aaabee71257e7a9fa33df1579c6f74a525f8b487.svn-base
6.71 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
/**
* Copyright © 2015-2018 <a href="#">J-Site</a> All rights reserved.
*/
package com.thinkgem.jeesite.modules.sys.web.setdjxl;
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.utils.StringUtils;
import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.modules.sys.entity.Dict;
import com.thinkgem.jeesite.modules.sys.entity.Office;
import com.thinkgem.jeesite.modules.sys.entity.setdjxl.SysDjxlOffice;
import com.thinkgem.jeesite.modules.sys.service.DictService;
import com.thinkgem.jeesite.modules.sys.service.OfficeService;
import com.thinkgem.jeesite.modules.sys.service.setdjxl.SysDjxlOfficeService;
import com.thinkgem.jeesite.modules.sys.utils.DictUtils;
/**
* 初审机构设置业务登记类型Controller
* @author xuyg
* @version 2016-12-29
*/
@Controller
@RequestMapping(value = "${adminPath}/sys/setdjxl/sysDjxlOffice")
public class SysDjxlOfficeController extends BaseController {
@Autowired
private SysDjxlOfficeService sysDjxlOfficeService;
@Autowired
private DictService dictService;
@Autowired
private OfficeService officeService;
@ModelAttribute
public SysDjxlOffice get(@RequestParam(required=false) String id) {
SysDjxlOffice entity = null;
if (StringUtils.isNotBlank(id)){
entity = sysDjxlOfficeService.get(id);
}
if (entity == null){
entity = new SysDjxlOffice();
}
return entity;
}
// @RequiresPermissions("sys:setdjxl:sysDjxlOffice:view")
// @RequestMapping(value = "listofdjxlquery")
// public String listofdjxlquery(SysDjxlOffice sysDjxlOffice, HttpServletRequest request, HttpServletResponse response, Model model) {
// List<String> djxlStrList = new ArrayList<String>();
// //获取当前已经设置的机构登记小类;根据参数officeid
// List<SysDjxlOffice> djxlOfficeList = sysDjxlOfficeService.findList(sysDjxlOffice);
// int djxlcount = djxlOfficeList.size();
// if(djxlcount > 0){
// for(int i = 0; i < djxlcount; i++){
// djxlStrList.add(djxlOfficeList.get(i).getValue());
// }
// }
// model.addAttribute("djxlStrList", djxlStrList);
// //获取所有的登记小类
// List<Dict> djxlList = dictService.findDjxlList();
// model.addAttribute("djxlList", djxlList);
// model.addAttribute("officeid", sysDjxlOffice.getOfficeid());
// return "modules/sys/dictOfDjxlList";
// }
@RequiresPermissions("sys:setdjxl:sysDjxlOffice:view")
@RequestMapping(value = {"list", ""})
public String list(SysDjxlOffice sysDjxlOffice, HttpServletRequest request, HttpServletResponse response, Model model) {
Page<SysDjxlOffice> page = sysDjxlOfficeService.findPage(new Page<SysDjxlOffice>(request, response), sysDjxlOffice);
model.addAttribute("page", page);
return "modules/sys/setdjxl/sysDjxlOfficeList";
}
@RequiresPermissions("sys:dict:view")
@RequestMapping(value = "listofdjxl")
public String listofdjxl(SysDjxlOffice sysDjxlOffice, HttpServletRequest request, HttpServletResponse response, Model model) {
List<String> djxlStrList = new ArrayList<String>();
//获取当前已经设置的机构登记小类;根据参数officeid
List<SysDjxlOffice> djxlOfficeList = sysDjxlOfficeService.findList(sysDjxlOffice);
int djxlcount = djxlOfficeList.size();
if(djxlcount > 0){
for(int i = 0; i < djxlcount; i++){
djxlStrList.add(djxlOfficeList.get(i).getValue());
}
}
model.addAttribute("djxlStrList", djxlStrList);
//获取所有的登记小类
List<Dict> djxlList = dictService.findDjxlList();
model.addAttribute("djxlList", djxlList);
model.addAttribute("officeid", sysDjxlOffice.getOfficeid());
return "modules/sys/dictOfDjxlList";
}
@RequiresPermissions("sys:setdjxl:sysDjxlOffice:view")
@RequestMapping(value = "form")
public String form(SysDjxlOffice sysDjxlOffice, Model model) {
model.addAttribute("sysDjxlOffice", sysDjxlOffice);
return "modules/sys/setdjxl/sysDjxlOfficeForm";
}
@RequiresPermissions("sys:setdjxl:sysDjxlOffice:edit")
@RequestMapping(value = "save")
public String save(SysDjxlOffice sysDjxlOffice, Model model, RedirectAttributes redirectAttributes) {
if (!beanValidator(model, sysDjxlOffice)){
return form(sysDjxlOffice, model);
}
sysDjxlOfficeService.save(sysDjxlOffice);
addMessage(redirectAttributes, "保存审核机构设置业务登记类型成功");
return "redirect:"+Global.getAdminPath()+"/sys/setdjxl/sysDjxlOffice/?repage";
}
@RequestMapping(value = "savebat")
@ResponseBody
public ModelMap savebat(Model model, RedirectAttributes redirectAttributes, HttpServletRequest request) {
ModelMap modelMap = new ModelMap();
String chk_value_str = request.getParameter("chk_value_str");
String officeid = request.getParameter("officeid");
//每次保存之前先清理之前的office id 相关信息
SysDjxlOffice sysDjxlOfficeTmp = new SysDjxlOffice();
sysDjxlOfficeTmp.setOfficeid(officeid);
sysDjxlOfficeService.deleteByOfficeid(sysDjxlOfficeTmp);
String[] chk_value_str_arr = chk_value_str.split("-");
for(String chk_value_str_onearr : chk_value_str_arr){
SysDjxlOffice sysDjxlOffice = new SysDjxlOffice();
sysDjxlOffice.setOfficeid(officeid);
sysDjxlOffice.setValue(chk_value_str_onearr);
sysDjxlOffice.setLabel(DictUtils.getDictLabel(chk_value_str_onearr, "reg_bus_djxl", ""));
sysDjxlOfficeService.save(sysDjxlOffice);
}
//addMessage(redirectAttributes, "批量保存当前机构所属的业务登记小类成功!");
//return "redirect:"+Global.getAdminPath()+"/sys/setdjxl/sysDjxlOffice/?repage";
Office office = officeService.get(officeid);
model.addAttribute("office", office);
modelMap.put("issucess", "1");
return modelMap;
//return "modules/sys/officeForm";
}
@RequiresPermissions("sys:setdjxl:sysDjxlOffice:edit")
@RequestMapping(value = "delete")
public String delete(SysDjxlOffice sysDjxlOffice, RedirectAttributes redirectAttributes) {
sysDjxlOfficeService.delete(sysDjxlOffice);
addMessage(redirectAttributes, "删除初审机构设置业务登记类型成功");
return "redirect:"+Global.getAdminPath()+"/sys/setdjxl/sysDjxlOffice/?repage";
}
}