|
|
|
@ -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<ImsDutyClassMapper, ImsDutyClassEntity> 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<ImsDutyClassMapper,
|
|
|
|
|
return this.baseMapper.getList(imsDutyClass); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public R save(List<ImsDutyClassEntity> imsDutyClass) { |
|
|
|
|
List<Long> collect = imsDutyClass.stream().map(s -> s.getId()).collect(Collectors.toList()); |
|
|
|
|
List<ImsDutyMainEntity> imsDutyMainEntities = imsDutyMainMapper.selectList(new LambdaQueryWrapper<ImsDutyMainEntity>() {{ |
|
|
|
|
in(ImsDutyMainEntity::getClassId, collect); |
|
|
|
|
eq(ImsDutyMainEntity::getIsDeleted, 0); |
|
|
|
|
}}); |
|
|
|
|
if (CollectionUtil.isNotEmpty(imsDutyMainEntities)){ |
|
|
|
|
return R.fail("该班次存在排班,不可修改或删除"); |
|
|
|
|
}else { |
|
|
|
|
List<ImsDutyClassEntity> res = this.baseMapper.selectList(new LambdaQueryWrapper<ImsDutyClassEntity>() {{ |
|
|
|
|
in(ImsDutyClassEntity::getClassTypeId, imsDutyClass.get(0).getClassTypeId()); |
|
|
|
|
eq(ImsDutyClassEntity::getIsDeleted, 0); |
|
|
|
|
notIn(ImsDutyClassEntity::getId, collect); |
|
|
|
|
}}); |
|
|
|
|
if (CollectionUtil.isNotEmpty(res)){ |
|
|
|
|
List<Long> 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<ImsDutyClassMapper,
|
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
public R typeRemove(Long classTypeId) { |
|
|
|
|
List<ImsDutyMainEntity> imsDutyMainEntities = imsDutyMainMapper.selectList(new LambdaQueryWrapper<ImsDutyMainEntity>() {{ |
|
|
|
|
eq(ImsDutyMainEntity::getClassId, classTypeId); |
|
|
|
|
eq(ImsDutyMainEntity::getIsDeleted, 0); |
|
|
|
|
}}); |
|
|
|
|
if (CollectionUtil.isNotEmpty(imsDutyMainEntities)){ |
|
|
|
|
return R.fail("该班次存在排班,不可修改或删除"); |
|
|
|
|
} |
|
|
|
|
List<ImsDutyClassEntity> imsDutyClassEntities = this.baseMapper.selectListByClassTypeId(classTypeId); |
|
|
|
|
if (CollectionUtil.isNotEmpty(imsDutyClassEntities)) { |
|
|
|
|
return R.fail("该班次已绑定值班,不可删除!"); |
|
|
|
|