Merge remote-tracking branch 'origin/jihan_0920_护理服务、商城、积分兑换、在线问诊功能分支' into jihan_0920_护理服务、商城、积分兑换、在线问诊功能分支

This commit is contained in:
HaoWang 2023-11-09 16:35:02 +08:00
commit 893804d963
2 changed files with 12 additions and 6 deletions

View File

@ -302,29 +302,29 @@ public class PatientCenterServiceImpl implements PatientCenterService {
GoodsAttributeDetails goodsAttributeDetails = nursingStationGoodsMapper.selectGoodsAttributeDetailsGoodsStockById(goodsOrder.getGoodsAttributeDetailsId());
//判断当前商品是否可兑换商品
if (Objects.nonNull(goodsAttributeDetails) && CouponAndIntegralFlagEnum.NOT_CONVERTIBLE.getInfo().equals(goodsAttributeDetails.getIntegralExchangeFlag())) {
return AjaxResult.error("当前商品非积分兑换商品,无法兑换!");
return AjaxResult.error("当前商品非健康豆兑换商品,无法兑换!");
}
//判断积分兑换数值是否正确
boolean integralExchangeSill = Objects.nonNull(goodsAttributeDetails) && Objects.isNull(goodsAttributeDetails.getIntegralExchangeSill());
boolean equalIntegralExchangeSill = Objects.nonNull(goodsAttributeDetails) && !goodsOrder.getIntegralExchangeSill().equals(goodsAttributeDetails.getIntegralExchangeSill());
if (BooleanUtils.isTrue(integralExchangeSill) || BooleanUtils.isTrue(equalIntegralExchangeSill)) {
return AjaxResult.error("当前商品兑换需要使用的积分数值不正确,无法兑换!");
return AjaxResult.error("当前商品兑换需要使用的健康豆数量不正确,无法兑换!");
}
//判断积分兑换商品数目是否正确
boolean integralExchangeCount = Objects.nonNull(goodsAttributeDetails) && Objects.isNull(goodsAttributeDetails.getIntegralExchangeCount());
boolean equalIntegralExchangeCount = Objects.nonNull(goodsAttributeDetails) && !goodsOrder.getIntegralExchangeCount().equals(goodsAttributeDetails.getIntegralExchangeCount());
if (BooleanUtils.isTrue(integralExchangeCount) || BooleanUtils.isTrue(equalIntegralExchangeCount)) {
return AjaxResult.error("当前积分兑换商品的数量不正确,无法兑换!");
return AjaxResult.error("当前健康豆兑换商品的数量不正确,无法兑换!");
}
//判断库存是否充足
if (Objects.isNull(goodsAttributeDetails.getGoodsStock()) || goodsAttributeDetails.getGoodsStock() == 0) {
return AjaxResult.error("当前商品库存不足,无法购买");
return AjaxResult.error("当前商品库存不足,无法兑换");
}
//判读用户账户积分是否充足
AtomicInteger patientIntegral = new AtomicInteger(Objects.isNull(patientInfo.getIntegral()) ? 0 : patientInfo.getIntegral());
AtomicInteger exchangeIntegralSkill = new AtomicInteger(Objects.isNull(goodsOrder.getIntegralExchangeSill()) ? 0 : goodsOrder.getIntegralExchangeSill());
if (patientIntegral.get() < exchangeIntegralSkill.get()) {
return AjaxResult.error("当前用户的账户积分数值不足,无法兑换!");
return AjaxResult.error("当前用户的健康豆数目值不足,无法兑换!");
}
//判断商品库存数量是否满足兑换数量
AtomicInteger goodsStock = new AtomicInteger(goodsAttributeDetails.getGoodsStock());

View File

@ -140,6 +140,7 @@ public class WeChatPayNotifyServiceImpl implements WeChatPayNotifyService {
resultMap.put("message", "通知验签失败");
return JSON.toJSONString(resultMap);
}
log.info(accountFlag + "微信通知的请求体信息 ===> {}", body);
String nonce = request.getHeader("Wechatpay-Nonce");
String timestamp = request.getHeader("Wechatpay-Timestamp");
String signature = request.getHeader("Wechatpay-Signature");
@ -147,7 +148,12 @@ public class WeChatPayNotifyServiceImpl implements WeChatPayNotifyService {
NotificationRequest notificationRequest = new NotificationRequest.Builder().withSerialNumber(serialNo)
.withNonce(nonce).withTimestamp(timestamp).withSignature(signature).withBody(body).build();
NotificationHandler handler = new NotificationHandler(xylVerifier, xylWeChatPaymentConfig.getXylPaymentKey().getBytes(StandardCharsets.UTF_8));
Notification notification = handler.parse(notificationRequest);
Notification notification = null;
try {
notification = handler.parse(notificationRequest);
} catch (Exception e) {
log.warn("微信支付回调异常,异常信息为:{}", e.getMessage());
}
if (Objects.isNull(notification)) {
log.error(accountFlag + "微信通知验签失败,请求体 ====> {}", body);
response.setStatus(500);