增加工程量清单的规格、以及招采和物资的审核
This commit is contained in:
@ -143,7 +143,7 @@ public class ExcelReader {
|
||||
|
||||
List<String> rowData = new ArrayList<>();
|
||||
// 读取A到E列(索引0到4)
|
||||
for (int cellIndex = 0; cellIndex < 5; cellIndex++) {
|
||||
for (int cellIndex = 0; cellIndex < 6; cellIndex++) {
|
||||
Cell cell = row.getCell(cellIndex, Row.MissingCellPolicy.CREATE_NULL_AS_BLANK);
|
||||
rowData.add(getCellValue(cell));
|
||||
}
|
||||
@ -228,51 +228,7 @@ public class ExcelReader {
|
||||
|
||||
return root;
|
||||
}
|
||||
// public static TreeNode buildTree(List<List<String>> data) {
|
||||
// TreeNode root = new TreeNode(new ArrayList<>());
|
||||
// Map<String, TreeNode> nodeMap = new HashMap<>();
|
||||
// nodeMap.put("", root);
|
||||
// List<String> nonEmptyKeys = new ArrayList<>(); // 记录非空A列值的顺序
|
||||
//
|
||||
// for (List<String> row : data) {
|
||||
// String key = row.get(0).trim();
|
||||
// TreeNode node = new TreeNode(row);
|
||||
//
|
||||
// if (!key.isEmpty()) {
|
||||
// String parentKey = getParentKey(key);
|
||||
// TreeNode parent = nodeMap.get(parentKey);
|
||||
//
|
||||
// if (parent == null) {
|
||||
// parent = new TreeNode(new ArrayList<>());
|
||||
// nodeMap.put(parentKey, parent);
|
||||
// TreeNode grandParent = nodeMap.get(getParentKey(parentKey));
|
||||
// if (grandParent != null) {
|
||||
// grandParent.addChild(parent);
|
||||
// } else {
|
||||
// // 如果没有更高级别的父节点,就挂到根节点
|
||||
// root.addChild(parent);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// parent.addChild(node);
|
||||
// nodeMap.put(key, node);
|
||||
// nonEmptyKeys.add(key);
|
||||
// } else {
|
||||
// // A列为空,挂到上一个非空节点下
|
||||
// if (!nonEmptyKeys.isEmpty()) {
|
||||
// String lastKey = nonEmptyKeys.get(nonEmptyKeys.size() - 1);
|
||||
// TreeNode parent = nodeMap.get(lastKey);
|
||||
// if (parent != null) {
|
||||
// parent.addChild(node);
|
||||
// }
|
||||
// } else {
|
||||
// root.addChild(node);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// return root;
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* 以可视化方式打印树形结构
|
||||
@ -362,26 +318,7 @@ public class ExcelReader {
|
||||
// 其他格式默认父节点是根节点
|
||||
return "";
|
||||
}
|
||||
// private static String getParentKey(String key) {
|
||||
// // 中文数字(一、二、三...)的父节点是根节点
|
||||
// if (key.matches(CHINESE_NUMBERS_REGEX)) {
|
||||
// return "";
|
||||
// }
|
||||
//
|
||||
// // 数字格式(1、1.1、1.2.1等)的父节点是上一级
|
||||
// if (key.matches("\\d+(\\.\\d+)*")) {
|
||||
// int lastDotIndex = key.lastIndexOf('.');
|
||||
// if (lastDotIndex > 0) {
|
||||
// return key.substring(0, lastDotIndex);
|
||||
// } else {
|
||||
// // 一级数字(如1、2)的父节点是根节点或最近的中文数字节点
|
||||
// return "";
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 其他格式默认父节点是根节点
|
||||
// return "";
|
||||
// }
|
||||
|
||||
|
||||
/**
|
||||
* Excel数据实体类,包含所有工作表数据
|
||||
@ -459,26 +396,6 @@ public class ExcelReader {
|
||||
this.parent = parent;
|
||||
}
|
||||
}
|
||||
// public static class TreeNode {
|
||||
// List<String> data;
|
||||
// List<TreeNode> children;
|
||||
//
|
||||
// public TreeNode(List<String> data) {
|
||||
// this.data = data;
|
||||
// this.children = new ArrayList<>();
|
||||
// }
|
||||
//
|
||||
// public void addChild(TreeNode child) {
|
||||
// this.children.add(child);
|
||||
// }
|
||||
//
|
||||
// public List<String> getData() {
|
||||
// return data;
|
||||
// }
|
||||
//
|
||||
// public List<TreeNode> getChildren() {
|
||||
// return children;
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
@ -333,8 +333,9 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
|
||||
material.setPid(pid);
|
||||
material.setNum(aNum);
|
||||
material.setName(rowData.size() >= 2 ? rowData.get(1).trim() : null);
|
||||
material.setUnit(rowData.size() >= 3 ? rowData.get(2).trim() : null);
|
||||
String quantityStr = rowData.size() >= 4 ? rowData.get(3).trim() : null;
|
||||
material.setSpecification(rowData.size() >= 3 ? rowData.get(2).trim() : null);
|
||||
material.setUnit(rowData.size() >= 4 ? rowData.get(3).trim() : null);
|
||||
String quantityStr = rowData.size() >= 5 ? rowData.get(4).trim() : null;
|
||||
if (!quantityStr.isEmpty()) {
|
||||
try {
|
||||
// 支持整数和小数解析
|
||||
@ -343,7 +344,7 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
|
||||
// 解析失败(如非数字内容),保持null
|
||||
}
|
||||
}
|
||||
material.setRemark(rowData.size() >= 5 ? rowData.get(4).trim() : null);
|
||||
material.setRemark(rowData.size() >= 6 ? rowData.get(5).trim() : null);
|
||||
|
||||
// 存储映射关系(供子节点查询父sid)
|
||||
nodeMap.put(currentNode, material);
|
||||
@ -438,11 +439,11 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
|
||||
*
|
||||
* @param processEvent 参数
|
||||
*/
|
||||
@org.springframework.context.event.EventListener(condition = "#processEvent.flowCode.endsWith('equipmentList')")
|
||||
@org.springframework.context.event.EventListener(condition = "#processEvent.flowCode.endsWith('pickEquipmentList ')")
|
||||
public void processPlansHandler(ProcessEvent processEvent) {
|
||||
log.info("物资设备清单审核任务执行了{}", processEvent.toString());
|
||||
log.info("招采清单审核任务执行了{}", processEvent.toString());
|
||||
String id = processEvent.getBusinessId();
|
||||
//变更状态
|
||||
//1、变更状态
|
||||
LambdaQueryWrapper<BusBillofquantitiesVersions> eq = new LambdaQueryWrapper<BusBillofquantitiesVersions>()
|
||||
.eq(BusBillofquantitiesVersions::getVersions, id);
|
||||
BusBillofquantitiesVersions busBillofquantitiesVersions = new BusBillofquantitiesVersions();
|
||||
@ -450,7 +451,7 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
|
||||
boolean update = this.update(busBillofquantitiesVersions, eq);
|
||||
//变更成功,增加数据
|
||||
if (update && BusinessStatusEnum.FINISH.getStatus().equals(processEvent.getStatus())) {
|
||||
//2、根据版本号查询数据
|
||||
//根据版本号查询数据
|
||||
BusBillofquantitiesVersions versions = this.getOne(eq);
|
||||
//2、新增批次号
|
||||
String num = BatchNumberGenerator.generateBatchNumber("ZGY-");
|
||||
@ -475,6 +476,7 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
|
||||
if (!b){
|
||||
log.info("新增失败");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -488,8 +490,54 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
|
||||
*
|
||||
* @param processTaskEvent 参数
|
||||
*/
|
||||
@org.springframework.context.event.EventListener(condition = "#processTaskEvent.flowCode.endsWith('equipmentList')")
|
||||
@org.springframework.context.event.EventListener(condition = "#processTaskEvent.flowCode.endsWith('pickEquipmentList ')")
|
||||
public void processTaskPlansHandler(ProcessTaskEvent processTaskEvent) {
|
||||
log.info("招采清单审核任务创建了{}", processTaskEvent.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 监听删除流程事件
|
||||
* 正常使用只需#processDeleteEvent.flowCode=='leave1'
|
||||
* 示例为了方便则使用startsWith匹配了全部示例key
|
||||
*
|
||||
* @param processDeleteEvent 参数
|
||||
*/
|
||||
@EventListener(condition = "#processDeleteEvent.flowCode.endsWith('pickEquipmentList ')")
|
||||
public void processDeletePlansHandler(ProcessDeleteEvent processDeleteEvent) {
|
||||
log.info("招采清单计划删除流程事件,技术标准文件审核任务执行了{}", processDeleteEvent.toString());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 总体流程监听(例如: 草稿,撤销,退回,作废,终止,已完成,单任务完成等)
|
||||
* 正常使用只需#processEvent.flowCode=='leave1'
|
||||
* 示例为了方便则使用startsWith匹配了全部示例key
|
||||
*
|
||||
* @param processEvent 参数
|
||||
*/
|
||||
@org.springframework.context.event.EventListener(condition = "#processEvent.flowCode.endsWith('equipmentList ')")
|
||||
public void processPlansHandlErequipmentList(ProcessEvent processEvent) {
|
||||
log.info("物资设备清单审核任务执行了{}", processEvent.toString());
|
||||
String id = processEvent.getBusinessId();
|
||||
LambdaQueryWrapper<BusBillofquantitiesVersions> eq = new LambdaQueryWrapper<BusBillofquantitiesVersions>()
|
||||
.eq(BusBillofquantitiesVersions::getVersions, id);
|
||||
BusBillofquantitiesVersions busBillofquantitiesVersions = new BusBillofquantitiesVersions();
|
||||
busBillofquantitiesVersions.setStatus(processEvent.getStatus());
|
||||
this.update(busBillofquantitiesVersions, eq);
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行任务创建监听
|
||||
* 示例:也可通过 @EventListener(condition = "#processTaskEvent.flowCode=='leave1'")进行判断
|
||||
* 在方法中判断流程节点key
|
||||
* if ("xxx".equals(processTaskEvent.getNodeCode())) {
|
||||
* //执行业务逻辑
|
||||
* }
|
||||
*
|
||||
* @param processTaskEvent 参数
|
||||
*/
|
||||
@org.springframework.context.event.EventListener(condition = "#processTaskEvent.flowCode.endsWith('equipmentList ')")
|
||||
public void processTaskPlansHandlerEquipmentList(ProcessTaskEvent processTaskEvent) {
|
||||
log.info("物资设备清单审核任务创建了{}", processTaskEvent.toString());
|
||||
}
|
||||
|
||||
@ -500,9 +548,8 @@ public class BusBillofquantitiesVersionsServiceImpl extends ServiceImpl<BusBillo
|
||||
*
|
||||
* @param processDeleteEvent 参数
|
||||
*/
|
||||
@EventListener(condition = "#processDeleteEvent.flowCode.endsWith('equipmentList')")
|
||||
public void processDeletePlansHandler(ProcessDeleteEvent processDeleteEvent) {
|
||||
@EventListener(condition = "#processDeleteEvent.flowCode.endsWith('equipmentList ')")
|
||||
public void processDeletePlansHandlerEquipmentList(ProcessDeleteEvent processDeleteEvent) {
|
||||
log.info("物资设备清单计划删除流程事件,技术标准文件审核任务执行了{}", processDeleteEvent.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user