Browse Source

Merge branch 'dev_screen_data' of C:\Users\Administrator\Desktop\党群e事通后端 with conflicts.

dev_shibei_match
zhangyongzhangyong 5 years ago
parent
commit
95d8c395cb
  1. 4
      epmet-gateway/pom.xml
  2. 18
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexGridScoreDTO.java
  3. 4
      epmet-module/data-statistical/data-statistical-server/pom.xml
  4. 33
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/OrgTypeConstant.java
  5. 24
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java
  6. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java
  7. 18
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java
  8. 13
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/FactIndexCommunityScoreDao.java
  9. 32
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/FactIndexGridScoreDao.java
  10. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java
  11. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerDeptDao.java
  12. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java
  13. 10
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexCollectService.java
  14. 332
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java
  15. 21
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml
  16. 20
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml
  17. 20
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/FactIndexCommunityScoreDao.xml
  18. 21
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/FactIndexGridScoreDao.xml
  19. 10
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml
  20. 11
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml
  21. 12
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml

4
epmet-gateway/pom.xml

@ -181,8 +181,8 @@
<gateway.routes.data-report-server.uri>lb://data-report-server</gateway.routes.data-report-server.uri>
<!-- <gateway.routes.data-report-server.uri>http://localhost:8109</gateway.routes.data-report-server.uri>-->
<!-- 29、统计服务 -->
<gateway.routes.data-statistical-server.uri>lb://data-statistical-server</gateway.routes.data-statistical-server.uri>
<!-- <gateway.routes.data-statistical-server.uri>http://localhost:8108</gateway.routes.data-statistical-server.uri>-->
<!--<gateway.routes.data-statistical-server.uri>lb://data-statistical-server</gateway.routes.data-statistical-server.uri>-->
<gateway.routes.data-statistical-server.uri>http://localhost:8108</gateway.routes.data-statistical-server.uri>
<!-- 30、内容审核服务 -->
<gateway.routes.epmet-openapi-scan.uri>lb://epmet-openapi-scan</gateway.routes.epmet-openapi-scan.uri>
<!-- <gateway.routes.epmet-openapi-scan.uri>http://localhost:8107</gateway.routes.epmet-openapi-scan.uri>-->

18
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/FactIndexGridScoreDTO.java

@ -60,24 +60,24 @@ public class FactIndexGridScoreDTO implements Serializable {
private String monthId;
/**
* 总指数分值
* 年维度Id: yyyy
*/
private BigDecimal totalScore;
private String yearId;
/**
* 党建能力分值
* 1总分0不是默认0
*/
private BigDecimal partyAblityScore;
private String isTotal;
/**
* 治理能力分值
* 分值
*/
private BigDecimal govrnAblityScore;
private BigDecimal score;
/**
* 服务能力分值
* 党建能力dangjiannengli治理能力zhilinengli服务能力fuwunengli网格相关(前三者之和)wanggexiangguan
*/
private BigDecimal serviceAblityScore;
private String indexCode;
/**
* 删除标识 0未删除1已删除
@ -109,4 +109,4 @@ public class FactIndexGridScoreDTO implements Serializable {
*/
private Date updatedTime;
}
}

4
epmet-module/data-statistical/data-statistical-server/pom.xml

@ -201,7 +201,7 @@
<spring.redis.port>6379</spring.redis.port>
<spring.redis.password>123456</spring.redis.password>
<!-- nacos -->
<nacos.register-enabled>true</nacos.register-enabled>
<nacos.register-enabled>false</nacos.register-enabled>
<nacos.server-addr>192.168.1.130:8848</nacos.server-addr>
<nacos.discovery.namespace>6ceab336-d004-4acf-89c6-e121d06f4988</nacos.discovery.namespace>
<nacos.config.namespace></nacos.config.namespace>
@ -416,4 +416,4 @@
</properties>
</profile>
</profiles>
</project>
</project>

33
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/constant/OrgTypeConstant.java

@ -0,0 +1,33 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
* <p>
* https://www.renren.io
* <p>
* 版权所有侵权必究
*/
package com.epmet.constant;
/**
* 组织类别 常量
*
* @author sun
* @since 1.0.0
*/
public interface OrgTypeConstant {
/**
* 部门
*/
String DEPARTMENT = "department";
/**
* 网格
*/
String GRID = "grid";
/**
* 组织
*/
String AGENCY = "agency";
}

24
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/FactIndexCollectController.java

