Browse Source

修改值班bug

zhongwei
tyty 2 years ago
parent
commit
0b15b42086
  1. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/controller/ImsDutyClassController.java
  2. 4
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/IImsDutyClassService.java
  3. 46
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyClassServiceImpl.java

6
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.Condition;
import org.springblade.core.mp.support.Query; import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -118,7 +119,10 @@ public class ImsDutyClassController extends BladeController {
@ApiOperation(value = "批量修改", notes = "imsDutyClassEntities") @ApiOperation(value = "批量修改", notes = "imsDutyClassEntities")
public R updateBatch(@Valid @RequestBody List<ImsDutyClassEntity> imsDutyClassEntities) { public R updateBatch(@Valid @RequestBody List<ImsDutyClassEntity> imsDutyClassEntities) {
//imsDutyClassService.determineThe(imsDutyClassEntities); //imsDutyClassService.determineThe(imsDutyClassEntities);
return R.status(imsDutyClassService.updateBatchById(imsDutyClassEntities)); if(CollectionUtil.isEmpty(imsDutyClassEntities)){
return R.fail("无数据");
}
return imsDutyClassService.save(imsDutyClassEntities);
} }

4
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; package com.hnac.hzims.operational.duty.service;
import com.hnac.hzims.operational.duty.entity.ImsDutyClassEntity; 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.mp.base.BaseService;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
@ -29,7 +27,7 @@ public interface IImsDutyClassService extends BaseService<ImsDutyClassEntity> {
List<ImsDutyClassEntity> getList(ImsDutyClassEntity imsDutyClass); List<ImsDutyClassEntity> getList(ImsDutyClassEntity imsDutyClass);
R save (List<ImsDutyClassEntity> imsDutyClassEntities);
R typeRemove(Long classTypeId); R typeRemove(Long classTypeId);

46
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; package com.hnac.hzims.operational.duty.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; 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.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.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.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.apache.commons.lang3.StringUtils;
import org.springblade.core.mp.base.BaseServiceImpl; import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.CollectionUtil; 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.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
/** /**
* 服务实现类 * 服务实现类
@ -31,6 +24,8 @@ import java.util.List;
@Service @Service
public class ImsDutyClassServiceImpl extends BaseServiceImpl<ImsDutyClassMapper, ImsDutyClassEntity> implements IImsDutyClassService { public class ImsDutyClassServiceImpl extends BaseServiceImpl<ImsDutyClassMapper, ImsDutyClassEntity> implements IImsDutyClassService {
@Autowired
private ImsDutyMainMapper imsDutyMainMapper;
@Override @Override
public R saveOrUpdateImsDutyClass(ImsDutyClassEntity imsDutyClass) { public R saveOrUpdateImsDutyClass(ImsDutyClassEntity imsDutyClass) {
if (null == imsDutyClass.getClassTypeId()) { if (null == imsDutyClass.getClassTypeId()) {
@ -56,6 +51,30 @@ public class ImsDutyClassServiceImpl extends BaseServiceImpl<ImsDutyClassMapper,
return this.baseMapper.getList(imsDutyClass); 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 删除所属类型班次 * 根据班次类型Id 删除所属类型班次
* *
@ -63,6 +82,13 @@ public class ImsDutyClassServiceImpl extends BaseServiceImpl<ImsDutyClassMapper,
*/ */
@Override @Override
public R typeRemove(Long classTypeId) { 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); List<ImsDutyClassEntity> imsDutyClassEntities = this.baseMapper.selectListByClassTypeId(classTypeId);
if (CollectionUtil.isNotEmpty(imsDutyClassEntities)) { if (CollectionUtil.isNotEmpty(imsDutyClassEntities)) {
return R.fail("该班次已绑定值班,不可删除!"); return R.fail("该班次已绑定值班,不可删除!");

Loading…
Cancel
Save