|
|
|
@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.cloudstore.dev.api.bean.MessageBean;
|
|
|
|
|
import com.cloudstore.dev.api.bean.MessageType;
|
|
|
|
|
import com.cloudstore.dev.api.util.Util_Message;
|
|
|
|
|
import okhttp3.*;
|
|
|
|
|
import org.apache.commons.codec.digest.DigestUtils;
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
import weaver.conn.RecordSet;
|
|
|
|
@ -220,11 +221,11 @@ public class RocketmqUtil {
|
|
|
|
|
bb.writeLog("status2:"+status);
|
|
|
|
|
|
|
|
|
|
String userUpdateSql = " update hrmresource set loginid=?,lastname=?,departmentid=?,subcompanyid1=?," +
|
|
|
|
|
" creater=?,email=?,mobile=?,jobtitle=?,status=?,dsporder=?,lastmoddate=?,modified=? where workcode=? ";
|
|
|
|
|
" creater=?,email=?,mobile=?,status=?,dsporder=?,lastmoddate=?,modified=? where workcode=? ";
|
|
|
|
|
bb.writeLog("updateSysUserData-userUpdateSql:"+userUpdateSql);
|
|
|
|
|
|
|
|
|
|
boolean flag = rs.executeUpdate(userUpdateSql,new Object[]{loginid,lastname,deptId,subcompanyid1,creator,email,
|
|
|
|
|
pwdSmsTel,jobTitleId,status,loginedNum,currentDate,currentDateTime,staffCode});
|
|
|
|
|
pwdSmsTel,status,loginedNum,currentDate,currentDateTime,staffCode});
|
|
|
|
|
bb.writeLog("flag:"+flag);
|
|
|
|
|
Map<String,String> dataMap = new HashMap<String,String>();
|
|
|
|
|
dataMap.put("staffcodecount",datacount+"");
|
|
|
|
@ -642,6 +643,10 @@ public class RocketmqUtil {
|
|
|
|
|
|
|
|
|
|
String systemUserCode = Util.null2String(jsonObject.get("systemUserCode"));
|
|
|
|
|
String systemUserName = Util.null2String(jsonObject.get("systemUserName"));
|
|
|
|
|
String sysUserId = Util.null2String(jsonObject.get("sysUserId"));
|
|
|
|
|
|
|
|
|
|
//所有角色
|
|
|
|
|
Set<String> set = getSysRoles(sysUserId);
|
|
|
|
|
|
|
|
|
|
String actType = Util.null2String(jsonObject.get("actType"));
|
|
|
|
|
String statusCd = Util.null2String(jsonObject.get("statusCd"));
|
|
|
|
@ -692,19 +697,22 @@ public class RocketmqUtil {
|
|
|
|
|
bb.writeLog("userId:" + userId + " roleId:" + roleId + "releationId:" + releationId);
|
|
|
|
|
if (StringUtils.isNotEmpty(releationId)) {
|
|
|
|
|
if ("D".equals(actType)) {
|
|
|
|
|
String delHrmrolemembersSql = " delete from hrmrolemembers where id = ?";
|
|
|
|
|
boolean flag = rs.executeUpdate(delHrmrolemembersSql, releationId);
|
|
|
|
|
bb.writeLog("delHrmrolemembersSql : " + flag);
|
|
|
|
|
Map<String,String> dataMap = new HashMap<String,String>();
|
|
|
|
|
dataMap.put("syndate",nowDateTime);
|
|
|
|
|
dataMap.put("reqmessage",jsonObject.toJSONString());
|
|
|
|
|
dataMap.put("systable",tableName);
|
|
|
|
|
if (!flag) {
|
|
|
|
|
dataMap.put("errmessage","角色成员删除失败");
|
|
|
|
|
}else {
|
|
|
|
|
dataMap.put("errmessage","角色成员删除成功");
|
|
|
|
|
// 不包含 角色
|
|
|
|
|
if(!set.contains(roleCode)){
|
|
|
|
|
String delHrmrolemembersSql = " delete from hrmrolemembers where id = ?";
|
|
|
|
|
boolean flag = rs.executeUpdate(delHrmrolemembersSql, releationId);
|
|
|
|
|
bb.writeLog("delHrmrolemembersSql : " + flag);
|
|
|
|
|
Map<String,String> dataMap = new HashMap<String,String>();
|
|
|
|
|
dataMap.put("syndate",nowDateTime);
|
|
|
|
|
dataMap.put("reqmessage",jsonObject.toJSONString());
|
|
|
|
|
dataMap.put("systable",tableName);
|
|
|
|
|
if (!flag) {
|
|
|
|
|
dataMap.put("errmessage","角色成员删除失败");
|
|
|
|
|
}else {
|
|
|
|
|
dataMap.put("errmessage","角色成员删除成功");
|
|
|
|
|
}
|
|
|
|
|
recordErrorData(dataMap);
|
|
|
|
|
}
|
|
|
|
|
recordErrorData(dataMap);
|
|
|
|
|
}else if("M".equals(actType)){
|
|
|
|
|
if("1100".equals(statusCd)){
|
|
|
|
|
String delHrmrolemembersSql = " delete from hrmrolemembers where id = ?";
|
|
|
|
@ -1325,7 +1333,7 @@ public class RocketmqUtil {
|
|
|
|
|
|
|
|
|
|
String cus_staff = PropBean.getUfPropValue("cus_staff") ;
|
|
|
|
|
String cus_eid = PropBean.getUfPropValue("cus_eid") ;
|
|
|
|
|
|
|
|
|
|
String cus_sysuserid = PropBean.getUfPropValue("cus_sysuserid") ;
|
|
|
|
|
|
|
|
|
|
String currentDate = TimeUtil.getCurrentDateString();//当前日期
|
|
|
|
|
String currentDateTime = TimeUtil.getCurrentTimeString(); //当前时间
|
|
|
|
@ -1358,7 +1366,7 @@ public class RocketmqUtil {
|
|
|
|
|
}
|
|
|
|
|
bb.writeLog("email:"+email);
|
|
|
|
|
|
|
|
|
|
String pwdSmsTel = Util.null2String(jsonObject.getString("pwdSmsTel"),"null");
|
|
|
|
|
String pwdSmsTel = Util.null2String(jsonObject.getString("mobilePhone"),"null");
|
|
|
|
|
bb.writeLog("pwdSmsTel:"+pwdSmsTel);
|
|
|
|
|
String loginedNum = Util.null2String(jsonObject.getString("sysUserId"),"null");
|
|
|
|
|
bb.writeLog("loginedNum:"+loginedNum);
|
|
|
|
@ -1377,9 +1385,10 @@ public class RocketmqUtil {
|
|
|
|
|
}else if(jsonObject.containsKey("eId")){
|
|
|
|
|
eId = Util.null2String(jsonObject.get("eId"));
|
|
|
|
|
}
|
|
|
|
|
String sysUserId = Util.null2String(jsonObject.get("sysUserId"));
|
|
|
|
|
bb.writeLog("eId:"+eId);
|
|
|
|
|
bb.writeLog("staffId:"+staffId);
|
|
|
|
|
|
|
|
|
|
bb.writeLog("sysUserId:"+sysUserId);
|
|
|
|
|
try {
|
|
|
|
|
String subcompanyid1 = "" ;
|
|
|
|
|
String deptId = "";
|
|
|
|
@ -1657,9 +1666,9 @@ public class RocketmqUtil {
|
|
|
|
|
seqorder = Util.null2String(rs.getString("seqorder"));
|
|
|
|
|
}
|
|
|
|
|
if (StringUtils.isNotEmpty(seqorder)) {
|
|
|
|
|
String cusUpdateSql = " update cus_fielddata set "+cus_staff+"=?,"+cus_eid+"=? where scope=? and scopeid=? and id=?";
|
|
|
|
|
String cusUpdateSql = " update cus_fielddata set "+cus_staff+"=?,"+cus_eid+"=?,"+cus_sysuserid+"=? where scope=? and scopeid=? and id=?";
|
|
|
|
|
bb.writeLog(cusUpdateSql);
|
|
|
|
|
boolean deflag = rs.executeUpdate(cusUpdateSql, new Object[]{staffId, eId, scope,scopeid,userid});
|
|
|
|
|
boolean deflag = rs.executeUpdate(cusUpdateSql, new Object[]{staffId, eId, sysUserId, scope,scopeid,userid});
|
|
|
|
|
Map<String,String> dataMap = new HashMap<String,String>();
|
|
|
|
|
dataMap.put("staffcodecount",datacount+"");
|
|
|
|
|
dataMap.put("staffcode",staffCode);
|
|
|
|
@ -1673,9 +1682,9 @@ public class RocketmqUtil {
|
|
|
|
|
}
|
|
|
|
|
recordErrorData(dataMap);
|
|
|
|
|
} else {
|
|
|
|
|
String cusInsertSql = " insert into cus_fielddata(scope,scopeid,id,"+cus_staff+","+cus_eid+") values(?,?,?,?,?)";
|
|
|
|
|
String cusInsertSql = " insert into cus_fielddata(scope,scopeid,id,"+cus_staff+","+cus_eid+","+cus_sysuserid+") values(?,?,?,?,?,?)";
|
|
|
|
|
bb.writeLog(cusInsertSql);
|
|
|
|
|
boolean deflag = rs.executeUpdate(cusInsertSql, new Object[]{scope, scopeid, userid, staffId, eId});
|
|
|
|
|
boolean deflag = rs.executeUpdate(cusInsertSql, new Object[]{scope, scopeid, userid, staffId, eId, sysUserId});
|
|
|
|
|
Map<String,String> dataMap = new HashMap<String,String>();
|
|
|
|
|
dataMap.put("staffcodecount",datacount+"");
|
|
|
|
|
dataMap.put("staffcode",staffCode);
|
|
|
|
@ -1848,5 +1857,48 @@ public class RocketmqUtil {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static Set<String> getSysRoles(String sysUserId){
|
|
|
|
|
Set<String> set = new HashSet<>();
|
|
|
|
|
BaseBean bb = new BaseBean();
|
|
|
|
|
|
|
|
|
|
String dataJson = "{\"sysUserId\": "+ sysUserId +",\"pageNum\": 1,\"pageSize\": 5555}";
|
|
|
|
|
|
|
|
|
|
String getAllSysUserRolesUrl = PropBean.getUfPropValue("getAllSysUserRolesUrl");
|
|
|
|
|
String Authorization = PropBean.getUfPropValue("Authorization");
|
|
|
|
|
try {
|
|
|
|
|
OkHttpClient client = new OkHttpClient().newBuilder().build();
|
|
|
|
|
MediaType mediaType = MediaType.parse("application/json");
|
|
|
|
|
RequestBody body = RequestBody.create(mediaType, dataJson);
|
|
|
|
|
Request request = new Request.Builder()
|
|
|
|
|
.url(getAllSysUserRolesUrl)
|
|
|
|
|
.method("POST", body)
|
|
|
|
|
.addHeader("Authorization", Authorization)
|
|
|
|
|
.addHeader("Content-Type", "application/json")
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
|
|
Response response = client.newCall(request).execute();
|
|
|
|
|
int code = response.code();
|
|
|
|
|
String bodyMsg = response.body().string();
|
|
|
|
|
bb.writeLog("response.code():"+code);
|
|
|
|
|
bb.writeLog("response.body():"+bodyMsg);
|
|
|
|
|
if(code == 200){
|
|
|
|
|
JSONObject msgObject = JSONObject.parseObject(bodyMsg);
|
|
|
|
|
if(msgObject.containsKey("list")){
|
|
|
|
|
String roleList = msgObject.getString("list");
|
|
|
|
|
JSONArray roleArray = JSONArray.parseArray(roleList);
|
|
|
|
|
for(int i=0;i<roleArray.size();i++){
|
|
|
|
|
JSONObject roleObject = (JSONObject) roleArray.get(i);
|
|
|
|
|
String systemRoles = roleObject.getString("systemRoles");
|
|
|
|
|
JSONObject rolesObject = JSONObject.parseObject(systemRoles);
|
|
|
|
|
String sysRoleCode = rolesObject.getString("sysRoleCode");
|
|
|
|
|
set.add(sysRoleCode);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
return set;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|