Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-api-boot-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lanbaoming
jiedao-api-boot-master
Commits
1aade5b1
Commit
1aade5b1
authored
Feb 26, 2025
by
wanghuazhou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix: 汇率国家非必填且可修改
parent
3b66168f
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
30 additions
and
19 deletions
+30
-19
20250222-currency-rate.sql
sql/v2.4/20250222-currency-rate.sql
+3
-1
CurrencyRateDO.java
...odule/ecw/dal/dataobject/currencyRate/CurrencyRateDO.java
+1
-1
CurrencyRateLogDO.java
...le/ecw/dal/dataobject/currencyRate/CurrencyRateLogDO.java
+16
-1
CurrencyRateServiceImpl.java
...ule/ecw/service/currencyRate/CurrencyRateServiceImpl.java
+2
-7
CurrencyRateCreateReqVO.java
...o/module/ecw/vo/currencyRate/CurrencyRateCreateReqVO.java
+3
-4
CurrencyRateQueryParamVO.java
.../module/ecw/vo/currencyRate/CurrencyRateQueryParamVO.java
+1
-5
CurrencyRateUpdateReqVO.java
...o/module/ecw/vo/currencyRate/CurrencyRateUpdateReqVO.java
+4
-0
No files found.
sql/v2.4/20250222-currency-rate.sql
View file @
1aade5b1
...
...
@@ -4,7 +4,7 @@ CREATE TABLE IF NOT EXISTS `ecw_currency_rate` (
`target_id`
BIGINT
NOT
NULL
COMMENT
'支付币种'
,
`source_amount`
DECIMAL
(
14
,
4
)
NOT
NULL
COMMENT
'原币种金额'
,
`target_amount`
DECIMAL
(
14
,
4
)
NOT
NULL
COMMENT
'支付币种金额'
,
`countries`
JSON
N
OT
N
ULL
COMMENT
'国家'
,
`countries`
JSON
NULL
COMMENT
'国家'
,
`expiration`
DATETIME
NOT
NULL
COMMENT
'有效期'
,
`remarks`
VARCHAR
(
255
)
NULL
COMMENT
'备注'
,
`creator`
VARCHAR
(
32
)
NOT
NULL
COMMENT
'创建者'
,
...
...
@@ -22,6 +22,8 @@ CREATE TABLE IF NOT EXISTS `ecw_currency_rate_log` (
`source_amount2`
DECIMAL
(
14
,
4
)
NOT
NULL
COMMENT
'修改后原币种金额'
,
`target_amount1`
DECIMAL
(
14
,
4
)
NOT
NULL
COMMENT
'修改前支付币种金额'
,
`target_amount2`
DECIMAL
(
14
,
4
)
NOT
NULL
COMMENT
'修改后支付币种金额'
,
`countries1`
JSON
NULL
COMMENT
'修改前国家'
,
`countries2`
JSON
NULL
COMMENT
'修改后国家'
,
`expiration1`
DATETIME
NOT
NULL
COMMENT
'修改前有效期'
,
`expiration2`
DATETIME
NOT
NULL
COMMENT
'修改后有效期'
,
`remarks`
VARCHAR
(
255
)
NULL
COMMENT
'备注'
,
...
...
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/dal/dataobject/currencyRate/CurrencyRateDO.java
View file @
1aade5b1
...
...
@@ -14,8 +14,8 @@ import lombok.NoArgsConstructor;
import
lombok.ToString
;
import
java.math.BigDecimal
;
import
java.util.Set
;
import
java.util.Date
;
import
java.util.Set
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
...
...
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/dal/dataobject/currencyRate/CurrencyRateLogDO.java
View file @
1aade5b1
package
cn
.
iocoder
.
yudao
.
module
.
ecw
.
dal
.
dataobject
.
currencyRate
;
import
cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO
;
import
cn.iocoder.yudao.framework.mybatis.core.type.JsonLongSetTypeHandler
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
lombok.AllArgsConstructor
;
...
...
@@ -12,6 +14,7 @@ import lombok.ToString;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.Set
;
/**
* 货币汇率变更历史 DO
...
...
@@ -20,7 +23,7 @@ import java.util.Date;
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName
(
"ecw_currency_rate_log"
)
@TableName
(
value
=
"ecw_currency_rate_log"
,
autoResultMap
=
true
)
@EqualsAndHashCode
(
callSuper
=
true
)
@ToString
(
callSuper
=
true
)
public
class
CurrencyRateLogDO
extends
BaseDO
{
...
...
@@ -55,6 +58,18 @@ public class CurrencyRateLogDO extends BaseDO {
*/
private
BigDecimal
targetAmount2
;
/**
* 国家变更前
*/
@TableField
(
typeHandler
=
JsonLongSetTypeHandler
.
class
)
private
Set
<
Long
>
countries1
;
/**
* 国家变更后
*/
@TableField
(
typeHandler
=
JsonLongSetTypeHandler
.
class
)
private
Set
<
Long
>
countries2
;
/**
* 有效期
*/
...
...
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/service/currencyRate/CurrencyRateServiceImpl.java
View file @
1aade5b1
...
...
@@ -19,11 +19,9 @@ import org.springframework.stereotype.Service;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.Set
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
exception
.
util
.
ServiceExceptionUtil
.
exception
;
import
static
cn
.
iocoder
.
yudao
.
module
.
ecw
.
enums
.
ErrorCodeConstants
.
CURRENCY_NOT_EXISTS
;
import
static
cn
.
iocoder
.
yudao
.
module
.
ecw
.
enums
.
ErrorCodeConstants
.
CURRENCY_RATE_COUNTRIES_INVALID
;
import
static
cn
.
iocoder
.
yudao
.
module
.
ecw
.
enums
.
ErrorCodeConstants
.
CURRENCY_RATE_EXISTS
;
import
static
cn
.
iocoder
.
yudao
.
module
.
ecw
.
enums
.
ErrorCodeConstants
.
CURRENCY_RATE_NOT_EXISTS
;
import
static
cn
.
iocoder
.
yudao
.
module
.
ecw
.
enums
.
ErrorCodeConstants
.
CURRENCY_RATE_PAIR_INVALID
;
...
...
@@ -52,7 +50,6 @@ public class CurrencyRateServiceImpl implements CurrencyRateService {
public
void
create
(
CurrencyRateCreateReqVO
req
)
{
long
sourceId
=
req
.
getSourceId
();
long
targetId
=
req
.
getTargetId
();
Set
<
Long
>
countries
=
req
.
getCountries
();
if
(
sourceId
==
targetId
)
{
throw
exception
(
CURRENCY_RATE_PAIR_INVALID
);
...
...
@@ -60,10 +57,6 @@ public class CurrencyRateServiceImpl implements CurrencyRateService {
rate
(
req
.
getSourceAmount
(),
req
.
getTargetAmount
());
// check rate
if
(
countries
.
isEmpty
()
||
(
countries
.
size
()
!=
countryService
.
getCountryList
(
countries
).
size
()))
{
throw
exception
(
CURRENCY_RATE_COUNTRIES_INVALID
);
}
// check if currencies exist
currency
(
sourceId
);
currency
(
targetId
);
...
...
@@ -104,11 +97,13 @@ public class CurrencyRateServiceImpl implements CurrencyRateService {
// 修改前
change
.
setSourceAmount1
(
saved
.
getSourceAmount
());
change
.
setTargetAmount1
(
saved
.
getTargetAmount
());
change
.
setCountries1
(
saved
.
getCountries
());
change
.
setExpiration1
(
saved
.
getExpiration
());
// 修改后
change
.
setSourceAmount2
(
req
.
getSourceAmount
());
change
.
setTargetAmount2
(
req
.
getTargetAmount
());
change
.
setCountries2
(
req
.
getCountries
());
change
.
setExpiration2
(
req
.
getExpiration
());
change
.
setRateId
(
id
);
...
...
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/vo/currencyRate/CurrencyRateCreateReqVO.java
View file @
1aade5b1
...
...
@@ -8,8 +8,8 @@ import org.springframework.format.annotation.DateTimeFormat;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotNull
;
import
java.math.BigDecimal
;
import
java.util.Set
;
import
java.util.Date
;
import
java.util.List
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
...
...
@@ -34,9 +34,8 @@ public class CurrencyRateCreateReqVO {
@Min
(
0
)
private
BigDecimal
targetAmount
;
@ApiModelProperty
(
value
=
"国家"
,
required
=
true
)
@NotNull
(
message
=
"至少选择一个国家"
)
private
Set
<
Long
>
countries
;
@ApiModelProperty
(
value
=
"国家"
)
private
List
<
Long
>
countries
;
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
@ApiModelProperty
(
value
=
"汇率有效截止日期"
)
...
...
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/vo/currencyRate/CurrencyRateQueryParamVO.java
View file @
1aade5b1
...
...
@@ -4,13 +4,10 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
org.hibernate.validator.constraints.Length
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Set
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
...
...
@@ -23,8 +20,7 @@ public class CurrencyRateQueryParamVO extends PageParam {
@ApiModelProperty
(
value
=
"支付币种"
)
private
Long
targetId
;
@ApiModelProperty
(
value
=
"国家(最多五个)"
)
// @Length(max = 5)
@ApiModelProperty
(
value
=
"国家"
)
private
List
<
Long
>
countries
;
@ApiModelProperty
(
value
=
"状态"
)
...
...
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/vo/currencyRate/CurrencyRateUpdateReqVO.java
View file @
1aade5b1
...
...
@@ -9,6 +9,7 @@ import javax.validation.constraints.Min;
import
javax.validation.constraints.NotNull
;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.Set
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
;
...
...
@@ -25,6 +26,9 @@ public class CurrencyRateUpdateReqVO {
@Min
(
0
)
private
BigDecimal
targetAmount
;
@ApiModelProperty
(
value
=
"国家"
)
private
Set
<
Long
>
countries
;
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND
)
@ApiModelProperty
(
value
=
"汇率有效截止日期"
)
private
Date
expiration
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment