Commit 7bd47354 authored by 赵啸非's avatar 赵啸非

更新事项,异步更新关联

parent 1359bb3d
...@@ -497,6 +497,7 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE ...@@ -497,6 +497,7 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
System.out.println(SecurityUtil.md5DoubleEncoding("xhxADMIN8@a")); System.out.println(SecurityUtil.md5DoubleEncoding("xhxADMIN8@a"));
System.out.println(SecurityUtil.md5DoubleEncoding("123"));
// System.out.println(SecurityUtil.md5DoubleEncoding("Qt123456@")); // System.out.println(SecurityUtil.md5DoubleEncoding("Qt123456@"));
/* /*
......
...@@ -42,7 +42,7 @@ import static com.mortals.framework.ap.SysConstains.PAGEINFO_KEY; ...@@ -42,7 +42,7 @@ import static com.mortals.framework.ap.SysConstains.PAGEINFO_KEY;
@Slf4j @Slf4j
@RequestMapping("alarm") @RequestMapping("alarm")
public class AlarmWebApiController extends BaseJsonBodyController { public class AlarmWebApiController extends BaseJsonBodyController {
@PostMapping(value = "body") @PostMapping(value = "body")
@UnAuth @UnAuth
......
package com.mortals.xhx.module.matter.service.impl; package com.mortals.xhx.module.matter.service.impl;
import cn.hutool.core.collection.ListUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
import com.mortals.framework.ap.GlobalSysInfo; import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.common.Rest; import com.mortals.framework.common.Rest;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.util.ThreadPool; import com.mortals.framework.util.ThreadPool;
import com.mortals.xhx.common.code.DxTypeEnum; import com.mortals.xhx.common.code.DxTypeEnum;
import com.mortals.xhx.common.code.SourceEnum; import com.mortals.xhx.common.code.SourceEnum;
...@@ -16,23 +17,20 @@ import com.mortals.xhx.module.area.service.AreaService; ...@@ -16,23 +17,20 @@ 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.model.DeptQuery;
import com.mortals.xhx.module.dept.service.DeptService; import com.mortals.xhx.module.dept.service.DeptService;
import com.mortals.xhx.module.matter.dao.MatterExtDao;
import com.mortals.xhx.module.matter.model.MatterEntity; import com.mortals.xhx.module.matter.model.MatterEntity;
import com.mortals.xhx.module.matter.model.MatterExtEntity;
import com.mortals.xhx.module.matter.model.MatterQuery; import com.mortals.xhx.module.matter.model.MatterQuery;
import com.mortals.xhx.module.matter.service.MatterExtService;
import com.mortals.xhx.module.matter.service.MatterService; import com.mortals.xhx.module.matter.service.MatterService;
import com.mortals.xhx.module.site.model.*; import com.mortals.xhx.module.site.model.*;
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.SiteThemeMatterService; import com.mortals.xhx.module.site.service.SiteThemeMatterService;
import com.mortals.xhx.module.site.service.SiteThemeService; import com.mortals.xhx.module.site.service.SiteThemeService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.matter.dao.MatterExtDao;
import com.mortals.xhx.module.matter.model.MatterExtEntity;
import com.mortals.xhx.module.matter.service.MatterExtService;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.*; import java.util.*;
...@@ -61,6 +59,8 @@ public class MatterExtServiceImpl extends AbstractCRUDServiceImpl<MatterExtDao, ...@@ -61,6 +59,8 @@ public class MatterExtServiceImpl extends AbstractCRUDServiceImpl<MatterExtDao,
private SiteThemeService siteThemeService; private SiteThemeService siteThemeService;
@Autowired @Autowired
private SiteMatterService siteMatterService; private SiteMatterService siteMatterService;
@Value("${sync.matter.deleted:false}")
private Boolean deleted;
/** /**
...@@ -119,7 +119,7 @@ public class MatterExtServiceImpl extends AbstractCRUDServiceImpl<MatterExtDao, ...@@ -119,7 +119,7 @@ public class MatterExtServiceImpl extends AbstractCRUDServiceImpl<MatterExtDao,
private List<MatterEntity> getMatterEntities(SiteEntity siteEntity, Context context) { private List<MatterEntity> getMatterEntities(SiteEntity siteEntity, Context context) {
AreaEntity areaEntity = areaService.getCache(siteEntity.getAreaCode()); AreaEntity areaEntity = areaService.getCache(siteEntity.getAreaCode());
List<DeptEntity> deptEntities = deptService.find(new DeptQuery().siteId(siteEntity.getId()).source(SourceEnum.政务网.getValue())); List<DeptEntity> deptEntities = deptService.find(new DeptQuery().siteId(siteEntity.getId()).source(SourceEnum.政务网.getValue()));
List<MatterEntity> govMatterList = deptEntities.parallelStream().flatMap(deptEntity -> { List<MatterEntity> govMatterList = deptEntities.stream().flatMap(deptEntity -> {
HashMap<String, String> params = new HashMap<>(); HashMap<String, String> params = new HashMap<>();
params.put("areaCode", areaEntity.getAreaCode()); params.put("areaCode", areaEntity.getAreaCode());
params.put("dxType", "6"); params.put("dxType", "6");
...@@ -234,6 +234,9 @@ public class MatterExtServiceImpl extends AbstractCRUDServiceImpl<MatterExtDao, ...@@ -234,6 +234,9 @@ public class MatterExtServiceImpl extends AbstractCRUDServiceImpl<MatterExtDao,
@Override @Override
public Rest<String> syncDelMatterBySiteId(SiteEntity siteEntity, Context context) { public Rest<String> syncDelMatterBySiteId(SiteEntity siteEntity, Context context) {
List<MatterEntity> govMatterList = getMatterEntities(siteEntity, context); List<MatterEntity> govMatterList = getMatterEntities(siteEntity, context);
if (ObjectUtils.isEmpty(govMatterList)) return Rest.ok("爬取事项列表为空!");
if (!deleted) return Rest.ok("配置不允许删除!");
log.info("计算差集"); log.info("计算差集");
MatterQuery matterQuery = new MatterQuery(); MatterQuery matterQuery = new MatterQuery();
matterQuery.setAreaCode(siteEntity.getAreaCode()); matterQuery.setAreaCode(siteEntity.getAreaCode());
...@@ -245,7 +248,7 @@ public class MatterExtServiceImpl extends AbstractCRUDServiceImpl<MatterExtDao, ...@@ -245,7 +248,7 @@ public class MatterExtServiceImpl extends AbstractCRUDServiceImpl<MatterExtDao,
Set<String> matterExistSet = govMatterList.parallelStream().map(i -> i.getMatterNo()).collect(Collectors.toSet()); Set<String> matterExistSet = govMatterList.parallelStream().map(i -> i.getMatterNo()).collect(Collectors.toSet());
List<MatterEntity> delList = this.subListSet(matterList, matterExistSet); List<MatterEntity> delList = this.subListSet(matterList, matterExistSet);
log.info("抓取事项总数:{} ,需要删除事项数量:{}", govMatterList.size(), delList.size()); log.info("抓取事项总数:{} ,需要删除事项数量:{}", govMatterList.size(), delList.size());
//删除matter 和siteMatter //删除matter 和siteMatter 开启了自动删除才启用
if (!ObjectUtils.isEmpty(delList)) { if (!ObjectUtils.isEmpty(delList)) {
Long[] delMatterIds = delList.parallelStream().map(i -> i.getId()).toArray(Long[]::new); Long[] delMatterIds = delList.parallelStream().map(i -> i.getId()).toArray(Long[]::new);
matterService.remove(delMatterIds, context); matterService.remove(delMatterIds, context);
...@@ -277,7 +280,7 @@ public class MatterExtServiceImpl extends AbstractCRUDServiceImpl<MatterExtDao, ...@@ -277,7 +280,7 @@ public class MatterExtServiceImpl extends AbstractCRUDServiceImpl<MatterExtDao,
List<DeptEntity> deptEntities = deptService.getDeptByWeb(areaCode, context).getData(); List<DeptEntity> deptEntities = deptService.getDeptByWeb(areaCode, context).getData();
List<MatterEntity> govMatterList = deptEntities.parallelStream().flatMap(deptEntity -> { List<MatterEntity> govMatterList = deptEntities.parallelStream().flatMap(deptEntity -> {
HashMap<String, String> params = new HashMap<>(); HashMap<String, String> params = new HashMap<>();
params.put("areaCode",areaCode); params.put("areaCode", areaCode);
params.put("dxType", "6"); params.put("dxType", "6");
params.put("deptCode", deptEntity.getDeptNumber()); params.put("deptCode", deptEntity.getDeptNumber());
params.put("searchtext", ""); params.put("searchtext", "");
......
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