Merge remote-tracking branch 'origin/release/3.0' into release/3.0

This commit is contained in:
shahaibo
2024-07-11 15:54:49 +08:00
12 changed files with 96 additions and 27 deletions

View File

@@ -12,16 +12,16 @@ public class MQConfig {
// public static final String GENERATE_QUEUE = "generate-queue-test";
// ==================================================================
// public static final String GENERATE_QUEUE = "generate-queue-local";
// public static final String GENERATE_QUEUE = "generate-queue-dev";
public static final String GENERATE_QUEUE = "generate-queue-prod";
// public static final String GENERATE_QUEUE = "generate-queue-prod";
//
// public static final String SR_QUEUE = "SR-queue-local";
public static final String SR_QUEUE = "SR-queue-prod";
// public static final String SR_QUEUE = "SR-queue-prod";
// public static final String SR_QUEUE = "SR-queue-dev";
public static final String SR_QUEUE = "SR-queue-prod";
//
// public static final String SR_RESULT_QUEUE = "SuperResolution-local";
public static final String SR_RESULT_QUEUE = "SuperResolution-prod";
// public static final String SR_RESULT_QUEUE = "SuperResolution-prod";
// public static final String SR_RESULT_QUEUE = "SuperResolution-dev";
public static final String SR_RESULT_QUEUE = "SuperResolution-prod";
//
// public static final String GENERATE_RESULT_QUEUE = "GenerateImage-local";
public static final String GENERATE_RESULT_QUEUE = "GenerateImage-prod";

View File

@@ -27,7 +27,7 @@ public class AliPayTask {
// @Scheduled(cron = "0/30 * * * * ?")
public void orderConfirm(){
log.info("Alipay orderConfirm 被执行......");
// log.info("Alipay orderConfirm 被执行......");
List<OrderInfo> orderInfoList = orderInfoService.getNoPayOrderByDuration(5, PayTypeEnum.ALIPAY.getType());

View File

@@ -26,7 +26,7 @@ public class PaypalTask {
@Scheduled(cron = "0/30 * * * * ?")
public void orderConfirm() throws SerializeException {
log.info("PayPal orderConfirm 被执行......");
// log.info("PayPal orderConfirm 被执行......");
List<OrderInfo> orderInfoList = orderInfoService.getNoPayOrderByDuration(5, PayTypeEnum.PAYPAL.getType());

View File

@@ -1,5 +1,6 @@
package com.ai.da.common.utils;
import cn.hutool.core.io.resource.ClassPathResource;
import com.ai.da.model.dto.AlipayHKParametersDTO;
import com.ai.da.model.dto.AlipayHKRequestDTO;
import com.alibaba.fastjson.JSONObject;
@@ -14,6 +15,7 @@ import org.bouncycastle.crypto.util.PublicKeyFactory;
import org.bouncycastle.openssl.PEMParser;
import org.bouncycastle.util.io.pem.PemObject;
import org.bouncycastle.util.io.pem.PemReader;
import org.jetbrains.annotations.NotNull;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
@@ -165,7 +167,23 @@ public class AlipayHKEncryptionUtil {
* @throws Exception
*/
private static PrivateKey readPrivateKeyFromFile(String filePath) throws Exception {
BufferedReader reader = new BufferedReader(new FileReader(filePath));
ClassPathResource classPathResource = new ClassPathResource(filePath);
InputStream inputstream = classPathResource.getStream();
String privateKeyContent = getString(inputstream);
// 进行 Base64 解码
byte[] privateKeyBytes = Base64.getDecoder().decode(privateKeyContent);
// 根据 PKCS8 格式的私钥字节数组构造私钥对象
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(privateKeyBytes);
return keyFactory.generatePrivate(keySpec);
}
@NotNull
private static String getString(InputStream inputstream) throws IOException {
BufferedReader reader = new BufferedReader(new InputStreamReader(inputstream));
// BufferedReader reader = new BufferedReader(new FileReader(filePath));
StringBuilder keyBuffer = new StringBuilder();
String line;
@@ -180,14 +198,7 @@ public class AlipayHKEncryptionUtil {
.replace("-----BEGIN PRIVATE KEY-----", "")
.replace("-----END PRIVATE KEY-----", "")
.replaceAll("\\s+", ""); // 去除空格、换行等字符
// 进行 Base64 解码
byte[] privateKeyBytes = Base64.getDecoder().decode(privateKeyContent);
// 根据 PKCS8 格式的私钥字节数组构造私钥对象
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(privateKeyBytes);
return keyFactory.generatePrivate(keySpec);
return privateKeyContent;
}
/**
@@ -233,7 +244,7 @@ public class AlipayHKEncryptionUtil {
// 使用 RSA 公钥加密 AES 密钥
String rsaPublicKeyPath = publicKeyPath;
PublicKey publicKey = readPublicKey(new File(rsaPublicKeyPath));
PublicKey publicKey = readPublicKey(rsaPublicKeyPath);
Cipher rsaCipher = Cipher.getInstance("RSA/ECB/PKCS1Padding");
// Cipher rsaCipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
@@ -313,11 +324,14 @@ public class AlipayHKEncryptionUtil {
System.out.println("数字签名验证结果:" + signatureValid);
}
public static PublicKey readPublicKey(File file) throws Exception {
// public static PublicKey readPublicKey(File file) throws Exception {
public static PublicKey readPublicKey(String fileName) throws Exception {
KeyFactory factory = KeyFactory.getInstance("RSA");
try (FileReader keyReader = new FileReader(file);
PemReader pemReader = new PemReader(keyReader)) {
ClassPathResource classPathResource = new ClassPathResource(fileName);
InputStream inputStream = classPathResource.getStream();
BufferedReader fileReader = new BufferedReader(new InputStreamReader(inputStream));
try (PemReader pemReader = new PemReader(fileReader)) {
PemObject pemObject = pemReader.readPemObject();
byte[] content = pemObject.getContent();
@@ -338,8 +352,10 @@ public class AlipayHKEncryptionUtil {
Base64.Decoder decoder = Base64.getDecoder();
// Verify key
try {
ClassPathResource classPathResource = new ClassPathResource(CODPublicKeyPath);
InputStream inputstream = classPathResource.getStream();
// 从指定的路径读取公钥文件
InputStreamReader isrPub = new InputStreamReader(new FileInputStream(CODPublicKeyPath));
InputStreamReader isrPub = new InputStreamReader(inputstream);
PEMParser pemParserPub = new PEMParser(isrPub);
// 使用 PEMParser 解析公钥文件
SubjectPublicKeyInfo pubInfo = (SubjectPublicKeyInfo) pemParserPub.readObject();

View File

@@ -4,10 +4,12 @@ import com.ai.da.mapper.primary.entity.DesignItem;
import com.ai.da.model.dto.DesignSingleDTO;
import com.ai.da.model.dto.DesignSingleIncludeLayersDTO;
import com.ai.da.model.vo.*;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.extension.service.IService;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* 服务类
@@ -51,6 +53,8 @@ public interface DesignItemService extends IService<DesignItem> {
DesignSingleVO designSingleIncludeLayers(DesignSingleIncludeLayersDTO designSingleIncludeLayersDTO);
Map<String, String> setTypeAndUndividedLayer(JSONArray layers);
ComposeLayersVO editLayersPositionAndScale(EditLayersPositionAndScaleVO positionAndScaleVO) throws IOException;
List<DesignItem> selectDesignIdById(List<Long> designItemIdList);

View File

@@ -568,7 +568,8 @@ public class DesignItemServiceImpl extends ServiceImpl<DesignItemMapper, DesignI
});
}
private Map<String, String> setTypeAndUndividedLayer(JSONArray layers){
@Override
public Map<String, String> setTypeAndUndividedLayer(JSONArray layers){
HashMap<String, String> categoryAndLayer = new HashMap<>();
for (int i = 0; i < layers.size(); i++) {
JSONObject jsonObject = layers.getJSONObject(i);

View File

@@ -607,6 +607,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
Map<String, Integer> typePriority = list.stream().collect(Collectors.toMap(d -> d.getImageCategory().split("_")[0],
d -> Math.abs(d.getPriority()),
(existing, replacement) -> replacement));
Map<String, String> typeAndUndividedLayer = designItemService.setTypeAndUndividedLayer(layers);
for (DesignPythonItem detail : item.getItems()) {
if (null == detail) {
continue;
@@ -617,6 +618,7 @@ public class DesignServiceImpl extends ServiceImpl<DesignMapper, Design> impleme
designItemDetail.setDesignItemId(designItemId);
designItemDetail.setCollectionElementId(detail.getElementId());
designItemDetail.setCreateDate(DateUtil.getByTimeZone(timeZone));
designItemDetail.setUndividedLayer(typeAndUndividedLayer.get(designItemDetail.getType().toLowerCase()));
if (SysFileLevel2TypeEnum.BODY.getRealName().equals(detail.getType())) {
designItemDetail.setPath(detail.getBody_path());
//BODY不关联businessId

View File

@@ -42,9 +42,9 @@ alipayHK.merchantId=2088841167357411
alipayHK.segmentId=1771653121
#alipayHK.AESKey=uTEbeOZBgXKbSqGz
alipayHK.AESKey=BwDWX4o7ORUxYwBNjRMAY2unnLkJeACj
alipayHK.rsaPrivateKey=files/Code-Create Limited-2088841167357411-merchant.private.key.txt
alipayHK.rsaPublicKey=files/Code-Create Limited.merchant.aqs.public.key.pem
alipayHK.CODPublicKey=files/COD-public-key.txt
alipayHK.rsaPrivateKey=\\files\\Code-Create Limited-2088841167357411-merchant.private.key.txt
alipayHK.rsaPublicKey=\\files\\Code-Create Limited.merchant.aqs.public.key.pem
alipayHK.CODPublicKey=\\files\\COD-public-key.txt
alipayHK.api.url=https://aqs-api.sandbox-codpayment.com/

View File

@@ -2,7 +2,7 @@
#spring.profiles.active=test
#<23><><EFBFBD><EFBFBD>application-prod<6F>ļ<EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
#spring.profiles.active=prod
spring.profiles.active=prod
#<23><><EFBFBD><EFBFBD>application-dev<65>ļ<EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>)
spring.profiles.active=prod
#spring.profiles.active=dev

View File

@@ -0,0 +1,9 @@
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAymkBAWixxUi9IAeMWgsq
K92AzFbe0qzzYPdkoh15ymL2A5MkYH7asnhFwclgdiFmd9a0TbZP+t/SzWW8UUzN
1pXoEp48R+eguGTt5xkJwb10+H6quVXF/Ezzid5yzVW3dcYRp8qUlFr0XBpvkK9l
FpPzh2+mwVEAsgBMXq/K50ZiX2dlkPZ7ffkVPWaK2ESIo3YgfM6dmiiza0hPWJ35
UgTH5rwJ7vN3IdOJTlkQOvrIrj2ocPcrudeEwqybIbCGhgRBwQSBsXQOO4U//rE4
VU+0LF/3uQgXkvVY1+a1JLiTncZYKGEQ/NtxM+dGtYWV2gPhQRyJ7Z77OX0XCbcn
zwIDAQAB
-----END PUBLIC KEY-----

View File

@@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDD+NUduhLJcb2Z
ryLwtIHdmjfh6Wn73E9umHmdPf6yF7Ib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