Quellcode durchsuchen

4/10 导入专利

lwhhszx vor 1 Jahr
Ursprung
Commit
75eb777bc0
37 geänderte Dateien mit 677 neuen und 76 gelöschten Zeilen
  1. 24 1
      src/main/java/com/example/xiaoshiweixinback/business/utils/ReadExcelUtils.java
  2. 33 0
      src/main/java/com/example/xiaoshiweixinback/controller/ImportPatentController.java
  3. 2 0
      src/main/java/com/example/xiaoshiweixinback/controller/LoginController.java
  4. 9 5
      src/main/java/com/example/xiaoshiweixinback/controller/PayController.java
  5. 0 2
      src/main/java/com/example/xiaoshiweixinback/domain/AssoPersonFunction.java
  6. 1 1
      src/main/java/com/example/xiaoshiweixinback/domain/AssoVipFunction.java
  7. 2 2
      src/main/java/com/example/xiaoshiweixinback/domain/Order.java
  8. 6 2
      src/main/java/com/example/xiaoshiweixinback/domain/Product.java
  9. 2 0
      src/main/java/com/example/xiaoshiweixinback/domain/SysFunction.java
  10. 1 1
      src/main/java/com/example/xiaoshiweixinback/domain/Ticket.java
  11. 1 1
      src/main/java/com/example/xiaoshiweixinback/domain/Vip.java
  12. 3 1
      src/main/java/com/example/xiaoshiweixinback/entity/product/ProductAddDTO.java
  13. 9 0
      src/main/java/com/example/xiaoshiweixinback/entity/sysFuctionRights/FunctionConfig.java
  14. 11 0
      src/main/java/com/example/xiaoshiweixinback/entity/vip/PersonFunctionVO.java
  15. 10 0
      src/main/java/com/example/xiaoshiweixinback/entity/vip/VipMessageVO.java
  16. 3 0
      src/main/java/com/example/xiaoshiweixinback/entity/vo/person/PersonVO.java
  17. 12 0
      src/main/java/com/example/xiaoshiweixinback/entity/weixinPay/FunctionRightVO.java
  18. 9 0
      src/main/java/com/example/xiaoshiweixinback/entity/weixinPay/VipRightsDTO.java
  19. 12 0
      src/main/java/com/example/xiaoshiweixinback/entity/weixinPay/VipRightsVO.java
  20. 5 1
      src/main/java/com/example/xiaoshiweixinback/mapper/AssoPersonFunctionMapper.java
  21. 5 1
      src/main/java/com/example/xiaoshiweixinback/mapper/AssoPersonVipMapper.java
  22. 9 6
      src/main/java/com/example/xiaoshiweixinback/mapper/AssoVipFunctionMapper.java
  23. 16 0
      src/main/java/com/example/xiaoshiweixinback/service/AssoPersonProductService.java
  24. 16 10
      src/main/java/com/example/xiaoshiweixinback/service/AssoPersonVipService.java
  25. 8 0
      src/main/java/com/example/xiaoshiweixinback/service/AssoVipFunctionService.java
  26. 11 3
      src/main/java/com/example/xiaoshiweixinback/service/LoginService.java
  27. 34 4
      src/main/java/com/example/xiaoshiweixinback/service/OrderService.java
  28. 11 0
      src/main/java/com/example/xiaoshiweixinback/service/SysFunctionService.java
  29. 145 7
      src/main/java/com/example/xiaoshiweixinback/service/VipService.java
  30. 4 5
      src/main/java/com/example/xiaoshiweixinback/service/importPatent/GetPatentPictureFromExcelService.java
  31. 84 0
      src/main/java/com/example/xiaoshiweixinback/service/importPatent/excel/GetPatentFromSzService.java
  32. 87 0
      src/main/java/com/example/xiaoshiweixinback/service/importPatent/excel/ImportProduct.java
  33. 8 7
      src/main/java/com/example/xiaoshiweixinback/service/weixinpay/AuthorizationService.java
  34. 24 16
      src/main/java/com/example/xiaoshiweixinback/service/weixinpay/WeixinPayService.java
  35. 27 0
      src/main/resources/mapper/AssoPersonFunctionMapper.xml
  36. 17 0
      src/main/resources/mapper/AssoPersonVipMapper.xml
  37. 16 0
      src/main/resources/mapper/AssoVipFunctionMapper.xml

+ 24 - 1
src/main/java/com/example/xiaoshiweixinback/business/utils/ReadExcelUtils.java

@@ -4,6 +4,7 @@ package com.example.xiaoshiweixinback.business.utils;
 import com.example.xiaoshiweixinback.service.importPatent.excel.PatentData;
 import org.apache.poi.hssf.usermodel.*;
 import org.apache.poi.ooxml.POIXMLDocumentPart;
+import org.apache.poi.openxml4j.opc.OPCPackage;
 import org.apache.poi.ss.usermodel.*;
 import org.apache.poi.xssf.usermodel.*;
 import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTMarker;
@@ -151,7 +152,7 @@ public class ReadExcelUtils {
 
             //读取第几个sheet
             sheet = workbook.getSheetAt(0);
-
+System.out.println("daoru");
             //关闭流
             inputStream.close();
 
@@ -276,6 +277,28 @@ public class ReadExcelUtils {
         }
         return cellId;
     }
+    public static List<PictureData> getPictures(XSSFSheet sheet, Integer row) throws IOException {
+        List<PictureData> pictureDatas=new ArrayList<>();
+        List<POIXMLDocumentPart> list = sheet.getRelations();
+        for (POIXMLDocumentPart part : list) {
+            if (part instanceof XSSFDrawing) {
+                XSSFDrawing drawing = (XSSFDrawing) part;
+                List<XSSFShape> shapes = drawing.getShapes();
+                for (XSSFShape shape : shapes) {
+                    //解决图片空指针报错问题 lig  2021-06-03
+                    XSSFClientAnchor anchor = (XSSFClientAnchor) shape.getAnchor();
+                    //XSSFClientAnchor anchor = picture.getPreferredSize();
+                    CTMarker marker = anchor.getFrom();
+                    int excelRow = marker.getRow();
+                    if (excelRow == row) {
+                        XSSFPicture picture = (XSSFPicture) shape;
+                        pictureDatas.add(picture.getPictureData());
+                    }
+                }
+            }
+        }
 
+        return pictureDatas;
+    }
 
 }

+ 33 - 0
src/main/java/com/example/xiaoshiweixinback/controller/ImportPatentController.java

