@@ -39,6 +39,12 @@ public enum OperateType { | |||
STOCKTAKING_INFO("库存盘存"), | |||
STOCKTAKING_REMOVE("盘存设备移除"), | |||
//高速快讯 | |||
FALSH_ADD("高速快讯添加"), | |||
FALSH_UPDATE("高速快讯更新"), | |||
FALSH_STATUS_UPDATE("高速快讯状态更新"), | |||
FALSH_DELETE("高速快讯删除"), | |||
; | |||
private final String value; | |||
@@ -1,6 +1,7 @@ | |||
package cn.com.taiji.userw.api.rbac; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.common.model.dao.Pagination; | |||
import cn.com.taiji.common.web.ApiResponse; | |||
import cn.com.taiji.userw.api.MyValidController; | |||
import cn.com.taiji.userw.dto.rbac.*; | |||
@@ -69,7 +70,7 @@ public class RbacRoleController extends MyValidController { | |||
@ApiOperation(value = "角色列表多条件分页查询") | |||
@PostMapping(value = "/rolePage") | |||
public ApiResponse<RbacRolePageResponseDTO> rolePage(@RequestBody @Valid RbacRolePageRequestDTO dto) throws FormatException, ManagerException { | |||
public ApiResponse<Pagination> rolePage(@RequestBody @Valid RbacRolePageRequestDTO dto) throws FormatException, ManagerException { | |||
return ApiResponse.of(rbacRoleManger.page(dto)).setMessage("角色列表多条件分页查询成功"); | |||
} | |||
@@ -1,31 +0,0 @@ | |||
package cn.com.taiji.userw.dto.rbac; | |||
import cn.com.taiji.common.model.BaseModel; | |||
import cn.com.taiji.core.entity.user.UserRole; | |||
import cn.com.taiji.userw.model.rbac.MenuModel; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import java.util.List; | |||
import java.util.Map; | |||
@Setter | |||
@Getter | |||
public class RbacRolePageResponseDTO extends BaseModel { | |||
private int currentPage; | |||
private int pageSize; | |||
private long pageCount; | |||
private long totalCount; | |||
private List<Map<UserRole, List<MenuModel>>> data; | |||
private boolean hasData; | |||
} | |||
@@ -1,6 +1,7 @@ | |||
package cn.com.taiji.userw.manager.rbac; | |||
import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.common.model.dao.Pagination; | |||
import cn.com.taiji.userw.dto.rbac.*; | |||
import java.util.List; | |||
@@ -20,7 +21,7 @@ public interface RbacRoleManger { | |||
/**单个角色查询*/ | |||
RbacRoleQueryResponseDTO query(RbacRoleQueryRequestDTO request) throws ManagerException; | |||
/**角色多条件分页查询*/ | |||
RbacRolePageResponseDTO page(RbacRolePageRequestDTO request) throws ManagerException; | |||
Pagination page(RbacRolePageRequestDTO request) throws ManagerException; | |||
/**根据角色获取拥有该角色的用户信息-分页列表*/ | |||
GetAccountInfoByRolePageResponseDTO getAccountInfoByRolePage(GetAccountInfoByRolePageRequestDTO request) throws ManagerException; | |||
@@ -4,6 +4,7 @@ import cn.com.taiji.common.manager.ManagerException; | |||
import cn.com.taiji.common.model.dao.Pagination; | |||
import cn.com.taiji.common.pub.BeanTools; | |||
import cn.com.taiji.common.pub.CommonAbstract; | |||
import cn.com.taiji.core.entity.basic.QtkServiceHall; | |||
import cn.com.taiji.core.entity.dict.basic.SourceType; | |||
import cn.com.taiji.core.entity.dict.user.RbacStatus; | |||
import cn.com.taiji.core.entity.dict.user.SystemType; | |||
@@ -12,8 +13,10 @@ import cn.com.taiji.core.manager.tools.DesensitizedUtil; | |||
import cn.com.taiji.core.repo.jpa.user.*; | |||
import cn.com.taiji.userw.dto.rbac.*; | |||
import cn.com.taiji.userw.model.rbac.*; | |||
import cn.com.taiji.userw.model.serviceHall.ServiceHallReturnModel; | |||
import cn.com.taiji.userw.repo.jpa.request.rbac.RbacRolePageableRequest; | |||
import cn.com.taiji.userw.tools.SystemTypeAndSourceUtil; | |||
import org.apache.bcel.generic.NEW; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Value; | |||
import org.springframework.data.domain.Page; | |||
@@ -481,16 +484,36 @@ public class RbacRoleMangerImpl extends CommonAbstract implements RbacRoleManger | |||
} | |||
@Override | |||
public RbacRolePageResponseDTO page(RbacRolePageRequestDTO request) throws ManagerException { | |||
public Pagination page(RbacRolePageRequestDTO request) throws ManagerException { | |||
//入参校验 | |||
request.valid(); | |||
RbacRolePageableRequest queryRequest = new RbacRolePageableRequest(); | |||
//复制属性,相当于MapStruct的功能 | |||
BeanTools.copyProperties(request, queryRequest); | |||
Pagination page = userRoleRepo.page(queryRequest); | |||
return toResponse(page); | |||
return userRoleRepo.page(queryRequest).convertResult(this :: conver); | |||
} | |||
private UserRoleModel conver(UserRole role) { | |||
UserRoleModel roleModel = new UserRoleModel(); | |||
BeanTools.copyProperties(role, roleModel); | |||
//(1)查询出该角色拥有的所有菜单、权限中间表 | |||
//通过Set做一个去重保护 | |||
Set<String> menuIds = new HashSet<>(userRoleUserMenuRepo.getListByRoleId(role.getId()).stream().map(mr -> mr.getMenuId()).collect(Collectors.toList())); | |||
//(2)根据中间表的menuId、permId,查询出所有的菜单、权限 | |||
List<UserMenu> menus = userMenuRepo.findAllById(menuIds); | |||
List<MenuModel> menuVoList = new ArrayList<>(); | |||
for (UserMenu menu : menus) { | |||
MenuModel menuVo = new MenuModel(); | |||
//复制属性,相当于MapStruct的功能 | |||
BeanTools.copyProperties(menu, menuVo); | |||
menuVoList.add(menuVo); | |||
} | |||
roleModel.setMenuList(menuVoList); | |||
return roleModel; | |||
} | |||
@Override | |||
public GetAccountInfoByRolePageResponseDTO getAccountInfoByRolePage(GetAccountInfoByRolePageRequestDTO request) throws ManagerException { | |||
//入参校验 | |||
@@ -582,54 +605,6 @@ public class RbacRoleMangerImpl extends CommonAbstract implements RbacRoleManger | |||
return specification; | |||
} | |||
/** | |||
* 获取分页后的结果 | |||
* | |||
* @param pagn | |||
* @return | |||
*/ | |||
private RbacRolePageResponseDTO toResponse(Pagination pagn) { | |||
RbacRolePageResponseDTO res = new RbacRolePageResponseDTO(); | |||
List<Map<UserRole,List<MenuModel>>> roleList = new ArrayList<>(); | |||
res.setHasData(false); | |||
//分页结果非空校验 | |||
if (isEmpty(pagn.getResult())) { | |||
return res; | |||
} | |||
//分页结果配置 | |||
pagn.getResult(UserRole.class).forEach(r -> { | |||
UserRole role = new UserRole(); | |||
BeanTools.copyProperties(r, role); | |||
//(1)查询出该角色拥有的所有菜单、权限中间表 | |||
//通过Set做一个去重保护 | |||
Set<String> menuIds = new HashSet<>(userRoleUserMenuRepo.getListByRoleId(role.getId()).stream().map(mr -> mr.getMenuId()).collect(Collectors.toList())); | |||
//(2)根据中间表的menuId、permId,查询出所有的菜单、权限 | |||
List<UserMenu> menus = userMenuRepo.findAllById(menuIds); | |||
List<MenuModel> menuVoList = new ArrayList<>(); | |||
for (UserMenu menu : menus) { | |||
MenuModel menuVo = new MenuModel(); | |||
//复制属性,相当于MapStruct的功能 | |||
BeanTools.copyProperties(menu, menuVo); | |||
menuVoList.add(menuVo); | |||
} | |||
Map<UserRole, List<MenuModel>> map = new HashMap<>(); | |||
map.put(role,menuVoList); | |||
// role.setMenuList(menuVoList); | |||
roleList.add(map); | |||
}); | |||
res.setCurrentPage(pagn.getCurrentPage()); | |||
res.setPageCount(pagn.getPageCount()); | |||
res.setPageSize(pagn.getPageSize()); | |||
res.setTotalCount(pagn.getTotalCount()); | |||
res.setHasData(true); | |||
res.setData(roleList); | |||
return res; | |||
} | |||
@Override | |||
public List<RoleListAndSystemTypeDTO> getRoleListBySystemType(RbacRoleListBySystemTypeRequestDTO request) throws ManagerException { |
@@ -1,9 +1,14 @@ | |||
package cn.com.taiji.userw.model.rbac; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
/*** | |||
* 简单用户信息 | |||
* | |||
*/ | |||
@Getter | |||
@Setter | |||
public class AccountInfoSimpleModel { | |||
@@ -16,27 +21,4 @@ public class AccountInfoSimpleModel { | |||
/** 用户姓名 */ | |||
private String userName; | |||
public String getNickName() { | |||
return nickName; | |||
} | |||
public void setNickName(String nickName) { | |||
this.nickName = nickName; | |||
} | |||
public String getMobile() { | |||
return mobile; | |||
} | |||
public void setMobile(String mobile) { | |||
this.mobile = mobile; | |||
} | |||
public String getUserName() { | |||
return userName; | |||
} | |||
public void setUserName(String userName) { | |||
this.userName = userName; | |||
} | |||
} |
@@ -1,26 +1,14 @@ | |||
package cn.com.taiji.userw.model.rbac; | |||
import java.util.List; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import java.util.List; | |||
@Getter | |||
@Setter | |||
public class SetMenuDto { | |||
private String menuId; | |||
private List<String> permIds; | |||
public String getMenuId() { | |||
return menuId; | |||
} | |||
public void setMenuId(String menuId) { | |||
this.menuId = menuId; | |||
} | |||
public List<String> getPermIds() { | |||
return permIds; | |||
} | |||
public void setPermIds(List<String> permIds) { | |||
this.permIds = permIds; | |||
} | |||
} |
@@ -1,7 +1,11 @@ | |||
package cn.com.taiji.userw.model.rbac; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
@Getter | |||
@Setter | |||
public class SetMenuModel { | |||
private String id; //菜单id或权限标识id | |||
@@ -9,28 +13,5 @@ public class SetMenuModel { | |||
private String menuId; //当permIdentity不为null时,表明这是该权限标识的所属菜单 | |||
public String getId() { | |||
return id; | |||
} | |||
public void setId(String id) { | |||
this.id = id; | |||
} | |||
public String getPermIdentity() { | |||
return permIdentity; | |||
} | |||
public void setPermIdentity(String permIdentity) { | |||
this.permIdentity = permIdentity; | |||
} | |||
public String getMenuId() { | |||
return menuId; | |||
} | |||
public void setMenuId(String menuId) { | |||
this.menuId = menuId; | |||
} | |||
} |
@@ -2,53 +2,33 @@ package cn.com.taiji.userw.model.rbac; | |||
import cn.com.taiji.core.entity.dict.user.RbacSource; | |||
import cn.com.taiji.core.entity.dict.user.RbacStatus; | |||
import cn.com.taiji.core.entity.dict.user.SystemType; | |||
import lombok.Getter; | |||
import lombok.Setter; | |||
import java.util.List; | |||
@Getter | |||
@Setter | |||
public class UserRoleModel { | |||
private String id; | |||
/** 角色名字 */ | |||
private String name; | |||
/** 角色信息描述 */ | |||
private String description; | |||
/** 状态 */ | |||
private RbacStatus status; | |||
/** 角色归属哪个系统 */ | |||
private SystemType systemType; | |||
/** 角色所属来源方 */ | |||
private RbacSource roleSource; | |||
/** 是否是模板 */ | |||
private Boolean whetherTemplate; | |||
public String getId() { | |||
return id; | |||
} | |||
public void setId(String id) { | |||
this.id = id; | |||
} | |||
public String getName() { | |||
return name; | |||
} | |||
public void setName(String name) { | |||
this.name = name; | |||
} | |||
public SystemType getSystemType() { | |||
return systemType; | |||
} | |||
public void setSystemType(SystemType systemType) { | |||
this.systemType = systemType; | |||
} | |||
public RbacSource getRoleSource() { | |||
return roleSource; | |||
} | |||
public void setRoleSource(RbacSource roleSource) { | |||
this.roleSource = roleSource; | |||
} | |||
public Boolean getWhetherTemplate() { | |||
return whetherTemplate; | |||
} | |||
private String insertTime; | |||
private String updateTime; | |||
public void setWhetherTemplate(Boolean whetherTemplate) { | |||
this.whetherTemplate = whetherTemplate; | |||
} | |||
private List<MenuModel> menuList; | |||
} |
@@ -243,7 +243,7 @@ public abstract class IssueCommManager { | |||
blackObu.setCreationTime(LocalDateTime.parse(dsiBlackObu.getCreationTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); | |||
blackObu.setReleaseTime(LocalDateTime.parse(dsiBlackObu.getReleaseTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); | |||
blackObu.setObuId(dsiBlackObu.getObuId()); | |||
blackObu.setType(CardBlackType.fromCode(dsiBlackObu.getType())); | |||
blackObu.setType(ObuBlackType.fromCode(dsiBlackObu.getType())); | |||
blackObu.setStatus(dsiBlackObu.getStatus()); | |||
blackObu.setCreateTime(dsiBlackObu.getCreateTime()); | |||
blackObu.setReason(dsiBlackObu.getReason()); |
@@ -5,6 +5,7 @@ import cn.com.taiji.common.manager.net.http.ServiceHandleException; | |||
import cn.com.taiji.common.pub.LambdaTools; | |||
import cn.com.taiji.core.entity.basic.QtkBlackObu; | |||
import cn.com.taiji.core.entity.dict.basic.CardBlackType; | |||
import cn.com.taiji.core.entity.dict.basic.ObuBlackType; | |||
import cn.com.taiji.core.model.comm.protocol.AbstractSignTypeResponse; | |||
import cn.com.taiji.core.model.comm.protocol.ods.oqs.issue.OqsObuBlackRequest; | |||
import cn.com.taiji.core.model.comm.protocol.ods.oqs.issue.OqsObuBlackResponse; | |||
@@ -64,8 +65,8 @@ public class ObuBlackQueryManager extends AbstractHandleManager<OqsObuBlackReque | |||
OqsObuBlackResponse res = new OqsObuBlackResponse(); | |||
qtkList.addAll(LambdaTools.doMap(dsiList, IssueCommManager::convert)); | |||
List<QtkBlackObu> result = Lists.newArrayList(); | |||
Map<CardBlackType, List<QtkBlackObu>> map = qtkList.stream().collect(Collectors.groupingBy(QtkBlackObu::getType)); | |||
for (Map.Entry<CardBlackType, List<QtkBlackObu>> entry : map.entrySet()) { | |||
Map<ObuBlackType, List<QtkBlackObu>> map = qtkList.stream().collect(Collectors.groupingBy(QtkBlackObu::getType)); | |||
for (Map.Entry<ObuBlackType, List<QtkBlackObu>> entry : map.entrySet()) { | |||
Optional<QtkBlackObu> max = entry.getValue().stream().max(Comparator.comparing(QtkBlackObu::getCreationTime)); | |||
max.ifPresent(result::add); | |||
} |