Browse Source

定时任务执行失败看不到异常,调整相应的日志级别,服务端添加应用异常拦截处理

dev_shibei_match
jianjun 5 years ago
parent
commit
52de7f1780
  1. 31
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ServletExceptionHandler.java
  2. 120
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IpUtils.java
  3. 4
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ModuleUtils.java
  4. 5
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsPublicityController.java
  5. 2
      epmet-module/data-statistical/data-statistical-server/src/main/resources/logback-spring.xml
  6. 6
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityArticleSummaryDailyStatsTask.java
  7. 6
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagUsedDailyStatsTask.java
  8. 6
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagUsedMonthlyStatsTask.java
  9. 6
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagUsedQuarterlyAndYearlyStatsTask.java
  10. 6
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagViewedDailyStatsTask.java
  11. 6
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagViewedMonthlyStatsTask.java
  12. 6
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagViewedQuarterlyAndYearlyhlyStatsTask.java
  13. 6
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsGroupAgencyDailyTask.java
  14. 6
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsGroupAgencyMonthlyTask.java
  15. 6
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsGroupGridDailyTask.java
  16. 8
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsIssueTask.java
  17. 6
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsProjectAgencyTask.java
  18. 6
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsProjectGridTask.java
  19. 6
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsTopicTask.java
  20. 6
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsUserTask.java
  21. 6
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/SyncVotingCacheAndDbTask.java
  22. 6
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/TestTask.java
  23. 5
      epmet-module/epmet-job/epmet-job-server/src/main/resources/logback-spring.xml

31
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ServletExceptionHandler.java

@ -0,0 +1,31 @@
package com.epmet.commons.tools.aspect;/**
* @author jianjun liu
* @email liujianjun@yunzongnet.com
* @date 2020-07-02 14:08
**/
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import javax.servlet.ServletException;
/**
* desc
*
* @author lyn
* @date 2020/7/2 14:08
*/
@Slf4j
@ControllerAdvice
public class ServletExceptionHandler {
@ExceptionHandler(ServletException.class)
public Result globalException(ServletException e) {
log.error("globalException", e);
return new Result<String>().error(EpmetErrorCode.SERVER_ERROR.getCode(), EpmetErrorCode.SERVER_ERROR.getMsg());
}
}

120
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/IpUtils.java

@ -1,8 +1,8 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
*
* <p>
* https://www.renren.io
*
* <p>
* 版权所有侵权必究
*/
@ -14,9 +14,7 @@ import org.slf4j.LoggerFactory;
import javax.servlet.http.HttpServletRequest;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Enumeration;
import java.util.regex.Pattern;
/**
* IP工具类
@ -26,59 +24,69 @@ import java.util.Enumeration;
*/
public class IpUtils {
private static Logger logger = LoggerFactory.getLogger(IpUtils.class);
public static final String LOCALHOST = "127.0.0.1";
public static final String ANYHOST = "0.0.0.0";
private static final Pattern IP_PATTERN = Pattern.compile("\\d{1,3}(\\.\\d{1,3}){3,5}$");
public static String getIpAddr(HttpServletRequest request) {
String ip = null;
try {
ip = request.getHeader("x-forwarded-for");
if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (StringUtils.isEmpty(ip) || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_CLIENT_IP");
}
if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
}
if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
} catch (Exception e) {
logger.error("IpUtils ERROR ", e);
}
public static String getIpAddr(HttpServletRequest request) {
String ip = null;
try {
ip = request.getHeader("x-forwarded-for");
if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (StringUtils.isEmpty(ip) || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_CLIENT_IP");
}
if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
}
if (StringUtils.isEmpty(ip) || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
} catch (Exception e) {
logger.error("IpUtils ERROR ", e);
}
return ip;
}
return ip;
}
/**
* desc:获取本地Ip
* @return
*/
public static String getServerIp() {
String SERVER_IP = "";
try {
/**
* 遍历本地网卡的方式在云平台虚拟机取不到真正的ip
* @return
*/
InetAddress localAddress = InetAddress.getLocalHost();
if (isValidAddress(localAddress)) {
return localAddress.getHostAddress();
}
logger.warn("Could not get local host ip address");
return null;
} catch (Exception e) {
logger.error("IpUtils getServerIp exception ", e);
}
/**
* desc:获取本地Ip
* @return
*/
public static String getServerIp(){
String SERVER_IP = "";
try {
Enumeration netInterfaces = NetworkInterface.getNetworkInterfaces();
InetAddress ip = null;
while (netInterfaces.hasMoreElements()) {
NetworkInterface ni = (NetworkInterface) netInterfaces
.nextElement();
ip = ni.getInetAddresses().nextElement();
SERVER_IP = ip.getHostAddress();
if (!ip.isSiteLocalAddress() && !ip.isLoopbackAddress()
&& ip.getHostAddress().indexOf(":") == -1) {
SERVER_IP = ip.getHostAddress();
break;
}else{
ip = null;
}
}
} catch (SocketException e) {
logger.error("IpUtils getServerIp exception ", e);
}
return SERVER_IP;
}
return SERVER_IP;
}
private static boolean isValidAddress(InetAddress address) {
if (address == null || address.isLoopbackAddress())
return false;
String name = address.getHostAddress();
return (name != null
&& !ANYHOST.equals(name)
&& !LOCALHOST.equals(name)
&& IP_PATTERN.matcher(name).matches());
}
}

