Pārlūkot izejas kodu

外部订单对接快递鸟

wangxy 1 nedēļu atpakaļ
vecāks
revīzija
2a40697eed

+ 1 - 1
fs-admin/src/main/java/com/fs/his/controller/FsExpressCommonController.java

@@ -39,7 +39,7 @@ public class FsExpressCommonController extends BaseController {
 	@PostMapping(path = "/expressNotify" )
 	public ExpressResultDTO expressNotify(ExpressNotifyDTO notifyDTO) throws Exception
 	{
-		return orderService.updateDeliveryItem(notifyDTO);
+		return orderService.updateDeliveryItemForStoreAndExternal(notifyDTO);
 	}
 	@PostMapping(path = "/integral" )
 	public R Integral(@RequestBody String json) throws Exception

+ 13 - 0
fs-admin/src/main/java/com/fs/his/controller/FsExternalOrderController.java

@@ -51,4 +51,17 @@ public class FsExternalOrderController extends BaseController {
     public R cancel(@PathVariable("orderId") Long orderId) {
         return fsExternalOrderService.cancelExternalOrder(orderId);
     }
+
+    @GetMapping(value = "/getExpress/{orderId}")
+    @PreAuthorize("@ss.hasPermi('his:externalOrder:express')")
+    public R getExpress(@PathVariable("orderId") Long orderId) {
+        return R.ok().put("data", fsExternalOrderService.getExpress(orderId));
+    }
+
+    @Log(title = "同步外部订单物流", businessType = BusinessType.UPDATE)
+    @GetMapping(value = "/syncExpress/{orderId}")
+    @PreAuthorize("@ss.hasPermi('his:externalOrder:syncExpress')")
+    public R syncExpress(@PathVariable("orderId") Long orderId) {
+        return fsExternalOrderService.syncExpress(orderId);
+    }
 }

+ 29 - 2
fs-admin/src/main/java/com/fs/web/controller/tool/TestController.java

@@ -1,6 +1,7 @@
 package com.fs.web.controller.tool;
 
 import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.*;
 
 import com.fs.common.core.domain.R;
@@ -12,10 +13,12 @@ import com.fs.his.enums.ProductSourceTypeEnum;
 import com.fs.his.mapper.FsStoreOrderItemMapper;
 import com.fs.his.mapper.FsStoreOrderMapper;
 import com.fs.his.mapper.FsStoreProductMapper;
+import com.fs.his.service.IFsExternalOrderService;
 import com.fs.his.service.IFsStoreOrderService;
 import com.fs.his.service.IFsStoreProductService;
 import com.fs.his.service.IFsUserService;
 import com.fs.his.task.Task;
+import com.fs.hisStore.task.ErpTask;
 import com.fs.his.mapper.FsStoreMapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.http.ResponseEntity;
@@ -67,6 +70,9 @@ public class TestController extends BaseController {
     @Autowired
     private Task task;
 
+    @Autowired
+    private ErpTask erpTask;
+
     @Autowired
     private FsStoreMapper fsStoreMapper;
 
@@ -76,6 +82,9 @@ public class TestController extends BaseController {
     @Autowired
     private FsStoreOrderItemMapper fsStoreOrderItemMapper;
 
+    @Autowired
+    private IFsExternalOrderService iFsExternalOrderService;
+
     @ApiOperation("获取用户列表")
     @GetMapping("/list")
     public AjaxResult userList() {
@@ -91,8 +100,8 @@ public class TestController extends BaseController {
     }
 
     @PostMapping("/deliveryOpJst")
-    public R executeDeliveryOpJst() throws InterruptedException {
-        task.deliveryOpJst();
+    public R executeDeliveryOpJst() throws Exception {
+        iFsExternalOrderService.syncOrderStatusFromJst();
         return R.ok();
     }
 
@@ -114,6 +123,24 @@ public class TestController extends BaseController {
         return R.ok().put("updateCount", count);
     }
 
+    /**
+     * 手动同步当天ERP商品信息
+     */
+    @GetMapping("/syncTodayProductFromErp")
+    public R syncTodayProductFromErp() {
+        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(Calendar.HOUR_OF_DAY, 0);
+        calendar.set(Calendar.MINUTE, 0);
+        calendar.set(Calendar.SECOND, 0);
+        calendar.set(Calendar.MILLISECOND, 0);
+        String modifiedBegin = formatter.format(calendar.getTime());
+        calendar.add(Calendar.DAY_OF_MONTH, 1);
+        String modifiedEnd = formatter.format(calendar.getTime());
+        erpTask.syncProductFromErp(modifiedBegin, modifiedEnd, 100);
+        return R.ok().put("modifiedBegin", modifiedBegin).put("modifiedEnd", modifiedEnd);
+    }
+
     /**
      * 测试im会员定时发课
      */

+ 13 - 0
fs-company/src/main/java/com/fs/company/controller/store/FsExternalOrderController.java

@@ -116,4 +116,17 @@ public class FsExternalOrderController extends BaseController {
                 userName,
                 param.getOrderType()));
     }
+
+    @GetMapping(value = "/getExpress/{orderId}")
+    @PreAuthorize("@ss.hasPermi('store:externalOrder:express')")
+    public R getExpress(@PathVariable("orderId") Long orderId) {
+        return R.ok().put("data", fsExternalOrderService.getExpress(orderId));
+    }
+
+    @Log(title = "同步外部订单物流", businessType = BusinessType.UPDATE)
+    @GetMapping(value = "/syncExpress/{orderId}")
+    @PreAuthorize("@ss.hasPermi('store:externalOrder:syncExpress')")
+    public R syncExpress(@PathVariable("orderId") Long orderId) {
+        return fsExternalOrderService.syncExpress(orderId);
+    }
 }

+ 6 - 0
fs-service/src/main/java/com/fs/company/domain/Company.java

@@ -81,6 +81,12 @@ public class Company extends BaseEntity
 
     private String linkName;
 
+    /** 寄件人姓名 */
+    private String senderName;
+
+    /** 寄件人手机号 */
+    private String senderPhone;
+
     private Integer limitUserCount;
 
     private Integer isDel;

+ 10 - 0
fs-service/src/main/java/com/fs/his/domain/FsExternalOrder.java

@@ -76,6 +76,16 @@ public class FsExternalOrder extends BaseEntity
     @Excel(name = "发货时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date deliveryTime;
 
+    @Excel(name = "物流状态")
+    private Integer deliveryStatus;
+
+    @Excel(name = "物流状态类型")
+    private String deliveryType;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @Excel(name = "物流更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
+    private Date deliveryUpdateTime;
+
     @Excel(name = "配送方式 1快递 2门店自提")
     private Integer shippingType;
 

+ 9 - 0
fs-service/src/main/java/com/fs/his/domain/vo/FsExternalOrderListVO.java

@@ -34,6 +34,15 @@ public class FsExternalOrderListVO {
 
     private Integer status;
 
+    private String deliverySn;
+
+    private Integer deliveryStatus;
+
+    private String deliveryType;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date deliveryUpdateTime;
+
     private String statusDesc;
 
     private Boolean isApplyAudit;

+ 2 - 0
fs-service/src/main/java/com/fs/his/mapper/FsExternalOrderMapper.java

@@ -16,6 +16,8 @@ public interface FsExternalOrderMapper {
 
     public FsExternalOrder selectFsExternalOrderByExtendOrderId(String extendOrderId);
 
+    public List<FsExternalOrder> selectFsExternalOrderListByDeliverySn(String deliverySn);
+
     public List<FsExternalOrder> selectFsExternalOrderList(FsExternalOrder fsExternalOrder);
 
     public List<FsExternalOrderListVO> selectExternalOrderListVO(FsExternalOrder fsExternalOrder);

+ 11 - 0
fs-service/src/main/java/com/fs/his/service/IFsExternalOrderService.java

@@ -5,6 +5,7 @@ import java.util.List;
 import com.fs.common.core.domain.R;
 import com.fs.his.domain.FsExternalOrder;
 import com.fs.his.domain.vo.FsExternalOrderListVO;
+import com.fs.his.dto.ExpressInfoDTO;
 import com.fs.his.param.FsExternalOrderAddParam;
 import com.fs.his.vo.FsExternalOrderDetailVO;
 
@@ -58,4 +59,14 @@ public interface IFsExternalOrderService {
      * @return 结果
      */
     R cancelExternalOrder(Long orderId);
+
+    /**
+     * 查询外部订单快递物流信息
+     */
+    ExpressInfoDTO getExpress(Long orderId);
+
+    /**
+     * 同步外部订单物流状态
+     */
+    R syncExpress(Long orderId);
 }

+ 2 - 0
fs-service/src/main/java/com/fs/his/service/IFsStoreOrderService.java

@@ -162,6 +162,8 @@ public interface IFsStoreOrderService
 
     ExpressResultDTO updateDeliveryItem(ExpressNotifyDTO notifyDTO);
 
+    ExpressResultDTO updateDeliveryItemForStoreAndExternal(ExpressNotifyDTO notifyDTO);
+
     R syncExpress(Long id);
 
     R updateExpress(Long id);

+ 82 - 1
fs-service/src/main/java/com/fs/his/service/impl/FsExternalOrderServiceImpl.java

@@ -9,6 +9,7 @@ import javax.annotation.PostConstruct;
 
 import com.alibaba.fastjson.JSON;
 import com.fs.common.annotation.DataScope;
+import com.fs.common.utils.DateUtils;
 import com.fs.company.domain.Company;
 import com.fs.company.domain.CompanyDept;
 import com.fs.company.domain.CompanyUser;
@@ -40,7 +41,9 @@ import com.fs.his.domain.FsUser;
 import com.fs.his.domain.FsUserAddress;
 import com.fs.his.domain.vo.FsExternalOrderListVO;
 import com.fs.his.dto.ExternalOrderProductDTO;
+import com.fs.his.dto.ExpressInfoDTO;
 import com.fs.his.enums.ProductSourceTypeEnum;
+import com.fs.his.enums.ShipperCodeEnum;
 import com.fs.his.mapper.FsExternalOrderMapper;
 import com.fs.his.mapper.FsExternalOrderItemMapper;
 import com.fs.his.mapper.FsStoreMapper;
@@ -51,8 +54,10 @@ import com.fs.his.service.IFsExpressService;
 import com.fs.his.service.IFsUserAddressService;
 import com.fs.his.service.IFsUserService;
 import com.fs.his.utils.ConfigUtil;
+import com.fs.his.utils.PhoneUtil;
 import com.fs.his.vo.FsExternalOrderDetailVO;
 
+import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
 import lombok.extern.slf4j.Slf4j;
 
@@ -150,6 +155,82 @@ public class FsExternalOrderServiceImpl implements IFsExternalOrderService {
         return detailVO;
     }
 
+    @Override
+    public ExpressInfoDTO getExpress(Long orderId) {
+        FsExternalOrder order = fsExternalOrderMapper.selectFsExternalOrderByOrderId(orderId);
+        if (order == null) {
+            throw new RuntimeException("外部订单不存在");
+        }
+        if (StringUtils.isBlank(order.getDeliverySn())) {
+            return null;
+        }
+        String lastFourNumber = getExpressLastFourNumber(order);
+        ExpressInfoDTO expressInfoDTO = expressService.getExpressInfo(order.getOrderCode(), order.getDeliveryCode(), order.getDeliverySn(), lastFourNumber);
+        if (expressInfoDTO != null
+                && "0".equals(expressInfoDTO.getStateEx())
+                && "0".equals(expressInfoDTO.getState())) {
+            expressInfoDTO = expressService.getExpressInfo(order.getOrderCode(), order.getDeliveryCode(), order.getDeliverySn(), getDefaultExpressLastFourNumber(order));
+        }
+        return expressInfoDTO;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public R syncExpress(Long orderId) {
+        FsExternalOrder order = fsExternalOrderMapper.selectFsExternalOrderByOrderId(orderId);
+        if (order == null) {
+            return R.error("外部订单不存在");
+        }
+        if (StringUtils.isBlank(order.getDeliverySn())) {
+            return R.error("快递单号为空");
+        }
+        ExpressInfoDTO dto = getExpress(orderId);
+        log.info("外部订单快递鸟查询dto:{}", JSONUtil.toJsonStr(dto));
+        if (dto == null) {
+            return R.error("未查询到物流信息");
+        }
+        if (!dto.isSuccess()) {
+            return R.error(dto.getReason());
+        }
+        FsExternalOrder update = new FsExternalOrder();
+        update.setOrderId(order.getOrderId());
+        update.setDeliveryStatus(Integer.parseInt(dto.getState()));
+        update.setDeliveryType(dto.getStateEx());
+        update.setDeliveryUpdateTime(DateUtils.getNowDate());
+        fsExternalOrderMapper.updateFsExternalOrder(update);
+        return R.ok();
+    }
+
+    private String getExpressLastFourNumber(FsExternalOrder order) {
+        if (!ShipperCodeEnum.SF.getValue().equals(order.getDeliveryCode()) || StringUtils.isBlank(order.getUserPhone())) {
+            return "";
+        }
+        String phone = order.getUserPhone();
+        if (phone.length() > 11) {
+            phone = PhoneUtil.decryptPhone(phone);
+        }
+        if (phone.length() >= 4) {
+            return StrUtil.sub(phone, phone.length(), -4);
+        }
+        return "";
+    }
+
+    private String getDefaultExpressLastFourNumber(FsExternalOrder order) {
+        if (!ShipperCodeEnum.SF.getValue().equals(order.getDeliveryCode())) {
+            return "";
+        }
+        String phone = "19331276912";
+        return StrUtil.sub(phone, phone.length(), -4);
+    }
+
+    private boolean isNormalSigned(ExpressInfoDTO dto) {
+        return "3".equals(dto.getState())
+                && ("301".equals(dto.getStateEx())
+                || "302".equals(dto.getStateEx())
+                || "304".equals(dto.getStateEx())
+                || "311".equals(dto.getStateEx()));
+    }
+
     @Override
     public int insertFsExternalOrder(FsExternalOrder fsExternalOrder) {
         return fsExternalOrderMapper.insertFsExternalOrder(fsExternalOrder);
@@ -674,7 +755,7 @@ public class FsExternalOrderServiceImpl implements IFsExternalOrderService {
         updateOrder.setDeliveryTime(new Date());
         fsExternalOrderMapper.updateFsExternalOrder(updateOrder);
         //订阅快递鸟
-//        subscribeExternalOrderExpress(localOrder, deliveryCode, delivery.getMail_no());
+        subscribeExternalOrderExpress(localOrder, deliveryCode, delivery.getMail_no());
         log.info("外部订单已发货: {}, 快递: {}, 单号: {}", localOrder.getOrderCode(), deliveryCode, delivery.getMail_no());
     }
 

+ 117 - 0
fs-service/src/main/java/com/fs/his/service/impl/FsStoreOrderServiceImpl.java

@@ -154,6 +154,8 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
     private HuiFuService huiFuService;
     @Autowired
     private FsStoreOrderMapper fsStoreOrderMapper;
+    @Autowired
+    private FsExternalOrderMapper fsExternalOrderMapper;
 
     @Autowired
     private FsPatientMapper fsPatientMapper;
@@ -2465,6 +2467,121 @@ public class FsStoreOrderServiceImpl implements IFsStoreOrderService {
 
     }
 
+    @Override
+    public ExpressResultDTO updateDeliveryItemForStoreAndExternal(ExpressNotifyDTO notifyDTO) {
+        String data = URLDecoder.decode(notifyDTO.getRequestData(), Charset.forName("UTF-8"));
+        logger.info("快递鸟物流回调:{}", data);
+        FsSysConfig sysConfig = configUtil.getSysConfig();
+        ExpressDataDTO expressDataDTO = JSONUtil.toBean(data, ExpressDataDTO.class);
+        if (expressDataDTO == null || expressDataDTO.getData() == null) {
+            return ExpressResultDTO.error(sysConfig.getKdnId().trim(), "物流详情数据为null");
+        }
+        for (ExpressInfoDTO dto : expressDataDTO.getData()) {
+            if (dto == null || StringUtils.isEmpty(dto.getLogisticCode())) {
+                continue;
+            }
+            updateStoreOrderDelivery(dto);
+            updateExternalOrderDelivery(dto);
+            if (!dto.isSuccess()) {
+                logger.info("物流状态异常:{}", dto);
+            }
+        }
+        return ExpressResultDTO.success(sysConfig.getKdnId().trim());
+    }
+
+    private void updateStoreOrderDelivery(ExpressInfoDTO dto) {
+        List<FsStoreOrder> orders = this.selectFsStoreOrderListByDeliveryId(dto.getLogisticCode());
+        if (orders == null) {
+            return;
+        }
+        for (FsStoreOrder order : orders) {
+            logger.info("商城订单物流回调订单信息:{}", JSONUtil.toJsonStr(order));
+            if (order == null || (order.getDeliveryStatus() != null && order.getDeliveryStatus() == 3)) {
+                continue;
+            }
+            if (dto.getState() == null || dto.getStateEx() == null) {
+                continue;
+            }
+            FsStoreOrder update = new FsStoreOrder();
+            update.setOrderId(order.getOrderId());
+            update.setDeliveryStatus(Integer.parseInt(dto.getState()));
+            update.setDeliveryType(dto.getStateEx());
+            update.setDeliveryUpdateTime(DateUtils.getNowDate());
+            this.updateFsStoreOrder(update);
+            if (isNormalSigned(dto)) {
+                this.getGoods(order.getOrderId(), "物流签收");
+                /*
+                try {
+                    uniPush2Service.pushOne(
+                            order.getUserId(),
+                            order.getOrderId(),
+                            null,
+                            "订单已签收",
+                            "您的订单:" + order.getOrderCode() + "快递单号为:" + dto.getLogisticCode() + "已签收",
+                            PushLogTypeEnum.ORDER_STORE.getValue(),
+                            PushLogDesTypeEnum.ORDER_SIGN.getValue()
+                    );
+                } catch (Exception e) {
+                    log.error("app订单通知推送失败:{}", e.getMessage());
+                }
+                */
+            }
+            if ("2".equals(dto.getState()) && "211".equals(dto.getStateEx())) {
+                // requestExpressInfo(order.getOrderId());
+            }
+            if ("2".equals(dto.getState()) && "202".equals(dto.getStateEx())) {
+                /*
+                try {
+                    uniPush2Service.pushOne(
+                            order.getUserId(),
+                            order.getOrderId(),
+                            null,
+                            "订单正在派送",
+                            "您的订单:" + order.getOrderCode() + "快递单号为:" + dto.getLogisticCode() + "正在派送",
+                            PushLogTypeEnum.ORDER_STORE.getValue(),
+                            PushLogDesTypeEnum.ORDER_SIGN.getValue()
+                    );
+                } catch (Exception e) {
+                    log.error("app订单通知推送失败:{}", e.getMessage());
+                }
+                */
+            }
+        }
+    }
+
+    private void updateExternalOrderDelivery(ExpressInfoDTO dto) {
+        List<FsExternalOrder> orders = fsExternalOrderMapper.selectFsExternalOrderListByDeliverySn(dto.getLogisticCode());
+        if (orders == null) {
+            return;
+        }
+        for (FsExternalOrder order : orders) {
+            logger.info("外部订单物流回调订单信息:{}", JSONUtil.toJsonStr(order));
+            if (order == null || (order.getDeliveryStatus() != null && order.getDeliveryStatus() == 3)) {
+                continue;
+            }
+            if (dto.getState() == null || dto.getStateEx() == null) {
+                continue;
+            }
+            FsExternalOrder update = new FsExternalOrder();
+            update.setOrderId(order.getOrderId());
+            update.setDeliveryStatus(Integer.parseInt(dto.getState()));
+            update.setDeliveryType(dto.getStateEx());
+            update.setDeliveryUpdateTime(DateUtils.getNowDate());
+//            if (isNormalSigned(dto)) {
+//                update.setStatus(4);
+//            }
+            fsExternalOrderMapper.updateFsExternalOrder(update);
+        }
+    }
+
+    private boolean isNormalSigned(ExpressInfoDTO dto) {
+        return "3".equals(dto.getState())
+                && ("301".equals(dto.getStateEx())
+                || "302".equals(dto.getStateEx())
+                || "304".equals(dto.getStateEx())
+                || "311".equals(dto.getStateEx()));
+    }
+
     private List<FsStoreOrder> selectFsStoreOrderListByDeliveryId(String logisticCode) {
         return fsStoreOrderMapper.selectFsStoreOrderListByDeliverySn(logisticCode);
     }

+ 7 - 0
fs-service/src/main/java/com/fs/his/vo/FsExternalOrderDetailVO.java

@@ -52,6 +52,13 @@ public class FsExternalOrderDetailVO implements Serializable {
 
     private String deliverySn;
 
+    private Integer deliveryStatus;
+
+    private String deliveryType;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date deliveryUpdateTime;
+
     @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
     private Date deliveryTime;
 

+ 32 - 32
fs-service/src/main/java/com/fs/im/service/impl/OpenIMServiceImpl.java

@@ -1528,39 +1528,39 @@ public class OpenIMServiceImpl implements OpenIMService {
             result.smsType = sms.getType();
             String sendContent = buildSmsSendContent(content, sms);
             result.content = sendContent;
-//            if ("rf".equals(sms.getType())) {
-//                String urls;
-//                if (Integer.valueOf(1).equals(smsTemp.getTempType())) {
-//                    urls = sms.getRfUrl1() + "sms?action=send&account=" + sms.getRfAccount1()
-//                            + "&password=" + sms.getRfPassword1()
-//                            + "&mobile=" + phone
-//                            + "&content=" + URLEncoder.encode(sendContent, "UTF-8")
-//                            + "&extno=" + sms.getRfCode1()
-//                            + "&rt=json";
-//                } else {
-//                    urls = sms.getRfUrl2() + "sms?action=send&account=" + sms.getRfAccount2()
-//                            + "&password=" + sms.getRfPassword2()
-//                            + "&mobile=" + phone
-//                            + "&content=" + URLEncoder.encode(sendContent + "拒收请回复R", "UTF-8")
-//                            + "&extno=" + sms.getRfCode2()
-//                            + "&rt=json";
-//                }
-//                String post = HttpRequest.get(urls).execute().body();
-//                cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(post);
-//                result.success = Objects.equals(jsonObject.getInt("status"), 0);
-//                result.msgId = getRfMsgId(jsonObject);
-//                result.message = post;
-//                return result;
-//            }
+            if ("rf".equals(sms.getType())) {
+                String urls;
+                if (Integer.valueOf(1).equals(smsTemp.getTempType())) {
+                    urls = sms.getRfUrl1() + "sms?action=send&account=" + sms.getRfAccount1()
+                            + "&password=" + sms.getRfPassword1()
+                            + "&mobile=" + phone
+                            + "&content=" + URLEncoder.encode(sendContent, "UTF-8")
+                            + "&extno=" + sms.getRfCode1()
+                            + "&rt=json";
+                } else {
+                    urls = sms.getRfUrl2() + "sms?action=send&account=" + sms.getRfAccount2()
+                            + "&password=" + sms.getRfPassword2()
+                            + "&mobile=" + phone
+                            + "&content=" + URLEncoder.encode(sendContent + "拒收请回复R", "UTF-8")
+                            + "&extno=" + sms.getRfCode2()
+                            + "&rt=json";
+                }
+                String post = HttpRequest.get(urls).execute().body();
+                cn.hutool.json.JSONObject jsonObject = JSONUtil.parseObj(post);
+                result.success = Objects.equals(jsonObject.getInt("status"), 0);
+                result.msgId = getRfMsgId(jsonObject);
+                result.message = post;
+                return result;
+            }
             SendSmsReturn sendSmsReturn;
-//            if (Integer.valueOf(1).equals(smsTemp.getTempType())) {
-//                sendSmsReturn = smsTService.sendSms(sms.getDhAccount1(), sms.getDhPassword1(), sendContent, phone);
-//            } else {
-//                sendSmsReturn = smsTService.sendSms(sms.getDhAccount2(), sms.getDhPassword2(), sendContent + "拒收请回复R", phone);
-//            }
-//            result.success = sendSmsReturn != null && "0".equals(sendSmsReturn.getResult());
-//            result.msgId = sendSmsReturn == null ? null : sendSmsReturn.getMsgid();
-//            result.message = sendSmsReturn == null ? "短信发送无响应" : sendSmsReturn.getDesc();
+            if (Integer.valueOf(1).equals(smsTemp.getTempType())) {
+                sendSmsReturn = smsTService.sendSms(sms.getDhAccount1(), sms.getDhPassword1(), sendContent, phone);
+            } else {
+                sendSmsReturn = smsTService.sendSms(sms.getDhAccount2(), sms.getDhPassword2(), sendContent + "拒收请回复R", phone);
+            }
+            result.success = sendSmsReturn != null && "0".equals(sendSmsReturn.getResult());
+            result.msgId = sendSmsReturn == null ? null : sendSmsReturn.getMsgid();
+            result.message = sendSmsReturn == null ? "短信发送无响应" : sendSmsReturn.getDesc();
         } catch (Exception e) {
             result.success = false;
             result.message = e.getMessage();

+ 8 - 0
fs-service/src/main/resources/mapper/company/CompanyMapper.xml

@@ -24,6 +24,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="appKey"    column="app_kdy"    />
         <result property="remark"    column="remark"    />
         <result property="linkName"    column="link_name"    />
+        <result property="senderName"    column="sender_name"    />
+        <result property="senderPhone"    column="sender_phone"    />
         <result property="limitUserCount"    column="limit_user_count"    />
         <result property="isDel"    column="is_del"    />
         <result property="voiceCallerNumber"    column="voice_caller_number"    />
@@ -108,6 +110,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="appKey != null">app_key,</if>
             <if test="remark != null">remark,</if>
             <if test="linkName != null">link_name,</if>
+            <if test="senderName != null">sender_name,</if>
+            <if test="senderPhone != null">sender_phone,</if>
             <if test="limitUserCount != null">limit_user_count,</if>
             <if test="isDel != null">is_del,</if>
             <if test="voiceCallerNumber != null">voice_caller_number,</if>
@@ -146,6 +150,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="appKey != null">#{appKey},</if>
             <if test="remark != null">#{remark},</if>
             <if test="linkName != null">#{linkName},</if>
+            <if test="senderName != null">#{senderName},</if>
+            <if test="senderPhone != null">#{senderPhone},</if>
             <if test="limitUserCount != null">#{limitUserCount},</if>
             <if test="isDel != null">#{isDel},</if>
             <if test="voiceCallerNumber != null">#{voiceCallerNumber},</if>
@@ -188,6 +194,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="appKey != null">app_key = #{appKey},</if>
             <if test="remark != null">remark = #{remark},</if>
             <if test="linkName != null">link_name = #{linkName},</if>
+            <if test="senderName != null">sender_name = #{senderName},</if>
+            <if test="senderPhone != null">sender_phone = #{senderPhone},</if>
             <if test="limitUserCount != null">limit_user_count = #{limitUserCount},</if>
             <if test="isDel != null">is_del = #{isDel},</if>
             <if test="voiceCallerNumber != null">voice_caller_number = #{voiceCallerNumber},</if>

+ 25 - 1
fs-service/src/main/resources/mapper/his/FsExternalOrderMapper.xml

@@ -24,6 +24,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="deliveryName"    column="delivery_name"    />
         <result property="deliverySn"    column="delivery_sn"    />
         <result property="deliveryTime"    column="delivery_time"    />
+        <result property="deliveryStatus"    column="delivery_status"    />
+        <result property="deliveryType"    column="delivery_type"    />
+        <result property="deliveryUpdateTime"    column="delivery_update_time"    />
         <result property="shippingType"    column="shipping_type"    />
         <result property="companyId"    column="company_id"    />
         <result property="companyUserId"    column="company_user_id"    />
@@ -38,7 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </resultMap>
 
     <sql id="selectFsExternalOrderVo">
-        select order_id, order_code, source, user_id, user_name, user_phone, user_address, total_num, total_price, pay_price, freight_price, is_pay, pay_time, pay_type, status, delivery_code, delivery_name, delivery_sn, delivery_time, shipping_type, company_id, company_user_id, remark, external_create_time, is_sync, sync_msg, create_time, update_time, extend_order_id,store_id from fs_external_order
+        select order_id, order_code, source, user_id, user_name, user_phone, user_address, total_num, total_price, pay_price, freight_price, is_pay, pay_time, pay_type, status, delivery_code, delivery_name, delivery_sn, delivery_time, delivery_status, delivery_type, delivery_update_time, shipping_type, company_id, company_user_id, remark, external_create_time, is_sync, sync_msg, create_time, update_time, extend_order_id,store_id from fs_external_order
     </sql>
 
     <select id="selectFsExternalOrderList" parameterType="FsExternalOrder" resultMap="FsExternalOrderResult">
@@ -72,6 +75,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         where extend_order_id = #{extendOrderId}
     </select>
 
+    <select id="selectFsExternalOrderListByDeliverySn" parameterType="String" resultMap="FsExternalOrderResult">
+        <include refid="selectFsExternalOrderVo"/>
+        where delivery_sn = #{deliverySn}
+    </select>
+
     <insert id="insertFsExternalOrder" parameterType="FsExternalOrder" useGeneratedKeys="true" keyProperty="orderId">
         insert into fs_external_order
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -93,6 +101,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="deliveryName != null and deliveryName != ''">delivery_name,</if>
             <if test="deliverySn != null and deliverySn != ''">delivery_sn,</if>
             <if test="deliveryTime != null">delivery_time,</if>
+            <if test="deliveryStatus != null">delivery_status,</if>
+            <if test="deliveryType != null and deliveryType != ''">delivery_type,</if>
+            <if test="deliveryUpdateTime != null">delivery_update_time,</if>
             <if test="shippingType != null">shipping_type,</if>
             <if test="companyId != null">company_id,</if>
             <if test="companyUserId != null">company_user_id,</if>
@@ -123,6 +134,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="deliveryName != null and deliveryName != ''">#{deliveryName},</if>
             <if test="deliverySn != null and deliverySn != ''">#{deliverySn},</if>
             <if test="deliveryTime != null">#{deliveryTime},</if>
+            <if test="deliveryStatus != null">#{deliveryStatus},</if>
+            <if test="deliveryType != null and deliveryType != ''">#{deliveryType},</if>
+            <if test="deliveryUpdateTime != null">#{deliveryUpdateTime},</if>
             <if test="shippingType != null">#{shippingType},</if>
             <if test="companyId != null">#{companyId},</if>
             <if test="companyUserId != null">#{companyUserId},</if>
@@ -157,6 +171,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="deliveryName != null and deliveryName != ''">delivery_name = #{deliveryName},</if>
             <if test="deliverySn != null and deliverySn != ''">delivery_sn = #{deliverySn},</if>
             <if test="deliveryTime != null">delivery_time = #{deliveryTime},</if>
+            <if test="deliveryStatus != null">delivery_status = #{deliveryStatus},</if>
+            <if test="deliveryType != null and deliveryType != ''">delivery_type = #{deliveryType},</if>
+            <if test="deliveryUpdateTime != null">delivery_update_time = #{deliveryUpdateTime},</if>
             <if test="shippingType != null">shipping_type = #{shippingType},</if>
             <if test="companyId != null">company_id = #{companyId},</if>
             <if test="companyUserId != null">company_user_id = #{companyUserId},</if>
@@ -196,6 +213,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             o.pay_type AS payType,
             o.external_create_time AS externalCreateTime,
             o.status,
+            o.delivery_sn AS deliverySn,
+            o.delivery_status AS deliveryStatus,
+            o.delivery_type AS deliveryType,
+            o.delivery_update_time AS deliveryUpdateTime,
             CASE o.status
                 WHEN 1 THEN '待审核'
                 WHEN 2 THEN '待发货'
@@ -246,6 +267,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             o.delivery_code AS deliveryCode,
             o.delivery_name AS deliveryName,
             o.delivery_sn AS deliverySn,
+            o.delivery_status AS deliveryStatus,
+            o.delivery_type AS deliveryType,
+            o.delivery_update_time AS deliveryUpdateTime,
             o.delivery_time AS deliveryTime,
             o.shipping_type AS shippingType,
             o.remark,