Commit f44b4033 by 李苗

[add]工单项目初始版本

1 parent aa7a47bc
Showing 83 changed files with 2880 additions and 86 deletions
......@@ -2,6 +2,7 @@
<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" />
......
......@@ -8,7 +8,5 @@
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</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
<?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
......@@ -3,10 +3,17 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.14</version>
</parent>
<groupId>org.example</groupId>
<artifactId>Vion-DevOps</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1</version>
<dependencies>
<dependency>
......@@ -33,24 +40,78 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.0.1.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
<version>2.0.1.RELEASE</version>
<artifactId>spring-boot-starter-jdbc</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<version>2.0.1.RELEASE</version>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.15</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>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.4.0</version>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.1</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>vion.Application</mainClass>
<layout>JAR</layout>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
......@@ -61,13 +122,11 @@
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>6</source>
<target>6</target>
</configuration>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
</plugin>
</plugins>
</build>
......
......@@ -9,6 +9,7 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import vion.controller.UserController;
import java.util.concurrent.CountDownLatch;
......@@ -26,13 +27,18 @@ public class Application implements CommandLineRunner {
}
@Autowired
private UserController userController;
private final static Logger logger = LoggerFactory.getLogger(Application.class);
@Scheduled(fixedDelay=1000*60*10,initialDelay=1000)
//@Scheduled(fixedDelay=1000*60*10,initialDelay=1000)
@Scheduled(cron="${third.run.cron:0 0 2 * * ?}")
public void startJob(){
try {
logger.info("启动");
//定时获取钉钉用户列表
userController.getDingUserList();
logger.info("启动完成");
} catch (Exception e) {
......
package vion;
public class Global {
public static final String BASE_URL = "/api";
public static final String ACCOUNT_URL = "/api/account";
public static final String STORE_URL = "/api/store";
public static final String WORK_URL = "/api/work";
public static final String INSPECT_URL = "/api/inspect";
}
package vion.controller;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;
import vion.Global;
import vion.enums.ResultEnum;
import vion.model.Account;
import vion.service.IAccountSerrvice;
import vion.utils.ResultUtil;
import java.util.Date;
import java.util.List;
@Controller
@RequestMapping(Global.BASE_URL)
@Slf4j
public class AccountController {
@Autowired
private IAccountSerrvice accountSerrvice;
@GetMapping("/accounts")
@ResponseBody
public Object getAccountList(@RequestParam(name = "pageNum")Integer pageNum,
@RequestParam(name = "pageSize")Integer pageSize){
//pageNum当前页,pageSize每页条数
PageHelper.startPage(pageNum,pageSize);
List<Account> accountList=accountSerrvice.list();
PageInfo pageInfo=new PageInfo(accountList,10);
if (accountList != null) {
return ResultUtil.success(pageInfo);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
}
@GetMapping("/account")
@ResponseBody
public Object getProductByID(@RequestParam(name = "id")Integer 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")
@ResponseBody
public Object saveOrUpdate(@RequestBody Account data) {
try {
if(data.getId()==null){
accountSerrvice.save(data);
return ResultUtil.success();
}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;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import vion.Global;
import vion.enums.ResultEnum;
import vion.model.Dictionary;
import vion.model.DictionaryType;
import vion.service.IDictionarySerrvice;
import vion.service.IDictionaryTypeSerrvice;
import vion.utils.ResultUtil;
import java.util.List;
@RestController
@RequestMapping(Global.BASE_URL)
@Slf4j
public class DictionaryController {
@Autowired
private IDictionarySerrvice dictionarySerrvice;
@Autowired
private IDictionaryTypeSerrvice dictionaryTypeSerrvice;
@GetMapping("/dictionarys")
@ResponseBody
public Object getDictionaryList(@RequestParam(name = "pageNum")Integer pageNum,
@RequestParam(name = "pageSize")Integer pageSize){
//pageNum当前页,pageSize每页条数
PageHelper.startPage(pageNum,pageSize);
List<Dictionary> dictionaryList=dictionarySerrvice.list();
PageInfo pageInfo=new PageInfo(dictionaryList,10);
if (dictionaryList != null) {
return ResultUtil.success(pageInfo);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
}
@GetMapping("/dictionary")
@ResponseBody
public Object getDictionaryByID(@RequestParam(name = "id")Integer id){
Dictionary dictionary=dictionarySerrvice.getById(id);
if (dictionary != null) {
return ResultUtil.success(dictionary);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
}
@PostMapping("/dictionarys")
@ResponseBody
public Object saveOrUpdateDictionary(@RequestBody Dictionary data) {
try {
dictionarySerrvice.saveOrUpdate(data);
return ResultUtil.success();
}catch (Exception e) {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
}
@GetMapping("/dictionaryTypes")
@ResponseBody
public Object getDictionaryTypeList(@RequestParam(name = "pageNum")Integer pageNum,
@RequestParam(name = "pageSize")Integer pageSize){
//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")
@ResponseBody
public Object getDictionaryTypeByID(@RequestParam(name = "id")Integer id){
DictionaryType dictionaryType=dictionaryTypeSerrvice.getById(id);
if (dictionaryType != null) {
return ResultUtil.success(dictionaryType);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
}
@PostMapping("/dictionaryTypes")
@ResponseBody
public Object saveOrUpdateDictionaryType(@RequestBody DictionaryType data) {
try {
dictionaryTypeSerrvice.saveOrUpdate(data);
return ResultUtil.success();
}catch (Exception e) {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
}
}
package vion.controller;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import vion.Global;
import vion.enums.ResultEnum;
import vion.model.File;
import vion.service.IFileSerrvice;
import vion.utils.ResultUtil;
import javax.servlet.http.HttpServletResponse;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.OutputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping(Global.BASE_URL)
@Slf4j
public class FileController {
@Autowired
private IFileSerrvice fileSerrvice;
@Value("${fileurl:}")
private String fileurl;
@GetMapping("/files")
@ResponseBody
public Object getAccountList(@RequestParam(name = "store_id")Integer store_id,
@RequestParam(name = "source_id")Integer source_id,
@RequestParam(name = "pageNum")Integer pageNum,
@RequestParam(name = "pageSize")Integer pageSize){
//pageNum当前页,pageSize每页条数
PageHelper.startPage(pageNum,pageSize);
List<File> fileList=fileSerrvice.list(Wrappers.<File>lambdaQuery()
.eq(File::getSourceId,source_id)
.eq(File::getStoreId,store_id));
PageInfo pageInfo=new PageInfo(fileList,10);
if (pageInfo != null) {
return ResultUtil.success(pageInfo);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
}
@PostMapping("/upLoadFile")
public Map<String, Object> uploadFile(@RequestParam(name="file") MultipartFile file){
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
//上传url地址
String path=fileurl+"/"+file.getOriginalFilename();
java.io.File fileinfo=new java.io.File(path);
file.transferTo(fileinfo);
resultMap.put("msg_code", "200");
} catch (IOException e) {
e.printStackTrace();
resultMap.put("msg_code", "500");
}
return resultMap;
}
@GetMapping("/downLoadFile")
public void downLoadFile(@RequestParam(name="fileurl")String fileurl,
@RequestParam(name="filename")String filename,
HttpServletResponse response){
Map<String, Object> resultMap = new HashMap<String, Object>();
response.setContentType("application/octet-stream");
response.setHeader("Content-Disposition","attachment;filename="+filename);
java.io.File file=new java.io.File(fileurl);
try {
FileInputStream fis=new FileInputStream(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) {
e.printStackTrace();
}
}
}
package vion.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import vion.Global;
import vion.enums.ResultEnum;
import vion.model.Inspect;
import vion.service.IInspectSerrvice;
import vion.utils.ResultUtil;
import java.util.Date;
import java.util.List;
@RestController
@RequestMapping(Global.BASE_URL)
@Slf4j
public class InspectController {
@Autowired
private IInspectSerrvice inspectSerrvice;
@GetMapping("/inspects")
@ResponseBody
public Object getProductList(@RequestParam(name = "store_id")Integer store_id,
@RequestParam(name = "status",required=false)Integer status,
@RequestParam(name = "startdate",required=false) Date startdate,
@RequestParam(name = "enddate",required=false)Date enddate,
@RequestParam(name = "pageNum")Integer pageNum,
@RequestParam(name = "pageSize")Integer pageSize){
//pageNum当前页,pageSize每页条数
PageHelper.startPage(pageNum,pageSize);
QueryWrapper<Inspect> wrapper=new QueryWrapper<>();
wrapper.eq("store_id",store_id);
if(status!=null)
wrapper.eq("status",status);
if(startdate!=null)
wrapper.ge("inspect_date",startdate);
if(enddate!=null)
wrapper.le("inspect_date",enddate);
List<Inspect> inspectList=inspectSerrvice.list(wrapper);
PageInfo pageInfo=new PageInfo(inspectList,10);
if (inspectList != null) {
return ResultUtil.success(pageInfo);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
}
@GetMapping("/inspect")
@ResponseBody
public Object getProductByID(@RequestParam(name = "id")Integer id){
Inspect inspect=inspectSerrvice.getById(id);
if (inspect != null) {
return ResultUtil.success(inspect);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
}
@PostMapping("/inspects")
@ResponseBody
public Object saveOrUpdate(@RequestBody Inspect data) {
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);
}
}
@PostMapping("/updateInspectStatus")
@ResponseBody
public Object UpdateStatus(@RequestBody Inspect data) {
Date current=new Date();
UpdateWrapper updateWrapper=new UpdateWrapper();
updateWrapper.eq("id",data.getId());
updateWrapper.set("status",data.getStatus());
updateWrapper.set("modify_time",current);
updateWrapper.set("audit_date",current);
updateWrapper.set("reviewer",data.getReviewer());
//审核状态为已完成的时候更新完成时间(0进行中、1待审核、2已完成、3、驳回)
if(data.getStatus()==2){
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;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import vion.Global;
import vion.enums.ResultEnum;
import vion.model.Product;
import vion.service.IProductSerrvice;
import vion.utils.ResultUtil;
import java.util.Date;
import java.util.List;
@RestController
@RequestMapping(Global.BASE_URL)
@Slf4j
public class ProductController {
@Autowired
private IProductSerrvice productSerrvice;
@GetMapping("/products")
@ResponseBody
public Object getProductList(@RequestParam(name = "account_id")Integer account_id,
@RequestParam(name = "store_id")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每页条数
PageHelper.startPage(pageNum,pageSize);
QueryWrapper<Product> wrapper=new QueryWrapper<>();
wrapper.eq("store_id",store_id);
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);
PageInfo pageInfo=new PageInfo(productList,10);
if (pageInfo != null) {
return ResultUtil.success(pageInfo);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
}
@GetMapping("/product")
@ResponseBody
public Object getProductByID(@RequestParam(name = "project_id")Integer project_id){
Product product=productSerrvice.getById(project_id);
if (product != null) {
return ResultUtil.success(product);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
}
@PostMapping("/products")
@ResponseBody
public Object saveOrUpdate(@RequestBody Product 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);
}
}
}
package vion.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import vion.Global;
import vion.enums.ResultEnum;
import vion.model.*;
import vion.service.IAddressSerrvice;
import vion.service.IFileSerrvice;
import vion.service.IStoreSerrvice;
import vion.utils.ResultUtil;
import vion.vo.StatusVO;
import vion.vo.StoreVO;
import java.util.Date;
import java.util.List;
@RestController
@RequestMapping(Global.BASE_URL)
@Slf4j
public class StoreController {
@Autowired
private IStoreSerrvice storeSerrvice;
@Autowired
private IFileSerrvice fileSerrvice;
@Autowired
private IAddressSerrvice addressSerrvice;
@GetMapping("/stores")
@ResponseBody
public Object getStoreList(@RequestParam(name = "account_id")Integer account_id,
@RequestParam(name = "store_id")Integer store_id,
@RequestParam(name = "storenum",required=false)String storenum,
@RequestParam(name = "project_state",required=false)Integer project_state,
@RequestParam(name = "salesperson",required=false)String salesperson,
@RequestParam(name = "implement_type",required=false)Integer implement_type,
@RequestParam(name = "startdate",required=false) Date startdate,
@RequestParam(name = "enddate",required=false) Date enddate,
@RequestParam(name = "pageNum")Integer pageNum,
@RequestParam(name = "pageSize")Integer pageSize){
//pageNum当前页,pageSize每页条数
PageHelper.startPage(pageNum,pageSize);
QueryWrapper<Store> wrapper=new QueryWrapper<>();
wrapper.eq("store_id",store_id);
wrapper.eq("account_id",account_id);
if(storenum!=null)
wrapper.eq("storenum",storenum);
if(project_state!=null)
wrapper.eq("project_state",project_state);
if(salesperson!=null)
wrapper.eq("salesperson",salesperson);
if(implement_type!=null)
wrapper.eq("implement_type",implement_type);
if(startdate!=null)
wrapper.ge("orderdate",startdate);
if(enddate!=null)
wrapper.le("orderdate",enddate);
List<Store> storeList=storeSerrvice.list(wrapper);
PageInfo pageInfo=new PageInfo(storeList,10);
if (pageInfo != null) {
return ResultUtil.success(pageInfo);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
}
@GetMapping("/store")
@ResponseBody
public Object getStoreByID(@RequestParam(name = "id")Integer id){
StoreVO storeVo=new StoreVO();//storeDao.getStoreByID(store_id);
Store store=storeSerrvice.getById(id);
storeVo.setId(store.getId());
storeVo.setNumber(store.getNumber());
storeVo.setName(store.getName());
storeVo.setStorenum(store.getStorenum());
storeVo.setAmount(store.getAmount());
storeVo.setOrderdate(store.getOrderdate());
storeVo.setSalesperson(store.getSalesperson());
storeVo.setWarranty_period(store.getWarrantyPeriod());
storeVo.setCustomer_name(store.getCustomerName());
storeVo.setProject_stage(store.getProjectStage());
storeVo.setProject_state(store.getProjectState());
storeVo.setContacts(store.getContacts());
storeVo.setRemark(store.getRemark());
//获取地址信息
Address address=addressSerrvice.getOne(Wrappers.<Address>lambdaQuery()
.eq(Address::getStoreId,id));
if(address!=null){
storeVo.setConsignee_name(address.getConsigneeName());
storeVo.setConsignee_phone(address.getConsigneePhone());
storeVo.setConsignee_address(address.getConsigneeAddress());
storeVo.setContract_name(address.getContractName());
storeVo.setContract_phone(address.getContractPhone());
storeVo.setContract_address(address.getContractAddress());
storeVo.setInvoice_name(address.getInvoiceName());
storeVo.setInvoice_phone(address.getInvoicePhone());
storeVo.setInvoice_address(address.getInvoiceAddress());
storeVo.setInvoice_info(address.getInvoiceInfo());
}
if (storeVo != null) {
return ResultUtil.success(storeVo);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
}
@PostMapping("/stores")
@ResponseBody
public Object saveOrUpdate(@RequestBody StoreVO storeVo) {
Store store=new Store();
store.setId(storeVo.getId());
store.setNumber(storeVo.getNumber());
store.setName(storeVo.getName());
store.setStorenum(storeVo.getStorenum());
store.setAmount(storeVo.getAmount());
store.setOrderdate(storeVo.getOrderdate());
store.setSalesperson(storeVo.getSalesperson());
store.setWarrantyPeriod(storeVo.getWarranty_period());
store.setCustomerName(storeVo.getCustomer_name());
store.setProjectStage(storeVo.getProject_stage());
store.setProjectState(storeVo.getProject_state());
store.setContacts(storeVo.getContacts());
store.setRemark(storeVo.getRemark());
Address address=addressSerrvice.getOne(Wrappers.<Address>lambdaQuery()
.eq(Address::getStoreId,storeVo.getId()));
address.setConsigneeName(storeVo.getConsignee_name());
address.setConsigneePhone(storeVo.getConsignee_phone());
address.setConsigneeAddress(storeVo.getConsignee_address());
address.setContractName(storeVo.getContract_name());
address.setContractPhone(storeVo.getContract_phone());
address.setContractAddress(storeVo.getContract_address());
address.setInvoiceName(storeVo.getInvoice_name());
address.setInvoicePhone(storeVo.getInvoice_phone());
address.setInvoiceAddress(storeVo.getInvoice_address());
address.setInvoiceInfo(storeVo.getInvoice_info());
try {
storeSerrvice.saveOrUpdate(store);
addressSerrvice.saveOrUpdate(address);
return ResultUtil.success();
}catch (Exception e) {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
}
@PostMapping("/updateStoreStatus")
@ResponseBody
public Object updateStoreStage(@RequestBody StatusVO statusVo) {
try {
//更新项目阶段
//storeDao.updateStoreStage(statusVo.getSource_id(),statusVo.getProject_stage());
UpdateWrapper updateWrapper=new UpdateWrapper();
updateWrapper.eq("id",statusVo.getSource_id());
updateWrapper.set("project_stage",statusVo.getProject_stage());
storeSerrvice.update(updateWrapper);
//添加文件附件
File file=new File();
file.setStoreId(statusVo.getStore_id());
file.setSourceId(statusVo.getSource_id());
file.setSourceType(statusVo.getSource_type());//1项目、2工单预处理,3工单操作,4巡检
file.setName(statusVo.getName());
file.setUrl(statusVo.getUrl());
file.setType(statusVo.getFile_type());
fileSerrvice.save(file);
return ResultUtil.success();
}catch (Exception e) {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
}
}
package vion.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import vion.Global;
import vion.enums.ResultEnum;
import vion.model.*;
import vion.service.IFaultLogSerrvice;
import vion.service.IFileSerrvice;
import vion.service.ITaskSerrvice;
import vion.service.ITaskTempSerrvice;
import vion.utils.ResultUtil;
import vion.vo.FaultLogVO;
import vion.vo.TaskVO;
import java.util.Date;
import java.util.List;
@RestController
@RequestMapping(Global.BASE_URL)
@Slf4j
public class TaskController {
@Autowired
private ITaskTempSerrvice taskTempSerrvice;
@Autowired
private ITaskSerrvice taskSerrvice;
@Autowired
private IFileSerrvice fileSerrvice;
@Autowired
private IFaultLogSerrvice faultLogSerrvice;
@GetMapping("/tasks")
@ResponseBody
public Object getStoreList(@RequestParam(name = "account_id")Integer account_id,
@RequestParam(name = "store_id")Integer store_id,
@RequestParam(name = "fault_type",required=false)Integer fault_type,
@RequestParam(name = "status",required=false)Integer status,
@RequestParam(name = "startdate",required=false) Date startdate,
@RequestParam(name = "enddate",required=false) Date enddate,
@RequestParam(name = "pageNum")Integer pageNum,
@RequestParam(name = "pageSize")Integer pageSize){
//pageNum当前页,pageSize每页条数
PageHelper.startPage(pageNum,pageSize);
QueryWrapper<Task> wrapper=new QueryWrapper<>();
wrapper.eq("store_id",store_id);
wrapper.eq("account_id",account_id);
if(fault_type!=null)
wrapper.eq("fault_type",fault_type);
if(status!=null)
wrapper.eq("status",status);
if(startdate!=null)
wrapper.ge("repair_date",startdate);
if(enddate!=null)
wrapper.le("repair_date",enddate);
List<Task> taskList=taskSerrvice.list(wrapper);
PageInfo pageInfo=new PageInfo(taskList,10);
if (pageInfo != null) {
return ResultUtil.success(pageInfo);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
}
@GetMapping("/task")
@ResponseBody
public Object getWorkByID(@RequestParam(name = "task_id")Integer task_id){
Task task=taskSerrvice.getById(task_id);
if (task != null) {
return ResultUtil.success(task);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
}
@PostMapping("/tasks")
@ResponseBody
public Object saveOrUpdate(@RequestBody TaskVO data) {
try {
Task task=new Task();
task.setAccountId(data.getAccount_id());
task.setStoreId(data.getStore_id());
task.setFaultType(data.getFault_type());
task.setFaultDescription(data.getFault_description());
task.setRepairDate(data.getRepair_date());
task.setRepairPeople(data.getRepair_people());
task.setRepairPhone(data.getRepair_phone());
task.setStatus(data.getStatus());
task.setCreateUser(data.getCreate_user());
if(data.getWorktemp_id()!=null){
//得到预处理工单
// TaskTemp taskTemp= taskTempDao.getTaskTempByID(data.getWorktemp_id());
TaskTemp taskTemp= taskTempSerrvice.getById(data.getWorktemp_id());
//更新预处理工单状态
taskTemp.setStatus(2);//状态(1待确认、2已确认)
taskTemp.setModifyTime(new Date());
taskTemp.setOperator(data.getCurrentuser());
taskTemp.setStoreId(data.getStore_id());
taskTemp.setModifyTime(new Date());
//taskTempDao.updateTaskTemp(taskTemp);
taskTempSerrvice.saveOrUpdate(taskTemp);
//根据预处理工单更新附件的门店ID
fileSerrvice.lambdaUpdate()
.setSql("store_id="+data.getStore_id())
.eq(File::getSourceId,data.getId())
.update();
//fileDao.updateFileStoreid(fileTemp);
}
if(data.getId()==null){
//添加新工单
// Task work= taskDao.addTask(task);
Task work=taskSerrvice.saveAndReturn(task);
//添加新工单的附件信息
if(work!=null && data.getFilename()!=null){
File file=new File();
file.setStoreId(work.getStoreId());
file.setSourceId(work.getId());
file.setSourceType(3);//1项目、2工单预处理,3工单操作,4巡检
file.setName(data.getFilename());
file.setUrl(data.getFileurl());
file.setType(1);
fileSerrvice.save(file);
}
}
else{
task.setId(data.getId());
task.setSolveDate(data.getSolve_date());
task.setFaultReason(data.getFault_reason());
task.setSolveType(data.getSolve_type());
task.setSolveDescription(data.getSolve_description());
task.setCurrentuser(data.getCurrentuser());
task.setRemark(data.getRemark());
// taskDao.updateTask(task);
taskSerrvice.saveOrUpdate(task);
if(data.getFilename()!=null){
//添加文件附件
File file=new File();
file.setStoreId(data.getStore_id());
file.setSourceId(data.getId());
file.setSourceType(3);//1项目、2工单预处理,3工单操作,4巡检
file.setName(data.getFilename());
file.setUrl(data.getFileurl());
file.setType(1);
fileSerrvice.save(file);
}
}
return ResultUtil.success();
}catch (Exception e) {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
}
@GetMapping("/faultLogs")
@ResponseBody
public Object getFaultLogByID(@RequestParam(name = "store_id")Integer store_id,
@RequestParam(name = "task_id")Integer task_id){
//FaultLog faultLog=taskDao.getFaultlogByStoreID(store_id,task_id);
List<FaultLog> faultLogs=faultLogSerrvice.list(Wrappers.<FaultLog>lambdaQuery()
.eq(FaultLog::getStoreId,store_id)
.eq(FaultLog::getTaskId,task_id));
if (faultLogs != null) {
return ResultUtil.success(faultLogs);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
}
@PostMapping("/faultLogs")
@ResponseBody
public Object saveAddFaultLog(@RequestBody FaultLogVO data) {
try {
FaultLog faultLog=new FaultLog();
faultLog.setTaskId(data.getTask_id());
faultLog.setStoreId(data.getStore_id());
faultLog.setOperator(data.getOperator());
faultLog.setContent(data.getContent());
faultLog.setRemark(data.getRemark());
// taskDao.addFaultLog(faultLog);
faultLogSerrvice.saveOrUpdate(faultLog);
if(data.getFilename()!=null){
//添加文件附件
File file=new File();
file.setStoreId(data.getStore_id());
file.setSourceId(data.getTask_id());
file.setSourceType(3);//1项目、2工单预处理,3工单操作,4巡检
file.setName(data.getFilename());
file.setUrl(data.getFileurl());
file.setType(1);
//fileDao.addFile(file);
fileSerrvice.save(file);
}
return ResultUtil.success();
}catch (Exception e) {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
}
}
package vion.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.bouncycastle.util.test.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import vion.Global;
import vion.enums.ResultEnum;
import vion.model.File;
import vion.model.TaskTemp;
import vion.service.IFileSerrvice;
import vion.service.ITaskTempSerrvice;
import vion.utils.ResultUtil;
import vion.vo.TaskTempVO;
import java.util.Date;
import java.util.List;
@RestController
@RequestMapping(Global.BASE_URL)
@Slf4j
public class TaskTempController {
@Autowired
private ITaskTempSerrvice taskTempSerrvice;
@Autowired
private IFileSerrvice fileSerrvice;
@GetMapping("/taskTemps")
@ResponseBody
public Object getTaskTempList(@RequestParam(name = "store_name",required=false)String store_name,
@RequestParam(name = "store_id",required=false)Integer store_id,
@RequestParam(name = "startdate",required=false)Date startdate,
@RequestParam(name = "enddate",required=false)Date enddate,
@RequestParam(name = "status",required=false)Integer status,
@RequestParam(name = "pageNum")Integer pageNum,
@RequestParam(name = "pageSize")Integer pageSize){
//pageNum当前页,pageSize每页条数
PageHelper.startPage(pageNum,pageSize);
QueryWrapper<TaskTemp> wrapper=new QueryWrapper<>();
if(store_id!=null)
wrapper.eq("store_id",store_id);
if(store_name!=null)
wrapper.eq("store_name",store_name);
if(status!=null)
wrapper.eq("status",status);
if(startdate!=null)
wrapper.ge("repair_date",startdate);
if(enddate!=null)
wrapper.le("repair_date",enddate);
List<TaskTemp> taskTempList= taskTempSerrvice.list(wrapper);
PageInfo pageInfo=new PageInfo(taskTempList,10);
if (pageInfo != null) {
return ResultUtil.success(pageInfo);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
}
@GetMapping("/taskTemp")
@ResponseBody
public Object getTaskTempByID(@RequestParam(name = "id")Integer id){
TaskTemp work_orderTemp = taskTempSerrvice.getById(id);
if (work_orderTemp != null) {
return ResultUtil.success(work_orderTemp);
} else {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
}
@PostMapping("/taskTemps")
@ResponseBody
public Object saveOrUpdateTaskTemp(@RequestBody TaskTempVO data) {
try {
TaskTemp taskTemp=new TaskTemp();
taskTemp.setStoreName(data.getStore_name());
taskTemp.setRepairPeople(data.getRepair_people());
taskTemp.setRepairPhone(data.getRepair_phone());
taskTemp.setRepairDate(data.getRepair_date());
taskTemp.setFaultDescription(data.getFault_description());
//TaskTemp workOrder= taskTempDao.addTaskTemp(taskTemp);
TaskTemp saveTaskTemp= taskTempSerrvice.saveAndReturn(taskTemp);
if(saveTaskTemp!=null){
//添加文件附件
File file=new File();
file.setStoreId(0);//新增预处理订单还没有门店ID
file.setSourceId(saveTaskTemp.getId());
file.setSourceType(2);//1项目、2工单预处理,3工单操作,4巡检
file.setName(data.getFilename());
file.setUrl(data.getFileurl());
file.setType(1);
// fileDao.addFile(file);
fileSerrvice.save(file);
}
return ResultUtil.success();
}catch (Exception e) {
return ResultUtil.error(ResultEnum.SELECT_ERROR);
}
}
@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.dao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import vion.model.Account;
import vion.model.File;
import vion.model.Store;
import java.util.List;
@Repository
public class AccountDao {
@Autowired
private JdbcTemplate jdbcTemplate;
private static final String SELECT_BY_UNID = "SELECT * FROM tbl_account_info WHERE id=?";
public Account getAccountById(Integer id) {
List<Account> accounts= jdbcTemplate.query(SELECT_BY_UNID, new BeanPropertyRowMapper<Account>(Account.class), new Object[]{id});
if(accounts.size()>0){
return accounts.get(0);
}else{
return null;
}
}
private static final String SELECT_ALL= "SELECT * FROM tbl_account_info";
public List<Account> getAccountAll() {
return jdbcTemplate.query(SELECT_ALL, new BeanPropertyRowMapper<Account>(Account.class));
}
private static final String SAVE_ACCOUNT= "INSERT INTO tbl_account_info(name,remark) VALUES (?, ?);";
public Integer addAccount(Account account) {
return jdbcTemplate.update(SAVE_ACCOUNT,
new Object[]{
account.getName(),account.getRemark()});
}
private static final String UPDATE_ACCOUNT= "UPDATE tbl_account_info\n" +
" SET name=?, modify_time=?, remark=?\n" +
" WHERE id=?;\n";
/*
public Integer updateAccount(Account account) {
return jdbcTemplate.update(UPDATE_ACCOUNT,
new Object[]{
account.getName(),account.getModify_time(),account.getRemark(),account.getId()});
}*/
}
package vion.dao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import vion.model.Account;
import vion.model.Dictionary;
import vion.model.DictionaryType;
import java.util.List;
@Repository
public class DictionaryDao {
@Autowired
private JdbcTemplate jdbcTemplate;
private static final String SELECT_DICTIONARY_BY_UNID = "SELECT * FROM tbl_dictionary_info WHERE id=?";
public Dictionary getDictionaryById(Integer id) {
List<Dictionary> dictionaries= jdbcTemplate.query(SELECT_DICTIONARY_BY_UNID, new BeanPropertyRowMapper<Dictionary>(Dictionary.class), new Object[]{id});
if(dictionaries.size()>0){
return dictionaries.get(0);
}else{
return null;
}
}
private static final String SELECT_DICTIONARY_ALL= "SELECT * FROM tbl_dictionary_info";
public List<Dictionary> getDictionaryAll() {
return jdbcTemplate.query(SELECT_DICTIONARY_ALL, new BeanPropertyRowMapper<Dictionary>(Dictionary.class));
}
private static final String SAVE_DICTIONARY= "INSERT INTO tbl_dictionary_info(\n" +
" type, key, value, remark)\n" +
" VALUES (?, ?, ?, ?);";
public Integer addDictionary(Dictionary dictionary) {
return jdbcTemplate.update(SAVE_DICTIONARY,
new Object[]{
dictionary.getType(),dictionary.getKey(),dictionary.getValue(),dictionary.getRemark()});
}
private static final String UPDATE_DICTIONARY= "UPDATE tbl_dictionary_info\n" +
" SET type=?, key=?, value=?, remark=?\n" +
" WHERE id=?;";
public Integer updateDictionary(Dictionary dictionary) {
return jdbcTemplate.update(UPDATE_DICTIONARY,
new Object[]{
dictionary.getType(),dictionary.getKey(),dictionary.getValue(),dictionary.getRemark(),dictionary.getId()});
}
private static final String SELECT_TYPE_BY_UNID = "SELECT * FROM tbl_dictionary_type WHERE id=?";
public DictionaryType getDictionaryTypeById(Integer id) {
List<DictionaryType> dictionaries= jdbcTemplate.query(SELECT_TYPE_BY_UNID, new BeanPropertyRowMapper<DictionaryType>(DictionaryType.class), new Object[]{id});
if(dictionaries.size()>0){
return dictionaries.get(0);
}else{
return null;
}
}
private static final String SELECT_DICTIONARYTYPE_ALL= "SELECT * FROM tbl_dictionary_type";
public List<DictionaryType> getDictionaryTypeAll() {
return jdbcTemplate.query(SELECT_DICTIONARYTYPE_ALL, new BeanPropertyRowMapper<DictionaryType>(DictionaryType.class));
}
private static final String SAVE_DICTIONARYTYPE= "INSERT INTO tbl_dictionary_type(\n" +
" type, name, remark)\n" +
" VALUES (?, ?, ?);";
public Integer addDictionaryType(DictionaryType dictionaryType) {
return jdbcTemplate.update(SAVE_DICTIONARYTYPE,
new Object[]{
dictionaryType.getType(),dictionaryType.getName(),dictionaryType.getRemark()});
}
private static final String UPDATE_DICTIONARYTYPE= "UPDATE tbl_dictionary_type\n" +
" SET type=?, name=?, remark=?\n" +
" WHERE id=?;";
public Integer updateDictionaryType(DictionaryType dictionaryType) {
return jdbcTemplate.update(UPDATE_DICTIONARYTYPE,
new Object[]{
dictionaryType.getType(),dictionaryType.getName(),dictionaryType.getRemark(),dictionaryType.getId()});
}
}
package vion.dao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import vion.model.Account;
import vion.model.File;
import vion.model.Store;
import java.util.List;
@Repository
public class FileDao {
@Autowired
private JdbcTemplate jdbcTemplate;
private static final String SELECT_FILE_ALL = "SELECT * FROM tbl_file_info";
public List<File> getFileAll() {
return jdbcTemplate.query(SELECT_FILE_ALL, new BeanPropertyRowMapper<File>(File.class));
}
private static final String SELECT_FILE_BY_SOURCEID = "SELECT * FROM tbl_file_info where store_id=? and source_id=?";
public List<File> getFileBySourceId(Integer store_id,Integer source_id) {
return jdbcTemplate.query(SELECT_FILE_BY_SOURCEID,new Object[]{store_id,source_id},
new BeanPropertyRowMapper<File>(File.class));
}
/*
private static final String SAVE_FILE= "INSERT INTO tbl_file_info(\n" +
" store_id, type, source_type, source_id, name, url)\n" +
" VALUES (?, ?, ?, ?, ?, ?);";
public Integer addFile(File file) {
return jdbcTemplate.update(SAVE_FILE,
new Object[]{file.getStore_id(),file.getType(),file.getSource_type(),
file.getSource_id(),file.getName(),file.getUrl()});
}
private static final String UPDATE_FILE= "UPDATE tbl_file_info\n" +
" SET store_id=? WHERE source_id=?";
public Integer updateFileStoreid(File file) {
return jdbcTemplate.update(UPDATE_FILE,
new Object[]{file.getStore_id(),file.getSource_id()});
}*/
}
package vion.dao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import vion.model.Inspect;
import java.util.Date;
import java.util.List;
@Repository
public class InspectDao {
@Autowired
private JdbcTemplate jdbcTemplate;
private static final String SELECT_INSPECT_ALL = "SELECT * FROM tbl_inspect_info";
public List<Inspect> getInspectAll() {
return jdbcTemplate.query(SELECT_INSPECT_ALL, new BeanPropertyRowMapper<Inspect>(Inspect.class));
}
private static final String SELECT_INSPECT_BY_ID = "SELECT * FROM tbl_inspect_info WHERE id=?";
public Inspect getInspectByID(Integer id) {
List<Inspect> inspects= jdbcTemplate.query(SELECT_INSPECT_BY_ID,new Object[]{id}, new BeanPropertyRowMapper<Inspect>(Inspect.class));
if(inspects.size()>0){
return inspects.get(0);
}else{
return null;
}
}
private static final String SELECT_INSPECT_BY_PARM= "SELECT * FROM tbl_inspect_info WHERE account_id=? ";
public List<Inspect> getInspectByParm(Integer account_id, Integer store_id, Date startdate,
Date enddate, Integer status) {
StringBuffer getInspectSb = new StringBuffer(SELECT_INSPECT_BY_PARM);
if(store_id!=null){
getInspectSb.append(" and store_id = "+store_id+"");
}
if(startdate!=null){
getInspectSb.append(" and inspect_date>='"+startdate+"'");
}
if(enddate!=null){
getInspectSb.append(" and inspect_date<='"+enddate+"'");
}
if(status!=null){
getInspectSb.append(" and status="+status+"");
}
return jdbcTemplate.query(getInspectSb.toString(),new Object[]{account_id}, new BeanPropertyRowMapper<Inspect>(Inspect.class));
}
/*
private static final String SAVE_INSPECT= "INSERT INTO tbl_inspect_info(\n" +
" store_id, inspect_date, type, status, inspect_user, reviewer, \n" +
" audit_date, finish_date, remark)\n" +
" VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);";
public Integer addInspect(Inspect inspect) {
return jdbcTemplate.update(SAVE_INSPECT,
new Object[]{
inspect.getStore_id(),inspect.getInspect_date(),inspect.getType(),inspect.getStatus(),
inspect.getInspect_user(),inspect.getReviewer(),inspect.getAudit_date(),
inspect.getFinish_date(),inspect.getRemark()});
}
private static final String UPDATE_INSPECT= "UPDATE tbl_inspect_info\n" +
" SET store_id=?, inspect_date=?, type=?, status=?, inspect_user=?, \n" +
" reviewer=?, audit_date=?, finish_date=?, modify_time=?, \n" +
" remark=?\n" +
" WHERE id=?;";
public Integer updateInspect(Inspect inspect) {
return jdbcTemplate.update(UPDATE_INSPECT,
new Object[]{
inspect.getStore_id(),inspect.getInspect_date(),inspect.getType(),inspect.getStatus(),
inspect.getInspect_user(),inspect.getReviewer(),inspect.getAudit_date(),
inspect.getFinish_date(),inspect.getModify_time(),inspect.getRemark(),
inspect.getId()});
}
private static final String UPDATE_INSPECT_STATUS= "UPDATE tbl_inspect_info\n" +
" SET status=?,reviewer=?, audit_date=?, finish_date=?, modify_time=? \n" +
" WHERE id=?;";
public Integer updateInspectStatus(Inspect inspect) {
return jdbcTemplate.update(UPDATE_INSPECT_STATUS,
new Object[]{
inspect.getStatus(),inspect.getReviewer(),inspect.getAudit_date(),
inspect.getFinish_date(),inspect.getModify_time(),inspect.getId()});
}*/
}
package vion.dao;
import cn.hutool.core.util.StrUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import vion.model.File;
import vion.model.Product;
import vion.model.Store;
import java.util.Date;
import java.util.List;
@Repository
public class ProductDao {
@Autowired
private JdbcTemplate jdbcTemplate;
private static final String SELECT_PRODUCT_ALL = "SELECT * FROM tbl_product_info";
public List<Product> getProductAll() {
return jdbcTemplate.query(SELECT_PRODUCT_ALL, new BeanPropertyRowMapper<Product>(Product.class));
}
private static final String SELECT_PRODUCT_BY_ID = "SELECT * FROM tbl_product_info where id=?";
public Product getProductByID(Integer id) {
List<Product> products= jdbcTemplate.query(SELECT_PRODUCT_BY_ID,new Object[]{id},
new BeanPropertyRowMapper<Product>(Product.class));
if(products.size()>0){
return products.get(0);
}else{
return null;
}
}
private static final String SELECT_PRODUCT_BY_PARM= "SELECT * FROM tbl_product_info WHERE account_id=? and id=? ";
public List<Product> getProductByParm(Integer accountid, Integer id, String name, Integer brand, Integer functionary) {
StringBuffer getProductSb = new StringBuffer(SELECT_PRODUCT_BY_PARM);
if(!StrUtil.isBlank(name)){
getProductSb.append(" and name='"+name+"'");
}
if(brand!=null){
getProductSb.append(" and brand="+brand+"");
}
if(functionary!=null){
getProductSb.append(" and functionary="+functionary+"");
}
return jdbcTemplate.query(getProductSb.toString(),new Object[]{accountid,id}, new BeanPropertyRowMapper<Product>(Product.class));
}
private static final String SAVE_PRODUCT= "INSERT INTO tbl_product_info(\n" +
" material_no, store_id, name, functionary, brand, product_count, \n" +
" product_price, product_subtotal, product_total_price,remark,account_id)\n" +
" VALUES (?, ?, ?, ?, ?, ?, ?, \n" +
" ?, ?, ?,?);";
/*
public Integer addProduct(Product product) {
return jdbcTemplate.update(SAVE_PRODUCT,
new Object[]{product.getMaterial_no(),product.getStore_id(),product.getName(),
product.getFunctionary(),product.getBrand(),product.getProduct_count(),
product.getProduct_price(),product.getProduct_subtotal(),product.getProduct_total_price(),
product.getRemark(),product.getAccount_id()});
}
private static final String UPDATE_PRODUCT= "UPDATE tbl_product_info\n" +
" SET material_no=?, store_id=?, name=?, functionary=?, brand=?, \n" +
" product_count=?, product_price=?, product_subtotal=?, product_total_price=?, \n" +
" modify_time=?, remark=?,account_id=?\n" +
" WHERE id=?;";
public Integer updateProduct(Product product) {
return jdbcTemplate.update(UPDATE_PRODUCT,
new Object[]{product.getMaterial_no(),product.getStore_id(),product.getName(),
product.getFunctionary(),product.getBrand(),product.getProduct_count(),
product.getProduct_price(),product.getProduct_subtotal(),
product.getProduct_total_price(),product.getModify_time(),
product.getRemark(),product.getId(),product.getAccount_id()});
}*/
}
package vion.dao;
import cn.hutool.core.util.StrUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import vion.model.Address;
import vion.model.Store;
import vion.vo.StoreVO;
import java.util.Date;
import java.util.List;
@Repository
public class StoreDao {
@Autowired
private JdbcTemplate jdbcTemplate;
private static final String SELECT_STORE_ALL= "SELECT * FROM tbl_store_info";
public List<Store> getStoreAll() {
return jdbcTemplate.query(SELECT_STORE_ALL, new BeanPropertyRowMapper<Store>(Store.class));
}
private static final String SAVE_STORE= "INSERT INTO tbl_store_info(\n" +
" storenum, name, \"number\", contract_code, amount, orderdate, \n" +
" salesperson, warranty_period, customer_name, implement_type, \n" +
" project_state, contacts, create_user,remark, project_stage,account_id)\n" +
" VALUES (?, ?, ?, ?, ?, ?, \n" +
" ?, ?, ?, ?, ?,\n" +
" ?, ?, ?, ?, ?);";
public Integer addStore(StoreVO store) {
return jdbcTemplate.update(SAVE_STORE,
new Object[]{
store.getStorenum(),store.getName(),store.getNumber(),store.getContract_code(),store.getAmount(),
store.getOrderdate(),store.getSalesperson(),store.getWarranty_period(),store.getCustomer_name(),
store.getImplement_type(),store.getProject_state(),
store.getContacts(),store.getCreate_user(),store.getRemark(),
store.getProject_stage(),store.getAccount_id()});
}
private static final String UPDATE_STORE= "UPDATE tbl_store_info\n" +
" SET storenum=?, name=?, \"number\"=?, contract_code=?, amount=?, \n" +
" orderdate=?, salesperson=?, warranty_period=?, customer_name=?, \n" +
" implement_type=?, project_state=?, contacts=?, \n" +
" modify_user=?, modify_time=?, remark=?, \n" +
" project_stage=?,account_id=?\n" +
" WHERE id=?;";
public Integer updateStore(StoreVO store) {
return jdbcTemplate.update(UPDATE_STORE,
new Object[]{
store.getStorenum(),store.getName(),store.getNumber(),store.getContract_code(),store.getAmount(),
store.getOrderdate(),store.getSalesperson(),store.getWarranty_period(),store.getCustomer_name(),
store.getImplement_type(),store.getProject_state(),store.getContacts(),
store.getModify_user(),store.getModify_time(),store.getRemark(),store.getProject_stage(),
store.getAccount_id(),store.getId()});
}
private static final String UPDATE_STORE_STAGE= "UPDATE tbl_store_info SET project_stage=? WHERE id=?;";
public Integer updateStoreStage(Integer id,Integer project_stage) {
return jdbcTemplate.update(UPDATE_STORE_STAGE,
new Object[]{project_stage,id});
}
private static final String SELECT_STORE_BY_PARM= "SELECT * FROM tbl_store_info WHERE account_id=? and id=? ";
public List<Store> getStoreByParm(Integer accountid, Integer id, String storenum, Integer project_state,
String salesperson, Integer implement_type, Date startdate, Date enddate) {
StringBuffer getPlazaSb = new StringBuffer(SELECT_STORE_BY_PARM);
if(!StrUtil.isBlank(storenum)){
getPlazaSb.append(" and storenum='"+storenum+"'");
}
if(project_state!=null){
getPlazaSb.append(" and project_state="+project_state+"");
}
if(!StrUtil.isBlank(salesperson)){
getPlazaSb.append(" and salesperson='"+salesperson+"'");
}
if(implement_type!=null){
getPlazaSb.append(" and implement_type="+implement_type+"");
}
if(startdate!=null){
getPlazaSb.append(" and orderdate>='"+startdate+"'");
}
if(enddate!=null){
getPlazaSb.append(" and orderdate>='"+enddate+"'");
}
return jdbcTemplate.query(getPlazaSb.toString(),new Object[]{accountid,id}, new BeanPropertyRowMapper<Store>(Store.class));
}
private static final String SELECT_STORE_BY_ID= "select s.*,a.consignee_name,a.consignee_phone,a.consignee_address,a.contract_name,a.contract_phone,a.contract_address,a.invoice_name,a.invoice_phone,a.invoice_address,a.invoice_info \n" +
"from tbl_store_info as s left join tbl_address_info as a on a.store_id=s.id and s.id=?";
public StoreVO getStoreByID(Integer id) {
List<StoreVO> stores= jdbcTemplate.query(SELECT_STORE_BY_ID,new Object[]{id}, new BeanPropertyRowMapper<StoreVO>(StoreVO.class));
if(stores.size()>0){
return stores.get(0);
}else{
return null;
}
}
private static final String SAVE_ADDRESS= "INSERT INTO tbl_address_info(\n" +
" store_id, consignee_name, consignee_phone, consignee_address, \n" +
" contract_name, contract_phone, contract_address, invoice_name, \n" +
" invoice_phone, invoice_address, invoice_info)\n" +
" VALUES (?, ?, ?, ?, \n" +
" ?, ?, ?, ?, \n" +
" ?, ?, ?);";
public Integer addAddress(StoreVO address) {
return jdbcTemplate.update(SAVE_ADDRESS,
new Object[]{
address.getId(),address.getConsignee_name(),address.getConsignee_phone(),address.getConsignee_address(),
address.getContract_name(),address.getContract_phone(),address.getContract_address(),address.getInvoice_name(),
address.getInvoice_phone(),address.getInvoice_address(),address.getInvoice_info()
});
}
private static final String UPDATE_ADDRESS= "UPDATE tbl_address_info\n" +
" SET consignee_name=?, consignee_phone=?, consignee_address=?, \n" +
" contract_name=?, contract_phone=?, contract_address=?, invoice_name=?, \n" +
" invoice_phone=?, invoice_address=?, invoice_info=?\n" +
" WHERE store_id=?;";
public Integer updateAddress(StoreVO address) {
return jdbcTemplate.update(UPDATE_ADDRESS,
new Object[]{
address.getConsignee_name(),address.getConsignee_phone(),address.getConsignee_address(),
address.getContract_name(),address.getContract_phone(),address.getContract_address(),address.getInvoice_name(),
address.getInvoice_phone(),address.getInvoice_address(),address.getInvoice_info(),address.getId()
});
}
}
package vion.dao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import vion.model.FaultLog;
import vion.model.Task;
import java.util.Date;
import java.util.List;
@Repository
public class TaskDao {
@Autowired
private JdbcTemplate jdbcTemplate;
private static final String SELECT_WORKORDRE_ALL = "SELECT * FROM tbl_task_info";
public List<Task> getTaskAll() {
return jdbcTemplate.query(SELECT_WORKORDRE_ALL, new BeanPropertyRowMapper<Task>(Task.class));
}
private static final String SELECT_WORKORDRE_BY_ID = "SELECT * FROM tbl_task_info where id=?";
public Task getTaskByID(Integer id) {
List<Task> tasks= jdbcTemplate.query(SELECT_WORKORDRE_BY_ID,new Object[]{id},
new BeanPropertyRowMapper<Task>(Task.class));
if(tasks.size()>0){
return tasks.get(0);
}else{
return null;
}
}
private static final String SELECT_WORKORDRE_BY_PARM= "SELECT * FROM tbl_task_info WHERE account_id=?";
public List<Task> getTaskByParm(Integer accountid,Integer store_id, Date startdate,
Date enddate,Integer status,Integer fault_type) {
StringBuffer getTaskSb = new StringBuffer(SELECT_WORKORDRE_BY_PARM);
if(store_id!=null){
getTaskSb.append(" and store_id = "+store_id+"");
}
if(startdate!=null){
getTaskSb.append(" and repair_date>='"+startdate+"'");
}
if(enddate!=null){
getTaskSb.append(" and repair_date<='"+enddate+"'");
}
if(status!=null){
getTaskSb.append(" and status="+status+"");
}
if(fault_type!=null){
getTaskSb.append(" and fault_type="+fault_type+"");
}
return jdbcTemplate.query(getTaskSb.toString(),new Object[]{accountid},
new BeanPropertyRowMapper<Task>(Task.class));
}
private static final String SAVE_WORKORDRE= "INSERT INTO tbl_task_info(\n" +
" store_id, repair_date, fault_type, fault_description, repair_people, \n" +
" repair_phone, status, solve_date, fault_reason, solve_type, solve_description, \n" +
" create_user, remark,account_id)\n" +
" VALUES (?, ?, ?, ?, ?, ?, \n" +
" ?, ?, ?, ?, ?, ?, \n" +
" ?, ? );";
/*
public Task addTask(Task task) {
return jdbcTemplate.queryForObject(SAVE_WORKORDRE,
new Object[]{
task.getStore_id(),task.getRepair_date(),task.getFault_type(),
task.getFault_description(),task.getRepair_people(),task.getRepair_phone(),
task.getStatus(),task.getSolve_date(),task.getFault_reason(),task.getSolve_type(),
task.getSolve_description(),task.getCreate_user(),
task.getRemark(),task.getAccount_id()}
, new BeanPropertyRowMapper<Task>(Task.class));
}
private static final String UPDATE_WORKORDRE= "UPDATE tbl_task_info\n" +
" SET store_id=?, repair_date=?, fault_type=?, fault_description=?, \n" +
" repair_people=?, repair_phone=?, status=?, solve_date=?, fault_reason=?, \n" +
" solve_type=?, solve_description=?, create_user=?, \"current_user\"=?, \n" +
" modify_time=?, remark=?, account_id=?\n" +
" WHERE id=?;";
public Integer updateTask(Task task) {
return jdbcTemplate.update(UPDATE_WORKORDRE,
new Object[]{
task.getStore_id(),task.getRepair_date(),task.getFault_type(),
task.getFault_description(),task.getRepair_people(),task.getRepair_phone(),
task.getStatus(),task.getSolve_date(),task.getFault_reason(),task.getSolve_type(),
task.getSolve_description(),task.getCreate_user(),task.getCurrent_user(),
task.getModify_time(),task.getRemark(),task.getAccount_id(),task.getId()});
}
private static final String SELECT_FAULTLOG_BY_STOREID = "SELECT * FROM tbl_fault_log where store_id=? and workorder_id=?";
public FaultLog getFaultlogByStoreID(Integer store_id,Integer workorder_id) {
List<FaultLog> faultLogs= jdbcTemplate.query(SELECT_FAULTLOG_BY_STOREID,new Object[]{store_id,workorder_id},
new BeanPropertyRowMapper<FaultLog>(FaultLog.class));
if(faultLogs.size()>0){
return faultLogs.get(0);
}else{
return null;
}
}
private static final String SAVE_FAULTLOG= "INSERT INTO tbl_fault_log(\n" +
" store_id, workorder_id, operator, content, remark)\n" +
" VALUES (?, ?, ?, ?, ?);";
public Integer addFaultLog(FaultLog faultLog) {
return jdbcTemplate.update(SAVE_FAULTLOG,
new Object[]{
faultLog.getStore_id(),faultLog.getTask_id(),faultLog.getOperator(),
faultLog.getContent(),faultLog.getRemark()});
}*/
}
package vion.dao;
import cn.hutool.core.util.StrUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import vion.model.TaskTemp;
import java.util.Date;
import java.util.List;
@Repository
public class TaskTempDao {
@Autowired
private JdbcTemplate jdbcTemplate;
private static final String SELECT_WORK_TEMP_ALL = "SELECT * FROM tbl_task_temp";
public List<TaskTemp> getTaskTempAll() {
return jdbcTemplate.query(SELECT_WORK_TEMP_ALL, new BeanPropertyRowMapper<TaskTemp>(TaskTemp.class));
}
private static final String SELECT_WORK_TEMP_BY_ID = "SELECT * FROM tbl_task_temp where id=?";
public TaskTemp getTaskTempByID(Integer id) {
List<TaskTemp> taskTemps= jdbcTemplate.query(SELECT_WORK_TEMP_BY_ID,new Object[]{id}, new BeanPropertyRowMapper<TaskTemp>(TaskTemp.class));
if(taskTemps.size()>0){
return taskTemps.get(0);
}else{
return null;
}
}
private static final String SELECT_PRODUCT_BY_PARM= "SELECT * FROM tbl_product_info WHERE 1=1 ";
public List<TaskTemp> getTaskTempByParm(Integer store_id,String store_name, Date startdate, Date enddate, Integer status) {
StringBuffer getWorkOrderSb = new StringBuffer(SELECT_PRODUCT_BY_PARM);
if(!StrUtil.isBlank(store_name)){
getWorkOrderSb.append(" and store_name like '%"+store_name+"%'");
}
if(startdate!=null){
getWorkOrderSb.append(" and repair_date>='"+startdate+"'");
}
if(enddate!=null){
getWorkOrderSb.append(" and repair_date<='"+enddate+"'");
}
if(status!=null){
getWorkOrderSb.append(" and status="+status+"");
}
if(store_id!=null){
getWorkOrderSb.append(" and store_id="+store_id+"");
}
return jdbcTemplate.query(getWorkOrderSb.toString(),new BeanPropertyRowMapper<TaskTemp>(TaskTemp.class));
}
private static final String SAVE_WORK_ORDER_TEMP= "INSERT INTO tbl_task_temp(\n" +
" store_name, repair_date, fault_description, repair_people, \n" +
" repair_phone, status, operator, remark)\n" +
" VALUES (?, ?, ?, ?, ?, \n" +
" ?, ?, ?, ?, ?) RETURNING *;";//
/*
public TaskTemp addTaskTemp(TaskTemp order_temp) {
return jdbcTemplate.queryForObject(SAVE_WORK_ORDER_TEMP,
new Object[]{order_temp.getStore_name(),order_temp.getRepair_date(),order_temp.getFault_description(),
order_temp.getRepair_people(),order_temp.getRepair_phone(),order_temp.getStatus(),
order_temp.getOperator(),order_temp.getRemark()},
new BeanPropertyRowMapper<TaskTemp>(TaskTemp.class));
}
private static final String UPDATE_WORK_ORDER_TEMP= "UPDATE tbl_task_temp\n" +
" SET status=?, operator=?, modify_time=?" +
" WHERE id=?";
public Integer updateTaskTemp(TaskTemp order_temp) {
return jdbcTemplate.update(UPDATE_WORK_ORDER_TEMP,
new Object[]{order_temp.getStatus(),order_temp.getOperator(),
order_temp.getModify_time(),order_temp.getId()});
}*/
}
package vion.dao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
import vion.model.User;
import java.util.List;
@Repository
public class UserDao {
@Autowired
private JdbcTemplate jdbcTemplate;
private static final String SELECT_USER_ALL = "SELECT * FROM tbl_user_info";
public List<User> getUserAll() {
return jdbcTemplate.query(SELECT_USER_ALL, new BeanPropertyRowMapper<User>(User.class));
}
private static final String SELECT_USER_BY_ID = "SELECT * FROM tbl_user_info where id=?";
public User getUserById(Integer id) {
return jdbcTemplate.queryForObject(SELECT_USER_BY_ID,new Object[]{id}, new BeanPropertyRowMapper<User>(User.class));
}
private static final String SELECT_USER_BY_USERID = "SELECT * FROM tbl_user_info where userid=?";
//根据钉钉存的userid判断是否存在
public User getUserByUserid(String userid) {
List<User> users= jdbcTemplate.query(SELECT_USER_BY_USERID,new Object[]{userid}, new BeanPropertyRowMapper<User>(User.class));
if(users.size()>0){
return users.get(0);
}else{
return null;
}
}
private static final String SAVE_USER= "INSERT INTO tbl_user_info(\n" +
" userid, username, phone)\n" +
" VALUES (?, ?, ?);";
public Integer addUser(User user) {
return jdbcTemplate.update(SAVE_USER,
new Object[]{user.getUserid(),user.getUsername(),user.getPhone()});
}
/*
private static final String UPDATE_USER= "UPDATE tbl_user_info\n" +
" SET username=?, phone=?,modify_time=?" +
" WHERE userid=? \n";
public Integer updateUserByUserid(User user) {
return jdbcTemplate.update(UPDATE_USER,
new Object[]{user.getUsername(),user.getPhone(),user.getModify_time(),user.getUserid()});
}
private static final String UPDATE_USER_PASS= "UPDATE tbl_user_info\n" +
" SET password=?,modify_time=?,remark=? " +
" WHERE userid=? \n";
public Integer updateUserPassByUserid(User user) {
return jdbcTemplate.update(UPDATE_USER_PASS,
new Object[]{user.getPassword(),user.getModify_time(),user.getRemark(),user.getUserid()});
}*/
}
package vion.enums;
public enum ResultEnum {
/**
* 登录失败
*/
LOGIN_ERROR(503, "Login Failed"),
/**
* 数据重复(目前没用)
*/
DATA_ERROR(502, "The data is incorrect. There may be duplicate data. Please check the data"),
/**
* atoken校验失败
*/
ATOKEN_ERROR(501, "atoken verification failed"),
/**
* 错误
*/
ERROR(505, "Failed to update or add"),
/**
* 插入或更新时有失败的数据
*/
SAVE_OR_UPDATE_ERROR(500, "Failed to save or update"),
/**
* 成功
*/
SUCCESS(200, "success"),
/**
* 查询数据为空或是查询出错
*/
SELECT_ERROR(506, "Data does not exist or search error"),
/**
* 查询分钟数据不是同一天
*/
ISNOTSAMEDAY(507, "The time interval between entries is not one day"),
/**
* 参数不全或参数错误提示
*/
FALSEPARAM(508, "Parameter error, please enter correct parameter"),
ILLEGALPARAM(513, "The parameter contains illegal characters"),
NOTVALIDMODIFYTIME(509, "The modification entered is not in the valid range"),
TIMEOUTOFWEEKS(511, "The interval between start date and end date exceeds 7 days"),
FREQUENCYERROR(512, "Interface requests are too frequent"),
MARK_ERROR(514, "Mark failed"),
IMAGE_ERROR(515, "The picture does not fit");
private final Integer code;
private final String message;
ResultEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
public Integer getCode() {
return code;
}
public String getMessage() {
return message;
}
}
package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import vion.model.Account;
@Mapper
public interface AccountMapper extends BaseMapper<Account> {
}
package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import vion.model.Account;
import vion.model.Address;
@Mapper
public interface AddressMapper extends BaseMapper<Address> {
}
package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import vion.model.Address;
import vion.model.Dictionary;
@Mapper
public interface DictionaryMapper extends BaseMapper<Dictionary> {
}
package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import vion.model.Address;
import vion.model.DictionaryType;
@Mapper
public interface DictionaryTypeMapper extends BaseMapper<DictionaryType> {
}
package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import vion.model.Address;
import vion.model.FaultLog;
@Mapper
public interface FaultLogMapper extends BaseMapper<FaultLog> {
}
package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import vion.model.Address;
import vion.model.File;
@Mapper
public interface FileMapper extends BaseMapper<File> {
}
package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import vion.model.Address;
import vion.model.Inspect;
@Mapper
public interface InspectMapper extends BaseMapper<Inspect> {
}
package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import vion.model.Address;
import vion.model.Product;
@Mapper
public interface ProductMapper extends BaseMapper<Product> {
}
package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import vion.model.Product;
import vion.model.Store;
@Mapper
public interface StoreMapper extends BaseMapper<Store> {
}
package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import vion.model.Product;
import vion.model.Task;
@Mapper
public interface TaskMapper extends BaseMapper<Task> {
}
package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import vion.model.TaskTemp;
@Mapper
public interface TaskTempMapper extends BaseMapper<TaskTemp> {
}
package vion.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import vion.model.Product;
import vion.model.User;
@Mapper
public interface UserMapper extends BaseMapper<User> {
}
package vion.model;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
/**
* 集团信息
*/
import java.util.Date;
@Data
@TableName(value="tbl_account_info")
public class Account {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;//自增列
private String name;//名称
private Date createTime;//创建时间
private Date modifyTime;//修改时间
private String remark;//备注
}
package vion.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
/**
* 门店地址信息
*/
@Data
@TableName(value="tbl_address_info")
public class Address {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;//自增列
private Integer store_id;//门店编码(外键)
private String consignee_name;//收货名称
private String consignee_phone;//收货手机号
private String consignee_address;//收货地址
private String contract_name;//合同姓名
private String contract_phone;//合同手机号
private String contract_address;//合同地址
private String invoice_name ;//发票姓名
private String invoice_phone;//发票手机号
private String invoice_address;//发票地址
private String invoice_info;//开票信息
private Integer storeId;//门店编码(外键)
private String consigneeName;//收货名称
private String consigneePhone;//收货手机号
private String consigneeAddress;//收货地址
private String contractName;//合同姓名
private String contractPhone;//合同手机号
private String contractAddress;//合同地址
private String invoiceName ;//发票姓名
private String invoicePhone;//发票手机号
private String invoiceAddress;//发票地址
private String invoiceInfo;//开票信息
private String remark;//备注
}
package vion.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName(value="tbl_dictionary_info")
public class Dictionary {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private String type;
private Integer key;
private String value;
private String remark;
}
package vion.model;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName(value="tbl_dictionary_type")
public class DictionaryType {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private String name;
private String type;
private String remark;
}
package vion.model;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
......@@ -8,12 +9,14 @@ import java.util.Date;
* 工单操作记录
*/
@Data
public class Fault_log {
@TableName(value="tbl_fault_log")
public class FaultLog {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;//自增列
private Integer store_id;//门店id(外键)
private Integer workorder_id;//工单id(外键)
private Integer storeId;//门店id(外键)
private Integer taskId;//工单id(外键)
private Integer operator;//操作者
private String content;//操作内容
private Date create_time;//创建时间
private Date createTime;//创建时间
private String remark;//备注
}
package vion.model;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
......@@ -8,14 +9,16 @@ import java.util.Date;
* 文件信息
*/
@Data
@TableName(value="tbl_file_info")
public class File {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;//自增列
private Integer store_id;//门店id(外键)
private Integer storeId;//门店id(外键)
private Integer type;//文件类型(1图片 2文件)
private Integer source_type;//文件来源(项目、工单预处理,工单操作,巡检)
private Integer source_id;//文件来源id
private Integer sourceType;//文件来源(项目、工单预处理,工单操作,巡检)
private Integer sourceId;//文件来源id
private String name;//文件名称
private String url;//文件地址
private Date create_time;//创建时间
private Date createTime;//创建时间
private String remark;//备注
}
package vion.model;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
......@@ -8,17 +9,18 @@ import java.util.Date;
* 巡检信息
*/
@Data
@TableName(value="tbl_inspect_info")
public class Inspect {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;//自增列
private Integer store_id;//门店id(外键)
private Date inspect_date;//巡检日期
private Integer storeId;//门店id(外键)
private Date inspectDate;//巡检日期
private Integer type;//巡检方式(0远程、1现场)
private Integer status;//状态(0进行中、1待审核、2已完成、3、驳回)
private Integer inspect_user;//巡检人
private Integer inspectUser;//巡检人
private Integer reviewer;//审核人
private Date audit_date;//审核日期
private Date finish_date;//完成日期
private Date create_time;//创建时间
private Date modify_time;//修改时间
private Date finishDate;//完成日期
private Date createTime;//创建时间
private Date modifyTime;//修改时间
private String remark;//备注
}
package vion.model;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
......@@ -8,18 +9,21 @@ import java.util.Date;
* 产品信息
*/
@Data
@TableName(value="tbl_product_info")
public class Product {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;//自增列
private String material_no;//物料编号
private Integer store_id;//门店id(外键)
private String materialNo;//物料编号
private Integer storeId;//门店id(外键)
private String name;//产品名称
private Integer functionary;//产品型号
private Integer brand;//品牌
private Integer product_count;//订货数量
private Float product_price;//订货单价
private Float product_subtotal;//定后价小计(单价乘以数量)
private Float product_total_price;//订货总价
private Date create_time;//创建时间
private Date modify_time;//修改时间
private Integer productCount;//订货数量
private Float productPrice;//订货单价
private Float productSubtotal;//定后价小计(单价乘以数量)
private Float productTotal_price;//订货总价
private Date createTime;//创建时间
private Date modifyTime;//修改时间
private String remark;//备注
private Integer accountId;//集团id
}
package vion.model;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
......@@ -8,25 +9,27 @@ import java.util.Date;
* 门店信息
*/
@Data
@TableName(value="tbl_store_info")
public class Store {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private String storenum;
private String name ;// 门店名称
private String number;// 流水号
private String contract_code;//合同编码
private String contractCode;//合同编码
private Float amount;// 合同金额
private Date orderdate;//签订日期
private String salesperson;//销售人
private Integer warranty_period;//质保期
private String customer_name;//客户姓名
private Integer product_type;//产品型号
private Integer implement_type;//实施类型:0纯供货、1供货+安装、3续保、4维修
private Integer project_state;//项目状态:0待确认、1进行中、2已完成、3挂起
private Integer salesperson;//销售人
private Integer warrantyPeriod;//质保期
private String customerName;//客户姓名
private Integer implementType;//实施类型:0纯供货、1供货+安装、3续保、4维修
private Integer projectState;//项目状态:0待确认、1进行中、2已完成、3挂起
private String contacts;//联系人(多个联系人逗号隔开)
private Integer create_user;//创建者
private Integer modify_user;//修改者
private Date create_time;//创建时间
private Date modify_time;//修改时间
private Integer createUser;//创建者
private Integer modifyUser;//修改者
private Date createTime;//创建时间
private Date modifyTime;//修改时间
private String remark;//备注
private Integer project_stage;//项目阶段
private Integer projectStage;//项目阶段
private Integer accountId;//集团id
}
package vion.model;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
@Data
@TableName(value="tbl_task_info")
public class Task {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;//自增列
private Integer storeId;//门店id(外键)
private Date repairDate;//报修日期
private Integer faultType;//故障类型
private String faultDescription;//故障说明
private Integer repairPeople;//报修人
private String repairPhone;//报修人联系方式
private Integer status;//状态:0待确认1进行中2已完成3挂起
private Date solveDate;//解决日期
private String faultReason;//故障原因
private Integer solveType;//解决措施:0产品BUG、1使用问题、2需求问题
private String solveDescription;//解决故障描述
private Integer createUser;//创建者
private Integer currentuser;//当前处理人
private Date createTime;//创建时间
private Date modifyTime;//修改时间
private String remark;//备注
private Integer accountId;//集团id
}
package vion.model;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
@Data
@TableName(value="tbl_task_temp")
public class TaskTemp {
@TableId(type= IdType.AUTO)
private Integer id;//自增列
private Integer storeId;//项目名称
private String storeName;//项目名称
private Date repairDate;//报修日期
private String faultDescription;//故障说明
private String repairPeople;//报修人
private String repairPhone;//联系方式
private Integer status;//状态(1待确认、2已确认)
private Integer operator;//操作人
private Date createTime;//创建时间
private Date modifyTime;//修改时间
private String remark;//备注
}
package vion.model;
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
......@@ -8,10 +9,15 @@ import java.util.Date;
* 用户信息
*/
@Data
@TableName(value="tbl_user_info")
public class User {
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
private String name;
private String userid;
private String username;
private String password;
private Date create_time;
private String phone;
private Date createTime;//创建时间
private Date modifyTime;
private String remark;
}
package vion.service;
import com.baomidou.mybatisplus.extension.service.IService;
import vion.model.Account;
public interface IAccountSerrvice extends IService<Account> {
Account saveAndReturn(Account account);
}
package vion.service;
import com.baomidou.mybatisplus.extension.service.IService;
import vion.model.Address;
public interface IAddressSerrvice extends IService<Address> {
}
package vion.service;
import com.baomidou.mybatisplus.extension.service.IService;
import vion.model.Dictionary;
public interface IDictionarySerrvice extends IService<Dictionary> {
}
package vion.service;
import com.baomidou.mybatisplus.extension.service.IService;
import vion.model.Account;
import vion.model.DictionaryType;
public interface IDictionaryTypeSerrvice extends IService<DictionaryType> {
}
package vion.service;
import com.baomidou.mybatisplus.extension.service.IService;
import vion.model.FaultLog;
public interface IFaultLogSerrvice extends IService<FaultLog> {
}
package vion.service;
import com.baomidou.mybatisplus.extension.service.IService;
import vion.model.File;
public interface IFileSerrvice extends IService<File> {
}
package vion.service;
import com.baomidou.mybatisplus.extension.service.IService;
import vion.model.Inspect;
public interface IInspectSerrvice extends IService<Inspect> {
Inspect saveAndReturn(Inspect inspect);
}
package vion.service;
import com.baomidou.mybatisplus.extension.service.IService;
import vion.model.Product;
public interface IProductSerrvice extends IService<Product> {
Product saveAndReturn(Product product);
}
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.service.IService;
import vion.model.Task;
public interface ITaskSerrvice extends IService<Task> {
Task saveAndReturn(Task task);
}
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.service.IService;
import vion.model.User;
public interface IUserSerrvice extends IService<User> {
User saveAndReturn(User user);
}
package vion.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import vion.mapper.AccountMapper;
import vion.model.Account;
import vion.service.IAccountSerrvice;
@Service
public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> implements IAccountSerrvice {
@Override
public Account saveAndReturn(Account account) {
this.saveOrUpdate(account);
return account;
}
}
package vion.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import vion.mapper.AddressMapper;
import vion.model.Address;
import vion.service.IAddressSerrvice;
@Service
public class AddressServiceImpl extends ServiceImpl<AddressMapper, Address> implements IAddressSerrvice {
}
package vion.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import vion.mapper.DictionaryMapper;
import vion.model.Dictionary;
import vion.service.IDictionarySerrvice;
@Service
public class DictionaryServiceImpl extends ServiceImpl<DictionaryMapper, Dictionary> implements IDictionarySerrvice {
}
package vion.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import vion.mapper.DictionaryTypeMapper;
import vion.model.DictionaryType;
import vion.service.IDictionaryTypeSerrvice;
@Service
public class DictionaryTypeServiceImpl extends ServiceImpl<DictionaryTypeMapper, DictionaryType> implements IDictionaryTypeSerrvice {
}
package vion.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import vion.mapper.FaultLogMapper;
import vion.model.FaultLog;
import vion.service.IFaultLogSerrvice;
@Service
public class FaultLogServiceImpl extends ServiceImpl<FaultLogMapper, FaultLog> implements IFaultLogSerrvice {
}
package vion.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import vion.mapper.FileMapper;
import vion.model.File;
import vion.service.IFileSerrvice;
@Service
public class FileServiceImpl extends ServiceImpl<FileMapper, File> implements IFileSerrvice {
}
package vion.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import vion.mapper.InspectMapper;
import vion.model.Inspect;
import vion.service.IInspectSerrvice;
@Service
public class InspectServiceImpl extends ServiceImpl<InspectMapper, Inspect> implements IInspectSerrvice {
@Override
public Inspect saveAndReturn(Inspect inspect) {
this.saveOrUpdate(inspect);
return inspect;
}
}
package vion.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import vion.mapper.ProductMapper;
import vion.model.Product;
import vion.service.IProductSerrvice;
@Service
public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements IProductSerrvice {
@Override
public Product saveAndReturn(Product product) {
this.saveOrUpdate(product);
return product;
}
}
package vion.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import vion.mapper.StoreMapper;
import vion.model.Store;
import vion.service.IStoreSerrvice;
@Service
public class StoreServiceImpl extends ServiceImpl<StoreMapper, Store> implements IStoreSerrvice {
@Override
public Store saveAndReturn(Store store) {
this.saveOrUpdate(store);
return store;
}
}
package vion.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import vion.mapper.TaskMapper;
import vion.model.Task;
import vion.service.ITaskSerrvice;
@Service
public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements ITaskSerrvice {
@Override
public Task saveAndReturn(Task task) {
this.saveOrUpdate(task);
return task;
}
}
package vion.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import vion.mapper.TaskTempMapper;
import vion.model.TaskTemp;
import vion.service.ITaskTempSerrvice;
@Service
public class TaskTempServiceImpl extends ServiceImpl<TaskTempMapper, TaskTemp> implements ITaskTempSerrvice {
@Override
public TaskTemp saveAndReturn(TaskTemp taskTemp) {
this.saveOrUpdate(taskTemp);
return taskTemp;
}
}
package vion.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import vion.mapper.UserMapper;
import vion.model.User;
import vion.service.IUserSerrvice;
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements IUserSerrvice {
@Override
public User saveAndReturn(User user) {
this.saveOrUpdate(user);
return user;
}
}
package vion.utils;
public class FileTypeTool {
public static int fileType(String fileName){
if(fileName==null){
return 0;
}else{
String fileType=fileName.substring(fileName.lastIndexOf(".")+1).toLowerCase();
//创建图片类型数组
String img[]={"bmp","jpg","jpeg","png","tiff","gif","pcx","tga","exif","fpx","svg","psd",
"cdr","pcd","dxf","ufo","eps","ai","raw","wmf"};
for(int i=0;i<img.length+1;i++){
if (img[i].equals(fileType)){
return 1;
}
}
//创建文档类型
String documet[]={"txt","doc","docx","xls","xlsx","htm","html","jsp","rtf","wpd","pdf","ppt"};
for(int i=0;i<documet.length+1;i++){
if (documet[i].equals(fileType)){
return 2;
}
}
//创建视频类型
String video[]={"mp4","avi","wmv","asf","navi","3gp","mkv","f4v","rmvb","webm"};
for(int i=0;i<video.length+1;i++){
if (video[i].equals(fileType)){
return 3;
}
}
//创建音乐类型
String music[]={"mp3","wma","wav","mod","ra","cd","md","asf","aac","vqf","ape","mid","ogg","m4a","vqf"};
for(int i=0;i<music.length+1;i++){
if (music[i].equals(fileType)){
return 4;
}
}
}
return 0;
}
}
package vion.utils;
import vion.enums.ResultEnum;
import vion.vo.ResultVO;
public class ResultUtil {
public static ResultVO<Object> success(Object o) {
ResultVO<Object> resultVO = new ResultVO<Object>();
resultVO.setCode(ResultEnum.SUCCESS.getCode());
resultVO.setMessage(ResultEnum.SUCCESS.getMessage());
resultVO.setData(o);
return resultVO;
}
public static ResultVO<Object> error(ResultEnum e) {
ResultVO<Object> resultVO = new ResultVO<Object>();
resultVO.setCode(e.getCode());
resultVO.setMessage(e.getMessage());
return resultVO;
}
public static ResultVO<Object> success() {
return success(null);
}
}
package vion.vo;
import lombok.Data;
import java.util.Date;
@Data
public class FaultLogVO {
private Integer id;//自增列
private Integer store_id;//门店id(外键)
private Integer task_id;//工单id(外键)
private Integer operator;//操作者
private String content;//操作内容
private Date create_time;//创建时间
private String remark;//备注
private String filename;//文件名称
private String fileurl;//文件url
}
package vion.vo;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import org.springframework.stereotype.Component;
@Component
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ResultVO<T> {
@JsonProperty(value = "msg_code")
private Integer code;
@JsonProperty(value = "msg_info")
private String message;
private String atoken;
private Integer totalNum;
private T data;
private T result;
}
package vion.vo;
import lombok.Data;
import java.util.Date;
@Data
public class StatusVO {
private Integer store_id;//门店id
private Integer project_stage;//阶段
private Integer source_type;//文件来源
private Integer source_id;//来源id
private Integer file_type;//文件类型
private String name;//名称
private String url;//地址
}
package vion.vo;
import lombok.Data;
import java.util.Date;
@Data
public class StoreVO {
private Integer id;
private String storenum;
private String name ;// 门店名称
private String number;// 流水号
private String contract_code;//合同编码
private Float amount;// 合同金额
private Date orderdate;//签订日期
private Integer salesperson;//销售人
private Integer warranty_period;//质保期
private String customer_name;//客户姓名
private Integer implement_type;//实施类型:0纯供货、1供货+安装、3续保、4维修
private Integer project_state;//项目状态:0待确认、1进行中、2已完成、3挂起
private String contacts;//联系人(多个联系人逗号隔开)
private Integer create_user;//创建者
private Integer modify_user;//修改者
private Date create_time;//创建时间
private Date modify_time;//修改时间
private String remark;//备注
private Integer project_stage;//项目阶段
private Integer account_id;//集团id
//地址信息
private String consignee_name;//收货名称
private String consignee_phone;//收货手机号
private String consignee_address;//收货地址
private String contract_name;//合同姓名
private String contract_phone;//合同手机号
private String contract_address;//合同地址
private String invoice_name ;//发票姓名
private String invoice_phone;//发票手机号
private String invoice_address;//发票地址
private String invoice_info;//开票信息
}
package vion.model;
package vion.vo;
import lombok.Data;
import java.util.Date;
/**
* 工单预处理信息
*/
@Data
public class Work_order_temp {
public class TaskTempVO {
private Integer id;//自增列
private String store_name;//项目名称
private Date repair_date;//报修日期
......@@ -16,7 +13,7 @@ public class Work_order_temp {
private String repair_people;//报修人
private String repair_phone;//联系方式
private Integer status;//状态(1待确认、2已确认)
private Integer operator;//操作人
private Date modify_time;//修改时间
private String remark;//备注
private Date createTime;
private String filename;//文件名称
private String fileurl;//文件url
}
package vion.model;
package vion.vo;
import lombok.Data;
import java.util.Date;
/**
* 工单信息
*/
@Data
public class Work_order {
public class TaskVO {
private Integer id;//自增列
private Integer store_id;//门店id(外键)
private Integer worktemp_id;//预处理工单id
private Date repair_date;//报修日期
private Integer fault_type;//故障类型
private String fault_description;//故障说明
......@@ -18,12 +16,15 @@ public class Work_order {
private String repair_phone;//报修人联系方式
private Integer status;//状态:0待确认1进行中2已完成3挂起
private Date solve_date;//解决日期
private Date fault_reason;//故障原因
private String fault_reason;//故障原因
private Integer solve_type;//解决措施:0产品BUG、1使用问题、2需求问题
private String solve_description;//解决故障描述
private Integer create_user;//创建者
private Integer current_user;//当前处理人
private Integer currentuser;//当前处理人
private Date create_time;//创建时间
private Date modify_time;//修改时间
private String remark;//备注
private Integer account_id;//集团id
private String filename;//文件名称
private String fileurl;//文件url
}
debug=false
################################## DATABASE ########################################
spring.datasource.url=jdbc:postgresql://192.168.9.6:5432/vioncount6.0heze20201109
spring.datasource.username=postgres
spring.datasource.password=vion
spring.datasource.url=jdbc:postgresql://pgm-2ze3cjpyjgjw0bl5uo.pg.rds.aliyuncs.com:1921/work-order
spring.datasource.username=vion
spring.datasource.password=jkou72j32m4K5d8k
spring.datasource.driver-class-name=org.postgresql.Driver
server.port=8088
server.port=8011
#fileurl=D:/pic
fileurl=/mnt/vdb1/vion/task/taskpic
agentid=2358374016
appkey=dingkrzwks0jpi2di3uo
appsecret=Ul5UTZqIost_kEAdfZXidvLoZhzvraYurm_g7PCHg-IrDMLHT7mdSgRS1iCHrDPt
dingurl=https://oapi.dingtalk.com
#
CorpId=ding6bb660048f7ae2dcee0f45d8e4f7c288
SSOsecret=l
\ No newline at end of file
......@@ -11,4 +11,9 @@ spring:
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
main:
allow-circular-references: true
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!