@@ -0,0 +1,35 @@ | |||
package com.tuoheng.admin.controller; | |||
import com.tuoheng.admin.entity.request.WorkOrderRequest; | |||
import com.tuoheng.admin.service.IWorkOrderService; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.web.bind.annotation.GetMapping; | |||
import org.springframework.web.bind.annotation.RequestMapping; | |||
import org.springframework.web.bind.annotation.RestController; | |||
/** | |||
* 工单表 前端控制器 | |||
* | |||
* @author Wanghaoran | |||
* @since 2022-12-27 | |||
*/ | |||
@RestController | |||
@RequestMapping("/workOrder") | |||
public class WorkOrderController { | |||
@Autowired | |||
private IWorkOrderService workOrderService; | |||
/** | |||
* 获取工单列表(分页) | |||
* | |||
* @param request 查询条件 | |||
* @return | |||
*/ | |||
@GetMapping("/page") | |||
public JsonResult queryPage(WorkOrderRequest request) { | |||
return workOrderService.queryPage(request); | |||
} | |||
} |
@@ -0,0 +1,55 @@ | |||
package com.tuoheng.admin.entity.domain; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.io.Serializable; | |||
import java.util.Date; | |||
/** | |||
* 巡检问题处理结果映射实体 | |||
* | |||
* @author WangHaoran | |||
* @date 2022/12/27 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_question_handle") | |||
public class QuestionHandle extends BaseEntity implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 巡检问题文件ID | |||
*/ | |||
private Integer questionId; | |||
/** | |||
* 处理人 | |||
*/ | |||
private Integer handlerUser; | |||
/** | |||
* 处理后图片(多个图片逗号“,”分隔) | |||
*/ | |||
private String handlerImage; | |||
/** | |||
* 处理结果 | |||
*/ | |||
private String handlerResult; | |||
/** | |||
* 处理时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date handlerTime; | |||
} |
@@ -0,0 +1,60 @@ | |||
package com.tuoheng.admin.entity.domain; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.io.Serializable; | |||
import java.util.Date; | |||
/** | |||
* 巡检问题工单映射实体 | |||
* | |||
* @author WangHaoran | |||
* @date 2022/12/27 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_work_order") | |||
public class WorkOrder extends BaseEntity implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 分配人员 | |||
*/ | |||
private Integer distributionId; | |||
/** | |||
* 问题工单号 | |||
*/ | |||
private String code; | |||
/** | |||
* 工单状态:5待分配 10处理中(已分配) 15已完成 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 指派负责人,多个用,隔开 | |||
*/ | |||
private String assignUser; | |||
/** | |||
* 指派备注 | |||
*/ | |||
private String assignNote; | |||
/** | |||
* 指派时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date assignTime; | |||
} |
@@ -0,0 +1,35 @@ | |||
package com.tuoheng.admin.entity.domain; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.tuoheng.common.common.BaseEntity; | |||
import lombok.Data; | |||
import lombok.EqualsAndHashCode; | |||
import lombok.experimental.Accessors; | |||
import java.io.Serializable; | |||
/** | |||
* 巡检问题工单子表映射实体 | |||
* | |||
* @author WangHaoran | |||
* @date 2022/12/27 | |||
*/ | |||
@Data | |||
@EqualsAndHashCode(callSuper = true) | |||
@Accessors(chain = true) | |||
@TableName("th_work_order_question") | |||
public class WorkOrderQuestion extends BaseEntity implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 巡检问题工单ID | |||
*/ | |||
private Integer workOrderId; | |||
/** | |||
* 巡检问题文件ID | |||
*/ | |||
private Integer questionId; | |||
} |
@@ -0,0 +1,33 @@ | |||
package com.tuoheng.admin.entity.request; | |||
import com.tuoheng.common.common.BaseQuery; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
@Data | |||
public class WorkOrderRequest extends BaseQuery implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 问题工单号 | |||
*/ | |||
private String code; | |||
/** | |||
* 工单状态:5待分配 10处理中(已分配) 15已完成 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 开始时间 | |||
*/ | |||
private String createStartTime; | |||
/** | |||
* 结束时间 | |||
*/ | |||
private String createEndTime; | |||
} |
@@ -0,0 +1,7 @@ | |||
package com.tuoheng.admin.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.tuoheng.admin.entity.domain.QuestionHandle; | |||
public interface QuestionHandleMapper extends BaseMapper<QuestionHandle> { | |||
} |
@@ -0,0 +1,7 @@ | |||
package com.tuoheng.admin.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.tuoheng.admin.entity.domain.WorkOrder; | |||
public interface WorkOrderMapper extends BaseMapper<WorkOrder> { | |||
} |
@@ -0,0 +1,7 @@ | |||
package com.tuoheng.admin.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.tuoheng.admin.entity.domain.WorkOrderQuestion; | |||
public interface WorkOrderQuestionMapper extends BaseMapper<WorkOrderQuestion> { | |||
} |
@@ -0,0 +1,10 @@ | |||
package com.tuoheng.admin.service; | |||
import com.tuoheng.admin.entity.domain.WorkOrder; | |||
import com.tuoheng.admin.entity.request.WorkOrderRequest; | |||
import com.tuoheng.common.common.IBaseService; | |||
import com.tuoheng.common.utils.JsonResult; | |||
public interface IWorkOrderService extends IBaseService<WorkOrder> { | |||
JsonResult queryPage(WorkOrderRequest request); | |||
} |
@@ -0,0 +1,43 @@ | |||
package com.tuoheng.admin.service.impl; | |||
import cn.hutool.core.util.ObjectUtil; | |||
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.common.ServiceExceptionEnum; | |||
import com.tuoheng.admin.entity.domain.WorkOrder; | |||
import com.tuoheng.admin.entity.request.WorkOrderRequest; | |||
import com.tuoheng.admin.enums.MarkTypeEnum; | |||
import com.tuoheng.admin.mapper.WorkOrderMapper; | |||
import com.tuoheng.admin.service.IWorkOrderService; | |||
import com.tuoheng.common.common.BaseServiceImpl; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import com.tuoheng.common.utils.StringUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
@Slf4j | |||
@Service | |||
public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkOrder> implements IWorkOrderService { | |||
@Autowired | |||
private WorkOrderMapper workOrderMapper; | |||
@Override | |||
public JsonResult queryPage(WorkOrderRequest request) { | |||
if(null == request.getPage() || null == request.getLimit()){ | |||
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | |||
} | |||
// 获取分页数据 | |||
IPage<WorkOrder> page = new Page<>(request.getPage(), request.getLimit()); | |||
IPage<WorkOrder> pageData = workOrderMapper.selectPage(page, new LambdaQueryWrapper<WorkOrder>() | |||
.like(StringUtils.isNotEmpty(request.getCode()), WorkOrder::getCode, request.getCode()) | |||
.eq(ObjectUtil.isNotEmpty(request.getStatus()), WorkOrder::getStatus, request.getStatus()) | |||
.eq(WorkOrder::getMark, MarkTypeEnum.VALID.getCode()) | |||
.orderByDesc(WorkOrder::getCreateTime)); | |||
return JsonResult.success(pageData); | |||
} | |||
} |