|
...
|
...
|
@@ -3,6 +3,7 @@ package com.lframework.xingyun.sc.impl.order; |
|
3
|
3
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
4
|
4
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
5
|
5
|
import com.github.pagehelper.PageInfo;
|
|
|
6
|
+import com.lframework.starter.bpm.service.FlowInstanceWrapperService;
|
|
6
|
7
|
import com.lframework.starter.web.core.components.security.SecurityUtil;
|
|
7
|
8
|
import com.lframework.starter.web.core.utils.*;
|
|
8
|
9
|
import com.lframework.starter.web.inner.entity.SysUser;
|
|
...
|
...
|
@@ -21,6 +22,7 @@ import com.lframework.xingyun.sc.service.order.PurchaseOrderInfoService; |
|
21
|
22
|
import com.lframework.xingyun.sc.service.order.PurchaseOrderLineService;
|
|
22
|
23
|
import com.lframework.xingyun.sc.vo.order.change.*;
|
|
23
|
24
|
import org.apache.commons.collections4.CollectionUtils;
|
|
|
25
|
+import org.apache.commons.lang3.BooleanUtils;
|
|
24
|
26
|
import org.apache.commons.lang3.StringUtils;
|
|
25
|
27
|
import org.springframework.transaction.annotation.Transactional;
|
|
26
|
28
|
import com.lframework.xingyun.sc.mappers.OrderSpecificationChangeRecordMapper;
|
|
...
|
...
|
@@ -35,12 +37,17 @@ import java.util.*; |
|
35
|
37
|
public class OrderSpecificationChangeRecordServiceImpl extends BaseMpServiceImpl<OrderSpecificationChangeRecordMapper, OrderSpecificationChangeRecord> implements OrderSpecificationChangeRecordService {
|
|
36
|
38
|
|
|
37
|
39
|
|
|
|
40
|
+ private static final String BPM_FLAG = "SPEC_CHANGE_SUBMIT";
|
|
|
41
|
+
|
|
|
42
|
+
|
|
38
|
43
|
@Resource
|
|
39
|
44
|
private PurchaseOrderLineService purchaseOrderLineService;
|
|
40
|
45
|
@Resource
|
|
41
|
46
|
private SysUserService sysUserService;
|
|
42
|
47
|
@Resource
|
|
43
|
48
|
private PurchaseOrderInfoService purchaseOrderInfoService;
|
|
|
49
|
+ @Resource
|
|
|
50
|
+ private FlowInstanceWrapperService flowInstanceWrapperService;
|
|
44
|
51
|
|
|
45
|
52
|
|
|
46
|
53
|
@Override
|
|
...
|
...
|
@@ -160,6 +167,8 @@ public class OrderSpecificationChangeRecordServiceImpl extends BaseMpServiceImpl |
|
160
|
167
|
purchaseOrderLineService.batchAdd(orderLineList);
|
|
161
|
168
|
// 更新订货单规格变更状态
|
|
162
|
169
|
purchaseOrderInfoService.updateSpecChangeStatus(vo.getOrderId(), OrderSpecChangeStatus.IN_PROGRESS.getCode());
|
|
|
170
|
+ // 发起流程
|
|
|
171
|
+ flowInstanceWrapperService.startInstance("SPEC_CHANGE_SUBMIT", id, BPM_FLAG, data);
|
|
163
|
172
|
|
|
164
|
173
|
OpLogUtil.setVariable("id", data.getId());
|
|
165
|
174
|
OpLogUtil.setExtra(vo);
|
|
...
|
...
|
@@ -203,6 +212,14 @@ public class OrderSpecificationChangeRecordServiceImpl extends BaseMpServiceImpl |
|
203
|
212
|
}
|
|
204
|
213
|
getBaseMapper().update(updateWrapper);
|
|
205
|
214
|
purchaseOrderLineService.batchUpdate(orderLineList);
|
|
|
215
|
+ // 重新发起流程
|
|
|
216
|
+ JsonUtil.parseObject(JsonUtil.toJsonString(data), PurchaseOrderLine.class);
|
|
|
217
|
+ Boolean output = data.getOutput();
|
|
|
218
|
+ if (BooleanUtils.isTrue(output)) {
|
|
|
219
|
+ flowInstanceWrapperService.startInstance("SPEC_CHANGE_CONFIRM", vo.getId(), BPM_FLAG, data);
|
|
|
220
|
+ } else {
|
|
|
221
|
+ flowInstanceWrapperService.startInstance("SPEC_CHANGE_SUBMIT", vo.getId(), BPM_FLAG, data);
|
|
|
222
|
+ }
|
|
206
|
223
|
|
|
207
|
224
|
OpLogUtil.setVariable("id", data.getId());
|
|
208
|
225
|
OpLogUtil.setExtra(vo);
|
|
...
|
...
|
@@ -234,9 +251,44 @@ public class OrderSpecificationChangeRecordServiceImpl extends BaseMpServiceImpl |
|
234
|
251
|
updateWrapper.set(OrderSpecificationChangeRecord::getStatus, status)
|
|
235
|
252
|
.eq(OrderSpecificationChangeRecord::getId, id);
|
|
236
|
253
|
getBaseMapper().update(updateWrapper);
|
|
237
|
|
- if (OrderSpecChangeStatus.CANCEL.getCode().equals(status)) {
|
|
|
254
|
+ if (OrderSpecChangeStatus.CANCEL.getCode().equals(status)
|
|
|
255
|
+ || OrderSpecChangeStatus.COMPLETED.getCode().equals(status)) {
|
|
238
|
256
|
// 更新订货单规格变更状态
|
|
239
|
257
|
purchaseOrderInfoService.updateSpecChangeStatus(record.getOrderId(), status);
|
|
240
|
258
|
}
|
|
241
|
259
|
}
|
|
|
260
|
+
|
|
|
261
|
+ @Override
|
|
|
262
|
+ public void reviewPass(String id) {
|
|
|
263
|
+ if (StringUtils.isBlank(id)) {
|
|
|
264
|
+ return;
|
|
|
265
|
+ }
|
|
|
266
|
+ OrderSpecificationChangeRecord record = findById(id);
|
|
|
267
|
+ if (record == null) {
|
|
|
268
|
+ throw new DefaultClientException("规格变更记录不存在!");
|
|
|
269
|
+ }
|
|
|
270
|
+ // 更新状态
|
|
|
271
|
+ updateStatus(id, "PASS");
|
|
|
272
|
+ // 更新订货单规格数据
|
|
|
273
|
+ purchaseOrderLineService.updateByChangeId(id, record.getOrderId());
|
|
|
274
|
+ }
|
|
|
275
|
+
|
|
|
276
|
+ @Override
|
|
|
277
|
+ public void reviewRefuse(String id, Boolean output) {
|
|
|
278
|
+ if (StringUtils.isBlank(id)) {
|
|
|
279
|
+ return;
|
|
|
280
|
+ }
|
|
|
281
|
+ OrderSpecificationChangeRecord record = findById(id);
|
|
|
282
|
+ if (record == null) {
|
|
|
283
|
+ throw new DefaultClientException("规格变更记录不存在!");
|
|
|
284
|
+ }
|
|
|
285
|
+ // 更新状态
|
|
|
286
|
+ LambdaUpdateWrapper<OrderSpecificationChangeRecord> updateWrapper = Wrappers.lambdaUpdate(OrderSpecificationChangeRecord.class);
|
|
|
287
|
+ updateWrapper.set(OrderSpecificationChangeRecord::getStatus, "REFUSE")
|
|
|
288
|
+ .eq(OrderSpecificationChangeRecord::getId, id);
|
|
|
289
|
+ if (output != null) {
|
|
|
290
|
+ updateWrapper.set(OrderSpecificationChangeRecord::getOutput, output);
|
|
|
291
|
+ }
|
|
|
292
|
+ getBaseMapper().update(updateWrapper);
|
|
|
293
|
+ }
|
|
242
|
294
|
} |
...
|
...
|
|