@ -4,12 +4,10 @@ import com.epmet.commons.extappauth.annotation.ExternalAppRequestAuth;
import com.epmet.commons.extappauth.bean.ExternalAppRequestParam;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.indexcollect.form.*;
import com.epmet.dto.screencoll.form.IndexDataMonthlyFormDTO;
import com.epmet.service.evaluationindex.indexcoll.FactIndexCollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -153,4 +151,22 @@ public class FactIndexCollectController {
factIndexCollectService.insertDeptGovrnAbility(formDTO, externalAppRequestParam.getCustomerId());
return new Result();
}
public static void main(String[] args) {
String a = "202009";
System.out.println(a.substring(0,4));
System.out.println(a.substring(4,6));
int[] aa = new int[2];
System.out.println(aa[0]);
System.out.println(aa == null);
IndexDataMonthlyFormDTO monthlyFormDTO = new IndexDataMonthlyFormDTO();
System.out.println(monthlyFormDTO.getIndexTotal());
}
@GetMapping("hahaha")
public Result hahaha(String monthId, String customerId) {
factIndexCollectService.insertScreenIndexDataMonthlyAndYearly(monthId, customerId);
return new Result();
}
}

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java

@ -27,7 +27,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* /街道相关分数表
* /街道相关分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-09-02
@ -62,4 +62,13 @@ public interface AgencyScoreDao extends BaseDao<AgencyScoreEntity> {
*/
List<AgencyScoreDTO> selectStreetInfo(@Param("customerId") String customerId, @Param("monthId")String monthId,@Param("dataType")String dataType);
}
/**
* 根据入参查询 /街道相关分数表 记录
* @param customerId
* @param monthId
* @return java.util.List<com.epmet.dto.indexcal.AgencyScoreDTO>
* @Author zhangyong
* @Date 10:43 2020-09-03
**/
List<AgencyScoreDTO> selectListAgencyScore(@Param("customerId")String customerId, @Param("monthId")String monthId);
}

18
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java

@ -18,8 +18,12 @@
package com.epmet.dao.evaluationindex.indexcal;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.indexcal.DeptScoreDTO;
import com.epmet.entity.evaluationindex.indexcal.DeptScoreEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 区直部门分值表
@ -29,5 +33,15 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface DeptScoreDao extends BaseDao<DeptScoreEntity> {
}
/**
* 根据入参查询 区直部门分值表 记录
* @param customerId
* @param monthId
* @return java.util.List<com.epmet.dto.indexcal.DeptScoreDTO>
* @Author zhangyong
* @Date 10:43 2020-09-03
**/
List<DeptScoreDTO> selectListDeptScore(@Param("customerId")String customerId, @Param("monthId")String monthId);
}

13
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/FactIndexCommunityScoreDao.java

@ -29,7 +29,7 @@ import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 社区相关分数表
* 社区相关分数表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-31
@ -64,6 +64,15 @@ public interface FactIndexCommunityScoreDao extends BaseDao<FactIndexCommunitySc
*/
List<FactIndexCommunityScoreDTO> selectCommunityInfo(@Param("customerId") String customerId,@Param("monthId")String monthId);
/**
* 根据入参查询 查询社区相关信息
* @param customerId
* @param monthId
* @return java.util.List<com.epmet.dto.screen.FactIndexCommunityScoreDTO>
* @Author zhangyong
* @Date 10:43 2020-09-03
**/
List<FactIndexCommunityScoreDTO> selectListCommunityScore(@Param("customerId")String customerId, @Param("monthId")String monthId);
/**
* @Description 街道下级所有社区得分平均值
* @param customerId
@ -73,4 +82,4 @@ public interface FactIndexCommunityScoreDao extends BaseDao<FactIndexCommunitySc
*/
List<SubCommunityAvgResultDTO> selectSubCommAvgScore(@Param("customerId")String customerId, @Param("monthId")String monthId, @Param("indexCode")String indexCode);
}
}

32
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/FactIndexGridScoreDao.java

