Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
M
mall-adapter
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
inroi
mall-adapter
Commits
81825ce1
提交
81825ce1
authored
10月 28, 2022
作者:
inroi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
创建
上级
隐藏空白字符变更
内嵌
并排
正在显示
64 个修改的文件
包含
3745 行增加
和
0 行删除
+3745
-0
.gitignore
.gitignore
+33
-0
Dockerfile
Dockerfile
+16
-0
docker-compose.yml
docker-compose.yml
+12
-0
pom.xml
pom.xml
+202
-0
SystemApplication.java
src/main/java/com/system/SystemApplication.java
+19
-0
CommonApi.java
src/main/java/com/system/api/CommonApi.java
+63
-0
CommonGetApi.java
src/main/java/com/system/api/CommonGetApi.java
+75
-0
CommonPostApi.java
src/main/java/com/system/api/CommonPostApi.java
+60
-0
HttpContext.java
src/main/java/com/system/config/HttpContext.java
+42
-0
MybatisPlusConfig.java
src/main/java/com/system/config/MybatisPlusConfig.java
+30
-0
ThreadLocalConfig.java
src/main/java/com/system/config/ThreadLocalConfig.java
+34
-0
WebMvcConfig.java
src/main/java/com/system/config/WebMvcConfig.java
+57
-0
CommonGetConstants.java
src/main/java/com/system/constants/CommonGetConstants.java
+60
-0
CommonPostConstants.java
src/main/java/com/system/constants/CommonPostConstants.java
+59
-0
Constants.java
src/main/java/com/system/constants/Constants.java
+44
-0
SpringContextHolder.java
src/main/java/com/system/constants/SpringContextHolder.java
+49
-0
CommonHttpController.java
...main/java/com/system/controller/CommonHttpController.java
+35
-0
DockingController.java
src/main/java/com/system/controller/DockingController.java
+55
-0
SynchronizationController.java
...java/com/system/controller/SynchronizationController.java
+32
-0
CustomFormConfigMapper.java
src/main/java/com/system/dao/CustomFormConfigMapper.java
+25
-0
SynchronizationRecordsMapper.java
...ain/java/com/system/dao/SynchronizationRecordsMapper.java
+74
-0
ThirdPartyLogMapper.java
src/main/java/com/system/dao/ThirdPartyLogMapper.java
+26
-0
CustomFormConfigMapper.xml
...ain/java/com/system/dao/mapper/CustomFormConfigMapper.xml
+17
-0
SynchronizationRecordsMapper.xml
...va/com/system/dao/mapper/SynchronizationRecordsMapper.xml
+101
-0
ThirdPartyLogMapper.xml
src/main/java/com/system/dao/mapper/ThirdPartyLogMapper.xml
+27
-0
CommonExceptionHandler.java
src/main/java/com/system/handler/CommonExceptionHandler.java
+65
-0
FacePlusThrowErrorHandler.java
...in/java/com/system/handler/FacePlusThrowErrorHandler.java
+23
-0
SecretScheduler.java
src/main/java/com/system/scheduler/SecretScheduler.java
+36
-0
ICommonHttpService.java
src/main/java/com/system/serivce/ICommonHttpService.java
+18
-0
IDockingDistributionService.java
.../java/com/system/serivce/IDockingDistributionService.java
+65
-0
IDockingService.java
src/main/java/com/system/serivce/IDockingService.java
+52
-0
IDockingShoppingMallService.java
.../java/com/system/serivce/IDockingShoppingMallService.java
+29
-0
ISynchronizationService.java
...main/java/com/system/serivce/ISynchronizationService.java
+14
-0
DockingDistributionServiceImpl.java
...m/system/serivce/impl/DockingDistributionServiceImpl.java
+133
-0
DockingServiceImpl.java
...main/java/com/system/serivce/impl/DockingServiceImpl.java
+137
-0
DockingShoppingMallServiceImpl.java
...m/system/serivce/impl/DockingShoppingMallServiceImpl.java
+65
-0
ICommonHttpServiceImpl.java
.../java/com/system/serivce/impl/ICommonHttpServiceImpl.java
+39
-0
SynchronizationServiceImpl.java
...a/com/system/serivce/impl/SynchronizationServiceImpl.java
+61
-0
DockingDistributionMemberBalanceInVo.java
...ransfer/docking/DockingDistributionMemberBalanceInVo.java
+23
-0
DockingDistributionMemberCreateInVo.java
...transfer/docking/DockingDistributionMemberCreateInVo.java
+47
-0
DockingDistributionMemberProfitInVo.java
...transfer/docking/DockingDistributionMemberProfitInVo.java
+23
-0
DockingDistributionMemberSubordinateListInVo.java
...docking/DockingDistributionMemberSubordinateListInVo.java
+23
-0
DockingDistributionTransactionCreateInVo.java
...fer/docking/DockingDistributionTransactionCreateInVo.java
+41
-0
CustomFormConfigListInVo.java
...va/com/system/transfer/form/CustomFormConfigListInVo.java
+37
-0
CustomFormConfigListOutVoRecords.java
...ystem/transfer/form/CustomFormConfigListOutVoRecords.java
+65
-0
FormFieldMappingDetailOutVoRecords.java
...tem/transfer/form/FormFieldMappingDetailOutVoRecords.java
+47
-0
ThirdPartyLogCreateInVo.java
...java/com/system/transfer/log/ThirdPartyLogCreateInVo.java
+65
-0
PlatformDockingShoppingMallCommodityInVo.java
...er/platform/PlatformDockingShoppingMallCommodityInVo.java
+17
-0
ErrorResponseData.java
.../java/com/system/transfer/response/ErrorResponseData.java
+52
-0
RestResponse.java
src/main/java/com/system/transfer/response/RestResponse.java
+93
-0
SynchronizationRecordsDeleteInVo.java
...fer/synchronization/SynchronizationRecordsDeleteInVo.java
+21
-0
SynchronizationRecordsListInVo.java
...nsfer/synchronization/SynchronizationRecordsListInVo.java
+112
-0
SynchronizationRecordsListOutVo.java
...sfer/synchronization/SynchronizationRecordsListOutVo.java
+25
-0
SynchronizationRecordsListOutVoRecords.java
...nchronization/SynchronizationRecordsListOutVoRecords.java
+65
-0
SynchronizationRecordsUpdateInVo.java
...fer/synchronization/SynchronizationRecordsUpdateInVo.java
+39
-0
FormFieldMappingUtil.java
src/main/java/com/system/utils/FormFieldMappingUtil.java
+31
-0
HttpUtil.java
src/main/java/com/system/utils/HttpUtil.java
+156
-0
JsonUtil.java
src/main/java/com/system/utils/JsonUtil.java
+90
-0
SnowFlakeIdUtil.java
src/main/java/com/system/utils/SnowFlakeIdUtil.java
+177
-0
StringUtil.java
src/main/java/com/system/utils/StringUtil.java
+358
-0
ThirdPartyLogUtil.java
src/main/java/com/system/utils/ThirdPartyLogUtil.java
+59
-0
application-docker.yaml
src/main/resources/application-docker.yaml
+46
-0
application-test.yaml
src/main/resources/application-test.yaml
+46
-0
application.yaml
src/main/resources/application.yaml
+3
-0
没有找到文件。
.gitignore
0 → 100644
浏览文件 @
81825ce1
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
Dockerfile
0 → 100644
浏览文件 @
81825ce1
FROM
anapsix/alpine-java:8_server-jre_unlimited
MAINTAINER
Inori
RUN
ln
-sf
/usr/share/zoneinfo/Asia/Shanghai /etc/localtime
RUN
mkdir
-p
/mall-adapter
WORKDIR
/mall-adapter
EXPOSE
12002
ADD
./target/mall-adapter.jar /mall-adapter
CMD
sleep 15;java -Djava.security.egd=file:/dev/./urandom -jar mall-adapter.jar
\ No newline at end of file
docker-compose.yml
0 → 100644
浏览文件 @
81825ce1
version
:
'
2'
services
:
mall-adapter
:
build
:
context
:
./
restart
:
always
container_name
:
mall-adapter
image
:
mall-adapter
ports
:
-
12001:12001
\ No newline at end of file
pom.xml
0 → 100644
浏览文件 @
81825ce1
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<modelVersion>
4.0.0
</modelVersion>
<groupId>
org.example
</groupId>
<artifactId>
mall-adapter
</artifactId>
<version>
1.0-SNAPSHOT
</version>
<parent>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-parent
</artifactId>
<version>
2.3.6.RELEASE
</version>
<relativePath/>
</parent>
<properties>
<project.build.sourceEncoding>
UTF-8
</project.build.sourceEncoding>
<project.reporting.outputEncoding>
UTF-8
</project.reporting.outputEncoding>
<java.version>
1.8
</java.version>
<swagger.version>
2.9.2
</swagger.version>
<swagger.bootstrap.version>
1.9.6
</swagger.bootstrap.version>
<druid.version>
1.2.8
</druid.version>
<mybatis.version>
3.4.3
</mybatis.version>
<fastjson.version>
1.2.73
</fastjson.version>
<json.lib.version>
2.4
</json.lib.version>
</properties>
<dependencies>
<!-- SpringBoot -->
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-aop
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-validation
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<!-- SpringBoot -->
<!-- Mysql -->
<dependency>
<groupId>
mysql
</groupId>
<artifactId>
mysql-connector-java
</artifactId>
</dependency>
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
druid-spring-boot-starter
</artifactId>
<version>
${druid.version}
</version>
</dependency>
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
mybatis-plus-boot-starter
</artifactId>
<version>
${mybatis.version}
</version>
</dependency>
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
mybatis-plus
</artifactId>
<version>
${mybatis.version}
</version>
</dependency>
<!-- Mysql -->
<!-- Swagger -->
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
<version>
${swagger.version}
</version>
</dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger-ui
</artifactId>
<version>
${swagger.version}
</version>
</dependency>
<dependency>
<groupId>
com.github.xiaoymin
</groupId>
<artifactId>
swagger-bootstrap-ui
</artifactId>
<version>
${swagger.bootstrap.version}
</version>
</dependency>
<!-- Swagger -->
<!-- Common -->
<dependency>
<groupId>
com.alibaba
</groupId>
<artifactId>
fastjson
</artifactId>
<version>
${fastjson.version}
</version>
</dependency>
<dependency>
<groupId>
net.sf.json-lib
</groupId>
<artifactId>
json-lib
</artifactId>
<version>
${json.lib.version}
</version>
<classifier>
jdk15
</classifier>
</dependency>
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-lang3
</artifactId>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
</dependency>
<dependency>
<groupId>
org.apache.httpcomponents
</groupId>
<artifactId>
httpmime
</artifactId>
</dependency>
<dependency>
<groupId>
commons-httpclient
</groupId>
<artifactId>
commons-httpclient
</artifactId>
<version>
3.1
</version>
</dependency>
<!-- Common -->
</dependencies>
<build>
<finalName>
mall-adapter
</finalName>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-compiler-plugin
</artifactId>
<configuration>
<source>
${java.version}
</source>
<target>
${java.version}
</target>
<encoding>
UTF-8
</encoding>
<showWarnings>
true
</showWarnings>
</configuration>
</plugin>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<executions>
<execution>
<goals>
<goal>
repackage
</goal>
</goals>
</execution>
</executions>
<configuration>
<includeSystemScope>
true
</includeSystemScope>
</configuration>
</plugin>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-surefire-plugin
</artifactId>
<configuration>
<skipTests>
true
</skipTests>
</configuration>
</plugin>
<!-- 避免font文件的二进制文件格式压缩破坏 -->
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-resources-plugin
</artifactId>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>
woff
</nonFilteredFileExtension>
<nonFilteredFileExtension>
woff2
</nonFilteredFileExtension>
<nonFilteredFileExtension>
eot
</nonFilteredFileExtension>
<nonFilteredFileExtension>
ttf
</nonFilteredFileExtension>
<nonFilteredFileExtension>
svg
</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>
src/main/resources
</directory>
<filtering>
true
</filtering>
</resource>
<resource>
<directory>
src/main/java
</directory>
<includes>
<include>
**/*.xml
</include>
</includes>
</resource>
</resources>
</build>
</project>
\ No newline at end of file
src/main/java/com/system/SystemApplication.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
;
import
org.mybatis.spring.annotation.MapperScan
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
/**
* @author Inori
*/
@MapperScan
(
"com.system.dao"
)
@SpringBootApplication
public
class
SystemApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
SystemApplication
.
class
,
args
);
}
}
src/main/java/com/system/api/CommonApi.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
api
;
import
com.system.constants.Constants
;
import
com.system.transfer.form.FormFieldMappingDetailOutVoRecords
;
import
org.springframework.util.CollectionUtils
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author Inori
*/
public
class
CommonApi
{
public
static
Map
<
String
,
Object
>
purchaseData
(
Map
<
String
,
String
>
config
,
List
<
Map
<
String
,
Object
>>
dataList
,
List
<
FormFieldMappingDetailOutVoRecords
>
fieldList
)
{
Map
<
String
,
Object
>
request
=
new
LinkedHashMap
<>(
2
);
List
<
Map
<
String
,
Object
>>
tempList
=
new
ArrayList
<>();
for
(
Map
<
String
,
Object
>
data
:
dataList
)
{
Map
<
String
,
Object
>
temp
=
new
LinkedHashMap
<>();
for
(
FormFieldMappingDetailOutVoRecords
records
:
fieldList
)
{
if
(
Constants
.
IS_ENTRY_CODE
.
equals
(
records
.
getIsEntryField
()))
{
purchaseFieldData
(
data
,
temp
,
records
);
}
else
{
purchaseFieldData
(
data
,
request
,
records
);
}
}
if
(!
CollectionUtils
.
isEmpty
(
temp
))
{
tempList
.
add
(
temp
);
}
}
if
(!
CollectionUtils
.
isEmpty
(
tempList
))
{
request
.
put
(
"children"
,
tempList
);
}
return
request
;
}
private
static
void
purchaseFieldData
(
Map
<
String
,
Object
>
temp
,
Map
<
String
,
Object
>
data
,
FormFieldMappingDetailOutVoRecords
records
)
{
String
fieldType
=
records
.
getFieldType
();
String
fieldBeforeMapping
=
records
.
getFieldBeforeMapping
();
String
fieldAfterMapping
=
records
.
getFieldAfterMapping
();
if
(
Constants
.
INT_NAME
.
equals
(
fieldType
))
{
try
{
data
.
put
(
fieldAfterMapping
,
Integer
.
valueOf
(
String
.
valueOf
(
temp
.
get
(
fieldBeforeMapping
))));
}
catch
(
NumberFormatException
e
)
{
data
.
put
(
fieldAfterMapping
,
temp
.
get
(
fieldBeforeMapping
));
}
}
else
if
(
Constants
.
BIG_DECIMAL_NAME
.
equals
(
fieldType
))
{
try
{
data
.
put
(
fieldAfterMapping
,
new
BigDecimal
(
String
.
valueOf
(
temp
.
get
(
fieldBeforeMapping
))));
}
catch
(
NumberFormatException
e
)
{
data
.
put
(
fieldAfterMapping
,
temp
.
get
(
fieldBeforeMapping
));
}
}
else
{
data
.
put
(
fieldAfterMapping
,
temp
.
get
(
fieldBeforeMapping
));
}
}
}
src/main/java/com/system/api/CommonGetApi.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
api
;
import
com.system.constants.Constants
;
import
com.system.transfer.form.FormFieldMappingDetailOutVoRecords
;
import
com.system.utils.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* @author Inori
*/
@Component
public
class
CommonGetApi
{
@Autowired
private
ThirdPartyLogUtil
thirdPartyLogUtil
;
public
String
commonGet
(
Map
<
String
,
String
>
config
,
String
json
,
String
queueId
)
{
String
result
=
""
;
try
{
if
(
StringUtil
.
isNotBlank
(
json
))
{
result
=
HttpUtil
.
httpPost
(
config
.
get
(
"requestAddress"
),
json
).
getBody
();
}
else
{
result
=
HttpUtil
.
httpGet
(
config
.
get
(
"requestAddress"
)).
getBody
();
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
int
flag
=
0
;
Map
<
String
,
Object
>
response
=
new
HashMap
<>(
3
);
Map
<
String
,
Object
>
map
=
JsonUtil
.
toMap
(
result
,
String
.
class
,
Object
.
class
);
if
(!
CollectionUtils
.
isEmpty
(
map
))
{
if
(
Constants
.
SUCCESS_CODE
.
equals
(
String
.
valueOf
(
map
.
get
(
Constants
.
SUCCESS_NAME
))))
{
List
<
Object
>
objectList
=
JsonUtil
.
toList
(
JsonUtil
.
toString
(
map
.
get
(
"data"
)),
Object
.
class
);
List
<
Map
<
String
,
Object
>>
dataList
=
objectList
.
stream
().
map
(
m
->
JsonUtil
.
toMap
(
JsonUtil
.
toString
(
m
),
String
.
class
,
Object
.
class
)).
collect
(
Collectors
.
toList
());
List
<
FormFieldMappingDetailOutVoRecords
>
fieldList
=
FormFieldMappingUtil
.
purchaseMapping
(
config
.
get
(
"formFieldMappingDetail"
));
response
.
put
(
"data"
,
CommonApi
.
purchaseData
(
config
,
dataList
,
fieldList
));
response
.
put
(
"success"
,
true
);
flag
=
1
;
}
}
else
if
(!
Constants
.
SUCCESS_CODE
.
equals
(
String
.
valueOf
(
map
.
get
(
Constants
.
SUCCESS_NAME
)))
&&
map
.
containsKey
(
Constants
.
ERROR_MESSAGE
))
{
response
.
put
(
"message"
,
map
.
get
(
Constants
.
ERROR_MESSAGE
));
response
.
put
(
"success"
,
false
);
}
else
{
response
.
put
(
"message"
,
""
);
response
.
put
(
"success"
,
false
);
}
System
.
out
.
println
(
response
);
thirdPartyLogUtil
.
thirdPartyLogCreate
(
config
.
get
(
"name"
),
config
.
get
(
"docType"
),
queueId
,
config
.
get
(
"configureDirection"
),
StringUtil
.
isNotBlank
(
json
)
?
json
:
config
.
get
(
"requestAddress"
),
result
,
flag
);
return
JsonUtil
.
toString
(
response
);
}
public
String
commonSync
(
String
responseAddress
,
String
queueId
,
Map
<
String
,
String
>
config
,
String
json
)
{
try
{
String
result
=
HttpUtil
.
httpPost
(
responseAddress
,
json
).
getBody
();
thirdPartyLogUtil
.
thirdPartyLogCreate
(
config
.
get
(
"name"
),
config
.
get
(
"docType"
),
queueId
,
config
.
get
(
"configureDirection"
),
json
,
result
);
return
result
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
""
;
}
}
}
src/main/java/com/system/api/CommonPostApi.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
api
;
import
com.system.constants.Constants
;
import
com.system.transfer.form.FormFieldMappingDetailOutVoRecords
;
import
com.system.utils.FormFieldMappingUtil
;
import
com.system.utils.HttpUtil
;
import
com.system.utils.JsonUtil
;
import
com.system.utils.ThirdPartyLogUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author Inori
*/
@Component
public
class
CommonPostApi
{
@Autowired
private
ThirdPartyLogUtil
thirdPartyLogUtil
;
public
String
commonPost
(
Map
<
String
,
String
>
config
,
List
<
Map
<
String
,
Object
>>
dataList
,
String
queueId
)
{
int
flag
=
0
;
Map
<
String
,
Object
>
response
=
new
HashMap
<>(
3
);
try
{
List
<
FormFieldMappingDetailOutVoRecords
>
fieldList
=
FormFieldMappingUtil
.
purchaseMapping
(
config
.
get
(
"formFieldMappingDetail"
));
Map
<
String
,
Object
>
data
=
CommonApi
.
purchaseData
(
config
,
dataList
,
fieldList
);
String
result
=
HttpUtil
.
httpPost
(
config
.
get
(
""
),
JsonUtil
.
toString
(
data
)).
getBody
();
Map
<
String
,
Object
>
map
=
JsonUtil
.
toMap
(
result
,
String
.
class
,
Object
.
class
);
if
(!
CollectionUtils
.
isEmpty
(
map
))
{
if
(
Constants
.
SUCCESS_CODE
.
equals
(
String
.
valueOf
(
map
.
get
(
Constants
.
SUCCESS_NAME
))))
{
flag
=
1
;
response
.
put
(
"success"
,
true
);
}
}
else
if
(!
Constants
.
SUCCESS_CODE
.
equals
(
String
.
valueOf
(
map
.
get
(
Constants
.
SUCCESS_NAME
)))
&&
map
.
containsKey
(
Constants
.
ERROR_MESSAGE
))
{
response
.
put
(
"success"
,
false
);
response
.
put
(
"message"
,
map
.
get
(
Constants
.
ERROR_MESSAGE
));
}
else
{
response
.
put
(
"message"
,
""
);
response
.
put
(
"success"
,
false
);
}
thirdPartyLogUtil
.
thirdPartyLogCreate
(
config
.
get
(
"name"
),
config
.
get
(
"docType"
),
queueId
,
config
.
get
(
"configureDirection"
),
JsonUtil
.
toString
(
data
),
result
,
flag
);
return
JsonUtil
.
toString
(
response
);
}
catch
(
Exception
e
)
{
response
.
put
(
"message"
,
e
.
getMessage
());
response
.
put
(
"success"
,
false
);
return
JsonUtil
.
toString
(
response
);
}
}
}
src/main/java/com/system/config/HttpContext.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
config
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
/**
* 快捷获取HttpServletRequest,HttpServletResponse
*
* @author Inori
*/
public
class
HttpContext
{
/**
* 获取当前请求的Request对象
*
*/
public
static
HttpServletRequest
getRequest
()
{
ServletRequestAttributes
requestAttributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
if
(
requestAttributes
==
null
)
{
return
null
;
}
else
{
return
requestAttributes
.
getRequest
();
}
}
/**
* 获取当前请求的Response对象
*
*/
public
static
HttpServletResponse
getResponse
()
{
ServletRequestAttributes
requestAttributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
if
(
requestAttributes
==
null
)
{
return
null
;
}
else
{
return
requestAttributes
.
getResponse
();
}
}
}
src/main/java/com/system/config/MybatisPlusConfig.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
config
;
import
com.baomidou.mybatisplus.annotation.DbType
;
import
com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor
;
import
com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor
;
import
com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
/**
* @author Inori
*/
@Configuration
public
class
MybatisPlusConfig
{
/**
* mybatis-plus分页插件
*/
@Bean
public
MybatisPlusInterceptor
mybatisPlusInterceptor
()
{
MybatisPlusInterceptor
interceptor
=
new
MybatisPlusInterceptor
();
interceptor
.
addInnerInterceptor
(
new
PaginationInnerInterceptor
(
DbType
.
H2
));
//乐观锁mybatis插件
interceptor
.
addInnerInterceptor
(
new
OptimisticLockerInnerInterceptor
());
return
interceptor
;
}
}
\ No newline at end of file
src/main/java/com/system/config/ThreadLocalConfig.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
config
;
import
org.springframework.util.CollectionUtils
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @author Inori
*/
public
class
ThreadLocalConfig
{
private
static
ThreadLocal
<
Map
<
String
,
Object
>>
THREAD_LOCAL
=
new
ThreadLocal
<>();
public
static
Map
<
String
,
Object
>
get
()
{
if
(
CollectionUtils
.
isEmpty
(
THREAD_LOCAL
.
get
()))
{
ThreadLocalConfig
.
set
(
new
HashMap
<>());
}
return
THREAD_LOCAL
.
get
();
}
public
static
void
set
(
Map
<
String
,
Object
>
map
)
{
THREAD_LOCAL
.
set
(
map
);
}
public
static
void
remove
()
{
THREAD_LOCAL
.
remove
();
}
}
src/main/java/com/system/config/WebMvcConfig.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
config
;
import
com.alibaba.fastjson.serializer.SerializerFeature
;
import
com.alibaba.fastjson.support.config.FastJsonConfig
;
import
com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter
;
import
com.system.constants.SpringContextHolder
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.converter.HttpMessageConverter
;
import
org.springframework.web.servlet.config.annotation.EnableWebMvc
;
import
org.springframework.web.servlet.config.annotation.WebMvcConfigurer
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* @author Inori
*/
@EnableWebMvc
@Configuration
public
class
WebMvcConfig
implements
WebMvcConfigurer
{
@Override
public
void
extendMessageConverters
(
List
<
HttpMessageConverter
<?>>
converters
)
{
//创建fastJson消息转换器
FastJsonHttpMessageConverter
fastJsonConverter
=
new
FastJsonHttpMessageConverter
();
//创建配置类
FastJsonConfig
fastJsonConfig
=
new
FastJsonConfig
();
//过滤并修改配置返回内容
fastJsonConfig
.
setSerializerFeatures
(
//List字段如果为null,输出为[],而非null
SerializerFeature
.
WriteNullListAsEmpty
,
//字符类型字段如果为null,输出为"",而非null
SerializerFeature
.
WriteNullStringAsEmpty
,
//消除对同一对象循环引用的问题,默认为false(如果不配置有可能会进入死循环)
SerializerFeature
.
DisableCircularReferenceDetect
,
//是否输出值为null的字段,默认为false。
SerializerFeature
.
WriteMapNullValue
);
//处理中文乱码问题
List
<
MediaType
>
fastMediaTypes
=
new
ArrayList
<>();
fastMediaTypes
.
add
(
MediaType
.
APPLICATION_JSON
);
fastMediaTypes
.
add
(
MediaType
.
parseMediaType
(
MediaType
.
TEXT_PLAIN_VALUE
+
";charset=ISO-8859-1"
));
fastJsonConverter
.
setSupportedMediaTypes
(
fastMediaTypes
);
fastJsonConverter
.
setFastJsonConfig
(
fastJsonConfig
);
converters
.
add
(
0
,
fastJsonConverter
);
}
@Bean
public
SpringContextHolder
springContextHolder
()
{
return
new
SpringContextHolder
();
}
}
\ No newline at end of file
src/main/java/com/system/constants/CommonGetConstants.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
constants
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.system.dao.CustomFormConfigMapper
;
import
com.system.transfer.form.CustomFormConfigListInVo
;
import
com.system.transfer.form.CustomFormConfigListOutVoRecords
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
javax.annotation.PostConstruct
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* @author Inori
*/
@Component
public
class
CommonGetConstants
{
private
Map
<
String
,
Map
<
String
,
String
>>
map
=
new
ConcurrentHashMap
<>();
@Autowired
private
CustomFormConfigMapper
customFormConfigMapper
;
@PostConstruct
public
void
init
()
{
List
<
CustomFormConfigListOutVoRecords
>
recordsList
=
customFormConfigMapper
.
customFormConfigList
(
new
Page
<>(
0
,
10000
),
new
CustomFormConfigListInVo
(
1
));
for
(
CustomFormConfigListOutVoRecords
records
:
recordsList
)
{
this
.
map
.
put
(
records
.
getDocType
(),
this
.
purchaseCustomFormConfig
(
records
));
}
}
public
Map
<
String
,
String
>
get
(
String
docType
)
{
if
(
CollectionUtils
.
isEmpty
(
this
.
map
))
{
return
new
HashMap
<>(
1
);
}
return
this
.
map
.
get
(
docType
);
}
/**
* 封装自定义表单配置
*/
private
Map
<
String
,
String
>
purchaseCustomFormConfig
(
CustomFormConfigListOutVoRecords
records
)
{
Map
<
String
,
String
>
result
=
new
HashMap
<>(
10
);
result
.
put
(
"docType"
,
records
.
getDocType
());
result
.
put
(
"name"
,
records
.
getName
());
result
.
put
(
"configureDirection"
,
records
.
getConfigureDirection
());
result
.
put
(
"operation"
,
records
.
getOperation
()
==
1
?
"Get"
:
"Post"
);
result
.
put
(
"requestAddress"
,
records
.
getRequestAddress
());
result
.
put
(
"customSql"
,
records
.
getCustomSql
());
result
.
put
(
"formFieldMappingDetail"
,
records
.
getFormFieldMappingDetail
());
return
result
;
}
}
src/main/java/com/system/constants/CommonPostConstants.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
constants
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.system.dao.CustomFormConfigMapper
;
import
com.system.transfer.form.CustomFormConfigListInVo
;
import
com.system.transfer.form.CustomFormConfigListOutVoRecords
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
javax.annotation.PostConstruct
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
/**
* @author Inori
*/
@Component
public
class
CommonPostConstants
{
private
Map
<
String
,
Map
<
String
,
String
>>
map
=
new
ConcurrentHashMap
<>();
@Autowired
private
CustomFormConfigMapper
customFormConfigMapper
;
@PostConstruct
public
void
init
()
{
List
<
CustomFormConfigListOutVoRecords
>
recordsList
=
customFormConfigMapper
.
customFormConfigList
(
new
Page
<>(
0
,
10000
),
new
CustomFormConfigListInVo
(
2
));
for
(
CustomFormConfigListOutVoRecords
records
:
recordsList
)
{
this
.
map
.
put
(
records
.
getDocType
(),
this
.
purchaseCustomFormConfig
(
records
));
}
}
public
Map
<
String
,
String
>
get
(
String
docType
)
{
if
(
CollectionUtils
.
isEmpty
(
this
.
map
))
{
return
new
HashMap
<>(
1
);
}
return
this
.
map
.
get
(
docType
);
}
/**
* 封装自定义表单配置
*/
private
Map
<
String
,
String
>
purchaseCustomFormConfig
(
CustomFormConfigListOutVoRecords
records
)
{
Map
<
String
,
String
>
result
=
new
HashMap
<>(
10
);
result
.
put
(
"docType"
,
records
.
getDocType
());
result
.
put
(
"name"
,
records
.
getName
());
result
.
put
(
"operation"
,
records
.
getOperation
()
==
1
?
"Get"
:
"Post"
);
result
.
put
(
"configureDirection"
,
records
.
getConfigureDirection
());
result
.
put
(
"customSql"
,
records
.
getCustomSql
());
result
.
put
(
"formFieldMappingDetail"
,
records
.
getFormFieldMappingDetail
());
return
result
;
}
}
src/main/java/com/system/constants/Constants.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
constants
;
/**
* @author Inori
*/
public
interface
Constants
{
String
TIME_FORMAT
=
"yyyy-MM-dd HH:mm:ss"
;
String
FILE_FORMAT
=
"lic.tmp"
;
String
EFFECTIVE_TIME
=
"effectiveTime"
;
String
VERIFICATION_INTERVAL
=
"verificationInterval"
;
Integer
ROOT_MENU_CODE
=
-
1
;
Integer
IS_ENTRY_CODE
=
1
;
String
SUCCESS_NAME
=
"success"
;
String
ERROR_MESSAGE
=
"message"
;
String
SUCCESS_CODE
=
"true"
;
String
STRING_NAME
=
"字符"
;
String
INT_NAME
=
"数值"
;
String
BIG_DECIMAL_NAME
=
"浮点数值"
;
}
src/main/java/com/system/constants/SpringContextHolder.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
constants
;
import
org.springframework.beans.BeansException
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
/**
* 静态获取spring容器中的bean
*
* @author Inori
*/
public
class
SpringContextHolder
implements
ApplicationContextAware
{
private
static
ApplicationContext
applicationContext
;
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
SpringContextHolder
.
applicationContext
=
applicationContext
;
}
public
static
ApplicationContext
getApplicationContext
()
{
assertApplicationContext
();
return
applicationContext
;
}
@SuppressWarnings
(
"unchecked"
)
public
static
<
T
>
T
getBean
(
String
beanName
)
{
assertApplicationContext
();
return
(
T
)
applicationContext
.
getBean
(
beanName
);
}
public
static
<
T
>
T
getBean
(
Class
<
T
>
requiredType
)
{
assertApplicationContext
();
return
applicationContext
.
getBean
(
requiredType
);
}
private
static
void
assertApplicationContext
()
{
if
(
SpringContextHolder
.
applicationContext
==
null
)
{
throw
new
RuntimeException
(
"applicationContext属性为null,请检查是否注入了SpringContextHolder!"
);
}
}
}
src/main/java/com/system/controller/CommonHttpController.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
controller
;
import
com.system.serivce.ICommonHttpService
;
import
com.system.transfer.platform.PlatformDockingShoppingMallCommodityInVo
;
import
com.system.transfer.response.RestResponse
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
/**
* @author Inori
*/
@RestController
@RequestMapping
(
"/api"
)
public
class
CommonHttpController
{
@Autowired
private
ICommonHttpService
commonHttpService
;
@ApiOperation
(
"触发平台对接商城会员"
)
@GetMapping
(
"/docking/shopping/mall/member"
)
public
RestResponse
dockingShoppingMallMember
()
{
return
RestResponse
.
success
();
}
@ApiOperation
(
"触发平台对接商品"
)
@PostMapping
(
"/docking/shopping/mall/commodity"
)
public
RestResponse
dockingShoppingMallCommodity
(
@RequestBody
PlatformDockingShoppingMallCommodityInVo
inVo
)
{
commonHttpService
.
dockingShoppingMallCommodity
(
inVo
);
return
RestResponse
.
success
();
}
}
src/main/java/com/system/controller/DockingController.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
controller
;
import
com.system.serivce.IDockingService
;
import
com.system.transfer.docking.*
;
import
com.system.transfer.response.RestResponse
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @author Inori
*/
@RestController
@RequestMapping
(
"/api"
)
public
class
DockingController
{
@Autowired
private
IDockingService
dockingService
;
@ApiOperation
(
"分销会员创建"
)
@PostMapping
(
"/docking/distribution/member/create"
)
public
RestResponse
dockingDistributionMemberCreate
(
@RequestBody
DockingDistributionMemberCreateInVo
inVo
)
{
return
dockingService
.
dockingDistributionMemberCreate
(
inVo
);
}
@ApiOperation
(
"分销交易创建"
)
@PostMapping
(
"/docking/distribution/transaction/create"
)
public
RestResponse
dockingDistributionTransactionCreate
(
@RequestBody
DockingDistributionTransactionCreateInVo
inVo
)
{
return
dockingService
.
dockingDistributionTransactionCreate
(
inVo
);
}
@ApiOperation
(
"分销会员下级查询"
)
@PostMapping
(
"/docking/distribution/member/subordinate/list"
)
public
RestResponse
dockingDistributionMemberSubordinateList
(
@RequestBody
DockingDistributionMemberSubordinateListInVo
inVo
)
{
return
dockingService
.
dockingDistributionMemberSubordinateList
(
inVo
);
}
@ApiOperation
(
"分销会员余额"
)
@PostMapping
(
"/docking/distribution/member/balance"
)
public
RestResponse
dockingDistributionMemberBalance
(
@RequestBody
DockingDistributionMemberBalanceInVo
inVo
)
{
return
dockingService
.
dockingDistributionMemberBalance
(
inVo
);
}
@ApiOperation
(
"分销会员收益"
)
@PostMapping
(
"/docking/distribution/member/profit"
)
public
RestResponse
dockingDistributionMemberProfit
(
@RequestBody
DockingDistributionMemberProfitInVo
inVo
)
{
return
dockingService
.
dockingDistributionMemberProfit
(
inVo
);
}
}
src/main/java/com/system/controller/SynchronizationController.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
controller
;
import
com.system.serivce.ISynchronizationService
;
import
com.system.transfer.response.RestResponse
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @author Inori
*/
@Api
(
tags
=
"自动同步"
)
@RestController
@RequestMapping
(
"/api"
)
public
class
SynchronizationController
{
@Autowired
private
ISynchronizationService
synchronizationService
;
@ApiOperation
(
"自动同步"
)
@GetMapping
(
"/mall/synchronization"
)
public
RestResponse
mallSynchronization
()
{
synchronizationService
.
mallSynchronization
();
return
RestResponse
.
success
();
}
}
src/main/java/com/system/dao/CustomFormConfigMapper.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
dao
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.system.transfer.form.CustomFormConfigListInVo
;
import
com.system.transfer.form.CustomFormConfigListOutVoRecords
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* @author Inori
*/
public
interface
CustomFormConfigMapper
{
/**
* 自定义表单配置列表
*
* @param page 分页
* @param inVo 条件
* @return 列表
*/
List
<
CustomFormConfigListOutVoRecords
>
customFormConfigList
(
@Param
(
"page"
)
Page
<
CustomFormConfigListOutVoRecords
>
page
,
@Param
(
"inVo"
)
CustomFormConfigListInVo
inVo
);
}
src/main/java/com/system/dao/SynchronizationRecordsMapper.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
dao
;
import
com.system.transfer.synchronization.SynchronizationRecordsDeleteInVo
;
import
com.system.transfer.synchronization.SynchronizationRecordsListOutVoRecords
;
import
com.system.transfer.synchronization.SynchronizationRecordsUpdateInVo
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author Inori
*/
public
interface
SynchronizationRecordsMapper
{
/**
* 金蝶同步记录列表
*
* @param statusList 状态列表
* @return 同步记录
*/
List
<
SynchronizationRecordsListOutVoRecords
>
synchronizationRecordsListByStatus
(
@Param
(
"statusList"
)
List
<
Integer
>
statusList
);
/**
* 金蝶同步临时记录创建
*
* @param tempList 数据
*/
void
synchronizationRecordsTempCreate
(
@Param
(
"tempList"
)
List
<
Map
<
String
,
Object
>>
tempList
);
/**
* 金蝶同步临时记录列表
*
* @return 列表
*/
List
<
Map
<
String
,
Object
>>
synchronizationRecordsTempList
();
/**
* 金蝶同步记录创建
*
* @param tempList 数据
*/
void
synchronizationRecordsCreate
(
@Param
(
"tempList"
)
List
<
Map
<
String
,
Object
>>
tempList
);
/**
* 根据ID删除数据
*
* @param idList ID列表
*/
void
synchronizationRecordsTempDelete
(
@Param
(
"idList"
)
List
<
Integer
>
idList
);
/**
* 根据ID更新金蝶同步记录状态
*
* @param idList ID列表
*/
void
synchronizationRecordsUpdateByIdList
(
@Param
(
"idList"
)
List
<
Integer
>
idList
);
/**
* 金蝶同步记录更新
*
* @param inVo 条件
*/
void
synchronizationRecordsUpdate
(
SynchronizationRecordsUpdateInVo
inVo
);
/**
* 金蝶同步记录删除
*
* @param inVo 条件
*/
void
synchronizationRecordsDelete
(
SynchronizationRecordsDeleteInVo
inVo
);
}
src/main/java/com/system/dao/ThirdPartyLogMapper.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
dao
;
import
com.system.transfer.log.ThirdPartyLogCreateInVo
;
/**
* @author Inori
*/
public
interface
ThirdPartyLogMapper
{
/**
* 根据唯一标识查询是否存在
*
* @param queueId 唯一标识
* @return 是否存在
*/
Integer
getThirdPartyLogByQueueId
(
String
queueId
);
/**
* 第三方日志创建
*
* @param inVo 条件
*/
void
thirdPartyLogCreate
(
ThirdPartyLogCreateInVo
inVo
);
}
src/main/java/com/system/dao/mapper/CustomFormConfigMapper.xml
0 → 100644
浏览文件 @
81825ce1
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.system.dao.CustomFormConfigMapper"
>
<select
id=
"customFormConfigList"
parameterType=
"com.system.transfer.form.CustomFormConfigListInVo"
resultType=
"com.system.transfer.form.CustomFormConfigListOutVoRecords"
>
SELECT
id, doc_type, `name`, configure_direction, operation, request_address, custom_sql, form_field_mapping_detail, create_time
FROM tb_custom_form_config
</select>
</mapper>
src/main/java/com/system/dao/mapper/SynchronizationRecordsMapper.xml
0 → 100644
浏览文件 @
81825ce1
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.system.dao.SynchronizationRecordsMapper"
>
<select
id=
"synchronizationRecordsListByStatus"
parameterType=
"java.lang.Integer"
resultType=
"com.system.transfer.synchronization.SynchronizationRecordsListOutVoRecords"
>
SELECT
id, fid, data_id, entry_id, form, operation
FROM tb_mall_synchronization_record WHERE status IN
<foreach
collection=
"statusList"
item=
"item"
separator=
", "
open=
"("
close=
")"
>
#{item}
</foreach>
ORDER BY create_time ASC, id ASC
</select>
<insert
id=
"synchronizationRecordsTempCreate"
parameterType=
"java.util.List"
>
INSERT INTO tb_mall_synchronization_record_temp (fid, data_id, entry_id, form, operation) VALUES
<foreach
collection=
"tempList"
item=
"item"
separator=
","
>
(#{item.fid}, #{item.dataId}, #{item.entryId}, #{item.sFormId}, #{item.operation})
</foreach>
ON DUPLICATE KEY UPDATE
fid = VALUES (fid), data_id = VALUES (data_id), entry_id = VALUES (entry_id),
form = VALUES (form), operation = VALUES (operation)
</insert>
<select
id=
"synchronizationRecordsTempList"
resultType=
"java.util.Map"
>
SELECT
id, fid, data_id AS dataId, entry_id AS entryId, form, operation
FROM tb_mall_synchronization_record_temp
</select>
<insert
id=
"synchronizationRecordsCreate"
parameterType=
"java.util.List"
>
INSERT INTO tb_mall_synchronization_record (fid, data_id, entry_id, form, operation) VALUES
<foreach
collection=
"tempList"
item=
"item"
separator=
","
>
(#{item.fid}, #{item.dataId}, #{item.entryId}, #{item.sFormId}, #{item.operation})
</foreach>
ON DUPLICATE KEY UPDATE
fid = VALUES (fid), data_id = VALUES (data_id), entry_id = VALUES (entry_id),
form = VALUES (form), operation = VALUES (operation)
</insert>
<delete
id=
"synchronizationRecordsTempDelete"
parameterType=
"java.util.List"
>
DELETE FROM tb_mall_synchronization_record_temp WHERE id IN
<foreach
collection=
"idList"
item=
"item"
separator=
","
open=
"("
close=
")"
>
#{item}
</foreach>
</delete>
<update
id=
"synchronizationRecordsUpdateByIdList"
parameterType=
"java.util.List"
>
UPDATE tb_mall_synchronization_record SET
<foreach
collection=
"idList"
item=
"item"
open=
"status= CASE id"
close=
"END"
>
WHEN #{item} THEN 1
</foreach>
WHERE id IN
<foreach
collection=
"idList"
item=
"item"
separator=
", "
open=
"("
close=
")"
>
#{item}
</foreach>
</update>
<update
id=
"synchronizationRecordsUpdate"
parameterType=
"com.system.transfer.synchronization.SynchronizationRecordsUpdateInVo"
>
UPDATE tb_mall_synchronization_record SET queue_id = #{queueId}, message = #{message}, status = #{status} WHERE id = #{id} LIMIT 1
</update>
<delete
id=
"synchronizationRecordsDelete"
parameterType=
"com.system.transfer.synchronization.SynchronizationRecordsDeleteInVo"
>
DELETE FROM tb_mall_synchronization_record WHERE id = #{id}
</delete>
</mapper>
src/main/java/com/system/dao/mapper/ThirdPartyLogMapper.xml
0 → 100644
浏览文件 @
81825ce1
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.system.dao.ThirdPartyLogMapper"
>
<select
id=
"getThirdPartyLogByQueueId"
parameterType=
"java.lang.String"
resultType=
"java.lang.Integer"
>
SELECT COUNT(*) FROM tb_third_party_log WHERE queue_id = #{queueId} LIMIT 1
</select>
<insert
id=
"thirdPartyLogCreate"
parameterType=
"com.system.transfer.log.ThirdPartyLogCreateInVo"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
INSERT INTO tb_third_party_log (
`name`, code, queue_id, direction, request, flag, response, message
) VALUES (
#{name}, #{code}, #{queueId}, #{direction}, #{request}, #{flag}, #{response}, #{message}
)
</insert>
</mapper>
src/main/java/com/system/handler/CommonExceptionHandler.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
handler
;
import
com.system.config.HttpContext
;
import
com.system.transfer.response.ErrorResponseData
;
import
com.system.transfer.response.RestResponse
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.core.annotation.Order
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.ObjectError
;
import
org.springframework.web.bind.MethodArgumentNotValidException
;
import
org.springframework.web.bind.annotation.ControllerAdvice
;
import
org.springframework.web.bind.annotation.ExceptionHandler
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.ResponseStatus
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
/**
* 全局的的异常拦截器
*
* @author Inori
*/
@Order
(-
1
)
@ControllerAdvice
public
class
CommonExceptionHandler
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
CommonExceptionHandler
.
class
);
/**
* 参数校验异常
*/
@ResponseStatus
(
HttpStatus
.
OK
)
@ExceptionHandler
(
MethodArgumentNotValidException
.
class
)
@ResponseBody
public
RestResponse
handlerMethodArgumentNotValidException
(
MethodArgumentNotValidException
e
)
{
BindingResult
bindingResult
=
e
.
getBindingResult
();
// 所有参数异常信息
List
<
ObjectError
>
allErrors
=
bindingResult
.
getAllErrors
();
List
<
String
>
errorsMessageList
=
new
ArrayList
<>();
allErrors
.
forEach
(
error
->
{
errorsMessageList
.
add
(
error
.
getDefaultMessage
());
});
String
errorMsg
=
String
.
join
(
";"
,
errorsMessageList
);
return
RestResponse
.
fail
(
errorMsg
);
}
/**
* 拦截未知的运行时异常
*/
@ExceptionHandler
(
RuntimeException
.
class
)
@ResponseStatus
(
HttpStatus
.
INTERNAL_SERVER_ERROR
)
@ResponseBody
public
ErrorResponseData
notFount
(
RuntimeException
e
)
{
log
.
error
(
"运行时异常:"
,
e
);
return
new
ErrorResponseData
(
500
,
e
.
getMessage
(),
"Internal Server Error"
,
Objects
.
requireNonNull
(
HttpContext
.
getRequest
()).
getRequestURI
());
}
}
src/main/java/com/system/handler/FacePlusThrowErrorHandler.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
handler
;
import
org.springframework.http.client.ClientHttpResponse
;
import
org.springframework.web.client.ResponseErrorHandler
;
import
javax.validation.constraints.NotNull
;
/**
* @author Inori
*/
public
class
FacePlusThrowErrorHandler
implements
ResponseErrorHandler
{
@Override
public
boolean
hasError
(
@NotNull
ClientHttpResponse
response
)
{
return
false
;
}
@Override
public
void
handleError
(
@NotNull
ClientHttpResponse
response
)
{
}
}
src/main/java/com/system/scheduler/SecretScheduler.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
scheduler
;
import
com.system.serivce.impl.DockingDistributionServiceImpl
;
import
com.system.utils.HttpUtil
;
import
com.system.utils.JsonUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
java.util.Map
;
/**
* @author Inori
*/
@Configuration
@EnableScheduling
public
class
SecretScheduler
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
SecretScheduler
.
class
);
@Autowired
private
DockingDistributionServiceImpl
dockingDistributionServiceImpl
;
@Scheduled
(
fixedRate
=
1000
*
60
*
15
)
public
void
configureTasks
()
{
String
result
=
HttpUtil
.
httpGet
(
"http://192.168.0.34:8080/api/v1/getSign"
).
getBody
();
Map
<
String
,
Object
>
map
=
JsonUtil
.
toMap
(
result
,
String
.
class
,
Object
.
class
);
dockingDistributionServiceImpl
.
setSecret
(
String
.
valueOf
(
map
.
get
(
"data"
)));
}
}
src/main/java/com/system/serivce/ICommonHttpService.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
serivce
;
import
com.system.transfer.platform.PlatformDockingShoppingMallCommodityInVo
;
/**
* @author Inori
*/
public
interface
ICommonHttpService
{
/**
* 触发平台对接商品
*
* @param inVo 条件
*/
void
dockingShoppingMallCommodity
(
PlatformDockingShoppingMallCommodityInVo
inVo
);
}
src/main/java/com/system/serivce/IDockingDistributionService.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
serivce
;
import
com.system.transfer.response.RestResponse
;
import
java.util.Map
;
/**
* @author Inori
*/
public
interface
IDockingDistributionService
{
/**
* 对接分销会员创建
*
* @param queueId 唯一标识
* @param data 参数
* @return 结果
*/
String
dockingDistributionMemberCreate
(
String
queueId
,
Map
<
String
,
Object
>
data
);
/**
* 对接订单交易创建
*
* @param queueId 唯一标识
* @param data 参数
* @return 结果
*/
String
dockingDistributionTransactionCreate
(
String
queueId
,
Map
<
String
,
Object
>
data
);
/**
* 对接订单提现创建
*
* @return 结果
*/
RestResponse
dockingDistributionWithdrawalCreate
();
/**
* 查询分销会员下级列表
*
* @param memberId 会员标识
* @param queueId 唯一标识
* @return 结果
*/
String
dockingDistributionMemberSubordinateList
(
String
queueId
,
String
memberId
);
/**
* 会员余额
*
* @param memberId 会员标识
* @param queueId 唯一标识
* @return 结果
*/
String
dockingDistributionMemberBalance
(
String
queueId
,
String
memberId
);
/**
* 会员收益
*
* @param memberId 会员标识
* @param queueId 唯一标识
* @return 结果
*/
String
dockingDistributionMemberProfit
(
String
queueId
,
String
memberId
);
}
src/main/java/com/system/serivce/IDockingService.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
serivce
;
import
com.system.transfer.docking.*
;
import
com.system.transfer.response.RestResponse
;
/**
* @author Inori
*/
public
interface
IDockingService
{
/**
* 对接分销会员创建
*
* @param inVo 条件
* @return 结果
*/
RestResponse
dockingDistributionMemberCreate
(
DockingDistributionMemberCreateInVo
inVo
);
/**
* 对接分销交易创建
*
* @param inVo 条件
* @return 结果
*/
RestResponse
dockingDistributionTransactionCreate
(
DockingDistributionTransactionCreateInVo
inVo
);
/**
* 查询分销会员下级列表
*
* @param inVo 条件
* @return 结果
*/
RestResponse
dockingDistributionMemberSubordinateList
(
DockingDistributionMemberSubordinateListInVo
inVo
);
/**
* 分销会员余额
*
* @param inVo 条件
* @return 结果
*/
RestResponse
dockingDistributionMemberBalance
(
DockingDistributionMemberBalanceInVo
inVo
);
/**
* 分销会员余额
*
* @param inVo 条件
* @return 结果
*/
RestResponse
dockingDistributionMemberProfit
(
DockingDistributionMemberProfitInVo
inVo
);
}
src/main/java/com/system/serivce/IDockingShoppingMallService.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
serivce
;
/**
* @author Inori
*/
public
interface
IDockingShoppingMallService
{
/**
* 查询商城订单列表
*
* @return 列表
*/
String
shoppingMallOrderList
();
/**
* 查询商城产品列表
*/
void
shoppingMallProductList
();
/**
* 查询商城会员列表
*
* @param queueId 唯一标识
* @return 列表
*/
String
shoppingMallMemberList
(
String
queueId
);
}
src/main/java/com/system/serivce/ISynchronizationService.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
serivce
;
/**
* @author Inori
*/
public
interface
ISynchronizationService
{
/**
* 同步对接
*/
void
mallSynchronization
();
}
src/main/java/com/system/serivce/impl/DockingDistributionServiceImpl.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
serivce
.
impl
;
import
com.system.constants.Constants
;
import
com.system.serivce.IDockingDistributionService
;
import
com.system.transfer.response.RestResponse
;
import
com.system.utils.HttpUtil
;
import
com.system.utils.JsonUtil
;
import
com.system.utils.StringUtil
;
import
com.system.utils.ThirdPartyLogUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @author Inori
*/
@Service
public
class
DockingDistributionServiceImpl
implements
IDockingDistributionService
{
public
String
secret
;
@Autowired
private
ThirdPartyLogUtil
thirdPartyLogUtil
;
public
void
setSecret
(
String
secret
)
{
this
.
secret
=
secret
;
}
@Override
public
String
dockingDistributionMemberCreate
(
String
queueId
,
Map
<
String
,
Object
>
data
)
{
try
{
data
.
put
(
"secret"
,
secret
);
String
result
=
HttpUtil
.
httpPost
(
"http://192.168.0.34:8080/api/v1/memberAdd"
,
JsonUtil
.
toString
(
data
)).
getBody
();
thirdPartyLogUtil
.
thirdPartyLogCreate
(
"分销会员创建"
,
"0002"
,
queueId
,
"平台->分销"
,
JsonUtil
.
toString
(
data
),
StringUtil
.
replaceBlank
(
result
));
return
result
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
""
;
}
}
@Override
public
String
dockingDistributionTransactionCreate
(
String
queueId
,
Map
<
String
,
Object
>
data
)
{
try
{
data
.
put
(
"secret"
,
secret
);
String
result
=
HttpUtil
.
httpPost
(
"http://192.168.0.34:8080/api/v1/trade"
,
JsonUtil
.
toString
(
data
)).
getBody
();
thirdPartyLogUtil
.
thirdPartyLogCreate
(
"分销交易创建"
,
"0001"
,
queueId
,
"平台->分销"
,
JsonUtil
.
toString
(
data
),
StringUtil
.
replaceBlank
(
result
));
return
result
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
""
;
}
}
@Override
public
RestResponse
dockingDistributionWithdrawalCreate
()
{
try
{
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"secret"
,
secret
);
data
.
put
(
"userId"
,
"admin"
);
data
.
put
(
"amount"
,
"1"
);
data
.
put
(
"accountType"
,
"2"
);
String
result
=
HttpUtil
.
httpPost
(
"http://192.168.0.34:8080/api/v1/withdraw"
,
JsonUtil
.
toString
(
data
)).
getBody
();
Map
<
String
,
Object
>
map
=
JsonUtil
.
toMap
(
result
,
String
.
class
,
Object
.
class
);
if
(
CollectionUtils
.
isEmpty
(
map
)
||
!
Constants
.
SUCCESS_CODE
.
equals
(
String
.
valueOf
(
map
.
get
(
Constants
.
SUCCESS_NAME
))))
{
return
RestResponse
.
fail
(
"新增提现失败"
);
}
return
RestResponse
.
success
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
RestResponse
.
fail
(
"新增提现失败"
);
}
}
@Override
public
String
dockingDistributionMemberSubordinateList
(
String
queueId
,
String
memberId
)
{
try
{
Map
<
String
,
Object
>
data
=
new
HashMap
<>(
2
);
data
.
put
(
"secret"
,
secret
);
data
.
put
(
"memberId"
,
memberId
);
String
result
=
HttpUtil
.
httpPost
(
"http://192.168.0.34:8080/api/v1/subordinate"
,
JsonUtil
.
toString
(
data
)).
getBody
();
thirdPartyLogUtil
.
thirdPartyLogCreate
(
"分销会员下级查询"
,
"0001"
,
queueId
,
"平台->分销"
,
JsonUtil
.
toString
(
data
),
StringUtil
.
replaceBlank
(
result
));
return
result
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
""
;
}
}
@Override
public
String
dockingDistributionMemberBalance
(
String
queueId
,
String
memberId
)
{
try
{
Map
<
String
,
Object
>
data
=
new
HashMap
<>(
2
);
data
.
put
(
"secret"
,
secret
);
data
.
put
(
"memberId"
,
memberId
);
String
result
=
HttpUtil
.
httpPost
(
"http://192.168.0.34:8080/api/v1/member/balance"
,
JsonUtil
.
toString
(
data
)).
getBody
();
thirdPartyLogUtil
.
thirdPartyLogCreate
(
"分销会员余额查询"
,
"0001"
,
queueId
,
"平台->分销"
,
JsonUtil
.
toString
(
data
),
StringUtil
.
replaceBlank
(
result
));
return
result
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
""
;
}
}
@Override
public
String
dockingDistributionMemberProfit
(
String
queueId
,
String
memberId
)
{
try
{
Map
<
String
,
Object
>
data
=
new
HashMap
<>(
2
);
data
.
put
(
"secret"
,
secret
);
data
.
put
(
"memberId"
,
memberId
);
data
.
put
(
"offset"
,
0
);
data
.
put
(
"limit"
,
10000
);
String
result
=
HttpUtil
.
httpPost
(
"http://192.168.0.34:8080/api/v1/member/profit"
,
JsonUtil
.
toString
(
data
)).
getBody
();
thirdPartyLogUtil
.
thirdPartyLogCreate
(
"分销会员收益查询"
,
"0001"
,
queueId
,
"平台->分销"
,
JsonUtil
.
toString
(
data
),
StringUtil
.
replaceBlank
(
result
));
return
result
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
""
;
}
}
}
src/main/java/com/system/serivce/impl/DockingServiceImpl.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
serivce
.
impl
;
import
com.system.constants.Constants
;
import
com.system.serivce.IDockingDistributionService
;
import
com.system.serivce.IDockingService
;
import
com.system.transfer.docking.*
;
import
com.system.transfer.response.RestResponse
;
import
com.system.utils.JsonUtil
;
import
com.system.utils.StringUtil
;
import
com.system.utils.ThirdPartyLogUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.CollectionUtils
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* @author Inori
*/
@Service
public
class
DockingServiceImpl
implements
IDockingService
{
@Autowired
private
IDockingDistributionService
dockingDistributionService
;
@Autowired
private
ThirdPartyLogUtil
thirdPartyLogUtil
;
@Override
public
RestResponse
dockingDistributionMemberCreate
(
DockingDistributionMemberCreateInVo
inVo
)
{
if
(
thirdPartyLogUtil
.
isExist
(
inVo
.
getQueueId
())
!=
0
)
{
return
RestResponse
.
fail
(
"操作失败! QUEUE_ID为: "
+
inVo
.
getQueueId
()
+
"的唯一标识已存在"
);
}
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"disUserId"
,
inVo
.
getMemberId
());
data
.
put
(
"disUserName"
,
inVo
.
getMemberName
());
data
.
put
(
"disParentId"
,
inVo
.
getReferrerId
());
if
(
StringUtil
.
isBlank
(
inVo
.
getReferrerId
()))
{
data
.
put
(
"disPlatformId"
,
"test"
);
}
else
{
data
.
put
(
"disPlatformId"
,
""
);
}
data
.
put
(
"disNote"
,
inVo
.
getRemark
());
System
.
out
.
println
(
JsonUtil
.
toString
(
data
));
String
result
=
dockingDistributionService
.
dockingDistributionMemberCreate
(
inVo
.
getQueueId
(),
data
);
Map
<
String
,
Object
>
map
=
JsonUtil
.
toMap
(
result
,
String
.
class
,
Object
.
class
);
if
(
CollectionUtils
.
isEmpty
(
map
)
||
!
Constants
.
SUCCESS_CODE
.
equals
(
String
.
valueOf
(
map
.
get
(
Constants
.
SUCCESS_NAME
))))
{
return
RestResponse
.
fail
(
"新增会员失败!"
+
map
.
get
(
"errorMessage"
));
}
return
RestResponse
.
success
();
}
@Override
public
RestResponse
dockingDistributionTransactionCreate
(
DockingDistributionTransactionCreateInVo
inVo
)
{
if
(
thirdPartyLogUtil
.
isExist
(
inVo
.
getQueueId
())
!=
0
)
{
return
RestResponse
.
fail
(
"操作失败! QUEUE_ID为: "
+
inVo
.
getQueueId
()
+
"的唯一标识已存在"
);
}
Map
<
String
,
Object
>
data
=
new
HashMap
<>();
data
.
put
(
"disSetUserId"
,
inVo
.
getMemberId
());
data
.
put
(
"orderId"
,
inVo
.
getOrderId
());
data
.
put
(
"disNote"
,
inVo
.
getRemark
());
data
.
put
(
"disAmount"
,
inVo
.
getAmount
());
String
result
=
dockingDistributionService
.
dockingDistributionTransactionCreate
(
inVo
.
getQueueId
(),
data
);
Map
<
String
,
Object
>
map
=
JsonUtil
.
toMap
(
result
,
String
.
class
,
Object
.
class
);
if
(
CollectionUtils
.
isEmpty
(
map
)
||
!
Constants
.
SUCCESS_CODE
.
equals
(
String
.
valueOf
(
map
.
get
(
Constants
.
SUCCESS_NAME
))))
{
return
RestResponse
.
fail
(
"新增交易失败! "
+
map
.
get
(
"errorMessage"
));
}
return
RestResponse
.
success
();
}
@Override
public
RestResponse
dockingDistributionMemberSubordinateList
(
DockingDistributionMemberSubordinateListInVo
inVo
)
{
if
(
thirdPartyLogUtil
.
isExist
(
inVo
.
getQueueId
())
!=
0
)
{
return
RestResponse
.
fail
(
"操作失败! QUEUE_ID为: "
+
inVo
.
getQueueId
()
+
"的唯一标识已存在"
);
}
String
result
=
dockingDistributionService
.
dockingDistributionMemberSubordinateList
(
inVo
.
getQueueId
(),
inVo
.
getMemberId
());
List
<
Map
<
String
,
Object
>>
recordsList
=
new
ArrayList
<>();
Map
<
String
,
Object
>
map
=
JsonUtil
.
toMap
(
result
,
String
.
class
,
Object
.
class
);
if
(!
CollectionUtils
.
isEmpty
(
map
)
&&
Constants
.
SUCCESS_CODE
.
equals
(
String
.
valueOf
(
map
.
get
(
Constants
.
SUCCESS_NAME
))))
{
List
<
Object
>
objectList
=
JsonUtil
.
toList
(
JsonUtil
.
toString
(
map
.
get
(
"data"
)),
Object
.
class
);
List
<
Map
<
String
,
Object
>>
tempList
=
objectList
.
stream
().
map
(
m
->
JsonUtil
.
toMap
(
JsonUtil
.
toString
(
m
),
String
.
class
,
Object
.
class
)).
collect
(
Collectors
.
toList
());
List
<
Map
<
String
,
Object
>>
temp01List
=
tempList
.
stream
().
filter
(
m
->
inVo
.
getMemberId
().
equals
(
m
.
get
(
"parentId"
))).
collect
(
Collectors
.
toList
());
for
(
Map
<
String
,
Object
>
temp
:
temp01List
)
{
List
<
Map
<
String
,
Object
>>
temp02List
=
tempList
.
stream
().
filter
(
m
->
temp
.
get
(
"memberId"
).
equals
(
m
.
get
(
"parentId"
))).
collect
(
Collectors
.
toList
());
recordsList
.
add
(
temp
);
recordsList
.
addAll
(
temp02List
);
}
return
RestResponse
.
success
(
recordsList
);
}
return
RestResponse
.
success
();
}
@Override
public
RestResponse
dockingDistributionMemberBalance
(
DockingDistributionMemberBalanceInVo
inVo
)
{
if
(
thirdPartyLogUtil
.
isExist
(
inVo
.
getQueueId
())
!=
0
)
{
return
RestResponse
.
fail
(
"操作失败! QUEUE_ID为: "
+
inVo
.
getQueueId
()
+
"的唯一标识已存在"
);
}
String
result
=
dockingDistributionService
.
dockingDistributionMemberBalance
(
inVo
.
getQueueId
(),
inVo
.
getMemberId
());
Map
<
String
,
Object
>
map
=
JsonUtil
.
toMap
(
result
,
String
.
class
,
Object
.
class
);
if
(!
CollectionUtils
.
isEmpty
(
map
)
&&
Constants
.
SUCCESS_CODE
.
equals
(
String
.
valueOf
(
map
.
get
(
Constants
.
SUCCESS_NAME
))))
{
return
RestResponse
.
success
(
map
.
get
(
"data"
));
}
return
RestResponse
.
success
();
}
@Override
public
RestResponse
dockingDistributionMemberProfit
(
DockingDistributionMemberProfitInVo
inVo
)
{
if
(
thirdPartyLogUtil
.
isExist
(
inVo
.
getQueueId
())
!=
0
)
{
return
RestResponse
.
fail
(
"操作失败! QUEUE_ID为: "
+
inVo
.
getQueueId
()
+
"的唯一标识已存在"
);
}
String
result
=
dockingDistributionService
.
dockingDistributionMemberProfit
(
inVo
.
getQueueId
(),
inVo
.
getMemberId
());
Map
<
String
,
Object
>
map
=
JsonUtil
.
toMap
(
result
,
String
.
class
,
Object
.
class
);
if
(!
CollectionUtils
.
isEmpty
(
map
)
&&
Constants
.
SUCCESS_CODE
.
equals
(
String
.
valueOf
(
map
.
get
(
Constants
.
SUCCESS_NAME
))))
{
return
RestResponse
.
success
(
map
.
get
(
"data"
));
}
return
RestResponse
.
success
();
}
}
src/main/java/com/system/serivce/impl/DockingShoppingMallServiceImpl.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
serivce
.
impl
;
import
com.system.serivce.IDockingShoppingMallService
;
import
com.system.utils.HttpUtil
;
import
com.system.utils.JsonUtil
;
import
com.system.utils.ThirdPartyLogUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* @author Inori
*/
@Service
public
class
DockingShoppingMallServiceImpl
implements
IDockingShoppingMallService
{
@Autowired
private
ThirdPartyLogUtil
thirdPartyLogUtil
;
@Override
public
String
shoppingMallOrderList
()
{
Map
<
String
,
Object
>
data
=
new
HashMap
<>(
2
);
data
.
put
(
"startTime"
,
"2019-01-01+00:00:00"
);
data
.
put
(
"endTime"
,
"2022-10-12+23:59:59"
);
String
result
=
HttpUtil
.
httpGet
(
"http://192.168.2.212:81/apis/order/order/page?current=1&size=100"
,
data
).
getBody
();
System
.
out
.
println
(
result
);
return
result
;
}
@Override
public
void
shoppingMallProductList
()
{
Map
<
String
,
Object
>
data
=
new
HashMap
<>(
2
);
data
.
put
(
"startTime"
,
"2019-01-01+00:00:00"
);
data
.
put
(
"endTime"
,
"2022-10-12+23:59:59"
);
String
result
=
HttpUtil
.
httpGet
(
"http://192.168.2.212:81/apis/prod/prod/page?current=1&size=100"
,
data
).
getBody
();
System
.
out
.
println
(
result
);
}
@Override
public
String
shoppingMallMemberList
(
String
queueId
)
{
Map
<
String
,
Object
>
data
=
new
HashMap
<>(
2
);
data
.
put
(
"startTime"
,
"2019-01-01+00:00:00"
);
data
.
put
(
"endTime"
,
"2022-10-12+23:59:59"
);
StringBuilder
param
=
new
StringBuilder
();
for
(
Map
.
Entry
<
String
,
Object
>
entry
:
data
.
entrySet
())
{
if
(
param
.
length
()
>
0
)
{
param
.
append
(
"&"
).
append
(
entry
.
getKey
()).
append
(
"="
).
append
(
entry
.
getValue
());
}
else
{
param
.
append
(
entry
.
getKey
()).
append
(
"="
).
append
(
entry
.
getValue
());
}
}
String
result
=
HttpUtil
.
httpGet
(
"https://console-mock.apipost.cn/app/mock/project/a0605054-5c08-47a3-e61e-76782a1bc5aa/member/list"
).
getBody
();
thirdPartyLogUtil
.
thirdPartyLogCreate
(
"商城会员查询"
,
"0000"
,
queueId
,
"商城->平台"
,
JsonUtil
.
toString
(
data
),
result
);
return
result
;
}
}
src/main/java/com/system/serivce/impl/ICommonHttpServiceImpl.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
serivce
.
impl
;
import
com.system.serivce.ICommonHttpService
;
import
com.system.transfer.platform.PlatformDockingShoppingMallCommodityInVo
;
import
com.system.utils.HttpUtil
;
import
com.system.utils.JsonUtil
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
/**
* @author Inori
*/
@Service
public
class
ICommonHttpServiceImpl
implements
ICommonHttpService
{
@Override
public
void
dockingShoppingMallCommodity
(
PlatformDockingShoppingMallCommodityInVo
inVo
)
{
ResponseEntity
<
String
>
responseEntity
=
HttpUtil
.
httpPost
(
"http://192.168.0.9:8089/api/dataSyn/getSyn"
,
JsonUtil
.
toString
(
Stream
.
of
(
inVo
.
getId
()).
collect
(
Collectors
.
toList
())));
System
.
out
.
println
(
responseEntity
.
getBody
());
List
<
Object
>
tempList
=
JsonUtil
.
toList
(
JsonUtil
.
toString
(
responseEntity
.
getBody
()),
Object
.
class
);
Map
<
String
,
Object
>
map
=
JsonUtil
.
toMap
(
JsonUtil
.
toString
(
tempList
.
get
(
0
)),
String
.
class
,
Object
.
class
);
Map
<
String
,
Object
>
request
=
new
HashMap
<>(
3
);
request
.
put
(
"dataId"
,
map
.
get
(
"dataId"
));
request
.
put
(
"form"
,
map
.
get
(
"form"
));
request
.
put
(
"operation"
,
map
.
get
(
"operation"
));
ResponseEntity
<
String
>
result
=
HttpUtil
.
httpPost
(
"http://192.168.0.9:8089/api/dataSyn/synData"
,
JsonUtil
.
toString
(
request
));
System
.
out
.
println
(
result
.
getBody
());
}
}
src/main/java/com/system/serivce/impl/SynchronizationServiceImpl.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
serivce
.
impl
;
import
com.google.common.util.concurrent.ThreadFactoryBuilder
;
import
com.system.api.CommonGetApi
;
import
com.system.constants.CommonGetConstants
;
import
com.system.serivce.ISynchronizationService
;
import
com.system.utils.HttpUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.LinkedBlockingQueue
;
import
java.util.concurrent.ThreadPoolExecutor
;
import
java.util.concurrent.TimeUnit
;
/**
* @author Inori
*/
@Service
public
class
SynchronizationServiceImpl
implements
ISynchronizationService
{
private
ExecutorService
threadPool
=
new
ThreadPoolExecutor
(
10
,
10
,
0L
,
TimeUnit
.
MILLISECONDS
,
new
LinkedBlockingQueue
<
Runnable
>(
1024
),
new
ThreadFactoryBuilder
().
setNameFormat
(
"syn-pool-%d"
).
build
(),
new
ThreadPoolExecutor
.
AbortPolicy
());
@Autowired
private
CommonGetConstants
commonGetConstants
;
@Autowired
private
CommonGetApi
commonGetApi
;
@Override
public
void
mallSynchronization
()
{
ResponseEntity
<
String
>
responseEntity
=
HttpUtil
.
httpPost
(
"http://192.168.0.9:8089/api/dataSyn/getSyn"
,
""
);
System
.
out
.
println
(
responseEntity
.
getBody
());
/*List<Object> objectList = JsonUtil.toList(responseEntity.getBody(), Object.class);
for (Object object : objectList) {
Map<String, Object> temp = JsonUtil.toMap(JsonUtil.toString(object), String.class, Object.class);
Map<String, String> config = commonGetConstants.get(String.valueOf(temp.get("form")));
if (!CollectionUtils.isEmpty(config)) {
continue;
}
String queueId = SnowFlakeIdUtil.generateId().toString();
String result = commonGetApi.commonGet(config, "", queueId);
Map<String, Object> map = JsonUtil.toMap(result, String.class, Object.class);
if (!CollectionUtils.isEmpty(map) && Constants.SUCCESS_CODE.equals(String.valueOf(map.get(Constants.SUCCESS_NAME)))) {
Map<String, Object> data = JsonUtil.toMap(JsonUtil.toString(map.get("data")), String.class, Object.class);
commonGetApi.commonSync(String.valueOf(temp.get("response_address")), queueId, config, JsonUtil.toString(data));
}
}*/
}
}
src/main/java/com/system/transfer/docking/DockingDistributionMemberBalanceInVo.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
transfer
.
docking
;
import
lombok.Data
;
/**
* @author Inori
*/
@Data
public
class
DockingDistributionMemberBalanceInVo
{
/**
* 唯一标识
*/
private
String
queueId
;
/**
* 会员标识
*/
private
String
memberId
;
}
src/main/java/com/system/transfer/docking/DockingDistributionMemberCreateInVo.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
transfer
.
docking
;
import
lombok.Data
;
/**
* @author Inori
*/
@Data
public
class
DockingDistributionMemberCreateInVo
{
/**
* 唯一标识
*/
private
String
queueId
;
/**
* 会员标识
*/
private
String
memberId
;
/**
* 会员名称
*/
private
String
memberName
;
/**
* 推荐人标识
*/
private
String
referrerId
;
/**
* 平台标识
*/
private
String
platformId
;
/**
* 备注
*/
private
String
remark
;
}
src/main/java/com/system/transfer/docking/DockingDistributionMemberProfitInVo.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
transfer
.
docking
;
import
lombok.Data
;
/**
* @author Inori
*/
@Data
public
class
DockingDistributionMemberProfitInVo
{
/**
* 唯一标识
*/
private
String
queueId
;
/**
* 会员标识
*/
private
String
memberId
;
}
src/main/java/com/system/transfer/docking/DockingDistributionMemberSubordinateListInVo.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
transfer
.
docking
;
import
lombok.Data
;
/**
* @author Inori
*/
@Data
public
class
DockingDistributionMemberSubordinateListInVo
{
/**
* 唯一标识
*/
private
String
queueId
;
/**
* 会员标识
*/
private
String
memberId
;
}
src/main/java/com/system/transfer/docking/DockingDistributionTransactionCreateInVo.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
transfer
.
docking
;
import
lombok.Data
;
/**
* @author Inori
*/
@Data
public
class
DockingDistributionTransactionCreateInVo
{
/**
* 唯一标识
*/
private
String
queueId
;
/**
* 会员标识
*/
private
String
memberId
;
/**
* 订单号
*/
private
String
orderId
;
/**
* 金额
*/
private
String
amount
;
/**
* 备注
*/
private
String
remark
;
}
src/main/java/com/system/transfer/form/CustomFormConfigListInVo.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
transfer
.
form
;
import
lombok.Data
;
/**
* @author Inori
*/
@Data
public
class
CustomFormConfigListInVo
{
/**
* 操作(1-查询 2-创建)
*/
private
Integer
operation
;
/**
* 页码
*/
private
Integer
pageNo
=
1
;
/**
* 每页数量
*/
private
Integer
pageSize
=
20
;
public
CustomFormConfigListInVo
()
{
}
public
CustomFormConfigListInVo
(
Integer
operation
)
{
this
.
operation
=
operation
;
}
}
src/main/java/com/system/transfer/form/CustomFormConfigListOutVoRecords.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
transfer
.
form
;
import
lombok.Data
;
/**
* @author Inori
*/
@Data
public
class
CustomFormConfigListOutVoRecords
{
/**
* ID
*/
private
Integer
id
;
/**
* 第三方标识
*/
private
String
docType
;
/**
* 日志名称
*/
private
String
name
;
/**
* 配置方向
*/
private
String
configureDirection
;
/**
* 操作(1-查询 2-创建)
*/
private
Integer
operation
;
/**
* 请求地址
*/
private
String
requestAddress
;
/**
* 自定义Sql
*/
private
String
customSql
;
/**
* 表单字段映射明细
*/
private
String
formFieldMappingDetail
;
/**
* 创建时间
*/
private
String
createTime
;
}
src/main/java/com/system/transfer/form/FormFieldMappingDetailOutVoRecords.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
transfer
.
form
;
import
lombok.Data
;
/**
* @author Inori
*/
@Data
public
class
FormFieldMappingDetailOutVoRecords
{
/**
* 映射前字段
*/
private
String
fieldBeforeMapping
;
/**
* 映射前字段名称
*/
private
String
fieldBeforeMappingName
;
/**
* 字段类型
*/
private
String
fieldType
;
/**
* 是否是分录字段
*/
private
Integer
isEntryField
;
/**
* 映射后字段
*/
private
String
fieldAfterMapping
;
/**
* 映射后字段名称
*/
private
String
fieldAfterMappingName
;
}
src/main/java/com/system/transfer/log/ThirdPartyLogCreateInVo.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
transfer
.
log
;
import
lombok.Data
;
/**
* @author Inori
*/
@Data
public
class
ThirdPartyLogCreateInVo
{
/**
* ID
*/
private
Integer
id
;
/**
* 业务名称
*/
private
String
name
;
/**
* 业务标识
*/
private
String
code
;
/**
* 唯一标识
*/
private
String
queueId
;
/**
* 请求方向
*/
private
String
direction
;
/**
* 请求参数
*/
private
String
request
;
/**
* 是否成功(0-失败,1-成功)
*/
private
Integer
flag
;
/**
* 响应信息
*/
private
String
response
;
/**
* 错误原因
*/
private
String
message
;
}
src/main/java/com/system/transfer/platform/PlatformDockingShoppingMallCommodityInVo.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
transfer
.
platform
;
import
lombok.Data
;
/**
* @author Inori
*/
@Data
public
class
PlatformDockingShoppingMallCommodityInVo
{
/**
* ID
*/
private
Integer
id
;
}
src/main/java/com/system/transfer/response/ErrorResponseData.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
transfer
.
response
;
import
lombok.Data
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
/**
* 请求失败的返回
*
* @author stylefeng
* @Date 2018/1/4 22:39
*/
@Data
public
class
ErrorResponseData
{
/**
* 响应时间
*/
private
String
timestamp
;
/**
* 响应状态码
*/
private
Integer
code
;
/**
* 响应信息
*/
private
String
message
;
/**
* 异常的具体类名称
*/
private
String
error
;
/**
* 路径
*/
private
String
path
;
public
ErrorResponseData
(
Integer
code
,
String
message
,
String
error
,
String
path
)
{
this
.
timestamp
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
).
format
(
new
Date
());
this
.
code
=
code
;
this
.
message
=
message
;
this
.
error
=
error
;
this
.
path
=
path
;
}
}
src/main/java/com/system/transfer/response/RestResponse.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
transfer
.
response
;
/**
* @author Inori
*/
public
class
RestResponse
{
public
static
final
int
CODE_SUCCESS
=
200
;
public
static
final
int
CODE_VERSION_NONSUPPORT
=
305
;
public
static
final
int
CODE_PARAM_ERROR
=
400
;
public
static
final
int
CODE_TOKEN_EXPIRED
=
402
;
public
static
final
int
CODE_TOKEN_NOTFOUND
=
403
;
public
static
final
int
CODE_FORBIDDEN
=
406
;
public
static
final
int
CODE_SERVER_ERROR
=
500
;
private
int
code
;
private
String
message
;
private
Object
data
=
null
;
public
static
RestResponse
success
()
{
RestResponse
restResponse
=
new
RestResponse
();
restResponse
.
setCode
(
200
);
restResponse
.
setData
(
new
Object
());
return
restResponse
;
}
public
static
RestResponse
success
(
Object
data
)
{
RestResponse
restResponse
=
new
RestResponse
();
restResponse
.
setCode
(
200
);
restResponse
.
setData
(
data
);
return
restResponse
;
}
public
static
RestResponse
fail
(
int
code
,
String
msg
)
{
RestResponse
restResponse
=
new
RestResponse
();
restResponse
.
setCode
(
code
);
restResponse
.
setMessage
(
msg
);
return
restResponse
;
}
public
static
RestResponse
fail
(
String
msg
)
{
return
fail
(
CODE_PARAM_ERROR
,
msg
);
}
public
static
RestResponse
fail
(
String
msg
,
Object
data
)
{
RestResponse
restResponse
=
new
RestResponse
();
restResponse
.
setCode
(
CODE_PARAM_ERROR
);
restResponse
.
setMessage
(
msg
);
restResponse
.
setData
(
data
);
return
restResponse
;
}
public
static
RestResponse
error
(
String
msg
)
{
RestResponse
restResponse
=
new
RestResponse
();
restResponse
.
setCode
(
CODE_SERVER_ERROR
);
restResponse
.
setMessage
(
msg
);
return
restResponse
;
}
public
boolean
isSuccess
()
{
return
CODE_SUCCESS
==
this
.
code
;
}
public
int
getCode
()
{
return
code
;
}
public
RestResponse
setCode
(
int
code
)
{
this
.
code
=
code
;
return
this
;
}
public
String
getMessage
()
{
return
message
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
public
Object
getData
()
{
if
(
data
==
null
)
{
return
new
Object
();
}
return
data
;
}
public
void
setData
(
Object
data
)
{
this
.
data
=
data
;
}
}
src/main/java/com/system/transfer/synchronization/SynchronizationRecordsDeleteInVo.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
transfer
.
synchronization
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @author Inori
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
SynchronizationRecordsDeleteInVo
{
/**
* ID
*/
private
Integer
id
;
}
src/main/java/com/system/transfer/synchronization/SynchronizationRecordsListInVo.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
transfer
.
synchronization
;
import
com.system.utils.StringUtil
;
/**
* @author Inori
*/
public
class
SynchronizationRecordsListInVo
{
/**
* 同步记录主键
*/
private
String
fid
;
/**
* 金蝶标识
*/
private
String
sFormId
;
/**
* 唯一标识
*/
private
String
queueId
;
/**
* 同步状态(0-未同步,1-同步中,2-同步成功,3-同步失败)
*/
private
Integer
status
;
/**
* 页码
*/
private
Integer
pageNo
;
/**
* 每页数量
*/
private
Integer
pageSize
;
private
static
final
Integer
DEFAULT_PAGE_NO
=
1
;
private
static
final
Integer
DEFAULT_PAGE_SIZE
=
20
;
public
SynchronizationRecordsListInVo
()
{
}
public
SynchronizationRecordsListInVo
(
Integer
status
)
{
this
.
status
=
status
;
}
public
String
getFid
()
{
return
fid
;
}
public
void
setFid
(
String
fid
)
{
this
.
fid
=
fid
;
}
public
String
getsFormId
()
{
return
sFormId
;
}
public
void
setsFormId
(
String
sFormId
)
{
this
.
sFormId
=
sFormId
;
}
public
String
getQueueId
()
{
return
queueId
;
}
public
void
setQueueId
(
String
queueId
)
{
this
.
queueId
=
queueId
;
}
public
Integer
getStatus
()
{
return
status
;
}
public
void
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
}
public
Integer
getPageNo
()
{
if
(
StringUtil
.
isNull
(
pageNo
)
||
pageNo
==
-
1
)
{
return
DEFAULT_PAGE_NO
;
}
return
pageNo
;
}
public
void
setPageNo
(
Integer
pageNo
)
{
this
.
pageNo
=
pageNo
;
}
public
Integer
getPageSize
()
{
if
(
StringUtil
.
isNull
(
pageSize
)
||
pageSize
==
-
1
)
{
return
DEFAULT_PAGE_SIZE
;
}
return
pageSize
;
}
public
void
setPageSize
(
Integer
pageSize
)
{
this
.
pageSize
=
pageSize
;
}
}
src/main/java/com/system/transfer/synchronization/SynchronizationRecordsListOutVo.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
transfer
.
synchronization
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author Inori
*/
@Data
public
class
SynchronizationRecordsListOutVo
{
/**
* 总数
*/
private
Integer
total
;
/**
* 记录
*/
private
List
<
SynchronizationRecordsListOutVoRecords
>
records
;
}
src/main/java/com/system/transfer/synchronization/SynchronizationRecordsListOutVoRecords.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
transfer
.
synchronization
;
import
lombok.Data
;
/**
* @author Inori
*/
@Data
public
class
SynchronizationRecordsListOutVoRecords
{
/**
* ID
*/
private
Integer
id
;
/**
* 同步记录主键
*/
private
String
fid
;
/**
* 同步记录数据内码
*/
private
Integer
dataId
;
/**
* 同步记录数据分录内码
*/
private
Integer
entryId
;
/**
* 金蝶标识
*/
private
String
sFormId
;
/**
* 唯一标识
*/
private
String
queueId
;
/**
* 错误信息
*/
private
String
message
;
/**
* 同步状态(0-未同步,1-同步中,2-同步成功,3-同步失败)
*/
private
Integer
status
;
/**
* 创建时间
*/
private
String
createTime
;
}
src/main/java/com/system/transfer/synchronization/SynchronizationRecordsUpdateInVo.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
transfer
.
synchronization
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
/**
* @author Inori
*/
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
SynchronizationRecordsUpdateInVo
{
/**
* ID
*/
private
Integer
id
;
/**
* 唯一标识
*/
private
String
queueId
;
/**
* 错误原因
*/
private
String
message
;
/**
* 同步状态(0-未同步,1-同步中,2-同步失败,3-同步成功)
*/
private
Integer
status
;
}
src/main/java/com/system/utils/FormFieldMappingUtil.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
utils
;
import
com.system.transfer.form.FormFieldMappingDetailOutVoRecords
;
import
java.util.List
;
import
java.util.stream.Collectors
;
/**
* @author Inori
*/
public
class
FormFieldMappingUtil
{
public
static
List
<
FormFieldMappingDetailOutVoRecords
>
purchaseMapping
(
String
formFieldMappingDetail
)
{
List
<
Object
>
objectList
=
JsonUtil
.
toList
(
formFieldMappingDetail
,
Object
.
class
);
return
objectList
.
stream
().
map
(
m
->
JsonUtil
.
toBean
(
JsonUtil
.
toString
(
m
),
FormFieldMappingDetailOutVoRecords
.
class
)).
collect
(
Collectors
.
toList
());
}
/*private static List<Map<String, Object>> recursively(List<Map<String, Object>> dataList, Map<String, Object> data) {
List<Map<String, Object>> tempList = dataList.stream().filter(m ->
m.get("pid").equals(data.get("id"))).collect(Collectors.toList()
);
for (Map<String, Object> temp : tempList) {
temp.put("children", recursively(dataList, temp));
}
return tempList;
}*/
}
src/main/java/com/system/utils/HttpUtil.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
utils
;
import
com.system.handler.FacePlusThrowErrorHandler
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.http.HttpEntity
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.http.client.SimpleClientHttpRequestFactory
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.client.RestTemplate
;
import
java.util.Map
;
import
java.util.Set
;
/**
* @author Inori
*/
public
class
HttpUtil
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
HttpUtil
.
class
);
/**
* 连接超时时间
*/
private
static
final
int
CONN_TIMEOUT
=
10000
;
/**
* 请求超时时间
*/
private
static
final
int
READ_TIMEOUT
=
10000
;
/**
* 请求工具
*/
private
static
RestTemplate
restTemplate
;
static
{
//设置超时时间
SimpleClientHttpRequestFactory
requestFactory
=
new
SimpleClientHttpRequestFactory
();
requestFactory
.
setConnectTimeout
(
CONN_TIMEOUT
);
requestFactory
.
setReadTimeout
(
READ_TIMEOUT
);
restTemplate
=
new
RestTemplate
(
requestFactory
);
restTemplate
.
setErrorHandler
(
new
FacePlusThrowErrorHandler
());
}
/**
* 设置header公共参数
*/
private
static
HttpHeaders
initHeader
()
{
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
add
(
"Accept"
,
"application/json"
);
headers
.
add
(
"Content-Type"
,
"application/json; charset=UTF-8"
);
return
headers
;
}
/**
* 设置header参数
*/
private
static
void
setHeaderParam
(
HttpHeaders
httpHeaders
,
Map
<
String
,
Object
>
headers
)
{
if
(!
CollectionUtils
.
isEmpty
(
headers
))
{
Set
<
String
>
keys
=
headers
.
keySet
();
for
(
String
key
:
keys
)
{
httpHeaders
.
add
(
key
,
headers
.
get
(
key
).
toString
());
}
}
}
/**
* 发送Get请求
*/
public
static
ResponseEntity
<
String
>
httpGet
(
String
url
)
{
//初始化header公共参数
HttpHeaders
httpHeaders
=
initHeader
();
//发送请求
HttpEntity
<
String
>
httpEntity
=
new
HttpEntity
<>(
null
,
httpHeaders
);
return
restTemplate
.
exchange
(
url
,
HttpMethod
.
GET
,
httpEntity
,
String
.
class
);
}
/**
* 发送Get请求
*/
public
static
ResponseEntity
<
String
>
httpGet
(
String
url
,
Map
<
String
,
Object
>
param
)
{
//初始化header公共参数
HttpHeaders
httpHeaders
=
initHeader
();
//组装查询参数
url
=
setParam
(
url
,
param
);
//发送请求
HttpEntity
<
String
>
httpEntity
=
new
HttpEntity
<>(
null
,
httpHeaders
);
log
.
info
(
"【Get请求】Url: {}"
,
url
);
return
restTemplate
.
exchange
(
url
,
HttpMethod
.
GET
,
httpEntity
,
String
.
class
);
}
private
static
String
setParam
(
String
url
,
Map
<
String
,
Object
>
param
)
{
Set
<
String
>
keys
=
param
.
keySet
();
StringBuilder
builder
=
new
StringBuilder
();
builder
.
append
(
"?"
);
for
(
String
key
:
keys
)
{
builder
.
append
(
key
).
append
(
"="
).
append
(
param
.
get
(
key
)).
append
(
"&"
);
}
builder
.
deleteCharAt
(
builder
.
lastIndexOf
(
"&"
));
url
=
url
+
builder
.
toString
();
return
url
;
}
/**
* 发送Get请求
*/
public
static
ResponseEntity
<
String
>
httpGet
(
String
url
,
Map
<
String
,
Object
>
headers
,
Map
<
String
,
Object
>
param
)
{
//如果查询参数为空,则调用不带参数的Get请求
if
(
CollectionUtils
.
isEmpty
(
param
))
{
return
httpGet
(
url
,
headers
);
}
//组装查询参数
url
=
setParam
(
url
,
param
);
//发送请求
log
.
info
(
"【Get请求】Url: {}"
,
url
);
return
httpGet
(
url
,
headers
);
}
/**
* 发送Post请求
*/
public
static
ResponseEntity
<
String
>
httpPost
(
String
url
,
String
json
)
{
//初始化header公共参数
HttpHeaders
httpHeaders
=
initHeader
();
//发送请求
log
.
info
(
"【Post请求】Url: {}"
,
url
);
return
toPost
(
url
,
httpHeaders
,
json
);
}
/**
* 发送Post请求
*/
public
static
ResponseEntity
<
String
>
httpPost
(
String
url
,
Map
<
String
,
Object
>
header
,
String
json
)
{
//初始化header公共参数
HttpHeaders
httpHeaders
=
initHeader
();
setHeaderParam
(
httpHeaders
,
header
);
//发送请求
log
.
info
(
"【Post请求】Url: {}"
,
url
);
return
toPost
(
url
,
httpHeaders
,
json
);
}
/**
* 发送请求
*/
private
static
ResponseEntity
<
String
>
toPost
(
String
url
,
HttpHeaders
httpHeaders
,
String
json
)
{
HttpEntity
<
String
>
httpEntity
=
new
HttpEntity
<>(
json
,
httpHeaders
);
return
restTemplate
.
exchange
(
url
,
HttpMethod
.
POST
,
httpEntity
,
String
.
class
);
}
}
\ No newline at end of file
src/main/java/com/system/utils/JsonUtil.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
utils
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
lombok.extern.slf4j.Slf4j
;
import
net.sf.json.JSONArray
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author Inori
*/
@Slf4j
public
class
JsonUtil
{
private
static
final
ObjectMapper
MAPPER
=
new
ObjectMapper
();
public
static
String
toString
(
Object
obj
)
{
if
(
obj
==
null
)
{
return
null
;
}
if
(
obj
.
getClass
()
==
String
.
class
)
{
return
(
String
)
obj
;
}
try
{
return
MAPPER
.
writeValueAsString
(
obj
);
}
catch
(
JsonProcessingException
e
)
{
log
.
error
(
"Json解析出错: JsonUtil.toString(), Json: "
+
obj
);
return
""
;
}
}
public
static
<
T
>
T
toBean
(
String
json
,
Class
<
T
>
tClass
)
{
try
{
return
MAPPER
.
readValue
(
json
,
tClass
);
}
catch
(
IOException
e
)
{
log
.
error
(
"Json解析出错: JsonUtil.toBean(), Json: "
+
json
);
T
t
=
null
;
try
{
t
=
tClass
.
newInstance
();
}
catch
(
InstantiationException
|
IllegalAccessException
ex
)
{
ex
.
printStackTrace
();
}
return
t
;
}
}
public
static
<
T
>
String
listToJson
(
List
<
T
>
list
)
{
if
(
null
!=
list
&&
list
.
size
()
>
0
)
{
JSONArray
jsonArray
=
JSONArray
.
fromObject
(
list
);
return
jsonArray
.
toString
();
}
return
""
;
}
public
static
<
E
>
List
<
E
>
toList
(
String
json
,
Class
<
E
>
eClass
)
{
try
{
return
MAPPER
.
readValue
(
json
,
MAPPER
.
getTypeFactory
().
constructCollectionType
(
List
.
class
,
eClass
));
}
catch
(
IOException
e
)
{
log
.
error
(
"Json解析出错: JsonUtil.toList(), Json: "
+
json
);
return
new
ArrayList
<>();
}
}
public
static
<
K
,
V
>
Map
<
K
,
V
>
toMap
(
String
json
,
Class
<
K
>
kClass
,
Class
<
V
>
vClass
)
{
try
{
return
MAPPER
.
readValue
(
json
,
MAPPER
.
getTypeFactory
().
constructMapType
(
Map
.
class
,
kClass
,
vClass
));
}
catch
(
IOException
e
)
{
log
.
error
(
"Json解析出错: JsonUtil.toMap(), Json: "
+
json
);
return
new
HashMap
<>(
10
);
}
}
public
static
<
T
>
T
nativeRead
(
String
json
,
TypeReference
<
T
>
type
)
{
try
{
return
MAPPER
.
readValue
(
json
,
type
);
}
catch
(
IOException
e
)
{
log
.
error
(
"Json解析出错: JsonUtil.nativeRead(), Json: "
+
json
);
return
null
;
}
}
}
src/main/java/com/system/utils/SnowFlakeIdUtil.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
utils
;
import
org.apache.commons.lang3.RandomUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.SystemUtils
;
import
java.net.Inet4Address
;
import
java.net.UnknownHostException
;
/**
* @author Inori
*/
public
class
SnowFlakeIdUtil
{
/**
* 机器id所占的位数
*/
private
final
long
workerIdBits
=
5L
;
/**
* 数据标识id所占的位数
*/
private
final
long
dataCenterIdBits
=
5L
;
/**
* 工作机器ID(0~31)
*/
private
final
long
workerId
;
/**
* 数据中心ID(0~31)
*/
private
final
long
dataCenterId
;
/**
* 毫秒内序列(0~4095)
*/
private
long
sequence
=
0L
;
/**
* 上次生成ID的时间截
*/
private
long
lastTimestamp
=
-
1L
;
private
static
final
SnowFlakeIdUtil
ID_WORKER
;
static
{
ID_WORKER
=
new
SnowFlakeIdUtil
(
getWorkId
(),
getDataCenterId
());
}
//==============================Constructors=====================================
/**
* 构造函数
*
* @param workerId 工作ID (0~31)
* @param dataCenterId 数据中心ID (0~31)
*/
public
SnowFlakeIdUtil
(
long
workerId
,
long
dataCenterId
)
{
/* 支持的最大机器id,结果是31 (这个移位算法可以很快地计算出几位二进制数所能表示的最大十进制数) */
long
maxWorkerId
=
~(-
1L
<<
workerIdBits
);
if
(
workerId
>
maxWorkerId
||
workerId
<
0
)
{
throw
new
IllegalArgumentException
(
String
.
format
(
"workerId can''t be greater than %d or less than 0"
,
maxWorkerId
));
}
/* 支持的最大数据标识id,结果是31 */
long
maxDataCenterId
=
~(-
1L
<<
dataCenterIdBits
);
if
(
dataCenterId
>
maxDataCenterId
||
dataCenterId
<
0
)
{
throw
new
IllegalArgumentException
(
String
.
format
(
"dataCenterId can''t be greater than %d or less than 0"
,
maxDataCenterId
));
}
this
.
workerId
=
workerId
;
this
.
dataCenterId
=
dataCenterId
;
}
// ==============================Methods==========================================
/**
* 获得下一个ID (该方法是线程安全的)
*
* @return SnowflakeId
*/
public
synchronized
long
nextId
()
{
long
timestamp
=
timeGen
();
//如果当前时间小于上一次ID生成的时间戳,说明系统时钟回退过这个时候应当抛出异常
if
(
timestamp
<
lastTimestamp
)
{
throw
new
RuntimeException
(
String
.
format
(
"Clock moved backwards. Refusing to generate id for %d milliseconds"
,
lastTimestamp
-
timestamp
));
}
//如果是同一时间生成的,则进行毫秒内序列
/* 序列在id中占的位数 */
long
sequenceBits
=
12L
;
if
(
lastTimestamp
==
timestamp
)
{
/* 生成序列的掩码,这里为4095 (0b111111111111=0xfff=4095) */
long
sequenceMask
=
~(-
1L
<<
sequenceBits
);
sequence
=
(
sequence
+
1
)
&
sequenceMask
;
//毫秒内序列溢出
if
(
sequence
==
0
)
{
//阻塞到下一个毫秒,获得新的时间戳
timestamp
=
tilNextMillis
(
lastTimestamp
);
}
}
//时间戳改变,毫秒内序列重置
else
{
sequence
=
0L
;
}
//上次生成ID的时间截
lastTimestamp
=
timestamp
;
//移位并通过或运算拼到一起组成64位的ID
/* 开始时间截 (2015-01-01) */
long
twepoch
=
1489111610226L
;
/* 机器ID向左移12位 */
/* 数据标识id向左移17位(12+5) */
long
dataCenterIdShift
=
sequenceBits
+
workerIdBits
;
/* 时间截向左移22位(5+5+12) */
long
timestampLeftShift
=
sequenceBits
+
workerIdBits
+
dataCenterIdBits
;
return
((
timestamp
-
twepoch
)
<<
timestampLeftShift
)
|
(
dataCenterId
<<
dataCenterIdShift
)
|
(
workerId
<<
sequenceBits
)
|
sequence
;
}
/**
* 阻塞到下一个毫秒,直到获得新的时间戳
*
* @param lastTimestamp 上次生成ID的时间截
* @return 当前时间戳
*/
protected
long
tilNextMillis
(
long
lastTimestamp
)
{
long
timestamp
=
timeGen
();
while
(
timestamp
<=
lastTimestamp
)
{
timestamp
=
timeGen
();
}
return
timestamp
;
}
/**
* 返回以毫秒为单位的当前时间
*
* @return 当前时间(毫秒)
*/
protected
long
timeGen
()
{
return
System
.
currentTimeMillis
();
}
private
static
Long
getWorkId
()
{
try
{
String
hostAddress
=
Inet4Address
.
getLocalHost
().
getHostAddress
();
int
[]
ints
=
StringUtils
.
toCodePoints
(
hostAddress
);
int
sums
=
0
;
for
(
int
b
:
ints
)
{
sums
+=
b
;
}
return
(
long
)
(
sums
%
32
);
}
catch
(
UnknownHostException
e
)
{
// 如果获取失败,则使用随机数备用
return
RandomUtils
.
nextLong
(
0
,
31
);
}
}
private
static
Long
getDataCenterId
()
{
int
[]
intList
=
StringUtil
.
toCodePoints
(
SystemUtils
.
getHostName
());
int
sums
=
0
;
for
(
int
i
:
intList
)
{
sums
+=
i
;
}
return
(
long
)
(
sums
%
32
);
}
public
static
Long
generateId
()
{
return
ID_WORKER
.
nextId
();
}
}
src/main/java/com/system/utils/StringUtil.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
utils
;
import
java.util.Collection
;
import
java.util.Map
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
* 字符串工具类
*
* @author ruoyi
*/
public
class
StringUtil
extends
org
.
apache
.
commons
.
lang3
.
StringUtils
{
/**
* 空字符串
*/
private
static
final
String
NULL_STRING
=
""
;
/**
* 下划线
*/
private
static
final
char
SEPARATOR
=
'_'
;
/**
* 正则验证字符串是否是数字
*/
private
static
final
Pattern
NUM_PATTERN
=
Pattern
.
compile
(
"^[0-9]*$"
);
/**
* 获取参数不为空值
*
* @param value defaultValue 要判断的value
* @return value 返回值
*/
public
static
<
T
>
T
nvl
(
T
value
,
T
defaultValue
)
{
return
value
!=
null
?
value
:
defaultValue
;
}
/**
* * 判断一个Collection是否为空, 包含List,Set,Queue
*
* @param coll 要判断的Collection
* @return true:为空 false:非空
*/
public
static
boolean
isEmpty
(
Collection
<?>
coll
)
{
return
isNull
(
coll
)
||
coll
.
isEmpty
();
}
/**
* * 判断一个Collection是否非空,包含List,Set,Queue
*
* @param coll 要判断的Collection
* @return true:非空 false:空
*/
public
static
boolean
isNotEmpty
(
Collection
<?>
coll
)
{
return
!
isEmpty
(
coll
);
}
/**
* * 判断一个对象数组是否为空
*
* @param objects 要判断的对象数组
* @return true:为空 false:非空
*/
public
static
boolean
isEmpty
(
Object
[]
objects
)
{
return
isNull
(
objects
)
||
(
objects
.
length
==
0
);
}
/**
* * 判断一个对象数组是否非空
*
* @param objects 要判断的对象数组
* @return true:非空 false:空
*/
public
static
boolean
isNotEmpty
(
Object
[]
objects
)
{
return
!
isEmpty
(
objects
);
}
/**
* * 判断一个Map是否为空
*
* @param map 要判断的Map
* @return true:为空 false:非空
*/
public
static
boolean
isEmpty
(
Map
<?,
?>
map
)
{
return
isNull
(
map
)
||
map
.
isEmpty
();
}
/**
* * 判断一个Map是否为空
*
* @param map 要判断的Map
* @return true:非空 false:空
*/
public
static
boolean
isNotEmpty
(
Map
<?,
?>
map
)
{
return
!
isEmpty
(
map
);
}
/**
* * 判断一个字符串是否为空串
*
* @param str String
* @return true:为空 false:非空
*/
public
static
boolean
isEmpty
(
String
str
)
{
return
isNull
(
str
)
||
NULL_STRING
.
equals
(
str
.
trim
());
}
/**
* * 判断一个字符串是否为非空串
*
* @param str String
* @return true:非空串 false:空串
*/
public
static
boolean
isNotEmpty
(
String
str
)
{
return
!
isEmpty
(
str
);
}
/**
* * 判断一个对象是否为空
*
* @param object Object
* @return true:为空 false:非空
*/
public
static
boolean
isNull
(
Object
object
)
{
return
object
==
null
;
}
/**
* * 判断一个对象是否非空
*
* @param object Object
* @return true:非空 false:空
*/
public
static
boolean
isNotNull
(
Object
object
)
{
return
!
isNull
(
object
);
}
/**
* * 判断一个对象是否是数组类型(Java基本型别的数组)
*
* @param object 对象
* @return true:是数组 false:不是数组
*/
public
static
boolean
isArray
(
Object
object
)
{
return
isNotNull
(
object
)
&&
object
.
getClass
().
isArray
();
}
/**
* 去空格
*/
public
static
String
trim
(
String
str
)
{
return
(
str
==
null
?
""
:
str
.
trim
());
}
/**
* 截取字符串
*
* @param str 字符串
* @param start 开始
* @return 结果
*/
public
static
String
substring
(
final
String
str
,
int
start
)
{
if
(
str
==
null
)
{
return
NULL_STRING
;
}
if
(
start
<
0
)
{
start
=
str
.
length
()
+
start
;
}
if
(
start
<
0
)
{
start
=
0
;
}
if
(
start
>
str
.
length
())
{
return
NULL_STRING
;
}
return
str
.
substring
(
start
);
}
/**
* 截取字符串
*
* @param str 字符串
* @param start 开始
* @param end 结束
* @return 结果
*/
public
static
String
substring
(
final
String
str
,
int
start
,
int
end
)
{
if
(
str
==
null
)
{
return
NULL_STRING
;
}
if
(
end
<
0
)
{
end
=
str
.
length
()
+
end
;
}
if
(
start
<
0
)
{
start
=
str
.
length
()
+
start
;
}
if
(
end
>
str
.
length
())
{
end
=
str
.
length
();
}
if
(
start
>
end
)
{
return
NULL_STRING
;
}
if
(
start
<
0
)
{
start
=
0
;
}
if
(
end
<
0
)
{
end
=
0
;
}
return
str
.
substring
(
start
,
end
);
}
/**
* 下划线转驼峰命名
*/
public
static
String
toUnderScoreCase
(
String
str
)
{
if
(
str
==
null
)
{
return
null
;
}
StringBuilder
sb
=
new
StringBuilder
();
// 前置字符是否大写
boolean
preCharIsUpperCase
=
true
;
// 当前字符是否大写
boolean
curreCharIsUpperCase
=
true
;
// 下一字符是否大写
boolean
nexteCharIsUpperCase
=
true
;
for
(
int
i
=
0
;
i
<
str
.
length
();
i
++)
{
char
c
=
str
.
charAt
(
i
);
if
(
i
>
0
)
{
preCharIsUpperCase
=
Character
.
isUpperCase
(
str
.
charAt
(
i
-
1
));
}
else
{
preCharIsUpperCase
=
false
;
}
curreCharIsUpperCase
=
Character
.
isUpperCase
(
c
);
if
(
i
<
(
str
.
length
()
-
1
))
{
nexteCharIsUpperCase
=
Character
.
isUpperCase
(
str
.
charAt
(
i
+
1
));
}
if
(
preCharIsUpperCase
&&
curreCharIsUpperCase
&&
!
nexteCharIsUpperCase
)
{
sb
.
append
(
SEPARATOR
);
}
else
if
((
i
!=
0
&&
!
preCharIsUpperCase
)
&&
curreCharIsUpperCase
)
{
sb
.
append
(
SEPARATOR
);
}
sb
.
append
(
Character
.
toLowerCase
(
c
));
}
return
sb
.
toString
();
}
/**
* 是否包含字符串
*
* @param str 验证字符串
* @param strs 字符串组
* @return 包含返回true
*/
public
static
boolean
inStringIgnoreCase
(
String
str
,
String
...
strs
)
{
if
(
str
!=
null
&&
strs
!=
null
)
{
for
(
String
s
:
strs
)
{
if
(
str
.
equalsIgnoreCase
(
trim
(
s
)))
{
return
true
;
}
}
}
return
false
;
}
/**
* 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld
*
* @param name 转换前的下划线大写方式命名的字符串
* @return 转换后的驼峰式命名的字符串
*/
public
static
String
convertToCamelCase
(
String
name
)
{
StringBuilder
result
=
new
StringBuilder
();
// 快速检查
if
(
name
==
null
||
name
.
isEmpty
())
{
// 没必要转换
return
""
;
}
else
if
(!
name
.
contains
(
"_"
))
{
// 不含下划线,仅将首字母大写
return
name
.
substring
(
0
,
1
).
toUpperCase
()
+
name
.
substring
(
1
);
}
// 用下划线将原始字符串分割
String
[]
camels
=
name
.
split
(
"_"
);
for
(
String
camel
:
camels
)
{
// 跳过原始字符串中开头、结尾的下换线或双重下划线
if
(
camel
.
isEmpty
())
{
continue
;
}
// 首字母大写
result
.
append
(
camel
.
substring
(
0
,
1
).
toUpperCase
());
result
.
append
(
camel
.
substring
(
1
).
toLowerCase
());
}
return
result
.
toString
();
}
/**
* 驼峰式命名法 例如:user_name->userName
*/
public
static
String
toCamelCase
(
String
s
)
{
if
(
s
==
null
)
{
return
null
;
}
s
=
s
.
toLowerCase
();
StringBuilder
sb
=
new
StringBuilder
(
s
.
length
());
boolean
upperCase
=
false
;
for
(
int
i
=
0
;
i
<
s
.
length
();
i
++)
{
char
c
=
s
.
charAt
(
i
);
if
(
c
==
SEPARATOR
)
{
upperCase
=
true
;
}
else
if
(
upperCase
)
{
sb
.
append
(
Character
.
toUpperCase
(
c
));
upperCase
=
false
;
}
else
{
sb
.
append
(
c
);
}
}
return
sb
.
toString
();
}
/**
* 判断字符串是否是数字
*/
public
static
boolean
isStr2Num
(
String
str
)
{
Matcher
matcher
=
NUM_PATTERN
.
matcher
(
str
);
return
matcher
.
matches
();
}
/**
* java去除字符串中的空格、回车、换行符、制表符
*/
public
static
String
replaceBlank
(
String
str
)
{
String
dest
=
""
;
if
(
str
!=
null
)
{
Pattern
p
=
Pattern
.
compile
(
"\\s*|\t|\r|\n"
);
Matcher
m
=
p
.
matcher
(
str
);
dest
=
m
.
replaceAll
(
""
);
}
return
dest
;
}
}
\ No newline at end of file
src/main/java/com/system/utils/ThirdPartyLogUtil.java
0 → 100644
浏览文件 @
81825ce1
package
com
.
system
.
utils
;
import
com.system.constants.Constants
;
import
com.system.dao.ThirdPartyLogMapper
;
import
com.system.transfer.log.ThirdPartyLogCreateInVo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
java.util.Map
;
/**
* @author Inori
*/
@Component
public
class
ThirdPartyLogUtil
{
@Autowired
private
ThirdPartyLogMapper
thirdPartyLogMapper
;
public
Integer
isExist
(
String
queueId
)
{
return
thirdPartyLogMapper
.
getThirdPartyLogByQueueId
(
queueId
);
}
public
void
thirdPartyLogCreate
(
String
name
,
String
docType
,
String
queueId
,
String
direction
,
String
request
,
String
response
)
{
ThirdPartyLogCreateInVo
inVo
=
new
ThirdPartyLogCreateInVo
();
inVo
.
setName
(
name
);
inVo
.
setCode
(
docType
);
inVo
.
setQueueId
(
queueId
);
inVo
.
setDirection
(
direction
);
inVo
.
setRequest
(
request
);
inVo
.
setResponse
(
response
);
Map
<
String
,
Object
>
map
=
JsonUtil
.
toMap
(
response
,
String
.
class
,
Object
.
class
);
if
(!
CollectionUtils
.
isEmpty
(
map
)
&&
Constants
.
SUCCESS_CODE
.
equals
(
String
.
valueOf
(
map
.
get
(
Constants
.
SUCCESS_NAME
))))
{
inVo
.
setFlag
(
1
);
}
else
{
inVo
.
setFlag
(
0
);
}
thirdPartyLogMapper
.
thirdPartyLogCreate
(
inVo
);
}
public
void
thirdPartyLogCreate
(
String
name
,
String
docType
,
String
queueId
,
String
direction
,
String
request
,
String
response
,
Integer
flag
)
{
ThirdPartyLogCreateInVo
inVo
=
new
ThirdPartyLogCreateInVo
();
inVo
.
setName
(
name
);
inVo
.
setCode
(
docType
);
inVo
.
setQueueId
(
queueId
);
inVo
.
setDirection
(
direction
);
inVo
.
setRequest
(
request
);
inVo
.
setResponse
(
response
);
inVo
.
setFlag
(
flag
);
thirdPartyLogMapper
.
thirdPartyLogCreate
(
inVo
);
}
}
src/main/resources/application-docker.yaml
0 → 100644
浏览文件 @
81825ce1
server
:
port
:
12002
servlet
:
context-path
:
/mall
spring
:
main
:
allow-bean-definition-overriding
:
true
application
:
name
:
@
artifactId@
datasource
:
url
:
jdbc:mysql://integrate-mysql:3306/db_shopping?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true&useAffectedRows=true
username
:
root
password
:
gf^*i6%&9J83&(*kJ653F&L
driver-class-name
:
com.mysql.cj.jdbc.Driver
type
:
com.alibaba.druid.pool.DruidDataSource
mvc
:
static-path-pattern
:
/**
resource
:
static-locations
:
classpath:/static/,classpath:/public/,classpath:/META-INF/resources/,classpath:/META-INF/resources/webjars/
mybatis-plus
:
mapper-locations
:
classpath*:/**/*Mapper.xml
global-config
:
# 关闭MP3.0自带的banner
banner
:
false
db-config
:
#主键类型 0:"数据库ID自增",1:"该类型为未设置主键类型", 2:"用户输入ID",3:"全局唯一ID (数字类型唯一ID)", 4:"全局唯一ID UUID",5:"字符串全局唯一ID (idWorker 的字符串表示)";
id-type
:
AUTO
# 默认数据库表下划线命名
table-underline
:
true
configuration
:
# 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
#log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# 返回类型为Map,显示null对应的字段
call-setters-on-nulls
:
true
management
:
endpoint
:
health
:
enabled
:
true
\ No newline at end of file
src/main/resources/application-test.yaml
0 → 100644
浏览文件 @
81825ce1
server
:
port
:
12002
servlet
:
context-path
:
/mall
spring
:
main
:
allow-bean-definition-overriding
:
true
application
:
name
:
@
artifactId@
datasource
:
url
:
jdbc:mysql://127.0.0.1:3306/db_shopping?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true&useAffectedRows=true
username
:
inori
password
:
inori
driver-class-name
:
com.mysql.cj.jdbc.Driver
type
:
com.alibaba.druid.pool.DruidDataSource
mvc
:
static-path-pattern
:
/**
resource
:
static-locations
:
classpath:/static/,classpath:/public/,classpath:/META-INF/resources/,classpath:/META-INF/resources/webjars/
mybatis-plus
:
mapper-locations
:
classpath*:/**/*Mapper.xml
global-config
:
# 关闭MP3.0自带的banner
banner
:
false
db-config
:
#主键类型 0:"数据库ID自增",1:"该类型为未设置主键类型", 2:"用户输入ID",3:"全局唯一ID (数字类型唯一ID)", 4:"全局唯一ID UUID",5:"字符串全局唯一ID (idWorker 的字符串表示)";
id-type
:
AUTO
# 默认数据库表下划线命名
table-underline
:
true
configuration
:
# 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
log-impl
:
org.apache.ibatis.logging.stdout.StdOutImpl
# 返回类型为Map,显示null对应的字段
call-setters-on-nulls
:
true
management
:
endpoint
:
health
:
enabled
:
true
\ No newline at end of file
src/main/resources/application.yaml
0 → 100644
浏览文件 @
81825ce1
spring
:
profiles
:
active
:
test
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论