Authored by chenchao

add in Event trigger

... ... @@ -18,6 +18,9 @@ public interface IGoodsService {
*/
int platformReceiveGoods(long orderCode);
int platformChecking(long orderCode);
/**
* 鉴定通过
* @param orderCode
... ...
... ... @@ -66,6 +66,12 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService {
return rows;
}
/**
* 质检通过
* @param orderCode
* @return
*/
@Override
public int platformChecking(long orderCode){
AppraiseOrderStatus targetStatus = AppraiseOrderStatus.PLATFORM_CHECKING,
expectedStatus = AppraiseOrderStatus.PLATFORM_RECEIVE;
... ... @@ -97,7 +103,7 @@ public abstract class AbsGoodsServiceOrderService implements IGoodsService {
public int appraiseFake(long orderCode){
AppraiseOrderStatus targetStatus = AppraiseOrderStatus.CHECKING_FAKE,
expectedStatus = AppraiseOrderStatus.PLATFORM_RECEIVE;
expectedStatus = AppraiseOrderStatus.PLATFORM_CHECKING;
int rows = triggerStatusChange(orderCode, targetStatus, expectedStatus);
logger.info("appraise order appraiseFake update status, orderCode {} rows {}", orderCode, rows);
... ...
... ... @@ -849,7 +849,8 @@ public class AppraiseService {
Long orderCode = appraiseExpressInfoBo.getOrderCode();
ApiResponse apiResponse = new ApiResponse();
if (serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
serviceOrderProcessor.findGoodsServiceInstance(orderCode).appraiseFake(orderCode);
apiResponse.setCode(200);
return apiResponse;
}
... ... @@ -1095,12 +1096,16 @@ public class AppraiseService {
*/
public ApiResponse judgeCenterNotPass(Long orderCode) {
LOGGER.info("judgeCenterNotPass enter , orderCode {} ", orderCode);
ApiResponse apiResponse = new ApiResponse();
if(serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
serviceOrderProcessor.findGoodsServiceInstance(orderCode).appraiseFake(orderCode);
apiResponse.setCode(200);
return apiResponse;
}
OrderStatus expectStatus = OrderStatus.PLATFORM_RECEIVE;
OrderStatus targetStatus = OrderStatus.CHECKING_FAKE;
ApiResponse apiResponse = new ApiResponse();
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
if (buyerOrder == null) {
LOGGER.warn("judgeCenterNotPass getOrderInfo order not exist, orderCode {}", orderCode);
throw new ServiceException(ServiceError.ORDER_NULL);
... ... @@ -1172,12 +1177,21 @@ public class AppraiseService {
*/
public ApiResponse qualityCheckReject(SaveQualityCheckInfoRequest request) {
LOGGER.info("qualityCheckReject enter , appraiseExpressInfoBo {} ", request);
Long orderCode = request.getOrderCode();
ApiResponse apiResponse = new ApiResponse();
if (serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
LOGGER.info("qualityCheckReject isGoodsServiceOrder order code {}", orderCode);
serviceOrderProcessor.findGoodsServiceInstance(orderCode).appraiseFake(orderCode);
apiResponse.setCode(200);
return apiResponse;
}
OrderStatus expectStatus = OrderStatus.PLATFORM_RECEIVE;
OrderStatus targetStatus = OrderStatus.QUALITY_CHECK_FAKE;
Long orderCode = request.getOrderCode();
QualityCheck qualityCheck = request.getQualityCheck();
ApiResponse apiResponse = new ApiResponse();
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
if (buyerOrder == null) {
... ... @@ -1264,6 +1278,13 @@ public class AppraiseService {
public ApiResponse judgeCenterPass(Long orderCode) {
LOGGER.info("judgeCenterPass enter orderCode {}", orderCode);
ApiResponse apiResponse = new ApiResponse();
if(serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
LOGGER.info("judgeCenterPass isGoodsServiceOrder orderCode {}", orderCode);
serviceOrderProcessor.findGoodsServiceInstance(orderCode).appraisePass(orderCode);
apiResponse.setCode(200);
return apiResponse;
}
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
if (buyerOrder == null) {
... ... @@ -1514,6 +1535,12 @@ public class AppraiseService {
* @param orderCode
*/
public void appraiseUnsure(Integer uid, Long orderCode) {
if (serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
LOGGER.info("in appraiseUnsure isGoodsServiceOrder ordercode {}", orderCode);
serviceOrderProcessor.findGoodsServiceInstance(orderCode).unsure(orderCode);
}
new BuyerOrderCancelHandler(uid, orderCode)
.withBuyerOrderSupplier(buyerOrderMapper, buyerOrderGoodsMapper)
.withSellerOrderSupplier(sellerOrderGoodsMapper, sellerOrderMetaMapper)
... ...
... ... @@ -105,6 +105,9 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
@Autowired
private OrderChangeListenerContainer orderChangeListenerContainer;
@Autowired
protected ServiceOrderProcessor serviceOrderProcessor;
/**
* 提交订单
* @param orderRequest
... ... @@ -685,6 +688,13 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
@Override
public void confirmReceive(long orderCode) {
logger.info("in confirmReceive, orderCode {}", orderCode);
if(serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
logger.info("in confirmReceive isGoodsServiceOrder, orderCode {}", orderCode);
serviceOrderProcessor.findGoodsServiceInstance(orderCode).platformReceiveGoods(orderCode);
return;
}
OrderStatus expectStatus = OrderStatus.SELLER_SEND_OUT;
OrderStatus targetStatus = OrderStatus.PLATFORM_RECEIVE;
BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode);
... ... @@ -719,6 +729,13 @@ public class BuyerOrderServiceImpl implements IBuyerOrderService {
@Override
public void qualityCheckPass(long orderCode){
logger.info("in qualityCheckPass, orderCode {}", orderCode);
if(serviceOrderProcessor.isGoodsServiceOrder(orderCode)){
logger.info("in qualityCheckPass order is GoodsServiceOrder orderCode {}", orderCode);
serviceOrderProcessor.findGoodsServiceInstance(orderCode).platformChecking(orderCode);
return;
}
OrderStatus expectStatus = OrderStatus.PLATFORM_RECEIVE;
OrderStatus targetStatus = OrderStatus.PLATFORM_CHECKING;
BuyerOrder buyerOrder = buyerOrderMapper.selectByOrderCode(orderCode);
... ...
... ... @@ -29,8 +29,8 @@ public class ServiceOrderProcessor {
@Autowired
private OrderCodeGenerator orderCodeGenerator;
public IGoodsService findGoodsSeriveInstance(int oac){
OrderAttributes oa = OrderAttributes.getOrderAttributes(oac);
public IGoodsService findGoodsServiceInstance(int orderAttributesCode){
OrderAttributes oa = OrderAttributes.getOrderAttributes(orderAttributesCode);
IGoodsService goodsService = null;
switch (oa){
case APPRAISE:
... ... @@ -60,7 +60,7 @@ public class ServiceOrderProcessor {
throw new ServiceException(ServiceError.ORDER_NULL);
}
AppraiseOrder appraiseOrder = existenceNode.appraiseOrder;
IGoodsService goodsService = findGoodsSeriveInstance(appraiseOrder.getAttributes());
IGoodsService goodsService = findGoodsServiceInstance(appraiseOrder.getAttributes());
return goodsService;
}
}
... ...