Authored by chenchao

add in Event trigger

@@ -18,6 +18,9 @@ public interface IGoodsService { @@ -18,6 +18,9 @@ public interface IGoodsService {
18 */ 18 */
19 int platformReceiveGoods(long orderCode); 19 int platformReceiveGoods(long orderCode);
20 20
  21 +
  22 + int platformChecking(long orderCode);
  23 +
21 /** 24 /**
22 * 鉴定通过 25 * 鉴定通过
23 * @param orderCode 26 * @param orderCode
@@ -66,6 +66,12 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService { @@ -66,6 +66,12 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService {
66 return rows; 66 return rows;
67 } 67 }
68 68
  69 + /**
  70 + * 质检通过
  71 + * @param orderCode
  72 + * @return
  73 + */
  74 + @Override
69 public int platformChecking(long orderCode){ 75 public int platformChecking(long orderCode){
70 AppraiseOrderStatus targetStatus = AppraiseOrderStatus.PLATFORM_CHECKING, 76 AppraiseOrderStatus targetStatus = AppraiseOrderStatus.PLATFORM_CHECKING,
71 expectedStatus = AppraiseOrderStatus.PLATFORM_RECEIVE; 77 expectedStatus = AppraiseOrderStatus.PLATFORM_RECEIVE;
@@ -97,7 +103,7 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService { @@ -97,7 +103,7 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService {
97 public int appraiseFake(long orderCode){ 103 public int appraiseFake(long orderCode){
98 104
99 AppraiseOrderStatus targetStatus = AppraiseOrderStatus.CHECKING_FAKE, 105 AppraiseOrderStatus targetStatus = AppraiseOrderStatus.CHECKING_FAKE,
100 - expectedStatus = AppraiseOrderStatus.PLATFORM_RECEIVE; 106 + expectedStatus = AppraiseOrderStatus.PLATFORM_CHECKING;
101 107
102 int rows = triggerStatusChange(orderCode, targetStatus, expectedStatus); 108 int rows = triggerStatusChange(orderCode, targetStatus, expectedStatus);
103 logger.info("appraise order appraiseFake update status, orderCode {} rows {}", orderCode, rows); 109 logger.info("appraise order appraiseFake update status, orderCode {} rows {}", orderCode, rows);
@@ -849,7 +849,8 @@ public class AppraiseService { @@ -849,7 +849,8 @@ public class AppraiseService {
849 Long orderCode = appraiseExpressInfoBo.getOrderCode(); 849 Long orderCode = appraiseExpressInfoBo.getOrderCode();
850 ApiResponse apiResponse = new ApiResponse(); 850 ApiResponse apiResponse = new ApiResponse();
851 if (serviceOrderProcessor.isGoodsServiceOrder(orderCode)){ 851 if (serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
852 - 852 + serviceOrderProcessor.findGoodsServiceInstance(orderCode).appraiseFake(orderCode);
  853 + apiResponse.setCode(200);
853 return apiResponse; 854 return apiResponse;
854 } 855 }
855 856
@@ -1095,12 +1096,16 @@ public class AppraiseService { @@ -1095,12 +1096,16 @@ public class AppraiseService {
1095 */ 1096 */
1096 public ApiResponse judgeCenterNotPass(Long orderCode) { 1097 public ApiResponse judgeCenterNotPass(Long orderCode) {
1097 LOGGER.info("judgeCenterNotPass enter , orderCode {} ", orderCode); 1098 LOGGER.info("judgeCenterNotPass enter , orderCode {} ", orderCode);
  1099 + ApiResponse apiResponse = new ApiResponse();
  1100 + if(serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
  1101 + serviceOrderProcessor.findGoodsServiceInstance(orderCode).appraiseFake(orderCode);
  1102 + apiResponse.setCode(200);
  1103 + return apiResponse;
  1104 + }
  1105 +
1098 OrderStatus expectStatus = OrderStatus.PLATFORM_RECEIVE; 1106 OrderStatus expectStatus = OrderStatus.PLATFORM_RECEIVE;
1099 OrderStatus targetStatus = OrderStatus.CHECKING_FAKE; 1107 OrderStatus targetStatus = OrderStatus.CHECKING_FAKE;
1100 -  
1101 - ApiResponse apiResponse = new ApiResponse();  
1102 BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode); 1108 BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
1103 -  
1104 if (buyerOrder == null) { 1109 if (buyerOrder == null) {
1105 LOGGER.warn("judgeCenterNotPass getOrderInfo order not exist, orderCode {}", orderCode); 1110 LOGGER.warn("judgeCenterNotPass getOrderInfo order not exist, orderCode {}", orderCode);
1106 throw new ServiceException(ServiceError.ORDER_NULL); 1111 throw new ServiceException(ServiceError.ORDER_NULL);
@@ -1172,12 +1177,21 @@ public class AppraiseService { @@ -1172,12 +1177,21 @@ public class AppraiseService {
1172 */ 1177 */
1173 public ApiResponse qualityCheckReject(SaveQualityCheckInfoRequest request) { 1178 public ApiResponse qualityCheckReject(SaveQualityCheckInfoRequest request) {
1174 LOGGER.info("qualityCheckReject enter , appraiseExpressInfoBo {} ", request); 1179 LOGGER.info("qualityCheckReject enter , appraiseExpressInfoBo {} ", request);
  1180 + Long orderCode = request.getOrderCode();
  1181 + ApiResponse apiResponse = new ApiResponse();
  1182 + if (serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
  1183 + LOGGER.info("qualityCheckReject isGoodsServiceOrder order code {}", orderCode);
  1184 + serviceOrderProcessor.findGoodsServiceInstance(orderCode).appraiseFake(orderCode);
  1185 + apiResponse.setCode(200);
  1186 + return apiResponse;
  1187 + }
  1188 +
1175 OrderStatus expectStatus = OrderStatus.PLATFORM_RECEIVE; 1189 OrderStatus expectStatus = OrderStatus.PLATFORM_RECEIVE;
1176 OrderStatus targetStatus = OrderStatus.QUALITY_CHECK_FAKE; 1190 OrderStatus targetStatus = OrderStatus.QUALITY_CHECK_FAKE;
1177 - Long orderCode = request.getOrderCode(); 1191 +
1178 QualityCheck qualityCheck = request.getQualityCheck(); 1192 QualityCheck qualityCheck = request.getQualityCheck();
1179 1193
1180 - ApiResponse apiResponse = new ApiResponse(); 1194 +
1181 BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode); 1195 BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
1182 1196
1183 if (buyerOrder == null) { 1197 if (buyerOrder == null) {
@@ -1264,6 +1278,13 @@ public class AppraiseService { @@ -1264,6 +1278,13 @@ public class AppraiseService {
1264 public ApiResponse judgeCenterPass(Long orderCode) { 1278 public ApiResponse judgeCenterPass(Long orderCode) {
1265 LOGGER.info("judgeCenterPass enter orderCode {}", orderCode); 1279 LOGGER.info("judgeCenterPass enter orderCode {}", orderCode);
1266 ApiResponse apiResponse = new ApiResponse(); 1280 ApiResponse apiResponse = new ApiResponse();
  1281 + if(serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
  1282 + LOGGER.info("judgeCenterPass isGoodsServiceOrder orderCode {}", orderCode);
  1283 + serviceOrderProcessor.findGoodsServiceInstance(orderCode).appraisePass(orderCode);
  1284 + apiResponse.setCode(200);
  1285 + return apiResponse;
  1286 + }
  1287 +
1267 BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode); 1288 BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
1268 1289
1269 if (buyerOrder == null) { 1290 if (buyerOrder == null) {
@@ -1514,6 +1535,12 @@ public class AppraiseService { @@ -1514,6 +1535,12 @@ public class AppraiseService {
1514 * @param orderCode 1535 * @param orderCode
1515 */ 1536 */
1516 public void appraiseUnsure(Integer uid, Long orderCode) { 1537 public void appraiseUnsure(Integer uid, Long orderCode) {
  1538 + if (serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
  1539 + LOGGER.info("in appraiseUnsure isGoodsServiceOrder ordercode {}", orderCode);
  1540 + serviceOrderProcessor.findGoodsServiceInstance(orderCode).unsure(orderCode);
  1541 + }
  1542 +
  1543 +
1517 new BuyerOrderCancelHandler(uid, orderCode) 1544 new BuyerOrderCancelHandler(uid, orderCode)
1518 .withBuyerOrderSupplier(buyerOrderMapper, buyerOrderGoodsMapper) 1545 .withBuyerOrderSupplier(buyerOrderMapper, buyerOrderGoodsMapper)
1519 .withSellerOrderSupplier(sellerOrderGoodsMapper, sellerOrderMetaMapper) 1546 .withSellerOrderSupplier(sellerOrderGoodsMapper, sellerOrderMetaMapper)
@@ -105,6 +105,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -105,6 +105,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
105 @Autowired 105 @Autowired
106 private OrderChangeListenerContainer orderChangeListenerContainer; 106 private OrderChangeListenerContainer orderChangeListenerContainer;
107 107
  108 + @Autowired
  109 + protected ServiceOrderProcessor serviceOrderProcessor;
  110 +
108 /** 111 /**
109 * 提交订单 112 * 提交订单
110 * @param orderRequest 113 * @param orderRequest
@@ -685,6 +688,13 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -685,6 +688,13 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
685 @Override 688 @Override
686 public void confirmReceive(long orderCode) { 689 public void confirmReceive(long orderCode) {
687 logger.info("in confirmReceive, orderCode {}", orderCode); 690 logger.info("in confirmReceive, orderCode {}", orderCode);
  691 + if(serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
  692 + logger.info("in confirmReceive isGoodsServiceOrder, orderCode {}", orderCode);
  693 + serviceOrderProcessor.findGoodsServiceInstance(orderCode).platformReceiveGoods(orderCode);
  694 + return;
  695 + }
  696 +
  697 +
688 OrderStatus expectStatus = OrderStatus.SELLER_SEND_OUT; 698 OrderStatus expectStatus = OrderStatus.SELLER_SEND_OUT;
689 OrderStatus targetStatus = OrderStatus.PLATFORM_RECEIVE; 699 OrderStatus targetStatus = OrderStatus.PLATFORM_RECEIVE;
690 BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode); 700 BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode);
@@ -719,6 +729,13 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService { @@ -719,6 +729,13 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
719 @Override 729 @Override
720 public void qualityCheckPass(long orderCode){ 730 public void qualityCheckPass(long orderCode){
721 logger.info("in qualityCheckPass, orderCode {}", orderCode); 731 logger.info("in qualityCheckPass, orderCode {}", orderCode);
  732 + if(serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
  733 + logger.info("in qualityCheckPass order is GoodsServiceOrder orderCode {}", orderCode);
  734 + serviceOrderProcessor.findGoodsServiceInstance(orderCode).platformChecking(orderCode);
  735 + return;
  736 + }
  737 +
  738 +
722 OrderStatus expectStatus = OrderStatus.PLATFORM_RECEIVE; 739 OrderStatus expectStatus = OrderStatus.PLATFORM_RECEIVE;
723 OrderStatus targetStatus = OrderStatus.PLATFORM_CHECKING; 740 OrderStatus targetStatus = OrderStatus.PLATFORM_CHECKING;
724 BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode); 741 BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode);
@@ -29,8 +29,8 @@ public class ServiceOrderProcessor { @@ -29,8 +29,8 @@ public class ServiceOrderProcessor {
29 @Autowired 29 @Autowired
30 private OrderCodeGenerator orderCodeGenerator; 30 private OrderCodeGenerator orderCodeGenerator;
31 31
32 - public IGoodsService findGoodsSeriveInstance(int oac){  
33 - OrderAttributes oa = OrderAttributes.getOrderAttributes(oac); 32 + public IGoodsService findGoodsServiceInstance(int orderAttributesCode){
  33 + OrderAttributes oa = OrderAttributes.getOrderAttributes(orderAttributesCode);
34 IGoodsService goodsService = null; 34 IGoodsService goodsService = null;
35 switch (oa){ 35 switch (oa){
36 case APPRAISE: 36 case APPRAISE:
@@ -60,7 +60,7 @@ public class ServiceOrderProcessor { @@ -60,7 +60,7 @@ public class ServiceOrderProcessor {
60 throw new ServiceException(ServiceError.ORDER_NULL); 60 throw new ServiceException(ServiceError.ORDER_NULL);
61 } 61 }
62 AppraiseOrder appraiseOrder = existenceNode.appraiseOrder; 62 AppraiseOrder appraiseOrder = existenceNode.appraiseOrder;
63 - IGoodsService goodsService = findGoodsSeriveInstance(appraiseOrder.getAttributes()); 63 + IGoodsService goodsService = findGoodsServiceInstance(appraiseOrder.getAttributes());
64 return goodsService; 64 return goodsService;
65 } 65 }
66 } 66 }