Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
017ad491dc
@ -4,6 +4,7 @@ import com.definesys.mpaas.common.http.Response;
|
|||||||
import com.xdap.self_development.controller.form.BenchmarkingReportPageForm;
|
import com.xdap.self_development.controller.form.BenchmarkingReportPageForm;
|
||||||
import com.xdap.self_development.controller.form.HandleApprovalRequest;
|
import com.xdap.self_development.controller.form.HandleApprovalRequest;
|
||||||
import com.xdap.self_development.controller.form.SaveBenchmarkingReportForm;
|
import com.xdap.self_development.controller.form.SaveBenchmarkingReportForm;
|
||||||
|
import com.xdap.self_development.controller.form.UpdateBenchmarkingReportForm;
|
||||||
import com.xdap.self_development.exception.CommonException;
|
import com.xdap.self_development.exception.CommonException;
|
||||||
import com.xdap.self_development.pojo.BenchmarkingReport;
|
import com.xdap.self_development.pojo.BenchmarkingReport;
|
||||||
import com.xdap.self_development.pojo.view.ApprovalFlowView;
|
import com.xdap.self_development.pojo.view.ApprovalFlowView;
|
||||||
@ -50,6 +51,21 @@ public class BenchmarkingReportController {
|
|||||||
return Response.ok().setMessage("保存成功");
|
return Response.ok().setMessage("保存成功");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 修改对标报告并发起审批
|
||||||
|
@PostMapping("/restartReportApproval")
|
||||||
|
public Response restartReportApproval(
|
||||||
|
@Valid UpdateBenchmarkingReportForm form,
|
||||||
|
BindingResult bindingResult
|
||||||
|
) {
|
||||||
|
if (bindingResult.hasErrors()) {
|
||||||
|
bindingResult.getFieldErrors().forEach(error -> {
|
||||||
|
throw new CommonException(error.getDefaultMessage());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
benchmarkingReportService.restartReportApproval(form);
|
||||||
|
return Response.ok().setMessage("重新提交成功");
|
||||||
|
}
|
||||||
|
|
||||||
// 筛选对标报告及待办
|
// 筛选对标报告及待办
|
||||||
@PostMapping("/getReportAndTodoByCondition")
|
@PostMapping("/getReportAndTodoByCondition")
|
||||||
public Response getBenchmarkingReportByCondition(
|
public Response getBenchmarkingReportByCondition(
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.xdap.self_development.controller;
|
package com.xdap.self_development.controller;
|
||||||
|
|
||||||
import com.definesys.mpaas.common.http.Response;
|
import com.definesys.mpaas.common.http.Response;
|
||||||
|
import com.xdap.api.moudle.user.vo.LoginUserVo;
|
||||||
import com.xdap.runtime.service.RuntimeAppContextService;
|
import com.xdap.runtime.service.RuntimeAppContextService;
|
||||||
import com.xdap.runtime.service.RuntimeDatasourceService;
|
import com.xdap.runtime.service.RuntimeDatasourceService;
|
||||||
import com.xdap.runtime.service.RuntimeUserService;
|
import com.xdap.runtime.service.RuntimeUserService;
|
||||||
@ -42,11 +43,13 @@ public class DataEntryController {
|
|||||||
String currentTenantId = runtimeAppContextService.getCurrentTenantId();
|
String currentTenantId = runtimeAppContextService.getCurrentTenantId();
|
||||||
String currentToken = runtimeAppContextService.getCurrentToken();
|
String currentToken = runtimeAppContextService.getCurrentToken();
|
||||||
String currentUserId = runtimeAppContextService.getCurrentUserId();
|
String currentUserId = runtimeAppContextService.getCurrentUserId();
|
||||||
|
LoginUserVo loginUserVo = runtimeUserService.queryLoginUserVo(currentUserId, currentTenantId, currentAppId);
|
||||||
|
|
||||||
map.put("currentAppId", currentAppId);
|
map.put("currentAppId", currentAppId);
|
||||||
map.put("currentTenantId", currentTenantId);
|
map.put("currentTenantId", currentTenantId);
|
||||||
map.put("currentToken", currentToken);
|
map.put("currentToken", currentToken);
|
||||||
map.put("currentUserId", currentUserId);
|
map.put("currentUserId", currentUserId);
|
||||||
|
map.put("loginUserVo", loginUserVo.toString());
|
||||||
return Response.ok().data(map);
|
return Response.ok().data(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,53 @@
|
|||||||
|
package com.xdap.self_development.controller.form;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class UpdateBenchmarkingReportForm {
|
||||||
|
@NotBlank(message = "原对标报告id不能为空")
|
||||||
|
private String reportId;
|
||||||
|
|
||||||
|
@NotBlank(message = "标题不能为空")
|
||||||
|
private String title;
|
||||||
|
@NotBlank(message = "厂家名称不能为空")
|
||||||
|
private String manufacturerName;
|
||||||
|
@NotBlank(message = "产品型号不能为空")
|
||||||
|
private String modelName;
|
||||||
|
@NotBlank(message = "厂家简称不能为空")
|
||||||
|
private String manufacturerAbbreviation;
|
||||||
|
@NotBlank(message = "产品型号简称不能为空")
|
||||||
|
private String modelAbbreviation;
|
||||||
|
@NotBlank(message = "产品编号不能为空")
|
||||||
|
private String productNumber;
|
||||||
|
@NotBlank(message = "模块不能为空")
|
||||||
|
private String module;
|
||||||
|
@NotBlank(message = "板块不能为空")
|
||||||
|
private String plate;
|
||||||
|
@NotBlank(message = "平台不能为空")
|
||||||
|
private String platform;
|
||||||
|
@NotBlank(message = "系列不能为空")
|
||||||
|
private String series;
|
||||||
|
@NotBlank(message = "细分市场不能为空")
|
||||||
|
private String marketSegment;
|
||||||
|
@NotBlank(message = "项目名称不能为空")
|
||||||
|
private String projectName;
|
||||||
|
@NotBlank(message = "项目编号不能为空")
|
||||||
|
private String projectNumber;
|
||||||
|
|
||||||
|
private String fileUrl;
|
||||||
|
|
||||||
|
@NotEmpty(message = "校对人员不能为空")
|
||||||
|
private List<String> proofreadUsers;
|
||||||
|
@NotEmpty(message = "审核人员不能为空")
|
||||||
|
private List<String> reviewUsers;
|
||||||
|
private List<String> countersignUsers; // 可选
|
||||||
|
@NotEmpty(message = "批准人员不能为空")
|
||||||
|
private List<String> approveUsers;
|
||||||
|
@NotBlank(message = "发起人不能为空")
|
||||||
|
private String createBy;
|
||||||
|
private String explanation;
|
||||||
|
}
|
||||||
@ -13,5 +13,4 @@ public class MenuParamView {
|
|||||||
private String parameterName;
|
private String parameterName;
|
||||||
private String parameterId;
|
private String parameterId;
|
||||||
private String parameterPer;
|
private String parameterPer;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import java.sql.Timestamp;
|
|||||||
@SQL(view = "getReportByUserIdAndIds",
|
@SQL(view = "getReportByUserIdAndIds",
|
||||||
sql = "SELECT br.id AS \"reportId\", af.id AS \"flowId\", br.* FROM yfsjglpt_model_approval_flow af JOIN yfsjglpt_model_benchmarking_report br ON af.template_id = br.id WHERE 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 af.flow_type = 2 AND af.id NOT IN (#ids) AND af.create_by = #createBy"),
|
sql = "SELECT br.id AS \"reportId\", af.id AS \"flowId\", br.* FROM yfsjglpt_model_approval_flow af JOIN yfsjglpt_model_benchmarking_report br ON af.template_id = br.id WHERE 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 af.flow_type = 2 AND af.id NOT IN (#ids) AND af.create_by = #createBy"),
|
||||||
@SQL(view = "getTodoAndReport",
|
@SQL(view = "getTodoAndReport",
|
||||||
sql = "SELECT br.id AS \"reportId\", af.id AS \"flowId\", br.* FROM yfsjglpt_model_approval_flow af JOIN yfsjglpt_model_benchmarking_report br ON af.template_id = br.id WHERE 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 af.flow_type = 2 AND af.id IN (#ids)")
|
sql = "SELECT br.id AS \"reportId\", af.id AS \"flowId\", br.* FROM yfsjglpt_model_approval_flow af JOIN yfsjglpt_model_benchmarking_report br ON af.template_id = br.id WHERE 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 af.flow_type = 2 AND (af.id IN (#ids) OR af.create_by = #createBy) ORDER BY CASE br.status WHEN 'COMPLETE' THEN 1 WHEN 'APPROVING' THEN 2 WHEN 'REJECTED' THEN 3 ELSE 4 END ASC")
|
||||||
})
|
})
|
||||||
@Data
|
@Data
|
||||||
public class TodoAndReportView {
|
public class TodoAndReportView {
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.xdap.self_development.service;
|
|||||||
import com.xdap.self_development.controller.form.BenchmarkingReportPageForm;
|
import com.xdap.self_development.controller.form.BenchmarkingReportPageForm;
|
||||||
import com.xdap.self_development.controller.form.HandleApprovalRequest;
|
import com.xdap.self_development.controller.form.HandleApprovalRequest;
|
||||||
import com.xdap.self_development.controller.form.SaveBenchmarkingReportForm;
|
import com.xdap.self_development.controller.form.SaveBenchmarkingReportForm;
|
||||||
|
import com.xdap.self_development.controller.form.UpdateBenchmarkingReportForm;
|
||||||
import com.xdap.self_development.pojo.BenchmarkingReport;
|
import com.xdap.self_development.pojo.BenchmarkingReport;
|
||||||
import com.xdap.self_development.pojo.view.ApprovalFlowView;
|
import com.xdap.self_development.pojo.view.ApprovalFlowView;
|
||||||
import com.xdap.self_development.pojo.view.TodoAndReportView;
|
import com.xdap.self_development.pojo.view.TodoAndReportView;
|
||||||
@ -17,6 +18,8 @@ public interface BenchmarkingReportService {
|
|||||||
|
|
||||||
void saveBenchmarkingReport(@Valid SaveBenchmarkingReportForm form);
|
void saveBenchmarkingReport(@Valid SaveBenchmarkingReportForm form);
|
||||||
|
|
||||||
|
void restartReportApproval(@Valid UpdateBenchmarkingReportForm form);
|
||||||
|
|
||||||
void handleReportApproval(@Valid HandleApprovalRequest request);
|
void handleReportApproval(@Valid HandleApprovalRequest request);
|
||||||
|
|
||||||
BenchmarkingReport getReportDetail(@NotBlank String reportId);
|
BenchmarkingReport getReportDetail(@NotBlank String reportId);
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import com.xdap.self_development.config.BusinessDatabase;
|
|||||||
import com.xdap.self_development.controller.form.BenchmarkingReportPageForm;
|
import com.xdap.self_development.controller.form.BenchmarkingReportPageForm;
|
||||||
import com.xdap.self_development.controller.form.HandleApprovalRequest;
|
import com.xdap.self_development.controller.form.HandleApprovalRequest;
|
||||||
import com.xdap.self_development.controller.form.SaveBenchmarkingReportForm;
|
import com.xdap.self_development.controller.form.SaveBenchmarkingReportForm;
|
||||||
|
import com.xdap.self_development.controller.form.UpdateBenchmarkingReportForm;
|
||||||
import com.xdap.self_development.exception.CommonException;
|
import com.xdap.self_development.exception.CommonException;
|
||||||
import com.xdap.self_development.feign.ApaasMyTokenFeign;
|
import com.xdap.self_development.feign.ApaasMyTokenFeign;
|
||||||
import com.xdap.self_development.feign.dto.AppTokenDTO;
|
import com.xdap.self_development.feign.dto.AppTokenDTO;
|
||||||
@ -64,8 +65,8 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
|||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = CommonException.class)
|
@Transactional(rollbackFor = CommonException.class)
|
||||||
public void saveBenchmarkingReport(SaveBenchmarkingReportForm form) {
|
public void saveBenchmarkingReport(SaveBenchmarkingReportForm form) {
|
||||||
// 1. 创建对标报告并保存
|
|
||||||
BenchmarkingReport report = new BenchmarkingReport();
|
BenchmarkingReport report = new BenchmarkingReport();
|
||||||
|
// 1. 创建对标报告并保存
|
||||||
BeanUtils.copyProperties(form, report);
|
BeanUtils.copyProperties(form, report);
|
||||||
report.setFilePath(form.getFileUrl() == null ? "" : form.getFileUrl());
|
report.setFilePath(form.getFileUrl() == null ? "" : form.getFileUrl());
|
||||||
report.setUploadTime(Timestamp.valueOf(LocalDateTime.now()));
|
report.setUploadTime(Timestamp.valueOf(LocalDateTime.now()));
|
||||||
@ -93,6 +94,37 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void restartReportApproval(UpdateBenchmarkingReportForm form) {
|
||||||
|
BenchmarkingReport originalReport = bd.getBusinessDatabase()
|
||||||
|
.eq("id", form.getReportId()).doQueryFirst(BenchmarkingReport.class);
|
||||||
|
BeanUtils.copyProperties(form, originalReport);
|
||||||
|
originalReport.setFilePath(form.getFileUrl() == null ? "" : form.getFileUrl());
|
||||||
|
originalReport.setUploadTime(Timestamp.valueOf(LocalDateTime.now()));
|
||||||
|
originalReport.setStatus("APPROVING");
|
||||||
|
originalReport.setCreateBy(form.getCreateBy());
|
||||||
|
bd.getBusinessDatabase().doUpdate(originalReport);
|
||||||
|
|
||||||
|
ApprovalFlow flow = new ApprovalFlow();
|
||||||
|
flow.setTemplateId(originalReport.getId());
|
||||||
|
flow.setCurrentNode("PROOFREAD");
|
||||||
|
flow.setFlowStatus("APPROVING");
|
||||||
|
flow.setProofreadUsers(JSON.toJSONString(form.getProofreadUsers()));
|
||||||
|
flow.setReviewUsers(JSON.toJSONString(form.getReviewUsers()));
|
||||||
|
flow.setCountersignUsers(JSON.toJSONString(form.getCountersignUsers()));
|
||||||
|
flow.setApproveUsers(JSON.toJSONString(form.getApproveUsers()));
|
||||||
|
flow.setCreateBy(form.getCreateBy());
|
||||||
|
flow.setCreatedTime(Timestamp.valueOf(LocalDateTime.now()));
|
||||||
|
flow.setFlowType(2); // 设置为报告审批流程
|
||||||
|
flow.setExplanation(form.getExplanation());
|
||||||
|
bd.getBusinessDatabase().doInsert(flow);
|
||||||
|
|
||||||
|
form.getProofreadUsers().forEach(userId -> {
|
||||||
|
redisTemplate.opsForSet().add(TODO_PREFIX + userId, flow.getId());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String uploadFile(MultipartFile file, String userId) {
|
public String uploadFile(MultipartFile file, String userId) {
|
||||||
String currentTenantId = runtimeAppContextService.getCurrentTenantId();
|
String currentTenantId = runtimeAppContextService.getCurrentTenantId();
|
||||||
@ -126,36 +158,12 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
|||||||
@Override
|
@Override
|
||||||
public List<TodoAndReportView> getBenchmarkingReportByCondition(BenchmarkingReportPageForm form) {
|
public List<TodoAndReportView> getBenchmarkingReportByCondition(BenchmarkingReportPageForm form) {
|
||||||
List<TodoAndReportView> approvalList = new ArrayList<>();
|
List<TodoAndReportView> approvalList = new ArrayList<>();
|
||||||
Set<String> flowIds = redisTemplate.opsForSet().members(TODO_PREFIX + form.getCreateBy());
|
Set<String> flowIds = new HashSet<>(Objects.requireNonNull(redisTemplate.opsForSet().members(TODO_PREFIX + form.getCreateBy())));
|
||||||
|
|
||||||
if (flowIds != null && !flowIds.isEmpty()) {
|
|
||||||
List<String> ids = new ArrayList<>(flowIds);
|
List<String> ids = new ArrayList<>(flowIds);
|
||||||
List<TodoAndReportView> todoList =bd.getBusinessDatabase()
|
List<TodoAndReportView> todoList =bd.getBusinessDatabase()
|
||||||
.viewQueryMode(true)
|
.viewQueryMode(true)
|
||||||
.view("getTodoAndReport")
|
.view("getTodoAndReport")
|
||||||
.setVar("ids", ids)
|
.setVar("ids", ids)
|
||||||
.setVar("title", form.getTitle())
|
|
||||||
.setVar("manufacturerName", form.getManufacturerName())
|
|
||||||
.setVar("modelName", form.getModelName())
|
|
||||||
.setVar("productNumber", form.getProductNumber())
|
|
||||||
.setVar("module", form.getModule())
|
|
||||||
.setVar("plate", form.getPlate())
|
|
||||||
.setVar("platform", form.getPlatform())
|
|
||||||
.setVar("series", form.getSeries())
|
|
||||||
.setVar("marketSegment", form.getMarketSegment())
|
|
||||||
.setVar("projectName", form.getProjectName())
|
|
||||||
.setVar("projectNumber", form.getProjectNumber())
|
|
||||||
.setVar("status", form.getStatus())
|
|
||||||
.doQuery(TodoAndReportView.class);
|
|
||||||
setCurrentApprovers(approvalList, todoList);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> ids = (flowIds == null || flowIds.isEmpty()) ? new ArrayList<>(Collections.singleton("")) : new ArrayList<>(flowIds);
|
|
||||||
List<TodoAndReportView> todoAndTemplateViews = bd.getBusinessDatabase()
|
|
||||||
.viewQueryMode(true)
|
|
||||||
.view("getReportByUserIdAndIds")
|
|
||||||
.setVar("ids", ids)
|
|
||||||
.setVar("createBy", form.getCreateBy())
|
.setVar("createBy", form.getCreateBy())
|
||||||
.setVar("title", form.getTitle())
|
.setVar("title", form.getTitle())
|
||||||
.setVar("manufacturerName", form.getManufacturerName())
|
.setVar("manufacturerName", form.getManufacturerName())
|
||||||
@ -170,8 +178,7 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
|||||||
.setVar("projectNumber", form.getProjectNumber())
|
.setVar("projectNumber", form.getProjectNumber())
|
||||||
.setVar("status", form.getStatus())
|
.setVar("status", form.getStatus())
|
||||||
.doQuery(TodoAndReportView.class);
|
.doQuery(TodoAndReportView.class);
|
||||||
setCurrentApprovers(approvalList, todoAndTemplateViews);
|
setCurrentApprovers(approvalList, todoList);
|
||||||
|
|
||||||
return approvalList;
|
return approvalList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -200,19 +207,16 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
|||||||
String currentNode = flow.getCurrentNode();
|
String currentNode = flow.getCurrentNode();
|
||||||
// 验证当前用户是否有权限处理
|
// 验证当前用户是否有权限处理
|
||||||
if (!hasPermission(flow, currentNode, request.getUserId())) {
|
if (!hasPermission(flow, currentNode, request.getUserId())) {
|
||||||
throw new CommonException("无权限处理或已被处理");
|
throw new CommonException("无权限处理");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!"COUNTERSIGN".equals(currentNode)) {
|
|
||||||
String lockKey = FLOW_LOCK_PREFIX + flow.getId() + ":" + currentNode;
|
String lockKey = FLOW_LOCK_PREFIX + flow.getId() + ":" + currentNode;
|
||||||
String lockValue = UUID.randomUUID().toString();
|
String lockValue = UUID.randomUUID().toString();
|
||||||
boolean lockAcquired = redisLockUtil
|
boolean lockAcquired = redisLockUtil
|
||||||
.tryLock(lockKey, lockValue, FLOW_LOCK_EXPIRE_SECONDS, TimeUnit.SECONDS);
|
.tryLock(lockKey, lockValue, FLOW_LOCK_EXPIRE_SECONDS, TimeUnit.SECONDS);
|
||||||
|
|
||||||
if (!lockAcquired) {
|
if (!lockAcquired) {
|
||||||
throw new CommonException("当前节点正在处理,请稍后重试");
|
throw new CommonException("当前节点正在处理,请稍后重试");
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String processedKey = NODE_PROCESSED_PREFIX + flow.getId() + ":" + currentNode;
|
String processedKey = NODE_PROCESSED_PREFIX + flow.getId() + ":" + currentNode;
|
||||||
long processedCount = Optional.ofNullable(redisTemplate.opsForSet().size(processedKey))
|
long processedCount = Optional.ofNullable(redisTemplate.opsForSet().size(processedKey))
|
||||||
@ -224,9 +228,6 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
|||||||
} finally {
|
} finally {
|
||||||
redisLockUtil.unlock(lockKey, lockValue);
|
redisLockUtil.unlock(lockKey, lockValue);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
processApprovalLogic(flow, request, currentNode);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -245,7 +246,6 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
|||||||
approvalFlowView.setExplanation(flow.getExplanation());
|
approvalFlowView.setExplanation(flow.getExplanation());
|
||||||
approvalFlowView.setProofreadNodes(getNodeList(flowId, "PROOFREAD"));
|
approvalFlowView.setProofreadNodes(getNodeList(flowId, "PROOFREAD"));
|
||||||
approvalFlowView.setReviewNodes(getNodeList(flowId, "REVIEW"));
|
approvalFlowView.setReviewNodes(getNodeList(flowId, "REVIEW"));
|
||||||
approvalFlowView.setCountersignNodes(getNodeList(flowId, "COUNTERSIGN"));
|
|
||||||
approvalFlowView.setApproveNodes(getNodeList(flowId, "APPROVE"));
|
approvalFlowView.setApproveNodes(getNodeList(flowId, "APPROVE"));
|
||||||
|
|
||||||
approvalFlowView.setFlowStatus(flow.getFlowStatus());
|
approvalFlowView.setFlowStatus(flow.getFlowStatus());
|
||||||
@ -277,8 +277,6 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
|||||||
return JSON.parseArray(flow.getProofreadUsers()).toJavaList(String.class).contains(userId);
|
return JSON.parseArray(flow.getProofreadUsers()).toJavaList(String.class).contains(userId);
|
||||||
case "REVIEW":
|
case "REVIEW":
|
||||||
return JSON.parseArray(flow.getReviewUsers()).toJavaList(String.class).contains(userId);
|
return JSON.parseArray(flow.getReviewUsers()).toJavaList(String.class).contains(userId);
|
||||||
case "COUNTERSIGN":
|
|
||||||
return flow.getCountersignUsers() != null && JSON.parseArray(flow.getCountersignUsers()).toJavaList(String.class).contains(userId);
|
|
||||||
case "APPROVE":
|
case "APPROVE":
|
||||||
return JSON.parseArray(flow.getApproveUsers()).toJavaList(String.class).contains(userId);
|
return JSON.parseArray(flow.getApproveUsers()).toJavaList(String.class).contains(userId);
|
||||||
default:
|
default:
|
||||||
@ -369,22 +367,14 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
|||||||
Long processedCount = redisTemplate.opsForSet().size(key);
|
Long processedCount = redisTemplate.opsForSet().size(key);
|
||||||
if (processedCount == null) processedCount = 0L;
|
if (processedCount == null) processedCount = 0L;
|
||||||
|
|
||||||
// 会签节点需要所有人处理,其他节点只需1人
|
|
||||||
if ("COUNTERSIGN".equals(node)) {
|
|
||||||
return processedCount.equals((long) JSON.parseArray(flow.getCountersignUsers()).size());
|
|
||||||
} else {
|
|
||||||
return processedCount >= 1;
|
return processedCount >= 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private String getNextNode(String currentNode, ApprovalFlow flow) {
|
private String getNextNode(String currentNode, ApprovalFlow flow) {
|
||||||
switch (currentNode) {
|
switch (currentNode) {
|
||||||
case "PROOFREAD":
|
case "PROOFREAD":
|
||||||
return "REVIEW";
|
return "REVIEW";
|
||||||
case "REVIEW":
|
case "REVIEW":
|
||||||
return flow.getCountersignUsers() != null && !JSON.parseArray(flow.getCountersignUsers()).isEmpty()
|
|
||||||
? "COUNTERSIGN" : "APPROVE";
|
|
||||||
case "COUNTERSIGN":
|
|
||||||
return "APPROVE";
|
return "APPROVE";
|
||||||
case "APPROVE":
|
case "APPROVE":
|
||||||
return null; // 流程结束
|
return null; // 流程结束
|
||||||
@ -416,18 +406,12 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
|||||||
private void clearAllTodo(ApprovalFlow flow) {
|
private void clearAllTodo(ApprovalFlow flow) {
|
||||||
clearNodeTodo(flow, "PROOFREAD");
|
clearNodeTodo(flow, "PROOFREAD");
|
||||||
clearNodeTodo(flow, "REVIEW");
|
clearNodeTodo(flow, "REVIEW");
|
||||||
if (flow.getCountersignUsers() != null) {
|
|
||||||
clearNodeTodo(flow, "COUNTERSIGN");
|
|
||||||
}
|
|
||||||
clearNodeTodo(flow, "APPROVE");
|
clearNodeTodo(flow, "APPROVE");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearProcessed(ApprovalFlow flow) {
|
private void clearProcessed(ApprovalFlow flow) {
|
||||||
redisTemplate.delete(NODE_PROCESSED_PREFIX + flow.getId() + ":" + "PROOFREAD");
|
redisTemplate.delete(NODE_PROCESSED_PREFIX + flow.getId() + ":" + "PROOFREAD");
|
||||||
redisTemplate.delete(NODE_PROCESSED_PREFIX + flow.getId() + ":" + "REVIEW");
|
redisTemplate.delete(NODE_PROCESSED_PREFIX + flow.getId() + ":" + "REVIEW");
|
||||||
if (flow.getCountersignUsers() != null) {
|
|
||||||
redisTemplate.delete(NODE_PROCESSED_PREFIX + flow.getId() + ":" + "COUNTERSIGN");
|
|
||||||
}
|
|
||||||
redisTemplate.delete(NODE_PROCESSED_PREFIX + flow.getId() + ":" + "APPROVE");
|
redisTemplate.delete(NODE_PROCESSED_PREFIX + flow.getId() + ":" + "APPROVE");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -442,7 +426,6 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
|
|||||||
switch (node) {
|
switch (node) {
|
||||||
case "PROOFREAD": return JSON.parseArray(flow.getProofreadUsers()).toJavaList(String.class);
|
case "PROOFREAD": return JSON.parseArray(flow.getProofreadUsers()).toJavaList(String.class);
|
||||||
case "REVIEW": return JSON.parseArray(flow.getReviewUsers()).toJavaList(String.class);
|
case "REVIEW": return JSON.parseArray(flow.getReviewUsers()).toJavaList(String.class);
|
||||||
case "COUNTERSIGN": return JSON.parseArray(flow.getCountersignUsers()).toJavaList(String.class);
|
|
||||||
case "APPROVE": return JSON.parseArray(flow.getApproveUsers()).toJavaList(String.class);
|
case "APPROVE": return JSON.parseArray(flow.getApproveUsers()).toJavaList(String.class);
|
||||||
default: return Collections.emptyList();
|
default: return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,8 +10,10 @@ import com.xdap.self_development.pojo.Parameter;
|
|||||||
import com.xdap.self_development.pojo.RevisionRecord;
|
import com.xdap.self_development.pojo.RevisionRecord;
|
||||||
import com.xdap.self_development.pojo.Template;
|
import com.xdap.self_development.pojo.Template;
|
||||||
import com.xdap.self_development.pojo.TemplateAndParameter;
|
import com.xdap.self_development.pojo.TemplateAndParameter;
|
||||||
|
import com.xdap.self_development.pojo.view.MenuParamView;
|
||||||
import com.xdap.self_development.pojo.view.ParametersView;
|
import com.xdap.self_development.pojo.view.ParametersView;
|
||||||
import com.xdap.self_development.pojo.view.TemplateInfoView;
|
import com.xdap.self_development.pojo.view.TemplateInfoView;
|
||||||
|
import com.xdap.self_development.service.ModelRoleService;
|
||||||
import com.xdap.self_development.service.ParameterService;
|
import com.xdap.self_development.service.ParameterService;
|
||||||
import com.xdap.self_development.utils.FormulaValidator;
|
import com.xdap.self_development.utils.FormulaValidator;
|
||||||
import com.xdap.self_development.utils.ParameterOperation;
|
import com.xdap.self_development.utils.ParameterOperation;
|
||||||
@ -31,6 +33,8 @@ import java.util.stream.Collectors;
|
|||||||
public class ParameterServiceImpl implements ParameterService {
|
public class ParameterServiceImpl implements ParameterService {
|
||||||
@Resource
|
@Resource
|
||||||
private BusinessDatabase bd;
|
private BusinessDatabase bd;
|
||||||
|
@Resource
|
||||||
|
private ModelRoleService modelRoleService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageQueryResult<Parameter> getParameterByCondition(ParameterPageForm form) {
|
public PageQueryResult<Parameter> getParameterByCondition(ParameterPageForm form) {
|
||||||
@ -42,6 +46,8 @@ public class ParameterServiceImpl implements ParameterService {
|
|||||||
throw new CommonException("模板未找到");
|
throw new CommonException("模板未找到");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//todo 获取指定子系统下的用户的权限,权限应该为:参数的 parameterNumber
|
||||||
|
|
||||||
return bd.getBusinessDatabase()
|
return bd.getBusinessDatabase()
|
||||||
.viewQueryMode(true)
|
.viewQueryMode(true)
|
||||||
.view("selectParametersByTemplateId")
|
.view("selectParametersByTemplateId")
|
||||||
@ -83,8 +89,7 @@ public class ParameterServiceImpl implements ParameterService {
|
|||||||
switch (benchmark.getLastTemplate().getStatus()) {
|
switch (benchmark.getLastTemplate().getStatus()) {
|
||||||
// 如果最新版本为草稿状态,沿用该版本
|
// 如果最新版本为草稿状态,沿用该版本
|
||||||
case "DRAFT":
|
case "DRAFT":
|
||||||
newVersionTemplate = benchmark.getLastTemplate();
|
throw new CommonException("最新模板为草稿状态,暂时无法新建版本");
|
||||||
break;
|
|
||||||
// 如果最新版本为审核中,则不允许新建版本
|
// 如果最新版本为审核中,则不允许新建版本
|
||||||
case "APPROVING":
|
case "APPROVING":
|
||||||
throw new CommonException("最新模板审核中,暂时无法新建版本");
|
throw new CommonException("最新模板审核中,暂时无法新建版本");
|
||||||
@ -191,19 +196,21 @@ public class ParameterServiceImpl implements ParameterService {
|
|||||||
Template newTemplate)
|
Template newTemplate)
|
||||||
{
|
{
|
||||||
Map<Integer, Parameter> parameterMap = createParameterMap(existingParameters);
|
Map<Integer, Parameter> parameterMap = createParameterMap(existingParameters);
|
||||||
if (!existingParameters.isEmpty()) {
|
// if (!existingParameters.isEmpty()) {
|
||||||
// 清除原来的关联关系
|
// // 清除原来的关联关系
|
||||||
bd.getBusinessDatabase().eq("template_id", baseTemplate.getId()).doDelete(TemplateAndParameter.class);
|
// bd.getBusinessDatabase().eq("template_id", baseTemplate.getId()).doDelete(TemplateAndParameter.class);
|
||||||
}
|
// }
|
||||||
List<Parameter> newParameters = new ArrayList<>();
|
List<Parameter> newParameters = new ArrayList<>();
|
||||||
List<RevisionRecord> revisionRecords = new ArrayList<>();
|
List<RevisionRecord> revisionRecords = new ArrayList<>();
|
||||||
|
|
||||||
|
// 处理模板部分参数
|
||||||
for (ParameterForm parameterForm : parameterForms) {
|
for (ParameterForm parameterForm : parameterForms) {
|
||||||
if (parameterForm.getOperation() == null) {
|
if (parameterForm.getOperation() == null) {
|
||||||
parameterForm.setOperation("");
|
parameterForm.setOperation("");
|
||||||
}
|
}
|
||||||
ParameterOperation operation = ParameterOperation.fromCode(parameterForm.getOperation());
|
ParameterOperation operation = ParameterOperation.fromCode(parameterForm.getOperation());
|
||||||
|
|
||||||
|
|
||||||
switch (operation) {
|
switch (operation) {
|
||||||
case INSERT:
|
case INSERT:
|
||||||
handleInsertOperation(parameterForm, newTemplate, newParameters, revisionRecords, baseTemplate);
|
handleInsertOperation(parameterForm, newTemplate, newParameters, revisionRecords, baseTemplate);
|
||||||
@ -220,6 +227,9 @@ public class ParameterServiceImpl implements ParameterService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 处理模板剩余的参数
|
||||||
|
List<Parameter> unmatchedParameters = findUnmatchedParameters(parameterMap, parameterForms);
|
||||||
|
newParameters.addAll(unmatchedParameters);
|
||||||
return new ParameterProcessingResult(newParameters, revisionRecords);
|
return new ParameterProcessingResult(newParameters, revisionRecords);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -391,6 +401,19 @@ public class ParameterServiceImpl implements ParameterService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Parameter> findUnmatchedParameters(
|
||||||
|
Map<Integer, Parameter> parameterMap,
|
||||||
|
List<ParameterForm> parameterForms) {
|
||||||
|
Set<Integer> formNumbers = parameterForms.parallelStream()
|
||||||
|
.map(ParameterForm::getParameterNumber)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.collect(Collectors.toCollection(HashSet::new));
|
||||||
|
return parameterMap.entrySet().parallelStream()
|
||||||
|
.filter(entry -> !formNumbers.contains(entry.getKey()))
|
||||||
|
.map(Map.Entry::getValue)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存所有数据
|
* 保存所有数据
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -99,7 +99,7 @@ CREATE TABLE yfsjglpt_model_dep_user_role(
|
|||||||
) COMMENT '部门或用户关联角色表';
|
) COMMENT '部门或用户关联角色表';
|
||||||
|
|
||||||
|
|
||||||
--角色权限关联表
|
-- 角色权限关联表
|
||||||
DROP TABLE IF EXISTS yc_datasource_0.yfsjglpt_model_role_permission;
|
DROP TABLE IF EXISTS yc_datasource_0.yfsjglpt_model_role_permission;
|
||||||
CREATE TABLE yc_datasource_0.yfsjglpt_model_role_permission(
|
CREATE TABLE yc_datasource_0.yfsjglpt_model_role_permission(
|
||||||
`id` VARCHAR(64) NOT NULL COMMENT 'ID',
|
`id` VARCHAR(64) NOT NULL COMMENT 'ID',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user