Merge remote-tracking branch 'origin/main' into main

# Conflicts:
#	src/main/resources/application-test.yml
This commit is contained in:
WenG 2021-06-16 20:11:48 +08:00
commit dd2c087129
11 changed files with 94 additions and 54 deletions

View File

@ -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;
@ -54,7 +56,7 @@ public class AppVersionAppController extends AbstractController {
})
@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 {
public void download(@PathVariable("appVersionId") String appVersionId, HttpServletRequest request, HttpServletResponse response) throws SearchException, FileException, UpdateException {
Map<String, Object> params = getParams();
params.put("appVersionId", appVersionId);
params.put("isRelease", 1);

View File

@ -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<ZTreeDTO> listDepartments(@PathVariable("departmentParentId") String departmentParentId) throws SearchException {
Map<String, Object> params = new HashMap<>(0);
params.put("departmentParentId", departmentParentId);
return departmentService.listZTreeDepartment(params);
public Callable<List<ZTreeDTO>> listDepartments(@PathVariable("departmentParentId") String departmentParentId) throws SearchException {
return () -> {
Map<String, Object> 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<DepartmentDTO> listAllDepartments(@PathVariable("departmentParentId") String departmentParentId) throws SearchException {
Map<String, Object> params = new HashMap<>(0);
params.put("departmentParentId", departmentParentId);
return departmentService.listDepartmentsAll(params);
public Callable<List<DepartmentDTO>> listAllDepartments(@PathVariable("departmentParentId") String departmentParentId) throws SearchException {
return () -> {
Map<String, Object> 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<ZTreeDTO> listZTreeDepartmentWithUser(@RequestParam(required = false) String id) throws SearchException {
String departmentParentId = "0";
if (!StringUtils.isBlank(id)) {
departmentParentId = id;
}
return departmentService.listZTreeDepartmentWithUser(departmentParentId);
public Callable<List<ZTreeDTO>> 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<DepartmentSimpleDTO> listDepartmentSimpleByParentId(@PathVariable("departmentParentId") String departmentParentId) throws SearchException {
return departmentService.listDepartmentSimpleByParentId(departmentParentId);
public Callable<List<DepartmentSimpleDTO>> 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<DepartmentSimpleDTO> listDepartmentSimpleByParentIdAndAddDate(@PathVariable("departmentParentId") String departmentParentId, @PathVariable("addDate") String addDate) throws SearchException {
public Callable<List<DepartmentSimpleDTO>> 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<DepartmentSimpleDTO> listDepartmentSimpleByParentIdAndUpdateDate(@PathVariable("departmentParentId") String departmentParentId, @PathVariable("updateDate") String updateDate) throws SearchException {
public Callable<List<DepartmentSimpleDTO>> 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<DepartmentSimpleDTO> listDepartmentSimpleByParentId(@PathVariable("departmentParentIntId") Long departmentParentIntId) throws SearchException {
return departmentService.listDepartmentSimpleByParentIntId(departmentParentIntId);
public Callable<List<DepartmentSimpleDTO>> 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<DepartmentSimpleDTO> listDepartmentSimpleByParentIdAndAddDate(@PathVariable("departmentParentIntId") Long departmentParentIntId, @PathVariable("addDate") String addDate) throws SearchException {
public Callable<List<DepartmentSimpleDTO>> 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<DepartmentSimpleDTO> listDepartmentSimpleByParentIdAndUpdateDate(@PathVariable("departmentParentIntId") Long departmentParentIntId, @PathVariable("updateDate") String updateDate) throws SearchException {
public Callable<List<DepartmentSimpleDTO>> 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获取组织部门详情简单格式接口")

View File

@ -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<List<MenuDTO>> listMenuByClientId(@PathVariable("clientId") String clientId, @PathVariable("userId") String userId) throws Exception {
return menuService.listMenuByClientIdAndUserId(clientId, userId);
public Callable<SuccessResultData<List<MenuDTO>>> listMenuByClientId(@PathVariable("clientId") String clientId, @PathVariable("userId") String userId, HttpServletRequest httpServletRequest) throws Exception {
return () -> menuService.listMenuByClientIdAndUserId(clientId, userId);
}
}

View File

@ -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<String, Object> 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<String, Object> params = getParams();
params.put("oldPassword", appChangePasswordVO.getOldPassword());
params.put("newPassword", appChangePasswordVO.getNewPassword());
return userService.updateUserPassword(params);
return userService.updateUserPasswordByUserId(userId, params);
}
@ApiOperation(value = "获取密码状态", notes = "获取密码状态接口")

View File

@ -228,7 +228,7 @@ public class DepartmentServiceImpl extends BaseService implements IDepartmentSer
@Override
public List<DepartmentDTO> listDepartmentsAll(Map<String, Object> params) throws SearchException {
List<DepartmentDTO> departmentDTOs = departmentDao.listDepartments(params);
List<DepartmentDTO> departmentDTOs = listDepartments(params);
listSubDepartments(departmentDTOs, params);
return departmentDTOs;
}
@ -267,7 +267,7 @@ public class DepartmentServiceImpl extends BaseService implements IDepartmentSer
@Override
public SuccessResultList<List<DepartmentDTO>> listPageDepartment(ListPage page) throws SearchException {
PageHelper.startPage(page.getPage(), page.getRows());
List<DepartmentDTO> departmentDTOs = departmentDao.listDepartments(page.getParams());
List<DepartmentDTO> departmentDTOs = listDepartments(page.getParams());
PageInfo<DepartmentDTO> 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<DepartmentDTO> listDepartments(Map<String, Object> params) throws SearchException {
return departmentDao.listDepartments(params);
List<DepartmentDTO> 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<String> listDepartmentId(Map<String, Object> params) throws SearchException {
List<String> departmentIds = new ArrayList<>();
List<DepartmentDTO> departmentDTOs = departmentDao.listDepartments(params);
List<DepartmentDTO> 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<DepartmentDTO> departmentDTOs, Map<String, Object> params) throws SearchException {
for (DepartmentDTO departmentDTO : departmentDTOs) {
params.put("departmentParentId", departmentDTO.getDepartmentId());
List<DepartmentDTO> subDepartmentDTOs = departmentDao.listDepartments(params);
List<DepartmentDTO> subDepartmentDTOs = listDepartments(params);
departmentDTO.setSubDepartments(subDepartmentDTOs);
listSubDepartments(subDepartmentDTOs, params);
}

View File

@ -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<String, Object> params) throws SearchException, UpdateException;
/**
* 修改用户密码
* @param userId
* @param params
* @return
* @throws SearchException
* @throws UpdateException
*/
SuccessResult updateUserPasswordByUserId(String userId, Map<String, Object> params) throws SearchException, UpdateException;
/**
* 获取用户APP设备列表
*
@ -873,4 +881,6 @@ public interface IUserService {
*/
List<UserDepartmentResourceBO> listUserDepartmentResourceByPositionIds(List<String> positionIds) throws SearchException;
}

View File

@ -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<String, Object> 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<UserAppDevicePO> listUserAppDevice(Map<String, Object> params) throws SearchException {
return userDao.listUserAppDevice(params);

View File

@ -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:
@ -28,11 +28,14 @@ spring:
max-request-size: 1GB
datasource:
druid:
url: jdbc:mysql://127.0.0.1:3306/db_cloud?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC
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: root
password: root
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

View File

@ -424,7 +424,7 @@
</select>
<!-- 组织部门列表 -->
<select id="listDepartments" parameterType="map" resultMap="departmentDTO" useCache="false">
<select id="listDepartments" parameterType="map" resultMap="departmentDTO" useCache="true">
SELECT
department_id,
department_parent_id,

View File

@ -146,7 +146,7 @@
</select>
<!-- 菜单列表 -->
<select id="listMenus" parameterType="map" resultMap="menuDTO" useCache="false">
<select id="listMenus" parameterType="map" resultMap="menuDTO" useCache="true">
SELECT
*
FROM

View File

@ -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;