|
@@ -27,9 +27,7 @@ import com.qs.mp.common.annotation.Log;
|
|
|
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.ErrorCodeEnum;
|
|
|
-import com.qs.mp.common.enums.TicketPkgStatusEnum;
|
|
|
+import com.qs.mp.common.enums.*;
|
|
|
import com.qs.mp.common.service.IDeliveryCompanyService;
|
|
|
import com.qs.mp.user.domain.UserDeliverOrder;
|
|
|
import com.qs.mp.user.domain.UserDeliverOrderItem;
|
|
@@ -44,6 +42,10 @@ import io.swagger.annotations.ApiOperation;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
+
|
|
|
+import io.swagger.annotations.ApiResponse;
|
|
|
+import io.swagger.annotations.ApiResponses;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import ma.glasnost.orika.MapperFacade;
|
|
|
|
|
@@ -161,6 +163,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())) {
|
|
@@ -172,15 +177,36 @@ public class ChannelOrderMgrController extends BaseApiController {
|
|
|
|| null == order.getChannelId()) {
|
|
|
return error(ErrorCodeEnum.ERROR_CODE_1001);
|
|
|
}
|
|
|
+ Integer deliveryType = shipParam.getDeliveryType();
|
|
|
+ if (DeliverTypeEnum.DELIVER.getValue().equals(deliveryType)) {
|
|
|
+ if (Objects.isNull(shipParam.getDeliveryId())) {
|
|
|
+ return AjaxResult.error("快递公司不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(shipParam.getDeliveryFlowId())) {
|
|
|
+ return AjaxResult.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("发货失败");
|
|
|
}
|
|
@@ -193,10 +219,12 @@ public class ChannelOrderMgrController extends BaseApiController {
|
|
|
@Log(title = "经销商订单发货单号修改", businessType = BusinessType.UPDATE)
|
|
|
@PostMapping("/ship/update")
|
|
|
@ApiOperation(value = "订单发货单号修改" , notes = "在订单发货页面提交")
|
|
|
+ @ApiResponses(
|
|
|
+ @ApiResponse(code = 200, message = "操作成功", response = AjaxResult.class)
|
|
|
+ )
|
|
|
@PreAuthorize("@ss.hasPermi('order:channel:ship')")
|
|
|
public AjaxResult updateShipInfo(@RequestBody ChannelOrderShipParam shipParam) {
|
|
|
- if(null == shipParam || StringUtils.isBlank(shipParam.getOrderId())
|
|
|
- || null == shipParam.getDeliveryId() || StringUtils.isBlank(shipParam.getDeliveryFlowId())) {
|
|
|
+ if(null == shipParam || StringUtils.isBlank(shipParam.getOrderId())) {
|
|
|
return error(ErrorCodeEnum.ERROR_CODE_1001);
|
|
|
}
|
|
|
|
|
@@ -206,10 +234,35 @@ public class ChannelOrderMgrController extends BaseApiController {
|
|
|
return error(ErrorCodeEnum.ERROR_CODE_1001);
|
|
|
}
|
|
|
|
|
|
- boolean rtn = channelOrderService.update(new LambdaUpdateWrapper<ChannelOrder>()
|
|
|
- .set(ChannelOrder::getDeliveryId, shipParam.getDeliveryId())
|
|
|
- .set(ChannelOrder::getDeliveryFlowId, shipParam.getDeliveryFlowId())
|
|
|
- .eq(ChannelOrder::getOrderId, shipParam.getOrderId()));
|
|
|
+ Integer deliveryType = shipParam.getDeliveryType();
|
|
|
+ if (DeliverTypeEnum.DELIVER.getValue().equals(deliveryType)) {
|
|
|
+ if (Objects.isNull(shipParam.getDeliveryId())) {
|
|
|
+ return AjaxResult.error("快递公司不能为空");
|
|
|
+ }
|
|
|
+ if (StringUtils.isBlank(shipParam.getDeliveryFlowId())) {
|
|
|
+ return AjaxResult.error("快递单号不能为空");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ boolean rtn = false;
|
|
|
+ if (DeliverTypeEnum.NO_DELIVER.getValue().equals(deliveryType)) {
|
|
|
+ // 无需物流,设置单号为空,物流公司为空
|
|
|
+ rtn = channelOrderService.update(new LambdaUpdateWrapper<ChannelOrder>()
|
|
|
+ .set(ChannelOrder::getDeliveryId, null)
|
|
|
+ .set(ChannelOrder::getDeliveryFlowId, null)
|
|
|
+ .set(ChannelOrder::getStatus, DeliverOrderStatusEnum.FINISHED)
|
|
|
+ .eq(ChannelOrder::getOrderId, shipParam.getOrderId()));
|
|
|
+
|
|
|
+ } else if (DeliverTypeEnum.DELIVER.getValue().equals(deliveryType)) {
|
|
|
+ // 快递发货,原逻辑
|
|
|
+ rtn = channelOrderService.update(new LambdaUpdateWrapper<ChannelOrder>()
|
|
|
+ .set(ChannelOrder::getDeliveryId, shipParam.getDeliveryId())
|
|
|
+ .set(ChannelOrder::getDeliveryFlowId, shipParam.getDeliveryFlowId())
|
|
|
+ .eq(ChannelOrder::getOrderId, shipParam.getOrderId()));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
return rtn ? AjaxResult.success() : AjaxResult.error("修改失败");
|
|
|
|
|
|
}
|
|
@@ -260,9 +313,9 @@ public class ChannelOrderMgrController extends BaseApiController {
|
|
|
}
|
|
|
return AjaxResult.success(list);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@Log(title = "提货订单导出", businessType = BusinessType.EXPORT)
|
|
|
@PostMapping("/export")
|
|
|
@PreAuthorize("@ss.hasPermi('order:channel:export')")
|
|
@@ -279,12 +332,12 @@ public class ChannelOrderMgrController extends BaseApiController {
|
|
|
queryWrapper.le(null != queryParam && null != queryParam.getEndTime(), "t1.created_time", queryParam.getEndTime());
|
|
|
queryWrapper.like(null != queryParam && StringUtils.isNotBlank(queryParam.getTitle()), "t1.title", queryParam.getTitle());
|
|
|
queryWrapper.orderByDesc("t1.order_id");
|
|
|
-
|
|
|
+
|
|
|
int totalSize = channelOrderService.selectChannelOrderCount(queryWrapper);
|
|
|
if (totalSize == 0) {
|
|
|
return AjaxResult.error("没有符合条件的经销商订单");
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
int pageSize = 2000;
|
|
|
if (totalSize > pageSize) {
|
|
|
int totalPage = totalSize % pageSize == 0 ? totalSize / pageSize : totalSize / pageSize + 1;
|
|
@@ -334,7 +387,7 @@ public class ChannelOrderMgrController extends BaseApiController {
|
|
|
channelOrderVO.setItems(itemVOList);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
if (null != listAll && listAll.size() > 0) {
|
|
|
// listAll.sort(Comparator.comparing(UserDeliverOrderVO::getOrderId));
|
|
|
for (ChannelOrderVO channelOrder : listAll) {
|