浏览代码

20240624 会员管理

lwhhszx 1 年之前
父节点
当前提交
6cd7575e99
共有 80 个文件被更改,包括 2486 次插入166 次删除
  1. 6 0
      pom.xml
  2. 17 0
      src/main/java/com/example/xiaoshiweixinback/business/config/InsertBatchSqlInjector.java
  3. 16 0
      src/main/java/com/example/xiaoshiweixinback/business/config/MybatisPlusConfig.java
  4. 24 11
      src/main/java/com/example/xiaoshiweixinback/business/utils/FormatUtil.java
  5. 12 5
      src/main/java/com/example/xiaoshiweixinback/controller/PatentController.java
  6. 12 0
      src/main/java/com/example/xiaoshiweixinback/controller/PayController.java
  7. 55 0
      src/main/java/com/example/xiaoshiweixinback/controller/UserFeedBackController.java
  8. 1 1
      src/main/java/com/example/xiaoshiweixinback/controller/VIPController.java
  9. 51 12
      src/main/java/com/example/xiaoshiweixinback/controller/VoucherManageController.java
  10. 37 0
      src/main/java/com/example/xiaoshiweixinback/domain/AssoFeedbackFile.java
  11. 45 0
      src/main/java/com/example/xiaoshiweixinback/domain/AssoPayOrderGood.java
  12. 34 0
      src/main/java/com/example/xiaoshiweixinback/domain/AssoPayOrderVoucher.java
  13. 1 0
      src/main/java/com/example/xiaoshiweixinback/domain/AssoPersonVip.java
  14. 74 0
      src/main/java/com/example/xiaoshiweixinback/domain/AssoPersonVoucher.java
  15. 1 0
      src/main/java/com/example/xiaoshiweixinback/domain/AssoVipFunction.java
  16. 37 0
      src/main/java/com/example/xiaoshiweixinback/domain/AssoVipVoucher.java
  17. 43 0
      src/main/java/com/example/xiaoshiweixinback/domain/UseFunctionRecord.java
  18. 49 0
      src/main/java/com/example/xiaoshiweixinback/domain/UserFeedback.java
  19. 2 0
      src/main/java/com/example/xiaoshiweixinback/domain/Vip.java
  20. 5 2
      src/main/java/com/example/xiaoshiweixinback/domain/Voucher.java
  21. 16 0
      src/main/java/com/example/xiaoshiweixinback/entity/assoPersonVoucher/PersonVoucherQueryDTO.java
  22. 18 0
      src/main/java/com/example/xiaoshiweixinback/entity/assoPersonVoucher/SendVoucherToPersonVO.java
  23. 3 0
      src/main/java/com/example/xiaoshiweixinback/entity/person/PersonQueryVO.java
  24. 3 0
      src/main/java/com/example/xiaoshiweixinback/entity/person/PersonVO.java
  25. 29 0
      src/main/java/com/example/xiaoshiweixinback/entity/userFeedBack/UserFeedbackAddNewDTO.java
  26. 12 0
      src/main/java/com/example/xiaoshiweixinback/entity/userFeedBack/UserFeedbackQueryDTO.java
  27. 22 0
      src/main/java/com/example/xiaoshiweixinback/entity/userFeedBack/UserFeedbackVO.java
  28. 3 1
      src/main/java/com/example/xiaoshiweixinback/entity/vouchar/VoucherAddDTO.java
  29. 6 0
      src/main/java/com/example/xiaoshiweixinback/entity/vouchar/VoucherQueryDTO.java
  30. 12 0
      src/main/java/com/example/xiaoshiweixinback/entity/vouchar/VoucherUpdateDTO.java
  31. 83 0
      src/main/java/com/example/xiaoshiweixinback/entity/vouchar/VoucherVO.java
  32. 13 0
      src/main/java/com/example/xiaoshiweixinback/entity/weixinPay/GoodVO.java
  33. 1 0
      src/main/java/com/example/xiaoshiweixinback/entity/weixinPay/VipRightsVO.java
  34. 16 1
      src/main/java/com/example/xiaoshiweixinback/entity/weixinPay/WeiXinPayDTO.java
  35. 31 0
      src/main/java/com/example/xiaoshiweixinback/factorys/goodFactory/GoodFactory.java
  36. 17 0
      src/main/java/com/example/xiaoshiweixinback/factorys/goodFactory/GoodImp.java
  37. 49 0
      src/main/java/com/example/xiaoshiweixinback/factorys/goodFactory/GoodTicketService.java
  38. 38 0
      src/main/java/com/example/xiaoshiweixinback/factorys/goodFactory/GoodVipService.java
  39. 74 0
      src/main/java/com/example/xiaoshiweixinback/factorys/goodFactory/GoodVoucherService.java
  40. 51 0
      src/main/java/com/example/xiaoshiweixinback/factorys/useFunctionFactory/CheckConcernProduct.java
  41. 54 0
      src/main/java/com/example/xiaoshiweixinback/factorys/useFunctionFactory/CheckExportPatent.java
  42. 40 0
      src/main/java/com/example/xiaoshiweixinback/factorys/useFunctionFactory/CheckQueryPatent.java
  43. 23 0
      src/main/java/com/example/xiaoshiweixinback/factorys/useFunctionFactory/UseFunctionFactory.java
  44. 11 0
      src/main/java/com/example/xiaoshiweixinback/factorys/useFunctionFactory/UseFunctionImp.java
  45. 18 0
      src/main/java/com/example/xiaoshiweixinback/mapper/AssoFeedbackFileMapper.java
  46. 19 0
      src/main/java/com/example/xiaoshiweixinback/mapper/AssoPayOrderGoodMapper.java
  47. 19 0
      src/main/java/com/example/xiaoshiweixinback/mapper/AssoPayOrderVoucherMapper.java
  48. 33 0
      src/main/java/com/example/xiaoshiweixinback/mapper/AssoPersonVoucherMapper.java
  49. 19 0
      src/main/java/com/example/xiaoshiweixinback/mapper/AssoVipVoucherMapper.java
  50. 13 0
      src/main/java/com/example/xiaoshiweixinback/mapper/EasyBaseMapper.java
  51. 21 0
      src/main/java/com/example/xiaoshiweixinback/mapper/UseFunctionRecordMapper.java
  52. 19 0
      src/main/java/com/example/xiaoshiweixinback/mapper/UserFeedbackMapper.java
  53. 10 0
      src/main/java/com/example/xiaoshiweixinback/mapper/VoucherMapper.java
  54. 20 0
      src/main/java/com/example/xiaoshiweixinback/service/AssoFeedbackFileService.java
  55. 13 18
      src/main/java/com/example/xiaoshiweixinback/service/AssoPersonProductService.java
  56. 31 11
      src/main/java/com/example/xiaoshiweixinback/service/AssoPersonVipService.java
  57. 197 0
      src/main/java/com/example/xiaoshiweixinback/service/AssoPersonVoucherService.java
  58. 57 0
      src/main/java/com/example/xiaoshiweixinback/service/AssoVipVoucherService.java
  59. 42 5
      src/main/java/com/example/xiaoshiweixinback/service/MonitorService.java
  60. 72 40
      src/main/java/com/example/xiaoshiweixinback/service/OrderService.java
  61. 26 4
      src/main/java/com/example/xiaoshiweixinback/service/PersonService.java
  62. 1 1
      src/main/java/com/example/xiaoshiweixinback/service/ProductService.java
  63. 1 0
      src/main/java/com/example/xiaoshiweixinback/service/SysFunctionService.java
  64. 2 1
      src/main/java/com/example/xiaoshiweixinback/service/TicketService.java
  65. 58 0
      src/main/java/com/example/xiaoshiweixinback/service/UseFunctionRecordService.java
  66. 146 0
      src/main/java/com/example/xiaoshiweixinback/service/UserFeedbackService.java
  67. 32 5
      src/main/java/com/example/xiaoshiweixinback/service/VipService.java
  68. 60 20
      src/main/java/com/example/xiaoshiweixinback/service/VoucherService.java
  69. 14 0
      src/main/java/com/example/xiaoshiweixinback/service/exportPatent/PatentExportService.java
  70. 19 7
      src/main/java/com/example/xiaoshiweixinback/service/importPatent/EsDenseVectorService.java
  71. 52 0
      src/main/java/com/example/xiaoshiweixinback/service/weixinpay/AssoPayOrderGoodService.java
  72. 54 0
      src/main/java/com/example/xiaoshiweixinback/service/weixinpay/AssoPayOrderVoucherService.java
  73. 3 1
      src/main/java/com/example/xiaoshiweixinback/service/weixinpay/WeixinPayService.java
  74. 87 0
      src/main/java/com/example/xiaoshiweixinback/useFunctionRecordAop/UseFunctionRecordAop.java
  75. 17 0
      src/main/java/com/example/xiaoshiweixinback/useFunctionRecordAop/useFunctionRecord.java
  76. 68 0
      src/main/resources/mapper/AssoPersonVoucherMapper.xml
  77. 0 16
      src/main/resources/mapper/AssoVipFunctionMapper.xml
  78. 6 4
      src/main/resources/mapper/PersonMapper.xml
  79. 24 0
      src/main/resources/mapper/UseFunctionRecordMapper.xml
  80. 66 0
      src/main/resources/mapper/VoucherMapper.xml

+ 6 - 0
pom.xml

@@ -122,12 +122,18 @@
             <artifactId>mybatis-typehandlers-jsr310</artifactId>
             <artifactId>mybatis-typehandlers-jsr310</artifactId>
             <version>1.0.2</version>
             <version>1.0.2</version>
         </dependency>
         </dependency>
+
         <dependency>
         <dependency>
             <groupId>com.baomidou</groupId>
             <groupId>com.baomidou</groupId>
             <artifactId>mybatis-plus-boot-starter</artifactId>
             <artifactId>mybatis-plus-boot-starter</artifactId>
             <version>${mybatisplus.version}</version>
             <version>${mybatisplus.version}</version>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-extension</artifactId>
+            <version>${mybatisplus.version}</version>
+        </dependency>
+        <dependency>
             <groupId>org.springframework.boot</groupId>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-data-redis</artifactId>
             <artifactId>spring-boot-starter-data-redis</artifactId>
         </dependency>
         </dependency>

+ 17 - 0
src/main/java/com/example/xiaoshiweixinback/business/config/InsertBatchSqlInjector.java

@@ -0,0 +1,17 @@
+package com.example.xiaoshiweixinback.business.config;
+
+import com.baomidou.mybatisplus.core.injector.AbstractMethod;
+import com.baomidou.mybatisplus.core.injector.DefaultSqlInjector;
+import com.baomidou.mybatisplus.core.metadata.TableInfo;
+import com.baomidou.mybatisplus.extension.injector.methods.InsertBatchSomeColumn;
+
+import java.util.List;
+
+public class InsertBatchSqlInjector extends DefaultSqlInjector {
+    @Override
+    public List<AbstractMethod> getMethodList(Class<?> mapperClass, TableInfo tableInfo) {
+        List<AbstractMethod> methodList = super.getMethodList(mapperClass,tableInfo);
+        methodList.add(new InsertBatchSomeColumn()); //添加InsertBatchSomeColumn方法
+        return methodList;
+    }
+}

+ 16 - 0
src/main/java/com/example/xiaoshiweixinback/business/config/MybatisPlusConfig.java

@@ -2,9 +2,12 @@ package com.example.xiaoshiweixinback.business.config;
 
 
 
 
 import com.baomidou.mybatisplus.annotation.DbType;
 import com.baomidou.mybatisplus.annotation.DbType;
+import com.baomidou.mybatisplus.core.config.GlobalConfig;
+import com.baomidou.mybatisplus.core.injector.ISqlInjector;
 import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
 import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
 import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
 import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
 import org.mybatis.spring.annotation.MapperScan;
 import org.mybatis.spring.annotation.MapperScan;
+import org.springframework.beans.factory.annotation.Qualifier;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Configuration;
 
 
@@ -17,4 +20,17 @@ public class MybatisPlusConfig {
         interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
         interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL));
         return interceptor;
         return interceptor;
     }
     }
+    @Bean
+    public InsertBatchSqlInjector easySqlInjector() {
+        return new InsertBatchSqlInjector();
+    }
+    @Bean
+    public GlobalConfig globalConfig(@Qualifier("easySqlInjector") ISqlInjector easySqlInjector){
+        GlobalConfig globalConfig = new GlobalConfig();
+        globalConfig.setSqlInjector(easySqlInjector);
+        return globalConfig;
+    }
+
 }
 }
+
+

+ 24 - 11
src/main/java/com/example/xiaoshiweixinback/business/utils/FormatUtil.java

@@ -74,12 +74,11 @@ public class FormatUtil {
     }
     }
 
 
     public static List<String> getDistinctList(List<String> a, List<String> b) {
     public static List<String> getDistinctList(List<String> a, List<String> b) {
-        if (a == null || a.size() == 0 &&(b==null||b.size()==0)) {
+        if (a == null || a.size() == 0 && (b == null || b.size() == 0)) {
             return null;
             return null;
         } else if (b == null || b.size() == 0) {
         } else if (b == null || b.size() == 0) {
-            return  new ArrayList<>(a);
-        }
-        else if(a==null||a.size()==0){
+            return new ArrayList<>(a);
+        } else if (a == null || a.size() == 0) {
             return new ArrayList<>(b);
             return new ArrayList<>(b);
         }
         }
         a.addAll(b);
         a.addAll(b);
@@ -89,25 +88,39 @@ public class FormatUtil {
 
 
 
 
     public static List<Integer> StringTOIntegerList(List<String> strs) {
     public static List<Integer> StringTOIntegerList(List<String> strs) {
-        List<Integer> integers =new ArrayList<>();
-        strs.forEach(item->{
+        List<Integer> integers = new ArrayList<>();
+        strs.forEach(item -> {
             integers.add(Integer.parseInt(item));
             integers.add(Integer.parseInt(item));
         });
         });
-        return  integers;
+        return integers;
     }
     }
 
 
     public static List<String> IntegerTOStringList(List<Integer> integers) {
     public static List<String> IntegerTOStringList(List<Integer> integers) {
-        List<String> strs =new ArrayList<>();
-        integers.forEach(item->{
+        List<String> strs = new ArrayList<>();
+        integers.forEach(item -> {
             strs.add(item.toString());
             strs.add(item.toString());
         });
         });
-        return  strs;
+        return strs;
     }
     }
 
 
 
 
-    public static String getTimeStringYYMMdd(Date startDate){
+    public static String getTimeStringYYMMdd(Date startDate) {
         SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
         SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
         String dateString = formatter.format(startDate);
         String dateString = formatter.format(startDate);
         return dateString;
         return dateString;
     }
     }
+
+    public static List<Integer> StringToIntegerList(String content, String regex) {
+        List<Integer> reList = new ArrayList<>();
+        if (content == null) {
+            return reList;
+        }
+        String[] contentStrs = content.split(regex);
+        for (int i = 0; i < contentStrs.length; i++) {
+            Integer t = Integer.parseInt(contentStrs[i]);
+            reList.add(t);
+        }
+        return reList;
+    }
+
 }
 }

+ 12 - 5
src/main/java/com/example/xiaoshiweixinback/controller/PatentController.java

@@ -21,6 +21,7 @@ import com.example.xiaoshiweixinback.service.importPatent.EsDenseVectorService;
 import com.example.xiaoshiweixinback.service.importPatent.EsPatentService;
 import com.example.xiaoshiweixinback.service.importPatent.EsPatentService;
 import com.example.xiaoshiweixinback.service.importPatent.GetPatentFromExcelService;
 import com.example.xiaoshiweixinback.service.importPatent.GetPatentFromExcelService;
 import com.example.xiaoshiweixinback.service.importPatent.ImportFromWebToEsService;
 import com.example.xiaoshiweixinback.service.importPatent.ImportFromWebToEsService;
+import com.example.xiaoshiweixinback.useFunctionRecordAop.useFunctionRecord;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Operation;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -88,18 +89,24 @@ public class PatentController {
     //--------------------------- 关于图片的专利检索  --------------------------
     //--------------------------- 关于图片的专利检索  --------------------------
     @Operation(summary = "根据关键词获取列表(图片用于排序)--zero")
     @Operation(summary = "根据关键词获取列表(图片用于排序)--zero")
     @PostMapping(value = "/getPatentVectors")
     @PostMapping(value = "/getPatentVectors")
-    @checkLogin
+    @useFunctionRecord
     public Response getPatentVectors(@RequestParam(value = "vectorDTO", required = false) String vectorDTO, @RequestParam(value = "multipartFile", required = false) MultipartFile multipartFile) throws Exception {
     public Response getPatentVectors(@RequestParam(value = "vectorDTO", required = false) String vectorDTO, @RequestParam(value = "multipartFile", required = false) MultipartFile multipartFile) throws Exception {
+        Records records = null;
+        try {
         File file = FileUtils.multipartFileToFile(multipartFile);
         File file = FileUtils.multipartFileToFile(multipartFile);
         EsPatentVectorDTO esPatentVectorDTO = new EsPatentVectorDTO();
         EsPatentVectorDTO esPatentVectorDTO = new EsPatentVectorDTO();
         if (StringUtils.isNotEmpty(vectorDTO)) {
         if (StringUtils.isNotEmpty(vectorDTO)) {
             esPatentVectorDTO = JSONObject.parseObject(vectorDTO, EsPatentVectorDTO.class);
             esPatentVectorDTO = JSONObject.parseObject(vectorDTO, EsPatentVectorDTO.class);
         }
         }
-        Records records = null;
-        try {
+
+
             records = esDenseVectorService.getPatentVectors(esPatentVectorDTO, file);
             records = esDenseVectorService.getPatentVectors(esPatentVectorDTO, file);
-        } catch (BusinessException e) {
-            return Response.error(e.getErrorCode(), e.getMessage());
+        } catch (Exception e) {
+            if(e instanceof  BusinessException)
+
+            {   BusinessException b =(BusinessException) e;
+                return Response.error(b.getErrorCode(), e.getMessage());}
+        return Response.error(e.getMessage());
         }
         }
         return Response.success(records);
         return Response.success(records);
     }
     }

+ 12 - 0
src/main/java/com/example/xiaoshiweixinback/controller/PayController.java

@@ -80,4 +80,16 @@ public class PayController {
 
 
         return "success";
         return "success";
     }
     }
+
+
+    @Operation(summary = "回调成功")
+    @GetMapping("/testSuccess")
+    public String testSuccess(String tradeNo) throws IOException {
+        try {
+            orderService.payBack(tradeNo);
+        } catch (Exception e) {
+            return "";
+        }
+        return "success";
+    }
 }
 }

+ 55 - 0
src/main/java/com/example/xiaoshiweixinback/controller/UserFeedBackController.java

@@ -0,0 +1,55 @@
+package com.example.xiaoshiweixinback.controller;
+
+
+import com.example.xiaoshiweixinback.business.common.Constants;
+import com.example.xiaoshiweixinback.business.common.Response;
+import com.example.xiaoshiweixinback.business.common.base.Records;
+import com.example.xiaoshiweixinback.entity.userFeedBack.UserFeedbackAddNewDTO;
+import com.example.xiaoshiweixinback.entity.userFeedBack.UserFeedbackQueryDTO;
+import com.example.xiaoshiweixinback.service.UserFeedbackService;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 用户反馈的Controller层
+ *
+ * @Author chenyu
+ * @Date 2023/4/5
+ */
+@Tag(name = "用户反馈管理模块")
+@RequiredArgsConstructor
+@Slf4j
+@RequestMapping(Constants.XIAOSHI_WEIXINBACK  + "/userFeedBack")
+@RestController
+public class UserFeedBackController {
+    private final UserFeedbackService userFeedBackService;
+
+    @Operation(summary = "新增用户反馈")
+    @PostMapping("/addUserFeedback")
+    public Response addUserFeedback(@RequestBody UserFeedbackAddNewDTO userFeedbackAddNewDTO) {
+        try {
+            userFeedBackService.addUserFeedback(userFeedbackAddNewDTO);
+        } catch (Exception e) {
+            return Response.error(e.getMessage());
+        }
+        return Response.success("新增用户反馈完成");
+    }
+
+   @Operation(summary = "查询用户反馈")
+    @PostMapping("/queryUserFeedback")
+    public Response queryUserFeedback(@RequestBody UserFeedbackQueryDTO userFeedbackQueryDTO) {
+       Records records =new Records();
+        try {
+             records = userFeedBackService.queryUserFeedback(userFeedbackQueryDTO);
+        } catch (Exception e) {
+            return Response.error(e.getMessage());
+        }
+        return Response.success(records);
+    }
+}

