Browse Source

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

master
jianjun 4 years ago
parent
commit
7d6d4a47d1
  1. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java
  2. 4
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java
  3. 31
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ShiBeiICJobController.java
  4. 14
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ic/IcPrivateDeploySupportProjectTask.java
  5. 33
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ic/IcPrivateDeploySupportUserPointTask.java
  6. 5
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcUserChangeDetailedDTO.java
  7. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcUserChangeDetailedEntity.java
  8. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  9. 16
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserTransferRecordServiceImpl.java
  10. 3
      epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.24__alter_change_detailed.sql

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

@ -23,6 +23,7 @@ import com.epmet.dto.user.result.MidPatrolDetailResult;
import com.epmet.dto.user.result.MidPatrolRecordResult; import com.epmet.dto.user.result.MidPatrolRecordResult;
import com.epmet.feign.impl.DataStatisticalOpenFeignClientFallBackFactory; import com.epmet.feign.impl.DataStatisticalOpenFeignClientFallBackFactory;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
@ -362,6 +363,6 @@ public interface DataStatisticalOpenFeignClient {
* @author LiuJanJun * @author LiuJanJun
* @date 2022/1/18 4:37 下午 * @date 2022/1/18 4:37 下午
*/ */
@PostMapping("/data/stats/shibeiICJob/userPointAndProjectStatus") @PostMapping("/data/stats/shibeiICJob/userPointAndProjectStatus/{bizType}")
Result userPointAndProjectStatus(@RequestBody ExtractOriginFormDTO formDTO); Result userPointAndProjectStatus(@PathVariable("bizType") String biztype,@RequestBody ExtractOriginFormDTO formDTO);
} }

4
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java

@ -341,7 +341,7 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp
} }
@Override @Override
public Result userPointAndProjectStatus(ExtractOriginFormDTO formDTO) { public Result userPointAndProjectStatus(String biztype,ExtractOriginFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "userPointAndProjectStatus", formDTO); return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "userPointAndProjectStatus", biztype,formDTO);
} }
} }

31
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ShiBeiICJobController.java

