From d3aca91b40d1c580c5790175f79e8087a8b0bba8 Mon Sep 17 00:00:00 2001 From: DB <2502523450@qq.com> Date: Mon, 11 Dec 2023 15:02:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=93=81=E7=89=8C=E6=A0=A1=E5=8C=BA=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=91=98=E7=AE=A1=E7=90=86;=E6=B7=BB=E5=8A=A0?= =?UTF-8?q?=E5=B7=A5=E5=8D=95=E5=B7=A5=E5=85=B7;=E9=9B=86=E6=88=90?= =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=B0=8F=E7=A8=8B=E5=BA=8F;=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E6=95=B0=E6=8D=AE=E5=AF=BC=E5=85=A5;=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E5=AD=97=E5=85=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Cpop-Common/pom.xml | 5 + .../com/cpop/common/constant/Constants.java | 5 + .../com/cpop/common/utils/http/HttpUtils.java | 29 +++ Cpop-Core/pom.xml | 5 - .../core/base/entity/MultipartFileDto.java | 115 +++++++++ .../cpop/core/config/RestTemplateConfig.java | 32 +++ .../cpop/core/handler/TencentCosHandler.java | 13 +- .../com/cpop/core/utils/file/FileUtils.java | 44 ++-- .../com/cpop/generator/CpopGenerator.java | 12 +- .../business/task/CardTemplateAsyncTask.java | 106 ++++---- .../framework/constant/JamboxCloudUrl.java | 5 + Cpop-Mall/pom.xml | 1 + .../backstage/BackstageOrderController.java | 2 - .../backstage/BackstageProductController.java | 3 +- .../callback/WxPayCallbackController.java | 2 - .../service/impl/OrderServiceImpl.java | 9 +- .../service/impl/ProductServiceImpl.java | 2 +- .../task/OrderDetailAsyncTask.java | 17 +- .../task/OrderOverTimeUnPayTask.java | 2 +- .../task/ProductRecordSyncStockTask.java | 2 +- .../task/ShoppingCartAsyncTask.java | 2 +- .../task/WxPayAsyncTask.java | 6 +- .../src/main/resources/application-dev.yml | 4 +- .../src/main/resources/application.yml | 15 +- .../com/cpop/oam/web/CpopImportTests.java | 183 +++++++++++++- .../java/com/cpop/oam/web/CpopQrtzTest.java | 66 +++++ Cpop-Oam/pom.xml | 18 +- .../cpop/oam/business/bo/BrandManagerBo.java | 54 ++++ .../oam/business/bo/BrandManagerPageBo.java | 33 +++ .../cpop/oam/business/bo/DataImportBo.java | 57 +++++ .../oam/business/bo/DataImportPageBo.java | 34 +++ .../oam/business/bo/OperationStatusBo.java | 34 +++ .../oam/business/bo/TaskDemandUrgentBo.java | 26 ++ .../oam/business/bo/TechnologyToolBo.java | 56 +++++ .../backstage/BrandManagerController.java | 113 +++++++++ .../backstage/DataImportController.java | 173 +++++++++++++ .../controller/backstage/DutyController.java | 4 +- .../backstage/FinanceReimburseController.java | 11 +- .../backstage/OamMallController.java | 6 +- .../controller/backstage/StaffController.java | 14 ++ .../backstage/SysConfigController.java | 1 - .../backstage/TaskDemandController.java | 21 +- .../backstage/TaskTechnologyController.java | 42 ++-- .../backstage/TaskWorkOrderController.java | 10 - .../backstage/TechnologyToolController.java | 102 ++++++++ .../controller/backstage/WxPayController.java | 1 - .../cpop/oam/business/dto/DataImportDto.java | 116 +++++++++ .../oam/business/dto/DataImportParamsDto.java | 30 +++ .../oam/business/entity/BrandManager.java | 58 +++++ .../business/entity/BrandManagerStore.java | 52 ++++ .../cpop/oam/business/entity/DataImport.java | 73 ++++++ .../com/cpop/oam/business/entity/Staff.java | 5 + .../com/cpop/oam/business/entity/Task.java | 2 +- .../cpop/oam/business/entity/TaskDemand.java | 2 +- .../oam/business/entity/TechnologyTool.java | 67 +++++ .../business/mapper/BrandManagerMapper.java | 14 ++ .../mapper/BrandManagerStoreMapper.java | 14 ++ .../oam/business/mapper/DataImportMapper.java | 14 ++ .../business/mapper/TechnologyToolMapper.java | 14 ++ .../business/service/BrandManagerService.java | 43 ++++ .../service/BrandManagerStoreService.java | 14 ++ .../business/service/DataImportService.java | 61 +++++ .../oam/business/service/StaffService.java | 12 +- .../business/service/TaskDemandService.java | 10 + .../service/TechnologyToolService.java | 14 ++ .../impl/BrandManageStoreServiceImpl.java | 18 ++ .../service/impl/BrandManagerServiceImpl.java | 154 ++++++++++++ .../service/impl/DataImportServiceImpl.java | 238 ++++++++++++++++++ .../service/impl/StaffServiceImpl.java | 34 ++- .../service/impl/TaskDemandServiceImpl.java | 50 +++- .../impl/TaskWorkOrderServiceImpl.java | 36 ++- .../impl/TechnologyToolServiceImpl.java | 18 ++ .../oam/business/vo/BrandManagePageVo.java | 57 +++++ .../oam/business/vo/DataImportPageVo.java | 63 +++++ .../com/cpop/oam/business/vo/StaffPageVo.java | 6 + .../oam/business/vo/TaskDemandUrgentVo.java | 55 ++++ .../oam/business/vo/TechnologyToolPageVo.java | 64 +++++ .../config/wxMa/WxMaConfiguration.java | 132 ++++++++++ .../framework/config/wxMa/WxMaProperties.java | 46 ++++ .../framework/handler/wxPay/WxPayHandler.java | 72 ++++++ .../framework/tasks/DataImportAsyncTask.java | 21 ++ .../framework/tasks/OamScheduledTasks.java | 28 ++- .../tasks/WorkOrderAcceptOverTimeTask.java | 26 +- .../tasks/WorkOrderOvertimeTask.java | 14 +- .../resources/mapper/BrandManagerMapper.xml | 7 + .../mapper/BrandManagerStoreMapper.xml | 7 + .../resources/mapper/DataImportMapper.xml | 7 + .../resources/mapper/TechnologyToolMapper.xml | 7 + .../business/bo/StoreListByBrandBo.java | 25 ++ .../business/controller/BrandController.java | 4 - .../controller/DictTypeController.java | 1 + .../cpop/system/business/entity/Store.java | 30 +++ .../service/impl/StoreServiceImpl.java | 7 +- .../cpop/system}/business/vo/BrandListVo.java | 2 +- .../business/vo/StoreListByBrandVo.java | 35 +++ .../cpop/system/business/vo/StorePageVo.java | 40 ++- pom.xml | 4 + 97 files changed, 3157 insertions(+), 263 deletions(-) create mode 100644 Cpop-Core/src/main/java/com/cpop/core/base/entity/MultipartFileDto.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/config/RestTemplateConfig.java rename Cpop-Mall/src/main/java/com/cpop/mall/{business => framework}/task/OrderDetailAsyncTask.java (83%) rename Cpop-Mall/src/main/java/com/cpop/mall/{business => framework}/task/OrderOverTimeUnPayTask.java (98%) rename Cpop-Mall/src/main/java/com/cpop/mall/{business => framework}/task/ProductRecordSyncStockTask.java (98%) rename Cpop-Mall/src/main/java/com/cpop/mall/{business => framework}/task/ShoppingCartAsyncTask.java (98%) rename Cpop-Mall/src/main/java/com/cpop/mall/{business => framework}/task/WxPayAsyncTask.java (94%) create mode 100644 Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopQrtzTest.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/bo/BrandManagerBo.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/bo/BrandManagerPageBo.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/bo/DataImportBo.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/bo/DataImportPageBo.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/bo/OperationStatusBo.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskDemandUrgentBo.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TechnologyToolBo.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BrandManagerController.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/DataImportController.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/TechnologyToolController.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/dto/DataImportDto.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/dto/DataImportParamsDto.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/entity/BrandManager.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/entity/BrandManagerStore.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/entity/DataImport.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/entity/TechnologyTool.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/BrandManagerMapper.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/BrandManagerStoreMapper.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/DataImportMapper.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/TechnologyToolMapper.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/service/BrandManagerService.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/service/BrandManagerStoreService.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/service/DataImportService.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/service/TechnologyToolService.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BrandManageStoreServiceImpl.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BrandManagerServiceImpl.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/DataImportServiceImpl.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TechnologyToolServiceImpl.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/vo/BrandManagePageVo.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/vo/DataImportPageVo.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/vo/TaskDemandUrgentVo.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/business/vo/TechnologyToolPageVo.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/framework/config/wxMa/WxMaConfiguration.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/framework/config/wxMa/WxMaProperties.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/framework/handler/wxPay/WxPayHandler.java create mode 100644 Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/DataImportAsyncTask.java create mode 100644 Cpop-Oam/src/main/resources/mapper/BrandManagerMapper.xml create mode 100644 Cpop-Oam/src/main/resources/mapper/BrandManagerStoreMapper.xml create mode 100644 Cpop-Oam/src/main/resources/mapper/DataImportMapper.xml create mode 100644 Cpop-Oam/src/main/resources/mapper/TechnologyToolMapper.xml create mode 100644 Cpop-System/src/main/java/com/cpop/system/business/bo/StoreListByBrandBo.java rename {Cpop-Oam/src/main/java/com/cpop/oam => Cpop-System/src/main/java/com/cpop/system}/business/vo/BrandListVo.java (93%) create mode 100644 Cpop-System/src/main/java/com/cpop/system/business/vo/StoreListByBrandVo.java diff --git a/Cpop-Common/pom.xml b/Cpop-Common/pom.xml index b64d6b4..41929bc 100644 --- a/Cpop-Common/pom.xml +++ b/Cpop-Common/pom.xml @@ -34,6 +34,11 @@ com.alibaba fastjson + + + com.squareup.okhttp3 + okhttp + diff --git a/Cpop-Common/src/main/java/com/cpop/common/constant/Constants.java b/Cpop-Common/src/main/java/com/cpop/common/constant/Constants.java index 0d7b4b7..9aaa87f 100644 --- a/Cpop-Common/src/main/java/com/cpop/common/constant/Constants.java +++ b/Cpop-Common/src/main/java/com/cpop/common/constant/Constants.java @@ -204,4 +204,9 @@ public interface Constants { */ String USERNAME = "UserName"; + /** + * 二维码Base64头 + */ + String QRCODE_HEADER = "data:image/png;base64,"; + } diff --git a/Cpop-Common/src/main/java/com/cpop/common/utils/http/HttpUtils.java b/Cpop-Common/src/main/java/com/cpop/common/utils/http/HttpUtils.java index 94f3ec1..bd59465 100644 --- a/Cpop-Common/src/main/java/com/cpop/common/utils/http/HttpUtils.java +++ b/Cpop-Common/src/main/java/com/cpop/common/utils/http/HttpUtils.java @@ -2,6 +2,7 @@ package com.cpop.common.utils.http; import com.cpop.common.constant.Constants; import com.cpop.common.utils.StringUtils; +import okhttp3.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -344,4 +345,32 @@ public class HttpUtils { } } + /** + * okhttpPost请求 + * @param url 地址 + * @param jsonBody 请求体 + */ + public static Response sendOkHttpPost(String url,String jsonBody) throws IOException { + OkHttpClient client = new OkHttpClient().newBuilder().build(); + MediaType mediaType = MediaType.Companion.parse("application/json;charset=utf-8"); + RequestBody body = RequestBody.Companion.create(jsonBody, mediaType); + Request request = new Request + .Builder() + .url(url) + .post(body) + .addHeader("Content-Type", "application/json") + .build(); + return client.newCall(request).execute(); + } + + /** + * okhttpGet请求 + * @param url 地址 + */ + public static Response sendOkHttpGet(String url) throws IOException { + OkHttpClient client = new OkHttpClient().newBuilder().build(); + Request request = new Request.Builder().url(url).get().build(); + return client.newCall(request).execute(); + } + } diff --git a/Cpop-Core/pom.xml b/Cpop-Core/pom.xml index cb76ea5..3c66fa2 100644 --- a/Cpop-Core/pom.xml +++ b/Cpop-Core/pom.xml @@ -107,11 +107,6 @@ org.bouncycastle bcprov-jdk15on - - - com.squareup.okhttp3 - okhttp - diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/entity/MultipartFileDto.java b/Cpop-Core/src/main/java/com/cpop/core/base/entity/MultipartFileDto.java new file mode 100644 index 0000000..63747e9 --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/base/entity/MultipartFileDto.java @@ -0,0 +1,115 @@ +package com.cpop.core.base.entity; + +import org.springframework.util.FileCopyUtils; +import org.springframework.web.multipart.MultipartFile; + +import java.io.ByteArrayInputStream; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; + + +/** + * @author DB + * @since 2023-12-10 9:35 + * @version 1.0.0 + * + * 负责将InputStream转换MultipartFile,可以少引一个jar包,本来用的是spring-test-4.3.9中的MockMultipartFile,直接提取出来使用 + */ +public class MultipartFileDto implements MultipartFile { + private final String name; + + private String originalFilename; + + private String contentType; + + private final byte[] content; + + /** + * Create a new MultipartFileDto with the given content. + * @param name the name of the file + * @param content the content of the file + */ + public MultipartFileDto(String name, byte[] content) { + this(name, "", null, content); + } + + /** + * Create a new MultipartFileDto with the given content. + * @param name the name of the file + * @param contentStream the content of the file as stream + * @throws IOException if reading from the stream failed + */ + public MultipartFileDto(String name, InputStream contentStream) throws IOException { + this(name, "", null, FileCopyUtils.copyToByteArray(contentStream)); + } + + /** + * Create a new MultipartFileDto with the given content. + * @param name the name of the file + * @param originalFilename the original filename (as on the client's machine) + * @param contentType the content type (if known) + * @param content the content of the file + */ + public MultipartFileDto(String name, String originalFilename, String contentType, byte[] content) { + this.name = name; + this.originalFilename = (originalFilename != null ? originalFilename : ""); + this.contentType = contentType; + this.content = (content != null ? content : new byte[0]); + } + + /** + * Create a new MultipartFileDto with the given content. + * @param name the name of the file + * @param originalFilename the original filename (as on the client's machine) + * @param contentType the content type (if known) + * @param contentStream the content of the file as stream + * @throws IOException if reading from the stream failed + */ + public MultipartFileDto(String name, String originalFilename, String contentType, InputStream contentStream) + throws IOException { + + this(name, originalFilename, contentType, FileCopyUtils.copyToByteArray(contentStream)); + } + + @Override + public String getName() { + return this.name; + } + + @Override + public String getOriginalFilename() { + return this.originalFilename; + } + + @Override + public String getContentType() { + return this.contentType; + } + + @Override + public boolean isEmpty() { + return (this.content.length == 0); + } + + @Override + public long getSize() { + return this.content.length; + } + + @Override + public byte[] getBytes() throws IOException { + return this.content; + } + + @Override + public InputStream getInputStream() throws IOException { + return new ByteArrayInputStream(this.content); + } + + @Override + public void transferTo(File dest) throws IOException, IllegalStateException { + FileCopyUtils.copy(this.content, dest); + } + +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/config/RestTemplateConfig.java b/Cpop-Core/src/main/java/com/cpop/core/config/RestTemplateConfig.java new file mode 100644 index 0000000..3b264a1 --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/config/RestTemplateConfig.java @@ -0,0 +1,32 @@ +package com.cpop.core.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.client.ClientHttpRequestFactory; +import org.springframework.http.client.SimpleClientHttpRequestFactory; +import org.springframework.web.client.RestTemplate; + +/** + * @author DB + * @version 1.0.0 + * @since 2023-12-08 16:35 + */ +@Configuration +public class RestTemplateConfig { + + @Bean + public RestTemplate restTemplate(ClientHttpRequestFactory factory) { + return new RestTemplate(factory); + } + + @Bean + public ClientHttpRequestFactory simpleClientHttpRequestFactory() { + SimpleClientHttpRequestFactory factory = new SimpleClientHttpRequestFactory(); + factory.setReadTimeout(5000); + factory.setConnectTimeout(15000); + // 设置代理 + //factory.setProxy(null); + return factory; + } + +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/handler/TencentCosHandler.java b/Cpop-Core/src/main/java/com/cpop/core/handler/TencentCosHandler.java index 48ff246..84add4d 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/handler/TencentCosHandler.java +++ b/Cpop-Core/src/main/java/com/cpop/core/handler/TencentCosHandler.java @@ -2,17 +2,18 @@ package com.cpop.core.handler; import com.cpop.core.base.exception.UtilException; import com.cpop.core.config.TencentCosProperties; +import com.cpop.core.utils.file.FileTypeUtils; import com.cpop.core.utils.uuid.IdUtils; import com.qcloud.cos.COSClient; import com.qcloud.cos.ClientConfig; import com.qcloud.cos.auth.BasicCOSCredentials; import com.qcloud.cos.auth.COSCredentials; +import com.qcloud.cos.exception.CosClientException; +import com.qcloud.cos.exception.CosServiceException; import com.qcloud.cos.http.HttpProtocol; -import com.qcloud.cos.model.ObjectMetadata; -import com.qcloud.cos.model.PutObjectRequest; -import com.qcloud.cos.model.StorageClass; -import com.qcloud.cos.model.UploadResult; +import com.qcloud.cos.model.*; import com.qcloud.cos.region.Region; +import com.qcloud.cos.transfer.Download; import com.qcloud.cos.transfer.TransferManager; import com.qcloud.cos.transfer.TransferManagerConfiguration; import com.qcloud.cos.transfer.Upload; @@ -22,6 +23,7 @@ import org.springframework.stereotype.Component; import org.springframework.web.multipart.MultipartFile; import javax.annotation.PostConstruct; +import java.io.File; import java.io.IOException; import java.io.InputStream; import java.util.concurrent.ExecutorService; @@ -124,6 +126,7 @@ public class TencentCosHandler { * @return: com.qcloud.cos.model.UploadResult */ public UploadResult cdnUpload(MultipartFile file) { + String fileType = FileTypeUtils.getInstance().getFileType(file.getOriginalFilename()); try { ObjectMetadata objectMetadata = new ObjectMetadata(); // 上传的流如果能够获取准确的流长度,则推荐一定填写 content-length @@ -131,7 +134,7 @@ public class TencentCosHandler { objectMetadata.setContentLength(file.getSize()); objectMetadata.setContentType(file.getContentType()); InputStream inputStream = file.getInputStream(); - PutObjectRequest putObjectRequest = new PutObjectRequest(properties.getBucketName(), IdUtils.fastSimpleUUID(), inputStream, objectMetadata); + PutObjectRequest putObjectRequest = new PutObjectRequest(properties.getBucketName(), IdUtils.fastSimpleUUID() + "." + fileType, inputStream, objectMetadata); // 设置存储类型(如有需要,不需要请忽略此行代码), 默认是标准(Standard), 低频(standard_ia) // 更多存储类型请参见 https://cloud.tencent.com/document/product/436/33417 putObjectRequest.setStorageClass(StorageClass.Standard); diff --git a/Cpop-Core/src/main/java/com/cpop/core/utils/file/FileUtils.java b/Cpop-Core/src/main/java/com/cpop/core/utils/file/FileUtils.java index 664f858..0660dd7 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/utils/file/FileUtils.java +++ b/Cpop-Core/src/main/java/com/cpop/core/utils/file/FileUtils.java @@ -5,6 +5,7 @@ import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.read.listener.ReadListener; import com.cpop.common.utils.DateUtils; import com.cpop.common.utils.StringUtils; +import com.cpop.core.base.entity.MultipartFileDto; import com.cpop.core.base.exception.UtilException; import com.cpop.core.config.CpopConfig; import com.cpop.core.utils.SpringUtils; @@ -12,15 +13,23 @@ import com.cpop.core.utils.uuid.IdUtils; import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.ArrayUtils; +import org.apache.http.entity.ContentType; import org.apache.poi.ss.formula.functions.T; +import org.apache.tomcat.util.http.fileupload.FileItem; +import org.apache.tomcat.util.http.fileupload.FileItemFactory; +import org.apache.tomcat.util.http.fileupload.disk.DiskFileItemFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.mock.web.MockMultipartFile; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.commons.CommonsMultipartFile; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.*; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; +import java.nio.file.Files; import java.util.List; /** @@ -261,28 +270,7 @@ public class FileUtils { if (fileName == null) { return null; } - String baseName = FilenameUtils.getBaseName(fileName); - return baseName; - } - - /** - * @Description: 下载Excel - * @param response - * @return - * @author DB - * @Date: 2023/7/14 0014 13:42 - */ - public void downloadExcel(HttpServletResponse response, List list) { - // 写入数据 - try { - response.setContentType("application/vnd.excel"); - response.setCharacterEncoding("utf-8"); - String fileName = URLEncoder.encode("file", "UTF-8").replaceAll("\\+", "%20"); - response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); - EasyExcel.write(response.getOutputStream(), T.class).sheet("sheet1").doWrite(list); - } catch (IOException e) { - throw new UtilException(e); - } + return FilenameUtils.getBaseName(fileName); } /** @@ -309,5 +297,17 @@ public class FileUtils { }).sheet("sheet1").doRead(); } + /** + * 文件转上传文件格式 + * @author DB + * @since 2023/12/08 + * @param file 文件 + * @return MultipartFile 上传文件 + */ + public MultipartFile getMultipartFile(File file) throws IOException { + FileInputStream inputStream = new FileInputStream(file); + return new MockMultipartFile(file.getName(), file.getName(), ContentType.APPLICATION_OCTET_STREAM.toString(), inputStream); + } + } diff --git a/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java b/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java index e0a9781..6c41aff 100644 --- a/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java +++ b/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java @@ -26,7 +26,7 @@ public class CpopGenerator { * 数据库 URL */ // private static final String URL = "jdbc:mysql://localhost:3306/cpop-dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8"; - private static final String URL = "jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/cpop_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8"; + private static final String URL = "jdbc:mysql://localhost:3306/cpop_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8"; /** * 数据库用户名 */ @@ -34,23 +34,23 @@ public class CpopGenerator { /** * 数据库密码 */ - //private static final String PASSWORD = "root"; - private static final String PASSWORD = "Customer0401"; + private static final String PASSWORD = "root"; + //private static final String PASSWORD = "Customer0401"; /** * 输出路径 */ - private static final String EXPORT_URL = "/Cpop-System"; + private static final String EXPORT_URL = "/Cpop-Oam"; /** * 模块 */ - private static final String EXPORT_ITEM = "system"; + private static final String EXPORT_ITEM = "oam"; /** * 表前缀 */ - private static final String TABLE_PREFIX = "cp_sys_"; + private static final String TABLE_PREFIX = "cp_oam_"; /** * 主入口 diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/task/CardTemplateAsyncTask.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/task/CardTemplateAsyncTask.java index 5618e97..6c19a08 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/task/CardTemplateAsyncTask.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/task/CardTemplateAsyncTask.java @@ -14,6 +14,7 @@ import okhttp3.Request; import okhttp3.RequestBody; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; import java.io.IOException; import java.time.LocalDate; @@ -32,65 +33,52 @@ public class CardTemplateAsyncTask { */ @Async("customAsyncThreadPool") public void cloudCreateCard(JSONObject jsonBody,String cardTemplateId) { - try { - //查询课卡信息 - CardTemplate cardTemplate = SpringUtils.getBean(CardTemplateService.class).getById(cardTemplateId); - //时限卡 - if (cardTemplate.getTemplateType().equals(1)) { - jsonBody.put("moneyCard", true); - jsonBody.put("amount", cardTemplate.getPrice()); - } else if (cardTemplate.getTemplateType().equals(2)) { - jsonBody.put("timeLimit", true); - jsonBody.put("periodNumber", cardTemplate.getValidDay()); - jsonBody.put("periodType", cardTemplate.getTemplateType()); - } else { - // 课卡类型课时卡 - jsonBody.put("periodType", cardTemplate.getTemplateType()); - // 课卡计费类型 true false 课时卡 - jsonBody.put("timeLimit", false); - // 课时卡课时数 - jsonBody.put("periodNumber", cardTemplate.getClassNumber()); - } - // 课卡到期时间 - if (null != cardTemplate.getDayAppointment()){ - // 日最大约课次数 - jsonBody.put("maxFrequency", cardTemplate.getDayAppointment()); - } - if (StringUtils.isNotBlank(cardTemplate.getName())){ - // 课卡名称 - jsonBody.put("periodName", cardTemplate.getName()); - } - if (null != cardTemplate.getWeekAppointment()){ - // 周最大约课次数 - jsonBody.put("maxWeekFrequency", cardTemplate.getWeekAppointment()); - } - // 首次上课开始计有效期 - if (null != cardTemplate.getBufferDay()){ - // 最大停卡次数 - jsonBody.put("maxStopTime", cardTemplate.getBufferDay()); - } - //课卡有效期 - String periodExpire; - if (null != cardTemplate.getValidDay() && cardTemplate.getValidDay() > 0) { - //减一天 - LocalDate localDate = LocalDate.now().plusDays(cardTemplate.getValidDay() - 1); - periodExpire = localDate.format(DateTimeFormatter.ofPattern(DateUtils.YYYY_MM_DD)); - } else { - periodExpire = cardTemplate.getEndDate().format(DateTimeFormatter.ofPattern(DateUtils.YYYY_MM_DD)); - } - jsonBody.put("periodExpire", periodExpire); - //获取课卡信息 - OkHttpClient client = new OkHttpClient().newBuilder().build(); - MediaType mediaType = MediaType.parse("application/json"); - RequestBody body = RequestBody.create(mediaType, jsonBody.toJSONString()); - Request request = new Request.Builder() - .url(JamboxCloudUrl.COMMON_CARD_URL) - .method("POST", body) - .addHeader("Content-Type", "application/json") - .build(); - client.newCall(request).execute(); - } catch (IOException e) { - throw new ServiceException(e.getMessage()); + //查询课卡信息 + CardTemplate cardTemplate = SpringUtils.getBean(CardTemplateService.class).getById(cardTemplateId); + //时限卡 + if (cardTemplate.getTemplateType().equals(1)) { + jsonBody.put("moneyCard", true); + jsonBody.put("amount", cardTemplate.getPrice()); + } else if (cardTemplate.getTemplateType().equals(2)) { + jsonBody.put("timeLimit", true); + jsonBody.put("periodNumber", cardTemplate.getValidDay()); + jsonBody.put("periodType", cardTemplate.getTemplateType()); + } else { + // 课卡类型课时卡 + jsonBody.put("periodType", cardTemplate.getTemplateType()); + // 课卡计费类型 true false 课时卡 + jsonBody.put("timeLimit", false); + // 课时卡课时数 + jsonBody.put("periodNumber", cardTemplate.getClassNumber()); } + // 课卡到期时间 + if (null != cardTemplate.getDayAppointment()){ + // 日最大约课次数 + jsonBody.put("maxFrequency", cardTemplate.getDayAppointment()); + } + if (StringUtils.isNotBlank(cardTemplate.getName())){ + // 课卡名称 + jsonBody.put("periodName", cardTemplate.getName()); + } + if (null != cardTemplate.getWeekAppointment()){ + // 周最大约课次数 + jsonBody.put("maxWeekFrequency", cardTemplate.getWeekAppointment()); + } + // 首次上课开始计有效期 + if (null != cardTemplate.getBufferDay()){ + // 最大停卡次数 + jsonBody.put("maxStopTime", cardTemplate.getBufferDay()); + } + //课卡有效期 + String periodExpire; + if (null != cardTemplate.getValidDay() && cardTemplate.getValidDay() > 0) { + //减一天 + LocalDate localDate = LocalDate.now().plusDays(cardTemplate.getValidDay() - 1); + periodExpire = localDate.format(DateTimeFormatter.ofPattern(DateUtils.YYYY_MM_DD)); + } else { + periodExpire = cardTemplate.getEndDate().format(DateTimeFormatter.ofPattern(DateUtils.YYYY_MM_DD)); + } + jsonBody.put("periodExpire", periodExpire); + SpringUtils.getBean(RestTemplate.class).postForObject(JamboxCloudUrl.COMMON_CARD_URL, jsonBody, JSONObject.class); } } diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/framework/constant/JamboxCloudUrl.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/framework/constant/JamboxCloudUrl.java index ce98eea..b603d55 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/framework/constant/JamboxCloudUrl.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/framework/constant/JamboxCloudUrl.java @@ -14,4 +14,9 @@ public interface JamboxCloudUrl { * 课卡相关云函数 */ String COMMON_CARD_URL = BASE_URL + "/merchant_cloud"; + + /** + * 数据导入 + */ + String DATA_IMPORT = BASE_URL + "/dataImport"; } diff --git a/Cpop-Mall/pom.xml b/Cpop-Mall/pom.xml index 490f2b7..c97662d 100644 --- a/Cpop-Mall/pom.xml +++ b/Cpop-Mall/pom.xml @@ -27,6 +27,7 @@ com.cpop Cpop-Jambox + diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageOrderController.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageOrderController.java index e6cab86..e7a9f86 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageOrderController.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageOrderController.java @@ -1,11 +1,9 @@ package com.cpop.mall.business.controller.backstage; import com.cpop.core.base.R; -import com.cpop.core.utils.SpringUtils; import com.cpop.mall.business.bo.LogisticsOrderBo; import com.cpop.mall.business.bo.OrderPageBo; import com.cpop.mall.business.service.OrderService; -import com.cpop.mall.business.task.OrderDetailAsyncTask; import com.cpop.mall.business.vo.OrderPageVo; import com.mybatisflex.core.paginate.Page; import io.swagger.annotations.Api; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageProductController.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageProductController.java index ee4ffcf..928f894 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageProductController.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageProductController.java @@ -7,7 +7,7 @@ import com.cpop.mall.business.bo.ProductPageBo; import com.cpop.mall.business.service.ProductRecordService; import com.cpop.mall.business.service.ProductService; import com.cpop.mall.business.service.ProductSpecificationService; -import com.cpop.mall.business.task.ShoppingCartAsyncTask; +import com.cpop.mall.framework.task.ShoppingCartAsyncTask; import com.cpop.mall.business.vo.JamboxCardTemplateListVo; import com.cpop.mall.business.vo.ProductInfoVo; import com.cpop.mall.business.vo.ProductPageVo; @@ -21,7 +21,6 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import java.io.Serializable; import java.util.List; import static com.cpop.mall.business.entity.table.ProductRecordTableDef.PRODUCT_RECORD; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/callback/WxPayCallbackController.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/callback/WxPayCallbackController.java index aeeb5c4..bf4857c 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/callback/WxPayCallbackController.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/callback/WxPayCallbackController.java @@ -3,8 +3,6 @@ package com.cpop.mall.business.controller.callback; import com.cpop.mall.business.service.OrderRefundService; import com.cpop.mall.business.service.OrderService; import com.github.binarywang.wxpay.bean.notify.WxPayNotifyResponse; -import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; -import com.github.binarywang.wxpay.service.WxPayService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/OrderServiceImpl.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/OrderServiceImpl.java index a1c5787..cec090b 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/OrderServiceImpl.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/OrderServiceImpl.java @@ -10,7 +10,6 @@ import com.cpop.core.base.enums.OrderSource; import com.cpop.core.base.enums.UserType; import com.cpop.core.base.exception.ServiceException; import com.cpop.core.base.table.SysUser; -import com.cpop.core.service.CoreService; import com.cpop.core.service.RedisService; import com.cpop.core.utils.QuartzUtils; import com.cpop.core.utils.SecurityUtils; @@ -24,10 +23,10 @@ import com.cpop.mall.business.dto.WxPayGoodsDetailDto; import com.cpop.mall.business.entity.*; import com.cpop.mall.business.mapper.OrderMapper; import com.cpop.mall.business.service.*; -import com.cpop.mall.business.task.OrderDetailAsyncTask; -import com.cpop.mall.business.task.OrderOverTimeUnPayTask; -import com.cpop.mall.business.task.ProductRecordSyncStockTask; -import com.cpop.mall.business.task.WxPayAsyncTask; +import com.cpop.mall.framework.task.OrderDetailAsyncTask; +import com.cpop.mall.framework.task.OrderOverTimeUnPayTask; +import com.cpop.mall.framework.task.ProductRecordSyncStockTask; +import com.cpop.mall.framework.task.WxPayAsyncTask; import com.cpop.mall.business.vo.OrderDetailVo; import com.cpop.mall.business.vo.OrderInfoVo; import com.cpop.mall.business.vo.OrderPageVo; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/ProductServiceImpl.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/ProductServiceImpl.java index 63b90d6..05b3979 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/ProductServiceImpl.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/ProductServiceImpl.java @@ -24,7 +24,7 @@ import com.cpop.mall.business.service.OrderEvaluateService; import com.cpop.mall.business.service.ProductRecordService; import com.cpop.mall.business.service.ProductService; import com.cpop.mall.business.service.ProductSpecificationService; -import com.cpop.mall.business.task.ShoppingCartAsyncTask; +import com.cpop.mall.framework.task.ShoppingCartAsyncTask; import com.cpop.mall.business.vo.*; import com.cpop.mall.framework.constant.MallRedisConstant; import com.cpop.system.business.service.StoreService; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/task/OrderDetailAsyncTask.java b/Cpop-Mall/src/main/java/com/cpop/mall/framework/task/OrderDetailAsyncTask.java similarity index 83% rename from Cpop-Mall/src/main/java/com/cpop/mall/business/task/OrderDetailAsyncTask.java rename to Cpop-Mall/src/main/java/com/cpop/mall/framework/task/OrderDetailAsyncTask.java index da30f90..9a0c9fa 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/task/OrderDetailAsyncTask.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/framework/task/OrderDetailAsyncTask.java @@ -1,4 +1,4 @@ -package com.cpop.mall.business.task; +package com.cpop.mall.framework.task; import com.alibaba.fastjson.JSONObject; import com.cpop.core.base.enums.OrderSource; @@ -16,6 +16,7 @@ import okhttp3.*; import org.springframework.beans.factory.annotation.Value; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; import java.io.IOException; import java.util.List; @@ -84,19 +85,7 @@ public class OrderDetailAsyncTask { //模板对应实际地址 jsonBody.put("templateUrl", cloudBaseUrl); //获取课卡信息 - OkHttpClient client = new OkHttpClient().newBuilder().build(); - MediaType mediaType = MediaType.parse("application/json"); - RequestBody body = RequestBody.create(mediaType, jsonBody.toJSONString()); - Request request = new Request.Builder() - .url(JamboxCloudUrl.COMMON_CARD_URL) - .method("POST", body) - .addHeader("Content-Type", "application/json") - .build(); - try { - client.newCall(request).execute(); - } catch (IOException e) { - throw new ServiceException(e.getMessage()); - } + SpringUtils.getBean(RestTemplate.class).postForObject(JamboxCloudUrl.COMMON_CARD_URL, jsonBody, JSONObject.class); } }); } diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/task/OrderOverTimeUnPayTask.java b/Cpop-Mall/src/main/java/com/cpop/mall/framework/task/OrderOverTimeUnPayTask.java similarity index 98% rename from Cpop-Mall/src/main/java/com/cpop/mall/business/task/OrderOverTimeUnPayTask.java rename to Cpop-Mall/src/main/java/com/cpop/mall/framework/task/OrderOverTimeUnPayTask.java index d429e10..493271a 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/task/OrderOverTimeUnPayTask.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/framework/task/OrderOverTimeUnPayTask.java @@ -1,4 +1,4 @@ -package com.cpop.mall.business.task; +package com.cpop.mall.framework.task; import com.cpop.core.service.RedisService; import com.cpop.core.utils.SpringUtils; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/task/ProductRecordSyncStockTask.java b/Cpop-Mall/src/main/java/com/cpop/mall/framework/task/ProductRecordSyncStockTask.java similarity index 98% rename from Cpop-Mall/src/main/java/com/cpop/mall/business/task/ProductRecordSyncStockTask.java rename to Cpop-Mall/src/main/java/com/cpop/mall/framework/task/ProductRecordSyncStockTask.java index 5079a8b..2a59fe6 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/task/ProductRecordSyncStockTask.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/framework/task/ProductRecordSyncStockTask.java @@ -1,4 +1,4 @@ -package com.cpop.mall.business.task; +package com.cpop.mall.framework.task; import com.cpop.core.service.RedisService; import com.cpop.core.utils.SpringUtils; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/task/ShoppingCartAsyncTask.java b/Cpop-Mall/src/main/java/com/cpop/mall/framework/task/ShoppingCartAsyncTask.java similarity index 98% rename from Cpop-Mall/src/main/java/com/cpop/mall/business/task/ShoppingCartAsyncTask.java rename to Cpop-Mall/src/main/java/com/cpop/mall/framework/task/ShoppingCartAsyncTask.java index 76a0ba6..62b3e6b 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/task/ShoppingCartAsyncTask.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/framework/task/ShoppingCartAsyncTask.java @@ -1,4 +1,4 @@ -package com.cpop.mall.business.task; +package com.cpop.mall.framework.task; import com.cpop.core.utils.SpringUtils; import com.cpop.mall.business.entity.Product; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/task/WxPayAsyncTask.java b/Cpop-Mall/src/main/java/com/cpop/mall/framework/task/WxPayAsyncTask.java similarity index 94% rename from Cpop-Mall/src/main/java/com/cpop/mall/business/task/WxPayAsyncTask.java rename to Cpop-Mall/src/main/java/com/cpop/mall/framework/task/WxPayAsyncTask.java index b8e6b24..b1441d0 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/task/WxPayAsyncTask.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/framework/task/WxPayAsyncTask.java @@ -1,22 +1,18 @@ -package com.cpop.mall.business.task; +package com.cpop.mall.framework.task; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.cpop.common.utils.StringUtils; import com.cpop.core.base.enums.OrderSource; import com.cpop.core.base.exception.ServiceException; -import com.cpop.core.base.exception.UtilException; import com.cpop.core.utils.SpringUtils; import com.cpop.mall.framework.config.wxPay.WxPayProperties; import com.cpop.system.business.entity.ProfitSharing; import com.cpop.system.business.service.BrandService; import com.cpop.system.business.service.ProfitSharingService; import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult; -import com.github.binarywang.wxpay.bean.profitsharing.ProfitSharingReceiverRequest; import com.github.binarywang.wxpay.bean.profitsharing.ProfitSharingRequest; import com.github.binarywang.wxpay.bean.profitsharing.ProfitSharingResult; -import com.github.binarywang.wxpay.bean.profitsharingV3.ProfitSharingReceiver; -import com.github.binarywang.wxpay.config.WxPayConfig; import com.github.binarywang.wxpay.exception.WxPayException; import com.github.binarywang.wxpay.service.WxPayService; import org.springframework.beans.factory.annotation.Autowired; diff --git a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-dev.yml b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-dev.yml index 40dd268..980a964 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-dev.yml +++ b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application-dev.yml @@ -60,9 +60,9 @@ mybatis-flex: log-impl: org.apache.ibatis.logging.stdout.StdOutImpl datasource: oam: - url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/cpop_test?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 + url: jdbc:mysql://localhost:3306/cpop_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root - password: Customer0401 + password: root jambox: url: jdbc:mysql://sh-cynosdbmysql-grp-fggo83js.sql.tencentcdb.com:20965/jambox_test?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true username: root diff --git a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application.yml b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application.yml index ded05a5..4bcf4ef 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application.yml +++ b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/application.yml @@ -150,7 +150,6 @@ wx: token: 1i2dz2yxD0Np2xvMYTD # (应用中的 “接受消息” 部分的 “接收消息服务器配置” 里的EncodingAESKey值) aesKey: DLSzfHVUZN3O9WhtL07RBXUoooqC2bjEJYwep8k8ojt - #开放平台 open: openAppid: wx6e07ba6606e912a5 @@ -170,4 +169,16 @@ wx: apiV3Key: JamBox20230919174000000000000002 #分账服务商账号 sharingAccount: 1618884922 - sharingAccountName: 果酱盒子 \ No newline at end of file + sharingAccountName: 果酱盒子 + miniapp: + configs: + #微信小程序的appid + - appid: wx20853d18c455e874 + #微信小程序的Secret + secret: 217caf62439579195c8da19774de40d1 + #微信小程序消息服务器配置的token + token: + #微信小程序消息服务器配置的EncodingAESKey + aesKey: + #数据格式 + msgDataFormat: JSON \ No newline at end of file diff --git a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopImportTests.java b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopImportTests.java index 5f4b8e8..5886c77 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopImportTests.java +++ b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopImportTests.java @@ -10,12 +10,19 @@ import com.cpop.jambox.business.entity.BrandExtend; import com.cpop.jambox.business.entity.StoreExtend; import com.cpop.jambox.business.service.BrandExtendService; import com.cpop.jambox.business.service.StoreExtendService; +import com.cpop.oam.business.entity.BrandManager; +import com.cpop.oam.business.entity.BrandManagerStore; +import com.cpop.oam.business.service.BrandManagerService; +import com.cpop.oam.business.service.BrandManagerStoreService; import com.cpop.system.business.entity.Brand; import com.cpop.system.business.entity.Store; +import com.cpop.system.business.mapper.StoreMapper; import com.cpop.system.business.service.BrandService; import com.cpop.system.business.service.StoreService; -import com.mybatisflex.core.row.DbChain; -import com.mybatisflex.core.row.Row; +import com.mybatisflex.annotation.KeyType; +import com.mybatisflex.core.datasource.DataSourceKey; +import com.mybatisflex.core.query.QueryWrapper; +import com.mybatisflex.core.row.*; import lombok.Data; import lombok.Value; import lombok.extern.slf4j.Slf4j; @@ -25,14 +32,14 @@ import org.springframework.test.context.junit4.SpringRunner; import org.springframework.transaction.annotation.Transactional; import java.io.*; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.*; import java.util.stream.Collectors; import static com.cpop.jambox.business.entity.table.BrandExtendTableDef.BRAND_EXTEND; import static com.cpop.system.business.entity.table.BrandTableDef.BRAND; +import static com.cpop.system.business.entity.table.StoreTableDef.STORE; /** * @author DB @@ -96,7 +103,6 @@ public class CpopImportTests { .filter(item -> !filterList.contains(item.getBrandCloudId()) && //品牌不为null和空 null != item.getBrandCloudId() && StringUtils.isNotBlank(item.getBrandCloudId())).collect(Collectors.toList()); - //打印 Map storeExtendStoreMap = new HashMap<>(); //获取所有品牌 @@ -125,6 +131,130 @@ public class CpopImportTests { SpringUtils.getBean(StoreExtendService.class).saveBatch(storeExtendStoreMap.keySet()); } + /** + * 更新导入的旧数据 + * @author DB + * @since 2023/12/08 + */ + @Test + public void updateImportData() { + List rowList = null; + try { + //查询旧表 + DataSourceKey.use("jambox"); + rowList = DbChain.table("t_mechanism_info") + .select("tmi.store_id as storeCloudId") + .select("tmi.charge_name as personCharge") + .select("tmi.charge_phone as phone") + .select("tmi.address as storeAddr") + .select("ifnull(date_format(tsm.end_time,'%Y-%m-%d'),null) as expireDate") + .select("if(tmi.clue_id is null,0,1) as haveCounselor") + .select("if(of.activation is null,0,of.activation) as haveActive") + .from("t_mechanism_info").as("tmi") + .leftJoin("OAM_finance").as("of").on("of.clue_id LIKE tmi.clue_id") + .leftJoin("t_signContract_mechanism").as("tsm").on("tsm.store_id = tmi.store_id") + .list(); + } finally { + DataSourceKey.clear(); + } + //以云id换id + Map cloudToIdMap = SpringUtils.getBean(StoreExtendService.class).list() + .stream().collect(Collectors.toMap(StoreExtend::getStoreCloudId, StoreExtend::getStoreId)); + //用迭代器 + Iterator iterator = rowList.iterator(); + while (iterator.hasNext()) { + Row next = iterator.next(); + if (StringUtils.isBlank(cloudToIdMap.get(next.getString("storeCloudId")))) { + iterator.remove(); + } else { + next.set("id", cloudToIdMap.get(next.getString("storeCloudId"))); + if (StringUtils.isBlank(next.getString("id"))){ + iterator.remove(); + } + } + } + List entityList = RowUtil.toEntityList(rowList, Store.class); + entityList.forEach(item->{ + if (StringUtils.isBlank(item.getId())){ + log.error(item.toString()); + } + }); + SpringUtils.getBean(StoreService.class).updateBatch(entityList); + } + + /** + * 导入品牌管理员 + * @author DB + * @since 2023/12/08 + */ + @Test + public void importBrandManage() throws IOException { + String brandManagerFileUrl = "C:\\Users\\Administrator\\Desktop\\brandManager.json"; + List jsonBrands = JSONArray.parseArray(readJson(brandManagerFileUrl), JsonBrandManager.class); + List brandManagers = BeanUtils.mapToList(jsonBrands, BrandManager.class); + SpringUtils.getBean(BrandManagerService.class).saveBatch(brandManagers); + Map brandManagerMap = brandManagers.stream().collect(Collectors.toMap(BrandManager::getBrandManagerCloudId, BrandManager::getId)); + //中间表数据 + Map brandMap = SpringUtils.getBean(BrandExtendService.class).list() + .stream().collect(Collectors.toMap(BrandExtend::getBrandCloudId, BrandExtend::getBrandId)); + Map storMap = SpringUtils.getBean(StoreExtendService.class).list() + .stream().collect(Collectors.toMap(StoreExtend::getStoreCloudId, StoreExtend::getStoreId)); + List brandManagerStores = new ArrayList<>(); + jsonBrands.forEach(item->{ + if (item.getStoreCloudIds() != null && !item.getStoreCloudIds().isEmpty()) { + item.getStoreCloudIds().forEach(inner -> { + BrandManagerStore brandManagerStore = new BrandManagerStore(); + brandManagerStore.setBrandId(brandMap.get(item.getBrandCloudId())) + .setBrandManagerId(brandManagerMap.get(item.getBrandManagerCloudId())) + .setStoreId(storMap.get(inner)); + brandManagerStores.add(brandManagerStore); + }); + } else { + if (StringUtils.isNotBlank(item.getBrandCloudId())) { + BrandManagerStore brandManagerStore = new BrandManagerStore(); + brandManagerStore.setBrandId(brandMap.get(item.getBrandCloudId())).setBrandManagerId(brandManagerMap.get(item.getBrandManagerCloudId())); + brandManagerStores.add(brandManagerStore); + } + } + }); + SpringUtils.getBean(BrandManagerStoreService.class).saveBatch(brandManagerStores); + } + + @Data + private class JsonBrandManager implements Serializable { + + /** + * 云品牌id + */ + @JSONField(name = "_brandid") + private String brandCloudId; + + /** + * 云校区id集合 + */ + @JSONField(name = "store") + private List storeCloudIds; + + /** + * 手机号 + */ + @JSONField(name = "phone") + private String phoneNumber; + + /** + * 姓名 + */ + @JSONField(name = "name") + private String name; + + /** + * 云id + */ + @JSONField(name = "_id") + private String brandManagerCloudId; + + } + /** * json格式品牌 */ @@ -170,6 +300,45 @@ public class CpopImportTests { private String brandCloudId; } + @Data + private class UpdateStore implements Serializable { + + /** + * 云校区id + */ + private String storeCloudId; + + /** + * 店铺/校区地址 + */ + private String storeAddr; + + /** + * 负责人 + */ + private String personCharge; + + /** + * 手机号 + */ + private String phone; + + /** + * 到期日期 + */ + private LocalDate expireDate; + + /** + * 是否有顾问 + */ + private Boolean haveCounselor; + + /** + * 是否激活 + */ + private Boolean haveActive; + } + /** * 读取json文件数据 * diff --git a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopQrtzTest.java b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopQrtzTest.java new file mode 100644 index 0000000..2a3bd61 --- /dev/null +++ b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopQrtzTest.java @@ -0,0 +1,66 @@ +package com.cpop.oam.web; + +import com.cpop.core.utils.QuartzUtils; +import com.cpop.core.utils.SpringUtils; +import com.cpop.oam.business.entity.Task; +import com.cpop.oam.business.service.TaskService; +import com.cpop.oam.business.service.TaskStaffGroupService; +import org.junit.jupiter.api.Test; +import org.quartz.SchedulerException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +import static com.cpop.oam.business.entity.table.TaskStaffGroupTableDef.TASK_STAFF_GROUP; + +/** + * @author DB + * @version 1.0.0 + * @since 2023-12-07 11:55 + */ +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) + +public class CpopQrtzTest { + + @Autowired + private QuartzUtils quartzUtils; + + /** + * 定时任务删除 + * @author DB + * @since 2023/12/07 + */ + @Test + public void jobRemove() throws SchedulerException { + quartzUtils.deleteJob("WorkOrderAcceptOvertimeTask:90214101954240512","WorkOrder"); + } + + @Test + public void workOrderAcceptOverTimeTask() { + // 获取任务 + TaskService taskService = SpringUtils.getBean(TaskService.class); + Task task = taskService.getById("90263826384441344"); + // 工单超时为接收,扣除5绩点 + TaskStaffGroupService taskStaffGroupService = SpringUtils.getBean(TaskStaffGroupService.class); + taskStaffGroupService.updateChain() + .set(TASK_STAFF_GROUP.GRADE_POINT, -5) + .set(TASK_STAFF_GROUP.REMARK, "工单接收超时扣除5绩点 ") + .where(TASK_STAFF_GROUP.TASK_ID.eq(task.getId())) + .and(TASK_STAFF_GROUP.STAFF_ID.eq(task.getResponsibleStaffId())) + .update(); + } + + @Test + public void workOrderOverTimeTask() { + // 获取任务 + TaskService taskService = SpringUtils.getBean(TaskService.class); + Task task = taskService.getById("90282358270763008"); + // 扣除5点绩点 + SpringUtils.getBean(TaskStaffGroupService.class).updateChain() + .setRaw(TASK_STAFF_GROUP.GRADE_POINT, "grade_point - 5") + .setRaw(TASK_STAFF_GROUP.REMARK, "concat(remark,'工单完结超时扣除5绩点')") + .where(TASK_STAFF_GROUP.TASK_ID.eq(task.getId())) + .and(TASK_STAFF_GROUP.STAFF_ID.eq(task.getResponsibleStaffId())) + .update(); + } + +} diff --git a/Cpop-Oam/pom.xml b/Cpop-Oam/pom.xml index d5c629c..ee8b262 100644 --- a/Cpop-Oam/pom.xml +++ b/Cpop-Oam/pom.xml @@ -41,15 +41,15 @@ com.github.binarywang weixin-java-open - - - org.springframework.boot - spring-boot-devtools - - true - - runtime - + + + com.github.binarywang + weixin-java-miniapp + + + org.springframework + spring-test + diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/BrandManagerBo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/BrandManagerBo.java new file mode 100644 index 0000000..e883a70 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/BrandManagerBo.java @@ -0,0 +1,54 @@ +package com.cpop.oam.business.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import java.util.List; + +/** + * @author DB + * @version 1.0.0 + * @since 2023-12-07 17:57 + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "BrandManager对象", description = "品牌管理员") +public class BrandManagerBo { + + /** + * 主键 + */ + @ApiModelProperty("主键") + private String id; + + /** + * 姓名 + */ + @NotBlank(message = "姓名不能为空") + @ApiModelProperty(value = "姓名",required = true) + private String name; + + /** + * 手机号 + */ + @NotBlank(message = "手机号不能为空") + @ApiModelProperty(value = "手机号",required = true) + private String phone; + + /** + * 品牌 + */ + @NotBlank(message = "品牌不能为空") + @ApiModelProperty(value = "品牌",required = true ) + private String brandId; + + /** + * 校区id集合 + */ + @ApiModelProperty(value = "校区id集合") + private List storeIds; +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/BrandManagerPageBo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/BrandManagerPageBo.java new file mode 100644 index 0000000..b54a93d --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/BrandManagerPageBo.java @@ -0,0 +1,33 @@ +package com.cpop.oam.business.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author DB + * @version 1.0.0 + * @since 2023-12-07 17:25 + */ +@Data +@ApiModel(value = "品牌管理员参数") +public class BrandManagerPageBo { + + /** + * 品牌名 + */ + @ApiModelProperty(value = "品牌名") + private String brandName; + + /** + * 手机号 + */ + @ApiModelProperty(value = "手机号") + private String phoneNumber; + + /** + * + */ + @ApiModelProperty(value = "姓名") + private String name; +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/DataImportBo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/DataImportBo.java new file mode 100644 index 0000000..8aa7b20 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/DataImportBo.java @@ -0,0 +1,57 @@ +package com.cpop.oam.business.bo; + +import com.cpop.core.annontation.StringArrayConvert; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import java.time.LocalDateTime; + +/** + * @author DB + * @version 1.0.0 + * @since 2023-12-10 11:56 + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "DataImportBo对象") +public class DataImportBo { + + /** + * 主键 + */ + @ApiModelProperty(value = "主键") + private String id; + + /** + * 品牌id + */ + @NotBlank(message = "不能为空") + @ApiModelProperty(value = "品牌") + private String brandId; + + /** + * 校区 + */ + @NotBlank(message = "不能为空") + @ApiModelProperty(value = "校区") + private String storeId; + + /** + * 导入文件地址 + */ + @NotBlank(message = "不能为空") + @StringArrayConvert + @ApiModelProperty(value = "导入文件地址") + private String fileUrl; + + /** + * 是否清空 + */ + @ApiModelProperty(value = "是否清空") + private Boolean isClear; + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/DataImportPageBo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/DataImportPageBo.java new file mode 100644 index 0000000..4061400 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/DataImportPageBo.java @@ -0,0 +1,34 @@ +package com.cpop.oam.business.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * @author DB + * @version 1.0.0 + * @since 2023-12-10 11:05 + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "DataImportPageBo对象") +public class DataImportPageBo { + + /** + * 导入状态 + */ + @NotNull(message = "导入状态不能为空") + @ApiModelProperty(value = "导入状态") + private Boolean importStatus; + + /** + * 校区名 + */ + @ApiModelProperty(value = "校区名") + private String storeName; + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/OperationStatusBo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/OperationStatusBo.java new file mode 100644 index 0000000..2941ad0 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/OperationStatusBo.java @@ -0,0 +1,34 @@ +package com.cpop.oam.business.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; + +/** + * @author DB + * @version 1.0.0 + * @since 2023-12-07 18:14 + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "OperationStatusBo对象") +public class OperationStatusBo { + + /** + * 员工id + */ + @NotBlank(message = "员工id不能为空") + @ApiModelProperty(value = "员工id",required = true) + private String id; + + /** + * 操作状态 + */ + @NotNull(message = "操作状态不能为空") + @ApiModelProperty(value = "操作状态",required = true) + private Boolean isOperation; +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskDemandUrgentBo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskDemandUrgentBo.java new file mode 100644 index 0000000..b1cb2a8 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskDemandUrgentBo.java @@ -0,0 +1,26 @@ +package com.cpop.oam.business.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * 任务需求加急 + * @author DB + * @version 1.0.0 + * @since 2023-12-08 11:10 + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "TaskDemandUrgentBo对象") +public class TaskDemandUrgentBo { + + /** + * 需求id + */ + @ApiModelProperty("需求id") + private String id; + + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TechnologyToolBo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TechnologyToolBo.java new file mode 100644 index 0000000..6c43b2a --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TechnologyToolBo.java @@ -0,0 +1,56 @@ +package com.cpop.oam.business.bo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import java.time.LocalDateTime; + +/** + * @author DB + * @version 1.0.0 + * @since 2023-12-10 10:36 + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "TechnologyToolBo对象") +public class TechnologyToolBo { + + /** + * 主键 + */ + @ApiModelProperty(value = "主键") + private String id; + + /** + * 工具名 + */ + @NotBlank(message = "工具名不能为空") + @ApiModelProperty(value = "工具名",required = true) + private String toolName; + + /** + * 工具地址 + */ + @NotBlank(message = "工具地址不能为空") + @ApiModelProperty(value = "工具地址",required = true) + private String toolUrl; + + /** + * 工具介绍 + */ + @NotBlank(message = "工具介绍不能为空") + @ApiModelProperty(value = "工具介绍",required = true) + private String toolDesc; + + /** + * 工具类型(字典) + */ + @NotBlank(message = "工具类型不能为空") + @ApiModelProperty(value = "工具类型(字典)",required = true) + private String toolType; + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BrandManagerController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BrandManagerController.java new file mode 100644 index 0000000..45c4f7e --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BrandManagerController.java @@ -0,0 +1,113 @@ +package com.cpop.oam.business.controller.backstage; + +import com.cpop.core.base.R; +import com.cpop.oam.business.bo.BrandManagerBo; +import com.cpop.oam.business.bo.BrandManagerPageBo; +import com.cpop.oam.business.service.BrandManagerService; +import com.cpop.system.business.bo.StoreListByBrandBo; +import com.cpop.system.business.entity.table.BrandTableDef; +import com.cpop.system.business.entity.table.StoreTableDef; +import com.cpop.system.business.service.BrandService; +import com.cpop.system.business.service.StoreService; +import com.cpop.system.business.vo.BrandListVo; +import com.cpop.oam.business.vo.BrandManagePageVo; +import com.cpop.system.business.vo.StoreListByBrandVo; +import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.query.QueryWrapper; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.beans.factory.annotation.Autowired; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +import java.util.List; + +/** + * 品牌管理员表 控制层。 + * + * @author DB + * @since 2023-12-07 + */ +@RestController +@Api(tags = "品牌管理员表接口") +@RequestMapping("/brandManage") +public class BrandManagerController { + + @Autowired + private BrandManagerService brandManageService; + + @Autowired + private BrandService brandService; + + @Autowired + private StoreService storeService; + + /** + * 查询品牌管理员分页 + * @author DB + * @since 2023/12/07 + * @param bo 请求参数 + * @return R> + */ + @ApiOperation("查询品牌管理员分页") + @GetMapping("/getBrandManagePage") + public R> getBrandManagePage(BrandManagerPageBo bo) { + Page page = brandManageService.getBrandManagerPage(bo); + return R.ok(page); + } + + /** + * 查询品牌列表 + * @author DB + * @since 2023/09/07 18:07 + * @return R> + */ + @ApiOperation("查询品牌列表") + @GetMapping("/getBrandList") + public R> getBrandList(String query) { + List list = brandService.listAs(QueryWrapper.create().and(BrandTableDef.BRAND.BRAND_NAME.like(query)), BrandListVo.class); + return R.ok(list); + } + + /** + * 查询品牌列表 + * @return R> + * @author DB + * @since 2023/6/2 17:37 + **/ + @ApiOperation("根据品牌查询校区列表") + @PostMapping("/getStoreListByBrand") + public R> getCampusListByBrand(@RequestBody StoreListByBrandBo bo) { + List vos = storeService.listAs(QueryWrapper.create().and(StoreTableDef.STORE.BRAND_ID.in(bo.getBrandIds())), StoreListByBrandVo.class); + return R.ok(vos); + } + + /** + * 删除品牌管理员 + * @author DB + * @since 2023/12/07 + * @param id 主键 + * @return R + */ + @ApiOperation("删除品牌管理员") + @DeleteMapping("/removeBrandManageById/{id}") + public R removeBrandManageById(@PathVariable String id) { + brandManageService.removeBrandManagerById(id); + return R.ok(); + } + + /** + * 新增品牌管理员 + * @author DB + * @since 2023/12/07 + * @param bo 请求 + * @return R + */ + @ApiOperation("新增品牌管理员") + @PostMapping("insertBrandManage") + public R insertBrandManage(@RequestBody @Validated BrandManagerBo bo) { + brandManageService.insertBrandManager(bo); + return R.ok(); + } + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/DataImportController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/DataImportController.java new file mode 100644 index 0000000..649e738 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/DataImportController.java @@ -0,0 +1,173 @@ +package com.cpop.oam.business.controller.backstage; + +import com.alibaba.excel.EasyExcel; +import com.cpop.core.base.R; +import com.cpop.core.utils.file.FileUploadUtils; +import com.cpop.core.utils.file.FileUtils; +import com.cpop.oam.business.bo.DataImportBo; +import com.cpop.oam.business.bo.DataImportPageBo; +import com.cpop.oam.business.bo.StaffBo; +import com.cpop.oam.business.dto.DataImportDto; +import com.cpop.oam.business.vo.DataImportPageVo; +import com.cpop.oam.business.vo.StoreListVo; +import com.cpop.system.business.service.BrandService; +import com.cpop.system.business.service.StoreService; +import com.cpop.system.business.vo.BrandListVo; +import com.cpop.system.business.vo.SysFileVo; +import com.mybatisflex.core.paginate.Page; +import com.qcloud.cos.model.UploadResult; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.beans.factory.annotation.Autowired; +import com.cpop.oam.business.entity.DataImport; +import com.cpop.oam.business.service.DataImportService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import org.springframework.web.multipart.MultipartFile; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.Serializable; +import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.List; + +import static com.cpop.system.business.entity.table.BrandTableDef.BRAND; +import static com.cpop.system.business.entity.table.StoreTableDef.STORE; + +/** + * oam-数据导入表 控制层。 + * + * @author DB + * @since 2023-12-10 + */ +@RestController +@Api(tags = "数据导入接口") +@RequestMapping("/dataImport") +public class DataImportController { + + @Autowired + private DataImportService dataImportService; + + @Autowired + private BrandService brandService; + + @Autowired + private StoreService storeService; + + /** + * 数据导入分页查询 + * @author DB + * @since 2023/12/10 + * @param bo 请求参数 + * @return R> + */ + @GetMapping("/getDataImportPage") + @ApiOperation("数据导入分页查询") + public R> getDataImportPage(DataImportPageBo bo) { + Page page = dataImportService.getDataImportPage(bo); + return R.ok(page); + } + + /** + * 获取品牌列表 + * + * @param brandName 品牌名 + * @author DB + * @since 2023-11-30 17:59:29 + */ + @ApiOperation("获取品牌列表") + @GetMapping("/getBrandList") + public R> getBrandList(@ApiParam("品牌名") String brandName) { + List list = brandService.queryChain().and(BRAND.BRAND_NAME.like(brandName)).listAs(BrandListVo.class); + return R.ok(list); + } + + /** + * 获取校区/店铺列表 + * + * @param brandId 品牌id + * @author DB + * @since 2023-11-30 18:00:08 + */ + @ApiOperation("获取校区/店铺列表") + @GetMapping("/getStoreList") + public R> getStoreList(@ApiParam("品牌id") String brandId) { + List list = storeService.queryChain().and(STORE.BRAND_ID.eq(brandId)).listAs(StoreListVo.class); + return R.ok(list); + } + + /** + * 新增数据导入 + * @author DB + * @since 2023/12/10 + * @param bo 请求参数 + * @return boolean + */ + @PostMapping("/insertDataImport") + @ApiOperation("新增数据导入") + public R insertDataImport(@RequestBody @Validated DataImportBo bo) { + dataImportService.insertDataImport(bo); + return R.ok(); + } + + /** + * 根据主键删除oam-数据导入表。 + * + * @param id 主键 + * @return {@code true} 删除成功,{@code false} 删除失败 + */ + @DeleteMapping("/removeById/{id}") + @ApiOperation("根据主键删除未导入数据记录") + public boolean removeById(@PathVariable @ApiParam("数据导入主键") String id) { + return dataImportService.removeById(id); + } + + /** + * 检查上传的文件 + * @author DB + * @since 2023/12/10 + * @param file 文件 + * @return R + */ + @ApiOperation("检查上传的文件") + @PostMapping("/checkImportData") + public R checkImportData(@RequestParam("file") MultipartFile file){ + SysFileVo sysFileVo = dataImportService.checkImportData(file); + return R.ok(sysFileVo); + } + + /** + * 立即导入 + * @author DB + * @since 2023/12/10 + * @return R + */ + @ApiOperation("立即导入") + @PutMapping("/importNow/{id}") + public R importNow(@PathVariable @ApiParam("数据导入主键") String id) { + dataImportService.importNow(id); + return R.ok(); + } + + /** + * 模板下载 + * @author DB + * @since 2023/12/10 + * @param response 响应 + */ + @ApiOperation("模板下载") + @GetMapping("/download") + public R download(HttpServletResponse response) throws IOException { + // 这里注意 有同学反应使用swagger 会导致各种问题,请直接用浏览器或者用postman + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setCharacterEncoding("utf-8"); + // 这里URLEncoder.encode可以防止中文乱码 当然和easyExcel没有关系 + String fileName = URLEncoder.encode("数据导入模板", "UTF-8").replaceAll("\\+", "%20"); + response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); + EasyExcel.write(response.getOutputStream(), DataImportDto.class).sheet("模板").doWrite(new ArrayList<>()); + return R.ok(); + } + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/DutyController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/DutyController.java index 686c957..829cbd7 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/DutyController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/DutyController.java @@ -55,7 +55,7 @@ public class DutyController { * @Author: DB * @Date: 2023/5/18 9:50 **/ - @PreAuthorize("@aps.hasPermission('dutyCalendar:duty:insert')") + @PreAuthorize("@aps.hasPermission('dutyCalendar:duty:management')") @ApiOperation("新增值班") @PostMapping("/insertDuty") public R insertDuty(@RequestBody @Validated DutyBo bo) { @@ -70,7 +70,7 @@ public class DutyController { * @param dutyDate 值班日期 * @return com.pupu.core.base.R */ - @PreAuthorize("@aps.hasPermission('dutyCalendar:duty:remove')") + @PreAuthorize("@aps.hasPermission('dutyCalendar:duty:management')") @ApiOperation("删除值班信息") @DeleteMapping("/removeDutyByDate/{dutyDate}") public R removeDutyByDate(@PathVariable String dutyDate) { diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/FinanceReimburseController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/FinanceReimburseController.java index 1fdb6e8..44ff512 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/FinanceReimburseController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/FinanceReimburseController.java @@ -93,7 +93,7 @@ public class FinanceReimburseController { * @Author: DB * @Date: 2023/5/30 15:44 **/ - @PreAuthorize("@aps.hasPermission('financial:reimburseAudit:list')") + @PreAuthorize("@aps.hasPermission('financial:audit:list')") @ApiOperation("财务报销模块-报销审核分页列表") @GetMapping("/getReimburseAuditPage") public R> getReimburseAuditPage(FinanceReimburseAuditPageBo bo) { @@ -107,7 +107,6 @@ public class FinanceReimburseController { * @Author: DB * @Date: 2023/5/10 16:01 **/ - @PreAuthorize("@aps.hasPermission('financial:reimburseAudit:update')") @ApiOperation("修改报销状态") @PutMapping("/updateReimburseStatus") public R updateReimburseStatus(@RequestBody @Validated ReimburseStatusBo bo) { @@ -122,7 +121,6 @@ public class FinanceReimburseController { * @param bo 请求参数 * @return com.pupu.core.base.R */ - @PreAuthorize("@aps.hasPermission('financial:reimburseAudit:insert')") @ApiOperation("新增报销类型") @PostMapping("/insertReimburseType") public R insertReimburseApplication(@RequestBody @Validated ReimburseTypeBo bo) { @@ -137,7 +135,6 @@ public class FinanceReimburseController { * @param bo 请求参数 * @return com.jambox.core.base.R */ - @PreAuthorize("@aps.hasPermission('financial:reimburseAudit:update')") @ApiOperation("修改报销类型") @PutMapping("/updateReimburseType") public R updateReimburseType(@RequestBody @Validated ReimburseTypeBo bo) { @@ -152,7 +149,6 @@ public class FinanceReimburseController { * @param id 主键 * @return com.jambox.core.base.R */ - @PreAuthorize("@aps.hasPermission('financial:reimburseAudit:remove')") @ApiOperation("删除报销类型") @DeleteMapping("/removeReimburseTypeById/{id}") public R removeReimburseTypeById(@PathVariable String id) { @@ -166,7 +162,6 @@ public class FinanceReimburseController { * @Author: DB * @Date: 2023/5/30 15:44 **/ - @PreAuthorize("@aps.hasPermission('financial:application:list')") @ApiOperation("财务报销模块-个人报销统计") @GetMapping("/getPersonStatistic") public R getPersonStatistic() { @@ -178,7 +173,6 @@ public class FinanceReimburseController { * @Author: DB * @Date: 2023/5/10 16:01 **/ - @PreAuthorize("@aps.hasPermission('financial:reimburseAudit:update')") @ApiOperation("审核员工申请报销") @PutMapping("/auditReimburseApplication/{id}") public R auditReimburseApplication(@PathVariable String id) { @@ -193,7 +187,6 @@ public class FinanceReimburseController { * @param bo 请求参数 * @return com.jambox.core.base.R */ - @PreAuthorize("@aps.hasPermission('financial:reimburseAudit:update')") @ApiOperation("报销驳回") @PutMapping("/reimburseReject") public R reimburseReject(@RequestBody @Validated ReimburseRejectBo bo) { @@ -212,7 +205,6 @@ public class FinanceReimburseController { * @param bo 请求参数 * @return com.jambox.core.base.R */ - @PreAuthorize("@aps.hasPermission('financial:reimburseAudit:update')") @ApiOperation("报销下款") @PutMapping("/reimbursePay") public R reimbursePay(@RequestBody @Validated ReimbursePayBo bo) { @@ -227,7 +219,6 @@ public class FinanceReimburseController { * @Author: DB * @Date: 2023/5/30 15:44 **/ - @PreAuthorize("@aps.hasPermission('financial:application:list')") @ApiOperation("财务报销模块-报销详情记录列表") @GetMapping("/getReimburseRecordList/{id}") public R> getReimburseRecordList(@PathVariable String id) { diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/OamMallController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/OamMallController.java index c92af6a..13315ed 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/OamMallController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/OamMallController.java @@ -5,7 +5,7 @@ import com.cpop.core.service.CoreService; import com.cpop.core.utils.SpringUtils; import com.cpop.oam.business.bo.MallStaffBo; import com.cpop.oam.business.service.OamMallService; -import com.cpop.oam.business.vo.BrandListVo; +import com.cpop.system.business.vo.BrandListVo; import com.cpop.oam.business.vo.MallStaffPageVo; import com.cpop.system.business.service.BrandService; import com.mybatisflex.core.paginate.Page; @@ -52,7 +52,7 @@ public class OamMallController { * @descriptions 查询品牌列表 * @author DB * @date 2023/11/10 11:45 - * @return: com.cpop.core.base.R> + * @return: com.cpop.core.base.R> */ @ApiOperation("查询品牌列表") @GetMapping("/getBrandList") @@ -84,7 +84,6 @@ public class OamMallController { * @param bo 请求参数 * @return com.jambox.core.base.R */ - @PreAuthorize("@aps.hasPermission('mall:admin:insert')") @ApiOperation("新增管理员") @PostMapping("/insertAdmin") public R insertAdmin(@RequestBody @Validated MallStaffBo bo) { @@ -99,7 +98,6 @@ public class OamMallController { * @param id 主键 * @return: com.cpop.core.base.R */ - @PreAuthorize("@aps.hasPermission('mall:admin:remove')") @ApiOperation("删除管理员") @DeleteMapping("/removeAdmin/{id}") public R removeAdmin(@PathVariable String id) { diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/StaffController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/StaffController.java index 30796be..d639fd4 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/StaffController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/StaffController.java @@ -198,4 +198,18 @@ public class StaffController { return R.ok(); } + /** + * 修改运维状态 + * @author DB + * @since 2023/12/07 + * @param bo 请求参数 + * @return R + */ + @ApiOperation("修改运维状态") + @PutMapping("/changeOperationStatus") + public R changeOperationStatus(@Validated @RequestBody OperationStatusBo bo) { + staffService.changeOperationStatus(bo); + return R.ok(); + } + } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/SysConfigController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/SysConfigController.java index 2d58f4b..50660c1 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/SysConfigController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/SysConfigController.java @@ -47,7 +47,6 @@ public class SysConfigController { * @Author: DB * @Date: 2023/5/11 15:48 **/ - @PreAuthorize("@aps.hasPermission('system:config:update')") @OperationLog(operationLogEnumType = OperationLogEnum.UPDATE_OAM_CONFIG) @ApiOperation("设置系统配置信息") @PutMapping("/setSysConfigInfo") diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/TaskDemandController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/TaskDemandController.java index bf0fbf7..460e28d 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/TaskDemandController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/TaskDemandController.java @@ -3,8 +3,10 @@ package com.cpop.oam.business.controller.backstage; import com.cpop.core.base.R; import com.cpop.oam.business.bo.TaskDemandBo; import com.cpop.oam.business.bo.TaskDemandPageBo; +import com.cpop.oam.business.bo.TaskDemandUrgentBo; import com.cpop.oam.business.service.TaskDemandService; -import com.cpop.oam.business.vo.BrandListVo; +import com.cpop.oam.business.vo.TaskDemandUrgentVo; +import com.cpop.system.business.vo.BrandListVo; import com.cpop.oam.business.vo.StoreListVo; import com.cpop.oam.business.vo.TaskDemandPageVo; import com.cpop.system.business.service.BrandService; @@ -63,7 +65,6 @@ public class TaskDemandController { * @param bo 请求参数 * @since 2023-11-30 17:27:24 */ - @PreAuthorize("@aps.hasPermission('oamTask:taskDemand:insert')") @ApiOperation("工单模块-需求-新增需求") @PostMapping("/insertDemandTask") public R insertDemandTask(@RequestBody @Validated @@ -78,7 +79,6 @@ public class TaskDemandController { * @param bo 请求参数 * @since 2023-11-30 18:26:42 */ - @PreAuthorize("@aps.hasPermission('oamTask:taskDemand:update')") @ApiOperation("工单模块-需求-修改需求") @PutMapping("/updateDemandTask") public R updateDemandTask(@RequestBody @Validated @@ -93,7 +93,6 @@ public class TaskDemandController { * @param demandId 需求id * @since 2023-11-30 20:30:54 */ - @PreAuthorize("@aps.hasPermission('oamTask:taskDemand:remove')") @ApiOperation("工单模块-需求-删除需求") @DeleteMapping("/removeDemandTask/{demandId}") public R removeDemandTask(@PathVariable @ApiParam(value = "需求id") @@ -131,4 +130,18 @@ public class TaskDemandController { return R.ok(list); } + /** + * 工单模块-需求-需求加急 + * @author DB + * @since 2023/12/08 + * @param bo 请求参数 + * @return R + */ + @ApiOperation("工单模块-需求-需求加急") + @PutMapping("/demandUrgent") + public R demandUrgent(@RequestBody @Validated TaskDemandUrgentBo bo) { + TaskDemandUrgentVo vo = taskDemandService.demandUrgent(bo); + return R.ok(vo); + } + } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/TaskTechnologyController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/TaskTechnologyController.java index f714a7a..b968425 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/TaskTechnologyController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/TaskTechnologyController.java @@ -48,7 +48,7 @@ public class TaskTechnologyController { * @author DB * @since 2023-11-30 19:41:32 */ - //@PreAuthorize("@aps.hasPermission('oamTask:taskTechnology:list')") + @PreAuthorize("@aps.hasPermission('oamTask:technology:list')") @ApiOperation("技术模块-今日事务-获取个人工单列表") @GetMapping("/getPersonWorkOrder") public R> getPersonWorkOrder() { @@ -63,7 +63,6 @@ public class TaskTechnologyController { * @author DB * @since 2023-11-29 11:25:28 */ - //@PreAuthorize("@aps.hasPermission('oamTask:workOrder:record')") @ApiOperation("技术模块-今日事务-工单记录列表") @GetMapping("/getWorkOrderRecordList/{workOrderId}") public R> getWorkOrderRecordList(@PathVariable @ApiParam("工单id") @@ -79,7 +78,6 @@ public class TaskTechnologyController { * @author DB * @since 2023-11-29 11:33:35 */ - //@PreAuthorize("@aps.hasPermission('oamTask:workOrder:record')") @ApiOperation("技术模块-今日事务-新增工单记录") @PostMapping("/insertWorkOrderRecord") public R insertWorkOrderRecord(@RequestBody @Validated @@ -96,7 +94,7 @@ public class TaskTechnologyController { * @author DB * @since 2023-11-30 21:11:47 */ - //@PreAuthorize("@aps.hasPermission('oamTask:taskArchiving:list')") + @PreAuthorize("@aps.hasPermission('oamTask:technology:list')") @ApiOperation("技术模块-任务归档-获取任务归档分页") @GetMapping("/getTaskArchivingPage") public R> getTaskArchivingPage(TaskArchivingPagBo bo) { @@ -111,7 +109,7 @@ public class TaskTechnologyController { * @author DB * @since 2023-11-30 21:49:05 */ - //@PreAuthorize("@aps.hasPermission('oamTask:taskArchiving:update')") + @PreAuthorize("@aps.hasPermission('oamTask:technology:deploy')") @ApiOperation("技术模块-任务归档-设置任务归档") @PutMapping("/setTaskArchiving/{taskId}") public R setTaskArchiving(@PathVariable @ApiParam("任务id") @@ -129,7 +127,7 @@ public class TaskTechnologyController { * @author DB * @since 2023-11-30 22:21:58 */ - //@PreAuthorize("@aps.hasPermission('oamTask:task:list')") + @PreAuthorize("@aps.hasPermission('oamTask:technology:list')") @ApiOperation("技术模块-任务领取-获取领取任务分页") @GetMapping("/getToBeClaimedPage") public R> getToBeClaimedPage(@ApiParam(value = "主体") @@ -179,11 +177,10 @@ public class TaskTechnologyController { * @author DB * @since 2023-12-01 10:35:31 */ - //@PreAuthorize("@aps.hasPermission('oamTask:taskAudit:update')") + @PreAuthorize("@aps.hasPermission('oamTask:technology:audit')") @ApiOperation("技术模块-任务领取-任务审核") @PutMapping("/setTaskAuditComments") - public R setTaskAuditComments(@RequestBody @Validated - TaskAuditCommentsBo bo) { + public R setTaskAuditComments(@RequestBody @Validated TaskAuditCommentsBo bo) { taskService.setTaskAuditComments(bo); return R.ok(); } @@ -195,7 +192,7 @@ public class TaskTechnologyController { * @author DB * @since 2023/12/04 */ - //@PreAuthorize("@aps.hasPermission('oamTask:task:list')") + @PreAuthorize("@aps.hasPermission('oamTask:technology:list')") @ApiOperation("技术模块-今日事务-个人任务分页列表") @GetMapping("/getPersonTaskPage") public R> getPersonTaskPage() { @@ -298,25 +295,27 @@ public class TaskTechnologyController { /** * 技术模块-今日事务-更新任务进度 - * @author DB - * @since 2023/12/04 + * * @param bo 请求参数 * @return R + * @author DB + * @since 2023/12/04 */ @ApiOperation("技术模块-今日事务-更新任务进度") @PutMapping("/updateTaskProgress") public R updateTaskProgress(@RequestBody @Validated - TaskProgressBo bo) { + TaskProgressBo bo) { taskService.updateTaskProgress(bo); return R.ok(); } /** * "技术模块-今日事务-转交任务 - * @author DB - * @since 2023/12/04 + * * @param bo 请求参数 * @return R + * @author DB + * @since 2023/12/04 */ @ApiOperation("技术模块-今日事务-转交任务") @PutMapping("/updateTaskItem") @@ -328,11 +327,13 @@ public class TaskTechnologyController { /** * 技术模块-数据统计-获取月度任务统计列表 - * @author DB - * @since 2023/12/04 + * * @param bo 请求参数 * @return R + * @author DB + * @since 2023/12/04 */ + @PreAuthorize("@aps.hasPermission('oamTask:technology:list')") @ApiOperation("技术模块-数据统计-获取月度任务统计列表") @GetMapping("/getTaskMonthStatistics") public R getTaskMonthStatistics(TaskMonthStatisticsBo bo) { @@ -341,9 +342,10 @@ public class TaskTechnologyController { /** * 技术模块-数据统计-获取任务日报 + * + * @return R * @author DB * @since 2023/12/05 - * @return R */ @ApiOperation("技术模块-数据统计-获取任务日报") @GetMapping("/getTaskDailyPaper") @@ -354,10 +356,12 @@ public class TaskTechnologyController { /** * 技术模块-今日事务-个人绩点 + * + * @return R * @author DB * @since 2023/12/05 - * @return R */ + @PreAuthorize("@aps.hasPermission('oamTask:technology:list')") @ApiOperation("技术模块-今日事务-个人绩点") @GetMapping("/getIndividualGpa") public R getIndividualGpa() { diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/TaskWorkOrderController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/TaskWorkOrderController.java index 7474663..703f6e0 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/TaskWorkOrderController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/TaskWorkOrderController.java @@ -65,7 +65,6 @@ public class TaskWorkOrderController { * @author DB * @since 2023-11-29 14:01:03 */ - @PreAuthorize("@aps.hasPermission('oamTask:workOrder:list')") @ApiOperation("工单模块-工单提交-获取当天值班人员") @GetMapping("/getWorkOrderDutyStaff") public R getWorkOrderDutyStaff() { @@ -78,7 +77,6 @@ public class TaskWorkOrderController { * @author DB * @since 2023-11-29 14:35:08 */ - @PreAuthorize("@aps.hasPermission('oamTask:workOrder:list')") @ApiOperation("工单模块-工单提交-已办结分页列表") @GetMapping("/finishWorkOrderPage") public R> finishWorkOrderPage() { @@ -93,7 +91,6 @@ public class TaskWorkOrderController { * @author DB * @since 2023/5/30 16:53 **/ - @PreAuthorize("@aps.hasPermission('oamTask:workOrder:insert')") @ApiOperation("工单模块-工单提交-新增工单") @PostMapping("/insertWorkOrder") public R insertWorkOrder(@RequestBody @Validated @@ -108,7 +105,6 @@ public class TaskWorkOrderController { * @param workOrderId 工单id * @since 2023-11-29 11:25:28 */ - @PreAuthorize("@aps.hasPermission('oamTask:workOrder:record')") @ApiOperation("工单模块-工单提交-工单记录列表") @GetMapping("/getWorkOrderRecordList/{workOrderId}") public R> getWorkOrderRecordList(@PathVariable @ApiParam("工单id") @@ -123,7 +119,6 @@ public class TaskWorkOrderController { * @param bo 请求参数 * @since 2023-11-29 11:33:35 */ - @PreAuthorize("@aps.hasPermission('oamTask:workOrder:record')") @ApiOperation("工单模块-工单提交-新增工单记录") @PostMapping("/insertWorkOrderRecord") public R insertWorkOrderRecord(@RequestBody @Validated @@ -138,7 +133,6 @@ public class TaskWorkOrderController { * @param workOrderId 工单id * @since 2023-11-29 11:41:46 */ - @PreAuthorize("@aps.hasPermission('oamTask:workOrder:record')") @ApiOperation("工单模块-工单提交-工单提醒") @PutMapping("/workOrderRemind/{workOrderId}") public R workOrderRemind(@PathVariable @ApiParam("工单id") @@ -153,8 +147,6 @@ public class TaskWorkOrderController { * @param workOrderId 工单id * @since 2023-11-29 12:30:21 */ - @Deprecated - @PreAuthorize("@aps.hasPermission('oamTask:workOrder:update')") @ApiOperation("工单模块-工单提交-工单转需求") @PutMapping("/workOrderToDemand/{workOrderId}") public R workOrderToDemand(@PathVariable @ApiParam("工单id") @@ -169,7 +161,6 @@ public class TaskWorkOrderController { * @param bo 请求参数 * @since 2023-11-29 16:00:18 */ - @PreAuthorize("@aps.hasPermission('oamTask:workOrder:update')") @ApiOperation("工单模块-工单提交-工单暂停") @PutMapping("/pauseWorkOrder") public R pauseWorkOrder(@RequestBody @Validated @@ -184,7 +175,6 @@ public class TaskWorkOrderController { * @param workOrderId 工单id * @since 2023-11-29 15:44:08 */ - @PreAuthorize("@aps.hasPermission('oamTask:workOrder:update')") @ApiOperation("工单模块-工单提交-工单办结") @PutMapping("/workOrderFinish/{workOrderId}") public R workOrderFinish(@PathVariable("workOrderId") @ApiParam("工单id") diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/TechnologyToolController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/TechnologyToolController.java new file mode 100644 index 0000000..5cea5ea --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/TechnologyToolController.java @@ -0,0 +1,102 @@ +package com.cpop.oam.business.controller.backstage; + +import com.cpop.common.utils.bean.BeanUtils; +import com.cpop.core.base.R; +import com.cpop.core.base.entity.PageDomain; +import com.cpop.core.utils.SpringUtils; +import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.oam.business.bo.TechnologyToolBo; +import com.cpop.oam.business.vo.TechnologyToolPageVo; +import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.query.QueryWrapper; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import org.springframework.beans.factory.annotation.Autowired; +import com.cpop.oam.business.entity.TechnologyTool; +import com.cpop.oam.business.service.TechnologyToolService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import io.swagger.annotations.ApiParam; +import java.io.Serializable; +import java.util.List; + +import static com.cpop.core.base.table.table.SysUserTableDef.SYS_USER; +import static com.cpop.oam.business.entity.table.StaffTableDef.STAFF; +import static com.cpop.oam.business.entity.table.TechnologyToolTableDef.TECHNOLOGY_TOOL; + +/** + * oam-技术工具表 控制层。 + * + * @author DB + * @since 2023-12-10 + */ +@RestController +@Api(tags = "技术工具管理") +@RequestMapping("/technologyTool") +public class TechnologyToolController { + + @Autowired + private TechnologyToolService technologyToolService; + + /** + * 技术工具分页查询 + * @author DB + * @since 2023/12/10 + * @return Page + */ + @GetMapping("/getTechnologyToolPage") + @ApiOperation("技术工具分页查询") + public R> getTechnologyToolPage(@RequestParam("toolType") @ApiParam(value = "工具类型", required = true) String toolType) { + PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); + Page page = technologyToolService.pageAs(Page.of(pageDomain.getPageNum(), pageDomain.getPageSize()), + QueryWrapper.create().select(TECHNOLOGY_TOOL.ALL_COLUMNS) + .select(STAFF.NAME.as(TechnologyToolPageVo::getCreateUser)) + .leftJoin(SYS_USER).on(SYS_USER.ID.eq(TECHNOLOGY_TOOL.CREATE_USER_ID)) + .leftJoin(STAFF).on(STAFF.USER_ID.eq(SYS_USER.ID)) + .where(TECHNOLOGY_TOOL.TOOL_TYPE.eq(toolType)), + TechnologyToolPageVo.class); + return R.ok(page); + } + + /** + * 保存技术工具 + * @author DB + * @since 2023/12/10 + * @param bo 请求参数 + * @return R + */ + @PostMapping("/insertTool") + @ApiOperation("保存技术工具") + public R insertTool(@RequestBody @Validated TechnologyToolBo bo) { + technologyToolService.save(BeanUtils.mapToClass(bo, TechnologyTool.class)); + return R.ok(); + } + + /** + * 根据主键更新技术工具 + * @author DB + * @since 2023/12/10 + * @param bo 请求参数 + * @return R + */ + @PutMapping("/updateTool") + @ApiOperation("根据主键更新技术工具") + public R update(@RequestBody @Validated TechnologyToolBo bo) { + technologyToolService.updateById(BeanUtils.mapToClass(bo, TechnologyTool.class)); + return R.ok(); + } + + /** + * 根据主键删除oam-技术工具表。 + * + * @param id 主键 + * @return {@code true} 删除成功,{@code false} 删除失败 + */ + @DeleteMapping("/removeById/{id}") + @ApiOperation("根据主键删除技术工具") + public R remove(@PathVariable @ApiParam("技术工具表主键") String id) { + technologyToolService.removeById(id); + return R.ok(); + } + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/WxPayController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/WxPayController.java index 8f9fc4c..6ef980c 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/WxPayController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/WxPayController.java @@ -14,7 +14,6 @@ import com.github.binarywang.wxpay.exception.WxPayException; import com.github.binarywang.wxpay.service.WxPayService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/dto/DataImportDto.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/dto/DataImportDto.java new file mode 100644 index 0000000..cc5b32a --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/dto/DataImportDto.java @@ -0,0 +1,116 @@ +package com.cpop.oam.business.dto; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Data; +import org.springframework.format.annotation.DateTimeFormat; + +import java.time.LocalDate; + +/** + * 数据导入Dto + * @author DB + * @version 1.0.0 + * @since 2023-12-10 12:47 + */ +@Data +public class DataImportDto { + + /** + * 姓名 + */ + @ExcelProperty("姓名") + private String name; + + /** + * 电话 + */ + @ExcelProperty("电话") + private String phone; + + /** + * 课卡类型 + */ + @ExcelProperty("课卡类型") + private String cardType; + + /** + * 计费类型 + */ + @ExcelProperty("计费类型") + private String billingType; + + /** + * 首充课时 + */ + @ExcelProperty("首充课时") + private Integer firstChargePeriod; + + /** + * 剩余课时 + */ + @ExcelProperty("剩余课时") + private Integer remainingClassHours; + + /** + * 消费金额 + */ + @ExcelProperty("消费金额") + private Integer amountSpent; + + /** + * 办卡日期 + */ + @DateTimeFormat(pattern = "yyyy/MM/dd") + @ExcelProperty("办卡日期") + private LocalDate createCardDate; + + /** + * 有效期至 + */ + @DateTimeFormat(pattern = "yyyy/MM/dd") + @ExcelProperty("有效期至") + private LocalDate expiryDate; + + /** + * 课程顾问 + */ + @ExcelProperty("课程顾问") + private String courseConsultant; + + /** + * 性别 + */ + @ExcelProperty("性别") + private String sex; + + /** + * 课卡名称 + */ + @ExcelProperty("课卡名称") + private String cardName; + + /** + * 课卡状态 + */ + @ExcelProperty("课卡状态") + private String cardStatus; + + /** + * 备注 + */ + @ExcelProperty("备注") + private String remark; + + /** + * 停卡时剩余天数 + */ + @ExcelProperty("停卡时剩余天数") + private Integer stopCardRemainingDays; + + /** + * 停卡缓冲天数 + */ + @ExcelProperty("停卡缓冲天数") + private Integer stopCardBufferDays; + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/dto/DataImportParamsDto.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/dto/DataImportParamsDto.java new file mode 100644 index 0000000..20a7b55 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/dto/DataImportParamsDto.java @@ -0,0 +1,30 @@ +package com.cpop.oam.business.dto; + +import lombok.Data; +import lombok.experimental.Accessors; +import org.checkerframework.checker.units.qual.C; + +/** + * @author DB + * @version 1.0.0 + * @since 2023-12-10 17:03 + */ +@Data +@Accessors(chain = true) +public class DataImportParamsDto { + + /** + * 文件地址 + */ + private String fileUrl; + + /** + * 云校区id + */ + private String storeId; + + /** + * 是否清空 + */ + private String emptyTag; +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/BrandManager.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/BrandManager.java new file mode 100644 index 0000000..829d9f4 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/BrandManager.java @@ -0,0 +1,58 @@ +package com.cpop.oam.business.entity; + +import com.cpop.core.base.entity.BaseEntity; +import com.cpop.core.base.entity.BaseInsertListener; +import com.cpop.core.base.entity.BaseUpdateListener; +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.Table; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + * 品牌管理员表 实体类。 + * + * @author DB + * @since 2023-12-07 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@Table(value = "cp_oam_brand_manager", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) +public class BrandManager extends BaseEntity implements Serializable { + + /** + * 主键 + */ + @Id + private String id; + + /** + * 手机号 + */ + private String phone; + + /** + * 姓名 + */ + private String name; + + /** + * 云id + */ + private String brandManagerCloudId; + + /** + * 是否删除(0否1是) + */ + @Column(isLogicDelete = true) + private Boolean isDelete; + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/BrandManagerStore.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/BrandManagerStore.java new file mode 100644 index 0000000..51271c5 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/BrandManagerStore.java @@ -0,0 +1,52 @@ +package com.cpop.oam.business.entity; + +import com.cpop.core.base.entity.BaseEntity; +import com.cpop.core.base.entity.BaseInsertListener; +import com.cpop.core.base.entity.BaseUpdateListener; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.Table; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + * 品牌管理员-品牌-校区表 实体类。 + * + * @author DB + * @since 2023-12-07 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@Table(value = "cp_oam_brand_manager_store", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) +public class BrandManagerStore extends BaseEntity implements Serializable { + + /** + * 品管id + */ + @Id + private String brandManagerId; + + /** + * 品牌id + */ + @Id + private String brandId; + + /** + * 店铺/校区id + */ + @Id + private String storeId; + + + + + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/DataImport.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/DataImport.java new file mode 100644 index 0000000..649596d --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/DataImport.java @@ -0,0 +1,73 @@ +package com.cpop.oam.business.entity; + +import com.cpop.core.base.entity.BaseEntity; +import com.cpop.core.base.entity.BaseInsertListener; +import com.cpop.core.base.entity.BaseUpdateListener; +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.Table; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + * oam-数据导入表 实体类。 + * + * @author DB + * @since 2023-12-10 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@Table(value = "cp_oam_data_import", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) +public class DataImport extends BaseEntity implements Serializable { + + /** + * 主键 + */ + @Id + private String id; + + /** + * 品牌id + */ + private String brandId; + + /** + * 校区id + */ + private String storeId; + + /** + * 导入文件地址 + */ + private String fileUrl; + + /** + * 是否清空 + */ + private Boolean isClear; + + /** + * 来源类型 + */ + private String sourceType; + + /** + * 导入状态 + */ + private Boolean importStatus; + + /** + * 是否删除(0否1是) + */ + @Column(isLogicDelete = true) + private Boolean isDelete; + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/Staff.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/Staff.java index cc434f8..e0d4aec 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/Staff.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/Staff.java @@ -52,6 +52,11 @@ public class Staff extends BaseEntity implements Serializable { */ private String roleId; + /** + * 是否是运维账号 + */ + private Boolean isOperation; + /** * 企微用户id */ diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/Task.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/Task.java index 5fe3304..3b4c717 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/Task.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/Task.java @@ -92,7 +92,7 @@ public class Task extends BaseEntity implements Serializable { /** * 是否加急 */ - private Integer isUrgent; + private Boolean isUrgent; /** * 预期完成日期 diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/TaskDemand.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/TaskDemand.java index 34adf68..a9c1c3f 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/TaskDemand.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/TaskDemand.java @@ -56,7 +56,7 @@ public class TaskDemand extends BaseEntity implements Serializable { /** * 签约二维码 */ - private String signUrl; + private String payQrCode; /** * 预付款 diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/TechnologyTool.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/TechnologyTool.java new file mode 100644 index 0000000..3cd1de6 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/entity/TechnologyTool.java @@ -0,0 +1,67 @@ +package com.cpop.oam.business.entity; + +import com.cpop.core.base.entity.BaseEntity; +import com.cpop.core.base.entity.BaseInsertListener; +import com.cpop.core.base.entity.BaseUpdateListener; +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.Table; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + * oam-技术工具表 实体类。 + * + * @author DB + * @since 2023-12-10 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@Table(value = "cp_oam_technology_tool", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) +public class TechnologyTool extends BaseEntity implements Serializable { + + /** + * 主键 + */ + @Id + private String id; + + /** + * 工具名 + */ + private String toolName; + + /** + * 工具地址 + */ + private String toolUrl; + + /** + * 工具介绍 + */ + private String toolDesc; + + /** + * 工具类型(字典) + */ + private String toolType; + + + + + + /** + * 是否删除(0否1是) + */ + @Column(isLogicDelete = true) + private Boolean isDelete; + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/BrandManagerMapper.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/BrandManagerMapper.java new file mode 100644 index 0000000..910a4af --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/BrandManagerMapper.java @@ -0,0 +1,14 @@ +package com.cpop.oam.business.mapper; + +import com.cpop.oam.business.entity.BrandManager; +import com.mybatisflex.core.BaseMapper; + +/** + * 品牌管理员表 映射层。 + * + * @author DB + * @since 2023-12-07 + */ +public interface BrandManagerMapper extends BaseMapper { + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/BrandManagerStoreMapper.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/BrandManagerStoreMapper.java new file mode 100644 index 0000000..0987ddc --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/BrandManagerStoreMapper.java @@ -0,0 +1,14 @@ +package com.cpop.oam.business.mapper; + +import com.cpop.oam.business.entity.BrandManagerStore; +import com.mybatisflex.core.BaseMapper; + +/** + * 品牌管理员-品牌-校区表 映射层。 + * + * @author DB + * @since 2023-12-07 + */ +public interface BrandManagerStoreMapper extends BaseMapper { + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/DataImportMapper.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/DataImportMapper.java new file mode 100644 index 0000000..c3f761f --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/DataImportMapper.java @@ -0,0 +1,14 @@ +package com.cpop.oam.business.mapper; + +import com.mybatisflex.core.BaseMapper; +import com.cpop.oam.business.entity.DataImport; + +/** + * oam-数据导入表 映射层。 + * + * @author DB + * @since 2023-12-10 + */ +public interface DataImportMapper extends BaseMapper { + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/TechnologyToolMapper.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/TechnologyToolMapper.java new file mode 100644 index 0000000..5496284 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/mapper/TechnologyToolMapper.java @@ -0,0 +1,14 @@ +package com.cpop.oam.business.mapper; + +import com.mybatisflex.core.BaseMapper; +import com.cpop.oam.business.entity.TechnologyTool; + +/** + * oam-技术工具表 映射层。 + * + * @author DB + * @since 2023-12-10 + */ +public interface TechnologyToolMapper extends BaseMapper { + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/BrandManagerService.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/BrandManagerService.java new file mode 100644 index 0000000..11a0098 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/BrandManagerService.java @@ -0,0 +1,43 @@ +package com.cpop.oam.business.service; + +import com.cpop.oam.business.bo.BrandManagerBo; +import com.cpop.oam.business.bo.BrandManagerPageBo; +import com.cpop.oam.business.entity.BrandManager; +import com.cpop.oam.business.vo.BrandManagePageVo; +import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.service.IService; + +/** + * 品牌管理员表 服务层。 + * + * @author DB + * @since 2023-12-07 + */ +public interface BrandManagerService extends IService { + + /** + * 查询品牌管理员分页 + * @author DB + * @since 2023/12/07 + * @param bo 请求参数 + * @return Page + */ + Page getBrandManagerPage(BrandManagerPageBo bo); + + /** + * 删除品牌管理员 + * @author DB + * @since 2023/12/07 + * @param id 主键 + */ + void removeBrandManagerById(String id); + + /** + * 新增品牌管理员 + * @author DB + * @since 2023/12/08 + * @param bo 请求参数 + */ + void insertBrandManager(BrandManagerBo bo); + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/BrandManagerStoreService.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/BrandManagerStoreService.java new file mode 100644 index 0000000..7044817 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/BrandManagerStoreService.java @@ -0,0 +1,14 @@ +package com.cpop.oam.business.service; + +import com.cpop.oam.business.entity.BrandManagerStore; +import com.mybatisflex.core.service.IService; + +/** + * 品牌管理员-品牌-校区表 服务层。 + * + * @author DB + * @since 2023-12-07 + */ +public interface BrandManagerStoreService extends IService { + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/DataImportService.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/DataImportService.java new file mode 100644 index 0000000..87d11d4 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/DataImportService.java @@ -0,0 +1,61 @@ +package com.cpop.oam.business.service; + +import com.cpop.oam.business.bo.DataImportBo; +import com.cpop.oam.business.bo.DataImportPageBo; +import com.cpop.oam.business.vo.DataImportPageVo; +import com.cpop.system.business.vo.SysFileVo; +import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.service.IService; +import com.cpop.oam.business.entity.DataImport; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; + +/** + * oam-数据导入表 服务层。 + * + * @author DB + * @since 2023-12-10 + */ +public interface DataImportService extends IService { + + /** + * 数据导入分页查询 + * @author DB + * @since 2023/12/10 + * @param bo 请求参数 + * @return R> + */ + Page getDataImportPage(DataImportPageBo bo); + + /** + * 新增数据导入 + * @author DB + * @since 2023/12/10 + * @param bo 请求参数 + */ + void insertDataImport(DataImportBo bo); + + /** + * 立即导入 + * @author DB + * @since 2023/12/10 + */ + void importNow(String id); + + /** + * 导入 + * @author DB + * @since 2023/12/10 + * @param dataImport 导入详情 + */ + void importNow(DataImport dataImport); + + /** + * 检查上传的文件 + * @author DB + * @since 2023/12/10 + * @param file 文件 + */ + SysFileVo checkImportData(MultipartFile file); +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/StaffService.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/StaffService.java index 34c4de9..37b05e0 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/StaffService.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/StaffService.java @@ -1,12 +1,9 @@ package com.cpop.oam.business.service; import com.cpop.core.base.table.SysUser; +import com.cpop.oam.business.bo.*; import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.service.IService; -import com.cpop.oam.business.bo.ModifyUserPasswordBo; -import com.cpop.oam.business.bo.StaffBo; -import com.cpop.oam.business.bo.StaffPageBo; -import com.cpop.oam.business.bo.SysUserLogBo; import com.cpop.oam.business.entity.Staff; import com.cpop.oam.business.vo.StaffInfoVo; import com.cpop.oam.business.vo.StaffPageVo; @@ -112,4 +109,11 @@ public interface StaffService extends IService { */ List getTechnologyStaffList(); + /** + * 修改运维状态 + * @author DB + * @since 2023/12/07 + * @param bo 请求参数 + */ + void changeOperationStatus(OperationStatusBo bo); } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/TaskDemandService.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/TaskDemandService.java index db10748..c3b58ed 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/TaskDemandService.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/TaskDemandService.java @@ -1,5 +1,7 @@ package com.cpop.oam.business.service; +import com.cpop.oam.business.bo.TaskDemandUrgentBo; +import com.cpop.oam.business.vo.TaskDemandUrgentVo; import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.service.IService; import com.cpop.oam.business.bo.TaskDemandBo; @@ -46,4 +48,12 @@ public interface TaskDemandService extends IService { * @since 2023-11-30 20:30:54 */ void removeDemandTask(String demandId); + + /** + * 工单模块-需求-需求加急 + * @author DB + * @since 2023/12/08 + * @param bo 请求参数 + */ + TaskDemandUrgentVo demandUrgent(TaskDemandUrgentBo bo); } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/TechnologyToolService.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/TechnologyToolService.java new file mode 100644 index 0000000..6eb4f5d --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/TechnologyToolService.java @@ -0,0 +1,14 @@ +package com.cpop.oam.business.service; + +import com.mybatisflex.core.service.IService; +import com.cpop.oam.business.entity.TechnologyTool; + +/** + * oam-技术工具表 服务层。 + * + * @author DB + * @since 2023-12-10 + */ +public interface TechnologyToolService extends IService { + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BrandManageStoreServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BrandManageStoreServiceImpl.java new file mode 100644 index 0000000..477fff0 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BrandManageStoreServiceImpl.java @@ -0,0 +1,18 @@ +package com.cpop.oam.business.service.impl; + +import com.cpop.oam.business.entity.BrandManagerStore; +import com.cpop.oam.business.mapper.BrandManagerStoreMapper; +import com.cpop.oam.business.service.BrandManagerStoreService; +import com.mybatisflex.spring.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + * 品牌管理员-品牌-校区表 服务层实现。 + * + * @author DB + * @since 2023-12-07 + */ +@Service("brandManageStoreService") +public class BrandManageStoreServiceImpl extends ServiceImpl implements BrandManagerStoreService { + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BrandManagerServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BrandManagerServiceImpl.java new file mode 100644 index 0000000..f57d726 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BrandManagerServiceImpl.java @@ -0,0 +1,154 @@ +package com.cpop.oam.business.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.cpop.common.utils.bean.BeanUtils; +import com.cpop.common.utils.http.HttpUtils; +import com.cpop.core.base.entity.PageDomain; +import com.cpop.core.base.exception.ServiceException; +import com.cpop.core.utils.SpringUtils; +import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.jambox.business.entity.BrandExtend; +import com.cpop.jambox.business.entity.StoreExtend; +import com.cpop.jambox.business.entity.table.BrandExtendTableDef; +import com.cpop.jambox.business.entity.table.StoreExtendTableDef; +import com.cpop.jambox.business.service.BrandExtendService; +import com.cpop.jambox.business.service.StoreExtendService; +import com.cpop.jambox.framework.constant.JamboxCloudUrl; +import com.cpop.oam.business.bo.BrandManagerBo; +import com.cpop.oam.business.bo.BrandManagerPageBo; +import com.cpop.oam.business.entity.BrandManagerStore; +import com.cpop.oam.business.entity.BrandManager; +import com.cpop.oam.business.mapper.BrandManagerMapper; +import com.cpop.oam.business.service.BrandManagerStoreService; +import com.cpop.oam.business.service.BrandManagerService; +import com.cpop.oam.business.vo.BrandManagePageVo; +import com.cpop.system.business.entity.table.BrandTableDef; +import com.cpop.system.business.entity.table.StoreTableDef; +import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.query.QueryWrapper; +import com.mybatisflex.spring.service.impl.ServiceImpl; +import lombok.extern.slf4j.Slf4j; +import okhttp3.Response; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.client.RestTemplate; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import static com.cpop.oam.business.entity.table.BrandManagerStoreTableDef.BRAND_MANAGER_STORE; +import static com.cpop.oam.business.entity.table.BrandManagerTableDef.BRAND_MANAGER; +import static com.cpop.system.business.entity.table.BrandTableDef.BRAND; +import static com.cpop.system.business.entity.table.StoreTableDef.STORE; +import static com.mybatisflex.core.query.QueryMethods.distinct; +import static com.mybatisflex.core.query.QueryMethods.groupConcat; + +/** + * 品牌管理员表 服务层实现。 + * + * @author DB + * @since 2023-12-07 + */ +@Slf4j +@Service("brandManageService") +public class BrandManagerServiceImpl extends ServiceImpl implements BrandManagerService { + + /** + * 查询品牌管理员分页 + * @author DB + * @since 2023/12/07 + * @param bo 请求参数 + * @return Page + */ + @Override + public Page getBrandManagerPage(BrandManagerPageBo bo) { + PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); + return this.pageAs(Page.of(pageDomain.getPageNum(),pageDomain.getPageSize()), + QueryWrapper.create() + //品管 + .select(distinct(BRAND_MANAGER.ID, BRAND_MANAGER.NAME, BRAND_MANAGER.PHONE, BRAND_MANAGER.CREATE_TIME)) + //品牌 + .select(BRAND.BRAND_NAME) + //校区 + .select(groupConcat(STORE.STORE_NAME).as(BrandManagePageVo::getStoreName)) + //中间表 + .leftJoin(BRAND_MANAGER_STORE).on(BRAND_MANAGER_STORE.BRAND_MANAGER_ID.eq(BRAND_MANAGER.ID)) + //品牌 + .leftJoin(BRAND).on(BRAND.ID.eq(BRAND_MANAGER_STORE.BRAND_ID)) + //校区 + .leftJoin(STORE).on(STORE.ID.eq(BRAND_MANAGER_STORE.STORE_ID)) + .and(BRAND_MANAGER.PHONE.like(bo.getPhoneNumber())) + .and(BRAND_MANAGER.NAME.like(bo.getName())) + .and(BRAND.BRAND_NAME.like(bo.getBrandName())) + .groupBy(BRAND_MANAGER.ID), + BrandManagePageVo.class); + } + + /** + * 删除品牌管理员 + * @author DB + * @since 2023/12/07 + * @param id 主键 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void removeBrandManagerById(String id) { + BrandManager brandManage = this.getById(id); + JSONObject jsonBody = new JSONObject(); + jsonBody.put("_type","brandManagerDel"); + jsonBody.put("brandManagerId", brandManage.getBrandManagerCloudId()); + SpringUtils.getBean(RestTemplate.class).postForObject(JamboxCloudUrl.COMMON_CARD_URL, jsonBody, JSONObject.class); + this.removeById(id); + //删除中间表 + SpringUtils.getBean(BrandManagerStoreService.class).updateChain().where(BRAND_MANAGER_STORE.BRAND_MANAGER_ID.eq(id)).remove(); + } + + /** + * 新增品牌管理员 + * @author DB + * @since 2023/12/08 + * @param bo 请求参数 + */ + @Override + @Transactional(rollbackFor = Exception.class) + public void insertBrandManager(BrandManagerBo bo) { + //获取云品牌id + BrandExtend brandExtend = SpringUtils.getBean(BrandExtendService.class).queryChain().where(BrandExtendTableDef.BRAND_EXTEND.BRAND_ID.eq(bo.getBrandId())).one(); + //获取用户信息 + JSONObject jsonBody = new JSONObject(); + jsonBody.put("_type", "brandManagerAdd"); + jsonBody.put("brandId", brandExtend.getBrandCloudId()); + jsonBody.put("name", bo.getName()); + jsonBody.put("phone", bo.getPhone()); + jsonBody.put("position", "OAM添加"); + if (bo.getStoreIds() != null) { + //获取云校区id + List cloudStoreIds = SpringUtils.getBean(StoreExtendService.class).queryChain().where(StoreExtendTableDef.STORE_EXTEND.STORE_ID.in(bo.getStoreIds())).list() + .stream().map(StoreExtend::getStoreCloudId).collect(Collectors.toList()); + jsonBody.put("store", cloudStoreIds); + } + //本地新增 + BrandManager brandManage = BeanUtils.mapToClass(bo, BrandManager.class); + JSONObject result = SpringUtils.getBean(RestTemplate.class).postForObject(JamboxCloudUrl.COMMON_CARD_URL, jsonBody, JSONObject.class); + assert result != null; + brandManage.setBrandManagerCloudId(result.getString("data")); + this.save(brandManage); + List brandManagerStores = new ArrayList<>(); + //添加中间表 + if (bo.getStoreIds() != null) { + bo.getStoreIds().forEach(item -> { + BrandManagerStore brandManageStore = new BrandManagerStore(); + brandManageStore.setStoreId(item).setBrandId(bo.getBrandId()).setBrandManagerId(brandManage.getId()); + brandManagerStores.add(brandManageStore); + }); + } else { + BrandManagerStore brandManageStore = new BrandManagerStore(); + brandManageStore.setBrandId(bo.getBrandId()).setBrandManagerId(brandManage.getId()); + brandManagerStores.add(brandManageStore); + } + SpringUtils.getBean(BrandManagerStoreService.class).saveBatch(brandManagerStores); + } +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/DataImportServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/DataImportServiceImpl.java new file mode 100644 index 0000000..2651a66 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/DataImportServiceImpl.java @@ -0,0 +1,238 @@ +package com.cpop.oam.business.service.impl; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.exception.ExcelDataConvertException; +import com.alibaba.excel.read.listener.ReadListener; +import com.alibaba.excel.util.ListUtils; +import com.cpop.common.utils.StringUtils; +import com.cpop.common.utils.bean.BeanUtils; +import com.cpop.core.base.entity.PageDomain; +import com.cpop.core.base.enums.SourceType; +import com.cpop.core.base.exception.ServiceException; +import com.cpop.core.handler.TencentCosHandler; +import com.cpop.core.utils.SpringUtils; +import com.cpop.core.utils.file.FileUploadUtils; +import com.cpop.core.utils.file.FileUtils; +import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.jambox.business.entity.StoreExtend; +import com.cpop.jambox.business.service.StoreExtendService; +import com.cpop.jambox.framework.constant.JamboxCloudUrl; +import com.cpop.oam.business.bo.DataImportBo; +import com.cpop.oam.business.bo.DataImportPageBo; +import com.cpop.oam.business.dto.DataImportDto; +import com.cpop.oam.business.dto.DataImportParamsDto; +import com.cpop.oam.business.vo.DataImportPageVo; +import com.cpop.system.business.vo.SysFileVo; +import com.mybatisflex.core.paginate.Page; +import com.mybatisflex.core.query.QueryWrapper; +import com.mybatisflex.spring.service.impl.ServiceImpl; +import com.cpop.oam.business.entity.DataImport; +import com.cpop.oam.business.mapper.DataImportMapper; +import com.cpop.oam.business.service.DataImportService; +import com.qcloud.cos.model.UploadResult; +import lombok.extern.slf4j.Slf4j; +import org.springframework.stereotype.Service; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.multipart.MultipartFile; + +import java.io.File; +import java.io.IOException; +import java.util.List; + +import static com.alibaba.excel.cache.Ehcache.BATCH_COUNT; +import static com.cpop.jambox.business.entity.table.StoreExtendTableDef.STORE_EXTEND; +import static com.cpop.oam.business.entity.table.DataImportTableDef.DATA_IMPORT; +import static com.cpop.system.business.entity.table.BrandTableDef.BRAND; +import static com.cpop.system.business.entity.table.StoreTableDef.STORE; + +/** + * oam-数据导入表 服务层实现。 + * + * @author DB + * @since 2023-12-10 + */ +@Service("dataImportService") +@Slf4j +public class DataImportServiceImpl extends ServiceImpl implements DataImportService { + + /** + * 数据导入分页查询 + * @author DB + * @since 2023/12/10 + * @param bo 请求参数 + * @return R> + */ + @Override + public Page getDataImportPage(DataImportPageBo bo) { + PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); + return this.pageAs(Page.of(pageDomain.getPageNum(),pageDomain.getPageSize()), + QueryWrapper.create().select(DATA_IMPORT.ID, DATA_IMPORT.FILE_URL, DATA_IMPORT.IS_CLEAR, DATA_IMPORT.IMPORT_STATUS, DATA_IMPORT.CREATE_TIME) + .select(BRAND.BRAND_NAME) + .select(STORE.STORE_NAME) + .leftJoin(BRAND).on(BRAND.ID.eq(DATA_IMPORT.BRAND_ID)) + .leftJoin(STORE).on(STORE.ID.eq(DATA_IMPORT.STORE_ID)) + .where(DATA_IMPORT.IMPORT_STATUS.eq(bo.getImportStatus())) + .and(STORE.STORE_NAME.like(bo.getStoreName())), + DataImportPageVo.class); + } + + /** + * 新增数据导入 + * @author DB + * @since 2023/12/10 + * @param bo 请求参数 + */ + @Override + public void insertDataImport(DataImportBo bo) { + DataImport dataImport = BeanUtils.mapToClass(bo, DataImport.class); + dataImport.setImportStatus(false).setSourceType(SourceType.JAMBOX.getName()); + this.save(dataImport); + } + + /** + * 立即导入 + * @author DB + * @since 2023/12/10 + */ + @Override + public void importNow(String id) { + //读取数据 + DataImport dataImport = this.getById(id); + importNow(dataImport); + } + + @Override + public void importNow(DataImport dataImport) { + //读取数据 + DataImportParamsDto dataImportParamsDto = new DataImportParamsDto(); + dataImportParamsDto.setFileUrl(dataImport.getFileUrl()).setEmptyTag(dataImport.getIsClear() ? "清空" : "不清空"); + if (SourceType.valueOf(dataImport.getSourceType()) == SourceType.JAMBOX) { + StoreExtend storeExtend = SpringUtils.getBean(StoreExtendService.class).queryChain().where(STORE_EXTEND.STORE_ID.eq(dataImport.getStoreId())).one(); + dataImportParamsDto.setStoreId(storeExtend.getStoreCloudId()); + } else { + dataImportParamsDto.setStoreId(dataImport.getStoreId()); + } + SpringUtils.getBean(RestTemplate.class).postForObject(JamboxCloudUrl.DATA_IMPORT, dataImportParamsDto, String.class); + this.updateChain().set(DATA_IMPORT.IMPORT_STATUS, true).where(DATA_IMPORT.ID.eq(dataImport.getId())).update(); + } + + /** + * 检查上传的文件 + * @author DB + * @since 2023/12/10 + * @param file 文件 + */ + @Override + public SysFileVo checkImportData(MultipartFile file) { + //临时存储 + List cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT); + //文件检查 + File tempFile = null; + String fileName = file.getOriginalFilename(); + try { + EasyExcel.read(file.getInputStream(), DataImportDto.class, new ReadListener() { + @Override + public void invoke(DataImportDto dataImportDto, AnalysisContext analysisContext) { + //检查手机号 + if (StringUtils.isBlank(dataImportDto.getPhone())) { + throw new ServiceException("手机号为空!"); + } + //课卡类型 + if (StringUtils.isBlank(dataImportDto.getCardType())) { + dataImportDto.setCardType("少儿"); + } + //计费类型 + if (StringUtils.isBlank(dataImportDto.getBillingType())) { + dataImportDto.setBillingType("限时卡"); + } + //首充课时 + if (dataImportDto.getFirstChargePeriod() == null) { + dataImportDto.setFirstChargePeriod(0); + } + //剩余课时 + if (dataImportDto.getRemainingClassHours() == null) { + dataImportDto.setFirstChargePeriod(0); + } + //消费金额 + if (dataImportDto.getAmountSpent() == null) { + dataImportDto.setAmountSpent(0); + } + //课程顾问 + if (StringUtils.isBlank(dataImportDto.getBillingType())) { + dataImportDto.setBillingType("校长"); + } + //性别 + if (StringUtils.isBlank(dataImportDto.getSex())) { + dataImportDto.setSex("女"); + } + //课卡名称 + if (StringUtils.isBlank(dataImportDto.getCardName())) { + throw new ServiceException("课卡名称不能为空"); + } + //停卡时剩余天数 + if (dataImportDto.getStopCardRemainingDays() == null) { + dataImportDto.setStopCardRemainingDays(0); + dataImportDto.setCardStatus("使用中"); + } else { + dataImportDto.setCardStatus("停卡"); + } + //停卡缓冲天数 + if (dataImportDto.getStopCardBufferDays() == null) { + dataImportDto.setStopCardBufferDays(0); + } + if (dataImportDto.getStopCardBufferDays() != 0 && StringUtils.equals("使用中", dataImportDto.getCardStatus())) { + dataImportDto.setCardStatus("未激活"); + } else if (dataImportDto.getStopCardBufferDays() != 0 && StringUtils.equals("停卡", dataImportDto.getCardStatus())) { + dataImportDto.setCardStatus("停卡未激活"); + } + cachedDataList.add(dataImportDto); + } + + @Override + public void doAfterAllAnalysed(AnalysisContext analysisContext) { + + } + + /** + * 在转换异常 获取其他异常下会调用本接口。抛出异常则停止读取。如果这里不抛出异常则 继续读取下一行。 + * + * @param exception 异常 + * @param context 内容 + */ + @Override + public void onException(Exception exception, AnalysisContext context) { + // 如果是某一个单元格的转换异常 能获取到具体行号 如果要获取头的信息 配合invokeHeadMap使用 + if (exception instanceof ExcelDataConvertException) { + ExcelDataConvertException excelDataConvertException = (ExcelDataConvertException) exception; + throw new ServiceException("第" + (excelDataConvertException.getRowIndex() + 1) + "行,第" + (excelDataConvertException.getColumnIndex() + 1) + "列解析异常,数据为:" + excelDataConvertException.getCellData()); + } + } + }).sheet().doRead(); + tempFile = File.createTempFile(fileName, ".xlsx"); + log.info("文件名:{};临时文件地址: {}", fileName, tempFile.getPath()); + EasyExcel.write(tempFile.getPath(), DataImportDto.class) + .sheet("模板") + .doWrite(() -> { + // 分页查询数据 + return cachedDataList; + }); + MultipartFile multipartFile = FileUtils.getInstance().getMultipartFile(tempFile); + //文件上传 + TencentCosHandler tencentCosHandler = SpringUtils.getBean(TencentCosHandler.class); + UploadResult uploadResult = tencentCosHandler.cdnUpload(multipartFile); + String filename = FileUploadUtils.getInstance().extractFilename(multipartFile); + SysFileVo sysFileVo = new SysFileVo(); + sysFileVo.setUrl("https://" + uploadResult.getBucketName() + tencentCosHandler.getCdnUrl() + uploadResult.getKey()) + .setFileName(filename) + .setNewFileName(FileUtils.getInstance().getName(filename)) + .setOriginalFilename(file.getOriginalFilename()); + return sysFileVo; + } catch (IOException e) { + throw new ServiceException("文件上传失败!"); + } finally { + assert tempFile != null; + //tempFile.delete(); + } + } +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/StaffServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/StaffServiceImpl.java index 110ccdb..823f58c 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/StaffServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/StaffServiceImpl.java @@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONObject; import com.cpop.common.constant.Constants; import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; +import com.cpop.common.utils.http.HttpUtils; +import com.cpop.core.base.R; import com.cpop.core.base.entity.LoginUser; import com.cpop.core.base.entity.PageDomain; import com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo; @@ -15,10 +17,8 @@ import com.cpop.core.service.RedisService; import com.cpop.core.utils.*; import com.cpop.core.utils.sql.SqlUtils; import com.cpop.core.utils.uuid.IdUtils; -import com.cpop.oam.business.bo.ModifyUserPasswordBo; -import com.cpop.oam.business.bo.StaffBo; -import com.cpop.oam.business.bo.StaffPageBo; -import com.cpop.oam.business.bo.SysUserLogBo; +import com.cpop.jambox.framework.constant.JamboxCloudUrl; +import com.cpop.oam.business.bo.*; import com.cpop.oam.business.entity.Staff; import com.cpop.oam.business.entity.StaffMidDept; import com.cpop.oam.business.mapper.StaffMapper; @@ -37,10 +37,13 @@ import com.mybatisflex.spring.service.impl.ServiceImpl; import lombok.extern.slf4j.Slf4j; import me.chanjar.weixin.cp.api.WxCpService; import me.chanjar.weixin.cp.bean.message.WxCpXmlMessage; +import okhttp3.*; import org.springframework.security.crypto.bcrypt.BCrypt; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.client.RestTemplate; +import java.io.IOException; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.*; @@ -381,4 +384,27 @@ public class StaffServiceImpl extends ServiceImpl implements StaffVo.class); } + /** + * 修改运维状态 + * @author DB + * @since 2023/12/07 + * @param bo 请求参数 + */ + @Override + public void changeOperationStatus(OperationStatusBo bo) { + //获取用户信息 + Staff staff = this.getById(bo.getId()); + SysUser sysUser = DbChain.table(SYS_USER).select(SYS_USER.PHONE_NUMBER).where(SYS_USER.ID.eq(staff.getUserId())).oneAs(SysUser.class); + JSONObject jsonBody = new JSONObject(); + if (bo.getIsOperation()) { + jsonBody.put("_type", "oamAdd"); + jsonBody.put("name", staff.getName()); + jsonBody.put("phone", sysUser.getPhoneNumber()); + } else { + jsonBody.put("_type", "oamDel"); + jsonBody.put("phone", sysUser.getPhoneNumber()); + } + SpringUtils.getBean(RestTemplate.class).postForObject(JamboxCloudUrl.COMMON_CARD_URL, jsonBody, JSONObject.class); + } + } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskDemandServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskDemandServiceImpl.java index 5631223..dfcd14f 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskDemandServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskDemandServiceImpl.java @@ -1,12 +1,13 @@ package com.cpop.oam.business.service.impl; +import cn.binarywang.wx.miniapp.api.WxMaQrcodeService; +import cn.binarywang.wx.miniapp.api.WxMaService; import com.alibaba.fastjson.JSONObject; import com.cpop.api.tencent.wxWork.handler.WebHookSendHandler; +import com.cpop.common.constant.Constants; import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.entity.LoginUser; import com.cpop.core.base.entity.PageDomain; -import com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo; import com.cpop.core.base.enums.UserType; import com.cpop.core.base.exception.ServiceException; import com.cpop.core.base.table.SysConfig; @@ -17,21 +18,29 @@ import com.cpop.core.utils.SpringUtils; import com.cpop.core.utils.sql.SqlUtils; import com.cpop.oam.business.bo.TaskDemandBo; import com.cpop.oam.business.bo.TaskDemandPageBo; +import com.cpop.oam.business.bo.TaskDemandUrgentBo; import com.cpop.oam.business.entity.Task; import com.cpop.oam.business.entity.TaskDemand; import com.cpop.oam.business.mapper.TaskDemandMapper; import com.cpop.oam.business.service.TaskDemandService; import com.cpop.oam.business.service.TaskService; import com.cpop.oam.business.vo.TaskDemandPageVo; +import com.cpop.oam.business.vo.TaskDemandUrgentVo; import com.cpop.oam.framework.constant.WebHookKeyConstant; import com.cpop.oam.framework.enums.OamConfigEnum; +import com.cpop.system.business.vo.SysFileVo; import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.spring.service.impl.ServiceImpl; +import com.qcloud.cos.model.UploadResult; +import me.chanjar.weixin.common.error.WxErrorException; import org.springframework.stereotype.Service; +import java.io.ByteArrayInputStream; +import java.io.File; import java.io.IOException; import java.util.ArrayList; +import java.util.Base64; import java.util.List; import static com.cpop.core.base.table.table.SysUserTableDef.SYS_USER; @@ -41,6 +50,7 @@ import static com.cpop.oam.business.entity.table.TaskTableDef.TASK; import static com.cpop.system.business.entity.table.BrandTableDef.BRAND; import static com.cpop.system.business.entity.table.StoreTableDef.STORE; import org.springframework.transaction.annotation.Transactional; +import org.springframework.web.multipart.MultipartFile; /** * OAM-任务-需求表 服务层实现。 @@ -236,4 +246,40 @@ public class TaskDemandServiceImpl extends ServiceImpl getPersonWorkOrder() { - // 获取当前用户 - JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo(); - // 获取当天技术值班 // 获取值班员工 DutyService dutyService = SpringUtils.getBean(DutyService.class); Duty duty = dutyService.getOne(QueryWrapper.create().where(DUTY.DUTY_DATE.eq(DateUtils.getDate()))); if (duty == null) { throw new ServiceException("当天没有值班员工,请联系相关人员添加值班信息!"); } - // 判断当前用户是不是值班用户 - QueryWrapper queryWrapper = QueryWrapper.create(); - if (!StringUtils.equals(duty.getTechnologyStaffId(), loginUserInfo.getString("id"))) { - // 获取未接受的工单 - queryWrapper.or(TASK.TASK_STATUS.in(1, 7)); - } - return this.mapper.selectListByQueryAs(queryWrapper + return this.mapper.selectListByQueryAs(QueryWrapper.create() .select(TASK_WORK_ORDER.ID, TASK_WORK_ORDER.PHONE_NUMBER, TASK_WORK_ORDER.CREATE_TIME.as("createTime"), @@ -662,13 +655,13 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl item.field(TaskWorkOrderPersonVo::getRecordStaffName) @@ -705,13 +698,16 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl implements TechnologyToolService { + +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/BrandManagePageVo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/BrandManagePageVo.java new file mode 100644 index 0000000..428d39e --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/BrandManagePageVo.java @@ -0,0 +1,57 @@ +package com.cpop.oam.business.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.time.LocalDateTime; + +/** + * @author DB + * @version 1.0.0 + * @since 2023-12-07 17:26 + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "BrandManage对象", description = "品牌管理员") +public class BrandManagePageVo { + + /** + * 主键 + */ + @ApiModelProperty("主键") + private String id; + + /** + * 姓名 + */ + @ApiModelProperty("姓名") + private String name; + + /** + * 手机号 + */ + @ApiModelProperty("手机号") + private String phone; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8") + @ApiModelProperty("创建时间") + private LocalDateTime createTime; + + /** + * 品牌名 + */ + @ApiModelProperty("品牌名") + private String brandName; + + /** + * 校区名 + */ + @ApiModelProperty("校区名") + private String storeName; +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/DataImportPageVo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/DataImportPageVo.java new file mode 100644 index 0000000..995d4b2 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/DataImportPageVo.java @@ -0,0 +1,63 @@ +package com.cpop.oam.business.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.time.LocalDateTime; + +/** + * @author DB + * @version 1.0.0 + * @since 2023-12-10 11:08 + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "DataImportPageVo对象") +public class DataImportPageVo { + + /** + * 主键 + */ + @ApiModelProperty(value = "主键") + private String id; + + /** + * 品牌id + */ + @ApiModelProperty(value = "品牌") + private String brandName; + + /** + * 校区 + */ + @ApiModelProperty(value = "校区") + private String storeName; + + /** + * 导入文件地址 + */ + @ApiModelProperty(value = "导入文件地址") + private String fileUrl; + + /** + * 是否清空 + */ + @ApiModelProperty(value = "是否清空") + private Boolean isClear; + + /** + * 导入状态 + */ + @ApiModelProperty(value = "导入状态") + private Boolean importStatus; + + /** + * 上传时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss" , timezone = "GMT+8") + @ApiModelProperty(value = "上传时间") + private LocalDateTime createTime; +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/StaffPageVo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/StaffPageVo.java index fdc502c..270bb28 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/StaffPageVo.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/StaffPageVo.java @@ -120,4 +120,10 @@ public class StaffPageVo implements Serializable { */ @ApiModelProperty("密码") private String password; + + /** + * 是否是运维账号 + */ + @ApiModelProperty("是否是运维账号") + private Boolean isOperation; } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/TaskDemandUrgentVo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/TaskDemandUrgentVo.java new file mode 100644 index 0000000..21c53b2 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/TaskDemandUrgentVo.java @@ -0,0 +1,55 @@ +package com.cpop.oam.business.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; + +/** + * @author DB + * @version 1.0.0 + * @since 2023-12-10 10:04 + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "任务加急返回对象", description = "任务加急返回对象") +public class TaskDemandUrgentVo { + + /** + * 需求id + */ + @ApiModelProperty(value = "需求id") + private String id; + + /** + * 支付二维码 + */ + @ApiModelProperty(value = "支付二维码") + private String payQrCode; + + /** + * 签约图片 + */ + @ApiModelProperty(value = "签约图片") + private String signPic; + + /** + * 任务评级(A;B:C:D:E) + */ + @ApiModelProperty(value = "任务评级(A;B:C:D:E)") + private String taskRating; + + /** + * 预付款 + */ + @ApiModelProperty(value = "预付款") + private BigDecimal prepayment; + + /** + * 应付款 + */ + @ApiModelProperty(value = "应付款") + private BigDecimal payable; +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/TechnologyToolPageVo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/TechnologyToolPageVo.java new file mode 100644 index 0000000..7d88f57 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/TechnologyToolPageVo.java @@ -0,0 +1,64 @@ +package com.cpop.oam.business.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.mybatisflex.annotation.Id; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.time.LocalDateTime; + +/** + * @author DB + * @version 1.0.0 + * @since 2023-12-10 10:30 + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "TechnologyToolPageVo对象", description = "TechnologyToolPageVo对象") +public class TechnologyToolPageVo { + + /** + * 主键 + */ + @ApiModelProperty(value = "主键") + private String id; + + /** + * 工具名 + */ + @ApiModelProperty(value = "工具名") + private String toolName; + + /** + * 工具地址 + */ + @ApiModelProperty(value = "工具地址") + private String toolUrl; + + /** + * 工具介绍 + */ + @ApiModelProperty(value = "工具介绍") + private String toolDesc; + + /** + * 工具类型(字典) + */ + @ApiModelProperty(value = "工具类型") + private String toolType; + + /** + * 创建人 + */ + @ApiModelProperty(value = "创建人") + private String createUser; + + /** + * 创建时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + @ApiModelProperty(value = "创建时间") + private LocalDateTime createTime; +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/framework/config/wxMa/WxMaConfiguration.java b/Cpop-Oam/src/main/java/com/cpop/oam/framework/config/wxMa/WxMaConfiguration.java new file mode 100644 index 0000000..2b8daba --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/framework/config/wxMa/WxMaConfiguration.java @@ -0,0 +1,132 @@ +package com.cpop.oam.framework.config.wxMa; + +import cn.binarywang.wx.miniapp.api.WxMaService; +import cn.binarywang.wx.miniapp.api.impl.WxMaServiceImpl; +import cn.binarywang.wx.miniapp.bean.WxMaKefuMessage; +import cn.binarywang.wx.miniapp.bean.WxMaSubscribeMessage; +import cn.binarywang.wx.miniapp.config.impl.WxMaDefaultConfigImpl; +import cn.binarywang.wx.miniapp.message.WxMaMessageHandler; +import cn.binarywang.wx.miniapp.message.WxMaMessageRouter; +import com.google.common.collect.Lists; +import lombok.extern.slf4j.Slf4j; +import me.chanjar.weixin.common.bean.result.WxMediaUploadResult; +import me.chanjar.weixin.common.error.WxErrorException; +import me.chanjar.weixin.common.error.WxRuntimeException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.io.File; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author Binary Wang + */ +@Slf4j +@Configuration +@EnableConfigurationProperties(WxMaProperties.class) +public class WxMaConfiguration { + private final WxMaProperties properties; + + @Autowired + public WxMaConfiguration(WxMaProperties properties) { + this.properties = properties; + } + + @Bean + public WxMaService wxMaService() { + List configs = this.properties.getConfigs(); + if (configs == null) { + throw new WxRuntimeException("小程序相关信息配置错误"); + } + WxMaService maService = new WxMaServiceImpl(); + maService.setMultiConfigs( + configs.stream() + .map(a -> { + WxMaDefaultConfigImpl config = new WxMaDefaultConfigImpl(); + //WxMaDefaultConfigImpl config = new WxMaRedisConfigImpl(new JedisPool()); + // 使用上面的配置时,需要同时引入jedis-lock的依赖,否则会报类无法找到的异常 + config.setAppid(a.getAppid()); + config.setSecret(a.getSecret()); + config.setToken(a.getToken()); + config.setAesKey(a.getAesKey()); + config.setMsgDataFormat(a.getMsgDataFormat()); + return config; + }).collect(Collectors.toMap(WxMaDefaultConfigImpl::getAppid, a -> a, (o, n) -> o))); + return maService; + } + + @Bean + public WxMaMessageRouter wxMaMessageRouter(WxMaService wxMaService) { + final WxMaMessageRouter router = new WxMaMessageRouter(wxMaService); + router + .rule().handler(logHandler).next() + .rule().async(false).content("订阅消息").handler(subscribeMsgHandler).end() + .rule().async(false).content("文本").handler(textHandler).end() + .rule().async(false).content("图片").handler(picHandler).end() + .rule().async(false).content("二维码").handler(qrcodeHandler).end(); + return router; + } + + private final WxMaMessageHandler subscribeMsgHandler = (wxMessage, context, service, sessionManager) -> { + service.getMsgService().sendSubscribeMsg(WxMaSubscribeMessage.builder() + .templateId("此处更换为自己的模板id") + .data(Lists.newArrayList( + new WxMaSubscribeMessage.MsgData("keyword1", "339208499"))) + .toUser(wxMessage.getFromUser()) + .build()); + return null; + }; + + private final WxMaMessageHandler logHandler = (wxMessage, context, service, sessionManager) -> { + log.info("收到消息:" + wxMessage.toString()); + service.getMsgService().sendKefuMsg(WxMaKefuMessage.newTextBuilder().content("收到信息为:" + wxMessage.toJson()) + .toUser(wxMessage.getFromUser()).build()); + return null; + }; + + private final WxMaMessageHandler textHandler = (wxMessage, context, service, sessionManager) -> { + service.getMsgService().sendKefuMsg(WxMaKefuMessage.newTextBuilder().content("回复文本消息") + .toUser(wxMessage.getFromUser()).build()); + return null; + }; + + private final WxMaMessageHandler picHandler = (wxMessage, context, service, sessionManager) -> { + try { + WxMediaUploadResult uploadResult = service.getMediaService() + .uploadMedia("image", "png", + ClassLoader.getSystemResourceAsStream("tmp.png")); + service.getMsgService().sendKefuMsg( + WxMaKefuMessage + .newImageBuilder() + .mediaId(uploadResult.getMediaId()) + .toUser(wxMessage.getFromUser()) + .build()); + } catch (WxErrorException e) { + e.printStackTrace(); + } + + return null; + }; + + private final WxMaMessageHandler qrcodeHandler = (wxMessage, context, service, sessionManager) -> { + try { + final File file = service.getQrcodeService().createQrcode("123", 430); + WxMediaUploadResult uploadResult = service.getMediaService().uploadMedia("image", file); + service.getMsgService().sendKefuMsg( + WxMaKefuMessage + .newImageBuilder() + .mediaId(uploadResult.getMediaId()) + .toUser(wxMessage.getFromUser()) + .build()); + } catch (WxErrorException e) { + e.printStackTrace(); + } + + return null; + }; + +} + diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/framework/config/wxMa/WxMaProperties.java b/Cpop-Oam/src/main/java/com/cpop/oam/framework/config/wxMa/WxMaProperties.java new file mode 100644 index 0000000..441f7ff --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/framework/config/wxMa/WxMaProperties.java @@ -0,0 +1,46 @@ +package com.cpop.oam.framework.config.wxMa; + +import java.util.List; +import org.springframework.boot.context.properties.ConfigurationProperties; + +import lombok.Data; + +/** + * @author Binary Wang + */ +@Data +@ConfigurationProperties(prefix = "wx.miniapp") +public class WxMaProperties { + + private List configs; + + @Data + public static class Config { + /** + * 设置微信小程序的appid + */ + private String appid; + + /** + * 设置微信小程序的Secret + */ + private String secret; + + /** + * 设置微信小程序消息服务器配置的token + */ + private String token; + + /** + * 设置微信小程序消息服务器配置的EncodingAESKey + */ + private String aesKey; + + /** + * 消息格式,XML或者JSON + */ + private String msgDataFormat; + } + +} + diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/framework/handler/wxPay/WxPayHandler.java b/Cpop-Oam/src/main/java/com/cpop/oam/framework/handler/wxPay/WxPayHandler.java new file mode 100644 index 0000000..778da05 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/framework/handler/wxPay/WxPayHandler.java @@ -0,0 +1,72 @@ +package com.cpop.oam.framework.handler.wxPay; + +import com.alibaba.fastjson.JSONObject; +import com.cpop.common.utils.StringUtils; +import com.cpop.core.base.exception.ServiceException; +import com.cpop.core.utils.SecurityUtils; +import com.cpop.core.utils.SpringUtils; +import com.cpop.system.business.entity.Brand; +import com.cpop.system.business.service.BrandService; +import com.github.binarywang.wxpay.config.WxPayConfig; +import com.github.binarywang.wxpay.service.WxPayService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * @author DB + * @createTime 2023/10/27 15:47 + * @description + */ +@Component +public class WxPayHandler { + + @Autowired + private WxPayService wxPayService; + + /** + * @descriptions 获取微信支付service + * @author DB + * @date 2023/10/27 15:53 + * @return: com.github.binarywang.wxpay.service.WxPayService + */ + public WxPayService getWxPayService(){ + //查询当前登陆用户所在品牌的商户id + JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo(); + if (loginUserInfo == null) { + //直接返回 + return wxPayService; + } + String brandId = loginUserInfo.getString("brandId"); + Brand brand = SpringUtils.getBean(BrandService.class).getById(brandId); + //检查是否开启分账 + if (!brand.getIsOpenSharing()) { + throw new ServiceException("当前商户暂未开启分账,请联系相关客服"); + } + WxPayConfig payConfig = wxPayService.getConfig(); + //子商户信息 + payConfig.setSubMchId(StringUtils.trimToNull(brand.getWxMchId())); + // 可以指定是否使用沙箱环境 + payConfig.setUseSandboxEnv(false); + wxPayService.setConfig(payConfig); + return wxPayService; + } + + /** + * @descriptions 根据商户appid或商户号获取对应微信支付接口 + * @author DB + * @date 2023/10/18 10:34 + * @param subAppId 子商户appid + * @param subMchId 子商户id + * @return: com.github.binarywang.wxpay.service.WxPayService + */ + public WxPayService getWxPayService(String subAppId, String subMchId) { + WxPayConfig payConfig = wxPayService.getConfig(); + //子商户信息 + payConfig.setSubAppId(StringUtils.trimToNull(subAppId)); + payConfig.setSubMchId(StringUtils.trimToNull(subMchId)); + // 可以指定是否使用沙箱环境 + payConfig.setUseSandboxEnv(false); + wxPayService.setConfig(payConfig); + return wxPayService; + } +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/DataImportAsyncTask.java b/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/DataImportAsyncTask.java new file mode 100644 index 0000000..75820b8 --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/DataImportAsyncTask.java @@ -0,0 +1,21 @@ +package com.cpop.oam.framework.tasks; + +import com.cpop.core.utils.SpringUtils; +import com.cpop.oam.business.entity.DataImport; +import com.cpop.oam.business.service.DataImportService; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Component; + +/** + * @author DB + * @version 1.0.0 + * @since 2023-12-10 17:19 + */ +@Component +public class DataImportAsyncTask { + + @Async("customAsyncThreadPool") + public void asyncUpdateShoppingCartAmount(DataImport dataImport) { + SpringUtils.getBean(DataImportService.class).importNow(dataImport); + } +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/OamScheduledTasks.java b/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/OamScheduledTasks.java index 9eb5b7e..90e5b85 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/OamScheduledTasks.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/OamScheduledTasks.java @@ -1,13 +1,19 @@ package com.cpop.oam.framework.tasks; +import com.cpop.core.utils.SpringUtils; +import com.cpop.oam.business.entity.DataImport; +import com.cpop.oam.business.entity.table.DataImportTableDef; +import com.cpop.oam.business.service.DataImportService; import com.cpop.oam.business.service.DutyService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; -import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; +import java.util.List; + + /** * @author DB * @createTime 2023/11/22 18:07 @@ -31,4 +37,24 @@ public class OamScheduledTasks { public void dutyNotice() { dutyService.dutyNotice(); } + + /** + * 凌晨20分同步导入的数据 + * @author DB + * @since 2023/12/10 + */ + @Scheduled(cron = "0 20 0 * * *") + public void syncImportData() throws InterruptedException { + log.info("==============开始同步校区数据==========="); + long start = System.currentTimeMillis(); + DataImportService dataImportService = SpringUtils.getBean(DataImportService.class); + List dataList = dataImportService.queryChain() + .where(DataImportTableDef.DATA_IMPORT.IMPORT_STATUS.eq(false)).list(); + for (DataImport item : dataList) { + SpringUtils.getBean(DataImportAsyncTask.class).asyncUpdateShoppingCartAmount(item); + Thread.sleep(600000); + } + long end = System.currentTimeMillis(); + log.info("同步校区数据执行时间:{}ms", end - start); + } } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/WorkOrderAcceptOverTimeTask.java b/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/WorkOrderAcceptOverTimeTask.java index df811a2..371347d 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/WorkOrderAcceptOverTimeTask.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/WorkOrderAcceptOverTimeTask.java @@ -1,10 +1,12 @@ package com.cpop.oam.framework.tasks; +import com.cpop.common.utils.http.HttpHelper; import com.cpop.core.utils.SpringUtils; import com.cpop.oam.business.entity.Task; import com.cpop.oam.business.entity.TaskWorkOrder; import com.cpop.oam.business.service.TaskStaffGroupService; import com.cpop.oam.business.service.TaskWorkOrderService; +import lombok.extern.slf4j.Slf4j; import org.quartz.Job; import org.quartz.JobDataMap; import org.quartz.JobExecutionContext; @@ -14,18 +16,18 @@ import static com.cpop.oam.business.entity.table.TaskStaffGroupTableDef.TASK_STA import static com.cpop.oam.business.entity.table.TaskTableDef.TASK; import com.cpop.oam.business.service.TaskService; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; /** - * 工单接收超时定时任务 - * * @author DB - * @since 2023-11-29 10:13:22 - * @version 1.0.0 */ public class WorkOrderAcceptOverTimeTask implements Job { + private static final Logger LOGGER = LoggerFactory.getLogger(HttpHelper.class); + @Override - public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException { + public void execute(JobExecutionContext jobExecutionContext) { // 获取工单id JobDataMap jobDataMap = jobExecutionContext.getJobDetail().getJobDataMap(); String workOrderId = jobDataMap.getString("WorkOrderId"); @@ -35,18 +37,18 @@ public class WorkOrderAcceptOverTimeTask implements Job { TaskService taskService = SpringUtils.getBean(TaskService.class); Task task = taskService.getById(workOrder.getTaskId()); if (task != null) { - // 工单超时为接收,扣除5绩点 - TaskStaffGroupService taskStaffGroupService = SpringUtils.getBean(TaskStaffGroupService.class); - taskStaffGroupService.updateChain() - .set(TASK_STAFF_GROUP.GRADE_POINT, -5) - .set(TASK_STAFF_GROUP.REMARK, "工单接收超时扣除5绩点 ") - .where(TASK_STAFF_GROUP.TASK_ID.eq(task.getId()) - .and(TASK_STAFF_GROUP.STAFF_ID.eq(task.getResponsibleStaffId()))); // 更新任务为接收超时 taskService.updateChain() .set(TASK.TASK_STATUS, 7) .where(TASK.ID.eq(task.getId())) .update(); + // 工单超时为接收,扣除5绩点 + SpringUtils.getBean(TaskStaffGroupService.class).updateChain() + .set(TASK_STAFF_GROUP.GRADE_POINT, -5) + .set(TASK_STAFF_GROUP.REMARK, "工单接收超时扣除5绩点 ") + .where(TASK_STAFF_GROUP.TASK_ID.eq(task.getId())) + .and(TASK_STAFF_GROUP.STAFF_ID.eq(task.getResponsibleStaffId())) + .update(); } } } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/WorkOrderOvertimeTask.java b/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/WorkOrderOvertimeTask.java index 7dcc45a..3ad13f4 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/WorkOrderOvertimeTask.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/WorkOrderOvertimeTask.java @@ -1,6 +1,7 @@ package com.cpop.oam.framework.tasks; import com.cpop.core.utils.SpringUtils; +import com.cpop.oam.business.entity.Task; import com.cpop.oam.business.entity.TaskWorkOrder; import com.cpop.oam.business.service.TaskService; import com.cpop.oam.business.service.TaskWorkOrderService; @@ -31,16 +32,13 @@ public class WorkOrderOvertimeTask implements Job { // 修改任务逾期 TaskService taskService = SpringUtils.getBean(TaskService.class); taskService.updateChain().set(TASK.TASK_STATUS, 4).where(TASK.ID.eq(taskWorkOrder.getTaskId())).update(); + Task task = taskService.getById(taskWorkOrder.getTaskId()); // 扣除5点绩点 - TaskStaffGroupService taskStaffGroupService = SpringUtils.getBean(TaskStaffGroupService.class); - taskStaffGroupService.updateChain() + SpringUtils.getBean(TaskStaffGroupService.class).updateChain() .setRaw(TASK_STAFF_GROUP.GRADE_POINT, "grade_point - 5") - .set(TASK_STAFF_GROUP.REMARK, "remark + '工单完结超时扣除5绩点'") - .where(TASK_STAFF_GROUP.TASK_ID.eq(workOrderId)); - // 更新任务为逾期 - taskService.updateChain() - .set(TASK.TASK_STATUS, 4) - .where(TASK.ID.eq(taskWorkOrder.getTaskId())) + .setRaw(TASK_STAFF_GROUP.REMARK, "concat(remark,'工单完结超时扣除5绩点')") + .where(TASK_STAFF_GROUP.TASK_ID.eq(task.getId())) + .and(TASK_STAFF_GROUP.STAFF_ID.eq(task.getResponsibleStaffId())) .update(); } } diff --git a/Cpop-Oam/src/main/resources/mapper/BrandManagerMapper.xml b/Cpop-Oam/src/main/resources/mapper/BrandManagerMapper.xml new file mode 100644 index 0000000..5d83e3b --- /dev/null +++ b/Cpop-Oam/src/main/resources/mapper/BrandManagerMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/Cpop-Oam/src/main/resources/mapper/BrandManagerStoreMapper.xml b/Cpop-Oam/src/main/resources/mapper/BrandManagerStoreMapper.xml new file mode 100644 index 0000000..3eba157 --- /dev/null +++ b/Cpop-Oam/src/main/resources/mapper/BrandManagerStoreMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/Cpop-Oam/src/main/resources/mapper/DataImportMapper.xml b/Cpop-Oam/src/main/resources/mapper/DataImportMapper.xml new file mode 100644 index 0000000..1bbf65a --- /dev/null +++ b/Cpop-Oam/src/main/resources/mapper/DataImportMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/Cpop-Oam/src/main/resources/mapper/TechnologyToolMapper.xml b/Cpop-Oam/src/main/resources/mapper/TechnologyToolMapper.xml new file mode 100644 index 0000000..531ab01 --- /dev/null +++ b/Cpop-Oam/src/main/resources/mapper/TechnologyToolMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/Cpop-System/src/main/java/com/cpop/system/business/bo/StoreListByBrandBo.java b/Cpop-System/src/main/java/com/cpop/system/business/bo/StoreListByBrandBo.java new file mode 100644 index 0000000..f5248ac --- /dev/null +++ b/Cpop-System/src/main/java/com/cpop/system/business/bo/StoreListByBrandBo.java @@ -0,0 +1,25 @@ +package com.cpop.system.business.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import java.util.List; + +/** + * @author DB + * @version 1.0.0 + * @since 2023-12-07 17:51 + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "StoreListByBrandBo对象") +public class StoreListByBrandBo { + + /** + * 品牌id集合 + */ + @ApiModelProperty("品牌id集合") + private List brandIds; +} diff --git a/Cpop-System/src/main/java/com/cpop/system/business/controller/BrandController.java b/Cpop-System/src/main/java/com/cpop/system/business/controller/BrandController.java index 8af81d4..ab899c8 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/controller/BrandController.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/controller/BrandController.java @@ -44,7 +44,6 @@ public class BrandController { * @param bo 品牌参数 * @return: com.cpop.core.base.R */ - @PreAuthorize("@aps.hasPermission('brandStore:brand:insert')") @PostMapping("/insertSysBrand") @ApiOperation("新增系统品牌") public R insertSysBrand(@RequestBody @ApiParam("系统-品牌") @Validated BrandBo bo) { @@ -61,7 +60,6 @@ public class BrandController { * @param bo 品牌参数 * @return: com.cpop.core.base.R */ - @PreAuthorize("@aps.hasPermission('brandStore:brand:update')") @ApiOperation("修改系统品牌") @PutMapping("/updateSysBrand") public R updateSysBrand(@RequestBody @ApiParam("系统-品牌") @Validated BrandBo bo) { @@ -77,7 +75,6 @@ public class BrandController { * @param brandId 果酱品牌信息 * @return: boolean */ - @PreAuthorize("@aps.hasPermission('brandStore:brand:insert')") @PostMapping("/importJamboxBrand/{brandId}") @ApiOperation("导入果酱品牌") public R importJamboxBrand(@PathVariable String brandId) { @@ -107,7 +104,6 @@ public class BrandController { * @param id 主键 * @return: com.cpop.core.base.R */ - @PreAuthorize("@aps.hasPermission('brandStore:brand:remove')") @ApiOperation("根据品牌id删除品牌") @DeleteMapping("/removeBrandById/{id}") public R removeBrandById(@PathVariable String id) { diff --git a/Cpop-System/src/main/java/com/cpop/system/business/controller/DictTypeController.java b/Cpop-System/src/main/java/com/cpop/system/business/controller/DictTypeController.java index 39a7aa5..56a4b85 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/controller/DictTypeController.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/controller/DictTypeController.java @@ -55,6 +55,7 @@ public class DictTypeController { * @author DB * @since 2023/12/01 */ + @PreAuthorize("@aps.hasPermission('system:dict:list')") @GetMapping("/getDictTypePage") @ApiOperation("获取系统字典类型分页") public R> getDictTypePage(@ApiParam(value = "字典名") String dictName) { diff --git a/Cpop-System/src/main/java/com/cpop/system/business/entity/Store.java b/Cpop-System/src/main/java/com/cpop/system/business/entity/Store.java index 7d43e42..68dc399 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/entity/Store.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/entity/Store.java @@ -40,6 +40,36 @@ public class Store extends BaseEntity implements Serializable { */ private String storeName; + /** + * 店铺/校区地址 + */ + private String storeAddr; + + /** + * 负责人 + */ + private String personCharge; + + /** + * 手机号 + */ + private String phone; + + /** + * 到期日期 + */ + private String expireDate; + + /** + * 是否有顾问 + */ + private String haveCounselor; + + /** + * 是否激活 + */ + private String haveActive; + /** * 品牌id */ diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreServiceImpl.java b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreServiceImpl.java index 8129ceb..02b08fe 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreServiceImpl.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreServiceImpl.java @@ -41,8 +41,11 @@ public class StoreServiceImpl extends ServiceImpl implements public Page getStorePage(StorePageBo bo) { PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); return this.getMapper().paginateAs(Page.of(pageDomain.getPageNum(), pageDomain.getPageSize()), - QueryWrapper.create().select(STORE.ALL_COLUMNS).select(BRAND.BRAND_NAME).from(STORE).leftJoin(BRAND) - .on(BRAND.ID.eq(STORE.BRAND_ID)), + QueryWrapper.create().select(STORE.ALL_COLUMNS) + .select(BRAND.BRAND_NAME).from(STORE) + .select("cp_j_store_extend.store_cloud_id as storeCloudId") + .leftJoin(BRAND).on(BRAND.ID.eq(STORE.BRAND_ID)) + .leftJoin("cp_j_store_extend").on("`cp_j_store_extend`.`store_id` = `cp_sys_store`.`id`"), StorePageVo.class); } } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/BrandListVo.java b/Cpop-System/src/main/java/com/cpop/system/business/vo/BrandListVo.java similarity index 93% rename from Cpop-Oam/src/main/java/com/cpop/oam/business/vo/BrandListVo.java rename to Cpop-System/src/main/java/com/cpop/system/business/vo/BrandListVo.java index a440f16..1bb555d 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/BrandListVo.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/vo/BrandListVo.java @@ -1,4 +1,4 @@ -package com.cpop.oam.business.vo; +package com.cpop.system.business.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/Cpop-System/src/main/java/com/cpop/system/business/vo/StoreListByBrandVo.java b/Cpop-System/src/main/java/com/cpop/system/business/vo/StoreListByBrandVo.java new file mode 100644 index 0000000..5e7bf94 --- /dev/null +++ b/Cpop-System/src/main/java/com/cpop/system/business/vo/StoreListByBrandVo.java @@ -0,0 +1,35 @@ +package com.cpop.system.business.vo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +/** + * @author DB + * @version 1.0.0 + * @since 2023-12-07 17:50 + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "StoreList对象", description = "校区表") +public class StoreListByBrandVo { + + /** + * 主键 + */ + @ApiModelProperty("主键") + private String id; + + /** + * 品牌id + */ + @ApiModelProperty("品牌id") + private String brandId; + + /** + * 校区名 + */ + @ApiModelProperty("校区名") + private String name; +} diff --git a/Cpop-System/src/main/java/com/cpop/system/business/vo/StorePageVo.java b/Cpop-System/src/main/java/com/cpop/system/business/vo/StorePageVo.java index 9dd1efb..cb16310 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/vo/StorePageVo.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/vo/StorePageVo.java @@ -6,6 +6,7 @@ import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.experimental.Accessors; import java.io.Serializable; +import java.time.LocalDate; import java.time.LocalDateTime; import com.cpop.core.base.enums.SourceType; @@ -32,7 +33,7 @@ public class StorePageVo implements Serializable { * 云校区id */ @ApiModelProperty("云校区id") - private String campusCloudId; + private String storeCloudId; /** * 品牌id @@ -65,4 +66,41 @@ public class StorePageVo implements Serializable { @ApiModelProperty("创建时间") private LocalDateTime createTime; + /** + * 店铺/校区地址 + */ + @ApiModelProperty("店铺/校区地址") + private String storeAddr; + + /** + * 负责人 + */ + @ApiModelProperty("负责人") + private String personCharge; + + /** + * 手机号 + */ + @ApiModelProperty("手机号") + private String phone; + + /** + * 到期日期 + */ + @JsonFormat(pattern = "yyyy-MM-dd") + @ApiModelProperty("到期日期") + private LocalDate expireDate; + + /** + * 是否有顾问 + */ + @ApiModelProperty("是否有顾问") + private Boolean haveCounselor; + + /** + * 是否激活 + */ + @ApiModelProperty("是否激活") + private Boolean haveActive; + } diff --git a/pom.xml b/pom.xml index b96cd6e..4b86dbd 100644 --- a/pom.xml +++ b/pom.xml @@ -200,6 +200,10 @@ bcprov-jdk15on ${bcprov-jdk15on.version} + + org.springframework + spring-test +