瀏覽代碼

Merge remote-tracking branch 'origin/developer' into developerB

# Conflicts:
#	src/main/java/com/caimei365/manager/service/caimei/user/impl/CmBehaviorRecordServiceImpl.java
#	src/main/java/com/caimei365/manager/utils/formDataUtils.java
huangzhiguo 1 年之前
父節點
當前提交
daed0e52bf
共有 31 個文件被更改,包括 3618 次插入12 次删除
  1. 6 0
      pom.xml
  2. 121 3
      src/main/java/com/caimei365/manager/FastDFS/FastDFSClient.java
  3. 8 4
      src/main/java/com/caimei365/manager/config/GlobalControllerAdvice.java
  4. 15 0
      src/main/java/com/caimei365/manager/config/WebConfig.java
  5. 151 0
      src/main/java/com/caimei365/manager/controller/caimei/providers/ProvidersApi.java
  6. 93 0
      src/main/java/com/caimei365/manager/dao/CmRelatedImageMapper.java
  7. 91 0
      src/main/java/com/caimei365/manager/dao/CmRelatedMapper.java
  8. 88 0
      src/main/java/com/caimei365/manager/dao/providers/CmProvidersContractMapper.java
  9. 99 0
      src/main/java/com/caimei365/manager/dao/providers/CmProvidersMapper.java
  10. 91 0
      src/main/java/com/caimei365/manager/dao/user/UserMapper.java
  11. 70 0
      src/main/java/com/caimei365/manager/entity/caimei/CmRelated.java
  12. 67 0
      src/main/java/com/caimei365/manager/entity/caimei/CmRelatedImage.java
  13. 253 0
      src/main/java/com/caimei365/manager/entity/caimei/cmUser/User.java
  14. 139 0
      src/main/java/com/caimei365/manager/entity/caimei/providers/CmProviders.java
  15. 77 0
      src/main/java/com/caimei365/manager/entity/caimei/providers/CmProvidersContract.java
  16. 25 0
      src/main/java/com/caimei365/manager/entity/po/UploadFilePo.java
  17. 59 0
      src/main/java/com/caimei365/manager/service/caimei/providers/CmProvidersContractService.java
  18. 66 0
      src/main/java/com/caimei365/manager/service/caimei/providers/CmProvidersService.java
  19. 144 0
      src/main/java/com/caimei365/manager/service/caimei/providers/impl/CmProvidersContractServiceImpl.java
  20. 209 0
      src/main/java/com/caimei365/manager/service/caimei/providers/impl/CmProvidersServiceImpl.java
  21. 282 0
      src/main/java/com/caimei365/manager/service/caimei/providers/utils/ImageUtils.java
  22. 99 0
      src/main/java/com/caimei365/manager/service/caimei/providers/utils/ProvidersTemplate.java
  23. 5 4
      src/main/java/com/caimei365/manager/service/caimei/user/impl/CmBehaviorRecordServiceImpl.java
  24. 86 0
      src/main/java/com/caimei365/manager/utils/FileIOUtils.java
  25. 10 0
      src/main/java/com/caimei365/manager/utils/formDataUtils.java
  26. 2 1
      src/main/resources/application.yml
  27. 157 0
      src/main/resources/mapper/CmRelatedImageMapper.xml
  28. 158 0
      src/main/resources/mapper/CmRelatedMapper.xml
  29. 146 0
      src/main/resources/mapper/providers/CmProvidersContractMapper.xml
  30. 280 0
      src/main/resources/mapper/providers/CmProvidersMapper.xml
  31. 521 0
      src/main/resources/mapper/user/UserMapper.xml

+ 6 - 0
pom.xml

@@ -17,6 +17,12 @@
         <java.version>1.8</java.version>
     </properties>
     <dependencies>
+        <!--      图像生成-->
+        <dependency>
+            <groupId>com.google.zxing</groupId>
+            <artifactId>core</artifactId>
+            <version>3.3.0</version>
+        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-data-redis</artifactId>

+ 121 - 3
src/main/java/com/caimei365/manager/FastDFS/FastDFSClient.java

@@ -1,23 +1,53 @@
 package com.caimei365.manager.FastDFS;
 
+import com.caimei365.manager.config.thinkgem.Global;
+import com.caimei365.manager.entity.po.UploadFilePo;
+import com.caimei365.manager.service.caimei.providers.utils.ImageUtils;
+import com.caimei365.manager.utils.FileIOUtils;
 import com.github.tobato.fastdfs.domain.StorePath;
 import com.github.tobato.fastdfs.proto.storage.DownloadByteArray;
 import com.github.tobato.fastdfs.service.FastFileStorageClient;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.FilenameUtils;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Component;
 
 import javax.annotation.Resource;
+import javax.imageio.ImageIO;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.awt.image.BufferedImage;
 import java.io.*;
+import java.net.URL;
+import java.net.URLEncoder;
+import java.util.List;
+import java.util.UUID;
 
