diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/ExpressController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/ExpressController.java index 37d4cbc53..32f4b679c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/ExpressController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/ExpressController.java @@ -33,10 +33,32 @@ public class ExpressController extends XktBaseController { @Autowired private IExpressService expressService; - @ApiOperation("全部物流") + @ApiOperation("全部物流: systemDeliverAccess-系统发货是否可选则,storeDeliverAccess-档口发货是否可选择,userRefundAccess-用户退货是否可选择") @GetMapping("allExpress") - public R> allExpress() { - return success(BeanUtil.copyToList(expressService.allExpress(), ExpressVO.class)); + public R> allExpress(@RequestParam(value = "systemDeliverAccess", required = false) + Boolean systemDeliverAccess, + @RequestParam(value = "storeDeliverAccess", required = false) + Boolean storeDeliverAccess, + @RequestParam(value = "userRefundAccess", required = false) + Boolean userRefundAccess) { + List voList = expressService.allExpress() + .stream() + .filter(o -> { + boolean rtn = true; + if (systemDeliverAccess != null && !systemDeliverAccess.equals(o.getSystemDeliverAccess())) { + rtn = false; + } + if (storeDeliverAccess != null && !storeDeliverAccess.equals(o.getStoreDeliverAccess())) { + rtn = false; + } + if (userRefundAccess != null && !userRefundAccess.equals(o.getStoreDeliverAccess())) { + rtn = false; + } + return rtn; + }) + .map(o -> BeanUtil.toBean(o, ExpressVO.class)) + .collect(Collectors.toList()); + return success(voList); } @ApiOperation("下单时物流选择列表 - 含快递费") diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreOrderController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreOrderController.java index 3ee0690ba..1f25ef9d1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreOrderController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/StoreOrderController.java @@ -289,7 +289,7 @@ public class StoreOrderController extends XktBaseController { @PreAuthorize("@ss.hasAnyRoles('admin,general_admin,store')||@ss.hasSupplierSubRole()") @Log(title = "订单", businessType = BusinessType.OTHER) - @ApiOperation("发货-无单号(未在平台打印过快递单)") + @ApiOperation("发货-无单号(未在平台打印过快递单,档口自己联系物流发货)") @PostMapping("ship/store") public R> shipByStore(@Valid @RequestBody StoreOrderShipByStoreReqVO vo) { if (!SecurityUtils.isAdmin()) { @@ -316,8 +316,10 @@ public class StoreOrderController extends XktBaseController { //仅档口可操作 storeOrderService.checkOrderStore(vo.getStoreOrderDetailIds(), SecurityUtils.getStoreId()); } + ShipAddressDTO shipAddress = BeanUtil.toBean(vo, ShipAddressDTO.class); ExpressShippingLabelDTO dto = storeOrderService.printOrder(vo.getStoreOrderId(), - vo.getStoreOrderDetailIds(), vo.getExpressId(), vo.getNeedShip(), SecurityUtils.getUserId()); + vo.getStoreOrderDetailIds(), vo.getExpressId(), shipAddress, vo.getNeedShip(), + SecurityUtils.getUserId()); return success(DesensitizationUtil.desensitize(BeanUtil.toBean(dto, ExpressShippingLabelVO.class))); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/order/StoreOrderPrintReqVO.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/order/StoreOrderPrintReqVO.java index 2ad953c1b..80a2e7a2c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/order/StoreOrderPrintReqVO.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/xkt/vo/order/StoreOrderPrintReqVO.java @@ -30,4 +30,52 @@ public class StoreOrderPrintReqVO { @ApiModelProperty(value = "打印成功后立即发货", required = true) private Boolean needShip; + + @NotEmpty(message = "发货人名称不能为空") + @ApiModelProperty(value = "发货人-名称", required = true) + private String originContactName; + + @NotEmpty(message = "发货人电话不能为空") + @ApiModelProperty(value = "发货人-电话", required = true) + private String originContactPhoneNumber; + + @NotEmpty(message = "发货人省编码不能为空") + @ApiModelProperty(value = "发货人-省编码", required = true) + private String originProvinceCode; + + @NotEmpty(message = "发货人市编码不能为空") + @ApiModelProperty(value = "发货人-市编码", required = true) + private String originCityCode; + + @NotEmpty(message = "发货人区县编码不能为空") + @ApiModelProperty(value = "发货人-区县编码", required = true) + private String originCountyCode; + + @NotEmpty(message = "发货人详细地址不能为空") + @ApiModelProperty(value = "发货人-详细地址", required = true) + private String originDetailAddress; + + @NotEmpty(message = "收货人名称不能为空") + @ApiModelProperty(value = "收货人-名称", required = true) + private String destinationContactName; + + @NotEmpty(message = "收货人电话不能为空") + @ApiModelProperty(value = "收货人-电话", required = true) + private String destinationContactPhoneNumber; + + @NotEmpty(message = "收货人省编码不能为空") + @ApiModelProperty(value = "收货人-省编码", required = true) + private String destinationProvinceCode; + + @NotEmpty(message = "收货人市编码不能为空") + @ApiModelProperty(value = "收货人-市编码", required = true) + private String destinationCityCode; + + @NotEmpty(message = "收货人区县编码不能为空") + @ApiModelProperty(value = "收货人-区县编码", required = true) + private String destinationCountyCode; + + @NotEmpty(message = "收货人详细地址不能为空") + @ApiModelProperty(value = "收货人-详细地址", required = true) + private String destinationDetailAddress; } diff --git a/sql/ry_20240629.sql b/sql/ry_20240629.sql index 6aae2ed4c..28d7dbc99 100644 --- a/sql/ry_20240629.sql +++ b/sql/ry_20240629.sql @@ -2567,6 +2567,18 @@ CREATE TABLE `store_order_detail` `express_status` tinyint(4) NOT NULL COMMENT '物流状态[1:初始 2:下单中 3:已下单 4:取消中 5:已揽件 6:拦截中 99:已结束]', `express_req_no` varchar(32) DEFAULT NULL COMMENT '物流请求单号', `express_waybill_no` varchar(512) DEFAULT NULL COMMENT '物流运单号(快递单号),档口/用户自己填写时可能存在多个,使用“,”分割', + `origin_contact_name` varchar(32) DEFAULT NULL COMMENT '发货人-名称', + `origin_contact_phone_number` varchar(32) DEFAULT NULL COMMENT '发货人-电话', + `origin_province_code` varchar(16) DEFAULT NULL COMMENT '发货人-省编码', + `origin_city_code` varchar(16) DEFAULT NULL COMMENT '发货人-市编码', + `origin_county_code` varchar(16) DEFAULT NULL COMMENT '发货人-区县编码', + `origin_detail_address` varchar(255) DEFAULT NULL COMMENT '发货人-详细地址', + `destination_contact_name` varchar(32) DEFAULT NULL COMMENT '收货人-名称', + `destination_contact_phone_number` varchar(32) DEFAULT NULL COMMENT '收货人-电话', + `destination_province_code` varchar(16) DEFAULT NULL COMMENT '收货人-省编码', + `destination_city_code` varchar(16) DEFAULT NULL COMMENT '收货人-市编码', + `destination_county_code` varchar(16) DEFAULT NULL COMMENT '收货人-区县编码', + `destination_detail_address` varchar(255) DEFAULT NULL COMMENT '收货人-详细地址', `goods_price` decimal(18, 2) NOT NULL COMMENT '商品单价', `goods_quantity` int(11) NOT NULL COMMENT '商品数量', `goods_amount` decimal(18, 2) NOT NULL COMMENT '商品金额(商品单价*商品数量)', diff --git a/xkt/src/main/java/com/ruoyi/xkt/domain/StoreOrderDetail.java b/xkt/src/main/java/com/ruoyi/xkt/domain/StoreOrderDetail.java index 470911e89..5d2338c52 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/domain/StoreOrderDetail.java +++ b/xkt/src/main/java/com/ruoyi/xkt/domain/StoreOrderDetail.java @@ -79,6 +79,54 @@ public class StoreOrderDetail extends SimpleEntity { * 物流运单号(快递单号),档口/用户自己填写时可能存在多个,使用“,”分割 */ private String expressWaybillNo; + /** + * 发货人-名称 + */ + private String originContactName; + /** + * 发货人-电话 + */ + private String originContactPhoneNumber; + /** + * 发货人-省编码 + */ + private String originProvinceCode; + /** + * 发货人-市编码 + */ + private String originCityCode; + /** + * 发货人-区县编码 + */ + private String originCountyCode; + /** + * 发货人-详细地址 + */ + private String originDetailAddress; + /** + * 收货人-名称 + */ + private String destinationContactName; + /** + * 收货人-电话 + */ + private String destinationContactPhoneNumber; + /** + * 收货人-省编码 + */ + private String destinationProvinceCode; + /** + * 收货人-市编码 + */ + private String destinationCityCode; + /** + * 收货人-区县编码 + */ + private String destinationCountyCode; + /** + * 收货人-详细地址 + */ + private String destinationDetailAddress; /** * 商品单价 */ diff --git a/xkt/src/main/java/com/ruoyi/xkt/dto/order/ShipAddressDTO.java b/xkt/src/main/java/com/ruoyi/xkt/dto/order/ShipAddressDTO.java new file mode 100644 index 000000000..ba9329523 --- /dev/null +++ b/xkt/src/main/java/com/ruoyi/xkt/dto/order/ShipAddressDTO.java @@ -0,0 +1,59 @@ +package com.ruoyi.xkt.dto.order; + +import lombok.Data; + +/** + * @author liangyq + * @date 2025-11-30 + */ +@Data +public class ShipAddressDTO { + /** + * 发货人-名称 + */ + private String originContactName; + /** + * 发货人-电话 + */ + private String originContactPhoneNumber; + /** + * 发货人-省编码 + */ + private String originProvinceCode; + /** + * 发货人-市编码 + */ + private String originCityCode; + /** + * 发货人-区县编码 + */ + private String originCountyCode; + /** + * 发货人-详细地址 + */ + private String originDetailAddress; + /** + * 收货人-名称 + */ + private String destinationContactName; + /** + * 收货人-电话 + */ + private String destinationContactPhoneNumber; + /** + * 收货人-省编码 + */ + private String destinationProvinceCode; + /** + * 收货人-市编码 + */ + private String destinationCityCode; + /** + * 收货人-区县编码 + */ + private String destinationCountyCode; + /** + * 收货人-详细地址 + */ + private String destinationDetailAddress; +} diff --git a/xkt/src/main/java/com/ruoyi/xkt/dto/order/StoreOrderDetailDTO.java b/xkt/src/main/java/com/ruoyi/xkt/dto/order/StoreOrderDetailDTO.java index ca3978b7c..f4daec92d 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/dto/order/StoreOrderDetailDTO.java +++ b/xkt/src/main/java/com/ruoyi/xkt/dto/order/StoreOrderDetailDTO.java @@ -77,6 +77,54 @@ public class StoreOrderDetailDTO { * 物流运单号(快递单号),档口/用户自己填写时可能存在多个,使用“,”分割 */ private String expressWaybillNo; + /** + * 发货人-名称 + */ + private String originContactName; + /** + * 发货人-电话 + */ + private String originContactPhoneNumber; + /** + * 发货人-省编码 + */ + private String originProvinceCode; + /** + * 发货人-市编码 + */ + private String originCityCode; + /** + * 发货人-区县编码 + */ + private String originCountyCode; + /** + * 发货人-详细地址 + */ + private String originDetailAddress; + /** + * 收货人-名称 + */ + private String destinationContactName; + /** + * 收货人-电话 + */ + private String destinationContactPhoneNumber; + /** + * 收货人-省编码 + */ + private String destinationProvinceCode; + /** + * 收货人-市编码 + */ + private String destinationCityCode; + /** + * 收货人-区县编码 + */ + private String destinationCountyCode; + /** + * 收货人-详细地址 + */ + private String destinationDetailAddress; /** * 商品单价 */ diff --git a/xkt/src/main/java/com/ruoyi/xkt/manager/impl/ZtoExpressManagerImpl.java b/xkt/src/main/java/com/ruoyi/xkt/manager/impl/ZtoExpressManagerImpl.java index 52da731f0..b207540b7 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/manager/impl/ZtoExpressManagerImpl.java +++ b/xkt/src/main/java/com/ruoyi/xkt/manager/impl/ZtoExpressManagerImpl.java @@ -354,7 +354,7 @@ public class ZtoExpressManagerImpl implements ExpressManager, InitializingBean { //发件人信息 ZtoCreateOrderParam.SenderInfo senderInfo = new ZtoCreateOrderParam.SenderInfo(); reqDTO.setSenderInfo(senderInfo); - senderInfo.setSenderName(expressShipReqDTO.getOriginCountyName()); + senderInfo.setSenderName(expressShipReqDTO.getOriginContactName()); senderInfo.setSenderPhone(expressShipReqDTO.getOriginContactPhoneNumber()); senderInfo.setSenderProvince(expressShipReqDTO.getOriginProvinceName()); senderInfo.setSenderCity(expressShipReqDTO.getOriginCityName()); diff --git a/xkt/src/main/java/com/ruoyi/xkt/service/IStoreOrderService.java b/xkt/src/main/java/com/ruoyi/xkt/service/IStoreOrderService.java index 403619d09..ce7376aeb 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/IStoreOrderService.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/IStoreOrderService.java @@ -170,12 +170,13 @@ public interface IStoreOrderService { * @param storeOrderId * @param storeOrderDetailIds * @param expressId + * @param shipAddress * @param needShip * @param operatorId * @return */ ExpressShippingLabelDTO printOrder(Long storeOrderId, List storeOrderDetailIds, Long expressId, - Boolean needShip, Long operatorId); + ShipAddressDTO shipAddress, Boolean needShip, Long operatorId); /** * 确认收货 diff --git a/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreOrderServiceImpl.java b/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreOrderServiceImpl.java index ed3b62c8e..4bf8308e0 100644 --- a/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreOrderServiceImpl.java +++ b/xkt/src/main/java/com/ruoyi/xkt/service/impl/StoreOrderServiceImpl.java @@ -964,6 +964,19 @@ public class StoreOrderServiceImpl implements IStoreOrderService { orderDetail.setExpressType(EExpressType.STORE.getValue()); orderDetail.setExpressStatus(EExpressStatus.COMPLETED.getValue()); orderDetail.setExpressWaybillNo(expressWaybillNo); + //档口发货的物流信息从订单中取 + orderDetail.setOriginContactName(order.getOriginContactName()); + orderDetail.setOriginContactPhoneNumber(order.getOriginContactPhoneNumber()); + orderDetail.setOriginProvinceCode(order.getOriginProvinceCode()); + orderDetail.setOriginCityCode(order.getOriginCityCode()); + orderDetail.setOriginCountyCode(order.getOriginCountyCode()); + orderDetail.setOriginDetailAddress(order.getOriginDetailAddress()); + orderDetail.setDestinationContactName(order.getDestinationContactName()); + orderDetail.setDestinationContactPhoneNumber(order.getDestinationContactPhoneNumber()); + orderDetail.setDestinationProvinceCode(order.getDestinationProvinceCode()); + orderDetail.setDestinationCityCode(order.getDestinationCityCode()); + orderDetail.setDestinationCountyCode(order.getDestinationCountyCode()); + orderDetail.setDestinationDetailAddress(order.getDestinationDetailAddress()); int orderDetailSuccess = storeOrderDetailMapper.updateById(prepareUpdate(orderDetail)); if (orderDetailSuccess == 0) { throw new ServiceException(Constants.VERSION_LOCK_ERROR_COMMON_MSG); @@ -1000,7 +1013,7 @@ public class StoreOrderServiceImpl implements IStoreOrderService { @Transactional(rollbackFor = Exception.class) @Override public ExpressShippingLabelDTO printOrder(Long storeOrderId, List storeOrderDetailIds, Long expressId, - Boolean needShip, Long operatorId) { + ShipAddressDTO shipAddress, Boolean needShip, Long operatorId) { Assert.notEmpty(storeOrderDetailIds); checkNoCompleteRefundDetail(storeOrderDetailIds, "售后完成状态的商品无法打印快递单"); ExpressManager expressManager = expressService.getExpressManager(expressId); @@ -1050,7 +1063,7 @@ public class StoreOrderServiceImpl implements IStoreOrderService { } } //物流发货 - ExpressShipReqDTO shipReq = createShipReq(order, orderDetails); + ExpressShipReqDTO shipReq = createShipReq(order, orderDetails, shipAddress); ExpressShippingLabelDTO shippingLabelDTO = expressManager.shipStoreOrder(shipReq); //订阅轨迹 ExpressTrackSubReqDTO trackSubReq = new ExpressTrackSubReqDTO(shipReq.getExpressReqNo(), @@ -1067,6 +1080,19 @@ public class StoreOrderServiceImpl implements IStoreOrderService { orderDetail.setExpressStatus(EExpressStatus.PLACED.getValue()); orderDetail.setExpressReqNo(shipReq.getExpressReqNo()); orderDetail.setExpressWaybillNo(shippingLabelDTO.getExpressWaybillNo()); + //平台发货的物流信息 + orderDetail.setOriginContactName(shipReq.getOriginContactName()); + orderDetail.setOriginContactPhoneNumber(shipReq.getOriginContactPhoneNumber()); + orderDetail.setOriginProvinceCode(shipReq.getOriginProvinceCode()); + orderDetail.setOriginCityCode(shipReq.getOriginCityCode()); + orderDetail.setOriginCountyCode(shipReq.getOriginCountyCode()); + orderDetail.setOriginDetailAddress(shipReq.getOriginDetailAddress()); + orderDetail.setDestinationContactName(shipReq.getDestinationContactName()); + orderDetail.setDestinationContactPhoneNumber(shipReq.getDestinationContactPhoneNumber()); + orderDetail.setDestinationProvinceCode(shipReq.getDestinationProvinceCode()); + orderDetail.setDestinationCityCode(shipReq.getDestinationCityCode()); + orderDetail.setDestinationCountyCode(shipReq.getDestinationCountyCode()); + orderDetail.setDestinationDetailAddress(shipReq.getDestinationDetailAddress()); int orderDetailSuccess = storeOrderDetailMapper.updateById(prepareUpdate(orderDetail)); if (orderDetailSuccess == 0) { throw new ServiceException(Constants.VERSION_LOCK_ERROR_COMMON_MSG); @@ -2041,18 +2067,32 @@ public class StoreOrderServiceImpl implements IStoreOrderService { } - private ExpressShipReqDTO createShipReq(StoreOrder order, List orderDetails) { + private ExpressShipReqDTO createShipReq(StoreOrder order, List orderDetails, + ShipAddressDTO shipAddress) { ExpressShipReqDTO reqDTO = BeanUtil.toBean(order, ExpressShipReqDTO.class); + //收/发件人信息 + reqDTO.setOriginContactName(shipAddress.getOriginContactName()); + reqDTO.setOriginContactPhoneNumber(shipAddress.getOriginContactPhoneNumber()); + reqDTO.setOriginProvinceCode(shipAddress.getOriginProvinceCode()); + reqDTO.setOriginCityCode(shipAddress.getOriginCityCode()); + reqDTO.setOriginCountyCode(shipAddress.getOriginCountyCode()); + reqDTO.setOriginDetailAddress(shipAddress.getOriginDetailAddress()); + reqDTO.setDestinationContactName(shipAddress.getDestinationContactName()); + reqDTO.setDestinationContactPhoneNumber(shipAddress.getDestinationContactPhoneNumber()); + reqDTO.setDestinationProvinceCode(shipAddress.getDestinationProvinceCode()); + reqDTO.setDestinationCityCode(shipAddress.getDestinationCityCode()); + reqDTO.setDestinationCountyCode(shipAddress.getDestinationCountyCode()); + reqDTO.setDestinationDetailAddress(shipAddress.getDestinationDetailAddress()); //生成请求号 reqDTO.setExpressReqNo(IdUtil.simpleUUID()); //行政区划信息 Map regionMap = expressService.getRegionNameMapCache(); - reqDTO.setDestinationProvinceName(regionMap.get(order.getDestinationProvinceCode())); - reqDTO.setDestinationCityName(regionMap.get(order.getDestinationCityCode())); - reqDTO.setDestinationCountyName(regionMap.get(order.getDestinationCountyCode())); - reqDTO.setOriginProvinceName(regionMap.get(order.getOriginProvinceCode())); - reqDTO.setOriginCityName(regionMap.get(order.getOriginCityCode())); - reqDTO.setOriginCountyName(regionMap.get(order.getOriginCountyCode())); + reqDTO.setDestinationProvinceName(regionMap.get(shipAddress.getDestinationProvinceCode())); + reqDTO.setDestinationCityName(regionMap.get(shipAddress.getDestinationCityCode())); + reqDTO.setDestinationCountyName(regionMap.get(shipAddress.getDestinationCountyCode())); + reqDTO.setOriginProvinceName(regionMap.get(shipAddress.getOriginProvinceCode())); + reqDTO.setOriginCityName(regionMap.get(shipAddress.getOriginCityCode())); + reqDTO.setOriginCountyName(regionMap.get(shipAddress.getOriginCountyCode())); reqDTO.setRemark(order.getOrderRemark()); //货物信息 List orderItems = CollUtil.emptyIfNull(orderDetails).stream()