优化量表订单模块

This commit is contained in:
cjw 2024-09-18 10:22:32 +08:00
parent d2d2ea166e
commit 196cc52d33
17 changed files with 77 additions and 42 deletions

View File

@ -14,6 +14,7 @@ import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.error.WxErrorException; import me.chanjar.weixin.common.error.WxErrorException;
import org.dromara.common.core.domain.model.LoginUser; import org.dromara.common.core.domain.model.LoginUser;
import org.dromara.common.core.domain.model.XcxLoginBody; import org.dromara.common.core.domain.model.XcxLoginBody;
import org.dromara.common.core.enums.UserType;
import org.dromara.common.core.exception.user.UserException; import org.dromara.common.core.exception.user.UserException;
import org.dromara.common.core.utils.ValidatorUtils; import org.dromara.common.core.utils.ValidatorUtils;
import org.dromara.common.json.utils.JsonUtils; import org.dromara.common.json.utils.JsonUtils;
@ -110,7 +111,7 @@ public class XcxAuthStrategy implements IAuthStrategy {
newUser.setNickName("健康土豆"); newUser.setNickName("健康土豆");
newUser.setPhonenumber(phoneNumber); newUser.setPhonenumber(phoneNumber);
newUser.setOpenId(openid); newUser.setOpenId(openid);
newUser.setUserType("sys_user"); newUser.setUserType(UserType.APP_USER.getUserType());
userMapper.insert(newUser); userMapper.insert(newUser);
return newUser; return newUser;
} else { } else {

View File

@ -42,15 +42,15 @@ spring:
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
# jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562 # jdbc 所有参数配置参考 https://lionli.blog.csdn.net/article/details/122018562
# rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题) # rewriteBatchedStatements=true 批处理优化 大幅提升批量插入更新删除性能(对数据库有性能损耗 使用批量操作应考虑性能问题)
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true url: jdbc:mysql://39.101.193.239:3306/mental_tenant?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&allowMultiQueries=true
username: root username: root
password: root password: Mz123456*
# 从库数据源 # 从库数据源
slave: slave:
lazy: true lazy: true
type: ${spring.datasource.type} type: ${spring.datasource.type}
driverClassName: com.mysql.cj.jdbc.Driver driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true url: jdbc:mysql://39.101.193.239:3306/mental_tenant?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&allowMultiQueries=true
username: username:
password: password:
# oracle: # oracle:
@ -91,13 +91,13 @@ spring:
spring.data: spring.data:
redis: redis:
# 地址 # 地址
host: localhost host: 39.101.193.239
# 端口默认为6379 # 端口默认为6379
port: 6379 port: 6379
# 数据库索引 # 数据库索引
database: 0 database: 0
# redis 密码必须配置 # 密码(如没有密码请注释掉)
password: ruoyi123 password: Mz123456*
# 连接超时时间 # 连接超时时间
timeout: 10s timeout: 10s
# 是否开启ssl # 是否开启ssl
@ -262,7 +262,7 @@ wx:
appId: wx2e09db4124332242 appId: wx2e09db4124332242
mchId: 1646701170 mchId: 1646701170
mchKey: Mozhekejiyouxiangongsi6296296296 mchKey: Mozhekejiyouxiangongsi6296296296
keyPath: /usr/local/mental/certs keyPath: /usr/local/tenant/certs
miniapp: miniapp:
configs: configs:
- appid: wx2e09db4124332242 - appid: wx2e09db4124332242

View File

@ -22,7 +22,7 @@ captcha:
# 开发环境配置 # 开发环境配置
server: server:
# 服务器的HTTP端口默认为8080 # 服务器的HTTP端口默认为8080
port: 8080 port: 8090
servlet: servlet:
# 应用的访问路径 # 应用的访问路径
context-path: / context-path: /

View File

@ -65,6 +65,4 @@ public class WxMyController extends BaseController {
public TableDataInfo<ReservationOrderVo> list(ReservationOrderBo bo, PageQuery pageQuery) { public TableDataInfo<ReservationOrderVo> list(ReservationOrderBo bo, PageQuery pageQuery) {
return myService.queryReservationPageList(bo, pageQuery); return myService.queryReservationPageList(bo, pageQuery);
} }
} }

View File

