Browse Source

Merge remote-tracking branch 'remotes/origin/dev_for_shibei_customerid' into develop

dev
jianjun 4 years ago
parent
commit
3a271c37b3
  1. 15
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/CustomerIdConstant.java
  2. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexOriginExtractServiceImpl.java
  3. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java
  4. 3
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateServiceImpl.java
  5. 34
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ShiBeiScreenCollServiceImpl.java
  6. 7
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataPatrolChangeEventListener.java
  7. 14
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java

15
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/CustomerIdConstant.java

@ -0,0 +1,15 @@
package com.epmet.commons.tools.constant;
/**
* desc:
*
* @author: LiuJanJun
* @date: 2021/12/27 10:22 上午
* @version: 1.0
*/
public interface CustomerIdConstant {
/**
* 市北生产-客户ID
*/
String SHI_BEI_CUSTOMER_ID = "b09527201c4409e19d1dbc5e3c3429a1";
}

3
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/dataToIndex/impl/IndexOriginExtractServiceImpl.java

@ -1,6 +1,7 @@
package com.epmet.service.evaluationindex.extract.dataToIndex.impl; package com.epmet.service.evaluationindex.extract.dataToIndex.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.constant.CustomerIdConstant;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.dto.extract.form.ExtractIndexFormDTO; import com.epmet.dto.extract.form.ExtractIndexFormDTO;
@ -67,6 +68,8 @@ public class IndexOriginExtractServiceImpl implements IndexOriginExtractService
log.error("indexOriginExtractAll 获取客户Id为空"); log.error("indexOriginExtractAll 获取客户Id为空");
return; return;
} }
//去除 市北客户id的抽取
customerIds.remove(CustomerIdConstant.SHI_BEI_CUSTOMER_ID);
} }
String finalMonthId = monthId; String finalMonthId = monthId;

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/extract/toscreen/impl/ScreenExtractServiceImpl.java