@ -2,6 +2,7 @@ package com.epmet.controller;
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.enums.BizTypeEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.redis.RedisUtils;
@ -15,10 +16,7 @@ import com.epmet.service.evaluationindex.extract.toscreen.ScreenGrassrootsGovern
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.List; import java.util.List;
@ -38,8 +36,8 @@ public class ShiBeiICJobController {
@Autowired @Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
@PostMapping("userPointAndProjectStatus") @PostMapping("userPointAndProjectStatus/{bizType}")
public Result<String> userPointAndProjectStatus(@RequestBody ExtractOriginFormDTO formDTO) { public Result<String> userPointAndProjectStatus(@PathVariable("bizType") String bizType, @RequestBody ExtractOriginFormDTO formDTO) {
if (StringUtils.isBlank(formDTO.getCustomerId())){ if (StringUtils.isBlank(formDTO.getCustomerId())){
return new Result<String>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"参数错误cid不能为空"); return new Result<String>().error(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"参数错误cid不能为空");
} }
@ -48,23 +46,30 @@ public class ShiBeiICJobController {
if (StringUtils.isNotBlank(formDTO.getStartDate()) && StringUtils.isNotBlank(formDTO.getEndDate())) { if (StringUtils.isNotBlank(formDTO.getStartDate()) && StringUtils.isNotBlank(formDTO.getEndDate())) {
List<String> daysBetween = DateUtils.getDaysBetween(formDTO.getStartDate(), formDTO.getEndDate()); List<String> daysBetween = DateUtils.getDaysBetween(formDTO.getStartDate(), formDTO.getEndDate());
daysBetween.forEach(d -> { daysBetween.forEach(d -> {
this.extractUserPointData(formDTO.getCustomerId(), d); executeMethod(bizType, formDTO.getCustomerId(), d);
this.agencyProjectStats(formDTO.getCustomerId(), formDTO.getDateId());
result.add(d); result.add(d);
redisUtils.hSet(RedisKeys.getBackDoorbizExcuteResult("userPointAndProjectStatus"), formDTO.getCustomerId(), result, 3 * 24 * 60 * 60L); redisUtils.hSet(RedisKeys.getBackDoorbizExcuteResult("userPointAndProjectStatus-"+bizType), formDTO.getCustomerId(), result, 3 * 24 * 60 * 60L);
}); });
} else { } else {
if (StringUtils.isBlank(formDTO.getDateId())){ if (StringUtils.isBlank(formDTO.getDateId())){
formDTO.setDateId(DateUtils.getBeforeNDay(NumConstant.ONE)); formDTO.setDateId(DateUtils.getBeforeNDay(NumConstant.ONE));
} }
this.extractUserPointData(formDTO.getCustomerId(), formDTO.getDateId()); executeMethod(bizType, formDTO.getCustomerId(), formDTO.getDateId());
this.agencyProjectStats(formDTO.getCustomerId(), formDTO.getDateId());
result.add(formDTO.getDateId()); result.add(formDTO.getDateId());
redisUtils.hSet(RedisKeys.getBackDoorbizExcuteResult("userPointAndProjectStatus"), formDTO.getCustomerId(), result, 3 * 24 * 60 * 60L); redisUtils.hSet(RedisKeys.getBackDoorbizExcuteResult("userPointAndProjectStatus-"+bizType), formDTO.getCustomerId(), result, 3 * 24 * 60 * 60L);
} }
long end = System.currentTimeMillis(); long end = System.currentTimeMillis();
long l = (end - start) / 1000; long l = (end - start) / 1000;
return new Result<String>().ok("userPointAndProjectStatus耗时" + l + "s"); return new Result<String>().ok("userPointAndProjectStatus耗时-"+bizType + l + "s");
}
private void executeMethod(String bizType, String customerId, String d) {
if (bizType.equals(BizTypeEnum.USER.getType())){
this.extractUserPointData(customerId, d);
}
if (bizType.equals(BizTypeEnum.PROJECT.getType())) {
this.agencyProjectStats(customerId, d);
}
} }
/** /**

14
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/IcPrivateDeploySupportTask.java → epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ic/IcPrivateDeploySupportProjectTask.java

@ -1,21 +1,23 @@
package com.epmet.task; package com.epmet.task.ic;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.enums.BizTypeEnum;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.feign.DataStatisticalOpenFeignClient; import com.epmet.feign.DataStatisticalOpenFeignClient;
import com.epmet.task.ITask;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
/** /**
* desc数字社区私有化部署 任务之一还有autoEvaluateDemandTaskstatsDemandTaskdailyStatisticalVoteTask * desc数字社区私有化部署 任务之一还有autoEvaluateDemandTaskstatsDemandTaskdailyStatisticalVoteTask,IcPrivateDeploySupportUserPointTask
*/ */
@Slf4j @Slf4j
@Component("icPrivateDeploySupportTask") @Component("icPrivateDeploySupportProjectTask")
public class IcPrivateDeploySupportTask implements ITask { public class IcPrivateDeploySupportProjectTask implements ITask {
@Autowired @Autowired
private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient; private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient;
@ -25,7 +27,7 @@ public class IcPrivateDeploySupportTask implements ITask {
if (StringUtils.isNotBlank(params)) { if (StringUtils.isNotBlank(params)) {
formDTO = JSON.parseObject(params, ExtractOriginFormDTO.class); formDTO = JSON.parseObject(params, ExtractOriginFormDTO.class);
} }
Result result = dataStatisticalOpenFeignClient.userPointAndProjectStatus(formDTO); Result result = dataStatisticalOpenFeignClient.userPointAndProjectStatus(BizTypeEnum.PROJECT.getType(), formDTO);
log.info("IcPrivateDeploySupportTask excute end,param:{},result:{}",params,result); log.info("icPrivateDeploySupportProjectTask excute end,param:{},result:{}",params,result);
} }
} }

33
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/ic/IcPrivateDeploySupportUserPointTask.java

