Browse Source

Merge remote-tracking branch 'remotes/origin/dev' into dev_bugfix_ljj

# Conflicts:
#	epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java
dev_shibei_match
jianjun 5 years ago
parent
commit
0083d90f53
  1. 2
      epmet-auth/src/main/resources/logback-spring.xml
  2. 4
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java
  3. 7
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/constant/ThreadLocalConstant.java
  4. 129
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java
  5. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/AgencyScoreDao.java
  6. 1
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/indexcal/DeptScoreDao.java
  7. 8
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/dao/evaluationindex/screen/ScreenCustomerAgencyDao.java
  8. 19
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/evaluationindex/indexcal/impl/IndexCalculateDistrictServiceImpl.java
  9. 50
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/AgencyScoreDao.xml
  10. 21
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcal/DeptScoreDao.xml
  11. 3
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/indexcoll/FactIndexPartyAblityOrgMonthlyDao.xml
  12. 14
      epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml

2
epmet-auth/src/main/resources/logback-spring.xml

@ -139,7 +139,7 @@
</appender>
<!-- 开发、测试环境 -->
<springProfile name="dev,test">
<springProfile name="local,dev,test">
<logger name="org.springframework.web" level="INFO"/>
<logger name="org.springboot.sample" level="INFO"/>
<logger name="com.epmet" level="INFO"/>

4
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/BaseRequestLogAspect.java

@ -1,6 +1,7 @@
package com.epmet.commons.tools.aspect;
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;
@ -12,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;
/**
* 日志切面
@ -61,7 +63,7 @@ public abstract class BaseRequestLogAspect {
try {
Object[] args = point.getArgs();
ThreadLocalConstant.requestParam.set(objectsToString(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);

7
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<String> sqlFilter = new ThreadLocal();
/**
* 用于本次的获取请求参数
*/
public static final ThreadLocal<String> requestParam = new ThreadLocal();
}

129
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,7 +16,11 @@ 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.regex.Matcher;
import java.util.regex.Pattern;
@ -63,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");
@ -158,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(<generated>)\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(<generated>)\n" +
" at com.epmet.controller.ResiVolunteerController.authenticate(ResiVolunteerController.java:59)\n" +
" at com.epmet.controller.ResiVolunteerController$$FastClassBySpringCGLIB$$e023fb55.invoke(<generated>)\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(<generated>)\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);
}

2
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<AgencyScoreEntity> {
* @date 2021/1/15 下午4:23
*/
List<AgencyScoreDTO> selectAgencyScoreInfoExistsSub(@Param("areaCode") String areaCode,@Param("areaCodeLength") Integer areaCodeLength, @Param("monthId")String monthId, @Param("dataType")String dataType);
List<AgencyScoreDTO> selectAgencyScoreInfoExistsSubSelf(@Param("areaCode") String areaCode, @Param("monthId")String monthId, @Param("dataType")String dataType);
/**
* @Description 区下级街道得分平均值
@ -91,6 +92,7 @@ public interface AgencyScoreDao extends BaseDao<AgencyScoreEntity> {
* @date 2021/1/18 上午9:09
*/
List<SubAgencyScoreAvgResultDTO> selectAgencyScoreAvgExistsSub(@Param("monthId")String monthId, @Param("indexCode")String indexCode,@Param("dataType")String dataType,@Param("areaCode")String areaCode,@Param("areaCodeLength")Integer areaCodeLength);
List<SubAgencyScoreAvgResultDTO> selectAgencyScoreAvgByOrgIds(@Param("monthId")String monthId, @Param("indexCode")String indexCode,@Param("orgIds")List<String> orgIds);
/**

1
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<DeptScoreEntity> {
* @date 2021/1/18 上午9:31
*/
List<SubAgencyScoreAvgResultDTO> selectGovernDeptScoreAvgExistsSub(@Param("areaCode")String areaCode, @Param("monthId")String monthId, @Param("indexCode")String indexCode);
List<SubAgencyScoreAvgResultDTO> selectGovernDeptScoreAvgExistsSubNotSelf(@Param("areaCode")String areaCode, @Param("monthId")String monthId, @Param("indexCode")String indexCode);
/**
* @return int

8
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<ScreenCustomerAgencyEnt
List<ScreenProjectOrgDailyDTO> selectAgencyByCustomer(@Param("customerId")String customerId);
List<ScreenProjectOrgDailyDTO> selectAgencyByAreaCode(String areaCode);
/**
* @Description 根据areaCode查询下级组织
* @Param areaCode
* @author zxc
* @date 2021/3/9 上午9:41
*/
List<ScreenProjectOrgDailyDTO> selectAgencyByParentAreaCode(@Param("areaCode") String areaCode);
}

