admin
2022-10-28 0e9b6603d4ae9d11c1fbc90257ce816c5807b8ff
app/src/main/java/com/yeshi/makemoney/app/Application.java
@@ -1,5 +1,6 @@
package com.yeshi.makemoney.app;
import com.google.gson.Gson;
import com.ks.lib.common.exception.ParamsException;
import com.yeshi.makemoney.app.dto.mq.ExtractTransferResultMQMsg;
import com.yeshi.makemoney.app.dto.mq.GoldCornSettleMQMsg;
@@ -10,6 +11,7 @@
import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornSettleService;
import com.yeshi.makemoney.app.service.inter.money.ExtractService;
import com.yeshi.makemoney.app.utils.Constant;
import com.yeshi.makemoney.app.utils.LogUtil;
import com.yeshi.makemoney.app.utils.mq.CMQManager;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
@@ -40,6 +42,7 @@
@EnableTransactionManagement
//@EnableDubbo(scanBasePackages = "com.ks.push.service.remote")
public class Application implements ApplicationListener<ContextRefreshedEvent> {
    Logger settleLogger= LoggerFactory.getLogger("settleLog");
    private final static Logger logger = LoggerFactory.getLogger(Application.class);
    public static void main(String[] args) {
@@ -54,6 +57,8 @@
        logger.info("容器加载完毕");
        initMQMsgConsumer();
        initCOS();
        LogUtil.settleLogger.info("test123");
    }
    @Resource
@@ -70,24 +75,32 @@
            new JobThreadExecutorServiceImpl().run(new Runnable() {
                @Override
                public void run() {
                    Map<String, GoldCornSettleMQMsg> map = CMQManager.getInstance().consumeGoldCornSettleMsg(10);
                    if (map != null) {
                        for (Iterator<String> its = map.keySet().iterator(); its.hasNext(); ) {
                            String key = its.next();
                            GoldCornSettleMQMsg msg = map.get(key);
                            try {
                                settleLogger.info("消费结算消息开始:{}",new Gson().toJson(msg));
                                goldCornSettleService.settle(msg.getUid(), msg.getDay(),msg.getSettleId());
                                CMQManager.getInstance().deleteGoldCornSettleMsg(key);
                                settleLogger.info("消费结算消息成功:{}",new Gson().toJson(msg));
                            } catch (UserInfoException e) {
                                e.printStackTrace();
                                settleLogger.error("消费结算消息异常:{} ",new Gson().toJson(msg),e);
                            } catch (GoldCornMoneyExchangeRateRecordException e) {
                                e.printStackTrace();
                                settleLogger.error("消费结算消息异常:{} ",new Gson().toJson(msg),e);
                            } catch (UserMoneyRecordException e) {
                                e.printStackTrace();
                                settleLogger.error("消费结算消息异常:{} ",new Gson().toJson(msg),e);
                            } catch (GoldCornConsumeRecordException e) {
                                e.printStackTrace();
                                settleLogger.error("消费结算消息异常:{} ",new Gson().toJson(msg),e);
                            } catch (Exception e) {
                                e.printStackTrace();
                                settleLogger.error("消费结算消息异常:{} ",new Gson().toJson(msg),e);
                            }
                        }
                    }
@@ -101,7 +114,7 @@
        new JobThreadExecutorServiceImpl().run(new Runnable() {
            @Override
            public void run() {
                Map<String, ExtractTransferResultMQMsg> map = CMQManager.getInstance().consumeExtractResultMsg(10);
                Map<String, ExtractTransferResultMQMsg> map = CMQManager.getInstance().consumeExtractResultMsg(1);
                if (map != null) {
                    for (Iterator<String> its = map.keySet().iterator(); its.hasNext(); ) {
                        String key = its.next();