mirror of
https://gitee.com/durcframework/SOP.git
synced 2025-08-11 21:57:56 +08:00
5.0
This commit is contained in:
@@ -2,18 +2,20 @@ package com.gitee.sop.adminbackend.controller.isv;
|
||||
|
||||
import com.gitee.fastmybatis.core.PageInfo;
|
||||
import com.gitee.fastmybatis.core.query.LambdaQuery;
|
||||
import com.gitee.fastmybatis.core.query.Query;
|
||||
import com.gitee.fastmybatis.core.query.param.PageParam;
|
||||
import com.gitee.sop.adminbackend.common.RSATool;
|
||||
import com.gitee.sop.adminbackend.common.dto.StatusUpdateDTO;
|
||||
import com.gitee.sop.adminbackend.common.req.StatusUpdateParam;
|
||||
import com.gitee.sop.adminbackend.common.resp.Result;
|
||||
import com.gitee.sop.adminbackend.controller.isv.req.IsvGroupSettingParam;
|
||||
import com.gitee.sop.adminbackend.controller.isv.req.IsvInfoAddParam;
|
||||
import com.gitee.sop.adminbackend.controller.isv.req.IsvInfoUpdateKeysParam;
|
||||
import com.gitee.sop.adminbackend.controller.isv.req.IsvInfoUpdateParam;
|
||||
import com.gitee.sop.adminbackend.controller.isv.req.IsvKeysGenParam;
|
||||
import com.gitee.sop.adminbackend.dao.entity.IsvInfo;
|
||||
import com.gitee.sop.adminbackend.service.isv.IsvInfoService;
|
||||
import com.gitee.sop.adminbackend.service.isv.PermIsvGroupService;
|
||||
import com.gitee.sop.adminbackend.service.isv.dto.IsvGroupSettingDTO;
|
||||
import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoAddDTO;
|
||||
import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoDTO;
|
||||
import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoUpdateDTO;
|
||||
@@ -39,6 +41,8 @@ public class IsvInfoController {
|
||||
|
||||
@Resource
|
||||
private IsvInfoService isvInfoService;
|
||||
@Resource
|
||||
private PermIsvGroupService permIsvGroupService;
|
||||
|
||||
|
||||
/**
|
||||
@@ -130,4 +134,5 @@ public class IsvInfoController {
|
||||
return Result.ok(isvInfoService.updateStatus(statusUpdateDTO));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,92 @@
|
||||
package com.gitee.sop.adminbackend.controller.isv;
|
||||
|
||||
import com.gitee.fastmybatis.core.PageInfo;
|
||||
import com.gitee.fastmybatis.core.query.LambdaQuery;
|
||||
import com.gitee.sop.adminbackend.common.req.IdParam;
|
||||
import com.gitee.sop.adminbackend.common.resp.Result;
|
||||
import com.gitee.sop.adminbackend.controller.isv.req.PermGroupParam;
|
||||
import com.gitee.sop.adminbackend.dao.entity.PermGroup;
|
||||
import com.gitee.sop.adminbackend.service.isv.PermGroupService;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 权限分组
|
||||
*
|
||||
* @author 六如
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("perm/group")
|
||||
public class PermGroupController {
|
||||
|
||||
@Resource
|
||||
private PermGroupService permGroupService;
|
||||
|
||||
/**
|
||||
* 查询全部
|
||||
*
|
||||
* @return 返回分页结果
|
||||
*/
|
||||
@GetMapping("/listAll")
|
||||
public Result<List<PermGroup>> listAll() {
|
||||
List<PermGroup> list = permGroupService.listAll();
|
||||
return Result.ok(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param param 查询参数
|
||||
* @return 返回分页结果
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
public Result<PageInfo<PermGroup>> page(PermGroupParam param) {
|
||||
LambdaQuery<PermGroup> query = param.toLambdaQuery(PermGroup.class);
|
||||
PageInfo<PermGroup> pageInfo = permGroupService.doPage(query);
|
||||
return Result.ok(pageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增记录
|
||||
*
|
||||
* @param permGroup 表单参数
|
||||
* @return 返回添加后的主键值
|
||||
*/
|
||||
@PostMapping("/add")
|
||||
public Result<Long> add(@Validated @RequestBody PermGroup permGroup) {
|
||||
permGroupService.save(permGroup);
|
||||
// 返回添加后的主键值
|
||||
return Result.ok(permGroup.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改记录
|
||||
*
|
||||
* @param permGroup 表单数据
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
@PostMapping("/update")
|
||||
public Result<Integer> update(@Validated @RequestBody PermGroup permGroup) {
|
||||
return Result.ok(permGroupService.update(permGroup));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除记录
|
||||
*
|
||||
* @param param 参数
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
@PostMapping("/delete")
|
||||
public Result<Integer> delete(@Validated @RequestBody IdParam param) {
|
||||
return Result.ok(permGroupService.deleteById(param.getId()));
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,55 @@
|
||||
package com.gitee.sop.adminbackend.controller.isv;
|
||||
|
||||
import com.gitee.sop.adminbackend.common.resp.Result;
|
||||
import com.gitee.sop.adminbackend.controller.isv.req.IsvGroupSettingParam;
|
||||
import com.gitee.sop.adminbackend.dao.entity.PermGroup;
|
||||
import com.gitee.sop.adminbackend.service.isv.PermIsvGroupService;
|
||||
import com.gitee.sop.adminbackend.service.isv.dto.IsvGroupSettingDTO;
|
||||
import com.gitee.sop.adminbackend.util.CopyUtil;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("perm/isv/group")
|
||||
public class PermIsvGroupController {
|
||||
|
||||
@Resource
|
||||
private PermIsvGroupService permIsvGroupService;
|
||||
|
||||
/**
|
||||
* 查询isv分组
|
||||
*
|
||||
* @param isvId isvId
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
@GetMapping("listIsvCode")
|
||||
public Result<List<String>> listIsvGroup(Long isvId) {
|
||||
List<String> permGroups = permIsvGroupService.listIsvGroup(isvId);
|
||||
return Result.ok(permGroups);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置分组
|
||||
*
|
||||
* @param param 表单数据
|
||||
* @return 返回影响行数
|
||||
*/
|
||||
@PostMapping("setting")
|
||||
public Result<Integer> updateIsvGroup(@Validated @RequestBody IsvGroupSettingParam param) {
|
||||
IsvGroupSettingDTO isvGroupSettingDTO = CopyUtil.copyBean(param, IsvGroupSettingDTO::new);
|
||||
int i = permIsvGroupService.updateIsvGroup(isvGroupSettingDTO);
|
||||
return Result.ok(i);
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
package com.gitee.sop.adminbackend.controller.isv.req;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
@Data
|
||||
public class IsvGroupSettingParam {
|
||||
|
||||
@NotNull
|
||||
private Long isvId;
|
||||
|
||||
private List<String> groupCodeList;
|
||||
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
package com.gitee.sop.adminbackend.controller.isv.req;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.gitee.fastmybatis.core.query.Operator;
|
||||
import com.gitee.fastmybatis.core.query.annotation.Condition;
|
||||
import com.gitee.fastmybatis.core.query.param.PageParam;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* 备注:分组表
|
||||
*
|
||||
* @author 六如
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class PermGroupParam extends PageParam {
|
||||
|
||||
/**
|
||||
* 分组代码
|
||||
*/
|
||||
@Condition(operator = Operator.like)
|
||||
private String groupCode;
|
||||
|
||||
/**
|
||||
* 分组描述
|
||||
*/
|
||||
@Condition(operator = Operator.like)
|
||||
private String groupName;
|
||||
|
||||
}
|
@@ -4,10 +4,12 @@ import com.gitee.fastmybatis.core.query.Operator;
|
||||
import com.gitee.fastmybatis.core.query.annotation.Condition;
|
||||
import com.gitee.fastmybatis.core.query.param.PageParam;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class ApiInfoParam extends PageParam {
|
||||
|
||||
|
@@ -19,6 +19,9 @@ import lombok.Data;
|
||||
@Data
|
||||
public class ApiInfo {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
@@ -77,12 +80,18 @@ public class ApiInfo {
|
||||
private Integer regSource;
|
||||
|
||||
/**
|
||||
* 1启用,2禁用
|
||||
* 1启用,0禁用
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
private LocalDateTime addTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
|
@@ -1,11 +1,12 @@
|
||||
package com.gitee.sop.adminbackend.dao.entity;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.gitee.fastmybatis.annotation.Pk;
|
||||
import com.gitee.fastmybatis.annotation.PkStrategy;
|
||||
import com.gitee.fastmybatis.annotation.Table;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
@@ -18,6 +19,9 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
public class IsvInfo {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
@@ -35,8 +39,14 @@ public class IsvInfo {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
private LocalDateTime addTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
|
@@ -1,11 +1,12 @@
|
||||
package com.gitee.sop.adminbackend.dao.entity;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.gitee.fastmybatis.annotation.Pk;
|
||||
import com.gitee.fastmybatis.annotation.PkStrategy;
|
||||
import com.gitee.fastmybatis.annotation.Table;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
@@ -18,6 +19,9 @@ import java.time.LocalDateTime;
|
||||
@Data
|
||||
public class IsvKeys {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
@@ -50,8 +54,14 @@ public class IsvKeys {
|
||||
*/
|
||||
private String privateKeyPlatform;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
private LocalDateTime addTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
|
@@ -0,0 +1,54 @@
|
||||
package com.gitee.sop.adminbackend.dao.entity;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.gitee.fastmybatis.annotation.Pk;
|
||||
import com.gitee.fastmybatis.annotation.PkStrategy;
|
||||
import com.gitee.fastmybatis.annotation.Table;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 表名:perm_group
|
||||
* 备注:分组表
|
||||
*
|
||||
* @author 六如
|
||||
*/
|
||||
@Table(name = "perm_group", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
|
||||
@Data
|
||||
public class PermGroup {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 分组代码
|
||||
*/
|
||||
private String groupCode;
|
||||
|
||||
/**
|
||||
* 角色描述
|
||||
*/
|
||||
private String groupName;
|
||||
|
||||
/**
|
||||
* 是否删除
|
||||
*/
|
||||
@com.gitee.fastmybatis.annotation.Column(logicDelete = true)
|
||||
private Integer isDeleted;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
private LocalDateTime addTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
}
|
@@ -10,29 +10,38 @@ import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 表名:perm_role
|
||||
* 备注:角色表
|
||||
* 表名:perm_group_permission
|
||||
* 备注:组权限表
|
||||
*
|
||||
* @author 六如
|
||||
*/
|
||||
@Table(name = "perm_role", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
|
||||
@Table(name = "perm_group_permission", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
|
||||
@Data
|
||||
public class PermRole {
|
||||
public class PermGroupPermission {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 角色代码
|
||||
* 分组表code
|
||||
*/
|
||||
private String roleCode;
|
||||
private String groupCode;
|
||||
|
||||
/**
|
||||
* 角色描述
|
||||
* api_info.id
|
||||
*/
|
||||
private String description;
|
||||
private String apiId;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
private LocalDateTime addTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
@@ -10,14 +10,14 @@ import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 表名:perm_isv_role
|
||||
* 备注:isv角色
|
||||
* 表名:perm_isv_group
|
||||
* 备注:isv分组
|
||||
*
|
||||
* @author 六如
|
||||
*/
|
||||
@Table(name = "perm_isv_role", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
|
||||
@Table(name = "perm_isv_group", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
|
||||
@Data
|
||||
public class PermIsvRole {
|
||||
public class PermIsvGroup {
|
||||
|
||||
private Long id;
|
||||
|
||||
@@ -27,9 +27,9 @@ public class PermIsvRole {
|
||||
private Long isvId;
|
||||
|
||||
/**
|
||||
* 角色code
|
||||
* 组code
|
||||
*/
|
||||
private String roleCode;
|
||||
private String groupCode;
|
||||
|
||||
private LocalDateTime addTime;
|
||||
|
@@ -1,39 +0,0 @@
|
||||
package com.gitee.sop.adminbackend.dao.entity;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.gitee.fastmybatis.annotation.Pk;
|
||||
import com.gitee.fastmybatis.annotation.PkStrategy;
|
||||
import com.gitee.fastmybatis.annotation.Table;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
/**
|
||||
* 表名:perm_role_permission
|
||||
* 备注:角色权限表
|
||||
*
|
||||
* @author 六如
|
||||
*/
|
||||
@Table(name = "perm_role_permission", pk = @Pk(name = "id", strategy = PkStrategy.INCREMENT))
|
||||
@Data
|
||||
public class PermRolePermission {
|
||||
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 角色表code
|
||||
*/
|
||||
private String roleCode;
|
||||
|
||||
/**
|
||||
* api_id
|
||||
*/
|
||||
private String routeId;
|
||||
|
||||
private LocalDateTime addTime;
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
}
|
@@ -19,6 +19,9 @@ import lombok.Data;
|
||||
@Data
|
||||
public class SysAdminUser {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
@@ -47,17 +50,23 @@ public class SysAdminUser {
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 状态,1:启用,0:禁用
|
||||
* 状态,1:启用,2:禁用
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 注册类型
|
||||
* 注册类型,1-系统,2-手动
|
||||
*/
|
||||
private String regType;
|
||||
|
||||
/**
|
||||
* 添加时间
|
||||
*/
|
||||
private LocalDateTime addTime;
|
||||
|
||||
/**
|
||||
* 修改时间
|
||||
*/
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
|
||||
|
@@ -1,11 +1,11 @@
|
||||
package com.gitee.sop.adminbackend.dao.mapper;
|
||||
|
||||
import com.gitee.fastmybatis.core.mapper.BaseMapper;
|
||||
import com.gitee.sop.adminbackend.dao.entity.PermRole;
|
||||
import com.gitee.sop.adminbackend.dao.entity.PermGroup;
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
public interface PermRoleMapper extends BaseMapper<PermRole> {
|
||||
public interface PermGroupMapper extends BaseMapper<PermGroup> {
|
||||
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
package com.gitee.sop.adminbackend.dao.mapper;
|
||||
|
||||
import com.gitee.fastmybatis.core.mapper.BaseMapper;
|
||||
import com.gitee.sop.adminbackend.dao.entity.PermGroupPermission;
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
public interface PermGroupPermissionMapper extends BaseMapper<PermGroupPermission> {
|
||||
|
||||
}
|
@@ -1,11 +1,11 @@
|
||||
package com.gitee.sop.adminbackend.dao.mapper;
|
||||
|
||||
import com.gitee.fastmybatis.core.mapper.BaseMapper;
|
||||
import com.gitee.sop.adminbackend.dao.entity.PermIsvRole;
|
||||
import com.gitee.sop.adminbackend.dao.entity.PermIsvGroup;
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
public interface PermIsvRoleMapper extends BaseMapper<PermIsvRole> {
|
||||
public interface PermIsvGroupMapper extends BaseMapper<PermIsvGroup> {
|
||||
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
package com.gitee.sop.adminbackend.dao.mapper;
|
||||
|
||||
import com.gitee.fastmybatis.core.mapper.BaseMapper;
|
||||
import com.gitee.sop.adminbackend.dao.entity.PermRolePermission;
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
public interface PermRolePermissionMapper extends BaseMapper<PermRolePermission> {
|
||||
|
||||
}
|
@@ -9,8 +9,9 @@ import com.gitee.sop.adminbackend.common.enums.StatusEnum;
|
||||
import com.gitee.sop.adminbackend.common.enums.YesOrNoEnum;
|
||||
import com.gitee.sop.adminbackend.dao.entity.IsvInfo;
|
||||
import com.gitee.sop.adminbackend.dao.entity.IsvKeys;
|
||||
import com.gitee.sop.adminbackend.dao.entity.PermIsvRole;
|
||||
import com.gitee.sop.adminbackend.dao.entity.PermIsvGroup;
|
||||
import com.gitee.sop.adminbackend.dao.mapper.IsvInfoMapper;
|
||||
import com.gitee.sop.adminbackend.service.isv.dto.IsvGroupSettingDTO;
|
||||
import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoAddDTO;
|
||||
import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoDTO;
|
||||
import com.gitee.sop.adminbackend.service.isv.dto.IsvInfoUpdateDTO;
|
||||
@@ -20,6 +21,7 @@ import com.gitee.sop.adminbackend.service.isv.dto.IsvKeysGenDTO;
|
||||
import com.gitee.sop.adminbackend.util.CopyUtil;
|
||||
import com.gitee.sop.adminbackend.util.IdGen;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -29,6 +31,7 @@ import java.util.stream.Collectors;
|
||||
import javax.annotation.Resource;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
|
||||
@@ -42,7 +45,7 @@ public class IsvInfoService implements LambdaService<IsvInfo, IsvInfoMapper> {
|
||||
@Resource
|
||||
private IsvKeysService isvKeysService;
|
||||
@Resource
|
||||
private PermIsvRoleService permIsvRoleService;
|
||||
private PermIsvGroupService permIsvGroupService;
|
||||
|
||||
public PageInfo<IsvInfoDTO> doPage(LambdaQuery<IsvInfo> query) {
|
||||
query.orderByDesc(IsvInfo::getId);
|
||||
@@ -58,6 +61,8 @@ public class IsvInfoService implements LambdaService<IsvInfo, IsvInfoMapper> {
|
||||
.in(IsvKeys::getIsvId, idList)
|
||||
.map(IsvKeys::getIsvId, Function.identity());
|
||||
|
||||
Map<Long, List<String>> isvGroupMap = permIsvGroupService.getIsvGroupNameMap(idList);
|
||||
|
||||
// 格式转换
|
||||
return page.convert(isvInfo -> {
|
||||
IsvInfoDTO isvInfoDTO = CopyUtil.copyBean(isvInfo, IsvInfoDTO::new);
|
||||
@@ -73,6 +78,8 @@ public class IsvInfoService implements LambdaService<IsvInfo, IsvInfoMapper> {
|
||||
);
|
||||
}
|
||||
isvInfoDTO.setHasKeys(YesOrNoEnum.of(hasKey).getValue());
|
||||
List<String> groupNames = isvGroupMap.getOrDefault(isvInfo.getId(), Collections.emptyList());
|
||||
isvInfoDTO.setGroupNames(String.join("/", groupNames));
|
||||
return isvInfoDTO;
|
||||
});
|
||||
}
|
||||
@@ -115,18 +122,18 @@ public class IsvInfoService implements LambdaService<IsvInfo, IsvInfoMapper> {
|
||||
|
||||
private void saveIsvRole(IsvInfo isvInfo, List<String> roleCodeList) {
|
||||
Long isvId = isvInfo.getId();
|
||||
permIsvRoleService.deleteByColumn(PermIsvRole::getIsvId, isvId);
|
||||
permIsvGroupService.deleteByColumn(PermIsvGroup::getIsvId, isvId);
|
||||
|
||||
List<PermIsvRole> tobeSaveList = roleCodeList.stream()
|
||||
.map(roleCode -> {
|
||||
PermIsvRole rec = new PermIsvRole();
|
||||
List<PermIsvGroup> tobeSaveList = roleCodeList.stream()
|
||||
.map(groupCode -> {
|
||||
PermIsvGroup rec = new PermIsvGroup();
|
||||
rec.setIsvId(isvId);
|
||||
rec.setRoleCode(roleCode);
|
||||
rec.setGroupCode(groupCode);
|
||||
return rec;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
permIsvRoleService.saveBatch(tobeSaveList);
|
||||
permIsvGroupService.saveBatch(tobeSaveList);
|
||||
|
||||
// TODO:同步到网关
|
||||
// try {
|
||||
|
@@ -0,0 +1,29 @@
|
||||
package com.gitee.sop.adminbackend.service.isv;
|
||||
|
||||
import com.gitee.fastmybatis.core.PageInfo;
|
||||
import com.gitee.fastmybatis.core.query.LambdaQuery;
|
||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||
import com.gitee.sop.adminbackend.dao.entity.PermGroupPermission;
|
||||
import com.gitee.sop.adminbackend.dao.mapper.PermGroupPermissionMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
@Service
|
||||
public class PermGroupPermissionService implements LambdaService<PermGroupPermission, PermGroupPermissionMapper> {
|
||||
|
||||
public PageInfo<PermGroupPermission> doPage(LambdaQuery<PermGroupPermission> query) {
|
||||
query.orderByDesc(PermGroupPermission::getId);
|
||||
PageInfo<PermGroupPermission> page = this.page(query);
|
||||
|
||||
// 格式转换
|
||||
return page.convert(isvInfo -> {
|
||||
|
||||
return isvInfo;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
package com.gitee.sop.adminbackend.service.isv;
|
||||
|
||||
import com.gitee.fastmybatis.core.PageInfo;
|
||||
import com.gitee.fastmybatis.core.query.LambdaQuery;
|
||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||
import com.gitee.sop.adminbackend.dao.entity.PermGroup;
|
||||
import com.gitee.sop.adminbackend.dao.mapper.PermGroupMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
@Service
|
||||
public class PermGroupService implements LambdaService<PermGroup, PermGroupMapper> {
|
||||
|
||||
public PageInfo<PermGroup> doPage(LambdaQuery<PermGroup> query) {
|
||||
query.orderByDesc(PermGroup::getId);
|
||||
PageInfo<PermGroup> page = this.page(query);
|
||||
|
||||
// 格式转换
|
||||
return page.convert(isvInfo -> {
|
||||
|
||||
return isvInfo;
|
||||
});
|
||||
}
|
||||
|
||||
public Map<String, String> getCodeNameMap(Collection<String> codeList) {
|
||||
return this.query()
|
||||
.in(PermGroup::getGroupCode, codeList)
|
||||
.map(PermGroup::getGroupCode, PermGroup::getGroupName);
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -0,0 +1,85 @@
|
||||
package com.gitee.sop.adminbackend.service.isv;
|
||||
|
||||
import com.gitee.fastmybatis.core.PageInfo;
|
||||
import com.gitee.fastmybatis.core.query.LambdaQuery;
|
||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||
import com.gitee.sop.adminbackend.dao.entity.PermIsvGroup;
|
||||
import com.gitee.sop.adminbackend.dao.mapper.PermIsvGroupMapper;
|
||||
import com.gitee.sop.adminbackend.service.isv.dto.IsvGroupSettingDTO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
@Service
|
||||
public class PermIsvGroupService implements LambdaService<PermIsvGroup, PermIsvGroupMapper> {
|
||||
|
||||
@Resource
|
||||
private PermGroupService permGroupService;
|
||||
|
||||
public PageInfo<PermIsvGroup> doPage(LambdaQuery<PermIsvGroup> query) {
|
||||
query.orderByDesc(PermIsvGroup::getId);
|
||||
PageInfo<PermIsvGroup> page = this.page(query);
|
||||
|
||||
// 格式转换
|
||||
return page.convert(isvInfo -> {
|
||||
|
||||
return isvInfo;
|
||||
});
|
||||
}
|
||||
|
||||
public Map<Long, List<String>> getIsvGroupNameMap(Collection<Long> isvIds) {
|
||||
List<PermIsvGroup> list = this.list(PermIsvGroup::getIsvId, isvIds);
|
||||
if (list.isEmpty()) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
Set<String> codes = list.stream().map(PermIsvGroup::getGroupCode).collect(Collectors.toSet());
|
||||
Map<String, String> groupCodeMap = permGroupService.getCodeNameMap(codes);
|
||||
return this.query()
|
||||
.in(PermIsvGroup::getIsvId, isvIds)
|
||||
.group(PermIsvGroup::getIsvId,
|
||||
permIsvGroup -> groupCodeMap.getOrDefault(permIsvGroup.getGroupCode(), ""));
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int updateIsvGroup(IsvGroupSettingDTO isvGroupSettingDTO) {
|
||||
// 先删除所有
|
||||
int i = this.deleteByColumn(PermIsvGroup::getIsvId, isvGroupSettingDTO.getIsvId());
|
||||
List<String> groupCodeList = isvGroupSettingDTO.getGroupCodeList();
|
||||
if (CollectionUtils.isEmpty(groupCodeList)) {
|
||||
return i;
|
||||
}
|
||||
List<PermIsvGroup> saveList = groupCodeList
|
||||
.stream()
|
||||
.map(groupCode -> {
|
||||
PermIsvGroup permIsvGroup = new PermIsvGroup();
|
||||
permIsvGroup.setIsvId(isvGroupSettingDTO.getIsvId());
|
||||
permIsvGroup.setGroupCode(groupCode);
|
||||
return permIsvGroup;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return this.saveBatch(saveList);
|
||||
}
|
||||
|
||||
public List<String> listIsvGroup(Long isvId) {
|
||||
List<PermIsvGroup> list = this.list(PermIsvGroup::getIsvId, isvId);
|
||||
if (list.isEmpty()) {
|
||||
return new ArrayList<>(0);
|
||||
}
|
||||
return list.stream().map(PermIsvGroup::getGroupCode).distinct().collect(Collectors.toList());
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -1,15 +0,0 @@
|
||||
package com.gitee.sop.adminbackend.service.isv;
|
||||
|
||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||
import com.gitee.sop.adminbackend.dao.entity.PermIsvRole;
|
||||
import com.gitee.sop.adminbackend.dao.mapper.PermIsvRoleMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
@Service
|
||||
public class PermIsvRoleService implements LambdaService<PermIsvRole, PermIsvRoleMapper> {
|
||||
|
||||
}
|
@@ -1,15 +0,0 @@
|
||||
package com.gitee.sop.adminbackend.service.isv;
|
||||
|
||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||
import com.gitee.sop.adminbackend.dao.entity.PermRolePermission;
|
||||
import com.gitee.sop.adminbackend.dao.mapper.PermRolePermissionMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
@Service
|
||||
public class PermRolePermissionService implements LambdaService<PermRolePermission, PermRolePermissionMapper> {
|
||||
|
||||
}
|
@@ -1,15 +0,0 @@
|
||||
package com.gitee.sop.adminbackend.service.isv;
|
||||
|
||||
import com.gitee.fastmybatis.core.support.LambdaService;
|
||||
import com.gitee.sop.adminbackend.dao.entity.PermRole;
|
||||
import com.gitee.sop.adminbackend.dao.mapper.PermRoleMapper;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
@Service
|
||||
public class PermRoleService implements LambdaService<PermRole, PermRoleMapper> {
|
||||
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
package com.gitee.sop.adminbackend.service.isv.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author 六如
|
||||
*/
|
||||
@Data
|
||||
public class IsvGroupSettingDTO {
|
||||
|
||||
@NotNull
|
||||
private Long isvId;
|
||||
|
||||
@NotEmpty
|
||||
private List<String> groupCodeList;
|
||||
|
||||
}
|
@@ -37,6 +37,8 @@ public class IsvInfoDTO {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
private String groupNames;
|
||||
|
||||
private LocalDateTime addTime;
|
||||
|
||||
private LocalDateTime updateTime;
|
||||
|
Reference in New Issue
Block a user