|
@@ -44,6 +44,7 @@ import org.jeecg.modules.system.app.dto.receiptPaymentDetails.ReceiptPaymentDeta
|
|
|
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.SysDepart;
|
|
|
import org.jeecg.modules.system.entity.SysUser;
|
|
|
import org.jeecg.modules.system.mapper.SysDepartMapper;
|
|
|
import org.jeecg.modules.system.mapper.SysUserMapper;
|
|
@@ -129,6 +130,9 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
|
|
|
@Autowired
|
|
|
SysDepartMapper sysDepartMapper;
|
|
|
+ @Autowired
|
|
|
+ SeparateAccountsMapper separateAccountsMapper;
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@@ -1588,8 +1592,6 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
&& stringStringMap.containsKey("orderCode")
|
|
|
){
|
|
|
String orderCode = stringStringMap.get("orderCode");
|
|
|
-
|
|
|
-
|
|
|
if(StringUtils.isEmpty(orderCode)){
|
|
|
log.error("微信支付成功通知成功,订单编号为空,通知失败:"+JSONObject.toJSONString(stringStringMap));
|
|
|
throw new JeecgBootException("微信支付成功通知成功,订单编号为空,通知失败");
|
|
@@ -1599,7 +1601,7 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
log.error("微信支付成功通知成功,订单未查询到,通知失败:"+JSONObject.toJSONString(stringStringMap));
|
|
|
throw new JeecgBootException("微信支付成功通知成功,订单未查询到,通知失败");
|
|
|
}
|
|
|
- log.info("订单信息:"+JSONObject.toJSONString(appOrder));
|
|
|
+ log.info("支付成功消息通知,订单信息:"+JSONObject.toJSONString(appOrder));
|
|
|
if (StringUtils.isEmpty(appOrder.getOrgCode())){
|
|
|
log.error("微信支付成功通知成功,订单属于未知机构,通知失败");
|
|
|
return stringStringMap;
|
|
@@ -1610,16 +1612,50 @@ public class OrderServiceImpl implements IOrderService {
|
|
|
log.error("微信支付成功通知成功,订单明细订单金额为0,不进行分账,orderId:"+appOrder.getId());
|
|
|
return stringStringMap;
|
|
|
}
|
|
|
-// sysDepartMapper.findByOrgCodeAndParentId();
|
|
|
- log.info("支付成功消息通知,订单信息:"+JSONObject.toJSONString(appOrder));
|
|
|
- ReceiptPaymentDetailsInfoVo receiptPaymentDetailsInfoVo = new ReceiptPaymentDetailsInfoVo();
|
|
|
- iReceiptPaymentDetailsInfoService.add(receiptPaymentDetailsInfoVo);
|
|
|
+ SysDepart sysDepart= sysDepartMapper.findByOrgCodeAndParentId(appOrder.getOrgCode());
|
|
|
+ if (sysDepart==null){
|
|
|
+ log.error("微信支付成功通知成功,未查询到部门信息,该订单属于未知订单");
|
|
|
+ return stringStringMap;
|
|
|
+ }
|
|
|
+ SeparateAccounts separateAccounts = separateAccountsMapper.findByDeptIdAndStatus(sysDepart.getId());
|
|
|
+ ReceiptPaymentDetailsInfoVo receiptPaymentDetailsInfoVoMd = new ReceiptPaymentDetailsInfoVo();
|
|
|
+ receiptPaymentDetailsInfoVoMd.setMoney(priceSum);
|
|
|
+ receiptPaymentDetailsInfoVoMd.setPayType(0);
|
|
|
+ receiptPaymentDetailsInfoVoMd.setPurseChangeReason(0);
|
|
|
+ receiptPaymentDetailsInfoVoMd.setCreateTime(new Date());
|
|
|
+ receiptPaymentDetailsInfoVoMd.setUpdateTime(new Date());
|
|
|
+ receiptPaymentDetailsInfoVoMd.setOrderId(appOrder.getId());
|
|
|
+ if (separateAccounts==null){
|
|
|
+ //需要按照默认比例分账 -暂时未处理。
|
|
|
+ log.error("微信支付成功通知成功,未查询到分账信息,不进行分账");
|
|
|
+ return stringStringMap;
|
|
|
+ }
|
|
|
+
|
|
|
+ log.info("支付成功消息通知,门店添加明细:"+JSONObject.toJSONString(receiptPaymentDetailsInfoVoMd));
|
|
|
+ iReceiptPaymentDetailsInfoService.add(receiptPaymentDetailsInfoVoMd);
|
|
|
}
|
|
|
|
|
|
}
|
|
|
return stringStringMap;
|
|
|
}
|
|
|
|
|
|
+ private void getReceiptPaymentDetailsInfoVo(ReceiptPaymentDetailsInfoVo receiptPaymentDetailsInfoVo,BigDecimal proportion,String orgCode,String deptId,Integer deptType,BigDecimal priceSum){
|
|
|
+ receiptPaymentDetailsInfoVo.setOrgCode(orgCode);
|
|
|
+ receiptPaymentDetailsInfoVo.setDeptId(deptId);
|
|
|
+ receiptPaymentDetailsInfoVo.setDeptType(deptType);
|
|
|
+ if (proportion==null){
|
|
|
+ receiptPaymentDetailsInfoVo.setChangeMoney(BigDecimal.ZERO);
|
|
|
+ }else{
|
|
|
+ if (proportion.compareTo(BigDecimal.ZERO)==0){
|
|
|
+ receiptPaymentDetailsInfoVo.setChangeMoney(BigDecimal.ZERO);
|
|
|
+ }else {
|
|
|
+
|
|
|
+ receiptPaymentDetailsInfoVo.setChangeMoney();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* @return String 订单号
|
|
|
* @Author SheepHy
|