Commit bc053fcd authored by 廖旭伟's avatar 廖旭伟

达州一窗服务知识库系统

parent 59a534bc
-- ----------------------------
-- 辅助接件事项浏览记录表
-- ----------------------------
DROP TABLE IF EXISTS `mortals_sys_site_matter_assist_views`;
CREATE TABLE mortals_sys_site_matter_assist_views(
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`assistId` bigint(20) DEFAULT '0' COMMENT '辅助接件事项ID',
`matterId` bigint(20) COMMENT '事项ID',
`viewUserId` bigint(20) COMMENT '浏览用户id',
`viewUserName` varchar(512) COMMENT '浏览用户名称',
`createTime` datetime COMMENT '创建时间',
`createUserId` bigint(20) COMMENT '创建人id',
`updateTime` datetime COMMENT '更新时间',
`updateUserId` bigint(20) COMMENT '更新人id',
PRIMARY KEY (`id`)
,KEY `id` (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='辅助接件事项浏览记录';
-- ----------------------------
-- 常见问题表
-- ----------------------------
DROP TABLE IF EXISTS `mortals_sys_question`;
CREATE TABLE mortals_sys_question(
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID,主键,自增长',
`title` varchar(256) COMMENT '问题标题',
`deptId` bigint(20) COMMENT '所属部门id',
`deptName` varchar(256) COMMENT '所属部门名称',
`details` text COMMENT '问题详情',
`createTime` datetime COMMENT '创建时间',
`createUserId` bigint(20) COMMENT '创建人id',
`updateTime` datetime COMMENT '更新时间',
`updateUserId` bigint(20) COMMENT '更新人id',
PRIMARY KEY (`id`)
,KEY `id` (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='常见问题';
ALTER TABLE `mortals_sys_site_matter_assist` ADD COLUMN `suggest` tinyint(2) DEFAULT '0' COMMENT '推荐状态';
\ No newline at end of file
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
<profiles.publish.path>/home/publish</profiles.publish.path> <profiles.publish.path>/home/publish</profiles.publish.path>
<profiles.nacos.server-addr>192.168.0.252:8848</profiles.nacos.server-addr> <profiles.nacos.server-addr>192.168.0.252:8848</profiles.nacos.server-addr>
<profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group> <profiles.nacos.group>DEFAULT_GROUP</profiles.nacos.group>
<profiles.nacos.namespace>smart-gov-chuanshan</profiles.nacos.namespace> <profiles.nacos.namespace>smart-gov</profiles.nacos.namespace>
<profiles.log.path>/home/mortals/app/logs</profiles.log.path> <profiles.log.path>/home/mortals/app/logs</profiles.log.path>
<profiles.log.level>INFO</profiles.log.level> <profiles.log.level>INFO</profiles.log.level>
<package.environment>test</package.environment> <package.environment>test</package.environment>
......
...@@ -7,31 +7,43 @@ import com.mortals.framework.service.ICacheService; ...@@ -7,31 +7,43 @@ import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.IUser; import com.mortals.framework.service.IUser;
import com.mortals.framework.util.DateUtils; import com.mortals.framework.util.DateUtils;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.xhx.base.system.resource.service.ResourceService;
import com.mortals.xhx.base.system.user.model.UserEntity; import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.utils.MenuEncodeUtil;
import io.jsonwebtoken.Claims; import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts; import io.jsonwebtoken.Jwts;
import io.jsonwebtoken.SignatureAlgorithm; import io.jsonwebtoken.SignatureAlgorithm;
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.beans.factory.annotation.Value;
import org.springframework.context.annotation.Primary;
import org.springframework.core.annotation.Order; import org.springframework.core.annotation.Order;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.Base64; import java.util.Base64;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Set;
/** /**
* token验证处理 * token验证处理
* *
* @author zxfei * @author zxfei
*/ */
@Primary
@Service @Service("authTokenService")
@Order(1) @Order(1)
@Slf4j @Slf4j
public class AuthTokenServiceImpl implements IAuthTokenService { public class AuthTokenServiceImpl implements IAuthTokenService {
@Autowired
private UserService userService;
// 令牌自定义标识 // 令牌自定义标识
@Value("${token.header:Authorization}") @Value("${token.header:Authorization}")
private String header; private String header;
...@@ -54,9 +66,6 @@ public class AuthTokenServiceImpl implements IAuthTokenService { ...@@ -54,9 +66,6 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
@Value("${token.database:0}") @Value("${token.database:0}")
private Integer portalDb; private Integer portalDb;
@Value("${platform.type:cloud}")
private String platFormType;//版本,默认云服务版本
protected static final Long SECOND = 1l; protected static final Long SECOND = 1l;
protected static final Long SECOND_MINUTE = 60 * SECOND; protected static final Long SECOND_MINUTE = 60 * SECOND;
...@@ -72,6 +81,10 @@ public class AuthTokenServiceImpl implements IAuthTokenService { ...@@ -72,6 +81,10 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
@Autowired @Autowired
private ICacheService cacheService; private ICacheService cacheService;
@Autowired
private ResourceService resourceService;
/** /**
* 获取信息 * 获取信息
* *
...@@ -84,19 +97,42 @@ public class AuthTokenServiceImpl implements IAuthTokenService { ...@@ -84,19 +97,42 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
String token = getToken(request); String token = getToken(request);
if (StringUtils.isNotEmpty(token)) { if (StringUtils.isNotEmpty(token)) {
try { try {
boolean signed = Jwts.parser().isSigned(token);
if (!signed) {
log.error("token非法!=>{}", token);
return null;
}
Claims claims = parseToken(token); Claims claims = parseToken(token);
String uuid = (String) claims.get(SysConstains.LOGIN_USER_KEY); String uuid = (String) claims.get(SysConstains.LOGIN_USER_KEY);
String userKey = getTokenKey(uuid); String userKey = getTokenKey(uuid);
// cacheService.select(portalDb); /* cacheService.select(portalDb);
String userStr = cacheService.get(userKey); String userStr = cacheService.get(userKey);*/
// cacheService.select(db);
if (StringUtils.isNotEmpty(userStr)) { RedisTemplate<String, String> redisTemplate = cacheService.selectDbRedisTemplate(portalDb);
UserEntity userEntity = JSONObject.parseObject(userStr, UserEntity.class); String userStr =redisTemplate.opsForValue().get(userKey);
userEntity.setToken(token); //刷新token时间
UserEntity userEntity = JSONObject.parseObject(userStr, UserEntity.class);
if (!ObjectUtils.isEmpty(userEntity)) {
verifyToken(userEntity);
}
// cacheService.select(db);
if (!ObjectUtils.isEmpty(userEntity)) {
UserEntity temp = userService.getExtCache(userEntity.getLoginName());
if (!ObjectUtils.isEmpty(temp)) {
userEntity.setId(temp.getId());
}
//更新resource 路径
String menuUrlCode = cacheService.hget(RedisKey.KEY_USER_MENU_CACHE, userEntity.getId().toString(), String.class);
if (ObjectUtils.isEmpty(menuUrlCode)) {
Set<String> urls = resourceService.findUrlSetByUserId(userEntity.getId());
menuUrlCode = MenuEncodeUtil.generateMenuUrlCode(urls);
cacheService.hset(RedisKey.KEY_USER_MENU_CACHE, userEntity.getId().toString(), menuUrlCode);
}
userEntity.setMenuUrl(menuUrlCode);
return userEntity; return userEntity;
} }
} catch (Exception e) { } catch (Exception e) {
log.error("解析jwt token异常!", e); log.error("解析jwt token异常!,token:{}",token, e);
return null; return null;
} }
} }
...@@ -150,8 +186,8 @@ public class AuthTokenServiceImpl implements IAuthTokenService { ...@@ -150,8 +186,8 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
public void verifyToken(IUser user) { public void verifyToken(IUser user) {
long expireTime = user.getExpireTime(); long expireTime = user.getExpireTime();
long currentTime = System.currentTimeMillis(); long currentTime = System.currentTimeMillis();
if (expireTime - currentTime <= SECOND_MINUTE_TEN) { if (expireTime - currentTime <= SECOND_MINUTE_TEN*1000) {
log.info("不足十分钟,刷新过期时间"); log.info("不足十分钟,刷新过期时间");
refreshToken(user); refreshToken(user);
} }
} }
...@@ -163,7 +199,7 @@ public class AuthTokenServiceImpl implements IAuthTokenService { ...@@ -163,7 +199,7 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
*/ */
public void refreshToken(IUser user) { public void refreshToken(IUser user) {
//user.setLoginTime(System.currentTimeMillis()); //user.setLoginTime(System.currentTimeMillis());
user.setExpireTime(user.getLoginTime() == null ? System.currentTimeMillis() : user.getLoginTime() + expireTime * SECOND_MINUTE); user.setExpireTime(user.getLoginTime() == null ? System.currentTimeMillis() : user.getLoginTime() + expireTime * SECOND_MINUTE*1000);
// 根据uuid将user缓存 // 根据uuid将user缓存
String userKey = getTokenKey(user.getToken()); String userKey = getTokenKey(user.getToken());
//设置有效时间 单位秒 //设置有效时间 单位秒
...@@ -230,4 +266,11 @@ public class AuthTokenServiceImpl implements IAuthTokenService { ...@@ -230,4 +266,11 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
private String getTokenKey(String uuid) { private String getTokenKey(String uuid) {
return SysConstains.LOGIN_TOKEN_KEY + uuid; return SysConstains.LOGIN_TOKEN_KEY + uuid;
} }
public static void main(String[] args) {
// boolean signed = Jwts.parser().isSigned("123");
boolean signed = Jwts.parser().isSigned("eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJuaW5naGFvLm5ldCIsImV4cCI6IjE0Mzg5NTU0NDUiLCJuYW1lIjoid2FuZ2hhbyIsImFkbWluIjp0cnVlfQ.SwyHTEx_RQppr97g4J5lKXtabJecpejuef8AqKYMAJc");
System.out.println(signed);
}
} }
...@@ -9,7 +9,6 @@ import com.mortals.framework.util.AESUtil; ...@@ -9,7 +9,6 @@ import com.mortals.framework.util.AESUtil;
import com.mortals.framework.utils.ServletUtils; import com.mortals.framework.utils.ServletUtils;
import com.mortals.framework.web.interceptor.BaseInterceptor; import com.mortals.framework.web.interceptor.BaseInterceptor;
import com.mortals.xhx.base.framework.config.InterceptorConfig; import com.mortals.xhx.base.framework.config.InterceptorConfig;
import com.mortals.xhx.common.code.ApiRespCodeEnum;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -21,7 +20,6 @@ import javax.servlet.http.HttpServletResponse; ...@@ -21,7 +20,6 @@ import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import static com.mortals.xhx.common.key.ErrorCode.*; import static com.mortals.xhx.common.key.ErrorCode.*;
import static com.mortals.xhx.common.key.ErrorCode.ERROR_USER_OPERATION_CONTENT;
/** /**
* 用户权限验证,基于token * 用户权限验证,基于token
...@@ -74,7 +72,7 @@ public class AuthUserInterceptor extends BaseInterceptor { ...@@ -74,7 +72,7 @@ public class AuthUserInterceptor extends BaseInterceptor {
if (ObjectUtils.isEmpty(loginUser)) { if (ObjectUtils.isEmpty(loginUser)) {
ServletUtils.renderString(response, JSONObject.toJSONString(Rest.fail(ERROR_TOKEN_EXPIRED, ERROR_TOKEN_EXPIRED_CONTENT))); ServletUtils.renderString(response, JSONObject.toJSONString(Rest.fail(ERROR_TOKEN_EXPIRED, ERROR_TOKEN_EXPIRED_CONTENT)));
return false; return false;
} else if (loginUser.isAdmin() || loginUser.getUserType() == 1 || loginUser.getUserType() == 2) { } else if (loginUser.isAdmin() || loginUser.getUserType() == 1) {
return super.preHandle(request, response, handler); return super.preHandle(request, response, handler);
} else { } else {
ServletUtils.renderString(response, JSONObject.toJSONString(Rest.fail(ERROR_USER_OPERATION, ERROR_USER_OPERATION_CONTENT))); ServletUtils.renderString(response, JSONObject.toJSONString(Rest.fail(ERROR_USER_OPERATION, ERROR_USER_OPERATION_CONTENT)));
......
/** /**
* 文件:ResourceServiceImpl.java * 文件:ResourceServiceImpl.java
* 版本:1.0.0 * 版本:1.0.0
* 日期: * 日期:
* Copyright &reg; * Copyright &reg;
* All right reserved. * All right reserved.
*/ */
package com.mortals.xhx.base.system.resource.service.impl; package com.mortals.xhx.base.system.resource.service.impl;
...@@ -15,7 +15,6 @@ import com.mortals.xhx.base.system.resource.dao.ResourceDao; ...@@ -15,7 +15,6 @@ import com.mortals.xhx.base.system.resource.dao.ResourceDao;
import com.mortals.xhx.base.system.resource.model.ResourceEntity; import com.mortals.xhx.base.system.resource.model.ResourceEntity;
import com.mortals.xhx.base.system.resource.model.ResourceQuery; import com.mortals.xhx.base.system.resource.model.ResourceQuery;
import com.mortals.xhx.base.system.resource.service.ResourceService; import com.mortals.xhx.base.system.resource.service.ResourceService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.HashSet; import java.util.HashSet;
...@@ -27,7 +26,7 @@ import java.util.Set; ...@@ -27,7 +26,7 @@ import java.util.Set;
* <p>Description: ResourceServiceImpl service接口 </p> * <p>Description: ResourceServiceImpl service接口 </p>
* <p>Copyright: Copyright &reg; </p> * <p>Copyright: Copyright &reg; </p>
* <p>Company: </p> * <p>Company: </p>
* @author * @author
* @version 1.0.0 * @version 1.0.0
*/ */
@Service("resourceService") @Service("resourceService")
...@@ -52,7 +51,7 @@ public class ResourceServiceImpl extends AbstractCRUDServiceImpl<ResourceDao,Res ...@@ -52,7 +51,7 @@ public class ResourceServiceImpl extends AbstractCRUDServiceImpl<ResourceDao,Res
@Override @Override
public Set<String> findUrlSetByUserId(Long userId) throws AppException { public Set<String> findUrlSetByUserId(Long userId) throws AppException {
Set<String> urls = new HashSet<String>(); Set<String> urls = new HashSet<>();
List<ResourceEntity> resList = this.findListByUserId(userId); List<ResourceEntity> resList = this.findListByUserId(userId);
for (ResourceEntity res : resList) { for (ResourceEntity res : resList) {
String url = res.getUrl(); String url = res.getUrl();
...@@ -69,5 +68,7 @@ public class ResourceServiceImpl extends AbstractCRUDServiceImpl<ResourceDao,Res ...@@ -69,5 +68,7 @@ public class ResourceServiceImpl extends AbstractCRUDServiceImpl<ResourceDao,Res
public List<ResourceEntity> findAll(int userType) { public List<ResourceEntity> findAll(int userType) {
return dao.getAll(userType); return dao.getAll(userType);
} }
} }
\ No newline at end of file
...@@ -25,4 +25,5 @@ import java.util.List; ...@@ -25,4 +25,5 @@ import java.util.List;
public interface UserDao extends ICRUDDao<UserEntity,Long> { public interface UserDao extends ICRUDDao<UserEntity,Long> {
public List<Long> getAuthListById(Long id); public List<Long> getAuthListById(Long id);
int deleteNotIn(List<Long> keyList);
} }
\ No newline at end of file
...@@ -34,5 +34,8 @@ public class UserDaoImpl extends BaseCRUDDaoMybatis<UserEntity,Long> implements ...@@ -34,5 +34,8 @@ public class UserDaoImpl extends BaseCRUDDaoMybatis<UserEntity,Long> implements
param.getCondition().put("id", id); param.getCondition().put("id", id);
return getSqlSession().selectList(getSqlId("getAuthListById"), param); return getSqlSession().selectList(getSqlId("getAuthListById"), param);
} }
@Override
public int deleteNotIn(List<Long> keyList) {
return this.getSqlSession().delete(this.getSqlId("deleteByNotInKeyList"), keyList);
}
} }
\ No newline at end of file
/** /**
* 文件:UserService.java * 文件:UserService.java
* 版本:1.0.0 * 版本:1.0.0
* 日期: * 日期:
* Copyright &reg; * Copyright &reg;
* All right reserved. * All right reserved.
*/ */
package com.mortals.xhx.base.system.user.service; package com.mortals.xhx.base.system.user.service;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Result; import com.mortals.framework.model.Result;
import com.mortals.framework.service.ICRUDCacheService;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.framework.service.IUser; import com.mortals.framework.service.IUser;
import com.mortals.xhx.base.system.menu.model.MenuEntity; import com.mortals.xhx.base.system.menu.model.MenuEntity;
import com.mortals.xhx.base.system.user.dao.UserDao; import com.mortals.xhx.base.system.user.dao.UserDao;
import com.mortals.xhx.base.system.user.model.UserEntity; import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.common.pdu.user.UserPdu;
import com.mortals.xhx.common.pdu.user.UserPhpPdu; import com.mortals.xhx.common.pdu.user.UserPhpPdu;
import java.util.List; import java.util.List;
...@@ -26,11 +26,11 @@ import java.util.Set; ...@@ -26,11 +26,11 @@ import java.util.Set;
* <p>Description: UserService service接口 </p> * <p>Description: UserService service接口 </p>
* <p>Copyright: Copyright &reg; </p> * <p>Copyright: Copyright &reg; </p>
* <p>Company: </p> * <p>Company: </p>
* @author * @author
* @version 1.0.0 * @version 1.0.0
*/ */
public interface UserService extends ICRUDService<UserEntity,Long> { public interface UserService extends ICRUDCacheService<UserEntity,Long> {
/** /**
* 用户登录 * 用户登录
* *
...@@ -40,7 +40,7 @@ public interface UserService extends ICRUDService<UserEntity,Long> { ...@@ -40,7 +40,7 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
* @return * @return
* @throws AppException * @throws AppException
*/ */
UserEntity doLogin(String loginName, String password, String loginIp) throws AppException; UserEntity doLogin(String loginName, String password, String loginIp) throws AppException;
/** /**
* 校验用户名与密码是否正确 * 校验用户名与密码是否正确
...@@ -50,7 +50,7 @@ public interface UserService extends ICRUDService<UserEntity,Long> { ...@@ -50,7 +50,7 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
* @return * @return
* @throws AppException * @throws AppException
*/ */
UserEntity doCheckUser(String loginName, String password) throws AppException; UserEntity doCheckUser(String loginName, String password) throws AppException;
/** /**
* 检查用户是否存在 * 检查用户是否存在
...@@ -59,7 +59,7 @@ public interface UserService extends ICRUDService<UserEntity,Long> { ...@@ -59,7 +59,7 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
* @param userId 密码 * @param userId 密码
* @return * @return
*/ */
boolean existUser(String loginName, Long userId) throws AppException; boolean existUser(String loginName, Long userId) throws AppException;
/** /**
* 通过登录用户获取菜单功能权限 * 通过登录用户获取菜单功能权限
...@@ -67,7 +67,7 @@ public interface UserService extends ICRUDService<UserEntity,Long> { ...@@ -67,7 +67,7 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
* @param user * @param user
* @return * @return
*/ */
List<MenuEntity> findOutlookBarList(IUser user); List<MenuEntity> findOutlookBarList(IUser user);
/** /**
* 查询用户所有有权限的菜单ID * 查询用户所有有权限的菜单ID
...@@ -75,7 +75,7 @@ public interface UserService extends ICRUDService<UserEntity,Long> { ...@@ -75,7 +75,7 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
* @param userEntity * @param userEntity
* @return * @return
*/ */
Set<Long> findAllAuthIds(UserEntity userEntity) throws AppException; Set<Long> findAllAuthIds(UserEntity userEntity) throws AppException;
/** /**
* 查询用户记录 * 查询用户记录
...@@ -87,7 +87,7 @@ public interface UserService extends ICRUDService<UserEntity,Long> { ...@@ -87,7 +87,7 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
* @return * @return
* @throws AppException * @throws AppException
*/ */
Result<UserEntity> find(Long platformId, UserEntity params, int currPage, int prePageResult) throws AppException; Result<UserEntity> find(Long platformId, UserEntity params, int currPage, int prePageResult) throws AppException;
/** /**
* 为客户创建用户 * 为客户创建用户
...@@ -102,8 +102,8 @@ public interface UserService extends ICRUDService<UserEntity,Long> { ...@@ -102,8 +102,8 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
* @return * @return
* @throws AppException * @throws AppException
*/ */
UserEntity createUser(IUser currUser, Long customerId, String customerName, String loginName, String password, UserEntity createUser(IUser currUser, Long customerId, String customerName, String loginName, String password,
String userName, String mobile) throws AppException; String userName, String mobile) throws AppException;
/** /**
* 用户修改密码 * 用户修改密码
...@@ -114,10 +114,10 @@ public interface UserService extends ICRUDService<UserEntity,Long> { ...@@ -114,10 +114,10 @@ public interface UserService extends ICRUDService<UserEntity,Long> {
* @return * @return
* @throws AppException * @throws AppException
*/ */
boolean updateUserPwd(String loginName, String oldPwd, String newPwd) throws AppException; boolean updateUserPwd(String loginName, String oldPwd, String newPwd) throws AppException;
void updateUserList(List<UserPhpPdu> list); void updateUserList(List<UserPhpPdu> list);
UserDao getUserDao(); UserDao getUserDao();
} }
\ No newline at end of file
...@@ -15,11 +15,11 @@ import com.mortals.framework.model.Context; ...@@ -15,11 +15,11 @@ import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result; import com.mortals.framework.model.Result;
import com.mortals.framework.service.IUser; import com.mortals.framework.service.IUser;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl; import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.util.DataUtil; import com.mortals.framework.util.DataUtil;
import com.mortals.framework.util.SecurityUtil; import com.mortals.framework.util.SecurityUtil;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.framework.util.ThreadPool;
import com.mortals.xhx.base.system.menu.model.MenuEntity; import com.mortals.xhx.base.system.menu.model.MenuEntity;
import com.mortals.xhx.base.system.menu.service.MenuService; import com.mortals.xhx.base.system.menu.service.MenuService;
import com.mortals.xhx.base.system.resource.model.ResourceEntity; import com.mortals.xhx.base.system.resource.model.ResourceEntity;
...@@ -32,12 +32,7 @@ import com.mortals.xhx.base.system.user.dao.UserDao; ...@@ -32,12 +32,7 @@ import com.mortals.xhx.base.system.user.dao.UserDao;
import com.mortals.xhx.base.system.user.model.UserEntity; 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.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService; import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.pdu.user.UserPhpPdu; import com.mortals.xhx.common.pdu.user.UserPhpPdu;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.common.utils.SyncTreeSiteThread;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -56,7 +51,7 @@ import java.util.stream.Collectors; ...@@ -56,7 +51,7 @@ import java.util.stream.Collectors;
* @version 1.0.0 * @version 1.0.0
*/ */
@Service("userService") @Service("userService")
public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity, Long> implements UserService { public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserEntity, Long> implements UserService {
@Autowired @Autowired
...@@ -326,6 +321,7 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity ...@@ -326,6 +321,7 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
@Override @Override
public void updateUserList(List<UserPhpPdu> list) { public void updateUserList(List<UserPhpPdu> list) {
if(!CollectionUtils.isEmpty(list)){ if(!CollectionUtils.isEmpty(list)){
List<Long> userIdList = new ArrayList<>();
for(UserPhpPdu phpPdu:list){ for(UserPhpPdu phpPdu:list){
UserEntity tempUser = this.selectOne(new UserQuery().loginName(phpPdu.getAccount())); UserEntity tempUser = this.selectOne(new UserQuery().loginName(phpPdu.getAccount()));
if (ObjectUtils.isEmpty(tempUser)) { if (ObjectUtils.isEmpty(tempUser)) {
...@@ -341,10 +337,12 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity ...@@ -341,10 +337,12 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
throw new AppException("密码转换异常!", e); throw new AppException("密码转换异常!", e);
} }
entity.setUserType(DataUtil.converStr2Int(phpPdu.getType(),1)); entity.setUserType(DataUtil.converStr2Int(phpPdu.getType(),1));
this.save(entity); dao.insert(entity);
userIdList.add(entity.getId());
} else { } else {
//更新 //更新
UserEntity userEntity = new UserEntity(); UserEntity userEntity = new UserEntity();
userEntity.setId(tempUser.getId());
userEntity.setLoginName(phpPdu.getAccount()); userEntity.setLoginName(phpPdu.getAccount());
userEntity.setRealName(phpPdu.getUser_name()); userEntity.setRealName(phpPdu.getUser_name());
userEntity.setMobile(phpPdu.getMobile()); userEntity.setMobile(phpPdu.getMobile());
...@@ -354,9 +352,13 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity ...@@ -354,9 +352,13 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
throw new AppException("密码转换异常!", e); throw new AppException("密码转换异常!", e);
} }
userEntity.setUserType(DataUtil.converStr2Int(phpPdu.getType(),1)); userEntity.setUserType(DataUtil.converStr2Int(phpPdu.getType(),1));
this.update(userEntity); dao.update(userEntity);
userIdList.add(tempUser.getId());
} }
} }
if(userIdList.size()>0){
dao.deleteNotIn(userIdList);
}
} }
} }
......
...@@ -10,4 +10,5 @@ public class RedisKey { ...@@ -10,4 +10,5 @@ public class RedisKey {
*/ */
public static final String KEY_MENU_CACHE = "iot:base:MenuCacheKey:"; public static final String KEY_MENU_CACHE = "iot:base:MenuCacheKey:";
public static final String KEY_USER_MENU_CACHE = "user:menu";
} }
package com.mortals.xhx.common.utils;
import com.mortals.framework.ap.GlobalSysInfo;
import com.mortals.framework.ap.SysConstains;
import com.mortals.framework.util.AESUtil;
import lombok.extern.slf4j.Slf4j;
import java.util.Set;
@Slf4j
public class MenuEncodeUtil {
public static String generateMenuUrlCode(Set<String> urls) {
try {
String securityKey = GlobalSysInfo.getPropertyValue(SysConstains.PROP_COOKIE_SECURITY_KEY);
StringBuilder sb = new StringBuilder();
if (urls != null && urls.size() > 0) {
for (String url : urls) {
int index = url.hashCode() & (Integer.MAX_VALUE - 1);
sb.append(index).append(",");
}
}
String menuUrl = sb.toString();
return AESUtil.encrypt(menuUrl, securityKey);
} catch (Throwable e) {
log.error("编码异常",e);
return null;
}
}
}
package com.mortals.xhx.common.utils; //package com.mortals.xhx.common.utils;
//
import com.alibaba.fastjson.JSON; //import com.alibaba.fastjson.JSON;
import com.mortals.framework.model.Context; //import com.mortals.framework.model.Context;
import com.mortals.xhx.module.site.model.SiteTreeSelect; //import com.mortals.xhx.module.site.model.SiteTreeSelect;
import com.mortals.xhx.module.site.service.SiteService; //import com.mortals.xhx.module.site.service.SiteService;
import com.mortals.xhx.utils.SpringUtils; //import com.mortals.xhx.utils.SpringUtils;
import lombok.AllArgsConstructor; //import lombok.AllArgsConstructor;
import lombok.extern.apachecommons.CommonsLog; //import lombok.extern.apachecommons.CommonsLog;
import lombok.extern.slf4j.Slf4j; //import lombok.extern.slf4j.Slf4j;
import org.springframework.util.ObjectUtils; //import org.springframework.util.ObjectUtils;
//
import java.util.List; //import java.util.List;
//
/** ///**
* @author: zxfei // * @author: zxfei
* @date: 2022/4/13 13:34 // * @date: 2022/4/13 13:34
* @description: // * @description:
**/ // **/
@AllArgsConstructor //@AllArgsConstructor
@Slf4j //@Slf4j
public class SyncTreeSiteThread implements Runnable { //public class SyncTreeSiteThread implements Runnable {
//
private Context context; // private Context context;
//
@Override // @Override
public void run() { // public void run() {
SiteService siteService = SpringUtils.getBean(SiteService.class); // SiteService siteService = SpringUtils.getBean(SiteService.class);
List<SiteTreeSelect> siteTreeSelects = siteService.siteTree(context); // List<SiteTreeSelect> siteTreeSelects = siteService.siteTree(context);
siteService.setSiteTree(siteTreeSelects, context); // siteService.setSiteTree(siteTreeSelects, context);
log.info("刷新用户站点树=》userID:{} siteIds:{} siteTree:{}",context.getUser().getId(),context.getUser().getSiteIds(), JSON.toJSONString(siteService.getSiteTree(context))); // log.info("刷新用户站点树=》userID:{} siteIds:{} siteTree:{}",context.getUser().getId(),context.getUser().getSiteIds(), JSON.toJSONString(siteService.getSiteTree(context)));
} // }
//
} //}
package com.mortals.xhx.daemon.task;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService;
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.code.YesNoEnum;
import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.user.UserPdu;
import com.mortals.xhx.feign.user.IUserFeign;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 同步门户用户
*/
@Slf4j
@Service("SyncPortalUserTask")
public class SyncPortalUserTaskImpl implements ITaskExcuteService {
@Autowired
private IUserFeign userFeign;
@Autowired
private UserService userService;
@Override
public void excuteTask(ITask task) throws AppException {
try {
log.info("同步门户用户");
syncPersons();
} catch (Exception e) {
log.error("同步门户异常", e);
}
}
private void syncPersons() {
UserPdu userPdu = new UserPdu();
userPdu.setPage(1);
userPdu.setSize(-1);
Rest<RespData<List<UserPdu>>> resp = userFeign.list(userPdu);
if (resp.getCode() == YesNoEnum.YES.getValue()) {
List<UserPdu> userPduList = resp.getData().getData();
log.info("用户总数量:{}", userPduList.size());
if (!ObjectUtils.isEmpty(userPduList)) {
List<UserEntity> newUserList = userPduList.stream().map(newUser -> {
UserEntity userEntity = new UserEntity();
userEntity.initAttrValue();
BeanUtils.copyProperties(newUser, userEntity, new String[]{"id", "lastLoginTime", "lastLoginAddress"});
return userEntity;
}).collect(Collectors.toList());
List<UserEntity> oldUserList = userService.find(new UserQuery());
log.info(" oldUserList size:{}", oldUserList.size());
//当前用户map
Map<String, UserEntity> oldUserMap = oldUserList.parallelStream().collect(Collectors.toMap(x -> x.getLoginName(), y -> y, (o, n) -> n));
//门户用户map
// Map<String, UserEntity> newUserMap = newUserList.stream().collect(Collectors.toMap(x -> x.getLoginName(), y -> y, (o, n) -> n));
List<UserEntity> saveUserList = newUserList.stream().map(item -> {
if (!oldUserMap.containsKey(item.getLoginName())) {
item.setCreateUserId(1L);
item.setCreateUserName("系统管理员");
item.setCreateTime(new Date());
return item;
}
return null;
}).filter(f -> f != null).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(saveUserList)) {
log.info("用户新增,size:{}", saveUserList.size());
saveUserList.stream().forEach(item -> {
userService.getUserDao().insert(item);
});
}
// List<ApproverEntity> newApproverList = userPduList.stream().map(newUser -> {
// ApproverEntity approverEntity = new ApproverEntity();
// approverEntity.initAttrValue();
// approverEntity.setFullName(newUser.getRealName());
// if(StringUtils.isNotEmpty(newUser.getPhone())) {
// approverEntity.setPhoneNumber(newUser.getMobile());
// }else {
// approverEntity.setPhoneNumber("13888888888");
// }
// approverEntity.setLoginName(newUser.getLoginName());
// approverEntity.setLoginPwd(newUser.getLoginPwd());
// return approverEntity;
// }).collect(Collectors.toList());
// List<ApproverEntity> oldApproverList = approverService.find(new ApproverQuery());
// log.info(" oldApproverList size:{}", oldApproverList.size());
// //当前单事项审批人员
// Map<String, ApproverEntity> oldApproverMap = oldApproverList.parallelStream().collect(Collectors.toMap(x -> x.getLoginName(), y -> y, (o, n) -> n));
// List<ApproverEntity> saveApproverList = newApproverList.stream().map(item -> {
// if (!oldApproverMap.containsKey(item.getLoginName())) {
// item.setCreateUserId(1L);
// item.setCreateUserName("系统管理员");
// item.setCreateTime(new Date());
// return item;
// }
// return null;
// }).filter(f -> f != null).collect(Collectors.toList());
//
//
// if (!ObjectUtils.isEmpty(saveApproverList)) {
// log.info("单事项审批人员新增,size:{}", saveApproverList.size());
// saveApproverList.stream().forEach(item -> {
// approverService.getDao().insert(item);
// });
// }
}
//查找新增 与更新
}
}
@Override
public void stopTask(ITask task) throws AppException {
}
}
package com.mortals.xhx.daemon.task; //package com.mortals.xhx.daemon.task;
//
import com.alibaba.fastjson.JSON; //import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; //import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; //import com.alibaba.fastjson.JSONObject;
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.exception.AppException; //import com.mortals.framework.exception.AppException;
import com.mortals.framework.service.ITask; //import com.mortals.framework.service.ITask;
import com.mortals.framework.service.ITaskExcuteService; //import com.mortals.framework.service.ITaskExcuteService;
import com.mortals.framework.util.HttpUtil; //import com.mortals.framework.util.HttpUtil;
import com.mortals.xhx.base.system.user.service.UserService; //import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.pdu.user.UserPhpPdu; //import com.mortals.xhx.common.pdu.user.UserPhpPdu;
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.stereotype.Service; //import org.springframework.stereotype.Service;
//
import java.util.HashMap; //import java.util.HashMap;
import java.util.List; //import java.util.List;
//
import static com.mortals.xhx.common.key.Constant.PARAM_SERVER_PHP_HTTP_URL; //import static com.mortals.xhx.common.key.Constant.PARAM_SERVER_PHP_HTTP_URL;
//
/** ///**
* 同步用户 // * 同步用户
*/ // */
@Slf4j //@Slf4j
@Service("SyncUserTask") //@Service("SyncUserTask")
public class SyncUserTaskImpl implements ITaskExcuteService { //public class SyncUserTaskImpl implements ITaskExcuteService {
//
//
@Override // @Override
public void excuteTask(ITask task) throws AppException { // public void excuteTask(ITask task) throws AppException {
//
//
} // }
//
//
@Override // @Override
public void stopTask(ITask task) throws AppException { // public void stopTask(ITask task) throws AppException {
//
} // }
//
//
} //}
package com.mortals.xhx.module.question.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.question.model.QuestionEntity;
import java.util.List;
/**
* 常见问题Dao
* 常见问题 DAO接口
*
* @author zxfei
* @date 2025-05-15
*/
public interface QuestionDao extends ICRUDDao<QuestionEntity,Long>{
}
package com.mortals.xhx.module.question.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.question.dao.QuestionDao;
import com.mortals.xhx.module.question.model.QuestionEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 常见问题DaoImpl DAO接口
*
* @author zxfei
* @date 2025-05-15
*/
@Repository("questionDao")
public class QuestionDaoImpl extends BaseCRUDDaoMybatis<QuestionEntity,Long> implements QuestionDao {
}
package com.mortals.xhx.module.question.model;
import java.util.List;
import java.util.ArrayList;
import java.math.BigDecimal;
import cn.hutool.core.date.DateUtil;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.question.model.vo.QuestionVo;
import lombok.Data;
/**
* 常见问题实体对象
*
* @author zxfei
* @date 2025-05-15
*/
@Data
public class QuestionEntity extends QuestionVo {
private static final long serialVersionUID = 1L;
/**
* 问题标题
*/
private String title;
/**
* 所属部门id
*/
private Long deptId;
/**
* 所属部门名称
*/
private String deptName;
/**
* 问题详情
*/
private String details;
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof QuestionEntity) {
QuestionEntity tmp = (QuestionEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public void initAttrValue(){
this.title = "";
this.deptId = null;
this.deptName = "";
this.details = "";
}
}
\ No newline at end of file
package com.mortals.xhx.module.question.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.question.model.QuestionEntity;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
import com.mortals.framework.annotation.Excel;
import java.math.BigDecimal;
import java.util.Date;
/**
* 常见问题视图对象
*
* @author zxfei
* @date 2025-05-15
*/
@Data
public class QuestionVo extends BaseEntityLong {
/** 主键ID,主键,自增长列表 */
private List <Long> idList;
}
\ No newline at end of file
package com.mortals.xhx.module.question.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.question.model.QuestionEntity;
import com.mortals.xhx.module.question.dao.QuestionDao;
/**
* QuestionService
*
* 常见问题 service接口
*
* @author zxfei
* @date 2025-05-15
*/
public interface QuestionService extends ICRUDService<QuestionEntity,Long>{
QuestionDao getDao();
}
\ No newline at end of file
package com.mortals.xhx.module.question.service.impl;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.xhx.module.question.dao.QuestionDao;
import com.mortals.xhx.module.question.model.QuestionEntity;
import com.mortals.xhx.module.question.service.QuestionService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* QuestionService
* 常见问题 service实现
*
* @author zxfei
* @date 2025-05-15
*/
@Service("questionService")
@Slf4j
public class QuestionServiceImpl extends AbstractCRUDServiceImpl<QuestionDao, QuestionEntity, Long> implements QuestionService {
@Override
protected void saveBefore(QuestionEntity entity, Context context) throws AppException {
entity.setUpdateUserId(entity.getCreateUserId());
entity.setUpdateTime(entity.getCreateTime());
super.saveBefore(entity, context);
}
}
\ No newline at end of file
package com.mortals.xhx.module.question.web;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.user.model.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.module.question.model.QuestionEntity;
import com.mortals.xhx.module.question.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
import static java.util.stream.Collectors.toMap;
/**
*
* 常见问题
*
* @author zxfei
* @date 2025-05-15
*/
@RestController
@RequestMapping("question")
public class QuestionController extends BaseCRUDJsonBodyMappingController<QuestionService,QuestionEntity,Long> {
@Autowired
private UserService userService;
public QuestionController(){
super.setModuleDesc( "常见问题");
}
@Override
protected void init(Map<String, Object> model, Context context) {
this.addDict(model, "updateUserId", userService.find(new UserQuery()).stream().collect(toMap(x -> x.getId().toString(), y -> y.getRealName(), (o, n) -> n)));
super.init(model, context);
}
}
\ No newline at end of file
package com.mortals.xhx.module.site.dao;
import com.mortals.framework.dao.ICRUDDao;
import com.mortals.xhx.module.site.model.SiteMatterAssistViewsEntity;
import java.util.List;
/**
* 辅助接件事项浏览记录Dao
* 辅助接件事项浏览记录 DAO接口
*
* @author zxfei
* @date 2025-05-15
*/
public interface SiteMatterAssistViewsDao extends ICRUDDao<SiteMatterAssistViewsEntity,Long>{
}
package com.mortals.xhx.module.site.dao.ibatis;
import org.springframework.stereotype.Repository;
import com.mortals.xhx.module.site.dao.SiteMatterAssistViewsDao;
import com.mortals.xhx.module.site.model.SiteMatterAssistViewsEntity;
import java.util.Date;
import com.mortals.framework.dao.ibatis.BaseCRUDDaoMybatis;
import java.util.List;
/**
* 辅助接件事项浏览记录DaoImpl DAO接口
*
* @author zxfei
* @date 2025-05-15
*/
@Repository("siteMatterAssistViewsDao")
public class SiteMatterAssistViewsDaoImpl extends BaseCRUDDaoMybatis<SiteMatterAssistViewsEntity,Long> implements SiteMatterAssistViewsDao {
}
package com.mortals.xhx.module.site.model; package com.mortals.xhx.module.site.model;
import java.util.List; import java.util.List;
import java.util.ArrayList; import java.util.ArrayList;
import java.math.BigDecimal;
import cn.hutool.core.date.DateUtil;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel; import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.site.model.vo.SiteMatterAssistVo; import com.mortals.xhx.module.site.model.vo.SiteMatterAssistVo;
import lombok.Data;
/** /**
* 辅助接件事项实体对象 * 辅助接件事项实体对象
* *
* @author zxfei * @author zxfei
* @date 2023-03-21 * @date 2025-05-15
*/ */
@Data
public class SiteMatterAssistEntity extends SiteMatterAssistVo { public class SiteMatterAssistEntity extends SiteMatterAssistVo {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -72,210 +75,10 @@ public class SiteMatterAssistEntity extends SiteMatterAssistVo { ...@@ -72,210 +75,10 @@ public class SiteMatterAssistEntity extends SiteMatterAssistVo {
* 政务网地址 * 政务网地址
*/ */
private String govUrl; private String govUrl;
public SiteMatterAssistEntity(){}
/**
* 获取 站点事项id
* @return Long
*/
public Long getSiteMatterId(){
return siteMatterId;
}
/**
* 设置 站点事项id
* @param siteMatterId
*/
public void setSiteMatterId(Long siteMatterId){
this.siteMatterId = siteMatterId;
}
/**
* 获取 事项ID
* @return Long
*/
public Long getMatterId(){
return matterId;
}
/**
* 设置 事项ID
* @param matterId
*/
public void setMatterId(Long matterId){
this.matterId = matterId;
}
/**
* 获取 事项名称
* @return String
*/
public String getMatterName(){
return matterName;
}
/**
* 设置 事项名称
* @param matterName
*/
public void setMatterName(String matterName){
this.matterName = matterName;
}
/**
* 获取 事项编码
* @return String
*/
public String getMatterCode(){
return matterCode;
}
/**
* 设置 事项编码
* @param matterCode
*/
public void setMatterCode(String matterCode){
this.matterCode = matterCode;
}
/**
* 获取 部门ID
* @return Long
*/
public Long getDeptId(){
return deptId;
}
/**
* 设置 部门ID
* @param deptId
*/
public void setDeptId(Long deptId){
this.deptId = deptId;
}
/**
* 获取 部门名称
* @return String
*/
public String getDeptName(){
return deptName;
}
/**
* 设置 部门名称
* @param deptName
*/
public void setDeptName(String deptName){
this.deptName = deptName;
}
/** /**
* 获取 部门编码 * 推荐状态
* @return String
*/ */
public String getDeptCode(){ private Integer suggest;
return deptCode;
}
/**
* 设置 部门编码
* @param deptCode
*/
public void setDeptCode(String deptCode){
this.deptCode = deptCode;
}
/**
* 获取 股室ID
* @return Long
*/
public Long getOfficeId(){
return officeId;
}
/**
* 设置 股室ID
* @param officeId
*/
public void setOfficeId(Long officeId){
this.officeId = officeId;
}
/**
* 获取 股室名称
* @return String
*/
public String getOfficeName(){
return officeName;
}
/**
* 设置 股室名称
* @param officeName
*/
public void setOfficeName(String officeName){
this.officeName = officeName;
}
/**
* 获取 负责人姓名
* @return String
*/
public String getDutyer(){
return dutyer;
}
/**
* 设置 负责人姓名
* @param dutyer
*/
public void setDutyer(String dutyer){
this.dutyer = dutyer;
}
/**
* 获取 联系电话
* @return String
*/
public String getTelephone(){
return telephone;
}
/**
* 设置 联系电话
* @param telephone
*/
public void setTelephone(String telephone){
this.telephone = telephone;
}
/**
* 获取 事项来源
* @return Integer
*/
public Integer getSource(){
return source;
}
/**
* 设置 事项来源
* @param source
*/
public void setSource(Integer source){
this.source = source;
}
/**
* 获取 浏览次数
* @return Long
*/
public Long getViewsCount(){
return viewsCount;
}
/**
* 设置 浏览次数
* @param viewsCount
*/
public void setViewsCount(Long viewsCount){
this.viewsCount = viewsCount;
}
/**
* 获取 政务网地址
* @return String
*/
public String getGovUrl(){
return govUrl;
}
/**
* 设置 政务网地址
* @param govUrl
*/
public void setGovUrl(String govUrl){
this.govUrl = govUrl;
}
@Override @Override
public int hashCode() { public int hashCode() {
return this.getId().hashCode(); return this.getId().hashCode();
...@@ -292,53 +95,21 @@ public class SiteMatterAssistEntity extends SiteMatterAssistVo { ...@@ -292,53 +95,21 @@ public class SiteMatterAssistEntity extends SiteMatterAssistVo {
return false; return false;
} }
public String toString(){
StringBuilder sb = new StringBuilder("");
sb.append(",siteMatterId:").append(getSiteMatterId());
sb.append(",matterId:").append(getMatterId());
sb.append(",matterName:").append(getMatterName());
sb.append(",matterCode:").append(getMatterCode());
sb.append(",deptId:").append(getDeptId());
sb.append(",deptName:").append(getDeptName());
sb.append(",deptCode:").append(getDeptCode());
sb.append(",officeId:").append(getOfficeId());
sb.append(",officeName:").append(getOfficeName());
sb.append(",dutyer:").append(getDutyer());
sb.append(",telephone:").append(getTelephone());
sb.append(",source:").append(getSource());
sb.append(",viewsCount:").append(getViewsCount());
sb.append(",govUrl:").append(getGovUrl());
return sb.toString();
}
public void initAttrValue(){ public void initAttrValue(){
this.siteMatterId = null; this.siteMatterId = null;
this.matterId = null; this.matterId = null;
this.matterName = ""; this.matterName = "";
this.matterCode = ""; this.matterCode = "";
this.deptId = null; this.deptId = null;
this.deptName = ""; this.deptName = "";
this.deptCode = ""; this.deptCode = "";
this.officeId = null; this.officeId = null;
this.officeName = ""; this.officeName = "";
this.dutyer = ""; this.dutyer = "";
this.telephone = ""; this.telephone = "";
this.source = 0;
this.source = null;
this.viewsCount = 0L; this.viewsCount = 0L;
this.govUrl = ""; this.govUrl = "";
this.suggest = 0;
} }
} }
\ No newline at end of file
...@@ -6,7 +6,7 @@ import com.mortals.xhx.module.site.model.SiteMatterAssistEntity; ...@@ -6,7 +6,7 @@ import com.mortals.xhx.module.site.model.SiteMatterAssistEntity;
* 辅助接件事项查询对象 * 辅助接件事项查询对象
* *
* @author zxfei * @author zxfei
* @date 2023-03-21 * @date 2025-05-15
*/ */
public class SiteMatterAssistQuery extends SiteMatterAssistEntity { public class SiteMatterAssistQuery extends SiteMatterAssistEntity {
/** 开始 序号,主键,自增长 */ /** 开始 序号,主键,自增长 */
...@@ -196,6 +196,21 @@ public class SiteMatterAssistQuery extends SiteMatterAssistEntity { ...@@ -196,6 +196,21 @@ public class SiteMatterAssistQuery extends SiteMatterAssistEntity {
/** 结束 更新时间 */ /** 结束 更新时间 */
private String updateTimeEnd; private String updateTimeEnd;
/** 开始 推荐状态 */
private Integer suggestStart;
/** 结束 推荐状态 */
private Integer suggestEnd;
/** 增加 推荐状态 */
private Integer suggestIncrement;
/** 推荐状态列表 */
private List <Integer> suggestList;
/** 推荐状态排除列表 */
private List <Integer> suggestNotList;
/** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */ /** OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) */
private List<SiteMatterAssistQuery> orConditionList; private List<SiteMatterAssistQuery> orConditionList;
...@@ -1253,6 +1268,87 @@ public class SiteMatterAssistQuery extends SiteMatterAssistEntity { ...@@ -1253,6 +1268,87 @@ public class SiteMatterAssistQuery extends SiteMatterAssistEntity {
this.updateTimeEnd = updateTimeEnd; this.updateTimeEnd = updateTimeEnd;
} }
/**
* 获取 开始 推荐状态
* @return suggestStart
*/
public Integer getSuggestStart(){
return this.suggestStart;
}
/**
* 设置 开始 推荐状态
* @param suggestStart
*/
public void setSuggestStart(Integer suggestStart){
this.suggestStart = suggestStart;
}
/**
* 获取 结束 推荐状态
* @return $suggestEnd
*/
public Integer getSuggestEnd(){
return this.suggestEnd;
}
/**
* 设置 结束 推荐状态
* @param suggestEnd
*/
public void setSuggestEnd(Integer suggestEnd){
this.suggestEnd = suggestEnd;
}
/**
* 获取 增加 推荐状态
* @return suggestIncrement
*/
public Integer getSuggestIncrement(){
return this.suggestIncrement;
}
/**
* 设置 增加 推荐状态
* @param suggestIncrement
*/
public void setSuggestIncrement(Integer suggestIncrement){
this.suggestIncrement = suggestIncrement;
}
/**
* 获取 推荐状态
* @return suggestList
*/
public List<Integer> getSuggestList(){
return this.suggestList;
}
/**
* 设置 推荐状态
* @param suggestList
*/
public void setSuggestList(List<Integer> suggestList){
this.suggestList = suggestList;
}
/**
* 获取 推荐状态
* @return suggestNotList
*/
public List<Integer> getSuggestNotList(){
return this.suggestNotList;
}
/**
* 设置 推荐状态
* @param suggestNotList
*/
public void setSuggestNotList(List<Integer> suggestNotList){
this.suggestNotList = suggestNotList;
}
/** /**
* 设置 序号,主键,自增长 * 设置 序号,主键,自增长
* @param id * @param id
...@@ -1893,6 +1989,60 @@ public class SiteMatterAssistQuery extends SiteMatterAssistEntity { ...@@ -1893,6 +1989,60 @@ public class SiteMatterAssistQuery extends SiteMatterAssistEntity {
} }
/**
* 设置 推荐状态
* @param suggest
*/
public SiteMatterAssistQuery suggest(Integer suggest){
setSuggest(suggest);
return this;
}
/**
* 设置 开始 推荐状态
* @param suggestStart
*/
public SiteMatterAssistQuery suggestStart(Integer suggestStart){
this.suggestStart = suggestStart;
return this;
}
/**
* 设置 结束 推荐状态
* @param suggestEnd
*/
public SiteMatterAssistQuery suggestEnd(Integer suggestEnd){
this.suggestEnd = suggestEnd;
return this;
}
/**
* 设置 增加 推荐状态
* @param suggestIncrement
*/
public SiteMatterAssistQuery suggestIncrement(Integer suggestIncrement){
this.suggestIncrement = suggestIncrement;
return this;
}
/**
* 设置 推荐状态
* @param suggestList
*/
public SiteMatterAssistQuery suggestList(List<Integer> suggestList){
this.suggestList = suggestList;
return this;
}
/**
* 设置 推荐状态
* @param suggestNotList
*/
public SiteMatterAssistQuery suggestNotList(List<Integer> suggestNotList){
this.suggestNotList = suggestNotList;
return this;
}
/** /**
* 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4) * 获取 OR条件集合,列表项之间是OR,项内容之间是AND,如:(list[0].1 and list[0].2) or (list[1].3 and list[1].4)
* @return orConditionList * @return orConditionList
......
package com.mortals.xhx.module.site.model;
import java.util.List;
import java.util.ArrayList;
import java.math.BigDecimal;
import cn.hutool.core.date.DateUtil;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.mortals.framework.annotation.Excel;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.site.model.vo.SiteMatterAssistViewsVo;
import lombok.Data;
/**
* 辅助接件事项浏览记录实体对象
*
* @author zxfei
* @date 2025-05-15
*/
@Data
public class SiteMatterAssistViewsEntity extends SiteMatterAssistViewsVo {
private static final long serialVersionUID = 1L;
/**
* 辅助接件事项ID
*/
private Long assistId;
/**
* 事项ID
*/
private Long matterId;
/**
* 浏览用户id
*/
private Long viewUserId;
/**
* 浏览用户名称
*/
private String viewUserName;
@Override
public int hashCode() {
return this.getId().hashCode();
}
@Override
public boolean equals(Object obj) {
if (obj == null) return false;
if (obj instanceof SiteMatterAssistViewsEntity) {
SiteMatterAssistViewsEntity tmp = (SiteMatterAssistViewsEntity) obj;
if (this.getId() == tmp.getId()) {
return true;
}
}
return false;
}
public void initAttrValue(){
this.assistId = 0L;
this.matterId = null;
this.viewUserId = null;
this.viewUserName = "";
}
}
\ No newline at end of file
package com.mortals.xhx.module.site.model.vo;
import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.site.model.SiteMatterAssistViewsEntity;
import java.util.ArrayList;
import java.util.List;
import lombok.Data;
import com.mortals.framework.annotation.Excel;
import java.math.BigDecimal;
import java.util.Date;
/**
* 辅助接件事项浏览记录视图对象
*
* @author zxfei
* @date 2025-05-15
*/
@Data
public class SiteMatterAssistViewsVo extends BaseEntityLong {
/** 主键ID,主键,自增长列表 */
private List <Long> idList;
}
\ No newline at end of file
package com.mortals.xhx.module.site.service;
import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.site.model.SiteMatterAssistViewsEntity;
import com.mortals.xhx.module.site.dao.SiteMatterAssistViewsDao;
/**
* SiteMatterAssistViewsService
*
* 辅助接件事项浏览记录 service接口
*
* @author zxfei
* @date 2025-05-15
*/
public interface SiteMatterAssistViewsService extends ICRUDService<SiteMatterAssistViewsEntity,Long>{
SiteMatterAssistViewsDao getDao();
}
\ No newline at end of file
package com.mortals.xhx.module.site.service.impl;
import com.mortals.framework.model.PageInfo;
import org.springframework.beans.BeanUtils;
import java.util.function.Function;
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.site.dao.SiteMatterAssistViewsDao;
import com.mortals.xhx.module.site.model.SiteMatterAssistViewsEntity;
import com.mortals.xhx.module.site.service.SiteMatterAssistViewsService;
import lombok.extern.slf4j.Slf4j;
/**
* SiteMatterAssistViewsService
* 辅助接件事项浏览记录 service实现
*
* @author zxfei
* @date 2025-05-15
*/
@Service("siteMatterAssistViewsService")
@Slf4j
public class SiteMatterAssistViewsServiceImpl extends AbstractCRUDServiceImpl<SiteMatterAssistViewsDao, SiteMatterAssistViewsEntity, Long> implements SiteMatterAssistViewsService {
}
\ No newline at end of file
package com.mortals.xhx.module.site.web; package com.mortals.xhx.module.site.web;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.OrderCol;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService; import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.common.code.OperTypeEnum;
import com.mortals.xhx.module.site.model.SiteMatterEntity; import com.mortals.xhx.module.site.model.SiteMatterEntity;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
...@@ -44,15 +47,22 @@ public class SiteMatterAssistController extends BaseCRUDJsonBodyMappingControlle ...@@ -44,15 +47,22 @@ public class SiteMatterAssistController extends BaseCRUDJsonBodyMappingControlle
@Override @Override
protected void init(Map<String, Object> model, Context context) { protected void init(Map<String, Object> model, Context context) {
Map<String, String> suggest = new HashMap<>(2);
suggest.put("0", "取消推荐");
suggest.put("1", "推荐");
this.addDict(model, "source", paramService.getParamBySecondOrganize("SiteMatter","source")); this.addDict(model, "source", paramService.getParamBySecondOrganize("SiteMatter","source"));
this.addDict(model,"suggest",suggest);
super.init(model, context); super.init(model, context);
} }
@Override @Override
protected void doListBefore(SiteMatterAssistEntity query, Map<String, Object> model, Context context) throws AppException { protected void doListBefore(SiteMatterAssistEntity query, Map<String, Object> model, Context context) throws AppException {
Map<String,String> orderMap = new HashMap<>(); if (ObjectUtils.isEmpty(query.getOrderColList())) {
orderMap.put("viewsCount","DESC"); query.setOrderColList(Arrays.asList(new OrderCol("suggest", OrderCol.DESCENDING), new OrderCol("viewsCount", OrderCol.DESCENDING)));
query.setOrderCols(orderMap); } else {
query.getOrderColList().add(0,new OrderCol("viewsCount", OrderCol.DESCENDING));
query.getOrderColList().add(0,new OrderCol("suggest", OrderCol.DESCENDING));
}
super.doListBefore(query,model,context); super.doListBefore(query,model,context);
} }
...@@ -61,4 +71,48 @@ public class SiteMatterAssistController extends BaseCRUDJsonBodyMappingControlle ...@@ -61,4 +71,48 @@ public class SiteMatterAssistController extends BaseCRUDJsonBodyMappingControlle
this.service.addViewsCount(id); this.service.addViewsCount(id);
return 1; return 1;
} }
/**
* 推荐/取消推荐
* @param id
* @return
*/
@GetMapping(value = "suggest")
public String suggest(@RequestParam(value = "id") Long id) {
Map<String, Object> model = new HashMap();
if (id == null) {
return this.createFailJsonResp("请选择待操作的数据");
} else {
JSONObject ret = new JSONObject();
String busiDesc = "推荐/取消推荐" + this.getModuleDesc();
Context context = this.getContext();
try {
SiteMatterAssistEntity entity = this.service.get(id, context);
if (entity == null) {
throw new Exception(busiDesc + ",不存在或已被删除");
}
model.putAll(model);
model.put("entity", entity);
if (!ObjectUtils.isEmpty(context) && !ObjectUtils.isEmpty(context.getUser())) {
this.recordSysLog(this.request, busiDesc + " 【成功】");
}
if(entity.getSuggest()==0){
entity.setSuggest(1);
}else {
entity.setSuggest(0);
}
this.service.update(entity,context);
}catch (Exception var8) {
this.doException(this.request, busiDesc, model, var8);
Object msg = model.get("message_info");
return this.createFailJsonResp(msg == null ? "系统异常" : msg.toString());
}
this.init(model, context);
ret.put("data", model);
ret.put("code", 1);
ret.put("msg", model.remove("message_info"));
return ret.toJSONString();
}
}
} }
\ No newline at end of file
package com.mortals.xhx.module.site.web;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.param.service.ParamService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.model.Context;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.module.site.model.SiteMatterAssistViewsEntity;
import com.mortals.xhx.module.site.service.SiteMatterAssistViewsService;
import org.apache.commons.lang3.ArrayUtils;
import com.mortals.framework.util.StringUtils;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import java.util.Arrays;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*;
import com.mortals.xhx.common.code.*;
/**
*
* 辅助接件事项浏览记录
*
* @author zxfei
* @date 2025-05-15
*/
@RestController
@RequestMapping("site/matter/assist/views")
public class SiteMatterAssistViewsController extends BaseCRUDJsonBodyMappingController<SiteMatterAssistViewsService,SiteMatterAssistViewsEntity,Long> {
@Autowired
private ParamService paramService;
public SiteMatterAssistViewsController(){
super.setModuleDesc( "辅助接件事项浏览记录");
}
@Override
protected void init(Map<String, Object> model, Context context) {
super.init(model, context);
}
}
\ No newline at end of file
...@@ -451,6 +451,13 @@ ...@@ -451,6 +451,13 @@
#{item} #{item}
</foreach> </foreach>
</delete> </delete>
<!-- 根据主健列表删除一批,针对单一主健有效 -->
<delete id="deleteByNotInKeyList">
delete from mortals_xhx_user where id not in
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
<!-- 根据paramDto删除一批 --> <!-- 根据paramDto删除一批 -->
<delete id="deleteByMap" parameterType="paramDto"> <delete id="deleteByMap" parameterType="paramDto">
delete a.* from mortals_xhx_user as a delete a.* from mortals_xhx_user as a
......
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
<modules> <modules>
<module>common-lib</module> <module>common-lib</module>
<module>single-matter</module> <!--<module>single-matter</module>-->
<!-- <module>knowledge-base</module>--> <module>knowledge-base</module>
</modules> </modules>
<properties> <properties>
......
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