19
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<IndexInputVO> indexInputVOS = new ArrayList<>();
Map<String, String> pid = new HashMap<>();
List<ScreenProjectOrgDailyDTO> orgInfos = customerAgencyDao.selectAgencyByParentAreaCode(form.getCustomerAreaCode());
//党建能力平均值
indexDetailList.forEach(detail -> {
if (IndexCodeEnum.QU_XIA_JI_JIE_DDJNLHZPJZ.getCode().equals(detail.getIndexCode())) {
List<SubAgencyScoreAvgResultDTO> subGridPartyAvgScore = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId,IndexCodeEnum.DANG_JIAN_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL,form.getCustomerAreaCode(),NumConstant.SIX);
List<SubAgencyScoreAvgResultDTO> 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<Map<String, Object>> publishArticleCountList = factIndexPartyAblityOrgMonthlyDao.selectPublishArticleCountMapExistSub(monthId,form.getCustomerAreaCode(),NumConstant.SIX);
List<Map<String, Object>> 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<IndexInputVO> indexInputVOS = new ArrayList<>();
Map<String, String> pid = new HashMap<>();
List<ScreenProjectOrgDailyDTO> orgInfos = customerAgencyDao.selectAgencyByParentAreaCode(form.getCustomerAreaCode());
detailListByParentCode.forEach(detail -> {
if (IndexCodeEnum.SUO_YOU_JIE_DAO_ZLNLPJZ.getCode().equals(detail.getIndexCode())) {
List<SubAgencyScoreAvgResultDTO> districtGovernAvgList = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL,form.getCustomerAreaCode(),NumConstant.SIX);
// List<SubAgencyScoreAvgResultDTO> districtGovernAvgList = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL,form.getCustomerAreaCode(),NumConstant.SIX);
List<SubAgencyScoreAvgResultDTO> 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<SubAgencyScoreAvgResultDTO> deptScoreAvgList = deptScoreDao.selectGovernDeptScoreAvgExistsSub(monthId, IndexCodeEnum.ZHI_LI_NENG_LI.getCode(),form.getCustomerAreaCode());
List<SubAgencyScoreAvgResultDTO> 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<IndexInputVO> indexInputVOS = new ArrayList<>();
Map<String, String> pid = new HashMap<>();
List<ScreenProjectOrgDailyDTO> orgInfos = customerAgencyDao.selectAgencyByParentAreaCode(form.getCustomerAreaCode());
detailListByParentCode.forEach(detail -> {
String indexCode = detail.getIndexCode();
if (IndexCodeEnum.QU_XIA_SHU_JIE_DFWNLHZPJZ.getCode().equals(indexCode)) {
List<SubAgencyScoreAvgResultDTO> subStreetAvgList = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL,form.getCustomerAreaCode(),NumConstant.SIX);
// List<SubAgencyScoreAvgResultDTO> subStreetAvgList = agencyScoreDao.selectAgencyScoreAvgExistsSub(monthId,IndexCodeEnum.FU_WU_NENG_LI.getCode(),IndexCalConstant.STREET_LEVEL,form.getCustomerAreaCode(),NumConstant.SIX);
List<SubAgencyScoreAvgResultDTO> 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<IndexGroupDetailEntity> detailListByParentCode = indexGroupDetailService.getDetailListByParentCode(customerId, IndexCodeEnum.SHE_QU_XIANG_GUAN.getCode());
List<AgencyScoreDTO> agencyScoreList = agencyScoreDao.selectAgencyScoreInfoExistsSub(form.getCustomerAreaCode(),NumConstant.SIX,monthId, IndexCalConstant.DISTRICT_LEVEL);
List<AgencyScoreDTO> agencyScoreList = agencyScoreDao.selectAgencyScoreInfoExistsSubSelf(form.getCustomerAreaCode(),monthId, IndexCalConstant.DISTRICT_LEVEL);
detailListByParentCode.forEach(detail -> {
agencyScoreList.forEach(community -> {
if (detail.getIndexCode().equals(community.getIndexCode())) {

50
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
</select>
<select id="selectAgencyScoreAvgByOrgIds" resultType="com.epmet.dto.indexcal.SubAgencyScoreAvgResultDTO">
SELECT
fics.agency_id AS agencyId,
fics.month_id AS monthId,
fics.quarter_id AS quarterId,
fics.year_id AS yearId,
ROUND(AVG( fics.score ),6) AS score,
fics.customer_id AS customerId,
fics.PARENT_AGENCY_ID AS parentId
FROM
fact_index_agency_score fics
WHERE
fics.del_flag = '0'
AND fics.month_id = #{monthId}
AND fics.index_code = #{indexCode}
AND (
<foreach collection="orgIds" item="org" separator=" or ">
fics.agency_id = #{org}
</foreach>
)
GROUP BY AGENCY_ID
</select>
<select id="selectAgencyScoreInfoExistsSubSelf" resultType="com.epmet.dto.indexcal.AgencyScoreDTO">
SELECT
fias.CUSTOMER_ID,
fias.AGENCY_ID,
fias.MONTH_ID,
fias.QUARTER_ID,
fias.YEAR_ID,
fias.SCORE,
fias.INDEX_CODE,
fias.PARENT_AGENCY_ID
FROM
fact_index_agency_score fias
LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = fias.AGENCY_ID
WHERE
fias.del_flag = 0
AND sca.AREA_CODE = #{areaCode}
AND fias.MONTH_ID = #{monthId}
AND fias.IS_TOTAL = "0"
AND (fias.INDEX_CODE = "zhilinengli"
OR fias.INDEX_CODE = "dangjiannengli"
OR fias.INDEX_CODE = "fuwunengli")
</select>
</mapper>

21
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
</select>
<select id="selectGovernDeptScoreAvgExistsSubNotSelf" resultType="com.epmet.dto.indexcal.SubAgencyScoreAvgResultDTO">
SELECT
fidc.agency_id,
fidc.month_id,
fidc.quarter_id,
fidc.year_id,
AVG( fidc.score ) AS score,
fidc.customer_id,
sca.pid AS parentId
FROM
fact_index_dept_score fidc
LEFT JOIN screen_customer_agency sca ON sca.AGENCY_ID = fidc.AGENCY_ID
WHERE
fidc.del_flag = '0'
AND fidc.IS_TOTAL = '0'
AND sca.AREA_CODE LIKE CONCAT(#{areaCode},'%')
AND sca.AREA_CODE != #{areaCode}
AND fidc.month_id = #{monthId}
AND fidc.index_code = #{indexCode}
GROUP BY fidc.agency_id
</select>
</mapper>

3
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}
</select>
<select id="selectPublishArticleCountMapbyAreaCodeNotSelf" resultType="java.util.Map">

14
epmet-module/data-statistical/data-statistical-server/src/main/resources/mapper/evaluationindex/screen/ScreenCustomerAgencyDao.xml

@ -390,4 +390,18 @@
WHERE DEL_FLAG = 0
and sca.AREA_CODE like CONCAT(#{areaCode},'%')
</select>
<!-- 根据areaCode查询下级组织 -->
<select id="selectAgencyByParentAreaCode" resultType="com.epmet.dto.screen.ScreenProjectOrgDailyDTO">
SELECT
sca.CUSTOMER_ID,
sca.AGENCY_ID AS orgId,
sca.PID,
sca.PIDS,
sca.`LEVEL` AS orgType,
sca.AREA_CODE
FROM screen_customer_agency sca
WHERE DEL_FLAG = 0
and sca.PARENT_AREA_CODE = #{areaCode}
</select>
</mapper>

Loading…
Cancel
Save