Parcourir la source

更新库内自采接口

ccj il y a 3 ans
Parent
commit
da5b62212d
35 fichiers modifiés avec 1069 ajouts et 138 suppressions
  1. 3 3
      pom.xml
  2. 17 39
      winsea-haixin-platform-backend/src/main/java/com/yh/saas/platform/controller/AppendixController.java
  3. 5 5
      winsea-haixin-platform-backend/src/main/resources/application-local.yml
  4. 2 1
      winsea-haixin-platform-backend/src/main/resources/application-prod.yml
  5. 14 0
      winsea-haixin-plugin-yiliangyiyun/pom.xml
  6. 5 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/constant/StatusEnum.java
  7. 39 2
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/IdentityAuthenticationInfoController.java
  8. 45 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/PurchasePriceController.java
  9. 21 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/PurchasePriceDetailController.java
  10. 21 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/PurchasePriceDetailPrintController.java
  11. 43 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/CommonCompanyIdentity.java
  12. 99 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/PurchasePrice.java
  13. 63 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/PurchasePriceDetail.java
  14. 71 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/PurchasePriceDetailPrint.java
  15. 5 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/WarehouseBaseInfo.java
  16. 16 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/CommonCompanyIdentityMapper.java
  17. 19 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/IdentityAuthenticationInfoMapper.java
  18. 16 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/PurchasePriceDetailMapper.java
  19. 16 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/PurchasePriceDetailPrintMapper.java
  20. 34 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/PurchasePriceMapper.java
  21. 16 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/ICommonCompanyIdentityService.java
  22. 16 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IIdentityAuthenticationInfoService.java
  23. 16 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IPurchasePriceDetailPrintService.java
  24. 16 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IPurchasePriceDetailService.java
  25. 30 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IPurchasePriceService.java
  26. 62 87
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/IdentityAuthenticationInfoServiceImpl.java
  27. 20 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/PurchasePriceDetailPrintServiceImpl.java
  28. 20 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/PurchasePriceDetailServiceImpl.java
  29. 97 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/PurchasePriceServiceImpl.java
  30. 101 0
      winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/util/QRCodeUtil.java
  31. 5 0
      winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/CommonCompanyIdentityMapper.xml
  32. 56 1
      winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/IdentityAuthenticationInfoMapper.xml
  33. 5 0
      winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/PurchasePriceDetailMapper.xml
  34. 5 0
      winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/PurchasePriceDetailPrintMapper.xml
  35. 50 0
      winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/PurchasePriceMapper.xml

+ 3 - 3
pom.xml

@@ -184,9 +184,6 @@
             <properties>
                 <env>local</env>
             </properties>
-            <activation>
-                <activeByDefault>true</activeByDefault>
-            </activation>
         </profile>
         <profile>
             <id>dev</id>
@@ -205,6 +202,9 @@
             <properties>
                 <env>prod</env>
             </properties>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
         </profile>
     </profiles>
     <build>

+ 17 - 39
winsea-haixin-platform-backend/src/main/java/com/yh/saas/platform/controller/AppendixController.java

@@ -104,10 +104,6 @@ public class AppendixController implements InitializingBean {
     @GetMapping("/query/getFileList")
     public List<CommonAppendix> getFileList(@RequestParam String appendixIds) {
         List<CommonAppendix> list = appendixService.selectBatchIds(Arrays.asList(appendixIds.split(",")));
-        if (isOssUsed) {
-            addPrefix(list);
-        }
-
         return list;
     }
 
@@ -222,55 +218,23 @@ public class AppendixController implements InitializingBean {
             return null;
         }
         String companyId = request.getParameter("companyId");
-        String modelId = request.getParameter("modelId");
-        String vesselId = request.getParameter("vesselId");
         for (MultipartFile file : files) {
             String fileName = file.getOriginalFilename();
             fileName = fileName.substring(0, fileName.lastIndexOf("."));
-            StringBuilder filePathSb = new StringBuilder();
-            filePathSb.append("saas");
-            filePathSb.append(FILE_SEPERATOR);
-            filePathSb.append(companyId);
-            // 添加船舶ID
-            if (StringUtils.isNotBlank(vesselId)) {
-                filePathSb.append(FILE_SEPERATOR);
-                filePathSb.append(vesselId);
-            }
-            filePathSb.append(FILE_SEPERATOR);
-            filePathSb.append(modelId);
-            filePathSb.append(FILE_SEPERATOR);
-            filePathSb.append("{0}");
-            filePathSb.append("-");
-            filePathSb.append(DateUtils.formatDate(new Date(), DateUtils.DATE_FMT_DATETIME));
-            // 添加后缀
-            filePathSb.append(file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")));
-//            File dest = new File(fileRootPath + MessageFormat.format(filePathSb.toString(), fileName));
-//            if (!dest.getParentFile().exists()) { // 判断文件父目录是否存在
-//                dest.getParentFile().mkdirs();
-//            }
             try {
-//                Streams.copy(file.getInputStream(), new FileOutputStream(dest), true);
-                ObjectMetadata objectMetadata = new ObjectMetadata();
-                objectMetadata.setContentLength(file.getSize());
-                objectMetadata.setContentType(file.getContentType());
-                String ext = FilenameUtils.getExtension(file.getOriginalFilename());
-                String uuid = GeneratorUtil.genFileName();
-                PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, "eliangeyun/" + uuid+"."+ext, file.getInputStream(), objectMetadata);
-                ossClient.putObject(putObjectRequest);
                 CommonAppendix appendix = new CommonAppendix();
                 appendix.setAppendixName(
                         fileName + file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")));
-                String path = baseUrl + "eliangeyun/" + uuid +"."+ext;
-                appendix.setAppendixPath(path.replace("+", "%20"));
+                String path = upload(file,file.getOriginalFilename(),companyId);
+                appendix.setAppendixPath(path);
                 int size = (int) file.getSize();
                 appendix.setAppendixSize(GtAppendixUtil.getFileSize(size));
                 log.info("文件上传成功 地址:", path);
                 return appendix;
             } catch (Exception e) {
-                log.error("文件上传失败", e);
+                log.error("文件上传失败", e.toString());
             }
             finally {
-
 //                dest.delete();
             }
         }
@@ -371,4 +335,18 @@ public class AppendixController implements InitializingBean {
                     .forEach(appendix -> appendix.setAppendixPath(prefixUrl + appendix.getAppendixPath()));
         }
     }
+    /**
+     * 后台通过服务器间接传文件
+     * @param file
+     * @return
+     * @throws IOException
+     */
+    public  String upload(MultipartFile file,String name,String companyId) throws IOException {
+        ObjectMetadata objectMetadata = new ObjectMetadata();
+        objectMetadata.setContentLength(file.getSize());
+        objectMetadata.setContentType(file.getContentType());
+        PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, "eliangeyun/"+companyId+"/" +name, file.getInputStream(), objectMetadata);
+        ossClient.putObject(putObjectRequest);
+        return baseUrl + "eliangeyun/" +companyId+"/" +name;
+    }
 }

