|
@@ -1,7 +1,15 @@
|
|
package com.platform.service.repair.impl;
|
|
package com.platform.service.repair.impl;
|
|
|
|
+import cn.hutool.core.collection.CollectionUtil;
|
|
import com.platform.common.bean.AbstractPageResultBean;
|
|
import com.platform.common.bean.AbstractPageResultBean;
|
|
|
|
+import com.platform.common.util.IdGeneratorUtils;
|
|
|
|
+import com.platform.common.util.ListUtils;
|
|
import com.platform.dao.bean.MyPage;
|
|
import com.platform.dao.bean.MyPage;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
|
|
+import com.platform.dao.dto.sb.SbInfoDTO;
|
|
|
|
+import com.platform.dao.entity.upms.SysFile;
|
|
|
|
+import com.platform.dao.enums.RepairReasonStatusEnum;
|
|
|
|
+import com.platform.dao.enums.SysFileTypeEnum;
|
|
|
|
+import com.platform.dao.mapper.upms.SysFileMapper;
|
|
import com.platform.dao.vo.query.repair.RepairReasonVO;
|
|
import com.platform.dao.vo.query.repair.RepairReasonVO;
|
|
import com.platform.dao.dto.repair.RepairReasonDTO;
|
|
import com.platform.dao.dto.repair.RepairReasonDTO;
|
|
import com.platform.dao.entity.repair.RepairReason;
|
|
import com.platform.dao.entity.repair.RepairReason;
|
|
@@ -24,7 +32,50 @@ import java.util.List;
|
|
@AllArgsConstructor
|
|
@AllArgsConstructor
|
|
@Service("repairReasonService")
|
|
@Service("repairReasonService")
|
|
public class RepairReasonServiceImpl extends BaseServiceImpl<RepairReasonMapper, RepairReason, RepairReasonDTO> implements RepairReasonService {
|
|
public class RepairReasonServiceImpl extends BaseServiceImpl<RepairReasonMapper, RepairReason, RepairReasonDTO> implements RepairReasonService {
|
|
|
|
+ private final SysFileMapper sysFileMapper;
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
+ public RepairReason getModelById(Object id) {
|
|
|
|
+ Weekend<SysFile> weekend = new Weekend<>(SysFile.class);
|
|
|
|
+ weekend.weekendCriteria().andEqualTo(SysFile::getTargetId, id);
|
|
|
|
+ List<SysFile> fileList = sysFileMapper.selectByExample(weekend);
|
|
|
|
+ RepairReason model = super.getModelById(id);
|
|
|
|
+ model.setFileList(fileList);
|
|
|
|
+ return model;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public RepairReason saveModelByDTO(RepairReasonDTO model) {
|
|
|
|
+ model.setId(IdGeneratorUtils.getObjectId());
|
|
|
|
+ model.setStatus(RepairReasonStatusEnum.NORMAL.getValue());
|
|
|
|
+ this.saveFile(model);
|
|
|
|
+ return super.saveModelHaveCreateInfo(model);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void modModelByDTO(RepairReasonDTO model) {
|
|
|
|
+ super.modModelByDTO(model);
|
|
|
|
+ this.saveFile(model);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void saveFile(RepairReasonDTO model) {
|
|
|
|
+ Weekend<SysFile> weekend = new Weekend<>(SysFile.class);
|
|
|
|
+ weekend.weekendCriteria().andEqualTo(SysFile::getTargetId, model.getId());
|
|
|
|
+ sysFileMapper.deleteByExample(weekend);
|
|
|
|
+ List<SysFile> repairFileList = model.getFileList();
|
|
|
|
+ List<SysFile> list = ListUtils.newArrayList();
|
|
|
|
+ if (CollectionUtil.isNotEmpty(repairFileList)) {
|
|
|
|
+ repairFileList.forEach(item -> {
|
|
|
|
+ item.setType(SysFileTypeEnum.REPAIR_REASON_IMGS.getValue());
|
|
|
|
+ item.setId(IdGeneratorUtils.getObjectId());
|
|
|
|
+ item.setTargetId(model.getId());
|
|
|
|
+ list.add(item);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ if (CollectionUtil.isNotEmpty(list)) {
|
|
|
|
+ sysFileMapper.insertListforComplex(list);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
@Override
|
|
@Override
|
|
public int batchDelete(List<String> ids) {
|
|
public int batchDelete(List<String> ids) {
|
|
Weekend<RepairReason> weekend = new Weekend<>(RepairReason.class);
|
|
Weekend<RepairReason> weekend = new Weekend<>(RepairReason.class);
|