|
@@ -1,36 +1,34 @@
|
|
|
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.FaultStatistics;
|
|
|
+import org.eco.als.domain.bo.FaultStatisticsBo;
|
|
|
+import org.eco.als.domain.vo.FaultStatisticsImportVo;
|
|
|
+import org.eco.als.domain.vo.FaultStatisticsVo;
|
|
|
import org.eco.als.domain.vo.FaultStatisticsWbVo;
|
|
|
+import org.eco.als.listener.FaultStatisticsImportListener;
|
|
|
+import org.eco.als.mapper.FaultStatisticsMapper;
|
|
|
+import org.eco.als.service.IFaultStatisticsService;
|
|
|
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 jakarta.annotation.Resource;
|
|
|
+import org.eco.system.service.IImportExportService;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
+
|
|
|
import java.io.IOException;
|
|
|
-import org.eco.als.mapper.FaultStatisticsMapper;
|
|
|
-import org.eco.als.domain.FaultStatistics;
|
|
|
-import org.eco.als.domain.bo.FaultStatisticsBo;
|
|
|
-import org.eco.als.domain.vo.FaultStatisticsVo;
|
|
|
-import org.eco.als.domain.vo.FaultStatisticsImportVo;
|
|
|
-import org.eco.als.listener.FaultStatisticsImportListener;
|
|
|
-import org.eco.als.service.IFaultStatisticsService;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
import static org.eco.als.domain.table.FaultStatisticsTableDef.FAULT_STATISTICS;
|
|
|
|
|
|
/**
|
|
@@ -59,34 +57,38 @@ public class FaultStatisticsServiceImpl extends BaseServiceImpl<FaultStatisticsM
|
|
|
private QueryWrapper buildQueryWrapper(FaultStatisticsBo faultStatisticsBo) {
|
|
|
QueryWrapper queryWrapper = super.buildBaseQueryWrapper();
|
|
|
queryWrapper.and(FAULT_STATISTICS.STATISTICS_DATE.eq
|
|
|
- (faultStatisticsBo.getStatisticsDate()));
|
|
|
+ (faultStatisticsBo.getStatisticsDate()));
|
|
|
queryWrapper.and(FAULT_STATISTICS.WAR_ZONE.eq
|
|
|
- (faultStatisticsBo.getWarZone()));
|
|
|
+ (faultStatisticsBo.getWarZone()));
|
|
|
|
|
|
queryWrapper.and(FAULT_STATISTICS.GROUPS.eq
|
|
|
(faultStatisticsBo.getGroups()));
|
|
|
queryWrapper.and(FAULT_STATISTICS.MAJOR.eq
|
|
|
- (faultStatisticsBo.getMajor()));
|
|
|
+ (faultStatisticsBo.getMajor()));
|
|
|
queryWrapper.and(FAULT_STATISTICS.AIRCRAFT_MODEL.eq
|
|
|
(faultStatisticsBo.getAircraftModel()));
|
|
|
queryWrapper.and(FAULT_STATISTICS.AIRCRAFT_NUM.eq
|
|
|
(faultStatisticsBo.getAircraftNum()));
|
|
|
queryWrapper.and(FAULT_STATISTICS.FAULTY_PARTS_NAME.eq
|
|
|
(faultStatisticsBo.getFaultyPartsName()));
|
|
|
+ queryWrapper.and(FAULT_STATISTICS.FAULTY_PARTS_NUM.eq
|
|
|
+ (faultStatisticsBo.getFaultyPartsNum()));
|
|
|
+ queryWrapper.and(FAULT_STATISTICS.FAULTY_PARTS_MODEL.eq
|
|
|
+ (faultStatisticsBo.getFaultyPartsModel()));
|
|
|
|
|
|
- if(faultStatisticsBo.getStartStatisticsDate() != null && faultStatisticsBo.getEndStatisticsDate() != null){
|
|
|
+ if (faultStatisticsBo.getStartStatisticsDate() != null && faultStatisticsBo.getEndStatisticsDate() != null) {
|
|
|
queryWrapper.between("statistics_date", faultStatisticsBo.getStartStatisticsDate(), faultStatisticsBo.getEndStatisticsDate());
|
|
|
}
|
|
|
- if(faultStatisticsBo.getDistinctField() != null){
|
|
|
- if(faultStatisticsBo.getDistinctField().equals("groups")){
|
|
|
+ if (faultStatisticsBo.getDistinctField() != null) {
|
|
|
+ if (faultStatisticsBo.getDistinctField().equals("groups")) {
|
|
|
queryWrapper.select("DISTINCT groups"); // 指定去重字段
|
|
|
- }else if(faultStatisticsBo.getDistinctField().equals("major")){
|
|
|
+ } else if (faultStatisticsBo.getDistinctField().equals("major")) {
|
|
|
queryWrapper.select("DISTINCT major");
|
|
|
- }else if(faultStatisticsBo.getDistinctField().equals("aircraft_model")){
|
|
|
+ } else if (faultStatisticsBo.getDistinctField().equals("aircraft_model")) {
|
|
|
queryWrapper.select("DISTINCT aircraft_model");
|
|
|
- }else if(faultStatisticsBo.getDistinctField().equals("aircraft_num")){
|
|
|
+ } else if (faultStatisticsBo.getDistinctField().equals("aircraft_num")) {
|
|
|
queryWrapper.select("DISTINCT aircraft_num");
|
|
|
- }else if(faultStatisticsBo.getDistinctField().equals("faulty_parts_name")){
|
|
|
+ } else if (faultStatisticsBo.getDistinctField().equals("faulty_parts_name")) {
|
|
|
queryWrapper.select("DISTINCT faulty_parts_name");
|
|
|
}
|
|
|
}
|
|
@@ -108,7 +110,7 @@ public class FaultStatisticsServiceImpl extends BaseServiceImpl<FaultStatisticsM
|
|
|
queryWrapper.and(FAULT_STATISTICS.FAULTY_PARTS_NAME.eq
|
|
|
(faultStatisticsBo.getFaultyPartsName()));
|
|
|
|
|
|
- if(faultStatisticsBo.getStartStatisticsDate() != null && faultStatisticsBo.getEndStatisticsDate() != null){
|
|
|
+ if (faultStatisticsBo.getStartStatisticsDate() != null && faultStatisticsBo.getEndStatisticsDate() != null) {
|
|
|
queryWrapper.between("statistics_date", faultStatisticsBo.getStartStatisticsDate(), faultStatisticsBo.getEndStatisticsDate());
|
|
|
}
|
|
|
queryWrapper.select("faulty_parts_name,COUNT(*) as name_count").groupBy("faulty_parts_name");
|
|
@@ -124,7 +126,7 @@ public class FaultStatisticsServiceImpl extends BaseServiceImpl<FaultStatisticsM
|
|
|
*/
|
|
|
@Override
|
|
|
public FaultStatisticsVo selectById(Long id) {
|
|
|
- return this.getOneAs(query().where(FAULT_STATISTICS.ID.eq(id)), FaultStatisticsVo.class);
|
|
|
+ return this.getOneAs(query().where(FAULT_STATISTICS.ID.eq(id)), FaultStatisticsVo.class);
|
|
|
|
|
|
}
|
|
|
|
|
@@ -138,7 +140,7 @@ public class FaultStatisticsServiceImpl extends BaseServiceImpl<FaultStatisticsM
|
|
|
@Override
|
|
|
public List<FaultStatisticsVo> selectList(FaultStatisticsBo faultStatisticsBo) {
|
|
|
QueryWrapper queryWrapper = buildQueryWrapper(faultStatisticsBo);
|
|
|
- return this.listAs(queryWrapper, FaultStatisticsVo.class);
|
|
|
+ return this.listAs(queryWrapper, FaultStatisticsVo.class);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -174,7 +176,7 @@ public class FaultStatisticsServiceImpl extends BaseServiceImpl<FaultStatisticsM
|
|
|
@Override
|
|
|
public PageResult<FaultStatisticsVo> selectPage(FaultStatisticsBo faultStatisticsBo) {
|
|
|
QueryWrapper queryWrapper = buildQueryWrapper(faultStatisticsBo);
|
|
|
- Page<FaultStatisticsVo> page = this.pageAs(PageQuery.build(), queryWrapper, FaultStatisticsVo.class);
|
|
|
+ Page<FaultStatisticsVo> page = this.pageAs(PageQuery.build(), queryWrapper, FaultStatisticsVo.class);
|
|
|
return PageResult.build(page);
|
|
|
}
|
|
|
|
|
@@ -186,7 +188,7 @@ public class FaultStatisticsServiceImpl extends BaseServiceImpl<FaultStatisticsM
|
|
|
*/
|
|
|
@Override
|
|
|
public boolean insert(FaultStatisticsBo faultStatisticsBo) {
|
|
|
- FaultStatistics faultStatistics =MapstructUtils.convert(faultStatisticsBo, FaultStatistics. class);
|
|
|
+ FaultStatistics faultStatistics = MapstructUtils.convert(faultStatisticsBo, FaultStatistics.class);
|
|
|
|
|
|
return this.save(faultStatistics);//使用全局配置的雪花算法主键生成器生成ID值
|
|
|
}
|
|
@@ -198,12 +200,11 @@ public class FaultStatisticsServiceImpl extends BaseServiceImpl<FaultStatisticsM
|
|
|
* @return 结果:true 操作成功,false 操作失败
|
|
|
*/
|
|
|
@Override
|
|
|
- public boolean insertWithPk(FaultStatisticsBo faultStatisticsBo)
|
|
|
- {
|
|
|
+ public boolean insertWithPk(FaultStatisticsBo faultStatisticsBo) {
|
|
|
FaultStatistics faultStatistics = MapstructUtils.convert(faultStatisticsBo, FaultStatistics.class);
|
|
|
|
|
|
|
|
|
- return faultStatisticsMapper.insertWithPk(faultStatistics) > 0;//前台传来主键值
|
|
|
+ return faultStatisticsMapper.insertWithPk(faultStatistics) > 0;//前台传来主键值
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -214,10 +215,10 @@ public class FaultStatisticsServiceImpl extends BaseServiceImpl<FaultStatisticsM
|
|
|
*/
|
|
|
@Override
|
|
|
public boolean update(FaultStatisticsBo faultStatisticsBo) {
|
|
|
- FaultStatistics faultStatistics =MapstructUtils.convert(faultStatisticsBo, FaultStatistics. class);
|
|
|
- if (ObjectUtil.isNotNull(faultStatistics) && ObjectUtil.isNotNull(faultStatistics.getId())){
|
|
|
+ FaultStatistics faultStatistics = MapstructUtils.convert(faultStatisticsBo, FaultStatistics.class);
|
|
|
+ if (ObjectUtil.isNotNull(faultStatistics) && ObjectUtil.isNotNull(faultStatistics.getId())) {
|
|
|
boolean updated = this.updateById(faultStatistics);
|
|
|
- return updated;
|
|
|
+ return updated;
|
|
|
}
|
|
|
return false;
|
|
|
}
|