Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
为 GitLab 提交贡献
登录/注册
切换导航
Z
zion
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
1
合并请求
1
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
zhengfg
zion
Commits
d84f0ccf
提交
d84f0ccf
authored
12月 10, 2019
作者:
zgy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
完成汇率转换接口
上级
0bd9c725
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
435 行增加
和
199 行删除
+435
-199
TbCfOrderController.java
...aoyun/zion/chinafrica/controller/TbCfOrderController.java
+22
-4
TbCfOrderDao.java
...in/java/com/diaoyun/zion/chinafrica/dao/TbCfOrderDao.java
+18
-2
TbCfExchangeEntity.java
...om/diaoyun/zion/chinafrica/entity/TbCfExchangeEntity.java
+154
-0
TbCfOrderService.java
...com/diaoyun/zion/chinafrica/service/TbCfOrderService.java
+4
-0
TbCfOrderServiceImpl.java
...un/zion/chinafrica/service/impl/TbCfOrderServiceImpl.java
+45
-12
application.yml
src/main/resources/application.yml
+5
-5
TbCfOrderDao.xml
src/main/resources/mapper/TbCfOrderDao.xml
+187
-176
没有找到文件。
src/main/java/com/diaoyun/zion/chinafrica/controller/TbCfOrderController.java
浏览文件 @
d84f0ccf
...
...
@@ -31,14 +31,16 @@ public class TbCfOrderController {
@ApiOperation
(
"用户结算,返回订单"
)
@GetMapping
(
"/settle"
)
public
Result
<
TbCfOrderVo
>
settleAccount
(
@ApiParam
(
"发放ID"
)
@RequestParam
(
value
=
"toitableId"
,
required
=
false
)
String
toitableId
)
throws
IOException
,
URISyntaxException
,
ExecutionException
,
InterruptedException
,
TimeoutException
{
public
Result
<
TbCfOrderVo
>
settleAccount
(
@ApiParam
(
"发放ID"
)
@RequestParam
(
value
=
"toitableId"
,
required
=
false
)
String
toitableId
)
throws
IOException
,
URISyntaxException
,
ExecutionException
,
InterruptedException
,
TimeoutException
{
return
tbCfOrderService
.
settleAccount
(
toitableId
);
}
@ApiOperation
(
"用户确定下单"
)
@PostMapping
(
"/place"
)
public
Result
placeOrder
(
@ApiParam
(
"订单详情"
)
@RequestBody
TbCfOrderVo
tbCfOrderVo
,
@ApiParam
(
"发放ID"
)
@RequestParam
(
value
=
"toitableId"
,
required
=
false
)
String
toitableId
)
throws
IOException
,
URISyntaxException
,
ExecutionException
,
InterruptedException
,
TimeoutException
{
return
tbCfOrderService
.
placeOrder
(
tbCfOrderVo
,
toitableId
);
public
Result
placeOrder
(
@ApiParam
(
"订单详情"
)
@RequestBody
TbCfOrderVo
tbCfOrderVo
,
@ApiParam
(
"发放ID"
)
@RequestParam
(
value
=
"toitableId"
,
required
=
false
)
String
toitableId
)
throws
IOException
,
URISyntaxException
,
ExecutionException
,
InterruptedException
,
TimeoutException
{
return
tbCfOrderService
.
placeOrder
(
tbCfOrderVo
,
toitableId
);
}
/**
* pageNum 页数
* pageSize 每页大小
...
...
@@ -63,11 +65,13 @@ public class TbCfOrderController {
public
Result
payForOrder
(
@ApiParam
(
"订单id"
)
@PathVariable
(
"orderId"
)
String
orderId
,
@ApiParam
(
"支付token"
)
@PathVariable
(
"token"
)
String
token
)
{
return
tbCfOrderService
.
payForOrder
(
orderId
,
token
);
}
@ApiOperation
(
"发起订单支付"
)
@PostMapping
(
"/pay/{orderId}"
)
public
Result
rePayForOrder
(
@ApiParam
(
"订单id"
)
@PathVariable
(
"orderId"
)
String
orderId
)
{
return
tbCfOrderService
.
rePayForOrder
(
orderId
);
}
@ApiOperation
(
"根据订单id,查询物流详情"
)
@GetMapping
(
"/express/{orderId}"
)
public
Result
queryOrderExpressInfo
(
@ApiParam
(
"订单id"
)
@PathVariable
String
orderId
)
throws
IOException
{
...
...
@@ -81,11 +85,25 @@ public class TbCfOrderController {
}
/**
* 根据订单号获取详细订单数据
* 根据订单号获取详细订单数据
*/
@ApiOperation
(
value
=
"根据订单号获取详细订单数据"
)
@GetMapping
(
value
=
"/detail/{orderId}"
)
public
Result
getOrderDetail
(
@PathVariable
(
"orderId"
)
String
orderId
)
{
return
tbCfOrderService
.
getOrderDetail
(
orderId
);
}
/**
* 汇率转换(美元转换成其他)
*
* @param price
* @param currency
* @return
*/
@ApiOperation
(
"汇率转换"
)
@GetMapping
(
"/currencyConversion"
)
public
Result
currencyConversion
(
@ApiParam
(
"价格"
)
@RequestParam
(
"price"
)
String
price
,
@ApiParam
(
"兑换货币"
)
@RequestParam
(
"currency"
)
String
currency
)
{
return
tbCfOrderService
.
currencyConversion
(
price
,
currency
);
}
}
src/main/java/com/diaoyun/zion/chinafrica/dao/TbCfOrderDao.java
浏览文件 @
d84f0ccf
...
...
@@ -17,27 +17,32 @@ public interface TbCfOrderDao extends BaseDao<TbCfOrderEntity> {
/**
* 获取用户订单数据
*
* @param userId
* @param orderStatus OrderStatusEnum
* @return
*/
List
<
TbCfOrderEntity
>
getUserOrderList
(
String
userId
,
Integer
orderStatus
);
List
<
TbCfOrderEntity
>
getUserOrderList
(
String
userId
,
Integer
orderStatus
);
/**
* 获取订单内商品
*
* @param orderId
* @return
*/
List
<
TbCfItemDetailEntity
>
getOrderItemList
(
String
orderId
);
/**
* 获取订单内商品
* 获取订单内商品
*
* @param orderId
* @return
*/
List
<
ItemEntity
>
getItemList
(
String
orderId
);
/**
* 获取付款订单
*
* @param beginDate
* @param endDate
* @return
...
...
@@ -46,12 +51,14 @@ public interface TbCfOrderDao extends BaseDao<TbCfOrderEntity> {
/**
* 获取某段时间已发货订单数据
*
* @return
*/
List
<
TbCfItemShippedEntity
>
getDeliveryList
(
Date
beginDate
,
Date
endDate
);
/**
* 根据订单id获取订单实体
*
* @param orderId
* @return
*/
...
...
@@ -62,10 +69,19 @@ public interface TbCfOrderDao extends BaseDao<TbCfOrderEntity> {
/**
* 根据订单id和商品id查询订单记录id //后续根据此id 查询物流信息
*
* @param orderId
* @param itemId
* @return
*/
String
getOrdersId
(
String
orderId
,
String
itemId
);
/**
* 汇率转换
*
* @param currency
* @return
*/
TbCfExchangeEntity
currencyConversion
(
String
currency
);
}
src/main/java/com/diaoyun/zion/chinafrica/entity/TbCfExchangeEntity.java
0 → 100644
浏览文件 @
d84f0ccf
package
com
.
diaoyun
.
zion
.
chinafrica
.
entity
;
import
java.io.Serializable
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
* 汇率管理实体
* 表名 tb_cf_exchange
*
* @author lipengjun
* @date 2019-12-10 15:29:22
*/
public
class
TbCfExchangeEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* ID
*/
private
String
id
;
/**
* 转换类型
*/
private
String
type
;
/**
* 货币
*/
private
String
currency
;
/**
* 兑换货币
*/
private
String
exchangeCurrency
;
/**
* 汇率
*/
private
BigDecimal
exchangeRate
;
/**
* 删除标志 0:正常 1:已删除
*/
private
Integer
delFlag
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 更新时间
*/
private
Date
updateTime
;
/**
* 设置:ID
*/
public
void
setId
(
String
id
)
{
this
.
id
=
id
;
}
/**
* 获取:ID
*/
public
String
getId
()
{
return
id
;
}
/**
* 设置:转换类型
*/
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
/**
* 获取:转换类型
*/
public
String
getType
()
{
return
type
;
}
/**
* 设置:货币
*/
public
void
setCurrency
(
String
currency
)
{
this
.
currency
=
currency
;
}
/**
* 获取:货币
*/
public
String
getCurrency
()
{
return
currency
;
}
/**
* 设置:兑换货币
*/
public
void
setExchangeCurrency
(
String
exchangeCurrency
)
{
this
.
exchangeCurrency
=
exchangeCurrency
;
}
/**
* 获取:兑换货币
*/
public
String
getExchangeCurrency
()
{
return
exchangeCurrency
;
}
/**
* 设置:汇率
*/
public
void
setExchangeRate
(
BigDecimal
exchangeRate
)
{
this
.
exchangeRate
=
exchangeRate
;
}
/**
* 获取:汇率
*/
public
BigDecimal
getExchangeRate
()
{
return
exchangeRate
;
}
/**
* 设置:删除标志 0:正常 1:已删除
*/
public
void
setDelFlag
(
Integer
delFlag
)
{
this
.
delFlag
=
delFlag
;
}
/**
* 获取:删除标志 0:正常 1:已删除
*/
public
Integer
getDelFlag
()
{
return
delFlag
;
}
/**
* 设置:创建时间
*/
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
/**
* 获取:创建时间
*/
public
Date
getCreateTime
()
{
return
createTime
;
}
/**
* 设置:更新时间
*/
public
void
setUpdateTime
(
Date
updateTime
)
{
this
.
updateTime
=
updateTime
;
}
/**
* 获取:更新时间
*/
public
Date
getUpdateTime
()
{
return
updateTime
;
}
}
src/main/java/com/diaoyun/zion/chinafrica/service/TbCfOrderService.java
浏览文件 @
d84f0ccf
...
...
@@ -3,6 +3,8 @@ package com.diaoyun.zion.chinafrica.service;
import
com.diaoyun.zion.chinafrica.entity.TbCfOrderEntity
;
import
com.diaoyun.zion.chinafrica.vo.TbCfOrderVo
;
import
com.diaoyun.zion.master.base.Result
;
import
io.swagger.annotations.ApiParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.io.IOException
;
import
java.net.URISyntaxException
;
...
...
@@ -173,4 +175,6 @@ public interface TbCfOrderService {
Result
getDescriptionById
(
String
descriptionId
);
Result
rePayForOrder
(
String
orderId
);
Result
currencyConversion
(
String
price
,
String
currency
);
}
src/main/java/com/diaoyun/zion/chinafrica/service/impl/TbCfOrderServiceImpl.java
浏览文件 @
d84f0ccf
...
...
@@ -185,8 +185,8 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
}
else
{
//获取下单的订单数据
TbCfOrderVo
definiteOrder
=
ensureOrder
(
tbCfUserInfoVo
,
pageOrder
,
tbCfCartItemDetailList
,
toitableId
);
for
(
TbCfCartItemDetailVo
itemList:
tbCfCartItemDetailList
)
{
TbCfItemOrderREntity
tbCfItemOrderREntity
=
new
TbCfItemOrderREntity
();
for
(
TbCfCartItemDetailVo
itemList
:
tbCfCartItemDetailList
)
{
TbCfItemOrderREntity
tbCfItemOrderREntity
=
new
TbCfItemOrderREntity
();
tbCfItemOrderREntity
.
setOrderItemId
(
IdUtil
.
createIdbyUUID
());
tbCfItemOrderREntity
.
setOrderId
(
definiteOrder
.
getOrderId
());
tbCfItemOrderREntity
.
setItemId
(
itemList
.
getItemId
());
...
...
@@ -353,6 +353,7 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
/**
* 获取某段时间的付款订单数据
*
* @return
*/
@Override
...
...
@@ -370,8 +371,10 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
}
return
result
;
}
/**
* 获取某段时间已发货订单数据
*
* @return
*/
@Override
...
...
@@ -385,7 +388,7 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
Date
endDate
=
new
Date
(
endTime
*
1000
);
List
<
TbCfItemShippedEntity
>
orderList
=
tbCfOrderDao
.
getDeliveryList
(
beginDate
,
endDate
);
// TODO 暂设为赞比亚
for
(
TbCfItemShippedEntity
list:
orderList
)
{
for
(
TbCfItemShippedEntity
list
:
orderList
)
{
list
.
setCountry
(
"赞比亚"
);
}
PageInfo
<
TbCfItemShippedEntity
>
pageInfo
=
new
PageInfo
<>(
orderList
);
...
...
@@ -393,8 +396,10 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
}
return
result
;
}
/**
* 根据订单号获取详细订单数据 给第三方的接口
*
* @param orderId
* @return
*/
...
...
@@ -427,6 +432,7 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
result
.
setData
(
orderEntity
);
return
result
;
}
@Override
public
Result
deleteOrder
(
String
orderId
)
{
Result
result
=
new
Result
();
...
...
@@ -467,8 +473,8 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
@Override
public
Result
getDescriptionById
(
String
descriptionId
)
{
Result
<
ExpressTemplateVo
>
result
=
new
Result
<>();
ExpressTemplateVo
tbCfExpressTemplateEntity
=
new
ExpressTemplateVo
();
ExpressTemplateVo
expressTemplate
=
tbCfExpressTemplateDao
.
getDescriptionById
(
descriptionId
);
ExpressTemplateVo
tbCfExpressTemplateEntity
=
new
ExpressTemplateVo
();
ExpressTemplateVo
expressTemplate
=
tbCfExpressTemplateDao
.
getDescriptionById
(
descriptionId
);
tbCfExpressTemplateEntity
.
setDescriptionId
(
expressTemplate
.
getDescriptionId
());
tbCfExpressTemplateEntity
.
setDescriptionName
(
expressTemplate
.
getDescriptionName
());
tbCfExpressTemplateEntity
.
setExpressFee
(
expressTemplate
.
getExpressFee
());
...
...
@@ -480,11 +486,37 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
@Override
public
Result
rePayForOrder
(
String
orderId
)
{
Result
result
=
new
Result
();
TbCfOrderEntity
order
=
tbCfOrderDao
.
queryObject
(
orderId
);
Result
result
=
new
Result
();
TbCfOrderEntity
order
=
tbCfOrderDao
.
queryObject
(
orderId
);
return
result
.
setData
(
order
);
}
/**
* 汇率转换
*
* @param price
* @param currency
* @return
*/
@Override
public
Result
currencyConversion
(
String
price
,
String
currency
)
{
Result
result
=
new
Result
();
try
{
if
(!
StringUtils
.
isBlank
(
price
)
&&
!
StringUtils
.
isBlank
(
currency
))
{
TbCfExchangeEntity
exchangeEntity
=
tbCfOrderDao
.
currencyConversion
(
currency
.
toUpperCase
());
BigDecimal
rate
=
exchangeEntity
.
getExchangeRate
();
BigDecimal
oldPrice
=
new
BigDecimal
(
price
);
BigDecimal
resultPrice
=
oldPrice
.
multiply
(
rate
);
result
.
setData
(
resultPrice
).
setMessage
(
ResultCodeEnum
.
SUCCESS
.
getDesc
());
}
else
{
result
.
setCode
(
ResultCodeEnum
.
QUERY_ERROR
.
getCode
()).
setMessage
(
ResultCodeEnum
.
QUERY_ERROR
.
getDesc
());
}
}
catch
(
Exception
e
)
{
result
.
setCode
(
ResultCodeEnum
.
QUERY_ERROR
.
getCode
()).
setMessage
(
e
.
getMessage
());
}
return
result
;
}
/**
* 记录财务流水
...
...
@@ -735,14 +767,14 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
itemsPrice
=
itemsPrice
.
add
(
itemSourcePrice
.
multiply
(
itemNum
));
//计算运费
BigDecimal
expressCost
=
getExpressTemplate
(
tbCfCartItemDetailVo
.
getItemCategory
());
BigDecimal
continuationFee
=
getContinuationFee
(
tbCfCartItemDetailVo
.
getItemCategory
());
BigDecimal
continuationFee
=
getContinuationFee
(
tbCfCartItemDetailVo
.
getItemCategory
());
//expressCost = expressCost.multiply(itemNum);
if
(
"1"
.
equals
(
itemNum
))
{
if
(
"1"
.
equals
(
itemNum
))
{
expressCost
=
expressCost
.
multiply
(
itemNum
);
}
else
{
BigDecimal
a
=
BigDecimal
.
valueOf
(
1
);
}
else
{
BigDecimal
a
=
BigDecimal
.
valueOf
(
1
);
BigDecimal
dj
=
continuationFee
.
multiply
(
itemNum
.
subtract
(
a
));
expressCost
=
dj
.
add
(
expressCost
);
expressCost
=
dj
.
add
(
expressCost
);
}
totalExpressCost
=
totalExpressCost
.
add
(
expressCost
);
}
...
...
@@ -771,6 +803,7 @@ public class TbCfOrderServiceImpl implements TbCfOrderService {
TbCfExpressTemplateEntity
tbCfExpressTemplateEntity
=
tbCfExpressTemplateDao
.
queryObject
(
templateId
);
return
tbCfExpressTemplateEntity
.
getExpressFee
();
}
/**
* 获取运费 TODO 运费模板可改为缓存
*
...
...
src/main/resources/application.yml
浏览文件 @
d84f0ccf
...
...
@@ -39,12 +39,12 @@ spring:
type
:
com.alibaba.druid.pool.DruidDataSource
driver-class-name
:
com.mysql.cj.jdbc.Driver
# 测试环境
# url: jdbc:mysql://47.106.242.175:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false
# username: root
# password: diaoyun666
url
:
jdbc:mysql://159.138.48.71:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false
url
:
jdbc:mysql://47.106.242.175:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false
username
:
root
password
:
Diaoyunnuli.8
password
:
diaoyun666
# url: jdbc:mysql://159.138.48.71:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false
# username: root
# password: Diaoyunnuli.8
# 连接池配置
initial-size
:
5
...
...
src/main/resources/mapper/TbCfOrderDao.xml
浏览文件 @
d84f0ccf
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论