+ 1 - 1
src/main/java/com/example/xiaoshiweixinback/controller/VIPController.java

@@ -34,7 +34,7 @@ public class VIPController {
     @Operation(summary = "激活会员")
     @Operation(summary = "激活会员")
     @PostMapping("/activeVip")
     @PostMapping("/activeVip")
     public Response activeVip(@RequestBody ActiveVipDTO activeVipDTO) {
     public Response activeVip(@RequestBody ActiveVipDTO activeVipDTO) {
-        vipService.activateVIP(null);
+        vipService.activateVIP(null,null);
         return Response.success("激活成功");
         return Response.success("激活成功");
     }
     }
 
 

+ 51 - 12
src/main/java/com/example/xiaoshiweixinback/controller/VoucherManageController.java

@@ -3,19 +3,16 @@ package com.example.xiaoshiweixinback.controller;
 import com.example.xiaoshiweixinback.business.common.Constants;
 import com.example.xiaoshiweixinback.business.common.Constants;
 import com.example.xiaoshiweixinback.business.common.Response;
 import com.example.xiaoshiweixinback.business.common.Response;
 import com.example.xiaoshiweixinback.business.common.base.Records;
 import com.example.xiaoshiweixinback.business.common.base.Records;
-import com.example.xiaoshiweixinback.entity.vouchar.VoucherAddDTO;
-import com.example.xiaoshiweixinback.entity.vouchar.VoucherBatchUpdateDTO;
-import com.example.xiaoshiweixinback.entity.vouchar.VoucherQueryDTO;
-import com.example.xiaoshiweixinback.entity.vouchar.VoucherUpdateDTO;
+import com.example.xiaoshiweixinback.entity.assoPersonVoucher.PersonVoucherQueryDTO;
+import com.example.xiaoshiweixinback.entity.assoPersonVoucher.SendVoucherToPersonVO;
+import com.example.xiaoshiweixinback.entity.vouchar.*;
+import com.example.xiaoshiweixinback.service.AssoPersonVoucherService;
 import com.example.xiaoshiweixinback.service.VoucherService;
 import com.example.xiaoshiweixinback.service.VoucherService;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.models.security.SecurityScheme;
 import io.swagger.v3.oas.models.security.SecurityScheme;
 import lombok.RequiredArgsConstructor;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -28,7 +25,7 @@ import java.util.List;
 @RequiredArgsConstructor
 @RequiredArgsConstructor
 public class VoucherManageController {
 public class VoucherManageController {
     private final VoucherService voucherService;
     private final VoucherService voucherService;
-
+    private final AssoPersonVoucherService assoPersonVoucherService;
     @Operation(summary = "添加优惠券")
     @Operation(summary = "添加优惠券")
     @PostMapping("/addVoucher")
     @PostMapping("/addVoucher")
     public Response addVoucher  (@RequestBody VoucherAddDTO voucherAddDTO) {
     public Response addVoucher  (@RequestBody VoucherAddDTO voucherAddDTO) {
@@ -44,9 +41,17 @@ public class VoucherManageController {
     }
     }
 
 
     @Operation(summary = "查询优惠券")
     @Operation(summary = "查询优惠券")
-    @PostMapping("/queryVector")
-    public Response queryVector (@RequestBody VoucherQueryDTO voucherQueryDTO) {
-      Records records = voucherService.queryVector(voucherQueryDTO);
+    @PostMapping("/queryVoucher")
+    public Response queryVoucher (@RequestBody VoucherQueryDTO voucherQueryDTO) {
+        Records records =new Records();
+        try {
+             records = voucherService.queryVector(voucherQueryDTO);
+
+        }
+        catch (Exception e){
+            e.printStackTrace();
+            return Response.error("请求失败");
+        }
         return Response.success(records);
         return Response.success(records);
     }
     }
 
 
@@ -57,4 +62,38 @@ public class VoucherManageController {
       List<Integer> ids=  voucherService.updateBatchVoucher(voucherBatchUpdateDTO);
       List<Integer> ids=  voucherService.updateBatchVoucher(voucherBatchUpdateDTO);
         return Response.success(true);
         return Response.success(true);
     }
     }
+    @Operation(summary = "查看优惠券详情")
+    @GetMapping("/queryVectorDetail")
+    public Response queryVectorDetail (Integer id) {
+        VoucherVO voucherVO =  voucherService.queryVectorDetail(id);
+        return Response.success(voucherVO);
+    }
+
+    @Operation(summary = "向多个用户发放优惠券")
+    @PostMapping("/sendVoucherToPerson")
+    public Response sendVoucherToPerson (@RequestBody SendVoucherToPersonVO sendVoucherToPersonVO) {
+        try {
+            assoPersonVoucherService.sendVoucherToPerson(sendVoucherToPersonVO);
+        }
+        catch (Exception e)
+        {
+            return Response.error(e.getMessage());
+        }
+        return Response.success(true);
+    }
+
+
+    @Operation(summary = "查看个人拥有的优惠券")
+    @PostMapping("/queryPersonVoucher")
+    public Response queryPersonVoucher (@RequestBody PersonVoucherQueryDTO personVoucherQueryDTO) {
+        Records records =new Records();
+        try {
+            records=  assoPersonVoucherService.queryPersonVoucher(personVoucherQueryDTO);
+        }
+        catch (Exception e)
+        {e.printStackTrace();
+            return Response.error(e.getMessage());
+        }
+        return Response.success(records);
+    }
 }
 }

+ 37 - 0
src/main/java/com/example/xiaoshiweixinback/domain/AssoFeedbackFile.java

@@ -0,0 +1,37 @@
+package com.example.xiaoshiweixinback.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+
+import com.example.xiaoshiweixinback.domain.AssoCategoryFile;
+import com.example.xiaoshiweixinback.domain.BaseEntity;
+import lombok.Data;
+
+/**
+ * 用户反馈截图
+ * @TableName asso_feedback_file
+ */
+@TableName(value ="asso_feedback_file")
+@Data
+public class AssoFeedbackFile  extends BaseEntity<AssoCategoryFile> {
+    /**
+     * ID
+     */
+    private Integer id;
+
+    /**
+     * 
+     */
+    private Integer personFeedbackId;
+
+    /**
+     * 
+     */
+    private String fileGuid;
+
+    @TableField(exist = false)
+    private static final long serialVersionUID = 1L;
+}

+ 45 - 0
src/main/java/com/example/xiaoshiweixinback/domain/AssoPayOrderGood.java

@@ -0,0 +1,45 @@
+package com.example.xiaoshiweixinback.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+
+import com.example.xiaoshiweixinback.domain.AssoCategoryFile;
+import com.example.xiaoshiweixinback.domain.BaseEntity;
+import lombok.Data;
+
+/**
+ * 支付订单和产品关联表
+ * @TableName asso_pay_order_good
+ */
+@TableName(value ="asso_pay_order_good")
+@Data
+public class AssoPayOrderGood  extends BaseEntity<AssoPayOrderGood> {
+    /**
+     * ID
+     */
+    private Integer id;
+
+    /**
+     * 1会员 2工单
+     */
+    private Integer goodType;
+
+    /**
+     * 
+     */
+    private String goodUuid;
+
+    /**
+     * 
+     */
+    private Integer goodCount;
+
+    /**
+     * 
+     */
+    private Double goodPrice;
+    private Integer  payOrderId;
+}

+ 34 - 0
src/main/java/com/example/xiaoshiweixinback/domain/AssoPayOrderVoucher.java

@@ -0,0 +1,34 @@
+package com.example.xiaoshiweixinback.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+
+import com.example.xiaoshiweixinback.domain.BaseEntity;
+import lombok.Data;
+
+/**
+ * 订单和优惠券关联表
+ * @TableName asso_pay_order_voucher
+ */
+@TableName(value ="asso_pay_order_voucher")
+@Data
+public class AssoPayOrderVoucher extends BaseEntity<AssoPayOrderVoucher> {
+    /**
+     * id
+     */
+    private Integer id;
+
+    /**
+     * 
+     */
+    private Integer payOrderId;
+
+    /**
+     * 人员优惠券关联id
+     */
+    private Integer assoPersonVoucherId;
+
+}

+ 1 - 0
src/main/java/com/example/xiaoshiweixinback/domain/AssoPersonVip.java

@@ -35,4 +35,5 @@ public class AssoPersonVip extends BaseEntity<AssoPersonVip> {
 
 
     private Date createTime;
     private Date createTime;
     private Date expiryTime;
     private Date expiryTime;
+    private Integer vipType;
 }
 }

+ 74 - 0
src/main/java/com/example/xiaoshiweixinback/domain/AssoPersonVoucher.java

@@ -0,0 +1,74 @@
+package com.example.xiaoshiweixinback.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Data;
+
+/**
+ * 人员优惠券关联表
+ * @TableName asso_person_voucher
+ */
+@TableName(value ="asso_person_voucher")
+@Data
+public class AssoPersonVoucher   extends BaseEntity<AssoPersonVoucher>{
+    /**
+     * ID
+     */
+    private Integer id;
+
+    /**
+     * 人员guid
+     */
+    private String personUuid;
+
+    /**
+     * 优惠券名称
+     */
+    private String voucherName;
+
+    /**
+     * 0金额券 1折扣 
+     */
+    private Integer voucherType;
+
+    /**
+     * 可使用时间
+     */
+    private Date availableTime;
+
+    /**
+     * 金额,或折扣
+     */
+    private Double amount;
+
+
+    /**
+     * 使用期限
+     */
+    private Date expirationTime;
+
+    /**
+     * 使用范围0开通会员,1购买券,2支付工单
+     */
+    private String useScope;
+
+    /**
+     * 0未使用1已使用2冻结中
+     */
+    private Integer useState;
+
+    /**
+     * 使用门槛
+     */
+    private Double threshold;
+
+    /**
+     *
+     */
+    private Date createTime;
+
+}

+ 1 - 0
src/main/java/com/example/xiaoshiweixinback/domain/AssoVipFunction.java

@@ -33,4 +33,5 @@ public class AssoVipFunction extends BaseEntity<AssoVipFunction> {
     private String functionUuid;
     private String functionUuid;
     private String functionParameter;
     private String functionParameter;
     private String description;
     private String description;
+    private Integer vipType;
 }
 }

+ 37 - 0
src/main/java/com/example/xiaoshiweixinback/domain/AssoVipVoucher.java

@@ -0,0 +1,37 @@
+package com.example.xiaoshiweixinback.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+
+import com.example.xiaoshiweixinback.domain.BaseEntity;
+import com.example.xiaoshiweixinback.domain.ImportTask;
+import lombok.Data;
+
+/**
+ * vip和优惠券关联表
+ * @TableName asso_vip_voucher
+ */
+@TableName(value ="asso_vip_voucher")
+@Data
+public class AssoVipVoucher extends BaseEntity<AssoVipVoucher> {
+    /**
+     * ID
+     */
+    @TableId(type = IdType.AUTO)
+    private Integer id;
+
+    /**
+     * 
+     */
+    private String vipUuid;
+
+    /**
+     * 
+     */
+    private Integer voucherId;
+
+    private Integer voucherCount;
+}

+ 43 - 0
src/main/java/com/example/xiaoshiweixinback/domain/UseFunctionRecord.java

@@ -0,0 +1,43 @@
+package com.example.xiaoshiweixinback.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+import lombok.Data;
+
+/**
+ * 使用功能记录
+ * @TableName use_function_record
+ */
+@TableName(value ="use_function_record")
+@Data
+public class UseFunctionRecord  extends BaseEntity<UseFunctionRecord>  {
+    /**
+     * ID
+     */
+    private Integer id;
+
+    /**
+     * 人员id
+     */
+    private String personUuid;
+
+    /**
+     * 功能id
+     */
+    private String functionUuid;
+
+    /**
+     * 
+     */
+    private String functionParameter;
+
+    /**
+     * 
+     */
+    private Date createTime;
+
+}

+ 49 - 0
src/main/java/com/example/xiaoshiweixinback/domain/UserFeedback.java

@@ -0,0 +1,49 @@
+package com.example.xiaoshiweixinback.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import java.io.Serializable;
+import java.util.Date;
+
+import com.example.xiaoshiweixinback.domain.BaseEntity;
+import com.example.xiaoshiweixinback.domain.TicketRightsProtection;
+import lombok.Data;
+
+/**
+ * 
+ * @TableName user_feedback
+ */
+@TableName(value ="user_feedback")
+@Data
+public class UserFeedback extends BaseEntity<UserFeedback> {
+    /**
+     * 主键id
+     */
+    private Integer id;
+
+
+    /**
+     * 邮箱
+     */
+    private String email;
+
+    /**
+     * 反馈内容
+     */
+    private String feedbackContent;
+
+    /**
+     * 反馈人id
+     */
+    private String createId;
+
+
+
+    /**
+     * 创建时间
+     */
+    private Date createTime;
+
+}

+ 2 - 0
src/main/java/com/example/xiaoshiweixinback/domain/Vip.java

@@ -32,8 +32,10 @@ public class Vip extends BaseEntity<Vip> {
      *
      *
      */
      */
     private String name;
     private String name;
+    private String vipName;
     private String vipUuid;
     private String vipUuid;
     private Integer lastTime;
     private Integer lastTime;
     private Double price;
     private Double price;
     private String configParameter;
     private String configParameter;
+    private Double finalPrice;
 }
 }

+ 5 - 2
src/main/java/com/example/xiaoshiweixinback/domain/Voucher.java

