Commit 873ce676 by 吕明尚

增加支付回调的自动退款

parent be37419d
package share.web.controller.system;
import java.util.List;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
......@@ -11,11 +9,10 @@ import org.springframework.web.bind.annotation.*;
import share.common.core.controller.BaseController;
import share.common.core.domain.AjaxResult;
import share.common.core.domain.R;
import share.common.core.page.TableDataInfo;
import share.common.core.redis.RedisUtil;
import share.common.utils.JsonConvertUtil;
import share.system.domain.SConsumer;
import share.system.domain.SOrder;
import share.system.domain.vo.FrontTokenComponent;
import share.system.domain.vo.SOrderVo;
import share.system.request.CreateOrderRequest;
import share.system.request.OrderComputedPriceRequest;
......@@ -23,9 +20,9 @@ import share.system.request.OrderRefundRequest;
import share.system.response.ComputedOrderPriceResponse;
import share.system.response.OrderPayResultResponse;
import share.system.service.ISOrderService;
import share.common.core.page.TableDataInfo;
import javax.validation.constraints.NotBlank;
import java.util.List;
/**
* 订单Controller
......@@ -143,4 +140,9 @@ public class SOrderController extends BaseController
return R.ok(sOrderService.autoRefund(request));
}
@GetMapping("/statistics")
public R<Object> statistics() {
return R.ok(sOrderService.statistics());
}
}
......@@ -81,4 +81,12 @@ public class CreateOrderRequest {
@ApiModelProperty(value = "优惠比例")
private BigDecimal discountRatio;
//使用余额
@ApiModelProperty(value = "使用余额")
private BigDecimal balance;
//使用时长
@ApiModelProperty(value = "使用时长")
private BigDecimal duration;
}
......@@ -215,4 +215,6 @@ public interface ISOrderService extends IService<SOrder>
List<SOrder> selectSOrderByMaxTime(SOrder orderQuery);
List<SOrder> selectSOrderByStoreIdAndMaxTime(SOrder orderQuery);
Object statistics();
}
......@@ -153,6 +153,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Autowired
private ConsumerWalletService consumerWalletService;
@Autowired
private ISOrderService sOrderService;
private final static Long FIVE = 5L;
......@@ -978,9 +981,9 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
sConsumer.setStoreId(sStore.getId());
sConsumer.setPosition(3);
List<SConsumer> consumers = sConsumerService.selectAllocatedList(sConsumer);
if (consumers.size() > 0) {
//获取用户id
List<Long> sconsumerIds = consumers.stream().map(SConsumer::getId).collect(Collectors.toList());
if (consumers.size() > 0) {
Map<Long, SStoreConsumer> consumerMap = storeConsumerMapper.selectList(new LambdaQueryWrapper<SStoreConsumer>()
.in(SStoreConsumer::getConsumerId, sconsumerIds)
.eq(SStoreConsumer::getPosition, PositionEnum.CUSTOMER_SERVICE.getCode())
......@@ -1444,6 +1447,37 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
@Override
public void paymentSuccessful(SOrder sOrder) {
unLockOrder(sOrder.getRoomId());
// LambdaQueryWrapper<SOrder> queryWrapper = new LambdaQueryWrapper<>();
// queryWrapper.ne(SOrder::getOrderNo,sOrder.getOrderNo());
// queryWrapper.eq(SOrder::getOrderType,OrderTypeEnum.RESERVER.getCode());
// queryWrapper.notIn(SOrder::getRefundStatus, RefundStatusEnum.getRefundedStatus());
// queryWrapper.in(SOrder::getStatus, OrderStatusEnum.getUnfinishOrderStatus());
// queryWrapper.eq(SOrder::getIsDelete, YesNoEnum.no.getIndex());
// queryWrapper.eq(SOrder::getStoreId, sOrder.getStoreId());
// queryWrapper.eq(SOrder::getRoomId, sOrder.getRoomId());
// queryWrapper.apply("(IFNULL(start_date,pre_start_date) BETWEEN '"
// + DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, sOrder.getPreStartDate())
// + "' AND '" + DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.addMinutes(sOrder.getPreEndDate(), Constants.ROOM_LOCK_DELAY_MINUTE)) + "' " +
// "OR IFNULL(end_date,pre_end_date) BETWEEN '"
// + DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, DateUtils.addMinutes(sOrder.getPreStartDate(), -Constants.ROOM_LOCK_DELAY_MINUTE))
// + "' AND '" + DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, sOrder.getPreEndDate()) + "' )");
// SOrder order = getOne(queryWrapper);
// if(ObjectUtil.isNotEmpty(order)){
// //退款
// AdminRefundRequest refundRequest = new AdminRefundRequest();
// refundRequest.setOrderNo(sOrder.getOrderNo());
// refundRequest.setAmount(sOrder.getPayPrice());
// refundRequest.setIsClean(YesNoEnum.no.getIndex());
// refundRequest.setRefundCoupon(YesNoEnum.yes.getIndex());
// refundRequest.setRefundReason("当前订单:"+sOrder.getOrderNo()+"和订单:"+order.getOrderNo()+"预约时间有干涉");
// int i = sOrderService.refundOp(refundRequest);
// if(i==1){
// sOrderService.removeById(sOrder);
// }
// return;
// }
if (sOrder.getOrderType().equals(OrderTypeEnum.RENEW.getCode())) {
SRoom room = roomService.getById(sOrder.getRoomId());
if (room.getStatus().equals(RoomStatusEnum.FREE.getValue())) {
......@@ -1519,9 +1553,8 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
sConsumer.setStoreId(sStore.getId());
sConsumer.setPosition(3);
List<SConsumer> consumers = sConsumerService.selectAllocatedList(sConsumer);
List<Long> sconsumerIds = consumers.stream().map(SConsumer::getId).collect(Collectors.toList());
if (consumers.size() > 0) {
List<Long> sconsumerIds = consumers.stream().map(SConsumer::getId).collect(Collectors.toList());
Map<Long, SStoreConsumer> consumerMap = storeConsumerMapper.selectList(new LambdaQueryWrapper<SStoreConsumer>()
.in(SStoreConsumer::getConsumerId, sconsumerIds)
.eq(SStoreConsumer::getPosition, PositionEnum.CUSTOMER_SERVICE.getCode())
......@@ -2292,4 +2325,10 @@ public class SOrderServiceImpl extends ServiceImpl<SOrderMapper, SOrder> impleme
return sOrderVos;
}
@Override
public Object statistics() {
return null;
}
}
......@@ -615,7 +615,7 @@ public class WechatNewServiceImpl implements WechatNewService {
if (messageReminderEnum.equals(MessageReminderEnum.CLEANING)) {
officialAccountTemplate.setTemplate_id(MessageReminderEnum.CLEANING.getValue());
//预约店铺
data.put("thing2", new SendTemplateMessageItemVo("武汉" + sStore.getName()));
data.put("thing2", new SendTemplateMessageItemVo(sStore.getCityName() + sStore.getName()));
//预约包间
data.put("thing3", new SendTemplateMessageItemVo(sRoomVo.getName()));
//预约时间
......@@ -626,7 +626,7 @@ public class WechatNewServiceImpl implements WechatNewService {
miniprogram.setPagepath("/pages/orderResult/orderResult?orderNo=" + byOrderNo.getOrderNo() + "&share=share");
officialAccountTemplate.setTemplate_id(MessageReminderEnum.ORDER_RESERVE.getValue());
//门店名称
data.put("thing2", new SendTemplateMessageItemVo("武汉" + sStore.getName() + "(" + sRoomVo.getName() + ")"));
data.put("thing2", new SendTemplateMessageItemVo(sStore.getCityName() + sStore.getName() + "(" + sRoomVo.getName() + ")"));
//预订时间
data.put("time4", new SendTemplateMessageItemVo(date));
//联系电话
......@@ -725,7 +725,7 @@ public class WechatNewServiceImpl implements WechatNewService {
if (messageReminderEnum.equals(MessageReminderEnum.RESERVER)) {
templateMessageVo.setTemplate_id(MessageReminderEnum.RESERVER.getValue());
//订单门店
data.put("thing3", new SendTemplateMessageItemVo("武汉" + sStore.getName()));
data.put("thing3", new SendTemplateMessageItemVo(sStore.getCityName() + sStore.getName()));
//服务名称
data.put("thing1", new SendTemplateMessageItemVo(sRoomVo.getName()));
//订单时间
......@@ -735,7 +735,7 @@ public class WechatNewServiceImpl implements WechatNewService {
} else if (messageReminderEnum.equals(MessageReminderEnum.START)) {
templateMessageVo.setTemplate_id(MessageReminderEnum.START.getValue());
//预约门店
data.put("thing6", new SendTemplateMessageItemVo("武汉" + sStore.getName()));
data.put("thing6", new SendTemplateMessageItemVo(sStore.getCityName() + sStore.getName()));
//服务名称
data.put("thing7", new SendTemplateMessageItemVo(sRoomVo.getName()));
//预约时间
......@@ -745,7 +745,7 @@ public class WechatNewServiceImpl implements WechatNewService {
} else if (messageReminderEnum.equals(MessageReminderEnum.END)) {
templateMessageVo.setTemplate_id(MessageReminderEnum.END.getValue());
//订单门店
data.put("thing5", new SendTemplateMessageItemVo("武汉" + sStore.getName()));
data.put("thing5", new SendTemplateMessageItemVo(sStore.getCityName() + sStore.getName()));
//服务名称
data.put("thing6", new SendTemplateMessageItemVo(sRoomVo.getName()));
//订单时间
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment