Merge pull request 'feature/dxf' (#9) from feature/dxf into develop

Reviewed-on: #9
pull/10/head^2
dxfeng 3 years ago
commit 585746c723

@ -60,7 +60,7 @@ update jcl_org_comp set ec_company = ( select eccompany from ( select DISTINCT b
update JCL_ORG_DEPT set ec_department = ( select ecdepartment from ( select DISTINCT b.id as parent_dept, c.id as ecdepartment from JCL_ORG_DEPT a inner join JCL_ORG_DEPT b on a.parent_dept = b.id inner join hrmdepartment c on b.uuid = c.uuid ) e where JCL_ORG_DEPT.parent_dept = e.parent_dept );
update JCL_ORG_DEPT set ec_company = ( select eccompany from ( select a.id as id, c.id as eccompany from jcl_org_comp a inner join hrmsubcompany c on a.uuid = c.uuid) e where JCL_ORG_DEPT.parent_comp = e.id );
-- 更新人员jobtitle
update hrmresource set jobtitle = ( select id from HRMJOBTITLES where JOBTITLENAME = ( select JOB_NAME from jcl_org_job where id = ( select FIELD100002 from CUS_FIELDDATA where scope = 'HrmCustomFieldByInfoType' and SCOPEID = '-1' and CUS_FIELDDATA.ID = hrmresource.ID)));
update hrmresource set jobtitle = ( select top 1 id from HRMJOBTITLES where JOBTITLENAME = ( select JOB_NAME from jcl_org_job where id = ( select FIELD100002 from CUS_FIELDDATA where scope = 'HrmCustomFieldByInfoType' and SCOPEID = '-1' and CUS_FIELDDATA.ID = hrmresource.ID)));
-- 更新岗位ec_company、ec_department
update jcl_org_job set ec_company = (select eccompany from ( select a.id as id, c.id as eccompany from jcl_org_comp a inner join hrmsubcompany c on a.uuid = c.uuid) e where jcl_org_job.parent_comp = e.id );
update jcl_org_job set ec_department = ( select ec_department from ( select a.id as id, c.id as ec_department from jcl_org_dept a inner join hrmdepartment c on a.uuid = c.uuid) e where jcl_org_job.parent_dept = e.id );

@ -9,20 +9,22 @@ import com.engine.organization.component.OrganizationWeaTable;
import com.engine.organization.entity.browser.bo.CusBowserTreeBO;
import com.engine.organization.entity.browser.enums.TreeNodeTypeEnum;
import com.engine.organization.entity.browser.po.CusBrowserTree;
import com.engine.organization.entity.company.po.CompPO;
import com.engine.organization.entity.department.po.DepartmentPO;
import com.engine.organization.entity.job.vo.JobBrowserVO;
import com.engine.organization.entity.searchtree.SearchTree;
import com.engine.organization.entity.searchtree.SearchTreeParams;
import com.engine.organization.service.impl.JobServiceImpl;
import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.util.OrganizationFormItemUtil;
import com.engine.organization.util.db.DBType;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.tree.SearchTreeUtil;
import org.apache.commons.lang.StringUtils;
import weaver.conn.RecordSet;
import weaver.general.Util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
* @author:dxfeng
@ -38,35 +40,19 @@ public class JobBrowserService extends BrowserService {
Map<String, Object> resultMap = new HashMap<>();
String datatype = Util.null2String(params.get("datatype"));
if ("tree".equals(datatype)) {
List<TreeNode> nodeData = new ArrayList<>();
String id = Util.null2String(params.get("id"));
SearchTreeParams searchTreeParams = new SearchTreeParams();
if (StringUtils.isBlank(id)) {
Map<String, Object> searchTree = new JobServiceImpl().getSearchTree(searchTreeParams);
Map<String, Object> datas = (Map<String, Object>) searchTree.get("datas");
// 集团
SearchTree rootCompany = (SearchTree) datas.get("rootCompany");
nodeData.add(rootCompany);
} else if ("0".equals(id)) {
Map<String, Object> searchTree = new JobServiceImpl().getSearchTree(searchTreeParams);
Map<String, Object> datas = (Map<String, Object>) searchTree.get("datas");
SearchTree rootCompany = (SearchTree) datas.get("rootCompany");
nodeData.addAll(rootCompany.getSubs());
} else {
String[] idArray = id.split("_");
if (idArray.length == 2) {
if (TreeNodeTypeEnum.TYPE_COMP.getName().equals(idArray[0])) {
searchTreeParams.setType(TreeNodeTypeEnum.TYPE_COMP.getValue());
} else if (TreeNodeTypeEnum.TYPE_DEPT.getName().equals(idArray[0])) {
searchTreeParams.setType(TreeNodeTypeEnum.TYPE_DEPT.getValue());
}
searchTreeParams.setId(idArray[1]);
Map<String, Object> searchTree = new JobServiceImpl().getSearchTree(searchTreeParams);
List<TreeNode> datas = (List<TreeNode>) searchTree.get("datas");
TreeNode treeNode = datas.stream().filter(item -> idArray[1].equals(item.getId())).findFirst().orElse(new TreeNode());
nodeData.addAll(treeNode.getSubs());
searchTreeParams.setId(id);
String[] idArray = id.split("_");
if (idArray.length == 2) {
if (TreeNodeTypeEnum.TYPE_COMP.getName().equals(idArray[0])) {
searchTreeParams.setType(TreeNodeTypeEnum.TYPE_COMP.getValue());
} else if (TreeNodeTypeEnum.TYPE_DEPT.getName().equals(idArray[0])) {
searchTreeParams.setType(TreeNodeTypeEnum.TYPE_DEPT.getValue());
}
searchTreeParams.setId(idArray[1]);
}
List<TreeNode> nodeData = getCurrentTreeNode(searchTreeParams);
List<CusBrowserTree> cusBrowserTrees = CusBowserTreeBO.convertSearchTreeToBorwserTree(nodeData);
resultMap.put("datas", cusBrowserTrees);
} else {
@ -140,4 +126,79 @@ public class JobBrowserService extends BrowserService {
}
return sqlWhere;
}
/**
*
*
* @param params
* @return
*/
private List<TreeNode> getCurrentTreeNode(SearchTreeParams params) {
List<TreeNode> treeNodes = new ArrayList<>();
if (StringUtils.isBlank(params.getId())) {
// 集团总部
SearchTree topGroup = SearchTreeUtil.getTopGroup();
topGroup.setIsParent(true);
treeNodes.add(topGroup);
} else {
// 分部存在下级的ID
List<String> compHasSubs = MapperProxyFactory.getProxy(CompMapper.class).hasSubs();
// 部门存在下级的ID
List<String> hasSubDepartment = MapperProxyFactory.getProxy(DepartmentMapper.class).hasSubs();
if ("0".equals(params.getId())) {
List<CompPO> compList = MapperProxyFactory.getProxy(CompMapper.class).listParent();
// 获取顶层分部
compList.stream().sorted(Comparator.comparing(CompPO::getShowOrder)).forEach(item -> buildCompNodes(treeNodes, compHasSubs, item));
} else if ("1".equals(params.getType())) {
// 当前节点下的元素
CompPO compBuild = CompPO.builder().parentCompany(Long.parseLong(params.getId())).forbiddenTag(0).deleteType(0).build();
List<CompPO> compList = MapperProxyFactory.getProxy(CompMapper.class).listByFilter(compBuild, "show_order");
DepartmentPO departmentBuild = DepartmentPO.builder().parentComp(Long.parseLong(params.getId())).forbiddenTag(0).deleteType(0).build();
List<DepartmentPO> departmentList = MapperProxyFactory.getProxy(DepartmentMapper.class).listByFilter(departmentBuild, "show_order");
compList.forEach(item -> buildCompNodes(treeNodes, compHasSubs, item));
departmentList.stream().filter(item -> null == item.getParentDept() || 0 == item.getParentDept()).forEach(item -> buildDeptNodes(treeNodes, hasSubDepartment, item));
} else if ("2".equals(params.getType())) {
DepartmentPO departmentBuild = DepartmentPO.builder().parentDept(Long.parseLong(params.getId())).forbiddenTag(0).deleteType(0).build();
List<DepartmentPO> departmentList = MapperProxyFactory.getProxy(DepartmentMapper.class).listByFilter(departmentBuild, "show_order");
departmentList.forEach(item -> buildDeptNodes(treeNodes, hasSubDepartment, item));
}
}
return treeNodes;
}
/**
*
*
* @param treeNodes
* @param compHasSubs
* @param company
*/
private void buildCompNodes(List<TreeNode> treeNodes, List<String> compHasSubs, CompPO company) {
SearchTree searchTree = new SearchTree();
searchTree.setId(company.getId().toString());
searchTree.setType(TreeNodeTypeEnum.TYPE_COMP.getValue());
searchTree.setName(company.getCompName());
searchTree.setIsParent(compHasSubs.contains(company.getId().toString()));
treeNodes.add(searchTree);
}
/**
*
*
* @param treeNodes
* @param hasSubDepartment
* @param department
*/
private void buildDeptNodes(List<TreeNode> treeNodes, List<String> hasSubDepartment, DepartmentPO department) {
SearchTree searchTree = new SearchTree();
searchTree.setId(department.getId().toString());
searchTree.setName(department.getDeptName());
searchTree.setType(TreeNodeTypeEnum.TYPE_DEPT.getValue());
searchTree.setIsParent(hasSubDepartment.contains(department.getId().toString()));
treeNodes.add(searchTree);
}
}

@ -3,7 +3,6 @@ package com.engine.organization.entity.browser.bo;
import com.api.hrm.bean.TreeNode;
import com.engine.organization.entity.browser.enums.TreeNodeTypeEnum;
import com.engine.organization.entity.browser.po.CusBrowserTree;
import org.apache.commons.collections.CollectionUtils;
import java.util.List;
import java.util.stream.Collectors;
@ -25,8 +24,8 @@ public class CusBowserTreeBO {
List<CusBrowserTree> collect = searchTree.stream().map(item ->
CusBrowserTree.builder()
.domid("sel_" + item.getId())
.hasChild(CollectionUtils.isNotEmpty(item.getSubs()))
.isLeaf(CollectionUtils.isEmpty(item.getSubs()))
.hasChild(item.getIsParent())
.isLeaf(!item.getIsParent())
.isopen(false)
.key(getKey(item))
.name(item.getName())

@ -30,11 +30,8 @@ import lombok.NoArgsConstructor;
sortway = " asc",
primarykey = "id",
operates = {
@OrganizationTableOperate(index = "0", text = "发消息"),
@OrganizationTableOperate(index = "1", text = "发送邮件"),
@OrganizationTableOperate(index = "1", text = "发送短信"),
@OrganizationTableOperate(index = "1", text = "新建日程"),
@OrganizationTableOperate(index = "1", text = "系统信息"),
@OrganizationTableOperate(index = "0", text = "查看"),
@OrganizationTableOperate(index = "1", text = "编辑")
},
tableType = WeaTableType.CHECKBOX
)

@ -30,6 +30,8 @@ public interface CompMapper {
List<String> listUsedIds();
List<String> hasSubs();
/**
*
*

@ -239,6 +239,9 @@
<if test="compNameShort != null ">
#{compNameShort},
</if>
<if test="parentCompany != null ">
#{parentCompany},
</if>
<if test="ec_company != null ">
#{ecCompany},
</if>
@ -311,6 +314,9 @@
jcl_org_comp t
WHERE t.delete_type = 0
<include refid="likeSQL"/>
<if test=" compPO.parentCompany != null ">
and t.parent_company = #{compPO.parentCompany}
</if>
<if test=" compPO.ecCompany != null ">
and t.ec_company = #{compPO.ecCompany}
</if>
@ -418,6 +424,17 @@
where t.delete_type = 0
AND comp_no = #{companyNo}
</select>
<select id="hasSubs" resultType="java.lang.String">
select parent_company
from jcl_org_comp
where forbidden_tag = 0
and delete_type = 0
union
select parent_comp
from jcl_org_dept
where forbidden_tag = 0
and delete_type = 0
</select>
<update id="updateForbiddenTagById" parameterType="com.engine.organization.entity.sequence.po.SequencePO">
update jcl_org_comp

@ -134,4 +134,6 @@ public interface DepartmentMapper {
Long getIdByNameAndPid(@Param("departmentName") String departmentName, @Param("parentCompany") Long parentCompany, @Param("parentDepartment") Long parentDepartment);
int checkRepeatNo(@Param("departmentNo") String departmentNo, @Param("id") Long id);
List<String> hasSubs();
}

@ -178,6 +178,12 @@
and t.id != #{id}
</if>
</select>
<select id="hasSubs" resultType="java.lang.String">
select distinct parent_dept
from jcl_org_dept
where forbidden_tag = 0
and delete_type = 0
</select>
<sql id="nullParentDepartment">
and ifnull(parent_dept,0) =
#{parentDepartment}

@ -115,6 +115,20 @@
select *
from hrmjobtitles
where jobtitlename = #{name}
order by created desc limit 1
</select>
<select id="getHrmJobTitleByName" resultMap="RecordMap" databaseId="sqlserver">
select top 1 *
from hrmjobtitles
where jobtitlename = #{name}
order by created desc
</select>
<select id="getHrmJobTitleByName" resultMap="RecordMap" databaseId="oracle">
select *
from hrmjobtitles
where jobtitlename = #{name}
and rownum &lt; 2
order by created desc
</select>
<select id="getHrmResourceIds" resultType="java.lang.Long">
select id

@ -464,6 +464,11 @@
select job_id
from JCL_ORG_STAFF
where delete_type = 0
union
select field100002
from cus_fielddata
inner join
hrmresource on STATUS &lt; 4
</select>
<select id="listJobsByDepartmentId" resultMap="BaseResultMap">
select

@ -57,10 +57,10 @@
from jcl_org_staff t
where delete_type = 0
<if test="companyId != null">
and comp_id = #{companyId}
and ec_company = #{companyId}
</if>
<if test="departmentId != null">
and dept_id = #{departmentId}
and ec_department = #{departmentId}
</if>
<if test="jobId != null">
and job_id = #{jobId}

@ -536,7 +536,6 @@ public class FieldDefinedServiceImpl extends Service implements FieldDefinedServ
rightName = "PostField:All";
break;
case "4":
//TODO 人员自定义按钮权限
rightName = "ResourceField:All";
break;
default:

@ -18,7 +18,7 @@ import com.engine.organization.entity.hrmresource.bo.HrmRelationBO;
import com.engine.organization.entity.hrmresource.param.HrmRelationSaveParam;
import com.engine.organization.entity.hrmresource.param.HrmResourceSearchParam;
import com.engine.organization.entity.hrmresource.po.HrmRelationPO;
import com.engine.organization.entity.hrmresource.vo.ScHrmResourceVO;
import com.engine.organization.entity.hrmresource.vo.HrmResourceVO;
import com.engine.organization.entity.job.bo.JobBO;
import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.entity.searchtree.SearchTree;
@ -37,6 +37,7 @@ import com.engine.organization.mapper.scheme.SchemeMapper;
import com.engine.organization.mapper.sequence.SequenceMapper;
import com.engine.organization.service.ExtService;
import com.engine.organization.service.HrmResourceService;
import com.engine.organization.util.HasRightUtil;
import com.engine.organization.util.MenuBtn;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.OrganizationFormItemUtil;
@ -97,6 +98,8 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
*/
private static final String JCL_ORG_HRMEXT_DT1 = "JCL_ORG_HRMRESOURCEEXT_DT1";
private static final String RIGHT_NAME = "Roster:All";
private SchemeMapper getSchemeMapper() {
return MapperProxyFactory.getProxy(SchemeMapper.class);
}
@ -157,15 +160,13 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
@Override
public Map<String, Object> listPage(HrmResourceSearchParam params) {
Map<String, Object> resultMap = new HashMap<>();
OrganizationWeaTable<ScHrmResourceVO> table = new OrganizationWeaTable<>(user, ScHrmResourceVO.class);
OrganizationWeaTable<HrmResourceVO> table = new OrganizationWeaTable<>(user, HrmResourceVO.class);
String sqlWhere = buildSqlWhere(params);
table.setSqlwhere(sqlWhere);
WeaResultMsg result = new WeaResultMsg(false);
result.putAll(table.makeDataResult());
result.success();
resultMap.putAll(result.getResultMap());
return resultMap;
return new HashMap<>(result.getResultMap());
}
@Override
@ -184,6 +185,8 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
@Override
public Long saveBaseForm(Map<String, Object> params) {
HasRightUtil.hasRight(user, RIGHT_NAME, false);
return getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_HRM, params, "", null);
}

@ -22,6 +22,7 @@ import com.engine.organization.entity.jclimport.po.JclImportHistoryPO;
import com.engine.organization.entity.jclimport.vo.JclImportHistoryDetailVO;
import com.engine.organization.enums.LogModuleNameEnum;
import com.engine.organization.enums.OperateTypeEnum;
import com.engine.organization.enums.OrgImportEnum;
import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.mapper.extend.ExtMapper;
@ -42,7 +43,6 @@ import com.engine.organization.util.excel.ExcelUtil;
import com.engine.organization.util.relation.EcHrmRelationUtil;
import com.engine.organization.util.saveimport.hrmimport.HrmImportAdaptExcelE9;
import com.engine.organization.util.saveimport.hrmimport.HrmImportProcessE9;
import com.engine.organization.enums.OrgImportEnum;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.xssf.usermodel.XSSFCell;
@ -226,11 +226,10 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
break;
case "resource":
Long importHistoryId = saveImportLog("resource", operateType);
List<Object> lsErrorInfo = new ArrayList<>();
HrmImportAdaptExcelE9 importAdapt = new HrmImportAdaptExcelE9();
FileUploadToPath fu = new FileUploadToPath(request);
List errorInfo = importAdapt.creatImportMap(fu);
List<String> errorInfo = importAdapt.creatImportMap(fu);
//如果读取数据和验证模板没有发生错误
if (errorInfo.isEmpty()) {
@ -242,12 +241,8 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
importProcess.processMap(hrMap);
} else {
Map<String, Object> error;
for (int i = 0; i < errorInfo.size(); i++) {
error = new HashMap<>();
error.put("message", Util.null2String(errorInfo.get(i)));
lsErrorInfo.add(error);
MapperProxyFactory.getProxy(JclImportHistoryDetailMapper.class).insertHistoryDetail(JclImportHistoryDetailPO.builder().pid(importHistoryId).operateDetail(Util.null2String(errorInfo.get(i))).status("0").build());
for (String s : errorInfo) {
MapperProxyFactory.getProxy(JclImportHistoryDetailMapper.class).insertHistoryDetail(JclImportHistoryDetailPO.builder().pid(importHistoryId).operateDetail(Util.null2String(s)).status("0").build());
}
}
returnMap.put("pId", importHistoryId);
@ -504,7 +499,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
ConditionFactory conditionFactory = new ConditionFactory(user);
//重复验证字段
List<SearchConditionOption> statusOptions = new ArrayList<SearchConditionOption>();
List<SearchConditionOption> statusOptions = new ArrayList<>();
statusOptions.add(new SearchConditionOption("workcode", SystemEnv.getHtmlLabelName(714, user.getLanguage()), true));
statusOptions.add(new SearchConditionOption("loginid", SystemEnv.getHtmlLabelName(412, user.getLanguage())));
statusOptions.add(new SearchConditionOption("lastname", SystemEnv.getHtmlLabelName(413, user.getLanguage())));
@ -513,7 +508,7 @@ public class ImportCommonServiceImpl extends Service implements ImportCommonServ
itemList.add(searchConditionItem);
//导入类型
List<SearchConditionOption> statusOptions1 = new ArrayList<SearchConditionOption>();
List<SearchConditionOption> statusOptions1 = new ArrayList<>();
statusOptions1.add(new SearchConditionOption("add", SystemEnv.getHtmlLabelName(611, user.getLanguage()), true));
statusOptions1.add(new SearchConditionOption("update", SystemEnv.getHtmlLabelName(17744, user.getLanguage())));
searchConditionItem = conditionFactory.createCondition(ConditionType.SELECT, 24863, "importType", statusOptions1);

@ -16,6 +16,7 @@ import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.relation.EcHrmRelationUtil;
import com.engine.organization.util.relation.ResourceSyncUtil;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import weaver.general.Util;
@ -33,10 +34,10 @@ import java.util.stream.Collectors;
* @version: 1.0
*/
public class OrganizationSyncEc {
private LogModuleNameEnum moduleName;
private OperateTypeEnum operateType;
private Map<String, Object> params;
private User user;
private final LogModuleNameEnum moduleName;
private final OperateTypeEnum operateType;
private final Map<String, Object> params;
private final User user;
private JobPO oldJobPO;
Map<String, Object> resultMap;
private boolean throwException = true;
@ -88,6 +89,8 @@ public class OrganizationSyncEc {
case JOB:
refreshJob();
break;
case RESOURCE:
refreshResource();
default:
break;
}
@ -152,6 +155,30 @@ public class OrganizationSyncEc {
}
}
private void refreshResource(){
switch (operateType) {
case ADD:
addResource();
break;
case UPDATE:
break;
case CANCELED:
break;
default:
break;
}
}
private void addResource() {
Map<String, Object> map = ResourceSyncUtil.addResource(user, params);
this.resultMap = map;
}
private void updateResource() {
}
/**
*
*

@ -122,7 +122,7 @@ public class CusFieldDataTrigger {
}
// field100001更新,职等职级
if (null != sourceField100001 && sourceField100001.split("A").length == 3 && !sourceField100001.equals(directionData.getField100001())) {
if (null != sourceField100001 && sourceField100001.split("A").length == 3) {
directionData.setField100001(sourceField100001);
String[] field100001Array = sourceField100001.split("A");
// 职等
@ -145,7 +145,7 @@ public class CusFieldDataTrigger {
}
if (null != sourceField100003 && sourceField100003.split("_").length == 2 && !sourceField100003.equals(directionData.getField100003())) {
if (null != sourceField100003 && sourceField100003.split("_").length == 2) {
directionData.setField100003(sourceField100003);
String[] field100003Array = sourceField100003.split("_");
long zwId = Long.parseLong(field100003Array[1]);

@ -0,0 +1,615 @@
package com.engine.organization.util.relation;
import com.api.doc.detail.util.DocDownloadCheckUtil;
import com.api.hrm.service.HrmResourceBaseService;
import com.api.hrm.util.ServiceUtil;
import com.engine.common.biz.SimpleBizLogger;
import com.engine.common.constant.BizLogOperateAuditType;
import com.engine.common.constant.BizLogOperateType;
import com.engine.common.constant.BizLogSmallType4Hrm;
import com.engine.common.constant.BizLogType;
import com.engine.common.entity.BizLogContext;
import com.engine.common.service.impl.HrmCommonServiceImpl;
import com.engine.common.util.LogUtil;
import com.engine.hrm.entity.RuleCodeType;
import com.engine.hrm.util.CodeRuleManager;
import com.engine.hrm.util.HrmWeakPasswordUtil;
import com.engine.hrm.util.face.HrmFaceCheckManager;
import com.engine.hrm.util.face.ValidateFieldManager;
import com.engine.hrm.util.face.bean.CheckItemBean;
import com.weaver.general.BaseBean;
import ln.LN;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.conn.RecordSetTrans;
import weaver.file.Prop;
import weaver.general.GCONST;
import weaver.general.PasswordUtil;
import weaver.general.Util;
import weaver.hrm.HrmUserVarify;
import weaver.hrm.User;
import weaver.hrm.common.DbFunctionUtil;
import weaver.hrm.company.DepartmentComInfo;
import weaver.hrm.companyvirtual.DepartmentVirtualComInfo;
import weaver.hrm.finance.SalaryManager;
import weaver.hrm.passwordprotection.manager.HrmResourceManager;
import weaver.hrm.privacy.PrivacyComInfo;
import weaver.hrm.privacy.UserPrivacyComInfo;
import weaver.hrm.resource.ResourceComInfo;
import weaver.hrm.settings.ChgPasswdReminder;
import weaver.hrm.settings.RemindSettings;
import weaver.hrm.tools.HrmDateCheck;
import weaver.interfaces.hrm.HrmServiceManager;
import weaver.license.PluginUserCheck;
import weaver.rsa.security.RSA;
import weaver.rtx.OrganisationCom;
import weaver.rtx.OrganisationComRunnable;
import weaver.system.SysRemindWorkflow;
import weaver.systeminfo.SystemEnv;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author:dxfeng
* @createTime: 2022/10/11
* @version: 1.0
*/
public class ResourceSyncUtil {
private static final char separator = Util.getSeparator();
private static final String today = DateUtil.getCurrentDate();
public static Map<String, Object> addResource(User user, Map<String, Object> params) {
Map<String, Object> retmap = new HashMap<>();
RecordSet rs = new RecordSet();
String sql = "";
try {
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
boolean canEdit = HrmUserVarify.checkUserRight("HrmResourceEdit:Edit", user);
if (!canEdit) {
retmap.put("status", "-1");
retmap.put("message", SystemEnv.getHtmlLabelName(22620, user.getLanguage()));
return retmap;
}
String loginid = Util.null2String(params.get("loginid"));
String accounttype = Util.null2s(Util.fromScreen3(Util.null2String(params.get(("accounttype"))), user.getLanguage()), "0");
if (accounttype.equals("1")) loginid = "";//次账号没有loginid
boolean canSave = false;
LN LN = new LN();
int ckHrmnum = LN.CkHrmnum();
if (loginid.length() > 0) {
if (ckHrmnum < 0) {//只有License检查人数小于规定人数才能修改。防止客户直接修改数据库数据
canSave = true;
}
} else {
canSave = true;
}
if (!canSave) {
retmap.put("status", "-1");
retmap.put("message", SystemEnv.getHtmlLabelName(84760, user.getLanguage()));
return retmap;
}
if (!loginid.equals("") && "0".equals(accounttype)) {
sql = "select count(1) from hrmresourceallview where loginid='" + loginid + "' ";
rs.executeSql(sql);
if (rs.next()) {
if (rs.getInt(1) > 0) {
retmap.put("status", "-1");
retmap.put("message", SystemEnv.getHtmlLabelName(15094, user.getLanguage()));
return retmap;
}
}
}
String departmentid = Util.null2String(params.get("departmentid"));
String subcompanyid = departmentComInfo.getSubcompanyid1(departmentid);
if (!loginid.equals("") && !subcompanyid.equals("0") && new HrmResourceManager().noMore(subcompanyid)) {
retmap.put("status", "-1");
retmap.put("message", SystemEnv.getHtmlLabelName(81926, user.getLanguage()));
return retmap;
}
ResourceComInfo ResourceComInfo = new ResourceComInfo();
Map<String, String> result = ResourceSyncUtil.addResourceBase(user, params);
String addResourceBaseCode = result.get("status");
if ("-1".equals(addResourceBaseCode)) {
retmap.put("status", "-1");
retmap.put("message", result.get("message"));
return retmap;
}
int id = Util.getIntValue(result.get("id"));
String password = Util.null2String(params.get("password"));
//是否开启了RSA加密
String openRSA = Util.null2String(Prop.getPropValue("openRSA", "isrsaopen"));
if ("1".equals(openRSA)) {
password = new RSA().decrypt(password);
}
ChgPasswdReminder reminder = new ChgPasswdReminder();
RemindSettings settings = reminder.getRemindSettings();
//判断是否开启了【启用初始密码】
String defaultPasswordEnable = Util.null2String(settings.getDefaultPasswordEnable());
//【初始密码】
String defaultPassword = Util.null2String(settings.getDefaultPassword());
//如果管理员设置的密码为空。并且开启了【启用初始密码】,且初始密码不为空,则默认取初始密码作为密码
if (password.equals("") && defaultPasswordEnable.equals("1") && !defaultPassword.equals("")) {
password = defaultPassword;
}
//判断是否开启了【禁止弱密码保存】
String weakPasswordDisable = Util.null2s(settings.getWeakPasswordDisable(), "0");
if (weakPasswordDisable.equals("1")) {
if (password.equals("")) {//密码为空的情况
} else {
//判断是否为弱密码
HrmWeakPasswordUtil hrmWeakPasswordUtil = new HrmWeakPasswordUtil();
if (hrmWeakPasswordUtil.isWeakPsd(password)) {
retmap.put("status", "-1");
retmap.put("message", SystemEnv.getHtmlLabelName(515420, user.getLanguage()));
return retmap;
}
}
}
int seclevel = Util.getIntValue(Util.null2String(params.get("seclevel")), 0);
if (id > 0) {//保存系统信息
SimpleBizLogger logger = new SimpleBizLogger();
BizLogContext bizLogContext = new BizLogContext();
bizLogContext.setLogType(BizLogType.HRM);//模块类型
bizLogContext.setBelongType(BizLogSmallType4Hrm.HRM_RSOURCE_CARD);//所属大类型
bizLogContext.setLogSmallType(BizLogSmallType4Hrm.HRM_RSOURCE_CARD_SYSTEM);//当前小类型
bizLogContext.setOperateType(BizLogOperateType.ADD);
bizLogContext.setOperateAuditType(BizLogOperateAuditType.WARNING);
bizLogContext.setParams(params);//当前request请求参数
logger.setUser(user);//当前操作人
String mainSql = "select * from hrmresource where id=" + id;
logger.setMainSql(mainSql, "id");//主表sql
logger.setMainPrimarykey("id");//主日志表唯一key
logger.setMainTargetNameColumn("lastname");//当前targetName对应的列对应日志中的对象名
logger.before(bizLogContext);//写入操作前日志
String workstartdate = Util.null2String(params.get("workstartdate"));//参加工作日期
String companystartdate = Util.null2String(params.get("companystartdate"));//入职日期
String dsporder = Util.fromScreen3(Util.null2String(params.get("dsporder")), user.getLanguage());
if (dsporder.length() == 0) dsporder = "" + id;
if (accounttype.equals("0")) {
String encrptPassword = "";
String salt = "";
if (org.apache.commons.lang3.StringUtils.isNotBlank(password)) {
String[] encrypts = PasswordUtil.encrypt(password);
encrptPassword = encrypts[0];
salt = encrypts[1];
}
sql = " update hrmresource set loginid='" + loginid + "', password='" + encrptPassword + "'," +
"seclevel=" + seclevel + ",dsporder=" + dsporder +
",salt='" + salt + "',workstartdate='" + workstartdate + "',companystartdate='" + companystartdate + "' where id = " + id;
} else {
sql = " update hrmresource set seclevel=" + seclevel + ",dsporder=" + dsporder +
" ,workstartdate='" + workstartdate + "',companystartdate='" + companystartdate + "' where id = " + id;
}
updateWorkInfo(String.valueOf(id), user, params);
rs.executeSql(sql);
HrmFaceCheckManager.setUserPassowrd(id + "", password);
HrmFaceCheckManager.sync(id + "", HrmFaceCheckManager.getOptUpdate(), "HrmResourceAddService_saveSimple_update", HrmFaceCheckManager.getOaResource());
LogUtil.writeBizLog(logger.getBizLogContexts());
}
//同步RTX端的用户信息.
new OrganisationCom().checkUser(id);
new Thread(new OrganisationComRunnable("user", "add", "" + id)).start();
ResourceComInfo.updateResourceInfoCache("" + id);
new PluginUserCheck().clearPluginUserCache("messager");
//OA与第三方接口单条数据同步方法开始
new HrmServiceManager().SynInstantHrmResource("" + id, "1");
//OA与第三方接口单条数据同步方法结束
//BBS集成相关
String bbsLingUrl = new weaver.general.BaseBean().getPropValue(GCONST.getConfigFile(), "ecologybbs.linkUrl");
if (!password.equals("0")) {
if (!bbsLingUrl.equals("")) {
new Thread(new weaver.bbs.BBSRunnable(loginid, password)).start();
}
}
retmap.put("status", "1");
} catch (Exception e) {
new BaseBean().writeLog("保存新建人员simple错误" + e);
retmap.put("status", "-1");
retmap.put("message", "" + weaver.systeminfo.SystemEnv.getHtmlLabelName(22620, weaver.general.ThreadVarLanguage.getLang()) + "");
}
return retmap;
}
private static Map<String, String> addResourceBase(User user, Map<String, Object> params) {
Map<String, String> retmap = new HashMap<>();
try {
retmap.put("id", "0");
RecordSet rs = new RecordSet();
DepartmentComInfo DepartmentComInfo = new DepartmentComInfo();
ResourceComInfo ResourceComInfo = new ResourceComInfo();
SalaryManager SalaryManager = new SalaryManager();
ChgPasswdReminder reminder = new ChgPasswdReminder();
RemindSettings settings = reminder.getRemindSettings();
SysRemindWorkflow SysRemindWorkflow = new SysRemindWorkflow();
DepartmentVirtualComInfo DepartmentVirtualComInfo = new DepartmentVirtualComInfo();
StringBuilder para;
String cmd = Util.null2String(params.get("cmd"));
String id = Util.null2String(params.get("id"));
String workcode = Util.fromScreen3(Util.null2String(params.get("workcode")), user.getLanguage());
String lastname = Util.fromScreen3(Util.null2String(params.get("lastname")), user.getLanguage()).trim();
String sex = Util.fromScreen3(Util.null2String(params.get("sex")), user.getLanguage());
String resourceimageid = Util.null2String(params.get("resourceimageid"));
if (resourceimageid.length() > 0) {
resourceimageid = "" + DocDownloadCheckUtil.getDownloadfileidstr(resourceimageid);
}
String departmentid = Util.fromScreen3(Util.null2String(params.get("departmentid")), user.getLanguage());
String costcenterid = Util.fromScreen3(Util.null2String(params.get("costcenterid")), user.getLanguage());
String jobtitle = Util.fromScreen3(Util.null2String(params.get("jobtitle")), user.getLanguage());
String joblevel = Util.fromScreen3(Util.null2String(params.get("joblevel")), user.getLanguage());
String jobactivitydesc = Util.fromScreen3(Util.null2String(params.get("jobactivitydesc")), user.getLanguage());
String managerid = Util.fromScreen3(Util.null2String(params.get("managerid")), user.getLanguage());
String assistantid = Util.fromScreen3(Util.null2String(params.get("assistantid")), user.getLanguage());
String status = Util.fromScreen3(Util.null2String(params.get("status")), user.getLanguage());
String locationid = Util.fromScreen3(Util.null2String(params.get("locationid")), user.getLanguage());
String workroom = Util.fromScreen3(Util.null2String(params.get("workroom")), user.getLanguage());
String telephone = Util.fromScreen3(Util.null2String(params.get("telephone")), user.getLanguage());
String mobile = Util.fromScreen3(Util.null2String(params.get("mobile")), user.getLanguage());
String mobileshowtype = Util.fromScreen3(Util.null2String(params.get("mobileshowtype")), user.getLanguage());
String mobilecall = Util.fromScreen3(Util.null2String(params.get("mobilecall")), user.getLanguage());
String fax = Util.fromScreen3(Util.null2String(params.get("fax")), user.getLanguage());
String jobcall = Util.fromScreen3(Util.null2String(params.get("jobcall")), user.getLanguage());
String email = Util.fromScreen3(Util.null2String(params.get("email")), user.getLanguage());
String dsporder = Util.fromScreen3(Util.null2String(params.get("dsporder")), user.getLanguage());
String accounttype = Util.fromScreen3(Util.null2String(params.get("accounttype")), user.getLanguage());
String systemlanguage = Util.null2String(params.get("systemlanguage"));
if (systemlanguage.equals("") || systemlanguage.equals("0")) systemlanguage = "7";
String belongto = Util.fromScreen3(Util.null2String(params.get("belongto")), user.getLanguage());
//应聘人员id
String rcid = Util.null2String(params.get("rcId"));
CheckItemBean mobileBean = new CheckItemBean("mobile", mobile, id);
ValidateFieldManager.validate(mobileBean);
if (!mobileBean.isPass()) {
retmap.put("status", "-1");
retmap.put("message", mobileBean.getCheckMsg());
return retmap;
}
CheckItemBean telephoneBean = new CheckItemBean("telephone", telephone, id);
ValidateFieldManager.validate(telephoneBean);
if (!telephoneBean.isPass()) {
retmap.put("status", "-1");
retmap.put("message", telephoneBean.getCheckMsg());
return retmap;
}
if (dsporder.length() == 0) dsporder = id;
if (accounttype.equals("0")) {
belongto = "-1";
}
String departmentvirtualids = Util.null2String(params.get("departmentvirtualids"));//虚拟部门id;
//Td9325,解决多账号次账号没有登陆Id在浏览框组织结构中无法显示的问题。
boolean falg = false;
String loginid = "";
if (accounttype.equals("1")) {
rs.execute("select loginid from HrmResource where id =" + belongto);
if (rs.next()) {
loginid = rs.getString("loginid");
}
if (!loginid.equals("")) {
String maxidsql = "select max(id) as id from HrmResource where loginid like '" + loginid + "%'";
rs.execute(maxidsql);
if (rs.next()) {
loginid = loginid + (rs.getInt("id") + 1);
falg = true;
}
}
}
rs.executeProc("HrmResourceMaxId_Get", "");
rs.next();
id = "" + rs.getInt(1);
if (!"".equals(rcid)) {
id = rcid;
}
SimpleBizLogger logger = new SimpleBizLogger();
BizLogContext bizLogContext = new BizLogContext();
bizLogContext.setLogType(BizLogType.HRM);//模块类型
bizLogContext.setBelongType(BizLogSmallType4Hrm.HRM_RSOURCE_CARD);//所属大类型
bizLogContext.setBelongTypeTargetName(SystemEnv.getHtmlLabelName(1361, user.getLanguage()));
bizLogContext.setLogSmallType(BizLogSmallType4Hrm.HRM_RSOURCE_CARD_BASE);//当前小类型
bizLogContext.setOperateType(BizLogOperateType.ADD);
bizLogContext.setParams(params);//当前request请求参数
logger.setUser(user);//当前操作人
String cusFieldNames = ServiceUtil.getCusFieldNames("HrmCustomFieldByInfoType", -1, "b");
String mainSql = "select a.*" + (cusFieldNames.length() > 0 ? "," + cusFieldNames : "") + " from hrmresource a left join cus_fielddata b on a.id=b.id and b.scope='HrmCustomFieldByInfoType' and b.scopeid=-1 where a.id=" + id;
logger.setMainSql(mainSql, "id");//主表sql
logger.setMainPrimarykey("id");//主日志表唯一key
logger.setMainTargetNameColumn("lastname");//当前targetName对应的列对应日志中的对象名
logger.before(bizLogContext);//写入操作前日志
String sql = "select managerstr, seclevel from HrmResource where id = " + Util.getIntValue(managerid);
rs.execute(sql);
String managerstr = "";
while (rs.next()) {
String tmp_managerstr = rs.getString("managerstr");
//处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 begin
if (!tmp_managerstr.startsWith(",")) tmp_managerstr = "," + tmp_managerstr;
if (!tmp_managerstr.endsWith(",")) tmp_managerstr = tmp_managerstr + ",";
//处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 end
managerstr += tmp_managerstr;
managerstr = "," + managerid + managerstr;
managerstr = managerstr.endsWith(",") ? managerstr : (managerstr + ",");
}
String subcmpanyid1 = DepartmentComInfo.getSubcompanyid1(departmentid);
RecordSetTrans rst = new RecordSetTrans();
rst.setAutoCommit(false);
try {
if (resourceimageid.length() == 0) resourceimageid = "null";
if (costcenterid.length() == 0) costcenterid = "null";
if (managerid.length() == 0) managerid = "null";
if (assistantid.length() == 0) assistantid = "null";
if (accounttype.length() == 0) accounttype = "null";
if (belongto.length() == 0) belongto = "null";
if (jobcall.length() == 0) jobcall = "null";
if (mobileshowtype.length() == 0) mobileshowtype = "null";
if (rst.getDBType().equalsIgnoreCase("postgresql")) {
if (joblevel.length() == 0) joblevel = null;
if (dsporder.length() == 0) dsporder = null;
}
workcode = CodeRuleManager.getCodeRuleManager().generateRuleCode(RuleCodeType.USER, subcmpanyid1, departmentid, jobtitle, workcode);
para = new StringBuilder("" + id + separator + workcode + separator + lastname + separator + sex + separator + resourceimageid + separator +
departmentid + separator + costcenterid + separator + jobtitle + separator + joblevel + separator + jobactivitydesc + separator +
managerid + separator + assistantid + separator + status + separator + locationid + separator + workroom + separator + telephone +
separator + mobile + separator + mobilecall + separator + fax + separator + jobcall + separator + subcmpanyid1 + separator + managerstr +
separator + accounttype + separator + belongto + separator + systemlanguage + separator + email + separator + dsporder + separator + mobileshowtype);
rst.executeProc("HrmResourceBasicInfo_Insert", para.toString());
if (Util.null2String(locationid).length() > 0) {
rst.executeSql("update hrmresource set countryid=(select countryid from HrmLocations where id=" + locationid + "),"
+ DbFunctionUtil.getInsertUpdateSetSql(rst.getDBType(), user.getUID()) + " where id=" + id);
}
String logidsql, quickSearchStr = new HrmCommonServiceImpl().generateQuickSearchStr(lastname);
if (falg) {
logidsql = "update HrmResource set loginid = ?, pinyinlastname = ?, ecology_pinyin_search = ? where id = ?";
rst.executeUpdate(logidsql, loginid, quickSearchStr, quickSearchStr, id);
} else {
logidsql = "update HrmResource set pinyinlastname = ?, ecology_pinyin_search = ? where id = ?";
rst.executeUpdate(logidsql, quickSearchStr, quickSearchStr, id);
}
rst.commit();
} catch (Exception e) {
rst.rollback();
e.printStackTrace();
}
boolean formdefined = false;
weaver.system.CusFormSettingComInfo CusFormSettingComInfo = new weaver.system.CusFormSettingComInfo();
weaver.system.CusFormSetting CusFormSetting = CusFormSettingComInfo.getCusFormSetting("hrm", "HrmResourceBase");
if (CusFormSetting != null) {
if (CusFormSetting.getStatus() == 2) {
//自定义布局页面
formdefined = true;
}
}
int userid = user.getUID();
String userpara = "" + userid + separator + today;
para = new StringBuilder("" + id);
for (int i = 0; i < 5; i++) {
int idx = i;
if (formdefined) idx++;
String datefield = Util.null2String(params.get("datefield" + idx));
String numberfield = "" + Util.getDoubleValue(Util.null2String(params.get("numberfield" + idx)), 0);
String textfield = Util.null2String(params.get("textfield" + idx));
String tinyintfield = "" + Util.getIntValue(Util.null2String(params.get("tinyintfield" + idx)), 0);
para.append(separator).append(datefield).append(separator).append(numberfield).append(separator).append(textfield).append(separator).append(tinyintfield);
}
rs.executeProc("HrmResourceDefine_Update", para.toString());
rs.executeProc("HrmResource_CreateInfo", "" + id + separator + userpara + separator + userpara);
//421944 用户自定义隐私设置
UserPrivacyComInfo upc = new UserPrivacyComInfo();
PrivacyComInfo pc = new PrivacyComInfo();
Map<String, String> mapShowSets = pc.getMapShowSets();
String insertSql;
rs = new RecordSet();
try {
String deletePriSql = " delete from userprivacysetting where userid= '" + id + "'";
rs.execute(deletePriSql);
for (Map.Entry<String, String> me : mapShowSets.entrySet()) {
String fieldName = me.getKey();
String fieldVal = Util.null2String(mapShowSets.get(fieldName));
if (fieldVal.equals("1")) {
String tmpPK = id + "__" + fieldName;
String tmpPvalue = Util.null2String(params.get(fieldName + "showtype"));
insertSql = "insert into userprivacysetting (combinedid,userid,ptype,pvalue) values('" + tmpPK + "','" + id + "','" + fieldName + "','" + tmpPvalue + "')";
rs.execute(insertSql);
}
}
upc.removeUserPrivacyCache();
} catch (Exception e) {
e.printStackTrace();
}
// 改为只进行该人缓存信息的添加
ResourceComInfo.addResourceInfoCache(id);
SalaryManager.initResourceSalary(id);
para = new StringBuilder("" + id + separator + managerid + separator + departmentid + separator + subcmpanyid1 + separator + "0" + separator + managerstr);
rs.executeProc("HrmResource_Trigger_Insert", para.toString());
String sql_1 = ("insert into HrmInfoStatus (itemid,hrmid) values(1," + id + ")");
rs.execute(sql_1);
String sql_2 = ("insert into HrmInfoStatus (itemid,hrmid) values(2," + id + ")");
rs.execute(sql_2);
String sql_3 = ("insert into HrmInfoStatus (itemid,hrmid) values(3," + id + ")");
rs.execute(sql_3);
String sql_10 = ("insert into HrmInfoStatus (itemid,hrmid) values(10," + id + ")");
rs.execute(sql_10);
String CurrentUser = "" + user.getUID();
String CurrentUserName = "" + user.getUsername();
String SWFAccepter;
String SWFTitle;
String SWFRemark;
String SWFSubmiter;
String Subject;
Subject = SystemEnv.getHtmlLabelName(15670, user.getLanguage());
Subject += ":" + lastname;
//modifier by lvyi 2013-12-31
if (settings.getEntervalid().equals("1")) {//入职提醒
String thesql = "select hrmids from HrmInfoMaintenance where id<4 or id = 10";
rs.execute(thesql);
StringBuilder members = new StringBuilder();
while (rs.next()) {
String hrmid_tmp = Util.null2String(rs.getString("hrmids"));//TD9392
if (hrmid_tmp.length() != 0) {
members.append(",").append(rs.getString("hrmids"));
}
}
if (!members.toString().equals("")) {
members = new StringBuilder(members.substring(1));
members = new StringBuilder(new HrmResourceBaseService().duplicateRemoval(members.toString(), user.getUID() + ""));
SWFAccepter = members.toString();
SWFTitle = SystemEnv.getHtmlLabelName(15670, user.getLanguage());
SWFTitle += ":" + lastname;
SWFTitle += "-" + CurrentUserName;
SWFTitle += "-" + today;
SWFRemark = "<a class='wea-hrm-new-employee-set' onClick=\"openHrmNewEmployeeSetDialog(" + id + ")\" style=\"cursor:pointer;\" id = '" + id + "'>" + Util.fromScreen2(Subject, user.getLanguage()) + "</a>";
SWFSubmiter = CurrentUser;
SysRemindWorkflow.setPrjSysRemind(SWFTitle, 0, Util.getIntValue(SWFSubmiter), SWFAccepter, SWFRemark);
}
}
//CustomFieldTreeManager.editCustomDataE9Add("HrmCustomFieldByInfoType", -1, fu, Util.getIntValue(id, 0));
//应聘人员的个人信息18条
if (!"".equals(rcid)) {
sql = "select * from HrmCareerApply where id = ?";
rs.executeQuery(sql, id);
if (rs.next()) {
String birthday = Util.null2String(rs.getString("birthday"));
String folk = Util.null2String(rs.getString("folk"));
String nativeplace = Util.null2String(rs.getString("nativeplace"));
String regresidentplace = Util.null2String(rs.getString("regresidentplace"));
String certificatenum = Util.null2String(rs.getString("certificatenum"));
String maritalstatus = Util.null2String(rs.getString("maritalstatus"));
String policy = Util.null2String(rs.getString("policy"));
String bememberdate = Util.null2String(rs.getString("bememberdate"));
String bepartydate = Util.null2String(rs.getString("bepartydate"));
String islabouunion = Util.null2String(rs.getString("islabouunion"));
String educationlevel = Util.null2String(rs.getString("educationlevel"));
String degree = Util.null2String(rs.getString("degree"));
String healthinfo = Util.null2String(rs.getString("healthinfo"));
String height = Util.null2String(rs.getString("height"));
if (height.contains(".")) height = height.substring(0, height.indexOf("."));
String weight = Util.null2String(rs.getString("weight"));
if (weight.contains(".")) weight = weight.substring(0, weight.indexOf("."));
String residentplace = Util.null2String(rs.getString("residentplace"));
String homeaddress = Util.null2String(rs.getString("homeaddress"));
String tempresidentnumber = Util.null2String(rs.getString("tempresidentnumber"));
para = new StringBuilder("" + id + separator + birthday + separator + folk + separator + nativeplace + separator + regresidentplace + separator + maritalstatus + separator + policy + separator + bememberdate + separator + bepartydate + separator + islabouunion + separator + educationlevel + separator + degree + separator + healthinfo + separator + height + separator + weight + separator + residentplace + separator + homeaddress + separator + tempresidentnumber + separator + certificatenum);
RecordSet rs1 = new RecordSet();
rs1.executeProc("HrmResourcePersonalInfo_Insert", para.toString());
}
}
//更新虚拟组织部门id
if (departmentvirtualids.length() > 0) {
//保存前先删除需要删除的数据因为有managerid 所以不能全部删除再保存
sql = "delete from hrmresourcevirtual where resourceid=" + id + " and departmentid not in (" + departmentvirtualids + ")";
rs.execute(sql);
String[] departmentvirtualid = departmentvirtualids.split(",");
for (String s : departmentvirtualid) {
rs.execute(" select count(*) from HrmResourceVirtual where departmentid ='" + s + "' and resourceid = " + id);
if (rs.next()) {
//如果已存在 无需处理
if (rs.getInt(1) > 0) continue;
}
//写入
int tmpid = 0;
rs.execute("select max(id) from HrmResourceVirtual ");
if (rs.next()) {
tmpid = rs.getInt(1) + 1;
}
String subcompanyid = DepartmentVirtualComInfo.getSubcompanyid1(s);
sql = " insert into HrmResourceVirtual (id,resourceid,subcompanyid,departmentid ) " +
" values (" + tmpid + "," + id + "," + subcompanyid + "," + s + ")";
rs.execute(sql);
}
}
LogUtil.writeBizLog(logger.getBizLogContexts());
HrmFaceCheckManager.sync(id, HrmFaceCheckManager.getOptInsert(), "hrm_e9_HrmResourceBaseService_addResourceBase", HrmFaceCheckManager.getOaResource());
//同步RTX端的用户信息.
new OrganisationCom().checkUser(Util.getIntValue(id));
new Thread(new OrganisationComRunnable("user", "add", "" + id)).start();
ResourceComInfo.updateResourceInfoCache("" + id);
new PluginUserCheck().clearPluginUserCache("messager");
//OA与第三方接口单条数据同步方法开始
new HrmServiceManager().SynInstantHrmResource("" + id, "1");
//OA与第三方接口单条数据同步方法结束
//新增人员实时同步到CoreMail邮件系统
//CoreMailAPI.synUser(id);
if (cmd.equals("SaveAndNew")) {
retmap.put("status", "1");
} else if (cmd.equals("SaveAndNext")) {
retmap.put("status", "2");
} else {
retmap.put("status", "3");
}
retmap.put("id", id);
} catch (Exception e) {
new BaseBean().writeLog("新建人员基本信息错误:" + e);
retmap.put("status", "-1");
}
return retmap;
}
private static void updateWorkInfo(String id, User user, Map<String, Object> params) {
try {
RecordSet rs = new RecordSet();
String sql = "";
String companystartdate = Util.fromScreen3(Util.null2String(params.get("companystartdate")), user.getLanguage());
String workstartdate = Util.fromScreen3(Util.null2String(params.get("workstartdate")), user.getLanguage());
List<String> lsParams = new ArrayList<>();
lsParams.add(companystartdate.length() == 0 ? null : companystartdate);
lsParams.add(workstartdate.length() == 0 ? null : workstartdate);
lsParams.add(id);
sql = " update hrmresource set companystartdate=?,workstartdate=? where id=?";
rs.executeUpdate(sql, lsParams);
HrmDateCheck hrmDateCheck = new HrmDateCheck();
hrmDateCheck.calWorkInfo(id);
} catch (Exception e) {
new BaseBean().writeLog(e);
}
}
}

@ -62,7 +62,7 @@ public class SearchTreeUtil {
*
* @return
*/
private static SearchTree getTopGroup() {
public static SearchTree getTopGroup() {
RecordSet rs = new RecordSet();
String sql = "select * from HrmCompany ";
rs.executeQuery(sql);

@ -5,7 +5,6 @@ import com.engine.organization.entity.staff.po.StaffPO;
import com.engine.organization.entity.staff.po.StaffsPO;
import com.engine.organization.mapper.staff.StaffMapper;
import com.engine.organization.mapper.staff.StaffsMapper;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
@ -114,7 +113,6 @@ public class StaffChangeAction implements Action {
case "6":// 减员释放,比如离职、调出等
staffPO.setPermanentNum(staffPO.getPermanentNum() - changeNum);
if (staffPO.getPermanentNum() < 0) {
OrganizationAssert.isFalse(staffPO.getPermanentNum() < 0,"调整数量不可大于在编数");
return "调整数量不可大于在编数";
}
break;

Loading…
Cancel
Save