修改:权限修改
This commit is contained in:
parent
1ffa2ae9da
commit
3a28a68207
@ -23,18 +23,19 @@ public class UserPermissionGetter {
|
||||
private RuntimeAppContextService runtimeAppContextService;
|
||||
|
||||
|
||||
// 获取子系统下的参数权限
|
||||
// 获取子系统下的零部件权限
|
||||
public List<String> getParamPermissions(String subsystem, String userId) {
|
||||
Set<String> result = new HashSet<>();
|
||||
try {
|
||||
// 获取用户权限
|
||||
// 获取用户所有权限
|
||||
Map<String, List<MenuParamView>> collected = modelRoleService.selectPersByUser(userId)
|
||||
.stream().collect(Collectors.groupingBy(MenuParamView::getSubsystem));
|
||||
// 获取用户在当前子系统拥有的零部件权限
|
||||
if (collected.containsKey(subsystem)) {
|
||||
result.addAll(collected.get(subsystem)
|
||||
.stream().map(MenuParamView::getParameterId).collect(Collectors.toSet()));
|
||||
.stream().map(MenuParamView::getPartsName).collect(Collectors.toSet()));
|
||||
}
|
||||
// 获取用户所在部门权限
|
||||
// 获取用户所在部门在当前子系统拥有的零部件权限
|
||||
List<String> deptIds = businessDatabase.getBusinessDatabase()
|
||||
.eq("user_id", userId).doQuery(XdapDeptUsers.class)
|
||||
.stream().map(XdapDeptUsers::getDepartmentId).collect(Collectors.toList());
|
||||
@ -43,11 +44,12 @@ public class UserPermissionGetter {
|
||||
.stream().collect(Collectors.groupingBy(MenuParamView::getSubsystem));
|
||||
if (collected1.containsKey(subsystem)) {
|
||||
result.addAll(collected1.get(subsystem)
|
||||
.stream().map(MenuParamView::getParameterId).collect(Collectors.toSet()));
|
||||
.stream().map(MenuParamView::getPartsName).collect(Collectors.toSet()));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return new ArrayList<>(result);
|
||||
}
|
||||
@ -61,7 +63,7 @@ public class UserPermissionGetter {
|
||||
.stream().collect(Collectors.groupingBy(MenuParamView::getSubsystem));
|
||||
for (String subsystem : collected.keySet()) {
|
||||
result.addAll(collected.get(subsystem)
|
||||
.stream().map(MenuParamView::getParameterId).collect(Collectors.toSet()));
|
||||
.stream().map(MenuParamView::getPartsName).collect(Collectors.toSet()));
|
||||
}
|
||||
// 获取用户所在部门权限
|
||||
List<String> deptIds = businessDatabase.getBusinessDatabase()
|
||||
@ -72,7 +74,7 @@ public class UserPermissionGetter {
|
||||
.stream().collect(Collectors.groupingBy(MenuParamView::getSubsystem));
|
||||
for (String subsystem : collected1.keySet()) {
|
||||
result.addAll(collected1.get(subsystem)
|
||||
.stream().map(MenuParamView::getParameterId).collect(Collectors.toSet()));
|
||||
.stream().map(MenuParamView::getPartsName).collect(Collectors.toSet()));
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
@ -24,6 +24,6 @@ public class BusinessDatabase {
|
||||
|
||||
@Bean
|
||||
public MpaasQuery getTCDatabase() {
|
||||
return queryFactory.buildFromDatasource(DatasourceConstant.XDAP_MYSQL_PREFIX + tenantId);
|
||||
return queryFactory.buildFromDatasource("yc_lrs_test_relsult");
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,17 +8,12 @@ import lombok.Data;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
@SQLQuery(value = {
|
||||
@SQL(view = "getAllReportApprovalByParts",
|
||||
sql = "SELECT br.id AS \"reportId\", af.id AS \"flowId\", br.* FROM yfsjglpt_model_approval_flow af RIGHT JOIN yfsjglpt_model_benchmarking_report br ON af.template_id = br.id AND af.flow_type = 2 WHERE br.is_delete = 0 and br.title like CONCAT('%', #title, '%') and br.manufacturer_name like CONCAT('%', #manufacturerName, '%') and br.model_name like CONCAT('%', #modelName, '%') and br.product_number like CONCAT('%', #productNumber, '%') and br.module like CONCAT('%', #module, '%') and br.plate like CONCAT('%', #plate, '%') and br.platform like CONCAT('%', #platform, '%') and br.series like CONCAT('%', #series, '%') and br.market_segment like CONCAT('%', #marketSegment, '%') and br.project_name like CONCAT('%', #projectName, '%') and br.project_number like CONCAT('%', #projectNumber, '%') and br.status like CONCAT('%', #status, '%') and br.subsystem = #subsystem and br.parts_name in (#partsName) ORDER BY CASE br.status WHEN 'COMPLETE' THEN 1 WHEN 'APPROVING' THEN 2 WHEN 'REJECTED' THEN 3 ELSE 4 END ASC"),
|
||||
@SQL(view = "getAllReportApprovalBySub",
|
||||
sql = "SELECT br.id AS \"reportId\", af.id AS \"flowId\", br.* FROM yfsjglpt_model_approval_flow af RIGHT JOIN yfsjglpt_model_benchmarking_report br ON af.template_id = br.id AND af.flow_type = 2 WHERE br.is_delete = 0 and br.title like CONCAT('%', #title, '%') and br.manufacturer_name like CONCAT('%', #manufacturerName, '%') and br.model_name like CONCAT('%', #modelName, '%') and br.product_number like CONCAT('%', #productNumber, '%') and br.module like CONCAT('%', #module, '%') and br.plate like CONCAT('%', #plate, '%') and br.platform like CONCAT('%', #platform, '%') and br.series like CONCAT('%', #series, '%') and br.market_segment like CONCAT('%', #marketSegment, '%') and br.project_name like CONCAT('%', #projectName, '%') and br.project_number like CONCAT('%', #projectNumber, '%') and br.status like CONCAT('%', #status, '%') and br.subsystem = #subsystem ORDER BY CASE br.status WHEN 'COMPLETE' THEN 1 WHEN 'APPROVING' THEN 2 WHEN 'REJECTED' THEN 3 ELSE 4 END ASC"),
|
||||
@SQL(view = "getAllReportApproval",
|
||||
sql = "SELECT br.id AS \"reportId\", af.id AS \"flowId\", br.* FROM yfsjglpt_model_approval_flow af RIGHT JOIN yfsjglpt_model_benchmarking_report br ON af.template_id = br.id AND af.flow_type = 2 WHERE br.is_delete = 0 and br.title like CONCAT('%', #title, '%') and br.manufacturer_name like CONCAT('%', #manufacturerName, '%') and br.model_name like CONCAT('%', #modelName, '%') and br.product_number like CONCAT('%', #productNumber, '%') and br.module like CONCAT('%', #module, '%') and br.plate like CONCAT('%', #plate, '%') and br.platform like CONCAT('%', #platform, '%') and br.series like CONCAT('%', #series, '%') and br.market_segment like CONCAT('%', #marketSegment, '%') and br.project_name like CONCAT('%', #projectName, '%') and br.project_number like CONCAT('%', #projectNumber, '%') and br.status like CONCAT('%', #status, '%') ORDER BY CASE br.status WHEN 'COMPLETE' THEN 1 WHEN 'APPROVING' THEN 2 WHEN 'REJECTED' THEN 3 ELSE 4 END ASC")
|
||||
@SQL(view = "getAllReport",
|
||||
sql = "SELECT br.id AS \"reportId\", br.* FROM yfsjglpt_model_benchmarking_report br WHERE br.is_delete = 0 and br.title like CONCAT('%', #title, '%') and br.manufacturer_name like CONCAT('%', #manufacturerName, '%') and br.model_name like CONCAT('%', #modelName, '%') and br.product_number like CONCAT('%', #productNumber, '%') and br.module like CONCAT('%', #module, '%') and br.plate like CONCAT('%', #plate, '%') and br.platform like CONCAT('%', #platform, '%') and br.series like CONCAT('%', #series, '%') and br.market_segment like CONCAT('%', #marketSegment, '%') and br.project_name like CONCAT('%', #projectName, '%') and br.project_number like CONCAT('%', #projectNumber, '%') and br.status like CONCAT('%', #status, '%') ORDER BY CASE br.status WHEN 'COMPLETE' THEN 1 WHEN 'APPROVING' THEN 2 WHEN 'REJECTED' THEN 3 ELSE 4 END ASC")
|
||||
})
|
||||
@Data
|
||||
public class TodoAndReportView {
|
||||
private String reportId;
|
||||
private String flowId;
|
||||
|
||||
private String title;
|
||||
private String manufacturerName;
|
||||
|
||||
@ -4,15 +4,10 @@ import com.xdap.self_development.common.MyPageResult;
|
||||
import com.xdap.self_development.controller.form.ParameterPageForm;
|
||||
import com.xdap.self_development.controller.form.UpdateParameterForm;
|
||||
import com.xdap.self_development.pojo.Parameter;
|
||||
import com.xdap.self_development.pojo.view.ParametersView;
|
||||
import com.xdap.self_development.pojo.view.TemplateInfoView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ParameterService {
|
||||
MyPageResult<Parameter> getParameterByCondition(ParameterPageForm form);
|
||||
|
||||
TemplateInfoView maintenanceParameters(UpdateParameterForm form);
|
||||
|
||||
List<ParametersView> getAllParameters(String subsystem);
|
||||
}
|
||||
|
||||
@ -135,7 +135,7 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
||||
public PageQueryResult<TodoAndReportView> getBenchmarkingReportByCondition(BenchmarkingReportPageForm form) {
|
||||
PageQueryResult<TodoAndReportView> result = bd.getBusinessDatabase()
|
||||
.viewQueryMode(true)
|
||||
.view("getAllReportApproval")
|
||||
.view("getAllReport")
|
||||
.setVar("title", form.getTitle())
|
||||
.setVar("manufacturerName", form.getManufacturerName())
|
||||
.setVar("modelName", form.getModelName())
|
||||
@ -172,6 +172,13 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
||||
.eq("id", form.getReportId())
|
||||
.doQueryFirst(BenchmarkingReport.class);
|
||||
|
||||
ApprovalFlow approvalFlow = bd.getBusinessDatabase()
|
||||
.eq("template_id", report.getId())
|
||||
.doQueryFirst(ApprovalFlow.class);
|
||||
if (approvalFlow != null && Objects.equals(approvalFlow.getFlowStatus(), "APPROVING")) {
|
||||
throw new CommonException("该报告正在审批中,请勿重复发起审批");
|
||||
}
|
||||
|
||||
ApprovalFlow flow = new ApprovalFlow();
|
||||
flow.setTemplateId(report.getId());
|
||||
flow.setCurrentNode("PROOFREAD");
|
||||
@ -186,6 +193,11 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
||||
flow.setExplanation(form.getExplanation());
|
||||
bd.getBusinessDatabase().doInsert(flow);
|
||||
|
||||
bd.getBusinessDatabase()
|
||||
.eq("id", report.getId())
|
||||
.update("status", "APPROVING")
|
||||
.doUpdate(BenchmarkingReport.class);
|
||||
|
||||
List<TodoTaskPojo> list = new ArrayList<>();
|
||||
for (String person : form.getProofreadUsers()) {
|
||||
TodoTaskPojo todoTask = new TodoTaskPojo();
|
||||
@ -288,7 +300,7 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
||||
ApprovalFlowView approvalFlowView = new ApprovalFlowView();
|
||||
ApprovalFlow flow = bd.getBusinessDatabase()
|
||||
.eq("id", flowId)
|
||||
.eq("flow_type", 1)
|
||||
.eq("flow_type", 2)
|
||||
.doQueryFirst(ApprovalFlow.class);
|
||||
|
||||
if (flowId == null || flowId.isEmpty() || flow == null) {
|
||||
|
||||
@ -12,7 +12,6 @@ import com.xdap.self_development.pojo.Parameter;
|
||||
import com.xdap.self_development.pojo.RevisionRecord;
|
||||
import com.xdap.self_development.pojo.Template;
|
||||
import com.xdap.self_development.pojo.TemplateAndParameter;
|
||||
import com.xdap.self_development.pojo.view.ParametersView;
|
||||
import com.xdap.self_development.pojo.view.TemplateInfoView;
|
||||
import com.xdap.self_development.service.ParameterService;
|
||||
import com.xdap.self_development.utils.FormulaValidator;
|
||||
@ -163,15 +162,6 @@ public class ParameterServiceImpl implements ParameterService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ParametersView> getAllParameters(String subsystem) {
|
||||
return bd.getBusinessDatabase()
|
||||
.viewQueryMode(true)
|
||||
.view("getAllParameters")
|
||||
.setVar("subsystem", subsystem)
|
||||
.doQuery(ParametersView.class);
|
||||
}
|
||||
|
||||
private TemplateBenchmark getTemplateBenchmark(String templateRowId) {
|
||||
// 基准模板(用户选择的要比较的版本)
|
||||
Template baseTemplate = bd.getBusinessDatabase()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user