Browse Source

1、指标计算:IndexCalculateService.indexCalculate方法修改;2、所有指数查询接口添加@RequestHeader中的customerId

dev_shibei_match
yinzuomei 5 years ago
parent
commit
00cf9003c1
  1. 5
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthBarchartFormDTO.java
  2. 5
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthPieChartFormDTO.java
  3. 5
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankFormDTO.java
  4. 5
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankYMFormDTO.java
  5. 5
      epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/YearAverageIndexFormDTO.java
  6. 26
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java
  7. 1
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/CustomerSubInfoDTO.java
  8. 12
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java
  9. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerDeptDao.java
  10. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerGridDao.java
  11. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/CustomerRelationDao.java
  12. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/DeptScoreServiceImpl.java
  13. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java
  14. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/FactIndexCollectService.java
  15. 96
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcoll/impl/FactIndexCollectServiceImpl.java
  16. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java
  17. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/CustomerRelationServiceImpl.java
  18. 27
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml
  19. 19
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerDeptDao.xml
  20. 18
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerGridDao.xml
  21. 15
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/CustomerRelationDao.xml

5
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthBarchartFormDTO.java

@ -26,4 +26,9 @@ public class MonthBarchartFormDTO implements Serializable {
* 月份ID,如果此列有值查询截止到当前monthId的近12个月数据
*/
private String monthId;
/**
* area_code升级,新增此参数来源于当前token
*/
private String customerId;
}

5
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/MonthPieChartFormDTO.java

@ -21,4 +21,9 @@ public class MonthPieChartFormDTO implements Serializable {
*/
@NotBlank(message = "机关ID不能为空",groups = {MonthPieChart.class})
private String agencyId;
/**
* area_code升级,新增此参数来源于当前token
*/
private String customerId;
}

5
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankFormDTO.java

@ -30,4 +30,9 @@ public class SubAgencyIndexRankFormDTO implements Serializable {
private Integer topNum;
private String yearId;
/**
* area_code升级,新增此参数来源于当前token
*/
private String customerId;
}

5
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/SubAgencyIndexRankYMFormDTO.java

@ -53,4 +53,9 @@ public class SubAgencyIndexRankYMFormDTO implements Serializable {
* 组织类型 组织agency 网格grid
*/
private String orgType;
/**
* area_code升级,新增此参数来源于当前token
*/
private String customerId;
}

5
epmet-module/data-report/data-report-client/src/main/java/com/epmet/evaluationindex/screen/dto/form/YearAverageIndexFormDTO.java

@ -21,4 +21,9 @@ public class YearAverageIndexFormDTO implements Serializable {
*/
@NotBlank(message = "机关ID不能为空",groups = {YearAverageIndex.class})
private String agencyId;
/**
* area_code升级,新增此参数来源于当前token
*/
private String customerId;
}

26
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/controller/screen/IndexController.java