@@ -27,6 +27,9 @@ public class Voucher extends BaseEntity<Voucher> {
      */
      */
     private String name;
     private String name;
 
 
+    private Integer type;
+    private Double amount;
+
     /**
     /**
      * 可领取时间
      * 可领取时间
      */
      */
@@ -35,11 +38,11 @@ public class Voucher extends BaseEntity<Voucher> {
     /**
     /**
      * 使用期限
      * 使用期限
      */
      */
-    private Integer expirationTime;
+    private Date expirationTime;
 
 
     /**
     /**
      * 使用范围
      * 使用范围
-0开通会员,1购买券,2支付工单,以,隔开
+     -1开通会员,0购买券 1.填写工单  2.知识产权维权  3.知识产权应诉  4.我要申请专利以,隔开
      */
      */
     private String useScope;
     private String useScope;
 
 

+ 16 - 0
src/main/java/com/example/xiaoshiweixinback/entity/assoPersonVoucher/PersonVoucherQueryDTO.java

@@ -0,0 +1,16 @@
+package com.example.xiaoshiweixinback.entity.assoPersonVoucher;
+
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class PersonVoucherQueryDTO {
+    private Long current;
+    private Long size;
+    private Integer state;
+    private List<Integer> useScopes;
+    private String personUuid;
+    private Boolean ifExpiration;
+}

+ 18 - 0
src/main/java/com/example/xiaoshiweixinback/entity/assoPersonVoucher/SendVoucherToPersonVO.java

@@ -0,0 +1,18 @@
+package com.example.xiaoshiweixinback.entity.assoPersonVoucher;
+
+import io.swagger.v3.oas.models.security.SecurityScheme;
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class SendVoucherToPersonVO {
+    private List<String> personUuids;
+    private List<InAddVoucherVO> inAddVoucherVOS;
+
+    @Data
+    public static class InAddVoucherVO {
+        private Integer voucherId;
+        private Integer number;
+    }
+}

+ 3 - 0
src/main/java/com/example/xiaoshiweixinback/entity/person/PersonQueryVO.java

@@ -3,6 +3,8 @@ package com.example.xiaoshiweixinback.entity.person;
 import com.example.xiaoshiweixinback.entity.vip.VipMessageVO;
 import com.example.xiaoshiweixinback.entity.vip.VipMessageVO;
 import lombok.Data;
 import lombok.Data;
 
 
+import java.util.Date;
+
 @Data
 @Data
 public class PersonQueryVO {
 public class PersonQueryVO {
 
 
@@ -15,4 +17,5 @@ public class PersonQueryVO {
     private  Integer vipType;
     private  Integer vipType;
    private String vipName;
    private String vipName;
    private  String vipUuid;
    private  String vipUuid;
+   private Date createTime;
 }
 }

+ 3 - 0
src/main/java/com/example/xiaoshiweixinback/entity/person/PersonVO.java

@@ -3,6 +3,8 @@ package com.example.xiaoshiweixinback.entity.person;
 import com.example.xiaoshiweixinback.entity.vip.VipMessageVO;
 import com.example.xiaoshiweixinback.entity.vip.VipMessageVO;
 import lombok.Data;
 import lombok.Data;
 
 
+import java.util.Date;
+
 @Data
 @Data
 public class PersonVO {
 public class PersonVO {
 
 
@@ -14,4 +16,5 @@ public class PersonVO {
     private String uuid;
     private String uuid;
     private  Integer vipType;
     private  Integer vipType;
     private VipMessageVO vipMessageVO;
     private VipMessageVO vipMessageVO;
+    private Date createTime;
 }
 }

+ 29 - 0
src/main/java/com/example/xiaoshiweixinback/entity/userFeedBack/UserFeedbackAddNewDTO.java

@@ -0,0 +1,29 @@
+package com.example.xiaoshiweixinback.entity.userFeedBack;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * 新增用户反馈的DTO类
+ *
+ * @Author chenyu
+ * @Date 2023/4/4
+ */
+@Accessors(chain = true)
+@Data
+public class UserFeedbackAddNewDTO {
+
+    /**
+     * 邮箱
+     */
+    private String email;
+    /**
+     * 反馈内容
+     */
+    private String feedbackContent;
+    private List<String> fileGuids;
+
+}

+ 12 - 0
src/main/java/com/example/xiaoshiweixinback/entity/userFeedBack/UserFeedbackQueryDTO.java

@@ -0,0 +1,12 @@
+package com.example.xiaoshiweixinback.entity.userFeedBack;
+
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class UserFeedbackQueryDTO {
+    private Long current;
+    private Long size;
+}

+ 22 - 0
src/main/java/com/example/xiaoshiweixinback/entity/userFeedBack/UserFeedbackVO.java

@@ -0,0 +1,22 @@
+package com.example.xiaoshiweixinback.entity.userFeedBack;
+
+import com.example.xiaoshiweixinback.business.common.base.SystemFile;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class UserFeedbackVO {
+    private Integer id;
+    private String email;
+    /**
+     * 反馈内容
+     */
+    private String feedbackContent;
+    private String createId;
+    private String phoneNum;
+    private Date createTime;
+    private List<SystemFile> systemFiles;
+
+}

+ 3 - 1
src/main/java/com/example/xiaoshiweixinback/entity/vouchar/VoucherAddDTO.java

@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.Data;
 
 
 import java.util.Date;
 import java.util.Date;
+import java.util.List;
 
 
 @Data
 @Data
 public class VoucherAddDTO {
 public class VoucherAddDTO {
@@ -20,10 +21,11 @@ public class VoucherAddDTO {
             timezone = "GMT+8"
             timezone = "GMT+8"
     )
     )
     private Date expirationTime;
     private Date expirationTime;
-    private String useScope;
+    private List<Integer> useScopes;
     private Integer state;
     private Integer state;
     private String remark;
     private String remark;
     private Double threshold;
     private Double threshold;
     private Double sellingPrice;
     private Double sellingPrice;
     private Integer getWay;
     private Integer getWay;
+
 }
 }

+ 6 - 0
src/main/java/com/example/xiaoshiweixinback/entity/vouchar/VoucherQueryDTO.java

@@ -3,11 +3,17 @@ package com.example.xiaoshiweixinback.entity.vouchar;
 import lombok.Data;
 import lombok.Data;
 
 
 import java.util.Date;
 import java.util.Date;
+import java.util.List;
 
 
 @Data
 @Data
 public class VoucherQueryDTO {
 public class VoucherQueryDTO {
     private Long current;
     private Long current;
     private Long size;
     private Long size;
     private Integer state;
     private Integer state;
+    private List<Integer> useScopes;
+    private String useScope;
+    private Boolean ifAvailable;
+    private Boolean ifExpiration;
+    private Integer getWay;
 
 
 }
 }

+ 12 - 0
src/main/java/com/example/xiaoshiweixinback/entity/vouchar/VoucherUpdateDTO.java

@@ -4,16 +4,28 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 import lombok.Data;
 import lombok.Data;
 
 
 import java.util.Date;
 import java.util.Date;
+import java.util.List;
 
 
 @Data
 @Data
 public class VoucherUpdateDTO {
 public class VoucherUpdateDTO {
+    private String name;
+    private Integer type;
+    private Double amount;
     @JsonFormat(
     @JsonFormat(
             pattern = "yyyy-MM-dd",
             pattern = "yyyy-MM-dd",
             timezone = "GMT+8"
             timezone = "GMT+8"
     )
     )
     private Date availableTime;
     private Date availableTime;
+    @JsonFormat(
+            pattern = "yyyy-MM-dd",
+            timezone = "GMT+8"
+    )
+    private Date expirationTime;
+    private List<Integer> useScopes;
     private Integer state;
     private Integer state;
     private String remark;
     private String remark;
+    private Double threshold;
     private Double sellingPrice;
     private Double sellingPrice;
+    private Integer getWay;
     private Integer id;
     private Integer id;
 }
 }

+ 83 - 0
src/main/java/com/example/xiaoshiweixinback/entity/vouchar/VoucherVO.java

@@ -0,0 +1,83 @@
+package com.example.xiaoshiweixinback.entity.vouchar;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+
+import java.util.Date;
+import java.util.List;
+
+@Data
+public class VoucherVO {
+    /**
+     * ID
+     */
+    private Integer id;
+    /**
+     * 名称
+     */
+    private String name;
+
+    /**
+     * 可领取时间
+     */
+    @JsonFormat(
+            pattern = "yyyy-MM-dd",
+            timezone = "GMT+8"
+    )
+    private Date availableTime;
+
+    /**
+     * 使用期限
+     */
+    @JsonFormat(
+            pattern = "yyyy-MM-dd",
+            timezone = "GMT+8"
+    )
+    private Date expirationTime;
+
+    /**
+     *
+    -1开通会员,0购买券 1.填写工单  2.知识产权维权  3.知识产权应诉  4.我要申请专利
+     */
+    private List<Integer> useScopes;
+
+    /**
+     * 状态
+
+     */
+    private Integer state;
+
+    private Integer type;
+
+    /**
+     * c备注
+     */
+    private String remark;
+
+    /**
+     * 使用门槛
+     */
+    private Double threshold;
+
+    /**
+     * 售卖价格
+     */
+    private Double sellingPrice;
+
+    /**
+     * 获取方式
+     0赠送 1购买
+     */
+    private Integer getWay;
+
+    /**
+     *
+     */
+    private String createId;
+
+    /**
+     *
+     */
+    private Date createTime;
+    private Double amount;
+}

+ 13 - 0
src/main/java/com/example/xiaoshiweixinback/entity/weixinPay/GoodVO.java

@@ -0,0 +1,13 @@
+package com.example.xiaoshiweixinback.entity.weixinPay;
+
+import lombok.Data;
+
+@Data
+public class GoodVO {
+
+    private String goodType;
+    private String id;
+    private String name;
+    private Double price;
+    private Integer Num;
+}

+ 1 - 0
src/main/java/com/example/xiaoshiweixinback/entity/weixinPay/VipRightsVO.java

@@ -9,4 +9,5 @@ public class VipRightsVO {
    private String description;
    private String description;
    private String functionParameter;
    private String functionParameter;
    private String vipUuid;
    private String vipUuid;
+   private Integer vipType;
 }
 }

+ 16 - 1
src/main/java/com/example/xiaoshiweixinback/entity/weixinPay/WeiXinPayDTO.java

@@ -2,8 +2,23 @@ package com.example.xiaoshiweixinback.entity.weixinPay;
 
 
 import lombok.Data;
 import lombok.Data;
 
 
+import java.util.List;
+
 @Data
 @Data
 public class WeiXinPayDTO {
 public class WeiXinPayDTO {
     private Integer goodType;
     private Integer goodType;
-    private String goodUuid;
+    private List<GoodVO> goods;
+    private  Double servicePrice;
+    //总价格
+    private Double price;
+    //折扣
+    private  Double discount;
+    /**
+     * 使用的已购买的优惠券id(人员和优惠券关联id)
+     */
+    private  List<Integer> personVoucherIds;
+    //最终价格
+    private Double finalPrice;
+
+
 }
 }

+ 31 - 0
src/main/java/com/example/xiaoshiweixinback/factorys/goodFactory/GoodFactory.java

@@ -0,0 +1,31 @@
+package com.example.xiaoshiweixinback.factorys.goodFactory;
+
+import com.example.xiaoshiweixinback.entity.weixinPay.GoodVO;
+import com.example.xiaoshiweixinback.factorys.patentExportFactory.GetValueImp;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Component;
+
+@Component
+@RequiredArgsConstructor
+public class GoodFactory {
+    private final GoodTicketService goodTicketService;
+    private final GoodVipService goodVipService;
+    private final GoodVoucherService goodVoucherService;
+    public GoodImp getClass(Integer goodType) {
+        switch (goodType)
+        {
+            case -1:
+                return goodVipService;
+            case 0:
+                return goodVoucherService;
+            case 1:
+            case 2:
+            case 3:
+            case 4:
+                return goodTicketService;
+
+        }
+
+        return null;
+    }
+}

+ 17 - 0
src/main/java/com/example/xiaoshiweixinback/factorys/goodFactory/GoodImp.java

@@ -0,0 +1,17 @@
+package com.example.xiaoshiweixinback.factorys.goodFactory;
+
+import com.example.xiaoshiweixinback.domain.AssoPayOrderGood;
+import com.example.xiaoshiweixinback.domain.Order;
+import com.example.xiaoshiweixinback.entity.weixinPay.GoodVO;
+
+import java.util.List;
+
+/**
+ * @Author lrj
+ * @Date 2024/6/30
+ */
+public interface GoodImp {
+ public void activeGood(Order order, List<AssoPayOrderGood> assoPayOrderGoods);
+
+ public Double computePrice(List<GoodVO> goodVOs);
+}

+ 49 - 0
src/main/java/com/example/xiaoshiweixinback/factorys/goodFactory/GoodTicketService.java

@@ -0,0 +1,49 @@
+package com.example.xiaoshiweixinback.factorys.goodFactory;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.example.xiaoshiweixinback.business.exception.BusinessException;
+import com.example.xiaoshiweixinback.business.utils.FormatUtil;
+import com.example.xiaoshiweixinback.domain.AssoPayOrderGood;
+import com.example.xiaoshiweixinback.domain.Order;
+import com.example.xiaoshiweixinback.domain.Ticket;
+import com.example.xiaoshiweixinback.domain.Voucher;
+import com.example.xiaoshiweixinback.entity.weixinPay.GoodVO;
+import com.example.xiaoshiweixinback.service.TicketService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Component
+@RequiredArgsConstructor
+public class GoodTicketService implements GoodImp {
+    private final TicketService ticketService;
+
+    @Override
+    public void activeGood(Order order, List<AssoPayOrderGood> assoPayOrderGoods) {
+        List<String> goodUuids = assoPayOrderGoods.stream().map(AssoPayOrderGood::getGoodUuid).collect(Collectors.toList());
+        goodUuids.forEach(item -> {
+            ticketService.updateProcess(item, 3);
+        });
+    }
+
+
+    @Override
+    public Double computePrice(List<GoodVO> goodVOs) {
+        Double totalPrice = 0d;
+        List<String> idStrs = goodVOs.stream().map(GoodVO::getId).distinct().collect(Collectors.toList());
+        List<Integer> ids =FormatUtil.StringTOIntegerList(idStrs);
+        LambdaQueryWrapper<Ticket> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.in(Ticket::getId, ids);
+        List<Ticket> tickets =ticketService.list(queryWrapper);
+        if(tickets.size()!=ids.size()){
+            throw new BusinessException("608","工单信息错误");
+        }
+        for (Ticket ticket:tickets){
+            totalPrice+=ticket.getPrice();
+        }
+        return totalPrice;
+    }
+}

+ 38 - 0
src/main/java/com/example/xiaoshiweixinback/factorys/goodFactory/GoodVipService.java

@@ -0,0 +1,38 @@
+package com.example.xiaoshiweixinback.factorys.goodFactory;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.example.xiaoshiweixinback.business.exception.BusinessException;
+import com.example.xiaoshiweixinback.business.utils.FormatUtil;
+import com.example.xiaoshiweixinback.domain.*;
+import com.example.xiaoshiweixinback.entity.weixinPay.GoodVO;
+import com.example.xiaoshiweixinback.service.VipService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Component
+@RequiredArgsConstructor
+public class GoodVipService implements GoodImp {
+    private final VipService vipService;
+@Override
+public void activeGood(Order order, List<AssoPayOrderGood> assoPayOrderGoods){
+AssoPayOrderGood assoPayOrderGood =assoPayOrderGoods.get(0);
+vipService.activateVIP(order,assoPayOrderGood.getGoodUuid());
+}
+
+    @Override
+    public Double computePrice(List<GoodVO> goodVOs) {
+        Double totalPrice = 0d;
+    String idStr =goodVOs.get(0).getId();
+    Vip vip =vipService.getVipByUuId(idStr);
+     if(vip==null){
+         throw  new BusinessException("608","会员不存在");
+     }
+     totalPrice+=vip.getPrice();
+        return totalPrice;
+    }
+}

+ 74 - 0
src/main/java/com/example/xiaoshiweixinback/factorys/goodFactory/GoodVoucherService.java

@@ -0,0 +1,74 @@
+package com.example.xiaoshiweixinback.factorys.goodFactory;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.example.xiaoshiweixinback.business.exception.BusinessException;
+import com.example.xiaoshiweixinback.business.utils.FormatUtil;
+import com.example.xiaoshiweixinback.domain.AssoPayOrderGood;
+import com.example.xiaoshiweixinback.domain.Order;
+import com.example.xiaoshiweixinback.domain.Voucher;
+import com.example.xiaoshiweixinback.entity.assoPersonVoucher.SendVoucherToPersonVO;
+import com.example.xiaoshiweixinback.entity.weixinPay.GoodVO;
+import com.example.xiaoshiweixinback.service.AssoPersonVoucherService;
+import com.example.xiaoshiweixinback.service.VoucherService;
+import com.example.xiaoshiweixinback.service.weixinpay.AssoPayOrderVoucherService;
+import lombok.Data;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Component;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Component
+@RequiredArgsConstructor
+public class GoodVoucherService implements GoodImp {
+    private final AssoPersonVoucherService assoPersonVoucherService;
+    private final VoucherService voucherService;
+
+    @Override
+    public void activeGood(Order order, List<AssoPayOrderGood> assoPayOrderGoods) {
+        String personUuid = order.getPersonUuid();
+        List<String> personUuids = new ArrayList<>();
+        personUuids.add(personUuid);
+
+        SendVoucherToPersonVO sendVoucherToPersonVO = new SendVoucherToPersonVO();
+        sendVoucherToPersonVO.setPersonUuids(personUuids);
+        List<SendVoucherToPersonVO.InAddVoucherVO> inAddVoucherVOS = new ArrayList<>();
+        assoPayOrderGoods.forEach(item -> {
+            SendVoucherToPersonVO.InAddVoucherVO voucherVO = new SendVoucherToPersonVO.InAddVoucherVO();
+            voucherVO.setVoucherId(Integer.parseInt(item.getGoodUuid()));
+            voucherVO.setNumber(item.getGoodCount());
+            inAddVoucherVOS.add(voucherVO);
+        });
+        sendVoucherToPersonVO.setInAddVoucherVOS(inAddVoucherVOS);
+        assoPersonVoucherService.sendVoucherToPerson(sendVoucherToPersonVO);
+    }
+
+
+    @Override
+    public Double computePrice(List<GoodVO> goodVOs) {
+        Double totalPrice = 0d;
+        List<String> idStrs = goodVOs.stream().map(GoodVO::getId).distinct().collect(Collectors.toList());
+        List<Integer> ids = FormatUtil.StringTOIntegerList(idStrs);
+
+        LambdaQueryWrapper<Voucher> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.in(Voucher::getId, ids)
+                .eq(Voucher::getState, 1);
+
+        List<Voucher> vouchers = voucherService.list(queryWrapper);
+        if (vouchers.size() != ids.size()) {
+            throw new BusinessException("608", "优惠券使用错误");
+        }
+        for (GoodVO goodVO : goodVOs) {
+            Integer id = Integer.parseInt(goodVO.getId().toString());
+            Voucher voucher = vouchers.stream().filter(item -> item.getId().equals(id)).findFirst().orElse(null);
+            if (voucher == null) {
+                throw new BusinessException("608", "优惠券使用错误");
+            }
+            Double price = voucher.getSellingPrice();
+            Integer num = goodVO.getNum();
+            totalPrice += price * num;
+        }
+        return totalPrice;
+    }
+}

+ 51 - 0
src/main/java/com/example/xiaoshiweixinback/factorys/useFunctionFactory/CheckConcernProduct.java

@@ -0,0 +1,51 @@
+package com.example.xiaoshiweixinback.factorys.useFunctionFactory;
+
+import com.alibaba.fastjson.JSON;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.example.xiaoshiweixinback.business.exception.BusinessException;
+import com.example.xiaoshiweixinback.business.utils.CacheUtil;
+import com.example.xiaoshiweixinback.business.utils.LoginUtils;
+import com.example.xiaoshiweixinback.domain.AssoPersonProduct;
+import com.example.xiaoshiweixinback.domain.AssoVipFunction;
+import com.example.xiaoshiweixinback.domain.UseFunctionRecord;
+import com.example.xiaoshiweixinback.entity.sysFuctionRights.FunctionConfig;
+import com.example.xiaoshiweixinback.entity.vo.PersonnelVO;
+import com.example.xiaoshiweixinback.service.AssoPersonProductService;
+import com.example.xiaoshiweixinback.service.UseFunctionRecordService;
+import com.example.xiaoshiweixinback.service.VipService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/4/12
+ */
+@Component
+@RequiredArgsConstructor
+public class CheckConcernProduct implements UseFunctionImp {
+    private final VipService vipService;
+    private final UseFunctionRecordService useFunctionRecordService;
+    private final AssoPersonProductService assoPersonProductService;
+    private final CacheUtil cacheUtil;
+    @Override
+    public AssoVipFunction checkFunction(String functionUuid, Object o) {
+        PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
+        AssoVipFunction assoVipFunction = vipService.getVipFunctionMessage(functionUuid);
+        if (assoVipFunction == null) {
+            throw new BusinessException("608", "不可使用此功能");
+        }
+        FunctionConfig functionConfig = JSON.parseObject(assoVipFunction.getFunctionParameter(), FunctionConfig.class);
+        Integer canGetNum = functionConfig.getCanGetNum();
+
+        LambdaQueryWrapper<AssoPersonProduct> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(AssoPersonProduct::getPersonUuid, personnelVO.getUuid());
+        Long total = assoPersonProductService.count(queryWrapper);
+
+        if (total >= canGetNum) {
+            throw new BusinessException("606", "已超过可关注数量");
+        }
+        return assoVipFunction;
+    }
+}

+ 54 - 0
src/main/java/com/example/xiaoshiweixinback/factorys/useFunctionFactory/CheckExportPatent.java

@@ -0,0 +1,54 @@
+package com.example.xiaoshiweixinback.factorys.useFunctionFactory;
+
+import com.alibaba.fastjson.JSON;
+import com.example.xiaoshiweixinback.business.exception.BusinessException;
+import com.example.xiaoshiweixinback.domain.AssoVipFunction;
+import com.example.xiaoshiweixinback.domain.UseFunctionRecord;
+import com.example.xiaoshiweixinback.entity.sysFuctionRights.FunctionConfig;
+import com.example.xiaoshiweixinback.service.UseFunctionRecordService;
+import com.example.xiaoshiweixinback.service.VipService;
+import io.swagger.v3.oas.models.security.SecurityScheme;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/4/12
+ */
+@Component
+@RequiredArgsConstructor
+public class CheckExportPatent implements UseFunctionImp {
+    private final VipService vipService;
+    private final UseFunctionRecordService useFunctionRecordService;
+
+    @Override
+    public AssoVipFunction checkFunction(String functionUuid, Object o) {
+        if (o == null) {
+            throw new BusinessException("608", "请至少选择一个专利进行导出");
+        }
+        List<String> patentNos = (List<String>) o;
+        AssoVipFunction assoVipFunction = vipService.getVipFunctionMessage(functionUuid);
+        if (assoVipFunction == null) {
+            throw new BusinessException("608", "不可使用此功能");
+        }
+        FunctionConfig functionConfig = JSON.parseObject(assoVipFunction.getFunctionParameter(), FunctionConfig.class);
+        Integer canGetNum = functionConfig.getCanGetNum();
+        Integer size =functionConfig.getSize();
+        if(size<patentNos.size()){
+            throw new BusinessException("608", "超过最大导出数量");
+        }
+        //从操作记录中查询次数
+        List<UseFunctionRecord> useFunctionRecordList = useFunctionRecordService.queryUseFunctionRecordByTime(functionUuid, 0);
+        Integer totalExportNum = patentNos.size();
+        for (UseFunctionRecord item:useFunctionRecordList){
+            Integer exportNum = Integer.parseInt(item.getFunctionParameter());
+            totalExportNum+=exportNum;
+        }
+        if (canGetNum != -1 && canGetNum <= totalExportNum) {
+            throw new BusinessException("608", "今日可导入量已用完");
+        }
+        return assoVipFunction;
+    }
+}

+ 40 - 0
src/main/java/com/example/xiaoshiweixinback/factorys/useFunctionFactory/CheckQueryPatent.java

@@ -0,0 +1,40 @@
+package com.example.xiaoshiweixinback.factorys.useFunctionFactory;
+
+import com.alibaba.fastjson.JSON;
+import com.example.xiaoshiweixinback.business.exception.BusinessException;
+import com.example.xiaoshiweixinback.domain.AssoVipFunction;
+import com.example.xiaoshiweixinback.domain.UseFunctionRecord;
+import com.example.xiaoshiweixinback.entity.sysFuctionRights.FunctionConfig;
+import com.example.xiaoshiweixinback.factorys.patentExportFactory.GetValueImp;
+import com.example.xiaoshiweixinback.service.UseFunctionRecordService;
+import com.example.xiaoshiweixinback.service.VipService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/4/12
+ */
+@Component
+@RequiredArgsConstructor
+public class CheckQueryPatent implements UseFunctionImp {
+    private  final VipService vipService;
+    private final UseFunctionRecordService useFunctionRecordService;
+    @Override
+    public AssoVipFunction checkFunction(String functionUuid,Object o) {
+        AssoVipFunction assoVipFunction=vipService.getVipFunctionMessage(functionUuid);
+        if(assoVipFunction ==null){
+            throw new BusinessException("608","不可使用此功能");
+        }
+        FunctionConfig functionConfig = JSON.parseObject(assoVipFunction.getFunctionParameter(), FunctionConfig.class);
+       Integer canGetNum =functionConfig.getCanGetNum();
+       //从操作记录中查询次数
+      List<UseFunctionRecord> useFunctionRecordList =useFunctionRecordService.queryUseFunctionRecordByTime(functionUuid,0);
+        if(canGetNum!=-1&&canGetNum<=useFunctionRecordList.size()){
+            throw new BusinessException("608","功能次数已用完");
+        }
+        return  assoVipFunction;
+    }
+}

+ 23 - 0
src/main/java/com/example/xiaoshiweixinback/factorys/useFunctionFactory/UseFunctionFactory.java

@@ -0,0 +1,23 @@
+package com.example.xiaoshiweixinback.factorys.useFunctionFactory;
+
+import com.example.xiaoshiweixinback.factorys.patentExportFactory.GetValueImp;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/4/12
+ */
+@Component
+public class UseFunctionFactory {
+    @Autowired
+    private Map<String, UseFunctionImp> useFunctionImpMap;
+
+
+    public UseFunctionImp getClass(String functionClass) {
+        UseFunctionImp bean1 = useFunctionImpMap.get(functionClass);
+        return bean1;
+    }
+}

+ 11 - 0
src/main/java/com/example/xiaoshiweixinback/factorys/useFunctionFactory/UseFunctionImp.java

@@ -0,0 +1,11 @@
+package com.example.xiaoshiweixinback.factorys.useFunctionFactory;
+
+import com.example.xiaoshiweixinback.domain.AssoVipFunction;
+
+/**
+ * @Author xiexiang
+ * @Date 2024/4/12
+ */
+public interface UseFunctionImp {
+    public AssoVipFunction checkFunction(String functionUuid,Object o);
+}

+ 18 - 0
src/main/java/com/example/xiaoshiweixinback/mapper/AssoFeedbackFileMapper.java

@@ -0,0 +1,18 @@
+package com.example.xiaoshiweixinback.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.example.xiaoshiweixinback.domain.AssoFeedbackFile;
+
+/**
+* @author admin
+* @description 针对表【asso_feedback_file(用户反馈截图)】的数据库操作Mapper
+* @createDate 2024-06-27 14:49:07
+* @Entity com/example/xiaoshiweixinback.domain.AssoFeedbackFile
+*/
+public interface AssoFeedbackFileMapper extends EasyBaseMapper<AssoFeedbackFile> {
+
+}
+
+
+
+

+ 19 - 0
src/main/java/com/example/xiaoshiweixinback/mapper/AssoPayOrderGoodMapper.java

@@ -0,0 +1,19 @@
+package com.example.xiaoshiweixinback.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.example.xiaoshiweixinback.domain.AssoPayOrderGood;
+import com.example.xiaoshiweixinback.mapper.EasyBaseMapper;
+
+/**
+* @author admin
+* @description 针对表【asso_pay_order_good(支付订单和产品关联表)】的数据库操作Mapper
+* @createDate 2024-06-28 14:57:18
+* @Entity com/example/xiaoshiweixinback.domain.AssoPayOrderGood
+*/
+public interface AssoPayOrderGoodMapper extends EasyBaseMapper<AssoPayOrderGood> {
+
+}
+
+
+
+

+ 19 - 0
src/main/java/com/example/xiaoshiweixinback/mapper/AssoPayOrderVoucherMapper.java

@@ -0,0 +1,19 @@
+package com.example.xiaoshiweixinback.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.example.xiaoshiweixinback.domain.AssoPayOrderVoucher;
+import com.example.xiaoshiweixinback.mapper.EasyBaseMapper;
+
+/**
+* @author admin
+* @description 针对表【asso_pay_order_voucher(订单和优惠券关联表)】的数据库操作Mapper
+* @createDate 2024-06-28 15:03:25
+* @Entity com/example/xiaoshiweixinback.domain.AssoPayOrderVoucher
+*/
+public interface AssoPayOrderVoucherMapper extends EasyBaseMapper<AssoPayOrderVoucher> {
+
+}
+
+
+
+

+ 33 - 0
src/main/java/com/example/xiaoshiweixinback/mapper/AssoPersonVoucherMapper.java

@@ -0,0 +1,33 @@
+package com.example.xiaoshiweixinback.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.example.xiaoshiweixinback.domain.AssoPersonVoucher;
+import com.example.xiaoshiweixinback.domain.Voucher;
+import com.example.xiaoshiweixinback.entity.assoPersonVoucher.PersonVoucherQueryDTO;
+import com.example.xiaoshiweixinback.entity.vouchar.VoucherQueryDTO;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+
+import java.util.Collection;
+import java.util.List;
+
+/**
+* @author admin
+* @description 针对表【asso_person_voucher(人员优惠券关联表)】的数据库操作Mapper
+* @createDate 2024-06-26 11:35:27
+* @Entity com/example/xiaoshiweixinback.domain.AssoPersonVoucher
+*/
+@Repository
+
+public interface AssoPersonVoucherMapper extends EasyBaseMapper<AssoPersonVoucher> {
+
+    public List<AssoPersonVoucher> queryPersonVoucher(@Param("personVoucherQueryDTO") PersonVoucherQueryDTO personVoucherQueryDTO);
+
+
+    public Long queryPersonVoucherTotal(@Param("personVoucherQueryDTO") PersonVoucherQueryDTO personVoucherQueryDTO);
+}
+
+
+
+

+ 19 - 0
src/main/java/com/example/xiaoshiweixinback/mapper/AssoVipVoucherMapper.java

@@ -0,0 +1,19 @@
+package com.example.xiaoshiweixinback.mapper;
+
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.example.xiaoshiweixinback.domain.AssoVipVoucher;
+
+/**
+* @author admin
+* @description 针对表【asso_vip_voucher(vip和优惠券关联表)】的数据库操作Mapper
+* @createDate 2024-07-01 13:46:05
+* @Entity com/example/xiaoshiweixinback.domain.AssoVipVoucher
+*/
+public interface AssoVipVoucherMapper extends BaseMapper<AssoVipVoucher> {
+
+}
+
+
+
+

+ 13 - 0
src/main/java/com/example/xiaoshiweixinback/mapper/EasyBaseMapper.java

@@ -0,0 +1,13 @@
+package com.example.xiaoshiweixinback.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import java.util.List;
+
+public interface EasyBaseMapper<T> extends BaseMapper<T> {
+    /**
+     * 批量插入 仅适用于MysqL
+     * @param entityList 实体列表
+     * @return 影响行数
+     */
+    Integer insertBatchSomeColumn(List<T> entityList);
+}

+ 21 - 0
src/main/java/com/example/xiaoshiweixinback/mapper/UseFunctionRecordMapper.java

@@ -0,0 +1,21 @@
+package com.example.xiaoshiweixinback.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.example.xiaoshiweixinback.domain.UseFunctionRecord;
+
+import java.util.List;
+
+/**
+* @author admin
+* @description 针对表【use_function_record(使用功能记录)】的数据库操作Mapper
+* @createDate 2024-07-02 11:26:00
+* @Entity com/example/xiaoshiweixinback.domain.UseFunctionRecord
+*/
+public interface UseFunctionRecordMapper extends BaseMapper<UseFunctionRecord> {
+
+    public List<UseFunctionRecord> getPersonRecordByTime(String personUuid,String functionId,Integer timeType);
+}
+
+
+
+

+ 19 - 0
src/main/java/com/example/xiaoshiweixinback/mapper/UserFeedbackMapper.java

@@ -0,0 +1,19 @@
+package com.example.xiaoshiweixinback.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.example.xiaoshiweixinback.domain.UserFeedback;
+import com.example.xiaoshiweixinback.mapper.EasyBaseMapper;
+
+/**
+* @author admin
+* @description 针对表【user_feedback】的数据库操作Mapper
+* @createDate 2024-06-27 14:01:11
+* @Entity com/example/xiaoshiweixinback.domain.UserFeedback
+*/
+public interface UserFeedbackMapper extends EasyBaseMapper<UserFeedback> {
+
+}
+
+
+
+

+ 10 - 0
src/main/java/com/example/xiaoshiweixinback/mapper/VoucherMapper.java

@@ -2,6 +2,11 @@ package com.example.xiaoshiweixinback.mapper;
 
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.example.xiaoshiweixinback.domain.Voucher;
 import com.example.xiaoshiweixinback.domain.Voucher;
+import com.example.xiaoshiweixinback.entity.vouchar.VoucherQueryDTO;
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Repository;
+
+import java.util.List;
 
 
 /**
 /**
 * @author admin
 * @author admin
@@ -9,8 +14,13 @@ import com.example.xiaoshiweixinback.domain.Voucher;
 * @createDate 2024-06-18 23:06:58
 * @createDate 2024-06-18 23:06:58
 * @Entity com/example/xiaoshiweixinback.domain.Voucher
 * @Entity com/example/xiaoshiweixinback.domain.Voucher
 */
 */
+@Repository
 public interface VoucherMapper extends BaseMapper<Voucher> {
 public interface VoucherMapper extends BaseMapper<Voucher> {
 
 
+    public List<Voucher> queryVoucher(@Param("voucherQueryDTO") VoucherQueryDTO voucherQueryDTO);
+
+
+    public Long queryVoucherTotal(@Param("voucherQueryDTO") VoucherQueryDTO voucherQueryDTO);
 }
 }
 
 
 
 

+ 20 - 0
src/main/java/com/example/xiaoshiweixinback/service/AssoFeedbackFileService.java

@@ -0,0 +1,20 @@
+package com.example.xiaoshiweixinback.service;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.example.xiaoshiweixinback.domain.AssoFeedbackFile;
+import com.example.xiaoshiweixinback.mapper.AssoFeedbackFileMapper;
+import org.springframework.stereotype.Service;
+
+/**
+* @author admin
+* @description 针对表【asso_feedback_file(用户反馈截图)】的数据库操作Service实现
+* @createDate 2024-06-27 14:49:07
+*/
+@Service
+public class AssoFeedbackFileService extends ServiceImpl<AssoFeedbackFileMapper, AssoFeedbackFile>{
+
+}
+
+
+
+

+ 13 - 18
src/main/java/com/example/xiaoshiweixinback/service/AssoPersonProductService.java

@@ -11,10 +11,13 @@ import com.example.xiaoshiweixinback.business.utils.ToolUtil;
 import com.example.xiaoshiweixinback.domain.AssoPersonFunction;
 import com.example.xiaoshiweixinback.domain.AssoPersonFunction;
 import com.example.xiaoshiweixinback.domain.AssoPersonProduct;
 import com.example.xiaoshiweixinback.domain.AssoPersonProduct;
 
 
+import com.example.xiaoshiweixinback.domain.AssoVipFunction;
 import com.example.xiaoshiweixinback.entity.dto.AssoPersonProductDTO;
 import com.example.xiaoshiweixinback.entity.dto.AssoPersonProductDTO;
 import com.example.xiaoshiweixinback.entity.sysFuctionRights.FunctionConfig;
 import com.example.xiaoshiweixinback.entity.sysFuctionRights.FunctionConfig;
 import com.example.xiaoshiweixinback.entity.vo.PersonnelVO;
 import com.example.xiaoshiweixinback.entity.vo.PersonnelVO;
+import com.example.xiaoshiweixinback.factorys.useFunctionFactory.UseFunctionFactory;
 import com.example.xiaoshiweixinback.mapper.AssoPersonProductMapper;
 import com.example.xiaoshiweixinback.mapper.AssoPersonProductMapper;
+import com.example.xiaoshiweixinback.useFunctionRecordAop.useFunctionRecord;
 import lombok.RequiredArgsConstructor;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -39,6 +42,11 @@ public class AssoPersonProductService extends ServiceImpl<AssoPersonProductMappe
     @Lazy
     @Lazy
     @Autowired
     @Autowired
     private  MonitorService monitorService;
     private  MonitorService monitorService;
+    @Autowired
+    private UseFunctionRecordService useFunctionRecordService;
+
+    private static String FACTORY_CLASS = "checkConcernPatent";
+    private static String FUNCTION_UUID = "6";
     public Integer add(AssoPersonProductDTO assoPersonProductDTO) {
     public Integer add(AssoPersonProductDTO assoPersonProductDTO) {
         Integer productId =assoPersonProductDTO.getProductId();
         Integer productId =assoPersonProductDTO.getProductId();
         PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
         PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
@@ -84,13 +92,10 @@ public class AssoPersonProductService extends ServiceImpl<AssoPersonProductMappe
     public AssoPersonProduct checkAdmin(Integer productId) {
     public AssoPersonProduct checkAdmin(Integer productId) {
        AssoPersonProduct assoPersonProduct =null;
        AssoPersonProduct assoPersonProduct =null;
         PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
         PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
-        AssoPersonFunction assoPersonFunction = vipService.getAssoPersonFunction("6");
-        if (assoPersonFunction == null) {
-            throw new BusinessException("606", "无权限");
-        }
-        Integer totalNum = 5;
-        FunctionConfig functionConfig = JSON.parseObject(assoPersonFunction.getFunctionParameter(), FunctionConfig.class);
-        totalNum = functionConfig.getCanGetNum();
+        AssoVipFunction assoVipFunction = vipService.getVipFunctionMessage(FUNCTION_UUID);
+
+        FunctionConfig functionConfig = JSON.parseObject(assoVipFunction.getFunctionParameter(), FunctionConfig.class);
+        Integer totalNum = functionConfig.getCanGetNum();
         LambdaQueryWrapper<AssoPersonProduct> queryWrapper1 =new LambdaQueryWrapper<>();
         LambdaQueryWrapper<AssoPersonProduct> queryWrapper1 =new LambdaQueryWrapper<>();
         queryWrapper1.eq(AssoPersonProduct::getProductId,productId)
         queryWrapper1.eq(AssoPersonProduct::getProductId,productId)
                 .eq(AssoPersonProduct::getPersonUuid,personnelVO.getUuid());
                 .eq(AssoPersonProduct::getPersonUuid,personnelVO.getUuid());
@@ -110,17 +115,7 @@ public class AssoPersonProductService extends ServiceImpl<AssoPersonProductMappe
        return assoPersonProduct;
        return assoPersonProduct;
     }
     }
 
 
-    public Integer addAsso(AssoPersonProductDTO assoPersonProductDTO) {
-        PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
-        if (ToolUtil.isNotEmpty(personnelVO)) {
-            AssoPersonProduct assoPersonProduct = new AssoPersonProduct();
-            BeanUtils.copyProperties(assoPersonProductDTO, assoPersonProduct);
-            assoPersonProduct.setPersonUuid(personnelVO.getUuid());
-            assoPersonProduct.insert();
-            return assoPersonProduct.getProductId();
-        }
-        return -1;
-    }
+
 
 
 
 
     public List<Integer> cancelConcern(List<Integer> productIds) {
     public List<Integer> cancelConcern(List<Integer> productIds) {

+ 31 - 11
src/main/java/com/example/xiaoshiweixinback/service/AssoPersonVipService.java

@@ -7,8 +7,6 @@ import com.example.xiaoshiweixinback.business.utils.DateUtils;
 import com.example.xiaoshiweixinback.domain.AssoPersonVip;
 import com.example.xiaoshiweixinback.domain.AssoPersonVip;
 import com.example.xiaoshiweixinback.domain.Vip;
 import com.example.xiaoshiweixinback.domain.Vip;
 import com.example.xiaoshiweixinback.mapper.AssoPersonVipMapper;
 import com.example.xiaoshiweixinback.mapper.AssoPersonVipMapper;
-import jakarta.servlet.http.HttpServletRequest;
-import org.joda.time.DateTime;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import java.util.Date;
 import java.util.Date;
@@ -21,26 +19,24 @@ import java.util.Date;
 @Service
 @Service
 public class AssoPersonVipService extends ServiceImpl<AssoPersonVipMapper, AssoPersonVip> {
 public class AssoPersonVipService extends ServiceImpl<AssoPersonVipMapper, AssoPersonVip> {
 
 
-    public AssoPersonVip getAsso(String personUuid, Vip vip) {
+    public AssoPersonVip getAsso(String personUuid,Vip vip) {
         AssoPersonVip assoPersonVip = new AssoPersonVip();
         AssoPersonVip assoPersonVip = new AssoPersonVip();
         LambdaQueryWrapper<AssoPersonVip> queryWrapper = new LambdaQueryWrapper<>();
         LambdaQueryWrapper<AssoPersonVip> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(AssoPersonVip::getPersonUuid, personUuid)
         queryWrapper.eq(AssoPersonVip::getPersonUuid, personUuid)
-                .eq(AssoPersonVip::getVipUuid, vip.getVipUuid())
+                .eq(AssoPersonVip::getVipType, vip.getVipType())
                 .orderByDesc(AssoPersonVip::getExpiryTime);
                 .orderByDesc(AssoPersonVip::getExpiryTime);
         assoPersonVip = this.getOne(queryWrapper, false);
         assoPersonVip = this.getOne(queryWrapper, false);
 
 
-        Date date = new Date();
         if (assoPersonVip != null) {
         if (assoPersonVip != null) {
-            if(assoPersonVip.getExpiryTime().compareTo(date)>0){
-               date=assoPersonVip.getExpiryTime();
-            }
+          this.updateAssoPersonVip(assoPersonVip,personUuid,vip);
         }
         }
-        assoPersonVip = this.addAssoPersonVip(personUuid, vip,date);
+        else {
+        assoPersonVip = this.addAssoPersonVip(personUuid, vip);}
         return assoPersonVip;
         return assoPersonVip;
     }
     }
 
 
-    public AssoPersonVip addAssoPersonVip(String personUuid, Vip vip,Date createDate) {
-        Date date = createDate;
+    public AssoPersonVip addAssoPersonVip(String personUuid, Vip vip) {
+        Date date = new Date();
         AssoPersonVip assoPersonVip = new AssoPersonVip();
         AssoPersonVip assoPersonVip = new AssoPersonVip();
         assoPersonVip.setCreateTime(date);
         assoPersonVip.setCreateTime(date);
         Integer lastTime = vip.getLastTime();
         Integer lastTime = vip.getLastTime();
@@ -48,9 +44,33 @@ public class AssoPersonVipService extends ServiceImpl<AssoPersonVipMapper, AssoP
         assoPersonVip.setExpiryTime(expiryDate);
         assoPersonVip.setExpiryTime(expiryDate);
         assoPersonVip.setVipUuid(vip.getVipUuid());
         assoPersonVip.setVipUuid(vip.getVipUuid());
         assoPersonVip.setPersonUuid(personUuid);
         assoPersonVip.setPersonUuid(personUuid);
+        assoPersonVip.setVipType(vip.getVipType());
         assoPersonVip.insert();
         assoPersonVip.insert();
         return assoPersonVip;
         return assoPersonVip;
     }
     }
+
+    public AssoPersonVip updateAssoPersonVip(AssoPersonVip assoPersonVip, String personUuid, Vip vip) {
+        Date date = new Date();
+        Date orgExpiry = assoPersonVip.getExpiryTime();
+        Integer lastTime = vip.getLastTime();
+        Date expiryDate = null;
+        if (orgExpiry.compareTo(date) > 0) {
+            expiryDate = DateUtils.getPlusMonthDate(orgExpiry, lastTime);
+        } else {
+            expiryDate = DateUtils.getPlusMonthDate(date, lastTime);
+
+        }
+
+        assoPersonVip.setExpiryTime(expiryDate);
+        assoPersonVip.setVipUuid(vip.getVipUuid());
+        assoPersonVip.setVipType(vip.getVipType());
+        assoPersonVip.setPersonUuid(personUuid);
+        assoPersonVip.updateById();
+        return assoPersonVip;
+    }
+
+
+
 }
 }
 
 
 
 

+ 197 - 0
src/main/java/com/example/xiaoshiweixinback/service/AssoPersonVoucherService.java

@@ -0,0 +1,197 @@
+package com.example.xiaoshiweixinback.service;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.example.xiaoshiweixinback.business.common.base.Records;
+import com.example.xiaoshiweixinback.business.exception.BusinessException;
+import com.example.xiaoshiweixinback.business.exception.XiaoShiException;
+import com.example.xiaoshiweixinback.business.utils.CacheUtil;
+import com.example.xiaoshiweixinback.business.utils.FormatUtil;
+import com.example.xiaoshiweixinback.business.utils.LoginUtils;
+import com.example.xiaoshiweixinback.domain.AssoPersonVoucher;
+import com.example.xiaoshiweixinback.domain.Voucher;
+import com.example.xiaoshiweixinback.entity.assoPersonVoucher.PersonVoucherQueryDTO;
+import com.example.xiaoshiweixinback.entity.assoPersonVoucher.SendVoucherToPersonVO;
+import com.example.xiaoshiweixinback.entity.vo.PersonnelVO;
+import com.example.xiaoshiweixinback.entity.vouchar.VoucherQueryDTO;
+import com.example.xiaoshiweixinback.entity.vouchar.VoucherVO;
+import com.example.xiaoshiweixinback.mapper.AssoPersonVoucherMapper;
+import io.swagger.v3.oas.models.security.SecurityScheme;
+import lombok.RequiredArgsConstructor;
+import org.quartz.ListenerManager;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author admin
+ * @description 针对表【asso_person_voucher(人员优惠券关联表)】的数据库操作Service实现
+ * @createDate 2024-06-26 11:35:27
+ */
+@Service
+@RequiredArgsConstructor
+public class AssoPersonVoucherService extends ServiceImpl<AssoPersonVoucherMapper, AssoPersonVoucher> {
+    private final VoucherService voucherService;
+    private final CacheUtil cacheUtil;
+
+    @Transactional(rollbackFor = Exception.class)
+    public void sendVoucherToPerson(SendVoucherToPersonVO sendVoucherToPersonVO) {
+        List<String> personUuids = sendVoucherToPersonVO.getPersonUuids();
+        List<SendVoucherToPersonVO.InAddVoucherVO> inAddVoucherVOS = sendVoucherToPersonVO.getInAddVoucherVOS();
+
+        //校验
+        if (sendVoucherToPersonVO == null || personUuids == null || personUuids.size() == 0 || sendVoucherToPersonVO.getInAddVoucherVOS() == null) {
+            throw new BusinessException("608", "请校验参数");
+        }
+
+        List<AssoPersonVoucher> assoPersonVouchers = new ArrayList<>();
+        for (int i = 0; i < inAddVoucherVOS.size(); i++) {
+            SendVoucherToPersonVO.InAddVoucherVO inAddVoucherVO = inAddVoucherVOS.get(i);
+            Integer voucherId = inAddVoucherVO.getVoucherId();
+            Integer num = inAddVoucherVO.getNumber();
+
+            //根据voucherId查询优惠券
+            Voucher voucher = voucherService.getById(voucherId);
+            if (voucher == null) {
+                throw new BusinessException("608", "优惠券不存在");
+            }
+            for (int t = 0; t < num; t++) {
+                for (String personUuid : personUuids) {
+                    AssoPersonVoucher assoPersonVoucher = this.loadAssoPersonVoucher(voucher, personUuid);
+                    assoPersonVouchers.add(assoPersonVoucher);
+                }
+            }
+
+        }
+        this.getBaseMapper().insertBatchSomeColumn(assoPersonVouchers);
+    }
+
+    private AssoPersonVoucher loadAssoPersonVoucher(Voucher voucher, String personUuid) {
+        Date date = new Date();
+        AssoPersonVoucher assoPersonVoucher = new AssoPersonVoucher();
+        assoPersonVoucher.setPersonUuid(personUuid);
+        assoPersonVoucher.setVoucherName(voucher.getName());
+        assoPersonVoucher.setVoucherType(voucher.getType());
+        assoPersonVoucher.setAmount(voucher.getAmount());
+        assoPersonVoucher.setThreshold(voucher.getThreshold());
+        assoPersonVoucher.setAvailableTime(voucher.getAvailableTime());
+        assoPersonVoucher.setExpirationTime(voucher.getExpirationTime());
+        assoPersonVoucher.setUseScope(voucher.getUseScope());
+        assoPersonVoucher.setUseState(0);
+        assoPersonVoucher.setCreateTime(date);
+        return assoPersonVoucher;
+
+    }
+
+
+    /**
+     * 查询个人优惠券
+     */
+    public Records queryPersonVoucher(PersonVoucherQueryDTO personVoucherQueryDTO) {
+        Long size = personVoucherQueryDTO.getSize();
+        Long current = personVoucherQueryDTO.getCurrent();
+        String personUuid = personVoucherQueryDTO.getPersonUuid();
+        if (personUuid == null) {
+            PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
+            personUuid = personnelVO.getUuid();
+            personVoucherQueryDTO.setPersonUuid(personUuid);
+        }
+        List<AssoPersonVoucher> assoPersonVouchers = this.getBaseMapper().queryPersonVoucher(personVoucherQueryDTO);
+        List<VoucherVO> voucherVOS = this.loadVoucherVOs(assoPersonVouchers);
+        Long total = this.getBaseMapper().queryPersonVoucherTotal(personVoucherQueryDTO);
+        Records records = new Records();
+        records.setSize(size);
+        records.setCurrent(current);
+        records.setData(voucherVOS);
+        records.setTotal(total);
+        return records;
+    }
+
+    public List<VoucherVO> loadVoucherVOs(List<AssoPersonVoucher> assoPersonVouchers) {
+        List<VoucherVO> voucherVOs = new ArrayList<>();
+        if (assoPersonVouchers == null || assoPersonVouchers.size() == 0) {
+            return voucherVOs;
+        }
+        assoPersonVouchers.forEach(item -> {
+            VoucherVO voucherVO = new VoucherVO();
+            BeanUtils.copyProperties(item, voucherVO);
+            voucherVO.setType(item.getVoucherType());
+            voucherVO.setName(item.getVoucherName());
+            List<Integer> useScopes = FormatUtil.StringToIntegerList(item.getUseScope(), ",");
+            voucherVO.setUseScopes(useScopes);
+            voucherVOs.add(voucherVO);
+        });
+
+        return voucherVOs;
+    }
+
+    /**
+     * 使用优惠券
+     *
+     * @param assoIds
+     * @param state   0未使用 1已使用 2冻结
+     */
+    @Transactional(rollbackFor = Exception.class)
+    public void useVoucher(List<Integer> assoIds, Integer state) {
+        if (assoIds == null || assoIds.size() == 0) {
+            return;
+        }
+        //校验
+        Integer useState = -1;
+        if (state == 1) {
+            useState = 2;
+        } else if (state == 2) {
+            useState = 0;
+        } else {
+            throw new BusinessException("608", "非法修改优惠券状态");
+        }
+        LambdaQueryWrapper<AssoPersonVoucher> assoPersonVoucherLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        assoPersonVoucherLambdaQueryWrapper.in(AssoPersonVoucher::getId, assoIds)
+                .eq(AssoPersonVoucher::getUseState, useState);
+        List<AssoPersonVoucher> assoPersonVouchers = this.list(assoPersonVoucherLambdaQueryWrapper);
+        if (assoPersonVouchers.size() < assoIds.size()) {
+            throw new BusinessException("608", "伪造的优惠券");
+        }
+
+        //更新状态
+        UpdateWrapper<AssoPersonVoucher> updateWrapper = new UpdateWrapper<>();
+        updateWrapper.lambda().set(AssoPersonVoucher::getUseState, state)
+                .in(AssoPersonVoucher::getId, assoIds);
+        this.update(updateWrapper);
+
+    }
+
+    public Double verifyVouchers(List<Integer> assoVoucherIds, PersonnelVO personnelVO) {
+
+        Double price = 0d;
+        if(assoVoucherIds==null){
+            return price;
+        }
+        String personId = personnelVO.getUuid();
+        LambdaQueryWrapper<AssoPersonVoucher> assoPersonVoucherLambdaQueryWrapper = new LambdaQueryWrapper<>();
+        assoPersonVoucherLambdaQueryWrapper.in(AssoPersonVoucher::getId, assoVoucherIds)
+                .eq(AssoPersonVoucher::getUseState, 0)
+                .eq(AssoPersonVoucher::getPersonUuid, personId);
+        List<AssoPersonVoucher> assoPersonVouchers = this.list(assoPersonVoucherLambdaQueryWrapper);
+        if (assoPersonVouchers.size() != assoVoucherIds.size()) {
+            throw new BusinessException("608", "伪造的优惠券");
+        }
+
+        for (AssoPersonVoucher voucher : assoPersonVouchers) {
+            price+=voucher.getAmount();
+        }
+
+        return price;
+    }
+
+}
+
+
+
+

+ 57 - 0
src/main/java/com/example/xiaoshiweixinback/service/AssoVipVoucherService.java

@@ -0,0 +1,57 @@
+package com.example.xiaoshiweixinback.service;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import com.example.xiaoshiweixinback.domain.AssoVipVoucher;
+import com.example.xiaoshiweixinback.entity.assoPersonVoucher.SendVoucherToPersonVO;
+import com.example.xiaoshiweixinback.mapper.AssoVipVoucherMapper;
+import io.swagger.v3.oas.models.security.SecurityScheme;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @author admin
+ * @description 针对表【asso_vip_voucher(vip和优惠券关联表)】的数据库操作Service实现
+ * @createDate 2024-07-01 13:46:05
+ */
+@Service
+@RequiredArgsConstructor
+public class AssoVipVoucherService extends ServiceImpl<AssoVipVoucherMapper, AssoVipVoucher> {
+
+ private final AssoPersonVoucherService assoPersonVoucherService;
+    public void addVoucher(String vipUuid,String personUuid) {
+        LambdaQueryWrapper<AssoVipVoucher> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(AssoVipVoucher::getVipUuid, vipUuid);
+        List<AssoVipVoucher> assoVipVoucherList = new ArrayList<>();
+        assoVipVoucherList = this.list(queryWrapper);
+        SendVoucherToPersonVO sendVoucherToPersonVO =this.loadSendVoucherToPersonVO(assoVipVoucherList,personUuid);
+        assoPersonVoucherService.sendVoucherToPerson(sendVoucherToPersonVO);
+
+    }
+
+    private SendVoucherToPersonVO loadSendVoucherToPersonVO(List<AssoVipVoucher> assoVipVoucherList,String personUuid ) {
+        SendVoucherToPersonVO sendVoucherToPersonVO =new SendVoucherToPersonVO();
+        List<String> personIds =new ArrayList<>();
+        personIds.add(personUuid);
+        sendVoucherToPersonVO.setPersonUuids(personIds);
+        List<SendVoucherToPersonVO.InAddVoucherVO> inAddVoucherVOS =new ArrayList<>();
+        assoVipVoucherList.forEach(item->{
+            SendVoucherToPersonVO.InAddVoucherVO inAddVoucherVO =new SendVoucherToPersonVO.InAddVoucherVO();
+     inAddVoucherVO.setVoucherId(item.getVoucherId());
+     inAddVoucherVO.setNumber(item.getVoucherCount());
+            inAddVoucherVOS.add(inAddVoucherVO);
+        });
+        sendVoucherToPersonVO.setInAddVoucherVOS(inAddVoucherVOS);
+        return sendVoucherToPersonVO;
+    }
+}
+
+
+
+

+ 42 - 5
src/main/java/com/example/xiaoshiweixinback/service/MonitorService.java

@@ -1,11 +1,14 @@
 package com.example.xiaoshiweixinback.service;
 package com.example.xiaoshiweixinback.service;
 
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.example.xiaoshiweixinback.business.common.base.Records;
 import com.example.xiaoshiweixinback.business.common.base.Records;
 import com.example.xiaoshiweixinback.business.exception.BusinessException;
 import com.example.xiaoshiweixinback.business.exception.BusinessException;
 import com.example.xiaoshiweixinback.business.utils.CacheUtil;
 import com.example.xiaoshiweixinback.business.utils.CacheUtil;
 import com.example.xiaoshiweixinback.business.utils.LoginUtils;
 import com.example.xiaoshiweixinback.business.utils.LoginUtils;
+import com.example.xiaoshiweixinback.domain.AssoPersonProduct;
+import com.example.xiaoshiweixinback.domain.AssoVipFunction;
 import com.example.xiaoshiweixinback.domain.Monitor;
 import com.example.xiaoshiweixinback.domain.Monitor;
 
 
 import com.example.xiaoshiweixinback.domain.Product;
 import com.example.xiaoshiweixinback.domain.Product;
@@ -15,6 +18,7 @@ import com.example.xiaoshiweixinback.entity.dto.monitoring.AddMonitoringDTO;
 import com.example.xiaoshiweixinback.entity.dto.monitoring.CancelMonitoringDTO;
 import com.example.xiaoshiweixinback.entity.dto.monitoring.CancelMonitoringDTO;
 import com.example.xiaoshiweixinback.entity.dto.monitoring.SelectMonitoringDTO;
 import com.example.xiaoshiweixinback.entity.dto.monitoring.SelectMonitoringDTO;
 import com.example.xiaoshiweixinback.entity.product.ProductAddDTO;
 import com.example.xiaoshiweixinback.entity.product.ProductAddDTO;
+import com.example.xiaoshiweixinback.entity.sysFuctionRights.FunctionConfig;
 import com.example.xiaoshiweixinback.entity.vo.PersonnelVO;
 import com.example.xiaoshiweixinback.entity.vo.PersonnelVO;
 import com.example.xiaoshiweixinback.entity.vo.ProductVO;
 import com.example.xiaoshiweixinback.entity.vo.ProductVO;
 import com.example.xiaoshiweixinback.mapper.MonitorMapper;
 import com.example.xiaoshiweixinback.mapper.MonitorMapper;
@@ -41,15 +45,18 @@ import java.util.stream.Collectors;
 public class MonitorService extends ServiceImpl<MonitorMapper, Monitor> {
 public class MonitorService extends ServiceImpl<MonitorMapper, Monitor> {
     @Lazy
     @Lazy
     @Autowired
     @Autowired
-    private  AssoPersonProductService assoPersonProductService;
+    private AssoPersonProductService assoPersonProductService;
     @Lazy
     @Lazy
     @Autowired
     @Autowired
     private ProductService productService;
     private ProductService productService;
     @Autowired
     @Autowired
-    private  CacheUtil cacheUtil;
+    private CacheUtil cacheUtil;
     @Autowired
     @Autowired
-    private  ProductMapper productMapper;
+    private ProductMapper productMapper;
 
 
+    @Autowired
+    private VipService vipService;
+    private static String FUNCTION_UUID = "7";
     /**
     /**
      * 添加监控
      * 添加监控
      *
      *
@@ -62,7 +69,10 @@ public class MonitorService extends ServiceImpl<MonitorMapper, Monitor> {
         Integer productId = addMonitoringDTO.getProductId();
         Integer productId = addMonitoringDTO.getProductId();
         String monitorPeriod = addMonitoringDTO.getMonitorPeriod();
         String monitorPeriod = addMonitoringDTO.getMonitorPeriod();
         Integer concernType = addMonitoringDTO.getConcernType();
         Integer concernType = addMonitoringDTO.getConcernType();
-
+         Monitor orgMonitor =this.checkAdmin(productId);
+         if(orgMonitor!=null){
+             return productId;
+         }
         //关注产品
         //关注产品
         if (productId != null) {
         if (productId != null) {
             AssoPersonProductDTO assoPersonProductDTO = new AssoPersonProductDTO();
             AssoPersonProductDTO assoPersonProductDTO = new AssoPersonProductDTO();
@@ -89,7 +99,6 @@ public class MonitorService extends ServiceImpl<MonitorMapper, Monitor> {
         monitor.setMonitorPeriod(monitorPeriod);
         monitor.setMonitorPeriod(monitorPeriod);
         monitor.setProductId(productId);
         monitor.setProductId(productId);
         monitor.insert();
         monitor.insert();
-        //TODO 添加定时任务
 
 
         return productId;
         return productId;
     }
     }
@@ -177,6 +186,34 @@ public class MonitorService extends ServiceImpl<MonitorMapper, Monitor> {
         }
         }
         return products;
         return products;
     }
     }
+
+
+    public Monitor checkAdmin(Integer productId) {
+        AssoPersonProduct assoPersonProduct = null;
+        PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
+        AssoVipFunction assoVipFunction = vipService.getVipFunctionMessage(FUNCTION_UUID);
+
+        FunctionConfig functionConfig = JSON.parseObject(assoVipFunction.getFunctionParameter(), FunctionConfig.class);
+        Integer totalNum = functionConfig.getCanGetNum();
+        LambdaQueryWrapper<Monitor> queryWrapper1 = new LambdaQueryWrapper<>();
+        queryWrapper1.eq(Monitor::getProductId, productId)
+                .eq(Monitor::getCreateId, personnelVO.getUuid());
+        Monitor org = this.getOne(queryWrapper1, false);
+        if (org != null) {
+            return org;
+        }
+        //查看关注的数量
+        LambdaQueryWrapper<Monitor> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(Monitor::getCreateId, personnelVO.getUuid());
+        Long total = this.count(queryWrapper);
+
+        if (total >= totalNum) {
+            throw new BusinessException("606", "已超过可监控数量");
+        }
+
+        return org;
+    }
+
 }
 }
 
 
 
 

+ 72 - 40
src/main/java/com/example/xiaoshiweixinback/service/OrderService.java

@@ -3,25 +3,30 @@ package com.example.xiaoshiweixinback.service;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.example.xiaoshiweixinback.business.exception.BusinessException;
 import com.example.xiaoshiweixinback.business.utils.BatchNoUtil;
 import com.example.xiaoshiweixinback.business.utils.BatchNoUtil;
-import com.example.xiaoshiweixinback.domain.AssoPersonProduct;
+import com.example.xiaoshiweixinback.domain.*;
 
 
-import com.example.xiaoshiweixinback.domain.Order;
-import com.example.xiaoshiweixinback.domain.Ticket;
-import com.example.xiaoshiweixinback.domain.Vip;
 import com.example.xiaoshiweixinback.entity.dto.ticket.TicketProcessUpDTO;
 import com.example.xiaoshiweixinback.entity.dto.ticket.TicketProcessUpDTO;
 import com.example.xiaoshiweixinback.entity.vo.PersonnelVO;
 import com.example.xiaoshiweixinback.entity.vo.PersonnelVO;
 import com.example.xiaoshiweixinback.entity.vo.person.PersonVO;
 import com.example.xiaoshiweixinback.entity.vo.person.PersonVO;
 import com.example.xiaoshiweixinback.entity.weixinPay.GetPayTicketVO;
 import com.example.xiaoshiweixinback.entity.weixinPay.GetPayTicketVO;
+import com.example.xiaoshiweixinback.entity.weixinPay.GoodVO;
 import com.example.xiaoshiweixinback.entity.weixinPay.JsApiDTO;
 import com.example.xiaoshiweixinback.entity.weixinPay.JsApiDTO;
 import com.example.xiaoshiweixinback.entity.weixinPay.WeiXinPayDTO;
 import com.example.xiaoshiweixinback.entity.weixinPay.WeiXinPayDTO;
+import com.example.xiaoshiweixinback.factorys.goodFactory.GoodFactory;
+import com.example.xiaoshiweixinback.factorys.goodFactory.GoodImp;
 import com.example.xiaoshiweixinback.mapper.AssoPersonProductMapper;
 import com.example.xiaoshiweixinback.mapper.AssoPersonProductMapper;
 import com.example.xiaoshiweixinback.mapper.OrderMapper;
 import com.example.xiaoshiweixinback.mapper.OrderMapper;
+import com.example.xiaoshiweixinback.service.weixinpay.AssoPayOrderGoodService;
+import com.example.xiaoshiweixinback.service.weixinpay.AssoPayOrderVoucherService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
+import java.util.List;
+
 /**
 /**
  * @author admin
  * @author admin
  * @description
  * @description
@@ -36,38 +41,36 @@ public class OrderService extends ServiceImpl<OrderMapper, Order> {
     @Autowired
     @Autowired
     private TicketService ticketService;
     private TicketService ticketService;
 
 
+    @Autowired
+    private AssoPayOrderGoodService assoPayOrderGoodService;
+    @Autowired
+    private AssoPayOrderVoucherService assoPayOrderVoucherService;
+    @Autowired
+    private GoodFactory goodFactory;
+    @Autowired
+    private AssoPersonVoucherService assoPersonVoucherService;
+
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
-    public Order addOrder(WeiXinPayDTO weiXinPayDTO, GetPayTicketVO getPayTicketVO, String tradeNo, PersonnelVO personVO) {
+    public Order addOrder(WeiXinPayDTO weiXinPayDTO, String tradeNo, PersonnelVO personVO) {
+         this.verifyPrice(weiXinPayDTO,personVO);
         Integer type = weiXinPayDTO.getGoodType();
         Integer type = weiXinPayDTO.getGoodType();
-        String uuid = weiXinPayDTO.getGoodUuid();
-
-
+        Double price = weiXinPayDTO.getPrice();
+        Double finalPrice = weiXinPayDTO.getFinalPrice();
+        Double discount = weiXinPayDTO.getDiscount();
+        List<GoodVO> goodVOS = weiXinPayDTO.getGoods();
+        List<Integer> assoVoucherIds = weiXinPayDTO.getPersonVoucherIds();
         Order order = new Order();
         Order order = new Order();
         order.setOrderState(0);
         order.setOrderState(0);
         order.setTradeNo(tradeNo);
         order.setTradeNo(tradeNo);
-
-        String json = JSONObject.toJSONString(getPayTicketVO);
-
-        switch (type) {
-            case 1:
-                Vip vip = vipService.getVipByUuId(uuid);
-                order.setOrgPrice(vip.getPrice());
-                order.setTruePrice(vip.getPrice());
-                order.setGoodsType(type);
-                order.setGoodUuid(uuid);
-                order.setOrderParameter(json);
-                order.setPersonUuid(personVO.getUuid());
-                break;
-            case 2:
-                Ticket ticket =ticketService.getTicketByUUid(uuid);
-                order.setOrgPrice(ticket.getPrice());
-                order.setTruePrice(ticket.getPrice());
-                order.setGoodsType(type);
-                order.setGoodUuid(uuid);
-                order.setOrderParameter(json);
-                order.setPersonUuid(personVO.getUuid());
-        }
+        order.setPersonUuid(personVO.getUuid());
+        order.setOrgPrice(price);
+        order.setTruePrice(finalPrice);
+        order.setPersonUuid(personVO.getUuid());
+        order.setDiscount(discount);
         order.insert();
         order.insert();
+        assoPayOrderGoodService.addAssoPayOrderGood(order.getId(), type, goodVOS);
+        assoPayOrderVoucherService.addAssoPayOrderVoucher(order.getId(), assoVoucherIds);
+        assoPersonVoucherService.useVoucher(assoVoucherIds, 2);
         return order;
         return order;
     }
     }
 
 
@@ -78,23 +81,52 @@ public class OrderService extends ServiceImpl<OrderMapper, Order> {
         return order;
         return order;
     }
     }
 
 
+    @Transactional(rollbackFor = Exception.class)
     public void payBack(String tradeNo) {
     public void payBack(String tradeNo) {
         Order order = this.getOrderByTradeNo(tradeNo);
         Order order = this.getOrderByTradeNo(tradeNo);
-        if(order.getOrderState()!=0){
+
+        if (order.getOrderState() != 0) {
             return;
             return;
         }
         }
         order.setOrderState(1);
         order.setOrderState(1);
         order.updateById();
         order.updateById();
-        Integer orderType = order.getGoodsType();
-        String orderuuid = order.getGoodUuid();
-        switch (orderType) {
-            case 1:
-                vipService.activateVIP(order);
-                break;
-            case 2:
-              ticketService.updateProcess(orderuuid,3);
-                break;
+        List<AssoPayOrderGood> assoPayOrderGoods = assoPayOrderGoodService.getPayOrderGoodByOrderId(order.getId());
+        Integer orderType =assoPayOrderGoods.get(0).getGoodType();
+        GoodImp goodImp = goodFactory.getClass(orderType);
+        goodImp.activeGood(order, assoPayOrderGoods);
+        List<Integer> assoPersonVoucherIds = assoPayOrderVoucherService.getAssoVoucherIdsByOrder(order.getId());
+        assoPersonVoucherService.useVoucher(assoPersonVoucherIds, 1);
+    }
+
+
+    /**
+     * 校验订单价格
+     */
+    private void verifyPrice(WeiXinPayDTO weiXinPayDTO, PersonnelVO personVO) {
+        String personUuid = personVO.getUuid();
+        Integer type = weiXinPayDTO.getGoodType();
+        List<GoodVO> goodVOS = weiXinPayDTO.getGoods();
+        List<Integer> assoVoucherIds = weiXinPayDTO.getPersonVoucherIds();
+        Double price = weiXinPayDTO.getFinalPrice();
+        Double discount = weiXinPayDTO.getDiscount();
+        if(discount==null){
+            discount=1d;
         }
         }
+        //校验优惠卷是否能使用
+        Double voucherMon = assoPersonVoucherService.verifyVouchers(assoVoucherIds, personVO);
 
 
+        //计算商品价格
+        GoodImp goodImp = goodFactory.getClass(type);
+        Double allPrice =  goodImp.computePrice(goodVOS);
+     Double withVocherPrice =allPrice-voucherMon;
+     if(withVocherPrice<=0){
+         withVocherPrice=0d;
+     }
+        //查看是否有折扣
+        // 计算价格 (商品总价格-优惠券) *折扣
+        Double truePrice =withVocherPrice*discount;
+        if(!truePrice.equals(price)){
+            throw new BusinessException("608","价格错误");
+        }
     }
     }
 }
 }

+ 26 - 4
src/main/java/com/example/xiaoshiweixinback/service/PersonService.java

@@ -6,7 +6,10 @@ import com.example.xiaoshiweixinback.business.common.base.Records;
 import com.example.xiaoshiweixinback.domain.Person;
 import com.example.xiaoshiweixinback.domain.Person;
 import com.example.xiaoshiweixinback.entity.person.PersonQueryDTO;
 import com.example.xiaoshiweixinback.entity.person.PersonQueryDTO;
 import com.example.xiaoshiweixinback.entity.person.PersonQueryVO;
 import com.example.xiaoshiweixinback.entity.person.PersonQueryVO;
+import com.example.xiaoshiweixinback.entity.person.PersonVO;
+import com.example.xiaoshiweixinback.entity.vip.VipMessageVO;
 import com.example.xiaoshiweixinback.mapper.PersonMapper;
 import com.example.xiaoshiweixinback.mapper.PersonMapper;
+import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import java.util.ArrayList;
 import java.util.ArrayList;
@@ -36,17 +39,36 @@ public class PersonService extends ServiceImpl<PersonMapper, Person> {
         Long current = personQueryDTO.getCurrent();
         Long current = personQueryDTO.getCurrent();
         Long size = personQueryDTO.getSize();
         Long size = personQueryDTO.getSize();
 
 
-
         List<PersonQueryVO> personQueryVOs = this.getBaseMapper().queryPerson(personQueryDTO);
         List<PersonQueryVO> personQueryVOs = this.getBaseMapper().queryPerson(personQueryDTO);
-        Long total =this.getBaseMapper().queryPersonTotal(personQueryDTO);
-        Records records =new Records();
-        records.setData(personQueryVOs);
+        Long total = this.getBaseMapper().queryPersonTotal(personQueryDTO);
+        Records records = new Records();
+        List<PersonVO> personVOS =this.loadPersonVO(personQueryVOs);
+        records.setData(personVOS);
         records.setTotal(total);
         records.setTotal(total);
         records.setSize(size);
         records.setSize(size);
         records.setCurrent(current);
         records.setCurrent(current);
         return records;
         return records;
 
 
     }
     }
+
+    public List<PersonVO> loadPersonVO(List<PersonQueryVO> personQueryVOS) {
+        List<PersonVO> personVOS = new ArrayList<>();
+        personQueryVOS.forEach(item -> {
+            PersonVO personVO = new PersonVO();
+            BeanUtils.copyProperties(item, personVO);
+            VipMessageVO vipMessageVO = new VipMessageVO();
+            vipMessageVO.setVipUuid(item.getVipUuid());
+            vipMessageVO.setName(item.getVipName());
+            if (item.getVipUuid() != null) {
+                personVO.setVipType(1);
+            } else {
+                personVO.setVipType(0);
+            }
+            personVO.setVipMessageVO(vipMessageVO);
+            personVOS.add(personVO);
+        });
+ return personVOS;
+    }
 }
 }
 
 
 
 

+ 1 - 1
src/main/java/com/example/xiaoshiweixinback/service/ProductService.java

@@ -227,7 +227,7 @@ public class ProductService extends ServiceImpl<ProductMapper, Product> {
             AssoPersonProductDTO assoPersonProductDTO = new AssoPersonProductDTO();
             AssoPersonProductDTO assoPersonProductDTO = new AssoPersonProductDTO();
             assoPersonProductDTO.setProductId(product.getId());
             assoPersonProductDTO.setProductId(product.getId());
             assoPersonProductDTO.setConcernType(productAddDTO.getConcernType());
             assoPersonProductDTO.setConcernType(productAddDTO.getConcernType());
-            Integer flag = assoPersonProductService.addAsso(assoPersonProductDTO);
+            Integer flag = assoPersonProductService.add(assoPersonProductDTO);
         } else {
         } else {
             product = this.updateProduct(productAddDTO, productAddDTO.getId());
             product = this.updateProduct(productAddDTO, productAddDTO.getId());
         }
         }

