|
@@ -1,5 +1,6 @@
|
1
|
1
|
package com.unis.module.coding.service.task;
|
2
|
2
|
|
|
3
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
3
|
4
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
4
|
5
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
5
|
6
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
@@ -17,6 +18,7 @@ import com.unis.module.coding.dal.dataobject.dk.DkDO;
|
17
|
18
|
import com.unis.module.coding.dal.dataobject.dwxx.DwxxDO;
|
18
|
19
|
import com.unis.module.coding.dal.dataobject.kqxx.KqxxDO;
|
19
|
20
|
import com.unis.module.coding.dal.dataobject.province.ProvinceDO;
|
|
21
|
+import com.unis.module.coding.dal.dataobject.users.UsersDO;
|
20
|
22
|
import com.unis.module.coding.dal.mysql.bank.BankMapper;
|
21
|
23
|
import com.unis.module.coding.dal.mysql.caxx.CaxxMapper;
|
22
|
24
|
import com.unis.module.coding.dal.mysql.cwxx.CwxxMapper;
|
|
@@ -25,6 +27,7 @@ import com.unis.module.coding.dal.mysql.dk.DkMapper;
|
25
|
27
|
import com.unis.module.coding.dal.mysql.dwxx.DwxxMapper;
|
26
|
28
|
import com.unis.module.coding.dal.mysql.kqxx.KqxxMapper;
|
27
|
29
|
import com.unis.module.coding.dal.mysql.province.ProvinceMapper;
|
|
30
|
+import com.unis.module.coding.dal.mysql.users.UsersMapper;
|
28
|
31
|
import com.unis.module.core.enums.ErrorCodeConstants;
|
29
|
32
|
import com.unis.module.core.enums.project.DeliveryHyState;
|
30
|
33
|
import com.unis.module.system.api.permission.PermissionApi;
|
|
@@ -71,6 +74,8 @@ public class TaskServiceImpl implements TaskService {
|
71
|
74
|
private CwxxYearMapper cwxxYearMapper;
|
72
|
75
|
@Resource
|
73
|
76
|
private BankMapper bankMapper;
|
|
77
|
+ @Resource
|
|
78
|
+ private UsersMapper usersMapper;
|
74
|
79
|
|
75
|
80
|
@Override
|
76
|
81
|
public IPage<TaskRespVO> getTaskList(TaskPageReqVO pageReqVO) {
|
|
@@ -84,6 +89,31 @@ public class TaskServiceImpl implements TaskService {
|
84
|
89
|
}
|
85
|
90
|
|
86
|
91
|
@Override
|
|
92
|
+ public IPage<TaskRespVO> getAllStoreroomList(TaskPageReqVO pageReqVO) {
|
|
93
|
+ // 根据角色不同,查询不同数据
|
|
94
|
+ addParamDeptIds(pageReqVO);
|
|
95
|
+
|
|
96
|
+ IPage<TaskRespVO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
|
97
|
+ return dkMapper.getAllStoreroomList(page, pageReqVO);
|
|
98
|
+ }
|
|
99
|
+
|
|
100
|
+ @Override
|
|
101
|
+ public IPage<TaskRespVO> getMyStoreroomList(TaskPageReqVO pageReqVO) {
|
|
102
|
+ Long loginUserId = SecurityFrameworkUtils.getLoginUserIdNotNull();
|
|
103
|
+ // 查询登录人角色标识
|
|
104
|
+ Set<String> roleCodes = permissionApi.getUserRoleCodeListByUserIdFromCache(loginUserId);
|
|
105
|
+
|
|
106
|
+ // 存粮人
|
|
107
|
+ if(!roleCodes.contains(RoleCodeEnum.GRAIN_DEPOSITOR.getCode())) {
|
|
108
|
+ throw exception(ErrorCodeConstants.APP_ACCOUNT_PERMISSION_DENIED);
|
|
109
|
+ }
|
|
110
|
+
|
|
111
|
+ pageReqVO.setCreator(String.valueOf(loginUserId));
|
|
112
|
+ IPage<TaskRespVO> page = new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize());
|
|
113
|
+ return dkMapper.getMyStoreroomList(page, pageReqVO);
|
|
114
|
+ }
|
|
115
|
+
|
|
116
|
+ @Override
|
87
|
117
|
@Transactional(rollbackFor = Exception.class)
|
88
|
118
|
public Boolean getTasks(TaskPageReqVO reqVO) {
|
89
|
119
|
|
|
@@ -120,6 +150,30 @@ public class TaskServiceImpl implements TaskService {
|
120
|
150
|
}
|
121
|
151
|
|
122
|
152
|
@Override
|
|
153
|
+ public Boolean getStoreroom(TaskPageReqVO reqVO) {
|
|
154
|
+
|
|
155
|
+ // 存粮人选定仓 新增数据 以仓房为单位
|
|
156
|
+ if(0 == reqVO.getClrsfxd()) {
|
|
157
|
+ //存粮人删除选定
|
|
158
|
+ reqVO.getCaIds().forEach(caId ->
|
|
159
|
+ usersMapper.delete(new QueryWrapper<UsersDO>().lambda()
|
|
160
|
+ .eq(UsersDO::getCreator, SecurityFrameworkUtils.getLoginUserId())
|
|
161
|
+ .eq(UsersDO::getCaId, caId)));
|
|
162
|
+ }else{
|
|
163
|
+ // 校验 是登录人可选的任务
|
|
164
|
+ List<TaskCaxxRespVO> taskCaxxRespVOS = verifyStoreroom(reqVO);
|
|
165
|
+
|
|
166
|
+ taskCaxxRespVOS.forEach(taskCaxxRespVO ->
|
|
167
|
+ usersMapper.insert(new UsersDO()
|
|
168
|
+ .setId(YitIdHelper.nextId())
|
|
169
|
+ .setKqId(taskCaxxRespVO.getKqId())
|
|
170
|
+ .setCaId(taskCaxxRespVO.getCaId())));
|
|
171
|
+ }
|
|
172
|
+
|
|
173
|
+ return true;
|
|
174
|
+ }
|
|
175
|
+
|
|
176
|
+ @Override
|
123
|
177
|
@Transactional(rollbackFor = Exception.class)
|
124
|
178
|
public Boolean hyKqxx(TaskPageReqVO reqVO) {
|
125
|
179
|
//校验是登录人可选的任务
|
|
@@ -165,6 +219,13 @@ public class TaskServiceImpl implements TaskService {
|
165
|
219
|
|
166
|
220
|
return new ArrayList<>();
|
167
|
221
|
}
|
|
222
|
+ @Override
|
|
223
|
+ public List<TaskCaxxRespVO> getCaxxByKqIdForClr(TaskPageReqVO reqVO) {
|
|
224
|
+ // 根据角色不同,查询不同数据
|
|
225
|
+ addParamDeptIds(reqVO);
|
|
226
|
+
|
|
227
|
+ return dkMapper.getCaxxByKqIdForClr(reqVO);
|
|
228
|
+ }
|
168
|
229
|
|
169
|
230
|
@Override
|
170
|
231
|
public TaskKqxxRespVO getKqxxByKqId(TaskPageReqVO reqVO) {
|
|
@@ -280,6 +341,20 @@ public class TaskServiceImpl implements TaskService {
|
280
|
341
|
throw exception(ErrorCodeConstants.APP_TASK_RECEIVE_ERROR);
|
281
|
342
|
}
|
282
|
343
|
}
|
|
344
|
+ private List<TaskCaxxRespVO> verifyStoreroom(TaskPageReqVO reqVO) {
|
|
345
|
+
|
|
346
|
+ TaskPageReqVO pageReqVO = new TaskPageReqVO();
|
|
347
|
+ pageReqVO.setCaIds(reqVO.getCaIds());
|
|
348
|
+ pageReqVO.setListType(TaskPageReqVO.LIST_TYPE_TASK3);
|
|
349
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
350
|
+
|
|
351
|
+ List<TaskCaxxRespVO> taskList = getCaxxByKqIdForClr(pageReqVO);
|
|
352
|
+
|
|
353
|
+ if(taskList.size() != reqVO.getKqIds().size()) {
|
|
354
|
+ throw exception(ErrorCodeConstants.APP_TASK_RECEIVE_ERROR);
|
|
355
|
+ }
|
|
356
|
+ return taskList;
|
|
357
|
+ }
|
283
|
358
|
|
284
|
359
|
private void addParamDeptIds(@NotNull TaskPageReqVO pageReqVO) {
|
285
|
360
|
|
|
@@ -291,10 +366,21 @@ public class TaskServiceImpl implements TaskService {
|
291
|
366
|
// 查询待核验列表
|
292
|
367
|
if(pageReqVO.getListType() == null){
|
293
|
368
|
throw exception(ErrorCodeConstants.APP_PARAM_ERROR);
|
294
|
|
- }else if(1 == pageReqVO.getListType()) {
|
|
369
|
+ }else if(TaskPageReqVO.LIST_TYPE_TASK1.equals(pageReqVO.getListType())) {
|
|
370
|
+ // 可选任务
|
295
|
371
|
pageReqVO.setHyState(DeliveryHyState.WAIT.getCode());
|
296
|
|
- } else if(2 == pageReqVO.getListType()) {
|
|
372
|
+ } else if(TaskPageReqVO.LIST_TYPE_TASK2.equals(pageReqVO.getListType())) {
|
|
373
|
+ // 已选任务
|
297
|
374
|
pageReqVO.setHyryId(loginUserId);
|
|
375
|
+ } else if(TaskPageReqVO.LIST_TYPE_TASK3.equals(pageReqVO.getListType())) {
|
|
376
|
+ // 存粮人可选列表
|
|
377
|
+ pageReqVO.setHyState(DeliveryHyState.YES_HY.getCode());
|
|
378
|
+ pageReqVO.setClrsfxd(0);
|
|
379
|
+ } else if(TaskPageReqVO.LIST_TYPE_TASK4.equals(pageReqVO.getListType())) {
|
|
380
|
+ // 存粮人已选列表
|
|
381
|
+ pageReqVO.setHyState(DeliveryHyState.YES_HY.getCode());
|
|
382
|
+ pageReqVO.setClrsfxd(1);
|
|
383
|
+ pageReqVO.setCreator(String.valueOf(loginUserId));
|
298
|
384
|
} else {
|
299
|
385
|
throw exception(ErrorCodeConstants.APP_PARAM_ERROR);
|
300
|
386
|
}
|
|
@@ -312,18 +398,12 @@ public class TaskServiceImpl implements TaskService {
|
312
|
398
|
}
|
313
|
399
|
return;
|
314
|
400
|
}
|
315
|
|
- // 银行核验人员
|
316
|
|
- if(roleCodes.contains(RoleCodeEnum.VERIFICATION_PERSONNEL.getCode())) {
|
|
401
|
+ // 银行核验人员 | 存粮人
|
|
402
|
+ if(roleCodes.contains(RoleCodeEnum.VERIFICATION_PERSONNEL.getCode()) ||
|
|
403
|
+ roleCodes.contains(RoleCodeEnum.GRAIN_DEPOSITOR.getCode())) {
|
317
|
404
|
if(loginUser != null) {
|
318
|
|
- String areaLevel = loginUser.getInfo().get("areaLevel");
|
319
|
|
- if("1".equals(areaLevel)) {
|
320
|
|
- pageReqVO.setSheng(loginUser.getInfo().get("sheng_code"));
|
321
|
|
- //银行需要查询自己银行选定的
|
322
|
|
- pageReqVO.setDeptId(loginUser.getInfo().get("deptId"));
|
323
|
|
- pageReqVO.setTableName(TaskPageReqVO.TABLE_NAME_DELIVERY_BANK);
|
324
|
|
- } else {
|
325
|
|
- throw exception(ErrorCodeConstants.APP_ACCOUNT_PERMISSION_DENIED);
|
326
|
|
- }
|
|
405
|
+ pageReqVO.setDeptId(loginUser.getInfo().get("deptId"));
|
|
406
|
+ pageReqVO.setTableName(TaskPageReqVO.TABLE_NAME_DELIVERY_BANK);
|
327
|
407
|
}
|
328
|
408
|
return;
|
329
|
409
|
}
|