提交 | 用户 | 时间
|
58d006
|
1 |
package com.mandi.fendan.controller; |
A |
2 |
|
|
3 |
import java.util.List; |
|
4 |
import java.util.Map; |
|
5 |
|
|
6 |
import javax.annotation.Resource; |
|
7 |
import javax.servlet.http.HttpServletRequest; |
|
8 |
import javax.servlet.http.HttpServletResponse; |
|
9 |
|
|
10 |
import org.apache.commons.lang3.StringUtils; |
|
11 |
import org.springframework.stereotype.Controller; |
|
12 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
13 |
import org.springframework.web.bind.annotation.RequestMethod; |
|
14 |
import org.springframework.web.bind.annotation.ResponseBody; |
|
15 |
|
|
16 |
import com.mandi.common.Jacksonmethod; |
|
17 |
import com.mandi.common.RequestParam; |
|
18 |
import com.mandi.common.SessionMethod; |
|
19 |
import com.mandi.dao.common.ObjectResult; |
|
20 |
import com.mandi.dao.common.PageRequest; |
|
21 |
import com.mandi.dao.common.PageResult; |
|
22 |
import com.mandi.fendan.mapper.Fd_fhdqMapper; |
|
23 |
import com.mandi.fendan.persist.Fd_Company; |
|
24 |
import com.mandi.fendan.service.IAreaService; |
|
25 |
import com.mandi.fendan.service.IFd_fhdqService; |
|
26 |
|
|
27 |
/** |
|
28 |
* 发货地区controller |
|
29 |
* |
|
30 |
*/ |
|
31 |
@Controller("fd_areacontroller") |
|
32 |
@RequestMapping(value="/area",method={RequestMethod.POST}) |
|
33 |
public class Fd_AreaController { |
|
34 |
|
|
35 |
@Resource |
|
36 |
private IAreaService arser; |
|
37 |
@Resource |
|
38 |
private IFd_fhdqService fhdqser; |
|
39 |
@Resource |
|
40 |
private Fd_fhdqMapper dqper; |
|
41 |
|
|
42 |
/** |
|
43 |
* 获取发货地址列表 |
|
44 |
* @param r |
|
45 |
* @param re |
|
46 |
* @return |
|
47 |
*/ |
|
48 |
@RequestMapping(value = "/getList.htm", method = {RequestMethod.POST }) |
|
49 |
@ResponseBody |
|
50 |
public String getList(HttpServletRequest r,HttpServletResponse re){ |
|
51 |
String search=RequestParam.getSqlString(r, "search"); |
|
52 |
int state=RequestParam.getInt(r, "state"); |
|
53 |
int page=RequestParam.getInt(r, "page"); |
|
54 |
int pagesize=RequestParam.getInt(r, "pagesize"); |
|
55 |
int pages=RequestParam.getInt(r, "pages"); |
|
56 |
PageRequest pr=new PageRequest(page, pagesize, null); |
|
57 |
pr.setNeedPages(pages>0?true:false); |
|
58 |
PageResult<Map<String, Object>> prr=fhdqser.getList(pr, search, state); |
|
59 |
String str=Jacksonmethod.tojson(prr, false); |
|
60 |
SessionMethod.writeresp(re, str); |
|
61 |
return null; |
|
62 |
} |
|
63 |
|
|
64 |
/** |
|
65 |
* 获得所有的物流公司 |
|
66 |
* @param r |
|
67 |
* @param re |
|
68 |
* @return |
|
69 |
*/ |
|
70 |
@RequestMapping(value = "/getallCMlist.htm", method = {RequestMethod.POST }) |
|
71 |
@ResponseBody |
|
72 |
public String getallcmList(HttpServletRequest r,HttpServletResponse re){ |
|
73 |
PageResult<Fd_Company> prr=arser.getallcmList(); |
|
74 |
String str=Jacksonmethod.tojson(prr, false); |
|
75 |
SessionMethod.writeresp(re, str); |
|
76 |
return null; |
|
77 |
} |
|
78 |
|
|
79 |
/** |
|
80 |
* 保存配货地址及物流公司关系表 |
|
81 |
* @param r |
|
82 |
* @param re |
|
83 |
* @return |
|
84 |
*/ |
|
85 |
@RequestMapping(value = "/saveItem.htm", method = {RequestMethod.POST }) |
|
86 |
@ResponseBody |
|
87 |
public String saveItem(HttpServletRequest r,HttpServletResponse re){ |
|
88 |
//GLXJ //是否修改下级 |
|
89 |
//物流公司编号 companyNos |
|
90 |
// code 地区编号 |
|
91 |
String fhdqNo =RequestParam.getSqlString(r, "code");//发货地区编号 |
|
92 |
String wlgsNos =RequestParam.getSqlString(r, "companyNos");//物流公司编号 物流公司1,物流公司2 |
|
93 |
String ywdyNo =RequestParam.getSqlString(r, "ywdyNo");//物流公司编号 物流公司1,物流公司2 |
|
94 |
boolean xgxj=RequestParam.getBool(r, "GLXJ"); |
|
95 |
ObjectResult<Boolean> or=new ObjectResult<Boolean>(); |
|
96 |
try { |
|
97 |
or=this.fhdqser.savewlgs_fhdq(fhdqNo, wlgsNos,ywdyNo,xgxj); |
|
98 |
} catch (Exception e) { |
|
99 |
e.printStackTrace(); |
|
100 |
or.setCode(1); |
|
101 |
or.setErrmsg(e.getMessage()); |
|
102 |
} |
|
103 |
String str=Jacksonmethod.tojson(or, false); |
|
104 |
SessionMethod.writeresp(re, str); |
|
105 |
return null; |
|
106 |
} |
|
107 |
|
|
108 |
|
|
109 |
// /** |
|
110 |
// * 保存配货地址及物流公司关系表 |
|
111 |
// * @param r |
|
112 |
// * @param re |
|
113 |
// * @return |
|
114 |
// */ |
|
115 |
// @RequestMapping(value = "/saveItem.htm", method = {RequestMethod.POST }) |
|
116 |
// @ResponseBody |
|
117 |
// public String saveItem(HttpServletRequest r,HttpServletResponse re){ |
|
118 |
// String name =RequestParam.getSqlString(r, "name");//名字 |
|
119 |
// String bianhao =RequestParam.getSqlString(r, "bianhao");//编号 |
|
120 |
// int jishu =RequestParam.getInt(r, "jishu");//级数 |
|
121 |
// String companyNos =RequestParam.getSqlString(r, "companyNos");//物流公司 |
|
122 |
// boolean GLXJ=RequestParam.getBool(r, "GLXJ");//关联操作下级地区 |
|
123 |
// ObjectResult<Boolean> or=new ObjectResult<Boolean>(); |
|
124 |
// try { |
|
125 |
// or=arser.saveItem(name, bianhao, jishu, companyNos,GLXJ); |
|
126 |
// } catch (Exception e) { |
|
127 |
// e.printStackTrace(); |
|
128 |
// or.setCode(1); |
|
129 |
// or.setErrmsg(e.getMessage()); |
|
130 |
// } |
|
131 |
// String str=Jacksonmethod.tojson(or, false); |
|
132 |
// SessionMethod.writeresp(re, str); |
|
133 |
// return null; |
|
134 |
// } |
|
135 |
|
|
136 |
|
|
137 |
// /** |
|
138 |
// * 删除配货地址及物流公司关系表 |
|
139 |
// * @param r |
|
140 |
// * @param re |
|
141 |
// * @return |
|
142 |
// */ |
|
143 |
// @RequestMapping(value = "/delItem.htm", method = {RequestMethod.POST }) |
|
144 |
// @ResponseBody |
|
145 |
// public String delItem(HttpServletRequest r,HttpServletResponse re){ |
|
146 |
// String bianhao =RequestParam.getSqlString(r, "bianhao");//编号 |
|
147 |
// ObjectResult<Boolean> or=new ObjectResult<Boolean>(); |
|
148 |
// try { |
|
149 |
// or=arser.delItem(bianhao); |
|
150 |
// } catch (Exception e) { |
|
151 |
// e.printStackTrace(); |
|
152 |
// or.setCode(1); |
|
153 |
// or.setErrmsg(e.getMessage()); |
|
154 |
// } |
|
155 |
// String str=Jacksonmethod.tojson(or, false); |
|
156 |
// SessionMethod.writeresp(re, str); |
|
157 |
// return null; |
|
158 |
// } |
|
159 |
|
|
160 |
/** |
|
161 |
* 获得配货地址及物流公司 |
|
162 |
* @param r |
|
163 |
* @param re |
|
164 |
* @return |
|
165 |
*/ |
|
166 |
@RequestMapping(value = "/getcmList.htm", method = {RequestMethod.POST }) |
|
167 |
@ResponseBody |
|
168 |
public String getcmList(HttpServletRequest r,HttpServletResponse re){ |
|
169 |
String bianhao =RequestParam.getSqlString(r, "bianhao");//编号 |
|
170 |
String ywdyNo =RequestParam.getSqlString(r, "ywdyNo");//业务单元 |
|
171 |
List<Fd_Company> cl=this.dqper.getCbyNo(bianhao,ywdyNo); |
|
172 |
ObjectResult<String> or=new ObjectResult<String>(); |
|
173 |
String resl=""; |
|
174 |
if(cl!=null){ |
|
175 |
for (Fd_Company fd_Company : cl) { |
|
176 |
if(StringUtils.isNotBlank(resl)){ |
|
177 |
resl+=","+fd_Company.getCompanyNo(); |
|
178 |
}else{ |
|
179 |
resl+=fd_Company.getCompanyNo(); |
|
180 |
} |
|
181 |
} |
|
182 |
} |
|
183 |
or.setCode(0); |
|
184 |
or.setItem(resl); |
|
185 |
String str=Jacksonmethod.tojson(or, false); |
|
186 |
SessionMethod.writeresp(re, str); |
|
187 |
return null; |
|
188 |
} |
|
189 |
} |