@ -6,6 +6,7 @@ import com.epmet.datareport.eum.OrgTypeEnum;
import com.epmet.datareport.service.evaluationindex.screen.IndexService;
import com.epmet.evaluationindex.screen.dto.form.*;
import com.epmet.evaluationindex.screen.dto.result.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -17,6 +18,7 @@ import java.util.List;
* @author yinzuomei@elink-cn.com
* @date 2020/8/18 10:13
*/
@Slf4j
@RestController
@RequestMapping("/screen/index")
public class IndexController {
@ -31,7 +33,9 @@ public class IndexController {
* @date 2020/8/19 2:53 下午
*/
@PostMapping("yearaverageindex")
public Result<YearAverageIndexResultDTO> yearAverageIndex(@RequestBody YearAverageIndexFormDTO yearAverageIndexFormDTO){
public Result<YearAverageIndexResultDTO> yearAverageIndex(@RequestHeader("CustomerId") String customerId,@RequestBody YearAverageIndexFormDTO yearAverageIndexFormDTO){
//area_code升级,新增此参数
yearAverageIndexFormDTO.setCustomerId(customerId);
ValidatorUtils.validateEntity(yearAverageIndexFormDTO, YearAverageIndexFormDTO.YearAverageIndex.class);
return new Result<YearAverageIndexResultDTO>().ok(indexService.yearAverageIndex(yearAverageIndexFormDTO));
}
@ -43,7 +47,9 @@ public class IndexController {
* @date 2020/8/19 3:17 下午
*/
@PostMapping("monthindexanalysis/piechart")
public Result<MonthPieChartResultDTO> monthPieChart(@RequestBody MonthPieChartFormDTO monthPieChartFormDTO){
public Result<MonthPieChartResultDTO> monthPieChart(@RequestHeader("CustomerId") String customerId,@RequestBody MonthPieChartFormDTO monthPieChartFormDTO){
//area_code升级,新增此参数
monthPieChartFormDTO.setCustomerId(customerId);
ValidatorUtils.validateEntity(monthPieChartFormDTO, MonthPieChartFormDTO.MonthPieChart.class);
return new Result<MonthPieChartResultDTO>().ok(indexService.monthPieChart(monthPieChartFormDTO));
}
@ -55,7 +61,9 @@ public class IndexController {
* @date 2020/8/19 5:27 下午
*/
@PostMapping("monthindexanalysis/barchart")
public Result<MonthBarchartResultDTO> monthBarchart(@RequestBody MonthBarchartFormDTO monthBarchartFormDTO){
public Result<MonthBarchartResultDTO> monthBarchart(@RequestHeader("CustomerId") String customerId,@RequestBody MonthBarchartFormDTO monthBarchartFormDTO){
//area_code升级,新增此参数
monthBarchartFormDTO.setCustomerId(customerId);
ValidatorUtils.validateEntity(monthBarchartFormDTO, MonthBarchartFormDTO.MonthBarchart.class);
return new Result<MonthBarchartResultDTO>().ok(indexService.monthBarchart(monthBarchartFormDTO));
}
@ -67,7 +75,9 @@ public class IndexController {
* @date 2020/8/20 10:02 上午
*/
@PostMapping("subagencyindexrank")
public Result<List<SubAgencyIndexRankResultDTO>> subAgencyIndexRank(@RequestBody SubAgencyIndexRankFormDTO subAgencyIndexRankFormDTO){
public Result<List<SubAgencyIndexRankResultDTO>> subAgencyIndexRank(@RequestHeader("CustomerId") String customerId,@RequestBody SubAgencyIndexRankFormDTO subAgencyIndexRankFormDTO){
//area_code升级,新增此参数
subAgencyIndexRankFormDTO.setCustomerId(customerId);
ValidatorUtils.validateEntity(subAgencyIndexRankFormDTO, SubAgencyIndexRankFormDTO.SubAgencyIndexRank.class);
return new Result<List<SubAgencyIndexRankResultDTO>>().ok(indexService.subAgencyIndexRank(subAgencyIndexRankFormDTO));
}
@ -81,7 +91,9 @@ public class IndexController {
* @Date 13:39 2020-09-11
**/
@PostMapping("dataclient/subagencyindexrank")
public Result<List<AnNingSubAgencyIndexRankResultDTO>> getSubAgencyIndexRank(@RequestBody SubAgencyIndexRankYMFormDTO formDTO) {
public Result<List<AnNingSubAgencyIndexRankResultDTO>> getSubAgencyIndexRank(@RequestHeader("CustomerId") String customerId,@RequestBody SubAgencyIndexRankYMFormDTO formDTO) {
//area_code升级,新增此参数
formDTO.setCustomerId(customerId);
ValidatorUtils.validateEntity(formDTO, SubAgencyIndexRankYMFormDTO.SubAgencyIndexRank.class);
return new Result<List<AnNingSubAgencyIndexRankResultDTO>>().ok(indexService.getSubAgencyIndexRank(formDTO));
}
@ -118,7 +130,7 @@ public class IndexController {
/**
* @param formDTO
* @Description 组织月度指数得分
* @Description 数据改版组织月度指数得分
* @author sun
*/
@PostMapping("month/indexscore")
@ -129,7 +141,7 @@ public class IndexController {
/**
* @param formDTO
* @Description 先进排行-先进支部排行
* @Description 数据改版先进排行-先进支部排行
* @author sun
*/
@PostMapping("advancedbranchrank")

1
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/indexcal/CustomerSubInfoDTO.java

@ -15,6 +15,7 @@ import java.util.List;
public class CustomerSubInfoDTO implements Serializable {
private String customerId;
private String customerName;
/**
* 当前客户所属的地区编码 add 01.14
*/

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

@ -71,7 +71,9 @@ public interface ScreenCustomerAgencyDao extends BaseDao<ScreenCustomerAgencyEnt
* @Author zhangyong
* @Date 14:38 2020-09-04
**/
List<ScreenCustomerAgencyEntity> selectListMismatcCommunityAgencyInfo(@Param("customerId") String customerId, @Param("agencyIds") String[] agencyIds);
List<ScreenCustomerAgencyEntity> selectListMismatcCommunityAgencyInfo(@Param("customerId") String customerId, @Param("agencyIds") String[] agencyIds,
@Param("customerAreaCode") String customerAreaCode,
@Param("subCustomerIds")List<String> subCustomerIds);
/**
* 根据客户id查询区/街道 组织名称id
@ -81,7 +83,9 @@ public interface ScreenCustomerAgencyDao extends BaseDao<ScreenCustomerAgencyEnt
* @Author zhangyong
* @Date 16:57 2020-09-03
**/
List<ScreenCustomerAgencyEntity> selectListAgencyInfo(@Param("customerId") String customerId);
List<ScreenCustomerAgencyEntity> selectListAgencyInfo(@Param("customerId") String customerId,
@Param("customerAreaCode") String customerAreaCode,
@Param("subCustomerIds")List<String> subCustomerIds);
/**
* @param agencyId
@ -100,7 +104,9 @@ public interface ScreenCustomerAgencyDao extends BaseDao<ScreenCustomerAgencyEnt
* @Author zhangyong
* @Date 14:38 2020-09-04
**/
List<ScreenCustomerAgencyEntity> selectListMismatcStreetAndDistrictAgencyInfo(@Param("customerId") String customerId, @Param("agencyIds") String[] agencyIds);
List<ScreenCustomerAgencyEntity> selectListMismatcStreetAndDistrictAgencyInfo(@Param("customerId") String customerId, @Param("agencyIds") String[] agencyIds,
@Param("customerAreaCode") String customerAreaCode,
@Param("subCustomerIds")List<String> subCustomerIds);
/**
* desc:获取客户的组织条数

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

@ -57,14 +57,13 @@ public interface ScreenCustomerDeptDao extends BaseDao<ScreenCustomerDeptEntity>
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);
ScreenCustomerDeptEntity selectParentAgencyId(@Param("deptId") String deptId);
/**
* 返回当前客户下未匹配到的区直部门信息
@ -76,7 +75,9 @@ public interface ScreenCustomerDeptDao extends BaseDao<ScreenCustomerDeptEntity>
* @Date 10:45 2020-09-04
**/
List<ScreenCustomerDeptEntity> selectListMismatchDeptInfo(@Param("customerId") String customerId,
@Param("deptIds") String[] deptIds);
@Param("deptIds") String[] deptIds,
@Param("customerAreaCode") String customerAreaCode,
@Param("subCustomerIds")List<String> subCustomerIds);
/**
* 根据客户id 查询部门 信息
@ -85,7 +86,9 @@ public interface ScreenCustomerDeptDao extends BaseDao<ScreenCustomerDeptEntity>
* @Author zhangyong
* @Date 16:57 2020-09-03
**/
List<ScreenCustomerDeptEntity> selectListDeptInfo(@Param("customerId")String customerId);
List<ScreenCustomerDeptEntity> selectListDeptInfo(@Param("customerId")String customerId,
@Param("customerAreaCode") String customerAreaCode,
@Param("subCustomerIds")List<String> subCustomerIds);
/**
* 查询最后一次添加的部门

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

@ -106,7 +106,9 @@ public interface ScreenCustomerGridDao extends BaseDao<ScreenCustomerGridEntity>
* @Date 10:45 2020-09-04
**/
List<ScreenCustomerGridDTO> selectListMismatchGridInfo(@Param("customerId") String customerId,
@Param("gridIds") String[] gridIds);
@Param("gridIds") String[] gridIds,
@Param("customerAreaCode") String customerAreaCode,
@Param("subCustomerIds")List<String> subCustomerIds);
/**
* 根据客户id 查询网格(党支部)详细信息
@ -115,7 +117,9 @@ public interface ScreenCustomerGridDao extends BaseDao<ScreenCustomerGridEntity>
* @Author zhangyong
* @Date 16:57 2020-09-03
**/
List<ScreenCustomerGridDTO> selectListGridInfo(@Param("customerId")String customerId);
List<ScreenCustomerGridDTO> selectListGridInfo(@Param("customerId")String customerId,
@Param("customerAreaCode") String customerAreaCode,
@Param("subCustomerIds")List<String> subCustomerIds);
/**
* @Description 根据agencyId查询网格ID

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/stats/CustomerRelationDao.java

@ -34,5 +34,11 @@ import java.util.List;
@Mapper
public interface CustomerRelationDao extends BaseDao<CustomerRelationEntity> {
/**
* @param customerIds
* @author yinzuomei
* @description 查询当前客户的area_code信息以及子客户列表
* @Date 2021/1/21 11:27
**/
List<CustomerSubInfoDTO> selectCustomerSubInfo(@Param("list") List<String> customerIds);
}

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

@ -380,7 +380,7 @@ public class DeptScoreServiceImpl extends BaseServiceImpl<DeptScoreDao, DeptScor
deptScoreEntity.setDeptId(deptId);
deptScoreEntity.setIsTotal(NumConstant.ZERO_STR);
deptScoreEntity.setIndexCode(IndexCodeEnum.ZHI_LI_NENG_LI.getCode());
ScreenCustomerDeptEntity deptEntity = screenCustomerDeptDao.selectParentAgencyId(formDTO.getCustomerId(), deptId);
ScreenCustomerDeptEntity deptEntity = screenCustomerDeptDao.selectParentAgencyId(deptId);
if (null != deptEntity) {
if(StringUtils.isNotBlank(deptEntity.getParentAgencyId())){
deptScoreEntity.setAgencyId(deptEntity.getParentAgencyId());

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

@ -85,7 +85,7 @@ public class IndexCalculateServiceImpl implements IndexCalculateService {
param.setCustomerId(customerId);
param.setMonthId(formDTO.getMonthId());
//01.14 add
if(null!=customerInfoMap.get(customerId)){
if (!customerInfoMap.isEmpty() && null != customerInfoMap.get(customerId)) {
param.setCustomerAreaCode(customerInfoMap.get(customerId).getCustomerAreaCode());
param.setSubCustomerIds(customerInfoMap.get(customerId).getSubCustomerIds());
}
@ -93,6 +93,7 @@ public class IndexCalculateServiceImpl implements IndexCalculateService {
}
return flag;
} catch (Exception e) {
e.printStackTrace();
log.error("indexCalculate exception,param:{}", JSON.toJSONString(formDTO));
} finally {
//清除缓存
@ -176,7 +177,7 @@ public class IndexCalculateServiceImpl implements IndexCalculateService {
if (insertFlag || currentMonthId.equals(formDTO.getMonthId())) {
start = System.currentTimeMillis();
try {
factIndexCollectService.insertScreenIndexDataMonthlyAndYearly(formDTO.getMonthId(), formDTO.getCustomerId());
factIndexCollectService.insertScreenIndexDataMonthlyAndYearly(formDTO);
log.info("客户Id:{}分数插入到大屏显示库完毕,总耗时:{}秒", customerId, (System.currentTimeMillis() - start) / 1000);
} catch (Exception e) {
log.error("indexCalculate insertScreenIndexDataMonthlyAndYearly exception", e);
@ -192,6 +193,12 @@ public class IndexCalculateServiceImpl implements IndexCalculateService {
return false;
}
/**
* @param customerIds
* @author yinzuomei
* @description 查询当前客户的area_code信息以及子客户列表
* @Date 2021/1/21 11:28
**/
private Map<String, CustomerSubInfoDTO> getCustomerInfoMap(List<String> customerIds) {
return customerRelationService.getCustomerInfoMap(customerIds);
}

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

@ -1,9 +1,8 @@
package com.epmet.service.evaluationindex.indexcoll;
import com.epmet.dto.indexcal.CalculateCommonFormDTO;
import com.epmet.dto.indexcollect.form.*;
import java.util.List;
/**
* 大屏数据采集api
*
@ -110,11 +109,9 @@ public interface FactIndexCollectService {
/**
* 将网格社区区直部门/街道分支记录表中的数据抽取到 指数-指数数据(每月数值) 指数-指数数据(按年统计)
* @param monthId 2020-8
* @param customerId
* @return void
* @Author zhangyong
* @Date 10:29 2020-09-03
**/
void insertScreenIndexDataMonthlyAndYearly(String monthId, String customerId);
void insertScreenIndexDataMonthlyAndYearly(CalculateCommonFormDTO calculateCommonFormDTO);
}

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

@ -18,6 +18,7 @@ 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.CalculateCommonFormDTO;
import com.epmet.dto.indexcal.DeptScoreDTO;
import com.epmet.dto.indexcollect.form.*;
import com.epmet.dto.screen.FactIndexCommunityScoreDTO;
@ -44,7 +45,6 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors;
/**
@ -225,9 +225,9 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
* @date 2020/10/20 2:59 下午
*/
@Override
public void insertScreenIndexDataMonthlyAndYearly(String monthId, String customerId) {
if (NumConstant.SIX != monthId.length()) {
throw new RuntimeException("入参monthId格式不正确:monthId =" + monthId);
public void insertScreenIndexDataMonthlyAndYearly(CalculateCommonFormDTO formDTO) {
if (NumConstant.SIX != formDTO.getMonthId().length()) {
throw new RuntimeException("入参monthId格式不正确:monthId =" + formDTO.getMonthId());
}
RLock lock = distributedLock.getLock(LockConstants.STATS_LOCK_NAME);
try {
@ -236,26 +236,27 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
}
allParentIds.cleanUp();
// 根据网格类型,删除 指数-指数数据(每月数值)表中 匹配的数据
this.batchDelIndexDataMonthly(customerId, monthId, OrgTypeConstant.GRID);
this.batchDelIndexDataMonthly(formDTO.getCustomerId(), formDTO.getMonthId(), OrgTypeConstant.GRID);
// 开始处理 网格相关分值表
this.startHandleIndexGridScore(monthId, customerId);
this.startHandleIndexGridScore(formDTO);
// 根据组织类型,删除 指数-指数数据(每月数值)表中 匹配的数据
this.batchDelIndexDataMonthly(customerId, monthId, OrgTypeConstant.AGENCY);
this.batchDelIndexDataMonthly(formDTO.getCustomerId(), formDTO.getMonthId(), OrgTypeConstant.AGENCY);
// 开始处理 社区相关分值表
this.startHandleIndexCommunityScore(monthId, customerId);
this.startHandleIndexCommunityScore(formDTO);
// 根据部门类型,删除 指数-指数数据(每月数值)表中 匹配的数据
this.batchDelIndexDataMonthly(customerId, monthId, OrgTypeConstant.DEPARTMENT);
this.batchDelIndexDataMonthly(formDTO.getCustomerId(), formDTO.getMonthId(), OrgTypeConstant.DEPARTMENT);
// 开始处理 区直部门分值表
this.startHandleIndexDeptScore(monthId, customerId);
this.startHandleIndexDeptScore(formDTO);
// 同样是 组织类型,所以不再重复删除了
// 开始处理 区/街道相关分数表
this.startHandleIndexAgencyScore(monthId, customerId);
//todo
this.startHandleIndexAgencyScore(formDTO);
// 根据年,汇总今年各项得到,计算平均值后 插入年表 screen_index_data_yearly
this.insertIndexDataYear(monthId, customerId);
this.insertIndexDataYear(formDTO.getMonthId(), formDTO.getCustomerId());
allParentIds.invalidateAll();
} finally {
distributedLock.unLock(lock);
@ -266,13 +267,13 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
* 目标将网格的 党建能力治理能力服务能力总指数 得分 整理后(4条合1条) 插入 指数-指数数据(月表)
* 如果网格相关分值表 中的网格数量不全需要从 网格(党支部)信息表 先查询到缺少的网格信息赋上默认值后插入 指数-指数数据(月表)
*
* @param monthId
* @param customerId
* @return void
* @Author zhangyong
* @Date 13:44 2020-09-04
**/
private void startHandleIndexGridScore(String monthId, String customerId){
private void startHandleIndexGridScore(CalculateCommonFormDTO formDTO){
String customerId=formDTO.getCustomerId();
String monthId=formDTO.getMonthId();
List<ScreenCustomerGridDTO> mismatchGridList = new ArrayList<>();
// 查询网格相关分值记录 表已经存在的网格id
List<String> indexGridIds = factIndexGridScoreDao.selectListGridId(customerId, monthId);
@ -283,9 +284,9 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
gridIds[i] = indexGridIds.get(i);
}
// 进行不匹配查询(即返回网格相关分值表 中不存在的网格信息)。
mismatchGridList = screenCustomerGridDao.selectListMismatchGridInfo(customerId, gridIds);
mismatchGridList = screenCustomerGridDao.selectListMismatchGridInfo(customerId, gridIds,formDTO.getCustomerAreaCode(),formDTO.getSubCustomerIds());
} else {
mismatchGridList = screenCustomerGridDao.selectListMismatchGridInfo(customerId, null);
mismatchGridList = screenCustomerGridDao.selectListMismatchGridInfo(customerId, null,formDTO.getCustomerAreaCode(),formDTO.getSubCustomerIds());
}
if (!CollectionUtils.isEmpty(mismatchGridList)){
@ -295,7 +296,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
// fact_index_grid_score 网格相关分值记录表 grid
List<FactIndexGridScoreDTO> gridScoreDTOS = factIndexGridScoreDao.selectListGridScore(customerId, monthId);
// 开始处理实际分数
this.insertIndexDataMonthlyByGridScore(monthId, customerId, gridScoreDTOS);
this.insertIndexDataMonthlyByGridScore(monthId, customerId, gridScoreDTOS,formDTO.getCustomerAreaCode(),formDTO.getSubCustomerIds());
}
/**
@ -340,12 +341,12 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
* @Author zhangyong
* @Date 14:17 2020-09-03
**/
private void insertIndexDataMonthlyByGridScore(String monthId, String customerId, List<FactIndexGridScoreDTO> gridScoreDTOS) {
private void insertIndexDataMonthlyByGridScore(String monthId, String customerId, List<FactIndexGridScoreDTO> gridScoreDTOS,String customerAreaCode,List<String> subCustomerIds) {
List<IndexDataMonthlyFormDTO> monthlyFormDTOList = new ArrayList<>();
// 根据网格id进行分组,最后组装一条数据 一个网格 对应 4条数据
Map<String, List<FactIndexGridScoreDTO>> collect = gridScoreDTOS.stream().collect(Collectors.groupingBy(FactIndexGridScoreDTO::getGridId));
// 查询网格的 上级组织id 和 组织名称
List<ScreenCustomerGridDTO> parentGridList = screenCustomerGridDao.selectListGridInfo(customerId);
List<ScreenCustomerGridDTO> parentGridList = screenCustomerGridDao.selectListGridInfo(customerId,customerAreaCode,subCustomerIds);
if (!CollectionUtils.isEmpty(parentGridList)) {
parentGridList.forEach(o -> {
allParentIds.put(o.getGridId(), o.getAllParentIds());
@ -399,13 +400,13 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
* 目标将社区的 党建能力治理能力服务能力总指数 得分 整理后(4条合1条) 插入 指数-指数数据(月表)
* 如果社区相关分值表 中的社区数量不全需要从 组织机构信息 先查询到缺少的社区信息赋上默认值后在插入 指数-指数数据(月表)
*
* @param monthId
* @param customerId
* @return void
* @Author zhangyong
* @Date 13:44 2020-09-04
**/
private void startHandleIndexCommunityScore(String monthId, String customerId){
private void startHandleIndexCommunityScore(CalculateCommonFormDTO formDTO){
String customerId=formDTO.getCustomerId();
String monthId=formDTO.getMonthId();
List<ScreenCustomerAgencyEntity> mismatchAgencyList = new ArrayList<>();
// 查询社区相关分值记录id
List<String> indexCommunityIds = factIndexCommunityScoreDao.selectListCommunityId(customerId, monthId);
@ -416,9 +417,9 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
communityIds[i] = indexCommunityIds.get(i);
}
// 进行不匹配查询(即返回社区相关分值表 中不存在的【社区级】 组织信息)。
mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcCommunityAgencyInfo(customerId, communityIds);
mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcCommunityAgencyInfo(customerId, communityIds,formDTO.getCustomerAreaCode(),formDTO.getSubCustomerIds());
} else {
mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcCommunityAgencyInfo(customerId, null);
mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcCommunityAgencyInfo(customerId, null,formDTO.getCustomerAreaCode(),formDTO.getSubCustomerIds());
}
if (!CollectionUtils.isEmpty(mismatchAgencyList)){
@ -429,7 +430,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
// 查询社区相关分值记录
List<FactIndexCommunityScoreDTO> communityScoreDTOS = factIndexCommunityScoreDao.selectListCommunityScore(customerId, monthId);
// 开始处理实际分数
this.insertIndexDataMonthlyByCommunityScore(monthId, customerId, communityScoreDTOS);
this.insertIndexDataMonthlyByCommunityScore(monthId, customerId, communityScoreDTOS,formDTO.getCustomerAreaCode(),formDTO.getSubCustomerIds());
}
/**
@ -474,12 +475,14 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
* @Author zhangyong
* @Date 14:17 2020-09-03
**/
private void insertIndexDataMonthlyByCommunityScore(String monthId, String customerId, List<FactIndexCommunityScoreDTO> communityScoreDTOS) {
private void insertIndexDataMonthlyByCommunityScore(String monthId, String customerId, List<FactIndexCommunityScoreDTO> communityScoreDTOS,
String customerAreaCode,
List<String> subCustomerIds) {
List<IndexDataMonthlyFormDTO> monthlyFormDTOList = new ArrayList<>();
// 根据组织id 进行分组,最后组装一条数据 一个组织id 对应 4条数据
Map<String, List<FactIndexCommunityScoreDTO>> collect = communityScoreDTOS.stream().collect(Collectors.groupingBy(FactIndexCommunityScoreDTO::getAgencyId));
// 根据客户id,查询区/街道 组织名称、id
List<ScreenCustomerAgencyEntity> parentAgencyList = screenCustomerAgencyDao.selectListAgencyInfo(customerId);
List<ScreenCustomerAgencyEntity> parentAgencyList = screenCustomerAgencyDao.selectListAgencyInfo(customerId,customerAreaCode,subCustomerIds);
if (!CollectionUtils.isEmpty(parentAgencyList)) {
parentAgencyList.forEach(o -> {
allParentIds.put(o.getAgencyId(), o.getPids());
@ -534,13 +537,13 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
* 目标将区直部门的 党建能力治理能力服务能力总指数 得分 整理后(4条合1条) 插入 指数-指数数据(月表)
* 如果 区直部门分值表 中的部门数量不全需要从 部门信息表 先查询到缺少的部门信息赋上默认值后在插入 指数-指数数据(月表)
*
* @param monthId
* @param customerId
* @return void
* @Author zhangyong
* @Date 13:44 2020-09-04
**/
private void startHandleIndexDeptScore(String monthId, String customerId){
private void startHandleIndexDeptScore(CalculateCommonFormDTO formDTO){
String customerId=formDTO.getCustomerId();
String monthId=formDTO.getMonthId();
List<ScreenCustomerDeptEntity> mismatchDeptList = new ArrayList<>();
// 查询社 区直部门分值表
List<String> indexDeptIds = deptScoreDao.selectListDeptId(customerId, monthId);
@ -549,9 +552,9 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
for (int i = NumConstant.ZERO; i < indexDeptIds.size(); i++){
depeIds[i] = indexDeptIds.get(i);
}
mismatchDeptList = screenCustomerDeptDao.selectListMismatchDeptInfo(customerId, depeIds);
mismatchDeptList = screenCustomerDeptDao.selectListMismatchDeptInfo(customerId, depeIds,formDTO.getCustomerAreaCode(),formDTO.getSubCustomerIds());
} else {
mismatchDeptList = screenCustomerDeptDao.selectListMismatchDeptInfo(customerId, null);
mismatchDeptList = screenCustomerDeptDao.selectListMismatchDeptInfo(customerId, null,formDTO.getCustomerAreaCode(),formDTO.getSubCustomerIds());
}
if (!CollectionUtils.isEmpty(mismatchDeptList)) {
@ -568,7 +571,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
// 查询社 区直部门分值表
List<DeptScoreDTO> deptScoreDTOS = deptScoreDao.selectListDeptScore(customerId, monthId);
// 开始处理实际分数
this.insertIndexDataMonthlyByDeptScore(monthId, customerId, deptScoreDTOS);
this.insertIndexDataMonthlyByDeptScore(monthId, customerId, deptScoreDTOS,formDTO.getCustomerAreaCode(),formDTO.getSubCustomerIds());
}
/**
@ -613,11 +616,13 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
* @Author zhangyong
* @Date 14:17 2020-09-03
**/
private void insertIndexDataMonthlyByDeptScore(String monthId, String customerId, List<DeptScoreDTO> deptScoreDTOS){
private void insertIndexDataMonthlyByDeptScore(String monthId, String customerId, List<DeptScoreDTO> deptScoreDTOS,
String customerAreaCode,
List<String> subCustomerIds){
List<IndexDataMonthlyFormDTO> monthlyFormDTOList = new ArrayList<>();
// 根据部门id 进行分组,最后组装一条数据 一个部门id 对应 4条数据
Map<String, List<DeptScoreDTO>> collect = deptScoreDTOS.stream().collect(Collectors.groupingBy(DeptScoreDTO::getDeptId));
List<ScreenCustomerDeptEntity> parentDeptList = screenCustomerDeptDao.selectListDeptInfo(customerId);
List<ScreenCustomerDeptEntity> parentDeptList = screenCustomerDeptDao.selectListDeptInfo(customerId,customerAreaCode,subCustomerIds);
for(Map.Entry<String,List<DeptScoreDTO>> deptScore : collect.entrySet()){
IndexDataMonthlyFormDTO monthlyFormDTO = new IndexDataMonthlyFormDTO();
// 给4个指数 赋默认值
@ -666,13 +671,13 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
* 目标 /街道的 党建能力治理能力服务能力总指数 得分 整理后(4条合1条) 插入 指数-指数数据(月表)
* 如果 /街道相关分数表 中的组织数量不全需要从 组织机构信息 先查询到缺少的组织信息赋上默认值后在插入 /街道相关分数表 一对四
*
* @param monthId
* @param customerId
* @return void
* @Author zhangyong
* @Date 13:44 2020-09-04
**/
private void startHandleIndexAgencyScore(String monthId, String customerId){
private void startHandleIndexAgencyScore(CalculateCommonFormDTO formDTO){
String customerId=formDTO.getCustomerId();
String monthId=formDTO.getMonthId();
List<ScreenCustomerAgencyEntity> mismatchAgencyList = new ArrayList<>();
List<String> indexAgencyIds = agencyScoreDaol.selectListAgencyId(customerId, monthId);
if (indexAgencyIds.size() > NumConstant.ZERO){
@ -680,9 +685,10 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
for (int i = NumConstant.ZERO; i < indexAgencyIds.size(); i++){
agencyIds[i] = indexAgencyIds.get(i);
}
mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcStreetAndDistrictAgencyInfo(customerId, agencyIds);
//todo 平阴县areaCode重复
mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcStreetAndDistrictAgencyInfo(customerId, agencyIds,formDTO.getCustomerAreaCode(),formDTO.getSubCustomerIds());
} else {
mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcStreetAndDistrictAgencyInfo(customerId, null);
mismatchAgencyList = screenCustomerAgencyDao.selectListMismatcStreetAndDistrictAgencyInfo(customerId, null,formDTO.getCustomerAreaCode(),formDTO.getSubCustomerIds());
}
if (!CollectionUtils.isEmpty(mismatchAgencyList)){
@ -691,7 +697,7 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
// fact_index_agency_score 区/街道相关分数表 agency
List<AgencyScoreDTO> agencyScoreDTOS = agencyScoreDaol.selectListAgencyScore(customerId, monthId);
// 开始处理实际分数
this.insertIndexDataMonthlyByAgencyScore(monthId, customerId, agencyScoreDTOS);
this.insertIndexDataMonthlyByAgencyScore(monthId, customerId, agencyScoreDTOS,formDTO.getCustomerAreaCode(),formDTO.getSubCustomerIds());
}
/**
@ -704,11 +710,13 @@ public class FactIndexCollectServiceImpl implements FactIndexCollectService {
* @Author zhangyong
* @Date 14:17 2020-09-03
**/
private void insertIndexDataMonthlyByAgencyScore(String monthId, String customerId, List<AgencyScoreDTO> agencyScoreDTOS) {
private void insertIndexDataMonthlyByAgencyScore(String monthId, String customerId, List<AgencyScoreDTO> agencyScoreDTOS,
String customerAreaCode,
List<String> subCustomerIds) {
List<IndexDataMonthlyFormDTO> monthlyFormDTOList = new ArrayList<>();
// 根据组织id(eg:社区或者街道id) 进行分组,最后组装一条数据 一个组织id 对应 4条数据
Map<String, List<AgencyScoreDTO>> collect = agencyScoreDTOS.stream().collect(Collectors.groupingBy(AgencyScoreDTO::getAgencyId));
List<ScreenCustomerAgencyEntity> parentAgencyList = screenCustomerAgencyDao.selectListAgencyInfo(customerId);
List<ScreenCustomerAgencyEntity> parentAgencyList = screenCustomerAgencyDao.selectListAgencyInfo(customerId,customerAreaCode,subCustomerIds);
int j = 0;
if (!CollectionUtils.isEmpty(parentAgencyList)) {
parentAgencyList.forEach(o -> {

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java

@ -405,7 +405,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
@Transactional(rollbackFor = Exception.class)
public Integer initBizOrg(CustomerBizOrgFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO);
List<ScreenCustomerAgencyEntity> entityList = screenCustomerAgencyDao.selectListAgencyInfo(formDTO.getCustomerId());
List<ScreenCustomerAgencyEntity> entityList = screenCustomerAgencyDao.selectListAgencyInfo(formDTO.getCustomerId(),null,null);
List<ScreenCustomerBizOrgEntity> list = new ArrayList<>();
if (CollectionUtils.isEmpty(entityList)) {
return 0;

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/stats/impl/CustomerRelationServiceImpl.java

@ -25,7 +25,9 @@ import com.epmet.dto.indexcal.CustomerSubInfoDTO;
import com.epmet.entity.stats.CustomerRelationEntity;
import com.epmet.service.stats.CustomerRelationService;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@ -51,6 +53,9 @@ public class CustomerRelationServiceImpl extends BaseServiceImpl<CustomerRelatio
@Override
public Map<String, CustomerSubInfoDTO> getCustomerInfoMap(List<String> customerIds) {
List<CustomerSubInfoDTO> list = baseDao.selectCustomerSubInfo(customerIds);
if(CollectionUtils.isEmpty(list)){
return new HashMap<>();
}
return list.stream().collect(Collectors.toMap(CustomerSubInfoDTO::getCustomerId, customer -> customer));
}
}

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

@ -70,8 +70,15 @@
screen_customer_agency
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID =#{customerId}
AND `LEVEL` = 'community'
<choose>
<when test="null!=subCustomerIds and subCustomerIds.size()>0">
and AREA_CODE LIKE concat( #{customerAreaCode}, '%')
</when>
<otherwise>
AND CUSTOMER_ID =#{customerId}
</otherwise>
</choose>
<if test="agencyIds != null and agencyIds!= ''">
AND AGENCY_ID NOT IN
<foreach item="item" collection="agencyIds" open="(" separator="," close=")">
@ -90,7 +97,14 @@
screen_customer_agency
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID =#{customerId}
<choose>
<when test="null!=subCustomerIds and subCustomerIds.size()>0">
and AREA_CODE LIKE concat( #{customerAreaCode}, '%')
</when>
<otherwise>
AND CUSTOMER_ID =#{customerId}
</otherwise>
</choose>
</select>
<!-- 根据agencyId查询上级组织Id -->
@ -122,8 +136,15 @@
screen_customer_agency
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
AND (`LEVEL` = 'street' OR `LEVEL` = 'district')
<choose>
<when test="null!=subCustomerIds and subCustomerIds.size()>0">
and AREA_CODE LIKE concat( #{customerAreaCode}, '%')
</when>
<otherwise>
AND CUSTOMER_ID = #{customerId}
</otherwise>
</choose>
) agency
<if test="agencyIds != null and agencyIds!= ''">
WHERE agencyId NOT IN

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

@ -60,7 +60,6 @@
screen_customer_dept m
WHERE
m.DEL_FLAG = '0'
AND m.CUSTOMER_ID =#{customerId}
AND m.DEPT_ID =#{deptId}
</select>
@ -73,7 +72,14 @@
screen_customer_dept
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID =#{customerId}
<choose>
<when test="null!=subCustomerIds and subCustomerIds.size()>0">
and AREA_CODE LIKE concat( #{customerAreaCode}, '%')
</when>
<otherwise>
AND CUSTOMER_ID =#{customerId}
</otherwise>
</choose>
<if test="deptIds != null and deptIds!= ''">
AND DEPT_ID NOT IN
<foreach item="item" collection="deptIds" open="(" separator="," close=")">
@ -91,7 +97,14 @@
screen_customer_dept
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID =#{customerId}
<choose>
<when test="null!=subCustomerIds and subCustomerIds.size()>0">
and AREA_CODE LIKE concat( #{customerAreaCode}, '%')
</when>
<otherwise>
AND CUSTOMER_ID =#{customerId}
</otherwise>
</choose>
</select>
<select id="getLastAddDept" resultType="com.epmet.entity.evaluationindex.screen.ScreenCustomerDeptEntity">

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

@ -114,7 +114,14 @@
screen_customer_grid
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID =#{customerId}
<choose>
<when test="null!=subCustomerIds and subCustomerIds.size()>0">
and AREA_CODE LIKE concat( #{customerAreaCode}, '%')
</when>
<otherwise>
AND CUSTOMER_ID =#{customerId}
</otherwise>
</choose>
<if test="gridIds != null and gridIds!= ''">
AND GRID_ID NOT IN
<foreach item="item" collection="gridIds" open="(" separator="," close=")">
@ -133,7 +140,14 @@
screen_customer_grid
WHERE
DEL_FLAG = '0'
AND CUSTOMER_ID =#{customerId}
<choose>
<when test="null!=subCustomerIds and subCustomerIds.size()>0">
and AREA_CODE LIKE concat( #{customerAreaCode}, '%')
</when>
<otherwise>
AND CUSTOMER_ID =#{customerId}
</otherwise>
</choose>
</select>
<!-- 根据agencyId查询网格ID -->

15
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/stats/CustomerRelationDao.xml

@ -2,15 +2,24 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.stats.CustomerRelationDao">
<select id="selectCustomerSubInfo" parameterType="map" resultType="com.epmet.dto.indexcal.CustomerSubInfoDTO">
<resultMap id="CustomerSubInfoDTOResMap" type="com.epmet.dto.indexcal.CustomerSubInfoDTO">
<result property="customerId" column="customerId"></result>
<result property="customerName" column="customerName"></result>
<result property="customerAreaCode" column="customerAreaCode"></result>
<collection property="subCustomerIds" ofType="java.lang.String">
<result column="subCustomerId"/>
</collection>
</resultMap>
<!-- 查询当前客户的area_code信息、以及子客户列表 -->
<select id="selectCustomerSubInfo" parameterType="map" resultMap="CustomerSubInfoDTOResMap">
SELECT
CR.PARENT_CUSTOMER_ID AS customerId,
dc.CUSTOMER_NAME AS customerName,
dc.AREA_CODE AS areaCode,
dc.AREA_CODE AS customerAreaCode,
CR.CUSTOMER_ID AS subCustomerId
FROM
customer_relation cr
LEFT JOIN dim_customer dc ON ( cr.PARENT_CUSTOMER_ID = DC.ID )
LEFT JOIN dim_customer dc ON ( cr.PARENT_CUSTOMER_ID = DC.ID and dc.del_flag='0')
WHERE
cr.DEL_FLAG = '0'
AND cr.`STATUS` = 'open'

Loading…
Cancel
Save