Merge remote-tracking branch 'origin/main'

# Conflicts:
#	ccag-tvs-sim/ccag-tvs-sim-biz/src/main/java/com/ccag/utils/Tools.java
This commit is contained in:
2025-10-31 11:48:15 +08:00
8 changed files with 70 additions and 96 deletions

View File

@@ -17,11 +17,6 @@ import java.io.Serializable;
public class ApiResult<T> implements Serializable {
private static final long serialVersionUID = 1L;
// /**
// * 成功标志
// */
// @Schema(description = "成功标志")
// private boolean success = true;
/**
* 返回处理消息
@@ -41,12 +36,6 @@ public class ApiResult<T> implements Serializable {
@Schema(description = "返回数据对象")
private T data;
/**
* 时间戳
*/
// @Schema(description = "时间戳")
// private long timestamp = System.currentTimeMillis();
public ApiResult() {
}

View File

@@ -586,15 +586,6 @@ public class ApprovePostProcessor implements Callable<String> {
}else {
log.error("接收人为空,仿真地图评审通过无法发送消息");
}
} else if (status == 2) {
} else if (status == 3)//评审撤销
{
//delSystemApproveFiles(approvalBean.id,systemMapper);
}
updateTvsResult(String.valueOf(approveId), "仿真地图评审");
return APPROVE_SUCCESS;
@@ -887,10 +878,6 @@ public class ApprovePostProcessor implements Callable<String> {
if (status == 4) {
//评审通过
String approveInfo = approvalBean.approveInfo;
JSONObject jsonObject = JSON.parseObject(approveInfo);
} else if (status == 5) {
//评审不通过
}
}
@@ -910,10 +897,6 @@ public class ApprovePostProcessor implements Callable<String> {
String description = jsonObject.getString(DESCRIPTION);
projectService.updateProjectLoadcaseInfo(id, loadcaseName, beginTime, endTime, days, exeStatus, description, idCode);
projectService.updateProjectLoadcaseMember(id, userId, userName, idCode);
} else if (status == 2) {
} else if (status == 3)//评审撤销
{
}
}

View File

