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 @@
<profiles.publish.path>/home/publish</profiles.publish.path>
<profiles.nacos.server-addr>192.168.0.252:8848</profiles.nacos.server-addr>
<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.level>INFO</profiles.log.level>
<package.environment>test</package.environment>
......
......@@ -7,31 +7,43 @@ import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.IUser;
import com.mortals.framework.util.DateUtils;
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.service.UserService;
import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.utils.MenuEncodeUtil;
import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts;
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.Primary;
import org.springframework.core.annotation.Order;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import javax.servlet.http.HttpServletRequest;
import java.util.Base64;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
/**
* token验证处理
*
* @author zxfei
*/
@Service
@Primary
@Service("authTokenService")
@Order(1)
@Slf4j
public class AuthTokenServiceImpl implements IAuthTokenService {
@Autowired
private UserService userService;
// 令牌自定义标识
@Value("${token.header:Authorization}")
private String header;
......@@ -54,9 +66,6 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
@Value("${token.database:0}")
private Integer portalDb;
@Value("${platform.type:cloud}")
private String platFormType;//版本,默认云服务版本
protected static final Long SECOND = 1l;
protected static final Long SECOND_MINUTE = 60 * SECOND;
......@@ -72,6 +81,10 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
@Autowired
private ICacheService cacheService;
@Autowired
private ResourceService resourceService;
/**
* 获取信息
*
......@@ -84,19 +97,42 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
String token = getToken(request);
if (StringUtils.isNotEmpty(token)) {
try {
boolean signed = Jwts.parser().isSigned(token);
if (!signed) {
log.error("token非法!=>{}", token);
return null;
}
Claims claims = parseToken(token);
String uuid = (String) claims.get(SysConstains.LOGIN_USER_KEY);
String userKey = getTokenKey(uuid);
// cacheService.select(portalDb);
String userStr = cacheService.get(userKey);
// cacheService.select(db);
if (StringUtils.isNotEmpty(userStr)) {
/* cacheService.select(portalDb);
String userStr = cacheService.get(userKey);*/
RedisTemplate<String, String> redisTemplate = cacheService.selectDbRedisTemplate(portalDb);
String userStr =redisTemplate.opsForValue().get(userKey);
//刷新token时间
UserEntity userEntity = JSONObject.parseObject(userStr, UserEntity.class);
userEntity.setToken(token);
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;
}
} catch (Exception e) {
log.error("解析jwt token异常!", e);
log.error("解析jwt token异常!,token:{}",token, e);
return null;
}
}
......@@ -150,8 +186,8 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
public void verifyToken(IUser user) {
long expireTime = user.getExpireTime();
long currentTime = System.currentTimeMillis();
if (expireTime - currentTime <= SECOND_MINUTE_TEN) {
log.info("不足十分钟,刷新过期时间");
if (expireTime - currentTime <= SECOND_MINUTE_TEN*1000) {
log.info("不足十分钟,刷新过期时间");
refreshToken(user);
}
}
......@@ -163,7 +199,7 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
*/
public void refreshToken(IUser user) {
//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缓存
String userKey = getTokenKey(user.getToken());
//设置有效时间 单位秒
......@@ -230,4 +266,11 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
private String getTokenKey(String 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;
import com.mortals.framework.utils.ServletUtils;
import com.mortals.framework.web.interceptor.BaseInterceptor;
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.stereotype.Component;
import org.springframework.util.ObjectUtils;
......@@ -21,7 +20,6 @@ import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Method;
import static com.mortals.xhx.common.key.ErrorCode.*;
import static com.mortals.xhx.common.key.ErrorCode.ERROR_USER_OPERATION_CONTENT;
/**
* 用户权限验证,基于token
......@@ -74,7 +72,7 @@ public class AuthUserInterceptor extends BaseInterceptor {
if (ObjectUtils.isEmpty(loginUser)) {
ServletUtils.renderString(response, JSONObject.toJSONString(Rest.fail(ERROR_TOKEN_EXPIRED, ERROR_TOKEN_EXPIRED_CONTENT)));
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);
} else {
ServletUtils.renderString(response, JSONObject.toJSONString(Rest.fail(ERROR_USER_OPERATION, ERROR_USER_OPERATION_CONTENT)));
......
/**
* 文件:ResourceServiceImpl.java
* 版本:1.0.0
* 日期:
* Copyright &reg;
* All right reserved.
*/
* 文件:ResourceServiceImpl.java
* 版本:1.0.0
* 日期:
* Copyright &reg;
* All right reserved.
*/
package com.mortals.xhx.base.system.resource.service.impl;
......@@ -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.ResourceQuery;
import com.mortals.xhx.base.system.resource.service.ResourceService;
import org.springframework.stereotype.Service;
import java.util.HashSet;
......@@ -52,7 +51,7 @@ public class ResourceServiceImpl extends AbstractCRUDServiceImpl<ResourceDao,Res
@Override
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);
for (ResourceEntity res : resList) {
String url = res.getUrl();
......@@ -70,4 +69,6 @@ public class ResourceServiceImpl extends AbstractCRUDServiceImpl<ResourceDao,Res
return dao.getAll(userType);
}
}
\ No newline at end of file
......@@ -25,4 +25,5 @@ import java.util.List;
public interface UserDao extends ICRUDDao<UserEntity,Long> {
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
param.getCondition().put("id", id);
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
* 版本:1.0.0
* 日期:
* Copyright &reg;
* All right reserved.
*/
* 文件:UserService.java
* 版本:1.0.0
* 日期:
* Copyright &reg;
* All right reserved.
*/
package com.mortals.xhx.base.system.user.service;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.ICRUDCacheService;
import com.mortals.framework.service.ICRUDService;
import com.mortals.framework.service.IUser;
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.model.UserEntity;
import com.mortals.xhx.common.pdu.user.UserPdu;
import com.mortals.xhx.common.pdu.user.UserPhpPdu;
import java.util.List;
......@@ -30,7 +30,7 @@ import java.util.Set;
* @version 1.0.0
*/
public interface UserService extends ICRUDService<UserEntity,Long> {
public interface UserService extends ICRUDCacheService<UserEntity,Long> {
/**
* 用户登录
*
......
......@@ -15,11 +15,11 @@ import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.IUser;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.framework.service.impl.AbstractCRUDServiceImpl;
import com.mortals.framework.util.DataUtil;
import com.mortals.framework.util.SecurityUtil;
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.service.MenuService;
import com.mortals.xhx.base.system.resource.model.ResourceEntity;
......@@ -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.UserQuery;
import com.mortals.xhx.base.system.user.service.UserService;
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.stereotype.Service;
import org.springframework.util.CollectionUtils;
......@@ -56,7 +51,7 @@ import java.util.stream.Collectors;
* @version 1.0.0
*/
@Service("userService")
public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity, Long> implements UserService {
public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserEntity, Long> implements UserService {
@Autowired
......@@ -326,6 +321,7 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
@Override
public void updateUserList(List<UserPhpPdu> list) {
if(!CollectionUtils.isEmpty(list)){
List<Long> userIdList = new ArrayList<>();
for(UserPhpPdu phpPdu:list){
UserEntity tempUser = this.selectOne(new UserQuery().loginName(phpPdu.getAccount()));
if (ObjectUtils.isEmpty(tempUser)) {
......@@ -341,10 +337,12 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
throw new AppException("密码转换异常!", e);
}
entity.setUserType(DataUtil.converStr2Int(phpPdu.getType(),1));
this.save(entity);
dao.insert(entity);
userIdList.add(entity.getId());
} else {
//更新
UserEntity userEntity = new UserEntity();
userEntity.setId(tempUser.getId());
userEntity.setLoginName(phpPdu.getAccount());
userEntity.setRealName(phpPdu.getUser_name());
userEntity.setMobile(phpPdu.getMobile());
......@@ -354,8 +352,12 @@ public class UserServiceImpl extends AbstractCRUDServiceImpl<UserDao, UserEntity
throw new AppException("密码转换异常!", e);
}
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 {
*/
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;
import com.alibaba.fastjson.JSON;
import com.mortals.framework.model.Context;
import com.mortals.xhx.module.site.model.SiteTreeSelect;
import com.mortals.xhx.module.site.service.SiteService;
import com.mortals.xhx.utils.SpringUtils;
import lombok.AllArgsConstructor;
import lombok.extern.apachecommons.CommonsLog;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.ObjectUtils;
import java.util.List;
/**
* @author: zxfei
* @date: 2022/4/13 13:34
* @description:
**/
@AllArgsConstructor
@Slf4j
public class SyncTreeSiteThread implements Runnable {
private Context context;
@Override
public void run() {
SiteService siteService = SpringUtils.getBean(SiteService.class);
List<SiteTreeSelect> siteTreeSelects = siteService.siteTree(context);
siteService.setSiteTree(siteTreeSelects, context);
log.info("刷新用户站点树=》userID:{} siteIds:{} siteTree:{}",context.getUser().getId(),context.getUser().getSiteIds(), JSON.toJSONString(siteService.getSiteTree(context)));
}
}
//package com.mortals.xhx.common.utils;
//
//import com.alibaba.fastjson.JSON;
//import com.mortals.framework.model.Context;
//import com.mortals.xhx.module.site.model.SiteTreeSelect;
//import com.mortals.xhx.module.site.service.SiteService;
//import com.mortals.xhx.utils.SpringUtils;
//import lombok.AllArgsConstructor;
//import lombok.extern.apachecommons.CommonsLog;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.util.ObjectUtils;
//
//import java.util.List;
//
///**
// * @author: zxfei
// * @date: 2022/4/13 13:34
// * @description:
// **/
//@AllArgsConstructor
//@Slf4j
//public class SyncTreeSiteThread implements Runnable {
//
// private Context context;
//
// @Override
// public void run() {
// SiteService siteService = SpringUtils.getBean(SiteService.class);
// List<SiteTreeSelect> siteTreeSelects = siteService.siteTree(context);
// siteService.setSiteTree(siteTreeSelects, 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;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.ap.GlobalSysInfo;
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.framework.util.HttpUtil;
import com.mortals.xhx.base.system.user.service.UserService;
import com.mortals.xhx.common.pdu.user.UserPhpPdu;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import static com.mortals.xhx.common.key.Constant.PARAM_SERVER_PHP_HTTP_URL;
/**
* 同步用户
*/
@Slf4j
@Service("SyncUserTask")
public class SyncUserTaskImpl implements ITaskExcuteService {
@Override
public void excuteTask(ITask task) throws AppException {
}
@Override
public void stopTask(ITask task) throws AppException {
}
}
//package com.mortals.xhx.daemon.task;
//
//import com.alibaba.fastjson.JSON;
//import com.alibaba.fastjson.JSONArray;
//import com.alibaba.fastjson.JSONObject;
//import com.mortals.framework.ap.GlobalSysInfo;
//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.framework.util.HttpUtil;
//import com.mortals.xhx.base.system.user.service.UserService;
//import com.mortals.xhx.common.pdu.user.UserPhpPdu;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Service;
//
//import java.util.HashMap;
//import java.util.List;
//
//import static com.mortals.xhx.common.key.Constant.PARAM_SERVER_PHP_HTTP_URL;
//
///**
// * 同步用户
// */
//@Slf4j
//@Service("SyncUserTask")
//public class SyncUserTaskImpl implements ITaskExcuteService {
//
//
// @Override
// public void excuteTask(ITask task) throws AppException {
//
//
// }
//
//
// @Override
// 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;
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.SiteMatterAssistVo;
import lombok.Data;
/**
* 辅助接件事项实体对象
*
* @author zxfei
* @date 2023-03-21
* @date 2025-05-15
*/
@Data
public class SiteMatterAssistEntity extends SiteMatterAssistVo {
private static final long serialVersionUID = 1L;
......@@ -72,210 +75,10 @@ public class SiteMatterAssistEntity extends SiteMatterAssistVo {
* 政务网地址
*/
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(){
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;
}
private Integer suggest;
@Override
public int hashCode() {
return this.getId().hashCode();
......@@ -292,53 +95,21 @@ public class SiteMatterAssistEntity extends SiteMatterAssistVo {
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(){
this.siteMatterId = null;
this.matterId = null;
this.matterName = "";
this.matterCode = "";
this.deptId = null;
this.deptName = "";
this.deptCode = "";
this.officeId = null;
this.officeName = "";
this.dutyer = "";
this.telephone = "";
this.source = null;
this.source = 0;
this.viewsCount = 0L;
this.govUrl = "";
this.suggest = 0;
}
}
\ No newline at end of file
......@@ -6,7 +6,7 @@ import com.mortals.xhx.module.site.model.SiteMatterAssistEntity;
* 辅助接件事项查询对象
*
* @author zxfei
* @date 2023-03-21
* @date 2025-05-15
*/
public class SiteMatterAssistQuery extends SiteMatterAssistEntity {
/** 开始 序号,主键,自增长 */
......@@ -196,6 +196,21 @@ public class SiteMatterAssistQuery extends SiteMatterAssistEntity {
/** 结束 更新时间 */
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) */
private List<SiteMatterAssistQuery> orConditionList;
......@@ -1253,6 +1268,87 @@ public class SiteMatterAssistQuery extends SiteMatterAssistEntity {
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
......@@ -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)
* @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;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.OrderCol;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
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 org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
......@@ -44,15 +47,22 @@ public class SiteMatterAssistController extends BaseCRUDJsonBodyMappingControlle
@Override
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,"suggest",suggest);
super.init(model, context);
}
@Override
protected void doListBefore(SiteMatterAssistEntity query, Map<String, Object> model, Context context) throws AppException {
Map<String,String> orderMap = new HashMap<>();
orderMap.put("viewsCount","DESC");
query.setOrderCols(orderMap);
if (ObjectUtils.isEmpty(query.getOrderColList())) {
query.setOrderColList(Arrays.asList(new OrderCol("suggest", OrderCol.DESCENDING), new OrderCol("viewsCount", OrderCol.DESCENDING)));
} else {
query.getOrderColList().add(0,new OrderCol("viewsCount", OrderCol.DESCENDING));
query.getOrderColList().add(0,new OrderCol("suggest", OrderCol.DESCENDING));
}
super.doListBefore(query,model,context);
}
......@@ -61,4 +71,48 @@ public class SiteMatterAssistController extends BaseCRUDJsonBodyMappingControlle
this.service.addViewsCount(id);
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 @@
#{item}
</foreach>
</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删除一批 -->
<delete id="deleteByMap" parameterType="paramDto">
delete a.* from mortals_xhx_user as a
......
......@@ -16,8 +16,8 @@
<modules>
<module>common-lib</module>
<module>single-matter</module>
<!-- <module>knowledge-base</module>-->
<!--<module>single-matter</module>-->
<module>knowledge-base</module>
</modules>
<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