Commit 215fb303 authored by kongfm's avatar kongfm

BUG 2807 删除逻辑缺陷,现在前端后端传入 删除月份 2021-09-10 by kongfm

parent ca86ba05
......@@ -61,7 +61,7 @@ public interface IDutyCommonService {
* @param instanceId 实例id
* @return Boolean
*/
Boolean deleteDutyData(Long instanceId);
Boolean deleteDutyData(Long instanceId, String startTime, String endTime);
/**
* 查询指定条件的值班人信息
......
......@@ -11,7 +11,9 @@ import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
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;
......@@ -127,13 +129,21 @@ public class DutyCarController extends BaseController {
* 值班数据删除
*
* @param instanceId 实例id
* @param startTime 开始时间
* @param endTime 结束时间
* @return ResponseModel
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping("/{instanceId}")
@ApiOperation(httpMethod = "DELETE", value = "值班数据删除", notes = "值班数据删除")
public ResponseModel deleteDutyData(@PathVariable Long instanceId) {
return ResponseHelper.buildResponse(iDutyCarService.deleteDutyData(instanceId));
public ResponseModel deleteDutyData(@PathVariable Long instanceId,@PathVariable String startTime,@PathVariable String endTime) {
if (ValidationUtil.isEmpty(instanceId)
|| ValidationUtil.isEmpty(startTime)
|| ValidationUtil.isEmpty(endTime)){
throw new BadRequest("参数校验失败.");
}
// BUG 2807 删除逻辑缺陷,现在前端后端传入 删除月份 2021-09-10 by kongfm
return ResponseHelper.buildResponse(iDutyCarService.deleteDutyData(instanceId, startTime, endTime));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
......
......@@ -11,7 +11,9 @@ import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
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;
......@@ -116,13 +118,21 @@ public class DutyPersonController extends BaseController {
* 值班数据删除
*
* @param instanceId 实例id
* @param startTime 开始时间
* @param endTime 结束时间
* @return ResponseModel
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping("/{instanceId}")
@DeleteMapping("/{instanceId}/{startTime}/{endTime}")
@ApiOperation(httpMethod = "DELETE", value = "值班数据删除", notes = "值班数据删除")
public ResponseModel deleteDutyData(@PathVariable Long instanceId) {
return ResponseHelper.buildResponse(iDutyPersonService.deleteDutyData(instanceId));
public ResponseModel deleteDutyData(@PathVariable Long instanceId,@PathVariable String startTime,@PathVariable String endTime) {
if (ValidationUtil.isEmpty(instanceId)
|| ValidationUtil.isEmpty(startTime)
|| ValidationUtil.isEmpty(endTime)){
throw new BadRequest("参数校验失败.");
}
// BUG 2807 删除逻辑缺陷,现在前端后端传入 删除月份 2021-09-10 by kongfm
return ResponseHelper.buildResponse(iDutyPersonService.deleteDutyData(instanceId, startTime, endTime));
}
/**
......
......@@ -326,14 +326,11 @@ public class DutyCommonServiceImpl implements IDutyCommonService {
}
@Override
public Boolean deleteDutyData(Long instanceId) {
// 一个人共用一个 instanceId
dynamicFormInstanceService.remove(
new LambdaQueryWrapper<DynamicFormInstance>().eq(DynamicFormInstance::getInstanceId, instanceId));
public Boolean deleteDutyData(Long instanceId, String startTime, String endTime) {
// BUG 2807 删除逻辑缺陷,现在前端后端传入 删除月份 2021-09-10 by kongfm
//dynamicFormInstanceService.remove(new LambdaQueryWrapper<DynamicFormInstance>().eq(DynamicFormInstance::getInstanceId, instanceId));
dutyPersonShiftService
.remove(new LambdaQueryWrapper<DutyPersonShift>().eq(DutyPersonShift::getInstanceId, instanceId));
.remove(new LambdaQueryWrapper<DutyPersonShift>().ge(DutyPersonShift::getDutyDate,startTime).le(DutyPersonShift::getDutyDate,endTime).eq(DutyPersonShift::getInstanceId, instanceId));
return true;
}
......
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