Merge branch 'dev' into 'master'

新增接口:获得客户端配置文件文件id ;通过版本号获得对应客户端文件id

See merge request eshop/biz_service_ebtp_extend!11
This commit is contained in:
张银雪
2021-03-24 14:40:04 +08:00
8 changed files with 380 additions and 39 deletions

View File

@ -5,6 +5,7 @@ metadata:
namespace: default
labels:
app: biz-service-ebtp-extend
spec:
replicas: 3
strategy:
@ -19,62 +20,70 @@ spec:
labels:
app: biz-service-ebtp-extend #[3] 模板名称,可填写微服务名称
annotations:
prometheus.io/port: '18018' # [4] prometheus自动发现pod的端口也是该微服务server.port参数
prometheus.io/test-pod: 'true' #[5] 开启prometheus自动发现pod的功能自动发现所带标签为test-pod的podyy-pod sd-pod ji-pod
prometheus.io/port: '18018'
prometheus.io/jl-pod: 'true'
spec:
volumes:
- name: log
persistentVolumeClaim:
claimName: log-pvc
readOnly: false
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
- key: app
operator: In
values:
- biz-service-ebtp-extend
topologyKey: "kubernetes.io/hostname"
containers:
- name: biz-service-ebtp-extend #[6] 必选,容器名称,可填写微服务名称
image: harbor.dcos.xixian.unicom.local/eshop/biz-service-ebtp-extend:latest #[7] 镜像名称请把biz-service-ebtp-extend替换为服务名称
args: ["java","-Djava.security.egd=file:/dev/./urandom","-javaagent:/pinpoint/tianyan-springboot-agent/pinpoint-bootstrap-1.8.0.jar","-Dpinpoint.agentId=$(MY_POD_IP)","-Dpinpoint.applicationName=$(APP_NAME)","-Dpinpoint.licence=$(AGENT_LICENCE_DEV)","-jar","/app.jar"]
args: ["java","-Djava.security.egd=file:/dev/./urandom", "-javaagent:/pinpoint/tianyan-springboot-agent/pinpoint-bootstrap-1.8.0.jar", "-Dpinpoint.agentId=$(MY_POD_IP)", "-Dpinpoint.applicationName=$(APP_NAME)", "-Dpinpoint.licence=$(AGENT_LICENCE_DEV)", "-Dspring.profiles.active=pro", "-jar", "/app.jar"]
volumeMounts:
- name: log
mountPath: /log
ports:
- containerPort: 18018 #[8] 容器需要监听的端口号与配置文件中的server.port参数相同与参数[4]相同
livenessProbe: # 存活检测,不通过则重启容器
failureThreshold: 3 #探测失败3次重启容器
httpGet:
port: 18018 #[9] 与参数[4]相同
livenessProbe:
failureThreshold: 3
httpGet:
port: 18018 #[11] pod存活检测端口,修改为该微服务配置文件中server.port的端口号,与参数[5]相同
path: /actuator/prometheus
scheme: HTTP
initialDelaySeconds: 300 #启动容器后初始化延迟的时间也就是告诉监测从多久之后开始运行单位是秒。默认为0秒。最小值为0。
periodSeconds: 60 #执行探测的频率以秒为单位。默认为10秒。最小值为1。
successThreshold: 1 #连续失败的最小成功次数失败后将被视为成功。默认值为1。对于活动和启动探针必须为1。最小值为1。
timeoutSeconds: 2 #探测超时的秒数。默认为1秒。最小值为1。
# readinessProbe: # 就绪检测不通过则不加入svc
# failureThreshold: 1
# httpGet:
# path: /get
# port: 18018
# scheme: HTTP
# periodSeconds: 5 #执行探测的频率以秒为单位。默认为10秒。最小值为1
# successThreshold: 1 #连续失败的最小成功次数失败后将被视为成功。默认值为1。对于活动和启动探针必须为1。最小值为1。
# timeoutSeconds: 2 #探测超时的秒数。默认为1秒。最小值为1。
resources:
requests:
cpu: 500m
memory: 1Gi
limits:
initialDelaySeconds: 300
periodSeconds: 60
successThreshold: 1
timeoutSeconds: 2
readinessProbe:
failureThreshold: 1
httpGet:
port: 18018 #[12] pod就绪检测端口,修改为该微服务配置文件中server.port的端口号,与参数[5]相同
path: /actuator/prometheus
scheme: HTTP
periodSeconds: 5
successThreshold: 2
timeoutSeconds: 2
resources:
requests:
cpu: 1000m
memory: 2Gi
env: # 此处添加环境变量
- name: APP_NAME #[10] 微服务名称
value: biz-service-ebtp-extend
- name: AGENT_LICENCE_DEV #天眼pinpoint生产环境licence请勿修改
limits:
cpu: 3000m
memory: 6Gi
env:
- name: APP_NAME
value: biz-ebtp-extend
- name: AGENT_LICENCE
value: 527BFA7B28577578
- name: MY_POD_IP #自动获取pod ip作为agent id请勿修改
- name: APOLLO_CONFIGSERVICE
value: http://apollo-configservice:8080
- name: MY_POD_IP
valueFrom:
fieldRef:
fieldPath: status.podIP
- name: APOLLO_CONFIGSERVICE #获取apollo配置的地址请勿修改
value: http://10.238.25.112:6001
---
kind: Service
apiVersion: v1
@ -82,19 +91,17 @@ metadata:
name: biz-service-ebtp-extend-svc # [11] service的名字格式为“服务名-svc”
namespace: default
labels:
app: biz-service-ebtp-extend-svc # [12] service的标签可与参数[11]相同
service: biz-service-ebtp-extend-svc # [12] service的标签可与参数[11]相同
annotations:
lb.cke.tg.unicom/target-vports: 18018-18018 #[13] 内部端口-外部端口映射 内部端口为server.port即与参数[4]相同
prometheus.io/port: '18018' #[13] prometheus自动发现service的端口也是该微服务所使用的端口与参数[4]相同
prometheus.io/test-svc: 'true' #[14] 开启prometheus自动发现service的功能自动发现所带标签为test-svc的service
prometheus.io/jl-svc: 'true'
spec:
ports:
- port: 18018 #[15] 与参数4相同
targetPort: 18018 #[16] 与参数4相同
selector:
app: biz-service-ebtp-extend #[17] 该service对应Deployment的名字与参数[1]相同
status:
loadBalancer: {}
---

