Browse Source

Merge remote-tracking branch 'remotes/origin/dev_screen_data' into dev_temp

dev_shibei_match
jianjun 5 years ago
parent
commit
526fc87121
  1. 4
      epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml
  2. 7
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.java
  3. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/CpcIndexCalculateServiceImpl.java
  4. 21
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java
  5. 1347
      epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.3__add_index_table.sql
  6. 4
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml

4
epmet-module/data-statistical/data-statistical-server/deploy/docker-compose-prod.yml

@ -9,10 +9,10 @@ services:
volumes: volumes:
- "/opt/epmet-cloud-logs/prod:/logs" - "/opt/epmet-cloud-logs/prod:/logs"
environment: environment:
RUN_INSTRUCT: "java -Xms256m -Xmx512m -jar ./data-stats.jar" RUN_INSTRUCT: "java -Xms256m -Xmx1024m -jar ./data-stats.jar"
restart: "unless-stopped" restart: "unless-stopped"
deploy: deploy:
resources: resources:
limits: limits:
cpus: '0.1' cpus: '0.1'
memory: 600M memory: 1100M

7
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.java

@ -19,7 +19,6 @@ package com.epmet.dao.evaluationindex.indexcoll;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.indexcollect.form.GridPartyMemberDataDetailFormDTO; import com.epmet.dto.indexcollect.form.GridPartyMemberDataDetailFormDTO;
import com.epmet.dto.indexcollect.form.GridPartyMemberDataFormDTO;
import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity; import com.epmet.entity.evaluationindex.indexcoll.FactIndexPartyAblityCpcMonthlyEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -46,7 +45,7 @@ public interface FactIndexPartyAblityCpcMonthlyDao extends BaseDao<FactIndexPart
* @Date 10:52 2020-08-20 * @Date 10:52 2020-08-20
**/ **/
int deleteFactIndexPartyAblityCpcMonthly(@Param("customerId") String customerId, int deleteFactIndexPartyAblityCpcMonthly(@Param("customerId") String customerId,
@Param("monthId") String monthId); @Param("monthId") String monthId);
/** /**
* 1党建能力-党员相关指标上报(按照月份) * 1党建能力-党员相关指标上报(按照月份)
@ -58,9 +57,9 @@ public interface FactIndexPartyAblityCpcMonthlyDao extends BaseDao<FactIndexPart
* @Date 10:52 2020-08-20 * @Date 10:52 2020-08-20
**/ **/
int batchInsertFactIndexPartyAblityCpcMonthly(@Param("list") List<GridPartyMemberDataDetailFormDTO> list, int batchInsertFactIndexPartyAblityCpcMonthly(@Param("list") List<GridPartyMemberDataDetailFormDTO> list,
@Param("customerId") String customerId); @Param("customerId") String customerId);
List<Map<String, Object>> getCountByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("offset") Integer offset, @Param("pageSize") Integer pageSize); List<Map<String, Object>> getCountByMonthId(@Param("customerId") String customerId, @Param("monthId") String monthId, @Param("offset") Integer offset, @Param("pageSize") Integer pageSize);
Map<String, Object> getExtremeValue(@Param("customerId") String customerId); Map<String, Object> getExtremeValue(@Param("customerId") String customerId, @Param("monthId") String monthId);
} }

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