+@Slf4j
 @Component
 public class FastDFSClient {
+
+    private static FastFileStorageClient storageClient;
+    private static String config;
+    private static String imageDomain;
+
     @Resource
-    private FastFileStorageClient storageClient;
+    public void setStorageClient(FastFileStorageClient storageClient) {
+        FastDFSClient.storageClient = storageClient;
+    }
 
+    @Value("${cm.config}")
+    public void setConfig(String config) {
+        FastDFSClient.config = config;
+    }
+    @Value("${caimei.imageDomain}")
+    public void setImageDomain(String imageDomain) {
+        FastDFSClient.imageDomain = imageDomain;
+    }
 
     // 文件上传
-    public String uploadFile(String path) throws FileNotFoundException {
+    public static String uploadFile(String path) throws FileNotFoundException {
         File file = new File(path);
         InputStream input = new FileInputStream(file);
         long size = FileUtils.sizeOf(file);
@@ -28,7 +58,7 @@ public class FastDFSClient {
     }
 
     // 文件下载
-    public boolean downloadFile(String path, String downloadFilePath) throws IOException {
+    public static boolean downloadFile(String path, String downloadFilePath) throws IOException {
         File file = new File(downloadFilePath);
         FileOutputStream outputStream = null;
         // fastdfs 文件读取
@@ -41,4 +71,92 @@ public class FastDFSClient {
         return true;
     }
 
+    /**
+     * 保存文件到FastDFS
+     */
+    public static String saveFile(ByteArrayInputStream inputStream) throws IOException {
+        String randomStr = UUID.randomUUID().toString();
+        String name = ".jpeg";
+        // 图片暂存本地服务器路径
+        String filePath = "/mnt/newdatadrive/data/runtime/jar-instance/manager-api/tempImage/";
+        if ("dev".equals(config)) {
+            filePath = "D:\\";
+        }
+        filePath += randomStr + name;
+        FileOutputStream outputStream = new FileOutputStream(filePath);
+        int i = 0;
+        byte[] buffer = new byte[200];
+        while ((i = inputStream.read(buffer)) != -1) {
+            outputStream.write(buffer, 0, i);
+        }
+        outputStream.flush();
+        outputStream.close();
+        inputStream.close();
+        // 临时图片
+        File tempFile = new File(filePath);
+        log.info("【图片上传】>>>>>>>>>>>>>>>>图片临时路径:" + filePath);
+        String fileUrl = uploadFile(filePath);
+        // 删除临时图片
+        boolean delete = tempFile.delete();
+        log.info("【图片上传】>>>>>>>>>>>>>>>>删除临时图片:" + delete);
+        return imageDomain + "/" +fileUrl;
+    }
+
+    /**
+     * 保存文件到FastDFS
+     */
+    public static String saveImage(BufferedImage image) {
+        try {
+            return saveFile(new ByteArrayInputStream(ImageUtils.bufImg2Bytes(image)));
+        } catch (IOException e) {
+            log.error("【图片上传异常】>>>>>>>>>>>>>>>>:" + e);
+            return null;
+        }
+    }
+
+    public static void download(HttpServletRequest request, HttpServletResponse response, String filePath, String fileName) throws IOException {
+            File file = new File(filePath);
+            //  文件存在才下载
+            if (file.exists()) {
+            OutputStream out = null;
+            FileInputStream in = null;
+            try {
+                // 1.读取要下载的内容
+                in = new FileInputStream(file);
+                // 2. 告诉浏览器下载的方式以及一些设置
+                // 解决文件名乱码问题,获取浏览器类型,转换对应文件名编码格式,IE要求文件名必须是utf-8, firefo要求是iso-8859-1编码
+                String agent = request.getHeader("user-agent");
+                if (agent.contains("FireFox")) {
+                    fileName = new String(fileName.getBytes("UTF-8"), "iso-8859-1");
+                } else {
+                    fileName = URLEncoder.encode(fileName, "UTF-8");
+                }
+                // 设置下载文件的mineType,告诉浏览器下载文件类型
+                String mineType = request.getServletContext().getMimeType(fileName);
+                response.setContentType(mineType);
+                // 设置一个响应头,无论是否被浏览器解析,都下载
+                response.setHeader("Content-disposition", "attachment; filename=" + fileName);
+                // 将要下载的文件内容通过输出流写到浏览器
+                out = response.getOutputStream();
+                int len = 0;
+                byte[] buffer = new byte[1024];
+                while ((len = in.read(buffer)) > 0) {
+                    out.write(buffer, 0, len);
+                }
+            } catch (IOException e) {
+                e.printStackTrace();
+            } finally {
+                if (out != null) {
+                    out.close();
+                }
+                if (in != null) {
+                    in.close();
+                }
+                file.delete();
+            }
+        }
+    }
+
+
+
 }

+ 8 - 4
src/main/java/com/caimei365/manager/config/GlobalControllerAdvice.java

@@ -14,6 +14,8 @@ import javax.servlet.http.HttpServletRequest;
 import javax.validation.ConstraintViolation;
 import javax.validation.ConstraintViolationException;
 import java.beans.PropertyEditorSupport;
+import java.io.PrintWriter;
+import java.io.StringWriter;
 import java.time.LocalDateTime;
 import java.util.Date;
 import java.util.Iterator;
@@ -33,16 +35,18 @@ public class GlobalControllerAdvice {
         String msg ="入参错误!";
         if (iterator.hasNext()) {
             ConstraintViolation<?> cvl = iterator.next();
-            msg=cvl.getPropertyPath().toString().split("\\.")[1] + " " + cvl.getMessageTemplate();
+            // msg=cvl.getPropertyPath().toString().split("\\.")[1] + " " + cvl.getMessageTemplate();
+            msg = cvl.getMessageTemplate();
         }
         return ResponseJson.error(msg);
     }
 
     @ResponseBody
     @ExceptionHandler(value = Exception.class)
-    public ResponseJson Exception(HttpServletRequest request, Exception e){
-        log.error("出错了:[\u001B[31m {} \u001B[0m]",e.toString());
-        e.printStackTrace();
+    public ResponseJson Exception(HttpServletRequest request, Exception e) {
+        StringWriter stringWriter = new StringWriter();
+        e.printStackTrace(new PrintWriter(stringWriter));
+        log.error("出错了:[\u001B[31m {} \u001B[0m]", stringWriter);
         return ResponseJson.error("操作失败!");
     }
 

+ 15 - 0
src/main/java/com/caimei365/manager/config/WebConfig.java

@@ -1,8 +1,12 @@
 package com.caimei365.manager.config;
 
+import org.springframework.boot.web.servlet.MultipartConfigFactory;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
+import org.springframework.util.unit.DataSize;
+
+import javax.servlet.MultipartConfigElement;
 
 /**
  * Description
@@ -19,4 +23,15 @@ public class WebConfig {
     public BCryptPasswordEncoder bCryptPasswordEncoder() {
         return new BCryptPasswordEncoder();
     }
+
+
+    @Bean
+    public MultipartConfigElement multipartConfigElement() {
+        MultipartConfigFactory factory = new MultipartConfigFactory();
+        //文件最大
+        factory.setMaxFileSize(DataSize.parse("200MB"));
+        //设置总上传数据总大小
+        factory.setMaxRequestSize(DataSize.parse("200MB"));
+        return factory.createMultipartConfig();
+    }
 }

+ 151 - 0
src/main/java/com/caimei365/manager/controller/caimei/providers/ProvidersApi.java

@@ -0,0 +1,151 @@
+package com.caimei365.manager.controller.caimei.providers;
+
+import com.caimei365.manager.FastDFS.FastDFSClient;
+import com.caimei365.manager.entity.PaginationVo;
+import com.caimei365.manager.entity.ResponseJson;
+import com.caimei365.manager.entity.caimei.CmRelatedImage;
+import com.caimei365.manager.entity.caimei.providers.CmProviders;
+import com.caimei365.manager.entity.caimei.providers.CmProvidersContract;
+import com.caimei365.manager.service.caimei.providers.CmProvidersContractService;
+import com.caimei365.manager.service.caimei.providers.CmProvidersService;
+import com.github.pagehelper.PageHelper;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.validation.constraints.NotBlank;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 功能描述:服务商入驻Controller
+ *
+ * @auther: Kaick
+ * @date: 2023/12/13 15:30
+ */
+@Validated
+@RestController
+@RequestMapping("/providers")
+public class ProvidersApi {
+    @Resource
+    private CmProvidersService cmProvidersService;
+    @Resource
+    private CmProvidersContractService cmProvidersContractService;
+
+    @GetMapping("/list")
+    public ResponseJson providersList(String name,
+                                      Integer serviceLevel,
+                                      Integer serviceCategory,
+                                      String qualificationId,
+                                      Date contractStartDate,
+                                      Date contractEndDate,
+                                      @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                      @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<CmProviders> cmProvidersList = cmProvidersService.getCmProvidersList(new CmProviders()
+                .setName(name)
+                .setServiceLevel(serviceLevel)
+                .setServiceCategory(serviceCategory)
+                .setQualificationId(qualificationId)
+                .setContractStartDate(contractStartDate)
+                .setContractEndDate(contractEndDate)
+        );
+        return ResponseJson.success(new PaginationVo(cmProvidersList));
+    }
+
+    @GetMapping("/contract/list")
+    public ResponseJson providersContractList(String contractId,
+                                              @NotNull(message = "服务商ID不能为空") Integer providersId,
+                                              Date contractStartDate,
+                                              Date contractEndDate,
+                                              @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                              @RequestParam(value = "pageSize", defaultValue = "20") int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<CmProvidersContract> cmProvidersContractList = cmProvidersContractService.getCmProvidersContractList(new CmProvidersContract()
+                .setContractId(contractId)
+                .setProvidersId(providersId)
+                .setContractStartDate(contractStartDate)
+                .setContractEndDate(contractEndDate)
+        );
+        return ResponseJson.success(new PaginationVo(cmProvidersContractList));
+    }
+
+    @GetMapping("/from")
+    public ResponseJson providersFrom(String providersId) {
+        if (StringUtils.isBlank(providersId)
+        ) {
+            return ResponseJson.error("参数异常!");
+        }
+        CmProviders providers = cmProvidersService.getCmProvidersById(providersId);
+        return ResponseJson.success(providers);
+    }
+
+    @GetMapping("/contract/from")
+    public ResponseJson providersContractFrom(String providersContractId) {
+        if (StringUtils.isBlank(providersContractId)
+        ) {
+            return ResponseJson.error("参数异常!");
+        }
+        CmProvidersContract providersContract = cmProvidersContractService.getCmProvidersContractById(providersContractId);
+        return ResponseJson.success(providersContract);
+    }
+
+    @PostMapping("/add")
+    public ResponseJson providersAdd(@RequestBody CmProviders cmProviders
+    ) {
+        if (null == cmProviders.getName() ||
+                null == cmProviders.getLinkMan() ||
+                null == cmProviders.getMobile() ||
+                null == cmProviders.getServiceLevel() ||
+                null == cmProviders.getServiceCategory() ||
+                null == cmProviders.getAddress()||
+                null == cmProviders.getTextRelateds()||
+                null == cmProviders.getInfoRelateds()
+        ) {
+            return ResponseJson.error("参数异常!");
+        }
+        cmProvidersService.addCmProviders(cmProviders);
+        return ResponseJson.success();
+    }
+
+    @PostMapping("/updateStatus")
+    public ResponseJson providersUpdateStatus(String userIds, Integer status) {
+        if (null == userIds) {
+            return ResponseJson.error("ID不能为空!");
+        }
+        for (String userId : userIds.split(",")) {
+            cmProvidersService.updateCmProviders(new CmProviders()
+                    .setUserId(Integer.valueOf(userId))
+                    .setStatus(status == 90 ? 90 : 91)
+            );
+        }
+        return ResponseJson.success();
+    }
+
+    @PostMapping("/contract/add")
+    public ResponseJson providersContractAdd(@RequestBody CmProvidersContract cmProvidersContract) {
+        if (null == cmProvidersContract.getProvidersId() ||
+                null == cmProvidersContract.getContractId() ||
+                null == cmProvidersContract.getContractStartDate() ||
+                null == cmProvidersContract.getContractEndDate() ||
+                null == cmProvidersContract.getContractRelateds()
+        ) {
+            return ResponseJson.error("参数异常!");
+        }
+        cmProvidersContractService.addCmProvidersContract(cmProvidersContract);
+        return ResponseJson.success();
+    }
+
+    @GetMapping("/download/image")
+    public void downloadImage(String ids, Integer type, HttpServletRequest request, HttpServletResponse response) throws Exception {
+        if(StringUtils.isBlank(ids)||null==type){
+            return;
+        }
+        cmProvidersService.downloadImage(ids, type, request, response);
+    }
+}

+ 93 - 0
src/main/java/com/caimei365/manager/dao/CmRelatedImageMapper.java

@@ -0,0 +1,93 @@
+package com.caimei365.manager.dao;
+
+import java.util.List;
+
+import com.caimei365.manager.entity.caimei.CmRelatedImage;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 相关图片Mapper接口
+ *
+ * @author Kaick
+ * @date 2023-12-12
+ */
+@Mapper
+public interface CmRelatedImageMapper
+{
+    /**
+     * 通过对象查询相关图片列表
+     *
+     * @param cmRelatedImage 相关图片
+     * @return 相关图片集合
+     */
+    List<CmRelatedImage> getRelatedImageList(CmRelatedImage cmRelatedImage);
+
+
+
+    /**
+     * 通过Id查询相关图片对象
+     *
+     * @param id 相关图片主键
+     * @return 相关图片
+     */
+    CmRelatedImage getCmRelatedImageById(String id);
+
+    /**
+     * 通过对象查询相关图片对象
+     *
+     * @param cmRelatedImage 相关图片
+     * @return 相关图片
+     */
+    CmRelatedImage getByCmRelatedImage(CmRelatedImage cmRelatedImage);
+
+    /**
+     * 通过对象查询相关图片Id
+     *
+     * @param cmRelatedImage 相关图片
+     * @return String
+     */
+    String getById(CmRelatedImage cmRelatedImage);
+
+
+    /**
+     * 通过对象查询相关图片记录总数
+     *
+     * @param cmRelatedImage 相关图片
+     * @return 相关图片Integer
+     */
+    int getCount(CmRelatedImage cmRelatedImage);
+
+    /**
+     * 新增相关图片
+     *
+     * @param cmRelatedImage 相关图片
+     * @return 结果
+     */
+    int addCmRelatedImage(CmRelatedImage cmRelatedImage);
+
+    /**
+     * 修改相关图片
+     *
+     * @param cmRelatedImage 相关图片
+     * @return 结果
+     */
+    int updateCmRelatedImage(CmRelatedImage cmRelatedImage);
+
+    /**
+     * 删除相关图片
+     *
+     * @param id 相关图片主键
+     * @return 结果
+     */
+    int delCmRelatedImageById(String id);
+
+    /**
+     * 批量删除相关图片
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int delCmRelatedImage(CmRelatedImage cmRelatedImage);
+
+}

+ 91 - 0
src/main/java/com/caimei365/manager/dao/CmRelatedMapper.java

@@ -0,0 +1,91 @@
+package com.caimei365.manager.dao;
+
+import java.util.List;
+
+import com.caimei365.manager.entity.caimei.CmRelated;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 相关资源Mapper接口
+ *
+ * @author Kaick
+ * @date 2023-12-12
+ */
+@Mapper
+public interface CmRelatedMapper
+{
+    /**
+     * 通过对象查询相关资源列表
+     *
+     * @param cmRelated 相关资源
+     * @return 相关资源集合
+     */
+    List<CmRelated> getCmRelatedList(CmRelated cmRelated);
+
+    /**
+     * 通过Id查询相关资源对象
+     *
+     * @param id 相关资源主键
+     * @return 相关资源
+     */
+    CmRelated getCmRelatedById(String id);
+
+    /**
+     * 通过对象查询相关资源对象
+     *
+     * @param cmRelated 相关资源
+     * @return 相关资源
+     */
+    CmRelated getByCmRelated(CmRelated cmRelated);
+
+    /**
+     * 通过对象查询相关资源Id
+     *
+     * @param cmRelated 相关资源
+     * @return String
+     */
+    String getById(CmRelated cmRelated);
+
+
+    /**
+     * 通过对象查询相关资源记录总数
+     *
+     * @param cmRelated 相关资源
+     * @return 相关资源Integer
+     */
+    int getCount(CmRelated cmRelated);
+
+    /**
+     * 新增相关资源
+     *
+     * @param cmRelated 相关资源
+     * @return 结果
+     */
+    int addCmRelated(CmRelated cmRelated);
+
+    /**
+     * 修改相关资源
+     *
+     * @param cmRelated 相关资源
+     * @return 结果
+     */
+    int updateCmRelated(CmRelated cmRelated);
+
+    /**
+     * 删除相关资源
+     *
+     * @param id 相关资源主键
+     * @return 结果
+     */
+    int delCmRelatedById(String id);
+
+    /**
+     * 批量删除相关资源
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int delCmRelated(CmRelated cmRelated);
+
+}

+ 88 - 0
src/main/java/com/caimei365/manager/dao/providers/CmProvidersContractMapper.java

@@ -0,0 +1,88 @@
+package com.caimei365.manager.dao.providers;
+
+import java.util.List;
+
+import com.caimei365.manager.entity.caimei.providers.CmProvidersContract;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * Mapper接口
+ *
+ * @author Kaick
+ * @date 2023-12-12
+ */
+@Mapper
+public interface CmProvidersContractMapper
+{
+    /**
+     * 通过对象查询列表
+     *
+     * @param cmProvidersContract
+     * @return 集合
+     */
+    List<CmProvidersContract> getCmProvidersContractList(CmProvidersContract cmProvidersContract);
+
+    /**
+     * 通过Id查询对象
+     *
+     * @param id 主键
+     * @return
+     */
+    CmProvidersContract getCmProvidersContractById(String id);
+
+    /**
+     * 通过对象查询对象
+     *
+     * @param cmProvidersContract
+     * @return
+     */
+    CmProvidersContract getByCmProvidersContract(CmProvidersContract cmProvidersContract);
+
+    /**
+     * 通过对象查询Id
+     *
+     * @param cmProvidersContract
+     * @return String
+     */
+    String getById(CmProvidersContract cmProvidersContract);
+
+
+    /**
+     * 通过对象查询记录总数
+     *
+     * @param cmProvidersContract
+     * @return Integer
+     */
+    int getCount(CmProvidersContract cmProvidersContract);
+
+    /**
+     * 新增
+     *
+     * @param cmProvidersContract
+     * @return 结果
+     */
+    int addCmProvidersContract(CmProvidersContract cmProvidersContract);
+
+    /**
+     * 修改
+     *
+     * @param cmProvidersContract
+     * @return 结果
+     */
+    int updateCmProvidersContract(CmProvidersContract cmProvidersContract);
+
+    /**
+     * 删除
+     *
+     * @param id 主键
+     * @return 结果
+     */
+    int delCmProvidersContractById(String id);
+
+    /**
+     * 批量删除
+     */
+    int delCmProvidersContract(CmProvidersContract cmProvidersContract);
+
+}

+ 99 - 0
src/main/java/com/caimei365/manager/dao/providers/CmProvidersMapper.java

@@ -0,0 +1,99 @@
+package com.caimei365.manager.dao.providers;
+
+import java.util.List;
+
+import com.caimei365.manager.entity.caimei.providers.CmProviders;
+import com.caimei365.manager.entity.po.UploadFilePo;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * Mapper接口
+ *
+ * @author Kaick
+ * @date 2023-12-12
+ */
+@Mapper
+public interface CmProvidersMapper
+{
+    /**
+     * 通过对象查询列表
+     *
+     * @param cmProviders
+     * @return 集合
+     */
+    List<CmProviders> getCmProvidersList(CmProviders cmProviders);
+
+    /**
+     * 通过Id查询对象
+     *
+     * @param id 主键
+     * @return
+     */
+    CmProviders getCmProvidersById(String id);
+
+    /**
+     * 通过对象查询对象
+     *
+     * @param cmProviders
+     * @return
+     */
+    CmProviders getByCmProviders(CmProviders cmProviders);
+
+    /**
+     * 通过对象查询Id
+     *
+     * @param cmProviders
+     * @return String
+     */
+    String getById(CmProviders cmProviders);
+
+
+    /**
+     * 通过对象查询记录总数
+     *
+     * @param cmProviders
+     * @return Integer
+     */
+    int getCount(CmProviders cmProviders);
+
+    /**
+     * 新增
+     *
+     * @param cmProviders
+     * @return 结果
+     */
+    int addCmProviders(CmProviders cmProviders);
+
+    /**
+     * 修改
+     *
+     * @param cmProviders
+     * @return 结果
+     */
+    int updateCmProviders(CmProviders cmProviders);
+
+    /**
+     * 删除
+     *
+     * @param id 主键
+     * @return 结果
+     */
+    int delCmProvidersById(String id);
+
+    /**
+     * 批量删除
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    int delCmProviders(CmProviders cmProviders);
+    /**
+     * 批量删除
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    List<UploadFilePo> getProvidersUploadFileList(@Param("ids") String ids, @Param("type") Integer type);
+
+}

+ 91 - 0
src/main/java/com/caimei365/manager/dao/user/UserMapper.java

@@ -0,0 +1,91 @@
+package com.caimei365.manager.dao.user;
+
+import java.util.List;
+
+import com.caimei365.manager.entity.caimei.cmUser.User;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * 用户信息Mapper接口
+ *
+ * @author Kaick
+ * @date 2023-12-14
+ */
+@Mapper
+public interface UserMapper
+{
+    /**
+     * 通过对象查询用户信息列表
+     *
+     * @param user 用户信息
+     * @return 用户信息集合
+     */
+    List<User> getUserList(User user);
+
+    /**
+     * 通过Id查询用户信息对象
+     *
+     * @param userID 用户信息主键
+     * @return 用户信息
+     */
+    User getUserById(String userID);
+
+    /**
+     * 通过对象查询用户信息对象
+     *
+     * @param user 用户信息
+     * @return 用户信息
+     */
+    User getByUser(User user);
+
+    /**
+     * 通过对象查询用户信息Id
+     *
+     * @param user 用户信息
+     * @return String
+     */
+    String getById(User user);
+
+
+    /**
+     * 通过对象查询用户信息记录总数
+     *
+     * @param user 用户信息
+     * @return 用户信息Integer
+     */
+    int getCount(User user);
+
+    /**
+     * 新增用户信息
+     *
+     * @param user 用户信息
+     * @return 结果
+     */
+    int addUser(User user);
+
+    /**
+     * 修改用户信息
+     *
+     * @param user 用户信息
+     * @return 结果
+     */
+    int updateUser(User user);
+
+    /**
+     * 删除用户信息
+     *
+     * @param userID 用户信息主键
+     * @return 结果
+     */
+    int delUserByUserID(String userID);
+
+    /**
+     * 批量删除用户信息
+     *
+     * @param  需要删除的数据主键集合
+     * @return 结果
+     */
+    int delUser(User user);
+
+}

+ 70 - 0
src/main/java/com/caimei365/manager/entity/caimei/CmRelated.java

@@ -0,0 +1,70 @@
+package com.caimei365.manager.entity.caimei;
+
+import java.io.Serializable;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.apache.ibatis.type.Alias;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.util.Date;
+
+/**
+ * 相关资源对象 cm_related
+ *
+ * @author Kaick
+ * @date 2023-12-12
+ */
+@Accessors(chain = true)
+@Data
+@Alias("CmRelated")
+public class CmRelated implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * $column.columnComment
+     */
+    private String id;
+
+    /**
+     * 分类: 1 (info)相关文章,2 (info)精选文章
+     */
+    private String type;
+
+    /**
+     * 归属者Id(type字段表Id)
+     */
+    private String authorId;
+
+    /**
+     * 相关Id(type字段表Id)
+     */
+    private String relatedId;
+
+    /**
+     * 删除状态 0正常,其他删除
+     */
+    private Integer delFlag;
+
+    /**
+     * 修改时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date updateTime;
+
+    /**
+     * 添加时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date createTime;
+
+    /**
+     * 排序值
+     */
+    private Integer sort;
+
+
+}
+
+
+

+ 67 - 0
src/main/java/com/caimei365/manager/entity/caimei/CmRelatedImage.java

@@ -0,0 +1,67 @@
+package com.caimei365.manager.entity.caimei;
+
+import java.io.Serializable;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.apache.ibatis.type.Alias;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import java.util.Date;
+
+/**
+ * 相关图片对象 cm_related_image
+ *
+ * @author Kaick
+ * @date 2023-12-12
+ */
+@Accessors(chain  = true )
+@Data
+@Alias("CmRelatedImage")
+public class CmRelatedImage implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    /** id */
+    private String id;
+
+    /**
+     * 分类:1分销报备凭证图片(cm_reporting_member)分类:1分销报备凭证图片(cm_reporting_member)
+     * ,2 (cm_providers)服务商相关简介图
+     * ,3 (cm_providers)服务商相关资料文件
+     * ,4 (cm_providers_contract)服务商相关合同文件
+     */
+    private String type;
+
+    /**
+     * 归属者Id(type字段表Id)
+     */
+    private String authorId;
+
+    /**
+     * 原文件名
+     */
+    private String fileName;
+    /**
+     * 图片
+     */
+    private String image;
+
+    /**
+     * 删除状态 0正常,其他删除
+     */
+    private Integer delFlag;
+
+    /**
+     * 修改时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date updateTime;
+
+    /** 添加时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date createTime;
+
+
+}
+
+
+

+ 253 - 0
src/main/java/com/caimei365/manager/entity/caimei/cmUser/User.java

@@ -0,0 +1,253 @@
+package com.caimei365.manager.entity.caimei.cmUser;
+
+import java.math.BigDecimal;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import java.io.Serializable;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.apache.ibatis.type.Alias;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.util.Date;
+
+/**
+ * 用户信息对象 user
+ *
+ * @author Kaick
+ * @date 2023-12-14
+ */
+@Accessors(chain = true)
+@Data
+@Alias("User")
+public class User implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     *
+     */
+    private String userID;
+
+    /**
+     * 采美组织默认为0,具体对应cm_mall_organize表ID
+     */
+    private Integer userOrganizeID;
+
+    /**
+     * 企业账号名【供应商,目前只存数据不能用于登录】
+     */
+    private String account;
+
+    /**
+     * 个人手机号码(协销)
+     */
+    private String mobile;
+
+    /**
+     * 企业绑定手机号(机构,供应商)
+     */
+    private String bindMobile;
+
+    /**
+     * 用户权限 0游客 1 普通用户 2 会员机构 3 供应商 4 协销 5 普通机构 6 呵呵商城用户【V6.2.0版本后0和1不存在】
+     */
+    private Integer userPermission;
+
+    /**
+     * 用户身份 0、个人 1、协销 2、会员机构 3、供应商 4.普通机构 6、呵呵商城用户,7分销人员,8 分销人员生成机构【V6.2.0版本后0不存在】
+     */
+    private Integer userIdentity;
+
+    /**
+     * 邮箱
+     */
+    private String email;
+
+    /**
+     * 用户名(机构联系人,供应商简称)
+     */
+    private String userName;
+
+    /**
+     * 真实姓名(供应商的联系人,机构不使用)
+     */
+    private String realName;
+
+    /**
+     * 注册来源: 0网站 1小程序
+     */
+    private String source;
+
+    /**
+     * 头像
+     */
+    private String image;
+
+    /**
+     * 密码
+     */
+    private String password;
+
+    /**
+     * 名称(机构名称,供应商的公司名称)
+     */
+    private String name;
+
+    /**
+     * 见枚举UserType(1供应商,2协销经理,32协销,3会员机构,4普通机构,6呵呵商城)
+     */
+    private String registerUserTypeID;
+
+    /**
+     * 供应商状态, 3待审核, 90已上线,91已下线,92审核不通过
+     */
+    private Integer manufacturerStatus;
+
+    /**
+     * 供应商Id
+     */
+    private Integer shopID;
+
+    /**
+     * 审核状态
+     */
+    private String auditStatus;
+
+    /**
+     * 审核时间
+     */
+    private String auditTime;
+
+    /**
+     * 审核备注
+     */
+    private String auditNote;
+
+    /**
+     * 注册时间
+     */
+    private String registerTime;
+
+    /**
+     * 注册ip
+     */
+    private String registerIP;
+
+    /**
+     * 注册IP所属地
+     */
+    private String ipAddress;
+
+    /**
+     * 登录时间
+     */
+    private String loginTime;
+
+    /**
+     * 登录ip
+     */
+    private String loginIP;
+
+    /**
+     * 用户状态,1正常,0冻结
+     */
+    private String validFlag;
+
+    /**
+     * 会所状态,见表c_clubstatus或枚举ClubStatus
+     */
+    private Integer clubStatus;
+
+    /**
+     * 会所Id
+     */
+    private Integer clubID;
+
+    /**
+     * 同意协议标志
+     */
+    private String agreeFlag;
+
+    /**
+     * 创客状态
+     */
+    private Integer serviceProviderStatus;
+
+    /**
+     * 创客Id
+     */
+    private Integer serviceProviderID;
+
+    /**
+     * 账户线下余额
+     */
+    private BigDecimal userMoney;
+
+    /**
+     * 账户实际可用余额(提交订单未支付的被抵扣后的余额)
+     */
+    private BigDecimal ableUserMoney;
+
+    /**
+     * 退出时间
+     */
+    private String logoffTime;
+
+    /**
+     *
+     */
+    private String appKey;
+
+    /**
+     *
+     */
+    private String appSecret;
+
+    /**
+     * 扫描标志(4 CRM拉上来的会所) 0待扫描 1 已扫描 2已上线
+     */
+    private Integer scanFlag;
+
+    /**
+     * 采美豆数量
+     */
+    private Integer userBeans;
+
+    /**
+     * 是否已经引导过(供应商首次登陆操作引导/普通机构升级引导)
+     */
+    private Integer guideFlag;
+
+    /**
+     *
+     */
+    private Integer loginFailTime;
+
+    /**
+     *
+     */
+    private String tipStatus;
+
+    /**
+     * 账户线上余额
+     */
+    private BigDecimal onlineMoney;
+
+    /**
+     * 微信unionId
+     */
+    private String unionId;
+
+    /**
+     * 小程序openid
+     */
+    private String openId;
+
+
+}
+
+
+

+ 139 - 0
src/main/java/com/caimei365/manager/entity/caimei/providers/CmProviders.java

@@ -0,0 +1,139 @@
+package com.caimei365.manager.entity.caimei.providers;
+
+import java.io.Serializable;
+
+import com.caimei365.manager.entity.caimei.CmRelatedImage;
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.apache.ibatis.type.Alias;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 对象 cm_providers
+ *
+ * @author Kaick
+ * @date 2023-12-12
+ */
+@Accessors(chain = true)
+@Data
+@Alias("CmProviders")
+public class CmProviders implements Serializable {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * id
+     */
+    private String id;
+
+    /**
+     * 用户Id
+     */
+    private Integer userId;
+
+    /**
+     * 服务商名称
+     */
+    private String name;
+
+    /**
+     * 服务商级别为:1级,2级,3级
+     */
+    private Integer serviceLevel;
+
+    /**
+     * 服务商类型: 1个人,2企业
+     */
+    private Integer serviceCategory;
+    /**
+     * 状态:90上线,91下线
+     */
+    private Integer status;
+
+    /**
+     * 服务商地址
+     */
+    private String address;
+
+    /**
+     * 联系人
+     */
+    private String linkMan;
+
+    /**
+     * 联系电话
+     */
+    private String mobile;
+
+    /**
+     * 简介
+     */
+    private String text;
+
+    /**
+     * 服务商二维码
+     */
+    private String qrCodeImage;
+
+    /**
+     * 资格证书图片
+     */
+    private String qualificationImage;
+
+    /**
+     * 资格证书编号
+     */
+    private String qualificationId;
+
+
+    /**
+     * 创建人
+     */
+    private String createBy;
+
+    /**
+     * 修改时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date updateTime;
+
+    /**
+     * 添加时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date createTime;
+
+    /**
+     * 相关简介图集合
+     */
+    private List<CmRelatedImage> textRelateds;
+
+    /**
+     * 相关资料文件集合
+     */
+    private List<CmRelatedImage> infoRelateds;
+
+
+    //服务商合同
+    /**
+     * 合同起始日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date contractStartDate;
+
+    /**
+     * 合同截止日期
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date contractEndDate;
+
+    /**
+     * 合同对象
+     */
+    private CmProvidersContract contract;
+}
+
+
+

+ 77 - 0
src/main/java/com/caimei365/manager/entity/caimei/providers/CmProvidersContract.java

@@ -0,0 +1,77 @@
+package com.caimei365.manager.entity.caimei.providers;
+
+import java.util.Date;
+
+import com.caimei365.manager.entity.caimei.CmRelatedImage;
+import com.fasterxml.jackson.annotation.JsonFormat;
+
+import java.io.Serializable;
+import java.util.List;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.apache.ibatis.type.Alias;
+
+/**
+ * 对象 cm_providers_contract
+ *
+ * @author Kaick
+ * @date 2023-12-12
+ */
+@Accessors(chain  = true )
+@Data
+@Alias("CmProvidersContract")
+public class CmProvidersContract implements Serializable
+{
+    private static final long serialVersionUID = 1L;
+
+    /** id */
+    private String id;
+
+    /** 服务商id */
+    private Integer providersId;
+
+    /** 合同编号 */
+    private String contractId;
+
+    /** 合同起始日期 */
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date contractStartDate;
+
+    /** 合同截止日期 */
+    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
+    private Date contractEndDate;
+
+
+    /**
+     * 相关合同文件集合
+     */
+    private List<CmRelatedImage> contractRelateds;
+
+    /**
+     * 创建人
+     */
+    private String createBy;
+
+    /**
+     * 修改时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date updateTime;
+
+    /**
+     * 添加时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date createTime;
+
+    /**
+     * 是否新增标志
+     */
+    private Boolean flag=true;
+
+
+}
+
+
+

+ 25 - 0
src/main/java/com/caimei365/manager/entity/po/UploadFilePo.java

@@ -0,0 +1,25 @@
+package com.caimei365.manager.entity.po;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+import org.apache.ibatis.type.Alias;
+
+/**
+ * 功能描述:
+ * @auther: Kaick
+ * @date: 2023/12/13 17:57
+ */
+@Accessors(chain = true)
+@Alias("UploadFilePo")
+@Data
+public class UploadFilePo {
+    /**
+     * 文件名称
+     */
+    private String fileName;
+
+    /**
+     * 文件链接
+     */
+    private String fileUrl;
+}

+ 59 - 0
src/main/java/com/caimei365/manager/service/caimei/providers/CmProvidersContractService.java

@@ -0,0 +1,59 @@
+package com.caimei365.manager.service.caimei.providers;
+
+import com.caimei365.manager.entity.caimei.providers.CmProvidersContract;
+
+import java.util.List;
+
+/**
+ * Service接口
+ *
+ * @author Kaick
+ * @date 2023-12-12
+ */
+public interface CmProvidersContractService
+{
+    /**
+     * 通过对象查询列表
+     *
+     * @param cmProvidersContract
+     * @return 集合
+     */
+    List<CmProvidersContract> getCmProvidersContractList(CmProvidersContract cmProvidersContract);
+
+    /**
+     * 通过Id查询
+     *
+     * @param id 主键
+     * @return
+     */
+    CmProvidersContract getCmProvidersContractById(String id);
+
+    /**
+     * 通过对象查询
+     *
+     * @param cmProvidersContract
+     * @return
+     */
+    CmProvidersContract getByCmProvidersContract(CmProvidersContract cmProvidersContract);
+
+
+    /**
+     * 新增
+     *
+     * @param cmProvidersContract
+     * @return 结果
+     */
+    int addCmProvidersContract(CmProvidersContract cmProvidersContract);
+
+    /**
+     * 修改
+     *
+     * @param cmProvidersContract
+     * @return 结果
+     */
+    int updateCmProvidersContract(CmProvidersContract cmProvidersContract);
+
+
+}
+
+

+ 66 - 0
src/main/java/com/caimei365/manager/service/caimei/providers/CmProvidersService.java

@@ -0,0 +1,66 @@
+package com.caimei365.manager.service.caimei.providers;
+
+import com.caimei365.manager.entity.caimei.providers.CmProviders;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.List;
+
+/**
+ * Service接口
+ *
+ * @author Kaick
+ * @date 2023-12-12
+ */
+public interface CmProvidersService {
+    /**
+     * 通过对象查询列表
+     *
+     * @param cmProviders
+     * @return 集合
+     */
+    List<CmProviders> getCmProvidersList(CmProviders cmProviders);
+
+    /**
+     * 通过Id查询
+     *
+     * @param id 主键
+     * @return
+     */
+    CmProviders getCmProvidersById(String id);
+
+    /**
+     * 通过对象查询
+     *
+     * @param cmProviders
+     * @return
+     */
+    CmProviders getByCmProviders(CmProviders cmProviders);
+
+
+    /**
+     * 新增
+     *
+     * @param cmProviders
+     * @return 结果
+     */
+    int addCmProviders(CmProviders cmProviders);
+
+    /**
+     * 修改
+     *
+     * @param cmProviders
+     * @return 结果
+     */
+    int updateCmProviders(CmProviders cmProviders);
+
+    /**
+     *下載圖片
+     */
+    void downloadImage(String ids, Integer type, HttpServletRequest request, HttpServletResponse response) throws Exception;
+
+
+}
+
+
+

+ 144 - 0
src/main/java/com/caimei365/manager/service/caimei/providers/impl/CmProvidersContractServiceImpl.java

@@ -0,0 +1,144 @@
+package com.caimei365.manager.service.caimei.providers.impl;
+
+import java.awt.image.BufferedImage;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Date;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+import com.caimei365.manager.FastDFS.FastDFSClient;
+import com.caimei365.manager.dao.CmRelatedImageMapper;
+import com.caimei365.manager.dao.providers.CmProvidersContractMapper;
+import com.caimei365.manager.dao.providers.CmProvidersMapper;
+import com.caimei365.manager.entity.caimei.CmRelatedImage;
+import com.caimei365.manager.entity.caimei.providers.CmProviders;
+import com.caimei365.manager.entity.caimei.providers.CmProvidersContract;
+import com.caimei365.manager.service.caimei.providers.CmProvidersContractService;
+import com.caimei365.manager.service.caimei.providers.utils.ImageUtils;
+import com.caimei365.manager.service.caimei.providers.utils.ProvidersTemplate;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
+
+import javax.annotation.Resource;
+import javax.imageio.ImageIO;
+
+/**
+ * Service业务层处理
+ *
+ * @author Kaick
+ * @date 2023-12-12
+ */
+@Service
+public class CmProvidersContractServiceImpl implements CmProvidersContractService {
+    @Resource
+    private CmProvidersContractMapper cmProvidersContractMapper;
+    @Resource
+    private CmProvidersMapper cmProvidersMapper;
+
+    @Resource
+    private CmRelatedImageMapper cmRelatedImageMapper;
+
+    /**
+     * 通过对象查询列表
+     *
+     * @param cmProvidersContract
+     * @return
+     */
+    @Override
+    public List<CmProvidersContract> getCmProvidersContractList(CmProvidersContract cmProvidersContract) {
+        List<CmProvidersContract> cmProvidersContractList = cmProvidersContractMapper.getCmProvidersContractList(cmProvidersContract);
+        return cmProvidersContractList;
+    }
+
+    /**
+     * 通过Id查询
+     *
+     * @param id 主键
+     * @return
+     */
+    @Override
+    public CmProvidersContract getCmProvidersContractById(String id) {
+        CmProvidersContract cmProvidersContractById = cmProvidersContractMapper.getCmProvidersContractById(id);
+        cmProvidersContractById.setContractRelateds(cmRelatedImageMapper.getRelatedImageList(new CmRelatedImage().setType("4").setAuthorId(cmProvidersContractById.getId())));
+        return cmProvidersContractById;
+    }
+
+    /**
+     * 通过对象查询
+     *
+     * @param cmProvidersContract
+     * @return
+     */
+    @Override
+    public CmProvidersContract getByCmProvidersContract(CmProvidersContract cmProvidersContract) {
+        CmProvidersContract byCmProvidersContract = cmProvidersContractMapper.getByCmProvidersContract(cmProvidersContract);
+        byCmProvidersContract.setContractRelateds(cmRelatedImageMapper.getRelatedImageList(new CmRelatedImage().setType("4").setAuthorId(cmProvidersContract.getId())));
+        return byCmProvidersContract;
+    }
+
+
+    /**
+     * 新增
+     *
+     * @param cmProvidersContract
+     * @return 结果
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public int addCmProvidersContract(CmProvidersContract cmProvidersContract) {
+        CmProviders cmProviders = cmProvidersMapper.getCmProvidersById(String.valueOf(cmProvidersContract.getProvidersId()));
+        String levelName = cmProviders.getServiceLevel() == 1 ? "一级" : cmProviders.getServiceLevel() == 2 ? "二级" : "三级";
+        BufferedImage image = null;
+        try {
+            image = ImageIO.read(new URL("https://img-b.caimei365.com/group1/M00/04/50/rB-lHGV6WsWABl00AARW2RH48Zg563.jpg"));
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        BufferedImage realQrCodeImage = ImageUtils.createRealQrCode("https://www.caimei365.com/settlementInfo.html?id=" + cmProvidersContract.getProvidersId(), 1000);                //生成二维码
+        cmProvidersMapper.updateCmProviders(new CmProviders()
+                .setId(String.valueOf(cmProvidersContract.getProvidersId()))
+                .setQrCodeImage(FastDFSClient.saveImage(realQrCodeImage))
+                .setQualificationImage(ProvidersTemplate.setQualificationImage(image, cmProviders.getName(),    //生成资格证书
+                        levelName,
+                        cmProvidersContract.getContractStartDate(),
+                        cmProvidersContract.getContractEndDate(),
+                        cmProviders.getQualificationId(),
+                        realQrCodeImage))
+        );
+        if(cmProvidersContract.getFlag()){
+            if (null == cmProvidersContract.getId()) {
+                cmProvidersContractMapper.addCmProvidersContract(cmProvidersContract); //新增服务商合同
+                for (CmRelatedImage contractRelatedImage : cmProvidersContract.getContractRelateds()) {
+                    cmRelatedImageMapper.addCmRelatedImage(new CmRelatedImage().setType("4").setAuthorId(cmProvidersContract.getId()).setImage(contractRelatedImage.getImage()).setFileName(contractRelatedImage.getFileName()));   //新增服务商合同文件
+                }
+            } else {
+                cmProvidersContractMapper.updateCmProvidersContract(cmProvidersContract); //新增服务商合同
+                CmRelatedImage cmRelatedImage = new CmRelatedImage().setType("4").setAuthorId(cmProvidersContract.getId());
+                cmRelatedImageMapper.delCmRelatedImage(cmRelatedImage);
+                for (CmRelatedImage contractRelatedImage : cmProvidersContract.getContractRelateds()) {
+                    cmRelatedImageMapper.addCmRelatedImage(cmRelatedImage.setImage(contractRelatedImage.getImage()).setFileName(contractRelatedImage.getFileName()));     //新增服务商合同文件
+                }
+            }
+        }
+        return 1;
+    }
+
+    /**
+     * 修改
+     *
+     * @param cmProvidersContract
+     * @return 结果
+     */
+    @Override
+    public int updateCmProvidersContract(CmProvidersContract cmProvidersContract) {
+        cmProvidersContract.setUpdateTime(new Date());
+        return cmProvidersContractMapper.updateCmProvidersContract(cmProvidersContract);
+    }
+
+
+}
+
+
+

+ 209 - 0
src/main/java/com/caimei365/manager/service/caimei/providers/impl/CmProvidersServiceImpl.java

@@ -0,0 +1,209 @@
+package com.caimei365.manager.service.caimei.providers.impl;
+
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Date;
+import java.util.List;
+import java.util.NoSuchElementException;
+
+import com.caimei365.manager.FastDFS.FastDFSClient;
+import com.caimei365.manager.config.utils.DateUtil;
+import com.caimei365.manager.dao.CmRelatedImageMapper;
+import com.caimei365.manager.dao.providers.CmProvidersContractMapper;
+import com.caimei365.manager.dao.providers.CmProvidersMapper;
+import com.caimei365.manager.dao.user.UserMapper;
+import com.caimei365.manager.entity.caimei.CmRelatedImage;
+import com.caimei365.manager.entity.caimei.cmUser.User;
+import com.caimei365.manager.entity.caimei.providers.CmProviders;
+import com.caimei365.manager.entity.caimei.providers.CmProvidersContract;
+import com.caimei365.manager.entity.po.UploadFilePo;
+import com.caimei365.manager.service.caimei.providers.CmProvidersContractService;
+import com.caimei365.manager.service.caimei.providers.CmProvidersService;
+import com.caimei365.manager.service.caimei.providers.utils.ImageUtils;
+import com.caimei365.manager.service.caimei.providers.utils.ProvidersTemplate;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.poi.ss.formula.functions.T;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.transaction.interceptor.TransactionAspectSupport;
+
+import javax.annotation.Resource;
+import javax.imageio.ImageIO;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+/**
+ * Service业务层处理
+ *
+ * @author Kaick
+ * @date 2023-12-12
+ */
+@Slf4j
+@Service
+public class CmProvidersServiceImpl implements CmProvidersService {
+    @Resource
+    private CmProvidersMapper cmProvidersMapper;
+
+    @Resource
+    private CmProvidersContractMapper cmProvidersContractMapper;
+    @Resource
+    private CmProvidersContractService cmProvidersContractService;
+
+    @Resource
+    private CmRelatedImageMapper cmRelatedImageMapper;
+    @Resource
+    private UserMapper userMapper;
+
+
+    /**
+     * 通过对象查询列表
+     *
+     * @param cmProviders
+     * @return
+     */
+    @Override
+    public List<CmProviders> getCmProvidersList(CmProviders cmProviders) {
+        return cmProvidersMapper.getCmProvidersList(cmProviders);
+    }
+
+    /**
+     * 通过Id查询
+     *
+     * @param id 主键
+     * @return
+     */
+    @Override
+    public CmProviders getCmProvidersById(String id) {
+        CmProviders cmProvidersById = cmProvidersMapper.getCmProvidersById(id);
+        cmProvidersById.setTextRelateds(cmRelatedImageMapper.getRelatedImageList(new CmRelatedImage().setType("2").setAuthorId(cmProvidersById.getId())));
+        cmProvidersById.setInfoRelateds(cmRelatedImageMapper.getRelatedImageList(new CmRelatedImage().setType("3").setAuthorId(cmProvidersById.getId())));
+        return cmProvidersById;
+    }
+
+    /**
+     * 通过对象查询
+     *
+     * @param cmProviders
+     * @return
+     */
+    @Override
+    public CmProviders getByCmProviders(CmProviders cmProviders) {
+        CmProviders providers = cmProvidersMapper.getByCmProviders(cmProviders);
+        providers.setTextRelateds(cmRelatedImageMapper.getRelatedImageList(new CmRelatedImage().setType("2").setAuthorId(cmProviders.getId())));
+        providers.setInfoRelateds(cmRelatedImageMapper.getRelatedImageList(new CmRelatedImage().setType("3").setAuthorId(cmProviders.getId())));
+        return providers;
+    }
+
+
+    /**
+     * 新增
+     *
+     * @param cmProviders
+     * @return 结果
+     */
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public int addCmProviders(CmProviders cmProviders) {
+        if (StringUtils.isBlank(cmProviders.getId())) {
+            User user = new User();
+            user.setBindMobile(cmProviders.getMobile());
+            user.setUserName(cmProviders.getLinkMan());
+            user.setName(cmProviders.getName());
+            user.setUserIdentity(9);
+            user.setRegisterUserTypeID("-1");
+            user.setRegisterTime(DateUtil.getDateTime());
+            user.setValidFlag("1");
+            userMapper.addUser(user);
+            cmProviders.setUserId(Integer.valueOf(user.getUserID()));
+            String qualificationId = "CMFW0" + cmProviders.getServiceLevel();
+            if (0 == cmProvidersMapper.getCount(null)) {
+                qualificationId = qualificationId + "000001";
+            } else {
+                int num = Integer.parseInt(cmProvidersMapper.getByCmProviders(null).getQualificationId().substring(6));
+                num++; // 每次加1
+                // 使用字符串格式化保持位数不变,总共有6位,使用0进行填充
+                qualificationId = qualificationId + String.format("%06d", num);
+            }
+            cmProviders.setQualificationId(qualificationId);
+            cmProviders.setStatus(90);
+            cmProviders.setCreateTime(new Date());
+            cmProvidersMapper.addCmProviders(cmProviders);   //新增服务商
+            String providersId = cmProviders.getId();
+            cmProviders.getContract().setProvidersId(Integer.valueOf(providersId));
+            cmProviders.getContract().setCreateBy(cmProviders.getCreateBy());
+            cmProvidersContractService.addCmProvidersContract(cmProviders.getContract()); //新增服务商合同
+            for (CmRelatedImage textRelatedImage : cmProviders.getTextRelateds()) {
+                cmRelatedImageMapper.addCmRelatedImage(new CmRelatedImage().setType("2").setAuthorId(providersId).setImage(textRelatedImage.getImage()).setFileName(textRelatedImage.getFileName()));      //新增服务商简介图
+            }
+            for (CmRelatedImage infoRelatedImage : cmProviders.getInfoRelateds()) {
+                cmRelatedImageMapper.addCmRelatedImage(new CmRelatedImage().setType("3").setAuthorId(providersId).setImage(infoRelatedImage.getImage()).setFileName(infoRelatedImage.getFileName()));      //新增服务资料文件
+            }
+            return 1;
+        } else {
+            User user = new User();
+            user.setBindMobile(cmProviders.getMobile());
+            user.setUserName(cmProviders.getLinkMan());
+            user.setName(cmProviders.getName());
+            user.setValidFlag(cmProviders.getStatus() == 90 ? "1" : "0");
+            userMapper.updateUser(user);
+            String qualificationId = new StringBuffer(cmProviders.getQualificationId()).replace(5, 6, cmProviders.getServiceLevel().toString()).toString();
+            cmProviders.setQualificationId(qualificationId);
+            CmRelatedImage cmRelatedImage = new CmRelatedImage().setType("3").setAuthorId(cmProviders.getId());
+            cmRelatedImageMapper.delCmRelatedImage(cmRelatedImage);      //删除旧服务资料文件
+            cmRelatedImage.setType("2");
+            cmRelatedImageMapper.delCmRelatedImage(cmRelatedImage);      //删除旧服务商简介图
+            for (CmRelatedImage textRelatedImage : cmProviders.getTextRelateds()) {
+                cmRelatedImageMapper.addCmRelatedImage(cmRelatedImage.setImage(textRelatedImage.getImage()).setFileName(textRelatedImage.getFileName()));      //新增服务商简介图
+            }
+            cmRelatedImage.setType("3");
+            for (CmRelatedImage infoRelatedImage : cmProviders.getInfoRelateds()) {
+                cmRelatedImageMapper.addCmRelatedImage(cmRelatedImage.setImage(infoRelatedImage.getImage()).setFileName(infoRelatedImage.getFileName()));       //新增服务资料文件
+            }
+            cmProvidersMapper.updateCmProviders(cmProviders);
+            CmProvidersContract contract = cmProvidersContractMapper.getByCmProvidersContract(new CmProvidersContract().setProvidersId(Integer.valueOf(cmProviders.getId())));
+            contract.setFlag(false);//更改新增标识
+            cmProvidersContractService.addCmProvidersContract(contract); //新增服务商合同
+            return 1;
+        }
+    }
+
+    /**
+     * 修改
+     *
+     * @param cmProviders
+     * @return 结果
+     */
+    @Override
+    public int updateCmProviders(CmProviders cmProviders) {
+        if (null != cmProviders.getStatus()) {
+            userMapper.updateUser(new User()
+                    .setUserID(String.valueOf(cmProviders.getUserId()))
+                    .setValidFlag(cmProviders.getStatus() == 90 ? "1" : "0")
+            );
+        }
+        cmProviders.setUpdateTime(new Date());
+        return cmProvidersMapper.updateCmProviders(cmProviders);
+    }
+
+
+    /**
+     * 下載圖片
+     */
+    @Override
+    public void downloadImage(String ids, Integer type, HttpServletRequest request, HttpServletResponse response) throws Exception {
+        // 将图片压缩成zip文件
+        List<UploadFilePo> uploadFileList = cmProvidersMapper.getProvidersUploadFileList(ids, type);
+        String imageZipPath = ImageUtils.createImageZip(uploadFileList, type);
+        FastDFSClient.download(request, response, imageZipPath, imageZipPath.substring(imageZipPath.lastIndexOf("/")));
+        // 删除临时文件夹
+        String tempPath = imageZipPath.substring(0, imageZipPath.lastIndexOf("/"));
+        log.info("【图片压缩包】,删除图片压缩包文件夹:" + ImageUtils.deleteFile( new File(tempPath)));
+    }
+
+}
+
+
+

+ 282 - 0
src/main/java/com/caimei365/manager/service/caimei/providers/utils/ImageUtils.java

@@ -0,0 +1,282 @@
+package com.caimei365.manager.service.caimei.providers.utils;
+
+import com.caimei365.manager.FastDFS.FastDFSClient;
+import com.caimei365.manager.entity.po.UploadFilePo;
+import com.caimei365.manager.utils.FileIOUtils;
+import com.github.tobato.fastdfs.service.FastFileStorageClient;
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.EncodeHintType;
+import com.google.zxing.MultiFormatWriter;
+import com.google.zxing.WriterException;
+import com.google.zxing.common.BitMatrix;
+import com.google.zxing.qrcode.decoder.ErrorCorrectionLevel;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import javax.imageio.ImageIO;
+import java.awt.*;
+import java.awt.image.BufferedImage;
+import java.io.*;
+import java.net.URL;
+import java.util.*;
+import java.util.List;
+
+/**
+ * 生成二维码工具类.
+ *
+ * @author linzp
+ * @version 1.0.0
+ * CreateDate 2021/1/26 10:39
+ */
+@Slf4j
+@Component
+public class ImageUtils {
+
+    private static String config;
+
+    private static String imageDomain;
+
+
+    @Value("${cm.config}")
+    public void setConfig(String config) {
+        ImageUtils.config = config;
+    }
+
+    @Value("${caimei.imageDomain}")
+    public void setImageDomain(String imageDomain) {
+        ImageUtils.imageDomain = imageDomain;
+    }
+
+    /**
+     * BufferImage转byte[]
+     *
+     * @param original
+     * @return
+     */
+    public static byte[] bufImg2Bytes(BufferedImage original) {
+        ByteArrayOutputStream bStream = new ByteArrayOutputStream();
+        try {
+            ImageIO.write(original, "png", bStream);
+        } catch (IOException e) {
+            throw new RuntimeException("bugImg读取失败:" + e.getMessage(), e);
+        }
+        return bStream.toByteArray();
+    }
+
+    /**
+     * byte[]转BufferImage
+     * @param imgBytes
+     * @return
+     */
+    public static BufferedImage bytes2bufImg(byte[] imgBytes){
+        BufferedImage tagImg = null;
+        try {
+            tagImg = ImageIO.read(new ByteArrayInputStream(imgBytes));
+            return tagImg;
+        } catch (IOException e) {
+            throw new RuntimeException("bugImg写入失败:"+e.getMessage(),e);
+        }
+    }
+
+    public static String imageTemplate(BufferedImage image, List<Map<String,Object>> imageList) {
+        try (ByteArrayOutputStream os = new ByteArrayOutputStream()){
+            // 合成图片
+            BufferedImage result = image;
+            // 将两张图片放入结果图片中
+            Graphics2D g2d = result.createGraphics();
+            g2d.drawImage(result, 0, 0, null);
+            for (Map<String,Object> imageMap : imageList) {
+                int type = (int) imageMap.get("type");
+                int x = (int) imageMap.get("x");
+                int y = (int) imageMap.get("y");
+                if (1 == type) {
+                    BufferedImage imageFile = (BufferedImage) imageMap.get("image");
+                    if(null!=imageMap.get("align")){
+                        x=x-imageFile.getWidth()/2;
+                        // y=y-imageFile.getHeight()/2;
+                    }
+                    g2d.drawImage(imageFile, x, y, null);
+                } else {
+                    String text = (String) imageMap.get("text");
+                    //设置字体
+                    g2d.setFont(null==imageMap.get("font")? new Font("思源宋体", Font.PLAIN, 32):(Font) imageMap.get("font"));
+                    //设置颜色
+                    g2d.setColor(null==imageMap.get("color")?Color.BLACK:(Color) imageMap.get("color"));
+                    if(null!=imageMap.get("align")){
+                        int width = g2d.getFontMetrics().stringWidth(text);
+                        x=x-width/2;
+                        // y=y-g2d.getFont().getSize()/2;
+                    }
+                    //添加文字
+                    g2d.drawString(text, x, y);
+                }
+            }
+            // 保存合成图片
+            ImageIO.write(result, "jpg", os);
+            // 释放资源
+            g2d.dispose();
+            return FastDFSClient.saveFile(new ByteArrayInputStream(os.toByteArray()));
+        } catch (Exception e) {
+            e.printStackTrace();
+            log.error("生成图片异常!");
+            return null;
+        }
+    }
+
+
+    public static BufferedImage createRealQrCode(String url,int qrCodeSize) {
+        int BLACK = 0xFF000000;
+        int WHITE = 0xFFFFFFFF;
+        try {
+            Map<EncodeHintType, String> hints = new HashMap<>();
+            hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
+            //设置二维码白边的大小
+            hints.put(EncodeHintType.MARGIN, "0");
+            BitMatrix bitMatrix = new MultiFormatWriter().encode(url, BarcodeFormat.QR_CODE, qrCodeSize, qrCodeSize, hints);
+            //自定义白边边框宽度
+            int margin = 1;
+            bitMatrix = updateBit(bitMatrix, margin);
+            int width = bitMatrix.getWidth();
+            int height = bitMatrix.getHeight();
+            BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
+            for (int x = 0; x < width; x++) {
+                for (int y = 0; y < height; y++) {
+                    image.setRGB(x, y, bitMatrix.get(x, y) ? BLACK : WHITE);
+                }
+            }
+            //根据size放大、缩小生成的二维码
+            image = zoomInImage(image,qrCodeSize,qrCodeSize);
+            return image;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    private static BitMatrix updateBit(BitMatrix matrix, int margin){
+        int tempM = margin*2;
+        //获取二维码图案的属性
+        int[] rec = matrix.getEnclosingRectangle();
+        int resWidth = rec[2] + tempM;
+        int resHeight = rec[3] + tempM;
+        // 按照自定义边框生成新的BitMatrix
+        BitMatrix resMatrix = new BitMatrix(resWidth, resHeight);
+        resMatrix.clear();
+        //循环,将二维码图案绘制到新的bitMatrix中
+        for(int i= margin; i < resWidth- margin; i++){
+            for(int j=margin; j < resHeight-margin; j++){
+                if(matrix.get(i-margin + rec[0], j-margin + rec[1])){
+                    resMatrix.set(i,j);
+                }
+            }
+        }
+        return resMatrix;
+    }
+
+    public static BufferedImage zoomInImage(BufferedImage  originalImage, int width, int height){
+        BufferedImage newImage = new BufferedImage(width,height,originalImage.getType());
+        Graphics g = newImage.getGraphics();
+        g.drawImage(originalImage, 0,0,width,height,null);
+        g.dispose();
+        return newImage;
+    }
+
+    /**
+     * 创建图片压缩包
+     *
+     * @param type    1服务商资格证书,2服务商二维码
+     * @return
+     * @throws Exception
+     */
+    public static String createImageZip(List<UploadFilePo> uploadFilePos, Integer type) throws Exception {
+        String randomStr = UUID.randomUUID().toString();
+        // 图片暂存本地服务器路径
+        String filePath = "/mnt/newdatadrive/data/runtime/jar-instance/manager-api/tempImage/";
+        if ("dev".equals(config)) {
+            filePath = "D:\\uploadZip\\";
+        }
+        // 压缩文件夹上层临时文件夹路径
+        String tempPath = filePath + randomStr;
+        // 压缩文件夹路径
+        String basePath = "";
+        // 生成唯一临时文件夹
+        filePath += randomStr + "/";
+        // 在临时文件夹中生成要压缩的基础文件夹
+        String baseDirName = "";
+        switch (type) {
+            case 1:
+                baseDirName = "服务商资格证书";
+                break;
+            case 2:
+                baseDirName = "服务商二维码";
+                break;
+            default:
+                baseDirName = "";
+        }
+        filePath += baseDirName+ "/" ;
+        basePath = filePath;
+        File baseDir = new File(basePath);
+        if (!baseDir.exists()) {
+            baseDir.mkdirs();
+        }
+        // 往基础文件夹中填充相应数据
+        for (int i = 0; i < uploadFilePos.size(); i++) {
+            // 把图片链接转换为图片
+            UploadFilePo file = uploadFilePos.get(i);
+            String fileUrl = file.getFileUrl();
+            URL url = new URL(fileUrl);
+            InputStream inputStream = url.openStream();
+            BufferedImage image = ImageIO.read(inputStream);
+            String extName = fileUrl.substring(fileUrl.lastIndexOf(".") + 1);
+            File buildFile = buildFileName(filePath ,file.getFileName(),"."+extName,0);
+            ImageIO.write(image, extName, buildFile);
+            inputStream.close();
+        }
+        // 将文件夹转为压缩文件
+        String zipPath = tempPath + "/" + baseDirName + ".zip";
+        FileOutputStream zipOut = new FileOutputStream(zipPath);
+        FileIOUtils.zipFolder(basePath, zipOut, true);
+        return zipPath;
+    }
+
+
+    public static File buildFileName(String path, String fileName, String suffix, Integer index) {
+        File file;
+        //下标不等于0开始拼后缀
+        if (index != 0) {
+            file = new File(path + fileName + "(" + index + ")" + suffix);
+        } else {
+            file = new File(path + fileName + suffix);
+        }
+        //判断文件是否存在 文件不存在退出递归
+        if (file.isFile()) {
+            //每次递归给下标加1
+            file = buildFileName(path, fileName, suffix, ++index);
+        }
+        return file;
+    }
+
+    public static boolean deleteFile(File file){
+        //判断文件不为null或文件目录存在
+        if (file == null || !file.exists()){
+            log.error("文件删除失败,请检查文件路径是否正确>>>"+file.getAbsolutePath());
+            return false;
+        }
+        //取得这个目录下的所有子文件对象
+        File[] files = file.listFiles();
+        //遍历该目录下的文件对象
+        for (File f: files){
+            //判断子目录是否存在子目录,如果是文件则删除
+            if (f.isDirectory()){
+                deleteFile(f);
+            }else {
+                f.delete();
+            }
+        }
+        //删除空文件夹  for循环已经把上一层节点的目录清空。
+        return file.delete();
+    }
+}

+ 99 - 0
src/main/java/com/caimei365/manager/service/caimei/providers/utils/ProvidersTemplate.java

@@ -0,0 +1,99 @@
+package com.caimei365.manager.service.caimei.providers.utils;
+
+import com.caimei365.manager.FastDFS.FastDFSClient;
+import com.caimei365.manager.config.utils.DateUtil;
+import com.caimei365.manager.dao.providers.CmProvidersMapper;
+import com.caimei365.manager.entity.po.UploadFilePo;
+import com.caimei365.manager.utils.FileIOUtils;
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.EncodeHintType;
+import com.google.zxing.MultiFormatWriter;
+import com.google.zxing.common.BitMatrix;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.stereotype.Component;
+
+import javax.annotation.Resource;
+import javax.imageio.ImageIO;
+import javax.xml.crypto.Data;
+import java.awt.*;
+import java.awt.image.BufferedImage;
+import java.io.*;
+import java.net.URL;
+import java.util.*;
+import java.util.List;
+
+/**
+ * @author :Kaick
+ * @date :Created in 2023/12/13
+ * @description:Template
+ */
+@Slf4j
+public class ProvidersTemplate {
+
+
+    public static String setQualificationImage(BufferedImage image, String name, String level, Date startDate, Date endDate, String providersId, BufferedImage realQrCodeImage) {
+        ArrayList list = new ArrayList();
+        if (null != name) {
+            //合成文本Map
+            HashMap<String, Object> textMap = new HashMap<>();
+            textMap.put("type", 2);
+            textMap.put("text", name);
+            textMap.put("font", new Font("黑体", Font.BOLD, 32));
+            textMap.put("align", "center");
+            textMap.put("x", image.getWidth()/2);
+            textMap.put("y", 585);
+            list.add(textMap);
+        }
+        if (null != level) {
+            //合成文本Map
+            HashMap<String, Object> levelMap = new HashMap<>();
+            levelMap.put("type", 2);
+            levelMap.put("text", level);
+            levelMap.put("font", new Font("方正粗黑宋简体", Font.BOLD, 40));
+            levelMap.put("x", 943);
+            levelMap.put("y", 672);
+            list.add(levelMap);
+        }
+        if (null != startDate) {
+            //合成文本Map
+            HashMap<String, Object> startDateMap = new HashMap<>();
+            startDateMap.put("type", 2);
+            startDateMap.put("text", DateUtil.setDate(startDate, "yyyy  MM   dd"));
+            startDateMap.put("font", new Font("思源黑体", Font.PLAIN, 38));
+            startDateMap.put("x", 730);
+            startDateMap.put("y", 835);
+            list.add(startDateMap);
+        }
+        if (null != endDate) {
+            //合成文本Map
+            HashMap<String, Object> endDateMap = new HashMap<>();
+            endDateMap.put("type", 2);
+            endDateMap.put("text", DateUtil.setDate(endDate, "yyyy  MM   dd"));
+            endDateMap.put("font", new Font("思源黑体", Font.PLAIN, 38));
+            endDateMap.put("x", 1060);
+            endDateMap.put("y", 835);
+            list.add(endDateMap);
+        }
+        if (null != providersId) {
+            //合成文本Map
+            HashMap<String, Object> providersIdMap = new HashMap<>();
+            providersIdMap.put("type", 2);
+            providersIdMap.put("text", providersId);
+            providersIdMap.put("font", new Font("思源黑体", Font.PLAIN, 32));
+            providersIdMap.put("x", 520);
+            providersIdMap.put("y", 1090);
+            list.add(providersIdMap);
+        }
+        if (null != realQrCodeImage) {
+            //合成图片Map
+            HashMap<String, Object> imageFileMap = new HashMap<>();
+            imageFileMap.put("type", 1);
+            imageFileMap.put("image", ImageUtils.zoomInImage(realQrCodeImage, 150, 150));
+            imageFileMap.put("x", 1430);
+            imageFileMap.put("y", 990);
+            list.add(imageFileMap);
+        }
+        return ImageUtils.imageTemplate(ImageUtils.zoomInImage(image, 1920, 1315),list);
+    }
+
+}

+ 5 - 4
src/main/java/com/caimei365/manager/service/caimei/user/impl/CmBehaviorRecordServiceImpl.java

@@ -20,6 +20,7 @@ import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.concurrent.atomic.AtomicReference;
+import java.util.stream.Collectors;
 
 /**
  * Description
@@ -226,10 +227,10 @@ public class CmBehaviorRecordServiceImpl implements CmBehaviorRecordService {
                 if(StringUtils.isNotBlank(r.getPageLabel()) && StringUtils.isNotEmpty(r.getPageLabel()) && !label.contains(r.getPageLabel())) {
                     ReturnEntity retuenEntity = new ReturnEntity();
                     if (r.getPageLabel().contains(",")) {
-                        log.info("contains");
                         String[] split = r.getPageLabel().split(",");
                         for (String str : split) {
-                            if (StringUtils.isNotBlank(str) &&  !label.contains(str)) {
+                            List<String> collect = label.stream().map(RetuenEntity::getValue).collect(Collectors.toList());
+                            if (StringUtils.isNotBlank(str) &&  !collect.contains(str)) {
                                 retuenEntity = new ReturnEntity();
                                 returnId.updateAndGet(v -> v + 1);
                                 retuenEntity.setId(returnId.get().toString());
@@ -238,8 +239,8 @@ public class CmBehaviorRecordServiceImpl implements CmBehaviorRecordService {
                             }
                         }
                     } else {
-                        log.info("not   contains");
-                        if (!label.contains(r.getPageLabel())) {
+                        List<String> collect = label.stream().map(RetuenEntity::getValue).collect(Collectors.toList());
+                        if (!collect.contains(r.getPageLabel())) {
                             returnId.updateAndGet(v -> v + 1);
                             retuenEntity.setId(returnId.get().toString());
                             retuenEntity.setValue(r.getPageLabel());

+ 86 - 0
src/main/java/com/caimei365/manager/utils/FileIOUtils.java

@@ -0,0 +1,86 @@
+package com.caimei365.manager.utils;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+
+public class FileIOUtils {
+
+
+    /**
+     * 压缩成ZIP 方法1
+     *
+     * @param srcDir           压缩文件夹路径
+     * @param out              压缩文件输出流
+     * @param KeepDirStructure 是否保留原来的目录结构,true:保留目录结构; false:所有文件跑到压缩包根目录下(注意:不保留目录结构可能会出现同名文件,会压缩失败)
+     * @throws RuntimeException 压缩失败会抛出运行时异常
+     */
+    public static void zipFolder(String srcDir, OutputStream out, boolean KeepDirStructure) {
+        long startTime = System.currentTimeMillis();
+        try (ZipOutputStream zos = new ZipOutputStream(out)) {
+            final File sourceDir = new File(srcDir);
+            compressFolder(sourceDir, zos, sourceDir.getName(), KeepDirStructure);
+            long end = System.currentTimeMillis();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * 递归压缩方法
+     *
+     * @param sourceDir        源文件
+     * @param zipOut           zip输出流
+     * @param name             压缩后的名称
+     * @param keepDirStructure 是否保留原来的目录结构,true:保留目录结构; false:所有文件跑到压缩包根目录下(注意:不保留目录结构可能会出现同名文件,会压缩失败)
+     * @throws Exception
+     */
+    private static void compressFolder(File sourceDir, ZipOutputStream zipOut, String name, boolean keepDirStructure) throws Exception {
+        byte[] buffer = new byte[1024];
+        //如果是文件
+        if (sourceDir.isFile()) {
+            // 向zip输出流中添加一个zip实体,构造器中name为zip实体的文件的名字
+            zipOut.putNextEntry(new ZipEntry(name));
+            // copy文件到zip输出流中
+            int len;
+            FileInputStream in = new FileInputStream(sourceDir);
+            while ((len = in.read(buffer)) != -1) {
+                zipOut.write(buffer, 0, len);
+            }
+            // Complete the entry
+            zipOut.closeEntry();
+            in.close();
+        } else {//如果是文件夹
+            File[] listFiles = sourceDir.listFiles();
+            if (listFiles == null || listFiles.length == 0) {
+                // 需要保留原来的文件结构时,需要对空文件夹进行处理
+                if (keepDirStructure) {
+                    // 空文件夹的处理
+                    zipOut.putNextEntry(new ZipEntry(name + "/"));
+                    // 没有文件,不需要文件的copy
+                    zipOut.closeEntry();
+                }
+            } else {
+                for (File file : listFiles) {
+                    // 判断是否需要保留原来的文件结构
+                    if (keepDirStructure){
+                        // 注意:file.getName()前面需要带上父文件夹的名字加一斜杠,
+                        // 不然最后压缩包中就不能保留原来的文件结构,即:所有文件都跑到压缩包根目录下了
+                        compressFolder(file, zipOut, name + "/" + file.getName(), true);
+                    } else {
+                        compressFolder(file, zipOut, file.getName(), false);
+                    }
+                }
+            }
+        }
+    }
+
+    /*public static void main(final String[] args) throws Exception {
+//        zipFile(new File("F:\\temp\\temp-file\\sun.text"));
+        zipFolder("D:\\uploadZip\\机构二维码", new FileOutputStream(new File("D:\\uploadZip\\aaa.zip")), true);
+    }*/
+}

+ 10 - 0
src/main/java/com/caimei365/manager/utils/formDataUtils.java

@@ -1,5 +1,6 @@
 package com.caimei365.manager.utils;
 
+import com.caimei365.manager.config.thinkgem.Global;
 import lombok.extern.slf4j.Slf4j;
 import com.caimei365.manager.FastDFS.FastDFSClient;
 import org.springframework.beans.factory.annotation.Value;
@@ -11,7 +12,10 @@ import org.springframework.web.multipart.MultipartFile;
 
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayInputStream;
 import java.io.File;
+import java.io.FileOutputStream;
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
@@ -25,6 +29,9 @@ public class formDataUtils {
     private FastDFSClient client;
     @Value("${caimei.imageDomain}")
     private String imageDomain;
+    @Value("${cm.config}")
+    private String config;
+
 
     @ResponseBody
     @RequestMapping("/MultiPictareaddData")
@@ -54,6 +61,9 @@ public class formDataUtils {
         int index = originalFilename.lastIndexOf(".");
         String exet = originalFilename.substring(index);
         String filePath = "/mnt/newdatadrive/data/runtime/jar-instance/manager-api/tempImage/";
+        if ("dev".equals(config)) {
+            filePath = "D:\\uploadZip\\";
+        }
         filePath += "\\" + randomUUID + exet;
         file.transferTo(new File(filePath));
         log.info(">>>>>>>>>>>>>>>>图片上传路径:" + filePath);

+ 2 - 1
src/main/resources/application.yml

@@ -12,4 +12,5 @@ spring:
 
 mybatis:
   mapper-locations: classpath:mapper/*.xml, classpath:mapper/*/*.xml
-
+  # 定义包别名,使用pojo时可以直接使用pojo的类型名称不用加包名
+  type-aliases-package: com.caimei365.manager.entity

+ 157 - 0
src/main/resources/mapper/CmRelatedImageMapper.xml

@@ -0,0 +1,157 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.caimei365.manager.dao.CmRelatedImageMapper">
+
+    <resultMap type="CmRelatedImage" id="CmRelatedImageResult">
+        <result property="id"    column="id"    />
+        <result property="type"    column="type"    />
+        <result property="authorId"    column="authorId"    />
+        <result property="image"    column="image"    />
+        <result property="delFlag"    column="delFlag"    />
+        <result property="updateTime"    column="updateTime"    />
+        <result property="createTime"    column="createTime"    />
+    </resultMap>
+
+    <sql id="selectCmRelatedImageVo">
+         select
+         cm_related_image.id,
+         cm_related_image.type,
+         cm_related_image.authorId,
+         cm_related_image.image,
+         cm_related_image.fileName,
+         cm_related_image.delFlag,
+         cm_related_image.updateTime,
+         cm_related_image.createTime
+    </sql>
+
+    <select id="getByCmRelatedImage" parameterType="CmRelatedImage" resultMap="CmRelatedImageResult">
+        <include refid="selectCmRelatedImageVo"/>
+        from cm_related_image AS cm_related_image
+        <where>  cm_related_image.delFlag = 0
+            <if test="id != null  and id != ''"> and cm_related_image.id = #{id}</if>
+            <if test="type != null  and type != ''"> and cm_related_image.type = #{type}</if>
+            <if test="authorId != null  and authorId != ''"> and cm_related_image.authorId = #{authorId}</if>
+            <if test="fileName != null  and fileName != ''"> and cm_related_image.fileName = #{fileName}</if>
+            <if test="image != null  and image != ''"> and cm_related_image.image = #{image}</if>
+        </where>
+        group by cm_related_image.id
+        limit 0,1
+    </select>
+
+    <select id="getRelatedImageList" parameterType="CmRelatedImage" resultMap="CmRelatedImageResult">
+        <include refid="selectCmRelatedImageVo"/>
+        from cm_related_image AS cm_related_image
+        <where>  cm_related_image.delFlag = 0
+            <if test="id != null  and id != ''"> and cm_related_image.id = #{id}</if>
+            <if test="type != null  and type != ''">
+                and cm_related_image.type
+                <if test="type.toUpperCase().indexOf('=')==-1">
+                    = #{type}
+                </if>
+                <if test="type.toUpperCase().indexOf('=')!=-1">
+                    <if test="type.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="type.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="typeIn" collection="type.substring(type.toUpperCase().indexOf('=')+1,type.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{typeIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="authorId != null  and authorId != ''"> and cm_related_image.authorId = #{authorId}</if>
+            <if test="fileName != null  and fileName != ''"> and cm_related_image.fileName = #{fileName}</if>
+            <if test="image != null  and image != ''"> and cm_related_image.image = #{image}</if>
+        </where>
+        group by cm_related_image.id
+        order by cm_related_image.createTime desc
+    </select>
+
+
+
+    <select id="getCount" parameterType="CmRelatedImage" resultType="int">
+        select count(1)
+        from cm_related_image AS cm_related_image
+        <where>  cm_related_image.delFlag = 0
+            <if test="id != null  and id != ''"> and cm_related_image.id = #{id}</if>
+            <if test="type != null  and type != ''"> and cm_related_image.type = #{type}</if>
+            <if test="authorId != null  and authorId != ''"> and cm_related_image.authorId = #{authorId}</if>
+            <if test="fileName != null  and fileName != ''"> and cm_related_image.fileName = #{fileName}</if>
+            <if test="image != null  and image != ''"> and cm_related_image.image = #{image}</if>
+        </where>
+    </select>
+
+    <select id="getCmRelatedImageById" parameterType="String" resultMap="CmRelatedImageResult">
+        <include refid="selectCmRelatedImageVo"/>
+        from cm_related_image AS cm_related_image
+        where  cm_related_image.delFlag = 0 and cm_related_image.id = #{id}
+    </select>
+
+
+    <select id="getById" parameterType="CmRelatedImage" resultType="String">
+        select id
+        from cm_related_image AS cm_related_image
+        <where>  cm_related_image.delFlag = 0
+            <if test="id != null  and id != ''"> and cm_related_image.id = #{id}</if>
+            <if test="type != null  and type != ''"> and cm_related_image.type = #{type}</if>
+            <if test="authorId != null  and authorId != ''"> and cm_related_image.authorId = #{authorId}</if>
+            <if test="fileName != null  and fileName != ''"> and cm_related_image.fileName = #{fileName}</if>
+            <if test="image != null  and image != ''"> and cm_related_image.image = #{image}</if>
+        </where>
+        group by cm_related_image.id
+        limit 0,1
+    </select>
+
+    <insert id="addCmRelatedImage" parameterType="CmRelatedImage" useGeneratedKeys="true" keyProperty="id">
+        insert into cm_related_image
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="type != null and type != ''">type,</if>
+            <if test="authorId != null and authorId != ''">authorId,</if>
+            <if test="image != null and image != ''">image,</if>
+            <if test="fileName != null and fileName != ''">fileName,</if>
+            <if test="delFlag != null">delFlag,</if>
+            <if test="updateTime != null">updateTime,</if>
+            <if test="createTime != null">createTime,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="type != null and type != ''">#{type},</if>
+            <if test="authorId != null and authorId != ''">#{authorId},</if>
+            <if test="image != null and image != ''">#{image},</if>
+            <if test="fileName != null and fileName != ''">#{fileName},</if>
+            <if test="delFlag != null">#{delFlag},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="createTime != null">#{createTime},</if>
+         </trim>
+    </insert>
+
+    <update id="updateCmRelatedImage" parameterType="CmRelatedImage">
+        update cm_related_image
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="type != null and type != ''">type = #{type},</if>
+            <if test="authorId != null and authorId != ''">authorId = #{authorId},</if>
+            <if test="image != null and image != ''">image = #{image},</if>
+            <if test="fileName != null and fileName != ''">image = #{fileName},</if>
+            <if test="delFlag != null">delFlag = #{delFlag},</if>
+            <if test="updateTime != null">updateTime = #{updateTime},</if>
+            <if test="createTime != null">createTime = #{createTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="delCmRelatedImageById" parameterType="String">
+        delete
+        from cm_related_image where id = #{id}
+    </delete>
+
+    <delete id="delCmRelatedImage" parameterType="CmRelatedImage">
+        delete
+        from cm_related_image AS cm_related_image
+        <where>
+            <if test="id != null  and id != ''"> and cm_related_image.id = #{id}</if>
+            <if test="type != null  and type != ''"> and cm_related_image.type = #{type}</if>
+            <if test="authorId != null  and authorId != ''"> and cm_related_image.authorId = #{authorId}</if>
+            <if test="image != null  and image != ''"> and cm_related_image.image = #{image}</if>
+            <if test="fileName != null  and fileName != ''"> and cm_related_image.fileName = #{fileName}</if>
+        </where>
+    </delete>
+
+</mapper>

+ 158 - 0
src/main/resources/mapper/CmRelatedMapper.xml

@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.caimei365.manager.dao.CmRelatedMapper">
+
+    <resultMap type="CmRelated" id="CmRelatedResult">
+        <result property="id"    column="id"    />
+        <result property="type"    column="type"    />
+        <result property="authorId"    column="authorId"    />
+        <result property="relatedId"    column="relatedId"    />
+        <result property="delFlag"    column="delFlag"    />
+        <result property="updateTime"    column="updateTime"    />
+        <result property="createTime"    column="createTime"    />
+        <result property="sort"    column="sort"    />
+    </resultMap>
+
+    <sql id="selectCmRelatedVo">
+         select
+         cm_related.id,
+         cm_related.type,
+         cm_related.authorId,
+         cm_related.relatedId,
+         cm_related.delFlag,
+         cm_related.updateTime,
+         cm_related.createTime,
+         cm_related.sort
+    </sql>
+
+    <select id="getByCmRelated" parameterType="CmRelated" resultMap="CmRelatedResult">
+        <include refid="selectCmRelatedVo"/>
+        from cm_related AS cm_related
+        <where>  cm_related.delFlag = 0
+            <if test="id != null  and id != ''"> and cm_related.id = #{id}</if>
+            <if test="type != null  and type != ''"> and cm_related.type = #{type}</if>
+            <if test="authorId != null  and authorId != ''"> and cm_related.authorId = #{authorId}</if>
+            <if test="relatedId != null  and relatedId != ''"> and cm_related.relatedId = #{relatedId}</if>
+            <if test="sort != null "> and cm_related.sort = #{sort}</if>
+        </where>
+        group by cm_related.id
+        limit 0,1
+    </select>
+
+    <select id="getCmRelatedList" parameterType="CmRelated" resultMap="CmRelatedResult">
+        <include refid="selectCmRelatedVo"/>
+        from cm_related AS cm_related
+        <where>  cm_related.delFlag = 0
+            <if test="id != null  and id != ''"> and cm_related.id = #{id}</if>
+            <if test="type != null  and type != ''">
+                and cm_related.type
+                <if test="type.toUpperCase().indexOf('=')==-1">
+                    = #{type}
+                </if>
+                <if test="type.toUpperCase().indexOf('=')!=-1">
+                    <if test="type.toUpperCase().indexOf('NOT')!=-1"> not </if>
+                    <if test="type.toUpperCase().indexOf('IN')!=-1"> in </if>
+                    <foreach item="typeIn" collection="type.substring(type.toUpperCase().indexOf('=')+1,type.length()).trim().split(',')" open="(" separator="," close=")">
+                        #{typeIn}
+                    </foreach>
+                </if>
+            </if>
+            <if test="authorId != null  and authorId != ''"> and cm_related.authorId = #{authorId}</if>
+            <if test="relatedId != null  and relatedId != ''"> and cm_related.relatedId = #{relatedId}</if>
+            <if test="sort != null "> and cm_related.sort = #{sort}</if>
+        </where>
+        group by cm_related.id
+        order by cm_related.createTime desc
+    </select>
+
+    <select id="getCount" parameterType="CmRelated" resultType="int">
+        select count(1)
+        from cm_related AS cm_related
+        <where>  cm_related.delFlag = 0
+            <if test="id != null  and id != ''"> and cm_related.id = #{id}</if>
+            <if test="type != null  and type != ''"> and cm_related.type = #{type}</if>
+            <if test="authorId != null  and authorId != ''"> and cm_related.authorId = #{authorId}</if>
+            <if test="relatedId != null  and relatedId != ''"> and cm_related.relatedId = #{relatedId}</if>
+            <if test="sort != null "> and cm_related.sort = #{sort}</if>
+        </where>
+    </select>
+
+    <select id="getCmRelatedById" parameterType="String" resultMap="CmRelatedResult">
+        <include refid="selectCmRelatedVo"/>
+        from cm_related AS cm_related
+        where  cm_related.delFlag = 0 and cm_related.id = #{id}
+    </select>
+
+
+    <select id="getById" parameterType="CmRelated" resultType="String">
+        select id
+        from cm_related AS cm_related
+        <where>  cm_related.delFlag = 0
+            <if test="id != null  and id != ''"> and cm_related.id = #{id}</if>
+            <if test="type != null  and type != ''"> and cm_related.type = #{type}</if>
+            <if test="authorId != null  and authorId != ''"> and cm_related.authorId = #{authorId}</if>
+            <if test="relatedId != null  and relatedId != ''"> and cm_related.relatedId = #{relatedId}</if>
+            <if test="sort != null "> and cm_related.sort = #{sort}</if>
+        </where>
+        group by cm_related.id
+        limit 0,1
+    </select>
+
+    <insert id="addCmRelated" parameterType="CmRelated" useGeneratedKeys="true" keyProperty="id">
+        insert into cm_related
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null and id != ''">id,</if>
+            <if test="type != null and type != ''">type,</if>
+            <if test="authorId != null and authorId != ''">authorId,</if>
+            <if test="relatedId != null and relatedId != ''">relatedId,</if>
+            <if test="delFlag != null">delFlag,</if>
+            <if test="updateTime != null">updateTime,</if>
+            <if test="createTime != null">createTime,</if>
+            <if test="sort != null">sort,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null and id != ''">#{id},</if>
+            <if test="type != null and type != ''">#{type},</if>
+            <if test="authorId != null and authorId != ''">#{authorId},</if>
+            <if test="relatedId != null and relatedId != ''">#{relatedId},</if>
+            <if test="delFlag != null">#{delFlag},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="sort != null">#{sort},</if>
+         </trim>
+    </insert>
+
+    <update id="updateCmRelated" parameterType="CmRelated">
+        update cm_related
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="type != null and type != ''">type = #{type},</if>
+            <if test="authorId != null and authorId != ''">authorId = #{authorId},</if>
+            <if test="relatedId != null and relatedId != ''">relatedId = #{relatedId},</if>
+            <if test="delFlag != null">delFlag = #{delFlag},</if>
+            <if test="updateTime != null">updateTime = #{updateTime},</if>
+            <if test="createTime != null">createTime = #{createTime},</if>
+            <if test="sort != null">sort = #{sort},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="delCmRelatedById" parameterType="String">
+        delete
+        from cm_related where id = #{id}
+    </delete>
+
+    <delete id="delCmRelated" parameterType="CmRelated">
+        delete
+        from cm_related AS cm_related
+        <where>
+            <if test="id != null  and id != ''"> and cm_related.id = #{id}</if>
+            <if test="type != null  and type != ''"> and cm_related.type = #{type}</if>
+            <if test="authorId != null  and authorId != ''"> and cm_related.authorId = #{authorId}</if>
+            <if test="relatedId != null  and relatedId != ''"> and cm_related.relatedId = #{relatedId}</if>
+            <if test="sort != null "> and cm_related.sort = #{sort}</if>
+        </where>
+    </delete>
+
+</mapper>

+ 146 - 0
src/main/resources/mapper/providers/CmProvidersContractMapper.xml

@@ -0,0 +1,146 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.caimei365.manager.dao.providers.CmProvidersContractMapper">
+
+    <resultMap type="CmProvidersContract" id="CmProvidersContractResult">
+        <result property="id"    column="id"    />
+        <result property="providersId"    column="providersId"    />
+        <result property="contractId"    column="contractId"    />
+        <result property="contractStartDate"    column="contractStartDate"    />
+        <result property="contractEndDate"    column="contractEndDate"    />
+        <result property="createBy"    column="createBy"    />
+        <result property="updateTime"    column="updateTime"    />
+        <result property="createTime"    column="createTime"    />
+    </resultMap>
+
+    <sql id="selectCmProvidersContractVo">
+        select
+            cm_providers_contract.id,
+            cm_providers_contract.providersId,
+            cm_providers_contract.contractId,
+            cm_providers_contract.contractStartDate,
+            cm_providers_contract.contractEndDate,
+            cm_providers_contract.createBy,
+            cm_providers_contract.updateTime,
+            cm_providers_contract.createTime
+    </sql>
+
+    <select id="getByCmProvidersContract" parameterType="CmProvidersContract" resultMap="CmProvidersContractResult">
+        <include refid="selectCmProvidersContractVo"/>
+        from cm_providers_contract AS cm_providers_contract
+        <where>
+            <if test="id != null  and id != ''"> and cm_providers_contract.id = #{id}</if>
+            <if test="providersId != null "> and cm_providers_contract.providersId = #{providersId}</if>
+            <if test="contractId != null  and contractId != ''"> and cm_providers_contract.contractId = #{contractId}</if>
+            <if test="contractStartDate != null "> and cm_providers_contract.contractStartDate = #{contractStartDate}</if>
+            <if test="contractEndDate != null "> and cm_providers_contract.contractEndDate = #{contractEndDate}</if>
+        </where>
+        group by cm_providers_contract.id
+        limit 0,1
+    </select>
+
+    <select id="getCmProvidersContractList" parameterType="CmProvidersContract" resultMap="CmProvidersContractResult">
+        <include refid="selectCmProvidersContractVo"/>
+        from cm_providers_contract AS cm_providers_contract
+        <where>
+            <if test="id != null  and id != ''"> and cm_providers_contract.id = #{id}</if>
+            <if test="providersId != null "> and cm_providers_contract.providersId = #{providersId}</if>
+            <if test="contractId != null  and contractId != ''"> and cm_providers_contract.contractId = #{contractId}</if>
+            <if test="contractStartDate != null "> and cm_providers_contract.contractStartDate >= #{contractStartDate}</if>
+            <if test="contractEndDate != null "> and cm_providers_contract.contractEndDate  <![CDATA[ <= ]]> #{contractEndDate}</if>
+        </where>
+        group by cm_providers_contract.id
+        order by cm_providers_contract.createTime desc
+    </select>
+
+    <select id="getCount" parameterType="CmProvidersContract" resultType="int">
+        select count(1)
+        from cm_providers_contract AS cm_providers_contract
+        <where>
+            <if test="id != null  and id != ''"> and cm_providers_contract.id = #{id}</if>
+            <if test="providersId != null "> and cm_providers_contract.providersId = #{providersId}</if>
+            <if test="contractId != null  and contractId != ''"> and cm_providers_contract.contractId = #{contractId}</if>
+            <if test="contractStartDate != null "> and cm_providers_contract.contractStartDate = #{contractStartDate}</if>
+            <if test="contractEndDate != null "> and cm_providers_contract.contractEndDate = #{contractEndDate}</if>
+        </where>
+    </select>
+
+    <select id="getCmProvidersContractById" parameterType="String" resultMap="CmProvidersContractResult">
+        <include refid="selectCmProvidersContractVo"/>
+        from cm_providers_contract AS cm_providers_contract
+        where  cm_providers_contract.id = #{id}
+    </select>
+
+
+    <select id="getById" parameterType="CmProvidersContract" resultType="String">
+        select id
+        from cm_providers_contract AS cm_providers_contract
+        <where>
+            <if test="id != null  and id != ''"> and cm_providers_contract.id = #{id}</if>
+            <if test="providersId != null "> and cm_providers_contract.providersId = #{providersId}</if>
+            <if test="contractId != null  and contractId != ''"> and cm_providers_contract.contractId = #{contractId}</if>
+            <if test="contractStartDate != null "> and cm_providers_contract.contractStartDate = #{contractStartDate}</if>
+            <if test="contractEndDate != null "> and cm_providers_contract.contractEndDate = #{contractEndDate}</if>
+        </where>
+        group by cm_providers_contract.id
+        limit 0,1
+    </select>
+
+    <insert id="addCmProvidersContract" parameterType="CmProvidersContract" useGeneratedKeys="true" keyProperty="id">
+        insert into cm_providers_contract
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null and id != ''">id,</if>
+            <if test="providersId != null">providersId,</if>
+            <if test="contractId != null and contractId != ''">contractId,</if>
+            <if test="contractStartDate != null">contractStartDate,</if>
+            <if test="contractEndDate != null">contractEndDate,</if>
+            <if test="createBy != null and createBy != ''">createBy,</if>
+            <if test="updateTime != null">updateTime,</if>
+            <if test="createTime != null">createTime,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null and id != ''">#{id},</if>
+            <if test="providersId != null">#{providersId},</if>
+            <if test="contractId != null and contractId != ''">#{contractId},</if>
+            <if test="contractStartDate != null">#{contractStartDate},</if>
+            <if test="contractEndDate != null">#{contractEndDate},</if>
+            <if test="createBy != null and createBy != ''">#{createBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="createTime != null">#{createTime},</if>
+        </trim>
+    </insert>
+
+    <update id="updateCmProvidersContract" parameterType="CmProvidersContract">
+        update cm_providers_contract
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="providersId != null">providersId = #{providersId},</if>
+            <if test="contractId != null and contractId != ''">contractId = #{contractId},</if>
+            <if test="contractStartDate != null">contractStartDate = #{contractStartDate},</if>
+            <if test="contractEndDate != null">contractEndDate = #{contractEndDate},</if>
+            <if test="createBy != null and createBy != ''">createBy = #{createBy},</if>
+            <if test="updateTime != null">updateTime = #{updateTime},</if>
+            <if test="createTime != null">createTime = #{createTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="delCmProvidersContractById" parameterType="String">
+        delete
+        from cm_providers_contract where id = #{id}
+    </delete>
+
+    <delete id="delCmProvidersContract" parameterType="CmProvidersContract">
+        delete
+        from cm_providers_contract AS cm_providers_contract
+        <where>
+            <if test="id != null  and id != ''"> and cm_providers_contract.id = #{id}</if>
+            <if test="providersId != null "> and cm_providers_contract.providersId = #{providersId}</if>
+            <if test="contractId != null  and contractId != ''"> and cm_providers_contract.contractId = #{contractId}</if>
+            <if test="contractStartDate != null "> and cm_providers_contract.contractStartDate = #{contractStartDate}</if>
+            <if test="contractEndDate != null "> and cm_providers_contract.contractEndDate = #{contractEndDate}</if>
+        </where>
+    </delete>
+
+</mapper>

+ 280 - 0
src/main/resources/mapper/providers/CmProvidersMapper.xml

@@ -0,0 +1,280 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.caimei365.manager.dao.providers.CmProvidersMapper">
+
+    <resultMap type="CmProviders" id="CmProvidersResult">
+        <result property="id" column="id"/>
+        <result property="name" column="name"/>
+        <result property="serviceLevel" column="serviceLevel"/>
+        <result property="serviceCategory" column="serviceCategory"/>
+        <result property="address" column="address"/>
+        <result property="linkMan" column="linkMan"/>
+        <result property="mobile" column="mobile"/>
+        <result property="text" column="text"/>
+        <result property="qrCodeImage" column="qrCodeImage"/>
+        <result property="qualificationImage" column="qualificationImage"/>
+        <result property="qualificationId" column="qualificationId"/>
+        <result property="contractStartDate" column="contractStartDate"/>
+        <result property="contractEntDate" column="contractEntDate"/>
+        <result property="createBy" column="createBy"/>
+        <result property="updateTime" column="updateTime"/>
+        <result property="createTime" column="createTime"/>
+        <result property="userId" column="userId"/>
+        <result property="status" column="status"/>
+    </resultMap>
+
+    <sql id="selectCmProvidersVo">
+        select cm_providers.id,
+               cm_providers.name,
+               cm_providers.serviceLevel,
+               cm_providers.serviceCategory,
+               cm_providers.status,
+               cm_providers.userId,
+               cm_providers.address,
+               cm_providers.linkMan,
+               cm_providers.mobile,
+               cm_providers.text,
+               cm_providers.qrCodeImage,
+               cm_providers.qualificationImage,
+               cm_providers.qualificationId,
+               cm_providers.createBy,
+               cm_providers.updateTime,
+               cm_providers.createTime
+    </sql>
+
+    <select id="getByCmProviders" parameterType="CmProviders" resultMap="CmProvidersResult">
+        <include refid="selectCmProvidersVo"/>
+        from cm_providers AS cm_providers
+        <where>
+            <if test="id != null  and id != ''">and cm_providers.id = #{id}</if>
+            <if test="name != null  and name != ''">and cm_providers.name like concat('%', #{name}, '%')</if>
+            <if test="serviceLevel != null ">and cm_providers.serviceLevel = #{serviceLevel}</if>
+            <if test="serviceCategory != null ">and cm_providers.serviceCategory = #{serviceCategory}</if>
+            <if test="status != null ">and cm_providers.status = #{status}</if>
+            <if test="userId != null ">and cm_providers.userId = #{userId}</if>
+            <if test="address != null  and address != ''">and cm_providers.address = #{address}</if>
+            <if test="linkMan != null  and linkMan != ''">and cm_providers.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''">and cm_providers.mobile = #{mobile}</if>
+            <if test="text != null  and text != ''">and cm_providers.text = #{text}</if>
+            <if test="qrCodeImage != null  and qrCodeImage != ''">and cm_providers.qrCodeImage = #{qrCodeImage}</if>
+            <if test="qualificationImage != null  and qualificationImage != ''">and cm_providers.qualificationImage =
+                #{qualificationImage}
+            </if>
+            <if test="qualificationId != null  and qualificationId != ''">and cm_providers.qualificationId =
+                #{qualificationId}
+            </if>
+        </where>
+        group by cm_providers.id
+        order by cm_providers.createTime desc
+        limit 0,1
+    </select>
+
+    <select id="getCmProvidersList" parameterType="CmProviders" resultMap="CmProvidersResult">
+        <include refid="selectCmProvidersVo"/>
+        ,cm_providers_contract.contractStartDate
+        ,cm_providers_contract.contractEndDate
+        from cm_providers AS cm_providers
+        LEFT JOIN cm_providers_contract as cm_providers_contract ON cm_providers_contract.providersId = cm_providers.id
+        <where>
+            <if test="id != null  and id != ''">and cm_providers.id = #{id}</if>
+            <if test="name != null  and name != ''">and cm_providers.name like concat('%', #{name}, '%')</if>
+            <if test="serviceLevel != null ">and cm_providers.serviceLevel = #{serviceLevel}</if>
+            <if test="status != null ">and cm_providers.status = #{status}</if>
+            <if test="userId != null ">and cm_providers.userId = #{userId}</if>
+            <if test="serviceCategory != null ">and cm_providers.serviceCategory = #{serviceCategory}</if>
+            <if test="address != null  and address != ''">and cm_providers.address = #{address}</if>
+            <if test="linkMan != null  and linkMan != ''">and cm_providers.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''">and cm_providers.mobile = #{mobile}</if>
+            <if test="text != null  and text != ''">and cm_providers.text = #{text}</if>
+            <if test="qrCodeImage != null  and qrCodeImage != ''">and cm_providers.qrCodeImage = #{qrCodeImage}</if>
+            <if test="qualificationImage != null  and qualificationImage != ''">and cm_providers.qualificationImage =
+                #{qualificationImage}
+            </if>
+            <if test="qualificationId != null  and qualificationId != ''">and cm_providers.qualificationId =
+                #{qualificationId}
+            </if>
+            <if test="contractStartDate != null ">and cm_providers_contract.contractStartDate >= #{contractStartDate}
+            </if>
+            <if test="contractEndDate != null ">and cm_providers_contract.contractEndDate  <![CDATA[ <= ]]> #{contractEndDate}</if>
+        </where>
+        group by cm_providers.id
+        order by cm_providers.createTime desc
+    </select>
+
+    <select id="getCount" parameterType="CmProviders" resultType="int">
+        select count(1)
+        from cm_providers AS cm_providers
+        <where>
+            <if test="id != null  and id != ''">and cm_providers.id = #{id}</if>
+            <if test="name != null  and name != ''">and cm_providers.name like concat('%', #{name}, '%')</if>
+            <if test="serviceLevel != null ">and cm_providers.serviceLevel = #{serviceLevel}</if>
+            <if test="userId != null ">and cm_providers.userId = #{userId}</if>
+            <if test="status != null ">and cm_providers.status = #{status}</if>
+            <if test="serviceCategory != null ">and cm_providers.serviceCategory = #{serviceCategory}</if>
+            <if test="address != null  and address != ''">and cm_providers.address = #{address}</if>
+            <if test="linkMan != null  and linkMan != ''">and cm_providers.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''">and cm_providers.mobile = #{mobile}</if>
+            <if test="text != null  and text != ''">and cm_providers.text = #{text}</if>
+            <if test="qrCodeImage != null  and qrCodeImage != ''">and cm_providers.qrCodeImage = #{qrCodeImage}</if>
+            <if test="qualificationImage != null  and qualificationImage != ''">and cm_providers.qualificationImage =
+                #{qualificationImage}
+            </if>
+            <if test="qualificationId != null  and qualificationId != ''">and cm_providers.qualificationId =
+                #{qualificationId}
+            </if>
+        </where>
+    </select>
+
+    <select id="getCmProvidersById" parameterType="String" resultMap="CmProvidersResult">
+        <include refid="selectCmProvidersVo"/>
+        from cm_providers AS cm_providers
+        where cm_providers.id = #{id}
+    </select>
+
+
+    <select id="getById" parameterType="CmProviders" resultType="String">
+        select id
+        from cm_providers AS cm_providers
+        <where>
+            <if test="id != null  and id != ''">and cm_providers.id = #{id}</if>
+            <if test="name != null  and name != ''">and cm_providers.name like concat('%', #{name}, '%')</if>
+            <if test="serviceLevel != null ">and cm_providers.serviceLevel = #{serviceLevel}</if>
+            <if test="serviceCategory != null ">and cm_providers.serviceCategory = #{serviceCategory}</if>
+            <if test="status != null ">and cm_providers.status = #{status}</if>
+            <if test="userId != null ">and cm_providers.userId = #{userId}</if>
+            <if test="address != null  and address != ''">and cm_providers.address = #{address}</if>
+            <if test="linkMan != null  and linkMan != ''">and cm_providers.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''">and cm_providers.mobile = #{mobile}</if>
+            <if test="text != null  and text != ''">and cm_providers.text = #{text}</if>
+            <if test="qrCodeImage != null  and qrCodeImage != ''">and cm_providers.qrCodeImage = #{qrCodeImage}</if>
+            <if test="qualificationImage != null  and qualificationImage != ''">and cm_providers.qualificationImage =
+                #{qualificationImage}
+            </if>
+            <if test="qualificationId != null  and qualificationId != ''">and cm_providers.qualificationId =
+                #{qualificationId}
+            </if>
+        </where>
+        group by cm_providers.id
+        limit 0,1
+    </select>
+
+    <select id="getProvidersUploadFileList" resultType="UploadFilePo">
+        select
+        <if test="type != null and type == 1">
+            qualificationImage as fileUrl,
+        </if>
+        <if test="type != null and type == 2">
+            qrCodeImage as fileUrl,
+        </if>
+        name as fileName
+        from cm_providers AS cm_providers
+        <where>
+            cm_providers.id in
+            <foreach item="idsIn"
+                     collection="ids.split(',')"
+                     open="(" separator="," close=")">
+                    #{idsIn}
+            </foreach>
+        </where>
+        group by cm_providers.id
+    </select>
+
+
+    <insert id="addCmProviders" parameterType="CmProviders" useGeneratedKeys="true" keyProperty="id">
+        insert into cm_providers
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="id != null and id != ''">id,</if>
+            <if test="name != null and name != ''">name,</if>
+            <if test="serviceLevel != null">serviceLevel,</if>
+            <if test="serviceCategory != null">serviceCategory,</if>
+            <if test="address != null and address != ''">address,</if>
+            <if test="linkMan != null and linkMan != ''">linkMan,</if>
+            <if test="mobile != null and mobile != ''">mobile,</if>
+            <if test="text != null and text != ''">text,</if>
+            <if test="qrCodeImage != null and qrCodeImage != ''">qrCodeImage,</if>
+            <if test="qualificationImage != null and qualificationImage != ''">qualificationImage,</if>
+            <if test="qualificationId != null and qualificationId != ''">qualificationId,</if>
+            <if test="createBy != null and createBy != ''">createBy,</if>
+            <if test="updateTime != null">updateTime,</if>
+            <if test="createTime != null">createTime,</if>
+            <if test="status != null">status,</if>
+            <if test="userId != null">userId,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="id != null and id != ''">#{id},</if>
+            <if test="name != null and name != ''">#{name},</if>
+            <if test="serviceLevel != null">#{serviceLevel},</if>
+            <if test="serviceCategory != null">#{serviceCategory},</if>
+            <if test="address != null and address != ''">#{address},</if>
+            <if test="linkMan != null and linkMan != ''">#{linkMan},</if>
+            <if test="mobile != null and mobile != ''">#{mobile},</if>
+            <if test="text != null and text != ''">#{text},</if>
+            <if test="qrCodeImage != null and qrCodeImage != ''">#{qrCodeImage},</if>
+            <if test="qualificationImage != null and qualificationImage != ''">#{qualificationImage},</if>
+            <if test="qualificationId != null and qualificationId != ''">#{qualificationId},</if>
+            <if test="createBy != null and createBy != ''">#{createBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="status != null">#{status},</if>
+            <if test="userId != null">#{userId},</if>
+        </trim>
+    </insert>
+
+    <update id="updateCmProviders" parameterType="CmProviders">
+        update cm_providers
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="name != null and name != ''">name = #{name},</if>
+            <if test="serviceLevel != null">serviceLevel = #{serviceLevel},</if>
+            <if test="serviceCategory != null">serviceCategory = #{serviceCategory},</if>
+            <if test="address != null and address != ''">address = #{address},</if>
+            <if test="linkMan != null and linkMan != ''">linkMan = #{linkMan},</if>
+            <if test="mobile != null and mobile != ''">mobile = #{mobile},</if>
+            <if test="text != null and text != ''">text = #{text},</if>
+            <if test="qrCodeImage != null and qrCodeImage != ''">qrCodeImage = #{qrCodeImage},</if>
+            <if test="qualificationImage != null and qualificationImage != ''">qualificationImage =
+                #{qualificationImage},
+            </if>
+            <if test="qualificationId != null and qualificationId != ''">qualificationId = #{qualificationId},</if>
+            <if test="createBy != null and createBy != ''">createBy = #{createBy},</if>
+            <if test="updateTime != null">updateTime = #{updateTime},</if>
+            <if test="createTime != null">createTime = #{createTime},</if>
+            <if test="status != null">status = #{status},</if>
+            <if test="userId != null">userId = #{userId},</if>
+        </trim>
+        where id = #{id}
+        <if test="userId != null">or userId = #{userId}</if>
+    </update>
+
+    <delete id="delCmProvidersById" parameterType="String">
+        delete
+        from cm_providers
+        where id = #{id}
+    </delete>
+
+    <delete id="delCmProviders" parameterType="CmProviders">
+        delete
+        from cm_providers AS cm_providers
+        <where>
+            <if test="id != null  and id != ''">and cm_providers.id = #{id}</if>
+            <if test="name != null  and name != ''">and cm_providers.name like concat('%', #{name}, '%')</if>
+            <if test="serviceLevel != null ">and cm_providers.serviceLevel = #{serviceLevel}</if>
+            <if test="serviceCategory != null ">and cm_providers.serviceCategory = #{serviceCategory}</if>
+            <if test="status != null ">and cm_providers.status = #{status}</if>
+            <if test="userId != null ">and cm_providers.userId = #{userId}</if>
+            <if test="address != null  and address != ''">and cm_providers.address = #{address}</if>
+            <if test="linkMan != null  and linkMan != ''">and cm_providers.linkMan = #{linkMan}</if>
+            <if test="mobile != null  and mobile != ''">and cm_providers.mobile = #{mobile}</if>
+            <if test="text != null  and text != ''">and cm_providers.text = #{text}</if>
+            <if test="qrCodeImage != null  and qrCodeImage != ''">and cm_providers.qrCodeImage = #{qrCodeImage}</if>
+            <if test="qualificationImage != null  and qualificationImage != ''">and cm_providers.qualificationImage =
+                #{qualificationImage}
+            </if>
+            <if test="qualificationId != null  and qualificationId != ''">and cm_providers.qualificationId =
+                #{qualificationId}
+            </if>
+        </where>
+    </delete>
+
+</mapper>

+ 521 - 0
src/main/resources/mapper/user/UserMapper.xml

@@ -0,0 +1,521 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.caimei365.manager.dao.user.UserMapper">
+
+    <resultMap type="User" id="UserResult">
+        <result property="userID"    column="userID"    />
+        <result property="userOrganizeID"    column="userOrganizeID"    />
+        <result property="account"    column="account"    />
+        <result property="mobile"    column="mobile"    />
+        <result property="bindMobile"    column="bindMobile"    />
+        <result property="userPermission"    column="userPermission"    />
+        <result property="userIdentity"    column="userIdentity"    />
+        <result property="email"    column="email"    />
+        <result property="userName"    column="userName"    />
+        <result property="realName"    column="realName"    />
+        <result property="source"    column="source"    />
+        <result property="image"    column="image"    />
+        <result property="password"    column="password"    />
+        <result property="name"    column="name"    />
+        <result property="registerUserTypeID"    column="registerUserTypeID"    />
+        <result property="manufacturerStatus"    column="manufacturerStatus"    />
+        <result property="shopID"    column="shopID"    />
+        <result property="auditStatus"    column="auditStatus"    />
+        <result property="auditTime"    column="auditTime"    />
+        <result property="auditNote"    column="auditNote"    />
+        <result property="registerTime"    column="registerTime"    />
+        <result property="registerIP"    column="registerIP"    />
+        <result property="ipAddress"    column="ipAddress"    />
+        <result property="loginTime"    column="loginTime"    />
+        <result property="loginIP"    column="loginIP"    />
+        <result property="validFlag"    column="validFlag"    />
+        <result property="clubStatus"    column="clubStatus"    />
+        <result property="clubID"    column="clubID"    />
+        <result property="agreeFlag"    column="agreeFlag"    />
+        <result property="serviceProviderStatus"    column="serviceProviderStatus"    />
+        <result property="serviceProviderID"    column="serviceProviderID"    />
+        <result property="userMoney"    column="userMoney"    />
+        <result property="ableUserMoney"    column="ableUserMoney"    />
+        <result property="logoffTime"    column="logoffTime"    />
+        <result property="appKey"    column="appKey"    />
+        <result property="appSecret"    column="appSecret"    />
+        <result property="scanFlag"    column="scanFlag"    />
+        <result property="userBeans"    column="userBeans"    />
+        <result property="guideFlag"    column="guideFlag"    />
+        <result property="loginFailTime"    column="loginFailTime"    />
+        <result property="tipStatus"    column="tipStatus"    />
+        <result property="onlineMoney"    column="onlineMoney"    />
+        <result property="unionId"    column="unionId"    />
+        <result property="openId"    column="openId"    />
+    </resultMap>
+
+    <sql id="selectUserVo">
+        select
+            user.userID,
+            user.userOrganizeID,
+            user.account,
+            user.mobile,
+            user.bindMobile,
+            user.userPermission,
+            user.userIdentity,
+            user.email,
+            user.userName,
+            user.realName,
+            user.source,
+            user.image,
+            user.password,
+            user.name,
+            user.registerUserTypeID,
+            user.manufacturerStatus,
+            user.shopID,
+            user.auditStatus,
+            user.auditTime,
+            user.auditNote,
+            user.registerTime,
+            user.registerIP,
+            user.ipAddress,
+            user.loginTime,
+            user.loginIP,
+            user.validFlag,
+            user.clubStatus,
+            user.clubID,
+            user.agreeFlag,
+            user.serviceProviderStatus,
+            user.serviceProviderID,
+            ifnull(user.userMoney,0) AS userMoney,
+            ifnull(user.ableUserMoney,0) AS ableUserMoney,
+            user.logoffTime,
+            user.appKey,
+            user.appSecret,
+            user.scanFlag,
+            user.userBeans,
+            user.guideFlag,
+            user.loginFailTime,
+            user.tipStatus,
+            ifnull(user.onlineMoney,0) AS onlineMoney,
+            user.unionId,
+            user.openId
+    </sql>
+
+    <select id="getByUser" parameterType="User" resultMap="UserResult">
+        <include refid="selectUserVo"/>
+        from user AS user
+        <where>  user.delFlag = 0
+            <if test="userID != null  and userID != ''"> and user.userID = #{userID}</if>
+            <if test="userOrganizeID != null "> and user.userOrganizeID = #{userOrganizeID}</if>
+            <if test="account != null  and account != ''"> and user.account = #{account}</if>
+            <if test="mobile != null  and mobile != ''"> and user.mobile = #{mobile}</if>
+            <if test="bindMobile != null  and bindMobile != ''"> and user.bindMobile = #{bindMobile}</if>
+            <if test="userPermission != null "> and user.userPermission = #{userPermission}</if>
+            <if test="userIdentity != null "> and user.userIdentity = #{userIdentity}</if>
+            <if test="email != null  and email != ''"> and user.email = #{email}</if>
+            <if test="userName != null  and userName != ''"> and user.userName like concat('%', #{userName}, '%')</if>
+            <if test="realName != null  and realName != ''"> and user.realName like concat('%', #{realName}, '%')</if>
+            <if test="source != null  and source != ''"> and user.source = #{source}</if>
+            <if test="image != null  and image != ''"> and user.image = #{image}</if>
+            <if test="password != null  and password != ''"> and user.password = #{password}</if>
+            <if test="name != null  and name != ''"> and user.name like concat('%', #{name}, '%')</if>
+            <if test="registerUserTypeID != null  and registerUserTypeID != ''"> and user.registerUserTypeID = #{registerUserTypeID}</if>
+            <if test="manufacturerStatus != null "> and user.manufacturerStatus = #{manufacturerStatus}</if>
+            <if test="shopID != null "> and user.shopID = #{shopID}</if>
+            <if test="auditStatus != null  and auditStatus != ''"> and user.auditStatus = #{auditStatus}</if>
+            <if test="auditTime != null  and auditTime != ''"> and user.auditTime = #{auditTime}</if>
+            <if test="auditNote != null  and auditNote != ''"> and user.auditNote = #{auditNote}</if>
+            <if test="registerTime != null  and registerTime != ''"> and user.registerTime = #{registerTime}</if>
+            <if test="registerIP != null  and registerIP != ''"> and user.registerIP = #{registerIP}</if>
+            <if test="ipAddress != null  and ipAddress != ''"> and user.ipAddress = #{ipAddress}</if>
+            <if test="loginTime != null  and loginTime != ''"> and user.loginTime = #{loginTime}</if>
+            <if test="loginIP != null  and loginIP != ''"> and user.loginIP = #{loginIP}</if>
+            <if test="validFlag != null  and validFlag != ''"> and user.validFlag = #{validFlag}</if>
+            <if test="clubStatus != null "> and user.clubStatus = #{clubStatus}</if>
+            <if test="clubID != null "> and user.clubID = #{clubID}</if>
+            <if test="agreeFlag != null  and agreeFlag != ''"> and user.agreeFlag = #{agreeFlag}</if>
+            <if test="serviceProviderStatus != null "> and user.serviceProviderStatus = #{serviceProviderStatus}</if>
+            <if test="serviceProviderID != null "> and user.serviceProviderID = #{serviceProviderID}</if>
+            <if test="userMoney != null "> and user.userMoney = #{userMoney}</if>
+            <if test="ableUserMoney != null "> and user.ableUserMoney = #{ableUserMoney}</if>
+            <if test="logoffTime != null  and logoffTime != ''"> and user.logoffTime = #{logoffTime}</if>
+            <if test="appKey != null  and appKey != ''"> and user.appKey = #{appKey}</if>
+            <if test="appSecret != null  and appSecret != ''"> and user.appSecret = #{appSecret}</if>
+            <if test="scanFlag != null "> and user.scanFlag = #{scanFlag}</if>
+            <if test="userBeans != null "> and user.userBeans = #{userBeans}</if>
+            <if test="guideFlag != null "> and user.guideFlag = #{guideFlag}</if>
+            <if test="loginFailTime != null "> and user.loginFailTime = #{loginFailTime}</if>
+            <if test="tipStatus != null  and tipStatus != ''"> and user.tipStatus = #{tipStatus}</if>
+            <if test="onlineMoney != null "> and user.onlineMoney = #{onlineMoney}</if>
+            <if test="unionId != null  and unionId != ''"> and user.unionId = #{unionId}</if>
+            <if test="openId != null  and openId != ''"> and user.openId = #{openId}</if>
+        </where>
+        group by user.userID
+        limit 0,1
+    </select>
+
+    <select id="getUserList" parameterType="User" resultMap="UserResult">
+        <include refid="selectUserVo"/>
+        from user AS user
+        <where>  user.delFlag = 0
+            <if test="userID != null  and userID != ''"> and user.userID = #{userID}</if>
+            <if test="userOrganizeID != null "> and user.userOrganizeID = #{userOrganizeID}</if>
+            <if test="account != null  and account != ''"> and user.account = #{account}</if>
+            <if test="mobile != null  and mobile != ''"> and user.mobile = #{mobile}</if>
+            <if test="bindMobile != null  and bindMobile != ''"> and user.bindMobile = #{bindMobile}</if>
+            <if test="userPermission != null "> and user.userPermission = #{userPermission}</if>
+            <if test="userIdentity != null "> and user.userIdentity = #{userIdentity}</if>
+            <if test="email != null  and email != ''"> and user.email = #{email}</if>
+            <if test="userName != null  and userName != ''"> and user.userName like concat('%', #{userName}, '%')</if>
+            <if test="realName != null  and realName != ''"> and user.realName like concat('%', #{realName}, '%')</if>
+            <if test="source != null  and source != ''"> and user.source = #{source}</if>
+            <if test="image != null  and image != ''"> and user.image = #{image}</if>
+            <if test="password != null  and password != ''"> and user.password = #{password}</if>
+            <if test="name != null  and name != ''"> and user.name like concat('%', #{name}, '%')</if>
+            <if test="registerUserTypeID != null  and registerUserTypeID != ''"> and user.registerUserTypeID = #{registerUserTypeID}</if>
+            <if test="manufacturerStatus != null "> and user.manufacturerStatus = #{manufacturerStatus}</if>
+            <if test="shopID != null "> and user.shopID = #{shopID}</if>
+            <if test="auditStatus != null  and auditStatus != ''"> and user.auditStatus = #{auditStatus}</if>
+            <if test="auditTime != null  and auditTime != ''"> and user.auditTime = #{auditTime}</if>
+            <if test="auditNote != null  and auditNote != ''"> and user.auditNote = #{auditNote}</if>
+            <if test="registerTime != null  and registerTime != ''"> and user.registerTime = #{registerTime}</if>
+            <if test="registerIP != null  and registerIP != ''"> and user.registerIP = #{registerIP}</if>
+            <if test="ipAddress != null  and ipAddress != ''"> and user.ipAddress = #{ipAddress}</if>
+            <if test="loginTime != null  and loginTime != ''"> and user.loginTime = #{loginTime}</if>
+            <if test="loginIP != null  and loginIP != ''"> and user.loginIP = #{loginIP}</if>
+            <if test="validFlag != null  and validFlag != ''"> and user.validFlag = #{validFlag}</if>
+            <if test="clubStatus != null "> and user.clubStatus = #{clubStatus}</if>
+            <if test="clubID != null "> and user.clubID = #{clubID}</if>
+            <if test="agreeFlag != null  and agreeFlag != ''"> and user.agreeFlag = #{agreeFlag}</if>
+            <if test="serviceProviderStatus != null "> and user.serviceProviderStatus = #{serviceProviderStatus}</if>
+            <if test="serviceProviderID != null "> and user.serviceProviderID = #{serviceProviderID}</if>
+            <if test="userMoney != null "> and user.userMoney = #{userMoney}</if>
+            <if test="ableUserMoney != null "> and user.ableUserMoney = #{ableUserMoney}</if>
+            <if test="logoffTime != null  and logoffTime != ''"> and user.logoffTime = #{logoffTime}</if>
+            <if test="appKey != null  and appKey != ''"> and user.appKey = #{appKey}</if>
+            <if test="appSecret != null  and appSecret != ''"> and user.appSecret = #{appSecret}</if>
+            <if test="scanFlag != null "> and user.scanFlag = #{scanFlag}</if>
+            <if test="userBeans != null "> and user.userBeans = #{userBeans}</if>
+            <if test="guideFlag != null "> and user.guideFlag = #{guideFlag}</if>
+            <if test="loginFailTime != null "> and user.loginFailTime = #{loginFailTime}</if>
+            <if test="tipStatus != null  and tipStatus != ''"> and user.tipStatus = #{tipStatus}</if>
+            <if test="onlineMoney != null "> and user.onlineMoney = #{onlineMoney}</if>
+            <if test="unionId != null  and unionId != ''"> and user.unionId = #{unionId}</if>
+            <if test="openId != null  and openId != ''"> and user.openId = #{openId}</if>
+        </where>
+        group by user.userID
+        order by user.createTime desc
+    </select>
+
+    <select id="getCount" parameterType="User" resultType="int">
+        select count(1)
+        from user AS user
+        <where>  user.delFlag = 0
+            <if test="userID != null  and userID != ''"> and user.userID = #{userID}</if>
+            <if test="userOrganizeID != null "> and user.userOrganizeID = #{userOrganizeID}</if>
+            <if test="account != null  and account != ''"> and user.account = #{account}</if>
+            <if test="mobile != null  and mobile != ''"> and user.mobile = #{mobile}</if>
+            <if test="bindMobile != null  and bindMobile != ''"> and user.bindMobile = #{bindMobile}</if>
+            <if test="userPermission != null "> and user.userPermission = #{userPermission}</if>
+            <if test="userIdentity != null "> and user.userIdentity = #{userIdentity}</if>
+            <if test="email != null  and email != ''"> and user.email = #{email}</if>
+            <if test="userName != null  and userName != ''"> and user.userName like concat('%', #{userName}, '%')</if>
+            <if test="realName != null  and realName != ''"> and user.realName like concat('%', #{realName}, '%')</if>
+            <if test="source != null  and source != ''"> and user.source = #{source}</if>
+            <if test="image != null  and image != ''"> and user.image = #{image}</if>
+            <if test="password != null  and password != ''"> and user.password = #{password}</if>
+            <if test="name != null  and name != ''"> and user.name like concat('%', #{name}, '%')</if>
+            <if test="registerUserTypeID != null  and registerUserTypeID != ''"> and user.registerUserTypeID = #{registerUserTypeID}</if>
+            <if test="manufacturerStatus != null "> and user.manufacturerStatus = #{manufacturerStatus}</if>
+            <if test="shopID != null "> and user.shopID = #{shopID}</if>
+            <if test="auditStatus != null  and auditStatus != ''"> and user.auditStatus = #{auditStatus}</if>
+            <if test="auditTime != null  and auditTime != ''"> and user.auditTime = #{auditTime}</if>
+            <if test="auditNote != null  and auditNote != ''"> and user.auditNote = #{auditNote}</if>
+            <if test="registerTime != null  and registerTime != ''"> and user.registerTime = #{registerTime}</if>
+            <if test="registerIP != null  and registerIP != ''"> and user.registerIP = #{registerIP}</if>
+            <if test="ipAddress != null  and ipAddress != ''"> and user.ipAddress = #{ipAddress}</if>
+            <if test="loginTime != null  and loginTime != ''"> and user.loginTime = #{loginTime}</if>
+            <if test="loginIP != null  and loginIP != ''"> and user.loginIP = #{loginIP}</if>
+            <if test="validFlag != null  and validFlag != ''"> and user.validFlag = #{validFlag}</if>
+            <if test="clubStatus != null "> and user.clubStatus = #{clubStatus}</if>
+            <if test="clubID != null "> and user.clubID = #{clubID}</if>
+            <if test="agreeFlag != null  and agreeFlag != ''"> and user.agreeFlag = #{agreeFlag}</if>
+            <if test="serviceProviderStatus != null "> and user.serviceProviderStatus = #{serviceProviderStatus}</if>
+            <if test="serviceProviderID != null "> and user.serviceProviderID = #{serviceProviderID}</if>
+            <if test="userMoney != null "> and user.userMoney = #{userMoney}</if>
+            <if test="ableUserMoney != null "> and user.ableUserMoney = #{ableUserMoney}</if>
+            <if test="logoffTime != null  and logoffTime != ''"> and user.logoffTime = #{logoffTime}</if>
+            <if test="appKey != null  and appKey != ''"> and user.appKey = #{appKey}</if>
+            <if test="appSecret != null  and appSecret != ''"> and user.appSecret = #{appSecret}</if>
+            <if test="scanFlag != null "> and user.scanFlag = #{scanFlag}</if>
+            <if test="userBeans != null "> and user.userBeans = #{userBeans}</if>
+            <if test="guideFlag != null "> and user.guideFlag = #{guideFlag}</if>
+            <if test="loginFailTime != null "> and user.loginFailTime = #{loginFailTime}</if>
+            <if test="tipStatus != null  and tipStatus != ''"> and user.tipStatus = #{tipStatus}</if>
+            <if test="onlineMoney != null "> and user.onlineMoney = #{onlineMoney}</if>
+            <if test="unionId != null  and unionId != ''"> and user.unionId = #{unionId}</if>
+            <if test="openId != null  and openId != ''"> and user.openId = #{openId}</if>
+        </where>
+    </select>
+
+    <select id="getUserById" parameterType="String" resultMap="UserResult">
+        <include refid="selectUserVo"/>
+        from user AS user
+        where  user.delFlag = 0 and user.userID = #{userID}
+    </select>
+
+
+    <select id="getById" parameterType="User" resultType="String">
+        select userID
+        from user AS user
+        <where>  user.delFlag = 0
+            <if test="userID != null  and userID != ''"> and user.userID = #{userID}</if>
+            <if test="userOrganizeID != null "> and user.userOrganizeID = #{userOrganizeID}</if>
+            <if test="account != null  and account != ''"> and user.account = #{account}</if>
+            <if test="mobile != null  and mobile != ''"> and user.mobile = #{mobile}</if>
+            <if test="bindMobile != null  and bindMobile != ''"> and user.bindMobile = #{bindMobile}</if>
+            <if test="userPermission != null "> and user.userPermission = #{userPermission}</if>
+            <if test="userIdentity != null "> and user.userIdentity = #{userIdentity}</if>
+            <if test="email != null  and email != ''"> and user.email = #{email}</if>
+            <if test="userName != null  and userName != ''"> and user.userName like concat('%', #{userName}, '%')</if>
+            <if test="realName != null  and realName != ''"> and user.realName like concat('%', #{realName}, '%')</if>
+            <if test="source != null  and source != ''"> and user.source = #{source}</if>
+            <if test="image != null  and image != ''"> and user.image = #{image}</if>
+            <if test="password != null  and password != ''"> and user.password = #{password}</if>
+            <if test="name != null  and name != ''"> and user.name like concat('%', #{name}, '%')</if>
+            <if test="registerUserTypeID != null  and registerUserTypeID != ''"> and user.registerUserTypeID = #{registerUserTypeID}</if>
+            <if test="manufacturerStatus != null "> and user.manufacturerStatus = #{manufacturerStatus}</if>
+            <if test="shopID != null "> and user.shopID = #{shopID}</if>
+            <if test="auditStatus != null  and auditStatus != ''"> and user.auditStatus = #{auditStatus}</if>
+            <if test="auditTime != null  and auditTime != ''"> and user.auditTime = #{auditTime}</if>
+            <if test="auditNote != null  and auditNote != ''"> and user.auditNote = #{auditNote}</if>
+            <if test="registerTime != null  and registerTime != ''"> and user.registerTime = #{registerTime}</if>
+            <if test="registerIP != null  and registerIP != ''"> and user.registerIP = #{registerIP}</if>
+            <if test="ipAddress != null  and ipAddress != ''"> and user.ipAddress = #{ipAddress}</if>
+            <if test="loginTime != null  and loginTime != ''"> and user.loginTime = #{loginTime}</if>
+            <if test="loginIP != null  and loginIP != ''"> and user.loginIP = #{loginIP}</if>
+            <if test="validFlag != null  and validFlag != ''"> and user.validFlag = #{validFlag}</if>
+            <if test="clubStatus != null "> and user.clubStatus = #{clubStatus}</if>
+            <if test="clubID != null "> and user.clubID = #{clubID}</if>
+            <if test="agreeFlag != null  and agreeFlag != ''"> and user.agreeFlag = #{agreeFlag}</if>
+            <if test="serviceProviderStatus != null "> and user.serviceProviderStatus = #{serviceProviderStatus}</if>
+            <if test="serviceProviderID != null "> and user.serviceProviderID = #{serviceProviderID}</if>
+            <if test="userMoney != null "> and user.userMoney = #{userMoney}</if>
+            <if test="ableUserMoney != null "> and user.ableUserMoney = #{ableUserMoney}</if>
+            <if test="logoffTime != null  and logoffTime != ''"> and user.logoffTime = #{logoffTime}</if>
+            <if test="appKey != null  and appKey != ''"> and user.appKey = #{appKey}</if>
+            <if test="appSecret != null  and appSecret != ''"> and user.appSecret = #{appSecret}</if>
+            <if test="scanFlag != null "> and user.scanFlag = #{scanFlag}</if>
+            <if test="userBeans != null "> and user.userBeans = #{userBeans}</if>
+            <if test="guideFlag != null "> and user.guideFlag = #{guideFlag}</if>
+            <if test="loginFailTime != null "> and user.loginFailTime = #{loginFailTime}</if>
+            <if test="tipStatus != null  and tipStatus != ''"> and user.tipStatus = #{tipStatus}</if>
+            <if test="onlineMoney != null "> and user.onlineMoney = #{onlineMoney}</if>
+            <if test="unionId != null  and unionId != ''"> and user.unionId = #{unionId}</if>
+            <if test="openId != null  and openId != ''"> and user.openId = #{openId}</if>
+        </where>
+        group by user.userID
+        limit 0,1
+    </select>
+
+    <insert id="addUser" parameterType="User" useGeneratedKeys="true" keyProperty="userID">
+        insert into user
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="userID != null and userID != ''">userID,</if>
+            <if test="userOrganizeID != null">userOrganizeID,</if>
+            <if test="account != null and account != ''">account,</if>
+            <if test="mobile != null and mobile != ''">mobile,</if>
+            <if test="bindMobile != null and bindMobile != ''">bindMobile,</if>
+            <if test="userPermission != null">userPermission,</if>
+            <if test="userIdentity != null">userIdentity,</if>
+            <if test="email != null and email != ''">email,</if>
+            <if test="userName != null and userName != ''">userName,</if>
+            <if test="realName != null and realName != ''">realName,</if>
+            <if test="source != null and source != ''">source,</if>
+            <if test="image != null and image != ''">image,</if>
+            <if test="password != null and password != ''">password,</if>
+            <if test="name != null and name != ''">name,</if>
+            <if test="registerUserTypeID != null and registerUserTypeID != ''">registerUserTypeID,</if>
+            <if test="manufacturerStatus != null">manufacturerStatus,</if>
+            <if test="shopID != null">shopID,</if>
+            <if test="auditStatus != null and auditStatus != ''">auditStatus,</if>
+            <if test="auditTime != null and auditTime != ''">auditTime,</if>
+            <if test="auditNote != null and auditNote != ''">auditNote,</if>
+            <if test="registerTime != null and registerTime != ''">registerTime,</if>
+            <if test="registerIP != null and registerIP != ''">registerIP,</if>
+            <if test="ipAddress != null and ipAddress != ''">ipAddress,</if>
+            <if test="loginTime != null and loginTime != ''">loginTime,</if>
+            <if test="loginIP != null and loginIP != ''">loginIP,</if>
+            <if test="validFlag != null and validFlag != ''">validFlag,</if>
+            <if test="clubStatus != null">clubStatus,</if>
+            <if test="clubID != null">clubID,</if>
+            <if test="agreeFlag != null and agreeFlag != ''">agreeFlag,</if>
+            <if test="serviceProviderStatus != null">serviceProviderStatus,</if>
+            <if test="serviceProviderID != null">serviceProviderID,</if>
+            <if test="userMoney != null">userMoney,</if>
+            <if test="ableUserMoney != null">ableUserMoney,</if>
+            <if test="logoffTime != null and logoffTime != ''">logoffTime,</if>
+            <if test="appKey != null and appKey != ''">appKey,</if>
+            <if test="appSecret != null and appSecret != ''">appSecret,</if>
+            <if test="scanFlag != null">scanFlag,</if>
+            <if test="userBeans != null">userBeans,</if>
+            <if test="guideFlag != null">guideFlag,</if>
+            <if test="loginFailTime != null">loginFailTime,</if>
+            <if test="tipStatus != null and tipStatus != ''">tipStatus,</if>
+            <if test="onlineMoney != null">onlineMoney,</if>
+            <if test="unionId != null and unionId != ''">unionId,</if>
+            <if test="openId != null and openId != ''">openId,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="userID != null and userID != ''">#{userID},</if>
+            <if test="userOrganizeID != null">#{userOrganizeID},</if>
+            <if test="account != null and account != ''">#{account},</if>
+            <if test="mobile != null and mobile != ''">#{mobile},</if>
+            <if test="bindMobile != null and bindMobile != ''">#{bindMobile},</if>
+            <if test="userPermission != null">#{userPermission},</if>
+            <if test="userIdentity != null">#{userIdentity},</if>
+            <if test="email != null and email != ''">#{email},</if>
+            <if test="userName != null and userName != ''">#{userName},</if>
+            <if test="realName != null and realName != ''">#{realName},</if>
+            <if test="source != null and source != ''">#{source},</if>
+            <if test="image != null and image != ''">#{image},</if>
+            <if test="password != null and password != ''">#{password},</if>
+            <if test="name != null and name != ''">#{name},</if>
+            <if test="registerUserTypeID != null and registerUserTypeID != ''">#{registerUserTypeID},</if>
+            <if test="manufacturerStatus != null">#{manufacturerStatus},</if>
+            <if test="shopID != null">#{shopID},</if>
+            <if test="auditStatus != null and auditStatus != ''">#{auditStatus},</if>
+            <if test="auditTime != null and auditTime != ''">#{auditTime},</if>
+            <if test="auditNote != null and auditNote != ''">#{auditNote},</if>
+            <if test="registerTime != null and registerTime != ''">#{registerTime},</if>
+            <if test="registerIP != null and registerIP != ''">#{registerIP},</if>
+            <if test="ipAddress != null and ipAddress != ''">#{ipAddress},</if>
+            <if test="loginTime != null and loginTime != ''">#{loginTime},</if>
+            <if test="loginIP != null and loginIP != ''">#{loginIP},</if>
+            <if test="validFlag != null and validFlag != ''">#{validFlag},</if>
+            <if test="clubStatus != null">#{clubStatus},</if>
+            <if test="clubID != null">#{clubID},</if>
+            <if test="agreeFlag != null and agreeFlag != ''">#{agreeFlag},</if>
+            <if test="serviceProviderStatus != null">#{serviceProviderStatus},</if>
+            <if test="serviceProviderID != null">#{serviceProviderID},</if>
+            <if test="userMoney != null">#{userMoney},</if>
+            <if test="ableUserMoney != null">#{ableUserMoney},</if>
+            <if test="logoffTime != null and logoffTime != ''">#{logoffTime},</if>
+            <if test="appKey != null and appKey != ''">#{appKey},</if>
+            <if test="appSecret != null and appSecret != ''">#{appSecret},</if>
+            <if test="scanFlag != null">#{scanFlag},</if>
+            <if test="userBeans != null">#{userBeans},</if>
+            <if test="guideFlag != null">#{guideFlag},</if>
+            <if test="loginFailTime != null">#{loginFailTime},</if>
+            <if test="tipStatus != null and tipStatus != ''">#{tipStatus},</if>
+            <if test="onlineMoney != null">#{onlineMoney},</if>
+            <if test="unionId != null and unionId != ''">#{unionId},</if>
+            <if test="openId != null and openId != ''">#{openId},</if>
+        </trim>
+    </insert>
+
+    <update id="updateUser" parameterType="User">
+        update user
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="userOrganizeID != null">userOrganizeID = #{userOrganizeID},</if>
+            <if test="account != null and account != ''">account = #{account},</if>
+            <if test="mobile != null and mobile != ''">mobile = #{mobile},</if>
+            <if test="bindMobile != null and bindMobile != ''">bindMobile = #{bindMobile},</if>
+            <if test="userPermission != null">userPermission = #{userPermission},</if>
+            <if test="userIdentity != null">userIdentity = #{userIdentity},</if>
+            <if test="email != null and email != ''">email = #{email},</if>
+            <if test="userName != null and userName != ''">userName = #{userName},</if>
+            <if test="realName != null and realName != ''">realName = #{realName},</if>
+            <if test="source != null and source != ''">source = #{source},</if>
+            <if test="image != null and image != ''">image = #{image},</if>
+            <if test="password != null and password != ''">password = #{password},</if>
+            <if test="name != null and name != ''">name = #{name},</if>
+            <if test="registerUserTypeID != null and registerUserTypeID != ''">registerUserTypeID = #{registerUserTypeID},</if>
+            <if test="manufacturerStatus != null">manufacturerStatus = #{manufacturerStatus},</if>
+            <if test="shopID != null">shopID = #{shopID},</if>
+            <if test="auditStatus != null and auditStatus != ''">auditStatus = #{auditStatus},</if>
+            <if test="auditTime != null and auditTime != ''">auditTime = #{auditTime},</if>
+            <if test="auditNote != null and auditNote != ''">auditNote = #{auditNote},</if>
+            <if test="registerTime != null and registerTime != ''">registerTime = #{registerTime},</if>
+            <if test="registerIP != null and registerIP != ''">registerIP = #{registerIP},</if>
+            <if test="ipAddress != null and ipAddress != ''">ipAddress = #{ipAddress},</if>
+            <if test="loginTime != null and loginTime != ''">loginTime = #{loginTime},</if>
+            <if test="loginIP != null and loginIP != ''">loginIP = #{loginIP},</if>
+            <if test="validFlag != null and validFlag != ''">validFlag = #{validFlag},</if>
+            <if test="clubStatus != null">clubStatus = #{clubStatus},</if>
+            <if test="clubID != null">clubID = #{clubID},</if>
+            <if test="agreeFlag != null and agreeFlag != ''">agreeFlag = #{agreeFlag},</if>
+            <if test="serviceProviderStatus != null">serviceProviderStatus = #{serviceProviderStatus},</if>
+            <if test="serviceProviderID != null">serviceProviderID = #{serviceProviderID},</if>
+            <if test="userMoney != null">userMoney = #{userMoney},</if>
+            <if test="ableUserMoney != null">ableUserMoney = #{ableUserMoney},</if>
+            <if test="logoffTime != null and logoffTime != ''">logoffTime = #{logoffTime},</if>
+            <if test="appKey != null and appKey != ''">appKey = #{appKey},</if>
+            <if test="appSecret != null and appSecret != ''">appSecret = #{appSecret},</if>
+            <if test="scanFlag != null">scanFlag = #{scanFlag},</if>
+            <if test="userBeans != null">userBeans = #{userBeans},</if>
+            <if test="guideFlag != null">guideFlag = #{guideFlag},</if>
+            <if test="loginFailTime != null">loginFailTime = #{loginFailTime},</if>
+            <if test="tipStatus != null and tipStatus != ''">tipStatus = #{tipStatus},</if>
+            <if test="onlineMoney != null">onlineMoney = #{onlineMoney},</if>
+            <if test="unionId != null and unionId != ''">unionId = #{unionId},</if>
+            <if test="openId != null and openId != ''">openId = #{openId},</if>
+        </trim>
+        where userID = #{userID}
+    </update>
+
+    <delete id="delUserByUserID" parameterType="String">
+        delete
+        from user where userID = #{userID}
+    </delete>
+
+    <delete id="delUser" parameterType="User">
+        delete
+        from user AS user
+        <where>
+            <if test="userID != null  and userID != ''"> and user.userID = #{userID}</if>
+            <if test="userOrganizeID != null "> and user.userOrganizeID = #{userOrganizeID}</if>
+            <if test="account != null  and account != ''"> and user.account = #{account}</if>
+            <if test="mobile != null  and mobile != ''"> and user.mobile = #{mobile}</if>
+            <if test="bindMobile != null  and bindMobile != ''"> and user.bindMobile = #{bindMobile}</if>
+            <if test="userPermission != null "> and user.userPermission = #{userPermission}</if>
+            <if test="userIdentity != null "> and user.userIdentity = #{userIdentity}</if>
+            <if test="email != null  and email != ''"> and user.email = #{email}</if>
+            <if test="userName != null  and userName != ''"> and user.userName like concat('%', #{userName}, '%')</if>
+            <if test="realName != null  and realName != ''"> and user.realName like concat('%', #{realName}, '%')</if>
+            <if test="source != null  and source != ''"> and user.source = #{source}</if>
+            <if test="image != null  and image != ''"> and user.image = #{image}</if>
+            <if test="password != null  and password != ''"> and user.password = #{password}</if>
+            <if test="name != null  and name != ''"> and user.name like concat('%', #{name}, '%')</if>
+            <if test="registerUserTypeID != null  and registerUserTypeID != ''"> and user.registerUserTypeID = #{registerUserTypeID}</if>
+            <if test="manufacturerStatus != null "> and user.manufacturerStatus = #{manufacturerStatus}</if>
+            <if test="shopID != null "> and user.shopID = #{shopID}</if>
+            <if test="auditStatus != null  and auditStatus != ''"> and user.auditStatus = #{auditStatus}</if>
+            <if test="auditTime != null  and auditTime != ''"> and user.auditTime = #{auditTime}</if>
+            <if test="auditNote != null  and auditNote != ''"> and user.auditNote = #{auditNote}</if>
+            <if test="registerTime != null  and registerTime != ''"> and user.registerTime = #{registerTime}</if>
+            <if test="registerIP != null  and registerIP != ''"> and user.registerIP = #{registerIP}</if>
+            <if test="ipAddress != null  and ipAddress != ''"> and user.ipAddress = #{ipAddress}</if>
+            <if test="loginTime != null  and loginTime != ''"> and user.loginTime = #{loginTime}</if>
+            <if test="loginIP != null  and loginIP != ''"> and user.loginIP = #{loginIP}</if>
+            <if test="validFlag != null  and validFlag != ''"> and user.validFlag = #{validFlag}</if>
+            <if test="clubStatus != null "> and user.clubStatus = #{clubStatus}</if>
+            <if test="clubID != null "> and user.clubID = #{clubID}</if>
+            <if test="agreeFlag != null  and agreeFlag != ''"> and user.agreeFlag = #{agreeFlag}</if>
+            <if test="serviceProviderStatus != null "> and user.serviceProviderStatus = #{serviceProviderStatus}</if>
+            <if test="serviceProviderID != null "> and user.serviceProviderID = #{serviceProviderID}</if>
+            <if test="userMoney != null "> and user.userMoney = #{userMoney}</if>
+            <if test="ableUserMoney != null "> and user.ableUserMoney = #{ableUserMoney}</if>
+            <if test="logoffTime != null  and logoffTime != ''"> and user.logoffTime = #{logoffTime}</if>
+            <if test="appKey != null  and appKey != ''"> and user.appKey = #{appKey}</if>
+            <if test="appSecret != null  and appSecret != ''"> and user.appSecret = #{appSecret}</if>
+            <if test="scanFlag != null "> and user.scanFlag = #{scanFlag}</if>
+            <if test="userBeans != null "> and user.userBeans = #{userBeans}</if>
+            <if test="guideFlag != null "> and user.guideFlag = #{guideFlag}</if>
+            <if test="loginFailTime != null "> and user.loginFailTime = #{loginFailTime}</if>
+            <if test="tipStatus != null  and tipStatus != ''"> and user.tipStatus = #{tipStatus}</if>
+            <if test="onlineMoney != null "> and user.onlineMoney = #{onlineMoney}</if>
+            <if test="unionId != null  and unionId != ''"> and user.unionId = #{unionId}</if>
+            <if test="openId != null  and openId != ''"> and user.openId = #{openId}</if>
+        </where>
+    </delete>
+
+</mapper>