Merge remote-tracking branch 'origin/dev_2nd_period_test' into fix_2nd_period
This commit is contained in:
+1
-1
@@ -252,7 +252,7 @@ public class SysUserController {
|
|||||||
|
|
||||||
sysUserService.editUserWithRole(user, roles);
|
sysUserService.editUserWithRole(user, roles);
|
||||||
if (ObjectUtils.isNotEmpty(roles)) {
|
if (ObjectUtils.isNotEmpty(roles)) {
|
||||||
//如果角色包含viewer,设置责任领域权限和品牌权限
|
//如果角色包含viewer或者品牌管理员,设置责任领域权限和品牌权限
|
||||||
sysUserService.setBrandAndDutyTerritory(roles, dutyTerritories, brands, projectUserBrandList, projectUserDutyTerritoryList, id);
|
sysUserService.setBrandAndDutyTerritory(roles, dutyTerritories, brands, projectUserBrandList, projectUserDutyTerritoryList, id);
|
||||||
}
|
}
|
||||||
result.success("修改成功!");
|
result.success("修改成功!");
|
||||||
|
|||||||
+1
@@ -11,6 +11,7 @@ public enum ProjectRoleEnum {
|
|||||||
MANAGER("领导角色","11","R&H Manager"),
|
MANAGER("领导角色","11","R&H Manager"),
|
||||||
ADMIN("系统管理员","12","admin"),
|
ADMIN("系统管理员","12","admin"),
|
||||||
VIEWER("Viewer","13","Viewer"),
|
VIEWER("Viewer","13","Viewer"),
|
||||||
|
BRAND_ADMINISTRATOR("品牌管理员","14","BrandAdministrator"),
|
||||||
;
|
;
|
||||||
|
|
||||||
String name;
|
String name;
|
||||||
|
|||||||
+22
-17
@@ -713,28 +713,33 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|||||||
@Override
|
@Override
|
||||||
public void setBrandAndDutyTerritory(String roles, String dutyTerritories, String brands, List<ProjectUserBrand> projectUserBrandList, List<ProjectUserDutyTerritory> projectUserDutyTerritoryList, String userId) {
|
public void setBrandAndDutyTerritory(String roles, String dutyTerritories, String brands, List<ProjectUserBrand> projectUserBrandList, List<ProjectUserDutyTerritory> projectUserDutyTerritoryList, String userId) {
|
||||||
List<String> roleCodes = sysRoleService.listByIds(Arrays.asList(roles.split(","))).stream().map(SysRole::getRoleCode).collect(Collectors.toList());
|
List<String> roleCodes = sysRoleService.listByIds(Arrays.asList(roles.split(","))).stream().map(SysRole::getRoleCode).collect(Collectors.toList());
|
||||||
if (roleCodes.contains(ProjectRoleEnum.VIEWER.getCode())) {
|
if (roleCodes.contains(ProjectRoleEnum.VIEWER.getCode())||roleCodes.contains(ProjectRoleEnum.BRAND_ADMINISTRATOR.getCode())) {
|
||||||
|
//viewer设置对应的责任领域
|
||||||
|
if (roleCodes.contains(ProjectRoleEnum.VIEWER.getCode())) {
|
||||||
|
//先删后加
|
||||||
|
QueryWrapper<ProjectUserDutyTerritory> dutyTerritoryDelWrapper = new QueryWrapper<>();
|
||||||
|
dutyTerritoryDelWrapper.eq("user_id", userId);
|
||||||
|
projectUserDutyTerritoryService.remove(dutyTerritoryDelWrapper);
|
||||||
|
|
||||||
|
if (ObjectUtils.isNotEmpty(dutyTerritories)) {
|
||||||
|
List<String> dictItemValue = sysDictItemService.selectItemsByDictCode(DictCodeEnum.DUTY_TERRITORY.getValue()).stream().map(SysDictItem::getItemValue).collect(Collectors.toList());
|
||||||
|
for (String dutyTerritory : dutyTerritories.split(",")) {
|
||||||
|
//校验责任领域是否合法
|
||||||
|
if (dictItemValue.contains(dutyTerritory)) {
|
||||||
|
ProjectUserDutyTerritory projectUserDutyTerritory = new ProjectUserDutyTerritory();
|
||||||
|
projectUserDutyTerritory.setUserId(userId);
|
||||||
|
projectUserDutyTerritory.setDutyTerritory(dutyTerritory);
|
||||||
|
projectUserDutyTerritoryList.add(projectUserDutyTerritory);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//先删后加
|
//先删后加
|
||||||
QueryWrapper<ProjectUserBrand> brandDelWrapper = new QueryWrapper<>();
|
QueryWrapper<ProjectUserBrand> brandDelWrapper = new QueryWrapper<>();
|
||||||
brandDelWrapper.eq("user_id", userId);
|
brandDelWrapper.eq("user_id", userId);
|
||||||
projectUserBrandService.remove(brandDelWrapper);
|
projectUserBrandService.remove(brandDelWrapper);
|
||||||
|
|
||||||
QueryWrapper<ProjectUserDutyTerritory> dutyTerritoryDelWrapper = new QueryWrapper<>();
|
|
||||||
dutyTerritoryDelWrapper.eq("user_id", userId);
|
|
||||||
projectUserDutyTerritoryService.remove(dutyTerritoryDelWrapper);
|
|
||||||
|
|
||||||
if (ObjectUtils.isNotEmpty(dutyTerritories)) {
|
|
||||||
List<String> dictItemValue = sysDictItemService.selectItemsByDictCode(DictCodeEnum.DUTY_TERRITORY.getValue()).stream().map(SysDictItem::getItemValue).collect(Collectors.toList());
|
|
||||||
for (String dutyTerritory : dutyTerritories.split(",")) {
|
|
||||||
//校验责任领域是否合法
|
|
||||||
if (dictItemValue.contains(dutyTerritory)) {
|
|
||||||
ProjectUserDutyTerritory projectUserDutyTerritory = new ProjectUserDutyTerritory();
|
|
||||||
projectUserDutyTerritory.setUserId(userId);
|
|
||||||
projectUserDutyTerritory.setDutyTerritory(dutyTerritory);
|
|
||||||
projectUserDutyTerritoryList.add(projectUserDutyTerritory);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (ObjectUtils.isNotEmpty(brands)) {
|
if (ObjectUtils.isNotEmpty(brands)) {
|
||||||
List<String> dictItemValue = sysDictItemService.selectItemsByDictCode(DictCodeEnum.BRAND.getValue()).stream().map(SysDictItem::getItemValue).collect(Collectors.toList());
|
List<String> dictItemValue = sysDictItemService.selectItemsByDictCode(DictCodeEnum.BRAND.getValue()).stream().map(SysDictItem::getItemValue).collect(Collectors.toList());
|
||||||
for (String brand : brands.split(",")) {
|
for (String brand : brands.split(",")) {
|
||||||
|
|||||||
+4
-4
@@ -142,19 +142,19 @@ public class ParamsExportTemplateEOController extends JeroController<ParamsExpor
|
|||||||
String regionName = regionDictItemList.stream().filter(e -> e.getItemValue().equals(s)).map(f -> f.getItemText()).collect(Collectors.joining(","));
|
String regionName = regionDictItemList.stream().filter(e -> e.getItemValue().equals(s)).map(f -> f.getItemText()).collect(Collectors.joining(","));
|
||||||
regionBuilder.append(regionName).append(",");
|
regionBuilder.append(regionName).append(",");
|
||||||
}
|
}
|
||||||
paramsExportTemplateEOTemp.setRegionName(regionBuilder.substring(0, regionBuilder.toString().length() - 1));
|
paramsExportTemplateEOTemp.setRegion_dictText(regionBuilder.substring(0, regionBuilder.toString().length() - 1));
|
||||||
}else{
|
}else{
|
||||||
paramsExportTemplateEOTemp.setRegionName("");
|
paramsExportTemplateEOTemp.setRegion_dictText("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Collator comparator = Collator.getInstance(Locale.CHINESE);
|
Collator comparator = Collator.getInstance(Locale.CHINESE);
|
||||||
if (OrderEnum.POSITIVE.getValue().equals(paramsExportTemplateEO.getOrderBy())) {
|
if (OrderEnum.POSITIVE.getValue().equals(paramsExportTemplateEO.getOrderBy())) {
|
||||||
Collections.sort(list, (e1, e2) -> {
|
Collections.sort(list, (e1, e2) -> {
|
||||||
return comparator.compare(e1.getRegionName(), e2.getRegionName());
|
return comparator.compare(e1.getRegion_dictText(), e2.getRegion_dictText());
|
||||||
});
|
});
|
||||||
} else if (OrderEnum.REVERSE.getValue().equals(paramsExportTemplateEO.getOrderBy())) {
|
} else if (OrderEnum.REVERSE.getValue().equals(paramsExportTemplateEO.getOrderBy())) {
|
||||||
Collections.sort(list, (e1, e2) -> {
|
Collections.sort(list, (e1, e2) -> {
|
||||||
return comparator.compare(e2.getRegionName(), e1.getRegionName());
|
return comparator.compare(e2.getRegion_dictText(), e1.getRegion_dictText());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
pageList = getPages(pageNo, pageSize, list);
|
pageList = getPages(pageNo, pageSize, list);
|
||||||
|
|||||||
+1
-1
@@ -99,6 +99,6 @@ public class ParamsExportTemplateEO implements Serializable {
|
|||||||
|
|
||||||
//适用地区
|
//适用地区
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String regionName;
|
private String region_dictText;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+3
@@ -138,6 +138,9 @@ public class ProjectLibraryBase implements Comparable<ProjectLibraryBase> {
|
|||||||
//品牌
|
//品牌
|
||||||
private String brand;
|
private String brand;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String brandText;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(ProjectLibraryBase o) {
|
public int compareTo(ProjectLibraryBase o) {
|
||||||
return Integer.valueOf(this.projectVersion)-Integer.valueOf(o.projectVersion);//升序
|
return Integer.valueOf(this.projectVersion)-Integer.valueOf(o.projectVersion);//升序
|
||||||
|
|||||||
+3
-1
@@ -51,11 +51,13 @@
|
|||||||
plb.software_version,
|
plb.software_version,
|
||||||
plb.sort,
|
plb.sort,
|
||||||
plb.flag,
|
plb.flag,
|
||||||
plb.brand
|
plb.brand,
|
||||||
|
sdi.item_text brandText
|
||||||
from project_library_base as plb
|
from project_library_base as plb
|
||||||
left join project_name_info as pni on plb.project_name_id=pni.id
|
left join project_name_info as pni on plb.project_name_id=pni.id
|
||||||
left join sys_user as studiouser on plb.studio_engineer=studiouser.id
|
left join sys_user as studiouser on plb.studio_engineer=studiouser.id
|
||||||
left join project_year_name_info as pyni on plb.year_name_id=pyni.id
|
left join project_year_name_info as pyni on plb.year_name_id=pyni.id
|
||||||
|
left join sys_dict_item as sdi on sdi.item_value = plb.brand
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="queryPageList" resultType="com.jero.modules.project.entity.ProjectLibraryBase">
|
<select id="queryPageList" resultType="com.jero.modules.project.entity.ProjectLibraryBase">
|
||||||
|
|||||||
+7
-9
@@ -768,14 +768,12 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
|
|||||||
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
Integer isViewer = sysRoleMapper.queryUserRoleByCode(ProjectRoleEnum.VIEWER.getName(), loginUser.getId());
|
Integer isViewer = sysRoleMapper.queryUserRoleByCode(ProjectRoleEnum.VIEWER.getName(), loginUser.getId());
|
||||||
Set<String> projectIds = new HashSet<>();
|
Set<String> projectIds = new HashSet<>();
|
||||||
if (isViewer == 0) {
|
//根据项目用户权限表筛选有权访问的项目
|
||||||
//如果不是viewer,根据项目用户权限表筛选有权访问的项目
|
Set<String> permissionProjectIds = projectUserPermissionMapper.queryProjectIdsByUserId(loginUser.getId());
|
||||||
Set<String> permissionProjectIds = projectUserPermissionMapper.queryProjectIdsByUserId(loginUser.getId());
|
if (ObjectUtils.isNotEmpty(permissionProjectIds)) {
|
||||||
if (ObjectUtils.isNotEmpty(permissionProjectIds)) {
|
projectIds.addAll(permissionProjectIds);
|
||||||
projectIds.addAll(permissionProjectIds);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (sysRoleMapper.queryUserRoleByCode(ProjectRoleEnum.VIEWER.getName(), loginUser.getId()) > 0) {
|
if (isViewer > 0) {
|
||||||
//如果是Viewer,根据配置的品牌筛选可访问的项目
|
//如果是Viewer,根据配置的品牌筛选可访问的项目
|
||||||
List<String> brandTypes = projectUserBrandService.queryBrandByUserId(loginUser.getId());
|
List<String> brandTypes = projectUserBrandService.queryBrandByUserId(loginUser.getId());
|
||||||
if (ObjectUtils.isNotEmpty(brandTypes)) {
|
if (ObjectUtils.isNotEmpty(brandTypes)) {
|
||||||
@@ -874,10 +872,10 @@ public class ProjectLibraryBaseServiceImpl extends ServiceImpl<ProjectLibraryBas
|
|||||||
|
|
||||||
List<ProjectLibraryBase> resultLast = new ArrayList<>();
|
List<ProjectLibraryBase> resultLast = new ArrayList<>();
|
||||||
//权限筛选
|
//权限筛选
|
||||||
if (isViewer != 0) {
|
if (sysUserService.isAdministrator()) {
|
||||||
|
//管理员查看全部
|
||||||
resultLast = resultNew;
|
resultLast = resultNew;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
for (ProjectLibraryBase projectLibraryBase : resultNew) {
|
for (ProjectLibraryBase projectLibraryBase : resultNew) {
|
||||||
//判断父项目是否有权限
|
//判断父项目是否有权限
|
||||||
if (!projectIds.contains(projectLibraryBase.getId())) {
|
if (!projectIds.contains(projectLibraryBase.getId())) {
|
||||||
|
|||||||
@@ -61,10 +61,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="text-field">
|
<div class="text-field">
|
||||||
<span class="text-field-left" :title="$t('brand')">{{$t('brand')}}</span>
|
<span class="text-field-left" :title="$t('brand')">{{$t('brand')}}</span>
|
||||||
<span class="text-field-right text-field-right-color"
|
<span class="text-field-right" :title="queryForm.brandText"
|
||||||
:title="queryForm.brand"
|
>{{queryForm.brandText}}</span>
|
||||||
@click="urlClick(queryForm.brand)"
|
|
||||||
>{{queryForm.brand}}</span>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="content-text">
|
<div class="content-text">
|
||||||
|
|||||||
@@ -246,7 +246,7 @@
|
|||||||
align: 'center',
|
align: 'center',
|
||||||
width: 180,
|
width: 180,
|
||||||
ellipsis: true,
|
ellipsis: true,
|
||||||
dataIndex: 'brand'
|
dataIndex: 'brandText'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.$t('explain'),
|
title: this.$t('explain'),
|
||||||
|
|||||||
@@ -85,7 +85,7 @@
|
|||||||
<!-- :placeholder="$t('PleaseSelect')+$t('brand')"-->
|
<!-- :placeholder="$t('PleaseSelect')+$t('brand')"-->
|
||||||
<!-- :type="'select'"-->
|
<!-- :type="'select'"-->
|
||||||
<!-- :triggerChange="false" :dictCode="'brand'"/>-->
|
<!-- :triggerChange="false" :dictCode="'brand'"/>-->
|
||||||
<a-select allowClear :placeholder="$t('PleaseSelect')+$t('engineeringInterfacePerson')"
|
<a-select allowClear mode="multiple" :getPopupContainer="triggerNode => triggerNode.parentNode" :placeholder="$t('PleaseSelect')+$t('engineeringInterfacePerson')"
|
||||||
v-model="brands">
|
v-model="brands">
|
||||||
<a-select-option v-for="(item, key) in brandsList" :key="key" :value="item.value">
|
<a-select-option v-for="(item, key) in brandsList" :key="key" :value="item.value">
|
||||||
<span style="display: inline-block;width: 100%" :title=" item.text || item.label ">
|
<span style="display: inline-block;width: 100%" :title=" item.text || item.label ">
|
||||||
@@ -413,7 +413,7 @@
|
|||||||
this.dutyTerritories = res.dutyTerritoryList.join(',')
|
this.dutyTerritories = res.dutyTerritoryList.join(',')
|
||||||
}
|
}
|
||||||
if(res.brandList){
|
if(res.brandList){
|
||||||
this.brands = res.brandList.join(',')
|
this.brands = res.brandList
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -462,7 +462,7 @@
|
|||||||
ids: this.userId,
|
ids: this.userId,
|
||||||
selectedroles: selectedRole.join(','),
|
selectedroles: selectedRole.join(','),
|
||||||
dutyTerritories: dutyTerritorie,
|
dutyTerritories: dutyTerritorie,
|
||||||
brands: brand
|
brands: brand.join(',')
|
||||||
}
|
}
|
||||||
postAction('/sys/user/setRole', param).then((res) => {
|
postAction('/sys/user/setRole', param).then((res) => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
|
|||||||
Reference in New Issue
Block a user