Merge branch 'feature/REQ-2300' into 'master'
Feature/req 2300 See merge request universal/infrastructure/backend/tyr!124
This commit is contained in:
commit
cc7031c7cf
@ -15,7 +15,7 @@ public enum AttrPermissionEnum {
|
|||||||
|
|
||||||
DEPARTMENT_SUBORDINATE(4, "本部门及以下数据"),
|
DEPARTMENT_SUBORDINATE(4, "本部门及以下数据"),
|
||||||
|
|
||||||
UNIT_ONLY(5, "仅本单位数据"),
|
UNIT_ONLY(5, "仅本单位数据(包含班组)"),
|
||||||
|
|
||||||
UNIT_DIRECT_SUBORDINATE(6, "本单位及下级直属单位数据"),
|
UNIT_DIRECT_SUBORDINATE(6, "本单位及下级直属单位数据"),
|
||||||
|
|
||||||
@ -24,6 +24,8 @@ public enum AttrPermissionEnum {
|
|||||||
UNIT_ALL_SUBORDINATE(8, "本单位及以下协同(直属+合作)单位数据"),
|
UNIT_ALL_SUBORDINATE(8, "本单位及以下协同(直属+合作)单位数据"),
|
||||||
WORKSPACE(9, "本项目数据"),
|
WORKSPACE(9, "本项目数据"),
|
||||||
EQUAL_TO_ROW(10, "同行级数据权限"),
|
EQUAL_TO_ROW(10, "同行级数据权限"),
|
||||||
|
|
||||||
|
UNIT_ONLY_EXCLUDE_TEAM(11, "仅本单位数据(不包含班组)"),
|
||||||
;
|
;
|
||||||
private final Integer value;
|
private final Integer value;
|
||||||
private final String desc;
|
private final String desc;
|
||||||
@ -34,6 +36,6 @@ public enum AttrPermissionEnum {
|
|||||||
|
|
||||||
public static List<AttrPermissionEnum> listAttrPermissionForNotWorkspace() {
|
public static List<AttrPermissionEnum> listAttrPermissionForNotWorkspace() {
|
||||||
return Lists.newArrayList(SELF_ONLY, SELF_SUBORDINATE,
|
return Lists.newArrayList(SELF_ONLY, SELF_SUBORDINATE,
|
||||||
DEPARTMENT_ONLY, DEPARTMENT_SUBORDINATE, UNIT_ONLY, EQUAL_TO_ROW);
|
DEPARTMENT_ONLY, DEPARTMENT_SUBORDINATE, UNIT_ONLY, UNIT_ONLY_EXCLUDE_TEAM, EQUAL_TO_ROW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,14 +18,16 @@ public enum RowPermissionEnum {
|
|||||||
|
|
||||||
DEPARTMENT_SUBORDINATE(4, "本部门及以下数据"),
|
DEPARTMENT_SUBORDINATE(4, "本部门及以下数据"),
|
||||||
|
|
||||||
UNIT_ONLY(5, "仅本单位数据"),
|
UNIT_ONLY(5, "仅本单位数据(包含班组)"),
|
||||||
|
|
||||||
UNIT_DIRECT_SUBORDINATE(6, "本单位及下级直属单位数据"),
|
UNIT_DIRECT_SUBORDINATE(6, "本单位及下级直属单位数据"),
|
||||||
|
|
||||||
UNIT_COOPERATE_SUBORDINATE(7, "本单位及下级协同(直属+合作)单位数据"),
|
UNIT_COOPERATE_SUBORDINATE(7, "本单位及下级协同(直属+合作)单位数据"),
|
||||||
|
|
||||||
UNIT_ALL_SUBORDINATE(8, "本单位及以下协同(直属+合作)单位数据"),
|
UNIT_ALL_SUBORDINATE(8, "本单位及以下协同(直属+合作)单位数据"),
|
||||||
WORKSPACE(9, "本项目数据"),
|
WORKSPACE(9, "本项目部数据"),
|
||||||
|
|
||||||
|
UNIT_ONLY_EXCLUDE_TEAM(10, "仅本单位数据(不包含班组)"),
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
@ -41,7 +43,7 @@ public enum RowPermissionEnum {
|
|||||||
|
|
||||||
public static List<RowPermissionEnum> listRowPermissionForNotWorkspace() {
|
public static List<RowPermissionEnum> listRowPermissionForNotWorkspace() {
|
||||||
return Lists.newArrayList(SELF_ONLY, SELF_SUBORDINATE,
|
return Lists.newArrayList(SELF_ONLY, SELF_SUBORDINATE,
|
||||||
DEPARTMENT_ONLY, DEPARTMENT_SUBORDINATE, UNIT_ONLY);
|
DEPARTMENT_ONLY, DEPARTMENT_SUBORDINATE, UNIT_ONLY, UNIT_ONLY_EXCLUDE_TEAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,11 +2,7 @@ package cn.axzo.tyr.client.feign;
|
|||||||
|
|
||||||
import cn.axzo.basics.common.page.PageResult;
|
import cn.axzo.basics.common.page.PageResult;
|
||||||
import cn.axzo.framework.domain.web.result.ApiResult;
|
import cn.axzo.framework.domain.web.result.ApiResult;
|
||||||
import cn.axzo.tyr.client.common.annotation.RepeatedSubmit;
|
import cn.axzo.tyr.client.model.req.*;
|
||||||
import cn.axzo.tyr.client.model.req.CreateDataObjectReq;
|
|
||||||
import cn.axzo.tyr.client.model.req.DeleteDataObjectReq;
|
|
||||||
import cn.axzo.tyr.client.model.req.EditDataObjectReq;
|
|
||||||
import cn.axzo.tyr.client.model.req.PageDataObjectReq;
|
|
||||||
import cn.axzo.tyr.client.model.res.DataObjectRes;
|
import cn.axzo.tyr.client.model.res.DataObjectRes;
|
||||||
import cn.axzo.tyr.client.model.res.EnumRes;
|
import cn.axzo.tyr.client.model.res.EnumRes;
|
||||||
import cn.axzo.tyr.client.model.res.SimpleDataObjectRes;
|
import cn.axzo.tyr.client.model.res.SimpleDataObjectRes;
|
||||||
@ -28,7 +24,6 @@ public interface DataObjectApi {
|
|||||||
@PostMapping("/api/dataObject/create")
|
@PostMapping("/api/dataObject/create")
|
||||||
ApiResult<Long> createDataObject(@RequestBody @Valid CreateDataObjectReq req);
|
ApiResult<Long> createDataObject(@RequestBody @Valid CreateDataObjectReq req);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改数据对象
|
* 修改数据对象
|
||||||
* @param req
|
* @param req
|
||||||
@ -63,4 +58,12 @@ public interface DataObjectApi {
|
|||||||
*/
|
*/
|
||||||
@GetMapping("/api/dataObject/get")
|
@GetMapping("/api/dataObject/get")
|
||||||
ApiResult<DataObjectRes> getDataObject(@RequestParam Long dataObjectId);
|
ApiResult<DataObjectRes> getDataObject(@RequestParam Long dataObjectId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据租户范围、数据对象code查询数据对象
|
||||||
|
* @param req
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/api/dataObject/query")
|
||||||
|
ApiResult<DataObjectRes> queryDataObject(@RequestBody @Valid QueryDataObjectReq req);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,7 +15,7 @@ public class AttributePermissionBO {
|
|||||||
private Integer sort; // 序号
|
private Integer sort; // 序号
|
||||||
private String attrName; //字段名
|
private String attrName; //字段名
|
||||||
private String attrCode; // 字段code
|
private String attrCode; // 字段code
|
||||||
private Integer visibilityScope; // 字段值查看范围 1:仅本人数据 2:本人及下属数据 3:仅本部门数据 4:本部门及以下数据 5:仅本单位数据 6:本单位及下级直属单位数据 7:本单位及下级协同(直属+合作)单位数据 8:本单位及以下协同(直属+合作)单位数据 9:本项目数据 10:同行级数据权限
|
private Integer visibilityScope; // 字段值查看范围 1:仅本人数据 2:本人及下属数据 3:仅本部门数据 4:本部门及以下数据 5:仅本单位数据(包含班组) 6:本单位及下级直属单位数据 7:本单位及下级协同(直属+合作)单位数据 8:本单位及以下协同(直属+合作)单位数据 9:本项目部数据 10:同行级数据权限 11:仅本单位数据(不包含班组)
|
||||||
private Integer isUnmaskable; // 是否可脱敏 1-不可操作脱敏 2-可操作脱敏
|
private Integer isUnmaskable; // 是否可脱敏 1-不可操作脱敏 2-可操作脱敏
|
||||||
private Integer isEditable; // 是否可编辑 1-不可编辑 2-可编辑
|
private Integer isEditable; // 是否可编辑 1-不可编辑 2-可编辑
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,10 +39,19 @@ public class DataObjectRuleBO {
|
|||||||
* 岗位/角色id
|
* 岗位/角色id
|
||||||
*/
|
*/
|
||||||
private List<Long> relationId;
|
private List<Long> relationId;
|
||||||
|
/**
|
||||||
|
* 岗位code
|
||||||
|
*/
|
||||||
|
private List<String> relationCodes;
|
||||||
|
/**
|
||||||
|
* 岗位列表
|
||||||
|
*/
|
||||||
|
private List<JobInfo> jobs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 行级数据权限(单选) 1:仅本人数据 2:本人及下属数据 3:仅本部门数据 4:本部门及以下数据
|
* 行级数据权限(单选) 1:仅本人数据 2:本人及下属数据 3:仅本部门数据 4:本部门及以下数据
|
||||||
* 5:仅本单位数据 6:本单位及下级直属单位数据 7:本单位及下级协同(直属+合作)单位数据 8:本单位及以下协同(直属+合作)单位数据 9:本项目数据
|
* 5:仅本单位数据(包含班组) 6:本单位及下级直属单位数据 7:本单位及下级协同(直属+合作)单位数据 8:本单位及以下协同(直属+合作)单位数据
|
||||||
|
* 9:本项目部数据 10:仅本单位数据(不包含班组)
|
||||||
*/
|
*/
|
||||||
private Integer rowPermission;
|
private Integer rowPermission;
|
||||||
/**
|
/**
|
||||||
@ -50,4 +59,12 @@ public class DataObjectRuleBO {
|
|||||||
*/
|
*/
|
||||||
private List<AttributePermissionBO> attributePermissionBOList;
|
private List<AttributePermissionBO> attributePermissionBOList;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public static class JobInfo{
|
||||||
|
private Long id;
|
||||||
|
private String code;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,32 @@
|
|||||||
|
package cn.axzo.tyr.client.model.req;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author likunpeng
|
||||||
|
* @version 1.0
|
||||||
|
* @date 2024/6/3
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class QueryDataObjectReq implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据对象code
|
||||||
|
*/
|
||||||
|
@NotBlank(message = "数据对象code不能为空")
|
||||||
|
private String dataObjectCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户范围 1:单位租户 2:项目租户 3:政务监管平台 6:OMS
|
||||||
|
*/
|
||||||
|
private Integer tenantScope;
|
||||||
|
}
|
||||||
@ -1,6 +1,5 @@
|
|||||||
package cn.axzo.tyr.server.controller.data.object;
|
package cn.axzo.tyr.server.controller.data.object;
|
||||||
|
|
||||||
import cn.axzo.basics.auth.enums.WorkspaceTypeWithLegacyEnum;
|
|
||||||
import cn.axzo.basics.common.page.PageResult;
|
import cn.axzo.basics.common.page.PageResult;
|
||||||
import cn.axzo.framework.domain.ServiceException;
|
import cn.axzo.framework.domain.ServiceException;
|
||||||
import cn.axzo.framework.domain.web.result.ApiResult;
|
import cn.axzo.framework.domain.web.result.ApiResult;
|
||||||
@ -10,12 +9,8 @@ import cn.axzo.tyr.client.common.enums.EnumTypeEnum;
|
|||||||
import cn.axzo.tyr.client.common.enums.ReturnCodeEnum;
|
import cn.axzo.tyr.client.common.enums.ReturnCodeEnum;
|
||||||
import cn.axzo.tyr.client.common.enums.RowPermissionEnum;
|
import cn.axzo.tyr.client.common.enums.RowPermissionEnum;
|
||||||
import cn.axzo.tyr.client.common.enums.TenantScopeEnum;
|
import cn.axzo.tyr.client.common.enums.TenantScopeEnum;
|
||||||
import cn.axzo.tyr.client.common.enums.WorkspaceJoinType;
|
|
||||||
import cn.axzo.tyr.client.feign.DataObjectApi;
|
import cn.axzo.tyr.client.feign.DataObjectApi;
|
||||||
import cn.axzo.tyr.client.model.req.CreateDataObjectReq;
|
import cn.axzo.tyr.client.model.req.*;
|
||||||
import cn.axzo.tyr.client.model.req.DeleteDataObjectReq;
|
|
||||||
import cn.axzo.tyr.client.model.req.EditDataObjectReq;
|
|
||||||
import cn.axzo.tyr.client.model.req.PageDataObjectReq;
|
|
||||||
import cn.axzo.tyr.client.model.res.DataObjectRes;
|
import cn.axzo.tyr.client.model.res.DataObjectRes;
|
||||||
import cn.axzo.tyr.client.model.res.EnumRes;
|
import cn.axzo.tyr.client.model.res.EnumRes;
|
||||||
import cn.axzo.tyr.client.model.res.SimpleDataObjectRes;
|
import cn.axzo.tyr.client.model.res.SimpleDataObjectRes;
|
||||||
@ -91,4 +86,8 @@ public class DataObjectController implements DataObjectApi {
|
|||||||
return ApiResult.ok(dataObjectService.getDataObject(dataObjectId));
|
return ApiResult.ok(dataObjectService.getDataObject(dataObjectId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApiResult<DataObjectRes> queryDataObject(QueryDataObjectReq req) {
|
||||||
|
return ApiResult.ok(dataObjectService.queryDataObject(req));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,4 +36,8 @@ public class DataObjectRuleScope extends BaseOperatorEntity<DataObjectRuleScope>
|
|||||||
* 岗位id/角色id
|
* 岗位id/角色id
|
||||||
*/
|
*/
|
||||||
private Long relationId;
|
private Long relationId;
|
||||||
|
/**
|
||||||
|
* 岗位编码
|
||||||
|
*/
|
||||||
|
private String relationCode;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import cn.axzo.basics.common.page.PageResult;
|
|||||||
import cn.axzo.tyr.client.model.req.CreateDataObjectReq;
|
import cn.axzo.tyr.client.model.req.CreateDataObjectReq;
|
||||||
import cn.axzo.tyr.client.model.req.EditDataObjectReq;
|
import cn.axzo.tyr.client.model.req.EditDataObjectReq;
|
||||||
import cn.axzo.tyr.client.model.req.PageDataObjectReq;
|
import cn.axzo.tyr.client.model.req.PageDataObjectReq;
|
||||||
|
import cn.axzo.tyr.client.model.req.QueryDataObjectReq;
|
||||||
import cn.axzo.tyr.client.model.res.DataObjectRes;
|
import cn.axzo.tyr.client.model.res.DataObjectRes;
|
||||||
import cn.axzo.tyr.client.model.res.SimpleDataObjectRes;
|
import cn.axzo.tyr.client.model.res.SimpleDataObjectRes;
|
||||||
|
|
||||||
@ -17,4 +18,6 @@ public interface DataObjectService {
|
|||||||
PageResult<SimpleDataObjectRes> pageDataObject(PageDataObjectReq req);
|
PageResult<SimpleDataObjectRes> pageDataObject(PageDataObjectReq req);
|
||||||
|
|
||||||
DataObjectRes getDataObject(Long dataObjectId);
|
DataObjectRes getDataObject(Long dataObjectId);
|
||||||
|
|
||||||
|
DataObjectRes queryDataObject(QueryDataObjectReq req);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package cn.axzo.tyr.server.service.impl;
|
package cn.axzo.tyr.server.service.impl;
|
||||||
|
|
||||||
|
import cn.axzo.basics.common.constant.enums.DeleteEnum;
|
||||||
import cn.axzo.basics.common.exception.ServiceException;
|
import cn.axzo.basics.common.exception.ServiceException;
|
||||||
import cn.axzo.basics.common.page.PageResult;
|
import cn.axzo.basics.common.page.PageResult;
|
||||||
import cn.axzo.tyr.client.common.enums.ReturnCodeEnum;
|
import cn.axzo.tyr.client.common.enums.ReturnCodeEnum;
|
||||||
@ -16,6 +17,7 @@ import cn.axzo.tyr.client.model.data.object.RuleScopeQueryBO;
|
|||||||
import cn.axzo.tyr.client.model.req.CreateDataObjectReq;
|
import cn.axzo.tyr.client.model.req.CreateDataObjectReq;
|
||||||
import cn.axzo.tyr.client.model.req.EditDataObjectReq;
|
import cn.axzo.tyr.client.model.req.EditDataObjectReq;
|
||||||
import cn.axzo.tyr.client.model.req.PageDataObjectReq;
|
import cn.axzo.tyr.client.model.req.PageDataObjectReq;
|
||||||
|
import cn.axzo.tyr.client.model.req.QueryDataObjectReq;
|
||||||
import cn.axzo.tyr.client.model.res.DataObjectRes;
|
import cn.axzo.tyr.client.model.res.DataObjectRes;
|
||||||
import cn.axzo.tyr.client.model.res.SimpleDataObjectRes;
|
import cn.axzo.tyr.client.model.res.SimpleDataObjectRes;
|
||||||
import cn.axzo.tyr.server.repository.dao.DataObjectAttrDao;
|
import cn.axzo.tyr.server.repository.dao.DataObjectAttrDao;
|
||||||
@ -31,13 +33,17 @@ import cn.axzo.tyr.server.repository.entity.DataObjectRuleScope;
|
|||||||
import cn.axzo.tyr.server.service.DataObjectService;
|
import cn.axzo.tyr.server.service.DataObjectService;
|
||||||
import cn.axzo.tyr.server.utils.mapper.DataObjectMapper;
|
import cn.axzo.tyr.server.utils.mapper.DataObjectMapper;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.google.common.collect.Maps;
|
||||||
import groovy.lang.Tuple2;
|
import groovy.lang.Tuple2;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.transaction.support.TransactionTemplate;
|
import org.springframework.transaction.support.TransactionTemplate;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
@ -64,6 +70,7 @@ public class DataObjectServiceImpl implements DataObjectService {
|
|||||||
private TransactionTemplate transactionTemplate;
|
private TransactionTemplate transactionTemplate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Long createDataObject(CreateDataObjectReq req) {
|
public Long createDataObject(CreateDataObjectReq req) {
|
||||||
// 校验
|
// 校验
|
||||||
// objectName、objectCode不能重复
|
// objectName、objectCode不能重复
|
||||||
@ -88,6 +95,7 @@ public class DataObjectServiceImpl implements DataObjectService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<DataObjectRule> dataObjectRules = DataObjectMapper.INSTANCE.ruleBOs2Rules(req.getDataObjectRuleBOList());
|
List<DataObjectRule> dataObjectRules = DataObjectMapper.INSTANCE.ruleBOs2Rules(req.getDataObjectRuleBOList());
|
||||||
|
handleJobs(dataObjectRules, req.getDataObjectRuleBOList());
|
||||||
|
|
||||||
int size = (CollUtil.isNotEmpty(defaultDataObjectRules) ? defaultDataObjectRules.size() : 0)
|
int size = (CollUtil.isNotEmpty(defaultDataObjectRules) ? defaultDataObjectRules.size() : 0)
|
||||||
+ (CollUtil.isNotEmpty(dataObjectRules) ? dataObjectRules.size() : 0);
|
+ (CollUtil.isNotEmpty(dataObjectRules) ? dataObjectRules.size() : 0);
|
||||||
@ -167,6 +175,7 @@ public class DataObjectServiceImpl implements DataObjectService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void editDataObject(EditDataObjectReq req) {
|
public void editDataObject(EditDataObjectReq req) {
|
||||||
// 对象属性名和code不能重复
|
// 对象属性名和code不能重复
|
||||||
checkObjectAttrNameOrCodeUnique(req.getAttrs());
|
checkObjectAttrNameOrCodeUnique(req.getAttrs());
|
||||||
@ -196,6 +205,7 @@ public class DataObjectServiceImpl implements DataObjectService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
List<DataObjectRule> dataObjectRules = DataObjectMapper.INSTANCE.ruleBOs2Rules(req.getDataObjectRuleBOList());
|
List<DataObjectRule> dataObjectRules = DataObjectMapper.INSTANCE.ruleBOs2Rules(req.getDataObjectRuleBOList());
|
||||||
|
handleJobs(dataObjectRules, req.getDataObjectRuleBOList());
|
||||||
int size = (CollUtil.isNotEmpty(defaultDataObjectRules) ? defaultDataObjectRules.size() : 0)
|
int size = (CollUtil.isNotEmpty(defaultDataObjectRules) ? defaultDataObjectRules.size() : 0)
|
||||||
+ (CollUtil.isNotEmpty(dataObjectRules) ? dataObjectRules.size() : 0);
|
+ (CollUtil.isNotEmpty(dataObjectRules) ? dataObjectRules.size() : 0);
|
||||||
List<DataObjectRule> generalObjectRuleList = new ArrayList<>(size);
|
List<DataObjectRule> generalObjectRuleList = new ArrayList<>(size);
|
||||||
@ -235,6 +245,7 @@ public class DataObjectServiceImpl implements DataObjectService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void deleteDataObject(Long dataObjectId, Long updateBy) {
|
public void deleteDataObject(Long dataObjectId, Long updateBy) {
|
||||||
List<Long> idList = Collections.singletonList(dataObjectId);
|
List<Long> idList = Collections.singletonList(dataObjectId);
|
||||||
transactionTemplate.executeWithoutResult(status -> {
|
transactionTemplate.executeWithoutResult(status -> {
|
||||||
@ -274,87 +285,22 @@ public class DataObjectServiceImpl implements DataObjectService {
|
|||||||
if (Objects.isNull(dataObject)) {
|
if (Objects.isNull(dataObject)) {
|
||||||
throw new cn.axzo.framework.domain.ServiceException(ReturnCodeEnum.DATA_NOT_EXIST.getMessage());
|
throw new cn.axzo.framework.domain.ServiceException(ReturnCodeEnum.DATA_NOT_EXIST.getMessage());
|
||||||
}
|
}
|
||||||
DataObjectRes res = DataObjectMapper.INSTANCE.dataObject2DataObjectRes(dataObject);
|
|
||||||
|
|
||||||
// 获取数据对象字段
|
return buildDataObjectRes(dataObject);
|
||||||
DataObjectAttrQueryBO bo1 = DataObjectAttrQueryBO.builder().dataObjectId(dataObjectId).build();
|
}
|
||||||
List<DataObjectAttr> objectAttrList = dataObjectAttrDao.listByBO(bo1);
|
|
||||||
Map<String, String> attrMap;
|
@Override
|
||||||
if (CollUtil.isNotEmpty(objectAttrList)) {
|
public DataObjectRes queryDataObject(QueryDataObjectReq req) {
|
||||||
List<AttributeBO> attributeBOS = DataObjectMapper.INSTANCE.dataObjectAttrs2AttributeBOs(objectAttrList);
|
List<DataObject> dataObjects = dataObjectDao.lambdaQuery()
|
||||||
List<AttributeBO> attributeBOList = attributeBOS.stream().sorted(Comparator.comparing(AttributeBO::getSort)).collect(Collectors.toList());
|
.eq(DataObject::getIsDelete, DeleteEnum.NORMAL.getValue())
|
||||||
res.setAttrs(attributeBOList);
|
.eq(StringUtils.isNotBlank(req.getDataObjectCode()), DataObject::getDataObjectCode, req.getDataObjectCode())
|
||||||
attrMap = attributeBOList.stream().collect(Collectors.toMap(AttributeBO::getAttrCode, AttributeBO::getAttrName, (a, b) -> a));
|
.eq(Objects.nonNull(req.getTenantScope()), DataObject::getTenantScope, req.getTenantScope())
|
||||||
} else {
|
.list();
|
||||||
attrMap = null;
|
if (CollectionUtils.isEmpty(dataObjects)) {
|
||||||
|
log.warn("数据权限记录不存在,param:{}", JSON.toJSONString(req));
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
return buildDataObjectRes(dataObjects.get(0));
|
||||||
// 获取数据对象规则
|
|
||||||
DataObjectRuleQueryBO bo2 = DataObjectRuleQueryBO.builder().dataObjectId(dataObjectId).build();
|
|
||||||
List<DataObjectRule> dataObjectRules = dataObjectRuleDao.listByBO(bo2);
|
|
||||||
if (CollUtil.isNotEmpty(dataObjectRules)) {
|
|
||||||
res.setDataObjectRuleBOList(new ArrayList<>(dataObjectRules.size() - 1));
|
|
||||||
dataObjectRules.forEach(e -> {
|
|
||||||
if (YesNoEnum.YES.getValue().equals(e.getIsDefault())) {
|
|
||||||
DefaultDataObjectRuleBO ruleBO = DataObjectMapper.INSTANCE.rule2DefaultRuleBO(e);
|
|
||||||
res.setDefaultDataObjectRuleBO(ruleBO);
|
|
||||||
} else {
|
|
||||||
DataObjectRuleBO ruleBO = DataObjectMapper.INSTANCE.rule2RuleBO(e);
|
|
||||||
res.getDataObjectRuleBOList().add(ruleBO);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (CollUtil.isNotEmpty(res.getDataObjectRuleBOList())) {
|
|
||||||
List<DataObjectRuleBO> sortedRuleList = res.getDataObjectRuleBOList().stream().sorted(Comparator.comparing(DataObjectRuleBO::getSort)).collect(Collectors.toList());
|
|
||||||
res.setDataObjectRuleBOList(sortedRuleList);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// 获取数据对象规则字段
|
|
||||||
RuleAttrQueryBO bo3 = RuleAttrQueryBO.builder().dataObjectId(dataObjectId).build();
|
|
||||||
List<DataObjectRuleAttr> ruleAttrList = dataObjectRuleAttrDao.listByBO(bo3);
|
|
||||||
if (CollUtil.isNotEmpty(attrMap) && CollUtil.isNotEmpty(ruleAttrList)) {
|
|
||||||
Map<Long, List<DataObjectRuleAttr>> ruleAttrMap = ruleAttrList.stream().collect(Collectors.groupingBy(DataObjectRuleAttr::getDataObjectRuleId));
|
|
||||||
// 默认
|
|
||||||
List<DataObjectRuleAttr> ruleAttrList1 = ruleAttrMap.get(res.getDefaultDataObjectRuleBO().getDataObjectRuleId());
|
|
||||||
if (CollUtil.isNotEmpty(ruleAttrList1)) {
|
|
||||||
List<AttributePermissionBO> permissionBOs = DataObjectMapper.INSTANCE.ruleAttrs2AttrPermissionBOs(ruleAttrList1);
|
|
||||||
permissionBOs.forEach(e -> e.setAttrName(attrMap.get(e.getAttrCode())));
|
|
||||||
List<AttributePermissionBO> permissionBOList = permissionBOs.stream().sorted(Comparator.comparing(AttributePermissionBO::getSort)).collect(Collectors.toList());
|
|
||||||
res.getDefaultDataObjectRuleBO().setAttributePermissionBOList(permissionBOList);
|
|
||||||
}
|
|
||||||
|
|
||||||
//自定义
|
|
||||||
if (CollUtil.isNotEmpty(res.getDataObjectRuleBOList())) {
|
|
||||||
res.getDataObjectRuleBOList().forEach(e -> buildRuleAttr(attrMap, ruleAttrMap, e));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 获取数据对象规则范围
|
|
||||||
RuleScopeQueryBO bo4 = RuleScopeQueryBO.builder().dataObjectId(dataObjectId).build();
|
|
||||||
List<DataObjectRuleScope> scopeList = dataObjectRuleScopeDao.listByBO(bo4);
|
|
||||||
if (CollUtil.isNotEmpty(scopeList)) {
|
|
||||||
Map<Long, List<DataObjectRuleScope>> scopeMap = scopeList.stream().collect(Collectors.groupingBy(DataObjectRuleScope::getDataObjectRuleId));
|
|
||||||
// 默认
|
|
||||||
List<DataObjectRuleScope> defaultScopeList = scopeMap.get(res.getDefaultDataObjectRuleBO().getDataObjectRuleId());
|
|
||||||
if (CollUtil.isNotEmpty(defaultScopeList)) {
|
|
||||||
List<Long> relationIdList = defaultScopeList.stream().map(DataObjectRuleScope::getRelationId).collect(Collectors.toList());
|
|
||||||
res.getDefaultDataObjectRuleBO().setRelationId(relationIdList);
|
|
||||||
}
|
|
||||||
|
|
||||||
//自定义
|
|
||||||
if (CollUtil.isNotEmpty(res.getDataObjectRuleBOList())) {
|
|
||||||
res.getDataObjectRuleBOList().forEach(e -> {
|
|
||||||
List<DataObjectRuleScope> scopeList1 = scopeMap.get(e.getDataObjectRuleId());
|
|
||||||
if (CollUtil.isNotEmpty(scopeList1)) {
|
|
||||||
List<Long> relationIdList = scopeList1.stream().map(DataObjectRuleScope::getRelationId).collect(Collectors.toList());
|
|
||||||
e.setRelationId(relationIdList);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void buildRuleAttr(Map<String, String> attrMap, Map<Long, List<DataObjectRuleAttr>> ruleAttrMap, DataObjectRuleBO e) {
|
private static void buildRuleAttr(Map<String, String> attrMap, Map<Long, List<DataObjectRuleAttr>> ruleAttrMap, DataObjectRuleBO e) {
|
||||||
@ -428,4 +374,114 @@ public class DataObjectServiceImpl implements DataObjectService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private DataObjectRes buildDataObjectRes(DataObject dataObject) {
|
||||||
|
DataObjectRes res = DataObjectMapper.INSTANCE.dataObject2DataObjectRes(dataObject);
|
||||||
|
|
||||||
|
// 获取数据对象字段
|
||||||
|
DataObjectAttrQueryBO bo1 = DataObjectAttrQueryBO.builder().dataObjectId(dataObject.getId()).build();
|
||||||
|
List<DataObjectAttr> objectAttrList = dataObjectAttrDao.listByBO(bo1);
|
||||||
|
Map<String, String> attrMap;
|
||||||
|
if (CollUtil.isNotEmpty(objectAttrList)) {
|
||||||
|
List<AttributeBO> attributeBOS = DataObjectMapper.INSTANCE.dataObjectAttrs2AttributeBOs(objectAttrList);
|
||||||
|
List<AttributeBO> attributeBOList = attributeBOS.stream().sorted(Comparator.comparing(AttributeBO::getSort)).collect(Collectors.toList());
|
||||||
|
res.setAttrs(attributeBOList);
|
||||||
|
attrMap = attributeBOList.stream().collect(Collectors.toMap(AttributeBO::getAttrCode, AttributeBO::getAttrName, (a, b) -> a));
|
||||||
|
} else {
|
||||||
|
attrMap = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取数据对象规则
|
||||||
|
DataObjectRuleQueryBO bo2 = DataObjectRuleQueryBO.builder().dataObjectId(dataObject.getId()).build();
|
||||||
|
List<DataObjectRule> dataObjectRules = dataObjectRuleDao.listByBO(bo2);
|
||||||
|
if (CollUtil.isNotEmpty(dataObjectRules)) {
|
||||||
|
res.setDataObjectRuleBOList(new ArrayList<>(dataObjectRules.size() - 1));
|
||||||
|
dataObjectRules.forEach(e -> {
|
||||||
|
if (YesNoEnum.YES.getValue().equals(e.getIsDefault())) {
|
||||||
|
DefaultDataObjectRuleBO ruleBO = DataObjectMapper.INSTANCE.rule2DefaultRuleBO(e);
|
||||||
|
res.setDefaultDataObjectRuleBO(ruleBO);
|
||||||
|
} else {
|
||||||
|
DataObjectRuleBO ruleBO = DataObjectMapper.INSTANCE.rule2RuleBO(e);
|
||||||
|
res.getDataObjectRuleBOList().add(ruleBO);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (CollUtil.isNotEmpty(res.getDataObjectRuleBOList())) {
|
||||||
|
List<DataObjectRuleBO> sortedRuleList = res.getDataObjectRuleBOList().stream().sorted(Comparator.comparing(DataObjectRuleBO::getSort)).collect(Collectors.toList());
|
||||||
|
res.setDataObjectRuleBOList(sortedRuleList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 获取数据对象规则字段
|
||||||
|
RuleAttrQueryBO bo3 = RuleAttrQueryBO.builder().dataObjectId(dataObject.getId()).build();
|
||||||
|
List<DataObjectRuleAttr> ruleAttrList = dataObjectRuleAttrDao.listByBO(bo3);
|
||||||
|
if (CollUtil.isNotEmpty(attrMap) && CollUtil.isNotEmpty(ruleAttrList)) {
|
||||||
|
Map<Long, List<DataObjectRuleAttr>> ruleAttrMap = ruleAttrList.stream().collect(Collectors.groupingBy(DataObjectRuleAttr::getDataObjectRuleId));
|
||||||
|
// 默认
|
||||||
|
List<DataObjectRuleAttr> ruleAttrList1 = ruleAttrMap.get(res.getDefaultDataObjectRuleBO().getDataObjectRuleId());
|
||||||
|
if (CollUtil.isNotEmpty(ruleAttrList1)) {
|
||||||
|
List<AttributePermissionBO> permissionBOs = DataObjectMapper.INSTANCE.ruleAttrs2AttrPermissionBOs(ruleAttrList1);
|
||||||
|
permissionBOs.forEach(e -> e.setAttrName(attrMap.get(e.getAttrCode())));
|
||||||
|
List<AttributePermissionBO> permissionBOList = permissionBOs.stream().sorted(Comparator.comparing(AttributePermissionBO::getSort)).collect(Collectors.toList());
|
||||||
|
res.getDefaultDataObjectRuleBO().setAttributePermissionBOList(permissionBOList);
|
||||||
|
}
|
||||||
|
|
||||||
|
//自定义
|
||||||
|
if (CollUtil.isNotEmpty(res.getDataObjectRuleBOList())) {
|
||||||
|
res.getDataObjectRuleBOList().forEach(e -> buildRuleAttr(attrMap, ruleAttrMap, e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取数据对象规则范围
|
||||||
|
RuleScopeQueryBO bo4 = RuleScopeQueryBO.builder().dataObjectId(dataObject.getId()).build();
|
||||||
|
List<DataObjectRuleScope> scopeList = dataObjectRuleScopeDao.listByBO(bo4);
|
||||||
|
if (CollUtil.isNotEmpty(scopeList)) {
|
||||||
|
Map<Long, List<DataObjectRuleScope>> scopeMap = scopeList.stream().collect(Collectors.groupingBy(DataObjectRuleScope::getDataObjectRuleId));
|
||||||
|
// 默认
|
||||||
|
List<DataObjectRuleScope> defaultScopeList = scopeMap.get(res.getDefaultDataObjectRuleBO().getDataObjectRuleId());
|
||||||
|
if (CollUtil.isNotEmpty(defaultScopeList)) {
|
||||||
|
List<Long> relationIdList = defaultScopeList.stream().map(DataObjectRuleScope::getRelationId).collect(Collectors.toList());
|
||||||
|
res.getDefaultDataObjectRuleBO().setRelationId(relationIdList);
|
||||||
|
}
|
||||||
|
|
||||||
|
//自定义
|
||||||
|
if (CollUtil.isNotEmpty(res.getDataObjectRuleBOList())) {
|
||||||
|
res.getDataObjectRuleBOList().forEach(e -> {
|
||||||
|
List<DataObjectRuleScope> scopeList1 = scopeMap.get(e.getDataObjectRuleId());
|
||||||
|
if (CollUtil.isNotEmpty(scopeList1)) {
|
||||||
|
List<Long> relationIdList = scopeList1.stream().map(DataObjectRuleScope::getRelationId).collect(Collectors.toList());
|
||||||
|
e.setRelationId(relationIdList);
|
||||||
|
e.setRelationCodes(scopeList1.stream().map(DataObjectRuleScope::getRelationCode).filter(StringUtils::isNotBlank).collect(Collectors.toList()));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleJobs(List<DataObjectRule> dataObjectRules, List<DataObjectRuleBO> dataObjectRuleBOList) {
|
||||||
|
if (CollectionUtils.isEmpty(dataObjectRules) || CollectionUtils.isEmpty(dataObjectRuleBOList)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<Long, DataObjectRuleBO.JobInfo> jobInfoMap = Maps.newHashMap();
|
||||||
|
for (DataObjectRuleBO ruleBO : dataObjectRuleBOList) {
|
||||||
|
if (1 == ruleBO.getRuleScopeType() && CollectionUtils.isNotEmpty(ruleBO.getJobs())) {
|
||||||
|
ruleBO.getJobs().forEach(e -> {
|
||||||
|
jobInfoMap.put(e.getId(), e);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (DataObjectRule rule : dataObjectRules) {
|
||||||
|
if (1 == rule.getRuleScopeType() && CollectionUtils.isNotEmpty(rule.getDataObjectRuleScopeList())) {
|
||||||
|
rule.getDataObjectRuleScopeList().forEach(e -> {
|
||||||
|
if (Objects.nonNull(e.getRelationId()) && jobInfoMap.containsKey(e.getRelationId())) {
|
||||||
|
e.setRelationCode(jobInfoMap.get(e.getRelationId()).getCode());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,6 +30,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.apache.commons.collections.CollectionUtils;
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
@ -48,6 +49,7 @@ public class DataResourceServiceImpl implements DataResourceService {
|
|||||||
private final SaasFeatureDao saasFeatureDao;
|
private final SaasFeatureDao saasFeatureDao;
|
||||||
private final SaasFeatureDataResourceDao saasFeatureDataResourceDao;
|
private final SaasFeatureDataResourceDao saasFeatureDataResourceDao;
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void create(CreateDataResourceParam param) {
|
public void create(CreateDataResourceParam param) {
|
||||||
DataResource existDataResource = dataResourceDao.lambdaQuery()
|
DataResource existDataResource = dataResourceDao.lambdaQuery()
|
||||||
.eq(DataResource::getResourceCode, param.getResourceCode())
|
.eq(DataResource::getResourceCode, param.getResourceCode())
|
||||||
@ -72,6 +74,7 @@ public class DataResourceServiceImpl implements DataResourceService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean delete(DeleteDataResourceParam param) {
|
public boolean delete(DeleteDataResourceParam param) {
|
||||||
DataResource dataResource = dataResourceDao.getById(param.getId());
|
DataResource dataResource = dataResourceDao.getById(param.getId());
|
||||||
if (Objects.nonNull(dataResource)) {
|
if (Objects.nonNull(dataResource)) {
|
||||||
@ -109,6 +112,7 @@ public class DataResourceServiceImpl implements DataResourceService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean update(UpdateDataResourceParam param) {
|
public boolean update(UpdateDataResourceParam param) {
|
||||||
DataResource dataResource = new DataResource();
|
DataResource dataResource = new DataResource();
|
||||||
BeanUtils.copyProperties(param, dataResource);
|
BeanUtils.copyProperties(param, dataResource);
|
||||||
@ -116,6 +120,7 @@ public class DataResourceServiceImpl implements DataResourceService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void createDataResourceSaasFeature(DataResourceSaasFeatureParam param) {
|
public void createDataResourceSaasFeature(DataResourceSaasFeatureParam param) {
|
||||||
DataResource existDataResource = dataResourceDao.lambdaQuery()
|
DataResource existDataResource = dataResourceDao.lambdaQuery()
|
||||||
.eq(DataResource::getResourceCode, param.getResourceCode())
|
.eq(DataResource::getResourceCode, param.getResourceCode())
|
||||||
|
|||||||
@ -35,6 +35,7 @@ import org.slf4j.MDC;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
@ -112,6 +113,7 @@ public class FeatureResourceSyncServiceImpl implements FeatureResourceSyncServic
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void syncFromBase(ResourceSyncReq req) {
|
public void syncFromBase(ResourceSyncReq req) {
|
||||||
req.setTraceId(MDC.get(Constants.CTX_LOG_ID_MDC));
|
req.setTraceId(MDC.get(Constants.CTX_LOG_ID_MDC));
|
||||||
if (req.getIds().size() > 1) {
|
if (req.getIds().size() > 1) {
|
||||||
|
|||||||
@ -333,6 +333,7 @@ public class PermissionPointServiceImpl implements PermissionPointService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public PermissionPointDTO save(PermissionPointDTO dto) {
|
public PermissionPointDTO save(PermissionPointDTO dto) {
|
||||||
if (dto.getId() == null) {
|
if (dto.getId() == null) {
|
||||||
return doInsert(dto);
|
return doInsert(dto);
|
||||||
@ -501,6 +502,7 @@ public class PermissionPointServiceImpl implements PermissionPointService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void move(PermissionPointMoveRequest request) {
|
public void move(PermissionPointMoveRequest request) {
|
||||||
SaasFeature feature = getAndCheck(request.getPermissionId());
|
SaasFeature feature = getAndCheck(request.getPermissionId());
|
||||||
changeParent(feature, request);
|
changeParent(feature, request);
|
||||||
|
|||||||
@ -170,6 +170,7 @@ public class ProductServiceImpl implements ProductService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public ApiResult<ProductVO> add(ProductAddReq req) {
|
public ApiResult<ProductVO> add(ProductAddReq req) {
|
||||||
Optional<ProductModule> optProduct = productModuleDao.lambdaQuery()
|
Optional<ProductModule> optProduct = productModuleDao.lambdaQuery()
|
||||||
.eq(ProductModule::getProductName, req.getProductName())
|
.eq(ProductModule::getProductName, req.getProductName())
|
||||||
@ -186,6 +187,7 @@ public class ProductServiceImpl implements ProductService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public ApiResult<ProductVO> update(ProductUpdateReq req) {
|
public ApiResult<ProductVO> update(ProductUpdateReq req) {
|
||||||
Optional<ProductModule> optProduct = productModuleDao.lambdaQuery()
|
Optional<ProductModule> optProduct = productModuleDao.lambdaQuery()
|
||||||
.eq(ProductModule::getProductName, req.getProductName())
|
.eq(ProductModule::getProductName, req.getProductName())
|
||||||
@ -219,6 +221,7 @@ public class ProductServiceImpl implements ProductService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public ApiResult<ProductVO> delete(Long id) {
|
public ApiResult<ProductVO> delete(Long id) {
|
||||||
ProductModule productModule = productModuleDao.getById(id);
|
ProductModule productModule = productModuleDao.getById(id);
|
||||||
AssertUtil.isTrue(Objects.nonNull(productModule), "产品不存在");
|
AssertUtil.isTrue(Objects.nonNull(productModule), "产品不存在");
|
||||||
|
|||||||
@ -357,12 +357,14 @@ public class RoleUserService implements SaasRoleUserService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void removeWorkspaceOuAllUserRole(Long workspaceId, Long ouId) {
|
public void removeWorkspaceOuAllUserRole(Long workspaceId, Long ouId) {
|
||||||
saasRoleDao.removeWorkspaceOuAllRole(workspaceId, ouId);
|
saasRoleDao.removeWorkspaceOuAllRole(workspaceId, ouId);
|
||||||
roleUserRelationDao.removeWorkspaceOuAllUserRole(workspaceId, ouId);
|
roleUserRelationDao.removeWorkspaceOuAllUserRole(workspaceId, ouId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void grantOrUngrantWorkerLeader(GantOrUnGantaWorkerLeaderRoleReq req) {
|
public void grantOrUngrantWorkerLeader(GantOrUnGantaWorkerLeaderRoleReq req) {
|
||||||
Boolean grant = req.getGrant();
|
Boolean grant = req.getGrant();
|
||||||
// 授权
|
// 授权
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import com.baomidou.mybatisplus.core.exceptions.MybatisPlusException;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@ -103,6 +104,7 @@ public class SaasBasicDictServiceImpl implements SaasBasicDictService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Long create(BasicDictCreateReq req) {
|
public Long create(BasicDictCreateReq req) {
|
||||||
SaasBasicDict parent = saasBasicDictDao.getById(req.getParentId());
|
SaasBasicDict parent = saasBasicDictDao.getById(req.getParentId());
|
||||||
if (Objects.isNull(parent)) {
|
if (Objects.isNull(parent)) {
|
||||||
@ -145,6 +147,7 @@ public class SaasBasicDictServiceImpl implements SaasBasicDictService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean update(BasicDictUpdateReq req) {
|
public Boolean update(BasicDictUpdateReq req) {
|
||||||
BasicDictNodeResp currentNode = getById(req.getId());
|
BasicDictNodeResp currentNode = getById(req.getId());
|
||||||
if (Objects.isNull(currentNode)) {
|
if (Objects.isNull(currentNode)) {
|
||||||
@ -166,6 +169,7 @@ public class SaasBasicDictServiceImpl implements SaasBasicDictService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean updateStauts(BasicDictUpdateStatusReq req) {
|
public Boolean updateStauts(BasicDictUpdateStatusReq req) {
|
||||||
return saasBasicDictDao.updateStatus(req);
|
return saasBasicDictDao.updateStatus(req);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -256,6 +256,7 @@ public class SaasFeatureResourceServiceImpl extends ServiceImpl<SaasFeatureResou
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@CacheEvict(value = SaasFeatureResourceCacheService.CACHE_FEATURE_RESOURCE_TREE,allEntries = true)
|
@CacheEvict(value = SaasFeatureResourceCacheService.CACHE_FEATURE_RESOURCE_TREE,allEntries = true)
|
||||||
public void updateFeatureAuthType(Long featureId, Integer authType) {
|
public void updateFeatureAuthType(Long featureId, Integer authType) {
|
||||||
if (featureId != null && authType != null) {
|
if (featureId != null && authType != null) {
|
||||||
|
|||||||
@ -43,6 +43,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||||||
import org.slf4j.MDC;
|
import org.slf4j.MDC;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -139,6 +140,7 @@ public class SaasRoleGroupServiceImpl extends ServiceImpl<SaasRoleGroupMapper, S
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Long saveOrUpdate(SaasRoleGroupVO req) {
|
public Long saveOrUpdate(SaasRoleGroupVO req) {
|
||||||
SaasRoleGroup saasRoleGroup = validAndBuildGroup(req);
|
SaasRoleGroup saasRoleGroup = validAndBuildGroup(req);
|
||||||
saasRoleGroupDao.saveOrUpdate(saasRoleGroup);
|
saasRoleGroupDao.saveOrUpdate(saasRoleGroup);
|
||||||
@ -163,6 +165,7 @@ public class SaasRoleGroupServiceImpl extends ServiceImpl<SaasRoleGroupMapper, S
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void delete(List<Long> ids) {
|
public void delete(List<Long> ids) {
|
||||||
SaasRoleGroupDeleteRequest request = new SaasRoleGroupDeleteRequest();
|
SaasRoleGroupDeleteRequest request = new SaasRoleGroupDeleteRequest();
|
||||||
request.setIds(ids);
|
request.setIds(ids);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user