@ -18,6 +18,7 @@
package com.epmet.dao.evaluationindex.screen;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.screen.FactIndexGridScoreDTO;
import com.epmet.dto.screen.result.SubGridGovernAvgResultDTO;
import com.epmet.dto.screen.result.SubGridAvgResultDTO;
import com.epmet.dto.screen.result.SubGridServiceAvgResultDTO;
@ -44,4 +45,33 @@ public interface FactIndexGridScoreDao extends BaseDao<FactIndexGridScoreEntity>
* @date 2020/8/28 3:20 下午
*/
List<SubGridAvgResultDTO> selectSubGridAvgScore(@Param("customerId")String customerId, @Param("monthId")String monthId, @Param("indexCode")String indexCode);
}
List<SubGridPartyAvgResultDTO> selectSubGridPartyAvgScore(@Param("customerId")String customerId,@Param("monthId")String monthId);
/**
* @Description 社区下属所有网格治理能力汇总平均值
* @param customerId
* @param monthId
* @author zxc
* @date 2020/8/31 9:19 上午
*/
List<SubGridGovernAvgResultDTO> selectSubGridGovernAvgScore(@Param("customerId")String customerId, @Param("monthId")String monthId);
/**
* @Description 社区下级所有网格服务能力得分平均值
* @param customerId
* @param monthId
* @author zxc
* @date 2020/8/31 1:51 下午
*/
List<SubGridServiceAvgResultDTO> selectSubGridServiceAvgScore(@Param("customerId")String customerId, @Param("monthId")String monthId);
/**
* 根据入参查询 网格相关分值记录
* @param customerId
* @param monthId
* @return java.util.List<com.epmet.dto.screen.FactIndexGridScoreDTO>
* @Author zhangyong
* @Date 10:43 2020-09-03
**/
List<FactIndexGridScoreDTO> selectListGridScore(@Param("customerId")String customerId, @Param("monthId")String monthId);
}

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

@ -55,4 +55,15 @@ public interface ScreenCustomerAgencyDao extends BaseDao<ScreenCustomerAgencyEnt
* @Date 10:52 2020-08-18
**/
void batchInsertCustomerAgency(@Param("list") List<CustomerAgencyFormDTO> list, @Param("customerId")String customerId);
/**
* 根据客户id组织id查询区/街道 组织名称
*
* @param customerId 客户id
* @param agencyId 组织id
* @return java.util.String
* @Author zhangyong
* @Date 16:57 2020-09-03
**/
String selectParentAgencyInfo(@Param("customerId")String customerId, @Param("agencyId")String agencyId);
}

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

@ -58,6 +58,16 @@ public interface ScreenCustomerDeptDao extends BaseDao<ScreenCustomerDeptEntity>
**/
void batchInsertCustomerDept(@Param("list") List<CustomerDeptFormDTO> list, @Param("customerId")String customerId);
/**
* 根据客户id部门id查询部门父级 信息
* @param customerId 客户id
* @param deptId 部门id
* @return com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity
* @Author zhangyong
* @Date 16:57 2020-09-03
**/
ScreenCustomerDeptEntity selectParentDeptInfo(@Param("customerId")String customerId, @Param("deptId")String deptId);
/**
* @param customerId
* @param deptId

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java

@ -94,4 +94,14 @@ public interface ScreenCustomerGridDao extends BaseDao<ScreenCustomerGridEntity>
* @Date 2020/8/31 12:35
**/
ScreenCustomerGridDTO selectParentAgencyId(@Param("customerId") String customerId, @Param("gridId") String gridId);
/**
* 根据客户id网格id查询网格(党支部)父级信息
* @param customerId
* @param gridId
* @return com.epmet.dto.screen.FactIndexGridScoreDTO
* @Author zhangyong
* @Date 16:57 2020-09-03
**/
ScreenCustomerGridDTO selectParentGridInfo(@Param("customerId")String customerId, @Param("gridId")String gridId);
}

10
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexCollectService.java

@ -107,4 +107,14 @@ public interface FactIndexCollectService {
* @Date 10:52 2020-08-20
**/
void insertDeptGovrnAbility(List<DeptGovrnAbilityFormDTO> formDTO, String customerId);
/**
* 将网格社区区直部门/街道分支记录表中的数据抽取到 指数-指数数据(每月数值) 指数-指数数据(按年统计)
* @param monthId 2020-8
* @param customerId
* @return void
* @Author zhangyong
* @Date 10:29 2020-09-03
**/
void insertScreenIndexDataMonthlyAndYearly(String monthId, String customerId);
}

332
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java

