Commit 2c7d9597 by fudahua

Merge branch 'feature-2023-04' into 'developer'

Feature 2023 04

See merge request !87
parents dda1b337 82add547
......@@ -47,7 +47,7 @@ public class HDFSUtil {
*/
public boolean downloadFile(String srcPath,String toPath) {
try {
fileSystem.copyToLocalFile(false,new Path(srcPath),new Path(toPath));
fileSystem.copyToLocalFile(true,new Path(srcPath),new Path(toPath));
return true;
} catch (IOException e) {
logger.info("下载失败:{}",e);
......
......@@ -71,4 +71,9 @@ public interface DownloadTaskDao {
int updateTaskStatusError(@Param("idList") List<String> idList);
/** 获取等待申请通过状态的任务
* @return
*/
public int getCountDownloadTaskOfBuilding(@Param("queryDataSource") String queryDataSource);
}
......@@ -235,6 +235,13 @@ public class DownloadTaskServiceImpl implements IDownloadTaskService {
return downloadTaskDao.getDownloadTaskOfHasDownload(queryDataSource, num);
}
/** 获取在审核申请等待状态中的任务
* @return
*/
public int getCountDownloadTaskOfBuilding(String queryDataSource) {
return downloadTaskDao.getCountDownloadTaskOfBuilding(queryDataSource);
}
/** 获取指定申请编号的风险模式记录
* @param applyId
......
......@@ -682,8 +682,17 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
providerLocalTag.traceId = traceId;
logger.info("执行hivefile");
try{
String lockKey="data:hook:hive";
RedisUtil.lock(lockKey,2L);
RedisUtil.lock(lockKey,3L);
int curBuildingCount = DownloadTaskServiceImpl.getInstance().getCountDownloadTaskOfBuilding(QueryDataSource.FLAT_QUERY);
Config appConfig = ConfigService.getAppConfig();
Integer maxBuildingCount = appConfig.getIntProperty("buildingCount", 5);
if (maxBuildingCount<=curBuildingCount) {
RedisUtil.unlock(lockKey);
return;
}
List<DownloadTask> downloadTasks = DownloadTaskServiceImpl.getInstance().getDownloadTaskOfHasDownload(QueryDataSource.FLAT_QUERY,10);
if (CollectionUtils.isNotEmpty(downloadTasks)) {
for (DownloadTask downloadTask : downloadTasks) {
......
......@@ -220,4 +220,15 @@
</foreach>
</update>
<select id="getCountDownloadTaskOfBuilding" resultType="int">
SELECT count(*)
FROM
<include refid="queryTables"/>
<include refid="queryJoins"/>
WHERE
q.query_data_source = #{queryDataSource}
AND q.status = "building"
AND q.del_flag = '0'
</select>
</mapper>
\ No newline at end of file
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