1. 分账金额分为骑行费,调度费

2. 修改电子围栏时删除了
This commit is contained in:
邱贞招 2024-05-31 15:11:26 +08:00
parent 94e4f9d58f
commit df72b33023
3 changed files with 28 additions and 9 deletions

View File

@ -196,6 +196,7 @@ public class CallbackServiceImpl implements CallbackService {
TimerTask task = new TimerTask() {
@Override
public void run() {
logger.info("【微信支付回调】开始请求分账------------");
// 请求分账
List<CreateOrderReceiver> receivers = new ArrayList<>();
// 获取到合伙人的openid
@ -203,14 +204,20 @@ public class CallbackServiceImpl implements CallbackService {
sysUser.setUserType("03");
sysUser.setAreaId(area.getAreaId());
List<SysUser> sysUsers = userMapper.selectUserList(sysUser);
BigDecimal totalFee = order.getTotalFee();
BigDecimal dividendAmount = BigDecimal.ZERO;
for (SysUser sysUser1 : sysUsers){
AsUser asUser1 = userService.selectUserById(sysUser1.getAppUserId());
if(asUser1!=null && asUser1.getWxopenid()!=null){
CreateOrderReceiver receiver = new CreateOrderReceiver();
receiver.setType(ReceiverType.PERSONAL_OPENID.name());
receiver.setAccount(asUser1.getWxopenid());
BigDecimal multiply = totalFee.multiply(new BigDecimal(sysUser1.getDividendProportion()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)).multiply(new BigDecimal(100));
String dividendItem = sysUser1.getDividendItem();
if(dividendItem.contains("1")){
dividendAmount.add(order.getRidingFee().add(order.getAppointmentFee()));//1-骑行费骑行费+预约费
}else if(dividendItem.contains("2")){
dividendAmount.add(order.getManageFee().add(order.getManageFee()));//2-调度费调度费+管理费
}
BigDecimal multiply = dividendAmount.multiply(new BigDecimal(sysUser1.getDividendProportion()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP)).multiply(new BigDecimal(100));
logger.info(sysUser1.getUserName()+"分账比例:"+sysUser1.getDividendProportion()+"%,分账金额:"+multiply);
receiver.setAmount(multiply.longValue());
receiver.setDescription("系统自动分账");
@ -226,7 +233,7 @@ public class CallbackServiceImpl implements CallbackService {
}
}
};
timer.schedule(task, new Date(System.currentTimeMillis() + 30000));
timer.schedule(task, new Date(System.currentTimeMillis() + 30000));// 30秒后发起分账
}else if(attachVo.getType().equals(ServiceConstants.BUSINESS_TYPE_APPOINTMENT)){
logger.info("【微信支付回调】取消预约支付");
// 2-取消预约支付

View File

@ -138,12 +138,14 @@ public class EtOperatingAreaServiceImpl extends ServiceImpl<EtOperatingAreaMappe
Geometry geometry = GeoUtils.toGeometry(boundaryStr);
String wkt = GeoUtils.wkt(geometry);
etOperatingArea.setBoundary(wkt);
etAreaRuleMapper.deleteAreaRuleByAreaId(etOperatingArea.getAreaId());
int i = dao.updateById(etOperatingArea);
Long[] ruleIds = etOperatingArea.getRuleIds();
if(ObjectUtil.isNotNull(ruleIds)){
for (Long ruleId:ruleIds){
etAreaRuleMapper.insert(EtAreaRule.builder().areaId(etOperatingArea.getAreaId()).ruleId(ruleId).build());
etAreaRuleMapper.deleteAreaRuleByAreaId(etOperatingArea.getAreaId());
if(ObjectUtil.isNotNull(ruleIds)){
for (Long ruleId:ruleIds){
etAreaRuleMapper.insert(EtAreaRule.builder().areaId(etOperatingArea.getAreaId()).ruleId(ruleId).build());
}
}
}
return i;

View File

@ -1,5 +1,6 @@
package com.ruoyi.system.task;
import com.alibaba.fastjson2.JSON;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.constant.ServiceConstants;
import com.ruoyi.common.core.domain.entity.SysUser;
@ -93,9 +94,18 @@ public class EtTask {
etDividendDetail.setTotalAmount(order1.getTotalFee());
etDividendDetail.setCreateTime(DateUtils.getNowDate());
etDividendDetail.setDividendProportion(user.getDividendProportion());
// todo 分账金额是骑行费还是调度费看分账项目
etDividendDetail.setDividendAmount(order1.getTotalFee().multiply(new BigDecimal(user.getDividendProportion()).divide(new BigDecimal(100),2, BigDecimal.ROUND_HALF_UP)));
etDividendDetail.setDividendItem(user.getDividendItem());
String dividendItem = user.getDividendItem();
// todo 分账金额是骑行费还是调度费看分账项目 分账项目1-骑行费骑行费+预约费2-调度费调度费+管理费
BigDecimal dividendAmount = BigDecimal.ZERO;
if(dividendItem.contains("1")){
dividendAmount.add(order1.getRidingFee().add(order1.getAppointmentFee()));//1-骑行费骑行费+预约费
}else if(dividendItem.contains("2")){
dividendAmount.add(order1.getManageFee().add(order1.getManageFee()));//2-调度费调度费+管理费
}
BigDecimal divide = new BigDecimal(user.getDividendProportion()).divide(new BigDecimal(100), 2, BigDecimal.ROUND_HALF_UP);
etDividendDetail.setDividendAmount(dividendAmount.multiply(divide));
etDividendDetail.setDividendItem(dividendItem);
log.info("保存分账明细 === " + JSON.toJSONString(etDividendDetail));
int i = dividendDetailService.insertEtDividendDetail(etDividendDetail);
if(i==0){
throw new ServiceException("保存分账明细失败");