Browse Source

区直部门暂存v1

dev_shibei_match
yinzuomei 5 years ago
parent
commit
1427c2cbbc
  1. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyDao.java
  2. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerDeptDao.java
  3. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/DeptScoreEntity.java
  4. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/GridCorreLationService.java
  5. 58
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java
  6. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/GridCorreLationServiceImpl.java
  7. 12
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyDao.xml
  8. 12
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyDao.java

@ -98,4 +98,14 @@ public interface FactIndexGovrnAblityDeptMonthlyDao extends BaseDao<FactIndexGov
@Param("monthId") String monthId,
@Param("offset") Integer offset,
@Param("pageSize") Integer pageSize);
/**
* @return com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyEntity
* @param customerId
* @param monthId
* @author yinzuomei
* @description 只有一条数据时用
* @Date 2020/9/3 16:45
**/
FactIndexGovrnAblityDeptMonthlyEntity selectOneRecord(@Param("customerId") String customerId, @Param("monthId")String monthId);
}

11
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerDeptDao.java

@ -22,6 +22,7 @@ import com.epmet.dto.screencoll.form.CustomerDeptFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.PostMapping;
import java.util.List;
@ -56,4 +57,14 @@ public interface ScreenCustomerDeptDao extends BaseDao<ScreenCustomerDeptEntity>
* @Date 10:52 2020-08-18
**/
void batchInsertCustomerDept(@Param("list") List<CustomerDeptFormDTO> list, @Param("customerId")String customerId);
/**
* @param customerId
* @param deptId
* @return com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity
* @author yinzuomei
* @description 查询部门所属组织id
* @Date 2020/9/3 16:32
**/
ScreenCustomerDeptEntity selectParentAgencyId(@Param("customerId") String customerId, @Param("deptId") String deptId);
}

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/entity/evaluationindex/indexcal/DeptScoreEntity.java

@ -47,10 +47,10 @@ public class DeptScoreEntity extends BaseEpmetEntity {
*/
private String deptId;
/**
* 所有上级ID用英文逗号分开
*/
private String allParentIds;
/**
* 部门所属的组织id
*/
private String agencyId;
/**
* 季度id: yyyyQ1yyyyQ2yyyyQ3yyyyQ4

12
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/GridCorreLationService.java

@ -3,7 +3,10 @@ package com.epmet.service.evaluationindex.indexcal;
import com.epmet.dto.ScreenCustomerGridDTO;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.dto.indexcal.PageQueryGridFormDTO;
import com.epmet.support.normalizing.batch.IndexInputVO;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -41,4 +44,13 @@ public interface GridCorreLationService {
* @Date 2020/8/27 14:48
**/
List<ScreenCustomerGridDTO> pageGridList(PageQueryGridFormDTO formDTO);
/**
* @return java.util.HashMap<java.lang.String,java.math.BigDecimal>
* @param indexMap
* @author yinzuomei
* @description 通用计算方法
* @Date 2020/9/3 16:07
**/
HashMap<String, BigDecimal> calculate(Map<String, IndexInputVO<BigDecimal>> indexMap);
}

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

