|
@@ -1,12 +1,19 @@
|
|
|
package com.energy.manage.service.service.analysis.impl;
|
|
|
|
|
|
-import com.energy.manage.service.domain.dto.analysis.AnalysisResultReportDto;
|
|
|
+import com.energy.manage.common.enums.ResultReportEnums;
|
|
|
+import com.energy.manage.common.po.analysis.AnalysisResultReportPo;
|
|
|
+import com.energy.manage.service.domain.vo.analysis.AnalysisResultReportTypeVo;
|
|
|
+import com.energy.manage.service.domain.vo.analysis.AnalysisResultReportVo;
|
|
|
import com.energy.manage.service.mappers.analysis.AnalysisResultReportMapper;
|
|
|
import com.energy.manage.service.service.analysis.AnalysisResultReportService;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
+import java.util.concurrent.atomic.AtomicInteger;
|
|
|
|
|
|
/**
|
|
|
* @author chy
|
|
@@ -21,11 +28,40 @@ public class AnalysisResultReportServiceImpl implements AnalysisResultReportServ
|
|
|
/**
|
|
|
* 批量添加保存报告
|
|
|
*
|
|
|
- * @param resultReportDto
|
|
|
+ * @param resultReportVos
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public int saveReportBatch(List<AnalysisResultReportDto> resultReportDto) {
|
|
|
- return analysisResultReportMapper.saveReportBatch(resultReportDto);
|
|
|
+ public int saveReportBatch(List<AnalysisResultReportVo> resultReportVos) {
|
|
|
+ AtomicInteger integer = new AtomicInteger(0);
|
|
|
+ resultReportVos.forEach(item -> {
|
|
|
+ AnalysisResultReportPo resultReportPo = analysisResultReportMapper.selectByBatchCodeAndReportType(item.getBatchCode(),item.getReportType());
|
|
|
+ if(resultReportPo != null){
|
|
|
+ analysisResultReportMapper.updateReport(item);
|
|
|
+ }else{
|
|
|
+ analysisResultReportMapper.insertReport(item);
|
|
|
+ }
|
|
|
+ integer.getAndIncrement();
|
|
|
+ });
|
|
|
+ return integer.get();
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询报告类型
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ public List<AnalysisResultReportTypeVo> getRportType() {
|
|
|
+ List<AnalysisResultReportTypeVo> resultReportTypeVos = new ArrayList<>();
|
|
|
+ Arrays.stream(ResultReportEnums.values()).forEach(item -> {
|
|
|
+ AnalysisResultReportTypeVo resultReportTypeVo = new AnalysisResultReportTypeVo();
|
|
|
+ resultReportTypeVo.setReportType(item.getReportType());
|
|
|
+ resultReportTypeVo.setReportTypeName(item.getReportName());
|
|
|
+ resultReportTypeVos.add(resultReportTypeVo);
|
|
|
+ });
|
|
|
+ return resultReportTypeVos;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|