人员管理完善

pull/10/head
dxfeng 3 years ago
parent 46068ab008
commit f9c33da655

@ -41,4 +41,8 @@ public interface HrmResourceMapper {
// * @return
// */
//List<JSONObject> getKeyMapByKetField(@Param("keyField") String keyField);
String getEcResourceId(@Param("jclResourceId") String jclResourceId);
Long getJclResourceId(@Param("ecResourceId") String ecResourceId);
}

@ -38,7 +38,19 @@
where delete_type = 0
and ${keyField} = #{keyFieldValue}
</select>
<!-- <select id="getKeyMapByKetField" resultType="com.alibaba.fastjson.JSONObject">-->
<select id="getEcResourceId" resultType="java.lang.String">
select a.id
from hrmresource a
inner join jcl_org_hrmresource b on a.uuid = b.uuid
where b.id = #{jclResourceId}
</select>
<select id="getJclResourceId" resultType="java.lang.Long">
select a.id
from jcl_org_hrmresource a
inner join hrmresource b on a.uuid = b.uuid
where b.id = #{ecResourceId}
</select>
<!-- <select id="getKeyMapByKetField" resultType="com.alibaba.fastjson.JSONObject">-->
<!-- select id, account_type, certificate_num, login_id, work_code, ${keyField}-->
<!-- from jcl_org_hrmresource-->
<!-- </select>-->

@ -3,12 +3,12 @@
<mapper namespace="com.engine.organization.mapper.personnelcard.PersonnelCardMapper">
<resultMap id="UserMap" type="com.engine.organization.entity.personnelcard.User">
<result column="id" property="id"/>
<result column="messagerurl" property="image"/>
<result column="lastname" property="name"/>
<result column="messager_url" property="image"/>
<result column="last_name" property="name"/>
<result column="sex" property="sex"/>
<result column="email" property="email"/>
<result column="mobile" property="phone"/>
<result column="belongto" property="belongTo"/>
<result column="belong_to" property="belongTo"/>
<result column="status" property="status"/>
</resultMap>
@ -28,14 +28,14 @@
<select id="getUserById" resultMap="UserMap">
select id,
messagerurl,
lastname,
messager_url,
last_name,
sex,
email,
mobile,
belongto,
belong_to,
status
from hrmresource
from jcl_org_hrmresource
where id = #{id}
</select>