@ -0,0 +1,33 @@
package com.epmet.task.ic;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.enums.BizTypeEnum;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.feign.DataStatisticalOpenFeignClient;
import com.epmet.task.ITask;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* desc数字社区私有化部署 任务之一还有autoEvaluateDemandTaskstatsDemandTaskdailyStatisticalVoteTask,icPrivateDeploySupportProjectTask
*/
@Slf4j
@Component("icPrivateDeploySupportUserPointTask")
public class IcPrivateDeploySupportUserPointTask implements ITask {
@Autowired
private DataStatisticalOpenFeignClient dataStatisticalOpenFeignClient;
@Override
public void run(String params) {
ExtractOriginFormDTO formDTO = new ExtractOriginFormDTO();
if (StringUtils.isNotBlank(params)) {
formDTO = JSON.parseObject(params, ExtractOriginFormDTO.class);
}
Result result = dataStatisticalOpenFeignClient.userPointAndProjectStatus(BizTypeEnum.USER.getType(), formDTO);
log.info("icPrivateDeploySupportUserPointTask excute end,param:{},result:{}",params,result);
}
}

5
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcUserChangeDetailedDTO.java

@ -49,6 +49,11 @@ public class IcUserChangeDetailedDTO implements Serializable {
*/ */
private String icUserChangeRecordId; private String icUserChangeRecordId;
/**
* 组织的所有上级Id
*/
private String pids;
/** /**
* 组织Id * 组织Id
*/ */

5
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcUserChangeDetailedEntity.java

@ -46,6 +46,11 @@ public class IcUserChangeDetailedEntity extends BaseEpmetEntity {
*/ */
private String icUserChangeRecordId; private String icUserChangeRecordId;
/**
* 组织的所有上级Id
*/
private String pids;
/** /**
* 组织Id * 组织Id
*/ */

7
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

@ -40,6 +40,7 @@ import com.epmet.commons.tools.redis.RedisKeys;
import com.epmet.commons.tools.redis.RedisUtils; import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis; import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache; import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.security.dto.TokenDto; import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
@ -254,6 +255,10 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
if (!resultList.success()) { if (!resultList.success()) {
throw new RuntimeException("人员新增,获取客户居民类别预警配置表数据失败"); throw new RuntimeException("人员新增,获取客户居民类别预警配置表数据失败");
} }
AgencyInfoCache agencyInfo = CustomerOrgRedis.getAgencyInfo(map.get("AGENCY_ID"));
if (null == agencyInfo) {
throw new EpmetException(String.format("查询组织信息失败%s", map.get("AGENCY_ID")));
}
IcUserChangeDetailedEntity outEntity = null; IcUserChangeDetailedEntity outEntity = null;
for (IcResiCategoryWarnConfigDTO cf : resultList.getData()) { for (IcResiCategoryWarnConfigDTO cf : resultList.getData()) {
if (map.containsKey(cf.getColumnName()) && "1".equals(map.get(cf.getColumnName()))) { if (map.containsKey(cf.getColumnName()) && "1".equals(map.get(cf.getColumnName()))) {
@ -261,6 +266,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
outEntity = new IcUserChangeDetailedEntity(); outEntity = new IcUserChangeDetailedEntity();
outEntity.setCustomerId(tokenDto.getCustomerId()); outEntity.setCustomerId(tokenDto.getCustomerId());
outEntity.setIcUserChangeRecordId(icUserChangeRecordId); outEntity.setIcUserChangeRecordId(icUserChangeRecordId);
outEntity.setPids(agencyInfo.getPids());
outEntity.setAgencyId(map.get("AGENCY_ID")); outEntity.setAgencyId(map.get("AGENCY_ID"));
outEntity.setGridId(map.get("GRID_ID")); outEntity.setGridId(map.get("GRID_ID"));
outEntity.setNeighborHoodId(map.get("VILLAGE_ID")); outEntity.setNeighborHoodId(map.get("VILLAGE_ID"));
@ -399,6 +405,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
//变更明细里边存修改后的新值,是就存1否就存-1 //变更明细里边存修改后的新值,是就存1否就存-1
categoryEntity = new IcUserChangeDetailedEntity(); categoryEntity = new IcUserChangeDetailedEntity();
categoryEntity.setCustomerId(tokenDto.getCustomerId()); categoryEntity.setCustomerId(tokenDto.getCustomerId());
categoryEntity.setPids(entity.getPids());
categoryEntity.setAgencyId(entity.getAgencyId()); categoryEntity.setAgencyId(entity.getAgencyId());
categoryEntity.setGridId(map.containsKey("GRID_ID") ? map.get("GRID_ID") : entity.getGridId()); categoryEntity.setGridId(map.containsKey("GRID_ID") ? map.get("GRID_ID") : entity.getGridId());
categoryEntity.setNeighborHoodId(map.containsKey("VILLAGE_ID") ? map.get("VILLAGE_ID") : entity.getVillageId()); categoryEntity.setNeighborHoodId(map.containsKey("VILLAGE_ID") ? map.get("VILLAGE_ID") : entity.getVillageId());

16
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcUserTransferRecordServiceImpl.java

@ -19,8 +19,11 @@ package com.epmet.service.impl;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.IcResiUserDao; import com.epmet.dao.IcResiUserDao;
import com.epmet.dao.IcUserTransferRecordDao; import com.epmet.dao.IcUserTransferRecordDao;
@ -231,12 +234,24 @@ public class IcUserTransferRecordServiceImpl extends BaseServiceImpl<IcUserTrans
List<IcUserChangeDetailedEntity> list = new ArrayList<>(); List<IcUserChangeDetailedEntity> list = new ArrayList<>();
IcUserChangeDetailedEntity outEntity = null; IcUserChangeDetailedEntity outEntity = null;
IcUserChangeDetailedEntity inEntity = null; IcUserChangeDetailedEntity inEntity = null;
AgencyInfoCache oldAgencyInfo = CustomerOrgRedis.getAgencyInfo(resiUserDTO.getAgencyId());
if (null == oldAgencyInfo) {
throw new EpmetException(String.format("查询组织信息失败%s", resiUserDTO.getAgencyId()));
}
AgencyInfoCache newAgencyInfo = new AgencyInfoCache();
if ("in".equals(formDTO.getType())) {
newAgencyInfo = CustomerOrgRedis.getAgencyInfo(formDTO.getNewAgencyId());
if (null == newAgencyInfo) {
throw new EpmetException(String.format("查询组织信息失败%s", formDTO.getNewAgencyId()));
}
}
for (IcResiCategoryWarnConfigDTO cf : configList) { for (IcResiCategoryWarnConfigDTO cf : configList) {
if ("1".equals(map.get(cf.getColumnName()))) { if ("1".equals(map.get(cf.getColumnName()))) {
//迁出 //迁出
outEntity = new IcUserChangeDetailedEntity(); outEntity = new IcUserChangeDetailedEntity();
outEntity.setCustomerId(formDTO.getCustomerId()); outEntity.setCustomerId(formDTO.getCustomerId());
outEntity.setIcUserChangeRecordId(icUserChangeRecordId); outEntity.setIcUserChangeRecordId(icUserChangeRecordId);
outEntity.setPids(oldAgencyInfo.getPids());
outEntity.setAgencyId(resiUserDTO.getAgencyId()); outEntity.setAgencyId(resiUserDTO.getAgencyId());
outEntity.setGridId(resiUserDTO.getGridId()); outEntity.setGridId(resiUserDTO.getGridId());
outEntity.setNeighborHoodId(resiUserDTO.getVillageId()); outEntity.setNeighborHoodId(resiUserDTO.getVillageId());
@ -254,6 +269,7 @@ public class IcUserTransferRecordServiceImpl extends BaseServiceImpl<IcUserTrans
inEntity = new IcUserChangeDetailedEntity(); inEntity = new IcUserChangeDetailedEntity();
inEntity.setCustomerId(formDTO.getCustomerId()); inEntity.setCustomerId(formDTO.getCustomerId());
inEntity.setIcUserChangeRecordId(icUserChangeRecordId); inEntity.setIcUserChangeRecordId(icUserChangeRecordId);
inEntity.setPids(newAgencyInfo.getPids());
inEntity.setAgencyId(formDTO.getNewAgencyId()); inEntity.setAgencyId(formDTO.getNewAgencyId());
inEntity.setGridId(formDTO.getNewGridId()); inEntity.setGridId(formDTO.getNewGridId());
inEntity.setNeighborHoodId(formDTO.getNewNeighborHoodId()); inEntity.setNeighborHoodId(formDTO.getNewNeighborHoodId());

3
epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.24__alter_change_detailed.sql

@ -0,0 +1,3 @@
ALTER TABLE `ic_user_change_detailed`
ADD COLUMN `PIDS` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT ''Id'' AFTER `IC_USER_CHANGE_RECORD_ID`;
Loading…
Cancel
Save