提交 | 用户 | 时间
|
58d006
|
1 |
package com.mandi.fendan.controller; |
A |
2 |
|
|
3 |
|
|
4 |
|
|
5 |
import java.util.Map; |
|
6 |
|
|
7 |
import javax.annotation.Resource; |
|
8 |
import javax.servlet.http.HttpServletRequest; |
|
9 |
import javax.servlet.http.HttpServletResponse; |
|
10 |
|
|
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.persist.Fd_Company; |
|
23 |
import com.mandi.fendan.service.Ifd_companyService; |
|
24 |
import com.mandi.system.persist.Login; |
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
@Controller("fd_company_con") |
|
29 |
@RequestMapping(value="/company",method={RequestMethod.POST}) |
|
30 |
public class Fd_CompanyController { |
|
31 |
|
|
32 |
@Resource |
|
33 |
private Ifd_companyService ics; |
|
34 |
|
|
35 |
@RequestMapping(value = "/getList.htm", method = {RequestMethod.POST }) |
|
36 |
@ResponseBody |
|
37 |
public String getList(HttpServletRequest r,HttpServletResponse re){ |
|
38 |
int page=RequestParam.getInt(r, "page"); |
|
39 |
int pagesize=RequestParam.getInt(r, "pagesize"); |
|
40 |
int pages=RequestParam.getInt(r, "pages"); |
|
41 |
String keyword=RequestParam.getSqlString(r, "searchword"); |
|
42 |
|
|
43 |
PageRequest pr=new PageRequest(page,pagesize,null); |
|
44 |
if(pages>0) |
|
45 |
pr.setNeedPages(true); |
|
46 |
else |
|
47 |
pr.setNeedPages(false); |
|
48 |
|
|
49 |
|
|
50 |
PageResult<Map<String, Object>> prr = ics.getlist(keyword, pr); |
|
51 |
SessionMethod.writeresp(re, Jacksonmethod.tojson(prr, false)); |
|
52 |
return null; |
|
53 |
} |
|
54 |
@RequestMapping(value = "/delItem.htm", method = {RequestMethod.POST}) |
|
55 |
@ResponseBody |
|
56 |
public String delItem(HttpServletRequest r,HttpServletResponse re){ |
|
57 |
String companyNo=RequestParam.getSqlString(r, "companyNo"); |
|
58 |
|
|
59 |
ObjectResult<Boolean> orr=new ObjectResult<Boolean>(); |
|
60 |
try { |
|
61 |
orr = ics.delCompany(companyNo); |
|
62 |
} catch (Exception e) { |
|
63 |
orr.setCode(1); |
|
64 |
orr.setErrmsg(e.getMessage()); |
|
65 |
} |
|
66 |
|
|
67 |
SessionMethod.writeresp(re, Jacksonmethod.tojson(orr, false)); |
|
68 |
return null; |
|
69 |
} |
|
70 |
@RequestMapping(value = "/saveItem.htm", method = {RequestMethod.POST }) |
|
71 |
@ResponseBody |
|
72 |
public String saveItem(HttpServletRequest r,HttpServletResponse re){ |
|
73 |
String id=RequestParam.getSqlString(r, "id"); |
|
74 |
String ywdyNos=RequestParam.getSqlString(r, "ywdyNos"); |
|
75 |
Fd_Company fdc=new Fd_Company(); |
|
76 |
fdc=RequestParam.getobj(r, fdc); |
|
77 |
fdc.setId(id); |
|
78 |
ObjectResult<Fd_Company> orr=new ObjectResult<Fd_Company>(); |
|
79 |
try { |
|
80 |
orr =ics.saveCompany(fdc,ywdyNos); |
|
81 |
} catch (Exception e) { |
|
82 |
orr.setCode(1); |
|
83 |
orr.setErrmsg(e.getMessage()); |
|
84 |
} |
|
85 |
SessionMethod.writeresp(re, Jacksonmethod.tojson(orr, false)); |
|
86 |
return null; |
|
87 |
} |
|
88 |
|
|
89 |
@RequestMapping(value = "/getItem.htm", method = {RequestMethod.POST }) |
|
90 |
@ResponseBody |
|
91 |
public String getItem(HttpServletRequest r,HttpServletResponse re){ |
|
92 |
String companyNo=RequestParam.getSqlString(r, "companyNo"); |
|
93 |
|
|
94 |
|
|
95 |
ObjectResult<Fd_Company> orr=new ObjectResult<Fd_Company>(); |
|
96 |
try { |
|
97 |
orr = ics.getByCompanyNo(companyNo); |
|
98 |
} catch (Exception e) { |
|
99 |
orr.setCode(1); |
|
100 |
orr.setErrmsg(e.getMessage()); |
|
101 |
} |
|
102 |
|
|
103 |
SessionMethod.writeresp(re, Jacksonmethod.tojson(orr, false)); |
|
104 |
return null; |
|
105 |
} |
|
106 |
|
|
107 |
/** |
|
108 |
* 根据登录账号获取厂区信息 |
|
109 |
* @param r |
|
110 |
* @param re |
|
111 |
* @return |
|
112 |
*/ |
|
113 |
@RequestMapping(value = "/getcqList.htm", method = {RequestMethod.POST }) |
|
114 |
@ResponseBody |
|
115 |
public String getcqList(HttpServletRequest r,HttpServletResponse re){ |
|
116 |
Login lg=SessionMethod.getlogin(r.getSession()); |
|
117 |
PageResult<Map<String, Object>> prr=new PageResult<Map<String, Object>>(); |
|
118 |
if(lg==null){ |
|
119 |
prr.setCode(1); |
|
120 |
prr.setErrmsg("请重新登录账号!"); |
|
121 |
}else{ |
|
122 |
prr=this.ics.getcqList(lg.getDepartno()); |
|
123 |
} |
|
124 |
SessionMethod.writeresp(re, Jacksonmethod.tojson(prr, false)); |
|
125 |
return null; |
|
126 |
} |
|
127 |
/** |
|
128 |
* 根据登录账号获取改变运输公司的厂区信息 |
|
129 |
* @param r |
|
130 |
* @param re |
|
131 |
* @return |
|
132 |
*/ |
|
133 |
@RequestMapping(value = "/getFdCqList.htm", method = {RequestMethod.POST }) |
|
134 |
@ResponseBody |
|
135 |
public String getFdCqList(HttpServletRequest r,HttpServletResponse re){ |
|
136 |
Login lg=SessionMethod.getlogin(r.getSession()); |
|
137 |
PageResult<Map<String, Object>> prr=new PageResult<Map<String, Object>>(); |
|
138 |
if(lg==null){ |
|
139 |
prr.setCode(1); |
|
140 |
prr.setErrmsg("请重新登录账号!"); |
|
141 |
}else{ |
|
142 |
prr=this.ics.getFdCqList(lg.getDepartno(),lg); |
|
143 |
} |
|
144 |
SessionMethod.writeresp(re, Jacksonmethod.tojson(prr, false)); |
|
145 |
return null; |
|
146 |
} |
|
147 |
|
|
148 |
|
|
149 |
} |