+ 5 - 5
winsea-haixin-platform-backend/src/main/resources/application-local.yml

@@ -48,13 +48,13 @@ logging:
 oss:
   access:
     key:
-      id: Y8IZ2bDqwsFDLqM0
-      secret: GX34icMi6crTpF3IW31hv2CMTnpEO4
+      id: LTAI4G9c14PgKvM23WZ9zrpc
+      secret: FpClTp4OVrRRtHEfi3lBOWUoLxKieW
   bucket:
-    name: winsea-saas-test
+    name: taohaoliang
   endpoint:
-    default: oss-cn-shanghai.aliyuncs.com
-    internal: http://oss-cn-shanghai.aliyuncs.com
+    default: oss-cn-beijing.aliyuncs.com
+    internal: https://taohaoliang.oss-cn-beijing.aliyuncs.com/
 po:
   password: CA1XB-MF7Y-12ST-PSBP2
   syspath: E://officeTest//

+ 2 - 1
winsea-haixin-platform-backend/src/main/resources/application-prod.yml

@@ -54,7 +54,8 @@ oss:
     name: taohaoliang
   endpoint:
     default: oss-cn-beijing.aliyuncs.com
-    internal: http://oss-cn-beijing.aliyuncs.com
+    internal: https://taohaoliang.oss-cn-beijing.aliyuncs.com/
+
 po:
   password: CA1XB-MF7Y-12ST-PSBP2
   syspath: E://officeTest//

+ 14 - 0
winsea-haixin-plugin-yiliangyiyun/pom.xml

@@ -53,6 +53,20 @@
             <artifactId>restful-sdk</artifactId>
             <version>1.0.0.1</version>
         </dependency>
+        <dependency>
+            <groupId>com.google.zxing</groupId>
+            <artifactId>core</artifactId>
+            <version>3.3.0</version>
+        </dependency>
+        <dependency>
+            <groupId>com.google.zxing</groupId>
+            <artifactId>javase</artifactId>
+            <version>3.3.0</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-test</artifactId>
+        </dependency>
     </dependencies>
 
 

+ 5 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/constant/StatusEnum.java

@@ -111,6 +111,11 @@ public enum StatusEnum {
     TO_BE_REVIEWED("1", "待审核", ""),
     PASSED_COMP("3", "已通过", ""),
     FAIL_COMP("5", "未通过", ""),
+
+    //收购价格状态
+    PURCHASE_REVIEWED("1", "审核中", "reviewed"),
+    PURCHASE_COMPLETED("3", "已通过", "passed"),
+    PURCHASE_FAILED("4", "已驳回", "failed"),
     ;
     @Getter
     private String flag;

+ 39 - 2
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/IdentityAuthenticationInfoController.java

@@ -8,6 +8,7 @@ import com.yh.saas.plugin.yiliangyiyun.entity.WarehouseInOutInfo;
 import com.yh.saas.plugin.yiliangyiyun.exception.AppServiceException;
 import com.yh.saas.plugin.yiliangyiyun.exception.ServiceException;
 import com.yh.saas.plugin.yiliangyiyun.service.IIdentityAuthenticationInfoService;
+import com.yh.saas.plugin.yiliangyiyun.util.QRCodeUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.PostMapping;
@@ -31,7 +32,8 @@ public class IdentityAuthenticationInfoController {
 
     @Autowired
     private IIdentityAuthenticationInfoService iIdentityAuthenticationInfoService;
-
+    @Autowired
+    private QRCodeUtil qrCodeUtil ;
     /**
      * 粮商认证列表
      * @param identityAuthenticationInfo
@@ -147,6 +149,41 @@ public class IdentityAuthenticationInfoController {
     public IdentityAuthenticationInfo selectPhone(IdentityAuthenticationInfo identityAuthenticationInfo) throws AppServiceException {
         return iIdentityAuthenticationInfoService.selectPhone(identityAuthenticationInfo);
     }
-
+    /**
+     * 库内自采客户管理获取二维码
+     * @param identityAuthenticationInfo
+     * @return
+     */
+    @GetMapping("/generateQRCodeImage")
+    public String generateQRCodeImage(IdentityAuthenticationInfo identityAuthenticationInfo) {
+        return qrCodeUtil.generateQRCodeImage(identityAuthenticationInfo.getCompId(),100,100,"company",identityAuthenticationInfo.getCompId());
+    }
+    /**
+     * 手机端扫码成为公司客户
+     * @param identityAuthenticationInfo
+     * @return
+     */
+    @GetMapping("/saveCompanyIdentity")
+    public String scanCode(IdentityAuthenticationInfo identityAuthenticationInfo) {
+        return iIdentityAuthenticationInfoService.saveCompanyIdentity(identityAuthenticationInfo);
+    }
+    /**
+     * 库内自采客户管理列表PC端
+     * @param identityAuthenticationInfo
+     * @return
+     */
+    @GetMapping("/selectIdentityAuthenticationInfoPurchase")
+    public Page<IdentityAuthenticationInfo> selectIdentityAuthenticationInfoPurchase(IdentityAuthenticationInfo identityAuthenticationInfo) {
+        return iIdentityAuthenticationInfoService.selectIdentityAuthenticationInfoPurchase(identityAuthenticationInfo);
+    }
+    /**
+     * 库内自采客户管理删除身份认证
+     *  @param identityAuthenticationInfo
+     * @return
+     */
+    @PostMapping("/api/deleteCompanyIdentity")
+    public void deleteCompanyIdentity(@RequestBody IdentityAuthenticationInfo identityAuthenticationInfo) {
+        iIdentityAuthenticationInfoService.deleteCompanyIdentity(identityAuthenticationInfo);
+    }
 }
 

+ 45 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/PurchasePriceController.java

@@ -0,0 +1,45 @@
+package com.yh.saas.plugin.yiliangyiyun.controller;
+
+
+import com.baomidou.mybatisplus.plugins.Page;
+import com.yh.saas.plugin.yiliangyiyun.entity.IdentityAuthenticationInfo;
+import com.yh.saas.plugin.yiliangyiyun.entity.PurchasePrice;
+import com.yh.saas.plugin.yiliangyiyun.exception.ServiceException;
+import com.yh.saas.plugin.yiliangyiyun.service.IPurchasePriceService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * <p>
+ * 库内自采价格主表 前端控制器
+ * </p>
+ *
+ * @author ccj
+ * @since 2021-09-03
+ */
+@RestController
+@RequestMapping("/purchasePrice")
+public class PurchasePriceController {
+    @Autowired
+    IPurchasePriceService iPurchasePriceService;
+    /**
+     * 收购管理列表
+     * @param purchasePrice
+     * @return
+     */
+    @GetMapping("/purchasePriceList")
+    public Page<PurchasePrice> purchasePriceList(PurchasePrice purchasePrice) {
+        return iPurchasePriceService.purchasePriceList(purchasePrice);
+    }
+    /**
+     * 添加收购价格
+     * @param purchasePrice
+     * @return
+     */
+    @PostMapping("/api/addPurchasePrice")
+    public String addPurchasePrice(@RequestBody PurchasePrice purchasePrice) {
+        return iPurchasePriceService.addPurchasePrice(purchasePrice);
+    }
+
+}
+

+ 21 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/PurchasePriceDetailController.java

@@ -0,0 +1,21 @@
+package com.yh.saas.plugin.yiliangyiyun.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 库内自采价格明细表 前端控制器
+ * </p>
+ *
+ * @author ccj
+ * @since 2021-09-03
+ */
+@RestController
+@RequestMapping("/purchasePriceDetail")
+public class PurchasePriceDetailController {
+
+}
+

+ 21 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/controller/PurchasePriceDetailPrintController.java

@@ -0,0 +1,21 @@
+package com.yh.saas.plugin.yiliangyiyun.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ * 库内自采价格明细表(打印) 前端控制器
+ * </p>
+ *
+ * @author ccj
+ * @since 2021-09-03
+ */
+@RestController
+@RequestMapping("/purchasePriceDetailPrint")
+public class PurchasePriceDetailPrintController {
+
+}
+

+ 43 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/CommonCompanyIdentity.java

@@ -0,0 +1,43 @@
+package com.yh.saas.plugin.yiliangyiyun.entity;
+
+import com.baomidou.mybatisplus.activerecord.Model;
+import java.io.Serializable;
+
+import com.baomidou.mybatisplus.annotations.Version;
+
+import com.yh.saas.common.support.entity.BaseModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 公司、粮商身份关系表
+ * </p>
+ *
+ * @author Gongdc
+ * @since 2021-09-02
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+public class CommonCompanyIdentity extends BaseModel<CommonCompanyIdentity> {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 公司id
+     */
+    private String comId;
+    /**
+     * 身份认证表id
+     */
+    private String identityId;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return null;
+    }
+
+}

