mirror of
https://github.com/weizhiqiang1995/erp-pro.git
synced 2025-01-31 11:41:08 +08:00
Merge branch 'company_server' of https://gitee.com/doc_wei01/skyeye into company_server
This commit is contained in:
commit
890293b485
7 changed files with 75 additions and 0 deletions
|
@ -199,4 +199,19 @@ public class OrderController {
|
|||
public void updateOrderToPayState(InputObject inputObject, OutputObject outputObject) {
|
||||
orderService.updateOrderToPayState(inputObject, outputObject);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改订单签收状态
|
||||
*
|
||||
* @param inputObject 入参以及用户信息等获取对象
|
||||
* @param outputObject 出参以及提示信息的返回值对象
|
||||
*/
|
||||
@ApiOperation(id = "updateOrderItemState", value = "修改订单签收状态", method = "POST", allUse = "2")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(id = "id", name = "id", value = "主键id", required = "required"),
|
||||
@ApiImplicitParam(id = "orderItemId", name = "orderItemId", value = "子单Id", required = "required")})
|
||||
@RequestMapping("/post/OrderController/updateOrderItemState")
|
||||
public void updateOrderItemState(InputObject inputObject, OutputObject outputObject) {
|
||||
orderService.updateOrderItemState(inputObject, outputObject);
|
||||
}
|
||||
}
|
|
@ -219,4 +219,8 @@ public class Order extends AreaInfo {
|
|||
@TableField("extension_no")
|
||||
@Property(value = "支付成功的外部订单号")
|
||||
private String extensionNo;
|
||||
|
||||
@TableField("order_state")
|
||||
@ApiModelProperty(value = "订单状态")
|
||||
private Integer orderState;
|
||||
}
|
|
@ -124,4 +124,8 @@ public class OrderItem extends OperatorUserInfo {
|
|||
@TableField("vip_price")
|
||||
@ApiModelProperty(value = "VIP 减免金额,单位:分")
|
||||
private String vipPrice;
|
||||
|
||||
@TableField("order_item_state")
|
||||
@ApiModelProperty(value = "订单子单状态")
|
||||
private Integer orderItemState;
|
||||
}
|
|
@ -30,4 +30,8 @@ public interface OrderItemService extends SkyeyeBusinessService<OrderItem> {
|
|||
void setValueAndCreateEntity(Order order, String userId);
|
||||
|
||||
void updateCommentStateById(String id);
|
||||
|
||||
List<OrderItem> queryOrderItemByParentId(String orderId);
|
||||
|
||||
void UpdateOrderItemState(String orderItemId);
|
||||
}
|
||||
|
|
|
@ -37,4 +37,6 @@ public interface OrderService extends SkyeyeBusinessService<Order> {
|
|||
void updateOrderToPayState(InputObject inputObject, OutputObject outputObject);
|
||||
|
||||
void setOrderCancle(String orderId);
|
||||
|
||||
void updateOrderItemState(InputObject inputObject, OutputObject outputObject);
|
||||
}
|
||||
|
|
|
@ -11,10 +11,12 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|||
import com.skyeye.annotation.service.SkyeyeService;
|
||||
import com.skyeye.base.business.service.impl.SkyeyeBusinessServiceImpl;
|
||||
import com.skyeye.common.constans.CommonConstants;
|
||||
import com.skyeye.common.constans.CommonNumConstants;
|
||||
import com.skyeye.common.enumeration.WhetherEnum;
|
||||
import com.skyeye.common.util.mybatisplus.MybatisPlusUtil;
|
||||
import com.skyeye.erp.service.IMaterialNormsService;
|
||||
import com.skyeye.erp.service.IMaterialService;
|
||||
import com.skyeye.exception.CustomException;
|
||||
import com.skyeye.order.dao.OrderItemDao;
|
||||
import com.skyeye.order.entity.Order;
|
||||
import com.skyeye.order.entity.OrderItem;
|
||||
|
@ -122,4 +124,23 @@ public class OrderItemServiceImpl extends SkyeyeBusinessServiceImpl<OrderItemDao
|
|||
.set(MybatisPlusUtil.toColumns(OrderItem::getCommentState), WhetherEnum.ENABLE_USING.getKey());
|
||||
update(updateWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<OrderItem> queryOrderItemByParentId(String orderId) {
|
||||
QueryWrapper<OrderItem> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq(MybatisPlusUtil.toColumns(OrderItem::getParentId), orderId);
|
||||
return list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void UpdateOrderItemState(String orderItemId) {
|
||||
OrderItem orderItem = selectById(orderItemId);
|
||||
if (orderItem.getOrderItemState().equals(CommonNumConstants.NUM_TWO)){
|
||||
throw new CustomException("该订单已收货");
|
||||
}
|
||||
UpdateWrapper<OrderItem> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq(CommonConstants.ID, orderItemId);
|
||||
updateWrapper.set(MybatisPlusUtil.toColumns(OrderItem::getOrderItemState), CommonNumConstants.NUM_TWO);
|
||||
update(updateWrapper);
|
||||
}
|
||||
}
|
|
@ -590,4 +590,29 @@ public class OrderServiceImpl extends SkyeyeBusinessServiceImpl<OrderDao, Order>
|
|||
update(updateWrapper);
|
||||
refreshCache(orderId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateOrderItemState(InputObject inputObject, OutputObject outputObject) {
|
||||
Map<String, Object> map = inputObject.getParams();
|
||||
String orderId = map.get("id").toString();
|
||||
String orderItemId = map.get("orderItemId").toString();
|
||||
orderItemService.UpdateOrderItemState(orderItemId);
|
||||
List<OrderItem> orderItemList = orderItemService.queryOrderItemByParentId(orderId);
|
||||
boolean allTwo = orderItemList.stream().map(OrderItem::getOrderItemState)
|
||||
.allMatch(orderItemState -> orderItemState == CommonNumConstants.NUM_TWO);
|
||||
if (allTwo) {
|
||||
Integer numThree = CommonNumConstants.NUM_THREE;
|
||||
updateOrderState(orderId, numThree);
|
||||
} else {
|
||||
Integer numTwo = CommonNumConstants.NUM_TWO;
|
||||
updateOrderState(orderId, numTwo);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateOrderState(String orderId, Integer orderState) {
|
||||
UpdateWrapper<Order> updateWrapper = new UpdateWrapper<>();
|
||||
updateWrapper.eq(CommonConstants.ID, orderId);
|
||||
updateWrapper.set(MybatisPlusUtil.toColumns(Order::getOrderState), orderState);
|
||||
update(updateWrapper);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue