Browse Source

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

master
jianjun 5 years ago
parent
commit
54c22f6039
  1. 97
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java
  2. 2
      epmet-module/data-report/data-report-server/src/main/resources/mapper/project/ProjectDao.xml
  3. 1
      epmet-module/data-report/data-report-server/src/main/resources/mapper/topic/TopicDao.xml
  4. 4
      epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/GroupConstant.java
  5. 11
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java
  6. 16
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java
  7. 18
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java
  8. 67
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java
  9. 4
      epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml

97
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/LogMsgSendFilter.java

@ -0,0 +1,97 @@
package com.epmet.commons.tools.filter;
import ch.qos.logback.classic.Level;
import ch.qos.logback.classic.filter.LevelFilter;
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.utils.HttpClientManager;
import com.epmet.commons.tools.utils.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.SimpleDateFormat;
/**
* desc: 发送日志消息
*
* @date: 2020/6/24 17:47
* @author: jianjun liu
*/
public class LogMsgSendFilter extends LevelFilter {
private static final Logger logger = LoggerFactory.getLogger(LogMsgSendFilter.class);
@Override
public FilterReply decide(ILoggingEvent event) {
//如果日志级别等于设置的日志级别 则发送消息
if (event.getLevel().isGreaterOrEqual(Level.ERROR)) {
try {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("【日志告警】\n");
stringBuilder.append("\n");
stringBuilder.append("告警级别:" + event.getLevel());
stringBuilder.append("\n");
stringBuilder.append("故障时间:" + formatLongTime2Str(event.getTimeStamp()));
stringBuilder.append("\n");
stringBuilder.append("TraceId:" + Thread.currentThread().getName());
stringBuilder.append("\n");
stringBuilder.append("告警信息:" + event.getFormattedMessage());
stringBuilder.append("\n");
IThrowableProxy throwableProxy = event.getThrowableProxy();
//异常信息处理 暂时处理一级的5行数据
apendStackInfo(stringBuilder, throwableProxy);
Result<String> flag = HttpClientManager.getInstance().sendAlarmMsg(stringBuilder.toString());
if (!flag.success()) {
logger.warn("msgSender.sendMsg fail,param:{}", stringBuilder.toString());
}
} catch (Exception e) {
logger.warn("decide exception", e);
}
}
//交给其他filter继续向下处理
return super.decide(event);
}
private void apendStackInfo(StringBuilder stringBuilder, IThrowableProxy throwableProxy) {
int defaultRowLine = 5;
if (throwableProxy != null) {
stringBuilder.append("异常信息:")
.append(throwableProxy.getClassName())
.append(" : ")
.append(throwableProxy.getMessage())
.append("\n");
StackTraceElementProxy[] stackTraceElementProxyArray = throwableProxy.getStackTraceElementProxyArray();
StackTraceElementProxy stackTraceElementProxy = null;
if (stackTraceElementProxyArray.length < defaultRowLine) {
defaultRowLine = stackTraceElementProxyArray.length;
}
for (int i = 0; i < defaultRowLine; i++) {
stackTraceElementProxy = stackTraceElementProxyArray[i];
StackTraceElement stackTraceElement = stackTraceElementProxy.getStackTraceElement();
stringBuilder.append("\t\tat ");
stringBuilder.append(stackTraceElement.getClassName());
stringBuilder.append(".");
stringBuilder.append(stackTraceElement.getMethodName());
stringBuilder.append("(");
stringBuilder.append(stackTraceElement.getFileName());
stringBuilder.append(":");
stringBuilder.append(stackTraceElement.getLineNumber());
stringBuilder.append(")");
stringBuilder.append("\n");
}
}
}
private String formatLongTime2Str(long timestamp) {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
return dateFormat.format(timestamp);
}
}

2
epmet-module/data-report/data-report-server/src/main/resources/mapper/project/ProjectDao.xml

@ -159,7 +159,7 @@
) )
) a ) a
ORDER BY ORDER BY
a.project_total DESC a.project_total DESC, a.type ASC
</select> </select>
<select id="selectIncrTrendDaily" resultType="com.epmet.project.dto.result.ProjectIncrTrendResultDTO"> <select id="selectIncrTrendDaily" resultType="com.epmet.project.dto.result.ProjectIncrTrendResultDTO">

