#EC_HJ6# 人员Excel导入优化默认密码

main
shilei 2 years ago
parent d634f1e5cb
commit e84289c3e5

@ -45,7 +45,12 @@ public class ImportExcelResourceUtil {
String createrid = "1" ;
String lastmodid = "1" ;
String creator = "1";
String pwd = "1";
String pwd = PropBean.getUfPropValue("user_pwd") ;
String password = DigestUtils.md5Hex(pwd).toUpperCase(); //MD5加密
String currentDate = TimeUtil.getCurrentDateString();//当前日期
String currentDateTime = TimeUtil.getCurrentTimeString(); //当前时间
for (int i = 0; i < datalists.size(); i++)
{
@ -58,11 +63,6 @@ public class ImportExcelResourceUtil {
String STAFF_CODE = Util.null2String(h.get("staff_code"));
String currentDate = TimeUtil.getCurrentDateString();//当前日期
String currentDateTime = TimeUtil.getCurrentTimeString(); //当前时间
String password = DigestUtils.md5Hex(pwd).toUpperCase(); //MD5加密
String STAFF_ID = Util.null2String(h.get("staff_id"));
String E_MAIL = Util.null2String(h.get("e_mail"));
@ -153,10 +153,10 @@ public class ImportExcelResourceUtil {
BaseBean bb = new BaseBean();
RecordSet rs = new RecordSet();
String userid = "" ;
String sql = " select loginid,id,jobtitle as userid from hrmresource where workcode=?" ;
String sql = " select id,loginid,jobtitle from hrmresource where workcode=?" ;
rs.executeQuery(sql,new Object[]{STAFF_CODE});
if(rs.next()){
userid = Util.null2String(rs.getString("userid"));
userid = Util.null2String(rs.getString("id"));
jobTitleId = Util.null2String(rs.getString("jobtitle"));
}
@ -177,11 +177,19 @@ public class ImportExcelResourceUtil {
bb.writeLog("seqorder:"+seqorder);
if (StringUtils.isNotEmpty(seqorder)) {
String cusUpdateSql = " update cus_fielddata set "+cus_staff+"=?,"+cus_eid+"=? where scope=? and scopeid=? and id=?";
bb.writeLog(cusUpdateSql);
bb.writeLog("cus_staff:"+cus_staff);
bb.writeLog("cus_eid:"+cus_eid);
bb.writeLog("STAFF_ID:"+STAFF_ID);
bb.writeLog("EID:"+EID);
bb.writeLog("scope:"+scope);
bb.writeLog("scopeid:"+scopeid);
bb.writeLog("userid:"+userid);
if(StringUtils.isNotBlank(STAFF_ID)){
String cusUpdateSql = " update cus_fielddata set "+cus_staff+"=? where scope=? and scopeid=? and id=?";
bb.writeLog("cusUpdateSql:"+cusUpdateSql);
flag = rs.executeUpdate(cusUpdateSql, new Object[]{STAFF_ID, EID, scope,scopeid,userid});
flag = rs.executeUpdate(cusUpdateSql, new Object[]{STAFF_ID, scope,scopeid,userid});
bb.writeLog("flag:"+flag);
if(!flag)
{
@ -192,6 +200,23 @@ public class ImportExcelResourceUtil {
dataMap.put("systable",tableName);
recordErrorData(dataMap);
}
}
if(StringUtils.isNotBlank(EID)){
String cusUpdateSql = " update cus_fielddata set "+cus_eid+"=? where scope=? and scopeid=? and id=?";
bb.writeLog("cusUpdateSql:"+cusUpdateSql);
flag = rs.executeUpdate(cusUpdateSql, new Object[]{ EID, scope,scopeid,userid});
bb.writeLog("flag:"+flag);
if(!flag)
{
Map<String,String> dataMap = new HashMap<String,String>();
dataMap.put("syndate",nowDateTime);
dataMap.put("reqmessage", JSONObject.toJSONString(dataMap));
dataMap.put("errmessage","更新人员自定义信息失败");
dataMap.put("systable",tableName);
recordErrorData(dataMap);
}
}
} else {
String cusInsertSql = " insert into cus_fielddata(scope,scopeid,id,"+cus_staff+","+cus_eid+") values(?,?,?,?,?)";
bb.writeLog("cusInsertSql:"+cusInsertSql);

@ -179,21 +179,24 @@ public class ImportOrgExcelCmd extends AbstractCommonCommand<Map<String,Object>>
}
}else if("3".equals(type)){
//人员
String jobtitlestable = "hrmresource" ;
String jobtitlesbaktable = "hrmresource_allbak" ;
String hrmresourcetable = "hrmresource" ;
String hrmresourcebaktable = "hrmresource_allbak" ;
String cusfielddatatable = "cus_fielddata";
String cusfielddatatabakble = "cus_fielddata_allbak" ;
boolean isExist = importOrgExcelUtil.backupTableByData(jobtitlestable,jobtitlesbaktable);
bb.writeLog("isExist:"+isExist);
if(isExist){
isExist = importOrgExcelUtil.backupTableByData(cusfielddatatable,cusfielddatatabakble);
bb.writeLog("isExist:"+isExist);
if(isExist){
// try{
// boolean isExist = importOrgExcelUtil.backupTableByData(hrmresourcetable,hrmresourcebaktable);
// bb.writeLog("isExist:"+isExist);
// if(isExist){
// isExist = importOrgExcelUtil.backupTableByData(cusfielddatatable,cusfielddatatabakble);
// bb.writeLog("isExist:"+isExist);
// }
// }catch (Exception e){
// bb.writeLog("operateExcel--e:"+e);
// }
importExcelResourceUtil.operateHrmResourceExcel(datalists);
}
}
}else if("4".equals(type)){
//角色

@ -1,13 +1,17 @@
package com.engine.dito.excel.cmd;
import weaver.conn.RecordSet;
import weaver.general.BaseBean;
import weaver.general.Util;
public class ImportOrgExcelUtil {
public boolean backupTableByData(String tName,String bName){
boolean isExist = true;
BaseBean bb = new BaseBean();
RecordSet rs = new RecordSet();
boolean isExist = checkTableIsExist(bName);
try{
isExist = checkTableIsExist(bName);
if(!isExist){
String sql = " create table "+bName+" select * from "+tName ;
isExist = rs.executeUpdate(sql);
@ -20,7 +24,9 @@ public class ImportOrgExcelUtil {
isExist = rs.executeUpdate(sql);
}
}
}catch (Exception e){
bb.writeLog("backupTableByData-e:"+e);
}
return isExist;
}

Loading…
Cancel
Save