Commit 4704a8c3 authored by chenhao's avatar chenhao

添加删除时的限制

parent e127f546
......@@ -17,5 +17,7 @@ public interface IDutyFireFightingService extends IDutyCommonService {
* @return List<DutyCarDto>
*/
DutyFireFightingDto update(Long instanceId, DutyFireFightingDto dto);
Object getlistDutyPostTypeName(Long userId);
}
......@@ -2,6 +2,7 @@ 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;
......@@ -132,16 +133,21 @@ public class DutyCarController extends BaseController {
* @param startTime 开始时间
* @param endTime 结束时间
* @return ResponseModel
* @throws Exception
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping("/{instanceId}/{startTime}/{endTime}")
@ApiOperation(httpMethod = "DELETE", value = "值班数据删除", notes = "值班数据删除")
public ResponseModel deleteDutyData(@PathVariable Long instanceId,@PathVariable String startTime,@PathVariable String endTime) {
public ResponseModel deleteDutyData(@PathVariable Long instanceId,@PathVariable String startTime,@PathVariable String endTime) throws Exception {
if (ValidationUtil.isEmpty(instanceId)
|| ValidationUtil.isEmpty(startTime)
|| ValidationUtil.isEmpty(endTime)){
throw new BadRequest("参数校验失败.");
}
List<Map<String, Object>> list = iDutyCarService.list(null, startTime, DateUtils.getDateNowShortStr());
if(list!=null && list.size()>0 ) {
throw new BadRequest("班次已有值班数据,无法删除");
}
// BUG 2807 删除逻辑缺陷,现在前端后端传入 删除月份 2021-09-10 by kongfm
return ResponseHelper.buildResponse(iDutyCarService.deleteDutyData(instanceId, startTime, endTime));
}
......
package com.yeejoin.amos.boot.module.common.biz.controller;
import java.text.ParseException;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
......@@ -17,14 +18,18 @@ 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.DateUtil;
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;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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.DutyFireFightingDto;
import com.yeejoin.amos.boot.module.common.api.service.IDutyFireFightingService;
......@@ -136,16 +141,21 @@ public class DutyFireFightingController extends BaseController{
* @param startTime 开始时间
* @param endTime 结束时间
* @return ResponseModel
* @throws ParseException
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping("/{instanceId}/{startTime}/{endTime}")
@ApiOperation(httpMethod = "DELETE", value = "值班数据删除", notes = "值班数据删除")
public ResponseModel deleteDutyData(@PathVariable Long instanceId,@PathVariable String startTime,@PathVariable String endTime) {
public ResponseModel deleteDutyData(@PathVariable Long instanceId,@PathVariable String startTime,@PathVariable String endTime) throws Exception {
if (ValidationUtil.isEmpty(instanceId)
|| ValidationUtil.isEmpty(startTime)
|| ValidationUtil.isEmpty(endTime)){
throw new BadRequest("参数校验失败.");
}
List<Map<String, Object>> list = iDutyFireFightingService.list(null, startTime, DateUtils.getDateNowShortStr());
if(list!=null && list.size()>0 ) {
throw new BadRequest("班次已有值班数据,无法删除");
}
return ResponseHelper.buildResponse(iDutyFireFightingService.deleteDutyData(instanceId, startTime, endTime));
}
......@@ -157,4 +167,11 @@ public class DutyFireFightingController extends BaseController{
@ApiParam(value = "岗位") @RequestParam(required = false) String postType){
return ResponseHelper.buildResponse(iDutyFireFightingService.getSchedulingDutyForSpecifyDate(dutyDay,shiftId,postType));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("查询微型消防站排班值班的噶岗位信息列表")
@GetMapping("/DutyPostTypeName/{userId}")
public ResponseModel getlistDutyPostTypeName(@ApiParam(value = "当前用户id",required = true) @PathVariable Long userId) {
return ResponseHelper.buildResponse(iDutyFireFightingService.getlistDutyPostTypeName(userId));
}
}
......@@ -25,6 +25,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
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.DutyFirstAidDto;
import com.yeejoin.amos.boot.module.common.api.service.IDutyFirstAidService;
......@@ -133,16 +134,21 @@ public class DutyFirstAidController extends BaseController{
* @param startTime 开始时间
* @param endTime 结束时间
* @return ResponseModel
* @throws Exception
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping("/{instanceId}/{startTime}/{endTime}")
@ApiOperation(httpMethod = "DELETE", value = "值班数据删除", notes = "值班数据删除")
public ResponseModel deleteDutyData(@PathVariable Long instanceId,@PathVariable String startTime,@PathVariable String endTime) {
public ResponseModel deleteDutyData(@PathVariable Long instanceId,@PathVariable String startTime,@PathVariable String endTime) throws Exception {
if (ValidationUtil.isEmpty(instanceId)
|| ValidationUtil.isEmpty(startTime)
|| ValidationUtil.isEmpty(endTime)){
throw new BadRequest("参数校验失败.");
}
List<Map<String, Object>> list = iDutyFirstAidService.list(null, startTime, DateUtils.getDateNowShortStr());
if(list!=null && list.size()>0 ) {
throw new BadRequest("班次已有值班数据,无法删除");
}
return ResponseHelper.buildResponse(iDutyFirstAidService.deleteDutyData(instanceId, startTime, endTime));
}
......
......@@ -25,6 +25,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
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.DutyPersonDto;
import com.yeejoin.amos.boot.module.common.api.service.IDutyPersonService;
......@@ -130,16 +131,21 @@ public class DutyPersonController extends BaseController {
* @param startTime 开始时间
* @param endTime 结束时间
* @return ResponseModel
* @throws Exception
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@DeleteMapping("/{instanceId}/{startTime}/{endTime}")
@ApiOperation(httpMethod = "DELETE", value = "值班数据删除", notes = "值班数据删除")
public ResponseModel deleteDutyData(@PathVariable Long instanceId,@PathVariable String startTime,@PathVariable String endTime) {
public ResponseModel deleteDutyData(@PathVariable Long instanceId,@PathVariable String startTime,@PathVariable String endTime) throws Exception {
if (ValidationUtil.isEmpty(instanceId)
|| ValidationUtil.isEmpty(startTime)
|| 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("班次已有值班数据,无法删除");
}
// BUG 2807 删除逻辑缺陷,现在前端后端传入 删除月份 2021-09-10 by kongfm
return ResponseHelper.buildResponse(iDutyPersonService.deleteDutyData(instanceId, startTime, endTime));
}
......
package com.yeejoin.amos.boot.module.common.biz.service.impl;
import static org.hamcrest.CoreMatchers.nullValue;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
......@@ -9,9 +12,12 @@ import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.Bean;
import com.itextpdf.text.pdf.PdfStructTreeController.returnType;
import com.yeejoin.amos.boot.module.common.api.dto.DutyFireFightingDto;
import com.yeejoin.amos.boot.module.common.api.dto.DynamicFormInstanceDto;
import com.yeejoin.amos.boot.module.common.api.dto.FireStationDto;
import com.yeejoin.amos.boot.module.common.api.mapper.DutyPersonShiftMapper;
import com.yeejoin.amos.boot.module.common.api.service.IDutyFireFightingService;
......@@ -25,6 +31,9 @@ public class DutyFireFightingServiceImpl extends DutyCommonServiceImpl implement
@Autowired
DutyPersonShiftMapper dutyPersonShiftMapper;
@Autowired
DynamicFormInstanceServiceImpl alertFormValueServiceImpl;
public String getGroupCode() {
return "dutyFireFighting";
}
......@@ -101,5 +110,21 @@ public class DutyFireFightingServiceImpl extends DutyCommonServiceImpl implement
}
return detailList;
}
@Override
public Object getlistDutyPostTypeName(Long userId) {
List<DynamicFormInstanceDto> dyList = alertFormValueServiceImpl.queryByCalledId(userId);
Map<String, Object> map = new HashMap<String, Object>();
if (ObjectUtils.isEmpty(dyList)) {
return null;
}
for (DynamicFormInstanceDto dto : dyList) {
if ("positionType".equals(dto.getFieldCode())) {
map.put("postType", dto.getFieldValue());
map.put("postTypeName", dto.getFieldValueLabel());
break;
}
}
return map;
}
}
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