View File

@ -1,7 +1,9 @@
package com.chinaunicom.mall.ebtp.extend.templatewarehouse.controller;
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
import com.chinaunicom.mall.ebtp.extend.templatewarehouse.entity.BizBidClientVersion;
import com.chinaunicom.mall.ebtp.extend.templatewarehouse.entity.BizBidTemplateWarehouse;
import com.chinaunicom.mall.ebtp.extend.templatewarehouse.sevice.BizBidClientVersionService;
import com.chinaunicom.mall.ebtp.extend.templatewarehouse.sevice.BizBidTemplateWarehouseService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -16,6 +18,8 @@ import javax.annotation.Resource;
public class TemplateWarehouseController {
@Resource
private BizBidTemplateWarehouseService templateWarehouseService;
@Resource
private BizBidClientVersionService bizBidClientVersionService;
/**
* 通过模板类型查询模板数据
@ -44,4 +48,29 @@ public class TemplateWarehouseController {
Boolean result = templateWarehouseService.insertTemplate(templateWarehouse);
return BaseResponse.success(result);
}
/**
* 获得客户端配置文件相关信息
*
* @return
*/
@ApiOperation("获得客户端配置文件文件id")
@GetMapping("/client/file")
public BaseResponse<BizBidTemplateWarehouse> getClientFile(){
String type = "ipassConfigFile";
BizBidTemplateWarehouse templateWarehouse = templateWarehouseService.getTemplateByType(type);
return BaseResponse.success(templateWarehouse);
}
/**
* 通过版本号获得对应客户端文件id
*
* @return
*/
@ApiOperation("通过版本号获得对应客户端文件id")
@GetMapping("/client/{version}")
public BaseResponse<BizBidClientVersion> getClientByVersion(@ApiParam(value = "版本号", required = true) @PathVariable String version){
BizBidClientVersion clientVersion = bizBidClientVersionService.getClientByVersion(version);
return BaseResponse.success(clientVersion);
}
}

View File

@ -0,0 +1,10 @@
package com.chinaunicom.mall.ebtp.extend.templatewarehouse.dao;
import com.chinaunicom.mall.ebtp.common.base.dao.IBaseMapper;
import com.chinaunicom.mall.ebtp.extend.templatewarehouse.entity.BizBidClientVersion;
public interface BizBidClientVersionMapper extends IBaseMapper<BizBidClientVersion> {
}

