From a4174fafaa8d1509bade8815b3707d3f393b83f4 Mon Sep 17 00:00:00 2001 From: water_xu Date: Wed, 24 Jul 2024 08:41:20 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E4=BA=BA=E5=91=98=E4=B8=AD=E5=8F=B0?= =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/system/UsersController.java | 588 +++++++++++------- src/main/java/com/zcloud/dto/UpdateEnum.java | 83 +++ .../mapper/datasource/system/UsersMapper.java | 2 + .../zcloud/service/system/UsersService.java | 2 + .../service/system/impl/UsersServiceImpl.java | 8 + .../com/zcloud/util/HttpClientUtilDoGet.java | 224 +++++++ src/main/java/com/zcloud/util/Tools.java | 10 + src/main/resources/application-dev.properties | 1 + .../mybatis/datasource/system/UsersMapper.xml | 125 +++- 9 files changed, 808 insertions(+), 235 deletions(-) create mode 100644 src/main/java/com/zcloud/dto/UpdateEnum.java create mode 100644 src/main/java/com/zcloud/util/HttpClientUtilDoGet.java diff --git a/src/main/java/com/zcloud/controller/system/UsersController.java b/src/main/java/com/zcloud/controller/system/UsersController.java index 65116ec6..c7382ac9 100644 --- a/src/main/java/com/zcloud/controller/system/UsersController.java +++ b/src/main/java/com/zcloud/controller/system/UsersController.java @@ -6,6 +6,8 @@ import java.util.*; import javax.servlet.http.HttpServletResponse; +import com.alibaba.fastjson.JSON; +import com.zcloud.dto.UpdateEnum; import com.zcloud.entity.system.Dictionaries; import com.zcloud.entity.system.User; import com.zcloud.service.bus.*; @@ -19,6 +21,7 @@ import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.crypto.hash.SimpleHash; import org.hyperic.sigar.pager.PageList; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.RequestMapping; @@ -77,6 +80,8 @@ public class UsersController extends BaseController { private UserExamineService userExamineService; @Autowired private DictionariesService dictionariesService; + @Value("${tongbu.url}") + private String tongBuUrl; /** * 进入权限首页 @@ -421,6 +426,14 @@ public class UsersController extends BaseController { userCerList = imgfilesService.listAll(userCerPd); pd.putAll(userInfo); } + List face_file = new ArrayList<>(); + if (null != userInfo) { + PageData userCerPd = new PageData(); + userCerPd.put("TYPE", "30"); + userCerPd.put("FOREIGN_KEY", pd.get("USER_ID")); + face_file = imgfilesService.listAll(userCerPd); + pd.putAll(userInfo); + } //获取岗位下拉 PageData post = new PageData(); post.put("DEPARTMENT_ID", ZDEPARTMENT_ID); @@ -432,6 +445,7 @@ public class UsersController extends BaseController { map.put("periodStr", shiftDutyPeriod.getString("DURATION") + ',' + shiftDutyPeriod.getString("WORKSTATUS") + ',' + shiftDutyPeriod.getString("WORKPERIOD")); map.put("licenseinfor", pd1); map.put("userCerList", userCerList); + map.put("face_file", face_file); map.put("roleList", roleList); map.put("result", errInfo); return map; @@ -524,18 +538,6 @@ public class UsersController extends BaseController { PageData pd = new PageData(); pd = this.getPageData(); -// if(pd.get("USERAVATARURL")!=null && !pd.getString("USERAVATARURL").equals("")){ -// System.out.println("USERAVATARURL原长度:"+pd.getString("USERAVATARURL").length()); -// String USERAVATARURL64 = ImageAnd64Binary.zipBase64(pd.getString("USERAVATARURL")); -// System.out.println("USERAVATARURL压缩长度:"+USERAVATARURL64.length()); -//// try{ -//// FaceUtil.compareFace(pd.getString("USERAVATARURL"),pd.getString("USERAVATARURL")); -//// }catch (Exception e){ -//// map.put("result", "Error"); -//// map.put("msg", "人脸图像不符合要求 请重新上传!"); -//// return map; -//// } -// } FHLOG.save(Jurisdiction.getUsername(), "从系统用户中修改" + pd.getString("USERNAME") + "的资料"); //记录日志 if (!Jurisdiction.getUsername().equals(pd.getString("USERNAME"))) { //如果当前登录用户修改用户资料提交的用户名非本人 if ("admin".equals(pd.getString("USERNAME")) && !"admin".equals(Jurisdiction.getUsername())) { @@ -547,9 +549,6 @@ public class UsersController extends BaseController { pd.put("ROLE_ID", upd.getString("ROLE_ID")); //对角色ID还原本人角色ID pd.put("ROLE_IDS", Tools.notEmpty(upd.getString("ROLE_IDS")) ? upd.get("ROLE_IDS") : ""); //对角色ID还原本人副职角色ID } -// if(pd.getString("PASSWORD") != null && !"".equals(pd.getString("PASSWORD"))){ -// pd.put("PASSWORD", new SimpleHash("SHA-1", pd.getString("USERNAME"), pd.getString("PASSWORD")).toString()); -// } if (!Tools.isEmpty(pd.getString("ROLE_ID"))) { if (pd.getString("ROLE_ID").contains(",")) { String roleId = pd.getString("ROLE_ID").substring(0, pd.getString("ROLE_ID").indexOf(","));//截取第一个,之前的数据 @@ -575,6 +574,9 @@ public class UsersController extends BaseController { if (Tools.notEmpty(pd.getString("CARDNO"))) { usersService.resetCardNo(pd); } + //每次人员信息更改都要将人物状态置为未推送且不可查询,需推送后在进行使用 + pd.put("ISDELETE","1"); + pd.put("ISPUSH","0"); usersService.editUser(pd); //执行修改 if ("true".equals(pd.getString("ISSTUDENT"))) { pd.put("IS_ONLINELEARNING", "1"); @@ -610,6 +612,9 @@ public class UsersController extends BaseController { } userInfoService.delete(pd); userInfoService.save(pd); + } else { + userInfoService.delete(pd); + userInfoService.save(pd); } if (null == licenseInforService.findById(pd)) { if (pd.getString("PERSON_TYPE") != null) { @@ -627,16 +632,6 @@ public class UsersController extends BaseController { if (pd.getString("INFORWORKValue") != null || !(pd.getString("INFORWORKValue") == "")) { pd.put("INFORWORK", pd.getString("INFORWORKValue")); } -// if("select".equals(pd.getString("letDutiesType"))){ -// pd.put("TYPE_OF_WORK",pd.getString("TYPE_OF_WORK")); -// }else{ -// PageData dicPd = new PageData(); -// dicPd.put("PARENT_ID","09e36ac01e9540f8bc84eab1c1a78754"); -// dicPd.put("BIANMA","zhiwu"); -// dicPd.put("NAME",pd.getString("INFORPOSTValue")); -// dicPd = dictionariesCorpService.saveByZidongxinzeng(dicPd); -// pd.put("TYPE_OF_WORK",dicPd.getString("DICTIONARIES_ID")); -// } if (Tools.notEmpty(pd.getString("INFORPOSTValue"))) { if ("select".equals(pd.getString("letDutiesType"))) { PageData dicPd = new PageData(); @@ -777,7 +772,10 @@ public class UsersController extends BaseController { } } } - + System.out.println(pd.getString("isUpdateFace")); + if (pd.getString("isUpdateFace").equals("1")) { //若修改了人脸图片 + imgfilesService.delete(pd); //删除旧人脸图片 + } map.put("result", errInfo); return map; } @@ -898,7 +896,7 @@ public class UsersController extends BaseController { @RequiresPermissions("user:add") @ResponseBody public Object saveUser() throws Exception { - Map map = new HashMap(); + Map map = new HashMap<>(); String errInfo = "success"; PageData pd = new PageData(); pd = this.getPageData(); @@ -908,107 +906,122 @@ public class UsersController extends BaseController { pd.put("IP", ""); //IP pd.put("STATUS", "0"); //状态 pd.put("ISMAIN", "0"); //状态 - pd.put("ISDELETE", "0"); //是否删除,0表示不删除 + pd.put("ISDELETE", "1"); //是否删除,0表示不删除 pd.put("SKIN", "pcoded-navbar navbar-image-3,navbar pcoded-header navbar-expand-lg navbar-light header-dark,"); //用户默认皮肤 pd.put("PASSWORD", new SimpleHash("SHA-1", pd.getString("USERNAME"), pd.getString("PASSWORD")).toString()); //密码加密 pd.put("CORPINFO_ID", Jurisdiction.getCORPINFO_ID()); - if (null == usersService.findByUsername(pd)) { //判断用户名是否存在 - if (pd.getString("ROLE_ID").contains(",")) { - String roleId = pd.getString("ROLE_ID").substring(0, pd.getString("ROLE_ID").indexOf(","));//截取第一个,之前的数据 - String roleIds = pd.getString("ROLE_ID").substring(roleId.length() + 1, pd.getString("ROLE_ID").length());//截取第一个,之后的数据 - pd.put("ROLE_ID", roleId); - pd.put("ROLE_IDS", roleIds); - } - if ("true".equals(pd.getString("ISSTUDENT"))) { - pd.put("IS_ONLINELEARNING", '1'); - } - // todo - // 定位卡号 规则 如果俩个人使用同一一个卡号,最后一个人会是这个卡号。保证一个卡号一个人用。(11.28) - // 不同的公司,它定位卡的配置方案是不一样的,就你像九公司,九公司的卡是随机的。就他不是卡跟着人走,他就一天一变。 目前暂定这样 - if (Tools.notEmpty(pd.getString("CARDNO"))) { - usersService.resetCardNo(pd); - }else { - pd.put("CARDNO",null); - } - usersService.saveUser(pd); - //执行保存 - if ("true".equals(pd.getString("ISSTUDENT"))) { - pd.put("IS_ONLINELEARNING", '1'); - if ("select".equals(pd.getString("letDutiesType"))) { - pd.put("DUTIES", pd.getString("DUTIES")); - } else { - PageData dicPd = new PageData(); - dicPd.put("PARENT_ID", "09e36ac01e9540f8bc84eab1c1a78754"); - dicPd.put("BIANMA", "zhiwu"); - dicPd.put("NAME", pd.getString("DUTIESValue")); - dicPd = dictionariesCorpService.saveByZidongxinzeng(dicPd); - pd.put("DUTIES", dicPd.getString("DICTIONARIES_ID")); - } - if ("select".equals(pd.getString("letTitleType"))) { - pd.put("TITLE", pd.getString("TITLE")); - } else { - PageData dicPd = new PageData(); - dicPd.put("PARENT_ID", "945a6b10e59946078b500f0fbafa8679"); - dicPd.put("BIANMA", "zhicheng"); - dicPd.put("NAME", pd.getString("letTitleValue")); - dicPd = dictionariesCorpService.saveByZidongxinzeng(dicPd); - pd.put("TITLE", dicPd.getString("DICTIONARIES_ID")); - } - if ("select".equals(pd.getString("letTypeOfWorkType"))) { - pd.put("TYPE_OF_WORK", pd.getString("TYPE_OF_WORK")); - } else { - PageData dicPd = new PageData(); - dicPd.put("PARENT_ID", "55484e491a5e442d839c4595380713ec"); - dicPd.put("BIANMA", "gongzhong"); - dicPd.put("NAME", pd.getString("letTypeOfWorkValue")); - dicPd = dictionariesCorpService.saveByZidongxinzeng(dicPd); - pd.put("TYPE_OF_WORK", dicPd.getString("DICTIONARIES_ID")); - } - userInfoService.save(pd); - } - String PERSON_TYPE = pd.getString("PERSONNEL_TYPE"); - if (pd.getString("PERSON_TYPE").equals("主要负责人") || pd.getString("PERSON_TYPE").equals("安全管理人员") || pd.getString("PERSON_TYPE").equals("特种作业人员")) { - if ("select".equals(pd.getString("inforpostType"))) { - pd.put("INFORPOST", pd.getString("INFORPOST")); - } else { - PageData dicPd = new PageData(); - dicPd.put("PARENT_ID", "09e36ac01e9540f8bc84eab1c1a78754"); - dicPd.put("BIANMA", "zhiwu"); - dicPd.put("NAME", pd.getString("INFORPOSTValue")); - dicPd = dictionariesCorpService.saveByZidongxinzeng(dicPd); - pd.put("INFORPOST", dicPd.getString("DICTIONARIES_ID")); - } - if ("select".equals(pd.getString("infortitleType"))) { - pd.put("INFORTITLE", pd.getString("INFORTITLE")); - } else { - PageData dicPd = new PageData(); - dicPd.put("PARENT_ID", "945a6b10e59946078b500f0fbafa8679"); - dicPd.put("BIANMA", "zhicheng"); - dicPd.put("NAME", pd.getString("INFORTITLEValue")); - dicPd = dictionariesCorpService.saveByZidongxinzeng(dicPd); - pd.put("INFORTITLE", dicPd.getString("DICTIONARIES_ID")); - } - if ("select".equals(pd.getString("inforworkType"))) { - pd.put("INFORWORK", pd.getString("INFORWORK")); - } else { - PageData dicPd = new PageData(); - dicPd.put("PARENT_ID", "55484e491a5e442d839c4595380713ec"); - dicPd.put("BIANMA", "gongzhong"); - dicPd.put("NAME", pd.getString("INFORWORKValue")); - dicPd = dictionariesCorpService.saveByZidongxinzeng(dicPd); - pd.put("INFORWORK", dicPd.getString("DICTIONARIES_ID")); - } - pd.put("INFOR_ID", this.get32UUID()); - pd.put("USER_ID", ID); - licenseInforService.save(pd); //保存用户证照信息 + pd.put("ISPUSH", "0"); + Map resultMap = doCheck(pd.getString("USERNAME"), pd.getString("USER_ID_CARD"), ""); + if (resultMap.get("result").equals("success")) { + if (null == usersService.findByUsername(pd)) { //判断用户名是否存在 + if (pd.getString("ROLE_ID").contains(",")) { + String roleId = pd.getString("ROLE_ID").substring(0, pd.getString("ROLE_ID").indexOf(","));//截取第一个,之前的数据 + String roleIds = pd.getString("ROLE_ID").substring(roleId.length() + 1, pd.getString("ROLE_ID").length());//截取第一个,之后的数据 + pd.put("ROLE_ID", roleId); + pd.put("ROLE_IDS", roleIds); + } + if ("true".equals(pd.getString("ISSTUDENT"))) { + pd.put("IS_ONLINELEARNING", '1'); + } + // todo + // 定位卡号 规则 如果俩个人使用同一一个卡号,最后一个人会是这个卡号。保证一个卡号一个人用。(11.28) + // 不同的公司,它定位卡的配置方案是不一样的,就你像九公司,九公司的卡是随机的。就他不是卡跟着人走,他就一天一变。 目前暂定这样 + if (Tools.notEmpty(pd.getString("CARDNO"))) { + usersService.resetCardNo(pd); + }else { + pd.put("CARDNO",null); + } + usersService.saveUser(pd); + //执行保存 + if ("true".equals(pd.getString("ISSTUDENT"))) { + pd.put("IS_ONLINELEARNING", '1'); + if ("select".equals(pd.getString("letDutiesType"))) { + pd.put("DUTIES", pd.getString("DUTIES")); + } else { + PageData dicPd = new PageData(); + dicPd.put("PARENT_ID", "09e36ac01e9540f8bc84eab1c1a78754"); + dicPd.put("BIANMA", "zhiwu"); + dicPd.put("NAME", pd.getString("DUTIESValue")); + dicPd = dictionariesCorpService.saveByZidongxinzeng(dicPd); + pd.put("DUTIES", dicPd.getString("DICTIONARIES_ID")); + } + if ("select".equals(pd.getString("letTitleType"))) { + pd.put("TITLE", pd.getString("TITLE")); + } else { + PageData dicPd = new PageData(); + dicPd.put("PARENT_ID", "945a6b10e59946078b500f0fbafa8679"); + dicPd.put("BIANMA", "zhicheng"); + dicPd.put("NAME", pd.getString("letTitleValue")); + dicPd = dictionariesCorpService.saveByZidongxinzeng(dicPd); + pd.put("TITLE", dicPd.getString("DICTIONARIES_ID")); + } + if ("select".equals(pd.getString("letTypeOfWorkType"))) { + pd.put("TYPE_OF_WORK", pd.getString("TYPE_OF_WORK")); + } else { + PageData dicPd = new PageData(); + dicPd.put("PARENT_ID", "55484e491a5e442d839c4595380713ec"); + dicPd.put("BIANMA", "gongzhong"); + dicPd.put("NAME", pd.getString("letTypeOfWorkValue")); + dicPd = dictionariesCorpService.saveByZidongxinzeng(dicPd); + pd.put("TYPE_OF_WORK", dicPd.getString("DICTIONARIES_ID")); + } + } else { + userInfoService.save(pd); + } + String PERSON_TYPE = pd.getString("PERSONNEL_TYPE"); + if (pd.getString("PERSON_TYPE").equals("主要负责人") || pd.getString("PERSON_TYPE").equals("安全管理人员") || pd.getString("PERSON_TYPE").equals("特种作业人员")) { + if ("select".equals(pd.getString("inforpostType"))) { + pd.put("INFORPOST", pd.getString("INFORPOST")); + } else { + PageData dicPd = new PageData(); + dicPd.put("PARENT_ID", "09e36ac01e9540f8bc84eab1c1a78754"); + dicPd.put("BIANMA", "zhiwu"); + dicPd.put("NAME", pd.getString("INFORPOSTValue")); + dicPd = dictionariesCorpService.saveByZidongxinzeng(dicPd); + pd.put("INFORPOST", dicPd.getString("DICTIONARIES_ID")); + } + if ("select".equals(pd.getString("infortitleType"))) { + pd.put("INFORTITLE", pd.getString("INFORTITLE")); + } else { + PageData dicPd = new PageData(); + dicPd.put("PARENT_ID", "945a6b10e59946078b500f0fbafa8679"); + dicPd.put("BIANMA", "zhicheng"); + dicPd.put("NAME", pd.getString("INFORTITLEValue")); + dicPd = dictionariesCorpService.saveByZidongxinzeng(dicPd); + pd.put("INFORTITLE", dicPd.getString("DICTIONARIES_ID")); + } + if ("select".equals(pd.getString("inforworkType"))) { + pd.put("INFORWORK", pd.getString("INFORWORK")); + } else { + PageData dicPd = new PageData(); + dicPd.put("PARENT_ID", "55484e491a5e442d839c4595380713ec"); + dicPd.put("BIANMA", "gongzhong"); + dicPd.put("NAME", pd.getString("INFORWORKValue")); + dicPd = dictionariesCorpService.saveByZidongxinzeng(dicPd); + pd.put("INFORWORK", dicPd.getString("DICTIONARIES_ID")); + } + pd.put("INFOR_ID", this.get32UUID()); + pd.put("USER_ID", ID); + licenseInforService.save(pd); //保存用户证照信息 + } + //封装调用参数 + + } else { + map.put("result", "Error"); + map.put("msg", "用户名重复"); + return map; } + FHLOG.save(Jurisdiction.getUsername(), "新增用户:" + pd.getString("USERNAME")); //记录日志 + PageData userPd = new PageData(); + userPd.put("USER_ID",ID); + PageData userinfo = usersService.findById(userPd); + userinfo.put("ISDELETE","0"); + map.put("USERINFO", userinfo); + map.put("USER_ID",ID); + map.put("result", errInfo); //返回结果 } else { - map.put("result", "Error"); - map.put("msg", "用户名重复"); - return map; + map.put("result", "您输入的身份证号和用户名二次校验失败,请确认后重新申请"); //返回结果 } - FHLOG.save(Jurisdiction.getUsername(), "新增用户:" + pd.getString("USERNAME")); //记录日志 - map.put("result", errInfo); //返回结果 return map; } @@ -1025,113 +1038,128 @@ public class UsersController extends BaseController { PageData pd = new PageData(); String errInfo = "success"; pd = this.getPageData(); - FHLOG.save(Jurisdiction.getUsername(), "删除用户ID:" + pd.getString("USER_ID")); //记录日志 - usersService.deleteUser(pd); //删除用户 - ueditorService.delete(pd); //删除副文本关联数据 + Map returnMap = null; + if (pd.getString("ISPUSH").equals("1")) { + pd.put("ISDELETE","1"); + HashMap param = new HashMap<>(); + Set set = pd.keySet(); + for (Object key : set) { + param.put(key.toString(),pd.getString(key.toString())); + } + String UserDto = JSON.toJSONString(param); + String result = HttpClientUtilDoGet.sendHttpPost(tongBuUrl + "/docking/core/user/addOrUpdate", UserDto,param); + returnMap = (Map) JSON.parse(result); + } - List listIds = listManagerService.listListByUser(pd); - if (listIds != null && listIds.size() > 0) { - for (PageData listPd : listIds) { - PageData pd1 = new PageData(); - pd1.put("OPERATOR", Jurisdiction.getUsername()); //修改人 - pd1.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 - pd1.put("LISTMANAGER_ID", listPd.get("LISTMANAGER_ID")); - listManagerService.remove(pd1); - pd1 = listManagerService.findById(pd1); - if (pd1.get("TYPE") != null && Tools.notEmpty(pd1.get("TYPE").toString())) { - if ("listType0005".equals(pd1.get("TYPE").toString())) { - pd1.put("LISTSTATISTICS_ID", this.get32UUID()); //主键 - pd1.put("STARTTIME", pd1.get("START_DATE").toString() + " 00:00:00"); - pd1.put("ENDTIME", pd1.get("END_DATE").toString() + " 23:59:59"); - pd1.put("PERIOD", null); - PageData statistics = listStatisticsService.findByCondition(pd1); - if (statistics != null && statistics.get("LISTSTATISTICS_ID") != null) { - statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString()) - 2); - listStatisticsService.edit(statistics); - } - pd1.put("ISSTATISTICS", '0'); - // 本期已检查的不计入统计 - checkrecordService.editStatistics(pd1); - } else { - if (pd1.get("PERIOD") != null && Tools.notEmpty(pd1.get("PERIOD").toString())) { - String period = pd1.get("PERIOD").toString(); - switch (period) { - case "checkPeriod0001"://每日 - pd1.put("STARTTIME", DateUtil.getDay() + " 00:00:00"); - pd1.put("ENDTIME", DateUtil.getDay() + " 23:59:59"); - break; - - case "checkPeriod0002"://每周 - pd1.put("STARTTIME", DateUtil.getWeekStart()); - pd1.put("ENDTIME", DateUtil.getWeekEnd()); - break; - - case "checkPeriod0003"://每旬 - String year = DateUtil.getYear().toString(); - String month = DateUtil.getMonth().toString(); - Integer day = Integer.parseInt(DateUtil.getOnlyDay().toString()); - String startTime = year + "-" + month + "-"; - String endTime = year + "-" + month + "-"; - if (day <= 10) { - startTime = startTime + "01 00:00:00"; - endTime = endTime + "10 23:59:59"; - } else if (day > 10 && day <= 20) { - startTime = startTime + "11 00:00:00"; - endTime = endTime + "20 23:59:59"; - } else { - startTime = startTime + "21 00:00:00"; - endTime = DateUtil.getMonthEndDay() + " 23:59:59"; - } - pd1.put("STARTTIME", startTime); - pd1.put("ENDTIME", endTime); - break; - - case "checkPeriod0004"://每月 - pd1.put("STARTTIME", DateUtil.getMonthFirstDay() + " 00:00:00"); - pd1.put("ENDTIME", DateUtil.getMonthEndDay() + " 23:59:59"); - break; - - case "checkPeriod0005"://每季 - pd1.put("STARTTIME", DateUtil.quarterStart() + " 00:00:00"); - pd1.put("ENDTIME", DateUtil.quarterEnd() + " 23:59:59"); - break; - - case "checkPeriod0006"://每年 - pd1.put("STARTTIME", DateUtil.getCurrYearFirst() + " 00:00:00"); - pd1.put("ENDTIME", DateUtil.getCurrYearLast() + " 23:59:59"); - break; - - case "checkPeriod0007"://半年 - String byear = DateUtil.getYear().toString(); - Integer bmonth = Integer.parseInt(DateUtil.getMonth().toString()); - if (bmonth <= 6) { - pd1.put("STARTTIME", byear + "-01-01 00:00:00"); - pd1.put("ENDTIME", byear + "-06-30 23:59:59"); - } else if (bmonth > 6) { - pd1.put("STARTTIME", byear + "-07-01 00:00:00"); - pd1.put("ENDTIME", byear + "-12-31 23:59:59"); - } - break; - - default: - break; + if (pd.getString("ISPUSH").equals("0") || returnMap.get("result").equals("success")) { + FHLOG.save(Jurisdiction.getUsername(), "删除用户ID:" + pd.getString("USER_ID")); //记录日志 + usersService.deleteUser(pd); //删除用户 + ueditorService.delete(pd); //删除副文本关联数据 + List listIds = listManagerService.listListByUser(pd); + if (listIds != null && listIds.size() > 0) { + for (PageData listPd : listIds) { + PageData pd1 = new PageData(); + pd1.put("OPERATOR", Jurisdiction.getUsername()); //修改人 + pd1.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + pd1.put("LISTMANAGER_ID", listPd.get("LISTMANAGER_ID")); + listManagerService.remove(pd1); + pd1 = listManagerService.findById(pd1); + if (pd1.get("TYPE") != null && Tools.notEmpty(pd1.get("TYPE").toString())) { + if ("listType0005".equals(pd1.get("TYPE").toString())) { + pd1.put("LISTSTATISTICS_ID", this.get32UUID()); //主键 + pd1.put("STARTTIME", pd1.get("START_DATE").toString() + " 00:00:00"); + pd1.put("ENDTIME", pd1.get("END_DATE").toString() + " 23:59:59"); + pd1.put("PERIOD", null); + PageData statistics = listStatisticsService.findByCondition(pd1); + if (statistics != null && statistics.get("LISTSTATISTICS_ID") != null) { + statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString()) - 2); + listStatisticsService.edit(statistics); } - } - PageData statistics = listStatisticsService.findByCondition(pd1); - if (statistics != null && statistics.get("LISTSTATISTICS_ID") != null) { - statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString()) - 1); - listStatisticsService.edit(statistics); - } + pd1.put("ISSTATISTICS", '0'); + // 本期已检查的不计入统计 + checkrecordService.editStatistics(pd1); + } else { + if (pd1.get("PERIOD") != null && Tools.notEmpty(pd1.get("PERIOD").toString())) { + String period = pd1.get("PERIOD").toString(); + switch (period) { + case "checkPeriod0001"://每日 + pd1.put("STARTTIME", DateUtil.getDay() + " 00:00:00"); + pd1.put("ENDTIME", DateUtil.getDay() + " 23:59:59"); + break; - pd1.put("ISSTATISTICS", '0'); - // 本期已检查的不计入统计 - checkrecordService.editStatistics(pd1); + case "checkPeriod0002"://每周 + pd1.put("STARTTIME", DateUtil.getWeekStart()); + pd1.put("ENDTIME", DateUtil.getWeekEnd()); + break; + + case "checkPeriod0003"://每旬 + String year = DateUtil.getYear().toString(); + String month = DateUtil.getMonth().toString(); + Integer day = Integer.parseInt(DateUtil.getOnlyDay().toString()); + String startTime = year + "-" + month + "-"; + String endTime = year + "-" + month + "-"; + if (day <= 10) { + startTime = startTime + "01 00:00:00"; + endTime = endTime + "10 23:59:59"; + } else if (day > 10 && day <= 20) { + startTime = startTime + "11 00:00:00"; + endTime = endTime + "20 23:59:59"; + } else { + startTime = startTime + "21 00:00:00"; + endTime = DateUtil.getMonthEndDay() + " 23:59:59"; + } + pd1.put("STARTTIME", startTime); + pd1.put("ENDTIME", endTime); + break; + + case "checkPeriod0004"://每月 + pd1.put("STARTTIME", DateUtil.getMonthFirstDay() + " 00:00:00"); + pd1.put("ENDTIME", DateUtil.getMonthEndDay() + " 23:59:59"); + break; + + case "checkPeriod0005"://每季 + pd1.put("STARTTIME", DateUtil.quarterStart() + " 00:00:00"); + pd1.put("ENDTIME", DateUtil.quarterEnd() + " 23:59:59"); + break; + + case "checkPeriod0006"://每年 + pd1.put("STARTTIME", DateUtil.getCurrYearFirst() + " 00:00:00"); + pd1.put("ENDTIME", DateUtil.getCurrYearLast() + " 23:59:59"); + break; + + case "checkPeriod0007"://半年 + String byear = DateUtil.getYear().toString(); + Integer bmonth = Integer.parseInt(DateUtil.getMonth().toString()); + if (bmonth <= 6) { + pd1.put("STARTTIME", byear + "-01-01 00:00:00"); + pd1.put("ENDTIME", byear + "-06-30 23:59:59"); + } else if (bmonth > 6) { + pd1.put("STARTTIME", byear + "-07-01 00:00:00"); + pd1.put("ENDTIME", byear + "-12-31 23:59:59"); + } + break; + + default: + break; + } + } + PageData statistics = listStatisticsService.findByCondition(pd1); + if (statistics != null && statistics.get("LISTSTATISTICS_ID") != null) { + statistics.put("NOTEXAMINEDNUM", Integer.parseInt(statistics.get("NOTEXAMINEDNUM").toString()) - 1); + listStatisticsService.edit(statistics); + } + + pd1.put("ISSTATISTICS", '0'); + // 本期已检查的不计入统计 + checkrecordService.editStatistics(pd1); + } } } } + map.put("result", errInfo); //返回结果 + } else { + map.put("result", "error"); //返回结果 } - - map.put("result", errInfo); //返回结果 return map; } @@ -2429,4 +2457,120 @@ public class UsersController extends BaseController { return map; } + + /** + * 校验 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/goCheck") + @ResponseBody + public Object goCheck() throws Exception { + Map map = new HashMap(); + PageData pd = new PageData(); + pd = this.getPageData(); + HashMap param = new HashMap<>(); + param.put("USERNAME",pd.getString("USERNAME")); + param.put("CARD_NO",pd.getString("CARD_NO")); + if (!Tools.isEmpty(pd.get("USER_ID"))) { + param.put("USER_ID",pd.getString("USER_ID")); + } else { + param.put("USER_ID",""); + } + return doCheck(param.get("USERNAME"),param.get("CARD_NO"),param.get("USER_ID")); + } + + public Map doCheck(String USERNAME, String CARD_NO, String USER_ID) throws Exception { + String result = HttpClientUtilDoGet.sendHttpGet(tongBuUrl + "/docking/core/user/getCheck"+"?USERNAME="+USERNAME+"&CARD_NO="+CARD_NO+"&USER_ID="+USER_ID); + Map returnMap = (Map) JSON.parse(result); + return returnMap; + } + + /** + * 推送 + * + * @param + * @throws Exception + */ + @RequestMapping(value = "/goPush") + @ResponseBody + public Object goPush() throws Exception { + PageData pd = new PageData(); + pd = this.getPageData(); + pd.put("CREATTIME", DateUtil.date2Str(new Date())); //创建时间 + pd.put("CREATOR", Jurisdiction.getUSER_ID()); //创建人 + pd.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间 + pd.put("OPERATOR", Jurisdiction.getUSER_ID()); //修改人 + 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); + ORG_PATH.insert(0, department.getString("NAME")); + String deptId = department.getString("PARENT_ID"); + PageData deptPd = new PageData(); + deptPd.put("DEPARTMENT_ID",deptId); + if (!department.get("PARENT_ID").equals("0")) { + while (hasPid) { + PageData dept = departmentService.findById(deptPd); + if (dept.get("PARENT_ID").equals("0")) { + 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); + 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); + } + return returnMap; + } } diff --git a/src/main/java/com/zcloud/dto/UpdateEnum.java b/src/main/java/com/zcloud/dto/UpdateEnum.java new file mode 100644 index 00000000..cbcb3e50 --- /dev/null +++ b/src/main/java/com/zcloud/dto/UpdateEnum.java @@ -0,0 +1,83 @@ +package com.zcloud.dto; + +import com.zcloud.entity.PageData; +import com.zcloud.util.Tools; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +public enum UpdateEnum { +// USER_ID("USER_ID","USER_ID","用户ID"), + USERNAME("USERNAME","USERNAME","用户名"), + NAME("NAME","NAME","姓名"), +// CORPINFO_ID("CORPINFO_ID","CORPINFO_ID","单位ID"), + CORPINFO_NAME("CORPINFO_NAME","CORPINFO_NAME","单位名称"), + EMAIL("EMAIL","EMAIL","邮箱地址"), + CARD_TYPE("CARD_TYPE","CARD_TYPE","证件类型"), + CARD_TYPE_NAME("CARD_TYPE_NAME","CARD_TYPE_NAME","证件名称"), + CARD_NO("CARD_NO","CARD_NO","证件号码"), + NATION("NATION","NATION","民族"), + SEX("SEX","SEX","性别"), + ORG_PATH("ORG_PATH","ORG_PATH","组织路径"), + USER_TYPE("USER_TYPE","USER_TYPE","用户类型"), +// ISDELETE("ISDELETE","ISDELETE","是否删除"), +// CREATOR("CREATOR","CREATOR","创建人"), +// CREATTIME("CREATTIME","CREATTIME","创建时间"), +// OPERATOR("OPERATOR","OPERATOR","修改人"), +// OPERATTIME("OPERATTIME","OPERATTIME","修改时间"), +// DEPARTMENT_ID("DEPARTMENT_ID","DEPARTMENT_ID","部门ID"), + DEPARTMENT_NAME("DEPARTMENT_NAME","DEPARTMENT_NAME","部门名称"); + + private String enterpriseKey; //企业端字段 + + private String centerKey; //中台字段 + + private String name; //字段名称 + + public String getEnterpriseKey() { + return enterpriseKey; + } + + public String getName() { + return name; + } + + /** + * 提供修改前后的pd,根据提供参数自动提取修改描述 origin 为原值 target 为新值 + */ + public static String getUpdateDescription(PageData origin,PageData target) { + StringBuilder desc = new StringBuilder(); + for (UpdateEnum keyMap : values()) { + //获取key centerKey为从人员中台获取的旧数据key enterpriseKey为当前端要推送的新数据key + String centerKey = keyMap.getCenterKey(); + String enterpriseKey = keyMap.getEnterpriseKey(); + if (origin.containsKey(centerKey) && target.containsKey(enterpriseKey)) { + //取出源&目标值 + String originValue = origin.getString(centerKey); + String targetValue = target.getString(enterpriseKey); + if (!originValue.equals(targetValue)){ + desc.append(keyMap.getName()).append(": 由旧值\"").append(originValue).append("\"变为了\"").append(targetValue).append("\"; \n"); + } + } + } + return desc.toString(); + } + + /** + * 提供新增的数据 + */ + public static String getInsertDescription(PageData origin) { + StringBuilder remarks = new StringBuilder(); + for (UpdateEnum keyMap : values()) { + //获取key + String key = keyMap.getEnterpriseKey(); + if (origin.containsKey(key) && Tools.notEmpty(origin.getString(key))) { + //取出源&目标值 + String originValue = origin.getString(key); + remarks.append(keyMap.getName()).append(": 新增的值为\"").append(originValue).append("\"; \n"); + } + } + return remarks.toString(); + } +} diff --git a/src/main/java/com/zcloud/mapper/datasource/system/UsersMapper.java b/src/main/java/com/zcloud/mapper/datasource/system/UsersMapper.java index 5a9bcd9f..c47db93a 100644 --- a/src/main/java/com/zcloud/mapper/datasource/system/UsersMapper.java +++ b/src/main/java/com/zcloud/mapper/datasource/system/UsersMapper.java @@ -313,4 +313,6 @@ public interface UsersMapper { List listUserByDepId(PageData pd); List getDepartmentIds(@Param("departmentIds") String[] departmentIds); + + void editPushStatus(PageData pd); } diff --git a/src/main/java/com/zcloud/service/system/UsersService.java b/src/main/java/com/zcloud/service/system/UsersService.java index 43988460..6f338719 100644 --- a/src/main/java/com/zcloud/service/system/UsersService.java +++ b/src/main/java/com/zcloud/service/system/UsersService.java @@ -364,4 +364,6 @@ public interface UsersService { List listUserByDepId(PageData pd) throws Exception; List getDepartmentIds(String[] departmentIds) throws Exception; + + public void editPushStatus(PageData pd)throws Exception; } diff --git a/src/main/java/com/zcloud/service/system/impl/UsersServiceImpl.java b/src/main/java/com/zcloud/service/system/impl/UsersServiceImpl.java index c3c4e68e..107dc5a5 100644 --- a/src/main/java/com/zcloud/service/system/impl/UsersServiceImpl.java +++ b/src/main/java/com/zcloud/service/system/impl/UsersServiceImpl.java @@ -501,4 +501,12 @@ public class UsersServiceImpl implements UsersService { public List getDepartmentIds(String[] departmentIds) throws Exception { return usersMapper.getDepartmentIds(departmentIds); } + + /**修改用户 + * @param pd + * @throws Exception + */ + public void editPushStatus(PageData pd)throws Exception{ + usersMapper.editPushStatus(pd); + } } diff --git a/src/main/java/com/zcloud/util/HttpClientUtilDoGet.java b/src/main/java/com/zcloud/util/HttpClientUtilDoGet.java new file mode 100644 index 00000000..e8c3da04 --- /dev/null +++ b/src/main/java/com/zcloud/util/HttpClientUtilDoGet.java @@ -0,0 +1,224 @@ +package com.zcloud.util; + +import cn.hutool.core.collection.CollectionUtil; +import org.apache.commons.lang.StringUtils; +import org.apache.http.Consts; +import org.apache.http.HttpEntity; +import org.apache.http.client.config.RequestConfig; +import org.apache.http.client.entity.UrlEncodedFormEntity; +import org.apache.http.client.methods.*; +import org.apache.http.entity.StringEntity; +import org.apache.http.impl.client.CloseableHttpClient; +import org.apache.http.impl.client.HttpClients; +import org.apache.http.message.BasicNameValuePair; +import org.apache.http.util.EntityUtils; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public class HttpClientUtilDoGet { + private static final RequestConfig requestConfig = RequestConfig.custom() + .setSocketTimeout(60000) // 60s + .setConnectTimeout(10000) // 10s + .setConnectionRequestTimeout(10000) // 10s + .build(); + + + public static String sendHttpPost(String httpUrl, String body, Map header) { + HttpPost httpPost = new HttpPost(httpUrl); + try { + if (StringUtils.isNotEmpty(body)) { + StringEntity stringEntity = new StringEntity(body, "UTF-8"); + stringEntity.setContentType("application/json"); + httpPost.setEntity(stringEntity); + } + if (CollectionUtil.isNotEmpty(header)) { + for (Map.Entry entry : header.entrySet()) { + httpPost.addHeader(entry.getKey(), entry.getValue()); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return sendHttpPost(httpPost); + } + + private static String sendHttpPost(HttpPost httpPost) { + CloseableHttpClient httpClient = null; + CloseableHttpResponse response = null; + String responseContent = ""; + try { + httpClient = HttpClients.createDefault(); + httpPost.setConfig(requestConfig); + response = httpClient.execute(httpPost); + HttpEntity entity = response.getEntity(); + responseContent = EntityUtils.toString(entity, "UTF-8"); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (response != null) { + response.close(); + } + if (httpClient != null) { + httpClient.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + return responseContent; + } + + + public static String sendHttpPut(String httpUrl, String body, Map header) { + HttpPut httpPut = new HttpPut(httpUrl); + try { + if (StringUtils.isNotEmpty(body)) { + StringEntity stringEntity = new StringEntity(body, "UTF-8"); + stringEntity.setContentType("application/json"); + httpPut.setEntity(stringEntity); + } + if (CollectionUtil.isNotEmpty(header)) { + for (Map.Entry entry : header.entrySet()) { + httpPut.addHeader(entry.getKey(), entry.getValue()); + } + } + } catch (Exception e) { + e.printStackTrace(); + } + return sendHttpPut(httpPut); + } + + private static String sendHttpPut(HttpPut httpPut) { + CloseableHttpClient httpClient = null; + CloseableHttpResponse response = null; + String responseContent = ""; + try { + httpClient = HttpClients.createDefault(); + httpPut.setConfig(requestConfig); + response = httpClient.execute(httpPut); + HttpEntity entity = response.getEntity(); + responseContent = EntityUtils.toString(entity, "UTF-8"); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (response != null) { + response.close(); + } + if (httpClient != null) { + httpClient.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + return responseContent; + } + + + public static String sendHttpGet(String httpUrl, Map params, Map header) { + List list = new ArrayList<>(); + if (CollectionUtil.isNotEmpty(params)) { + for (Map.Entry entry : params.entrySet()) { + list.add(new BasicNameValuePair(entry.getKey(), entry.getValue())); + } + String paramStr = ""; + try { + paramStr = EntityUtils.toString(new UrlEncodedFormEntity(list, Consts.UTF_8)); + } catch (IOException e) { + e.printStackTrace(); + } + if (StringUtils.isNotEmpty(paramStr)) { + httpUrl = httpUrl + "?" + paramStr; + } + } + HttpGet httpGet = new HttpGet(httpUrl);// 创建get请求 + if (CollectionUtil.isNotEmpty(header)) { + for (Map.Entry entry : header.entrySet()) { + httpGet.addHeader(entry.getKey(), entry.getValue()); + } + } + return sendHttpGet(httpGet); + } + + public static String sendHttpGet(String httpUrl) { + HttpGet httpGet = new HttpGet(httpUrl);// 创建get请求 + return sendHttpGet(httpGet); + } + + private static String sendHttpGet(HttpGet httpGet) { + CloseableHttpClient httpClient = null; + CloseableHttpResponse response = null; + HttpEntity entity = null; + String responseContent = null; + try { + httpClient = HttpClients.createDefault(); + httpGet.setConfig(requestConfig); + response = httpClient.execute(httpGet); + entity = response.getEntity(); + responseContent = EntityUtils.toString(entity, "UTF-8"); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (response != null) { + response.close(); + } + if (httpClient != null) { + httpClient.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + if (StringUtils.isEmpty(responseContent)) { + System.out.println("responseContent is null"); + } + return responseContent; + } + + public static String sendHttpDelete(String httpUrl, Map header) { + HttpDelete httpDelete = new HttpDelete(httpUrl); + if (header != null && !header.isEmpty()) { + for (Map.Entry entry : header.entrySet()) { + httpDelete.addHeader(entry.getKey(), entry.getValue()); + } + } + return sendHttpDelete(httpDelete); + } + + private static String sendHttpDelete(HttpDelete httpDelete) { + CloseableHttpClient httpClient = null; + CloseableHttpResponse response = null; + HttpEntity entity = null; + String responseContent = null; + try { + httpClient = HttpClients.createDefault(); + httpDelete.setConfig(requestConfig); + response = httpClient.execute(httpDelete); + entity = response.getEntity(); + responseContent = EntityUtils.toString(entity, "UTF-8"); + } catch (Exception e) { + e.printStackTrace(); + } finally { + try { + if (response != null) { + response.close(); + } + if (httpClient != null) { + httpClient.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + if (StringUtils.isEmpty(responseContent)) { + System.out.println("responseContent is null"); + } + return responseContent; + } +} diff --git a/src/main/java/com/zcloud/util/Tools.java b/src/main/java/com/zcloud/util/Tools.java index 0d47a303..a77264d2 100644 --- a/src/main/java/com/zcloud/util/Tools.java +++ b/src/main/java/com/zcloud/util/Tools.java @@ -42,6 +42,16 @@ public class Tools { return s!=null && !"".equals(s) && !"null".equals(s); } + /** + * 检测字符串是否不为空(null,"","null") + * @param s + * @return 不为空则返回true,否则返回false + */ + public static boolean notEmpty(Object s){ + return s!=null && !"".equals(s) && !"null".equals(s); + } + + /** * 检测字符串是否为空(null,"","null") * @param s diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties index 7f5b7918..94215e87 100644 --- a/src/main/resources/application-dev.properties +++ b/src/main/resources/application-dev.properties @@ -106,6 +106,7 @@ perLoc.url=http://192.168.210.32:8084 perLoc.userName=qaaqadmin perLoc.pwd=Cfd2023@ baseimgpath =http://192.168.192.201:8991/file/ +tongbu.url=http://127.0.0.1:8094 mq.csy.data.topic=csy_docking mq.csy.data.group=scheduled_tasks_csy_docking diff --git a/src/main/resources/mybatis/datasource/system/UsersMapper.xml b/src/main/resources/mybatis/datasource/system/UsersMapper.xml index 2e79d2a6..9485dcac 100644 --- a/src/main/resources/mybatis/datasource/system/UsersMapper.xml +++ b/src/main/resources/mybatis/datasource/system/UsersMapper.xml @@ -92,7 +92,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" CORPINFO_ID, CARDNO, MKMJCARD, - ISDELETE + ISDELETE, + ISPUSH @@ -133,7 +134,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" f.CORPINFO_ID, f.CARDNO, f.MKMJCARD, - f.ISDELETE + f.ISDELETE, + f.ISPUSH @@ -171,7 +173,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{CORPINFO_ID}, #{CARDNO}, #{MKMJCARD}, - #{ISDELETE} + #{ISDELETE}, + #{ISPUSH} @@ -257,9 +260,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" f LEFT JOIN OA_DEPARTMENT dept on f.DEPARTMENT_ID = dept.DEPARTMENT_ID where - f.USERNAME = #{USERNAME} and f.ISDELETE='0' + USERNAME = #{USERNAME} and ISDELETE='0' - and f.USER_ID != #{VERIFYUSER_ID} + and USER_ID != #{VERIFYUSER_ID} @@ -1465,4 +1553,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + + update + + set + ISPUSH = #{ISPUSH}, + ISDELETE = #{ISDELETE} + where + USER_ID = #{USER_ID} + From 3fc60743f22df89c6592427a14cdc3905dd00407 Mon Sep 17 00:00:00 2001 From: water_xu Date: Fri, 9 Aug 2024 17:09:48 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E4=BA=BA=E5=91=98=E4=B8=AD=E5=8F=B0=20-=20?= =?UTF-8?q?=E5=88=87=E9=9D=A2=E3=80=81MQ=E9=80=9A=E7=9F=A5=E3=80=81MQ?= =?UTF-8?q?=E7=9B=91=E5=90=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/system/UsersController.java | 16 ++ src/main/java/com/zcloud/dto/TenCorpDto.java | 1 + .../mq/impl/DockSendMessageServiceImpl.java | 11 ++ .../zcloud/syncData/SyncDataAdviceAspect.java | 108 ++++++++++++++ .../zcloud/syncData/SyncPlatformAdvice.java | 22 +++ .../com/zcloud/syncData/SyncTypeEnum.java | 38 +++++ .../syncData/listener/SyncDataListener.java | 140 ++++++++++++++++++ .../java/com/zcloud/util/StackTraceUtils.java | 12 ++ src/main/resources/application-dev.properties | 8 + 9 files changed, 356 insertions(+) create mode 100644 src/main/java/com/zcloud/syncData/SyncDataAdviceAspect.java create mode 100644 src/main/java/com/zcloud/syncData/SyncPlatformAdvice.java create mode 100644 src/main/java/com/zcloud/syncData/SyncTypeEnum.java create mode 100644 src/main/java/com/zcloud/syncData/listener/SyncDataListener.java create mode 100644 src/main/java/com/zcloud/util/StackTraceUtils.java diff --git a/src/main/java/com/zcloud/controller/system/UsersController.java b/src/main/java/com/zcloud/controller/system/UsersController.java index c7382ac9..ee503d61 100644 --- a/src/main/java/com/zcloud/controller/system/UsersController.java +++ b/src/main/java/com/zcloud/controller/system/UsersController.java @@ -6,12 +6,16 @@ import java.util.*; import javax.servlet.http.HttpServletResponse; +import cn.hutool.json.JSONUtil; +import com.alibaba.druid.support.json.JSONUtils; import com.alibaba.fastjson.JSON; import com.zcloud.dto.UpdateEnum; import com.zcloud.entity.system.Dictionaries; import com.zcloud.entity.system.User; import com.zcloud.service.bus.*; import com.zcloud.service.system.*; +import com.zcloud.syncData.SyncPlatformAdvice; +import com.zcloud.syncData.SyncTypeEnum; import com.zcloud.util.*; import org.apache.commons.collections.map.ListOrderedMap; import org.apache.commons.lang.StringUtils; @@ -532,6 +536,7 @@ public class UsersController extends BaseController { @RequestMapping(value = "/editUser") @RequiresPermissions("user:edit") @ResponseBody + @SyncPlatformAdvice(type = SyncTypeEnum.PERSONNEL, isUpdate = true) public Object editUser() throws Exception { Map map = new HashMap(); String errInfo = "success"; @@ -777,6 +782,8 @@ public class UsersController extends BaseController { imgfilesService.delete(pd); //删除旧人脸图片 } map.put("result", errInfo); + map.put("code","0"); + map.put("syncInfo", JSONUtil.toJsonStr(usersService.findById(pd))); return map; } @@ -786,6 +793,7 @@ public class UsersController extends BaseController { @RequestMapping(value = "/editUserFuns") @RequiresPermissions("user:edit") @ResponseBody + @SyncPlatformAdvice(type = SyncTypeEnum.PERSONNEL, isUpdate = true) public Object editUserFuns() throws Exception { Map map = new HashMap(); String errInfo = "success"; @@ -794,6 +802,8 @@ public class UsersController extends BaseController { FHLOG.save(Jurisdiction.getUsername(), "从系统用户中修改" + pd.getString("USERNAME") + "的小程序菜单权限"); //记录日志 usersService.editUserFuns(pd); //执行修改 map.put("result", errInfo); + map.put("code", "0"); + map.put("syncInfo", JSONUtils.toJSONString(usersService.findById(pd))); return map; } @@ -802,6 +812,7 @@ public class UsersController extends BaseController { */ @RequestMapping(value = "/editUserOwn") @ResponseBody + @SyncPlatformAdvice(type = SyncTypeEnum.PERSONNEL, isUpdate = true) public Object editUserOwn() throws Exception { Map map = new HashMap(); String errInfo = "success"; @@ -823,6 +834,8 @@ public class UsersController extends BaseController { usersService.editUser(pd); //执行修改 FHLOG.save(Jurisdiction.getUsername(), "从个人资料中修改" + pd.getString("USERNAME") + "的资料"); //记录日志 map.put("result", errInfo); + map.put("code", "0"); + map.put("syncInfo", JSONUtils.toJSONString(usersService.findById(pd))); return map; } @@ -895,6 +908,7 @@ public class UsersController extends BaseController { @RequestMapping(value = "/saveUser") @RequiresPermissions("user:add") @ResponseBody + @SyncPlatformAdvice(type = SyncTypeEnum.PERSONNEL, isInsert = true) public Object saveUser() throws Exception { Map map = new HashMap<>(); String errInfo = "success"; @@ -1019,6 +1033,8 @@ public class UsersController extends BaseController { map.put("USERINFO", userinfo); map.put("USER_ID",ID); map.put("result", errInfo); //返回结果 + map.put("code", "0"); + map.put("syncInfo", JSONUtils.toJSONString(userinfo)); } else { map.put("result", "您输入的身份证号和用户名二次校验失败,请确认后重新申请"); //返回结果 } diff --git a/src/main/java/com/zcloud/dto/TenCorpDto.java b/src/main/java/com/zcloud/dto/TenCorpDto.java index f9398c74..7dc3cf4c 100644 --- a/src/main/java/com/zcloud/dto/TenCorpDto.java +++ b/src/main/java/com/zcloud/dto/TenCorpDto.java @@ -13,6 +13,7 @@ public class TenCorpDto { private String producer_name = "qa-prevention-cfd"; private String topic; //印记(方便寻找该条请求) + // 中台根据这个区分同步的消息类型(人员同步/隐患同步/安检同步等) private String mark; // 标记名称 private String mark_name; diff --git a/src/main/java/com/zcloud/service/mq/impl/DockSendMessageServiceImpl.java b/src/main/java/com/zcloud/service/mq/impl/DockSendMessageServiceImpl.java index d4c56f41..e6eeb52f 100644 --- a/src/main/java/com/zcloud/service/mq/impl/DockSendMessageServiceImpl.java +++ b/src/main/java/com/zcloud/service/mq/impl/DockSendMessageServiceImpl.java @@ -1,5 +1,6 @@ package com.zcloud.service.mq.impl; +import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSONObject; import com.zcloud.dto.TenCorpDto; import com.zcloud.entity.PageData; @@ -33,6 +34,10 @@ public class DockSendMessageServiceImpl implements DockSendMessageService { private String cmtDataDocking; @Value("${mq.czks.data.topic}") private String czksDataDocking; + + @Value("${mq.producer.dataChange.slice-data-change.topic}") + private String sliceDataChangeTopic; + @Resource private RocketMQTemplate rocketMQTemplate; @@ -72,6 +77,12 @@ public class DockSendMessageServiceImpl implements DockSendMessageService { if (tenCorpDto.getTopic().equals(csyDataDocking)) { sendResult = rocketMQTemplate.syncSend(this.csyDataDocking, tenCorpDto.toString()); } + + // 中台同步 + if (tenCorpDto.getTopic().equals(sliceDataChangeTopic)){ + sendResult = rocketMQTemplate.syncSend(this.sliceDataChangeTopic, JSONUtil.toJsonStr(tenCorpDto)); + } + if (sendResult != null && !sendResult.getSendStatus().equals(SendStatus.SEND_OK)) { throw new RuntimeException("产品入栈失败"); } diff --git a/src/main/java/com/zcloud/syncData/SyncDataAdviceAspect.java b/src/main/java/com/zcloud/syncData/SyncDataAdviceAspect.java new file mode 100644 index 00000000..c095afb0 --- /dev/null +++ b/src/main/java/com/zcloud/syncData/SyncDataAdviceAspect.java @@ -0,0 +1,108 @@ +package com.zcloud.syncData; + +import com.zcloud.dto.TenCorpDto; +import com.zcloud.entity.PageData; +import com.zcloud.service.mq.DockSendMessageService; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.aspectj.lang.reflect.MethodSignature; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import java.lang.reflect.Method; +import java.util.Map; + +/** + * 说明:同步切面 + * 使用次切面的方法需使用@SyncPlatformAdvice注解,返回类型为Map或其子类 + * map中需要包含code字段,用于标识该方法的执行结果:"0"成功,其他失败 + * map中需要包含syncInfo字段,用于传递该方法的需要同步的参数,以JSON格式传递 + * :@SyncPlatformAdvice 注解中的 type 参数为必填项,表示同步的数据类型 + * 类型可参考SyncTypeEnum类 + * 作者:water_xu + * 官网:www.zcloudchina.com + */ +@Aspect +@Component +public class SyncDataAdviceAspect { + + @Pointcut(value = "@annotation(com.zcloud.syncData.SyncPlatformAdvice)") + public void syncPointCut() {} + + @Autowired + private DockSendMessageService dockSendMessageService; + + @Value("${mq.producer.dataChange.slice-data-change.topic}") + private String sliceDataChangeTopic; + + @Around("syncPointCut()") + public Object around(ProceedingJoinPoint point) throws Throwable { + + // 执行目标方法 + Object result = null; + try { + result = point.proceed(); + }catch (Exception e){ + System.out.println("==========中台同步切面执行目标方法异常=========="); + throw new RuntimeException(e); + } + if (result instanceof Map) { + Map resultMap = (Map) result; + if ("0".equals(resultMap.get("code")) || "0".equals(resultMap.get("CODE"))) { + MethodSignature signature = (MethodSignature) point.getSignature(); + Method method = signature.getMethod(); + if (method.isAnnotationPresent(SyncPlatformAdvice.class)) { + SyncPlatformAdvice syncPlatformAdvice = method.getAnnotation(SyncPlatformAdvice.class); + + // 处理数据 + TenCorpDto message = new TenCorpDto(); + PageData pd = new PageData(); + resultMap.put("EXCEPT_SOURCE","qy"); + if (resultMap.get("syncInfo") == null || "".equals(resultMap.get("syncInfo"))){ + System.out.println("!!!----------使用同步切面需要返回的map中包含syncInfo字段-----------!!!"); + System.out.println("!!!-------------syncInfo为需要同步的数据 以JSON传递--------------!!!"); + System.out.println("!!!----------使用同步切面需要返回的map中包含syncInfo字段-----------!!!"); + return null; + } + pd.putAll(resultMap); + message.setData(pd); + message.setMessage("qy"); + message.setMark(syncPlatformAdvice.type().getDescription()); + message.setProducer_name("qy"); + message.setTopic(sliceDataChangeTopic); + + // 判断同步类型 + if (syncPlatformAdvice.type().equals(SyncTypeEnum.HIDDEN)){ + // 同步隐患 + } + if (syncPlatformAdvice.type().equals(SyncTypeEnum.PERSONNEL)){ + // 同步人员 + dockSendMessageService.sendMessage(message); + } + if (syncPlatformAdvice.type().equals(SyncTypeEnum.SAFETY_ENVIRONMENTAL_CHECK)){ + // 同步安全环保检查 + } + if (syncPlatformAdvice.type().equals(SyncTypeEnum.KEY_PROJECT)){ + // 同步重点工程 + } + + + } + + } else { + if (resultMap.get("code") == null || "".equals(resultMap.get("code"))){ + System.out.println("!!!----------使用同步切面需要返回的map中包含code字段-----------!!!"); + System.out.println("!!!------------------code为\"0\"成功 其他失败------------------!!!"); + System.out.println("!!!----------使用同步切面需要返回的map中包含code字段-----------!!!"); + }else{ + // 方法内执行失败,返回给调用端失败信息 + throw new RuntimeException(resultMap.get("code") + " ==> " + resultMap.get("msg").toString()); + } + } + } + return result; + } +} diff --git a/src/main/java/com/zcloud/syncData/SyncPlatformAdvice.java b/src/main/java/com/zcloud/syncData/SyncPlatformAdvice.java new file mode 100644 index 00000000..e2cbb90b --- /dev/null +++ b/src/main/java/com/zcloud/syncData/SyncPlatformAdvice.java @@ -0,0 +1,22 @@ +package com.zcloud.syncData; + +import java.lang.annotation.*; + +/** + * 用户同步通知注解,在方法体上加入此注解会进行AOP解析,并以MQ通知给消费者 + * @author :water_xu + * @date :2024.8.6 + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface SyncPlatformAdvice { + // 没啥用 + String value() default ""; + // 数据类型标记 (必须) + SyncTypeEnum type(); + // 是否更新 + boolean isUpdate() default false; + // 是否插入 + boolean isInsert() default false; +} diff --git a/src/main/java/com/zcloud/syncData/SyncTypeEnum.java b/src/main/java/com/zcloud/syncData/SyncTypeEnum.java new file mode 100644 index 00000000..34647a2b --- /dev/null +++ b/src/main/java/com/zcloud/syncData/SyncTypeEnum.java @@ -0,0 +1,38 @@ +package com.zcloud.syncData; + +/** + * 用于向中台同步的切面枚举,区分同步的类型 + * @autor water_xu + * @date 2024.8.8 + */ +public enum SyncTypeEnum { + PERSONNEL("人员"), + HIDDEN("隐患"), + SAFETY_ENVIRONMENTAL_CHECK("安全环保检查"), + KEY_PROJECT("重点工程"); + + private final String description; + + SyncTypeEnum(String description) { + this.description = description; + } + + public String getDescription() { + return description; + } + + /** + * 根据给定的字符串描述判断是否为枚举中的一个类型。 + * + * @param description 描述字符串 + * @return 如果匹配则返回 true,否则返回 false + */ + public static boolean matches(String description) { + for (SyncTypeEnum type : values()) { + if (type.getDescription().equals(description)) { + return true; + } + } + return false; + } +} diff --git a/src/main/java/com/zcloud/syncData/listener/SyncDataListener.java b/src/main/java/com/zcloud/syncData/listener/SyncDataListener.java new file mode 100644 index 00000000..5513ae10 --- /dev/null +++ b/src/main/java/com/zcloud/syncData/listener/SyncDataListener.java @@ -0,0 +1,140 @@ +package com.zcloud.syncData.listener; + +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson.JSON; +import com.zcloud.dto.TenCorpDto; +import com.zcloud.entity.PageData; +import com.zcloud.mapper.datasource.xgf.XgfUserDetailsMapper; +import com.zcloud.mapper.datasource.xgf.XgfUserMapper; +import com.zcloud.service.mq.DockSendMessageService; +import com.zcloud.service.system.UsersService; +import com.zcloud.service.xgf.XgfUserService; +import com.zcloud.syncData.SyncTypeEnum; +import com.zcloud.util.DateUtil; +import com.zcloud.util.StackTraceUtils; +import com.zcloud.util.UuidUtil; +import com.zcloud.util.Warden; +import org.apache.rocketmq.spring.annotation.MessageModel; +import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; +import org.apache.rocketmq.spring.annotation.SelectorType; +import org.apache.rocketmq.spring.core.RocketMQListener; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +@Component +@RocketMQMessageListener( + consumerGroup = "${mq.consumer.dataChange.tongbu-data-change.group}", + topic = "${mq.consumer.dataChange.tongbu-data-change.topic}", + selectorType = SelectorType.TAG, + messageModel = MessageModel.BROADCASTING) // 添加广播模式 +public class SyncDataListener implements RocketMQListener { + +// @Resource +// private MqMessageLogMapper mqMessageLogMapper; + + public static Map dockingRelationMap = new HashMap(); + +// @Autowired +// private MqConsumptionLogMapper mqConsumptionLogMapper; + + @Autowired + private UsersService usersService; + @Autowired + private XgfUserMapper xgfUserMapper; + @Autowired + private XgfUserDetailsMapper xgfUserDetailsMapper; + @Autowired + private DockSendMessageService dockSendMessageService; + +// @Autowired +// private static MqConsumptionErrorLogMapper mqConsumptionErrorLogMapper; + + @Override + public void onMessage(String message) { + //获取消息 + TenCorpDto tenCorpDto = JSON.parseObject(message, TenCorpDto.class); + + PageData productionPD = new PageData(); + productionPD.put("CONSUMPTION_ID", Warden.get32UUID()); + productionPD.put("MESSAGE_LOG_ID",tenCorpDto.getMessageLogId()); + productionPD.put("CONSUMPTION_TYPE","gwj-MqQyDataListener.onMessage(String message)"); + productionPD.put("CONSUMPTION_TIME", DateUtil.getTime()); + productionPD.put("CREATE_TIME", tenCorpDto.getCREATE_TIME() == null ? "" : tenCorpDto.getCREATE_TIME()); + productionPD.put("MARK", tenCorpDto.getMark() == null ? "" : tenCorpDto.getMark()); + productionPD.put("DATA", tenCorpDto.getData()== null ? "" : tenCorpDto.getData().toString()); + //从消息中获取参数数据 + PageData pd = tenCorpDto.getData(); + // save: + pd.put("SUCCESS",0); + pd.put("CONSUMPTION_ID", UuidUtil.get32UUID()); + pd.putAll(tenCorpDto.getPd()); + pd.put("CONSUMPTION_TIME", DateUtil.date2Str(new Date())); + pd.put("CONSUMPTION_TYPE","MqQyDataListener"); + if ("qy".equals(tenCorpDto.getMessage())){ + // 在本端发的同步消息,不需要再次同步该数据 + return; + } + try { + //拿到原路径 + String url = pd.getString("url"); + System.out.println(url + pd); + + // 人员 + if (SyncTypeEnum.PERSONNEL.getDescription().equals(tenCorpDto.getMark())){ + System.out.println("people"); + String str = tenCorpDto.getData().getString("syncInfo"); + PageData syncInfo = JSONUtil.toBean(str, PageData.class); + if ("xgf".equals(tenCorpDto.getMessage())){ + // 相关方推送更新 + syncInfo.put("XGF_USER_ID",syncInfo.getString("USER_ID")); + PageData localData = xgfUserMapper.findById(syncInfo); + if (localData != null && !localData.isEmpty()){ + xgfUserMapper.edit(syncInfo); + syncInfo.put("XGF_USER_DETAILS_ID",localData.getString("XGF_USER_ID")); + PageData localDetailsData = xgfUserDetailsMapper.findById(syncInfo); + if (localDetailsData != null && !localDetailsData.isEmpty()){ + xgfUserDetailsMapper.edit(syncInfo); + } + } + + } + PageData localData = usersService.findById(syncInfo); + if (localData != null && !localData.isEmpty()){ + usersService.editUser(syncInfo); + } else { + // 2024.8.9 按郭跃鹏提出:后期各公司从企业端分离后,需要其他公司的用户进行SQL联查,要求新增一张core_user的同步表,用于记录中台的所有用户数据 + } + + } + // 隐患 + if (SyncTypeEnum.HIDDEN.getDescription().equals(tenCorpDto.getMark())){ + + } + // 安全环保检查 + if (SyncTypeEnum.SAFETY_ENVIRONMENTAL_CHECK.getDescription().equals(tenCorpDto.getMark())){ + + } + // 重点工程 + if (SyncTypeEnum.KEY_PROJECT.getDescription().equals(tenCorpDto.getMark())){ + + } + +// mqConsumptionLogMapper.save(productionPD); +// mqConsumptionLogMapper.save(pd); + } catch (Exception e) { + productionPD.put("SUCCESS",'0'); + productionPD.put("ERROR_MESSAGE", StackTraceUtils.printStackTraceToString(e)); +// mqConsumptionErrorLogMapper.save(productionPD); + pd.put("ERROR_MESSAGE",e.getMessage()); +// mqConsumptionLogMapper.save(pd); + e.printStackTrace(); + throw new RuntimeException(e); + } + + } +} diff --git a/src/main/java/com/zcloud/util/StackTraceUtils.java b/src/main/java/com/zcloud/util/StackTraceUtils.java new file mode 100644 index 00000000..7c0fc661 --- /dev/null +++ b/src/main/java/com/zcloud/util/StackTraceUtils.java @@ -0,0 +1,12 @@ +package com.zcloud.util; + +import java.io.PrintWriter; +import java.io.StringWriter; + +public class StackTraceUtils { + public static String printStackTraceToString(Throwable t) { + StringWriter sw = new StringWriter(); + t.printStackTrace(new PrintWriter(sw, true)); + return sw.getBuffer().toString(); + } +} diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties index 94215e87..154469d1 100644 --- a/src/main/resources/application-dev.properties +++ b/src/main/resources/application-dev.properties @@ -143,3 +143,11 @@ gongJiangXueYuanProdUrl=https://gjxy.bjttsx.com #gongJiangXueYuanGetImgUrl=https://skqhdg.porthebei.com:9004/file/ # \u7ED9\u5DE5\u5320\u5B66\u9662\u63A8\u9001\u4EBA\u5458\u6570\u636E\u65F6\u7684\u56FE\u7247\u9644\u4EF6\u524D\u7F00 \uFF08\u6D4B\u8BD5\u516C\u7F51\uFF09 gongJiangXueYuanGetImgUrl=https://wwag.qhdsafety.com/file/ + +# \u4E2D\u53F0 +# \u6D88\u8D39\u4E2D\u53F0\u901A\u77E5 +mq.consumer.dataChange.tongbu-data-change.topic=tongbu_dataChange_docking +mq.consumer.dataChange.tongbu-data-change.group=tongbu_dataChange_group + +# \u672C\u5730\u6570\u636E\u4FEE\u6539\u540E\u5411\u8FD9\u4E2Atopic\u63A8\u9001\uFF08\u6240\u6709\u7C7B\u578B\u540C\u6B65\u6570\u636E\u516C\u7528\uFF09 +mq.producer.dataChange.slice-data-change.topic=slice_dataChange_docking \ No newline at end of file From 2b3510591b5628f9d29dd72e5dde93c4d0e3361e Mon Sep 17 00:00:00 2001 From: water_xu Date: Mon, 12 Aug 2024 10:15:37 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E4=BA=BA=E5=91=98=E4=B8=AD=E5=8F=B0=20-=20?= =?UTF-8?q?MQ=E6=97=A5=E5=BF=97=E8=A1=A5=E5=85=A8&=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=96=B9=E7=94=A8=E6=88=B7=E6=9B=B4=E6=96=B0=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mq/MqConsumptionErrorLogMapper.java | 18 ++ .../datasource/mq/MqConsumptionLogMapper.java | 18 ++ .../zcloud/service/xgf/XgfUserService.java | 3 +- .../service/xgf/impl/XgfUserServiceImpl.java | 25 ++ .../syncData/listener/SyncDataListener.java | 52 ++-- .../mq/MqConsumptionErrorLogMapper.xml | 41 +++ .../datasource/mq/MqConsumptionLogMapper.xml | 41 +++ .../datasource/xgf/XgfUserDetailsMapper.xml | 235 +++++++++++++----- .../mybatis/datasource/xgf/XgfUserMapper.xml | 63 +++-- 9 files changed, 383 insertions(+), 113 deletions(-) create mode 100644 src/main/java/com/zcloud/mapper/datasource/mq/MqConsumptionErrorLogMapper.java create mode 100644 src/main/java/com/zcloud/mapper/datasource/mq/MqConsumptionLogMapper.java create mode 100644 src/main/resources/mybatis/datasource/mq/MqConsumptionErrorLogMapper.xml create mode 100644 src/main/resources/mybatis/datasource/mq/MqConsumptionLogMapper.xml diff --git a/src/main/java/com/zcloud/mapper/datasource/mq/MqConsumptionErrorLogMapper.java b/src/main/java/com/zcloud/mapper/datasource/mq/MqConsumptionErrorLogMapper.java new file mode 100644 index 00000000..cfd3b77e --- /dev/null +++ b/src/main/java/com/zcloud/mapper/datasource/mq/MqConsumptionErrorLogMapper.java @@ -0,0 +1,18 @@ +package com.zcloud.mapper.datasource.mq; + +import com.zcloud.entity.PageData; + +/** + * 说明:mq消费信息错误日志表 + * 作者:LLX + * 时间:2024-01-10 + * 官网:www.zcloudchina.com + */ +public interface MqConsumptionErrorLogMapper { + + /** + * add + * @param pd + */ + void save(PageData pd); +} diff --git a/src/main/java/com/zcloud/mapper/datasource/mq/MqConsumptionLogMapper.java b/src/main/java/com/zcloud/mapper/datasource/mq/MqConsumptionLogMapper.java new file mode 100644 index 00000000..7af26505 --- /dev/null +++ b/src/main/java/com/zcloud/mapper/datasource/mq/MqConsumptionLogMapper.java @@ -0,0 +1,18 @@ +package com.zcloud.mapper.datasource.mq; + +import com.zcloud.entity.PageData; + +/** + * 说明:mq消费信息日志表 + * 作者:LLX + * 时间:2024-01-08 + * 官网:www.zcloudchina.com + */ +public interface MqConsumptionLogMapper { + + /** + * add + * @param pd + */ + void save(PageData pd); +} diff --git a/src/main/java/com/zcloud/service/xgf/XgfUserService.java b/src/main/java/com/zcloud/service/xgf/XgfUserService.java index 56c2a876..d7ab07e4 100644 --- a/src/main/java/com/zcloud/service/xgf/XgfUserService.java +++ b/src/main/java/com/zcloud/service/xgf/XgfUserService.java @@ -3,7 +3,6 @@ package com.zcloud.service.xgf; import com.zcloud.entity.Page; import com.zcloud.entity.PageData; import com.zcloud.flow.xgf.util.XgfFlowDto; -import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.web.multipart.MultipartFile; import java.util.List; @@ -46,4 +45,6 @@ public interface XgfUserService { List getWorkTask(PageData condition) throws Exception; void syncPhoto(PageData request) throws Exception; + + void edit4Mq(PageData syncInfo); } diff --git a/src/main/java/com/zcloud/service/xgf/impl/XgfUserServiceImpl.java b/src/main/java/com/zcloud/service/xgf/impl/XgfUserServiceImpl.java index f1605278..af636b9d 100644 --- a/src/main/java/com/zcloud/service/xgf/impl/XgfUserServiceImpl.java +++ b/src/main/java/com/zcloud/service/xgf/impl/XgfUserServiceImpl.java @@ -1204,4 +1204,29 @@ public class XgfUserServiceImpl implements XgfUserService { return "0"; } + + @Override + @Transactional(rollbackFor = Exception.class) + public void edit4Mq(PageData syncInfo) { + // 相关方推送更新 + syncInfo.put("XGF_USER_ID",syncInfo.getString("USER_ID")); + PageData localData = xgfUserMapper.findById(syncInfo); + + if (localData != null && !localData.isEmpty()){ + syncInfo.put("STUDY_STATUS", syncInfo.getString("STATUS")); + syncInfo.put("STATUS", ""); + syncInfo.put("BELONG_TO_CORP", syncInfo.getString("EMPLOYER")); + syncInfo.put("BELONG_TO_CORP_NAME", syncInfo.getString("EMPLOYER_NAME")); + syncInfo.put("XGF_USER_NAME", syncInfo.getString("NAME")); + + xgfUserMapper.edit(syncInfo); + + // details + syncInfo.put("XGF_USER_DETAILS_ID",localData.getString("XGF_USER_ID")); + PageData localDetailsData = xgfUserDetailsMapper.findById(syncInfo); + if (localDetailsData != null && !localDetailsData.isEmpty()){ + xgfUserDetailsMapper.edit(syncInfo); + } + } + } } diff --git a/src/main/java/com/zcloud/syncData/listener/SyncDataListener.java b/src/main/java/com/zcloud/syncData/listener/SyncDataListener.java index 5513ae10..b44c127a 100644 --- a/src/main/java/com/zcloud/syncData/listener/SyncDataListener.java +++ b/src/main/java/com/zcloud/syncData/listener/SyncDataListener.java @@ -4,9 +4,8 @@ import cn.hutool.json.JSONUtil; import com.alibaba.fastjson.JSON; import com.zcloud.dto.TenCorpDto; import com.zcloud.entity.PageData; -import com.zcloud.mapper.datasource.xgf.XgfUserDetailsMapper; -import com.zcloud.mapper.datasource.xgf.XgfUserMapper; -import com.zcloud.service.mq.DockSendMessageService; +import com.zcloud.mapper.datasource.mq.MqConsumptionErrorLogMapper; +import com.zcloud.mapper.datasource.mq.MqConsumptionLogMapper; import com.zcloud.service.system.UsersService; import com.zcloud.service.xgf.XgfUserService; import com.zcloud.syncData.SyncTypeEnum; @@ -21,10 +20,7 @@ import org.apache.rocketmq.spring.core.RocketMQListener; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; -import javax.annotation.Resource; import java.util.Date; -import java.util.HashMap; -import java.util.Map; @Component @RocketMQMessageListener( @@ -34,25 +30,17 @@ import java.util.Map; messageModel = MessageModel.BROADCASTING) // 添加广播模式 public class SyncDataListener implements RocketMQListener { -// @Resource -// private MqMessageLogMapper mqMessageLogMapper; - - public static Map dockingRelationMap = new HashMap(); - -// @Autowired -// private MqConsumptionLogMapper mqConsumptionLogMapper; + @Autowired + private MqConsumptionLogMapper mqConsumptionLogMapper; @Autowired private UsersService usersService; - @Autowired - private XgfUserMapper xgfUserMapper; - @Autowired - private XgfUserDetailsMapper xgfUserDetailsMapper; - @Autowired - private DockSendMessageService dockSendMessageService; -// @Autowired -// private static MqConsumptionErrorLogMapper mqConsumptionErrorLogMapper; + @Autowired + private XgfUserService xgfUserService; + + @Autowired + private static MqConsumptionErrorLogMapper mqConsumptionErrorLogMapper; @Override public void onMessage(String message) { @@ -90,18 +78,8 @@ public class SyncDataListener implements RocketMQListener { String str = tenCorpDto.getData().getString("syncInfo"); PageData syncInfo = JSONUtil.toBean(str, PageData.class); if ("xgf".equals(tenCorpDto.getMessage())){ - // 相关方推送更新 - syncInfo.put("XGF_USER_ID",syncInfo.getString("USER_ID")); - PageData localData = xgfUserMapper.findById(syncInfo); - if (localData != null && !localData.isEmpty()){ - xgfUserMapper.edit(syncInfo); - syncInfo.put("XGF_USER_DETAILS_ID",localData.getString("XGF_USER_ID")); - PageData localDetailsData = xgfUserDetailsMapper.findById(syncInfo); - if (localDetailsData != null && !localDetailsData.isEmpty()){ - xgfUserDetailsMapper.edit(syncInfo); - } - } - + // 相关方推送 + xgfUserService.edit4Mq(syncInfo); } PageData localData = usersService.findById(syncInfo); if (localData != null && !localData.isEmpty()){ @@ -124,14 +102,14 @@ public class SyncDataListener implements RocketMQListener { } -// mqConsumptionLogMapper.save(productionPD); -// mqConsumptionLogMapper.save(pd); + mqConsumptionLogMapper.save(productionPD); + mqConsumptionLogMapper.save(pd); } catch (Exception e) { productionPD.put("SUCCESS",'0'); productionPD.put("ERROR_MESSAGE", StackTraceUtils.printStackTraceToString(e)); -// mqConsumptionErrorLogMapper.save(productionPD); + mqConsumptionErrorLogMapper.save(productionPD); pd.put("ERROR_MESSAGE",e.getMessage()); -// mqConsumptionLogMapper.save(pd); + mqConsumptionLogMapper.save(pd); e.printStackTrace(); throw new RuntimeException(e); } diff --git a/src/main/resources/mybatis/datasource/mq/MqConsumptionErrorLogMapper.xml b/src/main/resources/mybatis/datasource/mq/MqConsumptionErrorLogMapper.xml new file mode 100644 index 00000000..a1475fef --- /dev/null +++ b/src/main/resources/mybatis/datasource/mq/MqConsumptionErrorLogMapper.xml @@ -0,0 +1,41 @@ + + + + + `qa-gwj-prevention`.`mq_consumption_error_log` + + + CONSUMPTION_ID, + MARK, + DATA, + MESSAGE_LOG_ID, + SUCCESS, + CREATE_TIME, + CONSUMPTION_TIME, + CONSUMPTION_TYPE, + ERROR_MESSAGE, + URL + + + #{CONSUMPTION_ID}, + #{MARK}, + #{DATA}, + #{MESSAGE_LOG_ID}, + #{SUCCESS}, + #{CREATE_TIME}, + #{CONSUMPTION_TIME}, + #{CONSUMPTION_TYPE}, + #{ERROR_MESSAGE}, + #{URL} + + + insert into + + ( + + ) values ( + + ) + + + diff --git a/src/main/resources/mybatis/datasource/mq/MqConsumptionLogMapper.xml b/src/main/resources/mybatis/datasource/mq/MqConsumptionLogMapper.xml new file mode 100644 index 00000000..4cb6634a --- /dev/null +++ b/src/main/resources/mybatis/datasource/mq/MqConsumptionLogMapper.xml @@ -0,0 +1,41 @@ + + + + + `qa-gwj-prevention`.`mq_consumption_log` + + + CONSUMPTION_ID, + MARK, + DATA, + MESSAGE_LOG_ID, + SUCCESS, + CREATE_TIME, + CONSUMPTION_TIME, + CONSUMPTION_TYPE, + ERROR_MESSAGE, + URL + + + #{CONSUMPTION_ID}, + #{MARK}, + #{DATA}, + #{MESSAGE_LOG_ID}, + #{SUCCESS}, + #{CREATE_TIME}, + #{CONSUMPTION_TIME}, + #{CONSUMPTION_TYPE}, + #{ERROR_MESSAGE}, + #{URL} + + + insert into + + ( + + ) values ( + + ) + + + diff --git a/src/main/resources/mybatis/datasource/xgf/XgfUserDetailsMapper.xml b/src/main/resources/mybatis/datasource/xgf/XgfUserDetailsMapper.xml index ed640710..0ff0a15d 100644 --- a/src/main/resources/mybatis/datasource/xgf/XgfUserDetailsMapper.xml +++ b/src/main/resources/mybatis/datasource/xgf/XgfUserDetailsMapper.xml @@ -218,65 +218,182 @@ update - set - XGF_USER_DETAILS_ID = #{XGF_USER_DETAILS_ID}, - XGF_USER_ID = #{XGF_USER_ID}, - XGF_USER_NAME = #{XGF_USER_NAME}, - BELONG_TO_CORP = #{BELONG_TO_CORP}, - BELONG_TO_CORP_NAME = #{BELONG_TO_CORP_NAME}, - PHONE = #{PHONE}, - CREATE_TIME = #{CREATE_TIME}, - DEPART_STATE = #{DEPART_STATE}, - IS_DELETE = #{IS_DELETE}, - AGE = #{AGE}, - HKLOCAL = #{HKLOCAL}, - ADDRESS = #{ADDRESS}, - DEGREE_OF_EDUCATION = #{DEGREE_OF_EDUCATION}, - DEGREE_OF_EDUCATION_NAME = #{DEGREE_OF_EDUCATION_NAME}, - CORP_START_DATE = #{CORP_START_DATE}, - POST_ID = #{POST_ID}, - POST_NAME = #{POST_NAME}, - WORK_SIGN = #{WORK_SIGN}, - JOINED_DATE = #{JOINED_DATE}, - WORK_DATE = #{WORK_DATE}, - PHOTO = #{PHOTO}, - DATE_OF_BIRTH = #{DATE_OF_BIRTH}, - ISPAY = #{ISPAY}, - ISPAY_NUMBER = #{ISPAY_NUMBER}, - IS_SAFETY_TELL = #{IS_SAFETY_TELL}, - IS_SAFETY_TIME = #{IS_SAFETY_TIME}, - IS_INJURIES_PAY = #{IS_INJURIES_PAY}, - IS_SIGN_LABOR = #{IS_SIGN_LABOR}, - SEX = #{SEX}, - ENTRY_DATE = #{ENTRY_DATE}, - PERSON_WORK_TYPE = #{PERSON_WORK_TYPE}, - PERSON_WORK_TYPE_NAME = #{PERSON_WORK_TYPE_NAME}, - NATIONALITY = #{NATIONALITY}, - NATIONALITY_NAME = #{NATIONALITY_NAME}, - POLITICAL_TIME = #{POLITICAL_TIME}, - POLITICAL_STATUS = #{POLITICAL_STATUS}, - POLITICAL_STATUS_NAME = #{POLITICAL_STATUS_NAME}, - IS_INJURIES_PAY_TIME = #{IS_INJURIES_PAY_TIME}, - IS_LEVEL_THREE = #{IS_LEVEL_THREE}, - IS_BODY_ADAPT = #{IS_BODY_ADAPT}, - IS_SPECIAL_JOB = #{IS_SPECIAL_JOB}, - CORPINFO_ID = #{CORPINFO_ID}, - MANAGER_DEPARTMENT_ID = #{MANAGER_DEPARTMENT_ID}, - MANAGER_DEPARTMENT_NAME = #{MANAGER_DEPARTMENT_NAME}, - COMPETENT_DEPARTMENT_ID = #{COMPETENT_DEPARTMENT_ID}, - COMPETENT_DEPARTMENT_NAME = #{COMPETENT_DEPARTMENT_NAME}, - MAIN_DEPARTMENT_ID = #{MAIN_DEPARTMENT_ID}, - MAIN_DEPARTMENT_NAME = #{MAIN_DEPARTMENT_NAME}, - CARD_ID = #{CARD_ID}, - DEPARTMENT_ID = #{DEPARTMENT_ID}, - DEPARTMENT_NAME = #{DEPARTMENT_NAME}, - IS_BF = #{IS_BF}, - IS_SOCIAL = #{IS_SOCIAL}, - SOCIAL_NUMBER = #{SOCIAL_NUMBER}, - zzName = #{zzName}, - ANNEX = #{ANNEX}, - ATTORNEY = #{ATTORNEY}, - COMMITMENT_LETTER = #{COMMITMENT_LETTER} + + + XGF_USER_DETAILS_ID = #{XGF_USER_DETAILS_ID}, + + + XGF_USER_ID = #{XGF_USER_ID}, + + + XGF_USER_NAME = #{XGF_USER_NAME}, + + + BELONG_TO_CORP = #{BELONG_TO_CORP}, + + + BELONG_TO_CORP_NAME = #{BELONG_TO_CORP_NAME}, + + + PHONE = #{PHONE}, + + + CREATE_TIME = #{CREATE_TIME}, + + + DEPART_STATE = #{DEPART_STATE}, + + + IS_DELETE = #{IS_DELETE}, + + + AGE = #{AGE}, + + + HKLOCAL = #{HKLOCAL}, + + + ADDRESS = #{ADDRESS}, + + + DEGREE_OF_EDUCATION = #{DEGREE_OF_EDUCATION}, + + + DEGREE_OF_EDUCATION_NAME = #{DEGREE_OF_EDUCATION_NAME}, + + + CORP_START_DATE = #{CORP_START_DATE}, + + + POST_ID = #{POST_ID}, + + + POST_NAME = #{POST_NAME}, + + + WORK_SIGN = #{WORK_SIGN}, + + + JOINED_DATE = #{JOINED_DATE}, + + + WORK_DATE = #{WORK_DATE}, + + + PHOTO = #{PHOTO}, + + + DATE_OF_BIRTH = #{DATE_OF_BIRTH}, + + + ISPAY = #{ISPAY}, + + + ISPAY_NUMBER = #{ISPAY_NUMBER}, + + + IS_SAFETY_TELL = #{IS_SAFETY_TELL}, + + + IS_SAFETY_TIME = #{IS_SAFETY_TIME}, + + + IS_INJURIES_PAY = #{IS_INJURIES_PAY}, + + + IS_SIGN_LABOR = #{IS_SIGN_LABOR}, + + + SEX = #{SEX}, + + + ENTRY_DATE = #{ENTRY_DATE}, + + + PERSON_WORK_TYPE = #{PERSON_WORK_TYPE}, + + + PERSON_WORK_TYPE_NAME = #{PERSON_WORK_TYPE_NAME}, + + + NATIONALITY = #{NATIONALITY}, + + + NATIONALITY_NAME = #{NATIONALITY_NAME}, + + + POLITICAL_TIME = #{POLITICAL_TIME}, + + + POLITICAL_STATUS = #{POLITICAL_STATUS}, + + + POLITICAL_STATUS_NAME = #{POLITICAL_STATUS_NAME}, + + + IS_INJURIES_PAY_TIME = #{IS_INJURIES_PAY_TIME}, + + + IS_LEVEL_THREE = #{IS_LEVEL_THREE}, + + + IS_BODY_ADAPT = #{IS_BODY_ADAPT}, + + + IS_SPECIAL_JOB = #{IS_SPECIAL_JOB}, + + + CORPINFO_ID = #{CORPINFO_ID}, + + + MANAGER_DEPARTMENT_ID = #{MANAGER_DEPARTMENT_ID}, + + + MANAGER_DEPARTMENT_NAME = #{MANAGER_DEPARTMENT_NAME}, + + + COMPETENT_DEPARTMENT_ID = #{COMPETENT_DEPARTMENT_ID}, + + + COMPETENT_DEPARTMENT_NAME = #{COMPETENT_DEPARTMENT_NAME}, + + + MAIN_DEPARTMENT_ID = #{MAIN_DEPARTMENT_ID}, + + + MAIN_DEPARTMENT_NAME = #{MAIN_DEPARTMENT_NAME}, + + + CARD_ID = #{CARD_ID}, + + + DEPARTMENT_ID = #{DEPARTMENT_ID}, + + + DEPARTMENT_NAME = #{DEPARTMENT_NAME}, + + + IS_BF = #{IS_BF}, + + + IS_SOCIAL = #{IS_SOCIAL}, + + + SOCIAL_NUMBER = #{SOCIAL_NUMBER}, + + + zzName = #{zzName}, + + + ANNEX = #{ANNEX}, + + + ATTORNEY = #{ATTORNEY}, + + + COMMITMENT_LETTER = #{COMMITMENT_LETTER} + + where XGF_USER_DETAILS_ID = #{XGF_USER_DETAILS_ID} diff --git a/src/main/resources/mybatis/datasource/xgf/XgfUserMapper.xml b/src/main/resources/mybatis/datasource/xgf/XgfUserMapper.xml index ae5dd84d..ca60be51 100644 --- a/src/main/resources/mybatis/datasource/xgf/XgfUserMapper.xml +++ b/src/main/resources/mybatis/datasource/xgf/XgfUserMapper.xml @@ -92,22 +92,53 @@ update - set - USERNAME = #{USERNAME}, - NAME = #{NAME}, - VALID_FLAG = #{VALID_FLAG}, - BELONG_TO_CORP = #{BELONG_TO_CORP}, - BELONG_TO_CORP_NAME = #{BELONG_TO_CORP_NAME}, - IS_DELETE = #{IS_DELETE}, - CREATE_TIME = #{CREATE_TIME}, - CORPINFO_ID = #{CORPINFO_ID}, - STATUS = #{STATUS}, - OPERATOR_TIME = #{OPERATOR_TIME}, - ISFLOW = #{ISFLOW}, - STUDY_STATUS = #{STUDY_STATUS}, - CHECK_STATUS = #{CHECK_STATUS}, - CHECK_STEP = #{CHECK_STEP}, - LIMIT_END_TIME = #{LIMIT_END_TIME} + + + USERNAME = #{USERNAME}, + + + NAME = #{NAME}, + + + VALID_FLAG = #{VALID_FLAG}, + + + BELONG_TO_CORP = #{BELONG_TO_CORP}, + + + BELONG_TO_CORP_NAME = #{BELONG_TO_CORP_NAME}, + + + IS_DELETE = #{IS_DELETE}, + + + CREATE_TIME = #{CREATE_TIME}, + + + CORPINFO_ID = #{CORPINFO_ID}, + + + STATUS = #{STATUS}, + + + OPERATOR_TIME = #{OPERATOR_TIME}, + + + ISFLOW = #{ISFLOW}, + + + STUDY_STATUS = #{STUDY_STATUS}, + + + CHECK_STATUS = #{CHECK_STATUS}, + + + CHECK_STEP = #{CHECK_STEP}, + + + LIMIT_END_TIME = #{LIMIT_END_TIME} + + where XGF_USER_ID = #{XGF_USER_ID} From 021b19d85e720fc3c3a64094b1c590b19cb716dc Mon Sep 17 00:00:00 2001 From: water_xu Date: Wed, 14 Aug 2024 17:03:52 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E4=BA=BA=E5=91=98=E4=B8=AD=E5=8F=B0=20-=20?= =?UTF-8?q?=E4=BA=BA=E5=91=98=E4=B8=AD=E5=8F=B0=E7=AE=A1=E7=90=86=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=9F=A5=E8=AF=A2=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/mybatis/datasource/system/UsersMapper.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/resources/mybatis/datasource/system/UsersMapper.xml b/src/main/resources/mybatis/datasource/system/UsersMapper.xml index 9485dcac..e7625a89 100644 --- a/src/main/resources/mybatis/datasource/system/UsersMapper.xml +++ b/src/main/resources/mybatis/datasource/system/UsersMapper.xml @@ -635,8 +635,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and u.ISDELETE = '0' - AND (u.ISPUSH != "1") - AND (u.ISDELETE != "1" or u.ISPUSH = "0") + AND (u.ISPUSH != "1" or u.ISPUSH is null) + AND (u.ISDELETE != "1" or u.ISPUSH = "0" ) From e6b781fa9529d5e9ff022efc3a7567a04edea13a Mon Sep 17 00:00:00 2001 From: water_xu Date: Wed, 14 Aug 2024 17:09:27 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E7=9B=B8=E5=85=B3=E6=96=B9=E4=BA=BA?= =?UTF-8?q?=E5=91=98=E7=AE=A1=E7=90=86=20-=20=E7=9B=B8=E5=85=B3=E6=96=B9?= =?UTF-8?q?=E4=BA=BA=E5=91=98=E5=AE=A1=E6=89=B9=E6=90=9C=E7=B4=A2=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E4=B8=8D=E8=83=BD=E4=BD=BF=E7=94=A8,=E6=90=9C?= =?UTF-8?q?=E7=B4=A2=E4=BF=A1=E6=81=AF=E6=B7=BB=E5=8A=A0=E5=A7=93=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/mybatis/datasource/xgf/XgfUserMapper.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/resources/mybatis/datasource/xgf/XgfUserMapper.xml b/src/main/resources/mybatis/datasource/xgf/XgfUserMapper.xml index ae5dd84d..e6affd5f 100644 --- a/src/main/resources/mybatis/datasource/xgf/XgfUserMapper.xml +++ b/src/main/resources/mybatis/datasource/xgf/XgfUserMapper.xml @@ -359,6 +359,12 @@ and a.CHECK_STEP = #{pd.CHECK_STEP} + + and ( + a.USERNAME like CONCAT('%', #{pd.KEYWORDS}, '%') + or a.NAME like CONCAT('%', #{pd.KEYWORDS}, '%') + ) +