|
|
@@ -7,20 +7,20 @@ import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import com.tuoheng.common.core.common.BaseServiceImpl; |
|
|
|
import com.tuoheng.common.core.config.common.CommonConfig; |
|
|
|
import com.tuoheng.common.core.exception.ServiceException; |
|
|
|
import com.tuoheng.common.core.utils.DateUtils; |
|
|
|
import com.tuoheng.common.core.utils.JsonResult; |
|
|
|
import com.tuoheng.common.core.utils.SecurityUserUtils; |
|
|
|
import com.tuoheng.common.core.utils.StringUtils; |
|
|
|
import com.tuoheng.miniprogram.dao.*; |
|
|
|
import com.tuoheng.miniprogram.entity.InspectionFile; |
|
|
|
import com.tuoheng.miniprogram.entity.User; |
|
|
|
import com.tuoheng.miniprogram.entity.WorkOrder; |
|
|
|
import com.tuoheng.miniprogram.entity.WorkOrderFile; |
|
|
|
import com.tuoheng.miniprogram.entity.*; |
|
|
|
import com.tuoheng.miniprogram.entity.dto.WorkOrderDto; |
|
|
|
import com.tuoheng.miniprogram.entity.query.HandleQuery; |
|
|
|
import com.tuoheng.miniprogram.entity.query.WorkOrderQuery; |
|
|
|
import com.tuoheng.miniprogram.enums.*; |
|
|
|
import com.tuoheng.miniprogram.service.IWorkOrderService; |
|
|
|
import com.tuoheng.miniprogram.vo.WorkOrderHandleVo; |
|
|
|
import com.tuoheng.miniprogram.vo.WorkOrderInfoVo; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
@@ -57,6 +57,15 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
@Autowired |
|
|
|
private DeptMapper deptMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private InspectionMapper inspectionMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private QuestionTypeMapper questionTypeMapper; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private RoadInformationMapper roadInformationMapper; |
|
|
|
|
|
|
|
@Override |
|
|
|
public JsonResult addInfo(WorkOrderDto dto) { |
|
|
|
if(StringUtils.isEmpty(dto.getTenantId())){ |
|
|
@@ -237,6 +246,72 @@ public class WorkOrderServiceImpl extends BaseServiceImpl<WorkOrderMapper, WorkO |
|
|
|
return JsonResult.success(pageData); |
|
|
|
} |
|
|
|
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(),WorkOrderEnum.DATA_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 处理工单 |
|
|
|
* @param query |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
public JsonResult handle(HandleQuery query) { |
|
|
|
if(StringUtils.isEmpty(query.getId())){ |
|
|
|
JsonResult.error(WorkOrderEnum.WORK_ORDER_ID_IS_NULL.getCode(),WorkOrderEnum.WORK_ORDER_ID_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
if(null == query.getPage() && null == query.getLimit()){ |
|
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
} |
|
|
|
//获取分页数据 |
|
|
|
IPage<InspectionFile> page = new Page<>(query.getPage(),query.getLimit()); |
|
|
|
IPage<WorkOrderHandleVo> pageData = new Page<>(query.getPage(),query.getLimit()); |
|
|
|
//根据工单id获取对应的问题集合 |
|
|
|
List<WorkOrderFile> workOrderFiles = workOrderFileMapper.selectList(Wrappers.<WorkOrderFile>lambdaQuery() |
|
|
|
.eq(WorkOrderFile::getWorkOrderId, query.getId())); |
|
|
|
if(null == workOrderFiles){ |
|
|
|
return JsonResult.error(WorkOrderEnum.DATA_IS_NULL.getCode(),WorkOrderEnum.DATA_IS_NULL.getMsg()); |
|
|
|
} |
|
|
|
//工单子表获取对应的问题集合id |
|
|
|
List<String> inspectionFiledIds = workOrderFiles.stream().map(o -> o.getInspectionFileId()).collect(Collectors.toList()); |
|
|
|
List<InspectionFile> inspectionFilesList = inspectionFileMapper.selectBatchIds(inspectionFiledIds); |
|
|
|
//设置分页 |
|
|
|
IPage<InspectionFile> inspectionFilePageData = page.setRecords(inspectionFilesList); |
|
|
|
List<WorkOrderHandleVo> list = inspectionFilePageData.getRecords().stream().map(t -> { |
|
|
|
WorkOrderHandleVo vo = new WorkOrderHandleVo(); |
|
|
|
BeanUtils.copyProperties(t, vo); |
|
|
|
//缩略图处理 |
|
|
|
vo.setFileThumbnail(CommonConfig.imageURL+t.getFileThumbnail()); |
|
|
|
//任务名称 任务执行时间 道路位置编号 |
|
|
|
if (StringUtils.isEmpty(t.getInspectionId())) { |
|
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
} |
|
|
|
Inspection inspection = inspectionMapper.selectById(t.getInspectionId()); |
|
|
|
if (ObjectUtil.isNotNull(inspection)) { |
|
|
|
vo.setName(inspection.getName()); |
|
|
|
vo.setExecutionStartTime(inspection.getExecutionStartTime()); |
|
|
|
RoadInformation roadInformation = roadInformationMapper.selectById(inspection.getRoadId()); |
|
|
|
if (null != roadInformation) { |
|
|
|
if (StringUtils.isEmpty(roadInformation.getCode())) { |
|
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
} |
|
|
|
vo.setCode(roadInformation.getCode()); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
//问题类型 |
|
|
|
if (StringUtils.isEmpty(t.getQuestionId())) { |
|
|
|
throw new ServiceException(ServiceExceptionEnum.PARAMETER_IS_NULL); |
|
|
|
} |
|
|
|
QuestionType questionType = questionTypeMapper.selectById(t.getQuestionId()); |
|
|
|
if (ObjectUtil.isNotNull(questionType)) { |
|
|
|
vo.setType(questionType.getName()); |
|
|
|
} |
|
|
|
return vo; |
|
|
|
|
|
|
|
}).collect(Collectors.toList()); |
|
|
|
pageData.setRecords(list); |
|
|
|
|
|
|
|
return JsonResult.success(pageData); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |