模板bug修改进行中
This commit is contained in:
parent
c9a5fc9893
commit
0edc3baadb
@ -10,5 +10,7 @@ public class ApprovalListForm {
|
||||
private String userId;
|
||||
|
||||
private String templateName;
|
||||
private String username;
|
||||
private String createDate;
|
||||
private String status;
|
||||
}
|
||||
|
||||
@ -9,6 +9,8 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@SQLQuery(value = {
|
||||
@SQL(view = "getAllSubsystem",
|
||||
sql = "SELECT DISTINCT mp.subsystem_name FROM yfsjglpt_model_parameter mp INNER JOIN yfsjglpt_model_parameter_and_template mpat ON mp.id = mpat.parameter_id INNER JOIN yfsjglpt_model_template mt ON mpat.template_id = mt.id INNER JOIN ( SELECT template_name, MAX(version) AS max_version FROM yfsjglpt_model_template WHERE status = 'COMPLETE' GROUP BY template_name ) latest ON mt.template_name = latest.template_name AND mt.version = latest.max_version WHERE mt.status = 'COMPLETE' ORDER BY mt.template_name, mp.subsystem_name, mp.parameter_name"),
|
||||
@SQL(view = "selectParametersByTemplateId", sql =
|
||||
"select p.* from yfsjglpt_model_parameter p left join yfsjglpt_model_parameter_and_template tap on p.id = tap.parameter_id where tap.template_id = #templateId"),
|
||||
@SQL(view = "selectMaxNumber", sql =
|
||||
|
||||
@ -25,20 +25,20 @@ public class RevisionRecord extends MpaasBasePojo {
|
||||
private String templateId;
|
||||
private String preTemplateId;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private Timestamp createdTime;
|
||||
private Timestamp createTime;
|
||||
private String parameterId;
|
||||
|
||||
public RevisionRecord(String templateName, Integer version,
|
||||
Integer parameterNumber, String modifyDetails,
|
||||
String templateId, String preTemplateId,
|
||||
Timestamp createdTime, String parameterId) {
|
||||
Timestamp createTime, String parameterId) {
|
||||
this.templateName = templateName;
|
||||
this.version = version;
|
||||
this.parameterNumber = parameterNumber;
|
||||
this.modifyDetails = modifyDetails;
|
||||
this.templateId = templateId;
|
||||
this.preTemplateId = preTemplateId;
|
||||
this.createdTime = createdTime;
|
||||
this.createTime = createTime;
|
||||
this.parameterId = parameterId;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 created_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")
|
||||
})
|
||||
@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 WHERE t.template_name like CONCAT('%',#templateName, '%') and t.status like CONCAT('%',#status, '%') 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\", 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)")
|
||||
})
|
||||
@Data
|
||||
public class TodoAndTemplateView {
|
||||
|
||||
@ -7,6 +7,7 @@ import com.xdap.self_development.controller.form.DeptResponsiblePageForm;
|
||||
import com.xdap.self_development.controller.form.ResponsiblePersonForm;
|
||||
import com.xdap.self_development.controller.form.UpdateResponsiblePersonForm;
|
||||
import com.xdap.self_development.exception.CommonException;
|
||||
import com.xdap.self_development.pojo.Parameter;
|
||||
import com.xdap.self_development.pojo.ResponsiblePerson;
|
||||
import com.xdap.self_development.pojo.Template;
|
||||
import com.xdap.self_development.service.ResponsiblePersonService;
|
||||
@ -109,10 +110,11 @@ public class ResponsiblePersonServiceImpl implements ResponsiblePersonService {
|
||||
|
||||
@Override
|
||||
public Set<String> getAllSubsystem() {
|
||||
List<Template> templates = bd
|
||||
List<Parameter> templates = bd
|
||||
.getBusinessDatabase()
|
||||
.select("template_name")
|
||||
.doQuery(Template.class);
|
||||
return templates.stream().map(Template::getTemplateName).collect(Collectors.toSet());
|
||||
.viewQueryMode(true)
|
||||
.view("getAllSubsystem")
|
||||
.doQuery(Parameter.class);
|
||||
return templates.stream().map(Parameter::getSubsystemName).collect(Collectors.toSet());
|
||||
}
|
||||
}
|
||||
|
||||
@ -113,9 +113,9 @@ public class TemplateApprovalServiceImpl implements TemplateApprovalService {
|
||||
@Transactional
|
||||
public List<TodoAndTemplateView> getApprovalList(ApprovalListForm form) {
|
||||
List<TodoAndTemplateView> approvalList = new ArrayList<>();
|
||||
Set<String> flowIds = redisTemplate.opsForSet().members(TODO_PREFIX + form.getUserId());
|
||||
|
||||
if (flowIds != null && !flowIds.isEmpty()) {
|
||||
Set<String> flowIds = new HashSet<>();
|
||||
flowIds.add(form.getUserId());
|
||||
flowIds.addAll(Objects.requireNonNull(redisTemplate.opsForSet().members(TODO_PREFIX + form.getUserId())));
|
||||
List<String> ids = new ArrayList<>(flowIds);
|
||||
List<TodoAndTemplateView> todoList =bd.getBusinessDatabase()
|
||||
.viewQueryMode(true)
|
||||
@ -123,22 +123,11 @@ public class TemplateApprovalServiceImpl implements TemplateApprovalService {
|
||||
.setVar("ids", ids)
|
||||
.setVar("templateName", form.getTemplateName())
|
||||
.setVar("status", form.getStatus())
|
||||
.setVar("createdTime", form.getCreateDate())
|
||||
.setVar("username", form.getUsername())
|
||||
.doQuery(TodoAndTemplateView.class);
|
||||
setCurrentApprovers(approvalList, todoList);
|
||||
|
||||
}
|
||||
|
||||
List<String> ids = (flowIds == null || flowIds.isEmpty()) ? new ArrayList<>(Collections.singleton("")) : new ArrayList<>(flowIds);
|
||||
List<TodoAndTemplateView> todoAndTemplateViews = bd.getBusinessDatabase()
|
||||
.viewQueryMode(true)
|
||||
.view("getApprovalByUserIdAndIds")
|
||||
.setVar("ids", ids)
|
||||
.setVar("createBy", form.getUserId())
|
||||
.setVar("templateName", form.getTemplateName())
|
||||
.setVar("status", form.getStatus())
|
||||
.doQuery(TodoAndTemplateView.class);
|
||||
setCurrentApprovers(approvalList, todoAndTemplateViews);
|
||||
|
||||
return approvalList;
|
||||
}
|
||||
|
||||
|
||||
@ -62,17 +62,7 @@ public class TemplateServiceImpl implements TemplateService {
|
||||
|
||||
// 如果有同名称模板
|
||||
if (template != null) {
|
||||
switch (template.getStatus()) {
|
||||
// 最新版本为草稿,提示已有草稿
|
||||
case "DRAFT":
|
||||
throw new CommonException("最新版本已为草稿,请勿重复新增");
|
||||
case "APPROVING":
|
||||
throw new CommonException("最新版本正在审核中,请勿重复新增");
|
||||
case "RETURNED":
|
||||
throw new CommonException("最新版本已被退回,请重新修改模板");
|
||||
}
|
||||
// 可新增版本
|
||||
newTemplate.setVersion(template.getVersion() + 1);
|
||||
throw new CommonException("已有同名版本,导入失败");
|
||||
}
|
||||
|
||||
bd.getBusinessDatabase().doInsert(newTemplate);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user