文件批量状态修改更新作废人、作废时间字段

This commit is contained in:
zhal 2024-08-08 14:50:59 +08:00
parent ce6505c24d
commit 333e05903e
2 changed files with 55 additions and 30 deletions

View File

@ -6,6 +6,7 @@ import com.actionsoft.apps.coe.pal.pal.output.extend.OutputAppManager;
import com.actionsoft.apps.coe.pal.pal.output.extend.OutputAppProfile;
import com.actionsoft.apps.coe.pal.pal.output.model.OutputTaskModel;
import com.actionsoft.apps.coe.pal.pal.repository.dao.CoeProcessLevelDaoFacotory;
import com.actionsoft.apps.coe.pal.pal.repository.dao.PALRepositoryPropertyDao;
import com.actionsoft.apps.coe.pal.pal.repository.upfile.model.UpfileModel;
import com.actionsoft.apps.coe.pal.pal.repository.upfile.web.UpfileWeb;
import com.actionsoft.apps.coe.pal.system.util.StringUtil;
@ -213,10 +214,6 @@ public class UpateFileStateController {
System.err.println("停用改设计=======>" + updataSql);
count = DBSql.update(updataSql);
PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plId);
if (plModel != null) {
PALRepositoryCache.getCache().put(plId, plModel);
}
RowMap map = DBSql.getMap("SELECT * FROM APP_ACT_COE_PAL_REPOSITORY WHERE ID = '" + plId + "'");
String ext4 = map.getString("EXT4");
@ -228,6 +225,39 @@ public class UpateFileStateController {
}
SDK.getLogAPI().consoleInfo("更新状态后刷新缓存结束===========>");
//更新作废人
PALRepositoryPropertyDao propertyDao = new PALRepositoryPropertyDao();
BO bo_act_coe_publish_s = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH_S").addQuery("STOPFILEID=", plId).detail();
String bindid=bo_act_coe_publish_s.getBindId();
BO publish = SDK.getBOAPI().query("BO_ACT_COE_PUBLISH").detailByBindId(bindid);
String sql = "insert into APP_ACT_COE_PAL_SHAPE_RLAT (ID,FILEID,ATTRID,RELATIONFILEID,RELATIONSHAPEID,RELATIONSHAPETEXT) values ('%s', '%s', '%s','%s','%s','%s')";
JSONObject js=new JSONObject();
js.put("name", publish.getString("APPLYUSERNAME"));
js.put("id", publish.getString("APPLYUSERID"));
js.put("type", "user");
String id = UUIDGener.getUUID();
int update = DBSql.update(String.format(sql, id, plId, "nullifier","00000000-0000-0000-0000-000000000000","00000000-0000-0000-0000-000000000000",js));
//作废时间
Date cancelDate=new Date();
SimpleDateFormat sdfs = new SimpleDateFormat("yyyy-MM-dd");
propertyDao.updatePropertyByPropertyId(plId, "obsolescence_time", sdfs.format(cancelDate));
PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(plId);
if (plModel != null) {
PALRepositoryCache.getCache().put(plId, plModel);
}
}
}
@ -281,22 +311,12 @@ public class UpateFileStateController {
}
ProcessInstance processInst = SDK.getProcessAPI().createBOProcessInstance("obj_e076b01bd0d04bc39e5af12e2c8c188c", me.getUID(), "权限阅览");
SDK.getBOAPI().create("BO_ACT_PUBLISH_PERM_SCOPE", scopeBo, processInst, me);
}else{
oldBo.set("PALVERSIONID" , plVersionid);
oldBo.set("PALNAME" , parentModel.getName());
//oldBo.set("PERMTYPE" , "0");
String sql = "select * from APP_ACT_COE_PAL_REPOSITORY where ID = '"+palId+"'";
RowMap map = DBSql.getMap(sql);
if (map!=null){
oldBo.set("ORGPERM" ,map.getString("EXT6"));
}
SDK.getBOAPI().update("BO_ACT_PUBLISH_PERM_SCOPE", oldBo);
}
}
private String createOutputReport(PALRepositoryModel model, String wsId, String userId, String teamId, String uuid) {
String taskId = "";
if (model.getMethodId().contains("process.")) {
if (model.getMethodId().contains("process.") && !"process.scheme".equals(model.getMethodId())) {
taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportPr(wsId, userId, teamId, uuid);
JSONObject object = JSONObject.parseObject(taskId);
if ("ok".equals(object.getString("result"))) {
@ -308,7 +328,7 @@ public class UpateFileStateController {
if ("ok".equals(object.getString("result"))) {
taskId = object.getJSONObject("data").getString("taskId");
}
} else if ("control.policy".equals(model.getMethodId())) {
} else if ("control.policy".equals(model.getMethodId()) || "engineering.standard".equals(model.getMethodId()) || "process.scheme".equals(model.getMethodId())) {
taskId = PALRepositoryQueryAPIManager.getInstance().createOutputReportZd(wsId, userId, teamId, uuid);
JSONObject object = JSONObject.parseObject(taskId);
if ("ok".equals(object.getString("result"))) {
@ -322,24 +342,29 @@ public class UpateFileStateController {
int count = 0;
int count2 = 0;
try {
Map<String, JSONObject> queryRepositoryAttributeById = new RepositoryAttribute().queryRepositoryAttributeById(id);
if (null != queryRepositoryAttributeById && !queryRepositoryAttributeById.isEmpty()) {
/**
* 更新部门视图EXT6字段
*/
List<RowMap> rlatRowMap=DBSql.getMaps("SELECT RELATIONSHAPETEXT FROM APP_ACT_COE_PAL_SHAPE_RLAT where FILEID = '"+id+"' and ATTRID='Issuing_department'");
if(rlatRowMap.size()>0){
// 发布部门
String dempId = "";
JSONObject Issuing_department = queryRepositoryAttributeById.get("Issuing_department");
if (null != Issuing_department && !Issuing_department.equals("")) {
JSONArray PUBDEPTJA = Issuing_department.getJSONArray("value");
//SDK.getLogAPI().consoleInfo(Issuing_department.toString());
if (null != PUBDEPTJA && !PUBDEPTJA.isEmpty()) {
for (Object PUBDEPTO : PUBDEPTJA) {
JSONObject PUBDEPTJO = JSONObject.parseObject(String.valueOf(PUBDEPTO));
dempId += PUBDEPTJO.getString("id")+",";
}
dempId = dempId.substring(0,dempId.length()-1);
count2 += DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6 = TO_CLOB('"+dempId+"') WHERE ID = '"+id+"'");
}
for(RowMap oneRowMap:rlatRowMap){
String relationshapetext=oneRowMap.getString("RELATIONSHAPETEXT");
JSONObject js=JSONObject.parseObject(relationshapetext);
dempId += js.getString("id") + ",";
}
dempId = dempId.substring(0, dempId.length() - 1);
count2 += DBSql.update("UPDATE APP_ACT_COE_PAL_REPOSITORY SET EXT6 = TO_CLOB('" + dempId + "') WHERE ID = '" + id + "'");
PALRepositoryModel plModel = CoeProcessLevelDaoFacotory.createCoeProcessLevel().getInstance(id);
if (plModel != null) {
PALRepositoryCache.getCache().put(id, plModel);
}
}
} catch (Exception e) {
// TODO: handle exception
}