1
epmet-module/data-report/data-report-server/src/main/resources/mapper/topic/TopicDao.xml

@ -61,6 +61,7 @@
WHERE WHERE
del_flag = '0' del_flag = '0'
AND pid = #{agencyId} AND pid = #{agencyId}
AND agency_dim_type = 'all'
</select> </select>
<!--获取最后一天的所有话题数据--> <!--获取最后一天的所有话题数据-->

4
epmet-module/data-statistical/data-statistical-client/src/main/java/com/epmet/constant/GroupConstant.java

@ -29,8 +29,8 @@ public interface GroupConstant {
String CITY = "city"; String CITY = "city";
String PROVINCE = "province"; String PROVINCE = "province";
String ERRORGRIDDAILY = "groupGridDaily ==>【网格小组统计出错了... 维度:网格-日】customerId为:"; String STATS_FAILED_GRID_DAILY = "统计数据方法groupGridDaily【网格小组统计-网格-日】执行失败,客户ID:%s,统计日期:%s,异常信息:%s";
String ERRORAGENCYDAILY = "groupAgencyDaily ==>【网格小组统计出错了... 维度:机关-日】customerId为:"; String STATS_FAILED_AGENCY_DAILY = "统计数据方法groupAgencyDaily【网格小组统计-机关-日】执行失败,客户ID:%s,统计日期:%s,异常信息:%s";
} }

11
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsGroupServiceImpl.java

@ -34,8 +34,6 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
public class StatsGroupServiceImpl implements StatsGroupService { public class StatsGroupServiceImpl implements StatsGroupService {
@Autowired
private DimGridService dimGridService;
@Autowired @Autowired
private DimAgencyService dimAgencyService; private DimAgencyService dimAgencyService;
@Autowired @Autowired
@ -63,18 +61,15 @@ public class StatsGroupServiceImpl implements StatsGroupService {
List<String> customerIds; List<String> customerIds;
do { do {
customerIds = dimCustomerService.selectCustomerIdPage(pageNo,pageSize); customerIds = dimCustomerService.selectCustomerIdPage(pageNo,pageSize);
DimIdGenerator.DimIdBean dimIdBean = this.getDimIdBean(date);
if (customerIds.size() != NumConstant.ZERO){ if (customerIds.size() != NumConstant.ZERO){
customerIds.forEach(customerId -> { customerIds.forEach(customerId -> {
try { try {
DimIdGenerator.DimIdBean dimIdBean = this.getDimIdBean(date);
// List<DimGridEntity> gridsInfo = dimGridService.getGridListByCustomerId(customerId);
List<GridIdListByCustomerResultDTO> gridsInfo = customerGridService.getCustomerGridIdList(customerId, dimIdBean.getDateId()); List<GridIdListByCustomerResultDTO> gridsInfo = customerGridService.getCustomerGridIdList(customerId, dimIdBean.getDateId());
List<GroupGridDailyResultDTO> resultDTOS = groupDataService.groupGridDaily(customerId,dimIdBean,gridsInfo); List<GroupGridDailyResultDTO> resultDTOS = groupDataService.groupGridDaily(customerId,dimIdBean,gridsInfo);
factGroupGridDailyService.statisticsGroupGridDaily(resultDTOS,customerId); factGroupGridDailyService.statisticsGroupGridDaily(resultDTOS,customerId);
} catch (Exception e) { } catch (Exception e) {
log.error(GroupConstant.ERRORGRIDDAILY+customerId,e); log.error(String.format(GroupConstant.STATS_FAILED_GRID_DAILY,customerId,LocalDate.now(),e));
} }
}); });
} }
@ -101,7 +96,7 @@ public class StatsGroupServiceImpl implements StatsGroupService {
List<AgencyGroupDailyResultDTO> agencyGroupDaily = this.getAgencyGroupDaily(customerAgencyInfos, dimIdBean, customerId); List<AgencyGroupDailyResultDTO> agencyGroupDaily = this.getAgencyGroupDaily(customerAgencyInfos, dimIdBean, customerId);
factGroupAgencyDailyService.insertGroupAgencyDaily(agencyGroupDaily,customerId); factGroupAgencyDailyService.insertGroupAgencyDaily(agencyGroupDaily,customerId);
} catch (Exception e) { } catch (Exception e) {
log.error(GroupConstant.ERRORAGENCYDAILY+customerId,e); log.error(String.format(GroupConstant.STATS_FAILED_AGENCY_DAILY,customerId,LocalDate.now(),e));
} }
}); });
} }

