Commit 619a7bfe authored by 赵啸非's avatar 赵啸非

测试 事项查询

parent 0ee29257
...@@ -225,8 +225,7 @@ public class DemoWebApiController { ...@@ -225,8 +225,7 @@ public class DemoWebApiController {
@UnAuth @UnAuth
public Rest<String> testAllMatterPage(@RequestBody SiteEntity siteEntity) { public Rest<String> testAllMatterPage(@RequestBody SiteEntity siteEntity) {
StopWatch stopWatch = new StopWatch("stopwatch syncmatter"); StopWatch stopWatch = new StopWatch("stopwatch syncmatter");
log.info("开始查询事项=="); log.info("开始分页查询事项==");
stopWatch.start("开始同步事项方法");
MatterQuery matterQuery = new MatterQuery(); MatterQuery matterQuery = new MatterQuery();
matterQuery.setAreaCode(siteEntity.getAreaCode()); matterQuery.setAreaCode(siteEntity.getAreaCode());
matterQuery.setSource(SourceEnum.政务网.getValue()); matterQuery.setSource(SourceEnum.政务网.getValue());
...@@ -236,18 +235,21 @@ public class DemoWebApiController { ...@@ -236,18 +235,21 @@ public class DemoWebApiController {
if (!ObjectUtils.isEmpty(matterQuery.getSource())) { if (!ObjectUtils.isEmpty(matterQuery.getSource())) {
param.getCondition().put("source", matterQuery.getSource()); param.getCondition().put("source", matterQuery.getSource());
} }
int count = matterService.getDao().getMatterListByAreaCodeCount(param); int count = matterService.getDao().getMatterListByAreaCodeCount(param);
log.info("本地事项总数:{}", count);
ArrayList<MatterEntity> allList = new ArrayList<>(); ArrayList<MatterEntity> allList = new ArrayList<>();
if (count > 0) { if (count > 0) {
//分页获取 //分页获取
int pages = count / 500+1; int pages = count / 500+1;
for (int i = 1; i <= pages; i++) { for (int i = 1; i <= pages; i++) {
stopWatch.start("开始同步事项方法");
PageInfo pageInfo = new PageInfo(); PageInfo pageInfo = new PageInfo();
pageInfo.setCurrPage(i); pageInfo.setCurrPage(i);
pageInfo.setPrePageResult(500); pageInfo.setPrePageResult(500);
Result<MatterEntity> rest = matterService.getDao().getMatterListByAreaCodePage(matterQuery, pageInfo); Result<MatterEntity> rest = matterService.getDao().getMatterListByAreaCodePage(matterQuery, pageInfo);
allList.addAll(rest.getList()); allList.addAll(rest.getList());
stopWatch.stop();
log.info("本地事项总数:{},{}s", allList.size(), stopWatch.getLastTaskTimeMillis() / 1000);
} }
stopWatch.stop(); stopWatch.stop();
log.info("本地事项总数:{},{}s", allList.size(), stopWatch.getLastTaskTimeMillis() / 1000); log.info("本地事项总数:{},{}s", allList.size(), stopWatch.getLastTaskTimeMillis() / 1000);
...@@ -259,6 +261,27 @@ public class DemoWebApiController { ...@@ -259,6 +261,27 @@ public class DemoWebApiController {
} }
@PostMapping(value = "testAllMatterCount")
@UnAuth
public Rest<String> testAllMatterCount(@RequestBody SiteEntity siteEntity) {
StopWatch stopWatch = new StopWatch("stopwatch syncmatter");
log.info("开始分页查询事项==");
MatterQuery matterQuery = new MatterQuery();
matterQuery.setAreaCode(siteEntity.getAreaCode());
matterQuery.setSource(SourceEnum.政务网.getValue());
ParamDto param = new ParamDto();
param.getCondition().put("areaCode", matterQuery.getAreaCode());
if (!ObjectUtils.isEmpty(matterQuery.getSource())) {
param.getCondition().put("source", matterQuery.getSource());
}
int count = matterService.getDao().getMatterListByAreaCodeCount(param);
log.info("本地事项总数:{}", count);
return Rest.ok();
}
public static void main(String[] args) { public static void main(String[] args) {
System.out.println(1001/500); System.out.println(1001/500);
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
<property name="showSql" value="MySql" /> <property name="showSql" value="MySql" />
</plugin> </plugin>
<plugin interceptor="com.mortals.framework.thirty.mybatis.LogInterceptor"> <plugin interceptor="com.mortals.framework.thirty.mybatis.LogInterceptor">
<property name="enableExecutorTime" value="false" /> <property name="enableExecutorTime" value="true" />
<property name="showSql" value="false" /> <property name="showSql" value="false" />
</plugin> </plugin>
</plugins> </plugins>
......
...@@ -104,6 +104,25 @@ Content-Type: application/json ...@@ -104,6 +104,25 @@ Content-Type: application/json
} }
###test testAllMatter
POST {{baseUrl}}/test/testAllMatter
Content-Type: application/json
{
"areaCode":"511500000000"
}
###test testAllMatterPage
POST {{baseUrl}}/test/testAllMatterPage
Content-Type: application/json
{
"areaCode":"511500000000"
}
###testre ###testre
POST {{baseUrl}}/test/reDepts POST {{baseUrl}}/test/reDepts
Content-Type: application/json Content-Type: application/json
......
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