|
@@ -1,40 +1,42 @@
|
|
|
package org.eco.als.service.impl;
|
|
|
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import com.mybatisflex.core.paginate.Page;
|
|
|
import com.mybatisflex.core.query.QueryWrapper;
|
|
|
-import jakarta.annotation.Resource;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.eco.als.domain.FaultCase;
|
|
|
-import org.eco.als.domain.bo.FaultCaseBo;
|
|
|
-import org.eco.als.domain.vo.FaultCaseImportVo;
|
|
|
-import org.eco.als.domain.vo.FaultCaseVo;
|
|
|
-import org.eco.als.listener.FaultCaseImportListener;
|
|
|
-import org.eco.als.mapper.FaultCaseMapper;
|
|
|
-import org.eco.als.service.IFaultCaseService;
|
|
|
import org.eco.common.core.core.domain.model.LoginUser;
|
|
|
-import org.eco.common.core.core.page.PageResult;
|
|
|
-import org.eco.common.core.utils.MapstructUtils;
|
|
|
import org.eco.common.excel.entity.ExcelResultRes;
|
|
|
import org.eco.common.excel.service.IExcelService;
|
|
|
+import org.eco.common.core.utils.bean.BeanUtils;
|
|
|
+import org.eco.common.core.utils.MapstructUtils;
|
|
|
+import org.eco.system.service.IImportExportService;
|
|
|
+import org.eco.common.core.utils.StringUtils;
|
|
|
+import org.eco.system.domain.bo.ImportExportBo;
|
|
|
import org.eco.common.orm.core.page.PageQuery;
|
|
|
+import org.eco.common.core.core.page.PageResult;
|
|
|
import org.eco.common.orm.core.service.impl.BaseServiceImpl;
|
|
|
-import org.eco.system.service.IImportExportService;
|
|
|
+import jakarta.annotation.Resource;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
-
|
|
|
import java.io.IOException;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
-
|
|
|
+import org.eco.als.mapper.FaultCaseMapper;
|
|
|
+import org.eco.als.domain.FaultCase;
|
|
|
+import org.eco.als.domain.bo.FaultCaseBo;
|
|
|
+import org.eco.als.domain.vo.FaultCaseVo;
|
|
|
+import org.eco.als.domain.vo.FaultCaseImportVo;
|
|
|
+import org.eco.als.listener.FaultCaseImportListener;
|
|
|
+import org.eco.als.service.IFaultCaseService;
|
|
|
import static org.eco.als.domain.table.FaultCaseTableDef.FAULT_CASE;
|
|
|
|
|
|
/**
|
|
|
* 故障案例Service业务层处理
|
|
|
*
|
|
|
* @author wgk
|
|
|
- * @date 2024-11-14
|
|
|
+ * @date 2024-12-13
|
|
|
*/
|
|
|
@Service
|
|
|
@Slf4j
|
|
@@ -55,23 +57,34 @@ public class FaultCaseServiceImpl extends BaseServiceImpl<FaultCaseMapper, Fault
|
|
|
|
|
|
private QueryWrapper buildQueryWrapper(FaultCaseBo faultCaseBo) {
|
|
|
QueryWrapper queryWrapper = super.buildBaseQueryWrapper();
|
|
|
- queryWrapper.and(FAULT_CASE.AIRCRAFT_CODE.eq(faultCaseBo.getAircraftCode()));
|
|
|
- queryWrapper.and(FAULT_CASE.AIRCRAFT_TYPE.eq(faultCaseBo.getAircraftType()));
|
|
|
- queryWrapper.and(FAULT_CASE.AIRCRAFT_CODE.in(faultCaseBo.getAircraftCodes()));
|
|
|
- queryWrapper.and(FAULT_CASE.AIRCRAFT_TYPE.in(faultCaseBo.getAircraftTypes()));
|
|
|
- queryWrapper.and(FAULT_CASE.FAULT_CODE.eq(faultCaseBo.getFaultCode()));
|
|
|
- queryWrapper.and(FAULT_CASE.FAULT_NAME.like(faultCaseBo.getFaultName()));
|
|
|
- queryWrapper.and(FAULT_CASE.OSS_ID.eq(faultCaseBo.getOssId()));
|
|
|
- queryWrapper.and(FAULT_CASE.FAULT_DATE.eq(faultCaseBo.getFaultDate()));
|
|
|
- queryWrapper.and(FAULT_CASE.SYSTEM_ITEM.eq(faultCaseBo.getSystemItem()));
|
|
|
- queryWrapper.and(FAULT_CASE.SPECIALTY.eq(faultCaseBo.getSpecialty()));
|
|
|
- queryWrapper.and(FAULT_CASE.LOCATION.eq(faultCaseBo.getLocation()));
|
|
|
- queryWrapper.and(FAULT_CASE.LEVEL.eq(faultCaseBo.getLevel()));
|
|
|
- queryWrapper.and(FAULT_CASE.SYMPTOMS.eq(faultCaseBo.getSymptoms()));
|
|
|
- queryWrapper.and(FAULT_CASE.METHOD_RECTIFICATION.eq(faultCaseBo.getMethodRectification()));
|
|
|
- queryWrapper.and(FAULT_CASE.FAULT_CAUSE_TYPE.eq(faultCaseBo.getFaultCauseType()));
|
|
|
- queryWrapper.and(FAULT_CASE.FAULT_CAUSE.eq(faultCaseBo.getFaultCause()));
|
|
|
- queryWrapper.and(FAULT_CASE.REMARKS.eq(faultCaseBo.getRemarks()));
|
|
|
+ queryWrapper.and(FAULT_CASE.AIRCRAFT_TYPE_ID.eq
|
|
|
+ (faultCaseBo.getAircraftTypeId()));
|
|
|
+ queryWrapper.and(FAULT_CASE.AIRCRAFT_TYPE_NAME.like
|
|
|
+ (faultCaseBo.getAircraftTypeName()));
|
|
|
+ queryWrapper.and(FAULT_CASE.AIRCRAFT_SYSTEM_ID.eq
|
|
|
+ (faultCaseBo.getAircraftSystemId()));
|
|
|
+ queryWrapper.and(FAULT_CASE.AIRCRAFT_SYSTEM_NAME.like
|
|
|
+ (faultCaseBo.getAircraftSystemName()));
|
|
|
+ queryWrapper.and(FAULT_CASE.AIRCRAFT_SUBSYSTEM_ID.eq
|
|
|
+ (faultCaseBo.getAircraftSubsystemId()));
|
|
|
+ queryWrapper.and(FAULT_CASE.AIRCRAFT_SUBSYSTEM_NAME.like
|
|
|
+ (faultCaseBo.getAircraftSubsystemName()));
|
|
|
+ queryWrapper.and(FAULT_CASE.AUTHOR.eq
|
|
|
+ (faultCaseBo.getAuthor()));
|
|
|
+ queryWrapper.and(FAULT_CASE.FAULT_PHENOMENON.eq
|
|
|
+ (faultCaseBo.getFaultPhenomenon()));
|
|
|
+ queryWrapper.and(FAULT_CASE.FAULT_CAUSE.eq
|
|
|
+ (faultCaseBo.getFaultCause()));
|
|
|
+ queryWrapper.and(FAULT_CASE.FAULT_TREE_PATH.eq
|
|
|
+ (faultCaseBo.getFaultTreePath()));
|
|
|
+ queryWrapper.and(FAULT_CASE.FAULT_PICTURE_PATH.eq
|
|
|
+ (faultCaseBo.getFaultPicturePath()));
|
|
|
+ queryWrapper.and(FAULT_CASE.TROUBLESHOOTING_METHOD_PATH.eq
|
|
|
+ (faultCaseBo.getTroubleshootingMethodPath()));
|
|
|
+ queryWrapper.and(FAULT_CASE.VIEW_COUNT.eq
|
|
|
+ (faultCaseBo.getViewCount()));
|
|
|
+ queryWrapper.and(FAULT_CASE.ORDER_BY.eq
|
|
|
+ (faultCaseBo.getOrderBy()));
|
|
|
|
|
|
return queryWrapper;
|
|
|
}
|
|
@@ -84,7 +97,7 @@ public class FaultCaseServiceImpl extends BaseServiceImpl<FaultCaseMapper, Fault
|
|
|
*/
|
|
|
@Override
|
|
|
public FaultCaseVo selectById(Long id) {
|
|
|
- return this.getOneAs(query().where(FAULT_CASE.ID.eq(id)), FaultCaseVo.class);
|
|
|
+ return this.getOneAs(query().where(FAULT_CASE.ID.eq(id)), FaultCaseVo.class);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -98,7 +111,7 @@ public class FaultCaseServiceImpl extends BaseServiceImpl<FaultCaseMapper, Fault
|
|
|
@Override
|
|
|
public List<FaultCaseVo> selectList(FaultCaseBo faultCaseBo) {
|
|
|
QueryWrapper queryWrapper = buildQueryWrapper(faultCaseBo);
|
|
|
- return this.listAs(queryWrapper, FaultCaseVo.class);
|
|
|
+ return this.listAs(queryWrapper, FaultCaseVo.class);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -110,7 +123,7 @@ public class FaultCaseServiceImpl extends BaseServiceImpl<FaultCaseMapper, Fault
|
|
|
@Override
|
|
|
public PageResult<FaultCaseVo> selectPage(FaultCaseBo faultCaseBo) {
|
|
|
QueryWrapper queryWrapper = buildQueryWrapper(faultCaseBo);
|
|
|
- Page<FaultCaseVo> page = this.pageAs(PageQuery.build(), queryWrapper, FaultCaseVo.class);
|
|
|
+ Page<FaultCaseVo> page = this.pageAs(PageQuery.build(), queryWrapper, FaultCaseVo.class);
|
|
|
return PageResult.build(page);
|
|
|
}
|
|
|
|
|
@@ -122,7 +135,7 @@ public class FaultCaseServiceImpl extends BaseServiceImpl<FaultCaseMapper, Fault
|
|
|
*/
|
|
|
@Override
|
|
|
public boolean insert(FaultCaseBo faultCaseBo) {
|
|
|
- FaultCase faultCase = MapstructUtils.convert(faultCaseBo, FaultCase.class);
|
|
|
+ FaultCase faultCase =MapstructUtils.convert(faultCaseBo, FaultCase. class);
|
|
|
|
|
|
return this.save(faultCase);//使用全局配置的雪花算法主键生成器生成ID值
|
|
|
}
|
|
@@ -134,11 +147,12 @@ public class FaultCaseServiceImpl extends BaseServiceImpl<FaultCaseMapper, Fault
|
|
|
* @return 结果:true 操作成功,false 操作失败
|
|
|
*/
|
|
|
@Override
|
|
|
- public boolean insertWithPk(FaultCaseBo faultCaseBo) {
|
|
|
+ public boolean insertWithPk(FaultCaseBo faultCaseBo)
|
|
|
+ {
|
|
|
FaultCase faultCase = MapstructUtils.convert(faultCaseBo, FaultCase.class);
|
|
|
|
|
|
|
|
|
- return faultCaseMapper.insertWithPk(faultCase) > 0;//前台传来主键值
|
|
|
+ return faultCaseMapper.insertWithPk(faultCase) > 0;//前台传来主键值
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -149,9 +163,10 @@ public class FaultCaseServiceImpl extends BaseServiceImpl<FaultCaseMapper, Fault
|
|
|
*/
|
|
|
@Override
|
|
|
public boolean update(FaultCaseBo faultCaseBo) {
|
|
|
- FaultCase faultCase = MapstructUtils.convert(faultCaseBo, FaultCase.class);
|
|
|
- if (ObjectUtil.isNotNull(faultCase) && ObjectUtil.isNotNull(faultCase.getId())) {
|
|
|
- return this.updateById(faultCase);
|
|
|
+ FaultCase faultCase =MapstructUtils.convert(faultCaseBo, FaultCase. class);
|
|
|
+ if (ObjectUtil.isNotNull(faultCase) && ObjectUtil.isNotNull(faultCase.getId())){
|
|
|
+ boolean updated = this.updateById(faultCase);
|
|
|
+ return updated;
|
|
|
}
|
|
|
return false;
|
|
|
}
|