Merge remote-tracking branch 'origin/dev_20230912_Platform' into dev_20230912_Platform

This commit is contained in:
zyx.net
2023-09-28 10:47:43 +08:00
2 changed files with 24 additions and 5 deletions
@@ -4556,8 +4556,8 @@ public class PlatformProjectLawsInventoryEOServiceImpl extends ServiceImpl<Platf
projectLawsInventoryEOTemp.setProjectLibraryId(projectLawsInventoryEO.getProjectLibraryId()); projectLawsInventoryEOTemp.setProjectLibraryId(projectLawsInventoryEO.getProjectLibraryId());
projectLawsInventoryEOTemp.setTaskAffirmStatus(TaskAffirmStatusEnum.NOT_STARTED.getValue()); projectLawsInventoryEOTemp.setTaskAffirmStatus(TaskAffirmStatusEnum.NOT_STARTED.getValue());
projectLawsInventoryEOTemp.setInventoryAffirmStatus(InventoryAffirmStatusEnum.NOT_STARTED.getValue()); projectLawsInventoryEOTemp.setInventoryAffirmStatus(InventoryAffirmStatusEnum.NOT_STARTED.getValue());
projectLawsInventoryEOTemp.setDesignFlowStatus(ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()); projectLawsInventoryEOTemp.setDesignFlowStatus(ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue());
projectLawsInventoryEOTemp.setVerifyFlowStatus(ComplianceFlowStatusEnum.LIST_TO_BE_RELEASED.getValue()); projectLawsInventoryEOTemp.setVerifyFlowStatus(ComplianceFlowStatusEnum.LIST_TO_BE_CHECKED.getValue());
datas.add(projectLawsInventoryEOTemp); datas.add(projectLawsInventoryEOTemp);
} }
} }
@@ -59,7 +59,7 @@ public class ProjectCertificationDirectoryEOServiceImpl extends ServiceImpl<Proj
*/ */
@Override @Override
public void add(ProjectCertificationDirectoryEO projectCertificationDirectoryEO) { public void add(ProjectCertificationDirectoryEO projectCertificationDirectoryEO) {
checkData(projectCertificationDirectoryEO.getProjectLibraryId(),null,projectCertificationDirectoryEO.getCut()); checkDataLaws(projectCertificationDirectoryEO.getProjectLibraryId(),null,projectCertificationDirectoryEO.getCut());
Date now = new Date(); Date now = new Date();
projectCertificationDirectoryEO.setCreateTime(now); projectCertificationDirectoryEO.setCreateTime(now);
projectCertificationDirectoryEO.setUpdateTime(now); projectCertificationDirectoryEO.setUpdateTime(now);
@@ -75,7 +75,7 @@ public class ProjectCertificationDirectoryEOServiceImpl extends ServiceImpl<Proj
*/ */
@Override @Override
public void editById(ProjectCertificationDirectoryEO projectCertificationDirectoryEO) { public void editById(ProjectCertificationDirectoryEO projectCertificationDirectoryEO) {
checkData(projectCertificationDirectoryEO.getProjectLibraryId(),projectCertificationDirectoryEO.getId(),projectCertificationDirectoryEO.getCut()); checkDataLaws(projectCertificationDirectoryEO.getProjectLibraryId(),projectCertificationDirectoryEO.getId(),projectCertificationDirectoryEO.getCut());
Date now = new Date(); Date now = new Date();
projectCertificationDirectoryEO.setUpdateTime(now); projectCertificationDirectoryEO.setUpdateTime(now);
saveOrUpdate(projectCertificationDirectoryEO); saveOrUpdate(projectCertificationDirectoryEO);
@@ -90,7 +90,7 @@ public class ProjectCertificationDirectoryEOServiceImpl extends ServiceImpl<Proj
@Override @Override
public void deleteById(String id,String cut) { public void deleteById(String id,String cut) {
ProjectCertificationDirectoryEO projectCertificationDirectoryEO = queryById(id); ProjectCertificationDirectoryEO projectCertificationDirectoryEO = queryById(id);
checkData(projectCertificationDirectoryEO.getProjectLibraryId(),id,cut); checkDataLaws(projectCertificationDirectoryEO.getProjectLibraryId(),id,cut);
removeById(id); removeById(id);
} }
@@ -257,4 +257,23 @@ public class ProjectCertificationDirectoryEOServiceImpl extends ServiceImpl<Proj
// } // }
return true; return true;
} }
/**
* 验证数据权限,只有法规工程师,并且创建人是当前登陆人,才能进行增、删、改操作。
* @return
*/
public boolean checkDataLaws(String projectLibraryId,String id,String cut){
int roleCode = checkUserRole(projectLibraryId);
if(roleCode != Integer.parseInt(ProjectRoleEnum.REGULATI_ENGINEER.getValue())
&& roleCode != Integer.parseInt(ProjectRoleEnum.STUDIO_ENGINEER.getValue())
&& 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 regulatory engineer can perform this operation.";
}
throw new JeroBootException(message);
}
return true;
}
} }