异常岗位数据插入日志

This commit is contained in:
zhal 2022-10-28 12:12:28 +08:00
parent 868b561924
commit dac9c4bf3f
2 changed files with 133 additions and 0 deletions

View File

@ -0,0 +1,133 @@
package com.actionsoft.apps.coe.pal.batch;
import com.actionsoft.apps.coe.pal.pal.repository.designer.manage.CoeDesignerAPIManager;
import com.actionsoft.apps.coe.pal.pal.repository.designer.model.BaseModel;
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil;
import com.actionsoft.bpms.bo.engine.BO;
import com.actionsoft.bpms.bpmn.engine.model.run.delegate.ProcessInstance;
import com.actionsoft.bpms.commons.database.RowMap;
import com.actionsoft.bpms.schedule.IJob;
import com.actionsoft.bpms.server.Quota;
import com.actionsoft.bpms.server.UserContext;
import com.actionsoft.bpms.util.DBSql;
import com.actionsoft.sdk.local.SDK;
import com.alibaba.fastjson.JSONObject;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class getPortJob implements IJob {
static int postCount=0;
static int orgindex = 0;
private UserContext _uc;
/**
* 同步组织架构数据
* 更新组织名称/数量更新岗位名称/数量
* @param jobExecutionContext
* @throws JobExecutionException
*/
@Override
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
Connection conn = DBSql.open();
List<RowMap> rowMaprole= DBSql.getMaps("SELECT ID,PLNAME,EXT1 FROM APP_ACT_COE_PAL_REPOSITORY WHERE PLCATEGORY='org' AND PLMETHODID='org.normal'");
if(rowMaprole!=null){
for(int i=0;i<rowMaprole.size();i++){
try {
if(!rowMaprole.get(i).getString("PLNAME").equals("内蒙古伊利实业集团股份有限公司") || !rowMaprole.get(i).getString("PLNAME").equals("总部")){
List<String> data2=new ArrayList();
List<RowMap> orgdepartmentList = DBSql.getMaps(conn, "select DESCR,DEPTNAME from BO_EU_ORG_POSTS WHERE DEPTID=? AND DESCR IS NOT NULL ", rowMaprole.get(i).getString("ID"));
if(orgdepartmentList.size()>0){
for(int l=0;l<orgdepartmentList.size();l++){
data2.add(orgdepartmentList.get(l).getString("DESCR").toString());
}
}
List<Map<String, Object>> fileElements = CoeDesignerUtil.getShapeMessageJson4(rowMaprole.get(i).getString("ID"));
if(fileElements.size()>0){
for (Map<String, Object> str : fileElements) {
if (!data2.contains(str.get("name").toString().trim())) {//如果存在这个数
ProcessInstance processInst = SDK.getProcessAPI().createBOProcessInstance("obj_06769365dafb4a65b284cbf729137a5a", _uc.getUID(), "指标绩效数据插入");
BO bo=new BO();
bo.set("POSTNAM",str.get("name"));
bo.set("DEPTID",rowMaprole.get(i).getString("EXT1"));
bo.set("DEPTNAME",rowMaprole.get(i).getString("PLNAME"));
bo.set("ISEXIST","1");
SDK.getBOAPI().create("BO_EU_POST_DATA",bo,processInst.getId(),"");
}else{
ProcessInstance processInst = SDK.getProcessAPI().createBOProcessInstance("obj_06769365dafb4a65b284cbf729137a5a", _uc.getUID(), "指标绩效数据插入");
BO bo=new BO();
bo.set("POSTNAM",str.get("name"));
bo.set("DEPTID",rowMaprole.get(i).getString("EXT1"));
bo.set("DEPTNAME",rowMaprole.get(i).getString("PLNAME"));
bo.set("ISEXIST","0");
SDK.getBOAPI().create("BO_EU_POST_DATA",bo,processInst.getId(),"");
}
postCount++;
}
}
}
} catch (Exception e) {
e.printStackTrace();
System.out.println("异常为=========="+rowMaprole.get(i).toString());
}
orgindex++;
}
}
System.out.println("岗位模型数量为========="+orgindex);
System.out.println("岗位形状数量为========="+postCount);
}
/**
* 根据当前许可环境获取当前wsid
* @return
*/
public String queryMaPublishGetWsId(){
String wsId = null;
boolean dev = Quota.isDEV();
if(dev==true){
wsId="0285ff6a-e418-4d8b-a5b1-22240296f769";
}
boolean prd=Quota.isPRD();
if(prd==true){
wsId="7d3ca852-a0bd-42e6-80b1-3dcea6f55083";
}
boolean qas=Quota.isQAS();
if(qas==true){
wsId="7d3ca852-a0bd-42e6-80b1-3dcea6f55083";
}
return wsId;
}
}