|
|
|
|
@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
|
|
@ -36,6 +37,7 @@ import org.springblade.system.user.entity.User;
|
|
|
|
|
import org.springblade.system.user.feign.IUserClient; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
import org.springframework.util.Assert; |
|
|
|
|
import org.springframework.util.ObjectUtils; |
|
|
|
|
|
|
|
|
|
@ -152,32 +154,19 @@ public class ImsDutyRecServiceImpl extends ServiceImpl<ImsDutyRecMapper, ImsDuty
|
|
|
|
|
return R.status(true); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 开启交接班 |
|
|
|
|
* |
|
|
|
|
* @param recDTO 交接班信息 - 巡检路线ID、NAME、DATA |
|
|
|
|
* @return 交接班成功标识 |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
// @Transactional(rollbackFor = Exception.class)
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
|
public Boolean changeShift(ImsDutyRecDTO recDTO) { |
|
|
|
|
// 获取班组组长
|
|
|
|
|
Long managerId = this.getHandleGroupManagerByDuty(recDTO.getDutyId()); |
|
|
|
|
Assert.isTrue(Func.isNotEmpty(managerId), () -> { |
|
|
|
|
throw new ServiceException("获取值班班组长失败!"); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
String tenantId = AuthUtil.getTenantId(); |
|
|
|
|
// 新建巡检计划并获取巡检任务Id
|
|
|
|
|
/* PlanVO planVO = new PlanVO(); |
|
|
|
|
planVO.setRouteId(recDTO.getRouteId()); |
|
|
|
|
planVO.setRouteData(recDTO.getRouteData()); |
|
|
|
|
planVO.setRouteName(recDTO.getRouteName()); |
|
|
|
|
planVO.setPlanUsers(Lists.newArrayList(managerId)); |
|
|
|
|
Long inspectTaskId = this.createInspectPlan(planVO); |
|
|
|
|
recDTO.setInspectTaskId(inspectTaskId);*/ |
|
|
|
|
// 交接班时间
|
|
|
|
|
recDTO.setExecTime(new Date()); |
|
|
|
|
recDTO.setStatus(DutyRecStatus.EXEC.getVal()); |
|
|
|
|
recDTO.setStatus(DutyRecStatus.ACCEPT.getVal()); |
|
|
|
|
recDTO.setAcceptTime(new Date()); |
|
|
|
|
recDTO.setQrCodeContent(System.currentTimeMillis() + ""); |
|
|
|
|
// 判断交接班是否延时
|
|
|
|
|
ImsDutyMainEntity dutyMainEntity = imsDutyMainService.getById(recDTO.getDutyId()); |
|
|
|
|
Long duration = this.changeShiftDuration(dutyMainEntity, OperationalConstants.DutyRecTypeEnum.HAND_REC.getVal()); |
|
|
|
|
@ -185,10 +174,15 @@ public class ImsDutyRecServiceImpl extends ServiceImpl<ImsDutyRecMapper, ImsDuty
|
|
|
|
|
recDTO.setDelayStatus(DutyContants.DutyRecDelayStatusEnum.HAND_DELAY_STATUS.getStatus()); |
|
|
|
|
} |
|
|
|
|
ImsDutyRecEntity recEntity = BeanUtil.copy(recDTO, ImsDutyRecEntity.class); |
|
|
|
|
recEntity.setTenantId(tenantId); |
|
|
|
|
recEntity.setTenantId(AuthUtil.getTenantId()); |
|
|
|
|
recEntity.setCreateDept(Long.valueOf(AuthUtil.getUser().getDeptId())); |
|
|
|
|
if (Func.isEmpty(recEntity.getId())) { |
|
|
|
|
save(recEntity); |
|
|
|
|
} |
|
|
|
|
// 更新值班状态
|
|
|
|
|
imsDutyMainService.update(new LambdaUpdateWrapper<ImsDutyMainEntity>().set(ImsDutyMainEntity::getStatus, 2).eq(ImsDutyMainEntity::getId, recDTO.getDutyId())); |
|
|
|
|
imsDutyMainService.update(new LambdaUpdateWrapper<ImsDutyMainEntity>().set(ImsDutyMainEntity::getStatus, 1).eq(ImsDutyMainEntity::getPreDutyId, recDTO.getDutyId())); |
|
|
|
|
// 值班日志
|
|
|
|
|
ImsDutyLogEntity imsDutyLogEntity = imsDutyLogService.getOne(new LambdaQueryWrapper<ImsDutyLogEntity>() {{ |
|
|
|
|
eq(ImsDutyLogEntity::getDutyId, dutyMainEntity.getId()).last(" limit 1"); |
|
|
|
|
}}); |
|
|
|
|
@ -322,11 +316,12 @@ public class ImsDutyRecServiceImpl extends ServiceImpl<ImsDutyRecMapper, ImsDuty
|
|
|
|
|
} |
|
|
|
|
imsDutyRecVO.setHeadDutyMainVo(imsSchedulingVo); |
|
|
|
|
// 机构名称
|
|
|
|
|
if (imsDutyRecVO.getCreateDept() != null) { |
|
|
|
|
R<String> result = sysClient.getDeptName(imsDutyRecVO.getCreateDept()); |
|
|
|
|
if (result.isSuccess() && ObjectUtil.isNotEmpty(result.getData())) { |
|
|
|
|
imsDutyRecVO.setStationName(result.getData()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
Long dutyId = imsDutyRecVO.getDutyId(); |
|
|
|
|
ImsDutyLogEntity dutyLogEntity = imsDutyLogService.getOne(new LambdaQueryWrapper<ImsDutyLogEntity>() {{ |
|
|
|
|
eq(ImsDutyLogEntity::getDutyId, dutyId); |
|
|
|
|
@ -519,6 +514,7 @@ public class ImsDutyRecServiceImpl extends ServiceImpl<ImsDutyRecMapper, ImsDuty
|
|
|
|
|
imsDutyRecEntity.setDutyId(imsDutyMainEntity.getId()); |
|
|
|
|
imsDutyRecEntity.setDelayStatus(DutyContants.DutyRecDelayStatusEnum.HAND_DELAY_STATUS.getStatus()); |
|
|
|
|
imsDutyRecEntity.setStatus(DutyRecStatus.ANOMALY.getVal()); |
|
|
|
|
imsDutyRecEntity.setCreateDept(mainEntityById.getCreateDept()); |
|
|
|
|
this.save(imsDutyRecEntity); |
|
|
|
|
} |
|
|
|
|
mainEntity1.setId(imsDutyMainEntity.getId()); |
|
|
|
|
|