Commit a73e2fb2 authored by 赵啸非's avatar 赵啸非

修改站点权限分配

parent ed6ce31b
...@@ -102,12 +102,13 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi ...@@ -102,12 +102,13 @@ public class LoginController extends BaseCRUDJsonBodyMappingController<UserServi
data.put("userType", userEntity.getUserType()); data.put("userType", userEntity.getUserType());
userEntity.setLoginTime(System.currentTimeMillis()); userEntity.setLoginTime(System.currentTimeMillis());
userEntity.setToken(IdUtil.fastSimpleUUID()); userEntity.setToken(IdUtil.fastSimpleUUID());
userEntity.setExpireTime(DateUtils.addCurrDate(7).getTime());
userEntity.setMenuUrl(generateMenuUrlCode(urls)); userEntity.setMenuUrl(generateMenuUrlCode(urls));
String token = authTokenService.createToken(userEntity); String token = authTokenService.createToken(userEntity);
data.put("token", token); data.put("token", token);
//设置token 和过期时间 //设置token 和过期时间
data.put("expiresTime", DateUtils.addCurrDate(7).getTime()); //data.put("expiresTime", DateUtils.addCurrDate(7).getTime());
generateMenuUrlCode(urls); generateMenuUrlCode(urls);
//this.generateBlackCookie(request, response, loginName, urls); //this.generateBlackCookie(request, response, loginName, urls);
ret.put(KEY_RESULT_DATA, data); ret.put(KEY_RESULT_DATA, data);
......
package com.mortals.xhx.module.business.service; package com.mortals.xhx.module.business.service;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result; import com.mortals.framework.model.Result;
import com.mortals.framework.service.ICRUDCacheService;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.business.model.BusinessEntity; import com.mortals.xhx.module.business.model.BusinessEntity;
import com.mortals.xhx.module.business.model.BusinessTreeSelect; import com.mortals.xhx.module.business.model.BusinessTreeSelect;
...@@ -17,7 +18,7 @@ import org.springframework.web.bind.annotation.RequestParam; ...@@ -17,7 +18,7 @@ import org.springframework.web.bind.annotation.RequestParam;
* @author zxfei * @author zxfei
* @date 2022-01-13 * @date 2022-01-13
*/ */
public interface BusinessService extends ICRUDService<BusinessEntity,Long>{ public interface BusinessService extends ICRUDCacheService<BusinessEntity,Long> {
/** /**
* 添加业务到站点 * 添加业务到站点
* @param businessIds * @param businessIds
......
...@@ -3,6 +3,7 @@ package com.mortals.xhx.module.business.service.impl; ...@@ -3,6 +3,7 @@ package com.mortals.xhx.module.business.service.impl;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result; import com.mortals.framework.model.Result;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.xhx.common.code.IsBusinessEnum; import com.mortals.xhx.common.code.IsBusinessEnum;
import com.mortals.xhx.common.utils.BeanUtil; import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.module.site.model.SiteBusinessEntity; import com.mortals.xhx.module.site.model.SiteBusinessEntity;
...@@ -37,7 +38,7 @@ import static com.mortals.framework.ap.SysConstains.RESULT_KEY; ...@@ -37,7 +38,7 @@ import static com.mortals.framework.ap.SysConstains.RESULT_KEY;
* @date 2022-01-13 * @date 2022-01-13
*/ */
@Service("businessService") @Service("businessService")
public class BusinessServiceImpl extends AbstractCRUDServiceImpl<BusinessDao, BusinessEntity, Long> implements BusinessService { public class BusinessServiceImpl extends AbstractCRUDCacheServiceImpl<BusinessDao, BusinessEntity, Long> implements BusinessService {
@Autowired @Autowired
private SiteBusinessService siteBusinessService; private SiteBusinessService siteBusinessService;
@Autowired @Autowired
......
package com.mortals.xhx.module.site.service; package com.mortals.xhx.module.site.service;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.ICRUDCacheService;
import com.mortals.framework.service.ICRUDService; import com.mortals.framework.service.ICRUDService;
import com.mortals.xhx.module.business.model.BusinessEntity;
import com.mortals.xhx.module.site.model.SiteBusinessEntity; import com.mortals.xhx.module.site.model.SiteBusinessEntity;
import com.mortals.xhx.module.site.model.SiteBusinessTreeSelect; import com.mortals.xhx.module.site.model.SiteBusinessTreeSelect;
import java.util.List; import java.util.List;
...@@ -13,7 +17,7 @@ import com.mortals.framework.model.Context; ...@@ -13,7 +17,7 @@ import com.mortals.framework.model.Context;
* @author zxfei * @author zxfei
* @date 2022-01-13 * @date 2022-01-13
*/ */
public interface SiteBusinessService extends ICRUDService<SiteBusinessEntity,Long>{ public interface SiteBusinessService extends ICRUDCacheService<SiteBusinessEntity,Long> {
/** /**
* 是否存在站点事项节点 * 是否存在站点事项节点
...@@ -41,4 +45,8 @@ public interface SiteBusinessService extends ICRUDService<SiteBusinessEntity,Lon ...@@ -41,4 +45,8 @@ public interface SiteBusinessService extends ICRUDService<SiteBusinessEntity,Lon
*/ */
List<SiteBusinessTreeSelect> buildSiteBusinessTreeSelect(List<SiteBusinessEntity> siteBusinessList); List<SiteBusinessTreeSelect> buildSiteBusinessTreeSelect(List<SiteBusinessEntity> siteBusinessList);
Result<SiteBusinessEntity> flatList(SiteBusinessEntity query, PageInfo pageInfo, Context context);
} }
\ No newline at end of file
package com.mortals.xhx.module.site.service.impl; package com.mortals.xhx.module.site.service.impl;
import com.mortals.framework.model.PageInfo; import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.service.impl.AbstractCRUDCacheServiceImpl;
import com.mortals.xhx.module.business.model.BusinessEntity; import com.mortals.xhx.module.business.model.BusinessEntity;
import com.mortals.xhx.module.business.model.BusinessQuery; import com.mortals.xhx.module.business.model.BusinessQuery;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -26,7 +28,7 @@ import java.util.stream.Collectors; ...@@ -26,7 +28,7 @@ import java.util.stream.Collectors;
* @date 2022-01-13 * @date 2022-01-13
*/ */
@Service("siteBusinessService") @Service("siteBusinessService")
public class SiteBusinessServiceImpl extends AbstractCRUDServiceImpl<SiteBusinessDao, SiteBusinessEntity, Long> implements SiteBusinessService { public class SiteBusinessServiceImpl extends AbstractCRUDCacheServiceImpl<SiteBusinessDao, SiteBusinessEntity, Long> implements SiteBusinessService {
@Override @Override
...@@ -99,6 +101,12 @@ public class SiteBusinessServiceImpl extends AbstractCRUDServiceImpl<SiteBusines ...@@ -99,6 +101,12 @@ public class SiteBusinessServiceImpl extends AbstractCRUDServiceImpl<SiteBusines
return returnList.stream().map(SiteBusinessTreeSelect::new).collect(Collectors.toList()); return returnList.stream().map(SiteBusinessTreeSelect::new).collect(Collectors.toList());
} }
@Override
public Result<SiteBusinessEntity> flatList(SiteBusinessEntity query, PageInfo pageInfo, Context context) {
Result<SiteBusinessEntity> result = this.dao.getList(query, pageInfo);
return result;
}
/** /**
* 递归列表 * 递归列表
......
...@@ -3,6 +3,8 @@ package com.mortals.xhx.module.site.web; ...@@ -3,6 +3,8 @@ package com.mortals.xhx.module.site.web;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.exception.AppException; import com.mortals.framework.exception.AppException;
import com.mortals.framework.model.Context; import com.mortals.framework.model.Context;
import com.mortals.framework.model.PageInfo;
import com.mortals.framework.model.Result;
import com.mortals.framework.util.StringUtils; import com.mortals.framework.util.StringUtils;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.framework.web.BasePhpCRUDJsonMappingController; import com.mortals.framework.web.BasePhpCRUDJsonMappingController;
...@@ -17,6 +19,7 @@ import org.apache.commons.lang3.ArrayUtils; ...@@ -17,6 +19,7 @@ import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -108,4 +111,31 @@ public class SiteBusinessController extends BaseCRUDJsonBodyMappingController<Si ...@@ -108,4 +111,31 @@ public class SiteBusinessController extends BaseCRUDJsonBodyMappingController<Si
return ret.toJSONString(); return ret.toJSONString();
} }
/**
* 查询站点业务扁平结构
*/
@PostMapping(value = "flatList")
public String flatList(@RequestBody SiteBusinessEntity query) {
JSONObject jsonObject = new JSONObject();
Map<String, Object> model = new HashMap<>();
String busiDesc = "查询" + this.getModuleDesc();
try {
PageInfo pageInfo = buildPageInfo(query);
Result<SiteBusinessEntity> result = this.service.flatList(query, pageInfo, getContext());
model.put(KEY_RESULT_DATA, result.getList());
parsePageInfo(model, result.getPageInfo());
recordSysLog(request, busiDesc + " 【成功】");
jsonObject.put(KEY_RESULT_DATA, model);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
jsonObject.put(KEY_RESULT_MSG, "查询站点业务列表成功!");
} catch (Exception e) {
log.error("获取异常", e);
jsonObject.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
jsonObject.put(KEY_RESULT_MSG, super.convertException(e));
}
return jsonObject.toJSONString();
}
} }
\ No newline at end of file
...@@ -6616,6 +6616,70 @@ dict|object|字典对象|- ...@@ -6616,6 +6616,70 @@ dict|object|字典对象|-
} }
``` ```
### 查询业务列表(非树形)
**请求URL:** site/business/flatList
**请求方式:** POST
**内容类型:** application/json;charset=utf-8
**简要描述:** 查询站点业务
**请求参数:**
参数名称|类型|备注|必填|其它
---|---|---|---|---
page|Integer|当前页|否|-
size|Integer|每页条数|否|-1查询全部
siteId|Long|站点Id|否|-
**请求样例:**
```
{
"siteId":12321,
"page":1,
"size":10
}
```
**响应参数:**
参数名称 |参数类型|备注|其它
---|---|---|---
code|Integer|结果码(-1.失败,1.成功)|-
msg|String|消息|-
data|object|数据对象|-
&emsp;per_page|Integer|每页条数|-
&emsp;total|Integer|总条数|-
&emsp;last_page|Integer|总页数|-
&emsp;current_page|Integer|当前页|-
&emsp;data|array|结果集列表|数组
&emsp;&emsp;id|Long|序号,主键,自增长|-
&emsp;&emsp;siteId|Long|站点ID|-
&emsp;&emsp;siteName|String|站点名称|-
&emsp;&emsp;ancestors|String|祖级列表,逗号分隔|-
&emsp;&emsp;businessId|Long|业务ID|-
&emsp;&emsp;isBusiness|Integer|业务类型(0.一级业务,1.二级业务)|-
&emsp;&emsp;parentId|Long|业务父级ID|-
&emsp;&emsp;businessName|String|业务名称|-
&emsp;&emsp;status|Integer|业务状态 (0.停用,1.正常)|-
&emsp;&emsp;createTime|Date|创建时间|-
&emsp;&emsp;createUserId|Long|创建用户|-
&emsp;&emsp;updateTime|Date|修改时间|-
dict|object|字典对象|-
&emsp;isBusiness|object|字典属性对象,详见附录|-
&emsp;status|object|字典属性对象,详见附录|-
**响应消息样例:**
```
{
}
```
### 编辑站点业务 ### 编辑站点业务
**请求URL:** site/business/edit **请求URL:** site/business/edit
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment