模板审核状态和流程模糊查询修改
This commit is contained in:
parent
f3266cdca8
commit
92a7a6a854
@ -6,7 +6,7 @@ import lombok.Data;
|
||||
|
||||
@SQLQuery(value = {
|
||||
@SQL(view = "getParameterAndChange",
|
||||
sql = "SELECT p.*, r.modify_details FROM ( SELECT *, ROW_NUMBER() OVER (PARTITION BY parameter_id ORDER BY create_time DESC) AS rn FROM yfsjglpt_model_revision_record ) r LEFT JOIN yfsjglpt_model_parameter p ON r.parameter_id = p.id WHERE r.rn = 1 and r.template_id = #templateId")
|
||||
sql = "SELECT p.*, r.modify_details FROM ( SELECT *, ROW_NUMBER() OVER (PARTITION BY parameter_id ORDER BY create_time DESC) AS rn FROM yfsjglpt_model_revision_record ) r LEFT JOIN yfsjglpt_model_parameter p ON r.parameter_id = p.id WHERE r.rn = 1 and r.template_id = #templateId order by r.create_time desc ")
|
||||
})
|
||||
@Data
|
||||
public class TemplateChangeView {
|
||||
|
||||
@ -13,7 +13,7 @@ import java.util.List;
|
||||
@SQL(view = "getApprovalByUserIdAndIds",
|
||||
sql = "SELECT af.id AS \"flowId\", t.id AS \"templateId\", t.template_name AS \"templateName\", t.version AS \"version\", t.status AS \"status\" , af.create_by AS \"createBy\", af.created_time AS \"createdTime\" , CASE WHEN current_node = 'PROOFREAD' THEN proofread_users WHEN current_node = 'REVIEW' THEN review_users WHEN current_node = 'COUNTERSIGN' THEN countersign_users WHEN current_node = 'APPROVE' THEN approve_users END AS current_users FROM yfsjglpt_model_approval_flow af JOIN yfsjglpt_model_template t ON af.template_id = t.id WHERE t.template_name like CONCAT('%',#templateName, '%') and t.status like CONCAT('%',#status, '%') and af.flow_type = 1 and af.id NOT IN (#ids) AND af.create_by = #createBy"),
|
||||
@SQL(view = "getTodoAndTemplate",
|
||||
sql = "SELECT af.id AS \"flowId\", t.id AS \"templateId\", t.template_name AS \"templateName\", t.version AS \"version\", t.status AS \"status\" , af.create_by AS \"createBy\", af.created_time AS \"createdTime\" , CASE WHEN current_node = 'PROOFREAD' THEN proofread_users WHEN current_node = 'REVIEW' THEN review_users WHEN current_node = 'COUNTERSIGN' THEN countersign_users WHEN current_node = 'APPROVE' THEN approve_users END AS current_users FROM yfsjglpt_model_approval_flow af JOIN yfsjglpt_model_template t ON af.template_id = t.id LEFT JOIN xdap_users xu ON xu.id = create_by WHERE t.template_name LIKE CONCAT('%', #templateName, '%') AND t.status LIKE CONCAT('%', #status, '%') AND t.created_time LIKE CONCAT('%', #createdTime, '%') AND xu.username LIKE CONCAT('%', #username, '%') AND af.flow_type = 1 AND af.id IN (#ids)")
|
||||
sql = "SELECT af.id AS \"flowId\", t.id AS \"templateId\", t.template_name AS \"templateName\", t.version AS \"version\", t.status AS \"status\" , af.create_by AS \"createBy\" , xu.username AS \"username\", af.created_time AS \"createdTime\" , CASE WHEN current_node = 'PROOFREAD' THEN proofread_users WHEN current_node = 'REVIEW' THEN review_users WHEN current_node = 'COUNTERSIGN' THEN countersign_users WHEN current_node = 'APPROVE' THEN approve_users END AS current_users FROM yfsjglpt_model_approval_flow af JOIN yfsjglpt_model_template t ON af.template_id = t.id LEFT JOIN xdap_users xu ON xu.id = af.create_by WHERE t.template_name LIKE CONCAT('%', #templateName, '%') AND t.status LIKE CONCAT('%', #status, '%') AND DATE(af.created_time) = #createdTime AND xu.username LIKE CONCAT('%', #username, '%') AND af.flow_type = 1 AND (af.id IN (#ids) OR af.create_by = #createBy)")
|
||||
})
|
||||
@Data
|
||||
public class TodoAndTemplateView {
|
||||
@ -24,6 +24,7 @@ public class TodoAndTemplateView {
|
||||
private String status;
|
||||
private String createBy;
|
||||
private String currentUsers;
|
||||
private String username;
|
||||
private List<ApprovalXdapUsers> currentApprovers;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Timestamp createdTime;
|
||||
|
||||
@ -113,21 +113,19 @@ public class TemplateApprovalServiceImpl implements TemplateApprovalService {
|
||||
@Transactional
|
||||
public List<TodoAndTemplateView> getApprovalList(ApprovalListForm form) {
|
||||
List<TodoAndTemplateView> approvalList = new ArrayList<>();
|
||||
Set<String> flowIds = new HashSet<>();
|
||||
flowIds.add(form.getUserId());
|
||||
flowIds.addAll(Objects.requireNonNull(redisTemplate.opsForSet().members(TODO_PREFIX + form.getUserId())));
|
||||
Set<String> flowIds = new HashSet<>(Objects.requireNonNull(redisTemplate.opsForSet().members(TODO_PREFIX + form.getUserId())));
|
||||
List<String> ids = new ArrayList<>(flowIds);
|
||||
List<TodoAndTemplateView> todoList =bd.getBusinessDatabase()
|
||||
.viewQueryMode(true)
|
||||
.view("getTodoAndTemplate")
|
||||
.setVar("ids", ids)
|
||||
.setVar("createBy", form.getUserId())
|
||||
.setVar("templateName", form.getTemplateName())
|
||||
.setVar("status", form.getStatus())
|
||||
.setVar("createdTime", form.getCreateDate())
|
||||
.setVar("username", form.getUsername())
|
||||
.setVar("username",form.getUsername())
|
||||
.doQuery(TodoAndTemplateView.class);
|
||||
setCurrentApprovers(approvalList, todoList);
|
||||
|
||||
return approvalList;
|
||||
}
|
||||
|
||||
@ -144,10 +142,6 @@ public class TemplateApprovalServiceImpl implements TemplateApprovalService {
|
||||
item.setCurrentApprovers(approvalXdapUsers);
|
||||
item.setCurrentUsers(null);
|
||||
}
|
||||
ApprovalXdapUsers approvalXdapUser = bd.getBusinessDatabase()
|
||||
.eq("id", item.getCreateBy())
|
||||
.doQueryFirst(ApprovalXdapUsers.class);
|
||||
item.setCreateBy(approvalXdapUser == null ? item.getCreateBy() : approvalXdapUser.getUsername());
|
||||
});
|
||||
approvalList.addAll(todoAndTemplateViews);
|
||||
}
|
||||
@ -215,9 +209,11 @@ public class TemplateApprovalServiceImpl implements TemplateApprovalService {
|
||||
|
||||
// 处理驳回逻辑
|
||||
if ("REJECT".equals(request.getResult())) {
|
||||
// 审批人退回
|
||||
cancelProcess(flow, "REJECTED");
|
||||
return;
|
||||
} else if ("RETURN".equals(request.getResult())) {
|
||||
// 申请人撤回
|
||||
cancelProcess(flow, "RETURNED");
|
||||
return;
|
||||
}
|
||||
@ -354,16 +350,17 @@ public class TemplateApprovalServiceImpl implements TemplateApprovalService {
|
||||
}
|
||||
|
||||
private void cancelProcess(ApprovalFlow flow, String status) {
|
||||
// 更新流程状态
|
||||
flow.setFlowStatus(status);
|
||||
bd.getBusinessDatabase()
|
||||
.rowid("id", flow.getRowId())
|
||||
.update("status", flow.getFlowStatus())
|
||||
.doUpdate(ApprovalFlow.class);
|
||||
// 更新模板状态
|
||||
// 更新模板状态(重新打回草稿状态)
|
||||
Template template = bd.getBusinessDatabase()
|
||||
.eq("id", flow.getTemplateId())
|
||||
.doQueryFirst(Template.class);
|
||||
template.setStatus(status);
|
||||
template.setStatus("DRAFT");
|
||||
bd.getBusinessDatabase()
|
||||
.rowid("id", template.getRowId())
|
||||
.update("status", template.getStatus())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user