|
@@ -3,9 +3,13 @@ package com.lframework.xingyun.sc.impl.order; |
|
@@ -3,9 +3,13 @@ package com.lframework.xingyun.sc.impl.order; |
|
3
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
3
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
4
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
4
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
5
|
import com.github.pagehelper.PageInfo;
|
5
|
import com.github.pagehelper.PageInfo;
|
|
|
|
6
|
+import com.lframework.starter.bpm.dto.FlowTaskDto;
|
|
|
|
7
|
+import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper;
|
|
6
|
import com.lframework.starter.bpm.service.FlowInstanceWrapperService;
|
8
|
import com.lframework.starter.bpm.service.FlowInstanceWrapperService;
|
|
|
|
9
|
+import com.lframework.starter.bpm.vo.flow.task.QueryTodoTaskListVo;
|
|
7
|
import com.lframework.starter.common.utils.StringUtil;
|
10
|
import com.lframework.starter.common.utils.StringUtil;
|
|
8
|
import com.lframework.starter.web.core.components.redis.RedisHandler;
|
11
|
import com.lframework.starter.web.core.components.redis.RedisHandler;
|
|
|
|
12
|
+import com.lframework.starter.web.core.components.security.SecurityUtil;
|
|
9
|
import com.lframework.starter.web.core.utils.*;
|
13
|
import com.lframework.starter.web.core.utils.*;
|
|
10
|
import com.lframework.starter.web.inner.service.system.SysUserService;
|
14
|
import com.lframework.starter.web.inner.service.system.SysUserService;
|
|
11
|
import com.lframework.xingyun.basedata.service.customer.CustomerService;
|
15
|
import com.lframework.xingyun.basedata.service.customer.CustomerService;
|
|
@@ -29,6 +33,7 @@ import com.lframework.xingyun.sc.vo.order.CreatePurchaseOrderLineVo; |
|
@@ -29,6 +33,7 @@ import com.lframework.xingyun.sc.vo.order.CreatePurchaseOrderLineVo; |
|
29
|
import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderInfoVo;
|
33
|
import com.lframework.xingyun.sc.vo.order.QueryPurchaseOrderInfoVo;
|
|
30
|
import com.lframework.xingyun.sc.vo.order.UpdatePurchaseOrderLineVo;
|
34
|
import com.lframework.xingyun.sc.vo.order.UpdatePurchaseOrderLineVo;
|
|
31
|
import com.lframework.xingyun.sc.vo.order.change.*;
|
35
|
import com.lframework.xingyun.sc.vo.order.change.*;
|
|
|
|
36
|
+import org.apache.commons.collections4.CollectionUtils;
|
|
32
|
import org.apache.commons.lang3.BooleanUtils;
|
37
|
import org.apache.commons.lang3.BooleanUtils;
|
|
33
|
import org.apache.commons.lang3.StringUtils;
|
38
|
import org.apache.commons.lang3.StringUtils;
|
|
34
|
import org.springframework.transaction.annotation.Transactional;
|
39
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -37,6 +42,7 @@ import com.lframework.xingyun.sc.service.order.OrderChangeRecordService; |
|
@@ -37,6 +42,7 @@ import com.lframework.xingyun.sc.service.order.OrderChangeRecordService; |
|
37
|
import org.springframework.stereotype.Service;
|
42
|
import org.springframework.stereotype.Service;
|
|
38
|
|
43
|
|
|
39
|
import javax.annotation.Resource;
|
44
|
import javax.annotation.Resource;
|
|
|
|
45
|
+import java.math.BigDecimal;
|
|
40
|
import java.util.*;
|
46
|
import java.util.*;
|
|
41
|
import java.util.stream.Collectors;
|
47
|
import java.util.stream.Collectors;
|
|
42
|
|
48
|
|
|
@@ -63,6 +69,8 @@ public class OrderChangeRecordServiceImpl extends BaseMpServiceImpl<OrderChangeR |
|
@@ -63,6 +69,8 @@ public class OrderChangeRecordServiceImpl extends BaseMpServiceImpl<OrderChangeR |
|
63
|
private RedisHandler redisHandler;
|
69
|
private RedisHandler redisHandler;
|
|
64
|
@Resource
|
70
|
@Resource
|
|
65
|
private MessageHandler messageHandler;
|
71
|
private MessageHandler messageHandler;
|
|
|
|
72
|
+ @Resource
|
|
|
|
73
|
+ private FlowTaskWrapperMapper flowTaskWrapperMapper;
|
|
66
|
|
74
|
|
|
67
|
|
75
|
|
|
68
|
@Override
|
76
|
@Override
|
|
@@ -78,7 +86,21 @@ public class OrderChangeRecordServiceImpl extends BaseMpServiceImpl<OrderChangeR |
|
@@ -78,7 +86,21 @@ public class OrderChangeRecordServiceImpl extends BaseMpServiceImpl<OrderChangeR |
|
78
|
|
86
|
|
|
79
|
@Override
|
87
|
@Override
|
|
80
|
public List<OrderInfoChangeRecord> query(QueryPurchaseOrderInfoVo vo) {
|
88
|
public List<OrderInfoChangeRecord> query(QueryPurchaseOrderInfoVo vo) {
|
|
81
|
- return getBaseMapper().query(vo);
|
89
|
+ List<OrderInfoChangeRecord> recordList = getBaseMapper().query(vo);
|
|
|
|
90
|
+ if (CollectionUtils.isEmpty(recordList)) {
|
|
|
|
91
|
+ return Collections.emptyList();
|
|
|
|
92
|
+ }
|
|
|
|
93
|
+ // 判断当前人员是否有审核权限
|
|
|
|
94
|
+ // 获取当前人员的待办任务数据
|
|
|
|
95
|
+ List<String> businessIds = new ArrayList<>();
|
|
|
|
96
|
+ List<FlowTaskDto> flowTaskList = flowTaskWrapperMapper.queryTodoList(new QueryTodoTaskListVo(), SecurityUtil.getCurrentUser().getId());
|
|
|
|
97
|
+ if (CollectionUtils.isNotEmpty(flowTaskList)) {
|
|
|
|
98
|
+ businessIds = flowTaskList.stream().map(FlowTaskDto::getBusinessId).collect(Collectors.toList());
|
|
|
|
99
|
+ }
|
|
|
|
100
|
+ for (OrderInfoChangeRecord record : recordList) {
|
|
|
|
101
|
+ record.setShowExamine(businessIds.contains(record.getId()));
|
|
|
|
102
|
+ }
|
|
|
|
103
|
+ return recordList;
|
|
82
|
}
|
104
|
}
|
|
83
|
|
105
|
|
|
84
|
@Override
|
106
|
@Override
|
|
@@ -94,6 +116,16 @@ public class OrderChangeRecordServiceImpl extends BaseMpServiceImpl<OrderChangeR |
|
@@ -94,6 +116,16 @@ public class OrderChangeRecordServiceImpl extends BaseMpServiceImpl<OrderChangeR |
|
94
|
changeRecord.setBeforeChangeSpecList(beforeChangeList);
|
116
|
changeRecord.setBeforeChangeSpecList(beforeChangeList);
|
|
95
|
// 变更后
|
117
|
// 变更后
|
|
96
|
List<PurchaseOrderLine> afterChangeList = purchaseOrderLineService.listByOrderIds(Collections.singletonList(id), true);
|
118
|
List<PurchaseOrderLine> afterChangeList = purchaseOrderLineService.listByOrderIds(Collections.singletonList(id), true);
|
|
|
|
119
|
+ if (CollectionUtils.isNotEmpty(afterChangeList)) {
|
|
|
|
120
|
+ BigDecimal total = BigDecimal.ZERO;
|
|
|
|
121
|
+ for (PurchaseOrderLine afterChangeLine : afterChangeList) {
|
|
|
|
122
|
+ BigDecimal quantity = afterChangeLine.getQuantity();
|
|
|
|
123
|
+ if (quantity != null) {
|
|
|
|
124
|
+ total = total.add(quantity);
|
|
|
|
125
|
+ }
|
|
|
|
126
|
+ }
|
|
|
|
127
|
+ changeRecord.setAfterTotalQuantity(total.doubleValue());
|
|
|
|
128
|
+ }
|
|
97
|
changeRecord.setAfterChangeSpecList(afterChangeList);
|
129
|
changeRecord.setAfterChangeSpecList(afterChangeList);
|
|
98
|
|
130
|
|
|
99
|
return changeRecord;
|
131
|
return changeRecord;
|