Browse Source

自身和下级分数计算

dev_shibei_match
jianjun 5 years ago
parent
commit
2a73d876b0
  1. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencySelfSubScoreDao.java
  2. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencySubScoreDao.java
  3. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunitySelfSubScoreDao.java
  4. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunitySubScoreDao.java
  5. 39
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptSelfSubScoreDao.java
  6. 9
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptSubScoreDao.java
  7. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/AgencySubScoreEntity.java
  8. 100
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/DeptSelfSubScoreEntity.java
  9. 88
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java
  10. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java
  11. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java
  12. 1
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencySelfSubScoreDao.xml
  13. 1
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencySubScoreDao.xml
  14. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunitySelfSubScoreDao.xml
  15. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunitySubScoreDao.xml
  16. 61
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptSelfSubScoreDao.xml
  17. 22
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptSubScoreDao.xml

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencySelfSubScoreDao.java

@ -35,5 +35,5 @@ public interface AgencySelfSubScoreDao extends BaseDao<AgencySelfSubScoreEntity>
int insertBatch(@Param("list") List<AgencySelfSubScoreEntity> list);
int deleteByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("parentIndexCode") String parentIndexCode);
int deleteByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("dataType") String dataType, @Param("parentIndexCode") String parentIndexCode);
}

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencySubScoreDao.java

@ -52,5 +52,6 @@ public interface AgencySubScoreDao extends BaseDao<AgencyScoreEntity> {
*/
Integer deleteOldRecord(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("dataType") String dataType, @Param("delNum") Integer delNum);
List<AgencySubScoreEntity> selectSubListByPath(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("levelIndexPath") String levelIndexPath);
List<AgencySubScoreEntity> selectSubListByPath(@Param("customerId") String customerId, @Param("monthId") String monthId,
@Param("dataType") String dataType, @Param("allIndexCodePath") String allIndexCodePath);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunitySelfSubScoreDao.java

@ -33,7 +33,7 @@ import java.util.List;
@Mapper
public interface CommunitySelfSubScoreDao extends BaseDao<CommunitySelfSubScoreEntity> {
int deleteByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("indexCode") String indexCode);
int deleteByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("parentIndexCode") String parentIndexCode);
int insertBatch(@Param("list") List<CommunitySelfSubScoreEntity> communitySelfSubScoreEntities);
}

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/CommunitySubScoreDao.java

@ -52,5 +52,5 @@ public interface CommunitySubScoreDao extends BaseDao<FactIndexCommunitySubScore
Integer deleteOldRecord(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("delNum") Integer delNum);
List<FactIndexCommunitySubScoreEntity> selectSubListByPath(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("levelIndexPath") String levelIndexPath);
List<FactIndexCommunitySubScoreEntity> selectSubListByPath(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("allIndexCodePath") String allIndexCodePath);
}

39
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptSelfSubScoreDao.java

@ -0,0 +1,39 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao.evaluationindex.indexcal;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.entity.evaluationindex.indexcal.DeptSelfSubScoreEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 社区相关 自身/下级分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-21
*/
@Mapper
public interface DeptSelfSubScoreDao extends BaseDao<DeptSelfSubScoreEntity> {
int deleteByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("parentIndexCode") String parentIndexCode);
int insertBatch(@Param("list") List<DeptSelfSubScoreEntity> deptSelfSubScoreEntities);
}

9
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptSubScoreDao.java

@ -22,7 +22,6 @@ import com.epmet.entity.evaluationindex.indexcal.DeptSubScoreEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import javax.annotation.security.PermitAll;
import java.util.List;
/**
@ -54,7 +53,9 @@ public interface DeptSubScoreDao extends BaseDao<DeptSubScoreEntity> {
* @Date 2020/9/10 12:28
**/
int deleteBatches(@Param("customerId") String customerId,
@Param("monthId") String monthId,
@Param("allParentIndexCode") String allParentIndexCode,
@Param("deleteSize") Integer deleteSize);
@Param("monthId") String monthId,
@Param("allParentIndexCode") String allParentIndexCode,
@Param("deleteSize") Integer deleteSize);
List<DeptSubScoreEntity> selectSubListByPath(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("allIndexCodePath") String allIndexCodePath);
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/AgencySubScoreEntity.java

