Commit 17184e80 by guojuxing

功能权限集

parent 88c2c599
......@@ -24,4 +24,6 @@ public interface FunctionApiService {
ServiceResponse<Page<FunctionDTO>> pageFunction(Integer enterpriseId, String functionName, Integer currentPage, Integer pageSize);
ServiceResponse<List<FunctionDTO>> listFunction(Integer enterpriseId, String functionName);
ServiceResponse<FunctionDTO> getFunction(Integer functionId);
}
......@@ -85,6 +85,11 @@ public class FunctionApiServiceImpl implements FunctionApiService{
.orElse(Collections.EMPTY_LIST));
}
@Override
public ServiceResponse<FunctionDTO> getFunction(Integer functionId) {
return ServiceResponse.success(EntityUtil.changeEntityNew(FunctionDTO.class, functionService.getFunction(functionId)));
}
private ServiceResponse<Void> validParam(FunctionDTO dto) {
if (dto.getFunctionId() != null) {
TabSysFunction record = functionService.getFunction(dto.getFunctionId());
......
package com.gic.cloud.web.controller;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gic.cloud.dto.FunctionDTO;
import com.gic.cloud.service.FunctionApiService;
import com.gic.cloud.web.vo.FunctionDetailVO;
import com.gic.cloud.web.vo.FunctionVO;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.utils.ResultControllerUtils;
import com.gic.enterprise.utils.UserDetailUtils;
@RestController
@RequestMapping("/function")
public class FunctionController {
private final static Logger LOGGER = LogManager.getLogger(FunctionController.class);
@Autowired
private FunctionApiService functionApiService;
@RequestMapping("/save-function")
public RestResponse saveFunction(FunctionDTO dto) {
dto.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
return ResultControllerUtils.commonResult(functionApiService.saveFunction(dto));
}
@RequestMapping("/edit-function")
public RestResponse editFunction(FunctionDTO dto) {
dto.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
return ResultControllerUtils.commonResult(functionApiService.editFunction(dto));
}
@RequestMapping("/get-function-detail")
public RestResponse getFunction(Integer functionId) {
return ResultControllerUtils.commonResultOne(functionApiService.getFunction(functionId), FunctionDetailVO.class);
}
@RequestMapping("/delete-function")
public RestResponse deleteFunction(Integer functionId) {
return ResultControllerUtils.commonResult(functionApiService.deleteFunction(functionId));
}
@RequestMapping("/page-function")
public RestResponse pageFunction(String functionName, Integer currentPage, Integer pageSize) {
return ResultControllerUtils.commonPageResult(functionApiService
.pageFunction(UserDetailUtils.getUserDetail().getEnterpriseId(), functionName, currentPage, pageSize), FunctionVO.class);
}
}
package com.gic.cloud.web.controller;
import com.gic.cloud.constants.FunctionEnum;
import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gic.cloud.dto.AccountGroupDTO;
import com.gic.cloud.dto.UserDTO;
import com.gic.cloud.qo.UserQO;
......@@ -12,15 +22,6 @@ import com.gic.cloud.web.vo.*;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.utils.ResultControllerUtils;
import com.gic.enterprise.utils.UserDetailUtils;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
import java.util.stream.Collectors;
@RestController
@RequestMapping("/user")
......@@ -76,7 +77,7 @@ public class UserController {
@RequestMapping("/get-user-detail")
public RestResponse getUserDetail(Integer userId) {
return ResultControllerUtils.commonResult(userApiService.getUser(userId), UserDetailVO.class);
return ResultControllerUtils.commonResultOne(userApiService.getUser(userId), UserDetailVO.class);
}
@RequestMapping("/delete-user")
......
package com.gic.cloud.web.vo;
import java.io.Serializable;
public class FunctionDetailVO implements Serializable{
private static final long serialVersionUID = -3211293345162922378L;
/**
* ID
*/
private Integer functionId;
/**
* 名称
*/
private String functionName;
/**
* 功能组件,_1_2_数据格式。1:排行榜 2:会员概况 3:招募分析 4:会员画像 5:业绩概览 6:消费构成 7:单品排行 8:基础业绩
*/
private String functionComponent;
public Integer getFunctionId() {
return functionId;
}
public FunctionDetailVO setFunctionId(Integer functionId) {
this.functionId = functionId;
return this;
}
public String getFunctionName() {
return functionName;
}
public FunctionDetailVO setFunctionName(String functionName) {
this.functionName = functionName;
return this;
}
public String getFunctionComponent() {
return functionComponent;
}
public FunctionDetailVO setFunctionComponent(String functionComponent) {
this.functionComponent = functionComponent;
return this;
}
}
package com.gic.cloud.web.vo;
import java.io.Serializable;
public class FunctionVO implements Serializable{
private static final long serialVersionUID = 2470057820888440245L;
/**
* ID
*/
private Integer functionId;
/**
* 名称
*/
private String functionName;
/**
* 授权用户人数
*/
private Integer memberCount;
public Integer getFunctionId() {
return functionId;
}
public FunctionVO setFunctionId(Integer functionId) {
this.functionId = functionId;
return this;
}
public String getFunctionName() {
return functionName;
}
public FunctionVO setFunctionName(String functionName) {
this.functionName = functionName;
return this;
}
public Integer getMemberCount() {
return memberCount;
}
public FunctionVO setMemberCount(Integer memberCount) {
this.memberCount = memberCount;
return this;
}
}
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