@ -1,6 +1,7 @@
package com.epmet.service.evaluationindex.extract.toscreen.impl; package com.epmet.service.evaluationindex.extract.toscreen.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.constant.CustomerIdConstant;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.distributedlock.DistributedLock; import com.epmet.commons.tools.distributedlock.DistributedLock;
@ -460,6 +461,11 @@ public class ScreenExtractServiceImpl implements ScreenExtractService {
} catch (Exception e) { } catch (Exception e) {
log.error("项目(事件)数量分析按组织_按月统计失败,参数为{}" + JSON.toJSONString(formDTO), e); log.error("项目(事件)数量分析按组织_按月统计失败,参数为{}" + JSON.toJSONString(formDTO), e);
} }
//去除 市北客户id的抽取
if (CustomerIdConstant.SHI_BEI_CUSTOMER_ID.equals(customerId)){
log.info("===== extractMonthly method end not contains shi bei:{}======", customerId);
return;
}
//此方法保持在最后即可 计算指标分数 todo 优化 手动创建线程池 控制任务数量 //此方法保持在最后即可 计算指标分数 todo 优化 手动创建线程池 控制任务数量
ExecutorService pool = Executors.newSingleThreadExecutor(); ExecutorService pool = Executors.newSingleThreadExecutor();
pool.submit(() -> { pool.submit(() -> {

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

@ -15,7 +15,6 @@ import com.epmet.dto.indexcal.IndexStatisticsFormDTO;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.redis.IndexCalRedis; import com.epmet.redis.IndexCalRedis;
import com.epmet.service.crm.CustomerRelationService; import com.epmet.service.crm.CustomerRelationService;
import com.epmet.service.evaluationindex.extract.dataToIndex.IndexOriginExtractService;
import com.epmet.service.evaluationindex.indexcal.*; import com.epmet.service.evaluationindex.indexcal.*;
import com.epmet.service.evaluationindex.indexcoll.FactIndexCollectService; import com.epmet.service.evaluationindex.indexcoll.FactIndexCollectService;
import com.epmet.util.DimIdGenerator; import com.epmet.util.DimIdGenerator;
@ -59,8 +58,6 @@ public class IndexCalculateServiceImpl implements IndexCalculateService {
private ScreenCustomerAgencyDao screenCustomerAgencyDao; private ScreenCustomerAgencyDao screenCustomerAgencyDao;
@Autowired @Autowired
private CustomerRelationService customerRelationService; private CustomerRelationService customerRelationService;
@Autowired
private IndexOriginExtractService indexOriginExtractService;
@Override @Override
public Boolean indexCalculate(CalculateCommonFormDTO formDTO) { public Boolean indexCalculate(CalculateCommonFormDTO formDTO) {

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

@ -110,7 +110,21 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
} while (deleteNum != NumConstant.ZERO); } while (deleteNum != NumConstant.ZERO);
} }
if (!CollectionUtils.isEmpty(formDTO.getDataList())) { if (!CollectionUtils.isEmpty(formDTO.getDataList())) {
screenPartyUserRankDataDao.batchInsertPartyUserRankData(formDTO.getDataList(), customerId); List<PartyUserRankDataFormDTO> list = new ArrayList<>();
formDTO.getDataList().forEach(item -> {
if (StringUtils.isEmpty(item.getGridId())) {
log.warn("gridId is null,userId:{}", item.getUserId());
return;
}
list.add(item);
if (list.size() == NumConstant.ONE_HUNDRED) {
screenPartyUserRankDataDao.batchInsertPartyUserRankData(list, customerId);
list.clear();
}
});
if (list.size() > NumConstant.ZERO) {
screenPartyUserRankDataDao.batchInsertPartyUserRankData(list, customerId);
}
} }
} }
@ -134,7 +148,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void insertPartyBranchData(PartyBranchDataListFormDTO formDTO, String customerId) { public void insertPartyBranchData(PartyBranchDataListFormDTO formDTO, String customerId) {
if (StringUtils.isEmpty(formDTO.getMonthId()) || formDTO.getMonthId().length() != NumConstant.SIX) { if (StringUtils.isEmpty(formDTO.getMonthId()) || formDTO.getMonthId().length() != NumConstant.SIX) {
throw new RenException("monthId格式应为: yyyyMM,当前传入:"+formDTO.getMonthId()); throw new RenException("monthId格式应为: yyyyMM,当前传入:" + formDTO.getMonthId());
} }
if (formDTO.getIsFirst()) { if (formDTO.getIsFirst()) {
int deleteNum; int deleteNum;
@ -152,7 +166,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void insertOrgRankData(OrgRankDataListFormDTO formDTO, String customerId) { public void insertOrgRankData(OrgRankDataListFormDTO formDTO, String customerId) {
if (StringUtils.isEmpty(formDTO.getMonthId()) || formDTO.getMonthId().length() != NumConstant.SIX) { if (StringUtils.isEmpty(formDTO.getMonthId()) || formDTO.getMonthId().length() != NumConstant.SIX) {
throw new RenException("monthId格式应为: yyyyMM,当前传入:"+formDTO.getMonthId()); throw new RenException("monthId格式应为: yyyyMM,当前传入:" + formDTO.getMonthId());
} }
if (formDTO.getIsFirst()) { if (formDTO.getIsFirst()) {
int deleteNum; int deleteNum;
@ -170,7 +184,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void insertGovernRankData(GovernRankDataListFormDTO formDTO, String customerId) { public void insertGovernRankData(GovernRankDataListFormDTO formDTO, String customerId) {
if (StringUtils.isEmpty(formDTO.getMonthId()) || formDTO.getMonthId().length() != NumConstant.SIX) { if (StringUtils.isEmpty(formDTO.getMonthId()) || formDTO.getMonthId().length() != NumConstant.SIX) {
throw new RenException("monthId格式应为: yyyyMM,当前传入:"+formDTO.getMonthId()); throw new RenException("monthId格式应为: yyyyMM,当前传入:" + formDTO.getMonthId());
} }
if (formDTO.getIsFirst()) { if (formDTO.getIsFirst()) {
int deleteNum; int deleteNum;
@ -261,7 +275,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void insertIndexDataMonthly(IndexDataListMonthlyFormDTO formDTO, String customerId) { public void insertIndexDataMonthly(IndexDataListMonthlyFormDTO formDTO, String customerId) {
if (StringUtils.isEmpty(formDTO.getMonthId()) || formDTO.getMonthId().length() != NumConstant.SIX) { if (StringUtils.isEmpty(formDTO.getMonthId()) || formDTO.getMonthId().length() != NumConstant.SIX) {
throw new RenException("monthId格式应为: yyyyMM,当前传入:"+formDTO.getMonthId()); throw new RenException("monthId格式应为: yyyyMM,当前传入:" + formDTO.getMonthId());
} }
if (formDTO.getIsFirst()) { if (formDTO.getIsFirst()) {
int deleteNum; int deleteNum;
@ -359,7 +373,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void insertUserJoin(UserJoinListFormDTO formDTO, String customerId) { public void insertUserJoin(UserJoinListFormDTO formDTO, String customerId) {
if (StringUtils.isEmpty(formDTO.getMonthId()) || formDTO.getMonthId().length() != NumConstant.SIX) { if (StringUtils.isEmpty(formDTO.getMonthId()) || formDTO.getMonthId().length() != NumConstant.SIX) {
throw new RenException("monthId格式应为: yyyyMM,当前传入:"+formDTO.getMonthId()); throw new RenException("monthId格式应为: yyyyMM,当前传入:" + formDTO.getMonthId());
} }
if (formDTO.getIsFirst()) { if (formDTO.getIsFirst()) {
int deleteNum; int deleteNum;
@ -377,7 +391,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
/*String[] lastMonth = this.lastMonthDate(); /*String[] lastMonth = this.lastMonthDate();
// 获取上个月的基本数据 // 获取上个月的基本数据
String moneth = lastMonth[NumConstant.ZERO] + lastMonth[NumConstant.ONE];*/ String moneth = lastMonth[NumConstant.ZERO] + lastMonth[NumConstant.ONE];*/
String monthId= DateUtils.getBeforeNMonthByMonth(1,formDTO.getMonthId()); String monthId = DateUtils.getBeforeNMonthByMonth(1, formDTO.getMonthId());
List<ScreenUserJoinEntity> lastMonthJoinList = screenUserJoinDao.selectLastMonthScreenUserJoinList(customerId, List<ScreenUserJoinEntity> lastMonthJoinList = screenUserJoinDao.selectLastMonthScreenUserJoinList(customerId,
monthId, monthId,
orgIds); orgIds);
@ -386,7 +400,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
List<ScreenUserJoinEntity> curMonthJoinEntityList = new ArrayList<>(); List<ScreenUserJoinEntity> curMonthJoinEntityList = new ArrayList<>();
// 增加率计算 // 增加率计算
if (null != lastMonthJoinList && lastMonthJoinList.size() > NumConstant.ZERO) { if (null != lastMonthJoinList && lastMonthJoinList.size() > NumConstant.ZERO) {
log.info("当前传入的monthId="+formDTO.getMonthId()+";数据集合长度="+formDTO.getDataList()+";当前monthId的上月已有数据集合长度="+lastMonthJoinList.size()); log.info("当前传入的monthId=" + formDTO.getMonthId() + ";数据集合长度=" + formDTO.getDataList() + ";当前monthId的上月已有数据集合长度=" + lastMonthJoinList.size());
// 存在上个月的数据 (本月-上月)/上月 *100 // 存在上个月的数据 (本月-上月)/上月 *100
for (int i = NumConstant.ZERO; i < formDTO.getDataList().size(); i++) { for (int i = NumConstant.ZERO; i < formDTO.getDataList().size(); i++) {
for (int j = NumConstant.ZERO; j < lastMonthJoinList.size(); j++) { for (int j = NumConstant.ZERO; j < lastMonthJoinList.size(); j++) {
@ -403,7 +417,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
} }
} }
} else { } else {
log.info("当前传入的monthId="+formDTO.getMonthId()+";数据集合长度="+formDTO.getDataList()+";当前monthId上月不存在数据。"); log.info("当前传入的monthId=" + formDTO.getMonthId() + ";数据集合长度=" + formDTO.getDataList() + ";当前monthId上月不存在数据。");
// 计算增长率后的 待新增数据 // 计算增长率后的 待新增数据
BigDecimal zero = new BigDecimal(NumConstant.ZERO); BigDecimal zero = new BigDecimal(NumConstant.ZERO);
// 不存在上个月的数据 // 不存在上个月的数据
@ -428,7 +442,7 @@ public class ShiBeiScreenCollServiceImpl implements ShiBeiScreenCollService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Integer initBizOrg(CustomerBizOrgFormDTO formDTO) { public Integer initBizOrg(CustomerBizOrgFormDTO formDTO) {
ValidatorUtils.validateEntity(formDTO); ValidatorUtils.validateEntity(formDTO);
List<ScreenCustomerAgencyEntity> entityList = screenCustomerAgencyDao.selectListAgencyInfo(formDTO.getCustomerId(),null,null); List<ScreenCustomerAgencyEntity> entityList = screenCustomerAgencyDao.selectListAgencyInfo(formDTO.getCustomerId(), null, null);
List<ScreenCustomerBizOrgEntity> list = new ArrayList<>(); List<ScreenCustomerBizOrgEntity> list = new ArrayList<>();
if (CollectionUtils.isEmpty(entityList)) { if (CollectionUtils.isEmpty(entityList)) {
return 0; return 0;

7
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataPatrolChangeEventListener.java

@ -3,6 +3,7 @@ package com.epmet.opendata.mq.listener;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.epmet.commons.rocketmq.constants.MQUserPropertys; import com.epmet.commons.rocketmq.constants.MQUserPropertys;
import com.epmet.commons.rocketmq.messages.StaffPatrolMQMsg; import com.epmet.commons.rocketmq.messages.StaffPatrolMQMsg;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.distributedlock.DistributedLock; import com.epmet.commons.tools.distributedlock.DistributedLock;
import com.epmet.commons.tools.exception.ExceptionUtils; import com.epmet.commons.tools.exception.ExceptionUtils;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
@ -70,10 +71,10 @@ public class OpenDataPatrolChangeEventListener implements MessageListenerConcurr
logger.info("【开放数据事件监听器】-巡查记录信息变更-收到消息内容:{}, 操作:{}", msg, tags); logger.info("【开放数据事件监听器】-巡查记录信息变更-收到消息内容:{}, 操作:{}", msg, tags);
StaffPatrolMQMsg msgObj = JSON.parseObject(msg, StaffPatrolMQMsg.class); StaffPatrolMQMsg msgObj = JSON.parseObject(msg, StaffPatrolMQMsg.class);
//只推送平阴数据 todo 先干掉测试 //只推送平阴数据
/*if (!StrConstant.PY_CUSTOMER.equals(msgObj.getCustomerId())) { if (!StrConstant.PY_CUSTOMER.equals(msgObj.getCustomerId())) {
return; return;
}*/ }
if (msgObj == null) { if (msgObj == null) {
log.warn("consumeMessage msg body is blank"); log.warn("consumeMessage msg body is blank");
return; return;

14
epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/service/impl/BaseGridDailyworkServiceImpl.java

@ -151,7 +151,19 @@ public class BaseGridDailyworkServiceImpl extends BaseServiceImpl<BaseGridDailyw
entity.setKeyAreaType(StrConstant.EPMETY_STR); entity.setKeyAreaType(StrConstant.EPMETY_STR);
entity.setRegionScale(StrConstant.EPMETY_STR); entity.setRegionScale(StrConstant.EPMETY_STR);
entity.setIsKeyareaState(StrConstant.EPMETY_STR); entity.setIsKeyareaState(StrConstant.EPMETY_STR);
entity.setIsKeyPeopleLocate(NumConstant.ONE == record.getIsKeyPeopleLocate()?"Y":"N");
Integer isKeyPeopleLocate = record.getIsKeyPeopleLocate();
if (isKeyPeopleLocate != null){
String value = "";
if (NumConstant.ONE == isKeyPeopleLocate){
value = "Y";
}else if (NumConstant.ZERO == isKeyPeopleLocate){
value = "N";
}
entity.setIsKeyPeopleLocate(value);
}
entity.setKeyPeopleStatus(record.getKeyPeopleStatus()); entity.setKeyPeopleStatus(record.getKeyPeopleStatus());
entity.setHappenPlace(record.getAddress()); entity.setHappenPlace(record.getAddress());
entity.setLng(record.getLongitude()); entity.setLng(record.getLongitude());

Loading…
Cancel
Save