启动出错
This commit is contained in:
@@ -6,9 +6,9 @@ spring:
|
||||
datasource:
|
||||
druid:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://192.168.1.24:13306/pqs9100?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=CTT
|
||||
url: jdbc:mysql://127.0.0.1:3306/pqs9100?useUnicode=true&characterEncoding=utf-8&useSSL=true&serverTimezone=CTT
|
||||
username: root
|
||||
password: njcnpqs
|
||||
password: 123456
|
||||
#初始化建立物理连接的个数、最小、最大连接数
|
||||
initial-size: 5
|
||||
min-idle: 5
|
||||
|
||||
@@ -54,7 +54,6 @@ public class DictDataController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增字典数据
|
||||
*
|
||||
@@ -93,7 +92,6 @@ public class DictDataController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除字典数据
|
||||
*/
|
||||
@@ -112,7 +110,6 @@ public class DictDataController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/getDicDataById")
|
||||
@ApiOperation("根据字典id查询字典数据")
|
||||
@@ -133,7 +130,6 @@ public class DictDataController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取所有字典数据基础信息
|
||||
*/
|
||||
@@ -150,6 +146,5 @@ public class DictDataController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.NO_DATA, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
package com.njcn.gather.system.dictionary.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.gather.system.dictionary.pojo.param.DictPqParam;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictPq;
|
||||
import com.njcn.gather.system.dictionary.service.IDictPqService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.utils.HttpResultUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Api(tags = "电能质量指标字典操作")
|
||||
@RestController
|
||||
@RequestMapping("/dictPq")
|
||||
@RequiredArgsConstructor
|
||||
public class DictPqController extends BaseController {
|
||||
|
||||
private final IDictPqService dictPqService;
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/list")
|
||||
@ApiOperation("查询电能质量指标字典")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public HttpResult<Page<DictPq>> list(@RequestBody @Validated DictPqParam.DictPqQueryParam queryParam) {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, queryParam);
|
||||
Page<DictPq> result = dictPqService.listDictPqs(queryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增电能质量指标字典")
|
||||
public HttpResult<Object> add(@RequestBody @Validated DictPqParam dictPqParam){
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
LogUtil.njcnDebug(log, "{},新增数据为:{}", methodDescribe, dictPqParam);
|
||||
boolean result = dictPqService.addDictPq(dictPqParam);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("更新电能质量指标字典")
|
||||
public HttpResult<Object> update(@RequestBody @Validated DictPqParam.DictPqUpdateParam updateParam){
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
LogUtil.njcnDebug(log, "{},更新数据为:{}", methodDescribe, updateParam);
|
||||
boolean result = dictPqService.updateDictPq(updateParam);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.DELETE)
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation("删除电能质量指标字典")
|
||||
@ApiImplicitParam(name = "ids", value = "字典索引", required = true)
|
||||
public HttpResult<Object> delete(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("delete");
|
||||
LogUtil.njcnDebug(log, "{},字典ID数据为:{}", methodDescribe, String.join(StrUtil.COMMA, ids));
|
||||
boolean result = dictPqService.deleteDictPq(ids);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,6 @@ import org.springframework.web.bind.annotation.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author hongawen
|
||||
* @since 2021-12-13
|
||||
*/
|
||||
@@ -62,7 +61,6 @@ public class DictTypeController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, dictTypeList, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增字典类型")
|
||||
@@ -78,7 +76,6 @@ public class DictTypeController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改字典类型")
|
||||
@@ -94,8 +91,6 @@ public class DictTypeController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.DELETE)
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation("删除字典类型")
|
||||
@@ -111,7 +106,12 @@ public class DictTypeController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/export")
|
||||
@ApiOperation("导出字典类型数据")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||
public void export(@RequestBody @Validated DictTypeParam.DictTypeQueryParam queryParam) {
|
||||
dictTypeService.exportDictType(queryParam);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.njcn.gather.system.dictionary.mapper;
|
||||
|
||||
import com.github.yulichang.base.MPJBaseMapper;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictPq;
|
||||
|
||||
public interface DictPqMapper extends MPJBaseMapper<DictPq> {
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.gather.system.dictionary.mapper.DictPqMapper">
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,149 @@
|
||||
package com.njcn.gather.system.dictionary.pojo.param;
|
||||
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.gather.system.pojo.constant.SystemValidMessage;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class DictPqParam {
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
@NotBlank(message = SystemValidMessage.NAME_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.DIC_REGEX, message = SystemValidMessage.NAME_FORMAT_ERROR)
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("相别")
|
||||
@NotBlank(message = SystemValidMessage.PHASE_NOT_BLANK)
|
||||
private String phase;
|
||||
|
||||
@ApiModelProperty("数据模型")
|
||||
@NotBlank(message = SystemValidMessage.DATA_TYPE_NOT_BLANK)
|
||||
private String dataType;
|
||||
|
||||
@ApiModelProperty("别名,默认与名称相同")
|
||||
private String otherName;
|
||||
|
||||
@ApiModelProperty("显示名称")
|
||||
private String showName;
|
||||
|
||||
@ApiModelProperty("排序")
|
||||
@NotNull(message = SystemValidMessage.SORT_NOT_NULL)
|
||||
@Min(value = 0, message = SystemValidMessage.SORT_FORMAT_ERROR)
|
||||
@Max(value = 999, message = SystemValidMessage.SORT_FORMAT_ERROR)
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty("指标数据类型(整型、浮点型、枚举型)")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty("单位")
|
||||
private String unit;
|
||||
|
||||
@ApiModelProperty("起始次数")
|
||||
private Integer harmStart;
|
||||
|
||||
@ApiModelProperty("结束次数")
|
||||
private Integer harmEnd;
|
||||
|
||||
@ApiModelProperty("数据表表名")
|
||||
@NotBlank(message = SystemValidMessage.CLASS_ID_NOT_BLANK)
|
||||
private String classId;
|
||||
|
||||
@ApiModelProperty("数据统计类型(最大、最小、平均、CP95)")
|
||||
private String statMethod;
|
||||
|
||||
@ApiModelProperty("系统类别(区分用能/电能)")
|
||||
private String systemType;
|
||||
|
||||
@ApiModelProperty("数据是否上送(0:不上送 1:上送)")
|
||||
private Integer tranFlag;
|
||||
|
||||
@ApiModelProperty("上送规则 变化: \"change\" 周期: \"period\"")
|
||||
private String tranRule;
|
||||
|
||||
@ApiModelProperty("evt的事件类别 \"1\"、\"2\"")
|
||||
private String eventType;
|
||||
|
||||
@ApiModelProperty("sts、di的是否存储 1:存储 0:不存储")
|
||||
private Integer storeFlag;
|
||||
|
||||
@ApiModelProperty("sts、do的当前值")
|
||||
private Integer curSts;
|
||||
|
||||
@ApiModelProperty("do的是否可远程控制 1:是 0:否;")
|
||||
private Integer ctlSts;
|
||||
|
||||
@ApiModelProperty("设置最大值")
|
||||
private Double maxNum;
|
||||
|
||||
@ApiModelProperty("设置最小值")
|
||||
private Double minNum;
|
||||
|
||||
@ApiModelProperty("参数为enum可设置的所有值序列")
|
||||
private String setValue;
|
||||
|
||||
@ApiModelProperty("参数string可设置字符串的长度上限")
|
||||
private Integer strlen;
|
||||
|
||||
@ApiModelProperty("参数缺省值、告警code值")
|
||||
private String defaultValue;
|
||||
|
||||
@ApiModelProperty("报表数据来源(统计表表名)")
|
||||
private String resourcesId;
|
||||
|
||||
@ApiModelProperty("限值字段名称")
|
||||
private String limitName;
|
||||
|
||||
@ApiModelProperty("限值表名")
|
||||
private String limitTable;
|
||||
|
||||
@ApiModelProperty("超标判断方式")
|
||||
private String formula;
|
||||
|
||||
@ApiModelProperty("二次值转一次值公式")
|
||||
private String primaryFormula;
|
||||
|
||||
/**
|
||||
* 更新操作实体
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class DictPqUpdateParam extends DictPqParam {
|
||||
|
||||
@ApiModelProperty("id")
|
||||
@NotBlank(message = SystemValidMessage.ID_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = SystemValidMessage.ID_FORMAT_ERROR)
|
||||
private String id;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询实体
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class DictPqQueryParam extends BaseParam {
|
||||
|
||||
@ApiModelProperty("名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("别名")
|
||||
private String otherName;
|
||||
|
||||
@ApiModelProperty("显示名称")
|
||||
private String showName;
|
||||
|
||||
@ApiModelProperty("数据模型")
|
||||
private String dataType;
|
||||
|
||||
@ApiModelProperty("数据表表名")
|
||||
private String classId;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
package com.njcn.gather.system.dictionary.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.mybatisplus.bo.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName("sys_dict_pq")
|
||||
public class DictPq extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 电能质量指标字典id
|
||||
*/
|
||||
public String id;
|
||||
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 相别
|
||||
*/
|
||||
private String phase;
|
||||
|
||||
/**
|
||||
* 数据模型 (epd、pqd...)
|
||||
*/
|
||||
private String dataType;
|
||||
|
||||
/**
|
||||
* 别名(默认与Name相同)
|
||||
*/
|
||||
private String otherName;
|
||||
|
||||
/**
|
||||
* 显示名称
|
||||
*/
|
||||
private String showName;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 指标数据类型(整型、浮点型、枚举型)
|
||||
*/
|
||||
private String type;
|
||||
|
||||
/**
|
||||
* 单位
|
||||
*/
|
||||
private String unit;
|
||||
|
||||
/**
|
||||
* 起始次数
|
||||
*/
|
||||
private Integer harmStart;
|
||||
|
||||
/**
|
||||
* 结束次数
|
||||
*/
|
||||
private Integer harmEnd;
|
||||
|
||||
/**
|
||||
* 数据表表名
|
||||
*/
|
||||
private String classId;
|
||||
|
||||
/**
|
||||
* 数据统计类型(最大、最小、平均、CP95)
|
||||
*/
|
||||
private String statMethod;
|
||||
|
||||
/**
|
||||
* 系统类别(区分用能/电能)
|
||||
*/
|
||||
private String systemType;
|
||||
|
||||
/**
|
||||
* 数据是否上送(0:不上送 1:上送)
|
||||
*/
|
||||
private Integer tranFlag;
|
||||
|
||||
/**
|
||||
* 上送规则 变化: "change" 周期: "period"
|
||||
*/
|
||||
private String tranRule;
|
||||
|
||||
/**
|
||||
* evt的事件类别 "1"、"2"
|
||||
*/
|
||||
private String eventType;
|
||||
|
||||
/**
|
||||
* sts、di的是否存储 1:存储 0:不存储
|
||||
*/
|
||||
private Integer storeFlag;
|
||||
|
||||
/**
|
||||
* sts、do的当前值
|
||||
*/
|
||||
private Integer curSts;
|
||||
|
||||
/**
|
||||
* do的是否可远程控制 1:是 0:否
|
||||
*/
|
||||
private Integer ctlSts;
|
||||
|
||||
/**
|
||||
* 设置最大值
|
||||
*/
|
||||
private BigDecimal maxNum;
|
||||
|
||||
/**
|
||||
* 设置最小值
|
||||
*/
|
||||
private BigDecimal minNum;
|
||||
|
||||
/**
|
||||
* 参数为enum可设置的所有值序列
|
||||
*/
|
||||
private String setValue;
|
||||
|
||||
/**
|
||||
* 参数string可设置字符串的长度上限
|
||||
*/
|
||||
private Integer strlen;
|
||||
|
||||
/**
|
||||
* 参数缺省值、告警code值
|
||||
*/
|
||||
private String defaultValue;
|
||||
|
||||
/**
|
||||
* 报表数据来源(统计表表名)
|
||||
*/
|
||||
private String resourcesId;
|
||||
|
||||
/**
|
||||
* 限值字段名称
|
||||
*/
|
||||
private String limitName;
|
||||
|
||||
/**
|
||||
* 限值表名
|
||||
*/
|
||||
private String limitTable;
|
||||
|
||||
/**
|
||||
* 超标判断方式
|
||||
*/
|
||||
private String formula;
|
||||
|
||||
/**
|
||||
* 二次值转一次值公式
|
||||
*/
|
||||
private String primaryFormula;
|
||||
|
||||
/**
|
||||
* 状态:0-删除 1-正常
|
||||
*/
|
||||
private Integer state;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.njcn.gather.system.dictionary.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.gather.system.dictionary.pojo.param.DictPqParam;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictPq;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IDictPqService extends IService<DictPq> {
|
||||
/**
|
||||
* 分页查询电能质量指标字典列表
|
||||
* @param queryParam 查询参数
|
||||
* @return 电能质量指标字典分页列表
|
||||
*/
|
||||
Page<DictPq> listDictPqs(DictPqParam.DictPqQueryParam queryParam);
|
||||
|
||||
/**
|
||||
* 新增电能质量指标字典
|
||||
* @param dictPqParam 电能质量指标字典类型
|
||||
* @return 操作结果
|
||||
*/
|
||||
boolean addDictPq(DictPqParam dictPqParam);
|
||||
|
||||
/**
|
||||
* 修改电能质量指标字典
|
||||
* @param updateParam 电能质量指标字典类型
|
||||
* @return 操作结果
|
||||
*/
|
||||
boolean updateDictPq(DictPqParam.DictPqUpdateParam updateParam);
|
||||
|
||||
/**
|
||||
* 删除电能质量指标字典
|
||||
* @param ids id集合
|
||||
* @return 操作结果
|
||||
*/
|
||||
boolean deleteDictPq(List<String> ids);
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.gather.system.dictionary.pojo.param.DictTypeParam;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictType;
|
||||
import com.njcn.web.pojo.dto.SimpleTreeDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -44,6 +43,9 @@ public interface IDictTypeService extends IService<DictType> {
|
||||
*/
|
||||
boolean deleteDictType(List<String> ids);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 导出字典类型数据
|
||||
* @param queryParam 查询参数
|
||||
*/
|
||||
public void exportDictType(DictTypeParam.DictTypeQueryParam queryParam);
|
||||
}
|
||||
|
||||
@@ -9,16 +9,18 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.ExcelUtil;
|
||||
import com.njcn.db.mybatisplus.constant.DbConstant;
|
||||
import com.njcn.gather.system.dictionary.mapper.DictTypeMapper;
|
||||
import com.njcn.gather.system.pojo.enums.SystemResponseEnum;
|
||||
import com.njcn.gather.system.dictionary.pojo.param.DictTypeParam;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictType;
|
||||
import com.njcn.gather.system.dictionary.service.IDictTypeService;
|
||||
import com.njcn.gather.system.pojo.enums.SystemResponseEnum;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -73,6 +75,12 @@ public class DictTypeServiceImpl extends ServiceImpl<DictTypeMapper, DictType> i
|
||||
.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportDictType(DictTypeParam.DictTypeQueryParam queryParam) {
|
||||
List<DictType> dictTypes=this.listDictTypes(queryParam).getRecords();
|
||||
ExcelUtil.exportExcel("字典类型导出数据.xls", "字典类型", DictType.class, dictTypes);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验参数,检查是否存在相同名称的字典类型
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
package com.njcn.gather.system.dictionary.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.db.mybatisplus.constant.DbConstant;
|
||||
import com.njcn.gather.system.dictionary.mapper.DictPqMapper;
|
||||
import com.njcn.gather.system.dictionary.pojo.param.DictPqParam;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictPq;
|
||||
import com.njcn.gather.system.dictionary.service.IDictPqService;
|
||||
import com.njcn.gather.system.pojo.enums.SystemResponseEnum;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class IDictPqServiceImpl extends ServiceImpl<DictPqMapper, DictPq> implements IDictPqService {
|
||||
|
||||
@Override
|
||||
public Page<DictPq> listDictPqs(DictPqParam.DictPqQueryParam queryParam) {
|
||||
QueryWrapper<DictPq> queryWrapper = new QueryWrapper<>();
|
||||
if (ObjectUtil.isNotNull(queryParam)) {
|
||||
queryWrapper.like(StrUtil.isNotBlank(queryParam.getName()), "sys_dict_pq.name", queryParam.getName())
|
||||
.like(StrUtil.isNotBlank(queryParam.getOtherName()), "sys_dict_pq.orther_name", queryParam.getOtherName())
|
||||
.like(StrUtil.isNotBlank(queryParam.getShowName()), "sys_dict_pq.show_name", queryParam.getShowName())
|
||||
.eq(StrUtil.isNotBlank(queryParam.getDataType()), "sys_dict_pq.data_type", queryParam.getDataType())
|
||||
.eq(StrUtil.isNotBlank(queryParam.getClassId()), "sys_dict_pq.class_id", queryParam.getClassId());
|
||||
//排序
|
||||
if (ObjectUtil.isAllNotEmpty(queryParam.getSortBy(), queryParam.getOrderBy())) {
|
||||
queryWrapper.orderBy(true, queryParam.getOrderBy().equals(DbConstant.ASC), StrUtil.toUnderlineCase(queryParam.getSortBy()));
|
||||
} else {
|
||||
//没有排序参数,默认根据sort字段排序,没有排序字段的,根据updateTime更新时间排序
|
||||
queryWrapper.orderBy(true, true, "sys_dict_pq.sort");
|
||||
}
|
||||
}
|
||||
queryWrapper.ne("sys_dict_pq.state", DataStateEnum.DELETED.getCode());
|
||||
return this.baseMapper.selectPage(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addDictPq(DictPqParam dictPqParam) {
|
||||
checkDicPqName(dictPqParam, false);
|
||||
DictPq dictPq = new DictPq();
|
||||
BeanUtil.copyProperties(dictPqParam, dictPq);
|
||||
//默认为正常状态
|
||||
dictPq.setState(DataStateEnum.ENABLE.getCode());
|
||||
System.out.println(dictPq.toString());
|
||||
return this.save(dictPq);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateDictPq(DictPqParam.DictPqUpdateParam updateParam) {
|
||||
checkDicPqName(updateParam, true);
|
||||
DictPq dictPq = new DictPq();
|
||||
BeanUtil.copyProperties(updateParam, dictPq);
|
||||
return this.updateById(dictPq);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteDictPq(List<String> ids) {
|
||||
return this.lambdaUpdate()
|
||||
.set(DictPq::getState, DataStateEnum.DELETED.getCode())
|
||||
.in(DictPq::getId, ids)
|
||||
.update();
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验参数,检查同一数据存储及相别下是否存在相同名称的字典项
|
||||
*
|
||||
* @param dictPqParam 字典项参数
|
||||
* @param isExcludeSelf 是否排除自己
|
||||
*/
|
||||
private void checkDicPqName(DictPqParam dictPqParam, boolean isExcludeSelf) {
|
||||
LambdaQueryWrapper<DictPq> dictPqLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
dictPqLambdaQueryWrapper
|
||||
.eq(StrUtil.isNotBlank(dictPqParam.getClassId()), DictPq::getClassId, dictPqParam.getClassId())
|
||||
.eq(StrUtil.isNotBlank(dictPqParam.getName()), DictPq::getName, dictPqParam.getName())
|
||||
.eq(StrUtil.isNotBlank(dictPqParam.getPhase()), DictPq::getPhase, dictPqParam.getPhase())
|
||||
.eq(DictPq::getState, DataStateEnum.ENABLE.getCode());
|
||||
//更新的时候,需排除当前记录
|
||||
if (isExcludeSelf) {
|
||||
if (dictPqParam instanceof DictPqParam.DictPqUpdateParam) {
|
||||
dictPqLambdaQueryWrapper.ne(DictPq::getId, ((DictPqParam.DictPqUpdateParam) dictPqParam).getId());
|
||||
}
|
||||
}
|
||||
int countByAccount = this.count(dictPqLambdaQueryWrapper);
|
||||
//大于等于1个则表示重复
|
||||
if (countByAccount >= 1) {
|
||||
throw new BusinessException(SystemResponseEnum.DICT_PQ_NAME_EXIST);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ package com.njcn.gather.system.pojo.constant;
|
||||
public interface SystemValidMessage {
|
||||
|
||||
|
||||
String MISS_PREFIX="字段不能为空,请检查";
|
||||
String MISS_PREFIX = "字段不能为空,请检查";
|
||||
|
||||
|
||||
String ID_NOT_BLANK = "id不能为空,请检查id参数";
|
||||
@@ -69,4 +69,9 @@ public interface SystemValidMessage {
|
||||
|
||||
String DEVICE_VERSION_NOT_BLANK = "装置版本json文件不能为空,请检查deviceVersionFile参数";
|
||||
|
||||
String PHASE_NOT_BLANK = "相别不能为空,请检查phase参数";
|
||||
|
||||
String DATA_TYPE_NOT_BLANK = "数据模型不能为空,请检查dataType参数";
|
||||
|
||||
String CLASS_ID_NOT_BLANK = "数据表表名不能为空,请检查classId参数";
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ public enum SystemResponseEnum {
|
||||
TIMER_NOT_EXISTED("A00361", "定时任务执行类不存在"),
|
||||
EXE_EMPTY_PARAM("A00361", "请检查定时器的id,定时器cron表达式,定时任务是否为空!"),
|
||||
|
||||
DICT_PQ_NAME_EXIST("", "当前数据存储及相别下已存在相同名称"),
|
||||
/**
|
||||
* 审计日志模块异常响应
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user