Browse Source

Merge branch 'develop' of http://git.elinkit.com.cn:7070/r/epmet-cloud into release_temp

dev
jianjun 4 years ago
parent
commit
c5ccf7e380
  1. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ApplicationFailedEventListener.java
  2. 3
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ApplicationReadyEventListener.java
  3. 13
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/DingDingRobotConstant.java
  4. 7
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ThreadLocalConstant.java
  5. 39
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/EpmetBaseRequestInterceptor.java
  6. 11
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/FeignHystrixConcurrencyStrategy.java
  7. 28
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/ResultDataResolver.java
  8. 1
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/GlobalFilter.java
  9. 17
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/resolver/LoginUserHandlerMethodArgumentResolver.java
  10. 2
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelPoiUtils.java
  11. 19
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/YuShanSysApiService.java
  12. 1
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/DataSourceConstant.java
  13. 39
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/DataCheckDTO.java
  14. 3
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/DataStatisticalOpenFeignClient.java
  15. 5
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/feign/impl/DataStatisticalOpenFeignClientFallBack.java
  16. 24
      epmet-module/data-statistical/data-statistical-server/pom.xml
  17. 19
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenExtractDailyController.java
  18. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenProjectDataDao.java
  19. 42
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ProjectDataService.java
  20. 103
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/impl/ProjectDataServiceImpl.java
  21. 5
      epmet-module/data-statistical/data-statistical-server/src/main/resources/bootstrap.yml
  22. 65
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml
  23. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/EpmetHeartApplication.java
  24. 16
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java
  25. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcCommunitySelfOrganizationService.java
  26. 31
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcCommunitySelfOrganizationServiceImpl.java
  27. 3
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/ScreenExtractTaskService.java
  28. 9
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/ScreenExtractTaskServiceImpl.java
  29. 33
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/DataCheckDailyTask.java
  30. 4
      epmet-module/gov-issue/gov-issue-server/src/main/resources/bootstrap.yml
  31. 14
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java
  32. 13
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java
  33. 15
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java
  34. 1
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportNeighborHoodInfoListener.java
  35. 6
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/redis/IcHouseRedis.java
  36. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/BuildingService.java
  37. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java
  38. 3
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java
  39. 48
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java
  40. 53
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java
  41. 19
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java
  42. 12
      epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml
  43. 4
      epmet-module/gov-project/gov-project-server/src/main/resources/bootstrap.yml
  44. 3
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataProjectChangeEventListener.java
  45. 7
      epmet-module/open-data-worker/open-data-worker-server/src/main/java/com/epmet/opendata/mq/listener/OpenDataStaffChangeEventListener.java
  46. 4
      epmet-module/resi-group/resi-group-server/src/main/resources/bootstrap.yml
  47. 2
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/ResiPartyMemberApplication.java
  48. 14
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/IcPartymemberStyleController.java
  49. 3
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/IcPartymemberStyleService.java
  50. 6
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartymemberStyleServiceImpl.java
  51. 90
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  52. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/enums/IcResiUserTableEnum.java
  53. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcResiImportDynamicExcelListener.java
  54. 5
      epmet-user/epmet-user-server/src/main/java/com/epmet/mq/listener/ICWarnStatsEventListener.java
  55. 102
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java

3
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ApplicationFailedEventListener.java

@ -13,6 +13,7 @@ import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.DingTalkClient; import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.OapiRobotSendRequest; import com.dingtalk.api.request.OapiRobotSendRequest;
import com.dingtalk.api.response.OapiRobotSendResponse; import com.dingtalk.api.response.OapiRobotSendResponse;
import com.epmet.commons.tools.constant.DingDingRobotConstant;
import com.epmet.commons.tools.enums.EnvEnum; import com.epmet.commons.tools.enums.EnvEnum;
import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.commons.tools.utils.SpringContextUtils;
import com.taobao.api.ApiException; import com.taobao.api.ApiException;
@ -56,7 +57,7 @@ public class ApplicationFailedEventListener implements ApplicationListener<Appli
} }
private void sendDingMarkDownMsg(Throwable exception) { private void sendDingMarkDownMsg(Throwable exception) {
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/robot/send?access_token=ffd7c972b0525e249283df1a16b65a8b9d0012601f3a458dfc588c2eac497bb5"); DingTalkClient client = new DefaultDingTalkClient(DingDingRobotConstant.DEPLOY_ROBOT);
OapiRobotSendRequest request = new OapiRobotSendRequest(); OapiRobotSendRequest request = new OapiRobotSendRequest();
request.setMsgtype("markdown"); request.setMsgtype("markdown");
OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown(); OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown();

3
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ApplicationReadyEventListener.java

@ -13,6 +13,7 @@ import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.DingTalkClient; import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.OapiRobotSendRequest; import com.dingtalk.api.request.OapiRobotSendRequest;
import com.dingtalk.api.response.OapiRobotSendResponse; import com.dingtalk.api.response.OapiRobotSendResponse;
import com.epmet.commons.tools.constant.DingDingRobotConstant;
import com.epmet.commons.tools.enums.EnvEnum; import com.epmet.commons.tools.enums.EnvEnum;
import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.commons.tools.utils.SpringContextUtils;
import com.taobao.api.ApiException; import com.taobao.api.ApiException;
@ -57,7 +58,7 @@ public class ApplicationReadyEventListener implements ApplicationListener<Applic
} }
private void sendDingMarkDownMsg() { private void sendDingMarkDownMsg() {
DingTalkClient client = new DefaultDingTalkClient("https://oapi.dingtalk.com/robot/send?access_token=ffd7c972b0525e249283df1a16b65a8b9d0012601f3a458dfc588c2eac497bb5"); DingTalkClient client = new DefaultDingTalkClient(DingDingRobotConstant.DEPLOY_ROBOT);
OapiRobotSendRequest request = new OapiRobotSendRequest(); OapiRobotSendRequest request = new OapiRobotSendRequest();
request.setMsgtype("markdown"); request.setMsgtype("markdown");
OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown(); OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown();

13
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/DingDingRobotConstant.java

@ -12,4 +12,17 @@ public interface DingDingRobotConstant {
*/ */
String V3_ROBOT_URL="https://oapi.dingtalk.com/robot/send?access_token=75e9ab857536f3018baa09009646876edbd263d07521a1a22eedfc3852623614"; String V3_ROBOT_URL="https://oapi.dingtalk.com/robot/send?access_token=75e9ab857536f3018baa09009646876edbd263d07521a1a22eedfc3852623614";
String V3_ROBOT_SECRET="SECdc8d3fb6780faa919f38fd43783f76d111255036c3b5bdcbc086dff023ee84d5"; String V3_ROBOT_SECRET="SECdc8d3fb6780faa919f38fd43783f76d111255036c3b5bdcbc086dff023ee84d5";
/**
* 产品后端开发小组- 部署成功通知这个已废弃改为DEPLOY_ROBOT
*/
// String BACKEND_DEV_GROUP_DEPLOY="https://oapi.dingtalk.com/robot/send?access_token=ffd7c972b0525e249283df1a16b65a8b9d0012601f3a458dfc588c2eac497bb5";
/**
* 开发测试-报警群的服务监控助理机器人
*/
String DEPLOY_ROBOT="https://oapi.dingtalk.com/robot/send?access_token=5dfbde0c814a43d72e3e7f02385db87df1fc8231cff30728d8df1d1b58a00998";
String SELF_ROBOT_URL="https://oapi.dingtalk.com/robot/send?access_token=ffd7c972b0525e249283df1a16b65a8b9d0012601f3a458dfc588c2eac497bb5";
String SELF_ROBOT_SECRET=null;
} }

7
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ThreadLocalConstant.java

@ -1,5 +1,7 @@
package com.epmet.commons.tools.constant; package com.epmet.commons.tools.constant;
import java.util.Map;
/** /**
* ThreadLocal常亮 * ThreadLocal常亮
*/ */
@ -19,4 +21,9 @@ public class ThreadLocalConstant {
* 用于本次的获取请求参数 * 用于本次的获取请求参数
*/ */
public static final ThreadLocal<String> requestParam = new ThreadLocal(); public static final ThreadLocal<String> requestParam = new ThreadLocal();
/**
* 可被子线程继承的追加的request headers
*/
public static final InheritableThreadLocal<Map<String, String>> inheritableAdditionalHeaders = new InheritableThreadLocal<>();
} }

39
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/EpmetBaseRequestInterceptor.java

@ -1,24 +1,55 @@
package com.epmet.commons.tools.feign; package com.epmet.commons.tools.feign;
import com.epmet.commons.tools.constant.ThreadLocalConstant;
import feign.RequestInterceptor; import feign.RequestInterceptor;
import feign.RequestTemplate; import feign.RequestTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
public class EpmetBaseRequestInterceptor implements RequestInterceptor { public class EpmetBaseRequestInterceptor implements RequestInterceptor {
private static final Logger log = LoggerFactory.getLogger(EpmetBaseRequestInterceptor.class);
@Override @Override
public void apply(RequestTemplate template) { public void apply(RequestTemplate template) {
// 自定义追加的request header,可被子线程继承拷贝
Map<String, String> inheritableAdditionalHeaders = FeignHystrixConcurrencyStrategy.hystrixAdditionHeaders.get();
Map<String, String> requestHeaders = getHeadersFromRequest();
log.info("EpmetBaseRequestInterceptor#apply#inheritableAdditionalHeaders:"+inheritableAdditionalHeaders);
if (requestHeaders != null && requestHeaders.size() > 0) {
for (Map.Entry<String, String> kv : requestHeaders.entrySet()) {
template.header(kv.getKey(), kv.getValue());
}
}
if (inheritableAdditionalHeaders != null && inheritableAdditionalHeaders.size() > 0) {
for (Map.Entry<String, String> kv : inheritableAdditionalHeaders.entrySet()) {
template.header(kv.getKey(), kv.getValue());
}
}
}
/**
* 从header里面获取headers
*/
public HashMap<String, String> getHeadersFromRequest() {
HashMap<String, String> headers = new HashMap<>();
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
if (requestAttributes == null) { if (requestAttributes == null) {
return; return null;
} }
HttpServletRequest request = ((ServletRequestAttributes) requestAttributes).getRequest(); HttpServletRequest request = ((ServletRequestAttributes) requestAttributes).getRequest();
Enumeration<String> headerNames = request.getHeaderNames(); Enumeration<String> headerNames = request.getHeaderNames();
if (headerNames != null) { if (headerNames != null) {
@ -27,9 +58,11 @@ public class EpmetBaseRequestInterceptor implements RequestInterceptor {
Enumeration<String> values = request.getHeaders(name); Enumeration<String> values = request.getHeaders(name);
while (values.hasMoreElements()) { while (values.hasMoreElements()) {
String value = values.nextElement(); String value = values.nextElement();
template.header(name, value); headers.put(name, value);
} }
} }
} }
return headers;
} }
} }

11
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/FeignHystrixConcurrencyStrategy.java