@ -12,6 +12,7 @@ import com.engine.organization.mapper.extend.ExtMapper;
import com.engine.organization.mapper.extend.ExtendGroupMapper;
import com.engine.organization.mapper.extend.ExtendInfoMapper;
import com.engine.organization.mapper.extend.ExtendTitleMapper;
import com.engine.organization.mapper.hrmresource.HrmResourceMapper;
import com.engine.organization.mapper.personnelcard.PersonnelCardMapper;
import com.engine.organization.service.HrmPersonnelCardService;
import com.engine.organization.util.OrganizationAssert;
@ -60,6 +61,10 @@ public class HrmPersonnelCardServiceImpl extends Service implements HrmPersonnel
return MapperProxyFactory.getProxy(ExtMapper.class);
}
private HrmResourceMapper getHrmResourceMapper() {
return MapperProxyFactory.getProxy(HrmResourceMapper.class);
}
@Override
public Map<String, Object> getPersonnelCard(Long uId) {
@ -67,7 +72,7 @@ public class HrmPersonnelCardServiceImpl extends Service implements HrmPersonnel
User userInfo;
//TODO 人员表之前关联关系处理UID
if (null == uId) {
uId = (long) user.getUID();
uId = getHrmResourceMapper().getJclResourceId(Util.null2String(user.getUID()));
}
userInfo = getPersonnelCardMapper().getUserById(uId);
@ -99,6 +104,7 @@ public class HrmPersonnelCardServiceImpl extends Service implements HrmPersonnel
resultMap.put("statistical", statistical);
resultMap.put("formItems", formItemList);
resultMap.put("anchorList", anchorList);
resultMap.put("iframeList", getIframeList());
return resultMap;
}
@ -121,32 +127,34 @@ public class HrmPersonnelCardServiceImpl extends Service implements HrmPersonnel
*/
private Statistical getStatistical(String resourceId) {
try {
// 获取Ec用户ID
String ecResourceId = getHrmResourceMapper().getEcResourceId(resourceId);
Statistical statistical = new Statistical();
if (SysModuleInfoBiz.checkModuleStatus(ModuleConstants.Workflow)) {
statistical.setWorkflowCount(new WorkflowRequestUtil().getRequestCount(user, resourceId));
statistical.setWorkflowCount(new WorkflowRequestUtil().getRequestCount(user, ecResourceId));
} else {
statistical.setWorkflowCount(0);
}
if (SysModuleInfoBiz.checkModuleStatus(ModuleConstants.Doc)) {
Object[] docCount4Hrm = new DocSearchComInfo().getDocCount4Hrm(resourceId, user);
Object[] docCount4Hrm = new DocSearchComInfo().getDocCount4Hrm(ecResourceId, user);
statistical.setDocCount(null == docCount4Hrm[1] ? 0 : Integer.parseInt(Util.null2String(docCount4Hrm[1])));
} else {
statistical.setDocCount(0);
}
if (SysModuleInfoBiz.checkModuleStatus(ModuleConstants.Crm)) {
String[] crmCount4Hrm = new CrmShareBase().getCrmCount4Hrm(resourceId, resourceId);
String[] crmCount4Hrm = new CrmShareBase().getCrmCount4Hrm(ecResourceId, ecResourceId);
statistical.setCusCount(null == crmCount4Hrm[1] ? 0 : Integer.parseInt(Util.null2String(crmCount4Hrm[1])));
} else {
statistical.setCusCount(0);
}
if (SysModuleInfoBiz.checkModuleStatus(ModuleConstants.Cowork)) {
String[] coworkCount4Hrm = new CoworkShareManager().getCoworkCount4Hrm(resourceId, resourceId);
String[] coworkCount4Hrm = new CoworkShareManager().getCoworkCount4Hrm(ecResourceId, ecResourceId);
statistical.setCollaborationCount(null == coworkCount4Hrm[1] ? 0 : Integer.parseInt(Util.null2String(coworkCount4Hrm[1])));
} else {
statistical.setCollaborationCount(0);
}
if (SysModuleInfoBiz.checkModuleStatus(ModuleConstants.Blog)) {
String[] blogCount4Hrm = new BlogShareManager().getBlogCount4Hrm(resourceId);
String[] blogCount4Hrm = new BlogShareManager().getBlogCount4Hrm(ecResourceId);
statistical.setWeiboCount(null == blogCount4Hrm[1] ? 0 : Integer.parseInt(Util.null2String(blogCount4Hrm[1])));
} else {
statistical.setWeiboCount(0);
@ -169,8 +177,11 @@ public class HrmPersonnelCardServiceImpl extends Service implements HrmPersonnel
ExtendInfoParams infoParams = ExtendInfoParams.builder().tableName(ExtendGroupBO.getTableNameByGroupPO(extendGroup)).fields(fields).params(null).id(uId).build();
Map<String, Object> fieldValueMap = getExtMapper().listExt(infoParams);
for (ExtendInfoPO extendInfoPO : extendInfoList) {
Object fieldValue = fieldValueMap.get(extendInfoPO.getFieldName());
String fieldShowName = FieldDefinedValueUtil.getFieldValue(user, extendInfoPO, Util.null2String(fieldValue));
String fieldShowName ="";
if (null != fieldValueMap) {
Object fieldValue = fieldValueMap.get(extendInfoPO.getFieldName());
fieldShowName = FieldDefinedValueUtil.getFieldValue(user, extendInfoPO, Util.null2String(fieldValue));
}
itemList.add(Item.builder().fieldId(extendInfoPO.getFieldNameDesc()).fieldValue(fieldShowName).build());
}
}

@ -23,6 +23,8 @@ import com.engine.organization.entity.job.bo.JobBO;
import com.engine.organization.entity.job.po.JobPO;
import com.engine.organization.entity.searchtree.SearchTree;
import com.engine.organization.entity.searchtree.SearchTreeParams;
import com.engine.organization.enums.LogModuleNameEnum;
import com.engine.organization.enums.OperateTypeEnum;
import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.department.DepartmentMapper;
import com.engine.organization.mapper.extend.ExtendTitleMapper;
@ -37,6 +39,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.thread.OrganizationSyncEc;
import com.engine.organization.util.HasRightUtil;
import com.engine.organization.util.MenuBtn;
import com.engine.organization.util.OrganizationAssert;
@ -186,7 +189,21 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
@Override
public Long saveBaseForm(Map<String, Object> params) {
HasRightUtil.hasRight(user, RIGHT_NAME, false);
// 通过岗位,获取分部、部门、等其他信息
String jobId = Util.null2String(params.get("job_title"));
if (StringUtils.isNotBlank(jobId)) {
JobPO jobById = getJobMapper().getJobById(Long.parseLong(jobId));
params.put("department_id", jobById.getParentDept());
params.put("company_id", jobById.getParentComp());
params.put("ec_department", jobById.getEcDepartment());
params.put("ec_company", jobById.getEcCompany());
// 等级方案、岗位序列、职等职级
}
// 新增EC人员,新增成功后,新增到聚才林人员表
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.RESOURCE, OperateTypeEnum.ADD, params).sync();
String ecResourceId = Util.null2String(syncMap.get("id"));
OrganizationAssert.isTrue(StringUtils.isNotBlank(ecResourceId), Util.null2String(syncMap.get("message")));
return getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_HRM, params, "", null);
}
@ -236,6 +253,22 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
if ("0".equals(groupId)) {
groupId = GROUP_ID.toString();
}
String jobId = Util.null2String(params.get("job_title"));
if (StringUtils.isNotBlank(jobId)) {
JobPO jobById = getJobMapper().getJobById(Long.parseLong(jobId));
params.put("department_id", jobById.getParentDept());
params.put("company_id", jobById.getParentComp());
params.put("ec_department", jobById.getEcDepartment());
params.put("ec_company", jobById.getEcCompany());
// 等级方案、岗位序列、职等职级
}
// 更新EC人员,更新成功后,更新聚才林人员表
Map<String, Object> syncMap = new OrganizationSyncEc(user, LogModuleNameEnum.RESOURCE, OperateTypeEnum.UPDATE, params).sync();
String ecResourceId = Util.null2String(syncMap.get("id"));
OrganizationAssert.isTrue(StringUtils.isNotBlank(ecResourceId), Util.null2String(syncMap.get("message")));
int updateCount = 0;
// 更新主表数据
updateCount += getExtService(user).updateExtForm(user, EXTEND_TYPE, JCL_ORG_HRM, params, "", id);
@ -281,10 +314,8 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
ArrayList<MenuBtn> topMenuList = new ArrayList<>();
ArrayList<MenuBtn> rightMenuList = new ArrayList<>();
topMenuList.add(MenuBtn.builder().isBatch("1").isTop("1").menuFun("new").menuIcon("icon-coms-New-Flow").menuName("新建人员").type("BTN_Addnew").build());
//topMenuList.add(MenuBtn.builder().isBatch("1").isTop("1").menuFun("import").menuIcon("icon-coms-leading-in").menuName("导入人员").type("BTN_Import").build());
btnDatas.put("topMenu", topMenuList);
rightMenuList.add(MenuBtn.builder().isBatch("1").isTop("1").menuFun("new").menuIcon("icon-coms-New-Flow").menuName("新建人员").type("BTN_Addnew").build());
//rightMenuList.add(MenuBtn.builder().isBatch("1").isTop("1").menuFun("import").menuIcon("icon-coms-leading-in").menuName("导入人员").type("BTN_Import").build());
rightMenuList.add(MenuBtn.builder().isBatch("0").isTop("0").menuFun("custom").menuIcon("icon-coms-task-list").menuName("显示列定制").type("BTN_COLUMN").build());
btnDatas.put("rightMenu", rightMenuList);
return btnDatas;

