Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
O
oms-ci-test
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
test-ci
oms-ci-test
Commits
846e733a
提交
846e733a
authored
7月 06, 2023
作者:
张小凤
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Price(update)
上级
0a1412cb
显示空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
62 行增加
和
23 行删除
+62
-23
ResultEnum.java
src/main/java/com/mmc/oms/common/ResultEnum.java
+2
-1
PriceAcquisition.java
...ain/java/com/mmc/oms/model/vo/order/PriceAcquisition.java
+3
-1
RentalOrdersServiceImpl.java
...ava/com/mmc/oms/service/Impl/RentalOrdersServiceImpl.java
+56
-19
application-local.yml
src/main/resources/application-local.yml
+1
-2
没有找到文件。
src/main/java/com/mmc/oms/common/ResultEnum.java
浏览文件 @
846e733a
...
@@ -404,7 +404,8 @@ public enum ResultEnum implements BaseErrorInfoInterface {
...
@@ -404,7 +404,8 @@ public enum ResultEnum implements BaseErrorInfoInterface {
NO_PERMISSION_TEMPORARILY
(
"2016"
,
"当前账号没有权限,只有后台账号拥有权限"
),
NO_PERMISSION_TEMPORARILY
(
"2016"
,
"当前账号没有权限,只有后台账号拥有权限"
),
THERE_IS_NO_SUCH_ORDER
(
"2017"
,
"没有当前订单,请输入正确的订单编号"
),
THERE_IS_NO_SUCH_ORDER
(
"2017"
,
"没有当前订单,请输入正确的订单编号"
),
THE_TOKEN_CANNOT_BE_NULL
(
"2018"
,
"token不能为null"
),
THE_TOKEN_CANNOT_BE_NULL
(
"2018"
,
"token不能为null"
),
THE_CURRENT_ACCOUNT_CANNOT_PLACE_ORDERS
(
"2019"
,
"后台管理账号不能下单"
);
THE_CURRENT_ACCOUNT_CANNOT_PLACE_ORDERS
(
"2019"
,
"后台管理账号不能下单"
),
THIRD_PARTY_ERRORS
(
"2020"
,
"第三方接口错误或者第三接口正在更新"
);
/**
/**
* 错误码
* 错误码
...
...
src/main/java/com/mmc/oms/model/vo/order/PriceAcquisition.java
浏览文件 @
846e733a
...
@@ -5,6 +5,8 @@ import lombok.AllArgsConstructor;
...
@@ -5,6 +5,8 @@ import lombok.AllArgsConstructor;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.NoArgsConstructor
;
import
java.util.List
;
/**
/**
* @Author small
* @Author small
* @Date 2023/5/26 14:10
* @Date 2023/5/26 14:10
...
@@ -24,6 +26,6 @@ public class PriceAcquisition {
...
@@ -24,6 +26,6 @@ public class PriceAcquisition {
private
Integer
day
;
private
Integer
day
;
@ApiModelProperty
(
value
=
"渠道等级id"
)
@ApiModelProperty
(
value
=
"渠道等级id"
)
private
Integer
channelLevelId
;
private
List
<
Integer
>
channelLevelId
;
}
}
src/main/java/com/mmc/oms/service/Impl/RentalOrdersServiceImpl.java
浏览文件 @
846e733a
...
@@ -18,6 +18,7 @@ import com.mmc.oms.entity.order.OrderReceiptDO;
...
@@ -18,6 +18,7 @@ import com.mmc.oms.entity.order.OrderReceiptDO;
import
com.mmc.oms.entity.order.OrderRefundDO
;
import
com.mmc.oms.entity.order.OrderRefundDO
;
import
com.mmc.oms.entity.order.OrderVcuDO
;
import
com.mmc.oms.entity.order.OrderVcuDO
;
import
com.mmc.oms.entity.ware.WareInfoDO
;
import
com.mmc.oms.entity.ware.WareInfoDO
;
import
com.mmc.oms.model.dto.mall.CooperationTagVO
;
import
com.mmc.oms.model.dto.order.*
;
import
com.mmc.oms.model.dto.order.*
;
import
com.mmc.oms.model.dto.repo.RepoAccountDTO
;
import
com.mmc.oms.model.dto.repo.RepoAccountDTO
;
import
com.mmc.oms.model.dto.transtatus.TranStatusDicDTO
;
import
com.mmc.oms.model.dto.transtatus.TranStatusDicDTO
;
...
@@ -28,6 +29,7 @@ import com.mmc.oms.model.vo.coupon.AppletMsgVO;
...
@@ -28,6 +29,7 @@ import com.mmc.oms.model.vo.coupon.AppletMsgVO;
import
com.mmc.oms.model.vo.order.*
;
import
com.mmc.oms.model.vo.order.*
;
import
com.mmc.oms.service.RentalOrdersService
;
import
com.mmc.oms.service.RentalOrdersService
;
import
com.mmc.oms.wx.WxMsgTemplete
;
import
com.mmc.oms.wx.WxMsgTemplete
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
...
@@ -40,9 +42,11 @@ import org.springframework.stereotype.Service;
...
@@ -40,9 +42,11 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
org.springframework.transaction.interceptor.TransactionAspectSupport
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.web.client.RestClientException
;
import
org.springframework.web.client.RestTemplate
;
import
org.springframework.web.client.RestTemplate
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -51,6 +55,7 @@ import java.util.stream.Collectors;
...
@@ -51,6 +55,7 @@ import java.util.stream.Collectors;
* @Author small @Date 2023/5/26 10:53 @Version 1.0
* @Author small @Date 2023/5/26 10:53 @Version 1.0
*/
*/
@Service
@Service
@Slf4j
public
class
RentalOrdersServiceImpl
implements
RentalOrdersService
{
public
class
RentalOrdersServiceImpl
implements
RentalOrdersService
{
@Autowired
@Autowired
...
@@ -79,13 +84,20 @@ public class RentalOrdersServiceImpl implements RentalOrdersService {
...
@@ -79,13 +84,20 @@ public class RentalOrdersServiceImpl implements RentalOrdersService {
return
ResultBody
.
error
(
ResultEnum
.
THE_CURRENT_ACCOUNT_CANNOT_PLACE_ORDERS
);
return
ResultBody
.
error
(
ResultEnum
.
THE_CURRENT_ACCOUNT_CANNOT_PLACE_ORDERS
);
}
}
//用户信息的远程调用
//用户信息的远程调用
ResponseEntity
<
String
>
responseEntity
=
UserId
(
user
.
getUserAccountId
(),
user
.
getToken
());
ResultBody
<
ResponseEntity
<
String
>>
responseEntityResultBody
=
UserId
(
user
.
getUserAccountId
(),
user
.
getToken
());
if
(
ResultEnum
.
THIRD_PARTY_ERRORS
.
getResultCode
().
equals
(
responseEntityResultBody
.
getCode
())){
return
ResultBody
.
error
(
ResultEnum
.
THIRD_PARTY_ERRORS
);
}
ResponseEntity
<
String
>
responseEntity
=
responseEntityResultBody
.
getResult
();
UserAccountSimpleDTO
account
=
JSON
.
parseObject
(
responseEntity
.
getBody
(),
UserAccountSimpleDTO
.
class
);
UserAccountSimpleDTO
account
=
JSON
.
parseObject
(
responseEntity
.
getBody
(),
UserAccountSimpleDTO
.
class
);
//优惠券id获取优惠券面值
//优惠券id获取优惠券面值
OrderInfoDO
orderInfo
=
new
OrderInfoDO
(
param
);
OrderInfoDO
orderInfo
=
new
OrderInfoDO
(
param
);
PriceAcquisition
priceAcquisition
=
getPriceAcquisition
(
param
,
account
);
PriceAcquisition
priceAcquisition
=
getPriceAcquisition
(
param
,
account
);
BigDecimal
unitPrice
=
getUnitPrice
(
priceAcquisition
);
ResultBody
<
BigDecimal
>
bigDecimalResultBody
=
getUnitPrice
(
priceAcquisition
);
if
(
ResultEnum
.
THIRD_PARTY_ERRORS
.
getResultCode
().
equals
(
bigDecimalResultBody
.
getCode
())){
return
ResultBody
.
error
(
ResultEnum
.
THIRD_PARTY_ERRORS
);
}
BigDecimal
unitPrice
=
bigDecimalResultBody
.
getResult
();
//每天单价
//每天单价
orderInfo
.
setUnitPrice
(
unitPrice
);
orderInfo
.
setUnitPrice
(
unitPrice
);
// 天数
// 天数
...
@@ -96,6 +108,11 @@ public class RentalOrdersServiceImpl implements RentalOrdersService {
...
@@ -96,6 +108,11 @@ public class RentalOrdersServiceImpl implements RentalOrdersService {
orderInfo
.
setBuyerName
(
user
.
getUserName
());
orderInfo
.
setBuyerName
(
user
.
getUserName
());
orderInfo
.
setBuyerPhone
(
user
.
getPhoneNum
());
orderInfo
.
setBuyerPhone
(
user
.
getPhoneNum
());
orderInfo
.
setNickName
(
user
.
getNickName
());
orderInfo
.
setNickName
(
user
.
getNickName
());
//获取剩余的余额
ResultBody
<
BigDecimal
>
remainingBalance
=
getRemainingBalance
(
user
.
getToken
(),
user
.
getUserAccountId
());
if
(
ResultEnum
.
THIRD_PARTY_ERRORS
.
getResultCode
().
equals
(
remainingBalance
.
getCode
()))
{
return
ResultBody
.
error
(
ResultEnum
.
THIRD_PARTY_ERRORS
);
}
rentalOrdersDao
.
insertOrderInfo
(
orderInfo
);
rentalOrdersDao
.
insertOrderInfo
(
orderInfo
);
// 添加收货地址
// 添加收货地址
Date
cdate
=
new
Date
();
Date
cdate
=
new
Date
();
...
@@ -104,8 +121,7 @@ public class RentalOrdersServiceImpl implements RentalOrdersService {
...
@@ -104,8 +121,7 @@ public class RentalOrdersServiceImpl implements RentalOrdersService {
receipt
.
setOrderInfoId
(
orderInfo
.
getId
());
receipt
.
setOrderInfoId
(
orderInfo
.
getId
());
receipt
.
setCreateTime
(
cdate
);
receipt
.
setCreateTime
(
cdate
);
rentalOrdersDao
.
insertOrderReceipt
(
receipt
);
rentalOrdersDao
.
insertOrderReceipt
(
receipt
);
//获取剩余的余额
orderInfo
.
setBalance
(
remainingBalance
.
getResult
());
orderInfo
.
setBalance
(
getRemainingBalance
(
user
.
getToken
(),
user
.
getUserAccountId
()));
// 将当前的用户id及订单编号存入redis
// 将当前的用户id及订单编号存入redis
OrderInfoDTO
dto
=
orderInfo
.
buildOrderInfoDTO
();
OrderInfoDTO
dto
=
orderInfo
.
buildOrderInfoDTO
();
stringRedisTemplate
.
opsForValue
().
set
(
orderInfo
.
getOrderNo
(),
JsonUtil
.
parseObjToJson
(
dto
));
stringRedisTemplate
.
opsForValue
().
set
(
orderInfo
.
getOrderNo
(),
JsonUtil
.
parseObjToJson
(
dto
));
...
@@ -132,25 +148,36 @@ public class RentalOrdersServiceImpl implements RentalOrdersService {
...
@@ -132,25 +148,36 @@ public class RentalOrdersServiceImpl implements RentalOrdersService {
//远程设置
//远程设置
private
PriceAcquisition
getPriceAcquisition
(
LeaseOrderVO
param
,
UserAccountSimpleDTO
account
)
{
private
PriceAcquisition
getPriceAcquisition
(
LeaseOrderVO
param
,
UserAccountSimpleDTO
account
)
{
List
<
CooperationTagVO
>
cooperationTagVOS
=
account
.
getCooperationTagVOS
();
List
<
Integer
>
list
=
new
ArrayList
<>();
if
(
cooperationTagVOS
!=
null
&&
!
cooperationTagVOS
.
isEmpty
()){
for
(
CooperationTagVO
cooperationTagVO
:
cooperationTagVOS
)
{
list
.
add
(
cooperationTagVO
.
getId
());
}
}
PriceAcquisition
priceAcquisition
=
new
PriceAcquisition
();
PriceAcquisition
priceAcquisition
=
new
PriceAcquisition
();
priceAcquisition
.
setUserId
(
account
.
getId
());
priceAcquisition
.
setUserId
(
account
.
getId
());
priceAcquisition
.
setDay
(
day
(
param
));
priceAcquisition
.
setDay
(
day
(
param
));
priceAcquisition
.
setSpecsId
(
param
.
getSpecsId
());
priceAcquisition
.
setSpecsId
(
param
.
getSpecsId
());
priceAcquisition
.
setChannelLevelId
(
account
.
getCooperationTagId
()
);
priceAcquisition
.
setChannelLevelId
(
list
);
return
priceAcquisition
;
return
priceAcquisition
;
}
}
private
Res
ponseEntity
<
String
>
UserId
(
Integer
repoAccountId
,
String
token
)
{
private
Res
ultBody
<
ResponseEntity
<
String
>
>
UserId
(
Integer
repoAccountId
,
String
token
)
{
ResponseEntity
<
String
>
response
=
null
;
try
{
HttpHeaders
headers
=
new
HttpHeaders
();
HttpHeaders
headers
=
new
HttpHeaders
();
//封装请求头
//封装请求头
headers
.
add
(
"token"
,
token
);
headers
.
add
(
"token"
,
token
);
HttpEntity
<
MultiValueMap
<
String
,
Object
>>
formEntity
=
new
HttpEntity
<
MultiValueMap
<
String
,
Object
>>(
headers
);
HttpEntity
<
MultiValueMap
<
String
,
Object
>>
formEntity
=
new
HttpEntity
<
MultiValueMap
<
String
,
Object
>>(
headers
);
ResponseEntity
<
String
>
response
=
restTemplate
.
exchange
(
userAppUrl
+
"user-account/feignGetUserSimpleInfo?userAccountId="
+
repoAccountId
,
response
=
restTemplate
.
exchange
(
userAppUrl
+
"user-account/feignGetUserSimpleInfo?userAccountId="
+
repoAccountId
,
HttpMethod
.
GET
,
formEntity
,
String
.
class
);
HttpMethod
.
GET
,
formEntity
,
String
.
class
);
log
.
info
(
String
.
valueOf
(
formEntity
));
}
catch
(
RestClientException
e
)
{
return
ResultBody
.
error
(
ResultEnum
.
THIRD_PARTY_ERRORS
);
}
// 用户信息
// 用户信息
/* ResponseEntity<String> response =
/* ResponseEntity<String> response =
restTemplate.getForEntity(
restTemplate.getForEntity(
...
@@ -158,7 +185,7 @@ public class RentalOrdersServiceImpl implements RentalOrdersService {
...
@@ -158,7 +185,7 @@ public class RentalOrdersServiceImpl implements RentalOrdersService {
+ "user-account/feignGetUserSimpleInfo?userAccountId="
+ "user-account/feignGetUserSimpleInfo?userAccountId="
+ repoAccountId,
+ repoAccountId,
String.class);*/
String.class);*/
return
response
;
return
ResultBody
.
success
(
response
)
;
}
}
...
@@ -168,7 +195,9 @@ public class RentalOrdersServiceImpl implements RentalOrdersService {
...
@@ -168,7 +195,9 @@ public class RentalOrdersServiceImpl implements RentalOrdersService {
* @param repoAccountId
* @param repoAccountId
* @return
* @return
*/
*/
public
BigDecimal
getRemainingBalance
(
String
token
,
Integer
repoAccountId
)
{
public
ResultBody
<
BigDecimal
>
getRemainingBalance
(
String
token
,
Integer
repoAccountId
)
{
BigDecimal
bigDecimal
=
null
;
try
{
HttpHeaders
headers
=
new
HttpHeaders
();
HttpHeaders
headers
=
new
HttpHeaders
();
//封装请求头
//封装请求头
headers
.
add
(
"token"
,
token
);
headers
.
add
(
"token"
,
token
);
...
@@ -179,8 +208,11 @@ public class RentalOrdersServiceImpl implements RentalOrdersService {
...
@@ -179,8 +208,11 @@ public class RentalOrdersServiceImpl implements RentalOrdersService {
if
(
body
==
null
)
{
if
(
body
==
null
)
{
body
=
"0"
;
body
=
"0"
;
}
}
BigDecimal
bigDecimal
=
new
BigDecimal
(
body
);
bigDecimal
=
new
BigDecimal
(
body
);
return
bigDecimal
;
}
catch
(
RestClientException
e
)
{
return
ResultBody
.
error
(
ResultEnum
.
THIRD_PARTY_ERRORS
);
}
return
ResultBody
.
success
(
bigDecimal
);
}
}
/**
/**
...
@@ -207,19 +239,24 @@ public class RentalOrdersServiceImpl implements RentalOrdersService {
...
@@ -207,19 +239,24 @@ public class RentalOrdersServiceImpl implements RentalOrdersService {
* @param param
* @param param
* @return
* @return
*/
*/
private
BigDecimal
getUnitPrice
(
PriceAcquisition
param
)
{
private
ResultBody
<
BigDecimal
>
getUnitPrice
(
PriceAcquisition
param
)
{
// 需要支付的价格
// 需要支付的价格
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
postForEntity
(
pmsUrl
+
"/product/spec/feignGetSpecLeaseUnitPrice"
BigDecimal
bigDecimal
=
null
;
try
{
ResponseEntity
<
String
>
responseEntity
=
restTemplate
.
postForEntity
(
pmsUrl
+
"product/spec/feignGetSpecLeaseUnitPrice"
,
param
,
String
.
class
);
,
param
,
String
.
class
);
String
body
=
responseEntity
.
getBody
();
String
body
=
responseEntity
.
getBody
();
if
(
null
==
body
)
{
if
(
null
==
body
)
{
body
=
"0"
;
body
=
"0"
;
}
}
BigDecimal
bigDecimal
=
new
BigDecimal
(
body
);
bigDecimal
=
new
BigDecimal
(
body
);
}
catch
(
RestClientException
e
)
{
return
ResultBody
.
error
(
ResultEnum
.
THIRD_PARTY_ERRORS
);
}
// 模拟
// 模拟
// int i = 12;
// int i = 12;
// BigDecimal bigDecimal = BigDecimal.valueOf(i);
// BigDecimal bigDecimal = BigDecimal.valueOf(i);
return
bigDecimal
;
return
ResultBody
.
success
(
bigDecimal
)
;
}
}
public
Integer
day
(
LeaseOrderVO
param
)
{
public
Integer
day
(
LeaseOrderVO
param
)
{
...
...
src/main/resources/application-local.yml
浏览文件 @
846e733a
...
@@ -7,9 +7,8 @@ spring:
...
@@ -7,9 +7,8 @@ spring:
password
:
MMC@2022&MYSQL
password
:
MMC@2022&MYSQL
redis
:
redis
:
database
:
1
database
:
1
host
:
r-wz9ke310fs684hacn1pd.redis.rds.aliyuncs.com
host
:
127.0.0.1
port
:
6379
port
:
6379
password
:
MMC@2022&REDIS
jedis
:
jedis
:
pool
:
pool
:
max-active
:
2
max-active
:
2
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论