Commit d341d9f1 by 宋祥

1.用户支持多组织机构

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