@ -3,14 +3,31 @@ package com.epmet.service.evaluationindex.indexcoll.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.constant.DataSourceConstant;
import com.epmet.constant.OrgTypeConstant;
import com.epmet.dao.evaluationindex.indexcal.AgencyScoreDao;
import com.epmet.dao.evaluationindex.indexcal.DeptScoreDao;
import com.epmet.dao.evaluationindex.indexcoll.*;
import com.epmet.dao.evaluationindex.screen.*;
import com.epmet.dto.ScreenCustomerGridDTO;
import com.epmet.dto.indexcal.AgencyScoreDTO;
import com.epmet.dto.indexcal.DeptScoreDTO;
import com.epmet.dto.indexcollect.form.*;
import com.epmet.dto.screen.FactIndexCommunityScoreDTO;
import com.epmet.dto.screen.FactIndexGridScoreDTO;
import com.epmet.dto.screencoll.form.IndexDataMonthlyFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity;
import com.epmet.entity.evaluationindex.screen.ScreenIndexDataMonthlyEntity;
import com.epmet.eum.IndexCodeEnum;
import com.epmet.service.evaluationindex.indexcoll.FactIndexCollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* @Auther: zhangyong
@ -36,6 +53,24 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
private FactIndexGovrnAblityOrgMonthlyDao factIndexGovrnAblityOrgMonthlyDao;
@Autowired
private FactIndexGovrnAblityDeptMonthlyDao factIndexGovrnAblityDeptMonthlyDao;
@Autowired
private FactIndexGridScoreDao factIndexGridScoreDao;
@Autowired
private FactIndexCommunityScoreDao factIndexCommunityScoreDao;
@Autowired
private DeptScoreDao deptScoreDao;
@Autowired
private AgencyScoreDao agencyScoreDaol;
@Autowired
private ScreenIndexDataMonthlyDao screenIndexDataMonthlyDao;
@Autowired
private ScreenIndexDataYearlyDao screenIndexDataYearlyDao;
@Autowired
private ScreenCustomerGridDao screenCustomerGridDao;
@Autowired
private ScreenCustomerDeptDao screenCustomerDeptDao;
@Autowired
private ScreenCustomerAgencyDao screenCustomerAgencyDao;
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
@Override
@ -160,4 +195,301 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
factIndexGovrnAblityDeptMonthlyDao.batchInsertFactIndexGovrnAblityDeptMonthly(formDTO, customerId);
}
}
@DataSource(value = DataSourceConstant.EVALUATION_INDEX, datasourceNameFromArg = true)
@Override
@Transactional(rollbackFor = Exception.class)
public void insertScreenIndexDataMonthlyAndYearly(String monthId, String customerId) {
if (NumConstant.SIX != monthId.length()){
throw new RuntimeException("入参monthId格式不正确:monthId =" + monthId);
}
String year = monthId.substring(NumConstant.ZERO, NumConstant.FOUR);
String month = monthId.substring(NumConstant.FOUR, NumConstant.SIX);
// fact_index_grid_score 网格相关分值记录表 grid
List<FactIndexGridScoreDTO> gridScoreDTOS = factIndexGridScoreDao.selectListGridScore(customerId, monthId);
if (null != gridScoreDTOS && gridScoreDTOS.size() > NumConstant.ZERO){
this.insertIndexDataMonthlyByGridScore(month, year, customerId, gridScoreDTOS);
}
// fact_index_community_score 社区相关分数表 agency
List<FactIndexCommunityScoreDTO> communityScoreDTOS = factIndexCommunityScoreDao.selectListCommunityScore(customerId, monthId);
if (null != communityScoreDTOS && communityScoreDTOS.size() > NumConstant.ZERO){
this.insertIndexDataMonthlyByCommunityScore(month, year, customerId, communityScoreDTOS);
}
// fact_index_dept_score 区直部门分值表 department
List<DeptScoreDTO> deptScoreDTOS = deptScoreDao.selectListDeptScore(customerId, monthId);
if (null != deptScoreDTOS && deptScoreDTOS.size() > NumConstant.ZERO){
this.insertIndexDataMonthlyByDeptScore(month, year, customerId, deptScoreDTOS);
}
// fact_index_agency_score 区/街道相关分数表 agency
List<AgencyScoreDTO> agencyScoreDTOS = agencyScoreDaol.selectListAgencyScore(customerId, monthId);
if (null != agencyScoreDTOS && agencyScoreDTOS.size() > NumConstant.ZERO) {
this.insertIndexDataMonthlyByAgencyScore(month, year, customerId, agencyScoreDTOS);
}
// 插入年表 screen_index_data_yearly
}
/**
* 将网格相关分值记录表 数据 插入月表 screenIndexDataMonthlyDao
*
* @param month 08
* @param year 2020
* @param customerId 客户id
* @param gridScoreDTOS 网格相关分值记录表 当前客户所属月份数据集
* @return void
* @Author zhangyong
* @Date 14:17 2020-09-03
**/
private void insertIndexDataMonthlyByGridScore(String month, String year, String customerId, List<FactIndexGridScoreDTO> gridScoreDTOS){
List<IndexDataMonthlyFormDTO> monthlyFormDTOList = new ArrayList<>();
// 根据网格id进行分组,最后组装一条数据 一个网格 对应 4条数据
Map<String, List<FactIndexGridScoreDTO>> collect = gridScoreDTOS.stream().collect(Collectors.groupingBy(FactIndexGridScoreDTO::getGridId));
String[] orgIds = new String[collect.size()];
int j = 0;
for(Map.Entry<String,List<FactIndexGridScoreDTO>> gridScore : collect.entrySet()){
IndexDataMonthlyFormDTO monthlyFormDTO = new IndexDataMonthlyFormDTO();
// 网格id
orgIds[j] = gridScore.getKey();
j++;
for ( int i = 0; i < gridScore.getValue().size(); i++){
if (NumConstant.ONE_STR.equals(gridScore.getValue().get(i).getIsTotal())){
// 是总分
if (IndexCodeEnum.WANG_GE_XIANG_GUAN.getCode().equals(gridScore.getValue().get(i).getIndexCode())){
// 总指数 = 网格相关
monthlyFormDTO.setIndexTotal(gridScore.getValue().get(i).getScore());
}
} else {
// 赋值 党建能力、治理能力、服务能力
monthlyFormDTO = this.setValueAblityMonthlyFor(gridScore.getValue().get(i).getIndexCode(),
gridScore.getValue().get(i).getScore(),
monthlyFormDTO);
}
}
// 查询网格的 上级组织id 和 组织名称
ScreenCustomerGridDTO parentGridInfo = screenCustomerGridDao.selectParentGridInfo(customerId, gridScore.getKey());
if (null == parentGridInfo){
throw new RuntimeException("在screen_customer_grid表中未查询到该客户下的网格信息:customerId =" + customerId + ", gridId = " + gridScore.getKey());
}
// 补充表中其他字段
monthlyFormDTO = this.supplementIndexDataMonthlyTable(year, month, OrgTypeConstant.GRID, gridScore.getKey(),
parentGridInfo.getParentAgencyId(), parentGridInfo.getGridName(), monthlyFormDTO);
monthlyFormDTOList.add(monthlyFormDTO);
}
screenIndexDataMonthlyDao.deleteIndexDataMonthly(customerId, year, month, orgIds);
screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId);
}
/**
* 社区相关分数表 数据 插入月表 screenIndexDataMonthlyDao
*
* @param month 08
* @param year 2020
* @param customerId 客户id
* @param communityScoreDTOS 社区相关分数表 当前客户所属月份数据集
* @return void
* @Author zhangyong
* @Date 14:17 2020-09-03
**/
private void insertIndexDataMonthlyByCommunityScore(String month, String year, String customerId, List<FactIndexCommunityScoreDTO> communityScoreDTOS){
List<IndexDataMonthlyFormDTO> monthlyFormDTOList = new ArrayList<>();
// 根据组织id 进行分组,最后组装一条数据 一个组织id 对应 4条数据
Map<String, List<FactIndexCommunityScoreDTO>> collect = communityScoreDTOS.stream().collect(Collectors.groupingBy(FactIndexCommunityScoreDTO::getAgencyId));
String[] orgIds = new String[collect.size()];
int j = 0;
for(Map.Entry<String,List<FactIndexCommunityScoreDTO>> communityScore : collect.entrySet()){
IndexDataMonthlyFormDTO monthlyFormDTO = new IndexDataMonthlyFormDTO();
// 组织id
orgIds[j] = communityScore.getKey();
j++;
for ( int i = 0; i < communityScore.getValue().size(); i++){
if (NumConstant.ONE_STR.equals(communityScore.getValue().get(i).getIsTotal())){
// 是总分
if (IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode().equals(communityScore.getValue().get(i).getIndexCode())){
// 总指数 = 社区相关
monthlyFormDTO.setIndexTotal(communityScore.getValue().get(i).getScore());
}
} else {
// 赋值 党建能力、治理能力、服务能力
monthlyFormDTO = this.setValueAblityMonthlyFor(communityScore.getValue().get(i).getIndexCode(),
communityScore.getValue().get(i).getScore(),
monthlyFormDTO);
}
}
// 当前组织 的上级组织id
String parentAgencyId = communityScore.getValue().get(NumConstant.ZERO).getParentAgencyId();
// 查询 组织名称
String agencyName = screenCustomerAgencyDao.selectParentAgencyInfo(customerId, communityScore.getKey());
if (null == agencyName){
throw new RuntimeException("在screen_customer_agency表中未查询到该客户下的组织名称:customerId =" + customerId + ", agencyId = " + communityScore.getKey());
}
// 补充表中其他字段
monthlyFormDTO = this.supplementIndexDataMonthlyTable(year, month, OrgTypeConstant.GRID, communityScore.getKey(),
parentAgencyId, agencyName, monthlyFormDTO);
// 补充表中其他字段
monthlyFormDTOList.add(monthlyFormDTO);
}
screenIndexDataMonthlyDao.deleteIndexDataMonthly(customerId, year, month, orgIds);
screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId);
}
/**
* 将区直部门分值表 数据 插入月表 screenIndexDataMonthlyDao
*
* @param month 08
* @param year 2020
* @param customerId 客户id
* @param deptScoreDTOS 区直部门分值表 当前客户所属月份数据集
* @return void
* @Author zhangyong
* @Date 14:17 2020-09-03
**/
private void insertIndexDataMonthlyByDeptScore(String month, String year, String customerId, List<DeptScoreDTO> deptScoreDTOS){
List<IndexDataMonthlyFormDTO> monthlyFormDTOList = new ArrayList<>();
// 根据部门id 进行分组,最后组装一条数据 一个部门id 对应 4条数据
Map<String, List<DeptScoreDTO>> collect = deptScoreDTOS.stream().collect(Collectors.groupingBy(DeptScoreDTO::getDeptId));
String[] orgIds = new String[collect.size()];
int j = 0;
for(Map.Entry<String,List<DeptScoreDTO>> deptScore : collect.entrySet()){
IndexDataMonthlyFormDTO monthlyFormDTO = new IndexDataMonthlyFormDTO();
// 部门id
orgIds[j] = deptScore.getKey();
j++;
for ( int i = 0; i < deptScore.getValue().size(); i++){
if (NumConstant.ONE_STR.equals(deptScore.getValue().get(i).getIsTotal())){
// 是总分 总指数 = IS_TOTAL = 1
monthlyFormDTO.setIndexTotal(deptScore.getValue().get(i).getScore());
} else {
// 赋值 党建能力、治理能力、服务能力
monthlyFormDTO = this.setValueAblityMonthlyFor(deptScore.getValue().get(i).getIndexCode(),
deptScore.getValue().get(i).getScore(),
monthlyFormDTO);
}
}
// 查询网格的 上级组织id 和 组织名称
ScreenCustomerDeptEntity parentDeptInfo = screenCustomerDeptDao.selectParentDeptInfo(customerId, deptScore.getKey());
if (null == parentDeptInfo){
throw new RuntimeException("在screen_customer_dept表中未查询到该客户下的父级信息:customerId =" + customerId + ", deptId = " + deptScore.getKey());
}
// 补充表中其他字段
monthlyFormDTO = this.supplementIndexDataMonthlyTable(year, month, OrgTypeConstant.GRID, deptScore.getKey(),
parentDeptInfo.getParentAgencyId(), parentDeptInfo.getDeptName(), monthlyFormDTO);
monthlyFormDTOList.add(monthlyFormDTO);
}
screenIndexDataMonthlyDao.deleteIndexDataMonthly(customerId, year, month, orgIds);
screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId);
}
/**
* 将区/街道相关分数表 数据 插入月表 screenIndexDataMonthlyDao
*
* @param month 08
* @param year 2020
* @param customerId 客户id
* @param agencyScoreDTOS /街道相关分数表 当前客户所属月份数据集
* @return void
* @Author zhangyong
* @Date 14:17 2020-09-03
**/
private void insertIndexDataMonthlyByAgencyScore(String month, String year, String customerId, List<AgencyScoreDTO> agencyScoreDTOS){
List<IndexDataMonthlyFormDTO> monthlyFormDTOList = new ArrayList<>();
// 根据组织id(eg:社区或者街道id) 进行分组,最后组装一条数据 一个组织id 对应 4条数据
Map<String, List<AgencyScoreDTO>> collect = agencyScoreDTOS.stream().collect(Collectors.groupingBy(AgencyScoreDTO::getAgencyId));
String[] orgIds = new String[collect.size()];
int j = 0;
for(Map.Entry<String,List<AgencyScoreDTO>> agencyScore : collect.entrySet()){
IndexDataMonthlyFormDTO monthlyFormDTO = new IndexDataMonthlyFormDTO();
// 组织id(eg:社区或者街道id)
orgIds[j] = agencyScore.getKey();
j++;
for ( int i = 0; i < agencyScore.getValue().size(); i++){
if (NumConstant.ONE_STR.equals(agencyScore.getValue().get(i).getIsTotal())){
// 是总分 总指数 = IS_TOTAL = 1
monthlyFormDTO.setIndexTotal(agencyScore.getValue().get(i).getScore());
} else {
// 赋值 党建能力、治理能力、服务能力
monthlyFormDTO = this.setValueAblityMonthlyFor(agencyScore.getValue().get(i).getIndexCode(),
agencyScore.getValue().get(i).getScore(),
monthlyFormDTO);
}
}
// 当前组织 的上级组织id
String parentAgencyId = agencyScore.getValue().get(NumConstant.ZERO).getParentAgencyId();
// 查询 组织名称
String agencyName = screenCustomerAgencyDao.selectParentAgencyInfo(customerId, agencyScore.getKey());
if (null == agencyName){
throw new RuntimeException("在screen_customer_agency表中未查询到该客户下的组织名称:customerId =" + customerId + ", agencyId = " + agencyScore.getKey());
}
// 补充表中其他字段
monthlyFormDTO = this.supplementIndexDataMonthlyTable(year, month, OrgTypeConstant.GRID, agencyScore.getKey(),
parentAgencyId, agencyName, monthlyFormDTO);
monthlyFormDTOList.add(monthlyFormDTO);
}
screenIndexDataMonthlyDao.deleteIndexDataMonthly(customerId, year, month, orgIds);
screenIndexDataMonthlyDao.batchInsertIndexDataMonthly(monthlyFormDTOList, customerId);
}
/**
* 指数-指数数据(每月数值) 字段补全待新增
* @param year 2020
* @param month 08
* @param orgType 组织类别 agency组织部门department网格grid
* @param orgId 组织Id 可以为网格机关id
* @param parentId 上级组织id
* @param orgName 组织名称
* @param monthlyFormDTO 待新增的DTO
* @return com.epmet.dto.screencoll.form.IndexDataMonthlyFormDTO
* @Author zhangyong
* @Date 15:29 2020-09-03
**/
private IndexDataMonthlyFormDTO supplementIndexDataMonthlyTable(String year, String month, String orgType, String orgId, String parentId,
String orgName, IndexDataMonthlyFormDTO monthlyFormDTO){
monthlyFormDTO.setYearId(year);
monthlyFormDTO.setMonthId(year + month);
monthlyFormDTO.setOrgType(orgType);
monthlyFormDTO.setOrgId(orgId);
// 根据网格id,查询其上级组织id、组织名称
monthlyFormDTO.setParentId(parentId);
monthlyFormDTO.setOrgName(orgName);
return monthlyFormDTO;
}
/**
* 赋值 党建能力治理能力服务能力
* (总指数 赋默认值)
* @param IndexCode 组织类别
* @param Score 分数
* @param monthlyFormDTO 待保存的数据
* @return com.epmet.dto.screencoll.form.IndexDataMonthlyFormDTO
* @Author zhangyong
* @Date 09:26 2020-09-04
**/
private IndexDataMonthlyFormDTO setValueAblityMonthlyFor(String IndexCode, BigDecimal Score,
IndexDataMonthlyFormDTO monthlyFormDTO){
// 赋默认值
if (null == monthlyFormDTO.getIndexTotal() && null == monthlyFormDTO.getPartyDevAblity()
&& null == monthlyFormDTO.getGovernAblity() && null == monthlyFormDTO.getServiceAblity()){
BigDecimal zero = new BigDecimal(NumConstant.ZERO);
monthlyFormDTO.setIndexTotal(zero);
monthlyFormDTO.setPartyDevAblity(zero);
monthlyFormDTO.setGovernAblity(zero);
monthlyFormDTO.setServiceAblity(zero);
}
// 赋实际值
if (IndexCodeEnum.DANG_JIAN_NENG_LI.getCode().equals(IndexCode)){
// 党建能力
monthlyFormDTO.setPartyDevAblity(Score);
} else if (IndexCodeEnum.ZHI_LI_NENG_LI.getCode().equals(IndexCode)){
// 治理能力
monthlyFormDTO.setGovernAblity(Score);
} else if (IndexCodeEnum.FU_WU_NENG_LI.getCode().equals(IndexCode)){
// 服务能力
monthlyFormDTO.setServiceAblity(Score);
}
return monthlyFormDTO;
}
}

