Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gogirl-miniapp-backend
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
huluobin
gogirl-miniapp-backend
Commits
339b867b
Commit
339b867b
authored
May 11, 2021
by
liyanlin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
4d54c653
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
3 deletions
+46
-3
GogirlProperties.java
...frastructure/common/config/property/GogirlProperties.java
+44
-2
GogirlConfigMapper.java
.../infrastructure/mapper/common/xcx/GogirlConfigMapper.java
+2
-1
No files found.
src/main/java/com/gogirl/infrastructure/common/config/property/GogirlProperties.java
View file @
339b867b
package
com
.
gogirl
.
infrastructure
.
common
.
config
.
property
;
package
com
.
gogirl
.
infrastructure
.
common
.
config
.
property
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.gogirl.domain.common.xcx.GogirlConfig
;
import
com.gogirl.infrastructure.mapper.common.xcx.GogirlConfigMapper
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.boot.context.properties.ConfigurationProperties
;
import
org.springframework.stereotype.Component
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
import
javax.annotation.Resource
;
import
java.lang.reflect.Field
;
import
java.util.List
;
@Component
@Component
@Data
@Data
@ConfigurationProperties
(
prefix
=
"gogirl"
)
@Slf4j
//@ConfigurationProperties(prefix = "gogirl")
public
class
GogirlProperties
{
public
class
GogirlProperties
{
/**
/**
...
@@ -58,7 +68,7 @@ public class GogirlProperties {
...
@@ -58,7 +68,7 @@ public class GogirlProperties {
/**
/**
* 发送评价是假
* 发送评价是假
*/
*/
p
ublic
long
testPaperTime
;
p
rivate
long
testPaperTime
;
/**
/**
* 后台地址
* 后台地址
...
@@ -69,4 +79,36 @@ public class GogirlProperties {
...
@@ -69,4 +79,36 @@ public class GogirlProperties {
private
String
enterpriseWechatWebhook
;
private
String
enterpriseWechatWebhook
;
@Resource
private
GogirlConfigMapper
gogirlConfigMapper
;
@PostConstruct
public
void
init
(){
Class
clazz
=
this
.
getClass
();
List
<
GogirlConfig
>
gogirlConfigList
=
gogirlConfigMapper
.
selectList
(
new
LambdaQueryWrapper
<
GogirlConfig
>()
.
eq
(
GogirlConfig:
:
getType
,
this
.
getClass
().
getSimpleName
()));
Field
[]
fields
=
this
.
getClass
().
getDeclaredFields
();
for
(
Field
field
:
fields
)
{
try
{
GogirlConfig
gogirlConfig
=
gogirlConfigList
.
stream
().
filter
(
x
->
x
.
getName
().
equals
(
field
.
getName
())).
findAny
().
orElseGet
(
null
);
if
(
null
!=
gogirlConfig
){
try
{
if
(
field
.
getName
().
equals
(
"testPaperTime"
)){
field
.
setLong
(
this
,
Long
.
parseLong
(
gogirlConfig
.
getValue
()));
}
else
{
field
.
set
(
this
,
gogirlConfig
.
getValue
());
}
}
catch
(
IllegalAccessException
e
)
{
e
.
printStackTrace
();
}
}
}
catch
(
Exception
e
){
continue
;
}
}
}
}
}
src/main/java/com/gogirl/infrastructure/mapper/common/xcx/GogirlConfigMapper.java
View file @
339b867b
package
com
.
gogirl
.
infrastructure
.
mapper
.
common
.
xcx
;
package
com
.
gogirl
.
infrastructure
.
mapper
.
common
.
xcx
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.gogirl.domain.common.xcx.GogirlConfig
;
import
com.gogirl.domain.common.xcx.GogirlConfig
;
public
interface
GogirlConfigMapper
{
public
interface
GogirlConfigMapper
extends
BaseMapper
<
GogirlConfig
>
{
GogirlConfig
selectByPrimaryKey
(
Integer
id
);
GogirlConfig
selectByPrimaryKey
(
Integer
id
);
...
...
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