Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
ims
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
ims
Commits
d2bf82b5
提交
d2bf82b5
authored
8月 23, 2023
作者:
张小凤
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Require(update)
上级
f07e4d56
显示空白字符变更
内嵌
并排
正在显示
14 个修改的文件
包含
716 行增加
和
420 行删除
+716
-420
IsNullConvertZero.java
...l/src/main/java/com/mmc/csf/config/IsNullConvertZero.java
+15
-0
IsNullConvertZeroUtil.java
...c/main/java/com/mmc/csf/config/IsNullConvertZeroUtil.java
+39
-0
GetOrderNumberDTO.java
...in/java/com/mmc/csf/infomation/dto/GetOrderNumberDTO.java
+2
-0
FlyerWalletFlowVO.java
...ain/java/com/mmc/csf/infomation/vo/FlyerWalletFlowVO.java
+55
-0
GetOrderNumberVO.java
...main/java/com/mmc/csf/infomation/vo/GetOrderNumberVO.java
+7
-6
GrabTheOrderVO.java
...c/main/java/com/mmc/csf/infomation/vo/GrabTheOrderVO.java
+2
-2
PublisherWalletFlowVO.java
...java/com/mmc/csf/infomation/vo/PublisherWalletFlowVO.java
+88
-0
WalletFlowVO.java
...src/main/java/com/mmc/csf/infomation/vo/WalletFlowVO.java
+5
-24
RequirementsDao.java
...rc/main/java/com/mmc/csf/release/dao/RequirementsDao.java
+4
-2
RequirementsAmountDO.java
...csf/release/entity/requirements/RequirementsAmountDO.java
+22
-0
RequirementsServiceDO.java
...sf/release/entity/requirements/RequirementsServiceDO.java
+5
-1
ServiceRequirementsDO.java
...sf/release/entity/requirements/ServiceRequirementsDO.java
+17
-0
RequirementsServiceImpl.java
...mmc/csf/release/service/impl/RequirementsServiceImpl.java
+435
-369
RequirementsDao.xml
...rc/main/resources/mapper/requirements/RequirementsDao.xml
+20
-16
没有找到文件。
csf-common/csf-common-model/src/main/java/com/mmc/csf/config/IsNullConvertZero.java
0 → 100644
浏览文件 @
d2bf82b5
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
{
}
csf-common/csf-common-model/src/main/java/com/mmc/csf/config/IsNullConvertZeroUtil.java
0 → 100644
浏览文件 @
d2bf82b5
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
;
}
}
csf-common/csf-common-model/src/main/java/com/mmc/csf/infomation/dto/GetOrderNumberDTO.java
浏览文件 @
d2bf82b5
package
com
.
mmc
.
csf
.
infomation
.
dto
;
package
com
.
mmc
.
csf
.
infomation
.
dto
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.fasterxml.jackson.annotation.JsonIgnore
;
import
com.mmc.csf.config.IsNullConvertZero
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Builder
;
...
@@ -30,6 +31,7 @@ public class GetOrderNumberDTO implements Serializable {
...
@@ -30,6 +31,7 @@ public class GetOrderNumberDTO implements Serializable {
private
String
paymentOrderNumber
;
private
String
paymentOrderNumber
;
@ApiModelProperty
(
value
=
"微信需要支付金额"
,
example
=
"100"
)
@ApiModelProperty
(
value
=
"微信需要支付金额"
,
example
=
"100"
)
@IsNullConvertZero
private
BigDecimal
weChatPay
;
private
BigDecimal
weChatPay
;
@JsonIgnore
@JsonIgnore
...
...
csf-common/csf-common-model/src/main/java/com/mmc/csf/infomation/vo/FlyerWalletFlowVO.java
0 → 100644
浏览文件 @
d2bf82b5
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
;
}
csf-common/csf-common-model/src/main/java/com/mmc/csf/infomation/vo/GetOrderNumberVO.java
浏览文件 @
d2bf82b5
package
com
.
mmc
.
csf
.
infomation
.
vo
;
package
com
.
mmc
.
csf
.
infomation
.
vo
;
import
com.mmc.csf.release.model.group.Insert
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
import
javax.validation.constraints.NotNull
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
/**
/**
...
@@ -21,12 +19,13 @@ import java.math.BigDecimal;
...
@@ -21,12 +19,13 @@ import java.math.BigDecimal;
@Builder
@Builder
public
class
GetOrderNumberVO
{
public
class
GetOrderNumberVO
{
@ApiModelProperty
(
value
=
"订单金额"
,
example
=
"100"
,
required
=
true
)
@ApiModelProperty
(
value
=
"订单金额"
,
example
=
"100.00"
,
required
=
true
)
@NotNull
(
message
=
"订单金额"
,
groups
=
{
Insert
.
class
})
//@NotNull(message = "订单金额", groups = {Insert.class})
//@DecimalMin(value = "100.00", message = "amount格式不正确")
private
BigDecimal
orderAmount
;
private
BigDecimal
orderAmount
;
@ApiModelProperty
(
value
=
"订单级别 todo:前端传英文,后台自己获取金额 订单级别(REGULAR_ORDER,RUSH_ORDER,TOP_ORDER)"
,
example
=
"REGULAR_ORDER"
,
required
=
true
)
@ApiModelProperty
(
value
=
"订单级别 todo:前端传英文,后台自己获取金额 订单级别(REGULAR_ORDER,RUSH_ORDER,TOP_ORDER)
注意抢单的时候传固定的普通支付 REGULAR_ORDER
"
,
example
=
"REGULAR_ORDER"
,
required
=
true
)
@NotNull
(
message
=
"订单级别"
,
groups
=
{
Insert
.
class
})
//
@NotNull(message = "订单级别", groups = {Insert.class})
private
OrderLevelEnum
orderLevelEnum
;
private
OrderLevelEnum
orderLevelEnum
;
...
@@ -47,5 +46,7 @@ public class GetOrderNumberVO {
...
@@ -47,5 +46,7 @@ public class GetOrderNumberVO {
@ApiModelProperty
(
value
=
"订单方式 发布订单:1 ,抢单:2"
,
example
=
"1"
,
required
=
true
)
@ApiModelProperty
(
value
=
"订单方式 发布订单:1 ,抢单:2"
,
example
=
"1"
,
required
=
true
)
private
Integer
orderMode
;
private
Integer
orderMode
;
@ApiModelProperty
(
value
=
"抢单时需要知道抢单的那个订单"
,
example
=
"1"
)
private
Integer
requirementsInfoId
;
}
}
csf-common/csf-common-model/src/main/java/com/mmc/csf/infomation/vo/GrabTheOrderVO.java
浏览文件 @
d2bf82b5
...
@@ -39,8 +39,8 @@ public class GrabTheOrderVO {
...
@@ -39,8 +39,8 @@ public class GrabTheOrderVO {
@ApiModelProperty
(
value
=
"微信金额"
,
example
=
"10"
,
hidden
=
true
)
@ApiModelProperty
(
value
=
"微信金额"
,
example
=
"10"
,
hidden
=
true
)
private
BigDecimal
weChat
;
private
BigDecimal
weChat
;
@ApiModelProperty
(
value
=
"
发布者任务编号"
,
example
=
"R202308192201279509820
"
)
@ApiModelProperty
(
value
=
"
抢单id"
,
example
=
"1
"
)
private
String
publisherNumber
;
private
Integer
requirementsInfoId
;
@JsonIgnore
@JsonIgnore
private
Integer
userAccountId
;
private
Integer
userAccountId
;
...
...
csf-common/csf-common-model/src/main/java/com/mmc/csf/infomation/vo/PublisherWalletFlowVO.java
0 → 100644
浏览文件 @
d2bf82b5
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
;
}
csf-common/csf-common-model/src/main/java/com/mmc/csf/infomation/vo/WalletFlowVO.java
浏览文件 @
d2bf82b5
package
com
.
mmc
.
csf
.
infomation
.
vo
;
package
com
.
mmc
.
csf
.
infomation
.
vo
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.
math.BigDecimal
;
import
java.
io.Serializable
;
/**
/**
* @Author small
* @Author small
...
@@ -19,29 +16,13 @@ import java.math.BigDecimal;
...
@@ -19,29 +16,13 @@ import java.math.BigDecimal;
@Data
@Data
@AllArgsConstructor
@AllArgsConstructor
@NoArgsConstructor
@NoArgsConstructor
public
class
WalletFlowVO
{
public
class
WalletFlowVO
implements
Serializable
{
@ApiModelProperty
(
value
=
"用户ID"
)
private
static
final
long
serialVersionUID
=
-
8848411142632397203L
;
private
Integer
userAccountId
;
@ApiModelProperty
(
value
=
"支付方式 200结算(完成) 300冻结 100订单取消"
)
private
PublisherWalletFlowVO
publisherWalletFlowVO
;
private
Integer
modeOfPayment
;
@ApiModelProperty
(
value
=
"云享金"
)
private
FlyerWalletFlowVO
flyerWalletFlowVO
;
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
;
}
}
release-service/src/main/java/com/mmc/csf/release/dao/RequirementsDao.java
浏览文件 @
d2bf82b5
...
@@ -79,9 +79,9 @@ public interface RequirementsDao {
...
@@ -79,9 +79,9 @@ public interface RequirementsDao {
void
addPublishService
(
ServiceRequirementsDO
requirementsInfoDO
);
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
);
void
insertService
(
RequirementsServiceDO
requirementsServiceDO
);
...
@@ -119,4 +119,6 @@ public interface RequirementsDao {
...
@@ -119,4 +119,6 @@ public interface RequirementsDao {
void
updateInfo
(
Integer
requirementsInfoId
,
Integer
serviceFlowId
);
void
updateInfo
(
Integer
requirementsInfoId
,
Integer
serviceFlowId
);
void
serviceOrder
(
Integer
requirementsInfoId
);
}
}
release-service/src/main/java/com/mmc/csf/release/entity/requirements/RequirementsAmountDO.java
浏览文件 @
d2bf82b5
package
com
.
mmc
.
csf
.
release
.
entity
.
requirements
;
package
com
.
mmc
.
csf
.
release
.
entity
.
requirements
;
import
com.mmc.csf.config.IsNullConvertZero
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Builder
;
...
@@ -29,12 +30,15 @@ public class RequirementsAmountDO implements Serializable {
...
@@ -29,12 +30,15 @@ public class RequirementsAmountDO implements Serializable {
private
Integer
requirementsInfoId
;
private
Integer
requirementsInfoId
;
@ApiModelProperty
(
value
=
"发布者订单金额"
,
example
=
"1"
)
@ApiModelProperty
(
value
=
"发布者订单金额"
,
example
=
"1"
)
@IsNullConvertZero
private
BigDecimal
orderAmount
;
private
BigDecimal
orderAmount
;
@ApiModelProperty
(
value
=
"发布者支付总金额"
,
example
=
"1"
)
@ApiModelProperty
(
value
=
"发布者支付总金额"
,
example
=
"1"
)
@IsNullConvertZero
private
BigDecimal
totalAmount
;
private
BigDecimal
totalAmount
;
@ApiModelProperty
(
value
=
"级别金额"
,
example
=
"1"
)
@ApiModelProperty
(
value
=
"级别金额"
,
example
=
"1"
)
@IsNullConvertZero
private
BigDecimal
orderLevelAmount
;
private
BigDecimal
orderLevelAmount
;
...
@@ -42,15 +46,18 @@ public class RequirementsAmountDO implements Serializable {
...
@@ -42,15 +46,18 @@ public class RequirementsAmountDO implements Serializable {
private
String
orderLevel
;
private
String
orderLevel
;
@ApiModelProperty
(
value
=
"发布者支付微信金额"
,
example
=
"1"
)
@ApiModelProperty
(
value
=
"发布者支付微信金额"
,
example
=
"1"
)
@IsNullConvertZero
private
BigDecimal
weChat
;
private
BigDecimal
weChat
;
@ApiModelProperty
(
value
=
"发布者支付佣金金额"
,
example
=
"1"
)
@ApiModelProperty
(
value
=
"发布者支付佣金金额"
,
example
=
"1"
)
@IsNullConvertZero
private
BigDecimal
salaryAmount
;
private
BigDecimal
salaryAmount
;
@ApiModelProperty
(
value
=
"发布者微信支付订单"
,
example
=
"1"
)
@ApiModelProperty
(
value
=
"发布者微信支付订单"
,
example
=
"1"
)
private
String
wechatPayOrderNumber
;
private
String
wechatPayOrderNumber
;
@ApiModelProperty
(
value
=
"修改任务后的佣金"
,
example
=
"1"
)
@ApiModelProperty
(
value
=
"修改任务后的佣金"
,
example
=
"1"
)
@IsNullConvertZero
private
BigDecimal
updateOrderAmount
;
private
BigDecimal
updateOrderAmount
;
@ApiModelProperty
(
value
=
"原因"
,
example
=
"原因"
)
@ApiModelProperty
(
value
=
"原因"
,
example
=
"原因"
)
...
@@ -61,8 +68,20 @@ public class RequirementsAmountDO implements Serializable {
...
@@ -61,8 +68,20 @@ public class RequirementsAmountDO implements Serializable {
@ApiModelProperty
(
value
=
"后台获取token里面的用户id"
,
hidden
=
true
)
@ApiModelProperty
(
value
=
"后台获取token里面的用户id"
,
hidden
=
true
)
private
Integer
userAccountId
;
private
Integer
userAccountId
;
@ApiModelProperty
(
value
=
"云享金"
,
example
=
"10"
)
@ApiModelProperty
(
value
=
"云享金"
,
example
=
"10"
)
@IsNullConvertZero
private
BigDecimal
cashAmount
;
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
)
{
public
RequirementsAmountDO
(
ServiceRequirementsDO
requirementsInfoDO
)
{
this
.
requirementsInfoId
=
requirementsInfoDO
.
getId
();
this
.
requirementsInfoId
=
requirementsInfoDO
.
getId
();
this
.
orderAmount
=
requirementsInfoDO
.
getOrderAmount
();
this
.
orderAmount
=
requirementsInfoDO
.
getOrderAmount
();
...
@@ -74,6 +93,9 @@ public class RequirementsAmountDO implements Serializable {
...
@@ -74,6 +93,9 @@ public class RequirementsAmountDO implements Serializable {
this
.
wechatPayOrderNumber
=
requirementsInfoDO
.
getWechatPayOrderNumber
();
this
.
wechatPayOrderNumber
=
requirementsInfoDO
.
getWechatPayOrderNumber
();
this
.
userAccountId
=
requirementsInfoDO
.
getUserAccountId
();
this
.
userAccountId
=
requirementsInfoDO
.
getUserAccountId
();
this
.
cashAmount
=
requirementsInfoDO
.
getCashAmount
();
this
.
cashAmount
=
requirementsInfoDO
.
getCashAmount
();
this
.
levelSalaryAmount
=
requirementsInfoDO
.
getLevelSalaryAmount
();
this
.
levelWeChatAmount
=
requirementsInfoDO
.
getLevelWeChatAmount
();
this
.
levelCashAmount
=
requirementsInfoDO
.
getLevelCashAmount
();
}
}
}
}
release-service/src/main/java/com/mmc/csf/release/entity/requirements/RequirementsServiceDO.java
浏览文件 @
d2bf82b5
package
com
.
mmc
.
csf
.
release
.
entity
.
requirements
;
package
com
.
mmc
.
csf
.
release
.
entity
.
requirements
;
import
com.mmc.csf.config.IsNullConvertZero
;
import
com.mmc.csf.infomation.dto.PilotCertificationInteriorDTO
;
import
com.mmc.csf.infomation.dto.PilotCertificationInteriorDTO
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.AllArgsConstructor
;
...
@@ -38,18 +39,22 @@ public class RequirementsServiceDO implements Serializable {
...
@@ -38,18 +39,22 @@ public class RequirementsServiceDO implements Serializable {
private
Integer
teamUserId
;
private
Integer
teamUserId
;
@ApiModelProperty
(
value
=
"云享金"
,
example
=
"10"
)
@ApiModelProperty
(
value
=
"云享金"
,
example
=
"10"
)
@IsNullConvertZero
private
BigDecimal
cashAmount
;
private
BigDecimal
cashAmount
;
@ApiModelProperty
(
value
=
"佣金"
,
example
=
"10"
)
@ApiModelProperty
(
value
=
"佣金"
,
example
=
"10"
)
@IsNullConvertZero
private
BigDecimal
salaryAmount
;
private
BigDecimal
salaryAmount
;
@ApiModelProperty
(
value
=
"微信金额"
,
example
=
"10"
)
@ApiModelProperty
(
value
=
"微信金额"
,
example
=
"10"
)
@IsNullConvertZero
private
BigDecimal
weChat
;
private
BigDecimal
weChat
;
@ApiModelProperty
(
value
=
"微信支付订单编号"
,
example
=
"R202308191657303116170"
)
@ApiModelProperty
(
value
=
"微信支付订单编号"
,
example
=
"R202308191657303116170"
)
private
String
wechatPayOrderNumber
;
private
String
wechatPayOrderNumber
;
@ApiModelProperty
(
value
=
"抢单支付的总金额"
,
example
=
"抢单支付的总金额"
)
@ApiModelProperty
(
value
=
"抢单支付的总金额"
,
example
=
"抢单支付的总金额"
)
@IsNullConvertZero
private
BigDecimal
preemptTotalAmount
;
private
BigDecimal
preemptTotalAmount
;
@ApiModelProperty
(
value
=
"任务流程id"
,
example
=
"任务流程id"
)
@ApiModelProperty
(
value
=
"任务流程id"
,
example
=
"任务流程id"
)
private
Integer
serviceFlowId
;
private
Integer
serviceFlowId
;
...
@@ -59,6 +64,5 @@ public class RequirementsServiceDO implements Serializable {
...
@@ -59,6 +64,5 @@ public class RequirementsServiceDO implements Serializable {
this
.
pilotCertificationId
=
pilot
.
getId
();
this
.
pilotCertificationId
=
pilot
.
getId
();
this
.
pilotCertificationUserId
=
pilot
.
getUserAccountId
();
this
.
pilotCertificationUserId
=
pilot
.
getUserAccountId
();
this
.
requirementsInfoId
=
requirementsInfoDO
.
getId
();
this
.
requirementsInfoId
=
requirementsInfoDO
.
getId
();
this
.
serviceDictionaryId
=
2
;
}
}
}
}
release-service/src/main/java/com/mmc/csf/release/entity/requirements/ServiceRequirementsDO.java
浏览文件 @
d2bf82b5
package
com
.
mmc
.
csf
.
release
.
entity
.
requirements
;
package
com
.
mmc
.
csf
.
release
.
entity
.
requirements
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
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.OrderLevelEnum
;
import
com.mmc.csf.infomation.vo.ServiceRequirementsVO
;
import
com.mmc.csf.infomation.vo.ServiceRequirementsVO
;
import
com.mmc.csf.release.model.group.Insert
;
import
com.mmc.csf.release.model.group.Insert
;
...
@@ -65,6 +66,7 @@ public class ServiceRequirementsDO {
...
@@ -65,6 +66,7 @@ public class ServiceRequirementsDO {
@ApiModelProperty
(
value
=
"订单金额"
,
example
=
"订单金额"
,
required
=
true
)
@ApiModelProperty
(
value
=
"订单金额"
,
example
=
"订单金额"
,
required
=
true
)
@NotNull
(
message
=
"订单金额"
,
groups
=
{
Insert
.
class
})
@NotNull
(
message
=
"订单金额"
,
groups
=
{
Insert
.
class
})
@IsNullConvertZero
private
BigDecimal
orderAmount
;
private
BigDecimal
orderAmount
;
@ApiModelProperty
(
value
=
"飞手保险"
,
example
=
"飞手保险"
,
required
=
true
)
@ApiModelProperty
(
value
=
"飞手保险"
,
example
=
"飞手保险"
,
required
=
true
)
...
@@ -89,6 +91,7 @@ public class ServiceRequirementsDO {
...
@@ -89,6 +91,7 @@ public class ServiceRequirementsDO {
private
String
publisherNumber
;
private
String
publisherNumber
;
@ApiModelProperty
(
value
=
"0普通 100急单 300置顶"
)
@ApiModelProperty
(
value
=
"0普通 100急单 300置顶"
)
@IsNullConvertZero
private
BigDecimal
orderLevelAmount
;
private
BigDecimal
orderLevelAmount
;
@ApiModelProperty
(
value
=
"订单级别 REGULAR_ORDER,RUSH_ORDER,TOP_ORDER"
)
@ApiModelProperty
(
value
=
"订单级别 REGULAR_ORDER,RUSH_ORDER,TOP_ORDER"
)
...
@@ -96,16 +99,20 @@ public class ServiceRequirementsDO {
...
@@ -96,16 +99,20 @@ public class ServiceRequirementsDO {
@ApiModelProperty
(
value
=
"总金额"
,
example
=
"100"
,
required
=
true
)
@ApiModelProperty
(
value
=
"总金额"
,
example
=
"100"
,
required
=
true
)
@NotNull
(
message
=
"总金额"
,
groups
=
{
Insert
.
class
})
@NotNull
(
message
=
"总金额"
,
groups
=
{
Insert
.
class
})
@IsNullConvertZero
private
BigDecimal
totalAmount
;
private
BigDecimal
totalAmount
;
@ApiModelProperty
(
value
=
"云享金"
,
example
=
"10"
)
@ApiModelProperty
(
value
=
"云享金"
,
example
=
"10"
)
@IsNullConvertZero
private
BigDecimal
cashAmount
;
private
BigDecimal
cashAmount
;
@ApiModelProperty
(
value
=
"佣金"
,
example
=
"10"
)
@ApiModelProperty
(
value
=
"佣金"
,
example
=
"10"
)
@IsNullConvertZero
private
BigDecimal
salaryAmount
;
private
BigDecimal
salaryAmount
;
@ApiModelProperty
(
value
=
"微信金额"
,
example
=
"10"
)
@ApiModelProperty
(
value
=
"微信金额"
,
example
=
"10"
)
@IsNullConvertZero
private
BigDecimal
weChat
;
private
BigDecimal
weChat
;
@ApiModelProperty
(
value
=
"微信支付订单编号"
,
example
=
"R202308191657303116170"
)
@ApiModelProperty
(
value
=
"微信支付订单编号"
,
example
=
"R202308191657303116170"
)
...
@@ -118,6 +125,16 @@ public class ServiceRequirementsDO {
...
@@ -118,6 +125,16 @@ public class ServiceRequirementsDO {
private
String
paymentType
;
private
String
paymentType
;
@ApiModelProperty
(
value
=
"地区编码"
)
@ApiModelProperty
(
value
=
"地区编码"
)
private
String
adcode
;
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
)
{
public
ServiceRequirementsDO
(
ServiceRequirementsVO
serviceRequirementsVO
)
{
this
.
id
=
serviceRequirementsVO
.
getId
();
this
.
id
=
serviceRequirementsVO
.
getId
();
...
...
release-service/src/main/java/com/mmc/csf/release/service/impl/RequirementsServiceImpl.java
浏览文件 @
d2bf82b5
...
@@ -6,6 +6,7 @@ import com.mmc.csf.common.util.json.JsonUtil;
...
@@ -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.page.PageResult
;
import
com.mmc.csf.common.util.web.ResultBody
;
import
com.mmc.csf.common.util.web.ResultBody
;
import
com.mmc.csf.common.util.web.ResultEnum
;
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.dto.*
;
import
com.mmc.csf.infomation.qo.IndustryCaseQO
;
import
com.mmc.csf.infomation.qo.IndustryCaseQO
;
import
com.mmc.csf.infomation.vo.*
;
import
com.mmc.csf.infomation.vo.*
;
...
@@ -239,6 +240,12 @@ public class RequirementsServiceImpl implements RequirementsService {
...
@@ -239,6 +240,12 @@ public class RequirementsServiceImpl implements RequirementsService {
@Override
@Override
public
ResultBody
<
GetOrderNumberDTO
>
publisherNumber
(
GetOrderNumberVO
getOrderNumberVO
,
HttpServletRequest
request
)
{
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
);
ResultBody
resultBody
=
getCurrentUserPayWalletInfo
(
request
);
GetOrderNumberDTO
orderNumberDTO
=
new
GetOrderNumberDTO
();
GetOrderNumberDTO
orderNumberDTO
=
new
GetOrderNumberDTO
();
...
@@ -253,50 +260,86 @@ public class RequirementsServiceImpl implements RequirementsService {
...
@@ -253,50 +260,86 @@ public class RequirementsServiceImpl implements RequirementsService {
BigDecimal
cashAndSalary
=
cashAmt
.
add
(
salaryAmt
);
BigDecimal
cashAndSalary
=
cashAmt
.
add
(
salaryAmt
);
//需要支付的总金额
//需要支付的总金额
BigDecimal
totalAmount
=
getOrderNumberVO
.
getOrderAmount
().
add
(
OrderLevelEnum
.
match
(
getOrderNumberVO
.
getOrderLevelEnum
().
getKey
()).
getValue
());
BigDecimal
totalAmount
=
getOrderNumberVO
.
getOrderAmount
().
add
(
OrderLevelEnum
.
match
(
getOrderNumberVO
.
getOrderLevelEnum
().
getKey
()).
getValue
());
BigDecimal
rushAndTop
=
OrderLevelEnum
.
match
(
getOrderNumberVO
.
getOrderLevelEnum
().
getKey
()).
getValue
();
if
(
getOrderNumberVO
.
getOrderMode
()
==
2
)
{
String
orderLevelEnum
=
OrderLevelEnum
.
match
(
getOrderNumberVO
.
getOrderLevelEnum
().
getKey
()).
getKey
();
BigDecimal
bigDecimal
=
new
BigDecimal
(
0.3
);
//需要支付的总金额
totalAmount
=
totalAmount
.
multiply
(
bigDecimal
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
BigDecimal
orderAmount
=
getOrderNumberVO
.
getOrderAmount
();
}
//需要冻结的金额
WalletFlowVO
walletFlowVO
=
new
WalletFlowVO
();
BigDecimal
tempTotalAmount
=
totalAmount
;
String
paymentType
=
getOrderNumberVO
.
getPaymentType
();
String
paymentType
=
getOrderNumberVO
.
getPaymentType
();
String
[]
split
=
paymentType
.
split
(
","
);
String
[]
split
=
paymentType
.
split
(
","
);
Set
<
String
>
collect
=
Arrays
.
asList
(
split
).
stream
().
collect
(
Collectors
.
toSet
());
Set
<
String
>
collect
=
Arrays
.
asList
(
split
).
stream
().
collect
(
Collectors
.
toSet
());
TreeSet
<
String
>
objects
=
new
TreeSet
<>(
collect
);
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
)
{
for
(
String
type
:
objects
)
{
switch
(
type
)
{
switch
(
type
)
{
case
"1"
:
case
"1"
:
if
(!(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
))
{
if
(!(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
))
{
if
(
cashAmt
.
compareTo
(
tempTotalAmount
)
==
1
||
cashAmt
.
compareTo
(
tempTotalAmount
)
==
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
;
tempTotalAmount
=
BigDecimal
.
ZERO
;
}
else
{
}
else
{
tempTotalAmount
=
tempTotalAmount
.
subtract
(
cashAmt
);
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
;
break
;
case
"2"
:
case
"2"
:
if
(!(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
))
{
if
(!(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
))
{
if
(
salaryAmt
.
compareTo
(
tempTotalAmount
)
==
1
||
salaryAmt
.
compareTo
(
tempTotalAmount
)
==
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
;
tempTotalAmount
=
BigDecimal
.
ZERO
;
}
else
{
}
else
{
tempTotalAmount
=
tempTotalAmount
.
subtract
(
salaryAmt
);
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
;
break
;
case
"3"
:
case
"3"
:
if
(!(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
))
{
if
(!(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
))
{
walletFlowVO
.
setWeChat
(
tempTotalAmount
);
//需要支付微信
requirementsInfoDO
.
setLevelWeChatAmount
(
tempTotalAmount
);
// walletFlowVO.setWeChat(tempTotalAmount);
tempTotalAmount
=
BigDecimal
.
ZERO
;
tempTotalAmount
=
BigDecimal
.
ZERO
;
}
}
break
;
break
;
...
@@ -305,241 +348,130 @@ public class RequirementsServiceImpl implements RequirementsService {
...
@@ -305,241 +348,130 @@ public class RequirementsServiceImpl implements RequirementsService {
}
}
}
}
System
.
out
.
println
(
requirementsInfoDO
);
System
.
out
.
println
(
publisherWalletFlowVO
);
if
(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
if
(
orderLevelEnum
.
equals
(
"RUSH_ORDER"
))
{
//表示订单计算完成,需要支付的钱都算出来了
//加急的云享金
walletFlowVO
.
toString
();
BigDecimal
urgentYxjAmount
=
publisherWalletFlowVO
.
getUrgentYxjAmount
();
System
.
out
.
println
(
walletFlowVO
);
userCashAmt
=
cashAmt
.
subtract
(
urgentYxjAmount
);
orderNumberDTO
.
setWeChatPay
(
walletFlowVO
.
getWeChat
());
BigDecimal
urgentSalaryAmount
=
publisherWalletFlowVO
.
getUrgentSalaryAmount
();
if
(
orderNumberDTO
.
getWeChatPay
()
!=
null
)
{
userSalaryAmt
=
salaryAmt
.
subtract
(
urgentSalaryAmount
);
orderNumberDTO
.
setPaymentOrderNumber
(
randomOrderCode
());
}
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
));
tempTotalAmount
=
orderAmount
;
return
ResultBody
.
success
(
orderNumberDTO
);
//剩下的用于支付任务佣金
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
{
}
else
{
//云享金和佣金扣除完成,但是还不足支付订单金额,并且没有选择微信支付,所以支付不合法
tempTotalAmount
=
tempTotalAmount
.
subtract
(
userCashAmt
);
return
ResultBody
.
success
(
"下单失败"
);
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);
}
}
//用户剩余的总金额小于需要支付的总金额 云享金及佣金支付 没有选择微信支付
break
;
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) != 0 &&
case
"2"
:
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0 &&
if
(!(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
))
{
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) == 0) {
if
(
userSalaryAmt
.
compareTo
(
tempTotalAmount
)
==
1
||
userSalaryAmt
.
compareTo
(
tempTotalAmount
)
==
0
)
{
publisherWalletFlowVO
.
setSalaryAmount
(
tempTotalAmount
);
return ResultBody.error("云享金加上佣金小于需要总金额,需要加上微信支付");
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);
}
}
break
;
//用户剩余的总金额小于需要支付的总金额 选择了佣金+选择了微信支付
case
"3"
:
if (getOrderNumberVO.getCashAmount().compareTo(BigDecimal.ZERO) == 0 &&
if
(!(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
))
{
getOrderNumberVO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0 &&
// publisherWalletFlowVO.setWeChat(tempTotalAmount);
getOrderNumberVO.getWeChatPay().compareTo(BigDecimal.ZERO) != 0) {
requirementsInfoDO
.
setWeChat
(
tempTotalAmount
);
tempTotalAmount
=
BigDecimal
.
ZERO
;
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
;
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)) {
for
(
String
type
:
objects
)
{
//总金额大于佣金剩余的金额
switch
(
type
)
{
if (totalAmount.compareTo(salaryAmt) == 1) {
case
"1"
:
return ResultBody.error(ResultEnum.SALARY_PAYMENT_FAILURE);
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);
}
}
}
}
//单独微信微信 可以进行支付
break
;
if (cashAmount.equals(BigDecimal.ZERO) && salaryAmount.equals(BigDecimal.ZERO) && !weChat.equals(BigDecimal.ZERO)) {
case
"2"
:
orderNumberDTO.setWeChatPay(totalAmount);
if
(!(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
))
{
orderNumberDTO.setPaymentOrderNumber(randomOrder);
if
(
salaryAmt
.
compareTo
(
tempTotalAmount
)
==
1
||
salaryAmt
.
compareTo
(
tempTotalAmount
)
==
0
)
{
return ResultBody.success(orderNumberDTO);
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)) {
break
;
BigDecimal subtract = totalAmount.subtract(cashAmt);
default
:
orderNumberDTO.setWeChatPay(subtract);
break
;
orderNumberDTO.setPaymentOrderNumber(randomOrder);
return ResultBody.success(orderNumberDTO);
}
}
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
(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
if (salary.compareTo(BigDecimal.ZERO) == 0) {
//表示订单计算完成,需要支付的钱都算出来了
return ResultBody.error(ResultEnum.SALARY_IS_ENOUGH);
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
);
return
ResultBody
.
success
(
orderNumberDTO
);
}*/
}
else
{
//云享金和佣金扣除完成,但是还不足支付订单金额,并且没有选择微信支付,所以支付不合法
return
ResultBody
.
success
(
"下单失败"
);
}
}
}
...
@@ -626,15 +558,26 @@ public class RequirementsServiceImpl implements RequirementsService {
...
@@ -626,15 +558,26 @@ public class RequirementsServiceImpl implements RequirementsService {
//需要冻结的金额
//需要冻结的金额
WalletFlowVO
walletFlowVO
=
new
WalletFlowVO
();
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
);
ServiceRequirementsDO
requirementsInfoDO
=
new
ServiceRequirementsDO
(
serviceRequirementsVO
);
requirementsInfoDO
.
setPublisherNumber
(
randomOrderCode
());
requirementsInfoDO
.
setPublisherNumber
(
randomOrderCode
());
IsNullConvertZeroUtil
.
checkIsNull
(
publisherWalletFlowVO
);
IsNullConvertZeroUtil
.
checkIsNull
(
requirementsInfoDO
);
//获取用户钱包
//获取用户钱包
ResultBody
resultBody
=
getCurrentUserPayWalletInfo
(
request
);
ResultBody
resultBody
=
getCurrentUserPayWalletInfo
(
request
);
PayWalletDTO
payWalletDTO
=
(
PayWalletDTO
)
resultBody
.
getResult
();
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
();
BigDecimal
cashAmt
=
payWalletDTO
.
getCashAmt
();
//佣金
//佣金
...
@@ -643,40 +586,83 @@ public class RequirementsServiceImpl implements RequirementsService {
...
@@ -643,40 +586,83 @@ public class RequirementsServiceImpl implements RequirementsService {
String
json
=
stringRedisTemplate
.
opsForValue
().
get
(
requirementsInfoDO
.
getWechatPayOrderNumber
()
+
requirementsInfoDO
.
getUserAccountId
());
String
json
=
stringRedisTemplate
.
opsForValue
().
get
(
requirementsInfoDO
.
getWechatPayOrderNumber
()
+
requirementsInfoDO
.
getUserAccountId
());
GetOrderNumberDTO
orderNumberDTO
=
JSONObject
.
parseObject
(
json
,
GetOrderNumberDTO
.
class
);
GetOrderNumberDTO
orderNumberDTO
=
JSONObject
.
parseObject
(
json
,
GetOrderNumberDTO
.
class
);
BigDecimal
tempTotalAmount
=
totalAmount
;
String
paymentType
=
requirementsInfoDO
.
getPaymentType
();
String
paymentType
=
requirementsInfoDO
.
getPaymentType
();
String
[]
split
=
paymentType
.
split
(
","
);
String
[]
split
=
paymentType
.
split
(
","
);
Set
<
String
>
collect
=
Arrays
.
asList
(
split
).
stream
().
collect
(
Collectors
.
toSet
());
Set
<
String
>
collect
=
Arrays
.
asList
(
split
).
stream
().
collect
(
Collectors
.
toSet
());
TreeSet
<
String
>
objects
=
new
TreeSet
<>(
collect
);
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
)
{
for
(
String
type
:
objects
)
{
switch
(
type
)
{
switch
(
type
)
{
case
"1"
:
case
"1"
:
if
(!(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
))
{
if
(!(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
))
{
if
(
cashAmt
.
compareTo
(
tempTotalAmount
)
==
1
||
cashAmt
.
compareTo
(
tempTotalAmount
)
==
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
;
tempTotalAmount
=
BigDecimal
.
ZERO
;
}
else
{
}
else
{
tempTotalAmount
=
tempTotalAmount
.
subtract
(
cashAmt
);
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
;
break
;
case
"2"
:
case
"2"
:
if
(!(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
))
{
if
(!(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
))
{
if
(
salaryAmt
.
compareTo
(
tempTotalAmount
)
==
1
||
salaryAmt
.
compareTo
(
tempTotalAmount
)
==
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
;
tempTotalAmount
=
BigDecimal
.
ZERO
;
}
else
{
}
else
{
tempTotalAmount
=
tempTotalAmount
.
subtract
(
salaryAmt
);
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
;
break
;
case
"3"
:
case
"3"
:
if
(!(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
))
{
if
(!(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
))
{
walletFlowVO
.
setWeChat
(
tempTotalAmount
);
//需要支付微信
requirementsInfoDO
.
setLevelWeChatAmount
(
tempTotalAmount
);
// walletFlowVO.setWeChat(tempTotalAmount);
tempTotalAmount
=
BigDecimal
.
ZERO
;
tempTotalAmount
=
BigDecimal
.
ZERO
;
}
}
break
;
break
;
...
@@ -684,140 +670,155 @@ public class RequirementsServiceImpl implements RequirementsService {
...
@@ -684,140 +670,155 @@ public class RequirementsServiceImpl implements RequirementsService {
break
;
break
;
}
}
}
}
if
(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
//表示订单计算完成,需要支付的钱都算出来了
System
.
out
.
println
(
requirementsInfoDO
);
walletFlowVO
.
toString
();
System
.
out
.
println
(
publisherWalletFlowVO
);
System
.
out
.
println
(
walletFlowVO
);
//orderNumberDTO.setWeChatPay(walletFlowVO.getWeChat());
if
(
orderLevelEnum
.
equals
(
"RUSH_ORDER"
))
{
/*if (orderNumberDTO.getWeChatPay() != null) {
//加急的云享金
orderNumberDTO.setPaymentOrderNumber(randomOrderCode());
BigDecimal
urgentYxjAmount
=
publisherWalletFlowVO
.
getUrgentYxjAmount
();
}*/
userCashAmt
=
cashAmt
.
subtract
(
urgentYxjAmount
);
requirementsInfoDO
.
setCashAmount
(
walletFlowVO
.
getCashAmount
());
BigDecimal
urgentSalaryAmount
=
publisherWalletFlowVO
.
getUrgentSalaryAmount
();
requirementsInfoDO
.
setSalaryAmount
(
walletFlowVO
.
getSalaryAmount
());
userSalaryAmt
=
salaryAmt
.
subtract
(
urgentSalaryAmount
);
requirementsInfoDO
.
setWeChat
(
walletFlowVO
.
getWeChat
());
if
(
orderNumberDTO
!=
null
)
{
}
else
if
(
orderLevelEnum
.
equals
(
"TOP_ORDER"
))
{
requirementsInfoDO
.
setWechatPayOrderNumber
(
orderNumberDTO
.
getPaymentOrderNumber
());
//置顶的云享金
}
else
if
(
orderNumberDTO
==
null
)
{
BigDecimal
topYxjAmount
=
publisherWalletFlowVO
.
getTopYxjAmount
();
requirementsInfoDO
.
setWechatPayOrderNumber
(
null
);
userCashAmt
=
cashAmt
.
subtract
(
topYxjAmount
);
BigDecimal
topSalaryAmount
=
publisherWalletFlowVO
.
getTopSalaryAmount
();
userSalaryAmt
=
salaryAmt
.
subtract
(
topSalaryAmount
);
}
}
requirementsDao
.
addPublishService
(
requirementsInfoDO
);
RequirementsAmountDO
requirementsAmountDO
=
new
RequirementsAmountDO
(
requirementsInfoDO
);
requirementsDao
.
addAmount
(
requirementsAmountDO
);
tempTotalAmount
=
orderAmount
;
return
ResultBody
.
success
();
//剩下的用于支付任务佣金
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
{
}
else
{
//云享金和佣金扣除完成,但是还不足支付订单金额,并且没有选择微信支付,所以支付不合法
tempTotalAmount
=
tempTotalAmount
.
subtract
(
userCashAmt
);
return
ResultBody
.
success
(
"下单失败"
);
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);
}
}
//云享金足够 不扣除佣金剩余的金额
break
;
if (cash.compareTo(BigDecimal.ZERO) > 0) {
case
"2"
:
walletFlowVO.setCashAmount(cash.negate());
if
(!(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
))
{
extracted(walletFlowVO, requirementsInfoDO);
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);
if
(
rushAndTop
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
extracted(walletFlowVO, requirementsInfoDO);
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)) {
break
;
BigDecimal cash = cashAmt.subtract(totalAmount);
case
"3"
:
BigDecimal salary = salaryAmt.subtract(cash.negate());
if
(!(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
))
{
// 如果云享金充足
requirementsInfoDO
.
setWeChat
(
tempTotalAmount
);
if (cash.compareTo(BigDecimal.ZERO) >= 0) {
tempTotalAmount
=
BigDecimal
.
ZERO
;
walletFlowVO.setCashAmount(totalAmount);
}
}
if (cash.compareTo(BigDecimal.ZERO) < 0 && salary.compareTo(BigDecimal.ZERO) >= 0) {
break
;
walletFlowVO.setCashAmount(cashAmt.negate());
default
:
walletFlowVO.setSalaryAmount(cash);
break
;
extracted(walletFlowVO, requirementsInfoDO);
}
}
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
)
{
if
(
requirementsAmountDO
.
getCashAmount
().
compareTo
(
BigDecimal
.
ZERO
)
!=
0
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
// 设置日期格式
||
requirementsAmountDO
.
getSalaryAmount
().
compareTo
(
BigDecimal
.
ZERO
)
!=
0
walletFlowVO
.
setWeChat
(
walletFlowVO
.
getWeChat
());
||
requirementsAmountDO
.
getLevelCashAmount
().
compareTo
(
BigDecimal
.
ZERO
)
!=
0
walletFlowVO
.
setModeOfPayment
(
300
);
||
requirementsAmountDO
.
getLevelSalaryAmount
().
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
walletFlowVO
.
setTimeOfPayment
(
df
.
format
(
new
Date
()
));
feignWalletFlow
(
publisherWalletFlowVO
,
request
.
getHeader
(
"token"
));
walletFlowVO
.
setUserAccountId
(
requirementsInfoDO
.
getUserAccountId
());
}
walletFlowVO
.
setOperateUserAccountId
(
requirementsInfoDO
.
getUserAccountId
()
);
return
ResultBody
.
success
(
);
walletFlowVO
.
setCashAmount
(
walletFlowVO
.
getCashAmount
());
}
else
{
walletFlowVO
.
setSalaryAmount
(
walletFlowVO
.
getSalaryAmount
());
//云享金和佣金扣除完成,但是还不足支付订单金额,并且没有选择微信支付,所以支付不合法
System
.
out
.
println
(
walletFlowVO
);
return
ResultBody
.
success
(
"下单失败"
);
}
}
}
/**
/**
* 获取用户钱包信息
* 获取用户钱包信息
...
@@ -858,8 +859,8 @@ public class RequirementsServiceImpl implements RequirementsService {
...
@@ -858,8 +859,8 @@ public class RequirementsServiceImpl implements RequirementsService {
@Override
@Override
public
ResultBody
grabTheOrder
(
GrabTheOrderVO
grabTheOrderVO
,
HttpServletRequest
request
)
{
public
ResultBody
grabTheOrder
(
GrabTheOrderVO
grabTheOrderVO
,
HttpServletRequest
request
)
{
ServiceRequirementsDO
requirementsInfoDO
=
requirementsDao
.
grabTheOrder
(
grabTheOrderVO
.
get
PublisherNumber
());
ServiceRequirementsDO
requirementsInfoDO
=
requirementsDao
.
grabTheOrder
(
grabTheOrderVO
.
get
RequirementsInfoId
());
if
(
grabTheOrderVO
.
get
PublisherNumber
().
equals
(
requirementsInfoDO
.
getPublisherNumber
())
&&
grabTheOrderVO
.
getUserAccountId
().
equals
(
requirementsInfoDO
.
getUserAccountId
()))
{
if
(
grabTheOrderVO
.
get
RequirementsInfoId
().
equals
(
requirementsInfoDO
.
getId
())
&&
grabTheOrderVO
.
getUserAccountId
().
equals
(
requirementsInfoDO
.
getUserAccountId
()))
{
return
ResultBody
.
error
(
"自己不能抢自己发布的需求"
);
return
ResultBody
.
error
(
"自己不能抢自己发布的需求"
);
}
}
//飞手
//飞手
...
@@ -876,7 +877,8 @@ public class RequirementsServiceImpl implements RequirementsService {
...
@@ -876,7 +877,8 @@ public class RequirementsServiceImpl implements RequirementsService {
// requirementsInfoDO.setPublisherNumber(randomOrderCode());
// requirementsInfoDO.setPublisherNumber(randomOrderCode());
ResultBody
resultBody
=
getCurrentUserPayWalletInfo
(
request
);
ResultBody
resultBody
=
getCurrentUserPayWalletInfo
(
request
);
PayWalletDTO
payWalletDTO
=
(
PayWalletDTO
)
resultBody
.
getResult
();
PayWalletDTO
payWalletDTO
=
(
PayWalletDTO
)
resultBody
.
getResult
();
RequirementsServiceDO
requirementsServiceDO
=
new
RequirementsServiceDO
(
pilot
,
requirementsInfoDO
);
IsNullConvertZeroUtil
.
checkIsNull
(
requirementsServiceDO
);
//用户云享金+用户佣金>总金额
//用户云享金+用户佣金>总金额
//剩余后台云享金
//剩余后台云享金
...
@@ -889,10 +891,12 @@ public class RequirementsServiceImpl implements RequirementsService {
...
@@ -889,10 +891,12 @@ public class RequirementsServiceImpl implements RequirementsService {
BigDecimal
totalAmount
=
requirementsInfoDO
.
getOrderAmount
();
BigDecimal
totalAmount
=
requirementsInfoDO
.
getOrderAmount
();
BigDecimal
bigDecimal
=
new
BigDecimal
(
0.3
);
BigDecimal
bigDecimal
=
new
BigDecimal
(
0.3
);
totalAmount
=
totalAmount
.
multiply
(
bigDecimal
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
totalAmount
=
totalAmount
.
multiply
(
bigDecimal
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
String
json
=
stringRedisTemplate
.
opsForValue
().
get
(
requirementsInfoDO
.
getWechatPayOrderNumber
()
+
requirementsInfoD
O
.
getUserAccountId
());
String
json
=
stringRedisTemplate
.
opsForValue
().
get
(
grabTheOrderVO
.
getWechatPayOrderNumber
()
+
grabTheOrderV
O
.
getUserAccountId
());
GetOrderNumberDTO
orderNumberDTO
=
JSONObject
.
parseObject
(
json
,
GetOrderNumberDTO
.
class
);
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
;
BigDecimal
tempTotalAmount
=
totalAmount
;
String
paymentType
=
grabTheOrderVO
.
getPaymentType
();
String
paymentType
=
grabTheOrderVO
.
getPaymentType
();
String
[]
split
=
paymentType
.
split
(
","
);
String
[]
split
=
paymentType
.
split
(
","
);
...
@@ -903,28 +907,33 @@ public class RequirementsServiceImpl implements RequirementsService {
...
@@ -903,28 +907,33 @@ public class RequirementsServiceImpl implements RequirementsService {
case
"1"
:
case
"1"
:
if
(!(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
))
{
if
(!(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
))
{
if
(
cashAmt
.
compareTo
(
tempTotalAmount
)
==
1
||
cashAmt
.
compareTo
(
tempTotalAmount
)
==
0
)
{
if
(
cashAmt
.
compareTo
(
tempTotalAmount
)
==
1
||
cashAmt
.
compareTo
(
tempTotalAmount
)
==
0
)
{
walletFlowVO
.
setCashAmount
(
tempTotalAmount
);
flyerWalletFlowVO
.
setCashAmount
(
tempTotalAmount
);
requirementsServiceDO
.
setCashAmount
(
tempTotalAmount
);
tempTotalAmount
=
BigDecimal
.
ZERO
;
tempTotalAmount
=
BigDecimal
.
ZERO
;
}
else
{
}
else
{
tempTotalAmount
=
tempTotalAmount
.
subtract
(
cashAmt
);
tempTotalAmount
=
tempTotalAmount
.
subtract
(
cashAmt
);
walletFlowVO
.
setCashAmount
(
cashAmt
);
flyerWalletFlowVO
.
setCashAmount
(
cashAmt
);
requirementsServiceDO
.
setCashAmount
(
cashAmt
);
}
}
}
}
break
;
break
;
case
"2"
:
case
"2"
:
if
(!(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
))
{
if
(!(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
))
{
if
(
salaryAmt
.
compareTo
(
tempTotalAmount
)
==
1
||
salaryAmt
.
compareTo
(
tempTotalAmount
)
==
0
)
{
if
(
salaryAmt
.
compareTo
(
tempTotalAmount
)
==
1
||
salaryAmt
.
compareTo
(
tempTotalAmount
)
==
0
)
{
walletFlowVO
.
setSalaryAmount
(
tempTotalAmount
);
flyerWalletFlowVO
.
setSalaryAmount
(
tempTotalAmount
);
requirementsServiceDO
.
setSalaryAmount
(
tempTotalAmount
);
tempTotalAmount
=
BigDecimal
.
ZERO
;
tempTotalAmount
=
BigDecimal
.
ZERO
;
}
else
{
}
else
{
tempTotalAmount
=
tempTotalAmount
.
subtract
(
salaryAmt
);
tempTotalAmount
=
tempTotalAmount
.
subtract
(
salaryAmt
);
walletFlowVO
.
setSalaryAmount
(
salaryAmt
);
flyerWalletFlowVO
.
setSalaryAmount
(
salaryAmt
);
requirementsServiceDO
.
setSalaryAmount
(
salaryAmt
);
}
}
}
}
break
;
break
;
case
"3"
:
case
"3"
:
if
(!(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
))
{
if
(!(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
))
{
walletFlowVO
.
setWeChat
(
tempTotalAmount
);
// publisherWalletFlowVO.setWeChat(tempTotalAmount);
requirementsServiceDO
.
setWeChat
(
tempTotalAmount
);
tempTotalAmount
=
BigDecimal
.
ZERO
;
tempTotalAmount
=
BigDecimal
.
ZERO
;
}
}
break
;
break
;
...
@@ -934,19 +943,33 @@ public class RequirementsServiceImpl implements RequirementsService {
...
@@ -934,19 +943,33 @@ public class RequirementsServiceImpl implements RequirementsService {
}
}
if
(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
if
(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
//表示订单计算完成,需要支付的钱都算出来了
//表示订单计算完成,需要支付的钱都算出来了
walletFlowVO
.
toString
();
System
.
out
.
println
(
flyerWalletFlowVO
);
System
.
out
.
println
(
walletFlowVO
);
System
.
out
.
println
(
requirementsServiceDO
);
RequirementsServiceDO
requirementsServiceDO
=
new
RequirementsServiceDO
(
pilot
,
requirementsInfoDO
);
requirementsServiceDO
.
setCashAmount
(
walletFlowVO
.
getCashAmount
());
requirementsServiceDO
.
setSalaryAmount
(
walletFlowVO
.
getSalaryAmount
());
flyerWalletFlowVO
.
setUserAccountId
(
grabTheOrderVO
.
getUserAccountId
());
flyerWalletFlowVO
.
setOperateUserAccountId
(
grabTheOrderVO
.
getUserAccountId
());
// requirementsServiceDO.setCashAmount(walletFlowVO.getCashAmount());
// requirementsServiceDO.setSalaryAmount(walletFlowVO.getSalaryAmount());
requirementsServiceDO
.
setWeChat
(
orderNumberDTO
.
getWeChatPay
());
requirementsServiceDO
.
setWeChat
(
orderNumberDTO
.
getWeChatPay
());
requirementsServiceDO
.
setWechatPayOrderNumber
(
orderNumberDTO
.
getPaymentOrderNumber
());
requirementsServiceDO
.
setWechatPayOrderNumber
(
orderNumberDTO
.
getPaymentOrderNumber
());
BigDecimal
cashAndSalaryAmount
=
walletFlowVO
.
getCashAmount
().
add
(
walletFlowVO
.
getSalaryAmount
());
// BigDecimal cashAndSalaryAmount = walletFlowVO.getCashAmount().add(walletFlowVO.getSalaryAmount());
BigDecimal
preemptTotalAmount
=
cashAndSalaryAmount
.
add
(
orderNumberDTO
.
getWeChatPay
());
// BigDecimal preemptTotalAmount = cashAndSalaryAmount.add(orderNumberDTO.getWeChatPay());
requirementsServiceDO
.
setPreemptTotalAmount
(
preemptTotalAmount
);
// 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
);
requirementsDao
.
insertService
(
requirementsServiceDO
);
requirementsInfoDO
.
setRepertory
(
repertory
-
1
);
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
();
return
ResultBody
.
success
();
}
else
{
}
else
{
//云享金和佣金扣除完成,但是还不足支付订单金额,并且没有选择微信支付,所以支付不合法
//云享金和佣金扣除完成,但是还不足支付订单金额,并且没有选择微信支付,所以支付不合法
...
@@ -1050,6 +1073,49 @@ public class RequirementsServiceImpl implements RequirementsService {
...
@@ -1050,6 +1073,49 @@ public class RequirementsServiceImpl implements RequirementsService {
return
body
;
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
)
{
public
ResultBody
releaseOrder
(
RequirementsInfoVO
requirementsInfoVO
,
String
token
)
{
HttpHeaders
headers
=
new
HttpHeaders
();
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
...
...
release-service/src/main/resources/mapper/requirements/RequirementsDao.xml
浏览文件 @
d2bf82b5
...
@@ -281,7 +281,7 @@
...
@@ -281,7 +281,7 @@
FROM requirements_info ri
FROM requirements_info ri
LEFT JOIN requirements_type rt
LEFT JOIN requirements_type rt
ON rt.id = ri.requirement_type_id
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
LEFT JOIN requirements_amount ra ON ra.requirements_info_id = ri.id
AND ra.user_account_id = ri.user_account_id
AND ra.user_account_id = ri.user_account_id
WHERE ri.id = #{id}
WHERE ri.id = #{id}
...
@@ -304,10 +304,12 @@
...
@@ -304,10 +304,12 @@
keyProperty=
"id"
useGeneratedKeys=
"true"
>
keyProperty=
"id"
useGeneratedKeys=
"true"
>
INSERT INTO requirements_amount(requirements_info_id, user_account_id, create_time, update_time, order_amount,
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,
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},
VALUES (#{requirementsInfoId}, #{userAccountId}, NOW(), NOW(), #{orderAmount},
#{totalAmount}, #{orderLevelAmount}, #{orderLevel}, #{cashAmount}, #{weChat},
#{totalAmount}, #{orderLevelAmount}, #{orderLevel}, #{cashAmount}, #{weChat},
#{salaryAmount}, #{wechatPayOrderNumber});
#{salaryAmount}, #{wechatPayOrderNumber}, #{levelCashAmount}, #{levelWeChatAmount},
#{levelSalaryAmount});
</insert>
</insert>
<select
id=
"grabTheOrder"
resultType=
"com.mmc.csf.release.entity.requirements.ServiceRequirementsDO"
>
<select
id=
"grabTheOrder"
resultType=
"com.mmc.csf.release.entity.requirements.ServiceRequirementsDO"
>
...
@@ -326,16 +328,18 @@
...
@@ -326,16 +328,18 @@
ri.publish_phone,
ri.publish_phone,
ri.publisher_number,
ri.publisher_number,
ri.service_id,
ri.service_id,
r
i
.total_amount,
r
a
.total_amount,
ri.repertory,
ri.repertory,
ri.order_level,
ra.order_level,
ri.cash_amount,
ra.cash_amount,
ri.we_chat,
ra.we_chat,
ri.salary_amount,
ra.salary_amount,
ri.wechat_pay_order_number
ra.wechat_pay_order_number,
ra.order_amount
FROM requirements_info ri
FROM requirements_info ri
LEFT JOIN requirements_type rt ON rt.id = ri.requirement_type_id
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>
</select>
<update
id=
"updateGrabTheOrder"
>
<update
id=
"updateGrabTheOrder"
>
...
@@ -343,7 +347,7 @@
...
@@ -343,7 +347,7 @@
set repertory=#{repertory},
set repertory=#{repertory},
service_flow_id = 2,
service_flow_id = 2,
update_time=NOW()
update_time=NOW()
where
publisher_number = #{publisherNumber
}
where
id = #{requirementsInfoId
}
</update>
</update>
<insert
id=
"insertService"
parameterType=
"com.mmc.csf.release.entity.requirements.RequirementsServiceDO"
<insert
id=
"insertService"
parameterType=
"com.mmc.csf.release.entity.requirements.RequirementsServiceDO"
...
@@ -354,7 +358,7 @@
...
@@ -354,7 +358,7 @@
wechat_pay_order_number, service_flow_id, preempt_total_amount)
wechat_pay_order_number, service_flow_id, preempt_total_amount)
VALUES (#{requirementsInfoId}, #{pilotCertificationId}, #{pilotCertificationUserId},
VALUES (#{requirementsInfoId}, #{pilotCertificationId}, #{pilotCertificationUserId},
#{teamId}, #{teamUserId}, #{cashAmount}, #{weChat}, #{salaryAmount}, #{wechatPayOrderNumber}, 2,
#{teamId}, #{teamUserId}, #{cashAmount}, #{weChat}, #{salaryAmount}, #{wechatPayOrderNumber}, 2,
preemptTotalAmount
);
#{preemptTotalAmount}
);
</insert>
</insert>
<insert
id=
"arriveAtTheScene"
parameterType=
"com.mmc.csf.release.entity.requirements.ServiceArriveSceneDO"
<insert
id=
"arriveAtTheScene"
parameterType=
"com.mmc.csf.release.entity.requirements.ServiceArriveSceneDO"
...
@@ -472,7 +476,7 @@
...
@@ -472,7 +476,7 @@
FROM requirements_info ri
FROM requirements_info ri
LEFT JOIN requirements_type rt
LEFT JOIN requirements_type rt
ON rt.id = ri.requirement_type_id
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}
WHERE ri.user_account_id = #{userAccountId}
ORDER BY ri.order_level_amount desc,
ORDER BY ri.order_level_amount desc,
ri.id desc
ri.id desc
...
@@ -507,7 +511,7 @@
...
@@ -507,7 +511,7 @@
ri.order_amount,
ri.order_amount,
FROM requirements_info ri
FROM requirements_info ri
LEFT JOIN requirements_type rt ON rt.id = ri.requirement_type_id
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
INNER JOIN requirements_service rs ON ri.id = rs.requirements_info_id
WHERE rs.pilot_certification_user_id = #{userAccountId}
WHERE rs.pilot_certification_user_id = #{userAccountId}
ORDER BY ri.order_level_amount desc,
ORDER BY ri.order_level_amount desc,
...
@@ -548,7 +552,7 @@
...
@@ -548,7 +552,7 @@
FROM requirements_info ri
FROM requirements_info ri
LEFT JOIN requirements_type rt
LEFT JOIN requirements_type rt
ON rt.id = ri.requirement_type_id
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
INNER JOIN requirements_service rs ON ri.id = rs.requirements_info_id
WHERE rs.pilot_certification_user_id = #{userAccountId}
WHERE rs.pilot_certification_user_id = #{userAccountId}
and rs.requirements_info_id = #{requirementsInfoId}
and rs.requirements_info_id = #{requirementsInfoId}
...
@@ -582,7 +586,7 @@
...
@@ -582,7 +586,7 @@
ri.publish
ri.publish
FROM requirements_info ri
FROM requirements_info ri
LEFT JOIN requirements_type rt ON rt.id = ri.requirement_type_id
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}
WHERE ri.user_account_id = #{userAccountId}
AND ri.id = #{requirementsInfoId}
AND ri.id = #{requirementsInfoId}
</select>
</select>
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论