package com.tuoheng.admin.controller; | package com.tuoheng.admin.controller; | ||||
import com.alibaba.fastjson.JSON; | |||||
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.airport.AirportService; | import com.tuoheng.admin.service.airport.AirportService; | ||||
import com.tuoheng.admin.service.dept.IDeptService; | |||||
import com.tuoheng.admin.vo.AirLineVO; | |||||
import com.tuoheng.admin.vo.AirPortVO; | |||||
import com.tuoheng.common.core.utils.JsonResult; | import com.tuoheng.common.core.utils.JsonResult; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||
import java.util.List; | |||||
import java.util.Map; | |||||
/** | /** | ||||
* 机场前端控制器 | * 机场前端控制器 | ||||
* | * | ||||
@Slf4j | @Slf4j | ||||
@RestController | @RestController | ||||
@RequestMapping("/airport") | @RequestMapping("/airport") | ||||
public class AirportController { | |||||
public class AirPortController { | |||||
@Autowired | @Autowired | ||||
AirportService airportService; | |||||
private AirportService airportService; | |||||
/** | /** | ||||
* 获取巡检机场 | * 获取巡检机场 | ||||
*/ | */ | ||||
@GetMapping("/airport") | |||||
public JsonResult getAirportList() { | |||||
@GetMapping("/list") | |||||
public JsonResult getList() { | |||||
return airportService.getAirportList(); | return airportService.getAirportList(); | ||||
} | } | ||||
/** | /** | ||||
* 获取巡检线路 | * 获取巡检线路 | ||||
* | |||||
* @param droneId 机场列表里面的droneId | * @param droneId 机场列表里面的droneId | ||||
* @return | * @return | ||||
*/ | */ | ||||
@GetMapping("/airport/line/{droneId}") | |||||
@GetMapping("/line/{droneId}") | |||||
public JsonResult getAirLineList(@PathVariable("droneId") Integer droneId) { | public JsonResult getAirLineList(@PathVariable("droneId") Integer droneId) { | ||||
return airportService.getAirLineList(droneId); | return airportService.getAirLineList(droneId); | ||||
} | } |
/** | /** | ||||
* 新增部门 | * 新增部门 | ||||
*/ | */ | ||||
@PostMapping | |||||
@PostMapping("/add") | |||||
public JsonResult add(@RequestBody AddDeptRequest addDeptRequest) { | public JsonResult add(@RequestBody AddDeptRequest addDeptRequest) { | ||||
log.info("进入新增部门接口"); | log.info("进入新增部门接口"); | ||||
return deptService.insert(addDeptRequest); | return deptService.insert(addDeptRequest); | ||||
/** | /** | ||||
* 修改部门 | * 修改部门 | ||||
*/ | */ | ||||
@PutMapping | |||||
@PutMapping("/edit") | |||||
public JsonResult update(@RequestBody Map<String, Object> param) { | public JsonResult update(@RequestBody Map<String, Object> param) { | ||||
log.info("进入修改部门接口"); | log.info("进入修改部门接口"); | ||||
EditDeptRequest oldEditDeptRequest = JSON.parseObject(JSON.toJSONString(param.get("oldEditDeptRequest")), EditDeptRequest.class); | EditDeptRequest oldEditDeptRequest = JSON.parseObject(JSON.toJSONString(param.get("oldEditDeptRequest")), EditDeptRequest.class); | ||||
/** | /** | ||||
* 删除部门 | * 删除部门 | ||||
*/ | */ | ||||
@DeleteMapping("/{id}") | |||||
public JsonResult delete(@PathVariable String id) { | |||||
@DeleteMapping("/delete/{id}") | |||||
public JsonResult delete(@PathVariable("id") String id) { | |||||
log.info("进入删除部门接口"); | log.info("进入删除部门接口"); | ||||
return deptService.deleteById(id); | return deptService.deleteById(id); | ||||
} | } |
package com.tuoheng.admin.controller; | package com.tuoheng.admin.controller; | ||||
import com.tuoheng.admin.entity.Inspection; | import com.tuoheng.admin.entity.Inspection; | ||||
import com.tuoheng.admin.request.inspection.AddInspectionRequest; | |||||
import com.tuoheng.admin.request.inspection.EditInspectionRequest; | |||||
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | ||||
import com.tuoheng.admin.service.inspection.IInspectionService; | import com.tuoheng.admin.service.inspection.IInspectionService; | ||||
import com.tuoheng.common.core.utils.JsonResult; | import com.tuoheng.common.core.utils.JsonResult; | ||||
*/ | */ | ||||
@GetMapping(value = "/{id}") | @GetMapping(value = "/{id}") | ||||
public JsonResult getInfo(QueryInspectionPageListRequest request) { | public JsonResult getInfo(QueryInspectionPageListRequest request) { | ||||
log.info("进入查询任务详情接口"); | |||||
return iInspectionService.selectOneById(request); | return iInspectionService.selectOneById(request); | ||||
} | } | ||||
* 新增巡检任务 | * 新增巡检任务 | ||||
*/ | */ | ||||
@PostMapping | @PostMapping | ||||
public JsonResult add(@RequestBody Inspection inspection) { | |||||
return iInspectionService.insert(inspection); | |||||
public JsonResult add(@RequestBody AddInspectionRequest addInspectionRequest) { | |||||
log.info("进入添加任务接口"); | |||||
return iInspectionService.insert(addInspectionRequest); | |||||
} | } | ||||
/** | /** | ||||
* 修改巡检任务 | * 修改巡检任务 | ||||
*/ | */ | ||||
@PutMapping | @PutMapping | ||||
public JsonResult edit(@RequestBody Inspection inspection) { | |||||
return iInspectionService.update(inspection); | |||||
public JsonResult edit(@RequestBody EditInspectionRequest editInspectionRequest) { | |||||
log.info("进入修改任务接口"); | |||||
return iInspectionService.update(editInspectionRequest); | |||||
} | } | ||||
/** | /** | ||||
* 删除巡检任务 | * 删除巡检任务 | ||||
*/ | */ | ||||
@DeleteMapping("/{ids}") | |||||
public JsonResult delete(@PathVariable String[] ids) { | |||||
return iInspectionService.deleteByIds(ids); | |||||
@DeleteMapping("/{id}") | |||||
public JsonResult delete(@PathVariable("id") String id) { | |||||
log.info("进入删除任务接口"); | |||||
return iInspectionService.deleteById(id); | |||||
} | } | ||||
} | } |
return sectionService.getListByDeptId(deptId); | return sectionService.getListByDeptId(deptId); | ||||
} | } | ||||
/** | |||||
* 根据公路id获取该公路下路段信息列表 | |||||
* @param roadId | |||||
* @return | |||||
*/ | |||||
@GetMapping("/list/by/road/{roadId}") | |||||
public JsonResult getListByRoadId(@PathVariable("roadId") String roadId) { | |||||
return sectionService.getListByRoadId(roadId); | |||||
} | |||||
/** | /** | ||||
* 根据id获取路段详情 | * 根据id获取路段详情 | ||||
* @param sectionId | * @param sectionId |
package com.tuoheng.admin.conver; | |||||
import com.tuoheng.admin.entity.Inspection; | |||||
import com.tuoheng.admin.request.inspection.AddInspectionRequest; | |||||
import com.tuoheng.admin.request.inspection.EditInspectionRequest; | |||||
import org.mapstruct.Mapper; | |||||
import org.mapstruct.factory.Mappers; | |||||
@Mapper | |||||
public interface InspectionConverMapper { | |||||
InspectionConverMapper INSTANCE = Mappers.getMapper(InspectionConverMapper.class); | |||||
Inspection fromAddInspectionRequestToInspection(AddInspectionRequest request); | |||||
Inspection fromEditInspectionRequestToInspection(EditInspectionRequest request); | |||||
} |
package com.tuoheng.admin.conver; | |||||
import com.tuoheng.admin.entity.Dept; | |||||
import com.tuoheng.admin.vo.DeptTreeVo; | |||||
import java.util.ArrayList; | |||||
import java.util.List; | |||||
public class Test { | |||||
public static void main(String[] args) { | |||||
List<Dept> deptList = new ArrayList<>(); | |||||
Dept dept1 = new Dept(); | |||||
dept1.setId("1001"); | |||||
dept1.setTenantId("1"); | |||||
dept1.setName("aaa"); | |||||
Dept dept2 = new Dept(); | |||||
dept2.setId("2002"); | |||||
dept2.setTenantId("1"); | |||||
dept2.setName("bbb"); | |||||
deptList.add(dept1); | |||||
deptList.add(dept2); | |||||
List<DeptTreeVo> deptTreeVoList = DeptConverMapper.INSTANCE.deptListToDeptVoList(deptList); | |||||
for (DeptTreeVo dv : deptTreeVoList) { | |||||
System.out.println(dv); | |||||
} | |||||
} | |||||
} |
import com.baomidou.mybatisplus.annotation.IdType; | import com.baomidou.mybatisplus.annotation.IdType; | ||||
import com.baomidou.mybatisplus.annotation.TableId; | import com.baomidou.mybatisplus.annotation.TableId; | ||||
import com.baomidou.mybatisplus.annotation.TableName; | |||||
import com.fasterxml.jackson.annotation.JsonFormat; | import com.fasterxml.jackson.annotation.JsonFormat; | ||||
import com.tuoheng.common.core.common.BaseEntity; | import com.tuoheng.common.core.common.BaseEntity; | ||||
import lombok.Data; | import lombok.Data; | ||||
import lombok.EqualsAndHashCode; | |||||
import lombok.experimental.Accessors; | |||||
import org.springframework.format.annotation.DateTimeFormat; | import org.springframework.format.annotation.DateTimeFormat; | ||||
import java.math.BigDecimal; | import java.math.BigDecimal; | ||||
* @date 2022-11-16 | * @date 2022-11-16 | ||||
*/ | */ | ||||
@Data | @Data | ||||
@EqualsAndHashCode(callSuper = true) | |||||
@Accessors(chain = true) | |||||
@TableName("th_inspection") | |||||
public class Inspection extends BaseEntity { | public class Inspection extends BaseEntity { | ||||
private static final long serialVersionUID = 1L; | private static final long serialVersionUID = 1L; | ||||
/** ID */ | |||||
@TableId(value = "id", type = IdType.AUTO) | |||||
private String id; | |||||
/** 租户ID */ | /** 租户ID */ | ||||
private String tenantId; | private String tenantId; | ||||
private Integer inspectionType; | private Integer inspectionType; | ||||
/** 巡检机场id */ | /** 巡检机场id */ | ||||
private Long airportId; | |||||
private Integer airportId; | |||||
/** 巡检机场名称 */ | /** 巡检机场名称 */ | ||||
private String airportName; | private String airportName; | ||||
/** 巡检线路id */ | /** 巡检线路id */ | ||||
private Long inspectionLine; | |||||
private Integer inspectionLine; | |||||
/** 巡检线路名称 */ | /** 巡检线路名称 */ | ||||
private String inspectionLineName; | private String inspectionLineName; | ||||
/** 巡逻地点 */ | /** 巡逻地点 */ | ||||
private String patrolLocation; | private String patrolLocation; | ||||
/** 创建人 */ | |||||
private String createUser; | |||||
/** 更新人 */ | |||||
private String updateUser; | |||||
/** 有效标记 */ | |||||
private Integer mark; | |||||
} | } |
package com.tuoheng.admin.entity; | |||||
import com.fasterxml.jackson.annotation.JsonFormat; | |||||
import com.tuoheng.common.core.common.BaseEntity; | |||||
import lombok.Data; | |||||
import java.math.BigDecimal; | |||||
import java.util.Date; | |||||
/** | |||||
* 巡检任务问题表 | |||||
* | |||||
* @team tuoheng | |||||
* @author wanjing | |||||
* @date 2022-11-23 | |||||
*/ | |||||
@Data | |||||
public class InspectionFile 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 Integer mark; | |||||
} |
package com.tuoheng.admin.entity; | |||||
import com.fasterxml.jackson.annotation.JsonFormat; | |||||
import com.tuoheng.common.core.common.BaseEntity; | |||||
import lombok.Data; | |||||
import java.util.Date; | |||||
/** | |||||
* 巡检问题处理结果对象 | |||||
* | |||||
* @team tuoheng | |||||
* @author wanjing | |||||
* @date 2022-11-23 | |||||
*/ | |||||
@Data | |||||
public class InspectionFileHandle extends BaseEntity { | |||||
private static final long serialVersionUID = 1L; | |||||
/** 租户ID */ | |||||
private String tenantId; | |||||
/** 巡检问题文件ID */ | |||||
private String inspectionFileId; | |||||
/** 处理人 */ | |||||
private String handlerUser; | |||||
/** 处理后图片(多个图片逗号“,”分隔) */ | |||||
private String handlerImage; | |||||
/** 处理结果 */ | |||||
private String handlerResult; | |||||
/** 处理完成时间 */ | |||||
@JsonFormat(pattern = "yyyy-MM-dd") | |||||
private Date handlerTime; | |||||
/** 创建人 */ | |||||
private String createUser; | |||||
/** 更新人 */ | |||||
private String updateUser; | |||||
/** 有效标记 */ | |||||
private Integer mark; | |||||
} |
package com.tuoheng.admin.enums; | |||||
import lombok.Getter; | |||||
/** | |||||
* 巡检方式类型 | |||||
* | |||||
* @author wanjing | |||||
* @team tuoheng | |||||
* @date 2022-11-23 | |||||
*/ | |||||
public enum InspectionWayEnum { | |||||
DRONE(1,"无人机"), | |||||
AIRPORT(2,"机场巡逻"), | |||||
MABNNEDFLIGHT(3,"飞手值飞"); | |||||
InspectionWayEnum(int code, String description){ | |||||
this.code = code; | |||||
this.description = description; | |||||
} | |||||
@Getter | |||||
private int code; | |||||
@Getter | |||||
private String description; | |||||
} |
package com.tuoheng.admin.enums; | |||||
package com.tuoheng.admin.enums.code; | |||||
public enum AriportCodeEnum { | public enum AriportCodeEnum { | ||||
package com.tuoheng.admin.enums.dept; | |||||
package com.tuoheng.admin.enums.code.dept; | |||||
/** | /** | ||||
* 添加部门信息返回码 | * 添加部门信息返回码 |
package com.tuoheng.admin.enums.dept; | |||||
package com.tuoheng.admin.enums.code.dept; | |||||
/** | /** | ||||
* 删除部门信息返回码 | * 删除部门信息返回码 | ||||
DELETE_DEPT_IS_FAILED(1200500, "删除部门失败"), | DELETE_DEPT_IS_FAILED(1200500, "删除部门失败"), | ||||
DEPT_ID_IS_NULL(1200501, "部门id为空"), | DEPT_ID_IS_NULL(1200501, "部门id为空"), | ||||
DEPT_IS_NOT_EXIST(1200502, "部门不存在"), | DEPT_IS_NOT_EXIST(1200502, "部门不存在"), | ||||
DEPT_IEXIST_USER(1200503, "该级部下存在用户"), | |||||
DEPT_IEXIST_CHILDREN_DEPT(1200504, "该级部下存在子部门"); | |||||
DEPT_IEXIST_USER(1200503, "该级部已绑定用户"), | |||||
DEPT_IEXIST_CHILDREN_DEPT(1200504, "该级部下有子部门"); | |||||
/** | /** | ||||
* 错误码 | * 错误码 |
package com.tuoheng.admin.enums.dept; | |||||
package com.tuoheng.admin.enums.code.dept; | |||||
/** | /** | ||||
* 修改部门信息返回码 | * 修改部门信息返回码 |
package com.tuoheng.admin.enums.dept; | |||||
package com.tuoheng.admin.enums.code.dept; | |||||
/** | /** | ||||
* 获取子部门列表返回码 | * 获取子部门列表返回码 |
package com.tuoheng.admin.enums.dept; | |||||
package com.tuoheng.admin.enums.code.dept; | |||||
/** | /** | ||||
* 获取部门信息返回码 | * 获取部门信息返回码 |
package com.tuoheng.admin.enums.dept; | |||||
package com.tuoheng.admin.enums.code.dept; | |||||
/** | /** | ||||
* 获取部门列表返回码 | * 获取部门列表返回码 |
package com.tuoheng.admin.enums.code.inspection; | |||||
/** | |||||
* 添加任务信息返回码 | |||||
* 模块代码:23(任务管理) | |||||
* 接口代码:01 (添加任务) | |||||
* | |||||
* @author wanjing | |||||
* @team tuoheng | |||||
* @date 2022-11-24 | |||||
*/ | |||||
public enum AddInspectionCodeEnum { | |||||
ADD_DEPT_IS_FAILED(1230100, "添加任务失败"), | |||||
NAME_IS_NULL(1230101, "任务名为空"), | |||||
TYPE_IS_NULL(1230102, "任务类型为空"), | |||||
ROAD_IS_NULL(1230103, "任务地点为空"), | |||||
SECTION_IS_NULL(1230104, "路段信息为空"), | |||||
INSPECTION_TYPE_IS_NULL(1230105, "巡检方式为空"), | |||||
AIRPORT_IS_NULL(1230106, "巡检机场为空"), | |||||
INSPECTION_LINE_IS_NULL(1230107, "巡检路线为空"), | |||||
INSPECTION_TIME_IS_NULL(1230108, "巡检时间为空"), | |||||
ROAD_IS_NOT_EXIST(1230109, "公路不存在"), | |||||
SECTION_IS_NOT_EXIST(1230110, "路段不存在"); | |||||
/** | |||||
* 错误码 | |||||
*/ | |||||
private int code; | |||||
/** | |||||
* 错误信息 | |||||
*/ | |||||
private String msg; | |||||
AddInspectionCodeEnum(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; | |||||
} | |||||
} |
package com.tuoheng.admin.enums.code.inspection; | |||||
/** | |||||
* 删除任务信息返回码 | |||||
* 模块代码:23(任务管理) | |||||
* 接口代码:02 (删除任务) | |||||
* | |||||
* @author wanjing | |||||
* @team tuoheng | |||||
* @date 2022-11-24 | |||||
*/ | |||||
public enum DeleteInspectionCodeEnum { | |||||
DELETE_IS_FAILED(1230200, "删除任务失败"), | |||||
ID_IS_NULL(1230201, "任务ID为空"), | |||||
INSPECTION_IS_NOT_EXIST(1230202, "任务不存在"); | |||||
/** | |||||
* 错误码 | |||||
*/ | |||||
private int code; | |||||
/** | |||||
* 错误信息 | |||||
*/ | |||||
private String msg; | |||||
DeleteInspectionCodeEnum(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; | |||||
} | |||||
} |
package com.tuoheng.admin.enums.code.inspection; | |||||
/** | |||||
* 修改任务信息返回码 | |||||
* 模块代码:23(任务管理) | |||||
* 接口代码:03 (修改任务) | |||||
* | |||||
* @author wanjing | |||||
* @team tuoheng | |||||
* @date 2022-11-24 | |||||
*/ | |||||
public enum EditInspectionCodeEnum { | |||||
ADD_DEPT_IS_FAILED(1230300, "修改任务失败"), | |||||
ID_IS_NULL(1230301, "任务ID为空"), | |||||
NAME_IS_NULL(1230302, "任务名为空"), | |||||
TYPE_IS_NULL(1230303, "任务类型为空"), | |||||
ROAD_IS_NULL(1230304, "任务地点为空"), | |||||
SECTION_IS_NULL(1230305, "路段信息为空"), | |||||
INSPECTION_TYPE_IS_NULL(1230306, "巡检方式为空"), | |||||
AIRPORT_IS_NULL(1230307, "巡检机场为空"), | |||||
INSPECTION_LINE_IS_NULL(1230308, "巡检路线为空"), | |||||
INSPECTION_TIME_IS_NULL(1230309, "巡检时间为空"), | |||||
ROAD_IS_NOT_EXIST(1230310, "公路不存在"), | |||||
SECTION_IS_NOT_EXIST(1230311, "路段不存在"); | |||||
/** | |||||
* 错误码 | |||||
*/ | |||||
private int code; | |||||
/** | |||||
* 错误信息 | |||||
*/ | |||||
private String msg; | |||||
EditInspectionCodeEnum(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; | |||||
} | |||||
} |
package com.tuoheng.admin.enums.code.inspection; | |||||
/** | |||||
* 查询巡检任务分页列表返回码 | |||||
* 模块代码:23(公路管理) | |||||
* 接口代码:04 (根据部门id获取该部门下公路列表) | |||||
* | |||||
* @author wanjing | |||||
* @team tuoheng | |||||
* @date 2022-11-24 | |||||
*/ | |||||
public enum QueryInspectionPageListCodeEnum { | |||||
QUERY_IS_FAILED(1230400, "获取数据失败"), | |||||
DEPT_ID_IS_NULL(1230401, "部门id为空"), | |||||
DEPT_IS_NOT_EXIST(1230402, "部门不存在"); | |||||
/** | |||||
* 错误码 | |||||
*/ | |||||
private int code; | |||||
/** | |||||
* 错误信息 | |||||
*/ | |||||
private String msg; | |||||
QueryInspectionPageListCodeEnum(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; | |||||
} | |||||
} |
package com.tuoheng.admin.enums.road; | |||||
package com.tuoheng.admin.enums.code.road; | |||||
/** | /** | ||||
* 根据部门id获取该部门下公路列表返回码 | * 根据部门id获取该部门下公路列表返回码 |
package com.tuoheng.admin.enums.section; | |||||
package com.tuoheng.admin.enums.code.section; | |||||
/** | /** | ||||
* 根据部门id获取该部门下公路列表返回码 | * 根据部门id获取该部门下公路列表返回码 | ||||
public enum QuerySectionListByDeptIdCodeEnum { | public enum QuerySectionListByDeptIdCodeEnum { | ||||
QUERY_IS_FAILED(1220300, "获取数据失败"), | QUERY_IS_FAILED(1220300, "获取数据失败"), | ||||
DEPT_ID_IS_NULL(1220201, "部门id为空"), | |||||
DEPT_IS_NOT_EXIST(1220202, "部门不存在"), | |||||
SECTION_LIST_IS_NULL(1220203, "路段列表为空");; | |||||
DEPT_ID_IS_NULL(1220301, "部门id为空"), | |||||
DEPT_IS_NOT_EXIST(1220302, "部门不存在"), | |||||
SECTION_LIST_IS_NULL(1220303, "路段列表为空"); | |||||
/** | /** | ||||
* 错误码 | * 错误码 |
package com.tuoheng.admin.enums.code.section; | |||||
/** | |||||
* 根据公路id获取该公路下公路列表返回码 | |||||
* 模块代码:22(路段管理) | |||||
* 接口代码:04 (根据公路d获取该公路下公路列表) | |||||
* | |||||
* @author wanjing | |||||
* @team tuoheng | |||||
* @date 2022-11-24 | |||||
*/ | |||||
public enum QuerySectionListByRoadIdCodeEnum { | |||||
QUERY_IS_FAILED(1220400, "获取数据失败"), | |||||
ROAD_ID_IS_NULL(1220401, "公路id为空"), | |||||
ROAD_IS_NOT_EXIST(1220402, "公路不存在"), | |||||
SECTION_LIST_IS_NULL(1220403, "路段列表为空"); | |||||
/** | |||||
* 错误码 | |||||
*/ | |||||
private int code; | |||||
/** | |||||
* 错误信息 | |||||
*/ | |||||
private String msg; | |||||
QuerySectionListByRoadIdCodeEnum(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; | |||||
} | |||||
} |
/** | /** | ||||
* 删除部门 | * 删除部门 | ||||
* | * | ||||
* @param dept 部门 | |||||
* @param id 部门 | |||||
* @return 结果 | * @return 结果 | ||||
*/ | */ | ||||
int deleteById(Dept dept); | |||||
int deleteById(String id); | |||||
} | } |
package com.tuoheng.admin.mapper; | |||||
/** | |||||
* 巡检问题处理结果Mapper接口 | |||||
* | |||||
* @team tuoheng | |||||
* @author wanjing | |||||
* @date 2022-11-23 | |||||
*/ | |||||
public interface InspectionFileHandleMapper { | |||||
} |
package com.tuoheng.admin.mapper; | |||||
/** | |||||
* 【请填写功能名称】Mapper接口 | |||||
* | |||||
* @team tuoheng | |||||
* @author wanjing | |||||
* @date 2022-11-23 | |||||
*/ | |||||
public interface InspectionFileMapper { | |||||
} |
package com.tuoheng.admin.mapper; | package com.tuoheng.admin.mapper; | ||||
import java.util.List; | |||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||||
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.entity.Inspection; | import com.tuoheng.admin.entity.Inspection; | ||||
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | ||||
import org.apache.ibatis.annotations.Param; | import org.apache.ibatis.annotations.Param; | ||||
import java.util.List; | |||||
/** | /** | ||||
* 巡检任务Mapper接口 | * 巡检任务Mapper接口 | ||||
* | * | ||||
* @author wanjing | * @author wanjing | ||||
* @date 2022-11-16 | * @date 2022-11-16 | ||||
*/ | */ | ||||
public interface InspectionMapper { | |||||
/** | |||||
* 查询巡检任务 | |||||
* | |||||
* @param request 巡检任务查询实体 | |||||
* @return 巡检任务 | |||||
*/ | |||||
public interface InspectionMapper extends BaseMapper<Inspection> { | |||||
/** | |||||
* 查询巡检任务 | |||||
* | |||||
* @param request 巡检任务查询实体 | |||||
* @return 巡检任务 | |||||
*/ | |||||
Inspection selectOneById(QueryInspectionPageListRequest request); | Inspection selectOneById(QueryInspectionPageListRequest request); | ||||
/** | /** | ||||
* @param request 巡检任务查询实体 | * @param request 巡检任务查询实体 | ||||
* @return 巡检任务集合 | * @return 巡检任务集合 | ||||
*/ | */ | ||||
Page<Inspection> selectPageList(@Param("page") Page<Inspection> page, @Param("request") QueryInspectionPageListRequest request); | |||||
Page<Inspection> selectPageList(@Param("page") IPage page, @Param("request") QueryInspectionPageListRequest request); | |||||
/** | /** | ||||
* 查询巡检任务列表 | * 查询巡检任务列表 | ||||
*/ | */ | ||||
List<Inspection> selectList(QueryInspectionPageListRequest request); | List<Inspection> selectList(QueryInspectionPageListRequest request); | ||||
/** | |||||
* 新增巡检任务 | |||||
* | |||||
* @param inspection 巡检任务 | |||||
* @return 结果 | |||||
*/ | |||||
int insert(Inspection inspection); | |||||
/** | /** | ||||
* 修改巡检任务 | * 修改巡检任务 | ||||
* | |||||
* | |||||
* @param inspection 巡检任务 | * @param inspection 巡检任务 | ||||
* @return 结果 | * @return 结果 | ||||
*/ | */ | ||||
*/ | */ | ||||
int deleteById(String id); | int deleteById(String id); | ||||
/** | |||||
* 批量删除巡检任务 | |||||
* | |||||
* @param ids 需要删除的数据主键集合 | |||||
* @return 结果 | |||||
*/ | |||||
int deleteByIds(String[] ids); | |||||
} | } |
package com.tuoheng.admin.request.inspection; | |||||
import com.fasterxml.jackson.annotation.JsonFormat; | |||||
import com.tuoheng.common.core.common.BaseQuery; | |||||
import lombok.Data; | |||||
import org.springframework.format.annotation.DateTimeFormat; | |||||
import javax.validation.constraints.NotNull; | |||||
import java.util.Date; | |||||
/** | |||||
* 新增任务请求参数 | |||||
* | |||||
* @author wanjing | |||||
* @team tuoheng | |||||
* @date 2022-11-24 | |||||
*/ | |||||
@Data | |||||
public class AddInspectionRequest { | |||||
/** | |||||
* 用户ID | |||||
*/ | |||||
private String userId; | |||||
/** | |||||
* 租户id | |||||
*/ | |||||
private String tenantId; | |||||
/** | |||||
* 任务编号 | |||||
*/ | |||||
private String code; | |||||
/** | |||||
* 任务名称 | |||||
*/ | |||||
private String name; | |||||
/** | |||||
* 巡检机场id | |||||
*/ | |||||
private Integer airportId; | |||||
/** | |||||
* 巡检机场名称 | |||||
*/ | |||||
private String airportName; | |||||
/** | |||||
* 巡检线路Id | |||||
*/ | |||||
private Integer inspectionLine; | |||||
/** | |||||
* 巡检线路名称 | |||||
*/ | |||||
private String inspectionLineName; | |||||
/** | |||||
* 巡检任务类型: 1 临时巡检(目前只有该一种类型) | |||||
*/ | |||||
private Integer type; | |||||
/** | |||||
* 巡检方式类型: 1 无人机 2机场巡逻 3 飞手值飞 | |||||
*/ | |||||
private Integer inspectionType; | |||||
/** | |||||
* 部门Id | |||||
*/ | |||||
private String deptId; | |||||
/** | |||||
* 公路Id | |||||
*/ | |||||
private String roadId; | |||||
/** | |||||
* 公路名称 | |||||
*/ | |||||
private String roadName; | |||||
/** | |||||
* 路段Id | |||||
*/ | |||||
private String sectionId; | |||||
/** | |||||
* 路段名称 | |||||
*/ | |||||
private String sectionName; | |||||
/** | |||||
* 计划巡检日期 | |||||
*/ | |||||
@NotNull(message = "计划巡检日期不能为空!") | |||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||||
private Date inspectionTime; | |||||
/** | |||||
* 备注 | |||||
*/ | |||||
private String note; | |||||
} |
package com.tuoheng.admin.request.inspection; | |||||
import com.fasterxml.jackson.annotation.JsonFormat; | |||||
import lombok.Data; | |||||
import org.springframework.format.annotation.DateTimeFormat; | |||||
import javax.validation.constraints.NotNull; | |||||
import java.util.Date; | |||||
/** | |||||
* 修改任务请求参数 | |||||
* | |||||
* @author wanjing | |||||
* @team tuoheng | |||||
* @date 2022-11-24 | |||||
*/ | |||||
@Data | |||||
public class EditInspectionRequest { | |||||
/** | |||||
* ID | |||||
*/ | |||||
private String id; | |||||
/** | |||||
* 用户ID | |||||
*/ | |||||
private String userId; | |||||
/** | |||||
* 租户id | |||||
*/ | |||||
private Integer tenantId; | |||||
/** | |||||
* 任务名称 | |||||
*/ | |||||
private String name; | |||||
/** | |||||
* 巡检机场id | |||||
*/ | |||||
private Integer airportId; | |||||
/** | |||||
* 巡检机场名称 | |||||
*/ | |||||
private String airportName; | |||||
/** | |||||
* 巡检线路Id | |||||
*/ | |||||
private Integer inspectionLine; | |||||
/** | |||||
* 巡检线路名称 | |||||
*/ | |||||
private String inspectionLineName; | |||||
/** | |||||
* 巡检任务类型: 1 临时巡检(目前只有该一种类型) | |||||
*/ | |||||
private Integer type; | |||||
/** | |||||
* 巡检方式类型: 1 无人机 2机场巡逻 3 飞手值飞 | |||||
*/ | |||||
private Integer inspectionType; | |||||
/** | |||||
* 部门Id | |||||
*/ | |||||
private String deptId; | |||||
/** | |||||
* 公路Id | |||||
*/ | |||||
private String roadId; | |||||
/** | |||||
* 公路名称 | |||||
*/ | |||||
private String roadName; | |||||
/** | |||||
* 路段Id | |||||
*/ | |||||
private String sectionId; | |||||
/** | |||||
* 路段名称 | |||||
*/ | |||||
private String sectionName; | |||||
/** | |||||
* 计划巡检日期 | |||||
*/ | |||||
@NotNull(message = "计划巡检日期不能为空!") | |||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||||
private Date inspectionTime; | |||||
/** | |||||
* 备注 | |||||
*/ | |||||
private String note; | |||||
} |
*/ | */ | ||||
private Integer tenantId; | private Integer tenantId; | ||||
/** | |||||
* 关键字,匹配任务编号和任务名称 | |||||
*/ | |||||
private String key; | |||||
/** | /** | ||||
* 任务编号 | * 任务编号 | ||||
*/ | */ | ||||
private Integer status; | private Integer status; | ||||
/** | /** | ||||
* 巡检方式类型: 1 无人机 2机场 | |||||
* 巡检方式类型: 1 无人机 2机场巡逻 3 飞手值飞 | |||||
*/ | */ | ||||
private Integer inspectionType; | private Integer inspectionType; | ||||
/** | /** | ||||
* 部门Id | * 部门Id | ||||
*/ | */ | ||||
private Integer deptId; | |||||
private String deptId; | |||||
} | } |
JsonResult getListByDeptId(String deptId); | JsonResult getListByDeptId(String deptId); | ||||
JsonResult getListByRoadId(String roadId); | |||||
JsonResult editInfo(Section entity); | JsonResult editInfo(Section entity); | ||||
JsonResult getSectionInfo(String sectionId); | JsonResult getSectionInfo(String sectionId); |
import cn.hutool.core.util.ObjectUtil; | import cn.hutool.core.util.ObjectUtil; | ||||
import com.tuoheng.admin.entity.Tenant; | import com.tuoheng.admin.entity.Tenant; | ||||
import com.tuoheng.admin.enums.AriportCodeEnum; | |||||
import com.tuoheng.admin.enums.code.AriportCodeEnum; | |||||
import com.tuoheng.admin.mapper.TenantMapper; | import com.tuoheng.admin.mapper.TenantMapper; | ||||
import com.tuoheng.admin.utils.ShiroUtils; | import com.tuoheng.admin.utils.ShiroUtils; | ||||
import com.tuoheng.admin.vo.AirLineVO; | import com.tuoheng.admin.vo.AirLineVO; |
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
import com.tuoheng.admin.entity.*; | import com.tuoheng.admin.entity.*; | ||||
import com.tuoheng.admin.enums.dept.AddDeptCodeEnum; | |||||
import com.tuoheng.admin.enums.code.dept.AddDeptCodeEnum; | |||||
import com.tuoheng.admin.mapper.DeptMapper; | import com.tuoheng.admin.mapper.DeptMapper; | ||||
import com.tuoheng.admin.mapper.RoadDeptMapper; | import com.tuoheng.admin.mapper.RoadDeptMapper; | ||||
import com.tuoheng.admin.mapper.SectionDeptMapper; | import com.tuoheng.admin.mapper.SectionDeptMapper; |
package com.tuoheng.admin.service.dept.delete; | package com.tuoheng.admin.service.dept.delete; | ||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
import com.tuoheng.admin.dto.RoadSectionDto; | |||||
import com.tuoheng.admin.entity.*; | import com.tuoheng.admin.entity.*; | ||||
import com.tuoheng.admin.enums.dept.DeleteDeptCodeEnum; | |||||
import com.tuoheng.admin.enums.code.dept.DeleteDeptCodeEnum; | |||||
import com.tuoheng.admin.mapper.DeptMapper; | import com.tuoheng.admin.mapper.DeptMapper; | ||||
import com.tuoheng.admin.mapper.RoadDeptMapper; | import com.tuoheng.admin.mapper.RoadDeptMapper; | ||||
import com.tuoheng.admin.mapper.SectionDeptMapper; | import com.tuoheng.admin.mapper.SectionDeptMapper; | ||||
import com.tuoheng.admin.mapper.UserMapper; | import com.tuoheng.admin.mapper.UserMapper; | ||||
import com.tuoheng.admin.request.dept.EditDeptRequest; | |||||
import com.tuoheng.admin.utils.ShiroUtils; | import com.tuoheng.admin.utils.ShiroUtils; | ||||
import com.tuoheng.common.core.utils.DateUtils; | import com.tuoheng.common.core.utils.DateUtils; | ||||
import com.tuoheng.common.core.utils.JsonResult; | import com.tuoheng.common.core.utils.JsonResult; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import org.springframework.util.CollectionUtils; | |||||
import java.util.ArrayList; | |||||
import java.util.HashMap; | import java.util.HashMap; | ||||
import java.util.List; | |||||
import java.util.Map; | import java.util.Map; | ||||
import java.util.stream.Collectors; | |||||
/** | /** | ||||
* 删除部门业务层处理 | * 删除部门业务层处理 |
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.tuoheng.admin.entity.Dept; | import com.tuoheng.admin.entity.Dept; | ||||
import com.tuoheng.admin.enums.dept.QueryDeptChildListCodeEnum; | |||||
import com.tuoheng.admin.enums.code.dept.QueryDeptChildListCodeEnum; | |||||
import com.tuoheng.admin.mapper.DeptMapper; | import com.tuoheng.admin.mapper.DeptMapper; | ||||
import com.tuoheng.admin.request.dept.QueryDeptChildPageListRequest; | import com.tuoheng.admin.request.dept.QueryDeptChildPageListRequest; | ||||
import com.tuoheng.admin.utils.ShiroUtils; | import com.tuoheng.admin.utils.ShiroUtils; |
import com.tuoheng.admin.conver.DeptConverMapper; | import com.tuoheng.admin.conver.DeptConverMapper; | ||||
import com.tuoheng.admin.dto.RoadSectionDto; | import com.tuoheng.admin.dto.RoadSectionDto; | ||||
import com.tuoheng.admin.entity.*; | import com.tuoheng.admin.entity.*; | ||||
import com.tuoheng.admin.enums.dept.QueryDeptInfoCodeEnum; | |||||
import com.tuoheng.admin.enums.code.dept.QueryDeptInfoCodeEnum; | |||||
import com.tuoheng.admin.mapper.*; | import com.tuoheng.admin.mapper.*; | ||||
import com.tuoheng.admin.utils.ShiroUtils; | import com.tuoheng.admin.utils.ShiroUtils; | ||||
import com.tuoheng.admin.vo.DeptInfoVo; | import com.tuoheng.admin.vo.DeptInfoVo; | ||||
@Autowired | @Autowired | ||||
private DeptMapper deptMapper; | private DeptMapper deptMapper; | ||||
@Autowired | |||||
private UserMapper userMapper; | |||||
@Autowired | @Autowired | ||||
private RoadInformationMapper roadInformationMapper; | private RoadInformationMapper roadInformationMapper; | ||||
@Autowired | @Autowired | ||||
private SectionDeptMapper sectionDeptMapper; | private SectionDeptMapper sectionDeptMapper; | ||||
public JsonResult getDeptInfo(String id) { | |||||
log.info("进入获取部门信息业务"); | |||||
public JsonResult getDeptInfo(String deptId) { | |||||
log.info("进入获取部门信息业务, deptId:{}", deptId); | |||||
String tenantId = ShiroUtils.getTenantId(); | String tenantId = ShiroUtils.getTenantId(); | ||||
// 校验 | // 校验 | ||||
JsonResult result = this.check(tenantId, id); | |||||
JsonResult result = this.check(tenantId, deptId); | |||||
if (0 != result.getCode()) { | if (0 != result.getCode()) { | ||||
log.info("获取部门信息业务:校验失败:{}", result.getMsg()); | log.info("获取部门信息业务:校验失败:{}", result.getMsg()); | ||||
return result; | return result; | ||||
// 在校验中,判断部门是否存在时,若部门存在,直接将部门信息返回,减少数据库查询次数 | // 在校验中,判断部门是否存在时,若部门存在,直接将部门信息返回,减少数据库查询次数 | ||||
Dept dept = (Dept) result.getData(); | Dept dept = (Dept) result.getData(); | ||||
// 获取该部门下公路列表 | |||||
List<RoadInformation> roadInformationList = this.getRoadInformationList(tenantId, id); | |||||
if (CollectionUtil.isEmpty(roadInformationList)) { | |||||
// 不会出现此场景,在代码层面考虑健壮性,加此判断 | |||||
// 根据业务需求,添加部门时,必须添加公路和路段信息 | |||||
// 若公路数据为空,说明肯定也没也路段信息,不用继续往下判断,因此直接返回 | |||||
log.info("获取部门信息业务:公路信息为空"); | |||||
return JsonResult.success(dept); | |||||
} | |||||
// 获取该部门下路段列表 | |||||
List<Section> sectionList = this.getSectionList(tenantId, id); | |||||
if (CollectionUtil.isEmpty(sectionList)) { | |||||
// 不会出现此场景,在代码层面考虑健壮性,加此判断 | |||||
// 若路段信息为空,不用继续往下判断,因此直接返回 | |||||
log.info("获取部门信息业务:路段信息为空"); | |||||
return JsonResult.success(dept); | |||||
} | |||||
// 处理公路与路段的对应关系 | // 处理公路与路段的对应关系 | ||||
List<RoadSectionDto> roadSectionDtoList = this.getRoadSectionDtoList(roadInformationList, sectionList); | |||||
List<RoadSectionDto> roadSectionDtoList = this.getRoadSectionDtoList(tenantId, deptId); | |||||
// 拼装返回数据实体 | // 拼装返回数据实体 | ||||
Dept parent = this.getParentDept(tenantId, dept.getPid()); | |||||
Integer userCount = this.getUserCount(tenantId, deptId); | |||||
Integer childDeptCount = this.getChildDeptCount(tenantId, deptId); | |||||
DeptInfoVo deptInfoVo = DeptConverMapper.INSTANCE.fromDeptToDeptVo(dept); | DeptInfoVo deptInfoVo = DeptConverMapper.INSTANCE.fromDeptToDeptVo(dept); | ||||
deptInfoVo.setRoadSectionDtoList(roadSectionDtoList); | deptInfoVo.setRoadSectionDtoList(roadSectionDtoList); | ||||
deptInfoVo.setUserCount(userCount); | |||||
deptInfoVo.setChildDeptCount(childDeptCount); | |||||
if (null != parent) { | |||||
deptInfoVo.setPname(parent.getName()); | |||||
} | |||||
return JsonResult.success(deptInfoVo); | return JsonResult.success(deptInfoVo); | ||||
} | } | ||||
return JsonResult.success(dept); | return JsonResult.success(dept); | ||||
} | } | ||||
/** | |||||
* 获取父部门信息 | |||||
*/ | |||||
private Dept getParentDept(String tenantId, String pid) { | |||||
Dept dept = deptMapper.selectOne(new LambdaQueryWrapper<Dept>() | |||||
.eq(Dept::getTenantId, tenantId) | |||||
.eq(Dept::getId, pid) | |||||
.eq(Dept::getMark, 1)); | |||||
return dept; | |||||
} | |||||
/** | |||||
* 获取部门下用户数 | |||||
*/ | |||||
private Integer getUserCount(String tenantId, String deptId) { | |||||
Integer count = userMapper.selectCount(new LambdaQueryWrapper<User>() | |||||
.eq(User::getTenantId, tenantId) | |||||
.eq(User::getDeptId, deptId) | |||||
.eq(User::getMark, 1)); | |||||
return count; | |||||
} | |||||
/** | |||||
* 获取部门下子部门数 | |||||
*/ | |||||
private Integer getChildDeptCount(String tenantId, String deptId) { | |||||
Integer count = deptMapper.selectCount(new LambdaQueryWrapper<Dept>() | |||||
.eq(Dept::getTenantId, tenantId) | |||||
.eq(Dept::getPid, deptId) | |||||
.eq(Dept::getMark, 1)); | |||||
return count; | |||||
} | |||||
/** | |||||
* 拼装数据 | |||||
* @param tenantId | |||||
* @param id | |||||
* @return | |||||
*/ | |||||
private List<RoadSectionDto> getRoadSectionDtoList(String tenantId, String id) { | |||||
// 获取该部门下公路列表 | |||||
List<RoadInformation> roadInformationList = this.getRoadInformationList(tenantId, id); | |||||
if (CollectionUtil.isEmpty(roadInformationList)) { | |||||
// 不会出现此场景,在代码层面考虑健壮性,加此判断 | |||||
// 根据业务需求,添加部门时,必须添加公路和路段信息 | |||||
// 若公路数据为空,说明肯定也没也路段信息,不用继续往下判断,因此直接返回 | |||||
log.info("获取部门信息业务:公路信息为空"); | |||||
return null; | |||||
} | |||||
// 获取该部门下路段列表 | |||||
List<Section> sectionList = this.getSectionList(tenantId, id); | |||||
if (CollectionUtil.isEmpty(sectionList)) { | |||||
// 不会出现此场景,在代码层面考虑健壮性,加此判断 | |||||
// 若路段信息为空,不用继续往下判断,因此直接返回 | |||||
log.info("获取部门信息业务:路段信息为空"); | |||||
return null; | |||||
} | |||||
List<RoadSectionDto> roadSectionDtoList = new ArrayList<>(); | |||||
RoadSectionDto roadSectionDto; | |||||
List<Section> sectionListTmp; | |||||
for (RoadInformation roadInformation : roadInformationList) { | |||||
roadSectionDto = new RoadSectionDto(); | |||||
sectionListTmp = new ArrayList<>(); | |||||
for (Section section : sectionList) { | |||||
if (section.getRoadId().equals(roadInformation.getId())) { | |||||
sectionListTmp.add(section); | |||||
} | |||||
} | |||||
roadSectionDto.setRoad(roadInformation); | |||||
roadSectionDto.setSectionList(sectionListTmp); | |||||
roadSectionDtoList.add(roadSectionDto); | |||||
} | |||||
return roadSectionDtoList; | |||||
} | |||||
/** | /** | ||||
* 查询该部门下公路信息列表 | * 查询该部门下公路信息列表 | ||||
* @param tenantId | * @param tenantId | ||||
List<Section> sectionList = sectionMapper.getListByMap(map); | List<Section> sectionList = sectionMapper.getListByMap(map); | ||||
return sectionList; | return sectionList; | ||||
} | } | ||||
/** | |||||
* 拼装数据 | |||||
* @param roadInformationList | |||||
* @param sectionList | |||||
* @return | |||||
*/ | |||||
private List<RoadSectionDto> getRoadSectionDtoList(List<RoadInformation> roadInformationList, List<Section> sectionList) { | |||||
List<RoadSectionDto> roadSectionDtoList = new ArrayList<>(); | |||||
RoadSectionDto roadSectionDto; | |||||
List<Section> sectionListTmp; | |||||
for (RoadInformation roadInformation : roadInformationList) { | |||||
roadSectionDto = new RoadSectionDto(); | |||||
sectionListTmp = new ArrayList<>(); | |||||
for (Section section : sectionList) { | |||||
if (section.getRoadId().equals(roadInformation.getId())) { | |||||
sectionListTmp.add(section); | |||||
} | |||||
} | |||||
roadSectionDto.setRoad(roadInformation); | |||||
roadSectionDto.setSectionList(sectionListTmp); | |||||
roadSectionDtoList.add(roadSectionDto); | |||||
} | |||||
return roadSectionDtoList; | |||||
} | |||||
} | } |
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
import com.tuoheng.admin.conver.DeptConverMapper; | import com.tuoheng.admin.conver.DeptConverMapper; | ||||
import com.tuoheng.admin.entity.Dept; | import com.tuoheng.admin.entity.Dept; | ||||
import com.tuoheng.admin.enums.dept.QueryDeptTreeListCodeEnum; | |||||
import com.tuoheng.admin.enums.code.dept.QueryDeptTreeListCodeEnum; | |||||
import com.tuoheng.admin.mapper.DeptMapper; | import com.tuoheng.admin.mapper.DeptMapper; | ||||
import com.tuoheng.admin.vo.DeptTreeVo; | import com.tuoheng.admin.vo.DeptTreeVo; | ||||
import com.tuoheng.common.core.utils.JsonResult; | import com.tuoheng.common.core.utils.JsonResult; |
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
import com.tuoheng.admin.dto.RoadSectionDto; | import com.tuoheng.admin.dto.RoadSectionDto; | ||||
import com.tuoheng.admin.entity.*; | import com.tuoheng.admin.entity.*; | ||||
import com.tuoheng.admin.enums.dept.AddDeptCodeEnum; | |||||
import com.tuoheng.admin.enums.dept.DeleteDeptCodeEnum; | |||||
import com.tuoheng.admin.enums.dept.EditDeptCodeEnum; | |||||
import com.tuoheng.admin.enums.code.dept.EditDeptCodeEnum; | |||||
import com.tuoheng.admin.mapper.DeptMapper; | import com.tuoheng.admin.mapper.DeptMapper; | ||||
import com.tuoheng.admin.mapper.RoadDeptMapper; | import com.tuoheng.admin.mapper.RoadDeptMapper; | ||||
import com.tuoheng.admin.mapper.SectionDeptMapper; | import com.tuoheng.admin.mapper.SectionDeptMapper; | ||||
import com.tuoheng.admin.request.dept.AddDeptRequest; | |||||
import com.tuoheng.admin.request.dept.EditDeptRequest; | import com.tuoheng.admin.request.dept.EditDeptRequest; | ||||
import com.tuoheng.admin.utils.ShiroUtils; | import com.tuoheng.admin.utils.ShiroUtils; | ||||
import com.tuoheng.common.core.utils.DateUtils; | import com.tuoheng.common.core.utils.DateUtils; |
import com.tuoheng.admin.query.SectionQuery; | import com.tuoheng.admin.query.SectionQuery; | ||||
import com.tuoheng.admin.service.ISectionService; | import com.tuoheng.admin.service.ISectionService; | ||||
import com.tuoheng.admin.service.section.query.QuerySectionListByDeptIdService; | import com.tuoheng.admin.service.section.query.QuerySectionListByDeptIdService; | ||||
import com.tuoheng.admin.service.section.query.QuerySectionListByRoadIdService; | |||||
import com.tuoheng.admin.vo.SectionInfoVo; | import com.tuoheng.admin.vo.SectionInfoVo; | ||||
import com.tuoheng.common.core.common.BaseServiceImpl; | import com.tuoheng.common.core.common.BaseServiceImpl; | ||||
import com.tuoheng.common.core.enums.ServiceExceptionEnum; | import com.tuoheng.common.core.enums.ServiceExceptionEnum; | ||||
@Autowired | @Autowired | ||||
private QuerySectionListByDeptIdService querySectionListByDeptIdService; | private QuerySectionListByDeptIdService querySectionListByDeptIdService; | ||||
@Autowired | |||||
private QuerySectionListByRoadIdService querySectionListByRoadIdService; | |||||
@Override | @Override | ||||
public JsonResult queryPage(SectionQuery query) { | public JsonResult queryPage(SectionQuery query) { | ||||
if(null==query.getLimit() && null == query.getPage()){ | if(null==query.getLimit() && null == query.getPage()){ | ||||
*/ | */ | ||||
@Override | @Override | ||||
public JsonResult getListByDeptId(String deptId) { | public JsonResult getListByDeptId(String deptId) { | ||||
return querySectionListByDeptIdService.getRoadList(deptId); | |||||
return querySectionListByDeptIdService.getList(deptId); | |||||
} | |||||
/** | |||||
* 根据公路id获取该公路下路段信息列表 | |||||
* @param roadId | |||||
* @return | |||||
*/ | |||||
@Override | |||||
public JsonResult getListByRoadId(String roadId) { | |||||
return querySectionListByRoadIdService.getList(roadId); | |||||
} | } | ||||
@Override | @Override |
package com.tuoheng.admin.service.inspection; | package com.tuoheng.admin.service.inspection; | ||||
import com.tuoheng.admin.entity.Inspection; | import com.tuoheng.admin.entity.Inspection; | ||||
import com.tuoheng.admin.request.inspection.AddInspectionRequest; | |||||
import com.tuoheng.admin.request.inspection.EditInspectionRequest; | |||||
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | ||||
import com.tuoheng.common.core.utils.JsonResult; | import com.tuoheng.common.core.utils.JsonResult; | ||||
/** | /** | ||||
* 新增巡检任务 | * 新增巡检任务 | ||||
* | * | ||||
* @param Inspection 巡检任务 | |||||
* @param addInspectionRequest 新增任务请求参数 | |||||
* @return 结果 | * @return 结果 | ||||
*/ | */ | ||||
JsonResult insert(Inspection Inspection); | |||||
JsonResult insert(AddInspectionRequest addInspectionRequest); | |||||
/** | /** | ||||
* 修改巡检任务 | * 修改巡检任务 | ||||
* | * | ||||
* @param Inspection 巡检任务 | |||||
* @param editInspectionRequest 修改任务请求参数 | |||||
* @return 结果 | * @return 结果 | ||||
*/ | */ | ||||
JsonResult update(Inspection Inspection); | |||||
/** | |||||
* 批量删除巡检任务 | |||||
* | |||||
* @param ids 需要删除的巡检任务主键集合 | |||||
* @return 结果 | |||||
*/ | |||||
JsonResult deleteByIds(String[] ids); | |||||
JsonResult update(EditInspectionRequest editInspectionRequest); | |||||
/** | /** | ||||
* 删除巡检任务信息 | * 删除巡检任务信息 |
import com.tuoheng.admin.entity.Inspection; | import com.tuoheng.admin.entity.Inspection; | ||||
import com.tuoheng.admin.mapper.InspectionMapper; | import com.tuoheng.admin.mapper.InspectionMapper; | ||||
import com.tuoheng.admin.request.inspection.AddInspectionRequest; | |||||
import com.tuoheng.admin.request.inspection.EditInspectionRequest; | |||||
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | ||||
import com.tuoheng.admin.service.inspection.add.AddInspectionService; | |||||
import com.tuoheng.admin.service.inspection.delete.DeleteInspectionService; | |||||
import com.tuoheng.admin.service.inspection.query.QueryInspectionPageListService; | import com.tuoheng.admin.service.inspection.query.QueryInspectionPageListService; | ||||
import com.tuoheng.admin.service.inspection.update.UpdateInspectionService; | |||||
import com.tuoheng.common.core.utils.JsonResult; | import com.tuoheng.common.core.utils.JsonResult; | ||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
private InspectionMapper inspectionMapper; | private InspectionMapper inspectionMapper; | ||||
@Autowired | @Autowired | ||||
QueryInspectionPageListService queryInspectionPageListService; | |||||
private QueryInspectionPageListService queryInspectionPageListService; | |||||
@Autowired | |||||
private AddInspectionService addinspectionService; | |||||
@Autowired | |||||
private UpdateInspectionService updateInspectionService; | |||||
@Autowired | |||||
private DeleteInspectionService deleteInspectionService; | |||||
/** | /** | ||||
* 查询巡检任务分页列表 | |||||
* 查询巡检任务分页分页列表 | |||||
* | * | ||||
* @param queryInspectionRequest 巡检任务查询实体 | * @param queryInspectionRequest 巡检任务查询实体 | ||||
* @return | * @return | ||||
/** | /** | ||||
* 新增巡检任务 | * 新增巡检任务 | ||||
* | * | ||||
* @param inspection 巡检任务 | |||||
* @param addInspectionRequest 新增任务请求参数 | |||||
* @return 结果 | * @return 结果 | ||||
*/ | */ | ||||
@Override | @Override | ||||
public JsonResult insert(Inspection inspection) { | |||||
inspectionMapper.insert(inspection); | |||||
return JsonResult.success(); | |||||
public JsonResult insert(AddInspectionRequest addInspectionRequest) { | |||||
return addinspectionService.add(addInspectionRequest); | |||||
} | } | ||||
/** | /** | ||||
* 修改巡检任务 | * 修改巡检任务 | ||||
* | * | ||||
* @param inspection 巡检任务 | |||||
* @return 结果 | |||||
*/ | |||||
@Override | |||||
public JsonResult update(Inspection inspection) { | |||||
inspectionMapper.update(inspection); | |||||
return JsonResult.success(); | |||||
} | |||||
/** | |||||
* 批量删除巡检任务 | |||||
* | |||||
* @param ids 需要删除的巡检任务主键 | |||||
* @param editInspectionRequest 修改任务请求参数 | |||||
* @return 结果 | * @return 结果 | ||||
*/ | */ | ||||
@Override | @Override | ||||
public JsonResult deleteByIds(String[] ids) { | |||||
inspectionMapper.deleteByIds(ids); | |||||
return JsonResult.success(); | |||||
public JsonResult update(EditInspectionRequest editInspectionRequest) { | |||||
return updateInspectionService.update(editInspectionRequest); | |||||
} | } | ||||
/** | /** | ||||
*/ | */ | ||||
@Override | @Override | ||||
public JsonResult deleteById(String id) { | public JsonResult deleteById(String id) { | ||||
inspectionMapper.deleteById(id); | |||||
return JsonResult.success(); | |||||
return deleteInspectionService.deleteById(id); | |||||
} | } | ||||
} | } |
package com.tuoheng.admin.service.inspection.add; | |||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.tuoheng.admin.conver.InspectionConverMapper; | |||||
import com.tuoheng.admin.entity.*; | |||||
import com.tuoheng.admin.enums.code.inspection.AddInspectionCodeEnum; | |||||
import com.tuoheng.admin.mapper.*; | |||||
import com.tuoheng.admin.request.inspection.AddInspectionRequest; | |||||
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; | |||||
/** | |||||
* 添加任务业务层处理 | |||||
* | |||||
* @author wanjing | |||||
* @team tuoheng | |||||
* @date 2022-11-23 | |||||
*/ | |||||
@Slf4j | |||||
@Service | |||||
public class AddInspectionService { | |||||
@Autowired | |||||
private UserMapper userMapper; | |||||
@Autowired | |||||
private DeptMapper deptMapper; | |||||
@Autowired | |||||
private RoadInformationMapper roadInformationMapper; | |||||
@Autowired | |||||
private SectionMapper sectionMapper; | |||||
@Autowired | |||||
private InspectionMapper inspectionMapper; | |||||
/** | |||||
* 添加任务 | |||||
* | |||||
* @return | |||||
*/ | |||||
public JsonResult add(AddInspectionRequest addInspectionRequest) { | |||||
log.info("进入添加任务业务接口"); | |||||
String userId = ShiroUtils.getUserId(); | |||||
String tenantId = ShiroUtils.getTenantId(); | |||||
JsonResult result = this.check(tenantId, addInspectionRequest); | |||||
if (0 != result.getCode()) { | |||||
log.info("添加任务业务接口:校验失败:{}", result.getMsg()); | |||||
return result; | |||||
} | |||||
User user = userMapper.selectOne(new LambdaQueryWrapper<User>() | |||||
.eq(User::getTenantId, tenantId) | |||||
.eq(User::getId, userId) | |||||
.eq(User::getMark, 1)); | |||||
Dept dept = deptMapper.selectOne(new LambdaQueryWrapper<Dept>() | |||||
.eq(Dept::getTenantId, tenantId) | |||||
.eq(Dept::getId, user.getDeptId()) | |||||
.eq(Dept::getMark, 1)); | |||||
String code = DateUtils.generateCode("XJRW"); | |||||
addInspectionRequest.setTenantId(tenantId); | |||||
addInspectionRequest.setCode(code); | |||||
addInspectionRequest.setDeptId(dept.getId()); | |||||
Inspection inspection = InspectionConverMapper.INSTANCE.fromAddInspectionRequestToInspection(addInspectionRequest); | |||||
Integer rowId = inspectionMapper.insert(inspection); | |||||
log.info("添加任务, 返回结果: deptId={}", rowId); | |||||
if (rowId <= 0) { | |||||
log.info("添加任务业务接口:添加任务失败:{}", result.getMsg()); | |||||
return JsonResult.error(AddInspectionCodeEnum.ADD_DEPT_IS_FAILED.getCode(), AddInspectionCodeEnum.ADD_DEPT_IS_FAILED.getMsg()); | |||||
} | |||||
log.info("添加任务业务接口:添加任务成功:{}", inspection); | |||||
return JsonResult.success(inspection); | |||||
} | |||||
/** | |||||
* 检查参数 | |||||
* @param tenantId | |||||
* @param addInspectionRequest | |||||
* @return | |||||
*/ | |||||
private JsonResult check(String tenantId, AddInspectionRequest addInspectionRequest) { | |||||
if (StringUtils.isEmpty(addInspectionRequest.getName())) { | |||||
return JsonResult.error(AddInspectionCodeEnum.NAME_IS_NULL.getCode(), AddInspectionCodeEnum.NAME_IS_NULL.getMsg()); | |||||
} | |||||
if (null == addInspectionRequest.getType()) { | |||||
return JsonResult.error(AddInspectionCodeEnum.TYPE_IS_NULL.getCode(), AddInspectionCodeEnum.TYPE_IS_NULL.getMsg()); | |||||
} | |||||
if (null == addInspectionRequest.getRoadId() || StringUtils.isEmpty(addInspectionRequest.getRoadName())) { | |||||
return JsonResult.error(AddInspectionCodeEnum.ROAD_IS_NULL.getCode(), AddInspectionCodeEnum.ROAD_IS_NULL.getMsg()); | |||||
} | |||||
if (null == addInspectionRequest.getSectionId() || StringUtils.isEmpty(addInspectionRequest.getSectionName())) { | |||||
return JsonResult.error(AddInspectionCodeEnum.SECTION_IS_NULL.getCode(), AddInspectionCodeEnum.SECTION_IS_NULL.getMsg()); | |||||
} | |||||
if (null == addInspectionRequest.getInspectionType()) { | |||||
return JsonResult.error(AddInspectionCodeEnum.INSPECTION_TYPE_IS_NULL.getCode(), AddInspectionCodeEnum.INSPECTION_TYPE_IS_NULL.getMsg()); | |||||
} | |||||
if (null == addInspectionRequest.getAirportId() || StringUtils.isEmpty(addInspectionRequest.getAirportName())) { | |||||
return JsonResult.error(AddInspectionCodeEnum.AIRPORT_IS_NULL.getCode(), AddInspectionCodeEnum.AIRPORT_IS_NULL.getMsg()); | |||||
} | |||||
if (null == addInspectionRequest.getInspectionLine() || StringUtils.isEmpty(addInspectionRequest.getInspectionLineName())) { | |||||
return JsonResult.error(AddInspectionCodeEnum.INSPECTION_LINE_IS_NULL.getCode(), AddInspectionCodeEnum.INSPECTION_LINE_IS_NULL.getMsg()); | |||||
} | |||||
if (null == addInspectionRequest.getInspectionTime()) { | |||||
return JsonResult.error(AddInspectionCodeEnum.INSPECTION_TIME_IS_NULL.getCode(), AddInspectionCodeEnum.INSPECTION_TIME_IS_NULL.getMsg()); | |||||
} | |||||
Integer roadCount = roadInformationMapper.selectCount(Wrappers.<RoadInformation>lambdaQuery() | |||||
.eq(RoadInformation::getTenantId, tenantId) | |||||
.eq(RoadInformation::getId, addInspectionRequest.getRoadId()) | |||||
.eq(RoadInformation::getMark, 1)); | |||||
if (roadCount <= 0) { | |||||
return JsonResult.error(AddInspectionCodeEnum.ROAD_IS_NOT_EXIST.getCode(), AddInspectionCodeEnum.ROAD_IS_NOT_EXIST.getMsg()); | |||||
} | |||||
Integer sectionCount = sectionMapper.selectCount(Wrappers.<Section>lambdaQuery() | |||||
.eq(Section::getTenantId, tenantId) | |||||
.eq(Section::getId, addInspectionRequest.getSectionId()) | |||||
.eq(Section::getMark, 1)); | |||||
if (sectionCount <= 0) { | |||||
return JsonResult.error(AddInspectionCodeEnum.SECTION_IS_NOT_EXIST.getCode(), AddInspectionCodeEnum.SECTION_IS_NOT_EXIST.getMsg()); | |||||
} | |||||
return JsonResult.success(); | |||||
} | |||||
} |
package com.tuoheng.admin.service.inspection.delete; | |||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.tuoheng.admin.entity.Dept; | |||||
import com.tuoheng.admin.entity.Inspection; | |||||
import com.tuoheng.admin.entity.User; | |||||
import com.tuoheng.admin.enums.code.dept.DeleteDeptCodeEnum; | |||||
import com.tuoheng.admin.enums.code.inspection.DeleteInspectionCodeEnum; | |||||
import com.tuoheng.admin.mapper.*; | |||||
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.Map; | |||||
/** | |||||
* 删除任务业务层处理 | |||||
* | |||||
* @author wanjing | |||||
* @team tuoheng | |||||
* @date 2022-11-24 | |||||
*/ | |||||
@Slf4j | |||||
@Service | |||||
public class DeleteInspectionService { | |||||
@Autowired | |||||
private InspectionMapper inspectionMapper; | |||||
public JsonResult deleteById(String id) { | |||||
log.info("进入删除任务业务接口"); | |||||
String tenantId = ShiroUtils.getTenantId(); | |||||
JsonResult result = this.check(tenantId, id); | |||||
if (0 != result.getCode()) { | |||||
log.info("删除部门任务接口:校验失败:{}", result.getMsg()); | |||||
return result; | |||||
} | |||||
// 在校验中,判断部门是否存在时,若部门存在,直接将部门信息返回,减少数据库查询次数 | |||||
Inspection inspection = (Inspection) result.getData(); | |||||
// inspection.setUpdateUser(SecurityUtils.getUserId()); | |||||
inspection.setUpdateTime(DateUtils.now()); | |||||
Integer rowId = inspectionMapper.deleteById(id); | |||||
log.info("删除任务, 返回结果: deptId={}", rowId); | |||||
if (rowId <= 0) { | |||||
log.info("删除任务业务接口:删除任务失败:{}", result.getMsg()); | |||||
return JsonResult.error(DeleteInspectionCodeEnum.DELETE_IS_FAILED.getCode(), DeleteInspectionCodeEnum.DELETE_IS_FAILED.getMsg()); | |||||
} | |||||
log.info("删除任务业务接口:删除任务成功:id={}", inspection.getId()); | |||||
return JsonResult.success("删除部门任务"); | |||||
} | |||||
/** | |||||
* 检查参数 | |||||
* @param tenantId | |||||
* @param id | |||||
* @return | |||||
*/ | |||||
private JsonResult check(String tenantId, String id) { | |||||
// 判断id是否为空 | |||||
if (StringUtils.isEmpty(id)) { | |||||
return JsonResult.error(DeleteInspectionCodeEnum.ID_IS_NULL.getCode(), DeleteInspectionCodeEnum.ID_IS_NULL.getMsg()); | |||||
} | |||||
// 判断任务是否存在 | |||||
Inspection inspection = inspectionMapper.selectOne(new LambdaQueryWrapper<Inspection>() | |||||
.eq(Inspection::getTenantId, tenantId) | |||||
.eq(Inspection::getId, id) | |||||
.eq(Inspection::getMark, 1)); | |||||
if (null == inspection) { | |||||
return JsonResult.error(DeleteInspectionCodeEnum.INSPECTION_IS_NOT_EXIST.getCode(), DeleteInspectionCodeEnum.INSPECTION_IS_NOT_EXIST.getMsg()); | |||||
} | |||||
return JsonResult.success(inspection); | |||||
} | |||||
} |
package com.tuoheng.admin.service.inspection.query; | package com.tuoheng.admin.service.inspection.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.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||
import com.tuoheng.admin.entity.Dept; | |||||
import com.tuoheng.admin.entity.Inspection; | import com.tuoheng.admin.entity.Inspection; | ||||
import com.tuoheng.admin.enums.InspectionWayEnum; | |||||
import com.tuoheng.admin.enums.code.dept.EditDeptCodeEnum; | |||||
import com.tuoheng.admin.enums.code.inspection.QueryInspectionPageListCodeEnum; | |||||
import com.tuoheng.admin.mapper.DeptMapper; | |||||
import com.tuoheng.admin.mapper.InspectionMapper; | import com.tuoheng.admin.mapper.InspectionMapper; | ||||
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | ||||
import com.tuoheng.admin.utils.ShiroUtils; | import com.tuoheng.admin.utils.ShiroUtils; | ||||
import com.tuoheng.common.core.utils.JsonResult; | import com.tuoheng.common.core.utils.JsonResult; | ||||
import com.tuoheng.common.core.utils.StringUtils; | |||||
import lombok.extern.slf4j.Slf4j; | import lombok.extern.slf4j.Slf4j; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import java.util.List; | |||||
/** | /** | ||||
* 查询巡检任务分页列表业务层处理 | * 查询巡检任务分页列表业务层处理 | ||||
* | * | ||||
@Service | @Service | ||||
public class QueryInspectionPageListService { | public class QueryInspectionPageListService { | ||||
@Autowired | |||||
private DeptMapper deptMapper; | |||||
@Autowired | @Autowired | ||||
private InspectionMapper inspectionMapper; | private InspectionMapper inspectionMapper; | ||||
return result; | return result; | ||||
} | } | ||||
Page<Inspection> page = new Page(queryInspectionRequest.getPage(), queryInspectionRequest.getLimit()); | |||||
Page<Inspection> pageList = inspectionMapper.selectPageList(page, queryInspectionRequest); | |||||
if (InspectionWayEnum.MABNNEDFLIGHT.getCode() == queryInspectionRequest.getInspectionType()) { | |||||
queryInspectionRequest.setAirportId(0); | |||||
queryInspectionRequest.setInspectionLine(0); | |||||
} | |||||
// 获取本部门及子孙部门id列表 | |||||
List<String> deptIdList = deptMapper.selectAllChildListById(queryInspectionRequest.getDeptId()); | |||||
// 设置分页参数 | |||||
IPage<Inspection> page = new Page<>(queryInspectionRequest.getPage(), queryInspectionRequest.getLimit()); | |||||
// 查询结果 | |||||
IPage<Inspection> pageData = inspectionMapper.selectPageList(page, queryInspectionRequest); | |||||
// | |||||
// Page<Inspection> page = new Page(queryInspectionRequest.getPage(), queryInspectionRequest.getLimit()); | |||||
// Page<Inspection> pageList = inspectionMapper.selectPageList2(page, queryInspectionRequest); | |||||
// 查询所有有效的子部门数据 | // 查询所有有效的子部门数据 | ||||
// IPage<Inspection> page = new Page<>(queryInspectionRequest.getPage(), queryInspectionRequest.getLimit()); | // IPage<Inspection> page = new Page<>(queryInspectionRequest.getPage(), queryInspectionRequest.getLimit()); | ||||
* @return | * @return | ||||
*/ | */ | ||||
private JsonResult check(String tenantId, QueryInspectionPageListRequest queryInspectionRequest) { | private JsonResult check(String tenantId, QueryInspectionPageListRequest queryInspectionRequest) { | ||||
// 判断id是否为空 | |||||
// if (StringUtils.isEmpty(id)) { | |||||
// return JsonResult.error(QueryDeptChildListCodeEnum.DEPT_ID_IS_NULL.getCode(), QueryDeptChildListCodeEnum.DEPT_ID_IS_NULL.getMsg()); | |||||
// } | |||||
// 判断部门id是否为空 | |||||
if (StringUtils.isEmpty(queryInspectionRequest.getDeptId())) { | |||||
return JsonResult.error(QueryInspectionPageListCodeEnum.DEPT_ID_IS_NULL.getCode(), QueryInspectionPageListCodeEnum.DEPT_ID_IS_NULL.getMsg()); | |||||
} | |||||
// 判断部门是否存在 | |||||
Dept dept = deptMapper.selectOne(new LambdaQueryWrapper<Dept>() | |||||
.eq(Dept::getTenantId, tenantId) | |||||
.eq(Dept::getId, queryInspectionRequest.getDeptId()) | |||||
.eq(Dept::getMark, 1)); | |||||
if (null == dept) { | |||||
return JsonResult.error(QueryInspectionPageListCodeEnum.DEPT_IS_NOT_EXIST.getCode(), QueryInspectionPageListCodeEnum.DEPT_IS_NOT_EXIST.getMsg()); | |||||
} | |||||
return JsonResult.success(); | return JsonResult.success(); | ||||
} | } |
package com.tuoheng.admin.service.inspection.update; | |||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers; | |||||
import com.tuoheng.admin.conver.InspectionConverMapper; | |||||
import com.tuoheng.admin.entity.Inspection; | |||||
import com.tuoheng.admin.entity.RoadInformation; | |||||
import com.tuoheng.admin.entity.Section; | |||||
import com.tuoheng.admin.enums.code.dept.AddDeptCodeEnum; | |||||
import com.tuoheng.admin.enums.code.inspection.EditInspectionCodeEnum; | |||||
import com.tuoheng.admin.mapper.*; | |||||
import com.tuoheng.admin.request.inspection.EditInspectionRequest; | |||||
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; | |||||
/** | |||||
* 修改任务业务层处理 | |||||
* | |||||
* @author wanjing | |||||
* @team tuoheng | |||||
* @date 2022-11-24 | |||||
*/ | |||||
@Slf4j | |||||
@Service | |||||
public class UpdateInspectionService { | |||||
@Autowired | |||||
private DeptMapper deptMapper; | |||||
@Autowired | |||||
private RoadInformationMapper roadInformationMapper; | |||||
@Autowired | |||||
private SectionMapper sectionMapper; | |||||
@Autowired | |||||
private InspectionMapper inspectionMapper; | |||||
/** | |||||
* 添加任务 | |||||
* | |||||
* @return | |||||
*/ | |||||
public JsonResult update(EditInspectionRequest editInspectionRequest) { | |||||
log.info("进入修改任务业务接口"); | |||||
String tenantId = ShiroUtils.getTenantId(); | |||||
JsonResult result = this.check(tenantId, editInspectionRequest); | |||||
if (0 != result.getCode()) { | |||||
log.info("修改任务业务接口:校验失败:{}", result.getMsg()); | |||||
return result; | |||||
} | |||||
Inspection inspection = InspectionConverMapper.INSTANCE.fromEditInspectionRequestToInspection(editInspectionRequest); | |||||
inspection.setUpdateUser(""); | |||||
inspection.setUpdateTime(DateUtils.now()); | |||||
Integer rowId = inspectionMapper.update(inspection); | |||||
if (rowId <= 0) { | |||||
log.info("修改任务业务接口:修改任务失败:{}", result.getMsg()); | |||||
return JsonResult.error(AddDeptCodeEnum.ADD_DEPT_IS_FAILED.getCode(), AddDeptCodeEnum.ADD_DEPT_IS_FAILED.getMsg()); | |||||
} | |||||
log.info("修改任务业务接口:修改任务成功:{}", inspection); | |||||
return JsonResult.success(); | |||||
} | |||||
/** | |||||
* 检查参数 | |||||
* @param tenantId | |||||
* @param editInspectionRequest | |||||
* @return | |||||
*/ | |||||
private JsonResult check(String tenantId, EditInspectionRequest editInspectionRequest) { | |||||
if (StringUtils.isEmpty(editInspectionRequest.getId())) { | |||||
return JsonResult.error(EditInspectionCodeEnum.ID_IS_NULL.getCode(), EditInspectionCodeEnum.ID_IS_NULL.getMsg()); | |||||
} | |||||
if (StringUtils.isEmpty(editInspectionRequest.getName())) { | |||||
return JsonResult.error(EditInspectionCodeEnum.NAME_IS_NULL.getCode(), EditInspectionCodeEnum.NAME_IS_NULL.getMsg()); | |||||
} | |||||
if (null == editInspectionRequest.getType()) { | |||||
return JsonResult.error(EditInspectionCodeEnum.TYPE_IS_NULL.getCode(), EditInspectionCodeEnum.TYPE_IS_NULL.getMsg()); | |||||
} | |||||
if (null == editInspectionRequest.getRoadId() || StringUtils.isEmpty(editInspectionRequest.getRoadName())) { | |||||
return JsonResult.error(EditInspectionCodeEnum.ROAD_IS_NULL.getCode(), EditInspectionCodeEnum.ROAD_IS_NULL.getMsg()); | |||||
} | |||||
if (null == editInspectionRequest.getSectionId() || StringUtils.isEmpty(editInspectionRequest.getSectionName()) ) { | |||||
return JsonResult.error(EditInspectionCodeEnum.SECTION_IS_NULL.getCode(), EditInspectionCodeEnum.SECTION_IS_NULL.getMsg()); | |||||
} | |||||
if (null == editInspectionRequest.getInspectionType()) { | |||||
return JsonResult.error(EditInspectionCodeEnum.INSPECTION_TYPE_IS_NULL.getCode(), EditInspectionCodeEnum.INSPECTION_TYPE_IS_NULL.getMsg()); | |||||
} | |||||
if (null == editInspectionRequest.getAirportId() || StringUtils.isEmpty(editInspectionRequest.getAirportName())) { | |||||
return JsonResult.error(EditInspectionCodeEnum.AIRPORT_IS_NULL.getCode(), EditInspectionCodeEnum.AIRPORT_IS_NULL.getMsg()); | |||||
} | |||||
if (null == editInspectionRequest.getInspectionLine() || StringUtils.isEmpty(editInspectionRequest.getInspectionLineName())) { | |||||
return JsonResult.error(EditInspectionCodeEnum.INSPECTION_LINE_IS_NULL.getCode(), EditInspectionCodeEnum.INSPECTION_LINE_IS_NULL.getMsg()); | |||||
} | |||||
if (null == editInspectionRequest.getInspectionTime()) { | |||||
return JsonResult.error(EditInspectionCodeEnum.INSPECTION_TIME_IS_NULL.getCode(), EditInspectionCodeEnum.INSPECTION_TIME_IS_NULL.getMsg()); | |||||
} | |||||
Integer roadCount = roadInformationMapper.selectCount(Wrappers.<RoadInformation>lambdaQuery() | |||||
.eq(RoadInformation::getTenantId, tenantId) | |||||
.eq(RoadInformation::getId, editInspectionRequest.getRoadId()) | |||||
.eq(RoadInformation::getMark, 1)); | |||||
if (roadCount <= 0) { | |||||
return JsonResult.error(EditInspectionCodeEnum.ROAD_IS_NOT_EXIST.getCode(), EditInspectionCodeEnum.ROAD_IS_NOT_EXIST.getMsg()); | |||||
} | |||||
Integer sectionCount = sectionMapper.selectCount(Wrappers.<Section>lambdaQuery() | |||||
.eq(Section::getTenantId, tenantId) | |||||
.eq(Section::getId, editInspectionRequest.getSectionId()) | |||||
.eq(Section::getMark, 1)); | |||||
if (sectionCount <= 0) { | |||||
return JsonResult.error(EditInspectionCodeEnum.SECTION_IS_NOT_EXIST.getCode(), EditInspectionCodeEnum.SECTION_IS_NOT_EXIST.getMsg()); | |||||
} | |||||
return JsonResult.success(); | |||||
} | |||||
} |
import com.tuoheng.admin.entity.Dept; | import com.tuoheng.admin.entity.Dept; | ||||
import com.tuoheng.admin.entity.RoadDept; | import com.tuoheng.admin.entity.RoadDept; | ||||
import com.tuoheng.admin.entity.RoadInformation; | import com.tuoheng.admin.entity.RoadInformation; | ||||
import com.tuoheng.admin.enums.dept.QueryDeptChildListCodeEnum; | |||||
import com.tuoheng.admin.enums.road.QueryRoadListByDeptIdCodeEnum; | |||||
import com.tuoheng.admin.enums.code.road.QueryRoadListByDeptIdCodeEnum; | |||||
import com.tuoheng.admin.mapper.DeptMapper; | import com.tuoheng.admin.mapper.DeptMapper; | ||||
import com.tuoheng.admin.mapper.RoadDeptMapper; | import com.tuoheng.admin.mapper.RoadDeptMapper; | ||||
import com.tuoheng.admin.mapper.RoadInformationMapper; | import com.tuoheng.admin.mapper.RoadInformationMapper; |
import cn.hutool.core.collection.CollectionUtil; | import cn.hutool.core.collection.CollectionUtil; | ||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
import com.tuoheng.admin.conver.DeptConverMapper; | |||||
import com.tuoheng.admin.dto.RoadSectionDto; | |||||
import com.tuoheng.admin.entity.*; | import com.tuoheng.admin.entity.*; | ||||
import com.tuoheng.admin.enums.road.QueryRoadListByDeptIdCodeEnum; | |||||
import com.tuoheng.admin.enums.section.QuerySectionListByDeptIdCodeEnum; | |||||
import com.tuoheng.admin.enums.code.section.QuerySectionListByDeptIdCodeEnum; | |||||
import com.tuoheng.admin.mapper.*; | import com.tuoheng.admin.mapper.*; | ||||
import com.tuoheng.admin.utils.ShiroUtils; | import com.tuoheng.admin.utils.ShiroUtils; | ||||
import com.tuoheng.admin.vo.DeptInfoVo; | |||||
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; | ||||
import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
import org.springframework.stereotype.Service; | import org.springframework.stereotype.Service; | ||||
import java.util.ArrayList; | |||||
import java.util.HashMap; | import java.util.HashMap; | ||||
import java.util.List; | import java.util.List; | ||||
import java.util.Map; | import java.util.Map; | ||||
@Autowired | @Autowired | ||||
private SectionDeptMapper sectionDeptMapper; | private SectionDeptMapper sectionDeptMapper; | ||||
public JsonResult getRoadList(String id) { | |||||
public JsonResult getList(String id) { | |||||
log.info("进入根据部门Id查询路段列表业务"); | log.info("进入根据部门Id查询路段列表业务"); | ||||
String tenantId = ShiroUtils.getTenantId(); | String tenantId = ShiroUtils.getTenantId(); | ||||
package com.tuoheng.admin.service.section.query; | |||||
import cn.hutool.core.collection.CollectionUtil; | |||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||||
import com.tuoheng.admin.entity.Dept; | |||||
import com.tuoheng.admin.entity.RoadInformation; | |||||
import com.tuoheng.admin.entity.Section; | |||||
import com.tuoheng.admin.entity.SectionDept; | |||||
import com.tuoheng.admin.enums.code.section.QuerySectionListByDeptIdCodeEnum; | |||||
import com.tuoheng.admin.enums.code.section.QuerySectionListByRoadIdCodeEnum; | |||||
import com.tuoheng.admin.mapper.*; | |||||
import com.tuoheng.admin.utils.ShiroUtils; | |||||
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; | |||||
import java.util.stream.Collectors; | |||||
/** | |||||
* 根据公路id获取该公路下路段信息列表 | |||||
* | |||||
* @author wanjing | |||||
* @team tuoheng | |||||
* @date 2022-11-24 | |||||
*/ | |||||
@Slf4j | |||||
@Service | |||||
public class QuerySectionListByRoadIdService { | |||||
@Autowired | |||||
private RoadInformationMapper roadInformationMapper; | |||||
@Autowired | |||||
private SectionMapper sectionMapper; | |||||
@Autowired | |||||
private RoadDeptMapper roadDeptMapper; | |||||
@Autowired | |||||
private SectionDeptMapper sectionDeptMapper; | |||||
public JsonResult getList(String roadId) { | |||||
log.info("根据公路id获取该公路下路段信息列表业务"); | |||||
String tenantId = ShiroUtils.getTenantId(); | |||||
// 校验 | |||||
JsonResult result = this.check(tenantId, roadId); | |||||
if (0 != result.getCode()) { | |||||
log.info("根据公路id获取该公路下路段信息列表业务:校验失败:{}", result.getMsg()); | |||||
return result; | |||||
} | |||||
// 获取该公路下路段列表 | |||||
List<Section> sectionList = this.getSectionList(tenantId, roadId); | |||||
if (CollectionUtil.isEmpty(sectionList)) { | |||||
log.info("根据公路id获取该公路下路段信息列表业务:路段信息为空"); | |||||
return JsonResult.error(QuerySectionListByRoadIdCodeEnum.SECTION_LIST_IS_NULL.getCode(), QuerySectionListByRoadIdCodeEnum.SECTION_LIST_IS_NULL.getMsg()); | |||||
} | |||||
return JsonResult.success(sectionList); | |||||
} | |||||
/** | |||||
* 检查参数 | |||||
* | |||||
* @param tenantId | |||||
* @param roadId | |||||
* @return | |||||
*/ | |||||
private JsonResult check(String tenantId, String roadId) { | |||||
if (StringUtils.isEmpty(roadId)) { | |||||
return JsonResult.error(QuerySectionListByRoadIdCodeEnum.ROAD_ID_IS_NULL.getCode(), QuerySectionListByRoadIdCodeEnum.ROAD_ID_IS_NULL.getMsg()); | |||||
} | |||||
// 判断部门是否存在 | |||||
RoadInformation roadInformation = roadInformationMapper.selectOne(new LambdaQueryWrapper<RoadInformation>() | |||||
.eq(RoadInformation::getTenantId, tenantId) | |||||
.eq(RoadInformation::getId, roadId) | |||||
.eq(RoadInformation::getMark, 1)); | |||||
if (null == roadInformation) { | |||||
return JsonResult.error(QuerySectionListByRoadIdCodeEnum.ROAD_IS_NOT_EXIST.getCode(), QuerySectionListByRoadIdCodeEnum.ROAD_IS_NOT_EXIST.getMsg()); | |||||
} | |||||
return JsonResult.success(roadInformation); | |||||
} | |||||
/** | |||||
* 查询该公路下路段信息列表 | |||||
* | |||||
* @param tenantId | |||||
* @param roadId | |||||
* @return | |||||
*/ | |||||
private List<Section> getSectionList(String tenantId, String roadId) { | |||||
List<Section> sectionList = sectionMapper.selectList(new LambdaQueryWrapper<Section>() | |||||
.eq(Section::getTenantId, tenantId) | |||||
.eq(Section::getRoadId, roadId) | |||||
.eq(Section::getMark, 1)); | |||||
return sectionList; | |||||
} | |||||
} |
package com.tuoheng.admin.utils; | package com.tuoheng.admin.utils; | ||||
import com.tuoheng.admin.entity.User; | |||||
import com.tuoheng.common.core.exception.ServiceException; | |||||
import org.springframework.http.HttpStatus; | |||||
import java.util.Optional; | |||||
/** | /** | ||||
* Shiro工具类 | * Shiro工具类 | ||||
*/ | */ | ||||
private ShiroUtils() { | private ShiroUtils() { | ||||
} | } | ||||
/** | |||||
* 获取当前用户信息 | |||||
* | |||||
* @return | |||||
*/ | |||||
public static User getUserInfo() { | |||||
// return (User) SecurityUtils.getSubject().getPrincipal(); | |||||
return null; | |||||
} | |||||
/** | |||||
* 获取用户编号 | |||||
* | |||||
* @return | |||||
*/ | |||||
public static String getUserId() { | |||||
// User user = getUserInfo(); | |||||
// return Optional.ofNullable(user.getId()).orElseThrow(() -> | |||||
// new ServiceException(HttpStatus.BAD_REQUEST.value(), "未获取到当前用户信息!")); | |||||
return "1"; | |||||
} | |||||
/** | /** | ||||
* 租户ID | * 租户ID | ||||
* | * |
*/ | */ | ||||
private String pid; | private String pid; | ||||
/** | |||||
* 上级部门名称 | |||||
*/ | |||||
private String pname; | |||||
/** | /** | ||||
* 公路,路段数据 | * 公路,路段数据 | ||||
*/ | */ | ||||
private List<RoadSectionDto> roadSectionDtoList; | private List<RoadSectionDto> roadSectionDtoList; | ||||
/** | |||||
* 用户数 | |||||
*/ | |||||
private Integer userCount; | |||||
/** | |||||
* 子部门数 | |||||
*/ | |||||
private Integer childDeptCount; | |||||
} | } |
package com.tuoheng.admin.vo; | |||||
import com.tuoheng.common.core.common.BaseQuery; | |||||
import lombok.Data; | |||||
/** | |||||
* 查询巡检任务列表视图Vo | |||||
* | |||||
* @author wanjing | |||||
* @team tuoheng | |||||
* @date 2022-11-17 | |||||
*/ | |||||
@Data | |||||
public class QueryInspectionPageListVo { | |||||
/** | |||||
* 任务编号 | |||||
*/ | |||||
private String code; | |||||
/** | |||||
* 任务名称 | |||||
*/ | |||||
private String name; | |||||
/** | |||||
* 巡检机场id | |||||
*/ | |||||
private Integer airportId; | |||||
/** | |||||
* 巡检机场名称 | |||||
*/ | |||||
private String airportName; | |||||
/** | |||||
* 巡检线路Id | |||||
*/ | |||||
private Integer inspectionLine; | |||||
/** | |||||
* 巡检线路名称 | |||||
*/ | |||||
private String inspectionLineName; | |||||
/** | |||||
* 巡检任务类型: 1 临时巡检(目前只有该一种类型) | |||||
*/ | |||||
private Integer type; | |||||
/** | |||||
* 任务状态 | |||||
*/ | |||||
private Integer status; | |||||
/** | |||||
* 巡检方式类型: 1 无人机 2机场巡逻 3 飞手值飞 | |||||
*/ | |||||
private Integer inspectionType; | |||||
/** | |||||
* 部门Id | |||||
*/ | |||||
private String deptId; | |||||
/** | |||||
* 部门名称 | |||||
*/ | |||||
private String deptName; | |||||
/** | |||||
* 已确认问题 | |||||
*/ | |||||
// List<> | |||||
/** | |||||
* 发现问题 | |||||
*/ | |||||
/** | |||||
* 巡检时间 | |||||
*/ | |||||
} |
where id = #{id} | where id = #{id} | ||||
</update> | </update> | ||||
<delete id="deleteById" parameterType="com.tuoheng.admin.entity.Dept"> | |||||
<delete id="deleteById" parameterType="String"> | |||||
update th_dept | update th_dept | ||||
set mark = 0 | set mark = 0 | ||||
where id = #{id} | where id = #{id} |
<?xml version="1.0" encoding="UTF-8" ?> | |||||
<!DOCTYPE mapper | |||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
<mapper namespace="com.tuoheng.admin.mapper.InspectionFileHandleMapper"> | |||||
<resultMap type="com.tuoheng.admin.entity.InspectionFileHandle" id="InspectionFileHandleResult"> | |||||
<result property="id" column="id" /> | |||||
<result property="tenantId" column="tenant_id" /> | |||||
<result property="inspectionFileId" column="inspection_file_id" /> | |||||
<result property="handlerUser" column="handler_user" /> | |||||
<result property="handlerImage" column="handler_image" /> | |||||
<result property="handlerResult" column="handler_result" /> | |||||
<result property="handlerTime" column="handler_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" /> | |||||
</resultMap> | |||||
<sql id="selectThInspectionFileHandleVo"> | |||||
select id, tenant_id, inspection_file_id, handler_user, handler_image, handler_result, handler_time, create_user, create_time, update_user, update_time, mark from th_inspection_file_handle | |||||
</sql> | |||||
</mapper> |
<?xml version="1.0" encoding="UTF-8" ?> | |||||
<!DOCTYPE mapper | |||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
<mapper namespace="com.tuoheng.admin.mapper.InspectionFileMapper"> | |||||
<resultMap type="com.tuoheng.admin.entity.InspectionFile" id="InspectionFileResult"> | |||||
<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" /> | |||||
</resultMap> | |||||
<sql id="selectThInspectionFileVo"> | |||||
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> | |||||
</mapper> |
</resultMap> | </resultMap> | ||||
<sql id="selectInspectionVo"> | <sql id="selectInspectionVo"> | ||||
select id, tenant_id, dept_id, code, 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_inspection | |||||
select id, tenant_id, dept_id, code, 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_inspection | |||||
</sql> | </sql> | ||||
<select id="selectOneById" parameterType="com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest" resultMap="InspectionResult"> | <select id="selectOneById" parameterType="com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest" resultMap="InspectionResult"> | ||||
<include refid="selectInspectionVo"/> | <include refid="selectInspectionVo"/> | ||||
<where> | <where> | ||||
<if test="1 == 1"> and mark = 1 </if> | <if test="1 == 1"> and mark = 1 </if> | ||||
<if test="code != null and code != ''"> and code like concat('%', #{code}, '%')</if> | |||||
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if> | |||||
<if test="request.key != null and request.key != ''"> and ((code like concat('%', #{request.code}, '%')) or (name like concat('%', #{request.name}, '%'))) </if> | |||||
<if test="request.airportId != null and request.airportId != 0"> and airport_id = #{request.inspectionLine} </if> | |||||
<if test="request.inspectionLine != null and request.inspectionLine != 0"> and inspection_line = #{request.inspectionLine} </if> | |||||
<if test="request.type != null and request.type != 0"> and type = #{request.type} </if> | |||||
<if test="request.status != null and request.status != 0"> and status = #{request.status} </if> | |||||
<if test="request.inspectionType != null and request.inspectionType != 0"> and inspection_type = #{request.inspectionType} </if> | |||||
<!-- <if test="request.name != null and request.name != ''">--> | |||||
<!-- and dept_id in--> | |||||
<!-- <foreach item="id" collection="array" open="(" separator="," close=")">--> | |||||
<!-- #{id}--> | |||||
<!-- </foreach>--> | |||||
<!-- </if>--> | |||||
</where> | </where> | ||||
</select> | </select> | ||||
<select id="selectList" parameterType="com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest" resultMap="InspectionResult"> | <select id="selectList" parameterType="com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest" resultMap="InspectionResult"> | ||||
<include refid="selectInspectionVo"/> | <include refid="selectInspectionVo"/> | ||||
<where> | |||||
<where> | |||||
<if test="tenantId != null and tenantId != ''"> and tenant_id = #{tenantId}</if> | <if test="tenantId != null and tenantId != ''"> and tenant_id = #{tenantId}</if> | ||||
<if test="deptId != null and deptId != ''"> and dept_id = #{deptId}</if> | <if test="deptId != null and deptId != ''"> and dept_id = #{deptId}</if> | ||||
<if test="code != null and code != ''"> and code = #{code}</if> | <if test="code != null and code != ''"> and code = #{code}</if> | ||||
</where> | </where> | ||||
</select> | </select> | ||||
<insert id="insert" parameterType="com.tuoheng.admin.entity.Inspection" | |||||
keyColumn="id" keyProperty="id" useGeneratedKeys="true"> | |||||
insert into th_inspection | |||||
<trim prefix="(" suffix=")" suffixOverrides=","> | |||||
<if test="id != null">id,</if> | |||||
<if test="tenantId != null and tenantId != ''">tenant_id,</if> | |||||
<if test="deptId != null and deptId != ''">dept_id,</if> | |||||
<if test="code != null">code,</if> | |||||
<if test="name != null">name,</if> | |||||
<if test="type != null">type,</if> | |||||
<if test="roadId != null and roadId != ''">road_id,</if> | |||||
<if test="roadName != null">road_name,</if> | |||||
<if test="sectionId != null and sectionId != ''">section_id,</if> | |||||
<if test="sectionName != null">section_name,</if> | |||||
<if test="inspectionType != null">inspection_type,</if> | |||||
<if test="airportId != null">airport_id,</if> | |||||
<if test="airportName != null">airport_name,</if> | |||||
<if test="inspectionLine != null">inspection_line,</if> | |||||
<if test="inspectionLineName != null">inspection_line_name,</if> | |||||
<if test="equipmentId != null">equipment_id,</if> | |||||
<if test="equipmentName != null">equipment_name,</if> | |||||
<if test="equipmentMountId != null">equipment_mount_id,</if> | |||||
<if test="equipmentMountName != null">equipment_mount_name,</if> | |||||
<if test="cloudBoxId != null">cloud_box_id,</if> | |||||
<if test="cloudBoxName != null">cloud_box_name,</if> | |||||
<if test="boxSn != null">box_sn,</if> | |||||
<if test="flightHand != null">flight_hand,</if> | |||||
<if test="flightHandName != null">flight_hand_name,</if> | |||||
<if test="inspectionTime != null">inspection_time,</if> | |||||
<if test="executionStartTime != null">execution_start_time,</if> | |||||
<if test="executionEndTime != null">execution_end_time,</if> | |||||
<if test="isLive != null">is_live,</if> | |||||
<if test="isTaken != null">is_taken,</if> | |||||
<if test="isTilt != null">is_tilt,</if> | |||||
<if test="videoUrl != null">video_url,</if> | |||||
<if test="aiVideoUrl != null">ai_video_url,</if> | |||||
<if test="reportUrl != null">report_url,</if> | |||||
<if test="srtUrl != null">srt_url,</if> | |||||
<if test="status != null">status,</if> | |||||
<if test="analyseStatus != null">analyse_status,</if> | |||||
<if test="progressbar != null">progressbar,</if> | |||||
<if test="note != null">note,</if> | |||||
<if test="weather != null">weather,</if> | |||||
<if test="flyHeight != null">fly_height,</if> | |||||
<if test="srtName != null">srt_name,</if> | |||||
<if test="heartbeatTime != null">heartbeat_time,</if> | |||||
<if test="executionStatus != null">execution_status,</if> | |||||
<if test="startLongitude != null">start_longitude,</if> | |||||
<if test="startLatitude != null">start_latitude,</if> | |||||
<if test="endLongitude != null">end_longitude,</if> | |||||
<if test="endLatitude != null">end_latitude,</if> | |||||
<if test="mobile != null">mobile,</if> | |||||
<if test="patrolLocation != null">patrol_location,</if> | |||||
<if test="createUser != null">create_user,</if> | |||||
<if test="createTime != null">create_time,</if> | |||||
<if test="updateUser != null">update_user,</if> | |||||
<if test="updateTime != null">update_time,</if> | |||||
<if test="mark != null">mark,</if> | |||||
</trim> | |||||
<trim prefix="values (" suffix=")" suffixOverrides=","> | |||||
<if test="id != null">#{id},</if> | |||||
<if test="tenantId != null and tenantId != ''">#{tenantId},</if> | |||||
<if test="deptId != null and deptId != ''">#{deptId},</if> | |||||
<if test="code != null">#{code},</if> | |||||
<if test="name != null">#{name},</if> | |||||
<if test="type != null">#{type},</if> | |||||
<if test="roadId != null and roadId != ''">#{roadId},</if> | |||||
<if test="roadName != null">#{roadName},</if> | |||||
<if test="sectionId != null and sectionId != ''">#{sectionId},</if> | |||||
<if test="sectionName != null">#{sectionName},</if> | |||||
<if test="inspectionType != null">#{inspectionType},</if> | |||||
<if test="airportId != null">#{airportId},</if> | |||||
<if test="airportName != null">#{airportName},</if> | |||||
<if test="inspectionLine != null">#{inspectionLine},</if> | |||||
<if test="inspectionLineName != null">#{inspectionLineName},</if> | |||||
<if test="equipmentId != null">#{equipmentId},</if> | |||||
<if test="equipmentName != null">#{equipmentName},</if> | |||||
<if test="equipmentMountId != null">#{equipmentMountId},</if> | |||||
<if test="equipmentMountName != null">#{equipmentMountName},</if> | |||||
<if test="cloudBoxId != null">#{cloudBoxId},</if> | |||||
<if test="cloudBoxName != null">#{cloudBoxName},</if> | |||||
<if test="boxSn != null">#{boxSn},</if> | |||||
<if test="flightHand != null">#{flightHand},</if> | |||||
<if test="flightHandName != null">#{flightHandName},</if> | |||||
<if test="inspectionTime != null">#{inspectionTime},</if> | |||||
<if test="executionStartTime != null">#{executionStartTime},</if> | |||||
<if test="executionEndTime != null">#{executionEndTime},</if> | |||||
<if test="isLive != null">#{isLive},</if> | |||||
<if test="isTaken != null">#{isTaken},</if> | |||||
<if test="isTilt != null">#{isTilt},</if> | |||||
<if test="videoUrl != null">#{videoUrl},</if> | |||||
<if test="aiVideoUrl != null">#{aiVideoUrl},</if> | |||||
<if test="reportUrl != null">#{reportUrl},</if> | |||||
<if test="srtUrl != null">#{srtUrl},</if> | |||||
<if test="status != null">#{status},</if> | |||||
<if test="analyseStatus != null">#{analyseStatus},</if> | |||||
<if test="progressbar != null">#{progressbar},</if> | |||||
<if test="note != null">#{note},</if> | |||||
<if test="weather != null">#{weather},</if> | |||||
<if test="flyHeight != null">#{flyHeight},</if> | |||||
<if test="srtName != null">#{srtName},</if> | |||||
<if test="heartbeatTime != null">#{heartbeatTime},</if> | |||||
<if test="executionStatus != null">#{executionStatus},</if> | |||||
<if test="startLongitude != null">#{startLongitude},</if> | |||||
<if test="startLatitude != null">#{startLatitude},</if> | |||||
<if test="endLongitude != null">#{endLongitude},</if> | |||||
<if test="endLatitude != null">#{endLatitude},</if> | |||||
<if test="mobile != null">#{mobile},</if> | |||||
<if test="patrolLocation != null">#{patrolLocation},</if> | |||||
<if test="createUser != null">#{createUser},</if> | |||||
<if test="createTime != null">#{createTime},</if> | |||||
<if test="updateUser != null">#{updateUser},</if> | |||||
<if test="updateTime != null">#{updateTime},</if> | |||||
<if test="mark != null">#{mark},</if> | |||||
</trim> | |||||
</insert> | |||||
<update id="update" parameterType="com.tuoheng.admin.entity.Inspection"> | <update id="update" parameterType="com.tuoheng.admin.entity.Inspection"> | ||||
update th_inspection | update th_inspection | ||||
<trim prefix="SET" suffixOverrides=","> | <trim prefix="SET" suffixOverrides=","> | ||||
</update> | </update> | ||||
<delete id="deleteById" parameterType="String"> | <delete id="deleteById" parameterType="String"> | ||||
delete from th_inspection where id = #{id} | |||||
</delete> | |||||
<delete id="deleteByIds" parameterType="String"> | |||||
delete from th_inspection where id in | |||||
<foreach item="id" collection="array" open="(" separator="," close=")"> | |||||
#{id} | |||||
</foreach> | |||||
update th_inspection | |||||
set mark = 0 | |||||
where id = #{id} | |||||
</delete> | </delete> | ||||
</mapper> | </mapper> |
<?xml version="1.0" encoding="UTF-8" ?> | |||||
<!DOCTYPE mapper | |||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> | |||||
<mapper namespace="com.tuoheng.admin.mapper.TenantMapper"> | |||||
<resultMap type="com.tuoheng.admin.entity.Tenant" id="TenantResult"> | |||||
<result property="id" column="id" /> | |||||
<result property="name" column="name" /> | |||||
<result property="code" column="code" /> | |||||
<result property="username" column="username" /> | |||||
<result property="logo" column="logo" /> | |||||
<result property="portraitUrl" column="portrait_url" /> | |||||
<result property="pid" column="pid" /> | |||||
<result property="type" column="type" /> | |||||
<result property="phone" column="phone" /> | |||||
<result property="email" column="email" /> | |||||
<result property="provinceCode" column="province_code" /> | |||||
<result property="provinceName" column="province_name" /> | |||||
<result property="cityCode" column="city_code" /> | |||||
<result property="cityName" column="city_name" /> | |||||
<result property="districtCode" column="district_code" /> | |||||
<result property="districtName" column="district_name" /> | |||||
<result property="platformName" column="platform_name" /> | |||||
<result property="airportUrl" column="airport_url" /> | |||||
<result property="address" column="address" /> | |||||
<result property="intro" column="intro" /> | |||||
<result property="status" column="status" /> | |||||
<result property="note" column="note" /> | |||||
<result property="sort" column="sort" /> | |||||
<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" /> | |||||
</resultMap> | |||||
<sql id="selectThTenantVo"> | |||||
select id, name, code, username, logo, portrait_url, pid, type, phone, email, province_code, province_name, city_code, city_name, district_code, district_name, platform_name, airport_url, address, intro, status, note, sort, create_user, create_time, update_user, update_time, mark from th_tenant | |||||
</sql> | |||||
</mapper> |