21
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml

@ -43,6 +43,25 @@
AND data_type = #{dataType}
</delete>
<select id="selectListAgencyScore" resultType="com.epmet.dto.indexcal.AgencyScoreDTO">
SELECT
CUSTOMER_ID customerId,
AGENCY_ID agencyId,
PARENT_AGENCY_ID parentAgencyId,
YEAR_ID yearId,
MONTH_ID monthId,
IS_TOTAL isTotal,
SCORE score,
INDEX_CODE indexCode
FROM
fact_index_agency_score
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
AND MONTH_ID = #{monthId}
ORDER BY AGENCY_ID
</select>
<!-- 查询街道相关信息 -->
<select id="selectStreetInfo" resultType="com.epmet.dto.indexcal.AgencyScoreDTO">
SELECT
@ -64,4 +83,4 @@
AND INDEX_CODE != "jiedaoxiangguan"
AND data_type = #{dataType}
</select>
</mapper>
</mapper>

20
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml

@ -3,4 +3,22 @@
<mapper namespace="com.epmet.dao.evaluationindex.indexcal.DeptScoreDao">
</mapper>
<select id="selectListDeptScore" resultType="com.epmet.dto.indexcal.DeptScoreDTO">
SELECT
CUSTOMER_ID customerId,
DEPT_ID deptId,
YEAR_ID yearId,
MONTH_ID monthId,
IS_TOTAL isTotal,
SCORE score,
INDEX_CODE indexCode
FROM
fact_index_dept_score
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
AND MONTH_ID = #{monthId}
ORDER BY DEPT_ID
</select>
</mapper>

