提交 7888bcd8 作者: 张小凤

Requi(update)

上级 01c83a8d
...@@ -1254,7 +1254,6 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -1254,7 +1254,6 @@ public class RequirementsServiceImpl implements RequirementsService {
if (i!=0){ if (i!=0){
return ResultBody.error("请勿重复判定"); return ResultBody.error("请勿重复判定");
} }
requirementsDao.customerServiceIntervention(liabilityProblemVO); requirementsDao.customerServiceIntervention(liabilityProblemVO);
//双方无责 //双方无责
...@@ -1317,14 +1316,16 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -1317,14 +1316,16 @@ public class RequirementsServiceImpl implements RequirementsService {
} }
//发布者责任 //发布者责任
if (liabilityProblemVO.getDuty().equals(2)){ if (liabilityProblemVO.getDuty().equals(2)){
publisherCancel(liabilityProblemVO.getRequirementsInfoId(),requirementsInfoDO.getUserAccountId(),request); // publisherCancel(liabilityProblemVO.getRequirementsInfoId(),requirementsInfoDO.getUserAccountId(),request);
publisherCancelDuty(liabilityProblemVO.getRequirementsInfoId(),requirementsInfoDO.getUserAccountId(),request);
requirementsDao.updateInfo(liabilityProblemVO.getRequirementsInfoId(), 7); requirementsDao.updateInfo(liabilityProblemVO.getRequirementsInfoId(), 7);
requirementsDao.updateScene(liabilityProblemVO.getRequirementsInfoId(), 7); requirementsDao.updateScene(liabilityProblemVO.getRequirementsInfoId(), 7);
return ResultBody.success(); return ResultBody.success();
} }
//飞手责任 //飞手责任
if (liabilityProblemVO.getDuty().equals(3)){ if (liabilityProblemVO.getDuty().equals(3)){
droneFlyerCancel(liabilityProblemVO.getRequirementsInfoId(),requirementsServiceDO.getPilotCertificationUserId(),request); // droneFlyerCancel(liabilityProblemVO.getRequirementsInfoId(),requirementsServiceDO.getPilotCertificationUserId(),request);
droneFlyerCancelDuty(liabilityProblemVO.getRequirementsInfoId(),requirementsServiceDO.getPilotCertificationUserId(),request);
requirementsDao.updateInfo(liabilityProblemVO.getRequirementsInfoId(), 7); requirementsDao.updateInfo(liabilityProblemVO.getRequirementsInfoId(), 7);
requirementsDao.updateScene(liabilityProblemVO.getRequirementsInfoId(), 7); requirementsDao.updateScene(liabilityProblemVO.getRequirementsInfoId(), 7);
return ResultBody.success(); return ResultBody.success();
...@@ -1332,6 +1333,306 @@ public class RequirementsServiceImpl implements RequirementsService { ...@@ -1332,6 +1333,306 @@ public class RequirementsServiceImpl implements RequirementsService {
return ResultBody.success(); return ResultBody.success();
} }
public ResultBody publisherCancelDuty(Integer requirementsInfoId, Integer userAccountId, HttpServletRequest request){
RequirementsInfoDO requirementsInfoDO = requirementsDao.publisherCancel(requirementsInfoId, userAccountId);
RequirementsServiceDO serviceDO = requirementsDao.serviceReq(requirementsInfoId);
if (serviceDO != null) {
IsNullConvertZeroUtil.checkIsNull(serviceDO);
}
if (requirementsInfoDO == null) {
return ResultBody.error("当前订单不存在");
}
if (requirementsInfoDO.getServiceFlowId() == 7) {
return ResultBody.error("已取消请不要重复取消");
}
IsNullConvertZeroUtil.checkIsNull(requirementsInfoDO);
Integer serviceFlowId = requirementsInfoDO.getServiceFlowId();
ApplyRefundVO applyRefundVO = new ApplyRefundVO();
WalletFlowVO walletFlowVO = new WalletFlowVO();
PublisherWalletFlowVO publisherWalletFlowVO = new PublisherWalletFlowVO();
FlyerWalletFlowVO flyerWalletFlowVO = new FlyerWalletFlowVO();
IsNullConvertZeroUtil.checkIsNull(publisherWalletFlowVO);
IsNullConvertZeroUtil.checkIsNull(flyerWalletFlowVO);
BigDecimal orderAmount = requirementsInfoDO.getOrderAmount();
BigDecimal bigDecimal = new BigDecimal(0.7);
//剩余金额
BigDecimal residueOrderAmount = orderAmount.multiply(bigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP);
//先退微信 再退任务佣金 最后退云享金
BigDecimal weChat = requirementsInfoDO.getWeChat();
//微信需要退款多少金额
//微信金额大于扣除之后的金额
BigDecimal refundCashAmount = new BigDecimal(0);
BigDecimal refundSalaryAmount = new BigDecimal(0);
BigDecimal refundWeChat = new BigDecimal(0);
//飞手获得的金额
BigDecimal receiveSalaryAmount = orderAmount.multiply(new BigDecimal(0.2)).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal freeze = orderAmount.multiply(new BigDecimal(0.3)).setScale(2, BigDecimal.ROUND_HALF_UP);
//微信支付金额大于需要退款金额
if (weChat.compareTo(residueOrderAmount) == 1) {
//云享金扣除多少
// publisherWalletFlowVO.setCashAmount(requirementsInfoDO.getCashAmount().negate());
//佣金扣除多少
// publisherWalletFlowVO.setSalaryAmount(requirementsInfoDO.getSalaryAmount().negate());
//违约云享金多少
publisherWalletFlowVO.setYxjCashPledge(requirementsInfoDO.getCashAmount().negate());
//违约佣金
publisherWalletFlowVO.setSalaryCashPledge(requirementsInfoDO.getSalaryAmount().negate());
//用户退百分之七十的费用
refundWeChat = residueOrderAmount;
BigDecimal multiply = refundWeChat.multiply(new BigDecimal(100));
Long longWeChat = multiply.longValue();
applyRefundVO.setRefund(longWeChat);
applyRefundVO.setReason("扣除飞手百分之三十的费用");
applyRefundVO.setOutTradeNo(requirementsInfoDO.getWechatPayOrderNumber());
//退款到微信
applyRefund(applyRefundVO, request.getHeader("token"));
}
//微信支付金额小于需要退款金额
if (weChat.compareTo(residueOrderAmount) == -1 ||
weChat.compareTo(refundCashAmount) == 0) {
//优先扣除微信里面的钱
BigDecimal returnToWechat = residueOrderAmount.subtract(requirementsInfoDO.getWeChat());
BigDecimal residueAmount = new BigDecimal(0);
if (returnToWechat.compareTo(requirementsInfoDO.getSalaryAmount()) == 1) {
//退回佣金
residueAmount = returnToWechat.subtract(requirementsInfoDO.getSalaryAmount());
publisherWalletFlowVO.setSalaryAmount(requirementsInfoDO.getSalaryAmount());
publisherWalletFlowVO.setCashAmount(residueAmount);
publisherWalletFlowVO.setYxjCashPledge(requirementsInfoDO.getCashAmount().subtract(residueAmount).negate());
}
if (returnToWechat.compareTo(requirementsInfoDO.getSalaryAmount()) == 0) {
publisherWalletFlowVO.setSalaryAmount(returnToWechat);
}
//如果退回的佣金小于支付的佣金
if (returnToWechat.compareTo(requirementsInfoDO.getSalaryAmount()) == -1) {
residueAmount = requirementsInfoDO.getSalaryAmount().subtract(returnToWechat);
//one
publisherWalletFlowVO.setSalaryAmount(requirementsInfoDO.getSalaryAmount().subtract(residueAmount));
publisherWalletFlowVO.setSalaryCashPledge(residueAmount.negate());
//修改2
//修改三
if (residueAmount.compareTo(BigDecimal.ZERO) == 1) {
publisherWalletFlowVO.setYxjCashPledge(requirementsInfoDO.getCashAmount().negate());
}
}
//如果退回佣金等于0
if (residueAmount.compareTo(BigDecimal.ZERO) == 0) {
publisherWalletFlowVO.setYxjCashPledge(requirementsInfoDO.getCashAmount().negate());
}
if (residueAmount.compareTo(BigDecimal.ZERO) == -1) {
publisherWalletFlowVO.setUserAccountId(userAccountId);
publisherWalletFlowVO.setOperateUserAccountId(userAccountId);
publisherWalletFlowVO.setModeOfPayment(300);
publisherWalletFlowVO.setSalaryAmount(residueAmount.negate());
System.out.println(residueAmount);
BigDecimal subtract = requirementsInfoDO.getSalaryAmount().subtract(residueAmount.negate());
publisherWalletFlowVO.setSalaryCashPledge(subtract.negate());
publisherWalletFlowVO.setYxjCashPledge(requirementsInfoDO.getCashAmount().negate());
// BigDecimal subtract = requirementsInfoDO.getSalaryAmount().subtract(residueAmount.negate());
// publisherWalletFlowVO.setSalaryCashPledge(subtract.negate());
walletFlowVO.setPublisherWalletFlowVO(publisherWalletFlowVO);
//flyerCancel(walletFlowVO, request.getHeader("token"));
//退回的佣金大于0
} else if (residueAmount.compareTo(BigDecimal.ZERO) == 1) {
// publisherWalletFlowVO.setCashAmount(residueAmount);
publisherWalletFlowVO.setUserAccountId(userAccountId);
publisherWalletFlowVO.setOperateUserAccountId(userAccountId);
publisherWalletFlowVO.setModeOfPayment(300);
walletFlowVO.setPublisherWalletFlowVO(publisherWalletFlowVO);
//退回任务佣金
//flyerCancel(walletFlowVO, request.getHeader("token"));
}
BigDecimal weChatAmount = requirementsInfoDO.getWeChat();
long longWeChat = weChatAmount.multiply(new BigDecimal(100)).longValue();
applyRefundVO.setRefund(longWeChat);
applyRefundVO.setReason("退回方式——微信佣金云享金");
applyRefundVO.setOutTradeNo(requirementsInfoDO.getWechatPayOrderNumber());
applyRefund(applyRefundVO, request.getHeader("token"));
}
//平台抽取百分之十
//发布者取消
BigDecimal earnings = orderAmount.multiply(new BigDecimal(0.1)).setScale(2, BigDecimal.ROUND_HALF_UP);
BigDecimal orderEarnings = requirementsInfoDO.getOrderEarnings();
BigDecimal add = orderEarnings.add(earnings);
requirementsInfoDO.setOrderEarnings(add);
requirementsDao.updateRequirementsAmount(requirementsInfoDO);
// requirementsDao.insertPlatformOrderEarnings(earnings, requirementsInfoId, userAccountId);
requirementsDao.updatePlatformOrderEarnings(earnings, requirementsInfoId, userAccountId);
if (serviceDO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 ||
serviceDO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0 ||
serviceDO.getWeChat().compareTo(BigDecimal.ZERO) != 0) {
System.out.println(freeze);
//优先扣除微信
BigDecimal weChat1 = requirementsInfoDO.getWeChat();
//如果微信扣除的金额小于飞手获得的钱
if (weChat1.compareTo(freeze) == -1) {
//还需要扣除多少
BigDecimal subtract = freeze.subtract(weChat1);
if (subtract.compareTo(requirementsInfoDO.getSalaryAmount()) == 1) {
publisherWalletFlowVO.setSalaryCashPledge(requirementsInfoDO.getSalaryAmount().negate());
BigDecimal subtract1 = subtract.subtract(requirementsInfoDO.getSalaryAmount());
if (subtract1.compareTo(BigDecimal.ZERO) == 0 || subtract1.compareTo(BigDecimal.ZERO) == 1) {
publisherWalletFlowVO.setYxjCashPledge(subtract1.negate());
}
}
if (subtract.compareTo(requirementsInfoDO.getSalaryAmount()) == -1) {
//update
if (requirementsInfoDO.getCashAmount().compareTo(BigDecimal.ZERO) == 0) {
publisherWalletFlowVO.setSalaryCashPledge(subtract.negate());
}
if (requirementsInfoDO.getCashAmount().compareTo(BigDecimal.ZERO) != 0) {
BigDecimal subtract1 = requirementsInfoDO.getCashAmount().subtract(publisherWalletFlowVO.getCashAmount());
publisherWalletFlowVO.setYxjCashPledge(subtract1.negate());
}
//publisherWalletFlowVO.setYxjCashPledge(subtract.negate());
}
}
//飞手应该获得的金额
publisherWalletFlowVO.setUserAccountId(userAccountId);
publisherWalletFlowVO.setOperateUserAccountId(userAccountId);
publisherWalletFlowVO.setModeOfPayment(300);
publisherWalletFlowVO.setPercentagePenaltyOfOrder(receiveSalaryAmount.negate());
flyerWalletFlowVO.setCashAmount(serviceDO.getCashAmount());
flyerWalletFlowVO.setSalaryAmount(serviceDO.getSalaryAmount());
flyerWalletFlowVO.setUserAccountId(requirementsInfoDO.getPilotCertificationUserId());
flyerWalletFlowVO.setOperateUserAccountId(userAccountId);
flyerWalletFlowVO.setModeOfPayment(300);
walletFlowVO.setPublisherWalletFlowVO(publisherWalletFlowVO);
walletFlowVO.setFlyerWalletFlowVO(flyerWalletFlowVO);
String s = String.valueOf(walletFlowVO);
log.info(s);
flyerCancel(walletFlowVO, request.getHeader("token"));
}
//飞手全额退款
if (serviceDO.getWechatPayOrderNumber() != null) {
ApplyRefundVO arv = new ApplyRefundVO();
arv.setReason("全额退款");
arv.setRefund(serviceDO.getWeChat().multiply(new BigDecimal(100)).longValue());
arv.setOutTradeNo(serviceDO.getWechatPayOrderNumber());
applyRefund(arv, request.getHeader("token"));
}
requirementsInfoDO.setReceiveSalaryAmount(receiveSalaryAmount);
//给飞手发送短信
this.sendMsgFlyerInfoAuth(requirementsInfoDO);
requirementsDao.updateInfo(requirementsInfoId, 7);
requirementsDao.updateFlow(requirementsInfoId, 7);
return ResultBody.success(ResultEnum.REFUND_PERCENTAGE.getResultMsg());
}
public ResultBody droneFlyerCancelDuty(Integer requirementsInfoId, Integer userAccountId, HttpServletRequest request){
RequirementsInfoDO infoDO = requirementsDao.publisherCancelFlyer(requirementsInfoId);
RequirementsServiceDO requirementsServiceDO = requirementsDao.droneFlyerCancel(requirementsInfoId, userAccountId);
IsNullConvertZeroUtil.checkIsNull(requirementsServiceDO);
Integer serviceFlowId = requirementsServiceDO.getServiceFlowId();
BigDecimal bigDecimal = new BigDecimal(0.9);
BigDecimal preemptTotalAmount = requirementsServiceDO.getPreemptTotalAmount();
BigDecimal percentagePenaltyOfOrder = preemptTotalAmount.multiply(bigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP);
//平台抽取百分之十
BigDecimal earnings = preemptTotalAmount.multiply(new BigDecimal(0.1)).setScale(2, BigDecimal.ROUND_HALF_UP);
WalletFlowVO walletFlowVO = new WalletFlowVO();
FlyerWalletFlowVO flyerWalletFlowVO = new FlyerWalletFlowVO();
IsNullConvertZeroUtil.checkIsNull(flyerWalletFlowVO);
IsNullConvertZeroUtil.checkIsNull(walletFlowVO);
PublisherWalletFlowVO publisherWalletFlowVO = new PublisherWalletFlowVO();
IsNullConvertZeroUtil.checkIsNull(publisherWalletFlowVO);
IsNullConvertZeroUtil.checkIsNull(walletFlowVO);
flyerWalletFlowVO.setModeOfPayment(600);
flyerWalletFlowVO.setPercentagePenaltyOfOrder(percentagePenaltyOfOrder.negate());
flyerWalletFlowVO.setUserAccountId(userAccountId);
flyerWalletFlowVO.setOperateUserAccountId(userAccountId);
//如果微信里面的钱大于需要扣除的钱
/* if (requirementsServiceDO.getWeChat().compareTo(preemptTotalAmount) == 1 ||
requirementsServiceDO.getWeChat().compareTo(preemptTotalAmount) == 0) {
//
}*/
//如果微信里面的钱小于需要扣除的金额
if (requirementsServiceDO.getWeChat().compareTo(preemptTotalAmount) == -1) {
//优先扣除微信的钱
BigDecimal subtract = preemptTotalAmount.subtract(requirementsServiceDO.getWeChat());
if (requirementsServiceDO.getSalaryAmount().compareTo(subtract) == -1) {
BigDecimal sub2 = subtract.subtract(requirementsServiceDO.getSalaryAmount());
flyerWalletFlowVO.setSalaryCashPledge(requirementsServiceDO.getSalaryAmount().negate());
if (sub2.compareTo(requirementsServiceDO.getCashAmount()) == 0 ||
sub2.compareTo(requirementsServiceDO.getCashAmount()) == -1) {
//云享金扣除违约多少
flyerWalletFlowVO.setYxjCashPledge(sub2.negate());
}
} else if (requirementsServiceDO.getSalaryAmount().compareTo(subtract) == 1 ||
requirementsServiceDO.getSalaryAmount().compareTo(subtract) == 0) {
flyerWalletFlowVO.setSalaryCashPledge(subtract.negate());
}
}
walletFlowVO.setFlyerWalletFlowVO(flyerWalletFlowVO);
//给发布者退钱
publisherWalletFlowVO.setUserAccountId(infoDO.getUserAccountId());
publisherWalletFlowVO.setModeOfPayment(600);
publisherWalletFlowVO.setOperateUserAccountId(userAccountId);
publisherWalletFlowVO.setSalaryAmount(infoDO.getSalaryAmount());
publisherWalletFlowVO.setCashAmount(infoDO.getCashAmount());
//退云享金和佣金
if (infoDO.getOrderLevel().equals("RUSH_ORDER")) {
publisherWalletFlowVO.setUrgentYxjAmount(infoDO.getLevelCashAmount());
publisherWalletFlowVO.setUrgentSalaryAmount(infoDO.getLevelSalaryAmount());
}
if (infoDO.getOrderLevel().equals("TOP_ORDER")) {
publisherWalletFlowVO.setTopYxjAmount(infoDO.getLevelCashAmount());
publisherWalletFlowVO.setTopSalaryAmount(infoDO.getLevelSalaryAmount());
}
walletFlowVO.setPublisherWalletFlowVO(publisherWalletFlowVO);
//给发布者微信退钱
String wechatPayOrderNumber = infoDO.getWechatPayOrderNumber();
if (wechatPayOrderNumber != null) {
ApplyRefundVO applyRefundVO = new ApplyRefundVO();
BigDecimal weChat = infoDO.getWeChat();
BigDecimal levelWeChatAmount = infoDO.getLevelWeChatAmount();
BigDecimal add = weChat.add(levelWeChatAmount);
long longValue = add.multiply(new BigDecimal(100)).longValue();
applyRefundVO.setRefund(longValue);
applyRefundVO.setReason("退回微信支付金额");
applyRefundVO.setOutTradeNo(infoDO.getWechatPayOrderNumber());
applyRefund(applyRefundVO, request.getHeader("token"));
}
IsNullConvertZeroUtil.checkIsNull(infoDO);
//任务佣金
requirementsServiceDO.setPercentagePenaltyOfOrder(percentagePenaltyOfOrder);
//飞手单方面取消将20之二十退回到发布者佣金里面
flyerCancel(walletFlowVO, request.getHeader("token"));
requirementsServiceDO.setOrderEarnings(new BigDecimal(0));
BigDecimal orderEarnings = requirementsServiceDO.getOrderEarnings();
BigDecimal add = orderEarnings.add(earnings);
requirementsServiceDO.setOrderEarnings(add);
requirementsServiceDO.setRequirementsInfoId(requirementsServiceDO.getId());
requirementsDao.updateAmounts(requirementsServiceDO);
// requirementsDao.insertPlatformOrderEarnings(earnings, requirementsInfoId, userAccountId);
requirementsDao.updatePlatformOrderEarnings(earnings, requirementsInfoId, userAccountId);
requirementsDao.updateScene(requirementsInfoId, 7);
requirementsDao.updateInfo(requirementsInfoId, 7);
requirementsDao.updateFlow(requirementsInfoId, 7);
this.sendMsgPublishInfoAuth(requirementsServiceDO);
return ResultBody.success(ResultEnum.PAYMENT_SUCCESS.getResultMsg());
}
/** /**
* 给发布者发信息 * 给发布者发信息
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论