4
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/utils/ModuleUtils.java

@ -2,6 +2,7 @@ package com.epmet.commons.tools.utils;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.constant.StrConstant;
import com.epmet.commons.tools.dto.form.DingTalkTextMsg;
import com.epmet.commons.tools.exception.RenException;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.CharEncoding;
@ -37,6 +38,9 @@ public class ModuleUtils {
String errorMessage = "Failure to connect " + serverName;
String errorLog = errorMessage + "::[method]->{}::[params]->{}";
log.error(errorLog, methodName, JSON.toJSONString(params));
DingdingMsgSender msgSender = new DingdingMsgSender();
DingTalkTextMsg dingTalkTextMsg = new DingTalkTextMsg();
msgSender.sendMsgAsync(dingTalkTextMsg);
return new Result().error();
}

5
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsPublicityController.java

@ -59,6 +59,7 @@ public class StatsPublicityController {
*/
@PostMapping(value = "tagUsedMonthlyStatsjob")
public Result<Boolean> tagUsedMonthlyStatsjob(@RequestBody(required = false) StatsFormDTO formDTO) {
log.debug("tagUsedMonthlyStatsjob param:{}", JSON.toJSONString(formDTO));
return new Result<Boolean>().ok(statsPublicityService.tagUsedMonthlyStatsjob(formDTO));
}
@ -70,6 +71,7 @@ public class StatsPublicityController {
*/
@PostMapping(value = "tagUsedQuarterlyStatsjob")
public Result<Boolean> tagUsedQuarterlyStatsjob(@RequestBody(required = false) StatsFormDTO formDTO) {
log.debug("tagUsedQuarterlyStatsjob param:{}", JSON.toJSONString(formDTO));
return new Result<Boolean>().ok(statsPublicityService.tagUsedQuarterlyStatsjob(formDTO));
}
@ -81,6 +83,7 @@ public class StatsPublicityController {
*/
@PostMapping(value = "tagViewedDailyStatsjob")
public Result<Boolean> tagViewedDailyStatsjob(@RequestBody(required = false) StatsFormDTO formDTO) {
log.debug("tagViewedDailyStatsjob param:{}", JSON.toJSONString(formDTO));
return new Result<Boolean>().ok(statsPublicityService.tagViewedDailyStatsjob(formDTO));
}
@ -92,6 +95,7 @@ public class StatsPublicityController {
*/
@PostMapping(value = "tagViewedMonthlyStatsjob")
public Result<Boolean> tagViewedMonthlyStatsjob(@RequestBody(required = false) StatsFormDTO formDTO) {
log.debug("tagViewedMonthlyStatsjob param:{}", JSON.toJSONString(formDTO));
return new Result<Boolean>().ok(statsPublicityService.tagViewedMonthlyStatsjob(formDTO));
}
@ -103,6 +107,7 @@ public class StatsPublicityController {
*/
@PostMapping(value = "tagViewedQuarterlyStatsjob")
public Result<Boolean> tagViewedQuarterlyStatsjob(@RequestBody(required = false) StatsFormDTO formDTO) {
log.debug("tagViewedQuarterlyStatsjob param:{}", JSON.toJSONString(formDTO));
return new Result<Boolean>().ok(statsPublicityService.tagViewedQuarterlyStatsjob(formDTO));
}
}

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

@ -125,7 +125,7 @@
<!--日志文档保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文档只记录ERROR级别的 -->
<!-- 此日志文档只记录ERROR级别的 发送钉钉短信 -->
<filter class="com.epmet.commons.tools.filter.LogMsgSendFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>

6
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityArticleSummaryDailyStatsTask.java

@ -23,16 +23,16 @@ public class PublicityArticleSummaryDailyStatsTask implements ITask {
@Override
public void run(String params) {
logger.debug("publicityArticleSummaryDailyStatsTask定时任务正在执行,参数为:{}", params);
logger.info("publicityArticleSummaryDailyStatsTask定时任务正在执行,参数为:{}", params);
StatsFormDTO formDTO = null;
if (StringUtils.isNotBlank(params)){
formDTO = JSON.parseObject(params,StatsFormDTO.class);
}
Result result = statsPublicityTaskService.articleSummaryDailyStatsjob(formDTO);
if (result.success()) {
logger.debug("publicityArticleSummaryDailyStatsTask定时任务正在执行定时任务执行成功");
logger.info("publicityArticleSummaryDailyStatsTask定时任务执行成功");
} else {
logger.debug("publicityArticleSummaryDailyStatsTask定时任务正在执行定时任务执行失败:" + result.getMsg());
logger.error("publicityArticleSummaryDailyStatsTask定时任务正在执行定时任务执行失败:" + result.getMsg());
}
}

6
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagUsedDailyStatsTask.java

@ -23,16 +23,16 @@ public class PublicityTagUsedDailyStatsTask implements ITask {
@Override
public void run(String params) {
logger.debug("publicityTagUsedDailyStatsjob定时任务正在执行,参数为:{}", params);
logger.info("publicityTagUsedDailyStatsTask定时任务正在执行,参数为:{}", params);
StatsFormDTO formDTO = null;
if (StringUtils.isNotBlank(params)){
formDTO = JSON.parseObject(params,StatsFormDTO.class);
}
Result result = statsPublicityTaskService.tagUsedDailyStatsjob(formDTO);
if (result.success()) {
logger.debug("publicityTagUsedDailyStatsjob定时任务正在执行定时任务执行成功");
logger.info("publicityTagUsedDailyStatsTask定时任务执行成功");
} else {
logger.debug("publicityTagUsedDailyStatsjob定时任务正在执行定时任务执行失败:" + result.getMsg());
logger.error("publicityTagUsedDailyStatsTask定时任务执行失败:" + result.getMsg());
}
}
}

6
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagUsedMonthlyStatsTask.java

@ -23,16 +23,16 @@ public class PublicityTagUsedMonthlyStatsTask implements ITask {
@Override
public void run(String params) {
logger.debug("publicityTagUsedMonthlyStatsjob定时任务正在执行,参数为:{}", params);
logger.info("publicityTagUsedMonthlyStatsTask定时任务正在执行,参数为:{}", params);
StatsFormDTO formDTO = null;
if (StringUtils.isNotBlank(params)){
formDTO = JSON.parseObject(params,StatsFormDTO.class);
}
Result result = statsPublicityTaskService.tagUsedMonthlyStatsjob(formDTO);
if (result.success()) {
logger.debug("publicityTagUsedMonthlyStatsjob定时任务正在执行定时任务执行成功");
logger.info("publicityTagUsedMonthlyStatsTask定时任务执行成功");
} else {
logger.debug("publicityTagUsedMonthlyStatsjob定时任务正在执行定时任务执行失败:" + result.getMsg());
logger.error("publicityTagUsedMonthlyStatsTask定时任务执行失败:" + result.getMsg());
}
}
}

6
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagUsedQuarterlyAndYearlyStatsTask.java

@ -23,16 +23,16 @@ public class PublicityTagUsedQuarterlyAndYearlyStatsTask implements ITask {
@Override
public void run(String params) {
logger.debug("publicityTagUsedMonthlyStatsjob定时任务正在执行,参数为:{}", params);
logger.info("publicityTagUsedQuarterlyAndYearlyStatsTask定时任务正在执行,参数为:{}", params);
StatsFormDTO formDTO = null;
if (StringUtils.isNotBlank(params)){
formDTO = JSON.parseObject(params,StatsFormDTO.class);
}
Result result = statsPublicityTaskService.tagUsedQuarterlyStatsjob(formDTO);
if (result.success()) {
logger.debug("publicityTagUsedMonthlyStatsjob定时任务正在执行定时任务执行成功");
logger.info("publicityTagUsedQuarterlyAndYearlyStatsTask定时任务执行成功");
} else {
logger.debug("publicityTagUsedMonthlyStatsjob定时任务正在执行定时任务执行失败:" + result.getMsg());
logger.error("publicityTagUsedQuarterlyAndYearlyStatsTask定时任务执行失败:" + result.getMsg());
}
}
}

6
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagViewedDailyStatsTask.java

@ -23,16 +23,16 @@ public class PublicityTagViewedDailyStatsTask implements ITask {
@Override
public void run(String params) {
logger.debug("publicityTagViewedDailyStatsTask定时任务正在执行,参数为:{}", params);
logger.info("publicityTagViewedDailyStatsTask定时任务正在执行,参数为:{}", params);
StatsFormDTO formDTO = null;
if (StringUtils.isNotBlank(params)){
formDTO = JSON.parseObject(params,StatsFormDTO.class);
}
Result result = statsPublicityTaskService.tagViewedDailyStatsjob(formDTO);
if (result.success()) {
logger.debug("publicityTagViewedDailyStatsTask定时任务正在执行定时任务执行成功");
logger.info("publicityTagViewedDailyStatsTask定时任务执行成功");
} else {
logger.debug("publicityTagViewedDailyStatsTask定时任务正在执行定时任务执行失败:" + result.getMsg());
logger.error("publicityTagViewedDailyStatsTask定时任务执行失败:" + result.getMsg());
}
}
}

6
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagViewedMonthlyStatsTask.java

@ -23,16 +23,16 @@ public class PublicityTagViewedMonthlyStatsTask implements ITask {
@Override
public void run(String params) {
logger.debug("publicityTagViewedMonthlyStatsTask定时任务正在执行,参数为:{}", params);
logger.info("publicityTagViewedMonthlyStatsTask定时任务正在执行,参数为:{}", params);
StatsFormDTO formDTO = null;
if (StringUtils.isNotBlank(params)){
formDTO = JSON.parseObject(params,StatsFormDTO.class);
}
Result result = statsPublicityTaskService.tagViewedMonthlyStatsjob(formDTO);
if (result.success()) {
logger.debug("publicityTagViewedMonthlyStatsTask定时任务正在执行定时任务执行成功");
logger.info("publicityTagViewedMonthlyStatsTask定时任务执行成功");
} else {
logger.debug("publicityTagViewedMonthlyStatsTask定时任务正在执行定时任务执行失败:" + result.getMsg());
logger.error("publicityTagViewedMonthlyStatsTask定时任务执行失败:" + result.getMsg());
}
}
}

6
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagViewedQuarterlyAndYearlyhlyStatsTask.java

@ -23,16 +23,16 @@ public class PublicityTagViewedQuarterlyAndYearlyhlyStatsTask implements ITask {
@Override
public void run(String params) {
logger.debug("publicityTagViewedMonthlyStatsTask定时任务正在执行,参数为:{}", params);
logger.info("publicityTagViewedMonthlyStatsTask定时任务正在执行,参数为:{}", params);
StatsFormDTO formDTO = null;
if (StringUtils.isNotBlank(params)){
formDTO = JSON.parseObject(params,StatsFormDTO.class);
}
Result result = statsPublicityTaskService.tagViewedQuarterlyStatsjob(formDTO);
if (result.success()) {
logger.debug("publicityTagViewedMonthlyStatsTask定时任务正在执行定时任务执行成功");
logger.info("publicityTagViewedMonthlyStatsTask定时任务执行成功");
} else {
logger.debug("publicityTagViewedMonthlyStatsTask定时任务正在执行定时任务执行失败:" + result.getMsg());
logger.error("publicityTagViewedMonthlyStatsTask定时任务执行失败:" + result.getMsg());
}
}
}

6
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsGroupAgencyDailyTask.java

@ -23,12 +23,12 @@ public class StatsGroupAgencyDailyTask implements ITask {
@Override
public void run(String params) {
logger.debug("StatsGroupAgencyDailyTask定时任务正在执行,参数为:{}", params);
logger.info("StatsGroupAgencyDailyTask定时任务正在执行,参数为:{}", params);
Result result = statsGroupService.groupAgencyDaily(params);
if (result.success()){
logger.debug("StatsGroupAgencyDailyTask定时任务正在执行定时任务执行成功");
logger.info("StatsGroupAgencyDailyTask定时任务执行成功");
}else {
logger.debug("StatsGroupAgencyDailyTask定时任务正在执行定时任务执行失败:" + result.getMsg());
logger.error("StatsGroupAgencyDailyTask定时任务执行失败:" + result.getMsg());
}
}
}

6
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsGroupAgencyMonthlyTask.java

@ -23,12 +23,12 @@ public class StatsGroupAgencyMonthlyTask implements ITask {
@Override
public void run(String params) {
logger.debug("StatsGroupAgencyMonthlyTask定时任务正在执行,参数为:{}", params);
logger.info("StatsGroupAgencyMonthlyTask定时任务正在执行,参数为:{}", params);
Result result = statsGroupService.groupAgencyMonthly(params);
if (result.success()){
logger.debug("StatsGroupAgencyMonthlyTask定时任务正在执行定时任务执行成功");
logger.info("StatsGroupAgencyMonthlyTask定时任务执行成功");
}else {
logger.debug("StatsGroupAgencyMonthlyTask定时任务正在执行定时任务执行失败:" + result.getMsg());
logger.error("StatsGroupAgencyMonthlyTask定时任务执行失败:" + result.getMsg());
}
}
}

6
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsGroupGridDailyTask.java

@ -24,12 +24,12 @@ public class StatsGroupGridDailyTask implements ITask {
@Override
public void run(String params) {
logger.debug("StatsGroupGridDailyTask定时任务正在执行,参数为:{}", params);
logger.info("StatsGroupGridDailyTask定时任务正在执行,参数为:{}", params);
Result result = statsGroupService.groupGridDaily(params);
if (result.success()){
logger.debug("StatsGroupGridDailyTask定时任务正在执行定时任务执行成功");
logger.info("StatsGroupGridDailyTask定时任务执行成功");
}else {
logger.debug("StatsGroupGridDailyTask定时任务正在执行定时任务执行失败:" + result.getMsg());
logger.error("StatsGroupGridDailyTask定时任务执行失败:" + result.getMsg());
}
}
}

8
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsIssueTask.java

@ -3,10 +3,8 @@ package com.epmet.task;
import com.epmet.commons.tools.utils.Result;
import com.epmet.service.StatsIssueService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.logging.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
/**
* @author zhaoqifeng
@ -21,12 +19,12 @@ public class StatsIssueTask implements ITask {
@Override
public void run(String params) {
log.debug("StatsGroupGridDailyTask定时任务正在执行,参数为:{}", params);
log.info("StatsGroupGridDailyTask定时任务正在执行,参数为:{}", params);
Result result = statsIssueService.agencyGridIssueStats(params);
if (result.success()){
log.debug("StatsGroupGridDailyTask定时任务正在执行定时任务执行成功");
log.info("StatsGroupGridDailyTask定时任务执行成功");
}else {
log.debug("StatsGroupGridDailyTask定时任务正在执行定时任务执行失败:" + result.getMsg());
log.error("StatsGroupGridDailyTask定时任务执行失败:" + result.getMsg());
}
}
}

6
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsProjectAgencyTask.java

@ -21,12 +21,12 @@ public class StatsProjectAgencyTask implements ITask {
@Override
public void run(String params) {
log.debug("StatsProjectAgencyTask定时任务正在执行,参数为:{}", params);
log.info("StatsProjectAgencyTask定时任务正在执行,参数为:{}", params);
Result result = statsProjectService.agencyProjectStats(params);
if (result.success()){
log.debug("StatsProjectAgencyTask定时任务正在执行定时任务执行成功");
log.info("StatsProjectAgencyTask定时任务执行成功");
}else {
log.debug("StatsProjectAgencyTask定时任务正在执行定时任务执行失败:" + result.getMsg());
log.error("StatsProjectAgencyTask定时任务执行失败:" + result.getMsg());
}
}
}

6
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsProjectGridTask.java

@ -24,12 +24,12 @@ public class StatsProjectGridTask implements ITask {
@Override
public void run(String params) {
log.debug("StatsProjectGridTask定时任务正在执行,参数为:{}", params);
log.info("StatsProjectGridTask定时任务正在执行,参数为:{}", params);
Result result = statsProjectService.gridProjectStats(params);
if (result.success()){
log.debug("StatsProjectGridTask定时任务正在执行定时任务执行成功");
log.info("StatsProjectGridTask定时任务执行成功");
}else {
log.debug("StatsProjectGridTask定时任务正在执行定时任务执行失败:" + result.getMsg());
log.error("StatsProjectGridTask定时任务执行失败:" + result.getMsg());
}
}
}

6
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsTopicTask.java

@ -23,12 +23,12 @@ public class StatsTopicTask implements ITask {
@Override
public void run(String params) {
logger.debug("StatsTopicTask定时任务正在执行,参数为:{}", params);
logger.info("StatsTopicTask定时任务正在执行,参数为:{}", params);
Result result = statsTopicService.execTopicStatistical(params);
if (result.success()){
logger.debug("StatsTopicTask定时任务正在执行定时任务执行成功");
logger.info("StatsTopicTask定时任务执行成功");
}else {
logger.debug("StatsTopicTask定时任务正在执行定时任务执行失败:" + result.getMsg());
logger.error("StatsTopicTask定时任务执行失败:" + result.getMsg());
}
}
}

6
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/StatsUserTask.java

@ -23,12 +23,12 @@ public class StatsUserTask implements ITask {
@Override
public void run(String params) {
logger.debug("StatsUserTask定时任务正在执行,参数为:{}", params);
logger.info("StatsUserTask定时任务正在执行,参数为:{}", params);
Result result = statsUserService.execUserStatistical(params);
if (result.success()){
logger.debug("StatsUserTask定时任务正在执行定时任务执行成功");
logger.info("StatsUserTask定时任务执行成功");
}else {
logger.debug("StatsUserTask定时任务正在执行定时任务执行失败:" + result.getMsg());
logger.error("StatsUserTask定时任务执行失败:" + result.getMsg());
}
}
}

6
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/SyncVotingCacheAndDbTask.java

@ -22,12 +22,12 @@ public class SyncVotingCacheAndDbTask implements ITask {
@Override
public void run(String params) {
logger.debug("syncVotingCacheAndDbTask定时任务正在执行,参数为:{}", params);
logger.info("syncVotingCacheAndDbTask定时任务正在执行,参数为:{}", params);
Result result = syncVotingCacheAndDbService.syncVotingCacheAndDb();
if(result.success()){
logger.debug("syncVotingCacheAndDbTask定时任务正在执行定时任务执行成功");
logger.info("syncVotingCacheAndDbTask定时任务执行成功");
}else{
logger.debug("syncVotingCacheAndDbTask定时任务正在执行定时任务执行失败:"+result.getMsg());
logger.debug("syncVotingCacheAndDbTask定时任务执行失败:"+result.getMsg());
}
}
}

6
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/TestTask.java

@ -30,12 +30,12 @@ public class TestTask implements ITask{
private TestTaskService testTaskService;
@Override
public void run(String params){
logger.debug("TestTask定时任务正在执行,参数为:{}", params);
logger.info("TestTask定时任务正在执行,参数为:{}", params);
Result result=testTaskService.testTask(params);
if(result.success()){
logger.debug("TestTask定时任务执行成功");
logger.info("TestTask定时任务执行成功");
}else{
logger.debug("TestTask定时任务执行失败:"+result.getMsg());
logger.error("TestTask定时任务执行失败:"+result.getMsg());
}
}
}

5
epmet-module/epmet-job/epmet-job-server/src/main/resources/logback-spring.xml

@ -125,11 +125,12 @@
<!--日志文档保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文档只记录ERROR级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<filter class="com.epmet.commons.tools.filter.LogMsgSendFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
<webHook>https://oapi.dingtalk.com/robot/send?access_token=90782b119f82a5b6bb8e0f819b6a77bbc2102b53aa2d7d2e24fa10b66d580b1c</webHook>
<secret>SEC080aac67ff78e79fdaba132aa51e3fb3f6060dec99492feaac82cabf9f8b6a19</secret>
</filter>
</appender>

Loading…
Cancel
Save