上传代码

This commit is contained in:
sunyu
2025-04-14 11:02:17 +08:00
parent 3389337b41
commit e53d20ac90
8 changed files with 216 additions and 126 deletions

Binary file not shown.

56
pom.xml
View File

@ -3,11 +3,11 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<parent> <parent>
<groupId>com.chinaunicom.ebtp</groupId> <groupId>com.chinaunicom.ebtp</groupId>
<artifactId>mall-ebtp-cloud-parent</artifactId> <artifactId>mall-ebtp-cloud-parent</artifactId>
<version>2.3.0-SNAPSHOT</version> <version>2.4.1-zyhy-SNAPSHOT</version>
</parent> </parent>
<groupId>com.chinaunicom.mall.ebtp</groupId> <groupId>com.chinaunicom.mall.ebtp</groupId>
@ -16,22 +16,22 @@
<name>biz_service_ebtp_extend</name> <name>biz_service_ebtp_extend</name>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>com.chinaunicom.mall.ebtp</groupId> <groupId>com.chinaunicom.mall.ebtp</groupId>
<artifactId>uboot-core</artifactId> <artifactId>uboot-core</artifactId>
<version>2.3.0-SNAPSHOT</version> <version>2.4.1-zyhy-SNAPSHOT</version>
</dependency> </dependency>
<!-- 证书加密签名 --> <!-- 证书加密签名 -->
<dependency> <!-- <dependency>-->
<groupId>com.cuca</groupId> <!-- <groupId>com.cuca</groupId>-->
<artifactId>cucasecuritysdk</artifactId> <!-- <artifactId>cucasecuritysdk</artifactId>-->
<version>1.7</version> <!-- <version>1.7</version>-->
<!-- <scope>system</scope>--> <!--&lt;!&ndash; <scope>system</scope>&ndash;&gt;-->
<!-- <systemPath>${project.basedir}/libs/cucasecuritysdk-1.7.jar</systemPath>--> <!--&lt;!&ndash; <systemPath>${project.basedir}/libs/cucasecuritysdk-1.7.jar</systemPath>&ndash;&gt;-->
</dependency> <!-- </dependency>-->
<dependency> <dependency>
<groupId>com.deepoove</groupId> <groupId>com.deepoove</groupId>
@ -75,11 +75,11 @@
<systemPath>${basedir}/lib/access_token1.3.jar</systemPath> <systemPath>${basedir}/lib/access_token1.3.jar</systemPath>
</dependency> </dependency>
<dependency> <!-- <dependency>-->
<groupId>cn.chinaunicom.sdsi</groupId> <!-- <groupId>cn.chinaunicom.sdsi</groupId>-->
<artifactId>mall-xxljob-core</artifactId> <!-- <artifactId>mall-xxljob-core</artifactId>-->
<version>0.0.1</version> <!-- <version>0.0.1</version>-->
</dependency> <!-- </dependency>-->
<dependency> <dependency>
<groupId>org.apache.velocity</groupId> <groupId>org.apache.velocity</groupId>
<artifactId>velocity-tools</artifactId> <artifactId>velocity-tools</artifactId>
@ -91,11 +91,11 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <!-- <dependency>-->
<groupId>e-iceblue</groupId> <!-- <groupId>e-iceblue</groupId>-->
<artifactId>spire.doc.free</artifactId> <!-- <artifactId>spire.doc.free</artifactId>-->
<version>3.9.0</version> <!-- <version>3.9.0</version>-->
</dependency> <!-- </dependency>-->
<dependency> <dependency>
<groupId>org</groupId> <groupId>org</groupId>
@ -155,12 +155,12 @@
</includes> </includes>
</resource> </resource>
</resources> </resources>
<plugins> <!-- <plugins>-->
<plugin> <!-- <plugin>-->
<groupId>org.springframework.boot</groupId> <!-- <groupId>org.springframework.boot</groupId>-->
<artifactId>spring-boot-maven-plugin</artifactId> <!-- <artifactId>spring-boot-maven-plugin</artifactId>-->
</plugin> <!-- </plugin>-->
</plugins> <!-- </plugins>-->
</build> </build>
</project> </project>

View File

