Bladeren bron

新增查询部分接口

tags/v1.0.0^2
wanjing 1 jaar geleden
bovenliggende
commit
dcaa25498b
10 gewijzigde bestanden met toevoegingen van 483 en 4 verwijderingen
  1. +13
    -4
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionFileController.java
  2. +3
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/conver/InspectionFileConverMapper.java
  3. +91
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/InspectionFileDistribution.java
  4. +9
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/InspectionFileMapper.java
  5. +38
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspectionfile/QueryInspectionFileDistributionListRequest.java
  6. +10
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/IInspectionFileService.java
  7. +17
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/InspectionFileServiceImpl.java
  8. +163
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFileDistributionListService.java
  9. +89
    -0
      tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/InspectionFileDistributionListVo.java
  10. +50
    -0
      tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionFileMapper.xml

+ 13
- 4
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/controller/InspectionFileController.java Bestand weergeven

@@ -1,12 +1,12 @@
package com.tuoheng.admin.controller;

import com.tuoheng.admin.query.InspectionFileQuery;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileDistributionListRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest;
import com.tuoheng.admin.service.IInspectionFileService;
import com.tuoheng.common.core.utils.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.*;

import java.util.List;
@@ -32,7 +32,7 @@ public class InspectionFileController {
}

/**
* 根据登录人角色获取该部门及子部门下问题列表
* 根据登录人角色获取该部门及子部门下任务问题列表
* @param query
* @return
*/
@@ -42,7 +42,7 @@ public class InspectionFileController {
}

/**
* 查询任务分页列表
* 查询任务问题分页列表
*
* @return
*/
@@ -52,7 +52,7 @@ public class InspectionFileController {
}

/**
* 根据任务ID查询任务分页列表
* 根据任务ID查询任务问题分页列表
*
* @return
*/
@@ -93,4 +93,13 @@ public class InspectionFileController {
return iInspectionFileService.getHandle(id);
}

/**
* 查询任务问题分布列表
*
* @return
*/
@GetMapping("/list/distribution")
public JsonResult getDistributionList(QueryInspectionFileDistributionListRequest request){
return iInspectionFileService.getDistributionList(request);
}
}

+ 3
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/conver/InspectionFileConverMapper.java Bestand weergeven

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

import com.tuoheng.admin.entity.InspectionFile;
import com.tuoheng.admin.entity.InspectionFileDistribution;
import com.tuoheng.admin.entity.InspectionFileExtend;
import com.tuoheng.admin.vo.InspectionFileDistributionListVo;
import com.tuoheng.admin.vo.InspectionFilePageListByInspectionIdVo;
import com.tuoheng.admin.vo.InspectionFilePageListVo;
import org.mapstruct.Mapper;
@@ -18,4 +20,5 @@ public interface InspectionFileConverMapper {

List<InspectionFilePageListVo> fromInspectionFileExtendListToInspectionFilePageListVoList(List<InspectionFileExtend> inspectionFileExtendList);

List<InspectionFileDistributionListVo> fromInspectionFileDistributionListToInspectionFileDistributionListVoList(List<InspectionFileDistribution> inspectionFileDistributionList);
}

+ 91
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/entity/InspectionFileDistribution.java Bestand weergeven

@@ -0,0 +1,91 @@
package com.tuoheng.admin.entity;
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-12-08
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class InspectionFileDistribution extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 租户ID
*/
private String tenantId;
/**
* 缩略图
*/
private String fileThumbnail;
/**
* 纬度(原始图片纬度)
*/
private String latitude;
/**
* 经度(原始图片经度)
*/
private String longitude;
/**
* 位置信息
*/
private String location;
/**
* 高德地图经度
*/
private String gaodeLongitude;
/**
* 高德地图纬度
*/
private String gaodeLatitude;
/**
* 高德地图地址
*/
private String gaodeAddress;
/**
* 问题类型二级分类ID
*/
private String questionId;
/**
* 问题名称
*/
private String questionName;
/**
* 状态:5待确认 10已忽略 15已确认 20已生成工单 25问题已处理
*/
private Integer status;
/**
* 任务编号
*/
private String inspectionCode;
/**
* 任务名称
*/
private String inspectionName;
}