+ 1 - 0
src/main/java/com/example/xiaoshiweixinback/service/SysFunctionService.java

@@ -24,6 +24,7 @@ public class SysFunctionService extends ServiceImpl<SysFunctionMapper, SysFuncti
         return sysFunctions;
         return sysFunctions;
 
 
     }
     }
+
 }
 }
 
 
 
 

+ 2 - 1
src/main/java/com/example/xiaoshiweixinback/service/TicketService.java

@@ -314,7 +314,8 @@ public class TicketService extends ServiceImpl<TicketMapper, Ticket> {
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
     public Integer updateProcess(String uuid, Integer process) {
     public Integer updateProcess(String uuid, Integer process) {
         LambdaQueryWrapper<Ticket> queryWrapper = new LambdaQueryWrapper<>();
         LambdaQueryWrapper<Ticket> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.eq(Ticket::getNum, uuid);
+      Integer id=  Integer.parseInt(uuid);
+        queryWrapper.eq(Ticket::getId, id);
         Ticket ticket = this.getOne(queryWrapper, false);
         Ticket ticket = this.getOne(queryWrapper, false);
         ticket.setTicketProgress(process);
         ticket.setTicketProgress(process);
         ticket.updateById();
         ticket.updateById();

+ 58 - 0
src/main/java/com/example/xiaoshiweixinback/service/UseFunctionRecordService.java

@@ -0,0 +1,58 @@
+package com.example.xiaoshiweixinback.service;
+
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+import com.example.xiaoshiweixinback.business.utils.CacheUtil;
+import com.example.xiaoshiweixinback.business.utils.LoginUtils;
+import com.example.xiaoshiweixinback.domain.UseFunctionRecord;
+import com.example.xiaoshiweixinback.entity.vo.PersonnelVO;
+import com.example.xiaoshiweixinback.mapper.UseFunctionRecordMapper;
+import lombok.RequiredArgsConstructor;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * @author admin
+ * @description 针对表【use_function_record(使用功能记录)】的数据库操作Service实现
+ * @createDate 2024-07-02 11:26:00
+ */
+@Service
+@RequiredArgsConstructor
+public class UseFunctionRecordService extends ServiceImpl<UseFunctionRecordMapper, UseFunctionRecord> {
+    private final CacheUtil cacheUtil;
+
+    public void addFunctionRecord(String functionUuid) {
+        PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
+        String uuid = personnelVO.getUuid();
+        UseFunctionRecord useFunctionRecord = new UseFunctionRecord();
+        useFunctionRecord.setPersonUuid(uuid);
+        useFunctionRecord.setFunctionUuid(functionUuid);
+        useFunctionRecord.insert();
+    }
+
+    public void addFunctionRecord(String functionUuid, String paramer) {
+        PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
+        String uuid = personnelVO.getUuid();
+        UseFunctionRecord useFunctionRecord = new UseFunctionRecord();
+        useFunctionRecord.setPersonUuid(uuid);
+        useFunctionRecord.setFunctionParameter(paramer);
+        useFunctionRecord.setFunctionUuid(functionUuid);
+        useFunctionRecord.insert();
+    }
+
+
+    public List<UseFunctionRecord> queryUseFunctionRecordByTime( String functionId, Integer timeType) {
+        PersonnelVO personnelVO =cacheUtil.getLoginUser(LoginUtils.getToken());
+        String personUuid =personnelVO.getUuid();
+        List<UseFunctionRecord> useFunctionRecords = this.getBaseMapper().getPersonRecordByTime(personUuid, functionId, timeType);
+        return useFunctionRecords;
+
+
+    }
+}
+
+
+
+

+ 146 - 0
src/main/java/com/example/xiaoshiweixinback/service/UserFeedbackService.java

@@ -0,0 +1,146 @@
+package com.example.xiaoshiweixinback.service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.example.xiaoshiweixinback.business.common.base.Records;
+import com.example.xiaoshiweixinback.business.common.base.SystemFile;
+import com.example.xiaoshiweixinback.business.exception.BusinessException;
+import com.example.xiaoshiweixinback.business.utils.CacheUtil;
+import com.example.xiaoshiweixinback.business.utils.LoginUtils;
+import com.example.xiaoshiweixinback.domain.AssoFeedbackFile;
+import com.example.xiaoshiweixinback.domain.Person;
+import com.example.xiaoshiweixinback.domain.UserFeedback;
+import com.example.xiaoshiweixinback.entity.userFeedBack.UserFeedbackAddNewDTO;
+import com.example.xiaoshiweixinback.entity.userFeedBack.UserFeedbackQueryDTO;
+import com.example.xiaoshiweixinback.entity.userFeedBack.UserFeedbackVO;
+import com.example.xiaoshiweixinback.entity.vo.PersonnelVO;
+import com.example.xiaoshiweixinback.mapper.UserFeedbackMapper;
+import com.example.xiaoshiweixinback.service.common.FileManagerService;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.BeanUtils;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @author admin
+ * @description 针对表【user_feedback】的数据库操作Service实现
+ * @createDate 2024-06-27 14:01:11
+ */
+@Service
+@RequiredArgsConstructor
+public class UserFeedbackService extends ServiceImpl<UserFeedbackMapper, UserFeedback> {
+    private final CacheUtil cacheUtil;
+    private final AssoFeedbackFileService assoFeedbackFileService;
+    private final FileManagerService fileManagerService;
+    private final PersonService personService;
+    public Integer addUserFeedback(UserFeedbackAddNewDTO userFeedbackAddNewDTO) {
+        PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
+        UserFeedback userFeedback = new UserFeedback();
+        BeanUtils.copyProperties(userFeedbackAddNewDTO, userFeedback);
+        userFeedback.setCreateId(personnelVO.getUuid());
+        userFeedback.insert();
+
+        List<String> fileGuids = userFeedbackAddNewDTO.getFileGuids();
+        List<AssoFeedbackFile> assoFeedbackFiles = new ArrayList<>();
+        if (fileGuids != null && fileGuids.size() > 0) {
+            fileGuids.forEach(item -> {
+                AssoFeedbackFile assoFeedbackFile = new AssoFeedbackFile();
+                assoFeedbackFile.setPersonFeedbackId(userFeedback.getId());
+                assoFeedbackFile.setFileGuid(item);
+                assoFeedbackFiles.add(assoFeedbackFile);
+            });
+            assoFeedbackFileService.getBaseMapper().insertBatchSomeColumn(assoFeedbackFiles);
+        }
+        return  userFeedback.getId();
+    }
+
+
+    public Records queryUserFeedback(UserFeedbackQueryDTO userFeedbackQueryDTO) {
+        Records records = new Records();
+
+        Long current = userFeedbackQueryDTO.getCurrent();
+        Long size = userFeedbackQueryDTO.getSize();
+        if (current == null || size == null) {
+            throw new BusinessException("608", "请输入分页信息");
+        }
+        LambdaQueryWrapper<UserFeedback> queryWrapper = new LambdaQueryWrapper<>();
+        Page<UserFeedback> page = this.page(new Page<>(current, size), queryWrapper);
+        Long total = page.getTotal();
+        List<UserFeedback> userFeedbacks = page.getRecords();
+        records.setCurrent(current);
+        records.setSize(size);
+        records.setTotal(total);
+        List<UserFeedbackVO> userFeedbackVOS =this.loadUserFeedbackVO(userFeedbacks);
+        records.setData(userFeedbackVOS);
+        return records;
+    }
+
+    /**
+     * 装载vo类返回
+     *
+     * @param userFeedbacks
+     * @return
+     */
+    private List<UserFeedbackVO> loadUserFeedbackVO(List<UserFeedback> userFeedbacks) {
+        List<UserFeedbackVO> userFeedbackVOS = new ArrayList<>();
+        List<String> createIds = new ArrayList<>();
+
+        //当列表为空或长度为0时,直接返回
+        if (userFeedbacks == null || userFeedbacks.size() == 0) {
+            return userFeedbackVOS;
+        }
+        userFeedbacks.forEach(item -> {
+            if (item.getCreateId() != null) {
+                createIds.add(item.getCreateId());
+            }
+        });
+
+        List<Integer> ids = userFeedbacks.stream().map(UserFeedback::getId).collect(Collectors.toList());
+        LambdaQueryWrapper<AssoFeedbackFile> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.in(AssoFeedbackFile::getPersonFeedbackId, ids);
+        List<AssoFeedbackFile> assoFeedbackFiles = assoFeedbackFileService.list(queryWrapper);
+        List<String> fileIds = assoFeedbackFiles.stream().map(AssoFeedbackFile::getFileGuid).collect(Collectors.toList());
+        List<SystemFile> systemFiles = new ArrayList<>();
+        try {
+            String res = fileManagerService.getSystemFileFromFMS(fileIds);
+            systemFiles = JSONObject.parseArray(res, SystemFile.class);
+            if (systemFiles == null) {
+                systemFiles = new ArrayList<>();
+            }
+        } catch (Exception e) {
+        }
+
+
+        LambdaQueryWrapper<Person>  queryWrapper1 =new LambdaQueryWrapper<>();
+        queryWrapper1.in(Person::getUuid,createIds);
+        List<Person> personList =personService.list(queryWrapper1);
+
+        for (UserFeedback userFeedback : userFeedbacks) {
+            UserFeedbackVO userFeedbackVO = new UserFeedbackVO();
+            BeanUtils.copyProperties(userFeedback, userFeedbackVO);
+            List<String> temAssoFeedbackFileIds = assoFeedbackFiles.stream().filter(item -> item.getPersonFeedbackId().equals(userFeedback.getId())).map(AssoFeedbackFile::getFileGuid).collect(Collectors.toList());
+          if(temAssoFeedbackFileIds!=null&&temAssoFeedbackFileIds.size()>0){
+              List<SystemFile> temSustemFiles= systemFiles.stream().filter(item->temAssoFeedbackFileIds.contains(item.getGuid())).collect(Collectors.toList());
+              userFeedbackVO.setSystemFiles(temSustemFiles);
+          }
+         Person person =   personList.stream().filter(item->item.getUuid().equals(userFeedback.getCreateId())).findFirst().orElse(null);
+        if(person!=null){
+            userFeedbackVO.setPhoneNum(person.getPhoneNum());
+        }
+        userFeedbackVOS.add(userFeedbackVO);
+        }
+        return userFeedbackVOS;
+    }
+
+
+
+}
+
+
+
+

+ 32 - 5
src/main/java/com/example/xiaoshiweixinback/service/VipService.java

@@ -16,6 +16,7 @@ import com.example.xiaoshiweixinback.entity.weixinPay.VipRightsDTO;
 import com.example.xiaoshiweixinback.entity.weixinPay.VipRightsVO;
 import com.example.xiaoshiweixinback.entity.weixinPay.VipRightsVO;
 import com.example.xiaoshiweixinback.mapper.VipMapper;
 import com.example.xiaoshiweixinback.mapper.VipMapper;
 import jakarta.json.JsonObject;
 import jakarta.json.JsonObject;
+import org.apache.poi.hssf.usermodel.HSSFDateUtil;
 import org.eclipse.parsson.JsonUtil;
 import org.eclipse.parsson.JsonUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.context.annotation.Lazy;
@@ -56,7 +57,7 @@ public class VipService extends ServiceImpl<VipMapper, Vip> {
     public Records getAllVip() {
     public Records getAllVip() {
         Records records = new Records();
         Records records = new Records();
         LambdaQueryWrapper<Vip> queryWrapper = new LambdaQueryWrapper<>();
         LambdaQueryWrapper<Vip> queryWrapper = new LambdaQueryWrapper<>();
-        queryWrapper.select(Vip::getPrice, Vip::getVipUuid, Vip::getName, Vip::getConfigParameter);
+        queryWrapper.select(Vip::getPrice, Vip::getVipUuid, Vip::getName, Vip::getConfigParameter, Vip::getFinalPrice);
         queryWrapper.ne(Vip::getVipType, 0);
         queryWrapper.ne(Vip::getVipType, 0);
         List<Vip> vipList = this.list(queryWrapper);
         List<Vip> vipList = this.list(queryWrapper);
         records.setData(vipList);
         records.setData(vipList);
@@ -70,9 +71,8 @@ public class VipService extends ServiceImpl<VipMapper, Vip> {
         return vip;
         return vip;
     }
     }
 
 
-    public void activateVIP(Order order) {
+    public void activateVIP(Order order, String uuid) {
         String tradeNo = order.getTradeNo();
         String tradeNo = order.getTradeNo();
-        String uuid = order.getGoodUuid();
         String personUuId = order.getPersonUuid();
         String personUuId = order.getPersonUuid();
         Vip vip = this.getVipByUuId(uuid);
         Vip vip = this.getVipByUuId(uuid);
         AssoPersonVip assoPersonVip = assoPersonVipService.getAsso(personUuId, vip);
         AssoPersonVip assoPersonVip = assoPersonVipService.getAsso(personUuId, vip);
@@ -92,6 +92,9 @@ public class VipService extends ServiceImpl<VipMapper, Vip> {
             assoPersonFunctions.add(assoPersonFunction);
             assoPersonFunctions.add(assoPersonFunction);
         });
         });
         assoPersonFunctionService.saveBatch(assoPersonFunctions);
         assoPersonFunctionService.saveBatch(assoPersonFunctions);
+
+        //添加优惠券
+
     }
     }
 
 
 
 
@@ -110,6 +113,7 @@ public class VipService extends ServiceImpl<VipMapper, Vip> {
                 FunctionConfig functionConfig = JSON.parseObject(parameter, FunctionConfig.class);
                 FunctionConfig functionConfig = JSON.parseObject(parameter, FunctionConfig.class);
                 String description = this.replaceDescription(sysFunction.getDescription(), functionConfig);
                 String description = this.replaceDescription(sysFunction.getDescription(), functionConfig);
                 item.setDescription(description);
                 item.setDescription(description);
+
             });
             });
 
 
             FunctionRightVO functionRightVO = new FunctionRightVO();
             FunctionRightVO functionRightVO = new FunctionRightVO();
