@@ -42,7 +42,7 @@ public class ReportController { | |||
*/ | |||
@GetMapping("/page/list") | |||
public JsonResult getPageList(QueryReportPageListRequest request) { | |||
log.info("进入查询报告分页列表接口"); | |||
// log.info("进入查询报告分页列表接口"); | |||
return reportService.getPageList(request); | |||
} | |||
@@ -51,7 +51,7 @@ public class ReportController { | |||
*/ | |||
@GetMapping("/inspection/{id}") | |||
public JsonResult getInspectionReport(@PathVariable("id") String id) { | |||
log.info("进入查看巡检报告接口"); | |||
// log.info("进入查看巡检报告接口"); | |||
return reportService.getInspectionReport(id); | |||
} | |||
@@ -60,7 +60,7 @@ public class ReportController { | |||
*/ | |||
@GetMapping("/export/inspection/{id}") | |||
public void exportInspectionReport(@PathVariable("id")String id, HttpServletRequest request, HttpServletResponse response) { | |||
log.info("进入导出巡检报告接口"); | |||
// log.info("进入导出巡检报告接口"); | |||
reportService.exportInspectionReport(request, response, id); | |||
} | |||
@@ -69,7 +69,7 @@ public class ReportController { | |||
*/ | |||
@GetMapping("/inspection/handle/{id}") | |||
public JsonResult getHandleReport(@PathVariable("id") String id) { | |||
log.info("进入查看处理报告接口"); | |||
// log.info("进入查看处理报告接口"); | |||
return reportService.getInspectionHandleReport(id); | |||
} | |||
@@ -78,7 +78,7 @@ public class ReportController { | |||
*/ | |||
@GetMapping("/export/inspection/handle/{id}") | |||
public void exportHandleReport(@PathVariable("id")String id, HttpServletRequest request, HttpServletResponse response) { | |||
log.info("进入导出处理报告接口"); | |||
// log.info("进入导出处理报告接口"); | |||
reportService.exportInspectionHandleReport(request, response, id); | |||
} | |||
@@ -275,14 +275,4 @@ public class Report extends BaseEntity { | |||
*/ | |||
private String patrolLocation; | |||
/** | |||
* 问题总数 | |||
*/ | |||
private Integer problemTotalCount; | |||
/** | |||
* 问题处理数 | |||
*/ | |||
private Integer problemHandleCount; | |||
} |
@@ -7,8 +7,8 @@ import lombok.Getter; | |||
* @author chenyukun | |||
*/ | |||
public enum MarkTypeEnum { | |||
VALID(1,"有效"), | |||
VALID(1,"有效"), | |||
NOTVALID(0,"失效"); | |||
MarkTypeEnum(int code, String description){ |
@@ -1,129 +1,127 @@ | |||
package com.tuoheng.admin.service.dept; | |||
import com.tuoheng.admin.entity.Dept; | |||
import com.tuoheng.admin.mapper.DeptMapper; | |||
import com.tuoheng.admin.request.dept.AddDeptRequest; | |||
import com.tuoheng.admin.request.dept.EditDeptRequest; | |||
import com.tuoheng.admin.request.dept.QueryDeptChildPageListRequest; | |||
import com.tuoheng.admin.service.dept.add.AddDeptService; | |||
import com.tuoheng.admin.service.dept.delete.DeleteDeptService; | |||
import com.tuoheng.admin.service.dept.query.QueryChildListService; | |||
import com.tuoheng.admin.service.dept.query.QueryDeptInfoService; | |||
import com.tuoheng.admin.service.dept.query.QueryListTreeByDeptIdService; | |||
import com.tuoheng.admin.service.dept.query.QueryListTreeService; | |||
import com.tuoheng.admin.service.dept.update.UpdateDeptService; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* 部门业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-11-16 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class DeptServiceImpl implements IDeptService { | |||
@Autowired | |||
private DeptMapper deptMapper; | |||
@Autowired | |||
private QueryListTreeService queryListTreeService; | |||
@Autowired | |||
private QueryListTreeByDeptIdService queryListTreeByDeptIdService; | |||
@Autowired | |||
private QueryChildListService queryChildListService; | |||
@Autowired | |||
private QueryDeptInfoService queryDeptInfoService; | |||
@Autowired | |||
private AddDeptService addDeptService; | |||
@Autowired | |||
private UpdateDeptService updateDeptService; | |||
@Autowired | |||
private DeleteDeptService deleteDeptService; | |||
/** | |||
* 查询部门树形列表 | |||
* | |||
* @return 部门 | |||
*/ | |||
@Override | |||
public JsonResult getListTree() { | |||
return queryListTreeService.getListTree(); | |||
} | |||
/** | |||
* 查询当前部门树形列表 | |||
* | |||
* @return 部门 | |||
*/ | |||
@Override | |||
public JsonResult getListTreeByDeptId(String deptId) { | |||
return queryListTreeByDeptIdService.getListTree(deptId); | |||
} | |||
/** | |||
* 根据id查询子部门列表 | |||
* | |||
* @return 部门 | |||
*/ | |||
@Override | |||
public JsonResult getChildList(String id) { | |||
return queryChildListService.getChildList(id); | |||
} | |||
/** | |||
* 查询部门 | |||
* | |||
* @param id 部门主键 | |||
* @return 部门 | |||
*/ | |||
@Override | |||
public JsonResult getDeptInfo(String id) { | |||
return queryDeptInfoService.getDeptInfo(id); | |||
} | |||
/** | |||
* 新增部门 | |||
* | |||
* @param addDeptRequest 新增部门对象 | |||
* @return 结果 | |||
*/ | |||
@Override | |||
public JsonResult insert(AddDeptRequest addDeptRequest) { | |||
return addDeptService.add(addDeptRequest); | |||
} | |||
/** | |||
* 修改部门 | |||
* | |||
* @param oldEditDeptRequest 原部门对象 | |||
* @param newEditDeptRequest 新部门对象 | |||
* @return 结果 | |||
*/ | |||
@Override | |||
public JsonResult update(EditDeptRequest oldEditDeptRequest, EditDeptRequest newEditDeptRequest) { | |||
return updateDeptService.update(oldEditDeptRequest, newEditDeptRequest); | |||
} | |||
/** | |||
* 删除部门信息 | |||
* | |||
* @param id 部门主键 | |||
* @return 结果 | |||
*/ | |||
@Override | |||
public JsonResult deleteById(String id) { | |||
return deleteDeptService.deleteById(id); | |||
} | |||
} | |||
package com.tuoheng.admin.service.dept; | |||
import com.tuoheng.admin.mapper.DeptMapper; | |||
import com.tuoheng.admin.request.dept.AddDeptRequest; | |||
import com.tuoheng.admin.request.dept.EditDeptRequest; | |||
import com.tuoheng.admin.service.dept.add.AddDeptService; | |||
import com.tuoheng.admin.service.dept.delete.DeleteDeptService; | |||
import com.tuoheng.admin.service.dept.query.QueryChildListService; | |||
import com.tuoheng.admin.service.dept.query.QueryDeptInfoService; | |||
import com.tuoheng.admin.service.dept.query.QueryListTreeByDeptIdService; | |||
import com.tuoheng.admin.service.dept.query.QueryListTreeService; | |||
import com.tuoheng.admin.service.dept.update.UpdateDeptService; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
/** | |||
* 部门业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-11-16 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class DeptServiceImpl implements IDeptService { | |||
@Autowired | |||
private DeptMapper deptMapper; | |||
@Autowired | |||
private QueryListTreeService queryListTreeService; | |||
@Autowired | |||
private QueryListTreeByDeptIdService queryListTreeByDeptIdService; | |||
@Autowired | |||
private QueryChildListService queryChildListService; | |||
@Autowired | |||
private QueryDeptInfoService queryDeptInfoService; | |||
@Autowired | |||
private AddDeptService addDeptService; | |||
@Autowired | |||
private UpdateDeptService updateDeptService; | |||
@Autowired | |||
private DeleteDeptService deleteDeptService; | |||
/** | |||
* 查询部门树形列表 | |||
* | |||
* @return 部门 | |||
*/ | |||
@Override | |||
public JsonResult getListTree() { | |||
return queryListTreeService.getListTree(); | |||
} | |||
/** | |||
* 查询当前部门树形列表 | |||
* | |||
* @return 部门 | |||
*/ | |||
@Override | |||
public JsonResult getListTreeByDeptId(String deptId) { | |||
return queryListTreeByDeptIdService.getListTree(deptId); | |||
} | |||
/** | |||
* 根据id查询子部门列表 | |||
* | |||
* @return 部门 | |||
*/ | |||
@Override | |||
public JsonResult getChildList(String id) { | |||
return queryChildListService.getChildList(id); | |||
} | |||
/** | |||
* 查询部门 | |||
* | |||
* @param id 部门主键 | |||
* @return 部门 | |||
*/ | |||
@Override | |||
public JsonResult getDeptInfo(String id) { | |||
return queryDeptInfoService.getDeptInfo(id); | |||
} | |||
/** | |||
* 新增部门 | |||
* | |||
* @param addDeptRequest 新增部门对象 | |||
* @return 结果 | |||
*/ | |||
@Override | |||
public JsonResult insert(AddDeptRequest addDeptRequest) { | |||
return addDeptService.add(addDeptRequest); | |||
} | |||
/** | |||
* 修改部门 | |||
* | |||
* @param oldEditDeptRequest 原部门对象 | |||
* @param newEditDeptRequest 新部门对象 | |||
* @return 结果 | |||
*/ | |||
@Override | |||
public JsonResult update(EditDeptRequest oldEditDeptRequest, EditDeptRequest newEditDeptRequest) { | |||
return updateDeptService.update(oldEditDeptRequest, newEditDeptRequest); | |||
} | |||
/** | |||
* 删除部门信息 | |||
* | |||
* @param id 部门主键 | |||
* @return 结果 | |||
*/ | |||
@Override | |||
public JsonResult deleteById(String id) { | |||
return deleteDeptService.deleteById(id); | |||
} | |||
} |
@@ -1,75 +1,71 @@ | |||
package com.tuoheng.admin.service.dept; | |||
import com.tuoheng.admin.entity.Dept; | |||
import com.tuoheng.admin.request.dept.AddDeptRequest; | |||
import com.tuoheng.admin.request.dept.EditDeptRequest; | |||
import com.tuoheng.admin.request.dept.QueryDeptChildPageListRequest; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import java.util.List; | |||
/** | |||
* 部门Service接口 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-11-16 | |||
*/ | |||
public interface IDeptService { | |||
/** | |||
* 查询部门 | |||
* | |||
* @param id 部门主键 | |||
* @return 部门 | |||
*/ | |||
JsonResult getDeptInfo(String id); | |||
/** | |||
* 查询部门树形列表 | |||
* | |||
* @return 部门集合 | |||
*/ | |||
JsonResult getListTree(); | |||
/** | |||
* 查询当前部门树形列表 | |||
* | |||
* @return 部门集合 | |||
*/ | |||
JsonResult getListTreeByDeptId(String deptId); | |||
/** | |||
* 根据id查询子部门列表 | |||
* | |||
* @return 部门集合 | |||
*/ | |||
JsonResult getChildList(String id); | |||
/** | |||
* 新增部门 | |||
* | |||
* @param addDeptRequest 新增部门对象 | |||
* @return 结果 | |||
*/ | |||
JsonResult insert(AddDeptRequest addDeptRequest); | |||
/** | |||
* 修改部门 | |||
* | |||
* @param oldEditDeptRequest 原部门对象 | |||
* @param newEditDeptRequest 新部门对象 | |||
* @return 结果 | |||
*/ | |||
JsonResult update(EditDeptRequest oldEditDeptRequest, EditDeptRequest newEditDeptRequest); | |||
/** | |||
* 删除部门信息 | |||
* | |||
* @param id 部门主键 | |||
* @return 结果 | |||
*/ | |||
JsonResult deleteById(String id); | |||
} | |||
package com.tuoheng.admin.service.dept; | |||
import com.tuoheng.admin.request.dept.AddDeptRequest; | |||
import com.tuoheng.admin.request.dept.EditDeptRequest; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
/** | |||
* 部门Service接口 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-11-16 | |||
*/ | |||
public interface IDeptService { | |||
/** | |||
* 查询部门 | |||
* | |||
* @param id 部门主键 | |||
* @return 部门 | |||
*/ | |||
JsonResult getDeptInfo(String id); | |||
/** | |||
* 查询部门树形列表 | |||
* | |||
* @return 部门集合 | |||
*/ | |||
JsonResult getListTree(); | |||
/** | |||
* 查询当前部门树形列表 | |||
* | |||
* @return 部门集合 | |||
*/ | |||
JsonResult getListTreeByDeptId(String deptId); | |||
/** | |||
* 根据id查询子部门列表 | |||
* | |||
* @return 部门集合 | |||
*/ | |||
JsonResult getChildList(String id); | |||
/** | |||
* 新增部门 | |||
* | |||
* @param addDeptRequest 新增部门对象 | |||
* @return 结果 | |||
*/ | |||
JsonResult insert(AddDeptRequest addDeptRequest); | |||
/** | |||
* 修改部门 | |||
* | |||
* @param oldEditDeptRequest 原部门对象 | |||
* @param newEditDeptRequest 新部门对象 | |||
* @return 结果 | |||
*/ | |||
JsonResult update(EditDeptRequest oldEditDeptRequest, EditDeptRequest newEditDeptRequest); | |||
/** | |||
* 删除部门信息 | |||
* | |||
* @param id 部门主键 | |||
* @return 结果 | |||
*/ | |||
JsonResult deleteById(String id); | |||
} |
@@ -108,23 +108,6 @@ public class GenerateReportService { | |||
report.setInspectionName(inspection.getName()); | |||
report.setCreateUser(userId); | |||
report.setCreateTime(DateUtils.now()); | |||
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(Wrappers.<InspectionFile>lambdaQuery() | |||
.eq(InspectionFile::getInspectionId, inspection.getId()) | |||
.in(InspectionFile::getStatus, GetInspectionFileStatusList.getStatusList()) | |||
.eq(InspectionFile::getMark, 1)); | |||
List<String> inspectionFileIdList = null; | |||
if (!CollectionUtil.isEmpty(inspectionFileList)) { | |||
report.setProblemTotalCount(inspectionFileList.size()); | |||
inspectionFileIdList = inspectionFileList.stream().map(o -> o.getId()).collect(Collectors.toList()); | |||
} | |||
if (!CollectionUtil.isEmpty(inspectionFileIdList)) { | |||
List<InspectionFileHandle> inspectionFileHandleList = inspectionFileHandleMapper.selectList(Wrappers.<InspectionFileHandle>lambdaQuery() | |||
.in(InspectionFileHandle::getInspectionFileId, inspectionFileIdList) | |||
.eq(InspectionFileHandle::getMark, 1)); | |||
if (!CollectionUtil.isEmpty(inspectionFileHandleList)) { | |||
report.setProblemHandleCount(inspectionFileHandleList.size()); | |||
} | |||
} | |||
return report; | |||
} | |||
@@ -1,15 +1,16 @@ | |||
package com.tuoheng.admin.service.report.query; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.conver.ReportConverMapper; | |||
import com.tuoheng.admin.entity.Dept; | |||
import com.tuoheng.admin.entity.InspectionFile; | |||
import com.tuoheng.admin.entity.InspectionFileHandle; | |||
import com.tuoheng.admin.entity.Report; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.mapper.DeptMapper; | |||
import com.tuoheng.admin.mapper.ReportMapper; | |||
import com.tuoheng.admin.mapper.UserMapper; | |||
import com.tuoheng.admin.enums.MarkTypeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.request.report.QueryReportPageListRequest; | |||
import com.tuoheng.admin.utils.CurrentUserUtil; | |||
import com.tuoheng.admin.vo.ReportPageListVo; | |||
@@ -19,6 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.List; | |||
import java.util.stream.Collectors; | |||
/** | |||
* 查询报告分页列表业务层处理 | |||
@@ -40,10 +42,15 @@ public class QueryReportPageListService { | |||
@Autowired | |||
private ReportMapper reportMapper; | |||
@Autowired | |||
private InspectionFileMapper inspectionFileMapper; | |||
@Autowired | |||
private InspectionFileHandleMapper inspectionFileHandleMapper; | |||
/** | |||
* | |||
* 查询报告分页列表 | |||
* 用户只能查看自己生成的报告 | |||
* 用户只能查看自己生成的报告 | |||
* | |||
* @param request | |||
* @return | |||
@@ -114,6 +121,25 @@ public class QueryReportPageListService { | |||
*/ | |||
private List<ReportPageListVo> buildReportPageListVoList(List<Report> reportList) { | |||
List<ReportPageListVo> reportPageListVoList = ReportConverMapper.INSTANCE.fromReportListToReportPageListList(reportList); | |||
for (ReportPageListVo reportPageListVo : reportPageListVoList) { | |||
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectList(Wrappers.<InspectionFile>lambdaQuery() | |||
.eq(InspectionFile::getInspectionId, reportPageListVo.getInspectionId()) | |||
.in(InspectionFile::getStatus, GetInspectionFileStatusList.getStatusList()) | |||
.eq(InspectionFile::getMark, MarkTypeEnum.VALID.getCode())); | |||
List<String> inspectionFileIdList = null; | |||
if (!CollectionUtil.isEmpty(inspectionFileList)) { | |||
reportPageListVo.setProblemTotalCount(inspectionFileList.size()); | |||
inspectionFileIdList = inspectionFileList.stream().map(o -> o.getId()).collect(Collectors.toList()); | |||
} | |||
if (!CollectionUtil.isEmpty(inspectionFileIdList)) { | |||
List<InspectionFileHandle> inspectionFileHandleList = inspectionFileHandleMapper.selectList(Wrappers.<InspectionFileHandle>lambdaQuery() | |||
.in(InspectionFileHandle::getInspectionFileId, inspectionFileIdList) | |||
.eq(InspectionFileHandle::getMark, MarkTypeEnum.VALID.getCode())); | |||
if (!CollectionUtil.isEmpty(inspectionFileHandleList)) { | |||
reportPageListVo.setProblemHandleCount(inspectionFileHandleList.size()); | |||
} | |||
} | |||
} | |||
return reportPageListVoList; | |||
} | |||
} |
@@ -120,11 +120,13 @@ public class RoadInformationServiceImpl extends BaseServiceImpl<RoadInformationM | |||
} | |||
if (StringUtils.isEmpty(entity.getId())) { | |||
//新增 | |||
if (this.getInformationListByCode(entity)) return JsonResult.error("公路代号存在不能重复"); | |||
entity.setCreateUser(userId); | |||
entity.setCreateTime(DateUtils.now()); | |||
entity.setTenantId(CurrentUserUtil.getTenantId()); | |||
} else { | |||
//更新 | |||
if (this.getInformationListByCode(entity)) return JsonResult.error("公路代号存在不能重复"); | |||
entity.setUpdateUser(userId); | |||
entity.setUpdateTime(DateUtils.now()); | |||
entity.setTenantId(CurrentUserUtil.getTenantId()); | |||
@@ -133,6 +135,21 @@ public class RoadInformationServiceImpl extends BaseServiceImpl<RoadInformationM | |||
return JsonResult.success(); | |||
} | |||
//查询数据库中当前租户对应的公路列表 | |||
private boolean getInformationListByCode(RoadInformation entity) { | |||
List<RoadInformation> roadInformationList = roadInformationMapper.selectList(new LambdaQueryWrapper<RoadInformation>() | |||
.eq(RoadInformation::getTenantId, CurrentUserUtil.getTenantId()) | |||
.eq(RoadInformation::getMark, 1) | |||
.eq(RoadInformation::getCode,entity.getCode())); | |||
if(CollectionUtil.isNotEmpty(roadInformationList)){ | |||
for (RoadInformation roadInformation : roadInformationList) { | |||
if(entity.getCode().equals(roadInformation.getCode())){ | |||
return true; | |||
} | |||
} | |||
} | |||
return false; | |||
} | |||
/** | |||
* 根据登录人角色获取该部门下公路信息列表 |
@@ -21,6 +21,11 @@ public class ReportPageListVo { | |||
*/ | |||
private String id; | |||
/** | |||
* 任务ID | |||
*/ | |||
private String inspectionId; | |||
/** | |||
* 任务编号 | |||
*/ | |||
@@ -59,4 +64,5 @@ public class ReportPageListVo { | |||
* 问题处理数 | |||
*/ | |||
private Integer problemHandleCount; | |||
} |
@@ -56,8 +56,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
<result property="endLatitude" column="end_latitude" /> | |||
<result property="mobile" column="mobile" /> | |||
<result property="patrolLocation" column="patrol_location" /> | |||
<result property="problemTotalCount" column="problem_total_count" /> | |||
<result property="problemHandleCount" column="problem_handle_count" /> | |||
<result property="createUser" column="create_user" /> | |||
<result property="createTime" column="create_time" /> | |||
<result property="updateUser" column="update_user" /> | |||
@@ -66,7 +64,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
</resultMap> | |||
<sql id="selectReportVo"> | |||
select id, tenant_id, dept_id, report_code, inspection_id, inspection_code, inspection_name, type, road_id, road_name, section_id, section_name, inspection_type, airport_id, airport_name, inspection_line, inspection_line_name, equipment_id, equipment_name, equipment_mount_id, equipment_mount_name, cloud_box_id, cloud_box_name, box_sn, flight_hand, flight_hand_name, inspection_time, execution_start_time, execution_end_time, is_live, is_taken, is_tilt, video_url, ai_video_url, report_url, srt_url, status, analyse_status, progressbar, note, weather, fly_height, srt_name, heartbeat_time, execution_status, start_longitude, start_latitude, end_longitude, end_latitude, mobile, patrol_location, problem_total_count, problem_handle_count, create_user, create_time, update_user, update_time, mark from th_report | |||
select id, tenant_id, dept_id, report_code, inspection_id, inspection_code, inspection_name, type, road_id, road_name, section_id, section_name, inspection_type, airport_id, airport_name, inspection_line, inspection_line_name, equipment_id, equipment_name, equipment_mount_id, equipment_mount_name, cloud_box_id, cloud_box_name, box_sn, flight_hand, flight_hand_name, inspection_time, execution_start_time, execution_end_time, is_live, is_taken, is_tilt, video_url, ai_video_url, report_url, srt_url, status, analyse_status, progressbar, note, weather, fly_height, srt_name, heartbeat_time, execution_status, start_longitude, start_latitude, end_longitude, end_latitude, mobile, patrol_location, create_user, create_time, update_user, update_time, mark from th_report | |||
</sql> | |||
<select id="selectPageList" parameterType="com.tuoheng.admin.request.report.QueryReportPageListRequest" resultMap="ReportResult"> |