|
|
@@ -118,7 +118,6 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
private final CheckJobMapper checkJobMapper;
|
|
|
private final CheckStandardSpareMapper checkStandardSpareMapper;
|
|
|
|
|
|
-
|
|
|
private final String useArea = "5e64ac691c527828b2114da0";
|
|
|
private final String useCompany = "6063f905eb190003685af6d4";
|
|
|
private final String useProject = "6063f92ceb190003685af6d9";
|
|
|
@@ -131,20 +130,21 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
Weekend<SbInfo> weekend = new Weekend<>(SbInfo.class);
|
|
|
WeekendCriteria<SbInfo, Object> weekendCriteria = weekend.weekendCriteria();
|
|
|
weekendCriteria.andIn(SbInfo::getId, ids);
|
|
|
-// Weekend<CheckStandard> weekend3 = new Weekend<>(CheckStandard.class);
|
|
|
-// WeekendCriteria<CheckStandard, Object> weekendCriteria3 = weekend3.weekendCriteria();
|
|
|
-// weekendCriteria3.andIn(CheckStandard::getSbId, ids);.
|
|
|
- //删除保养标准
|
|
|
+ // Weekend<CheckStandard> weekend3 = new Weekend<>(CheckStandard.class);
|
|
|
+ // WeekendCriteria<CheckStandard, Object> weekendCriteria3 =
|
|
|
+ // weekend3.weekendCriteria();
|
|
|
+ // weekendCriteria3.andIn(CheckStandard::getSbId, ids);.
|
|
|
+ // 删除保养标准
|
|
|
Weekend<CheckStandard> weekend1 = new Weekend<>(CheckStandard.class);
|
|
|
WeekendCriteria<CheckStandard, Object> weekendCriteria1 = weekend1.weekendCriteria();
|
|
|
weekendCriteria1.andIn(CheckStandard::getSbId, ids);
|
|
|
- //删除关联备件
|
|
|
+ // 删除关联备件
|
|
|
List<String> checkIds = new ArrayList<>();
|
|
|
List<CheckStandard> checkStandards = checkStandardMapper.selectByExample(weekend1);
|
|
|
- for (CheckStandard standard:checkStandards){
|
|
|
+ for (CheckStandard standard : checkStandards) {
|
|
|
checkIds.add(standard.getId());
|
|
|
}
|
|
|
- if (checkIds!=null&&checkIds.size()>0) {
|
|
|
+ if (checkIds != null && checkIds.size() > 0) {
|
|
|
Weekend<CheckStandardSpare> weekend3 = new Weekend<>(CheckStandardSpare.class);
|
|
|
WeekendCriteria<CheckStandardSpare, Object> weekendCriteria3 = weekend3.weekendCriteria();
|
|
|
weekendCriteria3.andIn(CheckStandardSpare::getCheckId, checkIds);
|
|
|
@@ -152,7 +152,7 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
}
|
|
|
|
|
|
checkStandardMapper.deleteByExample(weekend1);
|
|
|
- //删除保养任务
|
|
|
+ // 删除保养任务
|
|
|
Weekend<CheckJob> weekend2 = new Weekend<>(CheckJob.class);
|
|
|
WeekendCriteria<CheckJob, Object> weekendCriteria2 = weekend2.weekendCriteria();
|
|
|
weekendCriteria2.andIn(CheckJob::getSbId, ids);
|
|
|
@@ -252,7 +252,7 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
List<Integer> statusList = new ArrayList<Integer>();
|
|
|
statusList.add(RepairApplicationFormStatusEnum.NOT_ALLOCATED.getValue());
|
|
|
statusList.add(RepairApplicationFormStatusEnum.PROCESSING.getValue());
|
|
|
- if(CollectionUtil.isNotEmpty(ids)){
|
|
|
+ if (CollectionUtil.isNotEmpty(ids)) {
|
|
|
weekendCriteria.andIn(RepairApplicationForm::getSbId, ids);
|
|
|
}
|
|
|
weekendCriteria.andIn(RepairApplicationForm::getStatus, statusList);
|
|
|
@@ -274,7 +274,8 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
}
|
|
|
}
|
|
|
if (find) {
|
|
|
- if (findRepair.getCategory() == null || findRepair.getCategory().equals(RepairApplicationFormCategoryEnum.PLAN.getValue())) {
|
|
|
+ if (findRepair.getCategory() == null
|
|
|
+ || findRepair.getCategory().equals(RepairApplicationFormCategoryEnum.PLAN.getValue())) {
|
|
|
repairSbInfoListYellow.add(sbInfo);
|
|
|
} else {
|
|
|
repairSbInfoListRed.add(sbInfo);
|
|
|
@@ -287,8 +288,8 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
SysFile sysFile = new SysFile();
|
|
|
sysFile.setType(SysFileTypeEnum.SB_AREA_IMAGES.getValue());
|
|
|
List<SysFile> fileList = sysFileMapper.select(sysFile);
|
|
|
- if(CollectionUtil.isNotEmpty(fileList)){
|
|
|
- for (SysFile item : fileList){
|
|
|
+ if (CollectionUtil.isNotEmpty(fileList)) {
|
|
|
+ for (SysFile item : fileList) {
|
|
|
SbInfoScreenVO vo = new SbInfoScreenVO();
|
|
|
vo.setMapName(item.getTargetId());
|
|
|
vo.setImageUrl(item.getUrl());
|
|
|
@@ -307,10 +308,10 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
return resultList;
|
|
|
}
|
|
|
|
|
|
- private List<SbInfoScreenDetailVO> splitList(String mapName,List<SbInfoScreenDetailVO> splitList){
|
|
|
+ private List<SbInfoScreenDetailVO> splitList(String mapName, List<SbInfoScreenDetailVO> splitList) {
|
|
|
List<SbInfoScreenDetailVO> resultList = ListUtils.newArrayList();
|
|
|
for (SbInfoScreenDetailVO sbInfo : splitList) {
|
|
|
- if(sbInfo.getMapName() != null && sbInfo.getMapName().equals(mapName)){
|
|
|
+ if (sbInfo.getMapName() != null && sbInfo.getMapName().equals(mapName)) {
|
|
|
resultList.add(sbInfo);
|
|
|
}
|
|
|
}
|
|
|
@@ -336,17 +337,21 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
if (model.getIsFinancing() == null) {
|
|
|
model.setIsFinancing(SbInfoFinancingEnum.NOT.getValue());
|
|
|
}
|
|
|
- /* SbModelVO sbModelVO = sbModelMapper.getById(model.getModelId());
|
|
|
- if (sbModelVO == null) {
|
|
|
- throw new BusinessException("找不到型号,modelID: " + model.getModelId());
|
|
|
- }*/
|
|
|
- /*model.setUnit(sbModelVO.getUnit());
|
|
|
- model.setTypeId(sbModelVO.getTypeId());
|
|
|
- model.setLevel(sbModelVO.getLevel());
|
|
|
- model.setProducerId(sbModelVO.getProducerId());
|
|
|
- model.setName(sbModelVO.getName());
|
|
|
- model.setModel(sbModelVO.getModel());
|
|
|
- model.setNameModel(sbModelVO.getNameModel());*/
|
|
|
+ /*
|
|
|
+ * SbModelVO sbModelVO = sbModelMapper.getById(model.getModelId());
|
|
|
+ * if (sbModelVO == null) {
|
|
|
+ * throw new BusinessException("找不到型号,modelID: " + model.getModelId());
|
|
|
+ * }
|
|
|
+ */
|
|
|
+ /*
|
|
|
+ * model.setUnit(sbModelVO.getUnit());
|
|
|
+ * model.setTypeId(sbModelVO.getTypeId());
|
|
|
+ * model.setLevel(sbModelVO.getLevel());
|
|
|
+ * model.setProducerId(sbModelVO.getProducerId());
|
|
|
+ * model.setName(sbModelVO.getName());
|
|
|
+ * model.setModel(sbModelVO.getModel());
|
|
|
+ * model.setNameModel(sbModelVO.getNameModel());
|
|
|
+ */
|
|
|
SbInfo exsit = this.selectByNo(model.getNo());
|
|
|
if (exsit != null) {
|
|
|
throw new BusinessException("编号已经存在,请调整");
|
|
|
@@ -359,7 +364,8 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
model.setIsChild(SbInfoShowEnum.NOT_SHOW.getValue());
|
|
|
}
|
|
|
// 保存二维码
|
|
|
- String path = CommonConstants.RESOURCE_PREFIX + "/png/" + DateUtil.formatDate(new Date()) + "/" + IdGeneratorUtils.getObjectId() + "/";
|
|
|
+ String path = CommonConstants.RESOURCE_PREFIX + "/png/" + DateUtil.formatDate(new Date()) + "/"
|
|
|
+ + IdGeneratorUtils.getObjectId() + "/";
|
|
|
String rootPath = environment.getProperty("upload.root-dir");
|
|
|
String filePath = rootPath + path;
|
|
|
String codePath = path + model.getId() + ".png";
|
|
|
@@ -410,7 +416,8 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
model.setIsFinancing(SbInfoFinancingEnum.NOT.getValue());
|
|
|
}
|
|
|
// 保存二维码
|
|
|
- String path = CommonConstants.RESOURCE_PREFIX + "/png/" + DateUtil.formatDate(new Date()) + "/" + IdGeneratorUtils.getObjectId() + "/";
|
|
|
+ String path = CommonConstants.RESOURCE_PREFIX + "/png/" + DateUtil.formatDate(new Date()) + "/"
|
|
|
+ + IdGeneratorUtils.getObjectId() + "/";
|
|
|
String rootPath = environment.getProperty("upload.root-dir");
|
|
|
String filePath = rootPath + path;
|
|
|
String codePath = path + model.getId() + ".png";
|
|
|
@@ -496,7 +503,8 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
stopLog.setStartUserId(userInfo.getUserId());
|
|
|
stopLog.setStartTime(now);
|
|
|
stopLog.setStatus(1);
|
|
|
- stopLog.setStopDuration(new BigDecimal(DateUtils.getDurationMinutes(stopLog.getStopTime(), stopLog.getStartTime())));
|
|
|
+ stopLog.setStopDuration(
|
|
|
+ new BigDecimal(DateUtils.getDurationMinutes(stopLog.getStopTime(), stopLog.getStartTime())));
|
|
|
stopLog.setUpdateTime(now);
|
|
|
stopLog.setUpdateUserId(userInfo.getUserId());
|
|
|
sbStopLogMapper.updateByPrimaryKey(stopLog);
|
|
|
@@ -507,8 +515,8 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
public void modModelByDTO(SbInfoDTO model) {
|
|
|
SbInfo info = new SbInfo();
|
|
|
info.setId(model.getId());
|
|
|
- info= mapper.selectOne(info);
|
|
|
- if (!info.getStatus().equals(model.getStatus()) && SbInfoStatusEnum.IN_USE.equals(info.getStatus())){
|
|
|
+ info = mapper.selectOne(info);
|
|
|
+ if (!info.getStatus().equals(model.getStatus()) && SbInfoStatusEnum.IN_USE.equals(info.getStatus())) {
|
|
|
CheckJob checkJob = new CheckJob();
|
|
|
checkJob.setSbId(model.getId());
|
|
|
checkJobMapper.delete(checkJob);
|
|
|
@@ -541,17 +549,19 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
|
|
|
@Override
|
|
|
public void modModelByDTOIgnore(SbInfoDTO model) {
|
|
|
- /* SbModelVO sbModelVO = sbModelMapper.getById(model.getModelId());
|
|
|
- if (sbModelVO == null) {
|
|
|
- throw new BusinessException("找不到型号,modelID: " + model.getModelId());
|
|
|
- }
|
|
|
- model.setUnit(sbModelVO.getUnit());
|
|
|
- model.setTypeId(sbModelVO.getTypeId());
|
|
|
- model.setLevel(sbModelVO.getLevel());
|
|
|
- model.setProducerId(sbModelVO.getProducerId());
|
|
|
- model.setName(sbModelVO.getName());
|
|
|
- model.setModel(sbModelVO.getModel());
|
|
|
- model.setNameModel(sbModelVO.getNameModel());*/
|
|
|
+ /*
|
|
|
+ * SbModelVO sbModelVO = sbModelMapper.getById(model.getModelId());
|
|
|
+ * if (sbModelVO == null) {
|
|
|
+ * throw new BusinessException("找不到型号,modelID: " + model.getModelId());
|
|
|
+ * }
|
|
|
+ * model.setUnit(sbModelVO.getUnit());
|
|
|
+ * model.setTypeId(sbModelVO.getTypeId());
|
|
|
+ * model.setLevel(sbModelVO.getLevel());
|
|
|
+ * model.setProducerId(sbModelVO.getProducerId());
|
|
|
+ * model.setName(sbModelVO.getName());
|
|
|
+ * model.setModel(sbModelVO.getModel());
|
|
|
+ * model.setNameModel(sbModelVO.getNameModel());
|
|
|
+ */
|
|
|
if (model.getIsFinancing() == null) {
|
|
|
model.setIsFinancing(SbInfoFinancingEnum.NOT.getValue());
|
|
|
}
|
|
|
@@ -652,7 +662,8 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
stopLog.setStartTime(now);
|
|
|
stopLog.setStartReason(model.getChangeReason());
|
|
|
stopLog.setStatus(1);
|
|
|
- stopLog.setStopDuration(new BigDecimal(DateUtils.getDurationMinutes(stopLog.getStopTime(), stopLog.getStartTime())));
|
|
|
+ stopLog.setStopDuration(
|
|
|
+ new BigDecimal(DateUtils.getDurationMinutes(stopLog.getStopTime(), stopLog.getStartTime())));
|
|
|
stopLog.setUpdateTime(now);
|
|
|
stopLog.setUpdateUserId(userInfo.getUserId());
|
|
|
sbStopLogMapper.updateByPrimaryKey(stopLog);
|
|
|
@@ -721,7 +732,8 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
stopLog.setStartTime(now);
|
|
|
stopLog.setStartReason(model.getChangeReason());
|
|
|
stopLog.setStatus(1);
|
|
|
- stopLog.setStopDuration(new BigDecimal(DateUtils.getDurationMinutes(stopLog.getStopTime(), stopLog.getStartTime())));
|
|
|
+ stopLog.setStopDuration(
|
|
|
+ new BigDecimal(DateUtils.getDurationMinutes(stopLog.getStopTime(), stopLog.getStartTime())));
|
|
|
stopLog.setUpdateTime(now);
|
|
|
stopLog.setUpdateUserId(userId);
|
|
|
sbStopLogMapper.updateByPrimaryKey(stopLog);
|
|
|
@@ -757,9 +769,11 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
private void saveRepairFile(SbInfoDTO model) {
|
|
|
if (CollectionUtil.isNotEmpty(model.getRepairFileList())) {
|
|
|
Weekend<SysFile> weekend = new Weekend<>(SysFile.class);
|
|
|
- weekend.weekendCriteria().andEqualTo(SysFile::getType, SysFileTypeEnum.SB_WX_FILE.getValue()).andEqualTo(SysFile::getTargetId, model.getId());
|
|
|
+ weekend.weekendCriteria().andEqualTo(SysFile::getType, SysFileTypeEnum.SB_WX_FILE.getValue())
|
|
|
+ .andEqualTo(SysFile::getTargetId, model.getId());
|
|
|
sysFileMapper.deleteByExample(weekend);
|
|
|
- List<SysFile> list = SysFileUtils.changeFileList(model.getRepairFileList(), model.getId(), SysFileTypeEnum.SB_WX_FILE.getValue());
|
|
|
+ List<SysFile> list = SysFileUtils.changeFileList(model.getRepairFileList(), model.getId(),
|
|
|
+ SysFileTypeEnum.SB_WX_FILE.getValue());
|
|
|
if (CollectionUtil.isNotEmpty(list)) {
|
|
|
sysFileMapper.insertListforComplex(list);
|
|
|
}
|
|
|
@@ -774,9 +788,11 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
private void saveUseFile(SbInfoDTO model) {
|
|
|
if (CollectionUtil.isNotEmpty(model.getUseFileList())) {
|
|
|
Weekend<SysFile> weekend = new Weekend<>(SysFile.class);
|
|
|
- weekend.weekendCriteria().andEqualTo(SysFile::getType, SysFileTypeEnum.SB_USE_FILE.getValue()).andEqualTo(SysFile::getTargetId, model.getId());
|
|
|
+ weekend.weekendCriteria().andEqualTo(SysFile::getType, SysFileTypeEnum.SB_USE_FILE.getValue())
|
|
|
+ .andEqualTo(SysFile::getTargetId, model.getId());
|
|
|
sysFileMapper.deleteByExample(weekend);
|
|
|
- List<SysFile> list = SysFileUtils.changeFileList(model.getUseFileList(), model.getId(), SysFileTypeEnum.SB_USE_FILE.getValue());
|
|
|
+ List<SysFile> list = SysFileUtils.changeFileList(model.getUseFileList(), model.getId(),
|
|
|
+ SysFileTypeEnum.SB_USE_FILE.getValue());
|
|
|
if (CollectionUtil.isNotEmpty(list)) {
|
|
|
sysFileMapper.insertListforComplex(list);
|
|
|
}
|
|
|
@@ -791,9 +807,11 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
private void saveRecheckFile(SbInfoDTO model) {
|
|
|
if (CollectionUtil.isNotEmpty(model.getRecheckFileList())) {
|
|
|
Weekend<SysFile> weekend = new Weekend<>(SysFile.class);
|
|
|
- weekend.weekendCriteria().andEqualTo(SysFile::getType, SysFileTypeEnum.SB_WB_FILE.getValue()).andEqualTo(SysFile::getTargetId, model.getId());
|
|
|
+ weekend.weekendCriteria().andEqualTo(SysFile::getType, SysFileTypeEnum.SB_WB_FILE.getValue())
|
|
|
+ .andEqualTo(SysFile::getTargetId, model.getId());
|
|
|
sysFileMapper.deleteByExample(weekend);
|
|
|
- List<SysFile> list = SysFileUtils.changeFileList(model.getRecheckFileList(), model.getId(), SysFileTypeEnum.SB_WB_FILE.getValue());
|
|
|
+ List<SysFile> list = SysFileUtils.changeFileList(model.getRecheckFileList(), model.getId(),
|
|
|
+ SysFileTypeEnum.SB_WB_FILE.getValue());
|
|
|
if (CollectionUtil.isNotEmpty(list)) {
|
|
|
sysFileMapper.insertListforComplex(list);
|
|
|
}
|
|
|
@@ -809,9 +827,11 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
private void saveImageFile(SbInfoDTO model) {
|
|
|
if (CollectionUtil.isNotEmpty(model.getSbFileList())) {
|
|
|
Weekend<SysFile> weekend = new Weekend<>(SysFile.class);
|
|
|
- weekend.weekendCriteria().andEqualTo(SysFile::getType, SysFileTypeEnum.SB_IMG.getValue()).andEqualTo(SysFile::getTargetId, model.getId());
|
|
|
+ weekend.weekendCriteria().andEqualTo(SysFile::getType, SysFileTypeEnum.SB_IMG.getValue())
|
|
|
+ .andEqualTo(SysFile::getTargetId, model.getId());
|
|
|
sysFileMapper.deleteByExample(weekend);
|
|
|
- List<SysFile> list = SysFileUtils.changeFileList(model.getSbFileList(), model.getId(), SysFileTypeEnum.SB_IMG.getValue());
|
|
|
+ List<SysFile> list = SysFileUtils.changeFileList(model.getSbFileList(), model.getId(),
|
|
|
+ SysFileTypeEnum.SB_IMG.getValue());
|
|
|
if (CollectionUtil.isNotEmpty(list)) {
|
|
|
sysFileMapper.insertListforComplex(list);
|
|
|
}
|
|
|
@@ -1290,36 +1310,36 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
// vo.setCurrentAuditUserName(activitiBusinessService.getCurrentAuditUserName(vo.getProcessInstanceId()));
|
|
|
return vo;
|
|
|
}
|
|
|
-// private void generateProtocol(CheckJob checkJob) {
|
|
|
-// ProtocolThread thread = new ProtocolThread();
|
|
|
-// thread.setInfoVO(infoVO);
|
|
|
-// thread.start();
|
|
|
-// }
|
|
|
-
|
|
|
-// class ProtocolThread extends Thread {
|
|
|
-//
|
|
|
-// private GuaranteeInfoVO infoVO;
|
|
|
-//
|
|
|
-// @Override
|
|
|
-// public void run() {
|
|
|
-// synchronized (this) {
|
|
|
-// // 根据模板生成pdf
|
|
|
-// try {
|
|
|
-// protocolService.buildGuaranteePdf(infoVO);
|
|
|
-// } catch (Exception e) {
|
|
|
-// e.printStackTrace();
|
|
|
-// }
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// public GuaranteeInfoVO getInfoVO() {
|
|
|
-// return infoVO;
|
|
|
-// }
|
|
|
-//
|
|
|
-// public void setInfoVO(GuaranteeInfoVO infoVO) {
|
|
|
-// this.infoVO = infoVO;
|
|
|
-// }
|
|
|
-// }
|
|
|
+ // private void generateProtocol(CheckJob checkJob) {
|
|
|
+ // ProtocolThread thread = new ProtocolThread();
|
|
|
+ // thread.setInfoVO(infoVO);
|
|
|
+ // thread.start();
|
|
|
+ // }
|
|
|
+
|
|
|
+ // class ProtocolThread extends Thread {
|
|
|
+ //
|
|
|
+ // private GuaranteeInfoVO infoVO;
|
|
|
+ //
|
|
|
+ // @Override
|
|
|
+ // public void run() {
|
|
|
+ // synchronized (this) {
|
|
|
+ // // 根据模板生成pdf
|
|
|
+ // try {
|
|
|
+ // protocolService.buildGuaranteePdf(infoVO);
|
|
|
+ // } catch (Exception e) {
|
|
|
+ // e.printStackTrace();
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // public GuaranteeInfoVO getInfoVO() {
|
|
|
+ // return infoVO;
|
|
|
+ // }
|
|
|
+ //
|
|
|
+ // public void setInfoVO(GuaranteeInfoVO infoVO) {
|
|
|
+ // this.infoVO = infoVO;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
|
|
|
@Override
|
|
|
public SbInfoVO getScreenDetailByNo(String no) {
|
|
|
@@ -1459,16 +1479,16 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
sysDeptVos.forEach(item -> {
|
|
|
if (DeptNatureEnum.BAN_ZU.getValue().equals(item.getNature())) {
|
|
|
update.setUseGroup(item.getDeptId());
|
|
|
-// update.setUseGroupName(item.getName());
|
|
|
+ // update.setUseGroupName(item.getName());
|
|
|
} else if (DeptNatureEnum.BU_MEN.getValue().equals(item.getNature())) {
|
|
|
update.setUseDept(item.getDeptId());
|
|
|
-// update.setUseDeptName(item.getName());
|
|
|
+ // update.setUseDeptName(item.getName());
|
|
|
} else if (DeptNatureEnum.XIANG_MU_BU.getValue().equals(item.getNature())) {
|
|
|
update.setUseProject(item.getDeptId());
|
|
|
-// update.setUseProjectName(item.getName());
|
|
|
+ // update.setUseProjectName(item.getName());
|
|
|
} else if (DeptNatureEnum.FEN_GONG_SI.getValue().equals(item.getNature())) {
|
|
|
update.setUseCompany(item.getDeptId());
|
|
|
-// update.setUseCompanyName(item.getName());
|
|
|
+ // update.setUseCompanyName(item.getName());
|
|
|
} else if (DeptNatureEnum.JITUAN.getValue().equals(item.getNature())) {
|
|
|
update.setUseArea(item.getDeptId());
|
|
|
} else {
|
|
|
@@ -1521,7 +1541,8 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
for (SbInfoVO vo : voList) {
|
|
|
if (StringUtils.isBlank(vo.getQrCode())) {
|
|
|
// 保存二维码
|
|
|
- String path = CommonConstants.RESOURCE_PREFIX + "/png/" + DateUtil.formatDate(new Date()) + "/" + IdGeneratorUtils.getObjectId() + "/";
|
|
|
+ String path = CommonConstants.RESOURCE_PREFIX + "/png/" + DateUtil.formatDate(new Date()) + "/"
|
|
|
+ + IdGeneratorUtils.getObjectId() + "/";
|
|
|
String rootPath = environment.getProperty("upload.root-dir");
|
|
|
String filePath = rootPath + path;
|
|
|
String codePath = path + vo.getId() + ".png";
|
|
|
@@ -1588,11 +1609,13 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
if (CollectionUtil.isNotEmpty(list)) {
|
|
|
// 保存二维码
|
|
|
for (SbInfo sbInfo : list) {
|
|
|
- String path = CommonConstants.RESOURCE_PREFIX + "/png/" + DateUtil.formatDate(new Date()) + "/" + IdGeneratorUtils.getObjectId() + "/";
|
|
|
+ String path = CommonConstants.RESOURCE_PREFIX + "/png/" + DateUtil.formatDate(new Date()) + "/"
|
|
|
+ + IdGeneratorUtils.getObjectId() + "/";
|
|
|
String rootPath = environment.getProperty("upload.root-dir");
|
|
|
String filePath = rootPath + path;
|
|
|
String codePath = path + sbInfo.getId() + ".png";
|
|
|
- CodeFileUtils.uploadFileECode(domain + sbUrl + sbInfo.getId(), rootPath, filePath, sbInfo.getId() + ".png");
|
|
|
+ CodeFileUtils.uploadFileECode(domain + sbUrl + sbInfo.getId(), rootPath, filePath,
|
|
|
+ sbInfo.getId() + ".png");
|
|
|
// 修改
|
|
|
sbInfo.setQrCode(codePath);
|
|
|
}
|
|
|
@@ -1610,7 +1633,9 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
if (!CollectionUtils.isEmpty(items)) {
|
|
|
List<SbInfoVO> addItems = new ArrayList<SbInfoVO>();
|
|
|
List<SysUser> users = sysUserMapper.selectAll();
|
|
|
- List<FirmProducer> producerList = firmProducerMapper.selectAll();
|
|
|
+ List<FirmProducer> producerList = new ArrayList<>(firmProducerMapper.selectAll());
|
|
|
+ // 用于缓存本次导入新增的生产商,避免同名重复新增
|
|
|
+ Map<String, FirmProducer> newProducerMap = new HashMap<>();
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
for (SbInfoVO item : items) {
|
|
|
item.setUseArea(useArea);
|
|
|
@@ -1620,18 +1645,22 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
item.setUseGroup(useGroup);
|
|
|
item.setId(IdGeneratorUtils.getObjectId());
|
|
|
boolean findSaveUser = false;
|
|
|
- for (SysUser user : users) {
|
|
|
- if (user.getRealName().equals(item.getSaveUserName())) {
|
|
|
- item.setSaveUser(user.getUserId());
|
|
|
- item.setUseUser(user.getUserId());
|
|
|
- findSaveUser = true;
|
|
|
- break;
|
|
|
+ if (StringUtils.isNotBlank(item.getSaveUserName())
|
|
|
+ && !"null".equalsIgnoreCase(item.getSaveUserName())) {
|
|
|
+ for (SysUser user : users) {
|
|
|
+ if (user.getRealName().equals(item.getSaveUserName())) {
|
|
|
+ item.setSaveUser(user.getUserId());
|
|
|
+ item.setUseUser(user.getUserId());
|
|
|
+ findSaveUser = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!findSaveUser) {
|
|
|
+ throw new BusinessException("找不到使用人员,请先添加, 名称" + item.getSaveUserName());
|
|
|
}
|
|
|
}
|
|
|
- if (!findSaveUser) {
|
|
|
- throw new BusinessException("找不到使用人员,请先添加, 名称" + item.getSaveUser());
|
|
|
- }
|
|
|
- if (StringUtils.isNotBlank(item.getRepairUserName())) {
|
|
|
+ if (StringUtils.isNotBlank(item.getRepairUserName())
|
|
|
+ && !"null".equalsIgnoreCase(item.getRepairUserName())) {
|
|
|
boolean findRepairUser = false;
|
|
|
for (SysUser user : users) {
|
|
|
if (user.getRealName().equals(item.getRepairUserName())) {
|
|
|
@@ -1641,10 +1670,11 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
}
|
|
|
}
|
|
|
if (!findRepairUser) {
|
|
|
- throw new BusinessException("找不到维修人员,请先添加, 名称" + item.getRepairUser());
|
|
|
+ throw new BusinessException("找不到维修人员,请先添加, 名称" + item.getRepairUserName());
|
|
|
}
|
|
|
}
|
|
|
- if (StringUtils.isNotBlank(item.getRepairUserNameSecond())) {
|
|
|
+ if (StringUtils.isNotBlank(item.getRepairUserNameSecond())
|
|
|
+ && !"null".equalsIgnoreCase(item.getRepairUserNameSecond())) {
|
|
|
boolean findRepairUser = false;
|
|
|
for (SysUser user : users) {
|
|
|
if (user.getRealName().equals(item.getRepairUserNameSecond())) {
|
|
|
@@ -1654,7 +1684,7 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
}
|
|
|
}
|
|
|
if (!findRepairUser) {
|
|
|
- throw new BusinessException("找不到第二维修人员,请先添加, 名称" + item.getRepairUser());
|
|
|
+ throw new BusinessException("找不到第二维修人员,请先添加, 名称" + item.getRepairUserNameSecond());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1680,7 +1710,26 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
}
|
|
|
}
|
|
|
if (!findProdcuer) {
|
|
|
- throw new BusinessException("找不到生产商,请先添加:" + item.getProducerId());
|
|
|
+ String producerName = item.getProducerId();
|
|
|
+ if (StringUtils.isBlank(producerName) || "null".equalsIgnoreCase(producerName)) {
|
|
|
+ item.setProducerId(null);
|
|
|
+ } else {
|
|
|
+ // 库里没有则自动新增生产商
|
|
|
+ FirmProducer newProducer = newProducerMap.get(producerName);
|
|
|
+ if (newProducer == null) {
|
|
|
+ newProducer = new FirmProducer();
|
|
|
+ newProducer.setId(IdGeneratorUtils.getObjectId());
|
|
|
+ newProducer.setName(producerName);
|
|
|
+ newProducer.setLevel(1);
|
|
|
+ newProducer.setType(1);
|
|
|
+ newProducer.setDelFlag(DelFlagEnum.NORMAL.getValue());
|
|
|
+ newProducer.setCreatedTime(now);
|
|
|
+ firmProducerMapper.insertSelective(newProducer);
|
|
|
+ producerList.add(newProducer);
|
|
|
+ newProducerMap.put(producerName, newProducer);
|
|
|
+ }
|
|
|
+ item.setProducerId(newProducer.getId());
|
|
|
+ }
|
|
|
}
|
|
|
addItems.add(item);
|
|
|
}
|
|
|
@@ -1710,12 +1759,16 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
List<SbInfo> updateList = new ArrayList<SbInfo>();
|
|
|
try {
|
|
|
List<SbInfoVO> items = CustomExcelImportUtil.importListByUpdateALl(file.getInputStream());
|
|
|
- //List<ExportSbInfoVO> items = ExcelImportUtil.importExcel(file.getInputStream(), ExportSbInfoVO.class,new ImportParams());
|
|
|
+ // List<ExportSbInfoVO> items =
|
|
|
+ // ExcelImportUtil.importExcel(file.getInputStream(), ExportSbInfoVO.class,new
|
|
|
+ // ImportParams());
|
|
|
if (!CollectionUtils.isEmpty(items)) {
|
|
|
if (!CollectionUtils.isEmpty(items)) {
|
|
|
List<SbInfoVO> addItems = new ArrayList<SbInfoVO>();
|
|
|
List<SysUser> users = sysUserMapper.selectAll();
|
|
|
- List<FirmProducer> producerList = firmProducerMapper.selectAll();
|
|
|
+ List<FirmProducer> producerList = new ArrayList<>(firmProducerMapper.selectAll());
|
|
|
+ // 用于缓存本次导入新增的生产商,避免同名重复新增
|
|
|
+ Map<String, FirmProducer> newProducerMap = new HashMap<>();
|
|
|
List<SbPosition> positionList = sbPositionMapper.selectAll();
|
|
|
LocalDateTime now = LocalDateTime.now();
|
|
|
for (SbInfoVO item : items) {
|
|
|
@@ -1733,18 +1786,22 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
}
|
|
|
|
|
|
boolean findSaveUser = false;
|
|
|
- for (SysUser user : users) {
|
|
|
- if (user.getRealName().equalsIgnoreCase(item.getSaveUserName())) {
|
|
|
- item.setSaveUser(user.getUserId());
|
|
|
- item.setUseUser(user.getUserId());
|
|
|
- findSaveUser = true;
|
|
|
- break;
|
|
|
+ if (StringUtils.isNotBlank(item.getSaveUserName())
|
|
|
+ && !"null".equalsIgnoreCase(item.getSaveUserName())) {
|
|
|
+ for (SysUser user : users) {
|
|
|
+ if (user.getRealName().equalsIgnoreCase(item.getSaveUserName())) {
|
|
|
+ item.setSaveUser(user.getUserId());
|
|
|
+ item.setUseUser(user.getUserId());
|
|
|
+ findSaveUser = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!findSaveUser) {
|
|
|
+ throw new BusinessException("找不到使用人员,请先添加, 名称" + item.getSaveUserName());
|
|
|
}
|
|
|
}
|
|
|
- if (!findSaveUser) {
|
|
|
- throw new BusinessException("找不到使用人员,请先添加, 名称" + item.getSaveUser());
|
|
|
- }
|
|
|
- if (StringUtils.isNotBlank(item.getRepairUserName())) {
|
|
|
+ if (StringUtils.isNotBlank(item.getRepairUserName())
|
|
|
+ && !"null".equalsIgnoreCase(item.getRepairUserName())) {
|
|
|
boolean findRepairUser = false;
|
|
|
for (SysUser user : users) {
|
|
|
if (user.getRealName().equalsIgnoreCase(item.getRepairUserName())) {
|
|
|
@@ -1754,10 +1811,11 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
}
|
|
|
}
|
|
|
if (!findRepairUser) {
|
|
|
- throw new BusinessException("找不到维修人员,请先添加, 名称" + item.getRepairUser());
|
|
|
+ throw new BusinessException("找不到维修人员,请先添加, 名称" + item.getRepairUserName());
|
|
|
}
|
|
|
}
|
|
|
- if (StringUtils.isNotBlank(item.getRepairUserNameSecond())) {
|
|
|
+ if (StringUtils.isNotBlank(item.getRepairUserNameSecond())
|
|
|
+ && !"null".equalsIgnoreCase(item.getRepairUserNameSecond())) {
|
|
|
boolean findRepairUser = false;
|
|
|
for (SysUser user : users) {
|
|
|
if (user.getRealName().equalsIgnoreCase(item.getRepairUserNameSecond())) {
|
|
|
@@ -1767,7 +1825,7 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
}
|
|
|
}
|
|
|
if (!findRepairUser) {
|
|
|
- throw new BusinessException("找不到第二维修人员,请先添加, 名称" + item.getRepairUser());
|
|
|
+ throw new BusinessException("找不到第二维修人员,请先添加, 名称" + item.getRepairUserNameSecond());
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -1793,7 +1851,26 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
}
|
|
|
}
|
|
|
if (!findProdcuer) {
|
|
|
- throw new BusinessException("找不到生产商,请先添加:" + item.getProducerId());
|
|
|
+ String producerName = item.getProducerId();
|
|
|
+ if (StringUtils.isBlank(producerName) || "null".equalsIgnoreCase(producerName)) {
|
|
|
+ item.setProducerId(null);
|
|
|
+ } else {
|
|
|
+ // 库里没有则自动新增生产商
|
|
|
+ FirmProducer newProducer = newProducerMap.get(producerName);
|
|
|
+ if (newProducer == null) {
|
|
|
+ newProducer = new FirmProducer();
|
|
|
+ newProducer.setId(IdGeneratorUtils.getObjectId());
|
|
|
+ newProducer.setName(producerName);
|
|
|
+ newProducer.setLevel(1);
|
|
|
+ newProducer.setType(1);
|
|
|
+ newProducer.setDelFlag(DelFlagEnum.NORMAL.getValue());
|
|
|
+ newProducer.setCreatedTime(now);
|
|
|
+ firmProducerMapper.insertSelective(newProducer);
|
|
|
+ producerList.add(newProducer);
|
|
|
+ newProducerMap.put(producerName, newProducer);
|
|
|
+ }
|
|
|
+ item.setProducerId(newProducer.getId());
|
|
|
+ }
|
|
|
}
|
|
|
mapper.updateByPrimaryKeySelective(BeanConverterUtil.copyObjectProperties(item, SbInfo.class));
|
|
|
}
|
|
|
@@ -1843,7 +1920,6 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
this.modModelByDTO(sbInfoDTO);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void submitScrapAudit(SbInfoDTO sbInfoDTO) {
|
|
|
@@ -1864,11 +1940,13 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
result = 2;
|
|
|
auditNode = SbInfoScrapAuditNodeEnum.FGS_SBZG.getValue();
|
|
|
}
|
|
|
- ActObj obj = activitiBusinessService.startWorkflow(sbInfoDTO.getId(), sbInfoDTO.getName() + "-" + sbInfoDTO.getNo(), projectId, sbInfoDTO.getProcessInstanceId(),
|
|
|
+ ActObj obj = activitiBusinessService.startWorkflow(sbInfoDTO.getId(),
|
|
|
+ sbInfoDTO.getName() + "-" + sbInfoDTO.getNo(), projectId, sbInfoDTO.getProcessInstanceId(),
|
|
|
ActApplyEnum.SB_INFO_SCRAP.getName(), SbInfoScrapAuditNodeEnum.START.getValue(), roleCode,
|
|
|
now, result, sbInfoDTO.getRemark());
|
|
|
// 通知消息
|
|
|
- SpringContextHolder.publishEvent(new WorkplaceBacklogEvent(new WorkplaceBacklogDTO(WorkplaceBacklogTypeEnum.SB_SCRAP.getValue(),
|
|
|
+ SpringContextHolder.publishEvent(new WorkplaceBacklogEvent(new WorkplaceBacklogDTO(
|
|
|
+ WorkplaceBacklogTypeEnum.SB_SCRAP.getValue(),
|
|
|
WorkplaceBacklogDetailTypeEnum.SB_SCRAP.getValue(),
|
|
|
obj.getTaskId(), MessageTemplateUtil.getSbInfoScrapTask(sbInfoDTO.getName() + "-" + sbInfoDTO.getNo()),
|
|
|
sbInfoDTO.getId(), ListUtils.newArrayList(obj.getAssignee()))));
|
|
|
@@ -1884,15 +1962,18 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
* 校验分公司设备主管,分公司分管领导审批人是否设置
|
|
|
*/
|
|
|
private void validAuditPerson(String companyId) {
|
|
|
- SysUserVO user = activitiBusinessService.getLeadDeptAuditUserIdInCompany(companyId, null, SysRoleCodeEnum.FGS_SBZG.name());
|
|
|
+ SysUserVO user = activitiBusinessService.getLeadDeptAuditUserIdInCompany(companyId, null,
|
|
|
+ SysRoleCodeEnum.FGS_SBZG.name());
|
|
|
if (user == null) {
|
|
|
throw new BusinessException("该项目审批流程中分公司设备主管未设置");
|
|
|
}
|
|
|
- user = activitiBusinessService.getLeadDeptAuditUserIdInCompany(companyId, null, SysRoleCodeEnum.FGS_CWZG.name());
|
|
|
+ user = activitiBusinessService.getLeadDeptAuditUserIdInCompany(companyId, null,
|
|
|
+ SysRoleCodeEnum.FGS_CWZG.name());
|
|
|
if (user == null) {
|
|
|
throw new BusinessException("该项目审批流程中分公司财务未设置");
|
|
|
}
|
|
|
- user = activitiBusinessService.getLeadDeptAuditUserIdInCompany(companyId, null, SysRoleCodeEnum.FGS_SBFGLD.name());
|
|
|
+ user = activitiBusinessService.getLeadDeptAuditUserIdInCompany(companyId, null,
|
|
|
+ SysRoleCodeEnum.FGS_SBFGLD.name());
|
|
|
if (user == null) {
|
|
|
throw new BusinessException("该项目审批流程中分公司分管领导未设置");
|
|
|
}
|
|
|
@@ -1946,7 +2027,8 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
mapper.updateByPrimaryKeySelective(update);
|
|
|
|
|
|
// 执行审批流程
|
|
|
- ActObj obj = activitiBusinessService.executeFlow(record.getTaskId(), sbInfo.getProcessInstanceId(), null, result,
|
|
|
+ ActObj obj = activitiBusinessService.executeFlow(record.getTaskId(), sbInfo.getProcessInstanceId(), null,
|
|
|
+ result,
|
|
|
record.getRefuseReason(), record.getAuditFlag(), node, roleCode, null, LocalDateTime.now());
|
|
|
String assignee = obj.getAssignee();
|
|
|
WorkplaceBacklogDTO dto = null;
|
|
|
@@ -1959,7 +2041,8 @@ public class SbInfoServiceImpl extends BaseServiceImpl<SbInfoMapper, SbInfo, SbI
|
|
|
if (result == 1 || result == 0) {
|
|
|
dto = new WorkplaceBacklogDTO(WorkplaceBacklogTypeEnum.SB_SCRAP.getValue(),
|
|
|
WorkplaceBacklogDetailTypeEnum.SB_SCRAP_RESULT.getValue(),
|
|
|
- obj.getTaskId(), MessageTemplateUtil.getSbInfoScrapTaskResult(sbInfo.getName() + "-" + sbInfo.getNo(), result == 1),
|
|
|
+ obj.getTaskId(),
|
|
|
+ MessageTemplateUtil.getSbInfoScrapTaskResult(sbInfo.getName() + "-" + sbInfo.getNo(), result == 1),
|
|
|
sbInfo.getId(), ListUtils.newArrayList(sbInfo.getScrapUserId()));
|
|
|
}
|
|
|
if (dto != null) {
|