Commit d341d9f1 by 宋祥

1.用户支持多组织机构

parent 857357d9
...@@ -4,6 +4,7 @@ import com.baosight.hpjx.core.constant.CommonConstant; ...@@ -4,6 +4,7 @@ import com.baosight.hpjx.core.constant.CommonConstant;
import com.baosight.hpjx.core.enums.OrgTypeEnum; import com.baosight.hpjx.core.enums.OrgTypeEnum;
import com.baosight.hpjx.core.security.UserSessionUtils; import com.baosight.hpjx.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant; import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.pz.domain.HPPZ013;
import com.baosight.hpjx.hp.pz.tools.HPPZTools; import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.sc.domain.HPSC005B; import com.baosight.hpjx.hp.sc.domain.HPSC005B;
import com.baosight.hpjx.hp.sc.tools.HPSCTools; import com.baosight.hpjx.hp.sc.tools.HPSCTools;
...@@ -12,6 +13,7 @@ import com.baosight.hpjx.hp.xs.tools.HPXSTools; ...@@ -12,6 +13,7 @@ import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.AssertUtils; import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.LogUtils; import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.MapUtils; import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.common.ed.domain.TEDCM01; import com.baosight.iplat4j.common.ed.domain.TEDCM01;
import com.baosight.iplat4j.core.data.dao.DaoFactory; import com.baosight.iplat4j.core.data.dao.DaoFactory;
import com.baosight.iplat4j.core.ei.EiBlock; import com.baosight.iplat4j.core.ei.EiBlock;
...@@ -304,38 +306,45 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -304,38 +306,45 @@ public class ServiceXSOG0801 extends ServiceBase {
* @return * @return
*/ */
public EiInfo insertUserByOrgId(EiInfo inInfo) { public EiInfo insertUserByOrgId(EiInfo inInfo) {
String errorMsg = ""; try {
List insertList = new ArrayList(); String errorMsg = "";
List<Map> rows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List insertList = new ArrayList();
for (int i = 0; i < rows.size(); ++i) { List<Map> rows = inInfo.getBlock(EiConstant.resultBlock).getRows();
Map row = rows.get(i); for (int i = 0; i < rows.size(); ++i) {
Map map = new HashMap(); Map row = rows.get(i);
map.put("userId", row.get("userId")); // 厂区工人不能同时存在多个组
List<XSOG02> userResults = dao.query("XSOG02.queryByOrgIdAndUserId", map); Map queryMap = new HashMap();
if (userResults.size() > 0) { queryMap.put("userId", row.get("userId"));
errorMsg = errorMsg + "\n添加用户[" + row.get("loginName") + "]失败,选择用户已为其他组织机构成员"; List<HPPZ013> dbPz013s = dao.query(HPPZ013.QUERY, queryMap);
} else { if (dbPz013s.size() > 0) {
inInfo.getBlock(EiConstant.resultBlock).setCell(i, "recCreator", UserSession.getLoginName()); // 用户是工人时,只能有一个组织
insertList.add(inInfo.getBlock(EiConstant.resultBlock).getRow(i)); List<XSOG02> userResults = dao.query("XSOG02.queryByOrgIdAndUserId", queryMap);
if (userResults.size() > 0) {
errorMsg = errorMsg + "\n添加用户[" + row.get("loginName") + "]失败,选择用户已为其他组织机构成员";
continue;
}
}
row.put("recCreator", UserSession.getLoginName());
insertList.add(row);
}
if (insertList.size() == 0) {
inInfo.setMsg(errorMsg);
inInfo.setStatus(EiConstant.STATUS_FAILURE);
return inInfo;
} }
}
if (insertList.size() == 0) {
inInfo.setMsg(errorMsg);
inInfo.setStatus(-1);
return inInfo;
} else {
EiInfo call = new EiInfo(); EiInfo call = new EiInfo();
call.set("list", insertList); call.set("list", insertList);
call.set(EiConstant.serviceId, "S_XS_90"); call.set(EiConstant.serviceId, "S_XS_90");
EiInfo outInfo = XServiceManager.call(call); EiInfo outInfo = XServiceManager.call(call);
if (!"".equals(errorMsg)) { if (StringUtils.isNotBlank(errorMsg)) {
outInfo.addMsg(errorMsg); outInfo.addMsg(errorMsg);
outInfo.setStatus(0); outInfo.setStatus(EiConstant.STATUS_DEFAULT);
} }
return outInfo; return outInfo;
}catch (Exception e){
LogUtils.setMsg(inInfo, e, "添加失败");
} }
return inInfo;
} }
/** /**
...@@ -736,30 +745,34 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -736,30 +745,34 @@ public class ServiceXSOG0801 extends ServiceBase {
} }
public EiInfo queryUserDetailTemplateImpl(EiInfo inInfo) { public EiInfo queryUserDetailTemplateImpl(EiInfo inInfo) {
Map param = new HashMap(); try {
param.put("codesetCode", inInfo.get("codesetCode")); Map param = new HashMap();
param.put("projectName", "XSERVICES"); param.put("codesetCode", inInfo.get("codesetCode"));
String gridBlockId = (String) inInfo.get("gridBlockId"); param.put("projectName", "XSERVICES");
Map attr = inInfo.getBlock(gridBlockId).getAttr(); String gridBlockId = (String) inInfo.get("gridBlockId");
int limit = (Integer) attr.get("limit"); Map attr = inInfo.getBlock(gridBlockId).getAttr();
int offset = (Integer) attr.get("offset"); int limit = (Integer) attr.get("limit");
List result = DaoFactory.getPlatSqlDao().query("EDCM01.query", param, 0, -999999); int offset = attr.get("offset") == null ? 0 : (Integer) attr.get("offset");
int end = offset + limit; List result = DaoFactory.getPlatSqlDao().query("EDCM01.query", param, 0, -999999);
int size = result.size(); int end = offset + limit;
int actualEndIndex = Math.min(end, size); int size = result.size();
if (offset > size) { int actualEndIndex = Math.min(end, size);
result = new ArrayList(); if (offset > size) {
} else { result = new ArrayList();
result = result.subList(offset, actualEndIndex); } else {
result = result.subList(offset, actualEndIndex);
}
EiInfo outInfo = new EiInfo();
outInfo.setMsg("查询成功,共" + result.size() + "条记录");
outInfo.addBlock((String) inInfo.get("gridBlockId")).setRows(result);
attr.put("count", size);
outInfo.getBlock((String) inInfo.get("gridBlockId")).setAttr(attr);
outInfo.getBlock((String) inInfo.get("gridBlockId")).setBlockMeta((new TEDCM01()).eiMetadata);
return outInfo;
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "查询失败");
} }
return inInfo;
EiInfo outInfo = new EiInfo();
outInfo.setMsg("查询成功,共" + result.size() + "条记录");
outInfo.addBlock((String) inInfo.get("gridBlockId")).setRows(result);
attr.put("count", size);
outInfo.getBlock((String) inInfo.get("gridBlockId")).setAttr(attr);
outInfo.getBlock((String) inInfo.get("gridBlockId")).setBlockMeta((new TEDCM01()).eiMetadata);
return outInfo;
} }
public EiInfo queryUserMetadataImpl(EiInfo inInfo) { public EiInfo queryUserMetadataImpl(EiInfo inInfo) {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<c:set var="ctx" value="${pageContext.request.contextPath}"/> <c:set var="ctx" value="${pageContext.request.contextPath}"/>
<EF:EFPage title="用工管理"> <EF:EFPage title="工人管理">
<EF:EFRegion id="inqu" title="查询条件"> <EF:EFRegion id="inqu" title="查询条件">
<div class="row"> <div class="row">
<EF:EFSelect cname="厂区" blockId="inqu_status" ename="factoryCode" row="0" colWidth="3" filter="contains"> <EF:EFSelect cname="厂区" blockId="inqu_status" ename="factoryCode" row="0" colWidth="3" filter="contains">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment