岗位批处理导入

This commit is contained in:
446052889@qq.com 2022-08-10 13:11:37 +08:00
parent 87d06d636e
commit 2bdfbacf46
3 changed files with 14 additions and 14 deletions

View File

@ -120,13 +120,13 @@ public class PositionExcelImportRun {
if (!arisNameMap.containsKey(processName)) {
// Excel中的流程在PAL中不存在当作警告处理全部记录
LogUtil.appendLog(Constant.LOG_WARNING + "Excel流程" + "[" + processName + "]未在PAL中找到忽略导入", simpleLogFile, fullLogFile, warnLogFile);
LogUtil.appendLog("[Excel流程未找到]Excel流程" + "[" + processName + "]", matchErrImportFile);
LogUtil.appendLog("[流程未找到]Excel流程" + "[" + processName + "]", matchErrImportFile);
LogRealTimeCountCache.getCache().get(logId).setArisBlankCount(LogRealTimeCountCache.getCache().get(logId).getArisBlankCount() + 1);// 借用ArisBlankCount
continue;
}
String palId = arisNameMap.get(processName);
List<DesignerShapeRelationModel> insertModels = new ArrayList<>();// 匹配上待保存的数据
List<DesignerShapeRelationModel> delModels = null;// 待删除的数据Excel中存在代表要更新/删除
List<DesignerShapeRelationModel> delModels = new ArrayList<>();// 待删除的数据Excel中存在代表要更新/删除
// 获取pal流程的形状信息以及形状对应的角色信息
List<PalShapeInfoModel> palShapeInfoModelList = new ArrayList<>();
@ -160,7 +160,10 @@ public class PositionExcelImportRun {
if (matched) {
// 匹配上了形状和角色
// 先记录删除即Excel中存在但岗位为空则默认为清空该角色下的岗位属性
delModels = DesignerShapeRelationCache.getListByAttrId(matchPal.getRoleRepositoryId(), matchPal.getRoleShapeId(), Constant.METHOD_POST);
List<DesignerShapeRelationModel> tmpList = DesignerShapeRelationCache.getListByAttrId(matchPal.getRoleRepositoryId(), matchPal.getRoleShapeId(), Constant.METHOD_POST);
if (tmpList != null && tmpList.size() > 0) {
delModels.addAll(tmpList);
}
// 查询对应的岗位是否存在
List<String> positionList = model.getPositionList();
if (positionList.size() == 0) {
@ -177,8 +180,8 @@ public class PositionExcelImportRun {
DesignerShapeRelationModel newModel = new DesignerShapeRelationModel();
newModel.setId(UUIDGener.getUUID());
newModel.setFileId(matchPal.getRoleRepositoryId());
newModel.setShapeId(matchPal.getShapeId());
newModel.setShapeText(matchPal.getShapeName());
newModel.setShapeId(matchPal.getRoleShapeId());
newModel.setShapeText(matchPal.getRoleShapeName());
newModel.setAttrId(Constant.METHOD_POST);
newModel.setRelationFileId(positionModel.getOrgId());
newModel.setRelationShapeId(positionModel.getPositionId());
@ -200,7 +203,7 @@ public class PositionExcelImportRun {
if (delModels.size() > 0) {
relationDao.batchDeleteRelationListById(delModels);
for (DesignerShapeRelationModel relation : delModels) {
String name = relation.getAttrId();
String name = relation.getShapeText();
String posNmae = relation.getRelationShapeText();
String value = relation.toString();
LogUtil.appendLog(Constant.LOG_SUCCESS + "流程[" + processName + "]的活动涉及到的角色[" + name + "]原有的关联岗位[" + posNmae + "]删除", simpleLogFile, fullLogFile);
@ -227,7 +230,7 @@ public class PositionExcelImportRun {
boolean insertRelation = relationDao.barchInsert(insertModels);
if (insertRelation) {
for (DesignerShapeRelationModel relation : insertModels) {
String name = relation.getAttrId();
String name = relation.getShapeText();
String posNmae = relation.getRelationShapeText();
String value = relation.toString();
LogUtil.appendLog(Constant.LOG_SUCCESS + "流程[" + processName + "]的活动涉及到的角色[" + name + "]原有的关联岗位[" + posNmae + "]更新", simpleLogFile, fullLogFile);
@ -240,9 +243,6 @@ public class PositionExcelImportRun {
}
LogUtil.appendLog(Constant.LOG_END + "[新增]流程[" + processName + "]活动对应角色关联的岗位", simpleLogFile, fullLogFile);
LogUtil.appendLog("\n" + Constant.LOG_START + "************[执行阶段][流程匹配阶段]PAL过程链图与Excel中流程进行匹配************", simpleLogFile, fullLogFile);
// 记录流程导入结束日志
LogRealTimeCountCache.getCache().get(logId).setSuccessCount(LogRealTimeCountCache.getCache().get(logId).getSuccessCount() + 1);
LogUtil.appendLog(Constant.LOG_END + "保存PAL流程[" + processName + "]的的活动角色关联的岗位", simpleLogFile, fullLogFile, successLogFile);

View File

@ -300,7 +300,7 @@ public class PositionExcelImportWeb extends ActionWeb {
for (PALRepositoryModel posModel : posList) {
List<JSONObject> shapeList = CoeDesignerUtil.getShapeMessageJson5(posModel.getId());
for (JSONObject shape : shapeList) {
if ("position".equals(shape.getString("name"))) {
if ("position".equals(shape.getString("type"))) {
PalOrgPositionModel positionModel = new PalOrgPositionModel();
positionModel.setOrgId(posModel.getId());
positionModel.setOrgName(posModel.getName());
@ -320,7 +320,7 @@ public class PositionExcelImportWeb extends ActionWeb {
for (PalOrgPositionModel positionModel : entry.getValue()) {
nameList.add(positionModel.getOrgName());
}
LogUtil.appendLog(Constant.LOG_ERROR + "同一岗位名称[" + entry.getKey() + "]对应多个PAL组织岗位图[" + StringUtils.join(nameList, "") + "]", simpleLogFile, fullLogFile, simpleLogFile, fullLogFile);
LogUtil.appendLog(Constant.LOG_ERROR + "检测到PAL中岗位[" + entry.getKey() + "]在PAL的组织图中存在多个涉及到的组织图[" + StringUtils.join(nameList, "") + "]", simpleLogFile, fullLogFile, simpleLogFile, fullLogFile);
isOk = false;
}
}
@ -491,12 +491,12 @@ public class PositionExcelImportWeb extends ActionWeb {
private ResponseObject checkExcelTitle(List<String> titleList) {
ResponseObject ro = ResponseObject.newOkResponse();
if (titleList.size() < PositionConstant.EXCEL_TITLE_ROW_ARR.length) {
ro.err("上传文件工作表中标题行错误,请按照" + PositionConstant.EXCEL_TITLE_ROW + "的格式填写");
ro.err("上传文件工作表中标题行错误,请按照" + PositionConstant.EXCEL_TITLE_ROW + "的格式填写当前Excel列名" + StringUtils.join(titleList, ""));
return ro;
}
for (int i = 0; i < PositionConstant.EXCEL_TITLE_ROW_ARR.length; i++) {
if (!PositionConstant.EXCEL_TITLE_ROW_ARR[i].equals(titleList.get(i))) {
ro.err("上传文件工作表中标题行错误,请按照" + PositionConstant.EXCEL_TITLE_ROW + "的格式填写,若有隐藏列,请移动至最后");
ro.err("上传文件工作表中标题行错误,请按照" + PositionConstant.EXCEL_TITLE_ROW + "的格式填写,若有隐藏列,请移动至最后当前Excel列名" + StringUtils.join(titleList, ""));
return ro;
}
}