|
@@ -28,6 +28,7 @@ import com.qs.mp.common.core.domain.AjaxResult;
|
|
|
import com.qs.mp.common.core.page.TableDataInfo;
|
|
|
import com.qs.mp.common.domain.DeliveryCompany;
|
|
|
import com.qs.mp.common.enums.BusinessType;
|
|
|
+import com.qs.mp.common.enums.DeliverTypeEnum;
|
|
|
import com.qs.mp.common.enums.ErrorCodeEnum;
|
|
|
import com.qs.mp.common.enums.TicketPkgStatusEnum;
|
|
|
import com.qs.mp.common.service.IDeliveryCompanyService;
|
|
@@ -44,6 +45,9 @@ import io.swagger.annotations.ApiOperation;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+
|
|
|
+import io.swagger.annotations.ApiResponse;
|
|
|
+import io.swagger.annotations.ApiResponses;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import ma.glasnost.orika.MapperFacade;
|
|
|
|
|
@@ -161,6 +165,9 @@ public class ChannelOrderMgrController extends BaseApiController {
|
|
|
@Log(title = "经销商订单发货", businessType = BusinessType.UPDATE)
|
|
|
@PostMapping("/ship")
|
|
|
@ApiOperation(value = "订单发货" , notes = "在订单发货页面提交")
|
|
|
+ @ApiResponses(
|
|
|
+ @ApiResponse(code = 200, message = "操作成功", response = AjaxResult.class)
|
|
|
+ )
|
|
|
@PreAuthorize("@ss.hasPermi('order:channel:ship')")
|
|
|
public AjaxResult ship(@RequestBody ChannelOrderShipParam shipParam) {
|
|
|
if(null == shipParam || StringUtils.isBlank(shipParam.getOrderId())) {
|
|
@@ -173,14 +180,31 @@ public class ChannelOrderMgrController extends BaseApiController {
|
|
|
return error(ErrorCodeEnum.ERROR_CODE_1001);
|
|
|
}
|
|
|
|
|
|
+ Integer deliveryType = shipParam.getDeliveryType();
|
|
|
+ if (null == deliveryType) {
|
|
|
+ return error("物流类型参数为空");
|
|
|
+ }
|
|
|
+
|
|
|
if(null != shipParam && null != shipParam.getPkgIds()
|
|
|
&& shipParam.getPkgIds().size() > 0) {
|
|
|
ChannelOrder channelOrder = new ChannelOrder();
|
|
|
- channelOrder.setOrderId(shipParam.getOrderId());
|
|
|
- channelOrder.setChannelId(order.getChannelId());
|
|
|
- channelOrder.setDeliveryId(shipParam.getDeliveryId());
|
|
|
- channelOrder.setDeliveryFlowId(shipParam.getDeliveryFlowId());
|
|
|
- channelOrder.setDeliveryTime(new Date());
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if (DeliverTypeEnum.NO_DELIVER.getValue().equals(deliveryType)) {
|
|
|
+ // 无需物流,设置发货时间为当前时间
|
|
|
+ channelOrder.setOrderId(shipParam.getOrderId());
|
|
|
+ channelOrder.setChannelId(order.getChannelId());
|
|
|
+ channelOrder.setDeliveryTime(new Date());
|
|
|
+
|
|
|
+ } else if (DeliverTypeEnum.DELIVER.getValue().equals(deliveryType)) {
|
|
|
+ // 快递发货,设置物流信息
|
|
|
+ channelOrder.setOrderId(shipParam.getOrderId());
|
|
|
+ channelOrder.setChannelId(order.getChannelId());
|
|
|
+ channelOrder.setDeliveryId(shipParam.getDeliveryId());
|
|
|
+ channelOrder.setDeliveryFlowId(shipParam.getDeliveryFlowId());
|
|
|
+ channelOrder.setDeliveryTime(new Date());
|
|
|
+ }
|
|
|
boolean rtn = channelOrderService.channelOrderShip(channelOrder, shipParam.getPkgIds());
|
|
|
return rtn ? AjaxResult.success() : AjaxResult.error("发货失败");
|
|
|
}
|