增加监督人员接口以及查看详情校验
This commit is contained in:
@ -564,4 +564,9 @@ public class ProjectCommonUtil {
|
|||||||
//谈判
|
//谈判
|
||||||
this.put("04",negotiationArray);
|
this.put("04",negotiationArray);
|
||||||
}};
|
}};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 集团编码
|
||||||
|
*/
|
||||||
|
public static final String PROVINCES_BLOC = "001000";
|
||||||
}
|
}
|
||||||
|
@ -175,6 +175,8 @@ public enum ProjectExceptionEnum implements BusinessExceptionAssert {
|
|||||||
FRAME_EXCEPTION_INQUIRY_ENTRUST_STATUS_ERROR(110081, "项目委托状态不正确(项目经理未接受)"),
|
FRAME_EXCEPTION_INQUIRY_ENTRUST_STATUS_ERROR(110081, "项目委托状态不正确(项目经理未接受)"),
|
||||||
|
|
||||||
FRAME_EXCEPTION_PROJECT_ENTRUST_AGENCY_COMPANY_EMPTY(110082, "项目委托信息代理机构ID为空!"),
|
FRAME_EXCEPTION_PROJECT_ENTRUST_AGENCY_COMPANY_EMPTY(110082, "项目委托信息代理机构ID为空!"),
|
||||||
|
|
||||||
|
FRAME_EXCEPTION_USER_PROVINCE_EMPTY(110083, "用户信息或者用户的所属省分编码为空!"),
|
||||||
;
|
;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2,10 +2,10 @@ package com.chinaunicom.mall.ebtp.project.feign;
|
|||||||
|
|
||||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||||
import com.chinaunicom.mall.ebtp.project.feign.entity.AgainRoomVO;
|
import com.chinaunicom.mall.ebtp.project.feign.entity.AgainRoomVO;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import io.swagger.annotations.ApiParam;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -35,4 +35,10 @@ public interface EbtpTenderApi {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/v1/supplier_register/package/tenderCount")
|
@PostMapping("/v1/supplier_register/package/tenderCount")
|
||||||
BaseResponse<Map<String, Long>> getRegisterCountByPackage(@RequestBody List<String> list);
|
BaseResponse<Map<String, Long>> getRegisterCountByPackage(@RequestBody List<String> list);
|
||||||
|
|
||||||
|
|
||||||
|
@ApiOperation("查询供应商是否报名该项目")
|
||||||
|
@GetMapping("/v1/supplier_register/query/tendered/{projectId}/{userId}")
|
||||||
|
BaseResponse<Boolean> queryTenderedUser(@ApiParam(value = "项目id", required = true) @PathVariable String projectId,
|
||||||
|
@ApiParam(value = "用户id", required = true) @PathVariable String userId);
|
||||||
}
|
}
|
||||||
|
@ -234,4 +234,28 @@ public class ProjectRecordController{
|
|||||||
return BaseResponse.success(projectRecordService.getPageByPurchase(projectRecord));
|
return BaseResponse.success(projectRecordService.getPageByPurchase(projectRecord));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监督人员查询分页数据
|
||||||
|
* @param projectRecord 分页信息
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@ApiOperation("监督人员查询分页数据")
|
||||||
|
@PostMapping("/supervisor/getPage")
|
||||||
|
public BaseResponse<IPage<ProjectRecordVO>> getPageBySupervisor(@ApiParam(value = "对象数据", required = true) @RequestBody ProjectRecordVO projectRecord){
|
||||||
|
|
||||||
|
return BaseResponse.success(projectRecordService.getPageBySupervisor(projectRecord));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据项目ID查看权限和项目信息
|
||||||
|
* @param id 项目ID
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
@ApiOperation("根据项目ID查看权限和项目信息")
|
||||||
|
@PostMapping("/getRoleVerification/{id}")
|
||||||
|
public BaseResponse<Map<String,Object>> getRoleVerification(@ApiParam(value = "主键id", required = true) @PathVariable String id){
|
||||||
|
|
||||||
|
return BaseResponse.success(projectRecordService.getRoleVerification(id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -178,4 +178,18 @@ public interface IProjectRecordService extends IBaseService<ProjectRecord>{
|
|||||||
* @param vo 项目信息
|
* @param vo 项目信息
|
||||||
*/
|
*/
|
||||||
void getLinkPercentage(ProjectSectionVO sectionVO, ProjectRecordVO vo);
|
void getLinkPercentage(ProjectSectionVO sectionVO, ProjectRecordVO vo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检察人员查看分页信息
|
||||||
|
* @param projectRecord 项目信息
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
IPage<ProjectRecordVO> getPageBySupervisor(ProjectRecordVO projectRecord);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据项目ID查看权限和项目信息
|
||||||
|
* @param id 项目ID
|
||||||
|
* @return 返回结果
|
||||||
|
*/
|
||||||
|
Map<String,Object> getRoleVerification(String id);
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,13 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.chinaunicom.mall.ebtp.cloud.security.starter.entity.AuthorityEntity;
|
||||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseCacheUser;
|
import com.chinaunicom.mall.ebtp.common.base.entity.BaseCacheUser;
|
||||||
import com.chinaunicom.mall.ebtp.common.base.entity.BasePageRequest;
|
import com.chinaunicom.mall.ebtp.common.base.entity.BasePageRequest;
|
||||||
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
|
||||||
import com.chinaunicom.mall.ebtp.common.base.service.IBaseCacheUserService;
|
import com.chinaunicom.mall.ebtp.common.base.service.IBaseCacheUserService;
|
||||||
import com.chinaunicom.mall.ebtp.common.base.service.impl.BaseServiceImpl;
|
import com.chinaunicom.mall.ebtp.common.base.service.impl.BaseServiceImpl;
|
||||||
|
import com.chinaunicom.mall.ebtp.common.constant.EbtpRoleEnum;
|
||||||
import com.chinaunicom.mall.ebtp.common.exception.common.CommonExceptionEnum;
|
import com.chinaunicom.mall.ebtp.common.exception.common.CommonExceptionEnum;
|
||||||
import com.chinaunicom.mall.ebtp.common.util.JsonUtils;
|
import com.chinaunicom.mall.ebtp.common.util.JsonUtils;
|
||||||
import com.chinaunicom.mall.ebtp.common.util.PropertyUtils;
|
import com.chinaunicom.mall.ebtp.common.util.PropertyUtils;
|
||||||
@ -1117,4 +1119,91 @@ public class ProjectRecordServiceImpl extends BaseServiceImpl<ProjectRecordMappe
|
|||||||
sectionVO.setLinkCount(businessModuleTotal);
|
sectionVO.setLinkCount(businessModuleTotal);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPage<ProjectRecordVO> getPageBySupervisor(ProjectRecordVO projectRecordVO) {
|
||||||
|
|
||||||
|
QueryWrapper<ProjectRecord> query = getProjectRecordQueryWrapper(projectRecordVO);
|
||||||
|
|
||||||
|
if(null == projectRecordVO.getBasePageRequest()){
|
||||||
|
projectRecordVO.setBasePageRequest(new BasePageRequest());
|
||||||
|
}
|
||||||
|
|
||||||
|
BaseCacheUser cacheUser = cacheUserService.getCacheUser();
|
||||||
|
|
||||||
|
if(null == cacheUser || StringUtils.isEmpty(cacheUser.getProvince())){
|
||||||
|
ProjectExceptionEnum.FRAME_EXCEPTION_USER_PROVINCE_EMPTY.throwException();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!StringUtils.equals(ProjectCommonUtil.PROVINCES_BLOC,cacheUser.getProvince())){
|
||||||
|
query.eq("province", cacheUser.getProvince());
|
||||||
|
}
|
||||||
|
|
||||||
|
query.orderByDesc("create_date");
|
||||||
|
//查询
|
||||||
|
IPage<ProjectRecord> p = new Page<>(projectRecordVO.getBasePageRequest().getPageNo(), projectRecordVO.getBasePageRequest().getPageSize());
|
||||||
|
IPage<ProjectRecord> result = this.page(p, query);
|
||||||
|
|
||||||
|
IPage<ProjectRecordVO> voPage = result.convert(c -> BeanUtil.toBean(c,ProjectRecordVO.class));
|
||||||
|
assembleProjectPage(voPage.getRecords());
|
||||||
|
|
||||||
|
return voPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 跳转判断查看项目权限
|
||||||
|
* @param record 项目信息
|
||||||
|
* @return 返回权限信息
|
||||||
|
*/
|
||||||
|
private List<AuthorityEntity> checkSupervisor(ProjectRecord record){
|
||||||
|
|
||||||
|
//获取用户信息
|
||||||
|
BaseCacheUser user = cacheUserService.getCacheUser();
|
||||||
|
//获取用户角色信息
|
||||||
|
List<AuthorityEntity> authorityList = user.getAuthorityList();
|
||||||
|
//返回角色信息
|
||||||
|
List<AuthorityEntity> resultList = new ArrayList<>();
|
||||||
|
|
||||||
|
//遍历用户角色 并进行相应的权限判断
|
||||||
|
for (AuthorityEntity authority: authorityList) {
|
||||||
|
//是否项目经理角色
|
||||||
|
if(StringUtils.equals(EbtpRoleEnum.AGENCY_PROJECT_MANAGER.getRole(),authority.getRoleCode()) &&
|
||||||
|
StringUtils.equals(record.getAppManagerId(),user.getUserId())){
|
||||||
|
resultList.add(authority);
|
||||||
|
}
|
||||||
|
//是否采购经理角色
|
||||||
|
if(StringUtils.equals(EbtpRoleEnum.PURCHASE_MANAGER.getRole(),authority.getRoleCode()) &&
|
||||||
|
StringUtils.equals(record.getOwnerContactId(),user.getUserId())){
|
||||||
|
resultList.add(authority);
|
||||||
|
}
|
||||||
|
//是否供应商角色
|
||||||
|
if(StringUtils.equals(EbtpRoleEnum.SUPPLIER.getRole(),authority.getRoleCode())){
|
||||||
|
boolean retFlag = tenderApi.queryTenderedUser(record.getId(),user.getUserId()).getData();
|
||||||
|
if(retFlag){
|
||||||
|
resultList.add(authority);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//是否监督人员
|
||||||
|
if(StringUtils.equals(EbtpRoleEnum.SYSTEM_SUPERVISION.getRole(),authority.getRoleCode())){
|
||||||
|
if(StringUtils.equals(ProjectCommonUtil.PROVINCES_BLOC,user.getProvince()) ||
|
||||||
|
StringUtils.equals(user.getProvince(),record.getProvince())){
|
||||||
|
resultList.add(authority);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return resultList;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, Object> getRoleVerification(String id) {
|
||||||
|
|
||||||
|
Map<String, Object> resultMap = new LinkedHashMap<>();
|
||||||
|
|
||||||
|
ProjectRecord record = this.getById(id);
|
||||||
|
List<AuthorityEntity> authorityList = checkSupervisor(record);
|
||||||
|
|
||||||
|
resultMap.put("record",record);
|
||||||
|
resultMap.put("authorityList",authorityList);
|
||||||
|
return resultMap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user