cs.mina.client.handler; java.text.SimpleDateFormat; java.util.Calendar; java.util.Date; java.util.GregorianCalendar; java.util.List; java.util.concurrent.BlockingQueue; org.apache.log4j.Logger; org.springframework.jdbc.datasource.DataSourceTransactionManager; org.springframework.transaction.TransactionDefinition; org.springframework.transaction.TransactionStatus; org.springframework.transaction.support.DefaultTransactionDefinition; cs.base.IBaseService; cs.entity.Admin; cs.entity.Announce; cs.entity.DealRecord; cs.entity.FreezeRecord; cs.entity.FundLog; cs.entity.Member; cs.entity.Order; cs.entity.Product; cs.entity.StockHold; cs.mina.ExecIDSet; cs.mina.OrderIdAndDatabaseIdMap; cs.mina.OrderState; cs.mina.SeqNumAndDatabaseIdMap; cs.mina.codec.msg.BaseMsg; cs.mina.codec.msg.BusinessMessageRejectMsg; cs.mina.codec.msg.ExecutionReportMsg; cs.mina.codec.msg.MsgType; cs.mina.codec.msg.OrderCancelRejectMsg; cs.mina.codec.msg.RejectMsg; cs.service.IAdminService; cs.service.IAnnounceService; cs.service.IDealRecordService; cs.service.IFreezeRecordService; cs.service.IFundLogService; cs.service.IMemberService; cs.service.IOrderService; cs.service.IProductService; cs.service.IStockHoldService; cs.util.ApplicationContextUtil; cs.util.Constant; cs.util.FileOPUtil; csulog.CSULog; Thread { Logger loggerLogger.getLogger(DbFailExecuteThreadHandler.); CSULog csuLogCSULog.getInstance(); BlockingQueueDbFail failQueue; DbFailExecuteThreadHandler(BlockingQueueDbFail failQueue){ .failQueuefailQueue; } run() { (){ DbFail fail; { failfailQueue.take(); DataSourceTransactionManager txManager(DataSourceTransactionManager)ApplicationContextUtil.getApplicationContext().getBean(); DefaultTransactionDefinition def DefaultTransactionDefinition(); def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); TransactionStatus status txManager.getTransaction(def); { BaseMsg msgfail.getMsg(); (msg ExecutionReportMsg){ doExecutionReportMsgHandler(msg); FileOPUtil.removeDbFail(fail); } (msg BusinessMessageRejectMsg){ doBusinessMessageRejectMsgHandler(msg); FileOPUtil.removeDbFail(fail); } (msg OrderCancelRejectMsg){ doOrderCancelRejectMsgHandler(msg); FileOPUtil.removeDbFail(fail); } (msg RejectMsg){ doRejectMsgHandler(msg); FileOPUtil.removeDbFail(fail); }{ csuLog.log_ERROR(); } txManager.commit(status); }(Exception e){ txManager.rollback(status); e; } }(Exception e){ logger.error(, e); { (fail){ failQueue.put(fail); } Thread.sleep(); } (InterruptedException e1) { logger.error(, e1); } } } } doExecutionReportMsgHandler(BaseMsg msg) Exception{ ExecutionReportMsg report(ExecutionReportMsg)msg; csuLog.log_INFO(report.encode()); (ExecIDSet.isExist(report.getExecID().getTagValue())){ csuLog.log_WARNING(report.getExecID().getTagValue()report.encode()); ; }{ ExecIDSet.put(report.getExecID().getTagValue()); } IAnnounceService announceServiceImpl(IAnnounceService)ApplicationContextUtil.getApplicationContext().getBean(); IOrderService orderServiceImpl(IOrderService)ApplicationContextUtil.getApplicationContext().getBean(); IAdminService adminServiceImpl(IAdminService)ApplicationContextUtil.getApplicationContext().getBean(); IDealRecordService dealRecordServiceImpl(IDealRecordService)ApplicationContextUtil.getApplicationContext().getBean(); IMemberService memberServiceImpl(IMemberService)ApplicationContextUtil.getApplicationContext().getBean(); IFundLogService fundLogServiceImpl(IFundLogService)ApplicationContextUtil.getApplicationContext().getBean(); IProductService productServiceImpl(IProductService)ApplicationContextUtil.getApplicationContext().getBean(); IStockHoldService stockHoldServiceImpl(IStockHoldService)ApplicationContextUtil.getApplicationContext().getBean(); IFreezeRecordService freezeRecordServiceImpl(IFreezeRecordService)ApplicationContextUtil.getApplicationContext().getBean(); Order order Order(); order.setId(.parseLong(OrderIdAndDatabaseIdMap.get(report.getClOrdID().getTagValue()))); SimpleDateFormat sdf SimpleDateFormat(); order((IBaseServiceOrder)orderServiceImpl).get(order); Product product productServiceImpl.findByCode(order.getProduct().getCode()); StockHold stockHoldstockHoldServiceImpl.getByProductIdAndUserId(product.getId(), order.getMember().getId()); order.setState(report.getOrdStatus().getTagValue()); order.setServerOrderId(report.getOrderID().getTagValue()); sidereport.getSide().getTagValue(); (report.getExecType().getTagValue().toCharArray()[]){ : : : order.setAlreadyTrans(.parseInt(report.getCumQty().getTagValue())); DealRecord dealRecord DealRecord(); dealRecord.setOrder(order); dealRecord.setPrice(.parseDouble(report.getLastPx().getTagValue())); dealRecord.setQuantity(.parseInt(report.getLastQty().getTagValue())); (report.getTransactTime().getTagValue()){ dealRecord.setDealTime(sdf.parse(report.getTransactTime().getTagValue())); } ((IBaseServiceDealRecord)dealRecordServiceImpl).add(dealRecord); csuLog.log_INFO(order.getMember().getLgid()order.getId()dealRecord.getQuantity()order.getPrice()); order.setWaitTrans(.parseInt(report.getLeavesQty().getTagValue())); (side.equals(Constant.FIX_SIDE_BUY)){ (.parseInt(report.getLeavesQty().getTagValue())){ FreezeRecord freezeRecordfreezeRecordServiceImpl.getByOrderIdAndUserId(order.getId(), order.getMember().getId()); ListDealRecord dealListdealRecordServiceImpl.findByOrder(order); money; ( i;idealList.size();i){ DealRecord dealdealList.get(i); moneydeal.getPrice()deal.getQuantity(); } Member memberorder.getMember(); csuLog.log_INFO(member.getLgid()order.getId()member.getBalance()member.getAmtFrozen()); member.setBalance(member.getBalance()freezeRecord.getAmt()money); member.setAmtFrozen(member.getAmtFrozen()freezeRecord.getAmt()); ((IBaseServiceMember)memberServiceImpl).modify(member); csuLog.log_INFO(member.getLgid()order.getId()(freezeRecord.getAmt()money)member.getBalance()(freezeRecord.getAmt())member.getAmtFrozen()); ((IBaseServiceFreezeRecord)freezeRecordServiceImpl).delete(freezeRecord); csuLog.log_INFO(member.getLgid()order.getId()freezeRecord.getAmt()); FundLog fundLog FundLog(); fundLog.setAmount(freezeRecord.getAmt()money); fundLog.setBalance(member.getBalance()); fundLog.setIp(); fundLog.setLaType(FundLog.LATYPE_TD_TAD); fundLog.setLog(order.getId()); fundLog.setLpType(FundLog.LATYPE_TD_TDD); fundLog.setMember(member); fundLog.setTime( Date()); ((IBaseServiceFundLog)fundLogServiceImpl).add(fundLog); csuLog.log_INFO(member.getLgid()order.getId()(freezeRecord.getAmt()money)fundLog.getBalance()); (stockHold){ stockHold StockHold(); stockHold.setAmt(order.getQuantity()); stockHold.setProduct(product); stockHold.setUser(order.getMember()); ((IBaseServiceStockHold)stockHoldServiceImpl).add(stockHold); }{ stockHold.setAmt(stockHold.getAmt()order.getQuantity()); ((IBaseServiceStockHold)stockHoldServiceImpl).modify(stockHold); } csuLog.log_INFO(member.getLgid()order.getId()product.getName()stockHold.getAmt()); } } (side.equals(Constant.FIX_SIDE_SELL)){ (.parseInt(report.getLeavesQty().getTagValue())){ ListDealRecord dealListdealRecordServiceImpl.findByOrder(order); money; ( i;idealList.size();i){ DealRecord dealdealList.get(i); moneydeal.getPrice()deal.getQuantity(); } Member membermemberServiceImpl.getMemberByLgid(order.getMember()); csuLog.log_INFO(member.getLgid()order.getId()member.getBalance()member.getAmtFrozen()); member.setBalance(member.getBalance()money); ((IBaseServiceMember)memberServiceImpl).modify(member); csuLog.log_INFO(member.getLgid()order.getId()moneymember.getBalance()member.getAmtFrozen()); FundLog fundLog FundLog(); fundLog.setAmount(money); fundLog.setBalance(member.getBalance()); fundLog.setIp(); fundLog.setLaType(FundLog.LATYPE_TD_TAD); fundLog.setLog(order.getId()); fundLog.setLpType(FundLog.LATYPE_TD_TDD); fundLog.setMember(member); fundLog.setTime( Date()); ((IBaseServiceFundLog)fundLogServiceImpl).add(fundLog); csuLog.log_INFO(member.getLgid()order.getId()moneyfundLog.getBalance()); } }{ csuLog.log_ERROR(side); } ; : : : : : (side.equals(Constant.FIX_SIDE_BUY)){ FreezeRecord freezeRecordfreezeRecordServiceImpl.getByOrderIdAndUserId(order.getId(), order.getMember().getId()); (order.getQuantity()order.getWaitTrans()){ ListDealRecord dealListdealRecordServiceImpl.findByOrder(order); money; ( i;idealList.size();i){ DealRecord dealdealList.get(i); moneydeal.getPrice()deal.getQuantity(); } Member memberorder.getMember(); csuLog.log_INFO(member.getLgid()order.getId()member.getBalance()member.getAmtFrozen()); member.setAmtFrozen(member.getAmtFrozen()freezeRecord.getAmt()); moneyfreezeRecord.getAmt()money; member.setBalance(member.getBalance()money); ((IBaseServiceMember)memberServiceImpl).modify(member); csuLog.log_INFO(member.getLgid()order.getId()member.getBalance()moneymember.getAmtFrozen()(freezeRecord.getAmt())); ((IBaseServiceFreezeRecord)freezeRecordServiceImpl).delete(freezeRecord); csuLog.log_INFO(member.getLgid()order.getId()freezeRecord.getAmt()); FundLog fundLog FundLog(); fundLog.setAmount(money); fundLog.setBalance(member.getBalance()); fundLog.setIp(); fundLog.setLaType(FundLog.LATYPE_TD_TAD); fundLog.setLog(order.getId()); fundLog.setLpType(FundLog.LATYPE_TD_TDD); fundLog.setMember(member); fundLog.setTime( Date()); ((IBaseServiceFundLog)fundLogServiceImpl).add(fundLog); csuLog.log_INFO(member.getLgid()order.getId()fundLog.getAmount()fundLog.getBalance()); (stockHold){ stockHold StockHold(); stockHold.setAmt(order.getQuantity()order.getWaitTrans()); stockHold.setProduct(product); stockHold.setUser(order.getMember()); ((IBaseServiceStockHold)stockHoldServiceImpl).add(stockHold); }{ stockHold.setAmt(stockHold.getAmt()order.getQuantity()order.getWaitTrans()); ((IBaseServiceStockHold)stockHoldServiceImpl).modify(stockHold); } csuLog.log_INFO(member.getLgid()order.getId()product.getName()stockHold.getAmt()); }{ money; moneyorder.getPrice()order.getWaitTrans(); Member membermemberServiceImpl.getMemberByLgid(order.getMember()); csuLog.log_INFO(member.getLgid()order.getId()member.getBalance()member.getAmtFrozen()); member.setBalance(member.getBalance()money); member.setAmtFrozen(member.getAmtFrozen()freezeRecord.getAmt()); ((IBaseServiceMember)memberServiceImpl).modify(member); csuLog.log_INFO(member.getLgid()order.getId()member.getBalance()moneymember.getAmtFrozen()(freezeRecord.getAmt())); ((IBaseServiceFreezeRecord)freezeRecordServiceImpl).delete(freezeRecord); csuLog.log_INFO(member.getLgid()order.getId()freezeRecord.getAmt()); FundLog fundLog FundLog(); fundLog.setAmount(money); fundLog.setBalance(member.getBalance()); fundLog.setIp(); fundLog.setLaType(FundLog.LATYPE_TD_TAD); fundLog.setLog(order.getId()); fundLog.setLpType(FundLog.LATYPE_TD_TDD); fundLog.setMember(member); fundLog.setTime( Date()); ((IBaseServiceFundLog)fundLogServiceImpl).add(fundLog); csuLog.log_INFO(member.getLgid()order.getId()fundLog.getAmount()fundLog.getBalance()); } } (side.equals(Constant.FIX_SIDE_SELL)){ (order.getQuantity()order.getWaitTrans()){ (stockHold){ stockHold StockHold(); stockHold.setAmt(order.getQuantity()order.getWaitTrans()); stockHold.setProduct(product); stockHold.setUser(order.getMember()); ((IBaseServiceStockHold)stockHoldServiceImpl).add(stockHold); }{ stockHold.setAmt(stockHold.getAmt()order.getQuantity()order.getWaitTrans()); ((IBaseServiceStockHold)stockHoldServiceImpl).modify(stockHold); } csuLog.log_INFO(order.getMember().getLgid()order.getId()product.getName()stockHold.getAmt()); ListDealRecord dealListdealRecordServiceImpl.findByOrder(order); money; ( i;idealList.size();i){ DealRecord dealdealList.get(i); moneydeal.getPrice()deal.getQuantity(); } Member memberorder.getMember(); csuLog.log_INFO(member.getLgid()order.getId()member.getBalance()member.getAmtFrozen()); member.setBalance(member.getBalance()money); ((IBaseServiceMember)memberServiceImpl).modify(member); csuLog.log_INFO(member.getLgid()order.getId()member.getBalance()moneymember.getAmtFrozen()); FundLog fundLog FundLog(); fundLog.setAmount(money); fundLog.setBalance(member.getBalance()); fundLog.setIp(); fundLog.setLaType(FundLog.LATYPE_TD_TAD); fundLog.setLog(order.getId()); fundLog.setLpType(FundLog.LATYPE_TD_TDD); fundLog.setMember(member); fundLog.setTime( Date()); ((IBaseServiceFundLog)fundLogServiceImpl).add(fundLog); csuLog.log_INFO(member.getLgid()order.getId()fundLog.getAmount()fundLog.getBalance()); }{ stockHold.setAmt(stockHold.getAmt()order.getQuantity()); ((IBaseServiceStockHold)stockHoldServiceImpl).modify(stockHold); csuLog.log_INFO(order.getMember().getLgid()order.getId()product.getName()stockHold.getAmt()); } }{ csuLog.log_ERROR(side); } ; : csuLog.log_INFO(); ; : FreezeRecord freezeRecordfreezeRecordServiceImpl.getByOrderIdAndUserId(order.getId(), order.getMember().getId()); (side.equals(Constant.FIX_SIDE_BUY)){ (order.getState().equals(OrderState.ADD_SUBMIT)){ money; moneyorder.getPrice()order.getWaitTrans(); Member membermemberServiceImpl.getMemberByLgid(order.getMember()); csuLog.log_INFO(member.getLgid()order.getId()member.getBalance()member.getAmtFrozen()); member.setBalance(member.getBalance()money); member.setAmtFrozen(member.getAmtFrozen()freezeRecord.getAmt()); ((IBaseServiceMember)memberServiceImpl).modify(member); csuLog.log_INFO(member.getLgid()order.getId()member.getBalance()moneymember.getAmtFrozen()(freezeRecord.getAmt())); ((IBaseServiceFreezeRecord)freezeRecordServiceImpl).delete(freezeRecord); csuLog.log_INFO(member.getLgid()order.getId()freezeRecord.getAmt()); FundLog fundLog FundLog(); fundLog.setAmount(money); fundLog.setBalance(member.getBalance()); fundLog.setIp(); fundLog.setLaType(FundLog.LATYPE_TD_TAD); fundLog.setLog(order.getId()); fundLog.setLpType(FundLog.LATYPE_TD_TDD); fundLog.setMember(member); fundLog.setTime( Date()); ((IBaseServiceFundLog)fundLogServiceImpl).add(fundLog); csuLog.log_INFO(member.getLgid()order.getId()fundLog.getAmount()fundLog.getBalance()); }{ orderStatereport.getOrdStatus().getTagValue(); money; (order.getLastState().equals(orderState)){ csuLog.log_ERROR(); } (order.getState().equals(OrderState.REPLACE_SUBMIT)){ order.setState(order.getLastState()); moneyorder.getWaitTrans()order.getPrice()order.getLastAmt()order.getLastPrice(); Member membermemberServiceImpl.getMemberByLgid(order.getMember()); csuLog.log_INFO(member.getLgid()order.getId()member.getBalance()member.getAmtFrozen()); member.setBalance(member.getBalance()money); member.setAmtFrozen(member.getAmtFrozen()money); ((IBaseServiceMember)memberServiceImpl).modify(member); csuLog.log_INFO(member.getLgid()order.getId()member.getBalance()moneymember.getAmtFrozen()(money)); freezeRecord.setAmt(freezeRecord.getAmt()money); ((IBaseServiceFreezeRecord)freezeRecordServiceImpl).modify(freezeRecord); csuLog.log_INFO(member.getLgid()order.getId()(money)freezeRecord.getAmt()); FundLog fundLog FundLog(); fundLog.setAmount(money); fundLog.setBalance(member.getBalance()); fundLog.setIp(); fundLog.setLaType(FundLog.LATYPE_TD_TAD); fundLog.setLog(order.getId()); fundLog.setLpType(FundLog.LATYPE_TD_TDD); fundLog.setMember(member); fundLog.setTime( Date()); ((IBaseServiceFundLog)fundLogServiceImpl).add(fundLog); csuLog.log_INFO(member.getLgid()order.getId()fundLog.getAmount()fundLog.getBalance()); } (order.getState().equals(OrderState.CANCLE_SUBMIT)){ order.setState(order.getLastState()); } } } (side.equals(Constant.FIX_SIDE_SELL)){ (order.getState().equals(OrderState.ADD_SUBMIT)){ stockHold.setAmt(stockHold.getAmt()order.getQuantity()); ((IBaseServiceStockHold)stockHoldServiceImpl).modify(stockHold); csuLog.log_INFO(order.getMember().getLgid()order.getId()order.getProduct().getName()order.getQuantity()stockHold.getAmt()); }{ orderStatereport.getOrdStatus().getTagValue(); money; (order.getLastState().equals(orderState)){ csuLog.log_ERROR(); } (order.getState().equals(OrderState.REPLACE_SUBMIT)){ order.setState(order.getLastState()); amountorder.getWaitTrans()order.getLastAmt(); stockHold.setAmt(stockHold.getAmt()amount); ((IBaseServiceStockHold)stockHoldServiceImpl).modify(stockHold); csuLog.log_INFO(order.getMember().getLgid()order.getId()order.getProduct().getName()amountstockHold.getAmt()); } (order.getState().equals(OrderState.CANCLE_SUBMIT)){ order.setState(order.getLastState()); } } }{ csuLog.log_ERROR(side); } } ((IBaseServiceOrder)orderServiceImpl).modify(order); Announce announce Announce(); announce.setBeginTime( Date()); announce.setUpdateTime( Date()); Admin admin Admin(); admin.setLgid(); adminadminServiceImpl.getAdminByLgid(admin); announce.setPromulgator(admin); announce.setMember(order.getMember()); announce.setAlert(Announce.ALERT_VIEW); announce.setTitle(); (report.getExecType().getTagValue().toCharArray()[]){ : announce.setContent(order.getId()report.getOrdStatus().getTagValue()report.getSide().getTagValue()); ; : announce.setContent(order.getId()report.getOrdStatus().getTagValue()report.getSide().getTagValue()); ; : announce.setContent(order.getId()report.getOrdStatus().getTagValue()report.getSide().getTagValue()); ; : announce.setContent(order.getId()report.getOrdStatus().getTagValue()report.getSide().getTagValue()); ; : announce.setContent(order.getId()report.getOrdStatus().getTagValue()report.getSide().getTagValue()); ; : announce.setContent(order.getId()report.getOrdStatus().getTagValue()report.getSide().getTagValue()); ; : announce.setContent(order.getId()report.getOrdStatus().getTagValue()report.getSide().getTagValue()); ; : announce.setContent(order.getId()report.getOrdStatus().getTagValue()report.getSide().getTagValue()); ; : announce.setContent(order.getId()report.getOrdStatus().getTagValue()report.getSide().getTagValue()); ; : announce.setContent(order.getId()report.getOrdStatus().getTagValue()report.getSide().getTagValue()); ; : announce.setContent(order.getId()report.getOrdStatus().getTagValue()report.getSide().getTagValue()); ; : announce.setContent(order.getId()report.getOrdStatus().getTagValue()report.getSide().getTagValue()); ; : announce.setContent(order.getId()report.getOrdStatus().getTagValue()report.getSide().getTagValue()); ; : announce.setContent(order.getId()report.getOrdStatus().getTagValue()report.getSide().getTagValue()); ; : announce.setContent(order.getId()report.getOrdStatus().getTagValue()report.getSide().getTagValue()); ; : announce.setContent(order.getId()report.getOrdStatus().getTagValue()report.getSide().getTagValue()); ; : announce.setContent(order.getId()report.getOrdStatus().getTagValue()report.getSide().getTagValue()); ; : announce.setContent(order.getId()report.getOrdStatus().getTagValue()report.getSide().getTagValue()); ; : announce.setContent(order.getId()report.getOrdStatus().getTagValue()report.getSide().getTagValue()); ; : announce.setContent(order.getId()report.getOrdStatus().getTagValue()report.getSide().getTagValue()); ; : announce.setContent(order.getId()report.getOrdStatus().getTagValue()report.getSide().getTagValue()); ; : announce.setContent(order.getId()report.getOrdStatus().getTagValue()report.getSide().getTagValue()); ; : announce.setContent(order.getId()report.getOrdStatus().getTagValue()report.getSide().getTagValue()); ; } Calendar ca GregorianCalendar(); ca.setTime( Date()); ca.add(GregorianCalendar.MONTH, ); announce.setEndTime(ca.getTime()); announce.setDestType(Announce.DEST_TYPE_MEMBER); announceServiceImpl.addAnnounce(announce); csuLog.log_INFO(order.getMember().getLgid()order.getId()announce.getTitle()announce.getContent()); } doBusinessMessageRejectMsgHandler(BaseMsg basemsg) Exception{ BusinessMessageRejectMsg msg(BusinessMessageRejectMsg)basemsg; csuLog.log_INFO(msg.getRefMsgType().getTagValue()msg.getRefSeqNum().getTagValue()msg.getBusinessRejectReason().getTagValue()); IAnnounceService announceServiceImpl(IAnnounceService)ApplicationContextUtil.getApplicationContext().getBean(); IOrderService orderServiceImpl(IOrderService)ApplicationContextUtil.getApplicationContext().getBean(); IAdminService adminServiceImpl(IAdminService)ApplicationContextUtil.getApplicationContext().getBean(); IMemberService memberServiceImpl(IMemberService)ApplicationContextUtil.getApplicationContext().getBean(); IFundLogService fundLogServiceImpl(IFundLogService)ApplicationContextUtil.getApplicationContext().getBean(); IProductService productServiceImpl(IProductService)ApplicationContextUtil.getApplicationContext().getBean(); IStockHoldService stockHoldServiceImpl(IStockHoldService)ApplicationContextUtil.getApplicationContext().getBean(); IFreezeRecordService freezeRecordServiceImpl(IFreezeRecordService)ApplicationContextUtil.getApplicationContext().getBean(); dbidSeqNumAndDatabaseIdMap.get(msg.getRefSeqNum().getTagValue()); Order order Order(); order.setId(.parseInt(dbid)); order((IBaseServiceOrder)orderServiceImpl).get(order); Member memberorder.getMember(); Product product productServiceImpl.findByCode(order.getProduct().getCode()); StockHold stockHoldstockHoldServiceImpl.getByProductIdAndUserId(product.getId(), member.getId()); (msg.getRefMsgType().getTagValue().equals(MsgType.NEW_ORDER_SINGLE)){ transTypeorder.getTransType(); side; (transType.equals(Order.TRANSTYPE_BUY)){ side; } (transType.equals(Order.TRANSTYPE_SELL)){ side; }{ csuLog.log_ERROR(transType); } order.setState(Constant.ORDER_STATUS_REJECT); (side.equals(Constant.FIX_SIDE_BUY)){ csuLog.log_INFO(member.getLgid()order.getId()member.getAmtFrozen()member.getBalance()); member.setBalance(member.getBalance()order.getPrice()order.getWaitTrans()); FreezeRecord freezeRecordfreezeRecordServiceImpl.getByOrderIdAndUserId(order.getId(), member.getId()); member.setAmtFrozen(member.getAmtFrozen()freezeRecord.getAmt()); ((IBaseServiceMember)memberServiceImpl).modify(member); csuLog.log_INFO(member.getLgid()order.getId()member.getAmtFrozen()member.getBalance()); ((IBaseServiceFreezeRecord)freezeRecordServiceImpl).delete(freezeRecord); csuLog.log_INFO(freezeRecord.getUser().getLgid()order.getId()freezeRecord.getId()freezeRecord.getOrder().getId()freezeRecord.getAmt()); FundLog fundLog FundLog(); fundLog.setAmount(order.getPrice()order.getWaitTrans()); fundLog.setBalance(member.getBalance()); fundLog.setIp(); fundLog.setLaType(FundLog.LATYPE_TD_TAD); fundLog.setLog(order.getId()); fundLog.setLpType(FundLog.LATYPE_TD_TDD); fundLog.setMember(member); fundLog.setTime( Date()); ((IBaseServiceFundLog)fundLogServiceImpl).add(fundLog); csuLog.log_INFO(member.getLgid()order.getId()fundLog.getAmount()fundLog.getBalance()); } (side.equals(Constant.FIX_SIDE_SELL)){ stockHold.setAmt(stockHold.getAmt()order.getQuantity()); ((IBaseServiceStockHold)stockHoldServiceImpl).modify(stockHold); csuLog.log_INFO(member.getLgid()order.getId()order.getProduct().getName()order.getQuantity()stockHold.getAmt()); }{ csuLog.log_ERROR(side); } } (msg.getRefMsgType().getTagValue().equals(MsgType.ORDER_CANCEL_REQUEST)){ order.setState(order.getLastState()); } (msg.getRefMsgType().getTagValue().equals(MsgType.ORDER_CANCEL_REPLACE_REQUEST)){ order.setState(order.getLastState()); order.setPrice(order.getLastPrice()); order.setQuantity(order.getQuantity()order.getLastAmt()order.getWaitTrans()); order.setWaitTrans(order.getLastAmt()); transTypeorder.getTransType(); side; (transType.equals(Order.TRANSTYPE_BUY)){ side; } (transType.equals(Order.TRANSTYPE_SELL)){ side; }{ csuLog.log_ERROR(transType); } (side.equals(Constant.FIX_SIDE_BUY)){ csuLog.log_INFO(member.getLgid()order.getId()member.getAmtFrozen()member.getBalance()); moneyorder.getPrice()order.getWaitTrans()order.getLastAmt()order.getLastPrice(); member.setBalance(member.getBalance()money); FreezeRecord freezeRecordfreezeRecordServiceImpl.getByOrderIdAndUserId(order.getId(), member.getId()); member.setAmtFrozen(member.getAmtFrozen()money); ((IBaseServiceMember)memberServiceImpl).modify(member); csuLog.log_INFO(member.getLgid()order.getId()member.getAmtFrozen()member.getBalance()); freezeRecord.setAmt(freezeRecord.getAmt()money); ((IBaseServiceFreezeRecord)freezeRecordServiceImpl).modify(freezeRecord); csuLog.log_INFO(member.getLgid()order.getId()(money)freezeRecord.getAmt()); FundLog fundLog FundLog(); fundLog.setAmount(money); fundLog.setBalance(member.getBalance()); fundLog.setIp(); fundLog.setLaType(FundLog.LATYPE_TD_TAD); fundLog.setLog(order.getId()); fundLog.setLpType(FundLog.LATYPE_TD_TDD); fundLog.setMember(member); fundLog.setTime( Date()); ((IBaseServiceFundLog)fundLogServiceImpl).add(fundLog); csuLog.log_INFO(member.getLgid()order.getId()fundLog.getAmount()fundLog.getBalance()); } (side.equals(Constant.FIX_SIDE_SELL)){ stockHold.setAmt(stockHold.getAmt()(order.getWaitTrans()order.getLastAmt())); ((IBaseServiceStockHold)stockHoldServiceImpl).modify(stockHold); csuLog.log_INFO(member.getLgid()order.getId()order.getProduct().getName()(order.getWaitTrans()order.getLastAmt())stockHold.getAmt()); }{ csuLog.log_ERROR(side); } }{ csuLog.log_ERROR(); } ((IBaseServiceOrder)orderServiceImpl).modify(order); Announce announce Announce(); announce.setBeginTime( Date()); announce.setUpdateTime( Date()); Admin admin Admin(); admin.setLgid(); adminadminServiceImpl.getAdminByLgid(admin); announce.setPromulgator(admin); announce.setMember(order.getMember()); announce.setAlert(Announce.ALERT_VIEW); announce.setTitle(); (.parseInt(msg.getBusinessRejectReason().getTagValue())){ : announce.setContent(); ; : announce.setContent(); ; : announce.setContent(); ; : announce.setContent(); ; : announce.setContent(); ; : announce.setContent(); ; : announce.setContent(); ; : announce.setContent(); ; : announce.setContent(); ; : announce.setContent(); ; } Calendar ca GregorianCalendar(); ca.setTime( Date()); ca.add(GregorianCalendar.MONTH, ); announce.setEndTime(ca.getTime()); announce.setDestType(Announce.DEST_TYPE_MEMBER); announceServiceImpl.addAnnounce(announce); csuLog.log_INFO(order.getMember().getLgid()order.getId()announce.getTitle()announce.getContent()); } doOrderCancelRejectMsgHandler(BaseMsg message) Exception{ OrderCancelRejectMsg msg(OrderCancelRejectMsg)message; IAnnounceService announceServiceImpl(IAnnounceService)ApplicationContextUtil.getApplicationContext().getBean(); IOrderService orderServiceImpl(IOrderService)ApplicationContextUtil.getApplicationContext().getBean(); IAdminService adminServiceImpl(IAdminService)ApplicationContextUtil.getApplicationContext().getBean(); IMemberService memberServiceImpl(IMemberService)ApplicationContextUtil.getApplicationContext().getBean(); IFundLogService fundLogServiceImpl(IFundLogService)ApplicationContextUtil.getApplicationContext().getBean(); IFreezeRecordService freezeRecordServiceImpl(IFreezeRecordService)ApplicationContextUtil.getApplicationContext().getBean(); IStockHoldService stockHoldServiceImpl(IStockHoldService)ApplicationContextUtil.getApplicationContext().getBean(); orgClOrdmsg.getOrigClOrdID().getTagValue(); dbIdOrderIdAndDatabaseIdMap.get(orgClOrd); Order order Order(); order.setId(.parseLong(dbId)); order((IBaseServiceOrder)orderServiceImpl).get(order); cxlRejResponseTomsg.getCxlRejResponseTo().getTagValue(); Member memberorder.getMember(); transTypeorder.getTransType(); (transType.equals(Order.TRANSTYPE_BUY)){ (cxlRejResponseTo.equals()){ order.setState(order.getLastState()); } (cxlRejResponseTo.equals()){ moneyorder.getPrice()order.getWaitTrans()order.getLastAmt()order.getLastPrice(); order.setState(order.getLastState()); order.setPrice(order.getLastPrice()); order.setQuantity(order.getQuantity()order.getLastAmt()order.getWaitTrans()); order.setWaitTrans(order.getLastAmt()); csuLog.log_INFO(member.getLgid()order.getId()member.getBalance()member.getAmtFrozen()); member.setBalance(member.getBalance()money); member.setAmtFrozen(member.getAmtFrozen()money); ((IBaseServiceMember)memberServiceImpl).modify(member); csuLog.log_INFO(member.getLgid()order.getId()member.getBalance()moneymember.getAmtFrozen()(money)); FundLog fundLog FundLog(); fundLog.setAmount(money); fundLog.setBalance(member.getBalance()); fundLog.setIp(); fundLog.setLaType(FundLog.LATYPE_TD_TAD); fundLog.setLog(order.getId()); fundLog.setLpType(FundLog.LATYPE_TD_TDD); fundLog.setMember(member); fundLog.setTime( Date()); ((IBaseServiceFundLog)fundLogServiceImpl).add(fundLog); csuLog.log_INFO(member.getLgid()order.getId()fundLog.getAmount()fundLog.getBalance()); FreezeRecord freezeRecordfreezeRecordServiceImpl.getByOrderIdAndUserId(order.getId(), order.getMember().getId()); freezeRecord.setAmt(freezeRecord.getAmt()money); ((IBaseServiceFreezeRecord)freezeRecordServiceImpl).modify(freezeRecord); csuLog.log_INFO(member.getLgid()order.getId()(money)freezeRecord.getAmt()); }{ csuLog.log_ERROR(cxlRejResponseTo); } } (transType.equals(Order.TRANSTYPE_SELL)){ (cxlRejResponseTo.equals()){ order.setState(order.getLastState()); } (cxlRejResponseTo.equals()){ order.setState(order.getLastState()); order.setPrice(order.getLastPrice()); order.setQuantity(order.getQuantity()order.getLastAmt()order.getWaitTrans()); order.setWaitTrans(order.getLastAmt()); StockHold stockHoldstockHoldServiceImpl.getByProductIdAndUserId(order.getProduct().getId(),order.getMember().getId()); (stockHold){ csuLog.log_ERROR(); }{ stockHold.setAmt(stockHold.getAmt()order.getWaitTrans()order.getLastAmt()); ((IBaseServiceStockHold)stockHoldServiceImpl).modify(stockHold); } csuLog.log_INFO(member.getLgid()order.getId()(order.getWaitTrans()order.getLastAmt())stockHold.getAmt()); }{ csuLog.log_ERROR(cxlRejResponseTo); } }{ csuLog.log_ERROR(transType); } ((IBaseServiceOrder)orderServiceImpl).modify(order); Announce announce Announce(); announce.setBeginTime( Date()); announce.setUpdateTime( Date()); Admin admin Admin(); admin.setLgid(); adminadminServiceImpl.getAdminByLgid(admin); announce.setPromulgator(admin); announce.setMember(order.getMember()); announce.setAlert(Announce.ALERT_VIEW); (msg.getCxlRejReason().getTagValue()){ (.parseInt(msg.getCxlRejReason().getTagValue())){ : announce.setContent(); ; : announce.setContent(); ; : announce.setContent(); ; : announce.setContent(); ; : announce.setContent(); ; : announce.setContent(); ; : announce.setContent(); ; : announce.setContent(); ; : announce.setContent(); ; : announce.setContent(); ; } }{ announce.setContent(); } csuLog.log_INFO(announce.getContent()); announce.setTitle(); Calendar ca GregorianCalendar(); ca.setTime( Date()); ca.add(GregorianCalendar.MONTH, ); announce.setEndTime(ca.getTime()); announce.setDestType(Announce.DEST_TYPE_MEMBER); announceServiceImpl.addAnnounce(announce); csuLog.log_INFO(member.getLgid()order.getId()announce.getTitle()announce.getContent()); } doRejectMsgHandler(BaseMsg message) Exception{ RejectMsg msg(RejectMsg)message; (msg.getSessionRejectReason().getTagValue()){ (.parseInt(msg.getSessionRejectReason().getTagValue())){ : csuLog.log_INFO(msg.getRefSeqNum().getTagValue()msg.getRefMsgType().getTagValue()msg.getText().getTagValue()); ; : csuLog.log_INFO(msg.getRefSeqNum().getTagValue()msg.getRefMsgType().getTagValue()msg.getText().getTagValue()); ; : csuLog.log_INFO(msg.getRefSeqNum().getTagValue()msg.getRefMsgType().getTagValue()msg.getText().getTagValue()); ; : csuLog.log_INFO(msg.getRefSeqNum().getTagValue()msg.getRefMsgType().getTagValue()msg.getText().getTagValue()); ; : csuLog.log_INFO(msg.getRefSeqNum().getTagValue()msg.getRefMsgType().getTagValue()msg.getText().getTagValue()); ; : csuLog.log_INFO(msg.getRefSeqNum().getTagValue()msg.getRefMsgType().getTagValue()msg.getText().getTagValue()); ; : csuLog.log_INFO(msg.getRefSeqNum().getTagValue()msg.getRefMsgType().getTagValue()msg.getText().getTagValue()); ; : csuLog.log_INFO(msg.getRefSeqNum().getTagValue()msg.getRefMsgType().getTagValue()msg.getText().getTagValue()); ; : csuLog.log_INFO(msg.getRefSeqNum().getTagValue()msg.getRefMsgType().getTagValue()msg.getText().getTagValue()); ; : csuLog.log_INFO(msg.getRefSeqNum().getTagValue()msg.getRefMsgType().getTagValue()msg.getText().getTagValue()); ; : csuLog.log_INFO(msg.getRefSeqNum().getTagValue()msg.getRefMsgType().getTagValue()msg.getText().getTagValue()); ; : csuLog.log_INFO(msg.getRefSeqNum().getTagValue()msg.getRefMsgType().getTagValue()msg.getText().getTagValue()); ; : csuLog.log_INFO(msg.getRefSeqNum().getTagValue()msg.getRefMsgType().getTagValue()msg.getText().getTagValue()); ; : csuLog.log_INFO(msg.getRefSeqNum().getTagValue()msg.getRefMsgType().getTagValue()msg.getText().getTagValue()); ; : csuLog.log_INFO(msg.getRefSeqNum().getTagValue()msg.getRefMsgType().getTagValue()msg.getText().getTagValue()); ; : csuLog.log_INFO(msg.getRefSeqNum().getTagValue()msg.getRefMsgType().getTagValue()msg.getText().getTagValue()); ; : csuLog.log_INFO(msg.getRefSeqNum().getTagValue()msg.getRefMsgType().getTagValue()msg.getText().getTagValue()); ; : csuLog.log_INFO(msg.getRefSeqNum().getTagValue()msg.getRefMsgType().getTagValue()msg.getText().getTagValue()); ; : csuLog.log_INFO(msg.getRefSeqNum().getTagValue()msg.getRefMsgType().getTagValue()msg.getText().getTagValue()); ; : csuLog.log_INFO(msg.getRefSeqNum().getTagValue()msg.getRefMsgType().getTagValue()msg.getText().getTagValue()); ; } }{ csuLog.log_INFO(msg.getRefSeqNum().getTagValue()msg.getRefMsgType().getTagValue()msg.getText().getTagValue()); } IAnnounceService announceServiceImpl(IAnnounceService)ApplicationContextUtil.getApplicationContext().getBean(); IOrderService orderServiceImpl(IOrderService)ApplicationContextUtil.getApplicationContext().getBean(); IAdminService adminServiceImpl(IAdminService)ApplicationContextUtil.getApplicationContext().getBean(); dbidSeqNumAndDatabaseIdMap.get(msg.getRefSeqNum().getTagValue()); IMemberService memberServiceImpl(IMemberService)ApplicationContextUtil.getApplicationContext().getBean(); IFundLogService fundLogServiceImpl(IFundLogService)ApplicationContextUtil.getApplicationContext().getBean(); IFreezeRecordService freezeRecordServiceImpl(IFreezeRecordService)ApplicationContextUtil.getApplicationContext().getBean(); IStockHoldService stockHoldServiceImpl(IStockHoldService)ApplicationContextUtil.getApplicationContext().getBean(); Order order Order(); order.setId(.parseInt(dbid)); order((IBaseServiceOrder)orderServiceImpl).get(order); Member memberorder.getMember(); (msg.getRefMsgType().getTagValue().equals()){ { (order.getTransType().equals(Order.TRANSTYPE_BUY)){ (order.getState().equals(Constant.ORDER_STATUS_CREATE_NOT_SUBMIT)){ csuLog.log_INFO(member.getLgid()order.getId()member.getBalance()member.getAmtFrozen()); moneyorder.getPrice()order.getWaitTrans(); member.setBalance(member.getBalance()money); member.setAmtFrozen(member.getAmtFrozen()money); ((IBaseServiceMember)memberServiceImpl).modify(member); csuLog.log_INFO(member.getLgid()order.getId()member.getBalance()moneymember.getAmtFrozen()(money)); FundLog fundLog FundLog(); fundLog.setAmount(money); fundLog.setBalance(member.getBalance()); fundLog.setIp(); fundLog.setLaType(FundLog.LATYPE_TD_TAD); fundLog.setLog(order.getId()); fundLog.setLpType(FundLog.LATYPE_TD_TDD); fundLog.setMember(member); fundLog.setTime( Date()); ((IBaseServiceFundLog)fundLogServiceImpl).add(fundLog); csuLog.log_INFO(member.getLgid()order.getId()fundLog.getAmount()fundLog.getBalance()); ((IBaseServiceOrder)orderServiceImpl).delete(order); csuLog.log_INFO(member.getLgid()order.getId()); FreezeRecord freezeRecordfreezeRecordServiceImpl.getByOrderIdAndUserId(order.getId(), order.getMember().getId()); ((IBaseServiceFreezeRecord)freezeRecordServiceImpl).delete(freezeRecord); csuLog.log_INFO(member.getLgid()order.getId()freezeRecord.getAmt()); }{ csuLog.log_ERROR(Constant.ORDER_STATUS_CREATE_NOT_SUBMITorder.getState()); } } (order.getTransType().equals(Order.TRANSTYPE_SELL)){ (order.getState().equals(Constant.ORDER_STATUS_CREATE_NOT_SUBMIT)){ ((IBaseServiceOrder)orderServiceImpl).delete(order); csuLog.log_INFO(member.getLgid()order.getId()); StockHold stockHoldstockHoldServiceImpl.getByProductIdAndUserId(order.getProduct().getId(), order.getMember().getId()); (stockHold){ csuLog.log_ERROR(order.getId()order.getProduct().getName()order.getMember().getLgid()); }{ stockHold.setAmt(stockHold.getAmt()order.getQuantity()); ((IBaseServiceStockHold)stockHoldServiceImpl).modify(stockHold); } csuLog.log_INFO(order.getMember().getLgid()order.getId()order.getProduct().getName()order.getQuantity()stockHold.getAmt()); }{ csuLog.log_ERROR(Constant.ORDER_STATUS_CREATE_NOT_SUBMITorder.getState()); } }{ csuLog.log_ERROR(order.getTransType()); } }(Exception e){ logger.error(, e); } } (msg.getRefMsgType().getTagValue().equals()){ order.setState(order.getLastState()); { ((IBaseServiceOrder)orderServiceImpl).modify(order); } (Exception e) { logger.error(, e); } } (msg.getRefMsgType().getTagValue().equals()){ (order.getTransType().equals(Order.TRANSTYPE_BUY)){ moneyorder.getPrice()order.getWaitTrans()order.getLastAmt()order.getLastPrice(); order.setState(order.getLastState()); order.setPrice(order.getLastPrice()); order.setQuantity(order.getQuantity()order.getLastAmt()order.getWaitTrans()); order.setWaitTrans(order.getLastAmt()); csuLog.log_INFO(member.getLgid()order.getId()member.getBalance()member.getAmtFrozen()); member.setBalance(member.getBalance()money); member.setAmtFrozen(member.getAmtFrozen()money); { ((IBaseServiceMember)memberServiceImpl).modify(member); csuLog.log_INFO(member.getLgid()order.getId()member.getBalance()moneymember.getAmtFrozen()(money)); FreezeRecord freezeRecordfreezeRecordServiceImpl.getByOrderIdAndUserId(order.getId(), order.getMember().getId()); freezeRecord.setAmt(freezeRecord.getAmt()money); ((IBaseServiceFreezeRecord)freezeRecordServiceImpl).modify(freezeRecord); csuLog.log_INFO(member.getLgid()order.getId()(money)freezeRecord.getAmt()); } (Exception e) { logger.error(, e); } FundLog fundLog FundLog(); fundLog.setAmount(money); fundLog.setBalance(member.getBalance()); fundLog.setIp(); fundLog.setLaType(FundLog.LATYPE_TD_TAD); fundLog.setLog(order.getId()); fundLog.setLpType(FundLog.LATYPE_TD_TDD); fundLog.setMember(member); fundLog.setTime( Date()); { ((IBaseServiceFundLog)fundLogServiceImpl).add(fundLog); csuLog.log_INFO(member.getLgid()order.getId()fundLog.getAmount()fundLog.getBalance()); ((IBaseServiceOrder)orderServiceImpl).modify(order); } (Exception e) { logger.error(, e); } } (order.getTransType().equals(Order.TRANSTYPE_SELL)){ order.setState(order.getLastState()); order.setPrice(order.getLastPrice()); order.setQuantity(order.getQuantity()order.getLastAmt()order.getWaitTrans()); order.setWaitTrans(order.getLastAmt()); { ((IBaseServiceOrder)orderServiceImpl).modify(order); StockHold stockHoldstockHoldServiceImpl.getByProductIdAndUserId(order.getProduct().getId(), order.getMember().getId()); (stockHold){ csuLog.log_ERROR(order.getId()order.getProduct().getName()order.getMember().getLgid()); }{ stockHold.setAmt(stockHold.getAmt()order.getWaitTrans()order.getLastAmt()); ((IBaseServiceStockHold)stockHoldServiceImpl).modify(stockHold); } csuLog.log_INFO(member.getLgid()order.getId()(order.getWaitTrans()order.getLastAmt())stockHold.getAmt()); } (Exception e) { logger.error(, e); } }{ csuLog.log_ERROR(order.getTransType()); } } Announce announce Announce(); announce.setBeginTime( Date()); announce.setUpdateTime( Date()); Admin admin Admin(); admin.setLgid(); adminadminServiceImpl.getAdminByLgid(admin); announce.setPromulgator(admin); announce.setMember(order.getMember()); announce.setAlert(Announce.ALERT_VIEW); announce.setTitle(); announce.setContent(); Calendar ca GregorianCalendar(); ca.setTime( Date()); ca.add(GregorianCalendar.MONTH, ); announce.setEndTime(ca.getTime()); announce.setDestType(Announce.DEST_TYPE_MEMBER); announceServiceImpl.addAnnounce(announce); csuLog.log_INFO(member.getLgid()order.getId()announce.getTitle()announce.getContent()); } }