+ 9
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/mapper/InspectionFileMapper.java Bestand weergeven

@@ -5,8 +5,10 @@ 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.InspectionFileDistribution;
import com.tuoheng.admin.entity.InspectionFileExtend;
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileDistributionListRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest;
import org.apache.ibatis.annotations.Param;
@@ -61,4 +63,11 @@ public interface InspectionFileMapper extends BaseMapper<InspectionFile> {
*/
Page<InspectionFileExtend> selectPageList(@Param("page") IPage page, @Param("request") QueryInspectionFilePageListRequest request);

/**
* 查询任务问题分布列表
*
* @param request 巡检任务查询实体
* @return 巡检任务集合
*/
Page<InspectionFileDistribution> selectDistributionList(@Param("page") IPage page, @Param("request") QueryInspectionFileDistributionListRequest request);
}

+ 38
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/request/inspectionfile/QueryInspectionFileDistributionListRequest.java Bestand weergeven

@@ -0,0 +1,38 @@
package com.tuoheng.admin.request.inspectionfile;

import com.tuoheng.common.core.common.BaseQuery;
import lombok.Data;

import java.util.List;

/**
* 查询巡检任务分配请求实体
*
* @author wanjing
* @team tuoheng
* @date 2022-12-08
*/
@Data
public class QueryInspectionFileDistributionListRequest extends BaseQuery {

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

/**
* 问题类型
*/
private String questionId;

/**
* 问题状态:5待确认 10已忽略 15已确认 20已生成工单 25问题已处理
*/
private Integer status;

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

}

+ 10
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/IInspectionFileService.java Bestand weergeven

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

import com.tuoheng.admin.query.InspectionFileQuery;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileDistributionListRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest;
import com.tuoheng.common.core.utils.JsonResult;
@@ -60,4 +61,13 @@ public interface IInspectionFileService {
* @return
*/
JsonResult getHandle(String id);

/**
*
* 查询任务问题分布列表
*
* @param request
* @return
*/
JsonResult getDistributionList(QueryInspectionFileDistributionListRequest request);
}

+ 17
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/impl/InspectionFileServiceImpl.java Bestand weergeven

@@ -13,12 +13,14 @@ import com.tuoheng.admin.enums.code.inspectionfile.ListByDeptUserTypeEnum;
import com.tuoheng.admin.enums.code.questiontype.QuestionTypeEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.query.InspectionFileQuery;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileDistributionListRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest;
import com.tuoheng.admin.service.IInspectionFileService;
import com.tuoheng.admin.service.inspectionfile.confirm.InspectionFileConfirmService;
import com.tuoheng.admin.service.inspectionfile.handle.QueryInspectionFileHandleByInspectionFileIdService;
import com.tuoheng.admin.service.inspectionfile.ignore.InspectionFileIgnoreService;
import com.tuoheng.admin.service.inspectionfile.query.QueryInspectionFileDistributionListService;
import com.tuoheng.admin.service.inspectionfile.query.QueryInspectionFilePageListByInspectionIdService;
import com.tuoheng.admin.service.inspectionfile.query.QueryInspectionFilePageListService;
import com.tuoheng.admin.utils.ShiroUtils;
@@ -78,6 +80,9 @@ public class InspectionFileServiceImpl implements IInspectionFileService {
@Autowired
private QueryInspectionFileHandleByInspectionFileIdService queryInspectionFileHandleByInspectionFileIdService;

@Autowired
private QueryInspectionFileDistributionListService queryInspectionFileDistributionListService;

/**
* 问题类型和任务名称
*
@@ -322,4 +327,16 @@ public class InspectionFileServiceImpl implements IInspectionFileService {
public JsonResult getHandle(String id) {
return queryInspectionFileHandleByInspectionFileIdService.handle(id);
}

/**
*
* 查询任务问题分布列表
*
* @param request
* @return
*/
@Override
public JsonResult getDistributionList(QueryInspectionFileDistributionListRequest request) {
return queryInspectionFileDistributionListService.getPageList(request);
}
}

