Pārlūkot izejas kodu

Merge branch 'develop' of http://192.168.11.14:51037/gitadmin/tuoheng_freeway into feature_v1.0

tags/v1.0.0^2
chengwang pirms 1 gada
vecāks
revīzija
f6144898b8
6 mainītis faili ar 147 papildinājumiem un 2 dzēšanām
  1. +10
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/SectionController.java
  2. +3
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/section/QuerySectionListByRoadIdCodeEnum.java
  3. +2
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/section/ISectionService.java
  4. +9
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/section/SectionServiceImpl.java
  5. +122
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/section/query/QuerySectionListByRoadIdAndDeptIdService.java
  6. +1
    -1
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionFileMapper.xml

+ 10
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/SectionController.java Parādīt failu

@@ -58,6 +58,16 @@ public class SectionController {
return sectionService.getListByRoadId(roadId);
}

/**
* 根据公路id和部门id获取该公路下路段信息列表
* @param roadId
* @return
*/
@GetMapping("/list/by/road/dept/{roadId}/{deptId}")
public JsonResult getListByRoadIdAndDeptId(@PathVariable("roadId") String roadId, @PathVariable("deptId") String deptId) {
return sectionService.getListByRoadIdAndDeptId(roadId, deptId);
}

/**
* 根据id获取路段详情
* @param sectionId

+ 3
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/enums/code/section/QuerySectionListByRoadIdCodeEnum.java Parādīt failu

@@ -14,7 +14,9 @@ public enum QuerySectionListByRoadIdCodeEnum {
QUERY_IS_FAILED(1220400, "获取数据失败"),
ROAD_ID_IS_NULL(1220401, "公路id为空"),
ROAD_IS_NOT_EXIST(1220402, "公路不存在"),
SECTION_LIST_IS_NULL(1220403, "路段列表为空");
SECTION_LIST_IS_NULL(1220403, "路段列表为空"),
DEPT_ID_IS_NULL(1220404, "部门ID为空"),
DEPT_IS_NOT_EXIST(1220405, "部门不存在");

/**
* 错误码

+ 2
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/section/ISectionService.java Parādīt failu

@@ -18,6 +18,8 @@ public interface ISectionService extends IBaseService<Section> {

JsonResult getListByRoadId(String roadId);

JsonResult getListByRoadIdAndDeptId(String roadId, String deptId);

JsonResult editInfo(Section entity);

JsonResult getSectionInfo(String sectionId);

+ 9
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/section/SectionServiceImpl.java Parādīt failu

@@ -19,6 +19,7 @@ import com.tuoheng.admin.mapper.SectionMapper;
import com.tuoheng.admin.query.SectionQuery;
import com.tuoheng.admin.service.section.ISectionService;
import com.tuoheng.admin.service.section.query.QuerySectionListByDeptIdService;
import com.tuoheng.admin.service.section.query.QuerySectionListByRoadIdAndDeptIdService;
import com.tuoheng.admin.service.section.query.QuerySectionListByRoadIdService;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.admin.vo.SectionInfoVo;
@@ -59,6 +60,9 @@ public class SectionServiceImpl extends BaseServiceImpl<SectionMapper, Section>
@Autowired
private QuerySectionListByRoadIdService querySectionListByRoadIdService;

@Autowired
private QuerySectionListByRoadIdAndDeptIdService querySectionListByRoadIdAndDeptIdService;

@Autowired
private DeptMapper deptMapper;

@@ -203,6 +207,11 @@ public class SectionServiceImpl extends BaseServiceImpl<SectionMapper, Section>
return querySectionListByRoadIdService.getList(roadId);
}

@Override
public JsonResult getListByRoadIdAndDeptId(String roadId, String deptId) {
return querySectionListByRoadIdAndDeptIdService.getList(roadId, deptId);
}

@Override
public JsonResult editInfo(Section entity) {
//超级管理员可以进行新增和编辑,普通用户不能进行此操作,部门管理员可以进行修改经纬度

+ 122
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/section/query/QuerySectionListByRoadIdAndDeptIdService.java Parādīt failu

@@ -0,0 +1,122 @@
package com.tuoheng.admin.service.section.query;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.tuoheng.admin.entity.Dept;
import com.tuoheng.admin.entity.RoadInformation;
import com.tuoheng.admin.entity.Section;
import com.tuoheng.admin.entity.SectionDept;
import com.tuoheng.admin.enums.code.section.QuerySectionListByRoadIdCodeEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.utils.CurrentUserUtil;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
* 根据公路id和部门id获取该公路下路段信息列表
*
* @author wanjing
* @team tuoheng
* @date 2023-01-10
*/
@Slf4j
@Service
public class QuerySectionListByRoadIdAndDeptIdService {

@Autowired
private RoadInformationMapper roadInformationMapper;

@Autowired
private SectionMapper sectionMapper;

@Autowired
private RoadDeptMapper roadDeptMapper;

@Autowired
private SectionDeptMapper sectionDeptMapper;

@Autowired
private DeptMapper deptMapper;

public JsonResult getList(String roadId, String deptId) {
// log.info("根据公路id获取该公路下路段信息列表业务");
String tenantId = CurrentUserUtil.getTenantId();
// 校验
JsonResult result = this.check(tenantId, roadId, deptId);
if (0 != result.getCode()) {
log.info("根据公路id获取该公路下路段信息列表业务:校验失败:{}", result.getMsg());
return result;
}
// 获取该部门公路下路段列表
List<Section> sectionList = this.getSectionList(tenantId, roadId, deptId);
if (CollectionUtil.isEmpty(sectionList)) {
log.info("根据公路id获取该公路下路段信息列表业务:路段信息为空");
return JsonResult.error(QuerySectionListByRoadIdCodeEnum.SECTION_LIST_IS_NULL.getCode(), QuerySectionListByRoadIdCodeEnum.SECTION_LIST_IS_NULL.getMsg());
}
return JsonResult.success(sectionList);
}

/**
* 检查参数
*
* @param tenantId
* @param roadId
* @return
*/
private JsonResult check(String tenantId, String roadId, String deptId) {
if (StringUtils.isEmpty(roadId)) {
return JsonResult.error(QuerySectionListByRoadIdCodeEnum.ROAD_ID_IS_NULL.getCode(), QuerySectionListByRoadIdCodeEnum.ROAD_ID_IS_NULL.getMsg());
}
// 判断公路是否存在
RoadInformation roadInformation = roadInformationMapper.selectOne(new LambdaQueryWrapper<RoadInformation>()
.eq(RoadInformation::getTenantId, tenantId)
.eq(RoadInformation::getId, roadId)
.eq(RoadInformation::getMark, 1));
if (ObjectUtil.isNull(roadInformation)) {
return JsonResult.error(QuerySectionListByRoadIdCodeEnum.ROAD_IS_NOT_EXIST.getCode(), QuerySectionListByRoadIdCodeEnum.ROAD_IS_NOT_EXIST.getMsg());
}
if (StringUtils.isEmpty(deptId)) {
return JsonResult.error(QuerySectionListByRoadIdCodeEnum.DEPT_ID_IS_NULL.getCode(), QuerySectionListByRoadIdCodeEnum.DEPT_ID_IS_NULL.getMsg());
}
// 判断部门是否存在
Dept dept = deptMapper.selectOne(new LambdaQueryWrapper<Dept>()
.eq(Dept::getTenantId, tenantId)
.eq(Dept::getId, deptId)
.eq(Dept::getMark, 1));
if (ObjectUtil.isNull(dept)) {
return JsonResult.error(QuerySectionListByRoadIdCodeEnum.DEPT_IS_NOT_EXIST.getCode(), QuerySectionListByRoadIdCodeEnum.DEPT_IS_NOT_EXIST.getMsg());
}
return JsonResult.success(roadInformation);
}

/**
* 查询该公路下路段信息列表
*
* @param tenantId
* @param roadId
* @param deptId
* @return
*/
private List<Section> getSectionList(String tenantId, String roadId, String deptId) {
List<SectionDept> sectionDeptList = sectionDeptMapper.selectList(new LambdaQueryWrapper<SectionDept>()
.eq(SectionDept::getTenantId, tenantId)
.eq(SectionDept::getDeptId, deptId));
if (CollectionUtil.isEmpty(sectionDeptList)) {
return null;
}
List<String> sectionIdList = sectionDeptList.stream().map(o -> o.getSectionId()).collect(Collectors.toList());
List<Section> sectionList = sectionMapper.selectList(new LambdaQueryWrapper<Section>()
.eq(Section::getTenantId, tenantId)
.eq(Section::getRoadId, roadId)
.in(Section::getId, sectionIdList)
.eq(Section::getMark, 1));
return sectionList;
}
}

+ 1
- 1
tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionFileMapper.xml Parādīt failu

@@ -182,7 +182,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
and status = #{request.status}
</when>
<otherwise>
and status in (15, 20, 25)
and status in (5, 10, 15, 20, 25)
</otherwise>
</choose>
</where>

Notiek ielāde…
Atcelt
Saglabāt