Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
package com.njcn.system.pojo.param;
|
||||
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.web.constant.ValidMessage;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
/**
|
||||
* @version 1.0.0
|
||||
* @author: chenchao
|
||||
* @date: 2022/08/08 15:58
|
||||
*/
|
||||
@Data
|
||||
public class DeptConfigParam {
|
||||
|
||||
/**
|
||||
* 中心点经度
|
||||
*/
|
||||
@ApiModelProperty("中心点经度")
|
||||
@NotNull(message = "中心点经度不可为空")
|
||||
private Double longitude;
|
||||
|
||||
/**
|
||||
* 中心点纬度
|
||||
*/
|
||||
@ApiModelProperty("中心点纬度")
|
||||
@NotNull(message = "中心点纬度不可为空")
|
||||
private Double latitude;
|
||||
|
||||
/**
|
||||
* 最大值
|
||||
*/
|
||||
@ApiModelProperty("最大值")
|
||||
@NotNull(message = "最大值不可为空")
|
||||
private Integer maxValue;
|
||||
|
||||
/**
|
||||
* 最小值
|
||||
*/
|
||||
@ApiModelProperty("最小值")
|
||||
@NotNull(message = "最小值不可为空")
|
||||
private Integer minValue;
|
||||
|
||||
/**
|
||||
* 当前值
|
||||
*/
|
||||
@ApiModelProperty("当前值")
|
||||
@NotNull(message = "当前值不可为空")
|
||||
private Integer beValue;
|
||||
|
||||
/**
|
||||
* 地图状态:0-离线 1-在线
|
||||
*/
|
||||
@ApiModelProperty("地图状态:0-离线 1-在线")
|
||||
@NotNull(message = "地图状态不可为空")
|
||||
private Integer mapType;
|
||||
|
||||
/**
|
||||
* 部门Id
|
||||
*/
|
||||
@ApiModelProperty("部门Id")
|
||||
@NotBlank(message = "部门Id不能为空,请检查参数")
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR)
|
||||
private String deptId;
|
||||
|
||||
/**
|
||||
* 更新操作实体
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class DeptConfigUpdateParam extends DeptConfigParam {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@ApiModelProperty("主键Id")
|
||||
@NotBlank(message = ValidMessage.ID_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR)
|
||||
private String id;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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删除地图与部门关联配置")
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user