|
|
@ -34,6 +34,10 @@ import com.hnac.hzims.operational.duty.vo.ImsRecVo; |
|
|
|
import com.hnac.hzims.operational.duty.vo.ImsSchedulingVo; |
|
|
|
import com.hnac.hzims.operational.duty.vo.ImsSchedulingVo; |
|
|
|
import com.hnac.hzims.operational.duty.wrapper.ImsDutyRecWrapper; |
|
|
|
import com.hnac.hzims.operational.duty.wrapper.ImsDutyRecWrapper; |
|
|
|
import com.hnac.hzims.operational.station.service.IStationService; |
|
|
|
import com.hnac.hzims.operational.station.service.IStationService; |
|
|
|
|
|
|
|
import com.hnac.hzims.ticket.allTicket.dto.TicketStatisticDTO; |
|
|
|
|
|
|
|
import com.hnac.hzims.ticket.standardTicket.entity.StandardTicketInfoEntity; |
|
|
|
|
|
|
|
import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity; |
|
|
|
|
|
|
|
import com.hnac.hzims.ticket.workTicket.feign.ITicketInfoClient; |
|
|
|
import com.hnac.hzinfo.inspect.plan.PlanContants; |
|
|
|
import com.hnac.hzinfo.inspect.plan.PlanContants; |
|
|
|
import com.hnac.hzinfo.inspect.plan.feign.IInspectPlanClient; |
|
|
|
import com.hnac.hzinfo.inspect.plan.feign.IInspectPlanClient; |
|
|
|
import com.hnac.hzinfo.inspect.plan.vo.PlanVO; |
|
|
|
import com.hnac.hzinfo.inspect.plan.vo.PlanVO; |
|
|
@ -49,6 +53,7 @@ import org.springblade.flow.core.entity.BladeFlow; |
|
|
|
import org.springblade.flow.core.feign.IFlowClient; |
|
|
|
import org.springblade.flow.core.feign.IFlowClient; |
|
|
|
import org.springblade.flow.core.utils.TaskUtil; |
|
|
|
import org.springblade.flow.core.utils.TaskUtil; |
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
|
|
|
|
import org.springblade.system.user.cache.UserCache; |
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
import org.springblade.system.user.feign.IUserClient; |
|
|
|
import org.springblade.system.user.feign.IUserClient; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
@ -57,6 +62,7 @@ import org.springframework.transaction.annotation.Transactional; |
|
|
|
import org.springframework.util.Assert; |
|
|
|
import org.springframework.util.Assert; |
|
|
|
import org.springframework.util.ObjectUtils; |
|
|
|
import org.springframework.util.ObjectUtils; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.sql.Time; |
|
|
|
import java.sql.Time; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
import java.text.SimpleDateFormat; |
|
|
@ -65,6 +71,8 @@ import java.time.format.DateTimeFormatter; |
|
|
|
import java.util.*; |
|
|
|
import java.util.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import static org.springblade.core.tool.utils.DateUtil.PATTERN_DATETIME; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 服务实现类 |
|
|
|
* 服务实现类 |
|
|
@ -74,12 +82,15 @@ import java.util.stream.Collectors; |
|
|
|
@Slf4j |
|
|
|
@Slf4j |
|
|
|
@Service |
|
|
|
@Service |
|
|
|
public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, ImsDutyRecEntity> implements IImsDutyRecService { |
|
|
|
public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, ImsDutyRecEntity> implements IImsDutyRecService { |
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
private ITicketInfoClient ticketInfoClient; |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private ImsDutyMainMapper imsDutyMainMapper; |
|
|
|
private ImsDutyMainMapper imsDutyMainMapper; |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private IImsDutyMainService imsDutyMainService; |
|
|
|
private IImsDutyMainService imsDutyMainService; |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
|
|
|
|
private IImsDutyLogService imsDutyLogService; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private IImsDutyClassService imsDutyClassService; |
|
|
|
private IImsDutyClassService imsDutyClassService; |
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
private IImsDutyGroupService imsDutyGroupService; |
|
|
|
private IImsDutyGroupService imsDutyGroupService; |
|
|
@ -228,7 +239,11 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims |
|
|
|
if (Func.isEmpty(recEntity.getId())) { |
|
|
|
if (Func.isEmpty(recEntity.getId())) { |
|
|
|
save(recEntity); |
|
|
|
save(recEntity); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
ImsDutyLogEntity imsDutyLogEntity = recDTO.getImsDutyLogEntity(); |
|
|
|
|
|
|
|
imsDutyLogEntity.setHandTime(DateUtil.format(new Date(),PATTERN_DATETIME)); |
|
|
|
|
|
|
|
imsDutyLogService.save(imsDutyLogEntity); |
|
|
|
// 开启值班交接班流程
|
|
|
|
// 开启值班交接班流程
|
|
|
|
|
|
|
|
recEntity.setQrCodeContent(System.currentTimeMillis() + ""); |
|
|
|
BladeFlow bladeFlow = this.startDutyRecProcess(recEntity, managerId); |
|
|
|
BladeFlow bladeFlow = this.startDutyRecProcess(recEntity, managerId); |
|
|
|
recEntity.setProcessInstanceId(bladeFlow.getProcessInstanceId()); |
|
|
|
recEntity.setProcessInstanceId(bladeFlow.getProcessInstanceId()); |
|
|
|
return updateById(recEntity); |
|
|
|
return updateById(recEntity); |
|
|
@ -327,7 +342,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims |
|
|
|
userName = userR.getData().getName(); |
|
|
|
userName = userR.getData().getName(); |
|
|
|
log.info("--------------------------req2:" + req, groupEntityManagerId, userName, date); |
|
|
|
log.info("--------------------------req2:" + req, groupEntityManagerId, userName, date); |
|
|
|
} |
|
|
|
} |
|
|
|
String format = DateUtil.format(date, DateUtil.PATTERN_DATETIME); |
|
|
|
String format = DateUtil.format(date, PATTERN_DATETIME); |
|
|
|
/*remondingCarry(req, OperationalConstants.RecTypeEnum.HAND_REMIND.getVal(), |
|
|
|
/*remondingCarry(req, OperationalConstants.RecTypeEnum.HAND_REMIND.getVal(), |
|
|
|
groupEntity.getManagerId(), userName, null, |
|
|
|
groupEntity.getManagerId(), userName, null, |
|
|
|
format, groupEntity.getTenantId(), groupEntity.getCreateDept(), groupEntity.getCreateUser());*/ |
|
|
|
format, groupEntity.getTenantId(), groupEntity.getCreateDept(), groupEntity.getCreateUser());*/ |
|
|
@ -381,7 +396,6 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims |
|
|
|
updateMain(recEntity.getDutyId()); |
|
|
|
updateMain(recEntity.getDutyId()); |
|
|
|
recEntity.setStatus(DutyRecStatus.ACCEPT.getVal()); |
|
|
|
recEntity.setStatus(DutyRecStatus.ACCEPT.getVal()); |
|
|
|
recEntity.setAcceptTime(new Date()); |
|
|
|
recEntity.setAcceptTime(new Date()); |
|
|
|
recEntity.setQrCodeContent(System.currentTimeMillis() + ""); |
|
|
|
|
|
|
|
this.updateById(recEntity); |
|
|
|
this.updateById(recEntity); |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -457,6 +471,11 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims |
|
|
|
if (result.isSuccess() && ObjectUtil.isNotEmpty(result.getData())) { |
|
|
|
if (result.isSuccess() && ObjectUtil.isNotEmpty(result.getData())) { |
|
|
|
imsDutyRecVO.setStationName(result.getData()); |
|
|
|
imsDutyRecVO.setStationName(result.getData()); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
Long dutyId = imsDutyRecVO.getDutyId(); |
|
|
|
|
|
|
|
ImsDutyLogEntity dutyLogEntity = imsDutyLogService.getOne(new LambdaQueryWrapper<ImsDutyLogEntity>() {{ |
|
|
|
|
|
|
|
eq(ImsDutyLogEntity::getDutyId, dutyId); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
imsDutyRecVO.setImsDutyLogEntity(dutyLogEntity); |
|
|
|
} |
|
|
|
} |
|
|
|
imsDutyRecVOIPage.setRecords(records); |
|
|
|
imsDutyRecVOIPage.setRecords(records); |
|
|
|
return imsDutyRecVOIPage; |
|
|
|
return imsDutyRecVOIPage; |
|
|
@ -505,7 +524,13 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims |
|
|
|
if (ObjectUtil.isNotEmpty(recEntity)) { |
|
|
|
if (ObjectUtil.isNotEmpty(recEntity)) { |
|
|
|
return R.success("您已提交交班申请"); |
|
|
|
return R.success("您已提交交班申请"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
ImsDutyLogEntity imsDutyLogEntity=new ImsDutyLogEntity(); |
|
|
|
|
|
|
|
imsDutyLogEntity.setDutyId(entity.getId()); |
|
|
|
|
|
|
|
R<ImsDutyLogEntity> dutyLog = this.getDutyLog(imsDutyLogEntity); |
|
|
|
|
|
|
|
if(dutyLog.isSuccess()&&ObjectUtil.isNotEmpty(dutyLog.getData())){ |
|
|
|
|
|
|
|
ImsDutyLogEntity data = dutyLog.getData(); |
|
|
|
|
|
|
|
vo.setImsDutyLogEntity(data); |
|
|
|
|
|
|
|
} |
|
|
|
ImsDutyRecEntity dutyRecEntity = this.baseMapper.selectOne(new LambdaQueryWrapper<ImsDutyRecEntity>() {{ |
|
|
|
ImsDutyRecEntity dutyRecEntity = this.baseMapper.selectOne(new LambdaQueryWrapper<ImsDutyRecEntity>() {{ |
|
|
|
eq(ImsDutyRecEntity::getDutyId, entity.getPreDutyId()); |
|
|
|
eq(ImsDutyRecEntity::getDutyId, entity.getPreDutyId()); |
|
|
|
}}); |
|
|
|
}}); |
|
|
@ -824,12 +849,17 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims |
|
|
|
entity.setId(id); |
|
|
|
entity.setId(id); |
|
|
|
entity.setDutyDate(DateUtil.parse(date, DateUtil.PATTERN_DATE)); |
|
|
|
entity.setDutyDate(DateUtil.parse(date, DateUtil.PATTERN_DATE)); |
|
|
|
String format1 = DateUtil.format(new Date(), DateUtil.PATTERN_DATE); |
|
|
|
String format1 = DateUtil.format(new Date(), DateUtil.PATTERN_DATE); |
|
|
|
Date dutyDate = entity.getDutyDate(); |
|
|
|
|
|
|
|
Date parse = DateUtil.parse(format1, DateUtil.PATTERN_DATE); |
|
|
|
Date parse = DateUtil.parse(format1, DateUtil.PATTERN_DATE); |
|
|
|
|
|
|
|
ImsDutyMainEntity mainEntityById = imsDutyMainService.getById(id); |
|
|
|
|
|
|
|
ImsDutyClassEntity classEntity = imsDutyClassService.getOne(new LambdaQueryWrapper<ImsDutyClassEntity>() {{ |
|
|
|
|
|
|
|
eq(ImsDutyClassEntity::getId, mainEntityById.getClassId()); |
|
|
|
|
|
|
|
last("limit 1"); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
String dutyTime = DateUtil.format(mainEntityById.getDutyDate(), DateUtil.PATTERN_DATE) + " " +DateUtil.format(classEntity.getStartTime(), DateUtil.PATTERN_TIME); |
|
|
|
|
|
|
|
Date dutyDate = DateUtil.parse(dutyTime, PATTERN_DATETIME); |
|
|
|
if (dutyDate.getTime() > parse.getTime()) { |
|
|
|
if (dutyDate.getTime() > parse.getTime()) { |
|
|
|
return R.fail("值班时间不能大于当前时间"); |
|
|
|
return R.fail("指定的值班开始时间不能晚于当前时间"); |
|
|
|
} |
|
|
|
} |
|
|
|
ImsDutyMainEntity mainEntityById = imsDutyMainService.getById(id); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取当前值班
|
|
|
|
//获取当前值班
|
|
|
|
ImsDutyMainEntity mainEntity = imsDutyMainService.getOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{ |
|
|
|
ImsDutyMainEntity mainEntity = imsDutyMainService.getOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{ |
|
|
@ -998,7 +1028,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims |
|
|
|
|
|
|
|
|
|
|
|
format = DateUtil.format(dutyMainEntity.getDutyDate(), DateUtil.PATTERN_DATE) + " " + time; |
|
|
|
format = DateUtil.format(dutyMainEntity.getDutyDate(), DateUtil.PATTERN_DATE) + " " + time; |
|
|
|
strDate = format; |
|
|
|
strDate = format; |
|
|
|
Date parse = DateUtil.parse(format, DateUtil.PATTERN_DATETIME); |
|
|
|
Date parse = DateUtil.parse(format, PATTERN_DATETIME); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImsDutyMainEntity imsDutyMainServiceOne1 = imsDutyMainService.getOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{ |
|
|
|
ImsDutyMainEntity imsDutyMainServiceOne1 = imsDutyMainService.getOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{ |
|
|
@ -1019,7 +1049,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims |
|
|
|
preTime = dutyClassEntity.getStartTime() + ""; |
|
|
|
preTime = dutyClassEntity.getStartTime() + ""; |
|
|
|
} |
|
|
|
} |
|
|
|
preDate = DateUtil.format(imsDutyMainServiceOne1.getDutyDate(), DateUtil.PATTERN_DATE) + " " + preTime; |
|
|
|
preDate = DateUtil.format(imsDutyMainServiceOne1.getDutyDate(), DateUtil.PATTERN_DATE) + " " + preTime; |
|
|
|
Date preParse = DateUtil.parse(preDate, DateUtil.PATTERN_DATETIME); |
|
|
|
Date preParse = DateUtil.parse(preDate, PATTERN_DATETIME); |
|
|
|
if (preParse.getTime() > parse.getTime()) { |
|
|
|
if (preParse.getTime() > parse.getTime()) { |
|
|
|
bool = true; |
|
|
|
bool = true; |
|
|
|
strDate = calculateDutyDate(parse); |
|
|
|
strDate = calculateDutyDate(parse); |
|
|
@ -1051,7 +1081,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (preBool) { |
|
|
|
if (preBool) { |
|
|
|
Date preParse = DateUtil.parse(preDate, DateUtil.PATTERN_DATETIME); |
|
|
|
Date preParse = DateUtil.parse(preDate, PATTERN_DATETIME); |
|
|
|
if (preParse.getTime() > parse.getTime()) { |
|
|
|
if (preParse.getTime() > parse.getTime()) { |
|
|
|
strDate = calculateDutyDate(parse); |
|
|
|
strDate = calculateDutyDate(parse); |
|
|
|
} |
|
|
|
} |
|
|
@ -1085,7 +1115,7 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims |
|
|
|
c.setTime(date); |
|
|
|
c.setTime(date); |
|
|
|
c.add(Calendar.DAY_OF_MONTH, 1); |
|
|
|
c.add(Calendar.DAY_OF_MONTH, 1); |
|
|
|
date = c.getTime(); |
|
|
|
date = c.getTime(); |
|
|
|
return DateUtil.format(date, DateUtil.PATTERN_DATETIME); |
|
|
|
return DateUtil.format(date, PATTERN_DATETIME); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
@ -1309,9 +1339,9 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims |
|
|
|
entity.setId(imsDutyRecTestVo.getId()); |
|
|
|
entity.setId(imsDutyRecTestVo.getId()); |
|
|
|
entity.setCreateUser(imsDutyRecTestVo.getManagerId()); |
|
|
|
entity.setCreateUser(imsDutyRecTestVo.getManagerId()); |
|
|
|
String startTime = imsDutyRecTestVo.getDutyDate() + " " + imsDutyRecTestVo.getEndTime(); |
|
|
|
String startTime = imsDutyRecTestVo.getDutyDate() + " " + imsDutyRecTestVo.getEndTime(); |
|
|
|
entity.setExecTime(DateUtil.parse(startTime, DateUtil.PATTERN_DATETIME)); |
|
|
|
entity.setExecTime(DateUtil.parse(startTime, PATTERN_DATETIME)); |
|
|
|
String endTime = minutlDateTest(DateUtil.parse(startTime, DateUtil.PATTERN_DATETIME), 10); |
|
|
|
String endTime = minutlDateTest(DateUtil.parse(startTime, PATTERN_DATETIME), 10); |
|
|
|
entity.setAcceptTime(DateUtil.parse(endTime, DateUtil.PATTERN_DATETIME)); |
|
|
|
entity.setAcceptTime(DateUtil.parse(endTime, PATTERN_DATETIME)); |
|
|
|
this.baseMapper.updateById(entity); |
|
|
|
this.baseMapper.updateById(entity); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -1385,7 +1415,12 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims |
|
|
|
// 交接班接班信息填充
|
|
|
|
// 交接班接班信息填充
|
|
|
|
recDTO.setStatus(DutyRecStatus.ACCEPT.getVal()); |
|
|
|
recDTO.setStatus(DutyRecStatus.ACCEPT.getVal()); |
|
|
|
recDTO.setAcceptTime(new Date()); |
|
|
|
recDTO.setAcceptTime(new Date()); |
|
|
|
recDTO.setQrCodeContent(System.currentTimeMillis() + ""); |
|
|
|
ImsDutyLogEntity imsDutyLogEntity = recDTO.getImsDutyLogEntity(); |
|
|
|
|
|
|
|
imsDutyLogService.update(Wrappers.<ImsDutyLogEntity>lambdaUpdate() |
|
|
|
|
|
|
|
.set(ImsDutyLogEntity::getCarryTime, DateUtil.format(new Date(), PATTERN_DATETIME)) |
|
|
|
|
|
|
|
.eq(ImsDutyLogEntity::getDutyId,imsDutyLogEntity.getDutyId()) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
log.info("更新值班日志"); |
|
|
|
} |
|
|
|
} |
|
|
|
ImsDutyRecEntity dutyRec = BeanUtil.copy(recDTO, ImsDutyRecEntity.class); |
|
|
|
ImsDutyRecEntity dutyRec = BeanUtil.copy(recDTO, ImsDutyRecEntity.class); |
|
|
|
// 更新交班值班
|
|
|
|
// 更新交班值班
|
|
|
@ -1464,4 +1499,138 @@ public class ImsDutyRecServiceImpl extends BaseServiceImpl<ImsDutyRecMapper, Ims |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public R<ImsDutyLogEntity> getDutyLog(ImsDutyLogEntity imsDutyLogEntity) { |
|
|
|
|
|
|
|
String deptId = AuthUtil.getUser().getDeptId(); |
|
|
|
|
|
|
|
if (com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isNotEmpty(imsDutyLogEntity)&& com.baomidou.mybatisplus.core.toolkit.ObjectUtils.isNotEmpty(imsDutyLogEntity.getDutyId())) { |
|
|
|
|
|
|
|
ImsDutyLogEntity res = imsDutyLogService.getOne(new LambdaQueryWrapper<ImsDutyLogEntity>() {{ |
|
|
|
|
|
|
|
eq(ImsDutyLogEntity::getDutyId, imsDutyLogEntity.getDutyId()) |
|
|
|
|
|
|
|
.last(" limit 1");}}); |
|
|
|
|
|
|
|
if (Func.isNotEmpty(res)){ |
|
|
|
|
|
|
|
return R.data(res); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
ImsDutyMainEntity mainEntity = imsDutyMainMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{ |
|
|
|
|
|
|
|
eq(ImsDutyMainEntity::getId, imsDutyLogEntity.getDutyId()) |
|
|
|
|
|
|
|
.last(" limit 1"); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
if (cn.hutool.core.util.ObjectUtil.isEmpty(mainEntity)) { |
|
|
|
|
|
|
|
return R.success("您当前未值班"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
Long mainId = mainEntity.getId(); |
|
|
|
|
|
|
|
ImsDutyMainEntity carryEntity = imsDutyMainMapper.selectOne(new LambdaQueryWrapper<ImsDutyMainEntity>() {{ |
|
|
|
|
|
|
|
eq(ImsDutyMainEntity::getPreDutyId, mainId) |
|
|
|
|
|
|
|
.last(" limit 1"); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
if (cn.hutool.core.util.ObjectUtil.isEmpty(carryEntity)) { |
|
|
|
|
|
|
|
return R.success("没有接班计划,请到排班计划进行排班"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ImsDutyLogEntity dutyLogEntity=new ImsDutyLogEntity(); |
|
|
|
|
|
|
|
dutyLogEntity.setDutyId(mainId); |
|
|
|
|
|
|
|
//值班-交接班基本信息
|
|
|
|
|
|
|
|
dutyLogEntity.setTime(DateUtil.format(new Date(), "yyyy-MM-dd")); |
|
|
|
|
|
|
|
ImsDutyClassEntity classEntity = imsDutyClassService.getById(mainEntity.getClassId()); |
|
|
|
|
|
|
|
dutyLogEntity.setClassType(classEntity.getClassName()); |
|
|
|
|
|
|
|
String startTime = DateUtil.format(mainEntity.getDutyDate(), "yyyy-MM-dd") + " " +DateUtil.format(classEntity.getStartTime(), "HH:mm:ss"); |
|
|
|
|
|
|
|
String endTime = DateUtil.format(carryEntity.getDutyDate(), "yyyy-MM-dd")+ " " + DateUtil.format(classEntity.getEndTime(), "HH:mm:ss"); |
|
|
|
|
|
|
|
String dutyTime = startTime + "至" +endTime; |
|
|
|
|
|
|
|
dutyLogEntity.setDutyTime(dutyTime); |
|
|
|
|
|
|
|
ImsDutyRecEntity rec = this.getOne(Wrappers.<ImsDutyRecEntity>lambdaQuery() |
|
|
|
|
|
|
|
.eq(ImsDutyRecEntity::getDutyId, mainId) |
|
|
|
|
|
|
|
.last("limit 1;")); |
|
|
|
|
|
|
|
dutyLogEntity.setHandMaster(getManagerName(mainEntity)); |
|
|
|
|
|
|
|
dutyLogEntity.setHandNumber(getManagerNumber(mainEntity)); |
|
|
|
|
|
|
|
dutyLogEntity.setCarryMaster(getManagerName(carryEntity)); |
|
|
|
|
|
|
|
dutyLogEntity.setCarryNumber(getManagerNumber(carryEntity)); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(rec)) { |
|
|
|
|
|
|
|
dutyLogEntity.setHandTime(DateUtil.format(rec.getExecTime(), "yyyy-MM-dd HH:mm:ss")); |
|
|
|
|
|
|
|
dutyLogEntity.setCarryTime(DateUtil.format(rec.getAcceptTime(), "yyyy-MM-dd HH:mm:ss")); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
//工作票
|
|
|
|
|
|
|
|
Map<String, Object> paramMap = new HashMap<>(); |
|
|
|
|
|
|
|
paramMap.put("startDate", startTime); |
|
|
|
|
|
|
|
paramMap.put("endDate", endTime); |
|
|
|
|
|
|
|
paramMap.put("deptList", deptId); |
|
|
|
|
|
|
|
R<List<WorkTicketInfoEntity>> workTicketInfo = ticketInfoClient.getWorkTicketInfo(paramMap); |
|
|
|
|
|
|
|
if(workTicketInfo.isSuccess()&& cn.hutool.core.util.ObjectUtil.isNotEmpty(workTicketInfo.getData())){ |
|
|
|
|
|
|
|
List<WorkTicketInfoEntity> ticketInfoData = workTicketInfo.getData(); |
|
|
|
|
|
|
|
// 工作票终结数量
|
|
|
|
|
|
|
|
Integer ticketInfoCompleteNum = ticketInfoData.stream().filter(item -> "结束".equals(item.getFlowTaskName())) |
|
|
|
|
|
|
|
.collect(Collectors.toList()).size(); |
|
|
|
|
|
|
|
dutyLogEntity.setWorkFinish(ticketInfoCompleteNum.toString()); |
|
|
|
|
|
|
|
//工作票作废
|
|
|
|
|
|
|
|
List<WorkTicketInfoEntity> invalidList = ticketInfoData.stream().filter(item -> "废票".equals(item.getFlowTaskName())) |
|
|
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
dutyLogEntity.setWorkCancel(String.valueOf(invalidList.size())); |
|
|
|
|
|
|
|
Integer i=0; |
|
|
|
|
|
|
|
//工作票未执行数量
|
|
|
|
|
|
|
|
List<WorkTicketInfoEntity> unExecutedList = ticketInfoData.stream() |
|
|
|
|
|
|
|
.filter(item -> i.equals(item.getImplementStatus())) |
|
|
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
dutyLogEntity.setWorkUnFinish(String.valueOf(unExecutedList.size())); |
|
|
|
|
|
|
|
// 工作票执行数量
|
|
|
|
|
|
|
|
Integer ticketInfoStartNum = ticketInfoData.size() - ticketInfoCompleteNum-ticketInfoCompleteNum-invalidList.size()-unExecutedList.size(); |
|
|
|
|
|
|
|
dutyLogEntity.setWorkDoing(ticketInfoStartNum.toString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
R<List<StandardTicketInfoEntity>> operateTicketInfo = ticketInfoClient.getOperateTicketInfo(paramMap); |
|
|
|
|
|
|
|
if(operateTicketInfo.isSuccess()&& cn.hutool.core.util.ObjectUtil.isNotEmpty(operateTicketInfo.getData())){ |
|
|
|
|
|
|
|
List<StandardTicketInfoEntity> operateTicketInfoData = operateTicketInfo.getData(); |
|
|
|
|
|
|
|
Integer finishSize = operateTicketInfoData.stream().filter(item -> "结束".equals(item.getFlowTaskName())) |
|
|
|
|
|
|
|
.collect(Collectors.toList()).size(); |
|
|
|
|
|
|
|
dutyLogEntity.setOperationFinish(finishSize.toString()); |
|
|
|
|
|
|
|
Integer invalidSize= operateTicketInfoData.stream().filter(item -> "废票".equals(item.getFlowTaskName())) |
|
|
|
|
|
|
|
.collect(Collectors.toList()).size(); |
|
|
|
|
|
|
|
dutyLogEntity.setOperationCancel(invalidSize.toString()); |
|
|
|
|
|
|
|
Integer doingNum = operateTicketInfoData.size() - finishSize - invalidSize; |
|
|
|
|
|
|
|
dutyLogEntity.setOperationUnFinish(doingNum.toString()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
TicketStatisticDTO ticketStatisticDTO=new TicketStatisticDTO(); |
|
|
|
|
|
|
|
ticketStatisticDTO.setStartDate(DateUtil.format(classEntity.getStartTime(),"yyyy-MM-dd HH:mm:ss")); |
|
|
|
|
|
|
|
ticketStatisticDTO.setEndDate(DateUtil.format(classEntity.getEndTime(),"yyyy-MM-dd HH:mm:ss")); |
|
|
|
|
|
|
|
ticketStatisticDTO.setDeptIds(deptId); |
|
|
|
|
|
|
|
return R.data(dutyLogEntity); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String getManagerName(ImsDutyMainEntity mainEntity) { |
|
|
|
|
|
|
|
String managerName=""; |
|
|
|
|
|
|
|
if (cn.hutool.core.util.ObjectUtil.isNotEmpty(mainEntity.getDutyGroupId())){ |
|
|
|
|
|
|
|
Long dutyGroupId = mainEntity.getDutyGroupId(); |
|
|
|
|
|
|
|
ImsDutyGroupEntity groupEntity = imsDutyGroupService.getById(dutyGroupId); |
|
|
|
|
|
|
|
User manager = UserCache.getUser(groupEntity.getManagerId()); |
|
|
|
|
|
|
|
if (cn.hutool.core.util.ObjectUtil.isNotEmpty(manager)){ |
|
|
|
|
|
|
|
managerName=manager.getName(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}else { |
|
|
|
|
|
|
|
ImsDutyMainPersonEntity dutyMainPerson = imsDutyMainPersonService.getOne(new LambdaQueryWrapper<ImsDutyMainPersonEntity>() {{ |
|
|
|
|
|
|
|
eq(ImsDutyMainPersonEntity::getDutyMainId, mainEntity.getId()) |
|
|
|
|
|
|
|
.last(" limit 1"); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
User manager = UserCache.getUser(dutyMainPerson.getDutyChargePerson()); |
|
|
|
|
|
|
|
if (cn.hutool.core.util.ObjectUtil.isNotEmpty(manager)){ |
|
|
|
|
|
|
|
managerName=manager.getName(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return managerName; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private String getManagerNumber(ImsDutyMainEntity mainEntity) { |
|
|
|
|
|
|
|
String handNumber=""; |
|
|
|
|
|
|
|
String[] split = mainEntity.getDutyPersonIds().split("\\^"); |
|
|
|
|
|
|
|
if (null != split && split.length > 0) { |
|
|
|
|
|
|
|
for (int j = 0; j < split.length; j++) { |
|
|
|
|
|
|
|
User user = UserCache.getUser(Long.valueOf(split[j])); |
|
|
|
|
|
|
|
if (org.springblade.core.tool.utils.ObjectUtil.isNotEmpty(user)) { |
|
|
|
|
|
|
|
if (j == split.length - 1) { |
|
|
|
|
|
|
|
handNumber= handNumber + user.getName(); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
handNumber= handNumber + user.getName()+ "、"; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return handNumber; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|