Browse Source

权重配置

dev
sunyuchao 3 years ago
parent
commit
6b645c6572
  1. 4
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcollect/result/HistoryScoreListResultDTO.java
  2. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/ScreenPyWeightConfigurationDao.java
  3. 19
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyHistoryScoreServiceImpl.java
  4. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/ScreenPyWeightConfigurationServiceImpl.java
  5. 7
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyHistoryScoreDao.xml
  6. 27
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyWeightConfigurationDao.xml

4
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 updatedBy;
private String createdById; private String updatedById;
/** /**
* 发布时间 * 发布时间
*/ */

3
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.commons.mybatis.dao.BaseDao;
import com.epmet.dto.indexcollect.ScreenPyWeightConfigurationDTO;
import com.epmet.dto.indexcollect.form.HistoryScoreListFormDTO; import com.epmet.dto.indexcollect.form.HistoryScoreListFormDTO;
import com.epmet.dto.indexcollect.form.WeightConfigurationListFormDTO; import com.epmet.dto.indexcollect.form.WeightConfigurationListFormDTO;
import com.epmet.dto.indexcollect.result.HistoryScoreListResultDTO; import com.epmet.dto.indexcollect.result.HistoryScoreListResultDTO;
@ -37,4 +38,6 @@ public interface ScreenPyWeightConfigurationDao extends BaseDao<ScreenPyWeightCo
List<WeightConfigurationListResultDTO> selectWeightConfigurationList(WeightConfigurationListFormDTO formDTO); List<WeightConfigurationListResultDTO> selectWeightConfigurationList(WeightConfigurationListFormDTO formDTO);
ScreenPyWeightConfigurationDTO selectOneDTO();
} }

19
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.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.indexcoll.ScreenPyHistoryScoreDao; import com.epmet.dao.evaluationindex.indexcoll.ScreenPyHistoryScoreDao;
import com.epmet.dao.evaluationindex.indexcoll.ScreenPyHistoryScoreDetailDao; 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.form.GridLivelyFormDTO;
import com.epmet.dataaggre.dto.govorg.result.GridLivelyResultDTO; import com.epmet.dataaggre.dto.govorg.result.GridLivelyResultDTO;
import com.epmet.dataaggre.feign.DataAggregatorOpenFeignClient; import com.epmet.dataaggre.feign.DataAggregatorOpenFeignClient;
import com.epmet.dto.indexcollect.ScreenPyHistoryScoreDetailDTO; 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.HistoryScoreComputeFormDTO;
import com.epmet.dto.indexcollect.form.HistoryScoreFormDTO; import com.epmet.dto.indexcollect.form.HistoryScoreFormDTO;
import com.epmet.dto.indexcollect.form.HistoryScoreListFormDTO; 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.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.text.NumberFormat; import java.text.NumberFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -56,6 +59,8 @@ public class ScreenPyHistoryScoreServiceImpl implements ScreenPyHistoryScoreServ
private ScreenPyHistoryScoreDetailDao screenPyHistoryScoreDetailDao; private ScreenPyHistoryScoreDetailDao screenPyHistoryScoreDetailDao;
@Autowired @Autowired
private DataAggregatorOpenFeignClient dataAggregatorOpenFeignClient; private DataAggregatorOpenFeignClient dataAggregatorOpenFeignClient;
@Autowired
private ScreenPyWeightConfigurationDao screenPyWeightConfigurationDao;
@Override @Override
@ -73,11 +78,18 @@ public class ScreenPyHistoryScoreServiceImpl implements ScreenPyHistoryScoreServ
ScreenPyHistoryScoreEntity entity = ConvertUtils.sourceToTarget(formDTO, ScreenPyHistoryScoreEntity.class); ScreenPyHistoryScoreEntity entity = ConvertUtils.sourceToTarget(formDTO, ScreenPyHistoryScoreEntity.class);
screenPyHistoryScoreDao.insert(entity); screenPyHistoryScoreDao.insert(entity);
//2.明细表新增数据 //2.明细表新增数据
ScreenPyWeightConfigurationDTO wcDTO = screenPyWeightConfigurationDao.selectOneDTO();
List<ScreenPyHistoryScoreDetailEntity> list = new ArrayList<>(); List<ScreenPyHistoryScoreDetailEntity> list = new ArrayList<>();
formDTO.getDetailList().forEach(dto -> { formDTO.getDetailList().forEach(dto -> {
ScreenPyHistoryScoreDetailEntity detailEntity = ConvertUtils.sourceToTarget(dto, ScreenPyHistoryScoreDetailEntity.class); ScreenPyHistoryScoreDetailEntity detailEntity = ConvertUtils.sourceToTarget(dto, ScreenPyHistoryScoreDetailEntity.class);
detailEntity.setCustomerId(formDTO.getCustomerId()); detailEntity.setCustomerId(formDTO.getCustomerId());
detailEntity.setHistoryScoreId(entity.getId()); 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); list.add(detailEntity);
}); });
screenPyHistoryScoreDetailServiceImpl.insertBatch(list); screenPyHistoryScoreDetailServiceImpl.insertBatch(list);
@ -96,10 +108,17 @@ public class ScreenPyHistoryScoreServiceImpl implements ScreenPyHistoryScoreServ
screenPyHistoryScoreDao.updateById(newEntity); screenPyHistoryScoreDao.updateById(newEntity);
//2.更新字表 字表先删后增 //2.更新字表 字表先删后增
List<ScreenPyHistoryScoreDetailEntity> list = new ArrayList<>(); List<ScreenPyHistoryScoreDetailEntity> list = new ArrayList<>();
ScreenPyWeightConfigurationDTO wcDTO = screenPyWeightConfigurationDao.selectOneDTO();
formDTO.getDetailList().forEach(dto -> { formDTO.getDetailList().forEach(dto -> {
ScreenPyHistoryScoreDetailEntity detailEntity = ConvertUtils.sourceToTarget(dto, ScreenPyHistoryScoreDetailEntity.class); ScreenPyHistoryScoreDetailEntity detailEntity = ConvertUtils.sourceToTarget(dto, ScreenPyHistoryScoreDetailEntity.class);
detailEntity.setCustomerId(entity.getCustomerId()); detailEntity.setCustomerId(entity.getCustomerId());
detailEntity.setHistoryScoreId(entity.getId()); 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); list.add(detailEntity);
}); });
screenPyHistoryScoreDetailDao.delByHistoryScoreId(formDTO.getId(), formDTO.getUserId()); screenPyHistoryScoreDetailDao.delByHistoryScoreId(formDTO.getId(), formDTO.getUserId());