@ -1,5 +1,6 @@
package com.epmet.commons.tools.feign; package com.epmet.commons.tools.feign;
import com.epmet.commons.tools.constant.ThreadLocalConstant;
import com.netflix.hystrix.HystrixThreadPoolKey; import com.netflix.hystrix.HystrixThreadPoolKey;
import com.netflix.hystrix.HystrixThreadPoolProperties; import com.netflix.hystrix.HystrixThreadPoolProperties;
import com.netflix.hystrix.strategy.HystrixPlugins; import com.netflix.hystrix.strategy.HystrixPlugins;
@ -17,6 +18,7 @@ import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import java.util.Map;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.ThreadPoolExecutor;
@ -35,6 +37,7 @@ import java.util.concurrent.TimeUnit;
@Component @Component
public class FeignHystrixConcurrencyStrategy extends HystrixConcurrencyStrategy { public class FeignHystrixConcurrencyStrategy extends HystrixConcurrencyStrategy {
public static final ThreadLocal<Map<String, String>> hystrixAdditionHeaders = new ThreadLocal<>();
private static final Logger log = LoggerFactory.getLogger(FeignHystrixConcurrencyStrategy.class); private static final Logger log = LoggerFactory.getLogger(FeignHystrixConcurrencyStrategy.class);
private HystrixConcurrencyStrategy delegate; private HystrixConcurrencyStrategy delegate;
@ -74,8 +77,9 @@ public class FeignHystrixConcurrencyStrategy extends HystrixConcurrencyStrategy
@Override @Override
public <T> Callable<T> wrapCallable(Callable<T> callable) { public <T> Callable<T> wrapCallable(Callable<T> callable) {
Map<String, String> inheritableAdditionalHeaders = ThreadLocalConstant.inheritableAdditionalHeaders.get();
RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes(); RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
return new WrappedCallable<>(callable, requestAttributes); return new WrappedCallable<>(callable, requestAttributes, inheritableAdditionalHeaders);
} }
@Override @Override
@ -105,15 +109,18 @@ public class FeignHystrixConcurrencyStrategy extends HystrixConcurrencyStrategy
static class WrappedCallable<T> implements Callable<T> { static class WrappedCallable<T> implements Callable<T> {
private final Callable<T> target; private final Callable<T> target;
private final RequestAttributes requestAttributes; private final RequestAttributes requestAttributes;
private final Map<String, String> inheritableAdditionalHeaders;
public WrappedCallable(Callable<T> target, RequestAttributes requestAttributes) { public WrappedCallable(Callable<T> target, RequestAttributes requestAttributes, Map<String, String> inheritableAdditionalHeaders) {
this.target = target; this.target = target;
this.requestAttributes = requestAttributes; this.requestAttributes = requestAttributes;
this.inheritableAdditionalHeaders = inheritableAdditionalHeaders;
} }
@Override @Override
public T call() throws Exception { public T call() throws Exception {
try { try {
hystrixAdditionHeaders.set(inheritableAdditionalHeaders);
RequestContextHolder.setRequestAttributes(requestAttributes); RequestContextHolder.setRequestAttributes(requestAttributes);
return target.call(); return target.call();
} finally { } finally {

28
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/feign/ResultDataResolver.java

@ -1,5 +1,6 @@
package com.epmet.commons.tools.feign; package com.epmet.commons.tools.feign;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.RenException; import com.epmet.commons.tools.exception.RenException;
@ -13,6 +14,8 @@ import org.slf4j.LoggerFactory;
*/ */
public interface ResultDataResolver { public interface ResultDataResolver {
Logger logger = LoggerFactory.getLogger(ResultDataResolver.class);
/** /**
* @Description 获取Result种的data如果失败(返回result为null或者result.success为false)那么返回null * @Description 获取Result种的data如果失败(返回result为null或者result.success为false)那么返回null
* @return data数据 * @return data数据
@ -20,7 +23,6 @@ public interface ResultDataResolver {
* @date 2021.06.07 22:45 * @date 2021.06.07 22:45
*/ */
default <R> R getResultDataOrReturnNull(Result<R> result, String targetServiceName) { default <R> R getResultDataOrReturnNull(Result<R> result, String targetServiceName) {
Logger logger = LoggerFactory.getLogger(ResultDataResolver.class);
if (result == null) { if (result == null) {
logger.error("调用{}服务发生错误,返回Result为null", targetServiceName); logger.error("调用{}服务发生错误,返回Result为null", targetServiceName);
return null; return null;
@ -49,22 +51,24 @@ public interface ResultDataResolver {
// 考虑到:上游服务抛出的异常代码和错误消息并不一定适用于当前服务,并且上有服务的错误消息弹出之后可能给用户造成困扰, // 考虑到:上游服务抛出的异常代码和错误消息并不一定适用于当前服务,并且上有服务的错误消息弹出之后可能给用户造成困扰,
// 因此,当前服务抛出异常的时候,不再继承上游服务返回的错误码和错误消息 // 因此,当前服务抛出异常的时候,不再继承上游服务返回的错误码和错误消息
/*if (!result.success()) { if (!result.success()) {
Integer finalErrorCode = errorCode == null ? result.getCode() : errorCode; Integer finalErrorCode = errorCode == null ? result.getCode() : errorCode;
String finalErrorInternalMsg = StringUtils.isBlank(errorInternalMsg) ? result.getInternalMsg() : errorInternalMsg; String finalErrorInternalMsg = StringUtils.isBlank(errorInternalMsg) ? result.getInternalMsg() : errorInternalMsg;
throw new RenException(finalErrorCode, finalErrorInternalMsg, showMsg, RenException.MessageMode.CODE_INTERNAL_EXTERNAL); throw new RenException(finalErrorCode, finalErrorInternalMsg, showMsg, RenException.MessageMode.CODE_INTERNAL_EXTERNAL);
}*/
if (!result.success()) {
// 如果不通过参数指定code,则默认使用8000服务器开小差
Integer finalErrorCode = errorCode == null ? EpmetErrorCode.SERVER_ERROR.getCode() : errorCode;
String finalErrorInternalMsg = StringUtils.isBlank(errorInternalMsg) ? "" : errorInternalMsg;
String finalShowMsg = StringUtils.isBlank(showMsg) ? "" : showMsg;
throw new EpmetException(finalErrorCode, finalErrorInternalMsg, finalShowMsg);
} }
// if (!result.success()) {
// String j = JSON.toJSONString(result);
// logger.info("远程调用出错,返回结果:{}", j);
//
// // 如果不通过参数指定code,则默认使用8000服务器开小差
// Integer finalErrorCode = errorCode == null ? EpmetErrorCode.SERVER_ERROR.getCode() : errorCode;
// String finalErrorInternalMsg = StringUtils.isBlank(errorInternalMsg) ? "" : errorInternalMsg;
// String finalShowMsg = StringUtils.isBlank(showMsg) ? "" : showMsg;
//
// throw new EpmetException(finalErrorCode, finalErrorInternalMsg, finalShowMsg);
// }
return result.getData(); return result.getData();
} }

1
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/GlobalFilter.java

@ -25,6 +25,7 @@ public class GlobalFilter implements Filter {
ThreadLocalConstant.sqlFilter.remove(); ThreadLocalConstant.sqlFilter.remove();
ThreadLocalConstant.requirePermissionTl.remove(); ThreadLocalConstant.requirePermissionTl.remove();
ThreadLocalConstant.requestParam.remove(); ThreadLocalConstant.requestParam.remove();
ThreadLocalConstant.inheritableAdditionalHeaders.remove();
} }
} }
} }

17
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/security/resolver/LoginUserHandlerMethodArgumentResolver.java

@ -34,6 +34,9 @@ import org.springframework.web.servlet.HandlerMapping;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map; import java.util.Map;
/** /**
@ -80,6 +83,20 @@ public class LoginUserHandlerMethodArgumentResolver implements HandlerMethodArgu
logger.info("【LoginUserHandlerMethodArgumentResolver】请求uri:{}", requestURI); logger.info("【LoginUserHandlerMethodArgumentResolver】请求uri:{}", requestURI);
// todo delete
Iterator<String> headerNames = request.getHeaderNames();
if (headerNames != null) {
HashMap<String, String> hm = new HashMap<>();
while (headerNames.hasNext()) {
String name = headerNames.next();
String[] headerValues = request.getHeaderValues(name);
hm.put(name, String.join(",", headerValues));
}
logger.info("LoginUserHandlerMethodArgumentResolver#resolveArgument:"+hm);
}
//app-client-userId //app-client-userId
String redisKey = request.getHeader(Constant.APP_USER_KEY); String redisKey = request.getHeader(Constant.APP_USER_KEY);
if (StringUtils.isEmpty(redisKey)) { if (StringUtils.isEmpty(redisKey)) {

2
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ExcelPoiUtils.java

@ -255,7 +255,7 @@ public class ExcelPoiUtils {
* @param <T> * @param <T>
* @return * @return
*/ */
private static <T> ExcelImportResult<T> importExcelMore(InputStream inputStream,Integer titleRows, Integer headerRows, Class<T> pojoClass) throws IOException { public static <T> ExcelImportResult<T> importExcelMore(InputStream inputStream,Integer titleRows, Integer headerRows, Class<T> pojoClass) throws IOException {
if (inputStream == null) { if (inputStream == null) {
return null; return null;
} }

19
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/YuShanSysApiService.java

@ -8,12 +8,9 @@ import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.enums.EnvEnum; import com.epmet.commons.tools.enums.EnvEnum;
import com.epmet.commons.tools.enums.ExternalApiEnum; import com.epmet.commons.tools.enums.ExternalApiEnum;
import com.epmet.commons.tools.enums.ExternalServerEnum; import com.epmet.commons.tools.enums.ExternalServerEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
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.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
@ -35,10 +32,17 @@ public class YuShanSysApiService {
* *
* @return * @return
*/ */
@Async // @Async
public void updateUserPoints(String customerId, List<UpdateUserPointsFormDTO> paramList) { public void updateUserPoints(String customerId, List<UpdateUserPointsFormDTO> paramList) {
/*try {
Thread.sleep(1000l);
} catch (InterruptedException e) {
log.error("调用榆山街道发放积分睡眠发生异常,{}",e);
e.printStackTrace();
}*/
if (StringUtils.isBlank(customerId) || CollectionUtils.isEmpty(paramList)) { if (StringUtils.isBlank(customerId) || CollectionUtils.isEmpty(paramList)) {
throw new RenException("参数错误"); log.warn("updateUserPoints 参数错误");
return;
} }
if (!SpecialCustomerOrgConstant.PING_YIN_CUSTOMER_ID.equals(customerId)) { if (!SpecialCustomerOrgConstant.PING_YIN_CUSTOMER_ID.equals(customerId)) {
return; return;
@ -66,14 +70,13 @@ public class YuShanSysApiService {
// formDTO.setMobile("13205302682"); // formDTO.setMobile("13205302682");
Result<String> res = HttpClientManager.getInstance().sendPostByJSON(apiPath, JSON.toJSONString(formDTO)); Result<String> res = HttpClientManager.getInstance().sendPostByJSON(apiPath, JSON.toJSONString(formDTO));
Result result = JSON.parseObject(res.getData(), Result.class); Result result = JSON.parseObject(res.getData(), Result.class);
log.info(String.format("updateUserPoints 入参:%s;返参:%s", JSON.toJSONString(formDTO),JSON.toJSONString(result))); log.info(String.format("updateUserPoints 入参:%s;返参:%s", JSON.toJSONString(formDTO), JSON.toJSONString(result)));
if (!result.success()) { if (!result.success()) {
log.warn("updateUserPoints failed:{}", JSON.toJSONString(result)); log.warn("updateUserPoints failed:{}", JSON.toJSONString(result));
} }
} }
} catch (Exception e) { } catch (Exception e) {
log.warn("updateUserPoints exception 入参:{}", JSON.toJSONString(formDTO)); log.error("updateUserPoints exception 入参:{},异常:{}", JSON.toJSONString(formDTO), e);
throw new RenException(EpmetErrorCode.SERVER_ERROR.getCode(), e.getMessage());
} }
} }
} }

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

@ -12,6 +12,7 @@ public interface DataSourceConstant {
String RESI_GROUP = "resiGroup"; String RESI_GROUP = "resiGroup";
String EPMET_USER = "epmetuser"; String EPMET_USER = "epmetuser";
String EVALUATION_INDEX = "evaluationIndex"; String EVALUATION_INDEX = "evaluationIndex";
String EVALUATION_INDEX_READ = "evaluationIndexRead";
String PARTY_MEMBER = "partyMember"; String PARTY_MEMBER = "partyMember";
String EPMET_HEART="epmetHeart"; String EPMET_HEART="epmetHeart";
String EPMET_POINT = "epmetPoint"; String EPMET_POINT = "epmetPoint";

39
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/dto/screen/result/DataCheckDTO.java

@ -0,0 +1,39 @@
package com.epmet.dto.screen.result;
import lombok.Data;
import java.io.Serializable;
/**
* @Description
* @Author zhaoqifeng
* @Date 2022/3/7 15:56
*/
@Data
public class DataCheckDTO implements Serializable {
private static final long serialVersionUID = -5836567756526658928L;
/**
* 客户ID
*/
private String customerId;
/**
* 客户ID
*/
private String agencyId;
/**
* 客户名
*/
private String agencyName;
/**
* 日期
*/
private String dateId;
/**
* 上报项目数
*/
private String reportCount;
/**
* 项目数
*/
private String count;
}

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

@ -365,4 +365,7 @@ public interface DataStatisticalOpenFeignClient {
@PostMapping("/data/stats/ic/user/category-analysis-daily") @PostMapping("/data/stats/ic/user/category-analysis-daily")
Result statUserCategoryDaily(@RequestBody IcUserCategoryAnalysisDailyFormDTO formDTO); Result statUserCategoryDaily(@RequestBody IcUserCategoryAnalysisDailyFormDTO formDTO);
@PostMapping("/data/stats/screenextract/data_check")
Result dataCheck(@RequestBody ExtractOriginFormDTO formDTO);
} }

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

@ -346,4 +346,9 @@ public class DataStatisticalOpenFeignClientFallBack implements DataStatisticalOp
public Result statUserCategoryDaily(IcUserCategoryAnalysisDailyFormDTO formDTO) { public Result statUserCategoryDaily(IcUserCategoryAnalysisDailyFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "statUserCategoryDaily", formDTO); return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "statUserCategoryDaily", formDTO);
} }
@Override
public Result dataCheck(ExtractOriginFormDTO formDTO) {
return ModuleUtils.feignConError(ServiceConstant.DATA_STATISTICAL_SERVER, "dataCheck", formDTO);
}
} }

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

@ -242,6 +242,12 @@
<datasource.druid.evaluationIndex.username>epmet_evaluation_index_user</datasource.druid.evaluationIndex.username> <datasource.druid.evaluationIndex.username>epmet_evaluation_index_user</datasource.druid.evaluationIndex.username>
<datasource.druid.evaluationIndex.password>EpmEt-db-UsEr</datasource.druid.evaluationIndex.password> <datasource.druid.evaluationIndex.password>EpmEt-db-UsEr</datasource.druid.evaluationIndex.password>
<datasource.druid.evaluationIndex1.url>
<![CDATA[jdbc:mysql://192.168.1.140:3306/epmet_evaluation_index?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.evaluationIndex1.url>
<datasource.druid.evaluationIndex1.username>root</datasource.druid.evaluationIndex1.username>
<datasource.druid.evaluationIndex1.password>root</datasource.druid.evaluationIndex1.password>
<datasource.druid.partyMember.url> <datasource.druid.partyMember.url>
<![CDATA[jdbc:mysql://192.168.1.140:3306/epmet_resi_partymember?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> <![CDATA[jdbc:mysql://192.168.1.140:3306/epmet_resi_partymember?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.partyMember.url> </datasource.druid.partyMember.url>
@ -374,6 +380,12 @@
<datasource.druid.evaluationIndex.username>epmet_evaluation_index_user</datasource.druid.evaluationIndex.username> <datasource.druid.evaluationIndex.username>epmet_evaluation_index_user</datasource.druid.evaluationIndex.username>
<datasource.druid.evaluationIndex.password>EpmEt-db-UsEr</datasource.druid.evaluationIndex.password> <datasource.druid.evaluationIndex.password>EpmEt-db-UsEr</datasource.druid.evaluationIndex.password>
<datasource.druid.evaluationIndex1.url>
<![CDATA[jdbc:mysql://192.168.1.140:3306/epmet_evaluation_index?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.evaluationIndex1.url>
<datasource.druid.evaluationIndex1.username>root</datasource.druid.evaluationIndex1.username>
<datasource.druid.evaluationIndex1.password>root</datasource.druid.evaluationIndex1.password>
<datasource.druid.partyMember.url> <datasource.druid.partyMember.url>
<![CDATA[jdbc:mysql://192.168.1.140:3306/epmet_resi_partymember?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> <![CDATA[jdbc:mysql://192.168.1.140:3306/epmet_resi_partymember?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.partyMember.url> </datasource.druid.partyMember.url>
@ -506,6 +518,12 @@
<datasource.druid.evaluationIndex.username>epmet</datasource.druid.evaluationIndex.username> <datasource.druid.evaluationIndex.username>epmet</datasource.druid.evaluationIndex.username>
<datasource.druid.evaluationIndex.password>elink@833066</datasource.druid.evaluationIndex.password> <datasource.druid.evaluationIndex.password>elink@833066</datasource.druid.evaluationIndex.password>
<datasource.druid.evaluationIndex1.url>
<![CDATA[jdbc:mysql://rm-m5ef9t617j6o5eup7.mysql.rds.aliyuncs.com:3306/epmet_evaluation_index?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.evaluationIndex1.url>
<datasource.druid.evaluationIndex1.username>epmet</datasource.druid.evaluationIndex1.username>
<datasource.druid.evaluationIndex1.password>elink@833066</datasource.druid.evaluationIndex1.password>
<datasource.druid.partyMember.url> <datasource.druid.partyMember.url>
<![CDATA[jdbc:mysql://rm-m5ef9t617j6o5eup7.mysql.rds.aliyuncs.com:3306/epmet_resi_partymember?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> <![CDATA[jdbc:mysql://rm-m5ef9t617j6o5eup7.mysql.rds.aliyuncs.com:3306/epmet_resi_partymember?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.partyMember.url> </datasource.druid.partyMember.url>
@ -634,6 +652,12 @@
<datasource.druid.evaluationIndex.username>epmet_evaluation_index_user</datasource.druid.evaluationIndex.username> <datasource.druid.evaluationIndex.username>epmet_evaluation_index_user</datasource.druid.evaluationIndex.username>
<datasource.druid.evaluationIndex.password>EpmEt-db-UsEr</datasource.druid.evaluationIndex.password> <datasource.druid.evaluationIndex.password>EpmEt-db-UsEr</datasource.druid.evaluationIndex.password>
<datasource.druid.evaluationIndex1.url>
<![CDATA[jdbc:mysql://rm-m5e3vzs2637224wj9.mysql.rds.aliyuncs.com:3306/epmet_evaluation_index?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.evaluationIndex1.url>
<datasource.druid.evaluationIndex1.username>epmet_cloud_viewer</datasource.druid.evaluationIndex1.username>
<datasource.druid.evaluationIndex1.password>EpmEtclOUdvIEwEr@w</datasource.druid.evaluationIndex1.password>
<datasource.druid.partyMember.url> <datasource.druid.partyMember.url>
<![CDATA[jdbc:mysql://rm-m5e3vzs2637224wj9.mysql.rds.aliyuncs.com:3306/epmet_resi_partymember?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]> <![CDATA[jdbc:mysql://rm-m5e3vzs2637224wj9.mysql.rds.aliyuncs.com:3306/epmet_resi_partymember?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=Asia/Shanghai]]>
</datasource.druid.partyMember.url> </datasource.druid.partyMember.url>

19
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/ScreenExtractDailyController.java

@ -5,6 +5,7 @@ import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.extract.form.ExtractOriginFormDTO; import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.dto.extract.form.ExtractScreenFormDTO; import com.epmet.dto.extract.form.ExtractScreenFormDTO;
import com.epmet.service.evaluationindex.extract.toscreen.ScreenExtractService; import com.epmet.service.evaluationindex.extract.toscreen.ScreenExtractService;
import com.epmet.service.evaluationindex.screen.ProjectDataService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
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.PostMapping;
@ -12,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
/** /**
@ -26,6 +28,8 @@ public class ScreenExtractDailyController {
private ScreenExtractService screenExtractService; private ScreenExtractService screenExtractService;
@Autowired @Autowired
private ExecutorService executorService; private ExecutorService executorService;
@Resource
private ProjectDataService projectDataService;
/** /**
* @param extractOriginFormDTO * @param extractOriginFormDTO
@ -59,4 +63,19 @@ public class ScreenExtractDailyController {
return new Result(); return new Result();
} }
/**
* 平阴三个街道上报统计数据正确性校验
*
* @Param formDTO
* @Return {@link Result}
* @Author zhaoqifeng
* @Date 2022/3/7 15:43
*/
@PostMapping("data_check")
public Result dataCheck(@RequestBody ExtractOriginFormDTO formDTO) {
projectDataService.dataCheck(formDTO);
return new Result();
}
} }

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

@ -18,7 +18,9 @@
package com.epmet.dao.evaluationindex.screen; package com.epmet.dao.evaluationindex.screen;
import com.epmet.commons.mybatis.dao.BaseDao; import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.dto.screen.ScreenProjectDataDTO; import com.epmet.dto.screen.ScreenProjectDataDTO;
import com.epmet.dto.screen.result.DataCheckDTO;
import com.epmet.dto.screen.result.GridAndOrgCategoryCountResultDTO; import com.epmet.dto.screen.result.GridAndOrgCategoryCountResultDTO;
import com.epmet.entity.evaluationindex.screen.ScreenProjectDataEntity; import com.epmet.entity.evaluationindex.screen.ScreenProjectDataEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
@ -111,4 +113,13 @@ public interface ScreenProjectDataDao extends BaseDao<ScreenProjectDataEntity> {
@Param("customerId") String customerId, @Param("subCount")Integer subCount, @Param("customerId") String customerId, @Param("subCount")Integer subCount,
@Param("allAgencies") List<GridAndOrgCategoryCountResultDTO> allAgencies); @Param("allAgencies") List<GridAndOrgCategoryCountResultDTO> allAgencies);
/**
* 获取数据比对结果
*
* @Param formDTO
* @Return {@link List< DataCheckDTO>}
* @Author zhaoqifeng
* @Date 2022/3/7 16:00
*/
List<DataCheckDTO> getCheckResult(ExtractOriginFormDTO formDTO);
} }

42
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/screen/ProjectDataService.java

@ -0,0 +1,42 @@
/**
* 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.service.evaluationindex.screen;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.entity.evaluationindex.screen.ScreenProjectDataEntity;
/**
* 中央区-项目数据
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-02-23
*/
public interface ProjectDataService extends BaseService<ScreenProjectDataEntity> {
/**
* 平阴三个街道上报统计数据正确性校验
*
* @Param formDTO
* @Return
* @Author zhaoqifeng
* @Date 2022/3/7 15:44
*/
void dataCheck(ExtractOriginFormDTO formDTO);
}

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

@ -0,0 +1,103 @@
/**
* 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.service.evaluationindex.screen.impl;
import com.alibaba.fastjson.JSON;
import com.dingtalk.api.DefaultDingTalkClient;
import com.dingtalk.api.DingTalkClient;
import com.dingtalk.api.request.OapiRobotSendRequest;
import com.dingtalk.api.response.OapiRobotSendResponse;
import com.epmet.commons.dynamic.datasource.annotation.DataSource;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.DingDingRobotConstant;
import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.DataSourceConstant;
import com.epmet.dao.evaluationindex.screen.ScreenProjectDataDao;
import com.epmet.dto.extract.form.ExtractOriginFormDTO;
import com.epmet.dto.screen.result.DataCheckDTO;
import com.epmet.entity.evaluationindex.screen.ScreenProjectDataEntity;
import com.epmet.service.evaluationindex.screen.ProjectDataService;
import com.epmet.util.DimIdGenerator;
import com.taobao.api.ApiException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* 中央区-项目数据
*
* @author qu qu@elink-cn.com
* @since v1.0.0 2021-02-23
*/
@Slf4j
@Service
@DataSource(value = DataSourceConstant.EVALUATION_INDEX_READ)
public class ProjectDataServiceImpl extends BaseServiceImpl<ScreenProjectDataDao, ScreenProjectDataEntity> implements ProjectDataService {
/**
* 平阴三个街道上报统计数据正确性校验
*
* @param formDTO
* @Param formDTO
* @Return
* @Author zhaoqifeng
* @Date 2022/3/7 15:44
*/
@Override
public void dataCheck(ExtractOriginFormDTO formDTO) {
if (StringUtils.isNotBlank(formDTO.getStartDate()) && StringUtils.isNotBlank(formDTO.getEndDate())) {
formDTO.setDateId(null);
} else {
if (StringUtils.isBlank(formDTO.getDateId())){
formDTO.setDateId(DimIdGenerator.getDateDimId(DateUtils.addDateDays(new Date(), -1)));
}
}
List<DataCheckDTO> list = baseDao.getCheckResult(formDTO);
//群机器人
String url = DingDingRobotConstant.SELF_ROBOT_URL;
DingTalkClient client = new DefaultDingTalkClient(url);
if (CollectionUtils.isNotEmpty(list)) {
//发送钉钉消息
for (DataCheckDTO dto : list) {
OapiRobotSendRequest request = new OapiRobotSendRequest();
request.setMsgtype("markdown");
OapiRobotSendRequest.Markdown markdown = new OapiRobotSendRequest.Markdown();
markdown.setTitle("数据异常");
markdown.setText("数据异常:" + "\n\n" +
"> 所属客户ID:" + dto.getCustomerId() + "\n\n" +
"> 组织ID:" + dto.getAgencyId() + "\n\n" +
"> 组织名称:" + dto.getAgencyName() + "\n\n" +
"> 日期:" + dto.getDateId() + "\n\n" +
"> 上报项目数:" + dto.getReportCount() + "\n\n" +
"> 表中项目数:" + dto.getCount());
request.setMarkdown(markdown);
log.info("robot需要发送的内容为:"+markdown.getText());
try {
OapiRobotSendResponse execute = client.execute(request);
log.info("=====通知结果===>" + JSON.toJSONString(execute));
} catch (ApiException e) {
log.error("sendDingMarkDownMsg exception", e);
}
}
}
}
}

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

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

65
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenProjectDataDao.xml

@ -393,4 +393,69 @@
GROUP BY categoryCode GROUP BY categoryCode
</foreach> </foreach>
</select> </select>
<select id="getCheckResult" resultType="com.epmet.dto.screen.result.DataCheckDTO">
SELECT
CUSTOMER_ID,
AGENCY_ID AS agencyId,
CASE
AGENCY_ID
WHEN '1258587398679126017' THEN
'榆山'
WHEN '1215437824174608386' THEN
'锦水'
WHEN '1234085031077498881' THEN
'孔村'
WHEN 'f8d4a6af53b3fc5991ab1434b6ad39b8' THEN
'东阿镇'
WHEN 'f279343a67653fc20d8333c6b2e4dbee' THEN
'孝直镇'
WHEN 'ea78a8e9252f567517c4a8d60250c714' THEN
'安城镇'
WHEN 'c259c3b1d27f960b9b379fb2886179ba' THEN
'洪范池镇'
WHEN 'd20a7488eedf5bcfd5231c3771bc0e3d' THEN
'玫瑰镇'
ELSE '未知'
END AS agencyName,
PROJECT_TOTAL AS reportCount,
DATE_ID,
(
SELECT
count(*) AS dataCount
FROM
screen_project_data
WHERE
1 = 1
AND CUSTOMER_ID = a.CUSTOMER_ID
AND ALL_PARENT_IDS LIKE CONCAT( '%', a.AGENCY_ID, '%' )
AND DEL_FLAG = '0'
AND DATE_FORMAT( PROJECT_CREATE_TIME, '%Y%m%d' ) &lt;= DATE_ID
GROUP BY
AGENCY_ID
ORDER BY
AGENCY_ID
) AS count
FROM
epmet_data_statistical.fact_agency_project_daily a
WHERE
1 = 1
AND del_flag = '0'
AND customer_id IN ( '2fe0065f70ca0e23ce4c26fca5f1d933', '44876154d10d7cb7affd92000f84f833', '46c55cb862d6d5e6d05d2ab61a1cc07e', '6f203e30de1a65aab7e69c058826cd80' )
AND AGENCY_ID IN ( '1234085031077498881', '1215437824174608386', '1258587398679126017', 'c259c3b1d27f960b9b379fb2886179ba', 'd20a7488eedf5bcfd5231c3771bc0e3d', 'ea78a8e9252f567517c4a8d60250c714', 'f279343a67653fc20d8333c6b2e4dbee', 'f8d4a6af53b3fc5991ab1434b6ad39b8' )
<if test='null != dateId and "" != dateId'>
AND DATE_ID = #{dateId}
</if>
<if test='null != startDate and "" != startDate and null != endDate and "" != endDate'>
AND DATE_ID BETWEEN #{startDate} AND #{endDate}
</if>
GROUP BY
AGENCY_ID,
DATE_ID
HAVING
1 = 1
AND reportCount != count
ORDER BY
AGENCY_ID,
DATE_ID DESC
</select>
</mapper> </mapper>

2
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/EpmetHeartApplication.java

@ -13,6 +13,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableAsync;
/** /**
* 模块 * 模块
@ -24,6 +25,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@EnableDiscoveryClient @EnableDiscoveryClient
@EnableFeignClients @EnableFeignClients
@ServletComponentScan @ServletComponentScan
@EnableAsync
public class EpmetHeartApplication { public class EpmetHeartApplication {
public static void main(String[] args) { public static void main(String[] args) {

16
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/IcCommunitySelfOrganizationController.java

@ -42,6 +42,7 @@ import com.epmet.excel.IcCommunitySelfOrganizationExcel;
import com.epmet.excel.ImportCommunitySelfOrganizationSon; import com.epmet.excel.ImportCommunitySelfOrganizationSon;
import com.epmet.feign.EpmetCommonServiceOpenFeignClient; import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.service.IcCommunitySelfOrganizationService; import com.epmet.service.IcCommunitySelfOrganizationService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -50,6 +51,7 @@ import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -62,6 +64,7 @@ import java.util.Map;
*/ */
@RestController @RestController
@RequestMapping("iccommunityselforganization") @RequestMapping("iccommunityselforganization")
@Slf4j
public class IcCommunitySelfOrganizationController { public class IcCommunitySelfOrganizationController {
@Autowired @Autowired
@ -161,8 +164,19 @@ public class IcCommunitySelfOrganizationController {
if (!result.success()) { if (!result.success()) {
throw new RenException(result.getInternalMsg()); throw new RenException(result.getInternalMsg());
} }
InputStream inputStream = null;
try {
inputStream = file.getInputStream();
}catch (Exception e){
ImportTaskCommonFormDTO input = new ImportTaskCommonFormDTO();
input.setOperatorId(tokenDto.getUserId());
input.setTaskId(result.getData().getTaskId());
input.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL);
commonServiceOpenFeignClient.finishImportTask(input);
log.error("读取文件失败");
}
//2.执行导入程序 //2.执行导入程序
icCommunitySelfOrganizationService.importCommunitySelfOrganization(tokenDto, response, file, result.getData().getTaskId()); icCommunitySelfOrganizationService.importCommunitySelfOrganization(tokenDto, response, inputStream, result.getData().getTaskId());
return new Result(); return new Result();
} }

3
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/IcCommunitySelfOrganizationService.java

@ -33,6 +33,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -157,7 +158,7 @@ public interface IcCommunitySelfOrganizationService extends BaseService<IcCommun
* @author zxc * @author zxc
* @date 2021/11/25 9:03 上午 * @date 2021/11/25 9:03 上午
*/ */
void importCommunitySelfOrganization(TokenDto tokenDto, HttpServletResponse response, MultipartFile file, String taskId) throws IOException; void importCommunitySelfOrganization(TokenDto tokenDto, HttpServletResponse response, InputStream inputStream, String taskId) throws IOException;
List<IcCommunitySelfOrganizationEntity> queryListById(List<String> communityOrgIds); List<IcCommunitySelfOrganizationEntity> queryListById(List<String> communityOrgIds);
} }

31
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/IcCommunitySelfOrganizationServiceImpl.java

@ -30,11 +30,13 @@ import com.epmet.constant.IcCommunitySelfOrganizationConstant;
import com.epmet.constant.UserDemandConstant; import com.epmet.constant.UserDemandConstant;
import com.epmet.constants.ImportTaskConstants; import com.epmet.constants.ImportTaskConstants;
import com.epmet.dao.IcCommunitySelfOrganizationDao; import com.epmet.dao.IcCommunitySelfOrganizationDao;
import com.epmet.dao.IcUserDemandRecDao;
import com.epmet.dto.IcCommunitySelfOrganizationDTO; import com.epmet.dto.IcCommunitySelfOrganizationDTO;
import com.epmet.dto.form.*; import com.epmet.dto.form.*;
import com.epmet.dto.form.demand.ServiceQueryFormDTO; import com.epmet.dto.form.demand.ServiceQueryFormDTO;
import com.epmet.dto.result.CommunitySelfOrganizationListDTO; import com.epmet.dto.result.CommunitySelfOrganizationListDTO;
import com.epmet.dto.result.CommunitySelfOrganizationListResultDTO; import com.epmet.dto.result.CommunitySelfOrganizationListResultDTO;
import com.epmet.dto.result.ServicePointDTO;
import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.dto.result.UploadImgResultDTO;
import com.epmet.dto.result.demand.OptionDTO; import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.entity.IcCommunitySelfOrganizationEntity; import com.epmet.entity.IcCommunitySelfOrganizationEntity;
@ -45,7 +47,6 @@ import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.feign.OssFeignClient; import com.epmet.feign.OssFeignClient;
import com.epmet.service.IcCommunitySelfOrganizationPersonnelService; import com.epmet.service.IcCommunitySelfOrganizationPersonnelService;
import com.epmet.service.IcCommunitySelfOrganizationService; import com.epmet.service.IcCommunitySelfOrganizationService;
import com.epmet.service.IcUserDemandRecService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -66,9 +67,8 @@ import org.springframework.web.multipart.commons.CommonsMultipartFile;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
@ -84,13 +84,12 @@ import static com.epmet.commons.tools.utils.DateUtils.DATE_PATTERN;
*/ */
@Service @Service
@Slf4j @Slf4j
@EnableAsync
public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCommunitySelfOrganizationDao, IcCommunitySelfOrganizationEntity> implements IcCommunitySelfOrganizationService { public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCommunitySelfOrganizationDao, IcCommunitySelfOrganizationEntity> implements IcCommunitySelfOrganizationService {
@Autowired @Autowired
private IcCommunitySelfOrganizationPersonnelService personnelService; private IcCommunitySelfOrganizationPersonnelService personnelService;
@Autowired @Autowired
private IcUserDemandRecService icUserDemandRecService; private IcUserDemandRecDao icUserDemandRecDao;
@Autowired @Autowired
private OssFeignClient ossFeignClient; private OssFeignClient ossFeignClient;
@Autowired @Autowired
@ -306,7 +305,11 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo
throw new RenException(String.format("查询人员{%s}信息失败",tokenDto.getUserId())); throw new RenException(String.format("查询人员{%s}信息失败",tokenDto.getUserId()));
} }
//获取单位积分 //获取单位积分
Map<String, Integer> pointMap = icUserDemandRecService.getServicePoint(tokenDto.getCustomerId(), UserDemandConstant.COMMUNITY_ORG); List<ServicePointDTO> servicePointList = icUserDemandRecDao.getServicePoint(tokenDto.getCustomerId(), UserDemandConstant.COMMUNITY_ORG);
Map<String, Integer> pointMap = new HashMap<>();
if (CollectionUtils.isNotEmpty(servicePointList)){
pointMap = servicePointList.stream().collect(Collectors.toMap(ServicePointDTO::getServerId, ServicePointDTO::getPoint));
}
formDTO.setAgencyId(staffInfo.getAgencyId()); formDTO.setAgencyId(staffInfo.getAgencyId());
formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setCustomerId(tokenDto.getCustomerId());
final int[] i = {(formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize() + NumConstant.ONE}; final int[] i = {(formDTO.getPageNo() - NumConstant.ONE) * formDTO.getPageSize() + NumConstant.ONE};
@ -315,11 +318,11 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo
PageInfo<CommunitySelfOrganizationListDTO> objectPageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.selectCommunitySelfOrganizationList(formDTO)); PageInfo<CommunitySelfOrganizationListDTO> objectPageInfo = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize()).doSelectPageInfo(() -> baseDao.selectCommunitySelfOrganizationList(formDTO));
result.setTotal(Integer.valueOf(String.valueOf(objectPageInfo.getTotal()))); result.setTotal(Integer.valueOf(String.valueOf(objectPageInfo.getTotal())));
if (CollectionUtils.isNotEmpty(objectPageInfo.getList())){ if (CollectionUtils.isNotEmpty(objectPageInfo.getList())){
objectPageInfo.getList().forEach(l -> { for (CommunitySelfOrganizationListDTO l : objectPageInfo.getList()) {
l.setSort(i[NumConstant.ZERO]); l.setSort(i[NumConstant.ZERO]);
i[NumConstant.ZERO]++; i[NumConstant.ZERO]++;
l.setScore(null == pointMap.get(l.getOrgId())?NumConstant.ZERO:pointMap.get(l.getOrgId())); l.setScore(null == pointMap.get(l.getOrgId()) ? NumConstant.ZERO : pointMap.get(l.getOrgId()));
}); }
result.setList(objectPageInfo.getList()); result.setList(objectPageInfo.getList());
} }
return result; return result;
@ -328,10 +331,10 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo
if (CollectionUtils.isNotEmpty(resultDTOs)){ if (CollectionUtils.isNotEmpty(resultDTOs)){
result.setTotal(resultDTOs.size()); result.setTotal(resultDTOs.size());
AtomicReference<Integer> sort = new AtomicReference<>(NumConstant.ONE); AtomicReference<Integer> sort = new AtomicReference<>(NumConstant.ONE);
resultDTOs.forEach(r -> { for (CommunitySelfOrganizationListDTO r : resultDTOs) {
r.setSort(sort.getAndSet(sort.get() + NumConstant.ONE)); r.setSort(sort.getAndSet(sort.get() + NumConstant.ONE));
r.setScore(null == pointMap.get(r.getOrgId())?NumConstant.ZERO:pointMap.get(r.getOrgId())); r.setScore(null == pointMap.get(r.getOrgId()) ? NumConstant.ZERO : pointMap.get(r.getOrgId()));
}); }
result.setList(resultDTOs); result.setList(resultDTOs);
} }
return result; return result;
@ -478,13 +481,13 @@ public class IcCommunitySelfOrganizationServiceImpl extends BaseServiceImpl<IcCo
@Override @Override
//@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
@Async @Async
public void importCommunitySelfOrganization(TokenDto tokenDto, HttpServletResponse response, MultipartFile file, String taskId) { public void importCommunitySelfOrganization(TokenDto tokenDto, HttpServletResponse response, InputStream inputStream, String taskId) {
try { try {
log.info("社会自组织导入,子线程开始执行"); log.info("社会自组织导入,子线程开始执行");
List<CommunitySelfOrgImportExcel> fileList = new ArrayList<>(); List<CommunitySelfOrgImportExcel> fileList = new ArrayList<>();
CommunitySelfOrgImportExcel excel = null; CommunitySelfOrgImportExcel excel = null;
//1.读取Excel数据 //1.读取Excel数据
ExcelImportResult<ImportCommunitySelfOrganization> testExcelImportResult = ExcelPoiUtils.importExcelMore(file, 0, 2, ImportCommunitySelfOrganization.class); ExcelImportResult<ImportCommunitySelfOrganization> testExcelImportResult = ExcelPoiUtils.importExcelMore(inputStream,0,2,ImportCommunitySelfOrganization.class);
//2.存在错误行数据时存入错误数据集合中 //2.存在错误行数据时存入错误数据集合中
for (ImportCommunitySelfOrganization entity : testExcelImportResult.getFailList()) { for (ImportCommunitySelfOrganization entity : testExcelImportResult.getFailList()) {
//打印失败的行 和失败的信息 //打印失败的行 和失败的信息

3
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/ScreenExtractTaskService.java

@ -19,4 +19,7 @@ public interface ScreenExtractTaskService {
* @Date 2020/9/28 10:49 * @Date 2020/9/28 10:49
**/ **/
Result screenExtractMonthly(String params); Result screenExtractMonthly(String params);
Result dateCheckDaily(String params);
} }

9
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/impl/ScreenExtractTaskServiceImpl.java

@ -47,4 +47,13 @@ public class ScreenExtractTaskServiceImpl implements ScreenExtractTaskService {
} }
return dataStatisticalOpenFeignClient.extractMonthlyAll(extractScreenFormDTO); return dataStatisticalOpenFeignClient.extractMonthlyAll(extractScreenFormDTO);
} }
@Override
public Result dateCheckDaily(String params) {
ExtractOriginFormDTO extractOriginFormDTO = new ExtractOriginFormDTO();
if (StringUtils.isNotBlank(params)) {
extractOriginFormDTO = JSON.parseObject(params, ExtractOriginFormDTO.class);
}
return dataStatisticalOpenFeignClient.dataCheck(extractOriginFormDTO);
}
} }

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

@ -0,0 +1,33 @@
package com.epmet.task;
import com.epmet.commons.tools.utils.Result;
import com.epmet.service.ScreenExtractTaskService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* @author Administrator
*/
@Component("dataCheckDailyTask")
public class DataCheckDailyTask implements ITask{
@Autowired
private ScreenExtractTaskService screenExtractTaskService;
private Logger logger = LoggerFactory.getLogger(getClass());
@Override
public void run(String params) {
logger.info("DataCheckDailyTask定时任务正在执行,参数为:{}", params);
Result result = screenExtractTaskService.dateCheckDaily(params);
if (result.success()){
logger.info("DataCheckDailyTask定时任务执行成功");
}else {
logger.error("DataCheckDailyTask定时任务执行失败:" + result.getMsg());
}
}
}

4
epmet-module/gov-issue/gov-issue-server/src/main/resources/bootstrap.yml

@ -30,12 +30,12 @@ spring:
password: @spring.datasource.druid.password@ password: @spring.datasource.druid.password@
#监控页面 #监控页面
stat-view-servlet: stat-view-servlet:
enabled: true enabled: false
#loginUsername: admin #loginUsername: admin
#loginPassword: admin #loginPassword: admin
allow: allow:
web-stat-filter: web-stat-filter:
enabled: true enabled: false
filters: stat,log4j2 filters: stat,log4j2
cloud: cloud:
nacos: nacos:

14
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/BuildingController.java

@ -53,6 +53,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -224,7 +225,18 @@ public class BuildingController {
if (!importTask.success()){ if (!importTask.success()){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"","存在进行中的导入"); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"","存在进行中的导入");
} }
buildingService.buildingImportExcel(formDTO,file,importTask); InputStream inputStream = null;
try {
inputStream = file.getInputStream();
}catch (Exception e){
ImportTaskCommonFormDTO input = new ImportTaskCommonFormDTO();
input.setOperatorId(formDTO.getUserId());
input.setTaskId(importTask.getData().getTaskId());
input.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL);
epmetCommonServiceOpenFeignClient.finishImportTask(input);
log.error("读取文件失败");
}
buildingService.buildingImportExcel(formDTO, inputStream, importTask);
return new Result(); return new Result();
} }

13
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/HouseController.java

@ -274,7 +274,18 @@ public class HouseController implements ResultDataResolver {
if (!importTask.success()){ if (!importTask.success()){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"","存在进行中的导入"); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"","存在进行中的导入");
} }
houseService.dispose(file,formDTO,importTask); InputStream inputStream = null;
try {
inputStream = file.getInputStream();
}catch (Exception e){
ImportTaskCommonFormDTO input = new ImportTaskCommonFormDTO();
input.setOperatorId(formDTO.getUserId());
input.setTaskId(importTask.getData().getTaskId());
input.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL);
epmetCommonServiceOpenFeignClient.finishImportTask(input);
log.error("读取文件失败");
}
houseService.dispose(inputStream,formDTO,importTask);
return new Result<>(); return new Result<>();
} }

15
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/controller/IcNeighborHoodController.java

@ -40,10 +40,12 @@ import com.epmet.feign.EpmetCommonServiceOpenFeignClient;
import com.epmet.service.IcNeighborHoodService; import com.epmet.service.IcNeighborHoodService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -148,8 +150,19 @@ public class IcNeighborHoodController {
if (!importTask.success()){ if (!importTask.success()){
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"","存在进行中的导入"); throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(),"","存在进行中的导入");
} }
InputStream inputStream = null;
try {
inputStream = file.getInputStream();
}catch (Exception e){
ImportTaskCommonFormDTO input = new ImportTaskCommonFormDTO();
input.setOperatorId(formDTO.getUserId());
input.setTaskId(importTask.getData().getTaskId());
input.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL);
epmetCommonServiceOpenFeignClient.finishImportTask(input);
log.error("读取文件失败");
}
log.info("插入任务结果"+ JSON.toJSONString(importTask.getData())); log.info("插入任务结果"+ JSON.toJSONString(importTask.getData()));
icNeighborHoodService.neighborhoodImport(formDTO,file,importTask); icNeighborHoodService.neighborhoodImport(formDTO,inputStream,importTask);
return new Result(); return new Result();
} }

