修改:对标报告逻辑问题

This commit is contained in:
zjh 2025-12-16 10:10:12 +08:00
parent 793764326f
commit 7eae9974f8
13 changed files with 152 additions and 92 deletions

View File

@ -1,6 +1,7 @@
package com.xdap.self_development.controller;
import com.definesys.mpaas.common.http.Response;
import com.definesys.mpaas.query.db.PageQueryResult;
import com.xdap.self_development.controller.form.BenchmarkingReportPageForm;
import com.xdap.self_development.controller.form.HandleApprovalRequest;
import com.xdap.self_development.controller.form.SaveBenchmarkingReportForm;
@ -77,7 +78,7 @@ public class BenchmarkingReportController {
throw new CommonException(error.getDefaultMessage());
});
}
List<TodoAndReportView> list = benchmarkingReportService
PageQueryResult<TodoAndReportView> list = benchmarkingReportService
.getBenchmarkingReportByCondition(form);
return Response.ok().data(list);
}

View File

@ -4,11 +4,13 @@ import com.definesys.mpaas.common.http.Response;
import com.definesys.mpaas.query.MpaasQueryFactory;
import com.xdap.motor.entity.SnowflakeIdWorker;
import com.xdap.runtime.service.RuntimeAppContextService;
import com.xdap.self_development.common.MyResponse;
import com.xdap.self_development.common.UserPermissionGetter;
import com.xdap.self_development.config.BusinessDatabase;
import com.xdap.self_development.feign.ApaasMyTokenFeign;
import com.xdap.self_development.pojo.ClassificationAttribute;
import com.xdap.self_development.pojo.EnginePartsCollection;
import com.xdap.self_development.schedule.ParameterValueCalculationTimer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -35,12 +37,20 @@ public class DeleteController {
private RuntimeAppContextService runtimeAppContextService;
@Resource
private SnowflakeIdWorker snowflakeIdWorker;
@Resource
private ParameterValueCalculationTimer timer;
@Value("${apaas.token.clientId}")
private String clientId;
@Value("${apaas.token.clientSecred}")
private String clientSecret;
@GetMapping("/timer")
public Response timer() {
MyResponse myResponse = timer.dailyCalculate();
return Response.ok().data(myResponse);
}
@GetMapping("/getTC")
public Response getTC(
@RequestParam String productNumber,

View File

@ -2,7 +2,9 @@ package com.xdap.self_development.controller.form;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@Data
public class ApprovalListForm {
@ -10,5 +12,13 @@ public class ApprovalListForm {
private String username;
private String createDate;
private String status;
@NotBlank(message = "用户不能为空")
private String userId;
@NotNull(message = "页码不能为空")
@Min(value = 1, message = "页码不能小于1")
private Integer pageNumber;
@NotNull(message = "每页条数不能为空")
@Min(value = 1, message = "每页条数不能小于1")
private Integer pageSize;
}

View File

@ -2,7 +2,9 @@ package com.xdap.self_development.controller.form;
import lombok.Data;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
@Data
public class BenchmarkingReportPageForm {
@ -22,11 +24,11 @@ public class BenchmarkingReportPageForm {
@NotBlank(message = "上传用户不能为空")
private String createBy;
// @NotNull(message = "页码不能为空")
// @Min(value = 1, message = "页码不能小于1")
// private Integer pageNumber;
//
// @NotNull(message = "每页条数不能为空")
// @Min(value = 1, message = "每页条数不能小于1")
// private Integer pageSize;
@NotNull(message = "页码不能为空")
@Min(value = 1, message = "页码不能小于1")
private Integer pageNumber;
@NotNull(message = "每页条数不能为空")
@Min(value = 1, message = "每页条数不能小于1")
private Integer pageSize;
}

View File

@ -35,6 +35,7 @@ public class BenchmarkingReport extends MpaasBasePojo {
private String projectName;
private String projectNumber;
private String createBy;
private Integer isDelete;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Timestamp uploadTime;

View File

@ -6,8 +6,11 @@ import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.sql.Timestamp;
import java.util.List;
@SQLQuery(value = {
@SQL(view = "getAllReportApproval",
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.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 af.flow_type = 2 ORDER BY CASE br.status WHEN 'COMPLETE' THEN 1 WHEN 'APPROVING' THEN 2 WHEN 'REJECTED' THEN 3 ELSE 4 END ASC"),
@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(view = "getTodoAndReport",

View File

@ -11,7 +11,7 @@ import java.util.List;
@SQLQuery(value = {
@SQL(view = "getAllApproval",
sql = "SELECT af.id AS \"flowId\", t.id AS \"templateId\", t.template_name AS \"templateName\", t.version AS \"version\", af.flow_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 ORDER BY CASE af.flow_status WHEN 'COMPLETE' THEN 1 WHEN 'APPROVING' THEN 2 WHEN 'DRAFT' THEN 3 WHEN 'REJECTED' THEN 4 ELSE 5 END ASC"),
sql = "SELECT af.id AS \"flowId\", t.id AS \"templateId\", t.template_name AS \"templateName\", t.version AS \"version\", af.flow_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 t.created_time LIKE CONCAT('%', #createdTime, '%') AND xu.username LIKE CONCAT('%', #username, '%') AND af.flow_type = 1 ORDER BY CASE af.flow_status WHEN 'COMPLETE' THEN 1 WHEN 'APPROVING' THEN 2 WHEN 'DRAFT' THEN 3 WHEN 'REJECTED' THEN 4 ELSE 5 END ASC"),
@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",

View File

@ -1,11 +1,13 @@
package com.xdap.self_development.schedule;
import com.xdap.self_development.common.MyResponse;
import com.xdap.self_development.config.BusinessDatabase;
import com.xdap.self_development.exception.CommonException;
import com.xdap.self_development.pojo.ClassificationAttribute;
import com.xdap.self_development.pojo.EnginePartsCollection;
import com.xdap.self_development.pojo.view.CalculationParameterView;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -23,11 +25,16 @@ import java.util.stream.Collectors;
public class ParameterValueCalculationTimer {
@Resource
private BusinessDatabase bd;
// @Scheduled(cron = "0 0 0 * * ?")
// @Scheduled(cron = "0 */1 * * * *")
public void dailyCalculate() {
public MyResponse dailyCalculate() {
MyResponse myResponse = new MyResponse();
myResponse.setErrors(new ArrayList<>());
LocalDate today = LocalDate.now();
log.info("开始执行{}参数计算任务", today);
myResponse.getErrors().add("开始执行"+today+"参数计算任务");
List<CalculationParameterView> toUpdate = new ArrayList<>();
// 1.查询所有参数配置
@ -37,12 +44,13 @@ public class ParameterValueCalculationTimer {
.doQuery(CalculationParameterView.class);
if (parameterValues.isEmpty()) {
log.info("无参数配置,跳过计算");
return;
return myResponse;
}
// 2.从中台更新参数值
for (CalculationParameterView parameter : parameterValues) {
if (Objects.equals(parameter.getParameterSource(), "TC分类表")) {
try {
EnginePartsCollection enginePartsCollection = bd.getBusinessDatabase()
.eq("ztj", parameter.getProductNumber())
.eq("lbjmc", parameter.getPartsName())
@ -56,7 +64,10 @@ public class ParameterValueCalculationTimer {
.doQueryFirst(ClassificationAttribute.class);
if (classificationAttribute != null && classificationAttribute.getFieldvalue() != null) {
parameter.setParameterValue(classificationAttribute.getFieldvalue());
toUpdate.add(parameter);
}
} catch (Exception e) {
log.error("参数【{}】从中台更新值失败:{}", parameter.getParameterName(), e.getMessage(), e);
myResponse.getErrors().add("参数【"+parameter.getParameterName()+"】从中台更新值失败:"+e.getMessage());
}
}
}
@ -78,30 +89,34 @@ public class ParameterValueCalculationTimer {
String replacedFormula = replaceParametersInFormula(formula, parameterNames, originalValueMap, modelId);
Double result = calculateExpression(replacedFormula);
String formattedResult = String.format("%.6f", result);
log.info("计算结果:{}", formattedResult);
parameterValue.setParameterValue(formattedResult);
toUpdate.add(parameterValue);
log.info("参数【{}】计算结果:{}", parameterValue.getParameterName(), formattedResult);
myResponse.getErrors().add("参数【"+parameterValue.getParameterName()+"】计算结果:"+formattedResult);
} catch (Exception e) {
log.error("参数【{}】计算失败:{},公式:{}模型ID{}",
parameterValue.getParameterName(), e.getMessage(), formula, modelId);
throw new RuntimeException("参数【" + parameterValue.getParameterName() + "】计算失败:" + e.getMessage());
parameterValue.getParameterName(), e.getMessage(), formula, modelId, e);
myResponse.getErrors().add("参数【"+parameterValue.getParameterName()+"】计算失败:"+e.getMessage()+",公式:"+formula+"模型ID"+modelId);
parameterValue.setParameterValue(null);
}
}
}
// 批量插入或更新计算结果
if (!toUpdate.isEmpty()) {
toUpdate.forEach(parameterValue -> {
bd.getBusinessDatabase()
.table("engine_param_detail")
.eq("id", parameterValue.getId())
.update("parameter_value", parameterValue.getParameterValue())
.doUpdate();
});
}
log.info("{}参数计算完成,共处理{}个参数", today, toUpdate.size());
// if (!toUpdate.isEmpty()) {
// toUpdate.forEach(parameterValue -> {
// if (parameterValue.getParameterValue() != null) {
// bd.getBusinessDatabase()
// .table("engine_param_detail")
// .eq("id", parameterValue.getId())
// .update("parameter_value", parameterValue.getParameterValue())
// .doUpdate();
// }
// });
// }
// log.info("{}参数计算完成,成功处理{}个参数,失败参数已跳过", today, toUpdate.stream()
// .filter(p -> p.getParameterValue() != null).count());
return myResponse;
}
private String replaceParametersInFormula(String formula, List<String> parameterNames,
@ -114,7 +129,6 @@ public class ParameterValueCalculationTimer {
String value = getParameterValue(valueMap, paramName, modelId);
result = result.replaceAll(pattern, value);
}
return result;
}
@ -130,12 +144,10 @@ public class ParameterValueCalculationTimer {
}
private Double calculateExpression(String expression) throws RuntimeException {
Double result = calculateWithScriptEngine(expression);
if (result != null) {
return result;
}
throw new RuntimeException("无法计算表达式: " + expression);
}
@ -152,7 +164,7 @@ public class ParameterValueCalculationTimer {
}
return null;
} catch (Exception e) {
log.warn("ScriptEngine计算失败: {}, 错误: {}", expression, e.getMessage());
log.warn("ScriptEngine计算失败: {}, 错误: {}", expression, e.getMessage(), e);
return null;
}
}
@ -169,7 +181,6 @@ public class ParameterValueCalculationTimer {
return false;
}
}
return true;
}
@ -179,7 +190,6 @@ public class ParameterValueCalculationTimer {
if (list == null) {
return new HashMap<>();
}
// 参数名在所有子系统都唯一
// 转为以参数名为key机型代号为key参数值为值为值的形式
return list.stream()

View File

@ -1,5 +1,6 @@
package com.xdap.self_development.service;
import com.definesys.mpaas.query.db.PageQueryResult;
import com.xdap.self_development.controller.form.BenchmarkingReportPageForm;
import com.xdap.self_development.controller.form.HandleApprovalRequest;
import com.xdap.self_development.controller.form.SaveBenchmarkingReportForm;
@ -14,7 +15,7 @@ import javax.validation.constraints.NotBlank;
import java.util.List;
public interface BenchmarkingReportService {
List<TodoAndReportView> getBenchmarkingReportByCondition(@Valid BenchmarkingReportPageForm form);
PageQueryResult<TodoAndReportView> getBenchmarkingReportByCondition(@Valid BenchmarkingReportPageForm form);
void saveBenchmarkingReport(@Valid SaveBenchmarkingReportForm form);

View File

@ -11,7 +11,7 @@ import java.util.List;
public interface TemplateApprovalService {
String startApproval(StartApprovalRequest request);
List<TodoAndTemplateView> getApprovalList(ApprovalListForm form);
PageQueryResult<TodoAndTemplateView> getApprovalList(ApprovalListForm form);
void handleApproval(HandleApprovalRequest request);
PageQueryResult<TemplateChangeView> getTemplateChanges(@Valid ApprovalAndParameterForm form);
ApprovalFlowView getApprovalProcess(@Valid ApprovalFlowForm form);

View File

@ -3,6 +3,7 @@ package com.xdap.self_development.service.impl;
import cn.hutool.core.codec.Base64;
import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSON;
import com.definesys.mpaas.query.db.PageQueryResult;
import com.xdap.runtime.service.RuntimeAppContextService;
import com.xdap.self_development.common.UserPermissionGetter;
import com.xdap.self_development.config.BusinessDatabase;
@ -75,6 +76,7 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
report.setUploadTime(Timestamp.valueOf(LocalDateTime.now()));
report.setStatus("APPROVING");
report.setCreateBy(form.getUserId());
report.setIsDelete(0);
bd.getBusinessDatabase().doInsert(report);
// 2. 创建审批流程
ApprovalFlow flow = new ApprovalFlow();
@ -129,17 +131,20 @@ 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);
bd.getBusinessDatabase()
.eq("id", form.getReportId())
.update("is_delete", 1)
.doUpdate(BenchmarkingReport.class);
BenchmarkingReport report = new BenchmarkingReport();
BeanUtils.copyProperties(form, report);
report.setFilePath(form.getFileUrl() == null ? "" : form.getFileUrl());
report.setUploadTime(Timestamp.valueOf(LocalDateTime.now()));
report.setStatus("APPROVING");
report.setCreateBy(form.getCreateBy());
bd.getBusinessDatabase().doInsert(report);
ApprovalFlow flow = new ApprovalFlow();
flow.setTemplateId(originalReport.getId());
flow.setTemplateId(report.getId());
flow.setCurrentNode("PROOFREAD");
flow.setFlowStatus("APPROVING");
flow.setProofreadUsers(JSON.toJSONString(form.getProofreadUsers()));
@ -189,15 +194,13 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
}
@Override
public List<TodoAndReportView> getBenchmarkingReportByCondition(BenchmarkingReportPageForm form) {
List<TodoAndReportView> approvalList = new ArrayList<>();
Set<String> flowIds = new HashSet<>(Objects.requireNonNull(redisTemplate.opsForSet().members(TODO_PREFIX + form.getCreateBy())));
List<String> ids = new ArrayList<>(flowIds);
List<TodoAndReportView> todoList =bd.getBusinessDatabase()
public PageQueryResult<TodoAndReportView> getBenchmarkingReportByCondition(BenchmarkingReportPageForm form) {
// List<TodoAndReportView> approvalList = new ArrayList<>();
// Set<String> flowIds = new HashSet<>(Objects.requireNonNull(redisTemplate.opsForSet().members(TODO_PREFIX + form.getCreateBy())));
// List<String> ids = new ArrayList<>(flowIds);
PageQueryResult<TodoAndReportView> result = bd.getBusinessDatabase()
.viewQueryMode(true)
.view("getTodoAndReport")
.setVar("ids", ids)
.setVar("createBy", form.getCreateBy())
.view("getAllReportApproval")
.setVar("title", form.getTitle())
.setVar("manufacturerName", form.getManufacturerName())
.setVar("modelName", form.getModelName())
@ -210,19 +213,36 @@ public class BenchmarkingReportServiceImpl implements BenchmarkingReportService
.setVar("projectName", form.getProjectName())
.setVar("projectNumber", form.getProjectNumber())
.setVar("status", form.getStatus())
.doQuery(TodoAndReportView.class);
setCurrentApprovers(approvalList, todoList);
return approvalList;
.doPageQuery(form.getPageNumber(), form.getPageSize(), TodoAndReportView.class);
// List<TodoAndReportView> todoList = bd.getBusinessDatabase()
// .viewQueryMode(true)
// .view("getTodoAndReport")
// .setVar("ids", ids)
// .setVar("createBy", form.getCreateBy())
// .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(result);
return result;
}
private void setCurrentApprovers(List<TodoAndReportView> approvalList, List<TodoAndReportView> todoAndReportViews) {
todoAndReportViews.forEach(item -> {
private void setCurrentApprovers(PageQueryResult<TodoAndReportView> result) {
result.getResult().forEach(item -> {
ApprovalXdapUsers approvalXdapUser = bd.getBusinessDatabase()
.eq("id", item.getCreateBy())
.doQueryFirst(ApprovalXdapUsers.class);
item.setCreateBy(approvalXdapUser == null ? item.getCreateBy() : approvalXdapUser.getUsername());
});
approvalList.addAll(todoAndReportViews);
}
@Override

View File

@ -212,7 +212,7 @@ public class CommonParameterServiceImpl implements CommonParameterService {
.map(param -> new ParametersView(
param.getParameterId(),
param.getParameterName(),
param.getSubsystemName(),
param.getParameterType(),
param.getSubsystemName(),
param.getPartsName()
))

View File

@ -141,31 +141,34 @@ public class TemplateApprovalServiceImpl implements TemplateApprovalService {
@Override
@Transactional
public List<TodoAndTemplateView> getApprovalList(ApprovalListForm form) {
// List<TodoAndTemplateView> todoAndTemplateViews = bd.getBusinessDatabase()
// .viewQueryMode(true)
// .view("getAllApproval")
// .doQuery(TodoAndTemplateView.class);
List<TodoAndTemplateView> approvalList = new ArrayList<>();
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()
public PageQueryResult<TodoAndTemplateView> getApprovalList(ApprovalListForm form) {
// List<TodoAndTemplateView> approvalList = new ArrayList<>();
// Set<String> flowIds = new HashSet<>(Objects.requireNonNull(redisTemplate.opsForSet().members(TODO_PREFIX + form.getUserId())));
// List<String> ids = new ArrayList<>(flowIds);
PageQueryResult<TodoAndTemplateView> result = bd.getBusinessDatabase()
.viewQueryMode(true)
.view("getTodoAndTemplate")
.setVar("ids", ids)
.setVar("createBy", form.getUserId())
.view("getAllApproval")
.setVar("templateName", form.getTemplateName())
.setVar("status", form.getStatus())
.setVar("createdTime", form.getCreateDate() == null ? "" : form.getCreateDate())
.setVar("username",form.getUsername())
.doQuery(TodoAndTemplateView.class);
setCurrentApprovers(approvalList, todoList);
return approvalList;
// return todoAndTemplateViews;
.setVar("username", form.getUsername())
.doPageQuery(form.getPageNumber(), form.getPageSize(), TodoAndTemplateView.class);
// 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() == null ? "" : form.getCreateDate())
// .setVar("username",form.getUsername())
// .doQuery(TodoAndTemplateView.class);
setCurrentApprovers(result);
return result;
}
private void setCurrentApprovers(List<TodoAndTemplateView> approvalList, List<TodoAndTemplateView> todoAndTemplateViews) {
todoAndTemplateViews.forEach(item -> {
private void setCurrentApprovers(PageQueryResult<TodoAndTemplateView> result) {
result.getResult().forEach(item -> {
if (item.getCurrentUsers() == null || item.getCurrentUsers().isEmpty()) {
item.setCurrentApprovers(null);
item.setCurrentUsers(null);
@ -178,7 +181,6 @@ public class TemplateApprovalServiceImpl implements TemplateApprovalService {
item.setCurrentUsers(null);
}
});
approvalList.addAll(todoAndTemplateViews);
}
@Override