+ 99 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/PurchasePrice.java

@@ -0,0 +1,99 @@
+package com.yh.saas.plugin.yiliangyiyun.entity;
+
+import com.baomidou.mybatisplus.activerecord.Model;
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+import com.baomidou.mybatisplus.annotations.Version;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.yh.saas.common.support.entity.BaseModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
+
+/**
+ * <p>
+ * 库内自采价格主表
+ * </p>
+ *
+ * @author ccj
+ * @since 2021-09-03
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+public class PurchasePrice extends BaseModel<PurchasePrice> {
+
+    private static final long serialVersionUID = 1L;
+    private List<PurchasePriceDetail> details;
+    private List<PurchasePriceDetailPrint> detailPrints;
+    /**
+     * 主键
+     */
+    private String id;
+    /**
+     * 仓库id
+     */
+    private String warehouseId;
+    /**
+     * 仓库名
+     */
+    private String warehouseName;
+    /**
+     * 公司id
+     */
+    private String compId;
+    /**
+     * 货名key
+     */
+    private String goodsNameKey;
+    /**
+     * 货名
+     */
+    private String goodsName;
+    /**
+     * 基准水分(%)
+     */
+    private Float waterBase;
+    /**
+     * 扣重比
+     */
+    private Float deductWeight;
+    /**
+     * 水分下限(%)
+     */
+    private Float waterMin;
+    /**
+     * 水分上限(%)
+     */
+    private Float waterMax;
+    /**
+     * 销售上限(吨/年)
+     */
+    private Float saleLimit;
+    /**
+     * 状态标识
+     */
+    private String statusFlag;
+    /**
+     * 状态
+     */
+    private String status;
+
+    /**
+     * 通过时间
+     */
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date passDate;
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 63 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/PurchasePriceDetail.java

@@ -0,0 +1,63 @@
+package com.yh.saas.plugin.yiliangyiyun.entity;
+
+import com.baomidou.mybatisplus.activerecord.Model;
+import java.io.Serializable;
+
+import com.baomidou.mybatisplus.annotations.Version;
+
+import com.yh.saas.common.support.entity.BaseModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 库内自采价格明细表
+ * </p>
+ *
+ * @author ccj
+ * @since 2021-09-03
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+public class PurchasePriceDetail extends BaseModel<PurchasePriceDetail> {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    private String id;
+    /**
+     * 主表id
+     */
+    private String mainId;
+    /**
+     * 公司id
+     */
+    private String compId;
+    /**
+     * 基准单价(元/公斤)
+     */
+    private Float basePrice;
+    /**
+     * 等级
+     */
+    private String level;
+    /**
+     * 分界数组(以,区分)
+     */
+    private String point;
+    /**
+     * 分界价格数组(以,区分)
+     */
+    private String pointPrice;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 71 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/PurchasePriceDetailPrint.java

@@ -0,0 +1,71 @@
+package com.yh.saas.plugin.yiliangyiyun.entity;
+
+import com.baomidou.mybatisplus.activerecord.Model;
+import java.io.Serializable;
+
+import com.baomidou.mybatisplus.annotations.Version;
+
+import com.yh.saas.common.support.entity.BaseModel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+/**
+ * <p>
+ * 库内自采价格明细表(打印)
+ * </p>
+ *
+ * @author ccj
+ * @since 2021-09-03
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@Accessors(chain = true)
+public class PurchasePriceDetailPrint extends BaseModel<PurchasePriceDetailPrint> {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 主键
+     */
+    private String id;
+    /**
+     * 主表id
+     */
+    private String mainId;
+    /**
+     * 公司id
+     */
+    private String compId;
+    /**
+     * 水分下限(%)
+     */
+    private Float waterMin;
+    /**
+     * 水分上限(%)
+     */
+    private Float waterMax;
+    /**
+     * 一等单价
+     */
+    private Float price1;
+    /**
+     * 二等单价
+     */
+    private Float price2;
+    /**
+     * 三等单价
+     */
+    private Float price3;
+    /**
+     * 等外单价
+     */
+    private Float priceOther;
+
+
+    @Override
+    protected Serializable pkVal() {
+        return this.id;
+    }
+
+}

+ 5 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/entity/WarehouseBaseInfo.java

