项目库-认证目录开发。
This commit is contained in:
+162
@@ -0,0 +1,162 @@
|
||||
package com.jero.modules.project.controller;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.modules.project.entity.ProjectCertificationDirectoryEO;
|
||||
import com.jero.modules.project.service.IProjectCertificationDirectoryEOService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
|
||||
/**
|
||||
* @Description: 项目库-认证目录表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-05-23
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="项目库-认证目录表")
|
||||
@RestController
|
||||
@RequestMapping("/project/projectCertificationDirectoryEO")
|
||||
@Slf4j
|
||||
public class ProjectCertificationDirectoryEOController extends JeroController<ProjectCertificationDirectoryEO, IProjectCertificationDirectoryEOService> {
|
||||
@Autowired
|
||||
private IProjectCertificationDirectoryEOService projectCertificationDirectoryEOService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param projectCertificationDirectoryEO
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "项目库-认证目录表-分页列表查询")
|
||||
@ApiOperation(value="项目库-认证目录表-分页列表查询", notes="项目库-认证目录表-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(ProjectCertificationDirectoryEO projectCertificationDirectoryEO,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
return projectCertificationDirectoryEOService.queryPageList(projectCertificationDirectoryEO,pageNo,pageSize,req);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "项目库-认证目录表-列表查询")
|
||||
@ApiOperation(value="项目库-认证目录表-列表查询", notes="项目库-认证目录表-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<ProjectCertificationDirectoryEO>> queryList() {
|
||||
List<ProjectCertificationDirectoryEO> list = projectCertificationDirectoryEOService.queryList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param projectCertificationDirectoryEO
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "项目库-认证目录表-添加")
|
||||
@ApiOperation(value="项目库-认证目录表-添加", notes="项目库-认证目录表-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody ProjectCertificationDirectoryEO projectCertificationDirectoryEO) {
|
||||
projectCertificationDirectoryEOService.add(projectCertificationDirectoryEO);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param projectCertificationDirectoryEO
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "项目库-认证目录表-编辑")
|
||||
@ApiOperation(value="项目库-认证目录表-编辑", notes="项目库-认证目录表-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody ProjectCertificationDirectoryEO projectCertificationDirectoryEO) {
|
||||
projectCertificationDirectoryEOService.editById(projectCertificationDirectoryEO);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "项目库-认证目录表-通过id删除")
|
||||
@ApiOperation(value="项目库-认证目录表-通过id删除", notes="项目库-认证目录表-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id,@RequestParam(name="cut",required=true) String cut) {
|
||||
projectCertificationDirectoryEOService.deleteById(id,cut);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "项目库-认证目录表-批量删除")
|
||||
@ApiOperation(value="项目库-认证目录表-批量删除", notes="项目库-认证目录表-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids,@RequestParam(name="cut",required=true) String cut) {
|
||||
this.projectCertificationDirectoryEOService.deleteByIds(Arrays.asList(ids.split(",")),cut);
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "项目库-认证目录表-通过id查询")
|
||||
@ApiOperation(value="项目库-认证目录表-通过id查询", notes="项目库-认证目录表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
ProjectCertificationDirectoryEO projectCertificationDirectoryEO = projectCertificationDirectoryEOService.queryById(id);
|
||||
if(projectCertificationDirectoryEO==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(projectCertificationDirectoryEO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param projectCertificationDirectoryEO
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, ProjectCertificationDirectoryEO projectCertificationDirectoryEO) {
|
||||
return super.exportXls(request, projectCertificationDirectoryEO, ProjectCertificationDirectoryEO.class, "项目库-认证目录表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, ProjectCertificationDirectoryEO.class);
|
||||
}
|
||||
|
||||
}
|
||||
+109
@@ -0,0 +1,109 @@
|
||||
package com.jero.modules.project.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import org.jeecgframework.poi.excel.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 项目库-认证目录表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-05-23
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("project_certification_directory")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="project_certification_directory对象", description="项目库-认证目录表")
|
||||
public class ProjectCertificationDirectoryEO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private Date createTime;
|
||||
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private Date updateTime;
|
||||
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
|
||||
/**项目库id*/
|
||||
@Excel(name = "项目库id", width = 15)
|
||||
@ApiModelProperty(value = "项目库id")
|
||||
private String projectLibraryId;
|
||||
|
||||
/**目录名称*/
|
||||
@Excel(name = "目录名称", width = 15)
|
||||
@ApiModelProperty(value = "目录名称")
|
||||
private String directoryName;
|
||||
|
||||
/**批次*/
|
||||
@Excel(name = "批次", width = 15)
|
||||
@ApiModelProperty(value = "批次")
|
||||
private String lot;
|
||||
|
||||
/**目录文件(文件)*/
|
||||
@Excel(name = "目录文件(文件)", width = 15)
|
||||
@ApiModelProperty(value = "目录文件(文件)")
|
||||
private String directoryFile;
|
||||
|
||||
/**实验方案(文件)*/
|
||||
@Excel(name = "实验方案(文件)", width = 15)
|
||||
@ApiModelProperty(value = "实验方案(文件)")
|
||||
private String experimentFile;
|
||||
|
||||
/**检测报告位置*/
|
||||
@Excel(name = "检测报告位置", width = 15)
|
||||
@ApiModelProperty(value = "检测报告位置")
|
||||
private String detectionReportLocation;
|
||||
|
||||
/**说明*/
|
||||
@Excel(name = "说明", width = 15)
|
||||
@ApiModelProperty(value = "说明")
|
||||
private String explainInfo;
|
||||
|
||||
/**上传时间*/
|
||||
@Excel(name = "上传时间", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "上传时间")
|
||||
private Date uploadTime;
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private String cut;
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.jero.modules.project.mapper;
|
||||
|
||||
import com.jero.modules.project.entity.ProjectCertificationDirectoryEO;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
/**
|
||||
* @Description: 项目库-认证目录表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-05-23
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ProjectCertificationDirectoryEOMapper extends BaseMapper<ProjectCertificationDirectoryEO> {
|
||||
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
<?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.jero.modules.project.mapper.ProjectCertificationDirectoryEOMapper">
|
||||
<resultMap id="ProjectCertificationDirectoryEOResultMap" type="com.jero.modules.project.entity.ProjectCertificationDirectoryEO">
|
||||
<id column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="sys_org_code" property="sysOrgCode" />
|
||||
<result column="project_library_id" property="projectLibraryId" />
|
||||
<result column="directory_name" property="directoryName" />
|
||||
<result column="lot" property="lot" />
|
||||
<result column="directory_file" property="directoryFile" />
|
||||
<result column="experiment_file" property="experimentFile" />
|
||||
<result column="detection_report_location" property="detectionReportLocation" />
|
||||
<result column="explain_info" property="explainInfo" />
|
||||
<result column="upload_time" property="uploadTime" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
package com.jero.modules.project.service;
|
||||
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.modules.project.entity.ProjectCertificationDirectoryEO;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 项目库-认证目录表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-05-23
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IProjectCertificationDirectoryEOService extends IService<ProjectCertificationDirectoryEO> {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param projectCertificationDirectoryEO
|
||||
* @return
|
||||
*/
|
||||
void add(ProjectCertificationDirectoryEO projectCertificationDirectoryEO);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param projectCertificationDirectoryEO
|
||||
* @return
|
||||
*/
|
||||
void editById(ProjectCertificationDirectoryEO projectCertificationDirectoryEO);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id,String cut);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids,String cut);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
ProjectCertificationDirectoryEO queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<ProjectCertificationDirectoryEO> queryList();
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param projectCertificationDirectoryEO
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
Result<?> queryPageList(ProjectCertificationDirectoryEO projectCertificationDirectoryEO, Integer pageNo, Integer pageSize, HttpServletRequest req);
|
||||
}
|
||||
+225
@@ -0,0 +1,225 @@
|
||||
package com.jero.modules.project.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.modules.project.entity.ProjectCertificationDirectoryEO;
|
||||
import com.jero.modules.project.entity.ProjectLawsInventoryEO;
|
||||
import com.jero.modules.project.entity.ProjectLibraryBase;
|
||||
import com.jero.modules.project.enums.ProjectRoleEnum;
|
||||
import com.jero.modules.project.mapper.ProjectCertificationDirectoryEOMapper;
|
||||
import com.jero.modules.project.mapper.ProjectLawsInventoryEOMapper;
|
||||
import com.jero.modules.project.mapper.ProjectLibraryBaseMapper;
|
||||
import com.jero.modules.project.service.IProjectCertificationDirectoryEOService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
/**
|
||||
* @Description: 项目库-认证目录表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-05-23
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class ProjectCertificationDirectoryEOServiceImpl extends ServiceImpl<ProjectCertificationDirectoryEOMapper, ProjectCertificationDirectoryEO> implements IProjectCertificationDirectoryEOService {
|
||||
|
||||
@Autowired
|
||||
private ProjectLibraryBaseMapper projectLibraryBaseMapper;
|
||||
|
||||
@Autowired
|
||||
private ProjectLawsInventoryEOMapper projectLawsInventoryEOMapper;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param projectCertificationDirectoryEO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(ProjectCertificationDirectoryEO projectCertificationDirectoryEO) {
|
||||
checkData(projectCertificationDirectoryEO.getProjectLibraryId(),null,projectCertificationDirectoryEO.getCut());
|
||||
Date now = new Date();
|
||||
projectCertificationDirectoryEO.setCreateTime(now);
|
||||
projectCertificationDirectoryEO.setUpdateTime(now);
|
||||
save(projectCertificationDirectoryEO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param projectCertificationDirectoryEO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void editById(ProjectCertificationDirectoryEO projectCertificationDirectoryEO) {
|
||||
checkData(projectCertificationDirectoryEO.getProjectLibraryId(),projectCertificationDirectoryEO.getId(),projectCertificationDirectoryEO.getCut());
|
||||
Date now = new Date();
|
||||
projectCertificationDirectoryEO.setUpdateTime(now);
|
||||
saveOrUpdate(projectCertificationDirectoryEO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id,String cut) {
|
||||
ProjectCertificationDirectoryEO projectCertificationDirectoryEO = queryById(id);
|
||||
checkData(projectCertificationDirectoryEO.getProjectLibraryId(),id,cut);
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids,String cut) {
|
||||
ids.forEach(id->{
|
||||
ProjectCertificationDirectoryEO projectCertificationDirectoryEO = queryById(id);
|
||||
checkData(projectCertificationDirectoryEO.getProjectLibraryId(),id,cut);
|
||||
});
|
||||
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ProjectCertificationDirectoryEO queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<ProjectCertificationDirectoryEO> queryList() {
|
||||
return list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<?> queryPageList(ProjectCertificationDirectoryEO projectCertificationDirectoryEO, Integer pageNo, Integer pageSize, HttpServletRequest req) {
|
||||
/**
|
||||
* studio: 可以查看当前项目的所有认证目录,不能添加、编辑、删除。
|
||||
* 法规工程师:(只要是该项目里,其中一条法规清单的法规工程师) , 可以查看当前项目的所有认证目录,不能添加、编辑、删除。
|
||||
* 认证工程师:(只要是该项目里,其中一条法规清单的认证工程师) , 可以查看当前项目的所有认证目录,能添加、编辑、删除。 (添加、编辑、删除,只针对于自己创建的数据)
|
||||
*/
|
||||
int roleCode = checkUserRole(projectCertificationDirectoryEO.getProjectLibraryId());
|
||||
if(roleCode == -1){
|
||||
String message = "";
|
||||
if(StringUtils.equals(projectCertificationDirectoryEO.getCut(), CutEnum.CN.getValue())){
|
||||
message = "当前用户没有权限查看。";
|
||||
}else if(StringUtils.equals(projectCertificationDirectoryEO.getCut(), CutEnum.EN.getValue())){
|
||||
message = "The current user does not have permission to view it.";
|
||||
}
|
||||
throw new JeroBootException(message);
|
||||
}
|
||||
|
||||
QueryWrapper<ProjectCertificationDirectoryEO> queryWrapper = QueryGenerator.initQueryWrapper(projectCertificationDirectoryEO, req.getParameterMap());
|
||||
Page<ProjectCertificationDirectoryEO> page = new Page<ProjectCertificationDirectoryEO>(pageNo, pageSize);
|
||||
IPage<ProjectCertificationDirectoryEO> pageList = this.baseMapper.selectPage(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
public int checkUserRole(String projectLibraryId){
|
||||
int result = -1;
|
||||
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
try{
|
||||
QueryWrapper<ProjectLibraryBase> projectLibraryBaseQueryWrapper = new QueryWrapper<>();
|
||||
projectLibraryBaseQueryWrapper.lambda().eq(ProjectLibraryBase::getId,projectLibraryId);
|
||||
projectLibraryBaseQueryWrapper.lambda().eq(ProjectLibraryBase::getStudioEngineer,currentUser.getId());
|
||||
Integer projectLibrayBaseCount = projectLibraryBaseMapper.selectCount(projectLibraryBaseQueryWrapper);
|
||||
if(projectLibrayBaseCount > 0){
|
||||
result = Integer.parseInt(ProjectRoleEnum.STUDIO_ENGINEER.getValue());
|
||||
}else {
|
||||
QueryWrapper<ProjectLawsInventoryEO> inventoryEOQueryWrapperFG = new QueryWrapper<>();
|
||||
inventoryEOQueryWrapperFG.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId,projectLibraryId);
|
||||
inventoryEOQueryWrapperFG.lambda().eq(ProjectLawsInventoryEO::getRegulationOwnerId,currentUser.getId());
|
||||
Integer lawsInventoryCountFG = projectLawsInventoryEOMapper.selectCount(inventoryEOQueryWrapperFG);
|
||||
if(lawsInventoryCountFG > 0){
|
||||
result = Integer.parseInt(ProjectRoleEnum.REGULATI_ENGINEER.getValue());
|
||||
}
|
||||
|
||||
QueryWrapper<ProjectLawsInventoryEO> inventoryEOQueryWrapperRZ = new QueryWrapper<>();
|
||||
inventoryEOQueryWrapperRZ.lambda().eq(ProjectLawsInventoryEO::getProjectLibraryId,projectLibraryId);
|
||||
inventoryEOQueryWrapperRZ.lambda().eq(ProjectLawsInventoryEO::getHomologationEngineerId,currentUser.getId());
|
||||
Integer lawsInventoryCountRZ = projectLawsInventoryEOMapper.selectCount(inventoryEOQueryWrapperRZ);
|
||||
if(lawsInventoryCountRZ > 0){
|
||||
result = Integer.parseInt(ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue());
|
||||
}
|
||||
}
|
||||
}catch (Exception ex){
|
||||
log.error("验证用户在该项目中的角色失败:" + ex.getMessage());
|
||||
throw new JeroBootException("验证用户在该项目中的角色失败!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证数据权限,只有认证工程师,并且创建人是当前登陆人,才能进行增、删、改操作。
|
||||
* @return
|
||||
*/
|
||||
public boolean checkData(String projectLibraryId,String id,String cut){
|
||||
boolean result = false;
|
||||
int roleCode = checkUserRole(projectLibraryId);
|
||||
if(roleCode != Integer.parseInt(ProjectRoleEnum.HOMOLOGATION_ENGINEER.getValue())){
|
||||
String message = "";
|
||||
if(StringUtils.equals(cut, CutEnum.CN.getValue())){
|
||||
message = "没有权限操作,只有认证工程师才可以操作。";
|
||||
}else if(StringUtils.equals(cut, CutEnum.EN.getValue())){
|
||||
message = "Only certified engineers can perform this operation.";
|
||||
}
|
||||
throw new JeroBootException(message);
|
||||
}
|
||||
|
||||
try{
|
||||
if(StringUtils.isNotEmpty(id)){
|
||||
QueryWrapper<ProjectCertificationDirectoryEO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(ProjectCertificationDirectoryEO::getId,id);
|
||||
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
queryWrapper.lambda().eq(ProjectCertificationDirectoryEO::getCreateBy,currentUser.getUsername());
|
||||
Integer integer = this.baseMapper.selectCount(queryWrapper);
|
||||
if(integer > 0){
|
||||
result = true;
|
||||
}else {
|
||||
String message = "";
|
||||
if(StringUtils.equals(cut, CutEnum.CN.getValue())){
|
||||
message = "用户只能对自己创建的数据进行操作。";
|
||||
}else if(StringUtils.equals(cut, CutEnum.EN.getValue())){
|
||||
message = "Users can only operate data created by themselves.";
|
||||
}
|
||||
throw new JeroBootException(message);
|
||||
}
|
||||
}else {
|
||||
result = true;
|
||||
}
|
||||
}catch (Exception ex){
|
||||
log.error("验证项目库-认证目录数据异常:" + ex.getMessage());
|
||||
throw new JeroBootException("验证项目库-认证目录数据异常!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user