Commit 8c2fabbd authored by “yiyousong”'s avatar “yiyousong”
parents 3211fce1 e7b4bcb5
...@@ -9,7 +9,9 @@ ...@@ -9,7 +9,9 @@
package com.mortals.xhx.base.system.resource.service; package com.mortals.xhx.base.system.resource.service;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.base.system.resource.model.ResourceEntity; import com.mortals.xhx.base.system.resource.model.ResourceEntity;
...@@ -31,7 +33,7 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> { ...@@ -31,7 +33,7 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> {
* @return * @return
* @throws AppException * @throws AppException
*/ */
public List<ResourceEntity> findAllEnable() throws AppException; List<ResourceEntity> findAllEnable() throws AppException;
/** /**
* 根据用户查询可用资源 * 根据用户查询可用资源
...@@ -39,7 +41,7 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> { ...@@ -39,7 +41,7 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> {
* @return * @return
* @throws AppException * @throws AppException
*/ */
public List<ResourceEntity> findListByUserId(Long userId) throws AppException; List<ResourceEntity> findListByUserId(Long userId) throws AppException;
/** /**
* 查询用户可用资源 * 查询用户可用资源
...@@ -47,7 +49,7 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> { ...@@ -47,7 +49,7 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> {
* @return 字符串,多个以逗号分隔 * @return 字符串,多个以逗号分隔
* @throws AppException * @throws AppException
*/ */
public String findUrlByUserId(Long userId) throws AppException; String findUrlByUserId(Long userId) throws AppException;
/** /**
* 查询用户用资源集合 * 查询用户用资源集合
...@@ -55,7 +57,7 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> { ...@@ -55,7 +57,7 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> {
* @return * @return
* @throws AppException * @throws AppException
*/ */
public Set<String> findUrlSetByUserId(Long userId) throws AppException; Set<String> findUrlSetByUserId(Long userId) throws AppException;
/** /**
* 获取所有资源,不分页 * 获取所有资源,不分页
...@@ -63,5 +65,8 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> { ...@@ -63,5 +65,8 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> {
* @param userType * @param userType
*/ */
List<ResourceEntity> findAll(int userType); List<ResourceEntity> findAll(int userType);
Rest<String> refreshResourceUrl(String packageName, Context context);
} }
\ No newline at end of file
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
package com.mortals.xhx.base.system.resource.service.impl; package com.mortals.xhx.base.system.resource.service.impl;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICacheService; import com.mortals.framework.service.ICacheService;
...@@ -18,19 +19,17 @@ import com.mortals.xhx.base.system.resource.dao.ResourceDao; ...@@ -18,19 +19,17 @@ 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 com.mortals.xhx.base.system.role.model.RoleAuthEntity; import com.mortals.xhx.base.system.role.model.RoleAuthEntity;
import com.mortals.xhx.base.system.role.model.RoleAuthQuery; import com.mortals.xhx.base.system.role.model.RoleAuthQuery;
import com.mortals.xhx.base.system.role.service.RoleAuthService; import com.mortals.xhx.base.system.role.service.RoleAuthService;
import com.mortals.xhx.common.key.RedisKey; import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.utils.ControllerScanUtil;
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.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.Arrays; import java.util.*;
import java.util.HashSet; import java.util.stream.Collectors;
import java.util.List;
import java.util.Set;
import static com.mortals.xhx.common.utils.MenuEncodeUtil.generateMenuUrlCode; import static com.mortals.xhx.common.utils.MenuEncodeUtil.generateMenuUrlCode;
...@@ -39,6 +38,7 @@ import static com.mortals.xhx.common.utils.MenuEncodeUtil.generateMenuUrlCode; ...@@ -39,6 +38,7 @@ import static com.mortals.xhx.common.utils.MenuEncodeUtil.generateMenuUrlCode;
* <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
*/ */
...@@ -88,6 +88,74 @@ public class ResourceServiceImpl extends AbstractCRUDServiceImpl<ResourceDao, Re ...@@ -88,6 +88,74 @@ public class ResourceServiceImpl extends AbstractCRUDServiceImpl<ResourceDao, Re
return dao.getAll(userType); return dao.getAll(userType);
} }
@Override
public Rest<String> refreshResourceUrl(String packageName, Context context) {
List<Class<?>> classList = ControllerScanUtil.getAllClassByPackageName(packageName);
//System.out.println(classList); //获取到了所有的类
List<ResourceEntity> newResourcelist = ControllerScanUtil.getAnnotationInfo(classList).stream().filter(f->!ObjectUtils.isEmpty(f.getUrl())).collect(Collectors.toList());
Map<String, List<ResourceEntity>> localResourceMap = this.find(new ResourceQuery()).stream().collect(Collectors.groupingBy(x -> x.getName()));
Map<String, List<ResourceEntity>> newResourceMap = newResourcelist.stream().collect(Collectors.groupingBy(x -> x.getName()));
//更新 与新增 新加的;
newResourceMap.entrySet().forEach(item -> {
List<ResourceEntity> resourceEntities = item.getValue();
if (ObjectUtils.isEmpty(resourceEntities)) return;
if (resourceEntities.size() == 1) {
ResourceEntity resourceEntity = resourceEntities.get(0);
saveUpdateResourceEntity(context, localResourceMap, resourceEntity);
} else if (resourceEntities.size() > 1) {
//原始扫描 有多个资源列表针对一个名称的
for (ResourceEntity resourceEntity : resourceEntities) {
saveUpdateResourceEntity(context, localResourceMap, resourceEntity);
}
}
});
return Rest.ok();
}
private void saveUpdateResourceEntity(Context context, Map<String, List<ResourceEntity>> localResourceMap, ResourceEntity resourceEntity) {
//查找 本地是否已经存在了
List<ResourceEntity> tempResourceList = localResourceMap.getOrDefault(resourceEntity.getName(), new ArrayList<>());
if (tempResourceList.size() == 0) {
//新增 resource;
resourceEntity.setCreateUserId(this.getContextUserId(context));
resourceEntity.setCreateTime(new Date());
this.save(resourceEntity, context);
} else if (tempResourceList.size() == 1) {
//更新
ResourceEntity tempResource = tempResourceList.get(0);
Set<String> setUrl = Arrays.stream(resourceEntity.getUrl().split(",")).collect(Collectors.toSet());
Arrays.stream(tempResource.getUrl().split(",")).forEach(i -> {
setUrl.add(i);
});
tempResource.setUrl(setUrl.stream().collect(Collectors.joining(",")));
this.update(tempResource, context);
} else if (tempResourceList.size() > 1) {
//找到多个同名的 资源配置
for (ResourceEntity tempResource : tempResourceList) {
//模糊匹配到路径有一个存在的
Set<String> setUrl = Arrays.stream(resourceEntity.getUrl().split(",")).collect(Collectors.toSet());
String[] splitUrl = tempResource.getUrl().split(",");
Boolean bool = false;
for (int i = 0; i < splitUrl.length; i++) {
if (setUrl.contains(splitUrl[i])) {
bool = true;
break;
}
}
if (bool) {
//匹配到了,更新当前这个资源
Arrays.stream(tempResource.getUrl().split(",")).forEach(i -> {
setUrl.add(i);
});
tempResource.setUrl(setUrl.stream().collect(Collectors.joining(",")));
this.update(tempResource, context);
}
}
}
}
@Override @Override
protected void updateAfter(ResourceEntity entity, Context context) throws AppException { protected void updateAfter(ResourceEntity entity, Context context) throws AppException {
......
package com.mortals.xhx.base.system.resource.web; package com.mortals.xhx.base.system.resource.web;
import java.util.HashMap; import com.alibaba.fastjson.JSONObject;
import java.util.Map; import com.mortals.framework.annotation.UnAuth;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.mortals.framework.common.IBaseEnum; import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.common.Rest;
import com.mortals.framework.common.code.UserType; import com.mortals.framework.common.code.UserType;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.resource.model.ResourceEntity;
import com.mortals.xhx.base.system.resource.service.ResourceService;
import com.mortals.xhx.common.code.AuthType;
import com.mortals.xhx.common.code.SourceType;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import com.alibaba.fastjson.JSONObject; import java.util.HashMap;
import com.mortals.framework.model.Context; import java.util.Map;
import com.mortals.framework.web.BaseCRUDJsonMappingController;
import com.mortals.xhx.base.system.resource.model.ResourceEntity;
import com.mortals.xhx.base.system.resource.service.ResourceService;
import com.mortals.xhx.common.code.AuthType;
import com.mortals.xhx.common.code.SourceType;
/** /**
* 资源信息 * 资源信息
...@@ -32,37 +31,63 @@ import com.mortals.xhx.common.code.SourceType; ...@@ -32,37 +31,63 @@ import com.mortals.xhx.common.code.SourceType;
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("resource") @RequestMapping("resource")
public class ResourceController extends BaseCRUDJsonBodyMappingController<ResourceService,ResourceEntity,Long> { public class ResourceController extends BaseCRUDJsonBodyMappingController<ResourceService, ResourceEntity, Long> {
public ResourceController() {
super.setModuleDesc("资源信息");
}
@Override
protected void init(Map<String, Object> model, Context context) {
Map<String, Object> statsus = new HashMap<String, Object>();
statsus.put("authType", AuthType.getEnumMap());
statsus.put("sourceType", SourceType.getEnumMap());
if (getCurUser().isAdmin()) {
statsus.put("userType", IBaseEnum.getEnumMap(UserType.class));
} else {
statsus.put("userType", UserType.findByValue(getCurUser().getUserType()));
}
model.put(KEY_RESULT_DICT, statsus);
}
/**
* 获取所有资源
*
* @return
*/
@PostMapping("allResources")
public String allResources(int userType) {
JSONObject ret = new JSONObject();
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "所有的customer以及user");
ret.put(KEY_RESULT_DATA, service.findAll(userType));
return ret.toJSONString();
}
@Override
protected void doListBefore(ResourceEntity query, Map<String, Object> model, Context context) throws AppException {
public ResourceController(){ super.doListBefore(query, model, context);
super.setModuleDesc("资源信息"); }
}
@Override /**
protected void init(Map<String, Object> model, Context context) { * 资源路径刷新
Map<String, Object> statsus = new HashMap<String, Object>(); */
statsus.put("authType", AuthType.getEnumMap()); @PostMapping(value = "refreshUrl")
statsus.put("sourceType", SourceType.getEnumMap()); @UnAuth
if (getCurUser().isAdmin()) { public Rest<String> refreshUrl(@RequestParam(name = "packageName", defaultValue = "com.mortals.xhx") String packageName) {
statsus.put("userType", IBaseEnum.getEnumMap(UserType.class)); log.info("刷新资源路径,packageName", packageName);
} else { String busiDesc = this.getModuleDesc() + "资源路径刷新";
statsus.put("userType", UserType.findByValue(getCurUser().getUserType())); Rest<String> rest = Rest.ok(busiDesc + " 【成功】");
} try {
model.put(KEY_RESULT_DICT, statsus); this.service.refreshResourceUrl(packageName, getContext());
} recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
log.error(busiDesc, e);
rest = Rest.fail(super.convertException(e));
}
return rest;
}
/**
* 获取所有资源
*
* @return
*/
@PostMapping("allResources")
public String allResources(int userType) {
JSONObject ret = new JSONObject();
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "所有的customer以及user");
ret.put(KEY_RESULT_DATA, service.findAll(userType));
return ret.toJSONString();
}
} }
\ No newline at end of file
package com.mortals.xhx.base.system.user.model; package com.mortals.xhx.base.system.user.model.vo;
import com.mortals.framework.model.BaseEntityLong; import com.mortals.framework.model.BaseEntityLong;
import com.mortals.xhx.module.model.model.ModelEntity; import com.mortals.xhx.module.model.model.ModelEntity;
...@@ -7,15 +8,20 @@ import lombok.Data; ...@@ -7,15 +8,20 @@ import lombok.Data;
import java.util.List; import java.util.List;
/** /**
* Description:User * 用户信息业务视图对象
* date: 2021-9-26 16:11:48 *
* @author zxfei
* @date 2022-07-05
*/ */
@Data @Data
public class UserEntityExt extends BaseEntityLong { public class UserVo extends BaseEntityLong {
/** /**
* 站点名称 * 站点名称
*/ */
private String siteName; private String siteName;
private String roleIds;
/** /**
* 唯一标识 * 唯一标识
*/ */
...@@ -35,12 +41,9 @@ public class UserEntityExt extends BaseEntityLong { ...@@ -35,12 +41,9 @@ public class UserEntityExt extends BaseEntityLong {
*/ */
private Long expireTime; private Long expireTime;
private String oldPassword;
private String newPassword;
private String siteIds;
private List<ModelEntity> modleList; private List<ModelEntity> modleList;
/**
* 所属区域code,多个逗号分隔
*/
private String areaCodes;
} }
\ 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.common.Rest;
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.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.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.UserPdu;
...@@ -25,11 +27,11 @@ import java.util.Set; ...@@ -25,11 +27,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 ICRUDCacheService<UserEntity,Long> { public interface UserService extends ICRUDCacheService<UserEntity, Long> {
/** /**
* 用户登录 * 用户登录
* *
...@@ -39,7 +41,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> { ...@@ -39,7 +41,7 @@ public interface UserService extends ICRUDCacheService<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;
/** /**
* 校验用户名与密码是否正确 * 校验用户名与密码是否正确
...@@ -49,7 +51,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> { ...@@ -49,7 +51,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @return * @return
* @throws AppException * @throws AppException
*/ */
UserEntity doCheckUser(String loginName, String password) throws AppException; UserEntity doCheckUser(String loginName, String password) throws AppException;
/** /**
* 检查用户是否存在 * 检查用户是否存在
...@@ -58,7 +60,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> { ...@@ -58,7 +60,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @param userId 密码 * @param userId 密码
* @return * @return
*/ */
boolean existUser(String loginName, Long userId) throws AppException; boolean existUser(String loginName, Long userId) throws AppException;
/** /**
* 通过登录用户获取菜单功能权限 * 通过登录用户获取菜单功能权限
...@@ -66,7 +68,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> { ...@@ -66,7 +68,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @param user * @param user
* @return * @return
*/ */
List<MenuEntity> findOutlookBarList(IUser user); List<MenuEntity> findOutlookBarList(IUser user);
/** /**
* 查询用户所有有权限的菜单ID * 查询用户所有有权限的菜单ID
...@@ -74,7 +76,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> { ...@@ -74,7 +76,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> {
* @param userEntity * @param userEntity
* @return * @return
*/ */
Set<Long> findAllAuthIds(UserEntity userEntity) throws AppException; Set<Long> findAllAuthIds(UserEntity userEntity) throws AppException;
/** /**
* 查询用户记录 * 查询用户记录
...@@ -86,7 +88,7 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> { ...@@ -86,7 +88,7 @@ public interface UserService extends ICRUDCacheService<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;
/** /**
* 为客户创建用户 * 为客户创建用户
...@@ -101,8 +103,8 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> { ...@@ -101,8 +103,8 @@ public interface UserService extends ICRUDCacheService<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;
/** /**
* 用户修改密码 * 用户修改密码
...@@ -113,11 +115,14 @@ public interface UserService extends ICRUDCacheService<UserEntity,Long> { ...@@ -113,11 +115,14 @@ public interface UserService extends ICRUDCacheService<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 updateWidthDao(UserEntity userEntity); void updateWidthDao(UserEntity userEntity);
void updateUserList(List<UserPdu> list); void updateUserList(List<UserPdu> list);
Rest<Void> refreshUser();
UserDao getUserDao();
} }
\ No newline at end of file
...@@ -26,11 +26,14 @@ import com.mortals.xhx.base.system.menu.model.MenuEntity; ...@@ -26,11 +26,14 @@ 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;
import com.mortals.xhx.base.system.resource.service.ResourceService; import com.mortals.xhx.base.system.resource.service.ResourceService;
import com.mortals.xhx.base.system.role.model.RoleUserQuery;
import com.mortals.xhx.base.system.role.service.RoleUserService;
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.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.code.YesNoEnum;
import com.mortals.xhx.common.pdu.RespData; import com.mortals.xhx.common.pdu.RespData;
import com.mortals.xhx.common.pdu.user.UserPdu; import com.mortals.xhx.common.pdu.user.UserPdu;
import com.mortals.xhx.common.utils.BeanUtil; import com.mortals.xhx.common.utils.BeanUtil;
...@@ -43,8 +46,10 @@ import com.mortals.xhx.module.site.service.SiteService; ...@@ -43,8 +46,10 @@ import com.mortals.xhx.module.site.service.SiteService;
import com.mortals.xhx.module.workman.model.WorkmanEntity; import com.mortals.xhx.module.workman.model.WorkmanEntity;
import com.mortals.xhx.module.workman.model.WorkmanQuery; import com.mortals.xhx.module.workman.model.WorkmanQuery;
import com.mortals.xhx.module.workman.service.WorkmanService; import com.mortals.xhx.module.workman.service.WorkmanService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -61,12 +66,20 @@ import java.util.stream.Collectors; ...@@ -61,12 +66,20 @@ import java.util.stream.Collectors;
* @version 1.0.0 * @version 1.0.0
*/ */
@Service("userService") @Service("userService")
@Slf4j
public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserEntity, Long> implements UserService { public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserEntity, Long> implements UserService {
@Autowired @Autowired
private MenuService menuService; private MenuService menuService;
@Autowired @Autowired
private ResourceService resourceService; private ResourceService resourceService;
@Autowired
private RoleUserService roleUserService;
@Lazy
@Autowired
private IUserFeign userFeign;
/** /**
* @param data * @param data
* @return * @return
...@@ -241,7 +254,6 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE ...@@ -241,7 +254,6 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
entity.initAttrValue(); entity.initAttrValue();
entity.setLoginName(loginName); entity.setLoginName(loginName);
entity.setRealName(userName); entity.setRealName(userName);
entity.setCustomerId(customerId);
entity.setLoginPwd(password); entity.setLoginPwd(password);
entity.setMobile(mobile); entity.setMobile(mobile);
entity.setUserType(UserType.CUSTOMER.getValue()); entity.setUserType(UserType.CUSTOMER.getValue());
...@@ -287,10 +299,7 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE ...@@ -287,10 +299,7 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
} }
try { try {
sysUser.setLoginPwd(SecurityUtil.md5DoubleEncoding(newPwd)); sysUser.setLoginPwd(SecurityUtil.md5DoubleEncoding(newPwd));
sysUser.setLoginPwd3(sysUser.getLoginPwd2());
sysUser.setLoginPwd2(sysUser.getLoginPwd1());
sysUser.setLoginPwd1(sysUser.getLoginPwd());
sysUser.setLastModPwdTime(new Date());
} catch (Exception e) { } catch (Exception e) {
throw new AppException("密码转换异常!", e); throw new AppException("密码转换异常!", e);
} }
...@@ -315,7 +324,6 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE ...@@ -315,7 +324,6 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
//分组查找存在的与不存在的用户 //分组查找存在的与不存在的用户
Map<Boolean, List<UserPdu>> collect = list.parallelStream().collect(Collectors.partitioningBy(x -> existUserMap.containsKey(x.getLoginName()))); Map<Boolean, List<UserPdu>> collect = list.parallelStream().collect(Collectors.partitioningBy(x -> existUserMap.containsKey(x.getLoginName())));
List<UserPdu> userPdusUpdate = collect.get(true);//更新 List<UserPdu> userPdusUpdate = collect.get(true);//更新
List<UserEntity> userEntityUpdate = new ArrayList<>();
List<UserPdu> userPdusSave = collect.get(false);//新增 List<UserPdu> userPdusSave = collect.get(false);//新增
List<UserEntity> userEntitySave = new ArrayList<>(); List<UserEntity> userEntitySave = new ArrayList<>();
...@@ -341,14 +349,10 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE ...@@ -341,14 +349,10 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
} }
} }
//分组刷新节点 新增 //分组刷新节点 新增
Map<String, List<UserEntity>> saveSitesCollect = userEntitySave.stream().collect(Collectors.groupingBy(x -> x.getSiteIds())); Map<String, List<UserEntity>> saveSitesCollect = userEntitySave.stream().collect(Collectors.groupingBy(x -> x.getSiteIds()));
// Map<String, List<UserEntity>> updateSitesCollect = userEntityUpdate.stream().collect(Collectors.groupingBy(x -> x.getSiteIds())); // Map<String, List<UserEntity>> updateSitesCollect = userEntityUpdate.stream().collect(Collectors.groupingBy(x -> x.getSiteIds()));
saveSitesCollect.entrySet().stream().forEach(item -> { saveSitesCollect.entrySet().stream().forEach(item -> {
String siteIds = item.getKey();
List<UserEntity> userEntities = item.getValue(); List<UserEntity> userEntities = item.getValue();
if (!ObjectUtils.isEmpty(userEntities)) { if (!ObjectUtils.isEmpty(userEntities)) {
Context context = new Context(); Context context = new Context();
...@@ -356,38 +360,83 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE ...@@ -356,38 +360,83 @@ public class UserServiceImpl extends AbstractCRUDCacheServiceImpl<UserDao, UserE
ThreadPool.getInstance().execute(new SyncTreeSiteThread(context, userEntities)); ThreadPool.getInstance().execute(new SyncTreeSiteThread(context, userEntities));
} }
}); });
}
/*
//如果用户未有所属站点 则不更新 @Override
for (UserPdu user : list) { public Rest<Void> refreshUser() {
UserEntity tempUser = this.selectOne(new UserQuery().loginName(user.getLoginName())); UserPdu userPdu = new UserPdu();
if (ObjectUtils.isEmpty(tempUser)) { userPdu.setPage(1);
//新增 userPdu.setSize(-1);
UserEntity entity = new UserEntity(); Rest<RespData<List<UserPdu>>> resp = userFeign.list(userPdu);
entity.initAttrValue(); if (resp.getCode() == YesNoEnum.YES.getValue()) {
BeanUtils.copyProperties(user, entity, BeanUtil.getNullPropertyNames(user)); List<UserPdu> userPduList = resp.getData().getData();
this.save(entity); log.info("用户总数量:{}", userPduList.size());
if (!ObjectUtils.isEmpty(entity.getSiteIds())) { if (!ObjectUtils.isEmpty(userPduList)) {
Context context = new Context(); List<UserEntity> newUserList = userPduList.stream().map(newUser -> {
context.setUser(entity); UserEntity userEntity = new UserEntity();
ThreadPool.getInstance().execute(new SyncTreeSiteThread(context)); userEntity.initAttrValue();
BeanUtils.copyProperties(newUser, userEntity, new String[]{"id", "lastLoginTime", "lastLoginAddress"});
return userEntity;
}).collect(Collectors.toList());
List<UserEntity> saveUpdateUserList = newUserList.parallelStream().map(item -> {
UserEntity extCache = this.getExtCache(item.getLoginName());
if (ObjectUtils.isEmpty(extCache)) {
item.setCreateUserId(1L);
item.setCreateUserName("系统管理员");
item.setCreateTime(new Date());
return item;
} else {
//更新用户列表
item.setId(extCache.getId());
item.setUpdateUserId(1L);
item.setUpdateUserName("系统管理员");
item.setUpdateTime(new Date());
return item;
}
}).collect(Collectors.toList());
Map<Boolean, List<UserEntity>> saveUpdateCollect = saveUpdateUserList.stream().collect(Collectors.partitioningBy(x -> x.getId() == null));
if (!ObjectUtils.isEmpty(saveUpdateCollect.get(true))) {
//需要新增的用户
log.info("需要新增用户数量:{}", saveUpdateCollect.get(true).size());
saveUpdateCollect.get(true).stream().forEach(item -> {
this.getUserDao().insert(item);
this.putCache(item.getId() == null ? "" : item.getId().toString(), item);
RoleUserQuery roleUserQuery = new RoleUserQuery();
roleUserQuery.setUserId(item.getId());
roleUserQuery.setRoleIdList(Arrays.asList(1L));
roleUserService.doDistributionRole(roleUserQuery);
});
}
if (!ObjectUtils.isEmpty(saveUpdateCollect.get(false))) {
//需要新增的用户
log.info("需要更新用户数量:{}", saveUpdateCollect.get(false).size());
saveUpdateCollect.get(false).stream().forEach(item -> {
this.getUserDao().update(item);
this.putCache(item.getId() == null ? "" : item.getId().toString(), item);
});
} }
} else { //差集删除
//更新 Set<String> collectSet = newUserList.parallelStream().map(x -> x.getLoginName()).collect(Collectors.toSet());
UserEntity userEntity = new UserEntity(); Long[] removeUserIds = this.getCacheList().parallelStream().filter(f -> !collectSet.contains(f.getLoginName())).map(i -> i.getId()).distinct().toArray(Long[]::new);
BeanUtils.copyProperties(user, userEntity, new String[]{"loginPwd", "loginName", "userType", "status", "lastLoginTime", "lastLoginAddress"}); if (!ObjectUtils.isEmpty(removeUserIds)) {
userEntity.setId(tempUser.getId()); log.info("需要删除的本地用户数量:{}", removeUserIds.length);
this.updateWidthDao(userEntity); this.remove(removeUserIds, null);
if (!ObjectUtils.isEmpty(userEntity.getSiteIds())) {
Context context = new Context();
context.setUser(userEntity);
ThreadPool.getInstance().execute(new SyncTreeSiteThread(context));
} }
this.updateUserList(userPduList);
} }
}*/ }
return Rest.ok();
} }
@Override
public UserDao getUserDao() {
return this.getDao();
}
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
//eba467f81fb265befdf1f6ab041d39ab 原始admin密码 //eba467f81fb265befdf1f6ab041d39ab 原始admin密码
......
...@@ -2,7 +2,9 @@ package com.mortals.xhx.base.system.user.web; ...@@ -2,7 +2,9 @@ package com.mortals.xhx.base.system.user.web;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.IBaseEnum; import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.common.Rest;
import com.mortals.framework.common.code.UserType; import com.mortals.framework.common.code.UserType;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
...@@ -16,10 +18,7 @@ import io.jsonwebtoken.Claims; ...@@ -16,10 +18,7 @@ import io.jsonwebtoken.Claims;
import io.jsonwebtoken.Jwts; import io.jsonwebtoken.Jwts;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
...@@ -37,11 +36,7 @@ import java.util.Map; ...@@ -37,11 +36,7 @@ import java.util.Map;
@RequestMapping("user") @RequestMapping("user")
public class UserController extends BaseCRUDJsonBodyMappingController<UserService, UserEntity, Long> { public class UserController extends BaseCRUDJsonBodyMappingController<UserService, UserEntity, Long> {
@Autowired
private UserService userService;
public UserController() { public UserController() {
super.setFormClass(UserForm.class);
super.setModuleDesc("用户信息"); super.setModuleDesc("用户信息");
} }
...@@ -63,26 +58,6 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic ...@@ -63,26 +58,6 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
} }
} }
@Override
protected int editAfter(Long id, Map<String, Object> model, UserEntity entity, Context context) throws AppException {
entity.setLoginPwd(null);
entity.setLoginPwd1(null);
entity.setLoginPwd2(null);
return super.editAfter(id, model, entity, context);
}
@Override
protected int saveAfter(UserEntity entity, Map<String, Object> model, Context context) throws AppException {
if (entity.getId() == getCurUser().getId()) {
//saveCurrUserForSession(request, response, userService.get(form.getEntity().getId(), false));
}
return super.saveAfter(entity, model, context);
}
@Override @Override
protected void saveBefore(UserEntity entity, Map<String, Object> model, Context context) throws AppException { protected void saveBefore(UserEntity entity, Map<String, Object> model, Context context) throws AppException {
if (service.existUser(entity.getLoginName(), entity.getId())) { if (service.existUser(entity.getLoginName(), entity.getId())) {
...@@ -108,6 +83,15 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic ...@@ -108,6 +83,15 @@ public class UserController extends BaseCRUDJsonBodyMappingController<UserServic
} }
@PostMapping({"refreshUser"})
@UnAuth
public Rest<Object> refreshUser() {
log.info("刷新用户");
this.service.refreshUser();
return Rest.ok("用户同步刷新操作成功");
}
public static void main(String[] args) { public static void main(String[] args) {
String token = "eyJhbGciOiJIUzI1NiJ9.eyJsb2dpbl91c2VyX2tleSI6IjIzNGE5NDA5ZDVhOTQ3MWNhMzdkYjZkYmMwY2JjZTc5In0.MWyQW40HYDxyUz7PJRf_nRsFPWx3Hr811Ime984nixs"; String token = "eyJhbGciOiJIUzI1NiJ9.eyJsb2dpbl91c2VyX2tleSI6IjIzNGE5NDA5ZDVhOTQ3MWNhMzdkYjZkYmMwY2JjZTc5In0.MWyQW40HYDxyUz7PJRf_nRsFPWx3Hr811Ime984nixs";
......
/**
* 文件:UserForm.java
* 版本:1.0.0
* 日期:
* Copyright &reg;
* All right reserved.
*/
package com.mortals.xhx.base.system.user.web;
import com.mortals.framework.web.BaseCRUDFormLong;
import com.mortals.xhx.base.system.user.model.UserEntity;
import com.mortals.xhx.base.system.user.model.UserQuery;
/**
* <p>Title: 用户信息</p>
* <p>Description: UserForm </p>
* <p>Copyright: Copyright &reg; </p>
* <p>Company: </p>
* @author
* @version 1.0.0
*/
public class UserForm extends BaseCRUDFormLong<UserEntity> {
private UserEntity entity = new UserEntity();
private UserQuery query = new UserQuery();
public UserForm(){
}
@Override
public UserEntity getEntity() {
return entity;
}
public void setEntity(UserEntity entity) {
this.entity = entity;
}
@Override
public UserQuery getQuery() {
return query;
}
public void setQuery(UserQuery query) {
this.query = query;
}
}
\ No newline at end of file
...@@ -42,6 +42,9 @@ public class SyncUserTaskImpl implements ITaskExcuteService { ...@@ -42,6 +42,9 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
@Override @Override
public void excuteTask(ITask task) throws AppException { public void excuteTask(ITask task) throws AppException {
userService.refreshUser();
log.info("同步用户"); log.info("同步用户");
UserPdu userPdu = new UserPdu(); UserPdu userPdu = new UserPdu();
userPdu.setPage(1); userPdu.setPage(1);
......
...@@ -85,6 +85,12 @@ ...@@ -85,6 +85,12 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
<version>1.6.12</version>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
package com.mortals.xhx.feign.selfsystem;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.feign.IFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
/**
* 自助服务系统 Feign接口
*
* @author zxfei
* @date 2022-10-26
*/
@FeignClient(name = "sst-manager", path = "/sst", fallbackFactory = SelfSystemFeignFallbackFactory.class)
public interface ISelfSystemFeign extends IFeign {
/**
* 用户刷新通知
*
* @param
* @return
*/
@PostMapping(value = "/user/refreshUser")
Rest<Void> refreshUser();
}
@Slf4j
@Component
class SelfSystemFeignFallbackFactory implements FallbackFactory<ISelfSystemFeign> {
@Override
public ISelfSystemFeign create(Throwable t) {
return new ISelfSystemFeign() {
/**
* @return
*/
@Override
public Rest<Void> refreshUser() {
return Rest.fail("暂时无法通知设备,请稍后再试!");
}
};
}
}
package com.mortals.xhx.feign.smartoffice;
import com.mortals.framework.common.Rest;
import com.mortals.xhx.feign.IFeign;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
/**
* 服务系统 Feign接口
*
* @author zxfei
* @date 2022-10-26
*/
@FeignClient(name = "smart-office-manager", path = "/office", fallbackFactory = SmartSystemFeignFallbackFactory.class)
public interface ISmartSystemFeign extends IFeign {
/**
* 用户刷新通知
*
* @param
* @return
*/
@PostMapping(value = "/user/refreshUser")
Rest<Void> refreshUser();
}
@Slf4j
@Component
class SmartSystemFeignFallbackFactory implements FallbackFactory<ISmartSystemFeign> {
@Override
public ISmartSystemFeign create(Throwable t) {
return new ISmartSystemFeign() {
/**
* @return
*/
@Override
public Rest<Void> refreshUser() {
return Rest.fail("暂时无法通知设备,请稍后再试!");
}
};
}
}
...@@ -193,11 +193,6 @@ ...@@ -193,11 +193,6 @@
<artifactId>knife4j-spring-boot-starter</artifactId> <artifactId>knife4j-spring-boot-starter</artifactId>
</dependency> </dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>
<!--Token生成与解析--> <!--Token生成与解析-->
<dependency> <dependency>
<groupId>io.jsonwebtoken</groupId> <groupId>io.jsonwebtoken</groupId>
......
...@@ -4,13 +4,20 @@ import com.alibaba.druid.support.http.ResourceServlet; ...@@ -4,13 +4,20 @@ import com.alibaba.druid.support.http.ResourceServlet;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth; import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.service.IAuthTokenService; import com.mortals.framework.service.IAuthTokenService;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.IUser; import com.mortals.framework.service.IUser;
import com.mortals.framework.util.AESUtil; 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.base.system.resource.service.ResourceService;
import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.utils.MenuEncodeUtil;
import com.mortals.xhx.module.user.model.UserEntity;
import com.mortals.xhx.module.user.service.UserService;
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.ParameterResolutionDelegate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.method.HandlerMethod; import org.springframework.web.method.HandlerMethod;
...@@ -19,6 +26,7 @@ import org.springframework.web.servlet.resource.ResourceHttpRequestHandler; ...@@ -19,6 +26,7 @@ import org.springframework.web.servlet.resource.ResourceHttpRequestHandler;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.util.Set;
/** /**
* 用户权限验证,基于token * 用户权限验证,基于token
...@@ -33,6 +41,12 @@ public class AuthUserInterceptor extends BaseInterceptor { ...@@ -33,6 +41,12 @@ public class AuthUserInterceptor extends BaseInterceptor {
private InterceptorConfig config; private InterceptorConfig config;
@Autowired @Autowired
private IAuthTokenService authTokenService; private IAuthTokenService authTokenService;
@Autowired
private ICacheService cacheService;
@Autowired
private ResourceService resourceService;
@Autowired
private UserService userService;
@Override @Override
public int getOrder() { public int getOrder() {
...@@ -44,7 +58,7 @@ public class AuthUserInterceptor extends BaseInterceptor { ...@@ -44,7 +58,7 @@ public class AuthUserInterceptor extends BaseInterceptor {
throws Exception { throws Exception {
JSONObject ret = new JSONObject(); JSONObject ret = new JSONObject();
try { try {
if(handler instanceof HandlerMethod){ if (handler instanceof HandlerMethod) {
HandlerMethod handlerMethod = (HandlerMethod) handler; HandlerMethod handlerMethod = (HandlerMethod) handler;
Method method = handlerMethod.getMethod(); Method method = handlerMethod.getMethod();
UnAuth annotation = method.getAnnotation(UnAuth.class); UnAuth annotation = method.getAnnotation(UnAuth.class);
...@@ -52,7 +66,7 @@ public class AuthUserInterceptor extends BaseInterceptor { ...@@ -52,7 +66,7 @@ public class AuthUserInterceptor extends BaseInterceptor {
//取消校验 //取消校验
return true; return true;
} }
}else if(handler instanceof ResourceHttpRequestHandler){ } else if (handler instanceof ResourceHttpRequestHandler) {
return true; return true;
} }
String uri = request.getServletPath(); String uri = request.getServletPath();
...@@ -63,16 +77,16 @@ public class AuthUserInterceptor extends BaseInterceptor { ...@@ -63,16 +77,16 @@ public class AuthUserInterceptor extends BaseInterceptor {
if (!auth) { if (!auth) {
//不存在时候 如果是管理员也不做拦截 //不存在时候 如果是管理员也不做拦截
IUser loginUser = authTokenService.getLoginUser(request); IUser loginUser = authTokenService.getLoginUser(request);
if(ObjectUtils.isEmpty(loginUser)){ if (ObjectUtils.isEmpty(loginUser)) {
ret.put("code", 401); ret.put("code", 401);
ret.put("msg", "用户未登录或登录失效,请重新登录"); ret.put("msg", "用户未登录或登录失效,请重新登录");
ServletUtils.renderString(response, JSONObject.toJSONString(ret)); ServletUtils.renderString(response, JSONObject.toJSONString(ret));
return false; return false;
// }else if(loginUser.isAdmin()||loginUser.getUserType()==1){ // }else if(loginUser.isAdmin()||loginUser.getUserType()==1){
}else if(loginUser.isAdmin()){ } else if (loginUser.isAdmin()) {
return super.preHandle(request, response, handler); return super.preHandle(request, response, handler);
} else { } else {
ret.put("code", -1); ret.put("code", 405);
ret.put("msg", "用户无该操作权限!"); ret.put("msg", "用户无该操作权限!");
ServletUtils.renderString(response, JSONObject.toJSONString(ret)); ServletUtils.renderString(response, JSONObject.toJSONString(ret));
return false; return false;
...@@ -80,7 +94,7 @@ public class AuthUserInterceptor extends BaseInterceptor { ...@@ -80,7 +94,7 @@ public class AuthUserInterceptor extends BaseInterceptor {
} }
} }
} catch (Exception e) { } catch (Exception e) {
log.error("权限校验拦截请求处理异常-->" + e.getMessage(),e); log.error("权限校验拦截请求处理异常-->" + e.getMessage(), e);
writeJsonResponse(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "用户权限校验异常"); writeJsonResponse(response, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "用户权限校验异常");
return false; return false;
} }
...@@ -92,7 +106,17 @@ public class AuthUserInterceptor extends BaseInterceptor { ...@@ -92,7 +106,17 @@ public class AuthUserInterceptor extends BaseInterceptor {
int code = requestUrl.hashCode() & (Integer.MAX_VALUE - 1); int code = requestUrl.hashCode() & (Integer.MAX_VALUE - 1);
IUser loginUser = authTokenService.getLoginUser(request); IUser loginUser = authTokenService.getLoginUser(request);
if (ObjectUtils.isEmpty(loginUser)) return false; if (ObjectUtils.isEmpty(loginUser)) return false;
String menuUrl = loginUser.getMenuUrl();
UserEntity userCache = userService.getExtCache(loginUser.getLoginName());
if (ObjectUtils.isEmpty(userCache)) return false;
String menuUrl = cacheService.hget(RedisKey.KEY_USER_MENU_CACHE, userCache.getId().toString(), String.class);
if (ObjectUtils.isEmpty(menuUrl)) {
Set<String> urls = resourceService.findUrlSetByUserId(loginUser.getId());
menuUrl = MenuEncodeUtil.generateMenuUrlCode(urls);
cacheService.hset(RedisKey.KEY_USER_MENU_CACHE, loginUser.getId().toString(), menuUrl);
}
//String menuUrl = loginUser.getMenuUrl();
if (ObjectUtils.isEmpty(menuUrl)) return false; if (ObjectUtils.isEmpty(menuUrl)) return false;
menuUrl = AESUtil.decrypt(menuUrl, securityKey); menuUrl = AESUtil.decrypt(menuUrl, securityKey);
String codes = "," + menuUrl + ","; String codes = "," + menuUrl + ",";
...@@ -104,5 +128,4 @@ public class AuthUserInterceptor extends BaseInterceptor { ...@@ -104,5 +128,4 @@ public class AuthUserInterceptor extends BaseInterceptor {
} }
} }
...@@ -113,7 +113,175 @@ public class AuthTokenServiceImpl implements IAuthTokenService { ...@@ -113,7 +113,175 @@ public class AuthTokenServiceImpl implements IAuthTokenService {
cacheService.hset(RedisKey.KEY_USER_MENU_CACHE, userEntity.getId().toString(), menuUrlCode); cacheService.hset(RedisKey.KEY_USER_MENU_CACHE, userEntity.getId().toString(), menuUrlCode);
} }
userEntity.setMenuUrl(menuUrlCode); userEntity.setMenuUrl(menuUrlCode);
return userEntity; return userEntity;
/*return new IUser() {
*//**
* @return
*//*
@Override
public Long getId() {
return userEntity.getId();
}
*//**
* @return
*//*
@Override
public Long getDeptId() {
return userEntity.getDeptId();
}
*//**
* @return
*//*
@Override
public String getDeptName() {
return userEntity.getDeptName();
}
*//**
* @return
*//*
@Override
public Long getCustomerId() {
return userEntity.getCustomerId();
}
*//**
* @return
*//*
@Override
public Long getSiteId() {
return userEntity.getSiteId();
}
*//**
* @return
*//*
@Override
public String getSiteIds() {
return userEntity.getSiteIds();
}
*//**
* @return
*//*
@Override
public String getAreaCodes() {
return userEntity.getAreaCodes();
}
*//**
* @return
*//*
@Override
public Long getCustomerJoinId() {
return userEntity.getCustomerJoinId();
}
*//**
* @return
*//*
@Override
public String getCustomerNum() {
return userEntity.getCustomerNum();
}
*//**
* @return
*//*
@Override
public String getLoginName() {
return userEntity.getLoginName();
}
*//**
* @return
*//*
@Override
public String getRealName() {
return userEntity.getRealName();
}
*//**
* @return
*//*
@Override
public boolean isAdmin() {
return userEntity.isAdmin();
}
*//**
* @return
*//*
@Override
public boolean isSystemUser() {
return userEntity.isSystemUser();
}
*//**
* @return
*//*
@Override
public boolean isManager() {
return userEntity.isManager();
}
*//**
* @return
*//*
@Override
public Integer getUserType() {
return userEntity.getUserType();
}
*//**
* @return
*//*
@Override
public String getToken() {
return userEntity.getToken();
}
*//**
* @return
*//*
@Override
public Long getLoginTime() {
return userEntity.getLoginTime();
}
*//**
* @return
*//*
@Override
public Long getExpireTime() {
return userEntity.getExpireTime();
}
*//**
* @param expireTime
*//*
@Override
public void setExpireTime(Long expireTime) {
}
*//**
* @return
*//*
@Override
public String getMenuUrl() {
return userEntity.getMenuUrl();
}
};*/
// return userEntity;
/* if (StringUtils.isNotEmpty(userStr)) { /* if (StringUtils.isNotEmpty(userStr)) {
JSONObject userObj = JSON.parseObject(userStr); JSONObject userObj = JSON.parseObject(userStr);
Long userId = userObj.getLongValue("id"); Long userId = userObj.getLongValue("id");
...@@ -313,7 +481,7 @@ public class AuthTokenServiceImpl implements IAuthTokenService { ...@@ -313,7 +481,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 * MILLIS_MINUTE*1000); user.setExpireTime(user.getLoginTime() == null ? System.currentTimeMillis() : user.getLoginTime() + expireTime * MILLIS_MINUTE * 1000);
// 根据uuid将user缓存 // 根据uuid将user缓存
String userKey = getTokenKey(user.getToken()); String userKey = getTokenKey(user.getToken());
//设置有效时间 单位秒 //设置有效时间 单位秒
......
...@@ -9,7 +9,9 @@ ...@@ -9,7 +9,9 @@
package com.mortals.xhx.base.system.resource.service; package com.mortals.xhx.base.system.resource.service;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.base.system.resource.model.ResourceEntity; import com.mortals.xhx.base.system.resource.model.ResourceEntity;
...@@ -63,4 +65,8 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> { ...@@ -63,4 +65,8 @@ public interface ResourceService extends ICRUDService<ResourceEntity,Long> {
* @param userType * @param userType
*/ */
List<ResourceEntity> findAll(int userType); List<ResourceEntity> findAll(int userType);
Rest<String> refreshResourceUrl(String packageName, Context context);
} }
\ No newline at end of file
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
package com.mortals.xhx.base.system.resource.service.impl; package com.mortals.xhx.base.system.resource.service.impl;
import com.mortals.framework.common.Rest;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.service.ICacheService; import com.mortals.framework.service.ICacheService;
...@@ -19,6 +20,7 @@ import com.mortals.xhx.base.system.resource.model.ResourceEntity; ...@@ -19,6 +20,7 @@ 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 com.mortals.xhx.common.key.RedisKey; import com.mortals.xhx.common.key.RedisKey;
import com.mortals.xhx.common.utils.ControllerScanUtil;
import com.mortals.xhx.module.role.model.RoleAuthEntity; import com.mortals.xhx.module.role.model.RoleAuthEntity;
import com.mortals.xhx.module.role.model.RoleAuthQuery; import com.mortals.xhx.module.role.model.RoleAuthQuery;
import com.mortals.xhx.module.role.service.RoleAuthService; import com.mortals.xhx.module.role.service.RoleAuthService;
...@@ -26,10 +28,8 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -26,10 +28,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.Arrays; import java.util.*;
import java.util.HashSet; import java.util.stream.Collectors;
import java.util.List;
import java.util.Set;
import static com.mortals.xhx.common.utils.MenuEncodeUtil.generateMenuUrlCode; import static com.mortals.xhx.common.utils.MenuEncodeUtil.generateMenuUrlCode;
...@@ -51,7 +51,6 @@ public class ResourceServiceImpl extends AbstractCRUDServiceImpl<ResourceDao, Re ...@@ -51,7 +51,6 @@ public class ResourceServiceImpl extends AbstractCRUDServiceImpl<ResourceDao, Re
@Autowired @Autowired
private RoleAuthService roleAuthService; private RoleAuthService roleAuthService;
@Override @Override
public List<ResourceEntity> findAllEnable() throws AppException { public List<ResourceEntity> findAllEnable() throws AppException {
ResourceQuery params = new ResourceQuery(); ResourceQuery params = new ResourceQuery();
...@@ -89,6 +88,74 @@ public class ResourceServiceImpl extends AbstractCRUDServiceImpl<ResourceDao, Re ...@@ -89,6 +88,74 @@ public class ResourceServiceImpl extends AbstractCRUDServiceImpl<ResourceDao, Re
return dao.getAll(userType); return dao.getAll(userType);
} }
@Override
public Rest<String> refreshResourceUrl(String packageName, Context context) {
List<Class<?>> classList = ControllerScanUtil.getAllClassByPackageName(packageName);
//System.out.println(classList); //获取到了所有的类
List<ResourceEntity> newResourcelist = ControllerScanUtil.getAnnotationInfo(classList).stream().filter(f->!ObjectUtils.isEmpty(f.getUrl())).collect(Collectors.toList());
Map<String, List<ResourceEntity>> localResourceMap = this.find(new ResourceQuery()).stream().collect(Collectors.groupingBy(x -> x.getName()));
Map<String, List<ResourceEntity>> newResourceMap = newResourcelist.stream().collect(Collectors.groupingBy(x -> x.getName()));
//更新 与新增 新加的;
newResourceMap.entrySet().forEach(item -> {
List<ResourceEntity> resourceEntities = item.getValue();
if (ObjectUtils.isEmpty(resourceEntities)) return;
if (resourceEntities.size() == 1) {
ResourceEntity resourceEntity = resourceEntities.get(0);
saveUpdateResourceEntity(context, localResourceMap, resourceEntity);
} else if (resourceEntities.size() > 1) {
//原始扫描 有多个资源列表针对一个名称的
for (ResourceEntity resourceEntity : resourceEntities) {
saveUpdateResourceEntity(context, localResourceMap, resourceEntity);
}
}
});
return Rest.ok();
}
private void saveUpdateResourceEntity(Context context, Map<String, List<ResourceEntity>> localResourceMap, ResourceEntity resourceEntity) {
//查找 本地是否已经存在了
List<ResourceEntity> tempResourceList = localResourceMap.getOrDefault(resourceEntity.getName(), new ArrayList<>());
if (tempResourceList.size() == 0) {
//新增 resource;
resourceEntity.setCreateUserId(this.getContextUserId(context));
resourceEntity.setCreateTime(new Date());
this.save(resourceEntity, context);
} else if (tempResourceList.size() == 1) {
//更新
ResourceEntity tempResource = tempResourceList.get(0);
Set<String> setUrl = Arrays.stream(resourceEntity.getUrl().split(",")).collect(Collectors.toSet());
Arrays.stream(tempResource.getUrl().split(",")).forEach(i -> {
setUrl.add(i);
});
tempResource.setUrl(setUrl.stream().collect(Collectors.joining(",")));
this.update(tempResource, context);
} else if (tempResourceList.size() > 1) {
//找到多个同名的 资源配置
for (ResourceEntity tempResource : tempResourceList) {
//模糊匹配到路径有一个存在的
Set<String> setUrl = Arrays.stream(resourceEntity.getUrl().split(",")).collect(Collectors.toSet());
String[] splitUrl = tempResource.getUrl().split(",");
Boolean bool = false;
for (int i = 0; i < splitUrl.length; i++) {
if (setUrl.contains(splitUrl[i])) {
bool = true;
break;
}
}
if (bool) {
//匹配到了,更新当前这个资源
Arrays.stream(tempResource.getUrl().split(",")).forEach(i -> {
setUrl.add(i);
});
tempResource.setUrl(setUrl.stream().collect(Collectors.joining(",")));
this.update(tempResource, context);
}
}
}
}
@Override @Override
protected void updateAfter(ResourceEntity entity, Context context) throws AppException { protected void updateAfter(ResourceEntity entity, Context context) throws AppException {
...@@ -115,12 +182,14 @@ public class ResourceServiceImpl extends AbstractCRUDServiceImpl<ResourceDao, Re ...@@ -115,12 +182,14 @@ public class ResourceServiceImpl extends AbstractCRUDServiceImpl<ResourceDao, Re
} }
private void updateUserMenuUrlCache() { private void updateUserMenuUrlCache() {
//更新用户菜单
cacheService.del(RedisKey.KEY_USER_MENU_CACHE);
/* //更新用户菜单
Set<String> hkeys = cacheService.hkeys(RedisKey.KEY_USER_MENU_CACHE); Set<String> hkeys = cacheService.hkeys(RedisKey.KEY_USER_MENU_CACHE);
for (String userId : hkeys) { for (String userId : hkeys) {
Set<String> urls = this.findUrlSetByUserId(DataUtil.converStr2Long(userId, 0L)); Set<String> urls = this.findUrlSetByUserId(DataUtil.converStr2Long(userId, 0L));
String menuUrlCode = generateMenuUrlCode(urls); String menuUrlCode = generateMenuUrlCode(urls);
cacheService.hset(RedisKey.KEY_USER_MENU_CACHE, userId, menuUrlCode); cacheService.hset(RedisKey.KEY_USER_MENU_CACHE, userId, menuUrlCode);
} }*/
} }
} }
\ No newline at end of file
...@@ -2,8 +2,11 @@ package com.mortals.xhx.base.system.resource.web; ...@@ -2,8 +2,11 @@ package com.mortals.xhx.base.system.resource.web;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.IBaseEnum; import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.common.Rest;
import com.mortals.framework.common.code.UserType; import com.mortals.framework.common.code.UserType;
import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.resource.model.ResourceEntity; import com.mortals.xhx.base.system.resource.model.ResourceEntity;
...@@ -13,6 +16,7 @@ import com.mortals.xhx.common.code.SourceType; ...@@ -13,6 +16,7 @@ import com.mortals.xhx.common.code.SourceType;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.HashMap; import java.util.HashMap;
...@@ -27,37 +31,63 @@ import java.util.Map; ...@@ -27,37 +31,63 @@ import java.util.Map;
@Slf4j @Slf4j
@RestController @RestController
@RequestMapping("resource") @RequestMapping("resource")
public class ResourceController extends BaseCRUDJsonBodyMappingController<ResourceService,ResourceEntity,Long> { public class ResourceController extends BaseCRUDJsonBodyMappingController<ResourceService, ResourceEntity, Long> {
public ResourceController(){ public ResourceController() {
super.setModuleDesc("资源信息"); super.setModuleDesc("资源信息");
} }
@Override @Override
protected void init(Map<String, Object> model, Context context) { protected void init(Map<String, Object> model, Context context) {
Map<String, Object> statsus = new HashMap<String, Object>(); Map<String, Object> statsus = new HashMap<String, Object>();
statsus.put("authType", AuthType.getEnumMap()); statsus.put("authType", AuthType.getEnumMap());
statsus.put("sourceType", SourceType.getEnumMap()); statsus.put("sourceType", SourceType.getEnumMap());
if (getCurUser().isAdmin()) { if (getCurUser().isAdmin()) {
statsus.put("userType", IBaseEnum.getEnumMap(UserType.class)); statsus.put("userType", IBaseEnum.getEnumMap(UserType.class));
} else { } else {
statsus.put("userType", UserType.findByValue(getCurUser().getUserType())); statsus.put("userType", UserType.findByValue(getCurUser().getUserType()));
} }
model.put(KEY_RESULT_DICT, statsus); model.put(KEY_RESULT_DICT, statsus);
} }
/** /**
* 获取所有资源 * 获取所有资源
* *
* @return * @return
*/ */
@PostMapping("allResources") @PostMapping("allResources")
public String allResources(int userType) { public String allResources(int userType) {
JSONObject ret = new JSONObject(); JSONObject ret = new JSONObject();
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS); ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_MSG, "所有的customer以及user"); ret.put(KEY_RESULT_MSG, "所有的customer以及user");
ret.put(KEY_RESULT_DATA, service.findAll(userType)); ret.put(KEY_RESULT_DATA, service.findAll(userType));
return ret.toJSONString(); return ret.toJSONString();
} }
@Override
protected void doListBefore(ResourceEntity query, Map<String, Object> model, Context context) throws AppException {
super.doListBefore(query, model, context);
}
/**
* 资源路径刷新
*/
@PostMapping(value = "refreshUrl")
@UnAuth
public Rest<String> refreshUrl(@RequestParam(name = "packageName", defaultValue = "com.mortals.xhx") String packageName) {
log.info("刷新资源路径,packageName", packageName);
String busiDesc = this.getModuleDesc() + "资源路径刷新";
Rest<String> rest = Rest.ok(busiDesc + " 【成功】");
try {
this.service.refreshResourceUrl(packageName, getContext());
recordSysLog(request, busiDesc + " 【成功】");
} catch (Exception e) {
log.error(busiDesc, e);
rest = Rest.fail(super.convertException(e));
}
return rest;
}
} }
\ No newline at end of file
...@@ -2,8 +2,10 @@ package com.mortals.xhx.common.utils; ...@@ -2,8 +2,10 @@ package com.mortals.xhx.common.utils;
import com.mortals.xhx.feign.area.IApiAreaFeign; import com.mortals.xhx.feign.area.IApiAreaFeign;
import com.mortals.xhx.feign.device.IDeviceFeign; import com.mortals.xhx.feign.device.IDeviceFeign;
import com.mortals.xhx.feign.selfsystem.ISelfSystemFeign;
import com.mortals.xhx.feign.skin.ISkinFillFeign; import com.mortals.xhx.feign.skin.ISkinFillFeign;
import com.mortals.xhx.feign.skin.ISkinSampleFeign; import com.mortals.xhx.feign.skin.ISkinSampleFeign;
import com.mortals.xhx.feign.smartoffice.ISmartSystemFeign;
import com.mortals.xhx.utils.SpringUtils; import com.mortals.xhx.utils.SpringUtils;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -16,25 +18,26 @@ import lombok.extern.slf4j.Slf4j; ...@@ -16,25 +18,26 @@ import lombok.extern.slf4j.Slf4j;
* @description: * @description:
**/ **/
@Slf4j @Slf4j
@AllArgsConstructor
public class SendSubSystemTask implements Runnable { public class SendSubSystemTask implements Runnable {
private IApiAreaFeign apiAreaFeign; private IApiAreaFeign apiAreaFeign;
private IDeviceFeign deviceFeign; private IDeviceFeign deviceFeign;
private ISkinSampleFeign skinSampleFeign; private ISkinSampleFeign skinSampleFeign;
private ISkinFillFeign skinFillFeign; private ISkinFillFeign skinFillFeign;
private ISelfSystemFeign selfSystemFeign;
private ISmartSystemFeign smartSystemFeign;
public SendSubSystemTask() { public SendSubSystemTask() {
apiAreaFeign= SpringUtils.getBean(IApiAreaFeign.class); apiAreaFeign = SpringUtils.getBean(IApiAreaFeign.class);
deviceFeign= SpringUtils.getBean(IDeviceFeign.class); deviceFeign = SpringUtils.getBean(IDeviceFeign.class);
skinSampleFeign= SpringUtils.getBean(ISkinSampleFeign.class); skinSampleFeign = SpringUtils.getBean(ISkinSampleFeign.class);
skinFillFeign= SpringUtils.getBean(ISkinFillFeign.class); skinFillFeign = SpringUtils.getBean(ISkinFillFeign.class);
selfSystemFeign = SpringUtils.getBean(ISelfSystemFeign.class);
smartSystemFeign = SpringUtils.getBean(ISmartSystemFeign.class);
} }
@Override @Override
public void run() { public void run() {
String resp = null;
try { try {
Thread.sleep(2000); Thread.sleep(2000);
apiAreaFeign.refreshUser(); apiAreaFeign.refreshUser();
...@@ -44,9 +47,12 @@ public class SendSubSystemTask implements Runnable { ...@@ -44,9 +47,12 @@ public class SendSubSystemTask implements Runnable {
skinSampleFeign.refreshUser(); skinSampleFeign.refreshUser();
Thread.sleep(2000); Thread.sleep(2000);
skinFillFeign.refreshUser(); skinFillFeign.refreshUser();
Thread.sleep(2000);
selfSystemFeign.refreshUser();
Thread.sleep(2000);
smartSystemFeign.refreshUser();
} catch (Exception e) { } catch (Exception e) {
log.error("通知异常:", e);
log.error("异常:", e);
} }
} }
} }
...@@ -29,8 +29,6 @@ public class AreaController extends BaseCRUDJsonBodyMappingController<AreaServic ...@@ -29,8 +29,6 @@ public class AreaController extends BaseCRUDJsonBodyMappingController<AreaServic
@Autowired @Autowired
private ParamService paramService; private ParamService paramService;
@Autowired
private IAuthTokenService authTokenService;
public AreaController() { public AreaController() {
super.setModuleDesc("区域"); super.setModuleDesc("区域");
......
...@@ -24,7 +24,7 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -24,7 +24,7 @@ import org.springframework.web.multipart.MultipartFile;
import static com.mortals.framework.ap.SysConstains.*; import static com.mortals.framework.ap.SysConstains.*;
/** /**
* *
* 产品接口 * 产品接口日志
* *
* @author zxfei * @author zxfei
* @date 2023-07-18 * @date 2023-07-18
...@@ -35,7 +35,7 @@ public class ProductInterfaceLogController extends BaseCRUDJsonBodyMappingContro ...@@ -35,7 +35,7 @@ public class ProductInterfaceLogController extends BaseCRUDJsonBodyMappingContro
public ProductInterfaceLogController(){ public ProductInterfaceLogController(){
super.setModuleDesc( "产品接口"); super.setModuleDesc( "产品接口日志");
} }
@Override @Override
......
...@@ -111,6 +111,12 @@ public class UserEntity extends UserVo implements IUser { ...@@ -111,6 +111,12 @@ public class UserEntity extends UserVo implements IUser {
*/ */
private Date lockTime; private Date lockTime;
/**
* 菜单栏
*/
private String menuUrl;
public UserEntity(){} public UserEntity(){}
/** /**
...@@ -250,11 +256,20 @@ public class UserEntity extends UserVo implements IUser { ...@@ -250,11 +256,20 @@ public class UserEntity extends UserVo implements IUser {
return userType; return userType;
} }
public void setMenuUrl(String menuUrl) {
this.menuUrl = menuUrl;
}
/**
* @return
*/
@Override @Override
public String getMenuUrl() { public String getMenuUrl() {
return null; return menuUrl ;
} }
/** /**
* 设置 用户类型(0.系统用户,1.普通用户,2.工作人员) * 设置 用户类型(0.系统用户,1.普通用户,2.工作人员)
* @param userType * @param userType
......
...@@ -12,4 +12,10 @@ public class UserEntityExt extends UserEntity { ...@@ -12,4 +12,10 @@ public class UserEntityExt extends UserEntity {
private List<String> areaCodeList; private List<String> areaCodeList;
/**
* 菜单栏
*/
private String menuUrl;
} }
...@@ -57,10 +57,6 @@ public class UserVo extends BaseEntityLong { ...@@ -57,10 +57,6 @@ public class UserVo extends BaseEntityLong {
private String oldPwd; private String oldPwd;
private String newPwd; private String newPwd;
/**
* 菜单栏
*/
private String menuUrl;
public static void main(String[] args) { public static void main(String[] args) {
......
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