Browse Source

Merge remote-tracking branch 'remotes/origin/dev_screen_data_2.0' into dev_temp

dev_shibei_match
jianjun 5 years ago
parent
commit
6ddbf81dda
  1. 1
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java
  2. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/GridUserCountResultDTO.java
  3. 7
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java
  4. 24
      epmet-module/data-statistical/data-statistical-server/pom.xml
  5. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java
  6. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexOriginExtractController.java
  7. 18
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexServiceAblityGridMonthlyDao.java
  8. 44
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/ActInfoDao.java
  9. 20
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactIndexServiceAbilityGridMonthlyService.java
  10. 4
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/CalCpcIndexServiceImpl.java
  11. 101
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/CalGridIndexServiceImpl.java
  12. 30
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactIndexServiceAbilityGridMonthlyServiceImpl.java
  13. 5
      epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml
  14. 62
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexServiceAblityGridMonthlyDao.xml
  15. 21
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActInfoDao.xml

1
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java

@ -13,4 +13,5 @@ public interface DataSourceConstant {
String EPMET_USER = "epmetuser"; String EPMET_USER = "epmetuser";
String EVALUATION_INDEX = "evaluationIndex"; String EVALUATION_INDEX = "evaluationIndex";
String PARTY_MEMBER = "partyMember"; String PARTY_MEMBER = "partyMember";
String EPMET_HEART="epmetHeart";
} }

5
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/extract/result/GridUserCountResultDTO.java

