소스 검색

代码补充

yuansh 1 개월 전
부모
커밋
26f6a72909
40개의 변경된 파일976개의 추가작업 그리고 178개의 파일을 삭제
  1. 1 0
      jeecg-boot-base-core/src/main/java/org/jeecg/common/aspect/AutoLogAspect.java
  2. 14 8
      jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml
  3. 2 2
      jeecg-module-system/jeecg-system-start/src/main/resources/application-prod.yml
  4. 2 2
      jeecg-module-system/jeecg-system-start/src/main/resources/application-prod8004.yml
  5. 41 28
      jeecg-module-system/jeecg-system-start/src/main/resources/application-test.yml
  6. 1 1
      jeecg-module-system/jeecg-system-start/src/main/resources/application.yml
  7. 3 0
      srm-module-code/src/main/java/org/jeecg/modules/platCode/entity/PlatCommissionOrder.java
  8. 3 1
      srm-module-code/src/main/java/org/jeecg/modules/platCode/vo/PlatCommissionOrderPage.java
  9. 1 1
      srm-module-code/src/main/java/org/jeecg/modules/purCode/controller/PurInquiryFormController.java
  10. 35 1
      srm-module-code/src/main/java/org/jeecg/modules/purCode/controller/PurOrderController.java
  11. 166 1
      srm-module-code/src/main/java/org/jeecg/modules/purCode/controller/PurPurchaseQuotationController.java
  12. 87 6
      srm-module-code/src/main/java/org/jeecg/modules/purCode/controller/PurQuotationSelectionController.java
  13. 9 8
      srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurOrder.java
  14. 4 0
      srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurOrderProduct.java
  15. 13 6
      srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurPurchaseQuotation.java
  16. 10 1
      srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurQuotationSelection.java
  17. 2 0
      srm-module-code/src/main/java/org/jeecg/modules/purCode/mapper/PurPurchaseQuotationMapper.java
  18. 2 2
      srm-module-code/src/main/java/org/jeecg/modules/purCode/mapper/xml/PurOrderProductMapper.xml
  19. 11 0
      srm-module-code/src/main/java/org/jeecg/modules/purCode/mapper/xml/PurPurchaseQuotationMapper.xml
  20. 2 1
      srm-module-code/src/main/java/org/jeecg/modules/purCode/mapper/xml/PurPurchaseQuotationProductMapper.xml
  21. 1 0
      srm-module-code/src/main/java/org/jeecg/modules/purCode/service/IPurPurchaseQuotationService.java
  22. 1 0
      srm-module-code/src/main/java/org/jeecg/modules/purCode/service/impl/PurOrderServiceImpl.java
  23. 8 1
      srm-module-code/src/main/java/org/jeecg/modules/purCode/service/impl/PurPurchaseQuotationServiceImpl.java
  24. 29 3
      srm-module-code/src/main/java/org/jeecg/modules/purCode/service/impl/PurQuotationSelectionServiceImpl.java
  25. 8 5
      srm-module-code/src/main/java/org/jeecg/modules/purCode/vo/PurOrderPage.java
  26. 3 5
      srm-module-code/src/main/java/org/jeecg/modules/purCode/vo/PurPurchaseQuotationPage.java
  27. 53 3
      srm-module-code/src/main/java/org/jeecg/modules/saleCode/controller/SaleAdvancePaymentController.java
  28. 81 7
      srm-module-code/src/main/java/org/jeecg/modules/saleCode/controller/SaleInvoiceController.java
  29. 88 31
      srm-module-code/src/main/java/org/jeecg/modules/saleCode/controller/SaleReceiptController.java
  30. 10 0
      srm-module-code/src/main/java/org/jeecg/modules/saleCode/entity/SaleAdvancePayment.java
  31. 4 0
      srm-module-code/src/main/java/org/jeecg/modules/saleCode/entity/SaleInvoice.java
  32. 8 2
      srm-module-code/src/main/java/org/jeecg/modules/saleCode/entity/SaleReceipt.java
  33. 2 1
      srm-module-code/src/main/java/org/jeecg/modules/saleCode/service/ISaleAdvancePaymentService.java
  34. 2 1
      srm-module-code/src/main/java/org/jeecg/modules/saleCode/service/ISaleReceiptService.java
  35. 55 0
      srm-module-code/src/main/java/org/jeecg/modules/saleCode/service/impl/SaleAdvancePaymentServiceImpl.java
  36. 37 15
      srm-module-code/src/main/java/org/jeecg/modules/saleCode/service/impl/SaleInterfaceSyncServiceImpl.java
  37. 12 0
      srm-module-code/src/main/java/org/jeecg/modules/saleCode/service/impl/SaleInvoiceServiceImpl.java
  38. 55 0
      srm-module-code/src/main/java/org/jeecg/modules/saleCode/service/impl/SaleReceiptServiceImpl.java
  39. 37 35
      srm-module-code/src/main/java/org/jeecg/modules/saleCode/util/HttpUtils.java
  40. 73 0
      srm-module-code/src/main/java/org/jeecg/modules/utils/ExcelExportUtils.java

+ 1 - 0
jeecg-boot-base-core/src/main/java/org/jeecg/common/aspect/AutoLogAspect.java