20
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/FactIndexCommunityScoreDao.xml

@ -84,4 +84,22 @@
GROUP BY fics.agency_id
</select>
</mapper>
<select id="selectListCommunityScore" resultType="com.epmet.dto.screen.FactIndexCommunityScoreDTO">
SELECT
CUSTOMER_ID customerId,
AGENCY_ID agencyId,
PARENT_AGENCY_ID parentAgencyId,
YEAR_ID yearId,
MONTH_ID monthId,
IS_TOTAL isTotal,
SCORE score,
INDEX_CODE indexCode
FROM
fact_index_community_score
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
AND MONTH_ID = #{monthId}
ORDER BY AGENCY_ID
</select>
</mapper>

21
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/FactIndexGridScoreDao.xml

@ -24,4 +24,23 @@
AND figc.index_code = #{indexCode}
GROUP BY figc.agency_id
</select>
</mapper>
<select id="selectListGridScore" resultType="com.epmet.dto.screen.FactIndexGridScoreDTO">
SELECT
CUSTOMER_ID customerId,
GRID_ID gridId,
AGENCY_ID agencyId,
YEAR_ID yearId,
MONTH_ID monthId,
IS_TOTAL isTotal,
SCORE score,
INDEX_CODE indexCode
FROM
fact_index_grid_score
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
AND MONTH_ID = #{monthId}
ORDER BY GRID_ID
</select>
</mapper>

