Browse Source

Merge remote-tracking branch 'remotes/origin/dev_project_real_time_statistics' into dev_temp

master
jianjun 4 years ago
parent
commit
8908fc7dd4
  1. 87
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/TestController.java

87
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/modules/group/controller/TestController.java

@ -0,0 +1,87 @@
/**
* Copyright 2018 人人开源 https://www.renren.io
* <p>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* <p>
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* <p>
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.epmet.modules.group.controller;
import com.alibaba.fastjson.JSON;
import com.epmet.commons.tools.scan.param.TextScanParamDTO;
import com.epmet.commons.tools.scan.param.TextTaskDTO;
import com.epmet.commons.tools.scan.result.SyncScanResult;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.utils.ScanContentUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
* 群组信息表
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-03-28
*/
@RestController
@RequestMapping("test")
public class TestController {
/**
* 小组管理-设置是否允许参观
* @author zhaoqifeng
* @date 2021/4/7 13:50
* @param formDTO
* @return com.epmet.commons.tools.utils.Result
*/
@RequestMapping("scan")
public Result setVisitSwitch(@RequestParam String content){
String url = "https://epmet-dev.elinkservice.cn/api/epmetscan/api/textSyncScan";
TextTaskDTO p = new TextTaskDTO();
p.setDataId("1");
String content1 = "开着房车去旅行,已经成了不少人出游的新方式。临近“五一”,房车租赁市场持续火爆,尽管价格比平时贵了不少,可仍一车难求。\n" +
"\n" +
"“临近‘五一’,想开一辆房车拉着一家人去草原旅游,没想到一周前就已经租不到车了。”读者刘先生说,最近一段时间,他总是在一些短视频平台上看到有人开着房车出门旅行的视频。眼下春暖花开,正是出游的好时节,开上一辆房车,不仅节省了住宿费,还能体验一种不同的出行方式。不过,这周起刘先生搜索相关的房车租赁信息时,却发现不少房车租赁公司已经是一车难求了。\n" +
"在某房车租车软件上记者发现,位于房山和顺义的两个取车还车点,五一期间的全部车型已经被租赁一空。而在另一家房车租赁公司的价格目录里,明确标注了租赁价格分为平时价和节假日价,后者是前者的1.2倍。\n" +
"\n" +
"“‘五一’期间,北京的房车租赁情况很紧张,目前只剩一台东风了,你可以考虑一下。”一家房车租赁公司的工作人员介绍,他们公司规定“五一”期间租赁时间为五天起租,仅剩的东风车型每天的租金在1278元。“‘五一’期间的价格会比平时高一些,我建议您在5月6日之后租,一方面没有租赁时长的限制,另一方面租金会便宜不少,每天也就900多元。";
if (StringUtils.isBlank(content)){
p.setContent(content1);
}else{
p.setContent(content);
}
List<TextTaskDTO> list = new ArrayList<>();
list.add(p);
TextScanParamDTO param = new TextScanParamDTO();
param.setTasks(list);
Result<SyncScanResult> imgSyncScanResult = ScanContentUtils.textSyncScan(url, param);
System.out.println("==================="+ JSON.toJSONString(imgSyncScanResult));
SyncScanResult result = new SyncScanResult();
if (imgSyncScanResult != null){
SyncScanResult imgSyncScanResultData = imgSyncScanResult.getData();
if (imgSyncScanResult.success()&&imgSyncScanResultData.isAllPass()) {
result.setAllPass(imgSyncScanResultData.isAllPass());
result.getSuccessDataIds().addAll(imgSyncScanResultData.getSuccessDataIds());
result.getFailDataIds().addAll(imgSyncScanResultData.getFailDataIds());
System.out.println("================"+JSON.toJSONString(result));
}
}
return new Result().ok(result);
}
}
Loading…
Cancel
Save