Commit e9ce0c6b by 宋祥

1.组织机构和工人管理逻辑关联

parent 6d41ed2b
......@@ -15,6 +15,8 @@ import com.baosight.hpjx.hp.xs.tools.HPXSTools;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils;
import com.baosight.hpjx.util.ObjectUtils;
import com.baosight.hpjx.util.StringUtils;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
......@@ -22,7 +24,9 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase;
import com.baosight.iplat4j.core.service.soa.XLocalManager;
import com.baosight.iplat4j.core.service.soa.XServiceManager;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
......@@ -84,10 +88,15 @@ public class ServiceHPPZ013 extends ServiceBase {
public EiInfo save(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<Long> ids = ObjectUtils.listKey(resultRows, "id");
// 数据校验
this.checkSaveData(resultRows);
// 查询数据
List<HPPZ013> dbPz023s = HPPZTools.HpPz013.list(ids);
// 写入数据
this.saveData(resultRows);
List<HPPZ01301> fPz013s = this.saveData(resultRows);
// 清理和新增关系
this.delAndAddMember(dbPz023s, fPz013s);
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
......@@ -120,7 +129,8 @@ public class ServiceHPPZ013 extends ServiceBase {
*
* @param resultRows
*/
private void saveData(List<Map> resultRows) throws Exception {
private List<HPPZ01301> saveData(List<Map> resultRows) throws Exception {
List<HPPZ01301> fPz01301s = new ArrayList<>();
for (Map resultRow : resultRows) {
HPPZ01301 fPz01301 = new HPPZ01301();
fPz01301.fromMap(resultRow);
......@@ -131,7 +141,9 @@ public class ServiceHPPZ013 extends ServiceBase {
} else {
this.modify(fPz01301);
}
fPz01301s.add(fPz01301);
}
return fPz01301s;
}
/**
......@@ -165,28 +177,6 @@ public class ServiceHPPZ013 extends ServiceBase {
fPz01301.setUserId(userId);
fPz01301.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPPZ013.INSERT, fPz01301);
// 添加到组织机构
this.insertOrgMember(fPz01301);
}
/**
* 用户关联组织
*
* @param fPz01301
*/
private void insertOrgMember(HPPZ01301 fPz01301) {
Map inInfoRowMap = new HashMap();
inInfoRowMap.put("loginName", fPz01301.getUserId());
inInfoRowMap.put("userId", fPz01301.getUserId());
inInfoRowMap.put("orgId", fPz01301.getGroupCode());
EiInfo inInfo = new EiInfo();
inInfo.addBlock(EiConstant.resultBlock).addRow(inInfoRowMap);
inInfo.set(EiConstant.serviceName, "XSOG0801");
inInfo.set(EiConstant.methodName, "insertUserByOrgId");
EiInfo outInfo = XLocalManager.call(inInfo);
if (outInfo.getStatus() < 0) {
throw new PlatException(outInfo.getMsg());
}
}
/**
......@@ -208,14 +198,17 @@ public class ServiceHPPZ013 extends ServiceBase {
public EiInfo delete(EiInfo inInfo) {
try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<HPPZ013> fPz013s = new ArrayList<>();
for (Map resultRow : resultRows) {
HPPZ013 fPz013 = new HPPZ013();
HPPZ01301 fPz013 = new HPPZ01301();
fPz013.fromMap(resultRow);
fPz013.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPPZ013.DELETE, fPz013);
// 从组织机构删除
this.deleteOrgMember(fPz013);
fPz013s.add(fPz013);
}
// 从组织机构删除
this.deleteOrgMember(fPz013s);
// 刷新数据
inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
......@@ -226,23 +219,77 @@ public class ServiceHPPZ013 extends ServiceBase {
}
/**
* 用户删除组织
* 删除和新增组织机构关系
*
* @param delPz013s
* @param addPz01301s
*/
private void delAndAddMember(List<HPPZ013> delPz013s, List<HPPZ01301> addPz01301s) {
// 删除用工关系
this.deleteOrgMember(delPz013s);
// 重新添加组织机构关系
this.insertOrgMember(addPz01301s);
}
/**
* 用户关联组织
*
* @param fPz013
* @param addPz01301s
*/
private void deleteOrgMember(HPPZ013 fPz013) {
private void insertOrgMember(List<HPPZ01301> addPz01301s) {
if (CollectionUtils.isEmpty(addPz01301s)) {
return;
}
List<Map> addRelations = new ArrayList<>();
for (HPPZ01301 addPz01301 : addPz01301s) {
Map inInfoRowMap = new HashMap();
inInfoRowMap.put("loginName", addPz01301.getUserId());
inInfoRowMap.put("userId", addPz01301.getUserId());
inInfoRowMap.put("orgId", addPz01301.getGroupCode());
addRelations.add(inInfoRowMap);
}
EiInfo inInfo = new EiInfo();
inInfo.set("inqu_status-0-parentOrgId", fPz013.getGroupCode());
inInfo.set("result-0-userId", fPz013.getUserId());
inInfo.set("result-0-loginName", fPz013.getUserId());
inInfo.set("result-0-orgId", fPz013.getGroupCode());
inInfo.set("result-0-orgEname", fPz013.getGroupCode());
// serviceName:XSOrgManage,methodName:deleteRelationBetweenUserAndOrg
inInfo.addBlock(EiConstant.resultBlock).setRows(addRelations);
inInfo.set(EiConstant.serviceName, "XSOG0801");
inInfo.set(EiConstant.methodName, "deleteUserByOrgId");
inInfo.set(EiConstant.methodName, "insertUserByOrgId");
EiInfo outInfo = XLocalManager.call(inInfo);
if (outInfo.getStatus() < 0) {
throw new PlatException(outInfo.getMsg());
}
}
/**
* 用户删除组织
*
* @param delPz013s
*/
private void deleteOrgMember(List<HPPZ013> delPz013s) {
if (CollectionUtils.isEmpty(delPz013s)) {
return;
}
List<Map> delRelations = new ArrayList<>();
for (HPPZ013 delPz013 : delPz013s) {
String groupCode = delPz013.getGroupCode();
if (StringUtils.isBlank(groupCode)) {
continue;
}
Map deleteMap = new HashMap();
deleteMap.put("userId", delPz013.getUserId());
deleteMap.put("loginName", delPz013.getUserId());
deleteMap.put("orgId", delPz013.getGroupCode());
deleteMap.put("orgEname", delPz013.getGroupCode());
delRelations.add(deleteMap);
}
if (CollectionUtils.isEmpty(delRelations)) {
return;
}
EiInfo inInfo = new EiInfo();
inInfo.set("list", delRelations);
// serviceName:XSOrgManage,methodName:deleteRelationBetweenUserAndOrg
inInfo.set(EiConstant.serviceId, "S_XS_91");
EiInfo outInfo = XServiceManager.call(inInfo);
if (outInfo.getStatus() < 0) {
throw new PlatException(outInfo.getMsg());
}
}
}
......@@ -84,6 +84,9 @@
</sql>
<sql id="customCondition">
<isNotEmpty prepend=" AND " property="ids">
ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="gender">
USER_ID IN (SELECT LOGIN_NAME FROM ${platSchema}.XS_USER WHERE COMPANY_CODE = #companyCode# AND GENDER = #gender# )
</isNotEmpty>
......@@ -187,11 +190,16 @@
<update id="clearGroup">
UPDATE ${hpjxSchema}.T_HPPZ013
SET
FACTORY_CODE = '',
FACTORY_NAME = '',
GROUP_TYPE = '',
GROUP_CODE = '',
GROUP_NAME = '',
<include refid="updateRevise"/>
WHERE GROUP_CODE = #groupCode#
<isNotEmpty prepend=" AND " property="userId">
USER_ID = #userId#
</isNotEmpty>
</update>
<!-- 清空生产厂区 -->
......@@ -205,6 +213,9 @@
GROUP_NAME = '',
<include refid="updateRevise"/>
WHERE FACTORY_CODE = #factoryCode#
<isNotEmpty prepend=" AND " property="userId">
USER_ID = #userId#
</isNotEmpty>
</update>
<select id="queryComboBox" parameterClass="java.util.HashMap"
......
......@@ -6,11 +6,17 @@ import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant;
import com.baosight.hpjx.hp.pz.domain.*;
import com.baosight.hpjx.hp.pz.domain.HPPZ004;
import com.baosight.hpjx.hp.pz.domain.HPPZ006;
import com.baosight.hpjx.hp.pz.domain.HPPZ007;
import com.baosight.hpjx.hp.pz.domain.HPPZ009;
import com.baosight.hpjx.hp.pz.domain.HPPZ011;
import com.baosight.hpjx.hp.pz.domain.HPPZ013;
import com.baosight.hpjx.hp.pz.domain.HPPZ015;
import com.baosight.hpjx.hp.pz.domain.HPPZ015A;
import com.baosight.hpjx.hp.sc.domain.HPSC001;
import com.baosight.hpjx.hp.sc.domain.HPSC002;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.hp.pz.domain.*;
import com.baosight.hpjx.util.AssertUtils;
import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.ObjectUtils;
......@@ -553,15 +559,30 @@ public class HPPZTools {
}
/**
* @param ids
* @return
*/
public static List<HPPZ013> list(List<Long> ids) {
if (CollectionUtils.isEmpty(ids)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("ids", ids);
return DaoBase.getInstance().query(HPPZ013.QUERY, queryMap);
}
/**
* 清空生产部门关系
*
* @param orgId
* @param userId
* @return
*/
public static void clearGroup(String orgId) {
public static void clearGroup(String orgId, String userId) {
AssertUtils.isNull(orgId, "组织机构ID不能为空");
Map queryMap = new HashMap();
queryMap.put("groupCode", orgId);
queryMap.put("userId", userId);
DaoUtils.update(HPSqlConstant.HPPZ013.CLEAR_GROUP, queryMap);
}
......@@ -569,12 +590,14 @@ public class HPPZTools {
* 清空厂区关系
*
* @param orgId
* @param userId
* @return
*/
public static void clearFactory(String orgId) {
public static void clearFactory(String orgId, String userId) {
AssertUtils.isNull(orgId, "组织机构ID不能为空");
Map queryMap = new HashMap();
queryMap.put("factoryCode", orgId);
queryMap.put("userId", userId);
DaoUtils.update(HPSqlConstant.HPPZ013.CLEAR_FACTORY, queryMap);
}
......
......@@ -4,9 +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.HPPZ009;
import com.baosight.hpjx.hp.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.sc.domain.HPSC005A;
import com.baosight.hpjx.hp.sc.domain.HPSC005B;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.hp.xs.domain.Org;
......@@ -19,7 +17,6 @@ import com.baosight.iplat4j.core.data.dao.DaoFactory;
import com.baosight.iplat4j.core.ei.EiBlock;
import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException;
import com.baosight.iplat4j.core.ioc.spring.PlatApplicationContext;
import com.baosight.iplat4j.core.log.Logger;
import com.baosight.iplat4j.core.log.LoggerFactory;
......@@ -30,8 +27,8 @@ import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.AdminUtil;
import com.baosight.iplat4j.ed.util.SequenceGenerator;
import com.baosight.xservices.xs.domain.XS01;
import com.baosight.xservices.xs.domain.XS02;
import com.baosight.xservices.xs.og.domain.XSOG01;
import com.baosight.xservices.xs.og.domain.XSOG02;
import com.baosight.xservices.xs.service.ServiceXSOrgExport;
import com.baosight.xservices.xs.service.ServiceXSOrgImport;
import com.baosight.xservices.xs.service.ServiceXSOrgUtil;
......@@ -39,7 +36,6 @@ import com.baosight.xservices.xs.service.ServiceXSTreeNode;
import com.baosight.xservices.xs.up.utils.XSExcelUtils;
import com.baosight.xservices.xs.util.LoginUserDetails;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.springframework.web.multipart.MultipartFile;
......@@ -56,13 +52,158 @@ import java.util.Iterator;
import java.util.List;
import java.util.Map;
/**
* 组织机构管理
*
* @author:songx
* @date:2024/3/15,13:28
*/
public class ServiceXSOG0801 extends ServiceBase {
private static final Logger logger = LoggerFactory.getLogger(ServiceXSOG0801.class);
private Map impCacheMap = new HashMap();
public ServiceXSOG0801() {
}
public static EiInfo exportOrg(EiInfo inInfo) throws IOException {
String currentClassPath = PlatApplicationContext.getProperty("iplat.data.basedir");
String filePath =
currentClassPath + File.separator + "lessees" + File.separator + "user" + File.separator + "export"
+ File.separator;
File exportTempDir = new File(filePath);
if (!exportTempDir.exists()) {
FileUtils.forceMkdir(exportTempDir);
}
long currentTime = System.currentTimeMillis();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");
String dateNowStr = sdf.format(currentTime);
String realFilePathName = "orgAndUserAndGroup_" + dateNowStr + ".xlsx";
String finaPath = filePath + realFilePathName;
SXSSFWorkbook workbook = new SXSSFWorkbook(1000);
inInfo.set("workbook", workbook);
ServiceXSOrgExport.createUserSheet(inInfo);
ServiceXSOrgExport.createUserGroupSheet(inInfo);
ServiceXSOrgExport.createUserGroupMemberSheet(inInfo);
ServiceXSOrgExport.createUserCustomSheet(inInfo);
ServiceXSOrgExport.createUserCustomDetailSheet(inInfo);
ServiceXSOrgExport.createOrgSheet(inInfo);
ServiceXSOrgExport.createOrgUserSheet(inInfo);
FileOutputStream outputStream = new FileOutputStream(finaPath);
workbook.write(outputStream);
workbook.close();
workbook.dispose();
EiInfo outInfo = new EiInfo();
outInfo.set("filePath", filePath);
outInfo.set("fileName", realFilePathName);
return outInfo;
}
public static EiInfo exportCustomUser(EiInfo inInfo) throws IOException {
String currentClassPath = PlatApplicationContext.getProperty("iplat.data.basedir");
String filePath =
currentClassPath + File.separator + "lessees" + File.separator + "user" + File.separator + "export"
+ File.separator;
File exportTempDir = new File(filePath);
if (!exportTempDir.exists()) {
FileUtils.forceMkdir(exportTempDir);
}
long currentTime = System.currentTimeMillis();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");
String dateNowStr = sdf.format(currentTime);
String realFilePathName = "自定义模板用户信息_" + dateNowStr + ".xlsx";
String finaPath = filePath + realFilePathName;
SXSSFWorkbook workbook = new SXSSFWorkbook(1000);
inInfo.set("workbook", workbook);
ServiceXSOrgExport.createUserDetails(inInfo);
FileOutputStream outputStream = new FileOutputStream(finaPath);
workbook.write(outputStream);
workbook.close();
workbook.dispose();
EiInfo outInfo = new EiInfo();
outInfo.set("filePath", filePath);
outInfo.set("fileName", realFilePathName);
return outInfo;
}
public static EiInfo queryUserTableHeader(EiInfo inInfo) {
List enameList = new ArrayList();
List cnameList = new ArrayList();
Map param = new HashMap();
param.put("codesetCode", "iplat.org.userBasicTemplate");
param.put("projectName", "XSERVICES");
List basicList = DaoFactory.getPlatSqlDao().query("EDCM01.query", param);
List basicEnameList = new ArrayList();
List basicCnameList = new ArrayList();
for (int i = 0; i < basicList.size(); ++i) {
TEDCM01 tedcm01 = (TEDCM01) basicList.get(i);
if ("1".equals(tedcm01.getItemStatus())) {
basicEnameList.add(tedcm01.getItemEname());
basicCnameList.add(tedcm01.getItemCname());
}
}
Map orgParam = new HashMap();
orgParam.put("isDeleted", "0");
List<Map> orgList = DaoFactory.getPlatSqlDao().query("XSOG01.queryOrgInfo", orgParam, 0, -999999);
List orgLevelCnameList = new ArrayList();
List orgLevelEnameList = new ArrayList();
Iterator var11 = orgList.iterator();
while (var11.hasNext()) {
Map org = (Map) var11.next();
org.put("label", org.get("orgId"));
org.put("parentId", org.get("parentOrgId"));
}
ServiceXSTreeNode rootNode = ServiceXSTreeNode.buildTree(orgList);
int levelCount = ServiceXSTreeNode.getTreeDepth(rootNode) - 1;
for (int i = 0; i < levelCount; ++i) {
String levelEname = "level" + (i + 1);
String levelOrgEname = "orgLevel" + (i + 1);
String levleCname = ServiceXSOrgUtil.number2ChineseNumber(i + 1) + "级组织机构";
String levelOrgCname = ServiceXSOrgUtil.number2ChineseNumber(i + 1) + "级组织机构编码";
orgLevelEnameList.add(levelEname);
orgLevelEnameList.add(levelOrgEname);
orgLevelCnameList.add(levleCname);
orgLevelCnameList.add(levelOrgCname);
}
param.put("codesetCode", "iplat.org.userCustomTemplate");
List customList = DaoFactory.getPlatSqlDao().query("EDCM01.query", param);
List customEnameList = new ArrayList();
List customCnameList = new ArrayList();
for (int i = 0; i < customList.size(); ++i) {
TEDCM01 tedcm01 = (TEDCM01) customList.get(i);
if ("1".equals(tedcm01.getItemStatus())) {
customEnameList.add(tedcm01.getItemEname());
customCnameList.add(tedcm01.getItemCname());
}
}
enameList.addAll(basicEnameList);
enameList.addAll(orgLevelEnameList);
enameList.addAll(customEnameList);
cnameList.addAll(basicCnameList);
cnameList.addAll(orgLevelCnameList);
cnameList.addAll(customCnameList);
inInfo.set("enameList", enameList);
inInfo.set("cnameList", cnameList);
inInfo.set("basicEnameList", basicEnameList);
inInfo.set("basicCnameList", basicCnameList);
inInfo.set("customEnameList", customEnameList);
inInfo.set("customCnameList", customCnameList);
inInfo.set("basicCount", basicEnameList.size());
inInfo.set("customCount", customEnameList.size());
inInfo.set("orgLevel", levelCount);
return inInfo;
}
public EiInfo initLoad(EiInfo inInfo) {
inInfo = super.initLoad(inInfo, new XS01());
return inInfo;
......@@ -96,8 +237,8 @@ public class ServiceXSOG0801 extends ServiceBase {
List<String> strList = new ArrayList();
Iterator var6 = orgIdChildList.iterator();
while(var6.hasNext()) {
HashMap map = (HashMap)var6.next();
while (var6.hasNext()) {
HashMap map = (HashMap) var6.next();
strList.add(map.get("ORG_ID").toString());
}
......@@ -119,12 +260,12 @@ public class ServiceXSOG0801 extends ServiceBase {
Iterator var12 = totalUser.iterator();
int i;
while(var12.hasNext()) {
Map<String, Object> tmpMap = (Map)var12.next();
while (var12.hasNext()) {
Map<String, Object> tmpMap = (Map) var12.next();
String userId = tmpMap.get("userId").toString();
if (userIdList.contains(userId)) {
i = Integer.parseInt(indexMap.get(userId).toString());
Map<String, Object> mapi = (Map)userList.get(i);
Map<String, Object> mapi = userList.get(i);
String iCreateTime = mapi.get("recCreateTime").toString();
String currentCreateTime = tmpMap.get("recCreateTime").toString();
if (currentCreateTime.compareTo(iCreateTime) > 0) {
......@@ -140,7 +281,7 @@ public class ServiceXSOG0801 extends ServiceBase {
}
int count = userList.size();
HashMap<String, Object> attr = (HashMap)inInfo.getBlock(EiConstant.resultBlock).getAttr();
HashMap<String, Object> attr = (HashMap) inInfo.getBlock(EiConstant.resultBlock).getAttr();
int offset = Integer.parseInt(attr.get("offset").toString());
i = Integer.parseInt(attr.get("limit").toString());
int end = offset + i;
......@@ -156,18 +297,23 @@ public class ServiceXSOG0801 extends ServiceBase {
}
}
/**
* 添加用户与组织关系
*
* @param inInfo
* @return
*/
public EiInfo insertUserByOrgId(EiInfo inInfo) {
String errorMsg = "";
List insertList = new ArrayList();
for(int i = 0; i < inInfo.getBlock(EiConstant.resultBlock).getRowCount(); ++i) {
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", inInfo.getBlock(EiConstant.resultBlock).getCell(i, "userId"));
EiInfo eiInfo = new EiInfo();
eiInfo.addBlock(EiConstant.queryBlock).addRow(map);
EiInfo relationInfo = super.query(eiInfo, "XSOG02.queryByOrgIdAndUserId", new XS02());
if (relationInfo.getBlock(EiConstant.resultBlock).getRows().size() > 0) {
errorMsg = errorMsg + "\n添加用户[" + inInfo.getBlock(EiConstant.resultBlock).getCell(i, "loginName") + "]失败,选择用户已为其他组织机构成员";
map.put("userId", row.get("userId"));
List<XSOG02> userResults = dao.query("XSOG02.queryByOrgIdAndUserId", map);
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));
......@@ -192,19 +338,30 @@ public class ServiceXSOG0801 extends ServiceBase {
}
}
/**
* 删除用户与组织机构关系
*
* @param inInfo
* @return
*/
public EiInfo deleteUserByOrgId(EiInfo inInfo) {
try {
EiInfo call = new EiInfo();
String orgId = (String)inInfo.get("inqu_status-0-parentOrgId");
List deleteList = inInfo.getBlock(EiConstant.resultBlock).getRows();
String orgId = (String) inInfo.get("inqu_status-0-parentOrgId");
List<Map> deleteList = inInfo.getBlock(EiConstant.resultBlock).getRows();
for (int i = 0; i < deleteList.size(); ++i) {
inInfo.getBlock(EiConstant.resultBlock).getRow(i).put("orgId", orgId);
Map deleteMap = deleteList.get(i);
deleteMap.put("orgId", orgId);
String userId = MapUtils.getString(deleteMap, "userId");
// 清空组织机构
Org org = HPXSTools.XsOrg.get(orgId);
clearHp013(orgId, org.getOrgType(), userId);
}
call.set("list", inInfo.getBlock(EiConstant.resultBlock).getRows());
call.set(EiConstant.serviceId, "S_XS_91");
inInfo = XServiceManager.call(call);
if (inInfo.getStatus() == EiConstant.STATUS_FAILURE) {
throw new PlatException(inInfo.getMsg());
return XServiceManager.call(call);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "删除失败");
}
return inInfo;
}
......@@ -311,7 +468,7 @@ public class ServiceXSOG0801 extends ServiceBase {
EiBlock r3Block = inInfo.getBlock("result3");
List rows = r3Block.getRows();
rows.forEach((m) -> {
Map row = (Map)m;
Map row = (Map) m;
row.put("recRevisor", UserSession.getLoginName());
});
EiInfo call = new EiInfo();
......@@ -340,7 +497,7 @@ public class ServiceXSOG0801 extends ServiceBase {
// 校验是否存在进行中的任务
this.checkExistsTask(org.getOrgId(), org.getOrgCname(), org.getOrgType());
// 清除用工关系
clearHp013(org.getOrgId(), org.getOrgType());
clearHp013(org.getOrgId(), org.getOrgType(), null);
});
EiInfo call = new EiInfo();
call.set("list", rows);
......@@ -348,7 +505,7 @@ public class ServiceXSOG0801 extends ServiceBase {
inInfo = XServiceManager.call(call);
if (inInfo.getStatus() > 0) {
for (int i = 0; i < rows.size(); ++i) {
Map param = (Map) rows.get(i);
Map param = rows.get(i);
List orgs = this.dao.query("XSOG01.queryOrgInfo", param);
for (int j = 0; j < orgs.size(); ++j) {
......@@ -395,7 +552,7 @@ public class ServiceXSOG0801 extends ServiceBase {
memberMap.put("orgId", ((Map) orgIdChildList.get(j)).get("ORG_ID"));
this.dao.delete("XSOG02.deleteRelationByOrgId", memberMap);
// 清除用工关系
clearHp013(childOrgId, childOrgType);
this.clearHp013(childOrgId, childOrgType, null);
++sum;
}
}
......@@ -434,12 +591,12 @@ public class ServiceXSOG0801 extends ServiceBase {
* @param orgId 组织机构
* @param orgType 组织类型
*/
private void clearHp013(String orgId, String orgType) {
private void clearHp013(String orgId, String orgType, String userId) {
if (OrgTypeEnum.FACTORY.getCode().equals(orgType)) {
HPPZTools.HpPz013.clearFactory(orgId);
HPPZTools.HpPz013.clearFactory(orgId, userId);
} else if (OrgTypeEnum.PROD_GROUP.getCode().equals(orgType)
|| OrgTypeEnum.CUT_GROUP.getCode().equals(orgType)) {
HPPZTools.HpPz013.clearGroup(orgId);
HPPZTools.HpPz013.clearGroup(orgId, userId);
}
}
......@@ -454,67 +611,9 @@ public class ServiceXSOG0801 extends ServiceBase {
return eiInfo;
}
public static EiInfo exportOrg(EiInfo inInfo) throws IOException {
String currentClassPath = PlatApplicationContext.getProperty("iplat.data.basedir");
String filePath = currentClassPath + File.separator + "lessees" + File.separator + "user" + File.separator + "export" + File.separator;
File exportTempDir = new File(filePath);
if (!exportTempDir.exists()) {
FileUtils.forceMkdir(exportTempDir);
}
long currentTime = System.currentTimeMillis();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");
String dateNowStr = sdf.format(currentTime);
String realFilePathName = "orgAndUserAndGroup_" + dateNowStr + ".xlsx";
String finaPath = filePath + realFilePathName;
SXSSFWorkbook workbook = new SXSSFWorkbook(1000);
inInfo.set("workbook", workbook);
ServiceXSOrgExport.createUserSheet(inInfo);
ServiceXSOrgExport.createUserGroupSheet(inInfo);
ServiceXSOrgExport.createUserGroupMemberSheet(inInfo);
ServiceXSOrgExport.createUserCustomSheet(inInfo);
ServiceXSOrgExport.createUserCustomDetailSheet(inInfo);
ServiceXSOrgExport.createOrgSheet(inInfo);
ServiceXSOrgExport.createOrgUserSheet(inInfo);
FileOutputStream outputStream = new FileOutputStream(finaPath);
workbook.write(outputStream);
workbook.close();
workbook.dispose();
EiInfo outInfo = new EiInfo();
outInfo.set("filePath", filePath);
outInfo.set("fileName", realFilePathName);
return outInfo;
}
public static EiInfo exportCustomUser(EiInfo inInfo) throws IOException {
String currentClassPath = PlatApplicationContext.getProperty("iplat.data.basedir");
String filePath = currentClassPath + File.separator + "lessees" + File.separator + "user" + File.separator + "export" + File.separator;
File exportTempDir = new File(filePath);
if (!exportTempDir.exists()) {
FileUtils.forceMkdir(exportTempDir);
}
long currentTime = System.currentTimeMillis();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd_HH-mm-ss");
String dateNowStr = sdf.format(currentTime);
String realFilePathName = "自定义模板用户信息_" + dateNowStr + ".xlsx";
String finaPath = filePath + realFilePathName;
SXSSFWorkbook workbook = new SXSSFWorkbook(1000);
inInfo.set("workbook", workbook);
ServiceXSOrgExport.createUserDetails(inInfo);
FileOutputStream outputStream = new FileOutputStream(finaPath);
workbook.write(outputStream);
workbook.close();
workbook.dispose();
EiInfo outInfo = new EiInfo();
outInfo.set("filePath", filePath);
outInfo.set("fileName", realFilePathName);
return outInfo;
}
public EiInfo getImpInfo(EiInfo inInfo) throws IOException {
this.impCacheMap.clear();
MultipartFile file = (MultipartFile)inInfo.get("file");
MultipartFile file = (MultipartFile) inInfo.get("file");
if (file != null) {
try {
InputStream in = file.getInputStream();
......@@ -594,9 +693,9 @@ public class ServiceXSOG0801 extends ServiceBase {
public EiInfo updateUserOrg(EiInfo inInfo) {
EiBlock rBlock = inInfo.getBlock(EiConstant.resultBlock);
Map updateMap = rBlock.getRow(0);
String oldOrgId = (String)updateMap.get("oldOrgId");
String newOrgId = (String)updateMap.get("newOrgId");
String userId = (String)updateMap.get("userId");
String oldOrgId = (String) updateMap.get("oldOrgId");
String newOrgId = (String) updateMap.get("newOrgId");
String userId = (String) updateMap.get("userId");
if (oldOrgId != null && newOrgId != null && userId != null) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("inqu_status-0-orgId", newOrgId);
......@@ -640,10 +739,10 @@ public class ServiceXSOG0801 extends ServiceBase {
Map param = new HashMap();
param.put("codesetCode", inInfo.get("codesetCode"));
param.put("projectName", "XSERVICES");
String gridBlockId = (String)inInfo.get("gridBlockId");
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 limit = (Integer) attr.get("limit");
int offset = (Integer) attr.get("offset");
List result = DaoFactory.getPlatSqlDao().query("EDCM01.query", param, 0, -999999);
int end = offset + limit;
int size = result.size();
......@@ -655,31 +754,36 @@ public class ServiceXSOG0801 extends ServiceBase {
}
EiInfo outInfo = new EiInfo();
outInfo.setMsg("查询成功,共" + ((List)result).size() + "条记录");
outInfo.addBlock((String)inInfo.get("gridBlockId")).setRows((List)result);
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);
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) {
String codesetCode = (String)inInfo.get("inqu_status-6-codesetCode");
String codesetCode = (String) inInfo.get("inqu_status-6-codesetCode");
List enameList = new ArrayList();
List cnameList = new ArrayList();
HashMap param;
List result;
int i;
if ("iplat.org.userBasicTemplate".equals(codesetCode)) {
Collections.addAll(enameList, new String[]{"loginName", "password", "status", "userName", "gender", "mobile", "email", "accountExpireDate", "pwdExpireDate", "isLocked", "recCreator", "recCreateTime", "recRevisor", "recReviseTime"});
Collections.addAll(cnameList, new String[]{"登录名", "密码", "状态", "用户名", "性别", "手机", "邮件", "账户过期时间", "密码过期时间", "是否锁定", "创建人", "创建时间", "修改人", "修改时间"});
Collections.addAll(enameList,
"loginName", "password", "status", "userName", "gender", "mobile", "email",
"accountExpireDate", "pwdExpireDate", "isLocked", "recCreator", "recCreateTime",
"recRevisor", "recReviseTime");
Collections.addAll(cnameList,
"登录名", "密码", "状态", "用户名", "性别", "手机", "邮件", "账户过期时间", "密码过期时间", "是否锁定", "创建人", "创建时间",
"修改人", "修改时间");
} else {
param = new HashMap();
param.put("customType", "string");
result = DaoFactory.getPlatSqlDao().query("XS41.query", param, 0, -999999);
for(i = 0; i < result.size(); ++i) {
Map userCustom = (Map)result.get(i);
for (i = 0; i < result.size(); ++i) {
Map userCustom = (Map) result.get(i);
enameList.add(userCustom.get("ename"));
cnameList.add(userCustom.get("cname"));
}
......@@ -690,8 +794,8 @@ public class ServiceXSOG0801 extends ServiceBase {
param.put("projectName", "XSERVICES");
result = DaoFactory.getPlatSqlDao().query("EDCM01.query", param);
for(i = 0; i < result.size(); ++i) {
String itemEname = ((TEDCM01)result.get(i)).getItemEname();
for (i = 0; i < result.size(); ++i) {
String itemEname = ((TEDCM01) result.get(i)).getItemEname();
int index = enameList.indexOf(itemEname);
if (-1 < index) {
enameList.remove(index);
......@@ -701,7 +805,7 @@ public class ServiceXSOG0801 extends ServiceBase {
List paramList = new ArrayList();
for(i = 0; i < enameList.size(); ++i) {
for (i = 0; i < enameList.size(); ++i) {
Map map = new HashMap();
map.put("ename", enameList.get(i));
map.put("cname", cnameList.get(i));
......@@ -716,9 +820,9 @@ public class ServiceXSOG0801 extends ServiceBase {
public EiInfo insertUserCustomDetailTableHeader(EiInfo inInfo) {
List<Map> rows = inInfo.getBlock("result5").getRows();
for(int i = 0; i < rows.size(); ++i) {
((Map)rows.get(i)).put("ename", ((Map)rows.get(i)).get("itemEname"));
((Map)rows.get(i)).put("cname", ((Map)rows.get(i)).get("itemCname"));
for (int i = 0; i < rows.size(); ++i) {
rows.get(i).put("ename", rows.get(i).get("itemEname"));
rows.get(i).put("cname", rows.get(i).get("itemCname"));
}
inInfo.set("rows", rows);
......@@ -727,25 +831,26 @@ public class ServiceXSOG0801 extends ServiceBase {
}
public EiInfo insertUserTableHeaderImpl(EiInfo inInfo) {
List<Map<String, String>> rows = (List)inInfo.get("rows");
String codesetCode = (String)inInfo.get("codesetCode");
List<Map<String, String>> rows = (List) inInfo.get("rows");
String codesetCode = (String) inInfo.get("codesetCode");
for(int i = 0; i < rows.size(); ++i) {
for (int i = 0; i < rows.size(); ++i) {
TEDCM01 tedcm01 = new TEDCM01();
tedcm01.setCodesetCode(codesetCode);
tedcm01.setProjectName("XSERVICES");
tedcm01.setItemCode((String)((Map)rows.get(i)).get("ename"));
tedcm01.setItemCode((String) ((Map) rows.get(i)).get("ename"));
if (!this.checkCodeSet(tedcm01)) {
inInfo.setStatus(-1);
inInfo.setMsg((String)((Map)rows.get(i)).get("ename") + "重复,新增失败");
inInfo.setMsg(((Map) rows.get(i)).get("ename") + "重复,新增失败");
return inInfo;
}
tedcm01.setItemEname((String)((Map)rows.get(i)).get("ename"));
tedcm01.setItemCname((String)((Map)rows.get(i)).get("cname"));
tedcm01.setItemEname((String) ((Map) rows.get(i)).get("ename"));
tedcm01.setItemCname((String) ((Map) rows.get(i)).get("cname"));
tedcm01.setStatus("1");
tedcm01.setItemStatus("1");
tedcm01.setSortId(((Map)rows.get(i)).get("sortId") == null ? "1" : (String)((Map)rows.get(i)).get("sortId"));
tedcm01.setSortId(
((Map) rows.get(i)).get("sortId") == null ? "1" : (String) ((Map) rows.get(i)).get("sortId"));
tedcm01.setRecCreator(String.valueOf(UserSession.getLoginName()));
tedcm01.setRecCreateTime(DateUtils.curDateTimeStr14());
tedcm01.setRecRevisor(" ");
......@@ -765,7 +870,8 @@ public class ServiceXSOG0801 extends ServiceBase {
}
public EiInfo deleteUserMetadata(EiInfo inInfo) {
List result = inInfo.getBlock("result4") != null ? inInfo.getBlock("result4").getRows() : inInfo.getBlock("result5").getRows();
List result = inInfo.getBlock("result4") != null ? inInfo.getBlock("result4").getRows()
: inInfo.getBlock("result5").getRows();
inInfo.addBlock(EiConstant.resultBlock).addRows(result);
super.delete(inInfo, "tedcm01.delete");
AdminUtil.cleanCache(inInfo, "iplat:codeset");
......@@ -779,7 +885,7 @@ public class ServiceXSOG0801 extends ServiceBase {
inInfo.addBlock(EiConstant.resultBlock).addRows(eiBlock.getRows());
int i;
for(i = 0; i < eiBlock.getRowCount(); ++i) {
for (i = 0; i < eiBlock.getRowCount(); ++i) {
String userId = String.valueOf(UserSession.getLoginName());
String dateTime = DateUtils.curDateTimeStr14();
inInfo.getBlock(EiConstant.resultBlock).setCell(i, "recRevisor", userId);
......@@ -792,95 +898,19 @@ public class ServiceXSOG0801 extends ServiceBase {
return inInfo;
}
public static EiInfo queryUserTableHeader(EiInfo inInfo) {
List enameList = new ArrayList();
List cnameList = new ArrayList();
Map param = new HashMap();
param.put("codesetCode", "iplat.org.userBasicTemplate");
param.put("projectName", "XSERVICES");
List basicList = DaoFactory.getPlatSqlDao().query("EDCM01.query", param);
List basicEnameList = new ArrayList();
List basicCnameList = new ArrayList();
for(int i = 0; i < basicList.size(); ++i) {
TEDCM01 tedcm01 = (TEDCM01)basicList.get(i);
if ("1".equals(tedcm01.getItemStatus())) {
basicEnameList.add(tedcm01.getItemEname());
basicCnameList.add(tedcm01.getItemCname());
}
}
Map orgParam = new HashMap();
orgParam.put("isDeleted", "0");
List<Map> orgList = DaoFactory.getPlatSqlDao().query("XSOG01.queryOrgInfo", orgParam, 0, -999999);
List orgLevelCnameList = new ArrayList();
List orgLevelEnameList = new ArrayList();
Iterator var11 = orgList.iterator();
while(var11.hasNext()) {
Map org = (Map)var11.next();
org.put("label", org.get("orgId"));
org.put("parentId", org.get("parentOrgId"));
}
ServiceXSTreeNode rootNode = ServiceXSTreeNode.buildTree(orgList);
int levelCount = ServiceXSTreeNode.getTreeDepth(rootNode) - 1;
for(int i = 0; i < levelCount; ++i) {
String levelEname = "level" + (i + 1);
String levelOrgEname = "orgLevel" + (i + 1);
String levleCname = ServiceXSOrgUtil.number2ChineseNumber(i + 1) + "级组织机构";
String levelOrgCname = ServiceXSOrgUtil.number2ChineseNumber(i + 1) + "级组织机构编码";
orgLevelEnameList.add(levelEname);
orgLevelEnameList.add(levelOrgEname);
orgLevelCnameList.add(levleCname);
orgLevelCnameList.add(levelOrgCname);
}
param.put("codesetCode", "iplat.org.userCustomTemplate");
List customList = DaoFactory.getPlatSqlDao().query("EDCM01.query", param);
List customEnameList = new ArrayList();
List customCnameList = new ArrayList();
for(int i = 0; i < customList.size(); ++i) {
TEDCM01 tedcm01 = (TEDCM01)customList.get(i);
if ("1".equals(tedcm01.getItemStatus())) {
customEnameList.add(tedcm01.getItemEname());
customCnameList.add(tedcm01.getItemCname());
}
}
enameList.addAll(basicEnameList);
enameList.addAll(orgLevelEnameList);
enameList.addAll(customEnameList);
cnameList.addAll(basicCnameList);
cnameList.addAll(orgLevelCnameList);
cnameList.addAll(customCnameList);
inInfo.set("enameList", enameList);
inInfo.set("cnameList", cnameList);
inInfo.set("basicEnameList", basicEnameList);
inInfo.set("basicCnameList", basicCnameList);
inInfo.set("customEnameList", customEnameList);
inInfo.set("customCnameList", customCnameList);
inInfo.set("basicCount", basicEnameList.size());
inInfo.set("customCount", customEnameList.size());
inInfo.set("orgLevel", levelCount);
return inInfo;
}
public EiInfo importCustomUser(EiInfo inInfo) {
EiInfo outInfo = new EiInfo();
if (this.impCacheMap != null && !this.impCacheMap.isEmpty()) {
List impDetail = (List)this.impCacheMap.get("用户详情表");
String[] currentRegion = (String[])((String[])impDetail.get(0));
List impDetail = (List) this.impCacheMap.get("用户详情表");
String[] currentRegion = (String[]) impDetail.get(0);
int basicRegionCount = 0;
int orgRegionCount = 0;
int customRegionCount = 0;
for(int i = 0; i < currentRegion.length; ++i) {
for (int i = 0; i < currentRegion.length; ++i) {
String var9 = currentRegion[i];
byte var10 = -1;
switch(var9.hashCode()) {
switch (var9.hashCode()) {
case 701194932:
if (var9.equals("基础信息")) {
var10 = 0;
......@@ -897,7 +927,7 @@ public class ServiceXSOG0801 extends ServiceBase {
}
}
switch(var10) {
switch (var10) {
case 0:
++basicRegionCount;
break;
......@@ -910,24 +940,25 @@ public class ServiceXSOG0801 extends ServiceBase {
}
EiInfo tableHeaderInfo = queryUserTableHeader(new EiInfo());
String[] currentHeader = (String[])((String[])impDetail.get(1));
String[] currentHeader = (String[]) impDetail.get(1);
List<String> currentHeaderList = new ArrayList(Arrays.asList(currentHeader));
currentHeaderList.removeIf(String::isEmpty);
String[] currentHeaderWithoutEmpty = (String[])currentHeaderList.toArray(new String[0]);
String[] currentHeaderWithoutEmpty = currentHeaderList.toArray(new String[0]);
boolean isSame = true;
List<String> basicCnameList = (List)tableHeaderInfo.get("basicCnameList");
List<String> customCnameList = (List)tableHeaderInfo.get("customCnameList");
List<String> basicCnameList = (List) tableHeaderInfo.get("basicCnameList");
List<String> customCnameList = (List) tableHeaderInfo.get("customCnameList");
int i;
for(i = 0; i < basicRegionCount; ++i) {
for (i = 0; i < basicRegionCount; ++i) {
if (!currentHeaderWithoutEmpty[i].equals(basicCnameList.get(i))) {
isSame = false;
break;
}
}
for(i = 0; i < customRegionCount; ++i) {
if (!isSame || !currentHeaderWithoutEmpty[i + basicRegionCount + orgRegionCount].equals(customCnameList.get(i))) {
for (i = 0; i < customRegionCount; ++i) {
if (!isSame || !currentHeaderWithoutEmpty[i + basicRegionCount + orgRegionCount].equals(
customCnameList.get(i))) {
isSame = false;
break;
}
......@@ -940,19 +971,21 @@ public class ServiceXSOG0801 extends ServiceBase {
return inInfo;
}
List basicEnameList = (List)tableHeaderInfo.get("basicEnameList");
List basicEnameList = (List) tableHeaderInfo.get("basicEnameList");
List userResult = new ArrayList();
String[] userHeader = new String[]{"登录名", "密码", "状态", "用户名", "性别", "手机号", "电子邮件", "账号过期时间", "密码过期时间", "是否被锁定"};
String[] userProp = new String[]{"loginName", "password", "status", "userName", "gender", "mobile", "email", "accountExpireDate", "pwdExpireDate", "isLocked"};
String[] userHeader = new String[]{"登录名", "密码", "状态", "用户名", "性别", "手机号", "电子邮件", "账号过期时间", "密码过期时间",
"是否被锁定"};
String[] userProp = new String[]{"loginName", "password", "status", "userName", "gender", "mobile", "email",
"accountExpireDate", "pwdExpireDate", "isLocked"};
userResult.add(userHeader);
String[] userDetail;
int index;
for(i = 2; i < impDetail.size(); ++i) {
for (i = 2; i < impDetail.size(); ++i) {
userDetail = (String[]) impDetail.get(i);
String[] user = new String[10];
for(int j = 0; j < userProp.length; ++j) {
for (int j = 0; j < userProp.length; ++j) {
String prop = userProp[j];
index = basicEnameList.indexOf(prop);
if (-1 < index) {
......@@ -966,7 +999,8 @@ public class ServiceXSOG0801 extends ServiceBase {
}
List orgResult = new ArrayList();
String[] userDetailHeader = new String[]{"组织编码", "组织名称", "组织别名", "组织类型", "上级组织英文名", "成立日期", "组织级别", "节点类型(1-树节点|2-叶子节点)", "排序", "逻辑删除(1-已删除|0-正常状态)"};
String[] userDetailHeader = new String[]{"组织编码", "组织名称", "组织别名", "组织类型", "上级组织英文名", "成立日期", "组织级别",
"节点类型(1-树节点|2-叶子节点)", "排序", "逻辑删除(1-已删除|0-正常状态)"};
orgResult.add(userDetailHeader);
List orgUserResult = new ArrayList();
String[] orgUserHeader = new String[]{"组织机构英文名", "用户登录名"};
......@@ -978,11 +1012,11 @@ public class ServiceXSOG0801 extends ServiceBase {
String ename;
String[] userCustom;
String[] org;
for(index = 2; index < impDetail.size(); ++index) {
for (index = 2; index < impDetail.size(); ++index) {
String[] itemUserDetail = (String[]) impDetail.get(index);
String parentEname = "root";
for(j = 0; j <= orgRegionCount / 2; ++j) {
for (j = 0; j <= orgRegionCount / 2; ++j) {
String orgCname = userDetailHeader[basicRegionCount + 2 * j];
orgEname = itemUserDetail[basicRegionCount + 2 * j + 1];
if (orgEname != null && !"".equals(orgEname) && j != orgRegionCount / 2) {
......@@ -1006,27 +1040,28 @@ public class ServiceXSOG0801 extends ServiceBase {
}
}
List<Map> userCustomList = DaoFactory.getPlatSqlDao().query("XS41.query", (Object)null, 0, -999999);
List<String> customEnameList = (List)tableHeaderInfo.get("customEnameList");
List<Map> userCustomList = DaoFactory.getPlatSqlDao().query("XS41.query", null, 0, -999999);
List<String> customEnameList = (List) tableHeaderInfo.get("customEnameList");
Map userCustomMap = new HashMap();
for(j = 0; j < userCustomList.size(); ++j) {
Map itemMap = (Map)userCustomList.get(j);
orgEname = (String)itemMap.get("ename");
for (j = 0; j < userCustomList.size(); ++j) {
Map itemMap = userCustomList.get(j);
orgEname = (String) itemMap.get("ename");
userCustomMap.put(orgEname, itemMap);
}
List userCustomResult = new ArrayList();
String[] userCustomHeader = new String[]{"自定义属性英文名", "自定义属性中文名", "自定义属性类型", "自定义属性排序", "(字符)是否必填", "(字符)默认值"};
String[] userCustomHeader = new String[]{"自定义属性英文名", "自定义属性中文名", "自定义属性类型", "自定义属性排序", "(字符)是否必填",
"(字符)默认值"};
userCustomResult.add(userCustomHeader);
for(i = 0; i < customEnameList.size(); ++i) {
ename = (String)customEnameList.get(i);
for (i = 0; i < customEnameList.size(); ++i) {
ename = customEnameList.get(i);
if (userCustomMap.get(ename) == null) {
userCustom = new String[6];
Arrays.fill(userCustom, "");
userCustom[0] = ename;
userCustom[1] = (String)customCnameList.get(i);
userCustom[1] = customCnameList.get(i);
userCustom[2] = "string";
userCustom[3] = "0";
userCustom[4] = "0";
......@@ -1037,14 +1072,14 @@ public class ServiceXSOG0801 extends ServiceBase {
List customMemberResult = new ArrayList();
org = new String[]{"用户登录名", "自定义属性英文名", "自定义属性值"};
customMemberResult.add(org);
int customCount = (Integer)tableHeaderInfo.get("customCount");
int customCount = (Integer) tableHeaderInfo.get("customCount");
for(i = 2; i < impDetail.size(); ++i) {
for (i = 2; i < impDetail.size(); ++i) {
String[] itemUserDetail = (String[]) impDetail.get(i);
String loginName = itemUserDetail[0];
for(j = 0; j < customCount; ++j) {
String itemEname = (String)customEnameList.get(j);
for (j = 0; j < customCount; ++j) {
String itemEname = customEnameList.get(j);
String value = itemUserDetail[basicRegionCount + orgRegionCount + j];
String[] customMember = new String[]{loginName, itemEname, value};
customMemberResult.add(customMember);
......
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