From d0f245fc49126c25c06745d9f5bf333d2bed04f7 Mon Sep 17 00:00:00 2001 From: wanggeng888 <450292408@qq.com> Date: Mon, 12 Apr 2021 18:19:39 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AF=86=E7=A0=81?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../appversion/AppVersionAppController.java | 10 ++++++---- .../system/user/UserResourceController.java | 8 +++----- .../service/system/user/IUserService.java | 14 +++++++++++-- .../system/user/impl/UserServiceImpl.java | 20 ++++++++++++++++++- 4 files changed, 40 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/cm/serviceusercenter/controller/app/apis/appversion/AppVersionAppController.java b/src/main/java/com/cm/serviceusercenter/controller/app/apis/appversion/AppVersionAppController.java index 70491a4..b3eb13b 100644 --- a/src/main/java/com/cm/serviceusercenter/controller/app/apis/appversion/AppVersionAppController.java +++ b/src/main/java/com/cm/serviceusercenter/controller/app/apis/appversion/AppVersionAppController.java @@ -6,12 +6,14 @@ import com.cm.common.exception.FileException; import com.cm.common.exception.SearchException; import com.cm.common.exception.UpdateException; import com.cm.common.result.ErrorResult; -import com.cm.common.result.SuccessResult; import com.cm.common.result.SuccessResultData; import com.cm.serviceusercenter.service.appversion.IAppVersionService; import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -53,8 +55,8 @@ public class AppVersionAppController extends AbstractController { @ApiImplicitParam(name = "appVersionId", value = "app版本ID", paramType = "path") }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) - @GetMapping("downloadapp/{appVersionId}") - public void downloadApp(@PathVariable("appVersionId") String appVersionId, HttpServletRequest request, HttpServletResponse response) throws SearchException, FileException, UpdateException { + @GetMapping("download/{appVersionId}") + public void download(@PathVariable("appVersionId") String appVersionId, HttpServletRequest request, HttpServletResponse response) throws SearchException, FileException, UpdateException { Map params = getParams(); params.put("appVersionId", appVersionId); params.put("isRelease", 1); diff --git a/src/main/java/com/cm/serviceusercenter/controller/resources/system/user/UserResourceController.java b/src/main/java/com/cm/serviceusercenter/controller/resources/system/user/UserResourceController.java index adca1b5..ba8d669 100644 --- a/src/main/java/com/cm/serviceusercenter/controller/resources/system/user/UserResourceController.java +++ b/src/main/java/com/cm/serviceusercenter/controller/resources/system/user/UserResourceController.java @@ -31,8 +31,6 @@ import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; -import java.io.UnsupportedEncodingException; -import java.net.URLDecoder; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -218,9 +216,9 @@ public class UserResourceController extends BaseController { @ApiOperation(value = "修改密码", notes = "修改密码接口") @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) - @PostMapping("updateuserpassword") + @PostMapping("updateuserpassword/{userId}") @CheckRequestBodyAnnotation - public SuccessResult updateUserPassword(AppChangePasswordVO appChangePasswordVO) throws ParamsException, SearchException, UpdateException { + public SuccessResult updateUserPassword(@PathVariable("userId") String userId, AppChangePasswordVO appChangePasswordVO) throws ParamsException, SearchException, UpdateException { Map config = ConfigManager.getInstance().getConfig(); if (config.get(IUserService.PASSWORD_STRENGTH) != null) { String passwordStrength = config.get(IUserService.PASSWORD_STRENGTH).toString(); @@ -237,7 +235,7 @@ public class UserResourceController extends BaseController { Map params = getParams(); params.put("oldPassword", appChangePasswordVO.getOldPassword()); params.put("newPassword", appChangePasswordVO.getNewPassword()); - return userService.updateUserPassword(params); + return userService.updateUserPasswordByUserId(userId, params); } @ApiOperation(value = "获取密码状态", notes = "获取密码状态接口") diff --git a/src/main/java/com/cm/serviceusercenter/service/system/user/IUserService.java b/src/main/java/com/cm/serviceusercenter/service/system/user/IUserService.java index d4dba29..3f7d63d 100644 --- a/src/main/java/com/cm/serviceusercenter/service/system/user/IUserService.java +++ b/src/main/java/com/cm/serviceusercenter/service/system/user/IUserService.java @@ -4,7 +4,6 @@ import com.cm.common.exception.RemoveException; import com.cm.common.exception.SaveException; import com.cm.common.exception.SearchException; import com.cm.common.exception.UpdateException; -import com.cm.common.plugin.pojo.bos.UserResourceBO; import com.cm.common.plugin.pojo.bos.user.UserDepartmentResourceBO; import com.cm.common.pojo.ListPage; import com.cm.common.pojo.dtos.UserAttrInfoDTO; @@ -21,7 +20,6 @@ import com.cm.serviceusercenter.pojo.pos.UserPO; import com.cm.serviceusercenter.pojo.vos.DepartmentUserVO; import com.cm.serviceusercenter.pojo.vos.UserVO; import com.cm.serviceusercenter.pojo.vos.user.*; -import io.micrometer.core.instrument.search.Search; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletRequest; @@ -405,6 +403,16 @@ public interface IUserService { */ SuccessResult updateUserPassword(String token, Map params) throws SearchException, UpdateException; + /** + * 修改用户密码 + * @param userId + * @param params + * @return + * @throws SearchException + * @throws UpdateException + */ + SuccessResult updateUserPasswordByUserId(String userId, Map params) throws SearchException, UpdateException; + /** * 获取用户APP设备列表 * @@ -873,4 +881,6 @@ public interface IUserService { */ List listUserDepartmentResourceByPositionIds(List positionIds) throws SearchException; + + } diff --git a/src/main/java/com/cm/serviceusercenter/service/system/user/impl/UserServiceImpl.java b/src/main/java/com/cm/serviceusercenter/service/system/user/impl/UserServiceImpl.java index 2d2afa7..f894aeb 100644 --- a/src/main/java/com/cm/serviceusercenter/service/system/user/impl/UserServiceImpl.java +++ b/src/main/java/com/cm/serviceusercenter/service/system/user/impl/UserServiceImpl.java @@ -6,7 +6,6 @@ import com.cm.common.constants.ISystemConstant; import com.cm.common.enums.RoleDataAuthorityEnum; import com.cm.common.exception.*; import com.cm.common.plugin.excel.error.AbstractErrorExcelHandler; -import com.cm.common.plugin.pojo.bos.UserResourceBO; import com.cm.common.plugin.pojo.bos.department.DepartmentResourceBO; import com.cm.common.plugin.pojo.bos.user.UserDepartmentResourceBO; import com.cm.common.plugin.pojo.dtos.dynamic.config.form.DynamicConfigFormDTO; @@ -595,6 +594,7 @@ public class UserServiceImpl extends BaseService implements IUserService { return userDepartmentResourceBOs; } + /** * 部门ID列表 * @@ -958,6 +958,24 @@ public class UserServiceImpl extends BaseService implements IUserService { return new SuccessResult(); } + @Override + public SuccessResult updateUserPasswordByUserId(String userId, Map params) throws SearchException, UpdateException { + String oldPassword = DigestUtils.md5Hex(DigestUtils.md5Hex(DigestUtils.md5Hex(params.get("oldPassword").toString()))); + String newPassword = DigestUtils.md5Hex(DigestUtils.md5Hex(DigestUtils.md5Hex(params.get("newPassword").toString()))); + params.clear(); + params.put("userId", userId); + UserPO userPO = userDao.getUserPO(params); + if (!passwordEncoder.matches(oldPassword, userPO.getUserPassword())) { + throw new UpdateException("旧密码错误"); + } + params.put("userPassword", passwordEncoder.encode(newPassword)); + params.put("gmtPasswordModified", DateUtil.getDay()); + setUpdateInfoByUserId(params, userId); + userDao.updateUser(params); + return new SuccessResult(); + } + + @Override public List listUserAppDevice(Map params) throws SearchException { return userDao.listUserAppDevice(params); From 0ea9db59bf53ca58deb9d7fafbab64e409cce521 Mon Sep 17 00:00:00 2001 From: wanggeng888 <450292408@qq.com> Date: Sat, 22 May 2021 09:17:36 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=88=A0=E9=99=A4IM=EF=BC=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E8=B5=84=E6=BA=90=E7=B3=BB=E7=BB=9F=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E4=B8=BA=E5=BC=82=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../resources/system/menu/MenuResourceController.java | 7 ++++--- src/main/resources/application-test.yml | 9 ++++++--- .../resources/mybatis/mapper/system/menu/menu-mapper.xml | 2 +- src/main/resources/templates/main.html | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/main/java/com/cm/serviceusercenter/controller/resources/system/menu/MenuResourceController.java b/src/main/java/com/cm/serviceusercenter/controller/resources/system/menu/MenuResourceController.java index 06680e2..9ca4d5c 100644 --- a/src/main/java/com/cm/serviceusercenter/controller/resources/system/menu/MenuResourceController.java +++ b/src/main/java/com/cm/serviceusercenter/controller/resources/system/menu/MenuResourceController.java @@ -2,7 +2,6 @@ package com.cm.serviceusercenter.controller.resources.system.menu; import com.cm.common.constants.ISystemConstant; import com.cm.common.result.ErrorResult; -import com.cm.common.result.SuccessResult; import com.cm.common.result.SuccessResultData; import com.cm.serviceusercenter.controller.BaseController; import com.cm.serviceusercenter.pojo.dtos.MenuDTO; @@ -12,8 +11,10 @@ import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletRequest; import java.util.List; import java.util.Map; +import java.util.concurrent.Callable; /** * @ClassName: MenuController @@ -51,8 +52,8 @@ public class MenuResourceController extends BaseController { }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("listmenubyclientid/{clientId}/{userId}") - public SuccessResultData> listMenuByClientId(@PathVariable("clientId") String clientId, @PathVariable("userId") String userId) throws Exception { - return menuService.listMenuByClientIdAndUserId(clientId, userId); + public Callable>> listMenuByClientId(@PathVariable("clientId") String clientId, @PathVariable("userId") String userId, HttpServletRequest httpServletRequest) throws Exception { + return () -> menuService.listMenuByClientIdAndUserId(clientId, userId); } } diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml index 20df9b5..0d53412 100644 --- a/src/main/resources/application-test.yml +++ b/src/main/resources/application-test.yml @@ -1,7 +1,7 @@ server: port: 7001 url: http://192.168.0.103:7001/usercenter - ws: ws://192.168.0.103:7001/usercenter/ws +# ws: ws://192.168.0.103:7001/usercenter/ws title: 统一用户管理平台 login-page-name: 统一用户管理平台 servlet: @@ -29,10 +29,13 @@ spring: datasource: druid: url: jdbc:mysql://49.233.36.36:6688/db_cloud?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC +# url: jdbc:mysql://127.0.0.1:3306/db_cloud_v2_inspection?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC db-type: mysql driver-class-name: com.mysql.cj.jdbc.Driver username: wanggeng +# username: root password: WenG>2132997 +# password: root initial-size: 2 min-idle: 2 max-active: 10 @@ -168,7 +171,7 @@ open-platform: wechat: mini-app: # 激活状态 - active: true + active: false authorizeUrl: https://api.weixin.qq.com/sns/jscode2session # 绑定用户连接,指向统一用户,可以内网 bindUserUrl: http://127.0.0.1:7001/usercenter/wxminiapp/sign/logincheckusername @@ -182,7 +185,7 @@ open-platform: # 公众号 official-account: # 开启跨域 - apiCrossOrigin: true + apiCrossOrigin: false activate: false authorize: authorize-url: https://open.weixin.qq.com/connect/oauth2/authorize diff --git a/src/main/resources/mybatis/mapper/system/menu/menu-mapper.xml b/src/main/resources/mybatis/mapper/system/menu/menu-mapper.xml index 38a3553..5dfebd2 100644 --- a/src/main/resources/mybatis/mapper/system/menu/menu-mapper.xml +++ b/src/main/resources/mybatis/mapper/system/menu/menu-mapper.xml @@ -146,7 +146,7 @@ - SELECT * FROM diff --git a/src/main/resources/templates/main.html b/src/main/resources/templates/main.html index b5f6bc6..de72547 100644 --- a/src/main/resources/templates/main.html +++ b/src/main/resources/templates/main.html @@ -162,7 +162,7 @@ base: 'assets/layuiadmin/' //静态资源所在路径 }).extend({ index: 'lib/index' //主入口模块 - }).use(['index', 'restajax', 'datamessage', 'dialog', 'im-socket'], function() { + }).use(['index', 'restajax', 'datamessage', 'dialog'/*, 'im-socket'*/], function() { var $ = layui.$; var layer = layui.layer; From ceac706e09569d9e39df197b7532a3d754ca7320 Mon Sep 17 00:00:00 2001 From: wanggeng888 <450292408@qq.com> Date: Sun, 23 May 2021 21:11:44 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=BC=80=E7=BC=93=E5=AD=98=E3=80=81?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BC=82=E6=AD=A5=E8=AF=B7=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DepartmentResourceController.java | 59 +++++++++++-------- .../impl/DepartmentServiceImpl.java | 11 ++-- .../system/department/department-mapper.xml | 2 +- 3 files changed, 40 insertions(+), 32 deletions(-) diff --git a/src/main/java/com/cm/serviceusercenter/controller/resources/system/department/DepartmentResourceController.java b/src/main/java/com/cm/serviceusercenter/controller/resources/system/department/DepartmentResourceController.java index 23ddcf8..8cb7956 100644 --- a/src/main/java/com/cm/serviceusercenter/controller/resources/system/department/DepartmentResourceController.java +++ b/src/main/java/com/cm/serviceusercenter/controller/resources/system/department/DepartmentResourceController.java @@ -18,6 +18,7 @@ import org.springframework.web.bind.annotation.*; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.concurrent.Callable; /** * When you feel like quitting. Think about why you started @@ -44,10 +45,12 @@ public class DepartmentResourceController extends BaseController { }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @PostMapping("listdepartments/{departmentParentId}") - public List listDepartments(@PathVariable("departmentParentId") String departmentParentId) throws SearchException { - Map params = new HashMap<>(0); - params.put("departmentParentId", departmentParentId); - return departmentService.listZTreeDepartment(params); + public Callable> listDepartments(@PathVariable("departmentParentId") String departmentParentId) throws SearchException { + return () -> { + Map params = new HashMap<>(0); + params.put("departmentParentId", departmentParentId); + return departmentService.listZTreeDepartment(params); + }; } @ApiOperation(value = "组织部门全部列表", notes = "组织部门全部列表接口") @@ -57,10 +60,12 @@ public class DepartmentResourceController extends BaseController { }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @PostMapping("listalldepartments/{departmentParentId}") - public List listAllDepartments(@PathVariable("departmentParentId") String departmentParentId) throws SearchException { - Map params = new HashMap<>(0); - params.put("departmentParentId", departmentParentId); - return departmentService.listDepartmentsAll(params); + public Callable> listAllDepartments(@PathVariable("departmentParentId") String departmentParentId) throws SearchException { + return () -> { + Map params = new HashMap<>(0); + params.put("departmentParentId", departmentParentId); + return departmentService.listDepartmentsAll(params); + }; } @ApiOperation(value = "zTree列表(包括人员)", notes = "zTree列表(包括人员)接口") @@ -69,12 +74,14 @@ public class DepartmentResourceController extends BaseController { }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("listztreedepartmentwithuser") - public List listZTreeDepartmentWithUser(@RequestParam(required = false) String id) throws SearchException { - String departmentParentId = "0"; - if (!StringUtils.isBlank(id)) { - departmentParentId = id; - } - return departmentService.listZTreeDepartmentWithUser(departmentParentId); + public Callable> listZTreeDepartmentWithUser(@RequestParam(required = false) String id) throws SearchException { + return () -> { + String departmentParentId = "0"; + if (!StringUtils.isBlank(id)) { + departmentParentId = id; + } + return departmentService.listZTreeDepartmentWithUser(departmentParentId); + }; } @ApiOperation(value = "zTree列表", notes = "zTree列表接口") @@ -101,8 +108,8 @@ public class DepartmentResourceController extends BaseController { }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("listdepartmentsimplebyparentid/{departmentParentId}") - public List listDepartmentSimpleByParentId(@PathVariable("departmentParentId") String departmentParentId) throws SearchException { - return departmentService.listDepartmentSimpleByParentId(departmentParentId); + public Callable> listDepartmentSimpleByParentId(@PathVariable("departmentParentId") String departmentParentId) throws SearchException { + return () -> departmentService.listDepartmentSimpleByParentId(departmentParentId); } @ApiOperation(value = "通过上级ID和添加获取组织部门全部增量列表(简单格式)", notes = "通过上级ID和添加获取组织部门全部增量列表(简单格式)接口") @@ -113,11 +120,11 @@ public class DepartmentResourceController extends BaseController { }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("listdepartmentsimplebyparentidandadddate/{departmentParentId}/{addDate}") - public List listDepartmentSimpleByParentIdAndAddDate(@PathVariable("departmentParentId") String departmentParentId, @PathVariable("addDate") String addDate) throws SearchException { + public Callable> listDepartmentSimpleByParentIdAndAddDate(@PathVariable("departmentParentId") String departmentParentId, @PathVariable("addDate") String addDate) throws SearchException { if (!RegexUtil.isDate(addDate)) { throw new ParamsException("日期格式错误"); } - return departmentService.listDepartmentSimpleByParentIdAndAddDate(departmentParentId, addDate); + return () -> departmentService.listDepartmentSimpleByParentIdAndAddDate(departmentParentId, addDate); } @ApiOperation(value = "通过上级ID和更新获取组织部门全部新增和修改的列表(简单格式)", notes = "通过上级ID和更新获取组织部门全部新增和修改的列表(简单格式)接口") @@ -128,11 +135,11 @@ public class DepartmentResourceController extends BaseController { }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("listdepartmentsimplebyparentidandupdatedate/{departmentParentId}/{updateDate}") - public List listDepartmentSimpleByParentIdAndUpdateDate(@PathVariable("departmentParentId") String departmentParentId, @PathVariable("updateDate") String updateDate) throws SearchException { + public Callable> listDepartmentSimpleByParentIdAndUpdateDate(@PathVariable("departmentParentId") String departmentParentId, @PathVariable("updateDate") String updateDate) throws SearchException { if (!RegexUtil.isDate(updateDate)) { throw new ParamsException("日期格式错误"); } - return departmentService.listDepartmentSimpleByParentIdAndUpdateDate(departmentParentId, updateDate); + return () -> departmentService.listDepartmentSimpleByParentIdAndUpdateDate(departmentParentId, updateDate); } @ApiOperation(value = "通过部门ID获取组织部门详情(简单格式)", notes = "通过部门ID获取组织部门详情(简单格式)接口") @@ -153,8 +160,8 @@ public class DepartmentResourceController extends BaseController { }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("listdepartmentsimplebyparentid/{departmentParentIntId}") - public List listDepartmentSimpleByParentId(@PathVariable("departmentParentIntId") Long departmentParentIntId) throws SearchException { - return departmentService.listDepartmentSimpleByParentIntId(departmentParentIntId); + public Callable> listDepartmentSimpleByParentId(@PathVariable("departmentParentIntId") Long departmentParentIntId) throws SearchException { + return () -> departmentService.listDepartmentSimpleByParentIntId(departmentParentIntId); } @ApiOperation(value = "通过上级ID和添加获取组织部门全部增量列表(简单格式)", notes = "通过上级ID和添加获取组织部门全部增量列表(简单格式)接口") @@ -165,11 +172,11 @@ public class DepartmentResourceController extends BaseController { }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("listdepartmentsimplebyparentidandadddate/{departmentParentIntId}/{addDate}") - public List listDepartmentSimpleByParentIdAndAddDate(@PathVariable("departmentParentIntId") Long departmentParentIntId, @PathVariable("addDate") String addDate) throws SearchException { + public Callable> listDepartmentSimpleByParentIdAndAddDate(@PathVariable("departmentParentIntId") Long departmentParentIntId, @PathVariable("addDate") String addDate) throws SearchException { if (!RegexUtil.isDate(addDate)) { throw new ParamsException("日期格式错误"); } - return departmentService.listDepartmentSimpleByParentIntIdAndAddDate(departmentParentIntId, addDate); + return () -> departmentService.listDepartmentSimpleByParentIntIdAndAddDate(departmentParentIntId, addDate); } @ApiOperation(value = "通过上级ID和更新获取组织部门全部新增和修改的列表(简单格式)", notes = "通过上级ID和更新获取组织部门全部新增和修改的列表(简单格式)接口") @@ -180,11 +187,11 @@ public class DepartmentResourceController extends BaseController { }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) @GetMapping("listdepartmentsimplebyparentidandupdatedate/{departmentParentIntId}/{updateDate}") - public List listDepartmentSimpleByParentIdAndUpdateDate(@PathVariable("departmentParentIntId") Long departmentParentIntId, @PathVariable("updateDate") String updateDate) throws SearchException { + public Callable> listDepartmentSimpleByParentIdAndUpdateDate(@PathVariable("departmentParentIntId") Long departmentParentIntId, @PathVariable("updateDate") String updateDate) throws SearchException { if (!RegexUtil.isDate(updateDate)) { throw new ParamsException("日期格式错误"); } - return departmentService.listDepartmentSimpleByParentIntIdAndUpdateDate(departmentParentIntId, updateDate); + return () -> departmentService.listDepartmentSimpleByParentIntIdAndUpdateDate(departmentParentIntId, updateDate); } @ApiOperation(value = "通过部门ID获取组织部门详情(简单格式)", notes = "通过部门ID获取组织部门详情(简单格式)接口") diff --git a/src/main/java/com/cm/serviceusercenter/service/system/department/impl/DepartmentServiceImpl.java b/src/main/java/com/cm/serviceusercenter/service/system/department/impl/DepartmentServiceImpl.java index 0aa5a5c..00b3f15 100644 --- a/src/main/java/com/cm/serviceusercenter/service/system/department/impl/DepartmentServiceImpl.java +++ b/src/main/java/com/cm/serviceusercenter/service/system/department/impl/DepartmentServiceImpl.java @@ -228,7 +228,7 @@ public class DepartmentServiceImpl extends BaseService implements IDepartmentSer @Override public List listDepartmentsAll(Map params) throws SearchException { - List departmentDTOs = departmentDao.listDepartments(params); + List departmentDTOs = listDepartments(params); listSubDepartments(departmentDTOs, params); return departmentDTOs; } @@ -267,7 +267,7 @@ public class DepartmentServiceImpl extends BaseService implements IDepartmentSer @Override public SuccessResultList> listPageDepartment(ListPage page) throws SearchException { PageHelper.startPage(page.getPage(), page.getRows()); - List departmentDTOs = departmentDao.listDepartments(page.getParams()); + List departmentDTOs = listDepartments(page.getParams()); PageInfo pageInfo = new PageInfo<>(departmentDTOs); return new SuccessResultList<>(departmentDTOs, pageInfo.getPageNum(), pageInfo.getTotal()); } @@ -294,7 +294,8 @@ public class DepartmentServiceImpl extends BaseService implements IDepartmentSer @Override public List listDepartments(Map params) throws SearchException { - return departmentDao.listDepartments(params); + List departmentDTOs = departmentDao.listDepartments(params); + return ArrayListUtil.deepClone(departmentDTOs, DepartmentDTO.class); } @Override @@ -338,7 +339,7 @@ public class DepartmentServiceImpl extends BaseService implements IDepartmentSer @Override public List listDepartmentId(Map params) throws SearchException { List departmentIds = new ArrayList<>(); - List departmentDTOs = departmentDao.listDepartments(params); + List departmentDTOs = listDepartments(params); for (DepartmentDTO departmentDTO : departmentDTOs) { departmentIds.add(departmentDTO.getDepartmentId()); } @@ -779,7 +780,7 @@ public class DepartmentServiceImpl extends BaseService implements IDepartmentSer private void listSubDepartments(List departmentDTOs, Map params) throws SearchException { for (DepartmentDTO departmentDTO : departmentDTOs) { params.put("departmentParentId", departmentDTO.getDepartmentId()); - List subDepartmentDTOs = departmentDao.listDepartments(params); + List subDepartmentDTOs = listDepartments(params); departmentDTO.setSubDepartments(subDepartmentDTOs); listSubDepartments(subDepartmentDTOs, params); } diff --git a/src/main/resources/mybatis/mapper/system/department/department-mapper.xml b/src/main/resources/mybatis/mapper/system/department/department-mapper.xml index 343777c..9947341 100644 --- a/src/main/resources/mybatis/mapper/system/department/department-mapper.xml +++ b/src/main/resources/mybatis/mapper/system/department/department-mapper.xml @@ -424,7 +424,7 @@ - SELECT department_id, department_parent_id, From 94c88f8eea17d794dc491817d373c1122b06788b Mon Sep 17 00:00:00 2001 From: wanggeng888 <450292408@qq.com> Date: Thu, 27 May 2021 18:16:28 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/app/apis/appversion/AppVersionAppController.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/cm/serviceusercenter/controller/app/apis/appversion/AppVersionAppController.java b/src/main/java/com/cm/serviceusercenter/controller/app/apis/appversion/AppVersionAppController.java index b3eb13b..e3c572f 100644 --- a/src/main/java/com/cm/serviceusercenter/controller/app/apis/appversion/AppVersionAppController.java +++ b/src/main/java/com/cm/serviceusercenter/controller/app/apis/appversion/AppVersionAppController.java @@ -55,7 +55,7 @@ public class AppVersionAppController extends AbstractController { @ApiImplicitParam(name = "appVersionId", value = "app版本ID", paramType = "path") }) @ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)}) - @GetMapping("download/{appVersionId}") + @GetMapping("downloadapp/{appVersionId}") public void download(@PathVariable("appVersionId") String appVersionId, HttpServletRequest request, HttpServletResponse response) throws SearchException, FileException, UpdateException { Map params = getParams(); params.put("appVersionId", appVersionId);