Commit 2cad6e78 by 陶光胜

取数平台null筛选过滤

parent 0a10eaf4
......@@ -216,4 +216,34 @@ public class DownloadRecord implements Serializable {
public void setReportId(String reportId) {
this.reportId = reportId;
}
protected Integer desensiType;
public Integer getDesensiType() {
return desensiType;
}
public void setDesensiType(Integer desensiType) {
this.desensiType = desensiType;
}
private String downloadCondition;
public String getDownloadCondition() {
return downloadCondition;
}
public void setDownloadCondition(String downloadCondition) {
this.downloadCondition = downloadCondition;
}
private String applyPermitted;
public String getApplyPermitted() {
return applyPermitted;
}
public void setApplyPermitted(String applyPermitted) {
this.applyPermitted = applyPermitted;
}
}
......@@ -347,8 +347,23 @@ public class DownloadTask implements Serializable {
this.applyPermitted = applyPermitted;
}
protected Integer desensiType;
public Integer getDesensiType() {
return desensiType;
}
public void setDesensiType(Integer desensiType) {
this.desensiType = desensiType;
}
private String downloadCondition;
public String getDownloadCondition() {
return downloadCondition;
}
public void setDownloadCondition(String downloadCondition) {
this.downloadCondition = downloadCondition;
}
}
......@@ -3,6 +3,7 @@ package com.gic.cloud.data.hook.api.dto;
import com.gic.cloud.data.hook.api.entity.Global;
import java.io.Serializable;
import java.util.Date;
/** 自助查询表定义 DTO
* @author Sam.Z
......@@ -148,4 +149,14 @@ public class FlatQueryTable implements Serializable {
public void setAuthDesc(String authDesc) {
this.authDesc = authDesc;
}
private Date lastUpdateTime;
public Date getLastUpdateTime() {
return lastUpdateTime;
}
public void setLastUpdateTime(Date lastUpdateTime) {
this.lastUpdateTime = lastUpdateTime;
}
}
......@@ -62,4 +62,6 @@ public interface IDownloadTaskService {
*/
public Page<RiskModeRecord> getRiskModeRecordPage(String enterpriseId, Date startTime, Date endTime, Integer riskDuration, String fuzzyRange, String fuzzy, Integer pageNum, Integer pageSize);
List<DownloadRecord> listUnDownloadTask(String source);
}
......@@ -63,4 +63,6 @@ public interface IFlatQueryResultService {
public List<Object> getFlatQueryFilterData(String tableId, List<String>enterpriseIds, String fieldName);
public void initTask();
}
......@@ -77,4 +77,6 @@ public interface IFreeQueryService {
FreeQuerySource getFreeQuerySource(String enterpriseId);
void initTask();
}
......@@ -29,4 +29,5 @@ public interface DownloadRecordDao {
@Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("queryDataType") Integer queryDataType,
@Param("fuzzyRange") String fuzzyRange, @Param("fuzzy") String fuzzy);
List<DownloadRecord> listUnDownloadTask(@Param("source") String source);
}
......@@ -246,6 +246,10 @@ public class DownloadTaskServiceImpl implements IDownloadTaskService {
return result;
}
@Override
public List<DownloadRecord> listUnDownloadTask(String source) {
return this.downloadRecordDao.listUnDownloadTask(source);
}
}
......@@ -438,9 +438,6 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
Integer preReportCount = DownloadTaskServiceImpl.getInstance().getDownloadTaskCountByEnterpriseId(curTask.getEnterpriseId());
curTask.setReportId(ServiceUtils.buildReportId(curTask.getQueryDataType(), preReportCount));
// 保存下载任务
DownloadTaskServiceImpl.getInstance().createDownloadTask(curTask);
// 生成条件
FlatQueryTaskCondition condition = new FlatQueryTaskCondition();
condition.setTaskId(curTask.getId());
......@@ -459,9 +456,24 @@ public class FlatQueryResultServiceImpl implements IFlatQueryResultService {
condition.setAuthStoreIdList(authStoreIdList);
// 保存至列表
this.taskConditions.add(condition);
// 保存下载任务
curTask.setDownloadCondition(JSON.toJSONString(condition));
DownloadTaskServiceImpl.getInstance().createDownloadTask(curTask);
return curTask;
}
@Override
public void initTask(){
List<DownloadRecord> list = DownloadTaskServiceImpl.getInstance().listUnDownloadTask(QueryDataSource.FLAT_QUERY);
if(CollectionUtils.isNotEmpty(list)){
for(DownloadRecord record : list){
if(StringUtils.isNotBlank(record.getDownloadCondition())){
FlatQueryTaskCondition condition = JSON.parseObject(record.getDownloadCondition(), FlatQueryTaskCondition.class);
this.taskConditions.add(condition);
}
}
}
}
private static SimpleDateFormat datetimeFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
......
......@@ -17,6 +17,7 @@ import com.gic.cloud.data.hook.service.entity.CsvResultSetHelper;
import com.google.common.collect.Lists;
import com.opencsv.CSVWriter;
import com.opencsv.ResultSetHelper;
import org.apache.commons.collections.CollectionUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
......@@ -278,6 +279,7 @@ public class FreeQueryServiceImpl implements IFreeQueryService {
curTask.setUseCompress(useCompress ? Global.YES : Global.NO);
// 新增下载任务属性
curTask.setQueryDataType(queryDataType);
curTask.setDesensiType(desensiType);
curTask.setApplyId(applyId); // 设置申请编号
if (queryDataType == QueryDataType.SAFE) { // 如果是安全模式
curTask.setApplyPermitted(Global.YES); // 安全模式直接允许下载
......@@ -310,6 +312,28 @@ public class FreeQueryServiceImpl implements IFreeQueryService {
}
@Override
public void initTask() {
List<DownloadRecord> list = DownloadTaskServiceImpl.getInstance().listUnDownloadTask(QueryDataSource.FREE_QUERY);
if(CollectionUtils.isNotEmpty(list)) {
for (DownloadRecord record : list) {
if(record.getDesensiType() != null){
FreeQueryTaskCondition condition = new FreeQueryTaskCondition();
condition.setTaskId(record.getId());
condition.setSql(record.getRealSql());
condition.setEnterpriseId(record.getEnterpriseId());
condition.setDesensiType(record.getDesensiType());
// 设置条件可否执行
if (record.getApplyPermitted().equals(Global.YES)) {
condition.setBuildPermitted(Global.YES);
} else condition.setBuildPermitted(Global.NO);
// 保存至列表
this.taskConditions.add(condition);
}
}
}
}
private static SimpleDateFormat datetimeFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private static SimpleDateFormat dateFormatter = new SimpleDateFormat("yyyy-MM-dd");
......
package com.gic.cloud.data.hook.service.init;
import com.gic.cloud.data.hook.api.service.IFlatQueryResultService;
import com.gic.cloud.data.hook.api.service.IFreeQueryService;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.stereotype.Component;
@Component
public class MyApplicationContextAware implements ApplicationContextAware {
private Logger log = LogManager.getLogger(MyApplicationContextAware.class);
@Autowired
private IFreeQueryService freeQueryService;
@Autowired
private IFlatQueryResultService flatQueryResultService;
@Override
public void setApplicationContext(ApplicationContext appContext) throws BeansException {
this.freeQueryService.initTask();
this.flatQueryResultService.initTask();
log.info("任务初始化");
}
}
......@@ -24,7 +24,10 @@
t.amount,
t.query_data_type,
t.real_sql,
t.report_id
t.report_id,
t.desensi_type,
t.download_condition,
t.apply_permitted
</sql>
......@@ -94,6 +97,22 @@
#{userName}
)
</insert>
<select id="listUnDownloadTask" resultType="DownloadRecord">
SELECT
id,
enterprise_id,
name AS "task_name",
module_name,
amount,
query_data_type,
real_sql,
report_id,
desensi_type,
download_condition,
apply_permitted
FROM
dh_download_task
WHERE query_data_source = #{source} and status = 'waiting'
</select>
</mapper>
\ No newline at end of file
......@@ -104,7 +104,9 @@
real_sql,
enterprise_id,
report_id,
del_flag
del_flag,
desensi_type,
download_condition
) VALUES (
#{id},
#{userId},
......@@ -125,7 +127,9 @@
#{realSql},
#{enterpriseId},
#{reportId},
'0'
'0',
#{desensiType},
#{downloadCondition }
)
</insert>
......
......@@ -20,7 +20,8 @@
q.download_count,
f.is_favo,
q.auth_store_id,
q.auth_desc
q.auth_desc,
q.last_update_time
</sql>
<sql id="queryJoins">
......
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