|  |  |  | 
|---|
|  |  |  | import com.dy.common.util.IDLongGenerator; | 
|---|
|  |  |  | import com.dy.common.webUtil.BaseResponse; | 
|---|
|  |  |  | import com.dy.common.webUtil.BaseResponseUtils; | 
|---|
|  |  |  | import com.dy.common.webUtil.QueryResultVo; | 
|---|
|  |  |  | import com.dy.pipIrrApp.inspect.dto.Inspects; | 
|---|
|  |  |  | import com.dy.pipIrrApp.inspect.qo.QoInspect; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.pojoOp.OpeInspect; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.pojoOp.OpeTrack; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voOp.VoInspect; | 
|---|
|  |  |  | import com.dy.pipIrrGlobal.voOp.VoIssueReport; | 
|---|
|  |  |  | import jakarta.validation.Valid; | 
|---|
|  |  |  | import lombok.extern.slf4j.Slf4j; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.http.MediaType; | 
|---|
|  |  |  | import org.springframework.transaction.annotation.Transactional; | 
|---|
|  |  |  | import org.springframework.validation.BindingResult; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.PostMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestBody; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.RestController; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import java.util.Date; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 添加巡检记录 | 
|---|
|  |  |  | OpeInspect opeInspect = new OpeInspect(); | 
|---|
|  |  |  | opeInspect.setInspectorId(inspects.getInspectorId()); | 
|---|
|  |  |  | opeInspect.setInspectorId(inspectorId); | 
|---|
|  |  |  | if(startTime != null) { | 
|---|
|  |  |  | opeInspect.setStartTime(startTime); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | }else { | 
|---|
|  |  |  | // 该巡检已上传过记录,续传 | 
|---|
|  |  |  | if(stopTime != null) { | 
|---|
|  |  |  | OpeInspect inspect = new OpeInspect(); | 
|---|
|  |  |  | inspect.setId(inspectId); | 
|---|
|  |  |  | inspect.setStopTime(stopTime); | 
|---|
|  |  |  | inspectSv.updateInspect(inspect); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if(tracks != null && tracks.size() > 0) { | 
|---|
|  |  |  | for (int j = 0; j < tracks.size(); j++) { | 
|---|
|  |  |  | tracks.get(j).setId(idLongGenerator.generate()); | 
|---|
|  |  |  | tracks.get(j).setInspectId(inspectId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | Integer rec = inspectSv.insertTracks(tracks); | 
|---|
|  |  |  | if(rec == null || rec == 0) { | 
|---|
|  |  |  | return BaseResponseUtils.buildErrorMsg("巡检轨迹添加失败"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess() ; | 
|---|
|  |  |  | 
|---|
|  |  |  | return BaseResponseUtils.buildErrorMsg("您提交的巡检轨迹为空"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * 查询巡检轨迹 | 
|---|
|  |  |  | * @param qo | 
|---|
|  |  |  | * @return | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @GetMapping(path = "/getInspects") | 
|---|
|  |  |  | @SsoAop() | 
|---|
|  |  |  | public BaseResponse<QueryResultVo<List<VoInspect>>> getInspects(QoInspect qo){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | try{ | 
|---|
|  |  |  | QueryResultVo<List<VoInspect>> res = inspectSv.getInspects(qo); | 
|---|
|  |  |  | return BaseResponseUtils.buildSuccess(res); | 
|---|
|  |  |  | }catch (Exception e){ | 
|---|
|  |  |  | log.error("获取巡检列表异常", e); | 
|---|
|  |  |  | return BaseResponseUtils.buildException(e.getMessage()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|