|
@@ -4,14 +4,17 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.io.FileUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.rongwei.bscommon.sys.dao.ZhcxPmqManagementDistributionDao;
|
|
|
+import com.rongwei.bscommon.sys.dao.ZhcxPmqManagementDistributionDetailDao;
|
|
|
import com.rongwei.bscommon.sys.service.*;
|
|
|
import com.rongwei.bscommon.sys.utils.CommonUtils;
|
|
|
import com.rongwei.bsentity.domain.ZhcxPmqManagementDistributionDetailDo;
|
|
|
import com.rongwei.bsentity.domain.ZhcxPmqManagementDistributionDo;
|
|
|
+import com.rongwei.bsentity.domain.ZhcxPmqManagementDo;
|
|
|
import com.rongwei.bsentity.domain.ZhcxPmqManagementRecoredDo;
|
|
|
import com.rongwei.bscommon.sys.dao.ZhcxPmqManagementRecoredDao;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.rongwei.bsentity.dto.ZhcxPmqManagementDistributionDTO;
|
|
|
+import com.rongwei.bsentity.dto.sqlServer.DistributionDTO;
|
|
|
import com.rongwei.bsentity.dto.sqlServer.JuFileInfoDto;
|
|
|
import com.rongwei.bsentity.dto.sqlServer.JutInfo;
|
|
|
import com.rongwei.bsentity.dto.sqlServer.RecoredDistributionDTO;
|
|
@@ -73,6 +76,12 @@ public class ZhcxPmqManagementRecoredServiceImpl extends ServiceImpl<ZhcxPmqMana
|
|
|
@Autowired
|
|
|
private SysFileItemService sysFileItemService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ZhcxPmqManagementDistributionDao distributionDao;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ZhcxPmqManagementDistributionDetailDao detailDao;
|
|
|
+
|
|
|
@Override
|
|
|
public R generateDistributionDetail(Map<String, Object> map) {
|
|
|
// 第二层主表id
|
|
@@ -584,6 +593,100 @@ public class ZhcxPmqManagementRecoredServiceImpl extends ServiceImpl<ZhcxPmqMana
|
|
|
return R.ok("批量派单成功");
|
|
|
}
|
|
|
|
|
|
+ @Override
|
|
|
+ public R updateBatchList2(DistributionDTO dto) {
|
|
|
+ String pids = dto.getList().get(0).getPid();
|
|
|
+ List<ZhcxPmqManagementDistributionDTO> list = dto.getList();
|
|
|
+ if(StringUtils.isEmpty(pids)){
|
|
|
+ return R.error("数据异常,请联系管理员");
|
|
|
+ }
|
|
|
+ String[] pidStr = pids.split(",");
|
|
|
+ // 第2.5层集合
|
|
|
+ List<ZhcxPmqManagementDistributionDo> resultList1 = new ArrayList<>();
|
|
|
+ // 第三层集合
|
|
|
+ List<ZhcxPmqManagementDistributionDetailDo> resultList2 = new ArrayList<>();
|
|
|
+ // 第一层主表ID
|
|
|
+ List<String> managementIds = new ArrayList<>();
|
|
|
+ // 第二层表数据
|
|
|
+ List<ZhcxPmqManagementRecoredDo> recoredList = new ArrayList<>();
|
|
|
+ for (String pid : pidStr) {
|
|
|
+ // 第二层数据
|
|
|
+ ZhcxPmqManagementRecoredDo recoredDo = this.getById(pid);
|
|
|
+ recoredList.add(recoredDo);
|
|
|
+ for (ZhcxPmqManagementDistributionDTO zhcxPmqManagementDistributionDTO : list) {
|
|
|
+ ZhcxPmqManagementDistributionDo result = new ZhcxPmqManagementDistributionDo();
|
|
|
+ String distributionId = SecurityUtil.getUUID();
|
|
|
+ // 可能是未派单,或者是部分派单的数据
|
|
|
+ String id = zhcxPmqManagementDistributionDTO.getId();
|
|
|
+ String[] ids = id.split(",");
|
|
|
+ if(ids.length > 0){
|
|
|
+ List<String> idList = Arrays.asList(id.split(","));
|
|
|
+ // 删除第2.5层 第三层数据
|
|
|
+ baseMapper.deleteDistributionById(idList);
|
|
|
+ baseMapper.deleteDistributionDetailById(idList);
|
|
|
+ }
|
|
|
+ // 第2.5层数据
|
|
|
+ result.setId(distributionId);
|
|
|
+ result.setPid(pid);
|
|
|
+ result.setProjectid(zhcxPmqManagementDistributionDTO.getProjectid());
|
|
|
+ result.setProjectname(zhcxPmqManagementDistributionDTO.getProjectname());
|
|
|
+ result.setProjectno(zhcxPmqManagementDistributionDTO.getProjectno());
|
|
|
+ result.setMachineid(zhcxPmqManagementDistributionDTO.getMachineid());
|
|
|
+ result.setMachineno(zhcxPmqManagementDistributionDTO.getMachineno());
|
|
|
+ result.setConfirmerid(zhcxPmqManagementDistributionDTO.getConfirmerid());
|
|
|
+ result.setConfirmer(zhcxPmqManagementDistributionDTO.getConfirmer());
|
|
|
+ // 关闭状态
|
|
|
+ if(!StringUtils.isEmpty(zhcxPmqManagementDistributionDTO.getStatus())) {
|
|
|
+ result.setStatus(zhcxPmqManagementDistributionDTO.getStatus());
|
|
|
+ }
|
|
|
+ if(!StringUtils.isEmpty(String.valueOf(recoredDo.getSeqno()))) {
|
|
|
+ result.setSerialnumber(String.valueOf(recoredDo.getSeqno()));
|
|
|
+ }
|
|
|
+ if(!StringUtils.isEmpty(zhcxPmqManagementDistributionDTO.getSupplement())) {
|
|
|
+ result.setSupplement(zhcxPmqManagementDistributionDTO.getSupplement());
|
|
|
+ }
|
|
|
+ result.setRemark("批量派单");
|
|
|
+ resultList1.add(result);
|
|
|
+ // 第三层数据
|
|
|
+ ZhcxPmqManagementDistributionDetailDo bean = new ZhcxPmqManagementDistributionDetailDo();
|
|
|
+ BeanUtil.copyProperties(result,bean);
|
|
|
+ bean.setDistributid(distributionId);
|
|
|
+ bean.setId(SecurityUtil.getUUID());
|
|
|
+ resultList2.add(bean);
|
|
|
+ }
|
|
|
+ managementIds.add(recoredDo.getPmqmid());
|
|
|
+ }
|
|
|
+ // 保存2.5层 3层数据
|
|
|
+ if(!resultList1.isEmpty()){
|
|
|
+ zhcxPmqManagementDistributionService.saveBatch(resultList1);
|
|
|
+ zhcxPmqManagementDistributionDetailService.saveBatch(resultList2);
|
|
|
+ // 需要去更新Recored派单状态和关闭状态
|
|
|
+ updateRecoredStatus(recoredList,managementIds);
|
|
|
+ }
|
|
|
+ return R.ok("批量派单成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ private void updateRecoredStatus(List<ZhcxPmqManagementRecoredDo> recoredList, List<String> managementIds) {
|
|
|
+ for (ZhcxPmqManagementRecoredDo recoredDo : recoredList) {
|
|
|
+ // 派单状态
|
|
|
+ String dispatchStatus = (distributionDao.selectListByPid(recoredDo.getId()).isEmpty())? "1" : "2";
|
|
|
+ // 关闭状态
|
|
|
+ ZhcxPmqManagementDo managementDo = zhcxPmqManagementService.getById(recoredDo.getPmqmid());
|
|
|
+ if(Objects.nonNull(managementDo.getProjectid())) {
|
|
|
+ String closeStatus = detailDao.getNotClosedStateInThirdFloorByPid(recoredDo.getId(), managementDo.getProjectid());
|
|
|
+ // 更新第二层表数据
|
|
|
+ recoredDo.setDispatchstatus(dispatchStatus);
|
|
|
+ recoredDo.setClosestatus(closeStatus);
|
|
|
+ this.updateById(recoredDo);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 异步去更新第一层状态
|
|
|
+ List<String> ids = managementIds.stream().distinct().collect(Collectors.toList());
|
|
|
+ if(!ids.isEmpty()){
|
|
|
+ managementMapService.updateClosedStateInFirstFloor(ids);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public R closedBatchList(RecoredDistributionDTO dto) {
|
|
|
// 关闭状态
|