| | |
| | | gdWorkOrderFlowEntity.setWorkOrderId(gdPatrolTaskEntity.getId()); |
| | | gdWorkOrderFlowEntity.setFlowName(PatrolTaskStatusEnum.PENDING_SIGNING.getStageDesc()); |
| | | gdWorkOrderFlowEntity.setFlowDesc(AuthUtil.getUserName() + " " + DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss") + " 发布任务,等待接单"); |
| | | gdWorkOrderFlowEntity.setOperator(AuthUtil.getUserName()); |
| | | gdWorkOrderFlowEntity.setOperator(AuthUtil.getNickName()); |
| | | gdWorkOrderFlowEntity.setType(WorkOrderTypeEnum.PATROL_TASK.getValue()); |
| | | gdWorkOrderFlowEntity.setAreaCode(gdPatrolTaskEntity.getAreaCode()); |
| | | gdWorkOrderFlowEntity.setCreateDept(Long.valueOf(AuthUtil.getDeptId())); |
| | |
| | | flowEntity.setCreateUser(AuthUtil.getUserId()); |
| | | flowEntity.setWorkOrderId(workOrderId); |
| | | flowEntity.setFlowName(newStatus.getStageDesc()); |
| | | flowEntity.setFlowDesc(String.format("%s %s 更新了任务信息,状态转换为:%s", |
| | | AuthUtil.getUserName(), |
| | | DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"), |
| | | newStatus.getStageDesc())); |
| | | flowEntity.setOperator(AuthUtil.getUserName()); |
| | | flowEntity.setFlowDesc(newStatus.getDesc()); |
| | | flowEntity.setOperator(AuthUtil.getNickName()); |
| | | flowEntity.setType(WorkOrderTypeEnum.WORK_ORDER_TASK.getValue()); |
| | | flowEntity.setFlowStatus(newStatus.getMaxCode()); |
| | | flowEntity.setWorkStatus(newStatus.getCode()); |
| | | flowEntity.setCreateDept(Long.valueOf(AuthUtil.getDeptId())); |
| | | return gdWorkOrderFlowService.save(flowEntity); |
| | | } |
| | |
| | | flowEntity.setCreateUser(AuthUtil.getUserId()); |
| | | flowEntity.setWorkOrderId(taskEntity.getId()); |
| | | flowEntity.setFlowName(targetStatus.getDesc()); |
| | | flowEntity.setFlowDesc(AuthUtil.getUserName() + " " + DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss") + " 更新了任务信息,状态转换为:" + targetStatus.getDesc()); |
| | | flowEntity.setOperator(AuthUtil.getUserName()); |
| | | flowEntity.setFlowDesc(AuthUtil.getNickName() + " " + DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss") + " 更新了任务信息,状态转换为:" + targetStatus.getDesc()); |
| | | flowEntity.setOperator(AuthUtil.getNickName()); |
| | | flowEntity.setType(WorkOrderTypeEnum.PATROL_TASK.getValue()); |
| | | flowEntity.setAreaCode(existingTask.getAreaCode()); |
| | | flowEntity.setCreateDept(Long.valueOf(AuthUtil.getDeptId())); |
| | |
| | | String flowDesc = buildFlowDesc(newStatus, rejectReason); |
| | | flowEntity.setFlowDesc(flowDesc); |
| | | |
| | | flowEntity.setOperator(AuthUtil.getUserName()); |
| | | flowEntity.setOperator(AuthUtil.getNickName()); |
| | | flowEntity.setType(WorkOrderTypeEnum.PATROL_TASK.getValue()); |
| | | flowEntity.setAreaCode(areaCode); |
| | | flowEntity.setCreateDept(Long.valueOf(AuthUtil.getDeptId())); |
| | |
| | | */ |
| | | private String buildFlowDesc(PatrolTaskStatusEnum newStatus, String rejectReason) { |
| | | String baseDesc = String.format("%s %s ", |
| | | AuthUtil.getUserName(), |
| | | AuthUtil.getNickName(), |
| | | DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss")); |
| | | |
| | | // 拒绝类状态需要添加拒绝原因 |
| | |
| | | return baseDesc + newStatus.getDesc(); |
| | | } |
| | | |
| | | /** |
| | | * 根据部门ID获取部门名称 |
| | | * |
| | | * @param deptId 部门ID |
| | | * @return 部门名称,缺失时返回"/" |
| | | */ |
| | | private String getDeptName(Long deptId) { |
| | | if (deptId == null) { |
| | | return "/"; |
| | |
| | | return dept.getDeptName(); |
| | | } |
| | | |
| | | /** |
| | | * 根据用户ID获取用户姓名 |
| | | * |
| | | * @param userId 用户ID |
| | | * @return 用户姓名,缺失时返回"/" |
| | | */ |
| | | private String getUserName(Long userId) { |
| | | if (userId == null) { |
| | | return "/"; |
| | |
| | | return StringUtil.isBlank(realName) ? "/" : realName; |
| | | } |
| | | |
| | | /** |
| | | * 上传巡查报告并保存附件信息 |
| | | * |
| | | * @param reportFile 报告文件 |
| | | * @param taskEntity 巡查任务 |
| | | * @return 是否保存成功 |
| | | */ |
| | | private boolean saveAttachFile(File reportFile, GdPatrolTaskEntity taskEntity) throws IOException { |
| | | if (reportFile == null || !reportFile.exists()) { |
| | | throw new RuntimeException("巡查报告文件不存在"); |
| | |
| | | return true; |
| | | } |
| | | |
| | | /** |
| | | * 构建附件元数据 |
| | | * |
| | | * @param taskEntity 巡查任务 |
| | | * @param reportFile 报告文件 |
| | | * @param bladeFile 文件上传结果 |
| | | * @param resultType 结果类型 |
| | | * @param desiredName 期望文件名 |
| | | * @return 附件信息 |
| | | */ |
| | | private Attach buildAttachInfo(GdPatrolTaskEntity taskEntity, File reportFile, BladeFile bladeFile, Integer resultType, String desiredName) { |
| | | Attach attach = new Attach(); |
| | | attach.setDomainUrl(bladeFile.getDomain()); |
| | |
| | | return attach; |
| | | } |
| | | |
| | | /** |
| | | * 生成报告附件名称 |
| | | * |
| | | * @param taskEntity 巡查任务 |
| | | * @param fallbackName 兜底文件名 |
| | | * @return 附件名称 |
| | | */ |
| | | private String buildReportAttachName(GdPatrolTaskEntity taskEntity, String fallbackName) { |
| | | String taskNo = taskEntity != null ? taskEntity.getTaskNo() : null; |
| | | if (StringUtil.isBlank(taskNo)) { |
| | |
| | | return taskNo + ".docx"; |
| | | } |
| | | |
| | | /** |
| | | * 解析巡查任务类型为结果类型 |
| | | * |
| | | * @param patrolTaskType 巡查任务类型 |
| | | * @return 结果类型 |
| | | */ |
| | | private Integer parseResultType(String patrolTaskType) { |
| | | if (StringUtil.isBlank(patrolTaskType)) { |
| | | return null; |
| | |
| | | // param.setAirportId(taskEntity.getAirportId()); |
| | | // } |
| | | } |
| | | String status = parseStatus(gdPatrolTaskVO.getTaskStatus()); |
| | | if (StringUtil.isNotBlank(status)) { |
| | | param.setStatus(status); |
| | | } |
| | | param.setTaskType("定时执行"); |
| | | param.setStatus("待执行"); |
| | | param.setTaskType("航线飞行"); |
| | | return param; |
| | | } |
| | | |
| | | private String parseStatus(String taskStatus) { |
| | | if (StringUtil.isBlank(taskStatus)) { |
| | | return null; |
| | | } |
| | | switch (taskStatus) { |
| | | case "0": |
| | | return "待签收"; |
| | | case "1": |
| | | return "拒绝签收"; |
| | | case "2": |
| | | return "已撤回"; |
| | | case "3": |
| | | return "待审核"; |
| | | case "4": |
| | | return "审核驳回"; |
| | | case "5": |
| | | return "审核通过"; |
| | | case "6": |
| | | return "待验收"; |
| | | case "7": |
| | | return "拒绝验收"; |
| | | case "8": |
| | | return "验收通过"; |
| | | default: |
| | | return taskStatus; |
| | | } |
| | | } |
| | | |
| | | } |