@ -1,5 +1,6 @@
package com.epmet.dto.extract.result; package com.epmet.dto.extract.result;
import com.epmet.commons.tools.constant.NumConstant;
import lombok.Data; import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
@ -16,12 +17,12 @@ public class GridUserCountResultDTO implements Serializable {
/** /**
* 注册居民本月增量 * 注册居民本月增量
*/ */
private Integer userCount; private Integer userCount = NumConstant.ZERO;
/** /**
* 注册党员本月增量 * 注册党员本月增量
*/ */
private Integer partyCount; private Integer partyCount = NumConstant.ZERO;
/** /**
* 网格ID * 网格ID

7
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java

@ -22,7 +22,7 @@ import org.springframework.web.bind.annotation.RequestParam;
* @author: jianjun liu * @author: jianjun liu
*/ */
//url="http://localhost:8108" //url="http://localhost:8108"
@FeignClient(name = ServiceConstant.DATA_STATISTICAL_SERVER, fallback = DataStatisticalOpenFeignClientFallBack.class) @FeignClient(name = ServiceConstant.DATA_STATISTICAL_SERVER, fallback = DataStatisticalOpenFeignClientFallBack.class, configuration =)
public interface DataStatisticalOpenFeignClient { public interface DataStatisticalOpenFeignClient {
/** /**
@ -199,16 +199,17 @@ public interface DataStatisticalOpenFeignClient {
* @date: 2020/6/22 9:09 * @date: 2020/6/22 9:09
* @author: jianjun liu * @author: jianjun liu
*/ */
@PostMapping(value = "data/stats/factorigin/extractall") @PostMapping(value = "/data/stats/factorigin/extractall")
Result factOriginExtractAll(@RequestBody(required = false) ExtractFormDTO formDTO); Result factOriginExtractAll(@RequestBody(required = false) ExtractFormDTO formDTO);
/** /**
* ˚
* desc: 抽取统计数据到指标库 * desc: 抽取统计数据到指标库
* *
* @date: 2020/6/22 9:09 * @date: 2020/6/22 9:09
* @author: jianjun liu * @author: jianjun liu
*/ */
@PostMapping(value = "data/stats/indexorigin/extractall") @PostMapping(value = "/data/stats/indexorigin/extractall")
Result indexOriginExtractAll(@RequestBody(required = false) ExtractIndexFormDTO formDTO); Result indexOriginExtractAll(@RequestBody(required = false) ExtractIndexFormDTO formDTO);
} }

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

@ -210,6 +210,12 @@
<datasource.druid.partyMember.username>epmet_resi_partymember_user</datasource.druid.partyMember.username> <datasource.druid.partyMember.username>epmet_resi_partymember_user</datasource.druid.partyMember.username>
<datasource.druid.partyMember.password>EpmEt-db-UsEr</datasource.druid.partyMember.password> <datasource.druid.partyMember.password>EpmEt-db-UsEr</datasource.druid.partyMember.password>
<datasource.druid.epmetHeart.url>
<![CDATA[jdbc:mysql://192.168.1.130:3306/epmet_heart?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.epmetHeart.url>
<datasource.druid.epmetHeart.username>epmet_heart_user</datasource.druid.epmetHeart.username>
<datasource.druid.epmetHeart.password>EpmEt-db-UsEr</datasource.druid.epmetHeart.password>
<!-- redis配置 --> <!-- redis配置 -->
<spring.redis.index>0</spring.redis.index> <spring.redis.index>0</spring.redis.index>
<spring.redis.host>192.168.1.130</spring.redis.host> <spring.redis.host>192.168.1.130</spring.redis.host>
@ -314,6 +320,12 @@
<datasource.druid.partyMember.username>epmet_resi_partymember_user</datasource.druid.partyMember.username> <datasource.druid.partyMember.username>epmet_resi_partymember_user</datasource.druid.partyMember.username>
<datasource.druid.partyMember.password>EpmEt-db-UsEr</datasource.druid.partyMember.password> <datasource.druid.partyMember.password>EpmEt-db-UsEr</datasource.druid.partyMember.password>
<datasource.druid.epmetHeart.url>
<![CDATA[jdbc:mysql://192.168.1.130:3306/epmet_heart?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.epmetHeart.url>
<datasource.druid.epmetHeart.username>epmet_heart_user</datasource.druid.epmetHeart.username>
<datasource.druid.epmetHeart.password>EpmEt-db-UsEr</datasource.druid.epmetHeart.password>
<!-- redis配置 --> <!-- redis配置 -->
<spring.redis.index>0</spring.redis.index> <spring.redis.index>0</spring.redis.index>
<spring.redis.host>192.168.1.130</spring.redis.host> <spring.redis.host>192.168.1.130</spring.redis.host>
@ -418,6 +430,12 @@
<datasource.druid.partyMember.username>epmet</datasource.druid.partyMember.username> <datasource.druid.partyMember.username>epmet</datasource.druid.partyMember.username>
<datasource.druid.partyMember.password>elink@833066</datasource.druid.partyMember.password> <datasource.druid.partyMember.password>elink@833066</datasource.druid.partyMember.password>
<datasource.druid.epmetHeart.url>
<![CDATA[jdbc:mysql://rm-m5ef9t617j6o5eup7.mysql.rds.aliyuncs.com:3306/epmet_heart?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.epmetHeart.url>
<datasource.druid.epmetHeart.username>epmet</datasource.druid.epmetHeart.username>
<datasource.druid.epmetHeart.password>elink@833066</datasource.druid.epmetHeart.password>
<!-- redis配置 --> <!-- redis配置 -->
<spring.redis.index>0</spring.redis.index> <spring.redis.index>0</spring.redis.index>
<spring.redis.host>r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com</spring.redis.host> <spring.redis.host>r-m5eoz5b6tkx09y6bpz.redis.rds.aliyuncs.com</spring.redis.host>
@ -518,6 +536,12 @@
<datasource.druid.partyMember.username>epmet_resi_partymember_user</datasource.druid.partyMember.username> <datasource.druid.partyMember.username>epmet_resi_partymember_user</datasource.druid.partyMember.username>
<datasource.druid.partyMember.password>EpmEt-db-UsEr</datasource.druid.partyMember.password> <datasource.druid.partyMember.password>EpmEt-db-UsEr</datasource.druid.partyMember.password>
<datasource.druid.epmetHeart.url>
<![CDATA[jdbc:mysql://rm-m5e3vzs2637224wj9.mysql.rds.aliyuncs.com:3306/epmet_heart?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.epmetHeart.url>
<datasource.druid.epmetHeart.username>epmet_heart_user</datasource.druid.epmetHeart.username>
<datasource.druid.epmetHeart.password>EpmEt-db-UsEr</datasource.druid.epmetHeart.password>
<!-- redis配置 --> <!-- redis配置 -->
<spring.redis.index>0</spring.redis.index> <spring.redis.index>0</spring.redis.index>
<spring.redis.host>r-m5ez3n1j0qc3ykq2ut.redis.rds.aliyuncs.com</spring.redis.host> <spring.redis.host>r-m5ez3n1j0qc3ykq2ut.redis.rds.aliyuncs.com</spring.redis.host>

8
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/DemoController.java

@ -544,16 +544,16 @@ public class DemoController {
@PostMapping("gridparty") @PostMapping("gridparty")
public void gridParty(){ public void gridParty(){
// String customerId = "3ef7e4bb195eb9e622d68b52509aa940"; String customerId = "3ef7e4bb195eb9e622d68b52509aa940";
String customerId = "epmettest"; // String customerId = "epmettest";
String monthId = "202008"; String monthId = "202008";
calGridIndexService.calGridIndexPartyAbility(customerId,monthId); calGridIndexService.calGridIndexPartyAbility(customerId,monthId);
} }
@PostMapping("gridgovern") @PostMapping("gridgovern")
public void gridGovern(){ public void gridGovern(){
// String customerId = "3ef7e4bb195eb9e622d68b52509aa940"; String customerId = "3ef7e4bb195eb9e622d68b52509aa940";
String customerId = "epmettest"; // String customerId = "epmettest";
String monthId = "202008"; String monthId = "202008";
calGridIndexService.calGridIndexGovernAbility(customerId,monthId); calGridIndexService.calGridIndexGovernAbility(customerId,monthId);
} }

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/IndexOriginExtractController.java

@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
* @date 2020/9/15 11:06 * @date 2020/9/15 11:06
*/ */
@RestController @RestController
@RequestMapping("indexorigin") @RequestMapping("factorigin")
public class IndexOriginExtractController { public class IndexOriginExtractController {
@Autowired @Autowired
private IndexOriginExtractService indexOriginExtractService; private IndexOriginExtractService indexOriginExtractService;

18
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcoll/FactIndexServiceAblityGridMonthlyDao.java

@ -96,4 +96,22 @@ public interface FactIndexServiceAblityGridMonthlyDao extends BaseDao<FactIndexS
* @Date 2020/9/2 14:46 * @Date 2020/9/2 14:46
**/ **/
String selectTheOneGrid(CalculateCommonFormDTO formDTO); String selectTheOneGrid(CalculateCommonFormDTO formDTO);
/**
* @return java.util.List<com.epmet.entity.evaluationindex.indexcoll.FactIndexServiceAblityGridMonthlyEntity>
* @param customerId
* @author yinzuomei
* @description 查询出所有的网格初始化好 服务能力-网格相关事实表 各个指标值赋值为0
* @Date 2020/9/21 9:42
**/
List<FactIndexServiceAblityGridMonthlyEntity> initAllGridList(String customerId);
/**
* @return void
* @param list
* @author yinzuomei
* @description 批量插入网格相关-服务能力指标表
* @Date 2020/9/21 10:13
**/
void insertBatchEntity(@Param("list") List<FactIndexServiceAblityGridMonthlyEntity> list);
} }

44
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/heart/ActInfoDao.java

@ -0,0 +1,44 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.dao.heart;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
* 活动信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-07-19
*/
@Mapper
public interface ActInfoDao{
/**
* @return java.util.List<java.util.Map<java.lang.String,java.lang.Integer>>
* @param customerId
* @param monthId
* @author yinzuomei
* @description 查询这个月各个网格举办的活动次数 活动状态已结束并且实际结束时间在评价周期内的
* @Date 2020/9/21 10:41
**/
List<Map<String, Integer>> selectActGroupByGridId(@Param("customerId") String customerId, @Param("monthId") String monthId);
}

20
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/FactIndexServiceAbilityGridMonthlyService.java

@ -1,5 +1,9 @@
package com.epmet.service.evaluationindex.extract; package com.epmet.service.evaluationindex.extract;
import com.epmet.entity.evaluationindex.indexcoll.FactIndexServiceAblityGridMonthlyEntity;
import java.util.List;
/** /**
* 服务能力-网格相关事实表 * 服务能力-网格相关事实表
* *
@ -7,5 +11,21 @@ package com.epmet.service.evaluationindex.extract;
* @since v1.0.0 2020-09-19 * @since v1.0.0 2020-09-19
*/ */
public interface FactIndexServiceAbilityGridMonthlyService{ public interface FactIndexServiceAbilityGridMonthlyService{
/**
* @return java.util.List<com.epmet.entity.evaluationindex.indexcoll.FactIndexServiceAblityGridMonthlyEntity>
* @param customerId
* @author yinzuomei
* @description 查询出所有的网格初始化好 服务能力-网格相关事实表 各个指标值赋值为0
* @Date 2020/9/21 9:38
**/
List<FactIndexServiceAblityGridMonthlyEntity> initAllGridList(String customerId);
/**
* @return void
* @param list
* @author yinzuomei
* @description 批量插入网格相关-服务能力指标表
* @Date 2020/9/21 10:05
**/
void insertBatchEntity(List<FactIndexServiceAblityGridMonthlyEntity> list);
} }

4
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/CalCpcIndexServiceImpl.java

@ -132,7 +132,7 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService {
//4、分批插入批量插入 //4、分批插入批量插入
List<List<FactIndexPartyAblityCpcMonthlyEntity>> partition = ListUtils.partition(indexPartyAblityCpcList, IndexCalConstant.INSERT_SIZE); List<List<FactIndexPartyAblityCpcMonthlyEntity>> partition = ListUtils.partition(indexPartyAblityCpcList, IndexCalConstant.INSERT_SIZE);
partition.forEach(list -> { partition.forEach(list -> {
this.FactIndexPartyAblityCpcMonthlyEntity(list); this.saveFactIndexPartyAblityCpcMonthlyEntity(list);
}); });
} }
@ -428,7 +428,7 @@ public class CalCpcIndexServiceImpl implements CalCpcIndexService {
* @Date 2020/9/18 10:27 * @Date 2020/9/18 10:27
**/ **/
@DataSource(value = DataSourceConstant.EVALUATION_INDEX) @DataSource(value = DataSourceConstant.EVALUATION_INDEX)
private void FactIndexPartyAblityCpcMonthlyEntity(List<FactIndexPartyAblityCpcMonthlyEntity> list) { private void saveFactIndexPartyAblityCpcMonthlyEntity(List<FactIndexPartyAblityCpcMonthlyEntity> list) {
factIndexPartyAblityCpcMonthlyDao.insertBatchEntity(list); factIndexPartyAblityCpcMonthlyDao.insertBatchEntity(list);
} }

101
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/CalGridIndexServiceImpl.java

@ -1,20 +1,26 @@
package com.epmet.service.evaluationindex.extract.impl; package com.epmet.service.evaluationindex.extract.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
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.constant.DataSourceConstant;
import com.epmet.constant.ExtractConstant; import com.epmet.constant.ExtractConstant;
import com.epmet.constant.IndexCalConstant;
import com.epmet.constant.ProjectEvaluateConstant; import com.epmet.constant.ProjectEvaluateConstant;
import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyDao; import com.epmet.dao.evaluationindex.indexcoll.FactIndexGovrnAblityGridMonthlyDao;
import com.epmet.dao.evaluationindex.indexcoll.FactIndexServiceAblityGridMonthlyDao;
import com.epmet.dao.heart.ActInfoDao;
import com.epmet.dto.extract.form.GovernAbilityGridMonthlyFormDTO; import com.epmet.dto.extract.form.GovernAbilityGridMonthlyFormDTO;
import com.epmet.dto.extract.form.GridIssueCountResultDTO; import com.epmet.dto.extract.form.GridIssueCountResultDTO;
import com.epmet.dto.extract.form.PartyAbilityGridMonthlyFormDTO; import com.epmet.dto.extract.form.PartyAbilityGridMonthlyFormDTO;
import com.epmet.dto.extract.result.*; import com.epmet.dto.extract.result.*;
import com.epmet.entity.evaluationindex.indexcoll.FactIndexServiceAblityGridMonthlyEntity;
import com.epmet.service.evaluationindex.extract.*; import com.epmet.service.evaluationindex.extract.*;
import com.epmet.service.stats.FactArticlePublishedGridDailyService; import com.epmet.service.stats.FactArticlePublishedGridDailyService;
import com.epmet.service.stats.user.FactRegUserGridMonthlyService; import com.epmet.service.stats.user.FactRegUserGridMonthlyService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.apache.commons.collections4.ListUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -58,6 +64,12 @@ public class CalGridIndexServiceImpl implements CalGridIndexService {
@Autowired @Autowired
private FactOriginTopicLogDailyService topicLogService; private FactOriginTopicLogDailyService topicLogService;
@Autowired
private FactIndexServiceAbilityGridMonthlyService factIndexServiceAbilityGridMonthlyService;
@Autowired
private FactIndexServiceAblityGridMonthlyDao factIndexServiceAblityGridMonthlyDao;
@Autowired
private ActInfoDao actInfoDao;
/** /**
* @Description 计算网格指标党建能力 * @Description 计算网格指标党建能力
* @param customerId * @param customerId
@ -125,7 +137,8 @@ public class CalGridIndexServiceImpl implements CalGridIndexService {
if (!CollectionUtils.isEmpty(gridUserCountList)){ if (!CollectionUtils.isEmpty(gridUserCountList)){
gridUserCountList.forEach(count -> { gridUserCountList.forEach(count -> {
if (r.getGridId().equals(count.getGridId())){ if (r.getGridId().equals(count.getGridId())){
BeanUtils.copyProperties(count,r); r.setUserCount(count.getUserCount());
r.setPartyCount(count.getPartyCount());
} }
}); });
} }
@ -307,7 +320,8 @@ public class CalGridIndexServiceImpl implements CalGridIndexService {
if (!CollectionUtils.isEmpty(gridIssueTotalList)) { if (!CollectionUtils.isEmpty(gridIssueTotalList)) {
gridIssueTotalList.forEach(total -> { gridIssueTotalList.forEach(total -> {
if (r.getGridId().equals(total.getGridId())) { if (r.getGridId().equals(total.getGridId())) {
BeanUtils.copyProperties(total, r); r.setIssueTotal(total.getIssueTotal());
r.setAvgIssueCount(total.getAvgIssueCount());
} }
}); });
} }
@ -362,7 +376,86 @@ public class CalGridIndexServiceImpl implements CalGridIndexService {
*/ */
@Override @Override
public Boolean calGridIndexServiceAbility(String customerId, String monthId) { public Boolean calGridIndexServiceAbility(String customerId, String monthId) {
return null; //1、构造好初始数据,各指标赋值0
List<FactIndexServiceAblityGridMonthlyEntity> entityList=factIndexServiceAbilityGridMonthlyService.initAllGridList(customerId);
if(CollectionUtils.isEmpty(entityList)){
log.info("screen_customer_grid do not any records");
return true;
}
String quarterId= DateUtils.getQuarterId(monthId);
String yearId=DateUtils.getYearId(monthId);
//各个网格这个月举办的活动
Map<String,Integer> activityCountMap=calActivityCountMap(customerId,monthId);
//2、遍历网格,赋值每个网格指标
for(FactIndexServiceAblityGridMonthlyEntity entity:entityList){
entity.setMonthId(monthId);
entity.setQuarterId(quarterId);
entity.setYearId(yearId);
//网格活动组织次数 爱心活动
if(activityCountMap.containsKey(entity.getGridId())){
entity.setActivityCount(activityCountMap.get(entity.getGridId()));
}
//网格志愿者占比 todo
// entity.setVolunteerRatio();
//网格党员志愿者率 todo
// entity.setPartyVolunteerRatio();
}
//3、批量删
deleteBatchIndexServiceAblityGridMonthly(customerId,monthId);
//4、批量增
List<List<FactIndexServiceAblityGridMonthlyEntity>> partition = ListUtils.partition(entityList, IndexCalConstant.INSERT_SIZE);
partition.forEach(list -> {
this.saveFactIndexServiceAblityGridMonthlyEntity(list);
});
return true;
}
/**
* @return java.util.Map<java.lang.String,java.lang.Integer>
* @param customerId
* @param monthId
* @author yinzuomei
* @description 网格活动组织次数 爱心活动 值得是 活动状态已结束并且实际结束时间在评价周期内的
* @Date 2020/9/21 10:23
**/
@DataSource(DataSourceConstant.EPMET_HEART)
private Map<String, Integer> calActivityCountMap(String customerId, String monthId) {
List<Map<String, Integer>> mapList = actInfoDao.selectActGroupByGridId(customerId, monthId);
Map<String, Integer> resultMap = new HashMap<>();
for (Map<String, Integer> map : mapList) {
for (Map.Entry<String, Integer> m : map.entrySet()) {
resultMap.put(m.getKey(), m.getValue());
}
}
return resultMap;
}
/**
* @return void
* @param customerId
* @param monthId
* @author yinzuomei
* @description 批量删除网格相关-服务能力指标表
* @Date 2020/9/21 10:16
**/
@DataSource(DataSourceConstant.EVALUATION_INDEX)
private void deleteBatchIndexServiceAblityGridMonthly(String customerId, String monthId) {
int deleteNum;
do {
deleteNum = factIndexServiceAblityGridMonthlyDao.deleteFactIndexServiceAblityGridMonthly(customerId, monthId);
} while (deleteNum > NumConstant.ZERO);
}
/**
* @param list
* @return void
* @author yinzuomei
* @description 批量插入网格相关-服务能力指标表
* @Date 2020/9/21 10:04
**/
@DataSource(DataSourceConstant.EVALUATION_INDEX)
private void saveFactIndexServiceAblityGridMonthlyEntity(List<FactIndexServiceAblityGridMonthlyEntity> list) {
factIndexServiceAbilityGridMonthlyService.insertBatchEntity(list);
} }
/** /**

30
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/impl/FactIndexServiceAbilityGridMonthlyServiceImpl.java

@ -2,10 +2,15 @@ package com.epmet.service.evaluationindex.extract.impl;
import com.epmet.commons.dynamic.datasource.annotation.DataSource; import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.constant.DataSourceConstant; import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.indexcoll.FactIndexServiceAblityGridMonthlyDao;
import com.epmet.entity.evaluationindex.indexcoll.FactIndexServiceAblityGridMonthlyEntity;
import com.epmet.service.evaluationindex.extract.FactIndexServiceAbilityGridMonthlyService; import com.epmet.service.evaluationindex.extract.FactIndexServiceAbilityGridMonthlyService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.List;
/** /**
* 服务能力-网格相关事实表 * 服务能力-网格相关事实表
* *
@ -16,5 +21,30 @@ import org.springframework.stereotype.Service;
@Slf4j @Slf4j
@DataSource(DataSourceConstant.EVALUATION_INDEX) @DataSource(DataSourceConstant.EVALUATION_INDEX)
public class FactIndexServiceAbilityGridMonthlyServiceImpl implements FactIndexServiceAbilityGridMonthlyService { public class FactIndexServiceAbilityGridMonthlyServiceImpl implements FactIndexServiceAbilityGridMonthlyService {
@Autowired
private FactIndexServiceAblityGridMonthlyDao baseDao;
/**
* @param customerId
* @return java.util.List<com.epmet.entity.evaluationindex.indexcoll.FactIndexServiceAblityGridMonthlyEntity>
* @author yinzuomei
* @description 查询出所有的网格初始化好 服务能力-网格相关事实表 各个指标值赋值为0
* @Date 2020/9/21 9:38
**/
@Override
public List<FactIndexServiceAblityGridMonthlyEntity> initAllGridList(String customerId) {
return baseDao.initAllGridList(customerId);
}
/**
* @param list
* @return void
* @author yinzuomei
* @description 批量插入网格相关-服务能力指标表
* @Date 2020/9/21 10:05
**/
@Override
public void insertBatchEntity(List<FactIndexServiceAblityGridMonthlyEntity> list) {
baseDao.insertBatchEntity(list);
}
} }

5
epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml

@ -175,6 +175,11 @@ dynamic:
url: @datasource.druid.partyMember.url@ url: @datasource.druid.partyMember.url@
username: @datasource.druid.partyMember.username@ username: @datasource.druid.partyMember.username@
password: @datasource.druid.partyMember.password@ password: @datasource.druid.partyMember.password@
epmetHeart:
driver-class-name: com.mysql.cj.jdbc.Driver
url: @datasource.druid.epmetHeart.url@
username: @datasource.druid.epmetHeart.username@
password: @datasource.druid.epmetHeart.password@
thread: thread:
# 线程池配置 # 线程池配置

62
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexServiceAblityGridMonthlyDao.xml

@ -132,4 +132,66 @@
AND m.CUSTOMER_ID =#{customerId} AND m.CUSTOMER_ID =#{customerId}
AND m.MONTH_ID =#{monthId} AND m.MONTH_ID =#{monthId}
</select> </select>
<!-- 查询出所有的网格,初始化好 服务能力-网格相关事实表 各个指标值赋值为0 -->
<select id="initAllGridList" parameterType="java.lang.String" resultType="com.epmet.entity.evaluationindex.indexcoll.FactIndexServiceAblityGridMonthlyEntity">
SELECT
scg.CUSTOMER_ID,
scg.PARENT_AGENCY_ID AS agencyId,
scg.GRID_ID,
null as MONTH_ID,
NULL AS QUARTER_ID,
null as YEAR_ID,
0 AS ACTIVITY_COUNT,
0 AS VOLUNTEER_RATIO,
0 AS PARTY_VOLUNTEER_RATIO
FROM
screen_customer_grid scg
WHERE
DEL_FLAG = 0
AND CUSTOMER_ID = #{customerId}
</select>
<!-- 批量插入网格相关-服务能力指标表 -->
<insert id="insertBatchEntity" parameterType="map">
insert into fact_index_service_ablity_grid_monthly
(
ID,
CUSTOMER_ID,
AGENCY_ID,
GRID_ID,
MONTH_ID,
QUARTER_ID,
YEAR_ID,
ACTIVITY_COUNT,
VOLUNTEER_RATIO,
PARTY_VOLUNTEER_RATIO,
DEL_FLAG,
REVISION,
CREATED_BY,
CREATED_TIME,
UPDATED_BY,
UPDATED_TIME
) values
<foreach collection="list" item="item" index="index" separator=",">
(
(SELECT REPLACE(UUID(), '-', '') AS id),
#{item.customerId},
#{item.agencyId},
#{item.gridId},
#{item.monthId},
#{item.quarterId},
#{item.yearId},
#{item.activityCount},
#{item.volunteerRatio},
#{item.partyVolunteerRatio},
0,
0,
'APP_USER',
now(),
'APP_USER',
now()
)
</foreach>
</insert>
</mapper> </mapper>

21
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/heart/ActInfoDao.xml

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.heart.ActInfoDao">
<!-- 查询这个月,各个网格举办的活动次数 活动状态已结束并且实际结束时间在评价周期内的 -->
<select id="selectActGroupByGridId" parameterType="map" resultType="java.util.Map">
SELECT
ai.SPONSOR_ID,
count( 1 ) AS totalAct
FROM
act_info ai
WHERE
ai.DEL_FLAG = '0'
AND ai.ACT_STATUS = 'finished'
AND ai.SPONSOR_TYPE = 'grid'
and ai.CUSTOMER_ID=#{customerId}
AND DATE_FORMAT(ai.ACTUAL_END_TIME,'%Y%m') = #{monthId}
GROUP BY
ai.SPONSOR_ID
</select>
</mapper>
Loading…
Cancel
Save