@@ -204,6 +208,7 @@ public class VipService extends ServiceImpl<VipMapper, Vip> {
         return vip;
         return vip;
     }
     }
 
 
+
     public AssoPersonFunction getAssoPersonFunction(String functionUuid) {
     public AssoPersonFunction getAssoPersonFunction(String functionUuid) {
         AssoPersonFunction assoPersonFunction = null;
         AssoPersonFunction assoPersonFunction = null;
         PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
         PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
@@ -218,12 +223,34 @@ public class VipService extends ServiceImpl<VipMapper, Vip> {
     }
     }
 
 
 
 
-    public Vip getDefaultVip( ) {
+    public Vip getDefaultVip() {
         LambdaQueryWrapper<Vip> queryWrapper = new LambdaQueryWrapper<>();
         LambdaQueryWrapper<Vip> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(Vip::getVipType, 0);
         queryWrapper.eq(Vip::getVipType, 0);
-        Vip vip = this.getOne(queryWrapper,false);
+        Vip vip = this.getOne(queryWrapper, false);
         return vip;
         return vip;
     }
     }
+
+
+    public AssoVipFunction getVipFunctionMessage(String functionUuid) {
+        PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
+        //查询当前用户的会员
+        LambdaQueryWrapper<AssoPersonVip> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.gt(AssoPersonVip::getExpiryTime, new Date())
+                    .eq(AssoPersonVip::getPersonUuid,personnelVO.getUuid());
+      AssoPersonVip assoPersonVip =assoPersonVipService.getOne(queryWrapper,false);
+      Integer vipType =null;
+      if(assoPersonVip==null){
+          vipType=0;
+      }else {
+          vipType =assoPersonVip.getVipType();
+      }
+         //根据vipType和functionUuid查询
+        LambdaQueryWrapper<AssoVipFunction> queryWrapper1 =new LambdaQueryWrapper<>();
+      queryWrapper1.eq(AssoVipFunction::getVipType,vipType)
+                .eq(AssoVipFunction::getFunctionUuid,functionUuid);
+      AssoVipFunction assoVipFunction =assoVipFunctionService.getOne(queryWrapper1);
+      return assoVipFunction;
+    }
 }
 }
 
 
 
 

