0d15cb51c4aa8a81746ba74b42249d49a13b6e41.svn-base
12.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
/**
* Copyright © 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
*/
package com.thinkgem.jeesite.modules.reg.web.base;
import java.util.ArrayList;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
import com.thinkgem.jeesite.common.config.Global;
import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.common.utils.StringUtils;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBasePerson;
import com.thinkgem.jeesite.modules.reg.entity.base.RegBaseZsglb;
import com.thinkgem.jeesite.modules.reg.entity.bus.RegBusBdcqzsdjxx;
import com.thinkgem.jeesite.modules.reg.service.base.RegBaseZsglbService;
import com.thinkgem.jeesite.modules.sys.entity.User;
import com.thinkgem.jeesite.modules.sys.service.SystemService;
import com.thinkgem.jeesite.modules.sys.utils.UserUtils;
/**
* 证书信息维护Controller
* @author xuyg
* @version 2015-11-17
*/
@Controller
@RequestMapping(value = "${adminPath}/reg/base/regBaseZsglb")
public class RegBaseZsglbController extends BaseController {
@Autowired
private RegBaseZsglbService regBaseZsglbService;
@Autowired
private SystemService systemService;
@ModelAttribute
public RegBaseZsglb get(@RequestParam(required=false) String id) {
RegBaseZsglb entity = null;
if (StringUtils.isNotBlank(id)){
entity = regBaseZsglbService.get(id);
}
if (entity == null){
entity = new RegBaseZsglb();
}
return entity;
}
@RequiresPermissions("reg:base:regBaseZsglb:view")
@RequestMapping(value = {"list", ""})
public String list(RegBaseZsglb regBaseZsglb, HttpServletRequest request, HttpServletResponse response, Model model) {
String szwhrk = request.getParameter("szwhrk");
String creater1 = "";
String sqzsbs = request.getParameter("sqzsbs");
String all = request.getParameter("all");
if(StringUtils.isNotBlank(szwhrk)){
User user = UserUtils.getUser();
regBaseZsglb.setRemarks("1");//繕证维护入口选择编号
regBaseZsglb.setId(user.getId());
regBaseZsglb.setIsbf("0");
}else {
creater1 = regBaseZsglb.getCreater();
User creater = UserUtils.getByName(regBaseZsglb.getCreater());
if(creater != null){
regBaseZsglb.setCreater(creater.getId());
}
}
if(StringUtils.isNotBlank(all)){//全查标记,(D,J,NULL)
regBaseZsglb.setIsdj("all");
}
if(StringUtils.isNotBlank(sqzsbs)){//证书版式0是单一版,1是集成版,筛选只集成版带参数,未带参数为单一版
regBaseZsglb.setIsdj("jc");//jc集成
}
//-------------------------------记忆查询新增20180511
if(StringUtils.isNotBlank(request.getParameter("parazsbh"))){
regBaseZsglb.setZsbm(Long.parseLong(request.getParameter("parazsbh")));
}
if(StringUtils.isNotBlank(request.getParameter("parazslx"))){
regBaseZsglb.setZslx(request.getParameter("parazslx"));
}
if(StringUtils.isNotBlank(request.getParameter("paraywh"))){
regBaseZsglb.setYwh(request.getParameter("paraywh"));
}
if(StringUtils.isNotBlank(request.getParameter("parazt"))){
regBaseZsglb.setIsbf(request.getParameter("parazt"));
}
if(StringUtils.isNotBlank(request.getParameter("paraszr"))){
regBaseZsglb.setSzr(request.getParameter("paraszr"));
}
if(StringUtils.isNotBlank(request.getParameter("paraszbh"))){
regBaseZsglb.setSzzh(request.getParameter("paraszbh"));
}
if(StringUtils.isNotBlank(request.getParameter("paracjz"))){
regBaseZsglb.setCreater(request.getParameter("paracjz"));
}
//----------------------------------
//------------------------------------
Page<RegBaseZsglb> page = new Page<RegBaseZsglb>();
if(StringUtils.isNotBlank(request.getParameter("pageNo"))){
System.out.println(request.getParameter("pageNo"));
int no=Integer.parseInt(request.getParameter("pageNo"));
int size=Integer.parseInt(request.getParameter("pageSize"));
page = regBaseZsglbService.findPage(new Page<RegBaseZsglb>(no,size ), regBaseZsglb);
}
//------------------------------------
else{
page = regBaseZsglbService.findPage(new Page<RegBaseZsglb>(request, response), regBaseZsglb);
}
List<RegBaseZsglb> listregBaseZsglb = page.getList();
for(int i=0; i<listregBaseZsglb.size(); i++){
RegBaseZsglb temp = listregBaseZsglb.get(i);
User creater = systemService.getUser(temp.getCreateBy().getId());
temp.setCreater(creater.getName());//该笔业务的操作人员名称
}
page.setList(listregBaseZsglb);
model.addAttribute("page", page);
//-------------------------------记忆查询新增20180511
regBaseZsglb=new RegBaseZsglb();
if(StringUtils.isNotBlank(request.getParameter("parazsbh"))){
regBaseZsglb.setZsbm(Long.parseLong(request.getParameter("parazsbh")));
}
if(StringUtils.isNotBlank(request.getParameter("parazslx"))){
regBaseZsglb.setZslx(request.getParameter("parazslx"));
}
if(StringUtils.isNotBlank(request.getParameter("paraywh"))){
regBaseZsglb.setYwh(request.getParameter("paraywh"));
}
if(StringUtils.isNotBlank(request.getParameter("parazt"))){
regBaseZsglb.setIsbf(request.getParameter("parazt"));
}
if(StringUtils.isNotBlank(request.getParameter("paraszr"))){
regBaseZsglb.setSzr(request.getParameter("paraszr"));
}
if(StringUtils.isNotBlank(request.getParameter("paraszbh"))){
regBaseZsglb.setSzzh(request.getParameter("paraszbh"));
}
if(StringUtils.isNotBlank(request.getParameter("paracjz"))){
regBaseZsglb.setCreater(request.getParameter("paracjz"));
}
model.addAttribute("regBaseZsglb", regBaseZsglb);
//----------------------------------
//繕证维护入口进入证书编码列表
if(StringUtils.isNotBlank(szwhrk)){
model.addAttribute("szwhrk", szwhrk);
model.addAttribute("zslx", regBaseZsglb.getZslx());
return "modules/reg/base/regBaseZsglbszwhList";
}else {
regBaseZsglb.setCreater(creater1);
return "modules/reg/base/regBaseZsglbList";
}
}
@RequiresPermissions("reg:base:regBaseZsglb:view")
@RequestMapping(value = "alllist")
public String alllist(RegBaseZsglb regBaseZsglb, HttpServletRequest request, HttpServletResponse response, Model model) {
String creater1 = regBaseZsglb.getCreater();
User creater = UserUtils.getByName(regBaseZsglb.getCreater());
if(creater != null){
regBaseZsglb.setCreater(creater.getId());
}
Page<RegBaseZsglb> page = regBaseZsglbService.findPage(new Page<RegBaseZsglb>(request, response), regBaseZsglb);
List<RegBaseZsglb> listregBaseZsglb = page.getList();
for(int i=0; i<listregBaseZsglb.size(); i++){
RegBaseZsglb temp = listregBaseZsglb.get(i);
creater = systemService.getUser(temp.getCreateBy().getId());
temp.setCreater(creater.getName());//该笔业务的操作人员名称
}
page.setList(listregBaseZsglb);
model.addAttribute("page", page);
regBaseZsglb.setCreater(creater1);
return "modules/reg/base/regBaseZsglbAllList";
}
@RequiresPermissions("reg:base:regBaseZsglb:view")
@RequestMapping(value = "form")
public String form(RegBaseZsglb regBaseZsglb, Model model, HttpServletRequest request) {
String view = request.getParameter("VIEWS");
if(StringUtils.isNotBlank(view)){
model.addAttribute("VIEWS", view);
}
String update = request.getParameter("update");
if(StringUtils.isNotBlank(update)){
model.addAttribute("update", update);
}else {
regBaseZsglb.setZsbm((long)610000);
}
model.addAttribute("regBaseZsglb", regBaseZsglb);
return "modules/reg/base/regBaseZsglbForm";
}
@RequiresPermissions("reg:base:regBaseZsglb:view")
@RequestMapping(value = "formview")
public String formview(RegBaseZsglb regBaseZsglb, Model model, HttpServletRequest request) {
String view = request.getParameter("VIEWS");
if(StringUtils.isNotBlank(view)){
model.addAttribute("VIEWS", view);
}
String update = request.getParameter("update");
if(StringUtils.isNotBlank(update)){
model.addAttribute("update", update);
}else {
regBaseZsglb.setZsbm((long)610000);
}
model.addAttribute("regBaseZsglb", regBaseZsglb);
return "modules/reg/base/regBaseZsglbFormView";
}
/**
* 证书保存
* reg_base_zsglb
* @param regBaseZsglb
* @param model
* @param redirectAttributes
* @param request
* @return
*/
@RequiresPermissions("reg:base:regBaseZsglb:edit")
@RequestMapping(value = "save")
public String save(RegBaseZsglb regBaseZsglb, Model model, RedirectAttributes redirectAttributes, HttpServletRequest request) {
if (!beanValidator(model, regBaseZsglb)){
return form(regBaseZsglb, model, request);
}
String view = "redirect:"+Global.getAdminPath()+"/reg/base/regBaseZsglb/?repage";
if(StringUtils.isNotBlank(regBaseZsglb.getId())){
regBaseZsglbService.save(regBaseZsglb);
}else {
RegBaseZsglb regBaseZsglbtemp = new RegBaseZsglb();
regBaseZsglbtemp.setDelFlag("0");
regBaseZsglbtemp.setRemarks("0");
Long sl = regBaseZsglb.getZsbm()+regBaseZsglb.getZssl()-1;
regBaseZsglbtemp.setZsbm(regBaseZsglb.getZsbm());
regBaseZsglbtemp.setZssl(sl);
regBaseZsglbtemp.setZslx(regBaseZsglb.getZslx());
if("J".equals(regBaseZsglb.getIsdj())){
regBaseZsglbtemp.setIsdj("jc");
}
List<RegBaseZsglb> regBaseZsglblist = regBaseZsglbService.findListSave(regBaseZsglbtemp);
if(regBaseZsglblist.size() > 0){//数据库如果有本次添加的编码之一或者全部,不可以重复保存
addMessage(redirectAttributes, "保存证书信息失败,已经添加过该类型证书编码,不能重复添加!");
}else {
for (Long i = regBaseZsglb.getZsbm(); i <= sl; i++) {
regBaseZsglb.setZsbm(Long.valueOf(i));
regBaseZsglb.setId("");
regBaseZsglb.setIsbf("0");//未引用
regBaseZsglbService.save(regBaseZsglb);
}
addMessage(redirectAttributes, "保存证书信息成功");
}
}
return view;
}
@RequiresPermissions("reg:base:regBaseZsglb:edit")
@RequestMapping(value = "delete")
public String delete(RegBaseZsglb regBaseZsglb,RedirectAttributes redirectAttributes, HttpServletRequest request, HttpServletResponse response) {
String no = request.getParameter("pageNo");
String size = request.getParameter("pageSize");
System.out.println(no);
regBaseZsglbService.delete(regBaseZsglb);
addMessage(redirectAttributes, "删除证书信息成功");
//System.out.println("parazsbh="+request.getParameter("parazsbh")+"¶zslx="+request.getParameter("parazslx")+"¶ywh="+request.getParameter("paraywh")+"¶zt="+request.getParameter("parazt")+"¶szr="+request.getParameter("paraszr")+"¶szbh="+request.getParameter("paraszbh")+"¶cjz="+request.getParameter("paracjz")+"===="+no);
return "redirect:"+Global.getAdminPath()+"/reg/base/regBaseZsglb/list?parazsbh="+request.getParameter("parazsbh")+"¶zslx="+request.getParameter("parazslx")+"¶ywh="+request.getParameter("paraywh")+"¶zt="+request.getParameter("parazt")+"¶szr="+request.getParameter("paraszr")+"¶szbh="+request.getParameter("paraszbh")+"¶cjz="+request.getParameter("paracjz")+"&pageNo="+no+"&pageSize="+size;
}
/**
* 更新报废标记
* @param regBaseZsglb
* @param redirectAttributes
* @return
*/
@RequiresPermissions("reg:base:regBaseZsglb:edit")
@RequestMapping(value = "update")
public String update(RegBaseZsglb regBaseZsglb, RedirectAttributes redirectAttributes, HttpServletRequest request) {
String iszf = request.getParameter("isZf");
if(StringUtils.isNotBlank(iszf)){
if(iszf.equals("1")){
regBaseZsglb.setIsbf("2");//打报废标记
regBaseZsglbService.save(regBaseZsglb);
addMessage(redirectAttributes, "报废证书信息成功");
}else if(iszf.equals("0")){
regBaseZsglb.setSzr(null);
regBaseZsglb.setSzzh(null);
regBaseZsglb.setYwh(null);
regBaseZsglb.setBdcdyh(null);
regBaseZsglb.setIsbf("0");
regBaseZsglbService.save(regBaseZsglb);
addMessage(redirectAttributes, "恢复报废证书信息成功");
}
}
return "redirect:"+Global.getAdminPath()+"/reg/base/regBaseZsglb/?repage";
}
@RequiresPermissions("reg:base:regBaseZsglb:edit")
@RequestMapping("batchDeletes")
@ResponseBody
public ModelMap batchDeletes(HttpServletRequest request,HttpServletResponse response){
ModelMap model1 = new ModelMap();
String items = request.getParameter("delitems");
List<String> delList = new ArrayList<String>();
String[] strs = items.split(",");
for (String str : strs) {
delList.add(str);
}
model1.put("data", delList.size());
regBaseZsglbService.batchDeletes(delList);
return model1;
}
}