10
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml

@ -60,4 +60,14 @@
</foreach>
</insert>
<select id="selectParentAgencyInfo" parameterType="map" resultType="String">
SELECT
AGENCY_NAME agencyName
FROM
screen_customer_agency
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID =#{customerId}
AND AGENCY_ID = #{agencyId}
</select>
</mapper>

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

@ -64,4 +64,15 @@
AND m.CUSTOMER_ID =#{customerId}
AND m.DEPT_ID =#{deptId}
</select>
<select id="selectParentDeptInfo" parameterType="map" resultType="com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity">
SELECT
PARENT_AGENCY_ID parentAgencyId,
DEPT_NAME deptName
FROM
screen_customer_dept
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID =#{customerId}
AND DEPT_ID = #{deptId}
</select>
</mapper>

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

@ -105,4 +105,16 @@
AND m.CUSTOMER_ID =#{customerId}
AND m.GRID_ID = #{gridId}
</select>
<select id="selectParentGridInfo" parameterType="map" resultType="com.epmet.dto.ScreenCustomerGridDTO">
SELECT
GRID_NAME gridName,
PARENT_AGENCY_ID parentAgencyId
FROM
screen_customer_grid
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID =#{customerId}
AND GRID_ID = #{gridId}
</select>
</mapper>

Loading…
Cancel
Save