+ 60 - 20
src/main/java/com/example/xiaoshiweixinback/service/VoucherService.java

@@ -5,16 +5,17 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.example.xiaoshiweixinback.business.common.base.Records;
 import com.example.xiaoshiweixinback.business.common.base.Records;
-import com.example.xiaoshiweixinback.entity.vouchar.VoucherAddDTO;
-import com.example.xiaoshiweixinback.entity.vouchar.VoucherBatchUpdateDTO;
-import com.example.xiaoshiweixinback.entity.vouchar.VoucherQueryDTO;
-import com.example.xiaoshiweixinback.entity.vouchar.VoucherUpdateDTO;
+import com.example.xiaoshiweixinback.business.utils.FormatUtil;
+import com.example.xiaoshiweixinback.business.utils.StringUtils;
+import com.example.xiaoshiweixinback.entity.vouchar.*;
 import com.example.xiaoshiweixinback.domain.Voucher;
 import com.example.xiaoshiweixinback.domain.Voucher;
 import com.example.xiaoshiweixinback.mapper.VoucherMapper;
 import com.example.xiaoshiweixinback.mapper.VoucherMapper;
 import io.swagger.v3.oas.models.security.SecurityScheme;
 import io.swagger.v3.oas.models.security.SecurityScheme;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
+import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.List;
 import java.util.List;
 
 
 /**
 /**
@@ -28,14 +29,28 @@ public class VoucherService extends ServiceImpl<VoucherMapper, Voucher> {
     public Integer addVoucher(VoucherAddDTO voucherAddDTO) {
     public Integer addVoucher(VoucherAddDTO voucherAddDTO) {
         Voucher voucher = new Voucher();
         Voucher voucher = new Voucher();
         BeanUtils.copyProperties(voucherAddDTO, voucher);
         BeanUtils.copyProperties(voucherAddDTO, voucher);
+        List<Integer> userScopes = voucherAddDTO.getUseScopes();
+        if (userScopes != null && userScopes.size() > 0) {
+            String userScope = StringUtils.join(userScopes, ",");
+            voucher.setUseScope(userScope);
+        }
         voucher.insert();
         voucher.insert();
         return voucher.getId();
         return voucher.getId();
     }
     }
 
 
     public Integer editVoucher(VoucherUpdateDTO voucherUpdateDTO) {
     public Integer editVoucher(VoucherUpdateDTO voucherUpdateDTO) {
         Integer id = voucherUpdateDTO.getId();
         Integer id = voucherUpdateDTO.getId();
+        List<Integer> useScopes = voucherUpdateDTO.getUseScopes();
+
         Voucher voucher = this.getById(id);
         Voucher voucher = this.getById(id);
         BeanUtils.copyProperties(voucherUpdateDTO, voucher);
         BeanUtils.copyProperties(voucherUpdateDTO, voucher);
+        if (useScopes != null && useScopes.size() > 0) {
+            String userScope = StringUtils.join(useScopes, ",");
+            voucher.setUseScope(userScope);
+        } else {
+            voucher.setUseScope(null);
+        }
+
         voucher.updateById();
         voucher.updateById();
         return id;
         return id;
     }
     }
@@ -44,23 +59,14 @@ public class VoucherService extends ServiceImpl<VoucherMapper, Voucher> {
         Records records = new Records();
         Records records = new Records();
         Long size = voucherQueryDTO.getSize();
         Long size = voucherQueryDTO.getSize();
         Long current = voucherQueryDTO.getCurrent();
         Long current = voucherQueryDTO.getCurrent();
-        Integer state = voucherQueryDTO.getState();
+        List<Voucher> vouchers = this.getBaseMapper().queryVoucher(voucherQueryDTO);
+        Long total = this.getBaseMapper().queryVoucherTotal(voucherQueryDTO);
+        List<VoucherVO> voucherVOS = this.loadVoucherVOs(vouchers);
+        records.setData(voucherVOS);
+        records.setCurrent(current);
+        records.setSize(size);
+        records.setTotal(total);
 
 
-        LambdaQueryWrapper<Voucher> queryWrapper = new LambdaQueryWrapper<>();
-        if (state != null) {
-            queryWrapper.eq(Voucher::getState, state);
-        }
-        if (size != null && current != null) {
-            Page<Voucher> page = this.page(new Page<>(current, size), queryWrapper);
-            List<Voucher> vouchers = page.getRecords();
-            records.setData(vouchers);
-            records.setCurrent(current);
-            records.setSize(size);
-            records.setTotal(page.getTotal());
-        } else {
-            List<Voucher> vouchers = this.list(queryWrapper);
-            records.setData(vouchers);
-        }
         return records;
         return records;
     }
     }
 
 
@@ -74,6 +80,40 @@ public class VoucherService extends ServiceImpl<VoucherMapper, Voucher> {
         return ids;
         return ids;
     }
     }
 
 
+    public List<VoucherVO> loadVoucherVOs(List<Voucher> vouchers) {
+        List<VoucherVO> voucherVOs = new ArrayList<>();
+        if (vouchers == null || vouchers.size() == 0) {
+            return voucherVOs;
+        }
+        vouchers.forEach(item -> {
+            VoucherVO voucherVO = new VoucherVO();
+            BeanUtils.copyProperties(item, voucherVO);
+            List<Integer> useScopes = FormatUtil.StringToIntegerList(item.getUseScope(), ",");
+            voucherVO.setUseScopes(useScopes);
+            voucherVOs.add(voucherVO);
+        });
+
+        return voucherVOs;
+    }
+
+
+    public VoucherVO queryVectorDetail(Integer id) {
+        VoucherVO voucherVO = new VoucherVO();
+        if (id == null) {
+            return voucherVO;
+
+        }
+        Voucher voucher = this.getById(id);
+        if (voucher == null) {
+            return voucherVO;
+        }
+        List<VoucherVO> voucherVOS = this.loadVoucherVOs(Arrays.asList(voucher));
+
+        if (voucherVOS != null && voucherVOS.size() > 0) {
+            voucherVO = voucherVOS.get(0);
+        }
+        return voucherVO;
+    }
 }
 }
 
 
 
 

+ 14 - 0
src/main/java/com/example/xiaoshiweixinback/service/exportPatent/PatentExportService.java

@@ -2,12 +2,16 @@ package com.example.xiaoshiweixinback.service.exportPatent;
 
 
 import com.example.xiaoshiweixinback.business.exception.XiaoShiException;
 import com.example.xiaoshiweixinback.business.exception.XiaoShiException;
 import com.example.xiaoshiweixinback.business.utils.*;
 import com.example.xiaoshiweixinback.business.utils.*;
+import com.example.xiaoshiweixinback.domain.AssoVipFunction;
 import com.example.xiaoshiweixinback.entity.dto.patent.PatentColumnDTO;
 import com.example.xiaoshiweixinback.entity.dto.patent.PatentColumnDTO;
 import com.example.xiaoshiweixinback.entity.vo.PatentConfigVO;
 import com.example.xiaoshiweixinback.entity.vo.PatentConfigVO;
 import com.example.xiaoshiweixinback.entity.vo.PatentExportVO;
 import com.example.xiaoshiweixinback.entity.vo.PatentExportVO;
 import com.example.xiaoshiweixinback.entity.vo.esConfig.EsConfigVO;
 import com.example.xiaoshiweixinback.entity.vo.esConfig.EsConfigVO;
 import com.example.xiaoshiweixinback.factorys.patentExportFactory.GetValueImp;
 import com.example.xiaoshiweixinback.factorys.patentExportFactory.GetValueImp;
 import com.example.xiaoshiweixinback.factorys.patentExportFactory.PatentExportFactory;
 import com.example.xiaoshiweixinback.factorys.patentExportFactory.PatentExportFactory;
+import com.example.xiaoshiweixinback.factorys.useFunctionFactory.UseFunctionFactory;
+import com.example.xiaoshiweixinback.factorys.useFunctionFactory.UseFunctionImp;
+import com.example.xiaoshiweixinback.service.UseFunctionRecordService;
 import com.example.xiaoshiweixinback.service.importPatent.CommonService;
 import com.example.xiaoshiweixinback.service.importPatent.CommonService;
 import com.example.xiaoshiweixinback.service.importPatent.EsPatentService;
 import com.example.xiaoshiweixinback.service.importPatent.EsPatentService;
 import com.example.xiaoshiweixinback.service.importPatent.excel.ExcuteDataToVOService;
 import com.example.xiaoshiweixinback.service.importPatent.excel.ExcuteDataToVOService;
@@ -30,6 +34,7 @@ import java.util.stream.Collectors;
 
 
 /**
 /**
  * 专利导出Excel
  * 专利导出Excel
+ *
  * @Author xiexiang
  * @Author xiexiang
  * @Date 2024/4/11
  * @Date 2024/4/11
  */
  */
