* | * | ||||
* @return | * @return | ||||
*/ | */ | ||||
@PostMapping("/confirm") | |||||
public JsonResult confirm(@RequestParam("idList") List<String> idList){ | |||||
@PostMapping("/confirm/{idList}") | |||||
public JsonResult confirm(@PathVariable("idList") List<String> idList){ | |||||
return iInspectionFileService.confirm(idList); | return iInspectionFileService.confirm(idList); | ||||
} | } | ||||
* | * | ||||
* @return | * @return | ||||
*/ | */ | ||||
@PostMapping("/ignore") | |||||
public JsonResult ignore(@RequestParam("idList") List<String> idList){ | |||||
@PostMapping("/ignore/{idList}") | |||||
public JsonResult ignore(@PathVariable("idList") List<String> idList){ | |||||
return iInspectionFileService.ignore(idList); | return iInspectionFileService.ignore(idList); | ||||
} | } | ||||
package com.tuoheng.admin.conver; | package com.tuoheng.admin.conver; | ||||
import com.tuoheng.admin.entity.InspectionFile; | import com.tuoheng.admin.entity.InspectionFile; | ||||
import com.tuoheng.admin.vo.InspectionFilePageListByInspectionIdVo; | |||||
import com.tuoheng.admin.vo.InspectionFilePageListVo; | import com.tuoheng.admin.vo.InspectionFilePageListVo; | ||||
import com.tuoheng.admin.vo.InspectionFileVo; | |||||
import org.mapstruct.Mapper; | import org.mapstruct.Mapper; | ||||
import org.mapstruct.factory.Mappers; | import org.mapstruct.factory.Mappers; | ||||
InspectionFileConverMapper INSTANCE = Mappers.getMapper(InspectionFileConverMapper.class); | InspectionFileConverMapper INSTANCE = Mappers.getMapper(InspectionFileConverMapper.class); | ||||
List<InspectionFilePageListByInspectionIdVo> fromInspectionFileListToInspectionFilePageByInspectionIdListVoList(List<InspectionFile> inspectionFileList); | |||||
List<InspectionFilePageListVo> fromInspectionFileListToInspectionFilePageListVoList(List<InspectionFile> inspectionFileList); | List<InspectionFilePageListVo> fromInspectionFileListToInspectionFilePageListVoList(List<InspectionFile> inspectionFileList); | ||||
} | } |
* @param request 巡检任务查询实体 | * @param request 巡检任务查询实体 | ||||
* @return 巡检任务集合 | * @return 巡检任务集合 | ||||
*/ | */ | ||||
Page<InspectionFile> selectPageListByInspectionId(@Param("page") IPage page, @Param("request") QueryInspectionFilePageListRequest request); | |||||
Page<InspectionFile> selectPageList(@Param("page") IPage page, @Param("request") QueryInspectionFilePageListRequest request); | |||||
} | } |
package com.tuoheng.admin.request.inspectionfile; | package com.tuoheng.admin.request.inspectionfile; | ||||
import com.fasterxml.jackson.annotation.JsonFormat; | |||||
import com.tuoheng.common.core.common.BaseQuery; | import com.tuoheng.common.core.common.BaseQuery; | ||||
import lombok.Data; | import lombok.Data; | ||||
import java.util.Date; | |||||
/** | /** | ||||
* 查询巡检任务请求实体 | * 查询巡检任务请求实体 | ||||
* | * | ||||
public class QueryInspectionFilePageListRequest extends BaseQuery { | public class QueryInspectionFilePageListRequest extends BaseQuery { | ||||
/** | /** | ||||
* 任务Id | |||||
* 关键字,匹配任务编号和任务名称 | |||||
*/ | */ | ||||
private String inspectionId; | |||||
private String key; | |||||
/** | /** | ||||
* 问题类型 | * 问题类型 | ||||
*/ | */ | ||||
private String questionId; | private String questionId; | ||||
/** | |||||
* 问题状态 | |||||
*/ | |||||
private Integer status; | |||||
/** | |||||
* 部门Id | |||||
*/ | |||||
private String deptId; | |||||
/** | |||||
* 核实时间 | |||||
*/ | |||||
@JsonFormat(pattern = "yyyy-MM-dd") | |||||
private Date checkTime; | |||||
} | } |
import com.tuoheng.admin.enums.code.inspectionfile.QueryInspectionFilePageListByInspectionIdCodeEnum; | import com.tuoheng.admin.enums.code.inspectionfile.QueryInspectionFilePageListByInspectionIdCodeEnum; | ||||
import com.tuoheng.admin.mapper.*; | import com.tuoheng.admin.mapper.*; | ||||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest; | import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest; | ||||
import com.tuoheng.admin.vo.InspectionFilePageListVo; | |||||
import com.tuoheng.admin.vo.InspectionFilePageListByInspectionIdVo; | |||||
import com.tuoheng.common.core.utils.JsonResult; | import com.tuoheng.common.core.utils.JsonResult; | ||||
import com.tuoheng.common.core.utils.StringUtils; | import com.tuoheng.common.core.utils.StringUtils; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
} | } | ||||
// 构造返回结果对象 | // 构造返回结果对象 | ||||
List<InspectionFilePageListVo> inspectionFilePageListVoList = this.buildInspectionFilePageListVoList(pageData.getRecords()); | |||||
List<InspectionFilePageListByInspectionIdVo> inspectionFilePageListVoList = this.buildInspectionFilePageListVoList(pageData.getRecords()); | |||||
// 重写返回结果对象 | // 重写返回结果对象 | ||||
IPage<InspectionFilePageListVo> inspectionFilePageListVoPageData = new Page<>(); | |||||
IPage<InspectionFilePageListByInspectionIdVo> inspectionFilePageListVoPageData = new Page<>(); | |||||
inspectionFilePageListVoPageData.setPages(pageData.getPages()); | inspectionFilePageListVoPageData.setPages(pageData.getPages()); | ||||
inspectionFilePageListVoPageData.setCurrent(pageData.getCurrent()); | inspectionFilePageListVoPageData.setCurrent(pageData.getCurrent()); | ||||
inspectionFilePageListVoPageData.setSize(pageData.getSize()); | inspectionFilePageListVoPageData.setSize(pageData.getSize()); | ||||
} | } | ||||
/** | /** | ||||
* 1)、查找已确认问题数、发现问题数字段 | |||||
* 2)、判断是否有操作权限:立即执行、直播、回放、问题详情、问题核实、重新提交 | |||||
* 1)、查找问题类型字段 | |||||
* | * | ||||
* @param inspectionFileList | * @param inspectionFileList | ||||
* @return | * @return | ||||
*/ | */ | ||||
private List<InspectionFilePageListVo> buildInspectionFilePageListVoList(List<InspectionFile> inspectionFileList) { | |||||
private List<InspectionFilePageListByInspectionIdVo> buildInspectionFilePageListVoList(List<InspectionFile> inspectionFileList) { | |||||
List<QuestionType> questionTypeList = questionTypeMapper.selectList(new LambdaQueryWrapper<QuestionType>() | List<QuestionType> questionTypeList = questionTypeMapper.selectList(new LambdaQueryWrapper<QuestionType>() | ||||
.eq(QuestionType::getMark, 1)); | .eq(QuestionType::getMark, 1)); | ||||
Map<String, QuestionType> questionTypeMap = questionTypeList.stream().collect(Collectors.toMap(QuestionType::getId, Function.identity())); | Map<String, QuestionType> questionTypeMap = questionTypeList.stream().collect(Collectors.toMap(QuestionType::getId, Function.identity())); | ||||
List<InspectionFilePageListVo> inspectionFilePageListVoList = InspectionFileConverMapper.INSTANCE.fromInspectionFileListToInspectionFilePageListVoList(inspectionFileList); | |||||
List<InspectionFilePageListByInspectionIdVo> inspectionFilePageListVoList = InspectionFileConverMapper.INSTANCE.fromInspectionFileListToInspectionFilePageByInspectionIdListVoList(inspectionFileList); | |||||
QuestionType questionType; | QuestionType questionType; | ||||
Integer questionName; | Integer questionName; | ||||
for (InspectionFilePageListVo inspectionFilePageListVo : inspectionFilePageListVoList) { | |||||
for (InspectionFilePageListByInspectionIdVo inspectionFilePageListVo : inspectionFilePageListVoList) { | |||||
questionType = questionTypeMap.get(inspectionFilePageListVo.getQuestionId()); | questionType = questionTypeMap.get(inspectionFilePageListVo.getQuestionId()); | ||||
if (null != questionType) { | if (null != questionType) { | ||||
questionName = questionType.getName(); | questionName = questionType.getName(); |
import com.baomidou.mybatisplus.core.metadata.IPage; | import com.baomidou.mybatisplus.core.metadata.IPage; | ||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.tuoheng.admin.conver.InspectionFileConverMapper; | import com.tuoheng.admin.conver.InspectionFileConverMapper; | ||||
import com.tuoheng.admin.entity.Inspection; | |||||
import com.tuoheng.admin.entity.InspectionFile; | import com.tuoheng.admin.entity.InspectionFile; | ||||
import com.tuoheng.admin.entity.QuestionType; | import com.tuoheng.admin.entity.QuestionType; | ||||
import com.tuoheng.admin.enums.code.inspection.QueryInspectionPageListCodeEnum; | import com.tuoheng.admin.enums.code.inspection.QueryInspectionPageListCodeEnum; | ||||
import com.tuoheng.admin.enums.code.inspectionfile.QueryInspectionFilePageListByInspectionIdCodeEnum; | |||||
import com.tuoheng.admin.mapper.DeptMapper; | |||||
import com.tuoheng.admin.mapper.InspectionFileMapper; | import com.tuoheng.admin.mapper.InspectionFileMapper; | ||||
import com.tuoheng.admin.mapper.InspectionMapper; | import com.tuoheng.admin.mapper.InspectionMapper; | ||||
import com.tuoheng.admin.mapper.QuestionTypeMapper; | import com.tuoheng.admin.mapper.QuestionTypeMapper; | ||||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest; | |||||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest; | import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest; | ||||
import com.tuoheng.admin.vo.InspectionFilePageListByInspectionIdVo; | |||||
import com.tuoheng.admin.vo.InspectionFilePageListVo; | import com.tuoheng.admin.vo.InspectionFilePageListVo; | ||||
import com.tuoheng.common.core.utils.JsonResult; | import com.tuoheng.common.core.utils.JsonResult; | ||||
import com.tuoheng.common.core.utils.StringUtils; | import com.tuoheng.common.core.utils.StringUtils; | ||||
import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
/** | /** | ||||
* 查询巡检任务问题分页列表业务层处理 | |||||
* 查询任务问题分页列表业务层处理 | |||||
* | * | ||||
* @author wanjing | * @author wanjing | ||||
* @team tuoheng | * @team tuoheng | ||||
@Service | @Service | ||||
public class QueryInspectionFilePageListService { | public class QueryInspectionFilePageListService { | ||||
@Autowired | |||||
private DeptMapper deptMapper; | |||||
@Autowired | @Autowired | ||||
private InspectionMapper inspectionMapper; | private InspectionMapper inspectionMapper; | ||||
private QuestionTypeMapper questionTypeMapper; | private QuestionTypeMapper questionTypeMapper; | ||||
public JsonResult getPageList(QueryInspectionFilePageListRequest request) { | public JsonResult getPageList(QueryInspectionFilePageListRequest request) { | ||||
log.info("进入根据任务ID查询巡检任务问题分页列表业务, inspectionId:{}, questionId:{}", request.getInspectionId(), request.getQuestionId()); | |||||
log.info("进入查询任务问题分页列表业务, request:{}", request.toString()); | |||||
JsonResult result = this.check(request); | JsonResult result = this.check(request); | ||||
if (0 != result.getCode()) { | if (0 != result.getCode()) { | ||||
log.info("进入根据任务ID查询巡检任务问题分页列表业务:校验失败:{}", result.getMsg()); | |||||
log.info("进入查询任务问题分页列表业务:校验失败:{}", result.getMsg()); | |||||
return result; | return result; | ||||
} | } | ||||
// 设置分页参数 | // 设置分页参数 | ||||
IPage<InspectionFile> page = new Page<>(request.getPage(), request.getLimit()); | IPage<InspectionFile> page = new Page<>(request.getPage(), request.getLimit()); | ||||
// 查询结果 | // 查询结果 | ||||
IPage<InspectionFile> pageData = inspectionFileMapper.selectPageListByInspectionId(page, request); | |||||
IPage<InspectionFile> pageData = inspectionFileMapper.selectPageList(page, request); | |||||
if (null == pageData || pageData.getTotal() == 0) { | if (null == pageData || pageData.getTotal() == 0) { | ||||
log.info("获取任务分页列表为空"); | log.info("获取任务分页列表为空"); | ||||
return JsonResult.success(null, QueryInspectionPageListCodeEnum.DATA_IS_FAILED.getMsg()); | return JsonResult.success(null, QueryInspectionPageListCodeEnum.DATA_IS_FAILED.getMsg()); | ||||
* @return | * @return | ||||
*/ | */ | ||||
private JsonResult check(QueryInspectionFilePageListRequest request) { | private JsonResult check(QueryInspectionFilePageListRequest request) { | ||||
// 判断任务id是否为空 | |||||
if (StringUtils.isEmpty(request.getInspectionId())) { | |||||
return JsonResult.error(QueryInspectionFilePageListByInspectionIdCodeEnum.INSPECTION_ID_IS_NULL.getCode(), QueryInspectionFilePageListByInspectionIdCodeEnum.INSPECTION_ID_IS_NULL.getMsg()); | |||||
} | |||||
// 判断任务是否存在 | |||||
Inspection inspection = inspectionMapper.selectOne(new LambdaQueryWrapper<Inspection>() | |||||
.eq(Inspection::getId, request.getInspectionId()) | |||||
.eq(Inspection::getMark, 1)); | |||||
return JsonResult.success(); | |||||
} | |||||
if (null == inspection) { | |||||
return JsonResult.error(QueryInspectionFilePageListByInspectionIdCodeEnum.INSPECTION_IS_NOT_EXIST.getCode(), QueryInspectionFilePageListByInspectionIdCodeEnum.INSPECTION_IS_NOT_EXIST.getMsg()); | |||||
/** | |||||
* 超级管理员可查全部的任务 | |||||
* | |||||
* @param request | |||||
* @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; | |||||
} | |||||
/** | |||||
* 管理员和普通用户可查本部门及子部门的任务 | |||||
* 1)、如果前端检索条件,传了部门Id,则根据deptId来查 | |||||
* 2)、如果前端检索条件,部门Id为空,则表示查本部门及子部门的任务 | |||||
* | |||||
* @param request | |||||
* @return | |||||
*/ | |||||
private IPage<InspectionFile> getListByDept(QueryInspectionFilePageListRequest request) { | |||||
// 获取本部门及子孙部门id列表 | |||||
if (StringUtils.isEmpty(request.getDeptId())) { | |||||
List<String> deptIdList = deptMapper.selectAllChildListById(request.getDeptId()); | |||||
// request.setDeptIdList(deptIdList); | |||||
} | } | ||||
return JsonResult.success(inspection); | |||||
// 设置分页参数 | |||||
IPage<InspectionFile> page = new Page<>(request.getPage(), request.getLimit()); | |||||
// 查询结果 | |||||
IPage<InspectionFile> pageData = inspectionFileMapper.selectPageList(page, request); | |||||
return pageData; | |||||
} | } | ||||
/** | /** | ||||
List<InspectionFilePageListVo> inspectionFilePageListVoList = InspectionFileConverMapper.INSTANCE.fromInspectionFileListToInspectionFilePageListVoList(inspectionFileList); | List<InspectionFilePageListVo> inspectionFilePageListVoList = InspectionFileConverMapper.INSTANCE.fromInspectionFileListToInspectionFilePageListVoList(inspectionFileList); | ||||
QuestionType questionType; | QuestionType questionType; | ||||
Integer questionName; | |||||
for (InspectionFilePageListVo inspectionFilePageListVo : inspectionFilePageListVoList) { | for (InspectionFilePageListVo inspectionFilePageListVo : inspectionFilePageListVoList) { | ||||
questionType = questionTypeMap.get(inspectionFilePageListVo.getQuestionId()); | questionType = questionTypeMap.get(inspectionFilePageListVo.getQuestionId()); | ||||
if (null != questionType) { | if (null != questionType) { | ||||
questionName = questionType.getName(); | |||||
inspectionFilePageListVo.setQuestionName(Integer.toString(questionName)); | |||||
inspectionFilePageListVo.setQuestionName(Integer.toString(questionType.getName())); | |||||
inspectionFilePageListVo.setQuestionContent(questionType.getContent()); | |||||
} | } | ||||
} | } | ||||
return inspectionFilePageListVoList; | return inspectionFilePageListVoList; |
package com.tuoheng.admin.vo; | |||||
import lombok.Data; | |||||
/** | |||||
* 返回任务详情视图Vo | |||||
* | |||||
* @author wanjing | |||||
* @team tuoheng | |||||
* @date 2022-12-05 | |||||
*/ | |||||
@Data | |||||
public class InspectionFilePageListByInspectionIdVo { | |||||
/** | |||||
* 问题id | |||||
*/ | |||||
private String id; | |||||
/** | |||||
* 问题类型:1坑槽,2积水,3裂缝 | |||||
*/ | |||||
private String questionId; | |||||
/** | |||||
* 类型名称:1坑槽,2积水,3裂缝 | |||||
*/ | |||||
private String questionName; | |||||
/** | |||||
* 缩略图 | |||||
*/ | |||||
private String fileThumbnail; | |||||
/** | |||||
* 经度 | |||||
*/ | |||||
private String latitude; | |||||
/** | |||||
* 经度 | |||||
*/ | |||||
private String longitude; | |||||
/** | |||||
* 位置信息 | |||||
*/ | |||||
private String location; | |||||
/** | |||||
* 状态:5待确认 10已忽略 15已确认 20已生成工单 25问题已处理 | |||||
*/ | |||||
private Integer status; | |||||
} |
private String questionId; | private String questionId; | ||||
/** | /** | ||||
* 类型名称:1坑槽,2积水,3裂缝 | |||||
* 问题名称:1坑槽,2积水,3裂缝 | |||||
*/ | */ | ||||
private String questionName; | private String questionName; | ||||
/** | |||||
* 问题内容 | |||||
*/ | |||||
private String questionContent; | |||||
/** | /** | ||||
* 缩略图 | * 缩略图 | ||||
*/ | */ |
order by create_time desc | order by create_time desc | ||||
</select> | </select> | ||||
<select id="selectPageList" parameterType="com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest" resultMap="InspectionFileResult"> | |||||
select <include refid="Base_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 | |||||
</select> | |||||
<update id="updateByIdList" parameterType="hashmap"> | <update id="updateByIdList" parameterType="hashmap"> | ||||
update th_inspection_file | update th_inspection_file | ||||
<trim prefix="SET" suffixOverrides=","> | <trim prefix="SET" suffixOverrides=","> |