提交地图部门配置

This commit is contained in:
陈超
2022-08-09 10:20:45 +08:00
parent 6b6bc6c0eb
commit 78e52ecda9
4 changed files with 135 additions and 21 deletions

View File

@@ -8,6 +8,7 @@ import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.common.utils.LogUtil;
import com.njcn.system.pojo.param.DeptConfigParam;
import com.njcn.system.pojo.vo.DeptConfigVO;
import com.njcn.system.service.DeptMapService;
import com.njcn.web.controller.BaseController;
@@ -82,18 +83,12 @@ public class DeptMapController extends BaseController {
}
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
@ResponseBody
@PostMapping("/addDeptMapConfig")
@ApiOperation("新增地图与部门关联配置")
public HttpResult addDeptMapConfig(@RequestParam("longitude") Double longitude,
@RequestParam("latitude") Double latitude,
@RequestParam("maxValue") Integer maxValue,
@RequestParam("minValue") Integer minValue,
@RequestParam("beValue") Integer beValue,
@RequestParam("mapType") Integer mapType,
@RequestParam("deptId") String deptId) {
@ApiImplicitParam(name = "deptConfigParam", value = "新增配置实体", required = true)
public HttpResult addDeptMapConfig(@RequestBody @Validated DeptConfigParam deptConfigParam) {
String methodDescribe = getMethodDescribe("addDeptMapConfig");
boolean res = deptMapService.addDeptMapConfig(longitude, latitude, maxValue, minValue, beValue, mapType, deptId);
boolean res = deptMapService.addDeptMapConfig(deptConfigParam);
if (res) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
} else {
@@ -101,6 +96,21 @@ public class DeptMapController extends BaseController {
}
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.UPDATE)
@PostMapping("/updateDeptMapConfigById")
@ApiOperation("修改地图与部门关联配置")
@ApiImplicitParam(name = "deptConfigUpdateParam", value = "修改配置实体", required = true)
public HttpResult updateDeptMapConfigById(@RequestBody @Validated DeptConfigParam.DeptConfigUpdateParam deptConfigUpdateParam) {
String methodDescribe = getMethodDescribe("updateDeptMapConfigById");
LogUtil.njcnDebug(log, "{}", methodDescribe, methodDescribe);
boolean res = deptMapService.updateDeptMapConfigById(deptConfigUpdateParam);
if (res) {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
} else {
throw new BusinessException(CommonResponseEnum.ID_NOT_EXIST);
}
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON, operateType = OperateType.DELETE)
@GetMapping("/removeDeptMapConfigById")
@ApiOperation("根据id删除地图与部门关联配置")

View File

@@ -1,5 +1,6 @@
package com.njcn.system.service;
import com.njcn.system.pojo.param.DeptConfigParam;
import com.njcn.system.pojo.vo.DeptConfigVO;
import java.util.List;
@@ -17,7 +18,9 @@ public interface DeptMapService {
DeptConfigVO getConfigByDeptId(String deptId);
boolean addDeptMapConfig(Double longitude, Double latitude, Integer maxValue, Integer minValue, Integer beValue, Integer mapType, String deptId);
boolean addDeptMapConfig(DeptConfigParam deptConfigParam);
boolean updateDeptMapConfigById(DeptConfigParam.DeptConfigUpdateParam deptConfigUpdateParam);
boolean removeDeptMapConfigById(String id);

View File

@@ -5,6 +5,7 @@ import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.system.mapper.DeptMapMapper;
import com.njcn.system.pojo.param.DeptConfigParam;
import com.njcn.system.pojo.po.DeptMap;
import com.njcn.system.pojo.vo.Dept;
import com.njcn.system.pojo.vo.DeptConfigVO;
@@ -76,23 +77,16 @@ public class DeptMapServiceImpl implements DeptMapService {
}
@Override
public boolean addDeptMapConfig(Double longitude, Double latitude, Integer maxValue, Integer minValue, Integer beValue, Integer mapType, String deptId) {
if (deptMapMapper.selectCountByDept(deptId)==0) {
public boolean addDeptMapConfig(DeptConfigParam deptConfigParam) {
if (deptMapMapper.selectCountByDept(deptConfigParam.getDeptId())==0) {
throw new BusinessException(CommonResponseEnum.DEPT_NOT_EXIST);
}
QueryWrapper<DeptMap> deptMapQueryWrapper = new QueryWrapper<>();
deptMapQueryWrapper.eq("sys_dept_map.Dept_Id",deptId);
deptMapQueryWrapper.eq("sys_dept_map.Dept_Id",deptConfigParam.getDeptId());
Integer count = deptMapMapper.selectCount(deptMapQueryWrapper);
if (count==0) {
DeptMap deptMap = new DeptMap();
deptMap.setLongitude(longitude);
deptMap.setLatitude(latitude);
deptMap.setMaxValue(maxValue);
deptMap.setMinValue(minValue);
deptMap.setBeValue(beValue);
deptMap.setMapType(mapType);
deptMap.setDeptId(deptId);
// deptMap.setState(DataStateEnum.ENABLE.getCode());
BeanUtils.copyProperties(deptConfigParam,deptMap);
deptMap.setCreateBy(RequestUtil.getUserIndex());
deptMap.setCreateTime(LocalDateTime.now());
deptMap.setUpdateBy(RequestUtil.getUserIndex());
@@ -105,6 +99,25 @@ public class DeptMapServiceImpl implements DeptMapService {
}
@Override
public boolean updateDeptMapConfigById(DeptConfigParam.DeptConfigUpdateParam deptConfigUpdateParam) {
DeptMap deptMap = deptMapMapper.selectOne(new QueryWrapper<DeptMap>().eq("sys_dept_map.Id", deptConfigUpdateParam.getId()));
if (!Objects.isNull(deptMap) && deptMap.getState().equals(DataStateEnum.ENABLE.getCode())) {
deptMap.setLongitude(deptConfigUpdateParam.getLongitude());
deptMap.setLatitude(deptConfigUpdateParam.getLatitude());
deptMap.setMaxValue(deptConfigUpdateParam.getMaxValue());
deptMap.setMinValue(deptConfigUpdateParam.getMinValue());
deptMap.setBeValue(deptConfigUpdateParam.getBeValue());
deptMap.setMapType(deptConfigUpdateParam.getMapType());
deptMap.setDeptId(deptConfigUpdateParam.getDeptId());
deptMap.setUpdateBy(RequestUtil.getUserIndex());
deptMap.setUpdateTime(LocalDateTime.now());
deptMapMapper.updateById(deptMap);
return true;
}
return false;
}
@Override
public boolean removeDeptMapConfigById(String id) {
DeptMap deptMap = deptMapMapper.selectOne(new QueryWrapper<DeptMap>().eq("sys_dept_map.Id", id));