@@ -43,6 +48,12 @@ public class PatentExportService {
     @Autowired
     @Autowired
     private EsPatentService esPatentService;
     private EsPatentService esPatentService;
 
 
+    private final UseFunctionFactory useFunctionFactory;
+    private final UseFunctionRecordService useFunctionRecordService;
+
+    private static String FACTORY_CLASS = "checkExportPatent";
+    private static String FUNCTION_UUID = "5";
+
     /**
     /**
      * 导出专利
      * 导出专利
      *
      *
@@ -51,6 +62,8 @@ public class PatentExportService {
      * @throws IOException
      * @throws IOException
      */
      */
     public String exportPatent(List<String> patentNos) throws IOException {
     public String exportPatent(List<String> patentNos) throws IOException {
+        UseFunctionImp useFunctionImp = useFunctionFactory.getClass(FACTORY_CLASS);
+        AssoVipFunction assoVipFunction = useFunctionImp.checkFunction(FUNCTION_UUID, patentNos);
         try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
         try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
             String patentExportJson = ExcuteConfigUtils.excuteConfigJson();
             String patentExportJson = ExcuteConfigUtils.excuteConfigJson();
             //selected字符串转PatentExportVO集合
             //selected字符串转PatentExportVO集合
@@ -145,6 +158,7 @@ public class PatentExportService {
             if (out.toByteArray() != null && out.toByteArray().length != 0) {
             if (out.toByteArray() != null && out.toByteArray().length != 0) {
                 fileGuid = parseByteToFileUtils.uploadFile(out.toByteArray(), 1);
                 fileGuid = parseByteToFileUtils.uploadFile(out.toByteArray(), 1);
             }
             }
+            useFunctionRecordService.addFunctionRecord(FUNCTION_UUID, total.toString());
             return fileGuid;
             return fileGuid;
         } catch (FileNotFoundException e) {
         } catch (FileNotFoundException e) {
             throw new FileNotFoundException();
             throw new FileNotFoundException();

+ 19 - 7
src/main/java/com/example/xiaoshiweixinback/service/importPatent/EsDenseVectorService.java

@@ -29,6 +29,7 @@ import com.example.xiaoshiweixinback.business.utils.parseQueryToTree.operateNode
 import com.example.xiaoshiweixinback.business.utils.parseQueryToTree.treeNode;
 import com.example.xiaoshiweixinback.business.utils.parseQueryToTree.treeNode;
 import com.example.xiaoshiweixinback.domain.AssoPersonFunction;
 import com.example.xiaoshiweixinback.domain.AssoPersonFunction;
 import com.example.xiaoshiweixinback.domain.AssoProductFile;
 import com.example.xiaoshiweixinback.domain.AssoProductFile;
+import com.example.xiaoshiweixinback.domain.AssoVipFunction;
 import com.example.xiaoshiweixinback.domain.Product;
 import com.example.xiaoshiweixinback.domain.Product;
 import com.example.xiaoshiweixinback.domain.es.PatentVector;
 import com.example.xiaoshiweixinback.domain.es.PatentVector;
 import com.example.xiaoshiweixinback.entity.dto.esPicture.EsPictureNoDTO;
 import com.example.xiaoshiweixinback.entity.dto.esPicture.EsPictureNoDTO;
@@ -40,9 +41,12 @@ import com.example.xiaoshiweixinback.entity.sysFuctionRights.FunctionConfig;
 import com.example.xiaoshiweixinback.entity.vo.esPicture.EsPictureNoVo;
 import com.example.xiaoshiweixinback.entity.vo.esPicture.EsPictureNoVo;
 import com.example.xiaoshiweixinback.entity.vo.esPicture.EsPatentVectorVo;
 import com.example.xiaoshiweixinback.entity.vo.esPicture.EsPatentVectorVo;
 import com.example.xiaoshiweixinback.entity.vo.esPicture.GetImageVO;
 import com.example.xiaoshiweixinback.entity.vo.esPicture.GetImageVO;
+import com.example.xiaoshiweixinback.factorys.useFunctionFactory.UseFunctionFactory;
+import com.example.xiaoshiweixinback.factorys.useFunctionFactory.UseFunctionImp;
 import com.example.xiaoshiweixinback.mapper.AssoProductFileMapper;
 import com.example.xiaoshiweixinback.mapper.AssoProductFileMapper;
 import com.example.xiaoshiweixinback.mapper.ProductMapper;
 import com.example.xiaoshiweixinback.mapper.ProductMapper;
 import com.example.xiaoshiweixinback.service.SearchRecordService;
 import com.example.xiaoshiweixinback.service.SearchRecordService;
+import com.example.xiaoshiweixinback.service.UseFunctionRecordService;
 import com.example.xiaoshiweixinback.service.VipService;
 import com.example.xiaoshiweixinback.service.VipService;
 import com.example.xiaoshiweixinback.service.common.FileManagerService;
 import com.example.xiaoshiweixinback.service.common.FileManagerService;
 import com.example.xiaoshiweixinback.service.common.GetVectorService;
 import com.example.xiaoshiweixinback.service.common.GetVectorService;
@@ -100,6 +104,11 @@ public class EsDenseVectorService {
     @Value("${ES.patent}")
     @Value("${ES.patent}")
     private String patentMapName;
     private String patentMapName;
 
 
+    private final UseFunctionFactory useFunctionFactory;
+    private final UseFunctionRecordService useFunctionRecordService;
+    private static String FACTORY_CLASS = "checkQueryPatent";
+    private static String FUNCTION_UUID= "3";
+
     /**
     /**
      * R
      * R
      * 根据图片排序获取列表
      * 根据图片排序获取列表
@@ -114,14 +123,16 @@ public class EsDenseVectorService {
         Long pageSize = dto.getPageSize();
         Long pageSize = dto.getPageSize();
         Boolean ifAddSearchRecord = dto.getIfAddSearchRecord();
         Boolean ifAddSearchRecord = dto.getIfAddSearchRecord();
         Long allNum = pageNum * pageSize;
         Long allNum = pageNum * pageSize;
-        Long canGetNum = 100L;
-        AssoPersonFunction assoPersonFunction = vipService.getAssoPersonFunction("3");
-        if (assoPersonFunction != null) {
-            FunctionConfig functionConfig = JSON.parseObject(assoPersonFunction.getFunctionParameter(), FunctionConfig.class);
-            canGetNum = Long.parseLong(functionConfig.getSize().toString());
+
+        UseFunctionImp useFunctionImpMap = useFunctionFactory.getClass(FACTORY_CLASS);
+    AssoVipFunction assoVipFunction= useFunctionImpMap.checkFunction(FUNCTION_UUID,null);
+        Long size = null;
+        if (assoVipFunction != null) {
+            FunctionConfig functionConfig = JSON.parseObject(assoVipFunction.getFunctionParameter(), FunctionConfig.class);
+            size  = Long.parseLong(functionConfig.getSize().toString());
         }
         }
 
 
-        if (canGetNum!=-1L&&allNum > canGetNum) {
+        if (size != -1L && allNum > size) {
             throw new BusinessException("607", "超过可查看专利数量");
             throw new BusinessException("607", "超过可查看专利数量");
         }
         }
         SearchRequest.Builder builder = new SearchRequest.Builder();
         SearchRequest.Builder builder = new SearchRequest.Builder();
@@ -137,7 +148,7 @@ public class EsDenseVectorService {
         }
         }
 
 
         GetImageVO imageVO = this.getImageList(dto.getProductId(), file, dto.getDescription());
         GetImageVO imageVO = this.getImageList(dto.getProductId(), file, dto.getDescription());
-        List<Float> imageList = null;
+        List<Float> imageList = imageVO.getImageList();
         List<String> getGuids = imageVO.getGetGuids();
         List<String> getGuids = imageVO.getGetGuids();
         if (!CollectionUtils.isEmpty(imageList)) {
         if (!CollectionUtils.isEmpty(imageList)) {
             String source = "cosineSimilarity(params.queryVector, 'my_vector') + 1.0";
             String source = "cosineSimilarity(params.queryVector, 'my_vector') + 1.0";
@@ -213,6 +224,7 @@ public class EsDenseVectorService {
             recordDTO.setSearchTime(new Date());
             recordDTO.setSearchTime(new Date());
             searchRecordService.addSearchRecord(recordDTO);
             searchRecordService.addSearchRecord(recordDTO);
         }
         }
+        useFunctionRecordService.addFunctionRecord(FUNCTION_UUID);
         return records;
         return records;
     }
     }
 
 

+ 52 - 0
src/main/java/com/example/xiaoshiweixinback/service/weixinpay/AssoPayOrderGoodService.java

@@ -0,0 +1,52 @@
+package com.example.xiaoshiweixinback.service.weixinpay;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.example.xiaoshiweixinback.domain.AssoPayOrderGood;
+import com.example.xiaoshiweixinback.entity.weixinPay.GoodVO;
+import com.example.xiaoshiweixinback.mapper.AssoPayOrderGoodMapper;
+import io.swagger.v3.oas.models.security.SecurityScheme;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author admin
+ * @description 针对表【asso_pay_order_good(支付订单和产品关联表)】的数据库操作Service实现
+ * @createDate 2024-06-28 14:57:18
+ */
+@Service
+public class AssoPayOrderGoodService extends ServiceImpl<AssoPayOrderGoodMapper, AssoPayOrderGood> {
+
+    public void addAssoPayOrderGood(Integer orderId, Integer goodType, List<GoodVO> goodVOS) {
+        List<AssoPayOrderGood> assoPayOrderGoods = new ArrayList<>();
+        if (goodVOS == null || goodVOS.size() == 0) {
+            return;
+        }
+        for (GoodVO goodVO : goodVOS) {
+            AssoPayOrderGood assoPayOrderGood = new AssoPayOrderGood();
+            assoPayOrderGood.setGoodUuid(goodVO.getId());
+            assoPayOrderGood.setGoodCount(goodVO.getNum());
+            assoPayOrderGood.setGoodType(goodType);
+            assoPayOrderGood.setPayOrderId(orderId);
+            assoPayOrderGoods.add(assoPayOrderGood);
+        }
+        if (assoPayOrderGoods != null && assoPayOrderGoods.size() > 0) {
+            this.getBaseMapper().insertBatchSomeColumn(assoPayOrderGoods);
+        }
+    }
+
+    public List<AssoPayOrderGood>  getPayOrderGoodByOrderId(Integer orderId) {
+        LambdaQueryWrapper<AssoPayOrderGood> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(AssoPayOrderGood::getPayOrderId, orderId);
+        List<AssoPayOrderGood> assoPayOrderGoods = this.list(queryWrapper);
+        return assoPayOrderGoods;
+
+    }
+}
+
+
+
+

+ 54 - 0
src/main/java/com/example/xiaoshiweixinback/service/weixinpay/AssoPayOrderVoucherService.java

@@ -0,0 +1,54 @@
+package com.example.xiaoshiweixinback.service.weixinpay;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.example.xiaoshiweixinback.domain.AssoPayOrderVoucher;
+import com.example.xiaoshiweixinback.mapper.AssoPayOrderVoucherMapper;
+import io.swagger.v3.oas.models.security.SecurityScheme;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @author admin
+ * @description 针对表【asso_pay_order_voucher(订单和优惠券关联表)】的数据库操作Service实现
+ * @createDate 2024-06-28 15:03:25
+ */
+@Service
+public class AssoPayOrderVoucherService extends ServiceImpl<AssoPayOrderVoucherMapper, AssoPayOrderVoucher> {
+
+    public void addAssoPayOrderVoucher(Integer orderId, List<Integer> assoPersonVoucherIds) {
+        if (assoPersonVoucherIds==null||assoPersonVoucherIds.size() == 0) {
+            return;
+        }
+        List<AssoPayOrderVoucher> assoPayOrderVouchers = new ArrayList<>();
+        assoPersonVoucherIds.forEach(item -> {
+            AssoPayOrderVoucher assoPayOrderVoucher =new AssoPayOrderVoucher();
+            assoPayOrderVoucher.setPayOrderId(orderId);
+            assoPayOrderVoucher.setAssoPersonVoucherId(item);
+            assoPayOrderVouchers.add(assoPayOrderVoucher);
+        });
+
+    if(assoPayOrderVouchers!=null&&assoPayOrderVouchers.size()>0){
+        this.getBaseMapper().insertBatchSomeColumn(assoPayOrderVouchers);
+    }
+    }
+    public List<Integer> getAssoVoucherIdsByOrder(Integer orderId){
+        List<Integer> assoIds =new ArrayList<>();
+        LambdaQueryWrapper<AssoPayOrderVoucher> queryWrapper =new LambdaQueryWrapper<>();
+        queryWrapper.eq(AssoPayOrderVoucher::getPayOrderId,orderId);
+        List<AssoPayOrderVoucher> assoPayOrderVouchers =this.list(queryWrapper);
+        if(assoPayOrderVouchers==null||assoPayOrderVouchers.size()==0){
+            return assoIds;
+        }
+        assoIds =assoPayOrderVouchers.stream().map(AssoPayOrderVoucher::getAssoPersonVoucherId).collect(Collectors.toList());
+    return assoIds;
+    }
+}
+
+
+
+

+ 3 - 1
src/main/java/com/example/xiaoshiweixinback/service/weixinpay/WeixinPayService.java

@@ -18,6 +18,7 @@ import okhttp3.*;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 
 import java.io.IOException;
 import java.io.IOException;
 import java.util.Objects;
 import java.util.Objects;
@@ -48,12 +49,13 @@ public class WeixinPayService {
      * @return
      * @return
      * @throws Exception
      * @throws Exception
      */
      */
+    @Transactional(rollbackFor = Exception.class)
     public GetPayTicketVO getPayTickets(WeiXinPayDTO weiXinPayDTO) throws Exception {
     public GetPayTicketVO getPayTickets(WeiXinPayDTO weiXinPayDTO) throws Exception {
         GetPayTicketVO getPayTicketVO = new GetPayTicketVO();
         GetPayTicketVO getPayTicketVO = new GetPayTicketVO();
         String url = "https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi";
         String url = "https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi";
         String tradeNo = BatchNoUtil.getOrderNo();
         String tradeNo = BatchNoUtil.getOrderNo();
         PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
         PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
-        Order order = orderService.addOrder(weiXinPayDTO, getPayTicketVO, tradeNo, personnelVO);
+        Order order = orderService.addOrder(weiXinPayDTO, tradeNo, personnelVO);
         JsApiDTO jsApiDTO = this.loadJsApiDTO(order, tradeNo);
         JsApiDTO jsApiDTO = this.loadJsApiDTO(order, tradeNo);
 
 
         OkHttpClient okHttpClient = new OkHttpClient();
         OkHttpClient okHttpClient = new OkHttpClient();

+ 87 - 0
src/main/java/com/example/xiaoshiweixinback/useFunctionRecordAop/UseFunctionRecordAop.java

@@ -0,0 +1,87 @@
+package com.example.xiaoshiweixinback.useFunctionRecordAop;
+
+
+import com.example.xiaoshiweixinback.business.common.Response;
+import com.example.xiaoshiweixinback.business.utils.CacheUtil;
+import com.example.xiaoshiweixinback.business.utils.JsonUtils;
+import com.example.xiaoshiweixinback.business.utils.LoginUtils;
+import com.example.xiaoshiweixinback.business.utils.RedisUtil;
+import com.example.xiaoshiweixinback.entity.vo.PersonnelVO;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.*;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.annotation.Order;
+import org.springframework.stereotype.Component;
+
+import java.lang.reflect.Method;
+import java.util.concurrent.TimeUnit;
+
+@Order(2)
+@Aspect
+@Component
+public class UseFunctionRecordAop {
+    @Autowired
+    private CacheUtil cacheUtil;
+    @Autowired
+    private RedisUtil redisUtil;
+
+    /**
+     * 定义切点
+     */
+    @Pointcut("@annotation(com.example.xiaoshiweixinback.useFunctionRecordAop.useFunctionRecord)")
+    public void annotationPointcut() {
+
+    }
+
+    @Before("annotationPointcut()")
+    public void beforePointcut(JoinPoint joinPoint) {
+        //此处进入到方法前  可以实现一些业务逻辑
+        //获取目标对象方法参数
+
+    }
+
+    /**
+     * @param joinPoint 当前执行的方法
+     */
+    @Around("annotationPointcut()")
+    public Object doAround(ProceedingJoinPoint joinPoint) throws Throwable {
+//        // 是否通过切面过滤标记
+//        Boolean isPass = true;
+//        try {
+//            PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
+//            redisUtil.setEx(LoginUtils.getToken(), JsonUtils.objectToJson(personnelVO), 3L, TimeUnit.HOURS);
+//        } catch (Exception e) {
+//            return Response.unLogin("未登录");
+//        }
+//        //判断不通过
+//        if (!isPass) {
+//            return Response.unLogin("未登录");
+//        }
+
+        //判断通过
+        return joinPoint.proceed();
+    }
+
+    /**
+     * 在切入点return内容之后切入内容(可以用来对处理返回值做一些加工处理)
+     *
+     * @param joinPoint 切点
+     */
+    @AfterReturning("annotationPointcut()")
+    public void doAfterReturning(JoinPoint joinPoint) {
+
+        MethodSignature ms = (MethodSignature) joinPoint.getSignature();
+        //获得执行方法对象
+        Method method = ms.getMethod();
+        //获得执行方法对象上的@checkAuth,@Operation注解对象
+        useFunctionRecord myAnnotation = method.getAnnotation(useFunctionRecord.class);
+       String fId =myAnnotation.FunId();
+
+    }
+
+    private void checkToken(String token) {
+    }
+}
+

+ 17 - 0
src/main/java/com/example/xiaoshiweixinback/useFunctionRecordAop/useFunctionRecord.java

@@ -0,0 +1,17 @@
+package com.example.xiaoshiweixinback.useFunctionRecordAop;
+
+import java.lang.annotation.Documented;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * @author LRJ
+ * @date 2022-8-23
+ * @description 数据权限(增删改)条件判断注解
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Documented
+public @interface useFunctionRecord {
+    String FunId() default "0";
+}
+

+ 68 - 0
src/main/resources/mapper/AssoPersonVoucherMapper.xml

@@ -0,0 +1,68 @@
+<?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.example.xiaoshiweixinback.mapper.AssoPersonVoucherMapper">
+
+    <select id="queryPersonVoucher" resultType="com.example.xiaoshiweixinback.domain.AssoPersonVoucher">
+       select
+       *
+       from asso_person_voucher
+           <where>
+              <choose>
+                  <when test="personVoucherQueryDTO.state!=null">
+                      and use_state =#{personVoucherQueryDTO.state}
+                  </when>
+                  <otherwise>
+                      and  use_state =0
+                  </otherwise>
+              </choose>
+               <if test="personVoucherQueryDTO.useScopes!=null and personVoucherQueryDTO.useScopes.size()>0">
+          and
+                   <foreach collection="personVoucherQueryDTO.useScopes" item="item" open="(" close=")" separator=" or ">
+                       find_in_set(#{item},use_scope)
+                   </foreach>
+               </if>
+
+               <if test="personVoucherQueryDTO.ifExpiration!=null">
+                   <choose>
+                       <when test="personVoucherQueryDTO.ifExpiration.equals(true)">
+                           and expiration_time &lt; now()
+
+                       </when>
+                       <when test="personVoucherQueryDTO.ifExpiration.equals(false)">
+                           and (expiration_time &gt; now() or expiration_time is null)
+                       </when>
+                   </choose>
+               </if>
+
+          and person_uuid=#{personVoucherQueryDTO.personUuid}
+           </where>
+        order by create_time desc
+        <if test="personVoucherQueryDTO.current!=null and personVoucherQueryDTO.size!=null">
+            limit ${(personVoucherQueryDTO.current -1)*personVoucherQueryDTO.size},${personVoucherQueryDTO.size}
+        </if>
+
+    </select>
+
+    <select id="queryPersonVoucherTotal" resultType="java.lang.Long">
+        select count(*) from asso_person_voucher
+        <where>
+            <choose>
+                <when test="personVoucherQueryDTO.state!=null">
+                    and use_state =#{personVoucherQueryDTO.state}
+                </when>
+                <otherwise>
+                    and  use_state =0
+                </otherwise>
+            </choose>
+            <if test="personVoucherQueryDTO.useScopes!=null and personVoucherQueryDTO.useScopes.size()>0">
+                and
+                <foreach collection="personVoucherQueryDTO.useScopes" item="item" open="(" close=")" separator=" or ">
+                    find_in_set(#{item},use_scope)
+                </foreach>
+            </if>
+            and person_uuid=#{personVoucherQueryDTO.personUuid}
+        </where>
+
+
+    </select>
+</mapper>

+ 0 - 16
src/main/resources/mapper/AssoVipFunctionMapper.xml

@@ -1,16 +0,0 @@
-<?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.example.xiaoshiweixinback.mapper.AssoVipFunctionMapper">
-
-    <select id="getAll" resultType="com.example.xiaoshiweixinback.entity.weixinPay.VipRightsVO">
-        select avf.function_uuid      as functionUuid,
-               v.name                 as name,
-               avf.function_parameter as functionParameter,
-               v.vip_uuid        as vipUuid
-        from asso_vip_function as avf
-                 left join vip as v on avf.vip_uuid = v.vip_uuid
-
-    </select>
-
-
-</mapper>

+ 6 - 4
src/main/resources/mapper/PersonMapper.xml

@@ -10,7 +10,8 @@
                p.email    as email,
                p.email    as email,
                p.user_name as userName,
                p.user_name as userName,
                vm.vip_uuid as vipUuid,
                vm.vip_uuid as vipUuid,
-               vm.name as vipName
+               vm.name as vipName,
+               p.create_time as createTime
         from ecs.person as p
         from ecs.person as p
             left join (select person_uuid, name, vip_uuid
             left join (select person_uuid, name, vip_uuid
             from (select v.name, apv.person_uuid, v.vip_uuid
             from (select v.name, apv.person_uuid, v.vip_uuid
@@ -32,10 +33,11 @@
                <if test="personQueryDTO.phoneNum!=null">
                <if test="personQueryDTO.phoneNum!=null">
                    and p.phone_num like CONCAT('%',#{personQueryDTO.phoneNum},'%')
                    and p.phone_num like CONCAT('%',#{personQueryDTO.phoneNum},'%')
                </if>
                </if>
-               <if test="personQueryDTO.current!=null and personQueryDTO.size!=null">
-                   limit ${(personQueryDTO.current -1)*personQueryDTO.size},${personQueryDTO.size}
-               </if>
+
            </where>
            </where>
+        <if test="personQueryDTO.current!=null and personQueryDTO.size!=null">
+            limit ${(personQueryDTO.current -1)*personQueryDTO.size},${personQueryDTO.size}
+        </if>
     </select>
     </select>
 
 
     <select id="queryPersonTotal" resultType="java.lang.Long">
     <select id="queryPersonTotal" resultType="java.lang.Long">

+ 24 - 0
src/main/resources/mapper/UseFunctionRecordMapper.xml

@@ -0,0 +1,24 @@
+<?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.example.xiaoshiweixinback.mapper.UseFunctionRecordMapper">
+
+    <select id="getPersonRecordByTime" resultType="com.example.xiaoshiweixinback.domain.UseFunctionRecord">
+       select * from use_function_record
+<where>
+    person_uuid=#{personUuid} and function_uuid=#{functionId}
+<choose>
+
+    <when test="timeType.equals(0)">
+        and DATE_FORMAT(create_time,"%y-%m-%d") = DATE_FORMAT(now(),"%y-%m-%d")
+    </when>
+
+    <when test="timeType.equals(1)">
+        and DATE_FORMAT(create_time,"%y-%m") = DATE_FORMAT(now(),"%y-%m")
+    </when>
+</choose>
+</where>
+
+    </select>
+
+
+</mapper>

+ 66 - 0
src/main/resources/mapper/VoucherMapper.xml

@@ -0,0 +1,66 @@
+<?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.example.xiaoshiweixinback.mapper.VoucherMapper">
+
+    <select id="queryVoucher" resultType="com.example.xiaoshiweixinback.domain.Voucher">
+        select
+        * from voucher
+        <where>
+            <if test="voucherQueryDTO.state!=null">
+                and state =#{voucherQueryDTO.state}
+            </if>
+            <if test="voucherQueryDTO.useScopes!=null and voucherQueryDTO.useScopes.size()>0">
+                and
+                <foreach collection="voucherQueryDTO.useScopes" item="item" open="(" close=")" separator=" or ">
+                    find_in_set(#{item},use_scope)
+                </foreach>
+            </if>
+            <if test="voucherQueryDTO.ifAvailable!=null">
+                <choose>
+                    <when test="voucherQueryDTO.ifAvailable.equals(true)">
+                        and (available_time &lt; now() or available_time is null)
+                    </when>
+                    <when test="voucherQueryDTO.ifAvailable.equals(false)">
+                        and available_time &gt; now()
+                    </when>
+                </choose>
+            </if>
+            <if test="voucherQueryDTO.ifExpiration!=null">
+                <choose>
+                    <when test="voucherQueryDTO.ifExpiration.equals(true)">
+                        and expiration_time &lt; now()
+
+                    </when>
+                    <when test="voucherQueryDTO.ifExpiration.equals(false)">
+                        and (expiration_time &gt; now() or expiration_time is null)
+                    </when>
+                </choose>
+            </if>
+
+            <if test="voucherQueryDTO.getWay!=null">
+             and   get_way=#{voucherQueryDTO.getWay}
+            </if>
+        </where>
+        order by create_time desc
+        <if test="voucherQueryDTO.current!=null and voucherQueryDTO.size!=null">
+            limit ${(voucherQueryDTO.current -1)*voucherQueryDTO.size},${voucherQueryDTO.size}
+        </if>
+
+    </select>
+
+    <select id="queryVoucherTotal" resultType="java.lang.Long">
+        select count(*) from voucher
+        <where>
+            <if test="voucherQueryDTO.state!=null">
+                and state =#{voucherQueryDTO.state}
+            </if>
+            <if test="voucherQueryDTO.useScopes!=null and voucherQueryDTO.useScopes.size()>0">
+                and
+                <foreach collection="voucherQueryDTO.useScopes" item="item" open="(" close=")" separator=" and ">
+                    find_in_set(#{item},use_scope)
+                </foreach>
+            </if>
+        </where>
+
+    </select>
+</mapper>