@ -96,4 +96,9 @@ public class AgencySubScoreEntity extends BaseEpmetEntity {
* 权重同一组权重总和=1
*/
private BigDecimal weight;
/**
* 所有指标code拼接的字符串 冒号隔开
*/
private String allParentIndexCode;
}

100
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/DeptSelfSubScoreEntity.java

@ -0,0 +1,100 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.entity.evaluationindex.indexcal;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
/**
* 区直部门相关 自身/下级分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-23
*/
@Data
@EqualsAndHashCode(callSuper = false)
@TableName("fact_index_dept_self_sub_score")
public class DeptSelfSubScoreEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
private String customerId;
/**
* 部门id
*/
private String deptId;
/**
* 组织id
*/
private String agencyId;
/**
* 年度ID: yyyy
*/
private String yearId;
/**
* 季度id: yyyyQ1yyyyQ2yyyyQ3yyyyQ4
*/
private String quarterId;
/**
* 月维度Id: yyyyMM
*/
private String monthId;
/**
* 自身指标得分
*/
private BigDecimal selfScore;
/**
* 下级指标得分
*/
private BigDecimal subScore;
/**
* 党建能力dangjiannengli治理能力zhilinengli服务能力fuwunengli
*/
private String parentIndexCode;
/**
* 所有指标code拼接的字符串 冒号隔开
*/
private String allParentIndexCode;
/**
* 自身指标权重
*/
private BigDecimal selfWeight;
/**
* 下级指标权重
*/
private BigDecimal subWeight;
}

88
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java