@@ -114,6 +114,11 @@ public class WarehouseBaseInfo extends BaseModel<WarehouseBaseInfo> {
     @TableField(exist = false)
     private Float residual;
 
+
+    /**
+     * 是否允许手动编辑重量(0否1是)
+     */
+    private String allowEdit;
     @TableField(exist = false)
     private List<WarehousePositionInfo> warehousePositionInfoList;
 

+ 16 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/CommonCompanyIdentityMapper.java

@@ -0,0 +1,16 @@
+package com.yh.saas.plugin.yiliangyiyun.mapper;
+
+import com.yh.saas.plugin.yiliangyiyun.entity.CommonCompanyIdentity;
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 公司、粮商身份关系表 Mapper 接口
+ * </p>
+ *
+ * @author ccj
+ * @since 2021-09-02
+ */
+public interface CommonCompanyIdentityMapper extends BaseMapper<CommonCompanyIdentity> {
+
+}

+ 19 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/IdentityAuthenticationInfoMapper.java

@@ -2,6 +2,10 @@ package com.yh.saas.plugin.yiliangyiyun.mapper;
 
 import com.yh.saas.plugin.yiliangyiyun.entity.IdentityAuthenticationInfo;
 import com.baomidou.mybatisplus.mapper.BaseMapper;
+import com.yh.saas.plugin.yiliangyiyun.entity.InOutWarehouseTask;
+
+import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -12,5 +16,20 @@ import com.baomidou.mybatisplus.mapper.BaseMapper;
  * @since 2021-07-23
  */
 public interface IdentityAuthenticationInfoMapper extends BaseMapper<IdentityAuthenticationInfo> {
+    /**
+     * 粮商认证列表PC端(自采客户)
+     *
+     * @param pageView
+     * @return
+     */
+    List<IdentityAuthenticationInfo> getIdentityInfoByCondition(Map<String, Object> pageView);
+
+    /**
+     * 粮商认证数量PC端(自采客户)
+     *
+     * @param pageView
+     * @return
+     */
+    Integer getIdentityCountByCondition(Map<String, Object> pageView);
 
 }

+ 16 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/PurchasePriceDetailMapper.java

@@ -0,0 +1,16 @@
+package com.yh.saas.plugin.yiliangyiyun.mapper;
+
+import com.yh.saas.plugin.yiliangyiyun.entity.PurchasePriceDetail;
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 库内自采价格明细表 Mapper 接口
+ * </p>
+ *
+ * @author ccj
+ * @since 2021-09-03
+ */
+public interface PurchasePriceDetailMapper extends BaseMapper<PurchasePriceDetail> {
+
+}

+ 16 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/PurchasePriceDetailPrintMapper.java

@@ -0,0 +1,16 @@
+package com.yh.saas.plugin.yiliangyiyun.mapper;
+
+import com.yh.saas.plugin.yiliangyiyun.entity.PurchasePriceDetailPrint;
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+
+/**
+ * <p>
+ * 库内自采价格明细表(打印) Mapper 接口
+ * </p>
+ *
+ * @author ccj
+ * @since 2021-09-03
+ */
+public interface PurchasePriceDetailPrintMapper extends BaseMapper<PurchasePriceDetailPrint> {
+
+}

+ 34 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/mapper/PurchasePriceMapper.java

@@ -0,0 +1,34 @@
+package com.yh.saas.plugin.yiliangyiyun.mapper;
+
+import com.yh.saas.plugin.yiliangyiyun.entity.IdentityAuthenticationInfo;
+import com.yh.saas.plugin.yiliangyiyun.entity.PurchasePrice;
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 库内自采价格主表 Mapper 接口
+ * </p>
+ *
+ * @author ccj
+ * @since 2021-09-03
+ */
+public interface PurchasePriceMapper extends BaseMapper<PurchasePrice> {
+
+    /**
+     * 收购管理列表
+     *
+     * @param pageView
+     * @return
+     */
+    List<PurchasePrice> purchasePriceList(Map<String, Object> pageView);
+    /**
+     * 收购管理列表
+     *
+     * @param pageView
+     * @return
+     */
+    Integer purchasePriceListCount(Map<String, Object> pageView);
+}

+ 16 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/ICommonCompanyIdentityService.java

@@ -0,0 +1,16 @@
+package com.yh.saas.plugin.yiliangyiyun.service;
+
+import com.yh.saas.plugin.yiliangyiyun.entity.CommonCompanyIdentity;
+import com.baomidou.mybatisplus.service.IService;
+
+/**
+ * <p>
+ * 公司、粮商身份关系表 服务类
+ * </p>
+ *
+ * @author Gongdc
+ * @since 2021-09-02
+ */
+public interface ICommonCompanyIdentityService extends IService<CommonCompanyIdentity> {
+
+}

+ 16 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IIdentityAuthenticationInfoService.java

@@ -84,5 +84,21 @@ public interface IIdentityAuthenticationInfoService extends IService<IdentityAut
      * @param identityAuthenticationInfo
      */
     IdentityAuthenticationInfo selectPhone(IdentityAuthenticationInfo identityAuthenticationInfo) throws AppServiceException;
+    /**
+     *
+     * 粮商认证列表PC端(自采客户)
+     * @param identityAuthenticationInfo
+     */
+    Page<IdentityAuthenticationInfo> selectIdentityAuthenticationInfoPurchase(IdentityAuthenticationInfo identityAuthenticationInfo);
 
+    /**
+     * 手机端扫码成为公司客户
+     * @param identityAuthenticationInfo
+     */
+    String saveCompanyIdentity(IdentityAuthenticationInfo identityAuthenticationInfo);
+    /**
+     * 库内自采客户管理删除身份认证
+     * @param identityAuthenticationInfo
+     */
+    void deleteCompanyIdentity(IdentityAuthenticationInfo identityAuthenticationInfo);
 }

+ 16 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IPurchasePriceDetailPrintService.java

@@ -0,0 +1,16 @@
+package com.yh.saas.plugin.yiliangyiyun.service;
+
+import com.yh.saas.plugin.yiliangyiyun.entity.PurchasePriceDetailPrint;
+import com.baomidou.mybatisplus.service.IService;
+
+/**
+ * <p>
+ * 库内自采价格明细表(打印) 服务类
+ * </p>
+ *
+ * @author ccj
+ * @since 2021-09-03
+ */
+public interface IPurchasePriceDetailPrintService extends IService<PurchasePriceDetailPrint> {
+
+}

+ 16 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IPurchasePriceDetailService.java

