Browse Source

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

tags/v1.0.0^2
chengwang 1 year ago
parent
commit
83a425537b
7 changed files with 390 additions and 66 deletions
  1. +2
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/conver/InspectionFileConverMapper.java
  2. +163
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/InspectionFileExtend.java
  3. +2
    -1
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/InspectionFileMapper.java
  4. +14
    -2
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspectionfile/QueryInspectionFilePageListRequest.java
  5. +101
    -45
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFilePageListService.java
  6. +43
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/InspectionFilePageListVo.java
  7. +65
    -17
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionFileMapper.xml

+ 2
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/conver/InspectionFileConverMapper.java View File

@@ -1,6 +1,7 @@
package com.tuoheng.admin.conver;

import com.tuoheng.admin.entity.InspectionFile;
import com.tuoheng.admin.entity.InspectionFileExtend;
import com.tuoheng.admin.vo.InspectionFilePageListByInspectionIdVo;
import com.tuoheng.admin.vo.InspectionFilePageListVo;
import org.mapstruct.Mapper;
@@ -15,6 +16,6 @@ public interface InspectionFileConverMapper {

List<InspectionFilePageListByInspectionIdVo> fromInspectionFileListToInspectionFilePageByInspectionIdListVoList(List<InspectionFile> inspectionFileList);

List<InspectionFilePageListVo> fromInspectionFileListToInspectionFilePageListVoList(List<InspectionFile> inspectionFileList);
List<InspectionFilePageListVo> fromInspectionFileExtendListToInspectionFilePageListVoList(List<InspectionFileExtend> inspectionFileExtendList);

}

+ 163
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/InspectionFileExtend.java View File

@@ -0,0 +1,163 @@
package com.tuoheng.admin.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tuoheng.common.core.common.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.util.Date;
/**
* 巡检任务问题扩展
*
* @team tuoheng
* @author wanjing
* @date 2022-11-23
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class InspectionFileExtend extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 租户ID
*/
private String tenantId;
/**
* 图片编号
*/
private String fileCode;
/**
* 巡检任务ID
*/
private String inspectionId;
/**
* 附件类型:1图片 2视频
*/
private Integer fileType;
/**
* 文件名称
*/
private String fileName;
/**
* 缩略图
*/
private String fileThumbnail;
/**
* 原图
*/
private String fileOriginal;
/**
* 标记图
*/
private String fileImage;
/**
* 文件大小
*/
private BigDecimal fileSize;
/**
* 纬度(原始图片纬度)
*/
private String latitude;
/**
* 经度(原始图片经度)
*/
private String longitude;
/**
* 位置信息
*/
private String location;
/**
* 高德地图经度
*/
private String gaodeLongitude;
/**
* 高德地图纬度
*/
private String gaodeLatitude;
/**
* 高德地图地址
*/
private String gaodeAddress;
/**
* 问题类型二级分类ID
*/
private String questionId;
/**
* 图片来源:1AI 2后台 3视频
*/
private Integer source;
/**
* 问题名称
*/
private String questionName;
/**
* 巡检内容
*/
private String content;
/**
* 详细描述
*/
private String questionDesc;
/**
* 状态:5待确认 10已忽略 15已确认 20已生成工单 25问题已处理
*/
private Integer status;
/**
* 审核人
*/
private String checkUser;
/**
* 审核时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date checkTime;
/**
* 任务编号
*/
private String inspectionCode;
/**
* 任务名称
*/
private String inspectionName;
/**
* 所在公路ID
*/
private String roadId;
/**
* 所在部门ID
*/
private String deptId;
}

+ 2
- 1
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/InspectionFileMapper.java View File

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.admin.entity.Inspection;
import com.tuoheng.admin.entity.InspectionFile;
import com.tuoheng.admin.entity.InspectionFileExtend;
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest;
@@ -58,6 +59,6 @@ public interface InspectionFileMapper extends BaseMapper<InspectionFile> {
* @param request 巡检任务查询实体
* @return 巡检任务集合
*/
Page<InspectionFile> selectPageList(@Param("page") IPage page, @Param("request") QueryInspectionFilePageListRequest request);
Page<InspectionFileExtend> selectPageList(@Param("page") IPage page, @Param("request") QueryInspectionFilePageListRequest request);

}

