|
@@ -3,6 +3,7 @@ package com.kingdee.eas.custom.attendanceexception.task;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.kingdee.bos.metadata.entity.*;
|
|
|
+import com.kingdee.bos.metadata.query.util.CompareType;
|
|
|
import com.kingdee.eas.basedata.org.AdminOrgUnitCollection;
|
|
|
import com.kingdee.eas.basedata.org.AdminOrgUnitFactory;
|
|
|
import com.kingdee.eas.basedata.org.AdminOrgUnitInfo;
|
|
@@ -13,7 +14,6 @@ import com.kingdee.eas.custom.attendanceexception.bizEnum.PushTypeEnum;
|
|
|
import com.kingdee.eas.fi.arap.util.DBUtil;
|
|
|
import com.kingdee.eas.hr.ats.AttendanceFileCollection;
|
|
|
import com.kingdee.eas.hr.ats.AttendanceFileFactory;
|
|
|
-import com.kingdee.eas.hr.ats.AttendanceFileInfo;
|
|
|
import com.kingdee.eas.hr.ats.IAttendanceFile;
|
|
|
import com.kingdee.eas.hr.ats.util.AtsDateUtils;
|
|
|
import com.kingdee.jdbc.rowset.IRowSet;
|
|
@@ -106,13 +106,13 @@ public class AttendanceExceptionFacadeControllerBean extends AbstractAttendanceE
|
|
|
pushAttendanceExceptionData(syncAttendanceDataBeans, logInfo);
|
|
|
} catch (Exception e) {
|
|
|
String message = e.getMessage();
|
|
|
- logInfo.setPushStatus(CallStatusEnum.failure);
|
|
|
- logInfo.setPushResult(message);
|
|
|
logger.error("员工个人异常提醒报错 " + message, e);
|
|
|
if (message.contains("connect timed out")) {
|
|
|
iAttendanceExceptionLog.save(logInfo);
|
|
|
break;
|
|
|
}
|
|
|
+ logInfo.setPushStatus(CallStatusEnum.failure);
|
|
|
+ logInfo.setPushResult(message);
|
|
|
}
|
|
|
//保存消息记录
|
|
|
iAttendanceExceptionLog.save(logInfo);
|
|
@@ -190,13 +190,13 @@ public class AttendanceExceptionFacadeControllerBean extends AbstractAttendanceE
|
|
|
addRemindRecord(ctx, yearMonth, personNumber);
|
|
|
} catch (Exception e) {
|
|
|
String message = e.getMessage();
|
|
|
- logInfo.setPushStatus(CallStatusEnum.failure);
|
|
|
- logInfo.setPushResult(message);
|
|
|
logger.error("提醒员工累计异常报错: " + message, e);
|
|
|
if (message.contains("connect timed out")) {
|
|
|
iAttendanceExceptionLog.save(logInfo);
|
|
|
break;
|
|
|
}
|
|
|
+ logInfo.setPushStatus(CallStatusEnum.failure);
|
|
|
+ logInfo.setPushResult(message);
|
|
|
}
|
|
|
//保存消息记录
|
|
|
iAttendanceExceptionLog.save(logInfo);
|
|
@@ -227,11 +227,7 @@ public class AttendanceExceptionFacadeControllerBean extends AbstractAttendanceE
|
|
|
//中心负责人关系表
|
|
|
ICenterLeaderRelation iCenterLeaderRelation = CenterLeaderRelationFactory.getLocalInstance(ctx);
|
|
|
//获取中心负责人
|
|
|
- Map<String, Set<String>> leaders = iCenterLeaderRelation.getLeaders();
|
|
|
- //获取各中心考勤人数
|
|
|
- Map<String, Integer> attendanceCountMap = getAttendanceCount(ctx);
|
|
|
- //获取中心名称
|
|
|
- Map<String, String> orgMap = getOrgMap(ctx);
|
|
|
+ Map<String, String> leaders = iCenterLeaderRelation.getLeaders();
|
|
|
PushTypeEnum pushTypeEnum = PushTypeEnum.CENTERLEADERREMINDER;
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd E HH:mm:ss");
|
|
|
//获取考勤异常数据,本周周一至周五中心考勤异常数据
|
|
@@ -247,36 +243,65 @@ public class AttendanceExceptionFacadeControllerBean extends AbstractAttendanceE
|
|
|
//}
|
|
|
logger.error("_alertLeaderExceptionTotal endDate: " + sdf.format(endDate));
|
|
|
//1.查询异常数据
|
|
|
- Map<String, Map<String, Integer>> exceptionCountMap = new HashMap<>();
|
|
|
- Map<String, List<SyncAttendanceDataBean>> exceptionData = getAttendanceExceptionDataForLeader(ctx, monday, endDate, exceptionCountMap);
|
|
|
+ List<Map<String, Object>> exceptionDataList = getAttendanceExceptionDataForLeader(ctx, monday, endDate);
|
|
|
String mondayFormat = DateTimeUtils.format(monday, "yyyy年MM月dd日");
|
|
|
String endDateFormat = DateTimeUtils.format(endDate, "yyyy年MM月dd日");
|
|
|
- for (String centerNumber : exceptionData.keySet()) {
|
|
|
- String msgId = UUID.randomUUID().toString();
|
|
|
+ for (String orgLongNumber : leaders.keySet()) {
|
|
|
AttendanceExceptionLogInfo logInfo = new AttendanceExceptionLogInfo();
|
|
|
+ String msgId = UUID.randomUUID().toString();
|
|
|
logInfo.setMessageId(msgId);
|
|
|
logInfo.setPushType(pushTypeEnum);
|
|
|
try {
|
|
|
- Set<String> alertUserSet = leaders.get(centerNumber);
|
|
|
- String orgName = orgMap.getOrDefault(centerNumber, "中心");
|
|
|
- //中心负责人
|
|
|
- String alertUsers = convertSetToString(alertUserSet);
|
|
|
+ //获取组织名称
|
|
|
+ AdminOrgUnitInfo orgInfo = getOrgInfo(ctx, orgLongNumber);
|
|
|
+ String orgName = orgInfo.getName();
|
|
|
+ //负责人
|
|
|
+ String alertUsers = leaders.get(orgLongNumber);
|
|
|
if (StringUtils.isBlank(alertUsers)) {
|
|
|
throw new BOSException(orgName + "的负责人为空!");
|
|
|
}
|
|
|
- //中心考勤总人数
|
|
|
- Integer attendanceCount = attendanceCountMap.getOrDefault(centerNumber, 0);
|
|
|
- Map<String, Integer> orgExceptionTimes = exceptionCountMap.get(centerNumber);
|
|
|
+ //考勤总人数(包含下级)
|
|
|
+ Integer attendanceCount = getAttendanceCount(ctx, orgLongNumber);
|
|
|
//迟到人数
|
|
|
- Integer lateEmployees = orgExceptionTimes.getOrDefault("lateEmployees", 0);
|
|
|
+ Set<String> lateEmployees = new HashSet<>();
|
|
|
//早退人数
|
|
|
- Integer earlyLeaveEmployees = orgExceptionTimes.getOrDefault("earlyLeaveEmployees", 0);
|
|
|
+ Set<String> earlyLeaveEmployees = new HashSet<>();
|
|
|
//旷工人数
|
|
|
- Integer absentEmployees = orgExceptionTimes.getOrDefault("absentEmployees", 0);
|
|
|
+ Set<String> absentEmployees = new HashSet<>();
|
|
|
//个人原因补卡人数
|
|
|
- //Integer personalRecheckCountEmployees = orgExceptionTimes.getOrDefault("personalRecheckCountEmployees", 0);
|
|
|
+ //Set<String> personalRecheckCountEmployees = new HashSet<>();
|
|
|
//异常人数
|
|
|
- Integer exceptionEmployees = orgExceptionTimes.getOrDefault("exceptionEmployees", 0);
|
|
|
+ Set<String> exceptionEmployees = new HashSet<>();
|
|
|
+ //遍历人员
|
|
|
+ List<SyncAttendanceDataBean> syncAttendanceDataBeans = new ArrayList<>();
|
|
|
+ exceptionDataList.stream().forEach(map -> {
|
|
|
+ SyncAttendanceDataBean exceptionDataBean = (SyncAttendanceDataBean) map.get("data");
|
|
|
+ //部门长编码
|
|
|
+ String departmentManagerCode = exceptionDataBean.getDepartmentManagerCode();
|
|
|
+ if (departmentManagerCode.startsWith(orgLongNumber)) {
|
|
|
+ Map<String, Boolean> attendanceFlags = (Map<String, Boolean>) map.get("attendanceFlags");
|
|
|
+ String personNumber = exceptionDataBean.getEmployeeId();
|
|
|
+ exceptionDataBean.setMsgId(msgId);
|
|
|
+ syncAttendanceDataBeans.add(exceptionDataBean);
|
|
|
+ exceptionEmployees.add(personNumber);
|
|
|
+ if (attendanceFlags.get("lateEmployees")) {
|
|
|
+ //迟到
|
|
|
+ lateEmployees.add(personNumber);
|
|
|
+ }
|
|
|
+ if (attendanceFlags.get("earlyLeaveEmployees")) {
|
|
|
+ //早退
|
|
|
+ earlyLeaveEmployees.add(personNumber);
|
|
|
+ }
|
|
|
+ if (attendanceFlags.get("absentEmployees")) {
|
|
|
+ //旷工
|
|
|
+ absentEmployees.add(personNumber);
|
|
|
+ }
|
|
|
+// if(attendanceFlags.get("personalRecheckCountEmployees")){
|
|
|
+// //个人原因补卡
|
|
|
+// personalRecheckCountEmployees.add(personNumber);
|
|
|
+// }
|
|
|
+ }
|
|
|
+ });
|
|
|
//发送异常消息
|
|
|
JSONObject dingMsgBean = new JSONObject();
|
|
|
dingMsgBean.put("msgTempCode", "work_notice_01");
|
|
@@ -288,33 +313,31 @@ public class AttendanceExceptionFacadeControllerBean extends AbstractAttendanceE
|
|
|
param.put("msgId", msgId);
|
|
|
//时间
|
|
|
param.put("time", mondayFormat + "-" + endDateFormat);
|
|
|
- //中心考勤人数
|
|
|
+ //考勤总人数
|
|
|
param.put("centerNum", attendanceCount);
|
|
|
//考勤异常人数
|
|
|
- param.put("eorNum", exceptionEmployees);
|
|
|
+ param.put("eorNum", exceptionEmployees.size());
|
|
|
//迟到人数
|
|
|
- param.put("lateNum", lateEmployees);
|
|
|
+ param.put("lateNum", lateEmployees.size());
|
|
|
//早退人数
|
|
|
- param.put("earlyNum", earlyLeaveEmployees);
|
|
|
+ param.put("earlyNum", earlyLeaveEmployees.size());
|
|
|
//旷工人数
|
|
|
- param.put("hookyNum", absentEmployees);
|
|
|
+ param.put("hookyNum", absentEmployees.size());
|
|
|
+ //中心
|
|
|
+ param.put("depart", orgName);
|
|
|
dingMsgBean.put("param", param);
|
|
|
sendAttendanceExceptionMsg(dingMsgBean, logInfo);
|
|
|
//推送异常数据
|
|
|
- List<SyncAttendanceDataBean> syncAttendanceDataBeans = exceptionData.get(centerNumber);
|
|
|
- syncAttendanceDataBeans.stream().forEach(syncAttendanceDataBean -> {
|
|
|
- syncAttendanceDataBean.setMsgId(msgId);
|
|
|
- });
|
|
|
pushAttendanceExceptionData(syncAttendanceDataBeans, logInfo);
|
|
|
} catch (Exception e) {
|
|
|
String message = e.getMessage();
|
|
|
- logInfo.setPushStatus(CallStatusEnum.failure);
|
|
|
- logInfo.setPushResult(message);
|
|
|
logger.error("提醒中心负责人累计异常报错 " + message, e);
|
|
|
if (message.contains("connect timed out")) {
|
|
|
iAttendanceExceptionLog.save(logInfo);
|
|
|
break;
|
|
|
}
|
|
|
+ logInfo.setPushStatus(CallStatusEnum.failure);
|
|
|
+ logInfo.setPushResult(message);
|
|
|
}
|
|
|
//保存消息记录
|
|
|
iAttendanceExceptionLog.save(logInfo);
|
|
@@ -397,82 +420,30 @@ public class AttendanceExceptionFacadeControllerBean extends AbstractAttendanceE
|
|
|
* @throws BOSException
|
|
|
* @throws EASBizException
|
|
|
*/
|
|
|
- protected Map<String, List<SyncAttendanceDataBean>> getAttendanceExceptionDataForLeader(
|
|
|
+ protected List<Map<String, Object>> getAttendanceExceptionDataForLeader(
|
|
|
Context ctx,
|
|
|
Date startDate,
|
|
|
- Date endDate,
|
|
|
- Map<String, Map<String, Integer>> exceptionCountMap
|
|
|
+ Date endDate
|
|
|
) throws BOSException {
|
|
|
String sql = getSql(startDate, endDate);
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- Map<String, Map<String, Set<String>>> exceptionData = new HashMap<>();
|
|
|
+ List<Map<String, Object>> attendanceExceptionDatas = new ArrayList<Map<String, Object>>();
|
|
|
try {
|
|
|
IRowSet iRowSet = DBUtil.executeQuery(ctx, sql);
|
|
|
- Map<String, List<SyncAttendanceDataBean>> result = new HashMap<>();
|
|
|
while (iRowSet.next()) {
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
//设置考勤结果和次数
|
|
|
SyncAttendanceDataBean data = setAttendanceResult(iRowSet, sdf);
|
|
|
- //中心编码
|
|
|
- String admintwoNumber = iRowSet.getString("admintwoNumber");
|
|
|
- String personNumber = data.getEmployeeId();
|
|
|
Map<String, Boolean> attendanceFlags = new LinkedHashMap<>();
|
|
|
- int s19 = iRowSet.getInt("s19");
|
|
|
- int s21 = iRowSet.getInt("s21");
|
|
|
- BigDecimal s23 = iRowSet.getBigDecimal("s23");
|
|
|
- int s113 = iRowSet.getInt("s113");
|
|
|
- attendanceFlags.put("lateEmployees", s19 > 0);//迟到
|
|
|
- attendanceFlags.put("earlyLeaveEmployees", s21 > 0);//早退
|
|
|
- attendanceFlags.put("absentEmployees", s23.compareTo(BigDecimal.ZERO) > 0);//旷工
|
|
|
- attendanceFlags.put("personalRecheckCountEmployees", s113 > 0);//个人原因补卡
|
|
|
- Map<String, Set<String>> exceptionPersonMap = null;
|
|
|
- if (exceptionData.containsKey(admintwoNumber)) {
|
|
|
- exceptionPersonMap = exceptionData.get(admintwoNumber);
|
|
|
- } else {
|
|
|
- exceptionPersonMap = new HashMap<>();
|
|
|
- exceptionData.put(admintwoNumber, exceptionPersonMap);
|
|
|
- }
|
|
|
- Set<String> exceptionEmployees = exceptionPersonMap.get("exceptionEmployees");
|
|
|
- if (exceptionEmployees == null) {
|
|
|
- exceptionEmployees = new HashSet<>();
|
|
|
- exceptionPersonMap.put("exceptionEmployees", exceptionEmployees);
|
|
|
- }
|
|
|
- exceptionEmployees.add(personNumber);
|
|
|
- for (Map.Entry<String, Boolean> entry : attendanceFlags.entrySet()) {
|
|
|
- if (entry.getValue()) {
|
|
|
- Set<String> set = exceptionPersonMap.get(entry.getKey());
|
|
|
- if (set == null) {
|
|
|
- set = new HashSet<>();
|
|
|
- exceptionPersonMap.put(entry.getKey(), set);
|
|
|
- }
|
|
|
- set.add(personNumber);
|
|
|
- }
|
|
|
- }
|
|
|
- if (!result.containsKey(admintwoNumber)) {
|
|
|
- result.put(admintwoNumber, new ArrayList<>());
|
|
|
- }
|
|
|
- result.get(admintwoNumber).add(data);
|
|
|
+ attendanceFlags.put("lateEmployees", iRowSet.getInt("s19") > 0);//迟到
|
|
|
+ attendanceFlags.put("earlyLeaveEmployees", iRowSet.getInt("s21") > 0);//早退
|
|
|
+ attendanceFlags.put("absentEmployees", iRowSet.getBigDecimal("s23").compareTo(BigDecimal.ZERO) > 0);//旷工
|
|
|
+ attendanceFlags.put("personalRecheckCountEmployees", iRowSet.getInt("s113") > 0);//个人原因补卡
|
|
|
+ map.put("data", data);
|
|
|
+ map.put("attendanceFlags", attendanceFlags);
|
|
|
+ attendanceExceptionDatas.add(map);
|
|
|
}
|
|
|
- for (String orgNumber : exceptionData.keySet()) {
|
|
|
- Map<String, Set<String>> orgExceptionData = exceptionData.get(orgNumber);
|
|
|
- Map<String, Integer> orgExceptionTimes = new HashMap<>();
|
|
|
- //迟到人数
|
|
|
- Set<String> lateEmployees = orgExceptionData.get("lateEmployees");
|
|
|
- orgExceptionTimes.put("lateEmployees", lateEmployees != null ? lateEmployees.size() : 0);
|
|
|
- //早退人数
|
|
|
- Set<String> earlyLeaveEmployees = orgExceptionData.get("earlyLeaveEmployees");
|
|
|
- orgExceptionTimes.put("earlyLeaveEmployees", earlyLeaveEmployees != null ? earlyLeaveEmployees.size() : 0);
|
|
|
- //旷工人数
|
|
|
- Set<String> absentEmployees = orgExceptionData.get("absentEmployees");
|
|
|
- orgExceptionTimes.put("absentEmployees", absentEmployees != null ? absentEmployees.size() : 0);
|
|
|
- //个人原因补卡人数
|
|
|
- Set<String> personalRecheckCountEmployees = orgExceptionData.get("personalRecheckCountEmployees");
|
|
|
- orgExceptionTimes.put("personalRecheckCountEmployees", personalRecheckCountEmployees != null ? personalRecheckCountEmployees.size() : 0);
|
|
|
- //异常人数
|
|
|
- Set<String> exceptionEmployees = orgExceptionData.get("exceptionEmployees");
|
|
|
- orgExceptionTimes.put("exceptionEmployees", exceptionEmployees != null ? exceptionEmployees.size() : 0);
|
|
|
- exceptionCountMap.put(orgNumber, orgExceptionTimes);
|
|
|
- }
|
|
|
- return result;
|
|
|
+ return attendanceExceptionDatas;
|
|
|
} catch (SQLException e) {
|
|
|
logger.error(e.getMessage(), e);
|
|
|
throw new RuntimeException(e);
|
|
@@ -561,15 +532,15 @@ public class AttendanceExceptionFacadeControllerBean extends AbstractAttendanceE
|
|
|
.append(" adminOrg.fname_l2 as adminOrgName,").append("\n")
|
|
|
.append(" adminOrg.FLongNumber as adminOrgLongNumber,").append("\n")
|
|
|
.append(" adminOrg.FSortCode as sortCode,").append("\n")
|
|
|
- .append(" adminOrg.FDisplayName_L2 as displayName,").append("\n")
|
|
|
- .append(" admintwo.fid as admintwoId,").append("\n")
|
|
|
- .append(" admintwo.fnumber as admintwoNumber,").append("\n")
|
|
|
- .append(" admintwo.Fname_l2 as admintwoName").append("\n")
|
|
|
+ .append(" adminOrg.FDisplayName_L2 as displayName").append("\n")
|
|
|
+// .append(" admintwo.fid as admintwoId,").append("\n")
|
|
|
+// .append(" admintwo.fnumber as admintwoNumber,").append("\n")
|
|
|
+// .append(" admintwo.Fname_l2 as admintwoName").append("\n")
|
|
|
.append("from").append("\n")
|
|
|
.append(" T_HR_ATS_AttendanceResult attendanceResult").append("\n")
|
|
|
.append(" left join t_bd_person person on person.fid = attendanceResult.FProposerID").append("\n")
|
|
|
.append(" left join T_ORG_admin adminOrg on attendanceResult.FAdminOrgUnitID = adminOrg.fid").append("\n")
|
|
|
- .append(" left join T_ORG_admin admintwo on adminOrg.FLevelTwoGroupID = admintwo.fid").append("\n")
|
|
|
+ //.append(" left join T_ORG_admin admintwo on adminOrg.FLevelTwoGroupID = admintwo.fid").append("\n")
|
|
|
.append("where").append("\n")
|
|
|
.append(" attendanceResult.FAttenceDate >= { TS '").append(sdf.format(startDate)).append("' }").append("\n")
|
|
|
.append(" and attendanceResult.FAttenceDate <= { TS '").append(sdf.format(endDate)).append("' }").append("\n")
|
|
@@ -727,71 +698,57 @@ public class AttendanceExceptionFacadeControllerBean extends AbstractAttendanceE
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 获取各个中心考勤总人数
|
|
|
+ * 获取组织考勤总人数(包含下级)
|
|
|
*
|
|
|
* @param ctx
|
|
|
* @return
|
|
|
*/
|
|
|
- public Map<String, Integer> getAttendanceCount(Context ctx) {
|
|
|
- Map<String, Integer> attendanceCountMap = new HashMap<>();
|
|
|
+ public int getAttendanceCount(Context ctx, String orgLongNumber) {
|
|
|
try {
|
|
|
IAttendanceFile iAttendanceFile = AttendanceFileFactory.getLocalInstance(ctx);
|
|
|
FilterInfo filterInfo = new FilterInfo();
|
|
|
FilterItemCollection filterItems = filterInfo.getFilterItems();
|
|
|
filterItems.add(new FilterItemInfo("attendFileState", "1"));
|
|
|
- SelectorItemCollection sic = new SelectorItemCollection();
|
|
|
- sic.add("adminOrgUnit.levelTwoGroup.number");
|
|
|
- EntityViewInfo viewInfo = EntityViewInfo.getInstance(filterInfo, sic, null);
|
|
|
+ //打卡考勤
|
|
|
+ filterItems.add(new FilterItemInfo("isAttendance", "1"));
|
|
|
+ filterItems.add(new FilterItemInfo("adminOrgUnit.longNumber", orgLongNumber + "%", CompareType.LIKE));
|
|
|
+ EntityViewInfo viewInfo = EntityViewInfo.getInstance(filterInfo, null, null);
|
|
|
AttendanceFileCollection attendanceFileCol = iAttendanceFile.getAttendanceFileCollection(viewInfo);
|
|
|
- for (int i = 0; i < attendanceFileCol.size(); i++) {
|
|
|
- AttendanceFileInfo attendanceFileInfo = attendanceFileCol.get(i);
|
|
|
- String number = attendanceFileInfo.getAdminOrgUnit().getLevelTwoGroup().getNumber();
|
|
|
- if (attendanceCountMap.containsKey(number)) {
|
|
|
- Integer i1 = attendanceCountMap.get(number);
|
|
|
- attendanceCountMap.put(number, i1 + 1);
|
|
|
- } else {
|
|
|
- attendanceCountMap.put(number, 1);
|
|
|
- }
|
|
|
- }
|
|
|
+ return attendanceFileCol.size();
|
|
|
} catch (BOSException e) {
|
|
|
- logger.error("获取各个中心考勤总人数报错: " + e.getMessage(), e);
|
|
|
+ logger.error("获取" + orgLongNumber + "考勤总人数报错: " + e.getMessage(), e);
|
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
|
- return attendanceCountMap;
|
|
|
}
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * 获取中心名称
|
|
|
+ * 根据长编码获取组织
|
|
|
*
|
|
|
* @param ctx
|
|
|
* @return
|
|
|
*/
|
|
|
- public Map<String, String> getOrgMap(Context ctx) {
|
|
|
- Map<String, String> orgMap = new HashMap<>();
|
|
|
+ public AdminOrgUnitInfo getOrgInfo(Context ctx, String orgLongNumber) throws BOSException {
|
|
|
+ AdminOrgUnitCollection adminOrgUnitCollection = null;
|
|
|
try {
|
|
|
IAdminOrgUnit iAdminOrgUnit = AdminOrgUnitFactory.getLocalInstance(ctx);
|
|
|
FilterInfo filterInfo = new FilterInfo();
|
|
|
FilterItemCollection filterItems = filterInfo.getFilterItems();
|
|
|
//组织层级为一级组织
|
|
|
filterItems.add(new FilterItemInfo("unitLayerType", "00000000-0000-0000-0000-00000000000362824988"));
|
|
|
- filterItems.add(new FilterItemInfo("isSealUp", "0"));
|
|
|
+ filterItems.add(new FilterItemInfo("longNumber", "0"));
|
|
|
SelectorItemCollection sic = new SelectorItemCollection();
|
|
|
sic.add("number");
|
|
|
sic.add("name");
|
|
|
- EntityViewInfo viewInfo = EntityViewInfo.getInstance(filterInfo, sic, null);
|
|
|
- AdminOrgUnitCollection adminOrgUnitCol = iAdminOrgUnit.getAdminOrgUnitCollection(viewInfo);
|
|
|
- for (int i = 0; i < adminOrgUnitCol.size(); i++) {
|
|
|
- AdminOrgUnitInfo adminOrgUnitInfo = adminOrgUnitCol.get(i);
|
|
|
- String number = adminOrgUnitInfo.getNumber();
|
|
|
- String name = adminOrgUnitInfo.getName();
|
|
|
- orgMap.put(number, name);
|
|
|
- }
|
|
|
+ adminOrgUnitCollection = iAdminOrgUnit.getAdminOrgUnitCollection("where longNumber = '" + orgLongNumber + "'");
|
|
|
} catch (Exception e) {
|
|
|
- logger.error("获取中心名称报错: " + e.getMessage(), e);
|
|
|
- throw new RuntimeException(e);
|
|
|
+ logger.error("获取组织报错: " + e.getMessage(), e);
|
|
|
+ throw new BOSException(e);
|
|
|
+ }
|
|
|
+ if (adminOrgUnitCollection == null || adminOrgUnitCollection.size() == 0) {
|
|
|
+ throw new BOSException("未找到长编码为[" + orgLongNumber + "]的组织");
|
|
|
}
|
|
|
- return orgMap;
|
|
|
+ return adminOrgUnitCollection.get(0);
|
|
|
}
|
|
|
|
|
|
/**
|