Browse Source

Merge remote-tracking branch 'remotes/origin/dev_data_stats' into dev

dev
jianjun 5 years ago
parent
commit
ce786ed4cc
  1. 6
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsPublicityController.java
  2. 42
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsPublicityService.java
  3. 23
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java
  4. 8
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsPublicityTaskService.java
  5. 2
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagUsedMonthlyStatsTask.java
  6. 2
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagUsedQuarterlyAndYearlyStatsTask.java
  7. 2
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagViewedMonthlyStatsTask.java
  8. 6
      epmet-module/gov-voice/gov-voice-server/pom.xml
  9. 4
      epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SuggestionEnum.java
  10. 1
      epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SysResponseEnum.java
  11. 104
      epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java

6
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/controller/StatsPublicityController.java

@ -40,7 +40,7 @@ public class StatsPublicityController {
}
/**
* desc: 统计发表文章最多的分类 包含 机关 部门 网格
* desc: 统计标签被使用次数 包含 机关 部门 网格
*
* @param formDTO 默认为T-1天如果传 则统计的是formDTO的数据
* @return
@ -52,7 +52,7 @@ public class StatsPublicityController {
}
/**
* desc:, 统计发表文章最多的分类 包含 机关 部门 网格
* desc:, 统计标签被使用次数 包含 机关 部门 网格
*
* @param formDTO 默认为T-1天如果传 则统计的是formDTO的数据
* @return
@ -64,7 +64,7 @@ public class StatsPublicityController {
}
/**
* desc: 统计发表文章最多的分类 包含 机关 部门 网格
* desc: 统计标签被使用次数 包含 机关 部门 网格
*
* @param formDTO 默认为T-1天如果传 则统计的是formDTO的数据
* @return

42
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/StatsPublicityService.java

@ -4,74 +4,74 @@ package com.epmet.service;
import com.epmet.dto.StatsFormDTO;
public interface StatsPublicityService {
/**
* desc: 统计宣传能力的汇总信息
*
* @return: Boolean
* @date: 2020/6/17 16:11
* @author: jianjun liu
* @param statsDate
*/
Boolean articleSummaryDailyStatsjob(StatsFormDTO statsDate);
/**
* desc: 统计宣传能力的汇总信息
*
* @param formDTO
* @return: Boolean
* @date: 2020/6/17 16:11
* @author: jianjun liu
*/
Boolean articleSummaryDailyStatsjob(StatsFormDTO formDTO);
/**
* desc: 按日 统计每个标签被引用的使用文章数
*
* @param formDTO
* @return: Boolean
* @date: 2020/6/17 16:11
* @author: jianjun liu
* @param statsDate
*/
Boolean tagUsedDailyStatsjob(StatsFormDTO statsDate);
Boolean tagUsedDailyStatsjob(StatsFormDTO formDTO);
/**
* desc: 按月 统计每个标签被引用的使用文章数
*
* @param
* @param statsDate
* @param formDTO
* @return:
* @date: 2020/6/19 18:44
* @author: jianjun liu
*/
Boolean tagUsedMonthlyStatsjob(StatsFormDTO statsDate);
Boolean tagUsedMonthlyStatsjob(StatsFormDTO formDTO);
/**
* desc: 按季年统计标签被使用次数
*
* @param statsDate
* @param formDTO
* @return:
* @date: 2020/6/20 10:44
* @author: jianjun liu
*/
Boolean tagUsedQuarterlyStatsjob(StatsFormDTO statsDate);
Boolean tagUsedQuarterlyStatsjob(StatsFormDTO formDTO);
/**
* desc: 按日 统计每个标签的阅读数
*
* @param statsDate
* @param formDTO
* @return: Boolean
* @date: 2020/6/20 8:40
* @author: jianjun liu
*/
Boolean tagViewedDailyStatsjob(StatsFormDTO statsDate);
Boolean tagViewedDailyStatsjob(StatsFormDTO formDTO);
/**
* desc: 按月统计标签被查看次数
*
* @param statsDate
* @param formDTO
* @return:
* @date: 2020/6/20 10:44
* @author: jianjun liu
*/
Boolean tagViewedMonthlyStatsjob(StatsFormDTO statsDate);
Boolean tagViewedMonthlyStatsjob(StatsFormDTO formDTO);
/**
* desc: 按季年统计标签被查看次数
*
* @param statsDate
* @param formDTO
* @return:
* @date: 2020/6/20 10:44
* @author: jianjun liu
*/
Boolean tagViewedQuarterlyStatsjob(StatsFormDTO statsDate);
Boolean tagViewedQuarterlyStatsjob(StatsFormDTO formDTO);
}