1
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/ImportNeighborHoodInfoListener.java

@ -79,7 +79,6 @@ public class ImportNeighborHoodInfoListener extends AnalysisEventListener<Neighb
@Override @Override
public void invoke(NeighborHoodInfoModel data, AnalysisContext context) { public void invoke(NeighborHoodInfoModel data, AnalysisContext context) {
log.info("invoke ==========");
if (null == data){ if (null == data){
return; return;
} }

6
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/redis/IcHouseRedis.java

@ -24,6 +24,7 @@ import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.dao.IcHouseDao; import com.epmet.dao.IcHouseDao;
import com.epmet.dto.result.HouseInfoDTO; import com.epmet.dto.result.HouseInfoDTO;
import com.epmet.dto.result.ImportResultDTO; import com.epmet.dto.result.ImportResultDTO;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -38,6 +39,7 @@ import java.util.Map;
* @since v1.0.0 2021-10-27 * @since v1.0.0 2021-10-27
*/ */
@Component @Component
@Slf4j
public class IcHouseRedis { public class IcHouseRedis {
@Autowired @Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
@ -79,6 +81,10 @@ public class IcHouseRedis {
return ConvertUtils.mapToEntity(map,HouseInfoDTO.class); return ConvertUtils.mapToEntity(map,HouseInfoDTO.class);
} }
HouseInfoDTO houseInfo = icHouseDao.queryHouseInfoByHouseId(houseId); HouseInfoDTO houseInfo = icHouseDao.queryHouseInfoByHouseId(houseId);
if(null == houseInfo){
log.info("Database does not exist this house info, id = {}", houseId);
return null;
}
Map<String, Object> result = BeanUtil.beanToMap(houseInfo, false, true); Map<String, Object> result = BeanUtil.beanToMap(houseInfo, false, true);
setHouseInfo(houseId,result,houseInfo.getCustomerId()); setHouseInfo(houseId,result,houseInfo.getCustomerId());
return houseInfo; return houseInfo;

3
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/BuildingService.java

@ -31,6 +31,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.util.List; import java.util.List;
/** /**
@ -75,6 +76,6 @@ public interface BuildingService {
* @author zxc * @author zxc
* @date 2022/2/13 10:18 上午 * @date 2022/2/13 10:18 上午
*/ */
Result buildingImportExcel(ImportInfoFormDTO formDTO, MultipartFile file,Result<ImportTaskCommonResultDTO> importTask) throws IOException; Result buildingImportExcel(ImportInfoFormDTO formDTO, InputStream inputStream, Result<ImportTaskCommonResultDTO> importTask) throws IOException;
} }

3
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/HouseService.java

@ -29,6 +29,7 @@ import com.epmet.excel.IcHouseExcel;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.InputStream;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -76,5 +77,5 @@ public interface HouseService {
*/ */
void allDelete(NeighborHoodManageDelFormDTO formDTO); void allDelete(NeighborHoodManageDelFormDTO formDTO);
Result dispose(MultipartFile file, ImportInfoFormDTO formDTO, Result<ImportTaskCommonResultDTO> importTask); Result dispose(InputStream inputStream, ImportInfoFormDTO formDTO, Result<ImportTaskCommonResultDTO> importTask);
} }