@ -1,9 +1,9 @@
package org.dromara.scale.controller.wx; package org.dromara.scale.controller.wx;
import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
import jakarta.servlet.http.HttpServletRequest; import jakarta.servlet.http.HttpServletRequest;
import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.poi.ss.formula.functions.T;
import org.dromara.common.core.domain.R; import org.dromara.common.core.domain.R;
import org.dromara.common.core.validate.AddGroup; import org.dromara.common.core.validate.AddGroup;
import org.dromara.common.idempotent.annotation.RepeatSubmit; import org.dromara.common.idempotent.annotation.RepeatSubmit;
@ -60,7 +60,7 @@ public class WxOrderController extends BaseController {
@Log(title = "量表订单", businessType = BusinessType.INSERT) @Log(title = "量表订单", businessType = BusinessType.INSERT)
@RepeatSubmit() @RepeatSubmit()
@PostMapping("/scale") @PostMapping("/scale")
public R<T> addScale(@Validated(AddGroup.class) @RequestBody SysScaleOrderBo bo, HttpServletRequest request) throws Exception { public R<WxPayMpOrderResult> addScale(@Validated(AddGroup.class) @RequestBody SysScaleOrderBo bo, HttpServletRequest request) throws Exception {
String clientIpAddress = getClientIpAddress(request); String clientIpAddress = getClientIpAddress(request);
bo.setSpbillCreateIp(clientIpAddress); bo.setSpbillCreateIp(clientIpAddress);
return R.ok(scaleOrderService.insertByBo(bo)); return R.ok(scaleOrderService.insertByBo(bo));
@ -72,7 +72,7 @@ public class WxOrderController extends BaseController {
@Log(title = "预约订单", businessType = BusinessType.INSERT) @Log(title = "预约订单", businessType = BusinessType.INSERT)
@RepeatSubmit() @RepeatSubmit()
@PostMapping("/reservation") @PostMapping("/reservation")
public R<T> addReservation(@Validated(AddGroup.class) @RequestBody ReservationOrderBo bo, HttpServletRequest request) throws Exception { public R<WxPayMpOrderResult> addReservation(@Validated(AddGroup.class) @RequestBody ReservationOrderBo bo, HttpServletRequest request) throws Exception {
String clientIpAddress = getClientIpAddress(request); String clientIpAddress = getClientIpAddress(request);
bo.setSpbillCreateIp(clientIpAddress); bo.setSpbillCreateIp(clientIpAddress);
return R.ok(reservationOrderService.insertByBo(bo)); return R.ok(reservationOrderService.insertByBo(bo));

View File

@ -6,6 +6,7 @@ import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
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.scale.service.IReservationOrderService; import org.dromara.scale.service.IReservationOrderService;
import org.dromara.scale.service.ISysScaleOrderService; import org.dromara.scale.service.ISysScaleOrderService;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
@ -21,6 +22,8 @@ import org.springframework.web.bind.annotation.RestController;
* @version V1.0.0 * @version V1.0.0
* @date 2024/7/29 14:08 * @date 2024/7/29 14:08
*/ */
@Slf4j
@SaIgnore @SaIgnore
@Validated @Validated
@RequiredArgsConstructor @RequiredArgsConstructor
@ -36,6 +39,7 @@ public class WxPayController {
@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);
String outTradeNo = notifyResult.getOutTradeNo(); String outTradeNo = notifyResult.getOutTradeNo();
scaleOrderService.processOrder(outTradeNo); scaleOrderService.processOrder(outTradeNo);

View File

@ -83,6 +83,8 @@ public class SysScale extends TenantEntity {
@AutoMapping(target = "appCoverUrl") @AutoMapping(target = "appCoverUrl")
private Long appCover; private Long appCover;
@AutoMapping(target = "detailAnnexUrl")
private Long detailAnnex;
/** /**
* 发布次数 * 发布次数

View File

@ -33,6 +33,8 @@ public class SysScaleOrder extends TenantEntity {
*/ */
private Long scaleId; private Long scaleId;
private Long recordId;
/** /**
* 订单价格 * 订单价格
*/ */

View File

@ -87,8 +87,10 @@ public class SysScaleBo extends BaseEntity {
*/ */
@NotNull(message = "封面不能为空", groups = {AddGroup.class, EditGroup.class}) @NotNull(message = "封面不能为空", groups = {AddGroup.class, EditGroup.class})
private Long cover; private Long cover;
@NotNull(message = "移动端封面不能为空", groups = {AddGroup.class, EditGroup.class})
private Long appCover; private Long appCover;
@NotNull(message = "移动端详情图不能为空", groups = {AddGroup.class, EditGroup.class})
private Long detailAnnex;
/** /**
* 量表类型对应字典项scale_type * 量表类型对应字典项scale_type

View File

@ -88,6 +88,8 @@ public class SysScaleVo implements Serializable {
private Long appCover; private Long appCover;
private Long detailAnnex;
/** /**
* 封面地址 * 封面地址
*/ */
@ -99,6 +101,9 @@ public class SysScaleVo implements Serializable {
//@AutoMapping(target = "appCover") //@AutoMapping(target = "appCover")
private Long appCoverUrl; private Long appCoverUrl;
@Translation(type = TransConstant.OSS_ID_TO_URL)
//@AutoMapping(target = "appCover")
private Long detailAnnexUrl;
/** /**
* 发布次数 * 发布次数
*/ */

View File

@ -1,5 +1,6 @@
package org.dromara.scale.service; package org.dromara.scale.service;
import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
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.scale.domain.bo.ReservationOrderBo; import org.dromara.scale.domain.bo.ReservationOrderBo;
@ -46,7 +47,7 @@ public interface IReservationOrderService {
* @param bo 预约订单 * @param bo 预约订单
* @return 是否新增成功 * @return 是否新增成功
*/ */
<T> T insertByBo(ReservationOrderBo bo) throws Exception; WxPayMpOrderResult insertByBo(ReservationOrderBo bo) throws Exception;
Boolean processOrder(String orderId); Boolean processOrder(String orderId);

View File

@ -1,5 +1,6 @@
package org.dromara.scale.service; package org.dromara.scale.service;
import com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
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.scale.domain.bo.SysScaleOrderBo; import org.dromara.scale.domain.bo.SysScaleOrderBo;
@ -46,7 +47,7 @@ public interface ISysScaleOrderService {
* @param bo 量表订单 * @param bo 量表订单
* @return 是否新增成功 * @return 是否新增成功
*/ */
<T> T insertByBo(SysScaleOrderBo bo) throws Exception; WxPayMpOrderResult insertByBo(SysScaleOrderBo bo) throws Exception;
Boolean processOrder(String orderId); Boolean processOrder(String orderId);

View File

@ -3,6 +3,7 @@ package org.dromara.scale.service.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.dromara.common.core.domain.model.LoginUser; import org.dromara.common.core.domain.model.LoginUser;
@ -54,16 +55,12 @@ public class EvaluationServiceImpl implements IEvaluationService {
private final ISysWarnRecordService warnRecordService; private final ISysWarnRecordService warnRecordService;
private final SysScaleMapper scaleMapper; private final SysScaleMapper scaleMapper;
private final SysScalePublishMapper publishMapper; private final SysScalePublishMapper publishMapper;
private final SysEvaluationRecordMapper recordMapper; private final SysEvaluationRecordMapper recordMapper;
private final SysEvaluationConclusionMapper evaluationConclusionMapper; private final SysEvaluationConclusionMapper evaluationConclusionMapper;
private final SysEvaluationAnswerMapper evaluationAnswerMapper; private final SysEvaluationAnswerMapper evaluationAnswerMapper;
private final SysWarnRecordMapper warnMapper; private final SysWarnRecordMapper warnMapper;
private final SysScaleOrderMapper orderMapper;
private final MathContext mathContext = new MathContext(2); private final MathContext mathContext = new MathContext(2);
@ -117,6 +114,9 @@ public class EvaluationServiceImpl implements IEvaluationService {
if (evaluationRecord.getStatus() == 1) { if (evaluationRecord.getStatus() == 1) {
throw new ServiceException("此量表已经答题完毕,请勿重复提交"); throw new ServiceException("此量表已经答题完毕,请勿重复提交");
} }
if (evaluationRecord.getStatus() == -1) {
throw new ServiceException("此量表暂未开始作答,请确认后再尝试");
}
SysEvaluationRecord update = new SysEvaluationRecord(); SysEvaluationRecord update = new SysEvaluationRecord();
update.setRecordId(recordId); update.setRecordId(recordId);
update.setStatus(StatusEnum.DISABLED.getValue()); update.setStatus(StatusEnum.DISABLED.getValue());
@ -138,7 +138,7 @@ public class EvaluationServiceImpl implements IEvaluationService {
if (ObjectUtil.isEmpty(sysEvaluationRecord)) { if (ObjectUtil.isEmpty(sysEvaluationRecord)) {
throw new ServiceException("未查询到需要测试的记录,请联系管理员"); throw new ServiceException("未查询到需要测试的记录,请联系管理员");
} }
if (sysEvaluationRecord.getCreateTime() == null) { if (sysEvaluationRecord.getStatus() == -1) {
throw new ServiceException("此量表暂未开始作答,请确认后再提交"); throw new ServiceException("此量表暂未开始作答,请确认后再提交");
} }
if (sysEvaluationRecord.getStatus() == 1) { if (sysEvaluationRecord.getStatus() == 1) {
@ -182,7 +182,7 @@ public class EvaluationServiceImpl implements IEvaluationService {
Long batchNo = sysEvaluationRecord.getBatchNo(); Long batchNo = sysEvaluationRecord.getBatchNo();
Integer publishFlag = sysEvaluationRecord.getPublishFlag(); Integer publishFlag = sysEvaluationRecord.getPublishFlag();
//判断是个人还是发布 //群体发布
if (StatusEnum.IN_USE.getValue().equals(publishFlag)) { if (StatusEnum.IN_USE.getValue().equals(publishFlag)) {
SysScalePublishVo scalePublishVo = publishMapper.selectVoById(batchNo); SysScalePublishVo scalePublishVo = publishMapper.selectVoById(batchNo);
//查询考核结果 //查询考核结果
@ -207,6 +207,15 @@ public class EvaluationServiceImpl implements IEvaluationService {
wre.setSituation(max.get().getSituation()); wre.setSituation(max.get().getSituation());
warnRecordService.insertByBo(wre); warnRecordService.insertByBo(wre);
} }
} else {
//个人要更新订单状态
SysScaleOrder scaleOrder = orderMapper.selectOne(new LambdaQueryWrapper<SysScaleOrder>().eq(SysScaleOrder::getRecordId, recordId));
SysScaleOrder order = new SysScaleOrder();
order.setId(scaleOrder.getId());
order.setOrderStatus(2);
order.setUseStatus(1);
order.setUpdateBy(scaleOrder.getCreateBy());
orderMapper.updateById(order);
} }
//不允许查看考核结果 //不允许查看考核结果
if (!allowQueryResult) { if (!allowQueryResult) {
@ -215,7 +224,6 @@ public class EvaluationServiceImpl implements IEvaluationService {
BigDecimal totalScore = list.stream() BigDecimal totalScore = list.stream()
.map(SysEvaluationConclusionVo::getScore) .map(SysEvaluationConclusionVo::getScore)
// 使用reduce()聚合函数,得到金额总和
.reduce(BigDecimal.ZERO, BigDecimal::add); .reduce(BigDecimal.ZERO, BigDecimal::add);
return new HashMap<>(2) {{ return new HashMap<>(2) {{
//put("evalRecordId",evalRecord.getId()); //put("evalRecordId",evalRecord.getId());

View File

@ -3,6 +3,7 @@ package org.dromara.scale.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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 com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest; 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;
@ -99,7 +100,7 @@ public class ReservationOrderServiceImpl implements IReservationOrderService {
* @return 是否新增成功 * @return 是否新增成功
*/ */
@Override @Override
public <T> T insertByBo(ReservationOrderBo bo) throws Exception { public WxPayMpOrderResult insertByBo(ReservationOrderBo bo) throws Exception {
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());

View File

@ -3,12 +3,14 @@ package org.dromara.scale.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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 com.github.binarywang.wxpay.bean.order.WxPayMpOrderResult;
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest; 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 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.common.satoken.utils.LoginHelper;
import org.dromara.scale.constant.StatusEnum; import org.dromara.scale.constant.StatusEnum;
import org.dromara.scale.domain.SysEvaluationRecord; import org.dromara.scale.domain.SysEvaluationRecord;
import org.dromara.scale.domain.SysScale; import org.dromara.scale.domain.SysScale;
@ -100,27 +102,38 @@ public class SysScaleOrderServiceImpl implements ISysScaleOrderService {
* @return 是否新增成功 * @return 是否新增成功
*/ */
@Override @Override
public <T> T insertByBo(SysScaleOrderBo bo) throws Exception { public WxPayMpOrderResult insertByBo(SysScaleOrderBo bo) throws Exception {
String openId = LoginHelper.getOpenId();
Long userId = LoginHelper.getUserId();
SysScaleOrder add = MapstructUtils.convert(bo, SysScaleOrder.class); SysScaleOrder add = MapstructUtils.convert(bo, SysScaleOrder.class);
SysScale sysScale = sysScaleMapper.selectById(add.getScaleId()); Long scaleId = add.getScaleId();
SysScale sysScale = sysScaleMapper.selectById(scaleId);
BigDecimal price = sysScale.getPrice(); BigDecimal price = sysScale.getPrice();
add.setActualPrice(price); add.setActualPrice(price);
add.setOrderPrice(price); add.setOrderPrice(price);
add.setUseStatus(StatusEnum.DISABLED.getValue()); add.setUseStatus(StatusEnum.DISABLED.getValue());
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) { //初始量测记录
bo.setId(add.getId()); SysEvaluationRecord record = new SysEvaluationRecord();
} record.setUserId(userId);
//个人测评订单号就是批次号
record.setBatchNo(add.getId());
record.setScaleId(scaleId);
record.setStatus(-1);
record.setCreateBy(userId);
record.setUpdateBy(userId);
recordMapper.insert(record);
WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest(); WxPayUnifiedOrderRequest orderRequest = new WxPayUnifiedOrderRequest();
orderRequest.setBody("墨者科技-量表支付"); orderRequest.setBody("墨者科技-量表支付");
orderRequest.setOutTradeNo(add.getId().toString()); orderRequest.setOutTradeNo(add.getId().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/xxx/wx/pay/notify/order/scale"); orderRequest.setNotifyUrl("https://api.ysmental.com/tenant/wx/pay/notify/order/scale");
orderRequest.setTradeType("JSAPI"); orderRequest.setTradeType("JSAPI");
orderRequest.setSpbillCreateIp(bo.getSpbillCreateIp()); orderRequest.setSpbillCreateIp(bo.getSpbillCreateIp());
orderRequest.setOpenid(openId);
return payService.createOrder(orderRequest); return payService.createOrder(orderRequest);
} }
@ -136,18 +149,15 @@ public class SysScaleOrderServiceImpl implements ISysScaleOrderService {
public Boolean processOrder(String orderId) { public Boolean processOrder(String orderId) {
long id = Long.parseLong(orderId); long id = Long.parseLong(orderId);
SysScaleOrder scaleOrder = baseMapper.selectById(id); SysScaleOrder scaleOrder = baseMapper.selectById(id);
Long scaleId = scaleOrder.getScaleId();
Long userId = scaleOrder.getCreateBy(); Long userId = scaleOrder.getCreateBy();
Long recordId = scaleOrder.getRecordId();
//初始量测记录 //初始量测记录
SysEvaluationRecord record = new SysEvaluationRecord(); SysEvaluationRecord record = new SysEvaluationRecord();
record.setUserId(userId); record.setRecordId(recordId);
//个人测评订单号就是批次号 //个人测评订单号就是批次号
record.setBatchNo(id); record.setStatus(0);
record.setScaleId(scaleId);
record.setStatus(-1);
record.setCreateBy(userId);
record.setUpdateBy(userId); record.setUpdateBy(userId);
boolean recordFlag = recordMapper.insert(record) > 0; boolean recordFlag = recordMapper.updateById(record) > 0;
//更新订单状态 //更新订单状态
SysScaleOrder order = new SysScaleOrder(); SysScaleOrder order = new SysScaleOrder();
order.setId(id); order.setId(id);

View File

@ -213,7 +213,7 @@ public class SysScalePublishServiceImpl implements ISysScalePublishService {
record.setBatchNo(batchNo); record.setBatchNo(batchNo);
record.setScaleId(Long.parseLong(scaleId)); record.setScaleId(Long.parseLong(scaleId));
//初始化字段 //初始化字段
record.setStatus(-1); record.setStatus(0);
recordList.add(record); recordList.add(record);
} }
} }

View File

@ -85,7 +85,7 @@ public class SysScaleServiceImpl implements ISysScaleService {
.eq(SysEvaluationRecord::getUserId, userId) .eq(SysEvaluationRecord::getUserId, userId)
.eq(SysEvaluationRecord::getScaleId, scaleId) .eq(SysEvaluationRecord::getScaleId, scaleId)
.eq(SysEvaluationRecord::getPublishFlag, 0) .eq(SysEvaluationRecord::getPublishFlag, 0)
.lt(SysEvaluationRecord::getStatus, 1)); .eq(SysEvaluationRecord::getStatus, 0));
sysScaleVo.setRecordId(sysEvaluationRecord != null ? sysEvaluationRecord.getRecordId() : null); sysScaleVo.setRecordId(sysEvaluationRecord != null ? sysEvaluationRecord.getRecordId() : null);
return sysScaleVo; return sysScaleVo;
} }