记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
Project
Project
Details
Activity
Releases
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
董敬伟
liquidnet-bus-v1
Commits
8e49dd3c
Commit
8e49dd3c
authored
Nov 10, 2021
by
胡佳晨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
暂时提交
parent
9e9e84ba
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
52 additions
and
26 deletions
+52
-26
HttpUtil.java
...c/main/java/com/liquidnet/commons/lang/util/HttpUtil.java
+31
-10
application-dev.yml
liquidnet-bus-config/liquidnet-config/application-dev.yml
+1
-1
application-test.yml
liquidnet-bus-config/liquidnet-config/application-test.yml
+1
-1
TicketSystemController.java
...tform/controller/ticketSystem/TicketSystemController.java
+3
-6
ITicketSystemServiceImpl.java
...m/service/ticketSystem/impl/ITicketSystemServiceImpl.java
+16
-8
No files found.
liquidnet-bus-common/liquidnet-common-base/src/main/java/com/liquidnet/commons/lang/util/HttpUtil.java
View file @
8e49dd3c
package
com
.
liquidnet
.
commons
.
lang
.
util
;
package
com
.
liquidnet
.
commons
.
lang
.
util
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.liquidnet.commons.lang.util.spring.RestTemplateConfig
;
import
com.liquidnet.commons.lang.util.spring.RestTemplateConfig
;
import
org.springframework.http.*
;
import
org.springframework.http.*
;
...
@@ -65,7 +66,7 @@ public class HttpUtil {
...
@@ -65,7 +66,7 @@ public class HttpUtil {
return
request
(
url
,
params
,
headers
,
HttpMethod
.
POST
);
return
request
(
url
,
params
,
headers
,
HttpMethod
.
POST
);
}
}
public
static
String
postJson
(
String
url
,
String
jsonStr
)
{
public
static
String
postJson
(
String
url
,
String
jsonStr
)
{
MultiValueMap
<
String
,
String
>
headers
=
new
LinkedMultiValueMap
();
MultiValueMap
<
String
,
String
>
headers
=
new
LinkedMultiValueMap
();
headers
.
add
(
"Content-Type"
,
"application/json;charset=UTF-8"
);
headers
.
add
(
"Content-Type"
,
"application/json;charset=UTF-8"
);
headers
.
add
(
"Accept"
,
"application/json;charset=UTF-8"
);
headers
.
add
(
"Accept"
,
"application/json;charset=UTF-8"
);
...
@@ -82,11 +83,12 @@ public class HttpUtil {
...
@@ -82,11 +83,12 @@ public class HttpUtil {
HttpEntity
<
Object
>
httpEntity
=
new
HttpEntity
(
jsonStr
,
httpHeaders
);
HttpEntity
<
Object
>
httpEntity
=
new
HttpEntity
(
jsonStr
,
httpHeaders
);
// 提交方式:表单、json
// 提交方式:表单、json
Object
respObj
=
restTemplate
.
postForEntity
(
url
,
httpEntity
,
Object
.
class
).
getBody
();;
Object
respObj
=
restTemplate
.
postForEntity
(
url
,
httpEntity
,
Object
.
class
).
getBody
();
;
return
JsonUtils
.
toJson
(
respObj
);
return
JsonUtils
.
toJson
(
respObj
);
}
}
public
static
String
postJson
(
String
url
,
String
jsonStr
,
MultiValueMap
<
String
,
String
>
headers
)
{
public
static
String
postJson
(
String
url
,
String
jsonStr
,
MultiValueMap
<
String
,
String
>
headers
)
{
MultiValueMap
<
String
,
String
>
commonHeader
=
new
LinkedMultiValueMap
();
MultiValueMap
<
String
,
String
>
commonHeader
=
new
LinkedMultiValueMap
();
commonHeader
.
add
(
"Content-Type"
,
"application/json;charset=UTF-8"
);
commonHeader
.
add
(
"Content-Type"
,
"application/json;charset=UTF-8"
);
commonHeader
.
add
(
"Accept"
,
"application/json;charset=UTF-8"
);
commonHeader
.
add
(
"Accept"
,
"application/json;charset=UTF-8"
);
...
@@ -107,12 +109,13 @@ public class HttpUtil {
...
@@ -107,12 +109,13 @@ public class HttpUtil {
// 提交方式:表单、json
// 提交方式:表单、json
// ResponseEntity<String> response = restTemplate.exchange(url, method, httpEntity, String.class);
// ResponseEntity<String> response = restTemplate.exchange(url, method, httpEntity, String.class);
Object
respObj
=
restTemplate
.
postForEntity
(
url
,
httpEntity
,
Object
.
class
).
getBody
();
;
Object
respObj
=
restTemplate
.
postForEntity
(
url
,
httpEntity
,
Object
.
class
).
getBody
()
;
return
JsonUtils
.
toJson
(
respObj
);
return
JsonUtils
.
toJson
(
respObj
);
}
}
/**
/**
* josn post提交
* josn post提交
*
* @param url
* @param url
* @param jsonParam
* @param jsonParam
* @return
* @return
...
@@ -144,12 +147,25 @@ public class HttpUtil {
...
@@ -144,12 +147,25 @@ public class HttpUtil {
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
System
.
out
.
println
(
"posturl:"
+
url
+
", err="
+
e
.
getMessage
());
System
.
out
.
println
(
"posturl:"
+
url
+
", err="
+
e
.
getMessage
());
}
}
if
(
result
!=
null
)
{
if
(
result
!=
null
)
{
rsResultObj
=
JSONObject
.
parseObject
(
result
);
rsResultObj
=
JSONObject
.
parseObject
(
result
);
}
}
return
rsResultObj
;
return
rsResultObj
;
}
}
/**
* post请求
*
* @param url
* @param jsonString 请求参数
* @param headers 请求头
* @return
*/
public
static
String
getRaw
(
String
url
,
String
jsonString
,
MultiValueMap
<
String
,
String
>
headers
)
{
return
requestRaw
(
url
,
jsonString
,
headers
,
HttpMethod
.
GET
);
}
/**
/**
* post请求
* post请求
*
*
...
@@ -276,15 +292,20 @@ public class HttpUtil {
...
@@ -276,15 +292,20 @@ public class HttpUtil {
// header
// header
HttpHeaders
httpHeaders
=
new
HttpHeaders
();
HttpHeaders
httpHeaders
=
new
HttpHeaders
();
httpHeaders
.
add
(
"Accept"
,
MediaType
.
APPLICATION_JSON
.
toString
());
httpHeaders
.
add
(
"Accept"
,
MediaType
.
APPLICATION_JSON
.
toString
());
httpHeaders
.
set
(
"Content-Type"
,
"application/json;charset=UTF-8"
);
httpHeaders
.
set
(
"Content-Type"
,
"application/json;charset=UTF-8"
);
if
(
headers
!=
null
)
{
if
(
headers
!=
null
)
{
httpHeaders
.
addAll
(
headers
);
httpHeaders
.
addAll
(
headers
);
}
}
HttpEntity
<
Object
>
httpEntity
=
new
HttpEntity
(
params
,
httpHeaders
);
// RestTemplate restTemplate = new RestTemplate();
// 提交方式:表单、json
// 提交方式:表单、json
ResponseEntity
<
String
>
response
=
restTemplate
.
postForEntity
(
url
,
httpEntity
,
String
.
class
);
ResponseEntity
<
String
>
response
=
null
;
if
(
HttpMethod
.
POST
==
method
)
{
HttpEntity
<
String
>
httpEntity
=
new
HttpEntity
(
params
,
httpHeaders
);
response
=
restTemplate
.
postForEntity
(
url
,
httpEntity
,
String
.
class
);
}
else
if
(
HttpMethod
.
GET
==
method
)
{
HttpEntity
<
String
>
httpEntity
=
new
HttpEntity
(
params
,
httpHeaders
);
Map
<
String
,
Object
>
map
=
JSON
.
parseObject
(
params
.
toString
());
response
=
restTemplate
.
exchange
(
url
,
method
,
httpEntity
,
String
.
class
,
map
);
}
return
response
.
getBody
();
return
response
.
getBody
();
}
}
...
...
liquidnet-bus-config/liquidnet-config/application-dev.yml
View file @
8e49dd3c
...
@@ -83,7 +83,7 @@ liquidnet:
...
@@ -83,7 +83,7 @@ liquidnet:
chime
:
chime
:
url
:
http://devchime.zhengzai.tv
url
:
http://devchime.zhengzai.tv
other
:
other
:
ticketSystemUrl
:
http
s://
report.capapiao.com
ticketSystemUrl
:
http
://dev-
report.capapiao.com
appId
:
11920532
appId
:
11920532
secret
:
0854C2FFE6BED88E1E21E7F5BAF988CDF9D81D38
secret
:
0854C2FFE6BED88E1E21E7F5BAF988CDF9D81D38
executor-main
:
executor-main
:
...
...
liquidnet-bus-config/liquidnet-config/application-test.yml
View file @
8e49dd3c
...
@@ -85,7 +85,7 @@ liquidnet:
...
@@ -85,7 +85,7 @@ liquidnet:
chime
:
chime
:
url
:
http://testchime.zhengzai.tv
url
:
http://testchime.zhengzai.tv
other
:
other
:
ticketSystemUrl
:
http
s://report.capapiao.com
ticketSystemUrl
:
http
://dev-report.capapiao.com/
appId
:
11920532
appId
:
11920532
secret
:
0854C2FFE6BED88E1E21E7F5BAF988CDF9D81D38
secret
:
0854C2FFE6BED88E1E21E7F5BAF988CDF9D81D38
executor-main
:
executor-main
:
...
...
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/controller/ticketSystem/TicketSystemController.java
View file @
8e49dd3c
...
@@ -9,10 +9,7 @@ import io.swagger.annotations.ApiImplicitParam;
...
@@ -9,10 +9,7 @@ import io.swagger.annotations.ApiImplicitParam;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.NotNull
;
import
java.util.List
;
import
java.util.List
;
...
@@ -25,7 +22,7 @@ public class TicketSystemController {
...
@@ -25,7 +22,7 @@ public class TicketSystemController {
@Autowired
@Autowired
ITicketSystemService
ticketSystemService
;
ITicketSystemService
ticketSystemService
;
@
Pos
tMapping
(
"type/list"
)
@
Ge
tMapping
(
"type/list"
)
@ApiOperation
(
"查询标准演出类型"
)
@ApiOperation
(
"查询标准演出类型"
)
public
ResponseDto
<
List
<
STPTListVo
>>
getPerformanceTypeList
()
{
public
ResponseDto
<
List
<
STPTListVo
>>
getPerformanceTypeList
()
{
String
accessToken
=
ticketSystemService
.
getAccessToken
();
String
accessToken
=
ticketSystemService
.
getAccessToken
();
...
@@ -33,7 +30,7 @@ public class TicketSystemController {
...
@@ -33,7 +30,7 @@ public class TicketSystemController {
return
ResponseDto
.
success
(
vo
);
return
ResponseDto
.
success
(
vo
);
}
}
@
Pos
tMapping
(
"field/list"
)
@
Ge
tMapping
(
"field/list"
)
@ApiOperation
(
"查询标准演出场所"
)
@ApiOperation
(
"查询标准演出场所"
)
public
ResponseDto
<
List
<
STFieldListVo
>>
getFieldList
(
STFieldListParam
fieldListParam
)
{
public
ResponseDto
<
List
<
STFieldListVo
>>
getFieldList
(
STFieldListParam
fieldListParam
)
{
String
accessToken
=
ticketSystemService
.
getAccessToken
();
String
accessToken
=
ticketSystemService
.
getAccessToken
();
...
...
liquidnet-bus-service/liquidnet-service-platform/liquidnet-service-platform-impl/src/main/java/com/liquidnet/service/platform/service/ticketSystem/impl/ITicketSystemServiceImpl.java
View file @
8e49dd3c
...
@@ -10,12 +10,13 @@ import com.liquidnet.commons.lang.util.JsonUtils;
...
@@ -10,12 +10,13 @@ import com.liquidnet.commons.lang.util.JsonUtils;
import
com.liquidnet.service.platform.param.ticketSystem.*
;
import
com.liquidnet.service.platform.param.ticketSystem.*
;
import
com.liquidnet.service.platform.service.ticketSystem.ITicketSystemService
;
import
com.liquidnet.service.platform.service.ticketSystem.ITicketSystemService
;
import
com.liquidnet.service.platform.vo.ticketSystem.*
;
import
com.liquidnet.service.platform.vo.ticketSystem.*
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.MultiValueMap
;
import
org.springframework.util.MultiValueMap
;
import
java.
time.LocalDateTime
;
import
java.
util.HashMap
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -27,6 +28,7 @@ import java.util.List;
...
@@ -27,6 +28,7 @@ import java.util.List;
* @since 2021-05-11
* @since 2021-05-11
*/
*/
@Service
@Service
@Slf4j
public
class
ITicketSystemServiceImpl
implements
ITicketSystemService
{
public
class
ITicketSystemServiceImpl
implements
ITicketSystemService
{
@Value
(
"${liquidnet.service.other.ticketSystemUrl}"
)
@Value
(
"${liquidnet.service.other.ticketSystemUrl}"
)
private
String
ticketSystemUrl
;
private
String
ticketSystemUrl
;
...
@@ -46,9 +48,9 @@ public class ITicketSystemServiceImpl implements ITicketSystemService {
...
@@ -46,9 +48,9 @@ public class ITicketSystemServiceImpl implements ITicketSystemService {
}
else
{
}
else
{
MultiValueMap
<
String
,
String
>
headers
=
CollectionUtil
.
linkedMultiValueMapStringString
();
MultiValueMap
<
String
,
String
>
headers
=
CollectionUtil
.
linkedMultiValueMapStringString
();
headers
.
add
(
"Accept"
,
"application/json;charset=UTF-8"
);
headers
.
add
(
"Accept"
,
"application/json;charset=UTF-8"
);
MultiValueMap
<
String
,
String
>
params
=
CollectionUtil
.
linkedMultiValueM
apStringString
();
HashMap
<
String
,
String
>
params
=
CollectionUtil
.
m
apStringString
();
params
.
add
(
"appId"
,
appId
);
params
.
put
(
"appId"
,
appId
);
params
.
add
(
"secret"
,
secret
);
params
.
put
(
"secret"
,
secret
);
ResponseDataVo
<
STAccessTokenVo
>
response
=
ResponseDataVo
<
STAccessTokenVo
>
response
=
JsonUtils
.
fromJson
(
HttpUtil
.
postRaw
(
ticketSystemUrl
+
"/getAccessToken"
,
JSON
.
toJSONString
(
params
),
headers
),
JsonUtils
.
fromJson
(
HttpUtil
.
postRaw
(
ticketSystemUrl
+
"/getAccessToken"
,
JSON
.
toJSONString
(
params
),
headers
),
new
TypeReference
<
ResponseDataVo
<
STAccessTokenVo
>>()
{
new
TypeReference
<
ResponseDataVo
<
STAccessTokenVo
>>()
{
...
@@ -63,11 +65,17 @@ public class ITicketSystemServiceImpl implements ITicketSystemService {
...
@@ -63,11 +65,17 @@ public class ITicketSystemServiceImpl implements ITicketSystemService {
public
List
<
STPTListVo
>
getPerformanceTypeList
(
String
accessToken
)
{
public
List
<
STPTListVo
>
getPerformanceTypeList
(
String
accessToken
)
{
MultiValueMap
<
String
,
String
>
headers
=
CollectionUtil
.
linkedMultiValueMapStringString
();
MultiValueMap
<
String
,
String
>
headers
=
CollectionUtil
.
linkedMultiValueMapStringString
();
headers
.
add
(
"Accept"
,
"application/json;charset=UTF-8"
);
headers
.
add
(
"Accept"
,
"application/json;charset=UTF-8"
);
ResponseListVo
<
List
<
STPTListVo
>>
response
=
HashMap
<
String
,
String
>
params
=
CollectionUtil
.
mapStringString
();
JsonUtils
.
fromJson
(
HttpUtil
.
get
(
ticketSystemUrl
+
"/standard/performance/type/list?accessToken="
+
accessToken
,
null
,
headers
),
params
.
put
(
"accessToken"
,
accessToken
);
new
TypeReference
<
ResponseListVo
<
List
<
STPTListVo
>>>()
{
String
json
=
HttpUtil
.
getRaw
(
ticketSystemUrl
+
"/standard/performance/type/list?accessToken={accessToken}"
,
JSON
.
toJSONString
(
params
),
headers
);
log
.
info
(
"json = "
+
json
);
ResponseDataVo
<
List
<
STPTListVo
>>
response
=
JsonUtils
.
fromJson
(
HttpUtil
.
getRaw
(
ticketSystemUrl
+
"/standard/performance/type/list?accessToken={accessToken}"
,
JSON
.
toJSONString
(
params
),
headers
),
new
TypeReference
<
ResponseDataVo
<
List
<
STPTListVo
>>>()
{
});
});
return
response
.
getData
().
getDataList
();
log
.
info
(
"url="
+
ticketSystemUrl
+
"/standard/performance/type/list"
);
log
.
info
(
"param="
+
JSON
.
toJSONString
(
params
));
return
response
.
getData
();
}
}
@Override
@Override
...
...
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