Merge branch 'whq'
This commit is contained in:
commit
dd7769e216
|
@ -56,5 +56,8 @@ public interface CommonConstant {
|
|||
* 系统管理模块 application name
|
||||
*/
|
||||
String KN_SYSTEM_MANAGER_MODULE_NAME = "system-manager";
|
||||
String KN_VORDM_SETTING = "kn-setting";
|
||||
/**
|
||||
* 爬虫代理模块 application name
|
||||
*/
|
||||
String VORDM_PROXY_CRAWL_MODULE_NAME = "vordm-crawl";
|
||||
}
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>kn-service-api</artifactId>
|
||||
<groupId>com.kening.platform</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>kn-setting-api</artifactId>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.kening.platform</groupId>
|
||||
<artifactId>kn-common</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -1,133 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the dreamlu.net developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: Chill 庄骞 (smallchill@163.com)
|
||||
*/
|
||||
package com.kening.setting.cache;
|
||||
|
||||
import com.kening.setting.entity.DictBiz;
|
||||
import com.kening.setting.enums.DictBizEnum;
|
||||
import com.kening.setting.feign.IDictBizClient;
|
||||
import org.springblade.core.cache.utils.CacheUtil;
|
||||
import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.SpringUtil;
|
||||
import org.springblade.core.tool.utils.StringPool;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.springblade.core.cache.constant.CacheConstant.DICT_CACHE;
|
||||
|
||||
/**
|
||||
* 业务字典缓存工具类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public class DictBizCache {
|
||||
|
||||
private static final String DICT_ID = "dictBiz:id";
|
||||
private static final String DICT_VALUE = "dictBiz:value";
|
||||
private static final String DICT_LIST = "dictBiz:list";
|
||||
|
||||
private static IDictBizClient dictClient;
|
||||
|
||||
private static IDictBizClient getDictClient() {
|
||||
if (dictClient == null) {
|
||||
dictClient = SpringUtil.getBean(IDictBizClient.class);
|
||||
}
|
||||
return dictClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典实体
|
||||
*
|
||||
* @param id 主键
|
||||
* @return DictBiz
|
||||
*/
|
||||
public static DictBiz getById(Long id) {
|
||||
String keyPrefix = DICT_ID.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON);
|
||||
return CacheUtil.get(DICT_CACHE, keyPrefix, id, () -> {
|
||||
R<DictBiz> result = getDictClient().getById(id);
|
||||
return result.getData();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典值
|
||||
*
|
||||
* @param code 字典编号枚举
|
||||
* @param dictKey Integer型字典键
|
||||
* @return String
|
||||
*/
|
||||
public static String getValue(DictBizEnum code, Integer dictKey) {
|
||||
return getValue(code.getName(), dictKey);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取字典值
|
||||
*
|
||||
* @param code 字典编号
|
||||
* @param dictKey Integer型字典键
|
||||
* @return String
|
||||
*/
|
||||
public static String getValue(String code, Integer dictKey) {
|
||||
String keyPrefix = DICT_VALUE.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON);
|
||||
return CacheUtil.get(DICT_CACHE, keyPrefix + code + StringPool.COLON, String.valueOf(dictKey), () -> {
|
||||
R<String> result = getDictClient().getValue(code, String.valueOf(dictKey));
|
||||
return result.getData();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典值
|
||||
*
|
||||
* @param code 字典编号枚举
|
||||
* @param dictKey String型字典键
|
||||
* @return String
|
||||
*/
|
||||
public static String getValue(DictBizEnum code, String dictKey) {
|
||||
return getValue(code.getName(), dictKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典值
|
||||
*
|
||||
* @param code 字典编号
|
||||
* @param dictKey String型字典键
|
||||
* @return String
|
||||
*/
|
||||
public static String getValue(String code, String dictKey) {
|
||||
String keyPrefix = DICT_VALUE.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON);
|
||||
return CacheUtil.get(DICT_CACHE, keyPrefix + code + StringPool.COLON, dictKey, () -> {
|
||||
R<String> result = getDictClient().getValue(code, dictKey);
|
||||
return result.getData();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典集合
|
||||
*
|
||||
* @param code 字典编号
|
||||
* @return List<DictBiz>
|
||||
*/
|
||||
public static List<DictBiz> getList(String code) {
|
||||
String keyPrefix = DICT_LIST.concat(StringPool.DASH).concat(AuthUtil.getTenantId()).concat(StringPool.COLON);
|
||||
return CacheUtil.get(DICT_CACHE, keyPrefix, code, () -> {
|
||||
R<List<DictBiz>> result = getDictClient().getList(code);
|
||||
return result.getData();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
|
@ -1,109 +0,0 @@
|
|||
package com.kening.setting.entity;
|
||||
|
||||
/*
|
||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the dreamlu.net developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: Chill 庄骞 (smallchill@163.com)
|
||||
*/
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 实体类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Data
|
||||
@TableName("blade_dict_biz")
|
||||
@ApiModel(value = "DictBiz对象", description = "DictBiz对象")
|
||||
public class DictBiz implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@ApiModelProperty(value = "主键")
|
||||
@TableId(value = "id", type = IdType.ASSIGN_ID)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 租户ID
|
||||
*/
|
||||
@ApiModelProperty(value = "租户ID")
|
||||
private String tenantId;
|
||||
|
||||
/**
|
||||
* 父主键
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
@ApiModelProperty(value = "父主键")
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 字典码
|
||||
*/
|
||||
@ApiModelProperty(value = "字典码")
|
||||
private String code;
|
||||
|
||||
/**
|
||||
* 字典值
|
||||
*/
|
||||
@ApiModelProperty(value = "字典值")
|
||||
private String dictKey;
|
||||
|
||||
/**
|
||||
* 字典名称
|
||||
*/
|
||||
@ApiModelProperty(value = "字典名称")
|
||||
private String dictValue;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 字典备注
|
||||
*/
|
||||
@ApiModelProperty(value = "字典备注")
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 是否已封存
|
||||
*/
|
||||
@ApiModelProperty(value = "是否已封存")
|
||||
private Integer isSealed;
|
||||
|
||||
/**
|
||||
* 是否已删除
|
||||
*/
|
||||
@TableLogic
|
||||
@ApiModelProperty(value = "是否已删除")
|
||||
private Integer isDeleted;
|
||||
|
||||
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the dreamlu.net developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: Chill 庄骞 (smallchill@163.com)
|
||||
*/
|
||||
package com.kening.setting.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 业务字典枚举类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum DictBizEnum {
|
||||
|
||||
/**
|
||||
* 测试
|
||||
*/
|
||||
TEST("test"),
|
||||
;
|
||||
|
||||
final String name;
|
||||
|
||||
}
|
|
@ -1,72 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the dreamlu.net developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: Chill 庄骞 (smallchill@163.com)
|
||||
*/
|
||||
package com.kening.setting.feign;
|
||||
|
||||
|
||||
import com.kening.setting.entity.DictBiz;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Feign接口类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@FeignClient(
|
||||
value = "kn-system-biz-dict",
|
||||
fallback = com.kening.setting.feign.IDictBizClientFallback.class
|
||||
)
|
||||
public interface IDictBizClient {
|
||||
|
||||
String API_PREFIX = "/client";
|
||||
String GET_BY_ID = API_PREFIX + "/dict-biz/get-by-id";
|
||||
String GET_VALUE = API_PREFIX + "/dict-biz/get-value";
|
||||
String GET_LIST = API_PREFIX + "/dict-biz/get-list";
|
||||
|
||||
/**
|
||||
* 获取字典实体
|
||||
*
|
||||
* @param id 主键
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(GET_BY_ID)
|
||||
R<DictBiz> getById(@RequestParam("id") Long id);
|
||||
|
||||
/**
|
||||
* 获取字典表对应值
|
||||
*
|
||||
* @param code 字典编号
|
||||
* @param dictKey 字典序号
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(GET_VALUE)
|
||||
R<String> getValue(@RequestParam("code") String code, @RequestParam("dictKey") String dictKey);
|
||||
|
||||
/**
|
||||
* 获取字典表
|
||||
*
|
||||
* @param code 字典编号
|
||||
* @return
|
||||
*/
|
||||
@GetMapping(GET_LIST)
|
||||
R<List<DictBiz>> getList(@RequestParam("code") String code);
|
||||
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the dreamlu.net developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: Chill 庄骞 (smallchill@163.com)
|
||||
*/
|
||||
package com.kening.setting.feign;
|
||||
|
||||
import com.kening.setting.entity.DictBiz;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Feign失败配置
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Component
|
||||
public class IDictBizClientFallback implements IDictBizClient {
|
||||
@Override
|
||||
public R<DictBiz> getById(Long id) {
|
||||
return R.fail("获取数据失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<String> getValue(String code, String dictKey) {
|
||||
return R.fail("获取数据失败");
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<List<DictBiz>> getList(String code) {
|
||||
return R.fail("获取数据失败");
|
||||
}
|
||||
}
|
|
@ -1,71 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the dreamlu.net developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: Chill 庄骞 (smallchill@163.com)
|
||||
*/
|
||||
package com.kening.setting.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||
import com.kening.setting.entity.DictBiz;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springblade.core.tool.node.INode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 视图实体类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ApiModel(value = "DictBizVO对象", description = "DictBizVO对象")
|
||||
public class DictBizVO extends DictBiz implements INode<DictBizVO> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 父节点ID
|
||||
*/
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long parentId;
|
||||
|
||||
/**
|
||||
* 子孙节点
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
private List<DictBizVO> children;
|
||||
|
||||
@Override
|
||||
public List<DictBizVO> getChildren() {
|
||||
if (this.children == null) {
|
||||
this.children = new ArrayList<>();
|
||||
}
|
||||
return this.children;
|
||||
}
|
||||
|
||||
/**
|
||||
* 上级字典
|
||||
*/
|
||||
private String parentName;
|
||||
}
|
|
@ -14,7 +14,6 @@
|
|||
<version>${revision}</version>
|
||||
<modules>
|
||||
<module>biz-vordm-api</module>
|
||||
<module>kn-setting-api</module>
|
||||
</modules>
|
||||
<packaging>pom</packaging>
|
||||
<description>微服务API集合</description>
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
FROM bladex/alpine-java:openjdk8-openj9_cn_slim
|
||||
|
||||
LABEL maintainer=whq<460794335@qq.com>
|
||||
|
||||
RUN mkdir -p /kn/vordm
|
||||
|
||||
WORKDIR /kn/vordm
|
||||
|
||||
EXPOSE 8282
|
||||
|
||||
ADD ./target/biz-vordm.jar ./app.jar
|
||||
|
||||
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]
|
||||
|
||||
CMD ["--spring.profiles.active=test"]
|
|
@ -17,6 +17,87 @@
|
|||
<artifactId>biz-vordm-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hdrhistogram</groupId>
|
||||
<artifactId>HdrHistogram</artifactId>
|
||||
<version>2.1.12</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.javassist</groupId>
|
||||
<artifactId>javassist</artifactId>
|
||||
<version>3.25.0-GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-core-boot</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.oracle</groupId>
|
||||
<artifactId>ojdbc7</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>HdrHistogram</artifactId>
|
||||
<groupId>org.hdrhistogram</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>javassist</artifactId>
|
||||
<groupId>org.javassist</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.microsoft.sqlserver</groupId>
|
||||
<artifactId>mssql-jdbc</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<groupId>com.alibaba</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-starter-oss</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>esdk-obs-java</artifactId>
|
||||
<groupId>com.huaweicloud</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.minio</groupId>
|
||||
<artifactId>minio</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-mock</artifactId>
|
||||
<version>2.0.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-starter-swagger</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-starter-tenant</artifactId>
|
||||
</dependency>
|
||||
<!--邮件发送依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-mail</artifactId>
|
||||
</dependency>
|
||||
<!--thymeleaf-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>kn-service</artifactId>
|
||||
<groupId>com.kening.platform</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>kn-setting</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.kening.platform</groupId>
|
||||
<artifactId>kn-setting-api</artifactId>
|
||||
<version>${revision}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
package com.kening.setting;
|
||||
|
||||
import org.springblade.common.constant.CommonConstant;
|
||||
import org.springblade.core.launch.BladeApplication;
|
||||
import org.springframework.cloud.client.SpringCloudApplication;
|
||||
|
||||
/**
|
||||
* @author wanghongqing
|
||||
* @date 2023/3/21 14:24
|
||||
**/
|
||||
@SpringCloudApplication
|
||||
public class SettingApplication {
|
||||
public static void main(String[] args) {
|
||||
BladeApplication.run(CommonConstant.KN_VORDM_SETTING, SettingApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -1,15 +0,0 @@
|
|||
package com.kening.setting.config;
|
||||
|
||||
import org.mybatis.spring.annotation.MapperScan;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author wanghongqing
|
||||
* @date 2023/3/21 14:32
|
||||
**/
|
||||
@Configuration
|
||||
@ComponentScan({"org.springblade", "com.kening.setting"})
|
||||
@MapperScan({"org.springblade.**.mapper.**", "com.kening.**.mapper.**"})
|
||||
public class VoRdmConfig {
|
||||
}
|
|
@ -1,179 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the dreamlu.net developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: Chill 庄骞 (smallchill@163.com)
|
||||
*/
|
||||
package com.kening.setting.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import com.kening.setting.entity.DictBiz;
|
||||
import com.kening.setting.service.IDictBizService;
|
||||
import com.kening.setting.vo.DictBizVO;
|
||||
import com.kening.setting.wrapper.DictBizWrapper;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.boot.ctrl.BladeController;
|
||||
import org.springblade.core.cache.utils.CacheUtil;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.tenant.annotation.NonDS;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.springblade.core.cache.constant.CacheConstant.DICT_CACHE;
|
||||
|
||||
/**
|
||||
* 控制器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@NonDS
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/dict-biz")
|
||||
@Api(value = "业务字典", tags = "业务字典")
|
||||
public class DictBizController extends BladeController {
|
||||
|
||||
private final IDictBizService dictService;
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@ApiOperation(value = "详情", notes = "传入dict")
|
||||
public R<DictBizVO> detail(DictBiz dict) {
|
||||
DictBiz detail = dictService.getOne(Condition.getQueryWrapper(dict));
|
||||
return R.data(DictBizWrapper.build().entityVO(detail));
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "code", value = "字典编号", paramType = "query", dataType = "string"),
|
||||
@ApiImplicitParam(name = "dictValue", value = "字典名称", paramType = "query", dataType = "string")
|
||||
})
|
||||
@ApiOperationSupport(order = 2)
|
||||
@ApiOperation(value = "列表", notes = "传入dict")
|
||||
public R<List<DictBizVO>> list(@ApiIgnore @RequestParam Map<String, Object> dict) {
|
||||
List<DictBiz> list = dictService.list(Condition.getQueryWrapper(dict, DictBiz.class).lambda().orderByAsc(DictBiz::getSort));
|
||||
return R.data(DictBizWrapper.build().listNodeVO(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 顶级列表
|
||||
*/
|
||||
@GetMapping("/parent-list")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "code", value = "字典编号", paramType = "query", dataType = "string"),
|
||||
@ApiImplicitParam(name = "dictValue", value = "字典名称", paramType = "query", dataType = "string")
|
||||
})
|
||||
@ApiOperationSupport(order = 3)
|
||||
@ApiOperation(value = "列表", notes = "传入dict")
|
||||
public R<IPage<DictBizVO>> parentList(@ApiIgnore @RequestParam Map<String, Object> dict, Query query) {
|
||||
return R.data(dictService.parentList(dict, query));
|
||||
}
|
||||
|
||||
/**
|
||||
* 子列表
|
||||
*/
|
||||
@GetMapping("/child-list")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "code", value = "字典编号", paramType = "query", dataType = "string"),
|
||||
@ApiImplicitParam(name = "dictValue", value = "字典名称", paramType = "query", dataType = "string"),
|
||||
@ApiImplicitParam(name = "parentId", value = "字典名称", paramType = "query", dataType = "string")
|
||||
})
|
||||
@ApiOperationSupport(order = 4)
|
||||
@ApiOperation(value = "列表", notes = "传入dict")
|
||||
public R<List<DictBizVO>> childList(@ApiIgnore @RequestParam Map<String, Object> dict, @RequestParam(required = false, defaultValue = "-1") Long parentId) {
|
||||
return R.data(dictService.childList(dict, parentId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典树形结构
|
||||
*/
|
||||
@GetMapping("/tree")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@ApiOperation(value = "树形结构", notes = "树形结构")
|
||||
public R<List<DictBizVO>> tree() {
|
||||
List<DictBizVO> tree = dictService.tree();
|
||||
return R.data(tree);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典树形结构
|
||||
*/
|
||||
@GetMapping("/parent-tree")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@ApiOperation(value = "树形结构", notes = "树形结构")
|
||||
public R<List<DictBizVO>> parentTree() {
|
||||
List<DictBizVO> tree = dictService.parentTree();
|
||||
return R.data(tree);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或修改
|
||||
*/
|
||||
@PostMapping("/submit")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@ApiOperation(value = "新增或修改", notes = "传入dict")
|
||||
public R submit(@Valid @RequestBody DictBiz dict) {
|
||||
CacheUtil.clear(DICT_CACHE);
|
||||
return R.status(dictService.submit(dict));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@ApiOperation(value = "删除", notes = "传入ids")
|
||||
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
|
||||
CacheUtil.clear(DICT_CACHE);
|
||||
return R.status(dictService.removeDict(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典
|
||||
*/
|
||||
@GetMapping("/dictionary")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@ApiOperation(value = "获取字典", notes = "获取字典")
|
||||
public R<List<DictBiz>> dictionary(String code) {
|
||||
List<DictBiz> tree = dictService.getList(code);
|
||||
return R.data(tree);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典树
|
||||
*/
|
||||
@GetMapping("/dictionary-tree")
|
||||
@ApiOperationSupport(order = 9)
|
||||
@ApiOperation(value = "获取字典树", notes = "获取字典树")
|
||||
public R<List<DictBizVO>> dictionaryTree(String code) {
|
||||
List<DictBiz> tree = dictService.getList(code);
|
||||
return R.data(DictBizWrapper.build().listNodeVO(tree));
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the dreamlu.net developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: Chill 庄骞 (smallchill@163.com)
|
||||
*/
|
||||
package com.kening.setting.mapper;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.kening.setting.entity.DictBiz;
|
||||
import com.kening.setting.vo.DictBizVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Mapper 接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface DictBizMapper extends BaseMapper<DictBiz> {
|
||||
|
||||
/**
|
||||
* 获取字典表对应中文
|
||||
*
|
||||
* @param code 字典编号
|
||||
* @param dictKey 字典序号
|
||||
* @return
|
||||
*/
|
||||
String getValue(String code, String dictKey);
|
||||
|
||||
/**
|
||||
* 获取字典表
|
||||
*
|
||||
* @param code 字典编号
|
||||
* @return
|
||||
*/
|
||||
List<DictBiz> getList(String code);
|
||||
|
||||
/**
|
||||
* 获取树形节点
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<DictBizVO> tree();
|
||||
|
||||
/**
|
||||
* 获取树形节点
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<DictBizVO> parentTree();
|
||||
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
<?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.kening.setting.mapper.DictBizMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="dictResultMap" type="com.kening.setting.entity.DictBiz">
|
||||
<id column="id" property="id"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
<result column="parent_id" property="parentId"/>
|
||||
<result column="code" property="code"/>
|
||||
<result column="dict_key" property="dictKey"/>
|
||||
<result column="dict_value" property="dictValue"/>
|
||||
<result column="sort" property="sort"/>
|
||||
<result column="remark" property="remark"/>
|
||||
<result column="is_deleted" property="isDeleted"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="treeNodeResultMap" type="org.springblade.core.tool.node.TreeNode">
|
||||
<id column="id" property="id"/>
|
||||
<result column="parent_id" property="parentId"/>
|
||||
<result column="title" property="title"/>
|
||||
<result column="value" property="value"/>
|
||||
<result column="key" property="key"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getValue" resultType="java.lang.String">
|
||||
select
|
||||
dict_value
|
||||
from blade_dict_biz where code = #{param1} and dict_key = #{param2} and is_deleted = 0
|
||||
</select>
|
||||
|
||||
<!-- oracle 版本 -->
|
||||
<!--<select id="getValue" resultType="java.lang.String">
|
||||
select
|
||||
dict_value
|
||||
from blade_dict_biz where code = #{param1, jdbcType=VARCHAR} and dict_key = #{param2} and dict_key >= 0 rownum 1
|
||||
</select>-->
|
||||
|
||||
<select id="getList" resultMap="dictResultMap">
|
||||
select id, parent_id, code, dict_key, dict_value, sort, remark from blade_dict_biz where code = #{param1} and parent_id > 0 and is_sealed = 0 and is_deleted = 0
|
||||
</select>
|
||||
|
||||
<select id="tree" resultMap="treeNodeResultMap">
|
||||
select id, parent_id, dict_value as title, id as "value", id as "key" from blade_dict_biz where is_deleted = 0
|
||||
</select>
|
||||
|
||||
<select id="parentTree" resultMap="treeNodeResultMap">
|
||||
select id, parent_id, dict_value as title, id as "value", id as "key" from blade_dict_biz where is_deleted = 0 and parent_id = 0
|
||||
</select>
|
||||
|
||||
</mapper>
|
|
@ -1,101 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the dreamlu.net developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: Chill 庄骞 (smallchill@163.com)
|
||||
*/
|
||||
package com.kening.setting.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.kening.setting.entity.DictBiz;
|
||||
import com.kening.setting.vo.DictBizVO;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 服务类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface IDictBizService extends IService<DictBiz> {
|
||||
|
||||
/**
|
||||
* 树形结构
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<DictBizVO> tree();
|
||||
|
||||
/**
|
||||
* 树形结构
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<DictBizVO> parentTree();
|
||||
|
||||
/**
|
||||
* 获取字典表对应中文
|
||||
*
|
||||
* @param code 字典编号
|
||||
* @param dictKey 字典序号
|
||||
* @return
|
||||
*/
|
||||
String getValue(String code, String dictKey);
|
||||
|
||||
/**
|
||||
* 获取字典表
|
||||
*
|
||||
* @param code 字典编号
|
||||
* @return
|
||||
*/
|
||||
List<DictBiz> getList(String code);
|
||||
|
||||
/**
|
||||
* 新增或修改
|
||||
*
|
||||
* @param dict
|
||||
* @return
|
||||
*/
|
||||
boolean submit(DictBiz dict);
|
||||
|
||||
/**
|
||||
* 删除字典
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
boolean removeDict(String ids);
|
||||
|
||||
/**
|
||||
* 顶级列表
|
||||
*
|
||||
* @param dict
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
IPage<DictBizVO> parentList(Map<String, Object> dict, Query query);
|
||||
|
||||
/**
|
||||
* 子列表
|
||||
*
|
||||
* @param dict
|
||||
* @param parentId
|
||||
* @return
|
||||
*/
|
||||
List<DictBizVO> childList(Map<String, Object> dict, Long parentId);
|
||||
|
||||
}
|
|
@ -1,121 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the dreamlu.net developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: Chill 庄骞 (smallchill@163.com)
|
||||
*/
|
||||
package com.kening.setting.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.kening.setting.cache.DictBizCache;
|
||||
import com.kening.setting.entity.DictBiz;
|
||||
import com.kening.setting.mapper.DictBizMapper;
|
||||
import com.kening.setting.service.IDictBizService;
|
||||
import com.kening.setting.vo.DictBizVO;
|
||||
import com.kening.setting.wrapper.DictBizWrapper;
|
||||
import org.springblade.common.constant.CommonConstant;
|
||||
import org.springblade.core.cache.utils.CacheUtil;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.tool.constant.BladeConstant;
|
||||
import org.springblade.core.tool.node.ForestNodeMerger;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.core.tool.utils.StringPool;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.springblade.core.cache.constant.CacheConstant.DICT_CACHE;
|
||||
|
||||
/**
|
||||
* 服务实现类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Service
|
||||
public class DictBizServiceImpl extends ServiceImpl<DictBizMapper, DictBiz> implements IDictBizService {
|
||||
|
||||
@Override
|
||||
public List<DictBizVO> tree() {
|
||||
return ForestNodeMerger.merge(baseMapper.tree());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictBizVO> parentTree() {
|
||||
return ForestNodeMerger.merge(baseMapper.parentTree());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValue(String code, String dictKey) {
|
||||
return Func.toStr(baseMapper.getValue(code, dictKey), StringPool.EMPTY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictBiz> getList(String code) {
|
||||
return baseMapper.getList(code);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean submit(DictBiz dict) {
|
||||
LambdaQueryWrapper<DictBiz> lqw = Wrappers.<DictBiz>query().lambda().eq(DictBiz::getCode, dict.getCode()).eq(DictBiz::getDictKey, dict.getDictKey());
|
||||
Integer cnt = baseMapper.selectCount((Func.isEmpty(dict.getId())) ? lqw : lqw.notIn(DictBiz::getId, dict.getId()));
|
||||
if (cnt > 0) {
|
||||
throw new ServiceException("当前字典键值已存在!");
|
||||
}
|
||||
// 修改顶级字典后同步更新下属字典的编号
|
||||
if (Func.isNotEmpty(dict.getId()) && dict.getParentId().longValue() == BladeConstant.TOP_PARENT_ID) {
|
||||
DictBiz parent = DictBizCache.getById(dict.getId());
|
||||
this.update(Wrappers.<DictBiz>update().lambda().set(DictBiz::getCode, dict.getCode()).eq(DictBiz::getCode, parent.getCode()).ne(DictBiz::getParentId, BladeConstant.TOP_PARENT_ID));
|
||||
}
|
||||
if (Func.isEmpty(dict.getParentId())) {
|
||||
dict.setParentId(BladeConstant.TOP_PARENT_ID);
|
||||
}
|
||||
dict.setIsDeleted(BladeConstant.DB_NOT_DELETED);
|
||||
CacheUtil.clear(DICT_CACHE);
|
||||
return saveOrUpdate(dict);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeDict(String ids) {
|
||||
Integer cnt = baseMapper.selectCount(Wrappers.<DictBiz>query().lambda().in(DictBiz::getParentId, Func.toLongList(ids)));
|
||||
if (cnt > 0) {
|
||||
throw new ServiceException("请先删除子节点!");
|
||||
}
|
||||
return removeByIds(Func.toLongList(ids));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<DictBizVO> parentList(Map<String, Object> dict, Query query) {
|
||||
IPage<DictBiz> page = this.page(Condition.getPage(query), Condition.getQueryWrapper(dict, DictBiz.class).lambda().eq(DictBiz::getParentId, CommonConstant.TOP_PARENT_ID).orderByAsc(DictBiz::getSort));
|
||||
return DictBizWrapper.build().pageVO(page);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DictBizVO> childList(Map<String, Object> dict, Long parentId) {
|
||||
if (parentId < 0) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
dict.remove("parentId");
|
||||
DictBiz parentDict = DictBizCache.getById(parentId);
|
||||
List<DictBiz> list = this.list(Condition.getQueryWrapper(dict, DictBiz.class).lambda().ne(DictBiz::getId, parentId).eq(DictBiz::getCode, parentDict.getCode()).orderByAsc(DictBiz::getSort));
|
||||
return DictBizWrapper.build().listNodeVO(list);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the dreamlu.net developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: Chill 庄骞 (smallchill@163.com)
|
||||
*/
|
||||
package com.kening.setting.wrapper;
|
||||
|
||||
import com.kening.setting.cache.DictBizCache;
|
||||
import com.kening.setting.entity.DictBiz;
|
||||
import com.kening.setting.vo.DictBizVO;
|
||||
import org.springblade.core.mp.support.BaseEntityWrapper;
|
||||
import org.springblade.core.tool.constant.BladeConstant;
|
||||
import org.springblade.core.tool.node.ForestNodeMerger;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* 包装类,返回视图层所需的字段
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public class DictBizWrapper extends BaseEntityWrapper<DictBiz, DictBizVO> {
|
||||
|
||||
public static DictBizWrapper build() {
|
||||
return new DictBizWrapper();
|
||||
}
|
||||
|
||||
@Override
|
||||
public DictBizVO entityVO(DictBiz dict) {
|
||||
DictBizVO dictVO = Objects.requireNonNull(BeanUtil.copy(dict, DictBizVO.class));
|
||||
if (Func.equals(dict.getParentId(), BladeConstant.TOP_PARENT_ID)) {
|
||||
dictVO.setParentName(BladeConstant.TOP_PARENT_NAME);
|
||||
} else {
|
||||
DictBiz parent = DictBizCache.getById(dict.getParentId());
|
||||
dictVO.setParentName(parent.getDictValue());
|
||||
}
|
||||
return dictVO;
|
||||
}
|
||||
|
||||
public List<DictBizVO> listNodeVO(List<DictBiz> list) {
|
||||
List<DictBizVO> collect = list.stream().map(dict -> BeanUtil.copy(dict, DictBizVO.class)).collect(Collectors.toList());
|
||||
return ForestNodeMerger.merge(collect);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
spring:
|
||||
datasource:
|
||||
url: ${kn.datasource.vordm.url}
|
||||
username: ${kn.datasource.vordm.username}
|
||||
password: ${kn.datasource.vordm.password}
|
|
@ -1,5 +0,0 @@
|
|||
spring:
|
||||
datasource:
|
||||
url: ${kn.datasource.vordm.url}
|
||||
username: ${kn.datasource.vordm.username}
|
||||
password: ${kn.datasource.vordm.password}
|
|
@ -1,5 +0,0 @@
|
|||
spring:
|
||||
datasource:
|
||||
url: ${kn.datasource.vordm.url}
|
||||
username: ${kn.datasource.vordm.username}
|
||||
password: ${kn.datasource.vordm.password}
|
|
@ -1,13 +0,0 @@
|
|||
server:
|
||||
port: 8106
|
||||
|
||||
#mybatis-plus配置
|
||||
mybatis-plus:
|
||||
mapper-locations: classpath:com/kening/**/mapper/*Mapper.xml
|
||||
#实体扫描,多个package用逗号或者分号分隔
|
||||
typeAliasesPackage: com.kening.**.entity
|
||||
|
||||
#swagger扫描路径配置
|
||||
swagger:
|
||||
base-packages:
|
||||
- com.kening.setting
|
|
@ -5,6 +5,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<modules>
|
||||
<module>biz-vordm</module>
|
||||
<module>vordm-crawl</module>
|
||||
<!-- <module>kn-setting</module>-->
|
||||
</modules>
|
||||
|
||||
|
@ -21,91 +22,10 @@
|
|||
<description>微服务集合</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.hdrhistogram</groupId>
|
||||
<artifactId>HdrHistogram</artifactId>
|
||||
<version>2.1.12</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.javassist</groupId>
|
||||
<artifactId>javassist</artifactId>
|
||||
<version>3.25.0-GA</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.kening.platform</groupId>
|
||||
<artifactId>kn-launcher</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-core-boot</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.oracle</groupId>
|
||||
<artifactId>ojdbc7</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>HdrHistogram</artifactId>
|
||||
<groupId>org.hdrhistogram</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>javassist</artifactId>
|
||||
<groupId>org.javassist</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>com.microsoft.sqlserver</groupId>
|
||||
<artifactId>mssql-jdbc</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<groupId>com.alibaba</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-starter-oss</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>esdk-obs-java</artifactId>
|
||||
<groupId>com.huaweicloud</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.minio</groupId>
|
||||
<artifactId>minio</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-mock</artifactId>
|
||||
<version>2.0.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-starter-swagger</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-starter-tenant</artifactId>
|
||||
</dependency>
|
||||
<!--邮件发送依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-mail</artifactId>
|
||||
</dependency>
|
||||
<!--thymeleaf-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-thymeleaf</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
FROM bladex/alpine-java:openjdk8-openj9_cn_slim
|
||||
|
||||
LABEL maintainer=whq<460794335@qq.com>
|
||||
|
||||
RUN mkdir -p /kn/vordm
|
||||
|
||||
WORKDIR /kn/vordm
|
||||
|
||||
EXPOSE 8989
|
||||
|
||||
ADD ./target/vordm-crawl.jar ./app.jar
|
||||
|
||||
ENTRYPOINT ["java", "-Djava.security.egd=file:/dev/./urandom", "-jar", "app.jar"]
|
||||
|
||||
CMD ["--spring.profiles.active=test"]
|
|
@ -0,0 +1,74 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>kn-service</artifactId>
|
||||
<groupId>com.kening.platform</groupId>
|
||||
<version>${revision}</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>vordm-crawl</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.kening.platform</groupId>
|
||||
<artifactId>kn-launcher</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-undertow</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>wildfly-common</artifactId>
|
||||
<groupId>org.wildfly.common</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.itmuch</groupId>
|
||||
<artifactId>spring-cloud-wii</artifactId>
|
||||
<version>2.2.6.RELEASE</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||
</dependency>
|
||||
<!--Hystrix-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-logging</groupId>
|
||||
<artifactId>commons-logging</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>HdrHistogram</artifactId>
|
||||
<groupId>org.hdrhistogram</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
|
@ -0,0 +1,13 @@
|
|||
package com.kening.crawl;
|
||||
|
||||
import org.springblade.core.launch.BladeApplication;
|
||||
import org.springframework.cloud.client.SpringCloudApplication;
|
||||
import org.springframework.context.annotation.ComponentScan;
|
||||
|
||||
@SpringCloudApplication
|
||||
@ComponentScan({"org.springblade", "com.kening.crawl"})
|
||||
public class CrawlProxyApplication {
|
||||
public static void main(String[] args) {
|
||||
BladeApplication.run("vordm-crawl", CrawlProxyApplication.class, args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
server:
|
||||
port: 8989
|
||||
|
||||
spring:
|
||||
cloud:
|
||||
gateway:
|
||||
discovery:
|
||||
locator:
|
||||
enabled: true
|
||||
loadbalancer:
|
||||
retry:
|
||||
enabled: true
|
Loading…
Reference in New Issue