diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyClassController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyClassController.java index dc99dc1..b464ca2 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyClassController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyClassController.java @@ -16,6 +16,7 @@ import org.springblade.core.boot.ctrl.BladeController; import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.Func; import org.springframework.web.bind.annotation.*; @@ -118,7 +119,10 @@ public class ImsDutyClassController extends BladeController { @ApiOperation(value = "批量修改", notes = "imsDutyClassEntities") public R updateBatch(@Valid @RequestBody List imsDutyClassEntities) { //imsDutyClassService.determineThe(imsDutyClassEntities); - return R.status(imsDutyClassService.updateBatchById(imsDutyClassEntities)); + if(CollectionUtil.isEmpty(imsDutyClassEntities)){ + return R.fail("无数据"); + } + return imsDutyClassService.save(imsDutyClassEntities); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyClassService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyClassService.java index 038ac96..76c7d53 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyClassService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyClassService.java @@ -1,8 +1,6 @@ package com.hnac.hzims.operational.duty.service; import com.hnac.hzims.operational.duty.entity.ImsDutyClassEntity; -import com.hnac.hzims.operational.duty.entity.ImsDutyClassTypeEntity; -import com.hnac.hzims.operational.duty.vo.DutyMainInfoVo; import org.springblade.core.mp.base.BaseService; import org.springblade.core.tool.api.R; @@ -29,7 +27,7 @@ public interface IImsDutyClassService extends BaseService { List getList(ImsDutyClassEntity imsDutyClass); - + R save (List imsDutyClassEntities); R typeRemove(Long classTypeId); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyClassServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyClassServiceImpl.java index 57cacc5..cb31c38 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyClassServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyClassServiceImpl.java @@ -1,27 +1,20 @@ package com.hnac.hzims.operational.duty.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.hnac.hzims.operational.duty.entity.DutyGroupGeneratingCapacityEntity; import com.hnac.hzims.operational.duty.entity.ImsDutyClassEntity; -import com.hnac.hzims.operational.duty.entity.ImsDutyClassTypeEntity; +import com.hnac.hzims.operational.duty.entity.ImsDutyMainEntity; import com.hnac.hzims.operational.duty.mapper.ImsDutyClassMapper; -import com.hnac.hzims.operational.duty.service.IDutyGroupGeneratingCapacityService; +import com.hnac.hzims.operational.duty.mapper.ImsDutyMainMapper; import com.hnac.hzims.operational.duty.service.IImsDutyClassService; -import com.hnac.hzims.operational.duty.service.IImsDutyMainService; -import com.hnac.hzims.operational.duty.vo.DutyMainInfoVo; -import lombok.AllArgsConstructor; import org.apache.commons.lang3.StringUtils; import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.CollectionUtil; -import org.springblade.core.tool.utils.DateUtil; -import org.springblade.core.tool.utils.ObjectUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.Collection; import java.util.List; +import java.util.stream.Collectors; /** * 服务实现类 @@ -31,6 +24,8 @@ import java.util.List; @Service public class ImsDutyClassServiceImpl extends BaseServiceImpl implements IImsDutyClassService { + @Autowired + private ImsDutyMainMapper imsDutyMainMapper; @Override public R saveOrUpdateImsDutyClass(ImsDutyClassEntity imsDutyClass) { if (null == imsDutyClass.getClassTypeId()) { @@ -56,6 +51,30 @@ public class ImsDutyClassServiceImpl extends BaseServiceImpl imsDutyClass) { + List collect = imsDutyClass.stream().map(s -> s.getId()).collect(Collectors.toList()); + List imsDutyMainEntities = imsDutyMainMapper.selectList(new LambdaQueryWrapper() {{ + in(ImsDutyMainEntity::getClassId, collect); + eq(ImsDutyMainEntity::getIsDeleted, 0); + }}); + if (CollectionUtil.isNotEmpty(imsDutyMainEntities)){ + return R.fail("该班次存在排班,不可修改或删除"); + }else { + List res = this.baseMapper.selectList(new LambdaQueryWrapper() {{ + in(ImsDutyClassEntity::getClassTypeId, imsDutyClass.get(0).getClassTypeId()); + eq(ImsDutyClassEntity::getIsDeleted, 0); + notIn(ImsDutyClassEntity::getId, collect); + }}); + if (CollectionUtil.isNotEmpty(res)){ + List id = res.stream().map(s -> s.getId()).collect(Collectors.toList()); + this.deleteLogic(id); + } + return R.status(this.saveOrUpdateBatch(imsDutyClass)); + } + } + + /** * 根据班次类型Id 删除所属类型班次 * @@ -63,6 +82,13 @@ public class ImsDutyClassServiceImpl extends BaseServiceImpl imsDutyMainEntities = imsDutyMainMapper.selectList(new LambdaQueryWrapper() {{ + eq(ImsDutyMainEntity::getClassId, classTypeId); + eq(ImsDutyMainEntity::getIsDeleted, 0); + }}); + if (CollectionUtil.isNotEmpty(imsDutyMainEntities)){ + return R.fail("该班次存在排班,不可修改或删除"); + } List imsDutyClassEntities = this.baseMapper.selectListByClassTypeId(classTypeId); if (CollectionUtil.isNotEmpty(imsDutyClassEntities)) { return R.fail("该班次已绑定值班,不可删除!"); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainTemplateImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainTemplateImpl.java index 7e91c96..bacbf05 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainTemplateImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainTemplateImpl.java @@ -10,7 +10,6 @@ import com.hnac.hzims.operational.duty.vo.FlexibleSchedulingVo; import com.hnac.hzims.operational.duty.vo.ImsSchedulingVo; import lombok.extern.slf4j.Slf4j; import org.springblade.core.mp.base.BaseServiceImpl; -import org.springblade.core.mp.support.Condition; import org.springblade.core.tool.utils.CollectionUtil; import org.springframework.stereotype.Service; @@ -30,6 +29,9 @@ public class ImsDutyMainTemplateImpl extends BaseServiceImpl 0 && one.getDelayStatus() == 0) { + if (differMinute > 0 && one.getDelayStatus() == 0&&differMinute < 15) { //提醒站长 接班人 交班人 User admin = userClient.userByAccount(entity.getTenantId(), "admin").getData(); remondingStationV2(carryMainentity.getDutyDate(),admin, admin.getName(), classEntity, carryMainentity.getTenantId(), carryMainentity.getId(), carryMainentity.getCreateDept(), carryMainentity.getCreateUser());//提醒站长