|  | @@ -1,17 +1,25 @@
 | 
	
		
			
				|  |  |  package com.ym.mec.web.controller;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -import com.ym.mec.biz.dal.page.MemberPrivilegesItemQueryInfo;
 | 
	
		
			
				|  |  | +import com.ym.mec.auth.api.client.SysUserFeignService;
 | 
	
		
			
				|  |  | +import com.ym.mec.auth.api.entity.SysUser;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.dao.EmployeeDao;
 | 
	
		
			
				|  |  | +import com.ym.mec.biz.dal.entity.Employee;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.entity.MemberRankOrganizationFeeMapper;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.dal.page.MemberRankFeeQueryInfo;
 | 
	
		
			
				|  |  |  import com.ym.mec.biz.service.MemberRankOrganizationFeeMapperService;
 | 
	
		
			
				|  |  |  import com.ym.mec.common.controller.BaseController;
 | 
	
		
			
				|  |  | +import com.ym.mec.common.exception.BizException;
 | 
	
		
			
				|  |  |  import com.yonge.log.model.AuditLogAnnotation;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.Api;
 | 
	
		
			
				|  |  |  import io.swagger.annotations.ApiOperation;
 | 
	
		
			
				|  |  | +import org.apache.commons.lang3.StringUtils;
 | 
	
		
			
				|  |  |  import org.springframework.beans.factory.annotation.Autowired;
 | 
	
		
			
				|  |  |  import org.springframework.security.access.prepost.PreAuthorize;
 | 
	
		
			
				|  |  |  import org.springframework.web.bind.annotation.*;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +import java.util.Arrays;
 | 
	
		
			
				|  |  | +import java.util.List;
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |  @RequestMapping("memberRankOrganizationFeeMapper")
 | 
	
		
			
				|  |  |  @Api(tags = "会员收费设置服务")
 | 
	
		
			
				|  |  |  @RestController
 | 
	
	
		
			
				|  | @@ -19,21 +27,17 @@ public class MemberRankOrganizationFeeMapperController extends BaseController {
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @Autowired
 | 
	
		
			
				|  |  |      private MemberRankOrganizationFeeMapperService memberRankOrganizationFeeMapperService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private SysUserFeignService sysUserFeignService;
 | 
	
		
			
				|  |  | +    @Autowired
 | 
	
		
			
				|  |  | +    private EmployeeDao employeeDao;
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      @ApiOperation(value = "新增")
 | 
	
		
			
				|  |  |      @PostMapping("/add")
 | 
	
		
			
				|  |  |      @PreAuthorize("@pcs.hasPermissions('memberRankOrganizationFeeMapper/add')")
 | 
	
		
			
				|  |  |      @AuditLogAnnotation(operateName = "新增系统功能类型")
 | 
	
		
			
				|  |  |      public Object add(@RequestBody MemberRankOrganizationFeeMapper memberRankOrganizationFeeMapper) {
 | 
	
		
			
				|  |  | -        memberRankOrganizationFeeMapperService.insert(memberRankOrganizationFeeMapper);
 | 
	
		
			
				|  |  | -        return succeed();
 | 
	
		
			
				|  |  | -    }
 | 
	
		
			
				|  |  | -
 | 
	
		
			
				|  |  | -    @ApiOperation(value = "删除")
 | 
	
		
			
				|  |  | -    @PostMapping("/del")
 | 
	
		
			
				|  |  | -    @PreAuthorize("@pcs.hasPermissions('memberPrivilegesItem/del')")
 | 
	
		
			
				|  |  | -    public Object del(Integer id) {
 | 
	
		
			
				|  |  | -        memberPrivilegesItemService.recursiveDel(id);
 | 
	
		
			
				|  |  | +        memberRankOrganizationFeeMapperService.add(memberRankOrganizationFeeMapper);
 | 
	
		
			
				|  |  |          return succeed();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
	
		
			
				|  | @@ -45,10 +49,32 @@ public class MemberRankOrganizationFeeMapperController extends BaseController {
 | 
	
		
			
				|  |  |          return succeed();
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | +    @ApiOperation(value = "修改")
 | 
	
		
			
				|  |  | +    @PostMapping("/get")
 | 
	
		
			
				|  |  | +    @PreAuthorize("@pcs.hasPermissions('memberRankOrganizationFeeMapper/get')")
 | 
	
		
			
				|  |  | +    public Object get(Integer id) {
 | 
	
		
			
				|  |  | +        return succeed(memberRankOrganizationFeeMapperService.get(id));
 | 
	
		
			
				|  |  | +    }
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  |      @ApiOperation(value = "分页查询")
 | 
	
		
			
				|  |  |      @GetMapping("/queryPage")
 | 
	
		
			
				|  |  |      @PreAuthorize("@pcs.hasPermissions('memberRankOrganizationFeeMapper/queryPage')")
 | 
	
		
			
				|  |  |      public Object queryPage(MemberRankFeeQueryInfo queryInfo) {
 | 
	
		
			
				|  |  | +        SysUser sysUser = sysUserFeignService.queryUserInfo();
 | 
	
		
			
				|  |  | +        if (sysUser == null) {
 | 
	
		
			
				|  |  | +            throw new BizException("用户信息获取失败");
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +        Employee employee = employeeDao.get(sysUser.getId());
 | 
	
		
			
				|  |  | +        if (StringUtils.isEmpty(queryInfo.getOrganId())) {
 | 
	
		
			
				|  |  | +            queryInfo.setOrganId(employee.getOrganIdList());
 | 
	
		
			
				|  |  | +        }else if(StringUtils.isEmpty(employee.getOrganIdList())){
 | 
	
		
			
				|  |  | +            throw new BizException("用户所在分部异常");
 | 
	
		
			
				|  |  | +        }else {
 | 
	
		
			
				|  |  | +            List<String> list = Arrays.asList(employee.getOrganIdList().split(","));
 | 
	
		
			
				|  |  | +            if(!list.containsAll(Arrays.asList(queryInfo.getOrganId().split(",")))){
 | 
	
		
			
				|  |  | +                throw new BizException("非法请求");
 | 
	
		
			
				|  |  | +            }
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  |          return succeed(memberRankOrganizationFeeMapperService.queryPage(queryInfo));
 | 
	
		
			
				|  |  |      }
 | 
	
		
			
				|  |  |  }
 |