|
@@ -4,7 +4,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
4
|
4
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
5
|
5
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
6
|
6
|
import com.njyunzhi.pet_identity.common.BaseController;
|
|
7
|
+import com.njyunzhi.pet_identity.common.Constants;
|
7
|
8
|
import com.njyunzhi.pet_identity.common.ResponseBean;
|
|
9
|
+import com.njyunzhi.pet_identity.common.StringUtils;
|
|
10
|
+import com.njyunzhi.pet_identity.entity.SysUser;
|
|
11
|
+import com.njyunzhi.pet_identity.entity.TaPerson;
|
|
12
|
+import com.njyunzhi.pet_identity.vo.AuditParam;
|
|
13
|
+import com.njyunzhi.pet_identity.vo.MakeCardParam;
|
8
|
14
|
import io.swagger.annotations.Api;
|
9
|
15
|
import io.swagger.annotations.ApiOperation;
|
10
|
16
|
import io.swagger.annotations.ApiParam;
|
|
@@ -20,6 +26,8 @@ import com.njyunzhi.pet_identity.service.ITaApplicationService;
|
20
|
26
|
import com.njyunzhi.pet_identity.entity.TaApplication;
|
21
|
27
|
import org.springframework.web.bind.annotation.RestController;
|
22
|
28
|
|
|
29
|
+import java.time.LocalDateTime;
|
|
30
|
+
|
23
|
31
|
/**
|
24
|
32
|
* <p>
|
25
|
33
|
* 我的申请 前端控制器
|
|
@@ -46,13 +54,55 @@ public class TaApplicationController extends BaseController {
|
46
|
54
|
* @param pageSize
|
47
|
55
|
* @return
|
48
|
56
|
*/
|
49
|
|
- @RequestMapping(value="/taApplication",method= RequestMethod.GET)
|
|
57
|
+ @RequestMapping(value="/admin/application",method= RequestMethod.GET)
|
50
|
58
|
@ApiOperation(value="列表", notes = "列表", httpMethod = "GET", response = ResponseBean.class)
|
51
|
59
|
public ResponseBean taApplicationList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
|
52
|
60
|
@ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
|
53
|
61
|
|
|
62
|
+ SysUser sysUser = currentUser();
|
|
63
|
+
|
54
|
64
|
IPage<TaApplication> pg = new Page<>(pageNum, pageSize);
|
55
|
65
|
QueryWrapper<TaApplication> queryWrapper = new QueryWrapper<>();
|
|
66
|
+ queryWrapper.gt("status", Constants.STATUS_DELETE);
|
|
67
|
+
|
|
68
|
+ // 审核人角色
|
|
69
|
+ if (Constants.USER_AUDITOR.equals(sysUser.getRoleName())) {
|
|
70
|
+ queryWrapper.ge("status", Constants.WORKFLOW_STATUS_PROCESSING);
|
|
71
|
+ queryWrapper.le("status", Constants.WORKFLOW_STATUS_AUDIT);
|
|
72
|
+ }
|
|
73
|
+
|
|
74
|
+ // 发证(制卡)人角色
|
|
75
|
+ if (Constants.USER_MAKER.equals(sysUser.getRoleName())) {
|
|
76
|
+ queryWrapper.ge("status", Constants.WORKFLOW_STATUS_AUDIT);
|
|
77
|
+ queryWrapper.le("status", Constants.WORKFLOW_STATUS_MADE);
|
|
78
|
+ }
|
|
79
|
+
|
|
80
|
+ queryWrapper.orderByAsc("status");
|
|
81
|
+ queryWrapper.orderByDesc("create_date");
|
|
82
|
+
|
|
83
|
+ IPage<TaApplication> result = iTaApplicationService.page(pg, queryWrapper);
|
|
84
|
+ return ResponseBean.success(result);
|
|
85
|
+ }
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+ /**
|
|
89
|
+ * 分页查询列表
|
|
90
|
+ * @param pageNum
|
|
91
|
+ * @param pageSize
|
|
92
|
+ * @return
|
|
93
|
+ */
|
|
94
|
+ @RequestMapping(value="/wx/{client}/application",method= RequestMethod.GET)
|
|
95
|
+ @ApiOperation(value="微信列表", notes = "微信列表", httpMethod = "GET", response = ResponseBean.class)
|
|
96
|
+ public ResponseBean wxList(@ApiParam("页码") @RequestParam(value ="pageNum",defaultValue = "1") Integer pageNum,
|
|
97
|
+ @ApiParam("单页数据量") @RequestParam(value ="pageSize",defaultValue = "10") Integer pageSize) throws Exception{
|
|
98
|
+
|
|
99
|
+ TaPerson taPerson = currentPerson();
|
|
100
|
+
|
|
101
|
+ IPage<TaApplication> pg = new Page<>(pageNum, pageSize);
|
|
102
|
+ QueryWrapper<TaApplication> queryWrapper = new QueryWrapper<>();
|
|
103
|
+ queryWrapper.gt("status", Constants.STATUS_DELETE);
|
|
104
|
+ queryWrapper.eq("person_id", taPerson.getPersonId());
|
|
105
|
+
|
56
|
106
|
queryWrapper.orderByDesc("create_date");
|
57
|
107
|
|
58
|
108
|
IPage<TaApplication> result = iTaApplicationService.page(pg, queryWrapper);
|
|
@@ -64,13 +114,27 @@ public class TaApplicationController extends BaseController {
|
64
|
114
|
* @param taApplication 实体对象
|
65
|
115
|
* @return
|
66
|
116
|
*/
|
67
|
|
- @RequestMapping(value="/taApplication",method= RequestMethod.POST)
|
68
|
|
- @ApiOperation(value="保存", notes = "保存", httpMethod = "POST", response = ResponseBean.class)
|
|
117
|
+ @RequestMapping(value="/wx/{clientId}/application",method= RequestMethod.POST)
|
|
118
|
+ @ApiOperation(value="微信申请", notes = "微信申请", httpMethod = "POST", response = ResponseBean.class)
|
69
|
119
|
public ResponseBean taApplicationAdd(@ApiParam("保存内容") @RequestBody TaApplication taApplication) throws Exception{
|
70
|
120
|
|
|
121
|
+ TaPerson taPerson = currentPerson();
|
|
122
|
+ if (StringUtils.isEmpty(taPerson.getPhone())) {
|
|
123
|
+ return ResponseBean.error("请先完善个人信息");
|
|
124
|
+ }
|
|
125
|
+
|
|
126
|
+ taApplication.setPersonId(taPerson.getPersonId());
|
|
127
|
+ taApplication.setPersonName(taPerson.getNickName());
|
|
128
|
+ taApplication.setPhone(taPerson.getPhone());
|
|
129
|
+ taApplication.setPayStatus(Constants.PAY_STATUS_READY);
|
|
130
|
+ taApplication.setStatus(Constants.WORKFLOW_STATUS_READY);
|
|
131
|
+ taApplication.setCreateDate(LocalDateTime.now());
|
|
132
|
+ taApplication.setVerifyStatus(Constants.AUDIT_STATUS_READY);
|
|
133
|
+ taApplication.setMakeStatus(Constants.MAKE_STATUS_READY);
|
|
134
|
+
|
71
|
135
|
if (iTaApplicationService.save(taApplication)){
|
72
|
136
|
return ResponseBean.success(taApplication);
|
73
|
|
- }else {
|
|
137
|
+ } else {
|
74
|
138
|
return ResponseBean.error("保存失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
|
75
|
139
|
}
|
76
|
140
|
}
|
|
@@ -79,10 +143,25 @@ public class TaApplicationController extends BaseController {
|
79
|
143
|
* 根据id删除对象
|
80
|
144
|
* @param id 实体ID
|
81
|
145
|
*/
|
82
|
|
- @RequestMapping(value="/taApplication/{id}", method= RequestMethod.DELETE)
|
83
|
|
- @ApiOperation(value="删除", notes = "删除", httpMethod = "DELETE", response = ResponseBean.class)
|
|
146
|
+ @RequestMapping(value="/wx/{clientId}/application/{id}", method= RequestMethod.DELETE)
|
|
147
|
+ @ApiOperation(value="微信删除", notes = "微信删除", httpMethod = "DELETE", response = ResponseBean.class)
|
84
|
148
|
public ResponseBean taApplicationDelete(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
|
85
|
|
- if(iTaApplicationService.removeById(id)){
|
|
149
|
+ TaPerson taPerson = currentPerson();
|
|
150
|
+
|
|
151
|
+ TaApplication taApplication = iTaApplicationService.getById(id);
|
|
152
|
+ if (null == taApplication || taApplication.getStatus() == Constants.STATUS_DELETE) {
|
|
153
|
+ return ResponseBean.error("未找到数据");
|
|
154
|
+ }
|
|
155
|
+
|
|
156
|
+ if (!taPerson.getPersonId().equals(taApplication.getPersonId())) {
|
|
157
|
+ return ResponseBean.error("无权操作");
|
|
158
|
+ }
|
|
159
|
+
|
|
160
|
+ if (taApplication.getStatus() >= Constants.WORKFLOW_STATUS_PROCESSING) {
|
|
161
|
+ return ResponseBean.error("流程已提审, 不能删除");
|
|
162
|
+ }
|
|
163
|
+
|
|
164
|
+ if(iTaApplicationService.removeLogicById(id)){
|
86
|
165
|
return ResponseBean.success("success");
|
87
|
166
|
}else {
|
88
|
167
|
return ResponseBean.error("删除失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
|
|
@@ -95,10 +174,36 @@ public class TaApplicationController extends BaseController {
|
95
|
174
|
* @param taApplication 实体对象
|
96
|
175
|
* @return
|
97
|
176
|
*/
|
98
|
|
- @RequestMapping(value="/taApplication/{id}",method= RequestMethod.PUT)
|
99
|
|
- @ApiOperation(value="更新", notes = "更新", httpMethod = "PUT", response = ResponseBean.class)
|
100
|
|
- public ResponseBean taApplicationUpdate(@ApiParam("对象ID") @PathVariable Integer id,
|
101
|
|
- @ApiParam("更新内容") @RequestBody TaApplication taApplication) throws Exception{
|
|
177
|
+ @RequestMapping(value="/admin/application/{id}/audit",method= RequestMethod.PUT)
|
|
178
|
+ @ApiOperation(value="审批", notes = "审批", httpMethod = "PUT", response = ResponseBean.class)
|
|
179
|
+ public ResponseBean audit(@ApiParam("对象ID") @PathVariable Integer id,
|
|
180
|
+ @ApiParam("更新内容") @RequestBody AuditParam auditParam) throws Exception{
|
|
181
|
+
|
|
182
|
+ SysUser sysUser = currentUser();
|
|
183
|
+ if (!checkRole(sysUser.getRoleName(), Constants.USER_AUDITOR)) {
|
|
184
|
+ return ResponseBean.error("暂无权限");
|
|
185
|
+ }
|
|
186
|
+
|
|
187
|
+ TaApplication taApplication = iTaApplicationService.getById(id);
|
|
188
|
+ if (null == taApplication || taApplication.getStatus() == Constants.STATUS_DELETE) {
|
|
189
|
+ return ResponseBean.error("未找到数据");
|
|
190
|
+ }
|
|
191
|
+
|
|
192
|
+ if (taApplication.getStatus() < Constants.WORKFLOW_STATUS_PROCESSING) {
|
|
193
|
+ return ResponseBean.error("用户未支付");
|
|
194
|
+ }
|
|
195
|
+ if (taApplication.getStatus() >= Constants.WORKFLOW_STATUS_AUDIT) {
|
|
196
|
+ return ResponseBean.error("当前记录已审批");
|
|
197
|
+ }
|
|
198
|
+
|
|
199
|
+ if (auditParam.getVerifyStatus() == Constants.AUDIT_STATUS_REJECT && StringUtils.isEmpty(auditParam.getRejectReason())) {
|
|
200
|
+ return ResponseBean.error("请填写驳回理由");
|
|
201
|
+ }
|
|
202
|
+
|
|
203
|
+ taApplication.setVerifyStatus(auditParam.getVerifyStatus());
|
|
204
|
+ taApplication.setVerifyDate(LocalDateTime.now());
|
|
205
|
+ taApplication.setVerifyUser(sysUser.getUserId());
|
|
206
|
+ taApplication.setVerifyUserName(sysUser.getUserName());
|
102
|
207
|
|
103
|
208
|
if (iTaApplicationService.updateById(taApplication)){
|
104
|
209
|
return ResponseBean.success(iTaApplicationService.getById(id));
|
|
@@ -107,13 +212,84 @@ public class TaApplicationController extends BaseController {
|
107
|
212
|
}
|
108
|
213
|
}
|
109
|
214
|
|
|
215
|
+ /**
|
|
216
|
+ * 修改对象
|
|
217
|
+ * @param id 实体ID
|
|
218
|
+ * @param taApplication 实体对象
|
|
219
|
+ * @return
|
|
220
|
+ */
|
|
221
|
+ @RequestMapping(value="/admin/application/{id}/make",method= RequestMethod.PUT)
|
|
222
|
+ @ApiOperation(value="发证", notes = "发证", httpMethod = "PUT", response = ResponseBean.class)
|
|
223
|
+ public ResponseBean makeCard(@ApiParam("对象ID") @PathVariable Integer id,
|
|
224
|
+ @ApiParam("更新内容") @RequestBody MakeCardParam makeCardParam) throws Exception{
|
|
225
|
+ SysUser sysUser = currentUser();
|
|
226
|
+ if (!checkRole(sysUser.getRoleName(), Constants.USER_MAKER)) {
|
|
227
|
+ return ResponseBean.error("暂无权限");
|
|
228
|
+ }
|
|
229
|
+
|
|
230
|
+ TaApplication taApplication = iTaApplicationService.getById(id);
|
|
231
|
+ if (null == taApplication || taApplication.getStatus() == Constants.STATUS_DELETE) {
|
|
232
|
+ return ResponseBean.error("未找到数据");
|
|
233
|
+ }
|
|
234
|
+
|
|
235
|
+ if (taApplication.getStatus() != Constants.WORKFLOW_STATUS_AUDIT && taApplication.getVerifyStatus() == Constants.AUDIT_STATUS_PASSED) {
|
|
236
|
+ return ResponseBean.error("申请未通过或状态不对");
|
|
237
|
+ }
|
|
238
|
+
|
|
239
|
+ if (taApplication.getApplyMethod() == Constants.APPLY_METHOD_EXPRESS) {
|
|
240
|
+ if (StringUtils.isEmpty(taApplication.getTrackingType()) || StringUtils.isEmpty(taApplication.getTrackingNo())) {
|
|
241
|
+ return ResponseBean.error("请填写快递信息");
|
|
242
|
+ }
|
|
243
|
+ }
|
|
244
|
+
|
|
245
|
+ taApplication.setMakeStatus(Constants.MAKE_STATUS_MADE);
|
|
246
|
+ taApplication.setMakeDate(LocalDateTime.now());
|
|
247
|
+ taApplication.setMakeUser(sysUser.getUserId());
|
|
248
|
+ taApplication.setMakeUserName(sysUser.getUserName());
|
|
249
|
+ taApplication.setTrackingType(makeCardParam.getTrackingType());
|
|
250
|
+ taApplication.setTrackingNo(makeCardParam.getTrackingNo());
|
|
251
|
+
|
|
252
|
+ if (iTaApplicationService.updateById(taApplication)){
|
|
253
|
+ return ResponseBean.success(iTaApplicationService.getById(id));
|
|
254
|
+ } else {
|
|
255
|
+ return ResponseBean.error("修改失败, 请重试", ResponseBean.ERROR_UNAVAILABLE);
|
|
256
|
+ }
|
|
257
|
+ }
|
|
258
|
+
|
110
|
259
|
/**
|
111
|
260
|
* 根据id查询对象
|
112
|
261
|
* @param id 实体ID
|
113
|
262
|
*/
|
114
|
|
- @RequestMapping(value="/taApplication/{id}",method= RequestMethod.GET)
|
|
263
|
+ @RequestMapping(value="/admin/application/{id}",method= RequestMethod.GET)
|
115
|
264
|
@ApiOperation(value="详情", notes = "详情", httpMethod = "GET", response = ResponseBean.class)
|
116
|
265
|
public ResponseBean taApplicationGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
|
117
|
|
- return ResponseBean.success(iTaApplicationService.getById(id));
|
|
266
|
+
|
|
267
|
+ TaApplication taApplication = iTaApplicationService.getById(id);
|
|
268
|
+ if (taApplication == null || taApplication.getStatus() == Constants.STATUS_DELETE) {
|
|
269
|
+ return ResponseBean.error("未找到数据");
|
|
270
|
+ }
|
|
271
|
+
|
|
272
|
+ return ResponseBean.success(taApplication);
|
|
273
|
+ }
|
|
274
|
+
|
|
275
|
+ /**
|
|
276
|
+ * 根据id查询对象
|
|
277
|
+ * @param id 实体ID
|
|
278
|
+ */
|
|
279
|
+ @RequestMapping(value="/wx/{clientId}/application/{id}",method= RequestMethod.GET)
|
|
280
|
+ @ApiOperation(value="微信详情", notes = "微信详情", httpMethod = "GET", response = ResponseBean.class)
|
|
281
|
+ public ResponseBean wxGet(@ApiParam("对象ID") @PathVariable Integer id) throws Exception{
|
|
282
|
+
|
|
283
|
+ TaApplication taApplication = iTaApplicationService.getById(id);
|
|
284
|
+ if (taApplication == null || taApplication.getStatus() == Constants.STATUS_DELETE) {
|
|
285
|
+ return ResponseBean.error("未找到数据");
|
|
286
|
+ }
|
|
287
|
+
|
|
288
|
+ TaPerson taPerson = currentPerson();
|
|
289
|
+ if (!taPerson.getPersonId().equals(taApplication.getPersonId())) {
|
|
290
|
+ return ResponseBean.error("未找到数据");
|
|
291
|
+ }
|
|
292
|
+
|
|
293
|
+ return ResponseBean.success(taApplication);
|
118
|
294
|
}
|
119
|
295
|
}
|