@ -22,14 +22,19 @@ import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.IndexCalConstant;
import com.epmet.dao.evaluationindex.indexcal.DeptScoreDao;
import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyDao;
import com.epmet.dao.evaluationindex.screen.ScreenCustomerDeptDao;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.entity.evaluationindex.indexcal.DeptScoreEntity;
import com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyEntity;
import com.epmet.entity.evaluationindex.screen.IndexGroupDetailEntity;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity;
import com.epmet.eum.IndexCodeEnum;
import com.epmet.service.evaluationindex.indexcal.DeptScoreService;
import com.epmet.service.evaluationindex.indexcal.GridCorreLationService;
import com.epmet.service.evaluationindex.indexcal.IndexCodeFieldReService;
import com.epmet.service.evaluationindex.screen.IndexGroupDetailService;
import com.epmet.support.normalizing.BigDecimalScoreCalculator;
@ -42,6 +47,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
@ -49,7 +55,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
@ -67,6 +72,12 @@ public class DeptScoreServiceImpl extends BaseServiceImpl<DeptScoreDao, DeptScor
private FactIndexGovrnAblityDeptMonthlyDao factIndexGovrnAblityDeptMonthlyDao;
@Autowired
private IndexCodeFieldReService indexCodeFieldReService;
@Autowired
private GridCorreLationService gridCorreLationService;
@Autowired
private ScreenCustomerDeptDao screenCustomerDeptDao;
@Autowired
private DeptScoreDao deptScoreDao;
/**
* @param formDTO
@ -94,7 +105,7 @@ public class DeptScoreServiceImpl extends BaseServiceImpl<DeptScoreDao, DeptScor
return Boolean.FALSE;
} else if (NumConstant.ONE == total) {
//只有一个网格时
log.warn(String.format("customerId:%s,monthId:%s,only one fact_index_party_ablity_grid_monthly record", formDTO.getCustomerId(), formDTO.getMonthId()));
log.warn(String.format("customerId:%s,monthId:%s,only one fact_index_govrn_ablity_dept_monthly record", formDTO.getCustomerId(), formDTO.getMonthId()));
this.handleOneGridScene(formDTO);
return Boolean.TRUE;
}
@ -146,21 +157,56 @@ public class DeptScoreServiceImpl extends BaseServiceImpl<DeptScoreDao, DeptScor
}
});
});
//保存中间表记录 TODO
HashMap<String, BigDecimal> resultMap = gridCorreLationService.calculate(indexMap);
//保存中间表记录
this.saveDeptScoreEntity(formDTO,resultMap);
}
/**
* @return void
* @param formDTO
* @param resultMap
* @author yinzuomei
* @description fact_index_dept_score
* @Date 2020/9/3 16:11
**/
@Transactional(rollbackFor = Exception.class)
public void saveDeptScoreEntity(CalculateCommonFormDTO formDTO, HashMap<String, BigDecimal> resultMap) {
String quarterId = DateUtils.getQuarterId(formDTO.getMonthId());
String yearId = DateUtils.getYearId(formDTO.getMonthId());
resultMap.forEach((deptId, governAblityScore) -> {
DeptScoreEntity deptScoreEntity = new DeptScoreEntity();
deptScoreEntity.setCustomerId(formDTO.getCustomerId());
deptScoreEntity.setDeptId(deptId);
deptScoreEntity.setIsTotal(NumConstant.ZERO_STR);
deptScoreEntity.setIndexCode(IndexCodeEnum.ZHI_LI_NENG_LI.getCode());
ScreenCustomerDeptEntity deptEntity = screenCustomerDeptDao.selectParentAgencyId(formDTO.getCustomerId(), deptId);
if (null != deptEntity) {
if(StringUtils.isNotBlank(deptEntity.getParentAgencyId())){
deptScoreEntity.setAgencyId(deptEntity.getParentAgencyId());
}
}
deptScoreEntity.setQuarterId(quarterId);
deptScoreEntity.setYearId(yearId);
deptScoreEntity.setMonthId(formDTO.getMonthId());
deptScoreEntity.setScore(governAblityScore);
deptScoreDao.insert(deptScoreEntity);
});
}
/**
* @param formDTO
* @return void
* @author yinzuomei
* @description TODO
* @description
* @Date 2020/9/3 9:35
**/
private void handleOneGridScene(CalculateCommonFormDTO formDTO) {
FactIndexGovrnAblityDeptMonthlyEntity entity = factIndexGovrnAblityDeptMonthlyDao.selectOneRecord(formDTO.getCustomerId(), formDTO.getMonthId());
HashMap<String, BigDecimal> resultMap = new HashMap<>();
resultMap.put(entity.getDeptId(), new BigDecimal(NumConstant.FIFTY_STR));
this.saveDeptScoreEntity(formDTO, resultMap);
}
/**

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

@ -370,7 +370,8 @@ public class GridCorreLationServiceImpl implements GridCorreLationService {
* @description 调用计算器计算每个指标下各个网格的总分
* @Date 2020/8/30 21:40
**/
private HashMap<String, BigDecimal> calculate(Map<String, IndexInputVO<BigDecimal>> indexMap) {
@Override
public HashMap<String, BigDecimal> calculate(Map<String, IndexInputVO<BigDecimal>> indexMap) {
//构造入参
List<IndexInputVO> indexInputVOS = this.getIndexInputVOList(indexMap);
log.info("计算的参数"+JSON.toJSONString(indexInputVOS));

12
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexGovrnAblityDeptMonthlyDao.xml

@ -140,4 +140,16 @@
m.DEPT_ID ASC
LIMIT #{offset},#{pageSize}
</select>
<!-- 只有一条数据时用 -->
<select id="selectOneRecord" parameterType="map" resultType="com.epmet.entity.evaluationindex.indexcoll.FactIndexGovrnAblityDeptMonthlyEntity">
SELECT
m.DEPT_ID
FROM
fact_index_govrn_ablity_dept_monthly m
WHERE
m.DEL_FLAG = '0'
AND m.CUSTOMER_ID =#{customerId}
AND m.MONTH_ID =#{monthId}
</select>
</mapper>

12
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml

@ -52,4 +52,16 @@
</foreach>
</insert>
<!-- 查询部门所属组织id -->
<select id="selectParentAgencyId" parameterType="map" resultType="com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity">
SELECT
m.PARENT_AGENCY_ID
FROM
screen_customer_dept m
WHERE
m.DEL_FLAG = '0'
AND m.CUSTOMER_ID =#{customerId}
AND m.DEPT_ID =#{deptId}
</select>
</mapper>

Loading…
Cancel
Save