fix:sonar
This commit is contained in:
@@ -350,7 +350,6 @@ public class ApprovePostProcessor implements Callable<String> {
|
||||
}
|
||||
commonNewMsgInfoVo.setGroupType(0);
|
||||
commonNewMsgInfoVo.setMessageType(0);
|
||||
// User user = userService.getUserByIdCode(memberRelate.getIdentityCode());
|
||||
log.info("memberRelate.getIdentityCode()为:{}",memberRelate.getIdentityCode());
|
||||
SysUser user = userService.getUserByWorkNo(memberRelate.getIdentityCode());
|
||||
log.info("memberRelate.getIdentityCode()返回值为:{}",user);
|
||||
@@ -455,7 +454,6 @@ public class ApprovePostProcessor implements Callable<String> {
|
||||
JSONObject addJson = JSON.parseObject(addStr);
|
||||
String type = addJson.getString("type");
|
||||
switch (type) {
|
||||
// case DISCIPLINE_TAG -> parseDiscipline(libName, addJson);
|
||||
case NODE_TAG, DISCIPLINE_TAG, COMPONENT_TAG -> {
|
||||
parseNode(libName, addJson, version, false);
|
||||
}
|
||||
@@ -520,8 +518,6 @@ public class ApprovePostProcessor implements Callable<String> {
|
||||
systemMapper.delSystemLoadcaseVersion(null, version, poolName, company);
|
||||
systemMapper.delSystemNodeVersion(null, version, poolName, company);
|
||||
systemMapper.delSystemPerformanceVersion(null, version, poolName, company);
|
||||
// systemMapper.delSystemLoadcasePoolFromNode(poolName);
|
||||
// systemMapper.delSystemLoadcasePoolFromCase(poolName);
|
||||
}
|
||||
case NODE_TAG, DISCIPLINE_TAG, COMPONENT_TAG -> {
|
||||
poolName = delJson.getString("poolName");
|
||||
@@ -565,7 +561,6 @@ public class ApprovePostProcessor implements Callable<String> {
|
||||
}
|
||||
commonNewMsgInfoVo.setGroupType(0);
|
||||
commonNewMsgInfoVo.setMessageType(0);
|
||||
// User user = userService.getUserByIdCode(approvalBean.getCreatorIdentity());
|
||||
log.info("approvalBean.getCreatorIdentity()为:{}",approvalBean.getCreatorIdentity());
|
||||
SysUser user = userService.getUserByWorkNo(approvalBean.getCreatorIdentity());
|
||||
log.info("approvalBean.getCreatorIdentity()返回值为:{}",user);
|
||||
@@ -596,15 +591,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;
|
||||
@@ -897,10 +883,6 @@ public class ApprovePostProcessor implements Callable<String> {
|
||||
if (status == 4) {
|
||||
//评审通过
|
||||
String approveInfo = approvalBean.approveInfo;
|
||||
JSONObject jsonObject = JSON.parseObject(approveInfo);
|
||||
|
||||
} else if (status == 5) {
|
||||
//评审不通过
|
||||
}
|
||||
}
|
||||
|
||||
@@ -920,10 +902,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)//评审撤销
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -34,7 +34,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;
|
||||
@@ -45,9 +45,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;
|
||||
@@ -66,28 +66,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);
|
||||
@@ -98,29 +98,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);
|
||||
@@ -148,15 +148,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);
|
||||
@@ -167,8 +167,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);
|
||||
@@ -203,15 +203,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);
|
||||
@@ -239,8 +239,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);
|
||||
@@ -268,8 +268,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);
|
||||
@@ -277,8 +277,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;
|
||||
@@ -313,15 +313,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);
|
||||
|
||||
@@ -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;
|
||||
@@ -90,7 +91,6 @@ public class FilesUtil {
|
||||
public static Vector<File> getPathAllFiles(File file, Vector<File> vector) {
|
||||
if (file.isFile()) {
|
||||
// 如果是文件,直接装载
|
||||
// log.info("在迭代函数中文件" + file.getName() + "大小为:" + file.length());
|
||||
vector.add(file);
|
||||
} else {
|
||||
// 文件夹
|
||||
@@ -163,7 +163,7 @@ public class FilesUtil {
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("zip files failed", e);
|
||||
throw new RuntimeException(e);
|
||||
throw new IORuntimeException(e);
|
||||
}
|
||||
// 不再需要finally块,所有资源会自动关闭
|
||||
}
|
||||
@@ -204,14 +204,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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.ccag.utils;
|
||||
|
||||
import com.ccag.common.ThreadLocalContext;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.*;
|
||||
@@ -19,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);
|
||||
@@ -78,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);
|
||||
@@ -227,10 +221,7 @@ public class Tools {
|
||||
File[] childrenFiles = file.listFiles();
|
||||
if(childrenFiles != null) {
|
||||
for (File childFile : childrenFiles) {
|
||||
result = reverseDelFiles(childFile);
|
||||
//if(!result){
|
||||
//result = false;
|
||||
//}
|
||||
reverseDelFiles(childFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -326,9 +317,6 @@ public class Tools {
|
||||
|
||||
/**
|
||||
* 清理路径下空的文件夹,返回路径下包含的文件数量
|
||||
*
|
||||
* @param path
|
||||
* @param filterFiles
|
||||
* @return
|
||||
*/
|
||||
public static int emptyDirCleanAndIncludeFilesCount(File topFile, List<String> ignoreFiles) {
|
||||
@@ -356,27 +344,6 @@ public class Tools {
|
||||
return fileCount;
|
||||
}
|
||||
|
||||
public static String keyStringValid(String path, int type) {
|
||||
// 0命令,1路径
|
||||
// if (type == 0) {
|
||||
// if (path.contains(";") || path.contains("|") || path.contains("&") || path.contains("$")) {
|
||||
// return "";
|
||||
// }
|
||||
// }
|
||||
// Map<String, String> charWhiteList = new HashMap<>();
|
||||
// for (int index = 32; index < 127; index++) {
|
||||
// char ch = (char) index;
|
||||
// String string = String.valueOf(ch);
|
||||
// charWhiteList.put(string, string);
|
||||
// }
|
||||
// for (int i = 0; i < path.length(); i++) {
|
||||
// char c = path.charAt(i);
|
||||
// String cString = String.valueOf(c);
|
||||
// temp += charWhiteList.get(cString);
|
||||
// }
|
||||
return path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Log Forging漏洞校验
|
||||
* @param logs
|
||||
|
||||
@@ -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);// 设置些属性是可以访问的
|
||||
|
||||
Reference in New Issue
Block a user