|
@@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.rongwei.bsentity.dto.ZhcxPmqManagementDistributionDTO;
|
|
|
import com.rongwei.bsentity.dto.sqlServer.JuFileInfoDto;
|
|
|
import com.rongwei.bsentity.dto.sqlServer.JutInfo;
|
|
|
+import com.rongwei.bsentity.dto.sqlServer.RecoredDistributionDTO;
|
|
|
import com.rongwei.rwadmincommon.system.vo.SysUserVo;
|
|
|
import com.rongwei.rwcommon.base.R;
|
|
|
import com.rongwei.rwcommon.utils.SecurityUtil;
|
|
@@ -574,4 +575,81 @@ public class ZhcxPmqManagementRecoredServiceImpl extends ServiceImpl<ZhcxPmqMana
|
|
|
}
|
|
|
return R.ok("批量派单成功");
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public R closedBatchList(RecoredDistributionDTO dto) {
|
|
|
+ // 关闭状态
|
|
|
+ String status = dto.getStatus();
|
|
|
+ // 派单状态
|
|
|
+ String dispatchstatus = dto.getDispatchstatus();
|
|
|
+ // recored表的id集合
|
|
|
+ List<String> ids = dto.getIds();
|
|
|
+ // 获取当前用户
|
|
|
+ SysUserVo user = CommonUtils.getCurrentUser();
|
|
|
+ /*SysUserVo user = new SysUserVo();
|
|
|
+ user.setId("222");
|
|
|
+ user.setName("xuan");*/
|
|
|
+ if(Objects.isNull(user) && !StringUtils.isEmpty(user.getId())){
|
|
|
+ return R.error("无法获取当前用户信息");
|
|
|
+ }
|
|
|
+ // 删除数据
|
|
|
+ baseMapper.deleteDistributionByPid(ids);
|
|
|
+ baseMapper.deleteDistributionDetailByPid(ids);
|
|
|
+ // 第2.5层集合
|
|
|
+ List<ZhcxPmqManagementDistributionDo> resultList1 = new ArrayList<>();
|
|
|
+ // 第三层集合
|
|
|
+ List<ZhcxPmqManagementDistributionDetailDo> resultList2 = new ArrayList<>();
|
|
|
+ // 第一层主表ID
|
|
|
+ List<String> managementIds = new ArrayList<>();
|
|
|
+ for (String id : ids) {
|
|
|
+ // 第二层数据
|
|
|
+ ZhcxPmqManagementRecoredDo recoredDo = this.getById(id);
|
|
|
+ // 去构建2.5层数据
|
|
|
+ List<ZhcxPmqManagementDistributionDo> list = baseMapper.getDistributionsByPidSimple(id);
|
|
|
+ for (ZhcxPmqManagementDistributionDo zhcxPmqManagementDistributionDo : list) {
|
|
|
+ if(!StringUtils.isEmpty(zhcxPmqManagementDistributionDo.getMachineid())) {
|
|
|
+ ZhcxPmqManagementDistributionDo result = new ZhcxPmqManagementDistributionDo();
|
|
|
+ String distributionId = SecurityUtil.getUUID();
|
|
|
+ result.setId(distributionId);
|
|
|
+ result.setPid(id);
|
|
|
+ result.setProjectid(zhcxPmqManagementDistributionDo.getProjectid());
|
|
|
+ result.setProjectname(zhcxPmqManagementDistributionDo.getProjectname());
|
|
|
+ result.setProjectno(zhcxPmqManagementDistributionDo.getProjectno());
|
|
|
+ result.setMachineid(zhcxPmqManagementDistributionDo.getMachineid());
|
|
|
+ result.setMachineno(zhcxPmqManagementDistributionDo.getMachineno());
|
|
|
+ result.setSerialnumber(zhcxPmqManagementDistributionDo.getSerialnumber());
|
|
|
+ result.setRemark("批量派单");
|
|
|
+ result.setConfirmerid(user.getId());
|
|
|
+ result.setConfirmer(user.getName());
|
|
|
+ result.setStatus(status); // 关闭状态
|
|
|
+ resultList1.add(result);
|
|
|
+ // 第三层数据
|
|
|
+ ZhcxPmqManagementDistributionDetailDo bean = new ZhcxPmqManagementDistributionDetailDo();
|
|
|
+ BeanUtil.copyProperties(result, bean);
|
|
|
+ bean.setDistributid(distributionId);
|
|
|
+ bean.setId(SecurityUtil.getUUID());
|
|
|
+ resultList2.add(bean);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 更新第二层表数据
|
|
|
+ recoredDo.setClosestatus(status);
|
|
|
+ recoredDo.setDispatchstatus(dispatchstatus);
|
|
|
+ this.updateById(recoredDo);
|
|
|
+ // 第一层主表id
|
|
|
+ managementIds.add(recoredDo.getPmqmid());
|
|
|
+ }
|
|
|
+ // 保存2.5层 3层数据
|
|
|
+ if(!resultList1.isEmpty()){
|
|
|
+ zhcxPmqManagementDistributionService.saveBatch(resultList1);
|
|
|
+ zhcxPmqManagementDistributionDetailService.saveBatch(resultList2);
|
|
|
+ }
|
|
|
+ if(!managementIds.isEmpty()){
|
|
|
+ List<String> managementids = managementIds.stream().distinct().collect(Collectors.toList());
|
|
|
+ if(!managementids.isEmpty()){
|
|
|
+ // 异步去更新第一层状态
|
|
|
+ managementMapService.updateClosedStateInFirstFloor(managementids);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return R.ok("批量操作成功");
|
|
|
+ }
|
|
|
}
|