From 2a7c499b2476f5259e90cd57494ed41b6dc189a7 Mon Sep 17 00:00:00 2001
From: xiezhijun <15270898033@163.com>
Date: Thu, 4 Mar 2021 18:35:06 +0800
Subject: [PATCH] =?UTF-8?q?=E6=A1=88=E4=BE=8B=E7=AE=A1=E7=90=86=EF=BC=8C?=
=?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BF=AE=E6=94=B9=E6=9A=82=E5=81=9C=E4=BC=98?=
=?UTF-8?q?=E5=8C=96=EF=BC=8C=E5=88=A4=E6=96=AD=E6=97=B6=E9=97=B4=E4=B8=8D?=
=?UTF-8?q?=E8=83=BD=E9=87=8D=E5=8F=A0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 11 +-
.../web/controller/MyApplicationRunner.java | 27 ++
.../custom/SysCustomerCaseController.java | 103 ++++++
.../custom/SysOrderPauseController.java | 4 +-
.../stdiet/common/config/AliyunOSSConfig.java | 43 +++
.../common/utils/oss/AliyunOSSUtils.java | 293 ++++++++++++++++++
.../stdiet/custom/domain/SysCustomerCase.java | 35 +++
.../custom/domain/SysCustomerCaseFile.java | 35 +++
.../mapper/SysCustomerCaseFileMapper.java | 61 ++++
.../custom/mapper/SysCustomerCaseMapper.java | 61 ++++
.../custom/mapper/SysOrderPauseMapper.java | 2 +-
.../service/ISysCustomerCaseService.java | 61 ++++
.../custom/service/ISysOrderPauseService.java | 2 +-
.../impl/SysCustomerCaseServiceImpl.java | 96 ++++++
.../impl/SysOrderPauseServiceImpl.java | 4 +-
.../custom/SysCustomerCaseFileMapper.xml | 84 +++++
.../mapper/custom/SysCustomerCaseMapper.xml | 87 ++++++
.../mapper/custom/SysOrderPauseMapper.xml | 6 +-
18 files changed, 1005 insertions(+), 10 deletions(-)
create mode 100644 stdiet-admin/src/main/java/com/stdiet/web/controller/MyApplicationRunner.java
create mode 100644 stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerCaseController.java
create mode 100644 stdiet-common/src/main/java/com/stdiet/common/config/AliyunOSSConfig.java
create mode 100644 stdiet-common/src/main/java/com/stdiet/common/utils/oss/AliyunOSSUtils.java
create mode 100644 stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerCase.java
create mode 100644 stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerCaseFile.java
create mode 100644 stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerCaseFileMapper.java
create mode 100644 stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerCaseMapper.java
create mode 100644 stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerCaseService.java
create mode 100644 stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerCaseServiceImpl.java
create mode 100644 stdiet-custom/src/main/resources/mapper/custom/SysCustomerCaseFileMapper.xml
create mode 100644 stdiet-custom/src/main/resources/mapper/custom/SysCustomerCaseMapper.xml
diff --git a/pom.xml b/pom.xml
index fdd8087f3..b49f0bd5d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -30,6 +30,7 @@
3.17
1.7
0.9.1
+ 3.8.0
@@ -187,10 +188,18 @@
stdiet-common
${stdiet.version}
-
+
+
+
+ com.aliyun.oss
+ aliyun-sdk-oss
+ ${aliyun-oss.version}
+
+
+
stdiet-admin
stdiet-framework
diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/MyApplicationRunner.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/MyApplicationRunner.java
new file mode 100644
index 000000000..5357b59f4
--- /dev/null
+++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/MyApplicationRunner.java
@@ -0,0 +1,27 @@
+package com.stdiet.web.controller;
+
+import com.stdiet.common.config.AliyunOSSConfig;
+import com.stdiet.common.utils.oss.AliyunOSSUtils;
+import com.stdiet.custom.mapper.SysCustomerPhysicalSignsMapper;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.ApplicationArguments;
+import org.springframework.boot.ApplicationRunner;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
+
+import java.io.File;
+
+@Component
+@Order(value = 1)
+public class MyApplicationRunner implements ApplicationRunner {
+
+ @Autowired
+ private SysCustomerPhysicalSignsMapper sysCustomerPhysicalSignsMapper;
+
+ @Override
+ public void run(ApplicationArguments args) throws Exception {
+ System.out.println("项目启动调用方法");
+ String path = AliyunOSSUtils.uploadFileInputSteam(AliyunOSSConfig.casePrefix,"ceshi.png",new File("D:\\ceshi.png"));
+ System.out.println(path);
+ }
+}
diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerCaseController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerCaseController.java
new file mode 100644
index 000000000..66937d2d5
--- /dev/null
+++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerCaseController.java
@@ -0,0 +1,103 @@
+package com.stdiet.web.controller.custom;
+
+import java.util.List;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.stdiet.common.annotation.Log;
+import com.stdiet.common.core.controller.BaseController;
+import com.stdiet.common.core.domain.AjaxResult;
+import com.stdiet.common.enums.BusinessType;
+import com.stdiet.custom.domain.SysCustomerCase;
+import com.stdiet.custom.service.ISysCustomerCaseService;
+import com.stdiet.common.utils.poi.ExcelUtil;
+import com.stdiet.common.core.page.TableDataInfo;
+
+/**
+ * 客户案例管理Controller
+ *
+ * @author xiezhijun
+ * @date 2021-03-04
+ */
+@RestController
+@RequestMapping("/custom/customerCase")
+public class SysCustomerCaseController extends BaseController
+{
+ @Autowired
+ private ISysCustomerCaseService sysCustomerCaseService;
+
+ /**
+ * 查询客户案例管理列表
+ */
+ @PreAuthorize("@ss.hasPermi('custom:customerCase:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(SysCustomerCase sysCustomerCase)
+ {
+ startPage();
+ List list = sysCustomerCaseService.selectSysCustomerCaseList(sysCustomerCase);
+ return getDataTable(list);
+ }
+
+ /**
+ * 导出客户案例管理列表
+ */
+ @PreAuthorize("@ss.hasPermi('custom:customerCase:export')")
+ @Log(title = "客户案例管理", businessType = BusinessType.EXPORT)
+ @GetMapping("/export")
+ public AjaxResult export(SysCustomerCase sysCustomerCase)
+ {
+ List list = sysCustomerCaseService.selectSysCustomerCaseList(sysCustomerCase);
+ ExcelUtil util = new ExcelUtil(SysCustomerCase.class);
+ return util.exportExcel(list, "customerCase");
+ }
+
+ /**
+ * 获取客户案例管理详细信息
+ */
+ @PreAuthorize("@ss.hasPermi('custom:customerCase:query')")
+ @GetMapping(value = "/{id}")
+ public AjaxResult getInfo(@PathVariable("id") Long id)
+ {
+ return AjaxResult.success(sysCustomerCaseService.selectSysCustomerCaseById(id));
+ }
+
+ /**
+ * 新增客户案例管理
+ */
+ @PreAuthorize("@ss.hasPermi('custom:customerCase:add')")
+ @Log(title = "客户案例管理", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@RequestBody SysCustomerCase sysCustomerCase)
+ {
+ return toAjax(sysCustomerCaseService.insertSysCustomerCase(sysCustomerCase));
+ }
+
+ /**
+ * 修改客户案例管理
+ */
+ @PreAuthorize("@ss.hasPermi('custom:customerCase:edit')")
+ @Log(title = "客户案例管理", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@RequestBody SysCustomerCase sysCustomerCase)
+ {
+ return toAjax(sysCustomerCaseService.updateSysCustomerCase(sysCustomerCase));
+ }
+
+ /**
+ * 删除客户案例管理
+ */
+ @PreAuthorize("@ss.hasPermi('custom:customerCase:remove')")
+ @Log(title = "客户案例管理", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{ids}")
+ public AjaxResult remove(@PathVariable Long[] ids)
+ {
+ return toAjax(sysCustomerCaseService.deleteSysCustomerCaseByIds(ids));
+ }
+}
\ No newline at end of file
diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysOrderPauseController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysOrderPauseController.java
index e22c8b304..d8239d2f5 100644
--- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysOrderPauseController.java
+++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysOrderPauseController.java
@@ -76,7 +76,7 @@ public class SysOrderPauseController extends BaseController
@PostMapping
public AjaxResult add(@RequestBody SysOrderPause sysOrderPause)
{
- int count = sysOrderPauseService.getCountByOrderIdAndPauseDate(sysOrderPause);
+ int count = sysOrderPauseService.getCountByCusIdAndPauseDate(sysOrderPause);
if(count > 0){
return AjaxResult.error("时间范围重叠,请检查时间");
}
@@ -96,7 +96,7 @@ public class SysOrderPauseController extends BaseController
@PutMapping
public AjaxResult edit(@RequestBody SysOrderPause sysOrderPause)
{
- int count = sysOrderPauseService.getCountByOrderIdAndPauseDate(sysOrderPause);
+ int count = sysOrderPauseService.getCountByCusIdAndPauseDate(sysOrderPause);
if(count > 0){
return AjaxResult.error("时间范围重叠,请检查时间");
}
diff --git a/stdiet-common/src/main/java/com/stdiet/common/config/AliyunOSSConfig.java b/stdiet-common/src/main/java/com/stdiet/common/config/AliyunOSSConfig.java
new file mode 100644
index 000000000..3dbee23e6
--- /dev/null
+++ b/stdiet-common/src/main/java/com/stdiet/common/config/AliyunOSSConfig.java
@@ -0,0 +1,43 @@
+package com.stdiet.common.config;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AliyunOSSConfig {
+
+ public static String AccessKeyID;
+
+ public static String AccessKeySecret;
+
+ public static String Buckets;
+
+ public static String EndPoint;
+
+ public static String casePrefix;
+
+ @Value("${aliyun.oss.AccessKeyID}")
+ public void setAccessKeyID(String AccessKeyID){
+ AliyunOSSConfig.AccessKeyID = AccessKeyID;
+ }
+
+ @Value("${aliyun.oss.AccessKeySecret}")
+ public void setAccessKeySecret(String AccessKeySecret){
+ AliyunOSSConfig.AccessKeySecret = AccessKeySecret;
+ }
+
+ @Value("${aliyun.oss.Buckets}")
+ public void setBuckets(String Buckets){
+ AliyunOSSConfig.Buckets = Buckets;
+ }
+
+ @Value("${aliyun.oss.EndPoint}")
+ public void setEndPoint(String EndPoint){
+ AliyunOSSConfig.EndPoint = EndPoint;
+ }
+
+ @Value("${aliyun.oss.casePrefix}")
+ public void setCasePrefix(String casePrefix){
+ AliyunOSSConfig.casePrefix = casePrefix;
+ }
+}
diff --git a/stdiet-common/src/main/java/com/stdiet/common/utils/oss/AliyunOSSUtils.java b/stdiet-common/src/main/java/com/stdiet/common/utils/oss/AliyunOSSUtils.java
new file mode 100644
index 000000000..c78611763
--- /dev/null
+++ b/stdiet-common/src/main/java/com/stdiet/common/utils/oss/AliyunOSSUtils.java
@@ -0,0 +1,293 @@
+package com.stdiet.common.utils.oss;
+
+import com.aliyun.oss.model.GetObjectRequest;
+import com.aliyun.oss.model.OSSObject;
+import com.stdiet.common.config.AliyunOSSConfig;
+import org.springframework.web.multipart.MultipartFile;
+
+import com.aliyun.oss.OSS;
+import com.aliyun.oss.OSSClientBuilder;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.UUID;
+
+public class AliyunOSSUtils {
+
+ // 创建OSSClient实例
+ private static OSS ossClient = null;
+
+ public static OSS getOssClient() {
+ if (ossClient == null) {
+ synchronized (OSS.class) {
+ if (ossClient == null) {
+ ossClient = new OSSClientBuilder().build(AliyunOSSConfig.EndPoint, AliyunOSSConfig.AccessKeyID, AliyunOSSConfig.AccessKeySecret);
+ }
+ }
+ }
+ return ossClient;
+ }
+
+ /**
+ * 获取图片的URL头信息
+ *
+ * @return 返回url头信息
+ */
+ private static String getURLHead() {
+ //从哪个位置截取
+ int cutPoint = AliyunOSSConfig.EndPoint.lastIndexOf('/') + 1;
+ //http头
+ String head = AliyunOSSConfig.EndPoint.substring(0, cutPoint);
+ //服务器地址信息
+ String tail = AliyunOSSConfig.EndPoint.substring(cutPoint);
+ //返回结果
+ return head + AliyunOSSConfig.Buckets + "." + tail + "/";
+ }
+
+ /**
+ * 获取存储在服务器上的地址
+ *
+ * @param oranName 文件名
+ * @return 文件URL
+ */
+ private static String getRealName(String oranName) {
+ return getURLHead() + oranName;
+ }
+
+ /**
+ * 获取一个随机的文件名
+ *
+ * @param oranName 初始的文件名
+ * @return 返回加uuid后的文件名
+ */
+ private static String getRandomImageName(String prefix, String oranName) {
+ //获取一个uuid 去掉-
+ String uuid = UUID.randomUUID().toString().replace("-", "");
+ //查一下是否带路径
+ int cutPoint = oranName.lastIndexOf("/") + 1;
+ //如果存在路径
+ if (cutPoint != 0) {
+ //掐头 如果开头是/ 则去掉
+ String head = oranName.indexOf("/") == 0 ? oranName.substring(1, cutPoint) : oranName.substring(0, cutPoint);
+ //去尾
+ String tail = oranName.substring(cutPoint);
+ //返回正确的带路径的图片名称
+ return prefix + head + uuid + tail;
+ }
+ //不存在 直接返回
+ return prefix + uuid + oranName;
+ }
+
+ /**
+ * MultipartFile2File
+ * @param multipartFile
+ * @return
+ */
+ private static File transferToFile(MultipartFile multipartFile) {
+ //选择用缓冲区来实现这个转换即使用java 创建的临时文件 使用 MultipartFile.transferto()方法 。
+ File file = null;
+ try {
+ //获取文件名
+ String originalFilename = multipartFile.getOriginalFilename();
+ //获取最后一个"."的位置
+ int cutPoint = originalFilename.lastIndexOf(".");
+ //获取文件名
+ String prefix = originalFilename.substring(0,cutPoint);
+ //获取后缀名
+ String suffix = originalFilename.substring(cutPoint + 1);
+ //创建临时文件
+ file = File.createTempFile(prefix, suffix);
+ //multipartFile2file
+ multipartFile.transferTo(file);
+ //删除临时文件
+ file.deleteOnExit();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ return file;
+ }
+
+ /**
+ * 通过文件URL反向解析文件名
+ *
+ * @param fileURL 文件URL
+ * @return 原文件名
+ */
+ private static String getObjectName(String fileURL) {
+ return fileURL.substring(getURLHead().length());
+ }
+
+ /**
+ * 上传文件流
+ * @param prefix 路径的前缀路径目录
+ * @param oranFileName 上传到服务器上的文件路径和名称
+ * @param file 来自本地的文件或者文件流
+ */
+ public static String uploadFileInputSteam(String prefix, String oranFileName, MultipartFile file) {
+
+ // 上传文件到OSS时需要指定包含文件后缀在内的完整路径,例如abc/efg/123.jpg
+ String objectName = getRandomImageName(prefix, oranFileName);
+
+ // 创建OSSClient实例。
+ OSS ossClient = getOssClient();
+
+ // 上传文件流
+ try (InputStream inputStream = new FileInputStream(transferToFile(file))) {
+ //上传到OSS
+ ossClient.putObject(AliyunOSSConfig.Buckets, objectName, inputStream);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ // 关闭OSSClient。
+ ossClient.shutdown();
+
+ //返回文件在服务器上的全路径+名称
+ return getRealName(objectName);
+ }
+
+
+ /**
+ * 上传文件流
+ * @param prefix 路径的前缀路径目录
+ * @param oranFileName 上传到服务器上的文件路径和名称
+ * @param file 来自本地的文件或者文件流
+ */
+ public static String uploadFileInputSteam(String prefix, String oranFileName, File file) {
+
+ // 上传文件到OSS时需要指定包含文件后缀在内的完整路径,例如abc/efg/123.jpg
+ String objectName = getRandomImageName(prefix, oranFileName);
+
+ // 创建OSSClient实例。
+ OSS ossClient = getOssClient();
+
+ // 上传文件流。
+ try (InputStream inputStream = new FileInputStream(file);) {
+ //上传到OSS
+ ossClient.putObject(AliyunOSSConfig.Buckets, objectName, inputStream);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ // 关闭OSSClient。
+ ossClient.shutdown();
+
+ //返回文件在服务器上的全路径+名称
+ return getRealName(objectName);
+ }
+
+ /**
+ * 从OSS中下载一个文件
+ *
+ * @param fileURL 文件的url
+ * @param localFileName 下载到本地的文件名称
+ */
+ public static void downloadFileToLoacal(String fileURL, String localFileName) {
+
+ //将url解析成objectName
+ String objectName = getObjectName(fileURL);
+
+ // 创建OSSClient实例。
+ OSS ossClient = getOssClient();
+
+ // 下载OSS文件到本地文件。如果指定的本地文件存在会覆盖,不存在则新建。
+ ossClient.getObject(new GetObjectRequest(AliyunOSSConfig.Buckets, objectName), new File(localFileName));
+
+ // 关闭OSSClient。
+ ossClient.shutdown();
+
+ }
+
+ /**
+ * 从OSS中下载一个文件流
+ *
+ * @param fileURL 文件的url
+ */
+ public InputStream downloadFile(String fileURL) throws IOException {
+
+ //将url解析成objectName
+ String objectName = getObjectName(fileURL);
+
+ // 创建OSSClient实例。
+ OSS ossClient = getOssClient();
+
+ OSSObject ossObject = ossClient.getObject(AliyunOSSConfig.Buckets, objectName);
+
+ //获取流
+ InputStream streamData = ossObject.getObjectContent();
+
+ // 关闭OSSClient。
+ ossClient.shutdown();
+
+ return streamData;
+ }
+
+ /**
+ * 删除指定路径下的一个文件
+ *
+ * @param fileURL 文件的全称
+ */
+ public static void deleteFile(String fileURL) {
+
+ // 反向解析文件名
+ String objectName = getObjectName(fileURL);
+
+ // 创建OSSClient实例。
+ OSS ossClient = getOssClient();
+
+ // 删除文件。如需删除文件夹,请将ObjectName设置为对应的文件夹名称。如果文件夹非空,则需要将文件夹下的所有object删除后才能删除该文件夹。
+ ossClient.deleteObject(AliyunOSSConfig.Buckets, objectName);
+
+ //删除成功 打印文件存储地址
+ printDeleteSuccessInfo(fileURL);
+
+ // 关闭OSSClient。
+ ossClient.shutdown();
+ }
+
+ /**
+ * 打印文件的存储地址
+ *
+ * @param fileURL 文件URL
+ */
+ private static void printUploadSuccessInfo(String fileURL) {
+ //上传成功
+ System.out.println("upload success, path = " + getRealName(fileURL));
+ }
+
+ /**
+ * 打印文件的存储地址
+ *
+ * @param fileURL 文件URL
+ */
+ private static void printDeleteSuccessInfo(String fileURL) {
+ //上传成功
+ System.out.println("delete success, path = " + getRealName(fileURL));
+ }
+
+ /**
+ * 通过文件的URL 判断文件是否存在
+ *
+ * @param fileURL 文件的URL
+ * @return 文件是否存在
+ */
+ public static boolean exists(String fileURL) {
+
+ // 反向解析文件名
+ String objectName = getObjectName(fileURL);
+
+ // 创建OSSClient实例。
+ OSS ossClient = getOssClient();
+
+ // 判断文件是否存在。doesObjectExist还有一个参数isOnlyInOSS,如果为true则忽略302重定向或镜像;如果为false,则考虑302重定向或镜像。
+ boolean found = ossClient.doesObjectExist(AliyunOSSConfig.Buckets, objectName);
+
+ // 关闭OSSClient。
+ ossClient.shutdown();
+
+ // 返回是否存在
+ return found;
+ }
+
+}
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerCase.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerCase.java
new file mode 100644
index 000000000..a56bc8567
--- /dev/null
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerCase.java
@@ -0,0 +1,35 @@
+package com.stdiet.custom.domain;
+
+import com.stdiet.common.annotation.Excel;
+import com.stdiet.common.core.domain.BaseEntity;
+import lombok.Data;
+
+/**
+ * 客户案例管理对象 sys_customer_case
+ *
+ * @author xiezhijun
+ * @date 2021-03-04
+ */
+@Data
+public class SysCustomerCase extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** $column.columnComment */
+ private Long id;
+
+ /** 案例名称 */
+ @Excel(name = "案例名称")
+ private String name;
+
+ /** 案例关键词 */
+ @Excel(name = "案例关键词")
+ private String keyword;
+
+ /** 案例所属客户ID */
+ @Excel(name = "案例所属客户ID")
+ private Long customerId;
+
+ /** 删除标识 0未删除 1已删除,默认0 */
+ private Long delFlag;
+}
\ No newline at end of file
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerCaseFile.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerCaseFile.java
new file mode 100644
index 000000000..d8d1e62b8
--- /dev/null
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysCustomerCaseFile.java
@@ -0,0 +1,35 @@
+package com.stdiet.custom.domain;
+
+import com.stdiet.common.annotation.Excel;
+import com.stdiet.common.core.domain.BaseEntity;
+import lombok.Data;
+
+/**
+ * 客户案例对应文件管理对象 sys_customer_case_file
+ *
+ * @author xiezhijun
+ * @date 2021-03-04
+ */
+@Data
+public class SysCustomerCaseFile extends BaseEntity
+{
+ private static final long serialVersionUID = 1L;
+
+ /** $column.columnComment */
+ private Long id;
+
+ /** 案例文件 */
+ @Excel(name = "案例文件")
+ private Long caseId;
+
+ /** 文件路径 */
+ @Excel(name = "文件路径")
+ private String fileUrl;
+
+ /** 文件名字 */
+ @Excel(name = "文件名字")
+ private String fileName;
+
+ /** 删除标识 0未删除 1已删除 */
+ private Long delFlag;
+}
\ No newline at end of file
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerCaseFileMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerCaseFileMapper.java
new file mode 100644
index 000000000..8d3294f6e
--- /dev/null
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerCaseFileMapper.java
@@ -0,0 +1,61 @@
+package com.stdiet.custom.mapper;
+
+import java.util.List;
+import com.stdiet.custom.domain.SysCustomerCaseFile;
+
+/**
+ * 客户案例对应文件管理Mapper接口
+ *
+ * @author xiezhijun
+ * @date 2021-03-04
+ */
+public interface SysCustomerCaseFileMapper
+{
+ /**
+ * 查询客户案例对应文件管理
+ *
+ * @param id 客户案例对应文件管理ID
+ * @return 客户案例对应文件管理
+ */
+ public SysCustomerCaseFile selectSysCustomerCaseFileById(Long id);
+
+ /**
+ * 查询客户案例对应文件管理列表
+ *
+ * @param sysCustomerCaseFile 客户案例对应文件管理
+ * @return 客户案例对应文件管理集合
+ */
+ public List selectSysCustomerCaseFileList(SysCustomerCaseFile sysCustomerCaseFile);
+
+ /**
+ * 新增客户案例对应文件管理
+ *
+ * @param sysCustomerCaseFile 客户案例对应文件管理
+ * @return 结果
+ */
+ public int insertSysCustomerCaseFile(SysCustomerCaseFile sysCustomerCaseFile);
+
+ /**
+ * 修改客户案例对应文件管理
+ *
+ * @param sysCustomerCaseFile 客户案例对应文件管理
+ * @return 结果
+ */
+ public int updateSysCustomerCaseFile(SysCustomerCaseFile sysCustomerCaseFile);
+
+ /**
+ * 删除客户案例对应文件管理
+ *
+ * @param id 客户案例对应文件管理ID
+ * @return 结果
+ */
+ public int deleteSysCustomerCaseFileById(Long id);
+
+ /**
+ * 批量删除客户案例对应文件管理
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ public int deleteSysCustomerCaseFileByIds(Long[] ids);
+}
\ No newline at end of file
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerCaseMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerCaseMapper.java
new file mode 100644
index 000000000..0cc4a0b97
--- /dev/null
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysCustomerCaseMapper.java
@@ -0,0 +1,61 @@
+package com.stdiet.custom.mapper;
+
+import java.util.List;
+import com.stdiet.custom.domain.SysCustomerCase;
+
+/**
+ * 客户案例管理Mapper接口
+ *
+ * @author xiezhijun
+ * @date 2021-03-04
+ */
+public interface SysCustomerCaseMapper
+{
+ /**
+ * 查询客户案例管理
+ *
+ * @param id 客户案例管理ID
+ * @return 客户案例管理
+ */
+ public SysCustomerCase selectSysCustomerCaseById(Long id);
+
+ /**
+ * 查询客户案例管理列表
+ *
+ * @param sysCustomerCase 客户案例管理
+ * @return 客户案例管理集合
+ */
+ public List selectSysCustomerCaseList(SysCustomerCase sysCustomerCase);
+
+ /**
+ * 新增客户案例管理
+ *
+ * @param sysCustomerCase 客户案例管理
+ * @return 结果
+ */
+ public int insertSysCustomerCase(SysCustomerCase sysCustomerCase);
+
+ /**
+ * 修改客户案例管理
+ *
+ * @param sysCustomerCase 客户案例管理
+ * @return 结果
+ */
+ public int updateSysCustomerCase(SysCustomerCase sysCustomerCase);
+
+ /**
+ * 删除客户案例管理
+ *
+ * @param id 客户案例管理ID
+ * @return 结果
+ */
+ public int deleteSysCustomerCaseById(Long id);
+
+ /**
+ * 批量删除客户案例管理
+ *
+ * @param ids 需要删除的数据ID
+ * @return 结果
+ */
+ public int deleteSysCustomerCaseByIds(Long[] ids);
+}
\ No newline at end of file
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysOrderPauseMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysOrderPauseMapper.java
index 8d94a6a27..b9f0d18a3 100644
--- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysOrderPauseMapper.java
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysOrderPauseMapper.java
@@ -65,7 +65,7 @@ public interface SysOrderPauseMapper
* @param sysOrderPause
* @return
*/
- int getCountByOrderIdAndPauseDate(SysOrderPause sysOrderPause);
+ int getCountByCusIdAndPauseDate(SysOrderPause sysOrderPause);
/**
* 根据订单ID删除暂停记录
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerCaseService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerCaseService.java
new file mode 100644
index 000000000..4e0661ba3
--- /dev/null
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysCustomerCaseService.java
@@ -0,0 +1,61 @@
+package com.stdiet.custom.service;
+
+import java.util.List;
+import com.stdiet.custom.domain.SysCustomerCase;
+
+/**
+ * 客户案例管理Service接口
+ *
+ * @author xiezhijun
+ * @date 2021-03-04
+ */
+public interface ISysCustomerCaseService {
+ /**
+ * 查询客户案例管理
+ *
+ * @param id 客户案例管理ID
+ * @return 客户案例管理
+ */
+ public SysCustomerCase selectSysCustomerCaseById(Long id);
+
+ /**
+ * 查询客户案例管理列表
+ *
+ * @param sysCustomerCase 客户案例管理
+ * @return 客户案例管理集合
+ */
+ public List selectSysCustomerCaseList(SysCustomerCase sysCustomerCase);
+
+ /**
+ * 新增客户案例管理
+ *
+ * @param sysCustomerCase 客户案例管理
+ * @return 结果
+ */
+ public int insertSysCustomerCase(SysCustomerCase sysCustomerCase);
+
+ /**
+ * 修改客户案例管理
+ *
+ * @param sysCustomerCase 客户案例管理
+ * @return 结果
+ */
+ public int updateSysCustomerCase(SysCustomerCase sysCustomerCase);
+
+ /**
+ * 批量删除客户案例管理
+ *
+ * @param ids 需要删除的客户案例管理ID
+ * @return 结果
+ */
+ public int deleteSysCustomerCaseByIds(Long[] ids);
+
+ /**
+ * 删除客户案例管理信息
+ *
+ * @param id 客户案例管理ID
+ * @return 结果
+ */
+ public int deleteSysCustomerCaseById(Long id);
+
+}
\ No newline at end of file
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysOrderPauseService.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysOrderPauseService.java
index 8ad61a600..0044578db 100644
--- a/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysOrderPauseService.java
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/ISysOrderPauseService.java
@@ -64,7 +64,7 @@ public interface ISysOrderPauseService
* @param sysOrderPause
* @return
*/
- int getCountByOrderIdAndPauseDate(SysOrderPause sysOrderPause);
+ int getCountByCusIdAndPauseDate(SysOrderPause sysOrderPause);
/**
* 根据订单ID删除暂停记录
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerCaseServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerCaseServiceImpl.java
new file mode 100644
index 000000000..03dc6e488
--- /dev/null
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysCustomerCaseServiceImpl.java
@@ -0,0 +1,96 @@
+package com.stdiet.custom.service.impl;
+
+import java.util.List;
+import com.stdiet.common.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.stdiet.custom.mapper.SysCustomerCaseMapper;
+import com.stdiet.custom.domain.SysCustomerCase;
+import com.stdiet.custom.service.ISysCustomerCaseService;
+
+/**
+ * 客户案例管理Service业务层处理
+ *
+ * @author xiezhijun
+ * @date 2021-03-04
+ */
+@Service
+public class SysCustomerCaseServiceImpl implements ISysCustomerCaseService
+{
+ @Autowired
+ private SysCustomerCaseMapper sysCustomerCaseMapper;
+
+ /**
+ * 查询客户案例管理
+ *
+ * @param id 客户案例管理ID
+ * @return 客户案例管理
+ */
+ @Override
+ public SysCustomerCase selectSysCustomerCaseById(Long id)
+ {
+ return sysCustomerCaseMapper.selectSysCustomerCaseById(id);
+ }
+
+ /**
+ * 查询客户案例管理列表
+ *
+ * @param sysCustomerCase 客户案例管理
+ * @return 客户案例管理
+ */
+ @Override
+ public List selectSysCustomerCaseList(SysCustomerCase sysCustomerCase)
+ {
+ return sysCustomerCaseMapper.selectSysCustomerCaseList(sysCustomerCase);
+ }
+
+ /**
+ * 新增客户案例管理
+ *
+ * @param sysCustomerCase 客户案例管理
+ * @return 结果
+ */
+ @Override
+ public int insertSysCustomerCase(SysCustomerCase sysCustomerCase)
+ {
+ sysCustomerCase.setCreateTime(DateUtils.getNowDate());
+ return sysCustomerCaseMapper.insertSysCustomerCase(sysCustomerCase);
+ }
+
+ /**
+ * 修改客户案例管理
+ *
+ * @param sysCustomerCase 客户案例管理
+ * @return 结果
+ */
+ @Override
+ public int updateSysCustomerCase(SysCustomerCase sysCustomerCase)
+ {
+ sysCustomerCase.setUpdateTime(DateUtils.getNowDate());
+ return sysCustomerCaseMapper.updateSysCustomerCase(sysCustomerCase);
+ }
+
+ /**
+ * 批量删除客户案例管理
+ *
+ * @param ids 需要删除的客户案例管理ID
+ * @return 结果
+ */
+ @Override
+ public int deleteSysCustomerCaseByIds(Long[] ids)
+ {
+ return sysCustomerCaseMapper.deleteSysCustomerCaseByIds(ids);
+ }
+
+ /**
+ * 删除客户案例管理信息
+ *
+ * @param id 客户案例管理ID
+ * @return 结果
+ */
+ @Override
+ public int deleteSysCustomerCaseById(Long id)
+ {
+ return sysCustomerCaseMapper.deleteSysCustomerCaseById(id);
+ }
+}
\ No newline at end of file
diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysOrderPauseServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysOrderPauseServiceImpl.java
index 3f957b8fb..48da0567d 100644
--- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysOrderPauseServiceImpl.java
+++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysOrderPauseServiceImpl.java
@@ -126,8 +126,8 @@ public class SysOrderPauseServiceImpl implements ISysOrderPauseService
* @return
*/
@Override
- public int getCountByOrderIdAndPauseDate(SysOrderPause sysOrderPause){
- return sysOrderPauseMapper.getCountByOrderIdAndPauseDate(sysOrderPause);
+ public int getCountByCusIdAndPauseDate(SysOrderPause sysOrderPause){
+ return sysOrderPauseMapper.getCountByCusIdAndPauseDate(sysOrderPause);
}
/**
diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerCaseFileMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerCaseFileMapper.xml
new file mode 100644
index 000000000..088b64a93
--- /dev/null
+++ b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerCaseFileMapper.xml
@@ -0,0 +1,84 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select id, case_id, file_url, file_name, create_time, create_by, update_time, update_by, del_flag from sys_customer_case_file
+
+
+
+
+
+
+
+ insert into sys_customer_case_file
+
+ case_id,
+ file_url,
+ file_name,
+ create_time,
+ create_by,
+ update_time,
+ update_by,
+ del_flag,
+
+
+ #{caseId},
+ #{fileUrl},
+ #{fileName},
+ #{createTime},
+ #{createBy},
+ #{updateTime},
+ #{updateBy},
+ #{delFlag},
+
+
+
+
+ update sys_customer_case_file
+
+ case_id = #{caseId},
+ file_url = #{fileUrl},
+ file_name = #{fileName},
+ create_time = #{createTime},
+ create_by = #{createBy},
+ update_time = #{updateTime},
+ update_by = #{updateBy},
+ del_flag = #{delFlag},
+
+ where id = #{id}
+
+
+
+ delete from sys_customer_case_file where id = #{id}
+
+
+
+ delete from sys_customer_case_file where id in
+
+ #{id}
+
+
+
+
\ No newline at end of file
diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerCaseMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerCaseMapper.xml
new file mode 100644
index 000000000..f23030552
--- /dev/null
+++ b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerCaseMapper.xml
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ select id, name, keyword, remark, customer_id, create_time, create_by, update_time, update_by, del_flag from sys_customer_case
+
+
+
+
+
+
+
+ insert into sys_customer_case
+
+ name,
+ keyword,
+ remark,
+ customer_id,
+ create_time,
+ create_by,
+ update_time,
+ update_by,
+ del_flag,
+
+
+ #{name},
+ #{keyword},
+ #{remark},
+ #{customerId},
+ #{createTime},
+ #{createBy},
+ #{updateTime},
+ #{updateBy},
+ #{delFlag},
+
+
+
+
+ update sys_customer_case
+
+ name = #{name},
+ keyword = #{keyword},
+ remark = #{remark},
+ customer_id = #{customerId},
+ create_time = #{createTime},
+ create_by = #{createBy},
+ update_time = #{updateTime},
+ update_by = #{updateBy},
+ del_flag = #{delFlag},
+
+ where id = #{id}
+
+
+
+ update sys_customer_case set del_flag = 1 where id = #{id}
+
+
+
+ update sys_customer_case set del_flag = 1 where id in
+
+ #{id}
+
+
+
+
\ No newline at end of file
diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysOrderPauseMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysOrderPauseMapper.xml
index d3c6b0968..3493d133a 100644
--- a/stdiet-custom/src/main/resources/mapper/custom/SysOrderPauseMapper.xml
+++ b/stdiet-custom/src/main/resources/mapper/custom/SysOrderPauseMapper.xml
@@ -106,9 +106,9 @@
-
-