@ -90,7 +90,7 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
list = cpcScoreDao.getPartScore(formDTO.getCustomerId(), formDTO.getMonthId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode(), (pageNo - NumConstant.ONE) * pageSize, pageSize); list = cpcScoreDao.getPartScore(formDTO.getCustomerId(), formDTO.getMonthId(), IndexCodeEnum.DANG_YUAN_XIANG_GUAN.getCode(), (pageNo - NumConstant.ONE) * pageSize, pageSize);
pageNo++; pageNo++;
if (CollectionUtils.isEmpty(list)) { if (CollectionUtils.isEmpty(list)) {
log.error("calculateTotalScore cpcScoreDao.getPartScore return empty,customerId:{},monthId:{}", formDTO.getCustomerId(), formDTO.getMonthId()); log.warn("calculateTotalScore cpcScoreDao.getPartScore return empty,customerId:{},monthId:{}", formDTO.getCustomerId(), formDTO.getMonthId());
} else { } else {
//获取最后一条 //获取最后一条
currentLastCpcScore = list.get(list.size() - 1); currentLastCpcScore = list.get(list.size() - 1);
@ -182,7 +182,7 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
private void calculatePartScore(CalculateCommonFormDTO formDTO) { private void calculatePartScore(CalculateCommonFormDTO formDTO) {
//计算最大最小值 //计算最大最小值
Map<String, Object> minAndMaxMap = factIndexPartyAblityCpcMonthlyDao.getExtremeValue(formDTO.getCustomerId()); Map<String, Object> minAndMaxMap = factIndexPartyAblityCpcMonthlyDao.getExtremeValue(formDTO.getCustomerId(), formDTO.getMonthId());
if (CollectionUtils.isEmpty(minAndMaxMap)) { if (CollectionUtils.isEmpty(minAndMaxMap)) {
log.error("cpcIndexCalculate getExtremeValue customerId:{} have not any fact record", formDTO.getCustomerId()); log.error("cpcIndexCalculate getExtremeValue customerId:{} have not any fact record", formDTO.getCustomerId());
throw new RenException("指标原始数据记录不存在"); throw new RenException("指标原始数据记录不存在");
@ -198,9 +198,7 @@ public class CpcIndexCalculateServiceImpl implements CpcIndexCalculateService {
int pageSize = IndexCalConstant.PAGE_SIZE; int pageSize = IndexCalConstant.PAGE_SIZE;
//分页查询 要计算的原始数据 //分页查询 要计算的原始数据
List<Map<String, Object>> list = null; List<Map<String, Object>> list = null;
groupIndexDetailsMap.keySet().forEach(indexCode -> { groupIndexDetailsMap.keySet().forEach(indexCode -> deleteOldData(formDTO, indexCode));
deleteOldData(formDTO, indexCode);
});
do { do {
list = factIndexPartyAblityCpcMonthlyDao.getCountByMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), (pageNo - 1) * pageSize, pageSize); list = factIndexPartyAblityCpcMonthlyDao.getCountByMonthId(formDTO.getCustomerId(), formDTO.getMonthId(), (pageNo - 1) * pageSize, pageSize);
if (!CollectionUtils.isEmpty(list)) { if (!CollectionUtils.isEmpty(list)) {

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

@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSON;
import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.DataSourceConstant; import com.epmet.constant.DataSourceConstant;
import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.dto.indexcal.CalculateCommonFormDTO;
@ -78,30 +77,27 @@ public class IndexCalculateServiceImpl implements IndexCalculateService {
try { try {
CalculateCommonFormDTO param = new CalculateCommonFormDTO(customerId, formDTO.getMonthId()); CalculateCommonFormDTO param = new CalculateCommonFormDTO(customerId, formDTO.getMonthId());
flag = cpcIndexCalculateService.cpcIndexCalculate(param); flag = cpcIndexCalculateService.cpcIndexCalculate(param);
log.info("indexCalculate cpcIndexCalculate return result:{}", flag); log.info("客户Id:{}【党员相关】计算完毕,总耗时:{}秒,result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag);
} catch (Exception e) { } catch (Exception e) {
log.error("indexCalculate cpcIndexCalculate exception", e); log.error("indexCalculate cpcIndexCalculate exception", e);
throw new RenException("indexCalculate cpcIndexCalculate exception", e); throw new RenException("indexCalculate cpcIndexCalculate exception", e);
} }
//测试用 //测试用
HttpClientManager.getInstance().sendAlarmMsg("客户Id:" + customerId + " 【党员相关】计算完毕,总耗时:" + (System.currentTimeMillis() - start) / 1000 + "秒");
//计算网格 //计算网格
start = System.currentTimeMillis(); start = System.currentTimeMillis();
try { try {
flag = gridCorreLationService.calculateGridCorreLation(calculateCommonFormDTO); flag = gridCorreLationService.calculateGridCorreLation(calculateCommonFormDTO);
log.info("indexCalculate calculateGridCorreLation return result:{}", flag); log.info("客户Id:{}【网格相关】计算完毕,总耗时:{}秒,result:{},result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag);
} catch (Exception e) { } catch (Exception e) {
log.error("indexCalculate calculateGridCorreLation exception", e); log.error("indexCalculate calculateGridCorreLation exception", e);
throw new RenException("indexCalculate calculateGridCorreLation exception", e); throw new RenException("indexCalculate calculateGridCorreLation exception", e);
} }
HttpClientManager.getInstance().sendAlarmMsg("客户Id:" + customerId + " 【网格相关】计算完毕,总耗时:" + (System.currentTimeMillis() - start) / 1000 + "秒");
//计算社区 //计算社区
start = System.currentTimeMillis(); start = System.currentTimeMillis();
try { try {
flag = indexCalculateCommunityService.calCommunityAll(customerId, formDTO.getMonthId()); flag = indexCalculateCommunityService.calCommunityAll(customerId, formDTO.getMonthId());
log.info("indexCalculate calCommunityAll return result:{}", flag); log.info("客户Id:{}【社区相关】计算完毕,总耗时:{}秒,result:{},result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag);
HttpClientManager.getInstance().sendAlarmMsg("客户Id:" + customerId + " 【社区相关】计算完毕,总耗时:" + (System.currentTimeMillis() - start) / 1000 + "秒");
} catch (Exception e) { } catch (Exception e) {
log.error("indexCalculate calCommunityAll exception", e); log.error("indexCalculate calCommunityAll exception", e);
throw new RenException("indexCalculate calAll exception", e); throw new RenException("indexCalculate calAll exception", e);
@ -111,8 +107,7 @@ public class IndexCalculateServiceImpl implements IndexCalculateService {
start = System.currentTimeMillis(); start = System.currentTimeMillis();
try { try {
flag = indexCalculateStreetService.calStreetAll(customerId, formDTO.getMonthId()); flag = indexCalculateStreetService.calStreetAll(customerId, formDTO.getMonthId());
log.info("indexCalculate calStreetAll return result:{}", flag); log.info("客户Id:{}【街道相关】计算完毕,总耗时:{}秒,result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag);
HttpClientManager.getInstance().sendAlarmMsg("客户Id:" + customerId + " 【街道相关】计算完毕,总耗时:" + (System.currentTimeMillis() - start) / 1000 + "秒");
} catch (Exception e) { } catch (Exception e) {
log.error("indexCalculate calStreetAll exception", e); log.error("indexCalculate calStreetAll exception", e);
throw new RenException("indexCalculate calStreetAll exception", e); throw new RenException("indexCalculate calStreetAll exception", e);
@ -122,8 +117,7 @@ public class IndexCalculateServiceImpl implements IndexCalculateService {
start = System.currentTimeMillis(); start = System.currentTimeMillis();
try { try {
flag = deptScoreService.calculateDeptCorreLation(calculateCommonFormDTO); flag = deptScoreService.calculateDeptCorreLation(calculateCommonFormDTO);
log.info("indexCalculate calculateDeptCorreLation return result:{}", flag); log.info("客户Id:{}【区直部门】计算完毕,总耗时:{}秒,result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag);
HttpClientManager.getInstance().sendAlarmMsg("客户Id:" + customerId + " 【区直部门】计算完毕,总耗时:" + (System.currentTimeMillis() - start) / 1000 + "秒");
} catch (Exception e) { } catch (Exception e) {
log.error("indexCalculate calculateDeptCorreLation exception", e); log.error("indexCalculate calculateDeptCorreLation exception", e);
throw new RenException("indexCalculate calculateDeptCorreLation exception", e); throw new RenException("indexCalculate calculateDeptCorreLation exception", e);
@ -133,8 +127,7 @@ public class IndexCalculateServiceImpl implements IndexCalculateService {
start = System.currentTimeMillis(); start = System.currentTimeMillis();
try { try {
indexCalculateDistrictService.calDistrictAll(customerId, formDTO.getMonthId()); indexCalculateDistrictService.calDistrictAll(customerId, formDTO.getMonthId());
log.info("indexCalculate calDistrictAll return result:{}", flag); log.info("客户Id:{}【全区相关】计算完毕,总耗时:{}秒,result:{}", customerId, (System.currentTimeMillis() - start) / 1000, flag);
HttpClientManager.getInstance().sendAlarmMsg("客户Id:" + customerId + " 【全区相关】计算完毕,总耗时:" + (System.currentTimeMillis() - start) / 1000 + "秒");
} catch (Exception e) { } catch (Exception e) {
log.error("indexCalculate calDistrictAll exception", e); log.error("indexCalculate calDistrictAll exception", e);
throw new RenException("indexCalculate calDistrictAll exception", e); throw new RenException("indexCalculate calDistrictAll exception", e);
@ -148,7 +141,7 @@ public class IndexCalculateServiceImpl implements IndexCalculateService {
start = System.currentTimeMillis(); start = System.currentTimeMillis();
try { try {
factIndexCollectService.insertScreenIndexDataMonthlyAndYearly(formDTO.getMonthId(), formDTO.getCustomerId()); factIndexCollectService.insertScreenIndexDataMonthlyAndYearly(formDTO.getMonthId(), formDTO.getCustomerId());
HttpClientManager.getInstance().sendAlarmMsg("客户Id:" + customerId + " 分数插入到大屏显示库完毕,总耗时:" + (System.currentTimeMillis() - start) / 1000 + "秒"); log.info("客户Id:{}分数插入到大屏显示库完毕,总耗时:{}秒", customerId, (System.currentTimeMillis() - start) / 1000);
} catch (Exception e) { } catch (Exception e) {
log.error("indexCalculate insertScreenIndexDataMonthlyAndYearly exception", e); log.error("indexCalculate insertScreenIndexDataMonthlyAndYearly exception", e);
flag = false; flag = false;

1347
epmet-module/data-statistical/data-statistical-server/src/main/resources/db/migration/V0.0.3__add_index_table.sql

File diff suppressed because it is too large

4
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityCpcMonthlyDao.xml

@ -93,7 +93,9 @@
FROM FROM
fact_index_party_ablity_cpc_monthly fact_index_party_ablity_cpc_monthly
WHERE WHERE
CUSTOMER_ID = #{customerId,jdbcType=VARCHAR} AND DEL_FLAG = '0' CUSTOMER_ID = #{customerId,jdbcType=VARCHAR}
AND MONTH_ID = #{monthId,jdbcType=VARCHAR}
AND DEL_FLAG = '0'
</select> </select>
<select id="getCountByMonthId" resultType="java.util.Map"> <select id="getCountByMonthId" resultType="java.util.Map">

Loading…
Cancel
Save