Newer
Older
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
package com.cesgroup.bdc.apply.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.cesgroup.bdc.apply.entity.ExpireApply;
import com.cesgroup.bdc.apply.entity.ExpireVo;
import com.cesgroup.bdc.apply.service.IExpireApplyService;
import com.cesgroup.bdc.attachment.entity.RePrintApply;
import com.cesgroup.bdc.mail.entity.MailReceive;
import com.cesgroup.bdc.mail.entity.MailSend;
import com.cesgroup.bdc.mail.service.IMailReceiveService;
import com.cesgroup.bdc.mail.service.IMailSendService;
import com.cesgroup.bdc.message.entity.MsgType;
import com.cesgroup.bdc.message.service.INewMessagesService;
import com.cesgroup.bdc.util.CuiPage;
import com.cesgroup.bdc.util.PageVo;
import com.cesgroup.bdc.util.PrimaryKey;
import com.cesgroup.kingkong.core.security.model.IOrganization;
import com.cesgroup.kingkong.core.security.model.IUser;
import com.cesgroup.kingkong.core.security.service.AuthsystemService;
import com.cesgroup.kingkong.web.BaseServiceController;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import javax.xml.ws.Action;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* <p>
* 延期申请 前端控制器
* </p>
*
* @author shen.shaohua
* @since 2019-07-17
*/
@Controller
@RequestMapping("/expire-apply")
public class ExpireApplyController extends BaseServiceController<ExpireApply, IExpireApplyService> {
@Autowired
private IMailReceiveService mailReceiveService;
@Autowired
private INewMessagesService messagesService;
@Autowired
private AuthsystemService authsystemService;
@Autowired
private IMailSendService mailSendService;
/**
* 延期申请页面
*
* @param mailReceiveId
* @return
*/
@GetMapping("/add/{mailReceiveId}")
public ModelAndView add(@PathVariable String mailReceiveId) {
ModelAndView mv = new ModelAndView("expireApply/add");
mv.addObject("mailReceiveId", mailReceiveId);
return mv;
}
/**
* 保存新增
*
* @param expireApply
* @param session
* @return
* @author: shen.shaohua
* @since: 2019/7/18 9:41
*/
@PostMapping("/add")
@ResponseBody
public Map<String, String> add(ExpireApply expireApply, HttpSession session) {
Map<String, String> mm = new HashMap<>();
String mailReceiveId = expireApply.getMailReceiveId();
MailReceive mailReceive = mailReceiveService.getById(mailReceiveId);
MailSend mailSend = mailSendService.getById(mailReceive.getMailSendId());
IUser uu = getUser();
IOrganization org = getOrg(session);
expireApply.setId(PrimaryKey.generateId());
expireApply.setApplyDate(new Date());
expireApply.setApplyUserId(uu.getId());
expireApply.setApplyUserName(uu.getUserName());
expireApply.setApplyDeptId(org.getId());
expireApply.setApplyDeptName(org.getName());
expireApply.setApproveResult("0");
expireApply.setApproveDeptId(mailSend.getDeptId());
expireApply.setApproveDeptName(mailSend.getDeptName());
getBaseService().save(expireApply);
messagesService.addNewMessage(mailSend.getDeptId(), this.getUser().getId(), mailReceive.getId(), MsgType.NEW_OVERDATE_MSG);
mm.put("code", "0");
mm.put("id", expireApply.getId());
return mm;
}
/**
* 过期数据申请列表
*
* @return
* @author: shen.shaohua
* @since: 2019/7/18 17:15
*/
@RequestMapping("/applyList")
public ModelAndView applyList() {
ModelAndView mv = new ModelAndView("expireApply/applyList");
return mv;
}
/**
* 发件夹列表分页查询
*
* @param pager
* @param request
* @return
* @author: shen.shaohua
* @since: 2019/7/12 0:22
*/
@RequestMapping("/applyListQuery")
@ResponseBody
public PageVo applyListQuery(CuiPage<ExpireApply> pager, HttpServletRequest request,HttpSession session) {
Map<String, Object> cm = new HashMap<>();
//IUser uu = getUser();
//cm.put("applyUserId", uu.getId());
cm.put("applyDeptId",getOrg(session));
IPage<ExpireApply> p = getBaseService().queryPage(pager, cm);
PageVo<ExpireApply> pv = PageVo.convertFromMybatisplusPage(p);
return pv;
}
/**
* 过期数据审批列表
*
* @return
* @author: shen.shaohua
* @since: 2019/7/18 18:18
*/
@RequestMapping("/approveList/{type}")
public ModelAndView approveList(@PathVariable String type) {
ModelAndView mv = new ModelAndView("expireApply/approveList");
mv.addObject("type", type);
return mv;
}
/**
* 发件夹列表分页查询
*
* @param pager
* @param request
* @return
* @author: shen.shaohua
* @since: 2019/7/12 0:22
*/
@RequestMapping("/approveListQuery")
@ResponseBody
public PageVo approveListQuery(CuiPage<ExpireApply> pager, String type, HttpServletRequest request) {
Map<String, Object> cm = new HashMap<>();
/*IUser uu = getUser();
cm.put("applyUserId", uu.getId());*/
if ("todo".equalsIgnoreCase(type)) { //未审批
cm.put("approveResult", "0");
} else if ("done".equalsIgnoreCase(type)) { //已审批
cm.put("type", type);
}
String deptId = authsystemService.getOrganizationByUserId(this.getUser().getId()).getId();
cm.put("deptId", deptId);
IPage<ExpireApply> p = getBaseService().queryPage(pager, cm);
PageVo<ExpireApply> pv = PageVo.convertFromMybatisplusPage(p);
return pv;
}
/**
* 过期数据待审批数量
*
* @param request
* @return
* @author: shen.shaohua
* @since: 2019/7/19 15:07
*/
@RequestMapping("/getApproveCount")
@ResponseBody
public Integer getApproveCount(HttpServletRequest request) {
QueryWrapper<ExpireApply> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("APPROVE_RESULT", "0");
int c = getBaseService().count(queryWrapper);
return c;
}
/**
* 延期申请审批页面
*
* @param id
* @return
* @author: shen.shaohua
* @since: 2019/7/19 16:40
*/
@GetMapping("/approve/{id}")
public ModelAndView approve(@PathVariable String id) {
ModelAndView mv = new ModelAndView("expireApply/approve");
mv.addObject("id", id);
return mv;
}
/**
* 审批
*
* @param expireApply
* @param session
* @return
* @author: shen.shaohua
* @since: 2019/7/19 17:11
*/
@PostMapping("/approve")
@ResponseBody
public Map<String, String> approve2(ExpireApply expireApply, HttpSession session) {
Map<String, String> mm = new HashMap<>();
ExpireApply record = getBaseService().getById(expireApply.getId());
IUser uu = getUser();
IOrganization org = getOrg(session);
record.setApproveDate(new Date());
record.setApproveUserId(uu.getId());
record.setApproveUserName(uu.getUserName());
record.setApproveDeptId(org.getId());
record.setApproveDeptName(org.getName());
record.setApproveResult(expireApply.getApproveResult());
record.setApproveDetail(expireApply.getApproveDetail());
getBaseService().updateById(record);
messagesService.addNewMessage(record.getApplyDeptId(), record.getApplyUserId(), record.getMailReceiveId(), MsgType.OVERDATE_RESULT_MSG);
messagesService.updateMessageStatus(record.getApproveDeptId(), record.getMailReceiveId(), MsgType.NEW_OVERDATE_MSG);
mm.put("code", "0");
mm.put("id", record.getId());
return mm;
}
/**
* @return org.springframework.web.servlet.ModelAndView
* @Author ChenKai
* @Description 系统管理-过期数据查询
* @Date 2019-07-25 9:25
*/
@RequestMapping("/queryApproveList")
public ModelAndView queryApproveList() {
ModelAndView mv = new ModelAndView("expireApply/queryApproveList");
return mv;
}
/**
* @param pager
* @param expireVo
* @param request
* @return com.cesgroup.bdc.util.PageVo
* @Author ChenKai
* @Description 系统管理-过期数据查询-条件查询
* @Date 2019-07-25 9:58
*/
@RequestMapping("/queryByKeyWords")
@ResponseBody
public PageVo queryByKeyWords(CuiPage<ExpireApply> pager, ExpireVo expireVo, HttpServletRequest request) {
IPage<ExpireApply> p = getBaseService().queryPageList(pager, expireVo);
PageVo<ExpireApply> pv = PageVo.convertFromMybatisplusPage(p);
return pv;
}
}