|
@@ -23,6 +23,7 @@ import org.springframework.stereotype.Service;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Objects;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -94,7 +95,6 @@ public class ZhcxPmqManagementDistributionServiceImpl extends ServiceImpl<ZhcxPm
|
|
|
updateList.add(detailDo);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
// 操作派单表
|
|
|
if(!addList.isEmpty()){
|
|
|
detailService.saveBatch(addList);
|
|
@@ -102,11 +102,40 @@ public class ZhcxPmqManagementDistributionServiceImpl extends ServiceImpl<ZhcxPm
|
|
|
if(!updateList.isEmpty()){
|
|
|
detailService.updateBatchById(updateList);
|
|
|
}
|
|
|
+ // 可能会涉及到改派
|
|
|
+ dispatchTochange(pid,baseList);
|
|
|
// 更新第二层的派单状态
|
|
|
baseMapper.updateDispatchStatus(pid);
|
|
|
return R.ok("派单成功");
|
|
|
}
|
|
|
|
|
|
+ private void dispatchTochange(String pid,List<ZhcxPmqManagementDistributionDo> baseList){
|
|
|
+ // baseList -> List<confirmerid>
|
|
|
+ List<String> confirmerids = baseList.stream().
|
|
|
+ map(ZhcxPmqManagementDistributionDo::getConfirmerid)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ LambdaQueryWrapper<ZhcxPmqManagementDistributionDetailDo> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ queryWrapper.eq(ZhcxPmqManagementDistributionDetailDo::getDeleted,"0")
|
|
|
+ .eq(ZhcxPmqManagementDistributionDetailDo::getPid,pid);
|
|
|
+ List<ZhcxPmqManagementDistributionDetailDo> detailDos = detailService.list(queryWrapper);
|
|
|
+ // 需要删除的数据集合
|
|
|
+ List<ZhcxPmqManagementDistributionDetailDo> resultList = new ArrayList<>();
|
|
|
+ if(detailDos.size() != baseList.size() && !detailDos.isEmpty()){
|
|
|
+ // 证明有改派的数据,找出改派的数据然后删了
|
|
|
+ for (ZhcxPmqManagementDistributionDetailDo detailDo : detailDos) {
|
|
|
+ if (confirmerids.contains(detailDo.getDistributid())) {
|
|
|
+ // 如果在confirmerids里面,
|
|
|
+ detailDo.setDeleted("1"); // 伪删
|
|
|
+ detailDo.setRemark("改派删除");
|
|
|
+ resultList.add(detailDo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(!resultList.isEmpty()){
|
|
|
+ detailService.updateBatchById(resultList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public R selectManifestList(String projectId) {
|
|
|
// 找到第一层符合要求的数据
|