线上线下消费

This commit is contained in:
gaowdong 2025-03-07 13:47:07 +08:00
parent 2794953094
commit 356f3bd096
5 changed files with 150 additions and 51 deletions

View File

@ -50,28 +50,28 @@ public class FlowApi {
// return this.flowInstanceService.getInstance(instanceId); // return this.flowInstanceService.getInstance(instanceId);
// } // }
public Long getByMappingIdAndDefinitionType(Long mappingId, FlowDefinitionEum flowDefinitionEum) { // public Long getByMappingIdAndDefinitionType(Long mappingId, FlowDefinitionEum flowDefinitionEum) {
return this.getByMappingIdAndDefinitionType(mappingId, flowDefinitionEum, (Long)null); // return this.getByMappingIdAndDefinitionType(mappingId, flowDefinitionEum, (Long)null);
} // }
public Long getByMappingIdAndDefinitionType(Long mappingId, FlowDefinitionEum flowDefinitionEum, Long areaId) { // public Long getByMappingIdAndDefinitionType(Long mappingId, FlowDefinitionEum flowDefinitionEum, Long areaId) {
Long definitionId = this.flowDefinitionMapingService.getByMappingIdAndDefinitionType(mappingId, flowDefinitionEum); // Long definitionId = this.flowDefinitionMapingService.getByMappingIdAndDefinitionType(mappingId, flowDefinitionEum);
if (ObjectUtil.isEmpty(definitionId)) { // if (ObjectUtil.isEmpty(definitionId)) {
FlowDefinitionMaping defaultByType = this.flowDefinitionMapingService.getDefaultByType(flowDefinitionEum.getType()); // FlowDefinitionMaping defaultByType = this.flowDefinitionMapingService.getDefaultByType(flowDefinitionEum.getType());
if (ObjectUtil.isNotEmpty(defaultByType)) { // if (ObjectUtil.isNotEmpty(defaultByType)) {
definitionId = defaultByType.getDefinitionId(); // definitionId = defaultByType.getDefinitionId();
} // }
} // }
//
if (ObjectUtil.isNotEmpty(definitionId) && ObjectUtil.isNotEmpty(areaId)) { // if (ObjectUtil.isNotEmpty(definitionId) && ObjectUtil.isNotEmpty(areaId)) {
Map<Long, Long> areaMap = this.flowDefinitionAreaService.queryDefinitionArea(Collections.singletonList(definitionId)); // Map<Long, Long> areaMap = this.flowDefinitionAreaService.queryDefinitionArea(Collections.singletonList(definitionId));
if (!ObjectUtil.equals(areaMap.get(definitionId), areaId)) { // if (!ObjectUtil.equals(areaMap.get(definitionId), areaId)) {
definitionId = null; // definitionId = null;
} // }
} // }
//
return definitionId; // return definitionId;
} // }
public Map<Long, Boolean> getLimitMap(List<Long> instanceIds) { public Map<Long, Boolean> getLimitMap(List<Long> instanceIds) {
// return this.flowInstanceService.getLimitMap(instanceIds); // return this.flowInstanceService.getLimitMap(instanceIds);

View File

@ -975,7 +975,7 @@ public class OrderRefundBusinessImpl implements OrderRefundBusiness {
protected void createFlowIfNecessary(OrderInfo orderInfo, OrderRefund orderRefund, List<OrderRefundDetail> refundDetailList, protected void createFlowIfNecessary(OrderInfo orderInfo, OrderRefund orderRefund, List<OrderRefundDetail> refundDetailList,
List<OrderDetail> detailList) { List<OrderDetail> detailList) {
Long definitionId = this.flowApi.getByMappingIdAndDefinitionType((Long)null, FlowDefinitionEum.ORDER_REFUND); // Long definitionId = this.flowApi.getByMappingIdAndDefinitionType((Long)null, FlowDefinitionEum.ORDER_REFUND);
return; return;
// 2025-02-20 注释掉 暂不走工作流 // 2025-02-20 注释掉 暂不走工作流
// if (LeNumUtil.isValidId(definitionId)) { // if (LeNumUtil.isValidId(definitionId)) {
@ -1027,17 +1027,17 @@ public class OrderRefundBusinessImpl implements OrderRefundBusiness {
} }
protected boolean nextFlowIfNecessary(OrderRefund orderRefund, List<OrderRefundDetail> refundDetailList, OrderCheckDTO orderCheckDTO) { protected boolean nextFlowIfNecessary(OrderRefund orderRefund, List<OrderRefundDetail> refundDetailList, OrderCheckDTO orderCheckDTO) {
if (LeNumUtil.isValidId(orderRefund.getFlowInstanceId())) { // if (LeNumUtil.isValidId(orderRefund.getFlowInstanceId())) {
NextInstanceDto nextInstanceDto = new NextInstanceDto(); // NextInstanceDto nextInstanceDto = new NextInstanceDto();
nextInstanceDto.setInstanceIds(CollUtil.toList(new Long[]{orderRefund.getFlowInstanceId()})); // nextInstanceDto.setInstanceIds(CollUtil.toList(new Long[]{orderRefund.getFlowInstanceId()}));
nextInstanceDto.setRemark(orderCheckDTO.getCheckResult()); // nextInstanceDto.setRemark(orderCheckDTO.getCheckResult());
this.orderRefundService.updateOrderRefundById(orderRefund); // this.orderRefundService.updateOrderRefundById(orderRefund);
this.orderRefundDetailService.updateRefundDetailQuantity(refundDetailList); // this.orderRefundDetailService.updateRefundDetailQuantity(refundDetailList);
// this.flowApi.next(nextInstanceDto); // this.flowApi.next(nextInstanceDto);
return true; // return true; 2025-03-03 注释 不走工作流
} else { // } else {
return false; return false;
} // }
} }
// //
// protected OrderRefund packageCorrect(OrderPartRefundDTO orderPartRefundDTO, Long orderId) { // protected OrderRefund packageCorrect(OrderPartRefundDTO orderPartRefundDTO, Long orderId) {

View File

@ -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;
}
}

View File

@ -1,5 +1,6 @@
package com.bonus.canteen.core.order.mobile.controller; 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.domain.R;
import com.bonus.common.core.web.controller.BaseController; import com.bonus.common.core.web.controller.BaseController;
import com.bonus.common.core.web.domain.AjaxResult; 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.OrderShoppingCartAddResultVO;
import com.bonus.canteen.core.order.mobile.vo.OrderShoppingCartListMobileVO; import com.bonus.canteen.core.order.mobile.vo.OrderShoppingCartListMobileVO;
import com.bonus.canteen.core.pay.api.vo.UnifyPaySelectVO; 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.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -103,19 +105,19 @@ public class OrderInfoMobileController extends BaseController {
// this.orderInfoMobileBusiness.orderPayCancel(((OrderIdMobileDTO)request.getContent()).getOrderId()); // this.orderInfoMobileBusiness.orderPayCancel(((OrderIdMobileDTO)request.getContent()).getOrderId());
// return LeResponse.succ(); // return LeResponse.succ();
// } // }
//
// @PostMapping({"/part/refund"}) @PostMapping({"/part/refund"})
// @ApiOperation( @ApiOperation(
// value = "部分退单", value = "部分退单",
// notes = "cmt-部分退单" notes = "cmt-部分退单"
// ) )
// public LeResponse<OrderRefundResultVO> orderPartRefundMobile(@RequestBody LeRequest<OrderPartRefundDTO> request) { public AjaxResult orderPartRefundMobile(@RequestBody OrderPartRefundDTO request) {
// ((OrderPartRefundDTO)request.getContent()).getDetailRefundList().forEach((detailRefundDTO) -> { request.getDetailRefundList().forEach((detailRefundDTO) -> {
// detailRefundDTO.setRestoreQuantity(0); detailRefundDTO.setRestoreQuantity(0);
// }); });
// OrderRefundResultVO resultVO = this.orderRefundBusiness.orderRefund(((OrderPartRefundDTO)request.getContent()).convertToOrderRefundParam(), OrderRefundBizEnum.MOBILE_PART); OrderRefundResultVO resultVO = this.orderRefundBusiness.orderRefund(request.convertToOrderRefundParam(), OrderRefundBizEnum.MOBILE_PART);
// return resultVO.ifSuccess() ? LeResponse.succ(resultVO) : LeResponse.fail(resultVO.getResultCode(), resultVO.getResultMsg()); return resultVO.ifSuccess() ? AjaxResult.success(resultVO) : AjaxResult.error(resultVO.getResultMsg(), resultVO.getResultCode());
// } }
@PostMapping({"/refund"}) @PostMapping({"/refund"})
@ApiOperation( @ApiOperation(

View File

@ -183,11 +183,11 @@ public class OrderWebBusinessImpl implements OrderWebBusiness {
} }
if (OrderStateEnum.isPlaceState(orderInfo.getOrderState())) { 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.orderDishesAndroidBusiness.didUpdateDishesState(orderInfo.getOrderId(), originalDishesState);
this.orderCustomBusiness.web().didWriteOff(orderInfo, originalDishesState); this.orderCustomBusiness.web().didWriteOff(orderInfo, originalDishesState);
} else { } 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() { public OrderRefundWaitNumVO getRefundWaitNum() {
Long definitionId = this.flowApi.getByMappingIdAndDefinitionType((Long)null, FlowDefinitionEum.ORDER_REFUND); // Long definitionId = this.flowApi.getByMappingIdAndDefinitionType((Long)null, FlowDefinitionEum.ORDER_REFUND);
if (LeNumUtil.isValidId(definitionId)) { // if (LeNumUtil.isValidId(definitionId)) {
// Map<String, Long> homePageFlowNotice = this.flowApi.getHomePageFlowNotice(); // Map<String, Long> homePageFlowNotice = this.flowApi.getHomePageFlowNotice();
// Long num = (Long)homePageFlowNotice.getOrDefault(FlowDefinitionEum.ORDER_REFUND.getType(), 0L); // Long num = (Long)homePageFlowNotice.getOrDefault(FlowDefinitionEum.ORDER_REFUND.getType(), 0L);
// return OrderRefundWaitNumVO.of(num); // return OrderRefundWaitNumVO.of(num);
throw new ServiceException("不支持工作流!"); // throw new ServiceException("不支持工作流!");
} else { // } else {
OrderRefundWebDTO orderRefundWebDTO = new OrderRefundWebDTO(); OrderRefundWebDTO orderRefundWebDTO = new OrderRefundWebDTO();
orderRefundWebDTO.setCheckState(CheckStateEnum.WAIT.getKey()); orderRefundWebDTO.setCheckState(CheckStateEnum.WAIT.getKey());
PageVO<OrderRefundWebVO> orderRefundWebVOPageVO = this.pageOrderRefundList(PageDTO.of(1L, 1L), orderRefundWebDTO); PageVO<OrderRefundWebVO> orderRefundWebVOPageVO = this.pageOrderRefundList(PageDTO.of(1L, 1L), orderRefundWebDTO);
return OrderRefundWaitNumVO.of(orderRefundWebVOPageVO.getTotal()); return OrderRefundWaitNumVO.of(orderRefundWebVOPageVO.getTotal());
} // }
} }
protected OrderInfo getAndCheckOrderInfo(Long orderId) { protected OrderInfo getAndCheckOrderInfo(Long orderId) {