@@ -1,12 +1,15 @@ | |||
package com.tuoheng.admin.controller; | |||
import com.tuoheng.admin.query.InspectionFileQuery; | |||
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.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
import org.springframework.beans.factory.annotation.Qualifier; | |||
import org.springframework.web.bind.annotation.*; | |||
import java.util.List; | |||
/** | |||
* @Author ChengWang | |||
@@ -38,5 +41,44 @@ public class InspectionFileController { | |||
return iInspectionFileService.getListByDeptUserType(query); | |||
} | |||
/** | |||
* 查询任务分页列表 | |||
* | |||
* @return | |||
*/ | |||
@GetMapping("/page/list") | |||
public JsonResult getPageList(@RequestBody QueryInspectionFilePageListRequest request){ | |||
return null; | |||
} | |||
/** | |||
* 根据任务ID查询任务分页列表 | |||
* | |||
* @return | |||
*/ | |||
@GetMapping("/page/list/by/inspectionid") | |||
public JsonResult getPageListByInspectionId(@RequestBody QueryInspectionFilePageListByInspectionIdRequest request){ | |||
return iInspectionFileService.getPageListByInspectionId(request); | |||
} | |||
/** | |||
* 任务问题忽略 | |||
* | |||
* @return | |||
*/ | |||
@PostMapping("/confirm") | |||
public JsonResult confirm(@RequestParam("idList") List<String> idList){ | |||
return iInspectionFileService.confirm(idList); | |||
} | |||
/** | |||
* 任务问题忽略 | |||
* | |||
* @return | |||
*/ | |||
@PostMapping("/ignore") | |||
public JsonResult ignore(@RequestParam("idList") List<String> idList){ | |||
return iInspectionFileService.ignore(idList); | |||
} | |||
} |
@@ -0,0 +1,18 @@ | |||
package com.tuoheng.admin.conver; | |||
import com.tuoheng.admin.entity.InspectionFile; | |||
import com.tuoheng.admin.vo.InspectionFilePageListVo; | |||
import com.tuoheng.admin.vo.InspectionFileVo; | |||
import org.mapstruct.Mapper; | |||
import org.mapstruct.factory.Mappers; | |||
import java.util.List; | |||
@Mapper | |||
public interface InspectionFileConverMapper { | |||
InspectionFileConverMapper INSTANCE = Mappers.getMapper(InspectionFileConverMapper.class); | |||
List<InspectionFilePageListVo> fromInspectionFileListToInspectionFilePageListVoList(List<InspectionFile> inspectionFileList); | |||
} |
@@ -0,0 +1,50 @@ | |||
package com.tuoheng.admin.enums.code.inspectionfile; | |||
/** | |||
* 任务问题确认返回码 | |||
* 模块代码:24(问题管理) | |||
* 接口代码:05 (任务问题确认) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-05 | |||
*/ | |||
public enum InspectionFileConfirmCodeEnum { | |||
CONFIRM_IS_FAILED(1240500, "确认任务问题失败"), | |||
INSPECTION_FILE_ID_IS_NULL(1240501, "任务问题id为空"), | |||
INSPECTION_FILE_IS_NOT_EXIST(1240502, "任务问题不存在"), | |||
NOT_CONFIRM_INSPECTION_FILE(1240503, "非待确认任务不能被确认"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
InspectionFileConfirmCodeEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -0,0 +1,50 @@ | |||
package com.tuoheng.admin.enums.code.inspectionfile; | |||
/** | |||
* 任务问题忽略返回码 | |||
* 模块代码:24(问题管理) | |||
* 接口代码:06 (任务问题忽略) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-05 | |||
*/ | |||
public enum InspectionFileIgnoreCodeEnum { | |||
IGNORE_IS_FAILED(1240600, "忽略任务问题失败"), | |||
INSPECTION_FILE_ID_IS_NULL(1240601, "任务问题id为空"), | |||
INSPECTION_FILE_IS_NOT_EXIST(1240602, "任务问题不存在"), | |||
NOT_WAIT_CONFIRMED_OR_CONFIRMED_CAN_IGNORED(1240603, "非待确认和已确认不能被忽略"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
InspectionFileIgnoreCodeEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -1,4 +1,4 @@ | |||
package com.tuoheng.admin.enums.code.inspectionFile; | |||
package com.tuoheng.admin.enums.code.inspectionfile; | |||
/** | |||
* @Author ChengWang |
@@ -0,0 +1,49 @@ | |||
package com.tuoheng.admin.enums.code.inspectionfile; | |||
/** | |||
* 根据任务ID查询巡检任务问题分页列表返回码 | |||
* 模块代码:24(问题管理) | |||
* 接口代码:04 (根据任务ID查询巡检任务问题分页列表) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-01 | |||
*/ | |||
public enum QueryInspectionFilePageListByInspectionIdCodeEnum { | |||
QUERY_IS_FAILED(1240400, "获取数据失败"), | |||
INSPECTION_ID_IS_NULL(1240401, "任务id为空"), | |||
INSPECTION_IS_NOT_EXIST(1240402, "任务不存在"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
QueryInspectionFilePageListByInspectionIdCodeEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -1,8 +1,13 @@ | |||
package com.tuoheng.admin.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
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.request.inspection.QueryInspectionPageListRequest; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest; | |||
import org.apache.ibatis.annotations.Param; | |||
import java.util.List; | |||
import java.util.Map; | |||
@@ -34,5 +39,16 @@ public interface InspectionFileMapper extends BaseMapper<InspectionFile> { | |||
*/ | |||
int deleteByInspectionId(String inspectionId); | |||
int updateByIdList(Map<String, Object> map); | |||
List<InspectionFile> selectListByInspectIdList(List<String> inspectionIdList); | |||
/** | |||
* 查询任务ID查询任务分页列表 | |||
* | |||
* @param request 巡检任务查询实体 | |||
* @return 巡检任务集合 | |||
*/ | |||
Page<InspectionFile> selectPageListByInspectionId(@Param("page") IPage page, @Param("request") QueryInspectionFilePageListByInspectionIdRequest request); | |||
} |
@@ -0,0 +1,33 @@ | |||
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-05 | |||
*/ | |||
@Data | |||
public class QueryInspectionFilePageListByInspectionIdRequest extends BaseQuery { | |||
/** | |||
* 任务Id | |||
*/ | |||
private String inspectionId; | |||
/** | |||
* 问题类型 | |||
*/ | |||
private String questionId; | |||
/** | |||
* 问题状态:5待确认 10已忽略 15已确认 20已生成工单 25问题已处理 | |||
*/ | |||
private Integer status; | |||
} |
@@ -0,0 +1,27 @@ | |||
package com.tuoheng.admin.request.inspectionfile; | |||
import com.tuoheng.common.core.common.BaseQuery; | |||
import lombok.Data; | |||
/** | |||
* 查询巡检任务请求实体 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-05 | |||
*/ | |||
@Data | |||
public class QueryInspectionFilePageListRequest extends BaseQuery { | |||
/** | |||
* 任务Id | |||
*/ | |||
private String inspectionId; | |||
/** | |||
* 问题类型 | |||
*/ | |||
private String questionId; | |||
} |
@@ -1,8 +1,11 @@ | |||
package com.tuoheng.admin.service; | |||
import com.tuoheng.admin.query.InspectionFileQuery; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import java.util.List; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/11/29 | |||
@@ -11,4 +14,26 @@ public interface IInspectionFileService { | |||
JsonResult getQuestionList(); | |||
JsonResult getListByDeptUserType(InspectionFileQuery query); | |||
JsonResult getPageListByInspectionId(QueryInspectionFilePageListByInspectionIdRequest request); | |||
/** | |||
* | |||
* 确认 | |||
* | |||
* @param idList | |||
* @return | |||
*/ | |||
JsonResult confirm(List<String> idList); | |||
/** | |||
* | |||
* 忽略 | |||
* | |||
* @param idList | |||
* @return | |||
*/ | |||
JsonResult ignore(List<String> idList); | |||
} |
@@ -9,23 +9,28 @@ import com.tuoheng.admin.entity.InspectionFile; | |||
import com.tuoheng.admin.entity.QuestionType; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.enums.UserTypeEnum; | |||
import com.tuoheng.admin.enums.code.inspectionFile.ListByDeptUserTypeEnum; | |||
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.QueryInspectionFilePageListByInspectionIdRequest; | |||
import com.tuoheng.admin.service.IInspectionFileService; | |||
import com.tuoheng.admin.service.inspectionfile.confirm.InspectionFileConfirmService; | |||
import com.tuoheng.admin.service.inspectionfile.ignore.InspectionFileIgnoreService; | |||
import com.tuoheng.admin.service.inspectionfile.query.QueryInspectionFilePageListByInspectionIdService; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.vo.InspectionFileVo; | |||
import com.tuoheng.admin.vo.ListByDeptUserTypeVo; | |||
import com.tuoheng.common.core.enums.ServiceExceptionEnum; | |||
import com.tuoheng.common.core.exception.ServiceException; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.SecurityUserUtils; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.RequestBody; | |||
import java.util.ArrayList; | |||
@@ -57,7 +62,14 @@ public class InspectionFileServiceImpl implements IInspectionFileService { | |||
@Autowired | |||
private DeptMapper deptMapper; | |||
@Autowired | |||
private QueryInspectionFilePageListByInspectionIdService queryInspectionFilePageListByInspectionIdService; | |||
@Autowired | |||
private InspectionFileIgnoreService inspectionFileIgnoreService; | |||
@Autowired | |||
private InspectionFileConfirmService inspectionFileConfirmService; | |||
/** | |||
* 问题类型和任务名称 | |||
@@ -246,5 +258,37 @@ public class InspectionFileServiceImpl implements IInspectionFileService { | |||
return JsonResult.success(list); | |||
} | |||
/** | |||
* 根据任务ID查询任务分页列表 | |||
* | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult getPageListByInspectionId(QueryInspectionFilePageListByInspectionIdRequest request){ | |||
return queryInspectionFilePageListByInspectionIdService.getPageListByInspectionId(request); | |||
} | |||
/** | |||
* | |||
* 确认 | |||
* | |||
* @param idList | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult confirm(List<String> idList) { | |||
return inspectionFileConfirmService.confirm(idList); | |||
} | |||
/** | |||
* | |||
* 忽略 | |||
* | |||
* @param idList | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult ignore(List<String> idList) { | |||
return inspectionFileIgnoreService.ignore(idList); | |||
} | |||
} |
@@ -1,7 +1,6 @@ | |||
package com.tuoheng.admin.service.inspection.query; | |||
import com.tuoheng.admin.enums.code.inspectionFile.ListByDeptUserTypeEnum; | |||
import com.tuoheng.admin.mapper.InspectionFileMapper; | |||
import com.tuoheng.admin.enums.code.inspectionfile.ListByDeptUserTypeEnum; | |||
import com.tuoheng.admin.mapper.InspectionMapper; | |||
import com.tuoheng.admin.mapper.UserMapper; | |||
import com.tuoheng.admin.query.InspectionFileQuery; |
@@ -0,0 +1,108 @@ | |||
package com.tuoheng.admin.service.inspectionfile.confirm; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.entity.InspectionFile; | |||
import com.tuoheng.admin.enums.InspectionFileStatusEnum; | |||
import com.tuoheng.admin.enums.code.inspectionfile.InspectionFileConfirmCodeEnum; | |||
import com.tuoheng.admin.enums.code.inspectionfile.InspectionFileIgnoreCodeEnum; | |||
import com.tuoheng.admin.mapper.InspectionFileMapper; | |||
import com.tuoheng.admin.mapper.InspectionMapper; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.common.core.utils.DateUtils; | |||
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.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* 任务问题确认业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-05 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class InspectionFileConfirmService { | |||
@Autowired | |||
private InspectionMapper inspectionMapper; | |||
@Autowired | |||
private InspectionFileMapper inspectionFileMapper; | |||
public JsonResult confirm(List<String> idList) { | |||
log.info("进入任务问题确认业务, id:{}", idList.toString()); | |||
String userId = ShiroUtils.getUserId(); | |||
JsonResult result = this.check(idList); | |||
if (0 != result.getCode()) { | |||
log.info("进入任务问题确认业务:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
// 确认任务问题 | |||
result = this.updateInspectionFileStatus(userId, idList); | |||
return result; | |||
} | |||
/** | |||
* 检查参数 | |||
* | |||
* @param idList | |||
* @return | |||
*/ | |||
private JsonResult check(List<String> idList) { | |||
// 判断任务id是否为空 | |||
if (CollectionUtil.isEmpty(idList)) { | |||
return JsonResult.error(InspectionFileConfirmCodeEnum.INSPECTION_FILE_ID_IS_NULL.getCode(), InspectionFileConfirmCodeEnum.INSPECTION_FILE_ID_IS_NULL.getMsg()); | |||
} | |||
// 判断任务是否存在 | |||
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(new LambdaQueryWrapper<InspectionFile>() | |||
.in(InspectionFile::getId, idList) | |||
.eq(InspectionFile::getMark, 1)); | |||
if (CollectionUtil.isEmpty(inspectionFileList)) { | |||
return JsonResult.error(InspectionFileConfirmCodeEnum.INSPECTION_FILE_IS_NOT_EXIST.getCode(), InspectionFileConfirmCodeEnum.INSPECTION_FILE_IS_NOT_EXIST.getMsg()); | |||
} | |||
for (InspectionFile inspectionFile : inspectionFileList) { | |||
if (InspectionFileStatusEnum.WAIT_CONFIRMED.getCode() != inspectionFile.getStatus()) { | |||
return JsonResult.error(InspectionFileConfirmCodeEnum.NOT_CONFIRM_INSPECTION_FILE.getCode(), InspectionFileConfirmCodeEnum.NOT_CONFIRM_INSPECTION_FILE.getMsg()); | |||
} | |||
} | |||
return JsonResult.success(); | |||
} | |||
/** | |||
* | |||
* 问题状态,改为已经确认 | |||
* | |||
* @param userId | |||
* @param idList | |||
*/ | |||
private JsonResult updateInspectionFileStatus(String userId, List<String> idList) { | |||
Map<String, Object> map = new HashMap<>(); | |||
map.put("status", InspectionFileStatusEnum.CONFIRMED.getCode()); | |||
map.put("updateUser", userId); | |||
map.put("updateTime", DateUtils.now()); | |||
map.put("idList", idList); | |||
Integer rowCount = inspectionFileMapper.updateByIdList(map); | |||
if (rowCount <= 0) { | |||
log.info("修改任务问题状态, 确认失败"); | |||
return JsonResult.error(InspectionFileConfirmCodeEnum.CONFIRM_IS_FAILED.getCode(), InspectionFileConfirmCodeEnum.CONFIRM_IS_FAILED.getMsg()); | |||
} | |||
return JsonResult.success(); | |||
} | |||
} |
@@ -0,0 +1,108 @@ | |||
package com.tuoheng.admin.service.inspectionfile.ignore; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.entity.InspectionFile; | |||
import com.tuoheng.admin.enums.InspectionFileStatusEnum; | |||
import com.tuoheng.admin.enums.code.inspectionfile.InspectionFileConfirmCodeEnum; | |||
import com.tuoheng.admin.enums.code.inspectionfile.InspectionFileIgnoreCodeEnum; | |||
import com.tuoheng.admin.mapper.InspectionFileMapper; | |||
import com.tuoheng.admin.mapper.InspectionMapper; | |||
import com.tuoheng.admin.service.inspectionfile.confirm.InspectionFileConfirmService; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.common.core.utils.DateUtils; | |||
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.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
/** | |||
* 任务问题忽略业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-05 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class InspectionFileIgnoreService { | |||
@Autowired | |||
private InspectionMapper inspectionMapper; | |||
@Autowired | |||
private InspectionFileMapper inspectionFileMapper; | |||
public JsonResult ignore(List<String> idList) { | |||
log.info("进入任务问题忽略业务, idList:{}", idList.toString()); | |||
String userId = ShiroUtils.getUserId(); | |||
JsonResult result = this.check(idList); | |||
if (0 != result.getCode()) { | |||
log.info("进入任务问题忽略业务:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
// 忽略任务问题 | |||
result = this.updateInspectionFileStatus(userId, idList); | |||
return result; | |||
} | |||
/** | |||
* 检查参数 | |||
* | |||
* @param idList | |||
* @return | |||
*/ | |||
private JsonResult check(List<String> idList) { | |||
// 判断任务id是否为空 | |||
if (CollectionUtil.isEmpty(idList)) { | |||
return JsonResult.error(InspectionFileIgnoreCodeEnum.INSPECTION_FILE_ID_IS_NULL.getCode(), InspectionFileIgnoreCodeEnum.INSPECTION_FILE_ID_IS_NULL.getMsg()); | |||
} | |||
// 判断任务是否存在 | |||
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(new LambdaQueryWrapper<InspectionFile>() | |||
.in(InspectionFile::getId, idList) | |||
.eq(InspectionFile::getMark, 1)); | |||
if (CollectionUtil.isEmpty(inspectionFileList)) { | |||
return JsonResult.error(InspectionFileIgnoreCodeEnum.INSPECTION_FILE_IS_NOT_EXIST.getCode(), InspectionFileIgnoreCodeEnum.INSPECTION_FILE_IS_NOT_EXIST.getMsg()); | |||
} | |||
for (InspectionFile inspectionFile : inspectionFileList) { | |||
if (InspectionFileStatusEnum.WAIT_CONFIRMED.getCode() != inspectionFile.getStatus() && InspectionFileStatusEnum.CONFIRMED.getCode() != inspectionFile.getStatus()) { | |||
return JsonResult.error(InspectionFileIgnoreCodeEnum.NOT_WAIT_CONFIRMED_OR_CONFIRMED_CAN_IGNORED.getCode(), InspectionFileIgnoreCodeEnum.NOT_WAIT_CONFIRMED_OR_CONFIRMED_CAN_IGNORED.getMsg()); | |||
} | |||
} | |||
return JsonResult.success(); | |||
} | |||
/** | |||
* | |||
* 问题状态,改为忽略 | |||
* | |||
* @param userId | |||
* @param idList | |||
*/ | |||
private JsonResult updateInspectionFileStatus(String userId, List<String> idList) { | |||
Map<String, Object> map = new HashMap<>(); | |||
map.put("status", InspectionFileStatusEnum.IGNORED.getCode()); | |||
map.put("updateUser", userId); | |||
map.put("updateTime", DateUtils.now()); | |||
map.put("idList", idList); | |||
Integer rowCount = inspectionFileMapper.updateByIdList(map); | |||
if (rowCount <= 0) { | |||
log.info("修改任务问题状态, 忽略失败"); | |||
return JsonResult.error(InspectionFileIgnoreCodeEnum.IGNORE_IS_FAILED.getCode(), InspectionFileIgnoreCodeEnum.IGNORE_IS_FAILED.getMsg()); | |||
} | |||
return JsonResult.success(); | |||
} | |||
} |
@@ -0,0 +1,126 @@ | |||
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.Inspection; | |||
import com.tuoheng.admin.entity.InspectionFile; | |||
import com.tuoheng.admin.entity.QuestionType; | |||
import com.tuoheng.admin.enums.code.inspection.QueryInspectionPageListCodeEnum; | |||
import com.tuoheng.admin.enums.code.inspectionfile.QueryInspectionFilePageListByInspectionIdCodeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest; | |||
import com.tuoheng.admin.vo.InspectionFilePageListVo; | |||
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.Map; | |||
import java.util.function.Function; | |||
import java.util.stream.Collectors; | |||
/** | |||
* 根据任务ID查询巡检任务问题分页列表业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-05 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class QueryInspectionFilePageListByInspectionIdService { | |||
@Autowired | |||
private InspectionMapper inspectionMapper; | |||
@Autowired | |||
private InspectionFileMapper inspectionFileMapper; | |||
@Autowired | |||
private QuestionTypeMapper questionTypeMapper; | |||
public JsonResult getPageListByInspectionId(QueryInspectionFilePageListByInspectionIdRequest request) { | |||
log.info("进入根据任务ID查询巡检任务问题分页列表业务, inspectionId:{}, questionId:{}", request.getInspectionId(), request.getQuestionId()); | |||
JsonResult result = this.check(request); | |||
if (0 != result.getCode()) { | |||
log.info("进入根据任务ID查询巡检任务问题分页列表业务:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
// 设置分页参数 | |||
IPage<InspectionFile> page = new Page<>(request.getPage(), request.getLimit()); | |||
// 查询结果 | |||
IPage<InspectionFile> pageData = inspectionFileMapper.selectPageListByInspectionId(page, request); | |||
if (null == pageData || pageData.getTotal() == 0) { | |||
log.info("获取任务分页列表为空"); | |||
return JsonResult.success(null, QueryInspectionPageListCodeEnum.DATA_IS_FAILED.getMsg()); | |||
} | |||
// 构造返回结果对象 | |||
List<InspectionFilePageListVo> inspectionFilePageListVoList = this.buildInspectionFilePageListVoList(pageData.getRecords()); | |||
// 重写返回结果对象 | |||
IPage<InspectionFilePageListVo> inspectionFilePageListVoPageData = new Page<>(); | |||
inspectionFilePageListVoPageData.setPages(pageData.getPages()); | |||
inspectionFilePageListVoPageData.setCurrent(pageData.getCurrent()); | |||
inspectionFilePageListVoPageData.setSize(pageData.getSize()); | |||
inspectionFilePageListVoPageData.setTotal(pageData.getTotal()); | |||
inspectionFilePageListVoPageData.setRecords(inspectionFilePageListVoList); | |||
return JsonResult.success(inspectionFilePageListVoPageData); | |||
} | |||
/** | |||
* 检查参数 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
private JsonResult check(QueryInspectionFilePageListByInspectionIdRequest 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)); | |||
if (null == inspection) { | |||
return JsonResult.error(QueryInspectionFilePageListByInspectionIdCodeEnum.INSPECTION_IS_NOT_EXIST.getCode(), QueryInspectionFilePageListByInspectionIdCodeEnum.INSPECTION_IS_NOT_EXIST.getMsg()); | |||
} | |||
return JsonResult.success(inspection); | |||
} | |||
/** | |||
* 1)、查找已确认问题数、发现问题数字段 | |||
* 2)、判断是否有操作权限:立即执行、直播、回放、问题详情、问题核实、重新提交 | |||
* | |||
* @param inspectionFileList | |||
* @return | |||
*/ | |||
private List<InspectionFilePageListVo> buildInspectionFilePageListVoList(List<InspectionFile> inspectionFileList) { | |||
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; | |||
Integer questionName; | |||
for (InspectionFilePageListVo inspectionFilePageListVo : inspectionFilePageListVoList) { | |||
questionType = questionTypeMap.get(inspectionFilePageListVo.getQuestionId()); | |||
if (null != questionType) { | |||
questionName = questionType.getName(); | |||
inspectionFilePageListVo.setQuestionName(Integer.toString(questionName)); | |||
} | |||
} | |||
return inspectionFilePageListVoList; | |||
} | |||
} |
@@ -0,0 +1,55 @@ | |||
package com.tuoheng.admin.vo; | |||
import lombok.Data; | |||
/** | |||
* 返回任务详情视图Vo | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-05 | |||
*/ | |||
@Data | |||
public class InspectionFilePageListVo { | |||
/** | |||
* 问题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; | |||
} |
@@ -31,7 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
<if test="mark != null"> mark = #{mark},</if> | |||
</trim> | |||
<where> | |||
<if test="inspectionFileId != null and inspectionId != ''"> | |||
<if test="inspectionFileIdList != null and inspectionFileIdList.size() >0"> | |||
and inspection_file_id in | |||
<foreach collection="inspectionFileIdList" item="inspectionFileId" separator="," open="(" close=")"> | |||
#{inspectionFileId} |
@@ -70,4 +70,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
</foreach> | |||
</select> | |||
<select id="selectPageListByInspectionId" parameterType="com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest" resultMap="InspectionFileResult"> | |||
select <include refid="Base_Column_List"/> | |||
from th_inspection_file | |||
<where> | |||
<if test="1 == 1"> and mark = 1 </if> | |||
<if test="request.inspectionId != null and request.inspectionId != ''"> and inspection_id = #{request.inspectionId} </if> | |||
<if test="request.questionId != null and request.questionId != ''"> and question_id = #{request.questionId} </if> | |||
<if test="request.status != null and request.status != 0"> and status = #{request.status} </if> | |||
</where> | |||
order by create_time desc | |||
</select> | |||
<update id="updateByIdList" parameterType="hashmap"> | |||
update th_inspection_file | |||
<trim prefix="SET" suffixOverrides=","> | |||
<if test="status != null"> status = #{status}, </if> | |||
<if test="updateUser != null and updateUser != ''"> update_user = #{updateUser}, </if> | |||
<if test="updateTime != null"> update_time = #{updateTime}, </if> | |||
</trim> | |||
<where> | |||
<if test="idList != null and idList.size() > 0"> | |||
and id in | |||
<foreach collection="idList" item="id" separator="," open="(" close=")"> | |||
#{id} | |||
</foreach> | |||
</if> | |||
</where> | |||
</update> | |||
</mapper> |