人员中台 - 人员初始化相关接口
parent
6ff7afb927
commit
b3ec041f58
|
@ -2595,4 +2595,115 @@ public class UsersController extends BaseController {
|
|||
}
|
||||
return returnMap;
|
||||
}
|
||||
|
||||
static String CREATOR = null;
|
||||
static String OPERATOR = null;
|
||||
@RequestMapping(value = "/initCore")
|
||||
@ResponseBody
|
||||
public Object initCore() throws Exception {
|
||||
|
||||
PageData p1d = new PageData();
|
||||
// pd = this.getPageData();
|
||||
if (CREATOR == null) {
|
||||
CREATOR = Jurisdiction.getUSER_ID();
|
||||
OPERATOR = Jurisdiction.getUSER_ID();
|
||||
}
|
||||
List<PageData> pageData = usersService.listAllUser(p1d);
|
||||
|
||||
for (PageData pd : pageData) {
|
||||
try {
|
||||
pd.put("CREATTIME", DateUtil.date2Str(new Date())); //创建时间
|
||||
pd.put("CREATOR", CREATOR); //创建人
|
||||
pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
|
||||
pd.put("OPERATOR", OPERATOR); //修改人
|
||||
PageData sexPd = new PageData();
|
||||
if (Tools.notEmpty(pd.getString("SEX"))) {
|
||||
sexPd.put("DICTIONARIES_ID", pd.getString("SEX"));
|
||||
PageData byId = dictionariesService.findById(sexPd);
|
||||
if (Tools.notEmpty(byId)) {
|
||||
pd.put("SEX", byId.getString("NAME"));
|
||||
}
|
||||
}
|
||||
StringBuilder ORG_PATH = new StringBuilder();
|
||||
boolean hasPid = true;
|
||||
PageData department = departmentService.findById(pd);
|
||||
if (department != null) {
|
||||
ORG_PATH.insert(0, department.getString("NAME"));
|
||||
String deptId = department.getString("PARENT_ID");
|
||||
PageData deptPd = new PageData();
|
||||
deptPd.put("DEPARTMENT_ID", deptId);
|
||||
if (!"0".equals(department.get("PARENT_ID"))) {
|
||||
while (hasPid) {
|
||||
PageData dept = departmentService.findById(deptPd);
|
||||
if ("0".equals(dept.get("PARENT_ID"))) {
|
||||
hasPid = false;
|
||||
} else {
|
||||
deptId = dept.getString("PARENT_ID");
|
||||
deptPd.put("DEPARTMENT_ID", deptId);
|
||||
}
|
||||
ORG_PATH.insert(0, dept.getString("NAME") + "/");
|
||||
}
|
||||
}
|
||||
pd.put("ORG_PATH", ORG_PATH);
|
||||
} else {
|
||||
ORG_PATH.insert(0, "");
|
||||
|
||||
|
||||
}
|
||||
PageData CorpName = corpInfoService.findById(pd);
|
||||
|
||||
|
||||
pd.put("CORPINFO_NAME", CorpName == null ? "" : CorpName.getString("CORP_NAME"));
|
||||
pd.put("USER_TYPE", "1");
|
||||
|
||||
HashMap<String, Object> param = new HashMap<>();
|
||||
Set set = pd.keySet();
|
||||
for (Object key : set) {
|
||||
param.put(key.toString(), pd.getString(key.toString()));
|
||||
}
|
||||
|
||||
|
||||
//要推送的照片集合
|
||||
List<PageData> userPhotoDTOList = new ArrayList<>();
|
||||
//人脸照片
|
||||
PageData photoPd = new PageData();
|
||||
photoPd.put("USER_PHOTO_ID", pd.getString("IMGFILES_ID"));
|
||||
photoPd.put("USER_ID", pd.getString("FOREIGN_KEY"));
|
||||
photoPd.put("PHOTO_URL", pd.getString("FILEPATH"));
|
||||
photoPd.put("PHOTO_TYPE", "1");
|
||||
photoPd.put("ISDELETE", "0");
|
||||
userPhotoDTOList.add(photoPd);
|
||||
param.put("userPhotoDTOList", userPhotoDTOList);
|
||||
String userResult = HttpClientUtilDoGet.sendHttpGet(tongBuUrl + "/docking/core/user/getUserInfoById" + "?USER_ID=" + pd.getString("USER_ID"));
|
||||
Map<String, Object> userReturnMap = (Map<String, Object>) JSON.parse(userResult);
|
||||
if (userReturnMap.get("USERINFO") != null) { //有用户数据获取修改信息
|
||||
PageData userInfoPd = JSON.parseObject(userReturnMap.get("USERINFO").toString(), PageData.class);
|
||||
String updateDescription = UpdateEnum.getUpdateDescription(userInfoPd, pd);
|
||||
param.put("REMARKS", updateDescription);
|
||||
|
||||
} else { //没有数据则获取新增信息
|
||||
String insertDescription = UpdateEnum.getInsertDescription(pd);
|
||||
param.put("REMARKS", insertDescription);
|
||||
}
|
||||
String UserDto = JSON.toJSONString(param);
|
||||
String result = HttpClientUtilDoGet.sendHttpPost(tongBuUrl + "/docking/core/user/addOrUpdate", UserDto, null);
|
||||
Map<String, String> returnMap = (Map<String, String>) JSON.parse(result);
|
||||
if (returnMap.get("result").equals("success")) {
|
||||
PageData pushPd = new PageData();
|
||||
pushPd.put("ISPUSH", "1");
|
||||
if (!Tools.isEmpty(pd.get("operateType")) && pd.getString("operateType").equals("delete")) {
|
||||
pushPd.put("ISDELETE", "1");
|
||||
} else {
|
||||
pushPd.put("ISDELETE", "0");
|
||||
}
|
||||
pushPd.put("USER_ID", pd.getString("USER_ID"));
|
||||
usersService.editPushStatus(pushPd);
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -391,19 +391,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<!-- 修改 -->
|
||||
<update id="editUser" parameterType="pd" >
|
||||
update <include refid="tableName"></include>
|
||||
set NAME = #{NAME},
|
||||
DEPARTMENT_ID = #{DEPARTMENT_ID},
|
||||
POST_ID =#{POST_ID},
|
||||
ROLE_ID = #{ROLE_ID},
|
||||
ROLE_IDS = #{ROLE_IDS},
|
||||
BZ = #{BZ},
|
||||
EMAIL = #{EMAIL},
|
||||
NUMBER = #{NUMBER},
|
||||
SORT = #{SORT},
|
||||
PERSON_TYPE = #{PERSON_TYPE},
|
||||
IS_HAZARDCONFIRMER = #{IS_HAZARDCONFIRMER},
|
||||
IS_ONLINELEARNING = #{IS_ONLINELEARNING},
|
||||
PHONE = #{PHONE}
|
||||
set
|
||||
<if test="NAME != null and NAME != ''">
|
||||
NAME = #{NAME}
|
||||
</if>
|
||||
<if test="DEPARTMENT_ID != null and DEPARTMENT_ID != ''">
|
||||
,DEPARTMENT_ID = #{DEPARTMENT_ID}
|
||||
</if>
|
||||
<if test="POST_ID != null and POST_ID != ''">
|
||||
,POST_ID = #{POST_ID}
|
||||
</if>
|
||||
<if test="ROLE_ID != null and ROLE_ID != ''">
|
||||
,ROLE_ID = #{ROLE_ID}
|
||||
</if>
|
||||
<if test="ROLE_IDS != null and ROLE_IDS != ''">
|
||||
,ROLE_IDS = #{ROLE_IDS}
|
||||
</if>
|
||||
<if test="BZ != null and BZ != ''">
|
||||
,BZ = #{BZ}
|
||||
</if>
|
||||
<if test="EMAIL != null and EMAIL != ''">
|
||||
,EMAIL = #{EMAIL}
|
||||
</if>
|
||||
<if test="NUMBER != null and NUMBER != ''">
|
||||
,NUMBER = #{NUMBER}
|
||||
</if>
|
||||
<if test="SORT != null">
|
||||
,SORT = #{SORT}
|
||||
</if>
|
||||
<if test="PERSON_TYPE != null and PERSON_TYPE != ''">
|
||||
,PERSON_TYPE = #{PERSON_TYPE}
|
||||
</if>
|
||||
<if test="IS_HAZARDCONFIRMER != null and IS_HAZARDCONFIRMER != ''">
|
||||
,IS_HAZARDCONFIRMER = #{IS_HAZARDCONFIRMER}
|
||||
</if>
|
||||
<if test="IS_ONLINELEARNING != null and IS_ONLINELEARNING != ''">
|
||||
,IS_ONLINELEARNING = #{IS_ONLINELEARNING}
|
||||
</if>
|
||||
<if test="PHONE != null and PHONE != ''">
|
||||
,PHONE = #{PHONE}
|
||||
</if>
|
||||
<if test="ISPUSH != null and ISPUSH != ''">
|
||||
,ISPUSH = #{ISPUSH}
|
||||
</if>
|
||||
|
@ -770,17 +797,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<!-- 用户列表(全部) -->
|
||||
<select id="listAllUser" parameterType="pd" resultType="pd" >
|
||||
select u.USER_ID,
|
||||
u.USERNAME,
|
||||
u.PASSWORD,
|
||||
u.LAST_LOGIN,
|
||||
u.NAME,
|
||||
u.IP,
|
||||
u.EMAIL,
|
||||
u.NUMBER,
|
||||
u.PHONE,
|
||||
select u.*,
|
||||
r.ROLE_ID,
|
||||
u.DEPARTMENT_ID,
|
||||
|
||||
o.NAME as PID_NAME,
|
||||
o.PARENT_ID,
|
||||
d.NAME as DEPARTMENT_NAME,
|
||||
|
@ -791,6 +810,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
left join OA_DEPARTMENT o ON o.DEPARTMENT_ID = d.PARENT_ID
|
||||
where u.ROLE_ID = r.ROLE_ID
|
||||
and u.USERNAME != 'admin' and u.ISDELETE = '0'
|
||||
and (u.ISPUSH != '1' or u.ISPUSH is null)
|
||||
<!-- and r.PARENT_ID = '1' -->
|
||||
<if test="KEYWORDS != null and KEYWORDS != ''"><!-- 关键词检索 -->
|
||||
and
|
||||
|
|
Loading…
Reference in New Issue