diff --git a/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar b/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar index 732d0fdb..dfcd0479 100644 Binary files a/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar and b/com.actionsoft.apps.coe.pal/lib/com.actionsoft.apps.coe.pal.jar differ diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/CoEPALController.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/CoEPALController.java index 5799db16..5900ac48 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/CoEPALController.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/CoEPALController.java @@ -900,14 +900,6 @@ public class CoEPALController { return we.saveImportCoeWorkspace(wsFileName, replaceChoice, source); } - // 流程资产 选择用户 - // @Mapping("COE_PAL_WS_USERLIST") - @Mapping("com.actionsoft.apps.coe.pal_ws_userlist") - public String coePALWSUserList(UserContext me, String users, String removeUserIds) { - CoeWorkSpaceWeb web = new CoeWorkSpaceWeb(me); - return web.toPALWSUserList(users, removeUserIds); - } - // 停用启用流程资产 // @Mapping("COE_PAL_WS_STOPOROPEN") @Mapping("com.actionsoft.apps.coe.pal_ws_stoporopen") diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/cooperation/dao/CoeCooperationMemberDao.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/cooperation/dao/CoeCooperationMemberDao.java index 734306be..c165070f 100644 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/cooperation/dao/CoeCooperationMemberDao.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/cooperation/dao/CoeCooperationMemberDao.java @@ -5,6 +5,8 @@ import com.actionsoft.apps.coe.pal.cooperation.model.CoeCooperationRoleModel; import com.actionsoft.bpms.commons.database.RowMap; import com.actionsoft.bpms.commons.database.RowMapper; import com.actionsoft.bpms.commons.mvc.dao.DaoObject; +import com.actionsoft.bpms.org.cache.UserCache; +import com.actionsoft.bpms.org.model.UserModel; import com.actionsoft.bpms.util.DBSql; import com.actionsoft.bpms.util.UUIDGener; import com.actionsoft.bpms.util.UtilString; @@ -12,6 +14,7 @@ import com.actionsoft.exception.AWSDataAccessException; import java.sql.*; import java.util.ArrayList; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -48,20 +51,30 @@ public class CoeCooperationMemberDao extends DaoObject getCooperationAdminUsers(String teamId, String roleType) { - String sql = "SELECT m.USERID FROM " + entityName() + " m, " + CoeCooperationRoleModel.DATABASE_ENTITY+ " r, ORGUSER o WHERE m.TEAMID = ? AND m.TEAMID = r.TEAMID AND m.ROLEID = r.ID AND r.ROLETYPE = ? AND o.USERID = m.USERID AND o.CLOSED = '0' ORDER BY o.USERNAME"; + String sql = "SELECT m.USERID FROM " + entityName() + " m, " + CoeCooperationRoleModel.DATABASE_ENTITY+ " r WHERE m.TEAMID = ? AND m.TEAMID = r.TEAMID AND m.ROLEID = r.ID AND r.ROLETYPE = ? "; try { - return DBSql.query(sql, new RowMapper() { + List list = DBSql.query(sql, new RowMapper() { @Override public String mapRow(ResultSet rs, int arg1) throws SQLException { return rs.getString(1); } }, new Object[]{teamId, roleType}); + List result = new ArrayList<>(); + for (String userId : list) { + UserModel user = UserCache.getModel(userId); + if (user == null || user.isClosed()) { + continue; + } + result.add(userId); + } + Collections.sort(result); + return result; } catch (AWSDataAccessException e) { e.printStackTrace(System.err); } diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/job/SynchronousOrgJob.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/job/SynchronousOrgJob.java index d19bd4e9..bf517e1f 100644 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/job/SynchronousOrgJob.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/repository/job/SynchronousOrgJob.java @@ -239,7 +239,7 @@ public class SynchronousOrgJob implements IJob { JSONObject definition = JSONObject.parseObject(define); JSONObject elements = definition.getJSONObject("elements"); - + // todo List orgdepartmentList = DBSql.getMaps(conn, "select DISTINCT(POSITION_NAME) from ORGUSER WHERE DEPARTMENTID=?", departmentId); JSONArray shapes = new JSONArray(); diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/ws/dao/CoeWorkSpace.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/ws/dao/CoeWorkSpace.java index e4ef1728..920bc5ad 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/ws/dao/CoeWorkSpace.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/ws/dao/CoeWorkSpace.java @@ -10,10 +10,14 @@ import java.util.List; import java.util.Map; import com.actionsoft.apps.coe.pal.constant.CoEConstant; +import com.actionsoft.apps.coe.pal.team.user.dao.CoeUser; import com.actionsoft.bpms.commons.database.RowMapper; import com.actionsoft.bpms.commons.mvc.dao.DaoObject; import com.actionsoft.bpms.commons.mvc.model.PlatformMetaModelBean; import com.actionsoft.bpms.commons.pagination.SQLPagination; +import com.actionsoft.bpms.org.cache.UserCache; +import com.actionsoft.bpms.org.model.UserModel; +import com.actionsoft.bpms.server.UserContext; import com.actionsoft.bpms.server.conf.server.AWSServerConf; import com.actionsoft.bpms.util.DBSql; import com.actionsoft.bpms.util.UUIDGener; @@ -426,6 +430,7 @@ public class CoeWorkSpace extends DaoObject { if (!isUp) { upOrDown = "DESC"; } + // todo String sql = "SELECT cu." + CoeUserModel.FIELD_ID + ", cu." + CoeUserModel.FIELD_USER_ID + ", o." + CoeUserModel.FIELD_USER_NAME + ", cu." + CoeUserModel.FIELD_IS_ADMIN + " FROM " + CoeUserModel.DATABASE_ENTITY + " cu, ORGUSER o WHERE cu.USERID = o.USERID and o.CLOSED = 0" + " ORDER BY " + sortFiled + " " + upOrDown; if (isPaging) { sql = SQLPagination.getPaginitionSQL(sql, start, limit); @@ -446,6 +451,7 @@ public class CoeWorkSpace extends DaoObject { public List searchUser(String name) { String sortFiled = CoeUserModel.FIELD_USER_NAME; String upOrDown = "ASC"; + // todo StringBuilder sql = new StringBuilder("SELECT cu." + CoeUserModel.FIELD_ID + ", cu." + CoeUserModel.FIELD_USER_ID + ", o." + CoeUserModel.FIELD_USER_NAME + ", cu." + CoeUserModel.FIELD_IS_ADMIN + " FROM " + CoeUserModel.DATABASE_ENTITY + " cu, ORGUSER o WHERE cu.USERID = o.USERID "); String namelike = ""; if (StringUtil.containSpecialChar(name)) { @@ -479,13 +485,16 @@ public class CoeWorkSpace extends DaoObject { // 获取所有的记录条数 public int getCoeUserCount() { - try { - String sql = "SELECT COUNT(*) AS number FROM APP_ACT_COE_USER cu ,ORGUSER o WHERE cu.USERID = o.USERID and o.CLOSED = 0"; - return DBSql.getInt(sql, "number"); - } catch (AWSDataAccessException e) { - e.printStackTrace(); + List list = new CoeUser().getCoeUsers(); + int count = 0; + for (CoeUserModel model : list) { + UserModel user = UserCache.getModel(model.getUserId()); + if (user == null || user.isClosed()) { + continue; + } + count++; } - return 0; + return count; } public Map getCoeWorkSpaceVersions(String versionId) { diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/ws/web/CoeWorkSpaceWeb.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/ws/web/CoeWorkSpaceWeb.java index 7dc15a54..af55b58f 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/ws/web/CoeWorkSpaceWeb.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/pal/ws/web/CoeWorkSpaceWeb.java @@ -25,6 +25,7 @@ import com.actionsoft.apps.resource.plugin.profile.DCPluginProfile; import com.actionsoft.bpms.commons.htmlframework.HtmlPageTemplate; import com.actionsoft.bpms.commons.mvc.view.ActionWeb; import com.actionsoft.bpms.commons.mvc.view.ResponseObject; +import com.actionsoft.bpms.org.cache.UserCache; import com.actionsoft.bpms.org.model.UserModel; import com.actionsoft.bpms.server.UserContext; import com.actionsoft.bpms.server.fs.DCContext; @@ -1654,50 +1655,6 @@ public class CoeWorkSpaceWeb extends ActionWeb { return ro.toString(); } - /** - * 流程库属性-选择用户页面 - * - * @param users - * @return - */ - public String toPALWSUserList(String users, String removeUserIds) { - String[] userArray = null; - if (users != null) { - userArray = users.split(","); - } - - Map allUsers = CoeUserDaoFactory.createUser().getInstanceWithUserName(CoeUserModel.FIELD_ID); - JSONArray jsonArray = new JSONArray(); - for (int i = 0; allUsers != null && i < allUsers.size(); i++) { - CoeUserModel userModel = (CoeUserModel) allUsers.get(new Integer(i)); - if (removeUserIds != null && removeUserIds.contains(userModel.getUserId())) { - continue; - } - - String isAdmin = userModel.getIsAdmin() == 0 ? "否" : "是"; - String isChecked = ""; - if (userArray != null && isExist(userArray, userModel.getUserId())) { - isChecked = "checked"; - } else if (userArray == null || userArray.length == 0) { - if (userModel.getUserId().equals(_uc.getUID())) { - isChecked = "checked"; - } - } - JSONObject object = new JSONObject(); - object.put("id", userModel.getUserId()); - object.put("userName", userModel.getUserName()); - object.put("isChecked", isChecked); - object.put("isAdmin", isAdmin); - object.put("name", userModel.getUserId() + "<" + userModel.getUserName() + ">"); - jsonArray.add(object); - } - - Map macroLibraries = new HashMap(); - macroLibraries.put("sid", super.getContext().getSessionId()); - macroLibraries.put("userList", jsonArray); - return HtmlPageTemplate.merge(CoEConstant.APP_ID, "pal.ws.userlist.html", macroLibraries); - } - /** * 判断某个id是否在数组中 * @@ -1910,12 +1867,16 @@ public class CoeWorkSpaceWeb extends ActionWeb { Map allUsers = CoeUserDaoFactory.createUser().getInstanceWithUserName(CoeUserModel.FIELD_ID); for (int i = 0; allUsers != null && i < allUsers.size(); i++) { CoeUserModel userModel = (CoeUserModel) allUsers.get(new Integer(i)); + UserModel user = UserCache.getModel(userModel.getUserId()); + if (user == null || user.isClosed()) { + continue; + } if (userModel.getIsAdmin() == 0 || (HighSecurityUtil.isON() && HighSecurityUtil.isSecAdminUser(userModel.getUserId()))) { continue; } JSONObject object = new JSONObject(); object.put("value", userModel.getUserId()); - object.put("label", userModel.getUserId() + "<" + userModel.getUserName() + ">"); + object.put("label", userModel.getUserId() + "<" + user.getUserName() + ">"); object.put("path", SDK.getORGAPI().getDepartmentByUser(userModel.getUserId()).getPathNameI18NOfCache()); adminOptions.add(object); } diff --git a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/team/user/dao/CoeUser.java b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/team/user/dao/CoeUser.java index ce0fd616..a8bd7685 100755 --- a/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/team/user/dao/CoeUser.java +++ b/com.actionsoft.apps.coe.pal/src/com/actionsoft/apps/coe/pal/team/user/dao/CoeUser.java @@ -50,26 +50,6 @@ public class CoeUser extends DaoObject { // super.setEntityName(CoeUserModel.DATABASE_ENTITY); } - public PlatformMetaModelBean getInstanceById(String id) { - CoeUserModel model = new CoeUserModel(); - try { - String sql = "SELECT cu." + model.FIELD_ID + ", cu." + model.FIELD_USER_ID + ", o." + model.FIELD_USER_NAME + ", cu." + model.FIELD_IS_ADMIN + " FROM " + CoeUserModel.DATABASE_ENTITY + " cu, ORGUSER o WHERE cu.USERID = o.USERID AND cu." + model.FIELD_ID + "=?"; - return DBSql.getObject(sql, new RowMapper() { - @Override - public CoeUserModel mapRow(ResultSet rs, int arg1) throws SQLException { - CoeUserModel model = new CoeUserModel(); - model.setId(rs.getString(model.FIELD_ID)); - model.setIsAdmin(rs.getInt(model.FIELD_IS_ADMIN)); - model.setUserId(rs.getString(model.FIELD_USER_ID) + "<" + rs.getString(model.FIELD_USER_NAME) + ">"); - return model; - } - }, id); - } catch (Exception sqle) { - sqle.printStackTrace(); - } - return model; - } - /** * 根据用户Id获取用户信息 * @@ -78,8 +58,12 @@ public class CoeUser extends DaoObject { */ public PlatformMetaModelBean getInstanceByUserId(String userId) { CoeUserModel model = new CoeUserModel(); + UserModel userModel = UserCache.getModel(userId); + if (userModel == null) { + return model; + } try { - String sql = "SELECT cu." + model.FIELD_ID + ", cu." + model.FIELD_USER_ID + ", o." + model.FIELD_USER_NAME + ", cu." + model.FIELD_IS_ADMIN + " FROM " + CoeUserModel.DATABASE_ENTITY + " cu, ORGUSER o WHERE cu.USERID = o.USERID AND cu." + model.FIELD_USER_ID + "=?"; + String sql = "SELECT cu." + model.FIELD_ID + ", cu." + model.FIELD_USER_ID + ", cu." + model.FIELD_IS_ADMIN + " FROM " + CoeUserModel.DATABASE_ENTITY + " cu WHERE cu." + model.FIELD_USER_ID + "=?"; return DBSql.getObject(sql, new RowMapper() { @Override public CoeUserModel mapRow(ResultSet rs, int arg1) throws SQLException { @@ -87,7 +71,7 @@ public class CoeUser extends DaoObject { model.setId(rs.getString(model.FIELD_ID)); model.setIsAdmin(rs.getInt(model.FIELD_IS_ADMIN)); model.setUserId(rs.getString(model.FIELD_USER_ID)); - model.setUserName(rs.getString(model.FIELD_USER_NAME)); + model.setUserName(userModel.getUserName()); return model; } }, userId); @@ -153,7 +137,7 @@ public class CoeUser extends DaoObject { sorttype = "DESC"; } StringBuilder sqlbufer = new StringBuilder(); - sqlbufer.append(sql.append("SELECT cu." + CoeUserModel.FIELD_ID + ", cu." + CoeUserModel.FIELD_USER_ID + ", o." + CoeUserModel.FIELD_USER_NAME + ", cu." + CoeUserModel.FIELD_IS_ADMIN + " FROM " + CoeUserModel.DATABASE_ENTITY + " cu, ORGUSER o WHERE cu.USERID = o.USERID and o.CLOSED = 0 ").toString()); + sqlbufer.append(sql.append("SELECT cu." + CoeUserModel.FIELD_ID + ", cu." + CoeUserModel.FIELD_USER_ID + ", cu." + CoeUserModel.FIELD_IS_ADMIN + " FROM " + CoeUserModel.DATABASE_ENTITY + " cu ").toString()); if ((sortname != null) && (!sortname.equals(""))) { sqlbufer.append(" ORDER BY cu.").append(sortname).append(" ").append(sorttype); } @@ -164,7 +148,7 @@ public class CoeUser extends DaoObject { model.setId(rs.getString(model.FIELD_ID)); model.setIsAdmin(rs.getInt(model.FIELD_IS_ADMIN)); model.setUserId(rs.getString(model.FIELD_USER_ID)); - model.setUserName(rs.getString(model.FIELD_USER_NAME)); + model.setUserName(""); return model; } })); @@ -260,14 +244,19 @@ public class CoeUser extends DaoObject { } public boolean validateIsAccessCOE(String userid) { - String sql = "select u1.USERID from APP_ACT_COE_USER u1,ORGUSER u2 where u1.USERID=? and u1.USERID=u2.USERID and u2.CLOSED=0"; + String sql = "select u1.USERID from APP_ACT_COE_USER u1 where u1.USERID=?"; String id = DBSql.getObject(sql, new RowMapper() { @Override public String mapRow(ResultSet rs, int arg1) throws SQLException { return rs.getString(1); } }, userid); - if (id != null && !"".equals(id)) { + + if (UtilString.isNotEmpty(id)) { + UserModel user = UserCache.getModel(id); + if (user == null || user.isClosed()) { + return false; + } return true; } return false;