Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
I
ims
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
iuav
ims
Commits
ea99992f
提交
ea99992f
authored
11月 10, 2023
作者:
恶龙咆哮
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改问题
上级
fc26fb5e
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
118 行增加
和
100 行删除
+118
-100
RequirementsDao.java
...rc/main/java/com/mmc/csf/release/dao/RequirementsDao.java
+10
-0
RequirementsServiceImpl.java
...mmc/csf/release/service/impl/RequirementsServiceImpl.java
+105
-100
RequirementsDao.xml
...rc/main/resources/mapper/requirements/RequirementsDao.xml
+3
-0
没有找到文件。
release-service/src/main/java/com/mmc/csf/release/dao/RequirementsDao.java
浏览文件 @
ea99992f
...
...
@@ -311,4 +311,14 @@ public interface RequirementsDao {
* @return {@link Integer}
*/
Integer
selectServiceFlowIdByFatherId
(
Integer
requirementsId
);
/**
* 去抢单表中查看用户是否被拒绝过
* @param requireId 订单的id
* @param userAccountId 抢单飞手的用户id
* @return {@link Integer}
*/
Integer
selectRequirementsRefuse
(
Integer
requireId
,
Integer
userAccountId
);
}
release-service/src/main/java/com/mmc/csf/release/service/impl/RequirementsServiceImpl.java
浏览文件 @
ea99992f
...
...
@@ -25,6 +25,7 @@ import com.mmc.csf.release.industry.UserPayInfoVO;
import
com.mmc.csf.release.service.RequirementsService
;
import
com.mmc.csf.release.util.RestTemplateUtil
;
import
com.sun.xml.bind.v2.TODO
;
import
io.swagger.models.auth.In
;
import
lombok.extern.slf4j.Slf4j
;
import
org.gavaghan.geodesy.Ellipsoid
;
import
org.gavaghan.geodesy.GeodeticCalculator
;
...
...
@@ -2883,6 +2884,12 @@ public class RequirementsServiceImpl implements RequirementsService {
//获取没被抢的子订单id
Integer
requirementsSonInfoId
=
requirementsDao
.
getRequirementsSonInfoId
(
fatherRequireId
);
grabTheOrderVO
.
setRequirementsInfoId
(
requirementsSonInfoId
);
}
else
{
//单人被拒绝后也不能再次抢单
Integer
countRefuse
=
requirementsDao
.
selectRequirementsRefuse
(
grabTheOrderVO
.
getRequirementsInfoId
(),
grabTheOrderVO
.
getUserAccountId
());
if
(
countRefuse
==
1
)
{
return
ResultBody
.
error
(
"不能重复抢一个订单"
);
}
}
UserAccountSimpleDTO
userAccountSimpleDTO
=
feignGetUserSimpleInfo
(
grabTheOrderVO
.
getUserAccountId
(),
request
);
...
...
@@ -2892,8 +2899,6 @@ public class RequirementsServiceImpl implements RequirementsService {
if
(
grabTheOrderVO
.
getRequirementsInfoId
().
equals
(
requirementsInfoDO
.
getId
())
&&
grabTheOrderVO
.
getUserAccountId
().
equals
(
requirementsInfoDO
.
getUserAccountId
()))
{
return
ResultBody
.
error
(
"自己不能抢自己发布的需求"
);
}
// TODO 一人订单被拒绝也不能再次抢单
//飞手
PilotCertificationInteriorDTO
pilot
=
feignInteriorDetailPilot
(
grabTheOrderVO
.
getUserAccountId
(),
request
);
...
...
@@ -2912,114 +2917,114 @@ public class RequirementsServiceImpl implements RequirementsService {
RequirementsServiceDO
requirementsServiceDO
=
new
RequirementsServiceDO
(
pilot
,
requirementsInfoDO
);
IsNullConvertZeroUtil
.
checkIsNull
(
requirementsServiceDO
);
//用户云享金+用户佣金>总金额
//剩余后台云享金
BigDecimal
cashAmt
=
payWalletDTO
.
getCashAmt
();
//剩余佣金
BigDecimal
salaryAmt
=
payWalletDTO
.
getSalaryAmt
();
//用户云享金加上佣金的总金额
BigDecimal
cashAndSalary
=
cashAmt
.
add
(
salaryAmt
);
//需要支付的总金额(任务佣金)
BigDecimal
totalAmount
=
requirementsInfoDO
.
getOrderAmount
();
BigDecimal
bigDecimal
=
new
BigDecimal
(
0.0
);
totalAmount
=
totalAmount
.
multiply
(
bigDecimal
).
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
);
String
json
=
stringRedisTemplate
.
opsForValue
().
get
(
grabTheOrderVO
.
getWechatPayOrderNumber
()
+
grabTheOrderVO
.
getUserAccountId
());
GetOrderNumberDTO
orderNumberDTO
=
JSONObject
.
parseObject
(
json
,
GetOrderNumberDTO
.
class
);
if
(
orderNumberDTO
!=
null
)
{
IsNullConvertZeroUtil
.
checkIsNull
(
orderNumberDTO
);
}
//需要冻结的金额
FlyerWalletFlowVO
flyerWalletFlowVO
=
new
FlyerWalletFlowVO
();
IsNullConvertZeroUtil
.
checkIsNull
(
flyerWalletFlowVO
);
//IsNullConvertZeroUtil.checkIsNull(flyerWalletFlowVO);
//PublisherWalletFlowVO publisherWalletFlowVO = walletFlowVO.getPublisherWalletFlowVO();
BigDecimal
tempTotalAmount
=
totalAmount
;
String
paymentType
=
grabTheOrderVO
.
getPaymentType
();
String
[]
split
=
paymentType
.
split
(
","
);
Set
<
String
>
collect
=
Arrays
.
asList
(
split
).
stream
().
collect
(
Collectors
.
toSet
());
TreeSet
<
String
>
objects
=
new
TreeSet
<>(
collect
);
for
(
String
type
:
objects
)
{
switch
(
type
)
{
case
"1"
:
if
(!(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
))
{
if
(
cashAmt
.
compareTo
(
tempTotalAmount
)
==
1
||
cashAmt
.
compareTo
(
tempTotalAmount
)
==
0
)
{
flyerWalletFlowVO
.
setCashAmount
(
tempTotalAmount
);
requirementsServiceDO
.
setCashAmount
(
tempTotalAmount
);
tempTotalAmount
=
BigDecimal
.
ZERO
;
}
else
{
tempTotalAmount
=
tempTotalAmount
.
subtract
(
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
)
{
flyerWalletFlowVO
.
setSalaryAmount
(
tempTotalAmount
);
requirementsServiceDO
.
setSalaryAmount
(
tempTotalAmount
);
tempTotalAmount
=
BigDecimal
.
ZERO
;
}
else
{
tempTotalAmount
=
tempTotalAmount
.
subtract
(
salaryAmt
);
flyerWalletFlowVO
.
setSalaryAmount
(
salaryAmt
);
requirementsServiceDO
.
setSalaryAmount
(
salaryAmt
);
}
}
break
;
case
"3"
:
if
(!(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
))
{
// publisherWalletFlowVO.setWeChat(tempTotalAmount);
requirementsServiceDO
.
setWeChat
(
tempTotalAmount
);
tempTotalAmount
=
BigDecimal
.
ZERO
;
}
break
;
default
:
break
;
}
}
if
(
tempTotalAmount
.
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
//表示订单计算完成,需要支付的钱都算出来了
// System.out.println(flyerWalletFlowVO);
// System.out.println(requirementsServiceDO);
flyerWalletFlowVO
.
setUserAccountId
(
grabTheOrderVO
.
getUserAccountId
());
flyerWalletFlowVO
.
setOperateUserAccountId
(
grabTheOrderVO
.
getUserAccountId
());
// requirementsServiceDO.setCashAmount(walletFlowVO.getCashAmount());
// requirementsServiceDO.setSalaryAmount(walletFlowVO.getSalaryAmount());
if
(
orderNumberDTO
!=
null
)
{
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
cashAmount
=
requirementsServiceDO
.
getCashAmount
();
BigDecimal
salaryAmount
=
requirementsServiceDO
.
getSalaryAmount
();
BigDecimal
weChat
=
requirementsServiceDO
.
getWeChat
();
BigDecimal
add
=
cashAmount
.
add
(
salaryAmount
);
BigDecimal
add1
=
add
.
add
(
weChat
);
requirementsServiceDO
.
setPreemptTotalAmount
(
add1
);
requirementsServiceDO
.
setOpenid
(
openid
);
requirementsServiceDO
.
setPhoneNum
(
grabTheOrderVO
.
getPhoneNum
());
//
//用户云享金+用户佣金>总金额
//
//剩余后台云享金
//
BigDecimal cashAmt = payWalletDTO.getCashAmt();
//
//剩余佣金
//
BigDecimal salaryAmt = payWalletDTO.getSalaryAmt();
//
//用户云享金加上佣金的总金额
//
BigDecimal cashAndSalary = cashAmt.add(salaryAmt);
//
//需要支付的总金额(任务佣金)
//
BigDecimal totalAmount = requirementsInfoDO.getOrderAmount();
//
BigDecimal bigDecimal = new BigDecimal(0.0);
//
totalAmount = totalAmount.multiply(bigDecimal).setScale(2, BigDecimal.ROUND_HALF_UP);
//
String json = stringRedisTemplate.opsForValue().get(grabTheOrderVO.getWechatPayOrderNumber() + grabTheOrderVO.getUserAccountId());
//
GetOrderNumberDTO orderNumberDTO = JSONObject.parseObject(json, GetOrderNumberDTO.class);
//
if (orderNumberDTO != null) {
//
IsNullConvertZeroUtil.checkIsNull(orderNumberDTO);
//
}
//
//
//需要冻结的金额
//
FlyerWalletFlowVO flyerWalletFlowVO = new FlyerWalletFlowVO();
//
IsNullConvertZeroUtil.checkIsNull(flyerWalletFlowVO);
//
//IsNullConvertZeroUtil.checkIsNull(flyerWalletFlowVO);
//
//PublisherWalletFlowVO publisherWalletFlowVO = walletFlowVO.getPublisherWalletFlowVO();
//
BigDecimal tempTotalAmount = totalAmount;
//
String paymentType = grabTheOrderVO.getPaymentType();
//
String[] split = paymentType.split(",");
//
Set<String> collect = Arrays.asList(split).stream().collect(Collectors.toSet());
//
TreeSet<String> objects = new TreeSet<>(collect);
//
for (String type : objects) {
//
switch (type) {
//
case "1":
//
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
//
if (cashAmt.compareTo(tempTotalAmount) == 1 || cashAmt.compareTo(tempTotalAmount) == 0) {
//
flyerWalletFlowVO.setCashAmount(tempTotalAmount);
//
requirementsServiceDO.setCashAmount(tempTotalAmount);
//
tempTotalAmount = BigDecimal.ZERO;
//
} else {
//
tempTotalAmount = tempTotalAmount.subtract(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) {
//
flyerWalletFlowVO.setSalaryAmount(tempTotalAmount);
//
requirementsServiceDO.setSalaryAmount(tempTotalAmount);
//
tempTotalAmount = BigDecimal.ZERO;
//
} else {
//
tempTotalAmount = tempTotalAmount.subtract(salaryAmt);
//
flyerWalletFlowVO.setSalaryAmount(salaryAmt);
//
requirementsServiceDO.setSalaryAmount(salaryAmt);
//
}
//
}
//
break;
//
case "3":
//
if (!(tempTotalAmount.compareTo(BigDecimal.ZERO) == 0)) {
//
// publisherWalletFlowVO.setWeChat(tempTotalAmount);
//
requirementsServiceDO.setWeChat(tempTotalAmount);
//
tempTotalAmount = BigDecimal.ZERO;
//
}
//
break;
//
default:
//
break;
//
}
//
}
//
if (tempTotalAmount.compareTo(BigDecimal.ZERO) == 0) {
//
//表示订单计算完成,需要支付的钱都算出来了
//
// System.out.println(flyerWalletFlowVO);
//
// System.out.println(requirementsServiceDO);
//
//
flyerWalletFlowVO.setUserAccountId(grabTheOrderVO.getUserAccountId());
//
flyerWalletFlowVO.setOperateUserAccountId(grabTheOrderVO.getUserAccountId());
//
// requirementsServiceDO.setCashAmount(walletFlowVO.getCashAmount());
//
// requirementsServiceDO.setSalaryAmount(walletFlowVO.getSalaryAmount());
//
if (orderNumberDTO != null) {
//
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 cashAmount = requirementsServiceDO.getCashAmount();
//
BigDecimal salaryAmount = requirementsServiceDO.getSalaryAmount();
//
BigDecimal weChat = requirementsServiceDO.getWeChat();
//
BigDecimal add = cashAmount.add(salaryAmount);
//
BigDecimal add1 = add.add(weChat);
//
requirementsServiceDO.setPreemptTotalAmount(add1);
//
requirementsServiceDO.setOpenid(openid);
//
requirementsServiceDO.setPhoneNum(grabTheOrderVO.getPhoneNum());
//微信是否支付成功
requirementsDao
.
insertService
(
requirementsServiceDO
);
requirementsInfoDO
.
setRepertory
(
repertory
-
1
);
requirementsDao
.
updateGrabTheOrder
(
grabTheOrderVO
.
getRequirementsInfoId
(),
requirementsInfoDO
.
getRepertory
());
if
(
requirementsServiceDO
.
getCashAmount
().
compareTo
(
BigDecimal
.
ZERO
)
!=
0
||
requirementsServiceDO
.
getSalaryAmount
().
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
walletFlow
(
flyerWalletFlowVO
,
request
.
getHeader
(
"token"
));
}
//
if (requirementsServiceDO.getCashAmount().compareTo(BigDecimal.ZERO) != 0
//
|| requirementsServiceDO.getSalaryAmount().compareTo(BigDecimal.ZERO) != 0) {
//
walletFlow(flyerWalletFlowVO, request.getHeader("token"));
//
}
//如果是多人订单 还要去修改父订单还需多少人字段
if
(
requireNum
>=
2
)
{
requirementsDao
.
updateRequirementsInfoRepertory
(
fatherRequireId
,
fatherRepertory
-
1
);
}
return
ResultBody
.
success
();
}
else
{
//云享金和佣金扣除完成,但是还不足支付订单金额,并且没有选择微信支付,所以支付不合法
return
ResultBody
.
success
(
"抢单失败"
);
}
//
} else {
//
//云享金和佣金扣除完成,但是还不足支付订单金额,并且没有选择微信支付,所以支付不合法
//
return ResultBody.success("抢单失败");
//
}
}
...
...
release-service/src/main/resources/mapper/requirements/RequirementsDao.xml
浏览文件 @
ea99992f
...
...
@@ -1692,4 +1692,7 @@
<select
id=
"selectServiceFlowIdByFatherId"
resultType=
"java.lang.Integer"
>
select count(id) from requirements_info where father_require_id = #{requirementsId} and service_flow_id not in (1,10)
</select>
<select
id=
"selectRequirementsRefuse"
resultType=
"java.lang.Integer"
>
select count(id) from requirements_service where requirements_info_id = #{requireId} and pilot_certification_user_id = #{userAccountId}
</select>
</mapper>
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论