3
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/IcNeighborHoodService.java

@ -31,6 +31,7 @@ import com.epmet.entity.IcPropertyManagementEntity;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -129,7 +130,7 @@ public interface IcNeighborHoodService extends BaseService<IcNeighborHoodEntity>
* @author zxc * @author zxc
* @date 2022/2/12 11:11 上午 * @date 2022/2/12 11:11 上午
*/ */
Result neighborhoodImport(ImportInfoFormDTO formDTO, MultipartFile file,Result<ImportTaskCommonResultDTO> importTask) throws IOException; Result neighborhoodImport(ImportInfoFormDTO formDTO, InputStream inputStream, Result<ImportTaskCommonResultDTO> importTask) throws IOException;
/** /**
* 获取导入小区楼栋单元ID * 获取导入小区楼栋单元ID

48
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/BuildingServiceImpl.java

@ -58,6 +58,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.*; import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.function.Function; import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -95,6 +96,8 @@ public class BuildingServiceImpl implements BuildingService {
private IcNeighborHoodService neighborHoodService; private IcNeighborHoodService neighborHoodService;
@Autowired @Autowired
private EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient; private EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient;
@Autowired
private ExecutorService executorService;
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@ -403,33 +406,28 @@ public class BuildingServiceImpl implements BuildingService {
* @date 2022/2/13 10:15 上午 * @date 2022/2/13 10:15 上午
*/ */
@Override @Override
@Async public Result buildingImportExcel(ImportInfoFormDTO formDTO, InputStream inputStream,Result<ImportTaskCommonResultDTO> importTask) throws IOException {
public Result buildingImportExcel(ImportInfoFormDTO formDTO, MultipartFile file,Result<ImportTaskCommonResultDTO> importTask) throws IOException { executorService.submit(() -> {
ExcelReader excelReader = null; ExcelReader excelReader = null;
try {
InputStream inputStream = null;
try { try {
inputStream = file.getInputStream(); excelReader = EasyExcel.read(inputStream).build();
} catch (IOException e) { // 这里为了简单 所以注册了 同样的head 和Listener 自己使用功能必须不同的Listener
return new Result<String>().error("读取文件失败"); ReadSheet readSheet = EasyExcel.readSheet(0).head(BuildingInfoModel.class)
} .registerReadListener(new ImportBuildingInfoListener(formDTO,icHouseRedis,icBuildingDao,neighborHoodService,epmetCommonServiceOpenFeignClient,importTask.getData().getTaskId()))
excelReader = EasyExcel.read(inputStream).build(); .build();
// 这里为了简单 所以注册了 同样的head 和Listener 自己使用功能必须不同的Listener excelReader.read(readSheet);
ReadSheet readSheet = EasyExcel.readSheet(0).head(BuildingInfoModel.class) } catch (Exception e){
.registerReadListener(new ImportBuildingInfoListener(formDTO,icHouseRedis,icBuildingDao,neighborHoodService,epmetCommonServiceOpenFeignClient,importTask.getData().getTaskId())) ImportTaskCommonFormDTO input = new ImportTaskCommonFormDTO();
.build(); input.setOperatorId(formDTO.getUserId());
excelReader.read(readSheet); input.setTaskId(importTask.getData().getTaskId());
} catch (Exception e){ input.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL);
ImportTaskCommonFormDTO input = new ImportTaskCommonFormDTO(); epmetCommonServiceOpenFeignClient.finishImportTask(input);
input.setOperatorId(formDTO.getUserId()); } finally {
input.setTaskId(importTask.getData().getTaskId()); if (excelReader != null) {
input.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL); excelReader.finish();
epmetCommonServiceOpenFeignClient.finishImportTask(input); }
} finally {
if (excelReader != null) {
excelReader.finish();
} }
} });
return new Result<>(); return new Result<>();
} }

