Commit 354074dd by yukang

Merge remote-tracking branch 'origin/dev' into dev

parents cb45a13b 0b386492
...@@ -235,42 +235,42 @@ public enum DdynamicEnum { ...@@ -235,42 +235,42 @@ public enum DdynamicEnum {
* 用途:用户查询 * 用途:用户查询
* 编写:ly * 编写:ly
*/ */
USER_ID_BLOCK_ID("user_id_block_id","userId","userName","factoryCode","groupCode", "deleteFlag","HPSC008.queryUserId"), USER_ID_BLOCK_ID("user_id_block_id","userId","userName","factoryCode","groupCode", "HPSC008.queryUserId"),
/** /**
* 模块:系统管理 * 模块:系统管理
* 用途:生产组查询 * 用途:生产组查询
* 编写:ly * 编写:ly
*/ */
GROUP_CODE_BLOCK_ID("group_code_block_id","groupCode","groupName","factoryCode", "deleteFlag","HPSC008.queryGroupCode"), GROUP_CODE_BLOCK_ID("group_code_block_id","groupCode","groupName","factoryCode", "HPSC008.queryGroupCode"),
/** /**
* 模块:系统管理 * 模块:系统管理
* 用途:厂区查询 * 用途:厂区查询
* 编写:ly * 编写:ly
*/ */
FACTORY_CODE_BLOCK_ID("factory_code_block_id","factoryCode","factoryName", "deleteFlag","HPSC008.queryFactoryCode"), FACTORY_CODE_BLOCK_ID("factory_code_block_id","factoryCode","factoryName","HPSC008.queryFactoryCode"),
/** /**
* 模块:系统管理 * 模块:系统管理
* 用途:用户查询 * 用途:用户查询
* 编写:ly * 编写:ly
*/ */
USER_ID1_BLOCK_ID("user_id1_block_id","userId","userName","factoryCode","groupCode", "deleteFlag","HPSC008.queryUserId"), USER_ID1_BLOCK_ID("user_id1_block_id","userId","userName","factoryCode","groupCode", "HPSC008.queryUserId"),
/** /**
* 模块:系统管理 * 模块:系统管理
* 用途:生产组查询 * 用途:生产组查询
* 编写:ly * 编写:ly
*/ */
GROUP_CODE1_BLOCK_ID("group_code1_block_id","groupCode","groupName","factoryCode", "deleteFlag","HPSC008.queryGroupCode"), GROUP_CODE1_BLOCK_ID("group_code1_block_id","groupCode","groupName","factoryCode", "HPSC008.queryGroupCode"),
/** /**
* 模块:系统管理 * 模块:系统管理
* 用途:厂区查询 * 用途:厂区查询
* 编写:ly * 编写:ly
*/ */
FACTORY_CODE1_BLOCK_ID("factory_code1_block_id","factoryCode","factoryName", "deleteFlag","HPSC008.queryFactoryCode"), FACTORY_CODE1_BLOCK_ID("factory_code1_block_id","factoryCode","factoryName", "HPSC008.queryFactoryCode"),
/** /**
......
...@@ -30,8 +30,6 @@ public class ConfigurationBean { ...@@ -30,8 +30,6 @@ public class ConfigurationBean {
@Bean(name = "fileUpLoadManager") @Bean(name = "fileUpLoadManager")
public PlatFileUploadManagerByAmazonS3 newPlatFileUploadManagerByAmazonS3() { public PlatFileUploadManagerByAmazonS3 newPlatFileUploadManagerByAmazonS3() {
String str = PlatApplicationContext.getProperty("iplat4j.admin.objectStorage.s3.switch");
log.warn("str -> {}", str);
return new PlatFileUploadManagerByAmazonS3(); return new PlatFileUploadManagerByAmazonS3();
} }
......
...@@ -278,8 +278,14 @@ public class HPSqlConstant { ...@@ -278,8 +278,14 @@ public class HPSqlConstant {
*/ */
public class HPPZ013 { public class HPPZ013 {
// 查询 // 修改
public static final String UPDATE = "HPPZ013.update";
// 修改状态
public static final String UPDATE_STATUS = "HPPZ013.updateStatus"; public static final String UPDATE_STATUS = "HPPZ013.updateStatus";
// 清空生产部门
public static final String CLEAR_GROUP = "HPPZ013.clearGroup";
// 清空生产厂区
public static final String CLEAR_FACTORY = "HPPZ013.clearFactory";
} }
/** /**
......
...@@ -15,6 +15,8 @@ import com.baosight.hpjx.hp.xs.tools.HPXSTools; ...@@ -15,6 +15,8 @@ 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.CommonMethod; import com.baosight.hpjx.util.CommonMethod;
import com.baosight.hpjx.util.LogUtils; 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.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo; import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.exception.PlatException; import com.baosight.iplat4j.core.exception.PlatException;
...@@ -22,7 +24,9 @@ import com.baosight.iplat4j.core.service.impl.ServiceBase; ...@@ -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.XLocalManager;
import com.baosight.iplat4j.core.service.soa.XServiceManager; import com.baosight.iplat4j.core.service.soa.XServiceManager;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import org.apache.commons.collections.CollectionUtils;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -84,10 +88,15 @@ public class ServiceHPPZ013 extends ServiceBase { ...@@ -84,10 +88,15 @@ public class ServiceHPPZ013 extends ServiceBase {
public EiInfo save(EiInfo inInfo) { public EiInfo save(EiInfo inInfo) {
try { try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<Long> ids = ObjectUtils.listKey(resultRows, "id");
// 数据校验 // 数据校验
this.checkSaveData(resultRows); 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 = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据保存成功!");
...@@ -106,7 +115,7 @@ public class ServiceHPPZ013 extends ServiceBase { ...@@ -106,7 +115,7 @@ public class ServiceHPPZ013 extends ServiceBase {
for (Map resultRow : resultRows) { for (Map resultRow : resultRows) {
HPPZ01301 fPz01301 = new HPPZ01301(); HPPZ01301 fPz01301 = new HPPZ01301();
fPz01301.fromMap(resultRow); fPz01301.fromMap(resultRow);
AssertUtils.isEmpty(fPz01301.getFactoryCode(), "请选择工厂"); AssertUtils.isEmpty(fPz01301.getFactoryCode(), "请选择厂区");
AssertUtils.isEmpty(fPz01301.getGroupType(), "请选择生产组类型"); AssertUtils.isEmpty(fPz01301.getGroupType(), "请选择生产组类型");
AssertUtils.isEmpty(fPz01301.getGroupCode(), "请选择生产组"); AssertUtils.isEmpty(fPz01301.getGroupCode(), "请选择生产组");
AssertUtils.isEmpty(fPz01301.getUserName(), "请输入姓名"); AssertUtils.isEmpty(fPz01301.getUserName(), "请输入姓名");
...@@ -120,7 +129,8 @@ public class ServiceHPPZ013 extends ServiceBase { ...@@ -120,7 +129,8 @@ public class ServiceHPPZ013 extends ServiceBase {
* *
* @param resultRows * @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) { for (Map resultRow : resultRows) {
HPPZ01301 fPz01301 = new HPPZ01301(); HPPZ01301 fPz01301 = new HPPZ01301();
fPz01301.fromMap(resultRow); fPz01301.fromMap(resultRow);
...@@ -131,7 +141,9 @@ public class ServiceHPPZ013 extends ServiceBase { ...@@ -131,7 +141,9 @@ public class ServiceHPPZ013 extends ServiceBase {
} else { } else {
this.modify(fPz01301); this.modify(fPz01301);
} }
fPz01301s.add(fPz01301);
} }
return fPz01301s;
} }
/** /**
...@@ -165,28 +177,6 @@ public class ServiceHPPZ013 extends ServiceBase { ...@@ -165,28 +177,6 @@ public class ServiceHPPZ013 extends ServiceBase {
fPz01301.setUserId(userId); fPz01301.setUserId(userId);
fPz01301.setDeleteFlag(CommonConstant.YesNo.NO_0); fPz01301.setDeleteFlag(CommonConstant.YesNo.NO_0);
DaoUtils.insert(HPPZ013.INSERT, fPz01301); 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());
}
} }
/** /**
...@@ -195,7 +185,7 @@ public class ServiceHPPZ013 extends ServiceBase { ...@@ -195,7 +185,7 @@ public class ServiceHPPZ013 extends ServiceBase {
* @param fPz01301 * @param fPz01301
*/ */
private void modify(HPPZ01301 fPz01301) { private void modify(HPPZ01301 fPz01301) {
DaoUtils.update(HPSqlConstant.HPPZ013.UPDATE_STATUS, fPz01301); DaoUtils.update(HPSqlConstant.HPPZ013.UPDATE, fPz01301);
} }
/** /**
...@@ -208,14 +198,17 @@ public class ServiceHPPZ013 extends ServiceBase { ...@@ -208,14 +198,17 @@ public class ServiceHPPZ013 extends ServiceBase {
public EiInfo delete(EiInfo inInfo) { public EiInfo delete(EiInfo inInfo) {
try { try {
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
List<HPPZ013> fPz013s = new ArrayList<>();
for (Map resultRow : resultRows) { for (Map resultRow : resultRows) {
HPPZ013 fPz013 = new HPPZ013(); HPPZ01301 fPz013 = new HPPZ01301();
fPz013.fromMap(resultRow); fPz013.fromMap(resultRow);
fPz013.setDeleteFlag(CommonConstant.YesNo.YES_1); fPz013.setDeleteFlag(CommonConstant.YesNo.YES_1);
DaoUtils.update(HPPZ013.DELETE, fPz013); DaoUtils.update(HPPZ013.DELETE, fPz013);
// 从组织机构删除 fPz013s.add(fPz013);
this.deleteOrgMember(fPz013);
} }
// 从组织机构删除
this.deleteOrgMember(fPz013s);
// 刷新数据
inInfo = this.query(inInfo); inInfo = this.query(inInfo);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!"); inInfo.setMsg("操作成功!本次对[" + resultRows.size() + "]条数据删除成功!");
...@@ -226,23 +219,77 @@ public class ServiceHPPZ013 extends ServiceBase { ...@@ -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(); EiInfo inInfo = new EiInfo();
inInfo.set("inqu_status-0-parentOrgId", fPz013.getGroupCode()); inInfo.addBlock(EiConstant.resultBlock).setRows(addRelations);
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.set(EiConstant.serviceName, "XSOG0801"); inInfo.set(EiConstant.serviceName, "XSOG0801");
inInfo.set(EiConstant.methodName, "deleteUserByOrgId"); inInfo.set(EiConstant.methodName, "insertUserByOrgId");
EiInfo outInfo = XLocalManager.call(inInfo); EiInfo outInfo = XLocalManager.call(inInfo);
if (outInfo.getStatus() < 0) { if (outInfo.getStatus() < 0) {
throw new PlatException(outInfo.getMsg()); 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());
}
}
} }
...@@ -91,6 +91,8 @@ public class ServiceHPPZ014 extends ServiceBase { ...@@ -91,6 +91,8 @@ public class ServiceHPPZ014 extends ServiceBase {
Map queryMap = EiInfoUtils.getFirstRow(inInfo, "main"); Map queryMap = EiInfoUtils.getFirstRow(inInfo, "main");
String regDate = DateUtils.formatShort(queryMap.get("regDate")); String regDate = DateUtils.formatShort(queryMap.get("regDate"));
List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows(); List<Map> resultRows = inInfo.getBlock(EiConstant.resultBlock).getRows();
// 数据校验
this.checkData(resultRows, regDate);
// 写入数据 // 写入数据
this.saveData(resultRows, regDate); this.saveData(resultRows, regDate);
inInfo.setStatus(EiConstant.STATUS_DEFAULT); inInfo.setStatus(EiConstant.STATUS_DEFAULT);
...@@ -102,6 +104,24 @@ public class ServiceHPPZ014 extends ServiceBase { ...@@ -102,6 +104,24 @@ public class ServiceHPPZ014 extends ServiceBase {
} }
/** /**
* 校验数据
*
* @param resultRows
* @param regDate
*/
private void checkData(List<Map> resultRows, String regDate) {
AssertUtils.isEmpty(regDate, "登记时间不能为空");
for (Map resultRow : resultRows) {
HPPZ013 fPz013 = new HPPZ013();
fPz013.fromMap(resultRow);
AssertUtils.isEmpty(fPz013.getFactoryCode(), "请选择厂区");
AssertUtils.isEmpty(fPz013.getGroupType(), "请选择生产组类型");
AssertUtils.isEmpty(fPz013.getGroupCode(), "请选择生产组");
}
}
/**
* 保存数据 * 保存数据
* *
* @param resultRows * @param resultRows
......
...@@ -84,6 +84,9 @@ ...@@ -84,6 +84,9 @@
</sql> </sql>
<sql id="customCondition"> <sql id="customCondition">
<isNotEmpty prepend=" AND " property="ids">
ID IN <iterate close=")" open="(" conjunction="," property="ids">#ids[]#</iterate>
</isNotEmpty>
<isNotEmpty prepend=" AND " property="gender"> <isNotEmpty prepend=" AND " property="gender">
USER_ID IN (SELECT LOGIN_NAME FROM ${platSchema}.XS_USER WHERE COMPANY_CODE = #companyCode# AND GENDER = #gender# ) USER_ID IN (SELECT LOGIN_NAME FROM ${platSchema}.XS_USER WHERE COMPANY_CODE = #companyCode# AND GENDER = #gender# )
</isNotEmpty> </isNotEmpty>
...@@ -159,6 +162,21 @@ ...@@ -159,6 +162,21 @@
</delete> </delete>
<!-- 修改状态 --> <!-- 修改状态 -->
<update id="update">
UPDATE ${hpjxSchema}.T_HPPZ013
SET
STATUS = #status#, <!-- 状态:1-在职,2-离职 -->
FACTORY_CODE = #factoryCode#, <!-- 工厂编码 -->
FACTORY_NAME = #factoryName#, <!-- 工厂名称 -->
GROUP_TYPE = #groupType#, <!-- 部门类型 -->
GROUP_CODE = #groupCode#, <!-- 生产组编码 -->
GROUP_NAME = #groupName#, <!-- 生产组名称 -->
REMARK = #remark#, <!-- 备注 -->
<include refid="updateRevise"/>
WHERE ID = #id#
</update>
<!-- 修改状态 -->
<update id="updateStatus"> <update id="updateStatus">
UPDATE ${hpjxSchema}.T_HPPZ013 UPDATE ${hpjxSchema}.T_HPPZ013
SET SET
...@@ -168,6 +186,38 @@ ...@@ -168,6 +186,38 @@
WHERE ID = #id# WHERE ID = #id#
</update> </update>
<!-- 清空生产部门 -->
<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>
<!-- 清空生产厂区 -->
<update id="clearFactory">
UPDATE ${hpjxSchema}.T_HPPZ013
SET
FACTORY_CODE = '',
FACTORY_NAME = '',
GROUP_TYPE = '',
GROUP_CODE = '',
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" <select id="queryComboBox" parameterClass="java.util.HashMap"
resultClass="java.util.HashMap"> resultClass="java.util.HashMap">
SELECT DISTINCT SELECT DISTINCT
......
...@@ -6,11 +6,17 @@ import com.baosight.hpjx.core.dao.DaoBase; ...@@ -6,11 +6,17 @@ import com.baosight.hpjx.core.dao.DaoBase;
import com.baosight.hpjx.core.dao.DaoUtils; import com.baosight.hpjx.core.dao.DaoUtils;
import com.baosight.hpjx.hp.constant.HPConstant; import com.baosight.hpjx.hp.constant.HPConstant;
import com.baosight.hpjx.hp.constant.HPSqlConstant; 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.HPSC001;
import com.baosight.hpjx.hp.sc.domain.HPSC002; import com.baosight.hpjx.hp.sc.domain.HPSC002;
import com.baosight.hpjx.hp.sc.tools.HPSCTools; 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.AssertUtils;
import com.baosight.hpjx.util.MapUtils; import com.baosight.hpjx.util.MapUtils;
import com.baosight.hpjx.util.ObjectUtils; import com.baosight.hpjx.util.ObjectUtils;
...@@ -536,9 +542,13 @@ public class HPPZTools { ...@@ -536,9 +542,13 @@ public class HPPZTools {
} }
} }
} }
/**
* @author:songx
* @date:2024/3/14,20:59
*/
public static class HpPz013 { public static class HpPz013 {
public static HPPZ013 get(String userId) { public static HPPZ013 get(String userId) {
AssertUtils.isNull(userId, "工人ID不能为空"); AssertUtils.isNull(userId, "工人ID不能为空");
Map queryMap = new HashMap(); Map queryMap = new HashMap();
...@@ -547,6 +557,50 @@ public class HPPZTools { ...@@ -547,6 +557,50 @@ public class HPPZTools {
AssertUtils.isEmpty(results, String.format("工人ID[%s]不存在", userId)); AssertUtils.isEmpty(results, String.format("工人ID[%s]不存在", userId));
return results.get(0); return results.get(0);
} }
/**
* @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, 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);
}
/**
* 清空厂区关系
*
* @param orgId
* @param userId
* @return
*/
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);
}
} }
/** /**
......
...@@ -787,15 +787,24 @@ public class ServiceHPSC002 extends ServiceBase { ...@@ -787,15 +787,24 @@ public class ServiceHPSC002 extends ServiceBase {
// 项目环境 // 项目环境
String projectEnv = ProjectInfo.getProjectEnv(); String projectEnv = ProjectInfo.getProjectEnv();
if (projectEnv.equals(CommonConstant.projectEnv.RUN)) { if (projectEnv.equals(CommonConstant.projectEnv.RUN)) {
EiInfo eiInfo = new EiInfo(); EiInfo queryInfo = new EiInfo();
eiInfo.set("data",realPath+"-"+0); queryInfo.set(HPSC002A.FIELD_DOC_ID,hpds002.getDocId());
eiInfo.set(EiConstant.serviceId,"S_EU_0105"); //获取文档信息
//调用接口 queryInfo.set(EiConstant.serviceId,"S_EU_0102");
EiInfo outInfo = XServiceManager.call(eiInfo); EiInfo docInfo = XServiceManager.call(queryInfo);
//数据库
if(outInfo.getStatus() == EiConstant.STATUS_FAILURE){ Map docInfoMap = docInfo.getMap("docMap");
LogUtils.setDetailMsg(outInfo, new Throwable(), "查询部件类型失败"); if (docInfoMap.size() > 0) {
outInfo.setMsg("失败"); EiInfo eiInfo = new EiInfo();
eiInfo.set("data",docInfoMap.get("url")+"-"+0);
eiInfo.set(EiConstant.serviceId,"S_EU_0105");
//调用接口
EiInfo outInfo = XServiceManager.call(eiInfo);
if(outInfo.getStatus() == EiConstant.STATUS_FAILURE){
LogUtils.setDetailMsg(outInfo, new Throwable(), "查询部件类型失败");
outInfo.setMsg("失败");
}
} }
}else { }else {
FileUtils.deleteFile(realPath); FileUtils.deleteFile(realPath);
......
...@@ -150,15 +150,24 @@ public class ServiceHPSC002A extends ServiceEPBase { ...@@ -150,15 +150,24 @@ public class ServiceHPSC002A extends ServiceEPBase {
// 项目环境 // 项目环境
String projectEnv = ProjectInfo.getProjectEnv(); String projectEnv = ProjectInfo.getProjectEnv();
if (projectEnv.equals(CommonConstant.projectEnv.RUN)) { if (projectEnv.equals(CommonConstant.projectEnv.RUN)) {
EiInfo eiInfo = new EiInfo(); EiInfo queryInfo = new EiInfo();
eiInfo.set("data",realPath+"-"+0); queryInfo.set(HPSC002A.FIELD_DOC_ID,list.get(0).getDocId());
eiInfo.set(EiConstant.serviceId,"S_EU_0105"); //获取文档信息
//调用接口 queryInfo.set(EiConstant.serviceId,"S_EU_0102");
EiInfo outInfo = XServiceManager.call(eiInfo); EiInfo docInfo = XServiceManager.call(queryInfo);
//数据库
Map docInfoMap = docInfo.getMap("docMap");
if (docInfoMap.size() > 0) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("data",docInfoMap.get("url")+"-"+0);
eiInfo.set(EiConstant.serviceId,"S_EU_0105");
//调用接口
EiInfo outInfo = XServiceManager.call(eiInfo);
if(outInfo.getStatus() == EiConstant.STATUS_FAILURE){ if(outInfo.getStatus() == EiConstant.STATUS_FAILURE){
LogUtils.setDetailMsg(outInfo, new Throwable(), "查询部件类型失败"); LogUtils.setDetailMsg(outInfo, new Throwable(), "查询部件类型失败");
outInfo.setMsg("失败"); outInfo.setMsg("失败");
}
} }
}else { }else {
FileUtils.deleteFile(realPath); FileUtils.deleteFile(realPath);
......
...@@ -331,15 +331,24 @@ public class ServiceHPSC006 extends ServiceBase { ...@@ -331,15 +331,24 @@ public class ServiceHPSC006 extends ServiceBase {
// 项目环境 // 项目环境
String projectEnv = ProjectInfo.getProjectEnv(); String projectEnv = ProjectInfo.getProjectEnv();
if (projectEnv.equals(CommonConstant.projectEnv.RUN)) { if (projectEnv.equals(CommonConstant.projectEnv.RUN)) {
EiInfo eiInfo = new EiInfo(); EiInfo queryInfo = new EiInfo();
eiInfo.set("data",realPath+"-"+0); queryInfo.set(HPSC002A.FIELD_DOC_ID,hpds002.getDocId());
eiInfo.set(EiConstant.serviceId,"S_EU_0105"); //获取文档信息
//调用接口 queryInfo.set(EiConstant.serviceId,"S_EU_0102");
EiInfo outInfo = XServiceManager.call(eiInfo); EiInfo docInfo = XServiceManager.call(queryInfo);
//数据库
Map docInfoMap = docInfo.getMap("docMap");
if (docInfoMap.size() > 0) {
EiInfo eiInfo = new EiInfo();
eiInfo.set("data",docInfoMap.get("url")+"-"+0);
eiInfo.set(EiConstant.serviceId,"S_EU_0105");
//调用接口
EiInfo outInfo = XServiceManager.call(eiInfo);
if(outInfo.getStatus() == EiConstant.STATUS_FAILURE){ if(outInfo.getStatus() == EiConstant.STATUS_FAILURE){
LogUtils.setDetailMsg(outInfo, new Throwable(), "查询部件类型失败"); LogUtils.setDetailMsg(outInfo, new Throwable(), "查询部件类型失败");
outInfo.setMsg("失败"); outInfo.setMsg("失败");
}
} }
}else { }else {
FileUtils.deleteFile(realPath); FileUtils.deleteFile(realPath);
......
...@@ -35,13 +35,13 @@ public class ServiceHPSC008 extends ServiceEPBase { ...@@ -35,13 +35,13 @@ public class ServiceHPSC008 extends ServiceEPBase {
Arrays.asList(DdynamicEnum.USER_ID_BLOCK_ID,DdynamicEnum.GROUP_CODE_BLOCK_ID,DdynamicEnum.FACTORY_CODE_BLOCK_ID), Arrays.asList(DdynamicEnum.USER_ID_BLOCK_ID,DdynamicEnum.GROUP_CODE_BLOCK_ID,DdynamicEnum.FACTORY_CODE_BLOCK_ID),
new HashMap<String,Object>(){{put(HPSC008.FIELD_COMPANY_CODE,companyCode);}} new HashMap<String,Object>(){{put(HPSC008.FIELD_COMPANY_CODE,companyCode);}}
); );
/*CommonMethod.initBlock(outEiInfo, CommonMethod.initBlock(outEiInfo,
Arrays.asList(DdynamicEnum.USER_ID1_BLOCK_ID,DdynamicEnum.GROUP_CODE1_BLOCK_ID,DdynamicEnum.FACTORY_CODE1_BLOCK_ID), Arrays.asList(DdynamicEnum.USER_ID1_BLOCK_ID,DdynamicEnum.GROUP_CODE1_BLOCK_ID,DdynamicEnum.FACTORY_CODE1_BLOCK_ID),
new HashMap<String,Object>(){{ new HashMap<String,Object>(){{
put(HPSC008.FIELD_COMPANY_CODE,companyCode); put(HPSC008.FIELD_COMPANY_CODE,companyCode);
put(HPSC008.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0); put(HPSC008.FIELD_DELETE_FLAG,CommonConstant.YesNo.NO_0);
}} }}
);*/ );
//outEiInfo.getBlock(EiConstant.resultBlock).getRows().clear(); //outEiInfo.getBlock(EiConstant.resultBlock).getRows().clear();
return outEiInfo; return outEiInfo;
} }
...@@ -104,17 +104,24 @@ public class ServiceHPSC008 extends ServiceEPBase { ...@@ -104,17 +104,24 @@ public class ServiceHPSC008 extends ServiceEPBase {
String factoryCode = inInfo.getString(HPPZ013.FIELD_FACTORY_CODE); String factoryCode = inInfo.getString(HPPZ013.FIELD_FACTORY_CODE);
CommonMethod.initBlock(inInfo, CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.GROUP_CODE_BLOCK_ID), Arrays.asList(DdynamicEnum.GROUP_CODE_BLOCK_ID),
new HashMap<String,Object>(){{put(HPSC008.FIELD_COMPANY_CODE,companyCode);put(HPPZ013.FIELD_FACTORY_CODE,factoryCode);}}); new HashMap<String,Object>(){{
put(HPSC008.FIELD_COMPANY_CODE,companyCode);
put(HPSC008.FIELD_FACTORY_CODE,factoryCode);
}});
return inInfo; return inInfo;
} }
public EiInfo queryGroupCode(EiInfo inInfo) { public EiInfo queryGroupCode(EiInfo inInfo) {
final String companyCode = UserSessionUtils.getCompanyCode(); final String companyCode = UserSessionUtils.getCompanyCode();
String factoryCode = inInfo.getString(HPPZ013.FIELD_FACTORY_CODE); String factoryCode = inInfo.getString(HPPZ013.FIELD_FACTORY_CODE);
String groupCode = inInfo.getString(HPPZ013.FIELD_GROUP_CODE); String groupCode = inInfo.getString(HPSC008.FIELD_GROUP_CODE);
CommonMethod.initBlock(inInfo, CommonMethod.initBlock(inInfo,
Arrays.asList(DdynamicEnum.USER_ID_BLOCK_ID), Arrays.asList(DdynamicEnum.USER_ID_BLOCK_ID),
new HashMap<String,Object>(){{put(HPSC008.FIELD_COMPANY_CODE,companyCode);put(HPPZ013.FIELD_FACTORY_CODE,factoryCode);put(HPPZ013.FIELD_GROUP_CODE,groupCode);}}); new HashMap<String,Object>(){{
put(HPSC008.FIELD_COMPANY_CODE,companyCode);
put(HPSC008.FIELD_FACTORY_CODE,factoryCode);
put(HPSC008.FIELD_GROUP_CODE,groupCode);
}});
return inInfo; return inInfo;
} }
} }
...@@ -99,6 +99,9 @@ ...@@ -99,6 +99,9 @@
<isEqual prepend=" AND " property="isComplete" compareValue="0"> <isEqual prepend=" AND " property="isComplete" compareValue="0">
B.NUM - B.COMPLETE_NUM &gt; 0 B.NUM - B.COMPLETE_NUM &gt; 0
</isEqual> </isEqual>
<isEqual prepend=" AND " property="isComplete" compareValue="1">
B.NUM - B.COMPLETE_NUM = 0
</isEqual>
</sql> </sql>
<sql id="order"> <sql id="order">
......
...@@ -260,12 +260,14 @@ ...@@ -260,12 +260,14 @@
<select id="queryFactoryCode" parameterClass="java.util.HashMap" resultClass="java.util.HashMap"> <select id="queryFactoryCode" parameterClass="java.util.HashMap" resultClass="java.util.HashMap">
SELECT DISTINCT SELECT DISTINCT
FACTORY_CODE as "factoryCode", FACTORY_CODE as "factoryCode",
FACTORY_NAME as "factoryName", FACTORY_NAME as "factoryName"
DELETE_FLAG as "deleteFlag"
FROM ${hpjxSchema}.T_HPPZ013 WHERE 1=1 FROM ${hpjxSchema}.T_HPPZ013 WHERE 1=1
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
...@@ -281,15 +283,23 @@ ...@@ -281,15 +283,23 @@
SELECT DISTINCT SELECT DISTINCT
GROUP_CODE as "groupCode", GROUP_CODE as "groupCode",
GROUP_NAME as "groupName", GROUP_NAME as "groupName",
FACTORY_CODE AS factoryCode, FACTORY_CODE AS factoryCode
DELETE_FLAG as "deleteFlag" FROM ${hpjxSchema}.T_HPPZ013 WHERE 1=1
FROM ${hpjxSchema}.T_HPPZ013 WHERE 1=1 and GROUP_TYPE = 'prodGroup'
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="factoryCode"> <isNotEmpty prepend=" AND " property="factoryCode">
FACTORY_CODE = #factoryCode# FACTORY_CODE = #factoryCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isEmpty prepend=" AND " property="groupType">
GROUP_TYPE = 'prodGroup'
</isEmpty>
<isNotEmpty prepend=" AND " property="groupType">
GROUP_TYPE = #groupType#
</isNotEmpty>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
...@@ -306,9 +316,8 @@ ...@@ -306,9 +316,8 @@
USER_ID as "userId", USER_ID as "userId",
USER_NAME as "userName", USER_NAME as "userName",
FACTORY_CODE AS factoryCode, FACTORY_CODE AS factoryCode,
GROUP_CODE as "groupCode", GROUP_CODE as "groupCode"
DELETE_FLAG as "deleteFlag" FROM ${hpjxSchema}.T_HPPZ013 WHERE 1=1 and STATUS = '1'
FROM ${hpjxSchema}.T_HPPZ013 WHERE 1=1 and GROUP_TYPE = 'prodGroup' and STATUS = '1'
<isNotEmpty prepend=" AND " property="companyCode"> <isNotEmpty prepend=" AND " property="companyCode">
COMPANY_CODE = #companyCode# COMPANY_CODE = #companyCode#
</isNotEmpty> </isNotEmpty>
...@@ -318,6 +327,15 @@ ...@@ -318,6 +327,15 @@
<isNotEmpty prepend=" AND " property="groupCode"> <isNotEmpty prepend=" AND " property="groupCode">
GROUP_CODE = #groupCode# GROUP_CODE = #groupCode#
</isNotEmpty> </isNotEmpty>
<isNotEmpty prepend=" AND " property="deleteFlag">
DELETE_FLAG = #deleteFlag#
</isNotEmpty>
<isEmpty prepend=" AND " property="groupType">
GROUP_TYPE = 'prodGroup'
</isEmpty>
<isNotEmpty prepend=" AND " property="groupType">
GROUP_TYPE = #groupType#
</isNotEmpty>
<dynamic prepend="ORDER BY"> <dynamic prepend="ORDER BY">
<isNotEmpty property="orderBy"> <isNotEmpty property="orderBy">
$orderBy$ $orderBy$
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
FACTORY_CODE AS "factoryCode", FACTORY_CODE AS "factoryCode",
FACTORY_NAME AS "factoryName" FACTORY_NAME AS "factoryName"
FROM iplat.TXSOG01 FROM iplat.TXSOG01
WHERE 1 = 1 WHERE 1 = 1 AND IS_DELETED = 0
AND FACTORY_CODE IN ( AND FACTORY_CODE IN (
SELECT ORG_ENAME FROM iplat.TXSOG01 SELECT ORG_ENAME FROM iplat.TXSOG01
WHERE COMPANY_CODE = #companyCode# AND ORG_TYPE = 'factory' WHERE COMPANY_CODE = #companyCode# AND ORG_TYPE = 'factory'
......
...@@ -21,6 +21,7 @@ import com.baosight.iplat4j.core.util.NumberUtils; ...@@ -21,6 +21,7 @@ import com.baosight.iplat4j.core.util.NumberUtils;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -863,6 +864,39 @@ public class HPSCTools { ...@@ -863,6 +864,39 @@ public class HPSCTools {
return results.stream().collect(Collectors.toMap(HPSC005B::getProdTaskNo, item -> item)); return results.stream().collect(Collectors.toMap(HPSC005B::getProdTaskNo, item -> item));
} }
/**
* 查询信息
*
* @param factoryCode
* @param isComplete 是否完工
* @return
*/
public static List<HPSC005B> listByFactory(String factoryCode, Integer isComplete) {
if (StringUtils.isEmpty(factoryCode)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("factoryCode", factoryCode);
queryMap.put("isComplete", isComplete);
return DaoBase.getInstance().query(HPSC005B.QUERY, queryMap);
}
/**
* 查询信息
*
* @param orgNo 生产组
* @param isComplete
* @return
*/
public static List<HPSC005B> listByGroup(String orgNo, Integer isComplete) {
if (StringUtils.isEmpty(orgNo)) {
return null;
}
Map queryMap = new HashMap();
queryMap.put("orgNo", orgNo);
queryMap.put("isComplete", isComplete);
return DaoBase.getInstance().query(HPSC005B.QUERY, queryMap);
}
} }
......
package com.baosight.xservices.xs.og.service; package com.baosight.xservices.xs.og.service;
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.core.security.UserSessionUtils;
import com.baosight.hpjx.hp.constant.HPConstant; 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.pz.tools.HPPZTools;
import com.baosight.hpjx.hp.sc.domain.HPSC005B;
import com.baosight.hpjx.hp.sc.tools.HPSCTools;
import com.baosight.hpjx.hp.xs.domain.Org;
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.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;
...@@ -19,8 +27,8 @@ import com.baosight.iplat4j.core.web.threadlocal.UserSession; ...@@ -19,8 +27,8 @@ import com.baosight.iplat4j.core.web.threadlocal.UserSession;
import com.baosight.iplat4j.ed.util.AdminUtil; import com.baosight.iplat4j.ed.util.AdminUtil;
import com.baosight.iplat4j.ed.util.SequenceGenerator; import com.baosight.iplat4j.ed.util.SequenceGenerator;
import com.baosight.xservices.xs.domain.XS01; 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.XSOG01;
import com.baosight.xservices.xs.og.domain.XSOG02;
import com.baosight.xservices.xs.service.ServiceXSOrgExport; import com.baosight.xservices.xs.service.ServiceXSOrgExport;
import com.baosight.xservices.xs.service.ServiceXSOrgImport; import com.baosight.xservices.xs.service.ServiceXSOrgImport;
import com.baosight.xservices.xs.service.ServiceXSOrgUtil; import com.baosight.xservices.xs.service.ServiceXSOrgUtil;
...@@ -28,7 +36,6 @@ import com.baosight.xservices.xs.service.ServiceXSTreeNode; ...@@ -28,7 +36,6 @@ import com.baosight.xservices.xs.service.ServiceXSTreeNode;
import com.baosight.xservices.xs.up.utils.XSExcelUtils; import com.baosight.xservices.xs.up.utils.XSExcelUtils;
import com.baosight.xservices.xs.util.LoginUserDetails; import com.baosight.xservices.xs.util.LoginUserDetails;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.poi.xssf.streaming.SXSSFWorkbook; import org.apache.poi.xssf.streaming.SXSSFWorkbook;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
...@@ -45,13 +52,158 @@ import java.util.Iterator; ...@@ -45,13 +52,158 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
/**
* 组织机构管理
*
* @author:songx
* @date:2024/3/15,13:28
*/
public class ServiceXSOG0801 extends ServiceBase { public class ServiceXSOG0801 extends ServiceBase {
private static final Logger logger = LoggerFactory.getLogger(ServiceXSOG0801.class); private static final Logger logger = LoggerFactory.getLogger(ServiceXSOG0801.class);
private Map impCacheMap = new HashMap(); private Map impCacheMap = new HashMap();
public ServiceXSOG0801() { 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) { public EiInfo initLoad(EiInfo inInfo) {
inInfo = super.initLoad(inInfo, new XS01()); inInfo = super.initLoad(inInfo, new XS01());
return inInfo; return inInfo;
...@@ -85,8 +237,8 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -85,8 +237,8 @@ public class ServiceXSOG0801 extends ServiceBase {
List<String> strList = new ArrayList(); List<String> strList = new ArrayList();
Iterator var6 = orgIdChildList.iterator(); Iterator var6 = orgIdChildList.iterator();
while(var6.hasNext()) { while (var6.hasNext()) {
HashMap map = (HashMap)var6.next(); HashMap map = (HashMap) var6.next();
strList.add(map.get("ORG_ID").toString()); strList.add(map.get("ORG_ID").toString());
} }
...@@ -108,12 +260,12 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -108,12 +260,12 @@ public class ServiceXSOG0801 extends ServiceBase {
Iterator var12 = totalUser.iterator(); Iterator var12 = totalUser.iterator();
int i; int i;
while(var12.hasNext()) { while (var12.hasNext()) {
Map<String, Object> tmpMap = (Map)var12.next(); Map<String, Object> tmpMap = (Map) var12.next();
String userId = tmpMap.get("userId").toString(); String userId = tmpMap.get("userId").toString();
if (userIdList.contains(userId)) { if (userIdList.contains(userId)) {
i = Integer.parseInt(indexMap.get(userId).toString()); 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 iCreateTime = mapi.get("recCreateTime").toString();
String currentCreateTime = tmpMap.get("recCreateTime").toString(); String currentCreateTime = tmpMap.get("recCreateTime").toString();
if (currentCreateTime.compareTo(iCreateTime) > 0) { if (currentCreateTime.compareTo(iCreateTime) > 0) {
...@@ -129,7 +281,7 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -129,7 +281,7 @@ public class ServiceXSOG0801 extends ServiceBase {
} }
int count = userList.size(); 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()); int offset = Integer.parseInt(attr.get("offset").toString());
i = Integer.parseInt(attr.get("limit").toString()); i = Integer.parseInt(attr.get("limit").toString());
int end = offset + i; int end = offset + i;
...@@ -145,18 +297,23 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -145,18 +297,23 @@ public class ServiceXSOG0801 extends ServiceBase {
} }
} }
/**
* 添加用户与组织关系
*
* @param inInfo
* @return
*/
public EiInfo insertUserByOrgId(EiInfo inInfo) { public EiInfo insertUserByOrgId(EiInfo inInfo) {
String errorMsg = ""; String errorMsg = "";
List insertList = new ArrayList(); List insertList = new ArrayList();
List<Map> rows = inInfo.getBlock(EiConstant.resultBlock).getRows();
for(int i = 0; i < inInfo.getBlock(EiConstant.resultBlock).getRowCount(); ++i) { for (int i = 0; i < rows.size(); ++i) {
Map row = rows.get(i);
Map map = new HashMap(); Map map = new HashMap();
map.put("userId", inInfo.getBlock(EiConstant.resultBlock).getCell(i, "userId")); map.put("userId", row.get("userId"));
EiInfo eiInfo = new EiInfo(); List<XSOG02> userResults = dao.query("XSOG02.queryByOrgIdAndUserId", map);
eiInfo.addBlock(EiConstant.queryBlock).addRow(map); if (userResults.size() > 0) {
EiInfo relationInfo = super.query(eiInfo, "XSOG02.queryByOrgIdAndUserId", new XS02()); errorMsg = errorMsg + "\n添加用户[" + row.get("loginName") + "]失败,选择用户已为其他组织机构成员";
if (relationInfo.getBlock(EiConstant.resultBlock).getRows().size() > 0) {
errorMsg = errorMsg + "\n添加用户[" + inInfo.getBlock(EiConstant.resultBlock).getCell(i, "loginName") + "]失败,选择用户已为其他组织机构成员";
} else { } else {
inInfo.getBlock(EiConstant.resultBlock).setCell(i, "recCreator", UserSession.getLoginName()); inInfo.getBlock(EiConstant.resultBlock).setCell(i, "recCreator", UserSession.getLoginName());
insertList.add(inInfo.getBlock(EiConstant.resultBlock).getRow(i)); insertList.add(inInfo.getBlock(EiConstant.resultBlock).getRow(i));
...@@ -181,19 +338,32 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -181,19 +338,32 @@ public class ServiceXSOG0801 extends ServiceBase {
} }
} }
/**
* 删除用户与组织机构关系
*
* @param inInfo
* @return
*/
public EiInfo deleteUserByOrgId(EiInfo inInfo) { public EiInfo deleteUserByOrgId(EiInfo inInfo) {
EiInfo call = new EiInfo(); try {
String orgId = (String)inInfo.get("inqu_status-0-parentOrgId"); EiInfo call = new EiInfo();
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) { 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");
return XServiceManager.call(call);
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "删除失败");
} }
return inInfo;
call.set("list", inInfo.getBlock(EiConstant.resultBlock).getRows());
call.set(EiConstant.serviceId, "S_XS_91");
EiInfo result = XServiceManager.call(call);
return result;
} }
public EiInfo queryUserOutOfOrgId(EiInfo inInfo) { public EiInfo queryUserOutOfOrgId(EiInfo inInfo) {
...@@ -298,7 +468,7 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -298,7 +468,7 @@ public class ServiceXSOG0801 extends ServiceBase {
EiBlock r3Block = inInfo.getBlock("result3"); EiBlock r3Block = inInfo.getBlock("result3");
List rows = r3Block.getRows(); List rows = r3Block.getRows();
rows.forEach((m) -> { rows.forEach((m) -> {
Map row = (Map)m; Map row = (Map) m;
row.put("recRevisor", UserSession.getLoginName()); row.put("recRevisor", UserSession.getLoginName());
}); });
EiInfo call = new EiInfo(); EiInfo call = new EiInfo();
...@@ -310,64 +480,130 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -310,64 +480,130 @@ public class ServiceXSOG0801 extends ServiceBase {
return outInfo; return outInfo;
} }
/**
* 删除组织机构
*
* @param inInfo
* @return
*/
public EiInfo deleteOrgByEname(EiInfo inInfo) { public EiInfo deleteOrgByEname(EiInfo inInfo) {
EiBlock block = inInfo.getBlock(EiConstant.resultBlock); try {
List rows = block.getRows(); List<Map> rows = inInfo.getBlock(EiConstant.resultBlock).getRows();
rows.forEach((m) -> { rows.forEach((row) -> {
Map row = (Map)m; row.put("recRevisor", UserSession.getLoginName());
row.put("recRevisor", UserSession.getLoginName()); String orgId = MapUtils.getString(row, "orgEname");
}); // 清空组织机构下面人员的工人关系
EiInfo call = new EiInfo(); Org org = HPXSTools.XsOrg.get(orgId);
call.set("list", rows); // 校验是否存在进行中的任务
call.set(EiConstant.serviceId, "S_XS_88"); this.checkExistsTask(org.getOrgId(), org.getOrgCname(), org.getOrgType());
EiInfo result = XServiceManager.call(call); // 清除用工关系
if (result.getStatus() > 0) { clearHp013(org.getOrgId(), org.getOrgType(), null);
for(int i = 0; i < rows.size(); ++i) { });
Map param = (Map)rows.get(i); EiInfo call = new EiInfo();
List orgs = this.dao.query("XSOG01.queryOrgInfo", param); call.set("list", rows);
call.set(EiConstant.serviceId, "S_XS_88");
for(int j = 0; j < orgs.size(); ++j) { inInfo = XServiceManager.call(call);
Map memberMap = new HashMap(); if (inInfo.getStatus() > 0) {
memberMap.put("orgId", ((Map)orgs.get(j)).get("orgId")); for (int i = 0; i < rows.size(); ++i) {
this.dao.delete("XSOG02.deleteRelationByOrgId", memberMap); Map param = rows.get(i);
List orgs = this.dao.query("XSOG01.queryOrgInfo", param);
for (int j = 0; j < orgs.size(); ++j) {
Map memberMap = new HashMap();
memberMap.put("orgId", ((Map) orgs.get(j)).get("orgId"));
this.dao.delete("XSOG02.deleteRelationByOrgId", memberMap);
}
} }
} }
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "删除失败");
} }
return inInfo;
return result;
} }
/**
* 删除组织及子节点
*
* @param inInfo
* @return
*/
public EiInfo deleteOrgAndChildrenById(EiInfo inInfo) { public EiInfo deleteOrgAndChildrenById(EiInfo inInfo) {
EiBlock block = inInfo.getBlock(EiConstant.resultBlock); try {
Map idMap = new HashMap(); List<Map> rows = inInfo.getBlock(EiConstant.resultBlock).getRows();
int sum = 0; Map idMap = new HashMap();
int sum = 0;
for(int i = 0; i < block.getRowCount(); ++i) { for (int i = 0; i < rows.size(); ++i) {
String orgId = block.getCell(i, "orgId").toString(); String orgId = rows.get(i).get("orgId").toString();
Map orgIdMap = new HashMap(); Map orgIdMap = new HashMap();
orgIdMap.put("orgId", orgId); orgIdMap.put("orgId", orgId);
List orgIdChildList = this.dao.query("XSOG01.queryOrgChild", orgIdMap); List orgIdChildList = this.dao.query("XSOG01.queryOrgChild", orgIdMap);
for (int j = 0; j < orgIdChildList.size(); ++j) {
for(int j = 0; j < orgIdChildList.size(); ++j) { Map childMap = ((Map) orgIdChildList.get(j));
idMap.put("orgId", ((Map)orgIdChildList.get(j)).get("ORG_ID")); String childOrgId = childMap.get("ORG_ID").toString();
idMap.put("recRevisor", UserSession.getLoginName()); String childOrgName = childMap.get("ORG_CNAME").toString();
idMap.put("recReviseTime", DateUtils.curDateTimeStr14()); String childOrgType = childMap.get("ORG_TYPE").toString();
this.dao.update("XSOG01.deleteOrg", idMap); // 校验是否存在进行中的任务
Map memberMap = new HashMap(); this.checkExistsTask(childOrgId, childOrgName, childOrgType);
memberMap.put("orgId", ((Map)orgIdChildList.get(j)).get("ORG_ID")); idMap.put("orgId", childOrgId);
this.dao.delete("XSOG02.deleteRelationByOrgId", memberMap); idMap.put("recRevisor", UserSession.getLoginName());
++sum; idMap.put("recReviseTime", DateUtils.curDateTimeStr14());
this.dao.update("XSOG01.deleteOrg", idMap);
Map memberMap = new HashMap();
memberMap.put("orgId", ((Map) orgIdChildList.get(j)).get("ORG_ID"));
this.dao.delete("XSOG02.deleteRelationByOrgId", memberMap);
// 清除用工关系
this.clearHp013(childOrgId, childOrgType, null);
++sum;
}
} }
inInfo.setMsg("删除[" + sum + "]条记录成功");
} catch (Exception e) {
LogUtils.setMsg(inInfo, e, "删除失败");
} }
inInfo.setMsg("删除[" + sum + "]条记录成功");
return inInfo; return inInfo;
} }
/**
* 进行中的生产任务
*
* @param orgId 组织机构
* @param orgName
* @param orgType 组织类型
*/
private void checkExistsTask(String orgId, String orgName, String orgType) {
if (OrgTypeEnum.FACTORY.getCode().equals(orgType)) {
List<HPSC005B> dbSc005s = HPSCTools.HpSc005b.listByFactory(orgId, CommonConstant.YesNo.NO_0);
AssertUtils.isNotEmpty(dbSc005s, String.format("厂区【%s】已存在进行中的任务不能删除", orgName));
dbSc005s = HPSCTools.HpSc005b.listByFactory(orgId, CommonConstant.YesNo.YES_1);
AssertUtils.isNotEmpty(dbSc005s, String.format("厂区【%s】存在历史完成任务,删除将影响数据展示", orgName));
} else if (OrgTypeEnum.PROD_GROUP.getCode().equals(orgType)
|| OrgTypeEnum.CUT_GROUP.getCode().equals(orgType)) {
List<HPSC005B> dbSc005s = HPSCTools.HpSc005b.listByGroup(orgId, CommonConstant.YesNo.NO_0);
AssertUtils.isNotEmpty(dbSc005s, String.format("生产部门【%s】已存在进行中的任务不能删除", orgName));
dbSc005s = HPSCTools.HpSc005b.listByGroup(orgId, CommonConstant.YesNo.YES_1);
AssertUtils.isNotEmpty(dbSc005s, String.format("生产部门【%s】存在历史完成任务,删除将影响数据展示", orgName));
}
}
/**
* 清空用工关系
*
* @param orgId 组织机构
* @param orgType 组织类型
*/
private void clearHp013(String orgId, String orgType, String userId) {
if (OrgTypeEnum.FACTORY.getCode().equals(orgType)) {
HPPZTools.HpPz013.clearFactory(orgId, userId);
} else if (OrgTypeEnum.PROD_GROUP.getCode().equals(orgType)
|| OrgTypeEnum.CUT_GROUP.getCode().equals(orgType)) {
HPPZTools.HpPz013.clearGroup(orgId, userId);
}
}
public EiInfo updateTree(EiInfo inInfo) { public EiInfo updateTree(EiInfo inInfo) {
new EiInfo(); new EiInfo();
String orgId = (String)inInfo.getCell("result", 0, "orgId"); String orgId = (String) inInfo.getCell("result", 0, "orgId");
String parentOrgType = (String)inInfo.getCell("result", 0, "parentOrgId"); String parentOrgType = (String) inInfo.getCell("result", 0, "parentOrgId");
Map map = new HashMap(); Map map = new HashMap();
map.put("orgId", orgId); map.put("orgId", orgId);
map.put("parentOrgType", parentOrgType); map.put("parentOrgType", parentOrgType);
...@@ -375,67 +611,9 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -375,67 +611,9 @@ public class ServiceXSOG0801 extends ServiceBase {
return eiInfo; 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 { public EiInfo getImpInfo(EiInfo inInfo) throws IOException {
this.impCacheMap.clear(); this.impCacheMap.clear();
MultipartFile file = (MultipartFile)inInfo.get("file"); MultipartFile file = (MultipartFile) inInfo.get("file");
if (file != null) { if (file != null) {
try { try {
InputStream in = file.getInputStream(); InputStream in = file.getInputStream();
...@@ -515,9 +693,9 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -515,9 +693,9 @@ public class ServiceXSOG0801 extends ServiceBase {
public EiInfo updateUserOrg(EiInfo inInfo) { public EiInfo updateUserOrg(EiInfo inInfo) {
EiBlock rBlock = inInfo.getBlock(EiConstant.resultBlock); EiBlock rBlock = inInfo.getBlock(EiConstant.resultBlock);
Map updateMap = rBlock.getRow(0); Map updateMap = rBlock.getRow(0);
String oldOrgId = (String)updateMap.get("oldOrgId"); String oldOrgId = (String) updateMap.get("oldOrgId");
String newOrgId = (String)updateMap.get("newOrgId"); String newOrgId = (String) updateMap.get("newOrgId");
String userId = (String)updateMap.get("userId"); String userId = (String) updateMap.get("userId");
if (oldOrgId != null && newOrgId != null && userId != null) { if (oldOrgId != null && newOrgId != null && userId != null) {
EiInfo eiInfo = new EiInfo(); EiInfo eiInfo = new EiInfo();
eiInfo.set("inqu_status-0-orgId", newOrgId); eiInfo.set("inqu_status-0-orgId", newOrgId);
...@@ -561,10 +739,10 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -561,10 +739,10 @@ public class ServiceXSOG0801 extends ServiceBase {
Map param = new HashMap(); Map param = new HashMap();
param.put("codesetCode", inInfo.get("codesetCode")); param.put("codesetCode", inInfo.get("codesetCode"));
param.put("projectName", "XSERVICES"); param.put("projectName", "XSERVICES");
String gridBlockId = (String)inInfo.get("gridBlockId"); String gridBlockId = (String) inInfo.get("gridBlockId");
Map attr = inInfo.getBlock(gridBlockId).getAttr(); Map attr = inInfo.getBlock(gridBlockId).getAttr();
int limit = (Integer)attr.get("limit"); int limit = (Integer) attr.get("limit");
int offset = (Integer)attr.get("offset"); int offset = (Integer) attr.get("offset");
List result = DaoFactory.getPlatSqlDao().query("EDCM01.query", param, 0, -999999); List result = DaoFactory.getPlatSqlDao().query("EDCM01.query", param, 0, -999999);
int end = offset + limit; int end = offset + limit;
int size = result.size(); int size = result.size();
...@@ -576,31 +754,36 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -576,31 +754,36 @@ public class ServiceXSOG0801 extends ServiceBase {
} }
EiInfo outInfo = new EiInfo(); EiInfo outInfo = new EiInfo();
outInfo.setMsg("查询成功,共" + ((List)result).size() + "条记录"); outInfo.setMsg("查询成功,共" + result.size() + "条记录");
outInfo.addBlock((String)inInfo.get("gridBlockId")).setRows((List)result); outInfo.addBlock((String) inInfo.get("gridBlockId")).setRows(result);
attr.put("count", size); attr.put("count", size);
outInfo.getBlock((String)inInfo.get("gridBlockId")).setAttr(attr); outInfo.getBlock((String) inInfo.get("gridBlockId")).setAttr(attr);
outInfo.getBlock((String)inInfo.get("gridBlockId")).setBlockMeta((new TEDCM01()).eiMetadata); outInfo.getBlock((String) inInfo.get("gridBlockId")).setBlockMeta((new TEDCM01()).eiMetadata);
return outInfo; return outInfo;
} }
public EiInfo queryUserMetadataImpl(EiInfo inInfo) { 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 enameList = new ArrayList();
List cnameList = new ArrayList(); List cnameList = new ArrayList();
HashMap param; HashMap param;
List result; List result;
int i; int i;
if ("iplat.org.userBasicTemplate".equals(codesetCode)) { 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(enameList,
Collections.addAll(cnameList, new String[]{"登录名", "密码", "状态", "用户名", "性别", "手机", "邮件", "账户过期时间", "密码过期时间", "是否锁定", "创建人", "创建时间", "修改人", "修改时间"}); "loginName", "password", "status", "userName", "gender", "mobile", "email",
"accountExpireDate", "pwdExpireDate", "isLocked", "recCreator", "recCreateTime",
"recRevisor", "recReviseTime");
Collections.addAll(cnameList,
"登录名", "密码", "状态", "用户名", "性别", "手机", "邮件", "账户过期时间", "密码过期时间", "是否锁定", "创建人", "创建时间",
"修改人", "修改时间");
} else { } else {
param = new HashMap(); param = new HashMap();
param.put("customType", "string"); param.put("customType", "string");
result = DaoFactory.getPlatSqlDao().query("XS41.query", param, 0, -999999); result = DaoFactory.getPlatSqlDao().query("XS41.query", param, 0, -999999);
for(i = 0; i < result.size(); ++i) { for (i = 0; i < result.size(); ++i) {
Map userCustom = (Map)result.get(i); Map userCustom = (Map) result.get(i);
enameList.add(userCustom.get("ename")); enameList.add(userCustom.get("ename"));
cnameList.add(userCustom.get("cname")); cnameList.add(userCustom.get("cname"));
} }
...@@ -611,8 +794,8 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -611,8 +794,8 @@ public class ServiceXSOG0801 extends ServiceBase {
param.put("projectName", "XSERVICES"); param.put("projectName", "XSERVICES");
result = DaoFactory.getPlatSqlDao().query("EDCM01.query", param); result = DaoFactory.getPlatSqlDao().query("EDCM01.query", param);
for(i = 0; i < result.size(); ++i) { for (i = 0; i < result.size(); ++i) {
String itemEname = ((TEDCM01)result.get(i)).getItemEname(); String itemEname = ((TEDCM01) result.get(i)).getItemEname();
int index = enameList.indexOf(itemEname); int index = enameList.indexOf(itemEname);
if (-1 < index) { if (-1 < index) {
enameList.remove(index); enameList.remove(index);
...@@ -622,7 +805,7 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -622,7 +805,7 @@ public class ServiceXSOG0801 extends ServiceBase {
List paramList = new ArrayList(); List paramList = new ArrayList();
for(i = 0; i < enameList.size(); ++i) { for (i = 0; i < enameList.size(); ++i) {
Map map = new HashMap(); Map map = new HashMap();
map.put("ename", enameList.get(i)); map.put("ename", enameList.get(i));
map.put("cname", cnameList.get(i)); map.put("cname", cnameList.get(i));
...@@ -637,9 +820,9 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -637,9 +820,9 @@ public class ServiceXSOG0801 extends ServiceBase {
public EiInfo insertUserCustomDetailTableHeader(EiInfo inInfo) { public EiInfo insertUserCustomDetailTableHeader(EiInfo inInfo) {
List<Map> rows = inInfo.getBlock("result5").getRows(); List<Map> rows = inInfo.getBlock("result5").getRows();
for(int i = 0; i < rows.size(); ++i) { for (int i = 0; i < rows.size(); ++i) {
((Map)rows.get(i)).put("ename", ((Map)rows.get(i)).get("itemEname")); rows.get(i).put("ename", rows.get(i).get("itemEname"));
((Map)rows.get(i)).put("cname", ((Map)rows.get(i)).get("itemCname")); rows.get(i).put("cname", rows.get(i).get("itemCname"));
} }
inInfo.set("rows", rows); inInfo.set("rows", rows);
...@@ -648,25 +831,26 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -648,25 +831,26 @@ public class ServiceXSOG0801 extends ServiceBase {
} }
public EiInfo insertUserTableHeaderImpl(EiInfo inInfo) { public EiInfo insertUserTableHeaderImpl(EiInfo inInfo) {
List<Map<String, String>> rows = (List)inInfo.get("rows"); List<Map<String, String>> rows = (List) inInfo.get("rows");
String codesetCode = (String)inInfo.get("codesetCode"); 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 tedcm01 = new TEDCM01();
tedcm01.setCodesetCode(codesetCode); tedcm01.setCodesetCode(codesetCode);
tedcm01.setProjectName("XSERVICES"); 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)) { if (!this.checkCodeSet(tedcm01)) {
inInfo.setStatus(-1); inInfo.setStatus(-1);
inInfo.setMsg((String)((Map)rows.get(i)).get("ename") + "重复,新增失败"); inInfo.setMsg(((Map) rows.get(i)).get("ename") + "重复,新增失败");
return inInfo; return inInfo;
} }
tedcm01.setItemEname((String)((Map)rows.get(i)).get("ename")); tedcm01.setItemEname((String) ((Map) rows.get(i)).get("ename"));
tedcm01.setItemCname((String)((Map)rows.get(i)).get("cname")); tedcm01.setItemCname((String) ((Map) rows.get(i)).get("cname"));
tedcm01.setStatus("1"); tedcm01.setStatus("1");
tedcm01.setItemStatus("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.setRecCreator(String.valueOf(UserSession.getLoginName()));
tedcm01.setRecCreateTime(DateUtils.curDateTimeStr14()); tedcm01.setRecCreateTime(DateUtils.curDateTimeStr14());
tedcm01.setRecRevisor(" "); tedcm01.setRecRevisor(" ");
...@@ -686,7 +870,8 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -686,7 +870,8 @@ public class ServiceXSOG0801 extends ServiceBase {
} }
public EiInfo deleteUserMetadata(EiInfo inInfo) { 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); inInfo.addBlock(EiConstant.resultBlock).addRows(result);
super.delete(inInfo, "tedcm01.delete"); super.delete(inInfo, "tedcm01.delete");
AdminUtil.cleanCache(inInfo, "iplat:codeset"); AdminUtil.cleanCache(inInfo, "iplat:codeset");
...@@ -700,7 +885,7 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -700,7 +885,7 @@ public class ServiceXSOG0801 extends ServiceBase {
inInfo.addBlock(EiConstant.resultBlock).addRows(eiBlock.getRows()); inInfo.addBlock(EiConstant.resultBlock).addRows(eiBlock.getRows());
int i; int i;
for(i = 0; i < eiBlock.getRowCount(); ++i) { for (i = 0; i < eiBlock.getRowCount(); ++i) {
String userId = String.valueOf(UserSession.getLoginName()); String userId = String.valueOf(UserSession.getLoginName());
String dateTime = DateUtils.curDateTimeStr14(); String dateTime = DateUtils.curDateTimeStr14();
inInfo.getBlock(EiConstant.resultBlock).setCell(i, "recRevisor", userId); inInfo.getBlock(EiConstant.resultBlock).setCell(i, "recRevisor", userId);
...@@ -713,95 +898,19 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -713,95 +898,19 @@ public class ServiceXSOG0801 extends ServiceBase {
return inInfo; 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) { public EiInfo importCustomUser(EiInfo inInfo) {
EiInfo outInfo = new EiInfo(); EiInfo outInfo = new EiInfo();
if (this.impCacheMap != null && !this.impCacheMap.isEmpty()) { if (this.impCacheMap != null && !this.impCacheMap.isEmpty()) {
List impDetail = (List)this.impCacheMap.get("用户详情表"); List impDetail = (List) this.impCacheMap.get("用户详情表");
String[] currentRegion = (String[])((String[])impDetail.get(0)); String[] currentRegion = (String[]) impDetail.get(0);
int basicRegionCount = 0; int basicRegionCount = 0;
int orgRegionCount = 0; int orgRegionCount = 0;
int customRegionCount = 0; int customRegionCount = 0;
for(int i = 0; i < currentRegion.length; ++i) { for (int i = 0; i < currentRegion.length; ++i) {
String var9 = currentRegion[i]; String var9 = currentRegion[i];
byte var10 = -1; byte var10 = -1;
switch(var9.hashCode()) { switch (var9.hashCode()) {
case 701194932: case 701194932:
if (var9.equals("基础信息")) { if (var9.equals("基础信息")) {
var10 = 0; var10 = 0;
...@@ -818,7 +927,7 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -818,7 +927,7 @@ public class ServiceXSOG0801 extends ServiceBase {
} }
} }
switch(var10) { switch (var10) {
case 0: case 0:
++basicRegionCount; ++basicRegionCount;
break; break;
...@@ -831,24 +940,25 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -831,24 +940,25 @@ public class ServiceXSOG0801 extends ServiceBase {
} }
EiInfo tableHeaderInfo = queryUserTableHeader(new EiInfo()); 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)); List<String> currentHeaderList = new ArrayList(Arrays.asList(currentHeader));
currentHeaderList.removeIf(String::isEmpty); currentHeaderList.removeIf(String::isEmpty);
String[] currentHeaderWithoutEmpty = (String[])currentHeaderList.toArray(new String[0]); String[] currentHeaderWithoutEmpty = currentHeaderList.toArray(new String[0]);
boolean isSame = true; boolean isSame = true;
List<String> basicCnameList = (List)tableHeaderInfo.get("basicCnameList"); List<String> basicCnameList = (List) tableHeaderInfo.get("basicCnameList");
List<String> customCnameList = (List)tableHeaderInfo.get("customCnameList"); List<String> customCnameList = (List) tableHeaderInfo.get("customCnameList");
int i; int i;
for(i = 0; i < basicRegionCount; ++i) { for (i = 0; i < basicRegionCount; ++i) {
if (!currentHeaderWithoutEmpty[i].equals(basicCnameList.get(i))) { if (!currentHeaderWithoutEmpty[i].equals(basicCnameList.get(i))) {
isSame = false; isSame = false;
break; break;
} }
} }
for(i = 0; i < customRegionCount; ++i) { for (i = 0; i < customRegionCount; ++i) {
if (!isSame || !currentHeaderWithoutEmpty[i + basicRegionCount + orgRegionCount].equals(customCnameList.get(i))) { if (!isSame || !currentHeaderWithoutEmpty[i + basicRegionCount + orgRegionCount].equals(
customCnameList.get(i))) {
isSame = false; isSame = false;
break; break;
} }
...@@ -861,19 +971,21 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -861,19 +971,21 @@ public class ServiceXSOG0801 extends ServiceBase {
return inInfo; return inInfo;
} }
List basicEnameList = (List)tableHeaderInfo.get("basicEnameList"); List basicEnameList = (List) tableHeaderInfo.get("basicEnameList");
List userResult = new ArrayList(); List userResult = new ArrayList();
String[] userHeader = new String[]{"登录名", "密码", "状态", "用户名", "性别", "手机号", "电子邮件", "账号过期时间", "密码过期时间", "是否被锁定"}; String[] userHeader = new String[]{"登录名", "密码", "状态", "用户名", "性别", "手机号", "电子邮件", "账号过期时间", "密码过期时间",
String[] userProp = new String[]{"loginName", "password", "status", "userName", "gender", "mobile", "email", "accountExpireDate", "pwdExpireDate", "isLocked"}; "是否被锁定"};
String[] userProp = new String[]{"loginName", "password", "status", "userName", "gender", "mobile", "email",
"accountExpireDate", "pwdExpireDate", "isLocked"};
userResult.add(userHeader); userResult.add(userHeader);
String[] userDetail; String[] userDetail;
int index; int index;
for(i = 2; i < impDetail.size(); ++i) { for (i = 2; i < impDetail.size(); ++i) {
userDetail = (String[]) impDetail.get(i); userDetail = (String[]) impDetail.get(i);
String[] user = new String[10]; 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]; String prop = userProp[j];
index = basicEnameList.indexOf(prop); index = basicEnameList.indexOf(prop);
if (-1 < index) { if (-1 < index) {
...@@ -887,7 +999,8 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -887,7 +999,8 @@ public class ServiceXSOG0801 extends ServiceBase {
} }
List orgResult = new ArrayList(); List orgResult = new ArrayList();
String[] userDetailHeader = new String[]{"组织编码", "组织名称", "组织别名", "组织类型", "上级组织英文名", "成立日期", "组织级别", "节点类型(1-树节点|2-叶子节点)", "排序", "逻辑删除(1-已删除|0-正常状态)"}; String[] userDetailHeader = new String[]{"组织编码", "组织名称", "组织别名", "组织类型", "上级组织英文名", "成立日期", "组织级别",
"节点类型(1-树节点|2-叶子节点)", "排序", "逻辑删除(1-已删除|0-正常状态)"};
orgResult.add(userDetailHeader); orgResult.add(userDetailHeader);
List orgUserResult = new ArrayList(); List orgUserResult = new ArrayList();
String[] orgUserHeader = new String[]{"组织机构英文名", "用户登录名"}; String[] orgUserHeader = new String[]{"组织机构英文名", "用户登录名"};
...@@ -899,11 +1012,11 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -899,11 +1012,11 @@ public class ServiceXSOG0801 extends ServiceBase {
String ename; String ename;
String[] userCustom; String[] userCustom;
String[] org; String[] org;
for(index = 2; index < impDetail.size(); ++index) { for (index = 2; index < impDetail.size(); ++index) {
String[] itemUserDetail = (String[]) impDetail.get(index); String[] itemUserDetail = (String[]) impDetail.get(index);
String parentEname = "root"; String parentEname = "root";
for(j = 0; j <= orgRegionCount / 2; ++j) { for (j = 0; j <= orgRegionCount / 2; ++j) {
String orgCname = userDetailHeader[basicRegionCount + 2 * j]; String orgCname = userDetailHeader[basicRegionCount + 2 * j];
orgEname = itemUserDetail[basicRegionCount + 2 * j + 1]; orgEname = itemUserDetail[basicRegionCount + 2 * j + 1];
if (orgEname != null && !"".equals(orgEname) && j != orgRegionCount / 2) { if (orgEname != null && !"".equals(orgEname) && j != orgRegionCount / 2) {
...@@ -927,27 +1040,28 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -927,27 +1040,28 @@ public class ServiceXSOG0801 extends ServiceBase {
} }
} }
List<Map> userCustomList = DaoFactory.getPlatSqlDao().query("XS41.query", (Object)null, 0, -999999); List<Map> userCustomList = DaoFactory.getPlatSqlDao().query("XS41.query", null, 0, -999999);
List<String> customEnameList = (List)tableHeaderInfo.get("customEnameList"); List<String> customEnameList = (List) tableHeaderInfo.get("customEnameList");
Map userCustomMap = new HashMap(); Map userCustomMap = new HashMap();
for(j = 0; j < userCustomList.size(); ++j) { for (j = 0; j < userCustomList.size(); ++j) {
Map itemMap = (Map)userCustomList.get(j); Map itemMap = userCustomList.get(j);
orgEname = (String)itemMap.get("ename"); orgEname = (String) itemMap.get("ename");
userCustomMap.put(orgEname, itemMap); userCustomMap.put(orgEname, itemMap);
} }
List userCustomResult = new ArrayList(); List userCustomResult = new ArrayList();
String[] userCustomHeader = new String[]{"自定义属性英文名", "自定义属性中文名", "自定义属性类型", "自定义属性排序", "(字符)是否必填", "(字符)默认值"}; String[] userCustomHeader = new String[]{"自定义属性英文名", "自定义属性中文名", "自定义属性类型", "自定义属性排序", "(字符)是否必填",
"(字符)默认值"};
userCustomResult.add(userCustomHeader); userCustomResult.add(userCustomHeader);
for(i = 0; i < customEnameList.size(); ++i) { for (i = 0; i < customEnameList.size(); ++i) {
ename = (String)customEnameList.get(i); ename = customEnameList.get(i);
if (userCustomMap.get(ename) == null) { if (userCustomMap.get(ename) == null) {
userCustom = new String[6]; userCustom = new String[6];
Arrays.fill(userCustom, ""); Arrays.fill(userCustom, "");
userCustom[0] = ename; userCustom[0] = ename;
userCustom[1] = (String)customCnameList.get(i); userCustom[1] = customCnameList.get(i);
userCustom[2] = "string"; userCustom[2] = "string";
userCustom[3] = "0"; userCustom[3] = "0";
userCustom[4] = "0"; userCustom[4] = "0";
...@@ -958,14 +1072,14 @@ public class ServiceXSOG0801 extends ServiceBase { ...@@ -958,14 +1072,14 @@ public class ServiceXSOG0801 extends ServiceBase {
List customMemberResult = new ArrayList(); List customMemberResult = new ArrayList();
org = new String[]{"用户登录名", "自定义属性英文名", "自定义属性值"}; org = new String[]{"用户登录名", "自定义属性英文名", "自定义属性值"};
customMemberResult.add(org); 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[] itemUserDetail = (String[]) impDetail.get(i);
String loginName = itemUserDetail[0]; String loginName = itemUserDetail[0];
for(j = 0; j < customCount; ++j) { for (j = 0; j < customCount; ++j) {
String itemEname = (String)customEnameList.get(j); String itemEname = customEnameList.get(j);
String value = itemUserDetail[basicRegionCount + orgRegionCount + j]; String value = itemUserDetail[basicRegionCount + orgRegionCount + j];
String[] customMember = new String[]{loginName, itemEname, value}; String[] customMember = new String[]{loginName, itemEname, value};
customMemberResult.add(customMember); customMemberResult.add(customMember);
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN" "http://www.ibatis.com/dtd/sql-map-2.dtd">
<sqlMap namespace="XSOG01">
<!--组织机构所有子节点树查询-->
<select id="queryOrgChild" resultClass="java.util.HashMap">
SELECT PARENT_ORG_ID, ORG_ID,ORG_ENAME,ORG_CNAME,ORG_TYPE FROM ${platSchema}.TXSOG01 WHERE FIND_IN_SET(ORG_ID,${platSchema}.getChildrenOrg(#orgId#)) AND IS_DELETED = '0';
</select>
<!--根据组织机构编码 获取所有父节点的组织机构信息。包括本身-->
<select id="queryOrgByOrgEnameAndLevel" parameterClass="java.util.HashMap"
resultClass="java.util.HashMap">
SELECT org_id as "orgId",
org_ename as "orgEname",
org_cname as "orgCname",
org_type as "orgType",
sort_index as "sortIndex",
parent_org_id as "parentOrgId"
from ${platSchema}.txsog01
where FIND_IN_SET(org_id,${platSchema}.queryParentOrgs(#orgId#)) AND IS_DELETED = '0';
</select>
<!--根据组织机构编码向上递归组织机构 返回组织结构Id、父组织机构Id、由下向上的层级数-->
<sql id="getRecursiveUpOrg">
SELECT
@a as orgId,
(SELECT org_ename FROM ${platSchema}.TXSOG01 where org_id = @a) as orgEname,
(SELECT org_Cname FROM ${platSchema}.TXSOG01 where org_id = @a) as orgCname,
(SELECT org_type FROM ${platSchema}.TXSOG01 where org_id = @a) as orgType,
(SELECT @a:=parent_org_id from ${platSchema}.txsog01 where org_id = @a limit 0,1) as parentOrgId,
@b := @b+1 as lv
FROM (SELECT @a:= (SELECT ORG_ID FROM ${platSchema}.txsog01 WHERE 1=1
<isNotEmpty prepend=" AND " property="orgId">
ORG_ID = #orgId#
</isNotEmpty>
<isEmpty prepend=" " property="orgId">
<isNotEmpty prepend=" AND " property="orgEname">
ORG_ENAME = #orgEname#
</isNotEmpty>
</isEmpty>
AND IS_DELETED = '0' limit 0,1),@b:=0) vars,txsog01 t
where @a <![CDATA[<>]]> ''
</sql>
<!--根据组织机构代码获取匹配特定类型的父组织机构-->
<select id="getParentOrgByOrgEnameAndOrgType" parameterClass="java.util.HashMap"
resultClass="java.util.HashMap">
select * FROM (<include refid="getRecursiveUpOrg"/>) a Where a.orgEname <![CDATA[<>]]> #orgEname# AND a.orgType = #orgType#
</select>
<!--向上递归查询 到组织机构类型不等于company-->
<select id="queryOneLevelOrgByOrgId" parameterClass="java.util.HashMap"
resultClass="java.util.HashMap">
SELECT org_id as "orgId",org_ename as "orgEname",org_cname as "orgCname" from ${platSchema}.txsog01
where FIND_IN_SET(org_id,${platSchema}.queryParentOrg(#orgId#,'company')) AND org_Id != 'root';
</select>
</sqlMap>
\ No newline at end of file
...@@ -264,10 +264,12 @@ ...@@ -264,10 +264,12 @@
<!--组织机构所有子节点树查询--> <!--组织机构所有子节点树查询-->
<select id="queryOrgChild" resultClass="java.util.HashMap"> <select id="queryOrgChild" resultClass="java.util.HashMap">
WITH report(PARENT_ORG_ID, ORG_ID,ORG_ENAME,ORG_CNAME) AS ( WITH report(PARENT_ORG_ID, ORG_ID,ORG_ENAME,ORG_CNAME, ORG_TYPE) AS (
SELECT PARENT_ORG_ID, ORG_ID,ORG_ENAME,ORG_CNAME FROM ${platSchema}.TXSOG01 WHERE ORG_ID = #orgId# and is_deleted = '0' SELECT PARENT_ORG_ID, ORG_ID,ORG_ENAME,ORG_CNAME,ORG_TYPE FROM ${platSchema}.TXSOG01
UNION ALL WHERE ORG_ID = #orgId# and is_deleted = '0'
SELECT b.PARENT_ORG_ID, b.ORG_ID,b.ORG_ENAME,b.ORG_CNAME FROM report a, ${platSchema}.TXSOG01 b WHERE b.PARENT_ORG_ID = a.ORG_ID and b.is_deleted = '0' UNION ALL
SELECT b.PARENT_ORG_ID, b.ORG_ID,b.ORG_ENAME,b.ORG_CNAME,b.ORG_TYPE FROM report a, ${platSchema}.TXSOG01 b
WHERE b.PARENT_ORG_ID = a.ORG_ID and b.is_deleted = '0'
) )
SELECT * FROM report SELECT * FROM report
</select> </select>
......
...@@ -97,7 +97,7 @@ let save = function () { ...@@ -97,7 +97,7 @@ let save = function () {
for (let i = 0; i < rows.length; i++) { for (let i = 0; i < rows.length; i++) {
let item = rows[i]; let item = rows[i];
if (isBlank(item['factoryCode'])) { if (isBlank(item['factoryCode'])) {
message("选中的第" + (i + 1) + "行\"工厂\",不能为空!"); message("选中的第" + (i + 1) + "行\"厂区\",不能为空!");
return; return;
} }
if (isBlank(item['groupType'])) { if (isBlank(item['groupType'])) {
...@@ -153,6 +153,21 @@ let checkIn = function () { ...@@ -153,6 +153,21 @@ let checkIn = function () {
message("请选择数据"); message("请选择数据");
return; return;
} }
for (let i = 0; i < rows.length; i++) {
let item = rows[i];
if (isBlank(item['factoryCode'])) {
message("选中的第" + (i + 1) + "行\"厂区\",不能为空!");
return;
}
if (isBlank(item['groupType'])) {
message("选中的第" + (i + 1) + "行\"部门类型\",不能为空!");
return;
}
if (isBlank(item['groupCode'])) {
message("选中的第" + (i + 1) + "行\"生产部门\",不能为空!");
return;
}
}
JSColorbox.open({ JSColorbox.open({
href: "HPPZ013A?methodName=initLoad", href: "HPPZ013A?methodName=initLoad",
title: "<div style='text-align: center;'>用工登记</div>", title: "<div style='text-align: center;'>用工登记</div>",
......
...@@ -42,14 +42,13 @@ ...@@ -42,14 +42,13 @@
<EF:EFColumn ename="userId" cname="工号" enable="false" width="120" align="center"/> <EF:EFColumn ename="userId" cname="工号" enable="false" width="120" align="center"/>
<EF:EFColumn ename="userName" cname="姓名" width="120" align="center" required="true" readonly="true"/> <EF:EFColumn ename="userName" cname="姓名" width="120" align="center" required="true" readonly="true"/>
<EF:EFComboColumn ename="factoryCode" cname="厂区" width="110" align="center" defaultValue="" required="true" <EF:EFComboColumn ename="factoryCode" cname="厂区" width="110" align="center" defaultValue="" required="true"
filter="contains" readonly="true"> filter="contains">
<EF:EFOptions blockId="factory_record_block_id" valueField="valueField" textField="textField"/> <EF:EFOptions blockId="factory_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFComboColumn ename="groupType" cname="部门类型" width="80" align="center" required="true" <EF:EFComboColumn ename="groupType" cname="部门类型" width="80" align="center" required="true">
readonly="true">
<EF:EFCodeOption codeName="xs.og.orgType" condition="ITEM_CODE IN ('prodGroup', 'cutGroup')"/> <EF:EFCodeOption codeName="xs.og.orgType" condition="ITEM_CODE IN ('prodGroup', 'cutGroup')"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="groupCode" cname="生产部门" width="120" align="center" required="true" readonly="true"/> <EF:EFColumn ename="groupCode" cname="生产部门" width="120" align="center" required="true"/>
<EF:EFComboColumn ename="gender" cname="性别" width="80" align="center" required="true" readonly="true" <EF:EFComboColumn ename="gender" cname="性别" width="80" align="center" required="true" readonly="true"
valueField="valueField" textField="textField"> valueField="valueField" textField="textField">
<EF:EFCodeOption codeName="xservices.xs.sex"/> <EF:EFCodeOption codeName="xservices.xs.sex"/>
......
...@@ -42,13 +42,15 @@ ...@@ -42,13 +42,15 @@
<EF:EFColumn ename="regDate" cname="登记日期" enable="false" width="100" align="center" <EF:EFColumn ename="regDate" cname="登记日期" enable="false" width="100" align="center"
editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/> editType="date" dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']"/>
<EF:EFColumn ename="userId" cname="工号" enable="false" width="120" align="center"/> <EF:EFColumn ename="userId" cname="工号" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="factoryCode" cname="工厂" enable="false" width="110" align="center"> <EF:EFColumn ename="factoryName" cname="厂区" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="factoryCode" cname="厂区" enable="false" width="110" align="center" hidden="true">
<EF:EFOptions blockId="factory_record_block_id" valueField="valueField" textField="textField"/> <EF:EFOptions blockId="factory_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFComboColumn ename="groupType" cname="部门类型" enable="false" width="80" align="center"> <EF:EFComboColumn ename="groupType" cname="部门类型" enable="false" width="80" align="center">
<EF:EFCodeOption codeName="xs.og.orgType" condition="ITEM_CODE IN ('prodGroup', 'cutGroup')"/> <EF:EFCodeOption codeName="xs.og.orgType" condition="ITEM_CODE IN ('prodGroup', 'cutGroup')"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFComboColumn ename="groupCode" cname="生产部门" enable="false" width="110" align="center"> <EF:EFColumn ename="groupName" cname="生产部门" enable="false" width="120" align="center"/>
<EF:EFComboColumn ename="groupCode" cname="生产部门" enable="false" width="110" align="center" hidden="true">
<EF:EFOptions blockId="group_record_block_id" valueField="valueField" textField="textField"/> <EF:EFOptions blockId="group_record_block_id" valueField="valueField" textField="textField"/>
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFColumn ename="userName" cname="姓名" enable="false" width="120" align="center"/> <EF:EFColumn ename="userName" cname="姓名" enable="false" width="120" align="center"/>
......
...@@ -17,6 +17,17 @@ $(function () { ...@@ -17,6 +17,17 @@ $(function () {
} }
let flag = true; let flag = true;
$.each(rows, function(index, item) { $.each(rows, function(index, item) {
let id = item.get("id");
if (isBlank(id)) {
IPLAT.alert({
message: "选中的第" + (index + 1) + "行数据未保存,不能批量派工!",
okFn: function (e) {
},
title: '错误'
});
flag = false;
return false;
}
let status = item.get("status"); let status = item.get("status");
if (status === "1") { if (status === "1") {
IPLAT.alert({ IPLAT.alert({
......
...@@ -2,15 +2,6 @@ $(function () { ...@@ -2,15 +2,6 @@ $(function () {
var factoryCodes = __eiInfo.getBlock("factory_code_block_id").getMappedRows(); var factoryCodes = __eiInfo.getBlock("factory_code_block_id").getMappedRows();
var groupCodes = __eiInfo.getBlock("group_code_block_id").getMappedRows(); var groupCodes = __eiInfo.getBlock("group_code_block_id").getMappedRows();
var userIds = __eiInfo.getBlock("user_id_block_id").getMappedRows(); var userIds = __eiInfo.getBlock("user_id_block_id").getMappedRows();
var factoryCode = _.filter(__eiInfo.getBlock("factory_code_block_id").getMappedRows(), function (item) {
return item["param1Field"]=="false";
});
var groupCode = _.filter(__eiInfo.getBlock("group_code_block_id").getMappedRows(), function (item) {
return item["param2Field"]=="false";
});
var userId = _.filter(__eiInfo.getBlock("user_id_block_id").getMappedRows(), function (item) {
return item["param3Field"]=="false";
});
$(".row").children().attr("class", "col-md-3"); $(".row").children().attr("class", "col-md-3");
...@@ -52,6 +43,17 @@ $(function () { ...@@ -52,6 +43,17 @@ $(function () {
return currShortDate(); return currShortDate();
} }
},{ },{
field: "factoryCode",
title: "工厂",
template: function (dataItem) {
for (let i = 0; i < factoryCodes.length; i++) {
if (factoryCodes[i]['valueField'] === dataItem['factoryCode']) {
return factoryCodes[i]['textField'];
}
}
return dataItem["factoryCode"];
}
},{
field: "groupCode", field: "groupCode",
title: "生产组", title: "生产组",
filter: function (options) { filter: function (options) {
...@@ -65,6 +67,14 @@ $(function () { ...@@ -65,6 +67,14 @@ $(function () {
} else { } else {
return []; return [];
} }
},
template: function (dataItem) {
for (let i = 0; i < groupCodes.length; i++) {
if (groupCodes[i]['valueField'] === dataItem['groupCode']) {
return groupCodes[i]['textField'];
}
}
return dataItem["groupCode"];
} }
},{ },{
field: "userId", field: "userId",
...@@ -81,6 +91,14 @@ $(function () { ...@@ -81,6 +91,14 @@ $(function () {
} else { } else {
return []; return [];
} }
},
template: function (dataItem) {
for (let i = 0; i < userIds.length; i++) {
if (userIds[i]['valueField'] === dataItem['userId']) {
return userIds[i]['textField'];
}
}
return dataItem["userId"];
} }
}], }],
loadComplete: function(grid) { loadComplete: function(grid) {
...@@ -101,10 +119,10 @@ $(function () { ...@@ -101,10 +119,10 @@ $(function () {
//e.sender.dataSource.options.fields[5].values = groupCode //e.sender.dataSource.options.fields[5].values = groupCode
//e.sender.dataSource.options.fields[6].values = userId; //e.sender.dataSource.options.fields[6].values = userId;
// 动态设置默认邮箱 // 动态设置默认邮箱
$.each(e.items, function(index, item){ /*$.each(e.items, function(index, item){
item['prdtName'] = "demo"+ index + "@baosight.com"; item['prdtName'] = "demo"+ index + "@baosight.com";
}); });*/
}, },
onSave: function (e) { onSave: function (e) {
// 阻止默认请求,使用自定义保存 // 阻止默认请求,使用自定义保存
...@@ -148,7 +166,7 @@ $(function () { ...@@ -148,7 +166,7 @@ $(function () {
EiCommunicator.send("HPSC008", "queryFactoryCode", inInfo, { EiCommunicator.send("HPSC008", "queryFactoryCode", inInfo, {
onSuccess: function (ei) { onSuccess: function (ei) {
var input=$("#inqu_status-0-groupCode"); var input=$("#inqu_status-0-groupCode");
dataEdition=ei.getBlock("group_code_block_id").getMappedRows(); let dataEdition=ei.getBlock("group_code_block_id").getMappedRows();
input.kendoDropDownList({ input.kendoDropDownList({
valuePrimitive: true, valuePrimitive: true,
dataTextField: "textField", dataTextField: "textField",
...@@ -171,7 +189,7 @@ $(function () { ...@@ -171,7 +189,7 @@ $(function () {
EiCommunicator.send("HPSC008", "queryGroupCode", inInfo, { EiCommunicator.send("HPSC008", "queryGroupCode", inInfo, {
onSuccess: function (ei) { onSuccess: function (ei) {
var input=$("#inqu_status-0-userId"); var input=$("#inqu_status-0-userId");
dataEdition=ei.getBlock("user_id_block_id").getMappedRows(); let dataEdition=ei.getBlock("user_id_block_id").getMappedRows();
input.kendoDropDownList({ input.kendoDropDownList({
valuePrimitive: true, valuePrimitive: true,
dataTextField: "textField", dataTextField: "textField",
......
...@@ -48,19 +48,19 @@ ...@@ -48,19 +48,19 @@
<EF:EFColumn ename="companyCode" cname="企业编码" hidden="true"/> <EF:EFColumn ename="companyCode" cname="企业编码" hidden="true"/>
<EF:EFColumn ename="registerDate" cname="登记日期" width="160" align="center" editType="date" readonly="true" <EF:EFColumn ename="registerDate" cname="登记日期" width="160" align="center" editType="date" readonly="true"
dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/> dateFormat="yyyy-MM-dd" parseFormats="['yyyyMMdd']" required="true"/>
<EF:EFComboColumn ename="factoryCode" cname="工厂" blockName="factory_code_block_id" <EF:EFComboColumn ename="factoryCode" cname="工厂" blockName="factory_code1_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#" columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField" textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="120" required="true" maxLength="16" readonly="true" width="120" required="true"
align="center" filter="contains" sort="true"> align="center" filter="contains" sort="true">
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFComboColumn ename="groupCode" cname="生产组" blockName="group_code_block_id" <EF:EFComboColumn ename="groupCode" cname="生产组" blockName="group_code1_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#" columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField" textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="120" required="true" maxLength="16" readonly="true" width="120" required="true"
align="center" filter="contains" sort="true"> align="center" filter="contains" sort="true">
</EF:EFComboColumn> </EF:EFComboColumn>
<EF:EFComboColumn ename="userId" cname="员工" blockName="user_id_block_id" <EF:EFComboColumn ename="userId" cname="员工" blockName="user_id1_block_id"
columnTemplate="#=textField#" itemTemplate="#=textField#" columnTemplate="#=textField#" itemTemplate="#=textField#"
textField="textField" valueField="valueField" textField="textField" valueField="valueField"
maxLength="16" readonly="true" width="100" required="true" maxLength="16" readonly="true" width="100" required="true"
......
...@@ -43,10 +43,10 @@ $(function () { ...@@ -43,10 +43,10 @@ $(function () {
field: "docName", field: "docName",
title: "文件名称", title: "文件名称",
template: function (item) { template: function (item) {
let docId = item.docId;
let docName = item.docName let docName = item.docName
let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" ' let template = '<a style="cursor: pointer;display: inline-flex;justify-content: center;margin:auto 5px" '
+ 'href="' + IPLATUI.CONTEXT_PATH + '/EU/DM/EUDM06.jsp?docId=' + item.docId + 'href="' + downloadHref(docId) + '" target="_blank">'+docName+'</a>';
+ '" >'+docName+'</a>';
return template; return template;
} }
}], }],
...@@ -119,11 +119,14 @@ $(function () { ...@@ -119,11 +119,14 @@ $(function () {
NotificationUtil("请至少选中一条数据", "info"); NotificationUtil("请至少选中一条数据", "info");
} else { } else {
for (let i = 0, length = checkedRows.length; i < length; i++) { for (let i = 0, length = checkedRows.length; i < length; i++) {
docId += checkedRows[i]["docId"];
docId += "," window.location.href = downloadHref(checkedRows[i]["docId"])
//docId += checkedRows[i]["docId"];
//docId += ","
} }
docId = docId.substr(0, docId.lastIndexOf(','));
window.location.href = IPLATUI.CONTEXT_PATH + '/EU/DM/EUDM14.jsp?docIds=' + docId //docId = docId.substr(0, docId.lastIndexOf(','));
//window.location.href = IPLATUI.CONTEXT_PATH + '/EU/DM/EUDM14.jsp?docIds=' + docId
} }
}) })
......
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