提交 7bfe9737 作者: 张小凤

ResultAndUser(update)

上级 4885ed4b
......@@ -31,9 +31,7 @@ public class CodeUtil {
}
public static String createRoleNo() {
StringBuffer sb = new StringBuffer();
sb.append("A");
sb.append(CodeUtil.getRandomNum(4));
return sb.toString();
String s = "A" + System.currentTimeMillis();
return s;
}
}
......@@ -61,11 +61,4 @@ public class RoleController extends BaseController {
}
@ApiOperation(value = "角色管理-当前角色绑定了那些账号")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("roleAccountList")
public ResultBody<RoleInfoDTO> roleAccountList(@ApiParam(value = "角色id", required = true) @RequestParam Integer id) {
return roleService.roleAccountList(id);
}
}
......@@ -3,8 +3,8 @@ package com.mmc.iuav.user.controller;
import com.mmc.iuav.group.Page;
import com.mmc.iuav.group.Update;
import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.model.dto.RoleInfoDTO;
import com.mmc.iuav.user.model.dto.UserAccountSimpleDTO;
import com.mmc.iuav.user.model.qo.BUserAccountQO;
import com.mmc.iuav.user.model.qo.UserAccountQO;
import com.mmc.iuav.user.model.vo.UserAccountVO;
import com.mmc.iuav.user.service.UserAccountService;
......@@ -23,86 +23,86 @@ import java.util.List;
@Api(tags = "小程序用户账号相关接口")
@RequestMapping("/user-account/")
@RestController
public class UserAccountController extends BaseController{
public class UserAccountController extends BaseController {
@Autowired
private UserAccountService userAccountService;
@ApiOperation(value = "客户列表")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = UserAccountVO.class) })
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = UserAccountVO.class)})
@PostMapping("listAppUser")
public ResultBody<UserAccountVO> listAppUser(@Validated(value = {Page.class})@RequestBody UserAccountQO userAccountQO){
public ResultBody<UserAccountVO> listAppUser(@Validated(value = {Page.class}) @RequestBody UserAccountQO userAccountQO) {
return userAccountService.listAppUser(userAccountQO);
}
@ApiOperation(value = "获取用户信息")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = UserAccountVO.class) })
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = UserAccountVO.class)})
@GetMapping("info")
public ResultBody info(HttpServletRequest request) {
return ResultBody.success(userAccountService.getUserAccountById(this.getUserLoginInfoFromRedis(request).getUserAccountId()));
}
@ApiOperation(value = "修改用户信息")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = ResultBody.class) })
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@PostMapping("update")
public ResultBody update(@Validated(value = {Update.class})@RequestBody UserAccountVO userAccountVO){
public ResultBody update(@Validated(value = {Update.class}) @RequestBody UserAccountVO userAccountVO) {
return userAccountService.update(userAccountVO);
}
@ApiOperation(value = "获取用户基本信息", hidden = true)
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = UserAccountSimpleDTO.class) })
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = UserAccountSimpleDTO.class)})
@GetMapping("feignGetUserSimpleInfo")
public UserAccountSimpleDTO feignGetUserSimpleInfo(@RequestParam Integer userAccountId){
public UserAccountSimpleDTO feignGetUserSimpleInfo(@RequestParam Integer userAccountId) {
return userAccountService.getUserSimpleInfo(userAccountId);
}
@ApiOperation(value = "根据用户地区查询后台用户id", hidden = true)
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = UserAccountSimpleDTO.class) })
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = UserAccountSimpleDTO.class)})
@GetMapping("feignListUserAccountIds")
public List<Integer>feignListUserAccountIds(@RequestParam Integer provinceCode, @RequestParam(required = false) Integer cityCode, @RequestParam(required = false) Integer districtCode){
public List<Integer> feignListUserAccountIds(@RequestParam Integer provinceCode, @RequestParam(required = false) Integer cityCode, @RequestParam(required = false) Integer districtCode) {
return userAccountService.feignListUserAccountIds(provinceCode, cityCode, districtCode);
}
@ApiOperation(value = "授权手机号")
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = Integer.class) })
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = Integer.class)})
@GetMapping("getUserPhoneNumber")
public ResultBody getUserPhoneNumber(HttpServletRequest request,
@ApiParam(value = "授权手机号code", required = true) @RequestParam String code) {
@ApiParam(value = "授权手机号code", required = true) @RequestParam String code) {
return userAccountService.getUserPhoneNumber(this.getUserLoginInfoFromRedis(request).getUserAccountId(), code);
}
@ApiOperation(value = "根据用户id查询用户信息", hidden = true)
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = UserAccountSimpleDTO.class) })
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = UserAccountSimpleDTO.class)})
@PostMapping("feignListUserAccountByIds")
public List<UserAccountSimpleDTO> feignListUserAccountByIds(@RequestBody List<Integer> ids){
public List<UserAccountSimpleDTO> feignListUserAccountByIds(@RequestBody List<Integer> ids) {
return userAccountService.feignListUserAccountByIds(ids);
}
@ApiOperation(value = "根据条件查询用户信息", hidden = true)
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = UserAccountSimpleDTO.class) })
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = UserAccountSimpleDTO.class)})
@PostMapping("feignListAppUserAccount")
public List<UserAccountSimpleDTO> feignListAppUserAccount(@ApiParam(value = "账号查询QO", required = true) @RequestBody UserAccountQO userAccountQO) {
public List<UserAccountSimpleDTO> feignListAppUserAccount(@ApiParam(value = "账号查询QO", required = true) @RequestBody UserAccountQO userAccountQO) {
return userAccountService.feignListUserAccount(userAccountQO);
}
@ApiOperation(value = "根据用户ids上级推荐人信息", hidden = true)
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = UserAccountSimpleDTO.class) })
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = UserAccountSimpleDTO.class)})
@PostMapping("feignListRcdUserInfo")
public List<UserAccountSimpleDTO> feignListRcdUserInfo(@RequestBody List<Integer> userIds){
public List<UserAccountSimpleDTO> feignListRcdUserInfo(@RequestBody List<Integer> userIds) {
return userAccountService.feignListRcdUserInfo(userIds);
}
@ApiOperation(value = "查询上级推荐人id", hidden = true)
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = Integer.class) })
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = Integer.class)})
@GetMapping("feignGetSuperiorRef")
public Integer feignGetSuperiorRef(@RequestParam Integer userAccountId){
public Integer feignGetSuperiorRef(@RequestParam Integer userAccountId) {
return userAccountService.feignGetSuperiorRef(userAccountId);
}
@ApiOperation(value = "查询上级推荐人信息", hidden = true)
@ApiResponses({ @ApiResponse(code = 200, message = "OK", response = UserAccountSimpleDTO.class) })
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = UserAccountSimpleDTO.class)})
@GetMapping("feignGetUserRcdInfo")
public UserAccountSimpleDTO feignGetUserRcdInfo(@RequestParam Integer userAccountId){
public UserAccountSimpleDTO feignGetUserRcdInfo(@RequestParam Integer userAccountId) {
return userAccountService.feignGetUserRcdInfo(userAccountId);
}
......@@ -114,5 +114,12 @@ public class UserAccountController extends BaseController{
}
@ApiOperation(value = "角色管理-当前角色绑定了那些账号")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("roleAccountList")
public ResultBody<RoleInfoDTO> roleAccountList(@ApiParam(value = "角色id", required = true) @RequestParam Integer id) {
return userAccountService.roleAccountList(id);
}
}
package com.mmc.iuav.user.dao;
import com.mmc.iuav.user.entity.RoleInfoDO;
import com.mmc.iuav.user.entity.UserAccountDO;
import com.mmc.iuav.user.model.qo.RoleInfoQO;
import org.apache.ibatis.annotations.Mapper;
......@@ -35,7 +34,6 @@ public interface RoleDao {
Integer countNotDelUserAccountByRole(Integer id);
List<UserAccountDO> roleAccountList(Integer id);
}
......@@ -17,6 +17,7 @@ import java.util.List;
public interface UserServiceDao {
/**
* 根据用户unionId查询用户信息
*
* @param unionId
* @return
*/
......@@ -24,12 +25,14 @@ public interface UserServiceDao {
/**
* 插入用户信息
*
* @param userAccountDO
*/
void insertUserAccount(UserAccountDO userAccountDO);
/**
* 根据用户id查询用户信息
*
* @param userAccountId
* @return
*/
......@@ -37,12 +40,14 @@ public interface UserServiceDao {
/**
* 修改用户信息
*
* @param userAccountDO
*/
void update(UserAccountDO userAccountDO);
/**
* 根据用户地区查询后台用户id
*
* @param provinceCode
* @param cityCode
* @param districtCode
......@@ -52,6 +57,7 @@ public interface UserServiceDao {
/**
* 登录账号密码查询用户信息
*
* @param accountNo
* @param passWord
* @return
......@@ -60,6 +66,7 @@ public interface UserServiceDao {
/**
* 批量获取用户信息
*
* @param userAccountQO
* @return
*/
......@@ -67,6 +74,7 @@ public interface UserServiceDao {
/**
* 删除用户
*
* @param removeNO
* @param userAccountId
*/
......@@ -74,6 +82,7 @@ public interface UserServiceDao {
/**
* 根据账号名称查询数量
*
* @param excludeId
* @param accountNo
* @return
......@@ -82,6 +91,7 @@ public interface UserServiceDao {
/**
* 查询用户数量
*
* @param param
* @return
*/
......@@ -89,6 +99,7 @@ public interface UserServiceDao {
/**
* 查询用户信息
*
* @param param
* @return
*/
......@@ -96,6 +107,7 @@ public interface UserServiceDao {
/**
* 修改用户密码
*
* @param id
* @param passWord
*/
......@@ -103,6 +115,7 @@ public interface UserServiceDao {
/**
* 获取用户密码
*
* @param id
* @return
*/
......@@ -110,13 +123,15 @@ public interface UserServiceDao {
/**
* 根据id查询用户信息
*
* @param userIds
* @return
*/
List<UserAccountDO> listUserAccountByIds(@Param("userIds")List<Integer> userIds);
List<UserAccountDO> listUserAccountByIds(@Param("userIds") List<Integer> userIds);
/**
* 获取用户推荐人信息
*
* @param userIds
* @return
*/
......@@ -124,6 +139,7 @@ public interface UserServiceDao {
/**
* 获取推荐人信息
*
* @param userAccountId
* @return
*/
......@@ -131,6 +147,7 @@ public interface UserServiceDao {
/**
* 获取用户推荐信息
*
* @param userAccountId
* @return
*/
......@@ -138,6 +155,7 @@ public interface UserServiceDao {
/**
* 用户数量
*
* @param param
* @return
*/
......@@ -145,8 +163,17 @@ public interface UserServiceDao {
/**
* 用户信息
*
* @param param
* @return
*/
List<UserAccountDO> listAppUser(UserAccountQO param);
/**
* 角色关联了那些id
*
* @param id
* @return
*/
List<UserAccountDO> roleAccountList(Integer id);
}
package com.mmc.iuav.user.entity;
import com.alibaba.fastjson2.annotation.JSONField;
import com.mmc.iuav.user.model.dto.RoleInfoDTO;
import com.mmc.iuav.user.model.vo.RoleInfoVO;
import lombok.AllArgsConstructor;
......@@ -8,6 +9,7 @@ import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
import java.util.List;
/**
* @Author small
......@@ -41,13 +43,15 @@ public class RoleInfoDO {
/**
* 创建时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
/**
* 更新时间
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date updateTime;
/**
* 账号id
* 创建角色账号id
*/
private Integer userAccountId;
/**
......@@ -55,6 +59,16 @@ public class RoleInfoDO {
*/
private String userName;
/**
* 角色关联账号表
*/
List<UserRoleRel> userRoleRelList;
/**
* 角色关联菜单
*/
List<MenuInfoDO> menuInfoDOList;
/**
* DTO转换
......
package com.mmc.iuav.user.entity;
import com.alibaba.fastjson2.annotation.JSONField;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @Author small
* @Date 2023/7/12 13:29
* @Version 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class UserRoleRel {
/**
* 角色与账号关联表id
*/
private Integer id;
/**
* 账号关联角色id
*/
private Integer userAccountId;
/**
* 角色id
*/
private Integer roleId;
/**
* 角色与账号关联表id
*/
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
private Date createTime;
}
......@@ -21,5 +21,5 @@ public interface RoleService {
PageResult listPageRoleInfo(RoleInfoQO param, LoginSuccessDTO userLoginInfoFromRedis);
ResultBody roleAccountList(Integer id);
}
......@@ -4,7 +4,6 @@ import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.user.entity.UserAccountDO;
import com.mmc.iuav.user.model.dto.UserAccountSimpleDTO;
import com.mmc.iuav.user.model.qo.BUserAccountQO;
import com.mmc.iuav.user.model.qo.LoginUserQO;
import com.mmc.iuav.user.model.qo.UserAccountQO;
import com.mmc.iuav.user.model.vo.BUserAccountVO;
import com.mmc.iuav.user.model.vo.UserAccountVO;
......@@ -18,6 +17,7 @@ import java.util.List;
public interface UserAccountService {
/**
* Get the user account
*
* @param unionId
* @return
*/
......@@ -25,12 +25,14 @@ public interface UserAccountService {
/**
* Insert the user account
*
* @param userAccountDO
*/
void insertUserAccount(UserAccountDO userAccountDO);
/**
* 通过用户id获取用户信息
*
* @param userAccountId
* @return
*/
......@@ -38,6 +40,7 @@ public interface UserAccountService {
/**
* 修改用户信息
*
* @param userAccountVO
* @return
*/
......@@ -45,6 +48,7 @@ public interface UserAccountService {
/**
* 获取用户基本信息
*
* @param userAccountId
* @return
*/
......@@ -52,6 +56,7 @@ public interface UserAccountService {
/**
* 根据用户地区查询后台用户id
*
* @param provinceCode
* @param cityCode
* @param districtCode
......@@ -61,6 +66,7 @@ public interface UserAccountService {
/**
* 添加后台用户
*
* @param bUserAccountVO
* @return
*/
......@@ -68,6 +74,7 @@ public interface UserAccountService {
/**
* 删除用户信
*
* @param userAccountId
* @return
*/
......@@ -75,6 +82,7 @@ public interface UserAccountService {
/**
* 后台用户列表
*
* @param bUserAccountQO
* @return
*/
......@@ -82,6 +90,7 @@ public interface UserAccountService {
/**
* 登录账号密码查询用户信息
*
* @param accountNo
* @param passWord
* @return
......@@ -90,6 +99,7 @@ public interface UserAccountService {
/**
* 内部获取用户列表
*
* @param userAccountQO
* @return
*/
......@@ -97,6 +107,7 @@ public interface UserAccountService {
/**
* 修改用户信息
*
* @param bUserAccountVO
* @return
*/
......@@ -104,6 +115,7 @@ public interface UserAccountService {
/**
* 修改用户密码
*
* @param account
* @return
*/
......@@ -111,6 +123,7 @@ public interface UserAccountService {
/**
* 验证用户密码
*
* @param id
* @param authPwd
* @return
......@@ -119,6 +132,7 @@ public interface UserAccountService {
/**
* 授权手机号
*
* @param id
* @param code
* @return
......@@ -127,6 +141,7 @@ public interface UserAccountService {
/**
* 根据id获取用户信息
*
* @param ids
* @return
*/
......@@ -134,6 +149,7 @@ public interface UserAccountService {
/**
* 根据用户id获取推荐人信息
*
* @param userIds
* @return
*/
......@@ -141,6 +157,7 @@ public interface UserAccountService {
/**
* 获取推荐人id
*
* @param userAccountId
* @return
*/
......@@ -148,6 +165,7 @@ public interface UserAccountService {
/**
* 获取推荐人信息
*
* @param userAccountId
* @return
*/
......@@ -155,6 +173,7 @@ public interface UserAccountService {
/**
* 用户列表
*
* @param userAccountQO
* @return
*/
......@@ -162,8 +181,18 @@ public interface UserAccountService {
/**
* 删除小程序用户
*
* @param userAccountId
* @return
*/
ResultBody removeAppAccount(Integer userAccountId);
/**
* 角色关联了那些账号
*
* @param id
* @return
*/
ResultBody roleAccountList(Integer id);
}
......@@ -6,16 +6,13 @@ import com.mmc.iuav.response.ResultBody;
import com.mmc.iuav.response.ResultEnum;
import com.mmc.iuav.user.dao.RoleDao;
import com.mmc.iuav.user.entity.RoleInfoDO;
import com.mmc.iuav.user.entity.UserAccountDO;
import com.mmc.iuav.user.model.dto.LoginSuccessDTO;
import com.mmc.iuav.user.model.dto.UserAccountSimpleDTO;
import com.mmc.iuav.user.model.qo.RoleInfoQO;
import com.mmc.iuav.user.model.vo.RoleInfoVO;
import com.mmc.iuav.user.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
......@@ -79,12 +76,5 @@ public class RoleServiceImpl implements RoleService {
}).collect(Collectors.toList()));
}
@Override
public ResultBody roleAccountList(Integer id) {
List<UserAccountDO> roleInfoDOS = roleDao.roleAccountList(id);
List<UserAccountSimpleDTO> accountSimpleDTOS = roleInfoDOS.stream().map(UserAccountDO::buildUserAccountSimpleDTO).collect(Collectors.toList());
return ResultBody.success(accountSimpleDTOS);
}
}
......@@ -13,7 +13,10 @@ import com.mmc.iuav.user.entity.UserRcdDO;
import com.mmc.iuav.user.model.dto.UserAccountSimpleDTO;
import com.mmc.iuav.user.model.qo.BUserAccountQO;
import com.mmc.iuav.user.model.qo.UserAccountQO;
import com.mmc.iuav.user.model.vo.*;
import com.mmc.iuav.user.model.vo.BUserAccountVO;
import com.mmc.iuav.user.model.vo.CompanyAuthVO;
import com.mmc.iuav.user.model.vo.CooperationTagVO;
import com.mmc.iuav.user.model.vo.UserAccountVO;
import com.mmc.iuav.user.mq.MqProducer;
import com.mmc.iuav.user.service.CompanyAuthService;
import com.mmc.iuav.user.service.UserAccountService;
......@@ -74,7 +77,7 @@ public class UserAccountServiceImpl implements UserAccountService {
CompanyAuthVO companyAuthVO = companyAuthService.getCompanyAuthByUId(userAccountId);
if (companyAuthVO != null) {
userAccountVO.setCompanyAuthStatus(companyAuthVO.getAuthStatus());
}else {
} else {
userAccountVO.setCompanyAuthStatus(0);
}
List<CooperationTagDO> cooperationTagDOS = cooperationDao.listUserCooperationTag(userAccountId);
......@@ -96,18 +99,18 @@ public class UserAccountServiceImpl implements UserAccountService {
@Override
public UserAccountSimpleDTO getUserSimpleInfo(Integer userAccountId) {
UserAccountDO userAccountDO = userServiceDao.getUserAccountById(userAccountId);
if (userAccountDO == null){
if (userAccountDO == null) {
return null;
}
UserAccountSimpleDTO userAccountSimpleDTO = userAccountDO.buildUserAccountSimpleDTO();
CompanyAuthVO companyAuthVO = companyAuthService.getCompanyAuthByUId(userAccountId);
if (companyAuthVO != null) {
userAccountSimpleDTO.setCompanyAuthStatus(companyAuthVO.getAuthStatus());
}else {
} else {
userAccountSimpleDTO.setCompanyAuthStatus(0);
}
List<CooperationTagDO> cooperationTagDOS = cooperationDao.listUserCooperationTag(userAccountId);
if (!CollectionUtils.isEmpty(cooperationTagDOS)){
if (!CollectionUtils.isEmpty(cooperationTagDOS)) {
List<CooperationTagVO> cooperationTags = cooperationTagDOS.stream().map(CooperationTagDO::buildCooperationTagVO).collect(Collectors.toList());
userAccountSimpleDTO.setCooperationTagVOS(cooperationTags);
}
......@@ -184,15 +187,15 @@ public class UserAccountServiceImpl implements UserAccountService {
return accountSimpleDTOS;
}
public void buildCooperationTagVO(List<UserAccountSimpleDTO> accountSimpleDTOS){
public void buildCooperationTagVO(List<UserAccountSimpleDTO> accountSimpleDTOS) {
List<Integer> uIds = accountSimpleDTOS.stream().map(UserAccountSimpleDTO::getId).collect(Collectors.toList());
//设置用户的渠道等级
List<CooperationTagDO> cooperationTagDOS = cooperationDao.listUserCooperationTagByUIds(uIds);
if (!CollectionUtils.isEmpty(cooperationTagDOS)){
if (!CollectionUtils.isEmpty(cooperationTagDOS)) {
Map<Integer, List<CooperationTagDO>> userTagsMap = cooperationTagDOS.stream().collect(Collectors.groupingBy(CooperationTagDO::getUserAccountId));
for (UserAccountSimpleDTO simpleDTO : accountSimpleDTOS) {
List<CooperationTagDO> tagDOS = userTagsMap.get(simpleDTO.getId());
if (!CollectionUtils.isEmpty(tagDOS)){
if (!CollectionUtils.isEmpty(tagDOS)) {
List<CooperationTagVO> cooperationTagVOS = tagDOS.stream().map(CooperationTagDO::buildCooperationTagVO).collect(Collectors.toList());
simpleDTO.setCooperationTagVOS(cooperationTagVOS);
}
......@@ -253,7 +256,7 @@ public class UserAccountServiceImpl implements UserAccountService {
@Override
public ResultBody getUserPhoneNumber(Integer id, String code) {
String userPhoneNumber = wxService.getUserPhoneNumber(id, code);
if (StringUtils.isBlank(userPhoneNumber)){
if (StringUtils.isBlank(userPhoneNumber)) {
return ResultBody.error(ResultEnum.AUTH_PHONE_NUMBER_ERROR);
}
UserAccountDO userAccount = new UserAccountDO();
......@@ -266,7 +269,7 @@ public class UserAccountServiceImpl implements UserAccountService {
@Override
public List<UserAccountSimpleDTO> feignListUserAccountByIds(List<Integer> ids) {
List<UserAccountDO> userAccountDOS = userServiceDao.listUserAccountByIds(ids);
if (!CollectionUtils.isEmpty(userAccountDOS)){
if (!CollectionUtils.isEmpty(userAccountDOS)) {
List<UserAccountSimpleDTO> userAccountSimpleDTOS = userAccountDOS.stream().map(UserAccountDO::buildUserAccountSimpleDTO).collect(Collectors.toList());
//设置用户的渠道等级
buildCooperationTagVO(userAccountSimpleDTOS);
......@@ -278,7 +281,7 @@ public class UserAccountServiceImpl implements UserAccountService {
@Override
public List<UserAccountSimpleDTO> feignListRcdUserInfo(List<Integer> userIds) {
List<UserAccountDO> userAccountDOS = userServiceDao.feignListRcdUserInfo(userIds);
if (!CollectionUtils.isEmpty(userAccountDOS)){
if (!CollectionUtils.isEmpty(userAccountDOS)) {
List<UserAccountSimpleDTO> userAccountSimpleDTOS = userAccountDOS.stream().map(UserAccountDO::buildUserAccountSimpleDTO).collect(Collectors.toList());
//设置用户的渠道等级
buildCooperationTagVO(userAccountSimpleDTOS);
......@@ -290,7 +293,7 @@ public class UserAccountServiceImpl implements UserAccountService {
@Override
public Integer feignGetSuperiorRef(Integer userAccountId) {
UserRcdDO userRcdDO = userServiceDao.getUserRcdDO(userAccountId);
if (userRcdDO != null){
if (userRcdDO != null) {
return userRcdDO.getId();
}
return null;
......@@ -299,10 +302,10 @@ public class UserAccountServiceImpl implements UserAccountService {
@Override
public UserAccountSimpleDTO feignGetUserRcdInfo(Integer userAccountId) {
UserAccountDO rcdAccountDO = userServiceDao.getUserRcdByAccountId(userAccountId);
if (rcdAccountDO != null){
if (rcdAccountDO != null) {
List<CooperationTagDO> cooperationTagDOS = cooperationDao.listUserCooperationTag(userAccountId);
UserAccountSimpleDTO userAccountSimpleDTO = rcdAccountDO.buildUserAccountSimpleDTO();
if (!CollectionUtils.isEmpty(cooperationTagDOS)){
if (!CollectionUtils.isEmpty(cooperationTagDOS)) {
List<CooperationTagVO> cooperationTagVOS = cooperationTagDOS.stream().map(CooperationTagDO::buildCooperationTagVO).collect(Collectors.toList());
userAccountSimpleDTO.setCooperationTagVOS(cooperationTagVOS);
}
......@@ -314,7 +317,7 @@ public class UserAccountServiceImpl implements UserAccountService {
@Override
public ResultBody listAppUser(UserAccountQO param) {
int count = userServiceDao.countListAppUser(param);
if (count == 0){
if (count == 0) {
return ResultBody.success(PageResult.buildPage(param.getPageNo(), param.getPageSize(), count));
}
int pageNo = param.getPageNo();
......@@ -327,7 +330,7 @@ public class UserAccountServiceImpl implements UserAccountService {
List<UserAccountVO> userAccountVOS = res.stream().map(UserAccountDO::buildUserAccountVO).collect(Collectors.toList());
for (UserAccountVO userAccountVO : userAccountVOS) {
List<CooperationTagDO> userCooperationTagDOS = userTagsMap.get(userAccountVO.getId());
if (!CollectionUtils.isEmpty(userCooperationTagDOS)){
if (!CollectionUtils.isEmpty(userCooperationTagDOS)) {
List<CooperationTagVO> cooperationTagVOS = userCooperationTagDOS.stream().map(CooperationTagDO::buildCooperationTagVO).collect(Collectors.toList());
userAccountVO.setCooperationTagVOS(cooperationTagVOS);
}
......@@ -350,12 +353,18 @@ public class UserAccountServiceImpl implements UserAccountService {
Map<Integer, CooperationTagDO> cooperationTagDOMap = cooperationTagDOS.stream().collect(Collectors.toMap(CooperationTagDO::getId, d -> d, (k1, k2) -> k2));
for (UserAccountDO userAccountDO : userAccountDOList) {
CooperationTagDO cooperationTagDO = cooperationTagDOMap.get(userAccountDO.getCooperationTagId());
if (cooperationTagDO != null){
if (cooperationTagDO != null) {
userAccountDO.setTagName(cooperationTagDO.getTagName());
}
}
return userAccountDOList;
}
@Override
public ResultBody roleAccountList(Integer id) {
List<UserAccountDO> roleInfoDOS = userServiceDao.roleAccountList(id);
List<UserAccountSimpleDTO> accountSimpleDTOS = roleInfoDOS.stream().map(UserAccountDO::buildUserAccountSimpleDTO).collect(Collectors.toList());
return ResultBody.success(accountSimpleDTOS);
}
}
......@@ -65,8 +65,8 @@
<insert id="insertRoleInfo" useGeneratedKeys="true"
keyProperty="id" parameterType="com.mmc.iuav.user.entity.RoleInfoDO">
insert into role_info(role_no, role_name, user_account_id, remark, create_time)
values (#{roleNo}, #{roleName}, #{userAccountId}, #{remark}, NOW())
insert into role_info(role_no, role_name, user_account_id, remark, create_time, update_time)
values (#{roleNo}, #{roleName}, #{userAccountId}, #{remark}, NOW(), NOW())
</insert>
......@@ -90,13 +90,11 @@
where role_id = #{roleId}
</select>
<update id="removeRoleInfo" parameterType="int">
UPDATE role_info
<set>
is_deleted = 1
</set>
<delete id="removeRoleInfo" parameterType="java.lang.Integer">
delete
from role_info
where id = #{id}
</update>
</delete>
<select id="getRoleInfo" resultMap="roleInfoResultMap"
parameterType="int">
......@@ -157,16 +155,5 @@
AND ua.is_deleted = 0
</select>
<select id="roleAccountList" resultMap="userAccountResultMap">
SELECT urr.user_account_id,
ua.user_name,
ua.uid,
ua.phone_num,
ua.user_name,
ua.is_deleted
FROM user_role_rel urr
LEFT JOIN user_account ua ON ua.id = urr.user_account_id
WHERE urr.role_id = #{id}
AND ua.is_deleted = 0
</select>
</mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论