53
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/HouseServiceImpl.java

@ -70,6 +70,7 @@ import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.*; import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Slf4j @Slf4j
@ -102,6 +103,8 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
private IcNeighborHoodService neighborHoodService; private IcNeighborHoodService neighborHoodService;
@Autowired @Autowired
private EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient; private EpmetCommonServiceOpenFeignClient epmetCommonServiceOpenFeignClient;
@Autowired
private ExecutorService executorService;
@Autowired @Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@ -353,39 +356,37 @@ public class HouseServiceImpl implements HouseService, ResultDataResolver {
} }
List<HouseInfoDTO> result = new ArrayList<>(); List<HouseInfoDTO> result = new ArrayList<>();
houseIdList.forEach(h -> { houseIdList.forEach(h -> {
result.add(icHouseRedis.getHouseInfo(h,customerId)); HouseInfoDTO houseInfo = icHouseRedis.getHouseInfo(h, customerId);
if (null != houseInfo){
result.add(houseInfo);
}
}); });
return result; return result;
} }
@Async
@Override @Override
public Result dispose(MultipartFile file, ImportInfoFormDTO formDTO, Result<ImportTaskCommonResultDTO> importTask) { public Result dispose(InputStream inputStream, ImportInfoFormDTO formDTO, Result<ImportTaskCommonResultDTO> importTask) {
ExcelReader excelReader = null; executorService.submit(() -> {
try { ExcelReader excelReader = null;
InputStream inputStream = null;
try { try {
inputStream = file.getInputStream(); excelReader = EasyExcel.read(inputStream).build();
} catch (IOException e) { // 这里为了简单 所以注册了 同样的head 和Listener 自己使用功能必须不同的Listener
return new Result<String>().error("读取文件失败"); ReadSheet readSheet = EasyExcel.readSheet(0).head(HouseInfoModel.class)
} .registerReadListener(new ImportHouseInfoListener(formDTO,icBuildingDao,icHouseRedis,neighborHoodService,icHouseService,epmetCommonServiceOpenFeignClient,importTask.getData().getTaskId()))
excelReader = EasyExcel.read(inputStream).build(); .build();
// 这里为了简单 所以注册了 同样的head 和Listener 自己使用功能必须不同的Listener excelReader.read(readSheet);
ReadSheet readSheet = EasyExcel.readSheet(0).head(HouseInfoModel.class) } catch (Exception e){
.registerReadListener(new ImportHouseInfoListener(formDTO,icBuildingDao,icHouseRedis,neighborHoodService,icHouseService,epmetCommonServiceOpenFeignClient,importTask.getData().getTaskId())) ImportTaskCommonFormDTO input = new ImportTaskCommonFormDTO();
.build(); input.setOperatorId(formDTO.getUserId());
excelReader.read(readSheet); input.setTaskId(importTask.getData().getTaskId());
} catch (Exception e){ input.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL);
ImportTaskCommonFormDTO input = new ImportTaskCommonFormDTO(); epmetCommonServiceOpenFeignClient.finishImportTask(input);
input.setOperatorId(formDTO.getUserId()); } finally {
input.setTaskId(importTask.getData().getTaskId()); if (excelReader != null) {
input.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL); excelReader.finish();
epmetCommonServiceOpenFeignClient.finishImportTask(input); }
} finally {
if (excelReader != null) {
excelReader.finish();
} }
} });
return new Result(); return new Result();
} }

19
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/service/impl/IcNeighborHoodServiceImpl.java

@ -71,6 +71,7 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.http.entity.ContentType; import org.apache.http.entity.ContentType;
import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
@ -226,31 +227,23 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl<IcNeighborHoodDao
/** /**
* @Description 小区信息导入 * @Description 小区信息导入
* @param formDTO * @param formDTO
* @param file * @param inputStream
* @author zxc * @author zxc
* @date 2022/2/12 11:11 上午 * @date 2022/2/12 11:11 上午
*/ */
@Override @Override
public Result neighborhoodImport(ImportInfoFormDTO formDTO, MultipartFile file,Result<ImportTaskCommonResultDTO> importTask) { @Async
log.info("neighborhoodImport start====="); public Result neighborhoodImport(ImportInfoFormDTO formDTO, InputStream inputStream,Result<ImportTaskCommonResultDTO> importTask) {
executorService.submit(() -> { // executorService.submit(() -> {
// importNeighbor(formDTO,file,importTask); // importNeighbor(formDTO,file,importTask);
log.info("neighborhoodImport thread start====="); log.info("neighborhoodImport thread start=====");
ExcelReader excelReader = null; ExcelReader excelReader = null;
try { try {
InputStream inputStream = null;
try {
inputStream = file.getInputStream();
} catch (IOException e) {
throw new EpmetException("读取文件失败");
}
excelReader = EasyExcel.read(inputStream).build(); excelReader = EasyExcel.read(inputStream).build();
// 这里为了简单 所以注册了 同样的head 和Listener 自己使用功能必须不同的Listener // 这里为了简单 所以注册了 同样的head 和Listener 自己使用功能必须不同的Listener
ReadSheet readSheet = EasyExcel.readSheet(0).head(NeighborHoodInfoModel.class) ReadSheet readSheet = EasyExcel.readSheet(0).head(NeighborHoodInfoModel.class)
.registerReadListener(new ImportNeighborHoodInfoListener(formDTO,icHouseRedis,icBuildingDao,this,propertyManagementDao,epmetCommonServiceOpenFeignClient,importTask.getData().getTaskId())) .registerReadListener(new ImportNeighborHoodInfoListener(formDTO,icHouseRedis,icBuildingDao,this,propertyManagementDao,epmetCommonServiceOpenFeignClient,importTask.getData().getTaskId()))
.build(); .build();
log.info("neighborhoodImport build readSheet num:{}",readSheet.getSheetNo());
excelReader.read(readSheet); excelReader.read(readSheet);
} catch (Exception e){ } catch (Exception e){
log.error("neighborhoodImport import exception", e); log.error("neighborhoodImport import exception", e);
@ -266,7 +259,7 @@ public class IcNeighborHoodServiceImpl extends BaseServiceImpl<IcNeighborHoodDao
} }
} }
log.info("neighborhoodImport thread end====="); log.info("neighborhoodImport thread end=====");
}); // });
return new Result<>(); return new Result<>();
} }

12
epmet-module/gov-org/gov-org-server/src/main/resources/mapper/IcHouseDao.xml

@ -123,7 +123,9 @@
a.BUILDING_UNIT_ID as unitNumKey, a.BUILDING_UNIT_ID as unitNumKey,
a.HOUSE_TYPE as houseTypeKey, a.HOUSE_TYPE as houseTypeKey,
a.PURPOSE as purposeKey, a.PURPOSE as purposeKey,
a.RENT_FLAG as rentFlagKey a.RENT_FLAG as rentFlagKey,
c.AGENCY_ID as agencyId,
c.GRID_ID as gridId
from ic_house a from ic_house a
LEFT JOIN ic_building b on a.BUILDING_ID = b.ID and b.DEL_FLAG = '0' LEFT JOIN ic_building b on a.BUILDING_ID = b.ID and b.DEL_FLAG = '0'
LEFT JOIN ic_neighbor_hood c on a.NEIGHBOR_HOOD_ID = c.ID and c.DEL_FLAG = '0' LEFT JOIN ic_neighbor_hood c on a.NEIGHBOR_HOOD_ID = c.ID and c.DEL_FLAG = '0'
@ -304,6 +306,8 @@
and ih.id !=#{houseId} and ih.id !=#{houseId}
</if> </if>
</select> </select>
<!-- 复制的 queryHouseInfo 方法 -->
<select id="queryHouseInfoByHouseId" resultType="com.epmet.dto.result.HouseInfoDTO"> <select id="queryHouseInfoByHouseId" resultType="com.epmet.dto.result.HouseInfoDTO">
SELECT SELECT
ih.ID as homeId, ih.ID as homeId,
@ -322,9 +326,9 @@
ih.CUSTOMER_ID AS customerId, ih.CUSTOMER_ID AS customerId,
concat(IFNULL(n.NEIGHBOR_HOOD_NAME,''),IFNULL(ib.BUILDING_NAME,''),IFNULL(u.UNIT_NAME,''),IFNULL(ih.HOUSE_NAME,'')) AS allName concat(IFNULL(n.NEIGHBOR_HOOD_NAME,''),IFNULL(ib.BUILDING_NAME,''),IFNULL(u.UNIT_NAME,''),IFNULL(ih.HOUSE_NAME,'')) AS allName
FROM ic_house ih FROM ic_house ih
left JOIN ic_neighbor_hood n ON ( ih.NEIGHBOR_HOOD_ID = n.id ) left JOIN ic_neighbor_hood n ON ( ih.NEIGHBOR_HOOD_ID = n.id AND n.DEL_FLAG = '0')
left JOIN ic_building ib ON ( ih.BUILDING_ID = ib.id ) left JOIN ic_building ib ON ( ih.BUILDING_ID = ib.id AND ib.DEL_FLAG = '0')
left JOIN ic_building_unit u ON ( ih.BUILDING_UNIT_ID = u.ID ) left JOIN ic_building_unit u ON ( ih.BUILDING_UNIT_ID = u.ID AND u.DEL_FLAG = '0')
WHERE WHERE
ih.DEL_FLAG = '0' ih.DEL_FLAG = '0'
AND ih.ID = #{houseId} AND ih.ID = #{houseId}

4
epmet-module/gov-project/gov-project-server/src/main/resources/bootstrap.yml

@ -30,12 +30,12 @@ spring:
password: @spring.datasource.druid.password@ password: @spring.datasource.druid.password@
#监控页面 #监控页面
stat-view-servlet: stat-view-servlet:
enabled: true enabled: false
#loginUsername: admin #loginUsername: admin
#loginPassword: admin #loginPassword: admin
allow: allow:
web-stat-filter: web-stat-filter:
enabled: true enabled: false
filters: stat,wall,log4j2 filters: stat,wall,log4j2
# 数据迁移工具flyway # 数据迁移工具flyway
flyway: flyway:

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

@ -11,7 +11,6 @@ import com.epmet.commons.tools.redis.RedisUtils;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.dto.basereport.form.EventInfoFormDTO; import com.epmet.dto.basereport.form.EventInfoFormDTO;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.opendata.service.BaseDisputeProcessService; import com.epmet.opendata.service.BaseDisputeProcessService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext; import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
@ -34,8 +33,6 @@ public class OpenDataProjectChangeEventListener implements MessageListenerConcur
private Logger logger = LoggerFactory.getLogger(getClass()); private Logger logger = LoggerFactory.getLogger(getClass());
private EpmetMessageOpenFeignClient messageOpenFeignClient;
private RedisUtils redisUtils; private RedisUtils redisUtils;
private DistributedLock distributedLock; private DistributedLock distributedLock;

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

