This commit is contained in:
cjw 2024-11-22 14:02:16 +08:00
parent ba898c005b
commit 1ebca429a4
5 changed files with 26 additions and 5 deletions

View File

@ -1,5 +1,6 @@
package org.dromara.system.controller.wx; package org.dromara.system.controller.wx;
import cn.dev33.satoken.annotation.SaIgnore;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.dromara.common.core.constant.TenantConstants; import org.dromara.common.core.constant.TenantConstants;
@ -40,6 +41,7 @@ public class WxScaleController extends BaseController {
/** /**
* 查询心理测评量列表 * 查询心理测评量列表
*/ */
@SaIgnore
@GetMapping("/pageList") @GetMapping("/pageList")
public TableDataInfo<SysScaleVo> pageList(SysScaleBo bo, PageQuery pageQuery) { public TableDataInfo<SysScaleVo> pageList(SysScaleBo bo, PageQuery pageQuery) {
bo.setOrderBy("num"); bo.setOrderBy("num");
@ -49,6 +51,7 @@ public class WxScaleController extends BaseController {
/** /**
* 查询心理测评量列表 * 查询心理测评量列表
*/ */
@SaIgnore
@GetMapping("/typeList") @GetMapping("/typeList")
public R<List<SysScaleVo>> pageListTest(SysScaleBo bo) { public R<List<SysScaleVo>> pageListTest(SysScaleBo bo) {
bo.setOrderBy("num"); bo.setOrderBy("num");
@ -58,6 +61,7 @@ public class WxScaleController extends BaseController {
/** /**
* 查询心理测评量列表,默认展示两条数据 * 查询心理测评量列表,默认展示两条数据
*/ */
@SaIgnore
@GetMapping("/list") @GetMapping("/list")
public R<Map<String, List<SysScaleVo>>> list(String scaleType) { public R<Map<String, List<SysScaleVo>>> list(String scaleType) {
if (StringUtils.isEmpty(scaleType)) { if (StringUtils.isEmpty(scaleType)) {

View File

@ -86,8 +86,7 @@ public class ActivityServiceImpl implements IActivityService {
private LambdaQueryWrapper<Activity> buildQueryWrapper(ActivityBo bo) { private LambdaQueryWrapper<Activity> buildQueryWrapper(ActivityBo bo) {
Map<String, Object> params = bo.getParams(); Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<Activity> lqw = Wrappers.lambdaQuery(); LambdaQueryWrapper<Activity> lqw = Wrappers.lambdaQuery();
lqw.eq(StringUtils.isNotBlank(bo.getActivityTitle()), Activity::getActivityTitle, bo.getActivityTitle()); lqw.like(StringUtils.isNotBlank(bo.getActivityTitle()), Activity::getActivityTitle, bo.getActivityTitle());
lqw.eq(StringUtils.isNotBlank(bo.getActivityDetails()), Activity::getActivityDetails, bo.getActivityDetails());
lqw.eq(bo.getStartTime() != null, Activity::getStartTime, bo.getStartTime()); lqw.eq(bo.getStartTime() != null, Activity::getStartTime, bo.getStartTime());
lqw.eq(bo.getEndTime() != null, Activity::getEndTime, bo.getEndTime()); lqw.eq(bo.getEndTime() != null, Activity::getEndTime, bo.getEndTime());
lqw.eq(bo.getStatus() != null, Activity::getStatus, bo.getStatus()); lqw.eq(bo.getStatus() != null, Activity::getStatus, bo.getStatus());

View File

@ -9,6 +9,7 @@ import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
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 lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.service.OssService; import org.dromara.common.core.service.OssService;
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;
@ -114,11 +115,20 @@ 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();
Long userId = LoginHelper.getUserId();
BigDecimal price; BigDecimal price;
Long id = bo.getId(); Long id = bo.getId();
if (id == null) { if (id == null) {
ReservationOrder add = MapstructUtils.convert(bo, ReservationOrder.class); ReservationOrder add = MapstructUtils.convert(bo, ReservationOrder.class);
ReservationTime reservationTime = timeMapper.selectById(add.getTimeId()); Long timeId = add.getTimeId();
boolean exists = baseMapper.exists(new LambdaQueryWrapper<ReservationOrder>()
.eq(ReservationOrder::getTimeId, timeId)
.eq(ReservationOrder::getCreateBy, userId)
.eq(ReservationOrder::getOrderStatus, 0));
if(exists){
throw new ServiceException("账户下已有此预约时间的待支付订单,请确认后再支付");
}
ReservationTime reservationTime = timeMapper.selectById(timeId);
Counselor counselor = counselorMapper.selectById(reservationTime.getCounselorId()); Counselor counselor = counselorMapper.selectById(reservationTime.getCounselorId());
price = counselor.getPrice(); price = counselor.getPrice();
add.setCounselorId(counselor.getId()); add.setCounselorId(counselor.getId());
@ -128,7 +138,7 @@ public class ReservationOrderServiceImpl implements IReservationOrderService {
validEntityBeforeSave(add); validEntityBeforeSave(add);
baseMapper.insert(add); baseMapper.insert(add);
id = add.getId(); id = add.getId();
}else{ } else {
ReservationOrder reservationOrder = baseMapper.selectById(id); ReservationOrder reservationOrder = baseMapper.selectById(id);
Counselor counselor = counselorMapper.selectById(reservationOrder.getCounselorId()); Counselor counselor = counselorMapper.selectById(reservationOrder.getCounselorId());
price = counselor.getPrice(); price = counselor.getPrice();

View File

@ -9,6 +9,7 @@ import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
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 lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.core.service.OssService; import org.dromara.common.core.service.OssService;
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;
@ -118,6 +119,13 @@ public class SysScaleOrderServiceImpl implements ISysScaleOrderService {
Long userId = LoginHelper.getUserId(); Long userId = LoginHelper.getUserId();
SysScaleOrder add = MapstructUtils.convert(bo, SysScaleOrder.class); SysScaleOrder add = MapstructUtils.convert(bo, SysScaleOrder.class);
Long scaleId = add.getScaleId(); Long scaleId = add.getScaleId();
boolean exists = baseMapper.exists(new LambdaQueryWrapper<SysScaleOrder>()
.eq(SysScaleOrder::getScaleId, scaleId)
.eq(SysScaleOrder::getCreateBy, userId)
.eq(SysScaleOrder::getOrderStatus, 0));
if (exists) {
throw new ServiceException("账户下已有此量表的待支付订单,请确认后再支付");
}
//初始量测记录 //初始量测记录
SysEvaluationRecord record = new SysEvaluationRecord(); SysEvaluationRecord record = new SysEvaluationRecord();
record.setUserId(userId); record.setUserId(userId);

View File

@ -100,7 +100,7 @@
select scale_id select scale_id
from sys_evaluation_record from sys_evaluation_record
where user_id = #{userId} where user_id = #{userId}
and tenant_id = '000000' and status &gt;= 0
group by scale_id group by scale_id
</select> </select>