上传代码

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

View File

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

View File

@ -113,7 +113,7 @@ public class BizShortMessageServiceImpl extends BaseServiceImpl<BizShortMessageM
smsCheckRequest.setBizSn(value.toString());
//生成签名
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.setMobile(mobile);

View File

@ -1,15 +1,15 @@
package com.chinaunicom.mall.ebtp.extend.shortmessage.utils;
import com.cuca.security.algorithm.impl.soft.SoftSM2;
import com.cuca.security.soft.sm2.SM2PrivateKey;
import com.cuca.security.util.KeyFromDER;
//import com.cuca.security.algorithm.impl.soft.SoftSM2;
//import com.cuca.security.soft.sm2.SM2PrivateKey;
//import com.cuca.security.util.KeyFromDER;
/**
* 签名生成演示方法
*/
public class SignUtil {
private static final SoftSM2 SM2 = new SoftSM2();
// private static final SoftSM2 SM2 = new SoftSM2();
private static final String SIGN_ALG = "SM3withSM2";
/**
@ -19,7 +19,7 @@ public class SignUtil {
* @return 签名值
*/
public static byte[] sign(String priKey, byte[] inData) {
SM2PrivateKey privateKey = KeyFromDER.getSM2PrivateKey("", priKey);
return SM2.externalSign(SIGN_ALG, privateKey, inData);
// SM2PrivateKey privateKey = KeyFromDER.getSM2PrivateKey("", priKey);
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.deepoove.poi.XWPFTemplate;
import com.deepoove.poi.data.PictureRenderData;
import com.spire.doc.Document;
import com.spire.doc.DocumentObject;
import com.spire.doc.FileFormat;
import com.spire.doc.Section;
//import com.spire.doc.Document;
//import com.spire.doc.DocumentObject;
//import com.spire.doc.FileFormat;
//import com.spire.doc.Section;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils;
@ -100,46 +100,47 @@ public class ExpertSignatureServiceImpl implements ExpertSignatureService {
* @throws IOException
*/
private byte[] mergeWord(InputStream source, InputStream addObj, String path) throws IOException {
Document d1 = new Document(source);
Document d2 = new Document(addObj);
//获取文档1的最后一节
Section lastsec = d1.getLastSection();
//遍历文档2的所有段落内容添加到文档1
for (Section section : (Iterable<Section>) d2.getSections()) {
for (DocumentObject obj : (Iterable<DocumentObject>) section.getBody().getChildObjects()
) {
lastsec.getBody().getChildObjects().add(obj.deepClone());
}
}
//保存合并后的文档
d1.saveToFile(path + "merged.docx", FileFormat.Docx_2010);
//转为pdf
long l = System.currentTimeMillis();
if (!getLicense()) {
return null;
}
File f = new File(path + "merged.pdf");
FontSettings.getDefaultInstance().setFontsFolder(fontAddress, true);
try (FileOutputStream fos = new FileOutputStream(f);) {
com.aspose.words.Document doc = new com.aspose.words.Document(path + "merged.docx");
doc.save(fos, SaveFormat.PDF);
} catch (Exception e) {
log.info(ExceptionUtil.stacktraceToString(e));
} finally {
source.close();
addObj.close();
}
long l1 = System.currentTimeMillis();
log.info(" ======= " + (l1 - l) + " ======= ");
return IOUtils.toByteArray(new FileInputStream(f));
// Document d1 = new Document(source);
// Document d2 = new Document(addObj);
//
// //获取文档1的最后一节
// Section lastsec = d1.getLastSection();
//
// //遍历文档2的所有段落内容添加到文档1
// for (Section section : (Iterable<Section>) d2.getSections()) {
// for (DocumentObject obj : (Iterable<DocumentObject>) section.getBody().getChildObjects()
// ) {
// lastsec.getBody().getChildObjects().add(obj.deepClone());
// }
// }
//
// //保存合并后的文档
// d1.saveToFile(path + "merged.docx", FileFormat.Docx_2010);
//
// //转为pdf
// long l = System.currentTimeMillis();
// if (!getLicense()) {
// return null;
// }
//
// File f = new File(path + "merged.pdf");
//
// FontSettings.getDefaultInstance().setFontsFolder(fontAddress, true);
// try (FileOutputStream fos = new FileOutputStream(f);) {
// com.aspose.words.Document doc = new com.aspose.words.Document(path + "merged.docx");
// doc.save(fos, SaveFormat.PDF);
// } catch (Exception e) {
// log.info(ExceptionUtil.stacktraceToString(e));
// } finally {
// source.close();
// addObj.close();
// }
//
// long l1 = System.currentTimeMillis();
// log.info(" ======= " + (l1 - l) + " ======= ");
//
// return IOUtils.toByteArray(new FileInputStream(f));
return null;
}
private boolean getLicense() {

View File

@ -2,50 +2,50 @@ server:
port: 18018
servlet:
context-path: /
seata:
service:
vgroup-mapping:
biz-service-ebtp-extend-service-group: default
grouplist:
default: 10.242.37.148:18035
#registry:
# type: eureka
# eureka:
# serviceUrl: http://10.242.37.148:5001/eureka,http://10.242.37.148:5002/eureka,http://10.242.37.148:5003/eureka
# 对应 apollo 配置中心的应用名
app:
id: biz-service-ebtp-extend
# Apollo 配置信息
apollo:
meta: http://10.242.37.148:6001/
meta: http://localhost:8070
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: mall
password: unicom
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
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
username: root
password: Unicom@2024
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://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
maxActive: 20
initialSize: 1
@ -69,22 +69,22 @@ spring:
time-zone: GMT+8
serialization:
write-dates-as-timestamps: false
# 天宫Kafka增加了安全认证需要配置安全属性
# 天宫Kafka增加了安全认证需要配置安全属性
kafka:
bootstrap-servers: 10.125.164.192:32005,10.125.164.193:32005,10.125.164.194:32005
template:
default-topic: jl_test
# 生产者配置参数
producer:
client-id: core-service-ebtp-crypt
properties:
properties:
security.protocol: SASL_PLAINTEXT
sasl.mechanism: SCRAM-SHA-256
sasl.jaas.config: org.apache.kafka.common.security.scram.ScramLoginModule required username="jltest" password="Unicom#123";
# 消费者配置参数
# 消费者配置参数
consumer:
group-id: core-service-ebtp-crypt-consumer
auto-offset-reset: latest
@ -92,19 +92,25 @@ spring:
security.protocol: SASL_PLAINTEXT
sasl.mechanism: SCRAM-SHA-256
sasl.jaas.config: org.apache.kafka.common.security.scram.ScramLoginModule required username="jltest" password="Unicom#123";
# 天宫 redis 需要使用哨兵进行访问
redis:
sentinel:
master: eshop-redis
nodes: 10.125.164.124:32718, 10.125.164.118:32716, 10.125.164.121:32716
password: Unicom#135
# nodes: 10.125.164.124:32718, 10.125.164.118:32716, 10.125.164.121:32716
nodes: localhost:6379
# password: Unicom#135
database:
idempotent: 1
sharding: 1
cache: 1
userinfo: 1
# 天宫Eureka配置
eureka:
client:
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:
prefer-ip-address: true
instance-id: http://10.242.37.148:${server.port}
@ -151,13 +157,13 @@ hystrix:
circuitBreaker:
sleepWindowInMilliseconds: 20000
forceClosed: true
ribbon:
ReadTimeout: 20000 #请求处理的超时时间
ConnectTimeout: 20000 #请求连接超时时间
MaxAutoRetries: 0 #对当前实例的重试次数
MaxAutoRetriesNextServer: 1 #切换实例的重试次数 1
mconfig:
workerId: 1
datacenterId: 1
@ -180,7 +186,7 @@ document:
# 用户暴露给 prometheus 的健康数据
# 用户暴露给 prometheus 的健康数据
management:
endpoints:
web:

View File

@ -2,12 +2,95 @@
app:
id: biz-service-ebtp-extend
spring:
profiles:
active: dev
# Apollo 配置信息
apollo:
bootstrap:
enabled: true
namespace: application
jasypt:
encryptor:
bean: stringEncryptor
client:
clientHttpUrl: 1
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