Helius
2021-04-20 21b9602fb795769547ae08f68879b458b347765c
modify
3 files modified
17 ■■■■ changed files
src/main/java/com/xcong/excoin/common/aop/ExceptionCatchAspect.java 12 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/modules/blackchain/service/TrxUsdtUpdateService.java 2 ●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/utils/dingtalk/DingTalkType.java 3 ●●●● patch | view | raw | blame | history
src/main/java/com/xcong/excoin/common/aop/ExceptionCatchAspect.java
@@ -3,14 +3,17 @@
import com.xcong.excoin.common.exception.GlobalException;
import com.xcong.excoin.common.system.bean.SysExceptionDetailEntity;
import com.xcong.excoin.modules.platform.dao.SysExceptionDetailDao;
import com.xcong.excoin.utils.dingtalk.DingTalkUtils;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.AfterThrowing;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.dao.DuplicateKeyException;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.MethodArgumentNotValidException;
@@ -37,13 +40,16 @@
    @Autowired
    private SysExceptionDetailDao sysExceptionDetailDao;
    @Value("${spring.profiles.active}")
    private String profiles;
    @Pointcut("execution(* com.xcong.excoin..*.*(..))")
    public void exceptionCatch() {
    }
    @AfterThrowing(pointcut = "exceptionCatch()", throwing = "ex")
    public void afterThrows(JoinPoint jp, Exception ex) throws Exception {
        if (ex instanceof GlobalException || ex instanceof MethodArgumentNotValidException || ex instanceof ValidationException || ex instanceof DuplicateKeyException || ex instanceof BadCredentialsException) {
        if (ex instanceof GlobalException || ex instanceof MethodArgumentNotValidException || ex instanceof ValidationException || ex instanceof DuplicateKeyException || ex instanceof BadCredentialsException || ex instanceof UsernameNotFoundException) {
            throw ex;
        }
@@ -53,11 +59,13 @@
        SysExceptionDetailEntity exceptionData = new SysExceptionDetailEntity();
        exceptionData.setCreateTime(new Date());
        exceptionData.setMachine(InetAddress.getLocalHost().getHostName());
        exceptionData.setMachine(InetAddress.getLocalHost().getHostName()+"-"+profiles);
        exceptionData.setAddress(InetAddress.getLocalHost().getHostAddress());
        exceptionData.setExceptionMsg(printStackTraceToString(ex));
        exceptionData.setSimpleMsg(ex.getMessage());
        sysExceptionDetailDao.insert(exceptionData);
        DingTalkUtils.sendActionCard(6);
        throw ex;
    }
src/main/java/com/xcong/excoin/modules/blackchain/service/TrxUsdtUpdateService.java
@@ -106,7 +106,7 @@
        // 不用等到扫完再累加 只要进来就加 还有一个条件是必须查询出区块再加 否则当区块超过实际区块
//        redisUtils.set("USDT_TRC20_BLOCK_NUM", (num + 1L));
        JSONArray parseArray = JSON.parseObject(transactionInfoByBlockNum).getJSONArray("transactions");
        if (parseArray.size() > 0) {
        if (parseArray != null && parseArray.size() > 0) {
            for (Object e : parseArray) {
                try {
//                    String txId = JSON.parseObject(e.toString()).getString("id");
src/main/java/com/xcong/excoin/utils/dingtalk/DingTalkType.java
@@ -24,7 +24,8 @@
     * 实名认证
     */
    CARD_VERIFY("红包来了啊!!!!", 4),
   TYPE_FIVE("红包来了啊!!!!!", 5);
    TYPE_FIVE("红包来了啊!!!!!", 5),
    EXCEPTION_INFO("异常来啦", 6);
    private String name;