+ 163
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/service/inspectionfile/query/QueryInspectionFileDistributionListService.java Bestand weergeven

@@ -0,0 +1,163 @@
package com.tuoheng.admin.service.inspectionfile.query;

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.*;
import com.tuoheng.admin.enums.UserTypeEnum;
import com.tuoheng.admin.enums.code.inspection.QueryInspectionPageListCodeEnum;
import com.tuoheng.admin.mapper.*;
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileDistributionListRequest;
import com.tuoheng.admin.utils.ShiroUtils;
import com.tuoheng.admin.vo.InspectionFileDistributionListVo;
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;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;

/**
* 查询任务问题分布列表业务层处理
*
* @author wanjing
* @team tuoheng
* @date 2022-12-08
*/
@Slf4j
@Service
public class QueryInspectionFileDistributionListService {

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

@Autowired
private InspectionMapper inspectionMapper;

@Autowired
private InspectionFileMapper inspectionFileMapper;

@Autowired
private QuestionTypeMapper questionTypeMapper;

@Autowired
private RoadInformationMapper roadInformationMapper;

public JsonResult getPageList(QueryInspectionFileDistributionListRequest 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.setDeptIdList(deptIdList);

// 设置分页参数
IPage<InspectionFile> page = new Page<>(request.getPage(), request.getLimit());
// 查询结果
IPage<InspectionFileDistribution> pageData = inspectionFileMapper.selectDistributionList(page, request);
if (null == pageData || pageData.getTotal() == 0) {
log.info("获取任务问题分布列表为空");
return JsonResult.success(null, QueryInspectionPageListCodeEnum.DATA_IS_FAILED.getMsg());
}

// 构造返回结果对象
List<InspectionFileDistributionListVo> inspectionFileDistributionListVoList = this.buildInspectionFileDistributionListVo(pageData.getRecords());

// 重写返回结果对象
IPage<InspectionFileDistributionListVo> inspectionFileDistributionListVoData = new Page<>();
inspectionFileDistributionListVoData.setPages(pageData.getPages());
inspectionFileDistributionListVoData.setCurrent(pageData.getCurrent());
inspectionFileDistributionListVoData.setSize(pageData.getSize());
inspectionFileDistributionListVoData.setTotal(pageData.getTotal());
inspectionFileDistributionListVoData.setRecords(inspectionFileDistributionListVoList);

return JsonResult.success(inspectionFileDistributionListVoData);
}

/**
* 检查参数
*
* @param request
* @return
*/
private JsonResult check(QueryInspectionFileDistributionListRequest request) {
return JsonResult.success();
}

/**
* 获取部门Id的查询范围
* 1)、deptId:如果传了值,查该部门的任务
* 2)、deptId:如果没有传值
* 2.1)、管理员:可查全部确认问题
* 2.2)、管理员/普通用户:本部门及子部门创建的任务中已确认问题
*
* @param userId
* @return
*/
private List<String> getDeptIdList(String userId) {
List<String> deptIdList;
User user = userMapper.selectOne(new LambdaQueryWrapper<User>()
.eq(User::getId, userId)
.eq(User::getMark, 1));
if (UserTypeEnum.SUPER_ADMIN.getCode() == user.getType()) {
return null;
} else {
deptIdList = deptMapper.selectAllChildListById(user.getDeptId());
return deptIdList;
}
}

/**
* 1)、设置问题类型字段
* 2)、设置缩略图字段
*
* @param inspectionFileDistributionList
* @return
*/
private List<InspectionFileDistributionListVo> buildInspectionFileDistributionListVo(List<InspectionFileDistribution> inspectionFileDistributionList) {
Map<String, QuestionType> questionTypeMap = this.getQuestionTypeMap();
List<InspectionFileDistributionListVo> inspectionFileDistributionListVoList = InspectionFileConverMapper.INSTANCE.fromInspectionFileDistributionListToInspectionFileDistributionListVoList(inspectionFileDistributionList);
QuestionType questionType;
for (InspectionFileDistributionListVo inspectionFileDistributionListVo : inspectionFileDistributionListVoList) {
questionType = questionTypeMap.get(inspectionFileDistributionListVo.getQuestionId());
if (null != questionType) {
inspectionFileDistributionListVo.setQuestionName(Integer.toString(questionType.getName()));
inspectionFileDistributionListVo.setQuestionContent(questionType.getContent());
}
inspectionFileDistributionListVo.setFileThumbnail(CommonConfig.imageURL + inspectionFileDistributionListVo.getFileThumbnail());
}
return inspectionFileDistributionListVoList;
}

/**
*
* 获取问题类型列表,放到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()));
return questionTypeMap;
}

}

+ 89
- 0
tuoheng-service/tuoheng-admin/src/main/java/com/tuoheng/admin/vo/InspectionFileDistributionListVo.java Bestand weergeven

@@ -0,0 +1,89 @@
package com.tuoheng.admin.vo;

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

import java.util.Date;

/**
* 返回任务问题分布视图Vo
*
* @author wanjing
* @team tuoheng
* @date 2022-12-08
*/
@Data
public class InspectionFileDistributionListVo {

/**
* 问题id
*/
private String id;

/**
* 问题类型:1坑槽,2积水,3裂缝
*/
private String questionId;

/**
* 问题名称:1坑槽,2积水,3裂缝
*/
private String questionName;

/**
* 问题内容
*/
private String questionContent;

/**
* 缩略图
*/
private String fileThumbnail;

/**
* 经度
*/
private String latitude;

/**
* 经度
*/
private String longitude;

/**
* 位置信息
*/
private String location;

/**
* 高德地图纬度
*/
private String gaodeLongitude;

/**
* 高德地图经度
*/
private String gaodeLatitude;

/**
* 高德地图地址
*/
private String gaodeAddress;

/**
* 状态:5待确认 10已忽略 15已确认 20已生成工单 25问题已处理
*/
private Integer status;

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

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


}

+ 50
- 0
tuoheng-service/tuoheng-admin/src/main/resources/mapper/InspectionFileMapper.xml Bestand weergeven

@@ -72,6 +72,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="deptId" column="dept_id" />
</resultMap>

<resultMap type="com.tuoheng.admin.entity.InspectionFileDistribution" id="InspectionFileDistributionResult">
<result property="id" column="id" />
<result property="tenantId" column="tenant_id" />
<result property="fileThumbnail" column="file_thumbnail" />
<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="questionName" column="question_name" />
<result property="status" column="status" />
<result property="inspectionCode" column="inspection_code" />
<result property="inspectionName" column="inspection_name" />
</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>
@@ -87,6 +104,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ti.code as inspection_code, ti.name as inspection_name, ti.road_id, ti.dept_id
</sql>

<sql id="Base_Distribution_Column_List">
tif.id, tif.tenant_id, tif.file_thumbnail, tif.latitude, tif.longitude, tif.location, tif.gaode_longitude, tif.gaode_latitude, tif.gaode_address, tif.question_id, tif.question_name, tif.status,
ti.code as inspection_code, ti.name as inspection_name
</sql>

<update id="deleteLogicByMap" parameterType="hashmap">
update th_inspection_file
<trim prefix="SET" suffixOverrides=",">
@@ -159,6 +181,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
order by tif.create_time desc
</select>

<select id="selectDistributionList" parameterType="com.tuoheng.admin.request.inspectionfile.QueryInspectionFileDistributionListRequest" resultMap="InspectionFileDistributionResult">
select <include refid="Base_Distribution_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.inspectionName != null and request.inspectionName != 0"> and ti.name like concat('%', #{request.inspectionName}, '%') </if>
<if test="request.questionId != null and request.questionId != ''"> and tif.question_id = #{request.questionId} </if>
<if test="request.status != null">
<choose>
<when test="request.status != 0">
and tif.status = #{request.status}
</when>
<otherwise>
and tif.status in (15, 20, 25)
</otherwise>
</choose>
</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 tif.create_time desc
</select>

<update id="updateByIdList" parameterType="hashmap">
update th_inspection_file
<trim prefix="SET" suffixOverrides=",">

Laden…
Annuleren
Opslaan