16
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsIssueServiceImpl.java

@ -4,6 +4,7 @@ import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.constant.IssueConstant; import com.epmet.constant.IssueConstant;
import com.epmet.constant.ProjectConstant;
import com.epmet.dto.issue.IssueAgencyDTO; import com.epmet.dto.issue.IssueAgencyDTO;
import com.epmet.dto.issue.IssueGridDTO; import com.epmet.dto.issue.IssueGridDTO;
import com.epmet.dto.issue.IssueProjectDTO; import com.epmet.dto.issue.IssueProjectDTO;
@ -18,6 +19,7 @@ import com.epmet.service.StatsIssueService;
import com.epmet.service.project.ProjectService; import com.epmet.service.project.ProjectService;
import com.epmet.service.stats.*; import com.epmet.service.stats.*;
import com.epmet.util.DimIdGenerator; import com.epmet.util.DimIdGenerator;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -33,6 +35,7 @@ import java.util.stream.Collectors;
* @dscription * @dscription
* @date 2020/6/17 16:51 * @date 2020/6/17 16:51
*/ */
@Slf4j
@Service @Service
public class StatsIssueServiceImpl implements StatsIssueService { public class StatsIssueServiceImpl implements StatsIssueService {
@Autowired @Autowired
@ -60,11 +63,17 @@ public class StatsIssueServiceImpl implements StatsIssueService {
int pageSize = 100; int pageSize = 100;
List<String> customerIdList = null; List<String> customerIdList = null;
do { do {
//获取当前日期前一天
Date date = DateUtils.getBeforeDay(new Date());
customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize); customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize);
if (!CollectionUtils.isEmpty(customerIdList)) { if (!CollectionUtils.isEmpty(customerIdList)) {
for (String customerId : customerIdList) { for (String customerId : customerIdList) {
//遍历统计每一个客户数据 //遍历统计每一个客户数据
customerStats(customerId); try {
customerStats(customerId, date);
} catch(Exception e) {
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "agencyGridIssueStats", DateUtils.format(date), e.getMessage()));
}
} }
} }
} while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize); } while (!CollectionUtils.isEmpty(customerIdList) && customerIdList.size() == pageSize);
@ -77,10 +86,7 @@ public class StatsIssueServiceImpl implements StatsIssueService {
* @param customerId * @param customerId
* @return void * @return void
*/ */
@Async private void customerStats(String customerId, Date date) {
public void customerStats(String customerId) {
//获取当前日期前一天
Date date = DateUtils.getBeforeDay(new Date());
//机关议题日统计 //机关议题日统计
saveIssueAgencyDaily(customerId, date); saveIssueAgencyDaily(customerId, date);
//机关议题月统计 //机关议题月统计

18
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsProjectServiceImpl.java

@ -113,13 +113,21 @@ public class StatsProjectServiceImpl implements StatsProjectService {
//5:机关层级日月统计 //5:机关层级日月统计
if (null != dimAgencyList && dimAgencyList.size() > NumConstant.ZERO) { if (null != dimAgencyList && dimAgencyList.size() > NumConstant.ZERO) {
//5.1:执行机关日数据统计 //5.1:执行机关日数据统计
try {
log.info("StatsProjectServiceImpl.customerAgencyStats-开始执行机关日统计方法,方法名:agencyDateProjectStats,客户Id:" + customerId); log.info("StatsProjectServiceImpl.customerAgencyStats-开始执行机关日统计方法,方法名:agencyDateProjectStats,客户Id:" + customerId);
agencyDateProjectStats(customerId, dimId, dimAgencyList, projectList, processList); agencyDateProjectStats(customerId, dimId, dimAgencyList, projectList, processList);
} catch (Exception e) {
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "agencyDateProjectStats", customerId, dimId.getDateId(), e.getMessage()));
}
//5.2:执行机关月数据统计 //5.2:执行机关月数据统计
//if (Calendar.getInstance().get(Calendar.DATE) == 1) { //if (Calendar.getInstance().get(Calendar.DATE) == 1) {
try {
log.info("StatsProjectServiceImpl.customerAgencyStats-开始执行机关月统计方法,方法名:agencyMonthProjectStats,客户Id:" + customerId); log.info("StatsProjectServiceImpl.customerAgencyStats-开始执行机关月统计方法,方法名:agencyMonthProjectStats,客户Id:" + customerId);
agencyMonthProjectStats(customerId, dimId, dimAgencyList); agencyMonthProjectStats(customerId, dimId, dimAgencyList);
} catch (Exception e) {
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "agencyMonthProjectStats", customerId, dimId.getMonthId(), e.getMessage()));
}
//} //}
} }
@ -397,13 +405,21 @@ public class StatsProjectServiceImpl implements StatsProjectService {
//5:网格层级日月统计 //5:网格层级日月统计
if (null != dimGridList && dimGridList.size() > NumConstant.ZERO) { if (null != dimGridList && dimGridList.size() > NumConstant.ZERO) {
//5.1:执行网格日数据统计 //5.1:执行网格日数据统计
try {
log.info("StatsProjectServiceImpl.customerGridStats-开始执行机关日统计方法,方法名:gridDateProjectStats,客户Id:" + customerId); log.info("StatsProjectServiceImpl.customerGridStats-开始执行机关日统计方法,方法名:gridDateProjectStats,客户Id:" + customerId);
gridDateProjectStats(customerId, dimId, dimGridList, projectList, processList); gridDateProjectStats(customerId, dimId, dimGridList, projectList, processList);
} catch (Exception e) {
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "gridDateProjectStats", customerId, dimId.getDateId(), e.getMessage()));
}
//5.2:执行网格月数据统计 //5.2:执行网格月数据统计
//if (Calendar.getInstance().get(Calendar.DATE) == 1) { //if (Calendar.getInstance().get(Calendar.DATE) == 1) {
try {
log.info("StatsProjectServiceImpl.customerGridStats-开始执行机关月统计方法,方法名:gridMonthProjectStats,客户Id:" + customerId); log.info("StatsProjectServiceImpl.customerGridStats-开始执行机关月统计方法,方法名:gridMonthProjectStats,客户Id:" + customerId);
gridMonthProjectStats(customerId, dimId, dimGridList); gridMonthProjectStats(customerId, dimId, dimGridList);
} catch (Exception e) {
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "gridMonthProjectStats", customerId, dimId.getMonthId(), e.getMessage()));
}
//} //}
} }
@ -636,7 +652,7 @@ public class StatsProjectServiceImpl implements StatsProjectService {
try { try {
DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); DateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Calendar calendar = Calendar.getInstance(); Calendar calendar = Calendar.getInstance();
//calendar.set(Calendar.HOUR_OF_DAY, -24); calendar.set(Calendar.HOUR_OF_DAY, -24);
String str = sdf.format(calendar.getTime()); String str = sdf.format(calendar.getTime());
date = sdf.parse(str); date = sdf.parse(str);
} catch (Exception e) { } catch (Exception e) {

67
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java

@ -5,7 +5,6 @@ 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.utils.ConvertUtils; import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.DateUtils; import com.epmet.commons.tools.utils.DateUtils;
import com.epmet.commons.tools.utils.HttpClientManager;
import com.epmet.constant.DimAgencyConstant; import com.epmet.constant.DimAgencyConstant;
import com.epmet.constant.ProjectConstant; import com.epmet.constant.ProjectConstant;
import com.epmet.dto.voice.ArticleGridPublishedSummaryDTO; import com.epmet.dto.voice.ArticleGridPublishedSummaryDTO;
@ -165,12 +164,6 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
statsTagUsedDaily(finalStatsDate, dimIdBean, customerId); statsTagUsedDaily(finalStatsDate, dimIdBean, customerId);
} catch (Exception e) { } catch (Exception e) {
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "tagUsedDailyStatsjob", customerId, dimIdBean.getDateId(), e.getMessage())); log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "tagUsedDailyStatsjob", customerId, dimIdBean.getDateId(), e.getMessage()));
try {
String content = String.format(ProjectConstant.EXE_FAILED_MSG, "按日统计标签被使用次数", customerId, dimIdBean.getMonthId(), e.getMessage());
HttpClientManager.getInstance().sendAlarmMsg(content);
} catch (Exception ex) {
log.error("sendAlarmMsg exception", e);
}
} }
} }
} }
@ -199,12 +192,6 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
statsTagUsedMonthly(dimIdBean.getMonthId(), customerId); statsTagUsedMonthly(dimIdBean.getMonthId(), customerId);
} catch (Exception e) { } catch (Exception e) {
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "按月统计标签被使用次数", customerId, dimIdBean.getMonthId(), e.getMessage())); log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "按月统计标签被使用次数", customerId, dimIdBean.getMonthId(), e.getMessage()));
try {
String content = String.format(ProjectConstant.EXE_FAILED_MSG, "按月统计标签被使用次数", customerId, dimIdBean.getMonthId(), e.getMessage());
HttpClientManager.getInstance().sendAlarmMsg(content);
} catch (Exception ex) {
log.error("sendAlarmMsg exception", e);
}
} }
} }
} }
@ -234,12 +221,6 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
statsTagViewedDaily(statsDate, dimIdBean, customerId); statsTagViewedDaily(statsDate, dimIdBean, customerId);
} catch (Exception e) { } catch (Exception e) {
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "tagViewedDailyStatsjob", customerId, dimIdBean.getDateId(), e.getMessage())); log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "tagViewedDailyStatsjob", customerId, dimIdBean.getDateId(), e.getMessage()));
try {
String content = String.format(ProjectConstant.EXE_FAILED_MSG, "按日统计标签被查看次数", customerId, statsDate, e.getMessage());
HttpClientManager.getInstance().sendAlarmMsg(content);
} catch (Exception ex) {
log.error("sendAlarmMsg exception", ex);
}
} }
} }
} }
@ -268,12 +249,6 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
statsTagViewedMonthly(dimIdBean.getMonthId(), customerId); statsTagViewedMonthly(dimIdBean.getMonthId(), customerId);
} catch (Exception e) { } catch (Exception e) {
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "tagViewedMonthlyStatsjob", customerId, dimIdBean.getDateId(), e.getMessage())); log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "tagViewedMonthlyStatsjob", customerId, dimIdBean.getDateId(), e.getMessage()));
try {
String content = String.format(ProjectConstant.EXE_FAILED_MSG, "按月统计标签被查看次数", customerId, dimIdBean.getMonthId(), e.getMessage());
HttpClientManager.getInstance().sendAlarmMsg(content);
} catch (Exception ex) {
log.error("sendAlarmMsg exception", e);
}
} }
} }
} }
@ -304,12 +279,6 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
statsTagUsedQuarterly(dimIdBean.getQuarterId(), customerId); statsTagUsedQuarterly(dimIdBean.getQuarterId(), customerId);
} catch (Exception e) { } catch (Exception e) {
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsTagUsedQuarterly", customerId, dimIdBean.getQuarterId(), e.getMessage())); log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsTagUsedQuarterly", customerId, dimIdBean.getQuarterId(), e.getMessage()));
try {
String content = String.format(ProjectConstant.EXE_FAILED_MSG, "按季统计标签被使用次数", customerId, dimIdBean.getQuarterId(), e.getMessage());
HttpClientManager.getInstance().sendAlarmMsg(content);
} catch (Exception ex) {
log.error("sendAlarmMsg exception", e);
}
} }
}); });
executorService.submit(() -> { executorService.submit(() -> {
@ -318,12 +287,6 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
statsTagUsedYearly(dimIdBean.getYearId(), customerId); statsTagUsedYearly(dimIdBean.getYearId(), customerId);
} catch (Exception e) { } catch (Exception e) {
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsTagUsedYearly", customerId, dimIdBean.getYearId(), e.getMessage())); log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsTagUsedYearly", customerId, dimIdBean.getYearId(), e.getMessage()));
try {
String content = String.format(ProjectConstant.EXE_FAILED_MSG, "按年统计标签被使用次数", customerId, dimIdBean.getYearId(), e.getMessage());
HttpClientManager.getInstance().sendAlarmMsg(content);
} catch (Exception ex) {
log.error("sendAlarmMsg exception", e);
}
} }
}); });
} }
@ -355,12 +318,6 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
statsTagViewedQuarterly(dimIdBean.getQuarterId(), customerId); statsTagViewedQuarterly(dimIdBean.getQuarterId(), customerId);
} catch (Exception e) { } catch (Exception e) {
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsTagViewedQuarterly", customerId, dimIdBean.getQuarterId(), e.getMessage())); log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsTagViewedQuarterly", customerId, dimIdBean.getQuarterId(), e.getMessage()));
try {
String content = String.format(ProjectConstant.EXE_FAILED_MSG, "按季统计标签被查看次数", customerId, dimIdBean.getQuarterId(), e.getMessage());
HttpClientManager.getInstance().sendAlarmMsg(content);
} catch (Exception ex) {
log.error("sendAlarmMsg exception", e);
}
} }
}); });
executorService.submit(() -> { executorService.submit(() -> {
@ -371,12 +328,6 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
} catch (Exception e) { } catch (Exception e) {
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsTagViewedQuarterly", customerId, dimIdBean.getYearId(), e.getMessage())); log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsTagViewedQuarterly", customerId, dimIdBean.getYearId(), e.getMessage()));
try {
String content = String.format(ProjectConstant.EXE_FAILED_MSG, "按年统计标签被查看次数", customerId, dimIdBean.getYearId(), e.getMessage());
HttpClientManager.getInstance().sendAlarmMsg(content);
} catch (Exception ex) {
log.error("sendAlarmMsg exception", e);
}
} }
}); });
} }
@ -416,12 +367,6 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
boolean b = factArticlePublishedDepartmentDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), departmentDailyEntityMap.values()); boolean b = factArticlePublishedDepartmentDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), departmentDailyEntityMap.values());
} catch (Exception e) { } catch (Exception e) {
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsPublishedDepartmentDaily", customerId, statsDate, e.getMessage())); log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsPublishedDepartmentDaily", customerId, statsDate, e.getMessage()));
try {
String content = String.format(ProjectConstant.EXE_FAILED_MSG, "按日统计部门纬度文章总数", customerId, statsDate, e.getMessage());
HttpClientManager.getInstance().sendAlarmMsg(content);
} catch (Exception ex) {
log.error("sendAlarmMsg exception", e);
}
} }
} }
@ -491,12 +436,6 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsPublishedGridDaily", customerId, statsDate, e.getMessage())); log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsPublishedGridDaily", customerId, statsDate, e.getMessage()));
try {
String content = String.format(ProjectConstant.EXE_FAILED_MSG, "按日统计网格纬度文章总数", customerId, statsDate, e.getMessage());
HttpClientManager.getInstance().sendAlarmMsg(content);
} catch (Exception ex) {
log.error("sendAlarmMsg exception", e);
}
} }
@ -562,12 +501,6 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsPublishedAgencyDaily", customerId, statsDate, e.getMessage())); log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsPublishedAgencyDaily", customerId, statsDate, e.getMessage()));
try {
String content = String.format(ProjectConstant.EXE_FAILED_MSG, "按日统计部门纬度文章总数", customerId, statsDate, e.getMessage());
HttpClientManager.getInstance().sendAlarmMsg(content);
} catch (Exception ex) {
log.error("sendAlarmMsg exception", e);
}
} }
} }

4
epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml

@ -126,7 +126,7 @@
<maxHistory>15</maxHistory> <maxHistory>15</maxHistory>
</rollingPolicy> </rollingPolicy>
<!-- 此日志文档只记录ERROR级别的 --> <!-- 此日志文档只记录ERROR级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter"> <filter class="com.epmet.commons.tools.filter.LogMsgSendFilter">
<level>ERROR</level> <level>ERROR</level>
<onMatch>ACCEPT</onMatch> <onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch> <onMismatch>DENY</onMismatch>
@ -137,7 +137,7 @@
<springProfile name="dev,test"> <springProfile name="dev,test">
<logger name="org.springframework.web" level="INFO"/> <logger name="org.springframework.web" level="INFO"/>
<logger name="org.springboot.sample" level="INFO"/> <logger name="org.springboot.sample" level="INFO"/>
<logger name="com.epmet.dao" level="INFO"/> <logger name="com.epmet.dao" level="DEBUG"/>
<root level="INFO"> <root level="INFO">
<appender-ref ref="DEBUG_FILE"/> <appender-ref ref="DEBUG_FILE"/>
<appender-ref ref="INFO_FILE"/> <appender-ref ref="INFO_FILE"/>

Loading…
Cancel
Save