Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
card-provider
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
david.zhong
card-provider
Commits
a596c541
Commit
a596c541
authored
Jun 15, 2020
by
david.zhong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
卡系统资质功能映射
parent
ad0a6cef
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1221 additions
and
0 deletions
+1221
-0
.gitignore
.gitignore
+31
-0
pom.xml
pom.xml
+32
-0
CardProviderApplication.java
src/main/java/com/ost/micro/CardProviderApplication.java
+16
-0
ExcelBigUtils.java
...ain/java/com/ost/micro/provider/common/ExcelBigUtils.java
+144
-0
FileUploadController.java
...a/com/ost/micro/provider/common/FileUploadController.java
+32
-0
PaymentServiceClient.java
...a/com/ost/micro/provider/common/PaymentServiceClient.java
+235
-0
ServiceUrl.java
src/main/java/com/ost/micro/provider/common/ServiceUrl.java
+66
-0
CardApiController.java
.../com/ost/micro/provider/controller/CardApiController.java
+56
-0
CardBizController.java
.../com/ost/micro/provider/controller/CardBizController.java
+133
-0
CardOrderController.java
...om/ost/micro/provider/controller/CardOrderController.java
+174
-0
CardPassageController.java
.../ost/micro/provider/controller/CardPassageController.java
+262
-0
application-dev.yml
src/main/resources/application-dev.yml
+2
-0
application-paycoat.yml
src/main/resources/application-paycoat.yml
+2
-0
application-paytuch.yml
src/main/resources/application-paytuch.yml
+2
-0
application-pre.yml
src/main/resources/application-pre.yml
+2
-0
application-prod.yml
src/main/resources/application-prod.yml
+2
-0
application-test.yml
src/main/resources/application-test.yml
+2
-0
application-uat.yml
src/main/resources/application-uat.yml
+2
-0
application.yml
src/main/resources/application.yml
+14
-0
bootstrap.yml
src/main/resources/bootstrap.yml
+12
-0
No files found.
.gitignore
0 → 100644
View file @
a596c541
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
### 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/
### VS Code ###
.vscode/
pom.xml
0 → 100644
View file @
a596c541
<?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"
>
<parent>
<artifactId>
micro-as
</artifactId>
<groupId>
com.ost.micro
</groupId>
<version>
1.0.0-alpha
</version>
</parent>
<packaging>
jar
</packaging>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
card-provider
</artifactId>
<name>
Micro :: Project :: As :: Card-Provider
</name>
<dependencies>
<dependency>
<groupId>
org.apache.poi
</groupId>
<artifactId>
poi-ooxml
</artifactId>
<version>
3.15
</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-assembly-plugin
</artifactId>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
src/main/java/com/ost/micro/CardProviderApplication.java
0 → 100644
View file @
a596c541
package
com
.
ost
.
micro
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration
;
import
org.springframework.cloud.client.discovery.EnableDiscoveryClient
;
@EnableDiscoveryClient
@SpringBootApplication
(
exclude
=
DataSourceAutoConfiguration
.
class
)
public
class
CardProviderApplication
{
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
CardProviderApplication
.
class
,
args
);
}
}
src/main/java/com/ost/micro/provider/common/ExcelBigUtils.java
0 → 100644
View file @
a596c541
package
com
.
ost
.
micro
.
provider
.
common
;
import
cn.afterturn.easypoi.excel.entity.ExportParams
;
import
cn.afterturn.easypoi.excel.entity.enmus.ExcelType
;
import
cn.afterturn.easypoi.excel.export.ExcelExportService
;
import
com.google.gson.Gson
;
import
com.ost.micro.core.pay.modules.sys.dto.BizTradeDetailDto
;
import
com.ost.micro.core.pay.modules.sys.excel.BizTradeDetailBean
;
import
com.ost.micro.core.utils.CopyDataUtil
;
import
org.apache.poi.xssf.streaming.SXSSFWorkbook
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipOutputStream
;
/**
* excel工具类
*
* @author Mark sunlightcs@gmail.com
* @since 2018-03-24
*/
public
class
ExcelBigUtils
{
private
static
final
Integer
MAX_SIZE
=
10000
;
/**
* Excel导出
* 20W数据没问题,再多会卡死,需要继续优化
*
* @param response response
* @param list 数据List
*/
public
static
void
exportExcel
(
HttpServletResponse
response
,
String
fileName
,
Collection
<?>
list
)
{
try
{
List
<
String
>
fileNames
=
new
ArrayList
<>();
//存放生成的文件名称
String
filePath
=
"D:/excel/"
;
//上线后切换成linux服务器地址
if
(!
new
File
(
filePath
).
exists
())
{
new
File
(
filePath
).
mkdirs
();
}
File
zip
=
new
File
(
filePath
+
fileName
+
".zip"
);
//压缩文件路径
List
lists
=
(
List
)
list
;
Integer
pageNumeber
=
(
lists
.
size
()
%
MAX_SIZE
==
0
)
?
lists
.
size
()
/
MAX_SIZE
:
lists
.
size
()
/
MAX_SIZE
+
1
;
Gson
gson
=
new
Gson
();
List
<
BizTradeDetailBean
>
bizTradeDetailDtos
=
new
ArrayList
<>(
10000
);
for
(
int
i
=
0
;
i
<
pageNumeber
;
i
++)
{
String
tempExcelFile
=
filePath
+
fileName
+
"["
+
(
i
+
1
)
+
"].xlsx"
;
fileNames
.
add
(
tempExcelFile
);
FileOutputStream
fos
=
new
FileOutputStream
(
tempExcelFile
);
//int rowMemory = 100;
SXSSFWorkbook
workbook
=
new
SXSSFWorkbook
(
100
);
ExportParams
exportParams
=
new
ExportParams
();
exportParams
.
setMaxNum
(
10000
);
exportParams
.
setType
(
ExcelType
.
XSSF
);
int
minNum
=
i
*
MAX_SIZE
;
int
maxNum
=
(
i
+
1
)
*
MAX_SIZE
;
for
(
int
j
=
minNum
;
j
<
(
maxNum
>
lists
.
size
()
?
lists
.
size
()
:
maxNum
);
j
++)
{
BizTradeDetailBean
history
=
CopyDataUtil
.
copyObject
(
gson
.
fromJson
(
gson
.
toJson
(
lists
.
get
(
j
)),
BizTradeDetailDto
.
class
),
BizTradeDetailBean
.
class
);
bizTradeDetailDtos
.
add
(
history
);
}
//Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams(), BizTradeDetailDto.class, bizTradeDetailDtos);
new
ExcelExportService
().
createSheet
(
workbook
,
exportParams
,
BizTradeDetailBean
.
class
,
bizTradeDetailDtos
);
try
{
workbook
.
write
(
fos
);
fos
.
flush
();
fos
.
close
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
bizTradeDetailDtos
.
clear
();
}
exportZip
(
response
,
fileName
,
fileNames
,
zip
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
private
static
void
exportZip
(
HttpServletResponse
response
,
String
fileName
,
List
<
String
>
fileNames
,
File
zip
)
throws
IOException
{
response
.
reset
();
response
.
setContentType
(
"application/octet-stream;charset=UTF-8"
);
response
.
addHeader
(
"pargam"
,
"no-cache"
);
response
.
addHeader
(
"Cache-Control"
,
"no-cache"
);
response
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
fileName
,
"UTF-8"
)
+
".zip"
);
OutputStream
outPut
=
response
.
getOutputStream
();
//1.压缩文件
File
srcFile
[]
=
new
File
[
fileNames
.
size
()];
for
(
int
i
=
0
;
i
<
fileNames
.
size
();
i
++)
{
srcFile
[
i
]
=
new
File
(
fileNames
.
get
(
i
));
}
byte
[]
byt
=
new
byte
[
1024
];
ZipOutputStream
out
=
new
ZipOutputStream
(
new
FileOutputStream
(
zip
));
//out.setEncoding("UTF-8");
for
(
int
i
=
0
;
i
<
srcFile
.
length
;
i
++)
{
FileInputStream
in
=
new
FileInputStream
(
srcFile
[
i
]);
out
.
putNextEntry
(
new
ZipEntry
(
srcFile
[
i
].
getName
()));
int
length
;
while
((
length
=
in
.
read
(
byt
))
>
0
)
{
out
.
write
(
byt
,
0
,
length
);
}
out
.
closeEntry
();
in
.
close
();
}
out
.
close
();
//2.删除服务器上的临时文件(excel)
for
(
int
i
=
0
;
i
<
srcFile
.
length
;
i
++)
{
File
temFile
=
srcFile
[
i
];
if
(
temFile
.
exists
()
&&
temFile
.
isFile
())
{
temFile
.
delete
();
}
}
//3.返回客户端压缩文件
FileInputStream
inStream
=
new
FileInputStream
(
zip
);
byte
[]
buf
=
new
byte
[
4096
];
int
readLenght
;
while
((
readLenght
=
inStream
.
read
(
buf
))
!=
-
1
)
{
outPut
.
write
(
buf
,
0
,
readLenght
);
}
inStream
.
close
();
outPut
.
close
();
//4.删除压缩文件
if
(
zip
.
exists
()
&&
zip
.
isFile
())
{
zip
.
delete
();
}
}
}
src/main/java/com/ost/micro/provider/common/FileUploadController.java
0 → 100644
View file @
a596c541
package
com
.
ost
.
micro
.
provider
.
common
;
import
com.ost.micro.common.utils.FileUploadUtil
;
import
com.ost.micro.core.context.model.response.DataResponse
;
import
com.ost.micro.core.pay.modules.sys.dto.FileUploadDto
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.multipart.MultipartFile
;
/**
* @author rain
*/
@Component
public
class
FileUploadController
{
@Value
(
"${file.upload.storePath}"
)
private
String
UPLOADED_FOLDER
;
@Value
(
"${file.upload.urlProfix}"
)
private
String
UPLOAD_URLPROFIX
;
public
DataResponse
singleFileUpload
(
@RequestParam
(
"file"
)
MultipartFile
file
,
String
type
)
{
FileUploadDto
fileUploadDto
=
FileUploadDto
.
builder
()
.
file
(
file
)
.
type
(
type
)
.
storePath
(
UPLOADED_FOLDER
)
.
urlProfix
(
UPLOAD_URLPROFIX
)
.
build
();
return
FileUploadUtil
.
singleFileUpload
(
fileUploadDto
);
}
}
src/main/java/com/ost/micro/provider/common/PaymentServiceClient.java
0 → 100644
View file @
a596c541
package
com
.
ost
.
micro
.
provider
.
common
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.google.gson.Gson
;
import
com.google.gson.GsonBuilder
;
import
com.google.gson.JsonElement
;
import
com.google.gson.LongSerializationPolicy
;
import
com.ost.micro.common.utils.Result
;
import
com.ost.micro.core.configuration.SpringfoxJsonToGsonAdapter
;
import
com.ost.micro.core.context.model.response.DataResponse
;
import
com.ost.micro.core.utils.GsonUtil
;
import
com.ost.micro.core.utils.MapUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.http.*
;
import
org.springframework.http.converter.HttpMessageConverter
;
import
org.springframework.http.converter.json.GsonHttpMessageConverter
;
import
org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.MimeType
;
import
org.springframework.util.MimeTypeUtils
;
import
org.springframework.web.client.RestTemplate
;
import
java.nio.charset.Charset
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @Title: PaymentServiceClient
* @ProjectName micro-root
* @Description: 远程调用底层逻辑
* @date 2018/9/3011:03
*/
@Service
@Slf4j
public
class
PaymentServiceClient
<
T
>
{
private
Gson
gson
=
new
Gson
();
private
RestTemplate
restTemplate
;
public
PaymentServiceClient
()
{
restTemplate
=
new
RestTemplate
();
List
<
HttpMessageConverter
<?>>
converters
=
restTemplate
.
getMessageConverters
();
// 删除MappingJackson2HttpMessageConverter
converters
.
removeIf
(
httpMessageConverter
->
httpMessageConverter
instanceof
MappingJackson2HttpMessageConverter
);
// 添加GsonHttpMessageConverter
converters
.
add
(
new
GsonHttpMessageConverter
(
new
GsonBuilder
().
enableComplexMapKeySerialization
().
setLongSerializationPolicy
(
LongSerializationPolicy
.
STRING
)
.
serializeNulls
().
registerTypeAdapter
(
JsonElement
.
class
,
new
SpringfoxJsonToGsonAdapter
()).
create
()));
}
/**
* @param url
* @param param
* @return
*/
// @HystrixCommand(fallbackMethod = "selectPayChannelFallback") 熔断机制
public
DataResponse
get
(
String
url
,
Map
param
)
{
String
urlParams
=
MapUtil
.
getUrlParamsByMap
(
param
);
if
(!
StringUtils
.
isEmpty
(
urlParams
))
{
url
=
url
+
"?"
+
urlParams
;
}
log
.
info
(
"get url is :"
+
url
);
return
restTemplate
.
getForEntity
(
url
,
DataResponse
.
class
).
getBody
();
}
/**
* 包含敏感信息(身份信息、权限信息),用此方法做脱敏处理
*
* @param url
* @param param
* @return
*/
public
Result
_get
(
String
url
,
Map
param
)
{
String
urlParams
=
MapUtil
.
getUrlParamsByMap
(
param
);
if
(!
StringUtils
.
isEmpty
(
urlParams
))
{
url
=
url
+
"?"
+
urlParams
;
}
log
.
info
(
"get url is :"
+
url
.
split
(
"[?]"
)[
0
]
+
"?****"
);
return
restTemplate
.
getForEntity
(
url
,
Result
.
class
).
getBody
();
}
/**
* 通过id去获取
*
* @param url
* @param id
* @return
*/
public
DataResponse
get
(
String
url
,
Long
id
)
{
url
=
url
+
"/"
+
id
;
log
.
info
(
"get url is :"
+
url
);
DataResponse
model
=
restTemplate
.
getForEntity
(
url
,
DataResponse
.
class
).
getBody
();
String
json
=
gson
.
toJson
(
model
.
getData
());
Map
<
String
,
Object
>
data
=
gson
.
fromJson
(
json
,
HashMap
.
class
);
if
(
null
!=
data
)
{
data
.
put
(
"id"
,
id
);
}
return
model
;
}
/**
* post 请求
*
* @param url
* @param t
* @return
*/
public
DataResponse
post
(
String
url
,
T
t
)
{
log
.
info
(
"post url is :"
+
url
);
log
.
info
(
"request params is :"
+
gson
.
toJson
(
t
));
return
restTemplate
.
postForEntity
(
url
,
t
,
DataResponse
.
class
).
getBody
();
}
/**
* post 请求
*
* @param url
* @param t
* @return
*/
public
DataResponse
postForObject
(
String
url
,
MediaType
mediaType
,
T
t
)
{
log
.
info
(
"post url is :"
+
url
);
log
.
info
(
"request params is :"
+
gson
.
toJson
(
t
));
//return restTemplate.postForEntity(url, t, DataResponse.class).getBody();
HttpHeaders
header
=
new
HttpHeaders
();
// 需求需要传参为application/json格式
header
.
setContentType
(
mediaType
);
HttpEntity
<
String
>
httpEntity
=
new
HttpEntity
<>(
GsonUtil
.
toJson
(
t
,
false
),
header
);
String
response
=
restTemplate
.
postForObject
(
url
,
httpEntity
,
String
.
class
);
log
.
info
(
"response is {}"
,
response
);
DataResponse
dataResponse
=
GsonUtil
.
fromJson
(
response
,
DataResponse
.
class
);
return
dataResponse
;
}
/**
* put请求
*
* @param url
* @param t
* @return
*/
public
void
put
(
String
url
,
T
t
)
{
log
.
info
(
"put url is :"
+
url
);
log
.
info
(
"request params is :"
+
gson
.
toJson
(
t
));
restTemplate
.
put
(
url
,
t
);
}
/**
* put请求
*
* @param url
* @param t
* @return
*/
public
DataResponse
putForEntity
(
String
url
,
T
t
)
{
log
.
info
(
"put url is :"
+
url
);
log
.
info
(
"request params is :"
+
gson
.
toJson
(
t
));
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
HttpEntity
<
T
>
entity
=
new
HttpEntity
<
T
>(
t
,
headers
);
ResponseEntity
<
DataResponse
>
result
=
restTemplate
.
exchange
(
url
,
HttpMethod
.
PUT
,
entity
,
DataResponse
.
class
);
return
result
.
getBody
();
}
/**
* delete 请求
*
* @param url
* @param id
*/
public
void
delete
(
String
url
,
Long
id
)
{
url
=
url
+
"/"
+
id
;
log
.
info
(
"request params is :"
+
url
);
restTemplate
.
delete
(
url
,
id
);
}
/**
* delete
*
* @param url
* @param t
* @return
*/
public
DataResponse
deleteForEntity
(
String
url
,
T
t
)
{
log
.
info
(
"delete url is :"
+
url
);
log
.
info
(
"request params is :"
+
gson
.
toJson
(
t
));
//restTemplate.put(url, t);
HttpHeaders
headers
=
new
HttpHeaders
();
headers
.
setContentType
(
MediaType
.
APPLICATION_JSON
);
HttpEntity
<
T
>
entity
=
new
HttpEntity
<
T
>(
t
,
headers
);
ResponseEntity
<
DataResponse
>
result
=
restTemplate
.
exchange
(
url
,
HttpMethod
.
DELETE
,
entity
,
DataResponse
.
class
,
t
);
return
result
.
getBody
();
}
/**
* 发送/获取 服务端数据(主要用于解决发送put,delete方法无返回值问题).
*
* @param url 绝对地址
* @param method 请求方式
* @param bodyType 返回类型
* @param <T> 返回类型
* @return 返回结果(响应体)
*/
public
<
T
>
T
exchange
(
String
url
,
HttpMethod
method
,
Class
<
T
>
bodyType
,
Map
<
String
,
Object
>
params
)
{
// 请求头
HttpHeaders
headers
=
new
HttpHeaders
();
MimeType
mimeType
=
MimeTypeUtils
.
parseMimeType
(
"application/json"
);
MediaType
mediaType
=
new
MediaType
(
mimeType
.
getType
(),
mimeType
.
getSubtype
(),
Charset
.
forName
(
"UTF-8"
));
// 请求体
headers
.
setContentType
(
mediaType
);
//提供json转化功能
ObjectMapper
mapper
=
new
ObjectMapper
();
String
str
=
null
;
try
{
if
(!
params
.
isEmpty
())
{
str
=
mapper
.
writeValueAsString
(
params
);
}
}
catch
(
JsonProcessingException
e
)
{
e
.
printStackTrace
();
}
// 发送请求
HttpEntity
<
String
>
entity
=
new
HttpEntity
<>(
str
,
headers
);
RestTemplate
restTemplate
=
new
RestTemplate
();
ResponseEntity
<
T
>
resultEntity
=
restTemplate
.
exchange
(
url
,
method
,
entity
,
bodyType
);
return
resultEntity
.
getBody
();
}
public
RestTemplate
getRestTemplate
()
{
return
restTemplate
;
}
}
src/main/java/com/ost/micro/provider/common/ServiceUrl.java
0 → 100644
View file @
a596c541
package
com
.
ost
.
micro
.
provider
.
common
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.cloud.client.ServiceInstance
;
import
org.springframework.cloud.consul.discovery.ConsulDiscoveryClient
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.CollectionUtils
;
import
java.util.List
;
/**
* @author Yubo
*/
@Slf4j
@Component
public
class
ServiceUrl
{
@Value
(
"${spring.profiles.active}"
)
private
String
environmentValue
;
/**
* 开发环境和测试环境时使用
* 远程调用as-service
*/
public
static
final
String
LOCAL_DEV_URL_AS_SERVICE
=
"http://localhost:6020"
;
@Value
(
"${services.as-service}"
)
private
String
asService
;
public
static
final
ServiceUrl
INSTANCE
=
new
ServiceUrl
();
private
ServiceUrl
()
{
}
/**
* 远程调用as-service
*
* @param consulDiscoveryClient
* @return
*/
public
String
getAsServiceUrl
(
ConsulDiscoveryClient
consulDiscoveryClient
)
{
String
serviceUrl
=
null
;
switch
(
environmentValue
)
{
case
"dev"
:
serviceUrl
=
LOCAL_DEV_URL_AS_SERVICE
;
break
;
case
"devv2"
:
serviceUrl
=
LOCAL_DEV_URL_AS_SERVICE
;
break
;
case
"test"
:
case
"sit"
:
default
:
List
<
ServiceInstance
>
serviceInstanceList
=
consulDiscoveryClient
.
getInstances
(
asService
);
if
(
CollectionUtils
.
isEmpty
(
serviceInstanceList
))
{
log
.
error
(
"未找到服务========>"
+
asService
);
return
""
;
}
ServiceInstance
serviceInstance
=
serviceInstanceList
.
get
(
0
);
serviceUrl
=
serviceInstance
.
getUri
().
toString
();
log
.
info
(
"as-service 服务地址为:========>{}"
,
serviceUrl
);
}
return
serviceUrl
;
}
}
src/main/java/com/ost/micro/provider/controller/CardApiController.java
0 → 100644
View file @
a596c541
package
com
.
ost
.
micro
.
provider
.
controller
;
import
com.ost.micro.core.aop.DataToUnderline
;
import
com.ost.micro.core.context.model.response.DataResponse
;
import
com.ost.micro.core.pay.modules.cardservice.dto.passage.response.ApiResDto
;
import
com.ost.micro.provider.common.PaymentServiceClient
;
import
com.ost.micro.provider.common.ServiceUrl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cloud.consul.discovery.ConsulDiscoveryClient
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 支付接口表
*
* @author rain
* @email rain.guo@bytehug.com
* @date 2019-08-13 16:40:46
*/
@RestController
@RequestMapping
(
"provider/card/payapi"
)
@Api
(
tags
=
"card支付接口表接口"
)
@Slf4j
public
class
CardApiController
{
@Autowired
private
PaymentServiceClient
paymentServiceClient
;
@Autowired
private
ConsulDiscoveryClient
consulDiscoveryClient
;
@Autowired
private
ServiceUrl
serviceUrl
;
@GetMapping
(
"list"
)
@ApiOperation
(
"列表"
)
@ApiImplicitParam
(
paramType
=
"query"
,
required
=
false
,
name
=
"payment_type"
,
value
=
"支付方式 0-银行卡 1-固码汇旺财"
,
dataType
=
"Integer"
)
@DataToUnderline
()
public
DataResponse
<
List
<
ApiResDto
>>
list
(
@RequestParam
(
required
=
false
,
name
=
"payment_type"
)
Integer
paymentType
)
{
String
apiUrl
=
serviceUrl
.
getAsServiceUrl
(
consulDiscoveryClient
)
+
"/provider/payapi/list"
;
Map
requestMap
=
new
HashMap
<>();
if
(
null
!=
paymentType
)
{
requestMap
.
put
(
"payment_type"
,
paymentType
);
}
return
paymentServiceClient
.
get
(
apiUrl
,
requestMap
);
}
}
src/main/java/com/ost/micro/provider/controller/CardBizController.java
0 → 100644
View file @
a596c541
package
com
.
ost
.
micro
.
provider
.
controller
;
import
com.ost.micro.core.aop.DataToUnderline
;
import
com.ost.micro.core.context.model.response.DataResponse
;
import
com.ost.micro.core.pay.modules.cardservice.dto.biz.request.BizParamsReqDto
;
import
com.ost.micro.core.pay.modules.cardservice.dto.biz.request.BizReqDto
;
import
com.ost.micro.core.pay.modules.cardservice.dto.biz.response.BizResDto
;
import
com.ost.micro.provider.common.PaymentServiceClient
;
import
com.ost.micro.provider.common.ServiceUrl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cloud.consul.discovery.ConsulDiscoveryClient
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 商家管理表
*
* @author rain
* @email rain.guo@bytehug.com
* @date 2019-08-13 16:42:06
*/
@RestController
@RequestMapping
(
"provider/card/biz"
)
@Api
(
tags
=
"card商家管理表接口"
)
@Slf4j
public
class
CardBizController
{
@Autowired
private
PaymentServiceClient
paymentServiceClient
;
@Autowired
private
ConsulDiscoveryClient
consulDiscoveryClient
;
@Autowired
private
ServiceUrl
serviceUrl
;
@GetMapping
(
""
)
@ApiOperation
(
"分页列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"keyword"
,
value
=
"关键字"
,
required
=
false
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"enable"
,
value
=
"0禁用1启用"
,
required
=
false
,
dataType
=
"int"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"biz_ids"
,
value
=
"所属平台集合"
,
required
=
false
,
allowMultiple
=
true
,
dataType
=
"Long"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"page_index"
,
value
=
"页码"
,
required
=
true
,
dataType
=
"int"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"page_size"
,
value
=
"每页数码条数"
,
required
=
true
,
dataType
=
"int"
)})
@DataToUnderline
()
public
DataResponse
<
List
<
BizResDto
>>
search
(
@RequestParam
(
required
=
false
,
name
=
"keyword"
)
String
keyword
,
@RequestParam
(
required
=
false
,
name
=
"enable"
)
Integer
enable
,
@RequestParam
(
required
=
false
,
name
=
"biz_ids"
)
List
<
Long
>
bizIds
,
@RequestParam
(
name
=
"page_index"
)
Integer
pageIndex
,
@RequestParam
(
name
=
"page_size"
)
Integer
pageSize
)
{
String
bizUrl
=
serviceUrl
.
getAsServiceUrl
(
consulDiscoveryClient
)
+
"/card/biz"
;
Map
params
=
new
HashMap
();
params
.
put
(
"keyword"
,
keyword
);
params
.
put
(
"enable"
,
enable
);
params
.
put
(
"bizIds"
,
!
CollectionUtils
.
isEmpty
(
bizIds
)
?
StringUtils
.
strip
(
bizIds
.
toString
(),
"[]"
)
:
null
);
params
.
put
(
"pageIndex"
,
pageIndex
);
params
.
put
(
"pageSize"
,
pageSize
);
return
paymentServiceClient
.
get
(
bizUrl
,
params
);
}
@GetMapping
(
"list"
)
@ApiOperation
(
"列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"bank_id"
,
value
=
"银行id"
,
dataType
=
"long"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"biz_ids"
,
value
=
"所属平台集合"
,
required
=
false
,
allowMultiple
=
true
,
dataType
=
"Long"
)})
@DataToUnderline
()
public
DataResponse
list
(
@RequestParam
(
required
=
false
,
name
=
"bank_id"
)
Long
bankId
,
@RequestParam
(
required
=
false
,
name
=
"biz_ids"
)
List
<
Long
>
bizIds
)
{
String
bizUrl
=
serviceUrl
.
getAsServiceUrl
(
consulDiscoveryClient
)
+
"/card/biz/list"
;
Map
params
=
new
HashMap
();
params
.
put
(
"bankId"
,
bankId
);
params
.
put
(
"bizIds"
,
!
CollectionUtils
.
isEmpty
(
bizIds
)
?
StringUtils
.
strip
(
bizIds
.
toString
(),
"[]"
)
:
null
);
return
paymentServiceClient
.
get
(
bizUrl
,
params
);
}
@GetMapping
(
"/{id}"
)
@ApiOperation
(
"查看"
)
@ApiImplicitParam
(
paramType
=
"path"
,
name
=
"id"
,
value
=
"id"
,
required
=
true
,
dataType
=
"long"
)
@DataToUnderline
()
public
DataResponse
<
BizResDto
>
info
(
@PathVariable
(
"id"
)
Long
id
)
{
String
bizUrl
=
serviceUrl
.
getAsServiceUrl
(
consulDiscoveryClient
)
+
"/card/biz"
;
return
paymentServiceClient
.
get
(
bizUrl
,
id
);
}
@PostMapping
(
""
)
@ApiOperation
(
"新增"
)
@DataToUnderline
()
public
DataResponse
add
(
@RequestBody
BizReqDto
dto
)
{
String
bizUrl
=
serviceUrl
.
getAsServiceUrl
(
consulDiscoveryClient
)
+
"/card/biz"
;
return
paymentServiceClient
.
post
(
bizUrl
,
dto
);
}
@PutMapping
(
""
)
@ApiOperation
(
"修改"
)
@DataToUnderline
()
public
DataResponse
<
BizResDto
>
update
(
@RequestBody
BizReqDto
dto
)
{
String
bizUrl
=
serviceUrl
.
getAsServiceUrl
(
consulDiscoveryClient
)
+
"/card/biz"
;
return
paymentServiceClient
.
putForEntity
(
bizUrl
,
dto
);
}
@DeleteMapping
(
"{id}"
)
@ApiOperation
(
"删除"
)
@ApiImplicitParam
(
paramType
=
"path"
,
name
=
"id"
,
value
=
"id"
,
required
=
true
,
dataType
=
"long"
)
@DataToUnderline
()
public
DataResponse
delete
(
@PathVariable
Long
id
)
{
String
bizUrl
=
serviceUrl
.
getAsServiceUrl
(
consulDiscoveryClient
)
+
"/card/biz/"
+
id
;
ResponseEntity
<
DataResponse
>
resp
=
paymentServiceClient
.
getRestTemplate
()
.
exchange
(
bizUrl
,
HttpMethod
.
DELETE
,
null
,
DataResponse
.
class
,
id
);
return
resp
.
getBody
();
}
@PutMapping
(
"/params/edit"
)
@ApiOperation
(
"修改交易参数"
)
@DataToUnderline
()
public
DataResponse
<
BizResDto
>
editParams
(
@RequestBody
BizParamsReqDto
dto
)
{
String
bizUrl
=
serviceUrl
.
getAsServiceUrl
(
consulDiscoveryClient
)
+
"/card/biz/params/edit"
;
return
paymentServiceClient
.
putForEntity
(
bizUrl
,
dto
);
}
}
src/main/java/com/ost/micro/provider/controller/CardOrderController.java
0 → 100644
View file @
a596c541
package
com
.
ost
.
micro
.
provider
.
controller
;
import
com.google.common.reflect.TypeToken
;
import
com.google.gson.Gson
;
import
com.ost.micro.core.aop.DataToUnderline
;
import
com.ost.micro.core.context.model.response.DataResponse
;
import
com.ost.micro.core.pay.modules.cardservice.dto.order.request.OrderReqDto
;
import
com.ost.micro.core.pay.modules.cardservice.dto.order.response.OrderResDto
;
import
com.ost.micro.core.pay.modules.cardservice.excel.OrderExcelDto
;
import
com.ost.micro.core.utils.DateUtil
;
import
com.ost.micro.core.utils.ExcelUtils
;
import
com.ost.micro.provider.common.PaymentServiceClient
;
import
com.ost.micro.provider.common.ServiceUrl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cloud.consul.discovery.ConsulDiscoveryClient
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.*
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author Yubo
*/
@RestController
@RequestMapping
(
"provider/card/order"
)
@Api
(
tags
=
"card交易明细接口"
)
@Slf4j
public
class
CardOrderController
{
@Autowired
private
PaymentServiceClient
paymentServiceClient
;
@Autowired
private
ConsulDiscoveryClient
consulDiscoveryClient
;
@Autowired
private
ServiceUrl
serviceUrl
;
@GetMapping
(
""
)
@ApiOperation
(
"查询交易明细列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"keyword"
,
value
=
"关键字"
,
required
=
false
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"name"
,
value
=
"客户姓名"
,
required
=
false
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"remark"
,
value
=
"备注"
,
required
=
false
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"amount"
,
value
=
"金额"
,
required
=
false
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"biz_id"
,
value
=
"平台id"
,
required
=
false
,
dataType
=
"long"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"biz_id_list"
,
value
=
"平台集合"
,
required
=
false
,
allowMultiple
=
true
,
dataType
=
"Long"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"biz_ids"
,
value
=
"权限平台集合"
,
required
=
false
,
allowMultiple
=
true
,
dataType
=
"Long"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"status"
,
value
=
"状态"
,
required
=
false
,
dataType
=
"int"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"from_date"
,
value
=
"创建起始日期"
,
required
=
false
,
dataType
=
"Long"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"to_date"
,
value
=
"创建结束日期"
,
required
=
false
,
dataType
=
"Long"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"page_index"
,
value
=
"页码"
,
required
=
true
,
dataType
=
"int"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"page_size"
,
value
=
"每页数码条数"
,
required
=
true
,
dataType
=
"int"
)})
@DataToUnderline
()
public
DataResponse
<
List
<
OrderResDto
>>
search
(
@RequestParam
(
required
=
false
)
String
keyword
,
@RequestParam
(
required
=
false
)
String
name
,
@RequestParam
(
required
=
false
)
String
remark
,
@RequestParam
(
required
=
false
)
String
amount
,
@RequestParam
(
required
=
false
,
name
=
"biz_id"
)
Long
bizId
,
@RequestParam
(
required
=
false
,
name
=
"biz_id_list"
)
List
<
Long
>
bizIdList
,
@RequestParam
(
required
=
false
,
name
=
"biz_ids"
)
List
<
Long
>
bizIds
,
@RequestParam
(
required
=
false
)
Integer
status
,
@RequestParam
(
required
=
false
,
name
=
"from_date"
)
Long
fromDate
,
@RequestParam
(
required
=
false
,
name
=
"to_date"
)
Long
toDate
,
@RequestParam
(
name
=
"page_index"
)
Integer
pageIndex
,
@RequestParam
(
name
=
"page_size"
)
Integer
pageSize
)
{
String
orderUrl
=
serviceUrl
.
getAsServiceUrl
(
consulDiscoveryClient
)
+
"/card/order"
;
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"keyword"
,
keyword
);
params
.
put
(
"name"
,
name
);
params
.
put
(
"remark"
,
remark
);
params
.
put
(
"amount"
,
amount
);
params
.
put
(
"bizId"
,
bizId
);
if
(!
CollectionUtils
.
isEmpty
(
bizIdList
))
{
bizIds
=
bizIdList
;
}
params
.
put
(
"bizIds"
,
!
CollectionUtils
.
isEmpty
(
bizIds
)
?
StringUtils
.
strip
(
bizIds
.
toString
(),
"[]"
)
:
null
);
params
.
put
(
"status"
,
status
);
params
.
put
(
"fromDate"
,
fromDate
);
params
.
put
(
"toDate"
,
toDate
);
params
.
put
(
"pageIndex"
,
pageIndex
);
params
.
put
(
"pageSize"
,
pageSize
);
return
paymentServiceClient
.
get
(
orderUrl
,
params
);
}
@PutMapping
(
""
)
@ApiOperation
(
"编辑订单"
)
@DataToUnderline
()
public
DataResponse
edit
(
@RequestBody
OrderReqDto
dto
)
{
String
orderUrl
=
serviceUrl
.
getAsServiceUrl
(
consulDiscoveryClient
)
+
"/card/order"
;
return
paymentServiceClient
.
putForEntity
(
orderUrl
,
dto
);
}
@GetMapping
(
"/{id}"
)
@ApiOperation
(
"获取交易详情"
)
@ApiImplicitParam
(
paramType
=
"path"
,
name
=
"id"
,
value
=
"订单id"
,
required
=
true
,
dataType
=
"long"
)
@DataToUnderline
()
public
DataResponse
getTradeDetail
(
@PathVariable
Long
id
)
{
String
orderUrl
=
serviceUrl
.
getAsServiceUrl
(
consulDiscoveryClient
)
+
"/card/order"
;
return
paymentServiceClient
.
get
(
orderUrl
,
id
);
}
@GetMapping
(
"/export"
)
@ApiOperation
(
"导出交易流水"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"keyword"
,
value
=
"关键字"
,
required
=
false
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"name"
,
value
=
"客户姓名"
,
required
=
false
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"remark"
,
value
=
"备注"
,
required
=
false
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"amount"
,
value
=
"金额"
,
required
=
false
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"biz_id"
,
value
=
"平台id"
,
required
=
false
,
dataType
=
"long"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"biz_id_list"
,
value
=
"平台集合"
,
required
=
false
,
allowMultiple
=
true
,
dataType
=
"Long"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"biz_ids"
,
value
=
"所属平台集合"
,
required
=
false
,
allowMultiple
=
true
,
dataType
=
"Long"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"type"
,
value
=
"交易类型"
,
required
=
false
,
dataType
=
"int"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"status"
,
value
=
"状态"
,
required
=
false
,
dataType
=
"int"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"from_date"
,
value
=
"起始日期"
,
required
=
false
,
dataType
=
"Long"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"to_date"
,
value
=
"结束日期"
,
required
=
false
,
dataType
=
"Long"
)
})
public
void
export
(
@RequestParam
(
required
=
false
)
String
keyword
,
@RequestParam
(
required
=
false
)
String
name
,
@RequestParam
(
required
=
false
)
String
remark
,
@RequestParam
(
required
=
false
)
String
amount
,
@RequestParam
(
required
=
false
,
name
=
"biz_id"
)
Long
bizId
,
@RequestParam
(
required
=
false
,
name
=
"biz_id_list"
)
List
<
Long
>
bizIdList
,
@RequestParam
(
required
=
false
,
name
=
"biz_ids"
)
List
<
Long
>
bizIds
,
@RequestParam
(
required
=
false
)
Integer
status
,
@RequestParam
(
required
=
false
,
name
=
"from_date"
)
Long
fromDate
,
@RequestParam
(
required
=
false
,
name
=
"to_date"
)
Long
toDate
,
@RequestParam
(
required
=
false
,
name
=
"begin_time"
)
Long
beginTime
,
@RequestParam
(
required
=
false
,
name
=
"end_time"
)
Long
endTime
,
HttpServletResponse
response
)
{
String
orderUrl
=
serviceUrl
.
getAsServiceUrl
(
consulDiscoveryClient
)
+
"/card/order/export"
;
Map
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"keyword"
,
keyword
);
params
.
put
(
"name"
,
name
);
params
.
put
(
"remark"
,
remark
);
params
.
put
(
"amount"
,
amount
);
params
.
put
(
"bizId"
,
bizId
);
if
(!
CollectionUtils
.
isEmpty
(
bizIdList
))
{
bizIds
=
bizIdList
;
}
params
.
put
(
"bizIds"
,
!
CollectionUtils
.
isEmpty
(
bizIds
)
?
StringUtils
.
strip
(
bizIds
.
toString
(),
"[]"
)
:
null
);
params
.
put
(
"status"
,
status
);
params
.
put
(
"fromDate"
,
fromDate
);
params
.
put
(
"toDate"
,
toDate
);
params
.
put
(
"beginTime"
,
beginTime
);
params
.
put
(
"endTime"
,
endTime
);
DataResponse
dataResponse
=
paymentServiceClient
.
get
(
orderUrl
,
params
);
if
(
null
!=
dataResponse
&&
null
!=
dataResponse
.
getData
())
{
Object
obj
=
dataResponse
.
getData
().
getList
();
Gson
gson
=
new
Gson
();
if
(
null
!=
obj
&&
obj
instanceof
List
)
{
List
<
OrderResDto
>
dataList
=
gson
.
fromJson
(
gson
.
toJson
(
obj
),
new
TypeToken
<
List
<
OrderResDto
>>()
{
}.
getType
());
try
{
ExcelUtils
.
exportExcelToTarget
(
response
,
"交易明细_"
+
DateUtil
.
format
(
new
Date
(),
"yyyyMMddHHmmss"
),
dataList
,
OrderExcelDto
.
class
);
}
catch
(
Exception
e
)
{
log
.
error
(
"export 导出交易流水 error"
,
e
);
}
}
}
}
}
src/main/java/com/ost/micro/provider/controller/CardPassageController.java
0 → 100644
View file @
a596c541
package
com
.
ost
.
micro
.
provider
.
controller
;
import
com.ost.micro.core.aop.DataToUnderline
;
import
com.ost.micro.core.context.model.response.DataResponse
;
import
com.ost.micro.core.pay.modules.cardservice.dto.passage.request.CheckLoginDto
;
import
com.ost.micro.core.pay.modules.cardservice.dto.passage.request.PassageReqDto
;
import
com.ost.micro.core.pay.modules.cardservice.dto.passage.response.PassageResDto
;
import
com.ost.micro.core.pay.modules.upload.UploadResult
;
import
com.ost.micro.core.pay.resp.EventCode
;
import
com.ost.micro.core.utils.GsonUtil
;
import
com.ost.micro.core.utils.ResponseUtils
;
import
com.ost.micro.provider.common.FileUploadController
;
import
com.ost.micro.provider.common.PaymentServiceClient
;
import
com.ost.micro.provider.common.ServiceUrl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.cloud.consul.discovery.ConsulDiscoveryClient
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* 支付通道
*
* @author rain
* @email rain.guo@bytehug.com
* @date 2019-08-13 16:37:27
*/
@RestController
@RequestMapping
(
"provider/card/passage"
)
@Api
(
tags
=
"card支付通道接口"
)
@Slf4j
public
class
CardPassageController
{
@Autowired
private
PaymentServiceClient
paymentServiceClient
;
@Autowired
private
ConsulDiscoveryClient
consulDiscoveryClient
;
@Autowired
private
ServiceUrl
serviceUrl
;
@Autowired
private
FileUploadController
fileUploadController
;
@GetMapping
(
""
)
@ApiOperation
(
"分页列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"keyword"
,
value
=
"关键字"
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"api_id"
,
value
=
"接口id"
,
dataType
=
"Long"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"group_id"
,
value
=
"组别id"
,
dataType
=
"Long"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"biz_id"
,
value
=
"商家id"
,
dataType
=
"Long"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"biz_ids"
,
value
=
"所属平台集合"
,
required
=
false
,
allowMultiple
=
true
,
dataType
=
"Long"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"is_control"
,
value
=
"0未监控1监控中"
,
dataType
=
"Integer"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"page_index"
,
value
=
"页码"
,
required
=
true
,
dataType
=
"int"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"page_size"
,
value
=
"每页数码条数"
,
required
=
true
,
dataType
=
"int"
)})
@DataToUnderline
()
public
DataResponse
<
List
<
PassageResDto
>>
search
(
@RequestParam
(
required
=
false
,
name
=
"keyword"
)
String
keyword
,
@RequestParam
(
required
=
false
,
name
=
"api_id"
)
Long
apiId
,
@RequestParam
(
required
=
false
,
name
=
"group_id"
)
Long
groupId
,
@RequestParam
(
required
=
false
,
name
=
"biz_id"
)
Long
bizId
,
@RequestParam
(
required
=
false
,
name
=
"biz_ids"
)
List
<
Long
>
bizIds
,
@RequestParam
(
required
=
false
,
name
=
"is_control"
)
Integer
isControl
,
@RequestParam
(
name
=
"page_index"
)
Integer
pageIndex
,
@RequestParam
(
name
=
"page_size"
)
Integer
pageSize
)
{
String
passageUrl
=
serviceUrl
.
getAsServiceUrl
(
consulDiscoveryClient
)
+
"/card/passage"
;
Map
params
=
new
HashMap
();
params
.
put
(
"keyword"
,
keyword
);
params
.
put
(
"apiId"
,
apiId
);
params
.
put
(
"bizId"
,
bizId
);
params
.
put
(
"isControl"
,
isControl
);
params
.
put
(
"bizIds"
,
!
CollectionUtils
.
isEmpty
(
bizIds
)
?
StringUtils
.
strip
(
bizIds
.
toString
(),
"[]"
)
:
null
);
params
.
put
(
"groupId"
,
groupId
);
params
.
put
(
"pageIndex"
,
pageIndex
);
params
.
put
(
"pageSize"
,
pageSize
);
return
paymentServiceClient
.
get
(
passageUrl
,
params
);
}
@GetMapping
(
"list"
)
@ApiOperation
(
"列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"biz_id"
,
value
=
"所属平台id"
,
dataType
=
"Long"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"name"
,
value
=
"名字"
,
required
=
false
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"biz_ids"
,
value
=
"所属平台集合"
,
required
=
false
,
allowMultiple
=
true
,
dataType
=
"Long"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"group_type"
,
value
=
"(0变金额2不变金额)"
,
required
=
false
,
dataType
=
"Integer"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"payment_type"
,
value
=
"(0-银行卡 1-固码汇旺财 3-PDD)"
,
required
=
false
,
dataType
=
"Integer"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"bank_id"
,
value
=
"银行id"
,
required
=
false
,
dataType
=
"Long"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"bank_card"
,
value
=
"卡号"
,
required
=
false
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"api_id"
,
value
=
"接口id"
,
dataType
=
"Long"
)})
@DataToUnderline
()
public
DataResponse
list
(
@RequestParam
(
required
=
false
,
name
=
"biz_id"
)
Long
bizId
,
@RequestParam
(
required
=
false
,
name
=
"name"
)
String
name
,
@RequestParam
(
required
=
false
,
name
=
"bank_id"
)
Long
bankId
,
@RequestParam
(
required
=
false
,
name
=
"group_type"
)
Integer
groupType
,
@RequestParam
(
required
=
false
,
name
=
"payment_type"
)
Integer
paymentType
,
@RequestParam
(
required
=
false
,
name
=
"biz_ids"
)
List
<
Long
>
bizIds
,
@RequestParam
(
required
=
false
,
name
=
"bank_card"
)
Long
bankCard
,
@RequestParam
(
required
=
false
,
name
=
"api_id"
)
Long
apiId
)
{
String
passageUrl
=
serviceUrl
.
getAsServiceUrl
(
consulDiscoveryClient
)
+
"/card/passage/list"
;
Map
params
=
new
HashMap
();
params
.
put
(
"bizId"
,
bizId
);
params
.
put
(
"apiId"
,
apiId
);
params
.
put
(
"groupType"
,
groupType
);
params
.
put
(
"paymentType"
,
paymentType
);
params
.
put
(
"bizIds"
,
!
CollectionUtils
.
isEmpty
(
bizIds
)
?
StringUtils
.
strip
(
bizIds
.
toString
(),
"[]"
)
:
null
);
params
.
put
(
"name"
,
name
);
params
.
put
(
"bankId"
,
bankId
);
params
.
put
(
"bankCard"
,
bankCard
);
return
paymentServiceClient
.
get
(
passageUrl
,
params
);
}
@GetMapping
(
"list/cashout"
)
@ApiOperation
(
"列表"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"biz_id"
,
value
=
"所属平台id"
,
dataType
=
"Long"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"name"
,
value
=
"名字"
,
required
=
false
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"biz_ids"
,
value
=
"所属平台集合"
,
required
=
false
,
allowMultiple
=
true
,
dataType
=
"Long"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"group_type"
,
value
=
"(0变金额2不变金额)"
,
required
=
false
,
dataType
=
"Integer"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"bank_id"
,
value
=
"银行id"
,
required
=
false
,
dataType
=
"Long"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"bank_card"
,
value
=
"卡号"
,
required
=
false
,
dataType
=
"String"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"api_id"
,
value
=
"接口id"
,
dataType
=
"Long"
)})
@DataToUnderline
()
public
DataResponse
listCashout
(
@RequestParam
(
required
=
false
,
name
=
"biz_id"
)
Long
bizId
,
@RequestParam
(
required
=
false
,
name
=
"name"
)
String
name
,
@RequestParam
(
required
=
false
,
name
=
"bank_id"
)
Long
bankId
,
@RequestParam
(
required
=
false
,
name
=
"group_type"
)
Integer
groupType
,
@RequestParam
(
required
=
false
,
name
=
"biz_ids"
)
List
<
Long
>
bizIds
,
@RequestParam
(
required
=
false
,
name
=
"bank_card"
)
Long
bankCard
,
@RequestParam
(
required
=
false
,
name
=
"api_id"
)
Long
apiId
)
{
String
passageUrl
=
serviceUrl
.
getAsServiceUrl
(
consulDiscoveryClient
)
+
"/card/passage/list/cashout"
;
Map
params
=
new
HashMap
();
params
.
put
(
"bizId"
,
bizId
);
params
.
put
(
"apiId"
,
apiId
);
params
.
put
(
"groupType"
,
groupType
);
params
.
put
(
"bizIds"
,
!
CollectionUtils
.
isEmpty
(
bizIds
)
?
StringUtils
.
strip
(
bizIds
.
toString
(),
"[]"
)
:
null
);
params
.
put
(
"name"
,
name
);
params
.
put
(
"bankId"
,
bankId
);
params
.
put
(
"bankCard"
,
bankCard
);
return
paymentServiceClient
.
get
(
passageUrl
,
params
);
}
@GetMapping
(
"/{id}"
)
@ApiOperation
(
"查看"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"path"
,
name
=
"id"
,
value
=
"id"
,
dataType
=
"Long"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"biz_ids"
,
value
=
"所属平台集合"
,
allowMultiple
=
true
,
dataType
=
"Long"
)})
@DataToUnderline
()
public
DataResponse
<
PassageResDto
>
info
(
@PathVariable
(
"id"
)
Long
id
,
@RequestParam
(
required
=
false
,
name
=
"biz_ids"
)
List
<
Long
>
bizIds
)
{
String
passageUrl
=
serviceUrl
.
getAsServiceUrl
(
consulDiscoveryClient
)
+
"/card/passage/"
+
id
;
Map
params
=
new
HashMap
();
params
.
put
(
"bizIds"
,
!
CollectionUtils
.
isEmpty
(
bizIds
)
?
StringUtils
.
strip
(
bizIds
.
toString
(),
"[]"
)
:
null
);
return
paymentServiceClient
.
get
(
passageUrl
,
params
);
}
@PostMapping
(
""
)
@ApiOperation
(
"新增"
)
@DataToUnderline
()
public
DataResponse
add
(
@RequestBody
PassageReqDto
dto
)
{
String
passageUrl
=
serviceUrl
.
getAsServiceUrl
(
consulDiscoveryClient
)
+
"/card/passage"
;
return
paymentServiceClient
.
post
(
passageUrl
,
dto
);
}
@PutMapping
(
""
)
@ApiOperation
(
"修改"
)
@DataToUnderline
()
public
DataResponse
<
PassageResDto
>
update
(
@RequestBody
PassageReqDto
dto
)
{
String
passageUrl
=
serviceUrl
.
getAsServiceUrl
(
consulDiscoveryClient
)
+
"/card/passage"
;
return
paymentServiceClient
.
putForEntity
(
passageUrl
,
dto
);
}
@PutMapping
(
"/enable"
)
@ApiOperation
(
"修改状态"
)
@DataToUnderline
()
public
DataResponse
<
PassageResDto
>
updateEnable
(
@RequestBody
PassageReqDto
dto
)
{
String
passageUrl
=
serviceUrl
.
getAsServiceUrl
(
consulDiscoveryClient
)
+
"/card/passage/enable"
;
return
paymentServiceClient
.
putForEntity
(
passageUrl
,
dto
);
}
@DeleteMapping
(
"{id}"
)
@ApiOperation
(
"删除"
)
@ApiImplicitParam
(
paramType
=
"path"
,
name
=
"id"
,
value
=
"id"
,
required
=
true
,
dataType
=
"long"
)
@DataToUnderline
()
public
DataResponse
delete
(
@PathVariable
Long
id
)
{
String
passageUrl
=
serviceUrl
.
getAsServiceUrl
(
consulDiscoveryClient
)
+
"/card/passage/"
+
id
;
ResponseEntity
<
DataResponse
>
resp
=
paymentServiceClient
.
getRestTemplate
()
.
exchange
(
passageUrl
,
HttpMethod
.
DELETE
,
null
,
DataResponse
.
class
,
id
);
return
resp
.
getBody
();
}
@PostMapping
(
"/check/enter"
)
@ApiOperation
(
"测试登录/监控/获取url"
)
public
DataResponse
checkLogin
(
@RequestBody
CheckLoginDto
dto
)
{
String
passageUrl
=
serviceUrl
.
getAsServiceUrl
(
consulDiscoveryClient
)
+
"/card/passage/check/enter"
;
return
paymentServiceClient
.
post
(
passageUrl
,
dto
);
}
@GetMapping
(
"/enter/log/info"
)
@ApiOperation
(
"获取测试登录日志"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"card_number"
,
value
=
"银行卡号"
,
dataType
=
"Long"
)})
@DataToUnderline
()
public
DataResponse
loginLogInfo
(
@RequestParam
(
"card_number"
)
String
cardNumber
)
{
String
passageUrl
=
serviceUrl
.
getAsServiceUrl
(
consulDiscoveryClient
)
+
"/card/passage/enter/log/info"
;
Map
params
=
new
HashMap
();
params
.
put
(
"cardNumber"
,
cardNumber
);
return
paymentServiceClient
.
get
(
passageUrl
,
params
);
}
@PostMapping
(
"/uploads"
)
@ApiOperation
(
"上传"
)
@DataToUnderline
()
public
DataResponse
uploads
(
@RequestParam
(
"files"
)
MultipartFile
files
[])
{
if
(
null
!=
files
&&
files
.
length
>
0
)
{
List
<
String
>
images
=
new
ArrayList
<>(
files
.
length
);
for
(
MultipartFile
file
:
files
)
{
DataResponse
dataResponse
=
fileUploadController
.
singleFileUpload
(
file
,
"image"
);
if
(
null
!=
dataResponse
&&
dataResponse
.
getEventCode
()
==
0
)
{
UploadResult
uploadResult
=
(
UploadResult
)
dataResponse
.
getData
().
getList
();
if
(
null
!=
uploadResult
)
{
images
.
add
(
uploadResult
.
getUrl
());
}
}
}
log
.
info
(
GsonUtil
.
toJson
(
images
,
false
));
return
ResponseUtils
.
getInstance
().
success
(
images
);
}
return
ResponseUtils
.
getInstance
().
fail
(
EventCode
.
FAIL
.
getCode
(),
"请上传文件"
);
}
@GetMapping
(
"/image"
)
@ApiOperation
(
"查看银行卡号图片"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"bank_card"
,
value
=
"银行卡号"
,
dataType
=
"String"
)})
@DataToUnderline
()
public
DataResponse
image
(
@RequestParam
(
name
=
"bank_card"
)
String
bankCard
)
{
String
passageUrl
=
serviceUrl
.
getAsServiceUrl
(
consulDiscoveryClient
)
+
"/card/passage/image"
;
Map
params
=
new
HashMap
();
params
.
put
(
"bankCard"
,
bankCard
);
return
paymentServiceClient
.
get
(
passageUrl
,
params
);
}
@GetMapping
(
"/rate"
)
@ApiOperation
(
"查询域名成功率"
)
@DataToUnderline
()
public
DataResponse
rate
()
{
String
passageRateUrl
=
serviceUrl
.
getAsServiceUrl
(
consulDiscoveryClient
)
+
"/card/passage/rate"
;
Map
params
=
new
HashMap
();
return
paymentServiceClient
.
get
(
passageRateUrl
,
params
);
}
}
src/main/resources/application-dev.yml
0 → 100644
View file @
a596c541
applications
:
${spring.application.name}
\ No newline at end of file
src/main/resources/application-paycoat.yml
0 → 100644
View file @
a596c541
applications
:
${spring.application.name}
\ No newline at end of file
src/main/resources/application-paytuch.yml
0 → 100644
View file @
a596c541
applications
:
${spring.application.name}
\ No newline at end of file
src/main/resources/application-pre.yml
0 → 100644
View file @
a596c541
applications
:
${spring.application.name}
\ No newline at end of file
src/main/resources/application-prod.yml
0 → 100644
View file @
a596c541
applications
:
${spring.application.name}
\ No newline at end of file
src/main/resources/application-test.yml
0 → 100644
View file @
a596c541
applications
:
${spring.application.name}
\ No newline at end of file
src/main/resources/application-uat.yml
0 → 100644
View file @
a596c541
applications
:
${spring.application.name}
\ No newline at end of file
src/main/resources/application.yml
0 → 100644
View file @
a596c541
server
:
port
:
6014
tomcat
:
basedir
:
/web/temp_upload
services
:
as-service
:
micro-project-domain-as-service-v2
file
:
upload
:
storePath
:
/clouddisk/svr_sync/wwwroot/prj/www/uploads/
urlProfix
:
/uploads/
tempLocation
:
/web/temp_upload
\ No newline at end of file
src/main/resources/bootstrap.yml
0 → 100644
View file @
a596c541
spring
:
profiles
:
#active: prod
active
:
devv2
application
:
name
:
micro-project.as.card-provider-v2
cloud
:
consul
:
#host: 10.113.8.24
host
:
172.30.10.176
port
:
8500
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment