Commit 4ee877ff by liuyang

2024/03/14 调整文件删除

parent 8c782c98
...@@ -58,4 +58,13 @@ public class CommonConstant { ...@@ -58,4 +58,13 @@ public class CommonConstant {
public static final String ROOT = "root"; public static final String ROOT = "root";
} }
public static class ProjectEnv {
public static final String RUN = "run";
public static final String DEV = "dev";
}
} }
...@@ -12,11 +12,13 @@ import com.baosight.hpjx.hp.pz.tools.HPPZTools; ...@@ -12,11 +12,13 @@ import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.sc.domain.*; import com.baosight.hpjx.hp.sc.domain.*;
import com.baosight.hpjx.hp.sc.tools.HPSCTools; import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.util.*; import com.baosight.hpjx.util.*;
import com.baosight.iplat4j.core.ProjectInfo;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import com.baosight.iplat4j.core.util.NumberUtils; import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
...@@ -758,7 +760,22 @@ public class ServiceHPSC002 extends ServiceBase { ...@@ -758,7 +760,22 @@ public class ServiceHPSC002 extends ServiceBase {
if (list.size() > 0) { if (list.size() > 0) {
for (HPDS002 hpds002: list) { for (HPDS002 hpds002: list) {
String realPath = hpds002.getRealPath(); String realPath = hpds002.getRealPath();
FileUtils.deleteFile(realPath); // 项目环境
String projectEnv = ProjectInfo.getProjectEnv();
if (projectEnv.equals(CommonConstant.ProjectEnv.RUN)) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("data",realPath+"-"+0);
eiInfo.set(EiConstant.serviceId,"S_EU_0105");
//调用接口
EiInfo outInfo = XServiceManager.call(eiInfo);
if(outInfo.getStatus() == EiConstant.STATUS_FAILURE){
LogUtils.setDetailMsg(outInfo, new Throwable(), "查询部件类型失败");
outInfo.setMsg("失败");
}
}else {
FileUtils.deleteFile(realPath);
}
} }
this.dao.delete(HPDS002.DELETE,map); this.dao.delete(HPDS002.DELETE,map);
} }
......
package com.baosight.hpjx.hp.sc.service; package com.baosight.hpjx.hp.sc.service;
import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation; import com.baosight.hpjx.aspect.annotation.OperationLogAnnotation;
import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.ds.domain.HPDS002; import com.baosight.hpjx.hp.ds.domain.HPDS002;
import com.baosight.hpjx.hp.sc.domain.HPSC002; import com.baosight.hpjx.hp.sc.domain.HPSC002;
...@@ -9,10 +10,12 @@ import com.baosight.hpjx.hp.sc.domain.HPSC006; ...@@ -9,10 +10,12 @@ import com.baosight.hpjx.hp.sc.domain.HPSC006;
import com.baosight.hpjx.util.EiInfoUtils; import com.baosight.hpjx.util.EiInfoUtils;
import com.baosight.hpjx.util.FileUtils; import com.baosight.hpjx.util.FileUtils;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
import com.baosight.iplat4j.core.ProjectInfo;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceEPBase; import com.baosight.iplat4j.core.service.impl.ServiceEPBase;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import java.io.File; import java.io.File;
...@@ -137,7 +140,22 @@ public class ServiceHPSC002A extends ServiceEPBase { ...@@ -137,7 +140,22 @@ public class ServiceHPSC002A extends ServiceEPBase {
List<HPDS002> list = this.dao.query(HPDS002.QUERY,map); List<HPDS002> list = this.dao.query(HPDS002.QUERY,map);
if (list.size() > 0) { if (list.size() > 0) {
String realPath = list.get(0).getRealPath(); String realPath = list.get(0).getRealPath();
FileUtils.deleteFile(realPath); // 项目环境
String projectEnv = ProjectInfo.getProjectEnv();
if (projectEnv.equals(CommonConstant.ProjectEnv.RUN)) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("data",realPath+"-"+0);
eiInfo.set(EiConstant.serviceId,"S_EU_0105");
//调用接口
EiInfo outInfo = XServiceManager.call(eiInfo);
if(outInfo.getStatus() == EiConstant.STATUS_FAILURE){
LogUtils.setDetailMsg(outInfo, new Throwable(), "查询部件类型失败");
outInfo.setMsg("失败");
}
}else {
FileUtils.deleteFile(realPath);
}
this.dao.delete(HPDS002.DELETE,map); this.dao.delete(HPDS002.DELETE,map);
} }
......
...@@ -17,11 +17,13 @@ import com.baosight.hpjx.hp.sc.tools.HPSCTools; ...@@ -17,11 +17,13 @@ import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.hp.xs.domain.Org; import com.baosight.hpjx.hp.xs.domain.Org;
import com.baosight.hpjx.hp.xs.tools.HPXSTools; import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.*; import com.baosight.hpjx.util.*;
import com.baosight.iplat4j.core.ProjectInfo;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant; import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.service.impl.ServiceBase; import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import com.baosight.iplat4j.core.util.NumberUtils; import com.baosight.iplat4j.core.util.NumberUtils;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
...@@ -326,7 +328,22 @@ public class ServiceHPSC006 extends ServiceBase { ...@@ -326,7 +328,22 @@ public class ServiceHPSC006 extends ServiceBase {
if (list.size() > 0) { if (list.size() > 0) {
for (HPDS002 hpds002: list) { for (HPDS002 hpds002: list) {
String realPath = hpds002.getRealPath(); String realPath = hpds002.getRealPath();
FileUtils.deleteFile(realPath); // 项目环境
String projectEnv = ProjectInfo.getProjectEnv();
if (projectEnv.equals(CommonConstant.ProjectEnv.RUN)) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("data",realPath+"-"+0);
eiInfo.set(EiConstant.serviceId,"S_EU_0105");
//调用接口
EiInfo outInfo = XServiceManager.call(eiInfo);
if(outInfo.getStatus() == EiConstant.STATUS_FAILURE){
LogUtils.setDetailMsg(outInfo, new Throwable(), "查询部件类型失败");
outInfo.setMsg("失败");
}
}else {
FileUtils.deleteFile(realPath);
}
} }
this.dao.delete(HPDS002.DELETE,map); this.dao.delete(HPDS002.DELETE,map);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment