| | |
| | | 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; |
| | |
| | | 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; |
| | |
| | | @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) { |
| | |
| | | logger.info("容器加载完毕"); |
| | | initMQMsgConsumer(); |
| | | initCOS(); |
| | | LogUtil.settleLogger.info("test123"); |
| | | |
| | | } |
| | | |
| | | @Resource |
| | |
| | | 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); |
| | | } |
| | | } |
| | | } |