Commit 2efd82d5 by HlQ

[add] 项目代码提交

1 parent ee3b94fe
Showing 119 changed files with 2067 additions and 1219 deletions
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
src/main/test/
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="NodePackageJsonFileManager">
<packageJsonPaths />
</component>
</project>
\ No newline at end of file \ No newline at end of file
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile default="true" name="Default" enabled="true" />
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="Vion-DevOps" />
</profile>
</annotationProcessing>
</component>
<component name="JavacSettings">
<option name="ADDITIONAL_OPTIONS_OVERRIDE">
<module name="Vion-DevOps" options="-parameters" />
</option>
</component>
</project>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
</component>
</project>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="vion-nexus" />
<option name="name" value="vion-nexus" />
<option name="url" value="http://maven.vionyun.com:8081/nexus/content/groups/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="aliyun-nexus" />
<option name="name" value="aliyun-nexus" />
<option name="url" value="http://maven.aliyun.com/nexus/content/groups/public" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK" />
</project>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
\ No newline at end of file \ No newline at end of file
...@@ -8,34 +8,23 @@ ...@@ -8,34 +8,23 @@
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.14</version> <version>2.7.17</version>
</parent> </parent>
<artifactId>Vion-DevOps</artifactId> <artifactId>Vion-DevOps</artifactId>
<version>1</version> <version>1</version>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>net.minidev</groupId>
<artifactId>json-smart</artifactId>
<version>2.2.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.postgresql</groupId> <groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId> <artifactId>postgresql</artifactId>
<version>42.3.8</version> <version>42.6.0</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.projectlombok</groupId> <groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId> <artifactId>lombok</artifactId>
<version>1.16.20</version> <version>1.18.30</version>
<scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
...@@ -43,91 +32,64 @@ ...@@ -43,91 +32,64 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId> <artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.hutool</groupId> <groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId> <artifactId>hutool-all</artifactId>
<version>5.8.15</version> <version>5.8.22</version>
</dependency>
<dependency>
<groupId>com.mks.api</groupId>
<artifactId>mksapi-jar</artifactId>
<version>4.10.9049</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>dingtalk</artifactId>
<version>2.0.14</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.47</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.14</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>alibaba-dingtalk-service-sdk</artifactId>
<version>2.0.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.github.pagehelper</groupId> <groupId>io.github.linpeilie</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId> <artifactId>mapstruct-plus-spring-boot-starter</artifactId>
<version>1.4.0</version> <version>1.3.5</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.baomidou</groupId> <groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId> <artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.1</version> <version>3.5.4</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>javax</groupId> <groupId>com.github.binarywang</groupId>
<artifactId>javaee-api</artifactId> <artifactId>wx-java-mp-spring-boot-starter</artifactId>
<version>7.0</version> <version>4.5.0</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>VVAS-Task</finalName>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId> <artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>vion.Application</mainClass>
<layout>JAR</layout>
</configuration>
</plugin> </plugin>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration> <configuration>
<source>8</source> <source>1.8</source>
<target>8</target> <target>1.8</target>
</configuration> <annotationProcessorPaths>
</plugin> <path>
<plugin> <groupId>org.projectlombok</groupId>
<groupId>org.apache.maven.plugins</groupId> <artifactId>lombok</artifactId>
<artifactId>maven-jar-plugin</artifactId> <version>1.18.30</version>
<configuration> </path>
<excludes> <path>
<exclude>application-*.properties</exclude> <groupId>io.github.linpeilie</groupId>
</excludes> <artifactId>mapstruct-plus-processor</artifactId>
<version>1.3.5</version>
</path>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok-mapstruct-binding</artifactId>
<version>0.2.0</version>
</path>
</annotationProcessorPaths>
</configuration> </configuration>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
</plugin>
</plugins> </plugins>
</build> </build>
</project> </project>
\ No newline at end of file \ No newline at end of file
package vion; package vion;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import vion.controller.UserController; import vion.ding.DingMod;
import java.util.concurrent.CountDownLatch;
@SpringBootApplication @SpringBootApplication
@MapperScan("vion.mapper")
@EnableScheduling @EnableScheduling
public class Application implements CommandLineRunner { public class Application {
public static void main(String[] args) { public static void main(String[] args) {
try { SpringApplication.run(Application.class, args);
SpringApplication.run(Application.class, args);
new CountDownLatch(1).await();
} catch (Exception e) {
e.printStackTrace();
}
} }
@Autowired @Autowired
private UserController userController; private DingMod dingMod;
private final static Logger logger = LoggerFactory.getLogger(Application.class); private final static Logger logger = LoggerFactory.getLogger(Application.class);
//@Scheduled(fixedDelay=1000*60*10,initialDelay=1000) @Scheduled(cron = "${third.run.cron:0 0 2 * * ?}")
@Scheduled(cron="${third.run.cron:0 0 2 * * ?}") public void startJob() {
public void startJob(){
try { try {
logger.info("启动"); logger.info("启动");
//定时获取钉钉用户列表 //定时获取钉钉用户列表
userController.getDingUserList(); dingMod.getDeptList();
//USERNAME_MAP dingMod.getDingUserList();
logger.info("启动完成"); logger.info("启动完成");
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
// System.exit(-1);
} }
} }
@Override
public void run(String... args) throws Exception {
}
} }
...@@ -2,7 +2,6 @@ package vion; ...@@ -2,7 +2,6 @@ package vion;
import vion.model.User; import vion.model.User;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
...@@ -13,5 +12,4 @@ public class Global { ...@@ -13,5 +12,4 @@ public class Global {
public static final String WORK_URL = "/api/work"; public static final String WORK_URL = "/api/work";
public static final String INSPECT_URL = "/api/inspect"; public static final String INSPECT_URL = "/api/inspect";
public static final Map<String, User> USERNAME_MAP = new ConcurrentHashMap<>(); public static final Map<String, User> USERNAME_MAP = new ConcurrentHashMap<>();
public static final Map<String, String> IP_MALL_MAP = new HashMap<>();
} }
package vion.advice;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.MethodParameter;
import org.springframework.http.MediaType;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
import vion.utils.ResultUtil;
import vion.vo.ResultVO;
/**
* @author HlQ
* @date 2023/11/2
*/
@Component
@RestControllerAdvice("vion.controller")
@Slf4j
public class ResBodyAdvice implements ResponseBodyAdvice<Object> {
@Override
public boolean supports(MethodParameter returnType, Class<? extends HttpMessageConverter<?>> converterType) {
return !returnType.getMethod().getReturnType().isAssignableFrom(Void.TYPE);
}
@Override
public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType, Class selectedConverterType, ServerHttpRequest request, ServerHttpResponse response) {
if (body instanceof ResultVO || body instanceof ModelAndView) {
return body;
}
ResultVO resultVO = ResultUtil.success(body);
if (returnType.getParameterType().isAssignableFrom(String.class)) {
// 字符串类型特殊处理
try {
return new ObjectMapper().writeValueAsString(resultVO);
} catch (JsonProcessingException e) {
}
}
return resultVO;
}
@ExceptionHandler(Exception.class)
public Object exceptionHandler(Exception e) {
log.error("接口调用出错", e);
return ResultUtil.error(e.getMessage());
}
@ExceptionHandler(IllegalArgumentException.class)
public Object argExceptionHandler(Exception e) {
log.error("参数异常", e);
return ResultUtil.error(e.getMessage());
}
@ExceptionHandler(MethodArgumentTypeMismatchException.class)
public Object methodArgExceptionHandler(Exception e) {
log.error("方法参数异常", e);
return ResultUtil.error("Method parameter error.");
}
}
package vion.config;
import com.baomidou.mybatisplus.annotation.DbType;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.apache.ibatis.reflection.MetaObject;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import java.util.Date;
/**
* @author HlQ
* @date 2022/7/20
*/
@Configuration
public class MyBatisPlusConfig implements MetaObjectHandler {
@Override
public void insertFill(MetaObject metaObject) {
this.fillHasGetter(metaObject, "createTime", new Date());
this.fillHasGetter(metaObject, "modifyTime", new Date());
this.fillHasGetter(metaObject, "updateTime", new Date());
}
@Override
public void updateFill(MetaObject metaObject) {
this.fillHasGetter(metaObject, "modifyTime", new Date());
this.fillHasGetter(metaObject, "updateTime", new Date());
}
protected void fillHasGetter(MetaObject metaObject, String fieldName, Object fieldVal) {
if (metaObject.hasGetter(fieldName)) {
this.fillStrategy(metaObject, fieldName, fieldVal);
}
}
@Bean
public MybatisPlusInterceptor mybatisPlusInterceptor() {
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.POSTGRE_SQL));
return interceptor;
}
}
package vion.controller; package vion.controller;
import com.github.pagehelper.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.PageHelper; import lombok.RequiredArgsConstructor;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import vion.Global; import vion.Global;
import vion.enums.ResultEnum;
import vion.model.Account; import vion.model.Account;
import vion.model.Store; import vion.service.IAccountService;
import vion.service.IAccountSerrvice;
import vion.utils.ResultUtil;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
@Controller @RestController
@RequestMapping(Global.BASE_URL) @RequestMapping(Global.BASE_URL)
@RequiredArgsConstructor
@Slf4j @Slf4j
public class AccountController { public class AccountController {
@Autowired private final IAccountService accountService;
private IAccountSerrvice accountSerrvice;
@GetMapping("/accounts") @GetMapping("/accounts")
@ResponseBody public Page<Account> getAccountList(@RequestParam(defaultValue = "1") Integer pageNum,
public Object getAccountList(@RequestParam(name = "pageNum")Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize) {
@RequestParam(name = "pageSize")Integer pageSize){ return accountService.page(Page.of(pageNum, pageSize));
//pageNum当前页,pageSize每页条数
Page page= PageHelper.startPage(pageNum,pageSize);
List<Account> accountList=accountSerrvice.list();
accountList.sort(Comparator.comparing(Account::getId));
PageInfo pageInfo=new PageInfo<>(page);
pageInfo.setList(accountList);
if (accountList != null) {
return ResultUtil.success(pageInfo);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
} }
@GetMapping("/account") @GetMapping("/account")
@ResponseBody public Account getProductByID(Integer id) {
public Object getProductByID(@RequestParam(name = "id")Integer id){ return accountService.getById(id);
Account account=accountSerrvice.getById(id);//accountDao.getAccountById(id);
if (account != null) {
return ResultUtil.success(account);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
} }
@PostMapping("/accounts") @PostMapping("/accounts")
@ResponseBody public Account saveOrUpdate(@RequestBody Account data) {
public Object saveOrUpdate(@RequestBody Account data) { accountService.save(data);
return data;
try {
if(data.getId()==null){
data.setCreateTime(new Date());
}else{
data.setModifyTime(new Date());
}
Account account= accountSerrvice.saveAndReturn(data);
return ResultUtil.success(account);
}catch (Exception e) {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
} }
} }
package vion.controller; package vion.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.Page; import io.github.linpeilie.Converter;
import com.github.pagehelper.PageHelper; import lombok.RequiredArgsConstructor;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import vion.Global; import vion.Global;
import vion.enums.ResultEnum; import vion.dto.DictionaryDTO;
import vion.dto.DictionaryTypeDTO;
import vion.model.Dictionary; import vion.model.Dictionary;
import vion.model.DictionaryType; import vion.model.DictionaryType;
import vion.model.Store; import vion.service.IDictionaryService;
import vion.service.IDictionarySerrvice; import vion.service.IDictionaryTypeService;
import vion.service.IDictionaryTypeSerrvice;
import vion.utils.ResultUtil;
import java.util.Comparator;
import java.util.List;
@RestController @RestController
@RequestMapping(Global.BASE_URL) @RequestMapping(Global.BASE_URL)
@RequiredArgsConstructor
@Slf4j @Slf4j
public class DictionaryController { public class DictionaryController {
@Autowired private final IDictionaryService dictionaryService;
private IDictionarySerrvice dictionarySerrvice; private final IDictionaryTypeService dictionaryTypeService;
@Autowired private final Converter converter;
private IDictionaryTypeSerrvice dictionaryTypeSerrvice;
@GetMapping("/dictionarys") @GetMapping("/dictionarys")
@ResponseBody public Page<Dictionary> getDictionaryList(DictionaryDTO data) {
public Object getDictionaryList(@RequestParam(name = "pageNum")Integer pageNum, return dictionaryService.lambdaQuery(converter.convert(data, new Dictionary()))
@RequestParam(name = "pageSize")Integer pageSize, .page(Page.of(data.getPageNum(), data.getPageSize()));
@RequestParam(name = "type",required=false)String type){
//pageNum当前页,pageSize每页条数
Page page= PageHelper.startPage(pageNum,pageSize);
QueryWrapper<Dictionary> wrapper=new QueryWrapper<>();
if(type!=null)
wrapper.eq("type",type);
List<Dictionary> dictionaryList=dictionarySerrvice.list(wrapper);
dictionaryList.sort(Comparator.comparing(Dictionary::getId));
PageInfo pageInfo=new PageInfo<>(page);
pageInfo.setList(dictionaryList);
if (dictionaryList != null) {
return ResultUtil.success(pageInfo);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
} }
@GetMapping("/dictionary") @GetMapping("/dictionary")
@ResponseBody public Object getDictionaryByID(@RequestParam(name = "id") Integer id) {
public Object getDictionaryByID(@RequestParam(name = "id")Integer id){ return dictionaryService.getById(id);
Dictionary dictionary=dictionarySerrvice.getById(id);
if (dictionary != null) {
return ResultUtil.success(dictionary);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
} }
@PostMapping("/dictionarys") @PostMapping("/dictionary")
@ResponseBody public String saveOrUpdateDictionary(@RequestBody DictionaryDTO data) {
public Object saveOrUpdateDictionary(@RequestBody Dictionary data) { Dictionary dictionary = converter.convert(data, new Dictionary());
return dictionaryService.saveOrUpdate(dictionary) ? "成功" : "失败";
try {
dictionarySerrvice.saveOrUpdate(data);
return ResultUtil.success();
}catch (Exception e) {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
} }
@GetMapping("/dictionaryTypes") @GetMapping("/dictionaryTypes")
@ResponseBody public Page<DictionaryType> getDictionaryTypeList(DictionaryTypeDTO data) {
public Object getDictionaryTypeList(@RequestParam(name = "pageNum")Integer pageNum, return dictionaryTypeService.lambdaQuery(converter.convert(data, new DictionaryType()))
@RequestParam(name = "pageSize")Integer pageSize){ .page(Page.of(data.getPageNum(), data.getPageSize()));
//pageNum当前页,pageSize每页条数
PageHelper.startPage(pageNum,pageSize);
List<DictionaryType> dictionaryTypeList=dictionaryTypeSerrvice.list();
PageInfo pageInfo=new PageInfo(dictionaryTypeList,10);
if (dictionaryTypeList != null) {
return ResultUtil.success(pageInfo);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
} }
@GetMapping("/dictionaryType") @GetMapping("/dictionaryType")
@ResponseBody public Object getDictionaryTypeByID(@RequestParam Integer id) {
public Object getDictionaryTypeByID(@RequestParam(name = "id")Integer id){ return dictionaryTypeService.getById(id);
DictionaryType dictionaryType=dictionaryTypeSerrvice.getById(id);
if (dictionaryType != null) {
return ResultUtil.success(dictionaryType);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
} }
@PostMapping("/dictionaryTypes") @PostMapping("/dictionaryType")
@ResponseBody public String saveOrUpdateDictionaryType(@RequestBody DictionaryTypeDTO data) {
public Object saveOrUpdateDictionaryType(@RequestBody DictionaryType data) { DictionaryType dictionaryType = converter.convert(data, new DictionaryType());
return dictionaryTypeService.saveOrUpdate(dictionaryType) ? "成功" : "失败";
try {
dictionaryTypeSerrvice.saveOrUpdate(data);
return ResultUtil.success();
}catch (Exception e) {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
} }
} }
package vion.controller; package vion.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import cn.hutool.core.date.DatePattern;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import cn.hutool.core.date.DateUtil;
import com.github.pagehelper.Page; import cn.hutool.core.io.FileUtil;
import com.github.pagehelper.PageHelper; import cn.hutool.crypto.SecureUtil;
import com.github.pagehelper.PageInfo; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import vion.Global; import vion.Global;
import vion.enums.ResultEnum; import vion.dto.FileInfoDTO;
import vion.model.File; import vion.model.FileInfo;
import vion.model.Inspect; import vion.service.IFileService;
import vion.model.Store;
import vion.service.IFileSerrvice;
import vion.utils.ResultUtil; import vion.utils.ResultUtil;
import vion.vo.StoreVO; import vion.vo.ResultVO;
import javax.servlet.http.HttpServletResponse; import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.util.Date;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController @RestController
@RequestMapping(Global.BASE_URL) @RequestMapping(Global.BASE_URL)
@RequiredArgsConstructor
@Slf4j @Slf4j
public class FileController { public class FileController {
@Autowired private final IFileService fileService;
private IFileSerrvice fileSerrvice; private final Converter converter;
@Value("${fileUrl:}")
@Value("${fileurl:}")
private String fileurl; private String fileurl;
@GetMapping("/files") @GetMapping("/files")
@ResponseBody public Page<FileInfo> getFiles(FileInfoDTO data) {
public Object getFiles(@RequestParam(name = "storeId",required=false)Integer store_id, return fileService.lambdaQuery(converter.convert(data, new FileInfo()))
@RequestParam(name = "sourceId",required=false)Integer source_id, .page(Page.of(data.getPageNum(), data.getPageSize()));
@RequestParam(name = "pageNum")Integer pageNum,
@RequestParam(name = "pageSize")Integer pageSize){
//pageNum当前页,pageSize每页条数
Page page= PageHelper.startPage(pageNum,pageSize);
QueryWrapper<File> wrapper=new QueryWrapper<>();
if(store_id!=null)
wrapper.eq("store_id",store_id);
if(source_id!=null)
wrapper.eq("source_id",source_id);
List<File> fileList=fileSerrvice.list(wrapper);
fileList.sort(Comparator.comparing(File::getId));
PageInfo pageInfo=new PageInfo<>(page);
pageInfo.setList(fileList);
if (pageInfo != null) {
return ResultUtil.success(pageInfo);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
} }
@PostMapping("/files") @DeleteMapping("/file/{id}")
@ResponseBody public String remove(@PathVariable(name = "id") Integer id) {
public Map<String, Object> getFile(@RequestBody File file){ FileInfo file = fileService.getById(id);
Map<String, Object> resultMap = new HashMap<String, Object>(); if (FileUtil.del(file.getUrl())) {
try { fileService.removeById(id);
//添加文件附件 return "文件删除成功";
File tempFile=new File(); } else {
tempFile.setStoreId(file.getStoreId()); return "文件删除失败";
tempFile.setSourceId(file.getSourceId());
tempFile.setSourceType(file.getSourceType());//1项目、2工单预处理,3工单操作,4巡检
tempFile.setName(file.getName());
tempFile.setUrl(file.getUrl());
tempFile.setType(file.getType());
fileSerrvice.save(tempFile);
resultMap.put("msg_code", 200);
} catch (Exception e) {
e.printStackTrace();
resultMap.put("msg_code", 500);
}
return resultMap;
}
@GetMapping("/deleteFile")
@ResponseBody
public Map<String, Object> deleteFile(@RequestParam(name = "id")Integer id){
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
//解除文件关系
fileSerrvice.lambdaUpdate()
.setSql("id="+id)
.eq(File::getSourceId,-1)
.update();
resultMap.put("msg_code", 200);
} catch (Exception e) {
e.printStackTrace();
resultMap.put("msg_code", 500);
} }
return resultMap;
} }
/*
* todo
* 手机端工单预处理提交
* 项目阶段修改,待联调 sourceType=1 这里的附件查询
* 工单处理上传附件
*/
@PostMapping("/upLoadFile") @PostMapping("/upLoadFile")
public Map<String, Object> uploadFile(@RequestParam(name="file") MultipartFile file){ public ResultVO uploadFile(Long storeId, Long sourceId, FileInfo fileInfo, @RequestParam(name = "file") MultipartFile infile) {
Map<String, Object> resultMap = new HashMap<String, Object>();
try { try {
//上传url地址 //上传url地址
String path=fileurl+"/"+file.getOriginalFilename(); String filename = infile.getOriginalFilename() + "_" + DateUtil.format(new Date(), DatePattern.PURE_DATETIME_PATTERN);
java.io.File fileinfo=new java.io.File(path); // String path = fileurl + FileUtil.FILE_SEPARATOR + storeId + FileUtil.FILE_SEPARATOR + sourceId + FileUtil.FILE_SEPARATOR + filename;
String path = fileurl + FileUtil.FILE_SEPARATOR + filename;
file.transferTo(fileinfo); File file = FileUtil.touch(path);
infile.transferTo(file);
resultMap.put("msg_code", 200); String sha256 = SecureUtil.sha256(file).toUpperCase();
resultMap.put("fileUrl",path); String extName = FileUtil.extName(file);
return ResultUtil.success(path);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
resultMap.put("msg_code", 500);
resultMap.put("message",e.getMessage());
} }
return resultMap; return ResultUtil.success();
}
@GetMapping("/downLoadFile") /*String filename = infile.getOriginalFilename() + "_" + DateUtil.format(new Date(), DatePattern.PURE_DATETIME_PATTERN);
public void downLoadFile(@RequestParam(name="fileurl")String fileurl, String path = fileurl + FileUtil.FILE_SEPARATOR + fileInfo.getStoreId() + FileUtil.FILE_SEPARATOR + fileInfo.getSourceId() + FileUtil.FILE_SEPARATOR + filename;
@RequestParam(name="filename")String filename, // String path = fileurl + FileUtil.FILE_SEPARATOR + filename;
HttpServletResponse response){ File file = FileUtil.touch(path);
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition","attachment;filename="+filename);
java.io.File file=new java.io.File(fileurl);
try { try {
FileInputStream fis=new FileInputStream(file); infile.transferTo(file);
OutputStream os=response.getOutputStream();
byte[] buffer=new byte[1024];
int length;
while((length=fis.read(buffer))>0){
os.write(buffer,0,length);
}
fis.close();
os.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); throw new RuntimeException(e);
} }
fileInfo.setName(filename);
fileInfo.setUrl(path);
fileInfo.setType(FileUtil.extName(file));
fileInfo.setSha256(SecureUtil.sha256(file).toUpperCase());
// 如果是预工单的话,可能是客户上传的文件
// fileInfo.setUploader();
fileService.save(fileInfo);
return ResultUtil.success();*/
} }
public List<File> getFileList(Integer store_id,Integer source_id){ @PostMapping("/uploadFile1")
public String uploadFile1(FileInfo fileInfo, @RequestParam(name = "files") MultipartFile[] files) throws IOException {
QueryWrapper<File> wrapper=new QueryWrapper<>(); for (MultipartFile infile : files) {
if(store_id!=null) String orgName = infile.getOriginalFilename();
wrapper.eq("store_id",store_id); String fileName = orgName.substring(0, orgName.lastIndexOf("."));
if(source_id!=null) String fileExt = orgName.substring(orgName.lastIndexOf("."));
wrapper.eq("source_id",source_id); String filename = fileName + "_" + DateUtil.format(new Date(), "yyyyMMdd_HHmmss") + fileExt;
List<File> fileList=fileSerrvice.list(wrapper); String path = fileurl + FileUtil.FILE_SEPARATOR + fileInfo.getStoreId() + FileUtil.FILE_SEPARATOR + fileInfo.getSourceId() + FileUtil.FILE_SEPARATOR + filename;
File file = FileUtil.touch(path);
return fileList; infile.transferTo(file);
FileInfo tempFileInfo = new FileInfo();
tempFileInfo.setStoreId(fileInfo.getStoreId());
tempFileInfo.setSourceId(fileInfo.getSourceId());
tempFileInfo.setSourceType(fileInfo.getSourceType());
tempFileInfo.setName(filename);
tempFileInfo.setUrl(path);
tempFileInfo.setType(FileUtil.extName(file));
tempFileInfo.setSha256(SecureUtil.sha256(file).toUpperCase());
tempFileInfo.setUploader(fileInfo.getUploader());
fileService.save(tempFileInfo);
}
return "文件保存成功";
} }
} }
\ No newline at end of file \ No newline at end of file
package vion.controller; package vion.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import io.github.linpeilie.Converter;
import com.github.pagehelper.Page; import lombok.RequiredArgsConstructor;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import vion.Global; import vion.Global;
import vion.enums.ResultEnum; import vion.dto.InspectDTO;
import vion.model.Inspect; import vion.model.Inspect;
import vion.model.Store; import vion.service.IInspectService;
import vion.service.IInspectSerrvice;
import vion.utils.ResultUtil;
import java.util.Comparator;
import java.util.Date; import java.util.Date;
import java.util.List;
@RestController @RestController
@RequestMapping(Global.BASE_URL) @RequestMapping(Global.BASE_URL)
@RequiredArgsConstructor
@Slf4j @Slf4j
public class InspectController { public class InspectController {
@Autowired private final IInspectService inspectService;
private IInspectSerrvice inspectSerrvice; private final Converter converter;
@GetMapping("/inspects") @GetMapping("/inspects")
@ResponseBody public Page<Inspect> getInspectList(InspectDTO data) {
public Object getProductList(@RequestParam(name = "storeId",required=false)Integer store_id, return inspectService.getInspectList(data);
@RequestParam(name = "status",required=false)Integer status,
@RequestParam(name = "startdate",required=false)
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") Date startdate,
@RequestParam(name = "enddate",required=false)
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") Date enddate,
@RequestParam(name = "pageNum")Integer pageNum,
@RequestParam(name = "pageSize")Integer pageSize){
//pageNum当前页,pageSize每页条数
Page page= PageHelper.startPage(pageNum,pageSize);
QueryWrapper<Inspect> wrapper=new QueryWrapper<>();
if(store_id!=null)
wrapper.eq("store_id",store_id);
if(status!=null)
wrapper.eq("status",status);
if(startdate!=null)
wrapper.between("inspect_date",startdate,enddate);
List<Inspect> inspectList=inspectSerrvice.list(wrapper);
inspectList.sort(Comparator.comparing(Inspect::getId));
PageInfo pageInfo=new PageInfo<>(page);
pageInfo.setList(inspectList);
if (inspectList != null) {
return ResultUtil.success(pageInfo);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
} }
@GetMapping("/inspect") @GetMapping("/inspect")
@ResponseBody public Inspect getProductByID(@RequestParam(name = "id") Integer id) {
public Object getProductByID(@RequestParam(name = "id")Integer id){ return inspectService.getById(id);
Inspect inspect=inspectSerrvice.getById(id);
if (inspect != null) {
return ResultUtil.success(inspect);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
} }
@PostMapping("/inspects") @PostMapping("/inspects")
@ResponseBody public String saveOrUpdate(@RequestBody InspectDTO data) {
public Object saveOrUpdate(@RequestBody Inspect data) { Inspect inspect = converter.convert(data, new Inspect());
return inspectService.saveOrUpdate(inspect) ? "成功" : "失败";
try {
if(data.getId()==null){
inspectSerrvice.save(data);
return ResultUtil.success();
}else{
data.setModifyTime(new Date());
Inspect inspect=inspectSerrvice.saveAndReturn(data);
return ResultUtil.success(inspect);
}
}catch (Exception e) {
// return ResultUtil.error(ResultEnum.SELECT_ERROR);
return e.getMessage().toString();
}
} }
@PostMapping("/updateInspectStatus") @PostMapping("/updateInspectStatus")
@ResponseBody public String UpdateStatus(@RequestBody InspectDTO data) {
public Object UpdateStatus(@RequestBody Inspect data) { boolean result = inspectService.lambdaUpdate()
.eq(Inspect::getId, data.getId())
Date current=new Date(); .set(Inspect::getStatus, data.getStatus())
.set(Inspect::getAuditTime, new Date())
UpdateWrapper updateWrapper=new UpdateWrapper(); .set(Inspect::getReviewer, data.getReviewer())
updateWrapper.eq("id",data.getId()); //审核状态为已完成的时候更新完成时间(0进行中、1待审核、2已完成、3、驳回)
updateWrapper.set("status",data.getStatus()); .set(data.getStatus() == 2, Inspect::getFinishTime, new Date())
updateWrapper.set("modify_time",current); .update();
updateWrapper.set("audit_date",current); if (result) {
updateWrapper.set("reviewer",data.getReviewer()); return "更新巡检状态成功";
//审核状态为已完成的时候更新完成时间(0进行中、1待审核、2已完成、3、驳回) } else {
if(data.getStatus()==2){ return "更新巡检状态失败";
updateWrapper.set("finish_date",current);
}else{
updateWrapper.set("finish_date",null);
}
boolean result= inspectSerrvice.update(updateWrapper);
if(result){
return ResultUtil.success();
}else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
} }
} }
} }
package vion.controller; package vion.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.github.pagehelper.Page; import io.github.linpeilie.Converter;
import com.github.pagehelper.PageHelper; import lombok.RequiredArgsConstructor;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import vion.Global; import vion.Global;
import vion.enums.ResultEnum; import vion.dto.ProductDTO;
import vion.model.Product; import vion.model.Product;
import vion.model.Store; import vion.service.IProductService;
import vion.service.IProductSerrvice;
import vion.service.IStoreSerrvice;
import vion.utils.ResultUtil;
import vion.vo.ProductVO; import vion.vo.ProductVO;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@RestController @RestController
@RequestMapping(Global.BASE_URL) @RequestMapping(Global.BASE_URL)
@RequiredArgsConstructor
@Slf4j @Slf4j
public class ProductController { public class ProductController {
@Autowired private final IProductService productService;
private IProductSerrvice productSerrvice; private final Converter converter;
@Autowired
private IStoreSerrvice storeSerrvice;
@GetMapping("/products") @GetMapping("/products")
@ResponseBody public Page<ProductVO> getProductList(ProductDTO productDTO) {
public Object getProductList(@RequestParam(name = "accountId",required=false)Integer account_id, return productService.getProductList(productDTO);
@RequestParam(name = "storeId",required=false)Integer store_id,
@RequestParam(name = "name",required=false)String name,
@RequestParam(name = "brand",required=false)Integer brand,
@RequestParam(name = "functionary",required=false)Integer functionary,
@RequestParam(name = "pageNum")Integer pageNum,
@RequestParam(name = "pageSize")Integer pageSize){
//pageNum当前页,pageSize每页条数
Page page= PageHelper.startPage(pageNum,pageSize);
QueryWrapper<Product> wrapper=new QueryWrapper<>();
if(store_id!=null){
wrapper.eq("store_id",store_id);
}
if(account_id!=null)
wrapper.eq("account_id",account_id);
if(name!=null)
wrapper.eq("name",name);
if(brand!=null)
wrapper.eq("brand",brand);
if(functionary!=null)
wrapper.eq("functionary",functionary);
List<Product> productList=productSerrvice.list(wrapper);
List<Store> storeList=storeSerrvice.list();
List<ProductVO> productVOS=new ArrayList<>();
ProductVO productVO;
for(Product pro:productList){
productVO=new ProductVO();
productVO.setStoreName(storeList.stream().filter(store -> store.getId().equals(pro.getStoreId())).collect(Collectors.toList()).get(0).getName());
productVO.setId(pro.getId());
productVO.setStoreId(pro.getStoreId());
productVO.setMaterialNo(pro.getMaterialNo());
productVO.setName(pro.getName());
productVO.setFunctionary(pro.getFunctionary());
productVO.setBrand(pro.getBrand());
productVO.setProductCount(pro.getProductCount());
productVO.setProductPrice(pro.getProductPrice());
productVO.setProductTotalPrice(pro.getProductTotalPrice());
productVO.setProductSubtotal(pro.getProductSubtotal());
productVO.setCreateTime(pro.getCreateTime());
productVO.setModifyTime(pro.getModifyTime());
productVO.setRemark(pro.getRemark());
productVO.setAccountId(pro.getAccountId());
productVOS.add(productVO);
}
productVOS.sort(Comparator.comparing(ProductVO::getId));
PageInfo pageInfo=new PageInfo<>(page);
pageInfo.setList(productList);
if (pageInfo != null) {
return ResultUtil.success(pageInfo);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
} }
@GetMapping("/product") @GetMapping("/product")
@ResponseBody public Product getProductByID(@RequestParam Long projectId) {
public Object getProductByID(@RequestParam(name = "projectId")Integer project_id){ return productService.getById(projectId);
Product product=productSerrvice.getById(project_id);
if (product != null) {
return ResultUtil.success(product);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
} }
@PostMapping("/products") @PostMapping("/products")
@ResponseBody public String saveOrUpdate(@RequestBody ProductDTO productDTO) {
public Object saveOrUpdate(@RequestBody Product data) { Product data = converter.convert(productDTO, new Product());
return productService.saveOrUpdate(data) ? "成功" : "失败";
try {
if(data.getId()==null){
productSerrvice.save(data);
return ResultUtil.success();
}else{
data.setModifyTime(new Date());
Product product=productSerrvice.saveAndReturn(data);
return ResultUtil.success(product);
}
}catch (Exception e) {
//return ResultUtil.error(ResultEnum.SELECT_ERROR);
return e.getMessage().toString();
}
} }
} }
\ No newline at end of file \ No newline at end of file
package vion.controller;
import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.IdUtil;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import vion.dto.ServiceOrderDTO;
import vion.model.Dictionary;
import vion.model.ServiceOrder;
import vion.service.IDictionaryService;
import vion.service.IServiceOrderService;
import vion.vo.ServiceOrderVO;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 服务单
*
* @author HlQ
* @date 2023/11/21
*/
@RestController
@RequestMapping("/api")
@RequiredArgsConstructor
public class ServiceOrderController {
private final IServiceOrderService serviceOrderService;
private final IDictionaryService dictionaryService;
private final Converter converter;
@GetMapping("/order/{id}")
public ServiceOrder getOrderById(@PathVariable Long id) {
return serviceOrderService.getById(id);
}
@PostMapping("/order")
private Object save(@RequestBody ServiceOrderDTO serviceOrderDTO) {
Long count = serviceOrderService.lambdaQuery().eq(ServiceOrder::getTaskId, serviceOrderDTO.getTaskId()).count();
Assert.isFalse(count > 0, "该工单已存在服务单,不能重复创建!");
ServiceOrder serviceOrder = converter.convert(serviceOrderDTO, new ServiceOrder());
serviceOrder.setUnid(IdUtil.nanoId());
return serviceOrderService.save(serviceOrder) ? serviceOrder.getId() : "创建失败";
}
@PostMapping("/order/{id}")
private String update(@PathVariable Long id, @RequestBody ServiceOrderDTO serviceOrderDTO) {
ServiceOrder serviceOrder = converter.convert(serviceOrderDTO, new ServiceOrder());
serviceOrder.setId(id);
return serviceOrderService.updateById(serviceOrder) ? "更新成功" : "更新失败";
}
@DeleteMapping("/order/{id}")
private String remove(@PathVariable Long id) {
return serviceOrderService.removeById(id) ? "删除成功" : "删除失败";
}
@GetMapping("/order/sign/{unid}")
public ServiceOrderVO getOrderByUnid(@PathVariable String unid) {
// todo 字典加入缓存
List<Dictionary> dictionaryList = dictionaryService.lambdaQuery().eq(Dictionary::getType, "service_type").list();
Map<Integer, String> serviceTypeMap = dictionaryList.stream().collect(Collectors.toMap(Dictionary::getKey, Dictionary::getValue));
ServiceOrder order = serviceOrderService.lambdaQuery().eq(ServiceOrder::getUnid, unid).one();
ServiceOrderVO vo = converter.convert(order, new ServiceOrderVO());
vo.setServiceType(serviceTypeMap.get(order.getServiceType()));
return vo;
}
/**
* 签字专用更新接口
*
* @param unid 服务单unid
* @param serviceOrderDTO dto
* @return java.lang.String
*/
@PostMapping("/order/sign/{unid}")
public String updateByUnid(@PathVariable String unid, @RequestBody ServiceOrderDTO serviceOrderDTO) {
ServiceOrder serviceOrder = converter.convert(serviceOrderDTO, new ServiceOrder());
return serviceOrderService.lambdaUpdate().eq(ServiceOrder::getUnid, unid).update(serviceOrder) ? "提交成功" : "提交失败";
}
@GetMapping("/order/pushWechat")
public String sendOrder(Long id) {
return serviceOrderService.sendOrder(id);
}
}
package vion.controller; package vion.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import lombok.RequiredArgsConstructor;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.bouncycastle.util.test.Test; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.RestController;
import vion.Global; import vion.Global;
import vion.enums.ResultEnum; import vion.dto.TaskTempDTO;
import vion.model.File; import vion.service.ITaskTempService;
import vion.model.Store;
import vion.model.TaskTemp;
import vion.service.IFileSerrvice;
import vion.service.ITaskTempSerrvice;
import vion.utils.ResultUtil;
import vion.vo.TaskTempVO; import vion.vo.TaskTempVO;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
@RestController @RestController
@RequestMapping(Global.BASE_URL) @RequestMapping(Global.BASE_URL)
@RequiredArgsConstructor
@Slf4j @Slf4j
public class TaskTempController { public class TaskTempController {
@Autowired private final ITaskTempService taskTempService;
private ITaskTempSerrvice taskTempSerrvice;
@Autowired
private IFileSerrvice fileSerrvice;
@Autowired
private FileController fileController;
@GetMapping("/taskTemps") @GetMapping("/taskTemps")
@ResponseBody public Page<TaskTempVO> getTaskTempList(TaskTempDTO data) {
public Object getTaskTempList(@RequestParam(name = "storeName",required=false)String store_name, return taskTempService.getTaskTempList(data);
@RequestParam(name = "storeId",required=false)Integer store_id,
@RequestParam(name = "startdate",required=false)
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") Date startdate,
@RequestParam(name = "enddate",required=false)
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss") Date enddate,
@RequestParam(name = "status",required=false)Integer status,
@RequestParam(name = "pageNum")Integer pageNum,
@RequestParam(name = "pageSize")Integer pageSize){
//pageNum当前页,pageSize每页条数
Page page= PageHelper.startPage(pageNum,pageSize);
QueryWrapper<TaskTemp> wrapper=new QueryWrapper<>();
if(store_id!=null)
wrapper.eq("store_id",store_id);
if(store_name!=null)
wrapper.like("store_name",store_name);
if(status!=null)
wrapper.eq("status",status);
if(startdate!=null)
wrapper.between("repair_date",startdate,enddate);
List<TaskTemp> taskTempList= taskTempSerrvice.list(wrapper);
taskTempList.sort(Comparator.comparing(TaskTemp::getId));
PageInfo pageInfo=new PageInfo<>(page);
pageInfo.setList(taskTempList);
if (pageInfo != null) {
return ResultUtil.success(pageInfo);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
} }
@GetMapping("/taskTemp") @GetMapping("/taskTemp")
@ResponseBody public TaskTempVO getTaskTempById(Long id) {
public Object getTaskTempByID(@RequestParam(name = "id")Integer id){ return taskTempService.getTaskTempById(id);
TaskTemp taskTemp = taskTempSerrvice.getById(id);
TaskTempVO taskTempVO=new TaskTempVO();
List<File> files=fileController.getFileList(taskTemp.getStoreId(),taskTemp.getId());
taskTempVO.setId(taskTemp.getId());
taskTempVO.setStoreName(taskTemp.getStoreName());
taskTempVO.setRepairDate(taskTemp.getRepairDate());
taskTempVO.setFaultDescription(taskTemp.getFaultDescription());
taskTempVO.setRepairPeople(taskTemp.getRepairPeople());
taskTempVO.setRepairPhone(taskTemp.getRepairPhone());
taskTempVO.setStatus(taskTemp.getStatus());
taskTempVO.setCreateTime(taskTemp.getCreateTime());
taskTempVO.setFileList(files);
if (taskTempVO != null) {
return ResultUtil.success(taskTempVO);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
} }
@PostMapping("/taskTemps") @PostMapping("/taskTemp")
@ResponseBody public String saveOrUpdateTaskTemp(TaskTempDTO data) {
public Object saveOrUpdateTaskTemp(@RequestBody TaskTempVO data) { return taskTempService.saveOrUpdTaskTemp(data);
try {
TaskTemp taskTemp=new TaskTemp();
taskTemp.setStoreName(data.getStoreName());
taskTemp.setRepairPeople(data.getRepairPeople());
taskTemp.setRepairPhone(data.getRepairPhone());
taskTemp.setRepairDate(data.getRepairDate());
taskTemp.setFaultDescription(data.getFaultDescription());
TaskTemp saveTaskTemp= taskTempSerrvice.saveAndReturn(taskTemp);
if(saveTaskTemp!=null){
if(data.getFileList()!=null){
File file;
for(File fileModel:data.getFileList()){
file=new File();
file.setId(fileModel.getId());
file.setStoreId(0);
file.setSourceId(saveTaskTemp.getId());
file.setSourceType(2);//1项目、2工单预处理,3工单操作,4巡检
file.setName(fileModel.getName());
file.setUrl(fileModel.getUrl());
file.setType(fileModel.getType());
fileSerrvice.saveOrUpdate(file);
}
}
}
return ResultUtil.success();
}catch (Exception e) {
//return ResultUtil.error(ResultEnum.SELECT_ERROR);
return e.getMessage();
}
} }
@PostMapping("/updateTaskTempStatus")
@ResponseBody
public Object updateStoreStage(@RequestBody TaskTemp taskTemp) {
//更新预处理工单状态
UpdateWrapper updateWrapper=new UpdateWrapper();
updateWrapper.eq("id", taskTemp.getId());
updateWrapper.set("status",2);//状态(1待确认、2已确认)
updateWrapper.set("operator",taskTemp.getOperator());
updateWrapper.set("store_id",taskTemp.getStoreId());
updateWrapper.set("modify_time",new Date());
boolean result= taskTempSerrvice.update(updateWrapper);
//根据预处理工单跟新附件的门店ID
fileSerrvice.lambdaUpdate()
.setSql("store_id="+taskTemp.getStoreId())
.eq(File::getSourceId,taskTemp.getId())
.update();
if(result){
return ResultUtil.success();
}else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
}
} }
package vion.cron;
import cn.hutool.core.date.DateUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import vion.ding.DingMod;
import vion.model.Task;
import vion.model.User;
import vion.service.ITaskService;
import vion.service.IUserService;
import java.util.List;
/**
* @author HlQ
* @date 2023/11/13
*/
@Component
@RequiredArgsConstructor
@Slf4j
public class TaskRunner {
private final IUserService userService;
private final ITaskService taskService;
private final DingMod dingMod;
@Scheduled(cron = "0 0 17 * * ?")
void pushUndoneTask() {
log.info("开始推送未完成工单");
List<Task> taskList = taskService.list(Wrappers.<Task>lambdaQuery().notIn(Task::getStatus, 3, 5));
// todo 需要异步发送吗?
taskList.forEach(task -> {
Long activeUser = task.getActiveUser();
User user = userService.lambdaQuery().eq(User::getId, activeUser).one();
dingMod.sendMessage(buildMsg(user));
});
log.info("推送未完成工单完成");
}
JSONObject buildMsg(User user) {
JSONObject jsonObj = new JSONObject();
jsonObj.set("agent_id", 2358374016L);
jsonObj.set("userid_list", user.getUserid());
JSONObject msg = new JSONObject();
JSONObject content = new JSONObject();
content.set("title", "请查看您未完成的工单~_~");
content.set("markdown", "请查看您未完成的工单" +
" \n 发送时间:" + DateUtil.now());
content.set("btn_orientation", "1");
JSONArray jsonArray = new JSONArray();
jsonArray.add(new JSONObject().set("title", "查看详情").set("action_url", "https://oapi.dingtalk.com/connect/oauth2/sns_authorize?appid=dingkrzwks0jpi2di3uo&response_type=code&scope=snsapi_auth&state=STATE&redirect_uri=https%3A%2F%2Fyunwei.vionyun.com%3A8443%2Fyunwei%2Fapi%2Fding%2Fcallback%2Finside%3FuserId%3D" + user.getId()));
content.set("btn_json_list", jsonArray);
msg.set("msgtype", "action_card");
msg.set("action_card", content);
jsonObj.set("msg", msg);
return jsonObj;
}
}
\ No newline at end of file \ No newline at end of file
package vion.ding;
import cn.hutool.core.util.StrUtil;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import me.chanjar.weixin.common.api.WxConsts;
import me.chanjar.weixin.common.bean.WxOAuth2UserInfo;
import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;
import me.chanjar.weixin.common.error.WxErrorException;
import me.chanjar.weixin.mp.api.WxMpService;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateMessage;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.ModelAndView;
import java.util.List;
/**
* @author HlQ
* @date 2023/11/21
*/
@Component
@RequiredArgsConstructor
@Slf4j
public class WechatMod {
private final WxMpService wxMpService;
/**
* 微信扫码获取用户 openid
*
* @param code
* @return java.lang.Object
*/
public Object wechatCallback(String code) {
try {
WxOAuth2AccessToken accessToken = wxMpService.getOAuth2Service().getAccessToken(code);
WxOAuth2UserInfo wxMpUser = wxMpService.getOAuth2Service().getUserInfo(accessToken, null);
return wxMpUser.getOpenid();
} catch (WxErrorException e) {
log.error("调用微信接口异常!", e);
}
return new ModelAndView("weChatError");
}
/**
* 生成微信网页授权链接
* @param taskTempId 预工单 id
* @return java.lang.String
*/
public String genCodeUrl(Long taskTempId) {
String url = StrUtil.format("https://yunwei.vionyun.com/yunwei/api/wechat/callback?taskTempId={}", taskTempId);
return wxMpService.getOAuth2Service().buildAuthorizationUrl(url, WxConsts.OAuth2Scope.SNSAPI_USERINFO, null);
}
public String sendMsg(String templateId, String openId, List<WxMpTemplateData> wxMpTemplateDataList, String url) {
try {
WxMpTemplateMessage templateMessage = WxMpTemplateMessage.builder()
.toUser(openId)
.templateId(templateId)
.data(wxMpTemplateDataList)
.url(url)
.build();
String s = wxMpService.getTemplateMsgService().sendTemplateMsg(templateMessage);
log.info("微信消息推送成功,msgid:{}", s);
return "微信公众号消息推送成功";
} catch (WxErrorException e) {
log.error("调用微信接口发送模板消息异常!", e);
}
return "微信公众号消息推送失败";
}
}
package vion.dto;
import lombok.Getter;
import lombok.Setter;
/**
* @author HlQ
* @date 2023/11/24
*/
@Getter
@Setter
public class BaseDTO {
private Integer pageNum = 1;
private Integer pageSize = 10;
}
package vion.dto;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class DictionaryDTO extends BaseDTO {
private Long id;
private String type;
private Integer key;
private String value;
private String remark;
}
package vion.dto;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class DictionaryTypeDTO extends BaseDTO {
private Long id;
private String name;
private String type;
private String remark;
}
package vion.dto;
import lombok.Getter;
import lombok.Setter;
/**
* @author HlQ
* @date 2023/11/25
*/
@Getter
@Setter
public class DingDTO {
/** 微信拼接的两个 code 参数 */
private String authCode;
private String code;
/** 项目id */
private Long storeId;
/** 工单id */
private Long taskId;
/** 预工单id */
private Long taskTempId;
/** 用户id */
private Long userId;
}
package vion.dto;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class FileInfoDTO extends BaseDTO {
private Long id;
/** 门店id */
private Long storeId;
/** 文件扩展名 */
private String type;
/** 文件来源(1项目、2工单预处理,3工单操作,4巡检) */
private Integer sourceType;
/** 文件来源id */
private Long sourceId;
/** 文件名称 */
private String name;
/** 文件地址 */
private String url;
/** 备注 */
private String remark;
/** sha256 */
private String sha256;
/** 上传人 */
private String uploader;
}
package vion.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Getter
@Setter
public class InspectDTO extends BaseDTO {
/** 自增列 */
private Long id;
/** 门店id */
private Long storeId;
/** 巡检时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date inspectTime;
/** 巡检方式(0远程、1现场) */
private Integer type;
/** 状态(0进行中、1待审核、2已完成、3、驳回) */
private Integer status;
/** 巡检人 */
private Integer inspectUser;
/** 审核人 */
private Integer reviewer;
/** 巡检时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date finishTime;
/** 审核时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date auditTime;
/** 备注 */
private String remark;
/** 集团id */
private Long accountId;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startdate;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date enddate;
}
package vion.dto;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class ProductDTO extends BaseDTO {
private Long id;
/** 物料编号 */
private String materialNo;
/** 门店id */
private Long storeId;
/** 门店名称 */
private String storeName;
/** 产品名称 */
private String name;
/** 产品型号 */
private Integer functionary;
/** 品牌 */
private Integer brand;
/** 订货数量 */
private Integer productCount;
/** 订货单价 */
private Float productPrice;
/** 定后价小计(单价乘以数量) */
private Float productSubtotal;
/** 订货总价 */
private Float productTotalPrice;
/** 备注 */
private String remark;
/** 集团id */
private Long accountId;
}
package vion.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import java.util.Date;
/**
* @author HlQ
* @date 2023/11/23
*/
@Getter
@Setter
public class ServiceOrderDTO extends BaseDTO {
/** 项目名称 */
private String projectName;
/** 报修人 */
private String submitter;
/** 报修人手机号码 */
private String submitPhone;
/** 报修时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date submitTime;
/** 维修人 */
private String repairPeople;
/** 维修人手机号码*/
private String repairPhone;
/** 部门 */
private String dept;
/** 服务方式(1.电话支持 2.远程服务 3.现场服务) */
private Integer serviceType;
/** 耗时 */
private Double time;
/** 故障内容 */
private String faultContent;
/** 维修结果 */
private String repairRes;
/** 客户评价 */
private String review;
/** 工单id */
private Long taskId;
/** 服务单状态 */
private Integer state;
/** 五星好评 */
private Integer stars;
/** 签字图片base64 */
private String signPic;
/** 签字时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date signTime;
/** 完成时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date finishTime;
}
package vion.dto;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;
@Data
public class StatusDTO {
/** 门店id */
private Long storeId;
/** 阶段 */
private Integer projectStage;
/** 文件来源 */
private Integer sourceType;
/** 来源id */
private Long sourceId;
/** 文件类型 */
private Integer type;
/** 名称 */
private String name;
/** 地址 */
private String url;
private MultipartFile[] files;
}
package vion.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 门店信息
*/
@Getter
@Setter
public class StoreDTO extends BaseDTO {
private Long id;
private String storenum;
/** 门店名称 */
private String name ;
/** 流水号 */
private String number;
/** 合同编码 */
private String contractCode;
/** 合同金额 */
private Float amount;
/** 签订日期 */
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date orderdate;
/** 销售人 */
private Integer salesperson;
/** 质保期 */
private Integer warrantyPeriod;
/** 客户姓名 */
private String customerName;
/** 实施类型:0纯供货、1供货+安装、3续保、4维修 */
private Integer implementType;
/** 项目状态:0待确认、1进行中、2已完成、3挂起 */
private Integer projectState;
/** 联系人(多个联系人逗号隔开) */
private String contacts;
/** 创建者 */
private Long createUser;
/** 修改者 */
private Long modifyUser;
/** 备注 */
private String remark;
/** 项目阶段 */
private Integer projectStage;
/** 集团id */
private Long accountId;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startdate;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date enddate;
}
package vion.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.multipart.MultipartFile;
import java.util.Date;
@Getter
@Setter
public class TaskDTO extends BaseDTO {
private Long id;
/** 门店id */
private Long storeId;
/** 报修日期 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date repairTime;
/** 故障类型 */
private Integer faultType;
/** 故障说明 */
private String faultDescription;
/** 报修人 */
private String repairPeople;
/** 报修人联系方式 */
private String repairPhone;
/** 状态:0待确认1进行中2已完成3挂起 */
private Integer status;
/** 解决日期 */
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date solveDate;
/** 故障原因 */
private String faultReason;
/** 解决措施:0产品BUG、1使用问题、2需求问题 */
private Integer solveType;
/** 解决故障描述 */
private String solveDescription;
/** 创建者 */
private Long createUser;
/** 当前处理人 */
private Long activeUser;
/** 截止日期 */
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date expDate;
/** 备注 */
private String remark;
/** 集团id */
private Long accountId;
private String uuid;
/** 预工单id */
private Long tasktempId;
private MultipartFile[] files;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startdate;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date enddate;
@DateTimeFormat(pattern = "yyyy-MM-dd")
private Date curDate;
}
package vion.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.multipart.MultipartFile;
import vion.model.FileInfo;
import java.util.Date;
import java.util.List;
@Getter
@Setter
public class TaskTempDTO extends BaseDTO {
private Long id;
private Long storeId;
/** 项目名称 */
private String storeName;
/** 报修日期 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date repairTime;
/** 故障说明 */
private String faultDescription;
/** 报修人 */
private String repairPeople;
/** 联系方式 */
private String repairPhone;
/** 状态(1待确认、2已确认) */
private Integer status;
/** 附件信息 */
private List<FileInfo> fileList;
private String remark;
private MultipartFile[] files;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startdate;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date enddate;
}
package vion.interceptor; package vion.interceptor;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.Opt; import cn.hutool.core.lang.Opt;
import com.alibaba.fastjson.JSON; import cn.hutool.json.JSONObject;
import com.alibaba.fastjson.JSONObject; import org.springframework.stereotype.Component;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.springframework.web.servlet.HandlerInterceptor;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
import vion.Global; import vion.Global;
import vion.enums.ResultEnum; import vion.enums.ResultEnum;
import vion.model.User; import vion.model.User;
import vion.service.IUserSerrvice;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
public class Interceptor extends HandlerInterceptorAdapter { @Component
public class Interceptor implements HandlerInterceptor {
@Override @Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
String url = request.getRequestURI(); String url = request.getRequestURI();
System.out.println("拦截器"); if (url.indexOf("login") >= 0) {
if(url.indexOf("login") >= 0){
return true; return true;
} }
User user= Global.USERNAME_MAP.get(request.getHeader("userid")); User user = Opt.ofBlankAble(request.getHeader("token")).map(Global.USERNAME_MAP::get).orElse(null);
if(user==null){ if (user == null) {
response.reset(); response.reset();
response.setCharacterEncoding("UTF-8"); response.setCharacterEncoding("UTF-8");
response.setContentType("application/json;charset=UTF-8"); response.setContentType("application/json;charset=UTF-8");
PrintWriter pw = response.getWriter(); PrintWriter pw = response.getWriter();
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
jsonObject.put("msg_code", ResultEnum.ATOKEN_ERROR.getCode()); jsonObject.set("code", ResultEnum.ATOKEN_ERROR.getCode());
jsonObject.put("msg_info", "请先登陆再访问!"); jsonObject.set("msg", "请先登陆再访问!");
pw.write(JSON.toJSONString(jsonObject)); pw.write(jsonObject.toString());
pw.flush(); pw.flush();
pw.close(); pw.close();
return false; return false;
} else {
request.setAttribute("start", System.currentTimeMillis());
return true;
} }
request.setAttribute("userid", user.getUserid());
request.setAttribute("start", System.currentTimeMillis());
return super.preHandle(request, response, handler);
} }
} }
package vion.interceptor; package vion.interceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import javax.annotation.Resource;
@Configuration @Configuration
public class InterceptorConfig implements WebMvcConfigurer { public class InterceptorConfig implements WebMvcConfigurer {
@Bean @Resource
public Interceptor interceptor() { private Interceptor interceptor;
return new Interceptor();
}
@Override
public void addInterceptors(InterceptorRegistry registry){
registry.addInterceptor(interceptor()).addPathPatterns("/api/**").excludePathPatterns("/api/login") @Override
.excludePathPatterns("/error");//.excludePathPatterns("/api/downLoadFile"); public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(interceptor)
.addPathPatterns("/api/**")
.excludePathPatterns("/api/taskTemp", "/api/upLoadFile", "/api/ding/callback/**", "/api/wechat/**", "/error")
.excludePathPatterns("/api/order/sign/*");
} }
} }
package vion.mapper; package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import vion.model.Account; import vion.model.Account;
@Mapper
public interface AccountMapper extends BaseMapper<Account> { public interface AccountMapper extends BaseMapper<Account> {
} }
package vion.mapper; package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import vion.model.Account;
import vion.model.Address; import vion.model.Address;
@Mapper
public interface AddressMapper extends BaseMapper<Address> { public interface AddressMapper extends BaseMapper<Address> {
} }
package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import vion.model.Dept;
/**
* @author HlQ
* @date 2023/11/10
*/
public interface DeptMapper extends BaseMapper<Dept> {
}
package vion.mapper; package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import vion.model.Address;
import vion.model.Dictionary; import vion.model.Dictionary;
@Mapper
public interface DictionaryMapper extends BaseMapper<Dictionary> { public interface DictionaryMapper extends BaseMapper<Dictionary> {
} }
package vion.mapper; package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import vion.model.Address;
import vion.model.DictionaryType; import vion.model.DictionaryType;
@Mapper
public interface DictionaryTypeMapper extends BaseMapper<DictionaryType> { public interface DictionaryTypeMapper extends BaseMapper<DictionaryType> {
} }
package vion.mapper; package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import vion.model.Address;
import vion.model.FaultLog; import vion.model.FaultLog;
@Mapper
public interface FaultLogMapper extends BaseMapper<FaultLog> { public interface FaultLogMapper extends BaseMapper<FaultLog> {
} }
package vion.mapper; package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import vion.model.FileInfo;
import vion.model.Address; public interface FileMapper extends BaseMapper<FileInfo> {
import vion.model.File;
@Mapper
public interface FileMapper extends BaseMapper<File> {
} }
package vion.mapper; package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import vion.model.Address;
import vion.model.Inspect; import vion.model.Inspect;
@Mapper
public interface InspectMapper extends BaseMapper<Inspect> { public interface InspectMapper extends BaseMapper<Inspect> {
} }
package vion.mapper; package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import vion.model.Address;
import vion.model.Product; import vion.model.Product;
@Mapper
public interface ProductMapper extends BaseMapper<Product> { public interface ProductMapper extends BaseMapper<Product> {
} }
package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import vion.model.ServiceOrder;
/**
* @author HlQ
* @date 2023/11/21
*/
public interface ServiceOrderMapper extends BaseMapper<ServiceOrder> {
}
package vion.mapper; package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import vion.model.Product;
import vion.model.Store; import vion.model.Store;
@Mapper
public interface StoreMapper extends BaseMapper<Store> { public interface StoreMapper extends BaseMapper<Store> {
} }
package vion.mapper; package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import vion.model.Product;
import vion.model.Task; import vion.model.Task;
@Mapper
public interface TaskMapper extends BaseMapper<Task> { public interface TaskMapper extends BaseMapper<Task> {
} }
package vion.mapper; package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import vion.model.TaskTemp; import vion.model.TaskTemp;
@Mapper
public interface TaskTempMapper extends BaseMapper<TaskTemp> { public interface TaskTempMapper extends BaseMapper<TaskTemp> {
} }
package vion.mapper; package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import vion.model.Product;
import vion.model.User; import vion.model.User;
@Mapper
public interface UserMapper extends BaseMapper<User> { public interface UserMapper extends BaseMapper<User> {
} }
package vion.model; package vion.model;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
/**
* 集团信息
*/
import java.util.Date; import java.util.Date;
@Data @Data
@TableName(value="tbl_account_info") @TableName(value="tbl_account_info")
public class Account { public class Account {
/** 自增列 */
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Integer id;//自增列 private Long id;
private String name;//名称 /** 名称 */
private String name;
private Date createTime;//创建时间 /** 创建时间 */
@TableField(value = "create_time", fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
private Date modifyTime;//修改时间 /** 修改时间 */
@TableField(value = "modify_time", fill = FieldFill.INSERT_UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date modifyTime;
private String remark;//备注 /** 备注 */
private String remark;
} }
...@@ -12,8 +12,8 @@ import lombok.Data; ...@@ -12,8 +12,8 @@ import lombok.Data;
@TableName(value="tbl_address_info") @TableName(value="tbl_address_info")
public class Address { public class Address {
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Integer id;//自增列 private Long id;//自增列
private Integer storeId;//门店编码(外键) private Long storeId;//门店编码
private String consigneeName;//收货名称 private String consigneeName;//收货名称
private String consigneePhone;//收货手机号 private String consigneePhone;//收货手机号
private String consigneeAddress;//收货地址 private String consigneeAddress;//收货地址
......
package vion.model;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
@Data
@TableName(value="tbl_dept_info")
public class Dept {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
private Long deptId;
private String deptName;
private Long parentId;
@TableField(value = "create_time", fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@TableField(value = "modify_time", fill = FieldFill.INSERT_UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date modifyTime;
}
\ No newline at end of file \ No newline at end of file
package vion.model; package vion.model;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.TableId; import com.fasterxml.jackson.annotation.JsonFormat;
import com.baomidou.mybatisplus.annotation.TableName; import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import lombok.Data; import lombok.Data;
import vion.dto.DictionaryDTO;
import java.util.Date;
@Data @Data
@TableName(value="tbl_dictionary_info") @TableName(value="tbl_dictionary_info")
@AutoMappers({
@AutoMapper(target = DictionaryDTO.class),
})
public class Dictionary { public class Dictionary {
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Integer id; private Long id;
private String type; private String type;
private Integer key; private Integer key;
private String value; private String value;
private String remark; private String remark;
/** 创建时间 */
@TableField(value = "create_time", fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/** 更新时间 */
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
} }
package vion.model; package vion.model;
import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.*;
import com.baomidou.mybatisplus.annotation.TableId; import com.fasterxml.jackson.annotation.JsonFormat;
import com.baomidou.mybatisplus.annotation.TableName; import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import lombok.Data; import lombok.Data;
import vion.dto.DictionaryTypeDTO;
import java.util.Date;
@Data @Data
@TableName(value="tbl_dictionary_type") @TableName(value="tbl_dictionary_type")
@AutoMappers({
@AutoMapper(target = DictionaryTypeDTO.class),
})
public class DictionaryType { public class DictionaryType {
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Integer id; private Long id;
private String name; private String name;
private String type; private String type;
private String remark; private String remark;
/** 创建时间 */
@TableField(value = "create_time", fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/** 更新时间 */
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
} }
package vion.model; package vion.model;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data; import lombok.Data;
import vion.vo.FaultLogVO;
import java.util.Date; import java.util.Date;
...@@ -10,13 +13,24 @@ import java.util.Date; ...@@ -10,13 +13,24 @@ import java.util.Date;
*/ */
@Data @Data
@TableName(value="tbl_fault_log") @TableName(value="tbl_fault_log")
@AutoMapper(target = FaultLogVO.class)
public class FaultLog { public class FaultLog {
/** 自增列 */
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Integer id;//自增列 private Long id;
private Integer storeId;//门店id(外键) /** 门店id */
private Integer taskId;//工单id(外键) private Long storeId;
private Integer operator;//操作者 /** 工单id */
private String content;//操作内容 private Long taskId;
private Date createTime;//创建时间 /** 操作者 */
private String remark;//备注 private Long operator;
/** 操作内容 */
private String content;
/** 创建时间 */
@TableField(value = "create_time", fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/** 备注 */
private String remark;
} }
package vion.model;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
/**
* 文件信息
*/
@Data
@TableName(value="tbl_file_info")
public class File {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;//自增列
private Integer storeId;//门店id(外键)
private Integer type;//文件类型(1图片 2文件)
private Integer sourceType;//文件来源(项目、工单预处理,工单操作,巡检)
private Integer sourceId;//文件来源id
private String name;//文件名称
private String url;//文件地址
private Date createTime;//创建时间
private String remark;//备注
}
package vion.model;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import lombok.Data;
import vion.dto.FileInfoDTO;
import java.util.Date;
/**
* 文件信息
*/
@Data
@TableName(value="tbl_file_info")
@AutoMappers({
@AutoMapper(target = FileInfoDTO.class),
})
public class FileInfo {
@TableId(value = "id", type = IdType.AUTO)
private Long id;
/** 门店id */
private Long storeId;
/** 文件扩展名 */
private String type;
/** 文件来源(1项目、2工单预处理,3工单操作,4巡检) */
private Integer sourceType;
/** 文件来源id */
private Long sourceId;
/** 文件名称 */
private String name;
/** 文件地址 */
private String url;
/** 创建时间 */
@TableField(value = "create_time", fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/** 备注 */
private String remark;
/** sha256 */
private String sha256;
/** 上传人 */
private String uploader;
}
package vion.model; package vion.model;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import vion.dto.InspectDTO;
import java.util.Date; import java.util.Date;
...@@ -9,18 +14,57 @@ import java.util.Date; ...@@ -9,18 +14,57 @@ import java.util.Date;
* 巡检信息 * 巡检信息
*/ */
@Data @Data
@TableName(value="tbl_inspect_info") @TableName(value = "tbl_inspect_info")
@AutoMappers({
@AutoMapper(target = InspectDTO.class),
})
public class Inspect { public class Inspect {
/** 自增列 */
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Integer id;//自增列 private Long id;
private Integer storeId;//门店id(外键) /** 门店id */
private Date inspectDate;//巡检日期 private Long storeId;
private Integer type;//巡检方式(0远程、1现场)
private Integer status;//状态(0进行中、1待审核、2已完成、3、驳回) /** 巡检时间 */
private Integer inspectUser;//巡检人 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Integer reviewer;//审核人 @OrderBy
private Date finishDate;//完成日期 private Date inspectTime;
private Date createTime;//创建时间
private Date modifyTime;//修改时间 /** 巡检方式(0远程、1现场) */
private String remark;//备注 private Integer type;
/** 状态(0进行中、1待审核、2已完成、3、驳回) */
private Integer status;
/** 巡检人 */
private Integer inspectUser;
/** 审核人 */
private Integer reviewer;
/** 巡检时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date finishTime;
/** 审核时间 */
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date auditTime;
/** 创建时间 */
@TableField(value = "create_time", fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/** 修改时间 */
@TableField(value = "modify_time", fill = FieldFill.INSERT_UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date modifyTime;
/** 备注 */
private String remark;
/** 集团id */
private Long accountId;
@TableField(exist = false)
private String accountName;
@TableField(exist = false)
private String storeName;
} }
package vion.model; package vion.model;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import lombok.Data; import lombok.Data;
import vion.dto.ProductDTO;
import vion.vo.ProductVO;
import java.util.Date; import java.util.Date;
...@@ -10,20 +15,44 @@ import java.util.Date; ...@@ -10,20 +15,44 @@ import java.util.Date;
*/ */
@Data @Data
@TableName(value="tbl_product_info") @TableName(value="tbl_product_info")
@AutoMappers({
@AutoMapper(target = ProductVO.class),
@AutoMapper(target = ProductDTO.class),
})
public class Product { public class Product {
/** 自增列 */
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Integer id;//自增列 private Long id;
private String materialNo;//物料编号 /** 物料编号 */
private Integer storeId;//门店id(外键) private String materialNo;
private String name;//产品名称 /** 门店id */
private Integer functionary;//产品型号 private Long storeId;
private Integer brand;//品牌 /** 产品名称 */
private Integer productCount;//订货数量 private String name;
private Float productPrice;//订货单价 /** 产品型号 */
private Float productSubtotal;//定后价小计(单价乘以数量) private Integer functionary;
private Float productTotalPrice;//订货总价 /** 品牌 */
private Date createTime;//创建时间 private Integer brand;
private Date modifyTime;//修改时间 /** 订货数量 */
private String remark;//备注 private Integer productCount;
private Integer accountId;//集团id /** 订货单价 */
private Float productPrice;
//定后价小计(单价乘以数** ) */
private Float productSubtotal;
/** 订货总价 */
private Float productTotalPrice;
/** 创建时间 */
@TableField(value = "create_time", fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/** 修改时间 */
@TableField(value = "modify_time", fill = FieldFill.INSERT_UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date modifyTime;
/** 备注 */
private String remark;
/** 集团id */
private Long accountId;
} }
package vion.model;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import lombok.Data;
import vion.dto.ServiceOrderDTO;
import vion.vo.ServiceOrderVO;
import java.util.Date;
@Data
@TableName("tbl_service_order")
@AutoMappers({
@AutoMapper(target = ServiceOrderVO.class),
@AutoMapper(target = ServiceOrderDTO.class),
})
public class ServiceOrder {
@TableId(type = IdType.AUTO)
private Long id;
/** 项目名称 */
private String projectName;
/** 报修人 */
private String submitter;
/** 报修人手机号码 */
private String submitPhone;
/** 报修时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date submitTime;
/** 维修人 */
private String repairPeople;
/** 维修人手机号码*/
private String repairPhone;
/** 部门 */
private String dept;
/** 服务方式(1.电话支持 2.远程服务 3.现场服务) */
private Integer serviceType;
/** 耗时 */
private Double time;
/** 故障内容 */
private String faultContent;
/** 维修结果 */
private String repairRes;
/** 客户评价 */
private String review;
/** 工单id */
private Long taskId;
/** 服务单状态 */
private Integer state;
/** 创建时间 */
@TableField(value = "create_time", fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/** 更新时间 */
@TableField(value = "update_time", fill = FieldFill.INSERT_UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date updateTime;
/** 五星好评 */
private Integer stars;
/** 签字图片base64 */
private String signPic;
/** 签字时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date signTime;
/** 完成时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date finishTime;
/** 唯一id */
private String unid;
}
package vion.model; package vion.model;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import lombok.Data; import lombok.Data;
import vion.dto.StoreDTO;
import vion.vo.StoreVO;
import java.util.Date; import java.util.Date;
...@@ -10,26 +15,56 @@ import java.util.Date; ...@@ -10,26 +15,56 @@ import java.util.Date;
*/ */
@Data @Data
@TableName(value="tbl_store_info") @TableName(value="tbl_store_info")
@AutoMappers({
@AutoMapper(target = StoreVO.class),
@AutoMapper(target = StoreDTO.class),
})
public class Store { public class Store {
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Integer id; private Long id;
private String storenum; private String storenum;
private String name ;// 门店名称 /** 门店名称 */
private String number;// 流水号 private String name;
private String contractCode;//合同编码 /** 流水号 */
private Float amount;// 合同金额 private String number;
private Date orderdate;//签订日期 /** 合同编码 */
private Integer salesperson;//销售人 private String contractCode;
private Integer warrantyPeriod;//质保期 /** 合同金额 */
private String customerName;//客户姓名 private Float amount;
private Integer implementType;//实施类型:0纯供货、1供货+安装、3续保、4维修 /** 签订日期 */
private Integer projectState;//项目状态:0待确认、1进行中、2已完成、3挂起 private Date orderdate;
private String contacts;//联系人(多个联系人逗号隔开) /** 销售人 */
private Integer createUser;//创建者 private Integer salesperson;
private Integer modifyUser;//修改者 /** 质保期 */
private Date createTime;//创建时间 private Integer warrantyPeriod;
private Date modifyTime;//修改时间 /** 客户姓名 */
private String remark;//备注 private String customerName;
private Integer projectStage;//项目阶段 /** 实施类型:0纯供货、1供货+安装、3续保、4维修 */
private Integer accountId;//集团id private Integer implementType;
/** 项目状态:0待确认、1进行中、2已完成、3挂起 */
private Integer projectState;
/** 联系人(多个联系人逗号隔开) */
private String contacts;
/** 创建者 */
private Long createUser;
/** 修改者 */
private Long modifyUser;
/** 创建时间 */
@TableField(value = "create_time", fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
@OrderBy
private Date createTime;
/** 修改时间 */
@TableField(value = "modify_time", fill = FieldFill.INSERT_UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date modifyTime;
/** 备注 */
private String remark;
/** 项目阶段 */
private Integer projectStage;
/** 集团id */
private Long accountId;
} }
package vion.model; package vion.model;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import vion.dto.TaskDTO;
import vion.vo.TaskVO;
import java.util.Date; import java.util.Date;
@Data @Data
@TableName(value="tbl_task_info") @TableName(value="tbl_task_info")
@AutoMappers({
@AutoMapper(target = TaskVO.class),
@AutoMapper(target = TaskDTO.class),
})
public class Task { public class Task {
/** 自增列 */
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Integer id;//自增列 private Long id;
private Integer storeId;//门店id(外键) /** 门店id */
private Date repairDate;//报修日期 private Long storeId;
private Integer faultType;//故障类型 /** 报修日期 */
private String faultDescription;//故障说明 @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Integer repairPeople;//报修人 @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private String repairPhone;//报修人联系方式 @OrderBy(sort = 2)
private Integer status;//状态:0待确认1进行中2已完成3挂起 private Date repairTime;
private Date solveDate;//解决日期 /** 故障类型 */
private String faultReason;//故障原因 private Integer faultType;
private Integer solveType;//解决措施:0产品BUG、1使用问题、2需求问题 /** 故障说明 */
private String solveDescription;//解决故障描述 private String faultDescription;
private Integer createUser;//创建者 /** 报修人 */
private Integer activeUser;//当前处理人 private String repairPeople;
private Date createTime;//创建时间 /** 报修人联系方式 */
private Date modifyTime;//修改时间 private String repairPhone;
private String remark;//备注 /** 状态 */
private Integer accountId;//集团id @OrderBy(asc = true, sort = 1)
private Integer status;
/** 解决日期 */
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date solveDate;
/** 故障原因 */
private String faultReason;
/** 解决措施:0产品BUG、1使用问题、2需求问题 */
private Integer solveType;
/** 解决故障描述 */
private String solveDescription;
/** 创建者 */
private Long createUser;
/** 当前处理人 */
private Long activeUser;
/** 截止日期 */
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date expDate;
/** 创建时间 */
@TableField(value = "create_time", fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/** 修改时间 */
@TableField(value = "modify_time", fill = FieldFill.INSERT_UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date modifyTime;
/** 备注 */
private String remark;
/** 集团id */
private Long accountId;
private String uuid;
/** 预工单id */
private Long taskTempId;
} }
package vion.model; package vion.model;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.github.linpeilie.annotations.AutoMapper;
import io.github.linpeilie.annotations.AutoMappers;
import lombok.Data; import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import vion.dto.TaskTempDTO;
import vion.vo.TaskTempVO;
import java.util.Date; import java.util.Date;
@Data @Data
@TableName(value="tbl_task_temp") @TableName(value="tbl_task_temp")
@AutoMappers({
@AutoMapper(target = TaskTempVO.class),
@AutoMapper(target = TaskTempDTO.class),
})
public class TaskTemp { public class TaskTemp {
@TableId(type= IdType.AUTO) @TableId(type= IdType.AUTO)
private Integer id;//自增列 private Long id;
private Integer storeId;//项目名称 /** 项目id */
private String storeName;//项目名称 private Long storeId;
private Date repairDate;//报修日期 /** 项目名称 */
private String faultDescription;//故障说明 private String storeName;
private String repairPeople;//报修人 /** 报修时间 */
private String repairPhone;//联系方式 @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Integer status;//状态(1待确认、2已确认) @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Integer operator;//操作人 @OrderBy(sort = 2)
private Date createTime;//创建时间 private Date repairTime;
private Date modifyTime;//修改时间
private String remark;//备注 /** 故障说明 */
private String faultDescription;
/** 报修人 */
private String repairPeople;
/** 联系方式 */
private String repairPhone;
/** 状态(1待确认、2进行中、3已确认) */
@OrderBy(asc = true, sort = 1)
private Integer status;
/** 操作人 */
private Long operator;
/** 创建时间 */
@TableField(value = "create_time", fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
/** 修改时间 */
@TableField(value = "modify_time", fill = FieldFill.INSERT_UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date modifyTime;
/** 备注 */
private String remark;
/** 微信用户id */
private String openid;
} }
package vion.model; package vion.model;
import com.baomidou.mybatisplus.annotation.*; import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data; import lombok.Data;
import java.util.Date; import java.util.Date;
...@@ -12,12 +13,26 @@ import java.util.Date; ...@@ -12,12 +13,26 @@ import java.util.Date;
@TableName(value="tbl_user_info") @TableName(value="tbl_user_info")
public class User { public class User {
@TableId(value = "id", type = IdType.AUTO) @TableId(value = "id", type = IdType.AUTO)
private Integer id; private Long id;
private String userid; private String userid;
private String username; private String username;
private String password; private String password;
private String phone; private String phone;
private Date createTime;//创建时间 private Long deptId;
@TableField(value = "create_time", fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
@TableField(value = "modify_time", fill = FieldFill.INSERT_UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date modifyTime; private Date modifyTime;
private String remark; private String remark;
} /** 是否是预工单处理人 0:不是 1:是 */
private Integer preWorkOrder;
/** 员工状态 2:试用期 3:正式 5:待离职 -1:无状态 */
private Integer employeeStatus;
@TableField(exist = false)
private String token;
}
\ No newline at end of file \ No newline at end of file
...@@ -3,7 +3,6 @@ package vion.service; ...@@ -3,7 +3,6 @@ package vion.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import vion.model.Account; import vion.model.Account;
public interface IAccountSerrvice extends IService<Account> { public interface IAccountService extends IService<Account> {
Account saveAndReturn(Account account);
} }
...@@ -3,5 +3,5 @@ package vion.service; ...@@ -3,5 +3,5 @@ package vion.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import vion.model.Address; import vion.model.Address;
public interface IAddressSerrvice extends IService<Address> { public interface IAddressService extends IService<Address> {
} }
package vion.service;
import com.baomidou.mybatisplus.extension.service.IService;
import vion.model.Dept;
/**
* @author HlQ
* @date 2023/11/10
*/
public interface IDeptService extends IService<Dept> {
}
...@@ -3,5 +3,5 @@ package vion.service; ...@@ -3,5 +3,5 @@ package vion.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import vion.model.Dictionary; import vion.model.Dictionary;
public interface IDictionarySerrvice extends IService<Dictionary> { public interface IDictionaryService extends IService<Dictionary> {
} }
package vion.service; package vion.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import vion.model.Account;
import vion.model.DictionaryType; import vion.model.DictionaryType;
public interface IDictionaryTypeSerrvice extends IService<DictionaryType> { public interface IDictionaryTypeService extends IService<DictionaryType> {
} }
...@@ -3,5 +3,5 @@ package vion.service; ...@@ -3,5 +3,5 @@ package vion.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import vion.model.FaultLog; import vion.model.FaultLog;
public interface IFaultLogSerrvice extends IService<FaultLog> { public interface IFaultLogService extends IService<FaultLog> {
} }
package vion.service; package vion.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import vion.model.File; import vion.model.FileInfo;
public interface IFileSerrvice extends IService<File> { public interface IFileService extends IService<FileInfo> {
} }
package vion.service; package vion.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import vion.dto.InspectDTO;
import vion.model.Inspect; import vion.model.Inspect;
public interface IInspectSerrvice extends IService<Inspect> { public interface IInspectService extends IService<Inspect> {
Inspect saveAndReturn(Inspect inspect); Page<Inspect> getInspectList(InspectDTO data);
} }
package vion.service; package vion.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import vion.dto.ProductDTO;
import vion.model.Product; import vion.model.Product;
import vion.vo.ProductVO;
public interface IProductSerrvice extends IService<Product> { public interface IProductService extends IService<Product> {
Product saveAndReturn(Product product); Page<ProductVO> getProductList(ProductDTO productDTO);
} }
package vion.service;
import com.baomidou.mybatisplus.extension.service.IService;
import vion.model.ServiceOrder;
/**
* @author HlQ
* @date 2023/11/21
*/
public interface IServiceOrderService extends IService<ServiceOrder> {
String sendOrder(Long id);
}
package vion.service;
import com.baomidou.mybatisplus.extension.service.IService;
import vion.model.Store;
public interface IStoreSerrvice extends IService<Store> {
Store saveAndReturn(Store store);
}
package vion.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import vion.dto.StatusDTO;
import vion.dto.StoreDTO;
import vion.model.Store;
import vion.vo.StoreVO;
public interface IStoreService extends IService<Store> {
Page<StoreVO> getStoreList(StoreDTO data);
String updateStoreStage(StatusDTO statusDTO, String token);
}
package vion.service;
import com.baomidou.mybatisplus.extension.service.IService;
import vion.model.Task;
public interface ITaskSerrvice extends IService<Task> {
Task saveAndReturn(Task task);
}
package vion.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import vion.dto.TaskDTO;
import vion.model.Task;
import vion.vo.TaskVO;
public interface ITaskService extends IService<Task> {
Page<TaskVO> getTaskList(TaskDTO data);
TaskVO getTaskById(Long taskId);
Long circTask(TaskDTO data, String token);
}
package vion.service;
import com.baomidou.mybatisplus.extension.service.IService;
import vion.model.TaskTemp;
public interface ITaskTempSerrvice extends IService<TaskTemp> {
TaskTemp saveAndReturn(TaskTemp taskTemp);
}
package vion.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import vion.dto.TaskTempDTO;
import vion.model.TaskTemp;
import vion.vo.TaskTempVO;
public interface ITaskTempService extends IService<TaskTemp> {
Page<TaskTempVO> getTaskTempList(TaskTempDTO data);
TaskTempVO getTaskTempById(Long id);
String saveOrUpdTaskTemp(TaskTempDTO data);
}
package vion.service; package vion.service;
import cn.hutool.core.lang.tree.Tree;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import vion.model.User; import vion.model.User;
public interface IUserSerrvice extends IService<User> { import java.util.List;
public interface IUserService extends IService<User> {
List<Tree<String>> getOrgTree(String deptId);
User saveAndReturn(User user);
} }
...@@ -4,14 +4,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -4,14 +4,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import vion.mapper.AccountMapper; import vion.mapper.AccountMapper;
import vion.model.Account; import vion.model.Account;
import vion.service.IAccountSerrvice; import vion.service.IAccountService;
@Service @Service
public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> implements IAccountSerrvice { public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> implements IAccountService {
}
@Override
public Account saveAndReturn(Account account) {
this.saveOrUpdate(account);
return account;
}
}
\ No newline at end of file \ No newline at end of file
...@@ -4,8 +4,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -4,8 +4,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import vion.mapper.AddressMapper; import vion.mapper.AddressMapper;
import vion.model.Address; import vion.model.Address;
import vion.service.IAddressSerrvice; import vion.service.IAddressService;
@Service @Service
public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements IAddressSerrvice { public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements IAddressService {
} }
package vion.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import vion.mapper.DeptMapper;
import vion.model.Dept;
import vion.service.IDeptService;
/**
* @author HlQ
* @date 2023/11/10
*/
@Service
public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements IDeptService {
}
...@@ -4,8 +4,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -4,8 +4,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import vion.mapper.DictionaryMapper; import vion.mapper.DictionaryMapper;
import vion.model.Dictionary; import vion.model.Dictionary;
import vion.service.IDictionarySerrvice; import vion.service.IDictionaryService;
@Service @Service
public class DictionaryServiceImpl extends ServiceImpl<DictionaryMapper, Dictionary> implements IDictionarySerrvice { public class DictionaryServiceImpl extends ServiceImpl<DictionaryMapper, Dictionary> implements IDictionaryService {
} }
...@@ -4,8 +4,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -4,8 +4,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import vion.mapper.DictionaryTypeMapper; import vion.mapper.DictionaryTypeMapper;
import vion.model.DictionaryType; import vion.model.DictionaryType;
import vion.service.IDictionaryTypeSerrvice; import vion.service.IDictionaryTypeService;
@Service @Service
public class DictionaryTypeServiceImpl extends ServiceImpl<DictionaryTypeMapper, DictionaryType> implements IDictionaryTypeSerrvice { public class DictionaryTypeServiceImpl extends ServiceImpl<DictionaryTypeMapper, DictionaryType> implements IDictionaryTypeService {
} }
...@@ -4,8 +4,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -4,8 +4,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import vion.mapper.FaultLogMapper; import vion.mapper.FaultLogMapper;
import vion.model.FaultLog; import vion.model.FaultLog;
import vion.service.IFaultLogSerrvice; import vion.service.IFaultLogService;
@Service @Service
public class FaultLogServiceImpl extends ServiceImpl<FaultLogMapper, FaultLog> implements IFaultLogSerrvice { public class FaultLogServiceImpl extends ServiceImpl<FaultLogMapper, FaultLog> implements IFaultLogService {
} }
...@@ -3,9 +3,9 @@ package vion.service.impl; ...@@ -3,9 +3,9 @@ package vion.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import vion.mapper.FileMapper; import vion.mapper.FileMapper;
import vion.model.File; import vion.model.FileInfo;
import vion.service.IFileSerrvice; import vion.service.IFileService;
@Service @Service
public class FileServiceImpl extends ServiceImpl<FileMapper, File> implements IFileSerrvice { public class FileServiceImpl extends ServiceImpl<FileMapper, FileInfo> implements IFileService {
} }
package vion.service.impl; package vion.service.impl;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import vion.dto.InspectDTO;
import vion.mapper.InspectMapper; import vion.mapper.InspectMapper;
import vion.model.Account;
import vion.model.Inspect; import vion.model.Inspect;
import vion.service.IInspectSerrvice; import vion.model.Store;
import vion.service.IAccountService;
import vion.service.IInspectService;
import vion.service.IStoreService;
import java.util.List;
@Service @Service
public class InspectServiceImpl extends ServiceImpl<InspectMapper, Inspect> implements IInspectSerrvice { @RequiredArgsConstructor
public class InspectServiceImpl extends ServiceImpl<InspectMapper, Inspect> implements IInspectService {
private final IStoreService storeService;
private final IAccountService accountService;
private final Converter converter;
@Override @Override
public Inspect saveAndReturn(Inspect inspect) { public Page<Inspect> getInspectList(InspectDTO data) {
this.saveOrUpdate(inspect); Page<Inspect> inspectList = this.lambdaQuery(converter.convert(data, new Inspect()))
return inspect; .between(data.getStartdate() != null && data.getEnddate() != null, Inspect::getInspectTime, data.getStartdate(), data.getEnddate())
.page(Page.of(data.getPageNum(), data.getPageSize()));
List<Store> storeList = storeService.list();
List<Account> accountList = accountService.list();
inspectList.getRecords().forEach(item -> {
item.setAccountName(accountList.stream().filter(v -> v.getId().equals(item.getAccountId())).map(Account::getName).findFirst().orElse("--"));
item.setStoreName(storeList.stream().filter(v -> v.getId().equals(item.getStoreId())).map(Store::getName).findFirst().orElse("--"));
});
return inspectList;
} }
} }
package vion.service.impl; package vion.service.impl;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import vion.dto.ProductDTO;
import vion.mapper.ProductMapper; import vion.mapper.ProductMapper;
import vion.model.Product; import vion.model.Product;
import vion.service.IProductSerrvice; import vion.model.Store;
import vion.service.IProductService;
import vion.service.IStoreService;
import vion.vo.ProductVO;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Service @Service
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements IProductSerrvice { @RequiredArgsConstructor
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements IProductService {
private final IStoreService storeService;
private final Converter converter;
@Override @Override
public Product saveAndReturn(Product product) { public Page<ProductVO> getProductList(ProductDTO productDTO) {
this.saveOrUpdate(product); Page<Product> productList = this.page(Page.of(productDTO.getPageNum(), productDTO.getPageSize()), Wrappers.<Product>lambdaQuery()
return product; .eq(productDTO.getStoreId() != null, Product::getStoreId, productDTO.getStoreId())
.eq(productDTO.getAccountId() != null, Product::getAccountId, productDTO.getAccountId())
.like(productDTO.getName() != null, Product::getName, productDTO.getName())
.eq(productDTO.getBrand() != null, Product::getBrand, productDTO.getBrand())
.eq(productDTO.getFunctionary() != null, Product::getFunctionary, productDTO.getFunctionary()));
List<Store> storeList = storeService.list();
List<ProductVO> productVOList = new ArrayList<>();
for (Product pro : productList.getRecords()) {
ProductVO productVO = converter.convert(pro, ProductVO.class);
productVO.setStoreName(storeList.stream().filter(store -> store.getId().equals(pro.getStoreId())).collect(Collectors.toList()).get(0).getName());
productVOList.add(productVO);
}
return Page.<ProductVO>of(productDTO.getPageNum(), productDTO.getPageSize(), productList.getTotal()).setRecords(productVOList);
} }
} }
package vion.service.impl;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.lang.Opt;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import me.chanjar.weixin.mp.bean.template.WxMpTemplateData;
import org.springframework.stereotype.Service;
import vion.ding.WechatMod;
import vion.mapper.ServiceOrderMapper;
import vion.model.ServiceOrder;
import vion.model.Task;
import vion.service.IServiceOrderService;
import vion.service.ITaskService;
import vion.service.ITaskTempService;
import java.util.List;
/**
* @author HlQ
* @date 2023/11/21
*/
@Service
@RequiredArgsConstructor
public class ServiceOrderServiceImpl extends ServiceImpl<ServiceOrderMapper, ServiceOrder> implements IServiceOrderService {
private final ITaskService taskService;
private final ITaskTempService taskTempService;
private final WechatMod wechatMod;
@Override
public String sendOrder(Long id) {
ServiceOrder order = this.getById(id);
Task task = taskService.getById(order.getTaskId());
return Opt.ofNullable(task.getTaskTempId())
.map(tempId -> taskTempService.getById(tempId).getOpenid())
.map(openid -> {
List<WxMpTemplateData> wxMpTemplateDataList = ListUtil.of(
new WxMpTemplateData("character_string5", task.getUuid()),
new WxMpTemplateData("thing1", order.getSubmitter() + "-" + order.getSubmitPhone()));
return wechatMod.sendMsg("NN6N58EOr0BE-D0f2vFipqUek4qtVXp08EJWjJora-M", openid, wxMpTemplateDataList, "https://yunwei.vionyun.com:8443/wap/service-bill?unid=" + order.getUnid());
})
.orElse("微信公众号消息推送失败,请检查工单是否绑定微信用户或联系管理员!");
}
}
package vion.service.impl; package vion.service.impl;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Opt;
import cn.hutool.crypto.SecureUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import vion.Global;
import vion.dto.StatusDTO;
import vion.dto.StoreDTO;
import vion.mapper.StoreMapper; import vion.mapper.StoreMapper;
import vion.model.Account;
import vion.model.FileInfo;
import vion.model.Store; import vion.model.Store;
import vion.service.IStoreSerrvice; import vion.service.IAccountService;
import vion.service.IFileService;
import vion.service.IStoreService;
import vion.vo.StoreVO;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service @Service
public class StoreServiceImpl extends ServiceImpl<StoreMapper, Store> implements IStoreSerrvice { @RequiredArgsConstructor
public class StoreServiceImpl extends ServiceImpl<StoreMapper, Store> implements IStoreService {
private final IAccountService accountService;
private final IFileService fileService;
private final Converter converter;
@Value("${fileUrl:}")
private String fileUrl;
@Override
public Page<StoreVO> getStoreList(StoreDTO data) {
Page<Store> storeList = this.lambdaQuery(converter.convert(data, new Store()))
.between(data.getStartdate() != null && data.getEnddate() != null, Store::getOrderdate, data.getStartdate(), data.getEnddate())
.page(Page.of(data.getPageNum(), data.getPageSize()));
// todo 缓存
List<Account> accountList = accountService.list();
List<FileInfo> fileInfoList = fileService.lambdaQuery().eq(FileInfo::getSourceType, 1).list();
Map<Long, Long> store2CntMap = fileInfoList.stream().collect(Collectors.groupingBy(FileInfo::getStoreId, Collectors.counting()));
List<StoreVO> storeVOList = new ArrayList<>();
storeList.getRecords().forEach(item -> {
StoreVO storeVO = converter.convert(item, new StoreVO());
storeVO.setAccountName(accountList.stream().filter(v -> v.getId().equals(item.getAccountId())).map(Account::getName).findFirst().orElse("--"));
storeVO.setFileNum(store2CntMap.getOrDefault(item.getId(), 0L));
storeVOList.add(storeVO);
});
return Page.<StoreVO>of(data.getPageNum(), data.getPageSize(), storeList.getTotal()).setRecords(storeVOList);
}
@Override @Override
public Store saveAndReturn(Store store) { public String updateStoreStage(StatusDTO statusDTO, String token) {
this.saveOrUpdate(store); this.update(Wrappers.<Store>lambdaUpdate()
return store; .set(Store::getProjectStage, statusDTO.getProjectStage())
.eq(Store::getId, statusDTO.getSourceId()));
Opt.ofNullable(statusDTO.getFiles()).ifPresent(tmpFiles -> {
for (MultipartFile infile : tmpFiles) {
//上传url地址
String orgName = infile.getOriginalFilename();
String fileName = orgName.substring(0, orgName.lastIndexOf("."));
String fileExt = orgName.substring(orgName.lastIndexOf("."));
String filename = fileName + "_" + DateUtil.format(new Date(), "yyyyMMdd_HHmmss") + fileExt;
String path = fileUrl + FileUtil.FILE_SEPARATOR + statusDTO.getStoreId() + FileUtil.FILE_SEPARATOR + statusDTO.getSourceId() + FileUtil.FILE_SEPARATOR + filename;
File file = FileUtil.touch(path);
try {
infile.transferTo(file);
} catch (IOException e) {
log.error("保存文件出错", e);
}
FileInfo tempFileInfo = new FileInfo();
tempFileInfo.setStoreId(statusDTO.getStoreId());
tempFileInfo.setSourceId(statusDTO.getSourceId());
tempFileInfo.setSourceType(statusDTO.getSourceType());
tempFileInfo.setName(filename);
tempFileInfo.setUrl(path);
tempFileInfo.setType(FileUtil.extName(file));
tempFileInfo.setSha256(SecureUtil.sha256(file).toUpperCase());
tempFileInfo.setUploader(Global.USERNAME_MAP.get(token).getUsername());
fileService.save(tempFileInfo);
}
});
return "更新成功";
} }
} }
package vion.service.impl; package vion.service.impl;
import cn.hutool.core.collection.ListUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.lang.Opt;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import vion.ding.DingMod;
import vion.ding.WechatMod;
import vion.dto.TaskTempDTO;
import vion.mapper.TaskTempMapper; import vion.mapper.TaskTempMapper;
import vion.model.FileInfo;
import vion.model.TaskTemp; import vion.model.TaskTemp;
import vion.service.ITaskTempSerrvice; import vion.model.User;
import vion.service.IFileService;
import vion.service.ITaskTempService;
import vion.service.IUserService;
import vion.vo.TaskTempVO;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
@Service @Service
public class TaskTempServiceImpl extends ServiceImpl<TaskTempMapper, TaskTemp> implements ITaskTempSerrvice { @RequiredArgsConstructor
public class TaskTempServiceImpl extends ServiceImpl<TaskTempMapper, TaskTemp> implements ITaskTempService {
private final IFileService fileService;
private final IUserService userService;
private final DingMod dingMod;
private final WechatMod wechatMod;
private final Converter converter;
@Value("${fileUrl:}")
private String fileUrl;
@Override
public Page<TaskTempVO> getTaskTempList(TaskTempDTO data) {
Page<TaskTemp> taskTempPage = this
.lambdaQuery(converter.convert(data, new TaskTemp()))
.between(data.getStartdate() != null && data.getEnddate() != null, TaskTemp::getRepairTime, data.getStartdate(), data.getEnddate())
.page(Page.of(data.getPageNum(), data.getPageSize()));
List<TaskTempVO> taskTempVOList = converter.convert(taskTempPage.getRecords(), TaskTempVO.class);
return Page.<TaskTempVO>of(taskTempPage.getCurrent(), taskTempPage.getSize(), taskTempPage.getTotal()).setRecords(taskTempVOList);
}
@Override
public TaskTempVO getTaskTempById(Long id) {
TaskTemp taskTemp = this.getById(id);
List<FileInfo> fileInfos = Opt.ofNullable(taskTemp)
.map(tmp -> fileService.list(Wrappers.<FileInfo>lambdaUpdate()
.eq(FileInfo::getSourceId, tmp.getId())
.eq(FileInfo::getStoreId, 0L)))
.orElse(ListUtil.empty());
TaskTempVO taskTempVO = converter.convert(taskTemp, TaskTempVO.class);
taskTempVO.setFileList(fileInfos);
return taskTempVO;
}
@Override @Override
public TaskTemp saveAndReturn(TaskTemp taskTemp) { public String saveOrUpdTaskTemp(TaskTempDTO data) {
this.saveOrUpdate(taskTemp); TaskTemp taskTemp = converter.convert(data, TaskTemp.class);
return taskTemp; this.save(taskTemp);
Opt.ofNullable(data.getFiles())
.ifPresent(fileList ->
Arrays.stream(fileList).forEach(infile -> {
//上传url地址
String orgName = infile.getOriginalFilename();
String fileName = orgName.substring(0, orgName.lastIndexOf("."));
String fileExt = orgName.substring(orgName.lastIndexOf("."));
String filename = fileName + "_" + DateUtil.format(new Date(), "yyyyMMdd_HHmmss") + fileExt;
String path = fileUrl + FileUtil.FILE_SEPARATOR + 0 + FileUtil.FILE_SEPARATOR + taskTemp.getId() + FileUtil.FILE_SEPARATOR + filename;
File file = FileUtil.touch(path);
try {
infile.transferTo(file);
} catch (IOException e) {
log.error("保存文件出错", e);
}
FileInfo fileInfo = new FileInfo();
fileInfo.setStoreId(0L);
fileInfo.setSourceId(taskTemp.getId());
fileInfo.setSourceType(2);
fileInfo.setName(filename);
fileInfo.setUrl(path);
fileInfo.setType(FileUtil.extName(file));
fileInfo.setSha256(SecureUtil.sha256(file).toUpperCase());
fileInfo.setUploader(data.getRepairPeople());
fileService.save(fileInfo);
}));
// todo 异步发送钉钉消息通知
List<User> userList = userService.lambdaQuery().eq(User::getPreWorkOrder, 1).list();
String userids = userList.stream().map(User::getUserid).collect(Collectors.joining(","));
dingMod.sendMessage(buildMsg(userids, taskTemp));
return wechatMod.genCodeUrl(taskTemp.getId());
}
JSONObject buildMsg(String userid, TaskTemp taskTemp) {
JSONObject jsonObj = new JSONObject();
jsonObj.set("agent_id", 2358374016L);
jsonObj.set("userid_list", userid);
JSONObject msg = new JSONObject();
JSONObject content = new JSONObject();
content.set("title", "客户提交工单,请及时处理哦~_~");
content.set("markdown", "门店信息: " + taskTemp.getStoreName() +
" \n 客户姓名:" + taskTemp.getRepairPeople() +
" \n 联系方式:" + taskTemp.getRepairPhone() +
" \n 故障描述:" + taskTemp.getFaultDescription() +
" \n 发送时间:" + DateUtil.now());
content.set("btn_orientation", "1");
JSONArray jsonArray = new JSONArray();
jsonArray.add(new JSONObject().set("title", "查看详情").set("action_url", "https://oapi.dingtalk.com/connect/oauth2/sns_authorize?appid=dingkrzwks0jpi2di3uo&response_type=code&scope=snsapi_auth&state=STATE&redirect_uri=https%3A%2F%2Fyunwei.vionyun.com%3A8443%2Fyunwei%2Fapi%2Fding%2Fcallback%2Finside%3FtaskTempId%3D" + taskTemp.getId()));
content.set("btn_json_list", jsonArray);
msg.set("msgtype", "action_card");
msg.set("action_card", content);
jsonObj.set("msg", msg);
return jsonObj;
} }
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!