Commit 2f8f02c3 authored by chenhao's avatar chenhao

修改bug 2912

parent dc51dd32
package com.yeejoin.amos.boot.module.common.biz.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.common.api.dto.DutyCarDto;
import com.yeejoin.amos.boot.module.common.api.service.IDutyCarService;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
......@@ -18,10 +23,14 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.api.dto.DutyCarDto;
import com.yeejoin.amos.boot.module.common.api.service.IDutyCarService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
/**
......@@ -144,10 +153,6 @@ public class DutyCarController extends BaseController {
|| ValidationUtil.isEmpty(endTime)){
throw new BadRequest("参数校验失败.");
}
List<Map<String, Object>> list = iDutyCarService.list(null, startTime, DateUtils.getDateNowShortStr());
if(list!=null && list.size()>0 ) {
return ResponseHelper.buildResponse(0);
}
// BUG 2807 删除逻辑缺陷,现在前端后端传入 删除月份 2021-09-10 by kongfm
return ResponseHelper.buildResponse(iDutyCarService.deleteDutyData(instanceId, startTime, endTime));
}
......
......@@ -152,10 +152,6 @@ public class DutyFireFightingController extends BaseController{
|| ValidationUtil.isEmpty(endTime)){
throw new BadRequest("参数校验失败.");
}
List<Map<String, Object>> list = iDutyFireFightingService.list(null, startTime, DateUtils.getDateNowShortStr());
if(list!=null && list.size()>0 ) {
return ResponseHelper.buildResponse(0);
}
return ResponseHelper.buildResponse(iDutyFireFightingService.deleteDutyData(instanceId, startTime, endTime));
}
......
......@@ -145,10 +145,6 @@ public class DutyFirstAidController extends BaseController{
|| ValidationUtil.isEmpty(endTime)){
throw new BadRequest("参数校验失败.");
}
List<Map<String, Object>> list = iDutyFirstAidService.list(null, startTime, DateUtils.getDateNowShortStr());
if(list!=null && list.size()>0 ) {
return ResponseHelper.buildResponse(0);
}
return ResponseHelper.buildResponse(iDutyFirstAidService.deleteDutyData(instanceId, startTime, endTime));
}
......
......@@ -142,11 +142,6 @@ public class DutyPersonController extends BaseController {
|| ValidationUtil.isEmpty(endTime)){
throw new BadRequest("参数校验失败.");
}
List<Map<String, Object>> list = iDutyPersonService.list(null, startTime, DateUtils.getDateNowShortStr());
if(list!=null && list.size()>0 ) {
// throw new BadRequest("班次已有值班数据,无法删除");
return ResponseHelper.buildResponse(0);
}
// BUG 2807 删除逻辑缺陷,现在前端后端传入 删除月份 2021-09-10 by kongfm
return ResponseHelper.buildResponse(iDutyPersonService.deleteDutyData(instanceId, startTime, endTime));
}
......
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.common.api.dto.DutyShiftDto;
import com.yeejoin.amos.boot.module.common.api.entity.DutyShift;
import com.yeejoin.amos.boot.module.common.biz.service.impl.DutyPersonShiftServiceImpl;
import com.yeejoin.amos.boot.module.common.biz.service.impl.DutyShiftServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -31,7 +32,9 @@ public class DutyShiftController extends BaseController {
@Autowired
DutyShiftServiceImpl dutyShiftServiceImpl;
@Autowired
DutyPersonShiftServiceImpl dutyPersonShiftServiceImpl;
/**
* 新增值班班次
*
......@@ -73,6 +76,10 @@ public class DutyShiftController extends BaseController {
@DeleteMapping(value = "/{sequenceNbr}")
@ApiOperation(httpMethod = "DELETE", value = "根据sequenceNbr删除值班班次", notes = "根据sequenceNbr删除值班班次")
public ResponseModel<Boolean> deleteBySequenceNbr(@PathVariable(value = "sequenceNbr") Long sequenceNbr) {
if(dutyPersonShiftServiceImpl.checkCurrentDutyIsUser(sequenceNbr)) {
return ResponseHelper.buildResponse(false);
};
DutyShift dutyShift = dutyShiftServiceImpl.getById(sequenceNbr);
if (null != dutyShift) {
dutyShift.setIsDelete(true);
......
package com.yeejoin.amos.boot.module.common.biz.service.impl;
import java.util.List;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.common.api.dto.DutyPersonShiftDto;
import com.yeejoin.amos.boot.module.common.api.entity.DutyPersonShift;
import com.yeejoin.amos.boot.module.common.api.mapper.DutyPersonShiftMapper;
import com.yeejoin.amos.boot.module.common.api.service.IDutyPersonShiftService;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.List;
/**
* 值班人员日期关联关系表服务实现类
......@@ -33,4 +35,19 @@ public class DutyPersonShiftServiceImpl extends BaseService<DutyPersonShiftDto,
public List<DutyPersonShiftDto> queryForDutyPersonShiftList() {
return this.queryForList("", false);
}
/**
* 查询指定的班次是否被关联使用
* @return
*/
public boolean checkCurrentDutyIsUser(Long shiftId) {
LambdaQueryWrapper<DutyPersonShift> wrapper= new LambdaQueryWrapper<DutyPersonShift>();
wrapper.eq(DutyPersonShift::getIsDelete, false);
wrapper.eq(DutyPersonShift::getShiftId, shiftId);
List<DutyPersonShift> list = this.baseMapper.selectList(wrapper);
if(list!=null && list.size()>0) {
return true;
}
return false;
}
}
package com.yeejoin.amos.boot.module.common.biz.service.impl;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Sequence;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
......@@ -11,20 +26,6 @@ import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormColumn;
import com.yeejoin.amos.boot.module.common.api.entity.DynamicFormInstance;
import com.yeejoin.amos.boot.module.common.api.mapper.DynamicFormInstanceMapper;
import com.yeejoin.amos.boot.module.common.api.service.IDynamicFormInstanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;
/**
* 动态表单实例表服务实现类
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment