|
...
|
...
|
@@ -34,6 +34,7 @@ import com.lframework.starter.web.core.components.resp.PageResult; |
|
34
|
34
|
import com.lframework.starter.common.utils.ObjectUtil;
|
|
35
|
35
|
import com.lframework.starter.common.utils.Assert;
|
|
36
|
36
|
import com.lframework.xingyun.sc.enums.CustomerDevelopStatus;
|
|
|
37
|
+import com.lframework.xingyun.sc.handlers.TransactorHandler;
|
|
37
|
38
|
import com.lframework.xingyun.sc.mappers.ContractDistributorStandardMapper;
|
|
38
|
39
|
import com.lframework.xingyun.sc.service.contract.ContractDistributorLineService;
|
|
39
|
40
|
import com.lframework.xingyun.sc.service.contract.ContractDistributorStandardService;
|
|
...
|
...
|
@@ -107,6 +108,8 @@ public class ContractDistributorStandardServiceImpl extends |
|
107
|
108
|
private SysUserDeptService sysUserDeptService;
|
|
108
|
109
|
@Resource
|
|
109
|
110
|
private PurchaseOrderLineService purchaseOrderLineService;
|
|
|
111
|
+ @Resource
|
|
|
112
|
+ private TransactorHandler transactorHandler;
|
|
110
|
113
|
|
|
111
|
114
|
@Override
|
|
112
|
115
|
public PageResult<ContractDistributorStandard> query(Integer pageIndex, Integer pageSize, QueryContractDistributorStandardVo vo) {
|
|
...
|
...
|
@@ -1527,9 +1530,10 @@ public class ContractDistributorStandardServiceImpl extends |
|
1527
|
1530
|
@Override
|
|
1528
|
1531
|
public void supplementContractSpecReminder() {
|
|
1529
|
1532
|
Wrapper<ContractDistributorStandard> wrapper = Wrappers.lambdaQuery(ContractDistributorStandard.class)
|
|
1530
|
|
- .in(ContractDistributorStandard::getFormalApproved, Arrays.asList("REFUSE", "CANCEL"))
|
|
1531
|
|
- .or()
|
|
1532
|
|
- .in(ContractDistributorStandard::getStandardApproved, Arrays.asList("REFUSE", "CANCEL"));
|
|
|
1533
|
+ .and(w -> w.eq(ContractDistributorStandard::getStatus, "FORMAL")
|
|
|
1534
|
+ .in(ContractDistributorStandard::getFormalApproved, Arrays.asList("REFUSE", "CANCEL")))
|
|
|
1535
|
+ .or(w -> w.eq(ContractDistributorStandard::getStatus, "STANDARD")
|
|
|
1536
|
+ .in(ContractDistributorStandard::getStandardApproved, Arrays.asList("REFUSE", "CANCEL")));
|
|
1533
|
1537
|
List<ContractDistributorStandard> contractDistributorStandardList = list(wrapper);
|
|
1534
|
1538
|
if (CollectionUtils.isEmpty(contractDistributorStandardList)) {
|
|
1535
|
1539
|
return;
|
|
...
|
...
|
@@ -1538,6 +1542,7 @@ public class ContractDistributorStandardServiceImpl extends |
|
1538
|
1542
|
Set<String> workshopIds = contractDistributorStandardList
|
|
1539
|
1543
|
.stream()
|
|
1540
|
1544
|
.map(ContractDistributorStandard::getWorkshopId)
|
|
|
1545
|
+ .filter(StringUtils::isNotBlank)
|
|
1541
|
1546
|
.collect(Collectors.toSet());
|
|
1542
|
1547
|
List<Workshop> workshopList = workshopService.listByIds(workshopIds);
|
|
1543
|
1548
|
Map<String, String> workshopIdAndCodeMap = CollectionUtils.emptyIfNull(workshopList)
|
|
...
|
...
|
@@ -1553,8 +1558,6 @@ public class ContractDistributorStandardServiceImpl extends |
|
1553
|
1558
|
jybzgCodeAndUserIdMap.put("efcjybzg", sysUserRoleService.listUserIdByRoleCodes(Collections.singletonList("efcjybzg")));
|
|
1554
|
1559
|
jybzgCodeAndUserIdMap.put("sfcjybzg", sysUserRoleService.listUserIdByRoleCodes(Collections.singletonList("sfcjybzg")));
|
|
1555
|
1560
|
jybzgCodeAndUserIdMap.put("ztcjybzg", sysUserRoleService.listUserIdByRoleCodes(Collections.singletonList("ztcjybzg")));
|
|
1556
|
|
-
|
|
1557
|
|
- List<String> bsczgUserIdList = sysUserRoleService.listUserIdByRoleCodes(Collections.singletonList("bsczg"));
|
|
1558
|
1561
|
contractDistributorStandardList.forEach(contractDistributorStandard -> {
|
|
1559
|
1562
|
try {
|
|
1560
|
1563
|
StringBuilder stringBuilder = new StringBuilder("您的");
|
|
...
|
...
|
@@ -1577,8 +1580,8 @@ public class ContractDistributorStandardServiceImpl extends |
|
1577
|
1580
|
stringBuilder.append("(");
|
|
1578
|
1581
|
LocalDate lastApprovedTime = LocalDate.now();
|
|
1579
|
1582
|
if ("FORMAL".equals(contractDistributorStandard.getStatus())) {
|
|
1580
|
|
- if (!"REFUSE".equals(contractDistributorStandard.getFormalApproved())
|
|
1581
|
|
- && !"CANCEL".equals(contractDistributorStandard.getFormalApproved())) {
|
|
|
1583
|
+ if (!Arrays.asList("REFUSE", "CANCEL").contains(contractDistributorStandard.getFormalApproved())
|
|
|
1584
|
+ || contractDistributorStandard.getFormalTime() == null) {
|
|
1582
|
1585
|
return;
|
|
1583
|
1586
|
}
|
|
1584
|
1587
|
|
|
...
|
...
|
@@ -1587,8 +1590,8 @@ public class ContractDistributorStandardServiceImpl extends |
|
1587
|
1590
|
}
|
|
1588
|
1591
|
|
|
1589
|
1592
|
if ("STANDARD".equals(contractDistributorStandard.getStatus())) {
|
|
1590
|
|
- if (!"REFUSE".equals(contractDistributorStandard.getStandardApproved())
|
|
1591
|
|
- && !"CANCEL".equals(contractDistributorStandard.getStandardApproved())) {
|
|
|
1593
|
+ if (!Arrays.asList("REFUSE", "CANCEL").contains(contractDistributorStandard.getStandardApproved())
|
|
|
1594
|
+ || contractDistributorStandard.getStandardTime() == null) {
|
|
1592
|
1595
|
return;
|
|
1593
|
1596
|
}
|
|
1594
|
1597
|
|
|
...
|
...
|
@@ -1598,22 +1601,32 @@ public class ContractDistributorStandardServiceImpl extends |
|
1598
|
1601
|
|
|
1599
|
1602
|
stringBuilder.append(",合同号:").append(contractDistributorStandard.getCode());
|
|
1600
|
1603
|
stringBuilder.append(",请尽快补充规范合同。");
|
|
1601
|
|
- List<String> userIdList = new ArrayList<>();
|
|
1602
|
|
- userIdList.add(contractDistributorStandard.getCreateById());
|
|
|
1604
|
+ Set<String> userIdSet = new LinkedHashSet<>();
|
|
|
1605
|
+ if (StringUtils.isNotBlank(contractDistributorStandard.getCreateById())) {
|
|
|
1606
|
+ userIdSet.add(contractDistributorStandard.getCreateById());
|
|
|
1607
|
+ }
|
|
1603
|
1608
|
|
|
1604
|
1609
|
LocalDate currentDate = LocalDate.now();
|
|
1605
|
1610
|
// 如果最后批准时间加3天还在当前时间之前,说明超过3天
|
|
1606
|
1611
|
if (lastApprovedTime.plusDays(3).isBefore(currentDate)) {
|
|
|
1612
|
+ List<String> officeManagerIds = transactorHandler.listTransactorsByRoleCode("bsczg",
|
|
|
1613
|
+ contractDistributorStandard.getCreateById());
|
|
|
1614
|
+ if (CollectionUtils.isNotEmpty(officeManagerIds)) {
|
|
|
1615
|
+ userIdSet.addAll(officeManagerIds);
|
|
|
1616
|
+ }
|
|
1607
|
1617
|
Optional.ofNullable(contractDistributorStandard.getWorkshopId())
|
|
1608
|
1618
|
.map(workshopIdAndCodeMap::get)
|
|
1609
|
1619
|
.filter(StringUtils::isNotBlank)
|
|
1610
|
1620
|
.map(workshopCodeAndJybzgCodeMap::get)
|
|
1611
|
1621
|
.filter(StringUtils::isNotBlank)
|
|
1612
|
1622
|
.map(jybzgCodeAndUserIdMap::get)
|
|
1613
|
|
- .ifPresent(userIdList::addAll);
|
|
|
1623
|
+ .ifPresent(userIdSet::addAll);
|
|
|
1624
|
+ }
|
|
1614
|
1625
|
|
|
1615
|
|
- userIdList.addAll(bsczgUserIdList);
|
|
|
1626
|
+ if (CollectionUtils.isEmpty(userIdSet)) {
|
|
|
1627
|
+ return;
|
|
1616
|
1628
|
}
|
|
|
1629
|
+ List<String> userIdList = new ArrayList<>(userIdSet);
|
|
1617
|
1630
|
|
|
1618
|
1631
|
// 发送消息
|
|
1619
|
1632
|
SysSiteMessageDto messageDto = new SysSiteMessageDto();
|
...
|
...
|
|