add 初始化
This commit is contained in:
+2097
File diff suppressed because it is too large
Load Diff
+1604
File diff suppressed because it is too large
Load Diff
+218
@@ -0,0 +1,218 @@
|
||||
package com.jero.modules.activiti.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.modules.activiti.service.ProcessService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.activiti.bpmn.converter.BpmnXMLConverter;
|
||||
import org.activiti.bpmn.model.BpmnModel;
|
||||
import org.activiti.engine.*;
|
||||
import org.activiti.engine.repository.Deployment;
|
||||
import org.activiti.engine.repository.ProcessDefinition;
|
||||
import org.activiti.engine.repository.ProcessDefinitionQuery;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.activiti.engine.task.TaskQuery;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @author liJiaRao
|
||||
* @date 2023-08-02 15:05
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/modeler")
|
||||
public class AController {
|
||||
@Autowired
|
||||
private ProcessService processService;
|
||||
@Resource
|
||||
private RepositoryService repositoryService;
|
||||
@Resource
|
||||
private TaskService taskService;
|
||||
|
||||
|
||||
@GetMapping("/deploy")
|
||||
public Result<Map<String, String>> deploy(@RequestParam(value = "name", required = false) String name,
|
||||
@RequestParam(value = "classpathResource") String classpathResource) {
|
||||
if (StringUtils.isNotBlank(name)) {
|
||||
//根据流程定义Key查询
|
||||
name = "出差申请流程";
|
||||
}
|
||||
// 3、使用RepositoryService进行部署
|
||||
Deployment deployment = repositoryService.createDeployment()
|
||||
//.addClasspathResource("bpmn/diagram_1.bpmn20.xml") // 添加bpmn资源
|
||||
//.addClasspathResource("bpmn/business-trips.png") // 添加png资源
|
||||
.addClasspathResource(classpathResource)
|
||||
.name(name)
|
||||
.deploy();
|
||||
// 4、输出部署信息
|
||||
Map<String, String> map = new HashMap<>();
|
||||
|
||||
map.put("流程部署id:", deployment.getId());
|
||||
map.put("流程部署名称:", deployment.getName());
|
||||
map.put("流程部署key:", deployment.getKey());
|
||||
return Result.OK(map);
|
||||
}
|
||||
|
||||
@GetMapping("/deleteDeployment")
|
||||
@ApiOperation(value = "删除已部署的流程定义", notes = "删除已部署的流程定义")
|
||||
public Result<Object> deleteDeployment(@RequestParam(value = "id", required = false) String id) {
|
||||
// true 表示级联删除引用,比如 act_ru_execution 数据
|
||||
repositoryService.deleteDeployment(id, true);
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
@GetMapping("/findProcessDefinition")
|
||||
@ApiOperation(value = "查询流程定义列表", notes = "查询流程定义列表")
|
||||
public Result<List<Map<String, Object>>> findProcessDefinition(@RequestParam(value = "processDefinitionKey", required = false) String processDefinitionKey,
|
||||
@RequestParam(value = "processDefinitionName", required = false) String processDefinitionName) {
|
||||
List<Map<String, Object>> allList = new ArrayList<>();
|
||||
//创建一个流程定义查询
|
||||
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery();
|
||||
|
||||
if (StringUtils.isNotBlank(processDefinitionKey)) {
|
||||
//根据流程定义Key查询
|
||||
processDefinitionQuery.processDefinitionKey(processDefinitionKey);
|
||||
}
|
||||
if (StringUtils.isNotBlank(processDefinitionName)) {
|
||||
//根据流程定义name查询
|
||||
processDefinitionQuery.processDefinitionNameLike(processDefinitionName);
|
||||
}
|
||||
|
||||
List<ProcessDefinition> processDefinitionList = processDefinitionQuery.list();
|
||||
|
||||
for (ProcessDefinition processDefinition : processDefinitionList) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
String deploymentId = processDefinition.getDeploymentId();
|
||||
Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
|
||||
map.put("processDefinition", BeanUtil.beanToMap(processDefinition));
|
||||
map.put("deployment", deployment.toString());
|
||||
allList.add(map);
|
||||
}
|
||||
return Result.OK(allList);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/start")
|
||||
public Result<Map<String, String>> start(@RequestParam(value = "key", required = false) String key) {
|
||||
// 1、创建ProcessEngine
|
||||
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
|
||||
// 2、获取RunTimeService
|
||||
RuntimeService runtimeService = processEngine.getRuntimeService();
|
||||
// 3、根据流程定义Id启动流程
|
||||
ProcessInstance processInstance = runtimeService
|
||||
.startProcessInstanceByKey(key);
|
||||
|
||||
// 输出内容
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("流程Id:", processInstance.getDeploymentId());
|
||||
map.put("流程定义id:", processInstance.getProcessDefinitionId());
|
||||
map.put("流程实例id:", processInstance.getId());
|
||||
map.put("当前活动Id:", processInstance.getActivityId());
|
||||
|
||||
|
||||
return Result.OK(map);
|
||||
}
|
||||
|
||||
@GetMapping("/getTaskList")
|
||||
public Result<List<Map<String, String>>> testFindPersonalTaskList(@RequestParam(value = "assignee") String assignee,
|
||||
@RequestParam(value = "processKey") String processKey) {
|
||||
// 根据流程key 和 任务负责人 查询任务
|
||||
TaskQuery taskQuery = taskService.createTaskQuery();
|
||||
if (StringUtils.isNotBlank(assignee)) {
|
||||
taskQuery.taskAssignee(assignee);//只查询该任务负责人的任务
|
||||
}
|
||||
if (StringUtils.isNotBlank(processKey)) {
|
||||
taskQuery.processDefinitionKey(processKey); //流程Key
|
||||
}
|
||||
List<Task> list = taskQuery.list();
|
||||
List<Map<String, String>> resut = new ArrayList<>();
|
||||
for (Task task : list) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("流程实例id:", task.getProcessInstanceId());
|
||||
map.put("任务id:", task.getId());
|
||||
map.put("任务负责人:", task.getAssignee());
|
||||
map.put("任务名称:", task.getName());
|
||||
resut.add(map);
|
||||
}
|
||||
return Result.OK(resut);
|
||||
}
|
||||
|
||||
@GetMapping("/complete")
|
||||
public Result<Object> complete(@RequestParam(value = "taskId") String taskId) {
|
||||
taskService.complete(taskId);
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
* 加签
|
||||
* @param taskId
|
||||
* @param loginName
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/delegateTask")
|
||||
public Result<Object> delegateTask(@RequestParam(value = "taskId") String taskId,
|
||||
@RequestParam(value = "loginName") String loginName) {
|
||||
taskService.delegateTask(taskId, loginName);
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
@GetMapping("/resolveTask")
|
||||
public Result<Object> resolveTask(@RequestParam(value = "taskId") String taskId) {
|
||||
taskService.resolveTask(taskId);
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
@GetMapping("/addTask")
|
||||
// @ApiOperation("新增节点")
|
||||
public Object addTask(String taskId, String assignee) {
|
||||
return processService.addTask(taskId,assignee);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/readResource")
|
||||
@ApiOperation(value = "获取实时流程图", notes = "获取实时流程图,输出跟踪流程信息")
|
||||
public void getFlowImgByInstanceId(@RequestParam(value = "processInstanceId") String processInstanceId, HttpServletResponse response) {
|
||||
processService.getFlowImgByInstanceId(processInstanceId, response);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/export/{modelId}")
|
||||
@ApiOperation(value = "将流程模型导出为 bpmn文件",notes = "将流程模型导出为 bpmn文件")
|
||||
public void export(@PathVariable("modelId") @ApiParam("流程模型Id") String modelId, HttpServletResponse response) {
|
||||
try {
|
||||
BpmnModel bpmnModel = repositoryService.getBpmnModel(modelId);
|
||||
|
||||
// 流程非空判断
|
||||
if (!CollectionUtils.isEmpty(bpmnModel.getProcesses())) {
|
||||
BpmnXMLConverter xmlConverter = new BpmnXMLConverter();
|
||||
byte[] bpmnBytes = xmlConverter.convertToXML(bpmnModel);
|
||||
|
||||
ByteArrayInputStream in = new ByteArrayInputStream(bpmnBytes);
|
||||
String filename = bpmnModel.getMainProcess().getId() + ".bpmn";
|
||||
response.setHeader("Content-Disposition", "attachment; filename=" + filename);
|
||||
IOUtils.copy(in, response.getOutputStream());
|
||||
response.flushBuffer();
|
||||
} else {
|
||||
log.error("导出model的bpmn文件失败:modelId={}", modelId);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("导出model的bpmn文件失败:modelId={}", modelId, e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.jero.modules.activiti.entity;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
*@author liJiaRao
|
||||
*@date 2023-08-04 16:04
|
||||
*/
|
||||
|
||||
/**
|
||||
* 二进制资源表
|
||||
*/
|
||||
@Data
|
||||
@TableName(value = "act_ge_bytearray")
|
||||
public class ActGeBytearray {
|
||||
@TableId(value = "ID_", type = IdType.INPUT)
|
||||
private String id;
|
||||
|
||||
@TableField(value = "REV_")
|
||||
private Integer rev;
|
||||
|
||||
@TableField(value = "NAME_")
|
||||
private String name;
|
||||
|
||||
@TableField(value = "DEPLOYMENT_ID_")
|
||||
private String deploymentId;
|
||||
|
||||
@TableField(value = "BYTES_")
|
||||
private byte[] bytes;
|
||||
|
||||
@TableField(value = "GENERATED_")
|
||||
private Integer generated;
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.jero.modules.activiti.listener;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.activiti.engine.ProcessEngine;
|
||||
import org.activiti.engine.ProcessEngines;
|
||||
import org.activiti.engine.RuntimeService;
|
||||
import org.activiti.engine.delegate.DelegateTask;
|
||||
import org.activiti.engine.delegate.TaskListener;
|
||||
|
||||
/**
|
||||
* @author liJiaRao
|
||||
* @date 2023-08-04 10:53
|
||||
*/
|
||||
@Slf4j
|
||||
public class SignListener implements TaskListener {
|
||||
@Override
|
||||
public void notify(DelegateTask delegateTask) {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
//获取流程id
|
||||
String taskId = delegateTask.getExecutionId();
|
||||
//获取流程参数pass,会签人员完成自己的审批任务时会添加流程参数pass,false为拒绝,true为同意
|
||||
// 1、创建ProcessEngine
|
||||
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
|
||||
// 2、获取RunTimeService
|
||||
RuntimeService runtimeService = processEngine.getRuntimeService();
|
||||
boolean pass = (Boolean) runtimeService.getVariable(taskId, "pass");
|
||||
|
||||
/* ${nrOfCompletedInstances/nrOfInstances==1}
|
||||
* false:有一个人拒绝,整个流程就结束了,
|
||||
* 因为Complete condition的值为pass == false,即,当流程参数为pass时会签就结束开始下一个任务
|
||||
* 所以,当pass == false时,直接设置下一个流程跳转需要的参数
|
||||
* true:审批人同意,同时要判断是不是所有的人都已经完成了,而不是由一个人同意该会签就结束
|
||||
* 值得注意的是如果一个审批人完成了审批进入到该监听时nrOfCompletedInstances的值还没有更新,因此需要+1
|
||||
*/
|
||||
Integer complete = (Integer) runtimeService.getVariable(taskId, "nrOfCompletedInstances");
|
||||
Integer all = (Integer) runtimeService.getVariable(taskId, "nrOfInstances");
|
||||
// 这里的test对应的是第一个节点中的对应的参数
|
||||
String username= (String) runtimeService.getVariable(delegateTask.getExecutionId(), "test");
|
||||
if(!pass){
|
||||
//会签结束,返回发起人节点
|
||||
runtimeService.setVariable(taskId, "countersignState", 0);
|
||||
runtimeService.setVariable(taskId, "test", username);
|
||||
}else{
|
||||
|
||||
//说明都完成了并且没有人拒绝
|
||||
if((complete + 1) / all == 1){
|
||||
// 流程流向下个节点 test2为下个节点人的参数
|
||||
runtimeService.setVariable(taskId, "countersignState", 1);
|
||||
runtimeService.setVariable(taskId, "test2", "xiaowang");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.jero.modules.activiti.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jero.modules.activiti.entity.ActGeBytearray;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author liJiaRao
|
||||
* @date 2023-08-04 16:04
|
||||
*/
|
||||
@Mapper
|
||||
public interface ActGeBytearrayMapper extends BaseMapper<ActGeBytearray> {
|
||||
List<ActGeBytearray> getActGeBytearrayList(@Param("processDefinitionId") String processDefinitionId);
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jero.modules.activiti.mapper.ActGeBytearrayMapper">
|
||||
<resultMap id="BaseResultMap" type="com.jero.modules.activiti.entity.ActGeBytearray">
|
||||
<!--@mbg.generated-->
|
||||
<!--@Table act_ge_bytearray-->
|
||||
<id column="ID_" jdbcType="VARCHAR" property="id" />
|
||||
<result column="REV_" jdbcType="INTEGER" property="rev" />
|
||||
<result column="NAME_" jdbcType="VARCHAR" property="name" />
|
||||
<result column="DEPLOYMENT_ID_" jdbcType="VARCHAR" property="deploymentId" />
|
||||
<result column="BYTES_" jdbcType="BLOB" property="bytes" />
|
||||
<result column="GENERATED_" jdbcType="TINYINT" property="generated" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
ID_, REV_, NAME_, DEPLOYMENT_ID_, BYTES_, GENERATED_
|
||||
</sql>
|
||||
<select id="getActGeBytearrayList" resultType="com.jero.modules.activiti.entity.ActGeBytearray">
|
||||
select a.*
|
||||
from act_ge_bytearray a
|
||||
inner join act_re_procdef b ON a.DEPLOYMENT_ID_ = b.DEPLOYMENT_ID_
|
||||
where b.ID_ = #{processDefinitionId}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.jero.modules.activiti.service;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* @author liJiaRao
|
||||
* @date 2023-08-03 15:37
|
||||
*/
|
||||
public interface ProcessService {
|
||||
void getFlowImgByInstanceId(String pProcessInstanceId, HttpServletResponse response);
|
||||
|
||||
Object addTask(String taskId, String assignee);
|
||||
}
|
||||
+344
@@ -0,0 +1,344 @@
|
||||
package com.jero.modules.activiti.service.impl;
|
||||
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.modules.activiti.config.DefaultProcessDiagramGenerator;
|
||||
import com.jero.modules.activiti.entity.ActGeBytearray;
|
||||
import com.jero.modules.activiti.mapper.ActGeBytearrayMapper;
|
||||
import com.jero.modules.activiti.service.ProcessService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.activiti.bpmn.BpmnAutoLayout;
|
||||
import org.activiti.bpmn.converter.BpmnXMLConverter;
|
||||
import org.activiti.bpmn.model.Process;
|
||||
import org.activiti.bpmn.model.*;
|
||||
import org.activiti.engine.*;
|
||||
import org.activiti.engine.history.HistoricActivityInstance;
|
||||
import org.activiti.engine.history.HistoricProcessInstance;
|
||||
import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
|
||||
import org.activiti.engine.impl.persistence.deploy.DeploymentManager;
|
||||
import org.activiti.engine.runtime.Execution;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author liJiaRao
|
||||
* @date 2023-08-03 15:38
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ProcessServiceImpl implements ProcessService {
|
||||
@Autowired
|
||||
private RepositoryService repositoryService;
|
||||
@Autowired
|
||||
private HistoryService historyService;
|
||||
@Autowired
|
||||
private ProcessEngine processEngine;
|
||||
@Autowired
|
||||
private RuntimeService runtimeService;
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
@Autowired
|
||||
private ManagementService managementService;
|
||||
@Resource
|
||||
private ActGeBytearrayMapper actGeBytearrayMapper;
|
||||
|
||||
@Override
|
||||
public void getFlowImgByInstanceId(String processInstanceId, HttpServletResponse response) {
|
||||
InputStream imageStream = null;
|
||||
try {
|
||||
// 获取历史流程实例
|
||||
HistoricProcessInstance historicProcessInstance = historyService
|
||||
.createHistoricProcessInstanceQuery()
|
||||
.processInstanceId(processInstanceId).singleResult();
|
||||
if (historicProcessInstance == null){
|
||||
throw new JeroBootException("历史流程不存在");
|
||||
}
|
||||
// 获取流程中已经执行的节点,按照执行先后顺序排序
|
||||
List<HistoricActivityInstance> historicActivityInstances = historyService
|
||||
.createHistoricActivityInstanceQuery()
|
||||
.processInstanceId(processInstanceId)
|
||||
.orderByHistoricActivityInstanceId()
|
||||
.asc().list();
|
||||
// 高亮已经执行流程节点ID集合
|
||||
List<String> highLightedActivitiIds = new ArrayList<>();
|
||||
for (HistoricActivityInstance historicActivityInstance : historicActivityInstances) {
|
||||
// 用默认颜色
|
||||
highLightedActivitiIds.add(historicActivityInstance.getActivityId());
|
||||
}
|
||||
// 正在执行的节点
|
||||
List<Execution> runTaskList = runtimeService.createExecutionQuery()
|
||||
.processInstanceId(processInstanceId)
|
||||
.list();
|
||||
List<String> runningActivityIdList = new ArrayList<>();
|
||||
for (Execution execution : runTaskList) {
|
||||
if (!StringUtils.isEmpty(execution.getActivityId())) {
|
||||
runningActivityIdList.add(execution.getActivityId());
|
||||
}
|
||||
}
|
||||
List<String> currIds = historicActivityInstances.stream()
|
||||
.filter(item -> item.getEndTime() != null)
|
||||
.map(HistoricActivityInstance::getActivityId).collect(Collectors.toList());
|
||||
|
||||
// 获得流程引擎配置
|
||||
ProcessEngineConfiguration processEngineConfiguration = processEngine.getProcessEngineConfiguration();
|
||||
|
||||
BpmnModel bpmnModel = repositoryService
|
||||
.getBpmnModel(historicProcessInstance.getProcessDefinitionId());
|
||||
// 高亮流程已发生流转的线id集合
|
||||
List<String> highLightedFlowIds = getHighLightedFlows(bpmnModel, historicActivityInstances);
|
||||
//
|
||||
imageStream = new DefaultProcessDiagramGenerator().generateDiagram(
|
||||
bpmnModel,
|
||||
"png",
|
||||
highLightedActivitiIds,//所有活动过的节点,包括当前在激活状态下的节点
|
||||
currIds,//当前为激活状态下的节点
|
||||
highLightedFlowIds,//活动过的线
|
||||
"宋体",
|
||||
"宋体",
|
||||
"宋体",
|
||||
processEngineConfiguration.getClassLoader(),
|
||||
1.0,
|
||||
runningActivityIdList);
|
||||
|
||||
OutputStream out = null;
|
||||
out = response.getOutputStream();
|
||||
int len = 0;
|
||||
byte[] b = new byte[1024];
|
||||
while ((len = imageStream.read(b)) != -1) {
|
||||
out.write(b, 0, len);
|
||||
}
|
||||
out.flush();
|
||||
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if (imageStream != null) {
|
||||
try {
|
||||
imageStream.close();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object addTask(String taskId, String assignee) {
|
||||
// 1、创建ProcessEngine
|
||||
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
|
||||
final TaskService taskService = processEngine.getTaskService();
|
||||
final RepositoryService repositoryService = processEngine.getRepositoryService();
|
||||
Task userTask = taskService.createTaskQuery()
|
||||
.taskId(taskId)
|
||||
// .taskAssignee(assignee)
|
||||
.singleResult();
|
||||
|
||||
final BpmnModel bpmnModel = repositoryService.getBpmnModel(userTask.getProcessDefinitionId());
|
||||
Process process = bpmnModel.getMainProcess();
|
||||
process.removeFlowElement("add");//移除最终节点连线
|
||||
process.removeFlowElement("sequenceFlow-5d7e3faa-6c00-4010-8485-fe79c286448b");//移除最终节点连线
|
||||
process.removeFlowElement("sequenceFlow-aba52ded-835d-4863-b303-1b9771ae93cf");//移除最终节点连线
|
||||
process.addFlowElement(createSequenceFlow("Activity_0m576ex", "Event_17e1txx"));//新增节点 于原节点连线
|
||||
/*process.removeFlowElement("Flow_0stcykp");//移除最终节点连线
|
||||
process.addFlowElement(createUserTask("add", "First task", "fred"));//新增节点
|
||||
process.addFlowElement(createSequenceFlow("Activity_0m576ex", "add"));//新增节点 于原节点连线
|
||||
process.addFlowElement(createSequenceFlow("add", "Event_17e1txx"));//新增节点 于原节点连线*/
|
||||
//重新绘画图形
|
||||
BpmnAutoLayout bpmnAutoLayout = new BpmnAutoLayout(bpmnModel);
|
||||
bpmnAutoLayout.execute();
|
||||
BpmnXMLConverter converter = new BpmnXMLConverter();
|
||||
//把bpmnModel对象转换成字符
|
||||
byte[] bytes = converter.convertToXML(bpmnModel);
|
||||
//清除缓存
|
||||
ProcessEngineConfigurationImpl configuration = (ProcessEngineConfigurationImpl) processEngine.getProcessEngineConfiguration();
|
||||
DeploymentManager deploymentManager = configuration.getDeploymentManager();
|
||||
deploymentManager.getProcessDefinitionCache().remove(userTask.getProcessDefinitionId());
|
||||
|
||||
// String xmlContenxt = new String(bytes);
|
||||
List<ActGeBytearray> actGeBytearrayList = actGeBytearrayMapper.getActGeBytearrayList(userTask.getProcessDefinitionId());
|
||||
actGeBytearrayList = actGeBytearrayList.stream().filter(item -> item.getName().endsWith(".bpmn")).peek(item -> {
|
||||
item.setBytes(bytes);
|
||||
}).collect(Collectors.toList());
|
||||
if (ObjectUtils.isNotEmpty(actGeBytearrayList)) {
|
||||
actGeBytearrayMapper.updateById(actGeBytearrayList.get(0));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
protected static UserTask createUserTask(String id, String name, String assignee) {
|
||||
UserTask userTask = new UserTask();
|
||||
userTask.setName(name);
|
||||
userTask.setId(id);
|
||||
userTask.setAssignee(assignee);
|
||||
return userTask;
|
||||
}
|
||||
|
||||
protected static SequenceFlow createSequenceFlow(String from, String to) {
|
||||
SequenceFlow flow = new SequenceFlow();
|
||||
flow.setSourceRef(from);
|
||||
flow.setTargetRef(to);
|
||||
return flow;
|
||||
}
|
||||
/**
|
||||
* @param bpmnModel bpmnModel
|
||||
* @param historicActivityInstanceList historicActivityInstanceList
|
||||
* @return HighLightedFlows
|
||||
*/
|
||||
public List<String> getHighLightedFlows(BpmnModel bpmnModel,
|
||||
List<HistoricActivityInstance> historicActivityInstanceList) {
|
||||
//historicActivityInstanceList 是 流程中已经执行的历史活动实例
|
||||
// 已经流经的顺序流,需要高亮显示
|
||||
List<String> highFlows = new ArrayList<>();
|
||||
|
||||
// 全部活动节点
|
||||
List<FlowNode> allHistoricActivityNodeList = new ArrayList<>();
|
||||
|
||||
// 拥有endTime的历史活动实例,即已经完成了的节点
|
||||
List<HistoricActivityInstance> finishedActivityInstancesList = new ArrayList<>();
|
||||
|
||||
/*
|
||||
* 循环的目的:
|
||||
* 获取所有的历史节点FlowNode并放入allHistoricActivityNodeList
|
||||
* 获取所有确定结束了的历史节点finishedActivityInstancesList
|
||||
*/
|
||||
for (HistoricActivityInstance historicActivityInstance : historicActivityInstanceList) {
|
||||
// 获取流程节点
|
||||
// bpmnModel.getMainProcess()获取一个Process对象
|
||||
FlowNode flowNode = (FlowNode) bpmnModel.getMainProcess().getFlowElement(historicActivityInstance.getActivityId(), true);
|
||||
allHistoricActivityNodeList.add(flowNode);
|
||||
|
||||
// 如果结束时间不为空,表示当前节点已经完成
|
||||
if (historicActivityInstance.getEndTime() != null) {
|
||||
finishedActivityInstancesList.add(historicActivityInstance);
|
||||
}
|
||||
}
|
||||
|
||||
FlowNode currentFlowNode;
|
||||
FlowNode targetFlowNode;
|
||||
HistoricActivityInstance currentActivityInstance;
|
||||
|
||||
// 遍历已经完成的活动实例,从每个实例的outgoingFlows中找到已经执行的
|
||||
for (int k = 0; k < finishedActivityInstancesList.size(); k++) {
|
||||
currentActivityInstance = finishedActivityInstancesList.get(k);
|
||||
|
||||
// 获得当前活动对应的节点信息以及outgoingFlows信息
|
||||
currentFlowNode = (FlowNode) bpmnModel.getMainProcess().getFlowElement(currentActivityInstance.getActivityId(), true);
|
||||
|
||||
// 当前节点的所有流出线
|
||||
List<SequenceFlow> outgoingFlowList = currentFlowNode.getOutgoingFlows();
|
||||
|
||||
/*
|
||||
* 遍历outgoingFlows并找到已经流转的 满足如下条件认为已经流转:
|
||||
* 1、当前节点是并行网关或者兼容网关,则通过outgoingFlows能够在历史活动中找到的全部节点均为已经流转
|
||||
* 2、当前节点是以上两种类型之外的,通过outgoingFlows查找到的时间最早的流转节点视为有效流转
|
||||
* (第二点有问题,有过驳回的,会只绘制驳回的流程线,通过走向下一级的流程线没有高亮显示)
|
||||
*/
|
||||
if ("parallelGateway".equals(currentActivityInstance.getActivityType()) ||
|
||||
"inclusiveGateway".equals(currentActivityInstance.getActivityType())) {
|
||||
// 遍历历史活动节点,找到匹配流程目标节点的
|
||||
for (SequenceFlow outgoingFlow : outgoingFlowList) {
|
||||
// 获取当前节点流程线对应的下一级节点
|
||||
targetFlowNode = (FlowNode) bpmnModel.getMainProcess().getFlowElement(outgoingFlow.getTargetRef(), true);
|
||||
|
||||
// 如果下级节点包含在所有历史节点中,则将当前节点的流出线高亮显示
|
||||
if (allHistoricActivityNodeList.contains(targetFlowNode)) {
|
||||
highFlows.add(outgoingFlow.getId());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/*
|
||||
* 2、当前节点不是并行网关或者兼容网关
|
||||
* 【已解决-问题】如果当前节点有驳回功能,驳回到申请节点,
|
||||
* 则因为申请节点在历史节点中,导致当前节点驳回到申请节点的流程线被高亮显示,但实际并没有进行驳回操作
|
||||
*/
|
||||
List<Map<String, Object>> tempMapList = new ArrayList<>();
|
||||
|
||||
// 当前节点ID
|
||||
String currentActivityId = currentActivityInstance.getActivityId();
|
||||
|
||||
int size = historicActivityInstanceList.size();
|
||||
boolean ifStartFind = false;
|
||||
boolean ifFinded = false;
|
||||
HistoricActivityInstance historicActivityInstance;
|
||||
|
||||
// 循环当前节点的所有流出线
|
||||
// 循环所有的历史节点
|
||||
// log.info("【开始】-匹配当前节点-ActivityId=【{}】需要高亮显示的流出线", currentActivityId);
|
||||
// log.info("循环历史节点");
|
||||
|
||||
for (int i = 0; i < size; i++) {
|
||||
// // 如果当前节点流程线对应的下级节点在历史节点中,则该条流程线进行高亮显示(【问题】有驳回流程线时,即使没有进行驳回操作,因为申请节点在历史节点中,也会将驳回流程线高亮显示-_-||)
|
||||
// if (historicActivityInstance.getActivityId().equals(sequenceFlow.getTargetRef())) {
|
||||
// Map<String, Object> map = new HashMap<>();
|
||||
// map.put("highLightedFlowId", sequenceFlow.getId());
|
||||
// map.put("highLightedFlowStartTime", historicActivityInstance.getStartTime().getTime());
|
||||
// tempMapList.add(map);
|
||||
// // highFlows.add(sequenceFlow.getId());
|
||||
// }
|
||||
|
||||
// 历史节点
|
||||
historicActivityInstance = historicActivityInstanceList.get(i);
|
||||
// log.info("第【{}/{}】个历史节点-ActivityId=【{}】", i + 1, size, historicActivityInstance.getActivityId());
|
||||
|
||||
// 如果循环历史节点中的id等于当前节点id,从当前历史节点继续先后查找是否有当前流程线等于的节点
|
||||
// 历史节点的序号需要大于等于已经完成历史节点的序号,放置驳回重审一个节点经过两次时只取第一次的流出线高亮显示,第二次的不显示
|
||||
if (i >= k && historicActivityInstance.getActivityId().equals(currentActivityId)) {
|
||||
// log.info("第【{}】个历史节点和当前节点一致-ActivityId=【{}】", i + 1, historicActivityInstance.getActivityId());
|
||||
ifStartFind = true;
|
||||
// 跳过当前节点继续查找下一个节点
|
||||
continue;
|
||||
}
|
||||
if (ifStartFind) {
|
||||
// log.info("[开始]-循环当前节点-ActivityId=【{}】的所有流出线", currentActivityId);
|
||||
|
||||
ifFinded = false;
|
||||
for (SequenceFlow sequenceFlow : outgoingFlowList) {
|
||||
// 如果当前节点流程线对应的下级节点在其后面的历史节点中,则该条流程线进行高亮显示
|
||||
// 【问题】
|
||||
// log.info("当前流出线的下级节点=[{}]", sequenceFlow.getTargetRef());
|
||||
if (historicActivityInstance.getActivityId().equals(sequenceFlow.getTargetRef())) {
|
||||
// log.info("当前节点[{}]需高亮显示的流出线=[{}]", currentActivityId, sequenceFlow.getId());
|
||||
highFlows.add(sequenceFlow.getId());
|
||||
// 暂时默认找到离当前节点最近的下一级节点即退出循环,否则有多条流出线时将全部被高亮显示
|
||||
ifFinded = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// log.info("[完成]-循环当前节点-ActivityId=【{}】的所有流出线", currentActivityId);
|
||||
}
|
||||
if (ifFinded) {
|
||||
// 暂时默认找到离当前节点最近的下一级节点即退出历史节点循环,否则有多条流出线时将全部被高亮显示
|
||||
break;
|
||||
}
|
||||
}
|
||||
// log.info("【完成】-匹配当前节点-ActivityId=【{}】需要高亮显示的流出线", currentActivityId);
|
||||
// if (!CollectionUtils.isEmpty(tempMapList)) {
|
||||
// // 遍历匹配的集合,取得开始时间最早的一个
|
||||
// long earliestStamp = 0L;
|
||||
// String highLightedFlowId = null;
|
||||
// for (Map<String, Object> map : tempMapList) {
|
||||
// long highLightedFlowStartTime = Long.valueOf(map.get("highLightedFlowStartTime").toString());
|
||||
// if (earliestStamp == 0 || earliestStamp <= highLightedFlowStartTime) {
|
||||
// highLightedFlowId = map.get("highLightedFlowId").toString();
|
||||
// earliestStamp = highLightedFlowStartTime;
|
||||
// }
|
||||
// }
|
||||
// highFlows.add(highLightedFlowId);
|
||||
// }
|
||||
}
|
||||
}
|
||||
return highFlows;
|
||||
}
|
||||
}
|
||||
+1194
File diff suppressed because it is too large
Load Diff
+925
@@ -0,0 +1,925 @@
|
||||
package com.jero.modules.activiti.service.impl.image;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.activiti.bpmn.model.Process;
|
||||
import org.activiti.bpmn.model.*;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/**
|
||||
* Class to generate an image based the diagram interchange information in a BPMN 2.0 process.
|
||||
* 在 BPMN 2.0 流程中基于图表交换信息生成图像的类。
|
||||
*
|
||||
* @author Joram Barrez
|
||||
* @author Tijs Rademakers
|
||||
*/
|
||||
@Slf4j
|
||||
public class CustomProcessDiagramGenerator implements ICustomProcessDiagramGenerator {
|
||||
|
||||
protected String ACTIVITY_FONT_NAME = "微软雅黑";
|
||||
protected String LABEL_FONT_NAME = "微软雅黑";
|
||||
protected String ANNOTATION_FONT_NAME = "微软雅黑";
|
||||
|
||||
protected Map<Class<? extends BaseElement>, ActivityDrawInstruction> activityDrawInstructions = new HashMap<>();
|
||||
protected Map<Class<? extends BaseElement>, ArtifactDrawInstruction> artifactDrawInstructions = new HashMap<>();
|
||||
|
||||
/**
|
||||
* The instructions on how to draw a certain construct is
|
||||
* created statically and stored in a map for performance.
|
||||
*/
|
||||
public CustomProcessDiagramGenerator() {
|
||||
// start event
|
||||
activityDrawInstructions.put(StartEvent.class, new ActivityDrawInstruction() {
|
||||
@Override
|
||||
public void draw(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) {
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId());
|
||||
StartEvent startEvent = (StartEvent) flowNode;
|
||||
if (startEvent.getEventDefinitions() != null && !startEvent.getEventDefinitions().isEmpty()) {
|
||||
EventDefinition eventDefinition = startEvent.getEventDefinitions().get(0);
|
||||
if (eventDefinition instanceof TimerEventDefinition) {
|
||||
processDiagramCanvas.drawTimerStartEvent(flowNode.getId(), graphicInfo);
|
||||
} else if (eventDefinition instanceof ErrorEventDefinition) {
|
||||
processDiagramCanvas.drawErrorStartEvent(flowNode.getId(), graphicInfo);
|
||||
} else if (eventDefinition instanceof SignalEventDefinition) {
|
||||
processDiagramCanvas.drawSignalStartEvent(flowNode.getId(), graphicInfo);
|
||||
} else if (eventDefinition instanceof MessageEventDefinition) {
|
||||
processDiagramCanvas.drawMessageStartEvent(flowNode.getId(), graphicInfo);
|
||||
} else {
|
||||
processDiagramCanvas.drawNoneStartEvent(flowNode.getId(), graphicInfo);
|
||||
}
|
||||
} else {
|
||||
processDiagramCanvas.drawNoneStartEvent(flowNode.getId(), graphicInfo);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// signal catch
|
||||
activityDrawInstructions.put(IntermediateCatchEvent.class, new ActivityDrawInstruction() {
|
||||
@Override
|
||||
public void draw(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) {
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId());
|
||||
IntermediateCatchEvent intermediateCatchEvent = (IntermediateCatchEvent) flowNode;
|
||||
if (intermediateCatchEvent.getEventDefinitions() != null && !intermediateCatchEvent
|
||||
.getEventDefinitions().isEmpty()) {
|
||||
if (intermediateCatchEvent.getEventDefinitions().get(0) instanceof SignalEventDefinition) {
|
||||
processDiagramCanvas.drawCatchingSignalEvent(flowNode.getId(), flowNode.getName(), graphicInfo, true);
|
||||
} else if (intermediateCatchEvent.getEventDefinitions().get(0) instanceof TimerEventDefinition) {
|
||||
processDiagramCanvas.drawCatchingTimerEvent(flowNode.getId(), flowNode.getName(), graphicInfo, true);
|
||||
} else if (intermediateCatchEvent.getEventDefinitions().get(0) instanceof MessageEventDefinition) {
|
||||
processDiagramCanvas.drawCatchingMessageEvent(flowNode.getId(), flowNode.getName(), graphicInfo, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// signal throw
|
||||
activityDrawInstructions.put(ThrowEvent.class, new ActivityDrawInstruction() {
|
||||
@Override
|
||||
public void draw(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) {
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId());
|
||||
ThrowEvent throwEvent = (ThrowEvent) flowNode;
|
||||
if (throwEvent.getEventDefinitions() != null && !throwEvent.getEventDefinitions().isEmpty()) {
|
||||
if (throwEvent.getEventDefinitions().get(0) instanceof SignalEventDefinition) {
|
||||
processDiagramCanvas.drawThrowingSignalEvent(flowNode.getId(), graphicInfo);
|
||||
} else if (throwEvent.getEventDefinitions().get(0) instanceof CompensateEventDefinition) {
|
||||
processDiagramCanvas.drawThrowingCompensateEvent(flowNode.getId(), graphicInfo);
|
||||
} else {
|
||||
processDiagramCanvas.drawThrowingNoneEvent(flowNode.getId(), graphicInfo);
|
||||
}
|
||||
} else {
|
||||
processDiagramCanvas.drawThrowingNoneEvent(flowNode.getId(), graphicInfo);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// end event
|
||||
activityDrawInstructions.put(EndEvent.class, new ActivityDrawInstruction() {
|
||||
@Override
|
||||
public void draw(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) {
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId());
|
||||
EndEvent endEvent = (EndEvent) flowNode;
|
||||
if (endEvent.getEventDefinitions() != null && !endEvent.getEventDefinitions().isEmpty()) {
|
||||
if (endEvent.getEventDefinitions().get(0) instanceof ErrorEventDefinition) {
|
||||
processDiagramCanvas.drawErrorEndEvent(flowNode.getId(), flowNode.getName(), graphicInfo);
|
||||
} else {
|
||||
processDiagramCanvas.drawNoneEndEvent(flowNode.getId(), flowNode.getName(), graphicInfo);
|
||||
}
|
||||
} else {
|
||||
processDiagramCanvas.drawNoneEndEvent(flowNode.getId(), flowNode.getName(), graphicInfo);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// task
|
||||
activityDrawInstructions.put(Task.class, new ActivityDrawInstruction() {
|
||||
@Override
|
||||
public void draw(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) {
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId());
|
||||
processDiagramCanvas.drawTask(flowNode.getId(), flowNode.getName(), graphicInfo);
|
||||
}
|
||||
});
|
||||
|
||||
// user task
|
||||
activityDrawInstructions.put(UserTask.class, new ActivityDrawInstruction() {
|
||||
@Override
|
||||
public void draw(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) {
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId());
|
||||
processDiagramCanvas.drawUserTask(flowNode.getId(), flowNode.getName(), graphicInfo);
|
||||
}
|
||||
});
|
||||
|
||||
// script task
|
||||
activityDrawInstructions.put(ScriptTask.class, new ActivityDrawInstruction() {
|
||||
@Override
|
||||
public void draw(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) {
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId());
|
||||
processDiagramCanvas.drawScriptTask(flowNode.getId(), flowNode.getName(), graphicInfo);
|
||||
}
|
||||
});
|
||||
|
||||
// service task
|
||||
activityDrawInstructions.put(ServiceTask.class, new ActivityDrawInstruction() {
|
||||
@Override
|
||||
public void draw(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) {
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId());
|
||||
ServiceTask serviceTask = (ServiceTask) flowNode;
|
||||
processDiagramCanvas.drawServiceTask(flowNode.getId(), flowNode.getName(), graphicInfo);
|
||||
}
|
||||
});
|
||||
|
||||
// receive task
|
||||
activityDrawInstructions.put(ReceiveTask.class, new ActivityDrawInstruction() {
|
||||
@Override
|
||||
public void draw(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) {
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId());
|
||||
processDiagramCanvas.drawReceiveTask(flowNode.getId(), flowNode.getName(), graphicInfo);
|
||||
}
|
||||
});
|
||||
|
||||
// send task
|
||||
activityDrawInstructions.put(SendTask.class, new ActivityDrawInstruction() {
|
||||
@Override
|
||||
public void draw(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) {
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId());
|
||||
processDiagramCanvas.drawSendTask(flowNode.getId(), flowNode.getName(), graphicInfo);
|
||||
}
|
||||
});
|
||||
|
||||
// manual task
|
||||
activityDrawInstructions.put(ManualTask.class, new ActivityDrawInstruction() {
|
||||
@Override
|
||||
public void draw(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) {
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId());
|
||||
processDiagramCanvas.drawManualTask(flowNode.getId(), flowNode.getName(), graphicInfo);
|
||||
}
|
||||
});
|
||||
|
||||
// businessRuleTask task
|
||||
activityDrawInstructions.put(BusinessRuleTask.class, new ActivityDrawInstruction() {
|
||||
@Override
|
||||
public void draw(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) {
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId());
|
||||
processDiagramCanvas.drawBusinessRuleTask(flowNode.getId(), flowNode.getName(), graphicInfo);
|
||||
}
|
||||
});
|
||||
|
||||
// exclusive gateway
|
||||
activityDrawInstructions.put(ExclusiveGateway.class, new ActivityDrawInstruction() {
|
||||
@Override
|
||||
public void draw(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) {
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId());
|
||||
processDiagramCanvas.drawExclusiveGateway(flowNode.getId(), graphicInfo);
|
||||
}
|
||||
});
|
||||
|
||||
// inclusive gateway
|
||||
activityDrawInstructions.put(InclusiveGateway.class, new ActivityDrawInstruction() {
|
||||
@Override
|
||||
public void draw(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) {
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId());
|
||||
processDiagramCanvas.drawInclusiveGateway(flowNode.getId(), graphicInfo);
|
||||
}
|
||||
});
|
||||
|
||||
// parallel gateway
|
||||
activityDrawInstructions.put(ParallelGateway.class, new ActivityDrawInstruction() {
|
||||
@Override
|
||||
public void draw(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) {
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId());
|
||||
processDiagramCanvas.drawParallelGateway(flowNode.getId(), graphicInfo);
|
||||
}
|
||||
});
|
||||
|
||||
// event based gateway
|
||||
activityDrawInstructions.put(EventGateway.class, new ActivityDrawInstruction() {
|
||||
@Override
|
||||
public void draw(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) {
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId());
|
||||
processDiagramCanvas.drawEventBasedGateway(flowNode.getId(), graphicInfo);
|
||||
}
|
||||
});
|
||||
|
||||
// Boundary timer
|
||||
activityDrawInstructions.put(BoundaryEvent.class, new ActivityDrawInstruction() {
|
||||
@Override
|
||||
public void draw(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) {
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId());
|
||||
BoundaryEvent boundaryEvent = (BoundaryEvent) flowNode;
|
||||
if (boundaryEvent.getEventDefinitions() != null && !boundaryEvent.getEventDefinitions().isEmpty()) {
|
||||
if (boundaryEvent.getEventDefinitions().get(0) instanceof TimerEventDefinition) {
|
||||
processDiagramCanvas.drawCatchingTimerEvent(flowNode.getId(), flowNode.getName(), graphicInfo, boundaryEvent.isCancelActivity());
|
||||
} else if (boundaryEvent.getEventDefinitions().get(0) instanceof ErrorEventDefinition) {
|
||||
processDiagramCanvas.drawCatchingErrorEvent(flowNode.getId(), graphicInfo, boundaryEvent.isCancelActivity());
|
||||
} else if (boundaryEvent.getEventDefinitions().get(0) instanceof SignalEventDefinition) {
|
||||
processDiagramCanvas.drawCatchingSignalEvent(flowNode.getId(), flowNode.getName(), graphicInfo, boundaryEvent.isCancelActivity());
|
||||
} else if (boundaryEvent.getEventDefinitions().get(0) instanceof MessageEventDefinition) {
|
||||
processDiagramCanvas.drawCatchingMessageEvent(flowNode.getId(), flowNode.getName(), graphicInfo, boundaryEvent.isCancelActivity());
|
||||
} else if (boundaryEvent.getEventDefinitions().get(0) instanceof CompensateEventDefinition) {
|
||||
processDiagramCanvas.drawCatchingCompensateEvent(flowNode.getId(), graphicInfo, boundaryEvent.isCancelActivity());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
// subprocess
|
||||
activityDrawInstructions.put(SubProcess.class, new ActivityDrawInstruction() {
|
||||
@Override
|
||||
public void draw(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) {
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId());
|
||||
if (graphicInfo.getExpanded() != null && !graphicInfo.getExpanded()) {
|
||||
processDiagramCanvas.drawCollapsedSubProcess(flowNode.getId(), flowNode.getName(), graphicInfo, false);
|
||||
} else {
|
||||
processDiagramCanvas.drawExpandedSubProcess(flowNode.getId(), flowNode.getName(), graphicInfo, SubProcess.class);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Event subprocess
|
||||
activityDrawInstructions.put(EventSubProcess.class, new ActivityDrawInstruction() {
|
||||
@Override
|
||||
public void draw(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) {
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId());
|
||||
if (graphicInfo.getExpanded() != null && !graphicInfo.getExpanded()) {
|
||||
processDiagramCanvas.drawCollapsedSubProcess(flowNode.getId(), flowNode.getName(), graphicInfo, false);
|
||||
} else {
|
||||
processDiagramCanvas.drawExpandedSubProcess(flowNode.getId(), flowNode.getName(), graphicInfo, Transaction.class);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// call activity
|
||||
activityDrawInstructions.put(CallActivity.class, new ActivityDrawInstruction() {
|
||||
@Override
|
||||
public void draw(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode) {
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId());
|
||||
processDiagramCanvas.drawCollapsedCallActivity(flowNode.getId(), flowNode.getName(), graphicInfo);
|
||||
}
|
||||
});
|
||||
|
||||
// text annotation
|
||||
artifactDrawInstructions.put(TextAnnotation.class, new ArtifactDrawInstruction() {
|
||||
@Override
|
||||
public void draw(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, Artifact artifact) {
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(artifact.getId());
|
||||
TextAnnotation textAnnotation = (TextAnnotation) artifact;
|
||||
processDiagramCanvas.drawTextAnnotation(textAnnotation.getId(), textAnnotation.getText(), graphicInfo);
|
||||
}
|
||||
});
|
||||
|
||||
// association
|
||||
artifactDrawInstructions.put(Association.class, new ArtifactDrawInstruction() {
|
||||
@Override
|
||||
public void draw(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, Artifact artifact) {
|
||||
Association association = (Association) artifact;
|
||||
String sourceRef = association.getSourceRef();
|
||||
String targetRef = association.getTargetRef();
|
||||
|
||||
// source and target can be instance of FlowElement or Artifact
|
||||
BaseElement sourceElement = bpmnModel.getFlowElement(sourceRef);
|
||||
BaseElement targetElement = bpmnModel.getFlowElement(targetRef);
|
||||
if (sourceElement == null) {
|
||||
sourceElement = bpmnModel.getArtifact(sourceRef);
|
||||
}
|
||||
if (targetElement == null) {
|
||||
targetElement = bpmnModel.getArtifact(targetRef);
|
||||
}
|
||||
List<GraphicInfo> graphicInfoList = bpmnModel.getFlowLocationGraphicInfo(artifact.getId());
|
||||
graphicInfoList = connectionPerfectionizer(processDiagramCanvas, bpmnModel, sourceElement, targetElement, graphicInfoList);
|
||||
int[] xPoints = new int[graphicInfoList.size()];
|
||||
int[] yPoints = new int[graphicInfoList.size()];
|
||||
for (int i = 1; i < graphicInfoList.size(); i++) {
|
||||
GraphicInfo graphicInfo = graphicInfoList.get(i);
|
||||
GraphicInfo previousGraphicInfo = graphicInfoList.get(i - 1);
|
||||
|
||||
if (i == 1) {
|
||||
xPoints[0] = (int) previousGraphicInfo.getX();
|
||||
yPoints[0] = (int) previousGraphicInfo.getY();
|
||||
}
|
||||
xPoints[i] = (int) graphicInfo.getX();
|
||||
yPoints[i] = (int) graphicInfo.getY();
|
||||
}
|
||||
|
||||
AssociationDirection associationDirection = association.getAssociationDirection();
|
||||
processDiagramCanvas.drawAssociation(xPoints, yPoints, associationDirection, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
protected CustomProcessDiagramCanvas generateProcessDiagram(BpmnModel bpmnModel,
|
||||
List<String> highLightedActivities, List<String> runningActivityIdList, List<String> highLightedFlows, List<String> runningActivityFlowsIds,
|
||||
String activityFontName, String labelFontName, String annotationFontName) {
|
||||
|
||||
CustomProcessDiagramCanvas processDiagramCanvas = initProcessDiagramCanvas(bpmnModel, activityFontName, labelFontName, annotationFontName);
|
||||
|
||||
// Draw pool shape, if process is participant in collaboration
|
||||
for (Pool pool : bpmnModel.getPools()) {
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(pool.getId());
|
||||
processDiagramCanvas.drawPoolOrLane(pool.getId(), pool.getName(), graphicInfo);
|
||||
}
|
||||
|
||||
// Draw lanes
|
||||
for (Process process : bpmnModel.getProcesses()) {
|
||||
for (Lane lane : process.getLanes()) {
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(lane.getId());
|
||||
processDiagramCanvas.drawPoolOrLane(lane.getId(), lane.getName(), graphicInfo);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw activities and their sequence-flows
|
||||
/**
|
||||
* 绘制流程图上的所有节点和流程线,对高亮显示的节点和流程线进行特殊处理
|
||||
*/
|
||||
for (FlowNode flowNode : bpmnModel.getProcesses().get(0).findFlowElementsOfType(FlowNode.class)) {
|
||||
drawActivity(processDiagramCanvas, bpmnModel, flowNode, highLightedActivities, runningActivityIdList,
|
||||
highLightedFlows, runningActivityFlowsIds);
|
||||
}
|
||||
|
||||
// Draw artifacts
|
||||
for (Process process : bpmnModel.getProcesses()) {
|
||||
for (Artifact artifact : process.getArtifacts()) {
|
||||
drawArtifact(processDiagramCanvas, bpmnModel, artifact);
|
||||
}
|
||||
}
|
||||
|
||||
return processDiagramCanvas;
|
||||
}
|
||||
|
||||
/**
|
||||
* Desc: 绘制流程图上的所有节点和流程线,对高亮显示的节点和流程线进行特殊处理
|
||||
*
|
||||
* @param processDiagramCanvas
|
||||
* @param bpmnModel
|
||||
* @param flowNode
|
||||
* @param highLightedActivities
|
||||
* @param highLightedFlows
|
||||
* @author Fuxs
|
||||
*/
|
||||
protected void drawActivity(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode,
|
||||
List<String> highLightedActivities, List<String> runningActivityIdList, List<String> highLightedFlows, List<String> runningActivityFlowsIds) {
|
||||
|
||||
ActivityDrawInstruction drawInstruction = activityDrawInstructions.get(flowNode.getClass());
|
||||
if (drawInstruction != null) {
|
||||
|
||||
drawInstruction.draw(processDiagramCanvas, bpmnModel, flowNode);
|
||||
|
||||
// Gather info on the multi instance marker
|
||||
boolean multiInstanceSequential = false;
|
||||
boolean multiInstanceParallel = false;
|
||||
boolean highLighted = false;
|
||||
if (flowNode instanceof Activity) {
|
||||
Activity activity = (Activity) flowNode;
|
||||
MultiInstanceLoopCharacteristics multiInstanceLoopCharacteristics = activity.getLoopCharacteristics();
|
||||
if (multiInstanceLoopCharacteristics != null) {
|
||||
multiInstanceSequential = multiInstanceLoopCharacteristics.isSequential();
|
||||
multiInstanceParallel = !multiInstanceSequential;
|
||||
}
|
||||
}
|
||||
|
||||
// Gather info on the highLighted marker
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId());
|
||||
if (!(flowNode instanceof SubProcess)) {
|
||||
if (flowNode instanceof CallActivity) {
|
||||
highLighted = true;
|
||||
}
|
||||
} else {
|
||||
highLighted = graphicInfo.getExpanded() != null && !graphicInfo.getExpanded();
|
||||
}
|
||||
|
||||
processDiagramCanvas.drawActivityMarkers((int) graphicInfo.getX(), (int) graphicInfo.getY(), (int) graphicInfo.getWidth(), (int) graphicInfo.getHeight(), multiInstanceSequential, multiInstanceParallel, highLighted);
|
||||
|
||||
|
||||
// Draw highlighted activities
|
||||
if (highLightedActivities.contains(flowNode.getId())) {
|
||||
/*
|
||||
* 如果节点为当前正在处理中的节点,则红色高亮显示
|
||||
*/
|
||||
if (runningActivityIdList.contains(flowNode.getId())) {
|
||||
log.debug("[绘制]-当前正在处理中的节点-红色高亮显示节点[{}-{}]", flowNode.getId(), flowNode.getName());
|
||||
drawRunningActivityHighLight(processDiagramCanvas, bpmnModel.getGraphicInfo(flowNode.getId()));
|
||||
} else {
|
||||
log.debug("[绘制]-高亮显示节点[{}-{}]", flowNode.getId(), flowNode.getName());
|
||||
drawHighLight(processDiagramCanvas, bpmnModel.getGraphicInfo(flowNode.getId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 绘制当前节点的流程线
|
||||
*/
|
||||
for (SequenceFlow sequenceFlow : flowNode.getOutgoingFlows()) {
|
||||
boolean highLighted = (highLightedFlows.contains(sequenceFlow.getId()));
|
||||
String defaultFlow = null;
|
||||
if (flowNode instanceof Activity) {
|
||||
defaultFlow = ((Activity) flowNode).getDefaultFlow();
|
||||
} else if (flowNode instanceof Gateway) {
|
||||
defaultFlow = ((Gateway) flowNode).getDefaultFlow();
|
||||
}
|
||||
|
||||
boolean isDefault = false;
|
||||
if (defaultFlow != null && defaultFlow.equalsIgnoreCase(sequenceFlow.getId())) {
|
||||
isDefault = true;
|
||||
}
|
||||
boolean drawConditionalIndicator = sequenceFlow.getConditionExpression() != null
|
||||
&& !(flowNode instanceof Gateway);
|
||||
|
||||
String sourceRef = sequenceFlow.getSourceRef();
|
||||
String targetRef = sequenceFlow.getTargetRef();
|
||||
FlowElement sourceElement = bpmnModel.getFlowElement(sourceRef);
|
||||
FlowElement targetElement = bpmnModel.getFlowElement(targetRef);
|
||||
List<GraphicInfo> graphicInfoList = bpmnModel.getFlowLocationGraphicInfo(sequenceFlow.getId());
|
||||
if (graphicInfoList != null && graphicInfoList.size() > 0) {
|
||||
graphicInfoList = connectionPerfectionizer(processDiagramCanvas, bpmnModel, sourceElement,
|
||||
targetElement, graphicInfoList);
|
||||
int[] xPoints = new int[graphicInfoList.size()];
|
||||
int[] yPoints = new int[graphicInfoList.size()];
|
||||
|
||||
for (int i = 1; i < graphicInfoList.size(); i++) {
|
||||
GraphicInfo graphicInfo = graphicInfoList.get(i);
|
||||
GraphicInfo previousGraphicInfo = graphicInfoList.get(i - 1);
|
||||
|
||||
if (i == 1) {
|
||||
xPoints[0] = (int) previousGraphicInfo.getX();
|
||||
yPoints[0] = (int) previousGraphicInfo.getY();
|
||||
}
|
||||
xPoints[i] = (int) graphicInfo.getX();
|
||||
yPoints[i] = (int) graphicInfo.getY();
|
||||
|
||||
}
|
||||
|
||||
if (highLightedFlows.contains(sequenceFlow.getId()) && runningActivityFlowsIds.contains(sequenceFlow.getId())) {
|
||||
processDiagramCanvas.drawLastSequenceflow(xPoints, yPoints, drawConditionalIndicator, isDefault, highLighted);
|
||||
} else {
|
||||
processDiagramCanvas.drawSequenceflow(xPoints, yPoints, drawConditionalIndicator, isDefault, highLighted);
|
||||
}
|
||||
|
||||
/*
|
||||
* 绘制流程线名称
|
||||
*/
|
||||
// GraphicInfo lineCenter = getLineCenter(graphicInfoList);
|
||||
// processDiagramCanvas.drawLabel(sequenceFlow.getName(), lineCenter, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Nested elements
|
||||
if (flowNode instanceof FlowElementsContainer) {
|
||||
for (FlowElement nestedFlowElement : ((FlowElementsContainer) flowNode).getFlowElements()) {
|
||||
if (nestedFlowElement instanceof FlowNode) {
|
||||
drawActivity(processDiagramCanvas, bpmnModel, (FlowNode) nestedFlowElement, highLightedActivities,
|
||||
runningActivityIdList, highLightedFlows, runningActivityFlowsIds);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This method makes coordinates of connection flow better.
|
||||
*
|
||||
* @param processDiagramCanvas
|
||||
* @param bpmnModel
|
||||
* @param sourceElement
|
||||
* @param targetElement
|
||||
* @param graphicInfoList
|
||||
* @return
|
||||
*/
|
||||
protected static List<GraphicInfo> connectionPerfectionizer(CustomProcessDiagramCanvas processDiagramCanvas,
|
||||
BpmnModel bpmnModel, BaseElement sourceElement, BaseElement targetElement,
|
||||
List<GraphicInfo> graphicInfoList) {
|
||||
GraphicInfo sourceGraphicInfo = bpmnModel.getGraphicInfo(sourceElement.getId());
|
||||
GraphicInfo targetGraphicInfo = bpmnModel.getGraphicInfo(targetElement.getId());
|
||||
|
||||
CustomProcessDiagramCanvas.SHAPE_TYPE sourceShapeType = getShapeType(sourceElement);
|
||||
CustomProcessDiagramCanvas.SHAPE_TYPE targetShapeType = getShapeType(targetElement);
|
||||
|
||||
return processDiagramCanvas.connectionPerfectionizer(sourceShapeType, targetShapeType, sourceGraphicInfo,
|
||||
targetGraphicInfo, graphicInfoList);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns shape type of base element.<br>
|
||||
* Each element can be presented as rectangle, rhombus, or ellipse.
|
||||
*
|
||||
* @param baseElement
|
||||
* @return CustomProcessDiagramCanvas.SHAPE_TYPE
|
||||
*/
|
||||
protected static CustomProcessDiagramCanvas.SHAPE_TYPE getShapeType(BaseElement baseElement) {
|
||||
if (baseElement instanceof Task || baseElement instanceof Activity || baseElement instanceof TextAnnotation) {
|
||||
return CustomProcessDiagramCanvas.SHAPE_TYPE.Rectangle;
|
||||
} else if (baseElement instanceof Gateway) {
|
||||
return CustomProcessDiagramCanvas.SHAPE_TYPE.Rhombus;
|
||||
} else if (baseElement instanceof Event) {
|
||||
return CustomProcessDiagramCanvas.SHAPE_TYPE.Ellipse;
|
||||
} else {
|
||||
// unknown source element, just do not correct coordinates
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected static GraphicInfo getLineCenter(List<GraphicInfo> graphicInfoList) {
|
||||
GraphicInfo gi = new GraphicInfo();
|
||||
|
||||
int[] xPoints = new int[graphicInfoList.size()];
|
||||
int[] yPoints = new int[graphicInfoList.size()];
|
||||
|
||||
double length = 0;
|
||||
double[] lengths = new double[graphicInfoList.size()];
|
||||
lengths[0] = 0;
|
||||
double m;
|
||||
for (int i = 1; i < graphicInfoList.size(); i++) {
|
||||
GraphicInfo graphicInfo = graphicInfoList.get(i);
|
||||
GraphicInfo previousGraphicInfo = graphicInfoList.get(i - 1);
|
||||
|
||||
if (i == 1) {
|
||||
xPoints[0] = (int) previousGraphicInfo.getX();
|
||||
yPoints[0] = (int) previousGraphicInfo.getY();
|
||||
}
|
||||
xPoints[i] = (int) graphicInfo.getX();
|
||||
yPoints[i] = (int) graphicInfo.getY();
|
||||
|
||||
length += Math.sqrt(Math.pow((int) graphicInfo.getX() - (int) previousGraphicInfo.getX(), 2) + Math.pow(
|
||||
(int) graphicInfo.getY() - (int) previousGraphicInfo.getY(), 2));
|
||||
lengths[i] = length;
|
||||
}
|
||||
m = length / 2;
|
||||
int p1 = 0, p2 = 1;
|
||||
for (int i = 1; i < lengths.length; i++) {
|
||||
double len = lengths[i];
|
||||
p1 = i - 1;
|
||||
p2 = i;
|
||||
if (len > m) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
GraphicInfo graphicInfo1 = graphicInfoList.get(p1);
|
||||
GraphicInfo graphicInfo2 = graphicInfoList.get(p2);
|
||||
|
||||
double AB = (int) graphicInfo2.getX() - (int) graphicInfo1.getX();
|
||||
double OA = (int) graphicInfo2.getY() - (int) graphicInfo1.getY();
|
||||
double OB = lengths[p2] - lengths[p1];
|
||||
double ob = m - lengths[p1];
|
||||
double ab = AB * ob / OB;
|
||||
double oa = OA * ob / OB;
|
||||
|
||||
double mx = graphicInfo1.getX() + ab;
|
||||
double my = graphicInfo1.getY() + oa;
|
||||
|
||||
gi.setX(mx);
|
||||
gi.setY(my);
|
||||
return gi;
|
||||
}
|
||||
|
||||
protected void drawArtifact(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel,
|
||||
Artifact artifact) {
|
||||
|
||||
ArtifactDrawInstruction drawInstruction = artifactDrawInstructions.get(artifact.getClass());
|
||||
if (drawInstruction != null) {
|
||||
drawInstruction.draw(processDiagramCanvas, bpmnModel, artifact);
|
||||
}
|
||||
}
|
||||
|
||||
private static void drawHighLight(CustomProcessDiagramCanvas processDiagramCanvas, GraphicInfo graphicInfo) {
|
||||
processDiagramCanvas.drawHighLight((int) graphicInfo.getX(), (int) graphicInfo.getY(), (int) graphicInfo
|
||||
.getWidth(), (int) graphicInfo.getHeight());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Desc:绘制正在执行中的节点红色高亮显示
|
||||
*
|
||||
* @param processDiagramCanvas CustomProcessDiagramCanvas
|
||||
* @param graphicInfo GraphicInfo
|
||||
* @author Fuxs
|
||||
*/
|
||||
private static void drawRunningActivityHighLight(CustomProcessDiagramCanvas processDiagramCanvas, GraphicInfo graphicInfo) {
|
||||
processDiagramCanvas.drawRunningActivityHighLight((int) graphicInfo.getX(), (int) graphicInfo.getY(), (int) graphicInfo
|
||||
.getWidth(), (int) graphicInfo.getHeight());
|
||||
|
||||
}
|
||||
|
||||
protected static CustomProcessDiagramCanvas initProcessDiagramCanvas(BpmnModel bpmnModel, String activityFontName,
|
||||
String labelFontName, String annotationFontName) {
|
||||
|
||||
// We need to calculate maximum values to know how big the image will be in its entirety
|
||||
double minX = 1.7976931348623157E308D;
|
||||
double maxX = 0.0D;
|
||||
double minY = 1.7976931348623157E308D;
|
||||
double maxY = 0.0D;
|
||||
|
||||
|
||||
for (Pool pool : bpmnModel.getPools()) {
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(pool.getId());
|
||||
minX = graphicInfo.getX();
|
||||
maxX = graphicInfo.getX() + graphicInfo.getWidth();
|
||||
minY = graphicInfo.getY();
|
||||
maxY = graphicInfo.getY() + graphicInfo.getHeight();
|
||||
}
|
||||
|
||||
List<FlowNode> flowNodes = gatherAllFlowNodes(bpmnModel);
|
||||
for (FlowNode flowNode : flowNodes) {
|
||||
|
||||
GraphicInfo flowNodeGraphicInfo = bpmnModel.getGraphicInfo(flowNode.getId());
|
||||
|
||||
// width
|
||||
if (flowNodeGraphicInfo.getX() + flowNodeGraphicInfo.getWidth() > maxX) {
|
||||
maxX = flowNodeGraphicInfo.getX() + flowNodeGraphicInfo.getWidth();
|
||||
}
|
||||
if (flowNodeGraphicInfo.getX() < minX) {
|
||||
minX = flowNodeGraphicInfo.getX();
|
||||
}
|
||||
// height
|
||||
if (flowNodeGraphicInfo.getY() + flowNodeGraphicInfo.getHeight() > maxY) {
|
||||
maxY = flowNodeGraphicInfo.getY() + flowNodeGraphicInfo.getHeight();
|
||||
}
|
||||
if (flowNodeGraphicInfo.getY() < minY) {
|
||||
minY = flowNodeGraphicInfo.getY();
|
||||
}
|
||||
|
||||
for (SequenceFlow sequenceFlow : flowNode.getOutgoingFlows()) {
|
||||
List<GraphicInfo> graphicInfoList = bpmnModel.getFlowLocationGraphicInfo(sequenceFlow.getId());
|
||||
if (graphicInfoList != null) {
|
||||
for (GraphicInfo graphicInfo : graphicInfoList) {
|
||||
// width
|
||||
if (graphicInfo.getX() > maxX) {
|
||||
maxX = graphicInfo.getX();
|
||||
}
|
||||
if (graphicInfo.getX() < minX) {
|
||||
minX = graphicInfo.getX();
|
||||
}
|
||||
// height
|
||||
if (graphicInfo.getY() > maxY) {
|
||||
maxY = graphicInfo.getY();
|
||||
}
|
||||
if (graphicInfo.getY() < minY) {
|
||||
minY = graphicInfo.getY();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<Artifact> artifacts = gatherAllArtifacts(bpmnModel);
|
||||
for (Artifact artifact : artifacts) {
|
||||
|
||||
GraphicInfo artifactGraphicInfo = bpmnModel.getGraphicInfo(artifact.getId());
|
||||
|
||||
if (artifactGraphicInfo != null) {
|
||||
// width
|
||||
if (artifactGraphicInfo.getX() + artifactGraphicInfo.getWidth() > maxX) {
|
||||
maxX = artifactGraphicInfo.getX() + artifactGraphicInfo.getWidth();
|
||||
}
|
||||
if (artifactGraphicInfo.getX() < minX) {
|
||||
minX = artifactGraphicInfo.getX();
|
||||
}
|
||||
// height
|
||||
if (artifactGraphicInfo.getY() + artifactGraphicInfo.getHeight() > maxY) {
|
||||
maxY = artifactGraphicInfo.getY() + artifactGraphicInfo.getHeight();
|
||||
}
|
||||
if (artifactGraphicInfo.getY() < minY) {
|
||||
minY = artifactGraphicInfo.getY();
|
||||
}
|
||||
}
|
||||
|
||||
List<GraphicInfo> graphicInfoList = bpmnModel.getFlowLocationGraphicInfo(artifact.getId());
|
||||
if (graphicInfoList != null) {
|
||||
for (GraphicInfo graphicInfo : graphicInfoList) {
|
||||
// width
|
||||
if (graphicInfo.getX() > maxX) {
|
||||
maxX = graphicInfo.getX();
|
||||
}
|
||||
if (graphicInfo.getX() < minX) {
|
||||
minX = graphicInfo.getX();
|
||||
}
|
||||
// height
|
||||
if (graphicInfo.getY() > maxY) {
|
||||
maxY = graphicInfo.getY();
|
||||
}
|
||||
if (graphicInfo.getY() < minY) {
|
||||
minY = graphicInfo.getY();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int nrOfLanes = 0;
|
||||
for (Process process : bpmnModel.getProcesses()) {
|
||||
for (Lane l : process.getLanes()) {
|
||||
|
||||
nrOfLanes++;
|
||||
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(l.getId());
|
||||
// // width
|
||||
if (graphicInfo.getX() + graphicInfo.getWidth() > maxX) {
|
||||
maxX = graphicInfo.getX() + graphicInfo.getWidth();
|
||||
}
|
||||
if (graphicInfo.getX() < minX) {
|
||||
minX = graphicInfo.getX();
|
||||
}
|
||||
// height
|
||||
if (graphicInfo.getY() + graphicInfo.getHeight() > maxY) {
|
||||
maxY = graphicInfo.getY() + graphicInfo.getHeight();
|
||||
}
|
||||
if (graphicInfo.getY() < minY) {
|
||||
minY = graphicInfo.getY();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Special case, see http://jira.codehaus.org/browse/ACT-1431
|
||||
if (flowNodes.isEmpty() && bpmnModel.getPools().isEmpty() && nrOfLanes == 0) {
|
||||
// Nothing to show
|
||||
minX = 0.0D;
|
||||
minY = 0.0D;
|
||||
}
|
||||
//width和height代表最大的长宽
|
||||
return new CustomProcessDiagramCanvas((int) maxX + 30, (int) maxY + 50, (int) minX, (int) minY, activityFontName, labelFontName, annotationFontName);
|
||||
}
|
||||
|
||||
protected static List<Artifact> gatherAllArtifacts(BpmnModel bpmnModel) {
|
||||
List<Artifact> artifacts = new ArrayList<Artifact>();
|
||||
for (Process process : bpmnModel.getProcesses()) {
|
||||
artifacts.addAll(process.getArtifacts());
|
||||
}
|
||||
return artifacts;
|
||||
}
|
||||
|
||||
protected static List<FlowNode> gatherAllFlowNodes(BpmnModel bpmnModel) {
|
||||
List<FlowNode> flowNodes = new ArrayList<FlowNode>();
|
||||
for (Process process : bpmnModel.getProcesses()) {
|
||||
flowNodes.addAll(gatherAllFlowNodes(process));
|
||||
}
|
||||
return flowNodes;
|
||||
}
|
||||
|
||||
protected static List<FlowNode> gatherAllFlowNodes(FlowElementsContainer flowElementsContainer) {
|
||||
List<FlowNode> flowNodes = new ArrayList<FlowNode>();
|
||||
for (FlowElement flowElement : flowElementsContainer.getFlowElements()) {
|
||||
if (flowElement instanceof FlowNode) {
|
||||
flowNodes.add((FlowNode) flowElement);
|
||||
}
|
||||
if (flowElement instanceof FlowElementsContainer) {
|
||||
flowNodes.addAll(gatherAllFlowNodes((FlowElementsContainer) flowElement));
|
||||
}
|
||||
}
|
||||
return flowNodes;
|
||||
}
|
||||
|
||||
public Map<Class<? extends BaseElement>, ActivityDrawInstruction> getActivityDrawInstructions() {
|
||||
return activityDrawInstructions;
|
||||
}
|
||||
|
||||
public void setActivityDrawInstructions(Map<Class<? extends BaseElement>, ActivityDrawInstruction> activityDrawInstructions) {
|
||||
this.activityDrawInstructions = activityDrawInstructions;
|
||||
}
|
||||
|
||||
public Map<Class<? extends BaseElement>, ArtifactDrawInstruction> getArtifactDrawInstructions() {
|
||||
return artifactDrawInstructions;
|
||||
}
|
||||
|
||||
public void setArtifactDrawInstructions(Map<Class<? extends BaseElement>, ArtifactDrawInstruction> artifactDrawInstructions) {
|
||||
this.artifactDrawInstructions = artifactDrawInstructions;
|
||||
}
|
||||
|
||||
protected interface ActivityDrawInstruction {
|
||||
void draw(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode);
|
||||
}
|
||||
|
||||
protected interface ArtifactDrawInstruction {
|
||||
void draw(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, Artifact artifact);
|
||||
}
|
||||
|
||||
/**
|
||||
* Desc: 输入所有的参数,以获取图像
|
||||
*
|
||||
* @param bpmnModel
|
||||
* @param highLightedActivities
|
||||
* @param runningActivityIdList
|
||||
* @param highLightedFlows
|
||||
* @param activityFontName
|
||||
* @param labelFontName
|
||||
* @param annotationFontName
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public InputStream generateDiagramCustom(BpmnModel bpmnModel,
|
||||
List<String> highLightedActivities,
|
||||
List<String> runningActivityIdList,
|
||||
List<String> highLightedFlows,
|
||||
List<String> runningActivityFlowsIds,
|
||||
String activityFontName,
|
||||
String labelFontName,
|
||||
String annotationFontName) {
|
||||
// TODO
|
||||
return generateProcessDiagram(bpmnModel,
|
||||
highLightedActivities,
|
||||
runningActivityIdList,
|
||||
highLightedFlows,
|
||||
runningActivityFlowsIds,
|
||||
activityFontName,
|
||||
labelFontName,
|
||||
annotationFontName).generateImage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream generateDiagramCustom(BpmnModel bpmnModel,
|
||||
List<String> highLightedActivities,
|
||||
List<String> runningActivityIdList,
|
||||
List<String> highLightedFlows,
|
||||
String activityFontName,
|
||||
String labelFontName,
|
||||
String annotationFontName) {
|
||||
return generateProcessDiagram(bpmnModel,
|
||||
highLightedActivities,
|
||||
runningActivityIdList,
|
||||
highLightedFlows,
|
||||
Collections.emptyList(),
|
||||
activityFontName,
|
||||
labelFontName,
|
||||
annotationFontName).generateImage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream generateDiagramCustom(BpmnModel bpmnModel,
|
||||
List<String> highLightedActivities,
|
||||
List<String> highLightedFlows,
|
||||
String activityFontName,
|
||||
String labelFontName,
|
||||
String annotationFontName) {
|
||||
return generateProcessDiagram(bpmnModel,
|
||||
highLightedActivities,
|
||||
Collections.emptyList(),
|
||||
highLightedFlows,
|
||||
Collections.emptyList(),
|
||||
activityFontName,
|
||||
labelFontName,
|
||||
annotationFontName).generateImage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream generateDiagramCustom(BpmnModel bpmnModel,
|
||||
List<String> highLightedActivities,
|
||||
List<String> runningActivityIdList,
|
||||
List<String> highLightedFlows,
|
||||
List<String> runningActivityFlowsIds) {
|
||||
return generateProcessDiagram(bpmnModel,
|
||||
highLightedActivities,
|
||||
runningActivityIdList,
|
||||
highLightedFlows,
|
||||
runningActivityFlowsIds,
|
||||
ACTIVITY_FONT_NAME,
|
||||
LABEL_FONT_NAME,
|
||||
ANNOTATION_FONT_NAME).generateImage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream generateDiagramCustom(BpmnModel bpmnModel,
|
||||
List<String> highLightedActivities,
|
||||
List<String> runningActivityIdList,
|
||||
List<String> highLightedFlows) {
|
||||
return generateProcessDiagram(bpmnModel,
|
||||
highLightedActivities,
|
||||
runningActivityIdList,
|
||||
highLightedFlows,
|
||||
Collections.emptyList(),
|
||||
ACTIVITY_FONT_NAME,
|
||||
LABEL_FONT_NAME,
|
||||
ANNOTATION_FONT_NAME).generateImage();
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream generateDiagramCustom(BpmnModel bpmnModel,
|
||||
List<String> highLightedActivities,
|
||||
List<String> highLightedFlows) {
|
||||
return generateProcessDiagram(bpmnModel,
|
||||
highLightedActivities,
|
||||
Collections.emptyList(),
|
||||
highLightedFlows,
|
||||
Collections.emptyList(),
|
||||
ACTIVITY_FONT_NAME,
|
||||
LABEL_FONT_NAME,
|
||||
ANNOTATION_FONT_NAME).generateImage();
|
||||
}
|
||||
}
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
package com.jero.modules.activiti.service.impl.image;
|
||||
|
||||
import org.activiti.bpmn.model.BpmnModel;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* bpmnModel bpmn模型
|
||||
* activityFontName 活动字体
|
||||
* labelFontName 标签字体
|
||||
* annotationFontName 标注字体
|
||||
* highLightedActivities 高亮活动节点(绿色)
|
||||
* runningActivityIdList 正在运行的活动节点(红色)
|
||||
* highLightedFlows 高亮顺序流(绿色)
|
||||
* lastFlowIdList 最后一条执行的顺序流(红色) ——————未实现
|
||||
*/
|
||||
public interface ICustomProcessDiagramGenerator{
|
||||
|
||||
//指定字体
|
||||
InputStream generateDiagramCustom(BpmnModel bpmnModel,
|
||||
List<String> highLightedActivities,
|
||||
List<String> runningActivityIdList,
|
||||
List<String> highLightedFlows,
|
||||
List<String> runningActivityFlowsIds,
|
||||
String activityFontName,
|
||||
String labelFontName,
|
||||
String annotationFontName);
|
||||
|
||||
InputStream generateDiagramCustom(BpmnModel bpmnModel,
|
||||
List<String> highLightedActivities,
|
||||
List<String> runningActivityIdList,
|
||||
List<String> highLightedFlows,
|
||||
String activityFontName,
|
||||
String labelFontName,
|
||||
String annotationFontName);
|
||||
|
||||
InputStream generateDiagramCustom(BpmnModel bpmnModel,
|
||||
List<String> highLightedActivities,
|
||||
List<String> highLightedFlows,
|
||||
String activityFontName,
|
||||
String labelFontName,
|
||||
String annotationFontName);
|
||||
|
||||
//无指定字体,使用默认字体
|
||||
InputStream generateDiagramCustom(BpmnModel bpmnModel,
|
||||
List<String> highLightedActivities,
|
||||
List<String> runningActivityIdList,
|
||||
List<String> highLightedFlows,
|
||||
List<String> runningActivityFlowsIds);
|
||||
|
||||
InputStream generateDiagramCustom(BpmnModel bpmnModel,
|
||||
List<String> highLightedActivities,
|
||||
List<String> runningActivityIdList,
|
||||
List<String> highLightedFlows);
|
||||
|
||||
InputStream generateDiagramCustom(BpmnModel bpmnModel,
|
||||
List<String> highLightedActivities,
|
||||
List<String> highLightedFlows);
|
||||
|
||||
}
|
||||
+171
@@ -0,0 +1,171 @@
|
||||
package com.jero.modules.collection.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.modules.collection.entity.OnlCgformCollection;
|
||||
import com.jero.modules.collection.service.IOnlCgformCollectionService;
|
||||
import com.jero.modules.document.controller.BussDocumentLibraryEOController;
|
||||
import com.jero.modules.phone.service.ISearchCenterService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 我的收藏
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-02-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="我的收藏")
|
||||
@RestController
|
||||
@RequestMapping("/collection/onlCgformCollection")
|
||||
@Slf4j
|
||||
public class OnlCgformCollectionController extends JeroController<OnlCgformCollection, IOnlCgformCollectionService> {
|
||||
@Autowired
|
||||
private IOnlCgformCollectionService onlCgformCollectionService;
|
||||
@Autowired
|
||||
BussDocumentLibraryEOController bussDocumentLibraryEOService;
|
||||
@Autowired
|
||||
private ISearchCenterService searchCenterService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-分页列表查询")
|
||||
@ApiOperation(value="我的收藏-分页列表查询", notes="我的收藏-分页列表查询")
|
||||
@PostMapping(value = "/page")
|
||||
public Result<?> queryPageList(@RequestBody Map<String,Object> params){
|
||||
IPage<OnlCgformCollection> pageList = onlCgformCollectionService.queryPageList(params);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-列表查询")
|
||||
@ApiOperation(value="我的收藏-列表查询", notes="我的收藏-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<OnlCgformCollection>> queryList(OnlCgformCollection onlCgformCollection) {
|
||||
List<OnlCgformCollection> list = onlCgformCollectionService.queryList(onlCgformCollection);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param onlCgformCollection
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-添加")
|
||||
@ApiOperation(value="我的收藏-添加", notes="我的收藏-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody OnlCgformCollection onlCgformCollection) {
|
||||
LambdaQueryWrapper<OnlCgformCollection> lambdaQueryWrapper= new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(OnlCgformCollection::getId,onlCgformCollection.getDocumentId())
|
||||
.eq(OnlCgformCollection::getDocumentId,onlCgformCollection.getDocumentId());
|
||||
int count=onlCgformCollectionService.count(lambdaQueryWrapper);
|
||||
if(count==0){
|
||||
onlCgformCollectionService.add(onlCgformCollection);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
else{
|
||||
return Result.error("该值不可重复添加,系统中已存在!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-通过id删除")
|
||||
@ApiOperation(value="我的收藏-通过id删除", notes="我的收藏-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
onlCgformCollectionService.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-批量删除")
|
||||
@ApiOperation(value="我的收藏-批量删除", notes="我的收藏-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.onlCgformCollectionService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-通过id查询")
|
||||
@ApiOperation(value="我的收藏-通过id查询", notes="我的收藏-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
OnlCgformCollection onlCgformCollection = onlCgformCollectionService.queryById(id);
|
||||
if(onlCgformCollection==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(onlCgformCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 表头中英文切换
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-表头中英文切换")
|
||||
@ApiOperation(value="我的收藏-表头中英文切换", notes="我的收藏-表头中英文切换")
|
||||
@GetMapping(value = "/getHeader")
|
||||
public Result<List<Map<String, Object>>> getHeader(@RequestParam(name = "flag") String flag,
|
||||
@RequestParam(name = "cut") String cut) {
|
||||
List<Map<String, Object>> list =onlCgformCollectionService.getHeader(flag, cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询条件中英文切换
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-查询条件中英文切换")
|
||||
@ApiOperation(value="我的收藏-查询条件中英文切换", notes="我的收藏-查询条件中英文切换")
|
||||
@GetMapping(value = "/queryCondition")
|
||||
public Result<List<Map<String, Object>>> queryCondition(@RequestParam(name = "flag") String flag,
|
||||
@RequestParam(name = "cut") String cut) {
|
||||
List<Map<String, Object>> list = onlCgformCollectionService.queryCondition(flag, cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
@AutoLog(value = "我的收藏-搜索-根据用户获取文档库订阅和收藏信息")
|
||||
@ApiOperation(value = "我的收藏-搜索-根据用户获取文档库订阅和收藏信息", notes = "我的收藏-搜索-根据用户获取文档库订阅和收藏信息")
|
||||
@GetMapping(value = "/getWdkCollectAndSubscribeInfoByUser")
|
||||
public Result<Map<String, Object>> getWdkCollectAndSubscribeInfoByUser(@RequestParam Map<String,Object> params) {
|
||||
return this.searchCenterService.getWdkCollectAndSubscribeInfoByUser(params);
|
||||
}
|
||||
}
|
||||
+161
@@ -0,0 +1,161 @@
|
||||
package com.jero.modules.collection.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.modules.collection.entity.OnlCgformCollection;
|
||||
import com.jero.modules.collection.service.IOnlCgformCollectionService;
|
||||
import com.jero.modules.document.controller.BussDocumentLibraryEOController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 我的收藏
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-02-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="我的收藏")
|
||||
@RestController
|
||||
@RequestMapping("/phone/collection/onlCgformCollection")
|
||||
@Slf4j
|
||||
public class PhoneOnlCgformCollectionController extends JeroController<OnlCgformCollection, IOnlCgformCollectionService> {
|
||||
@Autowired
|
||||
private IOnlCgformCollectionService onlCgformCollectionService;
|
||||
@Autowired
|
||||
BussDocumentLibraryEOController bussDocumentLibraryEOService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-分页列表查询")
|
||||
@ApiOperation(value="我的收藏-分页列表查询", notes="我的收藏-分页列表查询")
|
||||
@PostMapping(value = "/page")
|
||||
public Result<?> queryPageList(@RequestBody Map<String,Object> params){
|
||||
IPage<OnlCgformCollection> pageList = onlCgformCollectionService.queryPageList(params);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-列表查询")
|
||||
@ApiOperation(value="我的收藏-列表查询", notes="我的收藏-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<OnlCgformCollection>> queryList(OnlCgformCollection onlCgformCollection) {
|
||||
List<OnlCgformCollection> list = onlCgformCollectionService.queryList(onlCgformCollection);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param onlCgformCollection
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-添加")
|
||||
@ApiOperation(value="我的收藏-添加", notes="我的收藏-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody OnlCgformCollection onlCgformCollection) {
|
||||
LambdaQueryWrapper<OnlCgformCollection> lambdaQueryWrapper= new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(OnlCgformCollection::getId,onlCgformCollection.getDocumentId())
|
||||
.eq(OnlCgformCollection::getDocumentId,onlCgformCollection.getDocumentId());
|
||||
int count=onlCgformCollectionService.count(lambdaQueryWrapper);
|
||||
if(count==0){
|
||||
onlCgformCollectionService.add(onlCgformCollection);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
else{
|
||||
return Result.error("该值不可重复添加,系统中已存在!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-通过id删除")
|
||||
@ApiOperation(value="我的收藏-通过id删除", notes="我的收藏-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
onlCgformCollectionService.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-批量删除")
|
||||
@ApiOperation(value="我的收藏-批量删除", notes="我的收藏-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.onlCgformCollectionService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-通过id查询")
|
||||
@ApiOperation(value="我的收藏-通过id查询", notes="我的收藏-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
OnlCgformCollection onlCgformCollection = onlCgformCollectionService.queryById(id);
|
||||
if(onlCgformCollection==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(onlCgformCollection);
|
||||
}
|
||||
|
||||
/**
|
||||
* 表头中英文切换
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-表头中英文切换")
|
||||
@ApiOperation(value="我的收藏-表头中英文切换", notes="我的收藏-表头中英文切换")
|
||||
@GetMapping(value = "/getHeader")
|
||||
public Result<List<Map<String, Object>>> getHeader(@RequestParam(name = "flag") String flag,
|
||||
@RequestParam(name = "cut") String cut) {
|
||||
List<Map<String, Object>> list =onlCgformCollectionService.getHeader(flag, cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询条件中英文切换
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "我的收藏-查询条件中英文切换")
|
||||
@ApiOperation(value="我的收藏-查询条件中英文切换", notes="我的收藏-查询条件中英文切换")
|
||||
@GetMapping(value = "/queryCondition")
|
||||
public Result<List<Map<String, Object>>> queryCondition(@RequestParam(name = "flag") String flag,
|
||||
@RequestParam(name = "cut") String cut) {
|
||||
List<Map<String, Object>> list = onlCgformCollectionService.queryCondition(flag, cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
package com.jero.modules.collection.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.jero.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
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: 我的收藏
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-02-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("onl_cgform_collection")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="onl_cgform_collection对象", description="我的收藏")
|
||||
public class OnlCgformCollection implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
/**收藏人*/
|
||||
@ApiModelProperty(value = "收藏人")
|
||||
private String createBy;
|
||||
|
||||
/**收藏日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "收藏日期")
|
||||
private java.util.Date createTime;
|
||||
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
|
||||
/**文档库id*/
|
||||
@Excel(name = "文档库id", width = 15, dictTable = "buss_document_library", dicText = "id", dicCode = "id")
|
||||
@Dict(dictTable = "buss_document_library", dicText = "id", dicCode = "id")
|
||||
@ApiModelProperty(value = "文档库id")
|
||||
private String documentId;
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
package com.jero.modules.collection.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jero.modules.collection.entity.OnlCgformCollection;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 我的收藏
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-02-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface OnlCgformCollectionMapper extends BaseMapper<OnlCgformCollection> {
|
||||
|
||||
@Select("select * from buss_document_library as document LEFT JOIN onl_cgform_collection as collection\n" +
|
||||
" on document.id= collection.document_id;")
|
||||
List<OnlCgformCollection> queryListByDocumentId(@Param("document_id") String document_id);
|
||||
|
||||
IPage queryPageList(IPage page,@Param("params") Map<String, Object> params);
|
||||
|
||||
List<Map<String,Object>> infoList(@Param("params") Map<String, Object> params);
|
||||
}
|
||||
+118
@@ -0,0 +1,118 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jero.modules.collection.mapper.OnlCgformCollectionMapper">
|
||||
<resultMap id="OnlCgformCollectionResultMap" type="com.jero.modules.collection.entity.OnlCgformCollection">
|
||||
<id column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="sys_org_code" property="sysOrgCode" />
|
||||
<result column="document_id" property="documentId" />
|
||||
</resultMap>
|
||||
|
||||
<select id="queryPageList" resultType="hashmap">
|
||||
select
|
||||
occ.id,
|
||||
occ.create_time as createTime,
|
||||
occ.create_by as createBy,
|
||||
bdl.serial_number as serialNumber,
|
||||
bdl.title,
|
||||
bdl.state,
|
||||
occ.document_id as documentId
|
||||
from
|
||||
onl_cgform_collection occ
|
||||
right join buss_document_library bdl on occ.document_id = bdl.id
|
||||
where occ.create_by = #{params.createBy}
|
||||
<if test="params.serialNumber != null and params.serialNumber != ''">
|
||||
<!--搜索条件:编号;包含%,单独搜索-->
|
||||
<choose>
|
||||
<when test='params.serialNumber != null and params.serialNumber != "" and params.serialNumber.contains("%")'>
|
||||
and bdl.serial_number like '%1%%' escape '1'
|
||||
</when>
|
||||
<otherwise>
|
||||
and bdl.serial_number like concat(concat('%',#{params.serialNumber}),'%')
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
|
||||
<if test="params.title != null and params.title != ''">
|
||||
<!--搜索条件:标题;包含%,单独搜索-->
|
||||
<choose>
|
||||
<when test='params.title != null and params.title != "" and params.title.contains("%")'>
|
||||
and bdl.title like '%1%%' escape '1'
|
||||
</when>
|
||||
<otherwise>
|
||||
and bdl.title like concat(concat('%',#{params.title}),'%')
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
|
||||
<if test="params.state != null and params.state != '' ">
|
||||
and bdl.state in
|
||||
<foreach collection="params.state.split(',')" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="params.orderByField == 'serial_number' or params.orderByField == 'title'">
|
||||
order by CONVERT( ${params.orderByField} USING gbk) COLLATE gbk_chinese_ci
|
||||
|
||||
</if>
|
||||
<if test="params.orderByField == 'create_time'">
|
||||
order by occ.create_time
|
||||
</if>
|
||||
<if test="params.orderBy == 1">
|
||||
asc
|
||||
</if>
|
||||
<if test="params.orderBy == 2">
|
||||
desc
|
||||
</if>
|
||||
<if test="params.orderByField == null or params.orderByField == ''">
|
||||
order by occ.create_time desc
|
||||
</if>
|
||||
</select>
|
||||
<select id="infoList" parameterType="java.util.Map" resultType="hashmap">
|
||||
select
|
||||
occ.id,
|
||||
occ.create_time as createTime,
|
||||
occ.create_by as createBy,
|
||||
bdl.serial_number as serialNumber,
|
||||
bdl.title,
|
||||
bdl.state,
|
||||
occ.document_id as documentId
|
||||
from
|
||||
onl_cgform_collection occ
|
||||
right join buss_document_library bdl on occ.document_id = bdl.id
|
||||
where occ.create_by = #{params.createBy}
|
||||
<if test="params.serialNumber != null and params.serialNumber != ''">
|
||||
<!--搜索条件:编号;包含%,单独搜索-->
|
||||
<choose>
|
||||
<when test='params.serialNumber != null and params.serialNumber != "" and params.serialNumber.contains("%")'>
|
||||
and bdl.serial_number like '%1%%' escape '1'
|
||||
</when>
|
||||
<otherwise>
|
||||
and bdl.serial_number like concat(concat('%',#{params.serialNumber}),'%')
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
|
||||
<if test="params.title != null and params.title != ''">
|
||||
<!--搜索条件:标题;包含%,单独搜索-->
|
||||
<choose>
|
||||
<when test='params.title != null and params.title != "" and params.title.contains("%")'>
|
||||
and bdl.title like '%1%%' escape '1'
|
||||
</when>
|
||||
<otherwise>
|
||||
and bdl.title like concat(concat('%',#{params.title}),'%')
|
||||
</otherwise>
|
||||
</choose>
|
||||
</if>
|
||||
|
||||
<if test="params.state != null and params.state != '' ">
|
||||
and bdl.state in
|
||||
<foreach collection="params.state.split(',')" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
package com.jero.modules.collection.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.modules.collection.entity.OnlCgformCollection;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 我的收藏
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-02-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IOnlCgformCollectionService extends IService<OnlCgformCollection> {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param onlCgformCollection
|
||||
* @return
|
||||
*/
|
||||
void add(OnlCgformCollection onlCgformCollection);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
OnlCgformCollection queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<OnlCgformCollection> queryList(OnlCgformCollection onlCgformCollection);
|
||||
|
||||
/**
|
||||
* 列表表头中英文切换
|
||||
* @param flag
|
||||
* @param cut
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> getHeader(String flag, String cut);
|
||||
|
||||
/**
|
||||
* 查询条件中英文切换
|
||||
* @param flag
|
||||
* @param cut
|
||||
* @return
|
||||
*/
|
||||
public List<Map<String, Object>> queryCondition(String flag, String cut);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
IPage<OnlCgformCollection> queryPageList(Map<String, Object> params);
|
||||
}
|
||||
+372
@@ -0,0 +1,372 @@
|
||||
package com.jero.modules.collection.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import com.jero.common.constant.enums.YesOrNoEnum;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
|
||||
import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl;
|
||||
import com.jero.modules.collection.entity.OnlCgformCollection;
|
||||
import com.jero.modules.collection.mapper.OnlCgformCollectionMapper;
|
||||
import com.jero.modules.collection.service.IOnlCgformCollectionService;
|
||||
import com.jero.modules.document.enums.LawsStateEnum;
|
||||
import com.jero.modules.ocr.util.LineHumpUtil;
|
||||
import com.jero.modules.system.entity.SysDictItem;
|
||||
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 我的收藏
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-02-15
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class OnlCgformCollectionServiceImpl extends ServiceImpl<OnlCgformCollectionMapper, OnlCgformCollection> implements IOnlCgformCollectionService {
|
||||
@Autowired
|
||||
private OnlCgformFieldServiceImpl onlCgformFieldService;
|
||||
@Autowired
|
||||
OnlCgformCollectionMapper onlCgformCollectionMapper;
|
||||
@Autowired
|
||||
private SysDictItemServiceImpl sysDictItemServiceImpl;
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param onlCgformCollection
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(OnlCgformCollection onlCgformCollection) {
|
||||
Date now = new Date();
|
||||
onlCgformCollection.setCreateTime(now);
|
||||
save(onlCgformCollection);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void deleteById(String id) {
|
||||
boolean checkData = checkData(id);
|
||||
if(!checkData){
|
||||
throw new JeroBootException("该用户没有权限!");
|
||||
}
|
||||
try {
|
||||
OnlCgformCollection onlCgformCollection = super.baseMapper.selectById(id);
|
||||
List<String> documentIdList = new ArrayList<>();
|
||||
documentIdList.add(onlCgformCollection.getDocumentId());
|
||||
|
||||
//删除订阅
|
||||
//deleteSubscribe(documentIdList);
|
||||
|
||||
removeById(id);
|
||||
}catch (Exception ex){
|
||||
log.error("取消收藏失败:" + ex.getMessage());
|
||||
throw new JeroBootException("取消收藏失败!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
@Transactional
|
||||
public void deleteByIds(List<String> ids) {
|
||||
for (String id : ids) {
|
||||
boolean checkData = checkData(id);
|
||||
if(!checkData){
|
||||
throw new JeroBootException("该用户没有权限!");
|
||||
}
|
||||
}
|
||||
try {
|
||||
QueryWrapper<OnlCgformCollection> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().in(OnlCgformCollection::getId,ids);
|
||||
List<OnlCgformCollection> onlCgformCollections = super.baseMapper.selectList(queryWrapper);
|
||||
List<String> documentIdList = onlCgformCollections.stream().map(OnlCgformCollection::getDocumentId).distinct().collect(Collectors.toList());
|
||||
|
||||
//删除订阅
|
||||
//deleteSubscribe(documentIdList);
|
||||
|
||||
removeByIds(ids);
|
||||
}catch (Exception ex){
|
||||
log.error("批量取消收藏失败:" + ex.getMessage());
|
||||
throw new JeroBootException("批量取消收藏失败!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public OnlCgformCollection queryById(String id) {
|
||||
boolean checkData = checkData(id);
|
||||
if(!checkData){
|
||||
throw new JeroBootException("该用户没有权限!");
|
||||
}
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<OnlCgformCollection> queryList(OnlCgformCollection onlCgformCollection) {
|
||||
List<OnlCgformCollection> list = onlCgformCollectionMapper.queryListByDocumentId(onlCgformCollection.getDocumentId());
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表表头中英文切换
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> getHeader(String flag, String cut) {
|
||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(flag);
|
||||
if (fieldList.size() != 0) {
|
||||
//过滤列表字段(is_show_list-->列表是否显示0否 1是) 过滤出需要的表头字段
|
||||
fieldList = fieldList.stream().filter(
|
||||
e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsShowList()))
|
||||
&& (
|
||||
e.getDbFieldEnName().equals("serial_number")||e.getDbFieldEnName().equals("title")
|
||||
||e.getDbFieldEnName().equals("state")
|
||||
)
|
||||
).collect(Collectors.toList());
|
||||
}
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (OnlCgformField onlCgformField : fieldList) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if ("file_name".equals(onlCgformField.getDbFieldName())) {
|
||||
//跳转详情的标识
|
||||
map.put("click", "true");
|
||||
}
|
||||
//单独处理发布日期和标准实施日期
|
||||
if ("update_time".equals(onlCgformField.getDbFieldName())) {
|
||||
map.put("sort", "true");//列表排序标识
|
||||
}
|
||||
map.put("db_field_name", LineHumpUtil.lineToHump(onlCgformField.getDbFieldName()));//字段
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
map.put("db_field_txt", onlCgformField.getDbFieldTxt());//字段中文名
|
||||
} else {
|
||||
map.put("db_field_txt", onlCgformField.getDbFieldEnName());//字段英文名
|
||||
}
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询条件中英文切换
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<Map<String, Object>> queryCondition(String flag, String cut) {
|
||||
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(flag);
|
||||
if (fieldList.size() != 0) {
|
||||
//过滤出需要的搜索条件()
|
||||
fieldList = fieldList.stream().filter(
|
||||
e -> YesOrNoEnum.YES.getValue().equals(String.valueOf(e.getIsQuery()))
|
||||
&& (
|
||||
e.getDbFieldEnName().equals("serial_number")||e.getDbFieldEnName().equals("title")
|
||||
||e.getDbFieldEnName().equals("state")
|
||||
)
|
||||
).collect(Collectors.toList());
|
||||
}
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
for (OnlCgformField onlCgformField : fieldList) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("field_show_type", onlCgformField.getFieldShowType());//类型(判断是下拉还是输入框,等等)
|
||||
map.put("dict_field", onlCgformField.getDictField()); //下拉类型的数据字典编码
|
||||
map.put("db_field_name", LineHumpUtil.lineToHump(onlCgformField.getDbFieldName()));//字段
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
map.put("db_field_txt", onlCgformField.getDbFieldTxt());//字段中文名
|
||||
} else {
|
||||
map.put("db_field_txt", onlCgformField.getDbFieldEnName());//字段英文名
|
||||
}
|
||||
list.add(map);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<OnlCgformCollection> queryPageList(Map<String, Object> params) {
|
||||
// params.put("orderByField","serial_number");
|
||||
// params.put("orderBy","1");
|
||||
if(ObjectUtils.isEmpty(params.get("orderByField"))){
|
||||
params.put("orderBy","");
|
||||
}
|
||||
Integer pageNo = Integer.parseInt(params.get("pageNo").toString());
|
||||
Integer pageSize = Integer.parseInt(params.get("pageSize").toString());
|
||||
IPage page = new Page(pageNo, pageSize);
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
params.put("createBy",sysUser.getUsername());
|
||||
IPage result = new Page();
|
||||
//表头排序(状态单独处理)
|
||||
if(ObjectUtils.isNotEmpty(params.get("orderByField")) && "state".equals((String) params.get("orderByField"))){
|
||||
List<Map<String, Object>> infoList = onlCgformCollectionMapper.infoList(params);
|
||||
result = stateSort(params,pageNo,pageSize,result,infoList);
|
||||
}else{
|
||||
result = onlCgformCollectionMapper.queryPageList(page,params);
|
||||
}
|
||||
List<Map<String,Object>> records = result.getRecords();
|
||||
dataDispose(records,params);
|
||||
return result;
|
||||
}
|
||||
public IPage stateSort(Map<String, Object> parameter, int pageNo, int pageSize, IPage infoPage,List<Map<String, Object>> infoList) {
|
||||
List<Map<String,Object>> list = new LinkedList<>();
|
||||
//状态排序,需要特殊处理 现行,即将实施,草稿,被替代,废止
|
||||
if(ObjectUtils.isNotEmpty(parameter.get("orderByField")) && "state".equals((String) parameter.get("orderByField"))){
|
||||
List<Map<String, Object>> active = infoList.stream()
|
||||
.filter(e -> LawsStateEnum.ACTIVE.getValue().equals(e.get("state"))).collect(Collectors.toList());
|
||||
List<Map<String, Object>> theUpcoming = infoList.stream()
|
||||
.filter(e -> LawsStateEnum.THE_UPCOMING.getValue().equals(e.get("state"))).collect(Collectors.toList());
|
||||
List<Map<String, Object>> draft = infoList.stream()
|
||||
.filter(e -> LawsStateEnum.DRAFT.getValue().equals(e.get("state"))).collect(Collectors.toList());
|
||||
List<Map<String, Object>> beReplaced = infoList.stream()
|
||||
.filter(e -> LawsStateEnum.BE_REPLACED.getValue().equals(e.get("state"))).collect(Collectors.toList());
|
||||
List<Map<String, Object>> abolish = infoList.stream()
|
||||
.filter(e -> LawsStateEnum.ABOLISH.getValue().equals(e.get("state"))).collect(Collectors.toList());
|
||||
if ("1".equals((String) parameter.get("orderBy"))) {
|
||||
//正序
|
||||
list.addAll(active);
|
||||
list.addAll(theUpcoming);
|
||||
list.addAll(draft);
|
||||
list.addAll(beReplaced);
|
||||
list.addAll(abolish);
|
||||
|
||||
} else if ("2".equals((String) parameter.get("orderBy"))) {
|
||||
//倒序
|
||||
list.addAll(abolish);
|
||||
list.addAll(beReplaced);
|
||||
list.addAll(draft);
|
||||
list.addAll(theUpcoming);
|
||||
list.addAll(active);
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(list)){
|
||||
infoPage = getPages(pageNo, pageSize, list);
|
||||
}
|
||||
}
|
||||
return infoPage;
|
||||
}
|
||||
public IPage getPages(Integer currentPage, Integer pageSize, List<Map<String,Object>> list){
|
||||
IPage page =new Page();
|
||||
if(list==null){
|
||||
return null;
|
||||
}
|
||||
int size = list.size();
|
||||
if(pageSize > size){
|
||||
pageSize = size;
|
||||
}
|
||||
if(pageSize!=0){
|
||||
//求出最⼤页数,防⽌currentPage越界
|
||||
int maxPage = size % pageSize ==0? size / pageSize : size / pageSize +1;
|
||||
if(currentPage > maxPage){
|
||||
currentPage = maxPage;
|
||||
}
|
||||
}
|
||||
//当前页第⼀条数据的下标
|
||||
int curIdx = currentPage >1?(currentPage -1)* pageSize :0;
|
||||
List pageList =new ArrayList();
|
||||
//将当前页的数据放进pageList
|
||||
for(int i =0; i < pageSize && curIdx + i < size; i++){
|
||||
pageList.add(list.get(curIdx + i));
|
||||
}
|
||||
page.setCurrent(currentPage).setSize(pageSize).setTotal(list.size()).setRecords(pageList);
|
||||
return page;
|
||||
}
|
||||
|
||||
public void dataDispose(List<Map<String,Object>> datas, Map<String,Object> params){
|
||||
if(CollectionUtils.isNotEmpty(datas)){
|
||||
List<SysDictItem> sysDictItems = sysDictItemServiceImpl.selectItemsAll();
|
||||
//获取所有文本状态数据字典
|
||||
List<SysDictItem> stateList = sysDictItems.stream()
|
||||
.filter(e -> StringUtils.isNotBlank(e.getDictCode()) && e.getDictCode().equals("state"))
|
||||
.collect(Collectors.toList());
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
|
||||
|
||||
String cut = (String) params.get("cut");
|
||||
for (Map<String, Object> data : datas) {
|
||||
Date createTime = (Date) data.get("createTime");
|
||||
data.put("createTime",sdf.format(createTime));
|
||||
String state = (String) data.get("state");
|
||||
for (SysDictItem sysDictItem : stateList) {
|
||||
if(StringUtils.equals(state,sysDictItem.getItemValue())){
|
||||
if(StringUtils.equals(cut,CutEnum.CN.getValue())){
|
||||
data.put("state",sysDictItem.getItemText());
|
||||
}else {
|
||||
data.put("state",sysDictItem.getEnName());
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
//设置为已收藏
|
||||
data.put("collectFlag","1");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 验证数据
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
public boolean checkData(String id){
|
||||
boolean result = false;
|
||||
try {
|
||||
QueryWrapper<OnlCgformCollection> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(OnlCgformCollection::getId,id);
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
queryWrapper.lambda().eq(OnlCgformCollection::getCreateBy,sysUser.getUsername());
|
||||
Integer integer = onlCgformCollectionMapper.selectCount(queryWrapper);
|
||||
if(integer>0){
|
||||
result = true;
|
||||
}
|
||||
}catch (Exception ex){
|
||||
log.error("验证我的收藏数据异常:" + ex.getMessage());
|
||||
throw new JeroBootException("验证我的收藏数据异常!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/*public void deleteSubscribe(List<String> docIdList){
|
||||
try {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
QueryWrapper<OnlCgformSubscribe> deleteWarpper = new QueryWrapper<>();
|
||||
deleteWarpper.lambda().in(OnlCgformSubscribe::getDocumentId,docIdList);
|
||||
deleteWarpper.lambda().eq(OnlCgformSubscribe::getCreateBy,sysUser.getUsername());
|
||||
onlCgformSubscribeMapper.delete(deleteWarpper);
|
||||
}catch (Exception ex){
|
||||
log.error("删除订阅信息失败:" + ex.getMessage());
|
||||
throw new JeroBootException("删除订阅信息失败!");
|
||||
}
|
||||
}*/
|
||||
}
|
||||
+281
@@ -0,0 +1,281 @@
|
||||
package com.jero.modules.compare.controller;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
|
||||
import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl;
|
||||
import com.jero.modules.compare.entity.SarFileCompareDetailVO;
|
||||
import com.jero.modules.compare.entity.SarFileCompareInfo;
|
||||
import com.jero.modules.compare.service.ISarFileCompareInfoService;
|
||||
import com.jero.modules.docTranslation.enums.ReleaseConditionEnum;
|
||||
import com.jero.modules.system.util.MyStringUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-02
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags = "文档对比信息表")
|
||||
@RestController
|
||||
@RequestMapping("/compare/sarFileCompareInfo")
|
||||
@Slf4j
|
||||
public class SarFileCompareInfoController extends JeroController<SarFileCompareInfo, ISarFileCompareInfoService> {
|
||||
@Autowired
|
||||
private ISarFileCompareInfoService sarFileCompareInfoService;
|
||||
@Autowired
|
||||
private OnlCgformFieldServiceImpl onlCgformFieldService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息表-分页列表查询")
|
||||
@ApiOperation(value = "文档对比信息表-分页列表查询", notes = "文档对比信息表-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
@RequestParam(name = "cut", defaultValue = "cn") String cut,
|
||||
@RequestParam(name = "serialNumber", defaultValue = "") String serialNumber,
|
||||
@RequestParam(name = "title", defaultValue = "") String title,
|
||||
@RequestParam(name = "releaseState", defaultValue = "") String releaseState,
|
||||
HttpServletRequest req) {
|
||||
LambdaQueryWrapper<SarFileCompareInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
queryWrapper.and(LambdaQueryWrapper -> LambdaQueryWrapper.eq(SarFileCompareInfo::getCreateBy, sysUser.getUsername()).or().eq(SarFileCompareInfo::getReleaseState, ReleaseConditionEnum.PUBLISHED.getValue()));
|
||||
if (MyStringUtils.isNotBlank(serialNumber)) {
|
||||
String finalSerialNumber = serialNumber.replace("%", "\\%");;
|
||||
queryWrapper.and(LambdaQueryWrapper -> LambdaQueryWrapper.like(SarFileCompareInfo::getSerialNumberLeft, finalSerialNumber).or().like(SarFileCompareInfo::getSerialNumberRight, finalSerialNumber));
|
||||
|
||||
}
|
||||
if (MyStringUtils.isNotBlank(title)) {
|
||||
String finalTitle = title.replace("%", "\\%");
|
||||
queryWrapper.and(i -> i.like(SarFileCompareInfo::getTitleLeft, finalTitle).or().like(SarFileCompareInfo::getTitleRight, finalTitle));
|
||||
}
|
||||
if (MyStringUtils.isNotBlank(releaseState)) {
|
||||
queryWrapper.and(LambdaQueryWrapper -> LambdaQueryWrapper.eq(SarFileCompareInfo::getReleaseState, releaseState));
|
||||
}
|
||||
queryWrapper.orderByDesc(SarFileCompareInfo::getCreateTime);
|
||||
Page<SarFileCompareInfo> page = new Page<>(pageNo, pageSize);
|
||||
IPage<SarFileCompareInfo> pageList = sarFileCompareInfoService.page(page, queryWrapper);
|
||||
for (SarFileCompareInfo info : pageList.getRecords()) {
|
||||
info.setReleaseStateTitle(ReleaseConditionEnum.getTextByValue(info.getReleaseState(), cut));
|
||||
info.setFileTypeLeft(getFileTypeText(info.getFileTypeLeft(), cut));
|
||||
info.setFileTypeRight(getFileTypeText(info.getFileTypeRight(), cut));
|
||||
}
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
private String getFileTypeText(String fileType, String cut) {
|
||||
OnlCgformField fileTypeField = this.onlCgformFieldService.queryById(fileType);
|
||||
if (ObjectUtil.isNotEmpty(fileTypeField)) {
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
return fileTypeField.getDbFieldTxt();
|
||||
} else {
|
||||
return fileTypeField.getDbFieldEnName();
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息表-列表查询")
|
||||
@ApiOperation(value = "文档对比信息表-列表查询", notes = "文档对比信息表-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<SarFileCompareInfo>> queryList() {
|
||||
List<SarFileCompareInfo> list = sarFileCompareInfoService.queryList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param sarFileCompareInfo
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息表-添加")
|
||||
@ApiOperation(value = "文档对比信息表-添加", notes = "文档对比信息表-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody SarFileCompareInfo sarFileCompareInfo) {
|
||||
sarFileCompareInfoService.add(sarFileCompareInfo);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sarFileCompareInfo
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息表-编辑")
|
||||
@ApiOperation(value = "文档对比信息表-编辑", notes = "文档对比信息表-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody SarFileCompareInfo sarFileCompareInfo) {
|
||||
sarFileCompareInfoService.editById(sarFileCompareInfo);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息表-通过id删除")
|
||||
@ApiOperation(value = "文档对比信息表-通过id删除", notes = "文档对比信息表-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
sarFileCompareInfoService.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息表-批量删除")
|
||||
@ApiOperation(value = "文档对比信息表-批量删除", notes = "文档对比信息表-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.sarFileCompareInfoService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息表-通过id查询")
|
||||
@ApiOperation(value = "文档对比信息表-通过id查询", notes = "文档对比信息表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
SarFileCompareInfo sarFileCompareInfo = sarFileCompareInfoService.queryById(id);
|
||||
if (sarFileCompareInfo == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(sarFileCompareInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param sarFileCompareInfo
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SarFileCompareInfo sarFileCompareInfo) {
|
||||
return super.exportXls(request, sarFileCompareInfo, SarFileCompareInfo.class, "文档对比信息表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SarFileCompareInfo.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 发起文档对比
|
||||
*
|
||||
* @param json
|
||||
* @return 对比详情ID
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息表-发起文档对比")
|
||||
@ApiOperation(value = "文档对比信息表-发起文档对比", notes = "文档对比信息表-发起文档对比")
|
||||
@RequestMapping(value = "/fullTextComparison", method = RequestMethod.POST)
|
||||
public Result<?> fullTextComparison(@RequestBody JSONObject json) {
|
||||
try {
|
||||
String leftStandard = json.get("leftStandard").toString();
|
||||
String rightStandard = json.get("rightStandard").toString();
|
||||
String remark = "";
|
||||
if (json.get("remark") != null) {
|
||||
remark = json.get("remark").toString();
|
||||
}
|
||||
String InfoId = sarFileCompareInfoService.fullTextComparison(leftStandard, rightStandard, remark);
|
||||
return Result.OK(InfoId);
|
||||
} catch (Exception ex) {
|
||||
log.error("发起文档对比失败:" + ex.getMessage());
|
||||
return Result.OK("发起文档对比失败!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更改发布状态
|
||||
*
|
||||
* @param sarFileCompareInfo
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息表-更改发布状态")
|
||||
@ApiOperation(value = "文档对比信息表-更改发布状态", notes = "文档对比信息表-更改发布状态")
|
||||
@RequestMapping(value = "/changeState", method = RequestMethod.POST)
|
||||
public Result<?> changeState(@Validated @RequestBody SarFileCompareInfo sarFileCompareInfo) {
|
||||
SarFileCompareInfo info = sarFileCompareInfoService.queryById(sarFileCompareInfo.getId());
|
||||
if (ReleaseConditionEnum.DRAFT.getValue().equals(sarFileCompareInfo.getReleaseState())) {
|
||||
info.setReleaseState(ReleaseConditionEnum.PUBLISHED.getValue());
|
||||
} else {
|
||||
info.setReleaseState(ReleaseConditionEnum.DRAFT.getValue());
|
||||
}
|
||||
sarFileCompareInfoService.editById(info);
|
||||
return Result.OK("更改成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 求对比详情
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息表-请求对比详情")
|
||||
@ApiOperation(value = "文档对比信息表-请求对比详情", notes = "文档对比信息表-请求对比详情")
|
||||
@RequestMapping(value = "/getComparisonDetail", method = RequestMethod.POST)
|
||||
public Result<?> getComparisonDetail(@RequestBody JSONObject json) {
|
||||
SarFileCompareDetailVO sarFileCompareDetailVO = sarFileCompareInfoService.getComparisonDetail(json.get("id").toString());
|
||||
return Result.OK(sarFileCompareDetailVO);
|
||||
}
|
||||
|
||||
@AutoLog(value = "文档对比信息表-编辑全文评论")
|
||||
@ApiOperation(value = "文档对比信息表-编辑全文评论", notes = "文档对比信息表-编辑全文评论")
|
||||
@PutMapping(value = "/editComments")
|
||||
public Result<?> editComments(@Validated @RequestBody SarFileCompareInfo sarFileCompareInfo) {
|
||||
SarFileCompareInfo info = sarFileCompareInfoService.getById(sarFileCompareInfo.getId());
|
||||
info.setComments(sarFileCompareInfo.getComments());
|
||||
sarFileCompareInfoService.editById(info);
|
||||
return Result.OK("编辑评论成功!");
|
||||
}
|
||||
|
||||
}
|
||||
+187
@@ -0,0 +1,187 @@
|
||||
package com.jero.modules.compare.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.modules.compare.entity.SarFileCompareItemComment;
|
||||
import com.jero.modules.compare.entity.SarFileCompareResultVO;
|
||||
import com.jero.modules.compare.service.ISarFileCompareItemCommentService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息条款评论表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-05
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags = "文档对比信息条款评论表")
|
||||
@RestController
|
||||
@RequestMapping("/compare/sarFileCompareItemComment")
|
||||
@Slf4j
|
||||
public class SarFileCompareItemCommentController extends JeroController<SarFileCompareItemComment, ISarFileCompareItemCommentService> {
|
||||
@Autowired
|
||||
private ISarFileCompareItemCommentService sarFileCompareItemCommentService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param sarFileCompareItemComment
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款评论表-分页列表查询")
|
||||
@ApiOperation(value = "文档对比信息条款评论表-分页列表查询", notes = "文档对比信息条款评论表-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(SarFileCompareItemComment sarFileCompareItemComment,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<SarFileCompareItemComment> queryWrapper = QueryGenerator.initQueryWrapper(sarFileCompareItemComment, req.getParameterMap());
|
||||
Page<SarFileCompareItemComment> page = new Page<SarFileCompareItemComment>(pageNo, pageSize);
|
||||
IPage<SarFileCompareItemComment> pageList = sarFileCompareItemCommentService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款评论表-列表查询")
|
||||
@ApiOperation(value = "文档对比信息条款评论表-列表查询", notes = "文档对比信息条款评论表-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<SarFileCompareItemComment>> queryList() {
|
||||
List<SarFileCompareItemComment> list = sarFileCompareItemCommentService.queryList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param sarFileCompareItemComment
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款评论表-添加")
|
||||
@ApiOperation(value = "文档对比信息条款评论表-添加", notes = "文档对比信息条款评论表-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody SarFileCompareItemComment sarFileCompareItemComment) {
|
||||
sarFileCompareItemCommentService.add(sarFileCompareItemComment);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 一致评估
|
||||
* @param sarFileCompareItemComment
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "一致评估")
|
||||
@ApiOperation(value = "一致评估", notes = "一致评估")
|
||||
@PostMapping(value = "/consensusAssessment")
|
||||
public Result<?> consensusAssessment(@Validated @RequestBody SarFileCompareItemComment sarFileCompareItemComment) {
|
||||
sarFileCompareItemCommentService.consensusAssessment(sarFileCompareItemComment);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sarFileCompareItemComment
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款评论表-编辑")
|
||||
@ApiOperation(value = "文档对比信息条款评论表-编辑", notes = "文档对比信息条款评论表-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody SarFileCompareItemComment sarFileCompareItemComment) {
|
||||
sarFileCompareItemCommentService.editById(sarFileCompareItemComment);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款评论表-通过id删除")
|
||||
@ApiOperation(value = "文档对比信息条款评论表-通过id删除", notes = "文档对比信息条款评论表-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
sarFileCompareItemCommentService.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款评论表-批量删除")
|
||||
@ApiOperation(value = "文档对比信息条款评论表-批量删除", notes = "文档对比信息条款评论表-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.sarFileCompareItemCommentService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款评论表-通过id查询")
|
||||
@ApiOperation(value = "文档对比信息条款评论表-通过id查询", notes = "文档对比信息条款评论表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
SarFileCompareItemComment sarFileCompareItemComment = sarFileCompareItemCommentService.queryById(id);
|
||||
if (sarFileCompareItemComment == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(sarFileCompareItemComment);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询对比结果
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款评论表-查询对比结果")
|
||||
@ApiOperation(value = "文档对比信息条款评论表-查询对比结果", notes = "文档对比信息条款评论表-查询对比结果")
|
||||
@GetMapping(value = "/queryCompareResult")
|
||||
public Result<SarFileCompareResultVO> queryCompareResult(@RequestParam(name = "infoId", required = true) String infoId,
|
||||
@RequestParam(name = "comment", required = false) String comment) {
|
||||
SarFileCompareResultVO res = sarFileCompareItemCommentService.queryCompareResult(infoId,comment);
|
||||
return Result.OK(res);
|
||||
}
|
||||
|
||||
@AutoLog(value = "文档对比信息条款评论表-导出结果")
|
||||
@ApiOperation(value = "文档对比信息条款评论表-导出结果", notes = "文档对比信息条款评论表-导出结果")
|
||||
@GetMapping(value = "/exportResXls")
|
||||
public void exportResXls(@RequestParam(name = "infoId", required = true) String infoId,
|
||||
@RequestParam(name = "selectIds", required = true) String selectIds,
|
||||
@RequestParam(name = "includeComments", required = true) boolean includeComments,
|
||||
@RequestParam(name = "cut", required = true) String cut,
|
||||
HttpServletResponse response,HttpServletRequest request,
|
||||
@RequestParam(name = "comment", required = false) String comment) {
|
||||
sarFileCompareItemCommentService.exportResXls(request,response, infoId, selectIds, includeComments, cut,comment);
|
||||
}
|
||||
|
||||
}
|
||||
+183
@@ -0,0 +1,183 @@
|
||||
package com.jero.modules.compare.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.modules.compare.entity.SarFileCompareItem;
|
||||
import com.jero.modules.compare.service.ISarFileCompareItemService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息条款表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-02
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="文档对比信息条款表")
|
||||
@RestController
|
||||
@RequestMapping("/compare/sarFileCompareItem")
|
||||
@Slf4j
|
||||
public class SarFileCompareItemController extends JeroController<SarFileCompareItem, ISarFileCompareItemService> {
|
||||
@Autowired
|
||||
private ISarFileCompareItemService sarFileCompareItemService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param sarFileCompareItem
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款表-分页列表查询")
|
||||
@ApiOperation(value="文档对比信息条款表-分页列表查询", notes="文档对比信息条款表-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(SarFileCompareItem sarFileCompareItem,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<SarFileCompareItem> queryWrapper = QueryGenerator.initQueryWrapper(sarFileCompareItem, req.getParameterMap());
|
||||
Page<SarFileCompareItem> page = new Page<SarFileCompareItem>(pageNo, pageSize);
|
||||
IPage<SarFileCompareItem> pageList = sarFileCompareItemService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款表-列表查询")
|
||||
@ApiOperation(value="文档对比信息条款表-列表查询", notes="文档对比信息条款表-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<SarFileCompareItem>> queryList() {
|
||||
List<SarFileCompareItem> list = sarFileCompareItemService.queryList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param sarFileCompareItem
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款表-添加")
|
||||
@ApiOperation(value="文档对比信息条款表-添加", notes="文档对比信息条款表-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody SarFileCompareItem sarFileCompareItem) {
|
||||
sarFileCompareItemService.add(sarFileCompareItem);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sarFileCompareItem
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款表-编辑")
|
||||
@ApiOperation(value="文档对比信息条款表-编辑", notes="文档对比信息条款表-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody SarFileCompareItem sarFileCompareItem) {
|
||||
sarFileCompareItemService.editById(sarFileCompareItem);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款表-通过id删除")
|
||||
@ApiOperation(value="文档对比信息条款表-通过id删除", notes="文档对比信息条款表-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
sarFileCompareItemService.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款表-批量删除")
|
||||
@ApiOperation(value="文档对比信息条款表-批量删除", notes="文档对比信息条款表-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.sarFileCompareItemService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款表-通过id查询")
|
||||
@ApiOperation(value="文档对比信息条款表-通过id查询", notes="文档对比信息条款表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
SarFileCompareItem sarFileCompareItem = sarFileCompareItemService.queryById(id);
|
||||
if(sarFileCompareItem==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(sarFileCompareItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param sarFileCompareItem
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SarFileCompareItem sarFileCompareItem) {
|
||||
return super.exportXls(request, sarFileCompareItem, SarFileCompareItem.class, "文档对比信息条款表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SarFileCompareItem.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 条款对比高亮
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息条款表-条款对比高亮")
|
||||
@ApiOperation(value="文档对比信息条款表-条款对比高亮", notes="文档对比信息条款表-条款对比高亮")
|
||||
@GetMapping(value = "/clauseComparison")
|
||||
public Result<?> clauseComparison(@RequestParam(name="leftId",required=true) String leftId,
|
||||
@RequestParam(name="rightId",required=true) String rightId) {
|
||||
List<String> res = sarFileCompareItemService.clauseComparison(leftId,rightId);
|
||||
return Result.OK(res);
|
||||
}
|
||||
|
||||
}
|
||||
+171
@@ -0,0 +1,171 @@
|
||||
package com.jero.modules.compare.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.modules.compare.entity.SarFileCompareMenu;
|
||||
import com.jero.modules.compare.service.ISarFileCompareMenuService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息目录表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="文档对比信息目录表")
|
||||
@RestController
|
||||
@RequestMapping("/compare/sarFileCompareMenu")
|
||||
@Slf4j
|
||||
public class SarFileCompareMenuController extends JeroController<SarFileCompareMenu, ISarFileCompareMenuService> {
|
||||
@Autowired
|
||||
private ISarFileCompareMenuService sarFileCompareMenuService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param sarFileCompareMenu
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息目录表-分页列表查询")
|
||||
@ApiOperation(value="文档对比信息目录表-分页列表查询", notes="文档对比信息目录表-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(SarFileCompareMenu sarFileCompareMenu,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<SarFileCompareMenu> queryWrapper = QueryGenerator.initQueryWrapper(sarFileCompareMenu, req.getParameterMap());
|
||||
Page<SarFileCompareMenu> page = new Page<SarFileCompareMenu>(pageNo, pageSize);
|
||||
IPage<SarFileCompareMenu> pageList = sarFileCompareMenuService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息目录表-列表查询")
|
||||
@ApiOperation(value="文档对比信息目录表-列表查询", notes="文档对比信息目录表-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<SarFileCompareMenu>> queryList() {
|
||||
List<SarFileCompareMenu> list = sarFileCompareMenuService.queryList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param sarFileCompareMenu
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息目录表-添加")
|
||||
@ApiOperation(value="文档对比信息目录表-添加", notes="文档对比信息目录表-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody SarFileCompareMenu sarFileCompareMenu) {
|
||||
sarFileCompareMenuService.add(sarFileCompareMenu);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sarFileCompareMenu
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息目录表-编辑")
|
||||
@ApiOperation(value="文档对比信息目录表-编辑", notes="文档对比信息目录表-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody SarFileCompareMenu sarFileCompareMenu) {
|
||||
sarFileCompareMenuService.editById(sarFileCompareMenu);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息目录表-通过id删除")
|
||||
@ApiOperation(value="文档对比信息目录表-通过id删除", notes="文档对比信息目录表-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
sarFileCompareMenuService.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息目录表-批量删除")
|
||||
@ApiOperation(value="文档对比信息目录表-批量删除", notes="文档对比信息目录表-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.sarFileCompareMenuService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息目录表-通过id查询")
|
||||
@ApiOperation(value="文档对比信息目录表-通过id查询", notes="文档对比信息目录表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
SarFileCompareMenu sarFileCompareMenu = sarFileCompareMenuService.queryById(id);
|
||||
if(sarFileCompareMenu==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(sarFileCompareMenu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param sarFileCompareMenu
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SarFileCompareMenu sarFileCompareMenu) {
|
||||
return super.exportXls(request, sarFileCompareMenu, SarFileCompareMenu.class, "文档对比信息目录表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SarFileCompareMenu.class);
|
||||
}
|
||||
|
||||
}
|
||||
+186
@@ -0,0 +1,186 @@
|
||||
package com.jero.modules.compare.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.modules.compare.entity.SarFileCompareResComVO;
|
||||
import com.jero.modules.compare.entity.SarFileCompareResComment;
|
||||
import com.jero.modules.compare.service.ISarFileCompareResCommentService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息结果评论表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-05
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags = "文档对比信息结果评论表")
|
||||
@RestController
|
||||
@RequestMapping("/compare/sarFileCompareResComment")
|
||||
@Slf4j
|
||||
public class SarFileCompareResCommentController extends JeroController<SarFileCompareResComment, ISarFileCompareResCommentService> {
|
||||
@Autowired
|
||||
private ISarFileCompareResCommentService sarFileCompareResCommentService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param sarFileCompareResComment
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息结果评论表-分页列表查询")
|
||||
@ApiOperation(value = "文档对比信息结果评论表-分页列表查询", notes = "文档对比信息结果评论表-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(SarFileCompareResComment sarFileCompareResComment,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<SarFileCompareResComment> queryWrapper = QueryGenerator.initQueryWrapper(sarFileCompareResComment, req.getParameterMap());
|
||||
Page<SarFileCompareResComment> page = new Page<SarFileCompareResComment>(pageNo, pageSize);
|
||||
IPage<SarFileCompareResComment> pageList = sarFileCompareResCommentService.page(page, queryWrapper);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息结果评论表-列表查询")
|
||||
@ApiOperation(value = "文档对比信息结果评论表-列表查询", notes = "文档对比信息结果评论表-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<SarFileCompareResComment>> queryList() {
|
||||
List<SarFileCompareResComment> list = sarFileCompareResCommentService.queryList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param sarFileCompareResComment
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息结果评论表-添加")
|
||||
@ApiOperation(value = "文档对比信息结果评论表-添加", notes = "文档对比信息结果评论表-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody SarFileCompareResComment sarFileCompareResComment) {
|
||||
sarFileCompareResCommentService.add(sarFileCompareResComment);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sarFileCompareResComment
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息结果评论表-编辑")
|
||||
@ApiOperation(value = "文档对比信息结果评论表-编辑", notes = "文档对比信息结果评论表-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody SarFileCompareResComment sarFileCompareResComment) {
|
||||
sarFileCompareResCommentService.editById(sarFileCompareResComment);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息结果评论表-通过id删除")
|
||||
@ApiOperation(value = "文档对比信息结果评论表-通过id删除", notes = "文档对比信息结果评论表-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
|
||||
sarFileCompareResCommentService.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息结果评论表-批量删除")
|
||||
@ApiOperation(value = "文档对比信息结果评论表-批量删除", notes = "文档对比信息结果评论表-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
|
||||
this.sarFileCompareResCommentService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息结果评论表-通过id查询")
|
||||
@ApiOperation(value = "文档对比信息结果评论表-通过id查询", notes = "文档对比信息结果评论表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
SarFileCompareResComment sarFileCompareResComment = sarFileCompareResCommentService.queryById(id);
|
||||
if (sarFileCompareResComment == null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(sarFileCompareResComment);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param sarFileCompareResComment
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, SarFileCompareResComment sarFileCompareResComment) {
|
||||
return super.exportXls(request, sarFileCompareResComment, SarFileCompareResComment.class, "文档对比信息结果评论表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, SarFileCompareResComment.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据infoId查询列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档对比信息结果评论表-根据infoId查询列表")
|
||||
@ApiOperation(value = "文档对比信息结果评论表-根据infoId查询列表", notes = "文档对比信息结果评论表-根据infoId查询列表")
|
||||
@GetMapping(value = "/queryListByInfoId")
|
||||
public Result<List<SarFileCompareResComVO>> queryListByInfoId(@RequestParam(name = "id", required = true) String id,
|
||||
@RequestParam(name = "str") String str) {
|
||||
List<SarFileCompareResComVO> list = sarFileCompareResCommentService.queryListByInfoId(id, str);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
}
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
package com.jero.modules.compare.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SarFileCompareDetailVO {
|
||||
|
||||
private String InfoId;
|
||||
private String serialNumberLeft;
|
||||
private String fileNameLeft;
|
||||
private String serialNumberRight;
|
||||
private String fileNameRight;
|
||||
private String remark;
|
||||
private String comments;
|
||||
private List<SarFileCompareMenuVo> menuLeft;
|
||||
private List<SarFileCompareItem> textLeft;
|
||||
private List<SarFileCompareMenuVo> menuRight;
|
||||
private List<SarFileCompareItem> textRight;
|
||||
|
||||
public String getInfoId() {
|
||||
return InfoId;
|
||||
}
|
||||
|
||||
public void setInfoId(String infoId) {
|
||||
InfoId = infoId;
|
||||
}
|
||||
|
||||
public String getSerialNumberLeft() {
|
||||
return serialNumberLeft;
|
||||
}
|
||||
|
||||
public void setSerialNumberLeft(String serialNumberLeft) {
|
||||
this.serialNumberLeft = serialNumberLeft;
|
||||
}
|
||||
|
||||
public String getFileNameLeft() {
|
||||
return fileNameLeft;
|
||||
}
|
||||
|
||||
public void setFileNameLeft(String fileNameLeft) {
|
||||
this.fileNameLeft = fileNameLeft;
|
||||
}
|
||||
|
||||
public String getSerialNumberRight() {
|
||||
return serialNumberRight;
|
||||
}
|
||||
|
||||
public void setSerialNumberRight(String serialNumberRight) {
|
||||
this.serialNumberRight = serialNumberRight;
|
||||
}
|
||||
|
||||
public String getFileNameRight() {
|
||||
return fileNameRight;
|
||||
}
|
||||
|
||||
public void setFileNameRight(String fileNameRight) {
|
||||
this.fileNameRight = fileNameRight;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
public String getComments() {
|
||||
return comments;
|
||||
}
|
||||
|
||||
public void setComments(String comments) {
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
public List<SarFileCompareItem> getTextLeft() {
|
||||
return textLeft;
|
||||
}
|
||||
|
||||
public void setTextLeft(List<SarFileCompareItem> textLeft) {
|
||||
this.textLeft = textLeft;
|
||||
}
|
||||
|
||||
public void addTextLeft(SarFileCompareItem text) {
|
||||
if (this.textLeft == null) {
|
||||
this.textLeft = new ArrayList<>();
|
||||
}
|
||||
this.textLeft.add(text);
|
||||
}
|
||||
|
||||
public List<SarFileCompareItem> getTextRight() {
|
||||
return textRight;
|
||||
}
|
||||
|
||||
public void setTextRight(List<SarFileCompareItem> textRight) {
|
||||
this.textRight = textRight;
|
||||
}
|
||||
|
||||
public void addTextRight(SarFileCompareItem text) {
|
||||
if (this.textRight == null) {
|
||||
this.textRight = new ArrayList<>();
|
||||
}
|
||||
this.textRight.add(text);
|
||||
}
|
||||
|
||||
public List<SarFileCompareMenuVo> getMenuLeft() {
|
||||
return menuLeft;
|
||||
}
|
||||
|
||||
public void setMenuLeft(List<SarFileCompareMenuVo> menuLeft) {
|
||||
this.menuLeft = menuLeft;
|
||||
}
|
||||
|
||||
public void addMenuLeft(SarFileCompareMenuVo menu) {
|
||||
if (this.menuLeft == null) {
|
||||
this.menuLeft = new ArrayList<>();
|
||||
}
|
||||
this.menuLeft.add(menu);
|
||||
}
|
||||
|
||||
public List<SarFileCompareMenuVo> getMenuRight() {
|
||||
return menuRight;
|
||||
}
|
||||
|
||||
public void setMenuRight(List<SarFileCompareMenuVo> menuRight) {
|
||||
this.menuRight = menuRight;
|
||||
}
|
||||
|
||||
public void addMenuRight(SarFileCompareMenuVo menu) {
|
||||
if (this.menuRight == null) {
|
||||
this.menuRight = new ArrayList<>();
|
||||
}
|
||||
this.menuRight.add(menu);
|
||||
}
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
package com.jero.modules.compare.entity;
|
||||
|
||||
public class SarFileCompareExcelMergeCell {
|
||||
|
||||
Integer leftStart;
|
||||
Integer leftEnd;
|
||||
Integer rightStart;
|
||||
Integer rightEnd;
|
||||
|
||||
public Integer getLeftStart() {
|
||||
return leftStart;
|
||||
}
|
||||
|
||||
public void setLeftStart(Integer leftStart) {
|
||||
this.leftStart = leftStart;
|
||||
}
|
||||
|
||||
public Integer getLeftEnd() {
|
||||
return leftEnd;
|
||||
}
|
||||
|
||||
public void setLeftEnd(Integer leftEnd) {
|
||||
this.leftEnd = leftEnd;
|
||||
}
|
||||
|
||||
public Integer getRightStart() {
|
||||
return rightStart;
|
||||
}
|
||||
|
||||
public void setRightStart(Integer rightStart) {
|
||||
this.rightStart = rightStart;
|
||||
}
|
||||
|
||||
public Integer getRightEnd() {
|
||||
return rightEnd;
|
||||
}
|
||||
|
||||
public void setRightEnd(Integer rightEnd) {
|
||||
this.rightEnd = rightEnd;
|
||||
}
|
||||
|
||||
public SarFileCompareExcelMergeCell() {
|
||||
}
|
||||
|
||||
public SarFileCompareExcelMergeCell(Integer leftStart, Integer leftEnd, Integer rightStart, Integer rightEnd) {
|
||||
this.leftStart = leftStart;
|
||||
this.leftEnd = leftEnd;
|
||||
this.rightStart = rightStart;
|
||||
this.rightEnd = rightEnd;
|
||||
}
|
||||
}
|
||||
+141
@@ -0,0 +1,141 @@
|
||||
package com.jero.modules.compare.entity;
|
||||
|
||||
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 io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
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: 文档对比信息表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-04
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sar_file_compare_info")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="sar_file_compare_info对象", description="文档对比信息表")
|
||||
public class SarFileCompareInfo implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
|
||||
/**文档1*/
|
||||
@Excel(name = "文档1", width = 15)
|
||||
@ApiModelProperty(value = "文档1")
|
||||
private String fileIdLeft;
|
||||
|
||||
/**文档key1*/
|
||||
@Excel(name = "文档key1", width = 15)
|
||||
@ApiModelProperty(value = "文档key1")
|
||||
private String fileKeyLeft;
|
||||
|
||||
/**编号1*/
|
||||
@Excel(name = "编号1", width = 15)
|
||||
@ApiModelProperty(value = "编号1")
|
||||
private String serialNumberLeft;
|
||||
|
||||
/**标题1*/
|
||||
@Excel(name = "标题1", width = 15)
|
||||
@ApiModelProperty(value = "标题1")
|
||||
private String titleLeft;
|
||||
|
||||
/**文本状态1*/
|
||||
@Excel(name = "文本状态1", width = 15)
|
||||
@ApiModelProperty(value = "文本状态1")
|
||||
private String fileTypeLeft;
|
||||
|
||||
/**文件名称1*/
|
||||
@Excel(name = "文件名称1", width = 15)
|
||||
@ApiModelProperty(value = "文件名称1")
|
||||
private String fileNameLeft;
|
||||
|
||||
/**文档2*/
|
||||
@Excel(name = "文档2", width = 15)
|
||||
@ApiModelProperty(value = "文档2")
|
||||
private String fileIdRight;
|
||||
|
||||
/**文档key2*/
|
||||
@Excel(name = "文档key2", width = 15)
|
||||
@ApiModelProperty(value = "文档key2")
|
||||
private String fileKeyRight;
|
||||
|
||||
/**编号2*/
|
||||
@Excel(name = "编号2", width = 15)
|
||||
@ApiModelProperty(value = "编号2")
|
||||
private String serialNumberRight;
|
||||
|
||||
/**标题2*/
|
||||
@Excel(name = "标题2", width = 15)
|
||||
@ApiModelProperty(value = "标题2")
|
||||
private String titleRight;
|
||||
|
||||
/**文本状态2*/
|
||||
@Excel(name = "文本状态2", width = 15)
|
||||
@ApiModelProperty(value = "文本状态2")
|
||||
private String fileTypeRight;
|
||||
|
||||
/**文件名称2*/
|
||||
@Excel(name = "文件名称2", width = 15)
|
||||
@ApiModelProperty(value = "文件名称2")
|
||||
private String fileNameRight;
|
||||
|
||||
/**发布状态*/
|
||||
@Excel(name = "发布状态", width = 15)
|
||||
@ApiModelProperty(value = "发布状态")
|
||||
private String releaseState;
|
||||
|
||||
/**发布状态-翻译后*/
|
||||
@TableField(exist = false)
|
||||
private String releaseStateTitle;
|
||||
|
||||
/**备注*/
|
||||
@Excel(name = "备注", width = 15)
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remark;
|
||||
|
||||
/**评论*/
|
||||
@Excel(name = "评论", width = 15)
|
||||
@ApiModelProperty(value = "评论")
|
||||
private String comments;
|
||||
|
||||
}
|
||||
+106
@@ -0,0 +1,106 @@
|
||||
package com.jero.modules.compare.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
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: 文档对比信息条款表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-06
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sar_file_compare_item")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="sar_file_compare_item对象", description="文档对比信息条款表")
|
||||
public class SarFileCompareItem implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
|
||||
/**文档对比信息id*/
|
||||
@Excel(name = "文档对比信息id", width = 15)
|
||||
@ApiModelProperty(value = "文档对比信息id")
|
||||
private String infoId;
|
||||
|
||||
/**目录id*/
|
||||
@Excel(name = "目录id", width = 15)
|
||||
@ApiModelProperty(value = "目录id")
|
||||
private String menuId;
|
||||
|
||||
/**条款名称*/
|
||||
@Excel(name = "条款名称", width = 15)
|
||||
@ApiModelProperty(value = "条款名称")
|
||||
private String itemsName;
|
||||
|
||||
/**条款编号*/
|
||||
@Excel(name = "条款编号", width = 15)
|
||||
@ApiModelProperty(value = "条款编号")
|
||||
private String itemsNum;
|
||||
|
||||
/**条款正文*/
|
||||
@Excel(name = "条款正文", width = 15)
|
||||
@ApiModelProperty(value = "条款正文")
|
||||
private String itemsText;
|
||||
|
||||
/**条款展示编号*/
|
||||
@Excel(name = "条款展示编号", width = 15)
|
||||
@ApiModelProperty(value = "条款展示编号")
|
||||
private Integer itemsDisplayNum;
|
||||
|
||||
/**对应相似条目*/
|
||||
@Excel(name = "对应相似条目", width = 15)
|
||||
@ApiModelProperty(value = "对应相似条目")
|
||||
private Integer targetStand;
|
||||
|
||||
/**条款位置*/
|
||||
@Excel(name = "条款位置", width = 15)
|
||||
@ApiModelProperty(value = "条款位置")
|
||||
private String leftOrRight;
|
||||
|
||||
/**是否被评论(0或1)*/
|
||||
@Excel(name = "是否被评论(0或1)", width = 15)
|
||||
@ApiModelProperty(value = "是否被评论(0或1)")
|
||||
private Integer reviewed;
|
||||
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
package com.jero.modules.compare.entity;
|
||||
|
||||
/**
|
||||
* 对比条目评论信息展示
|
||||
*/
|
||||
public class SarFileCompareItemComVO {
|
||||
private String id;
|
||||
private String itemsNameLeft;
|
||||
private String itemsNumLeft;
|
||||
private String itemsTextLeft;
|
||||
private String itemsNameRight;
|
||||
private String itemsNumRight;
|
||||
private String itemsTextRight;
|
||||
private String comment;
|
||||
|
||||
public SarFileCompareItemComVO() {
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getItemsNameLeft() {
|
||||
return itemsNameLeft;
|
||||
}
|
||||
|
||||
public void setItemsNameLeft(String itemsNameLeft) {
|
||||
this.itemsNameLeft = itemsNameLeft;
|
||||
}
|
||||
|
||||
public String getItemsNumLeft() {
|
||||
return itemsNumLeft;
|
||||
}
|
||||
|
||||
public void setItemsNumLeft(String itemsNumLeft) {
|
||||
this.itemsNumLeft = itemsNumLeft;
|
||||
}
|
||||
|
||||
public String getItemsTextLeft() {
|
||||
return itemsTextLeft;
|
||||
}
|
||||
|
||||
public void setItemsTextLeft(String itemsTextLeft) {
|
||||
this.itemsTextLeft = itemsTextLeft;
|
||||
}
|
||||
|
||||
public String getItemsNameRight() {
|
||||
return itemsNameRight;
|
||||
}
|
||||
|
||||
public void setItemsNameRight(String itemsNameRight) {
|
||||
this.itemsNameRight = itemsNameRight;
|
||||
}
|
||||
|
||||
public String getItemsNumRight() {
|
||||
return itemsNumRight;
|
||||
}
|
||||
|
||||
public void setItemsNumRight(String itemsNumRight) {
|
||||
this.itemsNumRight = itemsNumRight;
|
||||
}
|
||||
|
||||
public String getItemsTextRight() {
|
||||
return itemsTextRight;
|
||||
}
|
||||
|
||||
public void setItemsTextRight(String itemsTextRight) {
|
||||
this.itemsTextRight = itemsTextRight;
|
||||
}
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
}
|
||||
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package com.jero.modules.compare.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
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: 文档对比信息条款评论表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-05
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sar_file_compare_item_comment")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="sar_file_compare_item_comment对象", description="文档对比信息条款评论表")
|
||||
public class SarFileCompareItemComment implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
|
||||
/**文档对比信息id*/
|
||||
@Excel(name = "文档对比信息id", width = 15)
|
||||
@ApiModelProperty(value = "文档对比信息id")
|
||||
private String infoId;
|
||||
|
||||
/**条款id左*/
|
||||
@Excel(name = "条款id左", width = 15)
|
||||
@ApiModelProperty(value = "条款id左")
|
||||
private String itemsIdLeft;
|
||||
|
||||
/**条款id右*/
|
||||
@Excel(name = "条款id右", width = 15)
|
||||
@ApiModelProperty(value = "条款id右")
|
||||
private String itemsIdRight;
|
||||
|
||||
/**评论*/
|
||||
@Excel(name = "评论", width = 15)
|
||||
@ApiModelProperty(value = "评论")
|
||||
private String comment;
|
||||
|
||||
}
|
||||
+122
@@ -0,0 +1,122 @@
|
||||
package com.jero.modules.compare.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
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.Date;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息目录表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-04
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sar_file_compare_menu")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="sar_file_compare_menu对象", description="文档对比信息目录表")
|
||||
public class SarFileCompareMenu implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private Date createTime;
|
||||
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private Date updateTime;
|
||||
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
|
||||
/**目录ID*/
|
||||
@Excel(name = "目录ID", width = 15)
|
||||
@ApiModelProperty(value = "目录ID")
|
||||
private String menuId;
|
||||
|
||||
/**信息ID*/
|
||||
@Excel(name = "信息ID", width = 15)
|
||||
@ApiModelProperty(value = "信息ID")
|
||||
private String infoId;
|
||||
|
||||
/**目录名称*/
|
||||
@Excel(name = "目录名称", width = 15)
|
||||
@ApiModelProperty(value = "目录名称")
|
||||
private String name;
|
||||
|
||||
/**父级目录ID*/
|
||||
@Excel(name = "父级目录ID", width = 15)
|
||||
@ApiModelProperty(value = "父级目录ID")
|
||||
private String parentId;
|
||||
|
||||
/**排序序号*/
|
||||
@Excel(name = "排序序号", width = 15)
|
||||
@ApiModelProperty(value = "排序序号")
|
||||
private Integer displaySeq;
|
||||
|
||||
/**目录位置*/
|
||||
@Excel(name = "目录位置", width = 15)
|
||||
@ApiModelProperty(value = "目录位置")
|
||||
private String leftOrRight;
|
||||
|
||||
/**条款名称*/
|
||||
@Excel(name = "条款名称", width = 15)
|
||||
@ApiModelProperty(value = "条款名称")
|
||||
private String itemName;
|
||||
|
||||
/**备注*/
|
||||
@Excel(name = "备注", width = 15)
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remarks;
|
||||
|
||||
public SarFileCompareMenu(String id, String createBy, Date createTime, String updateBy, Date updateTime, String sysOrgCode, String menuId, String infoId, String name, String parentId, Integer displaySeq, String leftOrRight, String itemName, String remarks) {
|
||||
this.id = id;
|
||||
this.createBy = createBy;
|
||||
this.createTime = createTime;
|
||||
this.updateBy = updateBy;
|
||||
this.updateTime = updateTime;
|
||||
this.sysOrgCode = sysOrgCode;
|
||||
this.menuId = menuId;
|
||||
this.infoId = infoId;
|
||||
this.name = name;
|
||||
this.parentId = parentId;
|
||||
this.displaySeq = displaySeq;
|
||||
this.leftOrRight = leftOrRight;
|
||||
this.itemName = itemName;
|
||||
this.remarks = remarks;
|
||||
}
|
||||
|
||||
public SarFileCompareMenu() {
|
||||
|
||||
}
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
package com.jero.modules.compare.entity;
|
||||
|
||||
import com.jero.modules.system.util.MyStringUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SarFileCompareMenuVo extends SarFileCompareMenu {
|
||||
private String key;
|
||||
private String title;
|
||||
|
||||
private List<SarFileCompareMenuVo> children;
|
||||
|
||||
public SarFileCompareMenuVo(SarFileCompareMenu menu) {
|
||||
super();
|
||||
this.setId(menu.getId());
|
||||
this.setCreateBy(menu.getCreateBy());
|
||||
this.setCreateTime(menu.getCreateTime());
|
||||
this.setUpdateBy(menu.getUpdateBy());
|
||||
this.setUpdateTime(menu.getUpdateTime());
|
||||
this.setSysOrgCode(menu.getSysOrgCode());
|
||||
this.setMenuId(menu.getMenuId());
|
||||
this.setInfoId(menu.getInfoId());
|
||||
this.setName(menu.getName());
|
||||
this.setParentId(menu.getParentId());
|
||||
this.setDisplaySeq(menu.getDisplaySeq());
|
||||
this.setLeftOrRight(menu.getLeftOrRight());
|
||||
this.setItemName(menu.getItemName());
|
||||
this.setKey(menu.getId());
|
||||
this.setTitle(menu.getName());
|
||||
if(MyStringUtils.isNoneBlank(menu.getItemName())){
|
||||
this.setTitle(menu.getName() + menu.getItemName());
|
||||
}
|
||||
this.setRemarks(menu.getRemarks());
|
||||
}
|
||||
|
||||
public List<SarFileCompareMenuVo> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<SarFileCompareMenuVo> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public void addChild(SarFileCompareMenuVo child) {
|
||||
if (null == this.children) {
|
||||
this.children = new ArrayList<>();
|
||||
}
|
||||
children.add(child);
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
package com.jero.modules.compare.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SarFileCompareResComVO {
|
||||
private String id;
|
||||
private String name;
|
||||
private String createTime;
|
||||
private String content;
|
||||
private List<SarFileCompareResComVO> resComVoList;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public List<SarFileCompareResComVO> getResComVoList() {
|
||||
return resComVoList;
|
||||
}
|
||||
|
||||
public void setResComVoList(List<SarFileCompareResComVO> resComVoList) {
|
||||
this.resComVoList = resComVoList;
|
||||
}
|
||||
|
||||
public void addResComVo(SarFileCompareResComVO resComVo) {
|
||||
if (null == this.resComVoList) {
|
||||
this.resComVoList = new ArrayList<>();
|
||||
}
|
||||
this.resComVoList.add(resComVo);
|
||||
}
|
||||
}
|
||||
+76
@@ -0,0 +1,76 @@
|
||||
package com.jero.modules.compare.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
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: 文档对比信息结果评论表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-05
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("sar_file_compare_res_comment")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="sar_file_compare_res_comment对象", description="文档对比信息结果评论表")
|
||||
public class SarFileCompareResComment implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private java.util.Date createTime;
|
||||
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private java.util.Date updateTime;
|
||||
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
|
||||
/**文档对比信息id*/
|
||||
@Excel(name = "文档对比信息id", width = 15)
|
||||
@ApiModelProperty(value = "文档对比信息id")
|
||||
private String infoId;
|
||||
|
||||
/**回复评论ID*/
|
||||
@Excel(name = "回复评论ID", width = 15)
|
||||
@ApiModelProperty(value = "回复评论ID")
|
||||
private String parentId;
|
||||
|
||||
/**评论*/
|
||||
@Excel(name = "评论", width = 15)
|
||||
@ApiModelProperty(value = "评论")
|
||||
private String comment;
|
||||
|
||||
}
|
||||
+99
@@ -0,0 +1,99 @@
|
||||
package com.jero.modules.compare.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class SarFileCompareResultVO {
|
||||
|
||||
private String infoId;
|
||||
private String serialNumberLeft;
|
||||
private String fileNameLeft;
|
||||
private String fileIdLeft;
|
||||
private String serialNumberRight;
|
||||
private String fileNameRight;
|
||||
private String fileIdRight;
|
||||
private List<SarFileCompareItemComVO> resList;
|
||||
private String comments;
|
||||
|
||||
public SarFileCompareResultVO() {
|
||||
}
|
||||
|
||||
public String getInfoId() {
|
||||
return infoId;
|
||||
}
|
||||
|
||||
public void setInfoId(String infoId) {
|
||||
this.infoId = infoId;
|
||||
}
|
||||
|
||||
public String getSerialNumberLeft() {
|
||||
return serialNumberLeft;
|
||||
}
|
||||
|
||||
public void setSerialNumberLeft(String serialNumberLeft) {
|
||||
this.serialNumberLeft = serialNumberLeft;
|
||||
}
|
||||
|
||||
public String getFileNameLeft() {
|
||||
return fileNameLeft;
|
||||
}
|
||||
|
||||
public void setFileNameLeft(String fileNameLeft) {
|
||||
this.fileNameLeft = fileNameLeft;
|
||||
}
|
||||
|
||||
public String getSerialNumberRight() {
|
||||
return serialNumberRight;
|
||||
}
|
||||
|
||||
public void setSerialNumberRight(String serialNumberRight) {
|
||||
this.serialNumberRight = serialNumberRight;
|
||||
}
|
||||
|
||||
public String getFileNameRight() {
|
||||
return fileNameRight;
|
||||
}
|
||||
|
||||
public void setFileNameRight(String fileNameRight) {
|
||||
this.fileNameRight = fileNameRight;
|
||||
}
|
||||
|
||||
public List<SarFileCompareItemComVO> getResList() {
|
||||
return resList;
|
||||
}
|
||||
|
||||
public void setResList(List<SarFileCompareItemComVO> resList) {
|
||||
this.resList = resList;
|
||||
}
|
||||
|
||||
public void addRes(SarFileCompareItemComVO item) {
|
||||
if (this.resList == null) {
|
||||
this.resList = new ArrayList<>();
|
||||
}
|
||||
this.resList.add(item);
|
||||
}
|
||||
|
||||
public String getComments() {
|
||||
return comments;
|
||||
}
|
||||
|
||||
public void setComments(String comments) {
|
||||
this.comments = comments;
|
||||
}
|
||||
|
||||
public String getFileIdLeft() {
|
||||
return fileIdLeft;
|
||||
}
|
||||
|
||||
public void setFileIdLeft(String fileIdLeft) {
|
||||
this.fileIdLeft = fileIdLeft;
|
||||
}
|
||||
|
||||
public String getFileIdRight() {
|
||||
return fileIdRight;
|
||||
}
|
||||
|
||||
public void setFileIdRight(String fileIdRight) {
|
||||
this.fileIdRight = fileIdRight;
|
||||
}
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.jero.modules.compare.enums;
|
||||
|
||||
public enum AssessConsistencyEnum {
|
||||
|
||||
SAME("一致"),
|
||||
DIFFERENT("差异");
|
||||
|
||||
private String value;
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
AssessConsistencyEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.jero.modules.compare.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jero.modules.compare.entity.SarFileCompareInfo;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-04
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SarFileCompareInfoMapper extends BaseMapper<SarFileCompareInfo> {
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.jero.modules.compare.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jero.modules.compare.entity.SarFileCompareItemComment;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息条款评论表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-05
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SarFileCompareItemCommentMapper extends BaseMapper<SarFileCompareItemComment> {
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.jero.modules.compare.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jero.modules.compare.entity.SarFileCompareItem;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息条款表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-04
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SarFileCompareItemMapper extends BaseMapper<SarFileCompareItem> {
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.jero.modules.compare.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jero.modules.compare.entity.SarFileCompareMenu;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息目录表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SarFileCompareMenuMapper extends BaseMapper<SarFileCompareMenu> {
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.jero.modules.compare.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jero.modules.compare.entity.SarFileCompareResComment;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息结果评论表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-05
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface SarFileCompareResCommentMapper extends BaseMapper<SarFileCompareResComment> {
|
||||
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jero.modules.compare.mapper.SarFileCompareInfoMapper">
|
||||
<resultMap id="SarFileCompareInfoResultMap" type="com.jero.modules.compare.entity.SarFileCompareInfo">
|
||||
<id column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="sys_org_code" property="sysOrgCode" />
|
||||
<result column="file_id_left" property="fileIdLeft" />
|
||||
<result column="file_key_left" property="fileKeyLeft" />
|
||||
<result column="serial_number_left" property="serialNumberLeft" />
|
||||
<result column="title_left" property="titleLeft" />
|
||||
<result column="file_type_left" property="fileTypeLeft" />
|
||||
<result column="file_name_left" property="fileNameLeft" />
|
||||
<result column="file_id_right" property="fileIdRight" />
|
||||
<result column="file_key_right" property="fileKeyRight" />
|
||||
<result column="serial_number_right" property="serialNumberRight" />
|
||||
<result column="title_right" property="titleRight" />
|
||||
<result column="file_type_right" property="fileTypeRight" />
|
||||
<result column="file_name_right" property="fileNameRight" />
|
||||
<result column="release_state" property="releaseState" />
|
||||
<result column="remark" property="remark" />
|
||||
<result column="comments" property="comments" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jero.modules.compare.mapper.SarFileCompareItemCommentMapper">
|
||||
<resultMap id="SarFileCompareItemCommentResultMap" type="com.jero.modules.compare.entity.SarFileCompareItemComment">
|
||||
<id column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="sys_org_code" property="sysOrgCode" />
|
||||
<result column="info_id" property="infoId" />
|
||||
<result column="items_id_left" property="itemsIdLeft" />
|
||||
<result column="items_id_right" property="itemsIdRight" />
|
||||
<result column="comment" property="comment" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jero.modules.compare.mapper.SarFileCompareItemMapper">
|
||||
<resultMap id="SarFileCompareItemResultMap" type="com.jero.modules.compare.entity.SarFileCompareItem">
|
||||
<id column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="sys_org_code" property="sysOrgCode" />
|
||||
<result column="info_id" property="infoId" />
|
||||
<result column="menu_id" property="menuId" />
|
||||
<result column="items_name" property="itemsName" />
|
||||
<result column="items_num" property="itemsNum" />
|
||||
<result column="items_text" property="itemsText" />
|
||||
<result column="items_display_num" property="itemsDisplayNum" />
|
||||
<result column="target_stand" property="targetStand" />
|
||||
<result column="left_or_right" property="leftOrRight" />
|
||||
<result column="remark" property="remark" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jero.modules.compare.mapper.SarFileCompareMenuMapper">
|
||||
<resultMap id="SarFileCompareMenuResultMap" type="com.jero.modules.compare.entity.SarFileCompareMenu">
|
||||
<id column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="sys_org_code" property="sysOrgCode" />
|
||||
<result column="menu_id" property="menuId" />
|
||||
<result column="info_id" property="infoId" />
|
||||
<result column="name" property="name" />
|
||||
<result column="parent_id" property="parentId" />
|
||||
<result column="display_seq" property="displaySeq" />
|
||||
<result column="left_or_right" property="leftOrRight" />
|
||||
<result column="item_name" property="itemName" />
|
||||
<result column="remarks" property="remarks" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jero.modules.compare.mapper.SarFileCompareResCommentMapper">
|
||||
<resultMap id="SarFileCompareResCommentResultMap" type="com.jero.modules.compare.entity.SarFileCompareResComment">
|
||||
<id column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_by" property="updateBy" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="sys_org_code" property="sysOrgCode" />
|
||||
<result column="info_id" property="infoId" />
|
||||
<result column="parent_id" property="parentId" />
|
||||
<result column="comment" property="comment" />
|
||||
</resultMap>
|
||||
</mapper>
|
||||
+81
@@ -0,0 +1,81 @@
|
||||
package com.jero.modules.compare.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.modules.compare.entity.SarFileCompareDetailVO;
|
||||
import com.jero.modules.compare.entity.SarFileCompareInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-02
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISarFileCompareInfoService extends IService<SarFileCompareInfo> {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param sarFileCompareInfo
|
||||
* @return
|
||||
*/
|
||||
void add(SarFileCompareInfo sarFileCompareInfo);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param sarFileCompareInfo
|
||||
* @return
|
||||
*/
|
||||
void editById(SarFileCompareInfo sarFileCompareInfo);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
SarFileCompareInfo queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<SarFileCompareInfo> queryList();
|
||||
|
||||
/**
|
||||
* 发起全文对比
|
||||
*
|
||||
* @param leftStandard
|
||||
* @param rightStandard
|
||||
* @param remark
|
||||
* @return
|
||||
*/
|
||||
String fullTextComparison(String leftStandard, String rightStandard, String remark) throws Exception;
|
||||
|
||||
/**
|
||||
* 求对比详情
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
SarFileCompareDetailVO getComparisonDetail(String id);
|
||||
}
|
||||
+71
@@ -0,0 +1,71 @@
|
||||
package com.jero.modules.compare.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.modules.compare.entity.SarFileCompareItemComment;
|
||||
import com.jero.modules.compare.entity.SarFileCompareResultVO;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息条款评论表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-05
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISarFileCompareItemCommentService extends IService<SarFileCompareItemComment> {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param sarFileCompareItemComment
|
||||
* @return
|
||||
*/
|
||||
void add(SarFileCompareItemComment sarFileCompareItemComment);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param sarFileCompareItemComment
|
||||
* @return
|
||||
*/
|
||||
void editById(SarFileCompareItemComment sarFileCompareItemComment);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
SarFileCompareItemComment queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<SarFileCompareItemComment> queryList();
|
||||
|
||||
SarFileCompareResultVO queryCompareResult(String infoId,String comment);
|
||||
|
||||
void exportResXls(HttpServletRequest request,HttpServletResponse response, String infoId, String selectIds, boolean includeComments, String cut,String comment);
|
||||
|
||||
void consensusAssessment(SarFileCompareItemComment sarFileCompareItemComment);
|
||||
}
|
||||
+75
@@ -0,0 +1,75 @@
|
||||
package com.jero.modules.compare.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.modules.compare.entity.SarFileCompareItem;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息条款表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-02
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISarFileCompareItemService extends IService<SarFileCompareItem> {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param sarFileCompareItem
|
||||
* @return
|
||||
*/
|
||||
void add(SarFileCompareItem sarFileCompareItem);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param sarFileCompareItem
|
||||
* @return
|
||||
*/
|
||||
void editById(SarFileCompareItem sarFileCompareItem);
|
||||
|
||||
/**
|
||||
* 标记被评论过
|
||||
* @param id
|
||||
*/
|
||||
void updateReviewedById(String id);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
SarFileCompareItem queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<SarFileCompareItem> queryList();
|
||||
|
||||
List<SarFileCompareItem> queryListByInfoId(String infoId);
|
||||
|
||||
Map<String, SarFileCompareItem> queryMapByInfoId(String infoId);
|
||||
|
||||
List<String> clauseComparison(String lid,String rid);
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
package com.jero.modules.compare.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.modules.compare.entity.SarFileCompareMenu;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息目录表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISarFileCompareMenuService extends IService<SarFileCompareMenu> {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param sarFileCompareMenu
|
||||
* @return
|
||||
*/
|
||||
void add(SarFileCompareMenu sarFileCompareMenu);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param sarFileCompareMenu
|
||||
* @return
|
||||
*/
|
||||
void editById(SarFileCompareMenu sarFileCompareMenu);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
SarFileCompareMenu queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<SarFileCompareMenu> queryList();
|
||||
|
||||
|
||||
List<SarFileCompareMenu> queryListByInfoId(String infoId);
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package com.jero.modules.compare.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.modules.compare.entity.SarFileCompareResComVO;
|
||||
import com.jero.modules.compare.entity.SarFileCompareResComment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息结果评论表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-05
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface ISarFileCompareResCommentService extends IService<SarFileCompareResComment> {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param sarFileCompareResComment
|
||||
* @return
|
||||
*/
|
||||
void add(SarFileCompareResComment sarFileCompareResComment);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param sarFileCompareResComment
|
||||
* @return
|
||||
*/
|
||||
void editById(SarFileCompareResComment sarFileCompareResComment);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
SarFileCompareResComment queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<SarFileCompareResComment> queryList();
|
||||
|
||||
List<SarFileCompareResComVO> queryListByInfoId(String id, String str);
|
||||
|
||||
}
|
||||
+323
@@ -0,0 +1,323 @@
|
||||
package com.jero.modules.compare.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.modules.compare.entity.*;
|
||||
import com.jero.modules.compare.mapper.SarFileCompareInfoMapper;
|
||||
import com.jero.modules.compare.service.ISarFileCompareInfoService;
|
||||
import com.jero.modules.compare.service.ISarFileCompareItemService;
|
||||
import com.jero.modules.compare.service.ISarFileCompareMenuService;
|
||||
import com.jero.modules.compare.utils.CompHanLPUtils;
|
||||
import com.jero.modules.compare.utils.CompareConst;
|
||||
import com.jero.modules.docTranslation.enums.ReleaseConditionEnum;
|
||||
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
|
||||
import com.jero.modules.split.entity.SarFileSplitInfoEO;
|
||||
import com.jero.modules.split.entity.SarFileSplitItemsEO;
|
||||
import com.jero.modules.split.entity.SarFileSplitMenuEO;
|
||||
import com.jero.modules.split.service.IFileSplitItemsEOService;
|
||||
import com.jero.modules.split.service.ISarFileSplitInfoService;
|
||||
import com.jero.modules.split.service.ISarFileSplitMenuEOService;
|
||||
import com.jero.modules.system.util.MyStringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-02
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class SarFileCompareInfoServiceImpl extends ServiceImpl<SarFileCompareInfoMapper, SarFileCompareInfo> implements ISarFileCompareInfoService {
|
||||
|
||||
@Autowired
|
||||
private ISarFileSplitMenuEOService sarFileSplitMenuEOService;
|
||||
|
||||
@Autowired
|
||||
private IFileSplitItemsEOService sarFileSplitItemsEOService;
|
||||
|
||||
@Autowired
|
||||
private ISarFileSplitInfoService sarFileSplitInfoEOService;
|
||||
|
||||
@Autowired
|
||||
private ISarFileCompareItemService sarFileCompareItemService;
|
||||
|
||||
@Autowired
|
||||
private ISarFileCompareMenuService sarFileCompareMenuService;
|
||||
|
||||
@Autowired
|
||||
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
|
||||
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param sarFileCompareInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(SarFileCompareInfo sarFileCompareInfo) {
|
||||
Date now = new Date();
|
||||
sarFileCompareInfo.setCreateTime(now);
|
||||
sarFileCompareInfo.setUpdateTime(now);
|
||||
save(sarFileCompareInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param sarFileCompareInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void editById(SarFileCompareInfo sarFileCompareInfo) {
|
||||
Date now = new Date();
|
||||
sarFileCompareInfo.setUpdateTime(now);
|
||||
saveOrUpdate(sarFileCompareInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SarFileCompareInfo queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SarFileCompareInfo> queryList() {
|
||||
return list();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 全文对比
|
||||
*
|
||||
* @param leftStandard
|
||||
* @param rightStandard
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public String fullTextComparison(String leftStandard, String rightStandard, String remark) throws Exception {
|
||||
SarFileCompareInfo sfcInfo = addStandCompareHis(leftStandard, rightStandard, remark);
|
||||
//文档对比信息目录
|
||||
List<SarFileSplitMenuEO> leftMenuEOList = sarFileSplitMenuEOService.queryByInfoId(leftStandard);
|
||||
Map<String, SarFileCompareMenu> leftMenuMap = wrapperMenuMap(leftMenuEOList, sfcInfo.getId(), CompareConst.POS_LEFT);
|
||||
sarFileCompareMenuService.saveBatch(leftMenuMap.values());
|
||||
List<SarFileSplitMenuEO> rightMenuEOList = sarFileSplitMenuEOService.queryByInfoId(rightStandard);
|
||||
Map<String, SarFileCompareMenu> rightMenuMap = wrapperMenuMap(rightMenuEOList, sfcInfo.getId(), CompareConst.POS_RIGHT);
|
||||
sarFileCompareMenuService.saveBatch(rightMenuMap.values());
|
||||
//文档对比信息条款
|
||||
List<SarFileSplitItemsEO> leftItemEOList = sarFileSplitItemsEOService.selectByInfoId(leftStandard);
|
||||
List<SarFileCompareItem> leftItemList = wrapperItemList(leftItemEOList, sfcInfo.getId(), leftMenuMap, CompareConst.POS_LEFT);
|
||||
List<SarFileSplitItemsEO> rightItemEOList = sarFileSplitItemsEOService.selectByInfoId(rightStandard);
|
||||
List<SarFileCompareItem> rightItemList = wrapperItemList(rightItemEOList, sfcInfo.getId(), rightMenuMap, CompareConst.POS_RIGHT);
|
||||
|
||||
if (!leftItemList.isEmpty() && !rightItemList.isEmpty()) {
|
||||
//双重循环找到相似度最高的条款做关联
|
||||
for (int i = 0; i < leftItemList.size(); i++) {
|
||||
String leftTxt = leftItemList.get(i).getItemsText();
|
||||
//初始化 假设未找到相似条目
|
||||
leftItemList.get(i).setTargetStand(-1);
|
||||
//定义初始化的相似度
|
||||
double compareSimilarity = 0.0;
|
||||
if (null != leftTxt && !leftTxt.isEmpty()) {
|
||||
for (int j = 0; j < rightItemList.size(); j++) {
|
||||
if(null == rightItemList.get(j).getTargetStand()){
|
||||
rightItemList.get(j).setTargetStand(-1);
|
||||
}
|
||||
String rightTxt = rightItemList.get(j).getItemsText();
|
||||
if (null != rightTxt && !rightTxt.isEmpty()) {
|
||||
double similarity = CompHanLPUtils.findSimilarity(leftTxt.trim(), rightTxt.trim());
|
||||
//如果相似度超过0.6 并且该相似度比之前的相似度还高,那么该条款目前相似度最高
|
||||
if (similarity >= 0.6 && compareSimilarity < similarity) {
|
||||
compareSimilarity = similarity;
|
||||
leftItemList.get(i).setTargetStand(j);
|
||||
}
|
||||
}
|
||||
if (j >= rightItemList.size() - 1) {
|
||||
int ts = leftItemList.get(i).getTargetStand();
|
||||
if (ts > -1) {
|
||||
rightItemList.get(ts).setTargetStand(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
sarFileCompareItemService.saveBatch(leftItemList);
|
||||
sarFileCompareItemService.saveBatch(rightItemList);
|
||||
return sfcInfo.getId();
|
||||
}
|
||||
|
||||
|
||||
private Map<String, SarFileCompareMenu> wrapperMenuMap(List<SarFileSplitMenuEO> list, String infoId, String leftOrRight) {
|
||||
Map<String, SarFileCompareMenu> resMap = new HashMap<>();
|
||||
for (SarFileSplitMenuEO meo : list) {
|
||||
SarFileCompareMenu sfcMenu = new SarFileCompareMenu();
|
||||
sfcMenu.setInfoId(infoId);
|
||||
sfcMenu.setMenuId(meo.getId());
|
||||
sfcMenu.setName(meo.getName());
|
||||
sfcMenu.setItemName(meo.getItemName());
|
||||
sfcMenu.setParentId(meo.getPId());
|
||||
sfcMenu.setDisplaySeq(meo.getDisplaySeq().intValue());
|
||||
sfcMenu.setRemarks(meo.getRemarks());
|
||||
sfcMenu.setLeftOrRight(leftOrRight);
|
||||
resMap.put(sfcMenu.getMenuId(), sfcMenu);
|
||||
}
|
||||
return resMap;
|
||||
}
|
||||
|
||||
private List<SarFileCompareItem> wrapperItemList(List<SarFileSplitItemsEO> list, String infoId, Map<String, SarFileCompareMenu> menuMap, String leftOrRight) {
|
||||
List<SarFileCompareItem> resList = new ArrayList<>();
|
||||
for (SarFileSplitItemsEO itemsEO : list) {
|
||||
SarFileCompareItem item = new SarFileCompareItem();
|
||||
item.setInfoId(infoId);
|
||||
item.setItemsName(itemsEO.getItemsName());
|
||||
item.setMenuId(itemsEO.getMenuId());
|
||||
item.setItemsNum(itemsEO.getItemsNum());
|
||||
item.setItemsText(itemsEO.getItermsConditions());
|
||||
SarFileCompareMenu menu = menuMap.get(itemsEO.getMenuId());
|
||||
if (menu != null) {
|
||||
item.setItemsDisplayNum(menu.getDisplaySeq());
|
||||
}
|
||||
item.setLeftOrRight(leftOrRight);
|
||||
item.setReviewed(CompareConst.NO_REVIEWED);
|
||||
resList.add(item);
|
||||
}
|
||||
Collections.sort(resList, Comparator.comparingInt(SarFileCompareItem::getItemsDisplayNum));
|
||||
return resList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 保存比对历史
|
||||
*
|
||||
* @param leftStandId
|
||||
* @param rightStandId
|
||||
* @param remark
|
||||
* @throws Exception
|
||||
*/
|
||||
public SarFileCompareInfo addStandCompareHis(String leftStandId, String rightStandId, String remark) throws Exception {
|
||||
SarFileSplitInfoEO leftInfo = sarFileSplitInfoEOService.queryById(leftStandId);
|
||||
SarFileSplitInfoEO rightInfo = sarFileSplitInfoEOService.queryById(rightStandId);
|
||||
//保存标准比对历史表数据
|
||||
SarFileCompareInfo sarFileCompareInfo = new SarFileCompareInfo();
|
||||
String id = UUID.randomUUID().toString();
|
||||
sarFileCompareInfo.setId(id);
|
||||
sarFileCompareInfo.setFileIdLeft(leftInfo.getFileId());
|
||||
// 处理文档库id字段 根据编号和标题查询
|
||||
List<Map<String, Object>> bussDocumentLibraryEOList = bussDocumentLibraryEOService.getListBySerialNumber(leftInfo.getSerialNumber());
|
||||
if (CollectionUtil.isNotEmpty(bussDocumentLibraryEOList)) {
|
||||
sarFileCompareInfo.setFileKeyLeft(bussDocumentLibraryEOList.get(0).get("id").toString());
|
||||
}
|
||||
sarFileCompareInfo.setFileNameLeft(leftInfo.getFileName());
|
||||
sarFileCompareInfo.setTitleLeft(leftInfo.getTitle());
|
||||
sarFileCompareInfo.setFileTypeLeft(leftInfo.getFileType());
|
||||
sarFileCompareInfo.setSerialNumberLeft(leftInfo.getSerialNumber());
|
||||
|
||||
sarFileCompareInfo.setFileIdRight(rightInfo.getFileId());
|
||||
// 处理文档库id字段 根据编号和标题查询
|
||||
List<Map<String, Object>> bussDocumentLibraryEOList1 = bussDocumentLibraryEOService.getListBySerialNumber(rightInfo.getSerialNumber());
|
||||
if (CollectionUtil.isNotEmpty(bussDocumentLibraryEOList1)) {
|
||||
sarFileCompareInfo.setFileKeyRight(bussDocumentLibraryEOList1.get(0).get("id").toString());
|
||||
}
|
||||
sarFileCompareInfo.setFileKeyRight(rightInfo.getConnectId());
|
||||
sarFileCompareInfo.setFileNameRight(rightInfo.getFileName());
|
||||
sarFileCompareInfo.setFileTypeRight(rightInfo.getFileType());
|
||||
sarFileCompareInfo.setTitleRight(rightInfo.getTitle());
|
||||
sarFileCompareInfo.setSerialNumberRight(rightInfo.getSerialNumber());
|
||||
|
||||
sarFileCompareInfo.setReleaseState(ReleaseConditionEnum.DRAFT.getValue());
|
||||
sarFileCompareInfo.setRemark(remark);
|
||||
this.add(sarFileCompareInfo);
|
||||
return sarFileCompareInfo;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SarFileCompareDetailVO getComparisonDetail(String id) {
|
||||
SarFileCompareDetailVO sfVo = new SarFileCompareDetailVO();
|
||||
SarFileCompareInfo sfcInfo = this.queryById(id);
|
||||
sfVo.setInfoId(id);
|
||||
sfVo.setFileNameLeft(sfcInfo.getFileNameLeft());
|
||||
sfVo.setFileNameRight(sfcInfo.getFileNameRight());
|
||||
sfVo.setSerialNumberLeft(sfcInfo.getSerialNumberLeft());
|
||||
sfVo.setSerialNumberRight(sfcInfo.getSerialNumberRight());
|
||||
sfVo.setRemark(sfcInfo.getRemark());
|
||||
sfVo.setComments(sfcInfo.getComments());
|
||||
List<SarFileCompareMenu> menuList = sarFileCompareMenuService.queryListByInfoId(id);
|
||||
for (SarFileCompareMenu menu : menuList) {
|
||||
if (MyStringUtils.isBlank(menu.getParentId()) || "General catalogue".equals(menu.getName()) || "General Catalogue".equals(menu.getName())) {
|
||||
if (menu.getLeftOrRight().equals(CompareConst.POS_LEFT)) {
|
||||
SarFileCompareMenuVo menuLeft = new SarFileCompareMenuVo(menu);
|
||||
menuLeft.setChildren(getMenuChildren(menuList, CompareConst.POS_LEFT, menuLeft.getMenuId()));
|
||||
sfVo.addMenuLeft(menuLeft);
|
||||
} else if (menu.getLeftOrRight().equals(CompareConst.POS_RIGHT)) {
|
||||
SarFileCompareMenuVo menuRight = new SarFileCompareMenuVo(menu);
|
||||
menuRight.setChildren(getMenuChildren(menuList, CompareConst.POS_RIGHT, menuRight.getMenuId()));
|
||||
sfVo.addMenuRight(menuRight);
|
||||
}
|
||||
}
|
||||
if (sfVo.getMenuRight() != null && sfVo.getMenuRight().size() > 0 && sfVo.getMenuLeft() != null && sfVo.getMenuLeft().size() > 0) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
List<SarFileCompareItem> itemList = sarFileCompareItemService.queryListByInfoId(id);
|
||||
for (SarFileCompareItem item : itemList) {
|
||||
if (item.getLeftOrRight().equals(CompareConst.POS_LEFT)) {
|
||||
sfVo.addTextLeft(item);
|
||||
} else if (item.getLeftOrRight().equals(CompareConst.POS_RIGHT)) {
|
||||
sfVo.addTextRight(item);
|
||||
}
|
||||
}
|
||||
return sfVo;
|
||||
}
|
||||
|
||||
private List<SarFileCompareMenuVo> getMenuChildren(List<SarFileCompareMenu> menuList, String leftOrRight, String pid) {
|
||||
List<SarFileCompareMenuVo> list = new ArrayList<>();
|
||||
for (SarFileCompareMenu menu : menuList) {
|
||||
if (menu.getLeftOrRight().equals(leftOrRight) && menu.getParentId() != null && menu.getParentId().equals(pid)) {
|
||||
SarFileCompareMenuVo menuVO = new SarFileCompareMenuVo(menu);
|
||||
menuVO.setChildren(getMenuChildren(menuList, leftOrRight, menuVO.getMenuId()));
|
||||
list.add(menuVO);
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+672
@@ -0,0 +1,672 @@
|
||||
package com.jero.modules.compare.service.impl;
|
||||
|
||||
import com.aliyuncs.utils.IOUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.util.MinioUtil;
|
||||
import com.jero.modules.compare.entity.*;
|
||||
import com.jero.modules.compare.enums.AssessConsistencyEnum;
|
||||
import com.jero.modules.compare.mapper.SarFileCompareItemCommentMapper;
|
||||
import com.jero.modules.compare.service.ISarFileCompareInfoService;
|
||||
import com.jero.modules.compare.service.ISarFileCompareItemCommentService;
|
||||
import com.jero.modules.compare.service.ISarFileCompareItemService;
|
||||
import com.jero.modules.compare.utils.ConvertHtml2Excel;
|
||||
import com.jero.modules.system.util.MyStringUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.poi.common.usermodel.HyperlinkType;
|
||||
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
|
||||
import org.apache.poi.hssf.usermodel.HSSFFont;
|
||||
import org.apache.poi.hssf.usermodel.HSSFPatriarch;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.hssf.util.HSSFColor;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.*;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息条款评论表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-05
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class SarFileCompareItemCommentServiceImpl extends ServiceImpl<SarFileCompareItemCommentMapper, SarFileCompareItemComment> implements ISarFileCompareItemCommentService {
|
||||
|
||||
@Autowired
|
||||
private ISarFileCompareInfoService sarFileCompareInfoServiceImpl;
|
||||
|
||||
@Autowired
|
||||
private ISarFileCompareItemService SarFileCompareItemServiceImpl;
|
||||
|
||||
@Value("${jero.path.upload}")
|
||||
private String filePath;
|
||||
@Value("${jero.path.uploadCos}")
|
||||
private String filePathCos;
|
||||
@Value("${jero.splitUrl}")
|
||||
private String splitUrl;
|
||||
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param sarFileCompareItemComment
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(SarFileCompareItemComment sarFileCompareItemComment) {
|
||||
Date now = new Date();
|
||||
sarFileCompareItemComment.setCreateTime(now);
|
||||
sarFileCompareItemComment.setUpdateTime(now);
|
||||
save(sarFileCompareItemComment);
|
||||
String itemIdLeft = sarFileCompareItemComment.getItemsIdLeft();
|
||||
SarFileCompareItemServiceImpl.updateReviewedById(sarFileCompareItemComment.getItemsIdLeft());
|
||||
SarFileCompareItemServiceImpl.updateReviewedById(sarFileCompareItemComment.getItemsIdRight());
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param sarFileCompareItemComment
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void editById(SarFileCompareItemComment sarFileCompareItemComment) {
|
||||
SarFileCompareItemComment ic = queryById(sarFileCompareItemComment.getId());
|
||||
Date now = new Date();
|
||||
ic.setUpdateTime(now);
|
||||
ic.setComment(sarFileCompareItemComment.getComment());
|
||||
saveOrUpdate(ic);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
//删除时需要判断左侧跟右侧是否还有评论,如果没有,将对应的reviewed改为0
|
||||
String itemsIdLeft;
|
||||
String itemsIdRight;
|
||||
SarFileCompareItemComment sarFileCompareItemComment = queryById(id);
|
||||
itemsIdLeft = sarFileCompareItemComment.getItemsIdLeft();
|
||||
itemsIdRight = sarFileCompareItemComment.getItemsIdRight();
|
||||
removeById(id);
|
||||
|
||||
QueryWrapper<SarFileCompareItemComment> left = new QueryWrapper<>();
|
||||
left.eq("items_id_left", itemsIdLeft);
|
||||
if (baseMapper.selectCount(left) == 0) {
|
||||
SarFileCompareItem sarFileCompareItem = SarFileCompareItemServiceImpl.queryById(itemsIdLeft);
|
||||
sarFileCompareItem.setReviewed(0);
|
||||
SarFileCompareItemServiceImpl.saveOrUpdate(sarFileCompareItem);
|
||||
}
|
||||
QueryWrapper<SarFileCompareItemComment> right = new QueryWrapper<>();
|
||||
right.eq("items_id_right", itemsIdRight);
|
||||
if (baseMapper.selectCount(right) == 0) {
|
||||
SarFileCompareItem sarFileCompareItem = SarFileCompareItemServiceImpl.queryById(itemsIdRight);
|
||||
sarFileCompareItem.setReviewed(0);
|
||||
SarFileCompareItemServiceImpl.saveOrUpdate(sarFileCompareItem);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SarFileCompareItemComment queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SarFileCompareItemComment> queryList() {
|
||||
return list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public SarFileCompareResultVO queryCompareResult(String infoId,String comment) {
|
||||
SarFileCompareResultVO resultVO = new SarFileCompareResultVO();
|
||||
SarFileCompareInfo sfcInfo = sarFileCompareInfoServiceImpl.queryById(infoId);
|
||||
resultVO.setInfoId(infoId);
|
||||
resultVO.setSerialNumberLeft(sfcInfo.getSerialNumberLeft());
|
||||
resultVO.setFileNameLeft(sfcInfo.getFileNameLeft());
|
||||
resultVO.setFileIdLeft(sfcInfo.getFileIdLeft());
|
||||
resultVO.setSerialNumberRight(sfcInfo.getSerialNumberRight());
|
||||
resultVO.setFileNameRight(sfcInfo.getFileNameRight());
|
||||
resultVO.setFileIdRight(sfcInfo.getFileIdRight());
|
||||
resultVO.setComments(sfcInfo.getComments());
|
||||
|
||||
List<SarFileCompareItemComment> list = queryListByInfoId(infoId,comment);
|
||||
Map<String, SarFileCompareItem> sfcItemMap = SarFileCompareItemServiceImpl.queryMapByInfoId(infoId);
|
||||
for (SarFileCompareItemComment sfcItemCom : list) {
|
||||
SarFileCompareItemComVO itemComVO = new SarFileCompareItemComVO();
|
||||
itemComVO.setId(sfcItemCom.getId());
|
||||
itemComVO.setComment(sfcItemCom.getComment());
|
||||
String itemIdLeft = sfcItemCom.getItemsIdLeft();
|
||||
if (!MyStringUtils.isEmpty(itemIdLeft)) {
|
||||
SarFileCompareItem sfcItem = sfcItemMap.get(itemIdLeft);
|
||||
if (null != sfcItem) {
|
||||
itemComVO.setItemsNameLeft(sfcItem.getItemsName());
|
||||
itemComVO.setItemsNumLeft(sfcItem.getItemsNum());
|
||||
itemComVO.setItemsTextLeft(sfcItem.getItemsText());
|
||||
}
|
||||
}
|
||||
String itemIdRight = sfcItemCom.getItemsIdRight();
|
||||
if (!MyStringUtils.isEmpty(itemIdRight)) {
|
||||
SarFileCompareItem sfcItem = sfcItemMap.get(itemIdRight);
|
||||
if (null != sfcItem) {
|
||||
itemComVO.setItemsNameRight(sfcItem.getItemsName());
|
||||
itemComVO.setItemsNumRight(sfcItem.getItemsNum());
|
||||
itemComVO.setItemsTextRight(sfcItem.getItemsText());
|
||||
}
|
||||
}
|
||||
resultVO.addRes(itemComVO);
|
||||
}
|
||||
return resultVO;
|
||||
|
||||
}
|
||||
|
||||
public List<SarFileCompareItemComment> queryListByInfoId(String infoId,String comment) {
|
||||
LambdaQueryWrapper<SarFileCompareItemComment> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (ObjectUtils.isNotEmpty(comment)) {
|
||||
if (AssessConsistencyEnum.SAME.getValue().equals(comment)) {
|
||||
queryWrapper.eq(SarFileCompareItemComment::getComment, comment);
|
||||
} else if (AssessConsistencyEnum.DIFFERENT.getValue().equals(comment)) {
|
||||
queryWrapper.ne(SarFileCompareItemComment::getComment, AssessConsistencyEnum.SAME.getValue());
|
||||
}
|
||||
}
|
||||
queryWrapper.eq(SarFileCompareItemComment::getInfoId, infoId);
|
||||
queryWrapper.orderBy(true, true, SarFileCompareItemComment::getCreateTime);
|
||||
List<SarFileCompareItemComment> list = this.list(queryWrapper);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exportResXls(HttpServletRequest request,HttpServletResponse response, String infoId, String selectIds, boolean includeComments, String cut,String comment) {
|
||||
List<SarFileCompareItemComment> list = null;
|
||||
if (includeComments && MyStringUtils.isEmpty(selectIds)) {
|
||||
//只导出全文评论的情况
|
||||
list = new ArrayList<>();
|
||||
} else {
|
||||
LambdaQueryWrapper<SarFileCompareItemComment> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SarFileCompareItemComment::getInfoId, infoId);
|
||||
if (!MyStringUtils.isEmpty(selectIds)) {
|
||||
queryWrapper.in(SarFileCompareItemComment::getId, Arrays.asList(selectIds.split(",")));
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(comment)) {
|
||||
if (AssessConsistencyEnum.SAME.getValue().equals(comment)) {
|
||||
queryWrapper.eq(SarFileCompareItemComment::getComment, comment);
|
||||
} else if (AssessConsistencyEnum.DIFFERENT.getValue().equals(comment)) {
|
||||
queryWrapper.ne(SarFileCompareItemComment::getComment, AssessConsistencyEnum.SAME.getValue());
|
||||
}
|
||||
}
|
||||
queryWrapper.orderBy(true, true, SarFileCompareItemComment::getCreateTime);
|
||||
list = this.list(queryWrapper);
|
||||
}
|
||||
Map<String, SarFileCompareItem> sfcItemMap = SarFileCompareItemServiceImpl.queryMapByInfoId(infoId);
|
||||
|
||||
SarFileCompareInfo sarFileCompareInfo = sarFileCompareInfoServiceImpl.queryById(infoId);
|
||||
|
||||
OutputStream os = null;
|
||||
Workbook workbook = new HSSFWorkbook();
|
||||
log.info("-------------- workbook创建成功 -----------------");
|
||||
//在本地创建图片文件夹
|
||||
log.info("-------------- 在本地创建图片文件夹 -----------------");
|
||||
String dir = filePath + File.separator + UUID.randomUUID().toString().replace("-", "");
|
||||
File dirFile = new File(dir);
|
||||
if (dirFile.exists()){
|
||||
dirFile.delete();
|
||||
}
|
||||
dirFile.mkdirs();
|
||||
log.info("-------------- 文件夹创建成功:"+ dirFile.getAbsolutePath() +" -----------------");
|
||||
try {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String fileName = "导出对比结果 " + sdf.format(new Date()) + ".xlsx";
|
||||
response.setHeader("Content-Disposition", "attachment; filename=" + fileName);
|
||||
response.setContentType("application/force-download");
|
||||
//创建工作表对象
|
||||
String sheetName = "对比结果";
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
sheetName = "对比结果";
|
||||
} else {
|
||||
sheetName = "Comparing results";
|
||||
}
|
||||
Sheet sheet = workbook.createSheet(sheetName);
|
||||
HSSFPatriarch patriarch = (HSSFPatriarch) sheet.createDrawingPatriarch();
|
||||
// 创建头部
|
||||
String header = "";
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
header = "所选标准,条款号,条款名称,条款内容,所选标准,条款号,条款名称,条款内容,评论";
|
||||
} else {
|
||||
header = "Selected Standard,Number,Title,Content,Selected Standard,Number,Title,Content,Comment";
|
||||
}
|
||||
int[] columnWidth = {5000,5000, 5000, 10000, 5000,5000, 5000, 10000, 10000};
|
||||
CellStyle cellStyle = workbook.createCellStyle();//初始化单元格格式对象
|
||||
cellStyle.setAlignment(HorizontalAlignment.LEFT);
|
||||
cellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
cellStyle.setWrapText(true);
|
||||
Row rowHeader = sheet.createRow(0);//开始创建标题行
|
||||
if (MyStringUtils.isNotBlank(header)) {
|
||||
String[] headerArr = header.split(",");
|
||||
for (int i = 0; i < headerArr.length; i++) {
|
||||
rowHeader.createCell(i).setCellValue(headerArr[i]);
|
||||
sheet.setColumnWidth(i, columnWidth[i]);
|
||||
}
|
||||
}
|
||||
//超链接样式
|
||||
CellStyle cellStyleLink =workbook.createCellStyle();
|
||||
HSSFFont font = ((HSSFWorkbook) workbook).createFont();
|
||||
font.setColor(HSSFColor.HSSFColorPredefined.LIGHT_BLUE.getIndex());
|
||||
cellStyleLink.setFont(font);
|
||||
cellStyleLink.setWrapText(true);
|
||||
int i = 1;
|
||||
//记录需要合并的单元格
|
||||
List<SarFileCompareExcelMergeCell> mergeCells = new ArrayList<>();
|
||||
for (SarFileCompareItemComment itemComment : list) {
|
||||
SarFileCompareExcelMergeCell sarFileCompareExcelMergeCell = new SarFileCompareExcelMergeCell();
|
||||
String[] leftSplit = null;
|
||||
String[] rightSplit = null;
|
||||
Row row = sheet.createRow(i);
|
||||
row.createCell(0).setCellValue(sarFileCompareInfo == null ? "" : sarFileCompareInfo.getTitleLeft() + " " + sarFileCompareInfo.getFileNameLeft());
|
||||
row.createCell(4).setCellValue(sarFileCompareInfo == null ? "" : sarFileCompareInfo.getTitleRight() + " " + sarFileCompareInfo.getFileNameRight());
|
||||
String itemIdLeft = itemComment.getItemsIdLeft();
|
||||
if (!MyStringUtils.isEmpty(itemIdLeft)) {
|
||||
SarFileCompareItem itemLeft = sfcItemMap.get(itemIdLeft);
|
||||
if (null != itemLeft) {
|
||||
row.createCell(1).setCellValue(itemLeft.getItemsNum());
|
||||
row.createCell(2).setCellValue(itemLeft.getItemsName());
|
||||
String text = itemLeft.getItemsText();
|
||||
if (MyStringUtils.isNotEmpty(text)){
|
||||
log.info("-------------- 开始开始拆分左侧图片、文字、表格 :" + text + "-----------------");
|
||||
String rowDataAndPath = getSplitContent(request, text);
|
||||
log.info("-------------- 左侧图片、文字、表格 拆分成功 :"+ rowDataAndPath +"-----------------");
|
||||
leftSplit = rowDataAndPath.split("---");
|
||||
if (leftSplit.length > 1) {
|
||||
for (int j = 0; j < leftSplit.length; j++) {
|
||||
if (ObjectUtils.isNotEmpty(leftSplit[j])) {
|
||||
ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
|
||||
if (j > 0) {
|
||||
Row row2 = sheet.getRow(j + i);
|
||||
if (ObjectUtils.isEmpty(row2)) {
|
||||
row2 = sheet.createRow(j + i);
|
||||
}
|
||||
log.info("-------------- 开始开始处理左侧图片、表格 -----------------");
|
||||
handleSpecificData(workbook, dir, patriarch, cellStyleLink, byteArrayOut, row2, i, j, leftSplit[j], 3);
|
||||
log.info("-------------- 左侧图片、表格 处理成功 -----------------");
|
||||
} else {
|
||||
log.info("-------------- 开始开始处理左侧图片、表格 -----------------");
|
||||
handleSpecificData(workbook, dir, patriarch, cellStyleLink, byteArrayOut, row, i, j, leftSplit[j], 3);
|
||||
log.info("-------------- 左侧图片、表格 处理成功 -----------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
sarFileCompareExcelMergeCell.setLeftStart(i);
|
||||
sarFileCompareExcelMergeCell.setLeftEnd(i + leftSplit.length - 1);
|
||||
sarFileCompareExcelMergeCell.setRightStart(0);
|
||||
sarFileCompareExcelMergeCell.setRightEnd(0);
|
||||
mergeCells.add(sarFileCompareExcelMergeCell);
|
||||
} else {
|
||||
row.createCell(3).setCellValue(rowDataAndPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
String itemIdRight = itemComment.getItemsIdRight();
|
||||
if (!MyStringUtils.isEmpty(itemIdRight)) {
|
||||
SarFileCompareItem itemRight = sfcItemMap.get(itemIdRight);
|
||||
if (null != itemRight) {
|
||||
row.createCell(5).setCellValue(itemRight.getItemsNum());
|
||||
row.createCell(6).setCellValue(itemRight.getItemsName());
|
||||
String text = itemRight.getItemsText();
|
||||
if (MyStringUtils.isNotEmpty(text)) {
|
||||
log.info("-------------- 开始开始拆分右侧图片、文字、表格 :"+ text +" -----------------");
|
||||
String rowDataAndPath = getSplitContent(request, text);
|
||||
log.info("-------------- 右侧图片、文字、表格 拆分成功 :"+ rowDataAndPath +" -----------------");
|
||||
rightSplit = rowDataAndPath.split("---");
|
||||
if (rightSplit.length > 1) {
|
||||
for (int j = 0; j < rightSplit.length; j++) {
|
||||
if (ObjectUtils.isNotEmpty(rightSplit[j])) {
|
||||
ByteArrayOutputStream byteArrayOut = new ByteArrayOutputStream();
|
||||
if (j > 0) {
|
||||
Row row2 = sheet.getRow(j + i);
|
||||
if (ObjectUtils.isEmpty(row2)) {
|
||||
row2 = sheet.createRow(j + i);
|
||||
}
|
||||
log.info("-------------- 开始处理右侧图片、表格 -----------------");
|
||||
handleSpecificData(workbook, dir, patriarch, cellStyleLink, byteArrayOut, row2, i, j, rightSplit[j], 7);
|
||||
log.info("-------------- 右侧图片、表格 处理成功 -----------------");
|
||||
} else {
|
||||
log.info("-------------- 开始处理右侧图片、表格 -----------------");
|
||||
handleSpecificData(workbook, dir, patriarch, cellStyleLink, byteArrayOut, row, i, j, rightSplit[j], 7);
|
||||
log.info("-------------- 右侧图片、表格 处理成功 -----------------");
|
||||
}
|
||||
}
|
||||
}
|
||||
sarFileCompareExcelMergeCell.setRightStart(i);
|
||||
sarFileCompareExcelMergeCell.setRightEnd(i + rightSplit.length - 1);
|
||||
mergeCells.add(sarFileCompareExcelMergeCell);
|
||||
} else {
|
||||
row.createCell(7).setCellValue(rowDataAndPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
row.createCell(8).setCellValue(itemComment.getComment());
|
||||
row.setRowStyle(cellStyle);
|
||||
for (int j = 0; j < 9; j++) {
|
||||
Cell cell = row.getCell(j);
|
||||
if (null != cell) {
|
||||
cell.setCellStyle(cellStyle);
|
||||
}
|
||||
}
|
||||
int left_length = ObjectUtils.isEmpty(leftSplit) ? 0 : leftSplit.length;
|
||||
int right_length = ObjectUtils.isEmpty(rightSplit) ? 0 : rightSplit.length;
|
||||
i = left_length > right_length ? i + left_length : i + right_length;
|
||||
}
|
||||
if (includeComments || MyStringUtils.isEmpty(selectIds)) {
|
||||
Row row = sheet.createRow(i);
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
row.createCell(0).setCellValue("全文评论");
|
||||
} else {
|
||||
row.createCell(0).setCellValue("The full text comments");
|
||||
}
|
||||
//合并单元格
|
||||
CellRangeAddress rangeAddress = new CellRangeAddress(row.getRowNum(), row.getRowNum(), 1, 6);
|
||||
sheet.addMergedRegion(rangeAddress);
|
||||
SarFileCompareInfo compareInfo = sarFileCompareInfoServiceImpl.queryById(infoId);
|
||||
row.createCell(1).setCellValue(compareInfo.getComments());
|
||||
row.getCell(1).setCellStyle(cellStyle);
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(mergeCells)) {
|
||||
log.info("-------------- 开始处理需要合并的单元格 -----------------");
|
||||
Set<SarFileCompareExcelMergeCell> mergeCellSet = new HashSet<>(mergeCells);
|
||||
for (SarFileCompareExcelMergeCell mergeCell : mergeCellSet) {
|
||||
Integer leftCount = 0;
|
||||
if (ObjectUtils.isNotEmpty(mergeCell.getLeftEnd())&&ObjectUtils.isNotEmpty(mergeCell.getLeftStart())) {
|
||||
leftCount = mergeCell.getLeftEnd() - mergeCell.getLeftStart() + 1;
|
||||
}
|
||||
Integer rightCount = 0;
|
||||
if (ObjectUtils.isNotEmpty(mergeCell.getRightEnd())&&ObjectUtils.isNotEmpty(mergeCell.getRightStart())) {
|
||||
rightCount = mergeCell.getRightEnd() - mergeCell.getRightStart() + 1;
|
||||
}
|
||||
Integer start = leftCount - rightCount >= 0 ? mergeCell.getLeftStart() : mergeCell.getRightStart();
|
||||
log.info("-------------- 合并开始行数:" + start + " -----------------");
|
||||
Integer end = leftCount - rightCount >= 0 ? mergeCell.getLeftEnd() : mergeCell.getRightEnd();
|
||||
log.info("-------------- 合并结束行数: " + end + " -----------------");
|
||||
//合并
|
||||
if (ObjectUtils.isNotEmpty(start)&&ObjectUtils.isNotEmpty(end)) {
|
||||
CellRangeAddress region0 = new CellRangeAddress(start, end, 0, 0);
|
||||
sheet.addMergedRegion(region0);
|
||||
CellRangeAddress region1 = new CellRangeAddress(start, end, 1, 1);
|
||||
sheet.addMergedRegion(region1);
|
||||
CellRangeAddress region2 = new CellRangeAddress(start, end, 2, 2);
|
||||
sheet.addMergedRegion(region2);
|
||||
CellRangeAddress region4 = new CellRangeAddress(start, end, 4, 4);
|
||||
sheet.addMergedRegion(region4);
|
||||
CellRangeAddress region5 = new CellRangeAddress(start, end, 5, 5);
|
||||
sheet.addMergedRegion(region5);
|
||||
CellRangeAddress region6 = new CellRangeAddress(start, end, 6, 6);
|
||||
sheet.addMergedRegion(region6);
|
||||
CellRangeAddress region7 = new CellRangeAddress(start, end, 8, 8);
|
||||
sheet.addMergedRegion(region7);
|
||||
}
|
||||
|
||||
}
|
||||
log.info("-------------- 单元格合并成功 -----------------");
|
||||
}
|
||||
|
||||
|
||||
os = response.getOutputStream();
|
||||
workbook.write(os);
|
||||
os.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
throw new JeroBootException("下载文件失败");
|
||||
} else {
|
||||
throw new JeroBootException("Failed to download file");
|
||||
}
|
||||
} finally {
|
||||
IOUtils.closeQuietly(os);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理图片跟表格类型的数据
|
||||
* @param workbook
|
||||
* @param dir
|
||||
* @param patriarch
|
||||
* @param cellStyleLink
|
||||
* @param byteArrayOut
|
||||
* @param row
|
||||
* @param i
|
||||
* @param j
|
||||
* @param text
|
||||
* @param cellNum
|
||||
* @throws IOException
|
||||
*/
|
||||
private void handleSpecificData(Workbook workbook, String dir, HSSFPatriarch patriarch, CellStyle cellStyleLink, ByteArrayOutputStream byteArrayOut, Row row, int i, int j, String text, int cellNum) throws IOException {
|
||||
if (text.contains("/upFiles")) {
|
||||
row.setHeight((short) 3000); //设置行高
|
||||
//先将图片下载到本地
|
||||
log.info("-------------------------将图片下载到本地文件夹中----------------------------");
|
||||
String fileLastName = text.substring(text.lastIndexOf("/") + 1);
|
||||
if (MinioUtil.doesObjectExist(text)) {
|
||||
try (InputStream in = MinioUtil.download(text)) {
|
||||
copyFile2(in, dir + File.separator + fileLastName);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
log.error(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
File file = new File(dir + File.separator + fileLastName);
|
||||
log.info("-------------------------图片下载成功:"+ file.getAbsolutePath() +"----------------------------");
|
||||
if (file.exists()) {
|
||||
log.info("-------------------------将图片插入excel指定单元格中----------------------------");
|
||||
BufferedImage bufferImg = ImageIO.read(file);
|
||||
//获取文件后缀
|
||||
String fileName = file.getName();
|
||||
String formatName = fileName.substring(fileName.lastIndexOf(".") + 1);
|
||||
//如果是jpg或者是jpeg,需要重画一下,否则会变色
|
||||
if (formatName.equalsIgnoreCase("jpg") || formatName.equalsIgnoreCase("jpeg")) { //重画一下,要么会变色
|
||||
BufferedImage tag;
|
||||
tag = new BufferedImage(bufferImg.getWidth(), bufferImg.getHeight(), BufferedImage.TYPE_INT_BGR);
|
||||
Graphics g = tag.getGraphics();
|
||||
g.drawImage(bufferImg, 0, 0, null); // 绘制缩小后的图
|
||||
g.dispose();
|
||||
bufferImg = tag;
|
||||
}
|
||||
ImageIO.write(bufferImg, formatName, byteArrayOut);
|
||||
//anchor主要用于设置图片的属性
|
||||
HSSFClientAnchor anchor = new HSSFClientAnchor(0, 0, 600, 200, (short) cellNum, j + i, (short) cellNum, j + i);
|
||||
patriarch.createPicture(anchor, workbook.addPicture(byteArrayOut.toByteArray(), HSSFWorkbook.PICTURE_TYPE_JPEG));
|
||||
log.info("-------------------------将图片插入成功----------------------------");
|
||||
}
|
||||
} else {
|
||||
Cell cell = row.createCell(cellNum);
|
||||
if (text.contains("<table")) {
|
||||
log.info("-------------------------开始处理表格----------------------------");
|
||||
tableAssociate(workbook, cellStyleLink, cell, text);
|
||||
log.info("-------------------------表格处理完毕----------------------------");
|
||||
} else {
|
||||
cell.setCellValue(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 当前excel中新开sheet生成表格,并在指定单元格用超链接关联
|
||||
* @param workbook
|
||||
* @param cellStyleLink
|
||||
* @param cell
|
||||
* @param tableHtml
|
||||
*/
|
||||
private void tableAssociate(Workbook workbook, CellStyle cellStyleLink, Cell cell, String tableHtml) {
|
||||
cell.setCellValue("点击查看详情");
|
||||
//新开sheet生成表格
|
||||
log.info("-------------------------开始生成表格----------------------------");
|
||||
if (org.apache.commons.lang.StringUtils.isNotEmpty(tableHtml) && tableHtml.indexOf("<tbody>") < 0) {
|
||||
if (tableHtml.indexOf("<thead>") < 0) {
|
||||
tableHtml = tableHtml.replaceFirst("<tr>", "<tbody><tr>");
|
||||
tableHtml = tableHtml.replaceFirst("</table>", "</tbody></table>");
|
||||
} else {
|
||||
tableHtml = tableHtml.replaceFirst("</thead>", "</thead><tbody>");
|
||||
tableHtml = tableHtml.replaceFirst("</table>", "</tbody></table>");
|
||||
}
|
||||
}
|
||||
String cnt = "\n";
|
||||
tableHtml = tableHtml.replaceAll("<[\\s]*?br[^>]*?>|<[\\s]*?\\/[\\s]*?br[\\s]*?>", cnt);
|
||||
String tableSheetName = "表格" + System.currentTimeMillis();
|
||||
ConvertHtml2Excel.table2Excel(tableHtml, (HSSFWorkbook) workbook, tableSheetName);
|
||||
log.info("-------------------------表格生产完毕----------------------------");
|
||||
//添加超链接
|
||||
log.info("-------------------------开始添加超链接---------------------------");
|
||||
CreationHelper createHelper = workbook.getCreationHelper();
|
||||
Hyperlink hyperlink1 = createHelper.createHyperlink(HyperlinkType.DOCUMENT);
|
||||
String tableName = "#\'" + tableSheetName + "\'!A1";
|
||||
hyperlink1.setAddress(tableName);
|
||||
cell.setHyperlink(hyperlink1);// 链接
|
||||
cell.setCellStyle(cellStyleLink);
|
||||
log.info("-------------------------超链接添加完毕---------------------------");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文字、图片、表格分割后的内容
|
||||
* @param request
|
||||
* @param text
|
||||
* @return
|
||||
*/
|
||||
private String getSplitContent(HttpServletRequest request, String text) {
|
||||
text = text.replace("<p>", "").replace("</p>", "\r\n");
|
||||
//分割图片
|
||||
log.info("-------------------------开始分割文字与图片---------------------------");
|
||||
splitImg(text, request.getSession());
|
||||
log.info("-------------------------文字与图片分割完毕---------------------------");
|
||||
//分割表格
|
||||
log.info("-------------------------从剩余文字中开始分割表格---------------------------");
|
||||
String txtAndImg = (String) request.getSession().getAttribute("txtAndImg");
|
||||
txtAndImg = txtAndImg.replaceAll("table", "replaceTable");
|
||||
splitTable(txtAndImg, request.getSession());
|
||||
log.info("-------------------------表格分割完毕---------------------------");
|
||||
return (String) request.getSession().getAttribute("textAndTableAndImg");
|
||||
}
|
||||
|
||||
/**
|
||||
* 分割表格
|
||||
* @param textAndImg
|
||||
* @param session
|
||||
*/
|
||||
private void splitTable(String textAndImg,HttpSession session) {
|
||||
if (textAndImg.contains("<replaceTable")) {
|
||||
String left = textAndImg.substring(0, textAndImg.indexOf("<replaceTable"));
|
||||
String right = textAndImg.substring(textAndImg.indexOf("/replaceTable>") + 14);
|
||||
String table = textAndImg.substring(textAndImg.indexOf("<replaceTable"), textAndImg.indexOf("/replaceTable>")+14);
|
||||
table = table.replaceAll("replaceTable", "table");
|
||||
textAndImg = left + "---" + table + "---" + right;
|
||||
splitTable(textAndImg, session);
|
||||
} else {
|
||||
session.setAttribute("textAndTableAndImg", textAndImg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 分割图片
|
||||
* @param text
|
||||
* @param session
|
||||
* @return
|
||||
*/
|
||||
private void splitImg(String text,HttpSession session) {
|
||||
if (text.contains("<img")) {
|
||||
String txtLeft = text.substring(0, text.indexOf("<img"));
|
||||
String txtRight = text.substring(text.indexOf("g\">") + 3);
|
||||
String img = text.substring(text.indexOf("<img"), text.indexOf("g\">"));
|
||||
String path = img.substring(img.lastIndexOf("=") + 1)+"g";
|
||||
text = txtLeft + "---" + path + "---" + txtRight;
|
||||
splitImg(text, session);
|
||||
} else {
|
||||
session.setAttribute("txtAndImg", text);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 一致评估
|
||||
* @param sarFileCompareItemComment
|
||||
*/
|
||||
@Override
|
||||
public void consensusAssessment(SarFileCompareItemComment sarFileCompareItemComment) {
|
||||
Date now = new Date();
|
||||
sarFileCompareItemComment.setCreateTime(now);
|
||||
sarFileCompareItemComment.setUpdateTime(now);
|
||||
sarFileCompareItemComment.setComment("一致");
|
||||
save(sarFileCompareItemComment);
|
||||
SarFileCompareItemServiceImpl.updateReviewedById(sarFileCompareItemComment.getItemsIdLeft());
|
||||
SarFileCompareItemServiceImpl.updateReviewedById(sarFileCompareItemComment.getItemsIdRight());
|
||||
}
|
||||
|
||||
public void copyFile2(InputStream in, String destPath) throws IOException {
|
||||
BufferedInputStream bis = new BufferedInputStream(in);
|
||||
BufferedOutputStream bos =
|
||||
new BufferedOutputStream(Files.newOutputStream(Paths.get(destPath),
|
||||
StandardOpenOption.CREATE,
|
||||
StandardOpenOption.TRUNCATE_EXISTING,
|
||||
StandardOpenOption.WRITE));
|
||||
// 打开输入流
|
||||
// FileInputStream fis = new FileInputStream(srcPath);
|
||||
// 打开输出流
|
||||
// FileOutputStream fos = new FileOutputStream(destPath);
|
||||
// 读取和写入信息
|
||||
byte[] bytes = new byte[1024 * 1024];
|
||||
int len;
|
||||
while ((len = bis.read(bytes)) > 0) {
|
||||
bos.write(bytes, 0, len);
|
||||
}
|
||||
// 关闭流 先开后关 后开先关
|
||||
// 先开后关,先开的输入流,再开的输出流,那么应该先关输出流,再关输入流
|
||||
// 先关外层,再关内层。如BufferedInputStream包装了一个FileInputStream,那么先关BufferedInputStream,再关FileInputStream。
|
||||
bos.close(); // 后开先关
|
||||
bis.close(); // 先开后关
|
||||
}
|
||||
|
||||
}
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
package com.jero.modules.compare.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.modules.compare.entity.SarFileCompareItem;
|
||||
import com.jero.modules.compare.mapper.SarFileCompareItemMapper;
|
||||
import com.jero.modules.compare.service.ISarFileCompareItemService;
|
||||
import com.jero.modules.compare.utils.CompareConst;
|
||||
import com.jero.modules.compare.utils.DiffUtils;
|
||||
import com.jero.modules.system.util.MyStringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息条款表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-02
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class SarFileCompareItemServiceImpl extends ServiceImpl<SarFileCompareItemMapper, SarFileCompareItem> implements ISarFileCompareItemService {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param sarFileCompareItem
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(SarFileCompareItem sarFileCompareItem) {
|
||||
Date now = new Date();
|
||||
sarFileCompareItem.setCreateTime(now);
|
||||
sarFileCompareItem.setUpdateTime(now);
|
||||
save(sarFileCompareItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param sarFileCompareItem
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void editById(SarFileCompareItem sarFileCompareItem) {
|
||||
Date now = new Date();
|
||||
sarFileCompareItem.setUpdateTime(now);
|
||||
saveOrUpdate(sarFileCompareItem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateReviewedById(String id) {
|
||||
if (!MyStringUtils.isEmpty(id)) {
|
||||
SarFileCompareItem item = getById(id);
|
||||
if (null != item && item.getReviewed() == CompareConst.NO_REVIEWED) {
|
||||
item.setReviewed(CompareConst.REVIEWED);
|
||||
editById(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SarFileCompareItem queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SarFileCompareItem> queryList() {
|
||||
return list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SarFileCompareItem> queryListByInfoId(String infoId) {
|
||||
LambdaQueryWrapper<SarFileCompareItem> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SarFileCompareItem::getInfoId, infoId);
|
||||
queryWrapper.orderBy(true, true, SarFileCompareItem::getItemsDisplayNum);
|
||||
List<SarFileCompareItem> list = this.list(queryWrapper);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, SarFileCompareItem> queryMapByInfoId(String infoId) {
|
||||
Map<String, SarFileCompareItem> resMap = new HashMap<String, SarFileCompareItem>();
|
||||
List<SarFileCompareItem> list = queryListByInfoId(infoId);
|
||||
for (SarFileCompareItem item : list) {
|
||||
resMap.put(item.getId(), item);
|
||||
}
|
||||
return resMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> clauseComparison(String lid, String rid) {
|
||||
SarFileCompareItem leftItem = this.queryById(lid);
|
||||
SarFileCompareItem rightItem = this.queryById(rid);
|
||||
DiffUtils dmp = new DiffUtils();
|
||||
List<String> htmlDiffStr = dmp.getHtmlDiffStr(leftItem.getItemsText(), rightItem.getItemsText());
|
||||
return htmlDiffStr;
|
||||
}
|
||||
}
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
package com.jero.modules.compare.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.modules.compare.entity.SarFileCompareMenu;
|
||||
import com.jero.modules.compare.mapper.SarFileCompareMenuMapper;
|
||||
import com.jero.modules.compare.service.ISarFileCompareMenuService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息目录表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-03
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class SarFileCompareMenuServiceImpl extends ServiceImpl<SarFileCompareMenuMapper, SarFileCompareMenu> implements ISarFileCompareMenuService {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param sarFileCompareMenu
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(SarFileCompareMenu sarFileCompareMenu) {
|
||||
Date now = new Date();
|
||||
sarFileCompareMenu.setCreateTime(now);
|
||||
sarFileCompareMenu.setUpdateTime(now);
|
||||
save(sarFileCompareMenu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param sarFileCompareMenu
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void editById(SarFileCompareMenu sarFileCompareMenu) {
|
||||
Date now = new Date();
|
||||
sarFileCompareMenu.setUpdateTime(now);
|
||||
saveOrUpdate(sarFileCompareMenu);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SarFileCompareMenu queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SarFileCompareMenu> queryList() {
|
||||
return list();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<SarFileCompareMenu> queryListByInfoId(String infoId) {
|
||||
LambdaQueryWrapper<SarFileCompareMenu> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SarFileCompareMenu::getInfoId, infoId);
|
||||
queryWrapper.orderBy(true,true,SarFileCompareMenu::getDisplaySeq);
|
||||
List<SarFileCompareMenu> list = this.list(queryWrapper);
|
||||
return list;
|
||||
}
|
||||
}
|
||||
+159
@@ -0,0 +1,159 @@
|
||||
package com.jero.modules.compare.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.jero.modules.compare.entity.SarFileCompareResComVO;
|
||||
import com.jero.modules.compare.entity.SarFileCompareResComment;
|
||||
import com.jero.modules.compare.mapper.SarFileCompareResCommentMapper;
|
||||
import com.jero.modules.compare.service.ISarFileCompareResCommentService;
|
||||
import com.jero.modules.system.util.MyStringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @Description: 文档对比信息结果评论表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-08-05
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class SarFileCompareResCommentServiceImpl extends ServiceImpl<SarFileCompareResCommentMapper, SarFileCompareResComment> implements ISarFileCompareResCommentService {
|
||||
|
||||
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param sarFileCompareResComment
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(SarFileCompareResComment sarFileCompareResComment) {
|
||||
Date now = new Date();
|
||||
sarFileCompareResComment.setCreateTime(now);
|
||||
sarFileCompareResComment.setUpdateTime(now);
|
||||
save(sarFileCompareResComment);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param sarFileCompareResComment
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void editById(SarFileCompareResComment sarFileCompareResComment) {
|
||||
Date now = new Date();
|
||||
sarFileCompareResComment.setUpdateTime(now);
|
||||
saveOrUpdate(sarFileCompareResComment);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public SarFileCompareResComment queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<SarFileCompareResComment> queryList() {
|
||||
return list();
|
||||
}
|
||||
|
||||
public List<SarFileCompareResComVO> queryListByInfoId(String id) {
|
||||
LambdaQueryWrapper<SarFileCompareResComment> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SarFileCompareResComment::getInfoId, id);
|
||||
queryWrapper.orderBy(true, true, SarFileCompareResComment::getCreateTime);
|
||||
List<SarFileCompareResComVO> resList = new ArrayList<>();
|
||||
List<SarFileCompareResComment> list = this.list(queryWrapper);
|
||||
for (SarFileCompareResComment rc : list) {
|
||||
if (MyStringUtils.isEmpty(rc.getParentId())) {
|
||||
SarFileCompareResComVO resComVO = wrapperSarFileCompareResComVO(rc);
|
||||
for (SarFileCompareResComment rc1 : list) {
|
||||
if (!MyStringUtils.isEmpty(rc1.getParentId()) && rc1.getParentId().equals(resComVO.getId())) {
|
||||
resComVO.addResComVo(wrapperSarFileCompareResComVO(rc1));
|
||||
}
|
||||
}
|
||||
resList.add(resComVO);
|
||||
}
|
||||
}
|
||||
return resList;
|
||||
}
|
||||
|
||||
private SarFileCompareResComVO wrapperSarFileCompareResComVO(SarFileCompareResComment rc) {
|
||||
SarFileCompareResComVO resComVO = new SarFileCompareResComVO();
|
||||
resComVO.setId(rc.getId());
|
||||
resComVO.setName(rc.getCreateBy());
|
||||
resComVO.setCreateTime(sdf.format(rc.getCreateTime()));
|
||||
resComVO.setContent(rc.getComment());
|
||||
return resComVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SarFileCompareResComVO> queryListByInfoId(String id, String str) {
|
||||
if (MyStringUtils.isBlank(str)) {
|
||||
return queryListByInfoId(id);
|
||||
}
|
||||
LambdaQueryWrapper<SarFileCompareResComment> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(SarFileCompareResComment::getInfoId, id);
|
||||
queryWrapper.like(SarFileCompareResComment::getComment, str);
|
||||
queryWrapper.orderBy(true, true, SarFileCompareResComment::getCreateTime);
|
||||
List<SarFileCompareResComment> list = this.list(queryWrapper);
|
||||
Map<String, SarFileCompareResComVO> resCommentMap = new HashMap<>();
|
||||
List<SarFileCompareResComment> subList = new ArrayList<>();
|
||||
//先找到一级评论
|
||||
for (SarFileCompareResComment rc : list) {
|
||||
if (MyStringUtils.isEmpty(rc.getParentId())) {
|
||||
resCommentMap.put(rc.getId(), wrapperSarFileCompareResComVO(rc));
|
||||
} else {
|
||||
subList.add(rc);
|
||||
}
|
||||
}
|
||||
//把回复评论放进一级评论下,没有一级评论要查出来放上
|
||||
for (SarFileCompareResComment rc : subList) {
|
||||
if (resCommentMap.keySet().contains(rc.getParentId())) {
|
||||
resCommentMap.get(rc.getParentId()).addResComVo(wrapperSarFileCompareResComVO(rc));
|
||||
} else {
|
||||
SarFileCompareResComment prc = this.queryById(rc.getParentId());
|
||||
SarFileCompareResComVO prcVo = wrapperSarFileCompareResComVO(prc);
|
||||
prcVo.addResComVo(wrapperSarFileCompareResComVO(rc));
|
||||
resCommentMap.put(prcVo.getId(), prcVo);
|
||||
}
|
||||
}
|
||||
return Lists.newArrayList(resCommentMap.values());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,266 @@
|
||||
package com.jero.modules.compare.utils;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.extra.tokenizer.Result;
|
||||
import cn.hutool.extra.tokenizer.TokenizerEngine;
|
||||
import cn.hutool.extra.tokenizer.TokenizerUtil;
|
||||
import cn.hutool.extra.tokenizer.Word;
|
||||
import cn.hutool.extra.tokenizer.engine.hanlp.HanLPEngine;
|
||||
import cn.hutool.extra.tokenizer.engine.jieba.JiebaEngine;
|
||||
import com.hankcs.hanlp.HanLP;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jsoup.Jsoup;
|
||||
import org.wltea.analyzer.core.IKSegmenter;
|
||||
import org.wltea.analyzer.core.Lexeme;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.text.NumberFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
public class CompHanLPUtils {
|
||||
|
||||
|
||||
/**
|
||||
* 通过Ik 进行将句子分词
|
||||
*
|
||||
* @param text
|
||||
* @return
|
||||
*/
|
||||
public static Vector<String> participleIk(String text) {
|
||||
//对输入进行分词
|
||||
Vector<String> str = new Vector<>();
|
||||
try {
|
||||
StringReader reader = new StringReader(text);
|
||||
//当为true时,分词器进行最大词长切分
|
||||
IKSegmenter ik = new IKSegmenter(reader, true);
|
||||
Lexeme lexeme = null;
|
||||
while ((lexeme = ik.next()) != null) {
|
||||
str.add(lexeme.getLexemeText());
|
||||
}
|
||||
if (str.size() == 0) {
|
||||
return null;
|
||||
}
|
||||
//分词后
|
||||
log.info("str分词后:" + str);
|
||||
} catch (IOException e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 结巴分词
|
||||
*
|
||||
* @param text
|
||||
* @return
|
||||
*/
|
||||
public static Vector<String> participleJieBa(String text) {
|
||||
JiebaEngine engine = new JiebaEngine();
|
||||
Result results = engine.parse(text);
|
||||
//输出:这 两个 方法 的 区别 在于 返回 值
|
||||
String result = CollUtil.join((Iterator<Word>) results, ",");
|
||||
return new Vector<>(Arrays.asList(result.split(",")));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 中文分词
|
||||
*
|
||||
* @param text
|
||||
* @return
|
||||
*/
|
||||
public static Vector<String> participleChinese(String text) {
|
||||
//自动根据用户引入的分词库的jar来自动选择使用的引擎
|
||||
TokenizerEngine engine = TokenizerUtil.createEngine();
|
||||
//解析文本
|
||||
//String text = "这两个方法的区别在于返回值";
|
||||
Result results = engine.parse(text);
|
||||
//输出:这 两个 方法 的 区别 在于 返回 值
|
||||
String result = CollUtil.join((Iterator<Word>) results, ",");
|
||||
return new Vector<>(Arrays.asList(result.split(",")));
|
||||
}
|
||||
|
||||
/**
|
||||
* 采用 HanLP 进行自定义分词
|
||||
*/
|
||||
public static Vector<String> participleHanLP(String text) {
|
||||
TokenizerEngine engine = new HanLPEngine();
|
||||
//解析文本
|
||||
//String text = "这两个方法的区别在于返回值";
|
||||
Result results = engine.parse(text);
|
||||
//输出:这 两个 方法 的 区别 在于 返回 值
|
||||
String result = CollUtil.join((Iterator<Word>) results, ",");
|
||||
return new Vector<>(Arrays.asList(result.split(",")));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Java利用hanlp完成语句相似度分析
|
||||
*
|
||||
* @param sentenceOne
|
||||
* @param sentenceTwo
|
||||
* @return
|
||||
*/
|
||||
public static double findSimilarity(String sentenceOne, String sentenceTwo) {
|
||||
List<String> sentOneWords = getSplitWords(sentenceOne);
|
||||
List<String> sentTwoWords = getSplitWords(sentenceTwo);
|
||||
List<String> allWords = mergeList(sentOneWords, sentTwoWords);
|
||||
int[] statisticOne = statistic(allWords, sentOneWords);
|
||||
int[] statisticTwo = statistic(allWords, sentTwoWords);
|
||||
double dividend = 0;
|
||||
double divisor1 = 0;
|
||||
double divisor2 = 0;
|
||||
int length = statisticOne.length;
|
||||
for (int i = 0; i < length; i++) {
|
||||
dividend += statisticOne[i] * statisticTwo[i];
|
||||
divisor1 += Math.pow(statisticOne[i], 2);
|
||||
divisor2 += Math.pow(statisticTwo[i], 2);
|
||||
}
|
||||
return dividend / (Math.sqrt(divisor1) * Math.sqrt(divisor2));
|
||||
}
|
||||
|
||||
|
||||
private static int[] statistic(List<String> allWords, List<String> sentWords) {
|
||||
int[] result = new int[allWords.size()];
|
||||
int size = allWords.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
result[i] = Collections.frequency(sentWords, allWords.get(i));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 去重
|
||||
*
|
||||
* @param listOne
|
||||
* @param listTwo
|
||||
* @return
|
||||
*/
|
||||
private static List<String> mergeList(List<String> listOne, List<String> listTwo) {
|
||||
List<String> result = new ArrayList<>();
|
||||
result.addAll(listOne);
|
||||
result.addAll(listTwo);
|
||||
return result.stream().distinct().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 过滤标签
|
||||
*
|
||||
* @param sentence
|
||||
* @return
|
||||
*/
|
||||
private static List<String> getSplitWords(String sentence) {
|
||||
// 去除掉html标签
|
||||
sentence = Jsoup.parse(sentence.replace(" ", "")).body().text();
|
||||
// 标点符号会被单独分为一个Term,去除之
|
||||
return HanLP.segment(sentence).stream().map(a -> a.word).filter(s -> !"`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、? ".contains(s)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
String str1 = "6转向系\n" +
|
||||
"6.1汽车(三轮汽车除外)的方向盘应设置于左侧,其他机动车的方向盘不得设置于右侧;专项作业车、教练车按需要可设置左右两个方向盘。有驾驶室的正三轮摩托车如使用方向盘转向,则方向盘中心立柱距车辆纵向中心平面的水平距离应小于等于200 mm;其他摩托车不得使用方向盘转向。\n" +
|
||||
"6.2机动车的方向盘(或方向把)应转动灵活,操纵方便,无卡滞现象。机动车应设置转向限位装置。转向系统在任何操作位置上,不得与其他部件有干涉现象。\n" +
|
||||
"6.3机动车(摩托车、三轮汽车、手扶拖拉机运输机组除外)正常行驶时,转向轮转向后应有一定的回正能力(允许有残余角),以使机动车具有稳定的直线行驶能力。\n" +
|
||||
"6.4机动车方向盘的最大自由转动量应小于或等于:\n" +
|
||||
"a) 最大设计车速大于或等于100 km/h 的机动车:15°\n" +
|
||||
"b) 三轮汽车:35°;\n" +
|
||||
"c) 其他机动车:25° 。\n" +
|
||||
"6.5汽车(三轮汽车除外)应具有适度的不足转向特性。\n" +
|
||||
"6.6三轮汽车、摩托车的转向轮向左或向右转角应小于等于:\n" +
|
||||
"a)\t三轮汽车、三轮摩托车、正三轮轻便摩托车:45°;\n" +
|
||||
"6)\t\t两轮普通摩托车、两轮轻便摩托车:48°。\n" +
|
||||
"6.6机动车在平坦、硬实、干燥和清洁的道路上行驶不应跑偏,其方向盘(或方向把)不应有摆振、路感不灵或其他异常现象。\n" +
|
||||
"6.8机动车在平坦、硬实、干燥和清洁的水泥或沥青道路上行驶,以10 km/h的速度在5 s之内沿螺旋线从直线行驶过渡到外圆直径为25 m的车辆通道圆行驶,施加于方向盘外缘的最大切向力应小于等于245 N。\n" +
|
||||
"6.9专用校车应采用转向助力装置;其他机动车转向轴最大设计轴荷大于4 000 kg时,也应采用转向助力装置。装有转向助力装置的机动车,转向时其转向助力功能不得出现时有时无的现象,且转向助力装置失效时仍应具有用方向盘控制机动车的能力。装有电动转向助力装置的汽车,在产品使用说明书规定的正常使用状态下,应保证转向助力装置的电能供应。\n" +
|
||||
"6.10汽车和汽车列车(不计具有作业功能的专用装置的突出部分)、轮式拖拉机运输机组应能在同一个车辆通道圆内通过,车辆通道圆的外圆直径认为25.00 m,车辆通道圆的内圆直径D2为10.60 m。 汽车和汽车列车、轮式拖拉机运输机组由直线行驶过渡到上述圆周运动时,任何部分超出直线行驶时的 车辆外侧面垂直面的值(外摆值)应小于等于0.80 m(对铰接客车和铰接式无轨电车外摆值应小于等于 1.20 m),其试验方法见GB 1589。\n" +
|
||||
"6.11汽车(三轮汽车除外)的车轮定位应与该车型的技术要求一致。对前轴采用非独立悬架的汽车(前轴采用双转向轴时除外),其转向轮的横向侧滑量,用侧滑台检验时侧滑量值应在±5 m/km之间。\n" +
|
||||
"6.12转向节及臂,转向横、直拉杆及球销不得有裂纹和损伤,并且转向球销不应松旷。对机动车进行改装或修理时横、直拉杆不得拼焊。\n" +
|
||||
"6.13三轮汽车、摩托车的前减振器、上下联板和方向把不应有变形和裂损。\n";
|
||||
String str2 = "6转向系\n" +
|
||||
"6.1汽车(三轮汽车除外)的方向盘应设置于左侧,其他机动车的方向盘不应设置于右侧;专项作业车、教练车按需要可设置左右两个方向盘。装有两个后轮、有驾驶室的正三轮摩托车如使用方向盘转向,则方向盘中心立柱距车辆纵向中心平面的水平距离应小于或等于200 mm ;其他摩托车不应使用方向盘转向。\n" +
|
||||
"6.2机动车的方向盘(或方向把)应转动灵活,无卡滞现象。机动车应设置转向限位装置。转向系统在任何操作位置上,不应与其他部件有干涉现象。\n" +
|
||||
"6.3机动车(摩托车、三轮汽车、手扶拖拉机运输机组除外〉正常行驶时,转向轮转向后应有一定的回正能力(允许有残余角),以使机动车具有稳定的直线行驶能力0\n" +
|
||||
"6.4机动车方向盘的最大自由转动量应小于或等于:\n" +
|
||||
"a) 最大设计车速大于或等于100 km/h 的机动车:15°\n" +
|
||||
"b) 三轮汽车:35°;\n" +
|
||||
"c) 其他机动车:25° 。\n" +
|
||||
"6.5汽车(三轮汽车除外)应具有适度的不足转向特性。\n" +
|
||||
"6.6三轮汽车、摩托车的转向轮向左或向右转角应小于或等于:\n" +
|
||||
"a) 三轮汽车、三轮摩托车、正三轮轻便摩托车:45°;\n" +
|
||||
"b)两轮普通摩托车、两轮轻便摩托车:48°0\n" +
|
||||
"6.7机动车在平坦、硬实、干燥和清洁的道路上行驶不应跑偏,其方向盘(或方向把)不应有摆振等异常现象。\n" +
|
||||
"6.8机动车在平坦、硬实、干燥和清洁的水泥或沥青道路上行驶,以10 km/h 的速度在5 s 之内沿螺旋线从直线行驶过渡到外圆直径为25m 的车辆通道圆行驶,施加于方向盘外缘的最大切向力应小于或等于245 N。\n" +
|
||||
"6.9汽车(三轮汽车除外)的车轮定位应与该车型的技术要求一致。对前轴采用非独立悬架的汽车(前轴采用双转向轴时除外),其转向轮的横向侧滑量,用侧滑台检验时侧滑量值应小于或等于5 m/km。\n" +
|
||||
"6.10 专用校车应采用转向助力装置;其他机动车转向轴最大设计轴荷大于4 000 kg 时,也应采用转向助力装置。装有转向助力装置的机动车,转向时其转向助力功能不应出现时有时无的现象,且转向助力装置失效时仍应具有用方向盘控制机动车的能力。\n" +
|
||||
"6.11转向节及臂,转向横、直拉杆及球销应连接可靠,且不应有裂纹和损伤,并且转向球销不应松旷。对机动车进行改装或修理时横、直拉杆不应拼焊。\n" +
|
||||
"6.12三轮汽车、摩托车的前减振器、上下联板和方向把不应有变形和裂损。";
|
||||
String str3 = "\n" +
|
||||
"5车辆识别代号的标示位置\n" +
|
||||
"5.1每辆车辆都应具有唯一的车辆识别代号,并永久保持地标示在车辆上,同一车辆上标示的所有的 车辆识别代号的字码构成与排列顺序应相同。除第9章规定的情况外,不得对已标示的车辆识别代号 进行变更。\n" +
|
||||
"5.2车辆应在产品标牌上标示车辆识别代号(L1、L3类车辆可除外),产品标牌的型式、标示位置、标示要求应符合GB/T 18411的规定。\n" +
|
||||
"5.3车辆应至少有一个车辆识别代号直接打刻在车架(无车架的车辆为车身主要承载且不能拆卸的部件)能防止锈烛、磨损的部位上。其中:\n" +
|
||||
"a)\tM1类车辆的车辆识别代号应打刻在发动机舱内能防止替换的车辆结构件上,或打刻在车门 立柱上,如受结构限制没有打刻空间时也可打刻在右侧除行李舱外的车辆其他结构件上;\n" +
|
||||
"b)\t最大设计总质量大于或等于12000 kg的货车及所有牵引杆挂车,车辆识别代号应打刻在右前轮纵向中心线前端纵梁外侧,如受结构限制也可打刻在右前轮纵向中心线附近纵梁外侧;\n" +
|
||||
"c)\t半挂车和中置轴挂车的车辆识别代号应打刻在右前支腿前端纵梁外侧(无纵梁车辆除外);\n" +
|
||||
"d)\t其他汽车和无纵梁挂车的车辆识别代号应打刻在车辆右侧前部的车辆结构件上,如受结构限 制也可打刻在右侧其他车辆结构件上。\n" +
|
||||
"打刻车辆识别代号的部件不应采用打磨、挖补、垫片、凿改、重新涂漆(设计和制造上为保护打刻的 车辆识别代号而采取涂漆工艺的情形除外)等方式处理,从上(前)方观察时,打刻区域周边足够大面积 的表面不应有任何覆盖物,如有覆盖物,该覆盖物的表面应明确标示“车辆识别代号”或“VIN”字样,且覆盖物在不使用任何专用工具的情况下能直接取下(或揭开)及复原,以方便地观察到足够大的包括打刻区域的表面。\n" +
|
||||
"注1:打刻区域周边足够大面积的表面(足够大的包括打刻区域的表面)是指打刻车辆识别代号的部件的全部表面,但所暴露表面能满足查看打刻车辆识别代号的部件有无挖补、重新焊接、粘贴等痕迹的需要时,也应视为满足要求。\n" +
|
||||
"注2:对摩托车,打刻的车辆识别代号在不举升车辆的情形下可观察、拓印的,视为满足要求。\n" +
|
||||
"打刻的车辆识别代号从上(前)方应易于观察、拓印,对于汽车和挂车还应能拍照。\n" +
|
||||
"5.4具有电子控制单元的汽车,其至少有一个电子控制单元应不可篡改地存储车辆识别代号。\n" +
|
||||
"5.5 M1、N1类车辆应在靠近风窗立柱的位置标示车辆识别代号,该车辆识别代号在白天不需移动任何部件从车外即能清晰识读。\n" +
|
||||
"5.6除按照5.2、5.3、5.4、5.5规定标示车辆识别代号之外,类车辆还应在行李舱的易见部位标示车辆识别代号;且若车辆制造厂选取车辆识别代号作为车辆及部件识别标记的标识信息,还应按照GB 30509的规定,标示车辆识别代号。\n" +
|
||||
"5.7除按照5.2、5.3、5.4规定标示车辆识别代号之外,最大设计总质量大于或等于12000 kg的栏板式、仓栅式、自卸式、罐式货车及最大设计总质量大于或等于10000 kg的栏板式、仓栅式、自卸式、罐式挂车还应在其货箱或常压罐体(或设计和制造上固定在货箱或常压罐体上且用于与车架连接的结构件)上打刻至少两个车辆识别代号。打刻的车辆识别代号应位于货箱(常压罐体)左、右两侧或前端面且易于拍照;且若打刻在货箱(常压罐体)左、右两侧时,打刻的车辆识别代号距货箱(常压罐体)前端面的距离应小于或等于1 000 mm,若打刻在左、右两侧连接结构件时应尽量靠近货箱(常压罐体)前端面。\n" +
|
||||
"5.8车辆制造厂应至少在一种随车文件中标示车辆识别代号。";
|
||||
|
||||
String str4 = "\n" +
|
||||
"5.3车辆的驱动\n" +
|
||||
"5.3.1车辆不应靠自身动力驱动。\n" +
|
||||
"5.3.2在碰撞瞬间,车辆应不冉承受任何附加转向或驱动装置的作用。\n" +
|
||||
"5.3.3车辆到达壁障的路线在横向任一方向偏离理论轨迹均不应超过150 mm。\n" +
|
||||
"5.4 试验速度\n" +
|
||||
"在碰撞瞬间,车辆速度应为504 km/h。如果试验在更高的碰撞速度下进行并且车辆符合要求,也认为试验合格。\n" +
|
||||
"5.5对前排座椅假人的测量\n" +
|
||||
"5.5.1为确定性能指标必需的所有测量,均应采用符合附录D要求的测量系统。\n" +
|
||||
"5.5.2不同的参数应通过具备下列CFC(通道的频率等级)的独立数据通道来记录。\n" +
|
||||
"5.5.2.1对假人头部的测量\n" +
|
||||
"重心处的加速度(a)由加速度的二维分量计算得出。加速度分量测量时,CFC为1000。\n" +
|
||||
"5.5.2.2对假人颈部的测量\n" +
|
||||
"5.5.2.2.1在头颈连接处测量的轴向张力和前后剪切力,CFC为1000。\n" +
|
||||
"5.5.2.2.2在头颈连接处测量的对Y轴的弯矩,CFC为600。\n" +
|
||||
"5.5.2.3对假人胸部的测量\n" +
|
||||
"胸部变形测量时,CFC为180。\n" +
|
||||
"5.5.2.4对假人大腿的测量\n" +
|
||||
"轴向压缩力测量时,CFC为600。";
|
||||
|
||||
|
||||
double similarity = CompHanLPUtils.findSimilarity(str1, str2);
|
||||
NumberFormat nf = NumberFormat.getPercentInstance();
|
||||
nf.setMaximumIntegerDigits(2);//小数点前保留几位
|
||||
nf.setMinimumFractionDigits(2);// 小数点后保留几位
|
||||
String similarityDegree = nf.format(similarity);
|
||||
System.out.println(similarityDegree);
|
||||
System.out.println("======================================================");
|
||||
double similarity1 = CompHanLPUtils.findSimilarity(str1, str3);
|
||||
System.out.println(similarity1);
|
||||
|
||||
System.out.println("======================================================");
|
||||
double similarity2 = CompHanLPUtils.findSimilarity(str1, str4);
|
||||
System.out.println(similarity2);
|
||||
|
||||
|
||||
System.out.println("======================================================");
|
||||
double similarity3 = CompHanLPUtils.findSimilarity(str3, str4);
|
||||
System.out.println(similarity3);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.jero.modules.compare.utils;
|
||||
|
||||
public class CompareConst {
|
||||
/**
|
||||
* 在对比列表左侧
|
||||
*/
|
||||
public static String POS_LEFT = "LEFT";
|
||||
/**
|
||||
* 在对比列表右侧
|
||||
*/
|
||||
public static String POS_RIGHT = "RIGHT";
|
||||
|
||||
/**
|
||||
* 对比条目没有被评论
|
||||
*/
|
||||
public static int NO_REVIEWED = 0;
|
||||
/**
|
||||
* 对比条目已被评论
|
||||
*/
|
||||
public static int REVIEWED = 1;
|
||||
}
|
||||
+228
@@ -0,0 +1,228 @@
|
||||
package com.jero.modules.compare.utils;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import org.apache.poi.hssf.usermodel.*;
|
||||
import org.apache.poi.hssf.util.HSSFColor;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.ss.util.CellUtil;
|
||||
import org.dom4j.Document;
|
||||
import org.dom4j.DocumentException;
|
||||
import org.dom4j.DocumentHelper;
|
||||
import org.dom4j.Element;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/****
|
||||
* html转excel
|
||||
* @author user
|
||||
*
|
||||
*/
|
||||
public class ConvertHtml2Excel {
|
||||
/**
|
||||
* html表格转excel
|
||||
*
|
||||
* @param tableHtml 如
|
||||
* <table>
|
||||
* ..
|
||||
* </table>
|
||||
* @return
|
||||
*/
|
||||
public static void table2Excel(String tableHtml, HSSFWorkbook wb,String tableSheetName) {
|
||||
HSSFSheet sheet = wb.createSheet(tableSheetName);
|
||||
List<CrossRangeCellMeta> crossRowEleMetaLs = new ArrayList<CrossRangeCellMeta>();
|
||||
int rowIndex = 0;
|
||||
try {
|
||||
Document data = DocumentHelper.parseText(tableHtml);
|
||||
// 生成表头
|
||||
Element thead = data.getRootElement().element("thead");
|
||||
HSSFCellStyle titleStyle = getTitleStyle(wb);
|
||||
int ls=0;//列数
|
||||
if (thead != null) {
|
||||
List<Element> trLs = thead.elements("tr");
|
||||
for (Element trEle : trLs) {
|
||||
HSSFRow row = sheet.createRow(rowIndex);
|
||||
List<Element> thLs = trEle.elements("th");
|
||||
ls=thLs.size();
|
||||
makeRowCell(thLs, rowIndex, row, 0, titleStyle, crossRowEleMetaLs);
|
||||
rowIndex++;
|
||||
}
|
||||
}
|
||||
// 生成表体
|
||||
Element tbody = data.getRootElement().element("tbody");
|
||||
HSSFCellStyle contentStyle = getContentStyle(wb);
|
||||
if (tbody != null) {
|
||||
List<Element> trLs = tbody.elements("tr");
|
||||
for (Element trEle : trLs) {
|
||||
HSSFRow row = sheet.createRow(rowIndex);
|
||||
List<Element> thLs = trEle.elements("th");
|
||||
int cellIndex = makeRowCell(thLs, rowIndex, row, 0, titleStyle, crossRowEleMetaLs);
|
||||
List<Element> tdLs = trEle.elements("td");
|
||||
makeRowCell(tdLs, rowIndex, row, cellIndex, contentStyle, crossRowEleMetaLs);
|
||||
rowIndex++;
|
||||
}
|
||||
}
|
||||
// 合并表头
|
||||
for (CrossRangeCellMeta crcm : crossRowEleMetaLs) {
|
||||
sheet.addMergedRegion(new CellRangeAddress(crcm.getFirstRow(), crcm.getLastRow(), crcm.getFirstCol(), crcm.getLastCol()));
|
||||
setRegionStyle(sheet, new CellRangeAddress(crcm.getFirstRow(), crcm.getLastRow(), crcm.getFirstCol(), crcm.getLastCol()),contentStyle);
|
||||
}
|
||||
for(int i=0;i<ls;i++){
|
||||
sheet.autoSizeColumn(i, true);//设置列宽
|
||||
}
|
||||
} catch (DocumentException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 生产行内容
|
||||
*
|
||||
* @return 最后一列的cell index
|
||||
*/
|
||||
/**
|
||||
* @param tdLs th或者td集合
|
||||
* @param rowIndex 行号
|
||||
* @param row POI行对象
|
||||
* @param startCellIndex
|
||||
* @param cellStyle 样式
|
||||
* @param crossRowEleMetaLs 跨行元数据集合
|
||||
* @return
|
||||
*/
|
||||
private static int makeRowCell(List<Element> tdLs, int rowIndex, HSSFRow row, int startCellIndex, HSSFCellStyle cellStyle,
|
||||
List<CrossRangeCellMeta> crossRowEleMetaLs) {
|
||||
int i = startCellIndex;
|
||||
for (int eleIndex = 0; eleIndex < tdLs.size(); i++, eleIndex++) {
|
||||
int captureCellSize = getCaptureCellSize(rowIndex, i, crossRowEleMetaLs);
|
||||
while (captureCellSize > 0) {
|
||||
for (int j = 0; j < captureCellSize; j++) {// 当前行跨列处理(补单元格)
|
||||
row.createCell(i);
|
||||
i++;
|
||||
}
|
||||
captureCellSize = getCaptureCellSize(rowIndex, i, crossRowEleMetaLs);
|
||||
}
|
||||
Element thEle = tdLs.get(eleIndex);
|
||||
String val = thEle.getTextTrim();
|
||||
if (StringUtils.isBlank(val)) {
|
||||
Element e = thEle.element("a");
|
||||
if (e != null) {
|
||||
val = e.getTextTrim();
|
||||
}
|
||||
}
|
||||
HSSFCell c = row.createCell(i);
|
||||
if (NumberUtils.isNumber(val)) {
|
||||
c.setCellValue(Double.parseDouble(val));
|
||||
c.setCellType(CellType.NUMERIC);
|
||||
} else {
|
||||
c.setCellValue(val);
|
||||
}
|
||||
int rowSpan = NumberUtils.toInt(thEle.attributeValue("rowspan"), 1);
|
||||
int colSpan = NumberUtils.toInt(thEle.attributeValue("colspan"), 1);
|
||||
c.setCellStyle(cellStyle);
|
||||
if (rowSpan > 1 || colSpan > 1) { // 存在跨行或跨列
|
||||
crossRowEleMetaLs.add(new CrossRangeCellMeta(rowIndex, i, rowSpan, colSpan));
|
||||
}
|
||||
if (colSpan > 1) {// 当前行跨列处理(补单元格)
|
||||
for (int j = 1; j < colSpan; j++) {
|
||||
i++;
|
||||
row.createCell(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置合并单元格的边框样式
|
||||
*
|
||||
* @param sheet
|
||||
* @param region
|
||||
* @param cs
|
||||
*/
|
||||
public static void setRegionStyle(HSSFSheet sheet, CellRangeAddress region, HSSFCellStyle cs) {
|
||||
for (int i = region.getFirstRow(); i <= region.getLastRow(); i++) {
|
||||
Row row = CellUtil.getRow(i, sheet);
|
||||
for (int j = region.getFirstColumn(); j <= region.getLastColumn(); j++) {
|
||||
Cell cell = CellUtil.getCell(row, (short) j);
|
||||
cell.setCellStyle(cs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得因rowSpan占据的单元格
|
||||
*
|
||||
* @param rowIndex 行号
|
||||
* @param colIndex 列号
|
||||
* @param crossRowEleMetaLs 跨行列元数据
|
||||
* @return 当前行在某列需要占据单元格
|
||||
*/
|
||||
private static int getCaptureCellSize(int rowIndex, int colIndex, List<CrossRangeCellMeta> crossRowEleMetaLs) {
|
||||
int captureCellSize = 0;
|
||||
for (CrossRangeCellMeta crossRangeCellMeta : crossRowEleMetaLs) {
|
||||
if (crossRangeCellMeta.getFirstRow() < rowIndex && crossRangeCellMeta.getLastRow() >= rowIndex) {
|
||||
if (crossRangeCellMeta.getFirstCol() <= colIndex && crossRangeCellMeta.getLastCol() >= colIndex) {
|
||||
captureCellSize = crossRangeCellMeta.getLastCol() - colIndex + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return captureCellSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得标题样式
|
||||
*
|
||||
* @param workbook
|
||||
* @return
|
||||
*/
|
||||
private static HSSFCellStyle getTitleStyle(HSSFWorkbook workbook) {
|
||||
short titlebackgroundcolor = HSSFColor.HSSFColorPredefined.GREY_25_PERCENT.getIndex();
|
||||
short fontSize = 12;
|
||||
String fontName = "宋体";
|
||||
HSSFCellStyle style = workbook.createCellStyle();
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||
style.setAlignment(HorizontalAlignment.CENTER);
|
||||
style.setBorderBottom(BorderStyle.THIN); //下边框
|
||||
style.setBorderLeft(BorderStyle.THIN);//左边框
|
||||
style.setBorderTop(BorderStyle.THIN);//上边框
|
||||
style.setBorderRight(BorderStyle.THIN);//右边框
|
||||
style.setFillPattern(FillPatternType.SOLID_FOREGROUND);
|
||||
style.setFillForegroundColor(titlebackgroundcolor);// 背景色
|
||||
|
||||
HSSFFont font = workbook.createFont();
|
||||
font.setFontName(fontName);
|
||||
font.setFontHeightInPoints(fontSize);
|
||||
font.setBold(true);
|
||||
style.setFont(font);
|
||||
return style;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得内容样式
|
||||
*
|
||||
* @param wb
|
||||
* @return
|
||||
*/
|
||||
private static HSSFCellStyle getContentStyle(HSSFWorkbook wb) {
|
||||
short fontSize = 12;
|
||||
String fontName = "宋体";
|
||||
HSSFCellStyle style = wb.createCellStyle();
|
||||
style.setBorderBottom(BorderStyle.THIN);
|
||||
style.setBorderTop(BorderStyle.THIN);
|
||||
style.setBorderLeft(BorderStyle.THIN);
|
||||
style.setBorderRight(BorderStyle.THIN);
|
||||
HSSFFont font = wb.createFont();
|
||||
font.setFontName(fontName);
|
||||
font.setFontHeightInPoints(fontSize);
|
||||
style.setFont(font);
|
||||
style.setAlignment(HorizontalAlignment.CENTER);//水平居中
|
||||
style.setVerticalAlignment(VerticalAlignment.CENTER);//垂直居中
|
||||
|
||||
return style;
|
||||
}
|
||||
}
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package com.jero.modules.compare.utils;
|
||||
|
||||
public class CrossRangeCellMeta {
|
||||
|
||||
public CrossRangeCellMeta(int firstRowIndex, int firstColIndex, int rowSpan, int colSpan) {
|
||||
super();
|
||||
this.firstRowIndex = firstRowIndex;
|
||||
this.firstColIndex = firstColIndex;
|
||||
this.rowSpan = rowSpan;
|
||||
this.colSpan = colSpan;
|
||||
}
|
||||
|
||||
private int firstRowIndex;
|
||||
private int firstColIndex;
|
||||
private int rowSpan;// 跨越行数
|
||||
private int colSpan;// 跨越列数
|
||||
|
||||
public int getFirstRow() {
|
||||
return firstRowIndex;
|
||||
}
|
||||
|
||||
public int getLastRow() {
|
||||
return firstRowIndex + rowSpan - 1;
|
||||
}
|
||||
|
||||
public int getFirstCol() {
|
||||
return firstColIndex;
|
||||
}
|
||||
|
||||
public int getLastCol() {
|
||||
return firstColIndex + colSpan - 1;
|
||||
}
|
||||
|
||||
public int getColSpan(){
|
||||
return colSpan;
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
+21
@@ -0,0 +1,21 @@
|
||||
package com.jero.modules.compare.utils.treeTool;
|
||||
|
||||
import java.util.Comparator;
|
||||
|
||||
/**
|
||||
* List 排序 Comparator
|
||||
* @author david
|
||||
*/
|
||||
public class OrdNamComparator implements Comparator<TreeNode> {
|
||||
|
||||
@Override
|
||||
public int compare(TreeNode t1, TreeNode t2) {
|
||||
if (t1.getOrderNum() > t2.getOrderNum()) {
|
||||
return 1;
|
||||
}
|
||||
if (t1.getOrderNum() < t2.getOrderNum()) {
|
||||
return -1;
|
||||
}
|
||||
return t1.getNodeName().compareTo(t2.getNodeName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
package com.jero.modules.compare.utils.treeTool;
|
||||
|
||||
import com.jero.modules.compare.utils.treeTool.annotation.*;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 构建树形建构
|
||||
*
|
||||
* @author David
|
||||
*/
|
||||
public class Tree<T> {
|
||||
/**
|
||||
* 用于存放treeNode的Map
|
||||
*/
|
||||
private LinkedHashMap<String, TreeNode> treeNodesMap = new LinkedHashMap<>();
|
||||
/**
|
||||
* 用于存放treeNode的list
|
||||
*/
|
||||
private List<TreeNode> treeNodesList = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 构造方法
|
||||
*
|
||||
* @param list
|
||||
*/
|
||||
public Tree(List<T> list) {
|
||||
initTreeNodeMap(list);
|
||||
initTreeNodeList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 将List对象数据转为TreeNodeMap
|
||||
*
|
||||
* @param list
|
||||
*/
|
||||
private void initTreeNodeMap(List<T> list) {
|
||||
TreeNode treeNode;
|
||||
for (Object item : list) {
|
||||
treeNode = new TreeNode();
|
||||
treeNode.setNodeId(getFieldValue(item, "TreeNodeId"));
|
||||
treeNode.setNodeName(getFieldValue(item, "TreeNodeName"));
|
||||
treeNode.setParentNodeId(getFieldValue(item, "TreeNodeParentId"));
|
||||
if(StringUtils.isEmpty(getFieldValue(item, "TreeNodeLevel"))) {
|
||||
treeNode.setLevel(0);
|
||||
} else {
|
||||
treeNode.setLevel(Integer.parseInt(getFieldValue(item, "TreeNodeLevel")));
|
||||
}
|
||||
if(StringUtils.isEmpty(getFieldValue(item, "TreeNodeOrder"))) {
|
||||
treeNode.setOrderNum(0);
|
||||
} else {
|
||||
treeNode.setOrderNum(Integer.parseInt(getFieldValue(item, "TreeNodeOrder")));
|
||||
}
|
||||
treeNode.setLastNodeNum(1);
|
||||
treeNode.setData(item);
|
||||
treeNodesMap.put(treeNode.getNodeId(), treeNode);
|
||||
}
|
||||
Iterator<TreeNode> iterator = treeNodesMap.values().iterator();
|
||||
TreeNode parentTreeNode;
|
||||
while (iterator.hasNext()) {
|
||||
treeNode = iterator.next();
|
||||
if (StringUtils.isEmpty(treeNode.getParentNodeId())) {
|
||||
continue;
|
||||
}
|
||||
parentTreeNode = treeNodesMap.get(treeNode.getParentNodeId());
|
||||
if (parentTreeNode != null) {
|
||||
treeNode.setParent(parentTreeNode);
|
||||
parentTreeNode.addChild(treeNode);
|
||||
// 按照orderNum排序
|
||||
Collections.sort(parentTreeNode.getChildren(), new OrdNamComparator());
|
||||
// 判断这个节点是否是最子节点
|
||||
if (treeNode.getChildren().size() == 0) {
|
||||
treeNode.setLastNode(true);
|
||||
}
|
||||
// 计算每一个节点的最子节点的数量
|
||||
List<TreeNode> children = parentTreeNode.getChildren();
|
||||
if (children.size() > 0) {
|
||||
int sum = 0;
|
||||
for (TreeNode treeNode2 : children) {
|
||||
sum += treeNode2.getLastNodeNum();
|
||||
}
|
||||
parentTreeNode.setLastNodeNum(sum);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getFieldValue(Object obj, String type) {
|
||||
Class clz = obj.getClass();
|
||||
Field[] fields = clz.getDeclaredFields();
|
||||
String value = null;
|
||||
try {
|
||||
for(Field field : fields){
|
||||
field.setAccessible(true);
|
||||
switch (type){
|
||||
case "TreeNodeId":
|
||||
if(field.isAnnotationPresent(TreeNodeId.class)) {
|
||||
value = String.valueOf(field.get(obj));
|
||||
}
|
||||
break;
|
||||
case "TreeNodeParentId":
|
||||
if(field.isAnnotationPresent(TreeNodeParentId.class)) {
|
||||
value = String.valueOf(field.get(obj));
|
||||
}
|
||||
break;
|
||||
case "TreeNodeName":
|
||||
if(field.isAnnotationPresent(TreeNodeName.class)) {
|
||||
value = String.valueOf(field.get(obj));
|
||||
}
|
||||
break;
|
||||
case "TreeNodeOrder":
|
||||
if(field.isAnnotationPresent(TreeNodeOrder.class)) {
|
||||
value = String.valueOf(field.get(obj));
|
||||
}
|
||||
break;
|
||||
case "TreeNodeLevel":
|
||||
if(field.isAnnotationPresent(TreeNodeLevel.class)) {
|
||||
value = String.valueOf(field.get(obj));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据treeNodesMap转为treeNodesList
|
||||
*/
|
||||
private void initTreeNodeList() {
|
||||
if (treeNodesList.size() > 0) {
|
||||
return;
|
||||
}
|
||||
if (treeNodesMap.size() == 0) {
|
||||
return;
|
||||
}
|
||||
Iterator<TreeNode> iterator = treeNodesMap.values().iterator();
|
||||
TreeNode treeNode;
|
||||
while (iterator.hasNext()) {
|
||||
treeNode = iterator.next();
|
||||
if (treeNode.getParent() == null) {
|
||||
this.treeNodesList.add(treeNode);
|
||||
this.treeNodesList.addAll(treeNode.getAllChildren());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<TreeNode> getTree() {
|
||||
return this.treeNodesList;
|
||||
}
|
||||
|
||||
public List<TreeNode> getRoot() {
|
||||
List<TreeNode> rootList = new ArrayList<>();
|
||||
if (this.treeNodesList.size() > 0) {
|
||||
for (TreeNode node : treeNodesList) {
|
||||
if (node.getParent() == null) {
|
||||
rootList.add(node);
|
||||
Collections.sort(rootList, new OrdNamComparator());
|
||||
}
|
||||
}
|
||||
}
|
||||
return rootList;
|
||||
}
|
||||
|
||||
public TreeNode getTreeNode(String nodeId) {
|
||||
return this.treeNodesMap.get(nodeId);
|
||||
}
|
||||
}
|
||||
+202
@@ -0,0 +1,202 @@
|
||||
package com.jero.modules.compare.utils.treeTool;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author David
|
||||
*/
|
||||
public class TreeNode {
|
||||
|
||||
/**
|
||||
* 树节点ID
|
||||
*/
|
||||
@JSONField(ordinal = 1)
|
||||
private String nodeId;
|
||||
/**
|
||||
* 树节点名称
|
||||
*/
|
||||
@JSONField(ordinal = 2)
|
||||
private String nodeName;
|
||||
/**
|
||||
* 父节点ID
|
||||
*/
|
||||
@JSONField(ordinal = 3)
|
||||
private String parentNodeId;
|
||||
/**
|
||||
* 节点在树中的排序号
|
||||
*/
|
||||
@JSONField(ordinal = 4)
|
||||
private int orderNum;
|
||||
/**
|
||||
* 节点所在的层级
|
||||
*/
|
||||
@JSONField(ordinal = 5)
|
||||
private int level;
|
||||
/**
|
||||
* 最子节点的数量
|
||||
*/
|
||||
@JSONField(ordinal = 6)
|
||||
private int lastNodeNum;
|
||||
|
||||
/**
|
||||
* 是否是最子节点
|
||||
*/
|
||||
@JSONField(ordinal = 7)
|
||||
private boolean lastNode;
|
||||
|
||||
private Object data;
|
||||
|
||||
/**
|
||||
* 当前节点的儿子节点
|
||||
*/
|
||||
@JSONField(ordinal = 8)
|
||||
private List<TreeNode> children = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 当前节点的完整路径
|
||||
*/
|
||||
@JSONField(ordinal = 9)
|
||||
private String completeName;
|
||||
|
||||
/**
|
||||
* 当前节点的父级节点
|
||||
* 转json的时候忽略此属性,因为此属性到前端无作用
|
||||
*/
|
||||
@JSONField(serialize = false)
|
||||
private TreeNode parent;
|
||||
|
||||
/**
|
||||
* 当前节点的子孙节点
|
||||
* 转json的时候忽略此属性,因为此属性到前端无作用
|
||||
*/
|
||||
@JSONField(serialize = false)
|
||||
private List<TreeNode> allChildren = new ArrayList<>();
|
||||
|
||||
private int standFlag;
|
||||
|
||||
public TreeNode(TreeNode obj) {
|
||||
this.orderNum = obj.getOrderNum();
|
||||
this.level = obj.getLevel();
|
||||
this.lastNodeNum = obj.getLastNodeNum();
|
||||
}
|
||||
|
||||
public TreeNode() {
|
||||
}
|
||||
|
||||
public void addChild(TreeNode treeNode) {
|
||||
this.children.add(treeNode);
|
||||
}
|
||||
|
||||
public void removeChild(TreeNode treeNode) {
|
||||
this.children.remove(treeNode);
|
||||
}
|
||||
|
||||
public String getNodeId() {
|
||||
return nodeId;
|
||||
}
|
||||
|
||||
public void setNodeId(String nodeId) {
|
||||
this.nodeId = nodeId;
|
||||
}
|
||||
|
||||
public String getNodeName() {
|
||||
return nodeName;
|
||||
}
|
||||
|
||||
public void setNodeName(String nodeName) {
|
||||
this.nodeName = nodeName;
|
||||
}
|
||||
|
||||
public String getParentNodeId() {
|
||||
return parentNodeId;
|
||||
}
|
||||
|
||||
public void setParentNodeId(String parentNodeId) {
|
||||
this.parentNodeId = parentNodeId;
|
||||
}
|
||||
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(int level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public TreeNode getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void setParent(TreeNode parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public List<TreeNode> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<TreeNode> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public int getOrderNum() {
|
||||
return orderNum;
|
||||
}
|
||||
|
||||
public void setOrderNum(int orderNum) {
|
||||
this.orderNum = orderNum;
|
||||
}
|
||||
|
||||
public int getLastNodeNum() {
|
||||
return lastNodeNum;
|
||||
}
|
||||
|
||||
public void setLastNodeNum(int lastNodeNum) {
|
||||
this.lastNodeNum = lastNodeNum;
|
||||
}
|
||||
|
||||
public boolean isLastNode() {
|
||||
return lastNode;
|
||||
}
|
||||
|
||||
public void setLastNode(boolean lastNode) {
|
||||
this.lastNode = lastNode;
|
||||
}
|
||||
|
||||
public List<TreeNode> getAllChildren() {
|
||||
if (this.allChildren.isEmpty()) {
|
||||
for (TreeNode treeNode : this.children) {
|
||||
this.allChildren.add(treeNode);
|
||||
this.allChildren.addAll(treeNode.getAllChildren());
|
||||
}
|
||||
}
|
||||
return this.allChildren;
|
||||
}
|
||||
|
||||
public String getCompleteName() {
|
||||
return completeName;
|
||||
}
|
||||
|
||||
public void setCompleteName(String completeName) {
|
||||
this.completeName = completeName;
|
||||
}
|
||||
|
||||
public Object getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(Object data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public int getStandFlag() {
|
||||
return standFlag;
|
||||
}
|
||||
|
||||
public void setStandFlag(int standFlag) {
|
||||
this.standFlag = standFlag;
|
||||
}
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.jero.modules.compare.utils.treeTool.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author david
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD})
|
||||
@Documented
|
||||
public @interface TreeNodeId {
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.jero.modules.compare.utils.treeTool.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author david
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD})
|
||||
@Documented
|
||||
public @interface TreeNodeLevel {
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.jero.modules.compare.utils.treeTool.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author david
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD})
|
||||
@Documented
|
||||
public @interface TreeNodeName {
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.jero.modules.compare.utils.treeTool.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author david
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD})
|
||||
@Documented
|
||||
public @interface TreeNodeOrder {
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.jero.modules.compare.utils.treeTool.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* @author david
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target({ElementType.FIELD})
|
||||
@Documented
|
||||
public @interface TreeNodeParentId {
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
package com.jero.modules.docTranslation.enums;
|
||||
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
/**
|
||||
* 发布情况枚举类
|
||||
*/
|
||||
public enum ReleaseConditionEnum {
|
||||
|
||||
PUBLISHED("已发布","published","Published"),
|
||||
DRAFT("草稿","draft","Draft"),
|
||||
;
|
||||
|
||||
|
||||
String cnName;
|
||||
String enName;
|
||||
String value;
|
||||
|
||||
private ReleaseConditionEnum(String cnName, String value, String enName) {
|
||||
this.cnName = cnName;
|
||||
this.value = value;
|
||||
this.enName = enName;
|
||||
}
|
||||
|
||||
public String getCnName() {
|
||||
return cnName;
|
||||
}
|
||||
|
||||
public void setCnName(String cnName) {
|
||||
this.cnName = cnName;
|
||||
}
|
||||
|
||||
public String getEnName() {
|
||||
return enName;
|
||||
}
|
||||
|
||||
public void setEnName(String enName) {
|
||||
this.enName = enName;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static String getTextByValue(String value,String cut) {
|
||||
ReleaseConditionEnum[] values = values();
|
||||
for (ReleaseConditionEnum releaseConditionEnum : values) {
|
||||
if (releaseConditionEnum.value.equals(value)) {
|
||||
if(StringUtils.equals(cut, CutEnum.CN.getValue())){
|
||||
return releaseConditionEnum.cnName;
|
||||
}else if(StringUtils.equals(cut, CutEnum.EN.getValue())){
|
||||
return releaseConditionEnum.enName;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+524
@@ -0,0 +1,524 @@
|
||||
package com.jero.modules.document.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.modules.document.entity.BussDocumentLibraryEO;
|
||||
import com.jero.modules.document.entity.OSSFileForDocumentLibrary;
|
||||
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 文档库信息表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-01-21
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="文档库信息表")
|
||||
@RestController
|
||||
@RequestMapping("/document/bussDocumentLibraryEO")
|
||||
@Slf4j
|
||||
public class BussDocumentLibraryEOController extends JeroController<BussDocumentLibraryEO, IBussDocumentLibraryEOService> {
|
||||
@Autowired
|
||||
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
* @param parameter
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "分页查询")
|
||||
@ApiOperation(value="分页查询", notes="分页查询")
|
||||
@PostMapping(value = "/queryPageInfo")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("document:queryPageInfo")
|
||||
public JSONObject queryPageInfo(@RequestBody Map<String,Object> parameter) {
|
||||
IPage infoPage = bussDocumentLibraryEOService.getInfoPage(parameter);
|
||||
Result<IPage> ok = Result.OK(infoPage);
|
||||
JSONObject jsonResult = JSONObject.fromObject(ok);
|
||||
return jsonResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 代替标准分页列表查询
|
||||
* @param parameter
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "代替标准分页列表查询")
|
||||
@ApiOperation(value="代替标准分页列表查询", notes="代替标准分页列表查询")
|
||||
@PostMapping(value = "/replacePageInfo")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("document:getInfoById")
|
||||
public Result<IPage> replacePageInfo(@RequestBody Map<String,Object> parameter) {
|
||||
IPage infoPage = bussDocumentLibraryEOService.replacePageInfo(parameter);
|
||||
return Result.OK(infoPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* ocr识别调取已入库文件
|
||||
* @param parameter
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "ocr识别调取已入库文件分页")
|
||||
@ApiOperation(value="ocr识别调取已入库文件", notes="ocr识别调取已入库文件")
|
||||
@PostMapping(value = "/ocrPageInfo")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("document:ocrPageInfo")
|
||||
public Result<IPage<Map<String,Object>>> ocrPageInfo(@RequestBody Map<String,Object> parameter) {
|
||||
IPage<Map<String,Object>> infoPage = bussDocumentLibraryEOService.ocrPageInfo(parameter);
|
||||
return Result.OK(infoPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 文档翻译调取已入库文件
|
||||
* @param parameter
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档翻译调取已入库文件")
|
||||
@ApiOperation(value="文档翻译调取已入库文件", notes="文档翻译调取已入库文件")
|
||||
@PostMapping(value = "/transPageInfo")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("documentTranslation:retrieval")
|
||||
public Result<IPage<Map<String,Object>>> transPageInfo(@RequestBody Map<String,Object> parameter) {
|
||||
IPage<Map<String,Object>> infoPage = bussDocumentLibraryEOService.ocrPageInfo(parameter);
|
||||
return Result.OK(infoPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库信息表-列表查询")
|
||||
@ApiOperation(value="文档库信息表-列表查询", notes="文档库信息表-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<BussDocumentLibraryEO>> queryList() {
|
||||
List<BussDocumentLibraryEO> list = bussDocumentLibraryEOService.queryList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库信息表-通过id删除")
|
||||
@ApiOperation(value="文档库信息表-通过id删除", notes="文档库信息表-通过id删除")
|
||||
@GetMapping(value = "/delete")
|
||||
@RequiresPermissions("document:deleteBatch")
|
||||
public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
||||
bussDocumentLibraryEOService.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库信息表-批量删除")
|
||||
@ApiOperation(value="文档库信息表-批量删除", notes="文档库信息表-批量删除")
|
||||
@GetMapping(value = "/deleteBatch")
|
||||
@RequiresPermissions("document:deleteBatch")
|
||||
public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids, String cut) {
|
||||
this.bussDocumentLibraryEOService.deleteByIds(Arrays.asList(ids.split(",")),cut);
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库信息表-通过id查询")
|
||||
@ApiOperation(value="文档库信息表-通过id查询", notes="文档库信息表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
@RequiresPermissions("document:queryById")
|
||||
public Result<BussDocumentLibraryEO> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(id);
|
||||
if(bussDocumentLibraryEO==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(bussDocumentLibraryEO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 列表查询条件 标识传 1-->用于查询文档库字段属性
|
||||
* @param flag
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库信息表-查询条件")
|
||||
@ApiOperation(value="文档库信息表-查询条件", notes="文档库信息表-查询条件")
|
||||
@GetMapping(value = "/queryCondition")
|
||||
@RequiresPermissions("document:queryPageInfo")
|
||||
public Result<List<Map<String,Object>>> queryCondition(@RequestParam(name="flag",required=true) String flag,
|
||||
@RequestParam(name="cut",required=true) String cut) {
|
||||
List<Map<String,Object>> list = bussDocumentLibraryEOService.queryCondition(flag,cut,null);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表表头
|
||||
* @param flag 标识传 1-->用于查询文档库字段属性
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库信息表-列表表头")
|
||||
@ApiOperation(value="文档库信息表-列表表头", notes="文档库信息表-列表表头")
|
||||
@GetMapping(value = "/getHeader")
|
||||
@RequiresPermissions("document:queryPageInfo")
|
||||
public Result<List<Map<String,Object>>> getHeader(@RequestParam(name="flag",required=true) String flag,
|
||||
@RequestParam(name="cut",required=true) String cut) {
|
||||
List<Map<String,Object>> list = bussDocumentLibraryEOService.getHeader(flag,cut,null);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增表单
|
||||
* @param flag 标识传 1-->用于查询文档库字段属性
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库信息表-新增表单")
|
||||
@ApiOperation(value="文档库信息表-新增表单", notes="文档库信息表-新增表单")
|
||||
@GetMapping(value = "/getAddForm")
|
||||
@RequiresPermissions("document:queryPageInfo")
|
||||
public Result<List<Map<String,Object>>> getAddForm(@RequestParam(name="flag",required=true) String flag,
|
||||
@RequestParam(name="cut",required=true) String cut,
|
||||
@RequestParam(name="type",required=true) String type) {
|
||||
List<Map<String, Object>> list = bussDocumentLibraryEOService.getAddForm(flag,cut,type);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* ocr识别调取已入库文件-中英文切换
|
||||
* @param flag 标识传 1-->用于查询文档库字段属性
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库信息表-ocr表头和查询条件")
|
||||
@ApiOperation(value="文档库信息表-ocr表头和查询条件", notes="文档库信息表-ocr表头和查询条件")
|
||||
@GetMapping(value = "/getHeaderOrConditionForOcr")
|
||||
@RequiresPermissions("document:ocrPageInfo")
|
||||
public Result<List<Map<String,Object>>> getHeaderOrConditionForOcr(@RequestParam(name="flag",required=true) String flag,
|
||||
@RequestParam(name="cut",required=true) String cut) {
|
||||
List<Map<String, Object>> list = bussDocumentLibraryEOService.getHeaderOrConditionForOcr(flag,cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param flag 标识传 1-->用于查询文档库字段属性
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库信息表-文档拆分表头和查询条件")
|
||||
@ApiOperation(value="文档库信息表-文档拆分表头和查询条件", notes="文档库信息表-文档拆分表头和查询条件")
|
||||
@GetMapping(value = "/getHeaderOrConditionForSplitFile")
|
||||
@RequiresPermissions("split:sarFileSplitInfo:splitFile")
|
||||
public Result<List<Map<String,Object>>> getHeaderOrConditionForSplitFile(@RequestParam(name="flag",required=true) String flag,
|
||||
@RequestParam(name="cut",required=true) String cut) {
|
||||
List<Map<String, Object>> list = bussDocumentLibraryEOService.getHeaderOrConditionForSplit(flag,cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* ocr识别调取已入库文件-中英文切换
|
||||
* @param flag 标识传 1-->用于查询文档库字段属性
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库信息表-文档拆分表头和查询条件")
|
||||
@ApiOperation(value="文档库信息表-文档拆分表头和查询条件", notes="文档库信息表-文档拆分表头和查询条件")
|
||||
@GetMapping(value = "/getHeaderOrConditionForSplitResult")
|
||||
@RequiresPermissions("split:sarFileSplitInfo:splitResult")
|
||||
public Result<List<Map<String,Object>>> getHeaderOrConditionForSplitResult(@RequestParam(name="flag",required=true) String flag,
|
||||
@RequestParam(name="cut",required=true) String cut) {
|
||||
List<Map<String, Object>> list = bussDocumentLibraryEOService.getHeaderOrConditionForSplit(flag,cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "编辑数据查询")
|
||||
@ApiOperation(value="编辑数据查询", notes="编辑数据查询")
|
||||
@GetMapping(value = "/getDocumentInfoById")
|
||||
@RequiresPermissions("document:updateInfo")
|
||||
public Result<List<Map<String,Object>>> getDocumentInfoById(@RequestParam(name="id",required=true) String id,
|
||||
@RequestParam(name="cut",required=true) String cut) {
|
||||
List<Map<String, Object>> list = bussDocumentLibraryEOService.getDocumentInfoById(id,cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
/**
|
||||
* 详情数据查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "详情数据查询")
|
||||
@ApiOperation(value="详情数据查询", notes="详情数据查询")
|
||||
@GetMapping(value = "/getInfoById")
|
||||
@RequiresPermissions("document:queryPageInfo")
|
||||
public Result<List<Map<String,Object>>> getInfoById(@RequestParam(name="id",required=true) String id,
|
||||
@RequestParam(name="cut",required=true) String cut) {
|
||||
List<Map<String, Object>> list = bussDocumentLibraryEOService.getInfoById(id,cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value="详情目录查询", notes="详情目录查询")
|
||||
@GetMapping(value = "/getMenuList")
|
||||
public Result<List<Map<String,Object>>> getMenuList(@RequestParam(name="id",required=true) String id,
|
||||
@RequestParam(name="cut",required=true) String cut) {
|
||||
List<Map<String, Object>> list = bussDocumentLibraryEOService.getMenuList(id,cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "新增数据")
|
||||
@ApiOperation(value="新增数据", notes="新增数据")
|
||||
@PostMapping(value = "/addInfo")
|
||||
@RequiresPermissions("document:getInfoById")
|
||||
public Result<String> getInfoById(@RequestBody Map<String,Object> map) {
|
||||
try {
|
||||
bussDocumentLibraryEOService.addInfo(map);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
return Result.OK("新增成功");
|
||||
}
|
||||
/**
|
||||
* 编辑数据
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "编辑数据")
|
||||
@ApiOperation(value="编辑数据", notes="编辑数据")
|
||||
@PostMapping(value = "/updateInfo")
|
||||
@RequiresPermissions("document:updateInfo")
|
||||
public Result<String> updateInfo(@RequestBody Map<String,Object> map) {
|
||||
try {
|
||||
bussDocumentLibraryEOService.updateInfo(map);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
return Result.OK("编辑成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加收藏
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "添加收藏")
|
||||
@ApiOperation(value="添加收藏", notes="添加收藏")
|
||||
@GetMapping(value = "/addCollect")
|
||||
@RequiresPermissions("document:addCollect")
|
||||
public Result<String> addCollect(String id) {
|
||||
try {
|
||||
bussDocumentLibraryEOService.addCollect(id);
|
||||
} catch (Exception e) {
|
||||
return Result.error("收藏失败");
|
||||
}
|
||||
return Result.OK("收藏成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消收藏
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "取消收藏")
|
||||
@ApiOperation(value="取消收藏", notes="取消收藏")
|
||||
@GetMapping(value = "/cancelCollect")
|
||||
@RequiresPermissions("document:addCollect")
|
||||
public Result<String> cancelCollect(String id) {
|
||||
try {
|
||||
bussDocumentLibraryEOService.cancelCollect(id);
|
||||
} catch (Exception e) {
|
||||
return Result.error("取消收藏失败");
|
||||
}
|
||||
return Result.OK("取消收藏成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加订阅
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "添加订阅")
|
||||
@ApiOperation(value="添加订阅", notes="添加订阅")
|
||||
@GetMapping(value = "/addSubscribe")
|
||||
@RequiresPermissions("document:addSubscribe")
|
||||
public Result<String> addSubscribe(String id) {
|
||||
try {
|
||||
bussDocumentLibraryEOService.addSubscribe(id);
|
||||
} catch (Exception e) {
|
||||
return Result.error("订阅失败");
|
||||
}
|
||||
return Result.OK("订阅成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消订阅
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "取消订阅")
|
||||
@ApiOperation(value="取消订阅", notes="取消订阅")
|
||||
@GetMapping(value = "/cancelSubscribe")
|
||||
@RequiresPermissions("document:addSubscribe")
|
||||
public Result<String> cancelSubscribe(String id) {
|
||||
try {
|
||||
bussDocumentLibraryEOService.cancelSubscribe(id);
|
||||
} catch (Exception e) {
|
||||
return Result.error("取消订阅失败");
|
||||
}
|
||||
return Result.OK("取消订阅成功");
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "导出excel")
|
||||
@GetMapping(value = "/exportExcel")
|
||||
@RequiresPermissions("document:exportExcel")
|
||||
public void exportExcel(@RequestParam Map<String,Object> map,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request){
|
||||
bussDocumentLibraryEOService.exportExcel(map,response,request);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "带文件导出")
|
||||
@GetMapping(value = "/exportZip")
|
||||
@RequiresPermissions("document:exportZip")
|
||||
public void exportZip(@RequestParam Map<String,Object> map,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) throws Exception {
|
||||
bussDocumentLibraryEOService.exportZip(map,response,request);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "模板下载")
|
||||
@GetMapping(value = "/exportTemplate")
|
||||
@RequiresPermissions("document:exportTemplate")
|
||||
public void exportTemplate(@RequestParam Map<String,Object> map, HttpServletResponse response, HttpServletRequest request) throws Exception {
|
||||
bussDocumentLibraryEOService.exportTemplate(map,response,request);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "导入.zip")
|
||||
@PostMapping(value = "/importZip")
|
||||
@RequiresPermissions("document:importZip")
|
||||
public Result<String> importZip(@RequestParam(value = "file", required = false) MultipartFile file,
|
||||
@RequestParam(value = "cut",required = false) String cut) {
|
||||
try {
|
||||
bussDocumentLibraryEOService.importZip(file,cut);
|
||||
} catch (Exception e) {
|
||||
log.error(null,e);
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
return Result.OK("导入成功");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "推送")
|
||||
@GetMapping(value = "/pullMessage")
|
||||
@RequiresPermissions("document:pullMessage")
|
||||
public Result<String> pullMessage(String departIds, String userIds, String documentIds) {
|
||||
|
||||
bussDocumentLibraryEOService.pullMessage(departIds,userIds,documentIds);
|
||||
|
||||
return Result.OK("推送成功");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 验证文档是否被其他的文档绑定
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "验证文档是否被其他的文档绑定")
|
||||
@ApiOperation(value="验证文档是否被其他的文档绑定", notes="验证文档是否被其他的文档绑定")
|
||||
@GetMapping(value = "/verifyBind")
|
||||
public Result<String> verifyBind(@RequestParam(name="ids",required=true) String ids) {
|
||||
String msg = bussDocumentLibraryEOService.verifyBind(Arrays.asList(ids.split(",")));
|
||||
return Result.OK(msg);
|
||||
}
|
||||
|
||||
@AutoLog(value = "虚拟中心添加调用文档库数据--分页")
|
||||
@ApiOperation(value="虚拟中心添加调用文档库数据--分页", notes="虚拟中心添加调用文档库数据--分页")
|
||||
@PostMapping(value = "/queryPageInfoDummy")
|
||||
public Result<IPage<BussDocumentLibraryEO>> queryPageInfoDummy(@RequestBody BussDocumentLibraryEO bussDocumentLibraryEO,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<BussDocumentLibraryEO> queryWrapper = QueryGenerator.initQueryWrapper(bussDocumentLibraryEO, req.getParameterMap());
|
||||
Page<BussDocumentLibraryEO> page = new Page<BussDocumentLibraryEO>(bussDocumentLibraryEO.getPageNo(), bussDocumentLibraryEO.getPageSize());
|
||||
IPage<BussDocumentLibraryEO> pageList = bussDocumentLibraryEOService.queryPageInfoDummy(page, queryWrapper,bussDocumentLibraryEO);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value="虚拟中心添加调用文档库数据--分页", notes="虚拟中心添加调用文档库数据--分页")
|
||||
@PostMapping(value = "/queryPageDummy")
|
||||
@ResponseBody
|
||||
public JSONObject queryPageDummy(@RequestBody Map<String,Object> parameter) {
|
||||
IPage infoPage = bussDocumentLibraryEOService.getPageDummy(parameter);
|
||||
Result<IPage> ok = Result.OK(infoPage);
|
||||
JSONObject jsonResult = JSONObject.fromObject(ok);
|
||||
return jsonResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看已上传的文件
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value="查看已上传的文件", notes="查看已上传的文件")
|
||||
@GetMapping(value = "/getFileInfos")
|
||||
@RequiresPermissions("document:queryPageInfo")
|
||||
public Result<List<OSSFileForDocumentLibrary>> getFileInfos(String id) {
|
||||
List<OSSFileForDocumentLibrary> fileInfos = bussDocumentLibraryEOService.getFileInfos(id);
|
||||
return Result.OK(fileInfos);
|
||||
}
|
||||
/**
|
||||
* 根据id查询编号和标题
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value="查看已上传的文件", notes="查看已上传的文件")
|
||||
@GetMapping(value = "/getTitle")
|
||||
public Result<String> getTitle(String id, String cut) {
|
||||
String title = bussDocumentLibraryEOService.getTitle(id, cut);
|
||||
return Result.OK(title);
|
||||
}
|
||||
@ApiOperation(value="编辑ES数据(添加module_type_flag)", notes="编辑ES数据(添加module_type_flag)")
|
||||
@GetMapping(value = "/updateES")
|
||||
public Result<Integer> getTitle() {
|
||||
int count = bussDocumentLibraryEOService.updateES();
|
||||
return Result.OK(count);
|
||||
}
|
||||
}
|
||||
+173
@@ -0,0 +1,173 @@
|
||||
package com.jero.modules.document.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.modules.document.entity.PhasedImplementationDetailsEO;
|
||||
import com.jero.modules.document.service.IPhasedImplementationDetailsEOService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 文档库-分阶段实施详情表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-02-22
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="文档库-分阶段实施详情表")
|
||||
@RestController
|
||||
@RequestMapping("/document/phasedImplementationDetailsEO")
|
||||
@Slf4j
|
||||
public class PhasedImplementationDetailsEOController extends JeroController<PhasedImplementationDetailsEO, IPhasedImplementationDetailsEOService> {
|
||||
@Autowired
|
||||
private IPhasedImplementationDetailsEOService phasedImplementationDetailsEOService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param phasedImplementationDetailsEO
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库-分阶段实施详情表-分页列表查询")
|
||||
@ApiOperation(value="文档库-分阶段实施详情表-分页列表查询", notes="文档库-分阶段实施详情表-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(PhasedImplementationDetailsEO phasedImplementationDetailsEO,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
@RequestParam(name="cut", defaultValue="cn") String cut,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<PhasedImplementationDetailsEO> queryWrapper = QueryGenerator.initQueryWrapper(phasedImplementationDetailsEO, req.getParameterMap());
|
||||
Page<PhasedImplementationDetailsEO> page = new Page<PhasedImplementationDetailsEO>(pageNo, pageSize);
|
||||
IPage<PhasedImplementationDetailsEO> pageList = phasedImplementationDetailsEOService.page(page, queryWrapper);
|
||||
this.phasedImplementationDetailsEOService.disposeData(pageList.getRecords(),cut);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库-分阶段实施详情表-列表查询")
|
||||
@ApiOperation(value="文档库-分阶段实施详情表-列表查询", notes="文档库-分阶段实施详情表-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<PhasedImplementationDetailsEO>> queryList() {
|
||||
List<PhasedImplementationDetailsEO> list = phasedImplementationDetailsEOService.queryList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param phasedImplementationDetailsEO
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库-分阶段实施详情表-添加")
|
||||
@ApiOperation(value="文档库-分阶段实施详情表-添加", notes="文档库-分阶段实施详情表-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody PhasedImplementationDetailsEO phasedImplementationDetailsEO) {
|
||||
phasedImplementationDetailsEOService.add(phasedImplementationDetailsEO);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param phasedImplementationDetailsEO
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库-分阶段实施详情表-编辑")
|
||||
@ApiOperation(value="文档库-分阶段实施详情表-编辑", notes="文档库-分阶段实施详情表-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody PhasedImplementationDetailsEO phasedImplementationDetailsEO) {
|
||||
phasedImplementationDetailsEOService.editById(phasedImplementationDetailsEO);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库-分阶段实施详情表-通过id删除")
|
||||
@ApiOperation(value="文档库-分阶段实施详情表-通过id删除", notes="文档库-分阶段实施详情表-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
phasedImplementationDetailsEOService.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库-分阶段实施详情表-批量删除")
|
||||
@ApiOperation(value="文档库-分阶段实施详情表-批量删除", notes="文档库-分阶段实施详情表-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.phasedImplementationDetailsEOService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库-分阶段实施详情表-通过id查询")
|
||||
@ApiOperation(value="文档库-分阶段实施详情表-通过id查询", notes="文档库-分阶段实施详情表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
PhasedImplementationDetailsEO phasedImplementationDetailsEO = phasedImplementationDetailsEOService.queryById(id);
|
||||
if(phasedImplementationDetailsEO==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(phasedImplementationDetailsEO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param phasedImplementationDetailsEO
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, PhasedImplementationDetailsEO phasedImplementationDetailsEO) {
|
||||
return super.exportXls(request, phasedImplementationDetailsEO, PhasedImplementationDetailsEO.class, "文档库-分阶段实施详情表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, PhasedImplementationDetailsEO.class);
|
||||
}
|
||||
|
||||
}
|
||||
+526
@@ -0,0 +1,526 @@
|
||||
package com.jero.modules.document.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.modules.document.entity.BussDocumentLibraryEO;
|
||||
import com.jero.modules.document.entity.OSSFileForDocumentLibrary;
|
||||
import com.jero.modules.document.service.IBussDocumentLibraryEOService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 文档库信息表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-01-21
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="文档库信息表")
|
||||
@RestController
|
||||
@RequestMapping("/phone/document/bussDocumentLibraryEO")
|
||||
@Slf4j
|
||||
public class PhoneBussDocumentLibraryEOController extends JeroController<BussDocumentLibraryEO, IBussDocumentLibraryEOService> {
|
||||
@Autowired
|
||||
private IBussDocumentLibraryEOService bussDocumentLibraryEOService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
* @param parameter
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "分页查询")
|
||||
@ApiOperation(value="分页查询", notes="分页查询")
|
||||
@PostMapping(value = "/queryPageInfo")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("document:queryPageInfo")
|
||||
public JSONObject queryPageInfo(@RequestBody Map<String,Object> parameter) {
|
||||
IPage infoPage = bussDocumentLibraryEOService.getInfoPage(parameter);
|
||||
Result<IPage> ok = Result.OK(infoPage);
|
||||
JSONObject jsonResult = JSONObject.fromObject(ok);
|
||||
return jsonResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 代替标准分页列表查询
|
||||
* @param parameter
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "代替标准分页列表查询")
|
||||
@ApiOperation(value="代替标准分页列表查询", notes="代替标准分页列表查询")
|
||||
@PostMapping(value = "/replacePageInfo")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("document:getInfoById")
|
||||
public Result<?> replacePageInfo(@RequestBody Map<String,Object> parameter) {
|
||||
IPage infoPage = bussDocumentLibraryEOService.replacePageInfo(parameter);
|
||||
// Result<IPage> ok = Result.OK(infoPage);
|
||||
// JSONObject jsonResult = JSONObject.fromObject(ok);
|
||||
return Result.OK(infoPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* ocr识别调取已入库文件
|
||||
* @param parameter
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "ocr识别调取已入库文件分页")
|
||||
@ApiOperation(value="ocr识别调取已入库文件", notes="ocr识别调取已入库文件")
|
||||
@PostMapping(value = "/ocrPageInfo")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("document:ocrPageInfo")
|
||||
public Result<IPage<Map<String,Object>>> ocrPageInfo(@RequestBody Map<String,Object> parameter) {
|
||||
IPage<Map<String,Object>> infoPage = bussDocumentLibraryEOService.ocrPageInfo(parameter);
|
||||
return Result.OK(infoPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 文档翻译调取已入库文件
|
||||
* @param parameter
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档翻译调取已入库文件")
|
||||
@ApiOperation(value="文档翻译调取已入库文件", notes="文档翻译调取已入库文件")
|
||||
@PostMapping(value = "/transPageInfo")
|
||||
@ResponseBody
|
||||
@RequiresPermissions("documentTranslation:retrieval")
|
||||
public Result<IPage<Map<String,Object>>> transPageInfo(@RequestBody Map<String,Object> parameter) {
|
||||
IPage<Map<String,Object>> infoPage = bussDocumentLibraryEOService.ocrPageInfo(parameter);
|
||||
return Result.OK(infoPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库信息表-列表查询")
|
||||
@ApiOperation(value="文档库信息表-列表查询", notes="文档库信息表-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<BussDocumentLibraryEO>> queryList() {
|
||||
List<BussDocumentLibraryEO> list = bussDocumentLibraryEOService.queryList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库信息表-通过id删除")
|
||||
@ApiOperation(value="文档库信息表-通过id删除", notes="文档库信息表-通过id删除")
|
||||
@GetMapping(value = "/delete")
|
||||
@RequiresPermissions("document:deleteBatch")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
bussDocumentLibraryEOService.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库信息表-批量删除")
|
||||
@ApiOperation(value="文档库信息表-批量删除", notes="文档库信息表-批量删除")
|
||||
@GetMapping(value = "/deleteBatch")
|
||||
@RequiresPermissions("document:deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids, String cut) {
|
||||
this.bussDocumentLibraryEOService.deleteByIds(Arrays.asList(ids.split(",")),cut);
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库信息表-通过id查询")
|
||||
@ApiOperation(value="文档库信息表-通过id查询", notes="文档库信息表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
@RequiresPermissions("document:queryById")
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
BussDocumentLibraryEO bussDocumentLibraryEO = bussDocumentLibraryEOService.queryById(id);
|
||||
if(bussDocumentLibraryEO==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(bussDocumentLibraryEO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 列表查询条件 标识传 1-->用于查询文档库字段属性
|
||||
* @param flag
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库信息表-查询条件")
|
||||
@ApiOperation(value="文档库信息表-查询条件", notes="文档库信息表-查询条件")
|
||||
@GetMapping(value = "/queryCondition")
|
||||
@RequiresPermissions("document:queryPageInfo")
|
||||
public Result<List<Map<String,Object>>> queryCondition(@RequestParam(name="flag",required=true) String flag,
|
||||
@RequestParam(name="cut",required=true) String cut) {
|
||||
List<Map<String,Object>> list = bussDocumentLibraryEOService.queryCondition(flag,cut,null);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表表头
|
||||
* @param flag 标识传 1-->用于查询文档库字段属性
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库信息表-列表表头")
|
||||
@ApiOperation(value="文档库信息表-列表表头", notes="文档库信息表-列表表头")
|
||||
@GetMapping(value = "/getHeader")
|
||||
@RequiresPermissions("document:queryPageInfo")
|
||||
public Result<List<Map<String,Object>>> getHeader(@RequestParam(name="flag",required=true) String flag,
|
||||
@RequestParam(name="cut",required=true) String cut) {
|
||||
List<Map<String,Object>> list = bussDocumentLibraryEOService.getHeader(flag,cut,null);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增表单
|
||||
* @param flag 标识传 1-->用于查询文档库字段属性
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库信息表-新增表单")
|
||||
@ApiOperation(value="文档库信息表-新增表单", notes="文档库信息表-新增表单")
|
||||
@GetMapping(value = "/getAddForm")
|
||||
@RequiresPermissions("document:queryPageInfo")
|
||||
public Result<List<Map<String,Object>>> getAddForm(@RequestParam(name="flag",required=true) String flag,
|
||||
@RequestParam(name="cut",required=true) String cut,
|
||||
@RequestParam(name="type",required=true) String type) {
|
||||
List<Map<String, Object>> list = bussDocumentLibraryEOService.getAddForm(flag,cut,type);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* ocr识别调取已入库文件-中英文切换
|
||||
* @param flag 标识传 1-->用于查询文档库字段属性
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库信息表-ocr表头和查询条件")
|
||||
@ApiOperation(value="文档库信息表-ocr表头和查询条件", notes="文档库信息表-ocr表头和查询条件")
|
||||
@GetMapping(value = "/getHeaderOrConditionForOcr")
|
||||
@RequiresPermissions("document:ocrPageInfo")
|
||||
public Result<List<Map<String,Object>>> getHeaderOrConditionForOcr(@RequestParam(name="flag",required=true) String flag,
|
||||
@RequestParam(name="cut",required=true) String cut) {
|
||||
List<Map<String, Object>> list = bussDocumentLibraryEOService.getHeaderOrConditionForOcr(flag,cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param flag 标识传 1-->用于查询文档库字段属性
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库信息表-文档拆分表头和查询条件")
|
||||
@ApiOperation(value="文档库信息表-文档拆分表头和查询条件", notes="文档库信息表-文档拆分表头和查询条件")
|
||||
@GetMapping(value = "/getHeaderOrConditionForSplitFile")
|
||||
@RequiresPermissions("split:sarFileSplitInfo:splitFile")
|
||||
public Result<List<Map<String,Object>>> getHeaderOrConditionForSplitFile(@RequestParam(name="flag",required=true) String flag,
|
||||
@RequestParam(name="cut",required=true) String cut) {
|
||||
List<Map<String, Object>> list = bussDocumentLibraryEOService.getHeaderOrConditionForSplit(flag,cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* ocr识别调取已入库文件-中英文切换
|
||||
* @param flag 标识传 1-->用于查询文档库字段属性
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库信息表-文档拆分表头和查询条件")
|
||||
@ApiOperation(value="文档库信息表-文档拆分表头和查询条件", notes="文档库信息表-文档拆分表头和查询条件")
|
||||
@GetMapping(value = "/getHeaderOrConditionForSplitResult")
|
||||
@RequiresPermissions("split:sarFileSplitInfo:splitResult")
|
||||
public Result<List<Map<String,Object>>> getHeaderOrConditionForSplitResult(@RequestParam(name="flag",required=true) String flag,
|
||||
@RequestParam(name="cut",required=true) String cut) {
|
||||
List<Map<String, Object>> list = bussDocumentLibraryEOService.getHeaderOrConditionForSplit(flag,cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑数据查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "编辑数据查询")
|
||||
@ApiOperation(value="编辑数据查询", notes="编辑数据查询")
|
||||
@GetMapping(value = "/getDocumentInfoById")
|
||||
@RequiresPermissions("document:updateInfo")
|
||||
public Result<List<Map<String,Object>>> getDocumentInfoById(@RequestParam(name="id",required=true) String id,
|
||||
@RequestParam(name="cut",required=true) String cut) {
|
||||
List<Map<String, Object>> list = bussDocumentLibraryEOService.getDocumentInfoById(id,cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
/**
|
||||
* 详情数据查询
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "详情数据查询")
|
||||
@ApiOperation(value="详情数据查询", notes="详情数据查询")
|
||||
@GetMapping(value = "/getInfoById")
|
||||
@RequiresPermissions("document:queryPageInfo")
|
||||
public Result<List<Map<String,Object>>> getInfoById(@RequestParam(name="id",required=true) String id,
|
||||
@RequestParam(name="cut",required=true) String cut) {
|
||||
List<Map<String, Object>> list = bussDocumentLibraryEOService.getInfoById(id,cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value="详情目录查询", notes="详情目录查询")
|
||||
@GetMapping(value = "/getMenuList")
|
||||
public Result<List<Map<String,Object>>> getMenuList(@RequestParam(name="id",required=true) String id,
|
||||
@RequestParam(name="cut",required=true) String cut) {
|
||||
List<Map<String, Object>> list = bussDocumentLibraryEOService.getMenuList(id,cut);
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "新增数据")
|
||||
@ApiOperation(value="新增数据", notes="新增数据")
|
||||
@PostMapping(value = "/addInfo")
|
||||
@RequiresPermissions("document:getInfoById")
|
||||
public Result<?> getInfoById(@RequestBody Map<String,Object> map) {
|
||||
try {
|
||||
bussDocumentLibraryEOService.addInfo(map);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
return Result.OK("新增成功");
|
||||
}
|
||||
/**
|
||||
* 编辑数据
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "编辑数据")
|
||||
@ApiOperation(value="编辑数据", notes="编辑数据")
|
||||
@PostMapping(value = "/updateInfo")
|
||||
@RequiresPermissions("document:updateInfo")
|
||||
public Result<?> updateInfo(@RequestBody Map<String,Object> map) {
|
||||
try {
|
||||
bussDocumentLibraryEOService.updateInfo(map);
|
||||
} catch (Exception e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
return Result.OK("编辑成功");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加收藏
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "添加收藏")
|
||||
@ApiOperation(value="添加收藏", notes="添加收藏")
|
||||
@GetMapping(value = "/addCollect")
|
||||
@RequiresPermissions("document:addCollect")
|
||||
public Result<?> addCollect(String id) {
|
||||
try {
|
||||
bussDocumentLibraryEOService.addCollect(id);
|
||||
} catch (Exception e) {
|
||||
return Result.error("收藏失败");
|
||||
}
|
||||
return Result.OK("收藏成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消收藏
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "取消收藏")
|
||||
@ApiOperation(value="取消收藏", notes="取消收藏")
|
||||
@GetMapping(value = "/cancelCollect")
|
||||
@RequiresPermissions("document:addCollect")
|
||||
public Result<?> cancelCollect(String id) {
|
||||
try {
|
||||
bussDocumentLibraryEOService.cancelCollect(id);
|
||||
} catch (Exception e) {
|
||||
return Result.error("取消收藏失败");
|
||||
}
|
||||
return Result.OK("取消收藏成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加订阅
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "添加订阅")
|
||||
@ApiOperation(value="添加订阅", notes="添加订阅")
|
||||
@GetMapping(value = "/addSubscribe")
|
||||
@RequiresPermissions("document:addSubscribe")
|
||||
public Result<?> addSubscribe(String id) {
|
||||
try {
|
||||
bussDocumentLibraryEOService.addSubscribe(id);
|
||||
} catch (Exception e) {
|
||||
return Result.error("订阅失败");
|
||||
}
|
||||
return Result.OK("订阅成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消订阅
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "取消订阅")
|
||||
@ApiOperation(value="取消订阅", notes="取消订阅")
|
||||
@GetMapping(value = "/cancelSubscribe")
|
||||
@RequiresPermissions("document:addSubscribe")
|
||||
public Result<?> cancelSubscribe(String id) {
|
||||
try {
|
||||
bussDocumentLibraryEOService.cancelSubscribe(id);
|
||||
} catch (Exception e) {
|
||||
return Result.error("取消订阅失败");
|
||||
}
|
||||
return Result.OK("取消订阅成功");
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "导出excel")
|
||||
@GetMapping(value = "/exportExcel")
|
||||
@RequiresPermissions("document:exportExcel")
|
||||
public void exportExcel(@RequestParam Map<String,Object> map,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request){
|
||||
bussDocumentLibraryEOService.exportExcel(map,response,request);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "带文件导出")
|
||||
@GetMapping(value = "/exportZip")
|
||||
@RequiresPermissions("document:exportZip")
|
||||
public void exportZip(@RequestParam Map<String,Object> map,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request) throws Exception {
|
||||
bussDocumentLibraryEOService.exportZip(map,response,request);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "模板下载")
|
||||
@GetMapping(value = "/exportTemplate")
|
||||
@RequiresPermissions("document:exportTemplate")
|
||||
public void exportTemplate(@RequestParam Map<String,Object> map, HttpServletResponse response, HttpServletRequest request) throws Exception {
|
||||
bussDocumentLibraryEOService.exportTemplate(map,response,request);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value = "导入.zip")
|
||||
@PostMapping(value = "/importZip")
|
||||
@RequiresPermissions("document:importZip")
|
||||
public Result<?> importZip(@RequestParam(value = "file", required = false) MultipartFile file,
|
||||
@RequestParam(value = "cut",required = false) String cut) throws Exception {
|
||||
try {
|
||||
bussDocumentLibraryEOService.importZip(file,cut);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
return Result.OK("导入成功");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "推送")
|
||||
@GetMapping(value = "/pullMessage")
|
||||
@RequiresPermissions("document:pullMessage")
|
||||
public Result<?> pullMessage(String departIds, String userIds, String documentIds) {
|
||||
|
||||
bussDocumentLibraryEOService.pullMessage(departIds,userIds,documentIds);
|
||||
|
||||
return Result.OK("推送成功");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 验证文档是否被其他的文档绑定
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "验证文档是否被其他的文档绑定")
|
||||
@ApiOperation(value="验证文档是否被其他的文档绑定", notes="验证文档是否被其他的文档绑定")
|
||||
@GetMapping(value = "/verifyBind")
|
||||
public Result<?> verifyBind(@RequestParam(name="ids",required=true) String ids) {
|
||||
String msg = bussDocumentLibraryEOService.verifyBind(Arrays.asList(ids.split(",")));
|
||||
return Result.OK(msg);
|
||||
}
|
||||
|
||||
@AutoLog(value = "虚拟中心添加调用文档库数据--分页")
|
||||
@ApiOperation(value="虚拟中心添加调用文档库数据--分页", notes="虚拟中心添加调用文档库数据--分页")
|
||||
@PostMapping(value = "/queryPageInfoDummy")
|
||||
public Result<?> queryPageInfoDummy(@RequestBody BussDocumentLibraryEO bussDocumentLibraryEO,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<BussDocumentLibraryEO> queryWrapper = QueryGenerator.initQueryWrapper(bussDocumentLibraryEO, req.getParameterMap());
|
||||
Page<BussDocumentLibraryEO> page = new Page<BussDocumentLibraryEO>(bussDocumentLibraryEO.getPageNo(), bussDocumentLibraryEO.getPageSize());
|
||||
IPage<BussDocumentLibraryEO> pageList = bussDocumentLibraryEOService.queryPageInfoDummy(page, queryWrapper,bussDocumentLibraryEO);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation(value="虚拟中心添加调用文档库数据--分页", notes="虚拟中心添加调用文档库数据--分页")
|
||||
@PostMapping(value = "/queryPageDummy")
|
||||
@ResponseBody
|
||||
public JSONObject queryPageDummy(@RequestBody Map<String,Object> parameter) {
|
||||
IPage infoPage = bussDocumentLibraryEOService.getPageDummy(parameter);
|
||||
Result<IPage> ok = Result.OK(infoPage);
|
||||
JSONObject jsonResult = JSONObject.fromObject(ok);
|
||||
return jsonResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看已上传的文件
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value="查看已上传的文件", notes="查看已上传的文件")
|
||||
@GetMapping(value = "/getFileInfos")
|
||||
@RequiresPermissions("document:queryPageInfo")
|
||||
public Result<?> getFileInfos(String id) {
|
||||
List<OSSFileForDocumentLibrary> fileInfos = bussDocumentLibraryEOService.getFileInfos(id);
|
||||
return Result.OK(fileInfos);
|
||||
}
|
||||
/**
|
||||
* 根据id查询编号和标题
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value="查看已上传的文件", notes="查看已上传的文件")
|
||||
@GetMapping(value = "/getTitle")
|
||||
public Result<?> getTitle(String id, String cut) {
|
||||
String title = bussDocumentLibraryEOService.getTitle(id, cut);
|
||||
return Result.OK(title);
|
||||
}
|
||||
@ApiOperation(value="编辑ES数据(添加module_type_flag)", notes="编辑ES数据(添加module_type_flag)")
|
||||
@GetMapping(value = "/updateES")
|
||||
public Result<?> getTitle() {
|
||||
int count = bussDocumentLibraryEOService.updateES();
|
||||
return Result.OK(count);
|
||||
}
|
||||
}
|
||||
+173
@@ -0,0 +1,173 @@
|
||||
package com.jero.modules.document.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.query.QueryGenerator;
|
||||
import com.jero.modules.document.entity.PhasedImplementationDetailsEO;
|
||||
import com.jero.modules.document.service.IPhasedImplementationDetailsEOService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 文档库-分阶段实施详情表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-02-22
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags="文档库-分阶段实施详情表")
|
||||
@RestController
|
||||
@RequestMapping("/phone/document/phasedImplementationDetailsEO")
|
||||
@Slf4j
|
||||
public class PhonePhasedImplementationDetailsEOController extends JeroController<PhasedImplementationDetailsEO, IPhasedImplementationDetailsEOService> {
|
||||
@Autowired
|
||||
private IPhasedImplementationDetailsEOService phasedImplementationDetailsEOService;
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param phasedImplementationDetailsEO
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库-分阶段实施详情表-分页列表查询")
|
||||
@ApiOperation(value="文档库-分阶段实施详情表-分页列表查询", notes="文档库-分阶段实施详情表-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(PhasedImplementationDetailsEO phasedImplementationDetailsEO,
|
||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
||||
@RequestParam(name="cut", defaultValue="cn") String cut,
|
||||
HttpServletRequest req) {
|
||||
QueryWrapper<PhasedImplementationDetailsEO> queryWrapper = QueryGenerator.initQueryWrapper(phasedImplementationDetailsEO, req.getParameterMap());
|
||||
Page<PhasedImplementationDetailsEO> page = new Page<PhasedImplementationDetailsEO>(pageNo, pageSize);
|
||||
IPage<PhasedImplementationDetailsEO> pageList = phasedImplementationDetailsEOService.page(page, queryWrapper);
|
||||
this.phasedImplementationDetailsEOService.disposeData(pageList.getRecords(),cut);
|
||||
return Result.OK(pageList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库-分阶段实施详情表-列表查询")
|
||||
@ApiOperation(value="文档库-分阶段实施详情表-列表查询", notes="文档库-分阶段实施详情表-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<PhasedImplementationDetailsEO>> queryList() {
|
||||
List<PhasedImplementationDetailsEO> list = phasedImplementationDetailsEOService.queryList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param phasedImplementationDetailsEO
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库-分阶段实施详情表-添加")
|
||||
@ApiOperation(value="文档库-分阶段实施详情表-添加", notes="文档库-分阶段实施详情表-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody PhasedImplementationDetailsEO phasedImplementationDetailsEO) {
|
||||
phasedImplementationDetailsEOService.add(phasedImplementationDetailsEO);
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param phasedImplementationDetailsEO
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库-分阶段实施详情表-编辑")
|
||||
@ApiOperation(value="文档库-分阶段实施详情表-编辑", notes="文档库-分阶段实施详情表-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody PhasedImplementationDetailsEO phasedImplementationDetailsEO) {
|
||||
phasedImplementationDetailsEOService.editById(phasedImplementationDetailsEO);
|
||||
return Result.OK("编辑成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库-分阶段实施详情表-通过id删除")
|
||||
@ApiOperation(value="文档库-分阶段实施详情表-通过id删除", notes="文档库-分阶段实施详情表-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name="id",required=true) String id) {
|
||||
phasedImplementationDetailsEOService.deleteById(id);
|
||||
return Result.OK("删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库-分阶段实施详情表-批量删除")
|
||||
@ApiOperation(value="文档库-分阶段实施详情表-批量删除", notes="文档库-分阶段实施详情表-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
||||
this.phasedImplementationDetailsEOService.deleteByIds(Arrays.asList(ids.split(",")));
|
||||
return Result.OK("批量删除成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "文档库-分阶段实施详情表-通过id查询")
|
||||
@ApiOperation(value="文档库-分阶段实施详情表-通过id查询", notes="文档库-分阶段实施详情表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
|
||||
PhasedImplementationDetailsEO phasedImplementationDetailsEO = phasedImplementationDetailsEOService.queryById(id);
|
||||
if(phasedImplementationDetailsEO==null) {
|
||||
return Result.error("未找到对应数据");
|
||||
}
|
||||
return Result.OK(phasedImplementationDetailsEO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param phasedImplementationDetailsEO
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, PhasedImplementationDetailsEO phasedImplementationDetailsEO) {
|
||||
return super.exportXls(request, phasedImplementationDetailsEO, PhasedImplementationDetailsEO.class, "文档库-分阶段实施详情表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, PhasedImplementationDetailsEO.class);
|
||||
}
|
||||
|
||||
}
|
||||
+107
@@ -0,0 +1,107 @@
|
||||
package com.jero.modules.document.entity;
|
||||
|
||||
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 com.jero.common.aspect.annotation.Dict;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 文档库信息表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-01-21
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("buss_document_library")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="buss_document_library对象", description="文档库信息表")
|
||||
public class BussDocumentLibraryEO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
/**编号*/
|
||||
@ApiModelProperty(value = "编号")
|
||||
private String serialNumber;
|
||||
|
||||
/**标题*/
|
||||
@ApiModelProperty(value = "标题")
|
||||
private String title;
|
||||
|
||||
private String titleEn;
|
||||
|
||||
/**适用范围*/
|
||||
@ApiModelProperty(value = "适用范围")
|
||||
private String shi4Yong4Fan4Wei2;
|
||||
|
||||
/**适用地区*/
|
||||
@ApiModelProperty(value = "适用地区")
|
||||
private String region;
|
||||
/**适用地区*/
|
||||
@ApiModelProperty(value = "类别")
|
||||
private String lei4Bie2;
|
||||
|
||||
/**状态*/
|
||||
@ApiModelProperty(value = "状态")
|
||||
@Dict(dicCode ="state")
|
||||
private String state;
|
||||
|
||||
/**技术领域*/
|
||||
@ApiModelProperty(value = "技术领域")
|
||||
@Dict(dicCode ="technology_territory")
|
||||
private String technologyTerritory;
|
||||
|
||||
/**新车型实施日期*/
|
||||
@ApiModelProperty(value = "新车型实施日期")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
private java.util.Date xin1Che1Xing2Shi2Shi1Ri4Qi1;
|
||||
|
||||
/**在产车实施日期*/
|
||||
@ApiModelProperty(value = "在产车实施日期")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
private java.util.Date implementTime;
|
||||
|
||||
/**对应标准*/
|
||||
@ApiModelProperty(value = "对应标准")
|
||||
private String correspondingStandard;
|
||||
|
||||
|
||||
/**代替标准*/
|
||||
@ApiModelProperty(value = "代替标准")
|
||||
@Dict(dicCode ="replace_standard")
|
||||
private String replaceStandard;
|
||||
|
||||
|
||||
/**被代替标准*/
|
||||
@ApiModelProperty(value = "被代替标准")
|
||||
@Dict(dicCode ="replaced_standard")
|
||||
private String replacedStandard;
|
||||
|
||||
|
||||
|
||||
@TableField(exist = false)
|
||||
private String cut;
|
||||
|
||||
@TableField(exist = false)
|
||||
private Integer pageNo;
|
||||
@TableField(exist = false)
|
||||
private Integer pageSize;
|
||||
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.jero.modules.document.entity;
|
||||
|
||||
import com.jero.modules.oss.entity.OSSFile;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @Author: liyawei
|
||||
* @Description:
|
||||
* @Date: Created in 17:25 2022/4/25
|
||||
*/
|
||||
@Data
|
||||
public class OSSFileForDocumentLibrary extends OSSFile {
|
||||
|
||||
// 拆分回传文档库,标准分解单专用
|
||||
private Integer splitFlag;
|
||||
private String splitInfoId;
|
||||
}
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
package com.jero.modules.document.entity;
|
||||
|
||||
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 io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
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.Date;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 文档库-分阶段实施详情表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-02-22
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Data
|
||||
@TableName("phased_implementation_details")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="phased_implementation_details对象", description="文档库-分阶段实施详情表")
|
||||
public class PhasedImplementationDetailsEO implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**主键*/
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
/**创建人*/
|
||||
@ApiModelProperty(value = "创建人")
|
||||
private String createBy;
|
||||
|
||||
/**创建日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建日期")
|
||||
private Date createTime;
|
||||
|
||||
/**更新人*/
|
||||
@ApiModelProperty(value = "更新人")
|
||||
private String updateBy;
|
||||
|
||||
/**更新日期*/
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "更新日期")
|
||||
private Date updateTime;
|
||||
|
||||
/**所属部门*/
|
||||
@ApiModelProperty(value = "所属部门")
|
||||
private String sysOrgCode;
|
||||
|
||||
/**文档库id*/
|
||||
@Excel(name = "文档库id", width = 15)
|
||||
@ApiModelProperty(value = "文档库id")
|
||||
private String bussDocumentLibraryId;
|
||||
|
||||
/**法规编号/条款*/
|
||||
@Excel(name = "法规编号/条款", width = 15)
|
||||
@ApiModelProperty(value = "法规编号/条款")
|
||||
private String standNumberOrClause;
|
||||
|
||||
/**实施类型*/
|
||||
@Excel(name = "实施类型", width = 15)
|
||||
@ApiModelProperty(value = "实施类型")
|
||||
private String implementationType;
|
||||
|
||||
/**实施类型展示文本**/
|
||||
@TableField(exist = false)
|
||||
private String implementationTypeText;
|
||||
|
||||
/**实施日期*/
|
||||
@Excel(name = "实施日期", width = 15, format = "yyyy-MM-dd")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "实施日期")
|
||||
private Date implementationDate;
|
||||
|
||||
/**备注*/
|
||||
@Excel(name = "备注", width = 15)
|
||||
@ApiModelProperty(value = "备注")
|
||||
private String remarks;
|
||||
|
||||
/**排序号*/
|
||||
@Excel(name = "排序号", width = 15)
|
||||
@ApiModelProperty(value = "排序号")
|
||||
private Integer orderNum;
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.jero.modules.document.enums;
|
||||
|
||||
/**
|
||||
* @description
|
||||
* @date 2022/1/21 15:22
|
||||
* @auth zhn
|
||||
*/
|
||||
public enum FieldTypeEnum {
|
||||
//属性类型 1输入框(字符串),2输入框(数字),3单选下拉框,4多选下拉框,5单日期选择,6多日期选择,7文件,8文本框,9人员选择,10标准选择
|
||||
TREE("树形结构","0"),
|
||||
TEXT_STRING("输入框(字符串)","1"),
|
||||
TEXT_NUMBER("输入框(数字)","2"),
|
||||
PULL_SINGLE("单选下拉框","3"),
|
||||
PULL_MORE("多选下拉框","4"),
|
||||
DATE_SINGLE("单日期选择","5"),
|
||||
DATE_MORE("多日期选择","6"),
|
||||
FILE("文件","7"),
|
||||
TEXT("文本框","8"),
|
||||
PERSON("人员选择","9"),
|
||||
STANDARD("标准选择","10"),
|
||||
TEXT_LINK("输入框(链接)","11");
|
||||
|
||||
|
||||
|
||||
String name;
|
||||
String value;
|
||||
|
||||
FieldTypeEnum(String name, String value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package com.jero.modules.document.enums;
|
||||
|
||||
/**
|
||||
* 实施类型枚举类
|
||||
*/
|
||||
public enum ImplementationTypeEnum {
|
||||
CAR_IN_PRODUCTION("1628228171473039361","在产车","New Vehicle","34e90bd6a000471bbdcd0ff325898740"),
|
||||
NEW_CAR_MODEL("1628228101830815745","新车型","New Type","2148610ff06641849106321531656bfc");
|
||||
|
||||
String id;
|
||||
String nameCn;
|
||||
String nameEn;
|
||||
String itemValue;
|
||||
|
||||
ImplementationTypeEnum(String id, String nameCn, String nameEn, String itemValue) {
|
||||
this.id = id;
|
||||
this.nameCn = nameCn;
|
||||
this.nameEn = nameEn;
|
||||
this.itemValue = itemValue;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public String getNameCn() {
|
||||
return nameCn;
|
||||
}
|
||||
|
||||
public String getNameEn() {
|
||||
return nameEn;
|
||||
}
|
||||
|
||||
public String getItemValue() {
|
||||
return itemValue;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.jero.modules.document.enums;
|
||||
|
||||
/**
|
||||
* @description
|
||||
* 法规状态枚举
|
||||
* @date 2022/1/21 15:22
|
||||
* @auth zhn
|
||||
*/
|
||||
public enum LawsStateEnum {
|
||||
ACTIVE("现行","1"),
|
||||
ABOLISH("废止","2"),
|
||||
THE_UPCOMING("即将实施","3"),
|
||||
DRAFT("草稿","4"),
|
||||
BE_REPLACED("被替代","5");
|
||||
|
||||
|
||||
|
||||
String name;
|
||||
String value;
|
||||
|
||||
LawsStateEnum(String name, String value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.jero.modules.document.enums;
|
||||
|
||||
/**
|
||||
* @description
|
||||
* @date 2022/1/21 15:22
|
||||
* @auth zhn
|
||||
*/
|
||||
public enum SearchEnum {
|
||||
INDEX_NAME_DOCUMENT("文档库索引名称","documentLibrary"),
|
||||
TYPE_NAME_DOCUMENT("文档库类型","document"),
|
||||
INDEX_NAME_LAWS_MONTHLY_REPORT("法规月报索引名称","lawsmonthlyreportmanage"),
|
||||
TYPE_NAME_LAWS_MONTHLY_REPORT("法规月报类型名称","lawsmonthlyreport"),
|
||||
FULL_TEXT_SEARCH("全部中文","fulltextsearchcn"),
|
||||
FULL_TEXT_SEARCH_CN("全部中文","fulltextsearchcn"),
|
||||
FULL_TEXT_SEARCH_EN("全部英文","fulltextsearchen"),
|
||||
INDEX_PROBLEM_KNOWLEDGE_BASE("问题知识库索引名称","problemKnowledgeBase"),
|
||||
TYPE_PROBLEM_KNOWLEDGE_BASE_CN("问题知识库类型","problemKnowledgeBaseTypeCn"),
|
||||
TYPE_PROBLEM_KNOWLEDGE_BASE_EN("问题知识库类型","problemKnowledgeBaseTypeEn");
|
||||
|
||||
String name;
|
||||
String value;
|
||||
|
||||
SearchEnum(String name, String value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
+102
@@ -0,0 +1,102 @@
|
||||
package com.jero.modules.document.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.jero.modules.document.entity.BussDocumentLibraryEO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 文档库信息表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-01-21
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface BussDocumentLibraryEOMapper extends BaseMapper<BussDocumentLibraryEO> {
|
||||
|
||||
int insertInfo(@Param("insertField") String insertField,
|
||||
@Param("insertValue") String insertValue);
|
||||
|
||||
/**
|
||||
* 分页查询
|
||||
*
|
||||
* @param page
|
||||
* @param field
|
||||
* @param condition
|
||||
* @return
|
||||
*/
|
||||
IPage<Map<String,Object>> getInfoPage(@Param("page") IPage<Map<String,Object>> page,
|
||||
@Param("field") String field,
|
||||
@Param("condition") String condition);
|
||||
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @param
|
||||
* @param field
|
||||
* @param condition
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getInfoList(@Param("field") String field,
|
||||
@Param("condition") String condition);
|
||||
|
||||
/**
|
||||
* 代替标准分页
|
||||
*
|
||||
* @param page
|
||||
* @param field
|
||||
* @param condition
|
||||
* @return
|
||||
*/
|
||||
IPage<Map<String, Object>> replacePageInfo(@Param("page") IPage page,
|
||||
@Param("field") String field,
|
||||
@Param("condition") String condition);
|
||||
|
||||
/**
|
||||
* ocr识别调取已入库文件分页
|
||||
*
|
||||
* @param page
|
||||
* @param field
|
||||
* @param condition
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> ocrPageInfo(
|
||||
@Param("field") String field,
|
||||
@Param("condition") String condition);
|
||||
|
||||
|
||||
/**
|
||||
* 根据代替标准列表查询
|
||||
*
|
||||
* @param
|
||||
* @param replaceStandard
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getInfoListByReplaceStandard(@Param("replaceStandard") String replaceStandard);
|
||||
|
||||
|
||||
List<Map<String,Object>> getListBySerialNumber(@Param("serialNumbers") String serialNumbers);
|
||||
|
||||
List<String> getListBySerialNumberFuzzy(@Param("serialNumber") String serialNumber);
|
||||
|
||||
|
||||
List<Map<String,Object>> selectMapsAll(@Param("ids") String ids);
|
||||
|
||||
List<Map<String,Object>> selectMapsAllBySerialNumber(@Param("serialNumberList") String serialNumberList);
|
||||
|
||||
List<Map<String,Object>> getListInfo(@Param("condition") String condition);
|
||||
|
||||
List<Map<String,Object>> selectMapsByDeleteIds(@Param("id") String id);
|
||||
|
||||
void updateByDeleteId(@Param("correspondingStandardStr") String correspondingStandardStr,
|
||||
@Param("replaceStandardStr") String replaceStandardStr,
|
||||
@Param("id") String id );
|
||||
List<Map<String, Object>> queryListByIds(@Param("ids") String ids);
|
||||
|
||||
BussDocumentLibraryEO getBySerialNumber(@Param("serialNumber") String serialNumber);
|
||||
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.jero.modules.document.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jero.modules.document.entity.PhasedImplementationDetailsEO;
|
||||
|
||||
/**
|
||||
* @Description: 文档库-分阶段实施详情表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-02-22
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface PhasedImplementationDetailsEOMapper extends BaseMapper<PhasedImplementationDetailsEO> {
|
||||
|
||||
}
|
||||
+123
@@ -0,0 +1,123 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jero.modules.document.mapper.BussDocumentLibraryEOMapper">
|
||||
<resultMap id="BussDocumentLibraryEOResultMap" type="com.jero.modules.document.entity.BussDocumentLibraryEO">
|
||||
<id column="id" property="id" />
|
||||
<id column="serial_number" property="serialNumber" />
|
||||
<id column="title" property="title" />
|
||||
<id column="title_en" property="titleEn" />
|
||||
<id column="shi4_yong4_fan4_wei2" property="shi4Yong4Fan4Wei2" />
|
||||
<id column="state" property="state" />
|
||||
<id column="technology_territory" property="technologyTerritory" />
|
||||
<id column="xin1_che1_xing2_shi2_shi1_ri4_qi1" property="xin1Che1Xing2Shi2Shi1Ri4Qi1" />
|
||||
<id column="implement_time" property="implementTime" />
|
||||
<id column="corresponding_standard" property="correspondingStandard" />
|
||||
<id column="lei4_bie2" property="lei4Bie2" />
|
||||
</resultMap>
|
||||
|
||||
<insert id="insertInfo">
|
||||
insert into buss_document_library(${insertField})
|
||||
values (${insertValue})
|
||||
</insert>
|
||||
|
||||
<!--分页-->
|
||||
<select id="getInfoPage" resultType="java.util.LinkedHashMap">
|
||||
select ${field} from buss_document_library
|
||||
${condition}
|
||||
</select>
|
||||
<!--列表-->
|
||||
<select id="getInfoList" resultType="java.util.LinkedHashMap">
|
||||
select ${field} from buss_document_library
|
||||
${condition}
|
||||
</select>
|
||||
<!--代替标准分页-->
|
||||
<select id="replacePageInfo" resultType="java.util.LinkedHashMap">
|
||||
select ${field} from buss_document_library
|
||||
${condition}
|
||||
</select>
|
||||
<!--ocr识别调取已入库文件分页-->
|
||||
<select id="ocrPageInfo" resultType="java.util.LinkedHashMap">
|
||||
select ${field}
|
||||
${condition}
|
||||
</select>
|
||||
<!--根据代替标准列表查询-->
|
||||
<select id="getInfoListByReplaceStandard" resultType="java.util.LinkedHashMap">
|
||||
select * from buss_document_library
|
||||
where 1=1
|
||||
<if test="replaceStandard != null" >
|
||||
and replace_standard in
|
||||
<foreach collection="replaceStandard.split(',')" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
<!--根据编码列表查询-->
|
||||
<select id="getListBySerialNumber" resultType="java.util.LinkedHashMap">
|
||||
select * from buss_document_library
|
||||
where 1=1
|
||||
<if test="serialNumbers != null" >
|
||||
and serial_number in
|
||||
<foreach collection="serialNumbers.split(',')" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getListBySerialNumberFuzzy" resultType="java.lang.String">
|
||||
select id from buss_document_library
|
||||
where serial_number like concat(concat('%',#{serialNumber}),'%')
|
||||
</select>
|
||||
|
||||
<!--分页-->
|
||||
<select id="selectMapsAll" resultType="java.util.LinkedHashMap">
|
||||
select * from buss_document_library
|
||||
where 1=1
|
||||
<if test="ids != null" >
|
||||
and id in
|
||||
<foreach collection="ids.split(',')" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectMapsAllBySerialNumber" resultType="java.util.LinkedHashMap">
|
||||
select * from buss_document_library
|
||||
where 1=1
|
||||
<if test="serialNumberList != null" >
|
||||
and serial_number in
|
||||
<foreach collection="serialNumberList.split(',')" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getListInfo" resultType="java.util.LinkedHashMap">
|
||||
select * from buss_document_library
|
||||
where ${condition}
|
||||
</select>
|
||||
|
||||
<select id="selectMapsByDeleteIds" resultType="java.util.LinkedHashMap">
|
||||
select * from buss_document_library
|
||||
where corresponding_standard like concat(concat('%',#{id}),'%')
|
||||
or replace_standard like concat(concat('%',#{id}),'%')
|
||||
</select>
|
||||
|
||||
<update id="updateByDeleteId">
|
||||
update buss_document_library set
|
||||
corresponding_standard =#{correspondingStandardStr},replace_standard=#{replaceStandardStr}
|
||||
where id=#{id}
|
||||
</update>
|
||||
|
||||
<select id="queryListByIds" resultType="java.util.LinkedHashMap">
|
||||
select * from buss_document_library
|
||||
where id in
|
||||
<foreach collection="ids.split(',')" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getBySerialNumber" resultType="com.jero.modules.document.entity.BussDocumentLibraryEO">
|
||||
select * from buss_document_library
|
||||
where serial_number =#{serialNumber}
|
||||
</select>
|
||||
</mapper>
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jero.modules.document.mapper.PhasedImplementationDetailsEOMapper">
|
||||
|
||||
</mapper>
|
||||
+235
@@ -0,0 +1,235 @@
|
||||
package com.jero.modules.document.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.modules.document.entity.BussDocumentLibraryEO;
|
||||
import com.jero.modules.document.entity.OSSFileForDocumentLibrary;
|
||||
import com.jero.modules.document.vo.QueryConditionVO;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 文档库信息表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-01-21
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IBussDocumentLibraryEOService extends IService<BussDocumentLibraryEO> {
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids,String cut);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
BussDocumentLibraryEO queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<BussDocumentLibraryEO> queryList();
|
||||
|
||||
/**
|
||||
* 查询条件
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> queryCondition(String flag, String cut,String searchFlag);
|
||||
|
||||
/**
|
||||
* 查询条件(法规清单或虚拟清单高级搜索需要的数据)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> queryConditionInventory(String flag, String cut);
|
||||
|
||||
/**
|
||||
* 列表表头
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getHeader(String flag, String cut,String searchFlag);
|
||||
|
||||
/**
|
||||
* 新增表单
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getAddForm(String flag, String cut, String type);
|
||||
|
||||
/**
|
||||
* 编辑数据查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getDocumentInfoById(String id, String cut);
|
||||
|
||||
/**
|
||||
* 详情数据查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getInfoById(String id, String cut);
|
||||
|
||||
List<Map<String, Object>> getMenuList(String id, String cut);
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param map
|
||||
*/
|
||||
void addInfo(Map<String, Object> map);
|
||||
|
||||
/**
|
||||
* 编辑数据
|
||||
*
|
||||
* @param map
|
||||
*/
|
||||
void updateInfo(Map<String, Object> map);
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*
|
||||
* @param parameter
|
||||
* @return
|
||||
*/
|
||||
IPage getInfoPage(Map<String, Object> parameter);
|
||||
|
||||
/**
|
||||
* 代替标准分页
|
||||
*
|
||||
* @param parameter
|
||||
* @return
|
||||
*/
|
||||
IPage replacePageInfo(Map<String, Object> parameter);
|
||||
|
||||
/**
|
||||
* ocr识别调取已入库文件分页
|
||||
*
|
||||
* @param parameter
|
||||
* @return
|
||||
*/
|
||||
IPage<Map<String, Object>> ocrPageInfo(Map<String, Object> parameter);
|
||||
|
||||
/**
|
||||
* 添加收藏
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void addCollect(String id);
|
||||
|
||||
/**
|
||||
* 取消收藏
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void cancelCollect(String id);
|
||||
|
||||
/**
|
||||
* 添加订阅
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void addSubscribe(String id);
|
||||
|
||||
/**
|
||||
* 取消订阅
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void cancelSubscribe(String id);
|
||||
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param map
|
||||
* @param response
|
||||
* @param request
|
||||
*/
|
||||
void exportExcel(Map<String, Object> map,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request);
|
||||
|
||||
void exportZip(Map<String, Object> map,
|
||||
HttpServletResponse response,
|
||||
HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* 模板下载
|
||||
*
|
||||
* @param response
|
||||
* @param request
|
||||
*/
|
||||
void exportTemplate(Map<String, Object> map, HttpServletResponse response, HttpServletRequest request);
|
||||
|
||||
/**
|
||||
* ocr识别调取已入库文件-中英文切换
|
||||
*
|
||||
* @param flag
|
||||
* @param cut
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getHeaderOrConditionForOcr(String flag, String cut);
|
||||
|
||||
List<Map<String, Object>> getHeaderOrConditionForSplit(String flag, String cut);
|
||||
|
||||
String pullMessage(String departIds, String ids, String documentIds);
|
||||
|
||||
void importZip(MultipartFile file,String cut);
|
||||
|
||||
String verifyBind(List<String> ids);
|
||||
|
||||
List<Map<String,Object>> queryListByIds(String ids);
|
||||
|
||||
List<Map<String, Object>> getListBySerialNumber(String serialNumbers);
|
||||
|
||||
List<String> getListBySerialNumberFuzzy(String serialNumber);
|
||||
|
||||
List<OSSFileForDocumentLibrary> getFileInfos(String id);
|
||||
|
||||
|
||||
IPage<BussDocumentLibraryEO> queryPageInfoDummy(Page<BussDocumentLibraryEO> page, QueryWrapper<BussDocumentLibraryEO> queryWrapper,BussDocumentLibraryEO bussDocumentLibraryEO);
|
||||
|
||||
IPage getPageDummy(Map<String, Object> parameter);
|
||||
|
||||
void isModifyForOcrAndSplit(Map<String, Object> parameter);
|
||||
|
||||
String getTitle(String id,String cut);
|
||||
|
||||
String sqlJoint(List<QueryConditionVO> queryConditionVOList);
|
||||
|
||||
int updateES();
|
||||
|
||||
/**
|
||||
* 根据serialNumber获取BussDumentLibrar对象
|
||||
* @param serialNumber
|
||||
* @return
|
||||
*/
|
||||
BussDocumentLibraryEO getBySerialNumber(String serialNumber);
|
||||
}
|
||||
+66
@@ -0,0 +1,66 @@
|
||||
package com.jero.modules.document.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.modules.document.entity.PhasedImplementationDetailsEO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: 文档库-分阶段实施详情表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-02-22
|
||||
* @Version: V1.0
|
||||
*/
|
||||
public interface IPhasedImplementationDetailsEOService extends IService<PhasedImplementationDetailsEO> {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param phasedImplementationDetailsEO
|
||||
* @return
|
||||
*/
|
||||
void add(PhasedImplementationDetailsEO phasedImplementationDetailsEO);
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param phasedImplementationDetailsEO
|
||||
* @return
|
||||
*/
|
||||
void editById(PhasedImplementationDetailsEO phasedImplementationDetailsEO);
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
void deleteById(String id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
void deleteByIds(List<String> ids);
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
PhasedImplementationDetailsEO queryById(String id);
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List<PhasedImplementationDetailsEO> queryList();
|
||||
|
||||
boolean insertBatch(List<PhasedImplementationDetailsEO> phasedImplDetailsEOList);
|
||||
|
||||
void disposeData(List<PhasedImplementationDetailsEO> datas, String cut);
|
||||
}
|
||||
+5970
File diff suppressed because it is too large
Load Diff
+148
@@ -0,0 +1,148 @@
|
||||
package com.jero.modules.document.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import com.jero.modules.document.entity.PhasedImplementationDetailsEO;
|
||||
import com.jero.modules.document.enums.ImplementationTypeEnum;
|
||||
import com.jero.modules.document.mapper.PhasedImplementationDetailsEOMapper;
|
||||
import com.jero.modules.document.service.IPhasedImplementationDetailsEOService;
|
||||
import me.zhyd.oauth.utils.StringUtils;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Description: 文档库-分阶段实施详情表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2023-02-22
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Service
|
||||
public class PhasedImplementationDetailsEOServiceImpl extends ServiceImpl<PhasedImplementationDetailsEOMapper, PhasedImplementationDetailsEO> implements IPhasedImplementationDetailsEOService {
|
||||
|
||||
/**
|
||||
* 保存
|
||||
*
|
||||
* @param phasedImplementationDetailsEO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void add(PhasedImplementationDetailsEO phasedImplementationDetailsEO) {
|
||||
Date now = new Date();
|
||||
phasedImplementationDetailsEO.setCreateTime(now);
|
||||
phasedImplementationDetailsEO.setUpdateTime(now);
|
||||
save(phasedImplementationDetailsEO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新
|
||||
*
|
||||
* @param phasedImplementationDetailsEO
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void editById(PhasedImplementationDetailsEO phasedImplementationDetailsEO) {
|
||||
Date now = new Date();
|
||||
phasedImplementationDetailsEO.setUpdateTime(now);
|
||||
saveOrUpdate(phasedImplementationDetailsEO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void deleteByIds(List<String> ids) {
|
||||
removeByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public PhasedImplementationDetailsEO queryById(String id) {
|
||||
return getById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<PhasedImplementationDetailsEO> queryList() {
|
||||
return list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean insertBatch(List<PhasedImplementationDetailsEO> phasedImplDetailsEOList) {
|
||||
boolean flag = true;
|
||||
if(CollectionUtils.isNotEmpty(phasedImplDetailsEOList)){
|
||||
try {
|
||||
this.saveBatch(phasedImplDetailsEOList);
|
||||
}catch (Exception ex){
|
||||
flag = false;
|
||||
ex.printStackTrace();
|
||||
log.error("批量添加分阶段实施详情信息失败:" + ex.getMessage());
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disposeData(List<PhasedImplementationDetailsEO> datas, String cut) {
|
||||
if(CollectionUtils.isNotEmpty(datas)){
|
||||
for (PhasedImplementationDetailsEO data : datas) {
|
||||
String implementationType = data.getImplementationType();
|
||||
if(StringUtils.isNotEmpty(implementationType)){
|
||||
String[] implementationTypeArr = implementationType.split(",");
|
||||
ImplementationTypeEnum[] implementationTypeEnums = ImplementationTypeEnum.values();
|
||||
|
||||
String implementationTypeText = "";
|
||||
if(org.apache.commons.lang3.StringUtils.equals(cut, CutEnum.CN.getValue())){
|
||||
implementationTypeText = Arrays.stream(implementationTypeEnums).filter(implementationTypeEnum -> {
|
||||
boolean flag = false;
|
||||
for (String type : implementationTypeArr) {
|
||||
if (org.apache.commons.lang3.StringUtils.equals(type, implementationTypeEnum.getItemValue())) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}).map(ImplementationTypeEnum::getNameCn).collect(Collectors.joining(","));
|
||||
}else {
|
||||
implementationTypeText = Arrays.stream(implementationTypeEnums).filter(implementationTypeEnum -> {
|
||||
boolean flag = false;
|
||||
for (String type : implementationTypeArr) {
|
||||
if (org.apache.commons.lang3.StringUtils.equals(type, implementationTypeEnum.getItemValue())) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}).map(ImplementationTypeEnum::getNameEn).collect(Collectors.joining(","));
|
||||
}
|
||||
data.setImplementationTypeText(implementationTypeText);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
package com.jero.modules.document.service.impl;
|
||||
|
||||
import com.jero.modules.document.entity.BussDocumentLibraryEO;
|
||||
import com.jero.modules.document.enums.LawsStateEnum;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description
|
||||
* @date 2022/9/25 10:03
|
||||
* @auth zhn
|
||||
*/
|
||||
public class TimedTaskLaws implements Job {
|
||||
@Autowired
|
||||
private BussDocumentLibraryEOServiceImpl bussDocumentLibraryEOService;
|
||||
|
||||
/**
|
||||
* 法规状态为即将实施的法规,根据新车型实施日期和在产车实施日期, 到期后自动更新状态为现行
|
||||
* @param jobExecutionContext
|
||||
* @throws JobExecutionException
|
||||
*/
|
||||
@Override
|
||||
public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
||||
String currentTime = sdf.format(new Date());
|
||||
//获取所有的法规
|
||||
List<BussDocumentLibraryEO> bussDocumentLibraryEOList = bussDocumentLibraryEOService.list();
|
||||
if(bussDocumentLibraryEOList.size() != 0){
|
||||
for (BussDocumentLibraryEO bussDocumentLibraryEO : bussDocumentLibraryEOList) {
|
||||
String xin1Che1Xing2Shi2Shi1Ri4Qi1Str = "";
|
||||
String implementTimestr = "";
|
||||
|
||||
String state = bussDocumentLibraryEO.getState();//状态
|
||||
//新车型实施日期
|
||||
Date xin1Che1Xing2Shi2Shi1Ri4Qi1 = bussDocumentLibraryEO.getXin1Che1Xing2Shi2Shi1Ri4Qi1();
|
||||
//在产车实施日期
|
||||
Date implementTime = bussDocumentLibraryEO.getImplementTime();
|
||||
if(ObjectUtils.isNotEmpty(xin1Che1Xing2Shi2Shi1Ri4Qi1)){
|
||||
xin1Che1Xing2Shi2Shi1Ri4Qi1Str = sdf.format(xin1Che1Xing2Shi2Shi1Ri4Qi1);
|
||||
}
|
||||
if(ObjectUtils.isNotEmpty(implementTime)){
|
||||
implementTimestr = sdf.format(implementTime);
|
||||
}
|
||||
//法规状态为即将实施的法规,根据新车型实施日期和在产车实施日期, 到期后自动更新状态为现行
|
||||
if(StringUtils.isNotBlank(state) && LawsStateEnum.THE_UPCOMING.getValue().equals(state)
|
||||
&& (currentTime.equals(xin1Che1Xing2Shi2Shi1Ri4Qi1Str) || currentTime.equals(implementTimestr))){
|
||||
BussDocumentLibraryEO bussDocumentLibraryEOTemp = new BussDocumentLibraryEO();
|
||||
bussDocumentLibraryEOTemp.setId(bussDocumentLibraryEO.getId());
|
||||
bussDocumentLibraryEOTemp.setState(LawsStateEnum.ACTIVE.getValue());
|
||||
bussDocumentLibraryEOService.updateById(bussDocumentLibraryEOTemp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.jero.modules.document.utils;
|
||||
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.util.MinioUtil;
|
||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||
import org.apache.pdfbox.text.PDFTextStripper;
|
||||
import org.apache.pdfbox.text.PDFTextStripperByArea;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* @description
|
||||
* @date 2022/3/21 17:04
|
||||
* @auth zhn
|
||||
*/
|
||||
public class ReadPdfUtil {
|
||||
|
||||
public static String readPdf(String path) {
|
||||
if(MinioUtil.doesObjectExist(path)){
|
||||
try (InputStream in = MinioUtil.download(path);
|
||||
PDDocument document = PDDocument.load(in)) {
|
||||
document.getClass();
|
||||
PDFTextStripperByArea stripper = new PDFTextStripperByArea();
|
||||
stripper.setSortByPosition(true);
|
||||
PDFTextStripper tStripper = new PDFTextStripper();
|
||||
|
||||
String pdfFileInText = tStripper.getText(document);
|
||||
return pdfFileInText;
|
||||
|
||||
}catch (IOException e) {
|
||||
throw new JeroBootException("文件内容读取失败");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.jero.modules.document.utils;
|
||||
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.util.MinioUtil;
|
||||
import org.apache.poi.hwpf.extractor.WordExtractor;
|
||||
import org.apache.poi.ooxml.POIXMLDocument;
|
||||
import org.apache.poi.ooxml.extractor.POIXMLTextExtractor;
|
||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||
import org.apache.poi.xwpf.extractor.XWPFWordExtractor;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
|
||||
import static com.jero.modules.document.service.impl.BussDocumentLibraryEOServiceImpl.copyFile;
|
||||
|
||||
/**
|
||||
* @description
|
||||
* @date 2022/3/21 17:04
|
||||
* @auth zhn
|
||||
*/
|
||||
public class ReadWordUtil {
|
||||
public static String readWord(String path,String uploadpath) {
|
||||
// String path = "E:\\DeskTop\\1111.doc";
|
||||
// path = "E:\\DeskTop\\22222.docx";
|
||||
// String path = "E:\\DeskTop\\标准所ISO-用户手册.doc";
|
||||
String str = "";
|
||||
try {
|
||||
if (path.endsWith(".doc")) {
|
||||
if(MinioUtil.doesObjectExist(path)){
|
||||
InputStream in = MinioUtil.download(path);
|
||||
WordExtractor ex = new WordExtractor(in);
|
||||
str = ex.getText();
|
||||
ex.close();
|
||||
in.close();
|
||||
}
|
||||
} else if (path.endsWith("docx")) {
|
||||
//先把文件存到本地, 用完后在删除
|
||||
if(MinioUtil.doesObjectExist(path)){
|
||||
InputStream in = MinioUtil.download(path);
|
||||
String fileNowPath = uploadpath + "/tempZip/" ;
|
||||
File file = new File(fileNowPath);
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
file.mkdirs();
|
||||
File fileOld = new File(path);
|
||||
long currentTime = System.currentTimeMillis();
|
||||
copyFile(in, fileNowPath + File.separator + currentTime + fileOld.getName());
|
||||
File fileTemp = new File(fileNowPath + File.separator + currentTime + fileOld.getName());
|
||||
String pathTemp = fileTemp.getPath();
|
||||
OPCPackage opcPackage = POIXMLDocument.openPackage(pathTemp);
|
||||
POIXMLTextExtractor extractor = new XWPFWordExtractor(opcPackage);
|
||||
str = extractor.getText().trim();
|
||||
extractor.close();
|
||||
fileTemp.delete();
|
||||
in.close();
|
||||
}
|
||||
} else {
|
||||
throw new JeroBootException("此文件不是word文件");
|
||||
}
|
||||
return str;
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new JeroBootException("文件内容读取失败");
|
||||
}catch (NoSuchFieldError e){
|
||||
e.printStackTrace();
|
||||
throw new JeroBootException("文件内容读取失败");
|
||||
}
|
||||
}
|
||||
// public static String readWord(String path) {
|
||||
//// String path = "E:\\DeskTop\\1111.doc";
|
||||
//// path = "E:\\DeskTop\\22222.docx";
|
||||
//// String path = "E:\\DeskTop\\标准所ISO-用户手册.doc";
|
||||
// String str = "";
|
||||
// try {
|
||||
// if (path.endsWith(".doc")) {
|
||||
// InputStream is = new FileInputStream(new File(path));
|
||||
// WordExtractor ex = new WordExtractor(is);
|
||||
// str = ex.getText();
|
||||
// ex.close();
|
||||
// } else if (path.endsWith("docx")) {
|
||||
// OPCPackage opcPackage = POIXMLDocument.openPackage(path);
|
||||
// POIXMLTextExtractor extractor = new XWPFWordExtractor(opcPackage);
|
||||
// str = extractor.getText();
|
||||
// extractor.close();
|
||||
// } else {
|
||||
// throw new JeroBootException("此文件不是word文件");
|
||||
// }
|
||||
// return str;
|
||||
// } catch (Exception e) {
|
||||
// throw new JeroBootException("文件内容读取失败");
|
||||
// }catch (NoSuchFieldError e){
|
||||
// throw new JeroBootException("文件内容读取失败");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.jero.modules.document.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @description
|
||||
* @date 2022/5/20 14:37
|
||||
* @auth zhn
|
||||
*/
|
||||
@Data
|
||||
public class QueryConditionVO {
|
||||
//类型(and或or)
|
||||
private String type;
|
||||
//查询类型
|
||||
private String rule;
|
||||
//字段
|
||||
private String field;
|
||||
//字段值
|
||||
private String val;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package com.jero.modules.domain.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 领域与用户关系实体
|
||||
*@Author: wzj
|
||||
*@Date: 2022/3/2 11:41
|
||||
**/
|
||||
@Data
|
||||
@TableName("domain_user_rel")
|
||||
@Accessors(chain = true)
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@ApiModel(value="domain_user_rel对象", description="领域与用户关系表")
|
||||
public class DomainUserRel implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@TableId(type = IdType.ASSIGN_ID)
|
||||
@ApiModelProperty("主键")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty("创建人")
|
||||
private String createBy;
|
||||
|
||||
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty("领域id")
|
||||
private String domainId;
|
||||
|
||||
@ApiModelProperty("用户id")
|
||||
private String userId;
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.jero.modules.domain.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.jero.modules.domain.entity.DomainUserRel;
|
||||
/**
|
||||
* 领域与用户关系
|
||||
*@Author: wzj
|
||||
*@Date: 2022/3/2 11:41
|
||||
**/
|
||||
public interface DomainUserRelMapper extends BaseMapper<DomainUserRel> {
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.jero.modules.domain.mapper.DomainUserRelMapper">
|
||||
<resultMap id="OnlCgformSubscribeResultMap" type="com.jero.modules.domain.entity.DomainUserRel">
|
||||
<id column="id" property="id" />
|
||||
<result column="create_by" property="createBy" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="domain_id" property="domainId" />
|
||||
</resultMap>
|
||||
|
||||
</mapper>
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
package com.jero.modules.domain.service;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.modules.domain.entity.DomainUserRel;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 领域与用户关系
|
||||
*@Author: wzj
|
||||
*@Date: 2022/3/2 11:40
|
||||
**/
|
||||
public interface DomainUserRelService extends IService<DomainUserRel> {
|
||||
|
||||
Result<?> insert(JSONObject jsonObject);
|
||||
|
||||
Result<?> queryList();
|
||||
|
||||
/**
|
||||
* 查询领域、文档关联的用户
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
List<String> queryDomainUserRelInfo(Map<String,Object> params);
|
||||
|
||||
}
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
package com.jero.modules.domain.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.modules.domain.entity.DomainUserRel;
|
||||
import com.jero.modules.domain.mapper.DomainUserRelMapper;
|
||||
import com.jero.modules.domain.service.DomainUserRelService;
|
||||
import com.jero.modules.system.mapper.SysUserMapper;
|
||||
import me.zhyd.oauth.utils.StringUtils;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 领域与用户关系
|
||||
*@Author: wzj
|
||||
*@Date: 2022/3/2 11:41
|
||||
**/
|
||||
@Service
|
||||
public class DomainManageServiceImpl extends ServiceImpl<DomainUserRelMapper, DomainUserRel> implements DomainUserRelService {
|
||||
|
||||
//我的订阅
|
||||
//@Autowired
|
||||
//private OnlCgformSubscribeMapper onlCgformSubscribeMapper;
|
||||
|
||||
@Autowired
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
@Override
|
||||
public Result<?> insert(JSONObject jsonObject) {
|
||||
try {
|
||||
List<String> domainIdList = jsonObject.getJSONArray("domainIdList").toJavaList(String.class);
|
||||
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String userName = currentUser.getUsername();
|
||||
String userId = currentUser.getId();
|
||||
QueryWrapper<DomainUserRel> deleteWrapepr = new QueryWrapper<>();
|
||||
deleteWrapepr.lambda().eq(DomainUserRel::getUserId,userId);
|
||||
super.baseMapper.delete(deleteWrapepr);
|
||||
|
||||
List<DomainUserRel> domainUserRelList = new ArrayList<>();
|
||||
domainIdList.forEach(domainId -> {
|
||||
DomainUserRel domainUserRel = new DomainUserRel();
|
||||
domainUserRel.setCreateBy(userName);
|
||||
domainUserRel.setDomainId(domainId);
|
||||
domainUserRel.setUserId(userId);
|
||||
domainUserRel.setCreateTime(new Date());
|
||||
domainUserRelList.add(domainUserRel);
|
||||
});
|
||||
if (CollectionUtils.isNotEmpty(domainIdList)) {
|
||||
super.saveBatch(domainUserRelList);
|
||||
}
|
||||
}catch (Exception ex){
|
||||
log.error("添加领域与用户关系失败:" + ex.getMessage());
|
||||
throw new JeroBootException("添加失败!");
|
||||
}
|
||||
return Result.OK("添加成功!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<?> queryList() {
|
||||
LoginUser currentUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
String userId = currentUser.getId();
|
||||
QueryWrapper<DomainUserRel> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda().eq(DomainUserRel::getUserId,userId);
|
||||
List<DomainUserRel> domainUserRels = super.baseMapper.selectList(queryWrapper);
|
||||
return Result.OK(domainUserRels);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询领域、文档关联的用户
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<String> queryDomainUserRelInfo(Map<String, Object> params) {
|
||||
String domainId = (String) params.get("domainId");
|
||||
String documentId = (String) params.get("documentId");
|
||||
List<String> result = new ArrayList<>();
|
||||
try {
|
||||
//获取订阅该领域的所有用户信息
|
||||
if(StringUtils.isNotEmpty(domainId)){
|
||||
QueryWrapper<DomainUserRel> queryDomain = new QueryWrapper<>();
|
||||
queryDomain.lambda().in(DomainUserRel::getDomainId, Arrays.asList(domainId.split(",")));
|
||||
List<DomainUserRel> domainUserRelList = super.baseMapper.selectList(queryDomain);
|
||||
if(CollectionUtils.isNotEmpty(domainUserRelList)){
|
||||
result = domainUserRelList.stream().map(DomainUserRel::getUserId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
}catch (Exception ex){
|
||||
log.error("根据领域id、文档id查询用户失败:" + ex.getMessage());
|
||||
throw new JeroBootException("根据领域id、文档id查询用户失败!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
+309
@@ -0,0 +1,309 @@
|
||||
package com.jero.modules.extRepo.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.common.util.MinioUtil;
|
||||
import com.jero.modules.extRepo.entity.ExtRepoData;
|
||||
import com.jero.modules.extRepo.entity.ExtRepoDataPage;
|
||||
import com.jero.modules.extRepo.service.IExtRepoDataService;
|
||||
import com.jero.modules.extRepo.service.IExtRepoFolderService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 对外报告数据表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-07-25
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags = "对外报告数据表")
|
||||
@RestController
|
||||
@RequestMapping("/com.jero.modules.extRepo/extRepoData")
|
||||
@Slf4j
|
||||
public class ExtRepoDataController extends JeroController<ExtRepoData, IExtRepoDataService> {
|
||||
@Autowired
|
||||
private IExtRepoDataService extRepoDataService;
|
||||
|
||||
@Autowired
|
||||
private IExtRepoFolderService extRepoFolderService;
|
||||
|
||||
|
||||
private final SimpleDateFormat sdf = new SimpleDateFormat("yyy-MM-dd HH:mm:ss");
|
||||
|
||||
/**
|
||||
* 分页列表查询
|
||||
*
|
||||
* @param extRepoData
|
||||
* @param pageNo
|
||||
* @param pageSize
|
||||
* @param req
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告数据表-分页列表查询")
|
||||
@ApiOperation(value = "对外报告数据表-分页列表查询", notes = "对外报告数据表-分页列表查询")
|
||||
@GetMapping(value = "/page")
|
||||
public Result<?> queryPageList(ExtRepoData extRepoData,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
|
||||
HttpServletRequest req) {
|
||||
LambdaQueryWrapper<ExtRepoData> queryWrapper = new LambdaQueryWrapper<>();
|
||||
Page<ExtRepoData> page = new Page<>(pageNo, pageSize);
|
||||
// 文件名称模糊查询
|
||||
String fileName = req.getParameter("fileName");
|
||||
if (StringUtils.isNotBlank(fileName)) {
|
||||
fileName = fileName.replace("%", "\\%");
|
||||
queryWrapper.like(ExtRepoData::getFileName, fileName);
|
||||
}
|
||||
// 上传人模糊查询
|
||||
String createBy = req.getParameter("createBy");
|
||||
if (StringUtils.isNotBlank(createBy)) {
|
||||
createBy = createBy.replace("%", "\\%");
|
||||
queryWrapper.like(ExtRepoData::getCreateBy, createBy);
|
||||
}
|
||||
// 更新时间查询
|
||||
String createTime = req.getParameter("time");
|
||||
if (StringUtils.isNotBlank(createTime)) {
|
||||
String[] createTimeArr = createTime.split(",");
|
||||
if (createTimeArr.length >= 2) {
|
||||
queryWrapper.between(ExtRepoData::getCreateTime, createTimeArr[0]+" 00:00:00", createTimeArr[1]+" 23:59:59");
|
||||
}
|
||||
}
|
||||
queryWrapper.eq(ExtRepoData::getSupFolder, extRepoData.getSupFolder());
|
||||
queryWrapper.orderBy(true, false, ExtRepoData::getCreateTime);
|
||||
IPage<ExtRepoData> pageList = extRepoDataService.page(page, queryWrapper);
|
||||
//判断当前文件夹或者上级文件夹是否有权限
|
||||
HttpSession session = req.getSession();
|
||||
session.setAttribute("haveSuperiorManageAuth", false);
|
||||
extRepoFolderService.haveSuperiorManageAuth(extRepoData.getSupFolder(),session);
|
||||
ExtRepoDataPage res = new ExtRepoDataPage((Boolean)session.getAttribute("haveSuperiorManageAuth"), pageList);
|
||||
return Result.OK(res);
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告数据表-列表查询")
|
||||
@ApiOperation(value = "对外报告数据表-列表查询", notes = "对外报告数据表-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<List<ExtRepoData>> queryList() {
|
||||
List<ExtRepoData> list = extRepoDataService.queryList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param extRepoData
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告数据表-添加")
|
||||
@ApiOperation(value = "对外报告数据表-添加", notes = "对外报告数据表-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody ExtRepoData extRepoData, HttpSession session) {
|
||||
Result<ExtRepoData> result = new Result();
|
||||
//判断当前文件夹或者上级文件夹是否有权限
|
||||
session.setAttribute("haveSuperiorManageAuth", false);
|
||||
extRepoFolderService.haveSuperiorManageAuth(extRepoData.getSupFolder(),session);
|
||||
if ((Boolean)session.getAttribute("haveSuperiorManageAuth")) {
|
||||
log.info("对外报告数据表收到文件添加请求,开始处理文件:【" + sdf.format(new Date()) + "】");
|
||||
int res = extRepoDataService.add(extRepoData);
|
||||
if (CutEnum.CN.getValue().equals(extRepoData.getCut())) {
|
||||
result.success("添加成功:" + res + "条数据!");
|
||||
} else {
|
||||
result.success(res + " pieces of data are added successfully!");
|
||||
}
|
||||
} else {
|
||||
if (CutEnum.CN.getValue().equals(extRepoData.getCut())) {
|
||||
result.error500("没有权限!");
|
||||
} else {
|
||||
result.error500("You do not have permission !");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param extRepoData
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告数据表-编辑")
|
||||
@ApiOperation(value = "对外报告数据表-编辑", notes = "对外报告数据表-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody ExtRepoData extRepoData, HttpSession session) {
|
||||
Result<ExtRepoData> result = new Result();
|
||||
ExtRepoData erd = extRepoDataService.queryById(extRepoData.getId());
|
||||
//LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
//判断当前文件夹或者上级文件夹是否有权限
|
||||
session.setAttribute("haveSuperiorManageAuth", false);
|
||||
extRepoFolderService.haveSuperiorManageAuth(erd.getSupFolder(),session);
|
||||
if (extRepoFolderService.isManager() || (Boolean)session.getAttribute("haveSuperiorManageAuth")) {
|
||||
extRepoData.setSupFolder(erd.getSupFolder());
|
||||
extRepoDataService.editById(extRepoData);
|
||||
if (CutEnum.CN.getValue().equals(extRepoData.getCut())) {
|
||||
result.success("编辑成功!");
|
||||
} else {
|
||||
result.success("Data update successfully!");
|
||||
}
|
||||
} else {
|
||||
if (CutEnum.CN.getValue().equals(extRepoData.getCut())) {
|
||||
result.error500("没有权限!");
|
||||
} else {
|
||||
result.error500("You do not have permission !");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告数据表-通过id删除")
|
||||
@ApiOperation(value = "对外报告数据表-通过id删除", notes = "对外报告数据表-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam("id") String id,
|
||||
@RequestParam(name = "cut", defaultValue = "cn") String cut, HttpSession session) {
|
||||
Result<ExtRepoData> result = new Result();
|
||||
ExtRepoData erd = extRepoDataService.queryById(id);
|
||||
if (null != erd) {
|
||||
//LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
//判断当前文件夹或者上级文件夹是否有权限
|
||||
session.setAttribute("haveSuperiorManageAuth", false);
|
||||
extRepoFolderService.haveSuperiorManageAuth(erd.getSupFolder(),session);
|
||||
if (extRepoFolderService.isManager() || (Boolean)session.getAttribute("haveSuperiorManageAuth")) {
|
||||
extRepoDataService.deleteById(id);
|
||||
MinioUtil.delete(erd.getFileKey());
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
result.success("删除成功!");
|
||||
} else {
|
||||
result.success("Data deletion successfully!");
|
||||
}
|
||||
} else {
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
result.error500("没有权限!");
|
||||
} else {
|
||||
result.error500("You do not have permission!");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
result.error500("删除失败!");
|
||||
} else {
|
||||
result.error500("Delete failed!");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告数据表-批量删除")
|
||||
@ApiOperation(value = "对外报告数据表-批量删除", notes = "对外报告数据表-批量删除")
|
||||
@DeleteMapping(value = "/deleteBatch")
|
||||
public Result<?> deleteBatch(@RequestParam("ids") String ids,
|
||||
@RequestParam(name = "cut", defaultValue = "cn") String cut) {
|
||||
Result<ExtRepoData> result = new Result();
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
List<String> idsList = Arrays.asList(ids.split(","));
|
||||
for (String id : idsList) {
|
||||
ExtRepoData erd = extRepoDataService.queryById(id);
|
||||
if (null != erd && !extRepoFolderService.isManager() && !sysUser.getUsername().equals(erd.getCreateBy())) {
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
result.error500("没有权限!");
|
||||
} else {
|
||||
result.error500("You do not have permission!");
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String id : idsList) {
|
||||
ExtRepoData erd = extRepoDataService.queryById(id);
|
||||
if (null != erd) {
|
||||
MinioUtil.delete(erd.getFileKey());
|
||||
this.extRepoDataService.deleteById(id);
|
||||
}
|
||||
}
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
result.success("删除成功!");
|
||||
} else {
|
||||
result.success("Data deletion successfully!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告数据表-通过id查询")
|
||||
@ApiOperation(value = "对外报告数据表-通过id查询", notes = "对外报告数据表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id) {
|
||||
Result<ExtRepoData> result = new Result();
|
||||
ExtRepoData extRepoData = extRepoDataService.queryById(id);
|
||||
if (extRepoData == null) {
|
||||
result.success("未找到对应数据!");
|
||||
return result;
|
||||
}
|
||||
return result.OK(extRepoData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出excel
|
||||
*
|
||||
* @param request
|
||||
* @param extRepoData
|
||||
*/
|
||||
@RequestMapping(value = "/exportXls")
|
||||
public ModelAndView exportXls(HttpServletRequest request, ExtRepoData extRepoData) {
|
||||
return super.exportXls(request, extRepoData, ExtRepoData.class, "对外报告数据表");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过excel导入数据
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
||||
return super.importExcel(request, response, ExtRepoData.class);
|
||||
}
|
||||
|
||||
}
|
||||
+250
@@ -0,0 +1,250 @@
|
||||
package com.jero.modules.extRepo.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.aspect.annotation.AutoLog;
|
||||
import com.jero.common.constant.enums.CutEnum;
|
||||
import com.jero.common.exception.JeroBootException;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import com.jero.modules.extRepo.entity.ERFTreeDataVO;
|
||||
import com.jero.modules.extRepo.entity.ExtRepoData;
|
||||
import com.jero.modules.extRepo.entity.ExtRepoFolder;
|
||||
import com.jero.modules.extRepo.service.IExtRepoDataService;
|
||||
import com.jero.modules.extRepo.service.IExtRepoFolderService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Description: 对外报告文件夹表
|
||||
* @Author: jero-boot
|
||||
* @Date: 2022-07-25
|
||||
* @Version: V1.0
|
||||
*/
|
||||
@Api(tags = "对外报告文件夹表")
|
||||
@RestController
|
||||
@RequestMapping("/extRepo/extRepoFolder")
|
||||
@Slf4j
|
||||
public class ExtRepoFolderController extends JeroController<ExtRepoFolder, IExtRepoFolderService> {
|
||||
@Autowired
|
||||
private IExtRepoFolderService extRepoFolderService;
|
||||
|
||||
@Autowired
|
||||
private IExtRepoDataService extRepoDataService;
|
||||
|
||||
/**
|
||||
* 列表查询
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告文件夹表-列表查询")
|
||||
@ApiOperation(value = "对外报告文件夹表-列表查询", notes = "对外报告文件夹表-列表查询")
|
||||
@GetMapping(value = "/list")
|
||||
public Result<ERFTreeDataVO> queryList() {
|
||||
ERFTreeDataVO dataVO = new ERFTreeDataVO();
|
||||
//dataVO.setManager(extRepoFolderService.isManager());
|
||||
dataVO.setList(extRepoFolderService.queryTreeList());
|
||||
return Result.OK(dataVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加
|
||||
*
|
||||
* @param extRepoFolder
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告文件夹表-添加")
|
||||
@ApiOperation(value = "对外报告文件夹表-添加", notes = "对外报告文件夹表-添加")
|
||||
@PostMapping(value = "/add")
|
||||
public Result<?> add(@Validated @RequestBody ExtRepoFolder extRepoFolder, HttpSession session) {
|
||||
Result<ExtRepoFolder> result = new Result();
|
||||
session.setAttribute("haveSuperiorManageAuth", false);
|
||||
ExtRepoFolder folder = extRepoFolderService.queryById(extRepoFolder.getSupFolder());
|
||||
extRepoFolderService.haveSuperiorManageAuth(folder.getSupFolder(),session);
|
||||
//上层是否有权限
|
||||
boolean boo = (Boolean)session.getAttribute("haveSuperiorManageAuth");
|
||||
if (boo||extRepoFolderService.haveManageAuth(extRepoFolder.getSupFolder())) {
|
||||
if (!extRepoFolder.isAddSub()) {
|
||||
//增加同级文件夹
|
||||
if (!boo) {
|
||||
if (CutEnum.CN.getValue().equals(extRepoFolder.getCut())) {
|
||||
throw new JeroBootException("无法创建同级文件夹!请联系管理员!");
|
||||
} else {
|
||||
throw new JeroBootException("Unable to create a sibling folder ! Please Contact your administrator !");
|
||||
}
|
||||
}
|
||||
extRepoFolder.setSupFolder(folder.getSupFolder());
|
||||
}
|
||||
extRepoFolderService.add(extRepoFolder);
|
||||
if (CutEnum.CN.getValue().equals(extRepoFolder.getCut())) {
|
||||
result.success("添加成功!");
|
||||
} else {
|
||||
result.success("Data added successfully!");
|
||||
}
|
||||
} else {
|
||||
if (CutEnum.CN.getValue().equals(extRepoFolder.getCut())) {
|
||||
result.error500("没有权限!");
|
||||
} else {
|
||||
result.error500("You do not have permission !");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 是否允许增加同级文件夹
|
||||
* @param extRepoFolder
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "是否允许增加同级文件夹")
|
||||
@ApiOperation(value = "是否允许增加同级文件夹", notes = "是否允许增加同级文件夹")
|
||||
@PostMapping(value = "/isAllowSiblingFolder")
|
||||
public Result<?> isAllowSiblingFolder(@Validated @RequestBody ExtRepoFolder extRepoFolder,
|
||||
HttpSession session) {
|
||||
Result<ExtRepoFolder> result = new Result();
|
||||
session.setAttribute("haveSuperiorManageAuth", false);
|
||||
ExtRepoFolder folder = extRepoFolderService.queryById(extRepoFolder.getId());
|
||||
extRepoFolderService.haveSuperiorManageAuth(folder.getSupFolder(),session);
|
||||
//上层是否有权限
|
||||
boolean boo = (Boolean)session.getAttribute("haveSuperiorManageAuth");
|
||||
if (boo || extRepoFolderService.haveManageAuth(extRepoFolder.getId())) {
|
||||
if (!boo) {
|
||||
if (CutEnum.CN.getValue().equals(extRepoFolder.getCut())) {
|
||||
return result.error500("无法创建同级文件夹!请联系管理员!");
|
||||
} else {
|
||||
return result.error500("Unable to create a sibling folder ! Please Contact your administrator !");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (CutEnum.CN.getValue().equals(extRepoFolder.getCut())) {
|
||||
return result.error500("没有权限!");
|
||||
} else {
|
||||
return result.error500("You do not have permission !");
|
||||
}
|
||||
}
|
||||
return result.success("");
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param extRepoFolder
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告文件夹表-编辑")
|
||||
@ApiOperation(value = "对外报告文件夹表-编辑", notes = "对外报告文件夹表-编辑")
|
||||
@PutMapping(value = "/edit")
|
||||
public Result<?> edit(@Validated @RequestBody ExtRepoFolder extRepoFolder, HttpSession session) {
|
||||
Result<ExtRepoFolder> result = new Result();
|
||||
session.setAttribute("haveSuperiorManageAuth", false);
|
||||
extRepoFolderService.haveSuperiorManageAuth(extRepoFolder.getId(),session);
|
||||
if (ObjectUtils.isNotEmpty(session.getAttribute("haveSuperiorManageAuth"))&&(Boolean) session.getAttribute("haveSuperiorManageAuth")) {
|
||||
extRepoFolderService.editById(extRepoFolder);
|
||||
if (CutEnum.CN.getValue().equals(extRepoFolder.getCut())) {
|
||||
result.success("编辑成功!");
|
||||
} else {
|
||||
result.success("Data update successfully!");
|
||||
}
|
||||
} else {
|
||||
if (CutEnum.CN.getValue().equals(extRepoFolder.getCut())) {
|
||||
result.error500("没有权限!");
|
||||
} else {
|
||||
result.error500("You do not have permission !");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id删除
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告文件夹表-通过id删除")
|
||||
@ApiOperation(value = "对外报告文件夹表-通过id删除", notes = "对外报告文件夹表-通过id删除")
|
||||
@DeleteMapping(value = "/delete")
|
||||
public Result<?> delete(@RequestParam(name = "id", required = true) String id,
|
||||
@RequestParam(name = "cut", defaultValue = "cn") String cut, HttpSession session) {
|
||||
Result<ExtRepoFolder> result = new Result();
|
||||
session.setAttribute("haveSuperiorManageAuth", false);
|
||||
extRepoFolderService.haveSuperiorManageAuth(id,session);
|
||||
if (ObjectUtils.isNotEmpty(session.getAttribute("haveSuperiorManageAuth"))&&(Boolean) session.getAttribute("haveSuperiorManageAuth")) {
|
||||
List<ExtRepoFolder> resList = extRepoFolderService.getListBySupFolder(id);
|
||||
if (resList.isEmpty()) {
|
||||
ExtRepoFolder erf = extRepoFolderService.queryById(id);
|
||||
int count = getRootFolderCount();
|
||||
if (erf.getSupFolder().equals("root") && count <= 1) {
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
result.error500("此文件夹不可删除!");
|
||||
} else {
|
||||
result.error500("This folder cannot be deleted!");
|
||||
}
|
||||
} else {
|
||||
List<ExtRepoData> erdList = extRepoDataService.queryByFolder(id);
|
||||
for (ExtRepoData erd : erdList) {
|
||||
extRepoDataService.deleteById(erd.getId());
|
||||
}
|
||||
extRepoFolderService.deleteById(id);
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
result.success("删除成功!");
|
||||
} else {
|
||||
result.success("Data deletion successfully!");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
result.error500("请先删除子文件夹!");
|
||||
} else {
|
||||
result.error500("Please delete the subfolder first!");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
result.error500("没有权限!");
|
||||
} else {
|
||||
result.error500("You do not have permission!");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private int getRootFolderCount() {
|
||||
LambdaQueryWrapper<ExtRepoFolder> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ExtRepoFolder::getSupFolder, "root");
|
||||
return extRepoFolderService.count(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过id查询
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@AutoLog(value = "对外报告文件夹表-通过id查询")
|
||||
@ApiOperation(value = "对外报告文件夹表-通过id查询", notes = "对外报告文件夹表-通过id查询")
|
||||
@GetMapping(value = "/queryById")
|
||||
public Result<?> queryById(@RequestParam(name = "id", required = true) String id,
|
||||
@RequestParam(name = "cut", defaultValue = "cn") String cut) {
|
||||
Result<ExtRepoFolder> result = new Result();
|
||||
ExtRepoFolder extRepoFolder = extRepoFolderService.queryById(id);
|
||||
if (extRepoFolder == null) {
|
||||
if (CutEnum.CN.getValue().equals(cut)) {
|
||||
result.error500("未找到对应数据!");
|
||||
} else {
|
||||
result.error500("No Data!");
|
||||
}
|
||||
}
|
||||
return result.OK(extRepoFolder);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user