Commit 1333e894 authored by 赵啸非's avatar 赵啸非

添加部门事项过滤

parent 6a0f4015
...@@ -14,4 +14,7 @@ public class MidReq{ ...@@ -14,4 +14,7 @@ public class MidReq{
private String body; private String body;
private String path;
} }
package com.mortals.xhx.busiz.rsp;
import lombok.Data;
/**
* @author karlhoo
*/
@Data
public class MidResp {
private String appId;
private String appKey;
private String timeStamp;
private String nonce;
private String secretKey;
private String sign;
}
...@@ -4,9 +4,11 @@ import cn.hutool.core.codec.Base64; ...@@ -4,9 +4,11 @@ import cn.hutool.core.codec.Base64;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil; import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.URLUtil;
import cn.hutool.crypto.digest.DigestAlgorithm; import cn.hutool.crypto.digest.DigestAlgorithm;
import cn.hutool.crypto.digest.Digester; import cn.hutool.crypto.digest.Digester;
import cn.hutool.http.HttpUtil; import cn.hutool.http.HttpUtil;
import cn.hutool.http.Method;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth; import com.mortals.framework.annotation.UnAuth;
...@@ -60,6 +62,9 @@ import java.util.stream.Collectors; ...@@ -60,6 +62,9 @@ import java.util.stream.Collectors;
@Slf4j @Slf4j
public class MidSignApiController { public class MidSignApiController {
@Value("${mid.midUrl:http://172.15.28.117:9000}")
private String midUrl;
@Value("${mid.appId:01C67D56D0630517}") @Value("${mid.appId:01C67D56D0630517}")
private String appId; private String appId;
...@@ -124,4 +129,57 @@ public class MidSignApiController { ...@@ -124,4 +129,57 @@ public class MidSignApiController {
} }
} }
/**
* 透传请求
* @param midReq
* @return
*/
@PostMapping(value = "trans")
@UnAuth
public Rest<String> trans(@RequestBody MidReq midReq) {
try {
Map<String, String> headerMap = new HashMap<>();
StringBuilder signSb = new StringBuilder();
headerMap.put("appId", appId);
headerMap.put("appKey", appKey);
String timeStamp = System.currentTimeMillis() + "";
headerMap.put("timeStamp", timeStamp);
String nonce = RandomUtil.randomNumbers(6);
headerMap.put("nonce", nonce);
headerMap.put("secretKey", secretKey);
if("post".equalsIgnoreCase(midReq.getMethod())){
JSONObject object1 = JSONObject.parseObject(midReq.getBody());
headerMap.put("body", object1.toJSONString());
}else if("get".equalsIgnoreCase(midReq.getMethod())){
/* HashMap<String, String> paramsMap = JSON.parseObject(midReq.getBody(), HashMap.class);
if (!paramsMap.isEmpty()) {
for (Map.Entry<String, String> entry : paramsMap.entrySet()) {
headerMap.put(entry.getKey(), entry.getValue());
}
}*/
}
signSb.append("appId").append("=").append(headerMap.get("appId")).append("&");
signSb.append("appKey").append("=").append(headerMap.get("appKey")).append("&");
signSb.append("body").append("=").append(headerMap.get("body")).append("&");
signSb.append("nonce").append("=").append(headerMap.get("nonce")).append("&");
signSb.append("secretKey").append("=").append(headerMap.get("secretKey")).append("&");
signSb.append("timeStamp").append("=").append(headerMap.get("timeStamp")).append("&");
String signStr = signSb.substring(0, signSb.length() - 1);
log.info("签名源字符串: " + signStr);
String sign = EncryptionUtils.SHA256(signStr);
log.info("签名计算结果: " + sign);
headerMap.put("sign", sign);
//请求转发
String fullUrl = URLUtil.completeUrl(midUrl, midReq.getPath());
String body = HttpUtil.createRequest(Method.POST, fullUrl).headerMap(headerMap, true).body(headerMap.get("body")).execute().body();
return Rest.ok(body);
} catch (Exception e) {
log.error("透传请求异常",e);
return Rest.fail("透传请求异常!");
}
}
} }
...@@ -84,7 +84,7 @@ public class MatterHtmlParseUtil { ...@@ -84,7 +84,7 @@ public class MatterHtmlParseUtil {
List<MatterEntity> matterEntityList = new ArrayList<>(); List<MatterEntity> matterEntityList = new ArrayList<>();
String evaluationUrl = ""; String evaluationUrl = "";
String netApplyUrl = ""; String netApplyUrl = "";
String href =""; String href = "";
try { try {
Document dom = Jsoup.connect(url).data(params).get(); Document dom = Jsoup.connect(url).data(params).get();
//System.out.println(dom.html()); //System.out.println(dom.html());
...@@ -96,22 +96,18 @@ public class MatterHtmlParseUtil { ...@@ -96,22 +96,18 @@ public class MatterHtmlParseUtil {
continue; continue;
} }
String title = element.attr("title"); String title = element.attr("title");
// String href = element.firstElementChild().attr("href"); href = element.firstElementChild().attr("href");
//element.child() //element.child()
/* if (href.equalsIgnoreCase("javascript:void(0)")) { if (href.equalsIgnoreCase("javascript:void(0)")) {
continue; continue;
}*/ }
//抓取申请与评价页面地址 //抓取申请与评价页面地址
Element nextElementSibling = element.nextElementSibling(); Element nextElementSibling = element.nextElementSibling();
Elements elementsA = nextElementSibling.children();
Elements elementsA = nextElementSibling.selectXpath("//a"); //Elements elementsA = nextElementSibling.selectXpath("//a");
if (elementsA != null) { if (elementsA != null) {
for (Element tempElement : elementsA) { for (Element tempElement : elementsA) {
if ("办事指南".equals(tempElement.text().trim())) {
String onclick = tempElement.attr("onclick");
href = StrUtil.subBetween(onclick, "ywblurl('", "')");
}
if ("办事指南".equals(tempElement.text().trim())) { if ("办事指南".equals(tempElement.text().trim())) {
String onclick = tempElement.attr("onclick"); String onclick = tempElement.attr("onclick");
List<String> list = ReUtil.findAllGroup0("'(.*?)'", onclick); List<String> list = ReUtil.findAllGroup0("'(.*?)'", onclick);
...@@ -119,11 +115,11 @@ public class MatterHtmlParseUtil { ...@@ -119,11 +115,11 @@ public class MatterHtmlParseUtil {
href = StrUtil.subBetween(list.get(0), "'", "'"); href = StrUtil.subBetween(list.get(0), "'", "'");
} }
} }
if (tempElement.text().trim().equals("好差评")) { if ("好差评".equals(tempElement.text().trim())) {
String onclick = tempElement.attr("onclick"); String onclick = tempElement.attr("onclick");
evaluationUrl = StrUtil.subBetween(onclick, "evaluation('", "')"); evaluationUrl = StrUtil.subBetween(onclick, "evaluation('", "')");
} }
if (tempElement.text().trim().equals("申请")) { if ("申请".equals(tempElement.text().trim())) {
String onclick = tempElement.attr("onclick"); String onclick = tempElement.attr("onclick");
List<String> list = ReUtil.findAllGroup0("'(.*?)'", onclick); List<String> list = ReUtil.findAllGroup0("'(.*?)'", onclick);
if (list.size() > 4) { if (list.size() > 4) {
...@@ -132,6 +128,11 @@ public class MatterHtmlParseUtil { ...@@ -132,6 +128,11 @@ public class MatterHtmlParseUtil {
} }
} }
} }
if (ObjectUtils.isEmpty(href)) {
log.info("error href ,title:" + title);
}
buildMatter(matterEntityList, title, href, evaluationUrl, netApplyUrl); buildMatter(matterEntityList, title, href, evaluationUrl, netApplyUrl);
} }
...@@ -146,14 +147,19 @@ public class MatterHtmlParseUtil { ...@@ -146,14 +147,19 @@ public class MatterHtmlParseUtil {
//抓取申请与评价页面地址 //抓取申请与评价页面地址
Element nextElementSibling = element.nextElementSibling(); Element nextElementSibling = element.nextElementSibling();
if (nextElementSibling != null) { if (nextElementSibling != null) {
Elements elementsA = nextElementSibling.selectXpath("//a");
Elements elementsA = nextElementSibling.children();
//Elements elementsA = nextElementSibling.selectXpath("//a");
for (Element tempElement : elementsA) { for (Element tempElement : elementsA) {
if ("办事指南".equals(tempElement.text().trim())) { if ("办事指南".equals(tempElement.text().trim())) {
String onclick = tempElement.attr("onclick"); String onclick = tempElement.attr("onclick");
href = StrUtil.subBetween(onclick, "ywblurl('", "')"); if(ObjectUtils.isEmpty(onclick)) continue;
List<String> list = ReUtil.findAllGroup0("'(.*?)'", onclick);
if (list.size() > 1) {
href = StrUtil.subBetween(list.get(0), "'", "'");
}
} }
if ("好差评".equals(tempElement.text().trim())) { if ("好差评".equals(tempElement.text().trim())) {
String onclick = tempElement.attr("onclick"); String onclick = tempElement.attr("onclick");
evaluationUrl = StrUtil.subBetween(onclick, "evaluation('", "')"); evaluationUrl = StrUtil.subBetween(onclick, "evaluation('", "')");
...@@ -165,6 +171,11 @@ public class MatterHtmlParseUtil { ...@@ -165,6 +171,11 @@ public class MatterHtmlParseUtil {
netApplyUrl = StrUtil.subBetween(list.get(3), "'", "'"); netApplyUrl = StrUtil.subBetween(list.get(3), "'", "'");
} }
} }
if (ObjectUtils.isEmpty(href)) {
log.info("error href ,title:" + title);
}
} }
} }
buildMatter(matterEntityList, title, href, evaluationUrl, netApplyUrl); buildMatter(matterEntityList, title, href, evaluationUrl, netApplyUrl);
...@@ -329,12 +340,6 @@ public class MatterHtmlParseUtil { ...@@ -329,12 +340,6 @@ public class MatterHtmlParseUtil {
*/ */
} }
} }
...@@ -69,15 +69,15 @@ public class SyncGovMatterDetailThread implements Runnable { ...@@ -69,15 +69,15 @@ public class SyncGovMatterDetailThread implements Runnable {
@Override @Override
public void run() { public void run() {
log.info("同步站点事项开始....."); log.info("同步站点事项开始.....");
Rest<String> deptRest = deptService.syncDeptBySiteId(siteEntity, context); // Rest<String> deptRest = deptService.syncDeptBySiteId(siteEntity, context);
log.info("同步站点部门:" + JSON.toJSONString(deptRest)); // log.info("同步站点部门:" + JSON.toJSONString(deptRest));
Rest<String> rest = siteService.syncMatterBySiteId(siteEntity, context); Rest<String> rest = siteService.syncMatterBySiteId(siteEntity, context);
AreaEntity areaEntity = areaService.getCache(siteEntity.getAreaCode()); AreaEntity areaEntity = areaService.getCache(siteEntity.getAreaCode());
log.info("同步事项列表:" + JSON.toJSONString(rest)); log.info("同步事项列表:" + JSON.toJSONString(rest));
if (rest.getCode() == YesNoEnum.YES.getValue()) { if (rest.getCode() == YesNoEnum.YES.getValue()) {
List<MatterEntity> matterEntityList = matterService.find(new MatterQuery().areaCode(siteEntity.getAreaCode()).source(SourceEnum.政务网.getValue())); List<MatterEntity> matterEntityList = matterService.find(new MatterQuery().areaCode(siteEntity.getAreaCode()).source(SourceEnum.政务网.getValue()));
List<MatterEntity> unSyncDetailMatterList = matterEntityList.stream() List<MatterEntity> unSyncDetailMatterList = matterEntityList.stream()
//.filter(f -> f.getHaveGetMatterInfo().equalsIgnoreCase("false")) .filter(f -> f.getHaveGetMatterInfo().equalsIgnoreCase("false"))
.collect(Collectors.toList()); .collect(Collectors.toList());
//查询站点事项相关 //查询站点事项相关
......
...@@ -6,6 +6,10 @@ import com.mortals.framework.service.ITaskExcuteService; ...@@ -6,6 +6,10 @@ import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.xhx.module.dept.model.DeptEntity; import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptQuery; import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService; import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.matter.model.MatterQuery;
import com.mortals.xhx.module.matter.service.MatterService;
import com.mortals.xhx.module.matters.service.MattersService;
import com.mortals.xhx.module.site.model.SiteMatterQuery; import com.mortals.xhx.module.site.model.SiteMatterQuery;
import com.mortals.xhx.module.site.service.SiteMatterService; import com.mortals.xhx.module.site.service.SiteMatterService;
import com.mortals.xhx.module.site.service.SiteService; import com.mortals.xhx.module.site.service.SiteService;
...@@ -25,7 +29,7 @@ public class StatSiteDeptMatterTaskImpl implements ITaskExcuteService { ...@@ -25,7 +29,7 @@ public class StatSiteDeptMatterTaskImpl implements ITaskExcuteService {
@Autowired @Autowired
private DeptService deptService; private DeptService deptService;
@Autowired @Autowired
private SiteMatterService siteMatterService; private MatterService matterService;
@Override @Override
...@@ -33,11 +37,16 @@ public class StatSiteDeptMatterTaskImpl implements ITaskExcuteService { ...@@ -33,11 +37,16 @@ public class StatSiteDeptMatterTaskImpl implements ITaskExcuteService {
log.info("开始同步事项列表!"); log.info("开始同步事项列表!");
List<DeptEntity> deptEntities = deptService.find(new DeptQuery()); List<DeptEntity> deptEntities = deptService.find(new DeptQuery());
for (DeptEntity deptEntity : deptEntities) { for (DeptEntity deptEntity : deptEntities) {
int total = siteMatterService.count(new SiteMatterQuery().deptId(deptEntity.getId()), null); int total = matterService.count(new MatterQuery().deptCode(deptEntity.getDeptNumber()), null);
if (total > 0) { if (total > 0) {
deptEntity.setTotal(total); DeptEntity deptQuery = new DeptEntity();
deptEntity.setUpdateTime(new Date()); deptQuery.setTotal(total);
deptService.update(deptEntity, null); deptQuery.setUpdateTime(new Date());
DeptEntity condition = new DeptEntity();
condition.setId(deptEntity.getId());
deptService.getDao().update(deptQuery, condition);
// deptService.update(deptEntity, null);
} }
} }
......
...@@ -28,7 +28,7 @@ import java.util.List; ...@@ -28,7 +28,7 @@ import java.util.List;
* 同步用户 * 同步用户
*/ */
@Slf4j @Slf4j
@Service("SyncUserTask") //@Service("SyncUserTask")
public class SyncUserTaskImpl implements ITaskExcuteService { public class SyncUserTaskImpl implements ITaskExcuteService {
@Autowired @Autowired
......
...@@ -17,8 +17,10 @@ import com.mortals.framework.model.PageInfo; ...@@ -17,8 +17,10 @@ import com.mortals.framework.model.PageInfo;
import com.mortals.xhx.base.system.upload.service.UploadService; import com.mortals.xhx.base.system.upload.service.UploadService;
import com.mortals.xhx.common.code.YesNoEnum; import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.key.Constant; import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.pdu.app.AppPdu;
import com.mortals.xhx.common.utils.BeanUtil; import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.common.utils.ZipUtils; import com.mortals.xhx.common.utils.ZipUtils;
import com.mortals.xhx.feign.app.device.IAppFeign;
import com.mortals.xhx.module.app.model.*; import com.mortals.xhx.module.app.model.*;
import com.mortals.xhx.module.app.service.*; import com.mortals.xhx.module.app.service.*;
import com.mortals.xhx.module.site.model.SiteEntity; import com.mortals.xhx.module.site.model.SiteEntity;
...@@ -65,6 +67,8 @@ public class AppServiceImpl extends AbstractCRUDServiceImpl<AppDao, AppEntity, L ...@@ -65,6 +67,8 @@ public class AppServiceImpl extends AbstractCRUDServiceImpl<AppDao, AppEntity, L
private AppInfoTempleteFieldService appInfoTempleteFieldService; private AppInfoTempleteFieldService appInfoTempleteFieldService;
@Autowired @Autowired
private AppVersionService appVersionService; private AppVersionService appVersionService;
@Autowired
private IAppFeign appFeign;
@Override @Override
protected void findAfter(AppEntity params, PageInfo pageInfo, Context context, List<AppEntity> list) throws AppException { protected void findAfter(AppEntity params, PageInfo pageInfo, Context context, List<AppEntity> list) throws AppException {
...@@ -320,6 +324,12 @@ public class AppServiceImpl extends AbstractCRUDServiceImpl<AppDao, AppEntity, L ...@@ -320,6 +324,12 @@ public class AppServiceImpl extends AbstractCRUDServiceImpl<AppDao, AppEntity, L
entity.setFilePath(null); entity.setFilePath(null);
entity.setFileName(null); entity.setFileName(null);
//判断如果应用下架,通知自助服务终端
if(entity.getShelves()==YesNoEnum.NO.getValue()){
AppPdu appPdu = new AppPdu();
appPdu.setAppId(entity.getId());
appFeign.forbidden(appPdu);
}
int iRet = this.dao.update(entity); int iRet = this.dao.update(entity);
if (iRet == 0) { if (iRet == 0) {
throw new AppException(-1002, "更新失败!"); throw new AppException(-1002, "更新失败!");
......
...@@ -36,7 +36,7 @@ public class AreaServiceImpl extends AbstractCRUDCacheServiceImpl<AreaDao, AreaE ...@@ -36,7 +36,7 @@ public class AreaServiceImpl extends AbstractCRUDCacheServiceImpl<AreaDao, AreaE
private BaseAreaService baseAreaService; private BaseAreaService baseAreaService;
/* @Override @Override
public void putCache(String key, AreaEntity data) { public void putCache(String key, AreaEntity data) {
super.putCache(key, data); super.putCache(key, data);
//加载孩子关系 //加载孩子关系
...@@ -47,7 +47,7 @@ public class AreaServiceImpl extends AbstractCRUDCacheServiceImpl<AreaDao, AreaE ...@@ -47,7 +47,7 @@ public class AreaServiceImpl extends AbstractCRUDCacheServiceImpl<AreaDao, AreaE
cacheService.lpush(childKey, item); cacheService.lpush(childKey, item);
}); });
} }
}*/ }
@Override @Override
protected String getExtKey(AreaEntity data) { protected String getExtKey(AreaEntity data) {
......
...@@ -5,6 +5,7 @@ import com.mortals.framework.model.Context; ...@@ -5,6 +5,7 @@ import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDCacheService; import com.mortals.framework.service.ICRUDCacheService;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.business.model.BusinessEntity; import com.mortals.xhx.module.business.model.BusinessEntity;
import com.mortals.xhx.module.dept.dao.DeptDao;
import com.mortals.xhx.module.dept.model.DeptEntity; import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptQuery; import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.model.vo.DeptVo; import com.mortals.xhx.module.dept.model.vo.DeptVo;
...@@ -23,6 +24,7 @@ import java.util.Map; ...@@ -23,6 +24,7 @@ import java.util.Map;
*/ */
public interface DeptService extends ICRUDCacheService<DeptEntity, Long> { public interface DeptService extends ICRUDCacheService<DeptEntity, Long> {
DeptDao getDao();
/** /**
* 同步政务网部门数据 * 同步政务网部门数据
......
...@@ -156,6 +156,19 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic ...@@ -156,6 +156,19 @@ public class DeptController extends BaseCRUDJsonBodyMappingController<DeptServic
} }
/**
* @param entity
* @param model
* @param context
* @throws AppException
*/
@Override
protected void saveBefore(DeptEntity entity, Map<String, Object> model, Context context) throws AppException {
DeptEntity deptEntity = this.service.selectOne(new DeptQuery().deptNumber(entity.getDeptNumber()));
if(!ObjectUtils.isEmpty(deptEntity)){
throw new AppException("部门编码已存在!");
}
entity.setSource(1);
super.saveBefore(entity, model, context);
}
} }
\ No newline at end of file
package com.mortals.xhx.module.matter.model; package com.mortals.xhx.module.matter.model;
import java.util.*;
import java.util.List; import java.util.List;
import java.util.Date;
import java.util.List;
import java.util.ArrayList;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel; import com.mortals.framework.annotation.Excel;
...@@ -1694,7 +1692,7 @@ public class MatterEntity extends MatterVo { ...@@ -1694,7 +1692,7 @@ public class MatterEntity extends MatterVo {
@Override @Override
public int hashCode() { public int hashCode() {
return this.getId().hashCode(); return Objects.hash(this.areaCode, this.matterNo);
} }
@Override @Override
...@@ -1702,7 +1700,7 @@ public class MatterEntity extends MatterVo { ...@@ -1702,7 +1700,7 @@ public class MatterEntity extends MatterVo {
if (obj == null) return false; if (obj == null) return false;
if (obj instanceof MatterEntity) { if (obj instanceof MatterEntity) {
MatterEntity tmp = (MatterEntity) obj; MatterEntity tmp = (MatterEntity) obj;
if (this.getId() == tmp.getId()) { if ((this.getAreaCode()+this.matterNo).equals(tmp.getAreaCode()+tmp.matterNo)) {
return true; return true;
} }
} }
......
...@@ -27,6 +27,7 @@ import com.mortals.xhx.module.area.model.AreaEntity; ...@@ -27,6 +27,7 @@ import com.mortals.xhx.module.area.model.AreaEntity;
import com.mortals.xhx.module.area.model.AreaQuery; import com.mortals.xhx.module.area.model.AreaQuery;
import com.mortals.xhx.module.area.service.AreaService; import com.mortals.xhx.module.area.service.AreaService;
import com.mortals.xhx.module.dept.model.DeptEntity; import com.mortals.xhx.module.dept.model.DeptEntity;
import com.mortals.xhx.module.dept.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService; import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.matter.model.MatterEntity; import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.matter.model.MatterQuery; import com.mortals.xhx.module.matter.model.MatterQuery;
...@@ -556,8 +557,7 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE ...@@ -556,8 +557,7 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
private List<MatterEntity> getMatters(HashMap<String, String> params, Context context) { private List<MatterEntity> getMatters(HashMap<String, String> params, Context context) {
String url = GlobalSysInfo.getParamValue(Constant.GOV_MATTER_PAGELIST_URL, "http://www.sczwfw.gov.cn/jiq/interface/item/tags"); String url = GlobalSysInfo.getParamValue(Constant.GOV_MATTER_PAGELIST_URL, "http://www.sczwfw.gov.cn/jiq/interface/item/tags");
Rest<Map<String, Integer>> restStat = MatterHtmlParseUtil.statSiteMatterCount(params, url);
Rest<Map<String, Integer>> restStat = MatterHtmlParseUtil.statSiteMatterDeptCount(params, url);
if (restStat.getCode() == YesNoEnum.YES.getValue()) { if (restStat.getCode() == YesNoEnum.YES.getValue()) {
Integer pageNum = restStat.getData().getOrDefault("pageNum", 0); Integer pageNum = restStat.getData().getOrDefault("pageNum", 0);
Integer total = restStat.getData().getOrDefault("total", 0); Integer total = restStat.getData().getOrDefault("total", 0);
...@@ -579,10 +579,24 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE ...@@ -579,10 +579,24 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
//根据站点区域编码查询政务网事项列表 //根据站点区域编码查询政务网事项列表
AreaEntity areaEntity = areaService.getCache(siteEntity.getAreaCode()); AreaEntity areaEntity = areaService.getCache(siteEntity.getAreaCode());
//String dxType = AreaLevelDxTypeEnum.getByValue(areaEntity == null ? 2 : areaEntity.getAreaLevel()).getDesc(); //String dxType = AreaLevelDxTypeEnum.getByValue(areaEntity == null ? 2 : areaEntity.getAreaLevel()).getDesc();
String dxType="2"; // String dxType="2";
//String dxType = "3"; //String dxType = "3";
List<MatterEntity> govMatterList = new ArrayList<>();
HashMap<String, String> params = new HashMap<>(); List<DeptEntity> deptEntities = deptService.find(new DeptQuery().siteId(siteEntity.getId()).source(0));
for (DeptEntity deptEntity : deptEntities) {
HashMap<String, String> params = new HashMap<>();
params.put("areaCode", areaEntity.getAreaCode());
params.put("dxType", "6");
params.put("deptCode", deptEntity.getDeptNumber());
params.put("searchtext", "");
params.put("taskType", "");
List<MatterEntity> deptMatterList = this.getMatters(params, context);
if (!ObjectUtils.isEmpty(deptMatterList)) {
govMatterList.addAll(deptMatterList);
}
}
/* HashMap<String, String> params = new HashMap<>();
params.put("dxType", dxType); params.put("dxType", dxType);
params.put("areaCode", siteEntity.getAreaCode()); params.put("areaCode", siteEntity.getAreaCode());
params.put("deptCode", ""); params.put("deptCode", "");
...@@ -603,11 +617,13 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE ...@@ -603,11 +617,13 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
params.put("type", "2"); params.put("type", "2");
List<MatterEntity> mattersTwo = this.getMatters(params, context); List<MatterEntity> mattersTwo = this.getMatters(params, context);
govMatterList.addAll(mattersTwo); govMatterList.addAll(mattersTwo);*/
List<MatterEntity> localMatterList = matterService.find(new MatterQuery().areaCode(siteEntity.getAreaCode())); List<MatterEntity> localMatterList = matterService.find(new MatterQuery().areaCode(siteEntity.getAreaCode()));
List<MatterEntity> subList = this.subList(govMatterList, localMatterList); List<MatterEntity> subList = this.subList(govMatterList, localMatterList);
log.info("需要添加事项数量====" + subList.size()); log.info("抓取事项总数:{}需要添加事项数量:{}", govMatterList.size(), subList.size());
subList = subList.stream().distinct().collect(Collectors.toList());
log.info("需要添加事项过滤后数量:{}" , subList.size());
//差集进行插入并更新详细数据 //差集进行插入并更新详细数据
if (!ObjectUtils.isEmpty(subList)) { if (!ObjectUtils.isEmpty(subList)) {
for (MatterEntity matterEntity : subList) { for (MatterEntity matterEntity : subList) {
...@@ -616,12 +632,12 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE ...@@ -616,12 +632,12 @@ public class SiteServiceImpl extends AbstractCRUDCacheServiceImpl<SiteDao, SiteE
matterService.save(matterEntity, context); matterService.save(matterEntity, context);
} }
List<List<MatterEntity>> partition = ListUtil.partition(subList, 100); /* List<List<MatterEntity>> partition = ListUtil.partition(subList, 100);
for (List<MatterEntity> matterEntityList : partition) { for (List<MatterEntity> matterEntityList : partition) {
log.info("insert subList size:" + matterEntityList.size()); log.info("insert subList size:" + matterEntityList.size());
int count = matterService.save(matterEntityList, context); int count = matterService.save(matterEntityList, context);
log.info("insert subList size success:" + count); log.info("insert subList size success:" + count);
} }*/
} }
......
...@@ -184,7 +184,7 @@ public class WindowServiceImpl extends AbstractCRUDCacheServiceImpl<WindowDao, W ...@@ -184,7 +184,7 @@ public class WindowServiceImpl extends AbstractCRUDCacheServiceImpl<WindowDao, W
} }
private void pushChangeMsg(Long windowId) { private void pushChangeMsg(Long windowId) {
log.info("pushChangeMsg:{}", JSON.toJSONString(windowId)); // log.info("pushChangeMsg:{}", JSON.toJSONString(windowId));
String phpUrl = GlobalSysInfo.getParamValue(PARAM_SERVER_PHP_HTTP_URL, "http://172.15.28.116:8090"); String phpUrl = GlobalSysInfo.getParamValue(PARAM_SERVER_PHP_HTTP_URL, "http://172.15.28.116:8090");
phpUrl += "/api/window/winNameChange"; phpUrl += "/api/window/winNameChange";
HashMap<String, Object> paramsMap = new HashMap<>(); HashMap<String, Object> paramsMap = new HashMap<>();
......
...@@ -50,7 +50,7 @@ Accept: application/json ...@@ -50,7 +50,7 @@ Accept: application/json
###区域查看 ###区域查看
GET {{baseUrl}}/area/getListByRootId?rootId=6182157d00ce41559e001a89d87f4057 GET {{baseUrl}}/area/getListByRootId?rootId=0
Accept: application/json Accept: application/json
......
package com.mortals.xhx.common.pdu.app;
import com.mortals.framework.model.BaseEntityLong;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* appPdu对象
*
* @author zxfei
* @date 2022-10-26
*/
@Data
public class AppPdu {
/**
* appId
*/
private Long appId;
}
\ No newline at end of file
package com.mortals.xhx.feign.app.device;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.common.pdu.app.AppPdu;
import com.mortals.xhx.feign.IFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
/**
* 设备 Feign接口
*
* @author zxfei
* @date 2022-10-26
*/
@FeignClient(name = "sst-manager", path = "/sst", fallbackFactory = AppFeignFallbackFactory.class)
public interface IAppFeign extends IFeign {
/**
* 设备保存更新
*
* @param appPdu
* @return
*/
@PostMapping(value = "/apps/forbidden")
Rest<Void> forbidden(@RequestBody AppPdu appPdu);
}
@Slf4j
@Component
class AppFeignFallbackFactory implements FallbackFactory<IAppFeign> {
@Override
public IAppFeign create(Throwable t) {
return new IAppFeign() {
@Override
public Rest<Void> forbidden(AppPdu appPdu) {
return Rest.fail("暂时无法通知,请稍后再试!");
}
};
}
}
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