|
@@ -1,11 +1,14 @@
|
|
|
package com.platform.service.check.impl;
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
|
import com.platform.common.bean.AbstractPageResultBean;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.platform.common.util.DateUtils;
|
|
|
import com.platform.common.util.IdGeneratorUtils;
|
|
|
+import com.platform.common.util.ListUtils;
|
|
|
import com.platform.dao.bean.MyPage;
|
|
|
import com.platform.dao.dto.check.CheckStandardDTO;
|
|
|
import com.platform.dao.dto.check.CheckStandardParamDTO;
|
|
|
+import com.platform.dao.dto.sb.SbInfoDTO;
|
|
|
import com.platform.dao.entity.check.CheckJob;
|
|
|
import com.platform.dao.entity.check.CheckProjectStandardRelation;
|
|
|
import com.platform.dao.entity.check.CheckStandard;
|
|
@@ -13,13 +16,16 @@ import com.platform.dao.entity.check.CheckStandardParam;
|
|
|
import com.platform.dao.entity.maintain.MaintainProjectStandardRelation;
|
|
|
import com.platform.dao.entity.maintain.MaintainStandardParam;
|
|
|
import com.platform.dao.entity.sqarepartmanage.SparePartInfo;
|
|
|
+import com.platform.dao.entity.upms.SysFile;
|
|
|
import com.platform.dao.enums.CheckJobStatusEnum;
|
|
|
import com.platform.dao.enums.CheckPlanPeriodTypeEnum;
|
|
|
+import com.platform.dao.enums.SysFileTypeEnum;
|
|
|
import com.platform.dao.mapper.check.CheckJobMapper;
|
|
|
import com.platform.dao.mapper.check.CheckProjectStandardRelationMapper;
|
|
|
import com.platform.dao.mapper.check.CheckStandardMapper;
|
|
|
import com.platform.dao.mapper.check.CheckStandardParamMapper;
|
|
|
import com.platform.dao.mapper.maintain.MaintainProjectStandardRelationMapper;
|
|
|
+import com.platform.dao.mapper.upms.SysFileMapper;
|
|
|
import com.platform.dao.vo.query.check.CheckStandardVO;
|
|
|
import com.platform.service.check.CheckStandardParamService;
|
|
|
import com.platform.service.check.CheckStandardService;
|
|
@@ -49,6 +55,7 @@ public class CheckStandardServiceImpl extends BaseServiceImpl<CheckStandardMappe
|
|
|
private CheckProjectStandardRelationMapper relationMapper;
|
|
|
private CheckStandardParamMapper paramMapper;
|
|
|
private CheckJobMapper checkJobMapper;
|
|
|
+ private final SysFileMapper sysFileMapper;
|
|
|
@Override
|
|
|
public boolean cascadingDeleteByKey(String id) {
|
|
|
int result = mapper.deleteByPrimaryKey(id);
|
|
@@ -104,6 +111,7 @@ public class CheckStandardServiceImpl extends BaseServiceImpl<CheckStandardMappe
|
|
|
Integer count = mapper.selectCountByExample(weekend);
|
|
|
model.setNo(IdGeneratorUtils.getCheckStandardNo(++count));
|
|
|
CheckStandard checkStandard = super.saveModelByDTO(model);
|
|
|
+ this.saveFile(model);
|
|
|
// 保存参数
|
|
|
/* List<CheckStandardParamDTO> paramList = model.getParamList();
|
|
|
paramList.forEach(item -> {
|
|
@@ -121,6 +129,7 @@ public class CheckStandardServiceImpl extends BaseServiceImpl<CheckStandardMappe
|
|
|
Weekend<CheckStandardParam> weekend = new Weekend<>(CheckStandardParam.class);
|
|
|
weekend.weekendCriteria().andEqualTo(CheckStandardParam::getStandardId, model.getId());
|
|
|
paramMapper.deleteByExample(weekend);
|
|
|
+ this.saveFile(model);
|
|
|
// 保存参数
|
|
|
/* List<CheckStandardParamDTO> paramList = model.getParamList();
|
|
|
paramList.forEach(item -> {
|
|
@@ -129,13 +138,57 @@ public class CheckStandardServiceImpl extends BaseServiceImpl<CheckStandardMappe
|
|
|
paramService.saveModelListByDTO(paramList);*/
|
|
|
}
|
|
|
|
|
|
+ private void saveFile(CheckStandardDTO model) {
|
|
|
+ Weekend<SysFile> weekend = new Weekend<>(SysFile.class);
|
|
|
+ weekend.weekendCriteria().andEqualTo(SysFile::getTargetId, model.getId());
|
|
|
+ sysFileMapper.deleteByExample(weekend);
|
|
|
+ List<SysFile> checkImgList = model.getCheckImgList();
|
|
|
+ List<SysFile> checkFileList = model.getCheckFileList();
|
|
|
+ List<SysFile> list = ListUtils.newArrayList();
|
|
|
+ if (CollectionUtil.isNotEmpty(checkImgList)) {
|
|
|
+ checkImgList.forEach(item -> {
|
|
|
+ item.setType(SysFileTypeEnum.CHECK_STANDARD_IMGS.getValue());
|
|
|
+ item.setId(IdGeneratorUtils.getObjectId());
|
|
|
+ item.setTargetId(model.getId());
|
|
|
+ list.add(item);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (CollectionUtil.isNotEmpty(checkFileList)) {
|
|
|
+ checkFileList.forEach(item -> {
|
|
|
+ item.setType(SysFileTypeEnum.CHECK_STANDARD_FILES.getValue());
|
|
|
+ item.setId(IdGeneratorUtils.getObjectId());
|
|
|
+ item.setTargetId(model.getId());
|
|
|
+ list.add(item);
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (CollectionUtil.isNotEmpty(list)) {
|
|
|
+ sysFileMapper.insertListforComplex(list);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public CheckStandard getModelById(Object id) {
|
|
|
CheckStandard checkStandard = super.getModelById(id);
|
|
|
- Weekend<CheckStandardParam> weekend = new Weekend<>(CheckStandardParam.class);
|
|
|
+ /* Weekend<CheckStandardParam> weekend = new Weekend<>(CheckStandardParam.class);
|
|
|
weekend.weekendCriteria().andEqualTo(CheckStandardParam::getStandardId, id);
|
|
|
List<CheckStandardParam> paramList = paramMapper.selectByExample(weekend);
|
|
|
- checkStandard.setParamList(paramList);
|
|
|
+ checkStandard.setParamList(paramList);*/
|
|
|
+
|
|
|
+ Weekend<SysFile> weekendFile = new Weekend<>(SysFile.class);
|
|
|
+ weekendFile.weekendCriteria().andEqualTo(SysFile::getTargetId, checkStandard.getId());
|
|
|
+ List<SysFile> sysFiles = sysFileMapper.selectByExample(weekendFile);
|
|
|
+ List<SysFile> checkImgList = ListUtils.newArrayList();
|
|
|
+ List<SysFile> checkFileList = ListUtils.newArrayList();
|
|
|
+ sysFiles.forEach(item -> {
|
|
|
+ if (item.getType().equals( SysFileTypeEnum.CHECK_STANDARD_IMGS.getValue())) {
|
|
|
+ checkImgList.add(item);
|
|
|
+ }
|
|
|
+ if (item.getType().equals( SysFileTypeEnum.CHECK_STANDARD_FILES.getValue())) {
|
|
|
+ checkFileList.add(item);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ checkStandard.setCheckImgList(checkImgList);
|
|
|
+ checkStandard.setCheckFileList(checkFileList);
|
|
|
return checkStandard;
|
|
|
}
|
|
|
|