@ -10,7 +10,6 @@ import com.epmet.commons.tools.exception.RenException;
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;
import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.opendata.dto.form.StaffBaseInfoFormDTO; import com.epmet.opendata.dto.form.StaffBaseInfoFormDTO;
import com.epmet.opendata.service.ExUserService; import com.epmet.opendata.service.ExUserService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -35,16 +34,14 @@ public class OpenDataStaffChangeEventListener implements MessageListenerConcurre
private Logger logger = LoggerFactory.getLogger(getClass()); private Logger logger = LoggerFactory.getLogger(getClass());
private EpmetMessageOpenFeignClient messageOpenFeignClient;
private RedisUtils redisUtils; private RedisUtils redisUtils;
private DistributedLock distributedLock; private DistributedLock distributedLock;
public OpenDataStaffChangeEventListener(DistributedLock distributedLock) { public OpenDataStaffChangeEventListener(DistributedLock distributedLock) {
this.distributedLock = distributedLock; this.distributedLock = distributedLock;
} }
@Override @Override
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) { public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) {

4
epmet-module/resi-group/resi-group-server/src/main/resources/bootstrap.yml

@ -33,12 +33,12 @@ spring:
password: @spring.datasource.druid.password@ password: @spring.datasource.druid.password@
#监控页面 #监控页面
stat-view-servlet: stat-view-servlet:
enabled: true enabled: false
#loginUsername: admin #loginUsername: admin
#loginPassword: admin #loginPassword: admin
allow: allow:
web-stat-filter: web-stat-filter:
enabled: true enabled: false
filters: stat,wall,log4j2 filters: stat,wall,log4j2
# 数据迁移工具flyway # 数据迁移工具flyway
flyway: flyway:

2
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/ResiPartyMemberApplication.java

@ -13,6 +13,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan; import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableAsync;
/** /**
* 模块 * 模块
@ -24,6 +25,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@EnableDiscoveryClient @EnableDiscoveryClient
@EnableFeignClients @EnableFeignClients
@ServletComponentScan @ServletComponentScan
@EnableAsync
public class ResiPartyMemberApplication { public class ResiPartyMemberApplication {
public static void main(String[] args) { public static void main(String[] args) {

14
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/controller/IcPartymemberStyleController.java

@ -48,6 +48,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -143,8 +144,19 @@ public class IcPartymemberStyleController {
if (!result.success()) { if (!result.success()) {
throw new RenException(result.getInternalMsg()); throw new RenException(result.getInternalMsg());
} }
InputStream inputStream = null;
try {
inputStream = file.getInputStream();
}catch (Exception e){
ImportTaskCommonFormDTO input = new ImportTaskCommonFormDTO();
input.setOperatorId(tokenDto.getUserId());
input.setTaskId(result.getData().getTaskId());
input.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL);
commonServiceOpenFeignClient.finishImportTask(input);
log.error("读取文件失败");
}
//2.执行导入程序 //2.执行导入程序
icPartymemberStyleService.importData(tokenDto, response, file, result.getData().getTaskId()); icPartymemberStyleService.importData(tokenDto, response, inputStream, result.getData().getTaskId());
return new Result(); return new Result();
} }

3
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/IcPartymemberStyleService.java

@ -29,6 +29,7 @@ import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -108,7 +109,7 @@ public interface IcPartymemberStyleService extends BaseService<IcPartymemberStyl
* @Author zhaoqifeng * @Author zhaoqifeng
* @Date 2021/11/29 11:01 * @Date 2021/11/29 11:01
*/ */
void importData(TokenDto tokenDto, HttpServletResponse response, MultipartFile file, String taskId) throws IOException; void importData(TokenDto tokenDto, HttpServletResponse response, InputStream inputStream, String taskId) throws IOException;
/** /**
* 数据分析-党员风采列表查询 * 数据分析-党员风采列表查询

6
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/modules/partymember/service/impl/IcPartymemberStyleServiceImpl.java

@ -81,6 +81,7 @@ import org.springframework.web.multipart.commons.CommonsMultipartFile;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
@ -94,7 +95,6 @@ import java.util.stream.Collectors;
*/ */
@Slf4j @Slf4j
@Service @Service
@EnableAsync
public class IcPartymemberStyleServiceImpl extends BaseServiceImpl<IcPartymemberStyleDao, IcPartymemberStyleEntity> implements IcPartymemberStyleService { public class IcPartymemberStyleServiceImpl extends BaseServiceImpl<IcPartymemberStyleDao, IcPartymemberStyleEntity> implements IcPartymemberStyleService {
@Resource @Resource
@ -259,12 +259,12 @@ public class IcPartymemberStyleServiceImpl extends BaseServiceImpl<IcPartymember
@Override @Override
//@Transactional(rollbackFor = Exception.class) //@Transactional(rollbackFor = Exception.class)
@Async @Async
public void importData(TokenDto tokenDto, HttpServletResponse response, MultipartFile file, String taskId) { public void importData(TokenDto tokenDto, HttpServletResponse response, InputStream inputStream, String taskId) {
try { try {
log.info("党员风采导入,子线程开始执行"); log.info("党员风采导入,子线程开始执行");
List<PartyMemberImportExcel> fileList = new ArrayList<>(); List<PartyMemberImportExcel> fileList = new ArrayList<>();
PartyMemberImportExcel excel = null; PartyMemberImportExcel excel = null;
ExcelImportResult<IcPartymemberStyleImportExcel> importResult = ExcelPoiUtils.importExcelMore(file, 0, 1, IcPartymemberStyleImportExcel.class); ExcelImportResult<IcPartymemberStyleImportExcel> importResult = ExcelPoiUtils.importExcelMore(inputStream, 0, 1, IcPartymemberStyleImportExcel.class);
List<IcPartymemberStyleImportExcel> failList = importResult.getFailList(); List<IcPartymemberStyleImportExcel> failList = importResult.getFailList();
//存放错误数据行号 //存放错误数据行号

90
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java

@ -27,6 +27,7 @@ import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.constant.Constant; import com.epmet.commons.tools.constant.Constant;
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.constant.ThreadLocalConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.dto.result.OptionDataResultDTO; import com.epmet.commons.tools.dto.result.OptionDataResultDTO;
import com.epmet.commons.tools.enums.IcFormCodeEnum; import com.epmet.commons.tools.enums.IcFormCodeEnum;
@ -34,6 +35,7 @@ import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.EpmetException;
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;
import com.epmet.commons.tools.feign.EpmetBaseRequestInterceptor;
import com.epmet.commons.tools.feign.ResultDataResolver; import com.epmet.commons.tools.feign.ResultDataResolver;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.RedisKeys; import com.epmet.commons.tools.redis.RedisKeys;
@ -58,6 +60,7 @@ import com.epmet.feign.OperCustomizeOpenFeignClient;
import com.epmet.feign.OssFeignClient; import com.epmet.feign.OssFeignClient;
import com.epmet.service.IcResiUserImportService; import com.epmet.service.IcResiUserImportService;
import com.epmet.service.IcResiUserService; import com.epmet.service.IcResiUserService;
import feign.RequestInterceptor;
import jodd.io.FileUtil; import jodd.io.FileUtil;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
@ -71,7 +74,6 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.support.StandardMultipartHttpServletRequest; import org.springframework.web.multipart.support.StandardMultipartHttpServletRequest;
@ -88,6 +90,7 @@ import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -130,6 +133,8 @@ public class IcResiUserController implements ResultDataResolver {
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient; private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@Autowired @Autowired
private LoginUserUtil loginUserUtil; private LoginUserUtil loginUserUtil;
@Autowired
private RequestInterceptor requestInterceptor;
/** /**
* 模板枚举 * 模板枚举
@ -231,6 +236,7 @@ public class IcResiUserController implements ResultDataResolver {
//推送MQ事件 //推送MQ事件
IcResiUserAddMQMsg mqMsg = new IcResiUserAddMQMsg(); IcResiUserAddMQMsg mqMsg = new IcResiUserAddMQMsg();
mqMsg.setCustomerId(tokenDto.getCustomerId()); mqMsg.setCustomerId(tokenDto.getCustomerId());
log.info("customer id is {}",tokenDto.getCustomerId());
mqMsg.setIcResiUser(resiUserId); mqMsg.setIcResiUser(resiUserId);
SystemMsgFormDTO form = new SystemMsgFormDTO(); SystemMsgFormDTO form = new SystemMsgFormDTO();
form.setMessageType(SystemMessageType.IC_RESI_USER_EDIT); form.setMessageType(SystemMessageType.IC_RESI_USER_EDIT);
@ -359,6 +365,7 @@ public class IcResiUserController implements ResultDataResolver {
//表数据写入 //表数据写入
//通过枚举获取相关表并按照sheetNo排序 //通过枚举获取相关表并按照sheetNo排序
List<IcResiUserTableEnum> resiTableList = Arrays.stream(IcResiUserTableEnum.values()) List<IcResiUserTableEnum> resiTableList = Arrays.stream(IcResiUserTableEnum.values())
.filter((v) -> v.getSheetNo() != null)
.sorted(Comparator.comparing(IcResiUserTableEnum::getSheetNo)) .sorted(Comparator.comparing(IcResiUserTableEnum::getSheetNo))
.collect(Collectors.toList()); .collect(Collectors.toList());
List<Map<String, Object>> resiResultList = null; List<Map<String, Object>> resiResultList = null;
@ -465,26 +472,14 @@ public class IcResiUserController implements ResultDataResolver {
throw new RenException("上传失败"); throw new RenException("上传失败");
} }
HttpServletRequest request = ((StandardMultipartHttpServletRequest)multipartRequest).getRequest(); HashMap<String, String> headers = ((EpmetBaseRequestInterceptor) requestInterceptor).getHeadersFromRequest();
HashMap<String, String> headers = getHeadersFromRequest(request); ThreadLocalConstant.inheritableAdditionalHeaders.set(headers);
// 三.异步执行导入 // 三.异步执行导入
CompletableFuture.runAsync(() -> { new Thread(() -> {
try { try {
// 睡眠2秒钟,等待主线程先结束,主线程会清空request对象的headers,等他执行了清空之后,我们这边再手动setHeader进去
Thread.sleep(2000l);
System.out.println("请求头:" + headers);
} catch (InterruptedException e) {
String errorMsg = ExceptionUtils.getErrorStackTrace(e);
log.error("【上传居民信息】失败,睡眠2s发生中断:{}", errorMsg);
return;
}
try {
setHeaders2Request(request, headers);
List<FormItemResult> formItemList = icResiUserService.listFormItems(customerId,IcFormCodeEnum.RESI_BASE_INFO.getCode()); List<FormItemResult> formItemList = icResiUserService.listFormItems(customerId,IcFormCodeEnum.RESI_BASE_INFO.getCode());
icResiUserImportService.importIcResiInfoFromExcel(importTaskId, formItemList, importTempFileSavePath.toString(), response, IC_RESI_UPLOAD_DIR); icResiUserImportService.importIcResiInfoFromExcel(importTaskId, formItemList, importTempFileSavePath.toString(), response, IC_RESI_UPLOAD_DIR);
} catch (Throwable e) { } catch (Throwable e) {
@ -502,56 +497,29 @@ public class IcResiUserController implements ResultDataResolver {
log.error("【导入居民信息失败】清理上传的文件失败:{}", ExceptionUtils.getErrorStackTrace(e)); log.error("【导入居民信息失败】清理上传的文件失败:{}", ExceptionUtils.getErrorStackTrace(e));
} }
// 清理request对象 // 清理tl对象
RequestContextHolder.resetRequestAttributes(); ThreadLocalConstant.inheritableAdditionalHeaders.remove();
} }
}); }).start();
return new Result(); return new Result();
} }
private HashMap<String, String> getHeadersFromRequest(HttpServletRequest request) { // private HashMap<String, String> getHeadersFromRequest(HttpServletRequest request) {
HashMap<String, String> headers = new HashMap<>(); // HashMap<String, String> headers = new HashMap<>();
Enumeration<String> headerNames = request.getHeaderNames(); // Enumeration<String> headerNames = request.getHeaderNames();
if (headerNames != null) { // if (headerNames != null) {
while (headerNames.hasMoreElements()) { // while (headerNames.hasMoreElements()) {
String name = headerNames.nextElement(); // String name = headerNames.nextElement();
Enumeration<String> values = request.getHeaders(name); // Enumeration<String> values = request.getHeaders(name);
while (values.hasMoreElements()) { // while (values.hasMoreElements()) {
String value = values.nextElement(); // String value = values.nextElement();
headers.put(name, value); // headers.put(name, value);
} // }
} // }
} // }
return headers; // return headers;
} // }
private void setHeaders2Request(HttpServletRequest request, HashMap<String, String> headers) {
for (Map.Entry<String, String> kv : headers.entrySet()) {
setParam2Header(request, kv.getKey(), kv.getValue());
}
}
private void setParam2Header(HttpServletRequest requestFacade, String key, String value){
Class<? extends HttpServletRequest> requestFacadeClass = requestFacade.getClass();
try {
Field requestField = requestFacadeClass.getDeclaredField("request");
requestField.setAccessible(true);
Object requestObject = requestField.get(requestFacade);
Field coyoteRequestField = requestObject.getClass().getDeclaredField("coyoteRequest");
coyoteRequestField.setAccessible(true);
Object coyoteRequestObject = coyoteRequestField.get(requestObject);
Field headers = coyoteRequestObject.getClass().getDeclaredField("headers");
headers.setAccessible(true);
MimeHeaders o2 = (MimeHeaders)headers.get(coyoteRequestObject);
o2.addValue(key).setString(value);
} catch (Exception e) {
e.printStackTrace();
log.error("为子线程设置请求头出错");
}
}
@PostMapping("test") @PostMapping("test")
public Result<List<Map<String, Object>>> test(@LoginUser TokenDto tokenDto, @RequestBody DynamicQueryFormDTO formDTO) { public Result<List<Map<String, Object>>> test(@LoginUser TokenDto tokenDto, @RequestBody DynamicQueryFormDTO formDTO) {

2
epmet-user/epmet-user-server/src/main/java/com/epmet/enums/IcResiUserTableEnum.java

@ -89,7 +89,7 @@ public enum IcResiUserTableEnum {
return tableComment; return tableComment;
} }
public int getSheetNo() { public Integer getSheetNo() {
return sheetNo; return sheetNo;
} }

11
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/IcResiImportDynamicExcelListener.java

@ -122,12 +122,18 @@ public class IcResiImportDynamicExcelListener extends AnalysisEventListener<Map<
// 合并多级表头到一个list中,key为列序号 // 合并多级表头到一个list中,key为列序号
Map<Integer, List<String>> headers = icResiUserImportService.mergeMultiLevelHeadLabels(headList); Map<Integer, List<String>> headers = icResiUserImportService.mergeMultiLevelHeadLabels(headList);
icResiUserImportService.printLog("invokeHeadMap_1_" + isPrimary);
// 清洗表头数据,通过items剔除,并且得到options // 清洗表头数据,通过items剔除,并且得到options
abandonedHeaders = icResiUserImportService.removeAndGetOptionsFromHeaders(headers, formItemList); abandonedHeaders = icResiUserImportService.removeAndGetOptionsFromHeaders(headers, formItemList);
icResiUserImportService.printLog("invokeHeadMap_2_" + isPrimary);
// 交换表头信息,以label连起来的string作为key,列号的列表作为value // 交换表头信息,以label连起来的string作为key,列号的列表作为value
HashMap<String, List<Integer>> combinedHeaders = icResiUserImportService.exchangeKeyAndValueOfHeaders(headers); HashMap<String, List<Integer>> combinedHeaders = icResiUserImportService.exchangeKeyAndValueOfHeaders(headers);
icResiUserImportService.printLog("invokeHeadMap_3_" + isPrimary);
// 得到客户配置item数据。<"兴趣爱好:兴趣特长", item对象> // 得到客户配置item数据。<"兴趣爱好:兴趣特长", item对象>
Map<String, FormItemResult> customizedLabelCompbinedItemsMap = formItemList.stream().collect( Map<String, FormItemResult> customizedLabelCompbinedItemsMap = formItemList.stream().collect(
Collectors.toMap(formItem -> { Collectors.toMap(formItem -> {
@ -141,7 +147,11 @@ public class IcResiImportDynamicExcelListener extends AnalysisEventListener<Map<
}, formItem -> formItem) }, formItem -> formItem)
); );
icResiUserImportService.printLog("invokeHeadMap_4_" + isPrimary);
itemIdAndColumnWrapper = icResiUserImportService.convertExcelHeaders2DBColumnWrappers(customizedLabelCompbinedItemsMap, combinedHeaders); itemIdAndColumnWrapper = icResiUserImportService.convertExcelHeaders2DBColumnWrappers(customizedLabelCompbinedItemsMap, combinedHeaders);
icResiUserImportService.printLog("invokeHeadMap_5_" + isPrimary);
} }
/** /**
@ -172,6 +182,7 @@ public class IcResiImportDynamicExcelListener extends AnalysisEventListener<Map<
if (dataList.size() != 0) { if (dataList.size() != 0) {
execPersistant(); execPersistant();
} }
icResiUserImportService.printLog("invokeHeadMap_doAfterAllAnalysed_" + isPrimary);
} }
/** /**

5
epmet-user/epmet-user-server/src/main/java/com/epmet/mq/listener/ICWarnStatsEventListener.java

@ -10,6 +10,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.utils.SpringContextUtils; import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.service.StatsResiWarnService; import com.epmet.service.StatsResiWarnService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext; import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus; import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
@ -27,6 +28,7 @@ import java.util.concurrent.TimeUnit;
* @author wxz * @author wxz
* @date 2021.10.13 15:21:48 * @date 2021.10.13 15:21:48
*/ */
@Slf4j
public class ICWarnStatsEventListener implements MessageListenerConcurrently { public class ICWarnStatsEventListener implements MessageListenerConcurrently {
private Logger logger = LoggerFactory.getLogger(getClass()); private Logger logger = LoggerFactory.getLogger(getClass());
@ -53,13 +55,14 @@ public class ICWarnStatsEventListener implements MessageListenerConcurrently {
// msg即为消息体 // msg即为消息体
// tags为SystemMessageType.java中的项,为具体的操作,此处拿到tags,判断是创建还是变更,来做响应的后续操作即可 // tags为SystemMessageType.java中的项,为具体的操作,此处拿到tags,判断是创建还是变更,来做响应的后续操作即可
String msg = new String(messageExt.getBody()); String msg = new String(messageExt.getBody());
log.info("msg is {}",msg);
String topic = messageExt.getTopic(); String topic = messageExt.getTopic();
String tags = messageExt.getTags(); String tags = messageExt.getTags();
String pendingMsgLabel = messageExt.getUserProperty(MQUserPropertys.BLOCKED_MSG_LABEL); String pendingMsgLabel = messageExt.getUserProperty(MQUserPropertys.BLOCKED_MSG_LABEL);
logger.info("【开放数据事件监听器】-居民信息变动-收到消息内容:{},操作:{}", msg, tags); logger.info("【开放数据事件监听器】-居民信息变动-收到消息内容:{},操作:{}", msg, tags);
IcResiUserAddMQMsg obj = JSON.parseObject(msg, IcResiUserAddMQMsg.class); IcResiUserAddMQMsg obj = JSON.parseObject(msg, IcResiUserAddMQMsg.class);
log.info("obj is {}",JSON.toJSONString(obj));
DistributedLock distributedLock = null; DistributedLock distributedLock = null;
RLock lock = null; RLock lock = null;
try { try {

102
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserImportServiceImpl.java

@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.epmet.bean.ResiImportCategoryData; import com.epmet.bean.ResiImportCategoryData;
import com.epmet.bean.ResiImportResiCategoryChangedCache; import com.epmet.bean.ResiImportResiCategoryChangedCache;
import com.epmet.bean.ResiImportChangedData; import com.epmet.bean.ResiImportChangedData;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.constant.StrConstant; import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.constant.ThreadLocalConstant; import com.epmet.commons.tools.constant.ThreadLocalConstant;
@ -23,7 +24,6 @@ import com.epmet.commons.tools.feign.ResultDataResolver;
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;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis; import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.constants.ImportTaskConstants; import com.epmet.constants.ImportTaskConstants;
@ -103,10 +103,6 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
*/ */
Cache<String, Map<String, Map<String, String>>> itemIdAndOptionsCache = CacheBuilder.newBuilder().maximumSize(500).build(); Cache<String, Map<String, Map<String, String>>> itemIdAndOptionsCache = CacheBuilder.newBuilder().maximumSize(500).build();
@Autowired
private LoginUserUtil loginUserUtil;
@Autowired @Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient; private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
@ -217,19 +213,13 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
@Override @Override
public void importIcResiInfoFromExcel(String importTaskId, List<FormItemResult> formItemList, String excelPathName, HttpServletResponse response, Path importTempPath) { public void importIcResiInfoFromExcel(String importTaskId, List<FormItemResult> formItemList, String excelPathName, HttpServletResponse response, Path importTempPath) {
String loginUserId = loginUserUtil.getLoginUserId(); String app = ThreadLocalConstant.inheritableAdditionalHeaders.get().get(AppClientConstant.APP);
String loginUserApp = loginUserUtil.getLoginUserApp(); String client = ThreadLocalConstant.inheritableAdditionalHeaders.get().get(AppClientConstant.CLIENT);
String loginUserClient = loginUserUtil.getLoginUserClient(); String loginUserId = ThreadLocalConstant.inheritableAdditionalHeaders.get().get(AppClientConstant.USER_ID.toLowerCase());
LoginUserDetailsFormDTO userForm = new LoginUserDetailsFormDTO(); String currUserAgencyId = userService.getLoginUserDetails(app, client, loginUserId).getAgencyId();
userForm.setApp(loginUserApp);
userForm.setClient(loginUserClient);
userForm.setUserId(loginUserId);
String currUserAgencyId = userService.getLoginUserDetails( log.info("importIcResiInfoFromExcel:: currUserAgencyId:{}", currUserAgencyId);
loginUserUtil.getLoginUserApp(),
loginUserUtil.getLoginUserClient(),
loginUserUtil.getLoginUserId()).getAgencyId();
CustomerAgencyDTO agencyInfo = getResultDataOrThrowsException(govOrgOpenFeignClient.getAgencyById(currUserAgencyId), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null, null); CustomerAgencyDTO agencyInfo = getResultDataOrThrowsException(govOrgOpenFeignClient.getAgencyById(currUserAgencyId), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null, null);
String customerId = agencyInfo.getCustomerId(); String customerId = agencyInfo.getCustomerId();
@ -238,6 +228,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
initImportThreadLocal(customerId); initImportThreadLocal(customerId);
// 上传主表信息 // 上传主表信息
log.info("======开始导入基础信息=======");
importIcResiBaseInfoFromExcel(formItemList,excelPathName, IcResiUserTableEnum.IC_RESI_USER.getSheetNo(), IcResiUserTableEnum.IC_RESI_USER.getHeadRowNo(), importIcResiBaseInfoFromExcel(formItemList,excelPathName, IcResiUserTableEnum.IC_RESI_USER.getSheetNo(), IcResiUserTableEnum.IC_RESI_USER.getHeadRowNo(),
currUserAgencyId, agencyInfo.getPids(), loginUserId, IcResiUserTableEnum.IC_RESI_USER.getTableName(), customerId); currUserAgencyId, agencyInfo.getPids(), loginUserId, IcResiUserTableEnum.IC_RESI_USER.getTableName(), customerId);
@ -249,6 +240,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
} }
try { try {
log.info("======开始导入附加表:{}=======", sheet.getTableComment());
importIcResiExtraInfoFromExcel(formItemList, excelPathName, sheet, currUserAgencyId, loginUserId, customerId); importIcResiExtraInfoFromExcel(formItemList, excelPathName, sheet, currUserAgencyId, loginUserId, customerId);
} catch (Exception e) { } catch (Exception e) {
String errorMsg = ExceptionUtils.getErrorStackTrace(e); String errorMsg = ExceptionUtils.getErrorStackTrace(e);
@ -324,7 +316,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
*/ */
private void initImportThreadLocal(String customerId) { private void initImportThreadLocal(String customerId) {
// 生成importTag,用于标记唯一一次导入操作,导入完成之后,用来删除redis里面临时的key // 生成importTag,用于标记唯一一次导入操作,导入完成之后,用来删除redis里面临时的key
String operatorId = loginUserUtil.getLoginUserId(); String operatorId = ThreadLocalConstant.inheritableAdditionalHeaders.get().get(AppClientConstant.USER_ID.toLowerCase());
String importTag = operatorId + System.currentTimeMillis(); String importTag = operatorId + System.currentTimeMillis();
// 错误信息 // 错误信息
@ -364,6 +356,13 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
private void importIcResiBaseInfoFromExcel(List<FormItemResult> formItemList, String excelPathName, int sheetNo, int headRowNumber, String currUserAgencyId, String currUserAgencyPids, String currentUserId, private void importIcResiBaseInfoFromExcel(List<FormItemResult> formItemList, String excelPathName, int sheetNo, int headRowNumber, String currUserAgencyId, String currUserAgencyPids, String currentUserId,
String tableName, String customerId) { String tableName, String customerId) {
String loginUserApp = ThreadLocalConstant.inheritableAdditionalHeaders.get().get(AppClientConstant.APP);
String loginUserClient = ThreadLocalConstant.inheritableAdditionalHeaders.get().get(AppClientConstant.CLIENT);
String loginUserId = ThreadLocalConstant.inheritableAdditionalHeaders.get().get(AppClientConstant.USER_ID.toLowerCase());
String loginUserCustomerId = ThreadLocalConstant.inheritableAdditionalHeaders.get().get(AppClientConstant.CUSTOMER_ID.toLowerCase());
log.info("importIcResiBaseInfoFromExcel:: userId:{}, app:{}, client:{}, customerId:{}", loginUserId, loginUserApp, loginUserClient, loginUserCustomerId);
IcResiImportDynamicExcelListener readListener = new IcResiImportDynamicExcelListener(this, customerId, currentUserId, currUserAgencyId, currUserAgencyPids, IcResiImportDynamicExcelListener readListener = new IcResiImportDynamicExcelListener(this, customerId, currentUserId, currUserAgencyId, currUserAgencyPids,
true, tableName, formItemList, headRowNumber); true, tableName, formItemList, headRowNumber);
EasyExcel.read(new File(excelPathName)).registerReadListener(readListener).headRowNumber(headRowNumber).sheet(sheetNo).doRead(); EasyExcel.read(new File(excelPathName)).registerReadListener(readListener).headRowNumber(headRowNumber).sheet(sheetNo).doRead();
@ -416,6 +415,8 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
String currUserAgencyId, Map<Integer, String> checkBoxOptionColumnIdxAndLabel, String currUserAgencyId, Map<Integer, String> checkBoxOptionColumnIdxAndLabel,
String currUserAgencyPids, String currentUserId, String tableName) { String currUserAgencyPids, String currentUserId, String tableName) {
this.printLog("persistIcResiBaseInfo");
// 遍历每一行,将行内容转化为 // 遍历每一行,将行内容转化为
for (Map<Integer, String> row : dataRows) { for (Map<Integer, String> row : dataRows) {
@ -471,7 +472,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
columnAndValues.put("AGENCY_ID", currUserAgencyId); columnAndValues.put("AGENCY_ID", currUserAgencyId);
columnAndValues.put("PIDS", currUserAgencyPids); columnAndValues.put("PIDS", currUserAgencyPids);
columnAndValues.put("CUSTOMER_ID", loginUserUtil.getLoginUserCustomerId()); columnAndValues.put("CUSTOMER_ID", ThreadLocalConstant.inheritableAdditionalHeaders.get().get(AppClientConstant.CUSTOMER_ID.toLowerCase()));
columnAndValues.put("UPDATED_BY", currentUserId); columnAndValues.put("UPDATED_BY", currentUserId);
@ -541,6 +542,13 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
LinkedHashMap<String, String> columnAndValues = new LinkedHashMap<>(); LinkedHashMap<String, String> columnAndValues = new LinkedHashMap<>();
String loginUserApp = ThreadLocalConstant.inheritableAdditionalHeaders.get().get(AppClientConstant.APP);
String loginUserClient = ThreadLocalConstant.inheritableAdditionalHeaders.get().get(AppClientConstant.CLIENT);
String loginUserId = ThreadLocalConstant.inheritableAdditionalHeaders.get().get(AppClientConstant.USER_ID.toLowerCase());
String loginUserCustomerId = ThreadLocalConstant.inheritableAdditionalHeaders.get().get(AppClientConstant.CUSTOMER_ID.toLowerCase());
log.info("persistIcResiExtraInfo:: userId:{}, app:{}, client:{}, customerId:{}", loginUserId, loginUserApp, loginUserClient, loginUserCustomerId);
// 遍历每一行,将行内容转化为 // 遍历每一行,将行内容转化为
for (Map<Integer, String> row : dataRows) { for (Map<Integer, String> row : dataRows) {
@ -567,7 +575,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
String icResiId = existResiInfoMap.get("ID"); String icResiId = existResiInfoMap.get("ID");
columnAndValues.put("IC_RESI_USER", icResiId); columnAndValues.put("IC_RESI_USER", icResiId);
columnAndValues.put("CUSTOMER_ID", loginUserUtil.getLoginUserCustomerId()); columnAndValues.put("CUSTOMER_ID", loginUserCustomerId);
columnAndValues.put("UPDATED_BY", currentUserId); columnAndValues.put("UPDATED_BY", currentUserId);
// 移除excel中存在,但是数据库表中不存在的无效列,方式sql语法错误 // 移除excel中存在,但是数据库表中不存在的无效列,方式sql语法错误
@ -991,6 +999,8 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
List<OptionResultDTO> options = null; List<OptionResultDTO> options = null;
log.info("optionsUrl:{}, currUserAgencyId:{}", pureUri, currUserAgencyId);
this.printLog("listRemoteOptions");
switch (pureUri) { switch (pureUri) {
case "/epmetuser/icresidemanddict/demandoption": case "/epmetuser/icresidemanddict/demandoption":
options = getResultDataOrThrowsException(epmetUserOpenFeignClient.getDemandOptions(), ServiceConstant.EPMET_USER_SERVER, options = getResultDataOrThrowsException(epmetUserOpenFeignClient.getDemandOptions(), ServiceConstant.EPMET_USER_SERVER,
@ -1030,6 +1040,10 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
nform.setAgencyId(currUserAgencyId); nform.setAgencyId(currUserAgencyId);
} }
nform.setGridId(gridId); nform.setGridId(gridId);
this.printLog("listRemoteOptions#neighborhoodoption");
log.info("neighborhoodoption:{},{}", currUserAgencyId, gridId);
options = getResultDataOrThrowsException(govOrgOpenFeignClient.getNeighborHoodOptions(nform), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null, null); options = getResultDataOrThrowsException(govOrgOpenFeignClient.getNeighborHoodOptions(nform), ServiceConstant.GOV_ORG_SERVER, EpmetErrorCode.SERVER_ERROR.getCode(), null, null);
break; break;
case "/sys/dict/data/education": case "/sys/dict/data/education":
@ -1267,7 +1281,10 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
Date now = new Date(); Date now = new Date();
CustomerStaffInfoCacheResult operator = CustomerStaffRedis.getStaffInfo(loginUserUtil.getLoginUserCustomerId(), loginUserUtil.getLoginUserId()); String customerId = ThreadLocalConstant.inheritableAdditionalHeaders.get().get(AppClientConstant.CUSTOMER_ID.toLowerCase());
String userId = ThreadLocalConstant.inheritableAdditionalHeaders.get().get(AppClientConstant.USER_ID.toLowerCase());
CustomerStaffInfoCacheResult operator = CustomerStaffRedis.getStaffInfo(customerId, userId);
for (Map.Entry<String, ResiImportChangedData> entry : categoryChangedResis.entrySet()) { for (Map.Entry<String, ResiImportChangedData> entry : categoryChangedResis.entrySet()) {
String resiId = entry.getKey(); String resiId = entry.getKey();
@ -1296,7 +1313,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
} }
// 生成changeRecord并存入 // 生成changeRecord并存入
IcUserChangeRecordEntity changeRecord = fillChangeRecord(loginUserUtil.getLoginUserCustomerId(), resiId, resiInfoMap.get("NAME"), null, loginUserUtil.getLoginUserId(), IcUserChangeRecordEntity changeRecord = fillChangeRecord(customerId, resiId, resiInfoMap.get("NAME"), null, userId,
operator.getRealName() , descBefore, descAfter, "category", "类别", "", now); operator.getRealName() , descBefore, descAfter, "category", "类别", "", now);
icUserChangeRecordDao.insert(changeRecord); icUserChangeRecordDao.insert(changeRecord);
@ -1316,7 +1333,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
String unitId = newData.getUnitId(); String unitId = newData.getUnitId();
String homeId = newData.getHomeId(); String homeId = newData.getHomeId();
IcUserChangeDetailedEntity newDetail = fillChangeDetail(loginUserUtil.getLoginUserCustomerId(), resiId, changeRecord.getId(), agencyId, IcUserChangeDetailedEntity newDetail = fillChangeDetail(customerId, resiId, changeRecord.getId(), agencyId,
gridId, villageId, buildId, unitId, gridId, villageId, buildId, unitId,
homeId, "category", "类别", columnEntry.getKey(), 1, resiInfoMap.get("PIDS")); homeId, "category", "类别", columnEntry.getKey(), 1, resiInfoMap.get("PIDS"));
@ -1361,7 +1378,10 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
Set<String> newResiKeys = redisUtils.keys(RedisKeys.icResiImportTypeKey(newlyOrChangedResi.get().getImportTag(), "add").concat("*")); Set<String> newResiKeys = redisUtils.keys(RedisKeys.icResiImportTypeKey(newlyOrChangedResi.get().getImportTag(), "add").concat("*"));
CustomerStaffInfoCacheResult operator = CustomerStaffRedis.getStaffInfo(loginUserUtil.getLoginUserCustomerId(), loginUserUtil.getLoginUserId()); String customerId = ThreadLocalConstant.inheritableAdditionalHeaders.get().get(AppClientConstant.CUSTOMER_ID.toLowerCase());
String userId = ThreadLocalConstant.inheritableAdditionalHeaders.get().get(AppClientConstant.USER_ID.toLowerCase());
CustomerStaffInfoCacheResult operator = CustomerStaffRedis.getStaffInfo(customerId, userId);
for (String resiKey : newResiKeys) { for (String resiKey : newResiKeys) {
Map<String, Object> newResiInfoMap = redisUtils.hGetAll(resiKey); Map<String, Object> newResiInfoMap = redisUtils.hGetAll(resiKey);
@ -1370,14 +1390,14 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
IcResiUserEntity resiInfo = icResiUserDao.selectById(newResiInfoObj.getResiId()); IcResiUserEntity resiInfo = icResiUserDao.selectById(newResiInfoObj.getResiId());
// 插入changeRecord // 插入changeRecord
IcUserChangeRecordEntity changeRecord = fillChangeRecord(loginUserUtil.getLoginUserCustomerId(), newResiInfoObj.getResiId(), resiInfo.getName(), null, IcUserChangeRecordEntity changeRecord = fillChangeRecord(customerId, newResiInfoObj.getResiId(), resiInfo.getName(), null,
loginUserUtil.getLoginUserId(), operator.getRealName(), "-", "-", userId, operator.getRealName(), "-", "-",
"add", "新增", "", now); "add", "新增", "", now);
icUserChangeRecordDao.insert(changeRecord); icUserChangeRecordDao.insert(changeRecord);
// 插入changeDetail // 插入changeDetail
for (Map.Entry<String, String> mainTableColumn : newResiInfoObj.getCategories().entrySet()) { for (Map.Entry<String, String> mainTableColumn : newResiInfoObj.getCategories().entrySet()) {
IcUserChangeDetailedEntity changedetail = fillChangeDetail(loginUserUtil.getLoginUserCustomerId(), newResiInfoObj.getResiId(), changeRecord.getId(), newResiInfoObj.getAgencyId(), IcUserChangeDetailedEntity changedetail = fillChangeDetail(customerId, newResiInfoObj.getResiId(), changeRecord.getId(), newResiInfoObj.getAgencyId(),
newResiInfoObj.getGridId(), newResiInfoObj.getVillageId(), newResiInfoObj.getBuildId(), newResiInfoObj.getUnitId(), newResiInfoObj.getGridId(), newResiInfoObj.getVillageId(), newResiInfoObj.getBuildId(), newResiInfoObj.getUnitId(),
newResiInfoObj.getHomeId(), "add", "新增", mainTableColumn.getKey(), 1, resiInfo.getPids()); newResiInfoObj.getHomeId(), "add", "新增", mainTableColumn.getKey(), 1, resiInfo.getPids());
@ -1396,8 +1416,9 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
*/ */
public void saveTransferedResiRecord(Map<String, ResiImportChangedData> transferedResis) { public void saveTransferedResiRecord(Map<String, ResiImportChangedData> transferedResis) {
Date now = new Date(); Date now = new Date();
String customerId = loginUserUtil.getLoginUserCustomerId(); String loginUserId = ThreadLocalConstant.inheritableAdditionalHeaders.get().get(AppClientConstant.USER_ID.toLowerCase());
CustomerStaffInfoCacheResult operator = CustomerStaffRedis.getStaffInfo(customerId, loginUserUtil.getLoginUserId()); String loginUserCustomerId = ThreadLocalConstant.inheritableAdditionalHeaders.get().get(AppClientConstant.CUSTOMER_ID.toLowerCase());
CustomerStaffInfoCacheResult operator = CustomerStaffRedis.getStaffInfo(loginUserCustomerId, loginUserId);
for (Map.Entry<String, ResiImportChangedData> resi : transferedResis.entrySet()) { for (Map.Entry<String, ResiImportChangedData> resi : transferedResis.entrySet()) {
@ -1430,7 +1451,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
String newHomeId = newData.getHomeId(); String newHomeId = newData.getHomeId();
IcResiUserOrgMsgFormDTO oldOrgFormDTO = new IcResiUserOrgMsgFormDTO(); IcResiUserOrgMsgFormDTO oldOrgFormDTO = new IcResiUserOrgMsgFormDTO();
oldOrgFormDTO.setCustomerId(customerId); oldOrgFormDTO.setCustomerId(loginUserCustomerId);
oldOrgFormDTO.setAgencyId(oldAgencyId); oldOrgFormDTO.setAgencyId(oldAgencyId);
oldOrgFormDTO.setGridId(oldGridId); oldOrgFormDTO.setGridId(oldGridId);
oldOrgFormDTO.setNeighborHoodId(oldvillageId); oldOrgFormDTO.setNeighborHoodId(oldvillageId);
@ -1440,7 +1461,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
Result<IcResiUserOrgMsgResultDTO> oldOrgInfoRst = govOrgOpenFeignClient.icResiUserOrgMsg(oldOrgFormDTO); Result<IcResiUserOrgMsgResultDTO> oldOrgInfoRst = govOrgOpenFeignClient.icResiUserOrgMsg(oldOrgFormDTO);
IcResiUserOrgMsgFormDTO newOrgInfo = new IcResiUserOrgMsgFormDTO(); IcResiUserOrgMsgFormDTO newOrgInfo = new IcResiUserOrgMsgFormDTO();
newOrgInfo.setCustomerId(customerId); newOrgInfo.setCustomerId(loginUserCustomerId);
newOrgInfo.setAgencyId(newAgencyId); newOrgInfo.setAgencyId(newAgencyId);
newOrgInfo.setGridId(newGridId); newOrgInfo.setGridId(newGridId);
newOrgInfo.setNeighborHoodId(newvillageId); newOrgInfo.setNeighborHoodId(newvillageId);
@ -1510,13 +1531,13 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
} }
// 保存 transferRecord // 保存 transferRecord
IcUserTransferRecordEntity transferRecord = fillTransferRecord(resiId, resiName, operator, customerId, IcUserTransferRecordEntity transferRecord = fillTransferRecord(resiId, resiName, operator, loginUserCustomerId,
oldAgencyId, oldGridId, oldvillageId, oldBuildId, oldUnitId, oldHomeId, customerId, oldAgencyId, oldGridId, oldvillageId, oldBuildId, oldUnitId, oldHomeId, loginUserCustomerId,
newAgencyId, newGridId, newvillageId, newBuildId, newUnitId, newHomeId, oldOrg, newOrg); newAgencyId, newGridId, newvillageId, newBuildId, newUnitId, newHomeId, oldOrg, newOrg);
icUserTransferRecordDao.insert(transferRecord); icUserTransferRecordDao.insert(transferRecord);
// 保存 调动changeRecord // 保存 调动changeRecord
IcUserChangeRecordEntity transferChangeRecord = fillChangeRecord(customerId, resiId, resiName, transferRecord.getId(), operator.getStaffId(), IcUserChangeRecordEntity transferChangeRecord = fillChangeRecord(loginUserCustomerId, resiId, resiName, transferRecord.getId(), operator.getStaffId(),
operator.getRealName(), sbBefore.toString(), sbAfter.toString(), "transfer", "调动", "", now); operator.getRealName(), sbBefore.toString(), sbAfter.toString(), "transfer", "调动", "", now);
icUserChangeRecordDao.insert(transferChangeRecord); icUserChangeRecordDao.insert(transferChangeRecord);
@ -1550,7 +1571,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
String categoryDescAfter = sbAfter.toString(); String categoryDescAfter = sbAfter.toString();
if (!StringUtils.isAllBlank(categoryDescBefore, categoryDescAfter)) { if (!StringUtils.isAllBlank(categoryDescBefore, categoryDescAfter)) {
IcUserChangeRecordEntity categoryChangeRecord = fillChangeRecord(customerId, resiId, resiName, transferRecord.getId(), operator.getStaffId(), IcUserChangeRecordEntity categoryChangeRecord = fillChangeRecord(loginUserCustomerId, resiId, resiName, transferRecord.getId(), operator.getStaffId(),
operator.getRealName(), categoryDescBefore, categoryDescAfter , "category", "类别", "", now); operator.getRealName(), categoryDescBefore, categoryDescAfter , "category", "类别", "", now);
icUserChangeRecordDao.insert(categoryChangeRecord); icUserChangeRecordDao.insert(categoryChangeRecord);
} }
@ -1563,7 +1584,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
// 之前是这个类型,那这个类型需要-1 // 之前是这个类型,那这个类型需要-1
String oldValue = oldCategories.getValue(); String oldValue = oldCategories.getValue();
if ("1".equals(oldValue)) { if ("1".equals(oldValue)) {
IcUserChangeDetailedEntity changeDetail = fillChangeDetail(customerId, resiId, transferChangeRecord.getId(), oldAgencyId, IcUserChangeDetailedEntity changeDetail = fillChangeDetail(loginUserCustomerId, resiId, transferChangeRecord.getId(), oldAgencyId,
oldGridId, oldvillageId, oldBuildId, oldUnitId, oldGridId, oldvillageId, oldBuildId, oldUnitId,
oldHomeId, transferChangeRecord.getType(), transferChangeRecord.getTypeName(), key, -1, pids); oldHomeId, transferChangeRecord.getType(), transferChangeRecord.getTypeName(), key, -1, pids);
icUserChangeDetailedDao.insert(changeDetail); icUserChangeDetailedDao.insert(changeDetail);
@ -1577,7 +1598,7 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
// 现在是这个类型,这个类型要+1 // 现在是这个类型,这个类型要+1
if ("1".equals(newValue)) { if ("1".equals(newValue)) {
IcUserChangeDetailedEntity changeDetail = fillChangeDetail(customerId, resiId, transferChangeRecord.getId(), newAgencyId, IcUserChangeDetailedEntity changeDetail = fillChangeDetail(loginUserCustomerId, resiId, transferChangeRecord.getId(), newAgencyId,
newGridId, newvillageId, newBuildId, newUnitId, newGridId, newvillageId, newBuildId, newUnitId,
newHomeId, transferChangeRecord.getType(), transferChangeRecord.getTypeName(), key, 1, pids); newHomeId, transferChangeRecord.getType(), transferChangeRecord.getTypeName(), key, 1, pids);
icUserChangeDetailedDao.insert(changeDetail); icUserChangeDetailedDao.insert(changeDetail);
@ -1808,4 +1829,13 @@ public class IcResiUserImportServiceImpl implements IcResiUserImportService, Res
importTaskId, processStatus, operatorId, resultDesc, resultDescPath); importTaskId, processStatus, operatorId, resultDesc, resultDescPath);
} }
} }
public void printLog(String positionPrefix) {
String app = ThreadLocalConstant.inheritableAdditionalHeaders.get().get(AppClientConstant.APP);
String client = ThreadLocalConstant.inheritableAdditionalHeaders.get().get(AppClientConstant.CLIENT);
String loginUserId = ThreadLocalConstant.inheritableAdditionalHeaders.get().get(AppClientConstant.USER_ID.toLowerCase());
String loginUserCustomerId = ThreadLocalConstant.inheritableAdditionalHeaders.get().get(AppClientConstant.CUSTOMER_ID.toLowerCase());
log.info("{}:: userId:{}, app:{}, client:{}, customerId:{}", positionPrefix, loginUserId, app, client, loginUserCustomerId);
}
} }

Loading…
Cancel
Save