View File

@ -0,0 +1,14 @@
<?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.chinaunicom.mall.ebtp.extend.templatewarehouse.dao.BizBidClientVersionMapper">
<resultMap id="BaseResultMap"
type="com.chinaunicom.mall.ebtp.extend.templatewarehouse.entity.BizBidClientVersion">
<result column="id" jdbcType="BIGINT" property="id"/>
<result column="document_center_id" jdbcType="VARCHAR" property="documentCenterId"/>
<result column="ipass_version" jdbcType="VARCHAR" property="ipassVersion"/>
<result column="publish_date" jdbcType="TIMESTAMP" property="publishDate"/>
<result column="remark" jdbcType="VARCHAR" property="remark"/>
</resultMap>
</mapper>

View File

@ -0,0 +1,70 @@
package com.chinaunicom.mall.ebtp.extend.templatewarehouse.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.chinaunicom.mall.ebtp.common.base.entity.BaseEntity;
import com.chinaunicom.mall.ebtp.common.config.CustomLocalDateTimeTypeHandler;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 实体类 BizBidClientVersion
*
* @auto.generated
*/
@Data
@Accessors(chain = true)
@ApiModel
@TableName(value = "biz_bid_client_version", autoResultMap = true)
public class BizBidClientVersion implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
@ApiModelProperty(value = "主键")
private String id;
/**
* 文档中心-文档ID
*/
@ApiModelProperty(value = "文档中心-文档ID")
private String documentCenterId;
/**
* ipass客户端版本号
*/
@ApiModelProperty(value = "ipass客户端版本号")
private String ipassVersion;
@TableField(
fill = FieldFill.INSERT,
typeHandler = CustomLocalDateTimeTypeHandler.class
)
@JsonFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@DateTimeFormat(
pattern = "yyyy-MM-dd HH:mm:ss"
)
@ApiModelProperty("客户端发布时间")
private LocalDateTime publishDate;
/**
* ipass客户端版本号
*/
@ApiModelProperty(value = "备注")
private String remark;
}

View File

@ -0,0 +1,22 @@
package com.chinaunicom.mall.ebtp.extend.templatewarehouse.sevice;
import com.chinaunicom.mall.ebtp.common.base.service.IBaseService;
import com.chinaunicom.mall.ebtp.extend.templatewarehouse.entity.BizBidClientVersion;
/**
* 对数据表 biz_bid_client_version 操作的 service
* @author Auto create
*
*/
public interface BizBidClientVersionService extends IBaseService<BizBidClientVersion>{
/**
* 通过版本号获得对应客户端文件id
* @param version
* @return
*/
BizBidClientVersion getClientByVersion(String version);
}

View File

@ -0,0 +1,24 @@
package com.chinaunicom.mall.ebtp.extend.templatewarehouse.sevice.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.chinaunicom.mall.ebtp.extend.templatewarehouse.entity.BizBidClientVersion;
import org.springframework.stereotype.Service;
import com.chinaunicom.mall.ebtp.extend.templatewarehouse.dao.BizBidClientVersionMapper;
import com.chinaunicom.mall.ebtp.extend.templatewarehouse.sevice.BizBidClientVersionService;
import com.chinaunicom.mall.ebtp.common.base.service.impl.BaseServiceImpl;
/**
* 对数据表 biz_bid_client_version 操作的 serviceImpl
* @author Auto create
*
*/
@Service
public class BizBidClientVersionServiceImpl extends BaseServiceImpl<BizBidClientVersionMapper, BizBidClientVersion> implements BizBidClientVersionService {
@Override
public BizBidClientVersion getClientByVersion(String version) {
QueryWrapper<BizBidClientVersion> query = new QueryWrapper<>(new BizBidClientVersion().setIpassVersion(version));
return this.getOne(query);
}
}

View File