@ -27,13 +27,16 @@ import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant;
import com.epmet.constant.IndexCalConstant;
import com.epmet.dao.evaluationindex.indexcal.DeptScoreDao;
import com.epmet.dao.evaluationindex.indexcal.DeptSelfSubScoreDao;
import com.epmet.dao.evaluationindex.indexcal.DeptSubScoreDao;
import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyDao;
import com.epmet.dao.evaluationindex.screen.IndexGroupDetailDao;
import com.epmet.dao.evaluationindex.screen.ScreenCustomerDeptDao;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.dto.indexcal.DeotScore;
import com.epmet.dto.indexcal.DeptScoreDetailDTO;
import com.epmet.entity.evaluationindex.indexcal.DeptScoreEntity;
import com.epmet.entity.evaluationindex.indexcal.DeptSelfSubScoreEntity;
import com.epmet.entity.evaluationindex.indexcal.DeptSubScoreEntity;
import com.epmet.entity.evaluationindex.screen.IndexGroupDetailEntity;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity;
@ -59,10 +62,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -91,6 +91,10 @@ public class DeptScoreServiceImpl extends BaseServiceImpl<DeptScoreDao, DeptScor
private DeptScoreDao deptScoreDao;
@Autowired
private DeptSubScoreDao deptSubScoreDao;
@Autowired
private IndexGroupDetailDao indexGroupDetailDao;
@Autowired
private DeptSelfSubScoreDao deptSelfSubScoreDao;
/**
* @param formDTO
@ -105,15 +109,87 @@ public class DeptScoreServiceImpl extends BaseServiceImpl<DeptScoreDao, DeptScor
calculateZhiLiNengLiScore(formDTO);
//2、区直部门 总分计算
calculateDeptTotalScore(formDTO);
//计算自身和下级
calculateSelfSubScore(formDTO);
return true;
}
private void calculateSelfSubScore(CalculateCommonFormDTO formDTO) {
//todo 指标添加缓存
List<IndexGroupDetailEntity> indexList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(),
IndexCodeEnum.QU_ZHI_BU_MEN.getCode());
if (CollectionUtils.isEmpty(indexList)) {
log.error("calculateSelfSubScore customerId:{} have not any indexGroupDetail", formDTO.getCustomerId());
throw new RenException("客户【网格相关】指标权重信息不存在");
}
indexList.forEach(index -> {
String levelIndexPath = index.getAllParentIndexCode().concat(StrConstant.COLON).concat(index.getIndexCode());
//获取出指标之间的关系
List<IndexGroupDetailEntity> selfSubIndexList = indexGroupDetailDao.selectSelfSubIndex(formDTO.getCustomerId(), levelIndexPath);
if (CollectionUtils.isEmpty(selfSubIndexList)) {
log.error("calculateSelfSubScore indexGroupDetailDao.selectSelfSubIndex return empty,customerId:{}", formDTO.getCustomerId());
return;
}
//获取该能力下的分数
List<DeptSubScoreEntity> subScore = deptSubScoreDao.selectSubListByPath(formDTO.getCustomerId(), formDTO.getMonthId(), levelIndexPath);
if (CollectionUtils.isEmpty(subScore)) {
log.error("calculateSelfSubScore communitySubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId());
return;
}
Map<String, Set<String>> selfSubParentMap = new HashMap<>();
selfSubParentMap.put("zishen", new HashSet<>());
selfSubParentMap.put("xiaji", new HashSet<>());
selfSubIndexList.forEach(o -> {
//找出自身 和下级的指标
if (o.getAllIndexCodePath().indexOf("xiaji") > -1) {
selfSubParentMap.get("xiaji").add(o.getIndexCode());
} else {
selfSubParentMap.get("zishen").add(o.getIndexCode());
}
});
Map<String, DeptSelfSubScoreEntity> insertMap = new HashMap<>();
subScore.forEach(score -> {
String key = score.getAgencyId().concat(index.getIndexCode());
DeptSelfSubScoreEntity scoreEntity = insertMap.get(key);
if (scoreEntity == null) {
scoreEntity = ConvertUtils.sourceToTarget(score, DeptSelfSubScoreEntity.class);
insertMap.put(key, scoreEntity);
scoreEntity.setSelfScore(new BigDecimal(0));
scoreEntity.setSubScore(new BigDecimal(0));
scoreEntity.setParentIndexCode(index.getIndexCode());
scoreEntity.setSelfWeight(new BigDecimal(0));
scoreEntity.setSubWeight(new BigDecimal(0));
}
BigDecimal partScore = score.getScore().multiply(score.getWeight());
if (selfSubParentMap.get("xiaji").contains(score.getIndexCode())) {
scoreEntity.setSubScore(scoreEntity.getSubScore().add(partScore));
scoreEntity.setSubWeight(scoreEntity.getSubWeight().add(score.getWeight()));
} else {
scoreEntity.setSelfScore(scoreEntity.getSelfScore().add(partScore));
scoreEntity.setSelfWeight(scoreEntity.getSelfWeight().add(score.getWeight()));
}
log.debug("=====key" + key + ",grid:{},originScore:{},weight:{},finalScore:{},total", score.getAgencyId(), score.getScore(), score.getWeight(), partScore);
});
deleteAndInsertSelfSubScore(formDTO, index.getIndexCode(), insertMap);
});
}
@Transactional(rollbackFor = Exception.class)
public void deleteAndInsertSelfSubScore(CalculateCommonFormDTO formDTO, String indexCode, Map<String, DeptSelfSubScoreEntity> insertMap) {
int effectRow = 0;
do {
deptSelfSubScoreDao.deleteByMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), indexCode);
} while (effectRow > 0);
deptSelfSubScoreDao.insertBatch(new ArrayList<>(insertMap.values()));
}
/**
* @return void
* @param formDTO
* @return void
* @author yinzuomei
* @description 区直部门-党建能力分值计算
* @Date 2020/9/10 17:21
* @Date 2020/9/10 17:21
**/
private void calculateZhiLiNengLiScore(CalculateCommonFormDTO formDTO) {
//获取区直部门的治理能力下,五级指标权重

7
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java

@ -10,6 +10,7 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant;
import com.epmet.constant.IndexCalConstant;
import com.epmet.constant.OrgTypeConstant;
import com.epmet.dao.evaluationindex.indexcal.AgencyScoreDao;
import com.epmet.dao.evaluationindex.indexcal.AgencySelfSubScoreDao;
import com.epmet.dao.evaluationindex.indexcal.AgencySubScoreDao;
@ -112,7 +113,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
private void calculateSelfSubScore(CalculateCommonFormDTO formDTO) {
//todo 指标添加缓存
List<IndexGroupDetailEntity> indexList = indexGroupDetailService.getDetailListByParentCode(formDTO.getCustomerId(),
IndexCodeEnum.QU_ZHI_BU_MEN.getCode());
IndexCodeEnum.QUAN_QU_XIANG_GUAN.getCode());
if (CollectionUtils.isEmpty(indexList)) {
log.error("calculateSelfSubScore customerId:{} have not any indexGroupDetail", formDTO.getCustomerId());
throw new RenException("客户【网格相关】指标权重信息不存在");
@ -126,7 +127,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
return;
}
//获取该能力下的分数
List<AgencySubScoreEntity> subScore = agencySubScoreDao.selectSubListByPath(formDTO.getCustomerId(), formDTO.getMonthId(), levelIndexPath);
List<AgencySubScoreEntity> subScore = agencySubScoreDao.selectSubListByPath(formDTO.getCustomerId(), formDTO.getMonthId(), OrgTypeConstant.DISTRICT, levelIndexPath);
if (CollectionUtils.isEmpty(subScore)) {
log.error("calculateSelfSubScore communitySubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId());
return;
@ -173,7 +174,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict
public void deleteAndInsertSelfSubScore(CalculateCommonFormDTO formDTO, String indexCode, Map<String, AgencySelfSubScoreEntity> insertMap) {
int effectRow = 0;
do {
agencySelfSubScoreDao.deleteByMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), indexCode);
agencySelfSubScoreDao.deleteByMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), OrgTypeConstant.DISTRICT, indexCode);
} while (effectRow > 0);
agencySelfSubScoreDao.insertBatch(new ArrayList<>(insertMap.values()));

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateStreetServiceImpl.java

