Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nnjcy-data-model
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ljb
nnjcy-data-model
Commits
1f5df8c9
Commit
1f5df8c9
authored
Oct 16, 2023
by
ljb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改添加数据汇聚设置
parent
793ce0b5
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
389 additions
and
105 deletions
+389
-105
data-collect-server/src/main/java/com/zq/datacollect/DataCollectAppliction.java
+1
-1
data-collect-server/src/main/java/com/zq/datacollect/config/MybatisPlusConfig.java
+62
-0
data-collect-server/src/main/java/com/zq/datacollect/controller/DataCollectController.java
+46
-6
data-collect-server/src/main/java/com/zq/datacollect/entity/DataCollectSetting.java
+6
-0
data-collect-server/src/main/java/com/zq/datacollect/entity/DataCollectSettingDb.java
+7
-30
data-collect-server/src/main/java/com/zq/datacollect/entity/DataCollectSettingDbOld.java
+76
-0
data-collect-server/src/main/java/com/zq/datacollect/entity/DataCollectSettingFile.java
+2
-0
data-collect-server/src/main/java/com/zq/datacollect/entity/DataCollectSettingSite.java
+1
-1
data-collect-server/src/main/java/com/zq/datacollect/entity/DataCollectTaskLog.java
+1
-1
data-collect-server/src/main/java/com/zq/datacollect/entity/QueryDb.java
+1
-1
data-collect-server/src/main/java/com/zq/datacollect/service/DataCollectService.java
+10
-4
data-collect-server/src/main/java/com/zq/datacollect/service/impl/DataCollectServiceImpl.java
+71
-60
data-collect-server/src/main/java/com/zq/datacollect/vo/DataCollectApiAddReq.java
+32
-0
data-collect-server/src/main/java/com/zq/datacollect/vo/DataCollectDbAddReq.java
+24
-0
data-collect-server/src/main/java/com/zq/datacollect/vo/DataCollectFileAddReq.java
+24
-0
data-collect-server/src/main/java/com/zq/datacollect/vo/DataCollectSiteAddReq.java
+24
-0
spider-flow-web/src/main/resources/application.yml
+1
-1
No files found.
data-collect-server/src/main/java/com/zq/datacollect/DataCollectAppliction.java
View file @
1f5df8c9
...
...
@@ -4,8 +4,8 @@ import org.mybatis.spring.annotation.MapperScan;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
@MapperScan
({
"com.zq.datacollect.mapper"
})
@SpringBootApplication
@MapperScan
({
"com.zq.datacollect.mapper"
})
public
class
DataCollectAppliction
{
public
static
void
main
(
String
[]
args
)
{
...
...
data-collect-server/src/main/java/com/zq/datacollect/config/MybatisPlusConfig.java
0 → 100644
View file @
1f5df8c9
package
com
.
zq
.
datacollect
.
config
;
import
com.baomidou.mybatisplus.annotation.DbType
;
import
com.baomidou.mybatisplus.autoconfigure.ConfigurationCustomizer
;
import
com.baomidou.mybatisplus.core.handlers.MetaObjectHandler
;
import
com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor
;
import
com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor
;
import
com.github.pagehelper.PageInterceptor
;
import
org.apache.ibatis.reflection.MetaObject
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
java.util.Date
;
import
java.util.Properties
;
@Configuration
public
class
MybatisPlusConfig
implements
MetaObjectHandler
{
/**
* MybatisPlus分页插件
*/
@Bean
public
MybatisPlusInterceptor
mybatisPlusInterceptor
()
{
MybatisPlusInterceptor
interceptor
=
new
MybatisPlusInterceptor
();
interceptor
.
addInnerInterceptor
(
new
PaginationInnerInterceptor
(
DbType
.
H2
));
return
interceptor
;
}
/**
* 官方原话
* MybatisPlus新的分页插件,一缓和二缓遵循mybatis的规则,
* 需要设置 MybatisConfiguration#useDeprecatedExecutor = false
* 避免缓存出现问题(该属性会在旧插件移除后一同移除)
*/
@SuppressWarnings
(
value
=
{
"deprecation"
})
@Bean
public
ConfigurationCustomizer
configurationCustomizer
()
{
return
configuration
->
configuration
.
setUseDeprecatedExecutor
(
false
);
}
/**
* pagehelper分页插件
*/
@Bean
public
PageInterceptor
pageInterceptor
()
{
PageInterceptor
pageInterceptor
=
new
PageInterceptor
();
Properties
properties
=
new
Properties
();
properties
.
put
(
"helperDialect"
,
"mysql"
);
pageInterceptor
.
setProperties
(
properties
);
return
pageInterceptor
;
}
@Override
public
void
insertFill
(
MetaObject
metaObject
)
{
setFieldValByName
(
"createTime"
,
new
Date
(),
metaObject
);
}
@Override
public
void
updateFill
(
MetaObject
metaObject
)
{
setFieldValByName
(
"updateTime"
,
new
Date
(),
metaObject
);
}
}
data-collect-server/src/main/java/com/zq/datacollect/controller/DataCollectController.java
View file @
1f5df8c9
package
com
.
zq
.
datacollect
.
controller
;
import
com.zq.common.exception.BusinessException
;
import
com.zq.common.utils.AssertUtils
;
import
com.zq.common.vo.ResultVo
;
import
com.zq.datacollect.service.DataCollectService
;
import
com.zq.datacollect.vo.DataCollectReq
;
import
com.zq.datacollect.vo.DataCollectSettingAddReq
;
import
com.zq.datacollect.vo.*
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -36,10 +36,50 @@ public class DataCollectController {
return
ResultVo
.
success
(
dataCollectService
.
get
(
id
));
}
@ApiOperation
(
"新增数据汇聚设置"
)
@PostMapping
(
value
=
"/add"
)
public
ResultVo
add
(
@RequestBody
DataCollectSettingAddReq
dataCollectSettingAddReq
)
{
dataCollectService
.
add
(
dataCollectSettingAddReq
);
// @ApiOperation("新增数据汇聚设置")
// @PostMapping(value = "/add")
// public ResultVo add(@RequestBody DataCollectSettingAddReq dataCollectSettingAddReq) {
// switch (dataCollectSettingAddReq.getDataType()){
// case 1:
// dataCollectService.addDbSetting(dataCollectSettingAddReq);
// break;
// case 2:
// break;
// case 3:
// break;
// case 4:
// break;
// default:
// throw new BusinessException("汇聚类型错误");
// }
// return ResultVo.success("添加成功");
// }
@ApiOperation
(
"新增数据库数据汇聚设置"
)
@PostMapping
(
value
=
"/add/db"
)
public
ResultVo
addDbSetting
(
@RequestBody
DataCollectDbAddReq
dataCollectDbAddReq
)
{
dataCollectService
.
addDbSetting
(
dataCollectDbAddReq
);
return
ResultVo
.
success
(
"添加成功"
);
}
@ApiOperation
(
"新增文件数据汇聚设置"
)
@PostMapping
(
value
=
"/add/file"
)
public
ResultVo
addFileSetting
(
@RequestBody
DataCollectFileAddReq
dataCollectFileAddReq
)
{
dataCollectService
.
addFileSetting
(
dataCollectFileAddReq
);
return
ResultVo
.
success
(
"添加成功"
);
}
@ApiOperation
(
"新增接口数据汇聚设置"
)
@PostMapping
(
value
=
"/add/api"
)
public
ResultVo
addApiSetting
(
@RequestBody
DataCollectApiAddReq
dataCollectApiAddReq
)
{
dataCollectService
.
addApiSetting
(
dataCollectApiAddReq
);
return
ResultVo
.
success
(
"添加成功"
);
}
@ApiOperation
(
"新增网站数据汇聚设置"
)
@PostMapping
(
value
=
"/add/site"
)
public
ResultVo
addSiteSetting
(
@RequestBody
DataCollectSiteAddReq
dataCollectSiteAddReq
)
{
dataCollectService
.
addSiteSetting
(
dataCollectSiteAddReq
);
return
ResultVo
.
success
(
"添加成功"
);
}
...
...
data-collect-server/src/main/java/com/zq/datacollect/entity/DataCollectSetting.java
View file @
1f5df8c9
...
...
@@ -38,6 +38,12 @@ public class DataCollectSetting {
private
Boolean
isManually
;
/**
* 汇聚到的数据库名
* 如果是非结构化文件,可以不存入数据表
*/
private
Integer
toDbId
;
/**
* 汇聚到的数据表名
* 如果是非结构化文件,可以不存入数据表
*/
...
...
data-collect-server/src/main/java/com/zq/datacollect/entity/DataCollectSettingDb.java
View file @
1f5df8c9
...
...
@@ -5,14 +5,16 @@ import com.baomidou.mybatisplus.annotation.IdType;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.Date
;
@Data
@
AllArgsConstructo
r
@
Builde
r
@NoArgsConstructor
@AllArgsConstructor
public
class
DataCollectSettingDb
{
/**
...
...
@@ -27,39 +29,14 @@ public class DataCollectSettingDb {
private
Integer
dataCollectSettingId
;
/**
* 数据库名称
*/
private
String
dbName
;
/**
* 数据库ip
*/
private
String
dbIp
;
/**
* 数据库端口
*/
private
Integer
dbPort
;
/**
* 数据库用户名
*/
private
String
username
;
/**
* 数据库密码
*/
private
String
password
;
/**
* 数据库类型(1.Mysql 2.oracle 3.MSSQL )
* 来源数据库id
*/
private
Integer
dbType
;
private
Integer
fromDbId
;
/**
*
下次导入的标记
*
来源数据库名称
*/
private
String
nextImportFlag
;
private
String
fromTable
;
/**
* createTime
...
...
data-collect-server/src/main/java/com/zq/datacollect/entity/DataCollectSettingDbOld.java
0 → 100644
View file @
1f5df8c9
package
com
.
zq
.
datacollect
.
entity
;
import
com.baomidou.mybatisplus.annotation.FieldFill
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.Date
;
@Data
@AllArgsConstructor
@NoArgsConstructor
public
class
DataCollectSettingDbOld
{
/**
* id
*/
@TableId
(
type
=
IdType
.
AUTO
)
private
Integer
id
;
/**
* 数据汇聚id
*/
private
Integer
dataCollectSettingId
;
/**
* 数据库名称
*/
private
String
dbName
;
/**
* 数据库ip
*/
private
String
dbIp
;
/**
* 数据库端口
*/
private
Integer
dbPort
;
/**
* 数据库用户名
*/
private
String
username
;
/**
* 数据库密码
*/
private
String
password
;
/**
* 数据库类型(1.Mysql 2.oracle 3.MSSQL )
*/
private
Integer
dbType
;
/**
* 下次导入的标记
*/
private
String
nextImportFlag
;
/**
* createTime
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
Date
createTime
;
/**
* updateTime
*/
@TableField
(
fill
=
FieldFill
.
INSERT_UPDATE
)
private
Date
updateTime
;
}
\ No newline at end of file
data-collect-server/src/main/java/com/zq/datacollect/entity/DataCollectSettingFile.java
View file @
1f5df8c9
...
...
@@ -5,12 +5,14 @@ import com.baomidou.mybatisplus.annotation.IdType;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.Date
;
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public
class
DataCollectSettingFile
{
...
...
data-collect-server/src/main/java/com/zq/datacollect/entity/DataCollectSettingSite.java
View file @
1f5df8c9
...
...
@@ -19,7 +19,7 @@ public class DataCollectSettingSite {
* id
*/
@TableId
(
type
=
IdType
.
AUTO
)
private
Long
id
;
private
Integer
id
;
/**
* 数据汇聚id
...
...
data-collect-server/src/main/java/com/zq/datacollect/entity/DataCollectTaskLog.java
View file @
1f5df8c9
...
...
@@ -52,7 +52,7 @@ public class DataCollectTaskLog {
* id
*/
@TableId
(
type
=
IdType
.
AUTO
)
private
Long
id
;
private
Integer
id
;
/**
* createTime
...
...
data-collect-server/src/main/java/com/zq/datacollect/entity/QueryDb.java
View file @
1f5df8c9
...
...
@@ -17,7 +17,7 @@ public class QueryDb {
* id
*/
@TableId
(
type
=
IdType
.
AUTO
)
private
Long
id
;
private
Integer
id
;
/**
* 数据库名称
...
...
data-collect-server/src/main/java/com/zq/datacollect/service/DataCollectService.java
View file @
1f5df8c9
...
...
@@ -2,9 +2,7 @@ package com.zq.datacollect.service;
import
com.zq.common.vo.PageVo
;
import
com.zq.datacollect.entity.DataCollectSetting
;
import
com.zq.datacollect.vo.DataCollectReq
;
import
com.zq.datacollect.vo.DataCollectSettingAddReq
;
import
com.zq.datacollect.vo.DataCollectSettingResp
;
import
com.zq.datacollect.vo.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.IOException
;
...
...
@@ -17,7 +15,15 @@ public interface DataCollectService {
DataCollectSettingResp
get
(
Integer
id
);
void
add
(
DataCollectSettingAddReq
dataCollectSettingAddReq
);
// void add(DataCollectSettingAddReq dataCollectSettingAddReq);
void
addDbSetting
(
DataCollectDbAddReq
dataCollectDbAddReq
);
void
addFileSetting
(
DataCollectFileAddReq
dataCollectFileAddReq
);
void
addApiSetting
(
DataCollectApiAddReq
dataCollectApiAddReq
);
void
addSiteSetting
(
DataCollectSiteAddReq
dataCollectSiteAddReq
);
void
update
(
DataCollectSettingAddReq
dataCollectSettingAddReq
);
...
...
data-collect-server/src/main/java/com/zq/datacollect/service/impl/DataCollectServiceImpl.java
View file @
1f5df8c9
...
...
@@ -2,9 +2,6 @@ package com.zq.datacollect.service.impl;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.io.FileUtil
;
import
com.alibaba.excel.EasyExcel
;
import
com.alibaba.excel.context.AnalysisContext
;
import
com.alibaba.excel.event.AnalysisEventListener
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper
;
...
...
@@ -12,18 +9,13 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
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.common.utils.PagingUtils
;
import
com.zq.common.vo.PageVo
;
import
com.zq.datacollect.entity.DataCollectSetting
;
import
com.zq.datacollect.entity.DataCollectSettingApi
;
import
com.zq.datacollect.entity.DataCollectSettingApiPara
;
import
com.zq.datacollect.entity.QueryDb
;
import
com.zq.datacollect.entity.*
;
import
com.zq.datacollect.mapper.*
;
import
com.zq.datacollect.service.DataCollectService
;
import
com.zq.datacollect.vo.DataCollectReq
;
import
com.zq.datacollect.vo.DataCollectSettingAddReq
;
import
com.zq.datacollect.vo.DataCollectSettingApiAddReq
;
import
com.zq.datacollect.vo.DataCollectSettingResp
;
import
com.zq.datacollect.vo.*
;
import
lombok.RequiredArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
...
...
@@ -87,40 +79,80 @@ public class DataCollectServiceImpl extends ServiceImpl<DataCollectMapper, DataC
return
resp
;
}
// @Override
// @Transactional
// public void add(DataCollectSettingAddReq dataCollectSettingAddReq){
// boolean b = save(dataCollectSettingAddReq);
// AssertUtils.isTrue(b, "添加失败");
// if(dataCollectSettingAddReq.getDataType() != 3){
// HashMap<String, Object> map = new HashMap();
// BeanUtil.copyProperties(dataCollectSettingAddReq.getDataFromSetting(), map);
// if(dataCollectSettingAddReq.getDataType() == 1){
// QueryDb db = queryDbMapper.selectById((Integer) map.get("databaseId"));
// map.put("dbName", db.getDbName());
// map.put("dbIp", db.getDbIp());
// map.put("dbPort", db.getDbPort());
// map.put("username", db.getUsername());
// map.put("password", db.getPassword());
// map.put("dbType", db.getDbType());
// map.remove("databaseId");
// }
// map.put("dataCollectSettingId", dataCollectSettingAddReq.getId());
// AssertUtils.isTrue(getDao(dataCollectSettingAddReq.getDataType()).insert(map)==1, "添加失败");
// }else {
// DataCollectSettingApiAddReq apiAddReq = new DataCollectSettingApiAddReq();
// BeanUtil.copyProperties(dataCollectSettingAddReq.getDataFromSetting(), apiAddReq);
// apiAddReq.setDataCollectSettingId(dataCollectSettingAddReq.getId());
// AssertUtils.isTrue(dataCollectSettingApiMapper.insert(apiAddReq)==1, "添加失败");
// for (DataCollectSettingApiPara apiPara : apiAddReq.getApiParas()) {
// apiPara.setDataCollectSettingApiId(apiAddReq.getId());
// AssertUtils.isTrue(dataCollectSettingApiParaMapper.insert(apiPara)==1, "添加失败");
// }
// }
// }
@Override
@Transactional
public
void
add
(
DataCollectSettingAddReq
dataCollectSettingAddReq
){
boolean
b
=
save
(
dataCollectSettingAddReq
);
AssertUtils
.
isTrue
(
b
,
"添加失败"
);
if
(
dataCollectSettingAddReq
.
getDataType
()
!=
3
){
HashMap
<
String
,
Object
>
map
=
new
HashMap
();
BeanUtil
.
copyProperties
(
dataCollectSettingAddReq
.
getDataFromSetting
(),
map
);
if
(
dataCollectSettingAddReq
.
getDataType
()
==
1
){
QueryDb
db
=
queryDbMapper
.
selectById
((
Integer
)
map
.
get
(
"databaseId"
));
map
.
put
(
"dbName"
,
db
.
getDbName
());
map
.
put
(
"dbIp"
,
db
.
getDbIp
());
map
.
put
(
"dbPort"
,
db
.
getDbPort
());
map
.
put
(
"username"
,
db
.
getUsername
());
map
.
put
(
"password"
,
db
.
getPassword
());
map
.
put
(
"dbType"
,
db
.
getDbType
());
map
.
remove
(
"databaseId"
);
}
map
.
put
(
"dataCollectSettingId"
,
dataCollectSettingAddReq
.
getId
());
AssertUtils
.
isTrue
(
getDao
(
dataCollectSettingAddReq
.
getDataType
()).
insert
(
map
)==
1
,
"添加失败"
);
}
else
{
DataCollectSettingApiAddReq
apiAddReq
=
new
DataCollectSettingApiAddReq
();
BeanUtil
.
copyProperties
(
dataCollectSettingAddReq
.
getDataFromSetting
(),
apiAddReq
);
apiAddReq
.
setDataCollectSettingId
(
dataCollectSettingAddReq
.
getId
());
AssertUtils
.
isTrue
(
dataCollectSettingApiMapper
.
insert
(
apiAddReq
)==
1
,
"添加失败"
);
for
(
DataCollectSettingApiPara
apiPara
:
apiAddReq
.
getApiParas
())
{
apiPara
.
setDataCollectSettingApiId
(
apiAddReq
.
getId
());
AssertUtils
.
isTrue
(
dataCollectSettingApiParaMapper
.
insert
(
apiPara
)==
1
,
"添加失败"
);
}
public
void
addDbSetting
(
DataCollectDbAddReq
dataCollectDbAddReq
)
{
AssertUtils
.
isTrue
(
save
(
dataCollectDbAddReq
.
getDataCollectSetting
()),
"添加失败"
);
DataCollectSettingDb
settingDb
=
dataCollectDbAddReq
.
getDataCollectSettingDb
();
settingDb
.
setDataCollectSettingId
(
dataCollectDbAddReq
.
getDataCollectSetting
().
getId
());
AssertUtils
.
isTrue
(
dataCollectSettingDbMapper
.
insert
(
settingDb
)==
1
,
"添加失败"
);
}
@Override
@Transactional
public
void
addFileSetting
(
DataCollectFileAddReq
dataCollectFileAddReq
)
{
AssertUtils
.
isTrue
(
save
(
dataCollectFileAddReq
.
getDataCollectSetting
()),
"添加失败"
);
DataCollectSettingFile
settingFile
=
dataCollectFileAddReq
.
getDataCollectSettingFile
();
settingFile
.
setDataCollectSettingId
(
dataCollectFileAddReq
.
getDataCollectSetting
().
getId
());
AssertUtils
.
isTrue
(
dataCollectSettingFileMapper
.
insert
(
settingFile
)==
1
,
"添加失败"
);
}
@Override
@Transactional
public
void
addApiSetting
(
DataCollectApiAddReq
dataCollectApiAddReq
)
{
AssertUtils
.
isTrue
(
save
(
dataCollectApiAddReq
.
getDataCollectSetting
()),
"添加失败"
);
DataCollectSettingApi
settingApi
=
dataCollectApiAddReq
.
getDataCollectSettingApi
();
settingApi
.
setDataCollectSettingId
(
dataCollectApiAddReq
.
getDataCollectSetting
().
getId
());
AssertUtils
.
isTrue
(
dataCollectSettingApiMapper
.
insert
(
settingApi
)==
1
,
"添加失败"
);
for
(
DataCollectSettingApiPara
settingApiPara
:
dataCollectApiAddReq
.
getDataCollectSettingApiParas
())
{
settingApiPara
.
setDataCollectSettingApiId
(
settingApi
.
getId
());
AssertUtils
.
isTrue
(
dataCollectSettingApiParaMapper
.
insert
(
settingApiPara
)==
1
,
"添加失败"
);
}
}
@Override
@Transactional
public
void
addSiteSetting
(
DataCollectSiteAddReq
dataCollectSiteAddReq
)
{
AssertUtils
.
isTrue
(
save
(
dataCollectSiteAddReq
.
getDataCollectSetting
()),
"添加失败"
);
DataCollectSettingSite
settingSite
=
dataCollectSiteAddReq
.
getDataCollectSettingSite
();
settingSite
.
setDataCollectSettingId
(
dataCollectSiteAddReq
.
getDataCollectSetting
().
getId
());
AssertUtils
.
isTrue
(
dataCollectSettingSiteMapper
.
insert
(
settingSite
)==
1
,
"添加失败"
);
}
@Override
@Transactional
public
void
update
(
DataCollectSettingAddReq
dataCollectSettingAddReq
){
DataCollectSetting
dataCollectSetting
=
getById
(
dataCollectSettingAddReq
.
getId
());
AssertUtils
.
isTrue
(
dataCollectSetting
.
getDataType
()==
dataCollectSettingAddReq
.
getDataType
(),
"修改失败,数据来源不允许修改"
);
...
...
@@ -154,28 +186,7 @@ public class DataCollectServiceImpl extends ServiceImpl<DataCollectMapper, DataC
public
List
<
Map
<
String
,
Object
>>
analysisExcel
(
MultipartFile
file
)
throws
IOException
{
String
suffix
=
FileUtil
.
extName
(
file
.
getOriginalFilename
());
AssertUtils
.
isTrue
(
suffix
.
equals
(
"xls"
)
||
suffix
.
equals
(
"xlsx"
)
||
suffix
.
equals
(
"et"
),
"不支持的文件类型"
);
List
<
Map
<
String
,
Object
>>
list
=
new
LinkedList
<>();
EasyExcel
.
read
(
file
.
getInputStream
(),
new
AnalysisEventListener
<
Map
<
Integer
,
Object
>>()
{
private
Map
<
Integer
,
String
>
headMap
;
@Override
public
void
invokeHeadMap
(
Map
<
Integer
,
String
>
headMap
,
AnalysisContext
context
)
{
this
.
headMap
=
headMap
;
}
@Override
public
void
invoke
(
Map
<
Integer
,
Object
>
valueMap
,
AnalysisContext
analysisContext
)
{
LinkedHashMap
map
=
new
LinkedHashMap
(
valueMap
.
size
());
for
(
int
i
=
0
;
i
<
valueMap
.
size
();
i
++){
map
.
put
(
headMap
.
get
(
i
),
valueMap
.
get
(
i
));
}
list
.
add
(
map
);
}
@Override
public
void
doAfterAllAnalysed
(
AnalysisContext
analysisContext
)
{}
}).
sheet
().
doReadSync
();
return
list
;
return
EasyExcelUtil
.
read
(
file
.
getInputStream
());
}
public
BaseMapper
getDao
(
int
dataType
){
...
...
data-collect-server/src/main/java/com/zq/datacollect/vo/DataCollectApiAddReq.java
0 → 100644
View file @
1f5df8c9
package
com
.
zq
.
datacollect
.
vo
;
import
com.zq.datacollect.entity.DataCollectSetting
;
import
com.zq.datacollect.entity.DataCollectSettingApi
;
import
com.zq.datacollect.entity.DataCollectSettingApiPara
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.List
;
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
DataCollectApiAddReq
extends
DataCollectSetting
{
/**
* 数据汇聚基本参数
*/
private
DataCollectSetting
dataCollectSetting
;
/**
* 接口汇聚
*/
private
DataCollectSettingApi
dataCollectSettingApi
;
/**
* 接口参数
*/
private
List
<
DataCollectSettingApiPara
>
dataCollectSettingApiParas
;
}
\ No newline at end of file
data-collect-server/src/main/java/com/zq/datacollect/vo/DataCollectDbAddReq.java
0 → 100644
View file @
1f5df8c9
package
com
.
zq
.
datacollect
.
vo
;
import
com.zq.datacollect.entity.DataCollectSetting
;
import
com.zq.datacollect.entity.DataCollectSettingDb
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
DataCollectDbAddReq
{
/**
* 数据汇聚基本参数
*/
private
DataCollectSetting
dataCollectSetting
;
/**
* 数据库汇聚参数
*/
private
DataCollectSettingDb
dataCollectSettingDb
;
}
\ No newline at end of file
data-collect-server/src/main/java/com/zq/datacollect/vo/DataCollectFileAddReq.java
0 → 100644
View file @
1f5df8c9
package
com
.
zq
.
datacollect
.
vo
;
import
com.zq.datacollect.entity.DataCollectSetting
;
import
com.zq.datacollect.entity.DataCollectSettingFile
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
DataCollectFileAddReq
{
/**
* 数据汇聚基本参数
*/
private
DataCollectSetting
dataCollectSetting
;
/**
* 文件汇聚参数
*/
private
DataCollectSettingFile
dataCollectSettingFile
;
}
\ No newline at end of file
data-collect-server/src/main/java/com/zq/datacollect/vo/DataCollectSiteAddReq.java
0 → 100644
View file @
1f5df8c9
package
com
.
zq
.
datacollect
.
vo
;
import
com.zq.datacollect.entity.DataCollectSetting
;
import
com.zq.datacollect.entity.DataCollectSettingSite
;
import
lombok.AllArgsConstructor
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
@Data
@NoArgsConstructor
@AllArgsConstructor
public
class
DataCollectSiteAddReq
{
/**
* 数据汇聚基本参数
*/
private
DataCollectSetting
dataCollectSetting
;
/**
* 网站汇聚参数
*/
private
DataCollectSettingSite
dataCollectSettingSite
;
}
\ No newline at end of file
spider-flow-web/src/main/resources/application.yml
View file @
1f5df8c9
...
...
@@ -47,7 +47,7 @@ spider:
default
:
1
#单流程默认最大线程数
job
:
enable
:
false
#设置为true时定时任务才生效
workspace
:
/data/spider
#爬虫任务的工作空间
workspace
:
D:
/data/spider
#爬虫任务的工作空间
bloomfilter
:
capacity
:
1000000
#布隆过滤器默认容量
error-rate
:
0.0001
#布隆过滤器默认容错率
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment