Forráskód Böngészése

去除角色用户相关信息

lyhzzz 3 éve
szülő
commit
d7e1d2443a
67 módosított fájl, 748 hozzáadás és 4516 törlés
  1. 2 1
      platform-admin/src/main/java/com/platform/aop/CurrentUserAspect.java
  2. 12 11
      platform-admin/src/main/java/com/platform/aop/DataFilterAspect.java
  3. 1 2
      platform-admin/src/main/java/com/platform/aop/SysLogAspect.java
  4. 4 14
      platform-admin/src/main/java/com/platform/controller/SysOssController.java
  5. 3 7
      platform-api/src/main/java/com/platform/api/ApiAuthController.java
  6. 5 8
      platform-api/src/main/java/com/platform/api/ApiBrandController.java
  7. 6 8
      platform-api/src/main/java/com/platform/api/ApiUserController.java
  8. 7 8
      platform-api/src/main/java/com/platform/api/OpenApiNotifyController.java
  9. 2 2
      platform-common/src/main/java/com/platform/controller/AbstractController.java
  10. 418 418
      platform-common/src/main/java/com/platform/controller/SysLoginController.java
  11. 0 211
      platform-common/src/main/java/com/platform/controller/SysMenuController.java
  12. 0 136
      platform-common/src/main/java/com/platform/controller/SysRoleController.java
  13. 49 0
      platform-common/src/main/java/com/platform/controller/ZfbController.java
  14. 0 32
      platform-common/src/main/java/com/platform/dao/SysMenuDao.java
  15. 0 37
      platform-common/src/main/java/com/platform/dao/SysRoleDao.java
  16. 0 30
      platform-common/src/main/java/com/platform/dao/SysRoleDeptDao.java
  17. 0 20
      platform-common/src/main/java/com/platform/dao/SysRoleMenuDao.java
  18. 0 63
      platform-common/src/main/java/com/platform/dao/SysUserDao.java
  19. 0 24
      platform-common/src/main/java/com/platform/dao/SysUserRoleDao.java
  20. 0 156
      platform-common/src/main/java/com/platform/entity/SysDeptEntity.java
  21. 0 203
      platform-common/src/main/java/com/platform/entity/SysMenuEntity.java
  22. 0 82
      platform-common/src/main/java/com/platform/entity/SysRoleDeptEntity.java
  23. 0 82
      platform-common/src/main/java/com/platform/entity/SysRoleMenuEntity.java
  24. 0 333
      platform-common/src/main/java/com/platform/entity/SysUserEntity.java
  25. 0 82
      platform-common/src/main/java/com/platform/entity/SysUserRoleEntity.java
  26. 4 4
      platform-common/src/main/java/com/platform/interceptor/LogInterceptor.java
  27. 0 71
      platform-common/src/main/java/com/platform/service/SysMenuService.java
  28. 0 29
      platform-common/src/main/java/com/platform/service/SysRoleDeptService.java
  29. 0 22
      platform-common/src/main/java/com/platform/service/SysRoleMenuService.java
  30. 0 53
      platform-common/src/main/java/com/platform/service/SysRoleService.java
  31. 0 25
      platform-common/src/main/java/com/platform/service/SysUserRoleService.java
  32. 0 109
      platform-common/src/main/java/com/platform/service/SysUserService.java
  33. 12 16
      platform-common/src/main/java/com/platform/service/custom/MySysUserBrandService.java
  34. 0 157
      platform-common/src/main/java/com/platform/service/impl/SysMenuServiceImpl.java
  35. 0 52
      platform-common/src/main/java/com/platform/service/impl/SysRoleDeptServiceImpl.java
  36. 0 47
      platform-common/src/main/java/com/platform/service/impl/SysRoleMenuServiceImpl.java
  37. 0 136
      platform-common/src/main/java/com/platform/service/impl/SysRoleServiceImpl.java
  38. 0 57
      platform-common/src/main/java/com/platform/service/impl/SysUserRoleServiceImpl.java
  39. 0 339
      platform-common/src/main/java/com/platform/service/impl/SysUserServiceImpl.java
  40. 76 3
      platform-common/src/main/java/com/platform/service/impl/ZhiHouseService.java
  41. 42 76
      platform-common/src/main/java/com/platform/shiro/UserRealm.java
  42. 2 2
      platform-common/src/main/java/com/platform/shiro/jwt/JwtFilter.java
  43. 1 1
      platform-common/src/main/java/com/platform/utils/ShiroUtils.java
  44. 12 49
      platform-common/src/main/java/com/platform/vos/CurrentUserLoginVo.java
  45. 2 11
      platform-common/src/main/java/com/platform/entity/SysRoleEntity.java
  46. 52 0
      platform-common/src/main/java/com/platform/vos/TbUser.java
  47. 0 113
      platform-common/src/main/resources/com/platform/dao/SysMenuDao.xml
  48. 0 169
      platform-common/src/main/resources/com/platform/dao/SysRoleDao.xml
  49. 0 32
      platform-common/src/main/resources/com/platform/dao/SysRoleDeptDao.xml
  50. 0 182
      platform-common/src/main/resources/com/platform/dao/SysUserDao.xml
  51. 0 50
      platform-common/src/main/resources/com/platform/dao/SysUserRoleDao.xml
  52. 7 7
      platform-common/src/main/resources/platform-shiro.xml
  53. 0 26
      platform-framework/src/test/java/com/platform/BaseSpringTestCase.java
  54. 0 56
      platform-framework/src/test/java/com/platform/controller/TestSysUserController.java
  55. 0 14
      platform-framework/src/test/java/com/platform/dao/TestSysUserDao.java
  56. 0 31
      platform-framework/src/test/java/com/platform/service/TestSysUserService.java
  57. 0 33
      platform-framework/src/test/java/com/platform/service/impl/TestSysUserServiceImpl.java
  58. 0 130
      platform-framework/src/test/resources/applicationContext-test.xml
  59. 0 31
      platform-framework/src/test/resources/com/platform/dao/TestSysUserDao.xml
  60. 0 25
      platform-framework/src/test/resources/log4j.properties
  61. 0 44
      platform-framework/src/test/resources/platform.properties
  62. 3 6
      platform-shop/src/main/java/com/platform/controller/BrandController.java
  63. 0 305
      platform-shop/src/main/java/com/platform/controller/SysUserController.java
  64. 2 6
      platform-shop/src/main/java/com/platform/controller/TokenController.java
  65. 6 9
      platform-shop/src/main/java/com/platform/service/impl/BrandServiceImpl.java
  66. 14 14
      platform-shop/src/main/java/com/platform/service/impl/GoodsServiceImpl.java
  67. 4 4
      platform-shop/src/main/java/com/platform/task/TestTask.java

+ 2 - 1
platform-admin/src/main/java/com/platform/aop/CurrentUserAspect.java