2
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 @Slf4j
@Service @Service
@DataSource(DataSourceConstant.EVALUATION_INDEX_READ) @DataSource(DataSourceConstant.EVALUATION_INDEX)
public class ScreenPyWeightConfigurationServiceImpl extends BaseServiceImpl<ScreenPyWeightConfigurationDao, ScreenPyWeightConfigurationEntity> implements ScreenPyWeightConfigurationService { public class ScreenPyWeightConfigurationServiceImpl extends BaseServiceImpl<ScreenPyWeightConfigurationDao, ScreenPyWeightConfigurationEntity> implements ScreenPyWeightConfigurationService {

7
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyHistoryScoreDao.xml

@ -10,11 +10,11 @@
a.title, a.title,
CONCAT(DATE_FORMAT(a.start_time,'%Y年%m月%d日'),'-',DATE_FORMAT(a.end_time,'%Y年%m月%d日')) `time`, 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, DATE_FORMAT(a.release_time,'%Y-%m-%d %H:%i') releaseTime,
a.created_by createdById, a.updated_by updatedById,
b.real_name createdBy b.real_name updatedBy
FROM FROM
screen_py_history_score a 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 WHERE
a.del_flag = '0' a.del_flag = '0'
<if test="title != null and title != ''"> <if test="title != null and title != ''">
@ -26,6 +26,7 @@
<if test="endTime != null and endTime.trim() != ''"> <if test="endTime != null and endTime.trim() != ''">
<![CDATA[AND a.end_time <= #{endTime}]]> <![CDATA[AND a.end_time <= #{endTime}]]>
</if> </if>
ORDER BY a.start_time DESC
</select> </select>

27
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/ScreenPyWeightConfigurationDao.xml

@ -5,8 +5,8 @@
<select id="selectWeightConfigurationList" resultType="com.epmet.dto.indexcollect.result.WeightConfigurationListResultDTO"> <select id="selectWeightConfigurationList" resultType="com.epmet.dto.indexcollect.result.WeightConfigurationListResultDTO">
SELECT SELECT
ID, id,
CUSTOMER_ID, customer_id,
wghyd, wghyd,
sjff, sjff,
xlgc, xlgc,
@ -16,9 +16,28 @@
FROM FROM
screen_py_weight_configuration screen_py_weight_configuration
WHERE WHERE
DEL_FLAG = '0' del_flag = '0'
ORDER BY ORDER BY
UPDATED_TIME DESC updated_time DESC
</select>
<select id="selectOneDTO" resultType="com.epmet.dto.indexcollect.ScreenPyWeightConfigurationDTO">
SELECT
id,
customer_id,
wghyd,
sjff,
xlgc,
rhzt,
ldgz,
qtgz
FROM
screen_py_weight_configuration
WHERE
del_flag = '0'
ORDER BY
updated_time DESC
LIMIT 1
</select> </select>
</mapper> </mapper>

Loading…
Cancel
Save