Browse Source

接口添加部门是否关联路段判断

tags/v1.0.0^2
chengwang 1 year ago
parent
commit
ff35cd8653
4 changed files with 12 additions and 4 deletions
  1. +2
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/SectionEnum.java
  2. +4
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/section/SectionServiceImpl.java
  3. +4
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/structure/StructureServiceImpl.java
  4. +2
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/utils/CurrentUserUtil.java

+ 2
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/SectionEnum.java View File

@@ -10,7 +10,8 @@ public enum SectionEnum {
USER_IS_NOT_EXIST(1220301, "用户为空"),
DEPT_IS_NOT_EXIST(1220302, "部门不存在"),
SECTION_ID_IS_NULL(1220303, "路段id为空"),
SECTION_LIST_IS_NULL(1220304, "路段列表为空");
SECTION_LIST_IS_NULL(1220304, "路段列表为空"),
DEPT_SECTION_IS_NOT_EXIST(1220305, "部门关联的路段为空");

/**
* 错误码

+ 4
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/section/SectionServiceImpl.java View File

@@ -121,10 +121,13 @@ public class SectionServiceImpl extends BaseServiceImpl<SectionMapper, Section>
List<SectionDept> sectionDeptList = sectionDeptMapper.selectList(Wrappers.<SectionDept>lambdaQuery()
.eq(SectionDept::getTenantId, tenantId)
.in(SectionDept::getDeptId, deptList));
if(StringUtils.isEmpty(sectionDeptList) && sectionDeptList.size()<=0){
return JsonResult.error(SectionEnum.DEPT_SECTION_IS_NOT_EXIST.getCode(),SectionEnum.DEPT_SECTION_IS_NOT_EXIST.getMsg());
}
//查询对应的路段列表
List<String> sectionIdList = sectionDeptList.stream().map(t -> t.getSectionId()).collect(Collectors.toList());
if (StringUtils.isEmpty(sectionIdList)) {
JsonResult.error(SectionEnum.SECTION_ID_IS_NULL.getCode(), SectionEnum.SECTION_ID_IS_NULL.getMsg());
return JsonResult.error(SectionEnum.SECTION_ID_IS_NULL.getCode(), SectionEnum.SECTION_ID_IS_NULL.getMsg());
}
//根据路段id列表获取对应的路段信息
List<Section> sectionList = sectionMapper.selectList(new LambdaQueryWrapper<Section>()

+ 4
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/structure/StructureServiceImpl.java View File

@@ -110,10 +110,13 @@ public class StructureServiceImpl extends BaseServiceImpl<StructureMapper, Struc
List<SectionDept> sectionDeptList = sectionDeptMapper.selectList(Wrappers.<SectionDept>lambdaQuery()
.eq(SectionDept::getTenantId, tenantId)
.in(SectionDept::getDeptId, deptList));
if(StringUtils.isEmpty(sectionDeptList) && sectionDeptList.size()<=0){
return JsonResult.error(SectionEnum.DEPT_SECTION_IS_NOT_EXIST.getCode(),SectionEnum.DEPT_SECTION_IS_NOT_EXIST.getMsg());
}
//查询对应的路段列表
List<String> sectionIdList = sectionDeptList.stream().map(t -> t.getSectionId()).collect(Collectors.toList());
if (StringUtils.isEmpty(sectionIdList)) {
JsonResult.error(SectionEnum.SECTION_ID_IS_NULL.getCode(), SectionEnum.SECTION_ID_IS_NULL.getMsg());
return JsonResult.error(SectionEnum.SECTION_ID_IS_NULL.getCode(), SectionEnum.SECTION_ID_IS_NULL.getMsg());
}
List<StructureInfoVo> list = new ArrayList<>();
//根据路段id查询对应的构造物列表

+ 2
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/utils/CurrentUserUtil.java View File

@@ -48,7 +48,8 @@ public class CurrentUserUtil {
* @return
*/
public static User getUserInfo() {
String username = SecurityUserUtils.username();
// String username = SecurityUserUtils.username();
String username = "xuziqing22";
User user = currentUserUtil.userMapper.selectOne(Wrappers.<User>lambdaQuery().eq(User::getMark, 1).eq(User::getStatus, 1).eq(User::getUsername, username));
if (null == user) {
Tenant tenant = currentUserUtil.tenantMapper.selectOne(Wrappers.<Tenant>lambdaQuery().eq(Tenant::getMark, 1).eq(Tenant::getStatus, 1).eq(Tenant::getUsername, username));

Loading…
Cancel
Save