@ -17,8 +17,8 @@ import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.velocity.VelocityContext; //import org.apache.velocity.VelocityContext;
import org.apache.velocity.app.Velocity; //import org.apache.velocity.app.Velocity;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -83,8 +83,8 @@ public class BizMessageProducerServiceImpl implements BizMessageProducerService
BeanUtils.copyProperties(messageRaw, bizmessage); BeanUtils.copyProperties(messageRaw, bizmessage);
bizmessage.setId(messageId); bizmessage.setId(messageId);
bizmessage.setCategory(convertCodeToName(messageRaw.getCategory())); bizmessage.setCategory(convertCodeToName(messageRaw.getCategory()));
bizmessage.setContent(fill(dao.getBody(), messageRaw.getBody())); //bizmessage.setContent(fill(dao.getBody(), messageRaw.getBody()));
bizmessage.setUrl(fill(dao.getRouter(), messageRaw.getExtra())); //bizmessage.setUrl(fill(dao.getRouter(), messageRaw.getExtra()));
bizmessage.setParams(toJson(messageRaw.getExtra())); bizmessage.setParams(toJson(messageRaw.getExtra()));
bizmessage.setServicecode(toJson(messageRaw.getServicecode())); bizmessage.setServicecode(toJson(messageRaw.getServicecode()));
bizmessage.setTemplatecode(dao.getCode()); bizmessage.setTemplatecode(dao.getCode());
@ -132,20 +132,20 @@ public class BizMessageProducerServiceImpl implements BizMessageProducerService
* @param body * @param body
* @return * @return
*/ */
private String fill(String tempalte, Map<String, Object> map) { // private String fill(String tempalte, Map<String, Object> map) {
return Optional.ofNullable(tempalte).map(source -> { // return Optional.ofNullable(tempalte).map(source -> {
log.debug("message body tempalte: {}", tempalte); // log.debug("message body tempalte: {}", tempalte);
try (StringWriter out = new StringWriter()) { // try (StringWriter out = new StringWriter()) {
log.debug("template engine receive: {}, generate message: {}", map, out); // log.debug("template engine receive: {}, generate message: {}", map, out);
Velocity.evaluate(new VelocityContext(map), out, "log.chinaunicom", tempalte); // Velocity.evaluate(new VelocityContext(map), out, "log.chinaunicom", tempalte);
//
return out.toString(); // return out.toString();
} catch (IOException e) { // } catch (IOException e) {
log.error(e.getMessage()); // log.error(e.getMessage());
} // }
return StringUtils.EMPTY; // return StringUtils.EMPTY;
}).orElseGet(() -> StringUtils.EMPTY); // }).orElseGet(() -> StringUtils.EMPTY);
} // }
/** /**
* @param obj * @param obj

View File

@ -113,7 +113,7 @@ public class BizShortMessageServiceImpl extends BaseServiceImpl<BizShortMessageM
smsCheckRequest.setBizSn(value.toString()); smsCheckRequest.setBizSn(value.toString());
//生成签名 //生成签名
byte[] signByte = SignUtil.sign(privateKey,value.toString().getBytes(StandardCharsets.UTF_8)); byte[] signByte = SignUtil.sign(privateKey,value.toString().getBytes(StandardCharsets.UTF_8));
String sign = com.cuca.bouncycastle.util.encoders.Base64.toBase64String(signByte); String sign = null;//com.cuca.bouncycastle.util.encoders.Base64.toBase64String(signByte);
smsCheckRequest.setSign(sign); smsCheckRequest.setSign(sign);
//手机号 //手机号
smsCheckRequest.setMobile(mobile); smsCheckRequest.setMobile(mobile);

View File

@ -1,15 +1,15 @@
package com.chinaunicom.mall.ebtp.extend.shortmessage.utils; package com.chinaunicom.mall.ebtp.extend.shortmessage.utils;
import com.cuca.security.algorithm.impl.soft.SoftSM2; //import com.cuca.security.algorithm.impl.soft.SoftSM2;
import com.cuca.security.soft.sm2.SM2PrivateKey; //import com.cuca.security.soft.sm2.SM2PrivateKey;
import com.cuca.security.util.KeyFromDER; //import com.cuca.security.util.KeyFromDER;
/** /**
* 签名生成演示方法 * 签名生成演示方法
*/ */
public class SignUtil { public class SignUtil {
private static final SoftSM2 SM2 = new SoftSM2(); // private static final SoftSM2 SM2 = new SoftSM2();
private static final String SIGN_ALG = "SM3withSM2"; private static final String SIGN_ALG = "SM3withSM2";
/** /**
@ -19,7 +19,7 @@ public class SignUtil {
* @return 签名值 * @return 签名值
*/ */
public static byte[] sign(String priKey, byte[] inData) { public static byte[] sign(String priKey, byte[] inData) {
SM2PrivateKey privateKey = KeyFromDER.getSM2PrivateKey("", priKey); // SM2PrivateKey privateKey = KeyFromDER.getSM2PrivateKey("", priKey);
return SM2.externalSign(SIGN_ALG, privateKey, inData); return null;//SM2.externalSign(SIGN_ALG, privateKey, inData);
} }
} }

