Merge branch 'jihan_0920_护理服务、商城、积分兑换、在线问诊功能分支' of http://182.92.166.109:3000/jihan/xinelu-api into jihan_0920_护理服务、商城、积分兑换、在线问诊功能分支
This commit is contained in:
commit
e1bfafabde
@ -115,7 +115,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
.antMatchers("/login", "/register", "/captchaImage").anonymous()
|
.antMatchers("/login", "/register", "/captchaImage").anonymous()
|
||||||
// 静态资源,可匿名访问
|
// 静态资源,可匿名访问
|
||||||
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
|
||||||
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**", "/nurseApplet/**", "/nurseApp/**", "/specialDisease/getUserInfo", "/monitor/payTask/handCloseOrder", "/newApp/login/**", "/system/hospitalPerson/**").permitAll()
|
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**", "/nurseApplet/**", "/nurseApp/**", "/specialDisease/getUserInfo", "/monitor/payTask/handCloseOrder", "/newApp/login/**", "/system/hospitalPerson/**", "/evaluate/**", "/webSocket/**").permitAll()
|
||||||
.antMatchers(antMatchers.split(",")).permitAll()
|
.antMatchers(antMatchers.split(",")).permitAll()
|
||||||
// 除上面外的所有请求全部需要鉴权认证
|
// 除上面外的所有请求全部需要鉴权认证
|
||||||
.anyRequest().authenticated()
|
.anyRequest().authenticated()
|
||||||
|
|||||||
@ -172,7 +172,7 @@ public class PatientCenterController extends BaseController {
|
|||||||
throw new ServiceException(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
throw new ServiceException(bindingResult.getAllErrors().get(0).getDefaultMessage());
|
||||||
}
|
}
|
||||||
if (Objects.isNull(goodsOrder.getIntegralExchangeSill()) || goodsOrder.getIntegralExchangeSill() <= 0) {
|
if (Objects.isNull(goodsOrder.getIntegralExchangeSill()) || goodsOrder.getIntegralExchangeSill() <= 0) {
|
||||||
return AjaxResult.error("当前积分数值不足,无法兑换!");
|
return AjaxResult.error("当前健康豆数值不足,无法兑换!");
|
||||||
}
|
}
|
||||||
if (Objects.isNull(goodsOrder.getIntegralExchangeCount()) || goodsOrder.getIntegralExchangeCount() <= 0) {
|
if (Objects.isNull(goodsOrder.getIntegralExchangeCount()) || goodsOrder.getIntegralExchangeCount() <= 0) {
|
||||||
return AjaxResult.error("兑换商品数量不正确,无法兑换!");
|
return AjaxResult.error("兑换商品数量不正确,无法兑换!");
|
||||||
|
|||||||
@ -302,29 +302,29 @@ public class PatientCenterServiceImpl implements PatientCenterService {
|
|||||||
GoodsAttributeDetails goodsAttributeDetails = nursingStationGoodsMapper.selectGoodsAttributeDetailsGoodsStockById(goodsOrder.getGoodsAttributeDetailsId());
|
GoodsAttributeDetails goodsAttributeDetails = nursingStationGoodsMapper.selectGoodsAttributeDetailsGoodsStockById(goodsOrder.getGoodsAttributeDetailsId());
|
||||||
//判断当前商品是否可兑换商品
|
//判断当前商品是否可兑换商品
|
||||||
if (Objects.nonNull(goodsAttributeDetails) && CouponAndIntegralFlagEnum.NOT_CONVERTIBLE.getInfo().equals(goodsAttributeDetails.getIntegralExchangeFlag())) {
|
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 integralExchangeSill = Objects.nonNull(goodsAttributeDetails) && Objects.isNull(goodsAttributeDetails.getIntegralExchangeSill());
|
||||||
boolean equalIntegralExchangeSill = Objects.nonNull(goodsAttributeDetails) && !goodsOrder.getIntegralExchangeSill().equals(goodsAttributeDetails.getIntegralExchangeSill());
|
boolean equalIntegralExchangeSill = Objects.nonNull(goodsAttributeDetails) && !goodsOrder.getIntegralExchangeSill().equals(goodsAttributeDetails.getIntegralExchangeSill());
|
||||||
if (BooleanUtils.isTrue(integralExchangeSill) || BooleanUtils.isTrue(equalIntegralExchangeSill)) {
|
if (BooleanUtils.isTrue(integralExchangeSill) || BooleanUtils.isTrue(equalIntegralExchangeSill)) {
|
||||||
return AjaxResult.error("当前商品兑换需要使用的积分数值不正确,无法兑换!");
|
return AjaxResult.error("当前商品兑换需要使用的健康豆数量不正确,无法兑换!");
|
||||||
}
|
}
|
||||||
//判断积分兑换商品数目是否正确
|
//判断积分兑换商品数目是否正确
|
||||||
boolean integralExchangeCount = Objects.nonNull(goodsAttributeDetails) && Objects.isNull(goodsAttributeDetails.getIntegralExchangeCount());
|
boolean integralExchangeCount = Objects.nonNull(goodsAttributeDetails) && Objects.isNull(goodsAttributeDetails.getIntegralExchangeCount());
|
||||||
boolean equalIntegralExchangeCount = Objects.nonNull(goodsAttributeDetails) && !goodsOrder.getIntegralExchangeCount().equals(goodsAttributeDetails.getIntegralExchangeCount());
|
boolean equalIntegralExchangeCount = Objects.nonNull(goodsAttributeDetails) && !goodsOrder.getIntegralExchangeCount().equals(goodsAttributeDetails.getIntegralExchangeCount());
|
||||||
if (BooleanUtils.isTrue(integralExchangeCount) || BooleanUtils.isTrue(equalIntegralExchangeCount)) {
|
if (BooleanUtils.isTrue(integralExchangeCount) || BooleanUtils.isTrue(equalIntegralExchangeCount)) {
|
||||||
return AjaxResult.error("当前积分兑换商品的数量不正确,无法兑换!");
|
return AjaxResult.error("当前健康豆兑换商品的数量不正确,无法兑换!");
|
||||||
}
|
}
|
||||||
//判断库存是否充足
|
//判断库存是否充足
|
||||||
if (Objects.isNull(goodsAttributeDetails.getGoodsStock()) || goodsAttributeDetails.getGoodsStock() == 0) {
|
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 patientIntegral = new AtomicInteger(Objects.isNull(patientInfo.getIntegral()) ? 0 : patientInfo.getIntegral());
|
||||||
AtomicInteger exchangeIntegralSkill = new AtomicInteger(Objects.isNull(goodsOrder.getIntegralExchangeSill()) ? 0 : goodsOrder.getIntegralExchangeSill());
|
AtomicInteger exchangeIntegralSkill = new AtomicInteger(Objects.isNull(goodsOrder.getIntegralExchangeSill()) ? 0 : goodsOrder.getIntegralExchangeSill());
|
||||||
if (patientIntegral.get() < exchangeIntegralSkill.get()) {
|
if (patientIntegral.get() < exchangeIntegralSkill.get()) {
|
||||||
return AjaxResult.error("当前用户的账户积分数值不足,无法兑换!");
|
return AjaxResult.error("当前用户的健康豆数目值不足,无法兑换!");
|
||||||
}
|
}
|
||||||
//判断商品库存数量是否满足兑换数量
|
//判断商品库存数量是否满足兑换数量
|
||||||
AtomicInteger goodsStock = new AtomicInteger(goodsAttributeDetails.getGoodsStock());
|
AtomicInteger goodsStock = new AtomicInteger(goodsAttributeDetails.getGoodsStock());
|
||||||
|
|||||||
@ -140,6 +140,7 @@ public class WeChatPayNotifyServiceImpl implements WeChatPayNotifyService {
|
|||||||
resultMap.put("message", "通知验签失败");
|
resultMap.put("message", "通知验签失败");
|
||||||
return JSON.toJSONString(resultMap);
|
return JSON.toJSONString(resultMap);
|
||||||
}
|
}
|
||||||
|
log.info(accountFlag + "微信通知的请求体信息 ===> {}", body);
|
||||||
String nonce = request.getHeader("Wechatpay-Nonce");
|
String nonce = request.getHeader("Wechatpay-Nonce");
|
||||||
String timestamp = request.getHeader("Wechatpay-Timestamp");
|
String timestamp = request.getHeader("Wechatpay-Timestamp");
|
||||||
String signature = request.getHeader("Wechatpay-Signature");
|
String signature = request.getHeader("Wechatpay-Signature");
|
||||||
@ -147,7 +148,12 @@ public class WeChatPayNotifyServiceImpl implements WeChatPayNotifyService {
|
|||||||
NotificationRequest notificationRequest = new NotificationRequest.Builder().withSerialNumber(serialNo)
|
NotificationRequest notificationRequest = new NotificationRequest.Builder().withSerialNumber(serialNo)
|
||||||
.withNonce(nonce).withTimestamp(timestamp).withSignature(signature).withBody(body).build();
|
.withNonce(nonce).withTimestamp(timestamp).withSignature(signature).withBody(body).build();
|
||||||
NotificationHandler handler = new NotificationHandler(xylVerifier, xylWeChatPaymentConfig.getXylPaymentKey().getBytes(StandardCharsets.UTF_8));
|
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)) {
|
if (Objects.isNull(notification)) {
|
||||||
log.error(accountFlag + "微信通知验签失败,请求体 ====> {}", body);
|
log.error(accountFlag + "微信通知验签失败,请求体 ====> {}", body);
|
||||||
response.setStatus(500);
|
response.setStatus(500);
|
||||||
|
|||||||
@ -395,12 +395,12 @@ public class WeChatRefundServiceImpl implements WeChatRefundService {
|
|||||||
patientIntegralChange.setChangeIntegral(stockIntegralNum);
|
patientIntegralChange.setChangeIntegral(stockIntegralNum);
|
||||||
patientIntegralChange.setChangeTime(LocalDateTime.now());
|
patientIntegralChange.setChangeTime(LocalDateTime.now());
|
||||||
patientIntegralChange.setChangeType(IntegralChangeType.COMMODITY_EXCHANGE.getInfo());
|
patientIntegralChange.setChangeType(IntegralChangeType.COMMODITY_EXCHANGE.getInfo());
|
||||||
patientIntegralChange.setChangeRemark("积分兑换商品订单新增积分变更");
|
patientIntegralChange.setChangeRemark("健康豆兑换商品订单新增健康豆变更");
|
||||||
patientIntegralChange.setChangeIntegralChannel(StringUtils.isBlank(goodsOrderInfo.getOrderChannel()) ? "" : goodsOrderInfo.getOrderChannel());
|
patientIntegralChange.setChangeIntegralChannel(StringUtils.isBlank(goodsOrderInfo.getOrderChannel()) ? "" : goodsOrderInfo.getOrderChannel());
|
||||||
patientIntegralChange.setCreateTime(LocalDateTime.now());
|
patientIntegralChange.setCreateTime(LocalDateTime.now());
|
||||||
int integralChange = patientIntegralChangeMapper.insertPatientIntegralChange(patientIntegralChange);
|
int integralChange = patientIntegralChangeMapper.insertPatientIntegralChange(patientIntegralChange);
|
||||||
if (integralChange <= 0) {
|
if (integralChange <= 0) {
|
||||||
log.error("积分兑换商品-生成积分变更记录表信息失败,积分变更信息:{}", integralChange);
|
log.error("健康豆兑换商品-生成健康豆变更记录表信息失败,健康豆变更信息:{}", integralChange);
|
||||||
throw new ServiceException("确认退款失败,请联系管理员!");
|
throw new ServiceException("确认退款失败,请联系管理员!");
|
||||||
}
|
}
|
||||||
return AjaxResult.success();
|
return AjaxResult.success();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user