@ -10,6 +10,7 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant;
import com.epmet.constant.IndexCalConstant;
import com.epmet.constant.OrgTypeConstant;
import com.epmet.dao.evaluationindex.indexcal.AgencyScoreDao;
import com.epmet.dao.evaluationindex.indexcal.AgencySelfSubScoreDao;
import com.epmet.dao.evaluationindex.indexcal.AgencySubScoreDao;
@ -129,7 +130,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
return;
}
//获取该能力下的分数
List<AgencySubScoreEntity> subScore = agencySubScoreDao.selectSubListByPath(formDTO.getCustomerId(), formDTO.getMonthId(), levelIndexPath);
List<AgencySubScoreEntity> subScore = agencySubScoreDao.selectSubListByPath(formDTO.getCustomerId(), formDTO.getMonthId(), OrgTypeConstant.STREET, levelIndexPath);
if (CollectionUtils.isEmpty(subScore)) {
log.error("calculateSelfSubScore communitySubScoreDao.selectSubListByPath return empty,customerId:{} ", formDTO.getCustomerId());
return;
@ -176,7 +177,7 @@ public class IndexCalculateStreetServiceImpl implements IndexCalculateStreetServ
public void deleteAndInsertSelfSubScore(CalculateCommonFormDTO formDTO, String indexCode, Map<String, AgencySelfSubScoreEntity> insertMap) {
int effectRow = 0;
do {
agencySelfSubScoreDao.deleteByMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), indexCode);
agencySelfSubScoreDao.deleteByMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), OrgTypeConstant.STREET, indexCode);
} while (effectRow > 0);
agencySelfSubScoreDao.insertBatch(new ArrayList<>(insertMap.values()));

1
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencySelfSubScoreDao.xml