View File

@ -16,10 +16,10 @@ import com.chinaunicom.mall.ebtp.extend.signature.entity.ExpertSignature;
import com.chinaunicom.mall.ebtp.extend.signature.service.ExpertSignatureService; import com.chinaunicom.mall.ebtp.extend.signature.service.ExpertSignatureService;
import com.deepoove.poi.XWPFTemplate; import com.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.data.PictureRenderData; import com.deepoove.poi.data.PictureRenderData;
import com.spire.doc.Document; //import com.spire.doc.Document;
import com.spire.doc.DocumentObject; //import com.spire.doc.DocumentObject;
import com.spire.doc.FileFormat; //import com.spire.doc.FileFormat;
import com.spire.doc.Section; //import com.spire.doc.Section;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
@ -100,46 +100,47 @@ public class ExpertSignatureServiceImpl implements ExpertSignatureService {
* @throws IOException * @throws IOException
*/ */
private byte[] mergeWord(InputStream source, InputStream addObj, String path) throws IOException { private byte[] mergeWord(InputStream source, InputStream addObj, String path) throws IOException {
Document d1 = new Document(source); // Document d1 = new Document(source);
Document d2 = new Document(addObj); // Document d2 = new Document(addObj);
//
//获取文档1的最后一节 // //获取文档1的最后一节
Section lastsec = d1.getLastSection(); // Section lastsec = d1.getLastSection();
//
//遍历文档2的所有段落内容添加到文档1 // //遍历文档2的所有段落内容添加到文档1
for (Section section : (Iterable<Section>) d2.getSections()) { // for (Section section : (Iterable<Section>) d2.getSections()) {
for (DocumentObject obj : (Iterable<DocumentObject>) section.getBody().getChildObjects() // for (DocumentObject obj : (Iterable<DocumentObject>) section.getBody().getChildObjects()
) { // ) {
lastsec.getBody().getChildObjects().add(obj.deepClone()); // lastsec.getBody().getChildObjects().add(obj.deepClone());
} // }
} // }
//
//保存合并后的文档 // //保存合并后的文档
d1.saveToFile(path + "merged.docx", FileFormat.Docx_2010); // d1.saveToFile(path + "merged.docx", FileFormat.Docx_2010);
//
//转为pdf // //转为pdf
long l = System.currentTimeMillis(); // long l = System.currentTimeMillis();
if (!getLicense()) { // if (!getLicense()) {
return null; // return null;
} // }
//
File f = new File(path + "merged.pdf"); // File f = new File(path + "merged.pdf");
//
FontSettings.getDefaultInstance().setFontsFolder(fontAddress, true); // FontSettings.getDefaultInstance().setFontsFolder(fontAddress, true);
try (FileOutputStream fos = new FileOutputStream(f);) { // try (FileOutputStream fos = new FileOutputStream(f);) {
com.aspose.words.Document doc = new com.aspose.words.Document(path + "merged.docx"); // com.aspose.words.Document doc = new com.aspose.words.Document(path + "merged.docx");
doc.save(fos, SaveFormat.PDF); // doc.save(fos, SaveFormat.PDF);
} catch (Exception e) { // } catch (Exception e) {
log.info(ExceptionUtil.stacktraceToString(e)); // log.info(ExceptionUtil.stacktraceToString(e));
} finally { // } finally {
source.close(); // source.close();
addObj.close(); // addObj.close();
} // }
//
long l1 = System.currentTimeMillis(); // long l1 = System.currentTimeMillis();
log.info(" ======= " + (l1 - l) + " ======= "); // log.info(" ======= " + (l1 - l) + " ======= ");
//
return IOUtils.toByteArray(new FileInputStream(f)); // return IOUtils.toByteArray(new FileInputStream(f));
return null;
} }
private boolean getLicense() { private boolean getLicense() {

View File

@ -2,50 +2,50 @@ server:
port: 18018 port: 18018
servlet: servlet:
context-path: / context-path: /
seata: seata:
service: service:
vgroup-mapping: vgroup-mapping:
biz-service-ebtp-extend-service-group: default biz-service-ebtp-extend-service-group: default
grouplist: grouplist:
default: 10.242.37.148:18035 default: 10.242.37.148:18035
#registry: #registry:
# type: eureka # type: eureka
# eureka: # eureka:
# serviceUrl: http://10.242.37.148:5001/eureka,http://10.242.37.148:5002/eureka,http://10.242.37.148:5003/eureka # serviceUrl: http://10.242.37.148:5001/eureka,http://10.242.37.148:5002/eureka,http://10.242.37.148:5003/eureka
# 对应 apollo 配置中心的应用名 # 对应 apollo 配置中心的应用名
app: app:
id: biz-service-ebtp-extend id: biz-service-ebtp-extend
# Apollo 配置信息 # Apollo 配置信息
apollo: apollo:
meta: http://10.242.37.148:6001/ meta: http://localhost:8070
bootstrap: bootstrap:
namespace: application namespace: application
enabled: true enabled: true
eagerLoad: eagerLoad:
enabled: true enabled: true
spring: spring:
aop: aop:
auto: true #开启spring的aop配置 auto: true #开启spring的aop配置
proxy-target-class: true proxy-target-class: true
application: application:
name: biz-service-ebtp-extend name: biz-service-ebtp-extend
shardingsphere: shardingsphere:
datasource: datasource:
names: ds0 names: ds0
ds0: ds0:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
username: mall username: root
password: unicom password: Unicom@2024
jdbc-url: jdbc:mysql://10.125.160.26:3306/ebtp_mall_extend?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true jdbc-url: jdbc:mysql://59.110.10.99:53306/ebtp_mall_extend?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
url: jdbc:mysql://10.125.160.26:3306/ebtp_mall_extend?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true url: jdbc:mysql://59.110.10.99:53306/ebtp_mall_extend?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
filters: stat,wall,log4j filters: stat,wall,log4j
maxActive: 20 maxActive: 20
initialSize: 1 initialSize: 1
@ -69,22 +69,22 @@ spring:
time-zone: GMT+8 time-zone: GMT+8
serialization: serialization:
write-dates-as-timestamps: false write-dates-as-timestamps: false
# 天宫Kafka增加了安全认证需要配置安全属性 # 天宫Kafka增加了安全认证需要配置安全属性
kafka: kafka:
bootstrap-servers: 10.125.164.192:32005,10.125.164.193:32005,10.125.164.194:32005 bootstrap-servers: 10.125.164.192:32005,10.125.164.193:32005,10.125.164.194:32005
template: template:
default-topic: jl_test default-topic: jl_test
# 生产者配置参数 # 生产者配置参数
producer: producer:
client-id: core-service-ebtp-crypt client-id: core-service-ebtp-crypt
properties: properties:
security.protocol: SASL_PLAINTEXT security.protocol: SASL_PLAINTEXT
sasl.mechanism: SCRAM-SHA-256 sasl.mechanism: SCRAM-SHA-256
sasl.jaas.config: org.apache.kafka.common.security.scram.ScramLoginModule required username="jltest" password="Unicom#123"; sasl.jaas.config: org.apache.kafka.common.security.scram.ScramLoginModule required username="jltest" password="Unicom#123";
# 消费者配置参数 # 消费者配置参数
consumer: consumer:
group-id: core-service-ebtp-crypt-consumer group-id: core-service-ebtp-crypt-consumer
auto-offset-reset: latest auto-offset-reset: latest
@ -92,19 +92,25 @@ spring:
security.protocol: SASL_PLAINTEXT security.protocol: SASL_PLAINTEXT
sasl.mechanism: SCRAM-SHA-256 sasl.mechanism: SCRAM-SHA-256
sasl.jaas.config: org.apache.kafka.common.security.scram.ScramLoginModule required username="jltest" password="Unicom#123"; sasl.jaas.config: org.apache.kafka.common.security.scram.ScramLoginModule required username="jltest" password="Unicom#123";
# 天宫 redis 需要使用哨兵进行访问 # 天宫 redis 需要使用哨兵进行访问
redis: redis:
sentinel: sentinel:
master: eshop-redis master: eshop-redis
nodes: 10.125.164.124:32718, 10.125.164.118:32716, 10.125.164.121:32716 # nodes: 10.125.164.124:32718, 10.125.164.118:32716, 10.125.164.121:32716
password: Unicom#135 nodes: localhost:6379
# password: Unicom#135
database:
idempotent: 1
sharding: 1
cache: 1
userinfo: 1
# 天宫Eureka配置 # 天宫Eureka配置
eureka: eureka:
client: client:
service-url: service-url:
defaultZone: http://eureka-1-svc:8080/eureka, http://eureka-2-svc:8080/eureka, http://eureka-3-svc:8080/eureka # defaultZone: http://eureka-1-svc:8080/eureka, http://eureka-2-svc:8080/eureka, http://eureka-3-svc:8080/eureka
defaultZone: http://localhost:8080/eureka/
instance: instance:
prefer-ip-address: true prefer-ip-address: true
instance-id: http://10.242.37.148:${server.port} instance-id: http://10.242.37.148:${server.port}
@ -151,13 +157,13 @@ hystrix:
circuitBreaker: circuitBreaker:
sleepWindowInMilliseconds: 20000 sleepWindowInMilliseconds: 20000
forceClosed: true forceClosed: true
ribbon: ribbon:
ReadTimeout: 20000 #请求处理的超时时间 ReadTimeout: 20000 #请求处理的超时时间
ConnectTimeout: 20000 #请求连接超时时间 ConnectTimeout: 20000 #请求连接超时时间
MaxAutoRetries: 0 #对当前实例的重试次数 MaxAutoRetries: 0 #对当前实例的重试次数
MaxAutoRetriesNextServer: 1 #切换实例的重试次数 1 MaxAutoRetriesNextServer: 1 #切换实例的重试次数 1
mconfig: mconfig:
workerId: 1 workerId: 1
datacenterId: 1 datacenterId: 1
@ -180,7 +186,7 @@ document:
# 用户暴露给 prometheus 的健康数据 # 用户暴露给 prometheus 的健康数据
management: management:
endpoints: endpoints:
web: web:

View File

@ -2,12 +2,95 @@
app: app:
id: biz-service-ebtp-extend id: biz-service-ebtp-extend
spring:
profiles:
active: dev
# Apollo 配置信息 # Apollo 配置信息
apollo: apollo:
bootstrap: bootstrap:
enabled: true enabled: true
namespace: application namespace: application
jasypt: client:
encryptor: clientHttpUrl: 1
bean: stringEncryptor
user:
auth:
resource:
serviceId:mall-auth: 1
unifast:
sso:
getCode:
url: 1
redirectUrl: 1
clientId: 1
public-key: 1
jury:
loginCheck:
privateKey: 1
message:
privateKey: 1
callBackUrl: 1
appCode: 1
checkVerifycodeHttpUrl: 1
sendVerifycodeHttpUrl: 1
oss:
bucketName: 1
accessKeySecret: 1
accessKeyId: 1
endpoint: 1
KingSoftWps:
downloadUrl: 1
downloadUrl2: 1
publicKey: 1
privateKey: 1
host: 1
time_limit: 1
kswpsurl: 1
kswpsurl-preview: 1
tempDocFileId: 1
mconfig:
wps:
bss:
appTokenUrl: 1
previewUrl: 1
editUrl: 1
url:
appTokenUrl: 1
previewUrl: 1
downFileUrl: 1
editUrl: 1
bssAppId: 1
bssAppSecret: 1
bssAppUrl: 1
appid: 1
appKey: 1
bss:
app-url: 1
app-url-test: 1
app-secret: 1
app-id: 1
feign:
name:
usercenter: 1
tender: 1
rsms: 1
strategy-center: 1
resps: 1
project: 2
process: 1
notification: 1
documentcenter: 2
#jasypt:
# encryptor:
# bean: stringEncryptor