文件架构批量刷新属性代码修改
This commit is contained in:
parent
99edb3460c
commit
f796545496
@ -30,338 +30,367 @@ import com.awspaas.user.apps.app.util.RepositoryAttribute;
|
|||||||
*/
|
*/
|
||||||
@Controller
|
@Controller
|
||||||
public class SyncFrameData_job_Controller {
|
public class SyncFrameData_job_Controller {
|
||||||
@Mapping("com.awspaas.user.apps.app.reportform.controller.SyncFrameData_job_Controller")
|
@Mapping("com.awspaas.user.apps.app.reportform.controller.SyncFrameData_job_Controller")
|
||||||
public ResponseObject CheckUser(String sid,String fileName) {
|
public ResponseObject CheckUser(String sid,String fileName) {
|
||||||
ResponseObject ro = ResponseObject.newOkResponse();
|
ResponseObject ro = ResponseObject.newOkResponse();
|
||||||
syncFileData();
|
syncFileData();
|
||||||
sre2();
|
sre2();
|
||||||
ro.put("reslut", "ok");
|
ro.put("reslut", "ok");
|
||||||
return ro;
|
return ro;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Mapping("com.awspaas.user.apps.app.reportform.controller.SyncFrameData_job_Controller_resul")
|
|
||||||
public ResponseObject CheckUser2(String sid,String fileName) {
|
|
||||||
System.err.println("刷新模型架构属性开始=============>");
|
|
||||||
ResponseObject ro = ResponseObject.newOkResponse();
|
|
||||||
sre();
|
|
||||||
sre2();
|
|
||||||
ro.put("reslut", "ok");
|
|
||||||
return ro;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//刷新架构名称
|
|
||||||
public void sre() {
|
|
||||||
List<PALRepositoryModel> palRepositoryModels = CoeProcessLevelDaoFacotory.createCoeProcessLevel()
|
|
||||||
.getAllCoeProcessLevelByWsId("7d3ca852-a0bd-42e6-80b1-3dcea6f55083");
|
|
||||||
for (PALRepositoryModel palRepositoryModel : palRepositoryModels) {
|
|
||||||
BO bo = new BO();
|
|
||||||
|
|
||||||
boolean isResul = true;
|
|
||||||
String name = palRepositoryModel.getName();
|
|
||||||
String methodId = palRepositoryModel.getMethodId();
|
|
||||||
String uuid = palRepositoryModel.getId();
|
|
||||||
bo.set("PLNAME", name);
|
|
||||||
bo.set("PLID", uuid);
|
|
||||||
if (("process.epc".equals(methodId) || "control.policy".equals(methodId)
|
|
||||||
|| "process.flowchart".equals(methodId))|| "data.form".equals(methodId)) {
|
|
||||||
try {
|
|
||||||
String frameworkName1 = "";
|
|
||||||
//String frameworkName2 = "";
|
|
||||||
//String frameworkName3 = "";
|
|
||||||
// 获取一级架构名称
|
|
||||||
String parentId1 = palRepositoryModel.getParentId();
|
|
||||||
//String parentId2 = "";
|
|
||||||
//String parentId3 = "";
|
|
||||||
PALRepositoryModel parentMode1 = PALRepositoryCache.getCache().get(parentId1);
|
|
||||||
if (parentMode1 != null) {
|
|
||||||
frameworkName1 = parentMode1.getName();
|
|
||||||
/*
|
|
||||||
* parentId2 = parentMode1.getParentId(); PALRepositoryModel parentMode2 =
|
|
||||||
* PALRepositoryCache.getCache().get(parentId2); if (parentMode2 != null) {
|
|
||||||
* frameworkName2 = parentMode2.getName(); parentId3 =
|
|
||||||
* parentMode2.getParentId(); PALRepositoryModel parentMode3 =
|
|
||||||
* PALRepositoryCache.getCache().get(parentId3); if (parentMode3 != null) {
|
|
||||||
* frameworkName3 = parentMode3.getName();
|
|
||||||
*
|
|
||||||
* } }
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
@Mapping("com.awspaas.user.apps.app.reportform.controller.SyncFrameData_job_Controller_resul")
|
||||||
/*
|
public ResponseObject CheckUser2(String sid,String fileName) {
|
||||||
* String update = "UPDATE App_Act_Coe_Pal_Repository SET PLPARENTID = '" +
|
System.err.println("刷新模型架构属性开始=============>");
|
||||||
* maprightId + "' WHERE ID ='" + uuid + "'";
|
ResponseObject ro = ResponseObject.newOkResponse();
|
||||||
*/
|
sre();
|
||||||
// int update2 = DBSql.update(update);
|
sre2();
|
||||||
PALRepositoryPropertyDao propertyDao = new PALRepositoryPropertyDao();
|
ro.put("reslut", "ok");
|
||||||
if (isResul) {
|
return ro;
|
||||||
String name1 = frameworkName1.substring(frameworkName1.lastIndexOf(".") + 2).trim();
|
}
|
||||||
// 设置三级架构名称
|
|
||||||
bo.set("L3", name1);
|
|
||||||
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L3", name1);
|
|
||||||
// 设置二级架构名称
|
|
||||||
String sql2 = "SELECT PLPARENTID FROM App_Act_Coe_Pal_Repository WHERE ID ='" + parentId1
|
|
||||||
+ "'";
|
|
||||||
String prd2 = DBSql.getString(sql2);
|
|
||||||
String sqlp2 = "SELECT PLNAME,ID FROM App_Act_Coe_Pal_Repository WHERE ID ='" + prd2 + "'";
|
|
||||||
RowMap map2 = DBSql.getMap(sqlp2);
|
|
||||||
if (map2 != null) {
|
|
||||||
String uuid2 = map2.getString("ID");
|
|
||||||
String plName2 = map2.getString("PLNAME");
|
|
||||||
String name2 = plName2.substring(plName2.lastIndexOf(".") + 2).trim();
|
|
||||||
bo.set("L2", name2);
|
|
||||||
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L2", name2);
|
|
||||||
|
|
||||||
// 设置一级架构名称
|
|
||||||
String sql1 = "SELECT PLPARENTID FROM App_Act_Coe_Pal_Repository WHERE ID ='" + uuid2
|
|
||||||
+ "'";
|
|
||||||
String prd1 = DBSql.getString(sql1);
|
|
||||||
String sqlp1 = "SELECT PLNAME,ID FROM App_Act_Coe_Pal_Repository WHERE ID ='" + prd1
|
|
||||||
+ "'";
|
|
||||||
RowMap map1 = DBSql.getMap(sqlp1);
|
|
||||||
|
|
||||||
if (map1 != null) {
|
|
||||||
String plName1 = map1.getString("PLNAME");
|
|
||||||
String name3 = plName1.substring(plName1.lastIndexOf(".") + 2).trim();
|
|
||||||
bo.set("L1", name3);
|
|
||||||
bo.set("LEVELS", "4");
|
|
||||||
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L1", name3);
|
|
||||||
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET PLLEVEL = '4' WHERE ID ='"+uuid+"' AND PLMETHODID != 'process.framework'");
|
|
||||||
} else {
|
|
||||||
bo.set("L1", name1);
|
|
||||||
bo.set("L2", name2);
|
|
||||||
bo.set("L3", "/");
|
|
||||||
bo.set("LEVELS", "3");
|
|
||||||
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET PLLEVEL = '3' WHERE ID ='"+uuid+"' AND PLMETHODID != 'process.framework'");
|
|
||||||
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L3", "/");
|
|
||||||
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L1", name2);
|
|
||||||
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L2", name1);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
//刷新架构名称
|
||||||
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET PLLEVEL = '2' WHERE ID ='"+uuid+"' AND PLMETHODID != 'process.framework'");
|
public void sre() {
|
||||||
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L2", "/");
|
List<PALRepositoryModel> palRepositoryModels = CoeProcessLevelDaoFacotory.createCoeProcessLevel()
|
||||||
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L3", "/");
|
.getAllCoeProcessLevelByWsId("7d3ca852-a0bd-42e6-80b1-3dcea6f55083");
|
||||||
bo.set("L1", name1);
|
for (PALRepositoryModel palRepositoryModel : palRepositoryModels) {
|
||||||
bo.set("L2", "/");
|
BO bo = new BO();
|
||||||
bo.set("L3", "/");
|
|
||||||
bo.set("LEVELS", "2");
|
|
||||||
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L1", name1);
|
|
||||||
|
|
||||||
}
|
boolean isResul = true;
|
||||||
|
String name = palRepositoryModel.getName();
|
||||||
bo.set("RESULT", "成功");
|
String methodId = palRepositoryModel.getMethodId();
|
||||||
//System.err.println("============》"+palRepositoryModel.getName());
|
String uuid = palRepositoryModel.getId();
|
||||||
}
|
bo.set("PLNAME", name);
|
||||||
} catch (Exception e) {
|
bo.set("PLID", uuid);
|
||||||
|
if (("process.epc".equals(methodId) || "control.policy".equals(methodId)
|
||||||
bo.set("RESULT", "失败");
|
|| "process.flowchart".equals(methodId))|| "data.form".equals(methodId)) {
|
||||||
//System.err.println("刷新架构异常文件======》"+palRepositoryModel.getName());
|
try {
|
||||||
// TODO: handle exception
|
String frameworkName1 = "";
|
||||||
}finally {
|
//String frameworkName2 = "";
|
||||||
|
//String frameworkName3 = "";
|
||||||
SDK.getBOAPI().createDataBO("BO_EU_PAL_RES_FRARMWORK", bo, UserContext.fromUID("admin"));
|
// 获取一级架构名称
|
||||||
|
String parentId1 = palRepositoryModel.getParentId();
|
||||||
}
|
//String parentId2 = "";
|
||||||
|
//String parentId3 = "";
|
||||||
|
PALRepositoryModel parentMode1 = PALRepositoryCache.getCache().get(parentId1);
|
||||||
|
if (parentMode1 != null) {
|
||||||
|
frameworkName1 = parentMode1.getName();
|
||||||
|
/*
|
||||||
|
* parentId2 = parentMode1.getParentId(); PALRepositoryModel parentMode2 =
|
||||||
|
* PALRepositoryCache.getCache().get(parentId2); if (parentMode2 != null) {
|
||||||
|
* frameworkName2 = parentMode2.getName(); parentId3 =
|
||||||
|
* parentMode2.getParentId(); PALRepositoryModel parentMode3 =
|
||||||
|
* PALRepositoryCache.getCache().get(parentId3); if (parentMode3 != null) {
|
||||||
|
* frameworkName3 = parentMode3.getName();
|
||||||
|
*
|
||||||
|
* } }
|
||||||
|
*/
|
||||||
|
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* String update = "UPDATE App_Act_Coe_Pal_Repository SET PLPARENTID = '" +
|
||||||
|
* maprightId + "' WHERE ID ='" + uuid + "'";
|
||||||
|
*/
|
||||||
|
// int update2 = DBSql.update(update);
|
||||||
|
PALRepositoryPropertyDao propertyDao = new PALRepositoryPropertyDao();
|
||||||
|
if (isResul) {
|
||||||
|
String name1 = frameworkName1.substring(frameworkName1.lastIndexOf(".") + 2).trim();
|
||||||
|
// 设置四级架构名称
|
||||||
|
bo.set("L4", name1);
|
||||||
|
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L4", name1);
|
||||||
|
// 设置三级架构名称
|
||||||
|
String sql4 = "SELECT PLPARENTID FROM App_Act_Coe_Pal_Repository WHERE ID ='" + parentId1
|
||||||
|
+ "'";
|
||||||
|
String prd4 = DBSql.getString(sql4);
|
||||||
|
String sqlp4 = "SELECT PLNAME,ID FROM App_Act_Coe_Pal_Repository WHERE ID ='" + prd4 + "'";
|
||||||
|
RowMap map4 = DBSql.getMap(sqlp4);
|
||||||
|
if (map4 != null) {
|
||||||
|
String uuid4 = map4.getString("ID");
|
||||||
|
String plName4 = map4.getString("PLNAME");
|
||||||
|
String name4 = plName4.substring(plName4.lastIndexOf(".") + 2).trim();
|
||||||
|
bo.set("L3", name4);
|
||||||
|
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L3", name4);
|
||||||
|
|
||||||
}
|
// 设置二级架构名称
|
||||||
}
|
String sql2 = "SELECT PLPARENTID FROM App_Act_Coe_Pal_Repository WHERE ID ='" + uuid4
|
||||||
System.err.println("刷新模型架构属性结束=============>");
|
+ "'";
|
||||||
}
|
String prd2 = DBSql.getString(sql2);
|
||||||
|
String sqlp2 = "SELECT PLNAME,ID FROM App_Act_Coe_Pal_Repository WHERE ID ='" + prd2 + "'";
|
||||||
|
RowMap map2 = DBSql.getMap(sqlp2);
|
||||||
//更新架构层级错误
|
if (map2 != null) {
|
||||||
public void sre2() {
|
String uuid2 = map2.getString("ID");
|
||||||
int count = 0;
|
String plName2 = map2.getString("PLNAME");
|
||||||
String slq = "SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLMETHODID = 'process.framework'";
|
String name2 = plName2.substring(plName2.lastIndexOf(".") + 2).trim();
|
||||||
List<RowMap> maps2 = DBSql.getMaps(slq);
|
bo.set("L2", name2);
|
||||||
for (RowMap rowMap : maps2) {
|
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L2", name2);
|
||||||
String plname = rowMap.getString("PLNAME");
|
|
||||||
String plId = rowMap.getString("ID");
|
// 设置一级架构名称
|
||||||
String[] split = plname.split("\\.");
|
String sql1 = "SELECT PLPARENTID FROM App_Act_Coe_Pal_Repository WHERE ID ='" + uuid2
|
||||||
if(split.length>2) {
|
+ "'";
|
||||||
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET PLLEVEL = '3',EXT5 = '1' WHERE ID = '"+plId+"'");
|
String prd1 = DBSql.getString(sql1);
|
||||||
}else{
|
String sqlp1 = "SELECT PLNAME,ID FROM App_Act_Coe_Pal_Repository WHERE ID ='" + prd1
|
||||||
if(split.length>1) {
|
+ "'";
|
||||||
String ff = split[1];
|
RowMap map1 = DBSql.getMap(sqlp1);
|
||||||
if(ff.contains("0")) {
|
|
||||||
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET PLLEVEL = '1',EXT5 = '1' WHERE ID = '"+plId+"'");
|
if (map1 != null) {
|
||||||
}else {
|
String plName1 = map1.getString("PLNAME");
|
||||||
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET PLLEVEL = '2',EXT5 = '1' WHERE ID = '"+plId+"'");
|
String name3 = plName1.substring(plName1.lastIndexOf(".") + 2).trim();
|
||||||
}
|
bo.set("L1", name3);
|
||||||
}
|
bo.set("LEVELS", "5");
|
||||||
}
|
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L1", name3);
|
||||||
/*
|
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET PLLEVEL = '5' WHERE ID ='"+uuid+"' AND PLMETHODID != 'process.framework'");
|
||||||
* String sql =
|
} else {
|
||||||
* "SELECT PLLEVEL FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLPARENTID = '"+plId+
|
bo.set("L1", name1);
|
||||||
* "'"; String plLevel = DBSql.getString(sql);
|
bo.set("L2", name2);
|
||||||
* if(UtilString.isNotEmpty(plLevel)) {
|
bo.set("L3", name4);
|
||||||
* DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET PLLEVEL = '"+(Integer.
|
bo.set("L4", "/");
|
||||||
* parseInt(plLevel)-1)+""+"' WHERE ID = '"+plId+"'"); }else {
|
bo.set("LEVELS", "4");
|
||||||
*
|
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET PLLEVEL = '4' WHERE ID ='"+uuid+"' AND PLMETHODID != 'process.framework'");
|
||||||
*
|
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L4", "/");
|
||||||
* }
|
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L3", name4);
|
||||||
*/
|
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L1", name2);
|
||||||
|
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L2", name1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
String sql = "SELECT PLLEVEL,ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLMETHODID = 'process.framework'";
|
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET PLLEVEL = '3' WHERE ID ='"+uuid+"' AND PLMETHODID != 'process.framework'");
|
||||||
List<RowMap> maps = DBSql.getMaps(sql);
|
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L2", name4);
|
||||||
for (RowMap rowMap : maps) {
|
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L3", "/");
|
||||||
String id = rowMap.getString("ID");
|
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L4", "/");
|
||||||
String level = rowMap.getString("PLLEVEL");
|
bo.set("L1", name1);
|
||||||
//count+=DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET PLLEVEL = '"+level+"' WHERE ID = '"+id+"'");
|
bo.set("L2", name4);
|
||||||
count+=DBSql.update("UPDATE BO_EU_PAL_FRAME SET FRAMELEVEL = '"+level+"' WHERE FRAMEID = '"+id+"'");
|
bo.set("L3", "/");
|
||||||
}
|
bo.set("L4", "/");
|
||||||
System.err.println("共刷新数据=====》"+count);
|
bo.set("LEVELS", "3");
|
||||||
|
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L1", name1);
|
||||||
|
|
||||||
}
|
}
|
||||||
public void syncFileData() {
|
}else {
|
||||||
SDK.getLogAPI().consoleInfo("同步架构表信息开始执行");
|
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET PLLEVEL = '2' WHERE ID ='"+uuid+"' AND PLMETHODID != 'process.framework'");
|
||||||
long startTime = System.currentTimeMillis();
|
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L2", "/");
|
||||||
Date nowDateJ = new Date(System.currentTimeMillis());
|
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L3", "/");
|
||||||
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L4", "/");
|
||||||
String format = sdf2.format(nowDateJ);
|
bo.set("L1", name1);
|
||||||
SDK.getLogAPI().consoleInfo("开始时间" + format);
|
bo.set("L2", "/");
|
||||||
String wsId = "7d3ca852-a0bd-42e6-80b1-3dcea6f55083";
|
bo.set("L3", "/");
|
||||||
//总文件集合
|
bo.set("L4", "/");
|
||||||
String process = "process";
|
bo.set("LEVELS", "2");
|
||||||
String org = "org";
|
propertyDao.updatePropertyByPropertyId(uuid, "Process_Architecture_L1", name1);
|
||||||
String data = "data";
|
}
|
||||||
String itsystem = "itsystem";
|
|
||||||
String control = "control";
|
bo.set("RESULT", "成功");
|
||||||
List<PALRepositoryModel> palProcessList = new ArrayList<>();
|
//System.err.println("============》"+palRepositoryModel.getName());
|
||||||
Set<String> palProcessIds = new HashSet<>();
|
}
|
||||||
List<PALRepositoryModel> palOrgList = new ArrayList<>();
|
} catch (Exception e) {
|
||||||
Set<String> palOrgIds = new HashSet<>();
|
|
||||||
List<PALRepositoryModel> palDataList = new ArrayList<>();
|
bo.set("RESULT", "失败");
|
||||||
Set<String> palDataIds = new HashSet<>();
|
//System.err.println("刷新架构异常文件======》"+palRepositoryModel.getName());
|
||||||
List<PALRepositoryModel> palItsystemList = new ArrayList<>();
|
// TODO: handle exception
|
||||||
Set<String> palItsystemIds = new HashSet<>();
|
}finally {
|
||||||
List<PALRepositoryModel> palControlList = new ArrayList<>();
|
|
||||||
Set<String> palControlIds = new HashSet<>();
|
SDK.getBOAPI().createDataBO("BO_EU_PAL_RES_FRARMWORK", bo, UserContext.fromUID("admin"));
|
||||||
PALRepositoryCache.getAllChildrenModelsByPid(wsId, process, palProcessList, palProcessIds);
|
|
||||||
PALRepositoryCache.getAllChildrenModelsByPid(wsId, org, palOrgList, palOrgIds);
|
}
|
||||||
PALRepositoryCache.getAllChildrenModelsByPid(wsId, data, palDataList, palDataIds);
|
|
||||||
PALRepositoryCache.getAllChildrenModelsByPid(wsId, itsystem, palItsystemList, palItsystemIds);
|
|
||||||
PALRepositoryCache.getAllChildrenModelsByPid(wsId, control, palControlList, palControlIds);
|
|
||||||
//合并为文件总量list
|
}
|
||||||
List<PALRepositoryModel> palTotalList = new ArrayList<>();
|
}
|
||||||
palTotalList.addAll(palProcessList);
|
System.err.println("刷新模型架构属性结束=============>");
|
||||||
palTotalList.addAll(palOrgList);
|
}
|
||||||
palTotalList.addAll(palDataList);
|
|
||||||
palTotalList.addAll(palItsystemList);
|
|
||||||
palTotalList.addAll(palControlList);
|
//更新架构层级错误
|
||||||
SDK.getLogAPI().consoleInfo("process下文件数量:" + palProcessList.size());
|
public void sre2() {
|
||||||
SDK.getLogAPI().consoleInfo("org下文件数量:" + palOrgList.size());
|
int count = 0;
|
||||||
SDK.getLogAPI().consoleInfo("data下文件数量:" + palDataList.size());
|
String slq = "SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLMETHODID = 'process.framework'";
|
||||||
SDK.getLogAPI().consoleInfo("itsystem下文件数量:" + palItsystemList.size());
|
List<RowMap> maps2 = DBSql.getMaps(slq);
|
||||||
SDK.getLogAPI().consoleInfo("control下文件数量:" + palControlList.size());
|
for (RowMap rowMap : maps2) {
|
||||||
SDK.getLogAPI().consoleInfo("文件总数量:" + palTotalList.size());
|
String plname = rowMap.getString("PLNAME");
|
||||||
//过滤出角色文件
|
String plId = rowMap.getString("ID");
|
||||||
|
String[] split = plname.split("\\.");
|
||||||
|
if(split.length>2) {
|
||||||
|
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET PLLEVEL = '3',EXT5 = '1' WHERE ID = '"+plId+"'");
|
||||||
|
}else{
|
||||||
|
if(split.length>1) {
|
||||||
|
String ff = split[1];
|
||||||
|
if(ff.contains("0")) {
|
||||||
|
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET PLLEVEL = '1',EXT5 = '1' WHERE ID = '"+plId+"'");
|
||||||
|
}else {
|
||||||
|
DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET PLLEVEL = '2',EXT5 = '1' WHERE ID = '"+plId+"'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* String sql =
|
||||||
|
* "SELECT PLLEVEL FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLPARENTID = '"+plId+
|
||||||
|
* "'"; String plLevel = DBSql.getString(sql);
|
||||||
|
* if(UtilString.isNotEmpty(plLevel)) {
|
||||||
|
* DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET PLLEVEL = '"+(Integer.
|
||||||
|
* parseInt(plLevel)-1)+""+"' WHERE ID = '"+plId+"'"); }else {
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
String sql = "SELECT PLLEVEL,ID FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLMETHODID = 'process.framework'";
|
||||||
|
List<RowMap> maps = DBSql.getMaps(sql);
|
||||||
|
for (RowMap rowMap : maps) {
|
||||||
|
String id = rowMap.getString("ID");
|
||||||
|
String level = rowMap.getString("PLLEVEL");
|
||||||
|
//count+=DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET PLLEVEL = '"+level+"' WHERE ID = '"+id+"'");
|
||||||
|
count+=DBSql.update("UPDATE BO_EU_PAL_FRAME SET FRAMELEVEL = '"+level+"' WHERE FRAMEID = '"+id+"'");
|
||||||
|
}
|
||||||
|
System.err.println("共刷新数据=====》"+count);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
public void syncFileData() {
|
||||||
|
SDK.getLogAPI().consoleInfo("同步架构表信息开始执行");
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
|
Date nowDateJ = new Date(System.currentTimeMillis());
|
||||||
|
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
String format = sdf2.format(nowDateJ);
|
||||||
|
SDK.getLogAPI().consoleInfo("开始时间" + format);
|
||||||
|
String wsId = "7d3ca852-a0bd-42e6-80b1-3dcea6f55083";
|
||||||
|
//总文件集合
|
||||||
|
String process = "process";
|
||||||
|
String org = "org";
|
||||||
|
String data = "data";
|
||||||
|
String itsystem = "itsystem";
|
||||||
|
String control = "control";
|
||||||
|
List<PALRepositoryModel> palProcessList = new ArrayList<>();
|
||||||
|
Set<String> palProcessIds = new HashSet<>();
|
||||||
|
List<PALRepositoryModel> palOrgList = new ArrayList<>();
|
||||||
|
Set<String> palOrgIds = new HashSet<>();
|
||||||
|
List<PALRepositoryModel> palDataList = new ArrayList<>();
|
||||||
|
Set<String> palDataIds = new HashSet<>();
|
||||||
|
List<PALRepositoryModel> palItsystemList = new ArrayList<>();
|
||||||
|
Set<String> palItsystemIds = new HashSet<>();
|
||||||
|
List<PALRepositoryModel> palControlList = new ArrayList<>();
|
||||||
|
Set<String> palControlIds = new HashSet<>();
|
||||||
|
PALRepositoryCache.getAllChildrenModelsByPid(wsId, process, palProcessList, palProcessIds);
|
||||||
|
PALRepositoryCache.getAllChildrenModelsByPid(wsId, org, palOrgList, palOrgIds);
|
||||||
|
PALRepositoryCache.getAllChildrenModelsByPid(wsId, data, palDataList, palDataIds);
|
||||||
|
PALRepositoryCache.getAllChildrenModelsByPid(wsId, itsystem, palItsystemList, palItsystemIds);
|
||||||
|
PALRepositoryCache.getAllChildrenModelsByPid(wsId, control, palControlList, palControlIds);
|
||||||
|
//合并为文件总量list
|
||||||
|
List<PALRepositoryModel> palTotalList = new ArrayList<>();
|
||||||
|
palTotalList.addAll(palProcessList);
|
||||||
|
palTotalList.addAll(palOrgList);
|
||||||
|
palTotalList.addAll(palDataList);
|
||||||
|
palTotalList.addAll(palItsystemList);
|
||||||
|
palTotalList.addAll(palControlList);
|
||||||
|
SDK.getLogAPI().consoleInfo("process下文件数量:" + palProcessList.size());
|
||||||
|
SDK.getLogAPI().consoleInfo("org下文件数量:" + palOrgList.size());
|
||||||
|
SDK.getLogAPI().consoleInfo("data下文件数量:" + palDataList.size());
|
||||||
|
SDK.getLogAPI().consoleInfo("itsystem下文件数量:" + palItsystemList.size());
|
||||||
|
SDK.getLogAPI().consoleInfo("control下文件数量:" + palControlList.size());
|
||||||
|
SDK.getLogAPI().consoleInfo("文件总数量:" + palTotalList.size());
|
||||||
|
//过滤出角色文件
|
||||||
/* List<PALRepositoryModel> palRoleFileList = palOrgList.stream().filter(x -> x.getMethodId().equals("org.role")).collect(Collectors.toList());
|
/* List<PALRepositoryModel> palRoleFileList = palOrgList.stream().filter(x -> x.getMethodId().equals("org.role")).collect(Collectors.toList());
|
||||||
SDK.getLogAPI().consoleInfo("角色文件数量:" + palRoleFileList.size());*/
|
SDK.getLogAPI().consoleInfo("角色文件数量:" + palRoleFileList.size());*/
|
||||||
|
|
||||||
//初始化架构、文件、节点 old/new/del/fromDataID/dis list
|
//初始化架构、文件、节点 old/new/del/fromDataID/dis list
|
||||||
ArrayList<Map<String, ?>> oldFrameDataMaps = new ArrayList<>();
|
ArrayList<Map<String, ?>> oldFrameDataMaps = new ArrayList<>();
|
||||||
ArrayList<Map<String, ?>> newFrameDataMaps = new ArrayList<>();
|
ArrayList<Map<String, ?>> newFrameDataMaps = new ArrayList<>();
|
||||||
ArrayList<Map<String, ?>> delFrameDataMaps = new ArrayList<>();
|
ArrayList<Map<String, ?>> delFrameDataMaps = new ArrayList<>();
|
||||||
ArrayList<String> fromFrameDataIDMaps = new ArrayList<>();
|
ArrayList<String> fromFrameDataIDMaps = new ArrayList<>();
|
||||||
HashMap<String, Object> dataMap = new HashMap<>();
|
HashMap<String, Object> dataMap = new HashMap<>();
|
||||||
//获取底表数据
|
//获取底表数据
|
||||||
List<String> frameIdList = DBSql.getList("SELECT FRAMEID FROM BO_EU_PAL_FRAME", String.class);
|
List<String> frameIdList = DBSql.getList("SELECT FRAMEID FROM BO_EU_PAL_FRAME", String.class);
|
||||||
SDK.getLogAPI().consoleInfo("架构底表长度:" + frameIdList.size());
|
SDK.getLogAPI().consoleInfo("架构底表长度:" + frameIdList.size());
|
||||||
//系统字段
|
//系统字段
|
||||||
String uuId = SDK.getRuleAPI().executeAtScript("@uuid()");
|
String uuId = SDK.getRuleAPI().executeAtScript("@uuid()");
|
||||||
//遍历总文件集合
|
//遍历总文件集合
|
||||||
for (PALRepositoryModel fileModel : palTotalList) {
|
for (PALRepositoryModel fileModel : palTotalList) {
|
||||||
String PLMETHODID = fileModel.getMethodId();
|
String PLMETHODID = fileModel.getMethodId();
|
||||||
String FILEID = fileModel.getId();
|
String FILEID = fileModel.getId();
|
||||||
String PLNAME = fileModel.getName();
|
String PLNAME = fileModel.getName();
|
||||||
Timestamp MODIFYDATETIME = fileModel.getModifyDate();
|
Timestamp MODIFYDATETIME = fileModel.getModifyDate();
|
||||||
if (PLMETHODID.equals("process.framework")) {
|
if (PLMETHODID.equals("process.framework")) {
|
||||||
//更新/新增架构
|
//更新/新增架构
|
||||||
Integer FRAMELEVEL = fileModel.getLevel();
|
Integer FRAMELEVEL = fileModel.getLevel();
|
||||||
String FRAMETYPE = null;
|
String FRAMETYPE = null;
|
||||||
String FRAMEPARENTID = fileModel.getParentId();
|
String FRAMEPARENTID = fileModel.getParentId();
|
||||||
Integer FRAMEORDERINDEX = fileModel.getOrderIndex();
|
Integer FRAMEORDERINDEX = fileModel.getOrderIndex();
|
||||||
Map<String, JSONObject> frameAttrs = new HashMap<>();
|
Map<String, JSONObject> frameAttrs = new HashMap<>();
|
||||||
try {
|
try {
|
||||||
frameAttrs = new RepositoryAttribute().queryRepositoryAttributeById(FILEID);
|
frameAttrs = new RepositoryAttribute().queryRepositoryAttributeById(FILEID);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
SDK.getLogAPI().consoleInfo("更新架构时文件ID" + FILEID + "数据异常");
|
SDK.getLogAPI().consoleInfo("更新架构时文件ID" + FILEID + "数据异常");
|
||||||
}
|
}
|
||||||
if (null != frameAttrs && !frameAttrs.isEmpty()) {
|
if (null != frameAttrs && !frameAttrs.isEmpty()) {
|
||||||
JSONObject Frame_type = frameAttrs.get("Frame_type");
|
JSONObject Frame_type = frameAttrs.get("Frame_type");
|
||||||
FRAMETYPE = Frame_type.getString("text");
|
FRAMETYPE = Frame_type.getString("text");
|
||||||
}
|
}
|
||||||
|
|
||||||
fromFrameDataIDMaps.add(FILEID);
|
fromFrameDataIDMaps.add(FILEID);
|
||||||
|
|
||||||
|
if (frameIdList.contains(FILEID)) {
|
||||||
|
dataMap = new HashMap<>();
|
||||||
|
nowDateJ = new Date(System.currentTimeMillis());
|
||||||
|
Timestamp nowDateTime = new Timestamp(nowDateJ.getTime());
|
||||||
|
dataMap.put("FRAMEID", FILEID);
|
||||||
|
dataMap.put("UPDATEDATE", nowDateTime);
|
||||||
|
dataMap.put("FRAMENAME", PLNAME);
|
||||||
|
dataMap.put("FRAMELEVEL", FRAMELEVEL);
|
||||||
|
dataMap.put("FRAMETYPE", FRAMETYPE);
|
||||||
|
dataMap.put("FRAMEPARENTID", FRAMEPARENTID);
|
||||||
|
dataMap.put("FRAMEORDERINDEX", FRAMEORDERINDEX);
|
||||||
|
dataMap.put("MODIFYDATETIME", MODIFYDATETIME);
|
||||||
|
oldFrameDataMaps.add(dataMap);
|
||||||
|
} else {
|
||||||
|
dataMap = new HashMap<>();
|
||||||
|
uuId = SDK.getRuleAPI().executeAtScript("@uuid()");
|
||||||
|
dataMap.put("uuId", uuId);
|
||||||
|
dataMap.put("FRAMEID", FILEID);
|
||||||
|
dataMap.put("FRAMENAME", PLNAME);
|
||||||
|
dataMap.put("FRAMELEVEL", FRAMELEVEL);
|
||||||
|
dataMap.put("FRAMETYPE", FRAMETYPE);
|
||||||
|
dataMap.put("FRAMEPARENTID", FRAMEPARENTID);
|
||||||
|
dataMap.put("FRAMEORDERINDEX", FRAMEORDERINDEX);
|
||||||
|
dataMap.put("MODIFYDATETIME", MODIFYDATETIME);
|
||||||
|
newFrameDataMaps.add(dataMap);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//执行批量新增、修改、删除
|
||||||
|
if (null != frameIdList && !frameIdList.isEmpty()) {
|
||||||
|
for (String frameIdOfList : frameIdList) {
|
||||||
|
if (!fromFrameDataIDMaps.contains(frameIdOfList)) {
|
||||||
|
dataMap = new HashMap<>();
|
||||||
|
dataMap.put("FRAMEID", frameIdOfList);
|
||||||
|
delFrameDataMaps.add(dataMap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (null != oldFrameDataMaps && !oldFrameDataMaps.isEmpty()) {
|
||||||
|
DBSql.batchUpdate("UPDATE BO_EU_PAL_FRAME SET"
|
||||||
|
+ " FRAMENAME=:FRAMENAME, FRAMELEVEL=:FRAMELEVEL, FRAMETYPE=:FRAMETYPE, FRAMEPARENTID=:FRAMEPARENTID, FRAMEORDERINDEX=:FRAMEORDERINDEX, MODIFYDATETIME=:MODIFYDATETIME, UPDATEDATE=:UPDATEDATE WHERE FRAMEID=:FRAMEID", oldFrameDataMaps);
|
||||||
|
}
|
||||||
|
if (null != newFrameDataMaps && !newFrameDataMaps.isEmpty()) {
|
||||||
|
DBSql.batchUpdate("INSERT INTO BO_EU_PAL_FRAME(ID,FRAMEID,FRAMENAME,FRAMELEVEL,FRAMETYPE,FRAMEPARENTID,FRAMEORDERINDEX,MODIFYDATETIME) "
|
||||||
|
+ " VALUES(:uuId, :FRAMEID, :FRAMENAME, :FRAMELEVEL, :FRAMETYPE, :FRAMEPARENTID, :FRAMEORDERINDEX, :MODIFYDATETIME)", newFrameDataMaps);
|
||||||
|
}
|
||||||
|
if (null != delFrameDataMaps && !delFrameDataMaps.isEmpty()) {
|
||||||
|
DBSql.batchUpdate("DELETE FROM BO_EU_PAL_FRAME WHERE FRAMEID=:FRAMEID", delFrameDataMaps);
|
||||||
|
}
|
||||||
|
SDK.getLogAPI().consoleInfo("新增架构" + newFrameDataMaps.size());
|
||||||
|
SDK.getLogAPI().consoleInfo("修改架构" + oldFrameDataMaps.size());
|
||||||
|
SDK.getLogAPI().consoleInfo("删除架构" + delFrameDataMaps.size());
|
||||||
|
long endTime = System.currentTimeMillis();
|
||||||
|
SDK.getLogAPI().consoleInfo("结束时间" + endTime);
|
||||||
|
SDK.getLogAPI().consoleInfo("运行时间" + (endTime - startTime));
|
||||||
|
}
|
||||||
|
|
||||||
if (frameIdList.contains(FILEID)) {
|
|
||||||
dataMap = new HashMap<>();
|
|
||||||
nowDateJ = new Date(System.currentTimeMillis());
|
|
||||||
Timestamp nowDateTime = new Timestamp(nowDateJ.getTime());
|
|
||||||
dataMap.put("FRAMEID", FILEID);
|
|
||||||
dataMap.put("UPDATEDATE", nowDateTime);
|
|
||||||
dataMap.put("FRAMENAME", PLNAME);
|
|
||||||
dataMap.put("FRAMELEVEL", FRAMELEVEL);
|
|
||||||
dataMap.put("FRAMETYPE", FRAMETYPE);
|
|
||||||
dataMap.put("FRAMEPARENTID", FRAMEPARENTID);
|
|
||||||
dataMap.put("FRAMEORDERINDEX", FRAMEORDERINDEX);
|
|
||||||
dataMap.put("MODIFYDATETIME", MODIFYDATETIME);
|
|
||||||
oldFrameDataMaps.add(dataMap);
|
|
||||||
} else {
|
|
||||||
dataMap = new HashMap<>();
|
|
||||||
uuId = SDK.getRuleAPI().executeAtScript("@uuid()");
|
|
||||||
dataMap.put("uuId", uuId);
|
|
||||||
dataMap.put("FRAMEID", FILEID);
|
|
||||||
dataMap.put("FRAMENAME", PLNAME);
|
|
||||||
dataMap.put("FRAMELEVEL", FRAMELEVEL);
|
|
||||||
dataMap.put("FRAMETYPE", FRAMETYPE);
|
|
||||||
dataMap.put("FRAMEPARENTID", FRAMEPARENTID);
|
|
||||||
dataMap.put("FRAMEORDERINDEX", FRAMEORDERINDEX);
|
|
||||||
dataMap.put("MODIFYDATETIME", MODIFYDATETIME);
|
|
||||||
newFrameDataMaps.add(dataMap);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//执行批量新增、修改、删除
|
|
||||||
if (null != frameIdList && !frameIdList.isEmpty()) {
|
|
||||||
for (String frameIdOfList : frameIdList) {
|
|
||||||
if (!fromFrameDataIDMaps.contains(frameIdOfList)) {
|
|
||||||
dataMap = new HashMap<>();
|
|
||||||
dataMap.put("FRAMEID", frameIdOfList);
|
|
||||||
delFrameDataMaps.add(dataMap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (null != oldFrameDataMaps && !oldFrameDataMaps.isEmpty()) {
|
|
||||||
DBSql.batchUpdate("UPDATE BO_EU_PAL_FRAME SET"
|
|
||||||
+ " FRAMENAME=:FRAMENAME, FRAMELEVEL=:FRAMELEVEL, FRAMETYPE=:FRAMETYPE, FRAMEPARENTID=:FRAMEPARENTID, FRAMEORDERINDEX=:FRAMEORDERINDEX, MODIFYDATETIME=:MODIFYDATETIME, UPDATEDATE=:UPDATEDATE WHERE FRAMEID=:FRAMEID", oldFrameDataMaps);
|
|
||||||
}
|
|
||||||
if (null != newFrameDataMaps && !newFrameDataMaps.isEmpty()) {
|
|
||||||
DBSql.batchUpdate("INSERT INTO BO_EU_PAL_FRAME(ID,FRAMEID,FRAMENAME,FRAMELEVEL,FRAMETYPE,FRAMEPARENTID,FRAMEORDERINDEX,MODIFYDATETIME) "
|
|
||||||
+ " VALUES(:uuId, :FRAMEID, :FRAMENAME, :FRAMELEVEL, :FRAMETYPE, :FRAMEPARENTID, :FRAMEORDERINDEX, :MODIFYDATETIME)", newFrameDataMaps);
|
|
||||||
}
|
|
||||||
if (null != delFrameDataMaps && !delFrameDataMaps.isEmpty()) {
|
|
||||||
DBSql.batchUpdate("DELETE FROM BO_EU_PAL_FRAME WHERE FRAMEID=:FRAMEID", delFrameDataMaps);
|
|
||||||
}
|
|
||||||
SDK.getLogAPI().consoleInfo("新增架构" + newFrameDataMaps.size());
|
|
||||||
SDK.getLogAPI().consoleInfo("修改架构" + oldFrameDataMaps.size());
|
|
||||||
SDK.getLogAPI().consoleInfo("删除架构" + delFrameDataMaps.size());
|
|
||||||
long endTime = System.currentTimeMillis();
|
|
||||||
SDK.getLogAPI().consoleInfo("结束时间" + endTime);
|
|
||||||
SDK.getLogAPI().consoleInfo("运行时间" + (endTime - startTime));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user