|
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
+import com.ydtech.aop.request.RequestSingleParam;
|
|
|
import com.ydtech.constants.SysConstants;
|
|
import com.ydtech.constants.SysConstants;
|
|
|
import com.ydtech.core.page.HttpResult;
|
|
import com.ydtech.core.page.HttpResult;
|
|
|
import com.ydtech.core.page.PageRequest;
|
|
import com.ydtech.core.page.PageRequest;
|
|
@@ -24,6 +25,8 @@ import com.ydtech.modules.esm.model.EsmUserReferrer;
|
|
|
import com.ydtech.modules.esm.model.vo.EsmUserImageQueryVo;
|
|
import com.ydtech.modules.esm.model.vo.EsmUserImageQueryVo;
|
|
|
import com.ydtech.modules.esm.service.EsmUserImageService;
|
|
import com.ydtech.modules.esm.service.EsmUserImageService;
|
|
|
import com.ydtech.modules.esm.service.EsmUserReferrerService;
|
|
import com.ydtech.modules.esm.service.EsmUserReferrerService;
|
|
|
|
|
+import com.ydtech.modules.order.entity.po.InsUploadFiles;
|
|
|
|
|
+import com.ydtech.modules.order.service.InsUploadFilesService;
|
|
|
import com.ydtech.modules.protocol.utils.AssertionUtils;
|
|
import com.ydtech.modules.protocol.utils.AssertionUtils;
|
|
|
import com.ydtech.security.utils.PasswordUtils;
|
|
import com.ydtech.security.utils.PasswordUtils;
|
|
|
import com.ydtech.utils.StringUtils;
|
|
import com.ydtech.utils.StringUtils;
|
|
@@ -34,7 +37,6 @@ import io.swagger.annotations.ApiImplicitParam;
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
-import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
import org.springframework.data.redis.core.StringRedisTemplate;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.util.ObjectUtils;
|
|
import org.springframework.util.ObjectUtils;
|
|
@@ -43,14 +45,11 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
|
-import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
-import java.util.concurrent.TimeUnit;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
import static com.ydtech.constants.RedisConstant.PHONE_VERIFICATION_CODE_KEY;
|
|
import static com.ydtech.constants.RedisConstant.PHONE_VERIFICATION_CODE_KEY;
|
|
|
-import static com.ydtech.constants.RedisConstant.PHONE_VERIFICATION_CODE_KEY_TIME;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -81,6 +80,8 @@ public class SysUserController extends BaseController {
|
|
|
|
|
|
|
|
private final StringRedisTemplate redisTemplate;
|
|
private final StringRedisTemplate redisTemplate;
|
|
|
|
|
|
|
|
|
|
+ private final InsUploadFilesService insUploadFilesService;
|
|
|
|
|
+
|
|
|
// @PreAuthorize("hasAuthority('sys:user:delete')")
|
|
// @PreAuthorize("hasAuthority('sys:user:delete')")
|
|
|
@ApiOperation(value = "逻辑删除")
|
|
@ApiOperation(value = "逻辑删除")
|
|
|
@PostMapping(value = "/deleteFlag")
|
|
@PostMapping(value = "/deleteFlag")
|
|
@@ -370,15 +371,15 @@ public class SysUserController extends BaseController {
|
|
|
//获取用户角色
|
|
//获取用户角色
|
|
|
SysUser user = getUser();
|
|
SysUser user = getUser();
|
|
|
//如果查询后线人员
|
|
//如果查询后线人员
|
|
|
- if(RoleConstants.R22.getCode().equals(pageDto.getDto().getRoleId())){
|
|
|
|
|
- if(RoleConstants.R17.getCode().equals(user.getRoleId())){
|
|
|
|
|
|
|
+ if (RoleConstants.R22.getCode().equals(pageDto.getDto().getRoleId())) {
|
|
|
|
|
+ if (RoleConstants.R17.getCode().equals(user.getRoleId())) {
|
|
|
pageDto.getDto().setRoleId("18,22");
|
|
pageDto.getDto().setRoleId("18,22");
|
|
|
- }else if(RoleConstants.R18.getCode().equals(user.getRoleId())){
|
|
|
|
|
|
|
+ } else if (RoleConstants.R18.getCode().equals(user.getRoleId())) {
|
|
|
pageDto.getDto().setRoleId("22");
|
|
pageDto.getDto().setRoleId("22");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
//设置登录用户的部门
|
|
//设置登录用户的部门
|
|
|
- if("".equals(pageDto.getDto().getDeptId()) || null == pageDto.getDto().getDeptId()){
|
|
|
|
|
|
|
+ if ("".equals(pageDto.getDto().getDeptId()) || null == pageDto.getDto().getDeptId()) {
|
|
|
pageDto.getDto().setDeptId(user.getDeptId());
|
|
pageDto.getDto().setDeptId(user.getDeptId());
|
|
|
}
|
|
}
|
|
|
return HttpResult.ok(sysUserService.gainUserPage(pageDto));
|
|
return HttpResult.ok(sysUserService.gainUserPage(pageDto));
|
|
@@ -431,10 +432,10 @@ public class SysUserController extends BaseController {
|
|
|
if (!ObjectUtils.isEmpty(sysUserRole)) {
|
|
if (!ObjectUtils.isEmpty(sysUserRole)) {
|
|
|
sysUser.setRoleId(StringUtils.toString(sysUserRole.getRoleId()));
|
|
sysUser.setRoleId(StringUtils.toString(sysUserRole.getRoleId()));
|
|
|
}
|
|
}
|
|
|
- if("19".equals(sysUser.getRoleId())){
|
|
|
|
|
|
|
+ if ("19".equals(sysUser.getRoleId())) {
|
|
|
SysUser operator = sysUserService.getById(sysUser.getOperatorCode());
|
|
SysUser operator = sysUserService.getById(sysUser.getOperatorCode());
|
|
|
- sysUser.setReferrerId(operator!=null?operator.getId():"");
|
|
|
|
|
- sysUser.setReferrerName(operator!=null?operator.getName():"");
|
|
|
|
|
|
|
+ sysUser.setReferrerId(operator != null ? operator.getId() : "");
|
|
|
|
|
+ sysUser.setReferrerName(operator != null ? operator.getName() : "");
|
|
|
sysUserVo.setSysUser(sysUser);
|
|
sysUserVo.setSysUser(sysUser);
|
|
|
return HttpResult.ok(sysUserVo);
|
|
return HttpResult.ok(sysUserVo);
|
|
|
}
|
|
}
|
|
@@ -481,7 +482,10 @@ public class SysUserController extends BaseController {
|
|
|
sysUser.setReferrerId(eur.getReferrerId());
|
|
sysUser.setReferrerId(eur.getReferrerId());
|
|
|
sysUser.setReferrerName(eur.getReferrerName());
|
|
sysUser.setReferrerName(eur.getReferrerName());
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
+ InsUploadFiles insUploadFiles = insUploadFilesService.getById(sysUser.getHeadSculpture());
|
|
|
|
|
+ if (null != insUploadFiles) {
|
|
|
|
|
+ sysUser.setHeadSculpture(insUploadFiles.getFilePath());
|
|
|
|
|
+ }
|
|
|
return HttpResult.ok(sysUser);
|
|
return HttpResult.ok(sysUser);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -489,7 +493,7 @@ public class SysUserController extends BaseController {
|
|
|
@ApiOperation(value = "获取可选业务员列表")
|
|
@ApiOperation(value = "获取可选业务员列表")
|
|
|
@GetMapping(value = "/getAllUsers")
|
|
@GetMapping(value = "/getAllUsers")
|
|
|
public HttpResult getAllUsers(@RequestParam(required = false) String userId) {
|
|
public HttpResult getAllUsers(@RequestParam(required = false) String userId) {
|
|
|
- List<SysUser> userList = sysUserService.findAllAgentRoleUser(userId,"20");
|
|
|
|
|
|
|
+ List<SysUser> userList = sysUserService.findAllAgentRoleUser(userId, "20");
|
|
|
return HttpResult.ok(userList);
|
|
return HttpResult.ok(userList);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
@@ -515,27 +519,27 @@ public class SysUserController extends BaseController {
|
|
|
public HttpResult agentRegist(@RequestBody AgentUserDto dto) {
|
|
public HttpResult agentRegist(@RequestBody AgentUserDto dto) {
|
|
|
int noCount = 3;//顺序号是几位的
|
|
int noCount = 3;//顺序号是几位的
|
|
|
|
|
|
|
|
- if(StringUtils.isNullOrEmpty(dto.getFlag())){
|
|
|
|
|
|
|
+ if (StringUtils.isNullOrEmpty(dto.getFlag())) {
|
|
|
return HttpResult.error("个代、出单员标识不能为空");
|
|
return HttpResult.error("个代、出单员标识不能为空");
|
|
|
}
|
|
}
|
|
|
- if (StringUtils.isNullOrEmpty(dto.getMobile())||StringUtils.isNullOrEmpty(dto.getMobileMsg())) {
|
|
|
|
|
|
|
+ if (StringUtils.isNullOrEmpty(dto.getMobile()) || StringUtils.isNullOrEmpty(dto.getMobileMsg())) {
|
|
|
return HttpResult.error("手机号、验证码不能为空");
|
|
return HttpResult.error("手机号、验证码不能为空");
|
|
|
}
|
|
}
|
|
|
- if (StringUtils.isNullOrEmpty(dto.getName())){
|
|
|
|
|
|
|
+ if (StringUtils.isNullOrEmpty(dto.getName())) {
|
|
|
return HttpResult.error("姓名不能为空");
|
|
return HttpResult.error("姓名不能为空");
|
|
|
}
|
|
}
|
|
|
- if(StringUtils.isNullOrEmpty(dto.getPassword())){
|
|
|
|
|
|
|
+ if (StringUtils.isNullOrEmpty(dto.getPassword())) {
|
|
|
return HttpResult.error("密码不能为空");
|
|
return HttpResult.error("密码不能为空");
|
|
|
}
|
|
}
|
|
|
- if (StringUtils.isNullOrEmpty(dto.getReferrerId())){
|
|
|
|
|
|
|
+ if (StringUtils.isNullOrEmpty(dto.getReferrerId())) {
|
|
|
return HttpResult.error("推荐人不能为空");
|
|
return HttpResult.error("推荐人不能为空");
|
|
|
}
|
|
}
|
|
|
- String captcha_redis =(String)redisTemplate.opsForValue().get(PHONE_VERIFICATION_CODE_KEY + dto.getMobile());
|
|
|
|
|
|
|
+ String captcha_redis = (String) redisTemplate.opsForValue().get(PHONE_VERIFICATION_CODE_KEY + dto.getMobile());
|
|
|
redisTemplate.delete(PHONE_VERIFICATION_CODE_KEY + dto.getMobile());
|
|
redisTemplate.delete(PHONE_VERIFICATION_CODE_KEY + dto.getMobile());
|
|
|
- if(captcha_redis == null){
|
|
|
|
|
|
|
+ if (captcha_redis == null) {
|
|
|
return HttpResult.error("验证码已失效");
|
|
return HttpResult.error("验证码已失效");
|
|
|
}
|
|
}
|
|
|
- if(!dto.getMobileMsg().equals(captcha_redis)){
|
|
|
|
|
|
|
+ if (!dto.getMobileMsg().equals(captcha_redis)) {
|
|
|
return HttpResult.error("验证码错误");
|
|
return HttpResult.error("验证码错误");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -571,10 +575,10 @@ public class SysUserController extends BaseController {
|
|
|
String password = PasswordUtils.encode(dto.getPassword(), salt);
|
|
String password = PasswordUtils.encode(dto.getPassword(), salt);
|
|
|
sysUser.setPassword(password);
|
|
sysUser.setPassword(password);
|
|
|
sysUser.setSalt(salt);
|
|
sysUser.setSalt(salt);
|
|
|
- sysUser.setStatus(dto.getFlag().equals("1")?2:1);//1:正常 2:审批中
|
|
|
|
|
|
|
+ sysUser.setStatus(dto.getFlag().equals("1") ? 2 : 1);//1:正常 2:审批中
|
|
|
sysUser.setId(nextPK);
|
|
sysUser.setId(nextPK);
|
|
|
sysUser.setCreateBy("admin");
|
|
sysUser.setCreateBy("admin");
|
|
|
- if(dto.getFlag().equals("2")){
|
|
|
|
|
|
|
+ if (dto.getFlag().equals("2")) {
|
|
|
sysUser.setOperatorCode(recommenderid);
|
|
sysUser.setOperatorCode(recommenderid);
|
|
|
}
|
|
}
|
|
|
sysUserService.save(sysUser);
|
|
sysUserService.save(sysUser);
|
|
@@ -582,10 +586,10 @@ public class SysUserController extends BaseController {
|
|
|
//角色配置
|
|
//角色配置
|
|
|
SysUserRole userRole = new SysUserRole();
|
|
SysUserRole userRole = new SysUserRole();
|
|
|
userRole.setUserId(nextPK);
|
|
userRole.setUserId(nextPK);
|
|
|
- userRole.setRoleId(dto.getFlag().equals("1")?20L:19L);
|
|
|
|
|
|
|
+ userRole.setRoleId(dto.getFlag().equals("1") ? 20L : 19L);
|
|
|
sysUserRoleService.save(userRole);
|
|
sysUserRoleService.save(userRole);
|
|
|
|
|
|
|
|
- if(dto.getFlag().equals("1")){
|
|
|
|
|
|
|
+ if (dto.getFlag().equals("1")) {
|
|
|
esmUserReferrerService.addReferrer(dto.getReferrerId(), nextPK);
|
|
esmUserReferrerService.addReferrer(dto.getReferrerId(), nextPK);
|
|
|
}
|
|
}
|
|
|
return HttpResult.ok("保存成功", sysUser.getId());
|
|
return HttpResult.ok("保存成功", sysUser.getId());
|
|
@@ -740,15 +744,15 @@ public class SysUserController extends BaseController {
|
|
|
if (deptLevel != 5) {
|
|
if (deptLevel != 5) {
|
|
|
throw new SystemException("后线人员只能归属业务部门中");
|
|
throw new SystemException("后线人员只能归属业务部门中");
|
|
|
}
|
|
}
|
|
|
- } else if (RoleConstants.R18.getCode().equals(sysUser.getRoleId())){ // 42 门店长
|
|
|
|
|
- if(deptLevel != 5){
|
|
|
|
|
|
|
+ } else if (RoleConstants.R18.getCode().equals(sysUser.getRoleId())) { // 42 门店长
|
|
|
|
|
+ if (deptLevel != 5) {
|
|
|
throw new SystemException("机构管理员只能归属机构中");
|
|
throw new SystemException("机构管理员只能归属机构中");
|
|
|
}
|
|
}
|
|
|
- } else if(RoleConstants.R17.getCode().equals(sysUser.getRoleId())){
|
|
|
|
|
- if(deptLevel != 4){
|
|
|
|
|
|
|
+ } else if (RoleConstants.R17.getCode().equals(sysUser.getRoleId())) {
|
|
|
|
|
+ if (deptLevel != 4) {
|
|
|
throw new SystemException("部长只能归属于4级");
|
|
throw new SystemException("部长只能归属于4级");
|
|
|
}
|
|
}
|
|
|
- }else {
|
|
|
|
|
|
|
+ } else {
|
|
|
throw new SystemException("角色id有误");
|
|
throw new SystemException("角色id有误");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -757,8 +761,6 @@ public class SysUserController extends BaseController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
@ApiOperation(value = "修改用户详情信息")
|
|
@ApiOperation(value = "修改用户详情信息")
|
|
|
@PostMapping(value = "/updateUserInfo/{userId}")
|
|
@PostMapping(value = "/updateUserInfo/{userId}")
|
|
|
@ApiImplicitParams({
|
|
@ApiImplicitParams({
|
|
@@ -778,17 +780,23 @@ public class SysUserController extends BaseController {
|
|
|
|
|
|
|
|
|
|
|
|
|
@PostMapping(value = "/realNameAuth")
|
|
@PostMapping(value = "/realNameAuth")
|
|
|
- @ApiOperation(value = "实名认证", notes = "" +
|
|
|
|
|
- "参数1:姓名" +
|
|
|
|
|
|
|
+ @ApiOperation(value = "实名认证", notes = "参数1:姓名" +
|
|
|
"</br>参数2:身份证号")
|
|
"</br>参数2:身份证号")
|
|
|
public HttpResult realNameAuth(@RequestBody BaseDto dto) {
|
|
public HttpResult realNameAuth(@RequestBody BaseDto dto) {
|
|
|
SysUser sysUser = sysUserService.getById(getUserId());
|
|
SysUser sysUser = sysUserService.getById(getUserId());
|
|
|
sysUser.setName(dto.getParam1());
|
|
sysUser.setName(dto.getParam1());
|
|
|
sysUser.setIdentity(dto.getParam2());
|
|
sysUser.setIdentity(dto.getParam2());
|
|
|
// sysUser.setStatus(1);
|
|
// sysUser.setStatus(1);
|
|
|
-
|
|
|
|
|
return HttpResult.ok(sysUserService.updateById(sysUser));
|
|
return HttpResult.ok(sysUserService.updateById(sysUser));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @PostMapping("/modifyingTheAvatar")
|
|
|
|
|
+ @ApiOperation(value = "修改头像")
|
|
|
|
|
+ public HttpResult modifyingTheAvatar(@RequestSingleParam("imagesId") String imagesId) {
|
|
|
|
|
+ SysUser sysUser = sysUserService.getById(getUserId());
|
|
|
|
|
+ sysUser.setHeadSculpture(imagesId);
|
|
|
|
|
+ sysUserService.updateById(sysUser);
|
|
|
|
|
+ return HttpResult.ok();
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
}
|
|
}
|