@ -0,0 +1,165 @@
server:
port: 18018
servlet:
context-path: /
seata:
service:
vgroup-mapping:
biz-service-ebtp-extend-service-group: seata-server-jl
registry:
type: eureka
eureka:
serviceUrl: http://eureka-1-svc:8080/eureka,http://eureka-2-svc:8080/eureka,http://eureka-3-svc:8080/eureka
# 对应 apollo 配置中心的应用名
app:
id: biz-service-ebtp-extend
# Apollo 配置信息
apollo:
meta: http://10.238.25.112:6001/
bootstrap:
namespace: application
enabled: true
eagerLoad:
enabled: true
spring:
aop:
auto: true #开启spring的aop配置
proxy-target-class: true
application:
name: biz-service-ebtp-extend
shardingsphere:
datasource:
names: ds0
ds0:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
username: auction
password: ProdMall3_0118auction
jdbc-url: jdbc:mysql://10.168.9.242:3306/ebtp_mall_extend?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
url: jdbc:mysql://10.168.9.242:3306/ebtp_mall_extend?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
filters: stat,wall,log4j
maxActive: 20
initialSize: 1
maxWait: 60000
minIdle: 1
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: select 'x'
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxOpenPreparedStatements: 20
connection-properties: druid.stat.merggSql=ture;druid.stat.slowSqlMillis=5000
props:
sql:
show: true
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
serialization:
write-dates-as-timestamps: false
# 天宫Kafka增加了安全认证需要配置安全属性
kafka:
bootstrap-servers: 10.172.48.110:32050,10.172.48.109:32050,10.172.48.111:32050
template:
default-topic: jl_eshop
# 生产者配置参数
producer:
client-id: core-service-ebtp-crypt
properties:
security.protocol: SASL_PLAINTEXT
sasl.mechanism: SCRAM-SHA-256
sasl.jaas.config: org.apache.kafka.common.security.scram.ScramLoginModule required username="eshop-kafka" password="Unicom#135";
# 消费者配置参数
consumer:
group-id: core-service-ebtp-crypt-consumer
auto-offset-reset: latest
properties:
security.protocol: SASL_PLAINTEXT
sasl.mechanism: SCRAM-SHA-256
sasl.jaas.config: org.apache.kafka.common.security.scram.ScramLoginModule required username="eshop-kafka" password="Unicom#135";
# 生产区 redis 配置
redis:
sentinel:
master: eshop-redis2
nodes: 10.172.48.83:32521,10.172.48.100:32521,10.172.48.94:32561
password: Unicom#135
# 天宫Eureka配置
eureka:
client:
service-url:
defaultZone: http://eureka-1-svc:8080/eureka,http://eureka-2-svc:8080/eureka,http://eureka-3-svc:8080/eureka
instance:
prefer-ip-address: true
instance-ip: ${spring.cloud.client.ip-address}:${server.port}
mybatis-plus:
configuration:
# 是否开启自动驼峰命名规则映射:从数据库列名到Java属性驼峰命名的类似映射
map-underscore-to-camel-case: true
auto-mapping-behavior: full
# 这个配置会将执行的sql打印出来在开发或测试的时候可以用
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
mapper-locations: classpath*:com/chinaunicom/mall/ebtp/**/mapper/*Mapper.xml
global-config:
# 逻辑删除配置
db-config:
# logic-delete-field: flag # 全局逻辑删除的实体字段名(since 3.3.0,配置后可以忽略不配置步骤2) @TableLogic
logic-delete-value: deleted # 逻辑已删除值
logic-not-delete-value: normal # 逻辑未删除值
hystrix:
command:
default:
execution:
timeout:
enabled: true
isolation:
strategy: SEMAPHORE
thread:
timeoutInMilliseconds: 200000 #熔断超时时间
circuitBreaker:
sleepWindowInMilliseconds: 20000
forceClosed: true
ribbon:
ReadTimeout: 20000 #请求处理的超时时间
ConnectTimeout: 20000 #请求连接超时时间
MaxAutoRetries: 0 #对当前实例的重试次数
MaxAutoRetriesNextServer: 1 #切换实例的重试次数 1
mconfig:
workerId: 1
datacenterId: 1
# 服务名
feign:
name:
open: biz-service-ebtp-opening #开标大厅服务
process: biz-service-ebtp-process #评审流程服务
project: biz-service-ebtp-project #项目服务
resps: biz-service-ebtp-resps #应答结构化服务
rsms: biz-service-ebtp-rsms #评审结构化服务
tender: biz-service-ebtp-tender #投标服务
# 用户暴露给 prometheus 的健康数据
management:
endpoints:
web:
exposure:
include: "*"
cors:
allowed-origins: "*"
allowed-methods: "*"