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
3b66168f
Commit
3b66168f
authored
Feb 26, 2025
by
wanghuazhou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix: 汇率有效期精确到秒
parent
734ad2f7
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
35 additions
and
135 deletions
+35
-135
20250222-currency-rate.sql
sql/v2.4/20250222-currency-rate.sql
+3
-3
CurrencyRateDO.java
...odule/ecw/dal/dataobject/currencyRate/CurrencyRateDO.java
+4
-4
CurrencyRateLogDO.java
...le/ecw/dal/dataobject/currencyRate/CurrencyRateLogDO.java
+3
-3
CurrencyRateMapper.java
...module/ecw/dal/mysql/currencyRate/CurrencyRateMapper.java
+6
-3
CurrencyRateService.java
.../module/ecw/service/currencyRate/CurrencyRateService.java
+5
-5
CurrencyRateCreateReqVO.java
...o/module/ecw/vo/currencyRate/CurrencyRateCreateReqVO.java
+4
-4
CurrencyRateQueryParamVO.java
.../module/ecw/vo/currencyRate/CurrencyRateQueryParamVO.java
+6
-6
CurrencyRateUpdateReqVO.java
...o/module/ecw/vo/currencyRate/CurrencyRateUpdateReqVO.java
+4
-4
logback.xml
...-ecw/yudao-module-ecw-impl/src/test/resources/logback.xml
+0
-4
logback-spring.xml
yudao-server/src/main/resources/logback-spring.xml
+0
-99
No files found.
sql/v2.4/20250222-currency-rate.sql
View file @
3b66168f
...
...
@@ -5,7 +5,7 @@ CREATE TABLE IF NOT EXISTS `ecw_currency_rate` (
`source_amount`
DECIMAL
(
14
,
4
)
NOT
NULL
COMMENT
'原币种金额'
,
`target_amount`
DECIMAL
(
14
,
4
)
NOT
NULL
COMMENT
'支付币种金额'
,
`countries`
JSON
NOT
NULL
COMMENT
'国家'
,
`expiration`
DATE
NOT
NULL
COMMENT
'有效日
期'
,
`expiration`
DATE
TIME
NOT
NULL
COMMENT
'有效
期'
,
`remarks`
VARCHAR
(
255
)
NULL
COMMENT
'备注'
,
`creator`
VARCHAR
(
32
)
NOT
NULL
COMMENT
'创建者'
,
`create_time`
DATETIME
NOT
NULL
COMMENT
'创建时间'
,
...
...
@@ -22,8 +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
'修改后支付币种金额'
,
`expiration1`
DATE
NOT
NULL
COMMENT
'修改前有效期'
,
`expiration2`
DATE
NOT
NULL
COMMENT
'修改后有效期'
,
`expiration1`
DATE
TIME
NOT
NULL
COMMENT
'修改前有效期'
,
`expiration2`
DATE
TIME
NOT
NULL
COMMENT
'修改后有效期'
,
`remarks`
VARCHAR
(
255
)
NULL
COMMENT
'备注'
,
`creator`
VARCHAR
(
32
)
NOT
NULL
COMMENT
'创建者'
,
`create_time`
DATETIME
NOT
NULL
COMMENT
'创建时间'
,
...
...
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/dal/dataobject/currencyRate/CurrencyRateDO.java
View file @
3b66168f
...
...
@@ -14,10 +14,10 @@ import lombok.NoArgsConstructor;
import
lombok.ToString
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.util.Set
;
import
java.util.Date
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY
_HOUR_MINUTE_SECOND
;
/**
* 货币汇率 DO
...
...
@@ -65,8 +65,8 @@ public class CurrencyRateDO extends BaseDO {
/**
* 有效期
*/
@JsonFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY
)
private
Local
Date
expiration
;
@JsonFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY
_HOUR_MINUTE_SECOND
)
private
Date
expiration
;
/**
* 备注
...
...
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/dal/dataobject/currencyRate/CurrencyRateLogDO.java
View file @
3b66168f
...
...
@@ -11,7 +11,7 @@ import lombok.NoArgsConstructor;
import
lombok.ToString
;
import
java.math.BigDecimal
;
import
java.
time.Local
Date
;
import
java.
util.
Date
;
/**
* 货币汇率变更历史 DO
...
...
@@ -58,12 +58,12 @@ public class CurrencyRateLogDO extends BaseDO {
/**
* 有效期
*/
private
Local
Date
expiration1
;
private
Date
expiration1
;
/**
* 有效期
*/
private
Local
Date
expiration2
;
private
Date
expiration2
;
/**
* 备注
...
...
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/dal/mysql/currencyRate/CurrencyRateMapper.java
View file @
3b66168f
...
...
@@ -8,14 +8,17 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.core.toolkit.Wrappers
;
import
org.apache.ibatis.annotations.Mapper
;
import
java.time.LocalDate
;
import
java.util.*
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.function.Consumer
;
@Mapper
public
interface
CurrencyRateMapper
extends
AbstractMapper
<
CurrencyRateDO
>
{
default
PageResult
<
CurrencyRateDO
>
selectPage
(
CurrencyRateQueryParamVO
param
)
{
LocalDate
now
=
LocalDate
.
now
();
Date
now
=
new
Date
();
List
<
Long
>
countries
=
Optional
.
ofNullable
(
param
.
getCountries
()).
orElse
(
Collections
.
emptyList
());
Consumer
<
LambdaQueryWrapper
<
CurrencyRateDO
>>
countriesQuery
=
it
->
countries
.
stream
().
limit
(
5
).
forEach
(
id
->
...
...
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/service/currencyRate/CurrencyRateService.java
View file @
3b66168f
...
...
@@ -11,7 +11,7 @@ import cn.iocoder.yudao.module.ecw.vo.currencyRate.CurrencyRateUpdateReqVO;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.
time.Local
Date
;
import
java.
util.
Date
;
import
java.util.List
;
import
java.util.Optional
;
...
...
@@ -65,9 +65,9 @@ public interface CurrencyRateService {
default
CurrencyRateDO
exchangeBaseValue
(
long
sourceId
,
long
targetId
)
throws
ServiceException
{
CurrencyRateDO
entity
=
Optional
.
ofNullable
(
find
(
sourceId
,
targetId
))
.
orElseThrow
(()
->
exception
(
CURRENCY_RATE_NOT_EXISTS
));
LocalDate
now
=
LocalDate
.
now
();
Date
now
=
new
Date
();
if
(
now
.
isAfter
(
entity
.
getExpiration
())
)
{
if
(
now
.
compareTo
(
entity
.
getExpiration
())
>
0
)
{
throw
exception
(
CURRENCY_RATE_EXPIRED
,
String
.
valueOf
(
sourceId
),
String
.
valueOf
(
targetId
));
}
...
...
@@ -85,9 +85,9 @@ public interface CurrencyRateService {
default
BigDecimal
rate
(
long
sourceId
,
long
targetId
)
throws
ServiceException
{
CurrencyRateDO
entity
=
Optional
.
ofNullable
(
find
(
sourceId
,
targetId
))
.
orElseThrow
(()
->
exception
(
CURRENCY_RATE_NOT_EXISTS
));
LocalDate
now
=
LocalDate
.
now
();
Date
now
=
new
Date
();
if
(
now
.
isAfter
(
entity
.
getExpiration
())
)
{
if
(
now
.
compareTo
(
entity
.
getExpiration
())
>
0
)
{
throw
exception
(
CURRENCY_RATE_EXPIRED
,
String
.
valueOf
(
sourceId
),
String
.
valueOf
(
targetId
));
}
...
...
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/vo/currencyRate/CurrencyRateCreateReqVO.java
View file @
3b66168f
...
...
@@ -8,10 +8,10 @@ import org.springframework.format.annotation.DateTimeFormat;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotNull
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.util.Set
;
import
java.util.Date
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY
_HOUR_MINUTE_SECOND
;
@Data
@ApiModel
(
"管理后台 - 货币汇率创建 Request VO"
)
...
...
@@ -38,9 +38,9 @@ public class CurrencyRateCreateReqVO {
@NotNull
(
message
=
"至少选择一个国家"
)
private
Set
<
Long
>
countries
;
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY
_HOUR_MINUTE_SECOND
)
@ApiModelProperty
(
value
=
"汇率有效截止日期"
)
private
Local
Date
expiration
;
private
Date
expiration
;
@ApiModelProperty
(
value
=
"备注"
)
private
String
remarks
;
...
...
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/vo/currencyRate/CurrencyRateQueryParamVO.java
View file @
3b66168f
...
...
@@ -7,12 +7,12 @@ import lombok.Data;
import
org.hibernate.validator.constraints.Length
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.
time.Local
Date
;
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
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY
_HOUR_MINUTE_SECOND
;
@Data
@ApiModel
(
"管理后台 - 货币汇率查询 VO"
)
...
...
@@ -30,11 +30,11 @@ public class CurrencyRateQueryParamVO extends PageParam {
@ApiModelProperty
(
value
=
"状态"
)
private
Boolean
expired
;
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY
_HOUR_MINUTE_SECOND
)
@ApiModelProperty
(
value
=
"有效期大于"
)
private
Local
Date
expirationAfter
;
private
Date
expirationAfter
;
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY
_HOUR_MINUTE_SECOND
)
@ApiModelProperty
(
value
=
"有效期小于"
)
private
Local
Date
expirationBefore
;
private
Date
expirationBefore
;
}
yudao-module-ecw/yudao-module-ecw-impl/src/main/java/cn/iocoder/yudao/module/ecw/vo/currencyRate/CurrencyRateUpdateReqVO.java
View file @
3b66168f
...
...
@@ -8,9 +8,9 @@ import org.springframework.format.annotation.DateTimeFormat;
import
javax.validation.constraints.Min
;
import
javax.validation.constraints.NotNull
;
import
java.math.BigDecimal
;
import
java.
time.Local
Date
;
import
java.
util.
Date
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
util
.
date
.
DateUtils
.
FORMAT_YEAR_MONTH_DAY
_HOUR_MINUTE_SECOND
;
@Data
@ApiModel
(
"管理后台 - 货币汇率更新 Request VO"
)
...
...
@@ -25,9 +25,9 @@ public class CurrencyRateUpdateReqVO {
@Min
(
0
)
private
BigDecimal
targetAmount
;
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY
)
@DateTimeFormat
(
pattern
=
FORMAT_YEAR_MONTH_DAY
_HOUR_MINUTE_SECOND
)
@ApiModelProperty
(
value
=
"汇率有效截止日期"
)
private
Local
Date
expiration
;
private
Date
expiration
;
@ApiModelProperty
(
value
=
"备注"
)
private
String
remarks
;
...
...
yudao-module-ecw/yudao-module-ecw-impl/src/test/resources/logback.xml
deleted
100644 → 0
View file @
734ad2f7
<configuration>
<!-- 引用 Spring Boot 的 logback 基础配置 -->
<include
resource=
"org/springframework/boot/logging/logback/defaults.xml"
/>
</configuration>
yudao-server/src/main/resources/logback-spring.xml
deleted
100644 → 0
View file @
734ad2f7
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include
resource=
"org/springframework/boot/logging/logback/defaults.xml"
/>
<include
resource=
"org/springframework/boot/logging/logback/console-appender.xml"
/>
<shutdownHook
class=
"ch.qos.logback.core.hook.DelayingShutdownHook"
/>
<!-- ===================================================== -->
<!-- Service Config -->
<!-- ===================================================== -->
<property
name=
"SERVICE_LOG_PATTERN"
value=
"%-16X{traceId} %-12X{clientId:--} %-16X{method} %-25logger{0} %msg"
/>
<!-- 彩色日志 -->
<!-- 彩色日志依赖的渲染类 -->
<conversionRule
conversionWord=
"clr"
converterClass=
"org.springframework.boot.logging.logback.ColorConverter"
/>
<conversionRule
conversionWord=
"wex"
converterClass=
"org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"
/>
<conversionRule
conversionWord=
"wEx"
converterClass=
"org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"
/>
<!-- 彩色日志格式 -->
<property
name=
"CONSOLE_LOG_PATTERN"
value=
"${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"
/>
<!-- 开发测试环境 -->
<springProfile
name=
"test,dev,local,sit,uat"
>
<!-- 每天产生一个文件 -->
<appender
name=
"TEST-FILE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<!-- 文件路径 -->
<file>
${log.service.output:-service.log}
</file>
<!--日志文件输出格式-->
<encoder>
<pattern>
%date %.-3level ${SERVICE_LOG_PATTERN}%n
</pattern>
<charset>
UTF-8
</charset>
<!-- 此处设置字符集 -->
</encoder>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<!-- 文件名称 -->
<fileNamePattern>
${log.service.output:-service.log}-%d{yyyy-MM-dd}.%i
</fileNamePattern>
<!-- 启动服务时,是否清理历史日志,一般不建议清理 -->
<cleanHistoryOnStart>
${LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START:-true}
</cleanHistoryOnStart>
<!-- 文件大小 -->
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
1MB
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!-- 文件最大保存历史数量 -->
<MaxHistory>
1
</MaxHistory>
</rollingPolicy>
<layout
class=
"ch.qos.logback.classic.PatternLayout"
>
<pattern>
%date %.-3level ${SERVICE_LOG_PATTERN}%n
</pattern>
</layout>
</appender>
<!--输出到控制台-->
<appender
name=
"CONSOLE"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<encoder>
<Pattern>
${CONSOLE_LOG_PATTERN}
</Pattern>
<!-- 设置字符集 -->
<charset>
UTF-8
</charset>
</encoder>
</appender>
<root
level=
"INFO"
>
<appender-ref
ref=
"TEST-FILE"
/>
<appender-ref
ref=
"CONSOLE"
/>
</root>
</springProfile>
<!-- 生产环境. -->
<springProfile
name=
"pro"
>
<!-- 每天产生一个文件 -->
<appender
name=
"PRO-FILE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<!-- 文件路径 -->
<file>
${log.service.output:-service.log}
</file>
<!--日志文件输出格式-->
<encoder>
<pattern>
%date %.-3level ${SERVICE_LOG_PATTERN}%n
</pattern>
<charset>
UTF-8
</charset>
<!-- 此处设置字符集 -->
</encoder>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<!-- 文件名称 -->
<fileNamePattern>
${log.service.output:-service.log}-%d{yyyy-MM-dd}.%i
</fileNamePattern>
<!-- 文件大小 -->
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
50MB
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<!-- 文件最大保存历史数量 -->
<MaxHistory>
10
</MaxHistory>
</rollingPolicy>
<layout
class=
"ch.qos.logback.classic.PatternLayout"
>
<pattern>
%date %.-3level ${SERVICE_LOG_PATTERN}%n
</pattern>
</layout>
</appender>
<root
level=
"INFO"
>
<appender-ref
ref=
"PRO-FILE"
/>
</root>
</springProfile>
</configuration>
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