This commit is contained in:
parent
ce3abafec4
commit
ba898c005b
|
@ -7,7 +7,8 @@ import com.github.binarywang.wxpay.bean.notify.WxPayRefundNotifyResult;
|
||||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||||
import com.github.binarywang.wxpay.service.WxPayService;
|
import com.github.binarywang.wxpay.service.WxPayService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import org.dromara.common.log.annotation.Log;
|
||||||
|
import org.dromara.common.log.enums.BusinessType;
|
||||||
import org.dromara.system.service.IReservationOrderService;
|
import org.dromara.system.service.IReservationOrderService;
|
||||||
import org.dromara.system.service.IReservationRefundService;
|
import org.dromara.system.service.IReservationRefundService;
|
||||||
import org.dromara.system.service.ISysScaleOrderService;
|
import org.dromara.system.service.ISysScaleOrderService;
|
||||||
|
@ -25,7 +26,6 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
* @date 2024/7/29 14:08
|
* @date 2024/7/29 14:08
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Slf4j
|
|
||||||
@SaIgnore
|
@SaIgnore
|
||||||
@Validated
|
@Validated
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
@ -34,21 +34,19 @@ import org.springframework.web.bind.annotation.RestController;
|
||||||
public class WxPayController {
|
public class WxPayController {
|
||||||
|
|
||||||
private final WxPayService payService;
|
private final WxPayService payService;
|
||||||
|
|
||||||
private final ISysScaleOrderService scaleOrderService;
|
private final ISysScaleOrderService scaleOrderService;
|
||||||
|
|
||||||
private final IReservationOrderService reservationOrderService;
|
private final IReservationOrderService reservationOrderService;
|
||||||
|
|
||||||
private final IReservationRefundService reservationRefundService;
|
private final IReservationRefundService reservationRefundService;
|
||||||
|
|
||||||
|
@Log(title = "量表订单回调", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/notify/order/scale")
|
@PostMapping("/notify/order/scale")
|
||||||
public String parseScaleNotifyResult(@RequestBody String xmlData) throws WxPayException {
|
public String parseScaleNotifyResult(@RequestBody String xmlData) throws WxPayException {
|
||||||
log.info("---------量表支付回调-----------------");
|
|
||||||
final WxPayOrderNotifyResult notifyResult = this.payService.parseOrderNotifyResult(xmlData);
|
final WxPayOrderNotifyResult notifyResult = this.payService.parseOrderNotifyResult(xmlData);
|
||||||
scaleOrderService.processOrder(notifyResult);
|
scaleOrderService.processOrder(notifyResult);
|
||||||
return WxPayNotifyResponse.success("成功");
|
return WxPayNotifyResponse.success("成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Log(title = "咨询订单回调", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/notify/order/reservation")
|
@PostMapping("/notify/order/reservation")
|
||||||
public String parseReservationNotifyResult(@RequestBody String xmlData) throws WxPayException {
|
public String parseReservationNotifyResult(@RequestBody String xmlData) throws WxPayException {
|
||||||
final WxPayOrderNotifyResult notifyResult = this.payService.parseOrderNotifyResult(xmlData);
|
final WxPayOrderNotifyResult notifyResult = this.payService.parseOrderNotifyResult(xmlData);
|
||||||
|
@ -56,6 +54,7 @@ public class WxPayController {
|
||||||
return WxPayNotifyResponse.success("成功");
|
return WxPayNotifyResponse.success("成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Log(title = "退款订单回调", businessType = BusinessType.UPDATE)
|
||||||
@PostMapping("/notify/refund/reservation")
|
@PostMapping("/notify/refund/reservation")
|
||||||
public String refundReservationNotifyResult(@RequestBody String xmlData) throws WxPayException {
|
public String refundReservationNotifyResult(@RequestBody String xmlData) throws WxPayException {
|
||||||
final WxPayRefundNotifyResult result = this.payService.parseRefundNotifyResult(xmlData);
|
final WxPayRefundNotifyResult result = this.payService.parseRefundNotifyResult(xmlData);
|
||||||
|
|
|
@ -50,5 +50,7 @@ public class ScoreRecordBo extends BaseEntity {
|
||||||
@NotNull(message = "评分不能为空", groups = {AddGroup.class, EditGroup.class})
|
@NotNull(message = "评分不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||||
private BigDecimal threeScore;
|
private BigDecimal threeScore;
|
||||||
|
|
||||||
|
@NotNull(message = "对应订单号不能为空", groups = {AddGroup.class, EditGroup.class})
|
||||||
|
private Long orderId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -177,6 +177,7 @@ public class CounselorServiceImpl implements ICounselorService {
|
||||||
String url = ossService.selectUrlByIds(String.valueOf(user.getAvatar()));
|
String url = ossService.selectUrlByIds(String.valueOf(user.getAvatar()));
|
||||||
one.setAvatarUrl(url);
|
one.setAvatarUrl(url);
|
||||||
}
|
}
|
||||||
|
one.setName(user.getNickName());
|
||||||
one.setReservationNum(100);
|
one.setReservationNum(100);
|
||||||
Date practiceTime = one.getPracticeTime();
|
Date practiceTime = one.getPracticeTime();
|
||||||
String betweenYear = DateUtils.getBetweenYear(practiceTime, new Date());
|
String betweenYear = DateUtils.getBetweenYear(practiceTime, new Date());
|
||||||
|
|
|
@ -15,10 +15,7 @@ import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
import org.dromara.common.satoken.utils.LoginHelper;
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
import org.dromara.system.constant.StatusEnum;
|
import org.dromara.system.constant.StatusEnum;
|
||||||
import org.dromara.system.domain.Counselor;
|
import org.dromara.system.domain.*;
|
||||||
import org.dromara.system.domain.ReservationOrder;
|
|
||||||
import org.dromara.system.domain.ReservationTime;
|
|
||||||
import org.dromara.system.domain.SysUser;
|
|
||||||
import org.dromara.system.domain.bo.ReservationOrderBo;
|
import org.dromara.system.domain.bo.ReservationOrderBo;
|
||||||
import org.dromara.system.domain.vo.ReservationOrderVo;
|
import org.dromara.system.domain.vo.ReservationOrderVo;
|
||||||
import org.dromara.system.mapper.CounselorMapper;
|
import org.dromara.system.mapper.CounselorMapper;
|
||||||
|
@ -117,22 +114,28 @@ public class ReservationOrderServiceImpl implements IReservationOrderService {
|
||||||
@Override
|
@Override
|
||||||
public WxPayMpOrderResult insertByBo(ReservationOrderBo bo) throws Exception {
|
public WxPayMpOrderResult insertByBo(ReservationOrderBo bo) throws Exception {
|
||||||
String openId = LoginHelper.getOpenId();
|
String openId = LoginHelper.getOpenId();
|
||||||
|
BigDecimal price;
|
||||||
|
Long id = bo.getId();
|
||||||
|
if (id == null) {
|
||||||
ReservationOrder add = MapstructUtils.convert(bo, ReservationOrder.class);
|
ReservationOrder add = MapstructUtils.convert(bo, ReservationOrder.class);
|
||||||
ReservationTime reservationTime = timeMapper.selectById(add.getTimeId());
|
ReservationTime reservationTime = timeMapper.selectById(add.getTimeId());
|
||||||
Counselor counselor = counselorMapper.selectById(reservationTime.getCounselorId());
|
Counselor counselor = counselorMapper.selectById(reservationTime.getCounselorId());
|
||||||
BigDecimal price = counselor.getPrice();
|
price = counselor.getPrice();
|
||||||
add.setCounselorId(counselor.getId());
|
add.setCounselorId(counselor.getId());
|
||||||
add.setActualPrice(price);
|
add.setActualPrice(price);
|
||||||
add.setOrderPrice(price);
|
add.setOrderPrice(price);
|
||||||
add.setOrderStatus(StatusEnum.DISABLED.getValue());
|
add.setOrderStatus(StatusEnum.DISABLED.getValue());
|
||||||
validEntityBeforeSave(add);
|
validEntityBeforeSave(add);
|
||||||
boolean flag = baseMapper.insert(add) > 0;
|
baseMapper.insert(add);
|
||||||
if (flag) {
|
id = add.getId();
|
||||||
bo.setId(add.getId());
|
}else{
|
||||||
|
ReservationOrder reservationOrder = baseMapper.selectById(id);
|
||||||
|
Counselor counselor = counselorMapper.selectById(reservationOrder.getCounselorId());
|
||||||
|
price = counselor.getPrice();
|
||||||
}
|
}
|
||||||
WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest();
|
WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest();
|
||||||
orderRequest.setBody("墨者科技-预约支付");
|
orderRequest.setBody("墨者科技-预约支付");
|
||||||
orderRequest.setOutTradeNo(add.getId().toString());
|
orderRequest.setOutTradeNo(id.toString());
|
||||||
int totalFee = price.multiply(new BigDecimal(100)).intValue();
|
int totalFee = price.multiply(new BigDecimal(100)).intValue();
|
||||||
orderRequest.setTotalFee(totalFee);
|
orderRequest.setTotalFee(totalFee);
|
||||||
orderRequest.setNotifyUrl("https://api.ysmental.com/tenant/wx/pay/notify/order/reservation");
|
orderRequest.setNotifyUrl("https://api.ysmental.com/tenant/wx/pay/notify/order/reservation");
|
||||||
|
|
|
@ -1,17 +1,23 @@
|
||||||
package org.dromara.system.service.impl;
|
package org.dromara.system.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.dromara.common.core.constant.TenantConstants;
|
import org.dromara.common.core.constant.TenantConstants;
|
||||||
|
import org.dromara.common.core.exception.ServiceException;
|
||||||
import org.dromara.common.core.utils.MapstructUtils;
|
import org.dromara.common.core.utils.MapstructUtils;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.system.domain.ReservationOrder;
|
||||||
import org.dromara.system.domain.ScoreRecord;
|
import org.dromara.system.domain.ScoreRecord;
|
||||||
|
import org.dromara.system.domain.SysScaleOrder;
|
||||||
import org.dromara.system.domain.bo.ScoreRecordBo;
|
import org.dromara.system.domain.bo.ScoreRecordBo;
|
||||||
import org.dromara.system.domain.vo.ScoreRecordVo;
|
import org.dromara.system.domain.vo.ScoreRecordVo;
|
||||||
|
import org.dromara.system.mapper.ReservationOrderMapper;
|
||||||
import org.dromara.system.mapper.ScoreRecordMapper;
|
import org.dromara.system.mapper.ScoreRecordMapper;
|
||||||
|
import org.dromara.system.mapper.SysScaleOrderMapper;
|
||||||
import org.dromara.system.service.IScoreRecordService;
|
import org.dromara.system.service.IScoreRecordService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
@ -29,6 +35,8 @@ import java.util.Map;
|
||||||
public class ScoreRecordServiceImpl implements IScoreRecordService {
|
public class ScoreRecordServiceImpl implements IScoreRecordService {
|
||||||
|
|
||||||
private final ScoreRecordMapper baseMapper;
|
private final ScoreRecordMapper baseMapper;
|
||||||
|
private final ReservationOrderMapper reservationOrderMapper;
|
||||||
|
private final SysScaleOrderMapper scaleOrderMapper;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询评分
|
* 查询评分
|
||||||
|
@ -83,6 +91,29 @@ public class ScoreRecordServiceImpl implements IScoreRecordService {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Boolean insertByBo(ScoreRecordBo bo) {
|
public Boolean insertByBo(ScoreRecordBo bo) {
|
||||||
|
//scale
|
||||||
|
Long orderId = bo.getOrderId();
|
||||||
|
if (bo.getRecordStatus() == 0) {
|
||||||
|
boolean exists = scaleOrderMapper.exists(new LambdaQueryWrapper<SysScaleOrder>()
|
||||||
|
.eq(SysScaleOrder::getOrderStatus, 2)
|
||||||
|
.eq(SysScaleOrder::getId, orderId));
|
||||||
|
if(!exists){
|
||||||
|
throw new ServiceException("订单状态异常,请确认后再提交");
|
||||||
|
}
|
||||||
|
scaleOrderMapper.update(new LambdaUpdateWrapper<SysScaleOrder>()
|
||||||
|
.set(SysScaleOrder::getOrderStatus, 3)
|
||||||
|
.eq(SysScaleOrder::getId,orderId));
|
||||||
|
}else{
|
||||||
|
boolean exists = reservationOrderMapper.exists(new LambdaQueryWrapper<ReservationOrder>()
|
||||||
|
.eq(ReservationOrder::getOrderStatus, 2)
|
||||||
|
.eq(ReservationOrder::getId, orderId));
|
||||||
|
if(!exists){
|
||||||
|
throw new ServiceException("订单状态异常,请确认后再提交");
|
||||||
|
}
|
||||||
|
reservationOrderMapper.update(new LambdaUpdateWrapper<ReservationOrder>()
|
||||||
|
.set(ReservationOrder::getOrderStatus, 3)
|
||||||
|
.eq(ReservationOrder::getId,orderId));
|
||||||
|
}
|
||||||
ScoreRecord add = MapstructUtils.convert(bo, ScoreRecord.class);
|
ScoreRecord add = MapstructUtils.convert(bo, ScoreRecord.class);
|
||||||
add.setTenantId(TenantConstants.DEFAULT_TENANT_ID);
|
add.setTenantId(TenantConstants.DEFAULT_TENANT_ID);
|
||||||
boolean flag = baseMapper.insert(add) > 0;
|
boolean flag = baseMapper.insert(add) > 0;
|
||||||
|
|
|
@ -139,7 +139,7 @@ public class SysScaleOrderServiceImpl implements ISysScaleOrderService {
|
||||||
id = add.getId();
|
id = add.getId();
|
||||||
} else {
|
} else {
|
||||||
SysScaleOrder sysScaleOrder = baseMapper.selectById(id);
|
SysScaleOrder sysScaleOrder = baseMapper.selectById(id);
|
||||||
SysScale sysScale = sysScaleMapper.selectById(sysScaleOrder.getId());
|
SysScale sysScale = sysScaleMapper.selectById(sysScaleOrder.getScaleId());
|
||||||
price = sysScale.getPrice();
|
price = sysScale.getPrice();
|
||||||
}
|
}
|
||||||
WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest();
|
WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest();
|
||||||
|
|
|
@ -37,11 +37,9 @@
|
||||||
rt.status
|
rt.status
|
||||||
from m_reservation_time rt
|
from m_reservation_time rt
|
||||||
left join m_reservation_day rd on rd.id = rt.day_id
|
left join m_reservation_day rd on rd.id = rt.day_id
|
||||||
left join m_reservation_order ro on ro.time_id = rt.id
|
left join m_reservation_order ro on ro.time_id = rt.id and ro.order_status>0
|
||||||
left join sys_user u on u.user_id = ro.create_by
|
left join sys_user u on u.user_id = ro.create_by
|
||||||
where DATE_FORMAT(rd.day_time, '%Y-%m-%d') = #{time}
|
where DATE_FORMAT(rd.day_time, '%Y-%m-%d') = #{time}
|
||||||
and rt.counselor_id = #{userId}
|
and rt.counselor_id = #{userId}
|
||||||
#and ro.order_status = 1
|
|
||||||
#and rt.`status` > 0
|
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
Loading…
Reference in New Issue