@@ -0,0 +1,16 @@
+package com.yh.saas.plugin.yiliangyiyun.service;
+
+import com.yh.saas.plugin.yiliangyiyun.entity.PurchasePriceDetail;
+import com.baomidou.mybatisplus.service.IService;
+
+/**
+ * <p>
+ * 库内自采价格明细表 服务类
+ * </p>
+ *
+ * @author ccj
+ * @since 2021-09-03
+ */
+public interface IPurchasePriceDetailService extends IService<PurchasePriceDetail> {
+
+}

+ 30 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/IPurchasePriceService.java

@@ -0,0 +1,30 @@
+package com.yh.saas.plugin.yiliangyiyun.service;
+
+import com.baomidou.mybatisplus.plugins.Page;
+import com.yh.saas.plugin.yiliangyiyun.entity.PurchasePrice;
+import com.baomidou.mybatisplus.service.IService;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+
+/**
+ * <p>
+ * 库内自采价格主表 服务类
+ * </p>
+ *
+ * @author ccj
+ * @since 2021-09-03
+ */
+public interface IPurchasePriceService extends IService<PurchasePrice> {
+    /**
+     * 收购管理列表
+     * @param purchasePrice
+     * @return
+     */
+    Page<PurchasePrice> purchasePriceList(PurchasePrice purchasePrice);
+    /**
+     * 添加收购价格
+     * @param purchasePrice
+     * @return
+     */
+    String addPurchasePrice(@RequestBody PurchasePrice purchasePrice);
+}

+ 62 - 87
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/IdentityAuthenticationInfoServiceImpl.java

@@ -3,22 +3,31 @@ package com.yh.saas.plugin.yiliangyiyun.service.impl;
 import com.baomidou.mybatisplus.mapper.EntityWrapper;
 import com.baomidou.mybatisplus.mapper.Wrapper;
 import com.baomidou.mybatisplus.plugins.Page;
+import com.google.common.collect.Lists;
 import com.yh.saas.common.support.util.IdGenerator;
 import com.yh.saas.plugin.base.service.ICommonBillOperateHisService;
 import com.yh.saas.plugin.yiliangyiyun.constant.NumberConstant;
 import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
+import com.yh.saas.plugin.yiliangyiyun.entity.CommonCompanyIdentity;
 import com.yh.saas.plugin.yiliangyiyun.entity.DriverViewInfo;
 import com.yh.saas.plugin.yiliangyiyun.entity.IdentityAuthenticationInfo;
+import com.yh.saas.plugin.yiliangyiyun.entity.InOutWarehouseTask;
 import com.yh.saas.plugin.yiliangyiyun.exception.*;
