处理提交
This commit is contained in:
47
.gitignore
vendored
Normal file
47
.gitignore
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
######################################################################
|
||||
# Build Tools
|
||||
|
||||
.gradle
|
||||
/build/
|
||||
!gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
|
||||
######################################################################
|
||||
# IDE
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### JRebel ###
|
||||
rebel.xml
|
||||
|
||||
### NetBeans ###
|
||||
nbproject/private/
|
||||
build/*
|
||||
nbbuild/
|
||||
dist/
|
||||
nbdist/
|
||||
.nb-gradle/
|
||||
|
||||
######################################################################
|
||||
# Others
|
||||
*.log
|
||||
*.xml.versionsBackup
|
||||
*.swp
|
||||
|
||||
!*/build/*.java
|
||||
!*/build/*.html
|
||||
!*/build/*.xml
|
69
JeeThink-activiti/pom.xml
Normal file
69
JeeThink-activiti/pom.xml
Normal file
@ -0,0 +1,69 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>jeethink</artifactId>
|
||||
<groupId>com.jeethink</groupId>
|
||||
<version>3.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>jeethink-activiti</artifactId>
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.activiti</groupId>
|
||||
<artifactId>activiti-spring-boot-starter-rest-api</artifactId>
|
||||
<version>${activiti.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jeethink</groupId>
|
||||
<artifactId>jeethink-framework</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jeethink</groupId>
|
||||
<artifactId>jeethink-system</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jeethink</groupId>
|
||||
<artifactId>jeethink-common</artifactId>
|
||||
</dependency>
|
||||
<!--activiti modeler 5.22 start-->
|
||||
<dependency>
|
||||
<groupId>org.activiti</groupId>
|
||||
<artifactId>activiti-json-converter</artifactId>
|
||||
<version>6.0.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.activiti</groupId>
|
||||
<artifactId>activiti-bpmn-model</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<!-- xml解析依赖-->
|
||||
<dependency>
|
||||
<groupId>org.apache.xmlgraphics</groupId>
|
||||
<artifactId>batik-codec</artifactId>
|
||||
<version>1.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.xmlgraphics</groupId>
|
||||
<artifactId>batik-css</artifactId>
|
||||
<version>1.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.xmlgraphics</groupId>
|
||||
<artifactId>batik-svg-dom</artifactId>
|
||||
<version>1.7</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.xmlgraphics</groupId>
|
||||
<artifactId>batik-svggen</artifactId>
|
||||
<version>1.7</version>
|
||||
</dependency>
|
||||
<!-- xml解析依赖-->
|
||||
<!--activiti modeler 5.22 end-->
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,26 @@
|
||||
package com.jeethink.activiti.config;
|
||||
|
||||
import org.activiti.spring.SpringProcessEngineConfiguration;
|
||||
import org.activiti.spring.boot.ProcessEngineConfigurationConfigurer;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class ActivitiConfig implements ProcessEngineConfigurationConfigurer {
|
||||
|
||||
@Autowired
|
||||
private ICustomProcessDiagramGenerator customProcessDiagramGenerator;
|
||||
|
||||
/**
|
||||
* 解決工作流生成图片乱码问题
|
||||
*
|
||||
* @param processEngineConfiguration
|
||||
*/
|
||||
@Override
|
||||
public void configure(SpringProcessEngineConfiguration processEngineConfiguration) {
|
||||
processEngineConfiguration.setActivityFontName("宋体");
|
||||
processEngineConfiguration.setAnnotationFontName("宋体");
|
||||
processEngineConfiguration.setLabelFontName("宋体");
|
||||
processEngineConfiguration.setProcessDiagramGenerator(customProcessDiagramGenerator);
|
||||
}
|
||||
}
|
@ -0,0 +1,245 @@
|
||||
package com.jeethink.activiti.config;
|
||||
|
||||
import org.activiti.bpmn.model.AssociationDirection;
|
||||
import org.activiti.bpmn.model.GraphicInfo;
|
||||
import org.activiti.image.exception.ActivitiImageException;
|
||||
import org.activiti.image.impl.DefaultProcessDiagramCanvas;
|
||||
import org.activiti.image.util.ReflectUtil;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import java.awt.*;
|
||||
import java.awt.font.FontRenderContext;
|
||||
import java.awt.font.LineBreakMeasurer;
|
||||
import java.awt.font.TextAttribute;
|
||||
import java.awt.font.TextLayout;
|
||||
import java.awt.geom.Line2D;
|
||||
import java.awt.geom.Rectangle2D;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.text.AttributedCharacterIterator;
|
||||
import java.text.AttributedString;
|
||||
|
||||
public class CustomProcessDiagramCanvas extends DefaultProcessDiagramCanvas {
|
||||
|
||||
protected static Color LABEL_COLOR = new Color(0, 0, 0);
|
||||
|
||||
//font
|
||||
protected String activityFontName = "宋体";
|
||||
protected String labelFontName = "宋体";
|
||||
protected String annotationFontName = "宋体";
|
||||
|
||||
private static volatile boolean flag = false;
|
||||
|
||||
public CustomProcessDiagramCanvas(int width, int height, int minX, int minY, String imageType) {
|
||||
super(width, height, minX, minY, imageType);
|
||||
}
|
||||
|
||||
public CustomProcessDiagramCanvas(int width, int height, int minX, int minY, String imageType,
|
||||
String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader) {
|
||||
super(width, height, minX, minY, imageType, activityFontName, labelFontName, annotationFontName,
|
||||
customClassLoader);
|
||||
}
|
||||
|
||||
public void drawHighLight(boolean isStartOrEnd, int x, int y, int width, int height, Color color) {
|
||||
Paint originalPaint = g.getPaint();
|
||||
Stroke originalStroke = g.getStroke();
|
||||
|
||||
g.setPaint(color);
|
||||
g.setStroke(MULTI_INSTANCE_STROKE);
|
||||
if (isStartOrEnd) {// 开始、结束节点画圆
|
||||
g.drawOval(x, y, width, height);
|
||||
} else {// 非开始、结束节点画圆角矩形
|
||||
RoundRectangle2D rect = new RoundRectangle2D.Double(x, y, width, height, 5, 5);
|
||||
g.draw(rect);
|
||||
}
|
||||
g.setPaint(originalPaint);
|
||||
g.setStroke(originalStroke);
|
||||
}
|
||||
|
||||
public void drawSequenceflow(int[] xPoints, int[] yPoints, boolean conditional, boolean isDefault,
|
||||
boolean highLighted, double scaleFactor, Color color) {
|
||||
drawConnection(xPoints, yPoints, conditional, isDefault, "sequenceFlow", AssociationDirection.ONE, highLighted,
|
||||
scaleFactor, color);
|
||||
}
|
||||
|
||||
public void drawConnection(int[] xPoints, int[] yPoints, boolean conditional, boolean isDefault,
|
||||
String connectionType, AssociationDirection associationDirection, boolean highLighted, double scaleFactor,
|
||||
Color color) {
|
||||
|
||||
Paint originalPaint = g.getPaint();
|
||||
Stroke originalStroke = g.getStroke();
|
||||
|
||||
g.setPaint(CONNECTION_COLOR);
|
||||
if (connectionType.equals("association")) {
|
||||
g.setStroke(ASSOCIATION_STROKE);
|
||||
} else if (highLighted) {
|
||||
g.setPaint(color);
|
||||
g.setStroke(HIGHLIGHT_FLOW_STROKE);
|
||||
}
|
||||
|
||||
for (int i = 1; i < xPoints.length; i++) {
|
||||
Integer sourceX = xPoints[i - 1];
|
||||
Integer sourceY = yPoints[i - 1];
|
||||
Integer targetX = xPoints[i];
|
||||
Integer targetY = yPoints[i];
|
||||
Line2D.Double line = new Line2D.Double(sourceX, sourceY, targetX, targetY);
|
||||
g.draw(line);
|
||||
}
|
||||
|
||||
if (isDefault) {
|
||||
Line2D.Double line = new Line2D.Double(xPoints[0], yPoints[0], xPoints[1], yPoints[1]);
|
||||
drawDefaultSequenceFlowIndicator(line, scaleFactor);
|
||||
}
|
||||
|
||||
if (conditional) {
|
||||
Line2D.Double line = new Line2D.Double(xPoints[0], yPoints[0], xPoints[1], yPoints[1]);
|
||||
drawConditionalSequenceFlowIndicator(line, scaleFactor);
|
||||
}
|
||||
|
||||
if (associationDirection.equals(AssociationDirection.ONE)
|
||||
|| associationDirection.equals(AssociationDirection.BOTH)) {
|
||||
Line2D.Double line = new Line2D.Double(xPoints[xPoints.length - 2], yPoints[xPoints.length - 2],
|
||||
xPoints[xPoints.length - 1], yPoints[xPoints.length - 1]);
|
||||
drawArrowHead(line, scaleFactor);
|
||||
}
|
||||
if (associationDirection.equals(AssociationDirection.BOTH)) {
|
||||
Line2D.Double line = new Line2D.Double(xPoints[1], yPoints[1], xPoints[0], yPoints[0]);
|
||||
drawArrowHead(line, scaleFactor);
|
||||
}
|
||||
g.setPaint(originalPaint);
|
||||
g.setStroke(originalStroke);
|
||||
}
|
||||
|
||||
public void drawLabel(boolean highLighted, String text, GraphicInfo graphicInfo, boolean centered) {
|
||||
float interline = 1.0f;
|
||||
|
||||
// text
|
||||
if (text != null && text.length() > 0) {
|
||||
Paint originalPaint = g.getPaint();
|
||||
Font originalFont = g.getFont();
|
||||
if (highLighted) {
|
||||
g.setPaint(WorkflowConstants.COLOR_NORMAL);
|
||||
} else {
|
||||
g.setPaint(LABEL_COLOR);
|
||||
}
|
||||
g.setFont(new Font(labelFontName, Font.BOLD, 10));
|
||||
|
||||
int wrapWidth = 100;
|
||||
int textY = (int) graphicInfo.getY();
|
||||
|
||||
// TODO: use drawMultilineText()
|
||||
AttributedString as = new AttributedString(text);
|
||||
as.addAttribute(TextAttribute.FOREGROUND, g.getPaint());
|
||||
as.addAttribute(TextAttribute.FONT, g.getFont());
|
||||
AttributedCharacterIterator aci = as.getIterator();
|
||||
FontRenderContext frc = new FontRenderContext(null, true, false);
|
||||
LineBreakMeasurer lbm = new LineBreakMeasurer(aci, frc);
|
||||
|
||||
while (lbm.getPosition() < text.length()) {
|
||||
TextLayout tl = lbm.nextLayout(wrapWidth);
|
||||
textY += tl.getAscent();
|
||||
Rectangle2D bb = tl.getBounds();
|
||||
double tX = graphicInfo.getX();
|
||||
if (centered) {
|
||||
tX += (int) (graphicInfo.getWidth() / 2 - bb.getWidth() / 2);
|
||||
}
|
||||
tl.draw(g, (float) tX, textY);
|
||||
textY += tl.getDescent() + tl.getLeading() + (interline - 1.0f) * tl.getAscent();
|
||||
}
|
||||
|
||||
// restore originals
|
||||
g.setFont(originalFont);
|
||||
g.setPaint(originalPaint);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public BufferedImage generateBufferedImage(String imageType) {
|
||||
if (closed) {
|
||||
throw new ActivitiImageException("ProcessDiagramGenerator already closed");
|
||||
}
|
||||
|
||||
// Try to remove white space
|
||||
minX = (minX <= WorkflowConstants.PROCESS_PADDING) ? WorkflowConstants.PROCESS_PADDING : minX;
|
||||
minY = (minY <= WorkflowConstants.PROCESS_PADDING) ? WorkflowConstants.PROCESS_PADDING : minY;
|
||||
BufferedImage imageToSerialize = processDiagram;
|
||||
if (minX >= 0 && minY >= 0) {
|
||||
imageToSerialize = processDiagram.getSubimage(
|
||||
minX - WorkflowConstants.PROCESS_PADDING,
|
||||
minY - WorkflowConstants.PROCESS_PADDING,
|
||||
canvasWidth - minX + WorkflowConstants.PROCESS_PADDING,
|
||||
canvasHeight - minY + WorkflowConstants.PROCESS_PADDING);
|
||||
}
|
||||
return imageToSerialize;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize(String imageType) {
|
||||
this.processDiagram = new BufferedImage(canvasWidth, canvasHeight, BufferedImage.TYPE_INT_ARGB);
|
||||
this.g = processDiagram.createGraphics();
|
||||
|
||||
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||
g.setPaint(Color.black);
|
||||
|
||||
Font font = new Font(activityFontName, Font.BOLD, FONT_SIZE);
|
||||
g.setFont(font);
|
||||
this.fontMetrics = g.getFontMetrics();
|
||||
|
||||
LABEL_FONT = new Font(labelFontName, Font.ITALIC, 10);
|
||||
ANNOTATION_FONT = new Font(annotationFontName, Font.PLAIN, FONT_SIZE);
|
||||
//优化加载速度
|
||||
if(flag) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
USERTASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/userTask.png", customClassLoader));
|
||||
SCRIPTTASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/scriptTask.png", customClassLoader));
|
||||
SERVICETASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/serviceTask.png", customClassLoader));
|
||||
RECEIVETASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/receiveTask.png", customClassLoader));
|
||||
SENDTASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/sendTask.png", customClassLoader));
|
||||
MANUALTASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/manualTask.png", customClassLoader));
|
||||
BUSINESS_RULE_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/businessRuleTask.png", customClassLoader));
|
||||
SHELL_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/shellTask.png", customClassLoader));
|
||||
CAMEL_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/camelTask.png", customClassLoader));
|
||||
MULE_TASK_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/muleTask.png", customClassLoader));
|
||||
|
||||
TIMER_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/timer.png", customClassLoader));
|
||||
COMPENSATE_THROW_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/compensate-throw.png", customClassLoader));
|
||||
COMPENSATE_CATCH_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/compensate.png", customClassLoader));
|
||||
ERROR_THROW_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/error-throw.png", customClassLoader));
|
||||
ERROR_CATCH_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/error.png", customClassLoader));
|
||||
MESSAGE_THROW_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/message-throw.png", customClassLoader));
|
||||
MESSAGE_CATCH_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/message.png", customClassLoader));
|
||||
SIGNAL_THROW_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/signal-throw.png", customClassLoader));
|
||||
SIGNAL_CATCH_IMAGE = ImageIO.read(ReflectUtil.getResource("org/activiti/icons/signal.png", customClassLoader));
|
||||
/* String baseUrl = Thread.currentThread().getContextClassLoader().getResource("static/img/activiti/").getPath();
|
||||
SCRIPTTASK_IMAGE = ImageIO.read(new FileInputStream(baseUrl+"scriptTask.png"));
|
||||
USERTASK_IMAGE = ImageIO.read(new FileInputStream(baseUrl+"userTask.png"));
|
||||
SERVICETASK_IMAGE = ImageIO.read(new FileInputStream(baseUrl+"serviceTask.png"));
|
||||
RECEIVETASK_IMAGE = ImageIO.read(new FileInputStream(baseUrl+"receiveTask.png"));
|
||||
SENDTASK_IMAGE = ImageIO.read(new FileInputStream(baseUrl+"sendTask.png"));
|
||||
MANUALTASK_IMAGE = ImageIO.read(new FileInputStream(baseUrl+"manualTask.png"));
|
||||
BUSINESS_RULE_TASK_IMAGE = ImageIO.read(new FileInputStream(baseUrl+"businessRuleTask.png"));
|
||||
SHELL_TASK_IMAGE = ImageIO.read(new FileInputStream(baseUrl+"shellTask.png"));
|
||||
CAMEL_TASK_IMAGE = ImageIO.read(new FileInputStream(baseUrl+"camelTask.png"));
|
||||
MULE_TASK_IMAGE = ImageIO.read(new FileInputStream(baseUrl+"muleTask.png"));
|
||||
|
||||
TIMER_IMAGE = ImageIO.read(new FileInputStream(baseUrl+"timer.png"));
|
||||
COMPENSATE_THROW_IMAGE = ImageIO.read(new FileInputStream(baseUrl+"compensate-throw.png"));
|
||||
COMPENSATE_CATCH_IMAGE = ImageIO.read(new FileInputStream(baseUrl+"compensate.png"));
|
||||
ERROR_THROW_IMAGE = ImageIO.read(new FileInputStream(baseUrl+"error-throw.png"));
|
||||
ERROR_CATCH_IMAGE = ImageIO.read(new FileInputStream(baseUrl+"error.png"));
|
||||
MESSAGE_THROW_IMAGE = ImageIO.read(new FileInputStream(baseUrl+"message-throw.png"));
|
||||
MESSAGE_CATCH_IMAGE = ImageIO.read(new FileInputStream(baseUrl+"message.png"));
|
||||
SIGNAL_THROW_IMAGE = ImageIO.read(new FileInputStream(baseUrl+"signal-throw.png"));
|
||||
SIGNAL_CATCH_IMAGE = ImageIO.read(new FileInputStream(baseUrl+"signal.png"));*/
|
||||
flag = true;
|
||||
} catch (IOException e) {
|
||||
flag = false;
|
||||
LOGGER.warn("Could not load image for process diagram creation: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,361 @@
|
||||
package com.jeethink.activiti.config;
|
||||
|
||||
import org.activiti.bpmn.model.Process;
|
||||
import org.activiti.bpmn.model.*;
|
||||
import org.activiti.image.impl.DefaultProcessDiagramGenerator;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.imageio.stream.ImageOutputStream;
|
||||
import java.awt.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
@Component
|
||||
public class CustomProcessDiagramGenerator extends DefaultProcessDiagramGenerator implements ICustomProcessDiagramGenerator{
|
||||
//预初始化流程图绘制,大大提升了系统启动后首次查看流程图的速度
|
||||
static {
|
||||
new CustomProcessDiagramCanvas(10,10,0,0,"png", "宋体","宋体","宋体",null);
|
||||
}
|
||||
|
||||
public CustomProcessDiagramCanvas generateProcessDiagram(BpmnModel bpmnModel, String imageType,
|
||||
List<String> highLightedActivities, List<String> highLightedFlows, String activityFontName,
|
||||
String labelFontName, String annotationFontName, ClassLoader customClassLoader, double scaleFactor,
|
||||
Color[] colors, Set<String> currIds) {
|
||||
|
||||
if(null == highLightedActivities) {
|
||||
highLightedActivities = Collections.<String>emptyList();
|
||||
}
|
||||
if(null == highLightedFlows) {
|
||||
highLightedFlows = Collections.<String>emptyList();
|
||||
}
|
||||
|
||||
prepareBpmnModel(bpmnModel);
|
||||
|
||||
CustomProcessDiagramCanvas processDiagramCanvas = initProcessDiagramCanvas(bpmnModel, imageType, activityFontName, labelFontName, annotationFontName, customClassLoader);
|
||||
|
||||
// Draw pool shape, if process is participant in collaboration
|
||||
for (Pool pool : bpmnModel.getPools()) {
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(pool.getId());
|
||||
processDiagramCanvas.drawPoolOrLane(pool.getName(), graphicInfo);
|
||||
}
|
||||
|
||||
// Draw lanes
|
||||
for (Process process : bpmnModel.getProcesses()) {
|
||||
for (Lane lane : process.getLanes()) {
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(lane.getId());
|
||||
processDiagramCanvas.drawPoolOrLane(lane.getName(), graphicInfo);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw activities and their sequence-flows
|
||||
for (Process process: bpmnModel.getProcesses()) {
|
||||
List<FlowNode> flowNodeList= process.findFlowElementsOfType(FlowNode.class);
|
||||
for (FlowNode flowNode : flowNodeList) {
|
||||
drawActivity(processDiagramCanvas, bpmnModel, flowNode, highLightedActivities, highLightedFlows, scaleFactor, colors, currIds);
|
||||
}
|
||||
}
|
||||
|
||||
// Draw artifacts
|
||||
for (Process process : bpmnModel.getProcesses()) {
|
||||
|
||||
for (Artifact artifact : process.getArtifacts()) {
|
||||
drawArtifact(processDiagramCanvas, bpmnModel, artifact);
|
||||
}
|
||||
|
||||
List<SubProcess> subProcesses = process.findFlowElementsOfType(SubProcess.class, true);
|
||||
if (subProcesses != null) {
|
||||
for (SubProcess subProcess : subProcesses) {
|
||||
for (Artifact subProcessArtifact : subProcess.getArtifacts()) {
|
||||
drawArtifact(processDiagramCanvas, bpmnModel, subProcessArtifact);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return processDiagramCanvas;
|
||||
}
|
||||
|
||||
protected void drawActivity(CustomProcessDiagramCanvas processDiagramCanvas, BpmnModel bpmnModel, FlowNode flowNode,
|
||||
List<String> highLightedActivities, List<String> highLightedFlows, double scaleFactor, Color[] colors, Set<String> currIds) {
|
||||
ActivityDrawInstruction drawInstruction = activityDrawInstructions.get(flowNode.getClass());
|
||||
if (drawInstruction != null) {
|
||||
|
||||
drawInstruction.draw(processDiagramCanvas, bpmnModel, flowNode);
|
||||
|
||||
// Gather info on the multi instance marker
|
||||
boolean multiInstanceSequential = false, multiInstanceParallel = false, collapsed = 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 collapsed marker
|
||||
GraphicInfo graphicInfo = bpmnModel.getGraphicInfo(flowNode.getId());
|
||||
if (flowNode instanceof SubProcess) {
|
||||
collapsed = graphicInfo.getExpanded() != null && !graphicInfo.getExpanded();
|
||||
} else if (flowNode instanceof CallActivity) {
|
||||
collapsed = true;
|
||||
}
|
||||
|
||||
if (scaleFactor == 1.0) {
|
||||
// Actually draw the markers
|
||||
processDiagramCanvas.drawActivityMarkers((int) graphicInfo.getX(), (int) graphicInfo.getY(),(int) graphicInfo.getWidth(), (int) graphicInfo.getHeight(),
|
||||
multiInstanceSequential, multiInstanceParallel, collapsed);
|
||||
}
|
||||
|
||||
// Draw highlighted activities
|
||||
if (highLightedActivities.contains(flowNode.getId())) {
|
||||
if(!CollectionUtils.isEmpty(currIds)
|
||||
&&currIds.contains(flowNode.getId())
|
||||
&& !(flowNode instanceof Gateway)) {//非结束节点,并且是当前节点
|
||||
drawHighLight((flowNode instanceof StartEvent), processDiagramCanvas, bpmnModel.getGraphicInfo(flowNode.getId()), colors[1]);
|
||||
}else {//普通节点
|
||||
drawHighLight((flowNode instanceof StartEvent)||(flowNode instanceof EndEvent),processDiagramCanvas, bpmnModel.getGraphicInfo(flowNode.getId()), colors[0]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Outgoing transitions of activity
|
||||
for (SequenceFlow sequenceFlow : flowNode.getOutgoingFlows()) {
|
||||
String flowId = sequenceFlow.getId();
|
||||
boolean highLighted = (highLightedFlows.contains(flowId));
|
||||
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(flowId)) {
|
||||
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(flowId);
|
||||
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();
|
||||
|
||||
}
|
||||
//画高亮线
|
||||
processDiagramCanvas.drawSequenceflow(xPoints, yPoints, false, isDefault, highLighted, scaleFactor, colors[0]);
|
||||
|
||||
// Draw sequenceflow label
|
||||
// GraphicInfo labelGraphicInfo = bpmnModel.getLabelGraphicInfo(flowId);
|
||||
// if (labelGraphicInfo != null) {
|
||||
// processDiagramCanvas.drawLabel(sequenceFlow.getName(), labelGraphicInfo, false);
|
||||
// }else {//解决流程图连线名称不显示的BUG
|
||||
GraphicInfo lineCenter = getLineCenter(graphicInfoList);
|
||||
processDiagramCanvas.drawLabel(highLighted, sequenceFlow.getName(), lineCenter, Math.abs(xPoints[1]-xPoints[0]) >= 5);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
// Nested elements
|
||||
if (flowNode instanceof FlowElementsContainer) {
|
||||
for (FlowElement nestedFlowElement : ((FlowElementsContainer) flowNode).getFlowElements()) {
|
||||
if (nestedFlowElement instanceof FlowNode) {
|
||||
drawActivity(processDiagramCanvas, bpmnModel, (FlowNode) nestedFlowElement,
|
||||
highLightedActivities, highLightedFlows, scaleFactor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
protected void drawHighLight(boolean isStartOrEnd, CustomProcessDiagramCanvas processDiagramCanvas, GraphicInfo graphicInfo, Color color) {
|
||||
processDiagramCanvas.drawHighLight(isStartOrEnd, (int) graphicInfo.getX(), (int) graphicInfo.getY(), (int) graphicInfo.getWidth(), (int) graphicInfo.getHeight(), color);
|
||||
}
|
||||
|
||||
protected static CustomProcessDiagramCanvas initProcessDiagramCanvas(BpmnModel bpmnModel, String imageType,
|
||||
String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader) {
|
||||
|
||||
// We need to calculate maximum values to know how big the image will be in its entirety
|
||||
double minX = Double.MAX_VALUE;
|
||||
double maxX = 0;
|
||||
double minY = Double.MAX_VALUE;
|
||||
double maxY = 0;
|
||||
|
||||
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 https://activiti.atlassian.net/browse/ACT-1431
|
||||
if (flowNodes.isEmpty() && bpmnModel.getPools().isEmpty() && nrOfLanes == 0) {
|
||||
// Nothing to show
|
||||
minX = 0;
|
||||
minY = 0;
|
||||
}
|
||||
|
||||
return new CustomProcessDiagramCanvas((int) maxX + 10,(int) maxY + 10, (int) minX, (int) minY,
|
||||
imageType, activityFontName, labelFontName, annotationFontName, customClassLoader);
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream generateDiagram(BpmnModel bpmnModel, String imageType, List<String> highLightedActivities,
|
||||
List<String> highLightedFlows, String activityFontName, String labelFontName, String annotationFontName,
|
||||
ClassLoader customClassLoader, double scaleFactor, Color[] colors, Set<String> currIds) {
|
||||
CustomProcessDiagramCanvas customProcessDiagramCanvas = generateProcessDiagram(bpmnModel, imageType, highLightedActivities, highLightedFlows,
|
||||
activityFontName, labelFontName, annotationFontName, customClassLoader, scaleFactor,colors, currIds);
|
||||
BufferedImage bufferedImage = customProcessDiagramCanvas.generateBufferedImage(imageType);
|
||||
ByteArrayOutputStream bs = new ByteArrayOutputStream();
|
||||
ImageOutputStream imOut;
|
||||
try {
|
||||
imOut = ImageIO.createImageOutputStream(bs);
|
||||
ImageIO.write(bufferedImage, "PNG", imOut);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
InputStream is = new ByteArrayInputStream(bs.toByteArray());
|
||||
return is;
|
||||
}
|
||||
@Override
|
||||
public InputStream generateDiagram(BpmnModel bpmnModel, String imageType, String activityFontName, String labelFontName, String annotationFontName, ClassLoader customClassLoader) {
|
||||
return generateDiagram(bpmnModel, imageType, Collections.<String>emptyList(), Collections.<String>emptyList(),
|
||||
activityFontName, labelFontName, annotationFontName, customClassLoader, 1.0, new Color[] {Color.BLACK, Color.BLACK}, null);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.jeethink.activiti.config;
|
||||
|
||||
import org.activiti.bpmn.model.BpmnModel;
|
||||
import org.activiti.image.ProcessDiagramGenerator;
|
||||
|
||||
import java.awt.*;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public interface ICustomProcessDiagramGenerator extends ProcessDiagramGenerator {
|
||||
InputStream generateDiagram(BpmnModel bpmnModel, String imageType, List<String> highLightedActivities,
|
||||
List<String> highLightedFlows, String activityFontName, String labelFontName, String annotationFontName,
|
||||
ClassLoader customClassLoader, double scaleFactor, Color[] colors, Set<String> currIds);
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
package com.jeethink.activiti.config;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* 常量类
|
||||
*@author jjd
|
||||
**/
|
||||
public final class WorkflowConstants {
|
||||
|
||||
/**businessKey**/
|
||||
public static final String WORKLOW_BUSINESS_KEY = "businessKey";
|
||||
/**按钮网关**/
|
||||
public static final String WAY_TYPE = "wayType";
|
||||
/**按钮网关**/
|
||||
public static final String WAY_TYPE_PREFIX = "way_type_";
|
||||
/**项目id**/
|
||||
public static final String PROJECT_ID = "projectId";
|
||||
/**核心企业Id变量**/
|
||||
public static final String CORE_ENTERPRISE_ID="coreEnterpriseId";
|
||||
/**链属企业Id变量**/
|
||||
public static final String CHAIN_ENTERPRISE_ID="chainEnterpriseId";
|
||||
/**银行企业Id变量**/
|
||||
public static final String BANK_ENTERPRISE_ID="bankEnterpriseId";
|
||||
/**保理公司Id变量**/
|
||||
public static final String BAOLI_ENTERPRISE_ID="baoliEnterpriseId";
|
||||
/**立账开立企业Id变量**/
|
||||
public static final String START_ENTERPRISE_ID="startEnterpriseId";
|
||||
/**立账合作企业Id变量**/
|
||||
public static final String PARTNER_ENTERPRISE_ID="partnerEnterpriseId";
|
||||
/**母公司企业id**/
|
||||
public static final String PARENT_ENTERPRISE_ID="parentEnterpriseId";
|
||||
/**指定签收企业id**/
|
||||
public static final String RECEIVE_ENTERPRISE_ID ="receiveEnterpriseId";
|
||||
/**转出方企业Id变量**/
|
||||
public static final String TRANSFER_ENTERPRISE_ID="transEnterpriseId";
|
||||
/**指定签收企业id**/
|
||||
public static final String AC_TASK_ID ="acTaskId";
|
||||
/**企业所有角色**/
|
||||
public static final String ENT_ALL_ROLE ="all";
|
||||
/**运营所有角色**/
|
||||
public static final String OPER_ALL_ROLE ="oper";
|
||||
/**流程定义缓存时间**/
|
||||
public static final int PROCESS_DEFINITION_CACHE = 60;
|
||||
/**流程实例激活**/
|
||||
public static final int PROCESS_INSTANCE_ACTIVE = 1;
|
||||
|
||||
/**流程实例挂起**/
|
||||
public static final int PROCESS_INSTANCE_SUSPEND = 0;
|
||||
|
||||
/**读取图片**/
|
||||
public static final String READ_IMAGE = "image";
|
||||
|
||||
/**读取xml**/
|
||||
public static final String READ_XML = "xml";
|
||||
|
||||
/**流程激活**/
|
||||
public static final Integer ACTIVE_PROCESSDEFINITION = 1;
|
||||
|
||||
/**流程挂起**/
|
||||
public static final Integer SUSPEND_PROCESSDEFINITION = 2;
|
||||
|
||||
/**流程状态:0-全部,1-正常,2-已挂起**/
|
||||
public static final int QUERY_ALL = 0;
|
||||
public static final int QUERY_NORMAL = 1;
|
||||
public static final int QUERY_SUSPENDED = 2;
|
||||
|
||||
/**流程实例状态:0-全部,1-正常,2-已删除**/
|
||||
public static final int INSTANCE_ALL = 0;
|
||||
public static final int INSTANCE_NOT_DELETED = 1;
|
||||
public static final int INSTANCE_DELETED = 2;
|
||||
|
||||
/** 系统管理员ID **/
|
||||
public static final String INTERFACE_SYSTEM_ID = "-1";
|
||||
/** 系统管理员名称 **/
|
||||
public static final String INTERFACE_SYSTEM_NAME = "系统操作";
|
||||
|
||||
/** 流程部署类型:1-启动并激活,2-启动即挂起 **/
|
||||
public static final int PROCESS_START_ACTIVE = 1;
|
||||
public static final int PROCESS_START_SUSPEND = 2;
|
||||
|
||||
/** 用于标识流程项目配置信息校验结果:1:新流程,2:新版本, 3:流程类别有误 **/
|
||||
public static final int CHECK_NEW_PROCESS = 1;
|
||||
public static final int CHECK_NEW_VERSION = 2;
|
||||
public static final int CHECK_ERROR_PROCESS_TYPE = 3;
|
||||
|
||||
/** 默认网关条件值 **/
|
||||
public static final Integer default_GATEWAY_CONDITION_VALUE = 1;
|
||||
|
||||
/** 工作流-业务状态表数据类型:1-工作流状态,2-业务状态 **/
|
||||
public static final Integer PROCESS_STATUS = 1;
|
||||
public static final Integer BIZNESS_STATUS = 2;
|
||||
|
||||
/** 新增流程时标识:1-直接保存,2-提示覆盖 **/
|
||||
public static final Integer PROCESS_STATUS_SAVE = 1;
|
||||
public static final Integer BIZNESS_STATUS_WARN = 2;
|
||||
|
||||
/** 模板类型标识:1-新创建或直接导入的模板,2-默认模板生成 **/
|
||||
public static final Integer MODEL_TYPE_1 = 1;
|
||||
public static final Integer MODEL_TYPE_2 = 2;
|
||||
|
||||
/** 查询流程定义标识:1-查询最新版本流程定义,2-查询所有版本 **/
|
||||
public static final Integer QUERY_PROCESS_LATEST_VERSION = 1;
|
||||
public static final Integer QUERY_PROCESS_ALL_VERSION = 2;
|
||||
|
||||
/** 按钮网关 通过1 */
|
||||
public static final String WAY_TYPE_PASS = "1";
|
||||
/** 按钮网关 驳回或结束0 */
|
||||
public static final String WAY_TYPE_REJECT = "0";
|
||||
|
||||
/** 按钮网关 退回2 */
|
||||
public static final String WAY_TYPE_BACK = "2";
|
||||
|
||||
/**任务参数为空**/
|
||||
public static final int TASK_CHECK_PARAM_NULL = -1;
|
||||
/**任务已办理**/
|
||||
public static final int TASK_CHECK_COMPLETED = 1;
|
||||
/**无权限办理**/
|
||||
public static final int TASK_CHECK_NO_PERMISSIONS= 2;
|
||||
/**任务校验通过**/
|
||||
public static final int TASK_CHECK_PASS = 0;
|
||||
/** 动态流程图颜色定义 **/
|
||||
public static final Color COLOR_NORMAL = new Color(0, 205, 0);
|
||||
public static final Color COLOR_CURRENT = new Color(255, 0, 0);
|
||||
|
||||
/** 定义生成流程图时的边距(像素) **/
|
||||
public static final int PROCESS_PADDING = 5;
|
||||
|
||||
/** 定义新版业务进度查询包含的流程类型 **/
|
||||
// public static final List<ProcessTypeEnum> INCLUDE_PROCEE_TYPE = Lists.newArrayList(
|
||||
// ProcessTypeEnum.BUILD_ACCOUNT_APPLY,
|
||||
// ProcessTypeEnum.CREDIT_LETTER_APPLY,
|
||||
// ProcessTypeEnum.CREDIT_LETTER_TRANSFER,
|
||||
// ProcessTypeEnum.CREDIT_LETTER_CASH);
|
||||
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
package com.jeethink.activiti.controller;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.jeethink.activiti.domain.ActIdGroup;
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.page.PageDomain;
|
||||
import com.jeethink.common.core.page.TableDataInfo;
|
||||
import com.jeethink.common.core.page.TableSupport;
|
||||
import com.jeethink.common.utils.StringUtils;
|
||||
|
||||
import org.activiti.engine.IdentityService;
|
||||
import org.activiti.engine.identity.Group;
|
||||
import org.activiti.engine.identity.GroupQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程用户组Controller
|
||||
*
|
||||
* @author Xianlu Tech
|
||||
* @date 2019-10-02
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/activiti/actIdGroup")
|
||||
public class ActIdGroupController extends BaseController
|
||||
{
|
||||
|
||||
|
||||
@Autowired
|
||||
private IdentityService identityService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询流程用户组列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(ActIdGroup query)
|
||||
{
|
||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
Integer pageNum = pageDomain.getPageNum();
|
||||
Integer pageSize = pageDomain.getPageSize();
|
||||
|
||||
GroupQuery groupQuery = identityService.createGroupQuery();
|
||||
if (StringUtils.isNotBlank(query.getId())) {
|
||||
groupQuery.groupId(query.getId());
|
||||
}
|
||||
if (StringUtils.isNotBlank(query.getName())) {
|
||||
groupQuery.groupNameLike("%" + query.getName() + "%");
|
||||
}
|
||||
List<Group> groupList = groupQuery.listPage((pageNum - 1) * pageSize, pageSize);
|
||||
Page<ActIdGroup> list = new Page<>();
|
||||
list.setTotal(groupQuery.count());
|
||||
list.setPageNum(pageNum);
|
||||
list.setPageSize(pageSize);
|
||||
for (Group group: groupList) {
|
||||
ActIdGroup idGroup = new ActIdGroup();
|
||||
idGroup.setId(group.getId());
|
||||
idGroup.setName(group.getName());
|
||||
list.add(idGroup);
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package com.jeethink.activiti.controller;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.jeethink.activiti.domain.ActIdUser;
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.domain.entity.SysUser;
|
||||
import com.jeethink.common.core.page.PageDomain;
|
||||
import com.jeethink.common.core.page.TableDataInfo;
|
||||
import com.jeethink.common.core.page.TableSupport;
|
||||
import com.jeethink.common.utils.StringUtils;
|
||||
import com.jeethink.system.service.ISysUserService;
|
||||
|
||||
import org.activiti.engine.IdentityService;
|
||||
import org.activiti.engine.identity.User;
|
||||
import org.activiti.engine.identity.UserQuery;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程用户Controller
|
||||
*
|
||||
* @author Xianlu Tech
|
||||
* @date 2019-10-02
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/activiti/actIdUser")
|
||||
public class ActIdUserController extends BaseController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private IdentityService identityService;
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询流程用户列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(ActIdUser query)
|
||||
{
|
||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
Integer pageNum = pageDomain.getPageNum();
|
||||
Integer pageSize = pageDomain.getPageSize();
|
||||
|
||||
UserQuery userQuery = identityService.createUserQuery();
|
||||
if (StringUtils.isNotBlank(query.getId())) {
|
||||
userQuery.userId(query.getId());
|
||||
}
|
||||
if (StringUtils.isNotBlank(query.getFirst())) {
|
||||
userQuery.userFirstNameLike("%" + query.getFirst() + "%");
|
||||
}
|
||||
if (StringUtils.isNotBlank(query.getEmail())) {
|
||||
userQuery.userEmailLike("%" + query.getEmail() + "%");
|
||||
}
|
||||
List<User> userList = userQuery.listPage((pageNum - 1) * pageSize, pageSize);
|
||||
Page<ActIdUser> list = new Page<>();
|
||||
list.setTotal(userQuery.count());
|
||||
list.setPageNum(pageNum);
|
||||
list.setPageSize(pageSize);
|
||||
for (User user: userList) {
|
||||
ActIdUser idUser = new ActIdUser();
|
||||
idUser.setId(user.getId());
|
||||
idUser.setFirst(user.getFirstName());
|
||||
idUser.setEmail(user.getEmail());
|
||||
list.add(idUser);
|
||||
}
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 选择系统用户
|
||||
// */
|
||||
// @GetMapping("/authUser/selectUser")
|
||||
// public String selectUser(String taskId, ModelMap mmap) {
|
||||
// mmap.put("taskId", taskId);
|
||||
// return prefix + "/selectUser";
|
||||
// }
|
||||
|
||||
@PostMapping("/systemUserList")
|
||||
@ResponseBody
|
||||
public TableDataInfo systemUserList(SysUser user) {
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectUserList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,301 @@
|
||||
package com.jeethink.activiti.controller;
|
||||
|
||||
import com.jeethink.activiti.config.ICustomProcessDiagramGenerator;
|
||||
import com.jeethink.activiti.config.WorkflowConstants;
|
||||
import com.jeethink.activiti.domain.ActivitiBaseEntity;
|
||||
import com.jeethink.activiti.domain.HistoricActivity;
|
||||
import com.jeethink.activiti.service.IProcessService;
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.core.page.TableDataInfo;
|
||||
import com.jeethink.common.utils.SecurityUtils;
|
||||
import com.jeethink.common.utils.StringUtils;
|
||||
|
||||
import org.activiti.bpmn.model.BpmnModel;
|
||||
import org.activiti.bpmn.model.FlowNode;
|
||||
import org.activiti.bpmn.model.SequenceFlow;
|
||||
import org.activiti.engine.*;
|
||||
import org.activiti.engine.history.HistoricActivityInstance;
|
||||
import org.activiti.engine.history.HistoricProcessInstance;
|
||||
import org.activiti.engine.impl.RepositoryServiceImpl;
|
||||
import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntity;
|
||||
import org.activiti.engine.impl.persistence.entity.TaskEntityImpl;
|
||||
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.apache.commons.lang3.BooleanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.awt.*;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/process")
|
||||
public class ProcessController extends BaseController {
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private RepositoryService repositoryService;
|
||||
|
||||
@Autowired
|
||||
private HistoryService historyService;
|
||||
|
||||
@Autowired
|
||||
private ProcessEngine processEngine;
|
||||
|
||||
@Autowired
|
||||
private IProcessService processService;
|
||||
|
||||
@Autowired
|
||||
private RuntimeService runtimeService;
|
||||
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
|
||||
|
||||
/**
|
||||
* 审批历史列表
|
||||
* @param instanceId
|
||||
* @return
|
||||
*/
|
||||
// @RequiresPermissions("process:leave:list")
|
||||
@GetMapping("/listHistory/{instanceId}")
|
||||
@ResponseBody
|
||||
public TableDataInfo listHistory(@PathVariable String instanceId, HistoricActivity historicActivity) {
|
||||
startPage();
|
||||
List<HistoricActivity> list = processService.selectHistoryList(instanceId, historicActivity);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/read-resource")
|
||||
public void readResource(String pProcessInstanceId, HttpServletResponse response)
|
||||
throws Exception {
|
||||
|
||||
String processDefinitionId = "";
|
||||
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(pProcessInstanceId).singleResult();
|
||||
if(processInstance == null) {
|
||||
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery().processInstanceId(pProcessInstanceId).singleResult();
|
||||
processDefinitionId = historicProcessInstance.getProcessDefinitionId();
|
||||
} else {
|
||||
processDefinitionId = processInstance.getProcessDefinitionId();
|
||||
}
|
||||
ProcessDefinitionQuery pdq = repositoryService.createProcessDefinitionQuery();
|
||||
ProcessDefinition pd = pdq.processDefinitionId(processDefinitionId).singleResult();
|
||||
|
||||
String resourceName = pd.getDiagramResourceName();
|
||||
|
||||
if(resourceName.endsWith(".png") && StringUtils.isEmpty(pProcessInstanceId) == false)
|
||||
{
|
||||
getActivitiProccessImage(pProcessInstanceId,response);
|
||||
//ProcessDiagramGenerator.generateDiagram(pde, "png", getRuntimeService().getActiveActivityIds(processInstanceId));
|
||||
}
|
||||
else
|
||||
{
|
||||
// 通过接口读取
|
||||
InputStream resourceAsStream = repositoryService.getResourceAsStream(pd.getDeploymentId(), resourceName);
|
||||
|
||||
// 输出资源内容到相应对象
|
||||
byte[] b = new byte[1024];
|
||||
int len = -1;
|
||||
while ((len = resourceAsStream.read(b, 0, 1024)) != -1) {
|
||||
response.getOutputStream().write(b, 0, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取流程图像,已执行节点和流程线高亮显示
|
||||
*/
|
||||
public void getActivitiProccessImage(String pProcessInstanceId, HttpServletResponse response) {
|
||||
//logger.info("[开始]-获取流程图图像");
|
||||
try {
|
||||
// 获取历史流程实例
|
||||
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
|
||||
.processInstanceId(pProcessInstanceId).singleResult();
|
||||
|
||||
if (historicProcessInstance == null) {
|
||||
//throw new BusinessException("获取流程实例ID[" + pProcessInstanceId + "]对应的历史流程实例失败!");
|
||||
}
|
||||
else {
|
||||
// 获取流程定义
|
||||
ProcessDefinitionEntity processDefinition = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
|
||||
.getDeployedProcessDefinition(historicProcessInstance.getProcessDefinitionId());
|
||||
|
||||
// 获取流程历史中已执行节点,并按照节点在流程中执行先后顺序排序
|
||||
List<HistoricActivityInstance> historicActivityInstanceList = historyService.createHistoricActivityInstanceQuery()
|
||||
.processInstanceId(pProcessInstanceId).orderByHistoricActivityInstanceId().asc().list();
|
||||
|
||||
// 已执行的节点ID集合
|
||||
List<String> executedActivityIdList = new ArrayList<String>();
|
||||
int index = 1;
|
||||
//logger.info("获取已经执行的节点ID");
|
||||
for (HistoricActivityInstance activityInstance : historicActivityInstanceList) {
|
||||
executedActivityIdList.add(activityInstance.getActivityId());
|
||||
|
||||
//logger.info("第[" + index + "]个已执行节点=" + activityInstance.getActivityId() + " : " +activityInstance.getActivityName());
|
||||
index++;
|
||||
}
|
||||
|
||||
BpmnModel bpmnModel = repositoryService.getBpmnModel(historicProcessInstance.getProcessDefinitionId());
|
||||
|
||||
// 已执行的线集合
|
||||
List<String> flowIds = new ArrayList<String>();
|
||||
// 获取流程走过的线 (getHighLightedFlows是下面的方法)
|
||||
flowIds = getHighLightedFlows(bpmnModel,processDefinition, historicActivityInstanceList);
|
||||
|
||||
// // 获取流程图图像字符流
|
||||
// ProcessDiagramGenerator pec = processEngine.getProcessEngineConfiguration().getProcessDiagramGenerator();
|
||||
// //配置字体
|
||||
// InputStream imageStream = pec.generateDiagram(bpmnModel, "png", executedActivityIdList, flowIds,"宋体","微软雅黑","黑体",null,2.0);
|
||||
|
||||
Set<String> currIds = runtimeService.createExecutionQuery().processInstanceId(pProcessInstanceId).list()
|
||||
.stream().map(e->e.getActivityId()).collect(Collectors.toSet());
|
||||
|
||||
ICustomProcessDiagramGenerator diagramGenerator = (ICustomProcessDiagramGenerator) processEngine.getProcessEngineConfiguration().getProcessDiagramGenerator();
|
||||
InputStream imageStream = diagramGenerator.generateDiagram(bpmnModel, "png", executedActivityIdList,
|
||||
flowIds, "宋体", "宋体", "宋体", null, 1.0, new Color[] { WorkflowConstants.COLOR_NORMAL, WorkflowConstants.COLOR_CURRENT }, currIds);
|
||||
|
||||
response.setContentType("image/png");
|
||||
OutputStream os = response.getOutputStream();
|
||||
int bytesRead = 0;
|
||||
byte[] buffer = new byte[8192];
|
||||
while ((bytesRead = imageStream.read(buffer, 0, 8192)) != -1) {
|
||||
os.write(buffer, 0, bytesRead);
|
||||
}
|
||||
os.close();
|
||||
imageStream.close();
|
||||
}
|
||||
//logger.info("[完成]-获取流程图图像");
|
||||
} catch (Exception e) {
|
||||
System.out.println(e.getMessage());
|
||||
//logger.error("【异常】-获取流程图失败!" + e.getMessage());
|
||||
//throw new BusinessException("获取流程图失败!" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> getHighLightedFlows(BpmnModel bpmnModel,ProcessDefinitionEntity processDefinitionEntity,List<HistoricActivityInstance> historicActivityInstances) {
|
||||
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); //24小时制
|
||||
List<String> highFlows = new ArrayList<String>();// 用以保存高亮的线flowId
|
||||
|
||||
for (int i = 0; i < historicActivityInstances.size() - 1; i++) {
|
||||
// 对历史流程节点进行遍历
|
||||
// 得到节点定义的详细信息
|
||||
FlowNode activityImpl = (FlowNode)bpmnModel.getMainProcess().getFlowElement(historicActivityInstances.get(i).getActivityId());
|
||||
|
||||
|
||||
List<FlowNode> sameStartTimeNodes = new ArrayList<FlowNode>();// 用以保存后续开始时间相同的节点
|
||||
FlowNode sameActivityImpl1 = null;
|
||||
|
||||
HistoricActivityInstance activityImpl_ = historicActivityInstances.get(i);// 第一个节点
|
||||
HistoricActivityInstance activityImp2_ ;
|
||||
|
||||
for(int k = i + 1 ; k <= historicActivityInstances.size() - 1; k++) {
|
||||
activityImp2_ = historicActivityInstances.get(k);// 后续第1个节点
|
||||
|
||||
if ( activityImpl_.getActivityType().equals("userTask") && activityImp2_.getActivityType().equals("userTask") &&
|
||||
df.format(activityImpl_.getStartTime()).equals(df.format(activityImp2_.getStartTime())) ) //都是usertask,且主节点与后续节点的开始时间相同,说明不是真实的后继节点
|
||||
{
|
||||
|
||||
}
|
||||
else {
|
||||
sameActivityImpl1 = (FlowNode)bpmnModel.getMainProcess().getFlowElement(historicActivityInstances.get(k).getActivityId());//找到紧跟在后面的一个节点
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
sameStartTimeNodes.add(sameActivityImpl1); // 将后面第一个节点放在时间相同节点的集合里
|
||||
for (int j = i + 1; j < historicActivityInstances.size() - 1; j++) {
|
||||
HistoricActivityInstance activityImpl1 = historicActivityInstances.get(j);// 后续第一个节点
|
||||
HistoricActivityInstance activityImpl2 = historicActivityInstances.get(j + 1);// 后续第二个节点
|
||||
|
||||
if (df.format(activityImpl1.getStartTime()).equals(df.format(activityImpl2.getStartTime())) )
|
||||
{// 如果第一个节点和第二个节点开始时间相同保存
|
||||
FlowNode sameActivityImpl2 = (FlowNode)bpmnModel.getMainProcess().getFlowElement(activityImpl2.getActivityId());
|
||||
sameStartTimeNodes.add(sameActivityImpl2);
|
||||
}
|
||||
else
|
||||
{// 有不相同跳出循环
|
||||
break;
|
||||
}
|
||||
}
|
||||
List<SequenceFlow> pvmTransitions = activityImpl.getOutgoingFlows() ; // 取出节点的所有出去的线
|
||||
|
||||
for (SequenceFlow pvmTransition : pvmTransitions)
|
||||
{// 对所有的线进行遍历
|
||||
FlowNode pvmActivityImpl = (FlowNode)bpmnModel.getMainProcess().getFlowElement( pvmTransition.getTargetRef());// 如果取出的线的目标节点存在时间相同的节点里,保存该线的id,进行高亮显示
|
||||
if (sameStartTimeNodes.contains(pvmActivityImpl)) {
|
||||
highFlows.add(pvmTransition.getId());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return highFlows;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/delegate")
|
||||
@ResponseBody
|
||||
public AjaxResult delegate(String taskId, String delegateToUser) {
|
||||
processService.delegate(taskId, SecurityUtils.getUsername(), delegateToUser);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping( "/cancelApply/{instanceId}")
|
||||
@ResponseBody
|
||||
public AjaxResult cancelApply(@PathVariable String instanceId) {
|
||||
processService.cancelApply(instanceId, "用户撤销");
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PostMapping( "/suspendOrActiveApply")
|
||||
@ResponseBody
|
||||
public AjaxResult suspendOrActiveApply(@RequestBody ActivitiBaseEntity activitiBaseEntity) {
|
||||
processService.suspendOrActiveApply(activitiBaseEntity.getInstanceId(), activitiBaseEntity.getSuspendState());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("/showVerifyDialog/{taskId}")
|
||||
public AjaxResult showVerifyDialog(@PathVariable("taskId") String taskId) {
|
||||
Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
|
||||
String verifyName = task.getTaskDefinitionKey().substring(0, 1).toUpperCase() + task.getTaskDefinitionKey().substring(1);
|
||||
return AjaxResult.success(verifyName);
|
||||
}
|
||||
/**
|
||||
* 完成任务
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/complete")
|
||||
@ResponseBody
|
||||
public AjaxResult complete( @RequestBody ActivitiBaseEntity activitiBaseEntity) {
|
||||
List<Task> taskList = taskService.createTaskQuery()
|
||||
.processInstanceId(activitiBaseEntity.getInstanceId())
|
||||
// .singleResult();
|
||||
.list();
|
||||
|
||||
if (!CollectionUtils.isEmpty(taskList)) {
|
||||
TaskEntityImpl task = (TaskEntityImpl) taskList.get(0);
|
||||
activitiBaseEntity.setTaskId(task.getId());
|
||||
|
||||
}
|
||||
processService.complete(activitiBaseEntity,"leave");
|
||||
return AjaxResult.success("任务已完成");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,189 @@
|
||||
package com.jeethink.activiti.controller;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.jeethink.activiti.domain.ProcessDefinition;
|
||||
import com.jeethink.activiti.service.ProcessDefinitionService;
|
||||
import com.jeethink.common.annotation.Log;
|
||||
import com.jeethink.common.config.JeeThinkConfig;
|
||||
import com.jeethink.common.constant.Constants;
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.core.page.TableDataInfo;
|
||||
import com.jeethink.common.enums.BusinessType;
|
||||
import com.jeethink.common.utils.StringUtils;
|
||||
import com.jeethink.common.utils.file.FileUploadUtils;
|
||||
|
||||
import org.activiti.bpmn.converter.BpmnXMLConverter;
|
||||
import org.activiti.bpmn.model.BpmnModel;
|
||||
import org.activiti.editor.constants.ModelDataJsonConstants;
|
||||
import org.activiti.editor.language.json.converter.BpmnJsonConverter;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.repository.Model;
|
||||
import org.activiti.engine.repository.ProcessDefinitionQuery;
|
||||
import org.apache.ibatis.annotations.Delete;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.aspectj.weaver.loadtime.Aj;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.xml.stream.XMLInputFactory;
|
||||
import javax.xml.stream.XMLStreamException;
|
||||
import javax.xml.stream.XMLStreamReader;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.List;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/definition")
|
||||
public class ProcessDefinitionController extends BaseController {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ProcessDefinitionController.class);
|
||||
|
||||
private String prefix = "definition";
|
||||
|
||||
@Autowired
|
||||
private ProcessDefinitionService processDefinitionService;
|
||||
@Autowired
|
||||
private RepositoryService repositoryService;
|
||||
|
||||
|
||||
@GetMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(ProcessDefinition processDefinition) {
|
||||
List<ProcessDefinition> list = processDefinitionService.listProcessDefinition(processDefinition);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 部署流程定义
|
||||
*/
|
||||
@Log(title = "流程定义", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/upload")
|
||||
@ResponseBody
|
||||
public AjaxResult upload(MultipartFile file) {
|
||||
try {
|
||||
if (!file.isEmpty()) {
|
||||
String extensionName = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf('.') + 1);
|
||||
if (!"bpmn".equalsIgnoreCase(extensionName)
|
||||
&& !"zip".equalsIgnoreCase(extensionName)
|
||||
&& !"bar".equalsIgnoreCase(extensionName)) {
|
||||
return AjaxResult.error("流程定义文件仅支持 bpmn, zip 和 bar 格式!");
|
||||
}
|
||||
// p.s. 此时 FileUploadUtils.upload() 返回字符串 fileName 前缀为 Constants.RESOURCE_PREFIX,需剔除
|
||||
// 详见: FileUploadUtils.getPathFileName(...)
|
||||
String fileName = FileUploadUtils.upload(JeeThinkConfig.getProfile()+ "/processDefiniton", file);
|
||||
|
||||
if (StringUtils.isNotBlank(fileName)) {
|
||||
String realFilePath = JeeThinkConfig.getProfile()+ fileName.substring(Constants.RESOURCE_PREFIX.length());
|
||||
processDefinitionService.deployProcessDefinition(realFilePath);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
return AjaxResult.error("不允许上传空文件!");
|
||||
}
|
||||
catch (Exception e) {
|
||||
log.error("上传流程定义文件失败!", e);
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Log(title = "流程定义", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/remove/{ids}")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids) {
|
||||
try {
|
||||
return toAjax(processDefinitionService.deleteProcessDeploymentByIds(ids));
|
||||
}
|
||||
catch (Exception e) {
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// @Log(title = "流程定义", businessType = BusinessType.EXPORT)
|
||||
// @PostMapping("/export")
|
||||
// @ResponseBody
|
||||
// public AjaxResult export() {
|
||||
// List<ProcessDefinition> list = processDefinitionService.listProcessDefinition(new ProcessDefinition());
|
||||
// ExcelUtil<ProcessDefinition> util = new ExcelUtil<>(ProcessDefinition.class);
|
||||
// return util.exportExcel(list, "流程定义数据");
|
||||
// }
|
||||
|
||||
@PostMapping( "/suspendOrActiveApply")
|
||||
@ResponseBody
|
||||
public AjaxResult suspendOrActiveApply(@RequestBody ProcessDefinition processDefinition) {
|
||||
processDefinitionService.suspendOrActiveApply(processDefinition.getId(), processDefinition.getSuspendState());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取流程资源
|
||||
*
|
||||
* @param processDefinitionId 流程定义ID
|
||||
* @param resourceName 资源名称
|
||||
*/
|
||||
@RequestMapping(value = "/readResource")
|
||||
public void readResource(@RequestParam("processDefinitionId") String processDefinitionId, @RequestParam("resourceName") String resourceName, HttpServletResponse response)
|
||||
throws Exception {
|
||||
ProcessDefinitionQuery pdq = repositoryService.createProcessDefinitionQuery();
|
||||
org.activiti.engine.repository.ProcessDefinition pd = pdq.processDefinitionId(processDefinitionId).singleResult();
|
||||
|
||||
// 通过接口读取
|
||||
InputStream resourceAsStream = repositoryService.getResourceAsStream(pd.getDeploymentId(), resourceName);
|
||||
|
||||
// 输出资源内容到相应对象
|
||||
byte[] b = new byte[1024];
|
||||
int len = -1;
|
||||
while ((len = resourceAsStream.read(b, 0, 1024)) != -1) {
|
||||
response.getOutputStream().write(b, 0, len);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换流程定义为模型
|
||||
* @param processDefinitionId
|
||||
* @return
|
||||
* @throws UnsupportedEncodingException
|
||||
* @throws XMLStreamException
|
||||
*/
|
||||
@PostMapping(value = "/convert2Model")
|
||||
@ResponseBody
|
||||
public AjaxResult convertToModel(@RequestBody String processDefinitionId)
|
||||
throws UnsupportedEncodingException, XMLStreamException {
|
||||
org.activiti.engine.repository.ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery()
|
||||
.processDefinitionId(processDefinitionId).singleResult();
|
||||
|
||||
InputStream bpmnStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(),
|
||||
processDefinition.getResourceName());
|
||||
XMLInputFactory xif = XMLInputFactory.newInstance();
|
||||
InputStreamReader in = new InputStreamReader(bpmnStream, "UTF-8");
|
||||
XMLStreamReader xtr = xif.createXMLStreamReader(in);
|
||||
BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(xtr);
|
||||
|
||||
BpmnJsonConverter converter = new BpmnJsonConverter();
|
||||
ObjectNode modelNode = converter.convertToJson(bpmnModel);
|
||||
Model modelData = repositoryService.newModel();
|
||||
modelData.setKey(processDefinition.getKey());
|
||||
modelData.setName(processDefinition.getResourceName());
|
||||
modelData.setCategory(processDefinition.getDeploymentId());
|
||||
|
||||
ObjectNode modelObjectNode = new ObjectMapper().createObjectNode();
|
||||
modelObjectNode.put(ModelDataJsonConstants.MODEL_NAME, processDefinition.getName());
|
||||
modelObjectNode.put(ModelDataJsonConstants.MODEL_REVISION, 1);
|
||||
modelObjectNode.put(ModelDataJsonConstants.MODEL_DESCRIPTION, processDefinition.getDescription());
|
||||
modelData.setMetaInfo(modelObjectNode.toString());
|
||||
|
||||
repositoryService.saveModel(modelData);
|
||||
|
||||
repositoryService.addModelEditorSource(modelData.getId(), modelNode.toString().getBytes("utf-8"));
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
package com.jeethink.activiti.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import com.jeethink.common.annotation.Excel;
|
||||
import com.jeethink.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 流程用户组对象 act_id_group
|
||||
*
|
||||
* @author Xianlu Tech
|
||||
* @date 2019-10-02
|
||||
*/
|
||||
public class ActIdGroup extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
@Excel(name = "组ID")
|
||||
private String id;
|
||||
|
||||
/** 版本 */
|
||||
private Long rev;
|
||||
|
||||
/** 名称 */
|
||||
@Excel(name = "名称")
|
||||
private String name;
|
||||
|
||||
/** 类型 */
|
||||
private String type;
|
||||
|
||||
private String[] userIds;
|
||||
|
||||
/** 用户是否存在此用户组标识 默认不存在 */
|
||||
private boolean flag = false;
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setRev(Long rev)
|
||||
{
|
||||
this.rev = rev;
|
||||
}
|
||||
|
||||
public Long getRev()
|
||||
{
|
||||
return rev;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
public String[] getUserIds() {
|
||||
return userIds;
|
||||
}
|
||||
|
||||
public void setUserIds(String[] userIds) {
|
||||
this.userIds = userIds;
|
||||
}
|
||||
|
||||
public boolean isFlag() {
|
||||
return flag;
|
||||
}
|
||||
|
||||
public void setFlag(boolean flag) {
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("rev", getRev())
|
||||
.append("name", getName())
|
||||
.append("type", getType())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,141 @@
|
||||
package com.jeethink.activiti.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import com.jeethink.common.annotation.Excel;
|
||||
import com.jeethink.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 流程用户对象 act_id_user
|
||||
*
|
||||
* @author Xianlu Tech
|
||||
* @date 2019-10-02
|
||||
*/
|
||||
public class ActIdUser extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
@Excel(name = "用户ID")
|
||||
private String id;
|
||||
|
||||
/** 版本 */
|
||||
private Long rev;
|
||||
|
||||
/** 名字 */
|
||||
@Excel(name = "名字")
|
||||
private String first;
|
||||
|
||||
/** 姓氏 */
|
||||
private String last;
|
||||
|
||||
/** 邮箱 */
|
||||
@Excel(name = "邮箱")
|
||||
private String email;
|
||||
|
||||
/** 密码 */
|
||||
private String pwd;
|
||||
|
||||
/** 头像 */
|
||||
private String pictureId;
|
||||
|
||||
/** 用户组 */
|
||||
private String[] groupIds;
|
||||
|
||||
/** 用户组是否存在此用户标识 默认不存在 */
|
||||
private boolean flag = false;
|
||||
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setRev(Long rev)
|
||||
{
|
||||
this.rev = rev;
|
||||
}
|
||||
|
||||
public Long getRev()
|
||||
{
|
||||
return rev;
|
||||
}
|
||||
public void setFirst(String first)
|
||||
{
|
||||
this.first = first;
|
||||
}
|
||||
|
||||
public String getFirst()
|
||||
{
|
||||
return first;
|
||||
}
|
||||
public void setLast(String last)
|
||||
{
|
||||
this.last = last;
|
||||
}
|
||||
|
||||
public String getLast()
|
||||
{
|
||||
return last;
|
||||
}
|
||||
public void setEmail(String email)
|
||||
{
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getEmail()
|
||||
{
|
||||
return email;
|
||||
}
|
||||
public void setPwd(String pwd)
|
||||
{
|
||||
this.pwd = pwd;
|
||||
}
|
||||
|
||||
public String getPwd()
|
||||
{
|
||||
return pwd;
|
||||
}
|
||||
public void setPictureId(String pictureId)
|
||||
{
|
||||
this.pictureId = pictureId;
|
||||
}
|
||||
|
||||
public String getPictureId()
|
||||
{
|
||||
return pictureId;
|
||||
}
|
||||
|
||||
public String[] getGroupIds() {
|
||||
return groupIds;
|
||||
}
|
||||
|
||||
public void setGroupIds(String[] groupIds) {
|
||||
this.groupIds = groupIds;
|
||||
}
|
||||
|
||||
public boolean isFlag() {
|
||||
return flag;
|
||||
}
|
||||
|
||||
public void setFlag(boolean flag) {
|
||||
this.flag = flag;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("rev", getRev())
|
||||
.append("first", getFirst())
|
||||
.append("last", getLast())
|
||||
.append("email", getEmail())
|
||||
.append("pwd", getPwd())
|
||||
.append("pictureId", getPictureId())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,131 @@
|
||||
package com.jeethink.activiti.domain;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.jeethink.common.annotation.Excel;
|
||||
import com.jeethink.common.core.domain.BaseEntity;
|
||||
|
||||
public class ActivitiBaseEntity extends BaseEntity {
|
||||
|
||||
/** 流程实例ID */
|
||||
@Excel(name = "流程实例ID")
|
||||
private String instanceId;
|
||||
/** 申请人姓名 */
|
||||
private String applyUserName;
|
||||
/** 标题 */
|
||||
@Excel(name = "标题")
|
||||
private String title;
|
||||
|
||||
/** 原因 */
|
||||
@Excel(name = "原因")
|
||||
private String reason;
|
||||
|
||||
/** 任务ID */
|
||||
private String taskId;
|
||||
|
||||
/** 任务名称 */
|
||||
private String taskName;
|
||||
|
||||
/** 办理时间 */
|
||||
private Date doneTime;
|
||||
|
||||
/** 创建人 */
|
||||
private String createUserName;
|
||||
|
||||
|
||||
/** 流程实例状态 1 激活 2 挂起 */
|
||||
private String suspendState;
|
||||
private Map<String, Object> processParams;
|
||||
|
||||
|
||||
public String getApplyUserName() {
|
||||
return applyUserName;
|
||||
}
|
||||
|
||||
public void setApplyUserName(String applyUserName) {
|
||||
this.applyUserName = applyUserName;
|
||||
}
|
||||
|
||||
public String getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
|
||||
public void setTaskId(String taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public String getTaskName() {
|
||||
return taskName;
|
||||
}
|
||||
|
||||
public void setTaskName(String taskName) {
|
||||
this.taskName = taskName;
|
||||
}
|
||||
|
||||
public Date getDoneTime() {
|
||||
return doneTime;
|
||||
}
|
||||
|
||||
public void setDoneTime(Date doneTime) {
|
||||
this.doneTime = doneTime;
|
||||
}
|
||||
|
||||
public String getCreateUserName() {
|
||||
return createUserName;
|
||||
}
|
||||
|
||||
public void setCreateUserName(String createUserName) {
|
||||
this.createUserName = createUserName;
|
||||
}
|
||||
|
||||
public String getSuspendState() {
|
||||
return suspendState;
|
||||
}
|
||||
|
||||
public void setSuspendState(String suspendState) {
|
||||
this.suspendState = suspendState;
|
||||
}
|
||||
|
||||
public void setInstanceId(String instanceId)
|
||||
{
|
||||
this.instanceId = instanceId;
|
||||
}
|
||||
|
||||
public String getInstanceId()
|
||||
{
|
||||
return instanceId;
|
||||
}
|
||||
|
||||
public void setTitle(String title)
|
||||
{
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getTitle()
|
||||
{
|
||||
return title;
|
||||
}
|
||||
public void setReason(String reason)
|
||||
{
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
public String getReason()
|
||||
{
|
||||
return reason;
|
||||
}
|
||||
|
||||
public Map<String, Object> getProcessParams() {
|
||||
if (processParams == null)
|
||||
{
|
||||
processParams = new HashMap<>();
|
||||
}
|
||||
return processParams;
|
||||
}
|
||||
|
||||
public void setProcessParams(Map<String, Object> processParams) {
|
||||
this.processParams = processParams;
|
||||
}
|
||||
}
|
@ -0,0 +1,218 @@
|
||||
package com.jeethink.activiti.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import com.jeethink.common.annotation.Excel;
|
||||
import com.jeethink.common.core.domain.BaseEntity;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 待办事项对象 biz_todo_item
|
||||
*
|
||||
* @author Xianlu Tech
|
||||
* @date 2019-11-08
|
||||
*/
|
||||
public class BizTodoItem extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 ID */
|
||||
private Long id;
|
||||
|
||||
/** 事项标题 */
|
||||
@Excel(name = "事项标题")
|
||||
private String itemName;
|
||||
|
||||
/** 事项内容 */
|
||||
@Excel(name = "事项内容")
|
||||
private String itemContent;
|
||||
|
||||
/** 模块名称 (必须以 uri 一致) */
|
||||
@Excel(name = "模块名称")
|
||||
private String module;
|
||||
|
||||
/** 任务 ID */
|
||||
@Excel(name = "任务 ID")
|
||||
private String taskId;
|
||||
|
||||
/** 流程实例 ID */
|
||||
@Excel(name = "流程实例 ID")
|
||||
private String instanceId;
|
||||
|
||||
/** 任务名称 (必须以表单页面名称一致) */
|
||||
@Excel(name = "任务名称")
|
||||
private String taskName;
|
||||
|
||||
/** 节点名称 */
|
||||
@Excel(name = "节点名称")
|
||||
private String nodeName;
|
||||
|
||||
/** 是否查看 default 0 (0 否 1 是) */
|
||||
@Excel(name = "是否查看")
|
||||
private String isView;
|
||||
|
||||
/** 是否处理 default 0 (0 否 1 是) */
|
||||
@Excel(name = "是否处理")
|
||||
private String isHandle;
|
||||
|
||||
/** 待办人 ID */
|
||||
@Excel(name = "待办人 ID")
|
||||
private String todoUserId;
|
||||
|
||||
/** 待办人名称 */
|
||||
@Excel(name = "待办人名称")
|
||||
private String todoUserName;
|
||||
|
||||
/** 处理人 ID */
|
||||
@Excel(name = "处理人 ID")
|
||||
private String handleUserId;
|
||||
|
||||
/** 处理人名称 */
|
||||
@Excel(name = "处理人名称")
|
||||
private String handleUserName;
|
||||
|
||||
/** 通知时间 */
|
||||
@Excel(name = "通知时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date todoTime;
|
||||
|
||||
/** 处理时间 */
|
||||
@Excel(name = "处理时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date handleTime;
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
public void setItemName(String itemName) {
|
||||
this.itemName = itemName;
|
||||
}
|
||||
|
||||
public String getItemName() {
|
||||
return itemName;
|
||||
}
|
||||
public void setItemContent(String itemContent) {
|
||||
this.itemContent = itemContent;
|
||||
}
|
||||
|
||||
public String getItemContent() {
|
||||
return itemContent;
|
||||
}
|
||||
public void setModule(String module) {
|
||||
this.module = module;
|
||||
}
|
||||
|
||||
public String getModule() {
|
||||
return module;
|
||||
}
|
||||
public void setTaskId(String taskId) {
|
||||
this.taskId = taskId;
|
||||
}
|
||||
|
||||
public String getTaskId() {
|
||||
return taskId;
|
||||
}
|
||||
public void setTaskName(String taskName) {
|
||||
this.taskName = taskName;
|
||||
}
|
||||
|
||||
public String getNodeName() {
|
||||
return nodeName;
|
||||
}
|
||||
|
||||
public void setNodeName(String nodeName) {
|
||||
this.nodeName = nodeName;
|
||||
}
|
||||
|
||||
public String getTaskName() {
|
||||
return taskName;
|
||||
}
|
||||
public void setIsView(String isView) {
|
||||
this.isView = isView;
|
||||
}
|
||||
|
||||
public String getIsView() {
|
||||
return isView;
|
||||
}
|
||||
public void setIsHandle(String isHandle) {
|
||||
this.isHandle = isHandle;
|
||||
}
|
||||
|
||||
public String getIsHandle() {
|
||||
return isHandle;
|
||||
}
|
||||
public void setTodoUserId(String todoUserId) {
|
||||
this.todoUserId = todoUserId;
|
||||
}
|
||||
|
||||
public String getTodoUserId() {
|
||||
return todoUserId;
|
||||
}
|
||||
public void setTodoUserName(String todoUserName) {
|
||||
this.todoUserName = todoUserName;
|
||||
}
|
||||
|
||||
public String getTodoUserName() {
|
||||
return todoUserName;
|
||||
}
|
||||
public void setHandleUserId(String handleUserId) {
|
||||
this.handleUserId = handleUserId;
|
||||
}
|
||||
|
||||
public String getHandleUserId() {
|
||||
return handleUserId;
|
||||
}
|
||||
public void setHandleUserName(String handleUserName) {
|
||||
this.handleUserName = handleUserName;
|
||||
}
|
||||
|
||||
public String getHandleUserName() {
|
||||
return handleUserName;
|
||||
}
|
||||
public void setTodoTime(Date todoTime) {
|
||||
this.todoTime = todoTime;
|
||||
}
|
||||
|
||||
public Date getTodoTime() {
|
||||
return todoTime;
|
||||
}
|
||||
public void setHandleTime(Date handleTime) {
|
||||
this.handleTime = handleTime;
|
||||
}
|
||||
|
||||
public Date getHandleTime() {
|
||||
return handleTime;
|
||||
}
|
||||
|
||||
public String getInstanceId() {
|
||||
return instanceId;
|
||||
}
|
||||
|
||||
public void setInstanceId(String instanceId) {
|
||||
this.instanceId = instanceId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("itemName", getItemName())
|
||||
.append("itemContent", getItemContent())
|
||||
.append("module", getModule())
|
||||
.append("instanceId", getInstanceId())
|
||||
.append("taskId", getTaskId())
|
||||
.append("taskName", getTaskName())
|
||||
.append("isView", getIsView())
|
||||
.append("isHandle", getIsHandle())
|
||||
.append("todoUserId", getTodoUserId())
|
||||
.append("todoUserName", getTodoUserName())
|
||||
.append("handleUserId", getHandleUserId())
|
||||
.append("handleUserName", getHandleUserName())
|
||||
.append("todoTime", getTodoTime())
|
||||
.append("handleTime", getHandleTime())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.jeethink.activiti.domain;
|
||||
|
||||
import org.activiti.engine.impl.persistence.entity.HistoricActivityInstanceEntityImpl;
|
||||
|
||||
public class HistoricActivity extends HistoricActivityInstanceEntityImpl {
|
||||
|
||||
/** 审批批注 */
|
||||
private String comment;
|
||||
|
||||
/** 办理人姓名 */
|
||||
private String assigneeName;
|
||||
|
||||
public String getComment() {
|
||||
return comment;
|
||||
}
|
||||
|
||||
public void setComment(String comment) {
|
||||
this.comment = comment;
|
||||
}
|
||||
|
||||
public String getAssigneeName() {
|
||||
return assigneeName;
|
||||
}
|
||||
|
||||
public void setAssigneeName(String assigneeName) {
|
||||
this.assigneeName = assigneeName;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.jeethink.activiti.domain;
|
||||
|
||||
import com.jeethink.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 汇讯数码科技(深圳)有限公司
|
||||
* 创建日期:2020/9/14-13:57
|
||||
* 版本 开发者 日期
|
||||
* 1.0 Danny 2020/9/14
|
||||
*/
|
||||
public class ModelerVo {
|
||||
private String name;
|
||||
private String key;
|
||||
private String description;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
package com.jeethink.activiti.domain;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.jeethink.common.annotation.Excel;
|
||||
import com.jeethink.common.core.domain.BaseEntity;
|
||||
|
||||
public class ProcessDefinition extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String id;
|
||||
|
||||
@Excel(name = "流程名称")
|
||||
private String name;
|
||||
|
||||
@Excel(name = "流程KEY")
|
||||
private String key;
|
||||
|
||||
@Excel(name = "流程版本")
|
||||
private int version;
|
||||
|
||||
@Excel(name = "所属分类")
|
||||
private String category;
|
||||
|
||||
@Excel(name = "流程描述")
|
||||
private String description;
|
||||
|
||||
private String deploymentId;
|
||||
|
||||
@Excel(name = "部署时间", dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date deploymentTime;
|
||||
|
||||
@Excel(name = "流程图")
|
||||
private String diagramResourceName;
|
||||
|
||||
@Excel(name = "流程定义")
|
||||
private String resourceName;
|
||||
|
||||
/** 流程实例状态 1 激活 2 挂起 */
|
||||
private String suspendState;
|
||||
|
||||
private String suspendStateName;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getCategory() {
|
||||
return category;
|
||||
}
|
||||
|
||||
public void setCategory(String category) {
|
||||
this.category = category;
|
||||
}
|
||||
|
||||
public int getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(int version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDeploymentId() {
|
||||
return deploymentId;
|
||||
}
|
||||
|
||||
public void setDeploymentId(String deploymentId) {
|
||||
this.deploymentId = deploymentId;
|
||||
}
|
||||
|
||||
public Date getDeploymentTime() {
|
||||
return deploymentTime;
|
||||
}
|
||||
|
||||
public void setDeploymentTime(Date deploymentTime) {
|
||||
this.deploymentTime = deploymentTime;
|
||||
}
|
||||
|
||||
public String getDiagramResourceName() {
|
||||
return diagramResourceName;
|
||||
}
|
||||
|
||||
public void setDiagramResourceName(String diagramResourceName) {
|
||||
this.diagramResourceName = diagramResourceName;
|
||||
}
|
||||
|
||||
public String getResourceName() {
|
||||
return resourceName;
|
||||
}
|
||||
|
||||
public void setResourceName(String resourceName) {
|
||||
this.resourceName = resourceName;
|
||||
}
|
||||
|
||||
public String getSuspendState() {
|
||||
return suspendState;
|
||||
}
|
||||
|
||||
public void setSuspendState(String suspendState) {
|
||||
this.suspendState = suspendState;
|
||||
}
|
||||
|
||||
public String getSuspendStateName() {
|
||||
return suspendStateName;
|
||||
}
|
||||
|
||||
public void setSuspendStateName(String suspendStateName) {
|
||||
this.suspendStateName = suspendStateName;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package com.jeethink.activiti.form;
|
||||
|
||||
import org.activiti.engine.form.AbstractFormType;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 用户表单字段类型
|
||||
*
|
||||
* @author henryyan
|
||||
*/
|
||||
@Component
|
||||
public class UsersFormType extends AbstractFormType {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "users";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object convertFormValueToModelValue(String propertyValue) {
|
||||
String[] split = StringUtils.split(propertyValue, ",");
|
||||
return Arrays.asList(split);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String convertModelValueToFormValue(Object modelValue) {
|
||||
return ObjectUtils.toString(modelValue);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package com.jeethink.activiti.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import com.jeethink.activiti.domain.BizTodoItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 待办事项Mapper接口
|
||||
*
|
||||
* @author Xianlu Tech
|
||||
* @date 2019-11-08
|
||||
*/
|
||||
public interface BizTodoItemMapper {
|
||||
/**
|
||||
* 查询待办事项
|
||||
*
|
||||
* @param id 待办事项ID
|
||||
* @return 待办事项
|
||||
*/
|
||||
public BizTodoItem selectBizTodoItemById(Long id);
|
||||
|
||||
/**
|
||||
* 查询待办事项列表
|
||||
*
|
||||
* @param bizTodoItem 待办事项
|
||||
* @return 待办事项集合
|
||||
*/
|
||||
public List<BizTodoItem> selectBizTodoItemList(BizTodoItem bizTodoItem);
|
||||
|
||||
/**
|
||||
* 新增待办事项
|
||||
*
|
||||
* @param bizTodoItem 待办事项
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBizTodoItem(BizTodoItem bizTodoItem);
|
||||
|
||||
/**
|
||||
* 修改待办事项
|
||||
*
|
||||
* @param bizTodoItem 待办事项
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBizTodoItem(BizTodoItem bizTodoItem);
|
||||
|
||||
/**
|
||||
* 删除待办事项
|
||||
*
|
||||
* @param id 待办事项ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBizTodoItemById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除待办事项
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBizTodoItemByIds(String[] ids);
|
||||
|
||||
@Select("SELECT * FROM BIZ_TODO_ITEM WHERE TASK_ID = #{taskId}")
|
||||
BizTodoItem selectTodoItemByTaskId(@Param(value = "taskId") String taskId);
|
||||
|
||||
@Select("SELECT USER_ID_ FROM ACT_ID_MEMBERSHIP WHERE GROUP_ID_ = (SELECT GROUP_ID_ FROM ACT_RU_IDENTITYLINK WHERE TASK_ID_ = #{taskId})")
|
||||
List<String> selectTodoUserListByTaskId(@Param(value = "taskId") String taskId);
|
||||
|
||||
@Select("SELECT * FROM BIZ_TODO_ITEM WHERE TASK_ID = #{taskId} AND TODO_USER_ID = #{todoUserId}")
|
||||
BizTodoItem selectTodoItemByCondition(@Param(value = "taskId") String taskId, @Param(value = "todoUserId") String todoUserId);
|
||||
|
||||
@Select("SELECT USER_ID_ FROM ACT_ID_MEMBERSHIP WHERE USER_ID_ = (SELECT USER_ID_ FROM ACT_RU_IDENTITYLINK WHERE TASK_ID_ = #{taskId})")
|
||||
String selectTodoUserByTaskId(String id);
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
/* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jeethink.activiti.modeler;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import org.activiti.editor.constants.ModelDataJsonConstants;
|
||||
import org.activiti.engine.ActivitiException;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.repository.Model;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @author Tijs Rademakers
|
||||
*/
|
||||
@RestController
|
||||
public class ModelEditorJsonRestResource implements ModelDataJsonConstants {
|
||||
|
||||
protected static final Logger LOGGER = LoggerFactory.getLogger(ModelEditorJsonRestResource.class);
|
||||
|
||||
@Autowired
|
||||
private RepositoryService repositoryService;
|
||||
|
||||
@Autowired
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
@RequestMapping(value="/modeler/model/{modelId}/json", method = RequestMethod.GET, produces = "application/json")
|
||||
public ObjectNode getEditorJson(@PathVariable String modelId) {
|
||||
ObjectNode modelNode = null;
|
||||
|
||||
Model model = repositoryService.getModel(modelId);
|
||||
|
||||
if (model != null) {
|
||||
try {
|
||||
if (StringUtils.isNotEmpty(model.getMetaInfo())) {
|
||||
modelNode = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
|
||||
} else {
|
||||
modelNode = objectMapper.createObjectNode();
|
||||
modelNode.put(MODEL_NAME, model.getName());
|
||||
}
|
||||
modelNode.put(MODEL_ID, model.getId());
|
||||
ObjectNode editorJsonNode = (ObjectNode) objectMapper.readTree(
|
||||
new String(repositoryService.getModelEditorSource(model.getId()), "utf-8"));
|
||||
modelNode.put("model", editorJsonNode);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error creating model JSON", e);
|
||||
throw new ActivitiException("Error creating model JSON", e);
|
||||
}
|
||||
}
|
||||
return modelNode;
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
/* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jeethink.activiti.modeler;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import org.activiti.editor.constants.ModelDataJsonConstants;
|
||||
import org.activiti.engine.ActivitiException;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.repository.Model;
|
||||
import org.apache.batik.transcoder.TranscoderInput;
|
||||
import org.apache.batik.transcoder.TranscoderOutput;
|
||||
import org.apache.batik.transcoder.image.PNGTranscoder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
|
||||
/**
|
||||
* @author Tijs Rademakers
|
||||
*/
|
||||
@RestController
|
||||
public class ModelSaveRestResource implements ModelDataJsonConstants {
|
||||
|
||||
protected static final Logger LOGGER = LoggerFactory.getLogger(ModelSaveRestResource.class);
|
||||
|
||||
@Autowired
|
||||
private RepositoryService repositoryService;
|
||||
|
||||
@Autowired
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
@RequestMapping(value="/modeler/model/{modelId}/save", method = RequestMethod.POST)
|
||||
@ResponseStatus(value = HttpStatus.OK)
|
||||
public void saveModel(@PathVariable String modelId, @RequestBody MultiValueMap<String, String> values) {
|
||||
try {
|
||||
|
||||
Model model = repositoryService.getModel(modelId);
|
||||
|
||||
ObjectNode modelJson = (ObjectNode) objectMapper.readTree(model.getMetaInfo());
|
||||
|
||||
modelJson.put(MODEL_NAME, values.getFirst("name"));
|
||||
modelJson.put(MODEL_DESCRIPTION, values.getFirst("description"));
|
||||
model.setMetaInfo(modelJson.toString());
|
||||
model.setName(values.getFirst("name"));
|
||||
|
||||
repositoryService.saveModel(model);
|
||||
|
||||
repositoryService.addModelEditorSource(model.getId(), values.getFirst("json_xml").getBytes("utf-8"));
|
||||
|
||||
InputStream svgStream = new ByteArrayInputStream(values.getFirst("svg_xml").getBytes("utf-8"));
|
||||
TranscoderInput input = new TranscoderInput(svgStream);
|
||||
|
||||
PNGTranscoder transcoder = new PNGTranscoder();
|
||||
// Setup output
|
||||
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
|
||||
TranscoderOutput output = new TranscoderOutput(outStream);
|
||||
|
||||
// Do the transformation
|
||||
transcoder.transcode(input, output);
|
||||
final byte[] result = outStream.toByteArray();
|
||||
repositoryService.addModelEditorSourceExtra(model.getId(), result);
|
||||
outStream.close();
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("Error saving model", e);
|
||||
throw new ActivitiException("Error saving model", e);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,217 @@
|
||||
package com.jeethink.activiti.modeler;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.jeethink.activiti.domain.ModelerVo;
|
||||
import com.jeethink.common.annotation.Log;
|
||||
import com.jeethink.common.config.JeeThinkConfig;
|
||||
import com.jeethink.common.constant.HttpStatus;
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.core.page.PageDomain;
|
||||
import com.jeethink.common.core.page.TableDataInfo;
|
||||
import com.jeethink.common.core.page.TableSupport;
|
||||
import com.jeethink.common.enums.BusinessType;
|
||||
|
||||
import org.activiti.bpmn.converter.BpmnXMLConverter;
|
||||
import org.activiti.bpmn.model.BpmnModel;
|
||||
import org.activiti.editor.constants.ModelDataJsonConstants;
|
||||
import org.activiti.editor.language.json.converter.BpmnJsonConverter;
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.impl.persistence.entity.ModelEntityImpl;
|
||||
import org.activiti.engine.repository.Deployment;
|
||||
import org.activiti.engine.repository.Model;
|
||||
import org.activiti.engine.repository.ModelQuery;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.util.List;
|
||||
|
||||
import static org.activiti.editor.constants.ModelDataJsonConstants.MODEL_DESCRIPTION;
|
||||
import static org.activiti.editor.constants.ModelDataJsonConstants.MODEL_NAME;
|
||||
|
||||
@Controller
|
||||
public class ModelerController extends BaseController {
|
||||
protected static final Logger LOGGER = LoggerFactory.getLogger(ModelEditorJsonRestResource.class);
|
||||
|
||||
@Autowired
|
||||
private RepositoryService repositoryService;
|
||||
@Autowired
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
|
||||
@GetMapping("/modeler/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(ModelEntityImpl modelEntity) {
|
||||
ModelQuery modelQuery = repositoryService.createModelQuery();
|
||||
modelQuery.orderByLastUpdateTime().desc();
|
||||
|
||||
// 条件过滤
|
||||
if (com.jeethink.common.utils.StringUtils.isNotBlank(modelEntity.getKey())) {
|
||||
modelQuery.modelKey(modelEntity.getKey());
|
||||
}
|
||||
if (com.jeethink.common.utils.StringUtils.isNotBlank(modelEntity.getName())) {
|
||||
modelQuery.modelNameLike("%" + modelEntity.getName() + "%");
|
||||
}
|
||||
|
||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
Integer pageNum = pageDomain.getPageNum();
|
||||
Integer pageSize = pageDomain.getPageSize();
|
||||
|
||||
List<Model> resultList = modelQuery.listPage((pageNum - 1) * pageSize, pageSize);
|
||||
|
||||
Page<Model> list = new Page<>();
|
||||
list.addAll(resultList);
|
||||
|
||||
list.setTotal(modelQuery.count());
|
||||
list.setPageNum(pageNum);
|
||||
list.setPageSize(pageSize);
|
||||
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 创建模型
|
||||
*/
|
||||
@RequestMapping(value = "/modeler/create")
|
||||
@ResponseBody
|
||||
public AjaxResult create( @RequestBody ModelerVo modelerVo) {
|
||||
try {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
ObjectNode editorNode = objectMapper.createObjectNode();
|
||||
editorNode.put("id", "canvas");
|
||||
editorNode.put("resourceId", "canvas");
|
||||
ObjectNode stencilSetNode = objectMapper.createObjectNode();
|
||||
stencilSetNode.put("namespace", "http://b3mn.org/stencilset/bpmn2.0#");
|
||||
editorNode.put("stencilset", stencilSetNode);
|
||||
|
||||
ObjectNode modelObjectNode = objectMapper.createObjectNode();
|
||||
modelObjectNode.put(MODEL_NAME, modelerVo.getName());
|
||||
modelObjectNode.put(ModelDataJsonConstants.MODEL_REVISION, 1);
|
||||
String description = StringUtils.defaultString(modelerVo.getDescription());
|
||||
modelObjectNode.put(MODEL_DESCRIPTION, description);
|
||||
|
||||
Model newModel = repositoryService.newModel();
|
||||
newModel.setMetaInfo(modelObjectNode.toString());
|
||||
newModel.setName(modelerVo.getName());
|
||||
newModel.setKey(StringUtils.defaultString(modelerVo.getKey()));
|
||||
|
||||
repositoryService.saveModel(newModel);
|
||||
repositoryService.addModelEditorSource(newModel.getId(), editorNode.toString().getBytes("utf-8"));
|
||||
|
||||
return new AjaxResult(HttpStatus.SUCCESS, "创建模型成功", newModel.getId());
|
||||
} catch (Exception e) {
|
||||
logger.error("创建模型失败:", e);
|
||||
}
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据Model部署流程
|
||||
*/
|
||||
@RequestMapping(value = "/modeler/deploy/{modelId}")
|
||||
@ResponseBody
|
||||
public AjaxResult deploy(@PathVariable("modelId") String modelId, RedirectAttributes redirectAttributes) {
|
||||
try {
|
||||
Model modelData = repositoryService.getModel(modelId);
|
||||
ObjectNode modelNode = (ObjectNode) new ObjectMapper().readTree(repositoryService.getModelEditorSource(modelData.getId()));
|
||||
byte[] bpmnBytes = null;
|
||||
|
||||
BpmnModel model = new BpmnJsonConverter().convertToBpmnModel(modelNode);
|
||||
bpmnBytes = new BpmnXMLConverter().convertToXML(model);
|
||||
|
||||
String processName = modelData.getName() + ".bpmn20.xml";
|
||||
Deployment deployment = repositoryService.createDeployment().name(modelData.getName()).addString(processName, new String(bpmnBytes, "UTF-8")).deploy();
|
||||
LOGGER.info("部署成功,部署ID=" + deployment.getId());
|
||||
return AjaxResult.success("部署成功");
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("根据模型部署流程失败:modelId={}", modelId, e);
|
||||
|
||||
}
|
||||
return AjaxResult.error("部署失败");
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出model的xml文件
|
||||
*/
|
||||
@RequestMapping(value = "/modeler/export/{modelId}")
|
||||
@ResponseBody
|
||||
public AjaxResult export(@PathVariable("modelId") String modelId) {
|
||||
OutputStream out = null;
|
||||
try {
|
||||
Model modelData = repositoryService.getModel(modelId);
|
||||
BpmnJsonConverter jsonConverter = new BpmnJsonConverter();
|
||||
JsonNode editorNode = new ObjectMapper().readTree(repositoryService.getModelEditorSource(modelData.getId()));
|
||||
BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(editorNode);
|
||||
|
||||
// 流程非空判断
|
||||
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";
|
||||
|
||||
File file = new File(getAbsoluteFile(filename));
|
||||
if(file.exists()){
|
||||
file.delete();
|
||||
}
|
||||
FileOutputStream fos = new FileOutputStream(file);
|
||||
fos.write(bpmnBytes,0,bpmnBytes.length);
|
||||
fos.flush();
|
||||
fos.close();
|
||||
return AjaxResult.success(filename);
|
||||
} else {
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
LOGGER.error("导出model的xml文件失败:modelId={}", modelId, e);
|
||||
return AjaxResult.error("导出model的xml文件失败:modelId={}", modelId);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取下载路径
|
||||
*
|
||||
* @param filename 文件名称
|
||||
*/
|
||||
public String getAbsoluteFile(String filename)
|
||||
{
|
||||
String downloadPath = JeeThinkConfig.getDownloadPath() + filename;
|
||||
File desc = new File(downloadPath);
|
||||
if (!desc.getParentFile().exists())
|
||||
{
|
||||
desc.getParentFile().mkdirs();
|
||||
}
|
||||
return downloadPath;
|
||||
}
|
||||
|
||||
|
||||
@Log(title = "流程模型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/modeler/remove/{ids}")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(@PathVariable String ids) {
|
||||
try {
|
||||
repositoryService.deleteModel(ids);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
catch (Exception e) {
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jeethink.activiti.modeler;
|
||||
|
||||
import java.io.InputStream;
|
||||
|
||||
import org.activiti.engine.ActivitiException;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
/**
|
||||
* @author Tijs Rademakers
|
||||
*/
|
||||
@RestController
|
||||
public class StencilsetRestResource {
|
||||
|
||||
@RequestMapping(value="/modeler/editor/stencilset", method = RequestMethod.GET, produces = "application/json;charset=utf-8")
|
||||
public @ResponseBody String getStencilset() {
|
||||
InputStream stencilsetStream = this.getClass().getClassLoader().getResourceAsStream("stencilset.json");
|
||||
try {
|
||||
return IOUtils.toString(stencilsetStream, "utf-8");
|
||||
} catch (Exception e) {
|
||||
throw new ActivitiException("Error while loading stencil set", e);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
package com.jeethink.activiti.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jeethink.activiti.domain.BizTodoItem;
|
||||
|
||||
/**
|
||||
* 待办事项Service接口
|
||||
*
|
||||
* @author Xianlu Tech
|
||||
* @date 2019-11-08
|
||||
*/
|
||||
public interface IBizTodoItemService {
|
||||
/**
|
||||
* 查询待办事项
|
||||
*
|
||||
* @param id 待办事项ID
|
||||
* @return 待办事项
|
||||
*/
|
||||
public BizTodoItem selectBizTodoItemById(Long id);
|
||||
|
||||
/**
|
||||
* 查询待办事项列表
|
||||
*
|
||||
* @param bizTodoItem 待办事项
|
||||
* @return 待办事项集合
|
||||
*/
|
||||
public List<BizTodoItem> selectBizTodoItemList(BizTodoItem bizTodoItem);
|
||||
|
||||
/**
|
||||
* 新增待办事项
|
||||
*
|
||||
* @param bizTodoItem 待办事项
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBizTodoItem(BizTodoItem bizTodoItem);
|
||||
|
||||
/**
|
||||
* 修改待办事项
|
||||
*
|
||||
* @param bizTodoItem 待办事项
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBizTodoItem(BizTodoItem bizTodoItem);
|
||||
|
||||
/**
|
||||
* 批量删除待办事项
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBizTodoItemByIds(String ids);
|
||||
|
||||
/**
|
||||
* 删除待办事项信息
|
||||
*
|
||||
* @param id 待办事项ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBizTodoItemById(Long id);
|
||||
|
||||
int insertTodoItem(String instanceId, String itemName, String itemContent, String module);
|
||||
|
||||
BizTodoItem selectBizTodoItemByCondition(String taskId, String todoUserId);
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
package com.jeethink.activiti.service;
|
||||
|
||||
import org.activiti.engine.history.HistoricTaskInstance;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.activiti.engine.task.Task;
|
||||
|
||||
import com.jeethink.activiti.domain.ActivitiBaseEntity;
|
||||
import com.jeethink.activiti.domain.HistoricActivity;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface IProcessService {
|
||||
|
||||
/**
|
||||
* 查询审批历史列表
|
||||
* @param processInstanceId
|
||||
* @param historicActivity
|
||||
* @return
|
||||
*/
|
||||
List<HistoricActivity> selectHistoryList(String processInstanceId, HistoricActivity historicActivity);
|
||||
|
||||
/**
|
||||
* 提交申请
|
||||
* @param applyUserId 申请人
|
||||
* @param businessKey 业务表 id
|
||||
* @param key 流程定义 key
|
||||
* @param variables 流程变量
|
||||
* @return
|
||||
*/
|
||||
ProcessInstance submitApply(String applyUserId, String businessKey, String itemName, String itemConent, String key, Map<String, Object> variables);
|
||||
|
||||
List<Task> findTodoTasks(String userId, String key);
|
||||
|
||||
List<HistoricTaskInstance> findDoneTasks(String userId, String key);
|
||||
|
||||
void complete(ActivitiBaseEntity activitiBaseEntity, String module);
|
||||
|
||||
/**
|
||||
* 委托任务
|
||||
* @param taskId
|
||||
* @param delegateToUser
|
||||
*/
|
||||
void delegate(String taskId, String fromUser, String delegateToUser);
|
||||
|
||||
void cancelApply(String instanceId, String deleteReason);
|
||||
|
||||
void suspendOrActiveApply(String instanceId, String suspendState);
|
||||
|
||||
String findBusinessKeyByInstanceId(String instanceId);
|
||||
}
|
@ -0,0 +1,137 @@
|
||||
package com.jeethink.activiti.service;
|
||||
|
||||
import com.github.pagehelper.Page;
|
||||
import com.jeethink.common.core.page.PageDomain;
|
||||
import com.jeethink.common.core.page.TableSupport;
|
||||
import com.jeethink.common.core.text.Convert;
|
||||
import com.jeethink.common.utils.StringUtils;
|
||||
|
||||
import org.activiti.engine.RepositoryService;
|
||||
import org.activiti.engine.RuntimeService;
|
||||
import org.activiti.engine.impl.persistence.entity.ProcessDefinitionEntityImpl;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipInputStream;
|
||||
|
||||
@Transactional
|
||||
@Service
|
||||
public class ProcessDefinitionService {
|
||||
|
||||
@Autowired
|
||||
private RuntimeService runtimeService;
|
||||
|
||||
@Autowired
|
||||
private RepositoryService repositoryService;
|
||||
|
||||
/**
|
||||
* 分页查询流程定义文件
|
||||
* @return
|
||||
*/
|
||||
public Page<com.jeethink.activiti.domain.ProcessDefinition> listProcessDefinition(com.jeethink.activiti.domain.ProcessDefinition processDefinition) {
|
||||
PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
Integer pageNum = pageDomain.getPageNum();
|
||||
Integer pageSize = pageDomain.getPageSize();
|
||||
|
||||
Page<com.jeethink.activiti.domain.ProcessDefinition> list = new Page<>();
|
||||
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery();
|
||||
processDefinitionQuery.orderByProcessDefinitionId().orderByProcessDefinitionVersion().desc();
|
||||
if (StringUtils.isNotBlank(processDefinition.getName())) {
|
||||
processDefinitionQuery.processDefinitionNameLike("%" + processDefinition.getName() + "%");
|
||||
}
|
||||
if (StringUtils.isNotBlank(processDefinition.getKey())) {
|
||||
processDefinitionQuery.processDefinitionKeyLike("%" + processDefinition.getKey() + "%");
|
||||
}
|
||||
if (StringUtils.isNotBlank(processDefinition.getCategory())) {
|
||||
processDefinitionQuery.processDefinitionCategoryLike("%" + processDefinition.getCategory() + "%");
|
||||
}
|
||||
|
||||
List<ProcessDefinition> processDefinitionList;
|
||||
if (pageNum != null && pageSize != null) {
|
||||
processDefinitionList = processDefinitionQuery.listPage((pageNum - 1) * pageSize, pageSize);
|
||||
list.setTotal(processDefinitionQuery.count());
|
||||
list.setPageNum(pageNum);
|
||||
list.setPageSize(pageSize);
|
||||
} else {
|
||||
processDefinitionList = processDefinitionQuery.list();
|
||||
}
|
||||
for (ProcessDefinition definition: processDefinitionList) {
|
||||
ProcessDefinitionEntityImpl entityImpl = (ProcessDefinitionEntityImpl) definition;
|
||||
com.jeethink.activiti.domain.ProcessDefinition entity = new com.jeethink.activiti.domain.ProcessDefinition();
|
||||
entity.setId(definition.getId());
|
||||
entity.setKey(definition.getKey());
|
||||
entity.setName(definition.getName());
|
||||
entity.setCategory(definition.getCategory());
|
||||
entity.setVersion(definition.getVersion());
|
||||
entity.setDescription(definition.getDescription());
|
||||
entity.setDeploymentId(definition.getDeploymentId());
|
||||
Deployment deployment = repositoryService.createDeploymentQuery()
|
||||
.deploymentId(definition.getDeploymentId())
|
||||
.singleResult();
|
||||
entity.setDeploymentTime(deployment.getDeploymentTime());
|
||||
entity.setDiagramResourceName(definition.getDiagramResourceName());
|
||||
entity.setResourceName(definition.getResourceName());
|
||||
entity.setSuspendState(entityImpl.getSuspensionState() + "");
|
||||
if (entityImpl.getSuspensionState() == 1) {
|
||||
entity.setSuspendStateName("已激活");
|
||||
} else {
|
||||
entity.setSuspendStateName("已挂起");
|
||||
}
|
||||
list.add(entity);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public void deployProcessDefinition(String filePath) throws FileNotFoundException {
|
||||
if (StringUtils.isNotBlank(filePath)) {
|
||||
if (filePath.endsWith(".zip")) {
|
||||
ZipInputStream inputStream = new ZipInputStream(new FileInputStream(filePath));
|
||||
repositoryService.createDeployment()
|
||||
.addZipInputStream(inputStream)
|
||||
.deploy();
|
||||
} else if (filePath.endsWith(".bpmn")) {
|
||||
repositoryService.createDeployment()
|
||||
.addInputStream(filePath, new FileInputStream(filePath))
|
||||
.deploy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int deleteProcessDeploymentByIds(String deploymentIds) throws Exception {
|
||||
String[] deploymentIdsArr = Convert.toStrArray(deploymentIds);
|
||||
int counter = 0;
|
||||
for (String deploymentId: deploymentIdsArr) {
|
||||
List<ProcessInstance> instanceList = runtimeService.createProcessInstanceQuery()
|
||||
.deploymentId(deploymentId)
|
||||
.list();
|
||||
if (!CollectionUtils.isEmpty(instanceList)) {
|
||||
// 存在流程实例的流程定义
|
||||
throw new Exception("删除失败,存在运行中的流程实例");
|
||||
}
|
||||
repositoryService.deleteDeployment(deploymentId, true); // true 表示级联删除引用,比如 act_ru_execution 数据
|
||||
counter++;
|
||||
}
|
||||
return counter;
|
||||
}
|
||||
|
||||
public void suspendOrActiveApply(String id, String suspendState) {
|
||||
if ("1".equals(suspendState)) {
|
||||
// 当流程定义被挂起时,已经发起的该流程定义的流程实例不受影响(如果选择级联挂起则流程实例也会被挂起)。
|
||||
// 当流程定义被挂起时,无法发起新的该流程定义的流程实例。
|
||||
// 直观变化:act_re_procdef 的 SUSPENSION_STATE_ 为 2
|
||||
repositoryService.suspendProcessDefinitionById(id);
|
||||
} else if ("2".equals(suspendState)) {
|
||||
repositoryService.activateProcessDefinitionById(id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,163 @@
|
||||
package com.jeethink.activiti.service.impl;
|
||||
|
||||
import com.jeethink.activiti.domain.BizTodoItem;
|
||||
import com.jeethink.activiti.mapper.BizTodoItemMapper;
|
||||
import com.jeethink.activiti.service.IBizTodoItemService;
|
||||
import com.jeethink.common.core.domain.entity.SysUser;
|
||||
import com.jeethink.common.core.text.Convert;
|
||||
import com.jeethink.common.utils.DateUtils;
|
||||
import com.jeethink.common.utils.StringUtils;
|
||||
import com.jeethink.system.mapper.SysUserMapper;
|
||||
|
||||
import org.activiti.engine.TaskService;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 待办事项Service业务层处理
|
||||
*
|
||||
* @author Xianlu Tech
|
||||
* @date 2019-11-08
|
||||
*/
|
||||
@Service
|
||||
@Transactional
|
||||
public class BizTodoItemServiceImpl implements IBizTodoItemService {
|
||||
@Autowired
|
||||
private BizTodoItemMapper bizTodoItemMapper;
|
||||
@Autowired
|
||||
private SysUserMapper userMapper;
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
|
||||
/**
|
||||
* 查询待办事项
|
||||
*
|
||||
* @param id 待办事项ID
|
||||
* @return 待办事项
|
||||
*/
|
||||
@Override
|
||||
public BizTodoItem selectBizTodoItemById(Long id) {
|
||||
return bizTodoItemMapper.selectBizTodoItemById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询待办事项列表
|
||||
*
|
||||
* @param bizTodoItem 待办事项
|
||||
* @return 待办事项
|
||||
*/
|
||||
@Override
|
||||
public List<BizTodoItem> selectBizTodoItemList(BizTodoItem bizTodoItem) {
|
||||
return bizTodoItemMapper.selectBizTodoItemList(bizTodoItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增待办事项
|
||||
*
|
||||
* @param bizTodoItem 待办事项
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertBizTodoItem(BizTodoItem bizTodoItem) {
|
||||
return bizTodoItemMapper.insertBizTodoItem(bizTodoItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改待办事项
|
||||
*
|
||||
* @param bizTodoItem 待办事项
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateBizTodoItem(BizTodoItem bizTodoItem) {
|
||||
return bizTodoItemMapper.updateBizTodoItem(bizTodoItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除待办事项对象
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBizTodoItemByIds(String ids) {
|
||||
return bizTodoItemMapper.deleteBizTodoItemByIds(Convert.toStrArray(ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除待办事项信息
|
||||
*
|
||||
* @param id 待办事项ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBizTodoItemById(Long id) {
|
||||
return bizTodoItemMapper.deleteBizTodoItemById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertTodoItem(String instanceId, String itemName, String itemContent, String module) {
|
||||
BizTodoItem todoItem = new BizTodoItem();
|
||||
todoItem.setItemName(itemName);
|
||||
todoItem.setItemContent(itemContent);
|
||||
todoItem.setIsView("0");
|
||||
todoItem.setIsHandle("0");
|
||||
todoItem.setModule(module);
|
||||
todoItem.setTodoTime(DateUtils.getNowDate());
|
||||
List<Task> taskList = taskService.createTaskQuery().processInstanceId(instanceId).active().list();
|
||||
int counter = 0;
|
||||
for (Task task: taskList) {
|
||||
|
||||
// todoitem 去重
|
||||
BizTodoItem bizTodoItem = bizTodoItemMapper.selectTodoItemByTaskId(task.getId());
|
||||
if (bizTodoItem != null) continue;
|
||||
|
||||
BizTodoItem newItem = new BizTodoItem();
|
||||
BeanUtils.copyProperties(todoItem, newItem);
|
||||
newItem.setInstanceId(instanceId);
|
||||
newItem.setTaskId(task.getId());
|
||||
newItem.setTaskName("task" + task.getTaskDefinitionKey().substring(0, 1).toUpperCase() + task.getTaskDefinitionKey().substring(1));
|
||||
newItem.setNodeName(task.getName());
|
||||
String assignee = task.getAssignee();
|
||||
if (StringUtils.isNotBlank(assignee)) {
|
||||
newItem.setTodoUserId(assignee);
|
||||
SysUser user = userMapper.selectUserByUserName(assignee);
|
||||
newItem.setTodoUserName(user.getNickName());
|
||||
bizTodoItemMapper.insertBizTodoItem(newItem);
|
||||
counter++;
|
||||
} else {
|
||||
// 查询候选用户组
|
||||
List<String> todoUserIdList = bizTodoItemMapper.selectTodoUserListByTaskId(task.getId());
|
||||
if (!CollectionUtils.isEmpty(todoUserIdList)) {
|
||||
for (String todoUserId: todoUserIdList) {
|
||||
SysUser todoUser = userMapper.selectUserByUserName(todoUserId);
|
||||
newItem.setTodoUserId(todoUser.getUserName());
|
||||
newItem.setTodoUserName(todoUser.getNickName());
|
||||
bizTodoItemMapper.insertBizTodoItem(newItem);
|
||||
counter++;
|
||||
}
|
||||
} else {
|
||||
// 查询候选用户
|
||||
String todoUserId = bizTodoItemMapper.selectTodoUserByTaskId(task.getId());
|
||||
SysUser todoUser = userMapper.selectUserByUserName(todoUserId);
|
||||
newItem.setTodoUserId(todoUser.getUserName());
|
||||
newItem.setTodoUserName(todoUser.getNickName());
|
||||
bizTodoItemMapper.insertBizTodoItem(newItem);
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return counter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BizTodoItem selectBizTodoItemByCondition(String taskId, String todoUserId) {
|
||||
return bizTodoItemMapper.selectTodoItemByCondition(taskId, todoUserId);
|
||||
}
|
||||
}
|
@ -0,0 +1,252 @@
|
||||
package com.jeethink.activiti.service.impl;
|
||||
|
||||
import com.jeethink.activiti.domain.ActivitiBaseEntity;
|
||||
import com.jeethink.activiti.domain.BizTodoItem;
|
||||
import com.jeethink.activiti.domain.HistoricActivity;
|
||||
import com.jeethink.activiti.service.IBizTodoItemService;
|
||||
import com.jeethink.activiti.service.IProcessService;
|
||||
import com.jeethink.common.core.domain.entity.SysUser;
|
||||
import com.jeethink.common.utils.DateUtils;
|
||||
import com.jeethink.common.utils.SecurityUtils;
|
||||
import com.jeethink.common.utils.StringUtils;
|
||||
import com.jeethink.system.mapper.SysUserMapper;
|
||||
|
||||
import org.activiti.engine.HistoryService;
|
||||
import org.activiti.engine.IdentityService;
|
||||
import org.activiti.engine.RuntimeService;
|
||||
import org.activiti.engine.TaskService;
|
||||
import org.activiti.engine.history.HistoricActivityInstance;
|
||||
import org.activiti.engine.history.HistoricActivityInstanceQuery;
|
||||
import org.activiti.engine.history.HistoricProcessInstance;
|
||||
import org.activiti.engine.history.HistoricTaskInstance;
|
||||
import org.activiti.engine.runtime.ProcessInstance;
|
||||
import org.activiti.engine.task.Comment;
|
||||
import org.activiti.engine.task.Task;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class ProcessServiceImpl implements IProcessService {
|
||||
protected final Logger logger = LoggerFactory.getLogger(ProcessServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private RuntimeService runtimeService;
|
||||
@Autowired
|
||||
private IdentityService identityService;
|
||||
@Autowired
|
||||
private TaskService taskService;
|
||||
@Autowired
|
||||
private HistoryService historyService;
|
||||
@Autowired
|
||||
private SysUserMapper userMapper;
|
||||
@Autowired
|
||||
private IBizTodoItemService bizTodoItemService;
|
||||
|
||||
@Override
|
||||
public ProcessInstance submitApply(String applyUserId, String businessKey, String itemName, String itemConent, String module, Map<String, Object> variables) {
|
||||
// 用来设置启动流程的人员ID,引擎会自动把用户ID保存到activiti:initiator中
|
||||
identityService.setAuthenticatedUserId(applyUserId);
|
||||
// 启动流程时设置业务 key
|
||||
ProcessInstance instance = runtimeService.startProcessInstanceByKey(module, businessKey, variables);
|
||||
// 下一节点处理人待办事项
|
||||
bizTodoItemService.insertTodoItem(instance.getProcessInstanceId(), itemName, itemConent, module);
|
||||
return instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Task> findTodoTasks(String userId, String key) {
|
||||
List<Task> tasks = new ArrayList<Task>();
|
||||
// 根据当前人的ID查询
|
||||
List<Task> todoList = taskService
|
||||
.createTaskQuery()
|
||||
.processDefinitionKey(key)
|
||||
.taskAssignee(userId)
|
||||
.list();
|
||||
// 根据当前人未签收的任务
|
||||
List<Task> unsignedTasks = taskService
|
||||
.createTaskQuery()
|
||||
.processDefinitionKey(key)
|
||||
.taskCandidateUser(userId)
|
||||
.list();
|
||||
// 合并
|
||||
tasks.addAll(todoList);
|
||||
tasks.addAll(unsignedTasks);
|
||||
return tasks;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HistoricTaskInstance> findDoneTasks(String userId, String key) {
|
||||
List<HistoricTaskInstance> list = historyService
|
||||
.createHistoricTaskInstanceQuery()
|
||||
.processDefinitionKey(key)
|
||||
.taskAssignee(userId)
|
||||
.finished()
|
||||
.orderByHistoricTaskInstanceEndTime()
|
||||
.desc()
|
||||
.list();
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void complete(ActivitiBaseEntity activitiBaseEntity,String module) {
|
||||
Map<String, Object> variables =new HashMap<String, Object>();
|
||||
String comment = null; // 批注
|
||||
boolean agree = true;
|
||||
try {
|
||||
for(Map.Entry<String, Object> entry : activitiBaseEntity.getProcessParams().entrySet()){
|
||||
String parameterName = entry.getKey();
|
||||
// 参数结构:B_name,B为类型,name为属性名称
|
||||
String[] parameter = parameterName.split("_");
|
||||
if (parameter.length == 2) {
|
||||
String paramValue = (String) entry.getValue();
|
||||
Object value = paramValue;
|
||||
if (parameter[0].equals("B")) {
|
||||
value = BooleanUtils.toBoolean(paramValue);
|
||||
agree = (boolean) value;
|
||||
} else if (parameter[0].equals("DT")) {
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
value = sdf.parse(paramValue);
|
||||
} else if (parameter[0].equals("COM")) {
|
||||
comment = paramValue;
|
||||
}
|
||||
variables.put(parameter[1], value);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if (StringUtils.isNotEmpty(comment)) {
|
||||
identityService.setAuthenticatedUserId(SecurityUtils.getUsername());
|
||||
comment = agree ? "【同意】" + comment : "【拒绝】" + comment;
|
||||
taskService.addComment(activitiBaseEntity.getTaskId(), activitiBaseEntity.getInstanceId(), comment);
|
||||
}
|
||||
// 被委派人处理完成任务
|
||||
// p.s. 被委托的流程需要先 resolved 这个任务再提交。
|
||||
// 所以在 complete 之前需要先 resolved
|
||||
// resolveTask() 要在 claim() 之前,不然 act_hi_taskinst 表的 assignee 字段会为 null
|
||||
taskService.resolveTask(activitiBaseEntity.getTaskId(), variables);
|
||||
// 只有签收任务,act_hi_taskinst 表的 assignee 字段才不为 null
|
||||
taskService.claim(activitiBaseEntity.getTaskId(), SecurityUtils.getUsername());
|
||||
taskService.complete(activitiBaseEntity.getTaskId(), variables);
|
||||
|
||||
// 更新待办事项状态
|
||||
BizTodoItem query = new BizTodoItem();
|
||||
query.setTaskId(activitiBaseEntity.getTaskId());
|
||||
// 考虑到候选用户组,会有多个 todoitem 办理同个 task
|
||||
List<BizTodoItem> updateList = CollectionUtils.isEmpty(bizTodoItemService.selectBizTodoItemList(query)) ? null : bizTodoItemService.selectBizTodoItemList(query);
|
||||
for (BizTodoItem update: updateList) {
|
||||
// 找到当前登录用户的 todoitem,置为已办
|
||||
if (update.getTodoUserId().equals(SecurityUtils.getUsername())) {
|
||||
update.setIsView("1");
|
||||
update.setIsHandle("1");
|
||||
update.setHandleUserId(SecurityUtils.getUsername());
|
||||
update.setHandleUserName(SecurityUtils.getNickName());
|
||||
update.setHandleTime(DateUtils.getNowDate());
|
||||
bizTodoItemService.updateBizTodoItem(update);
|
||||
} else {
|
||||
bizTodoItemService.deleteBizTodoItemById(update.getId()); // 删除候选用户组其他 todoitem
|
||||
}
|
||||
}
|
||||
|
||||
// 下一节点处理人待办事项
|
||||
bizTodoItemService.insertTodoItem(activitiBaseEntity.getInstanceId(),activitiBaseEntity.getTitle(),activitiBaseEntity.getReason(), module);
|
||||
} catch (Exception e) {
|
||||
logger.error("error on complete task {}, variables={}", new Object[]{activitiBaseEntity.getTaskId(), variables, e});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HistoricActivity> selectHistoryList(String processInstanceId, HistoricActivity historicActivity) {
|
||||
// PageDomain pageDomain = TableSupport.buildPageRequest();
|
||||
// Integer pageNum = pageDomain.getPageNum();
|
||||
// Integer pageSize = pageDomain.getPageSize();
|
||||
List<HistoricActivity> activityList = new ArrayList<>();
|
||||
HistoricActivityInstanceQuery query = historyService.createHistoricActivityInstanceQuery();
|
||||
if (StringUtils.isNotBlank(historicActivity.getAssignee())) {
|
||||
query.taskAssignee(historicActivity.getAssignee());
|
||||
}
|
||||
if (StringUtils.isNotBlank(historicActivity.getActivityName())) {
|
||||
query.activityName(historicActivity.getActivityName());
|
||||
}
|
||||
List<HistoricActivityInstance> list = query.processInstanceId(processInstanceId)
|
||||
.activityType("userTask")
|
||||
.finished()
|
||||
.orderByHistoricActivityInstanceStartTime()
|
||||
.desc()
|
||||
.list();
|
||||
// .listPage((pageNum - 1) * pageSize, pageNum * pageSize);
|
||||
list.forEach(instance -> {
|
||||
HistoricActivity activity = new HistoricActivity();
|
||||
BeanUtils.copyProperties(instance, activity);
|
||||
String taskId = instance.getTaskId();
|
||||
List<Comment> comment = taskService.getTaskComments(taskId, "comment");
|
||||
if (!CollectionUtils.isEmpty(comment)) {
|
||||
activity.setComment(comment.get(0).getFullMessage());
|
||||
}
|
||||
SysUser sysUser = userMapper.selectUserByUserName(instance.getAssignee());
|
||||
if (sysUser != null) {
|
||||
activity.setAssigneeName(sysUser.getUserName());
|
||||
}
|
||||
activityList.add(activity);
|
||||
});
|
||||
return activityList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delegate(String taskId, String fromUser, String delegateToUser) {
|
||||
taskService.delegateTask(taskId, delegateToUser);
|
||||
// 更新待办事项
|
||||
// BizTodoItem updateItem = bizTodoItemService.selectBizTodoItemByCondition(taskId, fromUser);
|
||||
// if (updateItem != null) {
|
||||
// SysUser todoUser = userMapper.selectUserByLoginName(delegateToUser);
|
||||
// updateItem.setTodoUserId(delegateToUser);
|
||||
// updateItem.setTodoUserName(todoUser.getUserName());
|
||||
// bizTodoItemService.updateBizTodoItem(updateItem);
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelApply(String instanceId, String deleteReason) {
|
||||
// 执行此方法后未审批的任务 act_ru_task 会被删除,流程历史 act_hi_taskinst 不会被删除,并且流程历史的状态为finished完成
|
||||
runtimeService.deleteProcessInstance(instanceId, deleteReason);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void suspendOrActiveApply(String instanceId, String suspendState) {
|
||||
if ("1".equals(suspendState)) {
|
||||
// 当流程实例被挂起时,无法通过下一个节点对应的任务id来继续这个流程实例。
|
||||
// 通过挂起某一特定的流程实例,可以终止当前的流程实例,而不影响到该流程定义的其他流程实例。
|
||||
// 激活之后可以继续该流程实例,不会对后续任务造成影响。
|
||||
// 直观变化:act_ru_task 的 SUSPENSION_STATE_ 为 2
|
||||
runtimeService.suspendProcessInstanceById(instanceId);
|
||||
} else if ("2".equals(suspendState)) {
|
||||
runtimeService.activateProcessInstanceById(instanceId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String findBusinessKeyByInstanceId(String instanceId) {
|
||||
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(instanceId).singleResult();
|
||||
if (processInstance == null) {
|
||||
HistoricProcessInstance historicProcessInstance = historyService.createHistoricProcessInstanceQuery()
|
||||
.processInstanceId(instanceId)
|
||||
.singleResult();
|
||||
return historicProcessInstance.getBusinessKey();
|
||||
} else {
|
||||
return processInstance.getBusinessKey();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
<?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.jeethink.activiti.mapper.BizTodoItemMapper">
|
||||
|
||||
<resultMap type="BizTodoItem" id="BizTodoItemResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="itemName" column="item_name" />
|
||||
<result property="itemContent" column="item_content" />
|
||||
<result property="module" column="module" />
|
||||
<result property="instanceId" column="instance_id" />
|
||||
<result property="taskId" column="task_id" />
|
||||
<result property="taskName" column="task_name" />
|
||||
<result property="nodeName" column="node_name" />
|
||||
<result property="isView" column="is_view" />
|
||||
<result property="isHandle" column="is_handle" />
|
||||
<result property="todoUserId" column="todo_user_id" />
|
||||
<result property="todoUserName" column="todo_user_name" />
|
||||
<result property="handleUserId" column="handle_user_id" />
|
||||
<result property="handleUserName" column="handle_user_name" />
|
||||
<result property="todoTime" column="todo_time" />
|
||||
<result property="handleTime" column="handle_time" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBizTodoItemVo">
|
||||
select id, item_name, item_content, module, instance_id, task_id, task_name, node_name, is_view, is_handle, todo_user_id, todo_user_name, handle_user_id, handle_user_name, todo_time, handle_time from biz_todo_item
|
||||
</sql>
|
||||
|
||||
<select id="selectBizTodoItemList" parameterType="BizTodoItem" resultMap="BizTodoItemResult">
|
||||
<include refid="selectBizTodoItemVo"/>
|
||||
<where>
|
||||
<if test="itemName != null and itemName != ''"> and item_name like concat('%', #{itemName}, '%')</if>
|
||||
<if test="itemContent != null and itemContent != ''"> and item_content = #{itemContent}</if>
|
||||
<if test="module != null and module != ''"> and module = #{module}</if>
|
||||
<if test="instanceId != null and instanceId != ''"> and instance_id = #{instanceId}</if>
|
||||
<if test="taskId != null and taskId != ''"> and task_id = #{taskId}</if>
|
||||
<if test="taskName != null and taskName != ''"> and task_name like concat('%', #{taskName}, '%')</if>
|
||||
<if test="nodeName != null and nodeName != ''"> and node_name like concat('%', #{nodeName}, '%')</if>
|
||||
<if test="isView != null and isView != ''"> and is_view = #{isView}</if>
|
||||
<if test="isHandle != null and isHandle != ''"> and is_handle = #{isHandle}</if>
|
||||
<if test="todoUserId != null and todoUserId != ''"> and todo_user_id like concat('%', #{todoUserId}, '%')</if>
|
||||
<if test="todoUserName != null and todoUserName != ''"> and todo_user_name like concat('%', #{todoUserName}, '%')</if>
|
||||
<if test="handleUserId != null and handleUserId != ''"> and handle_user_id like concat('%', #{handleUserId}, '%')</if>
|
||||
<if test="handleUserName != null and handleUserName != ''"> and handle_user_name like concat('%', #{handleUserName}, '%')</if>
|
||||
<if test="todoTime != null "> and todo_time = #{todoTime}</if>
|
||||
<if test="handleTime != null "> and handle_time = #{handleTime}</if>
|
||||
<if test="params.todoItemStartTime != null and params.todoItemStartTime != ''"><!-- 开始时间检索 -->
|
||||
and date_format(todo_time,'%y%m%d') >= date_format(#{params.todoItemStartTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="params.todoItemEndTime != null and params.todoItemEndTime != ''"><!-- 结束时间检索 -->
|
||||
and date_format(todo_time,'%y%m%d') <= date_format(#{params.todoItemEndTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="params.handleStartTime != null and params.handleStartTime != ''"><!-- 开始时间检索 -->
|
||||
and date_format(handle_time,'%y%m%d') >= date_format(#{params.handleStartTime},'%y%m%d')
|
||||
</if>
|
||||
<if test="params.handleEndTime != null and params.handleEndTime != ''"><!-- 结束时间检索 -->
|
||||
and date_format(handle_time,'%y%m%d') <= date_format(#{params.handleEndTime},'%y%m%d')
|
||||
</if>
|
||||
order by todo_time desc
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectBizTodoItemById" parameterType="Long" resultMap="BizTodoItemResult">
|
||||
<include refid="selectBizTodoItemVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertBizTodoItem" parameterType="BizTodoItem" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into biz_todo_item
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="itemName != null and itemName != ''">item_name,</if>
|
||||
<if test="itemContent != null and itemContent != ''">item_content,</if>
|
||||
<if test="module != null and module != ''">module,</if>
|
||||
<if test="instanceId != null and instanceId != ''">instance_id,</if>
|
||||
<if test="taskId != null and taskId != ''">task_id,</if>
|
||||
<if test="taskName != null and taskName != ''">task_name,</if>
|
||||
<if test="nodeName != null and nodeName != ''">node_name,</if>
|
||||
<if test="isView != null and isView != ''">is_view,</if>
|
||||
<if test="isHandle != null and isHandle != ''">is_handle,</if>
|
||||
<if test="todoUserId != null ">todo_user_id,</if>
|
||||
<if test="todoUserName != null and todoUserName != ''">todo_user_name,</if>
|
||||
<if test="handleUserId != null ">handle_user_id,</if>
|
||||
<if test="handleUserName != null and handleUserName != ''">handle_user_name,</if>
|
||||
<if test="todoTime != null ">todo_time,</if>
|
||||
<if test="handleTime != null ">handle_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="itemName != null and itemName != ''">#{itemName},</if>
|
||||
<if test="itemContent != null and itemContent != ''">#{itemContent},</if>
|
||||
<if test="module != null and module != ''">#{module},</if>
|
||||
<if test="instanceId != null and instanceId != ''">#{instanceId},</if>
|
||||
<if test="taskId != null and taskId != ''">#{taskId},</if>
|
||||
<if test="taskName != null and taskName != ''">#{taskName},</if>
|
||||
<if test="nodeName != null and nodeName != ''">#{nodeName},</if>
|
||||
<if test="isView != null and isView != ''">#{isView},</if>
|
||||
<if test="isHandle != null and isHandle != ''">#{isHandle},</if>
|
||||
<if test="todoUserId != null ">#{todoUserId},</if>
|
||||
<if test="todoUserName != null and todoUserName != ''">#{todoUserName},</if>
|
||||
<if test="handleUserId != null ">#{handleUserId},</if>
|
||||
<if test="handleUserName != null and handleUserName != ''">#{handleUserName},</if>
|
||||
<if test="todoTime != null ">#{todoTime},</if>
|
||||
<if test="handleTime != null ">#{handleTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBizTodoItem" parameterType="BizTodoItem">
|
||||
update biz_todo_item
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="itemName != null and itemName != ''">item_name = #{itemName},</if>
|
||||
<if test="itemContent != null and itemContent != ''">item_content = #{itemContent},</if>
|
||||
<if test="module != null and module != ''">module = #{module},</if>
|
||||
<if test="instanceId != null and instanceId != ''">instance_id = #{instanceId},</if>
|
||||
<if test="taskId != null and taskId != ''">task_id = #{taskId},</if>
|
||||
<if test="taskName != null and taskName != ''">task_name = #{taskName},</if>
|
||||
<if test="nodeName != null and nodeName != ''">node_name = #{nodeName},</if>
|
||||
<if test="isView != null and isView != ''">is_view = #{isView},</if>
|
||||
<if test="isHandle != null and isHandle != ''">is_handle = #{isHandle},</if>
|
||||
<if test="todoUserId != null ">todo_user_id = #{todoUserId},</if>
|
||||
<if test="todoUserName != null and todoUserName != ''">todo_user_name = #{todoUserName},</if>
|
||||
<if test="handleUserId != null ">handle_user_id = #{handleUserId},</if>
|
||||
<if test="handleUserName != null and handleUserName != ''">handle_user_name = #{handleUserName},</if>
|
||||
<if test="todoTime != null ">todo_time = #{todoTime},</if>
|
||||
<if test="handleTime != null ">handle_time = #{handleTime},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBizTodoItemById" parameterType="Long">
|
||||
delete from biz_todo_item where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBizTodoItemByIds" parameterType="String">
|
||||
delete from biz_todo_item where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
1319
JeeThink-activiti/src/main/resources/stencilset.json
Normal file
1319
JeeThink-activiti/src/main/resources/stencilset.json
Normal file
File diff suppressed because one or more lines are too long
127
JeeThink-admin/pom.xml
Normal file
127
JeeThink-admin/pom.xml
Normal file
@ -0,0 +1,127 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>jeethink</artifactId>
|
||||
<groupId>com.jeethink</groupId>
|
||||
<version>3.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<packaging>jar</packaging>
|
||||
<artifactId>jeethink-admin</artifactId>
|
||||
|
||||
<description>
|
||||
web服务入口
|
||||
</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<!-- spring-boot-devtools -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<optional>true</optional> <!-- 表示依赖不会传递 -->
|
||||
</dependency>
|
||||
|
||||
<!-- swagger2-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!--防止进入swagger页面报类型转换错误,排除2.9.2中的引用,手动增加1.5.21版本-->
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>1.5.21</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
<version>1.5.21</version>
|
||||
</dependency>
|
||||
|
||||
<!-- swagger2-UI-->
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger-ui</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Mysql驱动包 -->
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
<!-- sqlserver驱动包 -->
|
||||
<dependency>
|
||||
<groupId>com.microsoft.sqlserver</groupId>
|
||||
<artifactId>mssql-jdbc</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 核心模块-->
|
||||
<dependency>
|
||||
<groupId>com.jeethink</groupId>
|
||||
<artifactId>jeethink-framework</artifactId>
|
||||
</dependency>
|
||||
<!--档案管理模块-->
|
||||
<dependency>
|
||||
<groupId>com.jeethink</groupId>
|
||||
<artifactId>jeethink-archives</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 定时任务-->
|
||||
<dependency>
|
||||
<groupId>com.jeethink</groupId>
|
||||
<artifactId>jeethink-quartz</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 代码生成-->
|
||||
<dependency>
|
||||
<groupId>com.jeethink</groupId>
|
||||
<artifactId>jeethink-generator</artifactId>
|
||||
</dependency>
|
||||
<!-- activiti-->
|
||||
<dependency>
|
||||
<groupId>com.jeethink</groupId>
|
||||
<artifactId>jeethink-activiti</artifactId>
|
||||
</dependency>
|
||||
<!-- 工作任务模块-->
|
||||
<dependency>
|
||||
<groupId>com.jeethink</groupId>
|
||||
<artifactId>jeethink-workFlow</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>2.1.1.RELEASE</version>
|
||||
<configuration>
|
||||
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<configuration>
|
||||
<failOnMissingWebXml>false</failOnMissingWebXml>
|
||||
<warName>${project.artifactId}</warName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
</build>
|
||||
|
||||
</project>
|
@ -0,0 +1,22 @@
|
||||
package com.jeethink;
|
||||
|
||||
import org.activiti.spring.boot.SecurityAutoConfiguration;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
|
||||
/**
|
||||
* 启动程序
|
||||
*
|
||||
* @author jeethink
|
||||
*/
|
||||
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, SecurityAutoConfiguration.class })
|
||||
public class JeeThinkApplication
|
||||
{
|
||||
public static void main(String[] args)
|
||||
{
|
||||
// System.setProperty("spring.devtools.restart.enabled", "false");
|
||||
SpringApplication.run(JeeThinkApplication.class, args);
|
||||
System.out.println("(♥◠‿◠)ノ゙ 智慧海档案系统启动成功 ლ(´ڡ`ლ)゙ \n");
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.jeethink;
|
||||
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
|
||||
/**
|
||||
* web容器中进行部署
|
||||
*
|
||||
* @author jeethink
|
||||
*/
|
||||
public class JeeThinkServletInitializer extends SpringBootServletInitializer
|
||||
{
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application)
|
||||
{
|
||||
return application.sources(JeeThinkApplication.class);
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package com.jeethink.web.controller.common;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.annotation.Resource;
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.util.FastByteArrayOutputStream;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.google.code.kaptcha.Producer;
|
||||
import com.jeethink.common.constant.Constants;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.core.redis.RedisCache;
|
||||
import com.jeethink.common.utils.sign.Base64;
|
||||
import com.jeethink.common.utils.uuid.IdUtils;
|
||||
|
||||
/**
|
||||
* 验证码操作处理
|
||||
*
|
||||
* @author jeethink
|
||||
*/
|
||||
@RestController
|
||||
public class CaptchaController
|
||||
{
|
||||
@Resource(name = "captchaProducer")
|
||||
private Producer captchaProducer;
|
||||
|
||||
@Resource(name = "captchaProducerMath")
|
||||
private Producer captchaProducerMath;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
// 验证码类型
|
||||
@Value("${jeethink.captchaType}")
|
||||
private String captchaType;
|
||||
|
||||
/**
|
||||
* 生成验证码
|
||||
*/
|
||||
@GetMapping("/captchaImage")
|
||||
public AjaxResult getCode(HttpServletResponse response) throws IOException
|
||||
{
|
||||
// 保存验证码信息
|
||||
String uuid = IdUtils.simpleUUID();
|
||||
String verifyKey = Constants.CAPTCHA_CODE_KEY + uuid;
|
||||
|
||||
String capStr = null, code = null;
|
||||
BufferedImage image = null;
|
||||
|
||||
// 生成验证码
|
||||
if ("math".equals(captchaType))
|
||||
{
|
||||
String capText = captchaProducerMath.createText();
|
||||
capStr = capText.substring(0, capText.lastIndexOf("@"));
|
||||
code = capText.substring(capText.lastIndexOf("@") + 1);
|
||||
image = captchaProducerMath.createImage(capStr);
|
||||
}
|
||||
else if ("char".equals(captchaType))
|
||||
{
|
||||
capStr = code = captchaProducer.createText();
|
||||
image = captchaProducer.createImage(capStr);
|
||||
}
|
||||
|
||||
redisCache.setCacheObject(verifyKey, code, Constants.CAPTCHA_EXPIRATION, TimeUnit.MINUTES);
|
||||
// 转换流信息写出
|
||||
FastByteArrayOutputStream os = new FastByteArrayOutputStream();
|
||||
try
|
||||
{
|
||||
ImageIO.write(image, "jpg", os);
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("uuid", uuid);
|
||||
ajax.put("img", Base64.encode(os.toByteArray()));
|
||||
return ajax;
|
||||
}
|
||||
}
|
@ -0,0 +1,110 @@
|
||||
package com.jeethink.web.controller.common;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.jeethink.common.config.JeeThinkConfig;
|
||||
import com.jeethink.common.constant.Constants;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.utils.StringUtils;
|
||||
import com.jeethink.common.utils.file.FileUploadUtils;
|
||||
import com.jeethink.common.utils.file.FileUtils;
|
||||
import com.jeethink.framework.config.ServerConfig;
|
||||
|
||||
/**
|
||||
* 通用请求处理
|
||||
*
|
||||
* @author jeethink
|
||||
*/
|
||||
@RestController
|
||||
public class CommonController
|
||||
{
|
||||
private static final Logger log = LoggerFactory.getLogger(CommonController.class);
|
||||
|
||||
@Autowired
|
||||
private ServerConfig serverConfig;
|
||||
|
||||
/**
|
||||
* 通用下载请求
|
||||
*
|
||||
* @param fileName 文件名称
|
||||
* @param delete 是否删除
|
||||
*/
|
||||
@GetMapping("common/download")
|
||||
public void fileDownload(String fileName, Boolean delete, HttpServletResponse response, HttpServletRequest request)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!FileUtils.isValidFilename(fileName))
|
||||
{
|
||||
throw new Exception(StringUtils.format("文件名称({})非法,不允许下载。 ", fileName));
|
||||
}
|
||||
String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
|
||||
String filePath = JeeThinkConfig.getDownloadPath() + fileName;
|
||||
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setContentType("multipart/form-data");
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment;fileName=" + FileUtils.setFileDownloadHeader(request, realFileName));
|
||||
FileUtils.writeBytes(filePath, response.getOutputStream());
|
||||
if (delete)
|
||||
{
|
||||
FileUtils.deleteFile(filePath);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.error("下载文件失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通用上传请求
|
||||
*/
|
||||
@PostMapping("/common/upload")
|
||||
public AjaxResult uploadFile(MultipartFile file) throws Exception
|
||||
{
|
||||
try
|
||||
{
|
||||
// 上传文件路径
|
||||
String filePath = JeeThinkConfig.getUploadPath();
|
||||
// 上传并返回新文件名称
|
||||
String fileName = FileUploadUtils.upload(filePath, file);
|
||||
String url = serverConfig.getUrl() + fileName;
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("fileName", fileName);
|
||||
ajax.put("url", url);
|
||||
return ajax;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
return AjaxResult.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 本地资源通用下载
|
||||
*/
|
||||
@GetMapping("/common/download/resource")
|
||||
public void resourceDownload(String name, HttpServletRequest request, HttpServletResponse response) throws Exception
|
||||
{
|
||||
// 本地资源路径
|
||||
String localPath = JeeThinkConfig.getProfile();
|
||||
// 数据库资源地址
|
||||
String downloadPath = localPath + StringUtils.substringAfter(name, Constants.RESOURCE_PREFIX);
|
||||
// 下载名称
|
||||
String downloadName = StringUtils.substringAfterLast(downloadPath, "/");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
response.setContentType("multipart/form-data");
|
||||
response.setHeader("Content-Disposition",
|
||||
"attachment;fileName=" + FileUtils.setFileDownloadHeader(request, downloadName));
|
||||
FileUtils.writeBytes(downloadPath, response.getOutputStream());
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.jeethink.web.controller.monitor;
|
||||
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.framework.web.domain.Server;
|
||||
|
||||
/**
|
||||
* 服务器监控
|
||||
*
|
||||
* @author jeethink
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/server")
|
||||
public class ServerController extends BaseController
|
||||
{
|
||||
@PreAuthorize("@ss.hasPermi('monitor:server:list')")
|
||||
@GetMapping()
|
||||
public AjaxResult getInfo() throws Exception
|
||||
{
|
||||
Server server = new Server();
|
||||
server.copyTo();
|
||||
return AjaxResult.success(server);
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package com.jeethink.web.controller.monitor;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jeethink.common.annotation.Log;
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.core.page.TableDataInfo;
|
||||
import com.jeethink.common.enums.BusinessType;
|
||||
import com.jeethink.common.utils.poi.ExcelUtil;
|
||||
import com.jeethink.system.domain.SysLogininfor;
|
||||
import com.jeethink.system.service.ISysLogininforService;
|
||||
|
||||
/**
|
||||
* 系统访问记录
|
||||
*
|
||||
* @author jeethink
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/logininfor")
|
||||
public class SysLogininforController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysLogininforService logininforService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysLogininfor logininfor)
|
||||
{
|
||||
startPage();
|
||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "登录日志", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:export')")
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SysLogininfor logininfor)
|
||||
{
|
||||
List<SysLogininfor> list = logininforService.selectLogininforList(logininfor);
|
||||
ExcelUtil<SysLogininfor> util = new ExcelUtil<SysLogininfor>(SysLogininfor.class);
|
||||
return util.exportExcel(list, "登录日志");
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
||||
@Log(title = "登录日志", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{infoIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] infoIds)
|
||||
{
|
||||
return toAjax(logininforService.deleteLogininforByIds(infoIds));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:logininfor:remove')")
|
||||
@Log(title = "登录日志", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/clean")
|
||||
public AjaxResult clean()
|
||||
{
|
||||
logininforService.cleanLogininfor();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
package com.jeethink.web.controller.monitor;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jeethink.common.annotation.Log;
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.core.page.TableDataInfo;
|
||||
import com.jeethink.common.enums.BusinessType;
|
||||
import com.jeethink.common.utils.poi.ExcelUtil;
|
||||
import com.jeethink.system.domain.SysOperLog;
|
||||
import com.jeethink.system.service.ISysOperLogService;
|
||||
|
||||
/**
|
||||
* 操作日志记录
|
||||
*
|
||||
* @author jeethink
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/operlog")
|
||||
public class SysOperlogController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysOperLogService operLogService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysOperLog operLog)
|
||||
{
|
||||
startPage();
|
||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:export')")
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SysOperLog operLog)
|
||||
{
|
||||
List<SysOperLog> list = operLogService.selectOperLogList(operLog);
|
||||
ExcelUtil<SysOperLog> util = new ExcelUtil<SysOperLog>(SysOperLog.class);
|
||||
return util.exportExcel(list, "操作日志");
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
||||
@DeleteMapping("/{operIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] operIds)
|
||||
{
|
||||
return toAjax(operLogService.deleteOperLogByIds(operIds));
|
||||
}
|
||||
|
||||
@Log(title = "操作日志", businessType = BusinessType.CLEAN)
|
||||
@PreAuthorize("@ss.hasPermi('monitor:operlog:remove')")
|
||||
@DeleteMapping("/clean")
|
||||
public AjaxResult clean()
|
||||
{
|
||||
operLogService.cleanOperLog();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package com.jeethink.web.controller.monitor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jeethink.common.annotation.Log;
|
||||
import com.jeethink.common.constant.Constants;
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.core.domain.model.LoginUser;
|
||||
import com.jeethink.common.core.page.TableDataInfo;
|
||||
import com.jeethink.common.core.redis.RedisCache;
|
||||
import com.jeethink.common.enums.BusinessType;
|
||||
import com.jeethink.common.utils.StringUtils;
|
||||
import com.jeethink.system.domain.SysUserOnline;
|
||||
import com.jeethink.system.service.ISysUserOnlineService;
|
||||
|
||||
/**
|
||||
* 在线用户监控
|
||||
*
|
||||
* @author jeethink
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/monitor/online")
|
||||
public class SysUserOnlineController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysUserOnlineService userOnlineService;
|
||||
|
||||
@Autowired
|
||||
private RedisCache redisCache;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('monitor:online:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(String ipaddr, String userName)
|
||||
{
|
||||
Collection<String> keys = redisCache.keys(Constants.LOGIN_TOKEN_KEY + "*");
|
||||
List<SysUserOnline> userOnlineList = new ArrayList<SysUserOnline>();
|
||||
for (String key : keys)
|
||||
{
|
||||
LoginUser user = redisCache.getCacheObject(key);
|
||||
if (StringUtils.isNotEmpty(ipaddr) && StringUtils.isNotEmpty(userName))
|
||||
{
|
||||
if (StringUtils.equals(ipaddr, user.getIpaddr()) && StringUtils.equals(userName, user.getUsername()))
|
||||
{
|
||||
userOnlineList.add(userOnlineService.selectOnlineByInfo(ipaddr, userName, user));
|
||||
}
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(ipaddr))
|
||||
{
|
||||
if (StringUtils.equals(ipaddr, user.getIpaddr()))
|
||||
{
|
||||
userOnlineList.add(userOnlineService.selectOnlineByIpaddr(ipaddr, user));
|
||||
}
|
||||
}
|
||||
else if (StringUtils.isNotEmpty(userName) && StringUtils.isNotNull(user.getUser()))
|
||||
{
|
||||
if (StringUtils.equals(userName, user.getUsername()))
|
||||
{
|
||||
userOnlineList.add(userOnlineService.selectOnlineByUserName(userName, user));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
userOnlineList.add(userOnlineService.loginUserToUserOnline(user));
|
||||
}
|
||||
}
|
||||
Collections.reverse(userOnlineList);
|
||||
userOnlineList.removeAll(Collections.singleton(null));
|
||||
return getDataTable(userOnlineList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 强退用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('monitor:online:forceLogout')")
|
||||
@Log(title = "在线用户", businessType = BusinessType.FORCE)
|
||||
@DeleteMapping("/{tokenId}")
|
||||
public AjaxResult forceLogout(@PathVariable String tokenId)
|
||||
{
|
||||
redisCache.deleteObject(Constants.LOGIN_TOKEN_KEY + tokenId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
package com.jeethink.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jeethink.common.annotation.Log;
|
||||
import com.jeethink.common.annotation.RepeatSubmit;
|
||||
import com.jeethink.common.constant.UserConstants;
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.core.page.TableDataInfo;
|
||||
import com.jeethink.common.enums.BusinessType;
|
||||
import com.jeethink.common.utils.SecurityUtils;
|
||||
import com.jeethink.common.utils.poi.ExcelUtil;
|
||||
import com.jeethink.system.domain.SysConfig;
|
||||
import com.jeethink.system.service.ISysConfigService;
|
||||
|
||||
/**
|
||||
* 参数配置 信息操作处理
|
||||
*
|
||||
* @author jeethink
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/config")
|
||||
public class SysConfigController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysConfigService configService;
|
||||
|
||||
/**
|
||||
* 获取参数配置列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysConfig config)
|
||||
{
|
||||
startPage();
|
||||
List<SysConfig> list = configService.selectConfigList(config);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "参数管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:config:export')")
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SysConfig config)
|
||||
{
|
||||
List<SysConfig> list = configService.selectConfigList(config);
|
||||
ExcelUtil<SysConfig> util = new ExcelUtil<SysConfig>(SysConfig.class);
|
||||
return util.exportExcel(list, "参数数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据参数编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:query')")
|
||||
@GetMapping(value = "/{configId}")
|
||||
public AjaxResult getInfo(@PathVariable Long configId)
|
||||
{
|
||||
return AjaxResult.success(configService.selectConfigById(configId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据参数键名查询参数值
|
||||
*/
|
||||
@GetMapping(value = "/configKey/{configKey}")
|
||||
public AjaxResult getConfigKey(@PathVariable String configKey)
|
||||
{
|
||||
return AjaxResult.success(configService.selectConfigByKey(configKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增参数配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:add')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@RepeatSubmit
|
||||
public AjaxResult add(@Validated @RequestBody SysConfig config)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
||||
{
|
||||
return AjaxResult.error("新增参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
config.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(configService.insertConfig(config));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改参数配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:edit')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysConfig config)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(configService.checkConfigKeyUnique(config)))
|
||||
{
|
||||
return AjaxResult.error("修改参数'" + config.getConfigName() + "'失败,参数键名已存在");
|
||||
}
|
||||
config.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(configService.updateConfig(config));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除参数配置
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{configIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] configIds)
|
||||
{
|
||||
return toAjax(configService.deleteConfigByIds(configIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空缓存
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:config:remove')")
|
||||
@Log(title = "参数管理", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/clearCache")
|
||||
public AjaxResult clearCache()
|
||||
{
|
||||
configService.clearCache();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
@ -0,0 +1,177 @@
|
||||
package com.jeethink.web.controller.system;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import com.jeethink.common.core.domain.TreeSelect;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jeethink.common.annotation.Log;
|
||||
import com.jeethink.common.constant.UserConstants;
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.core.domain.entity.SysDept;
|
||||
import com.jeethink.common.enums.BusinessType;
|
||||
import com.jeethink.common.utils.SecurityUtils;
|
||||
import com.jeethink.common.utils.StringUtils;
|
||||
import com.jeethink.system.service.ISysDeptService;
|
||||
|
||||
/**
|
||||
* 部门信息
|
||||
*
|
||||
* @author jeethink
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/dept")
|
||||
public class SysDeptController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysDeptService deptService;
|
||||
|
||||
/**
|
||||
* 获取部门列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:list')")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(SysDept dept)
|
||||
{
|
||||
List<SysDept> depts = deptService.selectDeptList(dept);
|
||||
return AjaxResult.success(depts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询部门列表(排除节点)
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:list')")
|
||||
@GetMapping("/list/exclude/{deptId}")
|
||||
public AjaxResult excludeChild(@PathVariable(value = "deptId", required = false) Long deptId)
|
||||
{
|
||||
List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
||||
Iterator<SysDept> it = depts.iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
SysDept d = (SysDept) it.next();
|
||||
if (d.getDeptId().intValue() == deptId
|
||||
|| ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""))
|
||||
{
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
return AjaxResult.success(depts);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据部门编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:query')")
|
||||
@GetMapping(value = "/{deptId}")
|
||||
public AjaxResult getInfo(@PathVariable Long deptId)
|
||||
{
|
||||
return AjaxResult.success(deptService.selectDeptById(deptId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取部门下拉树列表
|
||||
*/
|
||||
@GetMapping("/treeselect")
|
||||
public AjaxResult treeselect(SysDept dept)
|
||||
{
|
||||
List<SysDept> depts = deptService.selectDeptList(dept);
|
||||
List<TreeSelect> treeSelect = deptService.buildDeptTreeSelect(depts);
|
||||
return AjaxResult.success(treeSelect);
|
||||
}
|
||||
/**
|
||||
* 获取部门用户下拉树列表
|
||||
*/
|
||||
@GetMapping("/usertreeselect")
|
||||
public AjaxResult deptUserTreeSelect(SysDept dept)
|
||||
{
|
||||
List<SysDept> depts = deptService.selectDeptList(dept);
|
||||
List<TreeSelect> treeSelect = deptService.buildDeptUserTreeSelect(depts);
|
||||
return AjaxResult.success(treeSelect);
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载对应角色部门列表树
|
||||
*/
|
||||
@GetMapping(value = "/roleDeptTreeselect/{roleId}")
|
||||
public AjaxResult roleDeptTreeselect(@PathVariable("roleId") Long roleId)
|
||||
{
|
||||
List<SysDept> depts = deptService.selectDeptList(new SysDept());
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("checkedKeys", deptService.selectDeptListByRoleId(roleId));
|
||||
ajax.put("depts", deptService.buildDeptTreeSelect(depts));
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增部门
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:add')")
|
||||
@Log(title = "部门管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysDept dept)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
||||
{
|
||||
return AjaxResult.error("新增部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
}
|
||||
dept.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(deptService.insertDept(dept));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改部门
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:edit')")
|
||||
@Log(title = "部门管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysDept dept)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(deptService.checkDeptNameUnique(dept)))
|
||||
{
|
||||
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,部门名称已存在");
|
||||
}
|
||||
else if (dept.getParentId().equals(dept.getDeptId()))
|
||||
{
|
||||
return AjaxResult.error("修改部门'" + dept.getDeptName() + "'失败,上级部门不能是自己");
|
||||
}
|
||||
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, dept.getStatus())
|
||||
&& deptService.selectNormalChildrenDeptById(dept.getDeptId()) > 0)
|
||||
{
|
||||
return AjaxResult.error("该部门包含未停用的子部门!");
|
||||
}
|
||||
dept.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(deptService.updateDept(dept));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除部门
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dept:remove')")
|
||||
@Log(title = "部门管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{deptId}")
|
||||
public AjaxResult remove(@PathVariable Long deptId)
|
||||
{
|
||||
if (deptService.hasChildByDeptId(deptId))
|
||||
{
|
||||
return AjaxResult.error("存在下级部门,不允许删除");
|
||||
}
|
||||
if (deptService.checkDeptExistUser(deptId))
|
||||
{
|
||||
return AjaxResult.error("部门存在用户,不允许删除");
|
||||
}
|
||||
return toAjax(deptService.deleteDeptById(deptId));
|
||||
}
|
||||
}
|
@ -0,0 +1,114 @@
|
||||
package com.jeethink.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jeethink.common.annotation.Log;
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.core.domain.entity.SysDictData;
|
||||
import com.jeethink.common.core.page.TableDataInfo;
|
||||
import com.jeethink.common.enums.BusinessType;
|
||||
import com.jeethink.common.utils.SecurityUtils;
|
||||
import com.jeethink.common.utils.poi.ExcelUtil;
|
||||
import com.jeethink.system.service.ISysDictDataService;
|
||||
import com.jeethink.system.service.ISysDictTypeService;
|
||||
|
||||
/**
|
||||
* 数据字典信息
|
||||
*
|
||||
* @author jeethink
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/dict/data")
|
||||
public class SysDictDataController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysDictDataService dictDataService;
|
||||
|
||||
@Autowired
|
||||
private ISysDictTypeService dictTypeService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysDictData dictData)
|
||||
{
|
||||
startPage();
|
||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "字典数据", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SysDictData dictData)
|
||||
{
|
||||
List<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
||||
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(SysDictData.class);
|
||||
return util.exportExcel(list, "字典数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典数据详细
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||
@GetMapping(value = "/{dictCode}")
|
||||
public AjaxResult getInfo(@PathVariable Long dictCode)
|
||||
{
|
||||
return AjaxResult.success(dictDataService.selectDictDataById(dictCode));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据字典类型查询字典数据信息
|
||||
*/
|
||||
@GetMapping(value = "/type/{dictType}")
|
||||
public AjaxResult dictType(@PathVariable String dictType)
|
||||
{
|
||||
return AjaxResult.success(dictTypeService.selectDictDataByType(dictType));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||
@Log(title = "字典数据", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysDictData dict)
|
||||
{
|
||||
dict.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(dictDataService.insertDictData(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||
@Log(title = "字典数据", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysDictData dict)
|
||||
{
|
||||
dict.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(dictDataService.updateDictData(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{dictCodes}")
|
||||
public AjaxResult remove(@PathVariable Long[] dictCodes)
|
||||
{
|
||||
return toAjax(dictDataService.deleteDictDataByIds(dictCodes));
|
||||
}
|
||||
}
|
@ -0,0 +1,132 @@
|
||||
package com.jeethink.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jeethink.common.annotation.Log;
|
||||
import com.jeethink.common.constant.UserConstants;
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.core.domain.entity.SysDictType;
|
||||
import com.jeethink.common.core.page.TableDataInfo;
|
||||
import com.jeethink.common.enums.BusinessType;
|
||||
import com.jeethink.common.utils.SecurityUtils;
|
||||
import com.jeethink.common.utils.poi.ExcelUtil;
|
||||
import com.jeethink.system.service.ISysDictTypeService;
|
||||
|
||||
/**
|
||||
* 数据字典信息
|
||||
*
|
||||
* @author jeethink
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/dict/type")
|
||||
public class SysDictTypeController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysDictTypeService dictTypeService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysDictType dictType)
|
||||
{
|
||||
startPage();
|
||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:export')")
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SysDictType dictType)
|
||||
{
|
||||
List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
||||
ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
|
||||
return util.exportExcel(list, "字典类型");
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询字典类型详细
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:query')")
|
||||
@GetMapping(value = "/{dictId}")
|
||||
public AjaxResult getInfo(@PathVariable Long dictId)
|
||||
{
|
||||
return AjaxResult.success(dictTypeService.selectDictTypeById(dictId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:add')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysDictType dict)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
||||
{
|
||||
return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dict.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(dictTypeService.insertDictType(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysDictType dict)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
||||
{
|
||||
return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
||||
}
|
||||
dict.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(dictTypeService.updateDictType(dict));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除字典类型
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{dictIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] dictIds)
|
||||
{
|
||||
return toAjax(dictTypeService.deleteDictTypeByIds(dictIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 清空缓存
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
||||
@Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
||||
@DeleteMapping("/clearCache")
|
||||
public AjaxResult clearCache()
|
||||
{
|
||||
dictTypeService.clearCache();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取字典选择框列表
|
||||
*/
|
||||
@GetMapping("/optionselect")
|
||||
public AjaxResult optionselect()
|
||||
{
|
||||
List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
|
||||
return AjaxResult.success(dictTypes);
|
||||
}
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
package com.jeethink.web.controller.system;
|
||||
|
||||
import com.jeethink.common.config.JeeThinkConfig;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.core.domain.entity.SysUser;
|
||||
import com.jeethink.common.core.domain.model.LoginUser;
|
||||
import com.jeethink.common.utils.DateUtils;
|
||||
import com.jeethink.common.utils.ServletUtils;
|
||||
import com.jeethink.common.utils.StringUtils;
|
||||
import com.jeethink.common.utils.file.FileUploadUtils;
|
||||
import com.jeethink.common.utils.file.MimeTypeUtils;
|
||||
import com.jeethink.common.utils.uuid.IdUtils;
|
||||
import com.jeethink.framework.config.ServerConfig;
|
||||
import com.jeethink.framework.web.service.TokenService;
|
||||
import com.jeethink.system.domain.SystemFile;
|
||||
import com.jeethink.system.service.ISystemFileService;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author Administrator
|
||||
* @version 1.0
|
||||
* @description: 附件上传
|
||||
* @date 2022-03-24 14:12
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/sysFile")
|
||||
public class SysFileController {
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private ServerConfig serverConfig;
|
||||
|
||||
@Autowired
|
||||
private ISystemFileService systemFileService;
|
||||
/**
|
||||
* @auter:gd
|
||||
* @des 附件上传
|
||||
* @param file
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/upload")
|
||||
public AjaxResult avatar(@RequestParam("uploadfile") MultipartFile file,@RequestParam("uid") String uid) throws IOException
|
||||
{
|
||||
if (!file.isEmpty())
|
||||
{
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
SysUser user = loginUser.getUser();
|
||||
String filePath = JeeThinkConfig.getUploadPath();//文件磁盘存放路径
|
||||
// 上传并返回新文件名称
|
||||
String urlName = "",fileName="";
|
||||
urlName = FileUploadUtils.upload(filePath, file);
|
||||
fileName = file.getOriginalFilename();
|
||||
String extension = getExtension(file);
|
||||
filePath = filePath+ "/" + DateUtils.datePath() + "/" + IdUtils.fastUUID() + "." + extension;
|
||||
SystemFile sysfile = new SystemFile();
|
||||
sysfile.setFileId(uid);
|
||||
sysfile.setFileName(fileName);
|
||||
String url = serverConfig.getUrl() + urlName;
|
||||
sysfile.setFileUrl(url);//浏览器直接访问地址
|
||||
sysfile.setFilePath(filePath);
|
||||
sysfile.setFileSize(file.getSize());
|
||||
sysfile.setFileSuffix(extension);
|
||||
sysfile.setCreateUserId(user.getUserId());
|
||||
sysfile.setFileCreateTime(DateUtils.getNowDate());
|
||||
int rows = systemFileService.insertSystemFile(sysfile);
|
||||
return AjaxResult.success("上传成功",sysfile);
|
||||
}
|
||||
return AjaxResult.error("上传图片异常,请联系管理员");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取文件名的后缀
|
||||
*
|
||||
* @param file 表单文件
|
||||
* @return 后缀名
|
||||
*/
|
||||
public static final String getExtension(MultipartFile file)
|
||||
{
|
||||
String extension = FilenameUtils.getExtension(file.getOriginalFilename());
|
||||
if (StringUtils.isEmpty(extension))
|
||||
{
|
||||
extension = MimeTypeUtils.getExtension(file.getContentType());
|
||||
}
|
||||
return extension;
|
||||
}
|
||||
}
|
@ -0,0 +1,128 @@
|
||||
package com.jeethink.web.controller.system;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.jeethink.common.utils.MD5Utils;
|
||||
import com.jeethink.system.service.ISysUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jeethink.common.constant.Constants;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.core.domain.entity.SysMenu;
|
||||
import com.jeethink.common.core.domain.entity.SysUser;
|
||||
import com.jeethink.common.core.domain.model.LoginBody;
|
||||
import com.jeethink.common.core.domain.model.LoginUser;
|
||||
import com.jeethink.common.utils.ServletUtils;
|
||||
import com.jeethink.framework.web.service.SysLoginService;
|
||||
import com.jeethink.framework.web.service.SysPermissionService;
|
||||
import com.jeethink.framework.web.service.TokenService;
|
||||
import com.jeethink.system.service.ISysMenuService;
|
||||
|
||||
/**
|
||||
* 登录验证
|
||||
*
|
||||
* @author jeethink
|
||||
*/
|
||||
@RestController
|
||||
public class SysLoginController
|
||||
{
|
||||
@Autowired
|
||||
private SysLoginService loginService;
|
||||
|
||||
@Autowired
|
||||
private ISysMenuService menuService;
|
||||
|
||||
@Autowired
|
||||
private SysPermissionService permissionService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
/**
|
||||
* 登录方法
|
||||
*
|
||||
* @param loginBody 登录信息
|
||||
* @return 结果
|
||||
*/
|
||||
@PostMapping("/login")
|
||||
public AjaxResult login(@RequestBody LoginBody loginBody)
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
// 生成令牌
|
||||
String token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getCode(),
|
||||
loginBody.getUuid());
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
//人力系统单点登录后台接口
|
||||
@PostMapping("/login/human")
|
||||
public AjaxResult humanLogin(@RequestBody HashMap data){
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
String token="";
|
||||
String userNum = (String) data.get("userNum");
|
||||
String timestamp = (String) data.get("timestamp");
|
||||
String str = (String) data.get("str");
|
||||
String humanToken = (String) data.get("token");
|
||||
String realToken= MD5Utils.stringToMD5(userNum+timestamp+str);
|
||||
if(realToken.equals(humanToken)){
|
||||
HashMap account=userService.selectAccount(userNum);
|
||||
String userName= (String) account.get("userName");
|
||||
String password= (String) account.get("password");
|
||||
// 生成令牌
|
||||
token = loginService.login(userName,password,null,"");
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
return ajax;
|
||||
}else{
|
||||
return AjaxResult.error();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户信息
|
||||
*
|
||||
* @return 用户信息
|
||||
*/
|
||||
@GetMapping("getInfo")
|
||||
public AjaxResult getInfo()
|
||||
{
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
SysUser user = loginUser.getUser();
|
||||
// 角色集合
|
||||
Set<String> roles = permissionService.getRolePermission(user);
|
||||
// 权限集合
|
||||
Set<String> permissions = permissionService.getMenuPermission(user);
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("user", user);
|
||||
ajax.put("roles", roles);
|
||||
ajax.put("permissions", permissions);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取路由信息
|
||||
*
|
||||
* @return 路由信息
|
||||
*/
|
||||
@GetMapping("getRouters")
|
||||
public AjaxResult getRouters()
|
||||
{
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
// 用户信息
|
||||
SysUser user = loginUser.getUser();
|
||||
List<SysMenu> menus = menuService.selectMenuTreeByUserId(user.getUserId());
|
||||
return AjaxResult.success(menuService.buildMenus(menus));
|
||||
}
|
||||
}
|
@ -0,0 +1,158 @@
|
||||
package com.jeethink.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jeethink.common.annotation.Log;
|
||||
import com.jeethink.common.constant.Constants;
|
||||
import com.jeethink.common.constant.UserConstants;
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.core.domain.entity.SysMenu;
|
||||
import com.jeethink.common.core.domain.model.LoginUser;
|
||||
import com.jeethink.common.enums.BusinessType;
|
||||
import com.jeethink.common.utils.SecurityUtils;
|
||||
import com.jeethink.common.utils.ServletUtils;
|
||||
import com.jeethink.common.utils.StringUtils;
|
||||
import com.jeethink.framework.web.service.TokenService;
|
||||
import com.jeethink.system.service.ISysMenuService;
|
||||
|
||||
/**
|
||||
* 菜单信息
|
||||
*
|
||||
* @author jeethink
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/menu")
|
||||
public class SysMenuController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysMenuService menuService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
/**
|
||||
* 获取菜单列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:list')")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(SysMenu menu)
|
||||
{
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
Long userId = loginUser.getUser().getUserId();
|
||||
List<SysMenu> menus = menuService.selectMenuList(menu, userId);
|
||||
return AjaxResult.success(menus);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据菜单编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:query')")
|
||||
@GetMapping(value = "/{menuId}")
|
||||
public AjaxResult getInfo(@PathVariable Long menuId)
|
||||
{
|
||||
return AjaxResult.success(menuService.selectMenuById(menuId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取菜单下拉树列表
|
||||
*/
|
||||
@GetMapping("/treeselect")
|
||||
public AjaxResult treeselect(SysMenu menu)
|
||||
{
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
Long userId = loginUser.getUser().getUserId();
|
||||
List<SysMenu> menus = menuService.selectMenuList(menu, userId);
|
||||
return AjaxResult.success(menuService.buildMenuTreeSelect(menus));
|
||||
}
|
||||
|
||||
/**
|
||||
* 加载对应角色菜单列表树
|
||||
*/
|
||||
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
|
||||
public AjaxResult roleMenuTreeselect(@PathVariable("roleId") Long roleId)
|
||||
{
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
List<SysMenu> menus = menuService.selectMenuList(loginUser.getUser().getUserId());
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
|
||||
ajax.put("menus", menuService.buildMenuTreeSelect(menus));
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增菜单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:add')")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysMenu menu)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
||||
{
|
||||
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
}
|
||||
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame())
|
||||
&& !StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS))
|
||||
{
|
||||
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||
}
|
||||
menu.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(menuService.insertMenu(menu));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改菜单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:edit')")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysMenu menu)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(menuService.checkMenuNameUnique(menu)))
|
||||
{
|
||||
return AjaxResult.error("修改菜单'" + menu.getMenuName() + "'失败,菜单名称已存在");
|
||||
}
|
||||
else if (UserConstants.YES_FRAME.equals(menu.getIsFrame())
|
||||
&& !StringUtils.startsWithAny(menu.getPath(), Constants.HTTP, Constants.HTTPS))
|
||||
{
|
||||
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,地址必须以http(s)://开头");
|
||||
}
|
||||
else if (menu.getMenuId().equals(menu.getParentId()))
|
||||
{
|
||||
return AjaxResult.error("新增菜单'" + menu.getMenuName() + "'失败,上级菜单不能选择自己");
|
||||
}
|
||||
menu.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(menuService.updateMenu(menu));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除菜单
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:menu:remove')")
|
||||
@Log(title = "菜单管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{menuId}")
|
||||
public AjaxResult remove(@PathVariable("menuId") Long menuId)
|
||||
{
|
||||
if (menuService.hasChildByMenuId(menuId))
|
||||
{
|
||||
return AjaxResult.error("存在子菜单,不允许删除");
|
||||
}
|
||||
if (menuService.checkMenuExistRole(menuId))
|
||||
{
|
||||
return AjaxResult.error("菜单已分配,不允许删除");
|
||||
}
|
||||
return toAjax(menuService.deleteMenuById(menuId));
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package com.jeethink.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jeethink.common.annotation.Log;
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.core.page.TableDataInfo;
|
||||
import com.jeethink.common.enums.BusinessType;
|
||||
import com.jeethink.common.utils.SecurityUtils;
|
||||
import com.jeethink.system.domain.SysNotice;
|
||||
import com.jeethink.system.service.ISysNoticeService;
|
||||
|
||||
/**
|
||||
* 公告 信息操作处理
|
||||
*
|
||||
* @author jeethink
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/notice")
|
||||
public class SysNoticeController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysNoticeService noticeService;
|
||||
|
||||
/**
|
||||
* 获取通知公告列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysNotice notice)
|
||||
{
|
||||
startPage();
|
||||
List<SysNotice> list = noticeService.selectNoticeList(notice);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据通知公告编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:query')")
|
||||
@GetMapping(value = "/{noticeId}")
|
||||
public AjaxResult getInfo(@PathVariable Long noticeId)
|
||||
{
|
||||
return AjaxResult.success(noticeService.selectNoticeById(noticeId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增通知公告
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:add')")
|
||||
@Log(title = "通知公告", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysNotice notice)
|
||||
{
|
||||
notice.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(noticeService.insertNotice(notice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改通知公告
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:edit')")
|
||||
@Log(title = "通知公告", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysNotice notice)
|
||||
{
|
||||
notice.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(noticeService.updateNotice(notice));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除通知公告
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:notice:remove')")
|
||||
@Log(title = "通知公告", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{noticeIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] noticeIds)
|
||||
{
|
||||
return toAjax(noticeService.deleteNoticeByIds(noticeIds));
|
||||
}
|
||||
}
|
@ -0,0 +1,131 @@
|
||||
package com.jeethink.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jeethink.common.annotation.Log;
|
||||
import com.jeethink.common.constant.UserConstants;
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.core.page.TableDataInfo;
|
||||
import com.jeethink.common.enums.BusinessType;
|
||||
import com.jeethink.common.utils.SecurityUtils;
|
||||
import com.jeethink.common.utils.poi.ExcelUtil;
|
||||
import com.jeethink.system.domain.SysPost;
|
||||
import com.jeethink.system.service.ISysPostService;
|
||||
|
||||
/**
|
||||
* 岗位信息操作处理
|
||||
*
|
||||
* @author jeethink
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/post")
|
||||
public class SysPostController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysPostService postService;
|
||||
|
||||
/**
|
||||
* 获取岗位列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysPost post)
|
||||
{
|
||||
startPage();
|
||||
List<SysPost> list = postService.selectPostList(post);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "岗位管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:post:export')")
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SysPost post)
|
||||
{
|
||||
List<SysPost> list = postService.selectPostList(post);
|
||||
ExcelUtil<SysPost> util = new ExcelUtil<SysPost>(SysPost.class);
|
||||
return util.exportExcel(list, "岗位数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据岗位编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:query')")
|
||||
@GetMapping(value = "/{postId}")
|
||||
public AjaxResult getInfo(@PathVariable Long postId)
|
||||
{
|
||||
return AjaxResult.success(postService.selectPostById(postId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增岗位
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:add')")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysPost post)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
||||
{
|
||||
return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
}
|
||||
else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
||||
{
|
||||
return AjaxResult.error("新增岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
}
|
||||
post.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(postService.insertPost(post));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改岗位
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:edit')")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysPost post)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(postService.checkPostNameUnique(post)))
|
||||
{
|
||||
return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位名称已存在");
|
||||
}
|
||||
else if (UserConstants.NOT_UNIQUE.equals(postService.checkPostCodeUnique(post)))
|
||||
{
|
||||
return AjaxResult.error("修改岗位'" + post.getPostName() + "'失败,岗位编码已存在");
|
||||
}
|
||||
post.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(postService.updatePost(post));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除岗位
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:post:remove')")
|
||||
@Log(title = "岗位管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{postIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] postIds)
|
||||
{
|
||||
return toAjax(postService.deletePostByIds(postIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取岗位选择框列表
|
||||
*/
|
||||
@GetMapping("/optionselect")
|
||||
public AjaxResult optionselect()
|
||||
{
|
||||
List<SysPost> posts = postService.selectPostAll();
|
||||
return AjaxResult.success(posts);
|
||||
}
|
||||
}
|
@ -0,0 +1,128 @@
|
||||
package com.jeethink.web.controller.system;
|
||||
|
||||
import java.io.IOException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.jeethink.common.annotation.Log;
|
||||
import com.jeethink.common.config.JeeThinkConfig;
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.core.domain.entity.SysUser;
|
||||
import com.jeethink.common.core.domain.model.LoginUser;
|
||||
import com.jeethink.common.enums.BusinessType;
|
||||
import com.jeethink.common.utils.SecurityUtils;
|
||||
import com.jeethink.common.utils.ServletUtils;
|
||||
import com.jeethink.common.utils.file.FileUploadUtils;
|
||||
import com.jeethink.framework.web.service.TokenService;
|
||||
import com.jeethink.system.service.ISysUserService;
|
||||
|
||||
/**
|
||||
* 个人信息 业务处理
|
||||
*
|
||||
* @author jeethink
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/user/profile")
|
||||
public class SysProfileController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
/**
|
||||
* 个人信息
|
||||
*/
|
||||
@GetMapping
|
||||
public AjaxResult profile()
|
||||
{
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
SysUser user = loginUser.getUser();
|
||||
AjaxResult ajax = AjaxResult.success(user);
|
||||
ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
|
||||
ajax.put("postGroup", userService.selectUserPostGroup(loginUser.getUsername()));
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult updateProfile(@RequestBody SysUser user)
|
||||
{
|
||||
if (userService.updateUserProfile(user) > 0)
|
||||
{
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
// 更新缓存用户信息
|
||||
loginUser.getUser().setNickName(user.getNickName());
|
||||
loginUser.getUser().setPhonenumber(user.getPhonenumber());
|
||||
loginUser.getUser().setEmail(user.getEmail());
|
||||
loginUser.getUser().setSex(user.getSex());
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error("修改个人信息异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*/
|
||||
@Log(title = "个人信息", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/updatePwd")
|
||||
public AjaxResult updatePwd(String oldPassword, String newPassword)
|
||||
{
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
String userName = loginUser.getUsername();
|
||||
String password = loginUser.getPassword();
|
||||
if (!SecurityUtils.matchesPassword(oldPassword, password))
|
||||
{
|
||||
return AjaxResult.error("修改密码失败,旧密码错误");
|
||||
}
|
||||
if (SecurityUtils.matchesPassword(newPassword, password))
|
||||
{
|
||||
return AjaxResult.error("新密码不能与旧密码相同");
|
||||
}
|
||||
if (userService.resetUserPwd(userName, SecurityUtils.encryptPassword(newPassword)) > 0)
|
||||
{
|
||||
// 更新缓存用户密码
|
||||
loginUser.getUser().setPassword(SecurityUtils.encryptPassword(newPassword));
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error("修改密码异常,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 头像上传
|
||||
*/
|
||||
@Log(title = "用户头像", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/avatar")
|
||||
public AjaxResult avatar(@RequestParam("avatarfile") MultipartFile file) throws IOException
|
||||
{
|
||||
if (!file.isEmpty())
|
||||
{
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
String avatar = FileUploadUtils.upload(JeeThinkConfig.getAvatarPath(), file);
|
||||
if (userService.updateUserAvatar(loginUser.getUsername(), avatar))
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
ajax.put("imgUrl", avatar);
|
||||
// 更新缓存用户头像
|
||||
loginUser.getUser().setAvatar(avatar);
|
||||
tokenService.setLoginUser(loginUser);
|
||||
return ajax;
|
||||
}
|
||||
}
|
||||
return AjaxResult.error("上传图片异常,请联系管理员");
|
||||
}
|
||||
}
|
@ -0,0 +1,183 @@
|
||||
package com.jeethink.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jeethink.common.annotation.Log;
|
||||
import com.jeethink.common.constant.UserConstants;
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.core.domain.entity.SysRole;
|
||||
import com.jeethink.common.core.domain.model.LoginUser;
|
||||
import com.jeethink.common.core.page.TableDataInfo;
|
||||
import com.jeethink.common.enums.BusinessType;
|
||||
import com.jeethink.common.utils.SecurityUtils;
|
||||
import com.jeethink.common.utils.ServletUtils;
|
||||
import com.jeethink.common.utils.StringUtils;
|
||||
import com.jeethink.common.utils.poi.ExcelUtil;
|
||||
import com.jeethink.framework.web.service.SysPermissionService;
|
||||
import com.jeethink.framework.web.service.TokenService;
|
||||
import com.jeethink.system.service.ISysRoleService;
|
||||
import com.jeethink.system.service.ISysUserService;
|
||||
|
||||
/**
|
||||
* 角色信息
|
||||
*
|
||||
* @author jeethink
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/role")
|
||||
public class SysRoleController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysRoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private SysPermissionService permissionService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('system:role:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysRole role)
|
||||
{
|
||||
startPage();
|
||||
List<SysRole> list = roleService.selectRoleList(role);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@Log(title = "角色管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:role:export')")
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SysRole role)
|
||||
{
|
||||
List<SysRole> list = roleService.selectRoleList(role);
|
||||
ExcelUtil<SysRole> util = new ExcelUtil<SysRole>(SysRole.class);
|
||||
return util.exportExcel(list, "角色数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据角色编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||
@GetMapping(value = "/{roleId}")
|
||||
public AjaxResult getInfo(@PathVariable Long roleId)
|
||||
{
|
||||
return AjaxResult.success(roleService.selectRoleById(roleId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增角色
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:add')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysRole role)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
||||
{
|
||||
return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
}
|
||||
else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
||||
{
|
||||
return AjaxResult.error("新增角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||
}
|
||||
role.setCreateBy(SecurityUtils.getUsername());
|
||||
return toAjax(roleService.insertRole(role));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存角色
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysRole role)
|
||||
{
|
||||
roleService.checkRoleAllowed(role);
|
||||
if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleNameUnique(role)))
|
||||
{
|
||||
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色名称已存在");
|
||||
}
|
||||
else if (UserConstants.NOT_UNIQUE.equals(roleService.checkRoleKeyUnique(role)))
|
||||
{
|
||||
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,角色权限已存在");
|
||||
}
|
||||
role.setUpdateBy(SecurityUtils.getUsername());
|
||||
|
||||
if (roleService.updateRole(role) > 0)
|
||||
{
|
||||
// 更新缓存用户权限
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
if (StringUtils.isNotNull(loginUser.getUser()) && !loginUser.getUser().isAdmin())
|
||||
{
|
||||
loginUser.setPermissions(permissionService.getMenuPermission(loginUser.getUser()));
|
||||
loginUser.setUser(userService.selectUserByUserName(loginUser.getUser().getUserName()));
|
||||
tokenService.setLoginUser(loginUser);
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
return AjaxResult.error("修改角色'" + role.getRoleName() + "'失败,请联系管理员");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存数据权限
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/dataScope")
|
||||
public AjaxResult dataScope(@RequestBody SysRole role)
|
||||
{
|
||||
roleService.checkRoleAllowed(role);
|
||||
return toAjax(roleService.authDataScope(role));
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态修改
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:edit')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/changeStatus")
|
||||
public AjaxResult changeStatus(@RequestBody SysRole role)
|
||||
{
|
||||
roleService.checkRoleAllowed(role);
|
||||
role.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(roleService.updateRoleStatus(role));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除角色
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:remove')")
|
||||
@Log(title = "角色管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{roleIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] roleIds)
|
||||
{
|
||||
return toAjax(roleService.deleteRoleByIds(roleIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取角色选择框列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:role:query')")
|
||||
@GetMapping("/optionselect")
|
||||
public AjaxResult optionselect()
|
||||
{
|
||||
return AjaxResult.success(roleService.selectRoleAll());
|
||||
}
|
||||
}
|
@ -0,0 +1,307 @@
|
||||
package com.jeethink.web.controller.system;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.jeethink.common.core.domain.entity.SysDept;
|
||||
import com.jeethink.common.utils.DateUtils;
|
||||
import com.jeethink.system.service.ISysDeptService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import com.jeethink.common.annotation.Log;
|
||||
import com.jeethink.common.constant.UserConstants;
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.core.domain.entity.SysRole;
|
||||
import com.jeethink.common.core.domain.entity.SysUser;
|
||||
import com.jeethink.common.core.domain.model.LoginUser;
|
||||
import com.jeethink.common.core.page.TableDataInfo;
|
||||
import com.jeethink.common.enums.BusinessType;
|
||||
import com.jeethink.common.utils.SecurityUtils;
|
||||
import com.jeethink.common.utils.ServletUtils;
|
||||
import com.jeethink.common.utils.StringUtils;
|
||||
import com.jeethink.common.utils.poi.ExcelUtil;
|
||||
import com.jeethink.framework.web.service.TokenService;
|
||||
import com.jeethink.system.service.ISysPostService;
|
||||
import com.jeethink.system.service.ISysRoleService;
|
||||
import com.jeethink.system.service.ISysUserService;
|
||||
|
||||
/**
|
||||
* 用户信息
|
||||
*
|
||||
* @author jeethink
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/system/user")
|
||||
@Component("same")
|
||||
public class SysUserController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISysUserService userService;
|
||||
|
||||
@Autowired
|
||||
private ISysRoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private ISysPostService postService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@Autowired
|
||||
private ISysDeptService sysDeptService;
|
||||
|
||||
/**
|
||||
* 获取用户列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SysUser user)
|
||||
{
|
||||
startPage();
|
||||
List<SysUser> list = userService.selectUserList(user);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* sh
|
||||
* 2022年12月13日09:27:07
|
||||
* 定时任务同步人力系统组织及人员数据
|
||||
*/
|
||||
public void same()
|
||||
{
|
||||
SysDept dept = new SysDept();
|
||||
SysUser user = new SysUser();
|
||||
List<SysDept> rlDeptList = sysDeptService.selectRlDept();
|
||||
/*List<SysDept> deptList=sysDeptService.selectDeptList(dept);*/
|
||||
List<SysDept> deptList=sysDeptService.selectDeptAll();
|
||||
for(int i=0;i<rlDeptList.size();i++){
|
||||
Boolean oper=false;
|
||||
for(int j=0;j<deptList.size();j++){
|
||||
long a = rlDeptList.get(i).getDeptId();
|
||||
long b = deptList.get(j).getDeptId();
|
||||
if(a==b){
|
||||
oper=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(oper==false){
|
||||
sysDeptService.insertDept(rlDeptList.get(i));
|
||||
}
|
||||
}
|
||||
List<SysUser> rlUserList = userService.selectRlUser();
|
||||
/*List<SysUser> userList = userService.selectUserList(user);*/
|
||||
List<SysUser> userList = userService.selectUserAll();
|
||||
for(int i=0;i<rlUserList.size();i++){
|
||||
Boolean oper2=false;
|
||||
for(int j=0;j<userList.size();j++){
|
||||
String m = rlUserList.get(i).getUserNum();
|
||||
String n = userList.get(j).getUserNum();
|
||||
if(m.equals(n)){
|
||||
oper2=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(oper2==false){
|
||||
rlUserList.get(i).setRealPassword("123456");
|
||||
rlUserList.get(i).setPassword(SecurityUtils.encryptPassword("123456"));
|
||||
userService.insertUser(rlUserList.get(i));
|
||||
}
|
||||
}
|
||||
System.out.println("----------------------组织及人员数据同步完毕----------------------"+ DateUtils.getTime());
|
||||
}
|
||||
|
||||
|
||||
|
||||
//同步组织人员
|
||||
/* @GetMapping("/same")
|
||||
public AjaxResult same()
|
||||
{
|
||||
SysDept dept = new SysDept();
|
||||
SysUser user = new SysUser();
|
||||
List<SysDept> rlDeptList = sysDeptService.selectRlDept();
|
||||
List<SysDept> deptList=sysDeptService.selectDeptList(dept);
|
||||
for(int i=0;i<rlDeptList.size();i++){
|
||||
Boolean oper=false;
|
||||
for(int j=0;j<deptList.size();j++){
|
||||
long a = rlDeptList.get(i).getDeptId();
|
||||
long b = deptList.get(j).getDeptId();
|
||||
if(a==b){
|
||||
oper=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(oper==false){
|
||||
sysDeptService.insertDept(rlDeptList.get(i));
|
||||
}
|
||||
}
|
||||
List<SysUser> rlUserList = userService.selectRlUser();
|
||||
List<SysUser> userList = userService.selectUserList(user);
|
||||
for(int i=0;i<rlUserList.size();i++){
|
||||
Boolean oper2=false;
|
||||
for(int j=0;j<userList.size();j++){
|
||||
String m = rlUserList.get(i).getUserNum();
|
||||
String n = userList.get(j).getUserNum();
|
||||
if(m.equals(n)){
|
||||
oper2=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(oper2==false){
|
||||
rlUserList.get(i).setRealPassword("123456");
|
||||
rlUserList.get(i).setPassword(SecurityUtils.encryptPassword("123456"));
|
||||
userService.insertUser(rlUserList.get(i));
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}*/
|
||||
|
||||
@Log(title = "用户管理", businessType = BusinessType.EXPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:user:export')")
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(SysUser user)
|
||||
{
|
||||
List<SysUser> list = userService.selectUserList(user);
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||
return util.exportExcel(list, "用户数据");
|
||||
}
|
||||
|
||||
@Log(title = "用户管理", businessType = BusinessType.IMPORT)
|
||||
@PreAuthorize("@ss.hasPermi('system:user:import')")
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
||||
{
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||
List<SysUser> userList = util.importExcel(file.getInputStream());
|
||||
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
|
||||
String operName = loginUser.getUsername();
|
||||
String message = userService.importUser(userList, updateSupport, operName);
|
||||
return AjaxResult.success(message);
|
||||
}
|
||||
|
||||
@GetMapping("/importTemplate")
|
||||
public AjaxResult importTemplate()
|
||||
{
|
||||
ExcelUtil<SysUser> util = new ExcelUtil<SysUser>(SysUser.class);
|
||||
return util.importTemplateExcel("用户数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户编号获取详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:query')")
|
||||
@GetMapping(value = { "/", "/{userId}" })
|
||||
public AjaxResult getInfo(@PathVariable(value = "userId", required = false) Long userId)
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
List<SysRole> roles = roleService.selectRoleAll();
|
||||
ajax.put("roles", SysUser.isAdmin(userId) ? roles : roles.stream().filter(r -> !r.isAdmin()).collect(Collectors.toList()));
|
||||
ajax.put("posts", postService.selectPostAll());
|
||||
if (StringUtils.isNotNull(userId))
|
||||
{
|
||||
ajax.put(AjaxResult.DATA_TAG, userService.selectUserById(userId));
|
||||
ajax.put("postIds", postService.selectPostListByUserId(userId));
|
||||
ajax.put("roleIds", roleService.selectRoleListByUserId(userId));
|
||||
}
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:add')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody SysUser user)
|
||||
{
|
||||
if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName())))
|
||||
{
|
||||
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
||||
}
|
||||
else if (UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
||||
{
|
||||
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
}
|
||||
else if (UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
||||
{
|
||||
return AjaxResult.error("新增用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}
|
||||
user.setCreateBy(SecurityUtils.getUsername());
|
||||
user.setRealPassword(user.getPassword());
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
return toAjax(userService.insertUser(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody SysUser user)
|
||||
{
|
||||
userService.checkUserAllowed(user);
|
||||
/* if (UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique(user)))
|
||||
{
|
||||
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,手机号码已存在");
|
||||
}
|
||||
else if (UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique(user)))
|
||||
{
|
||||
return AjaxResult.error("修改用户'" + user.getUserName() + "'失败,邮箱账号已存在");
|
||||
}*/
|
||||
user.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(userService.updateUser(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:remove')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{userIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] userIds)
|
||||
{
|
||||
return toAjax(userService.deleteUserByIds(userIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 重置密码
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/resetPwd")
|
||||
public AjaxResult resetPwd(@RequestBody SysUser user)
|
||||
{
|
||||
userService.checkUserAllowed(user);
|
||||
user.setRealPassword(user.getPassword());
|
||||
user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
|
||||
user.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(userService.resetPwd(user));
|
||||
}
|
||||
|
||||
/**
|
||||
* 状态修改
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:user:edit')")
|
||||
@Log(title = "用户管理", businessType = BusinessType.UPDATE)
|
||||
@PutMapping("/changeStatus")
|
||||
public AjaxResult changeStatus(@RequestBody SysUser user)
|
||||
{
|
||||
userService.checkUserAllowed(user);
|
||||
user.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(userService.updateUserStatus(user));
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.jeethink.web.controller.tool;
|
||||
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
|
||||
/**
|
||||
* swagger 接口
|
||||
*
|
||||
* @author jeethink
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/tool/swagger")
|
||||
public class SwaggerController extends BaseController
|
||||
{
|
||||
@PreAuthorize("@ss.hasPermi('tool:swagger:view')")
|
||||
@GetMapping()
|
||||
public String index()
|
||||
{
|
||||
return redirect("/swagger-ui.html");
|
||||
}
|
||||
}
|
@ -0,0 +1,177 @@
|
||||
package com.jeethink.web.controller.tool;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.utils.StringUtils;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
||||
/**
|
||||
* swagger 用户测试方法
|
||||
*
|
||||
* @author jeethink
|
||||
*/
|
||||
@Api("用户信息管理")
|
||||
@RestController
|
||||
@RequestMapping("/test/user")
|
||||
public class TestController extends BaseController
|
||||
{
|
||||
private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
|
||||
{
|
||||
users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
|
||||
users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户列表")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult userList()
|
||||
{
|
||||
List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
|
||||
return AjaxResult.success(userList);
|
||||
}
|
||||
|
||||
@ApiOperation("获取用户详细")
|
||||
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
|
||||
@GetMapping("/{userId}")
|
||||
public AjaxResult getUser(@PathVariable Integer userId)
|
||||
{
|
||||
if (!users.isEmpty() && users.containsKey(userId))
|
||||
{
|
||||
return AjaxResult.success(users.get(userId));
|
||||
}
|
||||
else
|
||||
{
|
||||
return AjaxResult.error("用户不存在");
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation("新增用户")
|
||||
@ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
|
||||
@PostMapping("/save")
|
||||
public AjaxResult save(UserEntity user)
|
||||
{
|
||||
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
||||
{
|
||||
return AjaxResult.error("用户ID不能为空");
|
||||
}
|
||||
return AjaxResult.success(users.put(user.getUserId(), user));
|
||||
}
|
||||
|
||||
@ApiOperation("更新用户")
|
||||
@ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
|
||||
@PutMapping("/update")
|
||||
public AjaxResult update(UserEntity user)
|
||||
{
|
||||
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
|
||||
{
|
||||
return AjaxResult.error("用户ID不能为空");
|
||||
}
|
||||
if (users.isEmpty() || !users.containsKey(user.getUserId()))
|
||||
{
|
||||
return AjaxResult.error("用户不存在");
|
||||
}
|
||||
users.remove(user.getUserId());
|
||||
return AjaxResult.success(users.put(user.getUserId(), user));
|
||||
}
|
||||
|
||||
@ApiOperation("删除用户信息")
|
||||
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
|
||||
@DeleteMapping("/{userId}")
|
||||
public AjaxResult delete(@PathVariable Integer userId)
|
||||
{
|
||||
if (!users.isEmpty() && users.containsKey(userId))
|
||||
{
|
||||
users.remove(userId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
else
|
||||
{
|
||||
return AjaxResult.error("用户不存在");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ApiModel("用户实体")
|
||||
class UserEntity
|
||||
{
|
||||
@ApiModelProperty("用户ID")
|
||||
private Integer userId;
|
||||
|
||||
@ApiModelProperty("用户名称")
|
||||
private String username;
|
||||
|
||||
@ApiModelProperty("用户密码")
|
||||
private String password;
|
||||
|
||||
@ApiModelProperty("用户手机")
|
||||
private String mobile;
|
||||
|
||||
public UserEntity()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public UserEntity(Integer userId, String username, String password, String mobile)
|
||||
{
|
||||
this.userId = userId;
|
||||
this.username = username;
|
||||
this.password = password;
|
||||
this.mobile = mobile;
|
||||
}
|
||||
|
||||
public Integer getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(Integer userId)
|
||||
{
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUsername()
|
||||
{
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username)
|
||||
{
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getPassword()
|
||||
{
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password)
|
||||
{
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getMobile()
|
||||
{
|
||||
return mobile;
|
||||
}
|
||||
|
||||
public void setMobile(String mobile)
|
||||
{
|
||||
this.mobile = mobile;
|
||||
}
|
||||
}
|
@ -0,0 +1,127 @@
|
||||
package com.jeethink.web.core.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import com.jeethink.common.config.JeeThinkConfig;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.service.ApiKey;
|
||||
import springfox.documentation.service.AuthorizationScope;
|
||||
import springfox.documentation.service.Contact;
|
||||
import springfox.documentation.service.SecurityReference;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spi.service.contexts.SecurityContext;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
|
||||
/**
|
||||
* Swagger2的接口配置
|
||||
*
|
||||
* @author jeethink
|
||||
*/
|
||||
@Configuration
|
||||
@EnableSwagger2
|
||||
public class SwaggerConfig
|
||||
{
|
||||
/** 系统基础配置 */
|
||||
@Autowired
|
||||
private JeeThinkConfig jeethinkConfig;
|
||||
|
||||
/** 是否开启swagger */
|
||||
@Value("${swagger.enabled}")
|
||||
private boolean enabled;
|
||||
|
||||
/** 设置请求的统一前缀 */
|
||||
@Value("${swagger.pathMapping}")
|
||||
private String pathMapping;
|
||||
|
||||
/**
|
||||
* 创建API
|
||||
*/
|
||||
@Bean
|
||||
public Docket createRestApi()
|
||||
{
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
// 是否启用Swagger
|
||||
.enable(enabled)
|
||||
// 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
|
||||
.apiInfo(apiInfo())
|
||||
// 设置哪些接口暴露给Swagger展示
|
||||
.select()
|
||||
// 扫描所有有注解的api,用这种方式更灵活
|
||||
.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
||||
// 扫描指定包中的swagger注解
|
||||
// .apis(RequestHandlerSelectors.basePackage("com.jeethink.project.tool.swagger"))
|
||||
// 扫描所有 .apis(RequestHandlerSelectors.any())
|
||||
.paths(PathSelectors.any())
|
||||
.build()
|
||||
/* 设置安全模式,swagger可以设置访问token */
|
||||
.securitySchemes(securitySchemes())
|
||||
.securityContexts(securityContexts())
|
||||
.pathMapping(pathMapping);
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全模式,这里指定token通过Authorization头请求头传递
|
||||
*/
|
||||
private List<ApiKey> securitySchemes()
|
||||
{
|
||||
List<ApiKey> apiKeyList = new ArrayList<ApiKey>();
|
||||
apiKeyList.add(new ApiKey("Authorization", "Authorization", "header"));
|
||||
return apiKeyList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全上下文
|
||||
*/
|
||||
private List<SecurityContext> securityContexts()
|
||||
{
|
||||
List<SecurityContext> securityContexts = new ArrayList<>();
|
||||
securityContexts.add(
|
||||
SecurityContext.builder()
|
||||
.securityReferences(defaultAuth())
|
||||
.forPaths(PathSelectors.regex("^(?!auth).*$"))
|
||||
.build());
|
||||
return securityContexts;
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认的安全上引用
|
||||
*/
|
||||
private List<SecurityReference> defaultAuth()
|
||||
{
|
||||
AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
|
||||
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
|
||||
authorizationScopes[0] = authorizationScope;
|
||||
List<SecurityReference> securityReferences = new ArrayList<>();
|
||||
securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
|
||||
return securityReferences;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加摘要信息
|
||||
*/
|
||||
private ApiInfo apiInfo()
|
||||
{
|
||||
// 用ApiInfoBuilder进行定制
|
||||
return new ApiInfoBuilder()
|
||||
// 设置标题
|
||||
.title("标题:吉想管理系统_接口文档")
|
||||
// 描述
|
||||
.description("描述:用于管理集团旗下公司的人员信息,具体包括XXX,XXX模块...")
|
||||
// 作者信息
|
||||
.contact(new Contact(jeethinkConfig.getName(), null, null))
|
||||
// 版本
|
||||
.version("版本号:" + jeethinkConfig.getVersion())
|
||||
.build();
|
||||
}
|
||||
}
|
@ -0,0 +1 @@
|
||||
restart.include.json=/com.alibaba.fastjson.*.jar
|
66
JeeThink-admin/src/main/resources/application-druid.yml
Normal file
66
JeeThink-admin/src/main/resources/application-druid.yml
Normal file
@ -0,0 +1,66 @@
|
||||
# 数据源配置
|
||||
spring:
|
||||
datasource:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
druid:
|
||||
master:
|
||||
url: jdbc:mysql://115.28.208.186:3306/ylda?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowMultiQueries=true
|
||||
username: root
|
||||
password: 12345678Aa
|
||||
# url: jdbc:mysql://127.0.0.1:3306/daglxt?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowMultiQueries=true
|
||||
# username: root
|
||||
# password: 12345678a?
|
||||
# 从库数据源
|
||||
slave:
|
||||
# 从数据源开关/默认关闭
|
||||
enabled: true
|
||||
# url: jdbc:sqlserver://10.10.10.140;databasename=H5
|
||||
# username: dangan01
|
||||
# password: dang123
|
||||
# driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
url: jdbc:sqlserver://114.215.142.201;databasename=rlxt
|
||||
username: sa
|
||||
password: 123456789z?
|
||||
driverClassName: com.microsoft.sqlserver.jdbc.SQLServerDriver
|
||||
# 从数据源开关/默认关闭
|
||||
|
||||
# 初始连接数
|
||||
initialSize: 5
|
||||
# 最小连接池数量
|
||||
minIdle: 10
|
||||
# 最大连接池数量
|
||||
maxActive: 20
|
||||
# 配置获取连接等待超时的时间
|
||||
maxWait: 60000
|
||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
||||
timeBetweenEvictionRunsMillis: 60000
|
||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
||||
minEvictableIdleTimeMillis: 300000
|
||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
||||
maxEvictableIdleTimeMillis: 900000
|
||||
# 配置检测连接是否有效
|
||||
validationQuery: SELECT 1
|
||||
testWhileIdle: true
|
||||
testOnBorrow: false
|
||||
testOnReturn: false
|
||||
webStatFilter:
|
||||
enabled: true
|
||||
statViewServlet:
|
||||
enabled: false
|
||||
# 设置白名单,不填则允许所有访问
|
||||
allow:
|
||||
url-pattern: /druid/*
|
||||
# 控制台管理用户名和密码
|
||||
login-username:
|
||||
login-password:
|
||||
filter:
|
||||
stat:
|
||||
enabled: true
|
||||
# 慢SQL记录
|
||||
log-slow-sql: true
|
||||
slow-sql-millis: 1000
|
||||
merge-sql: false
|
||||
wall:
|
||||
config:
|
||||
multi-statement-allow: true
|
126
JeeThink-admin/src/main/resources/application.yml
Normal file
126
JeeThink-admin/src/main/resources/application.yml
Normal file
@ -0,0 +1,126 @@
|
||||
# 项目相关配置
|
||||
jeethink:
|
||||
# 名称
|
||||
name: JeeThink
|
||||
# 版本
|
||||
version: 3.1.0
|
||||
# 版权年份
|
||||
copyrightYear: 2020
|
||||
# 实例演示开关
|
||||
demoEnabled: true
|
||||
# 文件路径 示例( Windows配置D:/jeethink/uploadPath,Linux配置 /home/jeethink/uploadPath)
|
||||
profile: E:/jeethink/uploadPath
|
||||
# 获取ip地址开关
|
||||
addressEnabled: false
|
||||
# 验证码类型 math 数组计算 char 字符验证
|
||||
captchaType: math
|
||||
|
||||
# 开发环境配置
|
||||
server:
|
||||
# 服务器的HTTP端口,默认为9001
|
||||
port: 9001
|
||||
servlet:
|
||||
# 应用的访问路径
|
||||
context-path: /
|
||||
tomcat:
|
||||
# tomcat的URI编码
|
||||
uri-encoding: UTF-8
|
||||
# tomcat最大线程数,默认为200
|
||||
max-threads: 800
|
||||
# Tomcat启动初始化的线程数,默认值25
|
||||
min-spare-threads: 30
|
||||
|
||||
# 日志配置
|
||||
logging:
|
||||
level:
|
||||
com.jeethink: debug
|
||||
org.springframework: warn
|
||||
|
||||
# Spring配置
|
||||
spring:
|
||||
# 资源信息
|
||||
messages:
|
||||
# 国际化资源文件路径
|
||||
basename: i18n/messages
|
||||
profiles:
|
||||
active: druid
|
||||
# 文件上传
|
||||
servlet:
|
||||
multipart:
|
||||
# 单个文件大小
|
||||
max-file-size: 100MB
|
||||
# 设置总上传的文件大小
|
||||
max-request-size: 200MB
|
||||
# 服务模块
|
||||
devtools:
|
||||
restart:
|
||||
# 热部署开关
|
||||
enabled: true
|
||||
# activiti 模块
|
||||
# 解决启动报错:class path resource [processes/] cannot be resolved to URL because it does not exist
|
||||
activiti:
|
||||
check-process-definitions: false
|
||||
# 检测身份信息表是否存在
|
||||
db-identity-used: false
|
||||
# redis 配置
|
||||
redis:
|
||||
# 地址
|
||||
host: 127.0.0.1
|
||||
# 端口,默认为6379
|
||||
port: 6379
|
||||
# 密码
|
||||
password:
|
||||
# password: 12345678a?
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
pool:
|
||||
# 连接池中的最小空闲连接
|
||||
min-idle: 0
|
||||
# 连接池中的最大空闲连接
|
||||
max-idle: 8
|
||||
# 连接池的最大数据库连接数
|
||||
max-active: 8
|
||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||
max-wait: -1ms
|
||||
|
||||
# token配置
|
||||
token:
|
||||
# 令牌自定义标识
|
||||
header: Authorization
|
||||
# 令牌密钥
|
||||
secret: abcdefghijklmnopqrstuvwxyz
|
||||
# 令牌有效期(默认30分钟)
|
||||
expireTime: 300
|
||||
|
||||
# MyBatis配置
|
||||
mybatis:
|
||||
# 搜索指定包别名
|
||||
typeAliasesPackage: com.jeethink.**.domain
|
||||
# 配置mapper的扫描,找到所有的mapper.xml映射文件
|
||||
mapperLocations: classpath*:mapper/**/*Mapper.xml
|
||||
# 加载全局的配置文件
|
||||
configLocation: classpath:mybatis/mybatis-config.xml
|
||||
|
||||
# PageHelper分页插件
|
||||
pagehelper:
|
||||
helperDialect: mysql
|
||||
reasonable: true
|
||||
supportMethodsArguments: true
|
||||
params: count=countSql
|
||||
|
||||
# Swagger配置
|
||||
swagger:
|
||||
# 是否开启swagger
|
||||
enabled: true
|
||||
# 请求前缀
|
||||
pathMapping: /dev-api
|
||||
|
||||
# 防止XSS攻击
|
||||
xss:
|
||||
# 过滤开关
|
||||
enabled: true
|
||||
# 排除链接(多个用逗号分隔)
|
||||
excludes: /system/notice/*
|
||||
# 匹配链接
|
||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
2
JeeThink-admin/src/main/resources/banner.txt
Normal file
2
JeeThink-admin/src/main/resources/banner.txt
Normal file
@ -0,0 +1,2 @@
|
||||
Application Version: ${jeethink.version}
|
||||
Spring Boot Version: ${spring-boot.version}
|
36
JeeThink-admin/src/main/resources/i18n/messages.properties
Normal file
36
JeeThink-admin/src/main/resources/i18n/messages.properties
Normal file
@ -0,0 +1,36 @@
|
||||
#错误消息
|
||||
not.null=* 必须填写
|
||||
user.jcaptcha.error=验证码错误
|
||||
user.jcaptcha.expire=验证码已失效
|
||||
user.not.exists=用户不存在/密码错误
|
||||
user.password.not.match=用户不存在/密码错误
|
||||
user.password.retry.limit.count=密码输入错误{0}次
|
||||
user.password.retry.limit.exceed=密码输入错误{0}次,帐户锁定10分钟
|
||||
user.password.delete=对不起,您的账号已被删除
|
||||
user.blocked=用户已封禁,请联系管理员
|
||||
role.blocked=角色已封禁,请联系管理员
|
||||
user.logout.success=退出成功
|
||||
|
||||
length.not.valid=长度必须在{min}到{max}个字符之间
|
||||
|
||||
user.username.not.valid=* 2到20个汉字、字母、数字或下划线组成,且必须以非数字开头
|
||||
user.password.not.valid=* 5-50个字符
|
||||
|
||||
user.email.not.valid=邮箱格式错误
|
||||
user.mobile.phone.number.not.valid=手机号格式错误
|
||||
user.login.success=登录成功
|
||||
user.notfound=请重新登录
|
||||
user.forcelogout=管理员强制退出,请重新登录
|
||||
user.unknown.error=未知错误,请重新登录
|
||||
|
||||
##文件上传消息
|
||||
upload.exceed.maxSize=上传的文件大小超出限制的文件大小!<br/>允许的文件最大大小是:{0}MB!
|
||||
upload.filename.exceed.length=上传的文件名最长{0}个字符
|
||||
|
||||
##权限
|
||||
no.permission=您没有数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.create.permission=您没有创建数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.update.permission=您没有修改数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.delete.permission=您没有删除数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.export.permission=您没有导出数据的权限,请联系管理员添加权限 [{0}]
|
||||
no.view.permission=您没有查看数据的权限,请联系管理员添加权限 [{0}]
|
93
JeeThink-admin/src/main/resources/logback.xml
Normal file
93
JeeThink-admin/src/main/resources/logback.xml
Normal file
@ -0,0 +1,93 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration>
|
||||
<!-- 日志存放路径 -->
|
||||
<property name="log.path" value="/home/jeethink/logs" />
|
||||
<!-- 日志输出格式 -->
|
||||
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
|
||||
|
||||
<!-- 控制台输出 -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统日志输出 -->
|
||||
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-info.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/sys-info.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>INFO</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-error.log</file>
|
||||
<!-- 循环政策:基于时间创建日志文件 -->
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 日志文件名格式 -->
|
||||
<fileNamePattern>${log.path}/sys-error.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.LevelFilter">
|
||||
<!-- 过滤的级别 -->
|
||||
<level>ERROR</level>
|
||||
<!-- 匹配时的操作:接收(记录) -->
|
||||
<onMatch>ACCEPT</onMatch>
|
||||
<!-- 不匹配时的操作:拒绝(不记录) -->
|
||||
<onMismatch>DENY</onMismatch>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<!-- 用户访问日志输出 -->
|
||||
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/sys-user.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
|
||||
<!-- 按天回滚 daily -->
|
||||
<fileNamePattern>${log.path}/sys-user.%d{yyyy-MM-dd}.log</fileNamePattern>
|
||||
<!-- 日志最大的历史 60天 -->
|
||||
<maxHistory>60</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- 系统模块日志级别控制 -->
|
||||
<logger name="com.jeethink" level="info" />
|
||||
<!-- Spring日志级别控制 -->
|
||||
<logger name="org.springframework" level="warn" />
|
||||
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
</root>
|
||||
|
||||
<!--系统操作日志-->
|
||||
<root level="info">
|
||||
<appender-ref ref="file_info" />
|
||||
<appender-ref ref="file_error" />
|
||||
</root>
|
||||
|
||||
<!--系统用户操作日志-->
|
||||
<logger name="sys-user" level="info">
|
||||
<appender-ref ref="sys-user"/>
|
||||
</logger>
|
||||
</configuration>
|
15
JeeThink-admin/src/main/resources/mybatis/mybatis-config.xml
Normal file
15
JeeThink-admin/src/main/resources/mybatis/mybatis-config.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE configuration
|
||||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
<configuration>
|
||||
|
||||
<settings>
|
||||
<setting name="cacheEnabled" value="true" /> <!-- 全局映射器启用缓存 -->
|
||||
<setting name="useGeneratedKeys" value="true" /> <!-- 允许 JDBC 支持自动生成主键 -->
|
||||
<setting name="defaultExecutorType" value="REUSE" /> <!-- 配置默认的执行器 -->
|
||||
<setting name="logImpl" value="SLF4J" /> <!-- 指定 MyBatis 所用日志的具体实现 -->
|
||||
<setting name="mapUnderscoreToCamelCase" value="true"/> <!--驼峰式命名-->
|
||||
</settings>
|
||||
|
||||
</configuration>
|
51
JeeThink-archives/pom.xml
Normal file
51
JeeThink-archives/pom.xml
Normal file
@ -0,0 +1,51 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>jeethink</artifactId>
|
||||
<groupId>com.jeethink</groupId>
|
||||
<version>3.1.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<description>
|
||||
archives
|
||||
</description>
|
||||
<artifactId>jeethink-archives</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-core</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
</dependency>
|
||||
<!-- 通用工具-->
|
||||
<dependency>
|
||||
<groupId>com.jeethink</groupId>
|
||||
<artifactId>jeethink-common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-annotations</artifactId>
|
||||
<version>1.5.21</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jeethink</groupId>
|
||||
<artifactId>jeethink-system</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jeethink</groupId>
|
||||
<artifactId>jeethink-framework</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>8</maven.compiler.source>
|
||||
<maven.compiler.target>8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
</project>
|
@ -0,0 +1,355 @@
|
||||
package com.jeethink.bean.domain;
|
||||
|
||||
import com.jeethink.common.annotation.Excel;
|
||||
import com.jeethink.common.core.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 人事档案接收对象 archives_master
|
||||
*
|
||||
* @author sh
|
||||
* @date 2022-11-08
|
||||
*/
|
||||
public class ArchivesMaster extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键id */
|
||||
private String archivesId;
|
||||
|
||||
/** 档案标题(职工编码+姓名,如10000001张三) */
|
||||
@Excel(name = "档案标题")
|
||||
private String name;
|
||||
|
||||
/** 档案编号(类型缩写+职工编码+人事档案类别码+四位文件序号,如RS1000000011000) */
|
||||
@Excel(name = "档案编号")
|
||||
private String archiveNo;
|
||||
|
||||
/** 档案类型(0人事档案,1健康档案,2培训档案) */
|
||||
@Excel(name = "档案类别", readConverterExp = "0=人事档案,1=健康档案,2=培训档案")
|
||||
private String type;
|
||||
|
||||
/** 档案人员类别 */
|
||||
@Excel(name = "档案人员类别", readConverterExp = "0=管理人员,1=专业技术人员,2=员工")
|
||||
private String peopleType;
|
||||
|
||||
/** 层级 */
|
||||
@Excel(name = "层级", readConverterExp = "0=案卷级")
|
||||
private String tier;
|
||||
|
||||
/** 密级 */
|
||||
@Excel(name = "密级", readConverterExp = "0=绝密,1=机密,2=秘密")
|
||||
private String classified;
|
||||
|
||||
/** 保管期限 */
|
||||
@Excel(name = "保管期限", readConverterExp = "0=永久,1=30年,2=20年,3=10年")
|
||||
private String duration;
|
||||
|
||||
/** 是否为纸质档案(0是,1否) */
|
||||
private String ifPaper;
|
||||
|
||||
/** 归档人ID */
|
||||
private Long gdPeopleId;
|
||||
|
||||
/** 对应用户的id */
|
||||
private Long userId;
|
||||
|
||||
/** 创建用户 */
|
||||
private Long createUser;
|
||||
|
||||
/** 更新用户 */
|
||||
private Long updateUser;
|
||||
|
||||
private String nowStatus;
|
||||
/** 逻辑删除字段,是否删除 ,0为是,1为否 */
|
||||
private String deleted;
|
||||
|
||||
@Excel(name = "员工姓名")
|
||||
private String nickName;
|
||||
@Excel(name = "员工编号")
|
||||
private String userNumber;
|
||||
|
||||
private Long deptId;
|
||||
private String deptName;
|
||||
|
||||
private String updaterName;
|
||||
|
||||
private Integer expire; //剩余过期天数
|
||||
private String stage; //所处阶段:recevie接收,destroy销毁
|
||||
private Boolean isBorrowed;
|
||||
|
||||
private String warehouseType;//所在仓库
|
||||
|
||||
@Excel(name = "检查医院")
|
||||
private String checkHospital;
|
||||
@Excel(name = "检查结论")
|
||||
private String checkConclusion;
|
||||
@Excel(name = "检查日期")
|
||||
private Date checkDate;
|
||||
@Excel(name = "检查年份")
|
||||
private String jkFileDate;
|
||||
|
||||
public String getJkFileDate() {
|
||||
return jkFileDate;
|
||||
}
|
||||
|
||||
public void setJkFileDate(String jkFileDate) {
|
||||
this.jkFileDate = jkFileDate;
|
||||
}
|
||||
|
||||
public String getCheckHospital() {
|
||||
return checkHospital;
|
||||
}
|
||||
|
||||
public void setCheckHospital(String checkHospital) {
|
||||
this.checkHospital = checkHospital;
|
||||
}
|
||||
|
||||
public String getCheckConclusion() {
|
||||
return checkConclusion;
|
||||
}
|
||||
|
||||
public void setCheckConclusion(String checkConclusion) {
|
||||
this.checkConclusion = checkConclusion;
|
||||
}
|
||||
|
||||
public Date getCheckDate() {
|
||||
return checkDate;
|
||||
}
|
||||
|
||||
public void setCheckDate(Date checkDate) {
|
||||
this.checkDate = checkDate;
|
||||
}
|
||||
|
||||
public String getUserNumber() {
|
||||
return userNumber;
|
||||
}
|
||||
|
||||
public void setUserNumber(String userNumber) {
|
||||
this.userNumber = userNumber;
|
||||
}
|
||||
|
||||
public void setArchivesId(String archivesId)
|
||||
{
|
||||
this.archivesId = archivesId;
|
||||
}
|
||||
|
||||
public String getArchivesId()
|
||||
{
|
||||
return archivesId;
|
||||
}
|
||||
public void setName(String name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
public void setArchiveNo(String archiveNo)
|
||||
{
|
||||
this.archiveNo = archiveNo;
|
||||
}
|
||||
|
||||
public String getArchiveNo()
|
||||
{
|
||||
return archiveNo;
|
||||
}
|
||||
public void setType(String type)
|
||||
{
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getType()
|
||||
{
|
||||
return type;
|
||||
}
|
||||
public void setPeopleType(String peopleType)
|
||||
{
|
||||
this.peopleType = peopleType;
|
||||
}
|
||||
|
||||
public String getPeopleType()
|
||||
{
|
||||
return peopleType;
|
||||
}
|
||||
public void setTier(String tier)
|
||||
{
|
||||
this.tier = tier;
|
||||
}
|
||||
|
||||
public String getTier()
|
||||
{
|
||||
return tier;
|
||||
}
|
||||
public void setClassified(String classified)
|
||||
{
|
||||
this.classified = classified;
|
||||
}
|
||||
|
||||
public String getClassified()
|
||||
{
|
||||
return classified;
|
||||
}
|
||||
public void setDuration(String duration)
|
||||
{
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public String getDuration()
|
||||
{
|
||||
return duration;
|
||||
}
|
||||
public void setIfPaper(String ifPaper)
|
||||
{
|
||||
this.ifPaper = ifPaper;
|
||||
}
|
||||
|
||||
public String getIfPaper()
|
||||
{
|
||||
return ifPaper;
|
||||
}
|
||||
public void setGdPeopleId(Long gdPeopleId)
|
||||
{
|
||||
this.gdPeopleId = gdPeopleId;
|
||||
}
|
||||
|
||||
public Long getGdPeopleId()
|
||||
{
|
||||
return gdPeopleId;
|
||||
}
|
||||
|
||||
public Long getUserId()
|
||||
{
|
||||
return userId;
|
||||
}
|
||||
public void setCreateUser(Long createUser)
|
||||
{
|
||||
this.createUser = createUser;
|
||||
}
|
||||
|
||||
public Long getCreateUser()
|
||||
{
|
||||
return createUser;
|
||||
}
|
||||
public void setUpdateUser(Long updateUser)
|
||||
{
|
||||
this.updateUser = updateUser;
|
||||
}
|
||||
|
||||
public Long getUpdateUser()
|
||||
{
|
||||
return updateUser;
|
||||
}
|
||||
public void setDeleted(String deleted)
|
||||
{
|
||||
this.deleted = deleted;
|
||||
}
|
||||
|
||||
public String getDeleted()
|
||||
{
|
||||
return deleted;
|
||||
}
|
||||
|
||||
public Long getDeptId() {
|
||||
return deptId;
|
||||
}
|
||||
|
||||
public void setDeptId(Long deptId) {
|
||||
this.deptId = deptId;
|
||||
}
|
||||
|
||||
public String getNickName() {
|
||||
return nickName;
|
||||
}
|
||||
|
||||
public void setNickName(String nickName) {
|
||||
this.nickName = nickName;
|
||||
}
|
||||
|
||||
public String getDeptName() {
|
||||
return deptName;
|
||||
}
|
||||
|
||||
public void setDeptName(String deptName) {
|
||||
this.deptName = deptName;
|
||||
}
|
||||
|
||||
public String getNowStatus() {
|
||||
return nowStatus;
|
||||
}
|
||||
|
||||
public void setNowStatus(String nowStatus) {
|
||||
this.nowStatus = nowStatus;
|
||||
}
|
||||
|
||||
public void setUserId(Long userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUpdaterName() {
|
||||
return updaterName;
|
||||
}
|
||||
|
||||
public void setUpdaterName(String updaterName) {
|
||||
this.updaterName = updaterName;
|
||||
}
|
||||
|
||||
public Integer getExpire() {
|
||||
return expire;
|
||||
}
|
||||
|
||||
public void setExpire(Integer expire) {
|
||||
this.expire = expire;
|
||||
}
|
||||
|
||||
public String getStage() {
|
||||
return stage;
|
||||
}
|
||||
|
||||
public void setStage(String stage) {
|
||||
this.stage = stage;
|
||||
}
|
||||
|
||||
public Boolean getIsBorrowed() {
|
||||
return isBorrowed;
|
||||
}
|
||||
|
||||
public void setIsBorrowed(Boolean isBorrowed) {
|
||||
this.isBorrowed = isBorrowed;
|
||||
}
|
||||
|
||||
public String getWarehouseType() {
|
||||
return warehouseType;
|
||||
}
|
||||
|
||||
public void setWarehouseType(String warehouseType) {
|
||||
this.warehouseType = warehouseType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("archivesId", getArchivesId())
|
||||
.append("name", getName())
|
||||
.append("archiveNo", getArchiveNo())
|
||||
.append("type", getType())
|
||||
.append("peopleType", getPeopleType())
|
||||
.append("tier", getTier())
|
||||
.append("classified", getClassified())
|
||||
.append("duration", getDuration())
|
||||
.append("ifPaper", getIfPaper())
|
||||
.append("gdPeopleId", getGdPeopleId())
|
||||
.append("userId", getUserId())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("createUser", getCreateUser())
|
||||
.append("updateUser", getUpdateUser())
|
||||
.append("deleted", getDeleted())
|
||||
.toString();
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.jeethink.bean.vo;
|
||||
|
||||
public class Approval {
|
||||
|
||||
//档案ID
|
||||
private String objectId;
|
||||
//状态:pass:通过,reject:不通过
|
||||
private String status;
|
||||
//备注,不通过的理由
|
||||
private String remark;
|
||||
|
||||
public String getObjectId() {
|
||||
return objectId;
|
||||
}
|
||||
|
||||
public void setObjectId(String objectId) {
|
||||
this.objectId = objectId;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
}
|
@ -0,0 +1,207 @@
|
||||
package com.jeethink.dataCenter.controller;
|
||||
|
||||
import com.jeethink.common.constant.Constants;
|
||||
import com.jeethink.common.constant.UserConstants;
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.utils.SecurityUtils;
|
||||
import com.jeethink.common.utils.StringUtils;
|
||||
import com.jeethink.dataCenter.domain.Warehouse;
|
||||
import com.jeethink.dataCenter.service.IWarehouseService;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 库房信息
|
||||
*
|
||||
* @author wms
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/datacenter/warehouse")
|
||||
public class WarehouseController extends BaseController
|
||||
{
|
||||
|
||||
@Autowired
|
||||
private IWarehouseService warehouseService;
|
||||
|
||||
/**
|
||||
* 获取库房列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('datacenter:warehouse:list')")
|
||||
@GetMapping("/list")
|
||||
public AjaxResult list(Warehouse warehouse)
|
||||
{
|
||||
|
||||
List<Warehouse> warehouseList = warehouseService.selectWarehouseList(warehouse);
|
||||
return AjaxResult.success(warehouseList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询库房树数据
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('datacenter:warehouse:list')")
|
||||
@GetMapping("/tree")
|
||||
public AjaxResult tree()
|
||||
{
|
||||
List<Warehouse> list = warehouseService.selectWarehouseList(new Warehouse());
|
||||
Iterator<Warehouse> it = list.iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
Warehouse wh = it.next();
|
||||
if (wh.getLevel() >= Constants.WAREHOUSE_LEVEL_MAX) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询库房树数据(排除节点)
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('datacenter:warehouse:list')")
|
||||
@GetMapping("/tree/exclude/{id}")
|
||||
public AjaxResult excludeChild(@PathVariable(value = "id", required = false) Long id)
|
||||
{
|
||||
Warehouse warehouse = warehouseService.selectWarehouseById(id);
|
||||
List<Warehouse> warehouseList = warehouseService.selectWarehouseList(new Warehouse());
|
||||
Iterator<Warehouse> it = warehouseList.listIterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
Warehouse wh = it.next();
|
||||
if (wh.getId().intValue() == id
|
||||
|| ArrayUtils.contains(StringUtils.split(wh.getAncestors(), ","), id + "")
|
||||
|| wh.getLevel() >= Constants.WAREHOUSE_LEVEL_MAX)
|
||||
{
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
return AjaxResult.success(warehouseList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据主键获取详情
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('datacenter:warehouse:query')")
|
||||
@GetMapping("/{id}")
|
||||
public AjaxResult getInfo(@PathVariable Long id)
|
||||
{
|
||||
return AjaxResult.success(warehouseService.selectWarehouseById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增库房
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('datacenter:warehouse:add')")
|
||||
@PostMapping
|
||||
public AjaxResult add(@Validated @RequestBody Warehouse warehouse)
|
||||
{
|
||||
if (StringUtils.isNotNull(warehouse.getRelaUser()))
|
||||
{
|
||||
if (warehouse.getLevel() < Constants.WAREHOUSE_LEVEL_MAX)//层级为4(档案卷)才能关联人
|
||||
{
|
||||
return AjaxResult.error("新增库房“" + warehouse.getName() + "”失败,该等级不能关联人员");
|
||||
}
|
||||
else
|
||||
{
|
||||
List<Warehouse> list = warehouseService.selectWarehouseByRelaUser(warehouse.getRelaUser());
|
||||
if (list.size() > 0) {
|
||||
return AjaxResult.error("新增库房“" + warehouse.getName() + "”失败,关联人员已与“"+list.get(0).getName()+"”关联");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
warehouse.setCreateBy(SecurityUtils.getUsername());
|
||||
warehouse.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(warehouseService.insertWarehouse(warehouse));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改库房
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('datacenter:warehouse:edit')")
|
||||
@PutMapping
|
||||
public AjaxResult edit(@Validated @RequestBody Warehouse warehouse)
|
||||
{
|
||||
if (StringUtils.isNotNull(warehouse.getRelaUser()))
|
||||
{
|
||||
if (warehouse.getLevel() < Constants.WAREHOUSE_LEVEL_MAX)//层级为4(档案卷)才能关联人
|
||||
{
|
||||
return AjaxResult.error("修改库房“" + warehouse.getName() + "”失败,该等级不能关联人员");
|
||||
}
|
||||
else
|
||||
{
|
||||
List<Warehouse> list = warehouseService.selectWarehouseByRelaUser(warehouse.getRelaUser());
|
||||
if (list.size() > 1) {
|
||||
return AjaxResult.error("修改库房“" + warehouse.getName() + "”失败,关联人员已与其他库房关联");
|
||||
}
|
||||
if (list.size() > 0 && !list.get(0).getId().equals(warehouse.getId())) {
|
||||
return AjaxResult.error("修改库房“" + warehouse.getName() + "”失败,关联人员已与“"+list.get(0).getName()+"”关联");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (warehouse.getParentId().equals(warehouse.getId()))
|
||||
{
|
||||
return AjaxResult.error("修改库房'" + warehouse.getName() + "'失败,上级库房不能是自己");
|
||||
}
|
||||
else if (StringUtils.equals(UserConstants.DEPT_DISABLE, warehouse.getStatus())
|
||||
&& warehouseService.selectNormalChildrenById(warehouse.getId()) > 0)
|
||||
{
|
||||
return AjaxResult.error("该库房包含未停用的子库房!");
|
||||
}
|
||||
warehouse.setUpdateBy(SecurityUtils.getUsername());
|
||||
return toAjax(warehouseService.updateWarehouse(warehouse));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除库房
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('datacenter:warehouse:remove')")
|
||||
@DeleteMapping("/{id}")
|
||||
public AjaxResult remove(@PathVariable Long id)
|
||||
{
|
||||
if (warehouseService.hasChildById(id))
|
||||
{
|
||||
return AjaxResult.error("存在下级库房,不允许删除");
|
||||
}
|
||||
return toAjax(warehouseService.deleteWarehouseById(id));
|
||||
}
|
||||
|
||||
@PostMapping("/realArchives")
|
||||
public AjaxResult realArchives(@Validated @RequestBody HashMap hashMap){
|
||||
List<String> list = (List<String>) hashMap.get("list");
|
||||
Long id = Long.valueOf((Integer) hashMap.get("id"));
|
||||
String ancestorsId = (String) hashMap.get("ancestorsId");
|
||||
int i = 0;
|
||||
warehouseService.deleteArchives(id);
|
||||
if(list.size()>0){
|
||||
for(String archivesId : list){
|
||||
String name=warehouseService.selectArchivesById(archivesId);
|
||||
Warehouse warehouse = new Warehouse();
|
||||
warehouse.setParentId(id);
|
||||
warehouse.setArchivesId(archivesId);
|
||||
warehouse.setAncestors(ancestorsId);
|
||||
warehouse.setCreateBy(SecurityUtils.getUsername());
|
||||
warehouse.setUpdateBy(SecurityUtils.getUsername());
|
||||
warehouse.setLevel(5);
|
||||
warehouse.setStatus("0");
|
||||
warehouse.setOrderNum(i);
|
||||
warehouse.setName(name);
|
||||
warehouseService.insertWarehouse(warehouse);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
@GetMapping("/selectArchives/{parentId}")
|
||||
public AjaxResult selectArchives(@PathVariable Long parentId)
|
||||
{
|
||||
return AjaxResult.success(warehouseService.selectArchivesByParentId(parentId));
|
||||
}
|
||||
}
|
@ -0,0 +1,171 @@
|
||||
package com.jeethink.dataCenter.domain;
|
||||
|
||||
import com.jeethink.common.core.domain.BaseEntity;
|
||||
|
||||
public class Warehouse extends BaseEntity {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 库房ID */
|
||||
private Long id;
|
||||
|
||||
/** 库房名 */
|
||||
private String name;
|
||||
|
||||
/** 祖籍列表 */
|
||||
private String ancestors;
|
||||
|
||||
/** 层级:0:库,1:室,2:架,3:层,4:卷;最高4级 */
|
||||
private Integer level;
|
||||
/** 父库房 */
|
||||
private Long parentId;
|
||||
/** 描述 */
|
||||
private String description;
|
||||
/** 状态:0正常,1停用 */
|
||||
private String status;
|
||||
/** 关联人员:只有层级为4时,才可有值 */
|
||||
private Long relaUser;
|
||||
/** 排序 */
|
||||
private Integer orderNum;
|
||||
|
||||
/** 关联人员名 */
|
||||
private String relaUserName;
|
||||
|
||||
//所有父级名称
|
||||
private String parentsName;
|
||||
|
||||
private String wlh;
|
||||
private String lwz;
|
||||
private String ch;
|
||||
private String jh;
|
||||
|
||||
private String archivesId;
|
||||
|
||||
public String getArchivesId() {
|
||||
return archivesId;
|
||||
}
|
||||
|
||||
public void setArchivesId(String archivesId) {
|
||||
this.archivesId = archivesId;
|
||||
}
|
||||
|
||||
public String getWlh() {
|
||||
return wlh;
|
||||
}
|
||||
|
||||
public void setWlh(String wlh) {
|
||||
this.wlh = wlh;
|
||||
}
|
||||
|
||||
public String getLwz() {
|
||||
return lwz;
|
||||
}
|
||||
|
||||
public void setLwz(String lwz) {
|
||||
this.lwz = lwz;
|
||||
}
|
||||
|
||||
public String getCh() {
|
||||
return ch;
|
||||
}
|
||||
|
||||
public void setCh(String ch) {
|
||||
this.ch = ch;
|
||||
}
|
||||
|
||||
public String getJh() {
|
||||
return jh;
|
||||
}
|
||||
|
||||
public void setJh(String jh) {
|
||||
this.jh = jh;
|
||||
}
|
||||
|
||||
public String getParentsName() {
|
||||
return parentsName;
|
||||
}
|
||||
|
||||
public void setParentsName(String parentsName) {
|
||||
this.parentsName = parentsName;
|
||||
}
|
||||
|
||||
public Long getRelaUser() {
|
||||
return relaUser;
|
||||
}
|
||||
|
||||
public void setRelaUser(Long relaUser) {
|
||||
this.relaUser = relaUser;
|
||||
}
|
||||
|
||||
public String getRelaUserName() {
|
||||
return relaUserName;
|
||||
}
|
||||
|
||||
public void setRelaUserName(String relaUserName) {
|
||||
this.relaUserName = relaUserName;
|
||||
}
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public Integer getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
public void setLevel(Integer level) {
|
||||
this.level = level;
|
||||
}
|
||||
|
||||
public Long getParentId() {
|
||||
return parentId;
|
||||
}
|
||||
|
||||
public void setParentId(Long parentId) {
|
||||
this.parentId = parentId;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Integer getOrderNum() {
|
||||
return orderNum;
|
||||
}
|
||||
|
||||
public void setOrderNum(Integer orderNum) {
|
||||
this.orderNum = orderNum;
|
||||
}
|
||||
|
||||
public String getAncestors() {
|
||||
return ancestors;
|
||||
}
|
||||
|
||||
public void setAncestors(String ancestors) {
|
||||
this.ancestors = ancestors;
|
||||
}
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package com.jeethink.dataCenter.mapper;
|
||||
|
||||
import com.jeethink.dataCenter.domain.Warehouse;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 库房Mapper接口
|
||||
*
|
||||
* @author wms
|
||||
*/
|
||||
public interface WarehouseMapper {
|
||||
|
||||
/**
|
||||
* 查询库房数据
|
||||
*
|
||||
* @param warehouse 库房信息
|
||||
* @return 库房信息集合
|
||||
*/
|
||||
List<Warehouse> selectWarehouseList(Warehouse warehouse);
|
||||
|
||||
/**
|
||||
* 根据库房ID查询信息
|
||||
*
|
||||
* @param id 库房ID
|
||||
* @return 库房信息
|
||||
*/
|
||||
Warehouse selectWarehouseById(Long id);
|
||||
|
||||
/**
|
||||
* 校验库房名称是否唯一
|
||||
*
|
||||
* @param name 库房名称
|
||||
* @param parentId 父库房ID
|
||||
* @return 信息
|
||||
*/
|
||||
Warehouse checkNameUnique(@Param("name") String name, @Param("parentId") Long parentId);
|
||||
|
||||
/**
|
||||
* 新增库房信息
|
||||
*
|
||||
* @param warehouse 库房信息
|
||||
* @return 结果
|
||||
*/
|
||||
int insertWarehouse(Warehouse warehouse);
|
||||
|
||||
/**
|
||||
* 根据ID查询所有正常状态的所有子库房
|
||||
*
|
||||
* @param id 库房ID
|
||||
* @return 子库房数
|
||||
*/
|
||||
int selectNormalChildrenById(Long id);
|
||||
|
||||
/**
|
||||
* 修改库房信息
|
||||
*
|
||||
* @param warehouse 库房信息
|
||||
* @return 结果
|
||||
*/
|
||||
int updateWarehouse(Warehouse warehouse);
|
||||
|
||||
/**
|
||||
* 获取ID子库房集合
|
||||
*
|
||||
* @param id 库房ID
|
||||
* @return 子库房合集
|
||||
*/
|
||||
List<Warehouse> getChildList(Long id);
|
||||
|
||||
/**
|
||||
* 删除库房信息
|
||||
*
|
||||
* @param id 库房ID
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteWarehouseById(Long id);
|
||||
|
||||
/**
|
||||
* 根据关联人员查找库房
|
||||
*
|
||||
* @param relaUser 关联人员
|
||||
* @return 库房合集 (原则上只有1个)
|
||||
*/
|
||||
List<Warehouse> selectWarehouseByRelaUser(Long relaUser);
|
||||
|
||||
void deleteArchives(Long id);
|
||||
|
||||
String selectArchivesById(String archivesId);
|
||||
|
||||
List<String> selectArchivesByParentId(Long parentId);
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
package com.jeethink.dataCenter.service;
|
||||
|
||||
import com.jeethink.dataCenter.domain.Warehouse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 库房管理 服务层
|
||||
*
|
||||
* @author wms
|
||||
*/
|
||||
public interface IWarehouseService
|
||||
{
|
||||
|
||||
/**
|
||||
* 查询库房管理数据
|
||||
*
|
||||
* @param warehouse 库房信息
|
||||
* @return 库房信息合集
|
||||
*/
|
||||
public List<Warehouse> selectWarehouseList(Warehouse warehouse);
|
||||
|
||||
/**
|
||||
* 根据ID查询信息
|
||||
*
|
||||
* @param id 库房ID
|
||||
* @return 库房信息
|
||||
*/
|
||||
public Warehouse selectWarehouseById(Long id);
|
||||
|
||||
/**
|
||||
* 校验库房名称是否唯一
|
||||
*
|
||||
* @param warehouse 库房信息
|
||||
* @return 结果
|
||||
*/
|
||||
public String checkNameUnique(Warehouse warehouse);
|
||||
|
||||
/**
|
||||
* 新增库房信息
|
||||
*
|
||||
* @param warehouse 库房信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertWarehouse(Warehouse warehouse);
|
||||
|
||||
/**
|
||||
* 根据ID查询所有正常状态的子库房数
|
||||
*
|
||||
* @param id 库房ID
|
||||
* @return 子库房数
|
||||
*/
|
||||
public int selectNormalChildrenById(Long id);
|
||||
|
||||
/**
|
||||
* 修改库房信息
|
||||
*
|
||||
* @param warehouse 库房信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateWarehouse(Warehouse warehouse);
|
||||
|
||||
/**
|
||||
* 是否存在子库房
|
||||
*
|
||||
* @param id 库房ID
|
||||
* @return 结果
|
||||
*/
|
||||
public boolean hasChildById(Long id);
|
||||
|
||||
/**
|
||||
* 删除库房信息
|
||||
*
|
||||
* @param id 库房ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteWarehouseById(Long id);
|
||||
|
||||
/**
|
||||
* 根据关联人员查找库房
|
||||
*
|
||||
* @param relaUser 关联人员
|
||||
* @return 库房合集 (原则上只有1个)
|
||||
*/
|
||||
List<Warehouse> selectWarehouseByRelaUser(Long relaUser);
|
||||
|
||||
void deleteArchives(Long id);
|
||||
|
||||
String selectArchivesById(String archivesId);
|
||||
|
||||
List<String> selectArchivesByParentId(Long parentId);
|
||||
}
|
@ -0,0 +1,176 @@
|
||||
package com.jeethink.dataCenter.service.impl;
|
||||
|
||||
import com.jeethink.common.constant.UserConstants;
|
||||
import com.jeethink.common.exception.CustomException;
|
||||
import com.jeethink.common.utils.DateUtils;
|
||||
import com.jeethink.common.utils.StringUtils;
|
||||
import com.jeethink.dataCenter.domain.Warehouse;
|
||||
import com.jeethink.dataCenter.mapper.WarehouseMapper;
|
||||
import com.jeethink.dataCenter.service.IWarehouseService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 库房管理 服务层
|
||||
*
|
||||
* @author wms
|
||||
*/
|
||||
@Service
|
||||
public class WarehouseServiceImpl implements IWarehouseService
|
||||
{
|
||||
|
||||
@Autowired
|
||||
private WarehouseMapper warehouseMapper;
|
||||
|
||||
/**
|
||||
* 查询库房管理数据
|
||||
*
|
||||
* @param warehouse 库房信息
|
||||
* @return 库房信息合集
|
||||
*/
|
||||
@Override
|
||||
public List<Warehouse> selectWarehouseList(Warehouse warehouse)
|
||||
{
|
||||
List<Warehouse> warehouseList=warehouseMapper.selectWarehouseList(warehouse);
|
||||
for (int i=0;i<warehouseList.size();i++){
|
||||
String [] ids=warehouseList.get(i).getAncestors().split(",");
|
||||
String parentsName="";
|
||||
for (int j=0;j<ids.length;j++){
|
||||
Warehouse warehouse1=warehouseMapper.selectWarehouseById(Long.valueOf(ids[j]));
|
||||
if(warehouse1!=null){
|
||||
parentsName+=warehouse1.getName()+",";
|
||||
}
|
||||
}
|
||||
if (parentsName.length()>0){
|
||||
warehouseList.get(i).setParentsName(parentsName.substring(0,parentsName.length()-1));
|
||||
}else {
|
||||
warehouseList.get(i).setParentsName(parentsName);
|
||||
}
|
||||
}
|
||||
return warehouseList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询信息
|
||||
*
|
||||
* @param id 库房ID
|
||||
* @return 库房信息
|
||||
*/
|
||||
@Override
|
||||
public Warehouse selectWarehouseById(Long id)
|
||||
{
|
||||
return warehouseMapper.selectWarehouseById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验库房名称是否唯一
|
||||
*
|
||||
* @param warehouse 库房信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public String checkNameUnique(Warehouse warehouse)
|
||||
{
|
||||
Long id = StringUtils.isNull(warehouse.getId()) ? -1L : warehouse.getId();
|
||||
Warehouse info = warehouseMapper.checkNameUnique(warehouse.getName(), warehouse.getParentId());
|
||||
if (StringUtils.isNotNull(info) && info.getId().longValue() != id.longValue())
|
||||
{
|
||||
return UserConstants.NOT_UNIQUE;
|
||||
}
|
||||
return UserConstants.UNIQUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增库房信息
|
||||
*
|
||||
* @param warehouse 库房信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertWarehouse(Warehouse warehouse)
|
||||
{
|
||||
Warehouse info = warehouseMapper.selectWarehouseById(warehouse.getParentId());
|
||||
if (!UserConstants.DEPT_NORMAL.equals(warehouse.getStatus()))
|
||||
{
|
||||
throw new CustomException("库房停用, 不允许新增");
|
||||
}
|
||||
return warehouseMapper.insertWarehouse(warehouse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询所有正常状态的子库房数
|
||||
*
|
||||
* @param id 库房ID
|
||||
* @return 子库房数
|
||||
*/
|
||||
@Override
|
||||
public int selectNormalChildrenById(Long id)
|
||||
{
|
||||
|
||||
return warehouseMapper.selectNormalChildrenById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改库房信息
|
||||
*
|
||||
* @param warehouse 库房信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateWarehouse(Warehouse warehouse)
|
||||
{
|
||||
return warehouseMapper.updateWarehouse(warehouse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否存在子库房
|
||||
*
|
||||
* @param id 库房ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public boolean hasChildById(Long id)
|
||||
{
|
||||
return warehouseMapper.getChildList(id).size() > 0 ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除库房信息
|
||||
*
|
||||
* @param id 库房ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteWarehouseById(Long id) {
|
||||
return warehouseMapper.deleteWarehouseById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据关联人员查找库房
|
||||
*
|
||||
* @param relaUser 关联人员
|
||||
* @return 库房合集 (原则上只有1个)
|
||||
*/
|
||||
@Override
|
||||
public List<Warehouse> selectWarehouseByRelaUser(Long relaUser) {
|
||||
|
||||
return warehouseMapper.selectWarehouseByRelaUser(relaUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteArchives(Long id) {
|
||||
warehouseMapper.deleteArchives(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String selectArchivesById(String archivesId) {
|
||||
return warehouseMapper.selectArchivesById(archivesId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> selectArchivesByParentId(Long parentId) {
|
||||
return warehouseMapper.selectArchivesByParentId(parentId);
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.jeethink.flow.controller;
|
||||
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.flow.service.IFlowService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/flow")
|
||||
public class FlowController {
|
||||
|
||||
@Autowired
|
||||
private IFlowService flowService;
|
||||
|
||||
@RequestMapping("/step/{flowType}")
|
||||
public AjaxResult getFlowStep(@PathVariable("flowType") String flowType) {
|
||||
|
||||
return AjaxResult.success(flowService.selectStepsByFlowType(flowType));
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package com.jeethink.flow.domain;
|
||||
|
||||
|
||||
import com.jeethink.common.core.domain.BaseEntity;
|
||||
|
||||
public class Flow extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String flowId;
|
||||
private String objectId;
|
||||
private String flowType;
|
||||
private Integer stepNum;
|
||||
private String flowStatus;
|
||||
|
||||
private String createByName;
|
||||
private String updateByName;
|
||||
|
||||
|
||||
public String getFlowId() {
|
||||
return flowId;
|
||||
}
|
||||
|
||||
public void setFlowId(String flowId) {
|
||||
this.flowId = flowId;
|
||||
}
|
||||
|
||||
|
||||
public String getObjectId() {
|
||||
return objectId;
|
||||
}
|
||||
|
||||
public void setObjectId(String objectId) {
|
||||
this.objectId = objectId;
|
||||
}
|
||||
|
||||
public String getFlowType() {
|
||||
return flowType;
|
||||
}
|
||||
|
||||
public void setFlowType(String flowType) {
|
||||
this.flowType = flowType;
|
||||
}
|
||||
|
||||
public Integer getStepNum() {
|
||||
return stepNum;
|
||||
}
|
||||
|
||||
public void setStepNum(Integer stepNum) {
|
||||
this.stepNum = stepNum;
|
||||
}
|
||||
|
||||
public String getFlowStatus() {
|
||||
return flowStatus;
|
||||
}
|
||||
|
||||
public void setFlowStatus(String flowStatus) {
|
||||
this.flowStatus = flowStatus;
|
||||
}
|
||||
|
||||
public String getCreateByName() {
|
||||
return createByName;
|
||||
}
|
||||
|
||||
public void setCreateByName(String createByName) {
|
||||
this.createByName = createByName;
|
||||
}
|
||||
|
||||
public String getUpdateByName() {
|
||||
return updateByName;
|
||||
}
|
||||
|
||||
public void setUpdateByName(String updateByName) {
|
||||
this.updateByName = updateByName;
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package com.jeethink.flow.domain;
|
||||
|
||||
|
||||
import com.jeethink.common.core.domain.BaseEntity;
|
||||
|
||||
public class FlowRecord extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String recordId;
|
||||
private String flowId;
|
||||
private Integer stepNum;
|
||||
private String status;
|
||||
|
||||
private String createByName;
|
||||
|
||||
public String getRecordId() {
|
||||
return recordId;
|
||||
}
|
||||
|
||||
public void setRecordId(String recordId) {
|
||||
this.recordId = recordId;
|
||||
}
|
||||
|
||||
public String getFlowId() {
|
||||
return flowId;
|
||||
}
|
||||
|
||||
public void setFlowId(String flowId) {
|
||||
this.flowId = flowId;
|
||||
}
|
||||
|
||||
public Integer getStepNum() {
|
||||
return stepNum;
|
||||
}
|
||||
|
||||
public void setStepNum(Integer stepNum) {
|
||||
this.stepNum = stepNum;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getCreateByName() {
|
||||
return createByName;
|
||||
}
|
||||
|
||||
public void setCreateByName(String createByName) {
|
||||
this.createByName = createByName;
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package com.jeethink.flow.domain;
|
||||
|
||||
import com.jeethink.common.core.domain.BaseEntity;
|
||||
|
||||
public class FlowStep extends BaseEntity {
|
||||
|
||||
private Long stepId;
|
||||
private String flowType;
|
||||
private String stepName;
|
||||
private Integer stepNum;
|
||||
|
||||
public Long getStepId() {
|
||||
return stepId;
|
||||
}
|
||||
|
||||
public void setStepId(Long stepId) {
|
||||
this.stepId = stepId;
|
||||
}
|
||||
|
||||
public String getFlowType() {
|
||||
return flowType;
|
||||
}
|
||||
|
||||
public void setFlowType(String flowType) {
|
||||
this.flowType = flowType;
|
||||
}
|
||||
|
||||
public String getStepName() {
|
||||
return stepName;
|
||||
}
|
||||
|
||||
public void setStepName(String stepName) {
|
||||
this.stepName = stepName;
|
||||
}
|
||||
|
||||
public Integer getStepNum() {
|
||||
return stepNum;
|
||||
}
|
||||
|
||||
public void setStepNum(Integer stepNum) {
|
||||
this.stepNum = stepNum;
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.jeethink.flow.mapper;
|
||||
|
||||
import com.jeethink.flow.domain.Flow;
|
||||
import com.jeethink.flow.domain.FlowRecord;
|
||||
import com.jeethink.flow.domain.FlowStep;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface FlowMapper {
|
||||
|
||||
void insertFlow(Flow flow);
|
||||
|
||||
Flow selectFlowByObjectIdAndFlowType(@Param("objectId") String objectId, @Param("flowType") String flowType);
|
||||
|
||||
void updateFlow(Flow flow);
|
||||
|
||||
void changeStatusByObjectIdAndFlowType(Flow flow);
|
||||
|
||||
List<FlowRecord> selectRecordByObjectIdAndFlowType(@Param("objectId") String objectId, @Param("flowType") String flowType);
|
||||
|
||||
void insertRecord(FlowRecord record);
|
||||
|
||||
List<FlowStep> selectStepsByFlowType(String flowType);
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.jeethink.flow.service;
|
||||
|
||||
import com.jeethink.flow.domain.FlowRecord;
|
||||
import com.jeethink.flow.domain.FlowStep;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IFlowService {
|
||||
|
||||
void insertFlow(String objectId, String flowType);
|
||||
|
||||
void updateFlow(String objectId, String flowType, String status, String remark);
|
||||
|
||||
void finishFlow(String objectId, String flowType);
|
||||
|
||||
void destroyFlow(String objectId, String flowType);
|
||||
|
||||
List<FlowRecord> selectRecord(String objectId, String flowType);
|
||||
|
||||
List<FlowStep> selectStepsByFlowType(String flowType);
|
||||
}
|
@ -0,0 +1,140 @@
|
||||
package com.jeethink.flow.service.impl;
|
||||
|
||||
import com.jeethink.common.constant.Constants;
|
||||
import com.jeethink.common.utils.SecurityUtils;
|
||||
import com.jeethink.common.utils.uuid.IdUtils;
|
||||
import com.jeethink.flow.domain.Flow;
|
||||
import com.jeethink.flow.domain.FlowRecord;
|
||||
import com.jeethink.flow.domain.FlowStep;
|
||||
import com.jeethink.flow.mapper.FlowMapper;
|
||||
import com.jeethink.flow.service.IFlowService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class FlowServiceImpl implements IFlowService {
|
||||
|
||||
@Autowired
|
||||
private FlowMapper flowMapper;
|
||||
|
||||
/**
|
||||
* 插入新流程
|
||||
* @param objectId
|
||||
* @param flowType
|
||||
*/
|
||||
@Override
|
||||
public void insertFlow(String objectId, String flowType) {
|
||||
|
||||
Flow flow = new Flow();
|
||||
String flowId = IdUtils.simpleUUID();
|
||||
flow.setFlowId(flowId);
|
||||
flow.setObjectId(objectId);
|
||||
flow.setFlowType(flowType);
|
||||
flow.setFlowStatus(Constants.FLOW_STATUS_UNDERWAY);
|
||||
flow.setStepNum(1);
|
||||
flow.setCreateBy(SecurityUtils.getUsername());
|
||||
flowMapper.insertFlow(flow);
|
||||
|
||||
insertRecord(flowId, 1, Constants.APPROVE_PASS, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新流程进度
|
||||
* @param objectId
|
||||
* @param flowType
|
||||
* @param status
|
||||
* @param remark
|
||||
*/
|
||||
@Override
|
||||
public void updateFlow(String objectId, String flowType, String status, String remark) {
|
||||
|
||||
Flow flow = flowMapper.selectFlowByObjectIdAndFlowType(objectId, flowType);
|
||||
if (flow != null) {
|
||||
Integer stepNum = flow.getStepNum() + 1;
|
||||
flow.setStepNum(stepNum);
|
||||
flow.setUpdateBy(SecurityUtils.getUsername());
|
||||
flowMapper.updateFlow(flow);
|
||||
|
||||
insertRecord(flow.getFlowId(), stepNum, status, remark);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成流程
|
||||
* @param objectId
|
||||
* @param flowType
|
||||
*/
|
||||
@Override
|
||||
public void finishFlow(String objectId, String flowType) {
|
||||
|
||||
Flow flow = new Flow();
|
||||
flow.setObjectId(objectId);
|
||||
flow.setFlowType(flowType);
|
||||
flow.setFlowStatus(Constants.FLOW_STATUS_FINISH);
|
||||
flow.setUpdateBy(SecurityUtils.getUsername());
|
||||
flowMapper.changeStatusByObjectIdAndFlowType(flow);
|
||||
}
|
||||
|
||||
/**
|
||||
* 废弃流程
|
||||
* @param objectId
|
||||
* @param flowType
|
||||
*/
|
||||
@Override
|
||||
public void destroyFlow(String objectId, String flowType) {
|
||||
|
||||
|
||||
|
||||
Flow flow = new Flow();
|
||||
flow.setObjectId(objectId);
|
||||
flow.setFlowType(flowType);
|
||||
flow.setFlowStatus(Constants.FLOW_STATUS_DESTROY);
|
||||
flow.setUpdateBy(SecurityUtils.getUsername());
|
||||
flowMapper.changeStatusByObjectIdAndFlowType(flow);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询流程详情
|
||||
* @param objectId
|
||||
* @param flowType
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<FlowRecord> selectRecord(String objectId, String flowType) {
|
||||
|
||||
return flowMapper.selectRecordByObjectIdAndFlowType(objectId, flowType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过流程流程获取流程步骤
|
||||
* @param flowType
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<FlowStep> selectStepsByFlowType(String flowType) {
|
||||
|
||||
return flowMapper.selectStepsByFlowType(flowType);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 插入流程详情
|
||||
* @param flowId
|
||||
* @param stepNum
|
||||
* @param status
|
||||
* @param remark
|
||||
*/
|
||||
private void insertRecord(String flowId, Integer stepNum, String status, String remark) {
|
||||
|
||||
FlowRecord record = new FlowRecord();
|
||||
record.setRecordId(IdUtils.simpleUUID());
|
||||
record.setFlowId(flowId);
|
||||
record.setStepNum(stepNum);
|
||||
record.setStatus(status);
|
||||
record.setRemark(remark);
|
||||
record.setCreateBy(SecurityUtils.getUsername());
|
||||
flowMapper.insertRecord(record);
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.jeethink.manage.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jeethink.bean.domain.ArchivesMaster;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.jeethink.common.annotation.Log;
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.enums.BusinessType;
|
||||
import com.jeethink.manage.service.IAuthenticateService;
|
||||
import com.jeethink.common.utils.poi.ExcelUtil;
|
||||
import com.jeethink.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 价值鉴定Controller
|
||||
*
|
||||
* @author zjt
|
||||
* @date 2022-11-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/manage/authenticate")
|
||||
public class AuthenticateController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IAuthenticateService service;
|
||||
/**
|
||||
* 查询价值鉴定列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('manage:authenticate:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ArchivesMaster archives)
|
||||
{
|
||||
startPage();
|
||||
List<ArchivesMaster> list = service.selectAuthenticateList(archives);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出价值鉴定列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('manage:authenticate:export')")
|
||||
@Log(title = "价值鉴定", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(ArchivesMaster archives)
|
||||
{
|
||||
List<ArchivesMaster> list = service.selectAuthenticateList(archives);
|
||||
ExcelUtil<ArchivesMaster> util = new ExcelUtil<ArchivesMaster>(ArchivesMaster.class);
|
||||
return util.exportExcel(list, "authenticate");
|
||||
}
|
||||
|
||||
@PreAuthorize(("@ss.hasPermi('manage:authenticate:postpone')"))
|
||||
@Log(title = "档案延期", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/postpone")
|
||||
public AjaxResult postpone(@RequestBody ArchivesMaster archives) {
|
||||
|
||||
service.postponeArchives(archives);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
package com.jeethink.manage.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jeethink.bean.domain.ArchivesMaster;
|
||||
import com.jeethink.bean.vo.Approval;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.jeethink.common.annotation.Log;
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.enums.BusinessType;
|
||||
import com.jeethink.manage.service.IDestroyService;
|
||||
import com.jeethink.common.utils.poi.ExcelUtil;
|
||||
import com.jeethink.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 销毁清册Controller
|
||||
*
|
||||
* @author zjt
|
||||
* @date 2022-11-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/manage/destroy")
|
||||
public class DestroyController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IDestroyService service;
|
||||
|
||||
/**
|
||||
* 申请销毁
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('manage:destroy:add')")
|
||||
@GetMapping
|
||||
public AjaxResult apply(@RequestParam String archivesId)
|
||||
{
|
||||
service.applyDestroy(archivesId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('manage:destroy:revocation')")
|
||||
@GetMapping("/revocation")
|
||||
public AjaxResult revocation(@RequestParam String archivesId) {
|
||||
|
||||
service.revocationDestroy(archivesId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
/**
|
||||
* 查询待销毁列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('manage:destroy:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ArchivesMaster archiveDestroy)
|
||||
{
|
||||
startPage();
|
||||
List<ArchivesMaster> list = service.selectDestroyList(archiveDestroy);
|
||||
return getDataTable(list);
|
||||
};
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('manage:destroy:query')")
|
||||
@GetMapping("/archives")
|
||||
public AjaxResult getArchives(@RequestParam String archivesId) {
|
||||
|
||||
return AjaxResult.success(service.seelectArchivesById(archivesId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出销毁清册列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('manage:destroy:export')")
|
||||
@Log(title = "销毁清册", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(ArchivesMaster archiveDestroy)
|
||||
{
|
||||
List<ArchivesMaster> list = service.selectDestroyList(archiveDestroy);
|
||||
ExcelUtil<ArchivesMaster> util = new ExcelUtil<ArchivesMaster>(ArchivesMaster.class);
|
||||
return util.exportExcel(list, "destroy");
|
||||
}
|
||||
|
||||
/**
|
||||
* 审核销毁清册
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('manage:destroy:approval')")
|
||||
@PutMapping("/approval")
|
||||
public AjaxResult check(@RequestBody Approval approval)
|
||||
{
|
||||
service.approvalDestroy(approval);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
package com.jeethink.manage.controller;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.jeethink.bean.domain.ArchivesMaster;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.jeethink.common.annotation.Log;
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.enums.BusinessType;
|
||||
import com.jeethink.manage.service.ISearchService;
|
||||
import com.jeethink.common.utils.poi.ExcelUtil;
|
||||
import com.jeethink.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 档案检索Controller
|
||||
*
|
||||
* @author sh
|
||||
* @date 2022-11-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/manage/search")
|
||||
public class SearchController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private ISearchService service;
|
||||
|
||||
/**
|
||||
* 查询档案检索列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('manage:search:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ArchivesMaster archives)
|
||||
{
|
||||
startPage();
|
||||
List<ArchivesMaster> list = service.selectSearchList(archives);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('manage:search:query')")
|
||||
@GetMapping("/{archivesId}")
|
||||
public AjaxResult getInfo(@PathVariable("archivesId") String archivesId) {
|
||||
|
||||
return AjaxResult.success(service.selectArchivesById(archivesId));
|
||||
}
|
||||
|
||||
//查询附件
|
||||
@GetMapping("/exportFile/{archivesId}")
|
||||
public AjaxResult getFileInfo(@PathVariable("archivesId") String archivesId) {
|
||||
|
||||
return AjaxResult.success(service.selectArchivesFileById(archivesId));
|
||||
}
|
||||
/**
|
||||
* 导出档案检索列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('manage:search:export')")
|
||||
@Log(title = "档案检索", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(ArchivesMaster archives)
|
||||
{
|
||||
List<ArchivesMaster> list = service.selectSearchList(archives);
|
||||
ExcelUtil<ArchivesMaster> util = new ExcelUtil<ArchivesMaster>(ArchivesMaster.class);
|
||||
return util.exportExcel(list, "search");
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package com.jeethink.manage.controller;
|
||||
|
||||
import com.jeethink.bean.domain.ArchivesMaster;
|
||||
import com.jeethink.common.constant.Constants;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.core.page.TableDataInfo;
|
||||
import com.jeethink.receive.service.IArchivesService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 档案整理Controller
|
||||
*
|
||||
* @author zjt
|
||||
* @date 2022-11-10
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/manage/tidy")
|
||||
public class TidyController extends BaseController
|
||||
{
|
||||
|
||||
@Autowired
|
||||
private IArchivesService service;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ArchivesMaster archives) {
|
||||
|
||||
startPage();
|
||||
archives.setNowStatus(Constants.ARCHIVES_STATUS_RK);
|
||||
List<ArchivesMaster> list = service.selectArchivesList(archives);
|
||||
return getDataTable(list);
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.jeethink.manage.service;
|
||||
|
||||
import com.jeethink.bean.domain.ArchivesMaster;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 价值鉴定Service接口
|
||||
*
|
||||
* @author zjt
|
||||
* @date 2022-11-10
|
||||
*/
|
||||
public interface IAuthenticateService
|
||||
{
|
||||
|
||||
/**
|
||||
* 查询价值鉴定列表
|
||||
*
|
||||
* @param archiveAuthenticate 价值鉴定
|
||||
* @return 价值鉴定集合
|
||||
*/
|
||||
public List<ArchivesMaster> selectAuthenticateList(ArchivesMaster archiveAuthenticate);
|
||||
|
||||
/**
|
||||
* 档案延期
|
||||
* @param archives
|
||||
*/
|
||||
void postponeArchives(ArchivesMaster archives);
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.jeethink.manage.service;
|
||||
|
||||
import com.jeethink.bean.domain.ArchivesMaster;
|
||||
import com.jeethink.bean.vo.Approval;
|
||||
import com.jeethink.receive.vo.ArchivesVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 销毁清册Service接口
|
||||
*
|
||||
* @author zjt
|
||||
* @date 2022-11-10
|
||||
*/
|
||||
public interface IDestroyService
|
||||
{
|
||||
/**
|
||||
* 查询销毁清册列表
|
||||
*
|
||||
* @param archives 销毁清册
|
||||
* @return 销毁清册集合
|
||||
*/
|
||||
List<ArchivesMaster> selectDestroyList(ArchivesMaster archives);
|
||||
|
||||
void applyDestroy(String archivesId);
|
||||
|
||||
void approvalDestroy(Approval approval);
|
||||
|
||||
ArchivesVO seelectArchivesById(String archivesId);
|
||||
|
||||
void revocationDestroy(String archivesId);
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.jeethink.manage.service;
|
||||
|
||||
import com.jeethink.bean.domain.ArchivesMaster;
|
||||
import com.jeethink.receive.vo.ArchivesVO;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 档案检索Service接口
|
||||
*
|
||||
* @author sh
|
||||
* @date 2022-11-10
|
||||
*/
|
||||
public interface ISearchService
|
||||
{
|
||||
|
||||
/**
|
||||
* 查询档案检索列表
|
||||
*
|
||||
* @param archives 档案检索
|
||||
* @return 档案检索集合
|
||||
*/
|
||||
List<ArchivesMaster> selectSearchList(ArchivesMaster archives);
|
||||
|
||||
ArchivesVO selectArchivesById(String archivesId);
|
||||
|
||||
List<HashMap> selectArchivesFileById(String archivesId);
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.jeethink.manage.service;
|
||||
|
||||
import com.jeethink.bean.domain.ArchivesMaster;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 档案整理Service接口
|
||||
*
|
||||
* @author zjt
|
||||
* @date 2022-11-10
|
||||
*/
|
||||
public interface ITidyService
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package com.jeethink.manage.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jeethink.bean.domain.ArchivesMaster;
|
||||
import com.jeethink.common.utils.SecurityUtils;
|
||||
import com.jeethink.receive.mapper.ArchivesMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.jeethink.manage.service.IAuthenticateService;
|
||||
|
||||
/**
|
||||
* 价值鉴定Service业务层处理
|
||||
*
|
||||
* @author zjt
|
||||
* @date 2022-11-10
|
||||
*/
|
||||
@Service
|
||||
public class AuthenticateServiceImpl implements IAuthenticateService
|
||||
{
|
||||
@Autowired
|
||||
private ArchivesMapper archivesMapper;
|
||||
|
||||
/**
|
||||
* 查询价值鉴定列表
|
||||
*
|
||||
* @param archives 价值鉴定
|
||||
* @return 价值鉴定
|
||||
*/
|
||||
@Override
|
||||
public List<ArchivesMaster> selectAuthenticateList(ArchivesMaster archives)
|
||||
{
|
||||
return archivesMapper.selectExpireArchivesList(archives);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postponeArchives(ArchivesMaster archives) {
|
||||
|
||||
archives.setUpdateUser(SecurityUtils.getUserId());
|
||||
archivesMapper.postponeArchives(archives);
|
||||
}
|
||||
}
|
@ -0,0 +1,108 @@
|
||||
package com.jeethink.manage.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.jeethink.bean.domain.ArchivesMaster;
|
||||
import com.jeethink.bean.vo.Approval;
|
||||
import com.jeethink.receive.mapper.ArchivesMapper;
|
||||
import com.jeethink.common.constant.Constants;
|
||||
import com.jeethink.common.exception.CustomException;
|
||||
import com.jeethink.common.utils.SecurityUtils;
|
||||
import com.jeethink.flow.service.IFlowService;
|
||||
import com.jeethink.receive.service.IArchivesService;
|
||||
import com.jeethink.receive.vo.ArchivesVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.jeethink.manage.service.IDestroyService;
|
||||
|
||||
/**
|
||||
* 销毁清册Service业务层处理
|
||||
*
|
||||
* @author zjt
|
||||
* @date 2022-11-10
|
||||
*/
|
||||
@Service
|
||||
public class DestroyServiceImpl implements IDestroyService
|
||||
{
|
||||
@Autowired
|
||||
private IArchivesService archivesService;
|
||||
|
||||
@Autowired
|
||||
private IFlowService flowService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询销毁清册列表
|
||||
*
|
||||
* @param archive 销毁清册
|
||||
* @return 销毁清册
|
||||
*/
|
||||
@Override
|
||||
public List<ArchivesMaster> selectDestroyList(ArchivesMaster archive)
|
||||
{
|
||||
String userType = SecurityUtils.getLoginUser().getUser().getUserType();
|
||||
List<ArchivesMaster> list = new ArrayList<>();
|
||||
if (Constants.USER_TYPE_ZG.equals(userType)) {
|
||||
archive.setNowStatus(Constants.ARCHIVES_STATUS_DESTROY_APPLY);
|
||||
list = archivesService.selectArchivesList(archive);
|
||||
} else if (Constants.USER_TYPE_BZ.equals(userType)) {
|
||||
archive.setNowStatus(Constants.ARCHIVES_STATUS_DESTROY_APPROVE);
|
||||
list = archivesService.selectArchivesList(archive);
|
||||
} else {
|
||||
archive.setStage(Constants.ARCHIVES_STAGE_DESTROY);
|
||||
list = archivesService.selectArchivesList(archive);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyDestroy(String archivesId) {
|
||||
|
||||
ArchivesMaster archives = archivesService.selectById(archivesId);
|
||||
if (!Constants.ARCHIVES_STATUS_RK.equals(archives.getNowStatus())
|
||||
&& !Constants.ARCHIVES_STATUS_DESTROY_REJECT.equals(archives.getNowStatus())) {
|
||||
throw new CustomException("该档案当前不能申请销毁");
|
||||
}
|
||||
if (Constants.ARCHIVES_STATUS_DESTROY_REJECT.equals(archives.getNowStatus())) {
|
||||
//审批未通过,再次提交申请时,需要将上次的审批详情废弃
|
||||
flowService.destroyFlow(archivesId, Constants.FLOW_TYPE_DESTROY);
|
||||
}
|
||||
archivesService.changeNowStatus(archivesId, Constants.ARCHIVES_STATUS_DESTROY_APPLY);
|
||||
flowService.insertFlow(archivesId, Constants.FLOW_TYPE_DESTROY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void approvalDestroy(Approval approval) {
|
||||
String userType = SecurityUtils.getLoginUser().getUser().getUserType();
|
||||
if (!Constants.USER_TYPE_ZG.equals(userType) && !Constants.USER_TYPE_BZ.equals(userType)) {
|
||||
throw new CustomException("您没有审核权限");
|
||||
}
|
||||
String archivesId = approval.getObjectId();
|
||||
if (Constants.APPROVE_PASS.equals(approval.getStatus())) {
|
||||
String nowStatus = Constants.USER_TYPE_BZ.equals(userType)? Constants.ARCHIVES_STATUS_DESTROY_WAIT: Constants.ARCHIVES_STATUS_DESTROY_APPROVE;
|
||||
archivesService.changeNowStatus(archivesId, nowStatus);
|
||||
} else {
|
||||
archivesService.changeNowStatus(archivesId, Constants.ARCHIVES_STATUS_DESTROY_REJECT);
|
||||
}
|
||||
flowService.updateFlow(archivesId, Constants.FLOW_TYPE_DESTROY, approval.getStatus(), approval.getRemark());
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArchivesVO seelectArchivesById(String archivesId) {
|
||||
|
||||
return archivesService.selectArchivesById(archivesId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void revocationDestroy(String archivesId) {
|
||||
|
||||
ArchivesMaster master = archivesService.selectById(archivesId);
|
||||
if (!Constants.ARCHIVES_STATUS_DESTROY_APPLY.equals(master.getNowStatus())
|
||||
&& !Constants.ARCHIVES_STATUS_DESTROY_REJECT.equals(master.getNowStatus())) {
|
||||
throw new CustomException("该档案当前不能撤销注销申请");
|
||||
}
|
||||
archivesService.changeNowStatus(archivesId, Constants.ARCHIVES_STATUS_RK);
|
||||
flowService.destroyFlow(archivesId, Constants.FLOW_TYPE_DESTROY);
|
||||
}
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
package com.jeethink.manage.service.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import com.jeethink.bean.domain.ArchivesMaster;
|
||||
import com.jeethink.common.constant.Constants;
|
||||
import com.jeethink.receive.service.IArchivesService;
|
||||
import com.jeethink.receive.vo.ArchivesVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.jeethink.manage.service.ISearchService;
|
||||
|
||||
/**
|
||||
* 档案检索Service业务层处理
|
||||
*
|
||||
* @author sh
|
||||
* @date 2022-11-10
|
||||
*/
|
||||
@Service
|
||||
public class SearchServiceImpl implements ISearchService
|
||||
{
|
||||
@Autowired
|
||||
private IArchivesService archivesService;
|
||||
|
||||
/**
|
||||
* 查询档案检索列表
|
||||
*
|
||||
* @param archives 档案检索
|
||||
* @return 档案检索
|
||||
*/
|
||||
@Override
|
||||
public List<ArchivesMaster> selectSearchList(ArchivesMaster archives)
|
||||
{
|
||||
archives.setNowStatus(Constants.ARCHIVES_STATUS_RK);
|
||||
return archivesService.selectArchivesList(archives);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArchivesVO selectArchivesById(String archivesId) {
|
||||
|
||||
return archivesService.selectArchivesById(archivesId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<HashMap> selectArchivesFileById(String archivesId) {
|
||||
return archivesService.selectArchivesFileById(archivesId);
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.jeethink.manage.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jeethink.bean.domain.ArchivesMaster;
|
||||
import com.jeethink.common.utils.DateUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.jeethink.manage.service.ITidyService;
|
||||
|
||||
/**
|
||||
* 档案整理Service业务层处理
|
||||
*
|
||||
* @author zjt
|
||||
* @date 2022-11-10
|
||||
*/
|
||||
@Service
|
||||
public class TidyServiceImpl implements ITidyService
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package com.jeethink.receive.controller;
|
||||
|
||||
import com.jeethink.bean.domain.ArchivesMaster;
|
||||
import com.jeethink.common.annotation.Log;
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.core.page.TableDataInfo;
|
||||
import com.jeethink.common.enums.BusinessType;
|
||||
import com.jeethink.common.utils.poi.ExcelUtil;
|
||||
import com.jeethink.receive.service.IArchivesApprovalService;
|
||||
import com.jeethink.bean.vo.Approval;
|
||||
import com.jeethink.receive.vo.ArchivesVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 档案接收Controller
|
||||
*
|
||||
* @author sh
|
||||
* @date 2022-11-08
|
||||
*/
|
||||
@Api("档案审批")
|
||||
@RestController
|
||||
@RequestMapping("/receive/approval")
|
||||
public class ArchivesApprovalController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IArchivesApprovalService approvalService;
|
||||
|
||||
/**
|
||||
* 查询档案接收列表
|
||||
*/
|
||||
@ApiOperation("档案审批页面list列表")
|
||||
@PreAuthorize("@ss.hasPermi('receive:approval:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ArchivesMaster archive)
|
||||
{
|
||||
startPage();
|
||||
List<ArchivesMaster> list = approvalService.selectApprovalList(archive);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('receive:approval:query')")
|
||||
@GetMapping
|
||||
public AjaxResult getInfo(@RequestParam String archivesId) {
|
||||
|
||||
ArchivesVO archivesVO = approvalService.getArchives(archivesId);
|
||||
return AjaxResult.success(archivesVO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 审批
|
||||
*
|
||||
* @author wms
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('receive:approval:check')")
|
||||
@Log(title = "档案接收", businessType = BusinessType.UPDATE)
|
||||
@PostMapping
|
||||
public AjaxResult edit(@RequestBody Approval approval)
|
||||
{
|
||||
approvalService.approvalArchive(approval);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出档案接收列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('receive:approval:export')")
|
||||
@Log(title = "档案接收", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public AjaxResult export(ArchivesMaster rsArchive)
|
||||
{
|
||||
List<ArchivesMaster> list = approvalService.selectApprovalList(rsArchive);
|
||||
ExcelUtil<ArchivesMaster> util = new ExcelUtil<ArchivesMaster>(ArchivesMaster.class);
|
||||
return util.exportExcel(list, "rsReceive");
|
||||
}
|
||||
}
|
@ -0,0 +1,132 @@
|
||||
package com.jeethink.receive.controller;
|
||||
|
||||
import com.jeethink.bean.domain.ArchivesMaster;
|
||||
import com.jeethink.common.annotation.Log;
|
||||
import com.jeethink.common.constant.Constants;
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.core.domain.model.LoginUser;
|
||||
import com.jeethink.common.core.page.TableDataInfo;
|
||||
import com.jeethink.common.enums.BusinessType;
|
||||
import com.jeethink.common.utils.ServletUtils;
|
||||
import com.jeethink.common.utils.poi.ExcelUtil;
|
||||
import com.jeethink.receive.service.IArchivesService;
|
||||
import com.jeethink.receive.vo.ArchivesVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 健康档案接收Controller
|
||||
*
|
||||
* @author sh
|
||||
* @date 2022-11-08
|
||||
*/
|
||||
@Api("健康档案接收")
|
||||
@RestController
|
||||
@RequestMapping("/receive/jkReceive")
|
||||
public class JkArchivesController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IArchivesService service;
|
||||
|
||||
/**
|
||||
* 查询健康档案接收列表
|
||||
*/
|
||||
@ApiOperation("健康档案接收页面list列表")
|
||||
@PreAuthorize("@ss.hasPermi('receive:jkReceive:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ArchivesMaster archives) {
|
||||
|
||||
startPage();
|
||||
archives.setType(Constants.ARCHIVES_TYPE_JK);
|
||||
archives.setStage(Constants.ARCHIVES_STAGE_RECEIVE);
|
||||
List<ArchivesMaster> list = service.selectArchivesList(archives);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取健康档案接收详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('receive:jkReceive:query')")
|
||||
@GetMapping
|
||||
public AjaxResult getInfo(@RequestParam String archivesId) {
|
||||
|
||||
return AjaxResult.success(service.selectArchivesById(archivesId));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('receive:jkReceive:add')")
|
||||
@Log(title = "健康档案接收", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ArchivesVO archives) {
|
||||
|
||||
archives.setType(Constants.ARCHIVES_TYPE_JK);
|
||||
service.insertArchives(archives);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('receive:jkReceive:edit')")
|
||||
@Log(title = "健康档案接收", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult update(@RequestBody ArchivesVO archives) {
|
||||
|
||||
service.updateArchives(archives);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('receive:jkReceive:submit')")
|
||||
@Log(title = "健康档案接收", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/submit")
|
||||
public AjaxResult submit(@RequestBody ArchivesVO archives) {
|
||||
|
||||
service.submitArchives(archives);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('receive:jkReceive:remove')")
|
||||
@Log(title = "健康档案接收", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{archivesId}")
|
||||
public AjaxResult remove(@PathVariable("archivesId") String archivesId) {
|
||||
|
||||
return toAjax(service.removeArchives(archivesId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出健康档案接收列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('receive:jkReceive:export')")
|
||||
@Log(title = "健康档案接收", businessType = BusinessType.EXPORT)
|
||||
@GetMapping("/export")
|
||||
public AjaxResult export(ArchivesMaster archives) {
|
||||
archives.setType(Constants.ARCHIVES_TYPE_JK);
|
||||
archives.setStage(Constants.ARCHIVES_STAGE_RECEIVE);
|
||||
List<ArchivesMaster> list = service.selectArchivesList(archives);
|
||||
ExcelUtil<ArchivesMaster> util = new ExcelUtil<ArchivesMaster>(ArchivesMaster.class);
|
||||
return util.exportExcel(list, "rsReceive");
|
||||
}
|
||||
|
||||
@Log(title = "档案导入", businessType = BusinessType.IMPORT)
|
||||
@PreAuthorize("@ss.hasPermi('receive:jkReceive:import')")
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
||||
{
|
||||
ExcelUtil<ArchivesMaster> util = new ExcelUtil<ArchivesMaster>(ArchivesMaster.class);
|
||||
List<ArchivesMaster> archivesMasterList = util.importExcel(file.getInputStream());
|
||||
String message = service.importArchives2(archivesMasterList, updateSupport);
|
||||
return AjaxResult.success(message);
|
||||
}
|
||||
/**
|
||||
* 批量导入附件并与主表关联
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/uploadArchiveList")
|
||||
public AjaxResult uploadArchiveList(){
|
||||
service.uploadArchiveFileList();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
@ -0,0 +1,196 @@
|
||||
package com.jeethink.receive.controller;
|
||||
|
||||
import com.jeethink.bean.domain.ArchivesMaster;
|
||||
import com.jeethink.common.annotation.Log;
|
||||
import com.jeethink.common.constant.Constants;
|
||||
import com.jeethink.common.core.controller.BaseController;
|
||||
import com.jeethink.common.core.domain.AjaxResult;
|
||||
import com.jeethink.common.core.domain.entity.SysUser;
|
||||
import com.jeethink.common.core.domain.model.LoginUser;
|
||||
import com.jeethink.common.core.page.TableDataInfo;
|
||||
import com.jeethink.common.enums.BusinessType;
|
||||
import com.jeethink.common.utils.DateUtils;
|
||||
import com.jeethink.common.utils.SecurityUtils;
|
||||
import com.jeethink.common.utils.ServletUtils;
|
||||
import com.jeethink.common.utils.StringUtils;
|
||||
import com.jeethink.common.utils.file.FileDownLoad;
|
||||
import com.jeethink.common.utils.poi.ExcelUtil;
|
||||
import com.jeethink.common.utils.uuid.IdUtils;
|
||||
import com.jeethink.receive.service.IArchivesService;
|
||||
import com.jeethink.receive.vo.ArchivesVO;
|
||||
import com.jeethink.system.domain.SystemFile;
|
||||
import com.jeethink.system.service.ISystemFileService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.tomcat.util.bcel.Const;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 人事档案接收Controller
|
||||
*
|
||||
* @author sh
|
||||
* @date 2022-11-08
|
||||
*/
|
||||
@Api("人事档案接收")
|
||||
@RestController
|
||||
@RequestMapping("/receive/rsReceive")
|
||||
public class RsArchivesController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IArchivesService service;
|
||||
@Autowired
|
||||
private ISystemFileService systemFileService;
|
||||
|
||||
/**
|
||||
* 查询人事档案接收列表
|
||||
*/
|
||||
@ApiOperation("人事档案接收页面list列表")
|
||||
@PreAuthorize("@ss.hasPermi('receive:rsReceive:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ArchivesMaster archives) {
|
||||
|
||||
startPage();
|
||||
archives.setType(Constants.ARCHIVES_TYPE_RS);
|
||||
archives.setStage(Constants.ARCHIVES_STAGE_RECEIVE);
|
||||
List<ArchivesMaster> list = service.selectArchivesList(archives);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取人事档案接收详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('receive:rsReceive:query')")
|
||||
@GetMapping
|
||||
public AjaxResult getInfo(@RequestParam String archivesId) {
|
||||
|
||||
return AjaxResult.success(service.selectArchivesById(archivesId));
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('receive:rsReceive:add')")
|
||||
@Log(title = "人事档案接收", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody ArchivesVO archives) {
|
||||
|
||||
archives.setType(Constants.ARCHIVES_TYPE_RS);
|
||||
service.insertArchives(archives);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('receive:rsReceive:edit')")
|
||||
@Log(title = "人事档案接收", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult update(@RequestBody ArchivesVO archives) {
|
||||
|
||||
service.updateArchives(archives);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('receive:rsReceive:submit')")
|
||||
@Log(title = "人事档案接收", businessType = BusinessType.OTHER)
|
||||
@PostMapping("/submit")
|
||||
public AjaxResult submit(@RequestBody ArchivesVO archives) {
|
||||
|
||||
service.submitArchives(archives);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('receive:rsReceive:revocation')")
|
||||
@Log(title = "人事档案接收", businessType = BusinessType.OTHER)
|
||||
@GetMapping("/revocation")
|
||||
public AjaxResult revocation(@RequestParam String archivesId) {
|
||||
|
||||
service.revocationArchives(archivesId);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@PreAuthorize("@ss.hasPermi('receive:rsReceive:remove')")
|
||||
@Log(title = "人事档案接收", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{archivesId}")
|
||||
public AjaxResult remove(@PathVariable("archivesId") String archivesId) {
|
||||
|
||||
return toAjax(service.removeArchives(archivesId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出人事档案接收列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('receive:rsReceive:export')")
|
||||
@Log(title = "人事档案接收", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public AjaxResult export(@RequestBody ArchivesMaster archives) {
|
||||
archives.setType(Constants.ARCHIVES_TYPE_RS);
|
||||
archives.setStage(Constants.ARCHIVES_STAGE_RECEIVE);
|
||||
List<ArchivesMaster> list = service.selectArchivesList(archives);
|
||||
ExcelUtil<ArchivesMaster> util = new ExcelUtil<ArchivesMaster>(ArchivesMaster.class);
|
||||
return util.exportExcel(list, "rsReceive");
|
||||
}
|
||||
|
||||
@Log(title = "档案导入", businessType = BusinessType.IMPORT)
|
||||
@PreAuthorize("@ss.hasPermi('receive:rsReceive:import')")
|
||||
@PostMapping("/importData")
|
||||
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception
|
||||
{
|
||||
ExcelUtil<ArchivesMaster> util = new ExcelUtil<ArchivesMaster>(ArchivesMaster.class);
|
||||
List<ArchivesMaster> archivesMasterList = util.importExcel(file.getInputStream());
|
||||
String message = service.importArchives(archivesMasterList, updateSupport);
|
||||
return AjaxResult.success(message);
|
||||
}
|
||||
/**
|
||||
* 批量导入附件并与主表关联
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/uploadArchiveList")
|
||||
public AjaxResult uploadArchiveList(){
|
||||
service.uploadArchiveFileList();
|
||||
return AjaxResult.success();
|
||||
}
|
||||
@GetMapping("/importTemplate")
|
||||
public AjaxResult importTemplate()
|
||||
{
|
||||
ExcelUtil<ArchivesMaster> util = new ExcelUtil<ArchivesMaster>(ArchivesMaster.class);
|
||||
return util.importTemplateExcel("档案模板");
|
||||
}
|
||||
|
||||
/**
|
||||
* 与朗新接口对接获取年度工资表数据(URL、人员编号、文件类型、文件大小)
|
||||
* @param salaryList
|
||||
*/
|
||||
@ApiOperation("年度工资单")
|
||||
@PostMapping("/salary")
|
||||
@CrossOrigin(origins = "*")
|
||||
public AjaxResult rsSalary(@RequestBody List<HashMap> salaryList){
|
||||
for(int i=0;i<salaryList.size();i++){
|
||||
String fileUrl= (String) salaryList.get(i).get("fileUrl");
|
||||
String userNumber= (String) salaryList.get(i).get("userNumber");
|
||||
String type= (String) salaryList.get(i).get("type");
|
||||
int fileSize= (int) salaryList.get(i).get("fileSize");
|
||||
String fileName = fileUrl.substring(fileUrl.lastIndexOf("/")+1);
|
||||
String filePath = "E:\\jeethink\\uploadPath\\uploadFiles\\archives\\person\\"+userNumber+"\\"+type;
|
||||
File file = FileDownLoad.saveUrlAs(fileUrl, filePath,fileName ,"GET");
|
||||
String fileObjectId = service.selectArchiveFileId(userNumber,type);
|
||||
if(StringUtils.isNotNull(fileObjectId)){
|
||||
SystemFile systemFile = new SystemFile();
|
||||
systemFile.setFileId(IdUtils.simpleUUID());
|
||||
systemFile.setFileObjectId(fileObjectId);
|
||||
systemFile.setFileSize((long) fileSize);
|
||||
systemFile.setFileName(fileName.split("\\.")[0]);
|
||||
systemFile.setFileSuffix(fileName.split("\\.")[1]);
|
||||
systemFile.setFilePath(filePath);
|
||||
String fileUrl2 = "http://10.10.10.141:9001/profile/uploadFiles/archives/person/"+userNumber+"/"+type+"/"+fileName;
|
||||
systemFile.setFileUrl(fileUrl2);
|
||||
systemFile.setFileDeleteType(Constants.DELETED_NO);
|
||||
systemFile.setFileCreateTime(DateUtils.getNowDate());
|
||||
systemFileService.insertSystemFile(systemFile);
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,134 @@
|
||||
package com.jeethink.receive.domain;
|
||||
|
||||
|
||||
import com.jeethink.common.core.domain.BaseEntity;
|
||||
import com.jeethink.system.domain.SystemFile;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public class ArchivesFile extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String archivesFileId;
|
||||
private String rsFileType;
|
||||
private String jkFileDate;
|
||||
private String checkHospital;
|
||||
private String checkConclusion;
|
||||
private Date checkDate;
|
||||
private String archivesId;
|
||||
private Date createTime;
|
||||
private Date updateTime;
|
||||
private long createUser;
|
||||
private long updateUser;
|
||||
private String deleted;
|
||||
|
||||
private List<SystemFile> fileList;
|
||||
|
||||
public String getArchivesFileId() {
|
||||
return archivesFileId;
|
||||
}
|
||||
|
||||
public void setArchivesFileId(String archivesFileId) {
|
||||
this.archivesFileId = archivesFileId;
|
||||
}
|
||||
|
||||
public String getRsFileType() {
|
||||
return rsFileType;
|
||||
}
|
||||
|
||||
public void setRsFileType(String rsFileType) {
|
||||
this.rsFileType = rsFileType;
|
||||
}
|
||||
|
||||
public String getJkFileDate() {
|
||||
return jkFileDate;
|
||||
}
|
||||
|
||||
public void setJkFileDate(String jkFileDate) {
|
||||
this.jkFileDate = jkFileDate;
|
||||
}
|
||||
|
||||
public String getCheckHospital() {
|
||||
return checkHospital;
|
||||
}
|
||||
|
||||
public void setCheckHospital(String checkHospital) {
|
||||
this.checkHospital = checkHospital;
|
||||
}
|
||||
|
||||
public String getCheckConclusion() {
|
||||
return checkConclusion;
|
||||
}
|
||||
|
||||
public void setCheckConclusion(String checkConclusion) {
|
||||
this.checkConclusion = checkConclusion;
|
||||
}
|
||||
|
||||
public Date getCheckDate() {
|
||||
return checkDate;
|
||||
}
|
||||
|
||||
public void setCheckDate(Date checkDate) {
|
||||
this.checkDate = checkDate;
|
||||
}
|
||||
|
||||
public String getArchivesId() {
|
||||
return archivesId;
|
||||
}
|
||||
|
||||
public void setArchivesId(String archivesId) {
|
||||
this.archivesId = archivesId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUpdateTime(Date updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
|
||||
public long getCreateUser() {
|
||||
return createUser;
|
||||
}
|
||||
|
||||
public void setCreateUser(long createUser) {
|
||||
this.createUser = createUser;
|
||||
}
|
||||
|
||||
public long getUpdateUser() {
|
||||
return updateUser;
|
||||
}
|
||||
|
||||
public void setUpdateUser(long updateUser) {
|
||||
this.updateUser = updateUser;
|
||||
}
|
||||
|
||||
public String getDeleted() {
|
||||
return deleted;
|
||||
}
|
||||
|
||||
public void setDeleted(String deleted) {
|
||||
this.deleted = deleted;
|
||||
}
|
||||
|
||||
public List<SystemFile> getFileList() {
|
||||
return fileList;
|
||||
}
|
||||
|
||||
public void setFileList(List<SystemFile> fileList) {
|
||||
this.fileList = fileList;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package com.jeethink.receive.mapper;
|
||||
|
||||
import com.jeethink.receive.domain.ArchivesFile;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public interface ArchivesFileMapper {
|
||||
|
||||
|
||||
List<ArchivesFile> selectArchivesFileList(String archivesId);
|
||||
|
||||
void removeByArchivesId(String archivesId);
|
||||
|
||||
void insertArchivesFile(ArchivesFile archivesFile);
|
||||
|
||||
String selectArchiveFileId(@Param("userNumber") String userNumber, @Param("type") String type);
|
||||
|
||||
List<HashMap> selectArchivesFileById(String archivesId);
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.jeethink.receive.mapper;
|
||||
|
||||
import com.jeethink.bean.domain.ArchivesMaster;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface ArchivesMapper {
|
||||
|
||||
List<ArchivesMaster> selectArchivesList(ArchivesMaster archives);
|
||||
|
||||
ArchivesMaster selectById(String archivesId);
|
||||
|
||||
void insertArchives(ArchivesMaster master);
|
||||
|
||||
void updateArchive(ArchivesMaster archivesMaster);
|
||||
|
||||
void changeNowStatus(@Param("archivesId") String archivesId, @Param("nowStatus") String nowStatus);
|
||||
|
||||
int romoveById(String archivesId);
|
||||
|
||||
List<ArchivesMaster> selectExpireArchivesList(ArchivesMaster archives);
|
||||
|
||||
void postponeArchives(ArchivesMaster archives);
|
||||
|
||||
List<ArchivesMaster> selectArchivesByUser(ArchivesMaster archives);
|
||||
|
||||
ArchivesMaster selectJk(String userNumber);
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.jeethink.receive.service;
|
||||
|
||||
import com.jeethink.bean.domain.ArchivesMaster;
|
||||
import com.jeethink.bean.vo.Approval;
|
||||
import com.jeethink.receive.vo.ArchivesVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 人事档案接收Service接口
|
||||
*
|
||||
* @author sh
|
||||
* @date 2022-11-08
|
||||
*/
|
||||
public interface IArchivesApprovalService
|
||||
{
|
||||
|
||||
/**
|
||||
* 查询人事档案接收列表
|
||||
*
|
||||
* @param rsArchive 人事档案接收
|
||||
* @return 人事档案接收集合
|
||||
*/
|
||||
public List<ArchivesMaster> selectApprovalList(ArchivesMaster rsArchive);
|
||||
|
||||
/**
|
||||
* 档案审核
|
||||
* @param approval
|
||||
* @return
|
||||
*/
|
||||
void approvalArchive(Approval approval);
|
||||
|
||||
/**
|
||||
* 获取详情
|
||||
* @param archivesId
|
||||
* @return
|
||||
*/
|
||||
ArchivesVO getArchives(String archivesId);
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package com.jeethink.receive.service;
|
||||
|
||||
import com.jeethink.bean.domain.ArchivesMaster;
|
||||
import com.jeethink.receive.vo.ArchivesVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public interface IArchivesService {
|
||||
/**
|
||||
* 获取档案列表
|
||||
* @param archives
|
||||
* @return
|
||||
*/
|
||||
List<ArchivesMaster> selectArchivesList(ArchivesMaster archives);
|
||||
|
||||
/**
|
||||
* 获取档案详情
|
||||
* @param archivesId
|
||||
* @return
|
||||
*/
|
||||
ArchivesVO selectArchivesById(String archivesId);
|
||||
|
||||
/**
|
||||
* 新增档案
|
||||
* @param archives
|
||||
*/
|
||||
void insertArchives(ArchivesVO archives);
|
||||
|
||||
/**
|
||||
* 修改档案
|
||||
* @param archives
|
||||
*/
|
||||
void updateArchives(ArchivesVO archives);
|
||||
|
||||
/**
|
||||
* 提交档案
|
||||
* @param archives
|
||||
*/
|
||||
void submitArchives(ArchivesVO archives);
|
||||
|
||||
/**
|
||||
* 撤销提交
|
||||
* @param archivesId
|
||||
*/
|
||||
void revocationArchives(String archivesId);
|
||||
|
||||
/**
|
||||
* 删除档案
|
||||
* @param archivesId
|
||||
* @return
|
||||
*/
|
||||
int removeArchives(String archivesId);
|
||||
|
||||
/**
|
||||
* 修改档案状态
|
||||
* @param archivesId
|
||||
* @param nowStatus
|
||||
*/
|
||||
void changeNowStatus(String archivesId, String nowStatus);
|
||||
|
||||
void uploadArchiveFileList();
|
||||
|
||||
String importArchives(List<ArchivesMaster> archivesMasterList, boolean updateSupport);
|
||||
String importArchives2(List<ArchivesMaster> archivesMasterList, boolean updateSupport);
|
||||
|
||||
ArchivesMaster selectById(String archivesId);
|
||||
|
||||
String selectArchiveFileId(@Param("userNumber") String userNumber, @Param("type") String type);
|
||||
|
||||
List<HashMap> selectArchivesFileById(String archivesId);
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
package com.jeethink.receive.service.impl;
|
||||
|
||||
import com.jeethink.common.constant.Constants;
|
||||
import com.jeethink.common.exception.CustomException;
|
||||
import com.jeethink.common.utils.SecurityUtils;
|
||||
import com.jeethink.flow.service.IFlowService;
|
||||
import com.jeethink.bean.domain.ArchivesMaster;
|
||||
import com.jeethink.receive.service.IArchivesApprovalService;
|
||||
import com.jeethink.bean.vo.Approval;
|
||||
import com.jeethink.receive.service.IArchivesService;
|
||||
import com.jeethink.receive.vo.ArchivesVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.beans.Transient;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 人事档案接收Service业务层处理
|
||||
*
|
||||
* @author sh
|
||||
* @date 2022-11-08
|
||||
*/
|
||||
@Service
|
||||
public class ArchivesApprovalServiceImpl implements IArchivesApprovalService
|
||||
{
|
||||
@Autowired
|
||||
private IArchivesService archivesService;
|
||||
@Autowired
|
||||
private IFlowService flowService;
|
||||
|
||||
/**
|
||||
* 查询人事档案接收列表
|
||||
*
|
||||
* @param archives 人事档案接收
|
||||
* @return 人事档案接收
|
||||
*/
|
||||
@Override
|
||||
public List<ArchivesMaster> selectApprovalList(ArchivesMaster archives)
|
||||
{
|
||||
String userType = SecurityUtils.getLoginUser().getUser().getUserType();
|
||||
List<ArchivesMaster> list = new ArrayList<>();
|
||||
if (Constants.USER_TYPE_ZG.equals(userType)) {
|
||||
archives.setNowStatus(Constants.ARCHIVES_STATUS_RECEIVE_SUBMITED);
|
||||
list = archivesService.selectArchivesList(archives);
|
||||
} else if (Constants.USER_TYPE_BZ.equals(userType)) {
|
||||
archives.setNowStatus(Constants.ARCHIVES_STATUS_RECEIVE_APPROVE);
|
||||
list = archivesService.selectArchivesList(archives);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Transient
|
||||
@Override
|
||||
public void approvalArchive(Approval approval) {
|
||||
String userType = SecurityUtils.getLoginUser().getUser().getUserType();
|
||||
if (!Constants.USER_TYPE_ZG.equals(userType) && !Constants.USER_TYPE_BZ.equals(userType)) {
|
||||
throw new CustomException("您没有审核权限");
|
||||
}
|
||||
flowService.updateFlow(approval.getObjectId(), Constants.FLOW_TYPE_RECEIVE, approval.getStatus(), approval.getRemark());
|
||||
if (Constants.APPROVE_PASS.equals(approval.getStatus())) {
|
||||
if (Constants.USER_TYPE_BZ.equals(userType)) {
|
||||
archivesService.changeNowStatus(approval.getObjectId(), Constants.ARCHIVES_STATUS_RECEIVE_WAIT);
|
||||
}else if (Constants.USER_TYPE_ZG.equals(userType)) {
|
||||
archivesService.changeNowStatus(approval.getObjectId(), Constants.ARCHIVES_STATUS_RECEIVE_APPROVE);
|
||||
}
|
||||
} else {
|
||||
archivesService.changeNowStatus(approval.getObjectId(), Constants.ARCHIVES_STATUS_RECEIVE_REJECT);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArchivesVO getArchives(String archivesId) {
|
||||
|
||||
return archivesService.selectArchivesById(archivesId);
|
||||
}
|
||||
}
|
@ -0,0 +1,569 @@
|
||||
package com.jeethink.receive.service.impl;
|
||||
|
||||
import com.jeethink.bean.domain.ArchivesMaster;
|
||||
import com.jeethink.common.core.domain.entity.SysUser;
|
||||
import com.jeethink.common.utils.DateUtils;
|
||||
import com.jeethink.common.utils.StringUtils;
|
||||
import com.jeethink.common.utils.file.FileUtils;
|
||||
import com.jeethink.framework.config.ServerConfig;
|
||||
import com.jeethink.receive.domain.ArchivesFile;
|
||||
import com.jeethink.receive.mapper.ArchivesFileMapper;
|
||||
import com.jeethink.receive.vo.ArchivesVO;
|
||||
import com.jeethink.common.constant.Constants;
|
||||
import com.jeethink.common.exception.CustomException;
|
||||
import com.jeethink.common.utils.SecurityUtils;
|
||||
import com.jeethink.common.utils.uuid.IdUtils;
|
||||
import com.jeethink.flow.domain.FlowRecord;
|
||||
import com.jeethink.flow.service.IFlowService;
|
||||
import com.jeethink.receive.mapper.ArchivesMapper;
|
||||
import com.jeethink.receive.service.IArchivesService;
|
||||
import com.jeethink.system.domain.SystemFile;
|
||||
import com.jeethink.system.mapper.SysDictDataMapper;
|
||||
import com.jeethink.system.mapper.SysUserMapper;
|
||||
import com.jeethink.system.mapper.SystemFileMapper;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.beans.Transient;
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
@Service
|
||||
public class ArchivesServiceImpl implements IArchivesService {
|
||||
private static final Logger log = LoggerFactory.getLogger(ArchivesServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private ArchivesMapper mapper;
|
||||
@Autowired
|
||||
private ArchivesFileMapper archivesFileMapper;
|
||||
@Autowired
|
||||
private IFlowService flowService;
|
||||
@Autowired
|
||||
private SystemFileMapper fileMapper;
|
||||
@Autowired
|
||||
private SysUserMapper userMapper;
|
||||
@Autowired
|
||||
private ServerConfig serverConfig;
|
||||
/**
|
||||
* 获取档案列表
|
||||
*
|
||||
* @param archives
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<ArchivesMaster> selectArchivesList(ArchivesMaster archives) {
|
||||
|
||||
return mapper.selectArchivesList(archives);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取档案详情
|
||||
*
|
||||
* @param archivesId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ArchivesVO selectArchivesById(String archivesId) {
|
||||
|
||||
ArchivesMaster archives = mapper.selectById(archivesId);
|
||||
ArchivesVO vo = new ArchivesVO();
|
||||
BeanUtils.copyProperties(archives, vo);
|
||||
|
||||
Map<String, ArchivesFile> fileInfo = selectFileInfo(archives);
|
||||
vo.setFileInfo(fileInfo);
|
||||
|
||||
|
||||
List<FlowRecord> records = new ArrayList<>();
|
||||
if (Constants.ARCHIVES_STATUS_RECEIVE_SUBMITED.equals(archives.getNowStatus())
|
||||
|| Constants.ARCHIVES_STATUS_RECEIVE_APPROVE.equals(archives.getNowStatus())
|
||||
|| Constants.ARCHIVES_STATUS_RECEIVE_WAIT.equals(archives.getNowStatus())
|
||||
|| Constants.ARCHIVES_STATUS_RECEIVE_REJECT.equals(archives.getNowStatus())
|
||||
) {
|
||||
records = flowService.selectRecord(archivesId, Constants.FLOW_TYPE_RECEIVE);
|
||||
}
|
||||
if (Constants.ARCHIVES_STATUS_DESTROY_APPLY.equals(archives.getNowStatus())
|
||||
|| Constants.ARCHIVES_STATUS_DESTROY_APPROVE.equals(archives.getNowStatus())
|
||||
|| Constants.ARCHIVES_STATUS_DESTROY_WAIT.equals(archives.getNowStatus())
|
||||
|| Constants.ARCHIVES_STATUS_DESTROY_REJECT.equals(archives.getNowStatus())
|
||||
) {
|
||||
records = flowService.selectRecord(archivesId, Constants.FLOW_TYPE_DESTROY);
|
||||
}
|
||||
vo.setFlowRecords(records);
|
||||
|
||||
return vo;
|
||||
}
|
||||
|
||||
private Map<String, ArchivesFile> selectFileInfo(ArchivesMaster archives) {
|
||||
|
||||
String archivesId = archives.getArchivesId();
|
||||
String archivesType = archives.getType();
|
||||
Map<String, ArchivesFile> fileInfo = new HashMap<>();
|
||||
List<ArchivesFile> archivesFileList = archivesFileMapper.selectArchivesFileList(archivesId);
|
||||
if(Constants.ARCHIVES_TYPE_JK.equals(archivesType)){
|
||||
Date dt=new Date();
|
||||
int year = Integer.parseInt(DateUtils.parseDateToStr("yyyy",dt));
|
||||
ArchivesFile archivesFileNew = new ArchivesFile();
|
||||
/*for(int i=0;i<5;i++){
|
||||
fileInfo.put(String.valueOf(year-i),archivesFileNew);
|
||||
}*/
|
||||
for(int i=2019;i<=year;i++){
|
||||
fileInfo.put(String.valueOf(i),archivesFileNew);
|
||||
}
|
||||
}
|
||||
for (ArchivesFile archivesFile : archivesFileList){
|
||||
SystemFile systemFile = new SystemFile();
|
||||
systemFile.setFileObjectId(archivesFile.getArchivesFileId());
|
||||
List<SystemFile> fileList = fileMapper.selectSystemFileList(systemFile);
|
||||
archivesFile.setFileList(fileList);
|
||||
if (Constants.ARCHIVES_TYPE_RS.equals(archivesType)) {
|
||||
fileInfo.put(archivesFile.getRsFileType(), archivesFile);
|
||||
}else if (Constants.ARCHIVES_TYPE_JK.equals(archivesType)) {
|
||||
fileInfo.put(archivesFile.getJkFileDate(), archivesFile);
|
||||
}
|
||||
}
|
||||
return fileInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增档案
|
||||
*
|
||||
* @param archives
|
||||
*/
|
||||
@Transient
|
||||
@Override
|
||||
public void insertArchives(ArchivesVO archives) {
|
||||
|
||||
String archivesId= IdUtils.simpleUUID();
|
||||
String nowStatus = Constants.ARCHIVES_STATUS_SAVE;
|
||||
Boolean isSubmit = archives.getIsSubmit();
|
||||
if (isSubmit) {//保存并提交
|
||||
if (Constants.ARCHIVES_TYPE_JK.equals(archives.getType())) {//健康档案无需审核
|
||||
nowStatus = Constants.ARCHIVES_STATUS_RECEIVE_WAIT;
|
||||
} else {//其他需要审核
|
||||
Boolean skipApproval = archives.getSkipApproval();
|
||||
if (skipApproval) {//是否跳过审批
|
||||
nowStatus = Constants.ARCHIVES_STATUS_RECEIVE_WAIT;
|
||||
}else {
|
||||
nowStatus = Constants.ARCHIVES_STATUS_RECEIVE_SUBMITED;
|
||||
//插入审批流程
|
||||
flowService.insertFlow(archivesId, Constants.FLOW_TYPE_RECEIVE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ArchivesMaster master = new ArchivesMaster();
|
||||
BeanUtils.copyProperties(archives, master);
|
||||
master.setName(archives.getUserNumber()+archives.getNickName());
|
||||
master.setArchiveNo((Constants.ARCHIVES_TYPE_JK.equals(archives.getType())?"JK":"RS")+archives.getUserNumber());
|
||||
master.setArchivesId(archivesId);
|
||||
master.setNowStatus(nowStatus);
|
||||
master.setCreateUser(SecurityUtils.getUserId());
|
||||
master.setUpdateUser(SecurityUtils.getUserId());
|
||||
master.setWarehouseType(Constants.WAREHOUSE_TYPE_ZS);
|
||||
|
||||
mapper.insertArchives(master);
|
||||
|
||||
Map<String, ArchivesFile> fileInfo = archives.getFileInfo();
|
||||
for (String type : fileInfo.keySet()) {
|
||||
ArchivesFile archivesFile = fileInfo.get(type);
|
||||
archivesFile.setArchivesFileId(IdUtils.simpleUUID());
|
||||
archivesFile.setArchivesId(archivesId);
|
||||
if (Constants.ARCHIVES_TYPE_RS.equals(archives.getType())) {
|
||||
archivesFile.setRsFileType(type);
|
||||
}else if (Constants.ARCHIVES_TYPE_JK.equals(archives.getType())) {
|
||||
archivesFile.setJkFileDate(type);
|
||||
}
|
||||
archivesFile.setDeleted(Constants.DELETED_NO);
|
||||
archivesFile.setCreateUser(SecurityUtils.getUserId());
|
||||
archivesFile.setCreateTime(DateUtils.getNowDate());
|
||||
archivesFileMapper.insertArchivesFile(archivesFile);
|
||||
|
||||
for (SystemFile systemFile: archivesFile.getFileList()) {
|
||||
systemFile.setFileObjectId(archivesFile.getArchivesFileId());
|
||||
systemFile.setFileDeleteType(Constants.DELETED_NO);
|
||||
fileMapper.updateSystemFile(systemFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改档案
|
||||
*
|
||||
* @param archives
|
||||
*/
|
||||
@Transactional
|
||||
@Override
|
||||
public void updateArchives(ArchivesVO archives) {
|
||||
|
||||
ArchivesMaster master = mapper.selectById(archives.getArchivesId());
|
||||
//档案能够修改的三种状态:保存未提交,未通过审批,已入库
|
||||
if (!Constants.ARCHIVES_STATUS_SAVE.equals(master.getNowStatus())
|
||||
&& !Constants.ARCHIVES_STATUS_RECEIVE_REJECT.equals(master.getNowStatus())
|
||||
&& !Constants.ARCHIVES_STATUS_RK.equals(master.getNowStatus())
|
||||
) {
|
||||
throw new CustomException("档案当前状态不能修改");
|
||||
}
|
||||
//审批未通过状态修改会先将上次流程结束
|
||||
if (Constants.ARCHIVES_STATUS_RECEIVE_REJECT.equals(archives.getNowStatus())) {
|
||||
flowService.destroyFlow(archives.getArchivesId(), Constants.FLOW_TYPE_RECEIVE);
|
||||
}
|
||||
|
||||
Boolean isSubmit = archives.getIsSubmit();
|
||||
String nowStatus = Constants.ARCHIVES_STATUS_SAVE;
|
||||
if (isSubmit) {
|
||||
if (Constants.ARCHIVES_TYPE_JK.equals(archives.getType())) {//健康档案无需审核
|
||||
nowStatus = Constants.ARCHIVES_STATUS_RECEIVE_WAIT;
|
||||
} else {//其他需要审核
|
||||
Boolean skipApproval = archives.getSkipApproval();
|
||||
if (skipApproval) {//是否跳过审批
|
||||
nowStatus = Constants.ARCHIVES_STATUS_RECEIVE_WAIT;
|
||||
}else {
|
||||
nowStatus = Constants.ARCHIVES_STATUS_RECEIVE_SUBMITED;
|
||||
//插入审批流程
|
||||
flowService.insertFlow(archives.getArchivesId(), Constants.FLOW_TYPE_RECEIVE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ArchivesMaster archivesMaster = new ArchivesMaster();
|
||||
BeanUtils.copyProperties(archives, archivesMaster);
|
||||
archivesMaster.setNowStatus(nowStatus);
|
||||
archivesMaster.setUpdateUser(SecurityUtils.getUserId());
|
||||
mapper.updateArchive(archivesMaster);
|
||||
|
||||
//附件重新保存,删除原数据
|
||||
archivesFileMapper.removeByArchivesId(archives.getArchivesId());
|
||||
//保存附件
|
||||
Map<String, ArchivesFile> fileInfo = archives.getFileInfo();
|
||||
for (String type : fileInfo.keySet()) {
|
||||
ArchivesFile archivesFile = fileInfo.get(type);
|
||||
archivesFile.setArchivesFileId(IdUtils.simpleUUID());
|
||||
archivesFile.setArchivesId(archives.getArchivesId());
|
||||
if (Constants.ARCHIVES_TYPE_RS.equals(archives.getType())) {
|
||||
archivesFile.setRsFileType(type);
|
||||
}else if (Constants.ARCHIVES_TYPE_JK.equals(archives.getType())) {
|
||||
archivesFile.setJkFileDate(type);
|
||||
}
|
||||
archivesFile.setDeleted(Constants.DELETED_NO);
|
||||
archivesFile.setCreateUser(SecurityUtils.getUserId());
|
||||
archivesFile.setCreateTime(DateUtils.getNowDate());
|
||||
archivesFileMapper.insertArchivesFile(archivesFile);
|
||||
|
||||
if(archivesFile.getFileList()!=null){
|
||||
for (SystemFile systemFile: archivesFile.getFileList()) {
|
||||
systemFile.setFileObjectId(archivesFile.getArchivesFileId());
|
||||
systemFile.setFileDeleteType(Constants.DELETED_NO);
|
||||
fileMapper.updateSystemFile(systemFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交档案
|
||||
*
|
||||
* @param archives
|
||||
*/
|
||||
@Transient
|
||||
@Override
|
||||
public void submitArchives(ArchivesVO archives) {
|
||||
ArchivesMaster master = mapper.selectById(archives.getArchivesId());
|
||||
if (!Constants.ARCHIVES_STATUS_SAVE.equals(master.getNowStatus())) {
|
||||
throw new CustomException("当前档案所出状态不能提交");
|
||||
}
|
||||
if (Constants.ARCHIVES_TYPE_JK.equals(master.getType()) || archives.getSkipApproval()) {
|
||||
//健康档案无需审批,其他档案可跳过审批
|
||||
mapper.changeNowStatus(archives.getArchivesId(), Constants.ARCHIVES_STATUS_RECEIVE_WAIT);
|
||||
}else {
|
||||
mapper.changeNowStatus(archives.getArchivesId(), Constants.ARCHIVES_STATUS_RECEIVE_SUBMITED);
|
||||
flowService.insertFlow(archives.getArchivesId(), Constants.FLOW_TYPE_RECEIVE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 撤销提交
|
||||
*
|
||||
* @param archivesId
|
||||
*/
|
||||
@Transient
|
||||
@Override
|
||||
public void revocationArchives(String archivesId) {
|
||||
|
||||
ArchivesMaster master = mapper.selectById(archivesId);
|
||||
if (!Constants.ARCHIVES_STATUS_RECEIVE_SUBMITED.equals(master.getNowStatus())) {
|
||||
throw new CustomException("该档案已经不能撤销提交");
|
||||
}
|
||||
mapper.changeNowStatus(archivesId, Constants.ARCHIVES_STATUS_SAVE);
|
||||
flowService.destroyFlow(archivesId, Constants.FLOW_TYPE_RECEIVE);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除档案
|
||||
*
|
||||
* @param archivesId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int removeArchives(String archivesId) {
|
||||
|
||||
ArchivesMaster master = mapper.selectById(archivesId);
|
||||
if (!Constants.ARCHIVES_STATUS_SAVE.equals(master.getNowStatus())
|
||||
&& !Constants.ARCHIVES_STATUS_RECEIVE_REJECT.equals(master.getNowStatus())) {
|
||||
throw new CustomException("该档案已经不能删除");
|
||||
}
|
||||
return mapper.romoveById(archivesId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeNowStatus(String archivesId, String nowStatus) {
|
||||
|
||||
mapper.changeNowStatus(archivesId, nowStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uploadArchiveFileList() {
|
||||
String path = "E:\\jeethink\\uploadPath\\uploadFiles";
|
||||
List<File> list = new ArrayList<>();
|
||||
list = FileUtils.getFiles(path,list);
|
||||
for (File file:list){
|
||||
String filePath = file.getPath();
|
||||
String[] filePathArray=filePath.split("\\\\");
|
||||
String archiveType = filePathArray[filePathArray.length-4];
|
||||
String userNum = filePathArray[filePathArray.length-3];
|
||||
String fileType = filePathArray[filePathArray.length-2];
|
||||
String fileName = filePathArray[filePathArray.length-1];
|
||||
/* if("person".equals(archiveType)){//人事档案目录
|
||||
ArchivesMaster archivesMaster = new ArchivesMaster();
|
||||
archivesMaster.setUserNumber(userNum);
|
||||
archivesMaster.setType(Constants.ARCHIVES_TYPE_RS);
|
||||
List<ArchivesMaster> archiveList = mapper.selectArchivesByUser(archivesMaster);
|
||||
if(archiveList.size()>0){
|
||||
ArchivesMaster rsArchive = archiveList.get(0);
|
||||
List<ArchivesFile> archivesFileList = archivesFileMapper.selectArchivesFileList(rsArchive.getArchivesId());
|
||||
for (ArchivesFile archivesFile:archivesFileList) {
|
||||
if(fileType.equals(archivesFile.getRsFileType())){
|
||||
SystemFile systemFile = new SystemFile();
|
||||
systemFile.setFileId(IdUtils.simpleUUID());
|
||||
systemFile.setFileObjectId(archivesFile.getArchivesFileId());
|
||||
systemFile.setFileSize(file.length());
|
||||
String[] fileNames = fileName.split("\\.");
|
||||
String fileName1 = fileName.split("\\.")[0];
|
||||
String fileName2 = fileName.split("\\.")[1];
|
||||
systemFile.setFileName(fileName.split("\\.")[0]);
|
||||
systemFile.setFileSuffix(fileName.split("\\.")[1]);
|
||||
systemFile.setFilePath(filePath);
|
||||
// String fileUrl = serverConfig.getUrl()+"/profile/"+filePathArray[filePathArray.length-6]+"/"+filePathArray[filePathArray.length-5]+"/"+archiveType+"/"+userNum+"/"+fileType+"/"+fileName;
|
||||
String fileUrl = "http://10.10.10.141:9001/profile/"+filePathArray[filePathArray.length-6]+"/"+filePathArray[filePathArray.length-5]+"/"+archiveType+"/"+userNum+"/"+fileType+"/"+fileName;
|
||||
systemFile.setFileUrl(fileUrl);
|
||||
systemFile.setFileDeleteType(Constants.DELETED_NO);
|
||||
systemFile.setFileCreateTime(DateUtils.getNowDate());
|
||||
systemFile.setCreateUserId(SecurityUtils.getUserId());
|
||||
fileMapper.insertSystemFile(systemFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
if("2021".equals(fileType)){
|
||||
if("health".equals(archiveType)){//健康档案目录
|
||||
ArchivesMaster archivesMaster = new ArchivesMaster();
|
||||
archivesMaster.setUserNumber(userNum);
|
||||
archivesMaster.setType(Constants.ARCHIVES_TYPE_JK);
|
||||
List<ArchivesMaster> archiveList = mapper.selectArchivesByUser(archivesMaster);
|
||||
if(archiveList.size()>0){
|
||||
ArchivesMaster rsArchive = archiveList.get(0);
|
||||
List<ArchivesFile> archivesFileList = archivesFileMapper.selectArchivesFileList(rsArchive.getArchivesId());
|
||||
for (ArchivesFile archivesFile:archivesFileList) {
|
||||
if(fileType.equals(archivesFile.getJkFileDate())){
|
||||
SystemFile systemFile = new SystemFile();
|
||||
systemFile.setFileId(IdUtils.simpleUUID());
|
||||
systemFile.setFileObjectId(archivesFile.getArchivesFileId());
|
||||
systemFile.setFileSize(file.length());
|
||||
systemFile.setFileName(fileName.split("\\.")[0]);
|
||||
systemFile.setFileSuffix(fileName.split("\\.")[1]);
|
||||
systemFile.setFilePath(filePath);
|
||||
systemFile.setFileCreateTime(DateUtils.getNowDate());
|
||||
// String fileUrl = serverConfig.getUrl()+"/profile"+"/"+filePathArray[filePathArray.length-5]+"/"+archiveType+"/"+userNum+"/"+fileType+"/"+fileName;
|
||||
String fileUrl = "http://10.10.10.141:9001/profile/"+filePathArray[filePathArray.length-6]+"/"+filePathArray[filePathArray.length-5]+"/"+archiveType+"/"+userNum+"/"+fileType+"/"+fileName;
|
||||
systemFile.setFileUrl(fileUrl);
|
||||
systemFile.setFileDeleteType(Constants.DELETED_NO);
|
||||
systemFile.setCreateUserId(SecurityUtils.getUserId());
|
||||
fileMapper.insertSystemFile(systemFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String importArchives(List<ArchivesMaster> archivesMasterList, boolean updateSupport) {
|
||||
if (StringUtils.isNull(archivesMasterList) || archivesMasterList.size() == 0)
|
||||
{
|
||||
throw new CustomException("导入用户数据不能为空!");
|
||||
}
|
||||
int successNum = 0;
|
||||
int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
for (ArchivesMaster archivesMaster : archivesMasterList){
|
||||
try{
|
||||
// 验证是否存在这个用户
|
||||
String userNumber = archivesMaster.getUserNumber();
|
||||
SysUser u = userMapper.selectUserByUserNumber(userNumber);
|
||||
if (StringUtils.isNotNull(u)){
|
||||
archivesMaster.setArchivesId(IdUtils.simpleUUID());
|
||||
archivesMaster.setArchiveNo((Constants.ARCHIVES_TYPE_JK.equals(archivesMaster.getType())?"JK":"RS")+archivesMaster.getUserNumber());
|
||||
archivesMaster.setName(archivesMaster.getUserNumber()+archivesMaster.getNickName());
|
||||
archivesMaster.setDeleted(Constants.DELETED_NO);
|
||||
archivesMaster.setCreateUser(SecurityUtils.getUserId());
|
||||
archivesMaster.setCreateTime(DateUtils.getNowDate());
|
||||
archivesMaster.setUserId(u.getUserId());
|
||||
archivesMaster.setNowStatus(Constants.ARCHIVES_STATUS_RK);
|
||||
archivesMaster.setGdPeopleId(SecurityUtils.getUserId());
|
||||
archivesMaster.setType(Constants.ARCHIVES_TYPE_RS);
|
||||
archivesMaster.setWarehouseType(Constants.WAREHOUSE_TYPE_ZS);
|
||||
archivesMaster.setTier("0");
|
||||
archivesMaster.setIfPaper("0");
|
||||
archivesMaster.setPeopleType("2");
|
||||
archivesMaster.setClassified("0");
|
||||
archivesMaster.setDuration("0");
|
||||
mapper.insertArchives(archivesMaster);
|
||||
for (int i = 0; i <= 10; i++) {
|
||||
ArchivesFile archivesFile = new ArchivesFile();
|
||||
archivesFile.setArchivesFileId(IdUtils.simpleUUID());
|
||||
archivesFile.setArchivesId(archivesMaster.getArchivesId());
|
||||
archivesFile.setRsFileType(String.valueOf(i));
|
||||
archivesFile.setDeleted(Constants.DELETED_NO);
|
||||
archivesFile.setCreateUser(SecurityUtils.getUserId());
|
||||
archivesFile.setCreateTime(DateUtils.getNowDate());
|
||||
archivesFileMapper.insertArchivesFile(archivesFile);
|
||||
}
|
||||
successNum++;
|
||||
successMsg.append("<br/>" + successNum + "、员工编号 " + archivesMaster.getUserNumber() + " 的人事档案导入成功");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、员工编号 " + archivesMaster.getUserNumber() + " 的人事档案导入失败:";
|
||||
failureMsg.append(msg + e.getMessage());
|
||||
log.error(msg, e);
|
||||
}
|
||||
}
|
||||
if (failureNum > 0)
|
||||
{
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new CustomException(failureMsg.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String importArchives2(List<ArchivesMaster> archivesMasterList, boolean updateSupport) {
|
||||
if (StringUtils.isNull(archivesMasterList) || archivesMasterList.size() == 0)
|
||||
{
|
||||
throw new CustomException("导入用户数据不能为空!");
|
||||
}
|
||||
int successNum = 0;
|
||||
int failureNum = 0;
|
||||
StringBuilder successMsg = new StringBuilder();
|
||||
StringBuilder failureMsg = new StringBuilder();
|
||||
for (ArchivesMaster archivesMaster : archivesMasterList){
|
||||
try{
|
||||
// 验证是否存在这个用户
|
||||
String userNumber = archivesMaster.getUserNumber();
|
||||
SysUser u = userMapper.selectUserByUserNumber(userNumber);
|
||||
if (StringUtils.isNotNull(u)){
|
||||
ArchivesFile archivesFile = new ArchivesFile();
|
||||
ArchivesMaster m=mapper.selectJk(userNumber);
|
||||
if(StringUtils.isNull(m)){
|
||||
archivesMaster.setArchivesId(IdUtils.simpleUUID());
|
||||
archivesMaster.setArchiveNo("JK"+archivesMaster.getUserNumber());
|
||||
archivesMaster.setName(archivesMaster.getUserNumber()+archivesMaster.getNickName());
|
||||
archivesMaster.setDeleted(Constants.DELETED_NO);
|
||||
archivesMaster.setCreateUser(SecurityUtils.getUserId());
|
||||
archivesMaster.setCreateTime(DateUtils.getNowDate());
|
||||
archivesMaster.setUserId(u.getUserId());
|
||||
archivesMaster.setNowStatus(Constants.ARCHIVES_STATUS_RK);
|
||||
archivesMaster.setGdPeopleId(SecurityUtils.getUserId());
|
||||
archivesMaster.setType(Constants.ARCHIVES_TYPE_JK);
|
||||
archivesMaster.setWarehouseType(Constants.WAREHOUSE_TYPE_ZS);
|
||||
archivesMaster.setTier("0");
|
||||
archivesMaster.setIfPaper("0");
|
||||
archivesMaster.setPeopleType("2");
|
||||
archivesMaster.setClassified("0");
|
||||
archivesMaster.setDuration("0");
|
||||
mapper.insertArchives(archivesMaster);
|
||||
archivesFile.setArchivesId(archivesMaster.getArchivesId());
|
||||
archivesFile.setArchivesFileId(IdUtils.simpleUUID());
|
||||
archivesFile.setJkFileDate(archivesMaster.getJkFileDate());
|
||||
archivesFile.setCheckConclusion(archivesMaster.getCheckConclusion());
|
||||
archivesFile.setCheckDate(archivesMaster.getCheckDate());
|
||||
archivesFile.setCheckHospital(archivesMaster.getCheckHospital());
|
||||
archivesFile.setDeleted(Constants.DELETED_NO);
|
||||
archivesFile.setCreateUser(SecurityUtils.getUserId());
|
||||
archivesFile.setCreateTime(DateUtils.getNowDate());
|
||||
archivesFileMapper.insertArchivesFile(archivesFile);
|
||||
}else {
|
||||
archivesFile.setArchivesId(m.getArchivesId());
|
||||
archivesFile.setArchivesFileId(IdUtils.simpleUUID());
|
||||
archivesFile.setJkFileDate(archivesMaster.getJkFileDate());
|
||||
archivesFile.setCheckConclusion(archivesMaster.getCheckConclusion());
|
||||
archivesFile.setCheckDate(archivesMaster.getCheckDate());
|
||||
archivesFile.setCheckHospital(archivesMaster.getCheckHospital());
|
||||
archivesFile.setDeleted(Constants.DELETED_NO);
|
||||
archivesFile.setCreateUser(SecurityUtils.getUserId());
|
||||
archivesFile.setCreateTime(DateUtils.getNowDate());
|
||||
archivesFileMapper.insertArchivesFile(archivesFile);
|
||||
}
|
||||
|
||||
|
||||
successNum++;
|
||||
/*successMsg.append("<br/>" + successNum + "、员工编号 " + archivesMaster.getUserNumber() + " 的健康档案导入成功");*/
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
failureNum++;
|
||||
String msg = "<br/>" + failureNum + "、员工编号 " + archivesMaster.getUserNumber() + " 的健康档案导入失败:";
|
||||
failureMsg.append(msg + e.getMessage());
|
||||
log.error(msg, e);
|
||||
}
|
||||
}
|
||||
if (failureNum > 0)
|
||||
{
|
||||
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
|
||||
throw new CustomException(failureMsg.toString());
|
||||
}
|
||||
else
|
||||
{
|
||||
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
|
||||
}
|
||||
return successMsg.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArchivesMaster selectById(String archivesId) {
|
||||
return mapper.selectById(archivesId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String selectArchiveFileId(String userNumber, String type) {
|
||||
return archivesFileMapper.selectArchiveFileId(userNumber,type);
|
||||
}
|
||||
@Override
|
||||
public List<HashMap> selectArchivesFileById(String archivesId) {
|
||||
return archivesFileMapper.selectArchivesFileById(archivesId);
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package com.jeethink.receive.vo;
|
||||
|
||||
public class ApprovalVo {
|
||||
|
||||
//档案ID
|
||||
private String archiveId;
|
||||
//状态:pass:通过,reject:不通过
|
||||
private String status;
|
||||
//备注,不通过的理由
|
||||
private String remark;
|
||||
|
||||
public String getArchiveId() {
|
||||
return archiveId;
|
||||
}
|
||||
|
||||
public void setArchiveId(String archiveId) {
|
||||
this.archiveId = archiveId;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user