From a516d6c965ddebc90106dbd39718995c5975d6d7 Mon Sep 17 00:00:00 2001 From: jianjun Date: Mon, 8 Mar 2021 14:46:38 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E9=94=99=E8=AF=AF=E6=8F=90=E9=86=92?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E8=AF=B7=E6=B1=82=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E5=8F=8A=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/logback-spring.xml | 2 +- .../tools/aspect/BaseRequestLogAspect.java | 3 + .../tools/constant/ThreadLocalConstant.java | 7 +- .../tools/filter/LogMsgSendFilter.java | 130 ++++-------------- 4 files changed, 39 insertions(+), 103 deletions(-) diff --git a/epmet-auth/src/main/resources/logback-spring.xml b/epmet-auth/src/main/resources/logback-spring.xml index 734c4114a1..0152e72505 100644 --- a/epmet-auth/src/main/resources/logback-spring.xml +++ b/epmet-auth/src/main/resources/logback-spring.xml @@ -139,7 +139,7 @@ - + diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java index ff877a04be..02c3d8f18a 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java @@ -1,6 +1,8 @@ package com.epmet.commons.tools.aspect; +import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.constant.AppClientConstant; +import com.epmet.commons.tools.constant.ThreadLocalConstant; import com.epmet.commons.tools.exception.*; import com.epmet.commons.tools.utils.Result; import org.apache.commons.lang3.StringUtils; @@ -61,6 +63,7 @@ public abstract class BaseRequestLogAspect { try { Object[] args = point.getArgs(); + ThreadLocalConstant.requestParam.set(JSON.toJSONString(args)); log.info(">>>>>>>>请求信息>>>>>>>>:事务流水号:{},url:{} ,method:{},请求参数:{}", transactionSerial, requestURI, method, objectsToString(args)); result = point.proceed(); resultInfoLog(transactionSerial, getExecPeriod(startTime), result); diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ThreadLocalConstant.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ThreadLocalConstant.java index 2dad0d6dba..6a2b304cfa 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ThreadLocalConstant.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ThreadLocalConstant.java @@ -1,7 +1,5 @@ package com.epmet.commons.tools.constant; -import com.epmet.commons.tools.dto.form.LoginUserInfoResultDTO; - /** * ThreadLocal常亮 */ @@ -16,4 +14,9 @@ public class ThreadLocalConstant { * 用于向DataFilterInterceptor传递权限过滤的sql片段(需要在Controller相关的AOP中进行清理,防止变量残留) */ public static final ThreadLocal sqlFilter = new ThreadLocal(); + + /** + * 用于本次的获取请求参数 + */ + public static final ThreadLocal requestParam = new ThreadLocal(); } diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java index 4e2f0d16ab..df8121e059 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java @@ -6,6 +6,7 @@ import ch.qos.logback.classic.spi.ILoggingEvent; import ch.qos.logback.classic.spi.IThrowableProxy; import ch.qos.logback.classic.spi.StackTraceElementProxy; import ch.qos.logback.core.spi.FilterReply; +import com.epmet.commons.tools.constant.ThreadLocalConstant; import com.epmet.commons.tools.dto.form.DingTalkTextMsg; import com.epmet.commons.tools.enums.EnvEnum; import com.epmet.commons.tools.utils.DingdingMsgSender; @@ -15,9 +16,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.cloud.commons.util.InetUtils; import org.springframework.core.env.Environment; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; +import javax.servlet.http.HttpServletRequest; import java.text.SimpleDateFormat; -import java.util.Arrays; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -64,14 +68,26 @@ public class LogMsgSendFilter extends LevelFilter { stringBuilder.append("IP地址:" + serverIp); stringBuilder.append("\n"); } + stringBuilder.append("故障时间:" + formatLongTime2Str(event.getTimeStamp())); stringBuilder.append("\n"); stringBuilder.append("TraceId:" + Thread.currentThread().getName()); stringBuilder.append("\n"); + + HttpServletRequest request = getRequest(); + if (request != null) { + String requestURI = request.getRequestURI(); + stringBuilder.append("请求路径:" + requestURI); + stringBuilder.append("\n"); + + stringBuilder.append("请求参数:" + ThreadLocalConstant.requestParam.get()); + stringBuilder.append("\n"); + } + String formattedMessage = event.getFormattedMessage(); IThrowableProxy throwableProxy = event.getThrowableProxy(); if (throwableProxy == null && formattedMessage.length() > 1000) { - formattedMessage = formattedMessage.substring(0, getCharacterPosition(formattedMessage, baseProjectPackage, 5)); + formattedMessage = formattedMessage.substring(0, getCharacterPosition(formattedMessage, baseProjectPackage, 5)); } stringBuilder.append("告警信息:" + formattedMessage); stringBuilder.append("\n"); @@ -159,105 +175,19 @@ public class LogMsgSendFilter extends LevelFilter { } } - public static void main(String[] args) { - String msg = "<<<<<<<<异常响应<<<<<<<<:事务流水号:na1597027822634, 执行时长:59ms, 响应数据:{\"code\":8102,\"internalMsg\":\"验证码错误\",\"msg\":\"验证码错误\"}, 异常信息:验证码错误, 堆栈信息:com.epmet.commons.tools.exception.RenException: \n" + - " at com.epmet.service.impl.VolunteerInfoServiceImpl.authenticate(VolunteerInfoServiceImpl.java:91)\n" + - " at com.epmet.service.impl.VolunteerInfoServiceImpl$$FastClassBySpringCGLIB$$7babb2e8.invoke()\n" + - " at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)\n" + - " at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:750)\n" + - " at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)\n" + - " at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:295)\n" + - " at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:98)\n" + - " at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)\n" + - " at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)\n" + - " at com.epmet.service.impl.VolunteerInfoServiceImpl$$EnhancerBySpringCGLIB$$f78b4778.authenticate()\n" + - " at com.epmet.controller.ResiVolunteerController.authenticate(ResiVolunteerController.java:59)\n" + - " at com.epmet.controller.ResiVolunteerController$$FastClassBySpringCGLIB$$e023fb55.invoke()\n" + - " at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218)\n" + - " at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:750)\n" + - " at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)\n" + - " at org.springframework.aop.framework.adapter.MethodBeforeAdviceInterceptor.invoke(MethodBeforeAdviceInterceptor.java:56)\n" + - " at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)\n" + - " at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:88)\n" + - " at com.epmet.commons.tools.aspect.BaseRequestLogAspect.proceed(BaseRequestLogAspect.java:66)\n" + - " at com.epmet.aspect.RequestLogAspect.proceed(RequestLogAspect.java:26)\n" + - " at sun.reflect.GeneratedMethodAccessor195.invoke(Unknown Source)\n" + - " at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n" + - " at java.lang.reflect.Method.invoke(Method.java:498)\n" + - " at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:644)\n" + - " at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:633)\n" + - " at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:70)\n" + - " at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)\n" + - " at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:93)\n" + - " at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:186)\n" + - " at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689)\n" + - " at com.epmet.controller.ResiVolunteerController$$EnhancerBySpringCGLIB$$1c0751c0.authenticate()\n" + - " at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)\n" + - " at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)\n" + - " at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)\n" + - " at java.lang.reflect.Method.invoke(Method.java:498)\n" + - " at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:190)\n" + - " at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)\n" + - " at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105)\n" + - " at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:893)\n" + - " at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:798)\n" + - " at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)\n" + - " at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040)\n" + - " at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943)\n" + - " at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006)\n" + - " at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)\n" + - " at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)\n" + - " at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:883)\n" + - " at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" + - " at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" + - " at org.springframework.boot.actuate.web.trace.servlet.HttpTraceFilter.doFilterInternal(HttpTraceFilter.java:88)\n" + - " at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" + - " at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:100)\n" + - " at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" + - " at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:93)\n" + - " at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" + - " at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:94)\n" + - " at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" + - " at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.filterAndRecordMetrics(WebMvcMetricsFilter.java:114)\n" + - " at org.springframework.boot.actuate.metrics.web.servlet.WebMvcMetricsFilter.doFilterInternal(WebMvcMetricsFilter.java:104)\n" + - " at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" + - " at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:201)\n" + - " at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:119)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)\n" + - " at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)\n" + - " at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:202)\n" + - " at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)\n" + - " at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:526)\n" + - " at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)\n" + - " at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)\n" + - " at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)\n" + - " at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)\n" + - " at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:367)\n" + - " at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)\n" + - " at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860)\n" + - " at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1591)\n" + - " at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)\n" + - " at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\n" + - " at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\n" + - " at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)\n" + - " at java.lang.Thread.run(Thread.java:745)"; + /** + * 获取Request对象 + * + * @return + */ + private HttpServletRequest getRequest() { + RequestAttributes ra = RequestContextHolder.getRequestAttributes(); + ServletRequestAttributes sra = (ServletRequestAttributes) ra; + if (sra == null){ + return null; + } + return sra.getRequest(); - String substring = msg.substring(0, getCharacterPosition(msg, "com.epme1t", 5)); - System.out.println(substring); } From df3fe4cbaa0e5d83c5df80c37dd3a6c5b42cd721 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 9 Mar 2021 12:53:22 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=B9=B3=E9=98=B4=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=8A=BD=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../indexcal/AgencyScoreDao.java | 2 + .../indexcal/DeptScoreDao.java | 1 + .../screen/ScreenCustomerAgencyDao.java | 8 +++ .../IndexCalculateDistrictServiceImpl.java | 19 ++++--- .../indexcal/AgencyScoreDao.xml | 50 ++++++++++++++++++- .../evaluationindex/indexcal/DeptScoreDao.xml | 21 ++++++++ .../FactIndexPartyAblityOrgMonthlyDao.xml | 3 +- .../screen/ScreenCustomerAgencyDao.xml | 14 ++++++ 8 files changed, 109 insertions(+), 9 deletions(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java index 5e0d0585be..bc00d9e97b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java @@ -71,6 +71,7 @@ public interface AgencyScoreDao extends BaseDao { * @date 2021/1/15 下午4:23 */ List selectAgencyScoreInfoExistsSub(@Param("areaCode") String areaCode,@Param("areaCodeLength") Integer areaCodeLength, @Param("monthId")String monthId, @Param("dataType")String dataType); + List selectAgencyScoreInfoExistsSubSelf(@Param("areaCode") String areaCode, @Param("monthId")String monthId, @Param("dataType")String dataType); /** * @Description 区下级街道得分平均值 @@ -91,6 +92,7 @@ public interface AgencyScoreDao extends BaseDao { * @date 2021/1/18 上午9:09 */ List selectAgencyScoreAvgExistsSub(@Param("monthId")String monthId, @Param("indexCode")String indexCode,@Param("dataType")String dataType,@Param("areaCode")String areaCode,@Param("areaCodeLength")Integer areaCodeLength); + List selectAgencyScoreAvgByOrgIds(@Param("monthId")String monthId, @Param("indexCode")String indexCode,@Param("orgIds")List orgIds); /** diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java index a22317c371..cc35dbb875 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java @@ -77,6 +77,7 @@ public interface DeptScoreDao extends BaseDao { * @date 2021/1/18 上午9:31 */ List selectGovernDeptScoreAvgExistsSub(@Param("areaCode")String areaCode, @Param("monthId")String monthId, @Param("indexCode")String indexCode); + List selectGovernDeptScoreAvgExistsSubNotSelf(@Param("areaCode")String areaCode, @Param("monthId")String monthId, @Param("indexCode")String indexCode); /** * @return int diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java index f61e21f2ad..44eeb11fa6 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java @@ -194,4 +194,12 @@ public interface ScreenCustomerAgencyDao extends BaseDao selectAgencyByCustomer(@Param("customerId")String customerId); List selectAgencyByAreaCode(String areaCode); + + /** + * @Description 根据areaCode查询下级组织 + * @Param areaCode + * @author zxc + * @date 2021/3/9 上午9:41 + */ + List selectAgencyByParentAreaCode(@Param("areaCode") String areaCode); } diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java index 592c114fd4..5ea39f0d4c 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java +++ b/epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java @@ -23,6 +23,7 @@ import com.epmet.dto.indexcal.AgencyCalResultDTO; import com.epmet.dto.indexcal.AgencyScoreDTO; import com.epmet.dto.indexcal.CalculateCommonFormDTO; import com.epmet.dto.indexcal.SubAgencyScoreAvgResultDTO; +import com.epmet.dto.screen.ScreenProjectOrgDailyDTO; import com.epmet.dto.screen.result.MaxAndMinBigDecimalResultDTO; import com.epmet.entity.evaluationindex.indexcal.AgencySelfSubScoreEntity; import com.epmet.entity.evaluationindex.indexcal.AgencySubScoreEntity; @@ -604,10 +605,11 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict } List indexInputVOS = new ArrayList<>(); Map pid = new HashMap<>(); + List orgInfos = customerAgencyDao.selectAgencyByParentAreaCode(form.getCustomerAreaCode()); //党建能力平均值 indexDetailList.forEach(detail -> { if (IndexCodeEnum.QU_XIA_JI_JIE_DDJNLHZPJZ.getCode().equals(detail.getIndexCode())) { - List subGridPartyAvgScore = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL,form.getCustomerAreaCode(),NumConstant.SIX); + List subGridPartyAvgScore = agencyScoreDao.selectAgencyScoreAvgByOrgIds(monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),orgInfos.stream().map(o -> o.getOrgId()).collect(Collectors.toList())); if (CollectionUtils.isEmpty(subGridPartyAvgScore)) { log.warn(IndexCalConstant.DISTRICT_PARTY_AVG_NULL); } else if (subGridPartyAvgScore.size() > NumConstant.ZERO) { @@ -629,7 +631,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict } } else { // 区名义发文数量 - List> publishArticleCountList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMapExistSub(monthId,form.getCustomerAreaCode(),NumConstant.SIX); + List> publishArticleCountList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMapExistSubNotSelf(monthId,form.getCustomerAreaCode(),NumConstant.SIX); if (CollectionUtils.isEmpty(publishArticleCountList)) { log.warn(IndexCalConstant.DISTRICT_PUBLISH_ARTICLE_LIST_NULL); } else { @@ -682,9 +684,12 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict } List indexInputVOS = new ArrayList<>(); Map pid = new HashMap<>(); + List orgInfos = customerAgencyDao.selectAgencyByParentAreaCode(form.getCustomerAreaCode()); detailListByParentCode.forEach(detail -> { if (IndexCodeEnum.SUO_YOU_JIE_DAO_ZLNLPJZ.getCode().equals(detail.getIndexCode())) { - List districtGovernAvgList = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL,form.getCustomerAreaCode(),NumConstant.SIX); +// List districtGovernAvgList = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL,form.getCustomerAreaCode(),NumConstant.SIX); + List districtGovernAvgList = agencyScoreDao.selectAgencyScoreAvgByOrgIds(monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),orgInfos.stream().map(m -> m.getOrgId()).collect(Collectors.toList())); + log.info(districtGovernAvgList.toString()); for (int i = 0; i < districtGovernAvgList.size(); i++) { if (districtGovernAvgList.get(i).getAgencyId().equals(NumConstant.ZERO_STR)){ districtGovernAvgList.remove(districtGovernAvgList.get(i)); @@ -710,7 +715,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict }); } } else if (IndexCodeEnum.SUO_YOU_ZHI_SHU_BMZLNLPJZ.getCode().equals(detail.getIndexCode())){ - List deptScoreAvgList = deptScoreDao.selectGovernDeptScoreAvgExistsSub(monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),form.getCustomerAreaCode()); + List deptScoreAvgList = deptScoreDao.selectGovernDeptScoreAvgExistsSubNotSelf(monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),form.getCustomerAreaCode()); for (int i = 0; i < deptScoreAvgList.size(); i++) { if (deptScoreAvgList.get(i).getAgencyId().equals(NumConstant.ZERO_STR)){ deptScoreAvgList.remove(deptScoreAvgList.get(i)); @@ -762,10 +767,12 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict } List indexInputVOS = new ArrayList<>(); Map pid = new HashMap<>(); + List orgInfos = customerAgencyDao.selectAgencyByParentAreaCode(form.getCustomerAreaCode()); detailListByParentCode.forEach(detail -> { String indexCode = detail.getIndexCode(); if (IndexCodeEnum.QU_XIA_SHU_JIE_DFWNLHZPJZ.getCode().equals(indexCode)) { - List subStreetAvgList = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL,form.getCustomerAreaCode(),NumConstant.SIX); +// List subStreetAvgList = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL,form.getCustomerAreaCode(),NumConstant.SIX); + List subStreetAvgList = agencyScoreDao.selectAgencyScoreAvgByOrgIds(monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),orgInfos.stream().map(m -> m.getOrgId()).collect(Collectors.toList())); for (int i = 0; i < subStreetAvgList.size(); i++) { if (subStreetAvgList.get(i).getAgencyId().equals(NumConstant.ZERO_STR)){ subStreetAvgList.remove(subStreetAvgList.get(i)); @@ -815,7 +822,7 @@ public class IndexCalculateDistrictServiceImpl implements IndexCalculateDistrict String customerId = form.getCustomerId(); String monthId = form.getMonthId(); List detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode()); - List agencyScoreList = agencyScoreDao.selectAgencyScoreInfoExistsSub(form.getCustomerAreaCode(),NumConstant.SIX,monthId, IndexCalConstant.DISTRICT_LEVEL); + List agencyScoreList = agencyScoreDao.selectAgencyScoreInfoExistsSubSelf(form.getCustomerAreaCode(),monthId, IndexCalConstant.DISTRICT_LEVEL); detailListByParentCode.forEach(detail -> { agencyScoreList.forEach(community -> { if (detail.getIndexCode().equals(community.getIndexCode())) { diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml index 6ba1ac05cf..c082758802 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml @@ -142,6 +142,7 @@ WHERE fias.del_flag = 0 AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%') + AND sca.AREA_CODE != #{areaCode} AND fias.MONTH_ID = #{monthId} AND fias.data_type = #{dataType} AND fias.IS_TOTAL = "0" @@ -159,7 +160,7 @@ fics.year_id, ROUND(AVG( fics.score ),6) AS score, fics.customer_id, - PARENT_AGENCY_ID AS parentId + fics.PARENT_AGENCY_ID AS parentId FROM fact_index_agency_score fics LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = fics.PARENT_AGENCY_ID @@ -172,4 +173,51 @@ AND fics.DATA_TYPE = #{dataType} GROUP BY fics.parent_agency_id + + + + + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml index d5f2e9b8a0..f0dc795c8e 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml @@ -172,4 +172,25 @@ AND fidc.index_code = #{indexCode} GROUP BY fidc.agency_id + diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml index 9ce69d1128..c0f9e6e261 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml @@ -163,8 +163,7 @@ LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = pm.AGENCY_ID WHERE pm.del_flag = '0' - AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%') - AND sca.AREA_CODE != #{areaCode} + AND sca.AREA_CODE = #{areaCode} AND pm.month_id = #{monthId} + + + From 797011a8ef7b8b9c00ed649b3d5deb3f7ad2d797 Mon Sep 17 00:00:00 2001 From: zxc <1272811460@qq.com> Date: Tue, 9 Mar 2021 13:25:11 +0800 Subject: [PATCH 3/4] =?UTF-8?q?sql=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml index 9c3497f29e..5552a9df4b 100644 --- a/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml +++ b/epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml @@ -402,6 +402,6 @@ sca.AREA_CODE FROM screen_customer_agency sca WHERE DEL_FLAG = 0 - and sca.PARENT_AREA_CODE like #{areaCode} + and sca.PARENT_AREA_CODE = #{areaCode} From ff1d9694224c3ecb4ee249ccce693c55105862ec Mon Sep 17 00:00:00 2001 From: jianjun Date: Tue, 9 Mar 2021 14:05:59 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=8F=82=E6=95=B0=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/epmet/commons/tools/aspect/BaseRequestLogAspect.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java index 02c3d8f18a..4b3496ee36 100644 --- a/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java +++ b/epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java @@ -1,6 +1,5 @@ package com.epmet.commons.tools.aspect; -import com.alibaba.fastjson.JSON; import com.epmet.commons.tools.constant.AppClientConstant; import com.epmet.commons.tools.constant.ThreadLocalConstant; import com.epmet.commons.tools.exception.*; @@ -14,6 +13,7 @@ import org.springframework.dao.DuplicateKeyException; import javax.servlet.http.HttpServletRequest; import java.time.Duration; import java.time.LocalDateTime; +import java.util.Arrays; /** * 日志切面 @@ -63,7 +63,7 @@ public abstract class BaseRequestLogAspect { try { Object[] args = point.getArgs(); - ThreadLocalConstant.requestParam.set(JSON.toJSONString(args)); + ThreadLocalConstant.requestParam.set(Arrays.toString(point.getArgs())); log.info(">>>>>>>>请求信息>>>>>>>>:事务流水号:{},url:{} ,method:{},请求参数:{}", transactionSerial, requestURI, method, objectsToString(args)); result = point.proceed(); resultInfoLog(transactionSerial, getExecPeriod(startTime), result);