diff --git a/src/main/java/com/zcloud/controller/system/UsersController.java b/src/main/java/com/zcloud/controller/system/UsersController.java index eb1a0721..546cb06a 100644 --- a/src/main/java/com/zcloud/controller/system/UsersController.java +++ b/src/main/java/com/zcloud/controller/system/UsersController.java @@ -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 = 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 param = new HashMap<>(); + Set set = pd.keySet(); + for (Object key : set) { + param.put(key.toString(), pd.getString(key.toString())); + } + + + //要推送的照片集合 + List 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 userReturnMap = (Map) 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 returnMap = (Map) 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; + } } diff --git a/src/main/resources/mybatis/datasource/system/UsersMapper.xml b/src/main/resources/mybatis/datasource/system/UsersMapper.xml index e7625a89..1b0a68d3 100644 --- a/src/main/resources/mybatis/datasource/system/UsersMapper.xml +++ b/src/main/resources/mybatis/datasource/system/UsersMapper.xml @@ -391,19 +391,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update - 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 + + 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} + ,ISPUSH = #{ISPUSH} @@ -770,17 +797,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"