|
@@ -1,6 +1,7 @@
|
|
|
package com.platform.service.check.impl;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.github.pagehelper.util.StringUtil;
|
|
|
import com.platform.common.bean.AbstractPageResultBean;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.platform.common.cache.DictCache;
|
|
@@ -607,13 +608,13 @@ public class CheckStandardServiceImpl extends BaseServiceImpl<CheckStandardMappe
|
|
|
// throw new BusinessException("未找到设备编号为"+vo.getSbNo()+"的编号!");
|
|
|
// }
|
|
|
// }
|
|
|
-// if (vo.getSbLevel().trim().equals("A级")){
|
|
|
-// sbInfo.setLevel(1);
|
|
|
-// }else if (vo.getSbLevel().trim().equals("B级")){
|
|
|
-// sbInfo.setLevel(2);
|
|
|
-// }else if (vo.getSbLevel().trim().equals("C级")){
|
|
|
-// sbInfo.setLevel(3);
|
|
|
-// }
|
|
|
+ if (vo.getLevel().trim().equals("一级")){
|
|
|
+ checkStandard.setLevel(1);
|
|
|
+ }else if (vo.getLevel().trim().equals("二级")){
|
|
|
+ checkStandard.setLevel(2);
|
|
|
+ }else if (vo.getLevel().trim().equals("三级")){
|
|
|
+ checkStandard.setLevel(3);
|
|
|
+ }
|
|
|
// sbInfo.setLevel(vo.getSbLevel());
|
|
|
// SysUser user = new SysUser();
|
|
|
// user.setRealName(vo.getRepairUserName());
|
|
@@ -637,11 +638,9 @@ public class CheckStandardServiceImpl extends BaseServiceImpl<CheckStandardMappe
|
|
|
}
|
|
|
checkStandard.setPeriodType(DictCache.getValueByLabel("PERIOD_TYPE",vo.getPeriodType()));
|
|
|
checkStandard.setCreatedTime(LocalDateTime.now());
|
|
|
- checkStandard.setCheckUserId(SecurityUtils.getUserInfo().getUserId());
|
|
|
checkStandard.setUpdateTime(LocalDateTime.now());
|
|
|
checkStandard.setUpdateUserId(SecurityUtils.getUserInfo().getUserId());
|
|
|
-
|
|
|
- checkStandard.setNo(vo.getNo());
|
|
|
+// checkStandard.setNo(vo.getNo());
|
|
|
checkStandard.setRequirement(vo.getRequirement());
|
|
|
checkStandard.setRemark(vo.getRemark());
|
|
|
checkStandard.setPeriod(Integer.parseInt(vo.getPeriod()));
|
|
@@ -650,11 +649,11 @@ public class CheckStandardServiceImpl extends BaseServiceImpl<CheckStandardMappe
|
|
|
checkStandard.setStandardHours(vo.getStandardHours());
|
|
|
|
|
|
if (checkStandard.getCheckUserType() == 1) {
|
|
|
- checkStandard.setSbId(sbInfo.getId());
|
|
|
+// checkStandard.setSbId(sbInfo.getId());
|
|
|
checkStandard.setCheckUserId(sbInfo.getSaveUser());
|
|
|
}
|
|
|
if (checkStandard.getCheckUserType() == 2 || checkStandard.getCheckUserType() == 3) {// 设备的维修员
|
|
|
- checkStandard.setSbId(sbInfo.getId());
|
|
|
+// checkStandard.setSbId(sbInfo.getId());
|
|
|
checkStandard.setCheckUserId(sbInfo.getRepairUser());
|
|
|
}
|
|
|
}
|
|
@@ -676,6 +675,10 @@ public class CheckStandardServiceImpl extends BaseServiceImpl<CheckStandardMappe
|
|
|
List<CheckStandard> updates = new ArrayList<>();
|
|
|
List<CheckStandard> adds = new ArrayList<>();
|
|
|
List<CheckStandard> deletes = new ArrayList<>();
|
|
|
+ String selectMaxNo = mapper.selectMaxNo();
|
|
|
+ if(StringUtils.isBlank(selectMaxNo)){
|
|
|
+ selectMaxNo = "00000";
|
|
|
+ }
|
|
|
for (ExportCheckStandardVO2 vo:list){
|
|
|
checkStandard = new CheckStandard();
|
|
|
checkStandard.setId(vo.getId());
|
|
@@ -683,8 +686,19 @@ public class CheckStandardServiceImpl extends BaseServiceImpl<CheckStandardMappe
|
|
|
if (StringUtils.isNotBlank(vo.getNo())){
|
|
|
|
|
|
//修改
|
|
|
+ if (StringUtil.isEmpty(vo.getSbNo())){
|
|
|
+ throw new BusinessException("保养标准新增需要填写设备新号");
|
|
|
+ }
|
|
|
+ SbInfo info = new SbInfo();
|
|
|
+ info.setNo(vo.getSbNo());
|
|
|
+ List<SbInfo> sbInfos = sbInfoMapper.select(info);
|
|
|
+ if (sbInfos!=null&&sbInfos.size()>0){
|
|
|
+ checkStandard.setSbId(sbInfos.get(0).getId());
|
|
|
+ }else {
|
|
|
+ throw new BusinessException("未找到对应设备!");
|
|
|
+ }
|
|
|
|
|
|
- packageSbInfoAndCheckStandard(sbInfo,vo,sbId,checkStandard);
|
|
|
+ packageSbInfoAndCheckStandard(sbInfos.get(0),vo,sbId,checkStandard);
|
|
|
updates.add(checkStandard);
|
|
|
// sbInfoMapper.updateByPrimaryKey(sbInfo);
|
|
|
// mapper.updateByPrimaryKey(checkStandard);
|
|
@@ -699,7 +713,26 @@ public class CheckStandardServiceImpl extends BaseServiceImpl<CheckStandardMappe
|
|
|
}else if (StringUtils.isNotBlank(vo.getSbNo()) && StringUtils.isBlank(vo.getId())){
|
|
|
//新增
|
|
|
|
|
|
- packageSbInfoAndCheckStandard(sbInfo,vo,sbId,checkStandard);
|
|
|
+ String newStr = selectMaxNo.replaceFirst("^0*", "");
|
|
|
+ int count = Integer.valueOf(newStr) + 1;
|
|
|
+ String str1 = String.format("%05d", count);
|
|
|
+ checkStandard.setNo(str1);
|
|
|
+ selectMaxNo = str1;
|
|
|
+ if (StringUtil.isEmpty(vo.getSbNo())){
|
|
|
+ throw new BusinessException("保养标准新增需要填写设备新号");
|
|
|
+ }
|
|
|
+ SbInfo info = new SbInfo();
|
|
|
+ info.setNo(vo.getSbNo());
|
|
|
+ List<SbInfo> sbInfos = sbInfoMapper.select(info);
|
|
|
+ if (sbInfos!=null&&sbInfos.size()>0){
|
|
|
+ checkStandard.setSbId(sbInfos.get(0).getId());
|
|
|
+ }else {
|
|
|
+ throw new BusinessException("未找到对应设备!");
|
|
|
+ }
|
|
|
+ checkStandard.setType(2);//保养标准
|
|
|
+ checkStandard.setEnable(1);
|
|
|
+ packageSbInfoAndCheckStandard(sbInfos.get(0),vo,sbId,checkStandard);
|
|
|
+ checkStandard.setId(IdGeneratorUtils.getObjectId());
|
|
|
adds.add(checkStandard);
|
|
|
}
|
|
|
|