From 356f3bd096e9a0bc37e4d8e37128cd01450798db Mon Sep 17 00:00:00 2001 From: gaowdong Date: Fri, 7 Mar 2025 13:47:07 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BA=BF=E4=B8=8A=E7=BA=BF=E4=B8=8B=E6=B6=88?= =?UTF-8?q?=E8=B4=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../canteen/core/allocation/api/FlowApi.java | 42 ++++---- .../impl/OrderRefundBusinessImpl.java | 20 ++-- .../order/common/dto/OrderPartRefundDTO.java | 97 +++++++++++++++++++ .../controller/OrderInfoMobileController.java | 28 +++--- .../business/impl/OrderWebBusinessImpl.java | 14 +-- 5 files changed, 150 insertions(+), 51 deletions(-) create mode 100644 bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/common/dto/OrderPartRefundDTO.java diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/allocation/api/FlowApi.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/allocation/api/FlowApi.java index f9ffe831..328d49f6 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/allocation/api/FlowApi.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/allocation/api/FlowApi.java @@ -50,28 +50,28 @@ public class FlowApi { // return this.flowInstanceService.getInstance(instanceId); // } - public Long getByMappingIdAndDefinitionType(Long mappingId, FlowDefinitionEum flowDefinitionEum) { - return this.getByMappingIdAndDefinitionType(mappingId, flowDefinitionEum, (Long)null); - } +// public Long getByMappingIdAndDefinitionType(Long mappingId, FlowDefinitionEum flowDefinitionEum) { +// return this.getByMappingIdAndDefinitionType(mappingId, flowDefinitionEum, (Long)null); +// } - public Long getByMappingIdAndDefinitionType(Long mappingId, FlowDefinitionEum flowDefinitionEum, Long areaId) { - Long definitionId = this.flowDefinitionMapingService.getByMappingIdAndDefinitionType(mappingId, flowDefinitionEum); - if (ObjectUtil.isEmpty(definitionId)) { - FlowDefinitionMaping defaultByType = this.flowDefinitionMapingService.getDefaultByType(flowDefinitionEum.getType()); - if (ObjectUtil.isNotEmpty(defaultByType)) { - definitionId = defaultByType.getDefinitionId(); - } - } - - if (ObjectUtil.isNotEmpty(definitionId) && ObjectUtil.isNotEmpty(areaId)) { - Map areaMap = this.flowDefinitionAreaService.queryDefinitionArea(Collections.singletonList(definitionId)); - if (!ObjectUtil.equals(areaMap.get(definitionId), areaId)) { - definitionId = null; - } - } - - return definitionId; - } +// public Long getByMappingIdAndDefinitionType(Long mappingId, FlowDefinitionEum flowDefinitionEum, Long areaId) { +// Long definitionId = this.flowDefinitionMapingService.getByMappingIdAndDefinitionType(mappingId, flowDefinitionEum); +// if (ObjectUtil.isEmpty(definitionId)) { +// FlowDefinitionMaping defaultByType = this.flowDefinitionMapingService.getDefaultByType(flowDefinitionEum.getType()); +// if (ObjectUtil.isNotEmpty(defaultByType)) { +// definitionId = defaultByType.getDefinitionId(); +// } +// } +// +// if (ObjectUtil.isNotEmpty(definitionId) && ObjectUtil.isNotEmpty(areaId)) { +// Map areaMap = this.flowDefinitionAreaService.queryDefinitionArea(Collections.singletonList(definitionId)); +// if (!ObjectUtil.equals(areaMap.get(definitionId), areaId)) { +// definitionId = null; +// } +// } +// +// return definitionId; +// } public Map getLimitMap(List instanceIds) { // return this.flowInstanceService.getLimitMap(instanceIds); diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/common/business/impl/OrderRefundBusinessImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/common/business/impl/OrderRefundBusinessImpl.java index 8873fdc7..8b19dab0 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/common/business/impl/OrderRefundBusinessImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/common/business/impl/OrderRefundBusinessImpl.java @@ -975,7 +975,7 @@ public class OrderRefundBusinessImpl implements OrderRefundBusiness { protected void createFlowIfNecessary(OrderInfo orderInfo, OrderRefund orderRefund, List refundDetailList, List detailList) { - Long definitionId = this.flowApi.getByMappingIdAndDefinitionType((Long)null, FlowDefinitionEum.ORDER_REFUND); +// Long definitionId = this.flowApi.getByMappingIdAndDefinitionType((Long)null, FlowDefinitionEum.ORDER_REFUND); return; // 2025-02-20 注释掉 暂不走工作流 // if (LeNumUtil.isValidId(definitionId)) { @@ -1027,17 +1027,17 @@ public class OrderRefundBusinessImpl implements OrderRefundBusiness { } protected boolean nextFlowIfNecessary(OrderRefund orderRefund, List refundDetailList, OrderCheckDTO orderCheckDTO) { - if (LeNumUtil.isValidId(orderRefund.getFlowInstanceId())) { - NextInstanceDto nextInstanceDto = new NextInstanceDto(); - nextInstanceDto.setInstanceIds(CollUtil.toList(new Long[]{orderRefund.getFlowInstanceId()})); - nextInstanceDto.setRemark(orderCheckDTO.getCheckResult()); - this.orderRefundService.updateOrderRefundById(orderRefund); - this.orderRefundDetailService.updateRefundDetailQuantity(refundDetailList); +// if (LeNumUtil.isValidId(orderRefund.getFlowInstanceId())) { +// NextInstanceDto nextInstanceDto = new NextInstanceDto(); +// nextInstanceDto.setInstanceIds(CollUtil.toList(new Long[]{orderRefund.getFlowInstanceId()})); +// nextInstanceDto.setRemark(orderCheckDTO.getCheckResult()); +// this.orderRefundService.updateOrderRefundById(orderRefund); +// this.orderRefundDetailService.updateRefundDetailQuantity(refundDetailList); // this.flowApi.next(nextInstanceDto); - return true; - } else { +// return true; 2025-03-03 注释 不走工作流 +// } else { return false; - } +// } } // // protected OrderRefund packageCorrect(OrderPartRefundDTO orderPartRefundDTO, Long orderId) { diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/common/dto/OrderPartRefundDTO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/common/dto/OrderPartRefundDTO.java new file mode 100644 index 00000000..cb428bf8 --- /dev/null +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/common/dto/OrderPartRefundDTO.java @@ -0,0 +1,97 @@ +package com.bonus.canteen.core.order.common.dto; + +import cn.hutool.core.bean.BeanUtil; +import com.bonus.canteen.core.common.utils.SysUtil; +import com.bonus.common.houqin.constant.LeConstants; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; + +import javax.validation.Valid; +import javax.validation.constraints.NotNull; +import javax.validation.constraints.Size; +import java.util.List; + +@ApiModel("订单部分退单DTO") +public class OrderPartRefundDTO { + @ApiModelProperty("是否为试算") + private Integer ifTrial; + @ApiModelProperty("订单id") + private Long orderId; + @ApiModelProperty("设备订单id") + private String macOrderId; + @ApiModelProperty("外部退单流水号(选填)") + private String macRefundId; + @ApiModelProperty("备注") + private String remark; + @ApiModelProperty("退款纠错图片 多个用逗号分割") + private String resressPicurl; + @ApiModelProperty("退单详情list") + private @NotNull @Size( + min = 1 +) List<@Valid OrderDetailRefundDTO> detailRefundList; + + public void setResressPicurl(String resressPicurl) { + this.resressPicurl = SysUtil.getCutPathMulti(resressPicurl); + } + + public OrderRefundParam convertToOrderRefundParam() { + OrderRefundParam orderRefundParam = (OrderRefundParam)BeanUtil.copyProperties(this, OrderRefundParam.class, new String[0]); + return orderRefundParam; + } + + public OrderPartRefundDTO() { + this.ifTrial = LeConstants.COMMON_NO; + } + + public Integer getIfTrial() { + return this.ifTrial; + } + + public Long getOrderId() { + return this.orderId; + } + + public String getMacOrderId() { + return this.macOrderId; + } + + public String getMacRefundId() { + return this.macRefundId; + } + + public String getRemark() { + return this.remark; + } + + public String getResressPicurl() { + return this.resressPicurl; + } + + public List<@Valid OrderDetailRefundDTO> getDetailRefundList() { + return this.detailRefundList; + } + + public void setIfTrial(final Integer ifTrial) { + this.ifTrial = ifTrial; + } + + public void setOrderId(final Long orderId) { + this.orderId = orderId; + } + + public void setMacOrderId(final String macOrderId) { + this.macOrderId = macOrderId; + } + + public void setMacRefundId(final String macRefundId) { + this.macRefundId = macRefundId; + } + + public void setRemark(final String remark) { + this.remark = remark; + } + + public void setDetailRefundList(final List<@Valid OrderDetailRefundDTO> detailRefundList) { + this.detailRefundList = detailRefundList; + } +} diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/mobile/controller/OrderInfoMobileController.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/mobile/controller/OrderInfoMobileController.java index 24fabe5e..b6ac78a7 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/mobile/controller/OrderInfoMobileController.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/mobile/controller/OrderInfoMobileController.java @@ -1,5 +1,6 @@ package com.bonus.canteen.core.order.mobile.controller; +import com.bonus.canteen.core.order.common.dto.OrderPartRefundDTO; import com.bonus.common.core.domain.R; import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.domain.AjaxResult; @@ -20,6 +21,7 @@ import com.bonus.canteen.core.order.mobile.vo.OrderListMobileVO; import com.bonus.canteen.core.order.mobile.vo.OrderShoppingCartAddResultVO; import com.bonus.canteen.core.order.mobile.vo.OrderShoppingCartListMobileVO; import com.bonus.canteen.core.pay.api.vo.UnifyPaySelectVO; +import com.bonus.common.houqin.utils.LeRequest; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; @@ -103,19 +105,19 @@ public class OrderInfoMobileController extends BaseController { // this.orderInfoMobileBusiness.orderPayCancel(((OrderIdMobileDTO)request.getContent()).getOrderId()); // return LeResponse.succ(); // } -// -// @PostMapping({"/part/refund"}) -// @ApiOperation( -// value = "部分退单", -// notes = "cmt-部分退单" -// ) -// public LeResponse orderPartRefundMobile(@RequestBody LeRequest request) { -// ((OrderPartRefundDTO)request.getContent()).getDetailRefundList().forEach((detailRefundDTO) -> { -// detailRefundDTO.setRestoreQuantity(0); -// }); -// OrderRefundResultVO resultVO = this.orderRefundBusiness.orderRefund(((OrderPartRefundDTO)request.getContent()).convertToOrderRefundParam(), OrderRefundBizEnum.MOBILE_PART); -// return resultVO.ifSuccess() ? LeResponse.succ(resultVO) : LeResponse.fail(resultVO.getResultCode(), resultVO.getResultMsg()); -// } + + @PostMapping({"/part/refund"}) + @ApiOperation( + value = "部分退单", + notes = "cmt-部分退单" + ) + public AjaxResult orderPartRefundMobile(@RequestBody OrderPartRefundDTO request) { + request.getDetailRefundList().forEach((detailRefundDTO) -> { + detailRefundDTO.setRestoreQuantity(0); + }); + OrderRefundResultVO resultVO = this.orderRefundBusiness.orderRefund(request.convertToOrderRefundParam(), OrderRefundBizEnum.MOBILE_PART); + return resultVO.ifSuccess() ? AjaxResult.success(resultVO) : AjaxResult.error(resultVO.getResultMsg(), resultVO.getResultCode()); + } @PostMapping({"/refund"}) @ApiOperation( diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/web/business/impl/OrderWebBusinessImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/web/business/impl/OrderWebBusinessImpl.java index f2860b0a..4c85f54f 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/web/business/impl/OrderWebBusinessImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/order/web/business/impl/OrderWebBusinessImpl.java @@ -183,11 +183,11 @@ public class OrderWebBusinessImpl implements OrderWebBusiness { } if (OrderStateEnum.isPlaceState(orderInfo.getOrderState())) { - this.orderInfoService.updateOrderFinishByOrderIds(CollUtil.toList(new Long[]{orderId}), CollUtil.toList(new LocalDate[]{orderInfo.getOrderDate()})); + this.orderInfoService.updateOrderFinishByOrderIds(CollUtil.toList(orderId), CollUtil.toList(orderInfo.getOrderDate())); this.orderDishesAndroidBusiness.didUpdateDishesState(orderInfo.getOrderId(), originalDishesState); this.orderCustomBusiness.web().didWriteOff(orderInfo, originalDishesState); } else { - throw new ServiceException(I18n.getMessage("order.web.not-allow-write-un-pay", new Object[0])); + throw new ServiceException(I18n.getMessage("order.web.not-allow-write-un-pay")); } } @@ -324,18 +324,18 @@ public class OrderWebBusinessImpl implements OrderWebBusiness { // } public OrderRefundWaitNumVO getRefundWaitNum() { - Long definitionId = this.flowApi.getByMappingIdAndDefinitionType((Long)null, FlowDefinitionEum.ORDER_REFUND); - if (LeNumUtil.isValidId(definitionId)) { +// Long definitionId = this.flowApi.getByMappingIdAndDefinitionType((Long)null, FlowDefinitionEum.ORDER_REFUND); +// if (LeNumUtil.isValidId(definitionId)) { // Map homePageFlowNotice = this.flowApi.getHomePageFlowNotice(); // Long num = (Long)homePageFlowNotice.getOrDefault(FlowDefinitionEum.ORDER_REFUND.getType(), 0L); // return OrderRefundWaitNumVO.of(num); - throw new ServiceException("不支持工作流!"); - } else { +// throw new ServiceException("不支持工作流!"); +// } else { OrderRefundWebDTO orderRefundWebDTO = new OrderRefundWebDTO(); orderRefundWebDTO.setCheckState(CheckStateEnum.WAIT.getKey()); PageVO orderRefundWebVOPageVO = this.pageOrderRefundList(PageDTO.of(1L, 1L), orderRefundWebDTO); return OrderRefundWaitNumVO.of(orderRefundWebVOPageVO.getTotal()); - } +// } } protected OrderInfo getAndCheckOrderInfo(Long orderId) {