+import com.yh.saas.plugin.yiliangyiyun.mapper.CommonCompanyIdentityMapper;
+import com.yh.saas.plugin.yiliangyiyun.mapper.CommonUserMapper;
 import com.yh.saas.plugin.yiliangyiyun.mapper.IdentityAuthenticationInfoMapper;
 import com.yh.saas.plugin.yiliangyiyun.service.*;
 import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import java.sql.*;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 /**
  * <p>
@@ -32,16 +41,8 @@ import java.util.List;
 public class IdentityAuthenticationInfoServiceImpl extends ServiceImpl<IdentityAuthenticationInfoMapper, IdentityAuthenticationInfo> implements IIdentityAuthenticationInfoService {
     @Autowired
     private ICommonBillOperateHisService billOperateHisService;
-    @Value("com.mysql.jdbc.Driver")
-    private String driverClassName;
-    @Value("jdbc:mysql://47.100.3.209:3306/talk-core?createDatabaseIfNotExist=true&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&allowMultiQueries=true")
-    private String url;
-    @Value("root")
-    private String username;
-    @Value("Ccj841968545")
-    private String password;
-
-    Connection  coon=null;
+    @Autowired
+    private CommonCompanyIdentityMapper commonCompanyIdentityMapper;
     /**
      * 粮商认证列表
      * @param identityAuthenticationInfo
@@ -108,26 +109,8 @@ public class IdentityAuthenticationInfoServiceImpl extends ServiceImpl<IdentityA
         if ("3".equals(identityAuthenticationInfo.getCustomerTypeFlag())){
             identityAuthenticationInfo.setAuthenticationStatus(StatusEnum.IDENTITY_COMPLETED.getName());
             identityAuthenticationInfo.setAuthenticationStatusKey(StatusEnum.IDENTITY_COMPLETED.getFlag());
-            //将粮信用户表的粮农字段更新为1
-            if(identityAuthenticationInfo.getCustomerPhone() != null){
-                DBConnection();
-                String sUserId = excSelect("select * from s_user s where s.user_name = '"+identityAuthenticationInfo.getCustomerPhone()+"'",this.coon);
-                if( sUserId != null && !sUserId.isEmpty()){
-                    excUpdate("update s_user s set s.farmer_flag = 1 where s.user_name = '"+identityAuthenticationInfo.getCustomerPhone()+"'",this.coon);
-                }
-                close();
-            }
         }
         else{
-            //将粮信用户表的粮商字段更新为1
-            if(identityAuthenticationInfo.getCustomerPhone() != null){
-                DBConnection();
-                String sUserId = excSelect("select * from s_user s where s.user_name = '"+identityAuthenticationInfo.getCustomerPhone()+"'",this.coon);
-                if( sUserId != null && !sUserId.isEmpty()){
-                    excUpdate("update s_user s set s.trader_flag = 1 where s.user_name = '"+identityAuthenticationInfo.getCustomerPhone()+"'",this.coon);
-                }
-                close();
-            }
             identityAuthenticationInfo.setAuthenticationStatus(StatusEnum.IDENTITY_REVIEWED.getName());
             identityAuthenticationInfo.setAuthenticationStatusKey(StatusEnum.IDENTITY_REVIEWED.getFlag());
         }
@@ -145,7 +128,10 @@ public class IdentityAuthenticationInfoServiceImpl extends ServiceImpl<IdentityA
         }
         // 操作主表数据
         this.insert(identityAuthenticationInfo);
-
+        //如果是个人粮商且公司id不为空,则添加公司与个人粮商关系表
+        if("1".equals(identityAuthenticationInfo.getCustomerTypeFlag())&&identityAuthenticationInfo.getCompId() != null && !identityAuthenticationInfo.getCompId().isEmpty()){
+            this.saveCompanyIdentity(identityAuthenticationInfo);
+        }
         return identityAuthenticationInfo.getId();
     }
 
@@ -188,18 +174,6 @@ public class IdentityAuthenticationInfoServiceImpl extends ServiceImpl<IdentityA
         if(identityAuthenticationInfo != null){
             //删除身份认证
             this.deleteById(identityAuthenticationInfo.getId());
-            //粮农身份不需审核
-            if ("3".equals(identityAuthenticationInfo.getCustomerTypeFlag())){
-                //将粮信用户表的粮农字段更新为0
-                if(identityAuthenticationInfo.getCustomerPhone() != null){
-                    DBConnection();
-                    String sUserId = excSelect("select * from s_user s where s.user_name = '"+identityAuthenticationInfo.getCustomerPhone()+"'",this.coon);
-                    if( sUserId != null && !sUserId.isEmpty()){
-                        excUpdate("update s_user s set s.farmer_flag = 0 where s.user_name = '"+identityAuthenticationInfo.getCustomerPhone()+"'",this.coon);
-                    }
-                    close();
-                }
-            }
         }
     }
 
@@ -377,60 +351,61 @@ public class IdentityAuthenticationInfoServiceImpl extends ServiceImpl<IdentityA
         return identityAuthenticationInfo1;
     }
 
-    public void DBConnection(){
-        try{
-            //加载驱动程序
-            Class.forName(driverClassName);
-            coon=(Connection) DriverManager.getConnection(url,username,password);
-            if(!coon.isClosed()){
-                System.out.println("成功连接数据库!");
-            }
-        }catch (Exception e){
-            e.printStackTrace();
-        }
-    }
-    public void close(){
-        try{
-            this.coon.close();
-            System.out.println("成功关闭数据库连接!");
-        }catch(Exception e){
-            e.printStackTrace();
-            System.out.println("关闭数据库连接异常!");
-        }
-    }
-    //    查询s_user表
-    public String excSelect(String sql,Connection  coon){
+    @Override
+    public Page<IdentityAuthenticationInfo> selectIdentityAuthenticationInfoPurchase(IdentityAuthenticationInfo identityAuthenticationInfo) {
         try{
-            Statement stmt=(Statement)coon.createStatement();
-            ResultSet rs=(ResultSet)stmt.executeQuery(sql);//得到的是结果的集合
+            Map<String, Object> pageView = new HashMap<>();
+            pageView.put("startRecord", (identityAuthenticationInfo.getCurrentPage() - 1)
+                    * identityAuthenticationInfo.getPageSize());
+            //公司id
+            pageView.put("compId", identityAuthenticationInfo.getCompId());
+            pageView.put("searchKeyWord", identityAuthenticationInfo.getSearchKeyWord());
+            pageView.put("pageSize", identityAuthenticationInfo.getPageSize());
+            pageView.put("currentPage", identityAuthenticationInfo.getCurrentPage());
 
-            while(rs.next()){
-                String id=rs.getString("id");
-                if(id != null && !id.isEmpty()){
-                    return id;
-                }
-            }
-            stmt.close();
-            return null;
-        }catch(Exception e){
-            e.printStackTrace();
+            List<IdentityAuthenticationInfo> dataList = this.baseMapper.getIdentityInfoByCondition(pageView);
+
+
+            Integer dataCount = this.baseMapper.getIdentityCountByCondition(pageView);
+
+            Page<IdentityAuthenticationInfo> page = new Page<>();
+            page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
+            page.setTotal(dataCount == null ? 0 : dataCount);
+            page.setCurrent(identityAuthenticationInfo.getCurrentPage());
+            page.setSize(identityAuthenticationInfo.getPageSize());
+            return page;
+
+        }
+        catch (Exception e){
+            System.out.println("查询异常:"+e.toString());
             return null;
         }
+
     }
-    //    更改数据
-    public void excUpdate(String sql,Connection  coon){
-        try{
-            PreparedStatement prestmt=(PreparedStatement)coon.prepareStatement(sql);
-            prestmt.executeUpdate();
-            System.out.println("更改数据成功!");
-            prestmt.close();
-        }catch(Exception e){
-            System.out.println("粮信更改数据异常!");
-            e.printStackTrace();
+
+    @Override
+    public String saveCompanyIdentity(IdentityAuthenticationInfo identityAuthenticationInfo) {
+        CommonCompanyIdentity commonCompanyIdentity = new CommonCompanyIdentity();
+        commonCompanyIdentity.setIdentityId(identityAuthenticationInfo.getId());
+        commonCompanyIdentity.setComId(identityAuthenticationInfo.getCompId());
+
+        Integer one=this.commonCompanyIdentityMapper.insert(commonCompanyIdentity);
+        //成功返回ok
+        if (one>0 ) {
+            return "OK";
+        } else {
+            return "NG";
         }
     }
 
-
+    @Override
+    public void deleteCompanyIdentity(IdentityAuthenticationInfo identityAuthenticationInfo) {
+       List<CommonCompanyIdentity> list = this.commonCompanyIdentityMapper.selectList(new EntityWrapper<CommonCompanyIdentity>()
+                .eq("com_id",identityAuthenticationInfo.getCompId()).eq("identity_id",identityAuthenticationInfo.getId()));
+       for(CommonCompanyIdentity commonCompanyIdentity : list){
+           this.commonCompanyIdentityMapper.deleteById(commonCompanyIdentity);
+       }
+    }
 
 }
 

+ 20 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/PurchasePriceDetailPrintServiceImpl.java

@@ -0,0 +1,20 @@
+package com.yh.saas.plugin.yiliangyiyun.service.impl;
+
+import com.yh.saas.plugin.yiliangyiyun.entity.PurchasePriceDetailPrint;
+import com.yh.saas.plugin.yiliangyiyun.mapper.PurchasePriceDetailPrintMapper;
+import com.yh.saas.plugin.yiliangyiyun.service.IPurchasePriceDetailPrintService;
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 库内自采价格明细表(打印) 服务实现类
+ * </p>
+ *
+ * @author ccj
+ * @since 2021-09-03
+ */
+@Service
+public class PurchasePriceDetailPrintServiceImpl extends ServiceImpl<PurchasePriceDetailPrintMapper, PurchasePriceDetailPrint> implements IPurchasePriceDetailPrintService {
+
+}

+ 20 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/PurchasePriceDetailServiceImpl.java

@@ -0,0 +1,20 @@
+package com.yh.saas.plugin.yiliangyiyun.service.impl;
+
+import com.yh.saas.plugin.yiliangyiyun.entity.PurchasePriceDetail;
+import com.yh.saas.plugin.yiliangyiyun.mapper.PurchasePriceDetailMapper;
+import com.yh.saas.plugin.yiliangyiyun.service.IPurchasePriceDetailService;
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ * 库内自采价格明细表 服务实现类
+ * </p>
+ *
+ * @author ccj
+ * @since 2021-09-03
+ */
+@Service
+public class PurchasePriceDetailServiceImpl extends ServiceImpl<PurchasePriceDetailMapper, PurchasePriceDetail> implements IPurchasePriceDetailService {
+
+}

+ 97 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/service/impl/PurchasePriceServiceImpl.java