@@ -0,0 +1,33 @@
+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.vip.ActiveVipDTO;
+import com.example.xiaoshiweixinback.entity.vip.PersonFunctionVO;
+import com.example.xiaoshiweixinback.entity.weixinPay.FunctionRightVO;
+import com.example.xiaoshiweixinback.service.VipService;
+import com.example.xiaoshiweixinback.service.importPatent.excel.GetPatentFromSzService;
+import io.swagger.v3.oas.annotations.Operation;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@Slf4j
+@RequestMapping(Constants.XIAOSHI_WEIXINBACK + "/importPatent")
+@RestController
+@RequiredArgsConstructor
+public class ImportPatentController {
+    private final VipService vipService;
+private final GetPatentFromSzService getPatentFromSzService;
+    @Operation(summary = "查询会员")
+    @GetMapping("/import")
+    private Response importPatent(String path) {
+        getPatentFromSzService.test(path);
+        return Response.success("records");
+    }
+
+
+}

+ 2 - 0
src/main/java/com/example/xiaoshiweixinback/controller/LoginController.java

@@ -8,6 +8,7 @@ import com.example.xiaoshiweixinback.entity.vo.person.LoginByWxVO;
 import com.example.xiaoshiweixinback.entity.vo.person.LoginVO;
 import com.example.xiaoshiweixinback.entity.vo.person.PersonVO;
 import com.example.xiaoshiweixinback.service.LoginService;
