| | |
| | | public IPage<GdPatrolTaskVO> selectGdPatrolTaskPage(IPage<GdPatrolTaskVO> page, GdPatrolTaskPageParam gdPatrolTask) { |
| | | List<Long> deptList = new ArrayList<>(); |
| | | if (!AuthUtil.isAdministrator() || !AuthUtil.isAdmin()) { |
| | | deptList = SysCache.getDeptChildIds(Long.valueOf(AuthUtil.getDeptId())); |
| | | deptList = SysCache.getDeptChildIds(Long.valueOf(StringUtil.isBlank(AuthUtil.getDeptId()) ? "0" : AuthUtil.getDeptId())); |
| | | } |
| | | gdPatrolTask.setDeptList(deptList); |
| | | List<GdPatrolTaskVO> gdPatrolTaskVOS = baseMapper.selectGdPatrolTaskPage(page, gdPatrolTask); |
| | |
| | | |
| | | // 保存流转记录(发布任务,等待接单) |
| | | GdWorkOrderFlowEntity gdWorkOrderFlowEntity = new GdWorkOrderFlowEntity(); |
| | | gdWorkOrderFlowEntity.setCreateUser(AuthUtil.getUserId()); |
| | | gdWorkOrderFlowEntity.setCreateUser(AuthUtil.getUserId() == null ? 0L : AuthUtil.getUserId()); |
| | | gdWorkOrderFlowEntity.setWorkOrderId(gdPatrolTaskEntity.getId()); |
| | | gdWorkOrderFlowEntity.setFlowName(PatrolTaskStatusEnum.PENDING_SIGNING.getStageDesc()); |
| | | gdWorkOrderFlowEntity.setFlowDesc(PatrolTaskStatusEnum.PENDING_SIGNING.getStageDesc()); |
| | | gdWorkOrderFlowEntity.setOperator(AuthUtil.getNickName()); |
| | | gdWorkOrderFlowEntity.setOperator(StringUtil.isBlank(AuthUtil.getNickName()) ? "系统" : AuthUtil.getNickName()); |
| | | gdWorkOrderFlowEntity.setType(WorkOrderTypeEnum.PATROL_TASK.getValue()); |
| | | gdWorkOrderFlowEntity.setAreaCode(gdPatrolTaskEntity.getAreaCode()); |
| | | gdWorkOrderFlowEntity.setCreateDept(Long.valueOf(AuthUtil.getDeptId())); |
| | | gdWorkOrderFlowEntity.setCreateDept(Long.valueOf(StringUtil.isBlank(AuthUtil.getDeptId()) ? "0" : AuthUtil.getDeptId())); |
| | | boolean save1 = gdWorkOrderFlowService.save(gdWorkOrderFlowEntity); |
| | | if (!save1) { |
| | | // 流转记录保存失败,抛出异常触发回滚 |
| | |
| | | // 4. 更新任务状态 |
| | | Date now = new Date(); |
| | | task.setTaskStatus(newStatusEnum.getValue()); |
| | | task.setUpdateUser(AuthUtil.getUserId()); |
| | | task.setUpdateUser(AuthUtil.getUserId() == null ? 0L : AuthUtil.getUserId()); |
| | | task.setUpdateTime(now); |
| | | task.setRejectReason(auditParam.getRejectReason()); |
| | | boolean updateResult = updateById(task); |
| | |
| | | |
| | | // 2. 保存流转记录 |
| | | GdWorkOrderFlowEntity flowEntity = new GdWorkOrderFlowEntity(); |
| | | flowEntity.setCreateUser(AuthUtil.getUserId()); |
| | | flowEntity.setCreateUser(AuthUtil.getUserId() == null ? 0L : AuthUtil.getUserId()); |
| | | flowEntity.setWorkOrderId(workOrderId); |
| | | flowEntity.setFlowName(newStatus.getStageDesc()); |
| | | flowEntity.setFlowDesc(newStatus.getDesc()); |
| | | flowEntity.setOperator(AuthUtil.getNickName()); |
| | | flowEntity.setOperator(StringUtil.isBlank(AuthUtil.getNickName()) ? "系统" : AuthUtil.getNickName()); |
| | | flowEntity.setType(WorkOrderTypeEnum.WORK_ORDER_TASK.getValue()); |
| | | flowEntity.setFlowStatus(newStatus.getMaxCode()); |
| | | flowEntity.setWorkStatus(newStatus.getCode()); |
| | | flowEntity.setCreateDept(Long.valueOf(AuthUtil.getDeptId())); |
| | | flowEntity.setCreateDept(Long.valueOf(StringUtil.isBlank(AuthUtil.getDeptId()) ? "0" : AuthUtil.getDeptId())); |
| | | return gdWorkOrderFlowService.save(flowEntity); |
| | | } |
| | | |
| | |
| | | taskEntity.setTaskStatus(targetStatus.getValue()); |
| | | |
| | | // 4. 更新任务信息:合并传入的任务信息 |
| | | taskEntity.setUpdateUser(AuthUtil.getUserId()); |
| | | taskEntity.setUpdateUser(AuthUtil.getUserId() == null ? 0L : AuthUtil.getUserId()); |
| | | taskEntity.setUpdateTime(new Date()); |
| | | |
| | | // 5. 更新数据库 |
| | |
| | | |
| | | // 6. 保存流转记录:使用枚举设置flowName |
| | | GdWorkOrderFlowEntity flowEntity = new GdWorkOrderFlowEntity(); |
| | | flowEntity.setCreateUser(AuthUtil.getUserId()); |
| | | flowEntity.setCreateUser(AuthUtil.getUserId() == null ? 0L : AuthUtil.getUserId()); |
| | | flowEntity.setWorkOrderId(taskEntity.getId()); |
| | | flowEntity.setFlowName(targetStatus.getDesc()); |
| | | flowEntity.setFlowDesc(AuthUtil.getNickName() + " " + DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss") + " 更新了任务信息,状态转换为:" + targetStatus.getDesc()); |
| | | flowEntity.setOperator(AuthUtil.getNickName()); |
| | | flowEntity.setFlowDesc((StringUtil.isBlank(AuthUtil.getNickName()) ? "系统" : AuthUtil.getNickName()) + " " + DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss") + " 更新了任务信息,状态转换为:" + targetStatus.getDesc()); |
| | | flowEntity.setOperator(StringUtil.isBlank(AuthUtil.getNickName()) ? "系统" : AuthUtil.getNickName()); |
| | | flowEntity.setType(WorkOrderTypeEnum.PATROL_TASK.getValue()); |
| | | flowEntity.setAreaCode(existingTask.getAreaCode()); |
| | | flowEntity.setCreateDept(Long.valueOf(AuthUtil.getDeptId())); |
| | | flowEntity.setCreateDept(Long.valueOf(StringUtil.isBlank(AuthUtil.getDeptId()) ? "0" : AuthUtil.getDeptId())); |
| | | |
| | | return gdWorkOrderFlowService.save(flowEntity); |
| | | } |
| | |
| | | flowEntity.setWorkOrderId(workOrderId); |
| | | flowEntity.setFlowName(newStatus.getStageDesc()); |
| | | flowEntity.setFlowDesc(newStatus.getStageDesc()); |
| | | flowEntity.setOperator(AuthUtil.getNickName()); |
| | | flowEntity.setOperator(StringUtil.isBlank(AuthUtil.getNickName()) ? "系统" : AuthUtil.getNickName()); |
| | | flowEntity.setType(WorkOrderTypeEnum.PATROL_TASK.getValue()); |
| | | flowEntity.setAreaCode(areaCode); |
| | | flowEntity.setCreateDept(Long.valueOf(StringUtil.isBlank(AuthUtil.getDeptId()) ? "0" : AuthUtil.getDeptId())); |
| | |
| | | Long updateUser = taskEntity != null ? taskEntity.getUpdateUser() : null; |
| | | Long createDept = taskEntity != null ? taskEntity.getCreateDept() : null; |
| | | if (createUser == null) { |
| | | createUser = AuthUtil.getUserId(); |
| | | createUser = AuthUtil.getUserId() == null ? 0L : AuthUtil.getUserId(); |
| | | } |
| | | if (updateUser == null) { |
| | | updateUser = createUser; |
| | | } |
| | | if (createDept == null) { |
| | | createDept = Long.valueOf(AuthUtil.getDeptId()); |
| | | createDept = Long.valueOf(StringUtil.isBlank(AuthUtil.getDeptId()) ? "0" : AuthUtil.getDeptId()); |
| | | } |
| | | Date now = new Date(); |
| | | attach.setCreateUser(createUser); |