@@ -0,0 +1,97 @@
+package com.yh.saas.plugin.yiliangyiyun.service.impl;
+
+import com.baomidou.mybatisplus.plugins.Page;
+import com.google.common.collect.Lists;
+import com.yh.saas.common.support.util.IdGenerator;
+import com.yh.saas.plugin.yiliangyiyun.constant.StatusEnum;
+import com.yh.saas.plugin.yiliangyiyun.entity.IdentityAuthenticationInfo;
+import com.yh.saas.plugin.yiliangyiyun.entity.PurchasePrice;
+import com.yh.saas.plugin.yiliangyiyun.entity.PurchasePriceDetail;
+import com.yh.saas.plugin.yiliangyiyun.entity.PurchasePriceDetailPrint;
+import com.yh.saas.plugin.yiliangyiyun.mapper.CommonCompanyIdentityMapper;
+import com.yh.saas.plugin.yiliangyiyun.mapper.PurchasePriceDetailMapper;
+import com.yh.saas.plugin.yiliangyiyun.mapper.PurchasePriceDetailPrintMapper;
+import com.yh.saas.plugin.yiliangyiyun.mapper.PurchasePriceMapper;
+import com.yh.saas.plugin.yiliangyiyun.service.IPurchasePriceService;
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * <p>
+ * 库内自采价格主表 服务实现类
+ * </p>
+ *
+ * @author ccj
+ * @since 2021-09-03
+ */
+@Service
+public class PurchasePriceServiceImpl extends ServiceImpl<PurchasePriceMapper, PurchasePrice> implements IPurchasePriceService {
+
+    @Autowired
+    private PurchasePriceDetailMapper purchasePriceDetailMapper;
+    @Autowired
+    private PurchasePriceDetailPrintMapper purchasePriceDetailPrintMapper;
+    @Override
+    public Page<PurchasePrice> purchasePriceList(PurchasePrice purchasePrice) {
+
+        Map<String, Object> pageView = new HashMap<>();
+        pageView.put("startRecord", (purchasePrice.getCurrentPage() - 1)
+                * purchasePrice.getPageSize());
+        //公司id
+        pageView.put("compId", purchasePrice.getCompId());
+        pageView.put("warehouseId", purchasePrice.getWarehouseId());
+        pageView.put("pageSize", purchasePrice.getPageSize());
+        pageView.put("currentPage", purchasePrice.getCurrentPage());
+
+        List<PurchasePrice> dataList = this.baseMapper.purchasePriceList(pageView);
+
+
+        Integer dataCount = this.baseMapper.purchasePriceListCount(pageView);
+
+        Page<PurchasePrice> page = new Page<>();
+        page.setRecords(dataList == null ? Lists.newArrayList() : dataList);
+        page.setTotal(dataCount == null ? 0 : dataCount);
+        page.setCurrent(purchasePrice.getCurrentPage());
+        page.setSize(purchasePrice.getPageSize());
+        return page;
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public String addPurchasePrice(PurchasePrice purchasePrice) {
+        try{
+            String compId = purchasePrice.getCompId();
+            String mainId = IdGenerator.generateUUID();
+            purchasePrice.setId(mainId);
+            purchasePrice.setStatus(StatusEnum.PURCHASE_REVIEWED.getName());
+            purchasePrice.setStatusFlag(StatusEnum.PURCHASE_REVIEWED.getFlag());
+            // 操作主表数据
+            this.insert(purchasePrice);
+            // 操作明细表数据
+            for(PurchasePriceDetail tmp : purchasePrice.getDetails()){
+                tmp.setId(IdGenerator.generateUUID());
+                tmp.setCompId(compId);
+                tmp.setMainId(mainId);
+                this.purchasePriceDetailMapper.insert(tmp);
+            }
+            // 操作打印表数据
+            for(PurchasePriceDetailPrint tmp : purchasePrice.getDetailPrints()){
+                tmp.setId(IdGenerator.generateUUID());
+                tmp.setCompId(compId);
+                tmp.setMainId(mainId);
+                this.purchasePriceDetailPrintMapper.insert(tmp);
+            }
+            return "ok";
+        }
+        catch (Exception e){
+            System.out.println("新增收购价格异常:"+e.toString());
+            return "error";
+        }
+    }
+}

+ 101 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/java/com/yh/saas/plugin/yiliangyiyun/util/QRCodeUtil.java

@@ -0,0 +1,101 @@
+package com.yh.saas.plugin.yiliangyiyun.util;
+
+
+import com.aliyun.oss.OSSClient;
+import com.aliyun.oss.model.ObjectMetadata;
+import com.aliyun.oss.model.PutObjectRequest;
+import com.google.zxing.BarcodeFormat;
+import com.google.zxing.EncodeHintType;
+import com.google.zxing.WriterException;
+import com.google.zxing.client.j2se.MatrixToImageWriter;
+import com.google.zxing.common.BitMatrix;
+import com.google.zxing.qrcode.QRCodeWriter;
+import lombok.Getter;
+import org.apache.http.entity.ContentType;
+import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.mock.web.MockMultipartFile;
+import org.springframework.stereotype.Component;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.FileSystems;
+import java.nio.file.Path;
+import java.util.Hashtable;
+/**
+ * @Author:chengchangjiang
+ * @Description: 二维码Util类
+ * @Date:Created in 9:38 2021-09-03
+ */
+@Component
+public class QRCodeUtil implements InitializingBean {
+    @Getter
+    @Value("${oss.endpoint.internal:}")
+    private String baseUrl;
+    @Getter
+    @Value("${oss.bucket.name:}")
+    private String bucket;
+    @Autowired
+    private OSSClient ossClient;
+    @Getter
+    @Value("${oss.endpoint.default:}")
+    private String endpoint;
+
+    private String host;
+    @Override
+    public void afterPropertiesSet() throws Exception {
+        host = "http://" + bucket + "." + endpoint;
+    }
+
+    /***
+     * 生成二维码图片并上传OSS
+     * @param text 二维码内容
+     * @param width 宽度
+     * @param height 高度
+     * @param type 类型
+     * @param name 图片名字
+     * @return
+     */
+    public  String generateQRCodeImage(String text, int width, int height,String type,String name){
+        try {
+            QRCodeWriter qrCodeWriter = new QRCodeWriter();
+            Hashtable<EncodeHintType, Object> hints = new Hashtable();
+            hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
+            BitMatrix bitMatrix = qrCodeWriter.encode(type+"~"+text, BarcodeFormat.QR_CODE, width, height,hints);
+
+            File file = new File( new String(("templates" + File.separator + name+".png").getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8));
+            Path path = FileSystems.getDefault().getPath(file.getAbsoluteFile().getPath());
+
+            MatrixToImageWriter.writeToPath(bitMatrix, "PNG", path);
+
+            FileInputStream fileInputStream = new FileInputStream(file.getAbsoluteFile());
+
+            MultipartFile multipartFile = new MockMultipartFile( ContentType.APPLICATION_OCTET_STREAM.toString(), fileInputStream);
+            String result = upload(multipartFile,name);
+            file.delete();
+            return result;
+        }
+        catch (Exception e){
+            System.out.println("二维码异常:"+e.toString());
+            return "error";
+        }
+    }
+    /**
+     * 后台通过服务器间接传文件
+     * @param file
+     * @return
+     * @throws IOException
+     */
+    public  String upload(MultipartFile file,String sendCarNo) throws IOException {
+        ObjectMetadata objectMetadata = new ObjectMetadata();
+        objectMetadata.setContentLength(file.getSize());
+        objectMetadata.setContentType(file.getContentType());
+        PutObjectRequest putObjectRequest = new PutObjectRequest(bucket, "QRCode/" +sendCarNo+".png", file.getInputStream(), objectMetadata);
+        ossClient.putObject(putObjectRequest);
+        return baseUrl + "QRCode/" + sendCarNo+".png";
+    }
+}

+ 5 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/CommonCompanyIdentityMapper.xml

@@ -0,0 +1,5 @@
+<?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.yh.saas.plugin.yiliangyiyun.mapper.CommonCompanyIdentityMapper">
+
+</mapper>

+ 56 - 1
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/IdentityAuthenticationInfoMapper.xml

@@ -1,5 +1,60 @@
 <?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.yh.saas.plugin.yiliangyiyun.mapper.IdentityAuthenticationInfoMapper">
-
+    <!-- 获得客户列表 -->
+    <select id="getIdentityInfoByCondition" parameterType="Map"
+            resultType="com.yh.saas.plugin.yiliangyiyun.entity.IdentityAuthenticationInfo">
+        SELECT
+        a.id as id,
+        a.customer_name as customerName,
+        a.customer_phone as customerPhone,
+        a.bank_card as bankCard,
+        a.bank_deposit as bankDeposit,
+        a.bank_deposit_branch as bankDepositBranch,
+        a.payee_name as payeeName,
+        a.payee_number_card as payeeNumberCard,
+        a.authentication_status_key as authenticationStatusKey,
+        a.authentication_status as authenticationStatus,
+        a.cover ,
+        a.customer_number_card as customerNumberCard,
+        a.payee_address_url as payeeAddressUrl,
+        a.card_address_url as cardAddressUrl
+        FROM identity_authentication_info a
+        left join
+        common_company_identity b
+        on
+        a.id = b.identity_id
+        and b.com_id=#{compId}
+        WHERE
+        a.customer_type_flag = '1'
+        and b.delete_flag = '0'
+        and a.delete_flag = '0'
+        <if test="searchKeyWord != null and searchKeyWord != ''">
+            AND (lower(a.customer_name) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(a.customer_phone) like lower(CONCAT('%',#{searchKeyWord},'%')))
+        </if>
+        ORDER BY a.update_date DESC
+        <if test="currentPage != null and currentPage != ''">
+            LIMIT ${startRecord}, ${pageSize}
+        </if>
+    </select>
+    <!-- 获得客户总数 -->
+    <select id="getIdentityCountByCondition" parameterType="Map" resultType="java.lang.Integer">
+        SELECT
+        COUNT(a.id)
+        FROM identity_authentication_info a
+        left join
+        common_company_identity b
+        on
+        a.id = b.identity_id
+        and b.com_id=#{compId}
+        WHERE
+        a.customer_type_flag = '1'
+        and b.delete_flag = '0'
+        and a.delete_flag = '0'
+        <if test="searchKeyWord != null and searchKeyWord != ''">
+            AND (lower(a.customer_name) like lower(CONCAT('%',#{searchKeyWord},'%'))
+            OR lower(a.customer_phone) like lower(CONCAT('%',#{searchKeyWord},'%')))
+        </if>
+    </select>
 </mapper>

+ 5 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/PurchasePriceDetailMapper.xml

@@ -0,0 +1,5 @@
+<?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.yh.saas.plugin.yiliangyiyun.mapper.PurchasePriceDetailMapper">
+
+</mapper>

+ 5 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/PurchasePriceDetailPrintMapper.xml

@@ -0,0 +1,5 @@
+<?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.yh.saas.plugin.yiliangyiyun.mapper.PurchasePriceDetailPrintMapper">
+
+</mapper>

+ 50 - 0
winsea-haixin-plugin-yiliangyiyun/src/main/resources/mapper/PurchasePriceMapper.xml

@@ -0,0 +1,50 @@
+<?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.yh.saas.plugin.yiliangyiyun.mapper.PurchasePriceMapper">
+
+    <select id="purchasePriceList" parameterType="Map"
+            resultType="com.yh.saas.plugin.yiliangyiyun.entity.PurchasePrice">
+        SELECT
+        wbi.warehouse_name AS warehouseName,
+        pp.id,
+        pp.goods_name AS gooodsName,
+        pp.water_min AS waterMin,
+        pp.water_max AS waterMax,
+        pp.water_base AS waterBase,
+        pp.deduct_weight AS deductWeight,
+        pp.`status`,
+        pp.status_flag AS statusFlag,
+        pp.pass_date AS passDate
+        FROM
+        purchase_price pp
+        LEFT JOIN warehouse_base_info wbi ON pp.warehouse_id = wbi.id
+        WHERE
+        wbi.comp_id = #{compId}
+        and pp.comp_id = #{compId}
+        <if test="warehouseId != null and warehouseId != ''">
+            AND pp.warehouse_id = #{warehouseId}
+        </if>
+        and wbi.delete_flag = '0'
+        and pp.delete_flag = '0'
+        ORDER BY pp.warehouse_name DESC
+        <if test="currentPage != null and currentPage != ''">
+            LIMIT ${startRecord}, ${pageSize}
+        </if>
+    </select>
+    <select id="purchasePriceListCount" parameterType="Map" resultType="java.lang.Integer">
+        SELECT
+        COUNT(pp.id)
+        FROM
+        purchase_price pp
+        LEFT JOIN warehouse_base_info wbi ON pp.warehouse_id = wbi.id
+        WHERE
+        wbi.comp_id = #{compId}
+        and pp.comp_id = #{compId}
+        <if test="warehouseId != null and warehouseId != ''">
+            AND pp.warehouse_id = #{warehouseId}
+        </if>
+        and wbi.delete_flag = '0'
+        and pp.delete_flag = '0'
+        ORDER BY pp.warehouse_name DESC
+    </select>
+</mapper>