diff --git a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreListResultDTO.java b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreListResultDTO.java index 719c9ba594..656a0dd50c 100644 --- a/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreListResultDTO.java +++ b/epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreListResultDTO.java @@ -23,8 +23,8 @@ public class HistoryScoreListResultDTO implements Serializable { /** * 发布者 */ - private String createdBy; - private String createdById; + private String updatedBy; + private String updatedById; /** * 发布时间 */ diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyWeightConfigurationDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyWeightConfigurationDao.java index 212a504579..2d2d431f6e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyWeightConfigurationDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyWeightConfigurationDao.java @@ -17,6 +17,7 @@ package com.epmet.dao.evaluationindex.indexcoll; /** import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.indexcollect.ScreenPyWeightConfigurationDTO; import com.epmet.dto.indexcollect.form.HistoryScoreListFormDTO; import com.epmet.dto.indexcollect.form.WeightConfigurationListFormDTO; import com.epmet.dto.indexcollect.result.HistoryScoreListResultDTO; @@ -37,4 +38,6 @@ public interface ScreenPyWeightConfigurationDao extends BaseDao selectWeightConfigurationList(WeightConfigurationListFormDTO formDTO); + ScreenPyWeightConfigurationDTO selectOneDTO(); + } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyHistoryScoreServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyHistoryScoreServiceImpl.java index 0a0f72c178..4e6d4e4207 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyHistoryScoreServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyHistoryScoreServiceImpl.java @@ -12,10 +12,12 @@ import com.epmet.commons.tools.utils.Result; import com.epmet.constant.DataSourceConstant; import com.epmet.dao.evaluationindex.indexcoll.ScreenPyHistoryScoreDao; import com.epmet.dao.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailDao; +import com.epmet.dao.evaluationindex.indexcoll.ScreenPyWeightConfigurationDao; import com.epmet.dataaggre.dto.govorg.form.GridLivelyFormDTO; import com.epmet.dataaggre.dto.govorg.result.GridLivelyResultDTO; import com.epmet.dataaggre.feign.DataAggregatorOpenFeignClient; import com.epmet.dto.indexcollect.ScreenPyHistoryScoreDetailDTO; +import com.epmet.dto.indexcollect.ScreenPyWeightConfigurationDTO; import com.epmet.dto.indexcollect.form.HistoryScoreComputeFormDTO; import com.epmet.dto.indexcollect.form.HistoryScoreFormDTO; import com.epmet.dto.indexcollect.form.HistoryScoreListFormDTO; @@ -34,6 +36,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.math.BigDecimal; import java.text.NumberFormat; import java.util.ArrayList; import java.util.List; @@ -56,6 +59,8 @@ public class ScreenPyHistoryScoreServiceImpl implements ScreenPyHistoryScoreServ private ScreenPyHistoryScoreDetailDao screenPyHistoryScoreDetailDao; @Autowired private DataAggregatorOpenFeignClient dataAggregatorOpenFeignClient; + @Autowired + private ScreenPyWeightConfigurationDao screenPyWeightConfigurationDao; @Override @@ -73,11 +78,18 @@ public class ScreenPyHistoryScoreServiceImpl implements ScreenPyHistoryScoreServ ScreenPyHistoryScoreEntity entity = ConvertUtils.sourceToTarget(formDTO, ScreenPyHistoryScoreEntity.class); screenPyHistoryScoreDao.insert(entity); //2.明细表新增数据 + ScreenPyWeightConfigurationDTO wcDTO = screenPyWeightConfigurationDao.selectOneDTO(); List list = new ArrayList<>(); formDTO.getDetailList().forEach(dto -> { ScreenPyHistoryScoreDetailEntity detailEntity = ConvertUtils.sourceToTarget(dto, ScreenPyHistoryScoreDetailEntity.class); detailEntity.setCustomerId(formDTO.getCustomerId()); detailEntity.setHistoryScoreId(entity.getId()); + if (null != wcDTO) { + BigDecimal nldf = detailEntity.getWghyd().multiply(wcDTO.getWghyd()).add(detailEntity.getWghyd().multiply(wcDTO.getWghyd())) + .add(detailEntity.getWghyd().multiply(wcDTO.getWghyd())).add(detailEntity.getWghyd().multiply(wcDTO.getWghyd())) + .add(detailEntity.getWghyd().multiply(wcDTO.getWghyd())).add(detailEntity.getWghyd().multiply(wcDTO.getWghyd())); + detailEntity.setNldf(nldf); + } list.add(detailEntity); }); screenPyHistoryScoreDetailServiceImpl.insertBatch(list); @@ -96,10 +108,17 @@ public class ScreenPyHistoryScoreServiceImpl implements ScreenPyHistoryScoreServ screenPyHistoryScoreDao.updateById(newEntity); //2.更新字表 字表先删后增 List list = new ArrayList<>(); + ScreenPyWeightConfigurationDTO wcDTO = screenPyWeightConfigurationDao.selectOneDTO(); formDTO.getDetailList().forEach(dto -> { ScreenPyHistoryScoreDetailEntity detailEntity = ConvertUtils.sourceToTarget(dto, ScreenPyHistoryScoreDetailEntity.class); detailEntity.setCustomerId(entity.getCustomerId()); detailEntity.setHistoryScoreId(entity.getId()); + if (null != wcDTO) { + BigDecimal nldf = detailEntity.getWghyd().multiply(wcDTO.getWghyd()).add(detailEntity.getWghyd().multiply(wcDTO.getWghyd())) + .add(detailEntity.getWghyd().multiply(wcDTO.getWghyd())).add(detailEntity.getWghyd().multiply(wcDTO.getWghyd())) + .add(detailEntity.getWghyd().multiply(wcDTO.getWghyd())).add(detailEntity.getWghyd().multiply(wcDTO.getWghyd())); + detailEntity.setNldf(nldf); + } list.add(detailEntity); }); screenPyHistoryScoreDetailDao.delByHistoryScoreId(formDTO.getId(), formDTO.getUserId()); diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyWeightConfigurationServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyWeightConfigurationServiceImpl.java index aefe5cb8eb..7616671c45 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyWeightConfigurationServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyWeightConfigurationServiceImpl.java @@ -28,7 +28,7 @@ import java.util.List; */ @Slf4j @Service -@DataSource(DataSourceConstant.EVALUATION_INDEX_READ) +@DataSource(DataSourceConstant.EVALUATION_INDEX) public class ScreenPyWeightConfigurationServiceImpl extends BaseServiceImpl implements ScreenPyWeightConfigurationService { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyHistoryScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyHistoryScoreDao.xml index 7a79fbaa32..055e9672d6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyHistoryScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyHistoryScoreDao.xml @@ -10,11 +10,11 @@ a.title, CONCAT(DATE_FORMAT(a.start_time,'%Y年%m月%d日'),'-',DATE_FORMAT(a.end_time,'%Y年%m月%d日')) `time`, DATE_FORMAT(a.release_time,'%Y-%m-%d %H:%i') releaseTime, - a.created_by createdById, - b.real_name createdBy + a.updated_by updatedById, + b.real_name updatedBy FROM screen_py_history_score a - LEFT JOIN epmet_user.customer_staff b ON a.customer_id = b.customer_id AND a.created_by = b.user_id + LEFT JOIN epmet_user.customer_staff b ON a.customer_id = b.customer_id AND a.updated_by = b.user_id WHERE a.del_flag = '0' @@ -26,6 +26,7 @@ + ORDER BY a.start_time DESC diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyWeightConfigurationDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyWeightConfigurationDao.xml index 7c286faf1a..747639f09a 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyWeightConfigurationDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyWeightConfigurationDao.xml @@ -5,8 +5,8 @@ + +