diff --git a/src/main/java/com/xdap/self_development/listener/SheetDataListener.java b/src/main/java/com/xdap/self_development/listener/SheetDataListener.java index 94d8dda..fd18180 100644 --- a/src/main/java/com/xdap/self_development/listener/SheetDataListener.java +++ b/src/main/java/com/xdap/self_development/listener/SheetDataListener.java @@ -23,7 +23,6 @@ public class SheetDataListener implements ReadListener { private List cachedDataList; private String currentSheetName; MyResponse problems; - Integer maxOrder; // 用于存储表头 private Set actualHeaders = new HashSet<>(); @@ -35,14 +34,13 @@ public class SheetDataListener implements ReadListener { private boolean validSheet = false; public SheetDataListener(TemplateService templateService, - String templateRowId, String createBy, MyResponse problems, Integer maxOrder) { + String templateRowId, String createBy, MyResponse problems) { this.templateService = templateService; this.templateRowId = templateRowId; this.createBy = createBy; this.cachedDataList = new ArrayList<>(BATCH_SIZE); this.problems = problems; this.requiredHeaders = getIncludeColumnFieldNames(); - this.maxOrder = maxOrder; } @Override @@ -104,8 +102,7 @@ public class SheetDataListener implements ReadListener { currentSheetName, templateRowId, createBy, - problems, - maxOrder + problems ); cachedDataList.clear(); } @@ -147,7 +144,6 @@ public class SheetDataListener implements ReadListener { headerChecked = false; validSheet = false; actualHeaders.clear(); - maxOrder += 1; } private static Set getIncludeColumnFieldNames() { diff --git a/src/main/java/com/xdap/self_development/pojo/Template.java b/src/main/java/com/xdap/self_development/pojo/Template.java index 5d666b6..fb4c644 100644 --- a/src/main/java/com/xdap/self_development/pojo/Template.java +++ b/src/main/java/com/xdap/self_development/pojo/Template.java @@ -35,14 +35,14 @@ public class Template extends MpaasBasePojo { private Timestamp createdTime; @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") private Timestamp publishedTime; - private Integer orderNum; + private Long orderNum; private String createBy; @Column(type = ColumnType.CALCULATE) private Integer maxOrder; - public Template(String templateName, Integer version, String status, Timestamp createdTime, Timestamp publishedTime, String createBy, Integer orderNum) { + public Template(String templateName, Integer version, String status, Timestamp createdTime, Timestamp publishedTime, String createBy, Long orderNum) { this.templateName = templateName; this.version = version; this.status = status; diff --git a/src/main/java/com/xdap/self_development/pojo/view/TodoAndReportView.java b/src/main/java/com/xdap/self_development/pojo/view/TodoAndReportView.java index 851dd42..804ea09 100644 --- a/src/main/java/com/xdap/self_development/pojo/view/TodoAndReportView.java +++ b/src/main/java/com/xdap/self_development/pojo/view/TodoAndReportView.java @@ -10,11 +10,11 @@ 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 = "SELECT br.id AS \"reportId\", af.id AS \"flowId\", br.* FROM yfsjglpt_model_approval_flow af RIGHT JOIN yfsjglpt_model_benchmarking_report br ON af.template_id = br.id AND af.flow_type = 2 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, '%') 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 = "SELECT br.id AS \"reportId\", af.id AS \"flowId\", br.* FROM yfsjglpt_model_approval_flow af LEFT 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 = "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") + sql = "SELECT br.id AS \"reportId\", af.id AS \"flowId\", br.* FROM yfsjglpt_model_approval_flow af LEFT 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 public class TodoAndReportView { diff --git a/src/main/java/com/xdap/self_development/schedule/ModifiedTodoTimer.java b/src/main/java/com/xdap/self_development/schedule/ModifiedTodoTimer.java deleted file mode 100644 index ce6b59a..0000000 --- a/src/main/java/com/xdap/self_development/schedule/ModifiedTodoTimer.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.xdap.self_development.schedule; - -import com.alibaba.fastjson2.JSON; -import com.xdap.self_development.config.BusinessDatabase; -import com.xdap.self_development.exception.CommonException; -import com.xdap.self_development.pojo.ApprovalFlow; -import com.xdap.self_development.pojo.ApprovalRecord; -import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.data.redis.core.StringRedisTemplate; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.Resource; -import java.util.Collections; -import java.util.List; -import java.util.Objects; -import java.util.stream.Collectors; - -@Service -@Slf4j -@Transactional(rollbackFor = CommonException.class) -public class ModifiedTodoTimer { - @Resource - private BusinessDatabase bd; - @Autowired - private StringRedisTemplate redisTemplate; - private static final String TODO_PREFIX = "approval:todo:"; - private static final String TODO_PREFIX_2 = "report:todo:"; - - private static final String NODE_PROCESSED_PREFIX = "approval:node:processed:"; - private static final String NODE_PROCESSED_PREFIX_2 = "report:node:processed:"; - -// @Scheduled(cron = "0 */1 * * * *") - public void modifiedTodo() { - // 获取审批中的所有流程 - List flows1 = bd.getBusinessDatabase() - .eq("flow_status", "APPROVING") - .eq("flow_type", 1) - .doQuery(ApprovalFlow.class); - checkFlows(flows1, TODO_PREFIX, NODE_PROCESSED_PREFIX); - - List flows2 = bd.getBusinessDatabase() - .eq("flow_status", "APPROVING") - .eq("flow_type", 2) - .doQuery(ApprovalFlow.class); - checkFlows(flows2, TODO_PREFIX_2, NODE_PROCESSED_PREFIX_2); - } - - // 检查流程 - private void checkFlows(List flows, String todoFlag, String prefixFlag) { - // 遍历每一个流程 - flows.forEach(flow -> { - List nodeUsers = getNodeUsers(flow, flow.getCurrentNode()); - List records = bd.getBusinessDatabase() - .eq("flow_id", flow.getId()) - .eq("node", flow.getCurrentNode()) - .doQuery(ApprovalRecord.class) - .stream().map(ApprovalRecord::getUserId) - .collect(Collectors.toList()); - - if (Objects.equals(flow.getCurrentNode(), "COUNTERSIGN")) { - log.info("{}审批流,的COUNTERSIGN的已完成的人:{}", flow.getId(), records); - records.forEach(record -> { - Boolean isMember = redisTemplate.opsForSet() - .isMember(prefixFlag + flow.getId() + ":" + flow.getCurrentNode(), record); - if (Boolean.FALSE.equals(isMember)) { - redisTemplate.opsForSet().add(prefixFlag + flow.getId() + ":" + flow.getCurrentNode(), record); - } - }); - } - - // 未完成当前节点审批任务的人 - List collected = nodeUsers.stream() - .filter(element -> !records.contains(element)) - .collect(Collectors.toList()); - - collected.forEach(element -> { - // 检查redis是否存在该待办节点 - Boolean isMember = redisTemplate.opsForSet().isMember(todoFlag + element, flow.getId()); - log.info("{}{} is member: {}", todoFlag + element, flow.getId(), isMember); - if (Boolean.FALSE.equals(isMember)) { - redisTemplate.opsForSet().add(todoFlag + element, flow.getId()); - log.info("{}{} is added", todoFlag, element); - } - }); - }); - } - - private List getNodeUsers(ApprovalFlow flow, String node) { - switch (node) { - case "PROOFREAD": return JSON.parseArray(flow.getProofreadUsers()).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); - default: return Collections.emptyList(); - } - } -} diff --git a/src/main/java/com/xdap/self_development/service/TemplateService.java b/src/main/java/com/xdap/self_development/service/TemplateService.java index 9bd0a67..1ec3c3b 100644 --- a/src/main/java/com/xdap/self_development/service/TemplateService.java +++ b/src/main/java/com/xdap/self_development/service/TemplateService.java @@ -17,7 +17,7 @@ public interface TemplateService { MyResponse importTemplate(MultipartFile file, String templateRowId, String userId); void processSheetData(List dataList, String sheetName, - String templateRowId, String createBy, MyResponse problems,Integer maxOrder); + String templateRowId, String createBy, MyResponse problems); void insertTemplate(InsertTemplateForm form); diff --git a/src/main/java/com/xdap/self_development/service/impl/EngineParamDetailServiceImpl.java b/src/main/java/com/xdap/self_development/service/impl/EngineParamDetailServiceImpl.java index 526fa8c..4574dd7 100644 --- a/src/main/java/com/xdap/self_development/service/impl/EngineParamDetailServiceImpl.java +++ b/src/main/java/com/xdap/self_development/service/impl/EngineParamDetailServiceImpl.java @@ -94,7 +94,7 @@ public class EngineParamDetailServiceImpl implements EngineParamDetailService { ) )); ArrayList