|
@@ -40,10 +40,14 @@ import org.jeecg.modules.pay.config.WechatUrlConstants;
|
|
|
import org.jeecg.modules.pay.vo.NotifyRequest;
|
|
|
import org.jeecg.modules.pay.vo.NotifyResponse;
|
|
|
import org.jeecg.modules.redission.RedissonDelayQueue;
|
|
|
+import org.jeecg.modules.system.app.dto.receiptPaymentDetails.ReceiptPaymentDetailsInfoVo;
|
|
|
import org.jeecg.modules.system.app.entity.*;
|
|
|
import org.jeecg.modules.system.app.mapper.*;
|
|
|
+import org.jeecg.modules.system.app.service.IReceiptPaymentDetailsInfoService;
|
|
|
import org.jeecg.modules.system.entity.SysUser;
|
|
|
+import org.jeecg.modules.system.mapper.SysDepartMapper;
|
|
|
import org.jeecg.modules.system.mapper.SysUserMapper;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -120,6 +124,12 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
@Resource
|
|
|
private RedisTemplate<String, Object> redisTemplate;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ IReceiptPaymentDetailsInfoService iReceiptPaymentDetailsInfoService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ SysDepartMapper sysDepartMapper;
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public OrderVO.createOrderPlaceSchool createOrderPlaceSchool(String rulesId, String userIds) {
|
|
@@ -1562,7 +1572,44 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
|
|
|
@Override
|
|
|
public Map<String, String> wechatPayNotify(HttpServletRequest request) {
|
|
|
- return weChatPayService.wechatPayNotify(request);
|
|
|
+ Map<String, String> stringStringMap = weChatPayService.wechatPayNotify(request);
|
|
|
+ //对订单进行封账金额统计
|
|
|
+ if (stringStringMap!=null
|
|
|
+ && stringStringMap.containsKey("code")
|
|
|
+ && "SUCCESS".equals(stringStringMap.get("code"))
|
|
|
+ && stringStringMap.containsKey("orderCode")
|
|
|
+ ){
|
|
|
+ String orderCode = stringStringMap.get("orderCode");
|
|
|
+
|
|
|
+
|
|
|
+ if(StringUtils.isEmpty(orderCode)){
|
|
|
+ log.error("微信支付成功通知成功,订单编号为空,通知失败:"+JSONObject.toJSONString(stringStringMap));
|
|
|
+ throw new JeecgBootException("微信支付成功通知成功,订单编号为空,通知失败");
|
|
|
+ }
|
|
|
+ AppOrder appOrder = appOrderMapper.selectOne(Wrappers.<AppOrder>lambdaQuery().eq(AppOrder::getOrderCode, orderCode).last("limit 1"));
|
|
|
+ if (appOrder==null){
|
|
|
+ log.error("微信支付成功通知成功,订单未查询到,通知失败:"+JSONObject.toJSONString(stringStringMap));
|
|
|
+ throw new JeecgBootException("微信支付成功通知成功,订单未查询到,通知失败");
|
|
|
+ }
|
|
|
+ log.info("订单信息:"+JSONObject.toJSONString(appOrder));
|
|
|
+ if (StringUtils.isEmpty(appOrder.getOrgCode())){
|
|
|
+ log.error("微信支付成功通知成功,订单属于未知机构,通知失败");
|
|
|
+ return stringStringMap;
|
|
|
+ }
|
|
|
+ if (appOrder.getType()!=null&&appOrder.getType()!=2){
|
|
|
+ BigDecimal priceSum= appOrderProInfoMapper.findByOrderId(appOrder.getId());
|
|
|
+ if (priceSum==null||priceSum.compareTo(BigDecimal.ZERO)==0){
|
|
|
+ log.error("微信支付成功通知成功,订单明细订单金额为0,不进行分账,orderId:"+appOrder.getId());
|
|
|
+ return stringStringMap;
|
|
|
+ }
|
|
|
+// sysDepartMapper.findByOrgCodeAndParentId();
|
|
|
+ log.info("支付成功消息通知,订单信息:"+JSONObject.toJSONString(appOrder));
|
|
|
+ ReceiptPaymentDetailsInfoVo receiptPaymentDetailsInfoVo = new ReceiptPaymentDetailsInfoVo();
|
|
|
+ iReceiptPaymentDetailsInfoService.add(receiptPaymentDetailsInfoVo);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return stringStringMap;
|
|
|
}
|
|
|
|
|
|
/**
|