|
...
|
...
|
@@ -8,6 +8,7 @@ import com.lframework.starter.bpm.dto.FlowTaskDto; |
|
8
|
8
|
import com.lframework.starter.bpm.mappers.FlowTaskWrapperMapper;
|
|
9
|
9
|
import com.lframework.starter.bpm.service.FlowInstanceWrapperService;
|
|
10
|
10
|
import com.lframework.starter.bpm.vo.flow.task.QueryTodoTaskListVo;
|
|
|
11
|
+import com.lframework.starter.common.utils.StringUtil;
|
|
11
|
12
|
import com.lframework.starter.web.core.components.security.SecurityUtil;
|
|
12
|
13
|
import com.lframework.xingyun.sc.entity.ContractDistributorLine;
|
|
13
|
14
|
import com.lframework.xingyun.sc.entity.ContractDistributorStandard;
|
|
...
|
...
|
@@ -22,15 +23,19 @@ import com.lframework.starter.web.inner.components.oplog.OtherOpLogType; |
|
22
|
23
|
import com.lframework.starter.web.core.components.resp.PageResult;
|
|
23
|
24
|
import com.lframework.starter.common.utils.ObjectUtil;
|
|
24
|
25
|
import com.lframework.starter.common.utils.Assert;
|
|
|
26
|
+import com.lframework.xingyun.sc.entity.ContractStdProcessingLine;
|
|
25
|
27
|
import com.lframework.xingyun.sc.enums.CustomerDevelopStatus;
|
|
26
|
28
|
import com.lframework.xingyun.sc.mappers.ContractDistributorStandardMapper;
|
|
27
|
29
|
import com.lframework.xingyun.sc.service.contract.ContractDistributorLineService;
|
|
28
|
30
|
import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService;
|
|
|
31
|
+import com.lframework.xingyun.sc.service.contract.ContractStdProcessingLineService;
|
|
29
|
32
|
import com.lframework.xingyun.sc.vo.contract.createVo.CreateContractDistributorLineVo;
|
|
30
|
33
|
import com.lframework.xingyun.sc.vo.contract.createVo.CreateContractDistributorStandardVo;
|
|
|
34
|
+import com.lframework.xingyun.sc.vo.contract.createVo.CreateContractStdProcessingLineVo;
|
|
31
|
35
|
import com.lframework.xingyun.sc.vo.contract.queryVo.QueryContractDistributorStandardVo;
|
|
32
|
36
|
import com.lframework.xingyun.sc.vo.contract.updateVo.UpdateContractDistributorLineVo;
|
|
33
|
37
|
import com.lframework.xingyun.sc.vo.contract.updateVo.UpdateContractDistributorStandardVo;
|
|
|
38
|
+import com.lframework.xingyun.sc.vo.contract.updateVo.UpdateContractStdProcessingLineVo;
|
|
34
|
39
|
import org.apache.commons.collections4.CollectionUtils;
|
|
35
|
40
|
import org.apache.commons.lang3.StringUtils;
|
|
36
|
41
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
...
|
...
|
@@ -64,6 +69,8 @@ public class ContractDistributorStandardServiceImpl extends |
|
64
|
69
|
private FlowInstanceWrapperService flowInstanceWrapperService;
|
|
65
|
70
|
@Resource
|
|
66
|
71
|
private FlowTaskWrapperMapper flowTaskWrapperMapper;
|
|
|
72
|
+ @Resource
|
|
|
73
|
+ private ContractStdProcessingLineService contractStdProcessingLineService;
|
|
67
|
74
|
|
|
68
|
75
|
|
|
69
|
76
|
@Override
|
|
...
|
...
|
@@ -118,6 +125,42 @@ public class ContractDistributorStandardServiceImpl extends |
|
118
|
125
|
@Override
|
|
119
|
126
|
public String create(CreateContractDistributorStandardVo vo) {
|
|
120
|
127
|
|
|
|
128
|
+ ContractDistributorStandard data = createContractBase(vo);
|
|
|
129
|
+
|
|
|
130
|
+ OpLogUtil.setVariable("id", data.getId());
|
|
|
131
|
+ OpLogUtil.setExtra(vo);
|
|
|
132
|
+
|
|
|
133
|
+ for (int i = 0; i < vo.getContractDistributorLineList().size(); i++) {
|
|
|
134
|
+ CreateContractDistributorLineVo createContractDistributorLineVo = vo.getContractDistributorLineList().get(i);
|
|
|
135
|
+ createContractDistributorLineVo.setContractId(data.getId());
|
|
|
136
|
+ createContractDistributorLineVo.setShowOrder(i);
|
|
|
137
|
+ contractDistributorLineService.create(createContractDistributorLineVo);
|
|
|
138
|
+ }
|
|
|
139
|
+
|
|
|
140
|
+ return data.getId();
|
|
|
141
|
+ }
|
|
|
142
|
+
|
|
|
143
|
+ @OpLog(type = OtherOpLogType.class, name = "新增合同,ID:{}", params = {"#id"})
|
|
|
144
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
145
|
+ @Override
|
|
|
146
|
+ public String createStdContract(CreateContractDistributorStandardVo vo) {
|
|
|
147
|
+
|
|
|
148
|
+ ContractDistributorStandard data = createContractBase(vo);
|
|
|
149
|
+
|
|
|
150
|
+ OpLogUtil.setVariable("id", data.getId());
|
|
|
151
|
+ OpLogUtil.setExtra(vo);
|
|
|
152
|
+
|
|
|
153
|
+ for (int i = 0; i < vo.getContractStdProcessingLineList().size(); i++) {
|
|
|
154
|
+ CreateContractStdProcessingLineVo createContractStdProcessingLineVo = vo.getContractStdProcessingLineList().get(i);
|
|
|
155
|
+ createContractStdProcessingLineVo.setContractId(data.getId());
|
|
|
156
|
+ createContractStdProcessingLineVo.setShowOrder(i);
|
|
|
157
|
+ contractStdProcessingLineService.create(createContractStdProcessingLineVo);
|
|
|
158
|
+ }
|
|
|
159
|
+
|
|
|
160
|
+ return data.getId();
|
|
|
161
|
+ }
|
|
|
162
|
+
|
|
|
163
|
+ private ContractDistributorStandard createContractBase(CreateContractDistributorStandardVo vo) {
|
|
121
|
164
|
ContractDistributorStandard data = new ContractDistributorStandard();
|
|
122
|
165
|
data.setId(IdUtil.getUUID());
|
|
123
|
166
|
data.setCode(vo.getCode());
|
|
...
|
...
|
@@ -154,18 +197,7 @@ public class ContractDistributorStandardServiceImpl extends |
|
154
|
197
|
data.setType(vo.getType());
|
|
155
|
198
|
|
|
156
|
199
|
getBaseMapper().insert(data);
|
|
157
|
|
-
|
|
158
|
|
- OpLogUtil.setVariable("id", data.getId());
|
|
159
|
|
- OpLogUtil.setExtra(vo);
|
|
160
|
|
-
|
|
161
|
|
- for (int i = 0; i < vo.getContractDistributorLineList().size(); i++) {
|
|
162
|
|
- CreateContractDistributorLineVo createContractDistributorLineVo = vo.getContractDistributorLineList().get(i);
|
|
163
|
|
- createContractDistributorLineVo.setContractId(data.getId());
|
|
164
|
|
- createContractDistributorLineVo.setShowOrder(i);
|
|
165
|
|
- contractDistributorLineService.create(createContractDistributorLineVo);
|
|
166
|
|
- }
|
|
167
|
|
-
|
|
168
|
|
- return data.getId();
|
|
|
200
|
+ return data;
|
|
169
|
201
|
}
|
|
170
|
202
|
|
|
171
|
203
|
@OpLog(type = OtherOpLogType.class, name = "修改合同,ID:{}", params = {"#id"})
|
|
...
|
...
|
@@ -214,6 +246,129 @@ public class ContractDistributorStandardServiceImpl extends |
|
214
|
246
|
|
|
215
|
247
|
getBaseMapper().update(updateWrapper);
|
|
216
|
248
|
|
|
|
249
|
+ if ("PROCESS_STD_AGMT".equals(data.getType())) {
|
|
|
250
|
+ dealWithStdProcessingLine(data, vo);
|
|
|
251
|
+ } else {
|
|
|
252
|
+ dealWithDistributorLine(data, vo);
|
|
|
253
|
+ }
|
|
|
254
|
+
|
|
|
255
|
+
|
|
|
256
|
+ OpLogUtil.setVariable("id", data.getId());
|
|
|
257
|
+ OpLogUtil.setExtra(vo);
|
|
|
258
|
+ }
|
|
|
259
|
+
|
|
|
260
|
+ private void dealWithStdProcessingLine(ContractDistributorStandard data, UpdateContractDistributorStandardVo vo) {
|
|
|
261
|
+ Wrapper<ContractStdProcessingLine> lineWrapper = Wrappers.lambdaQuery(ContractStdProcessingLine.class)
|
|
|
262
|
+ .eq(ContractStdProcessingLine::getContractId, data.getId());
|
|
|
263
|
+ List<ContractStdProcessingLine> oldContractStdProcessingLineList = contractStdProcessingLineService.list(lineWrapper);
|
|
|
264
|
+ List<String> oldlineIdList = CollectionUtils.emptyIfNull(oldContractStdProcessingLineList)
|
|
|
265
|
+ .stream()
|
|
|
266
|
+ .map(ContractStdProcessingLine::getId).collect(Collectors.toList());
|
|
|
267
|
+ List<String> existIdList = new ArrayList<>(oldlineIdList.size());
|
|
|
268
|
+ for (int i = 0; i < vo.getContractStdProcessingLineList().size(); i++) {
|
|
|
269
|
+ UpdateContractStdProcessingLineVo updateContractStdProcessingLineVo = vo.getContractStdProcessingLineList().get(i);
|
|
|
270
|
+ updateContractStdProcessingLineVo.setShowOrder(i);
|
|
|
271
|
+ if (StringUtils.isNotBlank(updateContractStdProcessingLineVo.getId())) {
|
|
|
272
|
+ existIdList.add(updateContractStdProcessingLineVo.getId());
|
|
|
273
|
+ contractStdProcessingLineService.update(updateContractStdProcessingLineVo);
|
|
|
274
|
+ } else {
|
|
|
275
|
+ CreateContractStdProcessingLineVo createContractStdProcessingLineVo = new CreateContractStdProcessingLineVo();
|
|
|
276
|
+ createContractStdProcessingLineVo.setContractId(data.getId());
|
|
|
277
|
+ if (!StringUtil.isBlank(updateContractStdProcessingLineVo.getRawProductId())) {
|
|
|
278
|
+ createContractStdProcessingLineVo.setRawProductId(updateContractStdProcessingLineVo.getRawProductId());
|
|
|
279
|
+ }
|
|
|
280
|
+ if (!StringUtil.isBlank(updateContractStdProcessingLineVo.getRawProductGrade())) {
|
|
|
281
|
+ createContractStdProcessingLineVo.setRawProductGrade(updateContractStdProcessingLineVo.getRawProductGrade());
|
|
|
282
|
+ }
|
|
|
283
|
+ if (!StringUtil.isBlank(updateContractStdProcessingLineVo.getIndustry())) {
|
|
|
284
|
+ createContractStdProcessingLineVo.setIndustry(updateContractStdProcessingLineVo.getIndustry());
|
|
|
285
|
+ }
|
|
|
286
|
+ if (!StringUtil.isBlank(updateContractStdProcessingLineVo.getQuality())) {
|
|
|
287
|
+ createContractStdProcessingLineVo.setQuality(updateContractStdProcessingLineVo.getQuality());
|
|
|
288
|
+ }
|
|
|
289
|
+ if (!StringUtil.isBlank(updateContractStdProcessingLineVo.getLossRate())) {
|
|
|
290
|
+ createContractStdProcessingLineVo.setLossRate(updateContractStdProcessingLineVo.getLossRate());
|
|
|
291
|
+ }
|
|
|
292
|
+ if (updateContractStdProcessingLineVo.getSupplyTime() != null) {
|
|
|
293
|
+ createContractStdProcessingLineVo.setSupplyTime(updateContractStdProcessingLineVo.getSupplyTime());
|
|
|
294
|
+ }
|
|
|
295
|
+ if (!StringUtil.isBlank(updateContractStdProcessingLineVo.getMaterialProductRatio())) {
|
|
|
296
|
+ createContractStdProcessingLineVo.setMaterialProductRatio(updateContractStdProcessingLineVo.getMaterialProductRatio());
|
|
|
297
|
+ }
|
|
|
298
|
+ if (!StringUtil.isBlank(updateContractStdProcessingLineVo.getMaterialProductRatioRemarks())) {
|
|
|
299
|
+ createContractStdProcessingLineVo.setMaterialProductRatioRemarks(updateContractStdProcessingLineVo.getMaterialProductRatioRemarks());
|
|
|
300
|
+ }
|
|
|
301
|
+ if (!StringUtil.isBlank(updateContractStdProcessingLineVo.getProductId())) {
|
|
|
302
|
+ createContractStdProcessingLineVo.setProductId(updateContractStdProcessingLineVo.getProductId());
|
|
|
303
|
+ }
|
|
|
304
|
+ if (!StringUtil.isBlank(updateContractStdProcessingLineVo.getProductGrade())) {
|
|
|
305
|
+ createContractStdProcessingLineVo.setProductGrade(updateContractStdProcessingLineVo.getProductGrade());
|
|
|
306
|
+ }
|
|
|
307
|
+ if (!StringUtil.isBlank(updateContractStdProcessingLineVo.getProductStatus())) {
|
|
|
308
|
+ createContractStdProcessingLineVo.setProductStatus(updateContractStdProcessingLineVo.getProductStatus());
|
|
|
309
|
+ }
|
|
|
310
|
+ if (updateContractStdProcessingLineVo.getProductQuantity() != null) {
|
|
|
311
|
+ createContractStdProcessingLineVo.setProductQuantity(updateContractStdProcessingLineVo.getProductQuantity());
|
|
|
312
|
+ }
|
|
|
313
|
+ if (updateContractStdProcessingLineVo.getThickness() != null) {
|
|
|
314
|
+ createContractStdProcessingLineVo.setThickness(updateContractStdProcessingLineVo.getThickness());
|
|
|
315
|
+ }
|
|
|
316
|
+ if (updateContractStdProcessingLineVo.getThicknessTolPos() != null) {
|
|
|
317
|
+ createContractStdProcessingLineVo.setThicknessTolPos(updateContractStdProcessingLineVo.getThicknessTolPos());
|
|
|
318
|
+ }
|
|
|
319
|
+ if (updateContractStdProcessingLineVo.getThicknessTolNeg() != null) {
|
|
|
320
|
+ createContractStdProcessingLineVo.setThicknessTolNeg(updateContractStdProcessingLineVo.getThicknessTolNeg());
|
|
|
321
|
+ }
|
|
|
322
|
+ if (updateContractStdProcessingLineVo.getWidth() != null) {
|
|
|
323
|
+ createContractStdProcessingLineVo.setWidth(updateContractStdProcessingLineVo.getWidth());
|
|
|
324
|
+ }
|
|
|
325
|
+ if (updateContractStdProcessingLineVo.getWidthTolPos() != null) {
|
|
|
326
|
+ createContractStdProcessingLineVo.setWidthTolPos(updateContractStdProcessingLineVo.getWidthTolPos());
|
|
|
327
|
+ }
|
|
|
328
|
+ if (updateContractStdProcessingLineVo.getWidthTolNeg() != null) {
|
|
|
329
|
+ createContractStdProcessingLineVo.setWidthTolNeg(updateContractStdProcessingLineVo.getWidthTolNeg());
|
|
|
330
|
+ }
|
|
|
331
|
+ if (updateContractStdProcessingLineVo.getLength() != null) {
|
|
|
332
|
+ createContractStdProcessingLineVo.setLength(updateContractStdProcessingLineVo.getLength());
|
|
|
333
|
+ }
|
|
|
334
|
+ if (updateContractStdProcessingLineVo.getLengthTolPos() != null) {
|
|
|
335
|
+ createContractStdProcessingLineVo.setLengthTolPos(updateContractStdProcessingLineVo.getLengthTolPos());
|
|
|
336
|
+ }
|
|
|
337
|
+ if (updateContractStdProcessingLineVo.getLengthTolNeg() != null) {
|
|
|
338
|
+ createContractStdProcessingLineVo.setLengthTolNeg(updateContractStdProcessingLineVo.getLengthTolNeg());
|
|
|
339
|
+ }
|
|
|
340
|
+ if (updateContractStdProcessingLineVo.getUnitPrice() != null) {
|
|
|
341
|
+ createContractStdProcessingLineVo.setUnitPrice(updateContractStdProcessingLineVo.getUnitPrice());
|
|
|
342
|
+ }
|
|
|
343
|
+ if (updateContractStdProcessingLineVo.getAmountExcludingTax() != null) {
|
|
|
344
|
+ createContractStdProcessingLineVo.setAmountExcludingTax(updateContractStdProcessingLineVo.getAmountExcludingTax());
|
|
|
345
|
+ }
|
|
|
346
|
+ if (updateContractStdProcessingLineVo.getTotalAmount() != null) {
|
|
|
347
|
+ createContractStdProcessingLineVo.setTotalAmount(updateContractStdProcessingLineVo.getTotalAmount());
|
|
|
348
|
+ }
|
|
|
349
|
+ if (updateContractStdProcessingLineVo.getDeliveryDate() != null) {
|
|
|
350
|
+ createContractStdProcessingLineVo.setDeliveryDate(updateContractStdProcessingLineVo.getDeliveryDate());
|
|
|
351
|
+ }
|
|
|
352
|
+ if (updateContractStdProcessingLineVo.getShowOrder() != null) {
|
|
|
353
|
+ createContractStdProcessingLineVo.setShowOrder(updateContractStdProcessingLineVo.getShowOrder());
|
|
|
354
|
+ }
|
|
|
355
|
+ if (!StringUtil.isBlank(updateContractStdProcessingLineVo.getItemId())) {
|
|
|
356
|
+ createContractStdProcessingLineVo.setItemId(updateContractStdProcessingLineVo.getItemId());
|
|
|
357
|
+ }
|
|
|
358
|
+
|
|
|
359
|
+ contractStdProcessingLineService.create(createContractStdProcessingLineVo);
|
|
|
360
|
+ }
|
|
|
361
|
+ }
|
|
|
362
|
+
|
|
|
363
|
+ List<String> needDeleteLineIdList = oldlineIdList.stream()
|
|
|
364
|
+ .filter(oldLineId -> !existIdList.contains(oldLineId))
|
|
|
365
|
+ .collect(Collectors.toList());
|
|
|
366
|
+ if (CollectionUtils.isNotEmpty(needDeleteLineIdList)) {
|
|
|
367
|
+ contractStdProcessingLineService.removeByIds(needDeleteLineIdList);
|
|
|
368
|
+ }
|
|
|
369
|
+ }
|
|
|
370
|
+
|
|
|
371
|
+ private void dealWithDistributorLine(ContractDistributorStandard data, UpdateContractDistributorStandardVo vo) {
|
|
217
|
372
|
Wrapper<ContractDistributorLine> lineWrapper = Wrappers.lambdaQuery(ContractDistributorLine.class)
|
|
218
|
373
|
.eq(ContractDistributorLine::getContractId, data.getId());
|
|
219
|
374
|
List<ContractDistributorLine> oldContractDistributorLineList = contractDistributorLineService.list(lineWrapper);
|
|
...
|
...
|
@@ -264,9 +419,6 @@ public class ContractDistributorStandardServiceImpl extends |
|
264
|
419
|
if (CollectionUtils.isNotEmpty(needDeleteLineIdList)) {
|
|
265
|
420
|
contractDistributorLineService.removeByIds(needDeleteLineIdList);
|
|
266
|
421
|
}
|
|
267
|
|
-
|
|
268
|
|
- OpLogUtil.setVariable("id", data.getId());
|
|
269
|
|
- OpLogUtil.setExtra(vo);
|
|
270
|
422
|
}
|
|
271
|
423
|
|
|
272
|
424
|
@OpLog(type = OtherOpLogType.class, name = "上传合同附件,ID:{}", params = {"#id"})
|
...
|
...
|
|