+import com.example.xiaoshiweixinback.service.VipService;
 import io.swagger.v3.oas.annotations.Operation;
 import jakarta.validation.Valid;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -82,6 +83,7 @@ public class LoginController {
         PersonVO personVO = null;
         try {
             personVO = loginService.selectPerson(vo);
+
         } catch (Exception e) {
             return Response.unLogin(e.getMessage());
         }

+ 9 - 5
src/main/java/com/example/xiaoshiweixinback/controller/PayController.java

@@ -7,6 +7,7 @@ import com.example.xiaoshiweixinback.business.common.base.Records;
 import com.example.xiaoshiweixinback.business.utils.JsonUtils;
 import com.example.xiaoshiweixinback.business.utils.LoginUtils;
 import com.example.xiaoshiweixinback.entity.weixinPay.*;
+import com.example.xiaoshiweixinback.service.OrderService;
 import com.example.xiaoshiweixinback.service.VipService;
 import com.example.xiaoshiweixinback.service.weixinpay.AuthorizationService;
 import com.example.xiaoshiweixinback.service.weixinpay.WeixinPayService;
@@ -27,21 +28,24 @@ public class PayController {
     private WeixinPayService weixinPayService;
     @Autowired
     private AuthorizationService authorizationService;
+    @Autowired
+    private OrderService orderService;
 
     @Operation(summary = "回调成功")
     @PostMapping("/success")
     private String success(@RequestBody WeiXinSuccessDTO weiXinSuccessDTO) throws IOException {
         try {
-            WeiXinSuccessDTO.Resource resource =weiXinSuccessDTO.getResource();
-         WeixinSuccessVO weixinSuccessVO=   authorizationService.decryptMessage(resource.getAssociated_data(),resource.getNonce(),resource.getCiphertext());
-     String re=  JSONObject.toJSONString(weixinSuccessVO);
-        System.out.println(re);
+            WeiXinSuccessDTO.Resource resource = weiXinSuccessDTO.getResource();
+            WeixinSuccessVO weixinSuccessVO = authorizationService.decryptMessage(resource.getAssociated_data(), resource.getNonce(), resource.getCiphertext());
+            String tradeNo = weixinSuccessVO.getOut_trade_no();
+
+            orderService.payBack(tradeNo);
         } catch (Exception e) {
             return "";
         }
 
 
-        return "body";
+        return "success";
     }
 
 

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

@@ -46,6 +46,4 @@ public class AssoPersonFunction extends BaseEntity<AssoPersonFunction> {
      */
     private String functionParameter;
 
-    @TableField(exist = false)
-    private static final long serialVersionUID = 1L;
 }

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

@@ -32,5 +32,5 @@ public class AssoVipFunction extends BaseEntity<AssoVipFunction> {
      */
     private String functionUuid;
     private String functionParameter;
-
+    private String description;
 }

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

@@ -43,7 +43,7 @@ public class Order extends BaseEntity<Order> {
     /**
      * 原始价格
      */
-    private Double orgPrice;
+    private Integer orgPrice;
 
     /**
      * 
@@ -53,7 +53,7 @@ public class Order extends BaseEntity<Order> {
     /**
      * 真实价格
      */
-    private Double truePrice;
+    private Integer truePrice;
 
     /**
      * 

+ 6 - 2
src/main/java/com/example/xiaoshiweixinback/domain/Product.java

@@ -47,12 +47,12 @@ public class Product extends BaseEntity<Product> {
     /**
      * 
      */
-    private Integer ifHot;
+    private Boolean ifHot;
 
     /**
      * 是否显示(上架)
      */
-    private Integer ifShow;
+    private Boolean ifShow;
 
     /**
      *  是否自定义
@@ -62,6 +62,9 @@ public class Product extends BaseEntity<Product> {
     private String bestSellingBrand;
     private Double price;
     private String platformLink;
+
+    private String competitorCom;
+    private String competitorLink;
     /**
      * 
      */
@@ -71,6 +74,7 @@ public class Product extends BaseEntity<Product> {
      * 
      */
     private DateTime createTime;
+    private String locNum;
 
 
 }

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

@@ -30,4 +30,6 @@ public class SysFunction extends BaseEntity<SysFunction> {
      */
     private String uuid;
 
+    private String description;
+
 }

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

@@ -38,7 +38,7 @@ public class Ticket extends BaseEntity<Ticket> {
      */
     private Date createTime;
 
-    private Double price;
+    private Integer price;
     private String num;
     private String contactPerson;
     private String contactPhone;

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

@@ -34,6 +34,6 @@ public class Vip extends BaseEntity<Vip> {
     private String name;
     private String vipUuid;
     private Integer lastTime;
-    private Double price;
+    private Integer price;
     private String configParameter;
 }

+ 3 - 1
src/main/java/com/example/xiaoshiweixinback/entity/product/ProductAddDTO.java

@@ -38,7 +38,9 @@ public class ProductAddDTO {
      */
     private String sellPlatform;
 
-
+    private String competitorCom;
+    private String competitorLink;
     private List<String> fileGuids;
+    private Integer concernType;
 
 }

+ 9 - 0
src/main/java/com/example/xiaoshiweixinback/entity/sysFuctionRights/FunctionConfig.java

@@ -0,0 +1,9 @@
+package com.example.xiaoshiweixinback.entity.sysFuctionRights;
+
+import lombok.Data;
+
+@Data
+public class FunctionConfig {
+    private Integer canGetNum;
+    private Integer size;
+}

+ 11 - 0
src/main/java/com/example/xiaoshiweixinback/entity/vip/PersonFunctionVO.java

@@ -0,0 +1,11 @@
+package com.example.xiaoshiweixinback.entity.vip;
+
+import lombok.Data;
+
+@Data
+public class PersonFunctionVO {
+    private  String name;
+    private String functionParameter;
+    private String description;
+    private Integer id;
+}

+ 10 - 0
src/main/java/com/example/xiaoshiweixinback/entity/vip/VipMessageVO.java

@@ -0,0 +1,10 @@
+package com.example.xiaoshiweixinback.entity.vip;
+
+import lombok.Data;
+
+@Data
+public class VipMessageVO {
+    private String name;
+    private String vipUuid;
+    private String expiryTime;
+}

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

@@ -1,5 +1,7 @@
 package com.example.xiaoshiweixinback.entity.vo.person;
 
+import com.example.xiaoshiweixinback.domain.Vip;
+import com.example.xiaoshiweixinback.entity.vip.VipMessageVO;
 import lombok.Data;
 
 
@@ -21,4 +23,5 @@ public class PersonVO {
     private String uuid;
 
     private String openId;
+   private VipMessageVO vip;
 }

+ 12 - 0
src/main/java/com/example/xiaoshiweixinback/entity/weixinPay/FunctionRightVO.java

@@ -0,0 +1,12 @@
+package com.example.xiaoshiweixinback.entity.weixinPay;
+
+import lombok.Data;
+
+import java.util.List;
+
+@Data
+public class FunctionRightVO {
+    private String functionName;
+
+    private List<VipRightsVO> vipRightsVOList;
+}

+ 9 - 0
src/main/java/com/example/xiaoshiweixinback/entity/weixinPay/VipRightsDTO.java

@@ -0,0 +1,9 @@
+package com.example.xiaoshiweixinback.entity.weixinPay;
+
+import lombok.Data;
+
+@Data
+public class VipRightsDTO {
+    private Integer goodType;
+    private String goodUuid;
+}

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

@@ -0,0 +1,12 @@
+package com.example.xiaoshiweixinback.entity.weixinPay;
+
+import lombok.Data;
+
+@Data
+public class VipRightsVO {
+   private String functionUuid;
+   private String  name;
+   private String description;
+   private String functionParameter;
+   private String vipUuid;
+}

+ 5 - 1
src/main/java/com/example/xiaoshiweixinback/mapper/AssoPersonFunctionMapper.java

@@ -2,6 +2,10 @@ package com.example.xiaoshiweixinback.mapper;
 
 import com.example.xiaoshiweixinback.domain.AssoPersonFunction;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.example.xiaoshiweixinback.domain.Person;
+import com.example.xiaoshiweixinback.entity.vip.PersonFunctionVO;
+
+import java.util.List;
 
 /**
 * @author admin
@@ -10,7 +14,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 * @Entity xiaoshiweixinback.domain.AssoPersonFunction
 */
 public interface AssoPersonFunctionMapper extends BaseMapper<AssoPersonFunction> {
-
+  List<PersonFunctionVO> getByPerson(String personUuid,String functionUuid);
 }
 
 

+ 5 - 1
src/main/java/com/example/xiaoshiweixinback/mapper/AssoPersonVipMapper.java

@@ -2,8 +2,12 @@ package com.example.xiaoshiweixinback.mapper;
 
 import com.example.xiaoshiweixinback.domain.AssoPersonVip;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.example.xiaoshiweixinback.entity.vip.PersonFunctionVO;
+import com.example.xiaoshiweixinback.entity.vip.VipMessageVO;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 /**
 * @author admin
 * @description 针对表【asso_person_vip(人员会员管理表)】的数据库操作Mapper
@@ -12,7 +16,7 @@ import org.springframework.stereotype.Repository;
 */
 @Repository
 public interface AssoPersonVipMapper extends BaseMapper<AssoPersonVip> {
-
+    VipMessageVO getByPerson(String personUuid);
 }
 
 

+ 9 - 6
src/main/java/com/example/xiaoshiweixinback/mapper/AssoVipFunctionMapper.java

@@ -2,17 +2,20 @@ package com.example.xiaoshiweixinback.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.example.xiaoshiweixinback.domain.AssoVipFunction;
+import com.example.xiaoshiweixinback.entity.weixinPay.VipRightsVO;
 import org.springframework.stereotype.Repository;
 
+import java.util.List;
+
 /**
-* @author admin
-* @description 针对表【asso_vip_function(vip功能关联表)】的数据库操作Mapper
-* @createDate 2024-04-10 21:35:25
-* @Entity xiaoshiweixinback.domain.AssoVipFunction
-*/
+ * @author admin
+ * @description 针对表【asso_vip_function(vip功能关联表)】的数据库操作Mapper
+ * @createDate 2024-04-10 21:35:25
+ * @Entity xiaoshiweixinback.domain.AssoVipFunction
+ */
 @Repository
 public interface AssoVipFunctionMapper extends BaseMapper<AssoVipFunction> {
-
+    public List<VipRightsVO> getAll();
 }
 
 

+ 16 - 0
src/main/java/com/example/xiaoshiweixinback/service/AssoPersonProductService.java

@@ -1,13 +1,16 @@
 package com.example.xiaoshiweixinback.service;
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 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.business.utils.ToolUtil;
+import com.example.xiaoshiweixinback.domain.AssoPersonFunction;
 import com.example.xiaoshiweixinback.domain.AssoPersonProduct;
 
 import com.example.xiaoshiweixinback.entity.dto.AssoPersonProductDTO;
+import com.example.xiaoshiweixinback.entity.sysFuctionRights.FunctionConfig;
 import com.example.xiaoshiweixinback.entity.vo.PersonnelVO;
 import com.example.xiaoshiweixinback.mapper.AssoPersonProductMapper;
 import lombok.RequiredArgsConstructor;
@@ -23,9 +26,22 @@ import org.springframework.stereotype.Service;
 @RequiredArgsConstructor
 public class AssoPersonProductService extends ServiceImpl<AssoPersonProductMapper, AssoPersonProduct> {
     private final CacheUtil cacheUtil;
+    private final VipService vipService;
 
     public Integer add(AssoPersonProductDTO assoPersonProductDTO) {
         PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
+        AssoPersonFunction assoPersonFunction = vipService.getAssoPersonFunction("6");
+        if (assoPersonFunction == null) {
+            return null;
+        }
+        FunctionConfig functionConfig = JSON.parseObject(assoPersonFunction.getFunctionParameter(), FunctionConfig.class);
+        //查看关注的数量
+        LambdaQueryWrapper<AssoPersonProduct> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(AssoPersonProduct::getPersonUuid, personnelVO.getUuid());
+        Long total = this.count(queryWrapper);
+        if (total >= functionConfig.getCanGetNum()) {
+            return null;
+        }
         if (ToolUtil.isNotEmpty(personnelVO)) {
             AssoPersonProduct assoPersonProduct = new AssoPersonProduct();
             BeanUtils.copyProperties(assoPersonProductDTO, assoPersonProduct);

+ 16 - 10
src/main/java/com/example/xiaoshiweixinback/service/AssoPersonVipService.java

@@ -21,25 +21,31 @@ import java.util.Date;
 @Service
 public class AssoPersonVipService extends ServiceImpl<AssoPersonVipMapper, AssoPersonVip> {
 
-    public Date getCreateTime(String personUuid) {
-        Date date = new Date();
+    public AssoPersonVip getAsso(String personUuid, Vip vip) {
+        AssoPersonVip assoPersonVip = new AssoPersonVip();
         LambdaQueryWrapper<AssoPersonVip> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(AssoPersonVip::getPersonUuid, personUuid)
-                .gt(AssoPersonVip::getExpiryTime, date)
+                .eq(AssoPersonVip::getVipUuid, vip.getVipUuid())
                 .orderByDesc(AssoPersonVip::getExpiryTime);
-        AssoPersonVip assoPersonVip = this.getOne(queryWrapper, false);
+        assoPersonVip = this.getOne(queryWrapper, false);
+
+        Date date = new Date();
         if (assoPersonVip != null) {
-            date = assoPersonVip.getExpiryTime();
+            if(assoPersonVip.getExpiryTime().compareTo(date)>0){
+               date=assoPersonVip.getExpiryTime();
+            }
+
         }
-        return date;
+        assoPersonVip = this.addAssoPersonVip(personUuid, vip,date);
+        return assoPersonVip;
     }
 
-    public AssoPersonVip addAssoPersonVip(String personUuid, Vip vip) {
-        Date date = this.getCreateTime(personUuid);
+    public AssoPersonVip addAssoPersonVip(String personUuid, Vip vip,Date createDate) {
+        Date date = createDate;
         AssoPersonVip assoPersonVip = new AssoPersonVip();
         assoPersonVip.setCreateTime(date);
-        Integer lastTime =vip.getLastTime();
-       Date expiryDate = DateUtils.getPlusMonthDate(date,lastTime);
+        Integer lastTime = vip.getLastTime();
+        Date expiryDate = DateUtils.getPlusMonthDate(date, lastTime);
         assoPersonVip.setExpiryTime(expiryDate);
         assoPersonVip.setVipUuid(vip.getVipUuid());
         assoPersonVip.setPersonUuid(personUuid);

+ 8 - 0
src/main/java/com/example/xiaoshiweixinback/service/AssoVipFunctionService.java

@@ -28,6 +28,14 @@ public class AssoVipFunctionService extends ServiceImpl<AssoVipFunctionMapper, A
     }
 
 
+    public List<AssoVipFunction> getAll() {
+        LambdaQueryWrapper<AssoVipFunction> queryWrapper = new LambdaQueryWrapper<>();
+        List<AssoVipFunction> assoVipFunctions = this.list(queryWrapper);
+        return assoVipFunctions;
+
+
+    }
+
 }
 
 

+ 11 - 3
src/main/java/com/example/xiaoshiweixinback/service/LoginService.java

@@ -16,12 +16,15 @@ import com.example.xiaoshiweixinback.business.redis.CacheTTLEnum;
 import com.example.xiaoshiweixinback.business.redis.RedisService;
 import com.example.xiaoshiweixinback.business.utils.*;
 import com.example.xiaoshiweixinback.domain.Person;
+import com.example.xiaoshiweixinback.domain.Vip;
 import com.example.xiaoshiweixinback.entity.dto.person.*;
+import com.example.xiaoshiweixinback.entity.vip.VipMessageVO;
 import com.example.xiaoshiweixinback.entity.vo.PersonnelVO;
 import com.example.xiaoshiweixinback.entity.vo.person.Jscode2SessionWo;
 import com.example.xiaoshiweixinback.entity.vo.person.LoginByWxVO;
 import com.example.xiaoshiweixinback.entity.vo.person.LoginVO;
 import com.example.xiaoshiweixinback.entity.vo.person.PersonVO;
+import com.example.xiaoshiweixinback.mapper.AssoPersonVipMapper;
 import com.example.xiaoshiweixinback.mapper.PersonMapper;
 import com.example.xiaoshiweixinback.okhttp.ResponseManager;
 import com.example.xiaoshiweixinback.service.common.SmsService;
@@ -71,7 +74,10 @@ public class LoginService {
     private PersonMapper personMapper;
     @Autowired
     private CacheUtil cacheUtil;
-
+    @Autowired
+    private VipService vipService;
+@Autowired
+private AssoPersonVipMapper assoPersonVipMapper;
     /**
      * 手机号/账号登录
      *
@@ -121,7 +127,7 @@ public class LoginService {
 //        redisService.set(AppCacheKeyUtil.getUserIdToken(loginVO.getId()), AppCacheKeyUtil.getTokenUserInfo(loginVO.getToken()));
         //将用户信息数据存入Redis
         PersonnelVO personnelVO = new PersonnelVO();
-        BeanUtil.copy(person,personnelVO);
+        BeanUtil.copy(person, personnelVO);
         cacheUtil.setLoginUser(personnelVO, loginVO.getToken());
         return loginVO;
     }
@@ -186,7 +192,7 @@ public class LoginService {
 //            redisService.set(AppCacheKeyUtil.getUserIdToken(wxVO.getId()), AppCacheKeyUtil.getTokenUserInfo(wxVO.getToken()));
             //将用户信息数据存入Redis
             PersonnelVO personnelVO = new PersonnelVO();
-            BeanUtil.copy(person,personnelVO);
+            BeanUtil.copy(person, personnelVO);
             cacheUtil.setLoginUser(personnelVO, wxVO.getToken());
         }
         return wxVO;
@@ -269,6 +275,8 @@ public class LoginService {
         Person person = personMapper.selectById(personnelVO.getId());
         PersonVO personVO = new PersonVO();
         BeanUtil.copy(person, personVO);
+      VipMessageVO vipMessageVO= assoPersonVipMapper.getByPerson(person.getUuid());
+        personVO.setVip(vipMessageVO);
         return personVO;
     }
 

+ 34 - 4
src/main/java/com/example/xiaoshiweixinback/service/OrderService.java

@@ -7,7 +7,9 @@ import com.example.xiaoshiweixinback.business.utils.BatchNoUtil;
 import com.example.xiaoshiweixinback.domain.AssoPersonProduct;
 
 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.vo.PersonnelVO;
 import com.example.xiaoshiweixinback.entity.vo.person.PersonVO;
 import com.example.xiaoshiweixinback.entity.weixinPay.GetPayTicketVO;
@@ -31,15 +33,18 @@ public class OrderService extends ServiceImpl<OrderMapper, Order> {
     @Lazy
     private VipService vipService;
 
+    @Autowired
+    private TicketService ticketService;
+
     @Transactional(rollbackFor = Exception.class)
-    public Order addOrder(WeiXinPayDTO weiXinPayDTO, GetPayTicketVO getPayTicketVO, JsApiDTO jsApiDTO, PersonnelVO personVO) {
+    public Order addOrder(WeiXinPayDTO weiXinPayDTO, GetPayTicketVO getPayTicketVO, String tradeNo, PersonnelVO personVO) {
         Integer type = weiXinPayDTO.getGoodType();
         String uuid = weiXinPayDTO.getGoodUuid();
 
 
         Order order = new Order();
         order.setOrderState(0);
-        order.setTradeNo(jsApiDTO.getOut_trade_no());
+        order.setTradeNo(tradeNo);
 
         String json = JSONObject.toJSONString(getPayTicketVO);
 
@@ -53,19 +58,44 @@ public class OrderService extends ServiceImpl<OrderMapper, Order> {
                 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.insert();
         return order;
     }
 
-
     public Order getOrderByTradeNo(String tradeNo) {
         LambdaQueryWrapper<Order> queryWrapper = new LambdaQueryWrapper<>();
         queryWrapper.eq(Order::getTradeNo, tradeNo);
         Order order = this.getOne(queryWrapper);
         return order;
+    }
 
+    public void payBack(String tradeNo) {
+        Order order = this.getOrderByTradeNo(tradeNo);
+        if(order.getOrderState()!=0){
+            return;
+        }
+        order.setOrderState(1);
+        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;
+        }
 
     }
 }

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

@@ -1,10 +1,14 @@
 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.SysFunction;
 import com.example.xiaoshiweixinback.mapper.SysFunctionMapper;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
+import java.util.List;
+
 /**
 * @author admin
 * @description 针对表【sys_function(功能)】的数据库操作Service实现
@@ -13,6 +17,13 @@ import org.springframework.stereotype.Service;
 @Service
 public class SysFunctionService extends ServiceImpl<SysFunctionMapper, SysFunction> {
 
+    public List<SysFunction> getAllFunction(){
+        List<SysFunction> sysFunctions =new ArrayList<>();
+        LambdaQueryWrapper<SysFunction> queryWrapper =new LambdaQueryWrapper<>();
+        sysFunctions =this.list(queryWrapper);
+        return sysFunctions;
+
+    }
 }
 
 

+ 145 - 7
src/main/java/com/example/xiaoshiweixinback/service/VipService.java

@@ -1,17 +1,30 @@
 package com.example.xiaoshiweixinback.service;
 
+import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.example.xiaoshiweixinback.business.common.base.Records;
+import com.example.xiaoshiweixinback.business.utils.CacheUtil;
+import com.example.xiaoshiweixinback.business.utils.LoginUtils;
 import com.example.xiaoshiweixinback.domain.*;
+import com.example.xiaoshiweixinback.entity.sysFuctionRights.FunctionConfig;
 import com.example.xiaoshiweixinback.entity.vip.ActiveVipDTO;
+import com.example.xiaoshiweixinback.entity.vip.PersonFunctionVO;
+import com.example.xiaoshiweixinback.entity.vo.PersonnelVO;
+import com.example.xiaoshiweixinback.entity.weixinPay.FunctionRightVO;
+import com.example.xiaoshiweixinback.entity.weixinPay.VipRightsDTO;
+import com.example.xiaoshiweixinback.entity.weixinPay.VipRightsVO;
 import com.example.xiaoshiweixinback.mapper.VipMapper;
+import jakarta.json.JsonObject;
+import org.eclipse.parsson.JsonUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * @author admin
@@ -29,6 +42,10 @@ public class VipService extends ServiceImpl<VipMapper, Vip> {
     private AssoPersonVipService assoPersonVipService;
     @Autowired
     private AssoPersonFunctionService assoPersonFunctionService;
+    @Autowired
+    private SysFunctionService sysFunctionService;
+    @Autowired
+    private CacheUtil cacheUtil;
 
     /**
      * 查询会员
@@ -38,7 +55,7 @@ public class VipService extends ServiceImpl<VipMapper, Vip> {
     public Records getAllVip() {
         Records records = new Records();
         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);
         queryWrapper.ne(Vip::getVipType, 0);
         List<Vip> vipList = this.list(queryWrapper);
         records.setData(vipList);
@@ -50,17 +67,14 @@ public class VipService extends ServiceImpl<VipMapper, Vip> {
         queryWrapper.eq(Vip::getVipUuid, uuid);
         Vip vip = this.getOne(queryWrapper);
         return vip;
-
     }
 
-
-    public void activateVIP(ActiveVipDTO activeVipDTO) {
-        String tradeNo = activeVipDTO.getTradeNo();
-        Order order = orderService.getOrderByTradeNo(tradeNo);
+    public void activateVIP(Order order) {
+        String tradeNo = order.getTradeNo();
         String uuid = order.getGoodUuid();
         String personUuId = order.getPersonUuid();
         Vip vip = this.getVipByUuId(uuid);
-        AssoPersonVip assoPersonVip = assoPersonVipService.addAssoPersonVip(personUuId, vip);
+        AssoPersonVip assoPersonVip = assoPersonVipService.getAsso(personUuId, vip);
         //查询vip相关权益
         List<AssoVipFunction> assoVipFunctions = assoVipFunctionService.getVipFunctionByVipUuid(uuid);
         //将权益赋值给人员
@@ -71,10 +85,134 @@ public class VipService extends ServiceImpl<VipMapper, Vip> {
             assoPersonFunction.setExpiryTime(assoPersonVip.getExpiryTime());
             assoPersonFunction.setCreateTime(assoPersonVip.getCreateTime());
             assoPersonFunction.setFunctionParameter(item.getFunctionParameter());
+            assoPersonFunction.setPersonUuid(personUuId);
             assoPersonFunctions.add(assoPersonFunction);
         });
         assoPersonFunctionService.saveBatch(assoPersonFunctions);
     }
+
+
+    public List<FunctionRightVO> getVipRights() {
+
+        List<FunctionRightVO> functionRightVOS = new ArrayList<>();
+        //查询所有功能
+        List<SysFunction> sysFunctions = sysFunctionService.getAllFunction();
+        //查询功能和vip的关联
+        List<VipRightsVO> vipRightsVOS = assoVipFunctionService.getBaseMapper().getAll();
+        //装载
+        for (SysFunction sysFunction : sysFunctions) {
+            List<VipRightsVO> temAssoes = vipRightsVOS.stream().filter(item -> item.getFunctionUuid().equals(sysFunction.getUuid())).collect(Collectors.toList());
+            temAssoes.forEach(item -> {
+                String parameter = item.getFunctionParameter();
+                FunctionConfig functionConfig = JSON.parseObject(parameter, FunctionConfig.class);
+                String description = this.replaceDescription(sysFunction.getDescription(), functionConfig);
+                item.setDescription(description);
+            });
+
+            FunctionRightVO functionRightVO = new FunctionRightVO();
+            functionRightVO.setFunctionName(sysFunction.getName());
+            functionRightVO.setVipRightsVOList(temAssoes);
+            functionRightVOS.add(functionRightVO);
+        }
+        return functionRightVOS;
+    }
+
+    private String replaceDescription(String description, FunctionConfig functionConfig) {
+        if (functionConfig.getSize() != null && functionConfig.getSize() != -1) {
+
+            description = description.replace("size", functionConfig.getSize().toString());
+        } else {
+            description = description.replace("size", "无限");
+        }
+
+
+        if (functionConfig.getCanGetNum() != null && functionConfig.getCanGetNum() != -1) {
+
+            description = description.replace("canGetNum", functionConfig.getCanGetNum().toString());
+        } else {
+            description = description.replace("canGetNum", "无限");
+        }
+
+        return description;
+    }
+
+    public List<PersonFunctionVO> getPersonRights() {
+
+        PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
+
+        List<PersonFunctionVO> personFunctionVOS = assoPersonFunctionService.getBaseMapper().getByPerson(personnelVO.getUuid(), null);
+        personFunctionVOS.forEach(item ->
+                {
+                    String parameter = item.getFunctionParameter();
+                    FunctionConfig functionConfig = JSON.parseObject(parameter, FunctionConfig.class);
+                    String description = this.replaceDescription(item.getDescription(), functionConfig);
+                    item.setDescription(description);
+                }
+
+
+        );
+
+
+        return personFunctionVOS;
+
+
+    }
+
+    public Vip getPersonVip() {
+        Vip vip = null;
+        PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
+        Date date = new Date();
+        LambdaQueryWrapper<AssoPersonVip> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(AssoPersonVip::getPersonUuid, personnelVO.getUuid())
+                .gt(AssoPersonVip::getExpiryTime, date)
+                .orderByDesc(AssoPersonVip::getExpiryTime);
+        List<AssoPersonVip> assoPersonVips = assoPersonVipService.list(queryWrapper);
+        List<String> personVipUUids = assoPersonVips.stream().map(AssoPersonVip::getVipUuid).collect(Collectors.toList());
+        ;
+        if (personVipUUids.size() != 0) {
+            LambdaQueryWrapper<Vip> queryWrapper1 = new LambdaQueryWrapper<>();
+            queryWrapper1.in(Vip::getVipUuid, personVipUUids);
+            queryWrapper1.orderByDesc(Vip::getVipType);
+            vip = this.getOne(queryWrapper1, false);
+        }
+
+        return vip;
+    }
+
+
+    public Vip getLastHighVip() {
+        Vip vip = null;
+        PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
+        Date date = new Date();
+        LambdaQueryWrapper<AssoPersonVip> queryWrapper = new LambdaQueryWrapper<>();
+        queryWrapper.eq(AssoPersonVip::getPersonUuid, personnelVO.getUuid())
+                .gt(AssoPersonVip::getExpiryTime, date)
+                .orderByDesc(AssoPersonVip::getExpiryTime);
+        List<AssoPersonVip> assoPersonVips = assoPersonVipService.list(queryWrapper);
+        List<String> personVipUUids = assoPersonVips.stream().map(AssoPersonVip::getVipUuid).collect(Collectors.toList());
+
+        if (personVipUUids.size() != 0) {
+            LambdaQueryWrapper<Vip> queryWrapper1 = new LambdaQueryWrapper<>();
+            queryWrapper1.in(Vip::getVipUuid, personVipUUids);
+            queryWrapper1.orderByDesc(Vip::getVipType);
+            vip = this.getOne(queryWrapper1, false);
+        }
+
+        return vip;
+    }
+
+    public AssoPersonFunction getAssoPersonFunction(String functionUuid) {
+        AssoPersonFunction assoPersonFunction = null;
+        PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
+
+        List<PersonFunctionVO> personFunctionVOS = assoPersonFunctionService.getBaseMapper().getByPerson(personnelVO.getUuid(), functionUuid);
+        if (personFunctionVOS != null && personFunctionVOS.size() > 0) {
+            Integer id = personFunctionVOS.get(0).getId();
+            assoPersonFunction = assoPersonFunctionService.getById(id);
+        }
+
+        return assoPersonFunction;
+    }
 }
 
 

+ 4 - 5
src/main/java/com/example/xiaoshiweixinback/service/importPatent/GetPatentPictureFromExcelService.java

@@ -43,7 +43,7 @@ public class GetPatentPictureFromExcelService {
                 byte[] data = pictureData.getData();
                 String picName = IdUtil.simpleUUID();
                 File file = FileUtils.getFileByBytes(data, picName, "." + ext);
-                this.tem(file, uploadPatentWebDTO, 0);
+                this.tem(file, uploadPatentWebDTO.getPatent(), 0);
             }
         } catch (Exception e) {
 
@@ -52,10 +52,9 @@ public class GetPatentPictureFromExcelService {
 
     }
 
-    private void tem(File file, UploadPatentWebDTO uploadPatentWebDTO, Integer i) throws Exception {
-        Patent patent = uploadPatentWebDTO.getPatent();
-        String guid = FormatUtil.getPictureFormat(uploadPatentWebDTO.getPatent().getAppNo()) + i;
-        fileManagerService.uploadFileWithGuid(file, guid);
+    public void tem(File file, Patent patent, Integer i) throws Exception {
+        String guid = FormatUtil.getPictureFormat(patent.getAppNo()) + i;
+            fileManagerService.uploadFileWithGuid(file, guid);
         PatentVector patentVectorOrg = esService.getVectorByIndex(patent.getAppNo(), i);
         if (patentVectorOrg != null) {
             return;

+ 84 - 0
src/main/java/com/example/xiaoshiweixinback/service/importPatent/excel/GetPatentFromSzService.java

@@ -0,0 +1,84 @@
+package com.example.xiaoshiweixinback.service.importPatent.excel;
+
+import cn.hutool.core.util.IdUtil;
+import com.example.xiaoshiweixinback.business.utils.ExcelUtils;
+import com.example.xiaoshiweixinback.business.utils.FileUtils;
+import com.example.xiaoshiweixinback.business.utils.FormatUtil;
+import com.example.xiaoshiweixinback.business.utils.ReadExcelUtils;
+import com.example.xiaoshiweixinback.domain.AssoProductFile;
+import com.example.xiaoshiweixinback.domain.Product;
+import com.example.xiaoshiweixinback.domain.es.Patent;
+import com.example.xiaoshiweixinback.domain.es.PatentVector;
+import com.example.xiaoshiweixinback.entity.dto.importTaskModel.ImportTaskText;
+import com.example.xiaoshiweixinback.entity.dto.patent.UploadPatentWebDTO;
+import com.example.xiaoshiweixinback.service.importPatent.GetPatentFromExcelService;
+import com.example.xiaoshiweixinback.service.importPatent.GetPatentPictureFromExcelService;
+import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.ss.usermodel.Drawing;
+import org.apache.poi.ss.usermodel.PictureData;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class GetPatentFromSzService {
+@Autowired
+private ExcuteUploadSettingService excuteUploadSettingService;
+@Autowired
+private GetPatentFromExcelService getPatentFromExcelService;
+@Autowired
+private GetPatentPictureFromExcelService getPatentPictureFromExcelService;
+    public void test(String path) {
+        try {
+            File tempFile = new File("D:\\usa_patent\\202101-2380\\"+path);
+
+            Sheet sheet = ReadExcelUtils.readExcel(tempFile);
+            int total = sheet.getPhysicalNumberOfRows() - 1;
+            Row firstRow = sheet.getRow(0);
+            int columns = firstRow.getLastCellNum();
+
+            List<UploadSettingVO.Column> jsonData = excuteUploadSettingService.ExcuteUploadSetting(5+"");
+
+            for (int r = 0; r < total; r++) {
+                Row needRow = sheet.getRow(r + 1);
+                Map<Object, Object> map = new HashMap<>();
+                for (int i = 0; i < columns; i++) {
+                    map.put(firstRow.getCell(i) + "", ExcelUtils.getValue(needRow.getCell(i)) + "");
+                }
+                UploadParamsVO uploadParamsVO = UploadPatentBatchUtil.processData(map,jsonData);
+                getPatentFromExcelService.loadPatent(uploadParamsVO);
+
+                List<PictureData> pictureDatas = ReadExcelUtils.getPictures((XSSFSheet) sheet, r + 1);
+
+                    for(int i=0;i<pictureDatas.size();i++) {
+                        PictureData pictureData  =pictureDatas.get(i);
+                        String ext = pictureData.suggestFileExtension();
+                        byte[] data = pictureData.getData();
+                        String picName = IdUtil.simpleUUID();
+                        File file = FileUtils.getFileByBytes(data, picName, "." + ext);
+                        getPatentPictureFromExcelService.tem(file, uploadParamsVO.getPatent(),i);
+                    }
+
+            }
+
+
+            //获得总列数
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+
+
+    }
+
+
+
+
+}

+ 87 - 0
src/main/java/com/example/xiaoshiweixinback/service/importPatent/excel/ImportProduct.java

@@ -0,0 +1,87 @@
+package com.example.xiaoshiweixinback.service.importPatent.excel;
+
+import cn.hutool.core.util.IdUtil;
+import com.example.xiaoshiweixinback.business.utils.ExcelUtils;
+import com.example.xiaoshiweixinback.business.utils.FileUtils;
+import com.example.xiaoshiweixinback.business.utils.ReadExcelUtils;
+import com.example.xiaoshiweixinback.business.utils.RedisUtil;
+import com.example.xiaoshiweixinback.domain.AssoProductFile;
+import com.example.xiaoshiweixinback.domain.Product;
+import com.example.xiaoshiweixinback.service.AssoProductFileService;
+import com.example.xiaoshiweixinback.service.ProductService;
+import com.example.xiaoshiweixinback.service.common.FileManagerService;
+import org.apache.poi.hssf.usermodel.HSSFSheet;
+import org.apache.poi.ss.usermodel.PictureData;
+import org.apache.poi.ss.usermodel.Row;
+import org.apache.poi.ss.usermodel.Sheet;
+import org.apache.poi.xssf.usermodel.XSSFSheet;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
+@Service
+public class ImportProduct {
+
+    @Autowired
+    private ProductService productService;
+
+    @Autowired
+    private FileManagerService fileManagerService;
+    @Autowired
+    private AssoProductFileService assoProductFileService;
+    public void importProject() {
+        try {
+            File tempFile = new File("C:\\Users\\admin\\Desktop\\exce\\product.xlsx");
+
+            Sheet sheet = ReadExcelUtils.readExcel(tempFile);
+            for (int i = 2; i < 80; i++) {
+                PatentData patentData = ReadExcelUtils.readExcelOneRow(tempFile, sheet, i);
+                Map<Object, Object> map = patentData.getMap();
+                Object o = map.get("序号");
+                System.out.println(o);
+                if (map.get("序号").equals("")) {
+                    continue;
+                }
+                PictureData pictureData = patentData.getPictureData();
+
+                String ext = pictureData.suggestFileExtension();
+                byte[] data = pictureData.getData();
+                String picName = IdUtil.simpleUUID();
+                File file = FileUtils.getFileByBytes(data, picName, "." + ext);
+        String c =   fileManagerService.uploadFileWithGuid(file,picName);
+Product product =this.loadProduct(map);
+product.insert();
+                AssoProductFile assoProductFile =new AssoProductFile();
+                assoProductFile.setProductId(product.getId());
+                assoProductFile.setFileGuid(picName);
+                assoProductFile.insert();
+            }
+        } catch (Exception e) {
+        }
+
+
+    }
+
+    private Product loadProduct(Map<Object,Object> map){
+         Product product =new Product();
+         product.setName(map.get("产品名称").toString());
+         product.setSearchCondition(map.get("关键词").toString());
+         product.setSourceFrom(map.get("卖家").toString());
+         product.setSellPlatform(map.get("网站名").toString());
+         product.setIfHot(true);
+         product.setIfCustomized(false);
+         product.setBestSellingBrand(map.get("销冠品牌").toString());
+         String p =map.get("金额").toString().replace("$","");
+       Double price =  Double.parseDouble(p);
+         product.setPrice(price);
+         product.setPlatformLink(map.get("产品网页链接").toString());
+        product.setLocNum(map.get("LOC分类号").toString());
+        return product;
+    }
+
+}

+ 8 - 7
src/main/java/com/example/xiaoshiweixinback/service/weixinpay/AuthorizationService.java

@@ -12,6 +12,7 @@ import org.bouncycastle.asn1.pkcs.PrivateKeyInfo;
 import org.bouncycastle.jce.provider.BouncyCastleProvider;
 import org.bouncycastle.openssl.PEMParser;
 import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import javax.crypto.SecretKey;
@@ -36,8 +37,8 @@ public class AuthorizationService {
     /**
      * 商户API私钥路径
      */
-
-    public static String privateKeyPath = "C:\\Users\\admin\\Desktop\\小程序证书\\1673179188_20240408_cert\\apiclient_key.pem";
+    @Value("${Keypath}")
+    public  String privateKeyPath ;
 
     /**
      * 商户证书序列号
@@ -176,13 +177,13 @@ public class AuthorizationService {
     }
 
     public WeixinSuccessVO decryptMessage(String associatedData, String nonce, String ciphertext) throws Exception {
-      Integer q=  apiV3key.length();
-      System.out.println(q);
-      String key ="wL3g4tAlOFe72gAd1THRqNPQsHIVxsYi";
+        Integer q = apiV3key.length();
+        System.out.println(q);
+        String key = "wL3g4tAlOFe72gAd1THRqNPQsHIVxsYi";
         AesUtil aesUtil = new AesUtil(key.getBytes(StandardCharsets.UTF_8));
-        String d = aesUtil.decryptToString(associatedData.getBytes(StandardCharsets.UTF_8), nonce.getBytes(StandardCharsets.UTF_8),ciphertext);
+        String d = aesUtil.decryptToString(associatedData.getBytes(StandardCharsets.UTF_8), nonce.getBytes(StandardCharsets.UTF_8), ciphertext);
 
-       WeixinSuccessVO weixinSuccessVO= JSONObject.parseObject(d,WeixinSuccessVO.class);
+        WeixinSuccessVO weixinSuccessVO = JSONObject.parseObject(d, WeixinSuccessVO.class);
         return weixinSuccessVO;
 
     }

+ 24 - 16
src/main/java/com/example/xiaoshiweixinback/service/weixinpay/WeixinPayService.java

@@ -6,6 +6,7 @@ import com.example.xiaoshiweixinback.business.utils.BatchNoUtil;
 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.Order;
 import com.example.xiaoshiweixinback.entity.vo.PersonnelVO;
 import com.example.xiaoshiweixinback.entity.weixinPay.GetAuthorizationVO;
 import com.example.xiaoshiweixinback.entity.weixinPay.GetPayTicketVO;
@@ -50,21 +51,11 @@ public class WeixinPayService {
     public GetPayTicketVO getPayTickets(WeiXinPayDTO weiXinPayDTO) throws Exception {
         GetPayTicketVO getPayTicketVO = new GetPayTicketVO();
         String url = "https://api.mch.weixin.qq.com/v3/pay/transactions/jsapi";
-        JsApiDTO jsApiDTO = new JsApiDTO();
-        jsApiDTO.setAppid(appId);
-        jsApiDTO.setDescription("会员");
-        jsApiDTO.setMchid(merchantId);
         String tradeNo = BatchNoUtil.getOrderNo();
-        jsApiDTO.setOut_trade_no(tradeNo);
-        JsApiDTO.Amount amount = new JsApiDTO.Amount();
-        amount.setCurrency("CNY");
-        amount.setTotal(1);
-        jsApiDTO.setAmount(amount);
-        JsApiDTO.Payer payer = new JsApiDTO.Payer();
-        jsApiDTO.setNotify_url("https://xsip.cn/xiaoshi-weixinback/weixinpay/success");
         PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
-        payer.setOpenid(personnelVO.getOpenId());
-        jsApiDTO.setPayer(payer);
+        Order order = orderService.addOrder(weiXinPayDTO, getPayTicketVO, tradeNo, personnelVO);
+        JsApiDTO jsApiDTO = this.loadJsApiDTO(order, tradeNo);
+
         OkHttpClient okHttpClient = new OkHttpClient();
         String param = new Gson().toJson(jsApiDTO);
         GetAuthorizationVO authorizationVO = authorizationService.getAuthorization("POST", "/v3/pay/transactions/jsapi", param);
@@ -88,9 +79,7 @@ public class WeixinPayService {
                 String a = Objects.requireNonNull(response.body()).string();
                 JSONObject jsonObject = JSONObject.parseObject(a);
                 getPayTicketVO.setPrepayId(jsonObject.get("prepay_id").toString());
-
-                orderService.addOrder(weiXinPayDTO,getPayTicketVO,jsApiDTO,personnelVO);
-                GetAuthorizationVO authorizationVO1=    authorizationService.getFrontAuthorization(getPayTicketVO.getPrepayId());
+                GetAuthorizationVO authorizationVO1 = authorizationService.getFrontAuthorization(getPayTicketVO.getPrepayId());
                 getPayTicketVO.setTimestamp(authorizationVO1.getTimestamp());
                 getPayTicketVO.setNonceStr(authorizationVO1.getNonceStr());
                 getPayTicketVO.setSignature(authorizationVO1.getSignature());
@@ -104,4 +93,23 @@ public class WeixinPayService {
     }
 
 
+    private JsApiDTO loadJsApiDTO(Order order, String tradeNo) {
+        JsApiDTO jsApiDTO = new JsApiDTO();
+        jsApiDTO.setAppid(appId);
+        jsApiDTO.setDescription("会员");
+        jsApiDTO.setMchid(merchantId);
+        jsApiDTO.setOut_trade_no(tradeNo);
+        JsApiDTO.Amount amount = new JsApiDTO.Amount();
+        amount.setCurrency("CNY");
+        amount.setTotal(order.getTruePrice());
+        jsApiDTO.setAmount(amount);
+        JsApiDTO.Payer payer = new JsApiDTO.Payer();
+        jsApiDTO.setNotify_url("https://xsip.cn/xiaoshi-weixinback/weixinpay/success");
+        PersonnelVO personnelVO = cacheUtil.getLoginUser(LoginUtils.getToken());
+        payer.setOpenid(personnelVO.getOpenId());
+        jsApiDTO.setPayer(payer);
+
+        return jsApiDTO;
+    }
+
 }

+ 27 - 0
src/main/resources/mapper/AssoPersonFunctionMapper.xml

@@ -0,0 +1,27 @@
+<?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.AssoPersonFunctionMapper">
+
+    <select id="getByPerson" resultType="com.example.xiaoshiweixinback.entity.vip.PersonFunctionVO">
+        select * from ( select
+        apf.id as id,
+        sf.name as name,
+        apf.function_parameter as functionParameter,
+        sf.description as description,
+        apf.function_uuid
+        from asso_person_function as apf
+        left join sys_function as sf on apf.function_uuid = sf.uuid
+        <where>
+            apf.person_uuid = #{personUuid}
+            and apf.expiry_time > now()
+            <if test="functionUuid!=null">
+                and apf.function_uuid =#{functionUuid}
+            </if>
+            order by apf.vip_type desc, apf.expiry_time asc
+            ) as a
+            group by a.function_uuid
+        </where>
+    </select>
+
+
+</mapper>

+ 17 - 0
src/main/resources/mapper/AssoPersonVipMapper.xml

@@ -0,0 +1,17 @@
+<?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.AssoPersonVipMapper">
+
+    <select id="getByPerson" resultType="com.example.xiaoshiweixinback.entity.vip.VipMessageVO">
+        select v.name          as name,
+               v.vip_uuid      as vipUuid,
+               apv.expiry_time as expiryTime
+        from asso_person_vip as apv
+                 left join vip as v on apv.vip_uuid = v.vip_uuid
+        where apv.person_uuid = #{personUuid}
+          and apv.expiry_time > now()
+        order by v.vip_type desc, apv.expiry_time desc limit 1
+    </select>
+
+
+</mapper>

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

@@ -0,0 +1,16 @@
+<?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>