文件状态批量修改,同步到权限阅览表中数据增加更新操作

This commit is contained in:
Mr-wang 2023-12-05 17:51:33 +08:00
parent 0035889de5
commit 6ee7558f5f
12 changed files with 237 additions and 70 deletions

View File

@ -14,18 +14,20 @@ public class RemoveOtherBasicDataAslp implements ASLP {
@Override
@Meta(parameter = { "name: 'sid', required: true, desc: 'sid'"})
public ResponseObject call(Map<String, Object> params) {
SDK.getLogAPI().consoleInfo("删除数据开始执行");
ResponseObject ro = ResponseObject.newWarnResponse("结果未知");
String sid = (String) params.get("sid");
if (!SDK.getPortalAPI().checkSession(sid)) {
ro = ResponseObject.newErrResponse("sid无效");
return ro;
}
String CC_ID = "58372e80-6456-40d7-9822-ec0f4e2cd7a7";
String CC_ID = "0680d5a3-16eb-439b-ac7a-d2934456ff21";
RDSAPI rdsapi;
Connection connection = null;
rdsapi = SDK.getCCAPI().getRDSAPI(CC_ID);
connection = rdsapi.open();
int update = DBSql.update("delete from aws_bpa limit 300000");
int update = DBSql.update(connection,"delete from aws_bpa limit 300000");
SDK.getLogAPI().consoleInfo("删除数据完成删除");
if (update!=0){
return ResponseObject.newOkResponse();
}else {

View File

@ -24,7 +24,6 @@ import com.awspaas.user.bpa.util.HSSFUtils;
import com.awspaas.user.bpa.util.Utils;
import org.apache.poi.hslf.usermodel.*;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.sl.draw.binding.CTGeomGuideList;
import org.apache.poi.sl.usermodel.TableCell;
import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xslf.usermodel.*;
@ -1048,7 +1047,7 @@ public class UpdatePptxAndExcelAslp implements ASLP {
private static void replaceParameter(XSSFSheet sheet, String parameter, String replacement) {
for (Row row : sheet) {
for (Cell cell : row) {
if (CellType.forInt(cell.getCellType()) == CellType.STRING) {
/*if (CellType.forInt(cell.getCellType()) == CellType.STRING) {
String cellValue = cell.getStringCellValue();
if (cellValue.contains(parameter)) {
CellStyle cellStyle = cell.getCellStyle();
@ -1056,7 +1055,7 @@ public class UpdatePptxAndExcelAslp implements ASLP {
cellStyle.setWrapText(true);
cell.setCellStyle(cellStyle);
}
}
}*/
}
}
@ -1070,7 +1069,7 @@ public class UpdatePptxAndExcelAslp implements ASLP {
private static void replaceParameter(HSSFSheet sheet, String parameter, String replacement) {
for (Row row : sheet) {
for (Cell cell : row) {
if (CellType.forInt(cell.getCellType()) == CellType.STRING) {
/*if (CellType.forInt(cell.getCellType()) == CellType.STRING) {
String cellValue = cell.getStringCellValue();
if (cellValue.contains(parameter)) {
CellStyle cellStyle = cell.getCellStyle();
@ -1078,7 +1077,7 @@ public class UpdatePptxAndExcelAslp implements ASLP {
cellStyle.setWrapText(true);
cell.setCellStyle(cellStyle);
}
}
}*/
}
}

View File

@ -0,0 +1,36 @@
package com.awspaas.user.bpa.controller;
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.server.SSOUtil;
import com.actionsoft.bpms.server.bind.annotation.Controller;
import com.actionsoft.bpms.server.bind.annotation.Mapping;
import com.actionsoft.sdk.local.SDK;
import com.actionsoft.sdk.local.api.AppAPI;
import java.util.HashMap;
import java.util.Map;
@Controller
public class RemoveOtherDataController {
@Mapping(value = "com.awspaas.user.bpa.controller.RemoveOtherDataController.RemoveOtherData",
session = false,
noSessionEvaluate = "无安全隐患",
noSessionReason = "用于删除mysql数据库的数据")
public String RemoveOtherData(String sourceAppId,String aslp,String authentication){
// aslp服务地址
String sid = new SSOUtil().registerClientSessionNoPassword("admin", "cn", "127.0.0.1", "pc");
execute("com.awspaas.user.apps.new_performance_indicator_library","aslp://com.awspaas.user.apps.new_performance_indicator_library/RemoveOtherBasicDataAslp",sid);
return "删除成功";
}
public boolean execute(String sourceAppId,String aslp,String sid) {
// 参数定义列表
Map params = new HashMap<String, Object>();
params.put("sid",sid);
AppAPI appAPI = SDK.getAppAPI();
//删除指定的三十万数据
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
return ro.isOk();
}
}

View File

@ -207,6 +207,16 @@ 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);
}
}

View File

@ -41,7 +41,7 @@ public class CreateVER_ACTIVITYJob implements IJob {
// HttpURLConnection 发送SOAP请求
System.out.println("HttpURLConnection 发送SOAP请求");
String postSoap = UtilUrls.doPostSoap("http://10.119.22.207:80/services/WorkflowService", xmlStr, "");
String postSoap = UtilUrls.doPostSoap("http://10.105.1.59:80/services/WorkflowService", xmlStr, "");
Document document = DocumentHelper.parseText(postSoap);

View File

@ -25,24 +25,29 @@ import java.nio.charset.StandardCharsets;
import java.sql.Connection;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.*;
public class SaveMoreData implements IJob {
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
String CC_ID = "58372e80-6456-40d7-9822-ec0f4e2cd7a7";
String CC_ID = "0680d5a3-16eb-439b-ac7a-d2934456ff21";
RDSAPI rdsapi;
Connection connection = null;
rdsapi = SDK.getCCAPI().getRDSAPI(CC_ID);
connection = rdsapi.open();
DBSql.update("delete from BO_EU_BPA_SPAN");
List<RowMap> maps = DBSql.getMaps("select * from APP_ACT_BPAD_P_VER_ACTIVITY order by CAST(EXT1 as int) asc");
SimpleDateFormat sdfs = new SimpleDateFormat("yyyy-MM-dd");
String format = sdfs.format(new Date());
String date = format.concat(" 00:00:00");
String sub_date = null;
try {
sub_date = dateAddYear(format);
} catch (Exception e) {
e.printStackTrace();
}
String before_date = sub_date.concat(" 00:00:00");
JSONArray jsonArray_new = new JSONArray(new LinkedList<>());
JSONObject jsonObject = new JSONObject(new LinkedHashMap());
List<BO> boss = SDK.getBOAPI().query("BO_EU_OTHER_SYSTEM_PAGE", true).addQuery("WORKFLOWID = ", maps.get(0).getString("ID").trim()).orderBy("PAGES").desc().list();
@ -67,8 +72,8 @@ public class SaveMoreData implements IJob {
jsonObject.put("workflowId", tale);
// jsonObject.put("workflowId",bo.getString("WORKFLOWID"));
//jsonObject.put("createDateStart","2019-07-01 00:00:00");//SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo()
//jsonObject.put("createDateEnd","2023-09-01 00:00:00");//processExecutionContext.getProcessInstance().getCreateUser()
jsonObject.put("createDateStart",before_date);//SDK.getORGAPI().getDepartmentByUser(processExecutionContext.getProcessInstance().getCreateUser()).getNo()
jsonObject.put("createDateEnd",date);//processExecutionContext.getProcessInstance().getCreateUser()
jsonObject.put("pageIndex", j);
jsonObject.put("pageSize", 1000);
String xmlStr = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:web=\"webservices.services.weaver.com.cn\">\n" +
@ -89,7 +94,7 @@ public class SaveMoreData implements IJob {
// HttpURLConnection 发送SOAP请求
System.out.println("HttpURLConnection 发送SOAP请求");
String postSoap = UtilUrls.doPostSoap("http://10.119.22.207:80/services/WorkflowService", xmlStr, "");
String postSoap = UtilUrls.doPostSoap("http://10.105.1.59:80/services/WorkflowService", xmlStr, "");
Document document = null;
@ -152,8 +157,16 @@ public class SaveMoreData implements IJob {
}
end_process.put("begintime", JSONObject.parseObject(jsonArray.get(i).toString()).get("operateDate"));//开始时间
end_process.put("taskinstid", JSONObject.parseObject(jsonArray.get(i).toString()).get("id"));//流程实例id
end_process.put("actionname", JSONObject.parseObject(jsonArray.get(i).toString()).get("nodeName"));
//actionname 有驳回或者什么的转成不同意 不同意 回退|退回|驳回|撤销|收回
if (JSONObject.parseObject(jsonArray.get(i).toString()).get("operateType").equals("驳回")
||JSONObject.parseObject(jsonArray.get(i).toString()).get("operateType").equals("退回")||
JSONObject.parseObject(jsonArray.get(i).toString()).get("operateType").equals("撤销")||
JSONObject.parseObject(jsonArray.get(i).toString()).get("operateType").equals("收回")||
JSONObject.parseObject(jsonArray.get(i).toString()).get("operateType").equals("回退")){
end_process.put("actionname", "不同意");
}else {
end_process.put("actionname", JSONObject.parseObject(jsonArray.get(i).toString()).get("operateType"));
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date beginDate = null;
try {
@ -166,7 +179,8 @@ public class SaveMoreData implements IJob {
try {
endDate = sdf.parse(JSONObject.parseObject(jsonArray.get(i).toString()).get("receiveDate").toString());
if (endDate!=null){
long dates = (endDate.getTime() - beginDate.getTime()) / (1000 * 60*60);
//这里转成毫秒
long dates = (endDate.getTime() - beginDate.getTime());
end_process.put("executecosttime", dates);//开始时间-结束时间如果结束时间为空,则这个时间也为空
}
} catch (ParseException e) {
@ -176,8 +190,40 @@ public class SaveMoreData implements IJob {
} else {
end_process.put("executecosttime", "");//开始时间-结束时间如果结束时间为空,则这个时间也为空
}
end_process.put("timedur", "");
end_process.put("warningtimedur", "");
if (UtilString.isNotEmpty(JSONObject.parseObject(jsonArray.get(i).toString()).get("receiveDate").toString())) {
Date endDate = null;
try {
endDate = sdf.parse(JSONObject.parseObject(jsonArray.get(i).toString()).get("receiveDate").toString());
if (endDate!=null){
//这里转成毫秒
long dates = (endDate.getTime() - beginDate.getTime());
end_process.put("timedur", dates);//开始时间-结束时间如果结束时间为空,则这个时间也为空
}
} catch (ParseException e) {
e.printStackTrace();
}
} else {
end_process.put("timedur", "");//开始时间-结束时间如果结束时间为空,则这个时间也为空
}
if (UtilString.isNotEmpty(JSONObject.parseObject(jsonArray.get(i).toString()).get("receiveDate").toString())) {
Date endDate = null;
try {
endDate = sdf.parse(JSONObject.parseObject(jsonArray.get(i).toString()).get("receiveDate").toString());
if (endDate!=null){
//这里转成毫秒
long dates = (endDate.getTime() - beginDate.getTime());
end_process.put("warningtimedur", dates);//开始时间-结束时间如果结束时间为空,则这个时间也为空
}
} catch (ParseException e) {
e.printStackTrace();
}
} else {
end_process.put("warningtimedur", "");//开始时间-结束时间如果结束时间为空,则这个时间也为空
}
String id = UUIDGener.getUUID();
String sql = "insert into aws_bpa (ID,processinstid,processdefid,processdefverid,starttime,endtime," +
"createtime,createuser," +
@ -218,4 +264,19 @@ public class SaveMoreData implements IJob {
}
}
/**
* 日期减几年
*/
public String dateAddYear(String str) throws Exception {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
Date dt = sdf.parse(str);
Calendar rightNow = Calendar.getInstance();
rightNow.setTime(dt);
rightNow.add(Calendar.YEAR, -3);// 日期减三年
Date dt1 = rightNow.getTime();
String reStr = sdf.format(dt1);
return reStr;
}
}

View File

@ -56,7 +56,7 @@ public class ThirdJob implements IJob {
// HttpURLConnection 发送SOAP请求
System.out.println("HttpURLConnection 发送SOAP请求");
String postSoap = UtilUrls.doPostSoap("http://10.119.22.207:80/services/WorkflowService", xmlStr, "");
String postSoap = UtilUrls.doPostSoap("http://10.105.1.59:80/services/WorkflowService", xmlStr, "");
Document document = null;

View File

@ -35,18 +35,21 @@ public class UpdateKnowJobs implements IJob {
for (BO bo1 : bo_act_coe_publish_n) {
String publishfileid = bo1.getString("PUBLISHFILEID");
RowMap map = DBSql.getMap("select * from APP_ACT_COE_PAL_REPOSITORY where ID = '" + publishfileid + "' AND ISPUBLISH = '1' AND ISSTOP='0'");
String ext4 = map.getString("EXT4");
RowMap map1 = DBSql.getMap("select * from app_act_kms_card where ID = '" + ext4 + "'");
if (map1 != null) {
int update = DBSql.update("delete from sys_ac where RESOURCEID = '" + ext4 + "' AND RESOURCETYPE = 'kms.card'");
SDK.getLogAPI().consoleInfo("删除ac授权文件>>>>>>>>>>" + update);
JSONArray jsonArray1 = new JSONArray();
JSONObject jsonObjecta = new JSONObject();
jsonObjecta.put("assignmentType", "company");
jsonObjecta.put("assignmentId", "8911e732-b42a-4556-853f-ad32761bcbee");
jsonArray1.add(jsonObjecta);
UserContext userContext = UserContext.fromUID("admin");
AddKnwlAC(jsonArray1, userContext.getSessionId(), ext4);
if (map!=null) {
String ext4 = map.getString("EXT4");
RowMap map1 = DBSql.getMap("select * from app_act_kms_card where ID = '" + ext4 + "'");
if (map1 != null) {
int update = DBSql.update("delete from sys_ac where RESOURCEID = '" + ext4 + "' AND RESOURCETYPE = 'kms.card'");
SDK.getLogAPI().consoleInfo("删除ac授权文件>>>>>>>>>>" + update);
JSONArray jsonArray1 = new JSONArray();
JSONObject jsonObjecta = new JSONObject();
jsonObjecta.put("assignmentType", "company");
jsonObjecta.put("assignmentId", "8911e732-b42a-4556-853f-ad32761bcbee");
jsonArray1.add(jsonObjecta);
UserContext userContext = UserContext.fromUID("admin");
AddKnwlAC(jsonArray1, userContext.getSessionId(), ext4);
}
}
}
@ -54,18 +57,21 @@ public class UpdateKnowJobs implements IJob {
for (BO bo1 : bo_act_coe_publish_c) {
String publishfileid = bo1.getString("CHANGEDFILEIDNEW");
RowMap map = DBSql.getMap("select * from APP_ACT_COE_PAL_REPOSITORY where ID = '" + publishfileid + "' AND ISPUBLISH = '1' AND ISSTOP='0'");
String ext4 = map.getString("EXT4");
RowMap map1 = DBSql.getMap("select * from app_act_kms_card where ID = '" + ext4 + "'");
if (map1 != null) {
int update = DBSql.update("delete from sys_ac where RESOURCEID = '" + ext4 + "' AND RESOURCETYPE = 'kms.card'");
SDK.getLogAPI().consoleInfo("删除ac授权文件>>>>>>>>>>" + update);
JSONArray jsonArray1 = new JSONArray();
JSONObject jsonObjecta = new JSONObject();
jsonObjecta.put("assignmentType", "company");
jsonObjecta.put("assignmentId", "8911e732-b42a-4556-853f-ad32761bcbee");
jsonArray1.add(jsonObjecta);
UserContext userContext = UserContext.fromUID("admin");
AddKnwlAC(jsonArray1, userContext.getSessionId(), ext4);
if (map!=null) {
String ext4 = map.getString("EXT4");
RowMap map1 = DBSql.getMap("select * from app_act_kms_card where ID = '" + ext4 + "'");
if (map1 != null) {
int update = DBSql.update("delete from sys_ac where RESOURCEID = '" + ext4 + "' AND RESOURCETYPE = 'kms.card'");
SDK.getLogAPI().consoleInfo("删除ac授权文件>>>>>>>>>>" + update);
JSONArray jsonArray1 = new JSONArray();
JSONObject jsonObjecta = new JSONObject();
jsonObjecta.put("assignmentType", "company");
jsonObjecta.put("assignmentId", "8911e732-b42a-4556-853f-ad32761bcbee");
jsonArray1.add(jsonObjecta);
UserContext userContext = UserContext.fromUID("admin");
AddKnwlAC(jsonArray1, userContext.getSessionId(), ext4);
}
}
}

View File

@ -1,8 +1,11 @@
package com.awspaas.user.bpa.job;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.schedule.IJob;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.sdk.local.SDK;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
@ -11,28 +14,19 @@ import java.util.List;
public class UpdateSysAcJob implements IJob {
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
List<RowMap> maps = DBSql.getMaps("select distinct RESOURCEID from sys_ac where RESOURCETYPE = 'kms.card'");
List<RowMap> maps1 = DBSql.getMaps("select distinct ID from app_act_kms_card");
boolean flag = false;
String flag_id = "";
for (RowMap rowMap:maps1) {
String id = rowMap.getString("ID");
for (RowMap rowMap1:
maps) {
String id1 = rowMap1.getString("ID");
flag_id = id1;
if (id1.equals(id)){
flag = true;
break;
}
}
if (flag == true){
continue;
}
if (flag == false){
DBSql.update("delete from sys_ac where RESOURCETYPE = 'kms.card' and RESOURCEID = '"+flag_id+"'");
List<RowMap> maps1 = DBSql.getMaps("select distinct RESOURCEID from sys_ac where RESOURCETYPE = 'kms.card' and RESOURCEID not in (select distinct ID from app_act_kms_card)");
DBSql.update("delete from BO_EU_RESOURCEID");
for (RowMap map:maps1){
BO bo = new BO();
bo.set("RESOURCEID",map.getString("RESOURCEID"));
SDK.getBOAPI().createDataBO("BO_EU_RESOURCEID",bo, UserContext.fromUID("admin"));
}
List<BO> bo_eu_resourceid = SDK.getBOAPI().query("BO_EU_RESOURCEID").list();
for (BO bo:bo_eu_resourceid) {
String resourceid = bo.getString("RESOURCEID");
DBSql.update("delete from sys_ac where RESOURCETYPE = 'kms.card' and RESOURCEID = '"+resourceid+"'");
}
System.out.println("删除成功>>>>>>>>>>");
}
}

View File

@ -0,0 +1,59 @@
package com.awspaas.user.bpa.job;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.commons.mvc.view.ResponseObject;
import com.actionsoft.bpms.schedule.IJob;
import com.actionsoft.bpms.server.SSOUtil;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.sdk.local.SDK;
import com.actionsoft.sdk.local.api.AppAPI;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class UpdateWorkProcessJob implements IJob {
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
List<BO> bo_eu_work_process = SDK.getBOAPI().query("BO_EU_WORK_PROCESS", true).list();
for (BO bo :
bo_eu_work_process) {
String user_id = bo.getString("USER_ID");
String process_ids = bo.getString("PROCESS_ID");
String[] split = process_ids.split(",");
SSOUtil ssoUtil = new SSOUtil();
String sessionId = ssoUtil.registerClientSessionNoPassword(user_id, "cn",SDK.getPortalAPI().getPortalUrl(), "pc");
for (String process_id :
split) {
JSONObject jsonObject1 = new JSONObject();
jsonObject1.put("processDefId", process_id);
execute(sessionId,jsonObject1);
}
}
}
public boolean execute(String sid,JSONObject processData) {
// 调用App
String sourceAppId = "com.awspaas.user.apps.new_performance_indicator_library";
// aslp服务地址
String aslp = "aslp://com.actionsoft.apps.workbench/AddCommonProcessASLP";
// 参数定义列表
Map params = new HashMap<String, Object>();
//jsonobject结构流程信息包括processDefIdprocessNameicon信息,必填
params.put("processData", processData.toString());
//sessionId,必填
params.put("sid", sid);
AppAPI appAPI = SDK.getAppAPI();
//添加常用流程
ResponseObject ro = appAPI.callASLP(appAPI.getAppContext(sourceAppId), aslp, params);
System.out.println("是否更新成功>>>>>>>>>>"+ro.isOk());
return ro.isOk();
}
}

View File

@ -163,7 +163,7 @@ public class HSSFUtils {
newExcelCell.setCellComment(tmpCell.getCellComment());
}
// 不同数据类型处理
CellType tmpCellType = CellType.forInt(tmpCell.getCellType());
CellType tmpCellType = CellType.forInt(1);
newExcelCell.setCellType(tmpCellType);
if (tmpCellType == CellType.NUMERIC) {

View File

@ -159,7 +159,7 @@ public class Utils {
newExcelCell.setCellComment(tmpCell.getCellComment());
}
// 不同数据类型处理
CellType tmpCellType = CellType.forInt(tmpCell.getCellType());
CellType tmpCellType = CellType.forInt(1);
newExcelCell.setCellType(tmpCellType);
if (tmpCellType == CellType.NUMERIC) {