@ -36,7 +36,7 @@ import java.util.stream.Collectors;
public class OrganizationSyncEc {
private final LogModuleNameEnum moduleName;
private final OperateTypeEnum operateType;
private final Map<String, Object> params;
private Map<String, Object> params;
private final User user;
private JobPO oldJobPO;
Map<String, Object> resultMap;
@ -161,21 +161,22 @@ public class OrganizationSyncEc {
addResource();
break;
case UPDATE:
updateResource();
break;
case CANCELED:
break;
default:
break;
}
}
private void addResource() {
Map<String, Object> map = ResourceSyncUtil.addResource(user, params);
this.resultMap = map;
Map<String, Object> convertParams = ResourceSyncUtil.convertEcResourceParams(params);
this.resultMap = ResourceSyncUtil.addResource(user, convertParams);
}
private void updateResource() {
Map<String, Object> convertParams = ResourceSyncUtil.convertEcResourceParams(params);
this.resultMap = ResourceSyncUtil.editResourceBase(user, convertParams);
}

@ -17,11 +17,15 @@ 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.engine.organization.mapper.hrmresource.HrmResourceMapper;
import com.engine.organization.util.db.MapperProxyFactory;
import com.weaver.general.BaseBean;
import ln.LN;
import org.apache.commons.lang3.StringUtils;
import weaver.common.DateUtil;
import weaver.conn.RecordSet;
import weaver.conn.RecordSetTrans;
import weaver.crm.CrmShareBase;
import weaver.file.Prop;
import weaver.general.GCONST;
import weaver.general.PasswordUtil;
@ -44,8 +48,11 @@ import weaver.license.PluginUserCheck;
import weaver.rsa.security.RSA;
import weaver.rtx.OrganisationCom;
import weaver.rtx.OrganisationComRunnable;
import weaver.system.CusFormSetting;
import weaver.system.CusFormSettingComInfo;
import weaver.system.SysRemindWorkflow;
import weaver.systeminfo.SystemEnv;
import weaver.systeminfo.setting.HrmUserSettingComInfo;
import java.util.ArrayList;
import java.util.HashMap;
@ -65,7 +72,7 @@ public class ResourceSyncUtil {
Map<String, Object> retmap = new HashMap<>();
RecordSet rs = new RecordSet();
String sql = "";
String sql;
try {
DepartmentComInfo departmentComInfo = new DepartmentComInfo();
boolean canEdit = HrmUserVarify.checkUserRight("HrmResourceEdit:Edit", user);
@ -96,7 +103,7 @@ public class ResourceSyncUtil {
if (!loginid.equals("") && "0".equals(accounttype)) {
sql = "select count(1) from hrmresourceallview where loginid='" + loginid + "' ";
rs.executeSql(sql);
rs.execute(sql);
if (rs.next()) {
if (rs.getInt(1) > 0) {
retmap.put("status", "-1");
@ -116,7 +123,7 @@ public class ResourceSyncUtil {
ResourceComInfo ResourceComInfo = new ResourceComInfo();
Map<String, String> result = ResourceSyncUtil.addResourceBase(user, params);
Map<String, String> result = addResourceBase(user, params);
String addResourceBaseCode = result.get("status");
if ("-1".equals(addResourceBaseCode)) {
@ -148,8 +155,7 @@ public class ResourceSyncUtil {
//判断是否开启了【禁止弱密码保存】
String weakPasswordDisable = Util.null2s(settings.getWeakPasswordDisable(), "0");
if (weakPasswordDisable.equals("1")) {
if (password.equals("")) {//密码为空的情况
} else {
if (!password.equals("")) {//密码为空的情况
//判断是否为弱密码
HrmWeakPasswordUtil hrmWeakPasswordUtil = new HrmWeakPasswordUtil();
if (hrmWeakPasswordUtil.isWeakPsd(password)) {
@ -200,7 +206,7 @@ public class ResourceSyncUtil {
}
updateWorkInfo(String.valueOf(id), user, params);
rs.executeSql(sql);
rs.execute(sql);
HrmFaceCheckManager.setUserPassowrd(id + "", password);
HrmFaceCheckManager.sync(id + "", HrmFaceCheckManager.getOptUpdate(), "HrmResourceAddService_saveSimple_update", HrmFaceCheckManager.getOaResource());
@ -224,6 +230,7 @@ public class ResourceSyncUtil {
}
}
retmap.put("id", id);
retmap.put("status", "1");
} catch (Exception e) {
new BaseBean().writeLog("保存新建人员simple错误" + e);
@ -593,10 +600,374 @@ public class ResourceSyncUtil {
return retmap;
}
public static Map<String, Object> editResourceBase(User user, Map<String, Object> params) {
Map<String, Object> retMap = new HashMap<>();
try {
boolean canEdit = HrmUserVarify.checkUserRight("HrmResourceEdit:Edit", user);
if (!canEdit) {
retMap.put("status", "-1");
retMap.put("message", ""+weaver.systeminfo.SystemEnv.getHtmlLabelName(22620,weaver.general.ThreadVarLanguage.getLang())+"");
return retMap;
}
RecordSet rs = new RecordSet();
DepartmentComInfo DepartmentComInfo = new DepartmentComInfo();
ResourceComInfo ResourceComInfo = new ResourceComInfo();
HrmServiceManager HrmServiceManager = new HrmServiceManager();
CrmShareBase CrmShareBase = new CrmShareBase();
StringBuilder para;
String id = Util.null2String(params.get("id"));
if (id.length()==0) {
retMap.put("status", "-1");
retMap.put("message", ""+weaver.systeminfo.SystemEnv.getHtmlLabelName(22620,weaver.general.ThreadVarLanguage.getLang())+"");
return retMap;
}
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 resourceimageBase64 = Util.null2String(params.get("resourceimageBase64"));
if(resourceimageBase64.length()>0){
resourceimageid = ServiceUtil.saveResourceImage(resourceimageBase64);
}
String oldresourceimageid = Util.null2String(params.get("oldresourceimage"));
if (resourceimageid.equals("")) resourceimageid = oldresourceimageid;
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 email = Util.fromScreen3(Util.null2String(params.get("email")), user.getLanguage());
String dsporder = Util.fromScreen3(Util.null2String(params.get("dsporder")), user.getLanguage());
String jobcall = Util.fromScreen3(Util.null2String(params.get("jobcall")), user.getLanguage());
String systemlanguage = Util.fromScreen3(Util.null2String(params.get("systemlanguage")), user.getLanguage());
if (systemlanguage.equals("") || systemlanguage.equals("0")) {
systemlanguage = "7";
}
String accounttype = Util.fromScreen3(Util.null2String(params.get("accounttype")), user.getLanguage());
String belongto = Util.fromScreen3(Util.null2String(params.get("belongto")), user.getLanguage());
if (dsporder.length() == 0) dsporder = id;
if (accounttype.equals("0")) {
belongto = "-1";
}
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;
}
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.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);//吸入操作前日志
//Td9325,解决多账号次账号没有登陆Id在浏览框组织结构中无法显示的问题。
String oldbelongto = "";
boolean falg = false;
String loginid = "";
rs.execute("select * from HrmResource where id =" + id);
if (rs.next()) {
loginid = rs.getString("loginid");
float idsporder = rs.getFloat("dsporder");
if (idsporder <= 0) {
dsporder = rs.getString("id");
} else {
dsporder = "" + idsporder;
}
String thisAccounttype = rs.getString("accounttype");
if (thisAccounttype.equals("1") && accounttype.equals("0")) {
oldbelongto = rs.getString("belongto");
}
}
if (accounttype.equals("1") && loginid.equalsIgnoreCase("")) {
rs.execute("select loginid from HrmResource where id =" + belongto);
if (rs.next()) {
loginid = rs.getString(1);
}
if (!loginid.equals("")) {
loginid = loginid + (id + 1);
falg = true;
}
}
String sql = "select * from HrmResource where id = " + Util.getIntValue(id);
rs.execute(sql);
String oldmanagerid = "";
String oldmanagerstr = "";
while (rs.next()) {
oldmanagerid = rs.getString("managerid");
oldmanagerstr = rs.getString("managerstr");
// 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 begin
if (!oldmanagerstr.startsWith(",")) oldmanagerstr = "," + oldmanagerstr;
if (!oldmanagerstr.endsWith(",")) oldmanagerstr = oldmanagerstr + ",";
// 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 end
}
//mysql报错问题java.sql.SQLException: Incorrect integer value: '' for column 'COSTCENTERID' at row 1
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 (StringUtils.isNotEmpty(workcode)) {
CodeRuleManager.getCodeRuleManager().checkReservedIfDel(RuleCodeType.USER.getValue(), 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 + systemlanguage
+ separator + accounttype + separator + belongto + separator + email + separator + dsporder + separator + mobileshowtype);
RecordSetTrans rst = new RecordSetTrans();
rst.setAutoCommit(false);
try {
rst.executeProc("HrmResourceBasicInfo_Update", para.toString());
if(Util.null2String(locationid).length()>0) {
rst.executeSql("update hrmresource set countryid=(select countryid from HrmLocations where id=" + locationid + ") 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();
}
if(!"7".equals(systemlanguage) && StringUtils.isNotBlank(systemlanguage)){
User.setUserLang(Util.getIntValue(id),Util.getIntValue(systemlanguage, 7));
}
//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();
}
int userid = user.getUID();
String userpara = "" + userid + separator + today;
rs.executeProc("HrmResource_ModInfo", "" + id + separator + userpara);
String managerstr = "";
if (!id.equals(managerid)) {
sql = "select managerstr from HrmResource where id = " + Util.getIntValue(managerid);
rs.execute(sql);
while (rs.next()) {
managerstr = rs.getString("managerstr");
// 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 begin
if (!managerstr.startsWith(",")) managerstr = "," + managerstr;
if (!managerstr.endsWith(",")) managerstr = managerstr + ",";
// 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 end
managerstr = "," + managerid + managerstr;
managerstr = managerstr.endsWith(",") ? managerstr : (managerstr + ",");
}
} else {
managerstr = "," + managerid + ",";
}
rst = new RecordSetTrans();
rst.setAutoCommit(false);
try {
para = new StringBuilder("" + id + separator + managerstr);
rst.executeProc("HrmResource_UpdateManagerStr", para.toString());
rst.commit();
} catch (Exception e) {
rst.rollback();
e.printStackTrace();
}
managerid = Util.null2String(managerid).trim();
oldmanagerid = Util.null2String(oldmanagerid).trim();
if(!managerid.equals(oldmanagerid) && !(("".equals(managerid) || "0".equals(managerid)) && ("".equals(oldmanagerid) || "0".equals(oldmanagerid)))){
String temOldmanagerstr = "," + id + oldmanagerstr;
temOldmanagerstr = temOldmanagerstr.endsWith(",") ? temOldmanagerstr : (temOldmanagerstr + ",");
sql = "select id,departmentid,subcompanyid1,managerid,seclevel,managerstr from HrmResource where managerstr like '%" + temOldmanagerstr + "'";
rs.execute(sql);
while (rs.next()) {
String nowmanagerstr = Util.null2String(rs.getString("managerstr"));
// 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 begin
if (!nowmanagerstr.startsWith(",")) nowmanagerstr = "," + nowmanagerstr;
if (!nowmanagerstr.endsWith(",")) nowmanagerstr = nowmanagerstr + ",";
// 处理managerstr 不以逗号开始或者结束的情况 形如 managerstr8 end
String resourceid = rs.getString("id");
//指定上级为自身的情况,不更新自身上级
if (id.equals(resourceid))
continue;
String nowmanagerstr2 = "";
int index = nowmanagerstr.lastIndexOf(oldmanagerstr);
if (index != -1) {
if (!"".equals(managerstr)) {
nowmanagerstr2 = nowmanagerstr.substring(0, index) + ("".equals(oldmanagerstr) ? managerstr.substring(1) : managerstr);
} else {
nowmanagerstr2 = nowmanagerstr.substring(0, index) + ("".equals(oldmanagerstr) ? "" : ",");
}
}
rst = new RecordSetTrans();
rst.setAutoCommit(false);
try {
para = new StringBuilder(resourceid + separator + nowmanagerstr2);
rst.executeProc("HrmResource_UpdateManagerStr", para.toString());
rst.commit();
ResourceComInfo.updateResourceInfoCache(resourceid); //更新缓存
} catch (Exception e) {
rst.rollback();
e.printStackTrace();
}
}
}
String subcmpanyid1 = DepartmentComInfo.getSubcompanyid1(departmentid);
para = new StringBuilder("" + id + separator + subcmpanyid1);
rst = new RecordSetTrans();
rst.setAutoCommit(false);
try {
rst.executeProc("HrmResource_UpdateSubCom", para.toString());
rst.commit();
} catch (Exception e) {
rst.rollback();
e.printStackTrace();
}
if(!managerid.equals(oldmanagerid) && !(("".equals(managerid) || "0".equals(managerid)) && ("".equals(oldmanagerid) || "0".equals(oldmanagerid)))){//修改人力资源经理,对客户和日程共享重新计算
CrmShareBase.setShareForNewManager(id);
}
boolean formdefined = false;
CusFormSettingComInfo CusFormSettingComInfo = new weaver.system.CusFormSettingComInfo();
CusFormSetting CusFormSetting = CusFormSettingComInfo.getCusFormSetting("hrm", "HrmResourceBase");
if (CusFormSetting != null) {
if (CusFormSetting.getStatus() == 2) {
//自定义布局页面
formdefined = true;
}
}
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());
new Thread(new OrganisationComRunnable("user", "editbasicinfo", id + "-" + status)).start();
// 改为自进行修正
ResourceComInfo.updateResourceInfoCache(id);
try {
//OA与第三方接口单条数据同步方法开始
HrmServiceManager.SynInstantHrmResource(id, "2");
//OA与第三方接口单条数据同步方法结束
} catch (Exception e) {
new BaseBean().writeLog("OA与第三方接口单条数据同步失败" + e);
}
//处理次账号修改为主账号时,检查次账号所属 主账号的 其他设置是否需要修改 add by kzw QC159888
try {
if (!oldbelongto.equals("")) {
HrmUserSettingComInfo userSetting = new HrmUserSettingComInfo();
String belongtoshow = userSetting.getBelongtoshowByUserId(oldbelongto);
if (belongtoshow.equals("1")) {
rs.execute("select id from hrmresource where belongto = " + oldbelongto);
if (!rs.next()) {
String setId = userSetting.getId(oldbelongto);
rs.execute("update HrmUserSetting set belongtoshow=0 where id=" + setId);
userSetting.removeHrmUserSettingComInfoCache();
}
}
}
} catch (Exception e) {
new BaseBean().writeLog(e.getMessage());
}
rs.execute("update HrmResource set " + DbFunctionUtil.getUpdateSetSql(rs.getDBType(), user.getUID()) + " where id=" + id);
rs.execute("update HrmResourceManager set " + DbFunctionUtil.getUpdateSetSql(rs.getDBType(), user.getUID()) + " where id=" + id);
//写入操作后日志
LogUtil.writeBizLog(logger.getBizLogContexts());
HrmFaceCheckManager.sync(id, HrmFaceCheckManager.getOptUpdate(), "hrm_e9_HrmResourceBaseService_editResourceBase", HrmFaceCheckManager.getOaResource());
retMap.put("status", "1");
retMap.put("id", id);
} catch (Exception e) {
new BaseBean().writeLog(e);
retMap.put("status", "-1");
retMap.put("message", ""+weaver.systeminfo.SystemEnv.getHtmlLabelName(22620,weaver.general.ThreadVarLanguage.getLang())+"");
}
return retMap;
}
private static void updateWorkInfo(String id, User user, Map<String, Object> params) {
try {
RecordSet rs = new RecordSet();
String sql = "";
String sql;
String companystartdate = Util.fromScreen3(Util.null2String(params.get("companystartdate")), user.getLanguage());
String workstartdate = Util.fromScreen3(Util.null2String(params.get("workstartdate")), user.getLanguage());
@ -612,4 +983,62 @@ public class ResourceSyncUtil {
new BaseBean().writeLog(e);
}
}
public static Map<String,Object> convertEcResourceParams(Map<String, Object> params){
Map<String, Object> convertParams = new HashMap<>();
String jclResourceId = Util.null2String(params.get("id"));
String ecResourceId = "";
if(StringUtils.isNotBlank(jclResourceId)){
ecResourceId = MapperProxyFactory.getProxy(HrmResourceMapper.class).getEcResourceId(jclResourceId);
}
convertParams.put("id",ecResourceId);
// 部门ID
convertParams.put("departmentid",params.get("ec_department"));
// EC岗位
String jclJobId = Util.null2String(params.get("job_title"));
String ecJobId = "1";
if (StringUtils.isNotBlank(jclJobId)) {
ecJobId = EcHrmRelationUtil.getEcJobId(Long.parseLong(jclJobId));
}
convertParams.put("jobtitle",ecJobId);
convertParams.put("loginid",params.get("login_id"));
convertParams.put("accounttype",params.get("account_type"));
convertParams.put("password",params.get("pass_word"));
convertParams.put("seclevel",params.get("sec_level"));
convertParams.put("workstartdate",params.get("work_start_date"));
convertParams.put("companystartdate",params.get("company_start_date"));
convertParams.put("dsporder",params.get("show_order"));
convertParams.put("workcode",params.get("work_code"));
convertParams.put("lastname",params.get("last_name"));
convertParams.put("sex",params.get("sex"));
convertParams.put("resourceimageid",params.get("resource_image_id"));
convertParams.put("joblevel",params.get("job_level"));
convertParams.put("jobactivitydesc",params.get("job_activity_desc"));
convertParams.put("managerid",params.get("manager_id"));
convertParams.put("assistantid",params.get("assistant_id"));
convertParams.put("status",params.get("status"));
convertParams.put("locationid",params.get("location_id"));
convertParams.put("workroom",params.get("workroom"));
convertParams.put("telephone",params.get("telephone"));
convertParams.put("mobile",params.get("mobile"));
convertParams.put("mobilecall",params.get("mobile_call"));
convertParams.put("fax",params.get("fax"));
convertParams.put("jobcall",params.get("job_call"));
convertParams.put("email",params.get("email"));
convertParams.put("systemlanguage",params.get("system_language"));
convertParams.put("belongto",params.get("belong_to"));
convertParams.put("mobileshowtype","");
convertParams.put("costcenterid","");
convertParams.put("cmd","");
convertParams.put("rcId","");
convertParams.put("departmentvirtualids","");
// 更新EC人员用到参数
convertParams.put("editcontact","");
convertParams.put("resourceimageBase64","");
convertParams.put("oldresourceimage","");
return convertParams;
}
}

Loading…
Cancel
Save