+ 14
- 2
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspectionfile/QueryInspectionFilePageListRequest.java View File

@@ -5,6 +5,7 @@ import com.tuoheng.common.core.common.BaseQuery;
import lombok.Data;

import java.util.Date;
import java.util.List;

/**
* 查询巡检任务请求实体
@@ -37,9 +38,20 @@ public class QueryInspectionFilePageListRequest extends BaseQuery {
private String deptId;

/**
* 核实时间
* 核实开始时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date checkTime;
private Date beginTime;

/**
* 核实结束时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date endTime;

/**
* 部门及子部门Id列表
*/
private List<String> deptIdList;

}

+ 101
- 45
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFilePageListService.java View File

@@ -4,16 +4,15 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tuoheng.admin.conver.InspectionFileConverMapper;
import com.tuoheng.admin.entity.InspectionFile;
import com.tuoheng.admin.entity.QuestionType;
import com.tuoheng.admin.entity.*;
import com.tuoheng.admin.enums.UserTypeEnum;
import com.tuoheng.admin.enums.code.inspection.QueryInspectionPageListCodeEnum;
import com.tuoheng.admin.mapper.DeptMapper;
import com.tuoheng.admin.mapper.InspectionFileMapper;
import com.tuoheng.admin.mapper.InspectionMapper;
import com.tuoheng.admin.mapper.QuestionTypeMapper;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest;
import com.tuoheng.admin.utils.ShiroUtils;
import com.tuoheng.admin.vo.InspectionFilePageListByInspectionIdVo;
import com.tuoheng.admin.vo.InspectionFilePageListVo;
import com.tuoheng.common.core.config.common.CommonConfig;
import com.tuoheng.common.core.utils.JsonResult;
import com.tuoheng.common.core.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
@@ -36,6 +35,8 @@ import java.util.stream.Collectors;
@Service
public class QueryInspectionFilePageListService {

@Autowired
private UserMapper userMapper;
@Autowired
private DeptMapper deptMapper;

@@ -48,18 +49,28 @@ public class QueryInspectionFilePageListService {
@Autowired
private QuestionTypeMapper questionTypeMapper;

@Autowired
private RoadInformationMapper roadInformationMapper;

public JsonResult getPageList(QueryInspectionFilePageListRequest request) {
log.info("进入查询任务问题分页列表业务, request:{}", request.toString());

String userId = ShiroUtils.getUserId();

JsonResult result = this.check(request);
if (0 != result.getCode()) {
log.info("进入查询任务问题分页列表业务:校验失败:{}", result.getMsg());
return result;
}

// 获取部门Id的查询范围
List<String> deptIdList = this.getDeptIdList(userId, request.getDeptId());
request.setDeptIdList(deptIdList);

// 设置分页参数
IPage<InspectionFile> page = new Page<>(request.getPage(), request.getLimit());
// 查询结果
IPage<InspectionFile> pageData = inspectionFileMapper.selectPageList(page, request);
IPage<InspectionFileExtend> pageData = inspectionFileMapper.selectPageList(page, request);
if (null == pageData || pageData.getTotal() == 0) {
log.info("获取任务分页列表为空");
return JsonResult.success(null, QueryInspectionPageListCodeEnum.DATA_IS_FAILED.getMsg());
@@ -77,7 +88,6 @@ public class QueryInspectionFilePageListService {
inspectionFilePageListVoPageData.setRecords(inspectionFilePageListVoList);

return JsonResult.success(inspectionFilePageListVoPageData);

}

/**
@@ -92,63 +102,109 @@ public class QueryInspectionFilePageListService {
}

/**
* 超级管理员可查全部的任务
* 获取部门Id的查询范围
* 1)、deptId:如果传了值,查该部门的任务
* 2)、deptId:如果没有传值
* 2.1)、管理员:可查全部确认问题
* 2.2)、管理员/普通用户:本部门及子部门创建的任务中已确认问题
*
* @param request
* @param deptId
* @return
*/
private IPage<InspectionFile> getAllList(QueryInspectionFilePageListRequest request) {
// 设置分页参数
IPage<InspectionFile> page = new Page<>(request.getPage(), request.getLimit());
// 查询结果
IPage<InspectionFile> pageData = inspectionFileMapper.selectPageList(page, request);
return pageData;
private List<String> getDeptIdList(String userId, String deptId) {
List<String> deptIdList = null;
if (!StringUtils.isEmpty(deptId)) {
deptIdList.add(deptId);
return deptIdList;
}
User user = userMapper.selectOne(new LambdaQueryWrapper<User>()
.eq(User::getId, userId)
.eq(User::getMark, 1));
user.setType(UserTypeEnum.ORDINARY_USER.getCode());
if (UserTypeEnum.SUPER_ADMIN.getCode() == user.getType()) {
return null;
} else {
deptIdList = deptMapper.selectAllChildListById(user.getDeptId());
return deptIdList;
}
}

/**
* 管理员和普通用户可查本部门及子部门的任务
* 1)、如果前端检索条件,传了部门Id,则根据deptId来查
* 2)、如果前端检索条件,部门Id为空,则表示查本部门及子部门的任务
* 1)、设置问题类型字段
* 2)、设置公路名称字段
* 3)、设置部门名称字段
* 4)、设置缩略图字段
*
* @param request
* @param inspectionFileExtendList
* @return
*/
private IPage<InspectionFile> getListByDept(QueryInspectionFilePageListRequest request) {
// 获取本部门及子孙部门id列表
if (StringUtils.isEmpty(request.getDeptId())) {
List<String> deptIdList = deptMapper.selectAllChildListById(request.getDeptId());
// request.setDeptIdList(deptIdList);
private List<InspectionFilePageListVo> buildInspectionFilePageListVoList(List<InspectionFileExtend> inspectionFileExtendList) {
Map<String, RoadInformation> roadMap = this.getRoadMap(inspectionFileExtendList);
Map<String, Dept> deptMap = this.getDeptMap(inspectionFileExtendList);
Map<String, QuestionType> questionTypeMap = this.getQuestionTypeMap();
List<InspectionFilePageListVo> inspectionFilePageListVoList = InspectionFileConverMapper.INSTANCE.fromInspectionFileExtendListToInspectionFilePageListVoList(inspectionFileExtendList);
QuestionType questionType;
RoadInformation road;
Dept dept;
for (InspectionFilePageListVo inspectionFilePageListVo : inspectionFilePageListVoList) {
questionType = questionTypeMap.get(inspectionFilePageListVo.getQuestionId());
if (null != questionType) {
inspectionFilePageListVo.setQuestionName(Integer.toString(questionType.getName()));
inspectionFilePageListVo.setQuestionContent(questionType.getContent());
}
road = roadMap.get(inspectionFilePageListVo.getRoadId());
dept = deptMap.get(inspectionFilePageListVo.getDeptId());
inspectionFilePageListVo.setRoadName(road.getName());
inspectionFilePageListVo.setDeptName(dept.getName());
inspectionFilePageListVo.setFileThumbnail(CommonConfig.imageURL + inspectionFilePageListVo.getFileThumbnail());
}
return inspectionFilePageListVoList;
}

// 设置分页参数
IPage<InspectionFile> page = new Page<>(request.getPage(), request.getLimit());
// 查询结果
IPage<InspectionFile> pageData = inspectionFileMapper.selectPageList(page, request);
return pageData;
/**
*
* 获取公路列表,放到map,减少循环次数
*
* @param inspectionFileExtendList
* @return
*/
private Map<String, RoadInformation> getRoadMap(List<InspectionFileExtend> inspectionFileExtendList) {
List<String> roadIdList = inspectionFileExtendList.stream().map(o -> o.getRoadId()).collect(Collectors.toList());
List<RoadInformation> roadList = roadInformationMapper.selectList(new LambdaQueryWrapper<RoadInformation>()
.in(RoadInformation::getId, roadIdList)
.eq(RoadInformation::getMark, 1));
Map<String, RoadInformation> roadMap = roadList.stream().collect(Collectors.toMap(RoadInformation::getId, Function.identity()));
return roadMap;
}

/**
* 1)、查找已确认问题数、发现问题数字段
* 2)、判断是否有操作权限:立即执行、直播、回放、问题详情、问题核实、重新提交
*
* @param inspectionFileList
* 获取部门列表,放到map,减少循环次数
*
* @param inspectionFileExtendList
* @return
*/
private List<InspectionFilePageListVo> buildInspectionFilePageListVoList(List<InspectionFile> inspectionFileList) {
private Map<String, Dept> getDeptMap(List<InspectionFileExtend> inspectionFileExtendList) {
List<String> deptIdList = inspectionFileExtendList.stream().map(o -> o.getDeptId()).collect(Collectors.toList());
List<Dept> deptList = deptMapper.selectList(new LambdaQueryWrapper<Dept>()
.in(Dept::getId, deptIdList)
.eq(Dept::getMark, 1));
Map<String, Dept> deptMap = deptList.stream().collect(Collectors.toMap(Dept::getId, Function.identity()));
return deptMap;
}

/**
*
* 获取问题类型列表,放到map,减少循环次数
*
* @return
*/
private Map<String, QuestionType> getQuestionTypeMap() {
List<QuestionType> questionTypeList = questionTypeMapper.selectList(new LambdaQueryWrapper<QuestionType>()
.eq(QuestionType::getMark, 1));

Map<String, QuestionType> questionTypeMap = questionTypeList.stream().collect(Collectors.toMap(QuestionType::getId, Function.identity()));

List<InspectionFilePageListVo> inspectionFilePageListVoList = InspectionFileConverMapper.INSTANCE.fromInspectionFileListToInspectionFilePageListVoList(inspectionFileList);
QuestionType questionType;
for (InspectionFilePageListVo inspectionFilePageListVo : inspectionFilePageListVoList) {
questionType = questionTypeMap.get(inspectionFilePageListVo.getQuestionId());
if (null != questionType) {
inspectionFilePageListVo.setQuestionName(Integer.toString(questionType.getName()));
inspectionFilePageListVo.setQuestionContent(questionType.getContent());
}
}
return inspectionFilePageListVoList;
return questionTypeMap;
}

}

+ 43
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/InspectionFilePageListVo.java View File

@@ -1,7 +1,10 @@
package com.tuoheng.admin.vo;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import java.util.Date;

/**
* 返回任务详情视图Vo
*
@@ -57,4 +60,44 @@ public class InspectionFilePageListVo {
*/
private Integer status;

/**
* 任务编号
*/
private String inspectionCode;

/**
* 任务名称
*/
private String inspectionName;

/**
* 审核人
*/
private String checkUser;

/**
* 审核时间
*/
@JsonFormat(pattern = "yyyy-MM-dd")
private Date checkTime;

/**
* 所在公路ID
*/
private String roadId;

/**
* 所在公路名称
*/
private String roadName;

/**
* 所在部门ID
*/
private String deptId;

/**
* 所在部门名称
*/
private String deptName;
}

+ 65
- 17
tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionFileMapper.xml View File

@@ -36,6 +36,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="mark" column="mark" />
</resultMap>

<resultMap type="com.tuoheng.admin.entity.InspectionFileExtend" id="InspectionFileResult2">
<result property="id" column="id" />
<result property="tenantId" column="tenant_id" />
<result property="fileCode" column="file_code" />
<result property="inspectionId" column="inspection_id" />
<result property="fileType" column="file_type" />
<result property="fileName" column="file_name" />
<result property="fileThumbnail" column="file_thumbnail" />
<result property="fileOriginal" column="file_original" />
<result property="fileImage" column="file_image" />
<result property="fileSize" column="file_size" />
<result property="latitude" column="latitude" />
<result property="longitude" column="longitude" />
<result property="location" column="location" />
<result property="gaodeLongitude" column="gaode_longitude" />
<result property="gaodeLatitude" column="gaode_latitude" />
<result property="gaodeAddress" column="gaode_address" />
<result property="questionId" column="question_id" />
<result property="source" column="source" />
<result property="questionName" column="question_name" />
<result property="content" column="content" />
<result property="questionDesc" column="question_desc" />
<result property="status" column="status" />
<result property="checkUser" column="check_user" />
<result property="checkTime" column="check_time" />
<result property="createUser" column="create_user" />
<result property="createTime" column="create_time" />
<result property="updateUser" column="update_user" />
<result property="updateTime" column="update_time" />
<result property="mark" column="mark" />
<result property="inspectionCode" column="inspection_code" />
<result property="inspectionName" column="inspection_name" />
<result property="roadId" column="road_id" />
<result property="deptId" column="dept_id" />
</resultMap>

<sql id="Base_Column_List">
id, tenant_id, file_code, inspection_id, file_type, file_name, file_thumbnail, file_original, file_image, file_size, latitude, longitude, location, gaode_longitude, gaode_latitude, gaode_address, question_id, source, question_name, content, question_desc, status, check_user, check_time, create_user, create_time, update_user, update_time, mark
</sql>
@@ -44,6 +80,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select id, tenant_id, file_code, inspection_id, file_type, file_name, file_thumbnail, file_original, file_image, file_size, latitude, longitude, location, gaode_longitude, gaode_latitude, gaode_address, question_id, source, question_name, content, question_desc, status, check_user, check_time, create_user, create_time, update_user, update_time, mark from th_inspection_file
</sql>

<sql id="Base_Extend_Column_List">
tif.id, tif.tenant_id, tif.file_code, tif.inspection_id, tif.file_type, tif.file_name, tif.file_thumbnail, tif.file_original, tif.file_image, tif.file_size,
tif.latitude, tif.longitude, tif.location, tif.gaode_longitude, tif.gaode_latitude, tif.gaode_address, tif.question_id, tif.source, tif.question_name, tif.content, tif.question_desc, tif.status,
tif.check_user, tif.check_time, tif.create_user, tif.create_time, tif.update_user, tif.update_time, tif.mark,
ti.code as inspection_code, ti.name as inspection_name, ti.road_id, ti.dept_id
</sql>

<update id="deleteLogicByMap" parameterType="hashmap">
update th_inspection_file
<trim prefix="SET" suffixOverrides=",">
@@ -82,24 +125,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by create_time desc
</select>

<select id="selectPageList" parameterType="com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest" resultMap="InspectionFileResult">
select <include refid="Base_Column_List"/>
<select id="selectPageList" parameterType="com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest" resultMap="InspectionFileResult2">
select <include refid="Base_Extend_Column_List"/>
from th_inspection_file tif
<!-- left join th_inspection ti on tif.inspection_id = ti.id-->
<!-- <where>-->
<!-- <if test="1 == 1"> and tif.mark = 1 </if>-->
<!-- <if test="request.questionId != null and request.questionId != ''"> and tif.question_id = #{request.questionId} </if>-->
<!-- <if test="request.status != null and request.status != 0"> and tif.status = #{request.status} </if>-->
<!-- <if test="request.key != null and request.key != 0"> and (ti.code liek concat('%', #{request.key}, '%') or ti.name liek concat('%', #{request.key}, '%')) </if>-->
<!-- <if test="request.deptIdList != null and request.deptIdList.size() > 0">-->
<!-- and ti.dept_id in-->
<!-- <foreach item="deptId" collection="request.deptIdList" open="(" separator="," close=")">-->
<!-- #{deptId}-->
<!-- </foreach>-->
<!-- </if>-->

<!-- </where>-->
order by create_time desc
left join th_inspection ti on tif.inspection_id = ti.id
<where>
<if test="1 == 1"> and tif.mark = 1 </if>
<if test="request.key != null and request.key != 0"> and (ti.code like concat('%', #{request.key}, '%') or ti.name like concat('%', #{request.key}, '%')) </if>
<if test="request.questionId != null and request.questionId != ''"> and tif.question_id = #{request.questionId} </if>
<if test="request.status != null and request.status != 0"> and tif.status = #{request.status} </if>
<if test="request.deptIdList != null and request.deptIdList.size() > 0">
and ti.dept_id in
<foreach item="deptId" collection="request.deptIdList" open="(" separator="," close=")">
#{deptId}
</foreach>
</if>
<if test="request.beginTime != null">
and tif.check_time &gt;= #{request.beginTime}
</if>
<if test="request.endTime != null">
and tif.check_time &lt;= #{request.endTime}
</if>
</where>
order by tif.create_time desc
</select>

<update id="updateByIdList" parameterType="hashmap">

Loading…
Cancel
Save