Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
polestar-statement-services
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
peterchu
polestar-statement-services
Commits
bcef688e
Commit
bcef688e
authored
Mar 26, 2021
by
peterchu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:
1. 完成销售明细报表相关业务 2. 添加自动化持续部署配置
parent
a2d19547
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
272 additions
and
12 deletions
+272
-12
Dockerfile
+22
-0
Jenkinsfile
+65
-0
k8s.yaml
+169
-0
src/main/java/com/yutu/base/controller/StatementController.java
+3
-0
src/main/java/com/yutu/base/service/SalesSummaryService.java
+1
-1
src/main/java/com/yutu/base/utils/HttpsSendData.java
+7
-7
src/main/resources/application-prod.yml
+2
-1
src/main/resources/application.yml
+3
-3
No files found.
Dockerfile
0 → 100644
View file @
bcef688e
# 指定基础镜像
FROM
openjdk:8-jdk-alpine
VOLUME
/log
# 维护者信息
MAINTAINER
wangyu(wangyu@yutu-it.com)
# 用于指定持久化目录
#VOLUME /tmp
#获取传递参数
ARG
jarfile
ARG
javaopt
# 将本地文件添加到容器中
ADD
$jarfile /app.jar
#编写启动文件
RUN
echo
'#!/bin/sh'
>
/root/run.sh
RUN
echo
"nohup java -Djava.security.egd=file:/dev/./urandom
$javaopt
-jar /app.jar --spring.profiles.active=prod >/usr/java/logs/app.log 2>&1"
>>
/root/run.sh
RUN
chmod 755 /root/run.sh
# 指定于外界交互的端口
EXPOSE
8066
ENV
TZ Asia/Shanghai
ENV
LANG C.UTF-8
# 配置容器,使其可执行化
ENTRYPOINT
["/root/run.sh"]
Jenkinsfile
0 → 100644
View file @
bcef688e
pipeline
{
agent
any
environment
{
def
mvnHome
=
tool
'maven-3.6.3'
def
jdk_home
=
tool
'jdk8'
def
build_tag
=
''
def
version
=
'0.0.1'
def
pj_name
=
'polestar-statement-services'
def
nameSpace
=
'yutu'
def
harborUrl
=
'120.27.1.123:8089/yutu'
def
imageId
=
''
def
hostName
=
'121.36.16.56'
def
FilebeatImageId
=
'docker.elastic.co/beats/filebeat:7.10.1'
//Logstash地址
def
LogstashHost
=
'192.168.0.220'
//JVM参数
def
JAVA_OPTS_VALUE
=
'-Xms2048m -Xmx2048m -XX:PermSize=2048M -XX:MaxPermSize=2048M'
}
stages
{
stage
(
'build jar'
)
{
steps
{
script
{
env
.
PATH
=
"${jdk_home}/bin:${mvnHome}/bin:${env.PATH}"
//env.PATH = "${mvnHome}/apache-maven-3.6.3/bin:${env.PATH}"
}
//sh 'mvn clean package'
sh
'mvn clean install -Dmaven.test.skip=true'
}
}
stage
(
'build image'
)
{
steps
{
script
{
build_tag
=
sh
(
returnStdout:
true
,
script:
"date '+%Y%m%d%H%M%S'"
).
trim
()
imageId
=
"${harborUrl}/${pj_name}:${build_tag}"
}
//sh "docker build --build-arg jarfile='target/${pj_name}.jar' -t ${imageId} ."
sh
"docker build --build-arg jarfile='target/${pj_name}-${version}.jar' --build-arg javaopt='${JAVA_OPTS_VALUE}' -t ${imageId} ."
}
}
stage
(
'push image'
)
{
steps
{
sh
"docker login -u yutu -p Yutu.2020 http://${harborUrl}"
sh
"docker push ${imageId}"
sh
"docker rmi ${imageId}"
}
}
stage
(
'deploy to k8s'
)
{
steps
{
script
{
k8sPjname
=
sh
(
returnStdout:
true
,
script:
"echo ${pj_name} | sed 's/_//g'"
).
trim
()
}
sh
"sed -i 's#myImageId#${imageId}#g' k8s.yaml"
sh
"sed -i 's/myPjName/${k8sPjname}/g' k8s.yaml"
sh
"sed -i 's/myNameSpace/${nameSpace}/g' k8s.yaml"
sh
"sed -i 's/myHostName/${hostName}/g' k8s.yaml"
sh
"sed -i 's/myIndexName/${pj_name}/g' k8s.yaml"
sh
"sed -i 's#JAVA_OPTS_VALUE#${JAVA_OPTS_VALUE}#g' k8s.yaml"
sh
"sed -i 's/myLogstashHost/${LogstashHost}/g' k8s.yaml"
sh
"sed -i 's#myFilebeatImageId#${FilebeatImageId}#g' k8s.yaml"
sh
"kubectl apply -f k8s.yaml"
}
}
}
}
k8s.yaml
0 → 100644
View file @
bcef688e
apiVersion
:
v1
kind
:
ConfigMap
metadata
:
name
:
polestar-statement-servicesfilebeatconfig
namespace
:
yutu
labels
:
k8s-app
:
filebeat
data
:
filebeat.yml
:
|-
filebeat.inputs:
- type: log
#encoding: GB18030
enabled: true
paths:
- /logdata/*
multiline.pattern: '^[[:space:]]|^Caused by:|^\<|^<'
multiline.negate: false
multiline.match: after
multiline.max_lines: 30000
fields:
log_topics: polestar-statement-services
#pod_name: '${pod_name}'
#POD_IP: '${POD_IP}'
processors:
- drop_fields:
fields: ["tags","beat","prospector","input","log","agent","ecs","host"]
output.logstash:
# The Logstash hosts
hosts: ["192.168.0.220:5044"]
---
apiVersion
:
v1
kind
:
Service
metadata
:
name
:
polestar-statement-services
namespace
:
yutu
labels
:
k8s.eip.work/layer
:
web
k8s.eip.work/name
:
polestar-statement-services
spec
:
selector
:
app
:
polestar-statement-services
release
:
canary
type
:
NodePort
ports
:
-
name
:
http
targetPort
:
8080
port
:
8090
nodePort
:
32780
---
apiVersion
:
apps/v1
kind
:
Deployment
metadata
:
name
:
polestar-statement-services
namespace
:
yutu
labels
:
k8s.eip.work/layer
:
web
k8s.eip.work/name
:
polestar-statement-services
spec
:
replicas
:
1
selector
:
matchLabels
:
app
:
polestar-statement-services
release
:
canary
template
:
metadata
:
labels
:
app
:
polestar-statement-services
release
:
canary
spec
:
#hostAliases:
#- ip: '${HOST_IP}''
#hostnames:
#- "www.5iik.com"
imagePullSecrets
:
-
name
:
secret-harbor
containers
:
-
name
:
polestar-statement-servicesfilebeat
image
:
docker.elastic.co/beats/filebeat:7.10.1
#lifecycle:
#lifecycle:
# type: Sidecar
args
:
[
"
-c"
,
"
/opt/filebeat/filebeat.yml"
,
"
-e"
,
]
securityContext
:
runAsUser
:
0
env
:
-
name
:
POD_IP
valueFrom
:
fieldRef
:
apiVersion
:
v1
fieldPath
:
status.podIP
-
name
:
pod_name
valueFrom
:
fieldRef
:
apiVersion
:
v1
fieldPath
:
metadata.name
volumeMounts
:
-
name
:
config
mountPath
:
/opt/filebeat/
-
name
:
data
mountPath
:
/usr/share/filebeat/data
-
name
:
logdata
mountPath
:
/logdata
-
name
:
polestar-statement-services
image
:
120.27.1.123:8089/yutu/polestar-statement-services:20210326093442
#livenessProbe:
# tcpSocket:
# port: 8080
# initialDelaySeconds: 45
# periodSeconds: 45
# timeoutSeconds: 15
#readinessProbe:
# tcpSocket:
# port: 8080
# initialDelaySeconds: 45
# periodSeconds: 45
# timeoutSeconds: 15
args
:
-
--link redis7010:redis
env
:
-
name
:
JAVA_OPTS
value
:
"
-Xms2048m
-Xmx2048m
-XX:PermSize=2048M
-XX:MaxPermSize=2048M"
-
name
:
NODE_IP
valueFrom
:
fieldRef
:
fieldPath
:
status.hostIP
ports
:
-
name
:
http
containerPort
:
8080
volumeMounts
:
-
name
:
logdata
mountPath
:
/usr/java/logs
volumes
:
-
name
:
data
emptyDir
:
{}
-
name
:
logdata
emptyDir
:
{}
-
name
:
config
configMap
:
name
:
polestar-product-domesticfilebeatconfig
items
:
-
key
:
filebeat.yml
path
:
filebeat.yml
src/main/java/com/yutu/base/controller/StatementController.java
View file @
bcef688e
...
...
@@ -50,9 +50,12 @@ public class StatementController {
/**
* 查询销售汇总数据 salesSummary
*
* @date 20210325135607
* @param requestBody
* @return
*/
// @GetMapping(value = "salesSummary/getSalesSummaryList")
@RequestMapping
(
value
=
"salesSummary/getSalesSummaryList"
,
method
=
RequestMethod
.
POST
)
public
NoteResult
getSalesSummaryList
(
@RequestBody
String
requestBody
){
return
salesSummaryService
.
getSalesSummaryList
(
requestBody
);
...
...
src/main/java/com/yutu/base/service/SalesSummaryService.java
View file @
bcef688e
...
...
@@ -46,7 +46,7 @@ public class SalesSummaryService {
long
beginTime
=
System
.
currentTimeMillis
();
String
result
=
HttpsSendData
.
getPost
(
statementApiUrl
+
"salesSummary/getSalesSummaryList"
,
requestBody
);
// String result = "{\"status\":0,\"msg\":\"查询成功\",\"data\":[{\"id\":\"00027727-2e16-485a-b1b3-f13d5079645a\",\"key\":\"df0286f1-eaac-11e7-adf4-a4badb3682ff_2018-10-25_2018-10-26\",\"createTime\":\"2018-12-21 09:41:41\",\"updateTime\":\"2018-12-21 09:41:41\",\"createOrderTime\":\"2018-10-24 16:24:26\",\"ticketTime\":\"2018-10-25 00:55:41\",\"outerOrderNo\":\"1380889117689\",\"channel\":\"Taobao\",\"store\":\"tbml\",\"tairLine\":\"HKT-DMK\",\"flightTime\":\"1544358000000\",\"flightNumber\":\"FD3028\",\"tripType\":\"单程\",\"pnrType\":\"去程\",\"pnr\":\"BWSTUZ\",\"passengerCount\":1,\"salePrice\":128,\"luggagePrice\":0,\"points\":0,\"purchaseCurrency\":\"CNY\",\"purchasePrice_local\":92,\"purchasePrice_rmb\":92,\"transactionDetail_local\":92,\"transactionDetail_rmb\":92,\"payMethod\":\"支付宝huochepiao3\",\"cardNumber\":\"支付宝huochepiao3\",\"profit\":36,\"transactionNumber\":\" \",\"orderValueAddedNo\":\" \",\"purchaseChannel\":\"艺龙\",\"purchaseAccount\":\"18513092060----huidarui\",\"purchaseOrderNo\":\"IT7JP5181024MO515179\",\"policyType\":\"普通促销\",\"policyCode\":\"TGJ泰国-中国\",\"orderStatus\":\"已出票\",\"operator\":\"曹坤祥\",\"purchaseTime\":\"2018-10-24 19:01:39\",\"orderValueAdded\":\" \",\"orderValueAddedSpecific\":\" \",\"remark\":\" \",\"officalReceivedPaymentStatus\":\" \",\"officalActualExpendAmount\":0,\"officalBalance\":0,\"officalRateAdjustDate\":null,\"passengerNames\":null,\"adultCount\":1,\"childCount\":0,\"sortIndex\":438}],\"info\":null}";
if
(
StringUtils
.
isBlank
(
result
))
{
noteResult
.
setStatus
(
300
);
...
...
src/main/java/com/yutu/base/utils/HttpsSendData.java
View file @
bcef688e
...
...
@@ -117,7 +117,7 @@ public class HttpsSendData {
Scanner
scanner
=
new
Scanner
(
is
,
"UTF-8"
);
result
=
scanner
.
useDelimiter
(
"\\A"
).
next
();
}
else
{
System
.
out
.
println
(
"请求状态:"
+
statusCode
);
System
.
out
.
println
(
"请求状态:
"
+
statusCode
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -142,7 +142,7 @@ public class HttpsSendData {
if
(
body
!=
null
&&
!
""
.
equals
(
body
)){
StringRequestEntity
requestEntity
;
try
{
requestEntity
=
new
StringRequestEntity
(
body
,
"
application/json
"
,
"UTF-8"
);
requestEntity
=
new
StringRequestEntity
(
body
,
"
application/json
"
,
"UTF-8"
);
postMethod
.
setRequestEntity
(
requestEntity
);
}
catch
(
UnsupportedEncodingException
e
)
{
// TODO Auto-generated catch block
...
...
@@ -153,7 +153,7 @@ public class HttpsSendData {
HttpClientParams
httparams
=
new
HttpClientParams
();
httparams
.
setSoTimeout
(
180000
);
postMethod
.
setParams
(
httparams
);
postMethod
.
setRequestHeader
(
"Content-Type"
,
"application/json;
charset=UTF-8"
);
postMethod
.
setRequestHeader
(
"Content-Type"
,
"application/json;
charset=UTF-8"
);
HttpClient
httpClient
=
new
HttpClient
();
httpClient
.
getParams
().
setParameter
(
...
...
@@ -166,7 +166,7 @@ public class HttpsSendData {
Scanner
scanner
=
new
Scanner
(
is
,
"UTF-8"
);
result
=
scanner
.
useDelimiter
(
"\\A"
).
next
();
}
else
{
System
.
out
.
println
(
"请求状态:"
+
statusCode
);
System
.
out
.
println
(
"请求状态:
"
+
statusCode
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -196,7 +196,7 @@ public class HttpsSendData {
if
(
body
!=
null
&&
!
""
.
equals
(
body
)){
StringRequestEntity
requestEntity
;
try
{
requestEntity
=
new
StringRequestEntity
(
body
,
"application/json"
,
"UTF-8"
);
requestEntity
=
new
StringRequestEntity
(
body
,
"application/json
"
,
"UTF-8"
);
postMethod
.
setRequestEntity
(
requestEntity
);
}
catch
(
UnsupportedEncodingException
e
)
{
// TODO Auto-generated catch block
...
...
@@ -207,7 +207,7 @@ public class HttpsSendData {
HttpClientParams
httparams
=
new
HttpClientParams
();
httparams
.
setSoTimeout
(
180000
);
postMethod
.
setParams
(
httparams
);
postMethod
.
setRequestHeader
(
"Content-Type"
,
"application/json;charset=UTF-8"
);
postMethod
.
setRequestHeader
(
"Content-Type
"
,
"application/json;charset=UTF-8"
);
HttpClient
httpClient
=
new
HttpClient
();
httpClient
.
getParams
().
setParameter
(
...
...
@@ -220,7 +220,7 @@ public class HttpsSendData {
Scanner
scanner
=
new
Scanner
(
is
,
"UTF-8"
);
result
=
scanner
.
useDelimiter
(
"\\A"
).
next
();
}
else
{
System
.
out
.
println
(
"请求状态:"
+
statusCode
);
System
.
out
.
println
(
"请求状态:
"
+
statusCode
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
src/main/resources/application-prod.yml
View file @
bcef688e
...
...
@@ -7,7 +7,7 @@ spring:
polestarLogsServicesUrl
:
'
http://127.0.0.1:8089/'
dataApiUrl
:
'
http://14.18.207.91:38071/iffs-data-api/'
# 订单服务 ordercenter
statementApiUrl
:
'
http://
http://
121.36.16.56:32482/ordercenterApi/'
statementApiUrl
:
'
http://121.36.16.56:32482/ordercenterApi/'
pathConfig
:
saleDetailReportExcelPath
:
'
D:\\polestar_ExcelFile/'
# 销售明细报表导出保存的本地路径
saleReportExcelPath
:
'
D:/polestar_ExcelFile/'
#
...
...
@@ -20,3 +20,4 @@ server:
tomcat
:
max-connections
:
2000
max-threads
:
2000
src/main/resources/application.yml
View file @
bcef688e
spring
:
profiles
:
active
:
test
# active: test
active
:
prod
management
:
security
:
enabled
:
false
\ No newline at end of file
enabled
:
false
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