@@ -40,7 +40,6 @@ public class PushLoadcaseRunResultThread implements Runnable {
private final SvsService svsService;
private final AttachmentGrpcClientService attachmentGrpcClientService;
private final DataService dataService;
private final String UN_PUSH_STATUS = "0";
private final String SUCCESS_PUSH_STATUS = "1";
private final String FAILED_PUSH_STATUS = "2";
@@ -56,7 +55,6 @@ public class PushLoadcaseRunResultThread implements Runnable {
private static final String CREATE_USER = "createUser";
private static final String TARGET_CODE = "targetCode";
private static final String INPUT_FORM_ID = "inputFormId";
@Override
@Transactional(propagation = Propagation.REQUIRES_NEW)

View File

@@ -29,7 +29,7 @@ import static com.ccag.thread.ApprovePostProcessor.APPROVE_SUCCESS;
@Slf4j
public class PushProjectThread implements Callable<String> {
private final UpdateProjectVersionReq req;
private final UpdateProjectVersionReq updateProjectVersionReq;
private final SvsService svsService;
private final User user;
@@ -40,9 +40,9 @@ public class PushProjectThread implements Callable<String> {
private final List<JSONObject> inputFormParams;
private final List<String> workNodeList;
public PushProjectThread(UpdateProjectVersionReq req, SvsService svsService, User user, int version, long approveId,
public PushProjectThread(UpdateProjectVersionReq updateProjectVersionReq, SvsService svsService, User user, int version, long approveId,
List<JSONObject> memberJsons, ProjectMapper projectMapper, List<JSONObject> inputFormParams,List<String> workNodeList) {
this.req = req;
this.updateProjectVersionReq = updateProjectVersionReq;
this.svsService = svsService;
this.user = user;
this.version = version;
@@ -60,28 +60,28 @@ public class PushProjectThread implements Callable<String> {
log.info("PushProjectThread用户信息为{}",user);
TenantContext.setTenant(user.getTenantId());
log.info("TenantContext{}",TenantContext.getTenant());
log.info("推送项目策划记录addLoadcaseList为{}",req.getAddLoadcaseList());
log.info("推送项目策划记录updateLoadcaseList为{}",req.getUpdateLoadcaseList());
log.info("推送项目策划记录delLoadcaseList为{}",req.getDelLoadcaseList());
log.info("推送项目策划记录addLoadcaseList为{}",updateProjectVersionReq.getAddLoadcaseList());
log.info("推送项目策划记录updateLoadcaseList为{}",updateProjectVersionReq.getUpdateLoadcaseList());
log.info("推送项目策划记录delLoadcaseList为{}",updateProjectVersionReq.getDelLoadcaseList());
ProjectPlanRecord planRecord = new ProjectPlanRecord();
planRecord.setApproveId(approveId);
planRecord.setProjectId(req.getProjectId());
planRecord.setUpdateContent(req.getUpdateContent());
planRecord.setReason(req.getReason());
planRecord.setProjectId(updateProjectVersionReq.getProjectId());
planRecord.setUpdateContent(updateProjectVersionReq.getUpdateContent());
planRecord.setReason(updateProjectVersionReq.getReason());
String reviewTime = DateUtils.formatDate(new Date(), "yyyy-MM-dd HH:mm:ss");
planRecord.setReviewTime(reviewTime);
planRecord.setAddMsg(req.getAddMsg());
planRecord.setUpdateMsg(req.getUpdateMsg());
planRecord.setDelMsg(req.getDelMsg());
planRecord.setAddMsg(updateProjectVersionReq.getAddMsg());
planRecord.setUpdateMsg(updateProjectVersionReq.getUpdateMsg());
planRecord.setDelMsg(updateProjectVersionReq.getDelMsg());
planRecord.setVersion(String.valueOf(version));
planRecord.setCreatorName(user.getName());
planRecord.setCreateBy(user.getJobNumber());
planRecord.setTenantId(user.getTenantId());
projectMapper.addProjectPlanRecord(planRecord);
JSONObject planRecordJson = new JSONObject();
planRecordJson.put("projectId", req.getProjectId());
planRecordJson.put("updateContent", req.getUpdateContent());
planRecordJson.put("reason", req.getReason());
planRecordJson.put("projectId", updateProjectVersionReq.getProjectId());
planRecordJson.put("updateContent", updateProjectVersionReq.getUpdateContent());
planRecordJson.put("reason", updateProjectVersionReq.getReason());
planRecordJson.put("reviewTime", reviewTime);
planRecordJson.put("resultList", memberJsons);
planRecordJson.put("version", version);
@@ -92,29 +92,29 @@ public class PushProjectThread implements Callable<String> {
log.info("推送项目策划记录成功");
log.info("开始推送项目数据");
List<PushComponentAndDisciplineReq> componentAndDisciplineReqs = new ArrayList<>();
if (!CollectionUtils.isEmpty(req.getAddComponentList())) {
for (ProjectComponentBean componentBean : req.getAddComponentList()) {
if (!CollectionUtils.isEmpty(updateProjectVersionReq.getAddComponentList())) {
for (ProjectComponentBean componentBean : updateProjectVersionReq.getAddComponentList()) {
PushComponentAndDisciplineReq req = svsService.getComponentPushInfo(componentBean, version);
req.setOperation("A");
componentAndDisciplineReqs.add(req);
}
}
if (!CollectionUtils.isEmpty(req.getUpdateComponentList())) {
for (ProjectComponentBean componentBean : req.getUpdateComponentList()) {
if (!CollectionUtils.isEmpty(updateProjectVersionReq.getUpdateComponentList())) {
for (ProjectComponentBean componentBean : updateProjectVersionReq.getUpdateComponentList()) {
PushComponentAndDisciplineReq req = svsService.getComponentPushInfo(componentBean, version);
req.setOperation("M");
componentAndDisciplineReqs.add(req);
}
}
if (!CollectionUtils.isEmpty(req.getAddDisciplineList())) {
for (ProjectDisciplineBean disciplineBean : req.getAddDisciplineList()) {
if (!CollectionUtils.isEmpty(updateProjectVersionReq.getAddDisciplineList())) {
for (ProjectDisciplineBean disciplineBean : updateProjectVersionReq.getAddDisciplineList()) {
PushComponentAndDisciplineReq req = svsService.getDisciplinePushInfo(disciplineBean, version);
req.setOperation("A");
componentAndDisciplineReqs.add(req);
}
}
if (!CollectionUtils.isEmpty(req.getUpdateDisciplineList())) {
for (ProjectDisciplineBean disciplineBean : req.getUpdateDisciplineList()) {
if (!CollectionUtils.isEmpty(updateProjectVersionReq.getUpdateDisciplineList())) {
for (ProjectDisciplineBean disciplineBean : updateProjectVersionReq.getUpdateDisciplineList()) {
PushComponentAndDisciplineReq req = svsService.getDisciplinePushInfo(disciplineBean, version);
req.setOperation("M");
componentAndDisciplineReqs.add(req);
@@ -142,15 +142,15 @@ public class PushProjectThread implements Callable<String> {
}
List<PushLoadcaseReq> loadcaseReqs = new ArrayList<>();
if (!CollectionUtils.isEmpty(req.getAddLoadcaseList())) {
for (ProjectLoadcaseBean loadcaseBean : req.getAddLoadcaseList()) {
if (!CollectionUtils.isEmpty(updateProjectVersionReq.getAddLoadcaseList())) {
for (ProjectLoadcaseBean loadcaseBean : updateProjectVersionReq.getAddLoadcaseList()) {
PushLoadcaseReq req = svsService.getLoadcasePushInfo(loadcaseBean, version);
req.setOperation("A");
loadcaseReqs.add(req);
}
}
if (!CollectionUtils.isEmpty(req.getUpdateLoadcaseList())) {
for (ProjectLoadcaseBean loadcaseBean : req.getUpdateLoadcaseList()) {
if (!CollectionUtils.isEmpty(updateProjectVersionReq.getUpdateLoadcaseList())) {
for (ProjectLoadcaseBean loadcaseBean : updateProjectVersionReq.getUpdateLoadcaseList()) {
PushLoadcaseReq req = svsService.getLoadcasePushInfo(loadcaseBean, version);
req.setOperation("M");
loadcaseReqs.add(req);
@@ -161,8 +161,8 @@ public class PushProjectThread implements Callable<String> {
int count = 0;
String eachProjectNode;
if (workNodeList != null && workNodeList.isEmpty()) {
log.error("推送失败当前项目id:{}在TVS中不存在节点信息",req.getProjectId());
throw new JeecgBootException("推送失败当前项目id:"+req.getProjectId()+"在TVS中不存在节点信息");
log.error("推送失败当前项目id:{}在TVS中不存在节点信息",updateProjectVersionReq.getProjectId());
throw new JeecgBootException("推送失败当前项目id:"+updateProjectVersionReq.getProjectId()+"在TVS中不存在节点信息");
}
for (PushLoadcaseReq req : loadcaseReqs) {
log.info("workNodeList{}",workNodeList);
@@ -197,15 +197,15 @@ public class PushProjectThread implements Callable<String> {
}
List<PushPerformanceReq> performanceReqs = new ArrayList<>();
if (!CollectionUtils.isEmpty(req.getAddPerformanceList())) {
for (LoadcasePerformanceBean performanceBean : req.getAddPerformanceList()) {
if (!CollectionUtils.isEmpty(updateProjectVersionReq.getAddPerformanceList())) {
for (LoadcasePerformanceBean performanceBean : updateProjectVersionReq.getAddPerformanceList()) {
PushPerformanceReq req = svsService.getPerformancePushInfo(performanceBean, version);
req.setOperation("A");
performanceReqs.add(req);
}
}
if (!CollectionUtils.isEmpty(req.getUpdatePerformanceList())) {
for (LoadcasePerformanceBean performanceBean : req.getUpdatePerformanceList()) {
if (!CollectionUtils.isEmpty(updateProjectVersionReq.getUpdatePerformanceList())) {
for (LoadcasePerformanceBean performanceBean : updateProjectVersionReq.getUpdatePerformanceList()) {
PushPerformanceReq req = svsService.getPerformancePushInfo(performanceBean, version);
req.setOperation("M");
performanceReqs.add(req);
@@ -233,8 +233,8 @@ public class PushProjectThread implements Callable<String> {
}
performanceReqs.clear();
if (!CollectionUtils.isEmpty(req.getDelPerformanceList())) {
for (LoadcasePerformanceBean performanceBean : req.getDelPerformanceList()) {
if (!CollectionUtils.isEmpty(updateProjectVersionReq.getDelPerformanceList())) {
for (LoadcasePerformanceBean performanceBean : updateProjectVersionReq.getDelPerformanceList()) {
PushPerformanceReq req = svsService.getPerformancePushInfo(performanceBean, null);
req.setOperation("R");
performanceReqs.add(req);
@@ -262,8 +262,8 @@ public class PushProjectThread implements Callable<String> {
}
loadcaseReqs.clear();
if (!CollectionUtils.isEmpty(req.getDelLoadcaseList())) {
for (ProjectLoadcaseBean loadcaseBean : req.getDelLoadcaseList()) {
if (!CollectionUtils.isEmpty(updateProjectVersionReq.getDelLoadcaseList())) {
for (ProjectLoadcaseBean loadcaseBean : updateProjectVersionReq.getDelLoadcaseList()) {
PushLoadcaseReq req = svsService.getLoadcasePushInfo(loadcaseBean, version);
req.setOperation("R");
loadcaseReqs.add(req);
@@ -271,8 +271,8 @@ public class PushProjectThread implements Callable<String> {
}
if (!CollectionUtils.isEmpty(loadcaseReqs)) {
if (workNodeList != null && workNodeList.isEmpty()) {
log.error("推送失败当前项目id:{}在TVS中不存在节点信息",req.getProjectId());
throw new JeecgBootException("推送失败当前项目id:"+req.getProjectId()+"在TVS中不存在节点信息");
log.error("推送失败当前项目id:{}在TVS中不存在节点信息",updateProjectVersionReq.getProjectId());
throw new JeecgBootException("推送失败当前项目id:"+updateProjectVersionReq.getProjectId()+"在TVS中不存在节点信息");
}
List<PushLoadcaseReq> temReqs = new ArrayList<>();
int count = 0;
@@ -307,15 +307,15 @@ public class PushProjectThread implements Callable<String> {
}
componentAndDisciplineReqs.clear();
if (!CollectionUtils.isEmpty(req.getDelDisciplineList())) {
for (ProjectDisciplineBean disciplineBean : req.getDelDisciplineList()) {
if (!CollectionUtils.isEmpty(updateProjectVersionReq.getDelDisciplineList())) {
for (ProjectDisciplineBean disciplineBean : updateProjectVersionReq.getDelDisciplineList()) {
PushComponentAndDisciplineReq req = svsService.getDisciplinePushInfo(disciplineBean, version);
req.setOperation("R");
componentAndDisciplineReqs.add(req);
}
}
if (!CollectionUtils.isEmpty(req.getDelComponentList())) {
for (ProjectComponentBean componentBean : req.getDelComponentList()) {
if (!CollectionUtils.isEmpty(updateProjectVersionReq.getDelComponentList())) {
for (ProjectComponentBean componentBean : updateProjectVersionReq.getDelComponentList()) {
PushComponentAndDisciplineReq req = svsService.getComponentPushInfo(componentBean, version);
req.setOperation("R");
componentAndDisciplineReqs.add(req);

View File

@@ -1,5 +1,6 @@
package com.ccag.utils;
import cn.hutool.core.io.IORuntimeException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.mock.web.MockMultipartFile;
@@ -161,7 +162,7 @@ public class FilesUtil {
}
} catch (IOException e) {
log.error("zip files failed", e);
throw new RuntimeException(e);
throw new IORuntimeException(e);
}
// 不再需要finally块所有资源会自动关闭
}
@@ -202,14 +203,14 @@ public class FilesUtil {
// 读文件
public static String readFileContent(String filePath, String newString) {
StringBuffer bufAll = new StringBuffer();// 保存修改过后的所有内容
StringBuilder bufAll = new StringBuilder();// 保存修改过后的所有内容
boolean isChange = false;
try(BufferedReader br = new BufferedReader(
new InputStreamReader(new FileInputStream(filePath), StandardCharsets.UTF_8))) {
String line = null;
while ((line = br.readLine()) != null) {
StringBuffer buf = new StringBuffer();
StringBuilder buf = new StringBuilder();
// 修改内容
if (!isChange && line.startsWith("\t<script type=\"text/javascript\" src=\"")) {
buf.append(newString);

View File

@@ -25,6 +25,8 @@ import org.apache.http.impl.conn.PoolingHttpClientConnectionManager;
import org.apache.http.ssl.SSLContextBuilder;
import org.apache.http.ssl.SSLContexts;
import org.apache.http.util.EntityUtils;
import org.springframework.http.HttpStatusCode;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.multipart.MultipartFile;
import javax.net.ssl.*;
@@ -45,6 +47,10 @@ public class HttpUtil {
private static final String UTF_8 = "UTF-8";
private static final String HTTP_ERROR = "httpclient IO error:";
private HttpUtil() {
throw new UnsupportedOperationException("Utility class cannot be instantiated");
}
//创建一个跳过SSL证书认证策略的简单连接
public static CloseableHttpClient createSSLClientDefault() throws Exception {
//信任所有
@@ -151,7 +157,7 @@ public class HttpUtil {
result = EntityUtils.toString(entity, UTF_8);
//处理返回结果
if (response.getStatusLine().getStatusCode() < 200 || response.getStatusLine().getStatusCode() > 300) {
throw new Exception(result);
throw new HttpClientErrorException(HttpStatusCode.valueOf(response.getStatusLine().getStatusCode()));
}
EntityUtils.consume(entity);
} catch (IOException e) {
@@ -197,7 +203,7 @@ public class HttpUtil {
result = EntityUtils.toString(entity, UTF_8);
//处理返回结果
if (response.getStatusLine().getStatusCode() < 200 || response.getStatusLine().getStatusCode() > 300) {
throw new Exception(result);
throw new HttpClientErrorException(HttpStatusCode.valueOf(response.getStatusLine().getStatusCode()));
}
EntityUtils.consume(entity);
} catch (IOException e) {
@@ -245,7 +251,7 @@ public class HttpUtil {
result = EntityUtils.toString(responseEntity, UTF_8);
//处理返回结果
if (response.getStatusLine().getStatusCode() < 200 || response.getStatusLine().getStatusCode() > 300) {
throw new Exception(result);
throw new HttpClientErrorException(HttpStatusCode.valueOf(response.getStatusLine().getStatusCode()));
}
EntityUtils.consume(responseEntity);
} catch (IOException e) {
@@ -288,7 +294,7 @@ public class HttpUtil {
}
//处理返回结果
if (response.getStatusLine().getStatusCode() < 200 || response.getStatusLine().getStatusCode() > 300) {
throw new Exception(result);
throw new HttpClientErrorException(HttpStatusCode.valueOf(response.getStatusLine().getStatusCode()));
}
EntityUtils.consume(entity);
} catch (IOException e) {

View File

@@ -18,6 +18,10 @@ public class Tools {
private static final int KEY_SIZE = 128;
private static final int CACHE_SIZE = 1024;
private Tools() {
throw new UnsupportedOperationException("Utility class cannot be instantiated");
}
public static byte[] intToBytes(int value) {
byte[] src = new byte[4];
src[0] = (byte) ((value >> 24) & 0xFF);
@@ -77,15 +81,6 @@ public class Tools {
public static long bytesToLong(byte[] src, int offset) {
long value;
/*value = (long) ((src[offset+7] & 0xFF)
| ((src[offset+6] & 0xFF)<<8)
| ((src[offset+5] & 0xFF)<<16)
| ((src[offset+4] & 0xFF)<<24)
| ((src[offset+3] & 0xFF)<<32)
| ((src[offset+2] & 0xFF)<<40)
| ((src[offset+1] & 0xFF)<<48)
| ((src[offset] & 0xFF)<<56)
); */
long v1 = ((long) src[offset + 7] & 0xFFL);
long v2 = (((long) src[offset + 6] << 8) & 0xFF00L);
long v3 = (((long) src[offset + 5] << 16) & 0xFF0000L);
@@ -226,6 +221,7 @@ public class Tools {
File[] childrenFiles = file.listFiles();
if(childrenFiles != null) {
for (File childFile : childrenFiles) {
reverseDelFiles(childFile);
result = reverseDelFiles(childFile);
}
}
@@ -322,9 +318,6 @@ public class Tools {
/**
* 清理路径下空的文件夹,返回路径下包含的文件数量
*
* @param path
* @param filterFiles
* @return
*/
public static int emptyDirCleanAndIncludeFilesCount(File topFile, List<String> ignoreFiles) {

View File

@@ -18,6 +18,10 @@ import java.util.stream.Collectors;
@Slf4j
@Component
public class ExcelUtil {
private ExcelUtil() {
throw new UnsupportedOperationException("Utility class cannot be instantiated");
}
/**
* EasyExcel支持动态列导出
*
@@ -27,7 +31,7 @@ public class ExcelUtil {
* @param response
* @throws IOException
*/
public static void excelHelper(Class entityClass, List<HeadVO> customizeHeads, List<Map<String, Object>> list, HttpServletResponse response) throws IOException {
public static void excelHelper(Class<?> entityClass, List<HeadVO> customizeHeads, List<Map<String, Object>> list, HttpServletResponse response) throws IOException {
Field[] fields = entityClass.getDeclaredFields();
// 获取类的注解
@@ -68,14 +72,14 @@ public class ExcelUtil {
*/
public static List<Map<String, Object>> getKeysAndValues(List<?> result) {
Object[] object = result.toArray(new Object[0]);
List<Map<String, Object>> list = new ArrayList();
List<Map<String, Object>> list = new ArrayList<>();
for (Object obj : object) {
Class userCla;
Class<?> userCla;
// 得到类对象
userCla = obj.getClass();
/* 得到类中的所有属性集合 */
Field[] fs = userCla.getDeclaredFields();
Map<String, Object> listChild = new HashMap();
Map<String, Object> listChild = new HashMap<>();
for (int i = 0; i < fs.length; i++) {
Field f = fs[i];
ReflectionUtils.makeAccessible(f);// 设置些属性是可以访问的