Commit 01c5c67e by wqc

多数据源、大屏接口对接

parent 1f38df53
......@@ -27,7 +27,8 @@ redis.password:
jdbc.driver-class-name: com.mysql.cj.jdbc.Driver
jdbc.username: root
jdbc.password: Dk2019!23456
jdbc.url: jdbc:mysql://119.45.183.210:13308/visual_modeling_platform?characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8&autoReconnect=true
jdbc.master.url: jdbc:mysql://119.45.183.210:13308/visual_modeling_platform?characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8&autoReconnect=true
jdbc.hjk.url: jdbc:mysql://119.45.183.210:13308/data_collect?characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8&autoReconnect=true
spring:
servlet:
......@@ -66,4 +67,4 @@ task:
# 队列容量
queue-capacity: 20
# 活跃时间
keep-alive-seconds: 30
\ No newline at end of file
keep-alive-seconds: 30
......@@ -27,7 +27,9 @@ redis.password:
jdbc.driver-class-name: com.mysql.cj.jdbc.Driver
jdbc.username: root
jdbc.password: Dk2019!23456
jdbc.url: jdbc:mysql://143.155.2.251:3306/visual_modeling_platform?characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8&autoReconnect=true
jdbc.master.url: jdbc:mysql://143.155.2.251:3306/visual_modeling_platform?characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8&autoReconnect=true
jdbc.hjk.url: jdbc:mysql://143.155.2.251:3306/data_collect?characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8&autoReconnect=true
#jdbc.username: root
#jdbc.password: root
#jdbc.url: jdbc:mysql://127.0.0.1:3306/nnjcy_data_model?characterEncoding=utf8&useSSL=false&serverTimezone=GMT%2B8&autoReconnect=true
......@@ -69,4 +71,4 @@ task:
max-pool-size: 15
# 队列容量
queue-capacity: 20
# 活跃时间
\ No newline at end of file
# 活跃时间
......@@ -28,12 +28,6 @@
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!-- java8 不需要添加,高版本需要添加 -->
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
......@@ -68,6 +62,12 @@
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>${mybatis.plus.version}</version>
</dependency>
<!--Mybatis plus多数据源-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>3.4.0</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
......
......@@ -11,4 +11,4 @@ public class DataCollectApplication {
public static void main(String[] args) {
SpringApplication.run(DataCollectApplication.class, args);
}
}
\ No newline at end of file
}
......@@ -87,6 +87,18 @@ public class BigScreenController {
return ResultVo.success(bigScreenService.getPtcgDetails(type));
}
@ApiOperation("办案成效数据")
@GetMapping(value = "/bacxData")
public ResultVo getBacxData() {
return ResultVo.success(bigScreenService.getBacxData());
}
@ApiOperation("模型应用成效")
@GetMapping(value = "/modelEffect")
public ResultVo getModelEffect(@RequestParam String shiyuan) {
return ResultVo.success(bigScreenService.getModelEffect(shiyuan));
}
@ApiOperation("办案总量")
@GetMapping(value = "/getBazlNums")
public ResultVo getbazlNums() {
......@@ -99,5 +111,19 @@ public class BigScreenController {
return ResultVo.success(bigScreenService.getQbhsajcqwjList());
}
@ApiOperation("模型类型")
@GetMapping(value = "/getProxyType")
public ResultVo getProxyType() {
return ResultVo.success(bigScreenService.getProxyType());
}
@ApiOperation("地区")
@GetMapping(value = "/getCityArea")
public ResultVo getCityArea() {
return ResultVo.success(bigScreenService.getCityArea());
}
}
......@@ -46,10 +46,24 @@ public class DataCollectFileController {
return ResultVo.success(dataCollectFileService.analysisExcel(file));
}
@ApiOperation("导入Excel文件入库")
@PostMapping(value = "/importExcelToDb")
public ResultVo importExcelToDb(MultipartFile file) {
AssertUtils.isTrue(file != null && file.getSize() > 0, "请选择文件");
return ResultVo.success(dataCollectFileService.importExcelToDb(file));
}
@ApiOperation("导入办案成效表")
@PostMapping(value = "/importBacxToDb")
public ResultVo importBacxToDb(MultipartFile file) {
AssertUtils.isTrue(file != null && file.getSize() > 0, "请选择文件");
return ResultVo.success(dataCollectFileService.importBacxToDb(file));
}
@ApiOperation("执行文件汇聚")
@PostMapping(value = "/execute")
public ResultVo executeDb(@RequestParam("dataCollectSettingId") Integer dataCollectSettingId, @RequestParam("collectType") Integer collectType, MultipartFile file) {
dataCollectFileService.execute(dataCollectSettingId, collectType, file);
return ResultVo.success("汇聚执行成功");
}
}
\ No newline at end of file
}
package com.zq.datacollect.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "ajzlzypjzbdy")
@Builder
public class Ajzlzypjzbdy {
/**
* id
*/
@TableId(type = IdType.AUTO)
private Integer id;
/**
* 案
*/
private String cases;
/**
* 件
*/
private String piece;
/**
* 案件比
*/
private String caseRatio;
/**
* 单位
*/
private String unit;
/**
* 案件名称
*/
private String name;
/**
* createTime
*/
@TableField(fill = FieldFill.INSERT)
private Date createTime;
}
package com.zq.datacollect.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "bacx")
@Builder
public class BananChengxiao {
/**
* id
*/
@TableId(type = IdType.AUTO)
private Integer id;
/**
* 线索
*/
private String xiansuo;
/**
* 核查
*/
private String hecha;
/**
* 受理
*/
private String shouli;
/**
* 立案
*/
private String lian;
/**
* 成案
*/
private String chengan;
/**
* 线索转化率
*/
private String xiansuoRate;
/**
* 成案线索转化率
*/
private String chenganRate;
/**
* 挽回国有财产(万元)
*/
private String wanhui;
/**
* 发放救助金额(万元)
*/
private String fafangjiuzhu;
/**
* 推动建章立制数
*/
private String jianzhanglizhi;
/**
* 市院
*/
private String shiyuan;
/**
* createTime
*/
@TableField(fill = FieldFill.INSERT)
private Date createTime;
}
package com.zq.datacollect.entity;
import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName(value = "bacx")
@Builder
public class MoxingLeixing {
/**
* id
*/
@TableId(type = IdType.AUTO)
private Integer id;
/**
* 线索
*/
private String xiansuo;
/**
* 核查
*/
private String hecha;
/**
* 受理
*/
private String shouli;
/**
* 立案
*/
private String lian;
/**
* 成案
*/
private String chengan;
/**
* 线索转化率
*/
private String xiansuoRate;
/**
* 成案线索转化率
*/
private String chenganRate;
/**
* 挽回国有财产(万元)
*/
private String wanhui;
/**
* 发放救助金额(万元)
*/
private String fafangjiuzhu;
/**
* 推动建章立制数
*/
private String jianzhanglizhi;
/**
* 市院
*/
private String shiyuan;
/**
* createTime
*/
@TableField(fill = FieldFill.INSERT)
private Date createTime;
}
package com.zq.datacollect.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.datacollect.entity.Ajzlzypjzbdy;
@DS("hjk")
public interface AjzlzypjzbdyMapper extends BaseMapper<Ajzlzypjzbdy> {
}
package com.zq.datacollect.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.datacollect.entity.Ajzlzypjzbdy;
import com.zq.datacollect.entity.BananChengxiao;
@DS("hjk")
public interface BananChengxiaoMapper extends BaseMapper<BananChengxiao> {
}
......@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.zq.datacollect.entity.DataCollectSetting;
import com.zq.datacollect.entity.QueryDb;
import com.zq.datacollect.holder.DatabaseHolder;
import com.zq.datacollect.mapper.BananChengxiaoMapper;
import com.zq.datacollect.mapper.DataCollectMapper;
import com.zq.datacollect.mapper.QueryDbMapper;
import lombok.RequiredArgsConstructor;
......@@ -28,6 +29,8 @@ public class BigScreenService {
private DataCollectMapper dataCollectMapper;
@Resource
private QueryDbMapper queryDbMapper;
@Resource
private BananChengxiaoMapper bananChengxiaoMapper;
public Object getModelTypeCount() {
......@@ -176,13 +179,15 @@ public class BigScreenService {
public List<String> getYwuList() {
List<String> list = new ArrayList<>();
list.add("公益诉讼检察");
list.add("未成年人检察");
list.add("刑事检察");
list.add("刑事执行");
list.add("刑事执行检察");
list.add("司法工作人员职务犯罪检察");
list.add("民事检察");
list.add("行政检察");
list.add("行政执行");
list.add("公益诉讼检察");
list.add("未成年检察");
list.add("控告申诉检察");
list.add("知识产权检察");
return list;
}
......@@ -272,4 +277,49 @@ public class BigScreenService {
List<Map<String, Object>> mapList = jdbcTemplate.queryForList("SELECT `单位` as dept,`超过1个半月未结` as oneMonth,`超过2个半月未结`as twoMonth,`超过3个半月未结` as threeMonth,`超过6个半月未结` as sixMonth,`超过1年未结` as oneYear,`合计` as total FROM qbajcqwj");
return mapList;
}
public Object getBacxData() {
List<DataCollectSetting> collectList = getCollectList();
Integer toDbId = null;
for (DataCollectSetting list : collectList) {
toDbId = list.getToDbId();
}
JdbcTemplate jdbcTemplate = DatabaseHolder.getJdbcTemplate(toDbId);
List<Map<String, Object>> objects = jdbcTemplate.queryForList("SELECT t.`南宁` as shiyuan,t.`线索条` as xiansuo,t.`核查条` as hecha,t.`成案件` as chengan,t.`成案件` as shouli,t.`成案件` as lian,t.`成案线索转化率` as chengan_rate,t.`线索转化率` as xiansuo_rate,t.`挽回损失万` as wanhui,t.`发放救助金万` as fafangjiuzhu,t.`推动建章立制` as jianzhanglizhi FROM bananchengxiao t ");
return objects;
}
public Object getModelEffect(String shiyuan) {
List<DataCollectSetting> collectList = getCollectList();
Integer toDbId = null;
for (DataCollectSetting list : collectList) {
toDbId = list.getToDbId();
}
JdbcTemplate jdbcTemplate = DatabaseHolder.getJdbcTemplate(toDbId);
List<Map<String, Object>> objects = jdbcTemplate.queryForList("SELECT t.`模型类型` as moxing,t.`线索` as xiansuo,t.`核查` as hecha,t.`成案` as chengan,t.`线索转化率` as xiansuoRate,t.`挽回损失万` as wanhui,t.`发放救助金万` as fafangjiuzhu,t.`推动建章立制` as jianzhanglizhi FROM moxingleixing t WHERE t.`市院` like CONCAT('%','" + shiyuan + "','%')");
return objects;
}
public Object getProxyType() {
List<DataCollectSetting> collectList = getCollectList();
Integer toDbId = null;
for (DataCollectSetting list : collectList) {
toDbId = list.getToDbId();
}
JdbcTemplate jdbcTemplate = DatabaseHolder.getJdbcTemplate(toDbId);
List<Map<String, Object>> objects = jdbcTemplate.queryForList("SELECT t.caseratio FROM proxy_type t");
return objects;
}
public Object getCityArea() {
List<DataCollectSetting> collectList = getCollectList();
Integer toDbId = null;
for (DataCollectSetting list : collectList) {
toDbId = list.getToDbId();
}
JdbcTemplate jdbcTemplate = DatabaseHolder.getJdbcTemplate(toDbId);
List<Map<String, Object>> cityArea = jdbcTemplate.queryForList("SELECT id,diqu FROM city_area");
return cityArea;
}
}
......@@ -18,4 +18,8 @@ public interface DataCollectFileService {
Map<String, Object> analysisExcel(MultipartFile multipartFile);
void execute(Integer dataCollectSettingId, Integer collectType, MultipartFile file);
}
\ No newline at end of file
Object importExcelToDb(MultipartFile file);
Object importBacxToDb(MultipartFile file);
}
package com.zq.datacollect.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.poi.excel.ExcelReader;
import cn.hutool.poi.excel.ExcelUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zq.common.exception.BusinessException;
import com.zq.common.utils.AssertUtils;
import com.zq.common.utils.EasyExcelUtil;
import com.zq.datacollect.entity.DataCollectSetting;
import com.zq.datacollect.entity.DataCollectSettingFile;
import com.zq.datacollect.entity.DataCollectTaskLog;
import com.zq.datacollect.entity.*;
import com.zq.datacollect.holder.DatabaseHolder;
import com.zq.datacollect.mapper.DataCollectMapper;
import com.zq.datacollect.mapper.DataCollectSettingFileMapper;
import com.zq.datacollect.mapper.DataCollectTaskLogMapper;
import com.zq.datacollect.mapper.*;
import com.zq.datacollect.service.DataCollectFileService;
import com.zq.datacollect.util.SqlUtil;
import com.zq.datacollect.vo.DataCollectFileAddReq;
......@@ -25,10 +28,7 @@ import javax.annotation.Resource;
import java.io.IOException;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
@Service
public class DataCollectFileServiceImpl extends ServiceImpl<DataCollectSettingFileMapper, DataCollectSettingFile> implements DataCollectFileService {
......@@ -39,6 +39,12 @@ public class DataCollectFileServiceImpl extends ServiceImpl<DataCollectSettingFi
@Resource
private DataCollectTaskLogMapper dataCollectTaskLogMapper;
@Resource
private AjzlzypjzbdyMapper ajzlzypjzbdyMapper;
@Resource
private BananChengxiaoMapper bananChengxiaoMapper;
@Override
public DataCollectSettingFile get(Integer dataCollectSettingId) {
return lambdaQuery().eq(DataCollectSettingFile::getDataCollectSettingId, dataCollectSettingId).one();
......@@ -113,4 +119,91 @@ public class DataCollectFileServiceImpl extends ServiceImpl<DataCollectSettingFi
throw new BusinessException("文件读取失败,请检查后重试");
}
}
}
\ No newline at end of file
@Override
public Object importExcelToDb(MultipartFile file) {
List<Ajzlzypjzbdy> list = ajzlzypjzbdyMapper.selectList(Wrappers.lambdaQuery(Ajzlzypjzbdy.builder().build()));
if (list!= null && list.size() > 0) {
for(Ajzlzypjzbdy one:list){
ajzlzypjzbdyMapper.deleteById(one.getId());
}
}
ExcelReader reader;
try {
reader = ExcelUtil.getReader(file.getInputStream());
} catch (IOException e) {
e.printStackTrace();
throw new BusinessException("文件解析失败");
}
List<List<Object>> readList = reader.read(2,17);
List<Object> titleRow = reader.readRow(15);
int end = 0;
String pre = "";
List<String> rateList = new ArrayList<>();
for (Object o : titleRow) {
String str = Convert.toStr(o);
String content = str.trim();
if ("单位".equals(content)) {
end++;
continue;
}
if (StrUtil.isBlank(pre) || !pre.equals(content)) {
pre = content;
rateList.add(pre);
}
end++;
}
for (List<Object> objectList : readList) {
String city = Convert.toStr(CollUtil.get(objectList, 0), "");
int index = 1;
for (int i = 0; i < rateList.size(); i++) {
Ajzlzypjzbdy ajzlzypjzbdy = new Ajzlzypjzbdy();
ajzlzypjzbdy.setUnit(city);
ajzlzypjzbdy.setCases(Convert.toStr(CollUtil.get(objectList, index++)));
ajzlzypjzbdy.setPiece(Convert.toStr(CollUtil.get(objectList, index++)));
ajzlzypjzbdy.setCaseRatio(Convert.toStr(CollUtil.get(objectList, index++)));
// ajzlzypjzbdy.setName();
ajzlzypjzbdy.setCreateTime(DateUtil.date());
if (ajzlzypjzbdy.getCases()!=null && ajzlzypjzbdy.getPiece()!=null && ajzlzypjzbdy.getCaseRatio()!=null){
ajzlzypjzbdyMapper.insert(ajzlzypjzbdy);
}
}
}
return "导入库成功";
}
@Override
public Object importBacxToDb(MultipartFile file) {
List<BananChengxiao> list = bananChengxiaoMapper.selectList(Wrappers.lambdaQuery(BananChengxiao.builder().build()));
if (list != null && list.size() > 0) {
for (BananChengxiao one : list) {
bananChengxiaoMapper.deleteById(one.getId());
}
}
ExcelReader reader;
try {
reader = ExcelUtil.getReader(file.getInputStream());
} catch (IOException e) {
e.printStackTrace();
throw new BusinessException("文件解析失败");
}
List<List<Object>> readList = reader.read(2);
for (List<Object> objectList : readList) {
int index = 0;
BananChengxiao bananChengxiao = new BananChengxiao();
bananChengxiao.setShiyuan(Convert.toStr(CollUtil.get(objectList, index++)));
bananChengxiao.setXiansuo(Convert.toStr(CollUtil.get(objectList, index++)));
bananChengxiao.setHecha(Convert.toStr(CollUtil.get(objectList, index++)));
bananChengxiao.setChengan(Convert.toStr(CollUtil.get(objectList, index++)));
bananChengxiao.setXiansuoRate(Convert.toStr(CollUtil.get(objectList, index++)));
bananChengxiao.setChenganRate(Convert.toStr(CollUtil.get(objectList, index++)));
bananChengxiao.setWanhui(Convert.toStr(CollUtil.get(objectList, index++)));
bananChengxiao.setFafangjiuzhu(Convert.toStr(CollUtil.get(objectList, index++)));
bananChengxiao.setJianzhanglizhi(Convert.toStr(CollUtil.get(objectList, index++)));
bananChengxiao.setCreateTime(DateUtil.date());
}
return "导入成功";
}
}
......@@ -24,30 +24,6 @@ spring:
timeout: 5000
datasource:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: ${jdbc.driver-class-name}
username: ${jdbc.username}
password: ${jdbc.password}
url: ${jdbc.url}
# 初始连接数
initial-size: 5
# 最小连接数
min-idle: 10
# 最大连接数
max-active: 20
# 获取连接超时时间
max-wait: 5000
# 连接有效性检测时间
time-between-eviction-runs-millis: 60000
# 连接在池中最小生存的时间
min-evictable-idle-time-millis: 300000
# 连接在池中最大生存的时间
max-evictable-idle-time-millis: 900000
test-while-idle: true
test-on-borrow: false
test-on-return: false
# 检测连接是否有效
validation-query: SELECT 1 FROM DUAL
# 配置监控统计
webStatFilter:
enabled: true
......@@ -55,7 +31,42 @@ spring:
enabled: true
url-pattern: /druid/*
reset-enable: false
allow: ""
dynamic: # mybatis plus多数据源插件
primary: master #设置默认的数据源或者数据源组,默认值即为master
strict: false #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源
datasource:
master:
db-type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: ${jdbc.driver-class-name}
username: ${jdbc.username}
password: ${jdbc.password}
url: ${jdbc.master.url}
hjk:
db-type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: ${jdbc.driver-class-name}
username: ${jdbc.username}
password: ${jdbc.password}
url: ${jdbc.hjk.url}
druid:
# 初始连接数
initial-size: 5
# 最小连接数
min-idle: 10
# 最大连接数
max-active: 20
# 获取连接超时时间
max-wait: 5000
# 连接有效性检测时间
time-between-eviction-runs-millis: 60000
# 连接在池中最小生存的时间
min-evictable-idle-time-millis: 300000
# 连接在池中最大生存的时间
max-evictable-idle-time-millis: 900000
test-while-idle: true
test-on-borrow: false
test-on-return: false
# 检测连接是否有效
validation-query: SELECT 1 FROM DUAL
filter:
stat:
enabled: true
......
......@@ -85,6 +85,13 @@
<version>${druid.version}</version>
</dependency>
<!--Mybatis plus多数据源-->
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
<version>3.4.0</version>
</dependency>
<!-- excel工具 -->
<dependency>
<groupId>org.apache.poi</groupId>
......@@ -167,4 +174,4 @@
</resource>
</resources>
</build>
</project>
\ No newline at end of file
</project>
......@@ -4,31 +4,31 @@ server:
spring:
application:
name: ${data.name}
servlet:
#上传文件限制
multipart:
#单个文件大小
max-file-size: 20MB
#设置总上传的数据大小
max-request-size: 50MB
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
redis:
#数据库索引
database: 0
host: ${redis.url}
port: ${redis.port}
password: ${redis.password}
#连接超时时间
timeout: 5000
datasource:
druid:
db-type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: ${jdbc.driver-class-name}
username: ${jdbc.username}
password: ${jdbc.password}
url: ${jdbc.url}
# 配置监控统计
webStatFilter:
enabled: true
stat-view-servlet:
enabled: true
url-pattern: /druid/*
reset-enable: false
dynamic: # mybatis plus多数据源插件
primary: master #设置默认的数据源或者数据源组,默认值即为master
strict: false #严格匹配数据源,默认false. true未匹配到指定数据源时抛异常,false使用默认数据源
datasource:
master:
db-type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: ${jdbc.driver-class-name}
username: ${jdbc.username}
password: ${jdbc.password}
url: ${jdbc.master.url}
hjk:
db-type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: ${jdbc.driver-class-name}
username: ${jdbc.username}
password: ${jdbc.password}
url: ${jdbc.hjk.url}
# 初始连接数
initial-size: 5
# 最小连接数
......@@ -36,9 +36,9 @@ spring:
# 最大连接数
max-active: 20
# 获取连接超时时间
max-wait: 5000
max-wait: 20000
# 连接有效性检测时间
time-between-eviction-runs-millis: 60000
time-between-eviction-runs-millis: 8000
# 连接在池中最小生存的时间
min-evictable-idle-time-millis: 300000
# 连接在池中最大生存的时间
......@@ -47,7 +47,7 @@ spring:
test-on-borrow: false
test-on-return: false
# 检测连接是否有效
validation-query: SELECT 1 FROM DUAL
validation-query: select 1
# 配置监控统计
webStatFilter:
enabled: true
......@@ -55,7 +55,6 @@ spring:
enabled: true
url-pattern: /druid/*
reset-enable: false
allow: ""
filter:
stat:
enabled: true
......@@ -66,12 +65,70 @@ spring:
wall:
config:
multi-statement-allow: true
# mybatis plus 配置
mybatis-plus:
configuration:
jdbc-type-for-null: null
# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
global-config:
db-config:
select-strategy: not_empty
update-strategy: not_empty
redis:
#数据库索引
database: 1
host: ${redis.url}
port: ${redis.port}
password: ${redis.password}
#连接超时时间
timeout: 5000
#配置 Jpa
jpa:
properties:
hibernate:
ddl-auto: none
dialect: org.hibernate.dialect.MySQL5InnoDBDialect
open-in-view: true
#jwt
jwt:
header: Authorization
# 令牌前缀
# token-start-with: Bearer
# 必须使用最少88位的Base64对该令牌进行编码
base64-secret: ZmQ0ZGI5NjQ0MDQwY2I4MjMxY2Y3ZmI3MjdhN2ZmMjNhODViOTg1ZGE0NTBjMGM4NDA5NzYxMjdjOWMwYWRmZTBlZjlhNGY3ZTg4Y2U3YTE1ODVkZDU5Y2Y3OGYwZWE1NzUzNWQ2YjFjZDc0NGMxZWU2MmQ3MjY1NzJmNTE0MzI=
# 令牌过期时间 此处单位/毫秒 ,默认4小时,可在此网站生成 https://www.convertworld.com/zh-hans/time/milliseconds.html
token-validity-in-seconds: 14400000
# 在线用户key
online-key: online-token-
# 验证码
code-key: code-key-
# token 续期检查时间范围(默认30分钟,单位毫秒),在token即将过期的一段时间内用户操作了,则给用户的token续期
detect: 1800000
# 续期时间范围,默认1小时,单位毫秒
renew: 3600000
task:
pool:
# 核心线程池大小
core-pool-size: 10
# 最大线程数
max-pool-size: 30
# 活跃时间
keep-alive-seconds: 60
# 队列容量
queue-capacity: 50
#是否允许生成代码,生产环境设置为false
generator:
enabled: true
#是否开启 swagger-ui
swagger:
enabled: true
# 文件存储路径
file:
mac:
path: ~/file/
avatar: ~/avatar/
linux:
path: /home/eladmin/file/
avatar: /home/eladmin/avatar/
windows:
path: C:\eladmin\file\
avatar: C:\eladmin\avatar\
# 文件大小 /M
maxSize: 100
avatarMaxSize: 5
......@@ -14,7 +14,7 @@ spring:
driver-class-name: ${jdbc.driver-class-name}
username: ${jdbc.username}
password: ${jdbc.password}
url: ${jdbc.url}
url: ${jdbc.master.url}
redis:
#数据库索引
database: 0
......@@ -28,4 +28,4 @@ spring:
file:
tmpDir:
excel: /data/tmp/excel/
\ No newline at end of file
excel: /data/tmp/excel/
......@@ -57,41 +57,68 @@ public class MetaDataCategoryController {
* @param metaDataCategory
* @return
*/
// @PostMapping("/add")
// public ResultVo add(@RequestBody MetaDataCategory metaDataCategory) {
// AssertUtils.notNull(metaDataCategory.getCategoryName(), "缺少类别目录名称");
// AssertUtils.notNull(metaDataCategory.getStandardLevel(), "缺少类别目录级别");
// LambdaQueryWrapper<MetaDataCategory> wrapper = new LambdaQueryWrapper<>();
// List<MetaDataCategory> list = metaDataCategoryService.list(wrapper);
// for (MetaDataCategory category:list) {
// if (metaDataCategory.getCategoryName().equals(category.getCategoryName())) {
// return ResultVo.fail("抱歉,此目录名已创建");
// }
// }
// MetaDataCategory one = metaDataCategoryService.getOne(wrapper.eq(MetaDataCategory::getCategoryType,0).orderByDesc(MetaDataCategory::getId).last("LIMIT 1"));
// // 根据CategoryCode查询是否存在记录
// MetaDataCategory parent = metaDataCategoryService.getOne(new LambdaQueryWrapper<MetaDataCategory>()
// .eq(MetaDataCategory::getId, metaDataCategory.getCategoryCode()));
// // 如果存在记录,获取其id,并设置为新记录的parentId
// Boolean b=true;
// if (parent != null) {
// // 更新其subCount字段为原来的值加一
// metaDataCategory.setCategoryCode(parent.getId());
// parent.setSubCount(parent.getSubCount() + 1);
// parent.setUpdateTime(DateUtil.date());
// b= metaDataCategoryService.updateById(parent);
// }else {
// metaDataCategory.setCategoryCode(one.getId()+1);
// }
// metaDataCategory.setCategoryType(0);
// metaDataCategory.setCreateTime(DateUtil.date());
// b =metaDataCategoryService.save(metaDataCategory);
//
// return b ? ResultVo.success("操作成功!") : ResultVo.fail("操作失败");
// }
/**
* 新增元数据类别
* @param metaDataCategory
* @return
*/
@PostMapping("/add")
public ResultVo add(@RequestBody MetaDataCategory metaDataCategory) {
AssertUtils.notNull(metaDataCategory.getCategoryName(), "缺少类别目录名称");
AssertUtils.notNull(metaDataCategory.getStandardLevel(), "缺少类别目录级别");
LambdaQueryWrapper<MetaDataCategory> wrapper = new LambdaQueryWrapper<>();
List<MetaDataCategory> list = metaDataCategoryService.list(wrapper);
for (MetaDataCategory category:list) {
if (metaDataCategory.getCategoryName().equals(category.getCategoryName())) {
return ResultVo.fail("抱歉,此目录名已创建");
}
}
MetaDataCategory one = metaDataCategoryService.getOne(wrapper.eq(MetaDataCategory::getCategoryType,0).orderByDesc(MetaDataCategory::getId).last("LIMIT 1"));
AssertUtils.notNull(metaDataCategory.getCategoryCode(), "缺少类别目录编码");
// 根据CategoryCode查询是否存在记录
MetaDataCategory parent = metaDataCategoryService.getOne(new LambdaQueryWrapper<MetaDataCategory>()
.eq(MetaDataCategory::getId, metaDataCategory.getCategoryCode()));
// 如果存在记录,获取其id,并设置为新记录的parentId
Boolean b=true;
if (parent != null) {
// 更新其subCount字段为原来的值加一
metaDataCategory.setCategoryCode(parent.getId());
// 更新其subCount字段为原来的值加一
parent.setSubCount(parent.getSubCount() + 1);
parent.setUpdateTime(DateUtil.date());
b= metaDataCategoryService.updateById(parent);
}else {
metaDataCategory.setCategoryCode(one.getId()+1);
parent.setCategoryType(0);
metaDataCategoryService.updateById(parent);
}
metaDataCategory.setCategoryType(0);
metaDataCategory.setCreateTime(DateUtil.date());
b =metaDataCategoryService.save(metaDataCategory);
// 添加新的记录
boolean b = metaDataCategoryService.save(metaDataCategory);
return b ? ResultVo.success("操作成功!") : ResultVo.fail("操作失败");
}
/**
* 修改元数据类别
* @param metaDataCategory
......
......@@ -18,7 +18,7 @@ spring:
driver-class-name: ${jdbc.driver-class-name}
username: ${jdbc.username}
password: ${jdbc.password}
url: ${jdbc.url}
url: ${jdbc.master.url}
#JavaMailSender 邮件发送的配置
mail:
protocol: smtp
......
......@@ -9,7 +9,7 @@ spring:
db-type: com.alibaba.druid.pool.DruidDataSource
#启动失败
# driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
url: ${jdbc.url}
url: ${jdbc.master.url}
username: ${jdbc.username}
password: ${jdbc.password}
# 初始连接数
......@@ -140,4 +140,4 @@ rsa:
# sm.ms 图床的 token
smms:
token: 1oOP3ykFDI0K6ifmtvU7c8Y1eTWZSlyl
\ No newline at end of file
token: 1oOP3ykFDI0K6ifmtvU7c8Y1eTWZSlyl
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