提交 4c556ef6 authored 作者: kxjia's avatar kxjia

非现场报送优化

上级 44f84d08
package org.jeecg.modules.stm.baosong.controller;
import java.util.*;
import java.util.stream.Collectors;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.stm.baosong.entity.BaosongDataValid;
import org.jeecg.modules.stm.baosong.entity.BaosongTaskAlloc;
import org.jeecg.modules.stm.baosong.entity.BaosongTaskRecord;
import org.jeecg.modules.stm.baosong.entity.BaosongTplItem;
import org.jeecg.modules.stm.baosong.service.IBaosongDataValidService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.stm.baosong.service.IBaosongTaskRecordService;
import org.jeecg.modules.stm.baosong.service.IBaosongTplItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jeecg.modules.stm.baosong.service.IBaosongTaskRecordService;
import org.jeecg.modules.stm.baosong.service.IBaosongTplItemService;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Description: 报送数据校验
......
......@@ -192,7 +192,7 @@ public class BaosongTaskAllocController extends JeecgController<BaosongTaskAlloc
allocList.add(alloc);
}
baosongTaskAllocService.saveOrUpdateBatch(allocList);
baosongTaskService.updateTaskSta(2,taskId);
baosongTaskService.updateTaskSta(1,taskId);
return Result.OK("保存成功!");
}
......@@ -204,6 +204,7 @@ public class BaosongTaskAllocController extends JeecgController<BaosongTaskAlloc
queryWrapper.eq("taskid",taskAlloc.getTaskid())
.eq("fill_user",UserUtil.getUserId());
taskAlloc.setFillSta(true);
baosongTaskService.updateTaskSta(2,taskAlloc.getTaskid());
baosongTaskAllocService.update(taskAlloc,queryWrapper);
return Result.OK("保存成功!");
}
......
package org.jeecg.modules.stm.baosong.controller;
import java.io.File;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.modules.stm.baosong.entity.BaosongTask;
import org.jeecg.modules.stm.baosong.entity.BaosongTaskReview;
import org.jeecg.modules.stm.baosong.entity.BaosongTpl;
import org.jeecg.modules.stm.baosong.entity.TaskRecordVo;
import org.jeecg.modules.stm.baosong.service.IBaosongTaskAllocService;
import org.jeecg.modules.stm.baosong.service.IBaosongTaskReviewService;
import org.jeecg.modules.stm.baosong.service.IBaosongTaskService;
import org.jeecg.modules.stm.baosong.service.IBaosongTplService;
import org.springframework.beans.factory.annotation.Value;
import org.jeecg.modules.stm.baosong.entity.BaosongTask;
import org.jeecg.modules.stm.baosong.entity.BaosongTaskReview;
import org.jeecg.modules.stm.baosong.entity.BaosongTpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.system.base.controller.JeecgController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import javax.xml.transform.OutputKeys;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.File;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
/**
* @Description: 内容检查
* @Author: jeecg-boot
......
......@@ -27,9 +27,7 @@ public class CreateXmlFile {
// 常量定义
private static final String DEFAULT_ENCODING = "UTF-8";
private static final String DATE_FORMAT_PATTERN = "yyyy-MM-dd";
private static final String INDENT_AMOUNT_KEY = "{http://xml.apache.org/xslt}indent-amount";
private static final int DEFAULT_RIND_VALUE = 1;
private final BaosongTpl baosongTpl;
private final BaosongTask baosongTask;
......@@ -45,7 +43,6 @@ public class CreateXmlFile {
* 创建XML文件
*/
public boolean createXml(List<TaskRecordVo> dataList, String filePath) {
if (dataList == null || dataList.isEmpty()) {
logger.warn("数据列表为空,无法生成XML文件");
return false;
......@@ -64,47 +61,41 @@ public class CreateXmlFile {
Document doc = docBuilder.newDocument();
// 创建根元素
Comment rootComment = doc.createComment(baosongTpl.getNm());
doc.appendChild(rootComment);
String rootElementName = this.baosongTpl.getCode();
rootElementName =rootElementName.replaceAll("-","_");
String rootElementName = normalizeElementName(this.baosongTpl.getCode());
Element rootElement = doc.createElement(rootElementName);
doc.appendChild(rootElement);
// 添加固定信息节点
createFixedInfoNodes(doc, rootElement);
// 重新组织数据结构 - 按层级关系构建树形结构
Map<String, TaskRecordVo> codeToItemMap = new HashMap<>();
Map<String, List<TaskRecordVo>> pcodeToChildrenMap = new HashMap<>();
Set<String> allCodes = new HashSet<>();
// 构建完整的数据映射
Map<String, TaskRecordVo> allItems = new HashMap<>();
Map<String, List<TaskRecordVo>> childrenByParent = new HashMap<>();
// 第一步:构建映射关系
for (TaskRecordVo item : dataList) {
String code = item.getCode();
String pcode = item.getPcode();
if (code != null) {
codeToItemMap.put(code, item);
allCodes.add(code);
allItems.put(code, item);
}
if (pcode != null && !pcode.trim().isEmpty()) {
pcodeToChildrenMap.computeIfAbsent(pcode, k -> new ArrayList<>()).add(item);
childrenByParent.computeIfAbsent(pcode, k -> new ArrayList<>()).add(item);
}
}
// 第二步:找出顶级节点(根节点的直接子节点)
// 从目标XML可以看到,顶级节点是像TB1001、TB1012等
// 我们需要根据数据推断哪些是顶级节点
List<String> topLevelNodes = findTopLevelNodes(dataList, allCodes, codeToItemMap);
// 找出根节点的直接子节点
List<TaskRecordVo> rootChildren = childrenByParent.getOrDefault("T_B_1", new ArrayList<>());
logger.debug("找到的顶级节点: {}", topLevelNodes);
// 按itemid排序
rootChildren.sort(Comparator.comparingInt(TaskRecordVo::getItemid));
// 第三步:为每个顶级节点创建XML结构
for (String topNodeCode : topLevelNodes) {
createNodeStructure(doc, rootElement, topNodeCode,
codeToItemMap, pcodeToChildrenMap, new HashSet<>());
// 处理根节点的每个子节点
for (TaskRecordVo child : rootChildren) {
processItem(doc, rootElement, child, childrenByParent, allItems, "");
}
// 保存XML
......@@ -117,162 +108,232 @@ public class CreateXmlFile {
}
/**
* 找出顶级节点
* 处理数据项
*/
private List<String> findTopLevelNodes(List<TaskRecordVo> dataList, Set<String> allCodes,
Map<String, TaskRecordVo> codeToItemMap) {
List<String> topNodes = new ArrayList<>();
private void processItem(Document doc, Element parentElement, TaskRecordVo item,
Map<String, List<TaskRecordVo>> childrenByParent,
Map<String, TaskRecordVo> allItems, String parentPath) {
// 收集所有可能的节点代码
Set<String> allPcodes = new HashSet<>();
for (TaskRecordVo item : dataList) {
String pcode = item.getPcode();
if (pcode != null && !pcode.trim().isEmpty()) {
allPcodes.add(pcode);
String code = item.getCode();
String title = item.getTitle();
String currentPath = buildPath(parentPath, title);
// 检查是否是表格节点(有多个相同code但不同rind的子项)
if (isTableNode(code, childrenByParent)) {
createTableNode(doc, parentElement, item, childrenByParent, currentPath);
} else if (code.startsWith("TB")) {
// 普通TB节点
createNormalNode(doc, parentElement, item, childrenByParent, allItems, currentPath);
} else {
// 普通数据字段
addDataField(doc, parentElement, item, currentPath);
}
}
// 顶级节点特征:
// 1. 是一个pcode(有数据以此pcode为父节点)
// 2. 但不是其他节点的子节点(即这个pcode不作为code出现在数据中)
// 3. 或者这个pcode虽然有对应的item,但它的pcode是T_B_1或空
for (String pcode : allPcodes) {
if (!allCodes.contains(pcode)) {
// 这个pcode没有对应的item,说明它是顶级节点
topNodes.add(pcode);
} else {
// 这个pcode有对应的item,检查它的父节点
TaskRecordVo item = codeToItemMap.get(pcode);
if (item != null) {
String parentPcode = item.getPcode();
if (parentPcode == null || parentPcode.trim().isEmpty() ||
"T_B_1".equals(parentPcode)) {
topNodes.add(pcode);
/**
* 判断是否是表格节点
*/
private boolean isTableNode(String nodeCode, Map<String, List<TaskRecordVo>> childrenByParent) {
List<TaskRecordVo> children = childrenByParent.get(nodeCode);
if (children == null || children.isEmpty()) {
return false;
}
// 检查是否有多个不同的rind值
Set<Integer> rindValues = new HashSet<>();
for (TaskRecordVo child : children) {
if (nodeCode.equals(child.getPcode())) {
Integer rind = getRindValue(child);
rindValues.add(rind);
if (rindValues.size() > 1) {
return true;
}
}
}
return topNodes;
return false;
}
/**
* 创建节点结构
* 创建表格节点
*/
private void createTableNode(Document doc, Element parentElement, TaskRecordVo tableNode,
Map<String, List<TaskRecordVo>> childrenByParent, String parentPath) {
String code = tableNode.getCode();
String title = tableNode.getTitle();
String currentPath = buildPath(parentPath, title);
logger.debug("创建表格节点: {} - {}", code, title);
// 添加表格节点的注释
if (title != null && !title.trim().isEmpty()) {
String commentText = convertTitleToComment(title);
Comment comment = doc.createComment(commentText);
parentElement.appendChild(comment);
}
// 获取表格的所有子项
List<TaskRecordVo> tableChildren = childrenByParent.getOrDefault(code, new ArrayList<>());
// 按rind分组
Map<Integer, List<TaskRecordVo>> rowsByRind = new TreeMap<>();
for (TaskRecordVo child : tableChildren) {
if (code.equals(child.getPcode())) {
Integer rind = getRindValue(child);
rowsByRind.computeIfAbsent(rind, k -> new ArrayList<>()).add(child);
}
}
logger.debug("表格节点{}有{}行数据", code, rowsByRind.size());
// 为每一行创建独立的元素
for (Map.Entry<Integer, List<TaskRecordVo>> rowEntry : rowsByRind.entrySet()) {
List<TaskRecordVo> rowData = rowEntry.getValue();
// 创建行元素(使用相同的code)
Element rowElement = doc.createElement(code);
parentElement.appendChild(rowElement);
// 按itemid排序
rowData.sort(Comparator.comparingInt(TaskRecordVo::getItemid));
// 添加这一行的所有字段
for (TaskRecordVo field : rowData) {
addDataField(doc, rowElement, field, currentPath);
}
}
}
/**
* 创建节点结构
* 创建普通节点
*/
private void createNodeStructure(Document doc, Element parentElement, String nodeCode,
Map<String, TaskRecordVo> codeToItemMap,
Map<String, List<TaskRecordVo>> pcodeToChildrenMap,
Set<String> processedNodes) {
if (processedNodes.contains(nodeCode)) {
return; // 防止循环
}
processedNodes.add(nodeCode);
// 检查是否有子节点
boolean hasChildren = pcodeToChildrenMap.containsKey(nodeCode);
if (hasChildren) {
// 创建外层节点
Element outerElement = doc.createElement(nodeCode);
parentElement.appendChild(outerElement);
// 获取子节点并按rind分组
List<TaskRecordVo> children = pcodeToChildrenMap.get(nodeCode);
Map<Integer, List<TaskRecordVo>> childrenByRind = groupByRind(children, nodeCode);
// 检查分组数量
if (childrenByRind.size() == 1) {
// 只有一个分组,直接将节点添加到outerElement
for (Map.Entry<Integer, List<TaskRecordVo>> rindEntry : childrenByRind.entrySet()) {
List<TaskRecordVo> rindGroup = rindEntry.getValue();
// 处理这个分组中的每个子项
for (TaskRecordVo child : rindGroup) {
// 检查这个子项是否本身还有子项
String childCode = child.getCode();
if (pcodeToChildrenMap.containsKey(childCode)) {
// 这个子项还有子项,递归处理
createNodeStructure(doc, outerElement, childCode,
codeToItemMap, pcodeToChildrenMap, processedNodes);
} else {
// 这个子项是叶子节点,直接添加到outerElement
addDataItem(doc, outerElement, child);
private void createNormalNode(Document doc, Element parentElement, TaskRecordVo node,
Map<String, List<TaskRecordVo>> childrenByParent,
Map<String, TaskRecordVo> allItems, String currentPath) {
String code = node.getCode();
String title = node.getTitle();
// 添加节点注释
if (title != null && !title.trim().isEmpty()) {
String commentText = convertTitleToComment(title);
Comment comment = doc.createComment(commentText);
parentElement.appendChild(comment);
}
// 创建节点元素
Element element = doc.createElement(code);
parentElement.appendChild(element);
// 获取子项
List<TaskRecordVo> children = childrenByParent.getOrDefault(code, new ArrayList<>());
// 按itemid排序
children.sort(Comparator.comparingInt(TaskRecordVo::getItemid));
// 处理每个子项
for (TaskRecordVo child : children) {
if (code.equals(child.getPcode())) {
processItem(doc, element, child, childrenByParent, allItems, currentPath);
}
}
} else {
// 多个分组,创建内层节点
for (Map.Entry<Integer, List<TaskRecordVo>> rindEntry : childrenByRind.entrySet()) {
List<TaskRecordVo> rindGroup = rindEntry.getValue();
// 创建内层节点
Element innerElement = doc.createElement(nodeCode);
outerElement.appendChild(innerElement);
// 处理这个分组中的每个子项
for (TaskRecordVo child : rindGroup) {
// 检查这个子项是否本身还有子项
String childCode = child.getCode();
if (pcodeToChildrenMap.containsKey(childCode)) {
// 这个子项还有子项,递归处理
createNodeStructure(doc, innerElement, childCode,
codeToItemMap, pcodeToChildrenMap, processedNodes);
} else {
// 这个子项是叶子节点,直接添加
addDataItem(doc, innerElement, child);
}
/**
* 添加数据字段
*/
private void addDataField(Document doc, Element parentElement, TaskRecordVo field, String parentPath) {
String code = field.getCode();
String title = field.getTitle();
String content = field.getContent();
// 创建注释
if (title != null && !title.trim().isEmpty() && !isSystemField(code)) {
String fullComment = buildFullComment(title, parentPath);
Comment comment = doc.createComment(fullComment);
parentElement.appendChild(comment);
}
// 创建元素
Element element = doc.createElement(code);
if (content != null && !content.trim().isEmpty()) {
element.setTextContent(content);
}
parentElement.appendChild(element);
}
} else {
// 没有子节点,可能是数据项或空节点
TaskRecordVo item = codeToItemMap.get(nodeCode);
if (item != null) {
addDataItem(doc, parentElement, item);
/**
* 构建路径
*/
private String buildPath(String parentPath, String currentTitle) {
if (currentTitle == null || currentTitle.trim().isEmpty()) {
return parentPath;
}
String converted = convertTitleToComment(currentTitle);
if (parentPath == null || parentPath.isEmpty()) {
return converted;
} else {
return parentPath + "-" + converted;
}
}
/**
* 按rind分组
* 构建完整注释
*/
private Map<Integer, List<TaskRecordVo>> groupByRind(List<TaskRecordVo> items, String pcode) {
Map<Integer, List<TaskRecordVo>> groups = new HashMap<>();
for (TaskRecordVo item : items) {
if (pcode.equals(item.getPcode())) {
int rind = getIntValue(item, DEFAULT_RIND_VALUE);
groups.computeIfAbsent(rind, k -> new ArrayList<>()).add(item);
private String buildFullComment(String fieldTitle, String parentPath) {
if (fieldTitle == null || fieldTitle.trim().isEmpty()) {
return parentPath;
}
if (parentPath == null || parentPath.isEmpty()) {
return fieldTitle;
}
return groups;
return parentPath + "-" + fieldTitle;
}
/**
* 添加数据项(带注释)
* 转换title为注释格式
*/
private void addDataItem(Document doc, Element parentElement, TaskRecordVo item) {
String title = item.getTitle();
String code = item.getCode();
String content = item.getContent();
private String convertTitleToComment(String title) {
if (title == null) {
return "";
}
return title.replace("/", "-");
}
// 添加注释
if (title != null && !title.trim().isEmpty()) {
Comment comment = doc.createComment(title);
parentElement.appendChild(comment);
/**
* 获取rind值
*/
private Integer getRindValue(TaskRecordVo item) {
try {
if (item.getRind() == null) {
return 1;
}
if (item.getRind() instanceof Integer) {
return (Integer) item.getRind();
}
return Integer.parseInt(item.getRind().toString());
} catch (Exception e) {
return 1;
}
}
// 创建元素
Element element = doc.createElement(code);
element.setTextContent(content != null ? content : "");
parentElement.appendChild(element);
/**
* 判断是否为系统字段
*/
private boolean isSystemField(String code) {
return code.startsWith("FILLIN_") ||
code.equals("TELEPHONE") ||
code.equals("FILLE_USER") ||
code.equals("RES_PERSON") ||
code.equals("jiaoyanwei") ||
code.equals("isempty") ||
code.equals("itTitle") ||
code.equals("itVersion");
}
/**
......@@ -282,25 +343,32 @@ public class CreateXmlFile {
try {
String respDepart = this.baosongTask.getRespDepart() != null ?
this.baosongTask.getRespDepart() : "";
String enterDate = this.baosongTask.getEnterDate();//formatDate(this.baosongTask.getEnterDate(), DATE_FORMAT_PATTERN);
Date filleDate = this.baosongTask.getEndDate();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String fillDate = DateUtils.date2Str(filleDate,sdf);
String enterTel = this.baosongTask.getEnterTel() != null ?
this.baosongTask.getEnterTel() : "";
String respUser = this.baosongTask.getRespUser() != null ?
this.baosongTask.getRespUser() : "";
String version = this.baosongTpl.getVersion() != null ?
this.baosongTpl.getVersion() : "";
String fillUser = this.baosongTask.getFillUser();
addFixedNode(doc, parentElement, "FILLIN_DEPT", respDepart, "填报部门");
addFixedNode(doc, parentElement, "FILLIN_DATE", enterDate, "填报日期");
addFixedNode(doc, parentElement, "FILLIN_PERSON", this.fillUserNames, "填报人");
addFixedNode(doc, parentElement, "TELEPHONE", enterTel, "联系电话");
addFixedNode(doc, parentElement, "RES_PERSON", respUser, "负责人");
addFixedNode(doc, parentElement, "jiaoyanwei", "0", "校验位");
addFixedNode(doc, parentElement, "isempty", "yes", "是否为空");
// 添加固定节点(不带注释)
addFixedNodeNoComment(doc, parentElement, "FILLIN_DEPT", respDepart);
addFixedNodeNoComment(doc, parentElement, "FILLIN_DATE", fillDate);
addFixedNodeNoComment(doc, parentElement, "FILLIN_PERSON", fillUser);
addFixedNodeNoComment(doc, parentElement, "TELEPHONE", enterTel);
addFixedNodeNoComment(doc, parentElement, "RES_PERSON", respUser);
addFixedNodeNoComment(doc, parentElement, "jiaoyanwei", "1");
addFixedNodeNoComment(doc, parentElement, "isempty", "0");
String title = this.baosongTpl.getCode() + " " + this.baosongTpl.getNm();
addFixedNode(doc, parentElement, "itTitle", title, "模板标题");
addFixedNode(doc, parentElement, "itVersion", version, "模板版本");
String title = "T-B-1 信息科技治理情况表";
addFixedNodeNoComment(doc, parentElement, "itTitle", title);
addFixedNodeNoComment(doc, parentElement, "itVersion", version);
} catch (Exception e) {
logger.error("创建固定信息节点时发生错误", e);
......@@ -308,15 +376,10 @@ public class CreateXmlFile {
}
/**
* 添加固定节点
* 添加固定节点(不带注释)
*/
private void addFixedNode(Document doc, Element parentElement,
String tagName, String textContent, String comment) {
if (comment != null && !comment.trim().isEmpty()) {
Comment commentNode = doc.createComment(comment);
parentElement.appendChild(commentNode);
}
private void addFixedNodeNoComment(Document doc, Element parentElement,
String tagName, String textContent) {
Element element = doc.createElement(tagName);
element.setTextContent(textContent != null ? textContent : "");
parentElement.appendChild(element);
......@@ -339,8 +402,8 @@ public class CreateXmlFile {
Transformer transformer = transformerFactory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OutputKeys.ENCODING, DEFAULT_ENCODING);
transformer.setOutputProperty(OutputKeys.STANDALONE, "yes");
transformer.setOutputProperty(INDENT_AMOUNT_KEY, "4");
transformer.setOutputProperty(OutputKeys.STANDALONE, "no");
transformer.setOutputProperty(INDENT_AMOUNT_KEY, "2");
DOMSource source = new DOMSource(doc);
StreamResult result = new StreamResult(file);
......@@ -354,46 +417,4 @@ public class CreateXmlFile {
return false;
}
}
/**
* 规范化元素名称
*/
private String normalizeElementName(String name) {
return name != null ? name.replace("-", "_") : "";
}
/**
* 格式化日期
*/
private String formatDate(Date date, String pattern) {
if (date == null) {
return "";
}
try {
SimpleDateFormat sdf = new SimpleDateFormat(pattern);
return DateUtils.date2Str(date, sdf);
} catch (Exception e) {
logger.warn("日期格式化失败", e);
return "";
}
}
/**
* 获取整数值
*/
private int getIntValue(TaskRecordVo taskRecordVo, int defaultValue) {
try {
Object value = taskRecordVo.getRind();
if (value == null) {
return defaultValue;
}
if (value instanceof Number) {
return ((Number) value).intValue();
}
return Integer.parseInt(value.toString());
} catch (NumberFormatException e) {
logger.warn("解析rind值失败,使用默认值: {}", defaultValue);
return defaultValue;
}
}
}
\ No newline at end of file
package org.jeecg.modules.stm.baosong.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
/**
* @Description: 报送数据校验
......
package org.jeecg.modules.stm.baosong.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* @Description: 任务表
......
package org.jeecg.modules.stm.baosong.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import java.util.List;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
/**
* @Description: 任务表
......@@ -48,12 +45,11 @@ public class BaosongTask implements Serializable {
private java.lang.Integer sta;
/**报表类型*/
@Excel(name = "报表类型", width = 15)
private java.lang.Integer tp;
/**填报角色*/
@Excel(name = "填报角色", width = 15)
private java.lang.String enterRole;
/**填报人*/
@Excel(name = "填报人", width = 15)
private java.lang.String fillUser;
/**联系电话*/
@Excel(name = "联系电话", width = 15)
private java.lang.String enterTel;
......@@ -64,7 +60,7 @@ public class BaosongTask implements Serializable {
/**责任人*/
@Excel(name = "责任人", width = 15)
@Dict(dictTable ="sys_user",dicText = "realname",dicCode = "id")
//@Dict(dictTable ="sys_user",dicText = "realname",dicCode = "id")
private java.lang.String respUser;
/**责任部门*/
......@@ -81,13 +77,13 @@ public class BaosongTask implements Serializable {
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
private java.util.Date endDate;
/**创建时间*/
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
private java.util.Date createTime;
/**创建人*/
private java.lang.String createBy;
@TableField(exist = false)
......
package org.jeecg.modules.stm.baosong.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import java.util.List;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.List;
/**
* @Description: 任务分配
......
package org.jeecg.modules.stm.baosong.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import java.util.Map;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Map;
/**
* @Description: 填报记录
......
package org.jeecg.modules.stm.baosong.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
/**
* @Description: 内容检查
......
package org.jeecg.modules.stm.baosong.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
/**
* @Description: 报送模板
......
package org.jeecg.modules.stm.baosong.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import java.util.List;
import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.common.aspect.annotation.Dict;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.io.Serializable;
import java.util.List;
/**
* @Description: 报送模板项
......
package org.jeecg.modules.stm.baosong.entity;
import java.io.Serializable;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableLogic;
import lombok.Data;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.jeecg.common.aspect.annotation.Dict;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecgframework.poi.excel.annotation.Excel;
import java.io.Serializable;
/**
* @Description: 模板项目设置
......
......@@ -17,18 +17,16 @@
</select>
<select id="queryTaskRecordForXml" resultType="org.jeecg.modules.stm.baosong.entity.TaskRecordVo">
SELECT A.content,A.taskid,A.itemid,A.rind, B.tplid,B.code,B.pcode,B.title
FROM baosong_task_record A
RIGHT JOIN baosong_tpl_item B ON A.itemid = B.id
SELECT B.content,B.taskid,A.id as itemid,B.rind, A.tplid,A.code,A.pcode,A.title
FROM baosong_tpl_item A
LEFT JOIN baosong_task_record B ON A.id=B.itemid AND B.taskid=#{query.taskid}
<where>
<if test="query.taskid != null">
AND A.taskid = #{query.taskid}
</if>
<if test="query.tplid != null">
AND B.tplid = #{query.tplid}
AND A.tplid = #{query.tplid}
</if>
</where>
ORDER BY B.id,B.pcode,B.code
ORDER BY A.id,A.pcode,A.code
</select>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论