提交 d2bf82b5 作者: 张小凤

Require(update)

上级 f07e4d56
package com.mmc.csf.config;
import java.lang.annotation.*;
/**
* @Author small
* @Date 2023/8/23 14:16
* @Version 1.0
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface IsNullConvertZero {
}
package com.mmc.csf.config;
import lombok.extern.slf4j.Slf4j;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import java.util.Objects;
/**
* @Author small
* @Date 2023/8/23 14:16
* @Version 1.0
*/
@Slf4j
public class IsNullConvertZeroUtil {
public static Object checkIsNull(Object obj) {
try {
Class<?> clazz = obj.getClass();
//获得私有的成员属性
Field[] fields = clazz.getDeclaredFields();
if (Objects.nonNull(fields) && fields.length > 0) {
for (Field field : fields) {
field.setAccessible(true);
//判断IsNullConvertZero注解是否存在
if (field.isAnnotationPresent(IsNullConvertZero.class)) {
if (Objects.isNull(field.get(obj))) {
field.set(obj, BigDecimal.ZERO);
}
}
}
}
} catch (Exception e) {
log.error("IsNullConvertZeroUtil出现异常:{}", e);
}
return obj;
}
}
package com.mmc.csf.infomation.dto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.mmc.csf.config.IsNullConvertZero;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
......@@ -30,6 +31,7 @@ public class GetOrderNumberDTO implements Serializable {
private String paymentOrderNumber;
@ApiModelProperty(value = "微信需要支付金额", example = "100")
@IsNullConvertZero
private BigDecimal weChatPay;
@JsonIgnore
......
package com.mmc.csf.infomation.vo;
import com.mmc.csf.config.IsNullConvertZero;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Author small
* @Date 2023/8/23 9:44
* @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class FlyerWalletFlowVO {
@ApiModelProperty(value = "用户ID")
private Integer userAccountId;
@ApiModelProperty(value = "支付方式 100(订单发布) 200(无人接单取消订单)300(有人接单取消订单)400(飞手抢单)500(客服判定飞手无责取消订单)600(飞手有责取消订单)700(正常结算)800(修改订单金额状态)900(飞手未确认修改金额状态)1000(飞手确认修改金额状态)")
private Integer modeOfPayment;
@ApiModelProperty(value = "云享金(需要正负)")
@IsNullConvertZero
private BigDecimal cashAmount;
@ApiModelProperty(value = "佣金(需要正负)")
@IsNullConvertZero
private BigDecimal salaryAmount;
@ApiModelProperty(value = "支付时间")
private Date timeOfPayment;
@ApiModelProperty(value = "操作者用户id")
private Integer operateUserAccountId;
@ApiModelProperty(value = "云享金违约金(需要正负)")
@IsNullConvertZero
private BigDecimal yxjCashPledge;
@ApiModelProperty(value = "佣金违约金(需要正负)")
@IsNullConvertZero
private BigDecimal salaryCashPledge;
@ApiModelProperty(value = "订单的百分比违约金(这笔钱是给发布方的)")
@IsNullConvertZero
private BigDecimal percentagePenaltyOfOrder;
}
package com.mmc.csf.infomation.vo;
import com.mmc.csf.release.model.group.Insert;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
......@@ -21,12 +19,13 @@ import java.math.BigDecimal;
@Builder
public class GetOrderNumberVO {
@ApiModelProperty(value = "订单金额", example = "100", required = true)
@NotNull(message = "订单金额", groups = {Insert.class})
@ApiModelProperty(value = "订单金额", example = "100.00", required = true)
//@NotNull(message = "订单金额", groups = {Insert.class})
//@DecimalMin(value = "100.00", message = "amount格式不正确")
private BigDecimal orderAmount;
@ApiModelProperty(value = "订单级别 todo:前端传英文,后台自己获取金额 订单级别(REGULAR_ORDER,RUSH_ORDER,TOP_ORDER)", example = "REGULAR_ORDER", required = true)
@NotNull(message = "订单级别", groups = {Insert.class})
@ApiModelProperty(value = "订单级别 todo:前端传英文,后台自己获取金额 订单级别(REGULAR_ORDER,RUSH_ORDER,TOP_ORDER) 注意抢单的时候传固定的普通支付 REGULAR_ORDER", example = "REGULAR_ORDER", required = true)
// @NotNull(message = "订单级别", groups = {Insert.class})
private OrderLevelEnum orderLevelEnum;
......@@ -47,5 +46,7 @@ public class GetOrderNumberVO {
@ApiModelProperty(value = "订单方式 发布订单:1 ,抢单:2", example = "1", required = true)
private Integer orderMode;
@ApiModelProperty(value = "抢单时需要知道抢单的那个订单", example = "1")
private Integer requirementsInfoId;
}
......@@ -39,8 +39,8 @@ public class GrabTheOrderVO {
@ApiModelProperty(value = "微信金额", example = "10", hidden = true)
private BigDecimal weChat;
@ApiModelProperty(value = "发布者任务编号", example = "R202308192201279509820")
private String publisherNumber;
@ApiModelProperty(value = "抢单id", example = "1")
private Integer requirementsInfoId;
@JsonIgnore
private Integer userAccountId;
......
package com.mmc.csf.infomation.vo;
import com.mmc.csf.config.IsNullConvertZero;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
/**
* @Author small
* @Date 2023/8/23 9:43
* @Version 1.0
*/
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PublisherWalletFlowVO {
@ApiModelProperty(value = "用户ID")
@NotNull
private Integer userAccountId;
@ApiModelProperty(value = "支付方式 100(订单发布) 200(无人接单取消订单)300(有人接单取消订单)400(飞手抢单)500(客服判定飞手无责取消订单)" +
"600(飞手有责取消订单)700(正常结算)800(修改订单金额状态)900(飞手未确认修改金额状态)1000(飞手确认修改金额状态)")
private Integer modeOfPayment;
@ApiModelProperty(value = "云享金(需要正负)注:结算时修改金额如果大于原订单,需要支付的云享金,也传这个字段")
@IsNullConvertZero
private BigDecimal cashAmount;
@ApiModelProperty(value = "佣金(需要正负)注:结算时修改金额如果大于原订单,需要支付的佣金,也传这个字段")
@IsNullConvertZero
private BigDecimal salaryAmount;
@ApiModelProperty(value = "支付时间")
private Date timeOfPayment;
@ApiModelProperty(value = "操作者用户id")
@NotNull
private Integer operateUserAccountId;
@ApiModelProperty(value = "云享金违约金(需要正负)")
@IsNullConvertZero
private BigDecimal yxjCashPledge;
@ApiModelProperty(value = "佣金违约金(需要正负)")
@IsNullConvertZero
private BigDecimal salaryCashPledge;
@ApiModelProperty(value = "订单的百分比违约金(这笔钱是给飞手的) (需要正负)")
@IsNullConvertZero
private BigDecimal percentagePenaltyOfOrder;
@ApiModelProperty(value = "加急单云享金金额 (需要正负)")
@IsNullConvertZero
private BigDecimal urgentYxjAmount;
@ApiModelProperty(value = "加急单佣金金额 (需要正负)")
@IsNullConvertZero
private BigDecimal urgentSalaryAmount;
@ApiModelProperty(value = "置顶单云享金金额 (需要正负)")
@IsNullConvertZero
private BigDecimal topYxjAmount;
@ApiModelProperty(value = "置顶单佣金金额 (需要正负)")
@IsNullConvertZero
private BigDecimal topSalaryAmount;
@ApiModelProperty(value = "飞手应得订单金额 (正数)")
@IsNullConvertZero
private BigDecimal flyerSalaryAmount;
@ApiModelProperty(value = "修改后金额(注:①飞手未确认时,后面支付的需要退的佣金那部分钱 ②飞手确认时,修改后的金额小于原佣金,需要退多余的佣金那部分钱 ③如果全部是微信支付的则不用传值)")
@IsNullConvertZero
private BigDecimal refundSalaryAmount;
@ApiModelProperty(value = "修改后金额(注:①飞手未确认时,后面支付的需要退的云享金那部分钱 ②飞手确认时,修改后的金额小于原佣金,需要退多余的云享金那部分钱 ③如果全部是微信支付的则不用传值)")
@IsNullConvertZero
private BigDecimal refundCashAmount;
}
package com.mmc.csf.infomation.vo;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.io.Serializable;
/**
* @Author small
......@@ -19,29 +16,13 @@ import java.math.BigDecimal;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class WalletFlowVO {
public class WalletFlowVO implements Serializable {
@ApiModelProperty(value = "用户ID")
private Integer userAccountId;
private static final long serialVersionUID = -8848411142632397203L;
@ApiModelProperty(value = "支付方式 200结算(完成) 300冻结 100订单取消")
private Integer modeOfPayment;
private PublisherWalletFlowVO publisherWalletFlowVO;
@ApiModelProperty(value = "云享金")
private BigDecimal cashAmount;
@ApiModelProperty(value = "佣金")
private BigDecimal salaryAmount;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private String timeOfPayment;
@ApiModelProperty(value = "操作者用户ID")
private Integer operateUserAccountId;
@ApiModelProperty(value = "微信金额")
private BigDecimal weChat;
private FlyerWalletFlowVO flyerWalletFlowVO;
}
......@@ -79,9 +79,9 @@ public interface RequirementsDao {
void addPublishService(ServiceRequirementsDO requirementsInfoDO);
ServiceRequirementsDO grabTheOrder(String publisherNumber);
ServiceRequirementsDO grabTheOrder(Integer requirementsInfoId);
void updateGrabTheOrder(String publisherNumber, Integer repertory);
void updateGrabTheOrder(Integer requirementsInfoId, Integer repertory);
void insertService(RequirementsServiceDO requirementsServiceDO);
......@@ -119,4 +119,6 @@ public interface RequirementsDao {
void updateInfo(Integer requirementsInfoId, Integer serviceFlowId);
void serviceOrder(Integer requirementsInfoId);
}
package com.mmc.csf.release.entity.requirements;
import com.mmc.csf.config.IsNullConvertZero;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
......@@ -29,12 +30,15 @@ public class RequirementsAmountDO implements Serializable {
private Integer requirementsInfoId;
@ApiModelProperty(value = "发布者订单金额", example = "1")
@IsNullConvertZero
private BigDecimal orderAmount;
@ApiModelProperty(value = "发布者支付总金额", example = "1")
@IsNullConvertZero
private BigDecimal totalAmount;
@ApiModelProperty(value = "级别金额", example = "1")
@IsNullConvertZero
private BigDecimal orderLevelAmount;
......@@ -42,15 +46,18 @@ public class RequirementsAmountDO implements Serializable {
private String orderLevel;
@ApiModelProperty(value = "发布者支付微信金额", example = "1")
@IsNullConvertZero
private BigDecimal weChat;
@ApiModelProperty(value = "发布者支付佣金金额", example = "1")
@IsNullConvertZero
private BigDecimal salaryAmount;
@ApiModelProperty(value = "发布者微信支付订单", example = "1")
private String wechatPayOrderNumber;
@ApiModelProperty(value = "修改任务后的佣金", example = "1")
@IsNullConvertZero
private BigDecimal updateOrderAmount;
@ApiModelProperty(value = "原因", example = "原因")
......@@ -61,8 +68,20 @@ public class RequirementsAmountDO implements Serializable {
@ApiModelProperty(value = "后台获取token里面的用户id", hidden = true)
private Integer userAccountId;
@ApiModelProperty(value = "云享金", example = "10")
@IsNullConvertZero
private BigDecimal cashAmount;
@ApiModelProperty(value = "置顶/加急 佣金支付多少", example = "100")
@IsNullConvertZero
private BigDecimal levelSalaryAmount;
@ApiModelProperty(value = "置顶/加急 微信支付多少", example = "100")
@IsNullConvertZero
private BigDecimal levelWeChatAmount;
@ApiModelProperty(value = "置顶/加急 云享金支付多少", example = "100")
@IsNullConvertZero
private BigDecimal levelCashAmount;
public RequirementsAmountDO(ServiceRequirementsDO requirementsInfoDO) {
this.requirementsInfoId = requirementsInfoDO.getId();
this.orderAmount = requirementsInfoDO.getOrderAmount();
......@@ -74,6 +93,9 @@ public class RequirementsAmountDO implements Serializable {
this.wechatPayOrderNumber = requirementsInfoDO.getWechatPayOrderNumber();
this.userAccountId = requirementsInfoDO.getUserAccountId();
this.cashAmount = requirementsInfoDO.getCashAmount();
this.levelSalaryAmount = requirementsInfoDO.getLevelSalaryAmount();
this.levelWeChatAmount = requirementsInfoDO.getLevelWeChatAmount();
this.levelCashAmount = requirementsInfoDO.getLevelCashAmount();
}
}
package com.mmc.csf.release.entity.requirements;
import com.mmc.csf.config.IsNullConvertZero;
import com.mmc.csf.infomation.dto.PilotCertificationInteriorDTO;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
......@@ -38,18 +39,22 @@ public class RequirementsServiceDO implements Serializable {
private Integer teamUserId;
@ApiModelProperty(value = "云享金", example = "10")
@IsNullConvertZero
private BigDecimal cashAmount;
@ApiModelProperty(value = "佣金", example = "10")
@IsNullConvertZero
private BigDecimal salaryAmount;
@ApiModelProperty(value = "微信金额", example = "10")
@IsNullConvertZero
private BigDecimal weChat;
@ApiModelProperty(value = "微信支付订单编号", example = "R202308191657303116170")
private String wechatPayOrderNumber;
@ApiModelProperty(value = "抢单支付的总金额", example = "抢单支付的总金额")
@IsNullConvertZero
private BigDecimal preemptTotalAmount;
@ApiModelProperty(value = "任务流程id", example = "任务流程id")
private Integer serviceFlowId;
......@@ -59,6 +64,5 @@ public class RequirementsServiceDO implements Serializable {
this.pilotCertificationId = pilot.getId();
this.pilotCertificationUserId = pilot.getUserAccountId();
this.requirementsInfoId = requirementsInfoDO.getId();
this.serviceDictionaryId = 2;
}
}
package com.mmc.csf.release.entity.requirements;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mmc.csf.config.IsNullConvertZero;
import com.mmc.csf.infomation.vo.OrderLevelEnum;
import com.mmc.csf.infomation.vo.ServiceRequirementsVO;
import com.mmc.csf.release.model.group.Insert;
......@@ -65,6 +66,7 @@ public class ServiceRequirementsDO {
@ApiModelProperty(value = "订单金额", example = "订单金额", required = true)
@NotNull(message = "订单金额", groups = {Insert.class})
@IsNullConvertZero
private BigDecimal orderAmount;
@ApiModelProperty(value = "飞手保险", example = "飞手保险", required = true)
......@@ -89,6 +91,7 @@ public class ServiceRequirementsDO {
private String publisherNumber;
@ApiModelProperty(value = "0普通 100急单 300置顶")
@IsNullConvertZero
private BigDecimal orderLevelAmount;
@ApiModelProperty(value = "订单级别 REGULAR_ORDER,RUSH_ORDER,TOP_ORDER")
......@@ -96,16 +99,20 @@ public class ServiceRequirementsDO {
@ApiModelProperty(value = "总金额", example = "100", required = true)
@NotNull(message = "总金额", groups = {Insert.class})
@IsNullConvertZero
private BigDecimal totalAmount;
@ApiModelProperty(value = "云享金", example = "10")
@IsNullConvertZero
private BigDecimal cashAmount;
@ApiModelProperty(value = "佣金", example = "10")
@IsNullConvertZero
private BigDecimal salaryAmount;
@ApiModelProperty(value = "微信金额", example = "10")
@IsNullConvertZero
private BigDecimal weChat;
@ApiModelProperty(value = "微信支付订单编号", example = "R202308191657303116170")
......@@ -118,6 +125,16 @@ public class ServiceRequirementsDO {
private String paymentType;
@ApiModelProperty(value = "地区编码")
private String adcode;
@IsNullConvertZero
@ApiModelProperty(value = "置顶/加急 佣金支付多少", example = "100")
private BigDecimal levelSalaryAmount;
@ApiModelProperty(value = "置顶/加急 微信支付多少", example = "100")
@IsNullConvertZero
private BigDecimal levelWeChatAmount;
@ApiModelProperty(value = "置顶/加急 云享金支付多少", example = "100")
@IsNullConvertZero
private BigDecimal levelCashAmount;
public ServiceRequirementsDO(ServiceRequirementsVO serviceRequirementsVO) {
this.id = serviceRequirementsVO.getId();
......
......@@ -6,6 +6,7 @@ import com.mmc.csf.common.util.json.JsonUtil;
import com.mmc.csf.common.util.page.PageResult;
import com.mmc.csf.common.util.web.ResultBody;
import com.mmc.csf.common.util.web.ResultEnum;
import com.mmc.csf.config.IsNullConvertZeroUtil;
import com.mmc.csf.infomation.dto.*;
import com.mmc.csf.infomation.qo.IndustryCaseQO;
import com.mmc.csf.infomation.vo.*;
......@@ -239,6 +240,12 @@ public class RequirementsServiceImpl implements RequirementsService {
@Override
public ResultBody<GetOrderNumberDTO> publisherNumber(GetOrderNumberVO getOrderNumberVO, HttpServletRequest request) {
PublisherWalletFlowVO publisherWalletFlowVO = new PublisherWalletFlowVO();
ServiceRequirementsDO requirementsInfoDO = new ServiceRequirementsDO();
IsNullConvertZeroUtil.checkIsNull(requirementsInfoDO);
IsNullConvertZeroUtil.checkIsNull(publisherWalletFlowVO);
IsNullConvertZeroUtil.checkIsNull(publisherWalletFlowVO);
//用户钱包信息接口
ResultBody resultBody = getCurrentUserPayWalletInfo(request);
GetOrderNumberDTO orderNumberDTO = new GetOrderNumberDTO();
......@@ -253,50 +260,86 @@ public class RequirementsServiceImpl implements RequirementsService {
BigDecimal cashAndSalary = cashAmt.add(salaryAmt);
//需要支付的总金额
BigDecimal totalAmount = getOrderNumberVO.getOrderAmount().add(OrderLevelEnum.match(getOrderNumberVO.getOrderLevelEnum().getKey()).getValue());
if (getOrderNumberVO.getOrderMode() == 2) {
BigDecimal bigDecimal = new BigDecimal(0.3);
totalAmount = totalAmount.multiply(bigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP);
}
//需要冻结的金额
WalletFlowVO walletFlowVO = new WalletFlowVO();
BigDecimal tempTotalAmount = totalAmount;
BigDecimal rushAndTop = OrderLevelEnum.match(getOrderNumberVO.getOrderLevelEnum().getKey()).getValue();
String orderLevelEnum = OrderLevelEnum.match(getOrderNumberVO.getOrderLevelEnum().getKey()).getKey();
//需要支付的总金额
BigDecimal orderAmount = getOrderNumberVO.getOrderAmount();
String paymentType = getOrderNumberVO.getPaymentType();
String[] split = paymentType.split(",");
Set<String> collect = Arrays.asList(split).stream().collect(Collectors.toSet());
TreeSet<String> objects = new TreeSet<>(collect);
//用户剩余的佣金
BigDecimal userSalaryAmt = new BigDecimal(0);
//云享金余额还剩余多少
BigDecimal userCashAmt = new BigDecimal(0);
BigDecimal tempTotalAmount = new BigDecimal(0);
//存在置顶或加急
if (rushAndTop.compareTo(BigDecimal.ZERO) != 0) {
tempTotalAmount = rushAndTop;
for (String type : objects) {
switch (type) {
case "1":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
if (cashAmt.compareTo(tempTotalAmount) == 1 || cashAmt.compareTo(tempTotalAmount) == 0) {
walletFlowVO.setCashAmount(tempTotalAmount);
// walletFlowVO.setCashAmount(tempTotalAmount);
//加急云享金支付
if (orderLevelEnum.equals("RUSH_ORDER")) {
publisherWalletFlowVO.setUrgentYxjAmount(tempTotalAmount);
requirementsInfoDO.setLevelCashAmount(tempTotalAmount);
} else if (orderLevelEnum.equals("TOP_ORDER")) {
publisherWalletFlowVO.setTopYxjAmount(cashAmt);
requirementsInfoDO.setLevelCashAmount(tempTotalAmount);
}
tempTotalAmount = BigDecimal.ZERO;
} else {
tempTotalAmount = tempTotalAmount.subtract(cashAmt);
walletFlowVO.setCashAmount(cashAmt);
// walletFlowVO.setCashAmount(cashAmt);
if (orderLevelEnum.equals("RUSH_ORDER")) {
publisherWalletFlowVO.setUrgentYxjAmount(cashAmt);
requirementsInfoDO.setLevelCashAmount(cashAmt);
} else if (orderLevelEnum.equals("TOP_ORDER")) {
System.out.println(cashAmt);
publisherWalletFlowVO.setTopYxjAmount(cashAmt);
requirementsInfoDO.setLevelCashAmount(cashAmt);
}
}
}
break;
case "2":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
if (salaryAmt.compareTo(tempTotalAmount) == 1 || salaryAmt.compareTo(tempTotalAmount) == 0) {
walletFlowVO.setSalaryAmount(tempTotalAmount);
// walletFlowVO.setSalaryAmount(tempTotalAmount);
publisherWalletFlowVO.setTopSalaryAmount(tempTotalAmount);
if (orderLevelEnum.equals("RUSH_ORDER")) {
publisherWalletFlowVO.setUrgentSalaryAmount(tempTotalAmount);
requirementsInfoDO.setLevelSalaryAmount(tempTotalAmount);
} else if (orderLevelEnum.equals("TOP_ORDER")) {
publisherWalletFlowVO.setTopSalaryAmount(tempTotalAmount);
requirementsInfoDO.setLevelSalaryAmount(tempTotalAmount);
}
tempTotalAmount = BigDecimal.ZERO;
} else {
tempTotalAmount = tempTotalAmount.subtract(salaryAmt);
walletFlowVO.setSalaryAmount(salaryAmt);
// walletFlowVO.setSalaryAmount(salaryAmt);
publisherWalletFlowVO.setTopSalaryAmount(salaryAmt);
requirementsInfoDO.setLevelSalaryAmount(salaryAmt);
if (orderLevelEnum.equals("RUSH_ORDER")) {
publisherWalletFlowVO.setUrgentSalaryAmount(salaryAmt);
} else if (orderLevelEnum.equals("TOP_ORDER")) {
publisherWalletFlowVO.setTopSalaryAmount(salaryAmt);
requirementsInfoDO.setLevelSalaryAmount(salaryAmt);
}
}
}
break;
case "3":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
walletFlowVO.setWeChat(tempTotalAmount);
//需要支付微信
requirementsInfoDO.setLevelWeChatAmount(tempTotalAmount);
// walletFlowVO.setWeChat(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO;
}
break;
......@@ -305,241 +348,130 @@ public class RequirementsServiceImpl implements RequirementsService {
}
}
System.out.println(requirementsInfoDO);
System.out.println(publisherWalletFlowVO);
if (tempTotalAmount.compareTo(BigDecimal.ZERO) == 0) {
//表示订单计算完成,需要支付的钱都算出来了
walletFlowVO.toString();
System.out.println(walletFlowVO);
orderNumberDTO.setWeChatPay(walletFlowVO.getWeChat());
if (orderNumberDTO.getWeChatPay() != null) {
orderNumberDTO.setPaymentOrderNumber(randomOrderCode());
if (orderLevelEnum.equals("RUSH_ORDER")) {
//加急的云享金
BigDecimal urgentYxjAmount = publisherWalletFlowVO.getUrgentYxjAmount();
userCashAmt = cashAmt.subtract(urgentYxjAmount);
BigDecimal urgentSalaryAmount = publisherWalletFlowVO.getUrgentSalaryAmount();
userSalaryAmt = salaryAmt.subtract(urgentSalaryAmount);
} else if (orderLevelEnum.equals("TOP_ORDER")) {
//置顶的云享金
BigDecimal topYxjAmount = publisherWalletFlowVO.getTopYxjAmount();
userCashAmt = cashAmt.subtract(topYxjAmount);
BigDecimal topSalaryAmount = publisherWalletFlowVO.getTopSalaryAmount();
userSalaryAmt = salaryAmt.subtract(topSalaryAmount);
}
stringRedisTemplate.opsForValue().set(orderNumberDTO.getPaymentOrderNumber(), JsonUtil.parseObjToJson(orderNumberDTO));
return ResultBody.success(orderNumberDTO);
tempTotalAmount = orderAmount;
//剩下的用于支付任务佣金
for (String type : objects) {
switch (type) {
case "1":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
if (userCashAmt.compareTo(tempTotalAmount) == 1 || userCashAmt.compareTo(tempTotalAmount) == 0) {
// walletFlowVO.setCashAmount(tempTotalAmount);
publisherWalletFlowVO.setCashAmount(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO;
} else {
//云享金和佣金扣除完成,但是还不足支付订单金额,并且没有选择微信支付,所以支付不合法
return ResultBody.success("下单失败");
tempTotalAmount = tempTotalAmount.subtract(userCashAmt);
publisherWalletFlowVO.setCashAmount(userCashAmt);
}
/* //用户剩余总金额大于需要支付的总金额
if (cashAndSalary.compareTo(totalAmount) == 1) {
//优先扣除云享金
//如果用户选择了云享金没有选择佣金及微信支付
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) == 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) == 0) {
//如果云享金足够
if (cashAmt.compareTo(totalAmount) == 1) {
//冻结需要支付的金额
walletFlowVO.setCashAmount(totalAmount);
BigDecimal cashAmount = walletFlowVO.getCashAmount();
}
//云享金不够
if (cashAmt.compareTo(totalAmount) == -1) {
return ResultBody.error("请选择多个支付方式,云享金余额不足");
}
}
//选择了佣金 未选择微信支付,云享金
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) == 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) == 0) {
//佣金足够
if (salaryAmt.compareTo(totalAmount) == 1) {
walletFlowVO.setSalaryAmount(totalAmount);
BigDecimal salaryAmount = walletFlowVO.getSalaryAmount();
}
//佣金不够
if (salaryAmt.compareTo(totalAmount) == -1) {
return ResultBody.error("请选择多个支付方式,佣金余额不足");
}
}
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) == 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) == 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) != 0) {
return ResultBody.error("云享金加上佣金大于需要支付的金额无需使用微信支付");
}
//选择了 云享金及佣金支付 没有选择微信支付
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) == 0) {
//如果云享金大于总金额
if (cashAmt.compareTo(totalAmount) == 1) {
//云享金就冻结
walletFlowVO.setCashAmount(totalAmount.negate());
System.out.println(walletFlowVO.getCashAmount());
}
//如果云享金不够就扣除佣金
if (cashAmt.compareTo(totalAmount) == -1) {
//总金额减去云享金剩余未扣除的钱
BigDecimal subtract = totalAmount.subtract(cashAmt);
walletFlowVO.setCashAmount(cashAmt.negate());
walletFlowVO.setSalaryAmount(subtract.negate());
}
return ResultBody.success("用户剩余总金额足够,需要微信支付");
}
//前提是云享金加上佣金大于总金额 选择了云享金 +微信支付
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) == 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) != 0) {
return ResultBody.error("云享金加上佣金大于需要支付的金额无需使用微信支付");
}
//前提是云享金加上佣金大于总金额 选择了佣金+选择了微信支付
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) == 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) != 0) {
return ResultBody.error("云享金加上佣金大于需要支付的金额无需使用微信支付");
}
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) != 0) {
return ResultBody.error("云享金加上佣金大于需要支付的金额,请取消微信支付");
}
}
//用户剩余总金额小于需要支付的总金额
if (cashAndSalary.compareTo(totalAmount) == -1) {
//用户剩余的总金额小于需要支付的总金额 只选择了云享金支付
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) == 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) == 0) {
//云享金不够
if (cashAmt.compareTo(totalAmount) == -1) {
return ResultBody.error("请选择多个支付方式,云享金余额不足");
}
}
//用户剩余的总金额小于需要支付的总金额 选择了佣金 未选择微信支付,云享金
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) == 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) == 0) {
//佣金不够
if (salaryAmt.compareTo(totalAmount) == -1) {
return ResultBody.error("请选择多个支付方式,佣金余额不足");
}
}
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) == 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) == 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) != 0) {
//微信实际需要全部支付
orderNumberDTO.setWeChatPay(totalAmount);
orderNumberDTO.setPaymentOrderNumber(randomOrderCode());
stringRedisTemplate.opsForValue().set(orderNumberDTO.getPaymentOrderNumber(), JsonUtil.parseObjToJson(orderNumberDTO));
return ResultBody.success(orderNumberDTO);
}
//用户剩余的总金额小于需要支付的总金额 云享金及佣金支付 没有选择微信支付
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) == 0) {
return ResultBody.error("云享金加上佣金小于需要总金额,需要加上微信支付");
break;
case "2":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
if (userSalaryAmt.compareTo(tempTotalAmount) == 1 || userSalaryAmt.compareTo(tempTotalAmount) == 0) {
publisherWalletFlowVO.setSalaryAmount(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO;
} else {
tempTotalAmount = tempTotalAmount.subtract(userSalaryAmt);
publisherWalletFlowVO.setSalaryAmount(userSalaryAmt);
}
//用户剩余的总金额小于需要支付的总金额 选择了云享金 +微信支付
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) == 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) != 0) {
BigDecimal weChat = totalAmount.subtract(cashAmt);
//微信实际需要全部支付
//云享金需要冻结的金额
walletFlowVO.setCashAmount(cashAmt);
orderNumberDTO.setWeChatPay(weChat);
orderNumberDTO.setPaymentOrderNumber(randomOrderCode());
stringRedisTemplate.opsForValue().set(orderNumberDTO.getPaymentOrderNumber(), JsonUtil.parseObjToJson(orderNumberDTO));
return ResultBody.success(orderNumberDTO);
}
//用户剩余的总金额小于需要支付的总金额 选择了佣金+选择了微信支付
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) == 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) != 0) {
BigDecimal weChat = totalAmount.subtract(salaryAmt);
//需要冻结的佣金是
walletFlowVO.setSalaryAmount(salaryAmt);
//微信需要支付的金额
orderNumberDTO.setWeChatPay(weChat);
stringRedisTemplate.opsForValue().set(orderNumberDTO.getPaymentOrderNumber(), JsonUtil.parseObjToJson(orderNumberDTO));
return ResultBody.success(orderNumberDTO);
}
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0 &&
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) != 0) {
//优先扣除云享金
BigDecimal totalSubtract = totalAmount.subtract(cashAmt);
BigDecimal salarySubtract = totalSubtract.subtract(salaryAmt);
walletFlowVO.setWeChat(salarySubtract);
orderNumberDTO.setWeChatPay(salarySubtract);
orderNumberDTO.setPaymentOrderNumber(randomOrderCode());
stringRedisTemplate.opsForValue().set(orderNumberDTO.getPaymentOrderNumber(), JsonUtil.parseObjToJson(orderNumberDTO));
return ResultBody.success(orderNumberDTO);
break;
case "3":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
// publisherWalletFlowVO.setWeChat(tempTotalAmount);
requirementsInfoDO.setWeChat(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO;
}
break;
default:
break;
}
*/
/* //云享金
BigDecimal cashAmount = getOrderNumberVO.getCashAmount();
//佣金
BigDecimal salaryAmount = getOrderNumberVO.getSalaryAmount();
//微信金额
BigDecimal weChat = getOrderNumberVO.getWeChatPay();
String randomOrder = randomOrderCode();
if (cashAmount.equals(BigDecimal.ZERO) && salaryAmount.equals(BigDecimal.ZERO) && weChat.equals(BigDecimal.ZERO)) {
return ResultBody.error(ResultEnum.PLEASE_SELECT_PAYMENT);
}
if (!cashAmount.equals(BigDecimal.ZERO) && salaryAmount.equals(BigDecimal.ZERO) && weChat.equals(BigDecimal.ZERO)) {
//总金额大于云享金剩余的金额
if (totalAmount.compareTo(cashAmt) == 1) {
return ResultBody.error(ResultEnum.OVER_THE_TOTAL);
}
//不存在加急或者置顶
if (rushAndTop.compareTo(BigDecimal.ZERO) == 0) {
if (getOrderNumberVO.getOrderMode() == 2) {
Integer requirementsInfoId = getOrderNumberVO.getRequirementsInfoId();
RequirementsInfoDO requirementsInfoDO1 = requirementsDao.detailPublish(requirementsInfoId);
BigDecimal orderAmount1 = requirementsInfoDO1.getOrderAmount();
BigDecimal bigDecimal = new BigDecimal(0.3);
tempTotalAmount = orderAmount1.multiply(bigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP);
} else if (getOrderNumberVO.getOrderMode() == 1) {
tempTotalAmount = orderAmount;
}
if (cashAmount.equals(BigDecimal.ZERO) && !salaryAmount.equals(BigDecimal.ZERO) && weChat.equals(BigDecimal.ZERO)) {
//总金额大于佣金剩余的金额
if (totalAmount.compareTo(salaryAmt) == 1) {
return ResultBody.error(ResultEnum.SALARY_PAYMENT_FAILURE);
for (String type : objects) {
switch (type) {
case "1":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
if (cashAmt.compareTo(tempTotalAmount) == 1 || cashAmt.compareTo(tempTotalAmount) == 0) {
publisherWalletFlowVO.setCashAmount(tempTotalAmount);
// walletFlowVO.setCashAmount(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO;
} else {
tempTotalAmount = tempTotalAmount.subtract(cashAmt);
publisherWalletFlowVO.setCashAmount(cashAmt);
// walletFlowVO.setCashAmount(cashAmt);
}
}
//单独微信微信 可以进行支付
if (cashAmount.equals(BigDecimal.ZERO) && salaryAmount.equals(BigDecimal.ZERO) && !weChat.equals(BigDecimal.ZERO)) {
orderNumberDTO.setWeChatPay(totalAmount);
orderNumberDTO.setPaymentOrderNumber(randomOrder);
return ResultBody.success(orderNumberDTO);
break;
case "2":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
if (salaryAmt.compareTo(tempTotalAmount) == 1 || salaryAmt.compareTo(tempTotalAmount) == 0) {
publisherWalletFlowVO.setSalaryAmount(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO;
} else {
tempTotalAmount = tempTotalAmount.subtract(salaryAmt);
publisherWalletFlowVO.setSalaryAmount(salaryAmt);
}
if (!cashAmount.equals(BigDecimal.ZERO) && !salaryAmount.equals(BigDecimal.ZERO) && weChat.equals(BigDecimal.ZERO)) {
BigDecimal add = cashAmt.add(salaryAmt);
if (totalAmount.compareTo(add) == 1) {
return ResultBody.error(ResultEnum.CASH_SALARY_PAYMENT_FAILURE);
}
break;
case "3":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
requirementsInfoDO.setWeChat(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO;
}
if (!cashAmount.equals(BigDecimal.ZERO) && salaryAmount.equals(BigDecimal.ZERO) && !weChat.equals(BigDecimal.ZERO)) {
BigDecimal subtract = totalAmount.subtract(cashAmt);
orderNumberDTO.setWeChatPay(subtract);
orderNumberDTO.setPaymentOrderNumber(randomOrder);
return ResultBody.success(orderNumberDTO);
break;
default:
break;
}
if (cashAmount.equals(BigDecimal.ZERO) && !salaryAmount.equals(BigDecimal.ZERO) && !weChat.equals(BigDecimal.ZERO)) {
BigDecimal subtract = totalAmount.subtract(salaryAmt);
orderNumberDTO.setWeChatPay(subtract);
orderNumberDTO.setPaymentOrderNumber(randomOrder);
return ResultBody.success(orderNumberDTO);
}
if (!cashAmount.equals(BigDecimal.ZERO) && !salaryAmount.equals(BigDecimal.ZERO) && !weChat.equals(BigDecimal.ZERO)) {
BigDecimal cashAndSalary = cashAmt.add(salaryAmt);
BigDecimal cash = totalAmount.subtract(cashAmt);
if (cash.compareTo(BigDecimal.ZERO) == 0) {
return ResultBody.error(ResultEnum.CASH_IS_ENOUGH);
}
BigDecimal salary = cash.subtract(salaryAmt);
if (salary.compareTo(BigDecimal.ZERO) == 0) {
return ResultBody.error(ResultEnum.SALARY_IS_ENOUGH);
if (tempTotalAmount.compareTo(BigDecimal.ZERO) == 0) {
//表示订单计算完成,需要支付的钱都算出来了
System.out.println(requirementsInfoDO);
System.out.println(publisherWalletFlowVO);
BigDecimal weChat = requirementsInfoDO.getWeChat();
BigDecimal levelWeChatAmount = requirementsInfoDO.getLevelWeChatAmount();
BigDecimal add = weChat.add(levelWeChatAmount);
orderNumberDTO.setWeChatPay(add);
if (orderNumberDTO.getWeChatPay().compareTo(BigDecimal.ZERO) != 0) {
orderNumberDTO.setPaymentOrderNumber(randomOrderCode());
stringRedisTemplate.opsForValue().set(orderNumberDTO.getPaymentOrderNumber(), JsonUtil.parseObjToJson(orderNumberDTO));
}
return ResultBody.success(orderNumberDTO);
}*/
} else {
//云享金和佣金扣除完成,但是还不足支付订单金额,并且没有选择微信支付,所以支付不合法
return ResultBody.success("下单失败");
}
}
......@@ -626,15 +558,26 @@ public class RequirementsServiceImpl implements RequirementsService {
//需要冻结的金额
WalletFlowVO walletFlowVO = new WalletFlowVO();
// PublisherWalletFlowVO publisherWalletFlowVO = walletFlowVO.getPublisherWalletFlowVO();
PublisherWalletFlowVO publisherWalletFlowVO = new PublisherWalletFlowVO();
publisherWalletFlowVO.setUserAccountId(serviceRequirementsVO.getUserAccountId());
publisherWalletFlowVO.setOperateUserAccountId(serviceRequirementsVO.getUserAccountId());
ServiceRequirementsDO requirementsInfoDO = new ServiceRequirementsDO(serviceRequirementsVO);
requirementsInfoDO.setPublisherNumber(randomOrderCode());
IsNullConvertZeroUtil.checkIsNull(publisherWalletFlowVO);
IsNullConvertZeroUtil.checkIsNull(requirementsInfoDO);
//获取用户钱包
ResultBody resultBody = getCurrentUserPayWalletInfo(request);
PayWalletDTO payWalletDTO = (PayWalletDTO) resultBody.getResult();
//需要支付的总金额
BigDecimal totalAmount = requirementsInfoDO.getTotalAmount();
BigDecimal orderAmount = requirementsInfoDO.getOrderAmount();
//需要支付加急或者置顶金额
BigDecimal rushAndTop = OrderLevelEnum.match(serviceRequirementsVO.getOrderLevelEnum().getKey()).getValue();
String orderLevelEnum = OrderLevelEnum.match(serviceRequirementsVO.getOrderLevelEnum().getKey()).getKey();
//云享金
BigDecimal cashAmt = payWalletDTO.getCashAmt();
//佣金
......@@ -643,40 +586,83 @@ public class RequirementsServiceImpl implements RequirementsService {
String json = stringRedisTemplate.opsForValue().get(requirementsInfoDO.getWechatPayOrderNumber() + requirementsInfoDO.getUserAccountId());
GetOrderNumberDTO orderNumberDTO = JSONObject.parseObject(json, GetOrderNumberDTO.class);
BigDecimal tempTotalAmount = totalAmount;
String paymentType = requirementsInfoDO.getPaymentType();
String[] split = paymentType.split(",");
Set<String> collect = Arrays.asList(split).stream().collect(Collectors.toSet());
TreeSet<String> objects = new TreeSet<>(collect);
//用户剩余的佣金
BigDecimal userSalaryAmt = new BigDecimal(0);
//云享金余额还剩余多少
BigDecimal userCashAmt = new BigDecimal(0);
BigDecimal tempTotalAmount = new BigDecimal(0);
//存在置顶或加急
if (rushAndTop.compareTo(BigDecimal.ZERO) != 0) {
tempTotalAmount = rushAndTop;
for (String type : objects) {
switch (type) {
case "1":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
if (cashAmt.compareTo(tempTotalAmount) == 1 || cashAmt.compareTo(tempTotalAmount) == 0) {
walletFlowVO.setCashAmount(tempTotalAmount);
// walletFlowVO.setCashAmount(tempTotalAmount);
//加急云享金支付
if (orderLevelEnum.equals("RUSH_ORDER")) {
publisherWalletFlowVO.setUrgentYxjAmount(tempTotalAmount);
requirementsInfoDO.setLevelCashAmount(tempTotalAmount);
} else if (orderLevelEnum.equals("TOP_ORDER")) {
publisherWalletFlowVO.setTopYxjAmount(cashAmt);
requirementsInfoDO.setLevelCashAmount(tempTotalAmount);
}
tempTotalAmount = BigDecimal.ZERO;
} else {
tempTotalAmount = tempTotalAmount.subtract(cashAmt);
walletFlowVO.setCashAmount(cashAmt);
// walletFlowVO.setCashAmount(cashAmt);
if (orderLevelEnum.equals("RUSH_ORDER")) {
publisherWalletFlowVO.setUrgentYxjAmount(cashAmt);
requirementsInfoDO.setLevelCashAmount(cashAmt);
} else if (orderLevelEnum.equals("TOP_ORDER")) {
System.out.println(cashAmt);
publisherWalletFlowVO.setTopYxjAmount(cashAmt);
requirementsInfoDO.setLevelCashAmount(cashAmt);
}
}
}
break;
case "2":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
if (salaryAmt.compareTo(tempTotalAmount) == 1 || salaryAmt.compareTo(tempTotalAmount) == 0) {
walletFlowVO.setSalaryAmount(tempTotalAmount);
// walletFlowVO.setSalaryAmount(tempTotalAmount);
publisherWalletFlowVO.setTopSalaryAmount(tempTotalAmount);
if (orderLevelEnum.equals("RUSH_ORDER")) {
publisherWalletFlowVO.setUrgentSalaryAmount(tempTotalAmount);
requirementsInfoDO.setLevelSalaryAmount(tempTotalAmount);
} else if (orderLevelEnum.equals("TOP_ORDER")) {
publisherWalletFlowVO.setTopSalaryAmount(tempTotalAmount);
requirementsInfoDO.setLevelSalaryAmount(tempTotalAmount);
}
tempTotalAmount = BigDecimal.ZERO;
} else {
tempTotalAmount = tempTotalAmount.subtract(salaryAmt);
walletFlowVO.setSalaryAmount(salaryAmt);
// walletFlowVO.setSalaryAmount(salaryAmt);
publisherWalletFlowVO.setTopSalaryAmount(salaryAmt);
requirementsInfoDO.setLevelSalaryAmount(salaryAmt);
if (orderLevelEnum.equals("RUSH_ORDER")) {
publisherWalletFlowVO.setUrgentSalaryAmount(salaryAmt);
} else if (orderLevelEnum.equals("TOP_ORDER")) {
publisherWalletFlowVO.setTopSalaryAmount(salaryAmt);
requirementsInfoDO.setLevelSalaryAmount(salaryAmt);
}
}
}
break;
case "3":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
walletFlowVO.setWeChat(tempTotalAmount);
//需要支付微信
requirementsInfoDO.setLevelWeChatAmount(tempTotalAmount);
// walletFlowVO.setWeChat(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO;
}
break;
......@@ -684,140 +670,155 @@ public class RequirementsServiceImpl implements RequirementsService {
break;
}
}
if (tempTotalAmount.compareTo(BigDecimal.ZERO) == 0) {
//表示订单计算完成,需要支付的钱都算出来了
walletFlowVO.toString();
System.out.println(walletFlowVO);
//orderNumberDTO.setWeChatPay(walletFlowVO.getWeChat());
/*if (orderNumberDTO.getWeChatPay() != null) {
orderNumberDTO.setPaymentOrderNumber(randomOrderCode());
}*/
requirementsInfoDO.setCashAmount(walletFlowVO.getCashAmount());
requirementsInfoDO.setSalaryAmount(walletFlowVO.getSalaryAmount());
requirementsInfoDO.setWeChat(walletFlowVO.getWeChat());
if (orderNumberDTO != null) {
requirementsInfoDO.setWechatPayOrderNumber(orderNumberDTO.getPaymentOrderNumber());
} else if (orderNumberDTO == null) {
requirementsInfoDO.setWechatPayOrderNumber(null);
System.out.println(requirementsInfoDO);
System.out.println(publisherWalletFlowVO);
if (orderLevelEnum.equals("RUSH_ORDER")) {
//加急的云享金
BigDecimal urgentYxjAmount = publisherWalletFlowVO.getUrgentYxjAmount();
userCashAmt = cashAmt.subtract(urgentYxjAmount);
BigDecimal urgentSalaryAmount = publisherWalletFlowVO.getUrgentSalaryAmount();
userSalaryAmt = salaryAmt.subtract(urgentSalaryAmount);
} else if (orderLevelEnum.equals("TOP_ORDER")) {
//置顶的云享金
BigDecimal topYxjAmount = publisherWalletFlowVO.getTopYxjAmount();
userCashAmt = cashAmt.subtract(topYxjAmount);
BigDecimal topSalaryAmount = publisherWalletFlowVO.getTopSalaryAmount();
userSalaryAmt = salaryAmt.subtract(topSalaryAmount);
}
requirementsDao.addPublishService(requirementsInfoDO);
RequirementsAmountDO requirementsAmountDO = new RequirementsAmountDO(requirementsInfoDO);
requirementsDao.addAmount(requirementsAmountDO);
return ResultBody.success();
tempTotalAmount = orderAmount;
//剩下的用于支付任务佣金
for (String type : objects) {
switch (type) {
case "1":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
if (userCashAmt.compareTo(tempTotalAmount) == 1 || userCashAmt.compareTo(tempTotalAmount) == 0) {
// walletFlowVO.setCashAmount(tempTotalAmount);
publisherWalletFlowVO.setCashAmount(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO;
} else {
//云享金和佣金扣除完成,但是还不足支付订单金额,并且没有选择微信支付,所以支付不合法
return ResultBody.success("下单失败");
tempTotalAmount = tempTotalAmount.subtract(userCashAmt);
publisherWalletFlowVO.setCashAmount(userCashAmt);
}
/* if (cashAmount.equals(BigDecimal.ZERO) && salaryAmount.equals(BigDecimal.ZERO) && weChat.equals(BigDecimal.ZERO)) {
return ResultBody.error(ResultEnum.PLEASE_SELECT_PAYMENT);
}
if (!cashAmount.equals(BigDecimal.ZERO) && salaryAmount.equals(BigDecimal.ZERO) && weChat.equals(BigDecimal.ZERO)) {
//总金额大于云享金剩余的金额
if (totalAmount.compareTo(cashAmt) == 1) {
return ResultBody.error(ResultEnum.OVER_THE_TOTAL);
}
//总金额小于云享金剩余的金额
if (totalAmount.compareTo(cashAmt) == -1) {
walletFlowVO.setCashAmount(totalAmount);
}
walletFlowVO.setCashAmount(totalAmount.negate());
//冻结云享金
extracted(walletFlowVO, requirementsInfoDO);
}
if (cashAmount.equals(BigDecimal.ZERO) && !salaryAmount.equals(BigDecimal.ZERO) && weChat.equals(BigDecimal.ZERO)) {
//总金额大于佣金剩余的金额
if (totalAmount.compareTo(salaryAmt) == 1) {
return ResultBody.error(ResultEnum.SALARY_PAYMENT_FAILURE);
}
//总金额小于佣金剩余的金额
if (totalAmount.compareTo(salaryAmount) == -1) {
walletFlowVO.setSalaryAmount(totalAmount);
}
walletFlowVO.setSalaryAmount(totalAmount.negate());
extracted(walletFlowVO, requirementsInfoDO);
}
//单独微信制度 可以进行支付
if (cashAmount.equals(BigDecimal.ZERO) && salaryAmount.equals(BigDecimal.ZERO) && !weChat.equals(BigDecimal.ZERO)) {
BigDecimal weChatPay = orderNumberDTO.getWeChatPay().negate();
walletFlowVO.setWeChat(weChatPay);
extracted(walletFlowVO, requirementsInfoDO);
}
//云享金与佣金剩余金额足够及不足够
if (!cashAmount.equals(BigDecimal.ZERO) && !salaryAmount.equals(BigDecimal.ZERO) && weChat.equals(BigDecimal.ZERO)) {
BigDecimal add = cashAmt.add(salaryAmt);
if (totalAmount.compareTo(add) == 1) {
return ResultBody.error(ResultEnum.CASH_SALARY_PAYMENT_FAILURE);
}
//云享金不足佣金可以补上
if (totalAmount.compareTo(add) == -1) {
BigDecimal cash = cashAmt.subtract(totalAmount);
if (cash.compareTo(BigDecimal.ZERO) <= 0) {
BigDecimal salary = salaryAmt.subtract(cash.negate());
System.out.println(salary);
//云享金
walletFlowVO.setCashAmount(cashAmt.negate());
walletFlowVO.setSalaryAmount(cashAmt.negate());
extracted(walletFlowVO, requirementsInfoDO);
}
//云享金足够 不扣除佣金剩余的金额
if (cash.compareTo(BigDecimal.ZERO) > 0) {
walletFlowVO.setCashAmount(cash.negate());
extracted(walletFlowVO, requirementsInfoDO);
break;
case "2":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
if (userSalaryAmt.compareTo(tempTotalAmount) == 1 || userSalaryAmt.compareTo(tempTotalAmount) == 0) {
publisherWalletFlowVO.setSalaryAmount(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO;
} else {
tempTotalAmount = tempTotalAmount.subtract(userSalaryAmt);
publisherWalletFlowVO.setSalaryAmount(userSalaryAmt);
}
}
break;
case "3":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
// publisherWalletFlowVO.setWeChat(tempTotalAmount);
requirementsInfoDO.setWeChat(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO;
}
break;
default:
break;
}
}
}
//选择佣金或者微信支付
if (cashAmount.equals(BigDecimal.ZERO) && !salaryAmount.equals(BigDecimal.ZERO) && !weChat.equals(BigDecimal.ZERO)) {
BigDecimal salary = salaryAmt.subtract(totalAmount);
System.out.println(requirementsInfoDO);
System.out.println(publisherWalletFlowVO);
if (salary.compareTo(BigDecimal.ZERO) >= 0) {
walletFlowVO.setSalaryAmount(totalAmount);
extracted(walletFlowVO, requirementsInfoDO);
//不存在加急或者置顶
if (rushAndTop.compareTo(BigDecimal.ZERO) == 0) {
tempTotalAmount = orderAmount;
for (String type : objects) {
switch (type) {
case "1":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
if (cashAmt.compareTo(tempTotalAmount) == 1 || cashAmt.compareTo(tempTotalAmount) == 0) {
publisherWalletFlowVO.setCashAmount(tempTotalAmount);
// walletFlowVO.setCashAmount(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO;
} else {
tempTotalAmount = tempTotalAmount.subtract(cashAmt);
publisherWalletFlowVO.setCashAmount(cashAmt);
// walletFlowVO.setCashAmount(cashAmt);
}
if (salary.compareTo(BigDecimal.ZERO) < 0) {
BigDecimal weChatPay = orderNumberDTO.getWeChatPay();
walletFlowVO.setSalaryAmount(salary);
walletFlowVO.setWeChat(weChatPay.negate());
extracted(walletFlowVO, requirementsInfoDO);
}
return ResultBody.success(orderNumberDTO);
break;
case "2":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
if (salaryAmt.compareTo(tempTotalAmount) == 1 || salaryAmt.compareTo(tempTotalAmount) == 0) {
publisherWalletFlowVO.setSalaryAmount(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO;
} else {
tempTotalAmount = tempTotalAmount.subtract(salaryAmt);
publisherWalletFlowVO.setSalaryAmount(salaryAmt);
}
}
if (!cashAmount.equals(BigDecimal.ZERO) && !salaryAmount.equals(BigDecimal.ZERO) && !weChat.equals(BigDecimal.ZERO)) {
BigDecimal cash = cashAmt.subtract(totalAmount);
BigDecimal salary = salaryAmt.subtract(cash.negate());
// 如果云享金充足
if (cash.compareTo(BigDecimal.ZERO) >= 0) {
walletFlowVO.setCashAmount(totalAmount);
break;
case "3":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
requirementsInfoDO.setWeChat(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO;
}
if (cash.compareTo(BigDecimal.ZERO) < 0 && salary.compareTo(BigDecimal.ZERO) >= 0) {
walletFlowVO.setCashAmount(cashAmt.negate());
walletFlowVO.setSalaryAmount(cash);
extracted(walletFlowVO, requirementsInfoDO);
break;
default:
break;
}
if (cash.compareTo(BigDecimal.ZERO) < 0 && salary.compareTo(BigDecimal.ZERO) < 0) {
walletFlowVO.setCashAmount(cashAmt);
walletFlowVO.setSalaryAmount(salaryAmt);
walletFlowVO.setWeChat(orderNumberDTO.getWeChatPay());
}
}
*/
System.out.println(requirementsInfoDO);
System.out.println(publisherWalletFlowVO);
if (tempTotalAmount.compareTo(BigDecimal.ZERO) == 0) {
System.out.println(requirementsInfoDO);
System.out.println(publisherWalletFlowVO);
System.out.println(requirementsInfoDO);
if (orderNumberDTO != null) {
requirementsInfoDO.setWechatPayOrderNumber(orderNumberDTO.getPaymentOrderNumber());
} else if (orderNumberDTO == null) {
requirementsInfoDO.setWechatPayOrderNumber(null);
}
if (orderNumberDTO != null) {
BigDecimal weChatPay = orderNumberDTO.getWeChatPay();
if (requirementsInfoDO.getWechatPayOrderNumber().equals(orderNumberDTO.getPaymentOrderNumber())) {
BigDecimal weChat = requirementsInfoDO.getWeChat();
BigDecimal levelWeChatAmount = requirementsInfoDO.getLevelWeChatAmount();
BigDecimal add = weChat.add(levelWeChatAmount);
if (weChatPay.compareTo(add) != 0) {
return ResultBody.error("订单号错误下单失败");
}
}
}
requirementsDao.addPublishService(requirementsInfoDO);
RequirementsAmountDO requirementsAmountDO = new RequirementsAmountDO(requirementsInfoDO);
requirementsDao.addAmount(requirementsAmountDO);
System.out.println(requirementsAmountDO);
private void extracted(WalletFlowVO walletFlowVO, ServiceRequirementsDO requirementsInfoDO) {
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");// 设置日期格式
walletFlowVO.setWeChat(walletFlowVO.getWeChat());
walletFlowVO.setModeOfPayment(300);
walletFlowVO.setTimeOfPayment(df.format(new Date()));
walletFlowVO.setUserAccountId(requirementsInfoDO.getUserAccountId());
walletFlowVO.setOperateUserAccountId(requirementsInfoDO.getUserAccountId());
walletFlowVO.setCashAmount(walletFlowVO.getCashAmount());
walletFlowVO.setSalaryAmount(walletFlowVO.getSalaryAmount());
System.out.println(walletFlowVO);
if (requirementsAmountDO.getCashAmount().compareTo(BigDecimal.ZERO) != 0
|| requirementsAmountDO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0
|| requirementsAmountDO.getLevelCashAmount().compareTo(BigDecimal.ZERO) != 0
|| requirementsAmountDO.getLevelSalaryAmount().compareTo(BigDecimal.ZERO) != 0) {
feignWalletFlow(publisherWalletFlowVO, request.getHeader("token"));
}
return ResultBody.success();
} else {
//云享金和佣金扣除完成,但是还不足支付订单金额,并且没有选择微信支付,所以支付不合法
return ResultBody.success("下单失败");
}
}
/**
* 获取用户钱包信息
......@@ -858,8 +859,8 @@ public class RequirementsServiceImpl implements RequirementsService {
@Override
public ResultBody grabTheOrder(GrabTheOrderVO grabTheOrderVO, HttpServletRequest request) {
ServiceRequirementsDO requirementsInfoDO = requirementsDao.grabTheOrder(grabTheOrderVO.getPublisherNumber());
if (grabTheOrderVO.getPublisherNumber().equals(requirementsInfoDO.getPublisherNumber()) && grabTheOrderVO.getUserAccountId().equals(requirementsInfoDO.getUserAccountId())) {
ServiceRequirementsDO requirementsInfoDO = requirementsDao.grabTheOrder(grabTheOrderVO.getRequirementsInfoId());
if (grabTheOrderVO.getRequirementsInfoId().equals(requirementsInfoDO.getId()) && grabTheOrderVO.getUserAccountId().equals(requirementsInfoDO.getUserAccountId())) {
return ResultBody.error("自己不能抢自己发布的需求");
}
//飞手
......@@ -876,7 +877,8 @@ public class RequirementsServiceImpl implements RequirementsService {
// requirementsInfoDO.setPublisherNumber(randomOrderCode());
ResultBody resultBody = getCurrentUserPayWalletInfo(request);
PayWalletDTO payWalletDTO = (PayWalletDTO) resultBody.getResult();
RequirementsServiceDO requirementsServiceDO = new RequirementsServiceDO(pilot, requirementsInfoDO);
IsNullConvertZeroUtil.checkIsNull(requirementsServiceDO);
//用户云享金+用户佣金>总金额
//剩余后台云享金
......@@ -889,10 +891,12 @@ public class RequirementsServiceImpl implements RequirementsService {
BigDecimal totalAmount = requirementsInfoDO.getOrderAmount();
BigDecimal bigDecimal = new BigDecimal(0.3);
totalAmount = totalAmount.multiply(bigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP);
String json = stringRedisTemplate.opsForValue().get(requirementsInfoDO.getWechatPayOrderNumber() + requirementsInfoDO.getUserAccountId());
String json = stringRedisTemplate.opsForValue().get(grabTheOrderVO.getWechatPayOrderNumber() + grabTheOrderVO.getUserAccountId());
GetOrderNumberDTO orderNumberDTO = JSONObject.parseObject(json, GetOrderNumberDTO.class);
//需要冻结的金额
WalletFlowVO walletFlowVO = new WalletFlowVO();
FlyerWalletFlowVO flyerWalletFlowVO = new FlyerWalletFlowVO();
IsNullConvertZeroUtil.checkIsNull(flyerWalletFlowVO);
//PublisherWalletFlowVO publisherWalletFlowVO = walletFlowVO.getPublisherWalletFlowVO();
BigDecimal tempTotalAmount = totalAmount;
String paymentType = grabTheOrderVO.getPaymentType();
String[] split = paymentType.split(",");
......@@ -903,28 +907,33 @@ public class RequirementsServiceImpl implements RequirementsService {
case "1":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
if (cashAmt.compareTo(tempTotalAmount) == 1 || cashAmt.compareTo(tempTotalAmount) == 0) {
walletFlowVO.setCashAmount(tempTotalAmount);
flyerWalletFlowVO.setCashAmount(tempTotalAmount);
requirementsServiceDO.setCashAmount(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO;
} else {
tempTotalAmount = tempTotalAmount.subtract(cashAmt);
walletFlowVO.setCashAmount(cashAmt);
flyerWalletFlowVO.setCashAmount(cashAmt);
requirementsServiceDO.setCashAmount(cashAmt);
}
}
break;
case "2":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
if (salaryAmt.compareTo(tempTotalAmount) == 1 || salaryAmt.compareTo(tempTotalAmount) == 0) {
walletFlowVO.setSalaryAmount(tempTotalAmount);
flyerWalletFlowVO.setSalaryAmount(tempTotalAmount);
requirementsServiceDO.setSalaryAmount(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO;
} else {
tempTotalAmount = tempTotalAmount.subtract(salaryAmt);
walletFlowVO.setSalaryAmount(salaryAmt);
flyerWalletFlowVO.setSalaryAmount(salaryAmt);
requirementsServiceDO.setSalaryAmount(salaryAmt);
}
}
break;
case "3":
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
walletFlowVO.setWeChat(tempTotalAmount);
// publisherWalletFlowVO.setWeChat(tempTotalAmount);
requirementsServiceDO.setWeChat(tempTotalAmount);
tempTotalAmount = BigDecimal.ZERO;
}
break;
......@@ -934,19 +943,33 @@ public class RequirementsServiceImpl implements RequirementsService {
}
if (tempTotalAmount.compareTo(BigDecimal.ZERO) == 0) {
//表示订单计算完成,需要支付的钱都算出来了
walletFlowVO.toString();
System.out.println(walletFlowVO);
RequirementsServiceDO requirementsServiceDO = new RequirementsServiceDO(pilot, requirementsInfoDO);
requirementsServiceDO.setCashAmount(walletFlowVO.getCashAmount());
requirementsServiceDO.setSalaryAmount(walletFlowVO.getSalaryAmount());
System.out.println(flyerWalletFlowVO);
System.out.println(requirementsServiceDO);
flyerWalletFlowVO.setUserAccountId(grabTheOrderVO.getUserAccountId());
flyerWalletFlowVO.setOperateUserAccountId(grabTheOrderVO.getUserAccountId());
// requirementsServiceDO.setCashAmount(walletFlowVO.getCashAmount());
// requirementsServiceDO.setSalaryAmount(walletFlowVO.getSalaryAmount());
requirementsServiceDO.setWeChat(orderNumberDTO.getWeChatPay());
requirementsServiceDO.setWechatPayOrderNumber(orderNumberDTO.getPaymentOrderNumber());
BigDecimal cashAndSalaryAmount = walletFlowVO.getCashAmount().add(walletFlowVO.getSalaryAmount());
BigDecimal preemptTotalAmount = cashAndSalaryAmount.add(orderNumberDTO.getWeChatPay());
requirementsServiceDO.setPreemptTotalAmount(preemptTotalAmount);
// BigDecimal cashAndSalaryAmount = walletFlowVO.getCashAmount().add(walletFlowVO.getSalaryAmount());
// BigDecimal preemptTotalAmount = cashAndSalaryAmount.add(orderNumberDTO.getWeChatPay());
// requirementsServiceDO.setPreemptTotalAmount(preemptTotalAmount);
BigDecimal cashAmount = requirementsServiceDO.getCashAmount();
BigDecimal salaryAmount = requirementsServiceDO.getSalaryAmount();
BigDecimal weChat = requirementsServiceDO.getWeChat();
BigDecimal add = cashAmount.add(salaryAmount);
BigDecimal add1 = add.add(weChat);
requirementsServiceDO.setPreemptTotalAmount(add1);
requirementsDao.insertService(requirementsServiceDO);
requirementsInfoDO.setRepertory(repertory - 1);
requirementsDao.updateGrabTheOrder(grabTheOrderVO.getPublisherNumber(), requirementsInfoDO.getRepertory());
requirementsDao.updateGrabTheOrder(grabTheOrderVO.getRequirementsInfoId(), requirementsInfoDO.getRepertory());
if (requirementsServiceDO.getCashAmount().compareTo(BigDecimal.ZERO) != 0
|| requirementsServiceDO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0) {
walletFlow(flyerWalletFlowVO, request.getHeader("token"));
}
return ResultBody.success();
} else {
//云享金和佣金扣除完成,但是还不足支付订单金额,并且没有选择微信支付,所以支付不合法
......@@ -1050,6 +1073,49 @@ public class RequirementsServiceImpl implements RequirementsService {
return body;
}
public ResultBody walletFlow(FlyerWalletFlowVO flyerWalletFlowVO, String token) {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("token", token);
WalletFlowVO walletFlowVO = new WalletFlowVO();
flyerWalletFlowVO.setModeOfPayment(400);
flyerWalletFlowVO.setCashAmount(flyerWalletFlowVO.getCashAmount().negate());
flyerWalletFlowVO.setSalaryCashPledge(flyerWalletFlowVO.getSalaryAmount().negate());
walletFlowVO.setFlyerWalletFlowVO(flyerWalletFlowVO);
HttpEntity<String> entity = new HttpEntity<>(JSONObject.toJSONString(walletFlowVO), headers);
ResponseEntity<Object> exchange = null;
try {
exchange = restTemplate.exchange(userApp + "/userapp/pay/feignWalletFlow", HttpMethod.POST, entity, Object.class);
} catch (RestClientException e) {
return ResultBody.error(ResultEnum.THE_THIRD_PARTY_INTERFACE_IS_BEING_UPDATED);
}
return ResultBody.success();
}
public ResultBody feignWalletFlow(PublisherWalletFlowVO publisherWalletFlowVO, String token) {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
headers.add("token", token);
WalletFlowVO walletFlowVO = new WalletFlowVO();
publisherWalletFlowVO.setModeOfPayment(100);
publisherWalletFlowVO.setCashAmount(publisherWalletFlowVO.getCashAmount().negate());
publisherWalletFlowVO.setSalaryAmount(publisherWalletFlowVO.getSalaryAmount().negate());
publisherWalletFlowVO.setUrgentYxjAmount(publisherWalletFlowVO.getUrgentYxjAmount().negate());
publisherWalletFlowVO.setUrgentSalaryAmount(publisherWalletFlowVO.getUrgentSalaryAmount().negate());
publisherWalletFlowVO.setTopYxjAmount(publisherWalletFlowVO.getTopYxjAmount().negate());
publisherWalletFlowVO.setTopSalaryAmount(publisherWalletFlowVO.getTopSalaryAmount().negate());
walletFlowVO.setPublisherWalletFlowVO(publisherWalletFlowVO);
HttpEntity<String> entity = new HttpEntity<>(JSONObject.toJSONString(walletFlowVO), headers);
ResponseEntity<Object> exchange = null;
try {
exchange = restTemplate.exchange(userApp + "/userapp/pay/feignWalletFlow", HttpMethod.POST, entity, Object.class);
} catch (RestClientException e) {
return ResultBody.error(ResultEnum.THE_THIRD_PARTY_INTERFACE_IS_BEING_UPDATED);
}
return ResultBody.success();
}
public ResultBody releaseOrder(RequirementsInfoVO requirementsInfoVO, String token) {
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
......
......@@ -281,7 +281,7 @@
FROM requirements_info ri
LEFT JOIN requirements_type rt
ON rt.id = ri.requirement_type_id
LEFT JOIN service_flow sf ON sf.order_status = ri.service_flow_id
LEFT JOIN service_flow sf ON sf.id = ri.service_flow_id
LEFT JOIN requirements_amount ra ON ra.requirements_info_id = ri.id
AND ra.user_account_id = ri.user_account_id
WHERE ri.id = #{id}
......@@ -304,10 +304,12 @@
keyProperty="id" useGeneratedKeys="true">
INSERT INTO requirements_amount(requirements_info_id, user_account_id, create_time, update_time, order_amount,
total_amount, order_level_amount, order_level, cash_amount, we_chat,
salary_amount, wechat_pay_order_number)
salary_amount, wechat_pay_order_number, level_cash_amount,
level_we_chat_amount, level_salary_amount)
VALUES (#{requirementsInfoId}, #{userAccountId}, NOW(), NOW(), #{orderAmount},
#{totalAmount}, #{orderLevelAmount}, #{orderLevel}, #{cashAmount}, #{weChat},
#{salaryAmount}, #{wechatPayOrderNumber});
#{salaryAmount}, #{wechatPayOrderNumber}, #{levelCashAmount}, #{levelWeChatAmount},
#{levelSalaryAmount});
</insert>
<select id="grabTheOrder" resultType="com.mmc.csf.release.entity.requirements.ServiceRequirementsDO">
......@@ -326,16 +328,18 @@
ri.publish_phone,
ri.publisher_number,
ri.service_id,
ri.total_amount,
ra.total_amount,
ri.repertory,
ri.order_level,
ri.cash_amount,
ri.we_chat,
ri.salary_amount,
ri.wechat_pay_order_number
ra.order_level,
ra.cash_amount,
ra.we_chat,
ra.salary_amount,
ra.wechat_pay_order_number,
ra.order_amount
FROM requirements_info ri
LEFT JOIN requirements_type rt ON rt.id = ri.requirement_type_id
WHERE ri.publisher_number = #{publisherNumber}
LEFT JOIN requirements_amount ra ON ra.requirements_info_id = ri.id
WHERE ri.id = #{requirementsInfoId}
</select>
<update id="updateGrabTheOrder">
......@@ -343,7 +347,7 @@
set repertory=#{repertory},
service_flow_id = 2,
update_time=NOW()
where publisher_number = #{publisherNumber}
where id = #{requirementsInfoId}
</update>
<insert id="insertService" parameterType="com.mmc.csf.release.entity.requirements.RequirementsServiceDO"
......@@ -354,7 +358,7 @@
wechat_pay_order_number, service_flow_id, preempt_total_amount)
VALUES (#{requirementsInfoId}, #{pilotCertificationId}, #{pilotCertificationUserId},
#{teamId}, #{teamUserId}, #{cashAmount}, #{weChat}, #{salaryAmount}, #{wechatPayOrderNumber}, 2,
preemptTotalAmount);
#{preemptTotalAmount});
</insert>
<insert id="arriveAtTheScene" parameterType="com.mmc.csf.release.entity.requirements.ServiceArriveSceneDO"
......@@ -472,7 +476,7 @@
FROM requirements_info ri
LEFT JOIN requirements_type rt
ON rt.id = ri.requirement_type_id
LEFT JOIN service_flow sf ON sf.order_status = ri.service_flow_id
LEFT JOIN service_flow sf ON sf.id = ri.service_flow_id
WHERE ri.user_account_id = #{userAccountId}
ORDER BY ri.order_level_amount desc,
ri.id desc
......@@ -507,7 +511,7 @@
ri.order_amount,
FROM requirements_info ri
LEFT JOIN requirements_type rt ON rt.id = ri.requirement_type_id
LEFT JOIN service_flow sf ON sf.order_status = ri.service_flow_id
LEFT JOIN service_flow sf ON sf.id = ri.service_flow_id
INNER JOIN requirements_service rs ON ri.id = rs.requirements_info_id
WHERE rs.pilot_certification_user_id = #{userAccountId}
ORDER BY ri.order_level_amount desc,
......@@ -548,7 +552,7 @@
FROM requirements_info ri
LEFT JOIN requirements_type rt
ON rt.id = ri.requirement_type_id
LEFT JOIN service_flow sf ON sf.order_status = ri.service_flow_id
LEFT JOIN service_flow sf ON sf.id = ri.service_flow_id
INNER JOIN requirements_service rs ON ri.id = rs.requirements_info_id
WHERE rs.pilot_certification_user_id = #{userAccountId}
and rs.requirements_info_id = #{requirementsInfoId}
......@@ -582,7 +586,7 @@
ri.publish
FROM requirements_info ri
LEFT JOIN requirements_type rt ON rt.id = ri.requirement_type_id
LEFT JOIN service_flow sf ON sf.order_status = ri.service_flow_id
LEFT JOIN service_flow sf ON sf.id = ri.service_flow_id
WHERE ri.user_account_id = #{userAccountId}
AND ri.id = #{requirementsInfoId}
</select>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论