Commit 2856bb21 authored by 赵啸非's avatar 赵啸非

修复窗口业务更新后缓存未更新问题

parent 45aea52d
......@@ -20,6 +20,7 @@ import io.jsonwebtoken.SignatureAlgorithm;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.annotation.Primary;
import org.springframework.core.annotation.Order;
import org.springframework.data.redis.core.RedisTemplate;
......@@ -44,6 +45,7 @@ import java.util.Set;
public class AuthTokenServiceImpl implements IAuthTokenService {
@Autowired
@Lazy
private UserService userService;
// 令牌自定义标识
......
......@@ -32,6 +32,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
......@@ -61,7 +62,6 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
@Autowired
private IUserFeign userFeign;
private static Log logger = LogFactory.getLog(LoginController.class);
@RequestMapping("login")
public String login(@RequestBody LoginForm loginForm) throws Exception {
......
......@@ -77,6 +77,7 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
@Autowired
private RoleUserService roleUserService;
@Autowired
@Lazy
private SiteService siteService;
@Lazy
......
......@@ -74,8 +74,6 @@ public class DemoWebApiController {
@Autowired
private MatterService matterService;
@Autowired
private SiteThemeService siteThemeService;
@Autowired
private SiteThemeMatterService siteThemeMatterService;
@Autowired
private BusinessMatterService businessMatterService;
......
......@@ -111,7 +111,7 @@ public class MatterDetailHtmlParseUtil {
List<String> allGroup = ReUtil.findAllGroup1("'(.*?)'", onclickStr);
if (!ObjectUtils.isEmpty(allGroup)) {
String encryUrl = "http://www.sczwfw.gov.cn/jiq/interface/item/annex/encryptUrl?id=" + allGroup.get(0);
/* String encryUrl = "http://www.sczwfw.gov.cn/jiq/interface/item/annex/encryptUrl?id=" + allGroup.get(0);
String resp = HttpUtil.get(encryUrl);
JSONObject obj = JSON.parseObject(resp);
......@@ -120,7 +120,8 @@ public class MatterDetailHtmlParseUtil {
if ("0".equals(code)) {
fileEntity.setFileUrl(data);
fileEntity.setLocalFileUrl(data);
}
}*/
fileEntity.setFileUrl(allGroup.get(0));
}
// fileEntity.setFileUrl(node.firstChild().attr("href").trim());
......@@ -150,7 +151,7 @@ public class MatterDetailHtmlParseUtil {
List<String> allGroup = ReUtil.findAllGroup1("'(.*?)'", onclickStr);
if (!ObjectUtils.isEmpty(allGroup)) {
String encryUrl = "http://www.sczwfw.gov.cn/jiq/interface/item/annex/encryptUrl?id=" + allGroup.get(0);
/* String encryUrl = "http://www.sczwfw.gov.cn/jiq/interface/item/annex/encryptUrl?id=" + allGroup.get(0);
String resp = HttpUtil.get(encryUrl);
JSONObject obj = JSON.parseObject(resp);
......@@ -159,7 +160,8 @@ public class MatterDetailHtmlParseUtil {
if ("0".equals(code)) {
fileEntity.setFileUrl(data);
fileEntity.setLocalFileUrl(data);
}
}*/
fileEntity.setFileUrl(allGroup.get(0));
}
// fileEntity.setFileUrl(node.firstChild().attr("href").trim());
datumSampleFileEntities.add(fileEntity);
......
package com.mortals.xhx.daemon.applicationservice;
import com.mortals.framework.common.Rest;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.util.ThreadPool;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.code.YesNoEnum;
import com.mortals.xhx.common.key.Constant;
import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.user.UserPdu;
import com.mortals.xhx.common.utils.SendTaskThreadPool;
import com.mortals.xhx.feign.user.IUserFeign;
import com.mortals.framework.springcloud.service.IApplicationService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.mortals.framework.springcloud.service.IApplicationService;
import org.springframework.util.ObjectUtils;
import java.util.List;
@Component
//@Component
public class DemoStartService implements IApplicationService {
private static Log logger = LogFactory.getLog(DemoStartService.class);
@Autowired
private ICacheService cacheService;
@Autowired
private IUserFeign userFeign;
@Autowired
private UserService userService;
@Override
public void start() {
// ThreadPool.getInstance().init(10);
logger.info("开始服务..[配置已加载完成,但部分框架还未初始化,比如:Kafka]");
/* Rest<String> rest = userFeign.synchSiteAuth();
if (rest.getCode().equals(YesNoEnum.YES.getValue())) {
UserPdu userPdu = new UserPdu();
userPdu.setPage(1);
userPdu.setSize(-1);
Rest<RespData<List<UserPdu>>> list = userFeign.list(userPdu);
if(!ObjectUtils.isEmpty(list.getData().getData())){
//初始化更新门户用户站点树
cacheService.del(Constant.USER_SITE_TREE);
userService.updateUserList(list.getData().getData());
}
}*/
}
@Override
......
package com.mortals.xhx.daemon.applicationservice;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.IUser;
import com.mortals.framework.springcloud.config.web.BaseWebMvcConfigurer;
import com.mortals.framework.springcloud.service.IApplicationStartedService;
import com.mortals.framework.util.ThreadPool;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.pdu.user.UserPdu;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.common.utils.SyncTreeSiteThread;
import com.mortals.xhx.feign.user.IUserFeign;
import com.mortals.xhx.module.site.model.SiteEntity;
import com.mortals.xhx.module.site.model.SiteTreeSelect;
import com.mortals.xhx.module.site.service.SiteService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
import com.mortals.framework.springcloud.service.IApplicationStartedService;
import org.springframework.util.ObjectUtils;
import java.util.List;
import static com.mortals.xhx.common.key.Constant.USER_SITE_TREE;
@Component
@Slf4j
public class DemoStartedService implements IApplicationStartedService {
private static Log logger = LogFactory.getLog(DemoStartedService.class);
@Autowired
private IUserFeign userFeign;
@Autowired
private UserService userService;
@Autowired
private ICacheService cacheService;
@Autowired
......@@ -47,54 +25,16 @@ public class DemoStartedService implements IApplicationStartedService {
@Override
public void start() {
ThreadPool.getInstance().init(6);
logger.info("开始服务..[初始化用户站点树]");
ThreadPool.getInstance().init(10);
log.info("开始服务..[初始化用户站点树]");
//删除redis 中的 站点树
cacheService.del(USER_SITE_TREE);
siteService.updateAllSiteTree(null);
//测试获取站点
/*
int i=0;
while (true) {
SiteEntity siteCache = siteService.getCache("1");
if (ObjectUtils.isEmpty(siteCache)) {
log.error("siteCache is null");
}else {
log.info("count==>"+i);
}
try {
Thread.sleep(50);
i++;
} catch (InterruptedException e) {
}
}*/
/* UserEntity userEntity = new UserEntity();
userEntity.initAttrValue();
userEntity.setId(0L);
Context contextTemp = new Context();
contextTemp.setUser(userEntity);
SyncTreeSiteThread syncTreeSiteThread = new SyncTreeSiteThread(contextTemp);
ThreadPool.getInstance().execute(syncTreeSiteThread);
userEntity = new UserEntity();
userEntity.initAttrValue();
userEntity.setId(1L);
contextTemp = new Context();
contextTemp.setUser(userEntity);
syncTreeSiteThread = new SyncTreeSiteThread(contextTemp);
ThreadPool.getInstance().execute(syncTreeSiteThread);*/
}
@Override
public void stop() {
logger.info("停止服务..");
log.info("停止服务..");
}
@Override
......
......@@ -7,6 +7,7 @@ import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.util.DataUtil;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
......@@ -32,6 +33,7 @@ import java.util.Map;
import static com.mortals.framework.ap.SysConstains.MESSAGE_INFO;
import static com.mortals.framework.ap.SysConstains.PAGEINFO_KEY;
import static com.mortals.xhx.common.key.RedisKey.KEY_SEARCH_HALL_BUSINESS_CACHE;
/**
* 站点部门窗口
......@@ -50,6 +52,8 @@ public class WindowController extends BaseCRUDJsonBodyMappingController<WindowSe
private SiteService siteService;
@Autowired
private DeptService deptService;
@Autowired
private ICacheService cacheService;
public WindowController() {
......@@ -84,6 +88,8 @@ public class WindowController extends BaseCRUDJsonBodyMappingController<WindowSe
Long windowId = DataUtil.converObj2Long(map.get("windowId"));
try {
this.service.addBusinessToWindow(businessIds, windowId, getContext());
//更新完窗口业务,删除缓存列表
cacheService.del(KEY_SEARCH_HALL_BUSINESS_CACHE);
jsonObject.put(KEY_RESULT_DATA, model);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
jsonObject.put(KEY_RESULT_MSG, "添加业务到窗口成功!");
......@@ -182,15 +188,15 @@ public class WindowController extends BaseCRUDJsonBodyMappingController<WindowSe
if (!ObjectUtils.isEmpty(deptEntity)) {
windowEntity.setDeptId(deptEntity.getId());
windowEntity.setDeptName(deptEntity.getName());
}else {
} else {
//判断是否填入了部门名称
if(!ObjectUtils.isEmpty(windowEntity.getDeptName())){
if (!ObjectUtils.isEmpty(windowEntity.getDeptName())) {
//根据部门名称与站点 更新窗口
DeptQuery deptQuery = new DeptQuery();
deptQuery.setName(windowEntity.getDeptName());
deptQuery.setSiteId(DataUtil.converStr2Long(siteId,0L));
deptQuery.setSiteId(DataUtil.converStr2Long(siteId, 0L));
deptEntity = deptService.selectOne(deptQuery);
if(!ObjectUtils.isEmpty(deptEntity)){
if (!ObjectUtils.isEmpty(deptEntity)) {
windowEntity.setDeptId(deptEntity.getId());
windowEntity.setDeptName(deptEntity.getName());
}
......@@ -201,7 +207,7 @@ public class WindowController extends BaseCRUDJsonBodyMappingController<WindowSe
Iterator<WindowEntity> iterator = list.iterator();
while (iterator.hasNext()) {
WindowEntity next = iterator.next();
if(ObjectUtils.isEmpty(next.getSiteId())||ObjectUtils.isEmpty(next.getDeptId())){
if (ObjectUtils.isEmpty(next.getSiteId()) || ObjectUtils.isEmpty(next.getDeptId())) {
iterator.remove();
}
}
......
......@@ -115,7 +115,7 @@ POST {{baseUrl}}/site/syncGovMatterBySiteId
Content-Type: application/json
{
"id":22
"id":1
}
......
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