|
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
+import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
|
import com.gree.mall.manager.bean.ExcelData;
|
|
import com.gree.mall.manager.bean.ExcelData;
|
|
@@ -141,16 +142,21 @@ public class OrderLogic {
|
|
|
GoodsMaterialStorageService goodsMaterialStorageService;
|
|
GoodsMaterialStorageService goodsMaterialStorageService;
|
|
|
@Resource
|
|
@Resource
|
|
|
GoodsMaterialStockLogic goodsMaterialStockLogic;
|
|
GoodsMaterialStockLogic goodsMaterialStockLogic;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ UserCompanyAttrService userCompanyAttrService;
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 订单列表
|
|
* 订单列表
|
|
|
*
|
|
*
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
- public IPage<OrderDetailBean> list(HttpServletRequest request, String userId, String orderId, String productName, String userName, String phone,
|
|
|
|
|
- String exchangeCode, List<String> orderStatus, String startCreateTime, String endCreateTime, String startPayTime,
|
|
|
|
|
- String endPayTime, String websitId,
|
|
|
|
|
- Integer pageNum, Integer pageSize,
|
|
|
|
|
- String isNegative,String abnormalDispatch,String workerOrderNo,String goodsId
|
|
|
|
|
|
|
+ public IPage<OrderDetailBean> list(HttpServletRequest request, String userId, String orderId, String productName,
|
|
|
|
|
+ String userName, String phone, List<String> orderStatus, String startCreateTime,
|
|
|
|
|
+ String endCreateTime, String startPayTime, String endPayTime, Integer pageNum,
|
|
|
|
|
+ Integer pageSize,
|
|
|
|
|
+ String isNegative, String abnormalDispatch, String workerOrderNo, String goodsId
|
|
|
) {
|
|
) {
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser(request);
|
|
AdminUserCom adminUser = commonLogic.getAdminUser(request);
|
|
|
|
|
|
|
@@ -170,14 +176,13 @@ public class OrderLogic {
|
|
|
|
|
|
|
|
IPage page = orderInfoService.lambdaQuery()
|
|
IPage page = orderInfoService.lambdaQuery()
|
|
|
.in(CollectionUtils.isNotEmpty(adminUser.getCompanyWechatIds()),OrderInfo::getCompanyWechatId,adminUser.getCompanyWechatIds())
|
|
.in(CollectionUtils.isNotEmpty(adminUser.getCompanyWechatIds()),OrderInfo::getCompanyWechatId,adminUser.getCompanyWechatIds())
|
|
|
- ////.//in(CollectionUtils.isNotEmpty(adminUser.getAdminWebsitIds()),OrderInfo::getWebsitId,adminUser.getAdminWebsitIds())
|
|
|
|
|
|
|
+ .in(CollectionUtils.isNotEmpty(adminUser.getStorageIds()), OrderInfo::getPickStorageId, adminUser.getStorageIds())
|
|
|
.eq(StringUtils.isNotBlank(userId), OrderInfo::getUserId, userId)
|
|
.eq(StringUtils.isNotBlank(userId), OrderInfo::getUserId, userId)
|
|
|
.like(StringUtils.isNotBlank(orderId), OrderInfo::getOrderId, orderId)
|
|
.like(StringUtils.isNotBlank(orderId), OrderInfo::getOrderId, orderId)
|
|
|
.like(StringUtils.isNotBlank(productName), OrderInfo::getOrderTitle, productName)
|
|
.like(StringUtils.isNotBlank(productName), OrderInfo::getOrderTitle, productName)
|
|
|
- .in(CollectionUtils.isNotEmpty(orderIds),OrderInfo::getOrderId,orderIds)
|
|
|
|
|
|
|
+ .in(CollectionUtils.isNotEmpty(orderIds),OrderInfo::getOrderId, orderIds)
|
|
|
.and(StringUtils.isNotBlank(userName), v -> v.like(OrderInfo::getUserName,userName).or().like(OrderInfo::getReceUserName,userName))
|
|
.and(StringUtils.isNotBlank(userName), v -> v.like(OrderInfo::getUserName,userName).or().like(OrderInfo::getReceUserName,userName))
|
|
|
.and(StringUtils.isNotBlank(phone), v -> v.like(OrderInfo::getPhone, phone).or().like(OrderInfo::getRecePhone,phone))
|
|
.and(StringUtils.isNotBlank(phone), v -> v.like(OrderInfo::getPhone, phone).or().like(OrderInfo::getRecePhone,phone))
|
|
|
- // .in(!(adminWebsitBean.getType() && org.apache.commons.lang3.StringUtils.isBlank(websitId)), OrderInfo::getWebsitNumber, websitNoList)
|
|
|
|
|
.in(CollectionUtils.isNotEmpty(orderStatus), OrderInfo::getOrderStatus, orderStatus)
|
|
.in(CollectionUtils.isNotEmpty(orderStatus), OrderInfo::getOrderStatus, orderStatus)
|
|
|
.between(StringUtils.isNotBlank(startCreateTime) && StringUtils.isNotBlank(endCreateTime), OrderInfo::getCreateTime, startCreateTime, endCreateTime + " 23:59:59")
|
|
.between(StringUtils.isNotBlank(startCreateTime) && StringUtils.isNotBlank(endCreateTime), OrderInfo::getCreateTime, startCreateTime, endCreateTime + " 23:59:59")
|
|
|
.between(StringUtils.isNotBlank(startPayTime) && StringUtils.isNotBlank(endPayTime), OrderInfo::getPayTime, startPayTime, endPayTime + " 23:59:59")
|
|
.between(StringUtils.isNotBlank(startPayTime) && StringUtils.isNotBlank(endPayTime), OrderInfo::getPayTime, startPayTime, endPayTime + " 23:59:59")
|
|
@@ -306,7 +311,7 @@ public class OrderLogic {
|
|
|
//查询物流公司
|
|
//查询物流公司
|
|
|
String company = expressLogic.expressCompanyName(companyCode);
|
|
String company = expressLogic.expressCompanyName(companyCode);
|
|
|
OrderInfo orderInfo = orderInfoService.getById(orderId);
|
|
OrderInfo orderInfo = orderInfoService.getById(orderId);
|
|
|
- if(!orderInfo.getOrderStatus().equals(OrderStatusEnum.YFH.toString())){
|
|
|
|
|
|
|
+ if(!orderInfo.getOrderStatus().equals(OrderStatusEnum.OVER.toString())){
|
|
|
throw new RemoteServiceException("非已发货订单不可修改物流单号");
|
|
throw new RemoteServiceException("非已发货订单不可修改物流单号");
|
|
|
}
|
|
}
|
|
|
orderInfo.setCompanyCode(companyCode);
|
|
orderInfo.setCompanyCode(companyCode);
|
|
@@ -328,10 +333,10 @@ public class OrderLogic {
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 取消订单
|
|
* 取消订单
|
|
|
*/
|
|
*/
|
|
|
|
|
+ @Transactional
|
|
|
public void cancel(String orderId) throws Exception {
|
|
public void cancel(String orderId) throws Exception {
|
|
|
AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
OrderInfo orderInfo = orderInfoService.getById(orderId);
|
|
OrderInfo orderInfo = orderInfoService.getById(orderId);
|
|
@@ -340,27 +345,52 @@ public class OrderLogic {
|
|
|
throw new RemoteServiceException("订单当前状态不可取消");
|
|
throw new RemoteServiceException("订单当前状态不可取消");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- if(StringUtils.equals(orderInfo.getOrderStatus(),OrderStatusEnum.DFH.toString())) {
|
|
|
|
|
- log.info("【退款开始:】退款金额{}", orderInfo.getPayAmount().doubleValue());
|
|
|
|
|
- if(orderInfo.getPayTypeId().equals(PayTypeEnum.WECHAT.getKey())) {
|
|
|
|
|
- orderShareLogic.reloadAmount(orderId, null, 1);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ if ((orderInfo.getOrderStatus().equals(OrderStatusEnum.DJH.toString())
|
|
|
|
|
+ || orderInfo.getOrderStatus().equals(OrderStatusEnum.DFH.toString())
|
|
|
|
|
+ || orderInfo.getOrderStatus().equals(OrderStatusEnum.DPS.toString()))
|
|
|
|
|
+ && orderInfo.getExamineStatus().equals(ExamineStatusEnum.OK.getKey())) {
|
|
|
|
|
+ // 待拣货\待发货\待配送取消订单回退库存
|
|
|
|
|
+ final List<OrderDetail> orderDetailList = orderDetailService.lambdaQuery()
|
|
|
|
|
+ .eq(OrderDetail::getOrderId, orderId)
|
|
|
|
|
+ .list();
|
|
|
|
|
+ this.handleGoodsMaterialStock(orderInfo, orderDetailList, adminUser, DirectFlagEnum.ADD, "订单取消", "取消订单");
|
|
|
|
|
+
|
|
|
|
|
+ // TODO 授权支付退还额度逻辑
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// if (orderInfo.getSaleType().equals(SaleTypeEnum.OFFLINE.getValue())
|
|
|
|
|
-// && orderInfo.getOrderStatus().equals(OrderStatusEnum.DQR.toString())
|
|
|
|
|
-// && orderInfo.getExamineStatus().equals(ExamineStatusEnum.OK.getKey())) {
|
|
|
|
|
-// // 线下销售订单并且待确认并且审核通过的回退库存
|
|
|
|
|
-// final List<OrderDetail> orderDetailList = orderDetailService.lambdaQuery()
|
|
|
|
|
-// .eq(OrderDetail::getOrderId, orderId)
|
|
|
|
|
-// .list();
|
|
|
|
|
-// this.handleGoodsMaterialStock(orderInfo, orderDetailList, adminUser);
|
|
|
|
|
-// }
|
|
|
|
|
|
|
+ // 授权支付不需要确认退款
|
|
|
|
|
+ String changeOrderStatus = orderInfo.getPayType().equals(PayTypeEnum.CREDIT.getKey()) ? OrderStatusEnum.CLOSE.toString() : OrderStatusEnum.DTK.toString();
|
|
|
|
|
+ orderInfoService.lambdaUpdate()
|
|
|
|
|
+ .set(OrderInfo::getOrderStatus, changeOrderStatus)
|
|
|
|
|
+ .set(OrderInfo::getLastOrderStatus, orderInfo.getOrderStatus())
|
|
|
|
|
+ .set(OrderInfo::getCancelBy, adminUser.getNickName())
|
|
|
|
|
+ .set(OrderInfo::getCancelById, adminUser.getAdminUserId())
|
|
|
|
|
+ .set(OrderInfo::getCancelTime, DateUtil.date())
|
|
|
|
|
+ .eq(OrderInfo::getOrderId, orderId)
|
|
|
|
|
+ .update();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Transactional
|
|
|
|
|
+ public void confirmRefund(String orderId) {
|
|
|
|
|
+ AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
|
|
+ OrderInfo orderInfo = orderInfoService.getById(orderId);
|
|
|
|
|
+
|
|
|
|
|
+ if(!orderInfo.getOrderStatus().equals(OrderStatusEnum.DTK.toString())) {
|
|
|
|
|
+ throw new RemoteServiceException("订单当前状态非“待退款”");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- this.updateOrderStatus(orderId, OrderStatusEnum.CLOSE.toString());
|
|
|
|
|
|
|
+ orderInfoService.lambdaUpdate()
|
|
|
|
|
+ .set(OrderInfo::getOrderStatus, OrderStatusEnum.CLOSE.toString())
|
|
|
|
|
+ .set(OrderInfo::getLastOrderStatus, orderInfo.getOrderStatus())
|
|
|
|
|
+ .set(OrderInfo::getRefundBy, adminUser.getNickName())
|
|
|
|
|
+ .set(OrderInfo::getRefundById, adminUser.getAdminUserId())
|
|
|
|
|
+ .set(OrderInfo::getRefundTime, DateUtil.date())
|
|
|
|
|
+ .eq(OrderInfo::getOrderId, orderId)
|
|
|
|
|
+ .update();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private void handleGoodsMaterialStock(OrderInfo orderInfo, List<OrderDetail> orderDetailList, AdminUserCom adminUser, DirectFlagEnum flagEnum) throws Exception {
|
|
|
|
|
|
|
+ private void handleGoodsMaterialStock(OrderInfo orderInfo, List<OrderDetail> orderDetailList, AdminUserCom adminUser,
|
|
|
|
|
+ DirectFlagEnum flagEnum, String refBillType, String remark) throws Exception {
|
|
|
List<GoodsMaterialStockDTO> dtoList = new ArrayList<>();
|
|
List<GoodsMaterialStockDTO> dtoList = new ArrayList<>();
|
|
|
for (OrderDetail orderDetail : orderDetailList) {
|
|
for (OrderDetail orderDetail : orderDetailList) {
|
|
|
GoodsMaterialStockDTO dto = new GoodsMaterialStockDTO();
|
|
GoodsMaterialStockDTO dto = new GoodsMaterialStockDTO();
|
|
@@ -382,11 +412,11 @@ public class OrderLogic {
|
|
|
.setSdate(orderInfo.getExamineTime())
|
|
.setSdate(orderInfo.getExamineTime())
|
|
|
.setChangeQty(orderDetail.getNum())
|
|
.setChangeQty(orderDetail.getNum())
|
|
|
.setRefBillNo(orderInfo.getOrderId())
|
|
.setRefBillNo(orderInfo.getOrderId())
|
|
|
- .setRefBillType("线下销售单")
|
|
|
|
|
|
|
+ .setRefBillType(refBillType)
|
|
|
.setStorageId(orderInfo.getPickStorageId())
|
|
.setStorageId(orderInfo.getPickStorageId())
|
|
|
.setStorageName(orderInfo.getPickStorageName())
|
|
.setStorageName(orderInfo.getPickStorageName())
|
|
|
.setGoodsMaterialId(orderDetail.getGoodsMaterialId())
|
|
.setGoodsMaterialId(orderDetail.getGoodsMaterialId())
|
|
|
- .setRemark("取消订单")
|
|
|
|
|
|
|
+ .setRemark(remark)
|
|
|
.setOperateBy(adminUser.getAdminUserId());
|
|
.setOperateBy(adminUser.getAdminUserId());
|
|
|
dtoList.add(dto);
|
|
dtoList.add(dto);
|
|
|
}
|
|
}
|
|
@@ -651,7 +681,8 @@ public class OrderLogic {
|
|
|
* 发货
|
|
* 发货
|
|
|
*/
|
|
*/
|
|
|
@Transactional
|
|
@Transactional
|
|
|
- public void deliverGoods(String orderId, String logisticsNo, String companyCode, String storageId, Boolean workOrder, Boolean exchange,String pickName,String pickPhone ,String pickType) throws Exception {
|
|
|
|
|
|
|
+ public void deliverGoods(String orderId, String logisticsNo, String companyCode, String storageId, Boolean workOrder,
|
|
|
|
|
+ Boolean exchange,String pickName,String pickPhone ,String pickType) throws Exception {
|
|
|
//仓库
|
|
//仓库
|
|
|
Storage detail = storageLogic.detail(storageId);
|
|
Storage detail = storageLogic.detail(storageId);
|
|
|
//快递公司
|
|
//快递公司
|
|
@@ -746,7 +777,8 @@ public class OrderLogic {
|
|
|
}
|
|
}
|
|
|
orderInfo.setLogisticsNo(deliverGoodsBean.getLogisticsNo());
|
|
orderInfo.setLogisticsNo(deliverGoodsBean.getLogisticsNo());
|
|
|
|
|
|
|
|
- orderInfo.setOrderStatus(OrderStatusEnum.YFH.toString());
|
|
|
|
|
|
|
+ orderInfo.setOrderStatus(OrderStatusEnum.OVER.toString());
|
|
|
|
|
+ orderInfo.setOverTime(DateUtil.date());
|
|
|
if(detail != null) {
|
|
if(detail != null) {
|
|
|
orderInfo.setStorageName(detail.getStorageName());
|
|
orderInfo.setStorageName(detail.getStorageName());
|
|
|
orderInfo.setStorageAddress(detail.getStorageAddress());
|
|
orderInfo.setStorageAddress(detail.getStorageAddress());
|
|
@@ -756,8 +788,6 @@ public class OrderLogic {
|
|
|
orderInfo.setWorkOrder(deliverGoodsBean.getSend());
|
|
orderInfo.setWorkOrder(deliverGoodsBean.getSend());
|
|
|
orderInfo.updateById();
|
|
orderInfo.updateById();
|
|
|
|
|
|
|
|
- orderShareLogic.updateOrderStatus(orderId, OrderStatusEnum.YFH.toString());
|
|
|
|
|
-
|
|
|
|
|
//对接工单
|
|
//对接工单
|
|
|
this.orderToWorkorder(orderInfo);
|
|
this.orderToWorkorder(orderInfo);
|
|
|
|
|
|
|
@@ -881,39 +911,16 @@ public class OrderLogic {
|
|
|
orderInfo.setExamineTime(DateUtil.date());
|
|
orderInfo.setExamineTime(DateUtil.date());
|
|
|
orderInfo.setExamineStatus(ExamineStatusEnum.OK.getKey());
|
|
orderInfo.setExamineStatus(ExamineStatusEnum.OK.getKey());
|
|
|
orderInfo.setExamineBy(adminUser.getNickName());
|
|
orderInfo.setExamineBy(adminUser.getNickName());
|
|
|
- orderInfo.setOrderStatus(OrderStatusEnum.DFH.toString());
|
|
|
|
|
|
|
+ orderInfo.setOrderStatus(OrderStatusEnum.DJH.toString());
|
|
|
orderInfo.updateById();
|
|
orderInfo.updateById();
|
|
|
|
|
|
|
|
// 确认订单减少物料库存
|
|
// 确认订单减少物料库存
|
|
|
final List<OrderDetail> orderDetailList = orderDetailService.lambdaQuery()
|
|
final List<OrderDetail> orderDetailList = orderDetailService.lambdaQuery()
|
|
|
.eq(OrderDetail::getOrderId, orderInfo.getOrderId())
|
|
.eq(OrderDetail::getOrderId, orderInfo.getOrderId())
|
|
|
.list();
|
|
.list();
|
|
|
- this.handleGoodsMaterialStock(orderInfo, orderDetailList, adminUser, DirectFlagEnum.SUB);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 修改订单状态,修改结算的订单状态
|
|
|
|
|
- */
|
|
|
|
|
- public void updateOrderStatus(String orderId, String orderStatus) {
|
|
|
|
|
- orderInfoService.lambdaUpdate()
|
|
|
|
|
- .set(OrderInfo::getOrderStatus, orderStatus)
|
|
|
|
|
- .eq(OrderInfo::getOrderId, orderId)
|
|
|
|
|
- .update();
|
|
|
|
|
-
|
|
|
|
|
-// orderShareLogic.updateOrderStatus(orderId, orderStatus);
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /**
|
|
|
|
|
- * 查询订单详情
|
|
|
|
|
- */
|
|
|
|
|
- public List<OrderDetail> queryOrderDetails(String orderId){
|
|
|
|
|
- List<OrderDetail> list = orderDetailService.lambdaQuery().in(OrderDetail::getOrderId, orderId).list();
|
|
|
|
|
- return list;
|
|
|
|
|
|
|
+ this.handleGoodsMaterialStock(orderInfo, orderDetailList, adminUser, DirectFlagEnum.SUB, "确认订单", "确认订单");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* 导出excel
|
|
* 导出excel
|
|
|
*
|
|
*
|
|
@@ -956,7 +963,7 @@ public class OrderLogic {
|
|
|
String orderStatusName = Enum.valueOf(OrderStatusEnum.class, orderDetailBean.getOrderStatus().trim().toUpperCase()).getName();
|
|
String orderStatusName = Enum.valueOf(OrderStatusEnum.class, orderDetailBean.getOrderStatus().trim().toUpperCase()).getName();
|
|
|
if (orderDetailBean.getOrderStatus().equals(OrderStatusEnum.REFUND.toString())) {
|
|
if (orderDetailBean.getOrderStatus().equals(OrderStatusEnum.REFUND.toString())) {
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(orderDetailBean.getLogisticsNo())) {
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(orderDetailBean.getLogisticsNo())) {
|
|
|
- orderStatusName = OrderStatusEnum.YFH.getName();
|
|
|
|
|
|
|
+ orderStatusName = OrderStatusEnum.OVER.getName();
|
|
|
} else {
|
|
} else {
|
|
|
orderStatusName = OrderStatusEnum.DFH.getName();
|
|
orderStatusName = OrderStatusEnum.DFH.getName();
|
|
|
}
|
|
}
|
|
@@ -1396,4 +1403,63 @@ public class OrderLogic {
|
|
|
}
|
|
}
|
|
|
apply.updateById();
|
|
apply.updateById();
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 完成拣货
|
|
|
|
|
+ * @param orderId
|
|
|
|
|
+ */
|
|
|
|
|
+ @Transactional
|
|
|
|
|
+ public void completesPick(String orderId) {
|
|
|
|
|
+ final OrderInfo orderInfo = orderInfoService.getById(orderId);
|
|
|
|
|
+
|
|
|
|
|
+ orderInfoService.lambdaUpdate()
|
|
|
|
|
+ .set(OrderInfo::getOrderStatus, orderInfo.getTakeGoodsType().equals(TakeGoodsTypeEnum.Z.getKey()) ? OrderStatusEnum.DFH.toString() : OrderStatusEnum.DPS.toString())
|
|
|
|
|
+ .set(OrderInfo::getLastOrderStatus, orderInfo.getOrderStatus())
|
|
|
|
|
+ .eq(OrderInfo::getOrderId, orderId)
|
|
|
|
|
+ .update();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 开始配送
|
|
|
|
|
+ * @param orderId
|
|
|
|
|
+ */
|
|
|
|
|
+ @Transactional
|
|
|
|
|
+ public void startDelivery(String orderId) {
|
|
|
|
|
+ final OrderInfo orderInfo = orderInfoService.getById(orderId);
|
|
|
|
|
+
|
|
|
|
|
+ if (StringUtils.isBlank(orderInfo.getDeliveryUserId())) {
|
|
|
|
|
+ throw new RemoteServiceException("请先选择配送员");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ orderInfoService.lambdaUpdate()
|
|
|
|
|
+ .set(OrderInfo::getOrderStatus, OrderStatusEnum.PSZ.toString())
|
|
|
|
|
+ .set(OrderInfo::getLastOrderStatus, orderInfo.getOrderStatus())
|
|
|
|
|
+ .set(OrderInfo::getDeliverTime, DateUtil.date())
|
|
|
|
|
+ .eq(OrderInfo::getOrderId, orderId)
|
|
|
|
|
+ .update();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ public void addDelivery(String orderId, String userId) {
|
|
|
|
|
+ final OrderInfo orderInfo = orderInfoService.getById(orderId);
|
|
|
|
|
+
|
|
|
|
|
+ if (StringUtils.isBlank(orderInfo.getDeliveryUserId())) {
|
|
|
|
|
+ throw new RemoteServiceException("请先选择配送员");
|
|
|
|
|
+ }
|
|
|
|
|
+ AdminUserCom adminUser = commonLogic.getAdminUser();
|
|
|
|
|
+ final User user = userService.getById(userId);
|
|
|
|
|
+ final UserCompanyAttr userCompanyAttr = userCompanyAttrService.lambdaQuery()
|
|
|
|
|
+ .eq(UserCompanyAttr::getCompanyWechatId, adminUser.getAdminCompanyWechat().getCompanyWechatId())
|
|
|
|
|
+ .eq(UserCompanyAttr::getUserId, user.getUserId())
|
|
|
|
|
+ .one();
|
|
|
|
|
+
|
|
|
|
|
+ if (!userCompanyAttr.getIsDelivery()) {
|
|
|
|
|
+ throw new RemoteServiceException("非“配送员”,请检查");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ orderInfoService.lambdaUpdate()
|
|
|
|
|
+ .set(OrderInfo::getDeliveryUserId, user.getUserId())
|
|
|
|
|
+ .set(OrderInfo::getDeliveryUserName, user.getNickName())
|
|
|
|
|
+ .eq(OrderInfo::getOrderId, orderId)
|
|
|
|
|
+ .update();
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|