@@ -40,7 +40,8 @@ public class CurrentUserAspect {
         //获取当前登录用户
         CurrentUserLoginVo currentUser = ShiroUtils.getUserEntity();
         // 判断企业是否过期
-        if (!ObjectUtils.isEmpty(currentUser.getDeptExpirationDate()) && currentUser.getDeptExpirationDate().before(new Date())) {
+        if (!ObjectUtils.isEmpty(currentUser.getCompanyExpirationDate())
+                && currentUser.getCompanyExpirationDate().before(new Date())) {
             throw new RRException("当前登录用户企业已过期,不允许操作");
         }
     }

+ 12 - 11
platform-admin/src/main/java/com/platform/aop/DataFilterAspect.java

@@ -1,17 +1,18 @@
 package com.platform.aop;
 
 import com.platform.annotation.DataFilter;
-import com.platform.entity.SysUserEntity;
-import com.platform.service.SysRoleDeptService;
+import com.platform.service.impl.ZhiHouseService;
 import com.platform.utils.Constant;
 import com.platform.utils.RRException;
 import com.platform.utils.ShiroUtils;
+import com.platform.vos.TbUser;
 import org.apache.commons.lang.StringUtils;
 import org.aspectj.lang.JoinPoint;
 import org.aspectj.lang.annotation.Aspect;
 import org.aspectj.lang.annotation.Before;
 import org.aspectj.lang.annotation.Pointcut;
 import org.aspectj.lang.reflect.MethodSignature;
+import org.checkerframework.checker.units.qual.A;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
@@ -29,9 +30,9 @@ import java.util.Map;
 @Aspect
 @Component
 public class DataFilterAspect {
-    @Autowired
-    private SysRoleDeptService sysRoleDeptService;
 
+    @Autowired
+    private ZhiHouseService zhiHouseService;
     /**
      * 切点
      */
@@ -50,10 +51,10 @@ public class DataFilterAspect {
         //获取参数
         Object params = point.getArgs()[0];
         if (params != null && params instanceof Map) {
-            SysUserEntity user = ShiroUtils.getUserEntity();
+            TbUser user = ShiroUtils.getUserEntity();
 
             //如果不是超级管理员,则只能查询本部门及子部门数据
-            if (user.getUserId() != Constant.SUPER_ADMIN) {
+            if (user.getId() != Constant.SUPER_ADMIN) {
                 Map map = (Map) params;
                 map.put("filterSql", getFilterSQL(user, point));
             }
@@ -71,7 +72,7 @@ public class DataFilterAspect {
      * @param point 连接点
      * @return sql
      */
-    private String getFilterSQL(SysUserEntity user, JoinPoint point) {
+    private String getFilterSQL(TbUser user, JoinPoint point) {
         MethodSignature signature = (MethodSignature) point.getSignature();
         DataFilter dataFilter = signature.getMethod().getAnnotation(DataFilter.class);
 
@@ -82,7 +83,7 @@ public class DataFilterAspect {
 
         if (StringUtils.isNotBlank(deptAlias)) {
             //取出登录用户部门权限
-            String alias = getAliasByUser(user.getUserId());
+            String alias = getAliasByUser(user.getId());
             if (StringUtils.isNotEmpty(alias)) {
                 filterSql.append(" and (");
                 filterSql.append(deptAlias);
@@ -94,7 +95,7 @@ public class DataFilterAspect {
                     filterSql.append(" or ");
                     filterSql.append(userAlias);
                     filterSql.append("='");
-                    filterSql.append(user.getUserId());
+                    filterSql.append(user.getId());
                     filterSql.append("' ");
                 }
                 filterSql.append(" ) ");
@@ -103,7 +104,7 @@ public class DataFilterAspect {
             filterSql.append(" and ");
             filterSql.append(userAlias);
             filterSql.append("='");
-            filterSql.append(user.getUserId());
+            filterSql.append(user.getId());
             filterSql.append("' ");
         }
 
@@ -118,7 +119,7 @@ public class DataFilterAspect {
      */
     private String getAliasByUser(Long userId) {
         @SuppressWarnings("unchecked")
-        List<Long> roleOrglist = sysRoleDeptService.queryDeptIdListByUserId(userId);
+        List<Long> roleOrglist = zhiHouseService.queryDeptIdListByUserId(userId);
         StringBuilder roleStr = new StringBuilder();
         String alias = "";
         if (roleOrglist != null && !roleOrglist.isEmpty()) {

+ 1 - 2
platform-admin/src/main/java/com/platform/aop/SysLogAspect.java

@@ -3,7 +3,6 @@ package com.platform.aop;
 import com.alibaba.fastjson.JSON;
 import com.platform.annotation.SysLog;
 import com.platform.entity.SysLogEntity;
-import com.platform.entity.SysUserEntity;
 import com.platform.service.SysLogService;
 import com.platform.utils.HttpContextUtils;
 import com.platform.utils.IPUtils;
@@ -82,7 +81,7 @@ public class SysLogAspect {
             username = params;
         }
         if (null != sysUserEntity) {
-            username = sysUserEntity.getUsername();
+            username = sysUserEntity.getUserName();
         }
         sysLog.setUsername(username);
 

+ 4 - 14
platform-admin/src/main/java/com/platform/controller/SysOssController.java

@@ -4,20 +4,20 @@ import com.alibaba.fastjson.JSON;
 import com.platform.annotation.SysLog;
 import com.platform.entity.Result;
 import com.platform.entity.SysOssEntity;
-import com.platform.entity.SysUserEntity;
 import com.platform.enums.ResultCodeEnum;
 import com.platform.exception.CommonBaseException;
 import com.platform.oss.CloudStorageConfig;
 import com.platform.oss.OSSFactory;
 import com.platform.service.SysConfigService;
 import com.platform.service.SysOssService;
-import com.platform.service.SysUserService;
+import com.platform.service.impl.ZhiHouseService;
 import com.platform.utils.*;
 import com.platform.validator.ValidatorUtils;
 import com.platform.validator.group.AliyunGroup;
 import com.platform.validator.group.DiskGroup;
 import com.platform.validator.group.QcloudGroup;
 import com.platform.validator.group.QiniuGroup;
+import com.platform.vos.TbUser;
 import io.swagger.annotations.ApiOperation;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.shiro.authz.annotation.Logical;
@@ -46,13 +46,6 @@ public class SysOssController extends AbstractController{
     private SysOssService sysOssService;
     @Autowired
     private SysConfigService sysConfigService;
-
-    @Autowired
-    private SysUserService sysUserService;
-
-
-
-
     @Autowired
     private UploadToOssUtil uploadToOssUtil;
 
@@ -201,13 +194,10 @@ public class SysOssController extends AbstractController{
         ossEntity.setUrl(url);
         ossEntity.setCreateDate(new Date());
         ossEntity.setUserId(getUserId());
-
-        SysUserEntity userEntity = sysUserService.queryObject(ossEntity.getUserId());
-        if(userEntity != null){
-            ossEntity.setUsername(userEntity.getUsername());
+        if( getUser() != null){
+            ossEntity.setUsername(getUser().getUserName());
         }
         sysOssService.save(ossEntity);
-
         HashMap<String,Object> map = new HashMap<>();
         map.put("url", url);
         map.put("link", url);

+ 3 - 7
platform-api/src/main/java/com/platform/api/ApiAuthController.java

@@ -14,7 +14,6 @@ import com.platform.service.ApiUserService;
 import com.platform.service.TokenService;
 import com.platform.service.custom.MyApiTmBrandAdminService;
 import com.platform.service.custom.MySysUserBrandService;
-import com.platform.service.impl.SysUserServiceImpl;
 import com.platform.service.impl.ZhiHouseService;
 import com.platform.util.ApiBaseAction;
 import com.platform.util.ApiUserUtils;
@@ -22,6 +21,7 @@ import com.platform.util.CommonUtil;
 import com.platform.utils.*;
 import com.platform.validator.Assert;
 import com.platform.vos.ReturnDTO;
+import com.platform.vos.TbUser;
 import com.qiniu.util.StringUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -64,10 +64,6 @@ public class ApiAuthController extends ApiBaseAction {
 
     @Autowired
     private MyApiTmBrandAdminService myApiTmBrandAdminService;
-
-    @Autowired
-    private SysUserServiceImpl sysUserService;
-
     @Autowired
     private MySysUserBrandService mySysUserBrandService;
 
@@ -184,11 +180,11 @@ public class ApiAuthController extends ApiBaseAction {
             userVo.setLast_login_time(nowTime);
             userService.update(userVo);
             if(org.apache.commons.lang.StringUtils.isNotBlank(userVo.getMobile())){
-                SysUserEntity sysUserEntity = sysUserService.queryByUserMobile(userVo.getMobile());
+                TbUser sysUserEntity = zhiHouseService.queryByUserMobile(userVo.getMobile());
                 if(null == sysUserEntity){
                     userInfo.setIsAdmin(0);
                 }else{
-                    List<Long> brandIdList = mySysUserBrandService.queryBrandIdList(sysUserEntity.getUserId());
+                    List<Long> brandIdList = mySysUserBrandService.queryBrandIdList(sysUserEntity.getId());
                     if(!CollectionUtils.isEmpty(brandIdList)){
                         userInfo.setIsAdmin(1);
                     }else{

+ 5 - 8
platform-api/src/main/java/com/platform/api/ApiBrandController.java

@@ -10,12 +10,12 @@ import com.platform.service.ApiRecommendService;
 import com.platform.service.ApiUserService;
 import com.platform.service.custom.MyApiTmBrandTypeService;
 import com.platform.service.custom.MySysUserBrandService;
-import com.platform.service.impl.SysUserServiceImpl;
 import com.platform.service.impl.ZhiHouseService;
 import com.platform.util.ApiBaseAction;
 import com.platform.util.ApiPageUtils;
 import com.platform.utils.Query;
 import com.platform.vos.RequestScene;
+import com.platform.vos.TbUser;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.slf4j.Logger;
@@ -57,9 +57,6 @@ public class ApiBrandController extends ApiBaseAction {
     private ApiUserService apiUserService;
 
     @Autowired
-    private SysUserServiceImpl sysUserService;
-
-    @Autowired
     private ApiRecommendService recommendService;
 
     @Autowired
@@ -97,12 +94,12 @@ public class ApiBrandController extends ApiBaseAction {
             return toResponsSuccess(new ApiPageUtils(new PageInfo(new ArrayList<BrandVo>())));
         }
         // 根据手机号获取系统用户ID
-        SysUserEntity userEntity = sysUserService.queryByUserMobile(phone);
+        TbUser userEntity = zhiHouseService.queryByUserMobile(phone);
         if (ObjectUtils.isEmpty(userEntity)) {
             logger.error("获取系统用户失败:{}", phone);
             return toResponsSuccess(new ApiPageUtils(new PageInfo(new ArrayList<BrandVo>())));
         }
-        userId = userEntity.getUserId();
+        userId = userEntity.getId();
 
         ApiPageUtils result = null;
 
@@ -228,9 +225,9 @@ public class ApiBrandController extends ApiBaseAction {
             UserVo userVo = apiUserService.queryObject(userId);
             if(null != userVo && org.apache.commons.lang.StringUtils.isNotBlank(userVo.getMobile())){
                 //检查是否有带看权限,并更新
-                SysUserEntity sysUserEntity = sysUserService.queryByUserMobile(userVo.getMobile());
+                TbUser sysUserEntity = zhiHouseService.queryByUserMobile(userVo.getMobile());
                 if(null != sysUserEntity){
-                    SysUserBrand sysUserBrand = mySysUserBrandService.getUserBrandById(sysUserEntity.getUserId() , entity.getId());
+                    SysUserBrand sysUserBrand = mySysUserBrandService.getUserBrandById(sysUserEntity.getId() , entity.getId());
                     if(null != sysUserBrand){
                         canshow = null != sysUserBrand.getCanShow() ? sysUserBrand.getCanShow() : 0;
                     }

+ 6 - 8
platform-api/src/main/java/com/platform/api/ApiUserController.java

@@ -5,16 +5,16 @@ import com.github.qcloudsms.SmsSingleSenderResult;
 import com.platform.annotation.LoginUser;
 import com.platform.entity.Result;
 import com.platform.entity.SmsLogVo;
-import com.platform.entity.SysUserEntity;
 import com.platform.entity.UserVo;
 import com.platform.service.ApiUserService;
 import com.platform.service.custom.MyApiTmBrandAdminService;
 import com.platform.service.custom.MySysUserBrandService;
-import com.platform.service.impl.SysUserServiceImpl;
+import com.platform.service.impl.ZhiHouseService;
 import com.platform.util.ApiBaseAction;
 import com.platform.utils.CharUtil;
 
 import com.platform.utils.SmsUtil;
+import com.platform.vos.TbUser;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -43,12 +43,10 @@ public class ApiUserController extends ApiBaseAction {
     private MyApiTmBrandAdminService myApiTmBrandAdminService;
 
     @Autowired
-    private SysUserServiceImpl sysUserService;
-
-
+    private MySysUserBrandService mySysUserBrandService;
 
     @Autowired
-    private MySysUserBrandService mySysUserBrandService;
+    private ZhiHouseService zhiHouseService;
 
 
     @ApiOperation(value = "获取用户个人信息")
@@ -57,11 +55,11 @@ public class ApiUserController extends ApiBaseAction {
         long userId = loginUser.getUserId();
         UserVo userVo = userService.queryObject(userId);
         if(org.apache.commons.lang.StringUtils.isNotBlank(userVo.getMobile())){
-            SysUserEntity sysUserEntity = sysUserService.queryByUserMobile(userVo.getMobile());
+            TbUser sysUserEntity = zhiHouseService.queryByUserMobile(userVo.getMobile());
             if(null == sysUserEntity){
                 userVo.setIsAdmin(0);
             }else{
-                List<Long> brandIdList = mySysUserBrandService.queryBrandIdList(sysUserEntity.getUserId());
+                List<Long> brandIdList = mySysUserBrandService.queryBrandIdList(sysUserEntity.getId());
                 if(!CollectionUtils.isEmpty(brandIdList)){
                     userVo.setIsAdmin(1);
                 }else{

+ 7 - 8
platform-api/src/main/java/com/platform/api/OpenApiNotifyController.java

@@ -5,10 +5,11 @@ import com.platform.entity.*;
 import com.platform.service.ApiBrandService;
 import com.platform.service.ApiUserService;
 import com.platform.service.custom.MySysUserBrandService;
-import com.platform.service.impl.SysUserServiceImpl;
+import com.platform.service.impl.ZhiHouseService;
 import com.platform.utils.CommonDataUtils;
 import com.platform.utils.SyncWxSubscribeServiceImpl;
 import com.platform.vos.OpenApiRequestVo;
+import com.platform.vos.TbUser;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -48,11 +49,9 @@ public class OpenApiNotifyController {
     private MySysUserBrandService mySysUserBrandService;
 
     @Autowired
-    private SysUserServiceImpl sysUserService;
-
-    @Autowired
     private ApiUserService apiUserService;
-
+    @Autowired
+    private ZhiHouseService zhiHouseService;
 
     @ApiOperation(value = "接收消息订阅通知")
     @PostMapping(value = "/shop/notify")
@@ -81,16 +80,16 @@ public class OpenApiNotifyController {
                 if(null != sysUserBrand.getIsBusy() && sysUserBrand.getIsBusy().compareTo(0) == 0){
                     //TODO:这里改成要轮询有空的人,这期先不做,这里占个坑
                 }
-                SysUserEntity sysUserEntity = sysUserService.queryObject(sysUserBrand.getUserId());
+                TbUser sysUserEntity = zhiHouseService.getByUserId(sysUserBrand.getUserId());
                 if(null == sysUserEntity){
                     log.error("店铺管理员无效了");
                     continue;
                 }
-                if(StringUtils.isBlank(sysUserEntity.getMobile())){
+                if(StringUtils.isBlank(sysUserEntity.getPhone())){
                     log.error("店铺管理员缺失手机号");
                     continue;
                 }
-                UserVo userVo = apiUserService.queryByMobile(sysUserEntity.getMobile());
+                UserVo userVo = apiUserService.queryByMobile(sysUserEntity.getPhone());
                 if(null == userVo || StringUtils.isBlank(userVo.getWeixin_openid())){
                     //没有手机号或者openId直接跳过
                     log.error("店铺管理员无法通过手机号获取或者缺失openId");

+ 2 - 2
platform-common/src/main/java/com/platform/controller/AbstractController.java

@@ -20,10 +20,10 @@ public abstract class AbstractController {
     }
 
     protected Long getUserId() {
-        return getUser().getUserId();
+        return getUser().getId();
     }
 
     protected Long getDeptId() {
-        return getUser().getDeptId();
+        return getUser().getCompanyId();
     }
 }

+ 418 - 418
platform-common/src/main/java/com/platform/controller/SysLoginController.java

@@ -1,422 +1,422 @@
-package com.platform.controller;
-
-import com.alibaba.fastjson.JSONArray;
-import com.alibaba.fastjson.JSONObject;
-import com.google.code.kaptcha.Constants;
-import com.google.code.kaptcha.Producer;
-import com.platform.annotation.SysLog;
-import com.platform.entity.Result;
-import com.platform.entity.SysSmsLogEntity;
-import com.platform.entity.SysUserEntity;
-import com.platform.enums.ResultCodeEnum;
-import com.platform.exception.CommonBaseException;
-import com.platform.service.impl.SysSmsLogServiceImpl;
-import com.platform.service.impl.SysUserRoleServiceImpl;
-import com.platform.service.impl.SysUserServiceImpl;
-import com.platform.service.impl.ZhiHouseService;
-import com.platform.utils.*;
-import com.platform.vos.CurrentUserLoginVo;
-import com.platform.vos.UserOnlyLoginVo;
-import com.platform.vos.ZhiHouseUserLoginVo;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang.StringUtils;
-import org.apache.shiro.authc.*;
-import org.apache.shiro.subject.Subject;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.stereotype.Controller;
-import org.springframework.transaction.annotation.Propagation;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-import org.springframework.util.ObjectUtils;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.client.RestTemplate;
-
-import javax.imageio.ImageIO;
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletResponse;
-import java.awt.image.BufferedImage;
-import java.io.IOException;
-import java.time.Duration;
-import java.time.LocalDateTime;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 登录相关
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2016年11月10日 下午1:15:31
- */
-@Api(tags = "系统登录相关")
-@Controller
-@Slf4j
-public class SysLoginController {
-
-    public static final String SMS_AUTH_CODE_PRE = "login_sms_code:";
-    @Autowired
-    private Producer producer;
-
-    @Autowired
-    private SysUserServiceImpl sysUserService;
-
-    @Autowired
-    private SysSmsLogServiceImpl sysSmsLogService;
-
-    @Autowired
-    private SysUserRoleServiceImpl sysUserRoleService;
-
-    @Value("${scenePath}")
-    private String zhiHouseHost;
-
-    @Autowired
-    private RestTemplate restTemplate;
-
-    @Autowired
-    private ZhiHouseService zhiHouseService;
-
-
-    @RequestMapping("captcha.jpg")
-    public void captcha(HttpServletResponse response) throws IOException {
-        response.setHeader("Cache-Control", "no-store, no-cache");
-        response.setContentType("image/jpeg");
-
-        //生成文字验证码
-        String text = producer.createText();
-        //生成图片验证码
-        BufferedImage image = producer.createImage(text);
-        //保存到shiro session
-        ShiroUtils.setSessionAttribute(Constants.KAPTCHA_SESSION_KEY, text);
-
-        ServletOutputStream out = response.getOutputStream();
-        ImageIO.write(image, "jpg", out);
-    }
-
-
-    @ApiOperation(value = "验证短信验证码")
-    @SysLog("验证短信验证码")
-    @ResponseBody
-    @PostMapping(value = "/sys/sms/authCodeValid")
-    public Result smsAuthCodeValid(@RequestParam(name = "phoneNum") String phoneNum , @RequestParam(name = "smsCode") String smsCode) throws IOException {
-
-        if(StringUtils.isBlank(phoneNum) || StringUtils.isBlank(smsCode)){
-            return Result.failure("手机号或者验证码不能为空");
-        }
-        String redisSmsCode = (String) LettuceRedisClientUtils.getValueByKey(SMS_AUTH_CODE_PRE + phoneNum + smsCode);
-        log.info("缓存中的缓存码为:{},上送的为: {}" , redisSmsCode , smsCode);
-        if(StringUtils.isBlank(redisSmsCode)){
-            return Result.failure("验证码不正确或者已失效");
-        }
-        return Result.success();
-    }
-
-    @ApiOperation(value = "发送短信校验码")
-    @SysLog("发送短信校验码")
-    @ResponseBody
-    @PostMapping(value = "/sys/sms/authCode")
-    public Result sendSmsMsg(@RequestParam(name = "phoneNum") String phoneNum , Long deptId) throws IOException {
-
-        if (StringUtils.isBlank(phoneNum)) {
-            return Result.failure("手机号不能为空");
-        }
-        String regex = "^1[3-9][0-9]\\d{8}$";
-        if (!phoneNum.matches(regex)) {
-            return Result.failure("手机号不符合格式");
-        }
-        //校验是否是有效管理员
-        if(null != deptId){
-            SysUserEntity adminUser = sysUserService.queryByMobileAndDeptId(phoneNum , deptId);
-            if(null == adminUser){
-                return Result.failure("请正确填写所属公司管理员手机号码");
-            }
-            List<Long> roleIdList = sysUserRoleService.queryRoleIdList(adminUser.getUserId());
-            if(CollectionUtils.isEmpty(roleIdList) || (!roleIdList.contains(5L) && !roleIdList.contains(6L))){
-                return Result.failure("此手机对应的用户非管理员");
-            }
-
-        }
-
-        // 一分钟之内不能重复发送短信
-        SysSmsLogEntity smsLogVo = sysSmsLogService.querySmsCodeByPhoneNum(phoneNum);
-        if (null != smsLogVo && null != smsLogVo.getCreateTime()) {
-            Duration duration = Duration.between(smsLogVo.getCreateTime() , LocalDateTime.now());
-            long millis = duration.toMillis();
-            log.info("当前时间差为:{}[单位毫秒]" , millis);
-            if (millis <= 60000L) {
-                log.info("一分钟以内不能重复发短信");
-                return Result.failure("短信已发送");
-            }
-        }
-        //生成验证码
-        String smsCode = CharUtil.getRandomNum(4);
-        boolean falg = false;
-        try {
-            //阿里云短信平台
-            falg = SmsUtil.sendAliSms(phoneNum, "{\"code\":\"" + smsCode + "\"}", "SMS_205075406");
-        } catch (Exception e) {
-            return Result.failure("短信发送失败");
-        }
-        if (falg) {
-            SysSmsLogEntity sysSmsLogEntity = new SysSmsLogEntity();
-            sysSmsLogEntity.setCreateTime(LocalDateTime.now());
-            sysSmsLogEntity.setMobile(phoneNum);
-            sysSmsLogEntity.setCode(smsCode);
-            //发送状态 1标识成功,0标识失败
-            sysSmsLogEntity.setSendStatus(1);
-            sysSmsLogEntity.setContent("{\"code\":\"" + smsCode + "\"}");
-            sysSmsLogService.save(sysSmsLogEntity);
-            //将验证码存储redis中,有效期为5分钟,也就是300秒
-            LettuceRedisClientUtils.setStrKeyValue(SMS_AUTH_CODE_PRE + phoneNum +  smsCode , smsCode , 300);
-            return Result.success("短信发送成功");
-        } else {
-            return Result.failure("短信发送失败");
-        }
-    }
-
-    /**
-     * 登录
-     */
-    @SysLog("登录")
-    @ResponseBody
-    @RequestMapping(value = "/sys/loginWithoutAuth", method = RequestMethod.POST)
-    public Result onlyLogin(@RequestBody UserOnlyLoginVo userOnlyLoginVo){
-
-        ZhiHouseUserLoginVo userLoginVo = new ZhiHouseUserLoginVo();
-        userLoginVo.setUserName(userOnlyLoginVo.getUsername());
-        //对前端传的密码解密
-        String password = Base64Converter.decode(Base64Converter.subText(userOnlyLoginVo.getPassword()));
-        userOnlyLoginVo.setPassword(password);
-        userLoginVo.setUserPassword(userOnlyLoginVo.getPassword());
-        userLoginVo.setArea("1234");
-        String url = zhiHouseHost + "api/platform/login";
-        ResponseEntity<String> kankanResult = restTemplate.postForEntity(url, userLoginVo,String.class);
-        if(kankanResult.getStatusCode()!= HttpStatus.OK){
-            return Result.failure("账户验证失败");
-        }
-        //解析返回结果
-        JSONObject res = JSONObject.parseObject(kankanResult.getBody());
-        log.info("四维看看返回登录数据:{}", kankanResult.getBody());
-        Result result = parseResult(res, "登录失败", userLoginVo);
-        if(StringUtils.equals(result.getCode().toString(), String.valueOf(Result.CODE_SUCCESS))){
-            SysUserEntity manager = sysUserService.queryByUserMobile(userOnlyLoginVo.getUsername());
-            if(!ObjectUtils.isEmpty(manager) && manager.getDeptId() != -1L){
-                return Result.failure("操作失败,当前账号已被绑定");
-            }
-        }
-        return result;
-    }
-
-    /**
-     * 登录
-     */
-    @SysLog("登录")
-    @ResponseBody
-    @RequestMapping(value = "/sys/login", method = RequestMethod.POST)
-    public Result login(String username, String password, String captcha) throws IOException {
-//        String kaptcha = ShiroUtils.getKaptcha(Constants.KAPTCHA_SESSION_KEY);
-//        if (null == kaptcha) {
-//            return Result.failure("验证码已失效");
+//package com.platform.controller;
+//
+//import com.alibaba.fastjson.JSONArray;
+//import com.alibaba.fastjson.JSONObject;
+//import com.google.code.kaptcha.Constants;
+//import com.google.code.kaptcha.Producer;
+//import com.platform.annotation.SysLog;
+//import com.platform.entity.Result;
+//import com.platform.entity.SysSmsLogEntity;
+//import com.platform.entity.SysUserEntity;
+//import com.platform.enums.ResultCodeEnum;
+//import com.platform.exception.CommonBaseException;
+//import com.platform.service.impl.SysSmsLogServiceImpl;
+//import com.platform.service.impl.SysUserRoleServiceImpl;
+//import com.platform.service.impl.SysUserServiceImpl;
+//import com.platform.service.impl.ZhiHouseService;
+//import com.platform.utils.*;
+//import com.platform.vos.CurrentUserLoginVo;
+//import com.platform.vos.UserOnlyLoginVo;
+//import com.platform.vos.ZhiHouseUserLoginVo;
+//import io.swagger.annotations.Api;
+//import io.swagger.annotations.ApiOperation;
+//import lombok.extern.slf4j.Slf4j;
+//import org.apache.commons.lang.StringUtils;
+//import org.apache.shiro.authc.*;
+//import org.apache.shiro.subject.Subject;
+//import org.springframework.beans.BeanUtils;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.beans.factory.annotation.Value;
+//import org.springframework.http.HttpStatus;
+//import org.springframework.http.ResponseEntity;
+//import org.springframework.stereotype.Controller;
+//import org.springframework.transaction.annotation.Propagation;
+//import org.springframework.transaction.annotation.Transactional;
+//import org.springframework.util.CollectionUtils;
+//import org.springframework.util.ObjectUtils;
+//import org.springframework.web.bind.annotation.*;
+//import org.springframework.web.client.RestTemplate;
+//
+//import javax.imageio.ImageIO;
+//import javax.servlet.ServletOutputStream;
+//import javax.servlet.http.HttpServletResponse;
+//import java.awt.image.BufferedImage;
+//import java.io.IOException;
+//import java.time.Duration;
+//import java.time.LocalDateTime;
+//import java.util.HashMap;
+//import java.util.List;
+//import java.util.Map;
+//
+///**
+// * 登录相关
+// *
+// * @author lipengjun
+// * @email 939961241@qq.com
+// * @date 2016年11月10日 下午1:15:31
+// */
+//@Api(tags = "系统登录相关")
+//@Controller
+//@Slf4j
+//public class SysLoginController {
+//
+//    public static final String SMS_AUTH_CODE_PRE = "login_sms_code:";
+//    @Autowired
+//    private Producer producer;
+//
+//    @Autowired
+//    private SysUserServiceImpl sysUserService;
+//
+//    @Autowired
+//    private SysSmsLogServiceImpl sysSmsLogService;
+//
+//    @Autowired
+//    private SysUserRoleServiceImpl sysUserRoleService;
+//
+//    @Value("${scenePath}")
+//    private String zhiHouseHost;
+//
+//    @Autowired
+//    private RestTemplate restTemplate;
+//
+//    @Autowired
+//    private ZhiHouseService zhiHouseService;
+//
+//
+//    @RequestMapping("captcha.jpg")
+//    public void captcha(HttpServletResponse response) throws IOException {
+//        response.setHeader("Cache-Control", "no-store, no-cache");
+//        response.setContentType("image/jpeg");
+//
+//        //生成文字验证码
+//        String text = producer.createText();
+//        //生成图片验证码
+//        BufferedImage image = producer.createImage(text);
+//        //保存到shiro session
+//        ShiroUtils.setSessionAttribute(Constants.KAPTCHA_SESSION_KEY, text);
+//
+//        ServletOutputStream out = response.getOutputStream();
+//        ImageIO.write(image, "jpg", out);
+//    }
+//
+//
+//    @ApiOperation(value = "验证短信验证码")
+//    @SysLog("验证短信验证码")
+//    @ResponseBody
+//    @PostMapping(value = "/sys/sms/authCodeValid")
+//    public Result smsAuthCodeValid(@RequestParam(name = "phoneNum") String phoneNum , @RequestParam(name = "smsCode") String smsCode) throws IOException {
+//
+//        if(StringUtils.isBlank(phoneNum) || StringUtils.isBlank(smsCode)){
+//            return Result.failure("手机号或者验证码不能为空");
 //        }
-//        if (!captcha.equalsIgnoreCase(kaptcha)) {
-//            return Result.failure("验证码不正确");
+//        String redisSmsCode = (String) LettuceRedisClientUtils.getValueByKey(SMS_AUTH_CODE_PRE + phoneNum + smsCode);
+//        log.info("缓存中的缓存码为:{},上送的为: {}" , redisSmsCode , smsCode);
+//        if(StringUtils.isBlank(redisSmsCode)){
+//            return Result.failure("验证码不正确或者已失效");
 //        }
-
-        //对前端传的密码解密
-        password = Base64Converter.decode(Base64Converter.subText(password));
-
-        ResponseEntity<String> loginResult = zhiHouseService.login(username, password);
-        if(loginResult.getStatusCode()!= HttpStatus.OK){
-            return Result.failure("登录失败");
-        }
-        //解析返回结果
-        JSONObject res = JSONObject.parseObject(loginResult.getBody());
-        Result result = parseResultWithoutAddUser(res, "登录失败");
-//        if (null != result && result.getCode().equals(Result.CODE_SUCCESS)) {
-//            log.info("四维看看登录完成,将执行本地登录验证");
-//            try {
-//                Subject subject = ShiroUtils.getSubject();
-//                UsernamePasswordToken token = new UsernamePasswordToken(username, password);
-//                subject.login(token);
-//            } catch (UnknownAccountException | IncorrectCredentialsException | LockedAccountException e) {
-//                return Result.failure(e.getMessage());
-//            } catch (AuthenticationException e) {
-//                return Result.failure("账户验证失败");
+//        return Result.success();
+//    }
+//
+//    @ApiOperation(value = "发送短信校验码")
+//    @SysLog("发送短信校验码")
+//    @ResponseBody
+//    @PostMapping(value = "/sys/sms/authCode")
+//    public Result sendSmsMsg(@RequestParam(name = "phoneNum") String phoneNum , Long deptId) throws IOException {
+//
+//        if (StringUtils.isBlank(phoneNum)) {
+//            return Result.failure("手机号不能为空");
+//        }
+//        String regex = "^1[3-9][0-9]\\d{8}$";
+//        if (!phoneNum.matches(regex)) {
+//            return Result.failure("手机号不符合格式");
+//        }
+//        //校验是否是有效管理员
+//        if(null != deptId){
+//            SysUserEntity adminUser = sysUserService.queryByMobileAndDeptId(phoneNum , deptId);
+//            if(null == adminUser){
+//                return Result.failure("请正确填写所属公司管理员手机号码");
+//            }
+//            List<Long> roleIdList = sysUserRoleService.queryRoleIdList(adminUser.getUserId());
+//            if(CollectionUtils.isEmpty(roleIdList) || (!roleIdList.contains(5L) && !roleIdList.contains(6L))){
+//                return Result.failure("此手机对应的用户非管理员");
+//            }
+//
+//        }
+//
+//        // 一分钟之内不能重复发送短信
+//        SysSmsLogEntity smsLogVo = sysSmsLogService.querySmsCodeByPhoneNum(phoneNum);
+//        if (null != smsLogVo && null != smsLogVo.getCreateTime()) {
+//            Duration duration = Duration.between(smsLogVo.getCreateTime() , LocalDateTime.now());
+//            long millis = duration.toMillis();
+//            log.info("当前时间差为:{}[单位毫秒]" , millis);
+//            if (millis <= 60000L) {
+//                log.info("一分钟以内不能重复发短信");
+//                return Result.failure("短信已发送");
+//            }
+//        }
+//        //生成验证码
+//        String smsCode = CharUtil.getRandomNum(4);
+//        boolean falg = false;
+//        try {
+//            //阿里云短信平台
+//            falg = SmsUtil.sendAliSms(phoneNum, "{\"code\":\"" + smsCode + "\"}", "SMS_205075406");
+//        } catch (Exception e) {
+//            return Result.failure("短信发送失败");
+//        }
+//        if (falg) {
+//            SysSmsLogEntity sysSmsLogEntity = new SysSmsLogEntity();
+//            sysSmsLogEntity.setCreateTime(LocalDateTime.now());
+//            sysSmsLogEntity.setMobile(phoneNum);
+//            sysSmsLogEntity.setCode(smsCode);
+//            //发送状态 1标识成功,0标识失败
+//            sysSmsLogEntity.setSendStatus(1);
+//            sysSmsLogEntity.setContent("{\"code\":\"" + smsCode + "\"}");
+//            sysSmsLogService.save(sysSmsLogEntity);
+//            //将验证码存储redis中,有效期为5分钟,也就是300秒
+//            LettuceRedisClientUtils.setStrKeyValue(SMS_AUTH_CODE_PRE + phoneNum +  smsCode , smsCode , 300);
+//            return Result.success("短信发送成功");
+//        } else {
+//            return Result.failure("短信发送失败");
+//        }
+//    }
+//
+//    /**
+//     * 登录
+//     */
+//    @SysLog("登录")
+//    @ResponseBody
+//    @RequestMapping(value = "/sys/loginWithoutAuth", method = RequestMethod.POST)
+//    public Result onlyLogin(@RequestBody UserOnlyLoginVo userOnlyLoginVo){
+//
+//        ZhiHouseUserLoginVo userLoginVo = new ZhiHouseUserLoginVo();
+//        userLoginVo.setUserName(userOnlyLoginVo.getUsername());
+//        //对前端传的密码解密
+//        String password = Base64Converter.decode(Base64Converter.subText(userOnlyLoginVo.getPassword()));
+//        userOnlyLoginVo.setPassword(password);
+//        userLoginVo.setUserPassword(userOnlyLoginVo.getPassword());
+//        userLoginVo.setArea("1234");
+//        String url = zhiHouseHost + "api/platform/login";
+//        ResponseEntity<String> kankanResult = restTemplate.postForEntity(url, userLoginVo,String.class);
+//        if(kankanResult.getStatusCode()!= HttpStatus.OK){
+//            return Result.failure("账户验证失败");
+//        }
+//        //解析返回结果
+//        JSONObject res = JSONObject.parseObject(kankanResult.getBody());
+//        log.info("四维看看返回登录数据:{}", kankanResult.getBody());
+//        Result result = parseResult(res, "登录失败", userLoginVo);
+//        if(StringUtils.equals(result.getCode().toString(), String.valueOf(Result.CODE_SUCCESS))){
+//            SysUserEntity manager = sysUserService.queryByUserMobile(userOnlyLoginVo.getUsername());
+//            if(!ObjectUtils.isEmpty(manager) && manager.getDeptId() != -1L){
+//                return Result.failure("操作失败,当前账号已被绑定");
+//            }
+//        }
+//        return result;
+//    }
+//
+//    /**
+//     * 登录
+//     */
+//    @SysLog("登录")
+//    @ResponseBody
+//    @RequestMapping(value = "/sys/login", method = RequestMethod.POST)
+//    public Result login(String username, String password, String captcha) throws IOException {
+////        String kaptcha = ShiroUtils.getKaptcha(Constants.KAPTCHA_SESSION_KEY);
+////        if (null == kaptcha) {
+////            return Result.failure("验证码已失效");
+////        }
+////        if (!captcha.equalsIgnoreCase(kaptcha)) {
+////            return Result.failure("验证码不正确");
+////        }
+//
+//        //对前端传的密码解密
+//        password = Base64Converter.decode(Base64Converter.subText(password));
+//
+//        ResponseEntity<String> loginResult = zhiHouseService.login(username, password);
+//        if(loginResult.getStatusCode()!= HttpStatus.OK){
+//            return Result.failure("登录失败");
+//        }
+//        //解析返回结果
+//        JSONObject res = JSONObject.parseObject(loginResult.getBody());
+//        Result result = parseResultWithoutAddUser(res, "登录失败");
+////        if (null != result && result.getCode().equals(Result.CODE_SUCCESS)) {
+////            log.info("四维看看登录完成,将执行本地登录验证");
+////            try {
+////                Subject subject = ShiroUtils.getSubject();
+////                UsernamePasswordToken token = new UsernamePasswordToken(username, password);
+////                subject.login(token);
+////            } catch (UnknownAccountException | IncorrectCredentialsException | LockedAccountException e) {
+////                return Result.failure(e.getMessage());
+////            } catch (AuthenticationException e) {
+////                return Result.failure("账户验证失败");
+////            }
+////        }
+//        return result;
+//    }
+//    @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
+//    public Result parseResultWithoutAddUser(JSONObject res, String defaultFailMsg) {
+//        if(ObjectUtils.isEmpty(res)){
+//            return Result.failure(defaultFailMsg);
+//        }
+//        int code = res.containsKey("code") ? res.getIntValue("code") : -10;
+//        if (200 != code) {
+//            return Result.failure(res.getString("message"));
+//        }
+//        Map<String, Object> resultMap = new HashMap<>();
+//        JSONObject dataObject = null;
+//        String tokenFromKankan = "";
+//        if (res.get("message") instanceof JSONArray) {
+//            log.info("四维看看登录返回的data是json数组");
+//            return Result.success();
+//        } else if (res.get("message") instanceof JSONObject) {
+//            log.info("四维看看登录返回的data是json object");
+//            //登录返回的就是jsonObject
+//            dataObject = (JSONObject) res.get("message");
+//            if(ObjectUtils.isEmpty(dataObject)){
+//                return Result.success(resultMap);
 //            }
+//            tokenFromKankan = dataObject.getString("token");
+//            if (StringUtils.isBlank(tokenFromKankan)) {
+//                throw new CommonBaseException(ResultCodeEnum.D101, "四维看看返回的token为空");
+//            }
+//            resultMap.put("token", tokenFromKankan);
+//            String nickName = dataObject.getString("nickName");
+//            String userName = dataObject.getString("userName");
+//            if (StringUtils.isBlank(userName)) {
+//                throw new CommonBaseException(ResultCodeEnum.D101, "看看返回用户名为空");
+//            }
+//            SysUserEntity dbUser = sysUserService.queryByUserMobile(userName);
+//            if (null == dbUser) {
+//                  return Result.failure(11 ,"账号未授权,请联系平台管理员授予相关权限。");
+//            }
+//            if (null != dbUser.getStatus() && dbUser.getStatus() == 0) {
+//                log.info("用户[{}]不可用", dbUser.getUsername());
+//                throw new CommonBaseException(ResultCodeEnum.D101, "用户已经不可用");
+//            }
+//            CurrentUserLoginVo userVo = new CurrentUserLoginVo();
+//            BeanUtils.copyProperties(dbUser,userVo);
+//            if(!ObjectUtils.isEmpty(dbUser.getDeptId())){
+//                // 获取用户所在企业信息
+//                JSONObject deptEntity = zhiHouseService.getComponyInfo(dbUser.getMobile());
+//                userVo.setDeptName(deptEntity.getString("name"));
+//                userVo.setDeptId(deptEntity.getLong("id"));
+//                userVo.setDeptManagerPhoneNum(deptEntity.getString("phoneNum"));
+//                userVo.setDeptExpirationDate(deptEntity.getDate("expirationDate"));
+//                userVo.setFdkkPassword(null);
+//            }
+//            resultMap.put("user", userVo);
+//            return Result.success(resultMap);
+//        } else {
+//            return Result.failure("四维看看返回数据测试异常");
+//        }
+//
+//
+//    }
+//
+//
+//    @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
+//    public Result parseResult(JSONObject res, String defaultFailMsg, ZhiHouseUserLoginVo adminRegisterVo) {
+//        if(ObjectUtils.isEmpty(res)){
+//            return Result.failure(defaultFailMsg);
+//        }
+//        int code =res.containsKey("code")?res.getIntValue("code"): -10;
+//        if (200 != code) {
+//            return Result.failure(res.getString("message"));
+//        }
+//        Map<String, Object> resultMap = new HashMap<>();
+//        log.info("用户登录成功");
+//        if (res.get("message") instanceof JSONArray) {
+//            log.info("四维看看登录返回的data是json数组");
+//            return Result.success();
+//        } else if (res.get("message") instanceof JSONObject) {
+//            log.info("四维看看登录返回的data是json object");
+//            JSONObject dataObject = (JSONObject) res.get("message");
+//            if(ObjectUtils.isEmpty(dataObject)){
+//                return Result.success(resultMap);
+//            }
+//            String tokenFromKankan = dataObject.getString("token");
+//            if (StringUtils.isBlank(tokenFromKankan)) {
+//                throw new CommonBaseException(ResultCodeEnum.D101, "四维看看返回的token为空");
+//            }
+//            resultMap.put("token", tokenFromKankan);
+//            String nickName = dataObject.getString("nickName");
+//            String userName = dataObject.getString("userName");
+//            String password = dataObject.getString("userPassword");
+//            if (StringUtils.isBlank(userName)) {
+//                throw new CommonBaseException(ResultCodeEnum.D101, "看看返回用户名为空");
+//            }
+//            SysUserEntity dbUser = sysUserService.queryByUserMobile(userName);
+//            if (null == dbUser) {
+//                addNewUserWithDeptId(nickName,userName , password, -1L);
+//                dbUser = sysUserService.queryByUserMobile(adminRegisterVo.getUserName());
+//                if (null == dbUser) {
+//                    log.error("新插入的用户:{}重新捞取失败", adminRegisterVo.getUserName());
+//                    throw new CommonBaseException(ResultCodeEnum.D101, "获取用户失败");
+//                }
+//                //默认开通普通公司管理员的权限
+//                int insert = sysUserRoleService.onlySave(dbUser.getUserId(), 6L);
+//                if(insert != 1){
+//                    log.error("给用户[{}]开通普通管理员角色失败" , dbUser.getMobile());
+//                    throw new CommonBaseException(ResultCodeEnum.D101 , "新增普通管理员权限失败");
+//                }
+//            } else {
+//                if (null != dbUser.getStatus() && dbUser.getStatus() == 0) {
+//                    log.info("用户[{}]不可用", dbUser.getUsername());
+//                    throw new CommonBaseException(ResultCodeEnum.D101, "用户已经不可用");
+//                }
+//                if(!StringUtils.equals(nickName , dbUser.getUsername())){
+//                    log.info("修改了昵称,这里更新");
+//                    dbUser.setUsername(nickName);
+//                    sysUserService.updateOnly(dbUser);
+//                }
+//            }
+//            resultMap.put("user", dbUser);
+//            return Result.success(resultMap);
+//        } else {
+//            return Result.failure("四维看看返回数据测试异常");
+//        }
+//    }
+//
+//    public void addNewUserWithDeptId(String nickName, String phoneNum, String password, long deptId){
+//        if (StringUtils.isBlank(phoneNum)) {
+//            return;
+//        }
+//        SysUserEntity userEntity = new SysUserEntity();
+//        userEntity.setPassword(password);
+//        userEntity.setMobile(phoneNum);
+//        userEntity.setUsername(nickName);
+//        if(deptId >= 0){
+//            userEntity.setDeptId(deptId);
+//        }
+//        userEntity.setStatus(1);
+//        userEntity.setCreateUserId(1L);
+//        userEntity.setDeptId(-1L);
+//        sysUserService.addNewUserWithoutCheck(userEntity);
+//    }
+//
+//    public void addNewUserByPhone(String phoneNum, String password, int kankanUserId) {
+//        if (StringUtils.isBlank(phoneNum)) {
+//            return;
 //        }
-        return result;
-    }
-    @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
-    public Result parseResultWithoutAddUser(JSONObject res, String defaultFailMsg) {
-        if(ObjectUtils.isEmpty(res)){
-            return Result.failure(defaultFailMsg);
-        }
-        int code = res.containsKey("code") ? res.getIntValue("code") : -10;
-        if (200 != code) {
-            return Result.failure(res.getString("message"));
-        }
-        Map<String, Object> resultMap = new HashMap<>();
-        JSONObject dataObject = null;
-        String tokenFromKankan = "";
-        if (res.get("message") instanceof JSONArray) {
-            log.info("四维看看登录返回的data是json数组");
-            return Result.success();
-        } else if (res.get("message") instanceof JSONObject) {
-            log.info("四维看看登录返回的data是json object");
-            //登录返回的就是jsonObject
-            dataObject = (JSONObject) res.get("message");
-            if(ObjectUtils.isEmpty(dataObject)){
-                return Result.success(resultMap);
-            }
-            tokenFromKankan = dataObject.getString("token");
-            if (StringUtils.isBlank(tokenFromKankan)) {
-                throw new CommonBaseException(ResultCodeEnum.D101, "四维看看返回的token为空");
-            }
-            resultMap.put("token", tokenFromKankan);
-            String nickName = dataObject.getString("nickName");
-            String userName = dataObject.getString("userName");
-            if (StringUtils.isBlank(userName)) {
-                throw new CommonBaseException(ResultCodeEnum.D101, "看看返回用户名为空");
-            }
-            SysUserEntity dbUser = sysUserService.queryByUserMobile(userName);
-            if (null == dbUser) {
-                  return Result.failure(11 ,"账号未授权,请联系平台管理员授予相关权限。");
-            }
-            if (null != dbUser.getStatus() && dbUser.getStatus() == 0) {
-                log.info("用户[{}]不可用", dbUser.getUsername());
-                throw new CommonBaseException(ResultCodeEnum.D101, "用户已经不可用");
-            }
-            CurrentUserLoginVo userVo = new CurrentUserLoginVo();
-            BeanUtils.copyProperties(dbUser,userVo);
-            if(!ObjectUtils.isEmpty(dbUser.getDeptId())){
-                // 获取用户所在企业信息
-                JSONObject deptEntity = zhiHouseService.getComponyInfo(dbUser.getMobile());
-                userVo.setDeptName(deptEntity.getString("name"));
-                userVo.setDeptId(deptEntity.getLong("id"));
-                userVo.setDeptManagerPhoneNum(deptEntity.getString("phoneNum"));
-                userVo.setDeptExpirationDate(deptEntity.getDate("expirationDate"));
-                userVo.setFdkkPassword(null);
-            }
-            resultMap.put("user", userVo);
-            return Result.success(resultMap);
-        } else {
-            return Result.failure("四维看看返回数据测试异常");
-        }
-
-
-    }
-
-
-    @Transactional(propagation = Propagation.REQUIRES_NEW, rollbackFor = Exception.class)
-    public Result parseResult(JSONObject res, String defaultFailMsg, ZhiHouseUserLoginVo adminRegisterVo) {
-        if(ObjectUtils.isEmpty(res)){
-            return Result.failure(defaultFailMsg);
-        }
-        int code =res.containsKey("code")?res.getIntValue("code"): -10;
-        if (200 != code) {
-            return Result.failure(res.getString("message"));
-        }
-        Map<String, Object> resultMap = new HashMap<>();
-        log.info("用户登录成功");
-        if (res.get("message") instanceof JSONArray) {
-            log.info("四维看看登录返回的data是json数组");
-            return Result.success();
-        } else if (res.get("message") instanceof JSONObject) {
-            log.info("四维看看登录返回的data是json object");
-            JSONObject dataObject = (JSONObject) res.get("message");
-            if(ObjectUtils.isEmpty(dataObject)){
-                return Result.success(resultMap);
-            }
-            String tokenFromKankan = dataObject.getString("token");
-            if (StringUtils.isBlank(tokenFromKankan)) {
-                throw new CommonBaseException(ResultCodeEnum.D101, "四维看看返回的token为空");
-            }
-            resultMap.put("token", tokenFromKankan);
-            String nickName = dataObject.getString("nickName");
-            String userName = dataObject.getString("userName");
-            String password = dataObject.getString("userPassword");
-            if (StringUtils.isBlank(userName)) {
-                throw new CommonBaseException(ResultCodeEnum.D101, "看看返回用户名为空");
-            }
-            SysUserEntity dbUser = sysUserService.queryByUserMobile(userName);
-            if (null == dbUser) {
-                addNewUserWithDeptId(nickName,userName , password, -1L);
-                dbUser = sysUserService.queryByUserMobile(adminRegisterVo.getUserName());
-                if (null == dbUser) {
-                    log.error("新插入的用户:{}重新捞取失败", adminRegisterVo.getUserName());
-                    throw new CommonBaseException(ResultCodeEnum.D101, "获取用户失败");
-                }
-                //默认开通普通公司管理员的权限
-                int insert = sysUserRoleService.onlySave(dbUser.getUserId(), 6L);
-                if(insert != 1){
-                    log.error("给用户[{}]开通普通管理员角色失败" , dbUser.getMobile());
-                    throw new CommonBaseException(ResultCodeEnum.D101 , "新增普通管理员权限失败");
-                }
-            } else {
-                if (null != dbUser.getStatus() && dbUser.getStatus() == 0) {
-                    log.info("用户[{}]不可用", dbUser.getUsername());
-                    throw new CommonBaseException(ResultCodeEnum.D101, "用户已经不可用");
-                }
-                if(!StringUtils.equals(nickName , dbUser.getUsername())){
-                    log.info("修改了昵称,这里更新");
-                    dbUser.setUsername(nickName);
-                    sysUserService.updateOnly(dbUser);
-                }
-            }
-            resultMap.put("user", dbUser);
-            return Result.success(resultMap);
-        } else {
-            return Result.failure("四维看看返回数据测试异常");
-        }
-    }
-
-    public void addNewUserWithDeptId(String nickName, String phoneNum, String password, long deptId){
-        if (StringUtils.isBlank(phoneNum)) {
-            return;
-        }
-        SysUserEntity userEntity = new SysUserEntity();
-        userEntity.setPassword(password);
-        userEntity.setMobile(phoneNum);
-        userEntity.setUsername(nickName);
-        if(deptId >= 0){
-            userEntity.setDeptId(deptId);
-        }
-        userEntity.setStatus(1);
-        userEntity.setCreateUserId(1L);
-        userEntity.setDeptId(-1L);
-        sysUserService.addNewUserWithoutCheck(userEntity);
-    }
-
-    public void addNewUserByPhone(String phoneNum, String password, int kankanUserId) {
-        if (StringUtils.isBlank(phoneNum)) {
-            return;
-        }
-        SysUserEntity userEntity = new SysUserEntity();
-        userEntity.setPassword(password);
-        userEntity.setMobile(phoneNum);
-        userEntity.setUsername(phoneNum);
-        userEntity.setStatus(1);
-        //TODO:看看放这里是否合适
-        userEntity.setCreateUserId(1L);
-        //TODO:这里默认给76的默认部门
-        userEntity.setDeptId(76L);
-        sysUserService.addNewUserWithoutCheck(userEntity);
-
-    }
-
-    /**
-     * 退出
-     */
-    @RequestMapping(value = "logout", method = RequestMethod.GET)
-    public String logout() {
-        ShiroUtils.logout();
-        return "redirect:/";
-    }
-
-}
+//        SysUserEntity userEntity = new SysUserEntity();
+//        userEntity.setPassword(password);
+//        userEntity.setMobile(phoneNum);
+//        userEntity.setUsername(phoneNum);
+//        userEntity.setStatus(1);
+//        //TODO:看看放这里是否合适
+//        userEntity.setCreateUserId(1L);
+//        //TODO:这里默认给76的默认部门
+//        userEntity.setDeptId(76L);
+//        sysUserService.addNewUserWithoutCheck(userEntity);
+//
+//    }
+//
+//    /**
+//     * 退出
+//     */
+//    @RequestMapping(value = "logout", method = RequestMethod.GET)
+//    public String logout() {
+//        ShiroUtils.logout();
+//        return "redirect:/";
+//    }
+//
+//}

+ 0 - 211
platform-common/src/main/java/com/platform/controller/SysMenuController.java

@@ -1,211 +0,0 @@
-package com.platform.controller;
-
-import com.platform.annotation.SysLog;
-import com.platform.entity.Result;
-import com.platform.entity.SysMenuEntity;
-import com.platform.service.SysMenuService;
-import com.platform.utils.*;
-import com.platform.utils.Constant.MenuType;
-import com.platform.vos.CurrentUserLoginVo;
-import org.apache.commons.lang.StringUtils;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.ObjectUtils;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 系统菜单
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2016年10月27日 下午9:58:15
- */
-@RestController
-@RequestMapping("/sys/menu")
-public class SysMenuController extends AbstractController {
-    @Autowired
-    private SysMenuService sysMenuService;
-
-    /**
-     * 所有菜单列表
-     */
-    @RequestMapping("/list")
-    @RequiresPermissions("sys:menu:list")
-    public Result list(@RequestBody Map<String, Object> params) {
-        //查询列表数据
-        Query query = new Query(params);
-        List<SysMenuEntity> menuList = sysMenuService.queryList(query);
-        int total = sysMenuService.queryTotal(query);
-        return Result.success(PageUtilsPlus.page(menuList, (long) total,(long)query.getLimit(),(long)query.getPage()));
-    }
-
-    /**
-     * 所有菜单列表
-     */
-    @RequestMapping("/queryAll")
-    public Result queryAll(@RequestBody Map<String, Object> params) {
-        //查询列表数据
-        List<SysMenuEntity> menuList = sysMenuService.queryList(params);
-
-        return Result.success(menuList);
-    }
-
-    /**
-     * 选择菜单(添加、修改菜单)
-     */
-    @RequestMapping("/select")
-    @RequiresPermissions("sys:menu:select")
-    public Result select() {
-        //查询列表数据
-        List<SysMenuEntity> menuList = sysMenuService.queryNotButtonList();
-
-        //添加顶级菜单
-        SysMenuEntity root = new SysMenuEntity();
-        root.setMenuId(0L);
-        root.setName("一级菜单");
-        root.setParentId(-1L);
-        root.setOpen(true);
-        menuList.add(root);
-
-        return Result.success(menuList);
-    }
-
-    /**
-     * 角色授权菜单
-     */
-    @RequestMapping("/perms")
-    @RequiresPermissions("sys:menu:perms")
-    public Result perms() {
-        //查询列表数据
-        List<SysMenuEntity> menuList = null;
-
-        //只有超级管理员,才能查看所有管理员列表
-        if (getUserId() == Constant.SUPER_ADMIN) {
-            menuList = sysMenuService.queryList(new HashMap<String, Object>());
-        } else {
-            menuList = sysMenuService.queryUserList(getUserId());
-        }
-
-        return Result.success(menuList);
-    }
-
-    /**
-     * 菜单信息
-     */
-    @RequestMapping("/info")
-    @RequiresPermissions("sys:menu:info")
-    public Result info(@RequestParam("menuId") Long menuId) {
-        SysMenuEntity menu = sysMenuService.queryObject(menuId);
-        return Result.success( menu);
-    }
-
-    /**
-     * 保存
-     */
-    @SysLog("保存菜单")
-    @RequestMapping("/save")
-    @RequiresPermissions("sys:menu:save")
-    public Result save(@RequestBody SysMenuEntity menu) {
-        //数据校验
-        verifyForm(menu);
-
-        sysMenuService.save(menu);
-
-        return Result.success();
-    }
-
-    /**
-     * 修改
-     */
-    @SysLog("修改菜单")
-    @RequestMapping("/update")
-    @RequiresPermissions("sys:menu:update")
-    public Result update(@RequestBody SysMenuEntity menu) {
-        //数据校验
-        verifyForm(menu);
-
-        sysMenuService.update(menu);
-
-        return Result.success();
-    }
-
-    /**
-     * 删除
-     */
-    @SysLog("删除菜单")
-    @RequestMapping("/delete")
-    @RequiresPermissions("sys:menu:delete")
-    public Result delete(@RequestBody Long[] menuIds) {
-        for (Long menuId : menuIds) {
-            if (menuId.longValue() <= 30) {
-                return Result.failure("系统菜单,不能删除");
-            }
-        }
-        sysMenuService.deleteBatch(menuIds);
-
-        return Result.success();
-    }
-
-    /**
-     * 用户菜单列表
-     */
-    @RequestMapping("/user")
-    public Result user() {
-        List<SysMenuEntity> menuList = sysMenuService.getUserMenuList(getUserId());
-        CurrentUserLoginVo user = getUser();
-        if(!ObjectUtils.isEmpty(user.getIsPlatformStreamer()) && user.getIsPlatformStreamer()){
-            menuList.removeIf(menu->menu.getName().equals("商品管理"));
-        }
-        // 隐藏绑定账号
-        menuList.removeIf(menu->menu.getName().equals("绑定账号"));
-        return Result.success( menuList);
-    }
-
-    /**
-     * 验证参数是否正确
-     */
-    private void verifyForm(SysMenuEntity menu) {
-        if (StringUtils.isBlank(menu.getName())) {
-            throw new RRException("菜单名称不能为空");
-        }
-
-        if (menu.getParentId() == null) {
-            throw new RRException("上级菜单不能为空");
-        }
-
-        //菜单
-        if (menu.getType() == MenuType.MENU.getValue()) {
-            if (StringUtils.isBlank(menu.getUrl())) {
-                throw new RRException("菜单URL不能为空");
-            }
-        }
-
-        //上级菜单类型
-        int parentType = MenuType.CATALOG.getValue();
-        if (menu.getParentId() != 0) {
-            SysMenuEntity parentMenu = sysMenuService.queryObject(menu.getParentId());
-            parentType = parentMenu.getType();
-        }
-
-        //目录、菜单
-        if (menu.getType() == MenuType.CATALOG.getValue() ||
-                menu.getType() == MenuType.MENU.getValue()) {
-            if (parentType != MenuType.CATALOG.getValue()) {
-                throw new RRException("上级菜单只能为目录类型");
-            }
-            return;
-        }
-
-        //按钮
-        if (menu.getType() == MenuType.BUTTON.getValue()) {
-            if (parentType != MenuType.MENU.getValue()) {
-                throw new RRException("上级菜单只能为菜单类型");
-            }
-            return;
-        }
-    }
-}

+ 0 - 136
platform-common/src/main/java/com/platform/controller/SysRoleController.java

@@ -1,136 +0,0 @@
-package com.platform.controller;
-
-import com.platform.annotation.SysLog;
-import com.platform.entity.Result;
-import com.platform.entity.SysRoleEntity;
-import com.platform.service.SysRoleDeptService;
-import com.platform.service.SysRoleMenuService;
-import com.platform.service.SysRoleService;
-import com.platform.service.impl.SysUserRoleServiceImpl;
-import com.platform.utils.*;
-import com.platform.validator.ValidatorUtils;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.CollectionUtils;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * 角色管理
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2016年11月8日 下午2:18:33
- */
-@RestController
-@RequestMapping("/sys/role")
-public class SysRoleController extends AbstractController {
-    @Autowired
-    private SysRoleService sysRoleService;
-    @Autowired
-    private SysRoleMenuService sysRoleMenuService;
-    @Autowired
-    private SysRoleDeptService sysRoleDeptService;
-
-    /**
-     * 角色列表
-     */
-    @RequestMapping("/list")
-    @RequiresPermissions("sys:role:list")
-    public Result list(@RequestBody Map<String, Object> params) {
-        //如果不是超级管理员,则只查询自己创建的角色列表
-        if (getUserId() != Constant.SUPER_ADMIN) {
-            params.put("excludeSuperAdmin",  true);
-        }
-
-        //查询列表数据
-        Query query = new Query(params);
-        List<SysRoleEntity> list = sysRoleService.queryList(query);
-        int total = sysRoleService.queryListTotal(query);
-
-        PageUtils pageUtil = new PageUtils(list, total, query.getLimit(), query.getPage());
-
-        return Result.success(pageUtil);
-    }
-
-    /**
-     * 角色列表
-     */
-    @RequestMapping("/select")
-    @RequiresPermissions("sys:role:select")
-    public Result select() {
-        Map<String, Object> map = new HashMap<>();
-        List<SysRoleEntity> list = new ArrayList<>();
-        //默认获取全部,要剔除平台管理员
-        map.put("excludeSuperAdmin" , true);
-        map.put("hide" , 0);
-        list = sysRoleService.queryList(map);
-        return Result.success(list);
-    }
-
-    /**
-     * 角色信息
-     */
-    @RequestMapping("/info/{roleId}")
-    @RequiresPermissions("sys:role:info")
-    public Result info(@PathVariable("roleId") Long roleId) {
-        SysRoleEntity role = sysRoleService.queryObject(roleId);
-
-        //查询角色对应的菜单
-        List<Long> menuIdList = sysRoleMenuService.queryMenuIdList(roleId);
-        role.setMenuIdList(menuIdList);
-
-        //查询角色对应的部门
-        List<Long> deptIdList = sysRoleDeptService.queryDeptIdList(roleId);
-        role.setDeptIdList(deptIdList);
-
-        return Result.success(role);
-    }
-
-    /**
-     * 保存角色
-     */
-    @SysLog("保存角色")
-    @RequestMapping("/save")
-    @RequiresPermissions("sys:role:save")
-    public Result save(@RequestBody SysRoleEntity role) {
-        ValidatorUtils.validateEntity(role);
-
-        role.setCreateUserId(getUserId());
-        sysRoleService.save(role);
-
-        return Result.success();
-    }
-
-    /**
-     * 修改角色
-     */
-    @SysLog("修改角色")
-    @RequestMapping("/update")
-    @RequiresPermissions("sys:role:update")
-    public Result update(@RequestBody SysRoleEntity role) {
-        ValidatorUtils.validateEntity(role);
-
-        role.setCreateUserId(getUserId());
-        sysRoleService.update(role);
-
-        return Result.success();
-    }
-
-    /**
-     * 删除角色
-     */
-    @SysLog("删除角色")
-    @RequestMapping("/delete")
-    @RequiresPermissions("sys:role:delete")
-    public Result delete(@RequestBody Long[] roleIds) {
-        sysRoleService.deleteBatch(roleIds);
-
-        return Result.success();
-    }
-}

+ 49 - 0
platform-common/src/main/java/com/platform/controller/ZfbController.java

@@ -0,0 +1,49 @@
+package com.platform.controller;
+
+import com.platform.entity.Result;
+import com.platform.service.custom.MySysUserBrandService;
+import com.platform.service.impl.ZhiHouseService;
+import com.platform.vos.TbUser;
+import org.apache.shiro.authz.annotation.RequiresPermissions;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.ObjectUtils;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@RestController
+@RequestMapping("/api/zfb")
+public class ZfbController {
+
+    @Autowired
+    private MySysUserBrandService mySysUserBrandService;
+
+    @Autowired
+    private ZhiHouseService zhiHouseService;
+
+    @PostMapping("/preDeleteStaff")
+    @RequiresPermissions("sys:user:delete")
+    public Result preDeleteStaff(@RequestParam Long userId,@RequestParam Long deptId) {
+        // 获取直播间绑定信息
+        List<Long> bindUsers = mySysUserBrandService.queryBrandIdList(userId);
+        if (!ObjectUtils.isEmpty(bindUsers)) {
+            // 获取该公司下管理员手机号
+            List<TbUser> userEntities = zhiHouseService.getSysUserListByDeptIds(deptId);
+            List<String> phones = userEntities.stream().filter(user -> !user.getId().equals(userId))
+                    .map(TbUser::getPhone).collect(Collectors.toList());
+            if(ObjectUtils.isEmpty(phones)){
+                return Result.failure("删除失败,公司仅剩一名员工,不可进行删除!");
+            }
+            return Result.success(phones);
+        }
+        return Result.success();
+    }
+
+
+
+}

+ 0 - 32
platform-common/src/main/java/com/platform/dao/SysMenuDao.java

@@ -1,32 +0,0 @@
-package com.platform.dao;
-
-import com.platform.entity.SysMenuEntity;
-
-import java.util.List;
-
-/**
- * 菜单管理
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2016年9月18日 上午9:33:01
- */
-public interface SysMenuDao extends BaseDao<SysMenuEntity> {
-
-    /**
-     * 根据父菜单,查询子菜单
-     *
-     * @param parentId 父菜单ID
-     */
-    List<SysMenuEntity> queryListParentId(Long parentId);
-
-    /**
-     * 获取不包含按钮的菜单列表
-     */
-    List<SysMenuEntity> queryNotButtonList();
-
-    /**
-     * 查询用户的权限列表
-     */
-    List<SysMenuEntity> queryUserList(Long userId);
-}

+ 0 - 37
platform-common/src/main/java/com/platform/dao/SysRoleDao.java

@@ -1,37 +0,0 @@
-package com.platform.dao;
-
-import com.platform.entity.SysRoleEntity;
-import com.platform.entity.UserWindowDto;
-import io.swagger.models.auth.In;
-import org.apache.ibatis.annotations.Param;
-
-import javax.annotation.ParametersAreNonnullByDefault;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 角色管理
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2016年9月18日 上午9:33:33
- */
-public interface SysRoleDao extends BaseDao<SysRoleEntity> {
-
-    /**
-     * 查询用户创建的角色ID列表
-     */
-    List<Long> queryRoleIdList(Long createUserId);
-
-    Integer queryListTotal(Map<String, Object> map);
-
-    List<SysRoleEntity> queryGreaterRoleById(@Param("roleId") Long roleId , @Param("createUserId") Long createUserId);
-
-    /**
-     * 查询角色审批选择范围
-     * @return
-     */
-    List<UserWindowDto> queryPageByDto(UserWindowDto userWindowDto);
-
-    List<SysRoleEntity> queryListByUserId(Long userId);
-}

+ 0 - 30
platform-common/src/main/java/com/platform/dao/SysRoleDeptDao.java

@@ -1,30 +0,0 @@
-package com.platform.dao;
-
-import com.platform.entity.SysRoleDeptEntity;
-import org.apache.ibatis.annotations.Mapper;
-
-import java.util.List;
-
-/**
- * 角色与部门对应关系
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2017年9月18日 上午9:18:38
- */
-@Mapper
-public interface SysRoleDeptDao extends BaseDao<SysRoleDeptEntity> {
-
-    /**
-     * 根据角色ID,获取部门ID列表
-     */
-    List<Long> queryDeptIdList(Long roleId);
-
-    /**
-     * 根据用户ID获取权限部门列表
-     *
-     * @param userId
-     * @return
-     */
-    List<Long> queryDeptIdListByUserId(Long userId);
-}

+ 0 - 20
platform-common/src/main/java/com/platform/dao/SysRoleMenuDao.java

@@ -1,20 +0,0 @@
-package com.platform.dao;
-
-import com.platform.entity.SysRoleMenuEntity;
-
-import java.util.List;
-
-/**
- * 角色与菜单对应关系
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2016年9月18日 上午9:33:46
- */
-public interface SysRoleMenuDao extends BaseDao<SysRoleMenuEntity> {
-
-    /**
-     * 根据角色ID,获取菜单ID列表
-     */
-    List<Long> queryMenuIdList(Long roleId);
-}

+ 0 - 63
platform-common/src/main/java/com/platform/dao/SysUserDao.java

@@ -1,63 +0,0 @@
-package com.platform.dao;
-
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.platform.entity.SysUserEntity;
-import com.platform.entity.UserWindowDto;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * 系统用户
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2016年9月18日 上午9:34:11
- */
-public interface SysUserDao extends BaseDao<SysUserEntity> {
-
-    /**
-     * 查询用户的所有权限
-     *
-     * @param userId 用户ID
-     */
-    List<String> queryAllPerms(Long userId);
-
-    Long getUserNumOfDept(@Param("deptId") Long deptId);
-
-    IPage<SysUserEntity> getBindList(IPage<SysUserEntity> page,
-                                     @Param("ew") QueryWrapper<SysUserEntity> queryWrapper,
-                                     @Param("brandId")long brandId);
-
-
-    IPage<SysUserEntity> getCompanyUserList(IPage<SysUserEntity> page, @Param("ew") QueryWrapper<SysUserEntity> queryWrapper);
-
-    /**
-     * 查询用户的所有菜单ID
-     */
-    List<Long> queryAllMenuId(Long userId);
-
-    /**
-     * 根据用户名,查询系统用户
-     */
-    SysUserEntity queryByUserName(String username);
-
-    SysUserEntity queryByUserMobile(String mobile);
-
-    SysUserEntity queryByMobileAndDeptId(@Param("mobile") String mobile , @Param("deptId") long deptId);
-
-    /**
-     * 修改密码
-     */
-    int updatePassword(Map<String, Object> map);
-    /**
-     * 根据实体类查询
-     * @param userWindowDto
-     * @return
-     */
-    List<UserWindowDto> queryListByBean(UserWindowDto userWindowDto);
-
-    List<SysUserEntity> getSysUserListByDeptIds(@Param("deptList") List<Long> deptList);
-}

+ 0 - 24
platform-common/src/main/java/com/platform/dao/SysUserRoleDao.java

@@ -1,24 +0,0 @@
-package com.platform.dao;
-
-import com.platform.entity.SysUserRoleEntity;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * 用户与角色对应关系
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2016年9月18日 上午9:34:46
- */
-public interface SysUserRoleDao extends BaseDao<SysUserRoleEntity> {
-
-    /**
-     * 根据用户ID,获取角色ID列表
-     */
-    List<Long> queryRoleIdList(Long userId);
-
-    int saveOne(@Param("userId")long userId , @Param("roleId") long roleId);
-
-}

+ 0 - 156
platform-common/src/main/java/com/platform/entity/SysDeptEntity.java

@@ -1,156 +0,0 @@
-package com.platform.entity;
-
-import java.io.Serializable;
-import java.util.Date;
-import java.util.List;
-
-
-/**
- * 部门管理
- *
- * @author liepngjun
- * @email 939961241@qq.com
- * @date 2017-09-17 23:58:47
- */
-public class SysDeptEntity implements Serializable {
-	private static final long serialVersionUID = 1L;
-
-	//部门ID
-	private Long deptId;
-	//上级部门ID,一级部门为0
-	private Long parentId;
-	//部门名称
-	private String name;
-	//上级部门名称
-	private String parentName;
-	//排序
-	private Integer orderNum;
-	//员工数量
-	private Integer staffNum;
-
-	//logo图片地址
-	private String logoUrl;
-
-	//当前员工数量
-	private Integer curStaffNum;
-
-	//过期时间
-	private Date expirationDate;
-	/**
-	 * ztree属性
-	 */
-	private Boolean open;
-
-	private List<?> list;
-
-	//管理员手机号
-	private String managerPhoneNum;
-
-	public String getManagerPhoneNum() {
-		return managerPhoneNum;
-	}
-
-	public void setManagerPhoneNum(String managerPhoneNum) {
-		this.managerPhoneNum = managerPhoneNum;
-	}
-
-	public Integer getCurStaffNum() {
-		return curStaffNum;
-	}
-
-	public void setCurStaffNum(Integer curStaffNum) {
-		this.curStaffNum = curStaffNum;
-	}
-
-	public Integer getStaffNum() {
-		return staffNum;
-	}
-
-	public void setStaffNum(Integer staffNum) {
-		this.staffNum = staffNum;
-	}
-
-	public void setDeptId(Long deptId) {
-		this.deptId = deptId;
-	}
-
-	public Long getDeptId() {
-		return deptId;
-	}
-	/**
-	 * 设置:上级部门ID,一级部门为0
-	 */
-	public void setParentId(Long parentId) {
-		this.parentId = parentId;
-	}
-	/**
-	 * 获取:上级部门ID,一级部门为0
-	 */
-	public Long getParentId() {
-		return parentId;
-	}
-	/**
-	 * 设置:部门名称
-	 */
-	public void setName(String name) {
-		this.name = name;
-	}
-	/**
-	 * 获取:部门名称
-	 */
-	public String getName() {
-		return name;
-	}
-	/**
-	 * 设置:排序
-	 */
-	public void setOrderNum(Integer orderNum) {
-		this.orderNum = orderNum;
-	}
-	/**
-	 * 获取:排序
-	 */
-	public Integer getOrderNum() {
-		return orderNum;
-	}
-
-	public String getParentName() {
-		return parentName;
-	}
-
-	public void setParentName(String parentName) {
-		this.parentName = parentName;
-	}
-
-	public Boolean getOpen() {
-		return open;
-	}
-
-	public void setOpen(Boolean open) {
-		this.open = open;
-	}
-
-	public List<?> getList() {
-		return list;
-	}
-
-	public void setList(List<?> list) {
-		this.list = list;
-	}
-
-	public Date getExpirationDate() {
-		return expirationDate;
-	}
-
-	public void setExpirationDate(Date expirationDate) {
-		this.expirationDate = expirationDate;
-	}
-
-	public String getLogoUrl() {
-		return logoUrl;
-	}
-
-	public void setLogoUrl(String logoUrl) {
-		this.logoUrl = logoUrl;
-	}
-}

+ 0 - 203
platform-common/src/main/java/com/platform/entity/SysMenuEntity.java

@@ -1,203 +0,0 @@
-package com.platform.entity;
-
-
-/**
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2017年6月18日 上午9:26:39
- */
-public class SysMenuEntity extends Tree {
-
-    /**
-     * 菜单ID
-     */
-    private Long menuId;
-
-    /**
-     * 父菜单ID,一级菜单为0
-     */
-    private Long parentId;
-
-    /**
-     * 父菜单名称
-     */
-    private String parentName;
-
-    /**
-     * 菜单名称
-     */
-    private String name;
-
-    /**
-     * 菜单URL
-     */
-    private String url;
-
-    /**
-     * 授权(多个用逗号分隔,如:user:list,user:create)
-     */
-    private String perms;
-
-    /**
-     * 类型     0:目录   1:菜单   2:按钮
-     */
-    private Integer type;
-
-    /**
-     * 菜单图标
-     */
-    private String icon;
-
-    /**
-     * 排序
-     */
-    private Integer orderNum;
-
-    /**
-     * 状态
-     */
-    private Integer status;
-
-    /**
-     * 父级菜单id
-     */
-    private String parentMenu;
-
-    public void setMenuId(Long menuId) {
-        this.menuId = menuId;
-    }
-
-    public Long getMenuId() {
-        return menuId;
-    }
-
-    /**
-     * 设置:父菜单ID,一级菜单为0
-     *
-     * @param parentId 父菜单ID,一级菜单为0
-     */
-    public void setParentId(Long parentId) {
-        this.parentId = parentId;
-    }
-
-    /**
-     * 获取:父菜单ID,一级菜单为0
-     *
-     * @return Long
-     */
-    public Long getParentId() {
-        return parentId;
-    }
-
-    /**
-     * 设置:菜单名称
-     *
-     * @param name 菜单名称
-     */
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    /**
-     * 获取:菜单名称
-     *
-     * @return String
-     */
-    public String getName() {
-        return name;
-    }
-
-    /**
-     * 设置:菜单URL
-     *
-     * @param url 菜单URL
-     */
-    public void setUrl(String url) {
-        this.url = url;
-    }
-
-    /**
-     * 获取:菜单URL
-     *
-     * @return String
-     */
-    public String getUrl() {
-        return url;
-    }
-
-    public String getPerms() {
-        return perms;
-    }
-
-    public void setPerms(String perms) {
-        this.perms = perms;
-    }
-
-    public Integer getType() {
-        return type;
-    }
-
-    public void setType(Integer type) {
-        this.type = type;
-    }
-
-    /**
-     * 设置:菜单图标
-     *
-     * @param icon 菜单图标
-     */
-    public void setIcon(String icon) {
-        this.icon = icon;
-    }
-
-    /**
-     * 获取:菜单图标
-     *
-     * @return String
-     */
-    public String getIcon() {
-        return icon;
-    }
-
-    /**
-     * 设置:排序
-     *
-     * @param orderNum 排序
-     */
-    public void setOrderNum(Integer orderNum) {
-        this.orderNum = orderNum;
-    }
-
-    /**
-     * 获取:排序
-     *
-     * @return Integer
-     */
-    public Integer getOrderNum() {
-        return orderNum;
-    }
-
-    public String getParentName() {
-        return parentName;
-    }
-
-    public void setParentName(String parentName) {
-        this.parentName = parentName;
-    }
-
-    public Integer getStatus() {
-        return status;
-    }
-
-    public void setStatus(Integer status) {
-        this.status = status;
-    }
-
-    public String getParentMenu() {
-        return parentMenu;
-    }
-
-    public void setParentMenu(String parentMenu) {
-        this.parentMenu = parentMenu;
-    }
-}

+ 0 - 82
platform-common/src/main/java/com/platform/entity/SysRoleDeptEntity.java

@@ -1,82 +0,0 @@
-package com.platform.entity;
-
-
-import java.io.Serializable;
-
-/**
- * 角色与部门对应关系
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2017年9月18日 上午9:18:38
- */
-public class SysRoleDeptEntity implements Serializable {
-    private static final long serialVersionUID = 1L;
-
-    private Long id;
-
-    /**
-     * 角色ID
-     */
-    private Long roleId;
-
-    /**
-     * 部门ID
-     */
-    private Long deptId;
-
-    /**
-     * 设置:
-     *
-     * @param id
-     */
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    /**
-     * 获取:
-     *
-     * @return Long
-     */
-    public Long getId() {
-        return id;
-    }
-
-    /**
-     * 设置:角色ID
-     *
-     * @param roleId 角色ID
-     */
-    public void setRoleId(Long roleId) {
-        this.roleId = roleId;
-    }
-
-    /**
-     * 获取:角色ID
-     *
-     * @return Long
-     */
-    public Long getRoleId() {
-        return roleId;
-    }
-
-    /**
-     * 设置:部门ID
-     *
-     * @param deptId 部门ID
-     */
-    public void setDeptId(Long deptId) {
-        this.deptId = deptId;
-    }
-
-    /**
-     * 获取:部门ID
-     *
-     * @return Long
-     */
-    public Long getDeptId() {
-        return deptId;
-    }
-
-}

+ 0 - 82
platform-common/src/main/java/com/platform/entity/SysRoleMenuEntity.java

@@ -1,82 +0,0 @@
-package com.platform.entity;
-
-
-import java.io.Serializable;
-
-/**
- * 角色与菜单对应关系
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2016年9月18日 上午9:28:13
- */
-public class SysRoleMenuEntity implements Serializable {
-    private static final long serialVersionUID = 1L;
-
-    private Long id;
-
-    /**
-     * 角色ID
-     */
-    private Long roleId;
-
-    /**
-     * 菜单ID
-     */
-    private Long menuId;
-
-    /**
-     * 设置:
-     *
-     * @param id
-     */
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    /**
-     * 获取:
-     *
-     * @return Long
-     */
-    public Long getId() {
-        return id;
-    }
-
-    /**
-     * 设置:角色ID
-     *
-     * @param roleId 角色ID
-     */
-    public void setRoleId(Long roleId) {
-        this.roleId = roleId;
-    }
-
-    /**
-     * 获取:角色ID
-     *
-     * @return Long
-     */
-    public Long getRoleId() {
-        return roleId;
-    }
-
-    /**
-     * 设置:菜单ID
-     *
-     * @param menuId 菜单ID
-     */
-    public void setMenuId(Long menuId) {
-        this.menuId = menuId;
-    }
-
-    /**
-     * 获取:菜单ID
-     *
-     * @return Long
-     */
-    public Long getMenuId() {
-        return menuId;
-    }
-
-}

+ 0 - 333
platform-common/src/main/java/com/platform/entity/SysUserEntity.java

@@ -1,333 +0,0 @@
-package com.platform.entity;
-
-import com.platform.validator.group.AddGroup;
-import com.platform.validator.group.UpdateGroup;
-import io.swagger.annotations.ApiModel;
-import org.hibernate.validator.constraints.Email;
-import org.hibernate.validator.constraints.NotBlank;
-
-import java.io.Serializable;
-import java.util.Date;
-import java.util.List;
-
-/**
- * 系统用户
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2016年9月18日 上午9:28:55
- */
-@ApiModel(value="SysUserEntity对象", description="系统用户请求体")
-public class SysUserEntity implements Serializable {
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * 用户ID
-     */
-    private Long userId;
-
-    /**
-     * 用户名
-     */
-    @NotBlank(message = "用户名不能为空", groups = {AddGroup.class, UpdateGroup.class})
-    private String username;
-
-    /**
-     * 密码
-     */
-    private transient String password;
-
-    /**
-     * 邮箱
-     */
-    @Email(message = "邮箱格式不正确", groups = {AddGroup.class, UpdateGroup.class})
-    private String email;
-
-    /**
-     * 手机号
-     */
-    private String mobile;
-
-    /**
-     * 状态  0:禁用   1:正常
-     */
-    private Integer status;
-
-    /**
-     * 角色ID列表
-     */
-    private List<Long> roleIdList;
-
-    /**
-     * 关联的品牌列表
-     */
-    private List<SysUserBrand> brandList;
-
-    /**
-     * 关联的品牌列表
-     */
-    private List<SysRoleEntity> roleList;
-
-    /**
-     * 创建者ID
-     */
-    private Long createUserId;
-
-    /**
-     * 创建时间
-     */
-    private Date createTime;
-
-    private Long deptId;
-
-    /**
-     * 是否是平台主持人
-     */
-    private Boolean isPlatformStreamer;
-
-    /**
-     * 部门名称
-     */
-    private String deptName;
-
-    private String fdkkUser;
-
-    private String fdkkPassword;
-
-    /**
-     * 一起逛权限:1->有权限;0->没有权限
-     */
-    private Integer canShow;
-
-    /**
-     * 角色ID
-     */
-    private Long roleId;
-
-    /**
-     * 角色名称
-     */
-    private String roleName;
-
-    public String getRoleName() {
-        return roleName;
-    }
-
-    public void setRoleName(String roleName) {
-        this.roleName = roleName;
-    }
-
-    public Long getRoleId() {
-        return roleId;
-    }
-
-    public void setRoleId(Long roleId) {
-        this.roleId = roleId;
-    }
-
-    public Integer getCanShow() {
-        return canShow;
-    }
-
-    public void setCanShow(Integer canShow) {
-        this.canShow = canShow;
-    }
-
-    public String getFdkkPassword() {
-        return fdkkPassword;
-    }
-
-    public void setFdkkPassword(String fdkkPassword) {
-        this.fdkkPassword = fdkkPassword;
-    }
-
-    public String getFdkkUser() {
-        return fdkkUser;
-    }
-
-    public void setFdkkUser(String fdkkUser) {
-        this.fdkkUser = fdkkUser;
-    }
-
-    public List<SysRoleEntity> getRoleList() {
-        return roleList;
-    }
-
-    public void setRoleList(List<SysRoleEntity> roleList) {
-        this.roleList = roleList;
-    }
-
-    public List<SysUserBrand> getBrandList() {
-        return brandList;
-    }
-
-    public void setBrandList(List<SysUserBrand> brandList) {
-        this.brandList = brandList;
-    }
-
-    /**
-     * 设置:
-     *
-     * @param userId
-     */
-    public void setUserId(Long userId) {
-        this.userId = userId;
-    }
-
-    /**
-     * 获取:
-     *
-     * @return Long
-     */
-    public Long getUserId() {
-        return userId;
-    }
-
-    /**
-     * 设置:用户名
-     *
-     * @param username 用户名
-     */
-    public void setUsername(String username) {
-        this.username = username;
-    }
-
-    /**
-     * 获取:用户名
-     *
-     * @return String
-     */
-    public String getUsername() {
-        return username;
-    }
-
-    /**
-     * 设置:密码
-     *
-     * @param password 密码
-     */
-    public void setPassword(String password) {
-        this.password = password;
-    }
-
-    /**
-     * 获取:密码
-     *
-     * @return String
-     */
-    public String getPassword() {
-        return password;
-    }
-
-    /**
-     * 设置:邮箱
-     *
-     * @param email 邮箱
-     */
-    public void setEmail(String email) {
-        this.email = email;
-    }
-
-    /**
-     * 获取:邮箱
-     *
-     * @return String
-     */
-    public String getEmail() {
-        return email;
-    }
-
-    /**
-     * 设置:手机号
-     *
-     * @param mobile 手机号
-     */
-    public void setMobile(String mobile) {
-        this.mobile = mobile;
-    }
-
-    /**
-     * 获取:手机号
-     *
-     * @return String
-     */
-    public String getMobile() {
-        return mobile;
-    }
-
-    /**
-     * 设置:状态  0:禁用   1:正常
-     *
-     * @param status 状态  0:禁用   1:正常
-     */
-    public void setStatus(Integer status) {
-        this.status = status;
-    }
-
-    /**
-     * 获取:状态  0:禁用   1:正常
-     *
-     * @return Integer
-     */
-    public Integer getStatus() {
-        return status;
-    }
-
-    /**
-     * 设置:创建时间
-     *
-     * @param createTime 创建时间
-     */
-    public void setCreateTime(Date createTime) {
-        this.createTime = createTime;
-    }
-
-    /**
-     * 获取:创建时间
-     *
-     * @return Date
-     */
-    public Date getCreateTime() {
-        return createTime;
-    }
-
-    public List<Long> getRoleIdList() {
-        return roleIdList;
-    }
-
-    public void setRoleIdList(List<Long> roleIdList) {
-        this.roleIdList = roleIdList;
-    }
-
-    public Long getCreateUserId() {
-        return createUserId;
-    }
-
-    public void setCreateUserId(Long createUserId) {
-        this.createUserId = createUserId;
-    }
-
-    public Long getDeptId() {
-        return deptId;
-    }
-
-    public void setDeptId(Long deptId) {
-        this.deptId = deptId;
-    }
-
-    public String getDeptName() {
-        return deptName;
-    }
-
-    public void setDeptName(String deptName) {
-        this.deptName = deptName;
-    }
-
-    public Boolean getIsPlatformStreamer() {
-        return isPlatformStreamer;
-    }
-
-    public void setIsPlatformStreamer(Boolean platformStreamer) {
-        isPlatformStreamer = platformStreamer;
-    }
-}

+ 0 - 82
platform-common/src/main/java/com/platform/entity/SysUserRoleEntity.java

@@ -1,82 +0,0 @@
-package com.platform.entity;
-
-
-import java.io.Serializable;
-
-/**
- * 用户与角色对应关系
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2016年9月18日 上午9:28:39
- */
-public class SysUserRoleEntity implements Serializable {
-    private static final long serialVersionUID = 1L;
-
-    private Long id;
-
-    /**
-     * 用户ID
-     */
-    private Long userId;
-
-    /**
-     * 角色ID
-     */
-    private Long roleId;
-
-    /**
-     * 设置:
-     *
-     * @param id
-     */
-    public void setId(Long id) {
-        this.id = id;
-    }
-
-    /**
-     * 获取:
-     *
-     * @return Long
-     */
-    public Long getId() {
-        return id;
-    }
-
-    /**
-     * 设置:用户ID
-     *
-     * @param userId 用户ID
-     */
-    public void setUserId(Long userId) {
-        this.userId = userId;
-    }
-
-    /**
-     * 获取:用户ID
-     *
-     * @return Long
-     */
-    public Long getUserId() {
-        return userId;
-    }
-
-    /**
-     * 设置:角色ID
-     *
-     * @param roleId 角色ID
-     */
-    public void setRoleId(Long roleId) {
-        this.roleId = roleId;
-    }
-
-    /**
-     * 获取:角色ID
-     *
-     * @return Long
-     */
-    public Long getRoleId() {
-        return roleId;
-    }
-
-}

+ 4 - 4
platform-common/src/main/java/com/platform/interceptor/LogInterceptor.java

@@ -1,7 +1,7 @@
 package com.platform.interceptor;
 
-import com.platform.entity.SysUserEntity;
 import com.platform.utils.Constant;
+import com.platform.utils.JwtUtil;
 import com.platform.utils.RequestUtil;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -96,9 +96,9 @@ public class LogInterceptor extends HandlerInterceptorAdapter {
 
         String userName = "";
         try {
-            SysUserEntity sysUser = (SysUserEntity) SecurityUtils.getSubject().getSession().getAttribute(Constant.CURRENT_USER);
-            if (sysUser != null) {
-                userName = (sysUser.getUsername());
+            String token = request.getHeader("token");
+            if (token != null) {
+                userName = JwtUtil.parseJWT(token).get("username", String.class);
             }
         } catch (Exception e) {
 

+ 0 - 71
platform-common/src/main/java/com/platform/service/SysMenuService.java

@@ -1,71 +0,0 @@
-package com.platform.service;
-
-import com.platform.entity.SysMenuEntity;
-
-import java.util.List;
-import java.util.Map;
-
-
-/**
- * 菜单管理
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2016年9月18日 上午9:42:16
- */
-public interface SysMenuService {
-
-    /**
-     * 根据父菜单,查询子菜单
-     *
-     * @param parentId   父菜单ID
-     * @param menuIdList 用户菜单ID
-     */
-    List<SysMenuEntity> queryListParentId(Long parentId, List<Long> menuIdList);
-
-    /**
-     * 获取不包含按钮的菜单列表
-     */
-    List<SysMenuEntity> queryNotButtonList();
-
-    /**
-     * 获取用户菜单列表
-     */
-    List<SysMenuEntity> getUserMenuList(Long userId);
-
-
-    /**
-     * 查询菜单
-     */
-    SysMenuEntity queryObject(Long menuId);
-
-    /**
-     * 查询菜单列表
-     */
-    List<SysMenuEntity> queryList(Map<String, Object> map);
-
-    /**
-     * 查询总数
-     */
-    int queryTotal(Map<String, Object> map);
-
-    /**
-     * 保存菜单
-     */
-    void save(SysMenuEntity menu);
-
-    /**
-     * 修改
-     */
-    void update(SysMenuEntity menu);
-
-    /**
-     * 删除
-     */
-    void deleteBatch(Long[] menuIds);
-
-    /**
-     * 查询用户的权限列表
-     */
-    List<SysMenuEntity> queryUserList(Long userId);
-}

+ 0 - 29
platform-common/src/main/java/com/platform/service/SysRoleDeptService.java

@@ -1,29 +0,0 @@
-package com.platform.service;
-
-import java.util.List;
-
-
-/**
- * 角色与部门对应关系
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2017年9月18日 上午9:18:38
- */
-public interface SysRoleDeptService {
-
-    void saveOrUpdate(Long roleId, List<Long> deptIdList);
-
-    /**
-     * 根据角色ID,获取部门ID列表
-     */
-    List<Long> queryDeptIdList(Long roleId);
-
-    /**
-     * 根据用户ID获取权限部门列表
-     *
-     * @param userId
-     * @return
-     */
-    List<Long> queryDeptIdListByUserId(Long userId);
-}

+ 0 - 22
platform-common/src/main/java/com/platform/service/SysRoleMenuService.java

@@ -1,22 +0,0 @@
-package com.platform.service;
-
-import java.util.List;
-
-
-/**
- * 角色与菜单对应关系
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2016年9月18日 上午9:42:30
- */
-public interface SysRoleMenuService {
-
-    void saveOrUpdate(Long roleId, List<Long> menuIdList);
-
-    /**
-     * 根据角色ID,获取菜单ID列表
-     */
-    List<Long> queryMenuIdList(Long roleId);
-
-}

+ 0 - 53
platform-common/src/main/java/com/platform/service/SysRoleService.java

@@ -1,53 +0,0 @@
-package com.platform.service;
-
-import com.platform.entity.SysRoleEntity;
-import com.platform.entity.UserWindowDto;
-import com.platform.page.Page;
-
-import java.util.List;
-import java.util.Map;
-
-
-/**
- * 角色
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2016年9月18日 上午9:42:52
- */
-public interface SysRoleService {
-
-    SysRoleEntity queryObject(Long roleId);
-
-    List<SysRoleEntity> queryList(Map<String, Object> map);
-
-    List<SysRoleEntity> queryGreaterRoleById(long roleId ,long createUserId);
-
-    int queryTotal(Map<String, Object> map);
-
-    int queryListTotal(Map<String, Object> map);
-
-    void save(SysRoleEntity role);
-
-    void update(SysRoleEntity role);
-
-    void deleteBatch(Long[] roleIds);
-
-    /**
-     * 查询用户创建的角色ID列表
-     */
-    List<Long> queryRoleIdList(Long createUserId);
-
-    /**
-     * 分页查询角色审批选择范围
-     * @return
-     */
-    Page<UserWindowDto> queryPageByDto(UserWindowDto userWindowDto, int pageNmu);
-
-    /**
-     * 根据用户id查询角色信息列表
-     * @param userId
-     * @return
-     */
-    List<SysRoleEntity> queryListByUserId(Long userId);
-}

+ 0 - 25
platform-common/src/main/java/com/platform/service/SysUserRoleService.java

@@ -1,25 +0,0 @@
-package com.platform.service;
-
-import java.util.List;
-
-
-/**
- * 用户与角色对应关系
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2016年9月18日 上午9:43:24
- */
-public interface SysUserRoleService {
-
-    int onlySave(long userId , long roleId);
-
-    void saveOrUpdate(Long userId, List<Long> roleIdList);
-
-    /**
-     * 根据用户ID,获取角色ID列表
-     */
-    List<Long> queryRoleIdList(Long userId);
-
-    void delete(Long userId);
-}

+ 0 - 109
platform-common/src/main/java/com/platform/service/SysUserService.java

@@ -1,109 +0,0 @@
-package com.platform.service;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.platform.entity.SysUserEntity;
-import com.platform.entity.UserWindowDto;
-import com.platform.page.Page;
-
-import java.util.List;
-import java.util.Map;
-
-
-/**
- * 系统用户
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2016年9月18日 上午9:43:39
- */
-public interface SysUserService {
-
-    /**
-     * 查询用户的所有权限
-     *
-     * @param userId 用户ID
-     */
-    List<String> queryAllPerms(Long userId);
-
-
-    Long getUserNumOfDept(Long dptId);
-
-    /**
-     * 查询用户的所有菜单ID
-     */
-    List<Long> queryAllMenuId(Long userId);
-
-    IPage<SysUserEntity> getSysUserList(List<Long> deptIdList , String key , long brandId,
-                                        long pageNum , long pageSize);
-
-
-    IPage<SysUserEntity> getCompanyStaffList(String staffName, String deptName,
-                                             long pageNum, long pageSize , Long deptId, boolean excludeSuperAdmin);
-
-    /**
-     * 根据用户名,查询系统用户
-     */
-    SysUserEntity queryByUserName(String username);
-
-    SysUserEntity queryByUserMobile(String mobile);
-
-    SysUserEntity queryByMobileAndDeptId(String mobile , long deptId);
-
-    /**
-     * 根据用户ID,查询用户
-     *
-     * @param userId
-     * @return
-     */
-    SysUserEntity queryObject(Long userId);
-
-    /**
-     * 查询用户列表
-     */
-    List<SysUserEntity> queryList(Map<String, Object> map);
-
-    /**
-     * 查询总数
-     */
-    int queryTotal(Map<String, Object> map);
-
-    /**
-     * 保存用户
-     */
-    void save(SysUserEntity user);
-
-    public void addNewUserWithoutCheck(SysUserEntity user);
-
-    /**
-     * 修改用户
-     */
-    void update(SysUserEntity user);
-
-    void updateOnly(SysUserEntity user);
-
-    int updateUserAndAddDeptAdminRolls(SysUserEntity userEntity);
-
-    /**
-     * 删除用户
-     */
-    void deleteBatch(Long[] userIds);
-
-    /**
-     * 修改密码
-     *
-     * @param userId      用户ID
-     * @param password    原密码
-     * @param newPassword 新密码
-     */
-    void updatePassword(String mobile, String password, String newPassword, String fdkkUser);
-
-    /**
-     * 根据条件分页查询
-     * @param userEntity
-     * @param pageNum
-     * @return
-     */
-    Page<UserWindowDto> findPage(UserWindowDto userEntity, int pageNum);
-
-    public List<SysUserEntity> getSysUserListByDeptIds(List<Long> deptList);
-}

+ 12 - 16
platform-common/src/main/java/com/platform/service/custom/MySysUserBrandService.java

@@ -5,10 +5,8 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.platform.dao.SysUserBrandDao;
 import com.platform.dao.custom.MySysUserBrandDao;
 import com.platform.entity.SysUserBrand;
-import com.platform.entity.SysUserEntity;
 import com.platform.enums.IdStarterEnum;
 import com.platform.service.SysUserBrandService;
-import com.platform.service.SysUserService;
 import com.platform.service.impl.SysUserBrandServiceImpl;
 
 import com.platform.utils.UUidGenerator;
@@ -39,8 +37,6 @@ public class MySysUserBrandService extends SysUserBrandServiceImpl {
     @Autowired
     private MySysUserBrandDao mySysUserBrandDao;
 
-    @Autowired
-    private SysUserService sysUserService;
 
 
     public int addRelation(SysUserBrand sysUserBrand){
@@ -102,18 +98,18 @@ public class MySysUserBrandService extends SysUserBrandServiceImpl {
         return brands;
     }
 
-    public void reBindUser(Long fromUserId,SysUserEntity toUser) {
-        if ( ObjectUtils.isEmpty(fromUserId)) {
-            throw new RuntimeException("参数有误!");
-        }
-
-        UpdateWrapper<SysUserBrand> updateWrapper = new UpdateWrapper<>();
-        updateWrapper.set("user_id",toUser.getUserId());
-        updateWrapper.set("phone_num",toUser.getMobile());
-        updateWrapper.eq("user_id" , fromUserId);
-        updateWrapper.eq("enable" , 1);
-        update(updateWrapper);
-    }
+//    public void reBindUser(Long fromUserId,SysUserEntity toUser) {
+//        if ( ObjectUtils.isEmpty(fromUserId)) {
+//            throw new RuntimeException("参数有误!");
+//        }
+//
+//        UpdateWrapper<SysUserBrand> updateWrapper = new UpdateWrapper<>();
+//        updateWrapper.set("user_id",toUser.getUserId());
+//        updateWrapper.set("phone_num",toUser.getMobile());
+//        updateWrapper.eq("user_id" , fromUserId);
+//        updateWrapper.eq("enable" , 1);
+//        update(updateWrapper);
+//    }
 
     public void deleteByBrandIds(Integer[] ids) {
         QueryWrapper wrapper = new QueryWrapper();

+ 0 - 157
platform-common/src/main/java/com/platform/service/impl/SysMenuServiceImpl.java

@@ -1,157 +0,0 @@
-package com.platform.service.impl;
-
-import com.platform.dao.SysMenuDao;
-import com.platform.entity.SysMenuEntity;
-import com.platform.service.SysMenuService;
-import com.platform.service.SysRoleMenuService;
-import com.platform.service.SysUserService;
-import com.platform.utils.Constant.MenuType;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.*;
-
-
-@Service("sysMenuService")
-public class SysMenuServiceImpl implements SysMenuService {
-	@Autowired
-	private SysMenuDao sysMenuDao;
-	@Autowired
-	private SysUserService sysUserService;
-	@Autowired
-	private SysRoleMenuService sysRoleMenuService;
-	
-	@Override
-	public List<SysMenuEntity> queryListParentId(Long parentId, List<Long> menuIdList) {
-		List<SysMenuEntity> menuList = sysMenuDao.queryListParentId(parentId);
-		if(menuIdList == null){
-			return menuList;
-		}
-		
-		List<SysMenuEntity> userMenuList = new ArrayList<>();
-		for(SysMenuEntity menu : menuList){
-			if(menuIdList.contains(menu.getMenuId())){
-				userMenuList.add(menu);
-			}
-		}
-		return userMenuList;
-	}
-
-	@Override
-	public List<SysMenuEntity> queryNotButtonList() {
-		return sysMenuDao.queryNotButtonList();
-	}
-
-	@Override
-	public List<SysMenuEntity> getUserMenuList(Long userId) {
-		//系统管理员,拥有最高权限
-		if(userId == 1){
-			return getAllMenuList(null);
-		}
-		
-		//用户菜单列表
-		List<Long> menuIdList = sysUserService.queryAllMenuId(userId);
-		return getAllMenuList(menuIdList);
-	}
-	
-	@Override
-	public SysMenuEntity queryObject(Long menuId) {
-		return sysMenuDao.queryObject(menuId);
-	}
-
-	@Override
-	public List<SysMenuEntity> queryList(Map<String, Object> map) {
-		List<SysMenuEntity> sysMenuEntities = sysMenuDao.queryList(map);
-		sysMenuEntities.sort(Comparator.comparing(SysMenuEntity::getType));
-
-		List<SysMenuEntity> newMenu = new ArrayList<>();
-		HashMap<Long,SysMenuEntity> oneMenu = new HashMap<>();
-		HashMap<Long,SysMenuEntity> towMenu = new HashMap<>();
-		for (SysMenuEntity sysMenuEntity : sysMenuEntities) {
-			if(sysMenuEntity.getType() == 0 || sysMenuEntity.getParentId() == 0){
-				oneMenu.put(sysMenuEntity.getMenuId(),sysMenuEntity);
-			}else if(sysMenuEntity.getType() == 1) {
-				sysMenuEntity.setParentMenu(sysMenuEntity.getParentId().toString());
-				towMenu.put(sysMenuEntity.getMenuId(),sysMenuEntity);
-			}else if(sysMenuEntity.getType() == 2){
-				SysMenuEntity sysMenuEntity1 = towMenu.get(sysMenuEntity.getParentId());
-				sysMenuEntity.setParentMenu(sysMenuEntity1.getParentId().toString()+"-"+sysMenuEntity.getParentId().toString());
-				List list = sysMenuEntity1.getChildren();
-				if(list == null){
-					list = new ArrayList();
-				}
-				list.add(sysMenuEntity);
-				sysMenuEntity1.setChildren(list);
-
-			}
-		}
-		for (Long id : towMenu.keySet()) {
-			SysMenuEntity sysMenuEntity = towMenu.get(id);
-			List children = oneMenu.get(sysMenuEntity.getParentId()).getChildren();
-			if(children == null){
-				children = new ArrayList();
-			}
-			children.add(sysMenuEntity);
-			oneMenu.get(sysMenuEntity.getParentId()).setChildren(children);
-		}
-		for (Long id : oneMenu.keySet()) {
-			newMenu.add(oneMenu.get(id));
-		}
-		return newMenu;
-	}
-
-	@Override
-	public int queryTotal(Map<String, Object> map) {
-		return sysMenuDao.queryTotal(map);
-	}
-
-	@Override
-	public void save(SysMenuEntity menu) {
-		sysMenuDao.save(menu);
-	}
-
-	@Override
-	public void update(SysMenuEntity menu) {
-		sysMenuDao.update(menu);
-	}
-
-	@Override
-	@Transactional
-	public void deleteBatch(Long[] menuIds) {
-		sysMenuDao.deleteBatch(menuIds);
-	}
-	
-	@Override
-	public List<SysMenuEntity> queryUserList(Long userId) {
-		return sysMenuDao.queryUserList(userId);
-	}
-
-	/**
-	 * 获取所有菜单列表
-	 */
-	private List<SysMenuEntity> getAllMenuList(List<Long> menuIdList){
-		//查询根菜单列表
-		List<SysMenuEntity> menuList = queryListParentId(0L, menuIdList);
-		//递归获取子菜单
-		getMenuTreeList(menuList, menuIdList);
-		
-		return menuList;
-	}
-
-	/**
-	 * 递归
-	 */
-	private List<SysMenuEntity> getMenuTreeList(List<SysMenuEntity> menuList, List<Long> menuIdList){
-		List<SysMenuEntity> subMenuList = new ArrayList<SysMenuEntity>();
-		
-		for(SysMenuEntity entity : menuList){
-			if(entity.getType() == MenuType.CATALOG.getValue()){//目录
-				entity.setList(getMenuTreeList(queryListParentId(entity.getMenuId(), menuIdList), menuIdList));
-			}
-			subMenuList.add(entity);
-		}
-		
-		return subMenuList;
-	}
-}

+ 0 - 52
platform-common/src/main/java/com/platform/service/impl/SysRoleDeptServiceImpl.java

@@ -1,52 +0,0 @@
-package com.platform.service.impl;
-
-import com.platform.dao.SysRoleDeptDao;
-import com.platform.service.SysRoleDeptService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-
-/**
- * 角色与部门对应关系
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2017年9月18日 上午9:18:38
- */
-@Service("sysRoleDeptService")
-public class SysRoleDeptServiceImpl implements SysRoleDeptService {
-    @Autowired
-    private SysRoleDeptDao sysRoleDeptDao;
-
-    @Override
-    @Transactional
-    public void saveOrUpdate(Long roleId, List<Long> deptIdList) {
-        //先删除角色与菜单关系
-        sysRoleDeptDao.delete(roleId);
-
-        if (deptIdList.size() == 0) {
-            return;
-        }
-
-        //保存角色与菜单关系
-        Map<String, Object> map = new HashMap<>();
-        map.put("roleId", roleId);
-        map.put("deptIdList", deptIdList);
-        sysRoleDeptDao.save(map);
-    }
-
-    @Override
-    public List<Long> queryDeptIdList(Long roleId) {
-        return sysRoleDeptDao.queryDeptIdList(roleId);
-    }
-
-    @Override
-    public List<Long> queryDeptIdListByUserId(Long userId) {
-        return sysRoleDeptDao.queryDeptIdListByUserId(userId);
-    }
-}

+ 0 - 47
platform-common/src/main/java/com/platform/service/impl/SysRoleMenuServiceImpl.java

@@ -1,47 +0,0 @@
-package com.platform.service.impl;
-
-import com.platform.dao.SysRoleMenuDao;
-import com.platform.service.SysRoleMenuService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-
-/**
- * 角色与菜单对应关系
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2016年9月18日 上午9:44:35
- */
-@Service("sysRoleMenuService")
-public class SysRoleMenuServiceImpl implements SysRoleMenuService {
-    @Autowired
-    private SysRoleMenuDao sysRoleMenuDao;
-
-    @Override
-    @Transactional
-    public void saveOrUpdate(Long roleId, List<Long> menuIdList) {
-        if (menuIdList.size() == 0) {
-            return;
-        }
-        //先删除角色与菜单关系
-        sysRoleMenuDao.delete(roleId);
-
-        //保存角色与菜单关系
-        Map<String, Object> map = new HashMap<>();
-        map.put("roleId", roleId);
-        map.put("menuIdList", menuIdList);
-        sysRoleMenuDao.save(map);
-    }
-
-    @Override
-    public List<Long> queryMenuIdList(Long roleId) {
-        return sysRoleMenuDao.queryMenuIdList(roleId);
-    }
-
-}

+ 0 - 136
platform-common/src/main/java/com/platform/service/impl/SysRoleServiceImpl.java

@@ -1,136 +0,0 @@
-package com.platform.service.impl;
-
-import com.platform.dao.SysRoleDao;
-import com.platform.entity.SysRoleEntity;
-import com.platform.entity.UserWindowDto;
-import com.platform.page.Page;
-import com.platform.page.PageHelper;
-import com.platform.service.SysRoleDeptService;
-import com.platform.service.SysRoleMenuService;
-import com.platform.service.SysRoleService;
-import com.platform.service.SysUserService;
-import com.platform.utils.Constant;
-import com.platform.utils.RRException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-
-/**
- * 角色
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2016年9月18日 上午9:45:12
- */
-@Service("sysRoleService")
-public class SysRoleServiceImpl implements SysRoleService {
-    @Autowired
-    private SysRoleDao sysRoleDao;
-    @Autowired
-    private SysRoleMenuService sysRoleMenuService;
-    @Autowired
-    private SysUserService sysUserService;
-    @Autowired
-    private SysRoleDeptService sysRoleDeptService;
-
-    @Override
-    public int queryListTotal(Map<String, Object> map) {
-        return sysRoleDao.queryListTotal(map);
-    }
-
-    @Override
-    public List<SysRoleEntity> queryGreaterRoleById(long roleId ,long createUserId) {
-        return sysRoleDao.queryGreaterRoleById(roleId , createUserId);
-    }
-
-    @Override
-    public SysRoleEntity queryObject(Long roleId) {
-        return sysRoleDao.queryObject(roleId);
-    }
-
-    @Override
-    public List<SysRoleEntity> queryList(Map<String, Object> map) {
-        return sysRoleDao.queryList(map);
-    }
-
-    @Override
-    public int queryTotal(Map<String, Object> map) {
-        return sysRoleDao.queryTotal(map);
-    }
-
-    @Override
-    @Transactional
-    public void save(SysRoleEntity role) {
-        role.setCreateTime(new Date());
-        sysRoleDao.save(role);
-
-        //检查权限是否越权
-        checkPrems(role);
-
-        //保存角色与菜单关系
-        sysRoleMenuService.saveOrUpdate(role.getRoleId(), role.getMenuIdList());
-
-        //保存角色与部门关系
-        sysRoleDeptService.saveOrUpdate(role.getRoleId(), role.getDeptIdList());
-    }
-
-    @Override
-    @Transactional
-    public void update(SysRoleEntity role) {
-        sysRoleDao.update(role);
-
-        //检查权限是否越权
-        checkPrems(role);
-
-        //更新角色与菜单关系
-        sysRoleMenuService.saveOrUpdate(role.getRoleId(), role.getMenuIdList());
-        //保存角色与部门关系
-        sysRoleDeptService.saveOrUpdate(role.getRoleId(), role.getDeptIdList());
-    }
-
-    @Override
-    @Transactional
-    public void deleteBatch(Long[] roleIds) {
-        sysRoleDao.deleteBatch(roleIds);
-    }
-
-    @Override
-    public List<Long> queryRoleIdList(Long createUserId) {
-        return sysRoleDao.queryRoleIdList(createUserId);
-    }
-
-    @Override
-    public List<SysRoleEntity> queryListByUserId(Long userId) {
-        return sysRoleDao.queryListByUserId(userId);
-    }
-
-    /**
-     * 检查权限是否越权
-     */
-    private void checkPrems(SysRoleEntity role) {
-        //如果不是超级管理员,则需要判断角色的权限是否超过自己的权限
-        if (role.getCreateUserId() == Constant.SUPER_ADMIN) {
-            return;
-        }
-
-        //查询用户所拥有的菜单列表
-        List<Long> menuIdList = sysUserService.queryAllMenuId(role.getCreateUserId());
-
-        //判断是否越权
-        if (!menuIdList.containsAll(role.getMenuIdList())) {
-            throw new RRException("新增角色的权限,已超出你的权限范围");
-        }
-    }
-
-    @Override
-    public Page<UserWindowDto> queryPageByDto(UserWindowDto userWindowDto, int pageNum) {
-        PageHelper.startPage(pageNum, Constant.pageSize);
-        sysRoleDao.queryPageByDto(userWindowDto);
-        return PageHelper.endPage();
-    }
-}

+ 0 - 57
platform-common/src/main/java/com/platform/service/impl/SysUserRoleServiceImpl.java

@@ -1,57 +0,0 @@
-package com.platform.service.impl;
-
-import com.platform.dao.SysUserRoleDao;
-import com.platform.service.SysUserRoleService;
-import org.apache.commons.collections.CollectionUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-
-/**
- * 用户与角色对应关系
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2016年9月18日 上午9:45:48
- */
-@Service("sysUserRoleService")
-public class SysUserRoleServiceImpl implements SysUserRoleService {
-    @Autowired
-    private SysUserRoleDao sysUserRoleDao;
-
-
-    @Override
-    public int onlySave(long userId, long roleId) {
-        return sysUserRoleDao.saveOne(userId , roleId);
-    }
-
-    @Override
-    public void saveOrUpdate(Long userId, List<Long> roleIdList) {
-        if (CollectionUtils.isEmpty(roleIdList)) {
-            return;
-        }
-
-        //先删除用户与角色关系
-        sysUserRoleDao.delete(userId);
-
-        //保存用户与角色关系
-        Map<String, Object> map = new HashMap<>();
-        map.put("userId", userId);
-        map.put("roleIdList", roleIdList);
-        sysUserRoleDao.save(map);
-    }
-
-    @Override
-    public List<Long> queryRoleIdList(Long userId) {
-        return sysUserRoleDao.queryRoleIdList(userId);
-    }
-
-    @Override
-    public void delete(Long userId) {
-        sysUserRoleDao.delete(userId);
-    }
-}

+ 0 - 339
platform-common/src/main/java/com/platform/service/impl/SysUserServiceImpl.java

@@ -1,339 +0,0 @@
-package com.platform.service.impl;
-
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.platform.dao.SysUserDao;
-import com.platform.entity.Result;
-import com.platform.entity.SysRoleEntity;
-import com.platform.entity.SysUserEntity;
-import com.platform.entity.UserWindowDto;
-import com.platform.enums.ResultCodeEnum;
-import com.platform.enums.SysRoleEnum;
-import com.platform.exception.CommonBaseException;
-import com.platform.page.Page;
-import com.platform.page.PageHelper;
-import com.platform.service.SysRoleService;
-import com.platform.service.SysUserRoleService;
-import com.platform.service.SysUserService;
-import com.platform.utils.Base64Converter;
-import com.platform.utils.Constant;
-import com.platform.utils.RRException;
-import com.platform.utils.ShiroUtils;
-import com.platform.vos.CurrentUserLoginVo;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang.StringUtils;
-import org.apache.shiro.crypto.hash.Sha256Hash;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-import org.springframework.util.ObjectUtils;
-
-import java.util.*;
-
-
-/**
- * 系统用户
- *
- * @author 李鹏军
- * @email 939961241@qq.com
- * @date 2016年12月18日 上午9:46:09
- */
-@Service("sysUserService")
-@Slf4j
-public class SysUserServiceImpl implements SysUserService {
-
-    @Autowired
-    private SysUserDao sysUserDao;
-    @Autowired
-    private SysUserRoleService sysUserRoleService;
-    @Autowired
-    private SysRoleService sysRoleService;
-
-    @Autowired
-    private ZhiHouseService zhiHouseService;
-
-    @Autowired
-    private FdkkService fdkkService;
-
-
-    @Override
-    public Long getUserNumOfDept(Long dptId) {
-        return sysUserDao.getUserNumOfDept(dptId);
-    }
-
-    @Override
-    public IPage<SysUserEntity> getCompanyStaffList(String staffName, String deptName,
-                                                    long pageNum, long pageSize , Long deptId , boolean excludeSuperAdmin) {
-        IPage<SysUserEntity> page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(pageNum , pageSize);
-        QueryWrapper<SysUserEntity> queryWrapper = new QueryWrapper<>();
-        if(excludeSuperAdmin){
-            //不捞取超级管理员
-            queryWrapper.ne("role.role_id" , 5);
-        }
-        if(StringUtils.isNotBlank(staffName)){
-            queryWrapper.like("sysUser.username" , staffName);
-        }
-        if(StringUtils.isNotBlank(deptName)){
-            queryWrapper.like("dept.name" , deptName);
-        }
-        if(null != deptId){
-            //只有非超级管理员才会上送deptId,用于过滤本公司的部门数据
-            queryWrapper.eq("sysUser.dept_id" , deptId);
-        }
-        queryWrapper.orderByDesc("sysUser.create_time");
-
-        return sysUserDao.getCompanyUserList(page , queryWrapper);
-    }
-
-    @Override
-    public List<String> queryAllPerms(Long userId) {
-        return sysUserDao.queryAllPerms(userId);
-    }
-
-    @Override
-    public List<Long> queryAllMenuId(Long userId) {
-        return sysUserDao.queryAllMenuId(userId);
-    }
-
-    @Override
-    public IPage<SysUserEntity> getSysUserList(List<Long> deptIdList , String key , long brandId , long pageNum, long pageSize) {
-
-        QueryWrapper<SysUserEntity> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("sysUser.status" , 1);
-        if(!CollectionUtils.isEmpty(deptIdList)){
-            queryWrapper.and(wrapper->wrapper.in("sysUser.dept_id" , deptIdList).or().eq("sysUser.is_platform_streamer",true));
-        }
-        if(StringUtils.isNotBlank(key)){
-            queryWrapper.like("sysUser.username" , key);
-        }
-        IPage<SysUserEntity> page = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(pageNum , pageSize);
-        return sysUserDao.getBindList(page , queryWrapper,brandId);
-    }
-
-
-    @Override
-    public SysUserEntity queryByMobileAndDeptId(String mobile, long deptId) {
-        return sysUserDao.queryByMobileAndDeptId(mobile , deptId);
-    }
-
-    @Override
-    public SysUserEntity queryByUserMobile(String mobile) {
-        return sysUserDao.queryByUserMobile(mobile);
-    }
-
-    @Override
-    public SysUserEntity queryByUserName(String username) {
-        return sysUserDao.queryByUserName(username);
-    }
-
-    @Override
-    public SysUserEntity queryObject(Long userId) {
-        return sysUserDao.queryObject(userId);
-    }
-
-    @Override
-    public List<SysUserEntity> queryList(Map<String, Object> map) {
-        return sysUserDao.queryList(map);
-    }
-
-    @Override
-    public int queryTotal(Map<String, Object> map) {
-        return sysUserDao.queryTotal(map);
-    }
-
-    @Override
-    //@Transactional(isolation = Isolation.READ_COMMITTED)
-    @Transactional
-    public void save(SysUserEntity user) {
-        //检查角色是否越权
-        checkRole(user);
-
-        user.setCreateTime(new Date());
-        //sha256加密
-        user.setPassword(new Sha256Hash(Constant.DEFAULT_PASS_WORD).toHex());
-        sysUserDao.save(user);
-
-        //保存用户与角色关系
-        sysUserRoleService.saveOrUpdate(user.getUserId(), user.getRoleIdList());
-
-        //保存用户与品牌关系
-//        sysUserBrandService.saveOrUpdate(user.getUserId(), user.getBrandIdList());
-    }
-
-    @Override
-    @Transactional
-    public void addNewUserWithoutCheck(SysUserEntity user) {
-        user.setCreateTime(new Date());
-        int insert = sysUserDao.save(user);
-        if(insert !=  1){
-            log.error("新增系统管理员[{}]失败" , user.getUsername());
-        }
-    }
-
-
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public int updateUserAndAddDeptAdminRolls(SysUserEntity userEntity) {
-        if(null == userEntity){
-            return -1;
-        }
-        int update = sysUserDao.update(userEntity);
-        if(update != 1){
-            log.error("更新用户数据(部门id)失败");
-            throw new CommonBaseException(ResultCodeEnum.D101 , "更新用户数据失败");
-        }
-
-        //默认开通公司管理员的权限
-        int insert = sysUserRoleService.onlySave(userEntity.getUserId(), 7L);
-        if(insert != 1){
-            log.error("给用户[{}]开通普通管理员角色失败" , userEntity.getMobile());
-            throw new CommonBaseException(ResultCodeEnum.D101 , "新增普通管理员权限失败");
-        }
-        return 1;
-    }
-
-
-    @Override
-    public void updateOnly(SysUserEntity user) {
-        sysUserDao.update(user);
-    }
-
-    @Override
-    @Transactional
-    public void update(SysUserEntity user) {
-        if(ObjectUtils.isEmpty(user.getUserId())){
-            throw new CommonBaseException(500,"id 为空!");
-        }
-        if(user.getRoleIdList().contains(SysRoleEnum.PLATFORM_STREAMER.getCode())){
-            user.setIsPlatformStreamer(true);
-            user.setRoleIdList(Collections.singletonList(8L));
-        }else{
-            user.setIsPlatformStreamer(false);
-        }
-        SysUserEntity userEntity = queryObject(user.getUserId());
-        //检查角色是否越权
-        checkRole(user);
-
-        if (StringUtils.isBlank(user.getPassword())) {
-            user.setPassword(new Sha256Hash(Constant.DEFAULT_PASS_WORD).toHex());
-        } else {
-            user.setPassword(new Sha256Hash(user.getPassword()).toHex());
-        }
-
-        sysUserDao.update(user);
-
-        //保存用户与角色关系
-        sysUserRoleService.saveOrUpdate(user.getUserId(), user.getRoleIdList());
-    }
-
-    @Override
-    @Transactional
-    public void deleteBatch(Long[] userId) {
-        sysUserDao.deleteBatch(userId);
-    }
-
-    @Override
-    public void updatePassword(String mobile,String password, String fdkkPassword, String fdkkUser) {
-        CurrentUserLoginVo userEntity = ShiroUtils.getUserEntity();
-        ResponseEntity<String> loginResult;
-        if(!ObjectUtils.isEmpty(password)){
-            // 对指房宝密码解密
-            password = Base64Converter.decode(Base64Converter.subText(password));
-            // 登录指房宝进行当前密码校验
-            loginResult = zhiHouseService.login(mobile, password);
-            if(loginResult.getStatusCode()!= HttpStatus.OK){
-                throw new CommonBaseException(500,"请求失败");
-            }
-        }
-        if(!ObjectUtils.isEmpty(fdkkPassword)){
-            // 对4d看看密码解密
-            String decryptFdkkPassword = Base64Converter.decode(Base64Converter.subText(fdkkPassword));
-            // 登录4dkankan
-            loginResult = fdkkService.login(fdkkUser,decryptFdkkPassword);
-            if(loginResult.getStatusCode()!= HttpStatus.OK){
-                throw new CommonBaseException(500,"请求失败");
-            }
-            JSONObject result = JSONObject.parseObject(loginResult.getBody());
-            if (result.getInteger("code") == 3015) {
-                throw new CommonBaseException(500, "此账号未注册,请先注册后再绑定。");
-            }
-            if(result.getInteger("code") == 3014){
-                throw new CommonBaseException(500, "四维看看账号密码有误,请重新输入。");
-            }
-            if (result.getInteger("code") != Result.CODE_SUCCESS) {
-                throw new CommonBaseException(500, "请求失败,请重试");
-            }
-        }
-        Map<String, Object> map = new HashMap<>();
-        map.put("userId", userEntity.getUserId());
-        if(!ObjectUtils.isEmpty(fdkkPassword)){
-            map.put("fdkkUser", fdkkUser);
-            map.put("fdkkPassword", fdkkPassword);
-        }
-        sysUserDao.updatePassword(map);
-    }
-
-    /**
-     * 检查角色是否越权
-     */
-    private void checkRole(SysUserEntity user) {
-        //如果不是超级管理员,则需要判断用户的角色是否自己创建
-        if (user.getCreateUserId() == Constant.SUPER_ADMIN || CollectionUtils.isEmpty(user.getRoleIdList())) {
-            return;
-        }
-        List<Long> roleIdList = new ArrayList<>();
-       /*         //查询用户创建者[user.getCreateUserId()]所有创建的角色列表
-        List<Long> roleIdList = sysRoleService.queryRoleIdList(user.getCreateUserId());
-
-        //再带上创建者自己当前的角色
-        List<Long> curRoleList = sysUserRoleService.queryRoleIdList(user.getCreateUserId());
-        if(!CollectionUtils.isEmpty(curRoleList)){
-            roleIdList.addAll(curRoleList);
-        }*/
-        //这里还需要获取role_id大于最高权限的所有role_id
-        List<Long> roleList = sysUserRoleService.queryRoleIdList(user.getCreateUserId());
-        long cur = 10000000L;
-        for(Long roleId : roleList){
-            if(null == roleId){
-                continue;
-            }
-            if(roleId.compareTo(cur) < 0){
-                cur = roleId;
-            }
-        }
-        if(cur == 10000000L){
-            return;
-        }
-        //这里获取系统默认以及个人账户创建的角色列表
-        List<SysRoleEntity> sysRoleEntityList= sysRoleService.queryGreaterRoleById(cur , user.getCreateUserId());
-        if(!CollectionUtils.isEmpty(sysRoleEntityList)){
-            for (SysRoleEntity entity : sysRoleEntityList){
-                roleIdList.add(entity.getRoleId());
-            }
-        }
-        //判断是否越权
-        if (!roleIdList.containsAll(user.getRoleIdList())) {
-            throw new RRException("创建者无权限创建此角色的员工");
-        }
-    }
-
-
-    @Override
-    public Page<UserWindowDto> findPage(UserWindowDto userWindowDto, int pageNum) {
-        PageHelper.startPage(pageNum, Constant.pageSize);
-        sysUserDao.queryListByBean(userWindowDto);
-        return PageHelper.endPage();
-    }
-
-    @Override
-    public List<SysUserEntity> getSysUserListByDeptIds(List<Long> deptList) {
-        if(ObjectUtils.isEmpty(deptList)){
-            return new ArrayList<>();
-        }
-        return sysUserDao.getSysUserListByDeptIds(deptList);
-    }
-}

+ 76 - 3
platform-common/src/main/java/com/platform/service/impl/ZhiHouseService.java

@@ -1,11 +1,10 @@
 package com.platform.service.impl;
 
 import com.alibaba.fastjson.JSONObject;
+import com.google.gson.JsonObject;
 import com.platform.enums.ResultCodeEnum;
 import com.platform.exception.CommonBaseException;
-import com.platform.vos.RequestScene;
-import com.platform.vos.ReturnDTO;
-import com.platform.vos.ZhiHouseUserLoginVo;
+import com.platform.vos.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpEntity;
@@ -206,4 +205,78 @@ public class ZhiHouseService {
         //把信息封装为json
         return JSONObject.parseObject(JSONObject.toJSONString(responseEntity.getBody().getMessage()));
     }
+
+    public List<TbUser> getSysUserListByDeptIds(Long deptId) {
+        Map<String, Object> mp = new HashMap<>();
+        mp.put("deptId", deptId);
+        String url = zhiHouseHost + "api/shop/getUserByDeptId";
+        ResponseEntity<ReturnDTO>  responseEntity = restTemplate.postForEntity(url, mp,ReturnDTO.class);
+        if(responseEntity.getStatusCode()!= HttpStatus.OK){
+            throw new CommonBaseException(ResultCodeEnum.D100);
+        }
+        if (responseEntity.getBody().getCode() != 200) {
+            throw new CommonBaseException(ResultCodeEnum.D100,responseEntity.getBody().getError());
+        }
+        List<TbUser> message = (List<TbUser>) responseEntity.getBody().getMessage();
+        return message;
+    }
+
+    public TbUser queryByUserMobile(String phone) {
+        Map<String, Object> mp = new HashMap<>();
+        mp.put("phone", phone);
+        String url = zhiHouseHost + "api/shop/queryByUserMobile";
+        ResponseEntity<ReturnDTO>  responseEntity = restTemplate.postForEntity(url, mp,ReturnDTO.class);
+        if(responseEntity.getStatusCode()!= HttpStatus.OK){
+            throw new CommonBaseException(ResultCodeEnum.D100);
+        }
+        if (responseEntity.getBody().getCode() != 200) {
+            throw new CommonBaseException(ResultCodeEnum.D100,responseEntity.getBody().getError());
+        }
+        TbUser tbUser = (TbUser) responseEntity.getBody().getMessage();
+        return tbUser;
+    }
+
+    public TbUser getByUserId(Long userId) {
+        Map<String, Object> mp = new HashMap<>();
+        mp.put("userId", userId);
+        String url = zhiHouseHost + "api/shop/getByUserId";
+        ResponseEntity<ReturnDTO>  responseEntity = restTemplate.postForEntity(url, mp,ReturnDTO.class);
+        if(responseEntity.getStatusCode()!= HttpStatus.OK){
+            throw new CommonBaseException(ResultCodeEnum.D100);
+        }
+        if (responseEntity.getBody().getCode() != 200) {
+            throw new CommonBaseException(ResultCodeEnum.D100,responseEntity.getBody().getError());
+        }
+        TbUser tbUser =  JSONObject.parseObject(JSONObject.toJSONString(responseEntity.getBody().getMessage()),TbUser.class);
+        return tbUser;
+    }
+
+    public List<Long> queryDeptIdListByUserId(Long userId) {
+        Map<String, Object> mp = new HashMap<>();
+        mp.put("userId", userId);
+        String url = zhiHouseHost + "api/shop/queryDeptIdListByUserId";
+        ResponseEntity<ReturnDTO>  responseEntity = restTemplate.postForEntity(url, mp,ReturnDTO.class);
+        if(responseEntity.getStatusCode()!= HttpStatus.OK){
+            throw new CommonBaseException(ResultCodeEnum.D100);
+        }
+        if (responseEntity.getBody().getCode() != 200) {
+            throw new CommonBaseException(ResultCodeEnum.D100,responseEntity.getBody().getError());
+        }
+        List<Long> longs = (List) responseEntity.getBody().getMessage();
+        return longs;
+    }
+
+    public CurrentUserLoginVo getCurrentUser() {
+        Map<String, Object> mp = new HashMap<>();
+        String url = zhiHouseHost + "api/shop/getCurrentUser";
+        ResponseEntity<ReturnDTO>  responseEntity = restTemplate.postForEntity(url, mp,ReturnDTO.class);
+        if(responseEntity.getStatusCode()!= HttpStatus.OK){
+            throw new CommonBaseException(ResultCodeEnum.D100);
+        }
+        if (responseEntity.getBody().getCode() != 200) {
+            throw new CommonBaseException(ResultCodeEnum.D100,responseEntity.getBody().getError());
+        }
+        CurrentUserLoginVo user = (CurrentUserLoginVo) responseEntity.getBody().getMessage();
+        return user;
+    }
 }

+ 42 - 76
platform-common/src/main/java/com/platform/shiro/UserRealm.java

@@ -3,16 +3,12 @@ package com.platform.shiro;
 import com.auth0.jwt.JWT;
 import com.alibaba.fastjson.JSONObject;
 import com.platform.cache.J2CacheUtils;
-import com.platform.dao.SysMenuDao;
-import com.platform.dao.SysUserDao;
-import com.platform.dao.SysUserRoleDao;
-import com.platform.entity.SysMenuEntity;
-import com.platform.entity.SysUserEntity;
 import com.platform.shiro.jwt.JwtToken;
 import com.platform.service.impl.ZhiHouseService;
 import com.platform.utils.Constant;
 import com.platform.utils.JwtUtil;
 import com.platform.vos.CurrentUserLoginVo;
+import com.platform.vos.TbUser;
 import io.jsonwebtoken.Claims;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
@@ -38,13 +34,6 @@ import java.util.*;
  */
 @Slf4j
 public class UserRealm extends AuthorizingRealm {
-    @Autowired
-    private SysUserDao sysUserDao;
-    @Autowired
-    private SysMenuDao sysMenuDao;
-
-    @Autowired
-    private SysUserRoleDao sysUserRoleDao;
 
     @Autowired
     private ZhiHouseService zhiHouseService;
@@ -60,37 +49,41 @@ public class UserRealm extends AuthorizingRealm {
      */
     @Override
     protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
-
-//        Claims claims = JwtUtil.parseJWT(principals.toString());
-//        Long userId = Long.valueOf(claims.get("id", String.class));
-
-      SysUserEntity user = (SysUserEntity) principals.getPrimaryPrincipal();
-
-        List<String> permsList;
-
-        //系统管理员,拥有最高权限
-        if (user.getUserId() == Constant.SUPER_ADMIN) {
-            List<SysMenuEntity> menuList = sysMenuDao.queryList(new HashMap<>());
-            permsList = new ArrayList<>(menuList.size());
-            for (SysMenuEntity menu : menuList) {
-                permsList.add(menu.getPerms());
-            }
-        } else {
-            permsList = sysUserDao.queryAllPerms(user.getUserId());
-        }
-        //用户权限列表
-        Set<String> permsSet = new HashSet<String>();
-        if (permsList != null && permsList.size() != 0) {
-            for (String perms : permsList) {
-                if (StringUtils.isBlank(perms)) {
-                    continue;
-                }
-                permsSet.addAll(Arrays.asList(perms.trim().split(",")));
-            }
-        }
+//        SysUserEntity user = (SysUserEntity) principals.getPrimaryPrincipal();
+//        Long userId = user.getUserId();
+//
+////        Claims claims = JwtUtil.parseJWT(principals.toString());
+////        Long userId = Long.valueOf(claims.get("id", String.class));
+//
+//        SysUserEntity user = (SysUserEntity) principals.getPrimaryPrincipal();
+//
+//        List<String> permsList;
+//
+//        //系统管理员,拥有最高权限
+//        if (userId == Constant.SUPER_ADMIN) {
+//            if (user.getUserId() == Constant.SUPER_ADMIN) {
+//                List<SysMenuEntity> menuList = sysMenuDao.queryList(new HashMap<>());
+//                permsList = new ArrayList<>(menuList.size());
+//                for (SysMenuEntity menu : menuList) {
+//                    permsList.add(menu.getPerms());
+//                }
+//            } else {
+//                permsList = sysUserDao.queryAllPerms(userId);
+//                permsList = sysUserDao.queryAllPerms(user.getUserId());
+//            }
+//            //用户权限列表
+//            Set<String> permsSet = new HashSet<String>();
+//            if (permsList != null && permsList.size() != 0) {
+//                for (String perms : permsList) {
+//                    if (StringUtils.isBlank(perms)) {
+//                        continue;
+//                    }
+//                    permsSet.addAll(Arrays.asList(perms.trim().split(",")));
+//                }
+//            }
 
         SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
-        info.setStringPermissions(permsSet);
+        //info.setStringPermissions(permsSet);
         return info;
     }
 
@@ -107,54 +100,27 @@ public class UserRealm extends AuthorizingRealm {
         String password = claims.get("password", String.class);
 
         //查询用户信息
-        SysUserEntity userEntity = sysUserDao.queryObject(userId);
+        TbUser userEntity = zhiHouseService.getByUserId(Long.valueOf(userId));
 
         //账号不存在
         if (userEntity == null) {
             throw new UnknownAccountException("账号或密码不正确");
         }
-
-        //账号锁定
-        if (userEntity.getStatus() == 0) {
-            throw new LockedAccountException("账号已被锁定,请联系管理员");
-        }
-        // 获取用户角色
-        List<Long> roles = sysUserRoleDao.queryRoleIdList(userEntity.getUserId());
-        if(ObjectUtils.isEmpty(roles)){
-            throw new AuthenticationException("用户角色为空!");
-        }
-        Long roleId = roles.stream().min(Comparator.naturalOrder()).get();
         CurrentUserLoginVo user = new CurrentUserLoginVo();
-        BeanUtils.copyProperties(userEntity,user);
-        user.setRoleIdList(roles);
-        user.setRoleId(roleId);
+        BeanUtils.copyProperties(userEntity, user);
         // 把当前用户放入到session中
         Subject subject = SecurityUtils.getSubject();
         Session session = subject.getSession(true);
-        if(!ObjectUtils.isEmpty(user.getDeptId())){
+        if (!ObjectUtils.isEmpty(user.getCompanyId())) {
             // 获取用户所在企业信息
-            JSONObject deptEntity = zhiHouseService.getComponyInfo(user.getMobile());
-            user.setDeptName(deptEntity.getString("name"));
-            user.setDeptId(deptEntity.getLong("id"));
-            user.setDeptManagerPhoneNum(deptEntity.getString("phone"));
-            user.setDeptExpirationDate(deptEntity.getDate("expirationDate"));
+            JSONObject componyInfo = zhiHouseService.getComponyInfo(user.getPhone());
+            user.setCompanyName(componyInfo.getString("name"));
+            user.setCompanyId(componyInfo.getLong("id"));
+            user.setCompanyManagerPhoneNum(componyInfo.getString("phone"));
+            user.setCompanyExpirationDate(componyInfo.getDate("expirationTime"));
         }
         session.setAttribute(Constant.CURRENT_USER, user);
-        List<String> permsList;
-        //系统管理员,拥有最高权限
-        if (Constant.SUPER_ADMIN == user.getUserId()) {
-            List<SysMenuEntity> menuList = sysMenuDao.queryList(new HashMap<String, Object>());
-            permsList = new ArrayList<>(menuList.size());
-            for (SysMenuEntity menu : menuList) {
-                permsList.add(menu.getPerms());
-            }
-        } else {
-            permsList = sysUserDao.queryAllPerms(user.getUserId());
-        }
-        J2CacheUtils.put(Constant.PERMS_LIST + user.getUserId(), permsList);
-
         SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(user, token, getName());
         return info;
     }
-
 }

+ 2 - 2
platform-common/src/main/java/com/platform/shiro/jwt/JwtFilter.java

@@ -59,8 +59,8 @@ public class JwtFilter extends BasicHttpAuthenticationFilter {
         JwtToken jwtToken = new JwtToken(token);
         // 提交给realm进行登入,如果错误它会抛出异常并被捕获
         getSubject(request, response).login(jwtToken);
-        // 如果没有抛出异常则代表登入成功,返回true
-        return true;
+         //如果没有抛出异常则代表登入成功,返回true
+        return false;
     }
 
     /**

+ 1 - 1
platform-common/src/main/java/com/platform/utils/ShiroUtils.java

@@ -28,7 +28,7 @@ public class ShiroUtils {
     }
 
     public static Long getUserId() {
-        return getUserEntity().getUserId();
+        return getUserEntity().getId();
     }
 
     public static void setSessionAttribute(Object key, Object value) {

+ 12 - 49
platform-common/src/main/java/com/platform/vos/CurrentUserLoginVo.java

@@ -1,55 +1,18 @@
 package com.platform.vos;
 
-import com.platform.entity.SysUserEntity;
+import lombok.Data;
 
 import java.util.Date;
+import java.util.List;
+
+@Data
+public class CurrentUserLoginVo extends TbUser {
+    private Long parentCompanyId;
+    private String companyName;
+    private String parentCompanyName;
+    private Date companyExpirationDate;
+    private String companyManagerPhoneNum;
+    private List<Long> roleIdList;
+    private Long roleId;
 
-public class CurrentUserLoginVo extends SysUserEntity {
-    private Long parentDeptId;
-    private String deptName;
-    private String parentDeptName;
-    private Date deptExpirationDate;
-    private String deptManagerPhoneNum;
-
-    public Long getParentDeptId() {
-        return parentDeptId;
-    }
-
-    public void setParentDeptId(Long parentDeptId) {
-        this.parentDeptId = parentDeptId;
-    }
-
-    @Override
-    public String getDeptName() {
-        return deptName;
-    }
-
-    @Override
-    public void setDeptName(String deptName) {
-        this.deptName = deptName;
-    }
-
-    public String getParentDeptName() {
-        return parentDeptName;
-    }
-
-    public void setParentDeptName(String parentDeptName) {
-        this.parentDeptName = parentDeptName;
-    }
-
-    public Date getDeptExpirationDate() {
-        return deptExpirationDate;
-    }
-
-    public void setDeptExpirationDate(Date deptExpirationDate) {
-        this.deptExpirationDate = deptExpirationDate;
-    }
-
-    public String getDeptManagerPhoneNum() {
-        return deptManagerPhoneNum;
-    }
-
-    public void setDeptManagerPhoneNum(String deptManagerPhoneNum) {
-        this.deptManagerPhoneNum = deptManagerPhoneNum;
-    }
 }

+ 2 - 11
platform-common/src/main/java/com/platform/entity/SysRoleEntity.java

@@ -1,21 +1,12 @@
-package com.platform.entity;
-
+package com.platform.vos;
 
 import org.hibernate.validator.constraints.NotBlank;
 
 import javax.validation.constraints.NotNull;
-import java.io.Serializable;
 import java.util.Date;
 import java.util.List;
 
-/**
- * 角色
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2016年9月18日 上午9:27:38
- */
-public class SysRoleEntity implements Serializable {
+public class SysRoleEntity {
     private static final long serialVersionUID = 1L;
 
     /**

+ 52 - 0
platform-common/src/main/java/com/platform/vos/TbUser.java

@@ -0,0 +1,52 @@
+package com.platform.vos;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class TbUser implements Serializable {
+    private Long id;
+
+    private String userName;
+
+    private String userPassword;
+
+    private String appid;
+
+    private String phone;
+
+    private String nickName;
+
+    private String memoName;
+
+    private String head;
+
+    private Integer type;
+
+    private Long companyId;
+
+    private Integer state;
+
+    private Date createTime;
+
+    private String createUser;
+
+    private Date updateTime;
+
+    private String updateUser;
+
+    private String message;
+
+    private String token;
+
+    private String fdkkUser;
+
+    private String fdkkPassword;
+
+    private String RoleName;
+    private List<Long> roleIdList;
+    private List<SysRoleEntity> roleList;
+}

+ 0 - 113
platform-common/src/main/resources/com/platform/dao/SysMenuDao.xml

@@ -1,113 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="com.platform.dao.SysMenuDao">
-
-    <select id="queryObject" resultType="com.platform.entity.SysMenuEntity">
-		select * from sys_menu where menu_id = #{value}
-	</select>
-
-    <insert id="save" parameterType="com.platform.entity.SysMenuEntity">
-		insert into sys_menu
-		(
-			`menu_id`, 
-			`parent_id`, 
-			`name`, 
-			`url`, 
-			`perms`, 
-			`type`, 
-			`icon`, 
-			`order_num`,
-			`status`
-		)
-		values
-		(
-			#{menuId}, 
-			#{parentId}, 
-			#{name}, 
-			#{url}, 
-			#{perms}, 
-			#{type}, 
-			#{icon}, 
-			#{orderNum},
-			#{status}
-		)
-	</insert>
-
-    <select id="queryListParentId" resultType="com.platform.entity.SysMenuEntity">
-		select * from sys_menu where parent_id = #{parentId} AND status = 0 order by order_num asc
-	</select>
-
-    <select id="queryNotButtonList" resultType="com.platform.entity.SysMenuEntity">
-		select * from sys_menu where type != 2 AND status = 0 order by order_num asc
-	</select>
-
-    <select id="queryList" resultType="com.platform.entity.SysMenuEntity">
-        select m.*,(select p.name from sys_menu p where p.menu_id = m.parent_id) as parentName
-        from sys_menu m WHERE 1=1
-        <if test="menuName != null and menuName.trim() != ''">
-            and m.name like concat('%',#{menuName},'%')
-        </if>
-        <if test="parentName != null and parentName.trim() != ''">
-            AND exists(SELECT 1 FROM sys_menu WHERE m.parent_id=sys_menu.menu_id AND sys_menu.name LIKE concat('%',#{parentName},'%'))
-        </if>
-        <choose>
-            <when test="sidx != null and sidx.trim() != ''">
-                order by m.${sidx} ${order}
-            </when>
-            <otherwise>
-                order by m.order_num asc
-            </otherwise>
-        </choose>
-        <if test="offset != null and limit != null">
-            limit #{offset}, #{limit}
-        </if>
-    </select>
-
-    <!-- 查询用户的权限列表 -->
-    <select id="queryUserList" resultType="com.platform.entity.SysMenuEntity">
-		select distinct m.*,(select p.name from sys_menu p where p.menu_id = m.parent_id) as parentName
-			from sys_user_role ur 
-			JOIN sys_role_menu rm on ur.role_id = rm.role_id
-			JOIN sys_menu m on rm.menu_id = m.menu_id AND m.status = 0
-		where ur.user_id = #{userId} order by m.order_num asc
-	</select>
-
-    <select id="queryTotal" resultType="int">
-		select count(*) from sys_menu m WHERE 1=1
-        <if test="menuName != null and menuName.trim() != ''">
-            and m.name like concat('%',#{menuName},'%')
-        </if>
-        <if test="parentName != null and parentName.trim() != ''">
-            AND exists(SELECT 1 FROM sys_menu WHERE m.parent_id=sys_menu.menu_id AND sys_menu.name LIKE concat('%',#{parentName},'%'))
-        </if>
-	</select>
-
-    <update id="update" parameterType="com.platform.entity.SysMenuEntity">
-        update sys_menu
-        <set>
-            <if test="parentId != null">`parent_id` = #{parentId},</if>
-            <if test="name != null">`name` = #{name},</if>
-            <if test="url != null">`url` = #{url},</if>
-            <if test="perms != null">`perms` = #{perms},</if>
-            <if test="type != null">`type` = #{type},</if>
-            <if test="icon != null">`icon` = #{icon},</if>
-            <if test="orderNum != null">`order_num` = #{orderNum},</if>
-            <if test="status != null">`status` = #{status}</if>
-        </set>
-        where menu_id = #{menuId}
-    </update>
-
-    <delete id="deleteBatch">
-        delete from sys_menu where menu_id in
-        <foreach item="menuId" collection="array" open="(" separator="," close=")">
-            #{menuId}
-        </foreach>
-        ;
-        delete from sys_role_menu where menu_id in
-        <foreach item="menuId" collection="array" open="(" separator="," close=")">
-            #{menuId}
-        </foreach>
-    </delete>
-
-</mapper>

+ 0 - 169
platform-common/src/main/resources/com/platform/dao/SysRoleDao.xml

@@ -1,169 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="com.platform.dao.SysRoleDao">
-
-	<select id="queryObject" resultType="com.platform.entity.SysRoleEntity">
-		select * from sys_role where role_id = #{value}
-	</select>
-
-	<select id="queryGreaterRoleById" resultType="com.platform.entity.SysRoleEntity">
-		select * from sys_role where role_id >= #{roleId}
-		and create_user_id in (1,#{createUserId})
-	</select>
-	
-	<select id="queryList" resultType="com.platform.entity.SysRoleEntity">
-		select r.*, (select d.name from sys_dept d where d.dept_id = r.dept_id) deptName from sys_role r
-		<where>
-			<if test="hide != null">
-				and hide = #{hide}
-			</if>
-			<if test="roleName != null and roleName.trim() != ''">
-				and `role_name` like concat('%',#{roleName},'%')
-			</if>
-			<if test="createUserId != null">
-				and create_user_id = #{createUserId}
-			</if>
-			<if test="excludeSuperAdmin != null">
-				and role_id != 5
-			</if>
-			<if test="deptIdList != null">
-			    and
-				dept_id in
-				<foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
-					#{deptId}
-				</foreach>
-		    </if>
-		</where>
-		<choose>
-			<when test="sidx != null and sidx.trim() != ''">
-				order by r.${sidx} ${order}
-			</when>
-			<otherwise>
-				order by r.role_id asc
-			</otherwise>
-		</choose>
-		<if test="offset != null and limit != null">
-			limit #{offset}, #{limit}
-		</if>
-	</select>
-
-	<select id="queryListTotal" resultType="java.lang.Integer">
-		select count(*) from sys_role
-		<where>
-			<if test="roleName != null and roleName.trim() != ''">
-				and `role_name` like concat('%',#{roleName},'%')
-			</if>
-			<if test="createUserId != null">
-				and create_user_id = #{createUserId}
-			</if>
-			<if test="excludeSuperAdmin != null">
-				and role_id != 5
-			</if>
-			<if test="deptIdList != null">
-				and
-				dept_id in
-				<foreach item="deptId" collection="deptIdList" open="(" separator="," close=")">
-					#{deptId}
-				</foreach>
-			</if>
-		</where>
-		<choose>
-			<when test="sidx != null and sidx.trim() != ''">
-				order by ${sidx} ${order}
-			</when>
-			<otherwise>
-				order by role_id asc
-			</otherwise>
-		</choose>
-		<if test="offset != null and limit != null">
-			limit #{offset}, #{limit}
-		</if>
-	</select>
-
-	<select id="queryTotal" resultType="int">
-		select count(*) from sys_role 
-		<where>
-			<if test="roleName != null and roleName.trim() != ''">
-				and `role_name` like concat('%',#{roleName},'%') 
-			</if>
-			<if test="createUserId != null">
-				and create_user_id = #{createUserId} 
-			</if>
-		</where>
-	</select>
-
-	<select id="queryListByUserId" resultType="com.platform.entity.SysRoleEntity">
-		SELECT a.* FROM `sys_role` a LEFT JOIN `sys_user_role` b ON a.role_id = b.role_id
-		WHERE user_id = #{userId}
-	</select>
-	
-	<insert id="save" parameterType="com.platform.entity.SysRoleEntity" useGeneratedKeys="true" keyProperty="roleId">
-		insert into sys_role
-		(
-			`role_id`, 
-			`role_name`,
-			`dept_id`,
-			`remark`,
-			`create_user_id`,
-			`create_time`
-		)
-		values
-		(
-			#{roleId}, 
-			#{roleName},
-			#{deptId},
-			#{remark},
-			#{createUserId},
-			#{createTime}
-		)
-	</insert>
-	 
-	<update id="update" parameterType="com.platform.entity.SysRoleEntity">
-		update sys_role 
-		<set> 
-			<if test="roleName != null">`role_name` = #{roleName}, </if>
-			<if test="remark != null">`remark` = #{remark},</if>
-			<if test="deptId != null">`dept_id` = #{deptId}, </if>
-		</set>
-		where role_id = #{roleId}
-	</update>
-	
-	<delete id="deleteBatch">
-		delete from sys_role where role_id in 
-		<foreach item="roleId" collection="array" open="(" separator="," close=")">
-			#{roleId}
-		</foreach>
-		;
-		delete from sys_role_menu where role_id in 
-		<foreach item="roleId" collection="array" open="(" separator="," close=")">
-			#{roleId}
-		</foreach>
-		;
-		delete from sys_role_dept where role_id in
-		<foreach item="roleId" collection="array" open="(" separator="," close=")">
-			#{roleId}
-		</foreach>
-		;
-		delete from sys_user_role where role_id in 
-		<foreach item="roleId" collection="array" open="(" separator="," close=")">
-			#{roleId}
-		</foreach>
-	</delete>
-	
-	<!-- 查询用户创建的角色ID列表 -->
-	<select id="queryRoleIdList" resultType="long">
-		select role_id from sys_role where create_user_id = #{createUserId} 
-	</select>
-
-	<!--根据角色id查询可用的组织机构-->
-	<select id="queryPageByDto" resultType="com.platform.entity.UserWindowDto" >
-		select
-		role_id id,role_name name ,dept_id
-		from sys_role
-		where 1=1
-		<if test="name != null and name != '' ">
-			AND role_name LIKE concat('%',#{name},'%')
-		</if>
-	</select>
-</mapper>

+ 0 - 32
platform-common/src/main/resources/com/platform/dao/SysRoleDeptDao.xml

@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="com.platform.dao.SysRoleDeptDao">
-
-	<insert id="save">
-		insert into sys_role_dept
-		(
-			`role_id`, 
-			`dept_id`
-		)
-		values
-		<foreach collection="deptIdList" item="item" index="index" separator="," >
-		(
-			#{roleId}, 
-			#{item} 
-		)
-		</foreach>
-	</insert>
-	
-	<delete id="delete">
-		delete from sys_role_dept where role_id = #{value}
-	</delete>
-	
-	<select id="queryDeptIdList" resultType="long">
-		select dept_id from sys_role_dept where role_id = #{value}
-	</select>
-
-	<select id="queryDeptIdListByUserId" resultType="long">
-		select dept_id from sys_role_dept where role_id IN (SELECT role_id FROM sys_user_role WHERE user_id =  #{value})
-	</select>
-</mapper>

+ 0 - 182
platform-common/src/main/resources/com/platform/dao/SysUserDao.xml

@@ -1,182 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="com.platform.dao.SysUserDao">
-	<select id="queryObject" resultType="com.platform.entity.SysUserEntity">
-		select * from sys_user where user_id = #{value}
-	</select>
-
-	<select id="getUserNumOfDept" resultType="java.lang.Long">
-		select count(*) from sys_user where  dept_id = #{deptId} and status = 1
-	</select>
-
-
-	<select id="queryList" resultType="com.platform.entity.SysUserEntity">
-		select u.*,sys_user_role.role_id, (select d.name from sys_dept d where d.dept_id = u.dept_id) deptName from sys_user u
-		left join sys_user_role on u.user_id = sys_user_role.user_id
-		<where>
-			<if test="createUserId != null">
-				and `create_user_id` = #{createUserId} 
-			</if>
-			<if test="username != null and username.trim() != ''">
-				and u.`username` like concat('%',#{username},'%')
-			</if>
-
-			<if test="deptIdList != null and deptIdList.size() > 0">
-				AND dept_id in
-				<foreach item="id" collection="deptIdList" open="(" separator="," close=")">
-					#{id}
-				</foreach>
-			</if>
-
-		</where>
-		<choose>
-			<when test="sidx != null and sidx.trim() != ''">
-				order by u.${sidx} ${order}
-			</when>
-			<otherwise>
-				order by u.user_id desc
-			</otherwise>
-		</choose>
-		<if test="offset != null and limit != null">
-			limit #{offset}, #{limit}
-		</if>
-	</select>
-
-	<select id="queryListByBean" resultType="com.platform.entity.UserWindowDto">
-		select user.id,user.username name,user.dept_Id
-		from sys_user user
-		left join
-		left join sys_role role on user.
-		WHERE 1=1
-		<if test="name != null and name.trim() != ''" >
-			AND username LIKE concat('%',#{name},'%')
-		</if>
-	</select>
-
-	<select id="getSysUserListByDeptIds" resultType="com.platform.entity.SysUserEntity">
-		select * from sys_user WHERE status = 1 and dept_id in
-		<foreach collection="deptList" open="(" separator="," close=")" item="deptId">
-			#{deptId}
-		</foreach>
-	</select>
-
-	<select id="queryTotal" resultType="int">
-		select count(*) from sys_user user
-		left join sys_user_role role on user.user_id = role.user_id
-		<where>
-			<if test="createUserId != null">
-				and `create_user_id` = #{createUserId} 
-			</if>
-			<if test="username != null and username.trim() != ''">
-				and `username` like concat('%',#{username},'%') 
-			</if>
-			<if test="status != null and status.trim() != ''">
-				and `status` = #{status}
-			</if>
-			<if test="deptIdList != null and deptIdList.size() > 0">
-				AND dept_id in
-				<foreach item="id" collection="deptIdList" open="(" separator="," close=")">
-					#{id}
-				</foreach>
-			</if>
-			<if test="roleIdList != null and roleIdList.size() > 0">
-				AND dept_id in
-				<foreach item="id" collection="deptIdList" open="(" separator="," close=")">
-					#{id}
-				</foreach>
-			</if>
-		</where>
-	</select>
-	
-	<!-- 查询用户的所有权限 -->
-	<select id="queryAllPerms" resultType="string">
-		select m.perms from sys_user_role ur 
-			LEFT JOIN sys_role_menu rm on ur.role_id = rm.role_id 
-			LEFT JOIN sys_menu m on rm.menu_id = m.menu_id 
-		where ur.user_id = #{userId}
-	</select>
-	
-	<!-- 查询用户的所有菜单ID --> 
-	<select id="queryAllMenuId" resultType="long">
-		select distinct rm.menu_id from sys_user_role ur 
-			LEFT JOIN sys_role_menu rm on ur.role_id = rm.role_id 
-		where ur.user_id = #{userId}
-	</select>
-
-	<select id="getBindList" resultType="com.platform.entity.SysUserEntity">
-		select sysUser.*,
-		 brand.can_show as can_show,
-		 role.role_name as role_name,
-		 role.role_id as role_id
-		 from sys_user sysUser
-           left join sys_user_brand brand on (sysUser.user_id = brand.user_id and brand.enable = 1 and brand.brand_id=#{brandId})
-           left join sys_user_role userRole on userRole.user_id = sysUser.user_id
-           left join sys_role role on role.role_id = userRole.role_id
-		 ${ew.customSqlSegment}
-	</select>
-
-	<select id="getCompanyUserList" resultType="com.platform.entity.SysUserEntity">
-		select sysUser.*,
-		 role.role_name as role_name,
-		 dept.name as dept_name
-		 from sys_user sysUser
-           left join sys_user_role userRole on userRole.user_id = sysUser.user_id
-           left join sys_role role on role.role_id = userRole.role_id
-           left join sys_dept dept on sysUser.dept_id = dept.dept_id
-		 ${ew.customSqlSegment}
-	</select>
-
-
-	<select id="queryByUserName" resultType="com.platform.entity.SysUserEntity">
-		select * from sys_user where username = #{username} and status = 1 limit 0 , 1
-	</select>
-
-	<select id="queryByUserMobile" resultType="com.platform.entity.SysUserEntity">
-		select * from sys_user where mobile = #{mobile} and status = 1 limit 0 , 1
-	</select>
-
-	<select id="queryByMobileAndDeptId" resultType="com.platform.entity.SysUserEntity">
-		select * from sys_user where mobile = #{mobile} and dept_id = #{deptId}
-	</select>
-	
-	<insert id="save" parameterType="com.platform.entity.SysUserEntity" useGeneratedKeys="true" keyProperty="userId">
-		insert into sys_user(`user_id`, `username`, `password`, `email`, `mobile`, `status`, `create_user_id`,
-		`dept_id`, `create_time`, `is_platform_streamer`)
-		values(#{userId}, #{username}, #{password},#{email}, #{mobile}, #{status}, #{createUserId},#{deptId},
-			#{createTime},#{isPlatformStreamer})
-	</insert>
-	 
-	<update id="update" parameterType="com.platform.entity.SysUserEntity">
-		update sys_user 
-		<set> 
-			<if test="username != null">`username` = #{username}, </if>
-			<if test="email != null">`email` = #{email}, </if>
-			<if test="mobile != null">`mobile` = #{mobile}, </if>
-			<if test="status != null">`status` = #{status}, </if>
-			<if test="deptId != null">`dept_id` = #{deptId}, </if>
-			<if test="isPlatformStreamer != null">`is_platform_streamer` = #{isPlatformStreamer}, </if>
-		</set>
-		where user_id = #{userId} 
-		<if test="createUserId != null">
-			and `create_user_id` = #{createUserId} 
-		</if>
-	</update>
-	
-	<update id="updatePassword" parameterType="map">
-		update sys_user set fdkk_user = #{fdkkUser} ,fdkk_password = #{fdkkPassword} where user_id = #{userId}
-	</update>
-	
-	<delete id="deleteBatch">
-		delete from sys_user where user_id in 
-		<foreach item="userId" collection="array" open="(" separator="," close=")">
-			#{userId}
-		</foreach>
-		;
-		delete from sys_user_role where user_id in 
-		<foreach item="userId" collection="array" open="(" separator="," close=")">
-			#{userId}
-		</foreach>
-	</delete>
-
-</mapper>

+ 0 - 50
platform-common/src/main/resources/com/platform/dao/SysUserRoleDao.xml

@@ -1,50 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="com.platform.dao.SysUserRoleDao">
-
-	<select id="queryList" resultType="com.platform.entity.SysUserRoleEntity">
-		select * from sys_user_role 
-		<where>
-			<if test="userId != null">
-				user_id = #{userId}
-			</if>
-		</where>
-	</select>
- 
-	<insert id="save">
-		insert into sys_user_role
-		(
-			`user_id`, 
-			`role_id`
-		)
-		values
-		<foreach collection="roleIdList" item="item" index="index" separator="," >
-		(
-			#{userId}, 
-			#{item}
-		)
-		</foreach>
-	</insert>
-
-	<insert id="saveOne" >
-		insert into sys_user_role
-		(
-		`user_id`,
-		`role_id`
-		)
-		values
-		(
-			#{userId},
-			#{roleId}
-		)
-	</insert>
-	
-	<delete id="delete">
-		delete from sys_user_role where user_id = #{value}
-	</delete>
-	
-	<select id="queryRoleIdList" resultType="long">
-		select role_id from sys_user_role where user_id = #{value}
-	</select>
-</mapper>

+ 7 - 7
platform-common/src/main/resources/platform-shiro.xml

@@ -4,7 +4,7 @@
 	   xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans-4.2.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
 
-	<!-- 继承自AuthorizingRealm的自定义Realm,即指定Shiro验证用户登录的类为自定义的UserRealm.java -->  
+	<!-- 继承自AuthorizingRealm的自定义Realm,即指定Shiro验证用户登录的类为自定义的UserRealm.java -->
 	<bean id="userRealm" class="com.platform.shiro.UserRealm"/>
 
     <bean id="cluterShiroSessionDao" class="com.platform.shiro.CluterShiroSessionDao"/>
@@ -16,10 +16,10 @@
 		<property name="sessionIdUrlRewritingEnabled" value="false"></property>
         <property name="sessionDAO" ref="cluterShiroSessionDao"/>
 	</bean>
-	
-	<!-- Shiro默认会使用Servlet容器的Session,可通过sessionMode属性来指定使用Shiro原生Session -->  
-	<!-- 即<property name="sessionMode" value="native"/>,详细说明见官方文档 -->  
-	<!-- 这里主要是设置自定义的单Realm应用,若有多个Realm,可使用'realms'属性代替 -->  
+
+	<!-- Shiro默认会使用Servlet容器的Session,可通过sessionMode属性来指定使用Shiro原生Session -->
+	<!-- 即<property name="sessionMode" value="native"/>,详细说明见官方文档 -->
+	<!-- 这里主要是设置自定义的单Realm应用,若有多个Realm,可使用'realms'属性代替 -->
 	<bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager">
 		<property name="sessionManager" ref="sessionManager"></property>
 	    <property name="realm" ref="userRealm"/>
@@ -71,9 +71,9 @@
 	        </value>
 	    </property>
 	</bean>
-	
+
 	<bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/>
-	
+
 	<!-- AOP式方法级权限检查  -->
 	<bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" depends-on="lifecycleBeanPostProcessor">
 		<property name="proxyTargetClass" value="true" />

+ 0 - 26
platform-framework/src/test/java/com/platform/BaseSpringTestCase.java

@@ -1,26 +0,0 @@
-package com.platform;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.test.context.ContextConfiguration;
-import org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
-
-/**
- * 基于spring的单元测试基类
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2018-07-09 10:06:23
- */
-@ContextConfiguration(locations = {"classpath:applicationContext-test.xml"})
-public class BaseSpringTestCase extends AbstractJUnit4SpringContextTests {
-
-    protected Logger logger = LoggerFactory.getLogger(this.getClass());
-
-    /**
-     * 获取Logger
-     */
-    public Logger getLogger() {
-        return logger;
-    }
-}

+ 0 - 56
platform-framework/src/test/java/com/platform/controller/TestSysUserController.java

@@ -1,56 +0,0 @@
-package com.platform.controller;
-
-import com.platform.BaseSpringTestCase;
-import com.platform.entity.SysUserEntity;
-import com.platform.service.SysUserService;
-import com.platform.service.TestSysUserService;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * 会员测试
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2018-07-09 10:13:43
- */
-public class TestSysUserController extends BaseSpringTestCase {
-    @Autowired
-    TestSysUserService testSysUserService;
-    @Autowired
-    SysUserService sysUserService;
-    private Logger logger = getLogger();
-
-    /**
-     * 使用测试类
-     */
-    @Test
-    public void queryTestSysUserList() {
-        Map params = new HashMap();
-        List<SysUserEntity> list = testSysUserService.queryList(params);
-        if (list != null && list.size() != 0) {
-            for (SysUserEntity userEntity : list) {
-                logger.info("username:" + userEntity.getUsername() + ";mobile:" + userEntity.getMobile());
-            }
-        }
-    }
-
-    /**
-     * 使用项目中的service
-     */
-    @Test
-    public void querySysUserList() {
-        Map params = new HashMap();
-        List<SysUserEntity> list = sysUserService.queryList(params);
-        if (list != null && list.size() != 0) {
-            for (SysUserEntity userEntity : list) {
-                logger.info("username:" + userEntity.getUsername() + ";mobile:" + userEntity.getMobile());
-            }
-        }
-    }
-}

+ 0 - 14
platform-framework/src/test/java/com/platform/dao/TestSysUserDao.java

@@ -1,14 +0,0 @@
-package com.platform.dao;
-
-import com.platform.entity.SysUserEntity;
-
-/**
- * 管理员测试Dao
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2018-07-09 10:21:36
- */
-public interface TestSysUserDao extends BaseDao<SysUserEntity> {
-
-}

+ 0 - 31
platform-framework/src/test/java/com/platform/service/TestSysUserService.java

@@ -1,31 +0,0 @@
-package com.platform.service;
-
-import com.platform.entity.SysUserEntity;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Service测试接口
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2018-07-09 10:16:22
- */
-public interface TestSysUserService {
-    /**
-     * 根据主键查询实体
-     *
-     * @param id 主键
-     * @return 实体
-     */
-    SysUserEntity queryObject(Integer id);
-
-    /**
-     * 分页查询
-     *
-     * @param map 参数
-     * @return list
-     */
-    List<SysUserEntity> queryList(Map<String, Object> map);
-}

+ 0 - 33
platform-framework/src/test/java/com/platform/service/impl/TestSysUserServiceImpl.java

@@ -1,33 +0,0 @@
-package com.platform.service.impl;
-
-import com.platform.dao.TestSysUserDao;
-import com.platform.entity.SysUserEntity;
-import com.platform.service.TestSysUserService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * Service测试实现类
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2018-07-09 10:18:34
- */
-@Service("testUserService")
-public class TestSysUserServiceImpl implements TestSysUserService {
-    @Autowired
-    private TestSysUserDao testSysUserDao;
-
-    @Override
-    public SysUserEntity queryObject(Integer id) {
-        return testSysUserDao.queryObject(id);
-    }
-
-    @Override
-    public List<SysUserEntity> queryList(Map<String, Object> map) {
-        return testSysUserDao.queryList(map);
-    }
-}

+ 0 - 130
platform-framework/src/test/resources/applicationContext-test.xml

@@ -1,130 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:context="http://www.springframework.org/schema/context"
-       xmlns:tx="http://www.springframework.org/schema/tx" xmlns:aop="http://www.springframework.org/schema/aop"
-       xmlns:mvc="http://www.springframework.org/schema/mvc"
-       xsi:schemaLocation="http://www.springframework.org/schema/beans
-        http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
-        http://www.springframework.org/schema/context
-        http://www.springframework.org/schema/context/spring-context-4.2.xsd
-        http://www.springframework.org/schema/tx
-     	http://www.springframework.org/schema/tx/spring-tx-4.2.xsd
-		http://www.springframework.org/schema/aop
-		http://www.springframework.org/schema/aop/spring-aop-2.5.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
-    <context:component-scan base-package="com.platform.dao,com.platform.service">
-        <!--过滤定时任务service-->
-        <context:exclude-filter type="regex" expression="com.platform.service.impl.ScheduleJobServiceImpl"/>
-    </context:component-scan>
-
-    <context:property-placeholder location="classpath:platform.properties"/>
-    <context:annotation-config/>
-    <mvc:default-servlet-handler/>
-    <aop:aspectj-autoproxy proxy-target-class="true"/>
-    <mvc:annotation-driven>
-        <mvc:message-converters register-defaults="true">
-            <bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
-                <property name="supportedMediaTypes">
-                    <list>
-                        <value>text/html;charset=UTF-8</value>
-                        <value>application/json;charset=UTF-8</value>
-                    </list>
-                </property>
-                <property name="features">
-                    <list>
-                        <value>WriteMapNullValue</value>
-                        <value>QuoteFieldNames</value>
-                        <value>WriteDateUseDateFormat</value>
-                        <!-- 禁用fastjson循环引用检测 -->
-                        <value>DisableCircularReferenceDetect</value>
-                    </list>
-                </property>
-            </bean>
-        </mvc:message-converters>
-    </mvc:annotation-driven>
-
-    <tx:annotation-driven/>
-
-    <bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource"
-          init-method="init" destroy-method="close">
-        <property name="url">
-            <value>${jdbc.url}</value>
-        </property>
-        <property name="username">
-            <value>${jdbc.username}</value>
-        </property>
-        <property name="password">
-            <value>${jdbc.password}</value>
-        </property>
-        <property name="initialSize">
-            <value>${jdbc.initialSize}</value>
-        </property>
-        <property name="maxActive">
-            <value>${jdbc.maxActive}</value>
-        </property>
-        <property name="proxyFilters">
-            <list>
-                <ref bean="stat-filter"/>
-                <!--过滤永真条件 防止注入-->
-                <ref bean="wall-filter"/>
-            </list>
-        </property>
-        <property name="connectionInitSqls" value="set names utf8mb4;"/>
-    </bean>
-
-    <bean id="stat-filter" class="com.alibaba.druid.filter.stat.StatFilter">
-        <property name="slowSqlMillis" value="1000"/>
-        <property name="logSlowSql" value="true"/>
-        <property name="mergeSql" value="true"/>
-    </bean>
-
-    <bean id="wall-filter" class="com.alibaba.druid.wall.WallFilter">
-        <property name="dbType" value="mysql"/>
-        <property name="config" ref="wall-filter-config"/>
-    </bean>
-
-    <bean id="wall-filter-config" class="com.alibaba.druid.wall.WallConfig">
-        <property name="multiStatementAllow" value="true"/>
-    </bean>
-
-    <bean id="druid-stat-interceptor" class="com.alibaba.druid.support.spring.stat.DruidStatInterceptor"></bean>
-    <bean id="druid-stat-pointcut" class="org.springframework.aop.support.JdkRegexpMethodPointcut" scope="prototype">
-        <property name="patterns">
-            <list>
-                <value>com.platform.service.*</value>
-            </list>
-        </property>
-    </bean>
-    <aop:config>
-        <aop:advisor advice-ref="druid-stat-interceptor" pointcut-ref="druid-stat-pointcut"/>
-    </aop:config>
-
-    <!-- 配置事务管理器 -->
-    <bean id="transactionManager"
-          class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
-        <property name="dataSource" ref="dataSource"></property>
-    </bean>
-
-    <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate">
-        <property name="dataSource">
-            <ref bean="dataSource"/>
-        </property>
-    </bean>
-
-    <!-- JDBC配置 -->
-    <bean id="namedParameterJdbcTemplate"
-          class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate">
-        <constructor-arg ref="dataSource"/>
-    </bean>
-
-    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
-        <property name="configLocation" value="classpath:mybatis.xml"/>
-        <property name="dataSource" ref="dataSource"/>
-    </bean>
-
-    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
-        <property name="basePackage" value="com.platform.dao,com.platform.*.dao"/>
-    </bean>
-
-    <bean id="restTemplate" class="org.springframework.web.client.RestTemplate"/>
-</beans>

+ 0 - 31
platform-framework/src/test/resources/com/platform/dao/TestSysUserDao.xml

@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-
-<mapper namespace="com.platform.dao.TestSysUserDao">
-    <select id="queryObject" resultType="com.platform.entity.SysUserEntity">
-		select * from sys_user where user_id = #{value}
-	</select>
-
-    <select id="queryList" resultType="com.platform.entity.SysUserEntity">
-        select u.*, (select d.name from sys_dept d where d.dept_id = u.dept_id) deptName from sys_user u
-        <where>
-            <if test="createUserId != null">
-                and `create_user_id` = #{createUserId}
-            </if>
-            <if test="username != null and username.trim() != ''">
-                and u.`username` like concat('%',#{username},'%')
-            </if>
-        </where>
-        <choose>
-            <when test="sidx != null and sidx.trim() != ''">
-                order by u.${sidx} ${order}
-            </when>
-            <otherwise>
-                order by u.user_id desc
-            </otherwise>
-        </choose>
-        <if test="offset != null and limit != null">
-            limit #{offset}, #{limit}
-        </if>
-    </select>
-</mapper>

+ 0 - 25
platform-framework/src/test/resources/log4j.properties

@@ -1,25 +0,0 @@
-log4j.rootLogger=INFO,stdout,file
-#控制台输出
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.Threshold=INFO
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss SSS}|%5p|%F.%M:%L|%m%n
-#INFO所有日志
-log4j.logger.file=info
-log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.file.File=../logs/junitTestInfo.log
-log4j.appender.file.datePattern='.'yyyy-MM-dd'.log'
-log4j.appender.file.append=true
-log4j.appender.file.Threshold=INFO
-log4j.appender.file.encoding=UTF-8
-log4j.appender.file.ImmediateFlush=true
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss SSS}|%5p|%F.%M:%L|%m%n
-#控制台输出所有SQL
-#便于调试  生产环境注释
-log4j.logger.com.platform.dao=DEBUG,sql
-log4j.appender.sql=org.apache.log4j.ConsoleAppender
-log4j.appender.sql.Target=System.out
-log4j.appender.sql.layout=org.apache.log4j.PatternLayout
-log4j.appender.sql.layout.ConversionPattern=%m %n

+ 0 - 44
platform-framework/src/test/resources/platform.properties

@@ -1,44 +0,0 @@
-jdbc.url=jdbc:mysql://localhost/platform?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8
-jdbc.username=root
-jdbc.password=123456
-
-jdbc.initialSize=5
-jdbc.maxActive=30
-jdbc.minPoolSize=2
-jdbc.maxIdleTime=30000
-jdbc.idleConnectionTestPeriod=100
-
-#小程序ID
-wx.appId=
-#小程序密钥
-wx.secret=
-#商户号
-wx.mchId=
-#支付签名
-wx.paySignKey=
-#交易类型
-wx.tradeType=JSAPI
-#证书名称,对应不同的商户号
-wx.certName=/cert/apiclient_cert.p12
-#支付回调地址
-wx.notifyUrl=https://www.fly2you.cn/platform/url/api/notify
-#获取code的请求地址
-wx.getCode=https://open.weixin.qq.com/connect/oauth2/authorize?appid=%s&redirect_uri=%s&response_type=code&scope=%s&state=STAT#wechat_redirect
-#获取Web_access_tokenhttps的请求地址
-wx.webAccessTokenhttps = https://api.weixin.qq.com/sns/jscode2session?appid=%s&secret=%s&js_code=%s&grant_type=authorization_code
-#拉取用户信息的请求地址
-wx.userMessage=https://api.weixin.qq.com/sns/userinfo?access_token=%s&openid=%s&lang=zh_CN
-#微信统一下单接口路径
-wx.uniformorder=https://api.mch.weixin.qq.com/pay/unifiedorder
-#退款地址
-wx.refundUrl=https://api.mch.weixin.qq.com/secapi/pay/refund
-#退款查询地址
-wx.refundqueryUrl=https://api.mch.weixin.qq.com/pay/refundquery
-#微信查询订单状态
-wx.orderquery=https://api.mch.weixin.qq.com/pay/orderquery
-
-#安全起见,暴露的短信接口需要配置有效的请求IP
-sms.validIp=127.0.0.1
-
-#演示环境  1:是  0:否
-sys.demo=1

+ 3 - 6
platform-shop/src/main/java/com/platform/controller/BrandController.java

@@ -8,16 +8,15 @@ import com.platform.annotation.CanUserUpdateRecord;
 import com.platform.entity.BrandEntity;
 import com.platform.entity.GoodsEntity;
 import com.platform.entity.Result;
-import com.platform.entity.SysUserEntity;
 import com.platform.service.BrandService;
 import com.platform.service.GoodsService;
-import com.platform.service.SysUserService;
 import com.platform.service.custom.MySysUserBrandService;
 import com.platform.service.custom.TmBrandTypeService;
 import com.platform.service.impl.ZhiHouseService;
 import com.platform.utils.*;
 import com.platform.vo.BrandBindUserVo;
 import com.platform.vo.BrandRspVo;
+import com.platform.vos.TbUser;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -59,8 +58,6 @@ public class BrandController extends AbstractController{
     @Autowired
     private GoodsService goodsService;
 
-    @Autowired
-    private SysUserService sysUserService;
 
     @Autowired
     private TmBrandTypeService tmBrandTypeService;
@@ -120,7 +117,7 @@ public class BrandController extends AbstractController{
             if (roleId == 8) {
                 userId = getUserId();
             }else{
-                if(ObjectUtils.isEmpty(getUser().getDeptId())){
+                if(ObjectUtils.isEmpty(getUser().getCompanyId())){
                     return Result.failure("该账号未绑定公司!");
                 }
                 deptIdList.add(getDeptId());
@@ -524,7 +521,7 @@ public class BrandController extends AbstractController{
      */
     @RequestMapping("/goSceneEditUrl")
     public void goSceneEditUrl(HttpServletRequest request, HttpServletResponse response){
-        SysUserEntity sysUserEntity = sysUserService.queryObject((long)Constant.SUPER_ADMIN);
+        TbUser sysUserEntity = zhiHouseService.getByUserId((long)Constant.SUPER_ADMIN);
         String sceneUrl = request.getParameter("sceneUrl");
         if(!StringUtils.isEmpty(sceneUrl)){
             String sceneNum = sceneUrl.split("\\?m=")[1];

+ 0 - 305
platform-shop/src/main/java/com/platform/controller/SysUserController.java

@@ -1,305 +0,0 @@
-package com.platform.controller;
-
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.platform.annotation.SysLog;
-import com.platform.entity.Result;
-import com.platform.entity.SysRoleEntity;
-import com.platform.entity.SysUserEntity;
-import com.platform.enums.SysRoleEnum;
-import com.platform.service.SysRoleService;
-import com.platform.service.SysUserRoleService;
-import com.platform.service.SysUserService;
-import com.platform.service.custom.MySysUserBrandService;
-import com.platform.utils.Constant;
-import com.platform.utils.PageUtilsPlus;
-import com.platform.utils.Query;
-import com.platform.utils.StringUtils;
-import com.platform.validator.ValidatorUtils;
-import com.platform.validator.group.AddGroup;
-import com.platform.validator.group.UpdateGroup;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.ResponseEntity;
-import org.springframework.transaction.annotation.Transactional;
-import org.springframework.util.CollectionUtils;
-import org.springframework.util.ObjectUtils;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.client.RestTemplate;
-
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * 系统用户
- *
- * @author lipengjun
- * @email 939961241@qq.com
- * @date 2016年10月31日 上午10:40:10
- */
-@RestController
-@RequestMapping("/sys/user")
-@Slf4j
-public class SysUserController extends AbstractController {
-    @Autowired
-    private SysUserService sysUserService;
-    @Autowired
-    private SysUserRoleService sysUserRoleService;
-
-    @Autowired
-    private SysRoleService sysRoleService;
-
-
-    @Autowired
-    private MySysUserBrandService mySysUserBrandService;
-
-
-    @Autowired
-    private RestTemplate restTemplate;
-
-    @Value("${scenePath}")
-    private String scenePath;
-
-
-    /**
-     * 店铺绑定的用户列表
-     * @return
-     */
-    @GetMapping("/bindList")
-    @RequiresPermissions("sys:user:list")
-    public Result userBindList(String key, @RequestParam(name = "brandId") long brandId,
-                               @RequestParam(name = "pageNum") long pageNum,
-                               @RequestParam(name = "pageSize") long pageSize) {
-
-        IPage<SysUserEntity> resultPage = sysUserService.getSysUserList(Arrays.asList(getDeptId()), key,
-                brandId , pageNum, pageSize);
-        if (null == resultPage) {
-            return Result.failure("获取用户列表失败");
-        }
-        resultPage.getRecords().parallelStream().forEach(user->{
-            if (!ObjectUtils.isEmpty(user.getIsPlatformStreamer()) && user.getIsPlatformStreamer()) {
-                user.setRoleName("平台主持人");
-            }
-        });
-        return Result.success(PageUtilsPlus.page(resultPage));
-    }
-
-    /**
-     * 所有管理员列表
-     */
-    @GetMapping("/list")
-    @RequiresPermissions("sys:user:list")
-    public Result list(@RequestBody Map<String, Object> params) {
-        //只有超级管理员,才能查看所有管理员列表
-        if (getUserId() != Constant.SUPER_ADMIN) {
-            params.put("deptIdList", getDeptId());
-        }
-        //查询列表数据
-        Query query = new Query(params);
-        List<SysUserEntity> userList = sysUserService.queryList(query);
-        int total = sysUserService.queryTotal(query);
-        userList.parallelStream().forEach(userEntity -> {
-                    List<SysRoleEntity> curRoleList = new ArrayList<>();
-                    if (!ObjectUtils.isEmpty(userEntity.getIsPlatformStreamer()) && userEntity.getIsPlatformStreamer()) {
-                        SysRoleEntity sysRoleEntity = new SysRoleEntity();
-                        sysRoleEntity.setRoleName("平台主持人");
-                        curRoleList.add(sysRoleEntity);
-                    } else {
-                        curRoleList = sysRoleService.queryListByUserId(userEntity.getUserId());
-                    }
-                    userEntity.setRoleList(curRoleList);
-                }
-        );
-        return Result.success( PageUtilsPlus.page(userList, (long) total, (long)query.getLimit(),(long)query.getPage()));
-    }
-
-    /**
-     * 员工列表
-     * @return
-     */
-    @ApiOperation("员工列表")
-    @GetMapping("/staffList")
-    @RequiresPermissions("sys:user:list")
-    public Result staffList(String staffName,
-                            @RequestParam(name = "pageNum") long pageNum,
-                            @RequestParam(name = "pageSize") long pageSize,
-                            @RequestParam(name = "deptName",required = false) String deptName) {
-
-        IPage<SysUserEntity> resultPage = null;
-
-        if (getUserId() != Constant.SUPER_ADMIN) {
-            //非系统管理员,需要踢掉超级管理员
-            resultPage = sysUserService.getCompanyStaffList(staffName, deptName,
-                    pageNum, pageSize , getDeptId() , true);
-        }else{
-            //只有超级管理员才有权限查看自己的数据
-            resultPage = sysUserService.getCompanyStaffList(staffName, deptName,
-                    pageNum, pageSize , null , false);
-        }
-
-        if (null == resultPage) {
-            return Result.failure("获取员工列表失败");
-        }
-        return  Result.success(PageUtilsPlus.page(resultPage));
-    }
-
-    @ApiOperation("检验用户是否是四维看看的用户")
-    @ResponseBody
-    @GetMapping(value = "/checkUser")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "phoneNum", value = "手机号码", dataType = "String"),
-    })
-    public Result getBrandCommentList(@RequestParam(name = "phoneNum") String phoneNum) {
-
-        if (StringUtils.isNullOrEmpty(phoneNum)) {
-            return Result.failure("缺少手机号码");
-        }
-        Map<String, Object> mp = new HashMap<>();
-        mp.put("phone", phoneNum);
-        String url = scenePath + "user/checkUserExists";
-        ResponseEntity<String> kankanResult = restTemplate.postForEntity(url, mp,String.class);
-        //解析返回结果
-        JSONObject res = JSONObject.parseObject(kankanResult.getBody());
-        log.info("四维看看返回登录数据:{}", res.toJSONString());
-        if (!res.containsKey("code")) {
-            return Result.failure("系统故障,请稍后重试");
-        }
-        Boolean exist = res.getBoolean("message");
-        if (!exist) {
-            return Result.failure("用户不存在!");
-        }
-        return Result.success();
-    }
-
-    /**
-     * 获取登录的用户信息
-     */
-    @GetMapping("/info")
-    public Result info(String phone) {
-        if(ObjectUtils.isEmpty(phone)){
-            return Result.success(getUser());
-        }
-        SysUserEntity sysUserEntity = sysUserService.queryByUserMobile(phone);
-        return Result.success(sysUserEntity);
-    }
-
-    /**
-     * 用户信息
-     */
-    @GetMapping("/info/{userId}")
-    public Result info(@PathVariable("userId") Long userId) {
-        SysUserEntity user = sysUserService.queryObject(userId);
-
-        //获取用户所属的角色列表
-        List<Long> roleIdList = sysUserRoleService.queryRoleIdList(userId);
-        user.setRoleIdList(roleIdList);
-
-        return Result.success(user);
-    }
-
-    @RequestMapping("/infoAnon/{userId}")
-    @ResponseBody
-    public Result infoAnon(@PathVariable(value = "userId") Long userId) {
-        SysUserEntity user = sysUserService.queryObject(userId);
-        user.setPassword(null);
-        //获取用户所属的角色列表
-        List<Long> roleIdList = sysUserRoleService.queryRoleIdList(userId);
-        if (null != roleIdList) {
-            user.setRoleIdList(roleIdList);
-        }
-        return Result.success(user);
-    }
-
-    /**
-     * 保存用户
-     */
-    @SysLog("保存用户")
-    @PostMapping("/save")
-    @RequiresPermissions("sys:user:save")
-    public Result save(@ApiParam(name = "SysUserEntity对象", value = "传入json格式", required = true) @RequestBody SysUserEntity user) {
-        ValidatorUtils.validateEntity(user, AddGroup.class);
-
-        SysUserEntity sysUserEntity = sysUserService.queryByUserMobile(user.getMobile());
-        if(null != sysUserEntity){
-            return Result.failure("员工已经存在,请勿重复添加");
-        }
-
-        user.setCreateUserId(getUserId());
-
-        // 如果是平台主持人,则设置为公司员工
-        if(user.getRoleIdList().contains(SysRoleEnum.PLATFORM_STREAMER.getCode())){
-            user.setIsPlatformStreamer(true);
-            user.setRoleIdList(Collections.singletonList(8L));
-        }
-        sysUserService.save(user);
-        return Result.success();
-    }
-
-    /**
-     * 修改用户
-     */
-    @SysLog("修改用户")
-    @PostMapping("/update")
-    @RequiresPermissions("sys:user:update")
-    public Result update(@RequestBody SysUserEntity user) {
-        ValidatorUtils.validateEntity(user, UpdateGroup.class);
-        sysUserService.update(user);
-        return Result.success();
-    }
-
-    @ApiOperation(value = "删除员工")
-    @SysLog("删除员工")
-    @PostMapping("/preDeleteStaff")
-    @RequiresPermissions("sys:user:delete")
-    @Transactional(rollbackFor = Exception.class)
-    public Result preDeleteStaff(@RequestBody Map<String,Long> params) {
-        Long userId = params.get("userId");
-        if(ObjectUtils.isEmpty(userId)){
-            return Result.failure("参数有误!");
-        }
-        if (userId.equals(-1L)) {
-            return Result.failure("不能删除平台管理员");
-        }
-        if (getUserId().equals(userId)) {
-            return Result.failure("当前用户不能删除");
-        }
-
-        SysUserEntity sysUserEntity = sysUserService.queryObject(userId);
-        if(ObjectUtils.isEmpty(sysUserEntity)){
-            return Result.failure("获取用户信息失败!");
-        }
-
-        List<Long> roleList = sysUserRoleService.queryRoleIdList(userId);
-        if(!CollectionUtils.isEmpty(roleList) && (roleList.contains(6) || roleList.contains(5))){
-            return Result.failure("不能删除平台管理员或者普通管理员");
-        }
-
-        Long deptId = sysUserEntity.getDeptId();
-        if(!ObjectUtils.isEmpty(deptId)){
-            // 更新企业员工信息
-            long num = sysUserService.getUserNumOfDept(deptId);
-            if(num <= 1){
-                return Result.failure("删除失败,公司仅剩一个账号");
-            }
-            // 获取直播间绑定信息
-            List<Long> bindUsers = mySysUserBrandService.queryBrandIdList(userId);
-            if (!ObjectUtils.isEmpty(bindUsers)) {
-                // 获取该公司下管理员手机号
-                List<SysUserEntity> userEntities = sysUserService.getSysUserListByDeptIds(Arrays.asList(deptId));
-                List<String> phones = userEntities.stream().filter(user -> !user.getUserId().equals(userId))
-                        .map(SysUserEntity::getMobile).collect(Collectors.toList());
-                if(ObjectUtils.isEmpty(phones)){
-                    return Result.failure("删除失败,公司仅剩一名员工,不可进行删除!");
-                }
-                return Result.success(phones);
-            }
-        }
-        return Result.success();
-    }
-}

+ 2 - 6
platform-shop/src/main/java/com/platform/controller/TokenController.java

@@ -2,13 +2,12 @@ package com.platform.controller;
 
 import com.alibaba.fastjson.JSONObject;
 import com.platform.entity.Result;
-import com.platform.entity.SysUserEntity;
 import com.platform.enums.ResultCodeEnum;
 import com.platform.exception.CommonBaseException;
-import com.platform.service.SysUserService;
 import com.platform.service.impl.FdkkService;
 import com.platform.service.impl.ZhiHouseService;
 import com.platform.utils.Base64Converter;
+import com.platform.vos.CurrentUserLoginVo;
 import com.platform.vos.ReturnDTO;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -33,8 +32,6 @@ public class TokenController extends AbstractController{
     @Autowired
     private ZhiHouseService zhiHouseService;
 
-    @Autowired
-    private SysUserService sysUserService;
 
     @PostMapping("/renewToken")
     @ResponseBody
@@ -47,8 +44,7 @@ public class TokenController extends AbstractController{
         }
         // 判断场景为四维看看或者指房宝
         if(sceneUrl.contains("www.4dkankan.com") || sceneUrl.contains("test.4dkankan.com")){
-            Long userId = getUser().getUserId();
-            SysUserEntity user = sysUserService.queryObject(userId);
+            CurrentUserLoginVo user = getUser();
             if(ObjectUtils.isEmpty(user.getFdkkUser())){
                 throw new CommonBaseException(500, "请绑定四维看看账号!");
             }

+ 6 - 9
platform-shop/src/main/java/com/platform/service/impl/BrandServiceImpl.java

@@ -9,7 +9,6 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.platform.dao.BrandDao;
 import com.platform.entity.*;
 import com.platform.service.BrandService;
-import com.platform.service.SysUserService;
 import com.platform.service.custom.MySysUserBrandService;
 import com.platform.service.custom.TmBrandTypeService;
 import com.platform.utils.*;
@@ -62,8 +61,6 @@ public class BrandServiceImpl implements BrandService {
     @Autowired
     private MySysUserBrandService mySysUserBrandService;
 
-    @Autowired
-    private SysUserService sysUserService;
 
     @Value("${api.host.url}")
     private String apiHostQueryUrl;
@@ -343,11 +340,11 @@ public class BrandServiceImpl implements BrandService {
         brandEntity.setLivestreamStatus(0);
 
         CurrentUserLoginVo userEntity = ShiroUtils.getUserEntity();
-        brandEntity.setContractPhone(userEntity.getMobile());
+        brandEntity.setContractPhone(userEntity.getPhone());
         brandEntity.setPicList(sceneEntity.getAppListPicUrl());
-        brandEntity.setCreateUserId(userEntity.getUserId());
+        brandEntity.setCreateUserId(userEntity.getId());
         brandEntity.setSortOrder(100);
-        brandEntity.setCreateUserDeptId(userEntity.getDeptId());
+        brandEntity.setCreateUserDeptId(userEntity.getCompanyId());
         brandEntity.setAddress("浙江省,杭州市,萧山区 山阴路688号恒隆广场B座1217");
         brandEntity.setLongitude(new BigDecimal(120.262421));
         brandEntity.setLatitude(new BigDecimal(30.178317));
@@ -390,8 +387,8 @@ public class BrandServiceImpl implements BrandService {
             mySysUserBrandService.updateSysUserBrand(dbUserBrand);
         }else{
             //新增绑定关系
-            SysUserEntity sysUserEntity = sysUserService.queryObject(userId);
-            if(null == sysUserEntity){
+            CurrentUserLoginVo userEntity = ShiroUtils.getUserEntity();
+            if(null == userEntity){
                 log.info("用户不存在");
                 return;
             }
@@ -405,7 +402,7 @@ public class BrandServiceImpl implements BrandService {
             dbUserBrand.setUserId(userId);
             dbUserBrand.setCanShow(canShow);
             dbUserBrand.setEnable(1);
-            dbUserBrand.setPhoneNum(sysUserEntity.getMobile());
+            dbUserBrand.setPhoneNum(userEntity.getPhone());
             dbUserBrand.setSceneNum(brandEntity.getSceneNum());
             mySysUserBrandService.addRelation(dbUserBrand);
         }

+ 14 - 14
platform-shop/src/main/java/com/platform/service/impl/GoodsServiceImpl.java

@@ -11,6 +11,7 @@ import com.platform.service.GoodsSpecificationService;
 import com.platform.utils.RRException;
 import com.platform.utils.ShiroUtils;
 import com.platform.vo.GoodsSpecificationValueVo;
+import com.platform.vos.CurrentUserLoginVo;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -155,7 +156,7 @@ public class GoodsServiceImpl implements GoodsService {
     @Override
     @Transactional(rollbackFor = Exception.class)
     public int save(GoodsEntity goods) {
-        SysUserEntity user = ShiroUtils.getUserEntity();
+        CurrentUserLoginVo user = ShiroUtils.getUserEntity();
         Map<String, Object> map = new HashMap<>();
         map.put("name", goods.getName());
         List<GoodsEntity> list = queryList(map);
@@ -168,9 +169,8 @@ public class GoodsServiceImpl implements GoodsService {
         goods.setId(id);
 
         goods.setIsDelete(0);
-        goods.setCreateUserDeptId(user.getDeptId());
-        goods.setCreateUserId(user.getUserId());
-        goods.setUpdateUserId(user.getUserId());
+        goods.setCreateUserDeptId(user.getCompanyId());
+        goods.setUpdateUserId(user.getId());
         goods.setUpdateTime(new Date());
         goods.setAddTime(new Date());
 
@@ -265,8 +265,8 @@ public class GoodsServiceImpl implements GoodsService {
     @Override
     @Transactional
     public int update(GoodsEntity goods) {
-        SysUserEntity user = ShiroUtils.getUserEntity();
-        goods.setUpdateUserId(user.getUserId());
+        CurrentUserLoginVo user = ShiroUtils.getUserEntity();
+        goods.setUpdateUserId(user.getId());
         goods.setUpdateTime(new Date());
         goodsDao.update(goods);
 
@@ -372,11 +372,11 @@ public class GoodsServiceImpl implements GoodsService {
 
     @Override
     public int delete(Integer id) {
-        SysUserEntity user = ShiroUtils.getUserEntity();
+        CurrentUserLoginVo user = ShiroUtils.getUserEntity();
         GoodsEntity goodsEntity = queryObject(id);
         goodsEntity.setIsDelete(1);
         goodsEntity.setIsOnSale(0);
-        goodsEntity.setUpdateUserId(user.getUserId());
+        goodsEntity.setUpdateUserId(user.getId());
         goodsEntity.setUpdateTime(new Date());
         return goodsDao.update(goodsEntity);
     }
@@ -394,13 +394,13 @@ public class GoodsServiceImpl implements GoodsService {
     @Override
     @Transactional
     public int back(Integer[] ids) {
-        SysUserEntity user = ShiroUtils.getUserEntity();
+        CurrentUserLoginVo user = ShiroUtils.getUserEntity();
         int result = 0;
         for (Integer id : ids) {
             GoodsEntity goodsEntity = queryObject(id);
             goodsEntity.setIsDelete(0);
             goodsEntity.setIsOnSale(1);
-            goodsEntity.setUpdateUserId(user.getUserId());
+            goodsEntity.setUpdateUserId(user.getId());
             goodsEntity.setUpdateTime(new Date());
             result += goodsDao.update(goodsEntity);
         }
@@ -409,26 +409,26 @@ public class GoodsServiceImpl implements GoodsService {
 
     @Override
     public int enSale(Integer id) {
-        SysUserEntity user = ShiroUtils.getUserEntity();
+        CurrentUserLoginVo user = ShiroUtils.getUserEntity();
         GoodsEntity goodsEntity = queryObject(id);
         if (1 == goodsEntity.getIsOnSale()) {
             throw new RRException("此商品已处于上架状态!");
         }
         goodsEntity.setIsOnSale(1);
-        goodsEntity.setUpdateUserId(user.getUserId());
+        goodsEntity.setUpdateUserId(user.getId());
         goodsEntity.setUpdateTime(new Date());
         return goodsDao.update(goodsEntity);
     }
 
     @Override
     public int unSale(Integer id) {
-        SysUserEntity user = ShiroUtils.getUserEntity();
+        CurrentUserLoginVo user = ShiroUtils.getUserEntity();
         GoodsEntity goodsEntity = queryObject(id);
         if (0 == goodsEntity.getIsOnSale()) {
             throw new RRException("此商品已处于下架状态!");
         }
         goodsEntity.setIsOnSale(0);
-        goodsEntity.setUpdateUserId(user.getUserId());
+        goodsEntity.setUpdateUserId(user.getId());
         goodsEntity.setUpdateTime(new Date());
         return goodsDao.update(goodsEntity);
     }

+ 4 - 4
platform-shop/src/main/java/com/platform/task/TestTask.java

@@ -1,7 +1,7 @@
 package com.platform.task;
 
-import com.platform.entity.SysUserEntity;
-import com.platform.service.SysUserService;
+import com.platform.service.impl.ZhiHouseService;
+import com.platform.vos.TbUser;
 import org.apache.commons.lang.builder.ToStringBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -23,7 +23,7 @@ public class TestTask {
     private Logger logger = LoggerFactory.getLogger(getClass());
 
     @Autowired
-    private SysUserService sysUserService;
+    private ZhiHouseService zhiHouseService;
 
     public void test(String params) {
         logger.info("我是带参数的test方法,正在被执行,参数为:" + params);
@@ -34,7 +34,7 @@ public class TestTask {
             e.printStackTrace();
         }
 
-        SysUserEntity user = sysUserService.queryObject(1L);
+        TbUser user = zhiHouseService.getByUserId(1L);
         System.out.println(ToStringBuilder.reflectionToString(user));
 
     }