@@ -1,12 +1,12 @@ | |||
package com.tuoheng.admin.controller; | |||
import com.tuoheng.admin.query.InspectionFileQuery; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileDistributionListRequest; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest; | |||
import com.tuoheng.admin.service.IInspectionFileService; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.beans.factory.annotation.Qualifier; | |||
import org.springframework.web.bind.annotation.*; | |||
import java.util.List; | |||
@@ -32,7 +32,7 @@ public class InspectionFileController { | |||
} | |||
/** | |||
* 根据登录人角色获取该部门及子部门下问题列表 | |||
* 根据登录人角色获取该部门及子部门下任务问题列表 | |||
* @param query | |||
* @return | |||
*/ | |||
@@ -42,7 +42,7 @@ public class InspectionFileController { | |||
} | |||
/** | |||
* 查询任务分页列表 | |||
* 查询任务问题分页列表 | |||
* | |||
* @return | |||
*/ | |||
@@ -52,7 +52,7 @@ public class InspectionFileController { | |||
} | |||
/** | |||
* 根据任务ID查询任务分页列表 | |||
* 根据任务ID查询任务问题分页列表 | |||
* | |||
* @return | |||
*/ | |||
@@ -93,4 +93,13 @@ public class InspectionFileController { | |||
return iInspectionFileService.getHandle(id); | |||
} | |||
/** | |||
* 查询任务问题分布列表 | |||
* | |||
* @return | |||
*/ | |||
@GetMapping("/list/distribution") | |||
public JsonResult getDistributionList(QueryInspectionFileDistributionListRequest request){ | |||
return iInspectionFileService.getDistributionList(request); | |||
} | |||
} |
@@ -0,0 +1,64 @@ | |||
package com.tuoheng.admin.controller; | |||
import com.tuoheng.admin.request.workorder.DistributionWorkorderRequest; | |||
import com.tuoheng.admin.request.workorder.QueryWorkOrderPageListRequest; | |||
import com.tuoheng.admin.service.workorder.IWorkorderService; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.*; | |||
import java.util.List; | |||
/** | |||
* @Author ChengWang | |||
* @Date 2022/11/29 | |||
*/ | |||
@Slf4j | |||
@RestController | |||
@RequestMapping("/workorder") | |||
public class WorkOrderController { | |||
@Autowired | |||
private IWorkorderService iWorkorderService; | |||
/** | |||
* 生成工单 | |||
* | |||
* @param idList | |||
* @return | |||
*/ | |||
@PostMapping("/generate/{idList}") | |||
public JsonResult generate(@PathVariable("idList") List<String> idList) { | |||
return iWorkorderService.generate(idList); | |||
} | |||
/** | |||
* 查询工单分页列表 | |||
* | |||
* @param | |||
* @return | |||
*/ | |||
@GetMapping("/page/list") | |||
public JsonResult getPageList(QueryWorkOrderPageListRequest request) { | |||
return iWorkorderService.getPageList(request); | |||
} | |||
/** | |||
* 获取工单详情信息 | |||
*/ | |||
@GetMapping("/details/{id}") | |||
public JsonResult getDetails(@PathVariable("id") String id) { | |||
log.info("进入工单详情接口, id={}", id); | |||
return iWorkorderService.getDetails(id); | |||
} | |||
/** | |||
* 分配工单 | |||
*/ | |||
@PostMapping("/distribution") | |||
public JsonResult distribution(@RequestBody DistributionWorkorderRequest request) { | |||
log.info("进入分配工单接口, request={}", request); | |||
return iWorkorderService.distribution(request); | |||
} | |||
} |
@@ -1,7 +1,9 @@ | |||
package com.tuoheng.admin.conver; | |||
import com.tuoheng.admin.entity.InspectionFile; | |||
import com.tuoheng.admin.entity.InspectionFileDistribution; | |||
import com.tuoheng.admin.entity.InspectionFileExtend; | |||
import com.tuoheng.admin.vo.InspectionFileDistributionListVo; | |||
import com.tuoheng.admin.vo.InspectionFilePageListByInspectionIdVo; | |||
import com.tuoheng.admin.vo.InspectionFilePageListVo; | |||
import org.mapstruct.Mapper; | |||
@@ -18,4 +20,5 @@ public interface InspectionFileConverMapper { | |||
List<InspectionFilePageListVo> fromInspectionFileExtendListToInspectionFilePageListVoList(List<InspectionFileExtend> inspectionFileExtendList); | |||
List<InspectionFileDistributionListVo> fromInspectionFileDistributionListToInspectionFileDistributionListVoList(List<InspectionFileDistribution> inspectionFileDistributionList); | |||
} |
@@ -0,0 +1,17 @@ | |||
package com.tuoheng.admin.conver; | |||
import com.tuoheng.admin.entity.WorkOrder; | |||
import com.tuoheng.admin.vo.WorkOrderPageListVo; | |||
import org.mapstruct.Mapper; | |||
import org.mapstruct.factory.Mappers; | |||
import java.util.List; | |||
@Mapper | |||
public interface WorkOrderConverMapper { | |||
WorkOrderConverMapper INSTANCE = Mappers.getMapper(WorkOrderConverMapper.class); | |||
List<WorkOrderPageListVo> fromWorkOrderListToWorkOrderPageListVoList(List<WorkOrder> workOrderList); | |||
} |
@@ -0,0 +1,91 @@ | |||
package com.tuoheng.admin.entity; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.tuoheng.common.core.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import java.math.BigDecimal; | |||
import java.util.Date; | |||
/** | |||
* 巡检任务问题分布 | |||
* | |||
* @team tuoheng | |||
* @author wanjing | |||
* @date 2022-12-08 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
public class InspectionFileDistribution extends BaseEntity { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private String tenantId; | |||
/** | |||
* 缩略图 | |||
*/ | |||
private String fileThumbnail; | |||
/** | |||
* 纬度(原始图片纬度) | |||
*/ | |||
private String latitude; | |||
/** | |||
* 经度(原始图片经度) | |||
*/ | |||
private String longitude; | |||
/** | |||
* 位置信息 | |||
*/ | |||
private String location; | |||
/** | |||
* 高德地图经度 | |||
*/ | |||
private String gaodeLongitude; | |||
/** | |||
* 高德地图纬度 | |||
*/ | |||
private String gaodeLatitude; | |||
/** | |||
* 高德地图地址 | |||
*/ | |||
private String gaodeAddress; | |||
/** | |||
* 问题类型二级分类ID | |||
*/ | |||
private String questionId; | |||
/** | |||
* 问题名称 | |||
*/ | |||
private String questionName; | |||
/** | |||
* 状态:5待确认 10已忽略 15已确认 20已生成工单 25问题已处理 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 任务编号 | |||
*/ | |||
private String inspectionCode; | |||
/** | |||
* 任务名称 | |||
*/ | |||
private String inspectionName; | |||
} |
@@ -0,0 +1,80 @@ | |||
package com.tuoheng.admin.entity; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.tuoheng.common.core.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import java.util.Date; | |||
/** | |||
* 巡检问题工单对象 th_work_order | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-07 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_work_order") | |||
public class WorkOrder extends BaseEntity { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private String tenantId; | |||
/** | |||
* 部门ID | |||
*/ | |||
private String deptId; | |||
/** | |||
* 问题工单号 | |||
*/ | |||
private String code; | |||
/** | |||
* 工单状态:5待分配 10处理中(已分配) 15已完成 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 分配人员ID | |||
*/ | |||
private String distributionId; | |||
/** | |||
* 指派部门ID | |||
*/ | |||
private String assignDeptId; | |||
/** | |||
* 指派负责人 | |||
*/ | |||
private String assignUser; | |||
/** | |||
* 指派负责人联系方式 | |||
*/ | |||
private String assignContact; | |||
/** | |||
* 指派备注 | |||
*/ | |||
private String assignNote; | |||
/** | |||
* 指派时间 | |||
*/ | |||
@JsonFormat(pattern = "yyyy-MM-dd") | |||
private Date assignTime; | |||
} |
@@ -0,0 +1,36 @@ | |||
package com.tuoheng.admin.entity; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import lombok.Data; | |||
import lombok.experimental.Accessors; | |||
/** | |||
* 巡检问题工单子对象 th_work_order_file | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-11-16 | |||
*/ | |||
@Data | |||
@Accessors(chain = true) | |||
@TableName("th_work_order_file") | |||
public class WorkOrderFile { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 租户ID | |||
*/ | |||
private String tenantId; | |||
/** | |||
* 巡检问题工单ID | |||
*/ | |||
private String workOrderId; | |||
/** | |||
* 巡检问题文件ID | |||
*/ | |||
private String inspectionFileId; | |||
} |
@@ -0,0 +1,29 @@ | |||
package com.tuoheng.admin.enums; | |||
import lombok.Getter; | |||
/** | |||
* 工单状态类型 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-07 | |||
*/ | |||
public enum WorkOrderStatusEnum { | |||
WAIT(5,"待分配"), | |||
PROCESSING(10,"处理中(已分配)"), | |||
COMPLETED(13,"已完成"); | |||
WorkOrderStatusEnum(int code, String description){ | |||
this.code = code; | |||
this.description = description; | |||
} | |||
@Getter | |||
private int code; | |||
@Getter | |||
private String description; | |||
} |
@@ -0,0 +1,55 @@ | |||
package com.tuoheng.admin.enums.code.workorder; | |||
/** | |||
* 分配工单返回码 | |||
* 模块代码:26(工单管理) | |||
* 接口代码:04 (分配工单) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-08 | |||
*/ | |||
public enum DistributionWorkorderCodeEnum { | |||
DISTRIBUTION_IS_FAILED(1260400, "分配工单失败"), | |||
ID_LIST_IS_NULL(1260401, "工单id列表为空"), | |||
WORK_ORDER_IS_NOT_EXIST(1260402, "工单不存在"), | |||
ASSIGN_DEPT_ID_IS_NULL(1260403, "指派部门ID为空"), | |||
ASSIGN_USER_ID_IS_NULL(1260404, "指派负责人"), | |||
ASSIGN_USER_ID_IS_NOT_EXIST(1260405, "指派负责人不存在"), | |||
SUPER_ADMIN_NOT_DISTRIBUTION(1260406, "超级管理员不能分配工单"), | |||
ADMIN_NOT_DISTRIBUTION_CHILD_DEPT_WORK_ORDER(1260407, "管理员不能分配子部门工单"), | |||
ORDINARY_USER_NOT_DISTRIBUTION(1260408, "普通用户不能分配工单"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
DistributionWorkorderCodeEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -0,0 +1,53 @@ | |||
package com.tuoheng.admin.enums.code.workorder; | |||
/** | |||
* 生成工单返回码 | |||
* 模块代码:26(工单管理) | |||
* 接口代码:01 (生成工单) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-07 | |||
*/ | |||
public enum GenerateWorkorderCodeEnum { | |||
GENERATE_IS_FAILED(1260100, "生成工单失败"), | |||
ID_LIST_IS_NULL(1260101, "任务问题id列表为空"), | |||
INSPECTION_FILE_ID_LIST_IS_NOT_EXIST(1260102, "任务问题不存在"), | |||
INCLUDE_NO_CONFIRMED_INSPECTION(1260103, "包含非确认状态任务问题"), | |||
ADMIN_NOT_GENERATE_CHILD_WORKORDER(1260104, "管理员不能生成子部门工单"), | |||
ORDINARY_USER_NO_PERMISSION_TO_GENERATE(1260105, "普通用户不能生成工单"), | |||
; | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
GenerateWorkorderCodeEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -0,0 +1,49 @@ | |||
package com.tuoheng.admin.enums.code.workorder; | |||
/** | |||
* 工单详情返回码 | |||
* 模块代码:26(工单管理) | |||
* 接口代码:02 (工单详情) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-08 | |||
*/ | |||
public enum QueryWorkOrderDetailsCodeEnum { | |||
QUERY_IS_FAILED(1260200, "查看工单详情失败"), | |||
ID_IS_NULL(1260201, "工单id"), | |||
WORK_ORDER_IS_NOT_EXIST(1260202, "工单不存在"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
QueryWorkOrderDetailsCodeEnum(int code, String msg){ | |||
this.code = code; | |||
this.msg = msg; | |||
} | |||
public int getCode() { | |||
return code; | |||
} | |||
public void setCode(int code) { | |||
this.code = code; | |||
} | |||
public String getMsg() { | |||
return msg; | |||
} | |||
public void setMsg(String msg) { | |||
this.msg = msg; | |||
} | |||
} |
@@ -0,0 +1,47 @@ | |||
package com.tuoheng.admin.enums.code.workorder; | |||
/** | |||
* 查询工单分页列表返回码 | |||
* 模块代码:26(工单管理) | |||
* 接口代码:03 (查询工单分页列表) | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-08 | |||
*/ | |||
public enum QueryWorkOrderPageListCodeEnum { | |||
QUERY_IS_FAILED(1260300, "查询工单分页列表失败"); | |||
/** | |||
* 错误码 | |||
*/ | |||
private int code; | |||
/** | |||
* 错误信息 | |||
*/ | |||
private String msg; | |||
QueryWorkOrderPageListCodeEnum(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; | |||
} | |||
} |
@@ -5,8 +5,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.entity.InspectionFile; | |||
import com.tuoheng.admin.entity.InspectionFileDistribution; | |||
import com.tuoheng.admin.entity.InspectionFileExtend; | |||
import com.tuoheng.admin.request.inspection.QueryInspectionPageListRequest; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileDistributionListRequest; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest; | |||
import org.apache.ibatis.annotations.Param; | |||
@@ -61,4 +63,11 @@ public interface InspectionFileMapper extends BaseMapper<InspectionFile> { | |||
*/ | |||
Page<InspectionFileExtend> selectPageList(@Param("page") IPage page, @Param("request") QueryInspectionFilePageListRequest request); | |||
/** | |||
* 查询任务问题分布列表 | |||
* | |||
* @param request 巡检任务查询实体 | |||
* @return 巡检任务集合 | |||
*/ | |||
List<InspectionFileDistribution> selectDistributionList(@Param("request") QueryInspectionFileDistributionListRequest request); | |||
} |
@@ -0,0 +1,19 @@ | |||
package com.tuoheng.admin.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.tuoheng.admin.entity.WorkOrderFile; | |||
import java.util.List; | |||
/** | |||
* 巡检问题工单子Mapper接口 | |||
* | |||
* @team tuoheng | |||
* @author wanjing | |||
* @date 2022-12-07 | |||
*/ | |||
public interface WorkOrderFileMapper extends BaseMapper<WorkOrderFile> { | |||
int insertBatch(List<WorkOrderFile> workOrderFileList); | |||
} |
@@ -0,0 +1,32 @@ | |||
package com.tuoheng.admin.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.entity.WorkOrder; | |||
import com.tuoheng.admin.request.workorder.QueryWorkOrderPageListRequest; | |||
import org.apache.ibatis.annotations.Param; | |||
/** | |||
* 巡检工单Mapper接口 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-07 | |||
*/ | |||
public interface WorkOrderMapper extends BaseMapper<WorkOrder> { | |||
/** | |||
* 分配工单 | |||
*/ | |||
Integer update(WorkOrder workOrder); | |||
/** | |||
* 查询工单分页列表 | |||
* | |||
* @param request 巡检任务查询实体 | |||
* @return 巡检任务集合 | |||
*/ | |||
Page<WorkOrder> selectPageList(@Param("page") IPage page, @Param("request") QueryWorkOrderPageListRequest request); | |||
} |
@@ -0,0 +1,38 @@ | |||
package com.tuoheng.admin.request.inspectionfile; | |||
import com.tuoheng.common.core.common.BaseQuery; | |||
import lombok.Data; | |||
import java.util.List; | |||
/** | |||
* 查询巡检任务分配请求实体 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-08 | |||
*/ | |||
@Data | |||
public class QueryInspectionFileDistributionListRequest { | |||
/** | |||
* 任务名称 | |||
*/ | |||
private String inspectionName; | |||
/** | |||
* 问题类型 | |||
*/ | |||
private String questionId; | |||
/** | |||
* 问题状态:5待确认 10已忽略 15已确认 20已生成工单 25问题已处理 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 部门及子部门Id列表 | |||
*/ | |||
private List<String> deptIdList; | |||
} |
@@ -0,0 +1,30 @@ | |||
package com.tuoheng.admin.request.workorder; | |||
import lombok.Data; | |||
/** | |||
* 分配工单请求实体 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-08 | |||
*/ | |||
@Data | |||
public class DistributionWorkorderRequest { | |||
/** | |||
* 工单Id | |||
*/ | |||
private String workorderId; | |||
/** | |||
* 指派部门ID | |||
*/ | |||
private String assignDeptId; | |||
/** | |||
* 指派负责人 | |||
*/ | |||
private String assignUserIds; | |||
} |
@@ -0,0 +1,31 @@ | |||
package com.tuoheng.admin.request.workorder; | |||
import com.tuoheng.common.core.common.BaseQuery; | |||
import lombok.Data; | |||
/** | |||
* 生成工单请求实体 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-07 | |||
*/ | |||
@Data | |||
public class GenerateWorkorderRequest { | |||
/** | |||
* 任务Id | |||
*/ | |||
private String inspectionId; | |||
/** | |||
* 问题类型 | |||
*/ | |||
private String questionId; | |||
/** | |||
* 问题状态:5待确认 10已忽略 15已确认 20已生成工单 25问题已处理 | |||
*/ | |||
private Integer status; | |||
} |
@@ -0,0 +1,60 @@ | |||
package com.tuoheng.admin.request.workorder; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.tuoheng.common.core.common.BaseQuery; | |||
import lombok.Data; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.util.Date; | |||
import java.util.List; | |||
/** | |||
* 查询工单分页列表请求实体 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-07 | |||
*/ | |||
@Data | |||
public class QueryWorkOrderPageListRequest extends BaseQuery { | |||
/** | |||
* 问题工单号 | |||
*/ | |||
private String code; | |||
/** | |||
* 工单状态:5待分配 10处理中(已分配) 15已完成 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 工单生成开始时间 | |||
*/ | |||
@JsonFormat(pattern = "yyyy-MM-dd") | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
private Date beginTime; | |||
/** | |||
* 工单生成结束时间 | |||
*/ | |||
@JsonFormat(pattern = "yyyy-MM-dd") | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
private Date endTime; | |||
/** | |||
* 用户所在部门ID | |||
*/ | |||
private String userDeptId; | |||
/** | |||
* 检索条件中选择的部门ID | |||
*/ | |||
private String deptId; | |||
/** | |||
* 部门idList | |||
*/ | |||
private List<String> deptIdList; | |||
} |
@@ -1,6 +1,7 @@ | |||
package com.tuoheng.admin.service; | |||
import com.tuoheng.admin.query.InspectionFileQuery; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileDistributionListRequest; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
@@ -60,4 +61,13 @@ public interface IInspectionFileService { | |||
* @return | |||
*/ | |||
JsonResult getHandle(String id); | |||
/** | |||
* | |||
* 查询任务问题分布列表 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
JsonResult getDistributionList(QueryInspectionFileDistributionListRequest request); | |||
} |
@@ -13,12 +13,14 @@ import com.tuoheng.admin.enums.code.inspectionfile.ListByDeptUserTypeEnum; | |||
import com.tuoheng.admin.enums.code.questiontype.QuestionTypeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.query.InspectionFileQuery; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileDistributionListRequest; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListRequest; | |||
import com.tuoheng.admin.service.IInspectionFileService; | |||
import com.tuoheng.admin.service.inspectionfile.confirm.InspectionFileConfirmService; | |||
import com.tuoheng.admin.service.inspectionfile.handle.QueryInspectionFileHandleByInspectionFileIdService; | |||
import com.tuoheng.admin.service.inspectionfile.ignore.InspectionFileIgnoreService; | |||
import com.tuoheng.admin.service.inspectionfile.query.QueryInspectionFileDistributionListService; | |||
import com.tuoheng.admin.service.inspectionfile.query.QueryInspectionFilePageListByInspectionIdService; | |||
import com.tuoheng.admin.service.inspectionfile.query.QueryInspectionFilePageListService; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
@@ -78,6 +80,9 @@ public class InspectionFileServiceImpl implements IInspectionFileService { | |||
@Autowired | |||
private QueryInspectionFileHandleByInspectionFileIdService queryInspectionFileHandleByInspectionFileIdService; | |||
@Autowired | |||
private QueryInspectionFileDistributionListService queryInspectionFileDistributionListService; | |||
/** | |||
* 问题类型和任务名称 | |||
* | |||
@@ -322,4 +327,16 @@ public class InspectionFileServiceImpl implements IInspectionFileService { | |||
public JsonResult getHandle(String id) { | |||
return queryInspectionFileHandleByInspectionFileIdService.handle(id); | |||
} | |||
/** | |||
* | |||
* 查询任务问题分布列表 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult getDistributionList(QueryInspectionFileDistributionListRequest request) { | |||
return queryInspectionFileDistributionListService.getList(request); | |||
} | |||
} |
@@ -0,0 +1,153 @@ | |||
package com.tuoheng.admin.service.inspectionfile.query; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.conver.InspectionFileConverMapper; | |||
import com.tuoheng.admin.entity.*; | |||
import com.tuoheng.admin.enums.UserTypeEnum; | |||
import com.tuoheng.admin.enums.code.inspection.QueryInspectionPageListCodeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFileDistributionListRequest; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.vo.InspectionFileDistributionListVo; | |||
import com.tuoheng.admin.vo.InspectionFilePageListVo; | |||
import com.tuoheng.common.core.config.common.CommonConfig; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.function.Function; | |||
import java.util.stream.Collectors; | |||
/** | |||
* 查询任务问题分布列表业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-08 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class QueryInspectionFileDistributionListService { | |||
@Autowired | |||
private UserMapper userMapper; | |||
@Autowired | |||
private DeptMapper deptMapper; | |||
@Autowired | |||
private InspectionMapper inspectionMapper; | |||
@Autowired | |||
private InspectionFileMapper inspectionFileMapper; | |||
@Autowired | |||
private QuestionTypeMapper questionTypeMapper; | |||
@Autowired | |||
private RoadInformationMapper roadInformationMapper; | |||
public JsonResult getList(QueryInspectionFileDistributionListRequest request) { | |||
log.info("进入查询任务问题分布列表业务, request:{}", request.toString()); | |||
String userId = ShiroUtils.getUserId(); | |||
JsonResult result = this.check(request); | |||
if (0 != result.getCode()) { | |||
log.info("进入查询任务问题分布列表业务:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
// 获取部门Id的查询范围 | |||
List<String> deptIdList = this.getDeptIdList(userId); | |||
request.setDeptIdList(deptIdList); | |||
// 查询结果 | |||
List<InspectionFileDistribution> inspectionFileDistributionList = inspectionFileMapper.selectDistributionList(request); | |||
if (null == inspectionFileDistributionList || inspectionFileDistributionList.size() == 0) { | |||
log.info("获取任务问题分布列表为空"); | |||
return JsonResult.success(null, QueryInspectionPageListCodeEnum.DATA_IS_FAILED.getMsg()); | |||
} | |||
// 构造返回结果对象 | |||
List<InspectionFileDistributionListVo> inspectionFileDistributionListVoList = this.buildInspectionFileDistributionListVo(inspectionFileDistributionList); | |||
return JsonResult.success(inspectionFileDistributionListVoList); | |||
} | |||
/** | |||
* 检查参数 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
private JsonResult check(QueryInspectionFileDistributionListRequest request) { | |||
return JsonResult.success(); | |||
} | |||
/** | |||
* 获取部门Id的查询范围 | |||
* 1)、deptId:如果传了值,查该部门的任务 | |||
* 2)、deptId:如果没有传值 | |||
* 2.1)、管理员:可查全部确认问题 | |||
* 2.2)、管理员/普通用户:本部门及子部门创建的任务中已确认问题 | |||
* | |||
* @param userId | |||
* @return | |||
*/ | |||
private List<String> getDeptIdList(String userId) { | |||
List<String> deptIdList; | |||
User user = userMapper.selectOne(new LambdaQueryWrapper<User>() | |||
.eq(User::getId, userId) | |||
.eq(User::getMark, 1)); | |||
if (UserTypeEnum.SUPER_ADMIN.getCode() == user.getType()) { | |||
return null; | |||
} else { | |||
deptIdList = deptMapper.selectAllChildListById(user.getDeptId()); | |||
return deptIdList; | |||
} | |||
} | |||
/** | |||
* 1)、设置问题类型字段 | |||
* 2)、设置缩略图字段 | |||
* | |||
* @param inspectionFileDistributionList | |||
* @return | |||
*/ | |||
private List<InspectionFileDistributionListVo> buildInspectionFileDistributionListVo(List<InspectionFileDistribution> inspectionFileDistributionList) { | |||
Map<String, QuestionType> questionTypeMap = this.getQuestionTypeMap(); | |||
List<InspectionFileDistributionListVo> inspectionFileDistributionListVoList = InspectionFileConverMapper.INSTANCE.fromInspectionFileDistributionListToInspectionFileDistributionListVoList(inspectionFileDistributionList); | |||
QuestionType questionType; | |||
for (InspectionFileDistributionListVo inspectionFileDistributionListVo : inspectionFileDistributionListVoList) { | |||
questionType = questionTypeMap.get(inspectionFileDistributionListVo.getQuestionId()); | |||
if (null != questionType) { | |||
inspectionFileDistributionListVo.setQuestionName(Integer.toString(questionType.getName())); | |||
inspectionFileDistributionListVo.setQuestionContent(questionType.getContent()); | |||
} | |||
inspectionFileDistributionListVo.setFileThumbnail(CommonConfig.imageURL + inspectionFileDistributionListVo.getFileThumbnail()); | |||
} | |||
return inspectionFileDistributionListVoList; | |||
} | |||
/** | |||
* | |||
* 获取问题类型列表,放到map,减少循环次数 | |||
* | |||
* @return | |||
*/ | |||
private Map<String, QuestionType> getQuestionTypeMap() { | |||
List<QuestionType> questionTypeList = questionTypeMapper.selectList(new LambdaQueryWrapper<QuestionType>() | |||
.eq(QuestionType::getMark, 1)); | |||
Map<String, QuestionType> questionTypeMap = questionTypeList.stream().collect(Collectors.toMap(QuestionType::getId, Function.identity())); | |||
return questionTypeMap; | |||
} | |||
} |
@@ -121,7 +121,6 @@ public class QueryInspectionFilePageListService { | |||
User user = userMapper.selectOne(new LambdaQueryWrapper<User>() | |||
.eq(User::getId, userId) | |||
.eq(User::getMark, 1)); | |||
user.setType(UserTypeEnum.ORDINARY_USER.getCode()); | |||
if (UserTypeEnum.SUPER_ADMIN.getCode() == user.getType()) { | |||
return null; | |||
} else { |
@@ -0,0 +1,50 @@ | |||
package com.tuoheng.admin.service.workorder; | |||
import com.tuoheng.admin.request.workorder.DistributionWorkorderRequest; | |||
import com.tuoheng.admin.request.workorder.QueryWorkOrderPageListRequest; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import java.util.List; | |||
/** | |||
* 工单Service接口 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-07 | |||
*/ | |||
public interface IWorkorderService { | |||
/** | |||
* 生成工单 | |||
* | |||
* @param idList | |||
* @return | |||
*/ | |||
JsonResult generate(List<String> idList); | |||
/** | |||
* 查询工单分页列表 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
JsonResult getPageList(QueryWorkOrderPageListRequest request); | |||
/** | |||
* 查询工单详情 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
JsonResult getDetails(String id); | |||
/** | |||
* 分配工单 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
JsonResult distribution(DistributionWorkorderRequest request); | |||
} |
@@ -0,0 +1,77 @@ | |||
package com.tuoheng.admin.service.workorder; | |||
import com.tuoheng.admin.request.workorder.DistributionWorkorderRequest; | |||
import com.tuoheng.admin.request.workorder.QueryWorkOrderPageListRequest; | |||
import com.tuoheng.admin.service.workorder.distribution.DistributionWorkorderService; | |||
import com.tuoheng.admin.service.workorder.generate.GenerateWorkorderService; | |||
import com.tuoheng.admin.service.workorder.query.QueryWorkOrderDetailsService; | |||
import com.tuoheng.admin.service.workorder.query.QueryWorkOrderPageListService; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.List; | |||
/** | |||
* 工单Service接口实现 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-07 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class WorkorderServiceImpl implements IWorkorderService { | |||
@Autowired | |||
private GenerateWorkorderService generateWorkorderService; | |||
@Autowired | |||
private QueryWorkOrderPageListService queryWorkOrderPageListService; | |||
@Autowired | |||
private QueryWorkOrderDetailsService queryWorkOrderDetailsService; | |||
@Autowired | |||
private DistributionWorkorderService distributionWorkorderService; | |||
@Override | |||
public JsonResult generate(List<String> idList) { | |||
return generateWorkorderService.generate(idList); | |||
} | |||
/** | |||
* | |||
* 查询工单分页列表 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult getPageList(QueryWorkOrderPageListRequest request) { | |||
return queryWorkOrderPageListService.getPageList(request); | |||
} | |||
/** | |||
* 查询工单详情 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult getDetails(String id) { | |||
return queryWorkOrderDetailsService.getDetails(id); | |||
} | |||
/** | |||
* 分配工单 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
@Override | |||
public JsonResult distribution(DistributionWorkorderRequest request) { | |||
return distributionWorkorderService.distribution(request); | |||
} | |||
} |
@@ -0,0 +1,160 @@ | |||
package com.tuoheng.admin.service.workorder.distribution; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.entity.User; | |||
import com.tuoheng.admin.entity.WorkOrder; | |||
import com.tuoheng.admin.enums.UserTypeEnum; | |||
import com.tuoheng.admin.enums.WorkOrderStatusEnum; | |||
import com.tuoheng.admin.enums.code.workorder.DistributionWorkorderCodeEnum; | |||
import com.tuoheng.admin.enums.code.workorder.GenerateWorkorderCodeEnum; | |||
import com.tuoheng.admin.mapper.InspectionFileMapper; | |||
import com.tuoheng.admin.mapper.UserMapper; | |||
import com.tuoheng.admin.mapper.WorkOrderFileMapper; | |||
import com.tuoheng.admin.mapper.WorkOrderMapper; | |||
import com.tuoheng.admin.request.workorder.DistributionWorkorderRequest; | |||
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 org.springframework.transaction.annotation.Transactional; | |||
/** | |||
* 分配工单业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-08 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class DistributionWorkorderService { | |||
@Autowired | |||
private UserMapper userMapper; | |||
@Autowired | |||
private WorkOrderMapper workOrderMapper; | |||
/** | |||
* 生成工单 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
@Transactional | |||
public JsonResult distribution(DistributionWorkorderRequest request) { | |||
log.info("进入分配工单业务, request:{}", request); | |||
String userId = ShiroUtils.getUserId(); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
JsonResult result = this.check(request); | |||
if (0 != result.getCode()) { | |||
log.info("进入分配工单业务:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
WorkOrder workOrder = (WorkOrder) result.getData(); | |||
// 检查权限 | |||
result = checkPermission(userId, tenantId, workOrder); | |||
if (0 != result.getCode()) { | |||
log.info("进入分配工单:校验权限失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
result = this.distributionWorkOrder(userId, request); | |||
if (0 != result.getCode()) { | |||
log.info("进入分配工单:分配工单失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
return JsonResult.success(); | |||
} | |||
/** | |||
* 检查参数 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
private JsonResult check(DistributionWorkorderRequest request) { | |||
// 判断工单id是否为空 | |||
if (StringUtils.isEmpty(request.getWorkorderId())) { | |||
return JsonResult.error(DistributionWorkorderCodeEnum.ID_LIST_IS_NULL.getCode(), DistributionWorkorderCodeEnum.ID_LIST_IS_NULL.getMsg()); | |||
} | |||
// 判断指派部门ID是否为空 | |||
if (StringUtils.isEmpty(request.getAssignDeptId())) { | |||
return JsonResult.error(DistributionWorkorderCodeEnum.ASSIGN_DEPT_ID_IS_NULL.getCode(), DistributionWorkorderCodeEnum.ASSIGN_DEPT_ID_IS_NULL.getMsg()); | |||
} | |||
// 判断指派负责人是否为空 | |||
if (StringUtils.isEmpty(request.getAssignUserIds())) { | |||
return JsonResult.error(DistributionWorkorderCodeEnum.ASSIGN_USER_ID_IS_NULL.getCode(), DistributionWorkorderCodeEnum.ASSIGN_USER_ID_IS_NULL.getMsg()); | |||
} | |||
WorkOrder workOrder = workOrderMapper.selectOne(new LambdaQueryWrapper<WorkOrder>() | |||
.eq(WorkOrder::getId, request.getWorkorderId()) | |||
.eq(WorkOrder::getMark, 1)); | |||
if (null == workOrder) { | |||
return JsonResult.error(DistributionWorkorderCodeEnum.WORK_ORDER_IS_NOT_EXIST.getCode(), DistributionWorkorderCodeEnum.WORK_ORDER_IS_NOT_EXIST.getMsg()); | |||
} | |||
return JsonResult.success(workOrder); | |||
} | |||
/** | |||
* 判断是否有分配工单权限 | |||
* 1)、超级管理员不能分配工单 | |||
* 2)、部门管理员仅可分配本部门工单,无法分配子部门工单 | |||
* 3)、普通用户不能分配工单 | |||
* | |||
* @param userId | |||
* @param workOrder | |||
* @return | |||
*/ | |||
private JsonResult checkPermission(String userId, String tenantId, WorkOrder workOrder) { | |||
User user = userMapper.selectOne(new LambdaQueryWrapper<User>() | |||
.eq(User::getId, userId) | |||
.eq(User::getTenantId, tenantId) | |||
.eq(User::getMark, 1)); | |||
user.setType(UserTypeEnum.ADMIN.getCode()); | |||
if (UserTypeEnum.SUPER_ADMIN.getCode() == user.getType()) { | |||
return JsonResult.error(DistributionWorkorderCodeEnum.SUPER_ADMIN_NOT_DISTRIBUTION.getCode(), DistributionWorkorderCodeEnum.SUPER_ADMIN_NOT_DISTRIBUTION.getMsg()); | |||
} else if (UserTypeEnum.ADMIN.getCode() == user.getType()) { | |||
if (!user.getDeptId().equals(workOrder.getDeptId())) { | |||
return JsonResult.error(DistributionWorkorderCodeEnum.ADMIN_NOT_DISTRIBUTION_CHILD_DEPT_WORK_ORDER.getCode(), DistributionWorkorderCodeEnum.ADMIN_NOT_DISTRIBUTION_CHILD_DEPT_WORK_ORDER.getMsg()); | |||
} | |||
return JsonResult.success(user); | |||
} else if (UserTypeEnum.ORDINARY_USER.getCode() == user.getType()) { | |||
return JsonResult.error(DistributionWorkorderCodeEnum.ORDINARY_USER_NOT_DISTRIBUTION.getCode(), DistributionWorkorderCodeEnum.ORDINARY_USER_NOT_DISTRIBUTION.getMsg()); | |||
} | |||
return JsonResult.error(); | |||
} | |||
/** | |||
* | |||
* 分配工单 | |||
* 1)、修改分配字段信息 | |||
* 2)、修改工单状态 | |||
* 3)、修改更新字段 | |||
* | |||
* @param userId | |||
* @param request | |||
*/ | |||
private JsonResult distributionWorkOrder(String userId, DistributionWorkorderRequest request) { | |||
WorkOrder workOrder = new WorkOrder(); | |||
workOrder.setId(request.getWorkorderId()); | |||
workOrder.setUpdateUser(userId); | |||
workOrder.setUpdateTime(DateUtils.now()); | |||
workOrder.setStatus(WorkOrderStatusEnum.PROCESSING.getCode()); | |||
workOrder.setAssignDeptId(request.getAssignDeptId()); | |||
workOrder.setAssignUser(request.getAssignUserIds()); | |||
Integer rowCount = workOrderMapper.update(workOrder); | |||
if (rowCount <= 0) { | |||
log.info("修改工单状态, 确认失败"); | |||
return JsonResult.error(GenerateWorkorderCodeEnum.GENERATE_IS_FAILED.getCode(), GenerateWorkorderCodeEnum.GENERATE_IS_FAILED.getMsg()); | |||
} | |||
return JsonResult.success(); | |||
} | |||
} |
@@ -0,0 +1,218 @@ | |||
package com.tuoheng.admin.service.workorder.generate; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.entity.*; | |||
import com.tuoheng.admin.enums.InspectionFileStatusEnum; | |||
import com.tuoheng.admin.enums.UserTypeEnum; | |||
import com.tuoheng.admin.enums.WorkOrderStatusEnum; | |||
import com.tuoheng.admin.enums.code.inspection.DeleteInspectionCodeEnum; | |||
import com.tuoheng.admin.enums.code.inspectionfile.InspectionFileConfirmCodeEnum; | |||
import com.tuoheng.admin.enums.code.inspectionfile.QueryInspectionFilePageListByInspectionIdCodeEnum; | |||
import com.tuoheng.admin.enums.code.workorder.GenerateWorkorderCodeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.request.inspectionfile.QueryInspectionFilePageListByInspectionIdRequest; | |||
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.apache.poi.ss.usermodel.Workbook; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.stream.Collectors; | |||
/** | |||
* 生成工单业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-07 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class GenerateWorkorderService { | |||
@Autowired | |||
private UserMapper userMapper; | |||
@Autowired | |||
private InspectionMapper inspectionMapper; | |||
@Autowired | |||
private InspectionFileMapper inspectionFileMapper; | |||
@Autowired | |||
private WorkOrderMapper workOrderMapper; | |||
@Autowired | |||
private WorkOrderFileMapper workOrderFileMapper; | |||
/** | |||
* 生成工单 | |||
* 1)、判断参数 | |||
* 1.1)、判断参数 | |||
* 1.2)、判断权限 | |||
* 2)、添加到工单表 | |||
* 3)、添加到工单子表 | |||
* 4)、修改任务问题状态,改为已生成工单 | |||
* | |||
* @param idList | |||
* @return | |||
*/ | |||
@Transactional | |||
public JsonResult generate(List<String> idList) { | |||
log.info("进入生成工单业务, idList:{}", idList); | |||
String userId = ShiroUtils.getUserId(); | |||
String tenantId = ShiroUtils.getTenantId(); | |||
JsonResult result = this.check(idList); | |||
if (0 != result.getCode()) { | |||
log.info("进入生成工单业务:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
List<InspectionFile> inspectionFileList = (List<InspectionFile>) result.getData(); | |||
List<String> inspectionIdList = inspectionFileList.stream().map(o -> o.getInspectionId()).collect(Collectors.toList()); | |||
List<Inspection> inspectionList = inspectionMapper.selectBatchIds(inspectionIdList); | |||
User user = userMapper.selectOne(new LambdaQueryWrapper<User>() | |||
.eq(User::getTenantId, tenantId) | |||
.eq(User::getId, userId) | |||
.eq(User::getMark, 1)); | |||
result = checkPermission(user, inspectionList); | |||
if (0 != result.getCode()) { | |||
log.info("进入生成工单务:校验权限失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
WorkOrder workOrder = this.insertWorkOrder(user); | |||
this.insertWorkOrderFile(workOrder, idList); | |||
this.updateInspectionFileStatus(userId, idList); | |||
return JsonResult.success(); | |||
} | |||
/** | |||
* 检查参数 | |||
* | |||
* @param idList | |||
* @return | |||
*/ | |||
private JsonResult check(List<String> idList) { | |||
// 判断任务问题id是否为空 | |||
if (CollectionUtil.isEmpty(idList)) { | |||
return JsonResult.error(GenerateWorkorderCodeEnum.ID_LIST_IS_NULL.getCode(), GenerateWorkorderCodeEnum.ID_LIST_IS_NULL.getMsg()); | |||
} | |||
List<InspectionFile> inspectionFileList = inspectionFileMapper.selectBatchIds(idList); | |||
if (CollectionUtil.isEmpty(inspectionFileList)) { | |||
return JsonResult.error(GenerateWorkorderCodeEnum.INSPECTION_FILE_ID_LIST_IS_NOT_EXIST.getCode(), GenerateWorkorderCodeEnum.INSPECTION_FILE_ID_LIST_IS_NOT_EXIST.getMsg()); | |||
} | |||
for (InspectionFile inspectionFile : inspectionFileList) { | |||
if (inspectionFile.getStatus() != InspectionFileStatusEnum.CONFIRMED.getCode()) { | |||
return JsonResult.error(GenerateWorkorderCodeEnum.INCLUDE_NO_CONFIRMED_INSPECTION.getCode(), GenerateWorkorderCodeEnum.INCLUDE_NO_CONFIRMED_INSPECTION.getMsg()); | |||
} | |||
} | |||
return JsonResult.success(inspectionFileList); | |||
} | |||
/** | |||
* 判断是否有生成工单权限 | |||
* 1)、超级管理员可选择所有部门问题生成工单 | |||
* 2)、部门管理员仅可生成本部门工单,无法生成子部门工单 | |||
* 3)、普通用户无生成工单权限 | |||
* | |||
* @param user | |||
* @param inspectionList | |||
* @return | |||
*/ | |||
private JsonResult checkPermission(User user, List<Inspection> inspectionList) { | |||
if (UserTypeEnum.SUPER_ADMIN.getCode() == user.getType()) { | |||
return JsonResult.success(user); | |||
} else if (UserTypeEnum.ADMIN.getCode() == user.getType()) { | |||
for (Inspection inspection : inspectionList) { | |||
if (!user.getDeptId().equals(inspection.getDeptId())) { | |||
return JsonResult.error(GenerateWorkorderCodeEnum.ADMIN_NOT_GENERATE_CHILD_WORKORDER.getCode(), GenerateWorkorderCodeEnum.ADMIN_NOT_GENERATE_CHILD_WORKORDER.getMsg()); | |||
} | |||
} | |||
return JsonResult.success(user); | |||
} else if (UserTypeEnum.ORDINARY_USER.getCode() == user.getType()) { | |||
return JsonResult.error(GenerateWorkorderCodeEnum.ORDINARY_USER_NO_PERMISSION_TO_GENERATE.getCode(), GenerateWorkorderCodeEnum.ORDINARY_USER_NO_PERMISSION_TO_GENERATE.getMsg()); | |||
} | |||
return JsonResult.error(); | |||
} | |||
/** | |||
* | |||
* 添加工单 | |||
* | |||
*/ | |||
private WorkOrder insertWorkOrder(User user) { | |||
WorkOrder workOrder = new WorkOrder(); | |||
String code = DateUtils.generateCode("XJRW"); | |||
workOrder.setCode(code); | |||
workOrder.setTenantId(user.getTenantId()); | |||
workOrder.setDeptId(user.getDeptId()); | |||
workOrder.setStatus(WorkOrderStatusEnum.WAIT.getCode()); | |||
workOrder.setDistributionId(user.getId()); // 分配人员 | |||
workOrder.setCreateUser(user.getId()); | |||
workOrder.setCreateTime(DateUtils.now()); | |||
Integer rowCount = workOrderMapper.insert(workOrder); | |||
if (rowCount <= 0) { | |||
log.info("添加工单表失败"); | |||
} | |||
return workOrder; | |||
} | |||
/** | |||
* | |||
* 添加工单子表 | |||
* | |||
*/ | |||
private void insertWorkOrderFile(WorkOrder workOrder, List<String> idList) { | |||
List<WorkOrderFile> workOrderFileList = new ArrayList<>(); | |||
WorkOrderFile workOrderFile; | |||
for (String id : idList) { | |||
workOrderFile = new WorkOrderFile(); | |||
workOrderFile.setTenantId(workOrder.getTenantId()); | |||
workOrderFile.setWorkOrderId(workOrder.getId()); | |||
workOrderFile.setInspectionFileId(id); | |||
workOrderFileList.add(workOrderFile); | |||
} | |||
if (CollectionUtil.isEmpty(workOrderFileList)) { | |||
return; | |||
} | |||
Integer rowCount = workOrderFileMapper.insertBatch(workOrderFileList); | |||
if (rowCount <= 0) { | |||
log.info("添加工单子表失败"); | |||
} | |||
} | |||
/** | |||
* | |||
* 问题状态,改为已生成工单 | |||
* | |||
* @param userId | |||
* @param idList | |||
*/ | |||
private JsonResult updateInspectionFileStatus(String userId, List<String> idList) { | |||
Map<String, Object> map = new HashMap<>(); | |||
map.put("status", InspectionFileStatusEnum.GENERATE_ORDER.getCode()); | |||
map.put("updateUser", userId); | |||
map.put("updateTime", DateUtils.now()); | |||
map.put("idList", idList); | |||
Integer rowCount = inspectionFileMapper.updateByIdList(map); | |||
if (rowCount <= 0) { | |||
log.info("修改任务问题状态, 确认失败"); | |||
return JsonResult.error(GenerateWorkorderCodeEnum.GENERATE_IS_FAILED.getCode(), GenerateWorkorderCodeEnum.GENERATE_IS_FAILED.getMsg()); | |||
} | |||
return JsonResult.success(); | |||
} | |||
} |
@@ -0,0 +1,75 @@ | |||
package com.tuoheng.admin.service.workorder.query; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.tuoheng.admin.entity.Inspection; | |||
import com.tuoheng.admin.entity.WorkOrder; | |||
import com.tuoheng.admin.entity.WorkOrderFile; | |||
import com.tuoheng.admin.enums.code.inspectionfile.QueryInspectionFilePageListByInspectionIdCodeEnum; | |||
import com.tuoheng.admin.enums.code.workorder.QueryWorkOrderDetailsCodeEnum; | |||
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; | |||
/** | |||
* 查询工单详情业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-06 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class QueryWorkOrderDetailsService { | |||
@Autowired | |||
private WorkOrderMapper workOrderMapper; | |||
@Autowired | |||
private WorkOrderFileMapper workOrderFileMapper; | |||
@Autowired | |||
private InspectionFileMapper inspectionFileMapper; | |||
public JsonResult getDetails(String id) { | |||
log.info("进入查询工单详情业务, id:{}", id); | |||
String userId = ShiroUtils.getUserId(); | |||
JsonResult result = this.check(id); | |||
if (0 != result.getCode()) { | |||
log.info("进入查询工单详情业务:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
WorkOrder workOrder = (WorkOrder) result.getData(); | |||
return JsonResult.success(workOrder); | |||
} | |||
/** | |||
* 检查参数 | |||
* | |||
* @param id | |||
* @return | |||
*/ | |||
private JsonResult check(String id) { | |||
// 判断任务id是否为空 | |||
if (StringUtils.isEmpty(id)) { | |||
return JsonResult.error(QueryWorkOrderDetailsCodeEnum.ID_IS_NULL.getCode(), QueryWorkOrderDetailsCodeEnum.ID_IS_NULL.getMsg()); | |||
} | |||
// 判断工单是否存在 | |||
WorkOrder workOrder = workOrderMapper.selectOne(new LambdaQueryWrapper<WorkOrder>() | |||
.eq(WorkOrder::getId, id) | |||
.eq(WorkOrder::getMark, 1)); | |||
if (null == workOrder) { | |||
return JsonResult.error(QueryWorkOrderDetailsCodeEnum.WORK_ORDER_IS_NOT_EXIST.getCode(), QueryWorkOrderDetailsCodeEnum.WORK_ORDER_IS_NOT_EXIST.getMsg()); | |||
} | |||
return JsonResult.success(workOrder); | |||
} | |||
} |
@@ -0,0 +1,260 @@ | |||
package com.tuoheng.admin.service.workorder.query; | |||
import cn.hutool.core.collection.CollectionUtil; | |||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.tuoheng.admin.conver.WorkOrderConverMapper; | |||
import com.tuoheng.admin.entity.*; | |||
import com.tuoheng.admin.enums.InspectionFileStatusEnum; | |||
import com.tuoheng.admin.enums.UserTypeEnum; | |||
import com.tuoheng.admin.enums.code.inspection.QueryInspectionPageListCodeEnum; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.request.workorder.QueryWorkOrderPageListRequest; | |||
import com.tuoheng.admin.utils.ShiroUtils; | |||
import com.tuoheng.admin.vo.WorkOrderPageListVo; | |||
import com.tuoheng.common.core.utils.JsonResult; | |||
import com.tuoheng.common.core.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
import java.util.Map; | |||
import java.util.function.Function; | |||
import java.util.stream.Collectors; | |||
/** | |||
* 查询工单分页列表业务层处理 | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-06 | |||
*/ | |||
@Slf4j | |||
@Service | |||
public class QueryWorkOrderPageListService { | |||
@Autowired | |||
private UserMapper userMapper; | |||
@Autowired | |||
private DeptMapper deptMapper; | |||
@Autowired | |||
private WorkOrderMapper workOrderMapper; | |||
@Autowired | |||
private WorkOrderFileMapper workOrderFileMapper; | |||
@Autowired | |||
private InspectionFileMapper inspectionFileMapper; | |||
public JsonResult getPageList(QueryWorkOrderPageListRequest request) { | |||
log.info("进入查询工单分页列表业务, request:{}", request.toString()); | |||
String userId = ShiroUtils.getUserId(); | |||
JsonResult result = this.check(request); | |||
if (0 != result.getCode()) { | |||
log.info("进入查询工单分页列表业务:校验失败:{}", result.getMsg()); | |||
return result; | |||
} | |||
// 用户能看到被指派到自己部门的工单 | |||
User user = userMapper.selectOne(new LambdaQueryWrapper<User>() | |||
.eq(User::getId, userId) | |||
.eq(User::getMark, 1)); | |||
if (UserTypeEnum.SUPER_ADMIN.getCode() != user.getType()) { | |||
request.setUserDeptId(user.getDeptId()); | |||
} | |||
// 获取部门Id的查询范围 | |||
List<String> deptIdList = this.getDeptIdList(user, request.getDeptId()); | |||
request.setDeptIdList(deptIdList); | |||
// 设置分页参数 | |||
IPage<InspectionFile> page = new Page<>(request.getPage(), request.getLimit()); | |||
// 查询结果 | |||
IPage<WorkOrder> pageData = workOrderMapper.selectPageList(page, request); | |||
if (null == pageData || pageData.getTotal() == 0) { | |||
log.info("获取任务分页列表为空"); | |||
return JsonResult.success(null, QueryInspectionPageListCodeEnum.DATA_IS_FAILED.getMsg()); | |||
} | |||
// 构造返回结果对象 | |||
List<WorkOrderPageListVo> workOrderPageListVoList = this.buildPageList(pageData.getRecords()); | |||
// 重写返回结果对象 | |||
IPage<WorkOrderPageListVo> workOrderPageListVoPageData = new Page<>(); | |||
workOrderPageListVoPageData.setPages(pageData.getPages()); | |||
workOrderPageListVoPageData.setCurrent(pageData.getCurrent()); | |||
workOrderPageListVoPageData.setSize(pageData.getSize()); | |||
workOrderPageListVoPageData.setTotal(pageData.getTotal()); | |||
workOrderPageListVoPageData.setRecords(workOrderPageListVoList); | |||
return JsonResult.success(workOrderPageListVoPageData); | |||
} | |||
/** | |||
* 检查参数 | |||
* | |||
* @param request | |||
* @return | |||
*/ | |||
private JsonResult check(QueryWorkOrderPageListRequest request) { | |||
return JsonResult.success(); | |||
} | |||
/** | |||
* 获取部门Id的查询范围 | |||
* 1)、deptId:如果传了值,查该部门的任务 | |||
* 2)、deptId:如果没有传值 | |||
* 2.1)、管理员:可查全部确认问题 | |||
* 2.2)、管理员/普通用户:本部门及子部门创建的工单 | |||
* | |||
* @param deptId | |||
* @return | |||
*/ | |||
private List<String> getDeptIdList(User user, String deptId) { | |||
List<String> deptIdList = new ArrayList<>(); | |||
if (!StringUtils.isEmpty(deptId)) { | |||
deptIdList.add(deptId); | |||
return deptIdList; | |||
} | |||
if (UserTypeEnum.SUPER_ADMIN.getCode() == user.getType()) { | |||
return null; | |||
} else { | |||
deptIdList = deptMapper.selectAllChildListById(user.getDeptId()); | |||
return deptIdList; | |||
} | |||
} | |||
/** | |||
* 处理字段 | |||
* 1)、部门名称 | |||
* 2)、分配人员名称 | |||
* 3)、问题总数 | |||
* 4)、已处理问题数 | |||
* | |||
* @param workOrderList | |||
* @return | |||
*/ | |||
private List<WorkOrderPageListVo> buildPageList(List<WorkOrder> workOrderList) { | |||
Map<String, Dept> deptMap = this.getDeptMap(workOrderList); | |||
Map<String, User> userMap = this.getUserMap(workOrderList); | |||
Map<String, User> assignUserMap = this.getAssignUserMap(workOrderList); | |||
Map<String, List<WorkOrderFile>> workOrderFileMap = this.getWorkOrderFileMap(workOrderList); | |||
List<String> inspectionFileIdList; | |||
List<InspectionFile> inspectionFileList; | |||
List<WorkOrderPageListVo> workOrderPageListVoList = WorkOrderConverMapper.INSTANCE.fromWorkOrderListToWorkOrderPageListVoList(workOrderList); | |||
Dept dept; | |||
User user; | |||
User assignUser; | |||
String assignUserNames; | |||
List<WorkOrderFile> workOrderFileList; | |||
for (WorkOrderPageListVo workOrderPageListVo : workOrderPageListVoList) { | |||
assignUserNames = ""; | |||
dept = deptMap.get(workOrderPageListVo.getDeptId()); | |||
user = userMap.get(workOrderPageListVo.getDistributionId()); | |||
workOrderFileList = workOrderFileMap.get(workOrderPageListVo.getId()); | |||
if (!CollectionUtil.isEmpty(workOrderFileList)) { | |||
inspectionFileIdList = workOrderFileList.stream().map(o -> o.getInspectionFileId()).collect(Collectors.toList()); | |||
inspectionFileList = inspectionFileMapper.selectBatchIds(inspectionFileIdList); | |||
List<InspectionFile> inspectionFileListTmp = inspectionFileList.stream().filter(s -> s.getStatus() == InspectionFileStatusEnum.PROCESSED.getCode()).collect(Collectors.toList()); | |||
workOrderPageListVo.setProblemTotalCount(workOrderFileList.size()); | |||
workOrderPageListVo.setProcessedProblemCount(inspectionFileListTmp.size()); | |||
} | |||
if (null != dept) { | |||
workOrderPageListVo.setDeptName(dept.getName()); | |||
} | |||
if (null != user) { | |||
workOrderPageListVo.setDistributionName(user.getRealname()); | |||
} | |||
String assignUsers = workOrderPageListVo.getAssignUser(); | |||
if (!StringUtils.isEmpty(assignUsers)) { | |||
String[] assignUserArr = assignUsers.split(","); | |||
for (String au : assignUserArr) { | |||
assignUser = assignUserMap.get(au); | |||
assignUserNames += assignUser.getRealname() + ","; | |||
} | |||
} | |||
if (!StringUtils.isEmpty(assignUserNames)) { | |||
assignUserNames = assignUserNames.substring(0, assignUserNames.length() - 1); | |||
workOrderPageListVo.setAssignUserNames(assignUserNames); | |||
} | |||
} | |||
return workOrderPageListVoList; | |||
} | |||
/** | |||
* 获取部门列表,放到map,减少循环次数 | |||
* | |||
* @param workOrderList | |||
* @return | |||
*/ | |||
private Map<String, Dept> getDeptMap(List<WorkOrder> workOrderList) { | |||
List<String> deptIdList = workOrderList.stream().map(o -> o.getDeptId()).collect(Collectors.toList()); | |||
List<Dept> deptList = deptMapper.selectList(new LambdaQueryWrapper<Dept>() | |||
.in(Dept::getId, deptIdList) | |||
.eq(Dept::getMark, 1)); | |||
Map<String, Dept> deptMap = deptList.stream().collect(Collectors.toMap(Dept::getId, Function.identity())); | |||
return deptMap; | |||
} | |||
/** | |||
* 获取用户列表,放到map,减少循环次数 | |||
* | |||
* @param workOrderList | |||
* @return | |||
*/ | |||
private Map<String, User> getUserMap(List<WorkOrder> workOrderList) { | |||
List<String> distributionIdList = workOrderList.stream().map(o -> o.getDistributionId()).collect(Collectors.toList()); | |||
List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>() | |||
.in(User::getId, distributionIdList) | |||
.eq(User::getMark, 1)); | |||
Map<String, User> userMap = userList.stream().collect(Collectors.toMap(User::getId, Function.identity())); | |||
return userMap; | |||
} | |||
/** | |||
* 获取指派用户列表,放到map,减少循环次数 | |||
* | |||
* @param workOrderList | |||
* @return | |||
*/ | |||
private Map<String, User> getAssignUserMap(List<WorkOrder> workOrderList) { | |||
List<String> assignUserIdList = workOrderList.stream().map(o -> o.getDistributionId()).collect(Collectors.toList()); | |||
List<String> tmpList; | |||
for (WorkOrder workOrder : workOrderList) { | |||
String assignUser = workOrder.getAssignUser(); | |||
if (!StringUtils.isEmpty(assignUser)) { | |||
String[] arr = assignUser.split(","); | |||
tmpList = Arrays.asList(arr); | |||
assignUserIdList.addAll(tmpList); | |||
} | |||
} | |||
List<User> userList = null; | |||
if (!CollectionUtil.isEmpty(assignUserIdList)) { | |||
userList = userMapper.selectList(new LambdaQueryWrapper<User>() | |||
.in(User::getId, assignUserIdList) | |||
.eq(User::getMark, 1)); | |||
} | |||
Map<String, User> userMap = userList.stream().collect(Collectors.toMap(User::getId, Function.identity())); | |||
return userMap; | |||
} | |||
private Map<String, List<WorkOrderFile>> getWorkOrderFileMap(List<WorkOrder> workOrderList) { | |||
List<String> workOrderIdList = workOrderList.stream().map(o -> o.getId()).collect(Collectors.toList()); | |||
List<WorkOrderFile> workOrderFileList = workOrderFileMapper.selectList(new LambdaQueryWrapper<WorkOrderFile>() | |||
.in(WorkOrderFile::getWorkOrderId, workOrderIdList)); | |||
Map<String, List<WorkOrderFile>> workOrderFileMap = workOrderFileList.stream().collect(Collectors.groupingBy(WorkOrderFile::getWorkOrderId)); | |||
return workOrderFileMap; | |||
} | |||
} |
@@ -0,0 +1,89 @@ | |||
package com.tuoheng.admin.vo; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import lombok.Data; | |||
import java.util.Date; | |||
/** | |||
* 返回任务问题分布视图Vo | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-08 | |||
*/ | |||
@Data | |||
public class InspectionFileDistributionListVo { | |||
/** | |||
* 问题id | |||
*/ | |||
private String id; | |||
/** | |||
* 问题类型:1坑槽,2积水,3裂缝 | |||
*/ | |||
private String questionId; | |||
/** | |||
* 问题名称:1坑槽,2积水,3裂缝 | |||
*/ | |||
private String questionName; | |||
/** | |||
* 问题内容 | |||
*/ | |||
private String questionContent; | |||
/** | |||
* 缩略图 | |||
*/ | |||
private String fileThumbnail; | |||
/** | |||
* 经度 | |||
*/ | |||
private String latitude; | |||
/** | |||
* 经度 | |||
*/ | |||
private String longitude; | |||
/** | |||
* 位置信息 | |||
*/ | |||
private String location; | |||
/** | |||
* 高德地图纬度 | |||
*/ | |||
private String gaodeLongitude; | |||
/** | |||
* 高德地图经度 | |||
*/ | |||
private String gaodeLatitude; | |||
/** | |||
* 高德地图地址 | |||
*/ | |||
private String gaodeAddress; | |||
/** | |||
* 状态:5待确认 10已忽略 15已确认 20已生成工单 25问题已处理 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 任务编号 | |||
*/ | |||
private String inspectionCode; | |||
/** | |||
* 任务名称 | |||
*/ | |||
private String inspectionName; | |||
} |
@@ -0,0 +1,66 @@ | |||
package com.tuoheng.admin.vo; | |||
import lombok.Data; | |||
import java.util.Date; | |||
/** | |||
* 返回工单视图Vo | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-07 | |||
*/ | |||
@Data | |||
public class WorkOrderDetailsVo { | |||
/** | |||
* 工单ID | |||
*/ | |||
private String id; | |||
/** | |||
* 工单编号 | |||
*/ | |||
private String code; | |||
/** | |||
* 工单状态:5待分配 10处理中(已分配) 15已完成 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 工单生成时间 | |||
*/ | |||
private Date createTime; | |||
/** | |||
* 问题总数 | |||
*/ | |||
private Integer problemTotalCount; | |||
/** | |||
* 已处理问题数 | |||
*/ | |||
private Integer processedProblemCount; | |||
/** | |||
* 分配人员ID | |||
*/ | |||
private String distributionId; | |||
/** | |||
* 分配人员名称 | |||
*/ | |||
private String distributionName; | |||
/** | |||
* 所在部门ID | |||
*/ | |||
private String deptId; | |||
/** | |||
* 所在部门名称 | |||
*/ | |||
private String deptName; | |||
} |
@@ -0,0 +1,106 @@ | |||
package com.tuoheng.admin.vo; | |||
import lombok.Data; | |||
import java.util.Date; | |||
/** | |||
* 返回工单列表视图Vo | |||
* | |||
* @author wanjing | |||
* @team tuoheng | |||
* @date 2022-12-07 | |||
*/ | |||
@Data | |||
public class WorkOrderPageListVo { | |||
/** | |||
* 工单ID | |||
*/ | |||
private String id; | |||
/** | |||
* 工单编号 | |||
*/ | |||
private String code; | |||
/** | |||
* 工单状态:5待分配 10处理中(已分配) 15已完成 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 工单生成时间 | |||
*/ | |||
private Date createTime; | |||
/** | |||
* 问题总数 | |||
*/ | |||
private Integer problemTotalCount; | |||
/** | |||
* 已处理问题数 | |||
*/ | |||
private Integer processedProblemCount; | |||
/** | |||
* 分配人员ID | |||
*/ | |||
private String distributionId; | |||
/** | |||
* 分配人员名称 | |||
*/ | |||
private String distributionName; | |||
/** | |||
* 指派部门ID | |||
*/ | |||
private String assignDeptId; | |||
/** | |||
* 指派负责人,可以是多个(",")隔开 | |||
*/ | |||
private String assignUser; | |||
/** | |||
* 指派负责人名称,可以是多个(",")隔开 | |||
*/ | |||
private String assignUserNames; | |||
/** | |||
* 指派负责人联系方式 | |||
*/ | |||
private String assignContact; | |||
/** | |||
* 指派指派备注 | |||
*/ | |||
private String assignNote; | |||
/** | |||
* 指派时间 | |||
*/ | |||
private Date assignTime; | |||
/** | |||
* 所在部门ID | |||
*/ | |||
private String deptId; | |||
/** | |||
* 所在部门名称 | |||
*/ | |||
private String deptName; | |||
/** | |||
* 更新人 | |||
*/ | |||
private String updateUser; | |||
/** | |||
* 更新时间 | |||
*/ | |||
private Date updateTime; | |||
} |
@@ -72,6 +72,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
<result property="deptId" column="dept_id" /> | |||
</resultMap> | |||
<resultMap type="com.tuoheng.admin.entity.InspectionFileDistribution" id="InspectionFileDistributionResult"> | |||
<result property="id" column="id" /> | |||
<result property="tenantId" column="tenant_id" /> | |||
<result property="fileThumbnail" column="file_thumbnail" /> | |||
<result property="latitude" column="latitude" /> | |||
<result property="longitude" column="longitude" /> | |||
<result property="location" column="location" /> | |||
<result property="gaodeLongitude" column="gaode_longitude" /> | |||
<result property="gaodeLatitude" column="gaode_latitude" /> | |||
<result property="gaodeAddress" column="gaode_address" /> | |||
<result property="questionId" column="question_id" /> | |||
<result property="questionName" column="question_name" /> | |||
<result property="status" column="status" /> | |||
<result property="inspectionCode" column="inspection_code" /> | |||
<result property="inspectionName" column="inspection_name" /> | |||
</resultMap> | |||
<sql id="Base_Column_List"> | |||
id, tenant_id, file_code, inspection_id, file_type, file_name, file_thumbnail, file_original, file_image, file_size, latitude, longitude, location, gaode_longitude, gaode_latitude, gaode_address, question_id, source, question_name, content, question_desc, status, check_user, check_time, create_user, create_time, update_user, update_time, mark | |||
</sql> | |||
@@ -87,6 +104,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
ti.code as inspection_code, ti.name as inspection_name, ti.road_id, ti.dept_id | |||
</sql> | |||
<sql id="Base_Distribution_Column_List"> | |||
tif.id, tif.tenant_id, tif.file_thumbnail, tif.latitude, tif.longitude, tif.location, tif.gaode_longitude, tif.gaode_latitude, tif.gaode_address, tif.question_id, tif.question_name, tif.status, | |||
ti.code as inspection_code, ti.name as inspection_name | |||
</sql> | |||
<update id="deleteLogicByMap" parameterType="hashmap"> | |||
update th_inspection_file | |||
<trim prefix="SET" suffixOverrides=","> | |||
@@ -159,6 +181,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" | |||
order by tif.create_time desc | |||
</select> | |||
<select id="selectDistributionList" parameterType="com.tuoheng.admin.request.inspectionfile.QueryInspectionFileDistributionListRequest" resultMap="InspectionFileDistributionResult"> | |||
select <include refid="Base_Distribution_Column_List"/> | |||
from th_inspection_file tif | |||
left join th_inspection ti on tif.inspection_id = ti.id | |||
<where> | |||
<if test="1 == 1"> and tif.mark = 1 </if> | |||
<if test="request.inspectionName != null and request.inspectionName != ''"> and ti.name like concat('%', #{request.inspectionName}, '%') </if> | |||
<if test="request.questionId != null and request.questionId != ''"> and tif.question_id = #{request.questionId} </if> | |||
<if test="request.status != null"> | |||
<choose> | |||
<when test="request.status != 0"> | |||
and tif.status = #{request.status} | |||
</when> | |||
<otherwise> | |||
and tif.status in (15, 20, 25) | |||
</otherwise> | |||
</choose> | |||
</if> | |||
<if test="request.deptIdList != null and request.deptIdList.size() > 0"> | |||
and ti.dept_id in | |||
<foreach item="deptId" collection="request.deptIdList" open="(" separator="," close=")"> | |||
#{deptId} | |||
</foreach> | |||
</if> | |||
</where> | |||
order by tif.create_time desc | |||
</select> | |||
<update id="updateByIdList" parameterType="hashmap"> | |||
update th_inspection_file | |||
<trim prefix="SET" suffixOverrides=","> |
@@ -0,0 +1,26 @@ | |||
<?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.WorkOrderFileMapper"> | |||
<resultMap type="com.tuoheng.admin.entity.WorkOrderFile" id="WorkOrderFileResult"> | |||
<result property="tenantId" column="tenant_id" /> | |||
<result property="workOrderId" column="work_order_id" /> | |||
<result property="inspectionFileId" column="inspection_file_id" /> | |||
</resultMap> | |||
<sql id="selectThWorkOrderFileVo"> | |||
select tenant_id, work_order_id, inspection_file_id from th_work_order_file | |||
</sql> | |||
<!-- 批量新增数据 --> | |||
<insert id="insertBatch" parameterType="com.tuoheng.admin.entity.WorkOrderFile"> | |||
insert into th_work_order_file (tenant_id, work_order_id, inspection_file_id) | |||
VALUES | |||
<foreach collection="list" item="item" index="index" separator=","> | |||
( #{item.tenantId, jdbcType=INTEGER}, #{item.workOrderId, jdbcType=VARCHAR}, #{item.inspectionFileId, jdbcType=VARCHAR} ) | |||
</foreach> | |||
</insert> | |||
</mapper> |
@@ -0,0 +1,68 @@ | |||
<?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.WorkOrderMapper"> | |||
<resultMap type="com.tuoheng.admin.entity.WorkOrder" id="WorkOrderResult"> | |||
<result property="id" column="id" /> | |||
<result property="tenantId" column="tenant_id" /> | |||
<result property="deptId" column="dept_id" /> | |||
<result property="code" column="code" /> | |||
<result property="status" column="status" /> | |||
<result property="assignDeptId" column="assign_dept_id" /> | |||
<result property="assignUser" column="assign_user" /> | |||
<result property="assignContact" column="assign_contact" /> | |||
<result property="assignNote" column="assign_note" /> | |||
<result property="assignTime" column="assign_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="selectThWorkOrderVo"> | |||
select id, tenant_id, dept_id, code, status, assign_dept_id, assign_user, assign_contact, assign_note, assign_time, create_user, create_time, update_user, update_time, mark | |||
from th_work_order | |||
</sql> | |||
<update id="update" parameterType="com.tuoheng.admin.entity.WorkOrder"> | |||
update th_work_order | |||
<trim prefix="SET" suffixOverrides=","> | |||
<if test="assignDeptId != null and assignDeptId !='' "> assign_dept_id = #{assignDeptId}, </if> | |||
<if test="assignUser != null and assignUser !='' "> assign_user = #{assignUser}, </if> | |||
<if test="assignContact != null and assignContact !='' "> assign_contact = #{assignContact}, </if> | |||
<if test="assignNote != null and assignNote !='' "> assign_note = #{assignNote}, </if> | |||
<if test="assignTime != null"> assign_time = #{assignTime}, </if> | |||
<if test="status != null"> status = #{status}, </if> | |||
<if test="updateUser != null and updateUser != ''"> update_user = #{updateUser}, </if> | |||
<if test="updateTime != null"> update_time = #{updateTime}, </if> | |||
</trim> | |||
where id = #{id} | |||
</update> | |||
<select id="selectPageList" parameterType="com.tuoheng.admin.request.workorder.QueryWorkOrderPageListRequest" resultMap="WorkOrderResult"> | |||
<include refid="selectThWorkOrderVo"/> | |||
<where> | |||
<if test="1 == 1"> and mark = 1 </if> | |||
<if test="request.code != null and request.code != 0"> and code = #{request.code} </if> | |||
<if test="request.status != null and request.status != ''"> and status = #{request.status} </if> | |||
<if test="request.userDeptId != null and request.userDeptId != ''"> and assign_dept_id = #{request.userDeptId} </if> | |||
<if test="request.deptIdList != null and request.deptIdList.size() > 0"> | |||
and dept_id in | |||
<foreach item="deptId" collection="request.deptIdList" open="(" separator="," close=")"> | |||
#{deptId} | |||
</foreach> | |||
</if> | |||
<if test="request.beginTime != null"> | |||
and check_time >= #{request.beginTime} | |||
</if> | |||
<if test="request.endTime != null"> | |||
and check_time <= #{request.endTime} | |||
</if> | |||
</where> | |||
order by create_time desc | |||
</select> | |||
</mapper> |