mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2025-01-19 03:30:06 +08:00
仿钉钉流程设计- 会签按比例通过bug 修复
This commit is contained in:
parent
d7e1b87b1b
commit
8585e05772
@ -49,35 +49,23 @@ public class CompleteByRejectCountExpression {
|
|||||||
Integer rejectCount = CollectionUtils.getSumValue(execution.getExecutions(),
|
Integer rejectCount = CollectionUtils.getSumValue(execution.getExecutions(),
|
||||||
item -> Objects.equals(BpmTaskStatusEnum.REJECT.getStatus(), item.getVariableLocal(BpmConstants.TASK_VARIABLE_STATUS, Integer.class)) ? 1 : 0,
|
item -> Objects.equals(BpmTaskStatusEnum.REJECT.getStatus(), item.getVariableLocal(BpmConstants.TASK_VARIABLE_STATUS, Integer.class)) ? 1 : 0,
|
||||||
Integer::sum, 0);
|
Integer::sum, 0);
|
||||||
// 同意人数: 完成人数 - 拒绝人数
|
// 同意人数: 完成人数 - 拒绝人数
|
||||||
int agreeCount = nrOfCompletedInstances - rejectCount;
|
int agreeCount = nrOfCompletedInstances - rejectCount;
|
||||||
// 多人会签(按通过比例)
|
// 多人会签(按通过比例)
|
||||||
Integer approveRatio = NumberUtils.parseInt(BpmnModelUtils.parseExtensionElement(flowElement, USER_TASK_APPROVE_RATIO));
|
Integer approveRatio = NumberUtils.parseInt(BpmnModelUtils.parseExtensionElement(flowElement, USER_TASK_APPROVE_RATIO));
|
||||||
Assert.notNull(approveRatio, "通过比例不能空");
|
Assert.notNull(approveRatio, "通过比例不能空");
|
||||||
if (Objects.equals(100, approveRatio)) {
|
// 判断通过比例
|
||||||
// 所有人都同意
|
double approvePct = approveRatio / (double) 100;
|
||||||
if (agreeCount == nrOfInstances) {
|
double realApprovePct = (double) agreeCount / nrOfInstances;
|
||||||
return true;
|
if (realApprovePct >= approvePct) {
|
||||||
}
|
return true;
|
||||||
// 一个人拒绝了
|
}
|
||||||
if (rejectCount > 0) {
|
double rejectPct = (100 - approveRatio) / (double) 100;
|
||||||
execution.setVariable(String.format("%s_reject", flowElement.getId()), Boolean.TRUE);
|
double realRejectPct = (double) rejectCount / nrOfInstances;
|
||||||
return true;
|
// 判断拒绝比例
|
||||||
}
|
if (realRejectPct > rejectPct) {
|
||||||
} else {
|
execution.setVariable(String.format("%s_reject", flowElement.getId()), Boolean.TRUE);
|
||||||
// 判断通过比例
|
return true;
|
||||||
double approvePct = approveRatio / (double) 100;
|
|
||||||
double realApprovePct = (double) agreeCount / nrOfInstances;
|
|
||||||
if (realApprovePct >= approvePct) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
double rejectPct = (100 - approveRatio) / (double) 100;
|
|
||||||
double realRejectPct = (double) rejectCount / nrOfInstances;
|
|
||||||
// 判断拒绝比例
|
|
||||||
if (realRejectPct >= rejectPct) {
|
|
||||||
execution.setVariable(String.format("%s_reject", flowElement.getId()), Boolean.TRUE);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user