23
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/service/impl/StatsPublicityServiceImpl.java

@ -198,6 +198,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
if (null != formDTO && StringUtils.isNotBlank(formDTO.getCustomerId())) {
try {
log.info("tagUsedMonthlyStatsjob execute by customerId:{},dateId:{}", formDTO.getCustomerId(), dimIdBean.getDateId());
statsTagUsedMonthly(dimIdBean.getMonthId(), formDTO.getCustomerId());
} catch (Exception e) {
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "tagUsedMonthlyStatsjob", formDTO.getCustomerId(), dimIdBean.getMonthId()), e);
@ -206,6 +207,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
int pageNo = NumConstant.ONE;
int pageSize = NumConstant.ONE_HUNDRED;
List<String> customerIdList = null;
log.info("tagUsedMonthlyStatsjob execute all customerId,dateId:{}", dimIdBean.getDateId());
do {
customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize);
if (!CollectionUtils.isEmpty(customerIdList)) {
@ -228,6 +230,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(statsDate);
if (null != formDTO && StringUtils.isNotBlank(formDTO.getCustomerId())) {
try {
log.info("tagViewedDailyStatsjob execute by customerId:{},dateId:{}", formDTO.getCustomerId(), dimIdBean.getDateId());
statsTagViewedDaily(statsDate, dimIdBean, formDTO.getCustomerId());
} catch (Exception e) {
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "tagViewedDailyStatsjob", formDTO.getCustomerId(), dimIdBean.getMonthId()), e);
@ -236,6 +239,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
int pageNo = NumConstant.ONE;
int pageSize = NumConstant.ONE_HUNDRED;
List<String> customerIdList = null;
log.info("tagViewedDailyStatsjob execute all customerId,dateId:{}", dimIdBean.getDateId());
do {
customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize);
if (!CollectionUtils.isEmpty(customerIdList)) {
@ -259,6 +263,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(statsDate);
if (null != formDTO && StringUtils.isNotBlank(formDTO.getCustomerId())) {
try {
log.info("tagViewedMonthlyStatsjob execute by customerId:{},dateId:{}", formDTO.getCustomerId(), dimIdBean.getDateId());
statsTagViewedMonthly(dimIdBean.getMonthId(), formDTO.getCustomerId());
} catch (Exception e) {
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "tagViewedMonthlyStatsjob", formDTO.getCustomerId(), dimIdBean.getDateId()), e);
@ -267,6 +272,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
int pageNo = NumConstant.ONE;
int pageSize = NumConstant.ONE_HUNDRED;
List<String> customerIdList = null;
log.info("tagViewedMonthlyStatsjob execute all customerId,dateId:{}", dimIdBean.getDateId());
do {
customerIdList = dimCustomerService.selectCustomerIdPage(pageNo++, pageSize);
if (!CollectionUtils.isEmpty(customerIdList)) {
@ -289,6 +295,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(statsDate);
if (null != formDTO && StringUtils.isNotBlank(formDTO.getCustomerId())) {
try {
log.info("tagUsedQuarterlyStatsjob execute by customerId:{},dateId:{}", formDTO.getCustomerId(), dimIdBean.getDateId());
try {
log.debug("start === statsTagUsedQuarterly ");
statsTagUsedQuarterly(dimIdBean.getQuarterId(), formDTO.getCustomerId());
@ -305,6 +312,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "tagViewedMonthlyStatsjob", formDTO.getCustomerId(), dimIdBean.getDateId()), e);
}
} else {
log.info("tagUsedQuarterlyStatsjob execute all customerId,dateId:{}", dimIdBean.getDateId());
int pageNo = NumConstant.ONE;
int pageSize = NumConstant.ONE_HUNDRED;
List<String> customerIdList = null;
@ -336,6 +344,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
Date statsDate = getStatsDateFromParam(formDTO);
DimIdGenerator.DimIdBean dimIdBean = DimIdGenerator.getDimIdBean(statsDate);
if (null != formDTO && StringUtils.isNotBlank(formDTO.getCustomerId())) {
log.info("tagViewedQuarterlyStatsjob execute by customerId:{},dateId:{}", formDTO.getCustomerId(), dimIdBean.getDateId());
try {
log.debug("start === statsTagViewedQuarterly ");
statsTagViewedQuarterly(dimIdBean.getQuarterId(), formDTO.getCustomerId());
@ -349,6 +358,7 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsTagViewedQuarterly", formDTO.getCustomerId(), dimIdBean.getYearId()), e);
}
} else {
log.info("tagViewedQuarterlyStatsjob execute all customerId,dateId:{}", dimIdBean.getDateId());
int pageNo = NumConstant.ONE;
int pageSize = NumConstant.ONE_HUNDRED;
List<String> customerIdList = null;
@ -474,7 +484,6 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
}
boolean b = factArticlePublishedGridDailyService.deleteAndInsertBatch(customerId, dimIdBean.getDateId(), gridDailyEntityMap.values());
} catch (Exception e) {
e.printStackTrace();
log.error(String.format(ProjectConstant.STATS_FAILED_PREFIX, "statsPublishedGridDaily", customerId, statsDate), e);
}
}
@ -560,14 +569,10 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
*
* @param statsDate
* @param dimIdBean
* @param customerId
* @param customerId remark:获取当天发布的文章数据然后根据文章标签 进行统计加上默认标签的数量 没有则为0
*/
private void statsTagUsedDaily(Date statsDate, DimIdGenerator.DimIdBean dimIdBean, String customerId) {
//1.业务数据来源 发布时间为统计时间的
// 因为一个客户的发布文章数在同一天不会特别的多,所以以客户为单位查询今天发布的所有带有标签的文章 根据发布单位类型进行拆分
// 1.1查出今天所有的文章标签 根据网格Id
// 1.2
//获取所有网格
List<DimAgencyEntity> agencyDTOList = dimAgencyService.getAgencyListByCustomerId(customerId);
if (CollectionUtils.isEmpty(agencyDTOList)) {
@ -715,14 +720,10 @@ public class StatsPublicityServiceImpl implements StatsPublicityService {
*
* @param statsDate
* @param dimIdBean
* @param customerId
* @param customerId remark:根据统计时间的阅读文章记录然后根据文章Id获取到对应的标签 然后 进行统计
*/
private void statsTagViewedDaily(Date statsDate, DimIdGenerator.DimIdBean dimIdBean, String customerId) {
//1.业务数据来源 发布时间为统计时间的
// 因为一个客户的发布文章数在同一天不会特别的多,所以以客户为单位查询今天发布的所有带有标签的文章 根据发布单位类型进行拆分
// 1.1查出今天所有的文章标签 根据网格Id
// 1.2
//获取所有机关 用于后面想上级添加数据
List<DimAgencyEntity> agencyDTOList = dimAgencyService.getAgencyListByCustomerId(customerId);
if (CollectionUtils.isEmpty(agencyDTOList)) {

8
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/service/StatsPublicityTaskService.java

@ -22,7 +22,7 @@ public interface StatsPublicityTaskService {
Result articleSummaryDailyStatsjob(StatsFormDTO formDTO);
/**
* desc: 定时任务 统计文章总数及在线文章总 包含 机关 部门 网格
* desc: 定时任务 统计标签被使用次 包含 机关 部门 网格
*
* @return:
* @date: 2020/6/22 9:09
@ -31,7 +31,7 @@ public interface StatsPublicityTaskService {
Result tagUsedDailyStatsjob(StatsFormDTO formDTO);
/**
* desc: 统计发表文章最多的分类 包含 机关 部门 网格
* desc: 统计标签被使用次数包含 机关 部门 网格
*
* @date: 2020/6/22 9:09
* @author: jianjun liu
@ -39,7 +39,7 @@ public interface StatsPublicityTaskService {
Result tagUsedMonthlyStatsjob(StatsFormDTO formDTO);
/**
* desc: 统计发表文章最多的分类 包含 机关 部门 网格
* desc: 统计标签被使用次数 包含 机关 部门 网格
*
* @date: 2020/6/22 9:09
* @author: jianjun liu
@ -55,7 +55,7 @@ public interface StatsPublicityTaskService {
Result tagViewedDailyStatsjob(StatsFormDTO formDTO);
/**
* desc: 统计阅读最多的标签 包含 机关 网格
* desc: 统计阅读最多的标签 包含 机关 网格
*
* @date: 2020/6/22 9:09
* @author: jianjun liu

2
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagUsedMonthlyStatsTask.java

@ -11,7 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* desc:标签被使用次数 统计定时任务
* desc:标签被使用次数 统计定时任务
*/
@Component("publicityTagUsedMonthlyStatsTask")
public class PublicityTagUsedMonthlyStatsTask implements ITask {

2
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagUsedQuarterlyAndYearlyStatsTask.java

@ -11,7 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* desc:标签被使用次数 统计定时任务
* desc:标签被使用次数 统计定时任务
*/
@Component("publicityTagUsedQuarterlyAndYearlyStatsTask")
public class PublicityTagUsedQuarterlyAndYearlyStatsTask implements ITask {

2
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/task/PublicityTagViewedMonthlyStatsTask.java

@ -11,7 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* desc:标签被阅读次数 统计定时任务
* desc:标签被阅读次数 统计定时任务
*/
@Component("publicityTagViewedMonthlyStatsTask")
public class PublicityTagViewedMonthlyStatsTask implements ITask {

6
epmet-module/gov-voice/gov-voice-server/pom.xml

@ -134,7 +134,7 @@
<nacos.ip/>
<spring.flyway.enabled>false</spring.flyway.enabled>
<openapi.scan.server.url>https://epmet-dev.elinkservice.cn/epmetscan/api</openapi.scan.server.url>
<openapi.scan.server.url>https://epmet-dev.elinkservice.cn/api/epmetscan/api</openapi.scan.server.url>
</properties>
</profile>
<profile>
@ -167,7 +167,7 @@
<nacos.ip/>
<spring.flyway.enabled>true</spring.flyway.enabled>
<openapi.scan.server.url>https://epmet-dev.elinkservice.cn/epmetscan/api</openapi.scan.server.url>
<openapi.scan.server.url>https://epmet-dev.elinkservice.cn/api/epmetscan/api</openapi.scan.server.url>
</properties>
</profile>
<profile>
@ -197,7 +197,7 @@
<nacos.ip/>
<spring.flyway.enabled>true</spring.flyway.enabled>
<openapi.scan.server.url>https://epmet-open.elinkservice.cn:7040/epmetscan/api</openapi.scan.server.url>
<openapi.scan.server.url>https://epmet-open.elinkservice.cn/api/epmetscan/api</openapi.scan.server.url>
</properties>
</profile>
</profiles>

4
epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SuggestionEnum.java

@ -4,14 +4,14 @@ import java.util.ArrayList;
import java.util.List;
/**
* desc:文本检测建议
* desc:检测建议
* @author jianjun liu
* @date 2020-06-04 21:39
**/
public enum SuggestionEnum {
PASS("pass", "正常"),
REVIEW("review", "需要人工审核"),
BLOCK("block", "文本违规");
BLOCK("block", "内容违规");
private String code;
private String desc;

1
epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/common/enu/SysResponseEnum.java

@ -2,7 +2,6 @@ package com.epmet.openapi.scan.common.enu;
/**
* @author jianjun liu
* @email liujianjun@yunzongnet.com
* @date 2020-06-04 21:39
**/
public enum SysResponseEnum {

104
epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/service/impl/ScanServiceImpl.java

@ -4,8 +4,6 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.aliyuncs.AcsRequest;
import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.exceptions.ServerException;
import com.aliyuncs.green.model.v20180509.ImageAsyncScanRequest;
import com.aliyuncs.green.model.v20180509.ImageSyncScanRequest;
import com.aliyuncs.green.model.v20180509.TextScanRequest;
@ -162,7 +160,7 @@ public class ScanServiceImpl implements ScanService {
imageAsyncScanRequest.setReadTimeout(6000);
try {
ImgAsyncScanResult scanResult = executeAsyncImg(imageAsyncScanRequest);
ImgAsyncScanResult scanResult = null;//executeAsyncImg(imageAsyncScanRequest);
return new Result<ImgAsyncScanResult>().ok(scanResult);
} catch (Exception e) {
log.error("sendImgScan execute Exception", e);
@ -177,98 +175,52 @@ public class ScanServiceImpl implements ScanService {
if (httpResponse.isSuccess()) {
JSONObject scrResponse = JSON.parseObject(new String(httpResponse.getHttpContent(), SysConstant.UTF8));
//System.out.println(JSON.toJSONString(scrResponse, true));
if (HttpStatus.SC_OK == scrResponse.getInteger(SysConstant.CODE)) {
//任务 列表
List<ScanTaskResult> scanTaskResults = scrResponse.getJSONArray(SysConstant.DATA).toJavaList(ScanTaskResult.class);
for (ScanTaskResult taskResult : scanTaskResults) {
result.getDetails().add(taskResult);
//又根据场景不同
if (HttpStatus.SC_OK == taskResult.getCode()) {
//如果是多个场景 则为对个 BaseScanResult
List<SceneDetailResult> sceneResults = taskResult.getResults();
//是文本检测 目前就一种场景
boolean isSuccess = true;
for (SceneDetailResult sceneResult : sceneResults) {
String suggestion = sceneResult.getSuggestion();
if (SuggestionEnum.PASS.getCode().equals(suggestion)) {
isSuccess = false;
break;
}
}
if (isSuccess){
if (HttpStatus.SC_OK != taskResult.getCode()) {
if (!result.getFailDataIds().contains(taskResult.getDataId())) {
result.getFailDataIds().add(taskResult.getDataId());
} else {
result.getSuccessDataIds().add(taskResult.getDataId());
log.warn("executeSyncText task process fail:code:{},result:{}", taskResult.getCode(), JSON.toJSONString(taskResult));
}
continue;
}
//如果是多个场景 则为对个 BaseScanResult
List<SceneDetailResult> sceneResults = taskResult.getResults();
//是文本检测 目前就一种场景
boolean isSuccess = true;
for (SceneDetailResult sceneResult : sceneResults) {
String suggestion = sceneResult.getSuggestion();
if (SuggestionEnum.BLOCK.getCode().equals(suggestion)) {
isSuccess = false;
break;
}
}
if (isSuccess) {
result.getSuccessDataIds().add(taskResult.getDataId());
} else {
log.warn("executeSyncText dataId:{} block:{}", taskResult.getDataId(), JSON.toJSONString(taskResult.getResults()));
result.getFailDataIds().add(taskResult.getDataId());
log.warn("executeSyncText task process fail:code:{},msg:{}", taskResult.getCode(), taskResult.getMsg());
throw new ExeCuteHttpException(" executeSyncTexttask process fail:code:" + taskResult.getCode() + ",msg:" + taskResult.getMsg());
}
}
return result;
} else {
log.warn("executeSyncText response not success. code:{}", scrResponse.getInteger(SysConstant.CODE));
throw new ExeCuteHttpException("executeSyncText detect not success. code:" + scrResponse.getInteger(SysConstant.CODE));
}
} else {
log.warn("executeSyncText response not success. status:" + httpResponse.getStatus());
log.warn("executeSyncText response not success. status:{}", httpResponse.getStatus());
throw new ExeCuteHttpException("response not success. status:" + httpResponse.getStatus());
}
} catch (Exception e) {
log.warn("executeSyncImg exception", e);
log.warn("executeSyncText exception", e);
throw new ExeCuteHttpException(SysResponseEnum.EXCEPTION.getCode(), SysResponseEnum.EXCEPTION.getMsg());
}
}
/**
* desc:异步 检查图片 TODO 结果处理
*
* @param request
* @return
*/
private ImgAsyncScanResult executeAsyncImg(AcsRequest<?> request) {
ImgAsyncScanResult result = new ImgAsyncScanResult();
try {
HttpResponse httpResponse = IAcsClientUtil.getIAcsClient().doAction(request);
if (httpResponse.isSuccess()) {
JSONObject scrResponse = JSON.parseObject(new String(httpResponse.getHttpContent(), SysConstant.UTF8));
//System.out.println(JSON.toJSONString(scrResponse, true));
if (HttpStatus.SC_OK == scrResponse.getInteger(SysConstant.CODE)) {
JSONArray taskResults = scrResponse.getJSONArray(SysConstant.DATA);
for (Object taskResult : taskResults) {
if (HttpStatus.SC_OK == ((JSONObject) taskResult).getInteger(SysConstant.CODE)) {
String taskId = ((JSONObject) taskResult).getString("taskId");
// 将taskId 保存下来,间隔一段时间来轮询结果, 参照ImageAsyncScanResultsRequest
result.getSuccessTaskIds().add(taskId);
} else {
String taskId = ((JSONObject) taskResult).getString("taskId");
result.getFailTaskIds().add(taskId);
log.warn("task process fail:{}", ((JSONObject) taskResult).getInteger(SysConstant.CODE));
continue;
}
}
return result;
} else {
System.out.println("detect not success. code:" + scrResponse.getInteger(SysConstant.CODE));
throw new ExeCuteHttpException("detect not success. code:" + scrResponse.getInteger(SysConstant.CODE));
}
} else {
System.out.println("response not success. status:" + httpResponse.getStatus());
throw new ExeCuteHttpException("response not success. status:" + httpResponse.getStatus());
}
} catch (ServerException e) {
e.printStackTrace();
} catch (ClientException e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return result;
}
private SyncScanResult executeSyncImg(AcsRequest<?> request) {
SyncScanResult result = new SyncScanResult();
try {
@ -283,6 +235,7 @@ public class ScanServiceImpl implements ScanService {
if (HttpStatus.SC_OK != taskResult.getCode()) {
if (!result.getFailDataIds().contains(taskResult.getDataId())) {
result.getFailDataIds().add(taskResult.getDataId());
log.warn("executeSyncImg detect not success. code:{},result:{}", taskResult.getCode(), JSON.toJSONString(taskResult));
}
continue;
}
@ -297,19 +250,20 @@ public class ScanServiceImpl implements ScanService {
break;
}
}
if (isSuccess){
if (isSuccess) {
result.getSuccessDataIds().add(taskResult.getDataId());
}else{
} else {
log.warn("executeSyncImg dataId:{} block:{}", taskResult.getDataId(), JSON.toJSONString(taskResult.getResults()));
result.getFailDataIds().add(taskResult.getDataId());
}
}
return result;
} else {
log.warn("executeSyncImg detect not success. code:", scrResponse.getInteger(SysConstant.CODE));
log.warn("executeSyncImg detect not success. code:{}", scrResponse.getInteger(SysConstant.CODE));
throw new ExeCuteHttpException("detect not success. code:" + scrResponse.getInteger(SysConstant.CODE));
}
} else {
log.warn("executeSyncImg response not success. status:" + httpResponse.getStatus());
log.warn("executeSyncImg response not success. status:{}", httpResponse.getStatus());
throw new ExeCuteHttpException("response not success. status:" + httpResponse.getStatus());
}
} catch (Exception e) {

Loading…
Cancel
Save