@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.tuoheng.admin.entity.domain.Question; | |||
import com.tuoheng.admin.entity.request.*; | |||
import com.tuoheng.admin.entity.vo.QuestionTypeCountVO; | |||
import com.tuoheng.admin.entity.vo.QuestionVO; | |||
import com.tuoheng.admin.service.IQuestionService; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import lombok.extern.slf4j.Slf4j; | |||
@@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.*; | |||
import javax.validation.Valid; | |||
import javax.validation.constraints.NotBlank; | |||
import javax.validation.constraints.Pattern; | |||
import java.text.ParseException; | |||
import java.util.List; | |||
import java.util.Map; | |||
@@ -38,7 +40,7 @@ public class QuestionController { | |||
* @return | |||
*/ | |||
@GetMapping("/page") | |||
public JsonResult<IPage<Question>> page(QuestionQuery questionQuery) { | |||
public JsonResult<IPage<QuestionVO>> page(QuestionQuery questionQuery) throws ParseException { | |||
return JsonResult.success(questionService.queryPage(questionQuery)); | |||
} | |||
@@ -1,12 +1,14 @@ | |||
package com.tuoheng.admin.controller; | |||
import com.tuoheng.admin.entity.request.QuestionStatusRequest; | |||
import com.tuoheng.admin.entity.request.WorkOrderHandleRequest; | |||
import com.tuoheng.admin.entity.request.WorkOrderQuestionRequest; | |||
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; | |||
import org.springframework.web.bind.annotation.*; | |||
/** | |||
* 工单表 前端控制器 | |||
@@ -32,4 +34,57 @@ public class WorkOrderController { | |||
return workOrderService.queryPage(request); | |||
} | |||
/** | |||
* 生成工单 | |||
* | |||
* @return | |||
*/ | |||
@PostMapping("/generate/{ids}") | |||
public JsonResult generate(@PathVariable("ids") Integer[] ids) { | |||
return workOrderService.generate(ids); | |||
} | |||
/** | |||
* 分配处理人员 | |||
* | |||
* @return | |||
*/ | |||
@PostMapping("/assign") | |||
public JsonResult assign(@RequestBody WorkOrderRequest request) { | |||
return workOrderService.assign(request); | |||
} | |||
/** | |||
* 处理人员处理 | |||
* | |||
* @return | |||
*/ | |||
@PostMapping("/handle") | |||
public JsonResult handle(@RequestBody WorkOrderHandleRequest request) { | |||
return workOrderService.handle(request); | |||
} | |||
/** | |||
* 工单问题列表 | |||
* | |||
* @param | |||
* @return | |||
*/ | |||
@GetMapping("/question/page") | |||
public JsonResult questionPage(WorkOrderQuestionRequest request) { | |||
return workOrderService.questionPage(request); | |||
} | |||
/** | |||
* 工单问题详情 | |||
* | |||
* @param | |||
* @return | |||
*/ | |||
@GetMapping("/question/detail") | |||
public JsonResult questionDetail(@RequestParam("questionId") Integer questionId) { | |||
return workOrderService.questionDetail(questionId); | |||
} | |||
} |
@@ -1,5 +1,6 @@ | |||
package com.tuoheng.admin.entity.domain; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.baomidou.mybatisplus.annotation.TableName; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.tuoheng.common.common.BaseEntity; | |||
@@ -52,4 +53,9 @@ public class QuestionHandle extends BaseEntity implements Serializable { | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date handlerTime; | |||
/** | |||
* 处理状态:0待处理 1已处理 | |||
*/ | |||
@TableField(exist = false) | |||
private Integer status; | |||
} |
@@ -22,6 +22,8 @@ public class WorkOrderQuestion extends BaseEntity implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
private Integer tenantId; | |||
/** | |||
* 巡检问题工单ID | |||
*/ | |||
@@ -37,9 +39,4 @@ public class WorkOrderQuestion extends BaseEntity implements Serializable { | |||
*/ | |||
private Integer status; | |||
/** | |||
* 处理人员 | |||
*/ | |||
private Integer handleUser; | |||
} |
@@ -26,6 +26,16 @@ public class QuestionListDto { | |||
*/ | |||
private String missionName; | |||
/** | |||
* 经度 | |||
*/ | |||
private String lng; | |||
/** | |||
* 纬度 | |||
*/ | |||
private String lat; | |||
private String type; | |||
/** |
@@ -0,0 +1,28 @@ | |||
package com.tuoheng.admin.entity.request; | |||
import lombok.Data; | |||
@Data | |||
public class WorkOrderHandleRequest { | |||
/** | |||
* 巡检问题工单ID | |||
*/ | |||
private Integer workOrderId; | |||
/** | |||
* 巡检问题文件ID | |||
*/ | |||
private Integer questionId; | |||
/** | |||
* 处理后图片(多个图片逗号“,”分隔) | |||
*/ | |||
private String handlerImage; | |||
/** | |||
* 处理结果 | |||
*/ | |||
private String handlerResult; | |||
} |
@@ -0,0 +1,24 @@ | |||
package com.tuoheng.admin.entity.request; | |||
import com.tuoheng.common.common.BaseQuery; | |||
import lombok.Data; | |||
@Data | |||
public class WorkOrderQuestionRequest extends BaseQuery { | |||
/** | |||
* 工单ID | |||
*/ | |||
private Integer workOrderId; | |||
/** | |||
* 问题编码 | |||
*/ | |||
private String questionType; | |||
/** | |||
* 问题状态:0待处理 1已处理 | |||
*/ | |||
private Integer status; | |||
} |
@@ -4,12 +4,18 @@ import com.tuoheng.common.common.BaseQuery; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.util.List; | |||
@Data | |||
public class WorkOrderRequest extends BaseQuery implements Serializable { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 工单ID | |||
*/ | |||
private Integer id; | |||
/** | |||
* 问题工单号 | |||
*/ | |||
@@ -30,4 +36,9 @@ public class WorkOrderRequest extends BaseQuery implements Serializable { | |||
*/ | |||
private String createEndTime; | |||
/** | |||
* 处理人员 | |||
*/ | |||
private List<Integer> handleUserList; | |||
} |
@@ -0,0 +1,13 @@ | |||
package com.tuoheng.admin.entity.vo; | |||
import com.tuoheng.admin.entity.domain.Question; | |||
import com.tuoheng.admin.entity.domain.QuestionHandle; | |||
import lombok.Data; | |||
@Data | |||
public class QuestionDetailVO { | |||
private Question question; | |||
private QuestionHandle questionHandle; | |||
} |
@@ -0,0 +1,45 @@ | |||
package com.tuoheng.admin.entity.vo; | |||
import com.baomidou.mybatisplus.annotation.TableField; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import lombok.Data; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.util.Date; | |||
@Data | |||
public class QuestionHandleVO { | |||
/** | |||
* 处理人 | |||
*/ | |||
private Integer handlerUser; | |||
/** | |||
* 处理人 | |||
*/ | |||
private String handlerUserName; | |||
/** | |||
* 处理后图片(多个图片逗号“,”分隔) | |||
*/ | |||
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待处理 1已处理 | |||
*/ | |||
@TableField(exist = false) | |||
private Integer status; | |||
} |
@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty; | |||
import lombok.Data; | |||
import java.io.Serializable; | |||
import java.util.List; | |||
@Data | |||
public class QuestionReportVO implements Serializable { | |||
@@ -24,4 +25,7 @@ public class QuestionReportVO implements Serializable { | |||
@ApiModelProperty(value = "经度") | |||
private String lng; | |||
@ApiModelProperty(value = "问题处理清单") | |||
private List<QuestionHandleVO> questionHandleList; | |||
} |
@@ -0,0 +1,147 @@ | |||
package com.tuoheng.admin.entity.vo; | |||
import com.baomidou.mybatisplus.annotation.IdType; | |||
import com.baomidou.mybatisplus.annotation.TableId; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import com.tuoheng.admin.entity.domain.Question; | |||
import lombok.AllArgsConstructor; | |||
import lombok.Data; | |||
import lombok.NoArgsConstructor; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.util.Date; | |||
/** | |||
* 巡检任务 新增或修改请求参数 2022/7/27 | |||
* @author : qiujinyang | |||
*/ | |||
@Data | |||
@AllArgsConstructor | |||
@NoArgsConstructor | |||
public class QuestionVO { | |||
private static final long serialVersionUID = 1L; | |||
/** | |||
* 工单生成状态 | |||
*/ | |||
private Integer wordOrderStatus; | |||
/** | |||
* 工单处理状态 | |||
*/ | |||
private Integer handleStatus; | |||
/** | |||
* 任务ID | |||
*/ | |||
private Integer missionId; | |||
/** | |||
* 任务名称 | |||
*/ | |||
private String missionName; | |||
/** | |||
* 问题类型:病死树、林斑 | |||
*/ | |||
private String type; | |||
/** | |||
* 问题类型名称 | |||
*/ | |||
private String questionName; | |||
/** | |||
* 问题描述 | |||
*/ | |||
private String questionDesc; | |||
/** | |||
* 图片分析时间,可以通过这个时间来计算出坐标位置 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8") | |||
private Date analyseTime; | |||
/** | |||
* 文件编码 | |||
*/ | |||
private String fileCode; | |||
/** | |||
* 文件名称 | |||
*/ | |||
private String fileName; | |||
/** | |||
* 原图片位置 | |||
*/ | |||
private String fileOriginalUrl; | |||
/** | |||
* 分析后的图片位置 | |||
*/ | |||
private String fileMarkerUrl; | |||
/** | |||
* 经度 | |||
*/ | |||
private String lng; | |||
/** | |||
* 纬度 | |||
*/ | |||
private String lat; | |||
/** | |||
* 备注 | |||
*/ | |||
private String note; | |||
/** | |||
* 问题状态:1:确认,2:忽略,3:待确认 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 租户id | |||
*/ | |||
private Integer tenantId; | |||
/** | |||
* 主键ID | |||
*/ | |||
@TableId(value = "id", type = IdType.AUTO) | |||
private Integer id; | |||
/** | |||
* 添加人 | |||
*/ | |||
private Integer createUser; | |||
/** | |||
* 创建时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date createTime; | |||
/** | |||
* 更新人 | |||
*/ | |||
private Integer updateUser; | |||
/** | |||
* 更新时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date updateTime; | |||
/** | |||
* 有效标识 | |||
*/ | |||
private Integer mark; | |||
} |
@@ -0,0 +1,81 @@ | |||
package com.tuoheng.admin.entity.vo; | |||
import com.fasterxml.jackson.annotation.JsonFormat; | |||
import lombok.Data; | |||
import org.springframework.format.annotation.DateTimeFormat; | |||
import java.util.Date; | |||
@Data | |||
public class WorkOrderQuestionVO { | |||
/** | |||
* 问题ID | |||
*/ | |||
private Integer questionId; | |||
/** | |||
* 问题类型 | |||
*/ | |||
private String type; | |||
/** | |||
* 问题类型名称 | |||
*/ | |||
private String questionName; | |||
/** | |||
* 原图片地址 | |||
*/ | |||
private String fileOriginalUrl; | |||
/** | |||
* 分析后的图片地址 | |||
*/ | |||
private String fileMarkerUrl; | |||
/** | |||
* 经度 | |||
*/ | |||
private String lng; | |||
/** | |||
* 纬度 | |||
*/ | |||
private String lat; | |||
/** | |||
* 处理状态:0待处理 1已处理 | |||
*/ | |||
private Integer status; | |||
/** | |||
* 发现时间 | |||
*/ | |||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") | |||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") | |||
private Date createTime; | |||
/** | |||
* 处理人员 | |||
*/ | |||
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; | |||
/** | |||
* 处理人员名称 | |||
*/ | |||
private String handlerUserName; | |||
} |
@@ -0,0 +1,23 @@ | |||
package com.tuoheng.admin.enums; | |||
import lombok.Getter; | |||
public enum WorkOrderStatusEnum { | |||
//工单状态:5待分配 10处理中(已分配) 15已完成 | |||
TO_BE_ALLOCATED(5,"待分配"), | |||
ALLOCATED(10,"已分配"), | |||
COMPLETED(15,"已完成"); | |||
WorkOrderStatusEnum(int code, String description){ | |||
this.code = code; | |||
this.description = description; | |||
} | |||
@Getter | |||
private int code; | |||
@Getter | |||
private String description; | |||
} |
@@ -2,6 +2,11 @@ package com.tuoheng.admin.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.tuoheng.admin.entity.domain.QuestionHandle; | |||
import com.tuoheng.admin.entity.vo.QuestionHandleVO; | |||
import org.apache.ibatis.annotations.Param; | |||
import java.util.List; | |||
public interface QuestionHandleMapper extends BaseMapper<QuestionHandle> { | |||
List<QuestionHandleVO> getList(@Param("questionId") Integer questionId); | |||
} |
@@ -1,7 +1,13 @@ | |||
package com.tuoheng.admin.mapper; | |||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |||
import com.baomidou.mybatisplus.core.metadata.IPage; | |||
import com.tuoheng.admin.entity.domain.WorkOrder; | |||
import com.tuoheng.admin.entity.request.WorkOrderQuestionRequest; | |||
import com.tuoheng.admin.entity.vo.WorkOrderQuestionVO; | |||
import org.apache.ibatis.annotations.Param; | |||
public interface WorkOrderMapper extends BaseMapper<WorkOrder> { | |||
IPage<WorkOrderQuestionVO> questionPage(@Param("page") IPage page, @Param("request") WorkOrderQuestionRequest request); | |||
} |
@@ -5,10 +5,12 @@ import com.tuoheng.admin.entity.domain.Question; | |||
import com.tuoheng.admin.entity.request.*; | |||
import com.tuoheng.admin.entity.vo.QuestionCountVO; | |||
import com.tuoheng.admin.entity.vo.QuestionTypeCountVO; | |||
import com.tuoheng.admin.entity.vo.QuestionVO; | |||
import com.tuoheng.common.common.IBaseService; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import java.text.ParseException; | |||
import java.util.List; | |||
import java.util.Map; | |||
@@ -26,7 +28,7 @@ public interface IQuestionService extends IBaseService<Question> { | |||
* @param query | |||
* @return | |||
*/ | |||
IPage<Question> queryPage(QuestionQuery query); | |||
IPage<QuestionVO> queryPage(QuestionQuery query) throws ParseException; | |||
List<Question> distributed(QuestionQuery query); | |||
@@ -1,10 +1,23 @@ | |||
package com.tuoheng.admin.service; | |||
import com.tuoheng.admin.entity.domain.WorkOrder; | |||
import com.tuoheng.admin.entity.request.WorkOrderHandleRequest; | |||
import com.tuoheng.admin.entity.request.WorkOrderQuestionRequest; | |||
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); | |||
JsonResult generate(Integer[] ids); | |||
JsonResult assign(WorkOrderRequest request); | |||
JsonResult handle(WorkOrderHandleRequest request); | |||
JsonResult questionPage(WorkOrderQuestionRequest request); | |||
JsonResult questionDetail(Integer questionId); | |||
} |
@@ -13,6 +13,7 @@ import com.tuoheng.admin.entity.request.index.GetAirportDetailDto; | |||
import com.tuoheng.admin.entity.request.index.GetQuestionListDto; | |||
import com.tuoheng.admin.entity.vo.MissionVO; | |||
import com.tuoheng.admin.enums.MarkTypeEnum; | |||
import com.tuoheng.admin.enums.TaskStatusEnum; | |||
import com.tuoheng.admin.mapper.QuestionMapper; | |||
import com.tuoheng.admin.mapper.ThMissionMapper; | |||
import com.tuoheng.admin.service.IndexService; | |||
@@ -30,6 +31,7 @@ import org.springframework.transaction.annotation.Transactional; | |||
import java.math.BigDecimal; | |||
import java.util.ArrayList; | |||
import java.util.Arrays; | |||
import java.util.List; | |||
import java.util.Objects; | |||
@@ -56,7 +58,7 @@ public class IndexServiceImpl implements IndexService { | |||
page.setCurrent(baseQuery.getPage() != null ? baseQuery.getPage() : 0); | |||
LambdaQueryWrapper<ThMission> queryMission=new LambdaQueryWrapper<>(); | |||
queryMission.eq(ThMission::getMark,MarkTypeEnum.VALID.getCode()).orderByDesc(ThMission::getCreateTime); | |||
queryMission.in(ThMission::getStatus, Arrays.asList(TaskStatusEnum.FLIGHT.getCode(),TaskStatusEnum.WAIT.getCode())); | |||
IPage<ThMission> thMissionIPage = thMissionMapper.selectPage(page, queryMission); | |||
List<ThMission> records = thMissionIPage.getRecords(); | |||
List<MissionVO> result=new ArrayList<>(); |
@@ -6,20 +6,17 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | |||
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.Question; | |||
import com.tuoheng.admin.entity.domain.QuestionType; | |||
import com.tuoheng.admin.entity.domain.ThInspection; | |||
import com.tuoheng.admin.entity.domain.ThMission; | |||
import com.tuoheng.admin.entity.domain.*; | |||
import com.tuoheng.admin.entity.request.*; | |||
import com.tuoheng.admin.entity.vo.MissionVO; | |||
import com.tuoheng.admin.entity.vo.QuestionCountVO; | |||
import com.tuoheng.admin.entity.vo.QuestionTypeCountVO; | |||
import com.tuoheng.admin.entity.vo.QuestionVO; | |||
import com.tuoheng.admin.enums.*; | |||
import com.tuoheng.admin.mapper.QuestionMapper; | |||
import com.tuoheng.admin.mapper.QuestionTypeMapper; | |||
import com.tuoheng.admin.mapper.ThInspectionMapper; | |||
import com.tuoheng.admin.mapper.ThMissionMapper; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.service.IQuestionService; | |||
import com.tuoheng.admin.service.IQuestionTypeService; | |||
import com.tuoheng.admin.utils.TimeUtil; | |||
import com.tuoheng.common.common.BaseServiceImpl; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.JsonResult; | |||
@@ -29,8 +26,10 @@ import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.http.HttpStatus; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import org.springframework.util.CollectionUtils; | |||
import java.text.ParseException; | |||
import java.text.SimpleDateFormat; | |||
import java.util.*; | |||
@@ -55,39 +54,61 @@ public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Questio | |||
@Autowired | |||
private ThInspectionMapper inspectionMapper; | |||
@Autowired | |||
private WorkOrderQuestionMapper workOrderQuestionMapper; | |||
@Autowired | |||
private IQuestionTypeService questionTypeService; | |||
private final static SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |||
@Override | |||
public IPage<Question> queryPage(QuestionQuery query) { | |||
@Transactional(readOnly = true) | |||
public IPage<QuestionVO> queryPage(QuestionQuery query) throws ParseException { | |||
if(null == query.getPage() || null == query.getLimit()){ | |||
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); | |||
} | |||
IPage<Question> pageData=null; | |||
try { | |||
// 获取分页数据 | |||
IPage<Question> page = new Page<>(query.getPage(), query.getLimit()); | |||
LambdaQueryWrapper<Question> questionLambdaQueryWrapper = new LambdaQueryWrapper<Question>() | |||
.eq(ObjectUtil.isNotEmpty(query.getMissionId()), Question::getMissionId, query.getMissionId()) | |||
.like(ObjectUtil.isNotEmpty(query.getName()), Question::getMissionName, query.getName()) | |||
.eq(ObjectUtil.isNotEmpty(query.getType()), Question::getType, query.getType()) | |||
.eq(ObjectUtil.isNotEmpty(query.getStatus()), Question::getStatus, query.getStatus()) | |||
//.eq(Question::getTenantId, ShiroUtils.getTenantId()) | |||
.eq(Question::getMark, MarkTypeEnum.VALID.getCode()).orderByDesc(Question::getCreateTime); | |||
if(ObjectUtil.isNotEmpty(query.getStartTime()) && ObjectUtil.isNotEmpty(query.getEndTime())){ | |||
query.setStartTime(query.getStartTime()+" 00:00:00"); | |||
query.setEndTime(query.getEndTime()+" 23:59:59"); | |||
questionLambdaQueryWrapper.between(Question::getCreateTime, dateformat.parse(query.getStartTime()), dateformat.parse(query.getEndTime())); | |||
} | |||
pageData = questionMapper.selectPage(page, questionLambdaQueryWrapper); | |||
}catch (Exception e){ | |||
e.printStackTrace(); | |||
log.error("查询出错!"); | |||
// 获取分页数据 | |||
IPage<Question> page = new Page<>(query.getPage(), query.getLimit()); | |||
LambdaQueryWrapper<Question> questionLambdaQueryWrapper = new LambdaQueryWrapper<Question>() | |||
.eq(ObjectUtil.isNotEmpty(query.getMissionId()), Question::getMissionId, query.getMissionId()) | |||
.like(ObjectUtil.isNotEmpty(query.getName()), Question::getMissionName, query.getName()) | |||
.eq(ObjectUtil.isNotEmpty(query.getType()), Question::getType, query.getType()) | |||
.eq(ObjectUtil.isNotEmpty(query.getStatus()), Question::getStatus, query.getStatus()) | |||
//.eq(Question::getTenantId, ShiroUtils.getTenantId()) | |||
.eq(Question::getMark, MarkTypeEnum.VALID.getCode()).orderByDesc(Question::getCreateTime); | |||
if(ObjectUtil.isNotEmpty(query.getStartTime()) && ObjectUtil.isNotEmpty(query.getEndTime())){ | |||
query.setStartTime(query.getStartTime()+" 00:00:00"); | |||
query.setEndTime(query.getEndTime()+" 23:59:59"); | |||
questionLambdaQueryWrapper.between(Question::getCreateTime, dateformat.parse(query.getStartTime()), dateformat.parse(query.getEndTime())); | |||
} | |||
return pageData; | |||
IPage<Question> pageData = questionMapper.selectPage(page, questionLambdaQueryWrapper); | |||
List<Question> questions = pageData.getRecords(); | |||
List<QuestionVO> questionVOList = new ArrayList<>(); | |||
questions.forEach(question->{ | |||
QuestionVO questionVO = new QuestionVO(); | |||
BeanUtils.copyProperties(question,questionVO); | |||
LambdaQueryWrapper<WorkOrderQuestion> lambdaQueryWrapper = new LambdaQueryWrapper<>(); | |||
lambdaQueryWrapper.eq(WorkOrderQuestion::getQuestionId, question.getId()); | |||
WorkOrderQuestion workOrderQuestion = workOrderQuestionMapper.selectOne(lambdaQueryWrapper); | |||
if(workOrderQuestion != null){ | |||
questionVO.setWordOrderStatus(1); | |||
questionVO.setHandleStatus(workOrderQuestion.getStatus()); | |||
}else { | |||
questionVO.setWordOrderStatus(0); | |||
questionVO.setHandleStatus(0); | |||
} | |||
questionVOList.add(questionVO); | |||
}); | |||
IPage<QuestionVO> resultPage=new Page<>(); | |||
resultPage.setCurrent(pageData.getCurrent()); | |||
resultPage.setPages(pageData.getPages()); | |||
resultPage.setSize(pageData.getSize()); | |||
resultPage.setTotal(pageData.getTotal()); | |||
resultPage.setRecords(questionVOList); | |||
return resultPage; | |||
} | |||
@Override | |||
@@ -373,4 +394,5 @@ public class QuestionServiceImpl extends BaseServiceImpl<QuestionMapper, Questio | |||
} | |||
return inspectionData.get(0); | |||
} | |||
} |
@@ -8,30 +8,25 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | |||
import com.lowagie.text.*; | |||
import com.tuoheng.admin.common.ServiceExceptionEnum; | |||
import com.tuoheng.admin.entity.domain.Question; | |||
import com.tuoheng.admin.entity.domain.QuestionHandle; | |||
import com.tuoheng.admin.entity.domain.Report; | |||
import com.tuoheng.admin.entity.domain.ThMission; | |||
import com.tuoheng.admin.entity.request.ReportRequest; | |||
import com.tuoheng.admin.entity.vo.*; | |||
import com.tuoheng.admin.enums.*; | |||
import com.tuoheng.admin.mapper.ReportMapper; | |||
import com.tuoheng.admin.mapper.ThInspectionMapper; | |||
import com.tuoheng.admin.mapper.ThMissionMapper; | |||
import com.tuoheng.admin.mapper.*; | |||
import com.tuoheng.admin.service.IQuestionService; | |||
import com.tuoheng.admin.service.IReportService; | |||
import com.tuoheng.admin.service.IThInspectionService; | |||
import com.tuoheng.admin.utils.ImgTypeConvert; | |||
import com.tuoheng.admin.utils.WeatherUtil; | |||
import com.tuoheng.admin.utils.WordUtilsOld; | |||
import com.tuoheng.common.common.BaseServiceImpl; | |||
import com.tuoheng.common.config.CommonConfig; | |||
import com.tuoheng.common.config.UploadFileConfig; | |||
import com.tuoheng.common.exception.ServiceException; | |||
import com.tuoheng.common.utils.DateUtils; | |||
import com.tuoheng.common.utils.JsonResult; | |||
import com.tuoheng.common.utils.StringUtils; | |||
import com.tuoheng.system.service.impl.UserServiceImpl; | |||
import com.tuoheng.system.utils.ShiroUtils; | |||
import io.swagger.models.auth.In; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
@@ -41,12 +36,7 @@ import org.springframework.stereotype.Service; | |||
import javax.servlet.http.HttpServletRequest; | |||
import javax.servlet.http.HttpServletResponse; | |||
import java.io.File; | |||
import java.io.FileInputStream; | |||
import java.io.InputStream; | |||
import java.io.OutputStream; | |||
import java.math.BigDecimal; | |||
import java.net.URLEncoder; | |||
import java.nio.charset.StandardCharsets; | |||
import java.text.SimpleDateFormat; | |||
import java.util.*; | |||
import java.util.List; | |||
@@ -79,6 +69,9 @@ public class ReportServiceImpl extends BaseServiceImpl<ReportMapper, Report> imp | |||
@Autowired | |||
private UserServiceImpl userService; | |||
@Autowired | |||
private QuestionHandleMapper questionHandleMapper; | |||
@Override | |||
public JsonResult generateReport(Integer missionId) { | |||
@@ -218,6 +211,9 @@ public class ReportServiceImpl extends BaseServiceImpl<ReportMapper, Report> imp | |||
for (Question question : questionList) { | |||
QuestionReportVO questionReportVO=new QuestionReportVO(); | |||
BeanUtils.copyProperties(question,questionReportVO); | |||
List<QuestionHandleVO> questionHandleList = questionHandleMapper.getList(question.getId()); | |||
questionReportVO.setQuestionHandleList(questionHandleList); | |||
questionReportVOList.add(questionReportVO); | |||
} | |||
//问题列表 |
@@ -5,11 +5,19 @@ 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.Question; | |||
import com.tuoheng.admin.entity.domain.QuestionHandle; | |||
import com.tuoheng.admin.entity.domain.WorkOrder; | |||
import com.tuoheng.admin.entity.domain.WorkOrderQuestion; | |||
import com.tuoheng.admin.entity.request.WorkOrderHandleRequest; | |||
import com.tuoheng.admin.entity.request.WorkOrderQuestionRequest; | |||
import com.tuoheng.admin.entity.request.WorkOrderRequest; | |||
import com.tuoheng.admin.entity.vo.WorkOrderInfoVO; | |||
import com.tuoheng.admin.entity.vo.QuestionDetailVO; | |||
import com.tuoheng.admin.entity.vo.WorkOrderQuestionVO; | |||
import com.tuoheng.admin.enums.MarkTypeEnum; | |||
import com.tuoheng.admin.enums.WorkOrderStatusEnum; | |||
import com.tuoheng.admin.mapper.QuestionHandleMapper; | |||
import com.tuoheng.admin.mapper.QuestionMapper; | |||
import com.tuoheng.admin.mapper.WorkOrderMapper; | |||
import com.tuoheng.admin.mapper.WorkOrderQuestionMapper; | |||
import com.tuoheng.admin.service.IWorkOrderService; | |||
@@ -20,10 +28,12 @@ import com.tuoheng.common.utils.JsonResult; | |||
import com.tuoheng.common.utils.StringUtils; | |||
import com.tuoheng.system.entity.User; | |||
import com.tuoheng.system.mapper.UserMapper; | |||
import com.tuoheng.system.utils.ShiroUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
import org.springframework.beans.BeanUtils; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.transaction.annotation.Transactional; | |||
import java.util.Arrays; | |||
import java.util.Date; | |||
@@ -40,6 +50,12 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO | |||
@Autowired | |||
private WorkOrderQuestionMapper workOrderQuestionMapper; | |||
@Autowired | |||
private QuestionHandleMapper questionHandleMapper; | |||
@Autowired | |||
private QuestionMapper questionMapper; | |||
@Autowired | |||
private UserMapper userMapper; | |||
@@ -93,4 +109,108 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO | |||
return JsonResult.success(pageData); | |||
} | |||
@Override | |||
@Transactional | |||
public JsonResult generate(Integer[] ids) { | |||
//校验,已生成工单的问题,无法生成工单 | |||
Integer count = workOrderQuestionMapper.selectCount(new LambdaQueryWrapper<WorkOrderQuestion>() | |||
.in(WorkOrderQuestion::getQuestionId, ids)); | |||
if(count > 0){ | |||
return JsonResult.error("有问题已生成工单"); | |||
} | |||
String code = DateUtils.generateCode("XJGD"); | |||
WorkOrder workOrder = new WorkOrder(); | |||
workOrder.setCode(code); | |||
workOrderMapper.insert(workOrder); | |||
for (Integer id : ids) { | |||
WorkOrderQuestion workOrderQuestion = new WorkOrderQuestion(); | |||
workOrderQuestion.setWorkOrderId(workOrder.getId()); | |||
workOrderQuestion.setQuestionId(id); | |||
workOrderQuestionMapper.insert(workOrderQuestion); | |||
} | |||
return JsonResult.success(); | |||
} | |||
@Override | |||
public JsonResult assign(WorkOrderRequest request) { | |||
WorkOrder workOrder = new WorkOrder(); | |||
workOrder.setId(request.getId()); | |||
workOrder.setStatus(WorkOrderStatusEnum.ALLOCATED.getCode()); | |||
workOrder.setAssignUser(StringUtils.join(request.getHandleUserList(), ",")); | |||
workOrder.setAssignTime(new Date()); | |||
workOrderMapper.updateById(workOrder); | |||
return JsonResult.success(); | |||
} | |||
@Override | |||
@Transactional | |||
public JsonResult handle(WorkOrderHandleRequest request) { | |||
//将工单子表状态修改为已处理 | |||
WorkOrderQuestion workOrderQuestion = new WorkOrderQuestion(); | |||
BeanUtils.copyProperties(request, workOrderQuestion); | |||
workOrderQuestion.setStatus(1); | |||
workOrderQuestionMapper.update(workOrderQuestion, new LambdaQueryWrapper<WorkOrderQuestion>() | |||
.eq(WorkOrderQuestion::getWorkOrderId, request.getWorkOrderId()) | |||
.eq(WorkOrderQuestion::getQuestionId, request.getQuestionId())); | |||
//修改问题处理结果表 | |||
QuestionHandle questionHandle = new QuestionHandle(); | |||
BeanUtils.copyProperties(request, questionHandle); | |||
questionHandle.setHandlerUser(ShiroUtils.getUserId()); | |||
questionHandle.setHandlerTime(new Date()); | |||
questionHandleMapper.update(questionHandle, new LambdaQueryWrapper<QuestionHandle>() | |||
.eq(QuestionHandle::getQuestionId, request.getQuestionId())); | |||
//查询工单下待处理的问题,如全部处理完,将工单状态修改为已完成 | |||
Integer count = workOrderQuestionMapper.selectCount(new LambdaQueryWrapper<WorkOrderQuestion>() | |||
.eq(WorkOrderQuestion::getWorkOrderId, request.getWorkOrderId()) | |||
.eq(WorkOrderQuestion::getStatus, 0)); | |||
if(count == 0){ | |||
WorkOrder workOrder = new WorkOrder(); | |||
workOrder.setId(request.getWorkOrderId()); | |||
workOrder.setStatus(WorkOrderStatusEnum.COMPLETED.getCode()); | |||
workOrderMapper.updateById(workOrder); | |||
} | |||
return JsonResult.success(); | |||
} | |||
@Override | |||
public JsonResult questionPage(WorkOrderQuestionRequest request) { | |||
// 设置分页参数 | |||
IPage<WorkOrderQuestionVO> page = new Page<>(request.getPage(), request.getLimit()); | |||
// 查询结果 | |||
IPage<WorkOrderQuestionVO> pageInfo = workOrderMapper.questionPage(page, request); | |||
return JsonResult.success(pageInfo); | |||
} | |||
@Override | |||
public JsonResult questionDetail(Integer questionId) { | |||
QuestionDetailVO questionDetailVO = new QuestionDetailVO(); | |||
//查询问题详情 | |||
Question question = questionMapper.selectById(questionId); | |||
questionDetailVO.setQuestion(question); | |||
//查询问题处理详情 | |||
QuestionHandle questionHandle = questionHandleMapper.selectOne(new LambdaQueryWrapper<QuestionHandle>() | |||
.eq(QuestionHandle::getQuestionId, questionId) | |||
.eq(QuestionHandle::getMark, MarkTypeEnum.VALID.getCode())); | |||
//查询问题处理状态 | |||
WorkOrderQuestion workOrderQuestion = workOrderQuestionMapper.selectOne(new LambdaQueryWrapper<WorkOrderQuestion>() | |||
.eq(WorkOrderQuestion::getQuestionId, questionId)); | |||
questionDetailVO.setQuestionHandle(questionHandle); | |||
questionHandle.setStatus(workOrderQuestion.getStatus()); | |||
questionDetailVO.setQuestionHandle(questionHandle); | |||
return JsonResult.success(questionDetailVO); | |||
} | |||
} |
@@ -0,0 +1,17 @@ | |||
<?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.QuestionHandleMapper"> | |||
<select id="getList" resultType="com.tuoheng.admin.entity.vo.QuestionHandleVO"> | |||
SELECT | |||
qh.handler_user AS handlerUser, | |||
qh.handler_image AS handlerImage, | |||
qh.handler_result AS handlerResult, | |||
qh.handler_time AS handlerTime, | |||
u.realname AS handlerUserName | |||
FROM th_question_handle qh | |||
LEFT JOIN sys_user u ON qh.handler_user = u.id | |||
WHERE qh.question_id = #{questionId} | |||
</select> | |||
</mapper> |
@@ -20,7 +20,7 @@ | |||
a.mission_name as missionName, c.execution_start_time as inspectionTime, | |||
a.file_marker_url as fileMarkerUrl, d.handler_result as handlerResult, | |||
d.handler_image as handlerImage, d.handler_user as handlerUserId, e.realname as handlerUserName, | |||
d.handler_time as handlerTime | |||
d.handler_time as handlerTime, a.lng, a.lat | |||
from th_question a | |||
inner join th_question_type b on b.code = a.type and b.mark = 1 | |||
inner join th_mission c on c.id = a.mission_id and c.mark = 1 |
@@ -0,0 +1,38 @@ | |||
<?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"> | |||
<select id="questionPage" resultType="com.tuoheng.admin.entity.vo.WorkOrderQuestionVO"> | |||
SELECT | |||
q.type, | |||
q.id AS questionId, | |||
q.question_name AS questionName, | |||
q.question_desc AS questionDesc, | |||
q.file_original_url AS fileOriginalUrl, | |||
q.file_marker_url AS fileMarkerUrl, | |||
q.lng AS lng, | |||
q.lat AS lat, | |||
woq.`status` AS status, | |||
q.create_time AS createTime, | |||
qh.handler_user AS handlerUser, | |||
qh.handler_image AS handlerImage, | |||
qh.handler_result AS handlerResult, | |||
qh.handler_time AS handlerTime, | |||
u.realname AS handlerUserName | |||
FROM th_work_order wo | |||
LEFT JOIN th_work_order_question woq on wo.id = woq.work_order_id | |||
LEFT JOIN th_question q on woq.question_id = q.id | |||
LEFT JOIN th_question_handle qh on q.id = qh.question_id | |||
LEFT JOIN sys_user u on qh.handler_user = u.id | |||
WHERE | |||
wo.mark = 1 | |||
AND wo.id = #{request.workOrderId} | |||
<if test="request.questionType != '' and request.questionType != null"> | |||
AND q.type = #{request.questionType} | |||
</if> | |||
<if test="request.status != null"> | |||
AND woq.`status` = #{request.status} | |||
</if> | |||
</select> | |||
</mapper> |