@@ -99,6 +99,7 @@ public class AutoLogAspect {
         dto.setRequestParam(getReqestParams(request,joinPoint));
         dto.setRequestParam(getReqestParams(request,joinPoint));
         //设置IP地址
         //设置IP地址
         dto.setIp(IpUtils.getIpAddr(request));
         dto.setIp(IpUtils.getIpAddr(request));
+//        dto.setIp(IpUtils.getClientIp(request));
         //获取登录用户信息
         //获取登录用户信息
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
         if(sysUser!=null){
         if(sysUser!=null){

+ 14 - 8
jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml

@@ -1,5 +1,8 @@
 server:
 server:
   port: 8080
   port: 8080
+#  port: 8092
+#  port: 8002
+#  port: 8004
   tomcat:
   tomcat:
     max-swallow-size: -1
     max-swallow-size: -1
   error:
   error:
@@ -125,8 +128,8 @@ spring:
     druid:
     druid:
       stat-view-servlet:
       stat-view-servlet:
         enabled: true
         enabled: true
-        loginUsername: admin
-        loginPassword: 123456
+        loginUsername:
+        loginPassword:
         allow:
         allow:
       web-stat-filter:
       web-stat-filter:
         enabled: true
         enabled: true
@@ -161,9 +164,12 @@ spring:
           slow-sql-millis: 5000
           slow-sql-millis: 5000
       datasource:
       datasource:
         master:
         master:
-          url: jdbc:mysql://106.15.206.14:3306/global-srm?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+          url: jdbc:mysql://localhost:3306/global-srm2?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+#          url: jdbc:mysql://localhost:3306/global-srm?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+#          url: jdbc:mysql://106.15.206.14:3306/global-srm?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
           username: root
           username: root
-          password: CuiDian1234
+          password: root
+#          password: CuiDian1234
           driver-class-name: com.mysql.cj.jdbc.Driver
           driver-class-name: com.mysql.cj.jdbc.Driver
           # 多数据源配置
           # 多数据源配置
           #multi-datasource1:
           #multi-datasource1:
@@ -190,7 +196,7 @@ mybatis-plus:
       table-underline: true
       table-underline: true
   configuration:
   configuration:
     # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
     # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
-    #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
     # 返回类型为Map,显示null对应的字段
     # 返回类型为Map,显示null对应的字段
     call-setters-on-nulls: true
     call-setters-on-nulls: true
 #jeecg专用配置
 #jeecg专用配置
@@ -215,9 +221,9 @@ jeecg:
     app: http://localhost:8051
     app: http://localhost:8051
   path:
   path:
     #文件上传根目录 设置
     #文件上传根目录 设置
-    upload: /opt/upFiles
+    upload:  D://opt/upFiles
     #webapp文件路径
     #webapp文件路径
-    webapp: /opt/webapp
+    webapp:  D://opt/webapp
   shiro:
   shiro:
     excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/bigscreen/category/**,/bigscreen/visual/**,/bigscreen/map/**,/jmreport/bigscreen2/**
     excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/bigscreen/category/**,/bigscreen/visual/**,/bigscreen/map/**,/jmreport/bigscreen2/**
   #阿里云oss存储和大鱼短信秘钥配置
   #阿里云oss存储和大鱼短信秘钥配置
@@ -293,7 +299,7 @@ cas:
 logging:
 logging:
   level:
   level:
     org.flywaydb: debug
     org.flywaydb: debug
-    org.jeecg.modules.system.mapper: info
+    org.jeecg.modules.system.mapper: debug
 #swagger
 #swagger
 knife4j:
 knife4j:
   #开启增强配置
   #开启增强配置

+ 2 - 2
jeecg-module-system/jeecg-system-start/src/main/resources/application-prod.yml

@@ -297,8 +297,8 @@ cas:
 #Mybatis输出sql日志
 #Mybatis输出sql日志
 logging:
 logging:
   level:
   level:
-    org.flywaydb: debug
-    org.jeecg.modules.system.mapper: debug
+    org.flywaydb: info
+    org.jeecg.modules.system.mapper: info
 #swagger
 #swagger
 knife4j:
 knife4j:
   #开启增强配置
   #开启增强配置

+ 2 - 2
jeecg-module-system/jeecg-system-start/src/main/resources/application-prod8004.yml

@@ -294,8 +294,8 @@ cas:
 #Mybatis输出sql日志
 #Mybatis输出sql日志
 logging:
 logging:
   level:
   level:
-    org.flywaydb: debug
-    org.jeecg.modules.system.mapper: debug
+    org.flywaydb: info
+    org.jeecg.modules.system.mapper: info
 #swagger
 #swagger
 knife4j:
 knife4j:
   #开启增强配置
   #开启增强配置

+ 41 - 28
jeecg-module-system/jeecg-system-start/src/main/resources/application-test.yml

@@ -1,5 +1,5 @@
 server:
 server:
-  port: 8080
+  port: 8092
   tomcat:
   tomcat:
     max-swallow-size: -1
     max-swallow-size: -1
   error:
   error:
@@ -7,7 +7,7 @@ server:
     include-stacktrace: ALWAYS
     include-stacktrace: ALWAYS
     include-message: ALWAYS
     include-message: ALWAYS
   servlet:
   servlet:
-    context-path: /jeecg-boot
+    context-path: /global-srm
   compression:
   compression:
     enabled: true
     enabled: true
     min-response-size: 1024
     min-response-size: 1024
@@ -23,7 +23,7 @@ spring:
   # flyway配置
   # flyway配置
   flyway:
   flyway:
     # 是否启用flyway
     # 是否启用flyway
-    enabled: false
+    enabled: true
     # 编码格式,默认UTF-8
     # 编码格式,默认UTF-8
     encoding: UTF-8
     encoding: UTF-8
     # 迁移sql脚本文件存放路径,官方默认db/migration
     # 迁移sql脚本文件存放路径,官方默认db/migration
@@ -90,10 +90,10 @@ spring:
   jackson:
   jackson:
     date-format: yyyy-MM-dd HH:mm:ss
     date-format: yyyy-MM-dd HH:mm:ss
     time-zone: GMT+8
     time-zone: GMT+8
-  aop:
-    proxy-target-class: true
   jpa:
   jpa:
     open-in-view: false
     open-in-view: false
+  aop:
+    proxy-target-class: true
   #配置freemarker
   #配置freemarker
   freemarker:
   freemarker:
     # 设置模板后缀名
     # 设置模板后缀名
@@ -143,7 +143,7 @@ spring:
         timeBetweenEvictionRunsMillis: 60000
         timeBetweenEvictionRunsMillis: 60000
         # 配置一个连接在池中最小生存的时间,单位是毫秒
         # 配置一个连接在池中最小生存的时间,单位是毫秒
         minEvictableIdleTimeMillis: 300000
         minEvictableIdleTimeMillis: 300000
-        validationQuery: SELECT 1 FROM DUAL
+        validationQuery: SELECT 1
         testWhileIdle: true
         testWhileIdle: true
         testOnBorrow: false
         testOnBorrow: false
         testOnReturn: false
         testOnReturn: false
@@ -161,9 +161,9 @@ spring:
           slow-sql-millis: 5000
           slow-sql-millis: 5000
       datasource:
       datasource:
         master:
         master:
-          url: jdbc:mysql://127.0.0.1:3306/jeecg-boot?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
+          url: jdbc:mysql://106.15.206.14:3306/global-srm?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
           username: root
           username: root
-          password: root
+          password: CuiDian1234
           driver-class-name: com.mysql.cj.jdbc.Driver
           driver-class-name: com.mysql.cj.jdbc.Driver
           # 多数据源配置
           # 多数据源配置
           #multi-datasource1:
           #multi-datasource1:
@@ -174,23 +174,23 @@ spring:
   #redis 配置
   #redis 配置
   redis:
   redis:
     database: 0
     database: 0
-    host: 192.168.1.188
+    host: 127.0.0.1
     port: 6379
     port: 6379
     password: ''
     password: ''
 #mybatis plus 设置
 #mybatis plus 设置
 mybatis-plus:
 mybatis-plus:
-  mapper-locations: classpath*:org/jeecg/**/xml/*Mapper.xml
+  mapper-locations: classpath*:org/jeecg/**/xml/*Mapper.xml,classpath*:com/cuidian/**/xml/*Mapper.xml
   global-config:
   global-config:
     # 关闭MP3.0自带的banner
     # 关闭MP3.0自带的banner
     banner: false
     banner: false
     db-config:
     db-config:
-      #主键类型
+      #主键类型  0:"数据库ID自增",1:"该类型为未设置主键类型", 2:"用户输入ID",3:"全局唯一ID (数字类型唯一ID)", 4:"全局唯一ID UUID",5:"字符串全局唯一ID (idWorker 的字符串表示)";
       id-type: ASSIGN_ID
       id-type: ASSIGN_ID
       # 默认数据库表下划线命名
       # 默认数据库表下划线命名
       table-underline: true
       table-underline: true
   configuration:
   configuration:
     # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
     # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
-    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
+    #log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
     # 返回类型为Map,显示null对应的字段
     # 返回类型为Map,显示null对应的字段
     call-setters-on-nulls: true
     call-setters-on-nulls: true
 #jeecg专用配置
 #jeecg专用配置
@@ -207,7 +207,7 @@ jeecg:
   signatureSecret: dd05f1c54d63749eda95f9fa6d49v442a
   signatureSecret: dd05f1c54d63749eda95f9fa6d49v442a
   #签名拦截接口
   #签名拦截接口
   signUrls: /sys/dict/getDictItems/*,/sys/dict/loadDict/*,/sys/dict/loadDictOrderByValue/*,/sys/dict/loadDictItem/*,/sys/dict/loadTreeData,/sys/api/queryTableDictItemsByCode,/sys/api/queryFilterTableDictInfo,/sys/api/queryTableDictByKeys,/sys/api/translateDictFromTable,/sys/api/translateDictFromTableByKeys,/sys/sendChangePwdSms,/sys/user/sendChangePhoneSms,/sys/sms,/desform/api/sendVerifyCode
   signUrls: /sys/dict/getDictItems/*,/sys/dict/loadDict/*,/sys/dict/loadDictOrderByValue/*,/sys/dict/loadDictItem/*,/sys/dict/loadTreeData,/sys/api/queryTableDictItemsByCode,/sys/api/queryFilterTableDictInfo,/sys/api/queryTableDictByKeys,/sys/api/translateDictFromTable,/sys/api/translateDictFromTableByKeys,/sys/sendChangePwdSms,/sys/user/sendChangePhoneSms,/sys/sms,/desform/api/sendVerifyCode
-  # local\minio\alioss
+  # 本地:local、Minio:minio、阿里云:alioss
   uploadType: local
   uploadType: local
   # 前端访问地址
   # 前端访问地址
   domainUrl:
   domainUrl:
@@ -215,9 +215,9 @@ jeecg:
     app: http://localhost:8051
     app: http://localhost:8051
   path:
   path:
     #文件上传根目录 设置
     #文件上传根目录 设置
-    upload: D://opt//upFiles
+    upload:  D://opt/upFiles
     #webapp文件路径
     #webapp文件路径
-    webapp: D://opt//webapp
+    webapp:  D://opt/webapp
   shiro:
   shiro:
     excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/bigscreen/category/**,/bigscreen/visual/**,/bigscreen/map/**,/jmreport/bigscreen2/**
     excludeUrls: /test/jeecgDemo/demo3,/test/jeecgDemo/redisDemo/**,/bigscreen/category/**,/bigscreen/visual/**,/bigscreen/map/**,/jmreport/bigscreen2/**
   #阿里云oss存储和大鱼短信秘钥配置
   #阿里云oss存储和大鱼短信秘钥配置
@@ -226,30 +226,29 @@ jeecg:
     secretKey: ??
     secretKey: ??
     endpoint: oss-cn-beijing.aliyuncs.com
     endpoint: oss-cn-beijing.aliyuncs.com
     bucketName: jeecgdev
     bucketName: jeecgdev
-    staticDomain: https://static.jeecg.com
-  # ElasticSearch 设置
+  # ElasticSearch 6设置
   elasticsearch:
   elasticsearch:
     cluster-name: jeecg-ES
     cluster-name: jeecg-ES
-    cluster-nodes: 192.168.1.188:9200
+    cluster-nodes: 127.0.0.1:9200
     check-enabled: false
     check-enabled: false
   # 在线预览文件服务器地址配置
   # 在线预览文件服务器地址配置
-  file-view-domain: http://127.0.0.1:8012
+  file-view-domain: http://fileview.jeecg.com
   # minio文件上传
   # minio文件上传
   minio:
   minio:
     minio_url: http://minio.jeecg.com
     minio_url: http://minio.jeecg.com
     minio_name: ??
     minio_name: ??
     minio_pass: ??
     minio_pass: ??
-    bucketName: ??
+    bucketName: otatest
   #大屏报表参数设置
   #大屏报表参数设置
   jmreport:
   jmreport:
     #多租户模式,默认值为空(created:按照创建人隔离、tenant:按照租户隔离) (v1.6.2+ 新增)
     #多租户模式,默认值为空(created:按照创建人隔离、tenant:按照租户隔离) (v1.6.2+ 新增)
-    saasMode: 
+    saasMode:
     # 平台上线安全配置(v1.6.2+ 新增)
     # 平台上线安全配置(v1.6.2+ 新增)
     firewall:
     firewall:
       # 数据源安全 (开启后,不允许使用平台数据源、SQL解析加签并且不允许查询数据库)
       # 数据源安全 (开启后,不允许使用平台数据源、SQL解析加签并且不允许查询数据库)
-      dataSourceSafe: true
+      dataSourceSafe: false
       # 低代码开发模式(dev:开发模式,prod:发布模式—关闭在线报表设计功能,分配角色admin、lowdeveloper可以放开限制)
       # 低代码开发模式(dev:开发模式,prod:发布模式—关闭在线报表设计功能,分配角色admin、lowdeveloper可以放开限制)
-      lowCodeMode: prod
+      lowCodeMode: dev
   #xxl-job配置
   #xxl-job配置
   xxljob:
   xxljob:
     enabled: false
     enabled: false
@@ -267,20 +266,34 @@ jeecg:
     password:
     password:
     type: STANDALONE
     type: STANDALONE
     enabled: true
     enabled: true
+  # ai-chat
+  ai-chat:
+    # 是否开启;必须。
+    enabled: false
+    # openAi接口秘钥,填写自己的apiKey;必须。
+    apiKey: "????"
+    # openAi域名,有代理就填代理的域名。默认:openAI官方apiHost
+    apiHost: "https://api.openai.com"
+    # 超时时间单位:s。默认 60s
+    timeout: 60
+    # 本地代理地址
+  #    proxy:
+  #      host: "http://127.0.0.1"
+  #      port: "7890"
   # 百度开放API配置
   # 百度开放API配置
   baidu-api:
   baidu-api:
     app-id: ??
     app-id: ??
     api-key: ??
     api-key: ??
     secret-key: ??
     secret-key: ??
 
 
+#cas单点登录
+cas:
+  prefixUrl: http://cas.example.org:8443/cas
 #Mybatis输出sql日志
 #Mybatis输出sql日志
 logging:
 logging:
   level:
   level:
     org.flywaydb: debug
     org.flywaydb: debug
-    org.jeecg.modules.system.mapper: info
-#cas单点登录
-cas:
-  prefixUrl: http://cas.example.org:8443/cas
+    org.jeecg.modules.system.mapper: debug
 #swagger
 #swagger
 knife4j:
 knife4j:
   #开启增强配置
   #开启增强配置
@@ -288,7 +301,7 @@ knife4j:
   #开启生产环境屏蔽
   #开启生产环境屏蔽
   production: false
   production: false
   basic:
   basic:
-    enable: true
+    enable: false
     username: jeecg
     username: jeecg
     password: jeecg1314
     password: jeecg1314
 #第三方登录
 #第三方登录

+ 1 - 1
jeecg-module-system/jeecg-system-start/src/main/resources/application.yml

@@ -2,4 +2,4 @@ spring:
   application:
   application:
     name: jeecg-system
     name: jeecg-system
   profiles:
   profiles:
-    active: '@profile.name@'
+    active: 'dev'

+ 3 - 0
srm-module-code/src/main/java/org/jeecg/modules/platCode/entity/PlatCommissionOrder.java

@@ -153,6 +153,9 @@ public class PlatCommissionOrder implements Serializable {
     @ApiModelProperty(value = "附件(attachs)")
     @ApiModelProperty(value = "附件(attachs)")
     private String attachs;
     private String attachs;
 
 
+    //组织  上海/香港
+    @Excel(name = "组织(organize)", width = 15)
+    private String organize;
 
 
     @TableField(exist = false)
     @TableField(exist = false)
     private String currencyText;
     private String currencyText;

+ 3 - 1
srm-module-code/src/main/java/org/jeecg/modules/platCode/vo/PlatCommissionOrderPage.java

@@ -141,9 +141,11 @@ public class PlatCommissionOrderPage {
 	@ApiModelProperty(value = "备注(notes)")
 	@ApiModelProperty(value = "备注(notes)")
     private String notes;
     private String notes;
 	/**附件(attachs)*/
 	/**附件(attachs)*/
-	@Excel(name = "附件(attachs)", width = 15)
 	@ApiModelProperty(value = "附件(attachs)")
 	@ApiModelProperty(value = "附件(attachs)")
     private String attachs;
     private String attachs;
+	//组织  上海/香港
+	@Excel(name = "组织(organize)", width = 15)
+	private String organize;
 
 
 	@ExcelCollection(name="佣金订单-子表")
 	@ExcelCollection(name="佣金订单-子表")
 	@ApiModelProperty(value = "佣金订单-子表")
 	@ApiModelProperty(value = "佣金订单-子表")

+ 1 - 1
srm-module-code/src/main/java/org/jeecg/modules/purCode/controller/PurInquiryFormController.java

@@ -290,7 +290,7 @@ public class PurInquiryFormController {
 
 
                 for (PurInquiryFormProduct p : productList) {
                 for (PurInquiryFormProduct p : productList) {
 
 
-                    String sourceId = p.getSourceId();
+                    String sourceId = p.getSourceId() == "" || p.getSourceId() == null ? p.getProductCode() : p.getSourceId();
                     if (map.containsKey(sourceId)) {
                     if (map.containsKey(sourceId)) {
                         continue;
                         continue;
                     }
                     }

+ 35 - 1
srm-module-code/src/main/java/org/jeecg/modules/purCode/controller/PurOrderController.java

@@ -469,7 +469,7 @@ public class PurOrderController {
 
 
             if (status != null && status.equals(1)) {
             if (status != null && status.equals(1)) {
 //            if (status != null && status == 1) {
 //            if (status != null && status == 1) {
-                sb.append("单号" + code).append("客户已确认,无法取消提交;");
+                sb.append("单号" + code).append("供应商已确认,无法取消提交;");
                 continue;
                 continue;
             }
             }
             if (submit == null || submit == "" || submit.equals("0")) {
             if (submit == null || submit == "" || submit.equals("0")) {
@@ -755,6 +755,7 @@ public class PurOrderController {
         if (purOrder == null) {
         if (purOrder == null) {
             return Result.error("未找到对应数据");
             return Result.error("未找到对应数据");
         }
         }
+        purOrder.setOldBiz(purOrder.getCurrency());
         return Result.OK(purOrder);
         return Result.OK(purOrder);
 
 
     }
     }
@@ -815,6 +816,7 @@ public class PurOrderController {
 
 
                 product.setDiscount(new BigDecimal("0"));
                 product.setDiscount(new BigDecimal("0"));
                 product.setTaxPriceOriginal(product.getTaxPrice());
                 product.setTaxPriceOriginal(product.getTaxPrice());
+                product.setOldNum(product.getTaxPrice());
 
 
                 SaleOrderProduct saleOrderProduct = saleOrderProductList.stream().filter(e -> e.getId().equals(product.getSourceId())).findFirst().orElse(null);
                 SaleOrderProduct saleOrderProduct = saleOrderProductList.stream().filter(e -> e.getId().equals(product.getSourceId())).findFirst().orElse(null);
                 if (saleOrderProduct != null) {
                 if (saleOrderProduct != null) {
@@ -833,6 +835,7 @@ public class PurOrderController {
                                 BigDecimal setTaxPrice = getSalePrice.divide(dis, 2, BigDecimal.ROUND_HALF_UP);
                                 BigDecimal setTaxPrice = getSalePrice.divide(dis, 2, BigDecimal.ROUND_HALF_UP);
 
 
                                 product.setTaxPriceOriginal(setTaxPrice);
                                 product.setTaxPriceOriginal(setTaxPrice);
+                                product.setOldNum(setTaxPrice);
                             }
                             }
                         }
                         }
 
 
@@ -889,6 +892,37 @@ public class PurOrderController {
         return mv;
         return mv;
     }
     }
 
 
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param purOrder
+     */
+    @RequiresPermissions("purCode:pur_order:exportXls")
+    @RequestMapping(value = "/exportXls2")
+    public ModelAndView exportXls2(HttpServletRequest request, PurOrder purOrder) {
+        // Step.1 组装查询条件查询数据
+        QueryWrapper<PurOrder> queryWrapper = QueryGenerator.initQueryWrapper(purOrder, request.getParameterMap());
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+        //配置选中数据查询条件
+        String selections = request.getParameter("selections");
+        if (oConvertUtils.isNotEmpty(selections)) {
+            List<String> selectionList = Arrays.asList(selections.split(","));
+            queryWrapper.in("id", selectionList);
+        }
+        //Step.2 获取导出数据
+        List<PurOrder> purOrderList = purOrderService.list(queryWrapper);
+
+        // Step.4 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        mv.addObject(NormalExcelConstants.FILE_NAME, "采购订单列表");
+        mv.addObject(NormalExcelConstants.CLASS, PurOrder.class);
+        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("采购订单数据", "导出人:" + sysUser.getRealname(), "采购订单"));
+        mv.addObject(NormalExcelConstants.DATA_LIST, purOrderList);
+        return mv;
+    }
+
     /**
     /**
      * 通过excel导入数据
      * 通过excel导入数据
      *
      *

+ 166 - 1
srm-module-code/src/main/java/org/jeecg/modules/purCode/controller/PurPurchaseQuotationController.java

@@ -17,6 +17,7 @@ import org.jeecg.modules.baseCode.service.ISerialPatternService;
 import org.jeecg.modules.purCode.entity.*;
 import org.jeecg.modules.purCode.entity.*;
 import org.jeecg.modules.purCode.service.*;
 import org.jeecg.modules.purCode.service.*;
 import org.jeecg.modules.purCode.vo.SupplierQuotationDetails;
 import org.jeecg.modules.purCode.vo.SupplierQuotationDetails;
+import org.jeecg.modules.saleCode.entity.SaleQuotation;
 import org.jeecg.modules.saleCode.service.ISaleQuotationService;
 import org.jeecg.modules.saleCode.service.ISaleQuotationService;
 import org.jeecg.modules.saleCode.vo.SaleInquiryFormAlert;
 import org.jeecg.modules.saleCode.vo.SaleInquiryFormAlert;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
@@ -75,6 +76,8 @@ public class PurPurchaseQuotationController {
     private IPurOrderService purOrderService;
     private IPurOrderService purOrderService;
     @Autowired
     @Autowired
     private IBaseExchangeRateService baseExchangeRateService;
     private IBaseExchangeRateService baseExchangeRateService;
+    @Autowired
+    private IPurQuotationSelectionProductService purQuotationSelectionProductService;
 
 
 
 
     /**
     /**
@@ -100,6 +103,39 @@ public class PurPurchaseQuotationController {
         return Result.OK(pageList);
         return Result.OK(pageList);
     }
     }
 
 
+
+    @ApiOperation(value = "获取采购报价单中的技术资料", notes = "获取采购报价单中的技术资料-分页列表查询")
+    @GetMapping(value = "/queryByFileList")
+    public Result<IPage<PurPurchaseQuotation>> queryByFileList(PurPurchaseQuotation purPurchaseQuotation,
+                                                             @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                             @RequestParam(name = "pageSize", defaultValue = "100") Integer pageSize,
+                                                             HttpServletRequest req) {
+
+        String id = purPurchaseQuotation.getId();
+        purPurchaseQuotation.setId(null);
+
+        QueryWrapper<PurPurchaseQuotation> queryWrapper = QueryGenerator.initQueryWrapper(purPurchaseQuotation, req.getParameterMap());
+        Page<PurPurchaseQuotation> page = new Page<PurPurchaseQuotation>(pageNo, pageSize);
+
+        List<PurQuotationSelectionProduct> listChild = purQuotationSelectionProductService.selectByMainId(id);
+        if(listChild.size() > 0){
+
+            String result = listChild.stream()
+                    .map(product -> String.valueOf(product.getSourceId2()))
+                    .collect(Collectors.joining(","));
+
+//            List<String> test = listChild.stream().map(PurQuotationSelectionProduct::getSourceId2).collect(Collectors.toList());
+
+            queryWrapper.in("id", Arrays.asList(result.split(",")));
+            IPage<PurPurchaseQuotation> pageList = purPurchaseQuotationService.page(page, queryWrapper);
+
+            return Result.OK(pageList);
+        }else {
+            return null;
+        }
+
+    }
+
     /**
     /**
      * 采购报价单选定页签 - 供应商报价明细
      * 采购报价单选定页签 - 供应商报价明细
      *
      *
@@ -192,6 +228,10 @@ public class PurPurchaseQuotationController {
      */
      */
     public BigDecimal getRateByUsd(Date yearMonth, String currency) {
     public BigDecimal getRateByUsd(Date yearMonth, String currency) {
 
 
+        if("美元".equals(currency)){
+            return BigDecimal.ONE;
+        }
+
         String year = String.valueOf(yearMonth.getYear() + 1900);
         String year = String.valueOf(yearMonth.getYear() + 1900);
         String month = String.valueOf(yearMonth.getMonth() + 1);
         String month = String.valueOf(yearMonth.getMonth() + 1);
 
 
@@ -224,7 +264,7 @@ public class PurPurchaseQuotationController {
                 exchangeRate = list2.get(0).getExchangeRate();
                 exchangeRate = list2.get(0).getExchangeRate();
             } else {
             } else {
 
 
-                return BigDecimal.ONE;
+                return BigDecimal.ZERO;
             }
             }
 
 
         }
         }
@@ -258,6 +298,22 @@ public class PurPurchaseQuotationController {
         return Result.OK(pageList);
         return Result.OK(pageList);
     }
     }
 
 
+
+    /**
+     * 查看历史报价
+     *
+     * @return
+     */
+    @ApiOperation(value = "采购报价单-查看历史报价", notes = "采购报价单-查看历史报价")
+    @GetMapping(value = "/queryHisByInfo")
+    public Result<List<PurPurchaseQuotation>> queryHisByInfo(@RequestParam(name = "quotationSuppiler", required = true) String quotationSuppiler,
+                                                      @RequestParam(name = "productId", required = true) String productId) {
+        List<PurPurchaseQuotation> saleQuotationProductList = purPurchaseQuotationService.selectHisByInfo(quotationSuppiler,productId);
+
+        return Result.OK(saleQuotationProductList);
+    }
+
+
     /**
     /**
      * 供应商报价汇总金额
      * 供应商报价汇总金额
      *
      *
@@ -461,6 +517,7 @@ public class PurPurchaseQuotationController {
         if (list.size() == 0) {
         if (list.size() == 0) {
             return Result.error("数据为空!");
             return Result.error("数据为空!");
         }
         }
+//        List<String> listId = new ArrayList<>();
 
 
         StringBuffer sb = new StringBuffer();
         StringBuffer sb = new StringBuffer();
         for (PurPurchaseQuotation o : list) {
         for (PurPurchaseQuotation o : list) {
@@ -472,6 +529,24 @@ public class PurPurchaseQuotationController {
                 sb.append("单据编码" + code).append("已提交,请勿再次提交;");
                 sb.append("单据编码" + code).append("已提交,请勿再次提交;");
                 continue;
                 continue;
             }
             }
+
+//            BigDecimal totalAmount = o.getTotalAmount();
+//            String currency = o.getCurrency();
+//            String id = o.getId();
+//
+//            if(!"美元".equals(currency)){
+//
+//                BigDecimal rate = this.getRateByUsd(new Date(), currency);
+//                if(rate.compareTo(BigDecimal.ZERO) == 0){
+//                    return Result.error("当前币种("+currency+")未维护汇率,无法提交!");
+//                }
+//                totalAmount = totalAmount.multiply(rate);
+//
+//            }
+//            if(totalAmount.compareTo(new BigDecimal("2000")) >= 0 ){
+//                listId.add(id);
+//            }
+
         }
         }
 
 
         if (StringUtils.isNotBlank(sb.toString())) {
         if (StringUtils.isNotBlank(sb.toString())) {
@@ -483,9 +558,68 @@ public class PurPurchaseQuotationController {
         ent.setSubmit("1");
         ent.setSubmit("1");
         purPurchaseQuotationService.update(ent, queryWrapper);
         purPurchaseQuotationService.update(ent, queryWrapper);
 
 
+//        if(listId.size() > 0){
+//
+//            QueryWrapper<PurPurchaseQuotation> queryWrapper2 = new QueryWrapper<>();
+//            queryWrapper2.in("id",listId);
+//            PurPurchaseQuotation ent2 = new PurPurchaseQuotation();
+////            提交(1是 0否 2待审核)
+//            ent2.setSubmit("2");
+//            purPurchaseQuotationService.update(ent2, queryWrapper2);
+//
+//            return Result.OK("提交成功(本单报价金额超过2000美金,需上级审批)!");
+//        }
+
         return Result.OK("提交成功!");
         return Result.OK("提交成功!");
     }
     }
 
 
+    /**
+     * 审批
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "采购报价单-审批")
+    @ApiOperation(value = "采购报价单-审批", notes = "采购报价单-审批")
+    @RequiresPermissions("purCode:pur_purchase_quotation:approval")
+    @GetMapping(value = "/approvalBatch")
+    public Result<String> approvalBatch(@RequestParam(name = "ids", required = true) String ids) {
+
+        QueryWrapper<PurPurchaseQuotation> queryWrapper = new QueryWrapper<>();
+        queryWrapper.in("id", Arrays.asList(ids.split(",")));
+
+        List<PurPurchaseQuotation> list = purPurchaseQuotationService.list(queryWrapper);
+        if (list.size() == 0) {
+            return Result.error("数据为空!");
+        }
+
+        StringBuffer sb = new StringBuffer();
+        for (PurPurchaseQuotation o : list) {
+            //提交(1-是 ,0-否 ,2-待审批)
+            String submit = o.getSubmit();
+            String code = o.getBillCode();
+
+            if (submit != null && submit != "" && !submit.equals("2")) {
+                sb.append("单据编码" + code).append("无需审批;");
+                continue;
+            }
+
+        }
+
+        if (StringUtils.isNotBlank(sb.toString())) {
+
+            return Result.error(sb.toString());
+        }
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        PurPurchaseQuotation ent = new PurPurchaseQuotation();
+        ent.setSubmit("1");
+        ent.setApprovalBy(sysUser.getUsername());
+        ent.setApprovalTime(new Date());
+        purPurchaseQuotationService.update(ent, queryWrapper);
+
+        return Result.OK("审批成功!");
+    }
+
     /**
     /**
      * 批量取消提交
      * 批量取消提交
      *
      *
@@ -633,6 +767,37 @@ public class PurPurchaseQuotationController {
         return mv;
         return mv;
     }
     }
 
 
+    /**
+     * 导出excel
+     *
+     * @param request
+     * @param purPurchaseQuotation
+     */
+    @RequiresPermissions("purCode:pur_purchase_quotation:exportXls")
+    @RequestMapping(value = "/exportXls2")
+    public ModelAndView exportXls2(HttpServletRequest request, PurPurchaseQuotation purPurchaseQuotation) {
+        // Step.1 组装查询条件查询数据
+        QueryWrapper<PurPurchaseQuotation> queryWrapper = QueryGenerator.initQueryWrapper(purPurchaseQuotation, request.getParameterMap());
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+
+        //配置选中数据查询条件
+        String selections = request.getParameter("selections");
+        if (oConvertUtils.isNotEmpty(selections)) {
+            List<String> selectionList = Arrays.asList(selections.split(","));
+            queryWrapper.in("id", selectionList);
+        }
+        //Step.2 获取导出数据
+        List<PurPurchaseQuotation> purPurchaseQuotationList = purPurchaseQuotationService.list(queryWrapper);
+
+        // Step.4 AutoPoi 导出Excel
+        ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
+        mv.addObject(NormalExcelConstants.FILE_NAME, "采购报价单列表");
+        mv.addObject(NormalExcelConstants.CLASS, PurPurchaseQuotation.class);
+        mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("采购报价单数据", "导出人:" + sysUser.getRealname(), "采购报价单"));
+        mv.addObject(NormalExcelConstants.DATA_LIST, purPurchaseQuotationList);
+        return mv;
+    }
+
     /**
     /**
      * 通过excel导入数据
      * 通过excel导入数据
      *
      *

+ 87 - 6
srm-module-code/src/main/java/org/jeecg/modules/purCode/controller/PurQuotationSelectionController.java

@@ -1,20 +1,18 @@
 package org.jeecg.modules.purCode.controller;
 package org.jeecg.modules.purCode.controller;
 
 
+import java.io.InputStreamReader;
 import java.io.UnsupportedEncodingException;
 import java.io.UnsupportedEncodingException;
 import java.io.IOException;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.net.URLDecoder;
 import java.net.URLDecoder;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
-import java.util.HashMap;
 
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
 
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.StringUtils;
+import org.apache.logging.log4j.util.PropertiesUtil;
 import org.jeecg.common.aspect.annotation.PermissionData;
 import org.jeecg.common.aspect.annotation.PermissionData;
 import org.jeecg.modules.baseCode.service.ISerialPatternService;
 import org.jeecg.modules.baseCode.service.ISerialPatternService;
 import org.jeecg.modules.purCode.entity.*;
 import org.jeecg.modules.purCode.entity.*;
@@ -52,7 +50,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.jeecg.common.aspect.annotation.AutoLog;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
-
+import org.springframework.core.env.Environment;
 
 
 /**
 /**
  * @Description: 采购报价选定
  * @Description: 采购报价选定
@@ -87,6 +85,10 @@ public class PurQuotationSelectionController {
     @Autowired
     @Autowired
     private IPurPurchaseQuotationProductService purPurchaseInquiryProductService;
     private IPurPurchaseQuotationProductService purPurchaseInquiryProductService;
 
 
+    @Autowired
+    private Environment environment;
+
+
     /**
     /**
      * 分页列表查询
      * 分页列表查询
      *
      *
@@ -394,6 +396,53 @@ public class PurQuotationSelectionController {
     }
     }
 
 
 
 
+    /**
+     * 审批
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "报价选定大额审批")
+    @ApiOperation(value = "报价选定大额审批-审批", notes = "报价选定大额审批-审批")
+    @RequiresPermissions("purCode:pur_quotation_selection:approval")
+    @GetMapping(value = "/approvalBatch")
+    public Result<String> approvalBatch(@RequestParam(name = "ids", required = true) String ids) {
+
+        QueryWrapper<PurQuotationSelection> queryWrapper = new QueryWrapper<>();
+        queryWrapper.in("id", Arrays.asList(ids.split(",")));
+
+        List<PurQuotationSelection> list = purQuotationSelectionService.list(queryWrapper);
+        if (list.size() == 0) {
+            return Result.error("数据为空!");
+        }
+
+        StringBuffer sb = new StringBuffer();
+        for (PurQuotationSelection o : list) {
+            //提交(1-是 ,0-否 ,2-待审批)
+            String submit = o.getSubmit();
+            String code = o.getBillCode();
+
+            if (submit != null && submit != "" && !submit.equals("2")) {
+                sb.append("单据编码" + code).append("无需审批;");
+                continue;
+            }
+
+        }
+
+        if (StringUtils.isNotBlank(sb.toString())) {
+
+            return Result.error(sb.toString());
+        }
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        PurQuotationSelection ent = new PurQuotationSelection();
+        ent.setSubmit("1");
+        ent.setApprovalBy(sysUser.getUsername());
+        ent.setApprovalTime(new Date());
+        purQuotationSelectionService.update(ent, queryWrapper);
+
+        return Result.OK("审批成功!");
+    }
+
     /**
     /**
      * 批量提交
      * 批量提交
      *
      *
@@ -413,6 +462,8 @@ public class PurQuotationSelectionController {
             return Result.error("数据为空!");
             return Result.error("数据为空!");
         }
         }
 
 
+        List<String> listId = new ArrayList<>();
+
         StringBuffer sb = new StringBuffer();
         StringBuffer sb = new StringBuffer();
         for (PurQuotationSelection o : list) {
         for (PurQuotationSelection o : list) {
             //提交(1-是 ,0-否)
             //提交(1-是 ,0-否)
@@ -423,6 +474,13 @@ public class PurQuotationSelectionController {
                 sb.append("单据编码" + code).append("已提交,请勿再次提交;");
                 sb.append("单据编码" + code).append("已提交,请勿再次提交;");
                 continue;
                 continue;
             }
             }
+
+            BigDecimal totalAmountUsd = o.getTotalAmountUsd() == null ? BigDecimal.ZERO : o.getTotalAmountUsd();
+            String id = o.getId();
+            if(totalAmountUsd.compareTo(new BigDecimal("2000")) >= 0 ){
+                listId.add(id);
+            }
+
         }
         }
 
 
         if (StringUtils.isNotBlank(sb.toString())) {
         if (StringUtils.isNotBlank(sb.toString())) {
@@ -434,9 +492,28 @@ public class PurQuotationSelectionController {
         ent.setSubmit("1");
         ent.setSubmit("1");
         purQuotationSelectionService.update(ent, queryWrapper);
         purQuotationSelectionService.update(ent, queryWrapper);
 
 
+        if(listId.size() > 0){
+
+            String active = getActiveProfile();
+            if(StringUtils.isNotBlank(active) && active.equals("dev")){
+
+                QueryWrapper<PurQuotationSelection> queryWrapper2 = new QueryWrapper<>();
+                queryWrapper2.in("id",listId);
+                PurQuotationSelection ent2 = new PurQuotationSelection();
+//              提交(1是 0否 2待审核)
+                ent2.setSubmit("2");
+                purQuotationSelectionService.update(ent2, queryWrapper2);
+
+                return Result.OK("提交成功(本单报价金额超过2000美金,需上级审批)!");
+            }
+
+        }
+
         return Result.OK("提交成功!");
         return Result.OK("提交成功!");
     }
     }
 
 
+
+
     /**
     /**
      * 批量取消提交
      * 批量取消提交
      *
      *
@@ -672,4 +749,8 @@ public class PurQuotationSelectionController {
         return Result.OK("文件导入失败!");
         return Result.OK("文件导入失败!");
     }
     }
 
 
+    public String getActiveProfile() {
+        return environment.getProperty("spring.profiles.active");
+    }
+
 }
 }

+ 9 - 8
srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurOrder.java

@@ -72,7 +72,7 @@ public class PurOrder implements Serializable {
     @ApiModelProperty(value = "更新时间")
     @ApiModelProperty(value = "更新时间")
     private Date updateTime;
     private Date updateTime;
 	/**客户确认(1-已确认,0-未确认)*/
 	/**客户确认(1-已确认,0-未确认)*/
-	@Excel(name = "供应商确认(1-已确认,0-未确认)", width = 15)
+    @Excel(name = "供应商确认", width = 15,dicCode = "yes_or_no")
     @ApiModelProperty(value = "供应商确认(1-已确认,0-未确认)")
     @ApiModelProperty(value = "供应商确认(1-已确认,0-未确认)")
     @Dict(dicCode = "customer_confirm")
     @Dict(dicCode = "customer_confirm")
     private Integer status;
     private Integer status;
@@ -111,7 +111,6 @@ public class PurOrder implements Serializable {
     @ApiModelProperty(value = "项目名称")
     @ApiModelProperty(value = "项目名称")
     private String projectName;
     private String projectName;
 	/**供应商(supplier)*/
 	/**供应商(supplier)*/
-	@Excel(name = "供应商(supplier)", width = 15)
     @ApiModelProperty(value = "供应商(supplier)")
     @ApiModelProperty(value = "供应商(supplier)")
     private String supplier;
     private String supplier;
 	/**供应商名称*/
 	/**供应商名称*/
@@ -145,7 +144,7 @@ public class PurOrder implements Serializable {
     @ApiModelProperty(value = "贸易条款(trade Terms)")
     @ApiModelProperty(value = "贸易条款(trade Terms)")
     private String tradeTerms;
     private String tradeTerms;
 	/**是否出口(export)*/
 	/**是否出口(export)*/
-	@Excel(name = "是否出口(export)", width = 15)
+	@Excel(name = "是否出口(export)", width = 15,dicCode = "yes_or_no")
     @ApiModelProperty(value = "是否出口(export)")
     @ApiModelProperty(value = "是否出口(export)")
     private String isExport;
     private String isExport;
 	/**包装要求(packageb requirement)*/
 	/**包装要求(packageb requirement)*/
@@ -189,14 +188,14 @@ public class PurOrder implements Serializable {
     @ApiModelProperty(value = "汇率(exchange rate)")
     @ApiModelProperty(value = "汇率(exchange rate)")
     private java.math.BigDecimal exchangeRate;
     private java.math.BigDecimal exchangeRate;
 	/**采购员(purchaseman)*/
 	/**采购员(purchaseman)*/
-	@Excel(name = "采购员(purchaseman)", width = 15)
     @ApiModelProperty(value = "采购员(purchaseman)")
     @ApiModelProperty(value = "采购员(purchaseman)")
     private String purchaseman;
     private String purchaseman;
 	/**采购部门(purchase department)*/
 	/**采购部门(purchase department)*/
-	@Excel(name = "采购部门(purchase department)", width = 15)
     @ApiModelProperty(value = "采购部门(purchase department)")
     @ApiModelProperty(value = "采购部门(purchase department)")
     private String purchaseDepartment;
     private String purchaseDepartment;
+    @Excel(name = "采购部门(purchase department)", width = 15)
     private String purchaseDepartmentName;
     private String purchaseDepartmentName;
+    @Excel(name = "采购员(purchaseman)", width = 15)
     private String purchasemanName;
     private String purchasemanName;
 	/**币种(currency)*/
 	/**币种(currency)*/
 	@Excel(name = "币种(currency)", width = 15)
 	@Excel(name = "币种(currency)", width = 15)
@@ -207,15 +206,13 @@ public class PurOrder implements Serializable {
     @ApiModelProperty(value = "备注(notes)")
     @ApiModelProperty(value = "备注(notes)")
     private String notes;
     private String notes;
 	/**附件(attachs)*/
 	/**附件(attachs)*/
-	@Excel(name = "附件(attachs)", width = 15)
     @ApiModelProperty(value = "附件(attachs)")
     @ApiModelProperty(value = "附件(attachs)")
     private String attachs;
     private String attachs;
 	/**版本号*/
 	/**版本号*/
-	@Excel(name = "版本号", width = 15)
     @ApiModelProperty(value = "版本号")
     @ApiModelProperty(value = "版本号")
     private String version;
     private String version;
 	/**来源*/
 	/**来源*/
-	@Excel(name = "来源", width = 15)
+	@Excel(name = "来源 报价选定", width = 15)
     @ApiModelProperty(value = "来源")
     @ApiModelProperty(value = "来源")
     private String sourceCode;
     private String sourceCode;
 	/**来源2*/
 	/**来源2*/
@@ -233,6 +230,7 @@ public class PurOrder implements Serializable {
     //采购整单折扣
     //采购整单折扣
     private BigDecimal discountHead;
     private BigDecimal discountHead;
     //折后金额(整单折扣)
     //折后金额(整单折扣)
+    @Excel(name = "折后金额", width = 15)
     private BigDecimal discountAmount;
     private BigDecimal discountAmount;
 
 
 
 
@@ -266,4 +264,7 @@ public class PurOrder implements Serializable {
     private String discountHeadText;
     private String discountHeadText;
     @TableField(exist = false)
     @TableField(exist = false)
     private BigDecimal discountHeadMoney;
     private BigDecimal discountHeadMoney;
+
+    @TableField(exist = false)
+    private String oldBiz;
 }
 }

+ 4 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurOrderProduct.java

@@ -169,4 +169,8 @@ public class PurOrderProduct implements Serializable {
     private String discountText;
     private String discountText;
     //报价变更后的来源id
     //报价变更后的来源id
     private String changeSource;
     private String changeSource;
+
+    //前端修改汇率时临时使用
+    @TableField(exist = false)
+    private BigDecimal oldNum;
 }
 }

+ 13 - 6
srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurPurchaseQuotation.java

@@ -39,6 +39,15 @@ public class PurPurchaseQuotation implements Serializable {
     private String createBy;
     private String createBy;
     private String sysOrgCode;
     private String sysOrgCode;
 
 
+    //审批人
+    private String approvalBy;
+
+	/**审批时间*/
+	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "审批时间")
+    private Date approvalTime;
+
 	/**创建时间*/
 	/**创建时间*/
 	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
 	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
@@ -53,7 +62,7 @@ public class PurPurchaseQuotation implements Serializable {
     @ApiModelProperty(value = "更新时间")
     @ApiModelProperty(value = "更新时间")
     private Date updateTime;
     private Date updateTime;
 	/**状态(1-结束,0-报价中)*/
 	/**状态(1-结束,0-报价中)*/
-	@Excel(name = "状态(1-结束,0-报价中)", width = 15)
+//	@Excel(name = "状态", width = 15,dicCode = "yes_or_no")
     @ApiModelProperty(value = "状态(1-结束,0-报价中)")
     @ApiModelProperty(value = "状态(1-结束,0-报价中)")
     @Dict(dicCode = "yes_or_no")
     @Dict(dicCode = "yes_or_no")
     private Integer status;
     private Integer status;
@@ -63,8 +72,8 @@ public class PurPurchaseQuotation implements Serializable {
     @TableLogic
     @TableLogic
     private Integer delFlag;
     private Integer delFlag;
 	/**提交(1是 0否)*/
 	/**提交(1是 0否)*/
-	@Excel(name = "提交(1是 0否)", width = 15)
-    @ApiModelProperty(value = "提交(1是 0否)")
+	@Excel(name = "提交", width = 15,dicCode = "yes_or_no")
+    @ApiModelProperty(value = "提交(1是 0否 2待审核)")
     @Dict(dicCode = "yes_or_no")
     @Dict(dicCode = "yes_or_no")
     private String submit;
     private String submit;
 	/**单据日期(bill date)*/
 	/**单据日期(bill date)*/
@@ -78,7 +87,6 @@ public class PurPurchaseQuotation implements Serializable {
     @ApiModelProperty(value = "报价单号(bill code)")
     @ApiModelProperty(value = "报价单号(bill code)")
     private String billCode;
     private String billCode;
 	/**报价项目(quotation project)*/
 	/**报价项目(quotation project)*/
-	@Excel(name = "报价项目(quotation project)", width = 15)
     @ApiModelProperty(value = "报价项目(quotation project)")
     @ApiModelProperty(value = "报价项目(quotation project)")
     @Dict(dictTable = "base_project_archive", dicCode = "id", dicText = "status")
     @Dict(dictTable = "base_project_archive", dicCode = "id", dicText = "status")
     private String quotationProject;
     private String quotationProject;
@@ -87,7 +95,6 @@ public class PurPurchaseQuotation implements Serializable {
     @ApiModelProperty(value = "项目名称")
     @ApiModelProperty(value = "项目名称")
     private String projectName;
     private String projectName;
 	/**报价供应商(quotation supplier)*/
 	/**报价供应商(quotation supplier)*/
-	@Excel(name = "报价供应商(quotation supplier)", width = 15)
     @ApiModelProperty(value = "报价供应商(quotation supplier)")
     @ApiModelProperty(value = "报价供应商(quotation supplier)")
     private String quotationSuppiler;
     private String quotationSuppiler;
 	/**供应商名称*/
 	/**供应商名称*/
@@ -168,7 +175,7 @@ public class PurPurchaseQuotation implements Serializable {
     private String sourceCode;
     private String sourceCode;
 
 
 	//交期天数
 	//交期天数
-    @Excel(name = "交期天数", width = 15)
+    @Excel(name = "交期天数(deliveryDay)", width = 15)
     @ApiModelProperty(value = "交期天数")
     @ApiModelProperty(value = "交期天数")
     private String deliveryDayHead;
     private String deliveryDayHead;
     //订单总金额
     //订单总金额

+ 10 - 1
srm-module-code/src/main/java/org/jeecg/modules/purCode/entity/PurQuotationSelection.java

@@ -60,7 +60,7 @@ public class PurQuotationSelection implements Serializable {
 	/**提交(1是 0否)*/
 	/**提交(1是 0否)*/
 	@Excel(name = "提交(1是 0否)", width = 15)
 	@Excel(name = "提交(1是 0否)", width = 15)
     @ApiModelProperty(value = "提交(1是 0否)")
     @ApiModelProperty(value = "提交(1是 0否)")
-    @Dict(dicCode = "yes_or_no")
+    @Dict(dicCode = "new_yes_or_no")
     private String submit;
     private String submit;
 	/**单据日期(bill date)*/
 	/**单据日期(bill date)*/
 	@Excel(name = "单据日期(bill date)", width = 15, format = "yyyy-MM-dd")
 	@Excel(name = "单据日期(bill date)", width = 15, format = "yyyy-MM-dd")
@@ -122,4 +122,13 @@ public class PurQuotationSelection implements Serializable {
 	private BigDecimal totalAmountUsd;
 	private BigDecimal totalAmountUsd;
     //质量等级
     //质量等级
     private String qualityGradeHead;
     private String qualityGradeHead;
+
+    //审批人
+    private String approvalBy;
+    /**审批时间*/
+    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
+    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
+    @ApiModelProperty(value = "审批时间")
+    private Date approvalTime;
+
 }
 }

+ 2 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/mapper/PurPurchaseQuotationMapper.java

@@ -16,4 +16,6 @@ public interface PurPurchaseQuotationMapper extends BaseMapper<PurPurchaseQuotat
 
 
     //更新报价状态
     //更新报价状态
     int changeType(@Param("code")String code,@Param("type")String type);
     int changeType(@Param("code")String code,@Param("type")String type);
+
+    List<PurPurchaseQuotation> selectHisByInfo(@Param("quotationSuppiler")String quotationSuppiler,@Param("productId")String productId);
 }
 }

+ 2 - 2
srm-module-code/src/main/java/org/jeecg/modules/purCode/mapper/xml/PurOrderProductMapper.xml

@@ -9,8 +9,8 @@
 			 head_id = #{mainId} 	</delete>
 			 head_id = #{mainId} 	</delete>
 	
 	
 	<select id="selectByMainId" parameterType="java.lang.String" resultType="org.jeecg.modules.purCode.entity.PurOrderProduct">
 	<select id="selectByMainId" parameterType="java.lang.String" resultType="org.jeecg.modules.purCode.entity.PurOrderProduct">
-		SELECT * 
-		FROM  pur_order_product
+		SELECT a.*,a.tax_price_original oldNum
+		FROM  pur_order_product a
 		WHERE
 		WHERE
 			 head_id = #{mainId} order by create_time asc  	</select>
 			 head_id = #{mainId} order by create_time asc  	</select>
 
 

+ 11 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/mapper/xml/PurPurchaseQuotationMapper.xml

@@ -7,4 +7,15 @@
         update pur_purchase_quotation set status =#{type} where source_code =#{code}
         update pur_purchase_quotation set status =#{type} where source_code =#{code}
 
 
     </update>
     </update>
+
+
+    <select id="selectHisByInfo" parameterType="java.lang.String" resultType="org.jeecg.modules.purCode.entity.PurPurchaseQuotation">
+
+        select b.project_name , a.tax_price total_amount,b.bill_date from pur_purchase_quotation_product a
+        left join pur_purchase_quotation b on a.head_id = b.id
+
+        where b.quotation_suppiler=#{quotationSuppiler} and a.product_id=#{productId} order by b.bill_date desc
+
+    </select>
+
 </mapper>
 </mapper>

+ 2 - 1
srm-module-code/src/main/java/org/jeecg/modules/purCode/mapper/xml/PurPurchaseQuotationProductMapper.xml

@@ -73,6 +73,7 @@
 						a.quotation_deadline ,
 						a.quotation_deadline ,
 						a.currency,
 						a.currency,
 						a.source_code,
 						a.source_code,
+						a.quotation_notes,
 						a.status,
 						a.status,
 						sum(b.tax_amount) taxAmount,
 						sum(b.tax_amount) taxAmount,
 						sum(b.tax_amount_original) taxAmountOriginal,
 						sum(b.tax_amount_original) taxAmountOriginal,
@@ -88,7 +89,7 @@
 						  a.project_name ,
 						  a.project_name ,
 						  a.suppiler_name ,
 						  a.suppiler_name ,
 						  a.quotation_deadline,
 						  a.quotation_deadline,
-						  a.quotation_project,a.currency,a.status,a.source_code
+						  a.quotation_project,a.currency,a.status,a.source_code,a.quotation_notes
 
 
 			 ) a
 			 ) a
 			${ew.customSqlSegment}
 			${ew.customSqlSegment}

+ 1 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/service/IPurPurchaseQuotationService.java

@@ -16,6 +16,7 @@ import java.util.List;
  */
  */
 public interface IPurPurchaseQuotationService extends IService<PurPurchaseQuotation> {
 public interface IPurPurchaseQuotationService extends IService<PurPurchaseQuotation> {
 
 
+	public List<PurPurchaseQuotation> selectHisByInfo(String quotationSuppiler, String productId);
 	/**
 	/**
 	 * 添加一对多
 	 * 添加一对多
 	 *
 	 *

+ 1 - 0
srm-module-code/src/main/java/org/jeecg/modules/purCode/service/impl/PurOrderServiceImpl.java

@@ -153,6 +153,7 @@ public class PurOrderServiceImpl extends ServiceImpl<PurOrderMapper, PurOrder> i
 				//外键设置
 				//外键设置
 				entity.setId(null);
 				entity.setId(null);
 				entity.setHeadId(purOrder.getId());
 				entity.setHeadId(purOrder.getId());
+				entity.setArrivalQuantity(BigDecimal.ZERO);
 				purOrderProductMapper.insert(entity);
 				purOrderProductMapper.insert(entity);
 
 
 				String sourceId = entity.getSourceId();
 				String sourceId = entity.getSourceId();

+ 8 - 1
srm-module-code/src/main/java/org/jeecg/modules/purCode/service/impl/PurPurchaseQuotationServiceImpl.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.purCode.service.impl;
 package org.jeecg.modules.purCode.service.impl;
 
 
+import org.apache.ibatis.annotations.Param;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.DateUtils;
 import org.jeecg.modules.purCode.entity.PurPurchaseQuotation;
 import org.jeecg.modules.purCode.entity.PurPurchaseQuotation;
 import org.jeecg.modules.purCode.entity.PurPurchaseQuotationShip;
 import org.jeecg.modules.purCode.entity.PurPurchaseQuotationShip;
@@ -32,7 +33,13 @@ public class PurPurchaseQuotationServiceImpl extends ServiceImpl<PurPurchaseQuot
 	private PurPurchaseQuotationShipMapper purPurchaseQuotationShipMapper;
 	private PurPurchaseQuotationShipMapper purPurchaseQuotationShipMapper;
 	@Autowired
 	@Autowired
 	private PurPurchaseQuotationProductMapper purPurchaseQuotationProductMapper;
 	private PurPurchaseQuotationProductMapper purPurchaseQuotationProductMapper;
-	
+
+
+	@Override
+	public List<PurPurchaseQuotation> selectHisByInfo(String quotationSuppiler, String productId) {
+		return purPurchaseQuotationMapper.selectHisByInfo(quotationSuppiler,productId);
+	}
+
 	@Override
 	@Override
 	@Transactional(rollbackFor = Exception.class)
 	@Transactional(rollbackFor = Exception.class)
 	public void saveMain(PurPurchaseQuotation purPurchaseQuotation, List<PurPurchaseQuotationShip> purPurchaseQuotationShipList,List<PurPurchaseQuotationProduct> purPurchaseQuotationProductList) {
 	public void saveMain(PurPurchaseQuotation purPurchaseQuotation, List<PurPurchaseQuotationShip> purPurchaseQuotationShipList,List<PurPurchaseQuotationProduct> purPurchaseQuotationProductList) {

+ 29 - 3
srm-module-code/src/main/java/org/jeecg/modules/purCode/service/impl/PurQuotationSelectionServiceImpl.java

@@ -138,7 +138,7 @@ public class PurQuotationSelectionServiceImpl extends ServiceImpl<PurQuotationSe
                 }
                 }
             }
             }
             if (StringUtils.isNotBlank(saleInCode)) {
             if (StringUtils.isNotBlank(saleInCode)) {
-                saleInquiryFormMapper.changeType(saleInCode, "1");//结束
+                saleInquiryFormMapper.changeType(saleInCode, "1");//结束 状态(1-已报价,0-未报价)
             }
             }
         }
         }
     }
     }
@@ -245,22 +245,37 @@ public class PurQuotationSelectionServiceImpl extends ServiceImpl<PurQuotationSe
 
 
         PurQuotationSelection oldEnt = purQuotationSelectionMapper.selectById(id);
         PurQuotationSelection oldEnt = purQuotationSelectionMapper.selectById(id);
         String sourceOld = oldEnt.getSourceId();
         String sourceOld = oldEnt.getSourceId();
+
         if (StringUtils.isNotBlank(sourceOld)) {
         if (StringUtils.isNotBlank(sourceOld)) {
+
             String saleInCode = "";
             String saleInCode = "";
             for (String o : sourceOld.split(",")) {
             for (String o : sourceOld.split(",")) {
+
                 if (StringUtils.isBlank(saleInCode)) {
                 if (StringUtils.isBlank(saleInCode)) {
+
                     QueryWrapper<PurInquiryForm> queryWrapper = new QueryWrapper();
                     QueryWrapper<PurInquiryForm> queryWrapper = new QueryWrapper();
                     queryWrapper.eq("bill_code", o);
                     queryWrapper.eq("bill_code", o);
                     List<PurInquiryForm> list = purInquiryFormMapper.selectList(queryWrapper);
                     List<PurInquiryForm> list = purInquiryFormMapper.selectList(queryWrapper);
+
                     if (list.size() > 0) {
                     if (list.size() > 0) {
+
                         saleInCode = list.get(0).getSourceCode();
                         saleInCode = list.get(0).getSourceCode();
+                        if(StringUtils.isBlank(saleInCode)){
+                            for(PurInquiryForm a:list){
+
+                                saleInCode = a.getSourceCode();
+                                if(StringUtils.isNotBlank(saleInCode)){
+                                    break;
+                                }
+                            }
+                        }
                     }
                     }
                 }
                 }
                 purPurchaseQuotationMapper.changeType(o, "0");//进行中
                 purPurchaseQuotationMapper.changeType(o, "0");//进行中
                 purInquiryFormMapper.changeType(o, "0");//进行中
                 purInquiryFormMapper.changeType(o, "0");//进行中
             }
             }
             if (StringUtils.isNotBlank(saleInCode)) {
             if (StringUtils.isNotBlank(saleInCode)) {
-                saleInquiryFormMapper.changeType(saleInCode, "0");//执行中
+                saleInquiryFormMapper.changeType(saleInCode, "0");//执行中 状态(1-已报价,0-未报价)
             }
             }
         }
         }
 
 
@@ -286,14 +301,25 @@ public class PurQuotationSelectionServiceImpl extends ServiceImpl<PurQuotationSe
                         List<PurInquiryForm> list = purInquiryFormMapper.selectList(queryWrapper);
                         List<PurInquiryForm> list = purInquiryFormMapper.selectList(queryWrapper);
                         if (list.size() > 0) {
                         if (list.size() > 0) {
                             saleInCode = list.get(0).getSourceCode();
                             saleInCode = list.get(0).getSourceCode();
+
+                            if(StringUtils.isBlank(saleInCode)){
+                                for(PurInquiryForm a:list){
+
+                                    saleInCode = a.getSourceCode();
+                                    if(StringUtils.isNotBlank(saleInCode)){
+                                        break;
+                                    }
+                                }
+                            }
                         }
                         }
+
                     }
                     }
 
 
                     purPurchaseQuotationMapper.changeType(o, "0");//进行中
                     purPurchaseQuotationMapper.changeType(o, "0");//进行中
                     purInquiryFormMapper.changeType(o, "0");//进行中
                     purInquiryFormMapper.changeType(o, "0");//进行中
                 }
                 }
                 if (StringUtils.isNotBlank(saleInCode)) {
                 if (StringUtils.isNotBlank(saleInCode)) {
-                    saleInquiryFormMapper.changeType(saleInCode, "0");//执行中
+                    saleInquiryFormMapper.changeType(saleInCode, "0");//执行中 状态(1-已报价,0-未报价)
                 }
                 }
             }
             }
 
 

+ 8 - 5
srm-module-code/src/main/java/org/jeecg/modules/purCode/vo/PurOrderPage.java

@@ -39,8 +39,6 @@ public class PurOrderPage {
 	//订单总金额(已被付款申请参照金额)
 	//订单总金额(已被付款申请参照金额)
 	private BigDecimal totalAmountUsed;
 	private BigDecimal totalAmountUsed;
 
 
-	private String purchaseDepartmentName;
-	private String purchasemanName;
 	/**主键id*/
 	/**主键id*/
 	@ApiModelProperty(value = "主键id")
 	@ApiModelProperty(value = "主键id")
     private String id;
     private String id;
@@ -78,7 +76,7 @@ public class PurOrderPage {
 	@ApiModelProperty(value = "更新时间")
 	@ApiModelProperty(value = "更新时间")
     private Date updateTime;
     private Date updateTime;
 	/**客户确认(1-已确认,0-未确认)*/
 	/**客户确认(1-已确认,0-未确认)*/
-	@Excel(name = "客户确认", width = 15,dicCode = "yes_or_no")
+	@Excel(name = "供应商确认", width = 15,dicCode = "yes_or_no")
 	@ApiModelProperty(value = "客户确认(1-已确认,0-未确认)")
 	@ApiModelProperty(value = "客户确认(1-已确认,0-未确认)")
     private Integer status;
     private Integer status;
 	/**提交(submit)1是0否*/
 	/**提交(submit)1是0否*/
@@ -185,13 +183,17 @@ public class PurOrderPage {
 	@ApiModelProperty(value = "汇率(exchange rate)")
 	@ApiModelProperty(value = "汇率(exchange rate)")
     private java.math.BigDecimal exchangeRate;
     private java.math.BigDecimal exchangeRate;
 	/**采购员(purchaseman)*/
 	/**采购员(purchaseman)*/
-	@Excel(name = "采购员(purchaseman)", width = 15)
 	@ApiModelProperty(value = "采购员(purchaseman)")
 	@ApiModelProperty(value = "采购员(purchaseman)")
     private String purchaseman;
     private String purchaseman;
 	/**采购部门(purchase department)*/
 	/**采购部门(purchase department)*/
-	@Excel(name = "采购部门(purchase department)", width = 15)
 	@ApiModelProperty(value = "采购部门(purchase department)")
 	@ApiModelProperty(value = "采购部门(purchase department)")
     private String purchaseDepartment;
     private String purchaseDepartment;
+
+	@Excel(name = "采购部门(purchase department)", width = 15)
+	private String purchaseDepartmentName;
+	@Excel(name = "采购员(purchaseman)", width = 15)
+	private String purchasemanName;
+
 	/**币种(currency)*/
 	/**币种(currency)*/
 	@Excel(name = "币种(currency)", width = 15)
 	@Excel(name = "币种(currency)", width = 15)
 	@ApiModelProperty(value = "币种(currency)")
 	@ApiModelProperty(value = "币种(currency)")
@@ -218,6 +220,7 @@ public class PurOrderPage {
 	//采购整单折扣
 	//采购整单折扣
 	private BigDecimal discountHead;
 	private BigDecimal discountHead;
 	//折后金额
 	//折后金额
+	@Excel(name = "折后金额", width = 15)
 	private BigDecimal discountAmount;
 	private BigDecimal discountAmount;
 	//报价变更后的来源选定单号
 	//报价变更后的来源选定单号
 	private String changeSourceCode;
 	private String changeSourceCode;

+ 3 - 5
srm-module-code/src/main/java/org/jeecg/modules/purCode/vo/PurPurchaseQuotationPage.java

@@ -46,7 +46,7 @@ public class PurPurchaseQuotationPage {
 	@ApiModelProperty(value = "更新时间")
 	@ApiModelProperty(value = "更新时间")
 	private Date updateTime;
 	private Date updateTime;
 	/**状态(1-结束,0-报价中)*/
 	/**状态(1-结束,0-报价中)*/
-	@Excel(name = "状态(1-结束,0-报价中)", width = 15)
+//	@Excel(name = "状态", width = 15,dicCode = "yes_or_no")
 	@ApiModelProperty(value = "状态(1-结束,0-报价中)")
 	@ApiModelProperty(value = "状态(1-结束,0-报价中)")
 	private Integer status;
 	private Integer status;
 	/**删除状态(0-正常,1-已删除)*/
 	/**删除状态(0-正常,1-已删除)*/
@@ -55,7 +55,7 @@ public class PurPurchaseQuotationPage {
 	@TableLogic
 	@TableLogic
 	private Integer delFlag;
 	private Integer delFlag;
 	/**提交(1是 0否)*/
 	/**提交(1是 0否)*/
-	@Excel(name = "提交(1是 0否)", width = 15)
+	@Excel(name = "提交", width = 15,dicCode = "yes_or_no")
 	@ApiModelProperty(value = "提交(1是 0否)")
 	@ApiModelProperty(value = "提交(1是 0否)")
 	private String submit;
 	private String submit;
 	/**单据日期(bill date)*/
 	/**单据日期(bill date)*/
@@ -69,7 +69,6 @@ public class PurPurchaseQuotationPage {
 	@ApiModelProperty(value = "报价单号(bill code)")
 	@ApiModelProperty(value = "报价单号(bill code)")
 	private String billCode;
 	private String billCode;
 	/**报价项目(quotation project)*/
 	/**报价项目(quotation project)*/
-	@Excel(name = "报价项目(quotation project)", width = 15)
 	@ApiModelProperty(value = "报价项目(quotation project)")
 	@ApiModelProperty(value = "报价项目(quotation project)")
 	private String quotationProject;
 	private String quotationProject;
 	/**项目名称*/
 	/**项目名称*/
@@ -77,7 +76,6 @@ public class PurPurchaseQuotationPage {
 	@ApiModelProperty(value = "项目名称")
 	@ApiModelProperty(value = "项目名称")
 	private String projectName;
 	private String projectName;
 	/**报价供应商(quotation supplier)*/
 	/**报价供应商(quotation supplier)*/
-	@Excel(name = "报价供应商(quotation supplier)", width = 15)
 	@ApiModelProperty(value = "报价供应商(quotation supplier)")
 	@ApiModelProperty(value = "报价供应商(quotation supplier)")
 	private String quotationSuppiler;
 	private String quotationSuppiler;
 	/**供应商名称*/
 	/**供应商名称*/
@@ -142,7 +140,7 @@ public class PurPurchaseQuotationPage {
 
 
 
 
 	//交期天数
 	//交期天数
-	@Excel(name = "交期天数", width = 15)
+	@Excel(name = "交期天数(deliveryDay)", width = 15)
 	@ApiModelProperty(value = "交期天数")
 	@ApiModelProperty(value = "交期天数")
 	private String deliveryDayHead;
 	private String deliveryDayHead;
 	//币种
 	//币种

+ 53 - 3
srm-module-code/src/main/java/org/jeecg/modules/saleCode/controller/SaleAdvancePaymentController.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.saleCode.controller;
 package org.jeecg.modules.saleCode.controller;
 
 
+import java.math.BigDecimal;
 import java.util.Arrays;
 import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.List;
 import java.util.List;
@@ -19,6 +20,7 @@ import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.baseCode.service.ISerialPatternService;
 import org.jeecg.modules.baseCode.service.ISerialPatternService;
 import org.jeecg.modules.saleCode.entity.SaleAdvancePayment;
 import org.jeecg.modules.saleCode.entity.SaleAdvancePayment;
 import org.jeecg.modules.saleCode.entity.SaleAdvancePayment;
 import org.jeecg.modules.saleCode.entity.SaleAdvancePayment;
+import org.jeecg.modules.saleCode.entity.SaleOrder;
 import org.jeecg.modules.saleCode.service.ISaleAdvancePaymentService;
 import org.jeecg.modules.saleCode.service.ISaleAdvancePaymentService;
 
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -26,6 +28,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
 
 
+import org.jeecg.modules.saleCode.service.ISaleOrderService;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.ExcelImportUtil;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
 import org.jeecgframework.poi.excel.entity.ExportParams;
 import org.jeecgframework.poi.excel.entity.ExportParams;
@@ -58,7 +61,8 @@ public class SaleAdvancePaymentController extends JeecgController<SaleAdvancePay
     private ISaleAdvancePaymentService saleAdvancePaymentService;
     private ISaleAdvancePaymentService saleAdvancePaymentService;
     @Autowired
     @Autowired
     private ISerialPatternService serialPatternService;
     private ISerialPatternService serialPatternService;
-
+    @Autowired
+    private ISaleOrderService saleOrderService;
     /**
     /**
      * 分页列表查询
      * 分页列表查询
      *
      *
@@ -113,6 +117,21 @@ public class SaleAdvancePaymentController extends JeecgController<SaleAdvancePay
             saleAdvancePayment.setBillCode(result.getMessage());
             saleAdvancePayment.setBillCode(result.getMessage());
         }
         }
 
 
+        String saleOrderId = saleAdvancePayment.getSaleOrderId();
+        SaleOrder saleOrder = saleOrderService.getById(saleOrderId);
+        BigDecimal taxMoney = saleOrder.getConvertedAmount()==null ? BigDecimal.ZERO :saleOrder.getConvertedAmount();//发票金额
+        BigDecimal taxMoneyUse = saleOrder.getCollectedMoney()==null ? BigDecimal.ZERO :saleOrder.getCollectedMoney();//已使用金额
+
+        BigDecimal amountCollected = saleAdvancePayment.getAdvanceAmount();//本次收款金额
+
+        BigDecimal newMoney = amountCollected.add(taxMoneyUse);
+        if(taxMoney.compareTo(newMoney) < 0){
+            return Result.error("预收款金额("+newMoney+")不能超过订单金额("+taxMoney+"),请修改本次收款金额!");
+        }
+        saleOrder.setCollectedMoney(newMoney);
+
+        saleOrderService.updateById(saleOrder);
+
         saleAdvancePaymentService.save(saleAdvancePayment);
         saleAdvancePaymentService.save(saleAdvancePayment);
         return Result.OK("添加成功!");
         return Result.OK("添加成功!");
     }
     }
@@ -128,8 +147,14 @@ public class SaleAdvancePaymentController extends JeecgController<SaleAdvancePay
     @RequiresPermissions("saleCode:sale_advance_payment:edit")
     @RequiresPermissions("saleCode:sale_advance_payment:edit")
     @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
     @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
     public Result<String> edit(@RequestBody SaleAdvancePayment saleAdvancePayment) {
     public Result<String> edit(@RequestBody SaleAdvancePayment saleAdvancePayment) {
-        saleAdvancePaymentService.updateById(saleAdvancePayment);
-        return Result.OK("编辑成功!");
+//        saleAdvancePaymentService.updateById(saleAdvancePayment);
+//        return Result.OK("编辑成功!");
+        try {
+            return saleAdvancePaymentService.updateByAll(saleAdvancePayment);
+        }catch (Exception e){
+            return Result.error(e.getMessage());
+        }
+
     }
     }
 
 
     /**
     /**
@@ -153,6 +178,18 @@ public class SaleAdvancePaymentController extends JeecgController<SaleAdvancePay
         if (submit != null && submit != "" && submit.equals("1")) {
         if (submit != null && submit != "" && submit.equals("1")) {
             return Result.error("已提交的单据不能删除!");
             return Result.error("已提交的单据不能删除!");
         }
         }
+
+        SaleAdvancePayment saleReceiptOld = saleAdvancePaymentService.getById(saleAdvancePayment.getId());
+        BigDecimal amountCollectedOld = saleReceiptOld.getAdvanceAmount();//上次收款金额
+
+        String invoiceIdOld = saleReceiptOld.getSaleOrderId();
+        SaleOrder saleInvoiceOld = saleOrderService.getById(invoiceIdOld);
+        BigDecimal oldTaxMoneyUse = saleInvoiceOld.getCollectedMoney()==null ? BigDecimal.ZERO :saleInvoiceOld.getCollectedMoney();//已使用金额
+        BigDecimal oldMoney = oldTaxMoneyUse.subtract(amountCollectedOld);
+
+        saleInvoiceOld.setCollectedMoney(oldMoney);
+        saleOrderService.updateById(saleInvoiceOld);
+
         saleAdvancePaymentService.removeById(id);
         saleAdvancePaymentService.removeById(id);
         return Result.OK("删除成功!");
         return Result.OK("删除成功!");
     }
     }
@@ -182,6 +219,19 @@ public class SaleAdvancePaymentController extends JeecgController<SaleAdvancePay
                 return Result.error("单号"+code+"已提交,不能删除!");
                 return Result.error("单号"+code+"已提交,不能删除!");
             }
             }
 
 
+        }
+        for (String o : ids.split(",")) {
+            SaleAdvancePayment saleReceiptOld = saleAdvancePaymentService.getById(o);
+            BigDecimal amountCollectedOld = saleReceiptOld.getAdvanceAmount();//上次收款金额
+
+            String invoiceIdOld = saleReceiptOld.getSaleOrderId();
+            SaleOrder saleInvoiceOld = saleOrderService.getById(invoiceIdOld);
+            BigDecimal oldTaxMoneyUse = saleInvoiceOld.getCollectedMoney()==null ? BigDecimal.ZERO :saleInvoiceOld.getCollectedMoney();//已使用金额
+            BigDecimal oldMoney = oldTaxMoneyUse.subtract(amountCollectedOld);
+
+            saleInvoiceOld.setCollectedMoney(oldMoney);
+            saleOrderService.updateById(saleInvoiceOld);
+
         }
         }
         this.saleAdvancePaymentService.removeByIds(Arrays.asList(ids.split(",")));
         this.saleAdvancePaymentService.removeByIds(Arrays.asList(ids.split(",")));
         return Result.OK("批量删除成功!");
         return Result.OK("批量删除成功!");

+ 81 - 7
srm-module-code/src/main/java/org/jeecg/modules/saleCode/controller/SaleInvoiceController.java

@@ -196,6 +196,45 @@ public class SaleInvoiceController {
         IPage<SaleInvoice> pageList = saleInvoiceService.page(page, queryWrapper);
         IPage<SaleInvoice> pageList = saleInvoiceService.page(page, queryWrapper);
         return Result.OK(pageList);
         return Result.OK(pageList);
     }
     }
+    /**
+     * 分页列表查询(收款单弹框使用)
+     *
+     * @param saleInvoice
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    //@AutoLog(value = "销售发票-分页列表查询")
+    @ApiOperation(value = "销售发票-分页列表查询", notes = "销售发票-分页列表查询")
+    @GetMapping(value = "/list2")
+    public Result<IPage<SaleInvoice>> queryPageList2(SaleInvoice saleInvoice,
+                                                    @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                                    @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                                    HttpServletRequest req) {
+
+        QueryWrapper<SaleInvoice> queryWrapper = QueryGenerator.initQueryWrapper(saleInvoice, req.getParameterMap());
+        Page<SaleInvoice> page = new Page<SaleInvoice>(pageNo, pageSize);
+
+        LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+        String dept = sysUser.getOrgCode();
+        String userName =  sysUser.getUsername();
+
+        queryWrapper.apply("tax_money > IFNULL(tax_money_use, 0)");
+
+        if(!userName.equals("admin") && !userName.equals("jack") && !userName.equals("max") && !"A02A05".equals(dept)){
+            queryWrapper.and(wrapper ->
+                    wrapper.eq("sys_org_code_delivery", dept)
+                            .or()
+                            .eq("sys_org_code_commission", dept)
+            );
+            IPage<SaleInvoice> pageList = saleInvoiceService.selectSaleInvoicePage(page, queryWrapper);
+            return Result.OK(pageList);
+        }
+
+        IPage<SaleInvoice> pageList = saleInvoiceService.page(page, queryWrapper);
+        return Result.OK(pageList);
+    }
     public static long getDaysBetweenDates(LocalDate startDate, LocalDate endDate) {
     public static long getDaysBetweenDates(LocalDate startDate, LocalDate endDate) {
         return ChronoUnit.DAYS.between(startDate, endDate);
         return ChronoUnit.DAYS.between(startDate, endDate);
     }
     }
@@ -804,7 +843,17 @@ public class SaleInvoiceController {
                 }
                 }
 
 
             }
             }
-
+            String sourceCode2 = main.getSourceCode2();
+
+            if (oConvertUtils.isNotEmpty(sourceCode2)) {
+                LambdaQueryWrapper<PlatCommissionOrder> deliveryLambdaQueryWrapper = new LambdaQueryWrapper<>();
+                deliveryLambdaQueryWrapper.eq(PlatCommissionOrder::getBillCode, sourceCode2);
+                PlatCommissionOrder delivery = platCommissionOrderService.getOne(deliveryLambdaQueryWrapper);
+                if (delivery != null){
+                    vo.setCreateBy(delivery.getCreateBy());
+                    vo.setSysOrgCode(delivery.getSysOrgCode());
+                }
+            }
 
 
 //            vo.setSaleInvoiceShipList(saleInvoiceShipList);
 //            vo.setSaleInvoiceShipList(saleInvoiceShipList);
 //            List<SaleInvoiceProduct> saleInvoiceProductList = saleInvoiceProductService.selectByMainId(main.getId());
 //            List<SaleInvoiceProduct> saleInvoiceProductList = saleInvoiceProductService.selectByMainId(main.getId());
@@ -877,6 +926,7 @@ public class SaleInvoiceController {
 
 
         String sourceCode = saleInvoice.getSourceCode();//发货通知单
         String sourceCode = saleInvoice.getSourceCode();//发货通知单
         String sourceCode2 = saleInvoice.getSourceCode2();//佣金订单
         String sourceCode2 = saleInvoice.getSourceCode2();//佣金订单
+        boolean disc = false;
 
 
         if(StringUtils.isNotBlank(sourceCode)){
         if(StringUtils.isNotBlank(sourceCode)){
 
 
@@ -1032,7 +1082,12 @@ public class SaleInvoiceController {
                                 SaleQuotationProduct saleQuotationProduct = saleQuotationProductList.stream().filter(e -> e.getId().equals(saleOrderProduct.getSourceId())).findFirst().orElse(null);
                                 SaleQuotationProduct saleQuotationProduct = saleQuotationProductList.stream().filter(e -> e.getId().equals(saleOrderProduct.getSourceId())).findFirst().orElse(null);
 
 
                                 if (saleQuotationProduct !=null && oConvertUtils.isNotEmpty(saleQuotationProduct.getDiscount())) {
                                 if (saleQuotationProduct !=null && oConvertUtils.isNotEmpty(saleQuotationProduct.getDiscount())) {
-                                    o.setDiscountText(saleQuotationProduct.getDiscount().doubleValue() + "%");
+                                    if(saleQuotationProduct.getDiscount().compareTo(BigDecimal.ZERO) == 0){
+                                        o.setDiscountText(null);
+                                    }else{
+                                        disc = true;
+                                        o.setDiscountText(saleQuotationProduct.getDiscount().doubleValue() + "%");
+                                    }
                                 }
                                 }
                                 if (saleQuotationProduct !=null && oConvertUtils.isNotEmpty(saleQuotationProduct.getSalePrice())) {
                                 if (saleQuotationProduct !=null && oConvertUtils.isNotEmpty(saleQuotationProduct.getSalePrice())) {
 
 
@@ -1128,9 +1183,15 @@ public class SaleInvoiceController {
                     }
                     }
                     List<String> noteList = new ArrayList<>();
                     List<String> noteList = new ArrayList<>();
                     productList.forEach(p->noteList.add(p.getNotes()));
                     productList.forEach(p->noteList.add(p.getNotes()));
+                    if(disc){
+
+                        ExcelExportUtils.excelInsertRowNotes(getOutputStream(saleInvoice.getInvoiceCode()+".xlsx", response),
+                                tempFilePath, 19, noteList, 1, 4);
+                    }else{
 
 
-                    ExcelExportUtils.excelInsertRowNotes(getOutputStream(saleInvoice.getInvoiceCode()+".xlsx", response),
-                            tempFilePath, 19, noteList, 1, 4);
+                        ExcelExportUtils.excelInsertRowNotes2(getOutputStream(saleInvoice.getInvoiceCode()+".xlsx", response),
+                                tempFilePath, 19, noteList, 1, 4);
+                    }
 
 
 
 
 
 
@@ -1285,8 +1346,14 @@ public class SaleInvoiceController {
                                 SaleQuotationProduct saleQuotationProduct = saleQuotationProductList.stream().filter(e -> e.getId().equals(saleOrderProduct.getSourceId())).findFirst().orElse(null);
                                 SaleQuotationProduct saleQuotationProduct = saleQuotationProductList.stream().filter(e -> e.getId().equals(saleOrderProduct.getSourceId())).findFirst().orElse(null);
 
 
                                 if (saleQuotationProduct !=null && oConvertUtils.isNotEmpty(saleQuotationProduct.getDiscount())) {
                                 if (saleQuotationProduct !=null && oConvertUtils.isNotEmpty(saleQuotationProduct.getDiscount())) {
-                                    o.setDiscountText(saleQuotationProduct.getDiscount().doubleValue() + "%");
+                                    if(saleQuotationProduct.getDiscount().compareTo(BigDecimal.ZERO) == 0){
+                                        o.setDiscountText(null);
+                                    }else{
+                                        disc = true;
+                                        o.setDiscountText(saleQuotationProduct.getDiscount().doubleValue() + "%");
+                                    }
                                 }
                                 }
+
                                 if (saleQuotationProduct !=null && oConvertUtils.isNotEmpty(saleQuotationProduct.getSalePrice())) {
                                 if (saleQuotationProduct !=null && oConvertUtils.isNotEmpty(saleQuotationProduct.getSalePrice())) {
 
 
 
 
@@ -1378,8 +1445,15 @@ public class SaleInvoiceController {
                     List<String> noteList = new ArrayList<>();
                     List<String> noteList = new ArrayList<>();
                     productList.forEach(p->noteList.add(p.getNotes()));
                     productList.forEach(p->noteList.add(p.getNotes()));
 
 
-                    ExcelExportUtils.excelInsertRowNotes(getOutputStream(saleInvoice.getInvoiceCode()+".xlsx", response),
-                            tempFilePath, 19, noteList, 1, 4);
+                    if(disc){
+
+                        ExcelExportUtils.excelInsertRowNotes(getOutputStream(saleInvoice.getInvoiceCode()+".xlsx", response),
+                                tempFilePath, 19, noteList, 1, 4);
+                    }else{
+
+                        ExcelExportUtils.excelInsertRowNotes2(getOutputStream(saleInvoice.getInvoiceCode()+".xlsx", response),
+                                tempFilePath, 19, noteList, 1, 4);
+                    }
 
 
 
 
 
 

+ 88 - 31
srm-module-code/src/main/java/org/jeecg/modules/saleCode/controller/SaleReceiptController.java

@@ -21,8 +21,10 @@ import org.jeecg.common.system.vo.LoginUser;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.baseCode.service.ISerialPatternService;
 import org.jeecg.modules.baseCode.service.ISerialPatternService;
 import org.jeecg.modules.saleCode.entity.SaleAdvancePayment;
 import org.jeecg.modules.saleCode.entity.SaleAdvancePayment;
+import org.jeecg.modules.saleCode.entity.SaleInvoice;
 import org.jeecg.modules.saleCode.entity.SaleReceipt;
 import org.jeecg.modules.saleCode.entity.SaleReceipt;
 import org.jeecg.modules.saleCode.service.ISaleAdvancePaymentService;
 import org.jeecg.modules.saleCode.service.ISaleAdvancePaymentService;
+import org.jeecg.modules.saleCode.service.ISaleInvoiceService;
 import org.jeecg.modules.saleCode.service.ISaleReceiptService;
 import org.jeecg.modules.saleCode.service.ISaleReceiptService;
 
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -66,6 +68,9 @@ public class SaleReceiptController extends JeecgController<SaleReceipt, ISaleRec
     @Autowired
     @Autowired
     private ISaleAdvancePaymentService saleAdvancePaymentService;
     private ISaleAdvancePaymentService saleAdvancePaymentService;
 
 
+    @Autowired
+    private ISaleInvoiceService saleInvoiceService;
+
     /**
     /**
      * 分页列表查询
      * 分页列表查询
      *
      *
@@ -120,6 +125,21 @@ public class SaleReceiptController extends JeecgController<SaleReceipt, ISaleRec
             saleReceipt.setBillCode(result.getMessage());
             saleReceipt.setBillCode(result.getMessage());
         }
         }
 
 
+        String invoiceId = saleReceipt.getInvoiceId();
+        SaleInvoice saleInvoice = saleInvoiceService.getById(invoiceId);
+        BigDecimal taxMoney = saleInvoice.getTaxMoney()==null ? BigDecimal.ZERO :saleInvoice.getTaxMoney();//发票金额
+        BigDecimal taxMoneyUse = saleInvoice.getTaxMoneyUse()==null ? BigDecimal.ZERO :saleInvoice.getTaxMoneyUse();//已使用金额
+
+        BigDecimal amountCollected = saleReceipt.getAmountCollected();//本次收款金额
+
+        BigDecimal newMoney = amountCollected.add(taxMoneyUse);
+        if(taxMoney.compareTo(newMoney) < 0){
+            return Result.error("累计收款金额("+newMoney+")超过发票金额("+taxMoney+"),请修改本次收款金额!");
+        }
+        saleInvoice.setTaxMoneyUse(newMoney);
+
+        saleInvoiceService.updateById(saleInvoice);
+
         saleReceiptService.save(saleReceipt);
         saleReceiptService.save(saleReceipt);
         return Result.OK("添加成功!");
         return Result.OK("添加成功!");
     }
     }
@@ -135,8 +155,13 @@ public class SaleReceiptController extends JeecgController<SaleReceipt, ISaleRec
     @RequiresPermissions("saleCode:sale_receipt:edit")
     @RequiresPermissions("saleCode:sale_receipt:edit")
     @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
     @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
     public Result<String> edit(@RequestBody SaleReceipt saleReceipt) {
     public Result<String> edit(@RequestBody SaleReceipt saleReceipt) {
-        saleReceiptService.updateById(saleReceipt);
-        return Result.OK("编辑成功!");
+
+        try {
+            return saleReceiptService.updateByAll(saleReceipt);
+        }catch (Exception e){
+            return Result.error(e.getMessage());
+        }
+
     }
     }
 
 
     /**
     /**
@@ -159,6 +184,21 @@ public class SaleReceiptController extends JeecgController<SaleReceipt, ISaleRec
         if (submit != null && submit != "" && submit.equals("1")) {
         if (submit != null && submit != "" && submit.equals("1")) {
             return Result.error("已提交的单据不能删除!");
             return Result.error("已提交的单据不能删除!");
         }
         }
+
+        /**
+         * 旧数据还原
+         */
+        SaleReceipt saleReceiptOld = saleReceiptService.getById(saleReceipt.getId());
+        BigDecimal amountCollectedOld = saleReceiptOld.getAmountCollected();//上次收款金额
+
+        String invoiceIdOld = saleReceiptOld.getInvoiceId();
+        SaleInvoice saleInvoiceOld = saleInvoiceService.getById(invoiceIdOld);
+        BigDecimal oldTaxMoneyUse = saleInvoiceOld.getTaxMoneyUse()==null ? BigDecimal.ZERO :saleInvoiceOld.getTaxMoneyUse();//已使用金额
+        BigDecimal oldMoney = oldTaxMoneyUse.subtract(amountCollectedOld);
+
+        saleInvoiceOld.setTaxMoneyUse(oldMoney);
+        saleInvoiceService.updateById(saleInvoiceOld);
+
         saleReceiptService.removeById(id);
         saleReceiptService.removeById(id);
         return Result.OK("删除成功!");
         return Result.OK("删除成功!");
     }
     }
@@ -188,6 +228,23 @@ public class SaleReceiptController extends JeecgController<SaleReceipt, ISaleRec
                 return Result.error("单号"+code+"已提交,不能删除!");
                 return Result.error("单号"+code+"已提交,不能删除!");
             }
             }
             
             
+        }
+        for (String o : ids.split(",")) {
+
+            /**
+             * 旧数据还原
+             */
+            SaleReceipt saleReceiptOld = saleReceiptService.getById(o);
+            BigDecimal amountCollectedOld = saleReceiptOld.getAmountCollected();//上次收款金额
+
+            String invoiceIdOld = saleReceiptOld.getInvoiceId();
+            SaleInvoice saleInvoiceOld = saleInvoiceService.getById(invoiceIdOld);
+            BigDecimal oldTaxMoneyUse = saleInvoiceOld.getTaxMoneyUse()==null ? BigDecimal.ZERO :saleInvoiceOld.getTaxMoneyUse();//已使用金额
+            BigDecimal oldMoney = oldTaxMoneyUse.subtract(amountCollectedOld);
+
+            saleInvoiceOld.setTaxMoneyUse(oldMoney);
+            saleInvoiceService.updateById(saleInvoiceOld);
+
         }
         }
         this.saleReceiptService.removeByIds(Arrays.asList(ids.split(",")));
         this.saleReceiptService.removeByIds(Arrays.asList(ids.split(",")));
         return Result.OK("批量删除成功!");
         return Result.OK("批量删除成功!");
@@ -364,35 +421,35 @@ public class SaleReceiptController extends JeecgController<SaleReceipt, ISaleRec
         }
         }
         // Step.2 获取导出数据
         // Step.2 获取导出数据
         List<SaleReceipt> exportList = service.list(queryWrapper);
         List<SaleReceipt> exportList = service.list(queryWrapper);
-        for(SaleReceipt saleReceipt:exportList){
-
-
-            BigDecimal headAdvanceAmount = BigDecimal.ZERO;//预收金额
-            BigDecimal headAdvanceRatio = BigDecimal.ZERO;//预收比例
-
-            String xsCode = saleReceipt.getSaleOrderId();
-            if(StringUtils.isNotBlank(xsCode)){
-
-                QueryWrapper<SaleAdvancePayment> querySaleAdvancePayment = new QueryWrapper();
-                querySaleAdvancePayment.eq("saleOrderId", xsCode);
-                List<SaleAdvancePayment> list = saleAdvancePaymentService.list(querySaleAdvancePayment);
-                if(list.size() > 0){
-
-                    for(SaleAdvancePayment o:list){
-
-                        BigDecimal advanceAmount = o.getAdvanceAmount() == null?BigDecimal.ZERO:o.getAdvanceAmount();//预收金额
-                        BigDecimal advanceRatio = o.getAdvanceRatio() == null?BigDecimal.ZERO:o.getAdvanceRatio();;//预收比例
-
-                        headAdvanceAmount = headAdvanceAmount.add(advanceAmount);
-                        headAdvanceRatio = headAdvanceRatio.add(advanceRatio);
-                    }
-                }
-
-            }
-            saleReceipt.setAdvanceAmount(headAdvanceAmount);
-            saleReceipt.setAdvanceRatio(headAdvanceRatio);
-
-        }
+//        for(SaleReceipt saleReceipt:exportList){
+//
+//
+//            BigDecimal headAdvanceAmount = BigDecimal.ZERO;//预收金额
+//            BigDecimal headAdvanceRatio = BigDecimal.ZERO;//预收比例
+//
+//            String xsCode = saleReceipt.getSaleOrderId();
+//            if(StringUtils.isNotBlank(xsCode)){
+//
+//                QueryWrapper<SaleAdvancePayment> querySaleAdvancePayment = new QueryWrapper();
+//                querySaleAdvancePayment.eq("sale_Order_Id", xsCode);
+//                List<SaleAdvancePayment> list = saleAdvancePaymentService.list(querySaleAdvancePayment);
+//                if(list.size() > 0){
+//
+//                    for(SaleAdvancePayment o:list){
+//
+//                        BigDecimal advanceAmount = o.getAdvanceAmount() == null?BigDecimal.ZERO:o.getAdvanceAmount();//预收金额
+//                        BigDecimal advanceRatio = o.getAdvanceRatio() == null?BigDecimal.ZERO:o.getAdvanceRatio();;//预收比例
+//
+//                        headAdvanceAmount = headAdvanceAmount.add(advanceAmount);
+//                        headAdvanceRatio = headAdvanceRatio.add(advanceRatio);
+//                    }
+//                }
+//
+//            }
+//            saleReceipt.setAdvanceAmount(headAdvanceAmount);
+//            saleReceipt.setAdvanceRatio(headAdvanceRatio);
+//
+//        }
         // Step.3 AutoPoi 导出Excel
         // Step.3 AutoPoi 导出Excel
         ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
         ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
         //此处设置的filename无效 ,前端会重更新设置一下
         //此处设置的filename无效 ,前端会重更新设置一下

+ 10 - 0
srm-module-code/src/main/java/org/jeecg/modules/saleCode/entity/SaleAdvancePayment.java

@@ -42,7 +42,17 @@ public class SaleAdvancePayment implements Serializable {
     @ApiModelProperty(value = "创建人")
     @ApiModelProperty(value = "创建人")
     private String createBy;
     private String createBy;
     private String sysOrgCode;
     private String sysOrgCode;
+    
+    private String organize;
 
 
+    /**佣金订单(commission order)*/
+    @Excel(name = "佣金订单(commission order)", width = 15)
+    @ApiModelProperty(value = "佣金订单(commission order)")
+    private String commissionOrder;
+    /**佣金订单(commission order)*/
+    @Excel(name = "佣金订单(commission order)", width = 15)
+    @ApiModelProperty(value = "佣金订单(commission order)")
+    private String commissionOrderId;
 	/**创建时间*/
 	/**创建时间*/
 	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
 	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
     @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")

+ 4 - 0
srm-module-code/src/main/java/org/jeecg/modules/saleCode/entity/SaleInvoice.java

@@ -192,6 +192,10 @@ public class SaleInvoice implements Serializable {
 	@Excel(name = "价税合计(tax money)", width = 15,type = 4)
 	@Excel(name = "价税合计(tax money)", width = 15,type = 4)
     @ApiModelProperty(value = "价税合计(tax money)")
     @ApiModelProperty(value = "价税合计(tax money)")
     private BigDecimal taxMoney;
     private BigDecimal taxMoney;
+
+	//已收款金额(收款单使用)
+    private BigDecimal taxMoneyUse;
+
 	/**盖章发票(Stamp invoice)*/
 	/**盖章发票(Stamp invoice)*/
 	@Excel(name = "盖章发票(Stamp invoice)", width = 15)
 	@Excel(name = "盖章发票(Stamp invoice)", width = 15)
     @ApiModelProperty(value = "盖章发票(Stamp invoice)")
     @ApiModelProperty(value = "盖章发票(Stamp invoice)")

+ 8 - 2
srm-module-code/src/main/java/org/jeecg/modules/saleCode/entity/SaleReceipt.java

@@ -42,6 +42,7 @@ public class SaleReceipt implements Serializable {
     @ApiModelProperty(value = "创建人")
     @ApiModelProperty(value = "创建人")
     private String createBy;
     private String createBy;
     private String sysOrgCode;
     private String sysOrgCode;
+    private String organize;
 
 
 	/**创建时间*/
 	/**创建时间*/
 	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
 	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
@@ -86,7 +87,6 @@ public class SaleReceipt implements Serializable {
     @ApiModelProperty(value = "发票(invoice)")
     @ApiModelProperty(value = "发票(invoice)")
     private String invoice;
     private String invoice;
 	/**发票(invoice)*/
 	/**发票(invoice)*/
-	@Excel(name = "发票(invoice)", width = 15)
     @ApiModelProperty(value = "发票(invoice)")
     @ApiModelProperty(value = "发票(invoice)")
     private String invoiceId;
     private String invoiceId;
 	/**项目(project)*/
 	/**项目(project)*/
@@ -103,12 +103,18 @@ public class SaleReceipt implements Serializable {
     @ApiModelProperty(value = "销售订单(sale order)")
     @ApiModelProperty(value = "销售订单(sale order)")
     private String saleOrder;
     private String saleOrder;
 	/**销售订单(sale order)*/
 	/**销售订单(sale order)*/
-	@Excel(name = "销售订单(sale order)", width = 15)
     @ApiModelProperty(value = "销售订单(sale order)")
     @ApiModelProperty(value = "销售订单(sale order)")
     private String saleOrderId;
     private String saleOrderId;
+	/**佣金订单(commission order)*/
+    @ApiModelProperty(value = "佣金订单(commission order)")
+    private String commissionOrder;
+	/**佣金订单(commission order)*/
+    @ApiModelProperty(value = "佣金订单(commission order)")
+    private String commissionOrderId;
 	/**客户(customer)*/
 	/**客户(customer)*/
 	//@Excel(name = "客户(customer)", width = 15)
 	//@Excel(name = "客户(customer)", width = 15)
     @ApiModelProperty(value = "客户(customer)")
     @ApiModelProperty(value = "客户(customer)")
+    @Dict(dictTable = "cusp_customer_profile", dicCode = "id", dicText = "duty_paragraph")
     private String customer;
     private String customer;
 	/**客户(customer)*/
 	/**客户(customer)*/
 	//@Excel(name = "客户(customer)", width = 15)
 	//@Excel(name = "客户(customer)", width = 15)

+ 2 - 1
srm-module-code/src/main/java/org/jeecg/modules/saleCode/service/ISaleAdvancePaymentService.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.saleCode.service;
 package org.jeecg.modules.saleCode.service;
 
 
+import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.saleCode.entity.SaleAdvancePayment;
 import org.jeecg.modules.saleCode.entity.SaleAdvancePayment;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 
@@ -10,5 +11,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @Version: V1.0
  * @Version: V1.0
  */
  */
 public interface ISaleAdvancePaymentService extends IService<SaleAdvancePayment> {
 public interface ISaleAdvancePaymentService extends IService<SaleAdvancePayment> {
-
+    public Result<String> updateByAll(SaleAdvancePayment saleReceipt);
 }
 }

+ 2 - 1
srm-module-code/src/main/java/org/jeecg/modules/saleCode/service/ISaleReceiptService.java

@@ -1,5 +1,6 @@
 package org.jeecg.modules.saleCode.service;
 package org.jeecg.modules.saleCode.service;
 
 
+import org.jeecg.common.api.vo.Result;
 import org.jeecg.modules.saleCode.entity.SaleReceipt;
 import org.jeecg.modules.saleCode.entity.SaleReceipt;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.IService;
 
 
@@ -10,5 +11,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @Version: V1.0
  * @Version: V1.0
  */
  */
 public interface ISaleReceiptService extends IService<SaleReceipt> {
 public interface ISaleReceiptService extends IService<SaleReceipt> {
-
+    public Result<String> updateByAll(SaleReceipt saleReceipt);
 }
 }

+ 55 - 0
srm-module-code/src/main/java/org/jeecg/modules/saleCode/service/impl/SaleAdvancePaymentServiceImpl.java

@@ -1,11 +1,21 @@
 package org.jeecg.modules.saleCode.service.impl;
 package org.jeecg.modules.saleCode.service.impl;
 
 
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.modules.saleCode.entity.SaleAdvancePayment;
 import org.jeecg.modules.saleCode.entity.SaleAdvancePayment;
+import org.jeecg.modules.saleCode.entity.SaleInvoice;
+import org.jeecg.modules.saleCode.entity.SaleOrder;
+import org.jeecg.modules.saleCode.entity.SaleReceipt;
 import org.jeecg.modules.saleCode.mapper.SaleAdvancePaymentMapper;
 import org.jeecg.modules.saleCode.mapper.SaleAdvancePaymentMapper;
+import org.jeecg.modules.saleCode.mapper.SaleOrderMapper;
 import org.jeecg.modules.saleCode.service.ISaleAdvancePaymentService;
 import org.jeecg.modules.saleCode.service.ISaleAdvancePaymentService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
 
 
 /**
 /**
  * @Description: 预收款
  * @Description: 预收款
@@ -16,4 +26,49 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 @Service
 @Service
 public class SaleAdvancePaymentServiceImpl extends ServiceImpl<SaleAdvancePaymentMapper, SaleAdvancePayment> implements ISaleAdvancePaymentService {
 public class SaleAdvancePaymentServiceImpl extends ServiceImpl<SaleAdvancePaymentMapper, SaleAdvancePayment> implements ISaleAdvancePaymentService {
 
 
+    @Autowired
+    private SaleAdvancePaymentMapper saleAdvancePaymentMapper;
+    @Autowired
+    private SaleOrderMapper saleOrderMapper;
+
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Result<String> updateByAll(SaleAdvancePayment saleAdvancePayment) {
+
+        /**
+         * 旧数据还原
+         */
+        SaleAdvancePayment saleReceiptOld = saleAdvancePaymentMapper.selectById(saleAdvancePayment.getId());
+        BigDecimal amountCollectedOld = saleReceiptOld.getAdvanceAmount();//上次收款金额
+
+        String invoiceIdOld = saleReceiptOld.getSaleOrderId();
+        SaleOrder saleInvoiceOld = saleOrderMapper.selectById(invoiceIdOld);
+        BigDecimal oldTaxMoneyUse = saleInvoiceOld.getCollectedMoney()==null ? BigDecimal.ZERO :saleInvoiceOld.getCollectedMoney();//已使用金额
+        BigDecimal oldMoney = oldTaxMoneyUse.subtract(amountCollectedOld);
+
+        saleInvoiceOld.setCollectedMoney(oldMoney);
+        saleOrderMapper.updateById(saleInvoiceOld);
+
+        /**
+         * 新数据处理
+         */
+        String saleOrderId = saleAdvancePayment.getSaleOrderId();
+        SaleOrder saleOrder = saleOrderMapper.selectById(saleOrderId);
+        BigDecimal taxMoney = saleOrder.getConvertedAmount()==null ? BigDecimal.ZERO :saleOrder.getConvertedAmount();//发票金额
+        BigDecimal taxMoneyUse = saleOrder.getCollectedMoney()==null ? BigDecimal.ZERO :saleOrder.getCollectedMoney();//已使用金额
+
+        BigDecimal amountCollected = saleAdvancePayment.getAdvanceAmount();//本次收款金额
+
+        BigDecimal newMoney = amountCollected.add(taxMoneyUse);
+        if(taxMoney.compareTo(newMoney) < 0){
+            throw new JeecgBootException("预收款金额("+newMoney+")不能超过订单金额("+taxMoney+"),请修改本次收款金额!");
+        }
+        saleOrder.setCollectedMoney(newMoney);
+
+        saleOrderMapper.updateById(saleOrder);
+
+        return Result.OK("编辑成功!");
+
+    }
 }
 }

+ 37 - 15
srm-module-code/src/main/java/org/jeecg/modules/saleCode/service/impl/SaleInterfaceSyncServiceImpl.java

@@ -345,8 +345,8 @@ public class SaleInterfaceSyncServiceImpl extends ServiceImpl<SaleInterfaceSyncM
 
 
         Instant instant = Instant.parse(dateStr);
         Instant instant = Instant.parse(dateStr);
         Date date = Date.from(instant);
         Date date = Date.from(instant);
-
-        System.out.println(date);
+        BaseShipArchive baseShipArchive = new BaseShipArchive();
+        System.out.println(baseShipArchive.getId());
     }
     }
 
 
 
 
@@ -366,6 +366,8 @@ public class SaleInterfaceSyncServiceImpl extends ServiceImpl<SaleInterfaceSyncM
         for (SaleInterfaceSync ent : listSaleInterfaceSync) {
         for (SaleInterfaceSync ent : listSaleInterfaceSync) {
 
 
             try {
             try {
+                String str = ent.getId();
+                boolean contains = str.contains("-");
 
 
                 String referenceNumber = ent.getReferenceNumber();//询价编号
                 String referenceNumber = ent.getReferenceNumber();//询价编号
 
 
@@ -400,8 +402,9 @@ public class SaleInterfaceSyncServiceImpl extends ServiceImpl<SaleInterfaceSyncM
                 customerQuery.eq("name", buyerName);
                 customerQuery.eq("name", buyerName);
                 customerQuery.eq("status", 1);
                 customerQuery.eq("status", 1);
                 customerQuery.eq("del_flag", 0);
                 customerQuery.eq("del_flag", 0);
+
                 List<CuspCustomerProfile> listCustomer = cuspCustomerProfileService.list(customerQuery);
                 List<CuspCustomerProfile> listCustomer = cuspCustomerProfileService.list(customerQuery);
-                if (listCustomer.size() == 0) {
+                if (listCustomer.size() == 0 && contains) {
                     if(StringUtils.isBlank(currencyCode)){
                     if(StringUtils.isBlank(currencyCode)){
                         builder.append("客户'" + buyerName +"'未找到档案数据,请先维护客户档案;");
                         builder.append("客户'" + buyerName +"'未找到档案数据,请先维护客户档案;");
                     }else{
                     }else{
@@ -410,7 +413,11 @@ public class SaleInterfaceSyncServiceImpl extends ServiceImpl<SaleInterfaceSyncM
 
 
                     continue;
                     continue;
                 }
                 }
-                List<CuspCustomerProfileMan> cusMan = cuspCustomerProfileManMapper.selectByMainId(listCustomer.get(0).getId());
+                List<CuspCustomerProfileMan> cusMan = new ArrayList<>();
+                if (listCustomer.size() > 0) {
+                    cusMan = cuspCustomerProfileManMapper.selectByMainId(listCustomer.get(0).getId());
+                }
+
 
 
                 Date adviseBeforeDate = ent.getAdviseBeforeDate();//询价有效期尾
                 Date adviseBeforeDate = ent.getAdviseBeforeDate();//询价有效期尾
                 Date submittedDate = ent.getSubmittedDate();//客户询价日期
                 Date submittedDate = ent.getSubmittedDate();//客户询价日期
@@ -438,7 +445,7 @@ public class SaleInterfaceSyncServiceImpl extends ServiceImpl<SaleInterfaceSyncM
                 String contactName = "";
                 String contactName = "";
                 String contactId = "";
                 String contactId = "";
 
 
-                if(StringUtils.isNotBlank(buyerContactName) && cusMan.size() > 0){
+                if(cusMan!=null && StringUtils.isNotBlank(buyerContactName) && cusMan.size() > 0){
 
 
                     for(CuspCustomerProfileMan o:cusMan){
                     for(CuspCustomerProfileMan o:cusMan){
                         String name = o.getName();
                         String name = o.getName();
@@ -451,7 +458,7 @@ public class SaleInterfaceSyncServiceImpl extends ServiceImpl<SaleInterfaceSyncM
                 }
                 }
 
 
                 //未找到联系人时,新增一个联系人
                 //未找到联系人时,新增一个联系人
-                if(StringUtils.isBlank(contactId)){
+                if(listCustomer!=null && listCustomer.size() > 0 && StringUtils.isNotBlank(buyerContactName) && StringUtils.isBlank(contactId)){
 
 
                     CuspCustomerProfileMan man = new CuspCustomerProfileMan();
                     CuspCustomerProfileMan man = new CuspCustomerProfileMan();
                     man.setName(buyerContactName);
                     man.setName(buyerContactName);
@@ -464,13 +471,16 @@ public class SaleInterfaceSyncServiceImpl extends ServiceImpl<SaleInterfaceSyncM
                     contactName = buyerContactName;
                     contactName = buyerContactName;
                     contactId = man.getId();
                     contactId = man.getId();
                 }
                 }
-                saleInquiryForm.setLiaisonId(contactId);//单据日期
-                saleInquiryForm.setLiaisonInfo(contactName);//单据日期
+                saleInquiryForm.setLiaisonId(contactId);//
+                saleInquiryForm.setLiaisonInfo(contactName);//
 
 
                 saleInquiryForm.setBillDate(new Date());//单据日期
                 saleInquiryForm.setBillDate(new Date());//单据日期
                 saleInquiryForm.setInquiryTime(submittedDate);//客户询价日期
                 saleInquiryForm.setInquiryTime(submittedDate);//客户询价日期
-                saleInquiryForm.setInquiryCustomer(listCustomer.get(0).getId());//询价客户
-                saleInquiryForm.setCustomerName(listCustomer.get(0).getName());//询价客户
+                if(listCustomer!=null && listCustomer.size() > 0){
+
+                    saleInquiryForm.setInquiryCustomer(listCustomer.get(0).getId());//询价客户
+                    saleInquiryForm.setCustomerName(listCustomer.get(0).getName());//询价客户
+                }
                 saleInquiryForm.setCustomerInquiryNumber(referenceNumber);//询价编号
                 saleInquiryForm.setCustomerInquiryNumber(referenceNumber);//询价编号
                 saleInquiryForm.setInquiryPeriodBegin(submittedDate);//询价有效期
                 saleInquiryForm.setInquiryPeriodBegin(submittedDate);//询价有效期
                 saleInquiryForm.setInquiryPeriodEnd(adviseBeforeDate);//询价有效期尾
                 saleInquiryForm.setInquiryPeriodEnd(adviseBeforeDate);//询价有效期尾
@@ -486,10 +496,15 @@ public class SaleInterfaceSyncServiceImpl extends ServiceImpl<SaleInterfaceSyncM
                 saleInquiryForm.setSalesmanName(sysUser.getRealname());
                 saleInquiryForm.setSalesmanName(sysUser.getRealname());
 
 
                 QueryWrapper<BaseShipArchive> queryWrapperShip = new QueryWrapper();
                 QueryWrapper<BaseShipArchive> queryWrapperShip = new QueryWrapper();
-                if(StringUtils.isNotBlank(vesselImo.trim())){
+                if(StringUtils.isNotBlank(vesselImo) && StringUtils.isNotBlank(vesselImo.trim())){
                     queryWrapperShip.eq("imo", vesselImo);
                     queryWrapperShip.eq("imo", vesselImo);
                 }else{
                 }else{
-                    queryWrapperShip.eq("ship_name", vesselCode);
+                    if(StringUtils.isNotBlank(vesselCode)){
+
+                        queryWrapperShip.eq("ship_name", vesselCode);
+                    }else{
+                        queryWrapperShip.eq("ship_name", "船为空vesselCode");
+                    }
                 }
                 }
 
 
                 queryWrapperShip.eq("del_flag", "0");
                 queryWrapperShip.eq("del_flag", "0");
@@ -500,7 +515,11 @@ public class SaleInterfaceSyncServiceImpl extends ServiceImpl<SaleInterfaceSyncM
                     baseShipArchive.setImo(vesselImo);
                     baseShipArchive.setImo(vesselImo);
                     baseShipArchive.setShipName(vesselCode);
                     baseShipArchive.setShipName(vesselCode);
                     baseShipArchive.setStatus(1);
                     baseShipArchive.setStatus(1);
-                    baseShipArchiveService.save(baseShipArchive);
+
+                    if(StringUtils.isNotBlank(vesselImo)){
+                        baseShipArchiveService.save(baseShipArchive);
+                    }
+
                 } else {
                 } else {
                     baseShipArchive = listShip.get(0);
                     baseShipArchive = listShip.get(0);
                 }
                 }
@@ -527,7 +546,7 @@ public class SaleInterfaceSyncServiceImpl extends ServiceImpl<SaleInterfaceSyncM
                     String description = interfaceItem.getDescription();
                     String description = interfaceItem.getDescription();
                     description = description.toUpperCase();
                     description = description.toUpperCase();
                     String supplierPartNumber = interfaceItem.getSupplierPartNumber();
                     String supplierPartNumber = interfaceItem.getSupplierPartNumber();
-                    String quantity = interfaceItem.getQuantity().trim() == null || interfaceItem.getQuantity().trim()==""?"1":interfaceItem.getQuantity().trim();
+                    String quantity = interfaceItem.getQuantity() == null || interfaceItem.getQuantity().trim() == null || interfaceItem.getQuantity().trim()==""?"1":interfaceItem.getQuantity().trim();
                     String unitOfMeasure = interfaceItem.getUnitOfMeasure();
                     String unitOfMeasure = interfaceItem.getUnitOfMeasure();
                     String commentChild = interfaceItem.getComment();
                     String commentChild = interfaceItem.getComment();
 
 
@@ -586,7 +605,10 @@ public class SaleInterfaceSyncServiceImpl extends ServiceImpl<SaleInterfaceSyncM
                     saleInquiryFormProductMapper.insert(saleInquiryFormProduct);
                     saleInquiryFormProductMapper.insert(saleInquiryFormProduct);
                 }
                 }
                 saleInquiryFormShip.setHeadId(saleInquiryForm.getId());
                 saleInquiryFormShip.setHeadId(saleInquiryForm.getId());
-                saleInquiryFormShipMapper.insert(saleInquiryFormShip);
+
+                if(StringUtils.isNotBlank(vesselImo)){
+                    saleInquiryFormShipMapper.insert(saleInquiryFormShip);
+                }
 
 
                 ent.setSync(1);
                 ent.setSync(1);
                 ent.setSyncBy(sysUser.getUsername());
                 ent.setSyncBy(sysUser.getUsername());

+ 12 - 0
srm-module-code/src/main/java/org/jeecg/modules/saleCode/service/impl/SaleInvoiceServiceImpl.java

@@ -11,6 +11,7 @@ import org.jeecg.common.util.DateUtils;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.modules.platCode.entity.PlatCommissionOrder;
 import org.jeecg.modules.platCode.entity.PlatCommissionOrder;
 import org.jeecg.modules.platCode.mapper.PlatCommissionOrderMapper;
 import org.jeecg.modules.platCode.mapper.PlatCommissionOrderMapper;
+import org.jeecg.modules.platCode.service.IPlatCommissionOrderService;
 import org.jeecg.modules.saleCode.entity.*;
 import org.jeecg.modules.saleCode.entity.*;
 import org.jeecg.modules.saleCode.mapper.SaleDeliveryMapper;
 import org.jeecg.modules.saleCode.mapper.SaleDeliveryMapper;
 import org.jeecg.modules.saleCode.mapper.SaleInvoiceShipMapper;
 import org.jeecg.modules.saleCode.mapper.SaleInvoiceShipMapper;
@@ -51,6 +52,8 @@ public class SaleInvoiceServiceImpl extends ServiceImpl<SaleInvoiceMapper, SaleI
 	private PlatCommissionOrderMapper platCommissionOrderMapper;
 	private PlatCommissionOrderMapper platCommissionOrderMapper;
 	@Autowired
 	@Autowired
 	private ISaleOrderService saleOrderService;
 	private ISaleOrderService saleOrderService;
+	@Autowired
+	private IPlatCommissionOrderService platCommissionOrderService;
 
 
 
 
 	/**
 	/**
@@ -137,6 +140,15 @@ public class SaleInvoiceServiceImpl extends ServiceImpl<SaleInvoiceMapper, SaleI
 			}
 			}
 		}
 		}
 
 
+		if (oConvertUtils.isNotEmpty(saleInvoice.getSourceCode2())) {
+			LambdaQueryWrapper<PlatCommissionOrder> deliveryLambdaQueryWrapper = new LambdaQueryWrapper<>();
+			deliveryLambdaQueryWrapper.eq(PlatCommissionOrder::getBillCode, saleInvoice.getSourceCode2());
+			PlatCommissionOrder delivery = platCommissionOrderService.getOne(deliveryLambdaQueryWrapper);
+			if (delivery != null){
+				saleInvoice.setOrganize(delivery.getOrganize());
+			}
+		}
+
 
 
 		saleInvoiceMapper.insert(saleInvoice);
 		saleInvoiceMapper.insert(saleInvoice);
 		if(saleInvoiceShipList!=null && saleInvoiceShipList.size()>0) {
 		if(saleInvoiceShipList!=null && saleInvoiceShipList.size()>0) {

+ 55 - 0
srm-module-code/src/main/java/org/jeecg/modules/saleCode/service/impl/SaleReceiptServiceImpl.java

@@ -1,11 +1,19 @@
 package org.jeecg.modules.saleCode.service.impl;
 package org.jeecg.modules.saleCode.service.impl;
 
 
+import org.jeecg.common.api.vo.Result;
+import org.jeecg.common.exception.JeecgBootException;
+import org.jeecg.modules.saleCode.entity.SaleInvoice;
 import org.jeecg.modules.saleCode.entity.SaleReceipt;
 import org.jeecg.modules.saleCode.entity.SaleReceipt;
+import org.jeecg.modules.saleCode.mapper.SaleInvoiceMapper;
 import org.jeecg.modules.saleCode.mapper.SaleReceiptMapper;
 import org.jeecg.modules.saleCode.mapper.SaleReceiptMapper;
 import org.jeecg.modules.saleCode.service.ISaleReceiptService;
 import org.jeecg.modules.saleCode.service.ISaleReceiptService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.math.BigDecimal;
 
 
 /**
 /**
  * @Description: 收款单
  * @Description: 收款单
@@ -16,4 +24,51 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 @Service
 @Service
 public class SaleReceiptServiceImpl extends ServiceImpl<SaleReceiptMapper, SaleReceipt> implements ISaleReceiptService {
 public class SaleReceiptServiceImpl extends ServiceImpl<SaleReceiptMapper, SaleReceipt> implements ISaleReceiptService {
 
 
+    @Autowired
+    private SaleReceiptMapper saleReceiptMapper;
+    @Autowired
+    private SaleInvoiceMapper saleInvoiceMapper;
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Result<String> updateByAll(SaleReceipt saleReceipt) {
+
+        /**
+         * 旧数据还原
+         */
+        SaleReceipt saleReceiptOld = saleReceiptMapper.selectById(saleReceipt.getId());
+        BigDecimal amountCollectedOld = saleReceiptOld.getAmountCollected();//上次收款金额
+
+        String invoiceIdOld = saleReceiptOld.getInvoiceId();
+        SaleInvoice saleInvoiceOld = saleInvoiceMapper.selectById(invoiceIdOld);
+        BigDecimal oldTaxMoneyUse = saleInvoiceOld.getTaxMoneyUse()==null ? BigDecimal.ZERO :saleInvoiceOld.getTaxMoneyUse();//已使用金额
+        BigDecimal oldMoney = oldTaxMoneyUse.subtract(amountCollectedOld);
+
+        saleInvoiceOld.setTaxMoneyUse(oldMoney);
+        saleInvoiceMapper.updateById(saleInvoiceOld);
+
+        /**
+         * 新数据处理
+         */
+        String invoiceId = saleReceipt.getInvoiceId();
+        SaleInvoice saleInvoice = saleInvoiceMapper.selectById(invoiceId);
+        BigDecimal taxMoney = saleInvoice.getTaxMoney()==null ? BigDecimal.ZERO :saleInvoice.getTaxMoney();//发票金额
+        BigDecimal taxMoneyUse = saleInvoice.getTaxMoneyUse()==null ? BigDecimal.ZERO :saleInvoice.getTaxMoneyUse();//已使用金额
+
+        BigDecimal amountCollected = saleReceipt.getAmountCollected();//本次收款金额
+
+        BigDecimal newMoney = amountCollected.add(taxMoneyUse);
+        if(taxMoney.compareTo(newMoney) < 0){
+            throw new JeecgBootException("累计收款金额("+newMoney+")超过发票金额("+taxMoney+"),请修改本次收款金额!");
+        }
+        saleInvoice.setTaxMoneyUse(newMoney);
+        saleInvoiceMapper.updateById(saleInvoice);
+
+        saleReceiptMapper.updateById(saleReceipt);
+
+        return Result.OK("编辑成功!");
+    }
+
+
+
 }
 }

+ 37 - 35
srm-module-code/src/main/java/org/jeecg/modules/saleCode/util/HttpUtils.java

@@ -130,46 +130,48 @@ public class HttpUtils {
 
 
     }
     }
     public static void main(String[] args) throws Exception {
     public static void main(String[] args) throws Exception {
-        String token = getAccessToken();
-        System.out.println("======="+token);
-//        String ACCESS_TOKEN="RCuxvqm0TBTcKsX7zMMcMWbAdQz3gHNF";
+//        String token = getAccessToken();
+//        System.out.println("======="+token);
+        String ACCESS_TOKEN="DATJB3Tu0Iufgfp8n0jOmdIB8DYWSLLH";
 //        JsonNode jsonNode = getDateListByUrl(ACCESS_TOKEN,null);
 //        JsonNode jsonNode = getDateListByUrl(ACCESS_TOKEN,null);
 //        System.out.println("================1===--------------");
 //        System.out.println("================1===--------------");
 //        System.out.println(jsonNode.toString());
 //        System.out.println(jsonNode.toString());
 //////        ObjectMapper mapper = new ObjectMapper();
 //////        ObjectMapper mapper = new ObjectMapper();
 ////////
 ////////
 ////////
 ////////
-//       JsonNode rootNode = getDateByUrl("1aeb441c-fb0e-450f-be5b-1858b0a1045c",ACCESS_TOKEN);
-//
-//        // 1. 访问基本字段
-//        String id = rootNode.path("id").asText();
-//        String subject = rootNode.path("subject").asText();
-//
-//        // 2. 访问嵌套对象
-//        JsonNode vesselNode = rootNode.path("vessel");
-//        String vesselName = vesselNode.path("name").asText();
-//        String imoNumber = vesselNode.path("imoNumber").asText();
-//        String paymentTerms = vesselNode.path("paymentTerms").asText();
-//        System.out.println(paymentTerms);
-//
-//        // 3. 访问数组
-//        JsonNode lineItems = rootNode.path("lineItems");
-//        for (JsonNode item : lineItems) {
-//            String description = item.path("description").asText();
-//            double quantity = item.path("quantity").asDouble();
-//
-//            // 4. 访问数组中的嵌套数组
-//            JsonNode partIdentifications = item.path("partIdentification");
-//            for (JsonNode part : partIdentifications) {
-//                String partType = part.path("partType").asText();
-//                String partCode = part.path("partCode").asText();
-//
-//                System.out.println("Part: " + partType + " - " + partCode);
-//            }
-//        }
-////////
+       JsonNode rootNode = getDateByUrl("da036dc5-e9df-4399-99cc-6980d2abeedd",ACCESS_TOKEN);
+System.out.println("Part: "+rootNode);
+        // 1. 访问基本字段
+        String id = rootNode.path("id").asText();
+        String subject = rootNode.path("subject").asText();
+
+        // 2. 访问嵌套对象
+        JsonNode vesselNode = rootNode.path("vessel");
+        String vesselName = vesselNode.path("name").asText();
+        String imoNumber = vesselNode.path("imoNumber").asText();
+        String paymentTerms = vesselNode.path("paymentTerms").asText();
+        System.out.println(paymentTerms);
+
+        // 3. 访问数组
+        JsonNode lineItems = rootNode.path("lineItems");
+        System.out.println("========================================= ");
+        System.out.println("lineItems: "+lineItems);
+        for (JsonNode item : lineItems) {
+            String description = item.path("description").asText();
+            double quantity = item.path("quantity").asDouble();
+
+            // 4. 访问数组中的嵌套数组
+            JsonNode partIdentifications = item.path("partIdentification");
+            for (JsonNode part : partIdentifications) {
+                String partType = part.path("partType").asText();
+                String partCode = part.path("partCode").asText();
+
+                System.out.println("Part: " + partType + " - " + partCode);
+            }
+        }
+//////
 
 
-////
+//
 //        String buyerContact = jsonNodeAll.get("lineItems").toPrettyString();
 //        String buyerContact = jsonNodeAll.get("lineItems").toPrettyString();
 //////
 //////
 //////
 //////
@@ -287,8 +289,8 @@ public class HttpUtils {
                     String responseBody = EntityUtils.toString(entity);
                     String responseBody = EntityUtils.toString(entity);
                     JsonNode jsonNode = parseJson(responseBody);
                     JsonNode jsonNode = parseJson(responseBody);
                     // 在这里处理jsonNode,例如遍历或提取数据
                     // 在这里处理jsonNode,例如遍历或提取数据
-                    System.out.println("=========格式化输出JSON==========="); // 格式化输出JSON
-                    System.out.println(jsonNode.toPrettyString()); // 格式化输出JSON
+//                    System.out.println("=========格式化输出JSON==========="); // 格式化输出JSON
+//                    System.out.println(jsonNode.toPrettyString()); // 格式化输出JSON
                     return jsonNode;
                     return jsonNode;
                 } else {
                 } else {
 
 

+ 73 - 0
srm-module-code/src/main/java/org/jeecg/modules/utils/ExcelExportUtils.java

@@ -36,6 +36,79 @@ public class ExcelExportUtils {
             FileInputStream fis = new FileInputStream(tempFilePath);
             FileInputStream fis = new FileInputStream(tempFilePath);
             Workbook workbook = new XSSFWorkbook(fis);  // 创建 HSSFWorkbook 用于 .xls 文件
             Workbook workbook = new XSSFWorkbook(fis);  // 创建 HSSFWorkbook 用于 .xls 文件
             Sheet sheet = workbook.getSheetAt(0); // 获取第一个工作表(Sheet)
             Sheet sheet = workbook.getSheetAt(0); // 获取第一个工作表(Sheet)
+
+            int firstRowIndex = startIndex;
+            int insertedRow = 0;
+            for (int i = 0; i < noteList.size(); i++) {
+                String notes = noteList.get(i);
+                if (oConvertUtils.isNotEmpty(notes)) {
+                    int rowIndex = firstRowIndex + i + insertedRow;
+                    insertedRow++;
+                    sheet.shiftRows(rowIndex, sheet.getLastRowNum(), 1, true, true);
+                    Row newRow = sheet.createRow(rowIndex); // 备注行
+                    Cell remarkCell = newRow.createCell(mergeStartColumn); // 备注从第一列开始
+                    remarkCell.setCellValue(notes);
+                    CellRangeAddress mergedRegion = new CellRangeAddress(rowIndex, rowIndex, mergeStartColumn, mergeEndColumn); // 合并从第一行第一列到第一行第三列的单元格
+
+                    CellStyle style = workbook.createCellStyle();
+                    style.setWrapText(true);
+                    Font font = workbook.createFont();
+                    font.setFontHeightInPoints((short) 10); // 设置字体大小为10
+                    style.setFont(font);
+
+                    remarkCell.setCellStyle(style);
+                    sheet.addMergedRegion(mergedRegion);
+                }
+            }
+            // 6. 保存为新文件
+            workbook.write(outputStream);
+
+            // 7. 关闭资源
+            fis.close();
+
+            Path path = Paths.get(tempFilePath);
+            try {
+                Files.delete(path);
+            } catch (IOException e) {
+            }
+        }catch (Exception ex){
+
+        }
+    }
+
+    /**
+     * 导出excel插入注释行
+     * @param tempFilePath 临时
+     * @param startIndex 子表数据第一行号,从1开始
+     * @param noteList
+     * @param mergeStartColumn 开始合并列下标,从0开始
+     * @param mergeEndColumn
+     */
+    public static void excelInsertRowNotes2(OutputStream outputStream, String tempFilePath,
+                                    int startIndex, List<String> noteList,
+                                    int mergeStartColumn, int mergeEndColumn){
+        try {
+            FileInputStream fis = new FileInputStream(tempFilePath);
+            Workbook workbook = new XSSFWorkbook(fis);  // 创建 HSSFWorkbook 用于 .xls 文件
+            Sheet sheet = workbook.getSheetAt(0); // 获取第一个工作表(Sheet)
+
+
+// 获取第17行 (行索引从0开始,所以是16)
+            Row row = sheet.getRow(16);
+            if (row == null) {
+                // 如果第17行不存在,则创建它
+                row = sheet.createRow(16);
+            }
+// 获取H列 (列索引从0开始,H是第8列,所以是7)
+            Cell cell = row.getCell(7);
+            if (cell == null) {
+                // 如果H列单元格不存在,则创建它
+                cell = row.createCell(7);
+            }
+// 清空单元格内容
+            cell.setCellValue("");
+
+
             int firstRowIndex = startIndex;
             int firstRowIndex = startIndex;
             int insertedRow = 0;
             int insertedRow = 0;
             for (int i = 0; i < noteList.size(); i++) {
             for (int i = 0; i < noteList.size(); i++) {