Authored by qinchao

fix: erp 对接物流,增加mobile属性

... ... @@ -19,4 +19,7 @@ public class ExpressForMqSend extends BaseBO {
//用户id(*)
private Integer uid;
//收货人的手机号
private String mobile;
}
... ...
... ... @@ -37,7 +37,7 @@ public class AppraiseController {
@IgnoreSignature
public ApiResponse returnBack(@RequestBody AppraiseExpressInfoBo appraiseExpressInfoBo) {
logger.info("in returnBack , req {}", appraiseExpressInfoBo);
return appraiseService.returnBack(appraiseExpressInfoBo.getExpressCompanyId(), appraiseExpressInfoBo.getOrderCode(), appraiseExpressInfoBo.getWayBillCode(),appraiseExpressInfoBo.getDepotNum());
return appraiseService.returnBack(appraiseExpressInfoBo.getExpressCompanyId(), appraiseExpressInfoBo.getOrderCode(), appraiseExpressInfoBo.getWayBillCode(),appraiseExpressInfoBo.getDepotNum(),appraiseExpressInfoBo.getMobile());
}
/**
... ... @@ -50,7 +50,7 @@ public class AppraiseController {
@IgnoreSignature
public ApiResponse appraiseFail(@RequestBody AppraiseExpressInfoBo appraiseExpressInfoBo) {
logger.info("in appraise Fail, req {}", appraiseExpressInfoBo);
return appraiseService.appraiseFail(appraiseExpressInfoBo.getExpressCompanyId(), appraiseExpressInfoBo.getOrderCode(), appraiseExpressInfoBo.getWayBillCode(),appraiseExpressInfoBo.getDepotNum());
return appraiseService.appraiseFail(appraiseExpressInfoBo.getExpressCompanyId(), appraiseExpressInfoBo.getOrderCode(), appraiseExpressInfoBo.getWayBillCode(),appraiseExpressInfoBo.getDepotNum(),appraiseExpressInfoBo.getMobile());
}
/**
... ... @@ -62,7 +62,7 @@ public class AppraiseController {
@IgnoreSignature
public ApiResponse appraiseSuccess(@RequestBody AppraiseExpressInfoBo appraiseExpressInfoBo) {
logger.info("in appraiseSuccess, req {}", appraiseExpressInfoBo);
return appraiseService.appraiseSuccess(appraiseExpressInfoBo.getExpressCompanyId(), appraiseExpressInfoBo.getOrderCode(), appraiseExpressInfoBo.getWayBillCode(),appraiseExpressInfoBo.getDepotNum());
return appraiseService.appraiseSuccess(appraiseExpressInfoBo.getExpressCompanyId(), appraiseExpressInfoBo.getOrderCode(), appraiseExpressInfoBo.getWayBillCode(),appraiseExpressInfoBo.getDepotNum(),appraiseExpressInfoBo.getMobile());
}
}
... ...
... ... @@ -35,7 +35,7 @@ public interface IExpressInfoService {
* @param orderCode 订单号
* @param wayBillCode 快递单号
*/
void returnBack(Integer sellerUid,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum);
void returnBack(Integer sellerUid,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum,String mobile);
/**
* 商品鉴定不通过,鉴定中心寄回商品给卖家
... ... @@ -44,7 +44,7 @@ public interface IExpressInfoService {
* @param orderCode 订单号
* @param wayBillCode 快递单号
*/
void appraiseFail(Integer sellerUid,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum);
void appraiseFail(Integer sellerUid,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum,String mobile);
/**
* 商品鉴定通过,鉴定中心发货给买家
... ... @@ -54,7 +54,7 @@ public interface IExpressInfoService {
* @param orderCode 订单号
* @param wayBillCode 快递单号
*/
void appraiseSuccess(Integer uid,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum);
void appraiseSuccess(Integer uid,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum,String mobile);
/**
* 根据订单号查询快递信息
... ...
... ... @@ -18,6 +18,8 @@ import javax.annotation.PostConstruct;
import java.security.SecureRandom;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collector;
import java.util.stream.Collectors;
/**
* Created by li.ma on 2018/9/28.
... ... @@ -67,6 +69,24 @@ public class AppraiseAddressService {
return appraiseAddressResps.get(0);
}
// 根据默认鉴定中心地址
public AppraiseAddressResp queryInitAddressByDepotNum(int depotNum) {
List<AppraiseAddressResp> appraiseAddressResps = queryAddressInfoList();
if (CollectionUtils.isEmpty(appraiseAddressResps)) {
return new AppraiseAddressResp.builder().setMobile("15010019250").setType(0).setAddressName("宫布朗").setAddress("北京市朝阳区建国路81号华贸写字楼1座3层 UFO飞碟好物【北京】实物鉴定中心").build();
}
List<AppraiseAddressResp> collect = appraiseAddressResps.stream().filter(item -> item.getType() == depotNum).collect(Collectors.toList());
if (CollectionUtils.isEmpty(collect)) {
return new AppraiseAddressResp.builder().setMobile("15010019250").setType(0).setAddressName("宫布朗").setAddress("北京市朝阳区建国路81号华贸写字楼1座3层 UFO飞碟好物【北京】实物鉴定中心").build();
}
return collect.get(0);
}
public List<AppraiseAddressResp> queryAddressInfoList() {
Object value=localCache.get(CACHE_KEY);
if(null == value) {
... ...
... ... @@ -88,7 +88,7 @@ public class AppraiseService {
private SellerService sellerService;
public ApiResponse appraiseSuccess(Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum){
public ApiResponse appraiseSuccess(Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum,String mobile){
ApiResponse apiResponse=new ApiResponse();
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
... ... @@ -181,7 +181,7 @@ public class AppraiseService {
BuyerConfirmEvent buyerConfirmEvent = BuyerConfirmEvent.builder().uid(buyerUid).orderCode(orderCode).build();
EventBusPublisher.publishEvent(buyerConfirmEvent);
//记录物流信息
expressInfoService.appraiseSuccess(buyerUid, expressCompanyId, orderCode, wayBillCode, depotNum);
expressInfoService.appraiseSuccess(buyerUid, expressCompanyId, orderCode, wayBillCode, depotNum,mobile);
//平台已发货给买家
inBoxFacade.appraisePassNotice(buyerUid, orderCode, sellerOrderGoods);
}catch (Exception ex){
... ... @@ -228,7 +228,7 @@ public class AppraiseService {
* @param wayBillCode
* @return
*/
public ApiResponse returnBack(Integer expressCompanyId, Long orderCode, String wayBillCode, Integer depotNum){
public ApiResponse returnBack(Integer expressCompanyId, Long orderCode, String wayBillCode, Integer depotNum,String mobile){
ApiResponse apiResponse=new ApiResponse();
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
... ... @@ -246,7 +246,7 @@ public class AppraiseService {
//记录物流信息
int sellerUid = buyerOrder.getSellerUid();
expressInfoService.returnBack(sellerUid, expressCompanyId, orderCode, wayBillCode, depotNum);
expressInfoService.returnBack(sellerUid, expressCompanyId, orderCode, wayBillCode, depotNum,mobile);
//发送消息
inBoxFacade.sendCancelledProductToSellerByCenter(sellerUid,wayBillCode);
... ... @@ -262,7 +262,7 @@ public class AppraiseService {
* @param wayBillCode
* @return
*/
public ApiResponse appraiseFail(Integer expressCompanyId, Long orderCode, String wayBillCode, Integer depotNum){
public ApiResponse appraiseFail(Integer expressCompanyId, Long orderCode, String wayBillCode, Integer depotNum,String mobile){
ApiResponse apiResponse=new ApiResponse();
BuyerOrder buyerOrder = buyerOrderMapper.selectOnlyByOrderCode(orderCode);
... ... @@ -360,7 +360,7 @@ public class AppraiseService {
}finally {
//更新物流信息,写到最后
expressInfoService.appraiseFail(sellerUid, expressCompanyId, orderCode, wayBillCode, depotNum);
expressInfoService.appraiseFail(sellerUid, expressCompanyId, orderCode, wayBillCode, depotNum,mobile);
}
}else{
... ...
... ... @@ -139,7 +139,7 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
saveExpress(sellerUid,expressCompanyId,orderCode,wayBillCode,expressType,depotNum);
// 发送mq获取物流信息
sendExpressMQ(sellerUid,expressCompanyId,orderCode,wayBillCode);
sendExpressMQ(sellerUid,expressCompanyId,orderCode,wayBillCode,appraiseAddressService.queryInitAddressByDepotNum(depotNum).getMobile());
psog = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
LOGGER.info("deliverToDepot end ! send express to erp ");
inBoxFacade.sellerDeliver2Depot(buyerUid, orderCode, psog.getProductName());
... ... @@ -157,47 +157,47 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
}
@Override
public void returnBack(Integer sellerUid,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum){
public void returnBack(Integer sellerUid,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum,String mobile){
Integer expressType = ExpressInfoConstant.EXPRESS_TYPE_REBACK;
LOGGER.info("returnBack expressCompanyId = {}, orderCode = {}, wayBillCode = {} " +
",expressType = {},depotNum={}", new Object[]{expressCompanyId, orderCode, wayBillCode,expressType,depotNum});
",expressType = {},depotNum={},mobile={}", new Object[]{expressCompanyId, orderCode, wayBillCode,expressType,depotNum,mobile});
// 保存订单物流信息
saveExpress(sellerUid,expressCompanyId,orderCode,wayBillCode,expressType,depotNum);
// 发送mq获取物流信息
sendExpressMQ(sellerUid,expressCompanyId,orderCode,wayBillCode);
sendExpressMQ(sellerUid,expressCompanyId,orderCode,wayBillCode,mobile);
LOGGER.info("returnBack end ! send express to erp ");
}
@Override
public void appraiseFail(Integer sellerUid ,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum) {
public void appraiseFail(Integer sellerUid ,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum,String mobile) {
Integer expressType = ExpressInfoConstant.EXPRESS_TYPE_3;
LOGGER.info("appraiseFail expressCompanyId = {}, orderCode = {}, wayBillCode = {} " +
",expressType = {},depotNum={}", new Object[]{expressCompanyId, orderCode, wayBillCode,expressType,depotNum});
",expressType = {},depotNum={},mobile={}", new Object[]{expressCompanyId, orderCode, wayBillCode,expressType,depotNum,mobile});
// 保存订单物流信息
saveExpress(sellerUid,expressCompanyId,orderCode,wayBillCode,expressType,depotNum);
// 发送mq获取物流信息
sendExpressMQ(sellerUid,expressCompanyId,orderCode,wayBillCode);
sendExpressMQ(sellerUid,expressCompanyId,orderCode,wayBillCode,mobile);
LOGGER.info("appraiseFail end ! send express to erp ");
}
@Override
public void appraiseSuccess(Integer uid,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum) {
public void appraiseSuccess(Integer uid,Integer expressCompanyId, Long orderCode, String wayBillCode,Integer depotNum,String mobile) {
Integer expressType = ExpressInfoConstant.EXPRESS_TYPE_2;
LOGGER.info("appraiseSuccess expressCompanyId = {}, orderCode = {}, wayBillCode = {} " +
",expressType = {},depotNum={} ", new Object[]{expressCompanyId, orderCode, wayBillCode,expressType,depotNum});
",expressType = {},depotNum={},mobile={} ", new Object[]{expressCompanyId, orderCode, wayBillCode,expressType,depotNum,mobile});
// 保存订单物流信息
saveExpress(uid,expressCompanyId,orderCode,wayBillCode,expressType,depotNum);
// 发送mq获取物流信息
sendExpressMQ(uid,expressCompanyId,orderCode,wayBillCode);
sendExpressMQ(uid,expressCompanyId,orderCode,wayBillCode,mobile);
LOGGER.info("appraiseSuccess end ! send express to erp ");
}
... ... @@ -227,13 +227,14 @@ public class ExpressInfoServiceImpl implements IExpressInfoService {
/**
* 发送mq消息,获取物流信息
*/
private void sendExpressMQ(Integer uid,Integer expressCompanyId,Long orderCode,String wayBillCode ){
private void sendExpressMQ(Integer uid,Integer expressCompanyId,Long orderCode,String wayBillCode,String mobile ){
ExpressForMqSend mqInfo=new ExpressForMqSend();
mqInfo.setExpressNumber(wayBillCode);
mqInfo.setExpressId(expressCompanyId);
mqInfo.setOrderCode(orderCode);
mqInfo.setUid(uid);
mqInfo.setBusinessType(5);
mqInfo.setMobile(mobile);
try{
ufoExpressInfoProducer.send(EXPRESS_MQ_SEND, mqInfo);
... ...