@ -6,6 +6,7 @@
<delete id="deleteByMonthId">
delete from fact_index_agency_self_sub_score
where CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
and DATA_TYPE = #{dataType,jdbcType=VARCHAR}
and MONTH_ID = #{monthId,jdbcType=VARCHAR}
and PARENT_INDEX_CODE = #{parentIndexCode,jdbcType=VARCHAR}
limit 1000

1
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencySubScoreDao.xml

@ -54,6 +54,7 @@
fact_index_agency_sub_score
WHERE
DEL_FLAG = '0'
AND data_type = #{dataType}
AND CUSTOMER_ID = #{customerId}
AND ALL_PARENT_INDEX_CODE = #{allIndexCodePath,jdbcType=VARCHAR}
</select>

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunitySelfSubScoreDao.xml

@ -12,7 +12,7 @@
</delete>
<insert id="insertBatch">
INSERT INTO `fact_index_grid_self_sub_score` (
INSERT INTO `fact_index_community_self_sub_score` (
`ID`,
`CUSTOMER_ID`,
`AGENCY_ID`,

2
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/CommunitySubScoreDao.xml

@ -50,7 +50,7 @@
ID, CUSTOMER_ID, AGENCY_ID, PARENT_AGENCY_ID, YEAR_ID, QUARTER_ID, MONTH_ID, ORIGIN_VALUE, SCORE, INDEX_CODE,ALL_PARENT_INDEX_CODE,
WEIGHT
FROM
fact_index_grid_sub_score
fact_index_community_sub_score
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}

61
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptSelfSubScoreDao.xml

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.evaluationindex.indexcal.DeptSelfSubScoreDao">
<delete id="deleteByMonthId">
delete from fact_index_dept_self_sub_score
where CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
AND MONTH_ID = #{monthId,jdbcType=VARCHAR}
AND PARENT_INDEX_CODE = #{parentIndexCode,jdbcType=VARCHAR}
limit 1000
</delete>
<insert id="insertBatch">
INSERT INTO `fact_index_dept_self_sub_score` (
`ID`,
`CUSTOMER_ID`,
`AGENCY_ID`,
`DEPT_ID`,
`QUARTER_ID`,
`YEAR_ID`,
`MONTH_ID`,
`SELF_SCORE`,
`SUB_SCORE`,
`PARENT_INDEX_CODE`,
`ALL_PARENT_INDEX_CODE`,
`SELF_WEIGHT`,
`SUB_WEIGHT`,
`DEL_FLAG`,
`REVISION`,
`CREATED_BY`,
`CREATED_TIME`,
`UPDATED_BY`,
`UPDATED_TIME`
)
VALUES
<foreach collection="list" item="item" index="index" separator=",">
(
(SELECT REPLACE(UUID(), '-', '') AS id),
#{item.customerId},
#{item.agencyId},
#{item.deptId},
#{item.quarterId},
#{item.yearId},
#{item.monthId},
#{item.selfScore},
#{item.subScore},
#{item.parentIndexCode},
#{item.allParentIndexCode},
#{item.selfWeight},
#{item.subWeight},
0,
0,
'APP_USER',
now(),
'APP_USER',
now()
)
</foreach>
</insert>
</mapper>

22
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptSubScoreDao.xml

@ -59,4 +59,26 @@
limit #{deleteSize}
</if>
</delete>
<select id="selectSubListByPath" resultType="com.epmet.entity.evaluationindex.indexcal.DeptSubScoreEntity">
SELECT
ID,
CUSTOMER_ID,
DEPT_ID,
AGENCY_ID,
QUARTER_ID,
YEAR_ID,
MONTH_ID,
ORIGIN_VALUE,
SCORE,
INDEX_CODE,
ALL_PARENT_INDEX_CODE,
WEIGHT
FROM
fact_index_dept_sub_score
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
AND ALL_PARENT_INDEX_CODE = #{allIndexCodePath,jdbcType=VARCHAR}
</select>
</mapper>

Loading…
Cancel
Save