Commit 5f3b0684 authored by “yiyousong”'s avatar “yiyousong”
parents 8d594ce8 fb97430a
......@@ -46,12 +46,16 @@ public class MatterTypeHtmlParseUtil {
if (elements.size() > 0) {
Integer total = elements.get(0) == null ? 0 : DataUtil.converStr2Int(elements.get(0).attr("value"), 0);
resultMap.put("total", total);
} else {
resultMap.put("total", 0);
}
elements = dom.selectXpath(matterPageExp);
if (elements.size() > 0) {
Integer pageNum = elements.get(0) == null ? 0 : DataUtil.converStr2Int(elements.get(0).attr("value"), 0);
resultMap.put("pageNum", pageNum);
} else {
resultMap.put("pageNum", 0);
}
} catch (Exception e) {
......@@ -79,12 +83,16 @@ public class MatterTypeHtmlParseUtil {
if (elements.size() > 0) {
Integer total = elements.get(0) == null ? 0 : DataUtil.converStr2Int(elements.get(0).attr("value"), 0);
resultMap.put("total", total);
} else {
resultMap.put("total", 0);
}
elements = dom.selectXpath(matterPageExp);
if (elements.size() > 0) {
Integer pageNum = elements.get(0) == null ? 0 : DataUtil.converStr2Int(elements.get(0).attr("value"), 0);
resultMap.put("pageNum", pageNum);
} else {
resultMap.put("pageNum", 0);
}
} catch (Exception e) {
......@@ -315,7 +323,7 @@ public class MatterTypeHtmlParseUtil {
continue;
}
String title = element.attr("title");
String href = element.attr("href");
String href = element.attr("href");
/* String onclick = element.attr("onclick");
String href = StrUtil.subBetween(onclick, "ywblurl('", "',");
if (ObjectUtils.isEmpty(href)) {
......
......@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import com.mortals.framework.common.Rest;
import com.mortals.framework.model.Context;
import com.mortals.xhx.ManagerBaseApplication;
import com.mortals.xhx.common.code.DxTypeEnum;
import com.mortals.xhx.common.code.SourceEnum;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.module.area.model.AreaEntity;
......@@ -104,7 +105,7 @@ public class SyncGovMatterDetailThread implements Runnable {
log.info("同步站点主题事项开始.....");
//判断站点区域乡镇情况
if(areaEntity.getAreaLevel()<=3){
if (areaEntity.getAreaLevel() <= 3) {
//省,市,区
Rest<String> themeRest = siteThemeService.syncThemeBySiteId(siteEntity, context);
log.info("同步站点主题:" + JSON.toJSONString(themeRest));
......@@ -115,15 +116,18 @@ public class SyncGovMatterDetailThread implements Runnable {
log.info("同步站点法人主题事项开始.....");
Rest<String> frRest = siteThemeMatterService.syncThemeMatterBySiteId(siteEntity.getId(), "3", context);
log.info("同步站点主题法人事项:" + JSON.toJSONString(frRest));
}else if(areaEntity.getAreaLevel()>3){
} else if (areaEntity.getAreaLevel() > 3) {
//街道,镇,乡
Rest<String> themeTownRest = siteThemeService.syncTownThemeBySiteId(siteEntity, context);
log.info("同步乡镇站点主题:" + JSON.toJSONString(themeTownRest));
siteThemeMatterService.deleteGovBySiteId(siteEntity.getId(), context);
String dxType = DxTypeEnum.街道镇服务.getValue();
if (areaEntity.getAreaLevel() == 5) {
dxType = DxTypeEnum.乡村服务.getValue();
}
Rest<String> townThemeRest = siteThemeMatterService.syncTownThemeMatterBySiteId(siteEntity, dxType, context);
log.info("同步站点乡镇主题事项:" + JSON.toJSONString(townThemeRest));
}
log.info("同步站点事项结束.....");
}
}
......@@ -79,7 +79,7 @@ public class AppVersionController extends BaseCRUDJsonBodyMappingController<AppV
/**
* app历史版本使用
*/
@PostMapping(value = "used")
@GetMapping(value = "used")
public Rest<String> used(Long appVersionId) {
String busiDesc = this.getModuleDesc() + "自助服务应用使用";
Rest<String> rest = Rest.ok(busiDesc + " 【成功】");
......
......@@ -2,6 +2,7 @@ package com.mortals.xhx.module.site.service;
import com.mortals.framework.common.Rest;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.site.model.SiteEntity;
import com.mortals.xhx.module.site.model.SiteThemeMatterEntity;
/**
* SiteThemeMatterService
......@@ -15,5 +16,7 @@ public interface SiteThemeMatterService extends ICRUDService<SiteThemeMatterEnti
Rest<String> syncThemeMatterBySiteId(Long siteId,String userType, Context context);
Rest<String> syncTownThemeMatterBySiteId(SiteEntity siteEntity,String dxType, Context context);
void deleteGovBySiteId(Long siteId, Context context);
}
\ No newline at end of file
......@@ -48,7 +48,7 @@ public class SiteThemeMatterServiceImpl extends AbstractCRUDServiceImpl<SiteThem
@Override
public Rest<String> syncThemeMatterBySiteId(Long siteId,String userType, Context context) {
public Rest<String> syncThemeMatterBySiteId(Long siteId, String userType, Context context) {
String url = GlobalSysInfo.getParamValue(Constant.GOV_MATTER_PAGELIST_URL, "http://www.sczwfw.gov.cn/jiq/interface/item/tags");
SiteEntity siteEntity = siteService.get(siteId, context);
if (ObjectUtils.isEmpty(siteEntity)) {
......@@ -67,7 +67,7 @@ public class SiteThemeMatterServiceImpl extends AbstractCRUDServiceImpl<SiteThem
//获取主题重量
Rest<Map<String, Integer>> themeMatterRest = MatterTypeHtmlParseUtil.getThemeMatterPage(params, url);
Integer totalTheme = themeMatterRest.getData().get("total");
Integer sum=0;
Integer sum = 0;
//个人服务或法人服务
List<SiteThemeEntity> siteThemeEntities = siteThemeService.find(new SiteThemeQuery().siteId(siteId).userType(userType));
......@@ -81,14 +81,14 @@ public class SiteThemeMatterServiceImpl extends AbstractCRUDServiceImpl<SiteThem
int count = 0;
for (int i = 1; i <= pageNum; i++) {
params.put("pageno", String.valueOf(i));
Rest<List<MatterEntity>> restList=null;
if(userType=="2"){
restList = MatterTypeHtmlParseUtil.getGrThemeMatterList(params, url);
}else if(userType=="3"){
Rest<List<MatterEntity>> restList = null;
if (userType == "2") {
restList = MatterTypeHtmlParseUtil.getGrThemeMatterList(params, url);
} else if (userType == "3") {
restList = MatterTypeHtmlParseUtil.getFrThemeMatterList(params, url);
}
if (!ObjectUtils.isEmpty(restList)&&restList.getCode() == YesNoEnum.YES.getValue()) {
if (!ObjectUtils.isEmpty(restList) && restList.getCode() == YesNoEnum.YES.getValue()) {
allList.addAll(restList.getData());
count += restList.getData().size();
}
......@@ -97,7 +97,7 @@ public class SiteThemeMatterServiceImpl extends AbstractCRUDServiceImpl<SiteThem
log.info(String.format("服务获取数量异常,count:%s,total:%s,theme:%s", count, total, item.getThemeName()));
}
}
sum+=allList.size();
sum += allList.size();
if (!ObjectUtils.isEmpty(allList)) {
//当前主题列表 查找站点事项id列表,保存站点主题事项
List<String> matterCodeList = allList.stream().map(m -> m.getMatterNo()).collect(Collectors.toList());
......@@ -105,7 +105,7 @@ public class SiteThemeMatterServiceImpl extends AbstractCRUDServiceImpl<SiteThem
siteMatterQuery.setSiteId(siteId);
siteMatterQuery.setMatterCodeList(matterCodeList);
List<SiteMatterEntity> siteMatterEntities = siteMatterService.find(siteMatterQuery, context);
log.info(String.format("size1:%s,size2:%s",allList.size(),siteMatterEntities.size()));
log.info(String.format("size1:%s,size2:%s", allList.size(), siteMatterEntities.size()));
if (!ObjectUtils.isEmpty(siteMatterEntities)) {
List<SiteThemeMatterEntity> collect = siteMatterEntities.stream().map(siteMatterEntity -> {
SiteThemeMatterEntity siteThemeMatterEntity = new SiteThemeMatterEntity();
......@@ -130,6 +130,41 @@ public class SiteThemeMatterServiceImpl extends AbstractCRUDServiceImpl<SiteThem
return Rest.ok("主题更新完成");
}
@Override
public Rest<String> syncTownThemeMatterBySiteId(SiteEntity siteEntity, String dxType, Context context) {
String url = GlobalSysInfo.getParamValue(Constant.GOV_MATTER_PAGELIST_URL, "http://www.sczwfw.gov.cn/jiq/interface/item/tags");
HashMap<String, String> params = new HashMap<>();
params.put("dxType", dxType);
params.put("areaCode", siteEntity.getAreaCode());
List<SiteThemeEntity> siteThemeEntities = siteThemeService.find(new SiteThemeQuery().siteId(siteEntity.getId()));
for (SiteThemeEntity item : siteThemeEntities) {
params.put("theme", item.getThemeCode());
params.put("userType", item.getUserType());
List<MatterEntity> allList = new ArrayList<>();
Rest<Map<String, Integer>> themeMatterPageRest = MatterTypeHtmlParseUtil.getTownThemeMatterPage(params, url);
Integer pageNum = themeMatterPageRest.getData().get("pageNum");
Integer total = themeMatterPageRest.getData().get("total");
if (pageNum > 0 && total > 0) {
int count = 0;
for (int i = 1; i <= pageNum; i++) {
params.put("pageno", String.valueOf(i));
Rest<List<MatterEntity>> restList = MatterTypeHtmlParseUtil.getTownThemeMatterList(params, url);
if (restList.getCode() == YesNoEnum.YES.getValue()) {
allList.addAll(restList.getData());
count += restList.getData().size();
}
}
if (count != total) {
log.info(String.format("获取数量异常,count:%s,total:%s,theme:%s", count, total, item.getThemeName()));
}
}
}
return Rest.ok("乡镇主题更新完成");
}
@Override
public void deleteGovBySiteId(Long siteId, Context context) {
Map<String, Object> condition = new HashMap<>();
......
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