Browse Source

交接班流程修改

master
fengliu 2 weeks ago
parent
commit
ae90f7c66a
  1. 4
      HZInfo-RIS-PXHD/hzinfo-ris-pxhd-service/hzinfo-inspect-service/src/main/java/org/springblade/hzinfo_inspect/duty/controller/ImsDutyRecController.java
  2. 5
      HZInfo-RIS-PXHD/hzinfo-ris-pxhd-service/hzinfo-inspect-service/src/main/java/org/springblade/hzinfo_inspect/duty/service/impl/ImsDutyEmergencyServiceImpl.java
  3. 36
      HZInfo-RIS-PXHD/hzinfo-ris-pxhd-service/hzinfo-inspect-service/src/main/java/org/springblade/hzinfo_inspect/duty/service/impl/ImsDutyRecServiceImpl.java

4
HZInfo-RIS-PXHD/hzinfo-ris-pxhd-service/hzinfo-inspect-service/src/main/java/org/springblade/hzinfo_inspect/duty/controller/ImsDutyRecController.java

@ -18,7 +18,6 @@ import org.springblade.hzinfo_inspect.duty.entity.ImsDutyMainEntity;
import org.springblade.hzinfo_inspect.duty.entity.ImsDutyRecEntity;
import org.springblade.hzinfo_inspect.duty.service.IImsDutyEmergencyService;
import org.springblade.hzinfo_inspect.duty.service.IImsDutyRecService;
import org.springblade.hzinfo_inspect.duty.vo.ImsDutyEmergencyVo;
import org.springblade.hzinfo_inspect.duty.vo.ImsDutyRecVO;
import org.springframework.web.bind.annotation.*;
@ -210,8 +209,7 @@ public class ImsDutyRecController {
@PostMapping("/changeShift")
@ApiOperationSupport(order = 21)
@ApiOperation(value = "交班", notes = "传入imsDutyRecDTO交接班信息")
@ApiOperation(value = "交接班")
public R changeShift(@Valid @RequestBody ImsDutyRecDTO imsDutyRecDTO) {
return R.status(imsDutyRecService.changeShift(imsDutyRecDTO));
}

5
HZInfo-RIS-PXHD/hzinfo-ris-pxhd-service/hzinfo-inspect-service/src/main/java/org/springblade/hzinfo_inspect/duty/service/impl/ImsDutyEmergencyServiceImpl.java

@ -55,8 +55,9 @@ public class ImsDutyEmergencyServiceImpl extends ServiceImpl<ImsDutyEmergencyMap
}
imsDutyEmergencyEntity.setDutyClass(entity.getClassId());
imsDutyEmergencyEntity.setDutyTime(entity.getDutyDate());
this.saveOrUpdate(imsDutyEmergencyEntity);
return R.success("保存成功");
imsDutyEmergencyEntity.setCreateDept(Long.valueOf(AuthUtil.getUser().getDeptId()));
imsDutyEmergencyEntity.setStatus(1);
return R.status(this.saveOrUpdate(imsDutyEmergencyEntity));
}
@Override

36
HZInfo-RIS-PXHD/hzinfo-ris-pxhd-service/hzinfo-inspect-service/src/main/java/org/springblade/hzinfo_inspect/duty/service/impl/ImsDutyRecServiceImpl.java

@ -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 交接班信息 - 巡检路线IDNAMEDATA
* @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());

Loading…
Cancel
Save