Explorar o código

Merge branch 'feature/wxPay' of http://git.aseanbusiness.cn/qzyReal/market-server into feature/wxPay

panlijun hai 3 semanas
pai
achega
11ccd85137
Modificáronse 100 ficheiros con 4905 adicións e 1508 borrados
  1. 5 2
      sp-core/sp-api/src/main/java/com/pj/api/client/admin/AdminInterface.java
  2. 6 0
      sp-core/sp-api/src/main/java/com/pj/api/client/admin/AdminInterfaceFallback.java
  3. 5 1
      sp-core/sp-api/src/main/java/com/pj/api/client/level_one_server/LevelOneServerInterface.java
  4. 9 1
      sp-core/sp-api/src/main/java/com/pj/api/client/level_one_server/LevelOneServerInterfaceFallback.java
  5. 7 0
      sp-core/sp-api/src/main/java/com/pj/api/client/level_two_server/LevelTwoServerInterface.java
  6. 10 0
      sp-core/sp-api/src/main/java/com/pj/api/client/level_two_server/LevelTwoServerInterfaceFallback.java
  7. 5 0
      sp-core/sp-api/src/main/java/com/pj/api/client/payment_server/PaymentServerInterface.java
  8. 9 0
      sp-core/sp-api/src/main/java/com/pj/api/client/payment_server/PaymentServerInterfaceFallback.java
  9. 14 5
      sp-core/sp-api/src/main/java/com/pj/api/dto/AppUserDto.java
  10. 13 80
      sp-core/sp-api/src/main/java/com/pj/api/dto/BankInfoDto.java
  11. 4 104
      sp-core/sp-api/src/main/java/com/pj/api/dto/HtGroupDto.java
  12. 47 0
      sp-core/sp-api/src/main/java/com/pj/api/dto/PaymentDto.java
  13. 79 6
      sp-core/sp-api/src/main/java/com/pj/api/dto/PaymentTwoDto.java
  14. 35 52
      sp-core/sp-api/src/main/java/com/pj/api/dto/PeopleDto.java
  15. 155 0
      sp-core/sp-api/src/main/java/com/pj/api/dto/PeopleTaxAccountDto.java
  16. 5 1
      sp-core/sp-base/pom.xml
  17. 7 1
      sp-core/sp-base/src/main/java/com/pj/current/config/MyConfig.java
  18. 4 6
      sp-core/sp-base/src/main/java/com/pj/current/config/SystemObject.java
  19. 127 117
      sp-core/sp-base/src/main/java/com/pj/project4sp/apilog/SpApilogUtil.java
  20. 1 2
      sp-core/sp-base/src/main/java/com/pj/utils/ht/AESUtil.java
  21. 10 9
      sp-core/sp-nacos/src/main/resources/logback.xml
  22. 6 6
      sp-generate/src/main/java/com/pj/SpGenerateApplication.java
  23. 5 4
      sp-service/async-server/src/main/java/com/pj/feign/AmqpTemplateFeign.java
  24. 5 1
      sp-service/async-server/src/main/java/com/pj/ht_byte/HtByte.java
  25. 1 31
      sp-service/async-server/src/main/java/com/pj/ht_byte/HtByteController.java
  26. 1 10
      sp-service/async-server/src/main/java/com/pj/ht_byte/HtByteMapper.xml
  27. 61 33
      sp-service/async-server/src/main/java/com/pj/ht_byte/HtByteService.java
  28. 4 4
      sp-service/async-server/src/main/java/com/pj/listen/BaseInfoListen.java
  29. 2 3
      sp-service/async-server/src/main/java/com/pj/task/HtByteTask.java
  30. 125 0
      sp-service/async-server/src/main/resources/logback.xml
  31. 27 1
      sp-service/level-one-server/src/main/java/com/pj/ht_trade_settlement/HtTradeSettlement.java
  32. 20 2
      sp-service/level-one-server/src/main/java/com/pj/ht_trade_settlement/HtTradeSettlementApi.java
  33. 13 0
      sp-service/level-one-server/src/main/java/com/pj/ht_trade_settlement/HtTradeSettlementController.java
  34. 7 3
      sp-service/level-one-server/src/main/java/com/pj/ht_trade_settlement/HtTradeSettlementMapper.xml
  35. 17 2
      sp-service/level-one-server/src/main/java/com/pj/ht_trade_settlement/HtTradeSettlementService.java
  36. 64 61
      sp-service/level-one-server/src/main/java/com/pj/tb_group/TbGroup.java
  37. 48 0
      sp-service/level-one-server/src/main/java/com/pj/tb_group/TbGroupAPPController.java
  38. 41 26
      sp-service/level-one-server/src/main/java/com/pj/tb_group/TbGroupService.java
  39. 7 0
      sp-service/level-one-server/src/main/java/com/pj/tb_import_goods/TbImportGoodsMapper.java
  40. 1 0
      sp-service/level-one-server/src/main/java/com/pj/tb_import_order/TbImportOrder.java
  41. 1 0
      sp-service/level-one-server/src/main/java/com/pj/tb_import_order/TbImportOrderMapper.java
  42. 4 1
      sp-service/level-one-server/src/main/java/com/pj/tb_import_order/TbImportOrderMapper.xml
  43. 125 99
      sp-service/level-one-server/src/main/java/com/pj/tb_import_order/TbImportOrderService.java
  44. 28 3
      sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrder.java
  45. 21 3
      sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderAppController.java
  46. 210 109
      sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderController.java
  47. 2 0
      sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderMapper.java
  48. 11 3
      sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderMapper.xml
  49. 353 94
      sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderService.java
  50. 9 1
      sp-service/level-one-server/src/main/java/com/pj/tb_order/vo/OrderVo.java
  51. 26 18
      sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeople.java
  52. 89 10
      sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleAppController.java
  53. 26 12
      sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleController.java
  54. 17 9
      sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleService.java
  55. 14 7
      sp-service/level-one-server/src/main/java/com/pj/tb_people_tax_account/TbPeopleTaxAccountController.java
  56. 1 1
      sp-service/level-one-server/src/main/java/com/pj/tb_people_tax_account/TbPeopleTaxAccountMapper.xml
  57. 1 1
      sp-service/level-one-server/src/main/java/com/pj/tb_port_news/TbPortNewsAppController.java
  58. 2 3
      sp-service/level-one-server/src/main/java/com/pj/tb_port_news/TbPortNewsService.java
  59. 2 1
      sp-service/level-one-server/src/main/java/com/pj/tb_shop/TbShopMapper.xml
  60. 2 2
      sp-service/level-one-server/src/main/java/com/pj/tb_shop/TbShopService.java
  61. 125 0
      sp-service/level-one-server/src/main/resources/logback.xml
  62. 33 4
      sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrders.java
  63. 3 0
      sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersApiController.java
  64. 46 31
      sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersController.java
  65. 1 1
      sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersMapper.xml
  66. 198 55
      sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersService.java
  67. 443 0
      sp-service/level-two-server/src/main/java/com/pj/tb_orders/vo/TbOrdersEmailVo.java
  68. 296 0
      sp-service/level-two-server/src/main/java/com/pj/tb_orders/vo/TbOrdersPrintVo.java
  69. 0 54
      sp-service/level-two-server/src/main/java/com/pj/tb_purchaser/MethodPurchaserService.java
  70. 6 2
      sp-service/level-two-server/src/main/java/com/pj/tb_purchaser/TbPurchaserAppController.java
  71. 29 24
      sp-service/level-two-server/src/main/java/com/pj/tb_purchaser/TbPurchaserService.java
  72. 5 15
      sp-service/level-two-server/src/main/java/com/pj/tb_purchaser/param/PurchaserParam.java
  73. 125 0
      sp-service/level-two-server/src/main/resources/logback.xml
  74. 15 22
      sp-service/payment-server/src/main/java/com/pj/bank_info/BankInfoController.java
  75. 15 15
      sp-service/payment-server/src/main/java/com/pj/bank_info/BankInfoMapper.xml
  76. 6 3
      sp-service/payment-server/src/main/java/com/pj/task/BankByteTask.java
  77. 1 1
      sp-service/payment-server/src/main/java/com/pj/task/PaymentService.java
  78. 7 0
      sp-service/payment-server/src/main/java/com/pj/utils/CryptoUtil.java
  79. 192 97
      sp-service/payment-server/src/main/java/com/pj/xml/MessageXML.java
  80. 125 0
      sp-service/payment-server/src/main/resources/logback.xml
  81. 5 1
      sp-service/sp-admin/pom.xml
  82. 78 26
      sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserApiController.java
  83. 205 150
      sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserController.java
  84. 2 0
      sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserMapper.java
  85. 3 0
      sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserMapper.xml
  86. 80 34
      sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserService.java
  87. 24 0
      sp-service/sp-admin/src/main/java/com/pj/project/tb_app/AppApkController.java
  88. 86 0
      sp-service/sp-admin/src/main/java/com/pj/project/tb_app/TbApp.java
  89. 93 0
      sp-service/sp-admin/src/main/java/com/pj/project/tb_app/TbAppController.java
  90. 31 0
      sp-service/sp-admin/src/main/java/com/pj/project/tb_app/TbAppMapper.java
  91. 53 0
      sp-service/sp-admin/src/main/java/com/pj/project/tb_app/TbAppMapper.xml
  92. 85 0
      sp-service/sp-admin/src/main/java/com/pj/project/tb_app/TbAppService.java
  93. 7 2
      sp-service/sp-admin/src/main/java/com/pj/project4sp/face/brand/FaceBrand.java
  94. 60 0
      sp-service/sp-admin/src/main/java/com/pj/project4sp/face/factory/FaceEngineFactory.java
  95. 2 5
      sp-service/sp-admin/src/main/java/com/pj/project4sp/face/factory/FaceFactory.java
  96. 11 5
      sp-service/sp-admin/src/main/java/com/pj/project4sp/face/handler/IFaceHandler.java
  97. 9 0
      sp-service/sp-admin/src/main/java/com/pj/project4sp/face/handler/VerifyVO.java
  98. 223 0
      sp-service/sp-admin/src/main/java/com/pj/project4sp/face/handler/impl/ArcsoftFaceHandlerImpl.java
  99. 110 10
      sp-service/sp-admin/src/main/java/com/pj/project4sp/face/handler/impl/TencenFaceHandlerImpl.java
  100. 111 0
      sp-service/sp-admin/src/main/java/com/pj/project4sp/face/handler/impl/TencenRespBO.java

+ 5 - 2
sp-core/sp-api/src/main/java/com/pj/api/client/admin/AdminInterface.java

@@ -90,8 +90,8 @@ public interface AdminInterface {
     /**
      * 根据fkId查app用户
      */
-    @RequestMapping("/AppUser/rpc/getByFkId")
-    AppUserDto getByFkId(@RequestParam("fkId") Long fkId);
+    @PostMapping("AppUser/rpc/getByFkId")
+    public AppUserDto getByFkId(@RequestParam("fkId") Long fkId);
 
 
     @PostMapping("AppUser/rpc/changeBindShopStatus")
@@ -102,4 +102,7 @@ public interface AdminInterface {
 
     @PostMapping("AppUser/rpc/updateAccount")
     int updateAccount(UpdateAccountDTO updateAccountDTO);
+
+    @PostMapping("AppUser/rpc/bindFkId")
+    boolean bindFkId(@RequestParam("appUserId") Long appUserId,@RequestParam("fkId")  Long fkId);
 }

+ 6 - 0
sp-core/sp-api/src/main/java/com/pj/api/client/admin/AdminInterfaceFallback.java

@@ -87,6 +87,7 @@ public class AdminInterfaceFallback implements FallbackFactory<AdminInterface> {
 
             @Override
             public AppUserDto getByFkId(Long fkId) {
+                log.error("getByFkId报错,fkId:{}", fkId);
                 return null;
             }
 
@@ -105,6 +106,11 @@ public class AdminInterfaceFallback implements FallbackFactory<AdminInterface> {
                 return 0;
             }
 
+            @Override
+            public boolean bindFkId(Long appUserId, Long fkId) {
+                return false;
+            }
+
         };
     }
 

+ 5 - 1
sp-core/sp-api/src/main/java/com/pj/api/client/level_one_server/LevelOneServerInterface.java

@@ -74,6 +74,10 @@ public interface LevelOneServerInterface {
     @RequestMapping("/TbPeople/rpc/getRpcById")
     public PeopleDto getRpcById(@RequestParam("id")Long peopleId);
 
+    /** 根据边民ID获取边民开户信息 */
+    @PostMapping("/TbPeopleTaxAccount/rpc/getTaxAccountByPeopleId")
+    public PeopleTaxAccountDto getTaxAccountByPeopleId(@RequestParam("peopleId") Long peopleId);
+
     /** 根据ID获取边民组信息 */
     @RequestMapping("/TbGroup/rpc/getRpcById")
     public GroupDto getRpcById(@RequestParam("id") String id);
@@ -146,7 +150,7 @@ public interface LevelOneServerInterface {
 
     /** (一级市场)订单扣款回执 */
     @PostMapping("/app/TbOrder/rpc/confirmOrderFromBank")
-    public boolean confirmOrderFromBank(@RequestParam("tradeNo")String tradeNo,@RequestParam("SXB010Status")Integer SXB010Status);
+    public boolean confirmOrderFromBank(@RequestParam("tradeNo")String tradeNo,@RequestParam("note")String note,@RequestParam("SXB010Status")Integer SXB010Status);
 
     /** 收到(一级市场-通车批信息)订单打款回执 */
     @PostMapping("/app/TbOrder/rpc/orderFinishFromBank")

+ 9 - 1
sp-core/sp-api/src/main/java/com/pj/api/client/level_one_server/LevelOneServerInterfaceFallback.java

@@ -6,6 +6,7 @@ import feign.hystrix.FallbackFactory;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.RequestParam;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -110,6 +111,13 @@ public class LevelOneServerInterfaceFallback implements FallbackFactory<LevelOne
             }
 
             @Override
+            public PeopleTaxAccountDto getTaxAccountByPeopleId(Long peopleId) {
+                System.out.println(throwable.getMessage());
+                log.error("根据边民ID获取边民开户信息错误:{},错误信息是:{}",peopleId,throwable.getMessage());
+                return null;
+            }
+
+            @Override
             public GroupDto getRpcById(String id) {
                 System.out.println(throwable.getMessage());
                 log.error("互市区组长错误:{},错误信息是:{}",id,throwable.getMessage());
@@ -218,7 +226,7 @@ public class LevelOneServerInterfaceFallback implements FallbackFactory<LevelOne
             }
 
             @Override
-            public boolean confirmOrderFromBank(String tradeNo, Integer SXB010Status) {
+            public boolean confirmOrderFromBank(String tradeNo, String note, Integer SXB010Status) {
                 return false;
             }
 

+ 7 - 0
sp-core/sp-api/src/main/java/com/pj/api/client/level_two_server/LevelTwoServerInterface.java

@@ -9,6 +9,8 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 
+import java.util.List;
+
 /**
  * @Author Mechrevo
  * @Date 2023 08 01 10 38
@@ -42,4 +44,9 @@ public interface LevelTwoServerInterface {
     /** 收到边民缴税以及各服务费回执 */
     @PostMapping("/app/TbOrders/rpc/payTaxFromBank")
     public boolean payTaxFromBank(@RequestParam("orderNo") String orderNo, @RequestParam("MKT008Status")Integer MKT008Status);
+
+    @RequestMapping("/TbOrders/rpc/removeOnSaleOrderByLevelOneOrderId")
+    boolean removeOnSaleOrderByLevelOneOrderId(@RequestParam("levelOneOrderId") Long levelOneOrderId);
+    @RequestMapping("/TbOrders/rpc/removeOnSaleOrderByLevelOneOrderIds")
+    boolean removeOnSaleOrderByLevelOneOrderIds(@RequestParam("levelOneOrderIds")String levelOneOrderIds);
 }

+ 10 - 0
sp-core/sp-api/src/main/java/com/pj/api/client/level_two_server/LevelTwoServerInterfaceFallback.java

@@ -53,6 +53,16 @@ public class LevelTwoServerInterfaceFallback implements FallbackFactory<LevelTwo
             public boolean payTaxFromBank(String orderNo, Integer MKT008Status) {
                 return false;
             }
+
+            @Override
+            public boolean removeOnSaleOrderByLevelOneOrderId(Long levelOneOrderId) {
+                return false;
+            }
+
+            @Override
+            public boolean removeOnSaleOrderByLevelOneOrderIds(String ids) {
+                return false;
+            }
         };
     }
 }

+ 5 - 0
sp-core/sp-api/src/main/java/com/pj/api/client/payment_server/PaymentServerInterface.java

@@ -6,6 +6,8 @@ import com.pj.api.dto.*;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.List;
+
 @FeignClient(
         name = FeignConsts.PAYMENT_SERVER,                // 服务名称
         configuration = FeignInterceptor.class,        // 请求拦截器
@@ -48,4 +50,7 @@ public interface PaymentServerInterface {
      */
     @PostMapping("/payment/rpc/sendMKT006")
     void sendMKT006(@RequestBody PaymentTwoDto paymentTwoDto);
+
+    @PostMapping("/BankInfo/rpc/getListBySource")
+    public List<BankInfoDto> getListBySource(@RequestParam("source") String source);
 }

+ 9 - 0
sp-core/sp-api/src/main/java/com/pj/api/client/payment_server/PaymentServerInterfaceFallback.java

@@ -7,6 +7,8 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Component;
 
+import java.util.List;
+
 
 @Component
 public class PaymentServerInterfaceFallback implements FallbackFactory<PaymentServerInterface> {
@@ -51,6 +53,13 @@ public class PaymentServerInterfaceFallback implements FallbackFactory<PaymentSe
                 System.out.println(throwable.getMessage());
                 log.error("调用订单扣款(+手续费)接口【MKT006】错误,当前对象:{},错误信息是:{}",paymentTwoDto,throwable.getMessage());
             }
+
+            @Override
+            public List<BankInfoDto> getListBySource(String source) {
+                System.out.println(throwable.getMessage());
+                log.error("根据订单号查询银行回执信息错误:{},错误信息是:{}",source,throwable.getMessage());
+                return null;
+            }
         };
     }
 }

+ 14 - 5
sp-core/sp-api/src/main/java/com/pj/api/dto/AppUserDto.java

@@ -25,12 +25,13 @@ public class AppUserDto {
      * 姓名
      */
     private String name;
+    private String faceId;
     /**
      * 创建单位
      */
     private String createUnit;
 
-    public AppUserDto(Long id, String phone, String name, String createUnit, String userType, Long fkId, String status, String auth, String authTime, Long loginCount, String lastLoginTime, Date createTime, String updateById, String updateByName, Date updateTime, Integer deleteStatus, String password) {
+    public AppUserDto(Long id, String phone, String name, String createUnit, Integer userType, Long fkId, String status, String auth, String authTime, Long loginCount, String lastLoginTime, Date createTime, String updateById, String updateByName, Date updateTime, Integer deleteStatus, String password) {
         this.id = id;
         this.phone = phone;
         this.name = name;
@@ -61,7 +62,7 @@ public class AppUserDto {
     /**
      * 类型(1=边民,2=组长,3=商户,4=收购商,5=司机)
      */
-    private String userType;
+    private Integer userType;
 
     /**
      * 外联id,user_type=1=>边民ID;user_type=3=>商户ID
@@ -127,7 +128,7 @@ public class AppUserDto {
     public AppUserDto() {
     }
 
-    public AppUserDto(Long id, String phone, String name, String userType, Long fkId, String status, String auth, String authTime, Long loginCount, String lastLoginTime, Date createTime, String updateById, String updateByName, Date updateTime, Integer deleteStatus, String password) {
+    public AppUserDto(Long id, String phone, String name, Integer userType, Long fkId, String status, String auth, String authTime, Long loginCount, String lastLoginTime, Date createTime, String updateById, String updateByName, Date updateTime, Integer deleteStatus, String password) {
         this.id = id;
         this.phone = phone;
         this.name = name;
@@ -170,11 +171,11 @@ public class AppUserDto {
         this.name = name;
     }
 
-    public String getUserType() {
+    public Integer getUserType() {
         return userType;
     }
 
-    public void setUserType(String userType) {
+    public void setUserType(Integer userType) {
         this.userType = userType;
     }
 
@@ -273,4 +274,12 @@ public class AppUserDto {
     public void setPassword(String password) {
         this.password = password;
     }
+
+    public String getFaceId() {
+        return faceId;
+    }
+
+    public void setFaceId(String faceId) {
+        this.faceId = faceId;
+    }
 }

+ 13 - 80
sp-core/sp-api/src/main/java/com/pj/api/dto/BankInfoDto.java

@@ -1,13 +1,25 @@
 package com.pj.api.dto;
 
-import java.util.Date;
+import lombok.Data;
 
 /**
  * Model: bank_info -- 银行回执信息表
  * @author lbl
  */
+@Data
 public class BankInfoDto {
 
+	private String sn;
+	private String date;
+	private String organization;
+	private String bankCode;
+	private String operation;
+	private String code;
+	private String source;
+	private String result;
+	private String note;
+	private String type;
+
 	private String name;
 	private String papersType;
 	private String papersNo;
@@ -20,83 +32,4 @@ public class BankInfoDto {
 	private String swiftCode;
 	private String abroad;
 
-	public String getName() {
-		return name;
-	}
-
-	public void setName(String name) {
-		this.name = name;
-	}
-
-	public String getPapersType() {
-		return papersType;
-	}
-
-	public void setPapersType(String papersType) {
-		this.papersType = papersType;
-	}
-
-	public String getPapersNo() {
-		return papersNo;
-	}
-
-	public void setPapersNo(String papersNo) {
-		this.papersNo = papersNo;
-	}
-
-	public String getNationality() {
-		return nationality;
-	}
-
-	public void setNationality(String nationality) {
-		this.nationality = nationality;
-	}
-
-	public String getAccount() {
-		return account;
-	}
-
-	public void setAccount(String account) {
-		this.account = account;
-	}
-
-	public String getPayBankCode() {
-		return payBankCode;
-	}
-
-	public void setPayBankCode(String payBankCode) {
-		this.payBankCode = payBankCode;
-	}
-
-	public String getTel() {
-		return tel;
-	}
-
-	public void setTel(String tel) {
-		this.tel = tel;
-	}
-
-	public String getTitle() {
-		return title;
-	}
-
-	public void setTitle(String title) {
-		this.title = title;
-	}
-
-	public String getSwiftCode() {
-		return swiftCode;
-	}
-
-	public void setSwiftCode(String swiftCode) {
-		this.swiftCode = swiftCode;
-	}
-
-	public String getAbroad() {
-		return abroad;
-	}
-
-	public void setAbroad(String abroad) {
-		this.abroad = abroad;
-	}
 }

+ 4 - 104
sp-core/sp-api/src/main/java/com/pj/api/dto/HtGroupDto.java

@@ -1,13 +1,15 @@
 package com.pj.api.dto;
 
 import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
 
 import java.io.Serializable;
 
-
+@Data
 public class HtGroupDto implements Serializable {
 
-
+    @JsonProperty("opType")
+    private String opType;
     @JsonProperty("platSeqNo")
     private String platSeqNo;
     @JsonProperty("customsCode")
@@ -35,107 +37,5 @@ public class HtGroupDto implements Serializable {
     @JsonProperty("dclBorderList")
     private String dclBorderList;
 
-    public String getPlatSeqNo() {
-        return platSeqNo;
-    }
-
-    public void setPlatSeqNo(String platSeqNo) {
-        this.platSeqNo = platSeqNo;
-    }
-
-    public String getCustomsCode() {
-        return customsCode;
-    }
-
-    public void setCustomsCode(String customsCode) {
-        this.customsCode = customsCode;
-    }
-
-    public String getOrgName() {
-        return orgName;
-    }
-
-    public void setOrgName(String orgName) {
-        this.orgName = orgName;
-    }
-
-    public String getAddress() {
-        return address;
-    }
-
-    public void setAddress(String address) {
-        this.address = address;
-    }
-
-    public String getShopsSccd() {
-        return shopsSccd;
-    }
-
-    public void setShopsSccd(String shopsSccd) {
-        this.shopsSccd = shopsSccd;
-    }
-
-    public String geteDStatus() {
-        return eDStatus;
-    }
-
-    public void seteDStatus(String eDStatus) {
-        this.eDStatus = eDStatus;
-    }
-
-    public String getExpiry() {
-        return expiry;
-    }
-
-    public void setExpiry(String expiry) {
-        this.expiry = expiry;
-    }
-
-    public String getPutrecNo() {
-        return putrecNo;
-    }
-
-    public void setPutrecNo(String putrecNo) {
-        this.putrecNo = putrecNo;
-    }
-
-    public String getLocalGovernmentNo() {
-        return localGovernmentNo;
-    }
-
-    public void setLocalGovernmentNo(String localGovernmentNo) {
-        this.localGovernmentNo = localGovernmentNo;
-    }
-
-    public String getFilingStatus() {
-        return filingStatus;
-    }
-
-    public void setFilingStatus(String filingStatus) {
-        this.filingStatus = filingStatus;
-    }
-
-    public String getFieldCode() {
-        return fieldCode;
-    }
-
-    public void setFieldCode(String fieldCode) {
-        this.fieldCode = fieldCode;
-    }
-
-    public String getBorderList() {
-        return borderList;
-    }
-
-    public void setBorderList(String borderList) {
-        this.borderList = borderList;
-    }
-
-    public String getDclBorderList() {
-        return dclBorderList;
-    }
 
-    public void setDclBorderList(String dclBorderList) {
-        this.dclBorderList = dclBorderList;
-    }
 }

+ 47 - 0
sp-core/sp-api/src/main/java/com/pj/api/dto/PaymentDto.java

@@ -176,14 +176,17 @@ public class PaymentDto implements Serializable {
 	//边民姓名
 	private String borderName;
 	//证件类型
+	private String papersType;
 	//边民证件号
 	private String borderidno;
 	//国籍
+	private String borderNationality;
 	//银行账号
 	private String bankCode;
 	//银行名称
 	private String bankName;
 	//银行代码
+	private String bankNo;
 	//联系电话
 	private String borderTel;
 
@@ -202,6 +205,8 @@ public class PaymentDto implements Serializable {
 	//商铺联系电话
 	private String ownerTel;
 
+	//商品编码
+	private String codeTs;
 	//商品名称
 	private String goodsName;
 	//商品单位
@@ -212,6 +217,8 @@ public class PaymentDto implements Serializable {
 	private Double buyQty;
 	//商品重量(毛重)
 	private Double grossWt;
+	//商品重量(净重)
+	private Double netWt;
 
 	private String tradeNos;
 
@@ -263,6 +270,14 @@ public class PaymentDto implements Serializable {
 		this.ownerTel = ownerTel;
 	}
 
+	public String getCodeTs() {
+		return codeTs;
+	}
+
+	public void setCodeTs(String codeTs) {
+		this.codeTs = codeTs;
+	}
+
 	public String getGoodsName() {
 		return goodsName;
 	}
@@ -303,6 +318,14 @@ public class PaymentDto implements Serializable {
 		this.grossWt = grossWt;
 	}
 
+	public Double getNetWt() {
+		return netWt;
+	}
+
+	public void setNetWt(Double netWt) {
+		this.netWt = netWt;
+	}
+
 	public String getBorderName() {
 		return borderName;
 	}
@@ -319,6 +342,22 @@ public class PaymentDto implements Serializable {
 		this.borderidno = borderidno;
 	}
 
+	public String getPapersType() {
+		return papersType;
+	}
+
+	public void setPapersType(String papersType) {
+		this.papersType = papersType;
+	}
+
+	public String getBorderNationality() {
+		return borderNationality;
+	}
+
+	public void setBorderNationality(String borderNationality) {
+		this.borderNationality = borderNationality;
+	}
+
 	public String getBankCode() {
 		return bankCode;
 	}
@@ -335,6 +374,14 @@ public class PaymentDto implements Serializable {
 		this.bankName = bankName;
 	}
 
+	public String getBankNo() {
+		return bankNo;
+	}
+
+	public void setBankNo(String bankNo) {
+		this.bankNo = bankNo;
+	}
+
 	public String getBorderTel() {
 		return borderTel;
 	}

+ 79 - 6
sp-core/sp-api/src/main/java/com/pj/api/dto/PaymentTwoDto.java

@@ -177,14 +177,17 @@ public class PaymentTwoDto implements Serializable {
 	//边民姓名
 	private String borderName;
 	//证件类型
+	private String papersType;
 	//边民证件号
 	private String borderidno;
 	//国籍
+	private String borderNationality;
 	//银行账号
 	private String bankCode;
 	//银行名称
 	private String bankName;
 	//银行代码
+	private String bankNo;
 	//联系电话
 	private String borderTel;
 
@@ -213,6 +216,8 @@ public class PaymentTwoDto implements Serializable {
 	private Double buyQty;
 	//商品重量(毛重)
 	private Double grossWt;
+	//商品重量(净重)
+	private Double netWt;
 
 	private String tradeNos;
 
@@ -222,17 +227,29 @@ public class PaymentTwoDto implements Serializable {
 	 */
 	private String pcName;
 	/**
-	 * 营业执照
+	 * 统一社会信用代码
 	 */
-	private String businessLicense;
+	private String dutyParagraph;
 	/**
 	 * 银行账号
 	 */
 	private String pcBankAccount;
 	/**
+	 * 银行代码
+	 */
+	private String pcBankNo;
+	/**
 	 * 手机号码
 	 */
 	private String pcContact;
+	/**
+	 * 身份证号
+	 */
+	private String pcIdCard;
+	/**
+	 * 采购商类型
+	 */
+	private Integer pcType;
 
 	//费项列表
 	private List<CompanyDto> companyDtoList;
@@ -253,12 +270,20 @@ public class PaymentTwoDto implements Serializable {
 		this.pcName = pcName;
 	}
 
-	public String getBusinessLicense() {
-		return businessLicense;
+	public String getDutyParagraph() {
+		return dutyParagraph;
+	}
+
+	public void setDutyParagraph(String dutyParagraph) {
+		this.dutyParagraph = dutyParagraph;
 	}
 
-	public void setBusinessLicense(String businessLicense) {
-		this.businessLicense = businessLicense;
+	public String getPcBankNo() {
+		return pcBankNo;
+	}
+
+	public void setPcBankNo(String pcBankNo) {
+		this.pcBankNo = pcBankNo;
 	}
 
 	public String getPcBankAccount() {
@@ -277,6 +302,22 @@ public class PaymentTwoDto implements Serializable {
 		this.pcContact = pcContact;
 	}
 
+	public String getPcIdCard() {
+		return pcIdCard;
+	}
+
+	public void setPcIdCard(String pcIdCard) {
+		this.pcIdCard = pcIdCard;
+	}
+
+	public Integer getPcType() {
+		return pcType;
+	}
+
+	public void setPcType(Integer pcType) {
+		this.pcType = pcType;
+	}
+
 	public String getTradeNos() {
 		return tradeNos;
 	}
@@ -373,6 +414,14 @@ public class PaymentTwoDto implements Serializable {
 		this.grossWt = grossWt;
 	}
 
+	public Double getNetWt() {
+		return netWt;
+	}
+
+	public void setNetWt(Double netWt) {
+		this.netWt = netWt;
+	}
+
 	public String getBorderName() {
 		return borderName;
 	}
@@ -389,6 +438,30 @@ public class PaymentTwoDto implements Serializable {
 		this.borderidno = borderidno;
 	}
 
+	public String getPapersType() {
+		return papersType;
+	}
+
+	public void setPapersType(String papersType) {
+		this.papersType = papersType;
+	}
+
+	public String getBorderNationality() {
+		return borderNationality;
+	}
+
+	public void setBorderNationality(String borderNationality) {
+		this.borderNationality = borderNationality;
+	}
+
+	public String getBankNo() {
+		return bankNo;
+	}
+
+	public void setBankNo(String bankNo) {
+		this.bankNo = bankNo;
+	}
+
 	public String getBankCode() {
 		return bankCode;
 	}

+ 35 - 52
sp-core/sp-api/src/main/java/com/pj/api/dto/PeopleDto.java

@@ -101,58 +101,6 @@ public class PeopleDto {
         this.idCardImg = idCardImg;
     }
 
-
-    public PeopleDto(Long id, Long tradeAreaId, String tradeAreaName, String name, String code, Integer sex, Integer age, String idCard, String idCardImg, String phone, String bankNo, String bankCode, String bankName, Long groupId, String groupName, Integer status, Integer role, Double lng, Double lat, String lastLocation, String address, String addressIds, String detailAddress, Integer isLock, Double leftPrice, Integer judgeStatus, String judgeContent, Date registerTime, Date judgeTime, String personId, Date createTime, String createBy, String createName, Date updateTime, String updateBy, String updateName, Integer deleteStatus, String platSeqNo, Date startDate, Date endDate, String idcdGcertPgoffNm, String birplAddr, String customsCode, Date expiry, String putrecNo, String localGovernmentNo, String filingStatus, String fieldCode) {
-        this.id = id;
-        this.tradeAreaId = tradeAreaId;
-        this.tradeAreaName = tradeAreaName;
-        this.name = name;
-        this.code = code;
-        this.sex = sex;
-        this.age = age;
-        this.idCard = idCard;
-        this.idCardImg = idCardImg;
-        this.phone = phone;
-        this.bankNo = bankNo;
-        this.bankCode = bankCode;
-        this.bankName = bankName;
-        this.groupId = groupId;
-        this.groupName = groupName;
-        this.status = status;
-        this.role = role;
-        this.lng = lng;
-        this.lat = lat;
-        this.lastLocation = lastLocation;
-        this.address = address;
-        this.addressIds = addressIds;
-        this.detailAddress = detailAddress;
-        this.isLock = isLock;
-        this.leftPrice = leftPrice;
-        this.judgeStatus = judgeStatus;
-        this.judgeContent = judgeContent;
-        this.registerTime = registerTime;
-        this.judgeTime = judgeTime;
-        this.personId = personId;
-        this.createTime = createTime;
-        this.createBy = createBy;
-        this.createName = createName;
-        this.updateTime = updateTime;
-        this.updateBy = updateBy;
-        this.updateName = updateName;
-        this.deleteStatus = deleteStatus;
-        this.platSeqNo = platSeqNo;
-        this.startDate = startDate;
-        this.endDate = endDate;
-        this.idcdGcertPgoffNm = idcdGcertPgoffNm;
-        this.birplAddr = birplAddr;
-        this.customsCode = customsCode;
-        this.expiry = expiry;
-        this.putrecNo = putrecNo;
-        this.localGovernmentNo = localGovernmentNo;
-        this.filingStatus = filingStatus;
-        this.fieldCode = fieldCode;
-    }
-
     public String getBankNo() {
         return bankNo;
     }
@@ -457,6 +405,22 @@ public class PeopleDto {
         this.fieldCode = fieldCode;
     }
 
+    public String getPapersType() {
+        return papersType;
+    }
+
+    public void setPapersType(String papersType) {
+        this.papersType = papersType;
+    }
+
+    public String getNationality() {
+        return nationality;
+    }
+
+    public void setNationality(String nationality) {
+        this.nationality = nationality;
+    }
+
     private Long id;
 
     /**
@@ -701,8 +665,27 @@ public class PeopleDto {
      */
     private String fieldCode;
 
+    //证件类型
+    private String papersType;
+    //国籍
+    private String nationality;
+
+    private String leaderName;
+    private String leaderPhone;
 
+    public String getLeaderName() {
+        return leaderName;
+    }
 
+    public void setLeaderName(String leaderName) {
+        this.leaderName = leaderName;
+    }
 
+    public String getLeaderPhone() {
+        return leaderPhone;
+    }
 
+    public void setLeaderPhone(String leaderPhone) {
+        this.leaderPhone = leaderPhone;
+    }
 }

+ 155 - 0
sp-core/sp-api/src/main/java/com/pj/api/dto/PeopleTaxAccountDto.java

@@ -0,0 +1,155 @@
+package com.pj.api.dto;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * Model: tb_people_tax_account -- 边民-税务开户信息
+ * @author lbl
+ */
+@Data
+@Accessors(chain = true)
+public class PeopleTaxAccountDto implements Serializable {
+
+
+	private String id;
+
+	/**
+	 * 边民表ID
+	 */
+	private Long peopleId;
+
+	/**
+	 * 个体户名称
+	 */
+	private String businessName;
+
+	/**
+	 * 社会统一信用代码
+	 */
+	private String dutyParagraph;
+
+	/**
+	 * 经营者(边民)
+	 */
+	private String name;
+
+	/**
+	 * 地址
+	 */
+	private String address;
+
+	/**
+	 * 组成形式
+	 */
+	private String form;
+
+	/**
+	 * 联系人
+	 */
+	private String contacts;
+
+	/**
+	 * 联系电话
+	 */
+	private String phone;
+
+	/**
+	 * 经营场所
+	 */
+	private String businessAddress;
+
+	/**
+	 * 经营范围
+	 */
+	private String businessScope;
+
+	/**
+	 * 经营状态
+	 */
+	private String businessStatus;
+
+	/**
+	 * 身份证
+	 */
+	private String idCard;
+
+	/**
+	 * 开户行
+	 */
+	private String bankName;
+
+	/**
+	 * 银行账号
+	 */
+	private String bankCode;
+
+	/**
+	 * 开票商
+	 */
+	private String invoiceBusiness;
+
+	/**
+	 * 开票人
+	 */
+	private String invoicePeople;
+
+	/**
+	 * 收款人
+	 */
+	private String payee;
+
+	/**
+	 * 复核人
+	 */
+	private String checker;
+
+	/**
+	 * 创建时间
+	 */
+	private Date createTime;
+
+	/**
+	 * 创建人编号
+	 */
+	private String createBy;
+
+	/**
+	 * 创建人名称
+	 */
+	private String createName;
+
+	/**
+	 * 更新时间
+	 */
+	private Date updateTime;
+
+	/**
+	 * 更新人编号
+	 */
+	private String updateBy;
+
+	/**
+	 * 更新人名称
+	 */
+	private String updateName;
+
+	/**
+	 * 互市区id
+	 */
+	private Long tradeAreaId;
+
+	/**
+	 * 互市区名称
+	 */
+	private String tradeAreaName;
+
+
+
+
+
+
+}

+ 5 - 1
sp-core/sp-base/pom.xml

@@ -41,7 +41,11 @@
             <version>2.1.0</version>
         </dependency>
 
-
+        <dependency>
+            <groupId>com.arcsoft.face</groupId>
+            <artifactId>arcsoft-sdk-face</artifactId>
+            <version>3.0.0.0</version>
+        </dependency>
         <!--人脸识别 阿里云 新版-->
         <dependency>
             <groupId>com.aliyun</groupId>

+ 7 - 1
sp-core/sp-base/src/main/java/com/pj/current/config/MyConfig.java

@@ -46,7 +46,13 @@ public class MyConfig {
 	/**
 	 * 人脸配置
 	 */
-	private String faceType="tencen";
+	private String faceType;
+
+	private String faceImgPath;
+	private String faceLibs;
+
+	private String arcsoftAppid;
+	private String arcsoftSdkKey;
 
 	
 }

+ 4 - 6
sp-core/sp-base/src/main/java/com/pj/current/config/SystemObject.java

@@ -1,7 +1,6 @@
 package com.pj.current.config;
 
 import com.pj.common.core.utils.DateUtils;
-import com.pj.face.factory.FaceFactory;
 import com.pj.sms.factory.SmsFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
@@ -37,6 +36,10 @@ public class SystemObject {
         return getPasswordMd5(0, password);
     }
 
+    public static String getFaceImgPath() {
+        return config.getFaceImgPath();
+    }
+
 
     // ===================================== yml自定义配置信息 ===================================================
 
@@ -55,11 +58,6 @@ public class SystemObject {
     }
 
 
-    public static FaceFactory factory;
-    @Autowired
-    void setConfig(FaceFactory factory) {
-        SystemObject.factory = factory;
-    }
 
     // ===================================== 生成订单号工具类 ===================================================
 

+ 127 - 117
sp-core/sp-base/src/main/java/com/pj/project4sp/apilog/SpApilogUtil.java

@@ -1,9 +1,11 @@
 package com.pj.project4sp.apilog;
 
 import java.util.Date;
+import java.util.Map;
 
 import javax.servlet.http.HttpServletRequest;
 
+import cn.hutool.core.util.StrUtil;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 import org.springframework.web.context.request.RequestContextHolder;
@@ -22,127 +24,135 @@ import cn.hutool.core.util.IdUtil;
 
 /**
  * 工具类:api请求记录表
- * @author kong 
  *
+ * @author kong
  */
 @Component
 public class SpApilogUtil {
 
-	/** 底层 Mapper 对象 */
-	static SpApilogMapper spApilogMapper;
-	@Autowired
-	public void setSpApilogMapper(SpApilogMapper spApilogMapper) {
-		SpApilogUtil.spApilogMapper = spApilogMapper;
-	}
-	
-	static final String APILOG_OBJ_SAVE_KEY = "APILOG_OBJ_SAVE_KEY";
-	static final String APILOG_OBJ_SAVE_ID_KEY = "APILOG_OBJ_SAVE_ID_KEY";
-	
-	/**
-	 * 请求开始时调用,开始计时 
-	 */
-	public static void startRequest() {
-		if(isWeb() == false)  {
-			return;
-		}
-		
-		// 1、开始时 
-    	HttpServletRequest request = SpringMVCUtil.getRequest();
-    	SpApilog a = new SpApilog();
-    	a.setId(getSnowflakeId());		
-    	a.setReqIp(WebNbUtil.getIP(request));	
-    	a.setReqApi(request.getRequestURI());;		
-    	a.setReqParame(JSON.toJSONString(WebNbUtil.getParamsMap2(request)));	
-    	a.setReqToken(StpUtil.getTokenValue());			
-    	a.setReqHeader(JSON.toJSONString(WebNbUtil.getHeaderMap(request)));		
-    	a.setReqType(request.getMethod());		
-    	a.setAdminId(StpUtil.getLoginId(0L));	
-    	a.setUserId(StpUserUtil.getLoginId(0L));		
-    	a.setStartTime(new Date());			
-    	request.setAttribute(APILOG_OBJ_SAVE_KEY, a);
-    	
-    	// 控制台日志 
-    	LogUtil.info("----------------------------------------------------------------");
-		LogUtil.info("IP: " + a.getReqIp() + "\tr-> " + a.getReqApi()+ "\tp-> " + a.getReqParame());
-	}
-	
-
-	/**
-	 * 请求结束时调用,结束计时 
-	 * @param aj
-	 */
-	public static void endRequest(AjaxJson aj) {
-		if(isWeb() == false)  {
-			return;
-		}
-		
-		// 读取本次请求的 ApiLog 对象 
-		HttpServletRequest request = SpringMVCUtil.getRequest();
-		SpApilog a = (SpApilog)request.getAttribute(APILOG_OBJ_SAVE_KEY);
-		if(a == null) {
+    /**
+     * 底层 Mapper 对象
+     */
+    static SpApilogMapper spApilogMapper;
+
+    @Autowired
+    public void setSpApilogMapper(SpApilogMapper spApilogMapper) {
+        SpApilogUtil.spApilogMapper = spApilogMapper;
+    }
+
+    static final String APILOG_OBJ_SAVE_KEY = "APILOG_OBJ_SAVE_KEY";
+    static final String APILOG_OBJ_SAVE_ID_KEY = "APILOG_OBJ_SAVE_ID_KEY";
+
+    /**
+     * 请求开始时调用,开始计时
+     */
+    public static void startRequest() {
+        if (isWeb() == false) {
+            return;
+        }
+
+        // 1、开始时
+        HttpServletRequest request = SpringMVCUtil.getRequest();
+        SpApilog a = new SpApilog();
+        a.setId(getSnowflakeId());
+        a.setReqIp(WebNbUtil.getIP(request));
+        a.setReqApi(request.getRequestURI());
+        Map<String, Object> params = WebNbUtil.getParamsMap2(request);
+        if (StrUtil.contains(request.getRequestURI(), "faceImg")) {
+            params.remove("img");
+        }
+        a.setReqParame(JSON.toJSONString(params));
+        a.setReqToken(StpUtil.getTokenValue());
+        a.setReqHeader(JSON.toJSONString(WebNbUtil.getHeaderMap(request)));
+        a.setReqType(request.getMethod());
+        a.setAdminId(StpUtil.getLoginId(0L));
+        a.setUserId(StpUserUtil.getLoginId(0L));
+        a.setStartTime(new Date());
+        request.setAttribute(APILOG_OBJ_SAVE_KEY, a);
+
+        // 控制台日志
+        LogUtil.info("----------------------------------------------------------------");
+        LogUtil.info("IP: " + a.getReqIp() + "\tr-> " + a.getReqApi() + "\tp-> " + a.getReqParame());
+    }
+
+
+    /**
+     * 请求结束时调用,结束计时
+     *
+     * @param aj
+     */
+    public static void endRequest(AjaxJson aj) {
+        if (isWeb() == false) {
+            return;
+        }
+
+        // 读取本次请求的 ApiLog 对象
+        HttpServletRequest request = SpringMVCUtil.getRequest();
+        SpApilog a = (SpApilog) request.getAttribute(APILOG_OBJ_SAVE_KEY);
+        if (a == null) {
 //	    	LogUtil.info("未找到相应ApiLog对象(可能原因:全局异常),aj=" + aj);
-	    	SpApilogUtil.startRequest();	
-	    	a = (SpApilog)request.getAttribute(APILOG_OBJ_SAVE_KEY);
-		}
-
-		// 保存数据库
-		try {
-			// 开始结束计时 
-			a.setResCode(aj.getCode()); 	
-			a.setResMsg(aj.getMsg());	
-			a.setResString(new ObjectMapper().writeValueAsString(aj));		
-			a.setEndTime(new Date());		
-			a.setCostTime((int)(a.getEndTime().getTime() - a.getStartTime().getTime()));
-			
-			// res 字符串过长时禁止写入  
-			if(a.getResString().length() > 50000) {
-				a.setResString("{\"msg\": \"数据过长,无法写入 (length=" + a.getResString().length() + ")\"}");		
-			}
-		
-        	LogUtil.info("本次请求耗时:" + ((a.getCostTime() + 0.0) / 1000) + "s, 返回:" + a.getResString());
-			a.setCreateTime(new Date());
-        	spApilogMapper.saveObj(a);
-		} catch (Exception e) {
-			e.printStackTrace();
-		}
-	}
-	
-	
-	
-	
-
-	/**
-	 * 当前是否为web环境 
-	 */
-	public static boolean isWeb() {
-		// 大善人SpringMVC提供的封装 
-		ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
-		if(servletRequestAttributes != null) {
-			return true;
-		}
-		return false;
-	}
-
-
-	/** 获取当前请求的id */
-	public static String getCurrReqId() {
-		HttpServletRequest request = SpringMVCUtil.getRequest();
-		String id = (String)request.getAttribute(APILOG_OBJ_SAVE_ID_KEY);
-		if(id == null) {
-			id = IdUtil.simpleUUID();
-			request.setAttribute(APILOG_OBJ_SAVE_ID_KEY, id);
-		}
-		return id;
-	}
-
-
-	/**
-	 * 根据雪花算法,返回唯一id 
-	 * (此地方将workerId写死为1,如果你在分布式场景中应用此方法,你需要对workerId生成策略进行改造)
-	 * @return
-	 */
-	public static String getSnowflakeId() {
-		return IdUtil.getSnowflake(1, 1).nextIdStr();
-	}
-	
+            SpApilogUtil.startRequest();
+            a = (SpApilog) request.getAttribute(APILOG_OBJ_SAVE_KEY);
+        }
+
+        // 保存数据库
+        try {
+            // 开始结束计时
+            a.setResCode(aj.getCode());
+            a.setResMsg(aj.getMsg());
+            a.setResString(new ObjectMapper().writeValueAsString(aj));
+            a.setEndTime(new Date());
+            a.setCostTime((int) (a.getEndTime().getTime() - a.getStartTime().getTime()));
+
+            // res 字符串过长时禁止写入
+            if (a.getResString().length() > 50000) {
+                a.setResString("{\"msg\": \"数据过长,无法写入 (length=" + a.getResString().length() + ")\"}");
+            }
+
+            LogUtil.info("本次请求耗时:" + ((a.getCostTime() + 0.0) / 1000) + "s, 返回:" + a.getResString());
+            a.setCreateTime(new Date());
+            spApilogMapper.saveObj(a);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+
+    /**
+     * 当前是否为web环境
+     */
+    public static boolean isWeb() {
+        // 大善人SpringMVC提供的封装
+        ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+        if (servletRequestAttributes != null) {
+            return true;
+        }
+        return false;
+    }
+
+
+    /**
+     * 获取当前请求的id
+     */
+    public static String getCurrReqId() {
+        HttpServletRequest request = SpringMVCUtil.getRequest();
+        String id = (String) request.getAttribute(APILOG_OBJ_SAVE_ID_KEY);
+        if (id == null) {
+            id = IdUtil.simpleUUID();
+            request.setAttribute(APILOG_OBJ_SAVE_ID_KEY, id);
+        }
+        return id;
+    }
+
+
+    /**
+     * 根据雪花算法,返回唯一id
+     * (此地方将workerId写死为1,如果你在分布式场景中应用此方法,你需要对workerId生成策略进行改造)
+     *
+     * @return
+     */
+    public static String getSnowflakeId() {
+        return IdUtil.getSnowflake(1, 1).nextIdStr();
+    }
+
 }

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1 - 2
sp-core/sp-base/src/main/java/com/pj/utils/ht/AESUtil.java


+ 10 - 9
sp-core/sp-nacos/src/main/resources/logback.xml

@@ -2,14 +2,15 @@
 <configuration>
     <contextName>market</contextName>
     <property name="LOG_PATH" value="logs"/>
+    <property name="APP_DIR" value="pco"/>
     <property name="log.maxFileSize" value="10MB"/>
     <property name="log.maxFileCnt" value="90"/>
     <property name="log.totalSizeCap" value="10GB"/>
 
     <appender name="FILE_DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/log_debug.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/log_debug.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/debug/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/debug/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -27,9 +28,9 @@
     </appender>
 
     <appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/log_info.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/log_info.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/info/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/info/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -61,9 +62,9 @@
     </appender>
 
     <appender name="COMM_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/comm_info.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/comm_info.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/comm/comm_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/comm/comm_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -84,9 +85,9 @@
     </logger>
 
     <appender name="SXFX_info_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
-        <file>${LOG_PATH}/SxFx_info.log</file>
+        <file>${LOG_PATH}/${APP_DIR}/SxFx_info.log</file>
         <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
-            <fileNamePattern>${LOG_PATH}/SxFx/SxFx_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/SxFx/SxFx_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
             <maxFileSize>${log.maxFileSize}</maxFileSize>
             <maxHistory>${log.maxFileCnt}</maxHistory>
             <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
@@ -114,7 +115,7 @@
     <logger name="java.sql.PreparedStatement" level="DEBUG"/>
 
     <!-- 生产环境下,将此级别配置为适合的级别,以免日志文件太多或影响程序性能 -->
-    <root level="debug">
+    <root level="INFO">
         <!-- 生产环境将请stdout,testfile去掉 -->
         <appender-ref ref="STDOUT"/>
         <appender-ref ref="FILE_DEBUG"/>

+ 6 - 6
sp-generate/src/main/java/com/pj/SpGenerateApplication.java

@@ -23,7 +23,7 @@ public class SpGenerateApplication {
 		// ===================================  设置连接信息  ===================================
         FlyConfig config = new FlyConfig();
         config.setDriverClassName("com.mysql.cj.jdbc.Driver");
-        config.setUrl("jdbc:mysql://106.15.1.216:3006/pay-system?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC");
+        config.setUrl("jdbc:mysql://106.15.1.216:3006/ht-sync?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC");
         config.setUsername("yun_user");
         config.setPassword("yun_Root@1123");
         config.setPrintSql(true);		// 是否打印sql
@@ -37,8 +37,8 @@ public class SpGenerateApplication {
 
 		// ===================================  一些全局设置  ===================================
 		GenCfgManager.cfg
-			.setProjectPath("D:/project/")	// 总项目地址 (生成代码的路径)
-	        .setServerProjectName("market-server/sp-service/payment-server")				// 服务端 - 项目名称
+			.setProjectPath("E:/projects/hs/")	// 总项目地址 (生成代码的路径)
+	        .setServerProjectName("market-server/sp-service/sp-admin")				// 服务端 - 项目名称
 //	        .setServerProjectName("sp-com/sp-core")			// 服务端 - 项目名称 (sp-com多模块版填此格式)
 	        .setCodePath("src/main/java/")					// 服务端代码 - 存放路径
 	        .setPackagePath( "com.pj")				// 服务端代码 - 总包名
@@ -64,7 +64,7 @@ public class SpGenerateApplication {
 			.setOutFC(false)					// 是否输出FC.java工厂类
 			.setDefaultMeunIcon("el-icon-folder-opened")	// 生成后台管理页面时,默认的菜单图标
 			.setWebLibImportWay(2) 			// 前端js库导入方式(1=cdn导入, 2=本地导入[需将sa-admin附带js包复制到kj文件夹])
-			 .addTableName("bank_info_charges")	// 添加要生成的表 (单个添加)
+			 .addTableName("ht_byte")	// 添加要生成的表 (单个添加)
 //			.addTableAll()		// 添加要生成的表 (一次性添加所有表)
 //          .removeTableName("sp_role", "sp_role_permission", "sp_admin", "sp_apilog", "sp_cfg")	// 移除这些内置的表,不必生成代码
             ;
@@ -74,8 +74,8 @@ public class SpGenerateApplication {
 
 		// ===================================  开始读取并输出   ===================================
 		GenUtil.doRead();	// 从数据库读取数据
-		GenUtil.doOutMyBatis();	// 输出java代码 (mybatis版本)
-		GenUtil.doOutMyBatisService();	// 输出java代码 - 追加service层
+		//GenUtil.doOutMyBatis();	// 输出java代码 (mybatis版本)
+		//GenUtil.doOutMyBatisService();	// 输出java代码 - 追加service层
 		GenUtil.doOutAdminHtml();	// 输出 admin后台管理页面
 //		GenUtil.doOutApidoc();	// 输出 接口文档页面
 

+ 5 - 4
sp-service/async-server/src/main/java/com/pj/feign/AmqpTemplateFeign.java

@@ -1,5 +1,6 @@
 package com.pj.feign;
 
+import cn.hutool.log.StaticLog;
 import com.alibaba.fastjson.JSON;
 import com.pj.api.dto.OrderDto;
 import com.pj.api.dto.OrdersDto;
@@ -34,7 +35,7 @@ public class AmqpTemplateFeign {
      * @param dataType
      */
     public <T> void sendObject(T t, String dataType) {
-        log.info("send data to ht:{},{}", dataType,JSON.toJSONString(t));
+        StaticLog.info("send data to ht:{},{}", dataType,JSON.toJSONString(t));
         //todo: 数据暂时定死
         DataDto dataDto = new DataDto();
         //msgId
@@ -55,13 +56,13 @@ public class AmqpTemplateFeign {
         String msgTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
         dataDto.setMsgTime(msgTime);
         //sign
-        String signString = "msgId=" + msgId + "&appId=" + appId + "&dataType=" + dataType + "&msgTime=" + msgTime + "&data=" + encryptCBC;
+        String signString = "msgId=" + msgId + "&appId=" + appId + "&dataType=" + dataType + "&msgTime=" + msgTime + "&data=" + encryptCBC + "&" + RabbitMQ.ACC_KEY;
         String sign = MD5.getMd5(signString, 32);
         dataDto.setSign(sign);
-
         //mq发送信息
         amqpTemplate.convertAndSend(RabbitMQ.TEST_SEND_QUEUE, dataDto);
-        log.info("send mq msg finish:{},{}", dataType,JSON.toJSONString(t));
+        StaticLog.info("send mq msg finish:{},{}", dataType,JSON.toJSONString(dataDto));
+        StaticLog.info("send mq msg finish:{},{}", dataType,JSON.toJSONString(t));
     }
 
     /**

+ 5 - 1
sp-service/async-server/src/main/java/com/pj/ht_byte/HtByte.java

@@ -9,6 +9,7 @@ import lombok.AllArgsConstructor;
 import lombok.EqualsAndHashCode;
 
 import lombok.Data;
+import lombok.NoArgsConstructor;
 import lombok.experimental.Accessors;
 import org.springframework.format.annotation.DateTimeFormat;
 
@@ -21,6 +22,7 @@ import org.springframework.format.annotation.DateTimeFormat;
 @TableName(HtByte.TABLE_NAME)
 @EqualsAndHashCode(callSuper = false)
 @AllArgsConstructor
+@NoArgsConstructor
 public class HtByte extends Model<HtByte> implements Serializable {
 	public HtByte(String messageId, String dataType, String body, String queueName, Integer finishStatus, Date createTime) {
 		this.messageId = messageId;
@@ -92,10 +94,12 @@ public class HtByte extends Model<HtByte> implements Serializable {
 	/**
 	 * 创建时间 
 	 */
-	@DateTimeFormat(pattern = "yyyy-MM-dd")
 	private Date createTime;
 
 
+	@TableField(exist = false)
+	private String details;
+
 
 
 

+ 1 - 31
sp-service/async-server/src/main/java/com/pj/ht_byte/HtByteController.java

@@ -25,39 +25,9 @@ public class HtByteController {
 	@Autowired
 	HtByteService htByteService;
 
-	/** 增 */  
-	@RequestMapping("add")
-	@SaCheckPermission(HtByte.PERMISSION_CODE_ADD)
-	public AjaxJson add(HtByte h){
-		htByteService.add(h);
-		h = htByteService.getById(SP.publicMapper.getPrimarykey());
-		return AjaxJson.getSuccessData(h);
-	}
 
-	/** 删 */  
-	@RequestMapping("delete")
-	@SaCheckPermission(HtByte.PERMISSION_CODE_DEL)
-	public AjaxJson delete(Integer id){
-		 htByteService.delete(Long.valueOf(id));
-		return AjaxJson.getSuccess();
-	}
 	
-	/** 删 - 根据id列表 */  
-	@RequestMapping("deleteByIds")
-	@SaCheckPermission(HtByte.PERMISSION_CODE_DEL)
-	public AjaxJson deleteByIds(){
-		List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class); 
-		int line = SP.publicMapper.deleteByIds(HtByte.TABLE_NAME, ids);
-		return AjaxJson.getByLine(line);
-	}
-	
-	/** 改 */  
-	@RequestMapping("update")
-	@SaCheckPermission(HtByte.PERMISSION_CODE_EDIT)
-	public AjaxJson update(HtByte h){
-		htByteService.update(h);
-		return AjaxJson.getSuccess();
-	}
+
 
 	/** 查 - 根据id */  
 	@RequestMapping("getById")

+ 1 - 10
sp-service/async-server/src/main/java/com/pj/ht_byte/HtByteMapper.xml

@@ -30,16 +30,7 @@
 			<if test=' this.has("finishStatus") '> and finish_status = #{finishStatus} </if>
 			<if test=' this.has("createTime") '> and create_time = #{createTime} </if>
 		</where>
-		order by
-		<choose>
-			<when test='sortType == 1'> id desc </when>
-			<when test='sortType == 2'> message_id desc </when>
-			<when test='sortType == 3'> body desc </when>
-			<when test='sortType == 4'> queue_name desc </when>
-			<when test='sortType == 5'> finish_status desc </when>
-			<when test='sortType == 6'> create_time desc </when>
-			<otherwise> id desc </otherwise>
-		</choose>
+		order by create_time desc
 	</select>
 	
 	

+ 61 - 33
sp-service/async-server/src/main/java/com/pj/ht_byte/HtByteService.java

@@ -1,6 +1,11 @@
 package com.pj.ht_byte;
 
 import java.util.List;
+
+import com.alibaba.fastjson2.JSONObject;
+import com.pj.dto.DataDto;
+import com.pj.rabbitmq.RabbitMQ;
+import com.pj.utils.ht.AESUtil;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -11,41 +16,64 @@ import com.pj.utils.sg.*;
 
 /**
  * Service: ht_byte -- 航通基础信息字节码表
- * @author yzs 
+ *
+ * @author yzs
  */
 @Service
 @Transactional(rollbackFor = Exception.class)
-public class HtByteService extends ServiceImpl<HtByteMapper, HtByte> implements IService<HtByte>{
-
-	/** 底层 Mapper 对象 */
-	@Autowired
-	HtByteMapper htByteMapper;
-
-	/** 增 */
-	void add(HtByte h){
-		save(h);
-	}
-
-	/** 删 */
-	void delete(Long id){
-		removeById(id);
-	}
-
-	/** 改 */
-	void update(HtByte h){
-		updateById(h);
-
-	}
-
-	/** 查 */
-	HtByte getById(Integer id){
-		return super.getById(id);
-	}
-
-	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
-	List<HtByte> getList(SoMap so) { 
-		return htByteMapper.getList(so);	
-	}
-	
+public class HtByteService extends ServiceImpl<HtByteMapper, HtByte> implements IService<HtByte> {
+
+    /**
+     * 底层 Mapper 对象
+     */
+    @Autowired
+    HtByteMapper htByteMapper;
+
+    /**
+     * 增
+     */
+    void add(HtByte h) {
+        save(h);
+    }
+
+    /**
+     * 删
+     */
+    void delete(Long id) {
+        removeById(id);
+    }
+
+    /**
+     * 改
+     */
+    void update(HtByte h) {
+        updateById(h);
+
+    }
+
+    /**
+     * 查
+     */
+    HtByte getById(Integer id) {
+        HtByte htByte = super.getById(id);
+        DataDto dataDto = JSONObject.parseObject(htByte.getBody(), DataDto.class);
+        String body = AESUtil.decryptCBC(dataDto.getData(), RabbitMQ.ACC_KEY);
+        htByte.setDetails(body);
+        return htByte;
+    }
+
+    /**
+     * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+     */
+    List<HtByte> getList(SoMap so) {
+        List<HtByte> list = htByteMapper.getList(so);
+        list.forEach(htByte -> {
+            DataDto dataDto = JSONObject.parseObject(htByte.getBody(), DataDto.class);
+            String body = AESUtil.decryptCBC(dataDto.getData(), RabbitMQ.ACC_KEY);
+            htByte.setDetails(body);
+        });
+        return list;
+    }
+
 
 }

+ 4 - 4
sp-service/async-server/src/main/java/com/pj/listen/BaseInfoListen.java

@@ -1,6 +1,7 @@
 package com.pj.listen;
 
 import cn.hutool.core.util.RandomUtil;
+import cn.hutool.log.StaticLog;
 import com.alibaba.fastjson2.JSONObject;
 import com.pj.api.dto.OrderDto;
 import com.pj.dto.DataDto;
@@ -37,12 +38,11 @@ public class BaseInfoListen {
      */
     @RabbitListener(queuesToDeclare = @Queue(RabbitMQ.TEST_ACCEPT_QUEUE))
     public void accept(Message json){
-        System.out.println("\n接收:信息同步\n");
         byte[] content = json.getBody();
         //保存到数据库
         String jsonString = new String(content);
+        StaticLog.info("\n接收:信息同步:{}",jsonString);
         htByteMapper.insert(new HtByte(RandomUtil.randomString(64),null,jsonString,RabbitMQ.TEST_ACCEPT_QUEUE, FinishStatus.FINISH_STATUS_ZERO.getCode(),new Date()));
-        System.out.println("\n消息同步完成。\n");
 
     }
 
@@ -51,7 +51,7 @@ public class BaseInfoListen {
      * 测试接收
      * 测试已通过
      */
-    @RabbitListener(queuesToDeclare = @Queue(RabbitMQ.TEST_SEND_QUEUE))
+    /*@RabbitListener(queuesToDeclare = @Queue(RabbitMQ.TEST_SEND_QUEUE))
     public void sendMessage(Message dataDto1){
         System.out.println("\n测试:接收信息\n");
         byte[] body = dataDto1.getBody();
@@ -60,6 +60,6 @@ public class BaseInfoListen {
         String cbc = AESUtil.decryptCBC(dataDto.getData(), RabbitMQ.ACC_KEY);
         OrderDto orderDto = JSONObject.parseObject(cbc, OrderDto.class);
         System.out.println("\n" + orderDto.toString() + "\n");
-    }
+    }*/
 
 }

+ 2 - 3
sp-service/async-server/src/main/java/com/pj/task/HtByteTask.java

@@ -211,10 +211,9 @@ public class HtByteTask {
                 case "007":
                     //放行记录(过卡记录)
                     HtPassCardDTO htPassCardDTO = JSONObject.parseObject(body, HtPassCardDTO.class);
-                    //{"msgId":"987578382983278592","appId":"shop01","dataType":"007","msgTime":"2024-08-25 14:50:45","sign":"23370a204e1fa1c2a1c5a27f78947d52",
-                    // "data":"zo5yvhKGlGI4DFIbdwOa2eDjupWkiKvfWDGdNIbpX3WbDq4LsUhnTYh6aLPdj+w4l6OmVzLEjgh2/FC8MVmkYqCT6MZ401A8I8h7JYNXr+Gh5kU3vUCNEdOdxC8PcOKQKEBya4oggQjnC2cP2V39am9gCpCQ49rq76pcQh4+igji79vxJ7mISJ+iup/bY5Ps3EhTw2UC16cvnnt+ZHoM12Jz0JhnCMS9yvI1gPSx+vguo456ZIuuMaWLDiKU5TP5bXWJFyU3/XL7dgK9V5AGSg/nM3bHfiDyLLrREeeDt/ODQ4wUrjgVYLuNMSSJ543cCTrsDLc6+78VfoYhq7KxJXFb3DPV3vfxGKq9D5ymuViSBewscq7QFJumeEI5VExO"}
                     //系统接收到航通过卡记录且卡口类型为'3卡':车辆已出一级市场, 修改相对应的一级市场订单状态
-                    if ("3卡".equals(htPassCardDTO.getChannelType())|| StrUtil.contains(htPassCardDTO.getChannelNo(),"3")) {
+                    if ("3卡".equals(htPassCardDTO.getChannelType())|| StrUtil.contains(htPassCardDTO.getChannelName(),"三卡")) {
+                        StaticLog.info("\n3卡放行记录(过卡记录)信息: htPassCardDTO = " + htPassCardDTO.toString() + "\n");
                         flag = FeignFactory.levelOneServerInterface.orderFinish(htPassCardDTO);
                         methodHtByteTask.updateHtByteInfo(flag, item, dataDto);
                         if (flag) {

+ 125 - 0
sp-service/async-server/src/main/resources/logback.xml

@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+    <contextName>async</contextName>
+    <property name="LOG_PATH" value="logs"/>
+    <property name="APP_DIR" value="pco"/>
+    <property name="log.maxFileSize" value="10MB"/>
+    <property name="log.maxFileCnt" value="90"/>
+    <property name="log.totalSizeCap" value="10GB"/>
+
+    <appender name="FILE_DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${LOG_PATH}/${APP_DIR}/log_debug.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/debug/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <maxFileSize>${log.maxFileSize}</maxFileSize>
+            <maxHistory>${log.maxFileCnt}</maxHistory>
+            <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
+        </rollingPolicy>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS}|%-5level{10}[%25.25thread{24}]%-40.40logger{39}|-Line:%-3L:%msg%n
+            </pattern>
+            <charset>utf-8</charset>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>debug</level>
+            <onMatch>ACCEPT</onMatch>
+            <!--            <onMismatch>DENY</onMismatch>-->
+        </filter>
+    </appender>
+
+    <appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${LOG_PATH}/${APP_DIR}/log_info.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/info/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <maxFileSize>${log.maxFileSize}</maxFileSize>
+            <maxHistory>${log.maxFileCnt}</maxHistory>
+            <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
+        </rollingPolicy>
+        <append>true</append>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS}|%-5level{10}[%25.25thread{24}]%-40.40logger{39}|-Line:%-3L:%msg%n
+            </pattern>
+            <charset>UTF-8</charset>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>info</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <!--encoder 默认配置为PatternLayoutEncoder-->
+        <encoder>
+            <pattern>%d{yyyy-MM-dd
+                HH:mm:ss.SSS}|%highlight(%-5level{10})[%boldYellow(%25.25thread{24})]%gray(%-50.50logger{49})|-Line:%boldYellow(%-3L):%msg%n
+            </pattern>
+            <charset>UTF-8</charset>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+            <level>info</level>
+        </filter>
+    </appender>
+
+    <appender name="COMM_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${LOG_PATH}/${APP_DIR}/comm_info.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/comm/comm_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <maxFileSize>${log.maxFileSize}</maxFileSize>
+            <maxHistory>${log.maxFileCnt}</maxHistory>
+            <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
+        </rollingPolicy>
+        <append>true</append>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <pattern>%msg%n</pattern>
+            <charset>UTF-8</charset>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>info</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+    <logger name="com.cryann.hsms.driver.netty" additivity="false">
+        <appender-ref ref="COMM_LOG"/>
+    </logger>
+
+    <appender name="SXFX_info_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${LOG_PATH}/${APP_DIR}/SxFx_info.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/SxFx/SxFx_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <maxFileSize>${log.maxFileSize}</maxFileSize>
+            <maxHistory>${log.maxFileCnt}</maxHistory>
+            <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
+        </rollingPolicy>
+        <append>true</append>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <pattern>%d{yyyy-MM-dd
+                HH:mm:ss.SSS}|%highlight(%-5level{10})[%boldYellow(%25.25thread{24})]%gray(%-50.50logger{49})|-Line:%boldYellow(%-3L):%msg%n
+            </pattern>
+            <charset>UTF-8</charset>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>info</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+
+    <logger name="org.springframework" level="WARN"/>
+    <logger name="org.hibernate" level="WARN"/>
+    <logger name="com.apache.ibatis" level="TRACE"/>
+    <logger name="java.sql.Connection" level="DEBUG"/>
+    <logger name="java.sql.Statement" level="DEBUG"/>
+    <logger name="java.sql.PreparedStatement" level="DEBUG"/>
+
+    <!-- 生产环境下,将此级别配置为适合的级别,以免日志文件太多或影响程序性能 -->
+    <root level="INFO">
+        <!-- 生产环境将请stdout,testfile去掉 -->
+        <appender-ref ref="STDOUT"/>
+        <appender-ref ref="FILE_DEBUG"/>
+        <!--<appender-ref ref="FILEWARN"/>-->
+        <appender-ref ref="FILE_INFO"/>
+    </root>
+</configuration>

+ 27 - 1
sp-service/level-one-server/src/main/java/com/pj/ht_trade_settlement/HtTradeSettlement.java

@@ -43,7 +43,7 @@ public class HtTradeSettlement extends Model<HtTradeSettlement> implements Seria
 	public static final String PERMISSION_CODE_EDIT = "ht-trade-settlement-edit";
 	public static final String PERMISSION_CODE_DEL = "ht-trade-settlement-del";
 	public static final String PERMISSION_CODE_LISTING = "listing-management";
-
+	public static final String PERMISSION_CODE_HZSCONFIRM = "ht-trade-settlement-hzsconfirm";
 
 
 
@@ -253,6 +253,32 @@ public class HtTradeSettlement extends Model<HtTradeSettlement> implements Seria
 	private Integer orderCount;
 	private Integer onSaleCount;
 	private Integer beOrderCount;
+	/**
+	 * 退运状态0正常 1 退运
+	 */
+	private Integer returns;
+	/**
+	 * 退运时间
+	 */
+	private Date returnsTime;
+	/**
+	 * 退单 0正常 1 退运
+	 */
+	private Integer chargebacks;
+	/**
+	 * 退单时间
+	 */
+	private Date chargebacksTime;
+
+	/**
+	 * 互助社确认状态[0=待确认,1=确认]
+	 */
+	private Integer hzsConfirmStatus;
+	/**
+	 * 互助社确认时间
+	 */
+	private Date hzsConfirmTime;
+
 
 	@TableField(exist = false)
 	private String sumUpPrice;

+ 20 - 2
sp-service/level-one-server/src/main/java/com/pj/ht_trade_settlement/HtTradeSettlementApi.java

@@ -2,8 +2,10 @@ package com.pj.ht_trade_settlement;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
 import com.pj.api.dto.TradeSettlementDto;
+import com.pj.current.dto.APPLoginUserInfo;
 import com.pj.current.satoken.StpAPPUserUtil;
 import com.pj.project4sp.SP;
+import com.pj.tb_order.TbOrderService;
 import com.pj.utils.sg.AjaxJson;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -12,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import javax.annotation.Resource;
 import java.util.List;
 
 
@@ -29,6 +32,8 @@ public class HtTradeSettlementApi {
      */
     @Autowired
     HtTradeSettlementService htTradeSettlementService;
+    @Resource
+    private TbOrderService tbOrderService;
 
     /**
      * 查 - 根据id
@@ -39,20 +44,34 @@ public class HtTradeSettlementApi {
         HtTradeSettlement h = htTradeSettlementService.getById(id);
         return AjaxJson.getSuccessData(h);
     }
+   @RequestMapping("getByIds")
+    public AjaxJson getByIds() {
+        StpAPPUserUtil.isLogin();
+       List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
+        List<HtTradeSettlement> list = htTradeSettlementService.listByIds(ids);
+        list.forEach(htTradeSettlement -> {
+           double upPrice= tbOrderService.sumUpPrice(htTradeSettlement.getId());
+           htTradeSettlement.setSumUpPrice(upPrice+"");
+        });
+        return AjaxJson.getSuccessData(list);
+    }
 
     /**
      * 查集合 - 根据条件(参数为空时代表忽略指定条件)
      */
     @RequestMapping("getList")
     public AjaxJson getList() {
+        if (!StpAPPUserUtil.isLogin()) {
+            return AjaxJson.getError("未登录");
+        }
         SoMap so = SoMap.getRequestSoMap();
-        so.put("enterpriseId", StpAPPUserUtil.getAPPLoginInfo().getFk());
         List<HtTradeSettlement> list = htTradeSettlementService.getList(so.startPage());
         return AjaxJson.getPageData(so.getDataCount(), list);
     }
 
     /**
      * 获取整车在售列表
+     *
      * @return
      */
     @RequestMapping("getOnSaleList")
@@ -66,5 +85,4 @@ public class HtTradeSettlementApi {
     }
 
 
-
 }

+ 13 - 0
sp-service/level-one-server/src/main/java/com/pj/ht_trade_settlement/HtTradeSettlementController.java

@@ -9,6 +9,7 @@ import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import java.util.Date;
 import java.util.List;
 
 
@@ -82,6 +83,18 @@ public class HtTradeSettlementController {
 		return AjaxJson.getPageData(so.getDataCount(), list);
 	}
 
+	//互助社确认进境结算单
+	@RequestMapping("hzsConfirm")
+	@SaCheckPermission(HtTradeSettlement.PERMISSION_CODE_HZSCONFIRM)
+	public AjaxJson hzsConfirm(Long id){
+		HtTradeSettlement h = new HtTradeSettlement();
+		h.setId(id);
+		h.setHzsConfirmStatus(1);
+		h.setHzsConfirmTime(new Date());
+		htTradeSettlementService.updateById(h);
+		return AjaxJson.getSuccess();
+	}
+
 	/*-----           正常业务逻辑👆👆    rpc远程调用👇👇 -----*/
 
 	/** 远程调用: 添加大订单时同事生成小定单 */

+ 7 - 3
sp-service/level-one-server/src/main/java/com/pj/ht_trade_settlement/HtTradeSettlementMapper.xml

@@ -46,7 +46,7 @@
 			<if test=' this.has("trafMode") '> and traf_mode = #{trafMode} </if>
 			<if test=' this.has("currCode") '> and curr_code = #{currCode} </if>
 			<if test=' this.has("packNo") '> and pack_no = #{packNo} </if>
-			<if test=' this.has("declTime") '> and decl_time = #{declTime} </if>
+			<if test=' this.has("declTime") '> and date_format(decl_time,'%Y-%m-%d') = #{declTime} </if>
 			<if test=' this.has("billNo") '> and bill_no = #{billNo} </if>
 			<if test=' this.has("voyageNo") '> and voyage_no = #{voyageNo} </if>
 			<if test=' this.has("finishStatus") '> and finish_status = #{finishStatus} </if>
@@ -54,6 +54,9 @@
 			<if test=' this.has("bordersList") '> and borders_list = #{bordersList} </if>
 			<if test=' this.has("borderBuyGoodsList") '> and border_buy_goods_list = #{borderBuyGoodsList} </if>
 			<if test=' this.has("enterpriseId") '> and enterprise_id = #{enterpriseId} </if>
+			<if test=' this.has("returns") '> and returns = #{returns} </if>
+			<if test=' this.has("chargebacks") '> and chargebacks = #{chargebacks} </if>
+			<if test=' this.has("hzsConfirmStatus") '> and hzs_confirm_status = #{hzsConfirmStatus} </if>
 			<if test=' this.has("id") '> and id = #{id} </if>
 		</where>
 		order by
@@ -91,15 +94,16 @@
 			<when test='sortType == 31'> sell_goods_list desc </when>
 			<when test='sortType == 32'> id desc </when>
 			<when test='sortType == 33'> finish_time desc </when>
-			<otherwise> plat_seq_no desc </otherwise>
+			<otherwise> create_time desc ,id desc </otherwise>
 		</choose>
 	</select>
 	<select id="getOnSaleList" resultType="com.pj.ht_trade_settlement.HtTradeSettlement">
         select *,(select sum(up_price) from tb_order where sale_main_id=ht_trade_settlement.id) as sumUpPrice
         from ht_trade_settlement
         where order_count = on_sale_count
-        and be_order_count=0 and g_flow='01' and i_e_flag='I' and check_pass_status=1
+        and be_order_count=0  and i_e_flag='I' and check_pass_status=1
         <if test=' this.has("veNo") '>and ve_no like concat('%',#{veNo},'%')</if>
+		<if test=' this.has("shopName") '>and shop_name like concat('%',#{shopName},'%')</if>
         <if test=' this.has("productName") '>and goods_names like concat('%',#{productName},'%')</if>
         <if test=' this.has("dateBegin") '>and date_format(create_time,'%Y-%m-%d') &gt;=#{dateBegin}</if>
         <if test=' this.has("dateEnd") '>and date_format(create_time,'%Y-%m-%d') &lt;=#{dateEnd}</if>

+ 17 - 2
sp-service/level-one-server/src/main/java/com/pj/ht_trade_settlement/HtTradeSettlementService.java

@@ -3,6 +3,7 @@ package com.pj.ht_trade_settlement;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.json.JSONUtil;
 import cn.hutool.log.StaticLog;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.pj.api.dto.*;
@@ -101,6 +102,20 @@ public class HtTradeSettlementService extends ServiceImpl<HtTradeSettlementMappe
      * 远程调用: 添加大订单时同时生成边民订单
      */
     public boolean tradeSettlementDto(TradeSettlementDto tradeSettlementDto) {
+        LambdaQueryWrapper<HtTradeSettlement>  wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(HtTradeSettlement::getPlatSeqNo, tradeSettlementDto.getPlatSeqNo());
+        List<HtTradeSettlement> htTradeSettlements = htTradeSettlementMapper.selectList(wrapper);
+        //删除已存在的大订单与小订单,保留航通送过来的最新记录
+        if(htTradeSettlements.size()>0) {
+            List<Long> idList = htTradeSettlements.stream().map(item -> item.getId()).collect(Collectors.toList());
+            LambdaQueryWrapper<TbOrder>  orderWrapper = new LambdaQueryWrapper<>();
+            orderWrapper.in(TbOrder::getSaleMainId, idList);
+            int orderDelete = tbOrderMapper.delete(orderWrapper);
+
+            int htTradeSettlementsDelete = htTradeSettlementMapper.delete(wrapper);
+            StaticLog.info("\n------删除航通旧进境结算单:platSeqNo={}", tradeSettlementDto.getPlatSeqNo());
+        }
+
         StaticLog.info("接收到航通结算订单:{}", JSONUtil.toJsonStr(tradeSettlementDto));
         HtTradeSettlement htTradeSettlement = new HtTradeSettlement();
         BeanUtils.copyProperties(tradeSettlementDto, htTradeSettlement);
@@ -122,7 +137,7 @@ public class HtTradeSettlementService extends ServiceImpl<HtTradeSettlementMappe
 
         TbTradeArea tbTradeArea = tbTradeAreaService.updateHandler(tradeSettlementDto.getFieldCode(), tradeSettlementDto.getFieldName(), "");
         Date applyTime = new Date(Long.parseLong(tradeSettlementDto.getDeclTime()));
-        htTradeSettlement.setDeclTime(DateUtil.format(applyTime, "yyyy-MM-dd HH:mm:ss"));
+        htTradeSettlement.setDeclTime(DateUtil.format(applyTime, "yyyy-MM-dd HH:mm:ss")).setFinishStatus(0);
         BigDecimal totalPrice = BigDecimal.ZERO;
         for (BordersListDto item : bordersListDtoList) {//开始创建边民订单
             totalPrice = totalPrice.add(BigDecimal.valueOf(item.getBuyAmount()));
@@ -183,7 +198,7 @@ public class HtTradeSettlementService extends ServiceImpl<HtTradeSettlementMappe
             //发送短信
             if (result == 1) {
                 String content = "您好,您的[边民互市订单]已经生成,订单商品是[" + tbOrder.getGoodsNames() + "]。请前往app进行交易确认";
-                SystemObject.smsFactory.handler().sendSMS(tbPeople.getPhone(), content);
+              // SystemObject.smsFactory.handler().sendSMS(tbPeople.getPhone(), content);
             }
         }
         htTradeSettlement.setTotalPrice(totalPrice);

+ 64 - 61
sp-service/level-one-server/src/main/java/com/pj/tb_group/TbGroup.java

@@ -14,7 +14,7 @@ import java.util.Date;
 
 /**
  * Model: tb_group -- 互助组
- * @author yzs 
+ * @author yzs
  */
 @Data
 @Accessors(chain = true)
@@ -24,15 +24,15 @@ public class TbGroup extends Model<TbGroup> implements Serializable {
 
 	// ---------- 模块常量 ----------
 	/**
-	 * 序列化版本id 
+	 * 序列化版本id
 	 */
-	private static final long serialVersionUID = 1L;	
+	private static final long serialVersionUID = 1L;
 	/**
-	 * 此模块对应的表名 
+	 * 此模块对应的表名
 	 */
-	public static final String TABLE_NAME = "tb_group";	
+	public static final String TABLE_NAME = "tb_group";
 	/**
-	 * 此模块对应的权限码 
+	 * 此模块对应的权限码
 	 */
 	public static final String PERMISSION_CODE = "tb-group";
 	public static final String PERMISSION_CODE_ADD = "tb-group-add";
@@ -44,168 +44,171 @@ public class TbGroup extends Model<TbGroup> implements Serializable {
 
 	// ---------- 表中字段 ----------
 	/**
-	 *  
+	 *
 	 */
 	@TableId(type = IdType.AUTO)
 	private Long id;
 
 	/**
-	 *  
+	 *
 	 */
-	private String addressIds;	
+	private String addressIds;
 
 	/**
-	 * 所属边境市(县、区)乡镇村屯 
+	 * 所属边境市(县、区)乡镇村屯
 	 */
-	private String address;	
+	private String address;
 
 	/**
-	 *  
+	 *
 	 */
-	private String detailAddress;	
+	private String detailAddress;
 
 	/**
-	 * 互助组名称 
+	 * 互助组名称
 	 */
-	private String orgName;	
+	private String orgName;
 
 	/**
-	 * 组长ID 
+	 * 组长ID
 	 */
-	private Long leaderId;	
+	private Long leaderId;
 
 	/**
-	 * 组长名 
+	 * 组长名
 	 */
-	private String leaderName;	
+	private String leaderName;
 
 	/**
-	 * 组长电话 
+	 * 组长电话
 	 */
-	private String leaderPhone;	
+	private String leaderPhone;
 
 	/**
-	 *  
+	 *
 	 */
-	private String code;	
+	private String code;
 
 	/**
-	 * 当天该组剩余额度 
+	 * 当天该组剩余额度
 	 */
-	private Double leftPrice;	
+	private Double leftPrice;
 
 	/**
-	 * 创建时间 
+	 * 创建时间
 	 */
 	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
 	private Date createTime;
 
 	/**
-	 * 创建人编号 
+	 * 创建人编号
 	 */
 	private Long createBy;
 
 	/**
-	 * 创建人名称 
+	 * 创建人名称
 	 */
-	private String createName;	
+	private String createName;
 
 	/**
-	 * 更新时间 
+	 * 更新时间
 	 */
 	@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
 	private Date updateTime;
 
 	/**
-	 * 更新人编号 
+	 * 更新人编号
 	 */
 	private Long updateBy;
 
 	/**
-	 * 更新人名称 
+	 * 更新人名称
 	 */
-	private String updateName;	
+	private String updateName;
 
 	/**
-	 * 删除状态(0=禁用,1=启用) 
+	 * 删除状态(0=禁用,1=启用)
 	 */
-	private Integer deleteStatus;	
+	private Integer deleteStatus;
 
 	/**
-	 * 是否锁住 
+	 * 是否锁住
 	 */
 	private Integer isLock;
 
 	/**
-	 * 互市区id 
+	 * 互市区id
 	 */
-	private Long tradeAreaId;	
+	private Long tradeAreaId;
 
 	/**
-	 * 互市区名称 
+	 * 互市区名称
 	 */
-	private String tradeAreaName;	
+	private String tradeAreaName;
 
 	/**
-	 * 地方平台的内部业务编号,每次申请都是新编号 
+	 * 地方平台的内部业务编号,每次申请都是新编号
 	 */
-	private String platSeqNo;	
+	private String platSeqNo;
 
 	/**
-	 * 关区代码 
+	 * 关区代码
 	 */
-	private String customsCode;	
+	private String customsCode;
 
 	/**
-	 * 登记号 
+	 * 登记号
 	 */
-	private String shopsSccd;	
+	private String shopsSccd;
 
 	/**
-	 * 启停用状态:1-启用、2-停用、3-注销 
+	 * 启停用状态:1-启用、2-停用、3-注销
 	 */
-	private String eDStatus;	
+	private String eDStatus;
 
 	/**
-	 * 有效效截止时间 yyyy-MM-dd 
+	 * 有效效截止时间 yyyy-MM-dd
 	 */
-	private String expiry;	
+	private String expiry;
 
 	/**
-	 * 备案编号,如果为新增备案,传空值;如果为变更备案,必须传值; 
+	 * 备案编号,如果为新增备案,传空值;如果为变更备案,必须传值;
 	 */
-	private String putrecNo;	
+	private String putrecNo;
 
 	/**
-	 *  地方政府编号 
+	 *  地方政府编号
 	 */
-	private String localGovernmentNo;	
+	private String localGovernmentNo;
 
 	/**
-	 * 备案状态:默认 0、待申报,1、已申报,2、备案通过,3、备案失败 
+	 * 备案状态:默认 0、待申报,1、已申报,2、备案通过,3、备案失败
 	 */
-	private String filingStatus;	
+	private String filingStatus;
 
 	/**
-	 * 场站编码 
+	 * 场站编码
 	 */
-	private String fieldCode;	
+	private String fieldCode;
 
 	/**
-	 * 边民信息表体信息,json 数组List, 
+	 * 边民信息表体信息,json 数组List,
 	 */
 	private String borderList;
 
 	/**
-	 * 互助组申报边民代表表体信息,json 数组 List 
+	 * 互助组申报边民代表表体信息,json 数组 List
 	 */
 	private String dclBorderList;
 
+	/**
+	 * 操作类型(01:新增;02:修改;03:删除)
+	 */
+	private String opType;
 
 
 
 
-	
 
 
 }

+ 48 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_group/TbGroupAPPController.java

@@ -0,0 +1,48 @@
+package com.pj.tb_group;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+import com.pj.api.dto.GroupDto;
+import com.pj.api.dto.HtGroupDto;
+import com.pj.current.satoken.StpAPPUserUtil;
+import com.pj.project4sp.SP;
+import com.pj.utils.sg.AjaxJson;
+import com.pj.utils.so.SoMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.IOException;
+import java.util.List;
+
+
+/**
+ * Controller: tb_group -- 互助组
+ *
+ * @author qzy
+ */
+@RestController
+@RequestMapping("/app/TbGroup/")
+public class TbGroupAPPController {
+
+    /**
+     * 底层 Service 对象
+     */
+    @Autowired
+    TbGroupService tbGroupService;
+
+    /**
+     * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+     */
+    @RequestMapping("getList")
+    public AjaxJson getList() {
+        if (!StpAPPUserUtil.isLogin()) {
+            return AjaxJson.getError("未登录");
+        }
+        SoMap so = SoMap.getRequestSoMap();
+        List<TbGroup> list = tbGroupService.getList(so.startPage());
+        return AjaxJson.getPageData(so.getDataCount(), list);
+    }
+
+
+
+}

+ 41 - 26
sp-service/level-one-server/src/main/java/com/pj/tb_group/TbGroupService.java

@@ -379,19 +379,32 @@ public class TbGroupService extends ServiceImpl<TbGroupMapper, TbGroup> implemen
         List<DclBorderList> dclBorderList = JSONUtil.toList(groupDto.getDclBorderList(), DclBorderList.class);
 
         TbTradeArea tbTradeArea = tbTradeAreaService.updateHandler(groupDto.getFieldCode(), "", "");
-        //根据编号进行事务处理
-        TbGroup tbGroup = this.findByAreaCodeAndSeqCode(tbTradeArea.getId(), groupDto.getPlatSeqNo());
-        if (tbGroup == null) {
-            tbGroup = new TbGroup();
-            BeanUtils.copyProperties(groupDto, tbGroup);
-            //新增
-            tbGroup.setDeleteStatus(DeleteStatus.DELETE_STATUS_ON.getCode());
-            tbGroup.setCreateTime(new Date())
-                    .setTradeAreaId(tbTradeArea.getId())
-                    .setTradeAreaName(tbTradeArea.getName());
-            this.save(tbGroup);
+        //根据登记号进行事务处理
+        TbGroup tbGroup = this.findByAreaCodeAndSeqCode(tbTradeArea.getId(), groupDto.getShopsSccd());
+        if(tbGroup != null) {
+            //清空原互助组边民的组信息
+            LambdaQueryWrapper<TbPeople> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(TbPeople::getGroupId, tbGroup.getId());
+            List<TbPeople> peopleList = tbPeopleMapper.selectList(wrapper);
+
+            for (TbPeople people:peopleList) {
+                people.setGroupName(null).setGroupId(null).setUpdateTime(new Date());
+            }
+            tbPeopleService.updateBatchById(peopleList);
+            //删除原互助组
+            removeById(tbGroup.getId());
         }
 
+        //新增
+        tbGroup = new TbGroup();
+        BeanUtils.copyProperties(groupDto, tbGroup);
+        tbGroup.setDeleteStatus(DeleteStatus.DELETE_STATUS_ON.getCode());
+        tbGroup.setCreateTime(new Date())
+                .setTradeAreaId(tbTradeArea.getId())
+                .setTradeAreaName(tbTradeArea.getName());
+        this.save(tbGroup);
+
+
         for (BorderDTO borderDTO : borderDTOList) {
             TbPeople tbPeople = tbPeopleService.findByIdCarNo(borderDTO.getIdCardNo());
             if (tbPeople == null) {
@@ -404,32 +417,34 @@ public class TbGroupService extends ServiceImpl<TbGroupMapper, TbGroup> implemen
             } else {
                 tbPeople.setRole(1);//普通边民
             }
-
-            tbPeople.setGroupName(tbGroup.getOrgName()).setGroupId(tbGroup.getId()).setTradeAreaId(tbTradeArea.getId())
-                    .setTradeAreaName(tbTradeArea.getName()).setUpdateTime(new Date());
+            tbPeople.setGroupName(tbGroup.getOrgName()).setGroupId(tbGroup.getId())
+                    .setTradeAreaId(tbTradeArea.getId()).setTradeAreaName(tbTradeArea.getName()).setUpdateTime(new Date());
             tbPeopleService.saveOrUpdate(tbPeople);
+
             if (dclBorderList1.size() > 0) {
-                tbGroup.setLeaderId(tbPeople.getId());
+                AppUserDto appUser = adminInterface.getByFkId(tbPeople.getId());
+                if (appUser != null) {
+                    appUser.setUserType(2);
+                    adminInterface.saveAppUserInfo(appUser);
+                }
             }
+        }
 
-            AppUserDto appUser = adminInterface.getByFkId(tbPeople.getId());
-            if(appUser != null) {
-                appUser.setUserType("2");
-                adminInterface.saveAppUserInfo(appUser);
+        for (DclBorderList dclBorder : dclBorderList) {
+            TbPeople p = tbPeopleService.findByIdCarNo(dclBorder.getIdCardNo());
+            if(p != null) {
+                tbGroup.setLeaderId(p.getId()).setLeaderName(p.getName()).setLeaderPhone(p.getPhone());
+                break;
             }
         }
-        //修改
-        BeanUtils.copyProperties(groupDto, tbGroup);
-        tbGroup.setLeaderName(dclBorderList.get(0).getDeclareName())
-                .setLeaderPhone(dclBorderList.get(0).getDeclareTel());
-        tbGroup.setUpdateTime(new Date());
         super.saveOrUpdate(tbGroup);
+
         return true;
     }
 
-    public TbGroup findByAreaCodeAndSeqCode(Long tradeId, String platSeqNo) {
+    public TbGroup findByAreaCodeAndSeqCode(Long tradeId, String shopsSccd) {
         QueryWrapper<TbGroup> ew = new QueryWrapper<>();
-        ew.lambda().eq(TbGroup::getPlatSeqNo, platSeqNo).eq(TbGroup::getTradeAreaId, tradeId);
+        ew.lambda().eq(TbGroup::getShopsSccd, shopsSccd).eq(TbGroup::getTradeAreaId, tradeId).orderByDesc(TbGroup::getCreateTime);
         List<TbGroup> list = list(ew);
         return list.isEmpty() ? null : list.get(0);
     }

+ 7 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_import_goods/TbImportGoodsMapper.java

@@ -2,6 +2,8 @@ package com.pj.tb_import_goods;
 
 import java.util.List;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import org.apache.ibatis.annotations.Mapper;
 
 import com.pj.utils.so.*;
@@ -27,4 +29,9 @@ public interface TbImportGoodsMapper extends BaseMapper <TbImportGoods> {
 	List<TbImportGoods> getList(SoMap so);
 
 
+   default TbImportGoods findBySeqPlatNo(String platSeqNo){
+	   LambdaQueryWrapper<TbImportGoods>ew=new LambdaQueryWrapper<TbImportGoods>();
+	   ew.eq(TbImportGoods::getPlatSeqNo,platSeqNo);
+	    return selectOne(ew);
+   }
 }

+ 1 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_import_order/TbImportOrder.java

@@ -106,4 +106,5 @@ public class TbImportOrder extends Model<TbImportOrder> implements Serializable
 	private String judgeContent;
 	private Date judgeTime;
 
+	private Date createTime;
 }

+ 1 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_import_order/TbImportOrderMapper.java

@@ -27,4 +27,5 @@ public interface TbImportOrderMapper extends BaseMapper <TbImportOrder> {
 	List<TbImportOrder> getList(SoMap so);
 
 
+    TbImportOrder findByManifestId(String manifestId);
 }

+ 4 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_import_order/TbImportOrderMapper.xml

@@ -41,7 +41,10 @@
 			<if test=' this.has("updateName") '> and update_name = #{updateName} </if>
 			<if test=' this.has("deleteStatus") '> and delete_status = #{deleteStatus} </if>
 		</where>
-
+		order by create_time desc,id desc
+	</select>
+    <select id="findByManifestId" resultType="com.pj.tb_import_order.TbImportOrder">
+		select * from tb_import_order where manifest_id=#{manifestId}
 	</select>
 
 </mapper>

+ 125 - 99
sp-service/level-one-server/src/main/java/com/pj/tb_import_order/TbImportOrderService.java

@@ -28,107 +28,133 @@ import org.springframework.transaction.annotation.Transactional;
 
 /**
  * Service: tb_import_order -- 进口申报单
+ *
  * @author lbl
  */
 @Service
 @Transactional(rollbackFor = Exception.class)
-public class TbImportOrderService extends ServiceImpl<TbImportOrderMapper, TbImportOrder> implements IService<TbImportOrder>{
-
-	/** 底层 Mapper 对象 */
-	@Autowired
-	TbImportOrderMapper tbImportOrderMapper;
-	@Autowired
-	TbOrderService tbOrderService;
-	@Autowired
-	TbImportGoodsMapper importGoodsMapper;
-	@Autowired
-	private TbPeopleMapper tbPeopleMapper;
-
-	/** 增 */
-	void add(TbImportOrder t){
-		save(t);
-	}
-
-	/** 删 */
-	void delete(Long id){
-		removeById(id);
-	}
-
-	/** 改 */
-	void update(TbImportOrder t){
-		updateById(t);
-
-	}
-
-	/** 查 */
-	TbImportOrder getById(Long id){
-		return super.getById(id);
-	}
-
-	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */
-	List<TbImportOrder> getList(SoMap so) {
-		return tbImportOrderMapper.getList(so);
-	}
-
-	/**
-	 *  查看订单详情
-	 * @param orderId  一级市场订单ID
-	 * @return 订单的vo
-	 */
-	public ImportOrderVo importOrderDetail(Long orderId){
-		TbOrder peopleOrder = tbOrderService.getById(orderId);
-		APPLoginUserInfo appLoginInfo = StpAPPUserUtil.getAPPLoginInfo();
-		if(!appLoginInfo.getFk().equals(peopleOrder.getBuyUserId())) throw new ServiceException("当前边民订单信息异常,请联系管理员!");
-
-		//根据边民订单获取关联的进口申报单Id,查询进口申报单详情
-		TbImportOrder importOrder = tbImportOrderMapper.selectById(peopleOrder.getImportOrderId());
-		if(importOrder == null) throw new ServiceException("进口申报单信息异常,请联系管理员!");
-
-		ImportOrderVo importOrderVo = new ImportOrderVo();
-		BeanUtils.copyProperties(importOrder,importOrderVo);
-
-		importOrderVo.setGoodsNames(peopleOrder.getGoodsNames());
-		importOrderVo.setGLimit(peopleOrder.getGLimit());
-		return importOrderVo;
-	}
-
-	public boolean audit(Long id, Integer judgeStatus, String judgeContent) {
-		TbImportOrder importOrder = tbImportOrderMapper.selectById(id);
-		if(importOrder == null) throw new ServiceException("进口申报单信息异常,请联系管理员!");
-		String name = StpUserUtil.getLoginName();
-		importOrder.setJudgeStatus(judgeStatus).setJudgeContent(judgeContent).setJudgeTime(new Date()).setJudgeBy(name);
-		return updateById(importOrder);
-	}
-
-	/** 远程调用 进口申报单同步 */
-	public boolean importOrderDto(HtImportOrderDto importOrderDto) {
-
-		TbImportOrder importOrder = new TbImportOrder();
-		BeanUtils.copyProperties(importOrderDto, importOrder);
-		boolean save = save(importOrder);
-		long importOrderId = SP.publicMapper.getPrimarykey();
-		if(save) {
-			//委托边民额度
-			List<HtIeportDeclBillsBpLimitDto> ieportDeclBillsBpLimitDtoList = JSON.parseArray(importOrderDto.getBorderPeopleLimitList(), HtIeportDeclBillsBpLimitDto.class);
-			ieportDeclBillsBpLimitDtoList.forEach(ieportDeclBillsBpLimitDto -> {
-				LambdaUpdateWrapper<TbOrder> wrapper = new LambdaUpdateWrapper<>();
-				wrapper.set(TbOrder::getLimitNo, ieportDeclBillsBpLimitDto.getLimitNo());
-				wrapper.set(TbOrder::getGLimit, ieportDeclBillsBpLimitDto.getgLimit());
-				wrapper.set(TbOrder::getGNo, ieportDeclBillsBpLimitDto.getgNo());
-				wrapper.set(TbOrder::getImportOrderId, importOrderId);
-				wrapper.eq(TbOrder::getPreIeportNo, ieportDeclBillsBpLimitDto.getPlatSeqNo());
-				boolean update = tbOrderService.update(wrapper);
-			});
-
-			//申报单商品信息
-			List<HtIeportDeclBillsGoodsDto> ieportDeclBillsGoodsDtoList = JSON.parseArray(importOrderDto.getGoodsList(), HtIeportDeclBillsGoodsDto.class);
-			ieportDeclBillsGoodsDtoList.forEach(ieportDeclBillsGoodsDto -> {
-				TbImportGoods importGoods = new TbImportGoods();
-				BeanUtils.copyProperties(ieportDeclBillsGoodsDto, importGoods);
-				importGoods.setImportOrderId(importOrderId);
-				int insert = importGoodsMapper.insert(importGoods);
-			});
-		}
-		return save;
-	}
+public class TbImportOrderService extends ServiceImpl<TbImportOrderMapper, TbImportOrder> implements IService<TbImportOrder> {
+
+    /**
+     * 底层 Mapper 对象
+     */
+    @Autowired
+    TbImportOrderMapper tbImportOrderMapper;
+    @Autowired
+    TbOrderService tbOrderService;
+    @Autowired
+    TbImportGoodsMapper importGoodsMapper;
+
+
+    /**
+     * 增
+     */
+    void add(TbImportOrder t) {
+        save(t);
+    }
+
+    /**
+     * 删
+     */
+    void delete(Long id) {
+        removeById(id);
+    }
+
+    /**
+     * 改
+     */
+    void update(TbImportOrder t) {
+        updateById(t);
+
+    }
+
+    /**
+     * 查
+     */
+    TbImportOrder getById(Long id) {
+        return super.getById(id);
+    }
+
+    /**
+     * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+     */
+    List<TbImportOrder> getList(SoMap so) {
+        return tbImportOrderMapper.getList(so);
+    }
+
+    /**
+     * 查看订单详情
+     *
+     * @param orderId 一级市场订单ID
+     * @return 订单的vo
+     */
+    public ImportOrderVo importOrderDetail(Long orderId) {
+        TbOrder peopleOrder = tbOrderService.getById(orderId);
+        APPLoginUserInfo appLoginInfo = StpAPPUserUtil.getAPPLoginInfo();
+        if (!appLoginInfo.getFk().equals(peopleOrder.getBuyUserId()))
+            throw new ServiceException("当前边民订单信息异常,请联系管理员!");
+
+        //根据边民订单获取关联的进口申报单Id,查询进口申报单详情
+        TbImportOrder importOrder = tbImportOrderMapper.selectById(peopleOrder.getImportOrderId());
+        if (importOrder == null) throw new ServiceException("进口申报单信息异常,请联系管理员!");
+
+        ImportOrderVo importOrderVo = new ImportOrderVo();
+        BeanUtils.copyProperties(importOrder, importOrderVo);
+
+        importOrderVo.setGoodsNames(peopleOrder.getGoodsNames());
+        importOrderVo.setGLimit(peopleOrder.getGLimit());
+        return importOrderVo;
+    }
+
+    public boolean audit(Long id, Integer judgeStatus, String judgeContent) {
+        TbImportOrder importOrder = tbImportOrderMapper.selectById(id);
+        if (importOrder == null) throw new ServiceException("进口申报单信息异常,请联系管理员!");
+        String name = StpUserUtil.getLoginName();
+        importOrder.setJudgeStatus(judgeStatus).setJudgeContent(judgeContent).setJudgeTime(new Date()).setJudgeBy(name);
+        return updateById(importOrder);
+    }
+
+    /**
+     * 远程调用 进口申报单同步
+     */
+    public boolean importOrderDto(HtImportOrderDto importOrderDto) {
+        TbImportOrder importOrder = tbImportOrderMapper.findByManifestId(importOrderDto.getManifestId());
+        if (importOrder == null) {
+            importOrder = new TbImportOrder();
+            importOrder.setCreateTime(new Date());
+        }
+        BeanUtils.copyProperties(importOrderDto, importOrder, "id");
+        boolean save = saveOrUpdate(importOrder);
+        long importOrderId = importOrder.getId();
+        if (save) {
+            //委托边民额度
+            List<HtIeportDeclBillsBpLimitDto> ieportDeclBillsBpLimitDtoList = JSON.parseArray(importOrderDto.getBorderPeopleLimitList(), HtIeportDeclBillsBpLimitDto.class);
+            ieportDeclBillsBpLimitDtoList.forEach(ieportDeclBillsBpLimitDto -> {
+                LambdaUpdateWrapper<TbOrder> wrapper = new LambdaUpdateWrapper<>();
+                wrapper.set(TbOrder::getLimitNo, ieportDeclBillsBpLimitDto.getLimitNo());
+                wrapper.set(TbOrder::getGLimit, ieportDeclBillsBpLimitDto.getgLimit());
+                wrapper.set(TbOrder::getGNo, ieportDeclBillsBpLimitDto.getgNo());
+                wrapper.set(TbOrder::getImportOrderId, importOrderId);
+                wrapper.eq(TbOrder::getPreIeportNo, ieportDeclBillsBpLimitDto.getPlatSeqNo());
+                boolean update = tbOrderService.update(wrapper);
+            });
+            //申报单商品信息
+            List<HtIeportDeclBillsGoodsDto> ieportDeclBillsGoodsDtoList = JSON.parseArray(importOrderDto.getGoodsList(), HtIeportDeclBillsGoodsDto.class);
+            ieportDeclBillsGoodsDtoList.forEach(ieportDeclBillsGoodsDto -> {
+                TbImportGoods importGoods = importGoodsMapper.findBySeqPlatNo(ieportDeclBillsGoodsDto.getPlatSeqNo());
+                if (importGoods == null) {
+                    importGoods = new TbImportGoods();
+                }
+                BeanUtils.copyProperties(ieportDeclBillsGoodsDto, importGoods, "id");
+                importGoods.setImportOrderId(importOrderId);
+                if (importGoods.getId() != null) {
+                    importGoodsMapper.updateById(importGoods);
+                } else {
+                    importGoodsMapper.insert(importGoods);
+                }
+
+            });
+        }
+        return save;
+    }
 }

+ 28 - 3
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrder.java

@@ -42,7 +42,8 @@ public class TbOrder extends Model<TbOrder> implements Serializable {
     public static final String PERMISSION_CODE_DEL = "tb-order-del";
     public static final String PERMISSION_CODE_EDIT_PRICE = "tb-order-edit-price";
 	public static final String PERMISSION_CODE_DEDUCTION = "tb-order-deduction";
-
+	public static final String PERMISSION_CODE_SEND009 = "tb-order-send009";
+	public static final String PERMISSION_CODE_SENDCXB001 = "tb-order-sendCXB001";
 
     // ---------- 表中字段 ----------
     /**
@@ -119,12 +120,12 @@ public class TbOrder extends Model<TbOrder> implements Serializable {
 	private String buyUserType;
 
 	/**
-	 * 交易状态(0=未支付,1=已支付)
+	 * 打款状态(0=初始值,1=打款成功,2=打款失败)
 	 */
 	private Integer tradeStatus;
 
 	/**
-	 * 交易时间
+	 * 打款回执时间
 	 */
 	private Date tradeTime;
 
@@ -518,6 +519,10 @@ public class TbOrder extends Model<TbOrder> implements Serializable {
 	 */
 	private Integer Sxb010Status;
 	/**
+	 * 回执内容
+	 */
+	private String sxbNote;
+	/**
 	 * (一级市场)订单扣款回执时间
 	 */
 	private Date Sxb010StatusTime;
@@ -539,6 +544,26 @@ public class TbOrder extends Model<TbOrder> implements Serializable {
     private BigDecimal upPrice;
 
 	/**
+	 * 退运状态0正常 1 退运
+	 */
+	private Integer returns;
+	/**
+	 * 退运时间
+	 */
+	private Date returnsTime;
+	/**
+	 * 退单 0正常 1 退单
+	 */
+	private Integer chargebacks;
+	/**
+	 * 退单时间
+	 */
+	private Date chargebacksTime;
+
+	@TableField(exist = false)
+	private String phone;
+
+	/**
 	 * 是否扣除服务点费(0=未扣除,1=已扣除)
 	 */
 	private Integer isCheckoffWallet;

+ 21 - 3
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderAppController.java

@@ -56,6 +56,18 @@ public class TbOrderAppController {
 		return AjaxJson.getPageData(so.getDataCount(), list);
 	}
 
+	/**
+	 * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+	 * @return
+	 */
+	@RequestMapping("getListBySaleMainId")
+	public AjaxJson getListBySaleMainId() {
+		SoMap so = SoMap.getRequestSoMap();
+		List<TbOrder> list = tbOrderService.getList(so.startPage());
+		if(list.size() == 0)return AjaxJson.getSuccess("暂无更多的订单消息!");
+		return AjaxJson.getPageData(so.getDataCount(), list);
+	}
+
 	/** 查 转售列表:边民查看已完结订单,包括已转售/未转售 */
 	@RequestMapping("getResaleOrders")
 	public AjaxJson getResaleOrders() {
@@ -186,7 +198,13 @@ public class TbOrderAppController {
 	}
 
 
-
+	@RequestMapping("getPeopleOrderList")
+	public AjaxJson getPeopleOrderList() {
+		SoMap so = SoMap.getRequestSoMap();
+		List<OrderVo> list = tbOrderService.getPeopleOrderList(so.startPage());
+		if(list.size() == 0)return AjaxJson.getSuccess("暂无更多的订单消息!");
+		return AjaxJson.getPageData(so.getDataCount(), list);
+	}
 
 
 	@PostMapping("orderRefund")
@@ -198,8 +216,8 @@ public class TbOrderAppController {
 
 	/** 边民订单确认-收到银行扣款回执 */
 	@PostMapping("rpc/confirmOrderFromBank")
-	public boolean confirmOrderFromBank(@RequestParam("tradeNo")String tradeNo, @RequestParam("SXB010Status")Integer SXB010Status) {
-		boolean result = tbOrderService.confirmOrderFromBank(tradeNo, SXB010Status);
+	public boolean confirmOrderFromBank(@RequestParam("tradeNo")String tradeNo,@RequestParam("note")String note, @RequestParam("SXB010Status")Integer SXB010Status) {
+		boolean result = tbOrderService.confirmOrderFromBank(tradeNo,note, SXB010Status);
 		return result;
 	}
 

+ 210 - 109
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderController.java

@@ -2,7 +2,9 @@ package com.pj.tb_order;
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
+import java.util.Date;
 import java.util.List;
+import java.util.Map;
 
 import cn.hutool.core.convert.Convert;
 import com.pj.api.dto.HtDeclareChargebackDto;
@@ -20,120 +22,219 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
 
 /**
  * Controller: tb_order -- 订单表
+ *
  * @author loovi
  */
 @RestController
 @RequestMapping("/TbOrder/")
 public class TbOrderController {
 
-	/** 底层 Service 对象 */
-	@Autowired
-	TbOrderService tbOrderService;
-
-
-	/** 删 */
-	@RequestMapping("delete")
-	@SaCheckPermission(TbOrder.PERMISSION_CODE_DEL)
-	public AjaxJson delete(Long id){
-		 tbOrderService.delete(id);
-		return AjaxJson.getSuccess();
-	}
-
-	/** 删 - 根据id列表 */
-	@RequestMapping("deleteByIds")
-	@SaCheckPermission(TbOrder.PERMISSION_CODE_DEL)
-	public AjaxJson deleteByIds(){
-		List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
-		int line = SP.publicMapper.deleteByIds(TbOrder.TABLE_NAME, ids);
-		return AjaxJson.getByLine(line);
-	}
-
-	/** 改 */
-	@RequestMapping("update")
-	@SaCheckPermission(TbOrder.PERMISSION_CODE_EDIT)
-	public AjaxJson update(TbOrder t){
-		tbOrderService.update(t);
-		return AjaxJson.getSuccess();
-	}
-
-	/** 查 - 根据id */
-	@RequestMapping("getById")
-	@SaCheckPermission(TbOrder.PERMISSION_CODE)
-	public AjaxJson getById(Long id){
-		TbOrder t = tbOrderService.getById(id);
-		return AjaxJson.getSuccessData(t);
-	}
-
-	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */
-	@RequestMapping("getList")
-	@SaCheckPermission(TbOrder.PERMISSION_CODE)
-	public AjaxJson getList() {
-		SoMap so = SoMap.getRequestSoMap();
-		List<TbOrder> list = tbOrderService.getList(so.startPage());
-		return AjaxJson.getPageData(so.getDataCount(), list);
-	}
-
-
-	/** 改 - 删除状态(0=禁用,1=启用) */
-	@RequestMapping("updateDeleteStatus")
-	@SaCheckPermission(TbOrder.PERMISSION_CODE_EDIT)
-	public AjaxJson updateDeleteStatus(Long id, Integer value){
-		int line = SP.publicMapper.updateColumnById(TbOrder.TABLE_NAME, "delete_status", value, id);
-		return AjaxJson.getByLine(line);
-	}
-
-
-	/** 改 - 删除状态(0=禁用,1=启用) */
-	@RequestMapping("editUpPrice")
-	@SaCheckPermission(TbOrder.PERMISSION_CODE_EDIT_PRICE)
-	public AjaxJson editUpPrice(Long id, double price){
-		int line = SP.publicMapper.updateColumnById(TbOrder.TABLE_NAME, "up_price", price, id);
-		return AjaxJson.getByLine(line);
-	}
-
-	/** 批量修改总价 */
-	@RequestMapping("editUpPriceByIds")
-	@SaCheckPermission(TbOrder.PERMISSION_CODE_EDIT_PRICE)
-	public AjaxJson editUpPriceByIds(String ids, double price){
-		Long[] idArr = Convert.toLongArray(ids);
-
-		List<TbOrder> tbOrders = new ArrayList<>();
-		for (Long id: idArr) {
-			TbOrder order = new TbOrder();
-			order.setUpPrice(BigDecimal.valueOf(price));
-			order.setId(id);
-			tbOrders.add(order);
-		}
-		boolean batch = tbOrderService.updateBatchById(tbOrders);
-		return AjaxJson.toAjax(batch);
-	}
-
-	/** 订单补扣款 */
-	@RequestMapping("deduction")
-	@SaCheckPermission(TbOrder.PERMISSION_CODE_DEDUCTION)
-	public AjaxJson deduction(Long id){
-		tbOrderService.deduction(id);
-		return AjaxJson.getSuccess();
-	}
-
-
-	/*-----           正常业务逻辑👆👆    rpc远程调用👇👇 -----*/
-
-
-	/** 系统接收到航通接口信息:进出口申报单退单 **/
-	@RequestMapping("rpc/chargeback")
-	public boolean chargeback(HtDeclareChargebackDto htDeclareChargebackDto) {
-		return tbOrderService.chargeback(htDeclareChargebackDto);
-	}
-	@RequestMapping("rpc/getOrderListByMainIds")
-	public List<OrderDto> getOrderListByMainIds(String mainIds) {
-		return tbOrderService.getOrderListByMainIds(mainIds);
-	}
-
-	/** 系统接收到航通接口信息:车辆已出一级市场 ,相对应的一级市场订单状态修改 **/
-	@RequestMapping("rpc/orderFinish")
-	public boolean orderFinish(HtPassCardDTO htPassCardDTO) {
-		return tbOrderService.orderFinish(htPassCardDTO);
-	}
+    /**
+     * 底层 Service 对象
+     */
+    @Autowired
+    TbOrderService tbOrderService;
+
+
+
+    /**
+     * 改
+     */
+    @RequestMapping("update")
+    @SaCheckPermission(TbOrder.PERMISSION_CODE_EDIT)
+    public AjaxJson update(TbOrder t) {
+        tbOrderService.update(t);
+        return AjaxJson.getSuccess();
+    }
+
+    /**
+     * 查 - 根据id
+     */
+    @RequestMapping("getById")
+    @SaCheckPermission(TbOrder.PERMISSION_CODE)
+    public AjaxJson getById(Long id) {
+        TbOrder t = tbOrderService.getById(id);
+        return AjaxJson.getSuccessData(t);
+    }
+
+    /**
+     * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+     */
+    @RequestMapping("getList")
+    @SaCheckPermission(TbOrder.PERMISSION_CODE)
+    public AjaxJson getList() {
+        SoMap so = SoMap.getRequestSoMap();
+        List<TbOrder> list = tbOrderService.getList(so.startPage());
+        return AjaxJson.getPageData(so.getDataCount(), list);
+    }
+
+
+    /**
+     * 改 - 删除状态(0=禁用,1=启用)
+     */
+    @RequestMapping("updateDeleteStatus")
+    @SaCheckPermission(TbOrder.PERMISSION_CODE_EDIT)
+    public AjaxJson updateDeleteStatus(Long id, Integer value) {
+        int line = SP.publicMapper.updateColumnById(TbOrder.TABLE_NAME, "delete_status", value, id);
+        return AjaxJson.getByLine(line);
+    }
+
+
+    /**
+     * 改 - 删除状态(0=禁用,1=启用)
+     */
+    @RequestMapping("editUpPrice")
+    @SaCheckPermission(TbOrder.PERMISSION_CODE_EDIT_PRICE)
+    public AjaxJson editUpPrice(Long id, double price) {
+        int line = SP.publicMapper.updateColumnById(TbOrder.TABLE_NAME, "up_price", price, id);
+        return AjaxJson.getByLine(line);
+    }
+
+    /**
+     * 批量修改总价
+     */
+    @RequestMapping("editUpPriceByIds")
+    @SaCheckPermission(TbOrder.PERMISSION_CODE_EDIT_PRICE)
+    public AjaxJson editUpPriceByIds(String ids, double price) {
+        Long[] idArr = Convert.toLongArray(ids);
+
+        List<TbOrder> tbOrders = new ArrayList<>();
+        for (Long id : idArr) {
+            TbOrder order = new TbOrder();
+            order.setUpPrice(BigDecimal.valueOf(price));
+            order.setId(id);
+            tbOrders.add(order);
+        }
+        boolean batch = tbOrderService.updateBatchById(tbOrders);
+        return AjaxJson.toAjax(batch);
+    }
+
+    /**
+     * 订单补扣款
+     */
+    @RequestMapping("deduction")
+    @SaCheckPermission(TbOrder.PERMISSION_CODE_DEDUCTION)
+    public AjaxJson deduction(Long id) {
+        tbOrderService.deduction(id);
+        return AjaxJson.getSuccess();
+    }
+
+    /**
+     * 撤销转售
+     */
+    @RequestMapping("cancelSale")
+    @SaCheckPermission(TbOrder.PERMISSION_CODE)
+    public AjaxJson cancelSale(Long id) {
+        tbOrderService.cancelSale(id);
+        return AjaxJson.getSuccess();
+    }
+    /**
+     * 撤销转售
+     */
+    @RequestMapping("cancelSaleBatch")
+    @SaCheckPermission(TbOrder.PERMISSION_CODE)
+    public AjaxJson cancelSaleBatch() {
+        List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
+        tbOrderService.cancelSaleBatch(ids);
+        return AjaxJson.getSuccess();
+    }
+
+    /**
+     * 订单补扣款——按车,并且未扣款
+     */
+    @RequestMapping("deductionByVeNo")
+    @SaCheckPermission(TbOrder.PERMISSION_CODE_DEDUCTION)
+    public AjaxJson deductionByVeNo(String veNo, Long id) {
+        tbOrderService.deductionByVeNo(veNo, id);
+        return AjaxJson.getSuccess();
+    }
+
+    @RequestMapping("getDeductionByVeNoList")
+    @SaCheckPermission(TbOrder.PERMISSION_CODE)
+    public AjaxJson getDeductionByVeNoList() {
+        SoMap so = SoMap.getRequestSoMap();
+        List<TbOrder> list = tbOrderService.getDeductionByVeNoList(so.startPage());
+        return AjaxJson.getPageData(so.getDataCount(), list);
+    }
+
+    /**
+     * 订单补扣款
+     */
+    @RequestMapping("staticsStatus")
+    public AjaxJson staticsStatus(Long saleMainId) {
+        Map<String, Object> result = tbOrderService.staticsStatus(saleMainId);
+        return AjaxJson.getSuccessData(result);
+    }
+
+    /**
+     * 订单补发送009信息到航通
+     */
+    @RequestMapping("send009ToHt")
+    @SaCheckPermission(TbOrder.PERMISSION_CODE_SEND009)
+    public AjaxJson send009ToHt(Long id) {
+        TbOrder order = tbOrderService.getById(id);
+        if (order == null) {
+            throw new AjaxError("订单不存在");
+        }
+        order.setPeopleConfirmStatus(1)
+				.setPeopleConfirmTime(new Date())
+				.setCooperEntrustStatus(1)
+                .setApplyConfirmStatus(1);
+        tbOrderService.updateById(order);
+        tbOrderService.sendConfirmMsgToHt(order);
+        return AjaxJson.getSuccess();
+    }
+
+    /**
+     * 订单补推结关信息给银行
+     */
+    @RequestMapping("sendCXB001")
+    @SaCheckPermission(TbOrder.PERMISSION_CODE_SENDCXB001)
+    public AjaxJson sendCXB001(Long id) {
+        tbOrderService.sendCXB001(id);
+        return AjaxJson.getSuccess();
+    }
+
+    /**
+     * 订单补推结关信息给银行——按车,并且未完成
+     */
+    @RequestMapping("sendCXB001ByVeNo")
+    @SaCheckPermission(TbOrder.PERMISSION_CODE_SENDCXB001)
+    public AjaxJson sendCXB001ByVeNo(String veNo, Long id) {
+        tbOrderService.sendCXB001ByVeNo(veNo, id);
+        return AjaxJson.getSuccess();
+    }
+
+    @RequestMapping("getSendCXB001ByVeNoList")
+    @SaCheckPermission(TbOrder.PERMISSION_CODE)
+    public AjaxJson getSendCXB001ByVeNoList() {
+        SoMap so = SoMap.getRequestSoMap();
+        List<TbOrder> list = tbOrderService.getSendCXB001ByVeNoList(so.startPage());
+        return AjaxJson.getPageData(so.getDataCount(), list);
+    }
+
+    /*-----           正常业务逻辑👆👆    rpc远程调用👇👇 -----*/
+
+
+    /**
+     * 系统接收到航通接口信息:进出口申报单退单
+     **/
+    @RequestMapping("rpc/chargeback")
+    public boolean chargeback(@RequestBody HtDeclareChargebackDto htDeclareChargebackDto) {
+        return tbOrderService.chargeback(htDeclareChargebackDto);
+    }
+
+    @RequestMapping("rpc/getOrderListByMainIds")
+    public List<OrderDto> getOrderListByMainIds(String mainIds) {
+        return tbOrderService.getOrderListByMainIds(mainIds);
+    }
+
+    /**
+     * 系统接收到航通接口信息:车辆已出一级市场 ,相对应的一级市场订单状态修改
+     **/
+    @RequestMapping("rpc/orderFinish")
+    public boolean orderFinish(@RequestBody HtPassCardDTO htPassCardDTO) {
+        return tbOrderService.orderFinish(htPassCardDTO);
+    }
 
 }

+ 2 - 0
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderMapper.java

@@ -31,4 +31,6 @@ public interface TbOrderMapper extends BaseMapper <TbOrder> {
 	ConfirmVo getConfirmStatus(Long orderId);
 
 	List<TbOrder> getOnSaleList(SoMap so);
+
+    double sumUpPrice(Long htTradeSettlementId);
 }

+ 11 - 3
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderMapper.xml

@@ -18,7 +18,7 @@
 
 	<!-- 公共查询sql片段 -->
 	<sql id="select_sql">
-		select *
+		select *,(select phone from tb_people where id=tb_order.buy_user_id) as phone
 		from tb_order
 	</sql>
 
@@ -71,7 +71,7 @@
 			<if test=' this.has("callCarStatus") '> and call_car_status = #{callCarStatus} </if>
 			<if test=' this.has("createBy") '> and create_by = #{createBy} </if>
 			<if test=' this.has("createName") '> and create_name = #{createName} </if>
-			<if test=' this.has("createTime") '> and create_time = #{createTime} </if>
+			<if test=' this.has("createTime") '> and  date_format(create_time,'%Y-%m-%d')= #{createTime} </if>
 			<if test=' this.has("updateBy") '> and update_by = #{updateBy} </if>
 			<if test=' this.has("updateName") '> and update_name = #{updateName} </if>
 			<if test=' this.has("updateTime") '> and update_time = #{updateTime} </if>
@@ -115,6 +115,10 @@
 			<if test=' this.has("importOrderId") '> and import_order_id = #{importOrderId} </if>
 			<if test=' this.has("declareType") '> and declare_type = #{declareType} </if>
 			<if test=' this.has("upStatus") '> and up_status = #{upStatus} </if>
+			<if test=' this.has("Sxb010Status") '> and sxb010_status = #{Sxb010Status} </if>
+			<if test=' this.has("returns") '> and returns = #{returns} </if>
+			<if test=' this.has("chargebacks") '> and chargebacks = #{chargebacks} </if>
+
 			<if test=' this.has("isCheckoffWallet") '> and is_checkoff_wallet = #{isCheckoffWallet} </if>
 			<if test='confirmType == "people_confirm_time" and this.has("dateBegin")'> and people_confirm_time &gt;= #{dateBegin} </if>
 			<if test='confirmType == "people_confirm_time" and this.has("dateEnd")'> and people_confirm_time &lt;= #{dateEnd} </if>
@@ -178,7 +182,7 @@
 			<when test='sortType == 48'> update_by desc </when>
 			<when test='sortType == 49'> update_name desc </when>
 			<when test='sortType == 50'> delete_status desc </when>
-			<otherwise> id desc </otherwise>
+			<otherwise> create_time desc ,id desc </otherwise>
 		</choose>
 	</select>
 
@@ -196,9 +200,13 @@
 		<if test=' this.has("productName") '>and goods_names like concat('%',#{productName},'%')</if>
 		<if test=' this.has("dateBegin") '>and date_format(create_time,'%Y-%m-%d') &gt;=#{dateBegin}</if>
 		<if test=' this.has("dateEnd") '>and date_format(create_time,'%Y-%m-%d') &lt;=#{dateEnd}</if>
+		<if test=' this.has("id") '> and sale_main_id = #{id} </if>
 		order by up_time desc
 
 	</select>
+    <select id="sumUpPrice" resultType="java.lang.Double">
+		select sum(up_price) from tb_order where sale_main_id=#{htTradeSettlementId}
+	</select>
 
 
 </mapper>

+ 353 - 94
sp-service/level-one-server/src/main/java/com/pj/tb_order/TbOrderService.java

@@ -4,11 +4,13 @@ import java.math.BigDecimal;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
 import cn.hutool.log.StaticLog;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.injector.methods.SelectBatchByIds;
 import com.pj.api.client.admin.AdminInterface;
 import com.pj.api.client.async_server.AsyncServerInterface;
 import com.pj.api.client.level_one_server.LevelOneServerInterface;
@@ -17,6 +19,7 @@ import com.pj.api.client.payment_server.PaymentServerInterface;
 import com.pj.api.consts.FeignFactory;
 import com.pj.api.dto.*;
 import com.pj.common.core.exception.ServiceException;
+import com.pj.common.core.text.Convert;
 import com.pj.common.core.utils.StringUtils;
 import com.pj.current.config.SystemObject;
 import com.pj.current.dto.APPLoginUserInfo;
@@ -75,7 +78,7 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
     @Autowired
     private TbOrderMapper tbOrderMapper;
     @Autowired
-    TbImportOrderMapper tbImportOrderMapper;
+    private TbImportOrderMapper tbImportOrderMapper;
     /**
      * 互市组
      */
@@ -153,6 +156,7 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
      *
      * @param orderId 一级市场订单ID
      */
+    @Deprecated
     public boolean cancelOrder(Long orderId) {
         //获取登录用户
         APPLoginUserInfo appLoginInfo = StpAPPUserUtil.getAPPLoginInfo();
@@ -208,6 +212,34 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
         return tbOrderList;
     }
 
+    List<OrderVo> getPeopleOrderList(SoMap so) {
+        //获取登录用户,登录的用户也许边民,互市组组长,一级市场商家
+        APPLoginUserInfo appLoginInfo = StpAPPUserUtil.getAPPLoginInfo();
+        if (appLoginInfo.getUserType() != 2) throw new RuntimeException("当前登陆用户不是边民组长!");
+
+        TbPeople tbPeople = tbPeopleMapper.selectById(appLoginInfo.getFk());
+        if (tbPeople.getGroupId() == null) throw new RuntimeException("当前登陆用户不在互助组内!");
+
+        List<TbPeople> peopleList = tbPeopleService.lambdaQuery().eq(TbPeople::getGroupId, tbPeople.getGroupId()).list();
+        List<Long> idList = peopleList.stream().map(people -> people.getId()).collect(Collectors.toList());
+
+        List<TbOrder> tbOrderList = tbOrderMapper.getList(so);
+
+        List<TbOrder> list = tbOrderList.stream().filter(order -> idList.contains(order.getBuyUserId())).collect(Collectors.toList());
+        List<OrderVo> orderVoList = new ArrayList<>();
+        for (TbOrder tbOrder : list) {
+            OrderVo orderVo = new OrderVo();
+            BeanUtils.copyProperties(tbOrder, orderVo);
+            for (TbPeople people : peopleList) {
+                if (people.getId().compareTo(tbOrder.getBuyUserId()) == 0 || people.getId().equals(tbOrder.getBuyUserId())) {
+                    orderVo.setPhone(people.getPhone());
+                }
+            }
+            orderVoList.add(orderVo);
+        }
+        return orderVoList;
+    }
+
     /**
      * 获取当前登陆人订单集合
      */
@@ -425,8 +457,10 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
         BeanUtils.copyProperties(htTradeSettlement, paymentDto);
 
         paymentDto.setTradeNo(tbOrder.getTradeNo());
+        paymentDto.setCodeTs(tbOrder.getCodeTs());
         paymentDto.setBuyQty(tbOrder.getBuyQty());
         paymentDto.setGrossWt(tbOrder.getGrossWt());
+        paymentDto.setNetWt(tbOrder.getNetWt());
         paymentDto.setGoodsName(tbOrder.getGoodsNames());
         paymentDto.setGoodsUnit(tbOrder.getGoodsUnit());
         paymentDto.setDeclPrice(tbOrder.getDeclPrice());
@@ -437,27 +471,36 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
 
         TbPeople tbPeople = tbPeopleService.getById(tbOrder.getBuyUserId());
         StaticLog.info("tbPeople:{}", JSONUtil.toJsonStr(tbPeople));
-        if (tbPeople != null) {
-            paymentDto.setBankCode(tbPeople.getBankCode());
-            paymentDto.setBankName(tbPeople.getBankName());
-            paymentDto.setBorderName(tbPeople.getName());
-            paymentDto.setBorderidno(tbPeople.getIdCard());
-            paymentDto.setBorderTel(tbPeople.getPhone());
+        if (tbPeople == null) {
+            throw new AjaxError("查询不到边民信息");
         }
+        if (StrUtil.isEmpty(tbPeople.getBankCode())) {
+            throw new AjaxError(tbPeople.getName() + "银行账号不完善");
+        }
+        paymentDto.setBankCode(tbPeople.getBankCode());
+        paymentDto.setBankName(tbPeople.getBankName());
+        paymentDto.setBankNo(tbPeople.getBankNo());
+        paymentDto.setBorderName(tbPeople.getName());
+        paymentDto.setBorderidno(tbPeople.getIdCard());
+        paymentDto.setBorderTel(tbPeople.getPhone());
+        paymentDto.setPapersType(tbPeople.getPapersType());
+        paymentDto.setBorderNationality(tbPeople.getNationality());
 
         TbShop tbShop = tbShopService.findByCode(htTradeSettlement.getShopNo());
-        StaticLog.info("tbShop:{}", JSONUtil.toJsonStr(tbShop));
-        if (tbShop != null) {
-            paymentDto.setOwnerName(tbShop.getOwnerName());
-            paymentDto.setOwnerIdtype(tbShop.getOwnerIdtype());
-            paymentDto.setBankAccount(tbShop.getBankAccount());
-            paymentDto.setBank(tbShop.getBank());
-            paymentDto.setOwnerTel(tbShop.getOwnerTel());
-            paymentDto.setShopSccd(tbShop.getShopSccd());
-            paymentDto.setNationality(tbShop.getNationality());
+        if (tbShop == null) {
+            throw new AjaxError("查询不到商铺信息");
         }
-
-
+        if (StrUtil.isEmpty(tbShop.getBankAccount())) {
+            throw new AjaxError(tbShop.getShopName() + "银行账号不完善");
+        }
+        StaticLog.info("tbShop:{}", JSONUtil.toJsonStr(tbShop));
+        paymentDto.setOwnerName(tbShop.getOwnerName());
+        paymentDto.setOwnerIdtype(tbShop.getOwnerIdtype());
+        paymentDto.setBankAccount(tbShop.getBankAccount());
+        paymentDto.setBank(tbShop.getBank());
+        paymentDto.setOwnerTel(tbShop.getOwnerTel());
+        paymentDto.setShopSccd(tbShop.getShopSccd());
+        paymentDto.setNationality(tbShop.getNationality());
         return paymentDto;
     }
 
@@ -488,9 +531,9 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
 
         boolean update = super.updateById(tbOrder);
         // TODO: 2023/8/28 边民发起支付申请,调用银行接口:验证边民支付信息,将货款先存入银行第三方账户,并给出回执
-        PaymentDto paymentDto = this.getPaymentData(tbOrder);
+        /*PaymentDto paymentDto = this.getPaymentData(tbOrder);
         StaticLog.info("\nsendSXB010——PaymentDto——:{}", JSONUtil.toJsonStr(paymentDto));
-        paymentServerInterface.sendSXB010(paymentDto);
+        paymentServerInterface.sendSXB010(paymentDto);*/
 
         return update;
     }
@@ -499,17 +542,19 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
      * 边民订单确认-收到银行扣款回执——SXB011——SXB012
      *
      * @param tradeNo      一级市场边民订单-订单编号
+     * @param note         回执内容
      * @param SXB010Status 回执状态-1=扣款成功 2=扣款失败
      */
-    public boolean confirmOrderFromBank(String tradeNo, Integer SXB010Status) {
+    public boolean confirmOrderFromBank(String tradeNo, String note, Integer SXB010Status) {
         LambdaQueryWrapper<TbOrder> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(TbOrder::getTradeNo, tradeNo);
         List<TbOrder> tbOrderList = this.list(wrapper);
         if (tbOrderList.size() <= 0) {
-            throw new RuntimeException("边民订单确认-收到银行扣款回执:订单不存在");
+            log.error("收到银行回执:{},{},{},订单不存在", tradeNo, note, SXB010Status);
+            return false;
         }
         TbOrder tbOrder = tbOrderList.get(0);
-
+        tbOrder.setSxbNote(note);
         // TODO: 2023/8/29 更新状态保存交易记录
         if (2 == SXB010Status) {//扣款失败
             tbOrder.setSxb010Status(2)
@@ -517,15 +562,17 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
         } else if (1 == SXB010Status) {//扣款成功
             tbOrder.setSxb010Status(1)
                     .setSxb010StatusTime(new Date());
-
-            /*tbOrder.setPeopleConfirmTime(new Date())
-                    .setPeopleConfirmStatus(ConfirmStatus.CONFIRM_STATUS_ONE.getCode())
-                    .setUpdateTime(new Date());*/
-            if ("1".equals(tbOrder.getDeclareType())) {
-                // TODO: 2023/8/29 调用航通009接口,发送信息
-                sendConfirmMsgToHt(tbOrder);
-                //当declareType为边民时,不需要走后续两个确认,订单状态改为已完成
-                //tbOrder.setFinishStatus(FinishStatus.FINISH_STATUS_ONE.getCode());
+            //如果已经过了卡三,则补发送一次通关报文给银行
+            if(tbOrder.getFinishStatus()==1){
+                HtTradeSettlement htTradeSettlement=htTradeSettlementService.getById(tbOrder.getSaleMainId());
+                //TODO: 2023/8/30 补发通关报文
+                PaymentDto paymentDto2 = new PaymentDto();
+                paymentDto2.setTradeNos(tradeNo);
+                paymentDto2.setVoyageNo(htTradeSettlement.getVoyageNo());
+                paymentDto2.setVeNo(tbOrder.getVeNo());
+                StaticLog.info("\n扣款成功,补发通关批文 sendSXB023——PaymentDto——:{}", JSONUtil.toJsonStr(paymentDto2));
+                paymentServerInterface.sendSXB023(paymentDto2);
+                //todo 补发结关信息
             }
         }
 
@@ -578,13 +625,12 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
 
         //测试用,跳过银行接口
         // wrapper.set(TbOrder::getFinishStatus, FinishStatus.FINISH_STATUS_ONE.getCode());//已完成->完成后可以进行转售
-        wrapper.set(TbOrder::getFinishTime, new Date());
+//        wrapper.set(TbOrder::getFinishTime, new Date());
 
         wrapper.eq(TbOrder::getId, orderId);
         boolean result = update(wrapper);
 
-        if (result && !"1".equals(tbOrder.getDeclareType())
-                && tbOrder.getPeopleConfirmStatus() == 1 && tbOrder.getCooperEntrustStatus() == 1) {
+        if (result && tbOrder.getPeopleConfirmStatus() == 1) {
             // TODO: 2023/8/29 调用航通009接口,发送信息
             sendConfirmMsgToHt(tbOrder);
         }
@@ -594,14 +640,19 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
     /**
      * 发送009信息到航通
      */
-    private void sendConfirmMsgToHt(TbOrder tbOrder) {
+    public void sendConfirmMsgToHt(TbOrder tbOrder) {
         TbPeople tbPeople = tbPeopleService.getById(tbOrder.getBuyUserId());
+        if (tbPeople == null) {
+            StaticLog.info("\n--------------发送009信息到航通————边民不存在!!!");
+            throw new AjaxError("--------------发送009信息到航通,边民不存在");
+        }
         PeopleConfirmDTO peopleConfirmDTO = new PeopleConfirmDTO();
         peopleConfirmDTO.setBorderName(tbOrder.getBuyUserName());
         peopleConfirmDTO.setIdno(tbPeople.getIdCard());
         peopleConfirmDTO.setSettleBillNo(tbOrder.getSettleBillNo());
         peopleConfirmDTO.setPreIeportNo(tbOrder.getPreIeportNo());
-        log.info("sendConfirmMsgToHt:{}", JSONUtil.toJsonStr(peopleConfirmDTO));
+        peopleConfirmDTO.setBorderPutrecNo(tbOrder.getBorderPutrecNo());
+        StaticLog.info("\n--------------发送009信息到航通,sendConfirmMsgToHt:{}", JSONUtil.toJsonStr(peopleConfirmDTO));
         FeignFactory.asyncServerInterface.sendConfirm(peopleConfirmDTO);
     }
 
@@ -614,11 +665,23 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
         APPLoginUserInfo appLoginInfo = StpAPPUserUtil.getAPPLoginInfo();
         TbPeople tbPeople = tbPeopleMapper.selectById(appLoginInfo.getFk());
         if (tbPeople == null) throw new ServiceException("当前用户不存在,请联系管理员!");
-        List<TbOrder> orderList = findByBuyUserId(appLoginInfo.getFk());
+        List<TbOrder> list = findByBuyUserId(appLoginInfo.getFk());
+
+        //互助社未确认关联的大订单时边民不能做订单确认
+        List<TbOrder> orderList = new ArrayList<>();
+        for (TbOrder order : list) {
+            QueryWrapper<HtTradeSettlement> htWrapper = new QueryWrapper<>();
+            htWrapper.lambda().eq(HtTradeSettlement::getId, order.getSaleMainId())
+                    .eq(HtTradeSettlement::getHzsConfirmStatus, 1);
+            List<HtTradeSettlement> tradeSettlementList = htTradeSettlementService.list(htWrapper);
+            if (tradeSettlementList.size() > 0) {
+                orderList.add(order);
+            }
+        }
+
         OrderVo orderVo = new OrderVo();
         //被委托订单,并且三个状态中有一个未确认
-        List<TbOrder> declareList2 = orderList.stream().filter(item -> !"1".equals(item.getDeclareType()) &&
-                (item.getPeopleConfirmStatus() == 0 || item.getCooperEntrustStatus() == 0 || item.getApplyConfirmStatus() == 0)).collect(Collectors.toList());
+        List<TbOrder> declareList2 = orderList.stream().filter(item -> item.getApplyConfirmStatus() == 0).collect(Collectors.toList());
         if (declareList2.size() > 0) {
             if (1 == cooper_entrust) {
                 List<Long> removeList = new ArrayList<>();
@@ -680,11 +743,14 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
         return update;
     }
 
-    /** 订单补扣款 */
-    public boolean deduction(Long id){
+    /**
+     * 订单补扣款——单个订单
+     */
+    public boolean deduction(Long id) {
         TbOrder tbOrder = getById(id);
         if (tbOrder == null) {
-            throw new AjaxError("订单不存在");
+            StaticLog.error("\n---------补扣款失败:{}不存在", id);
+            return false;
         }
 
         PaymentDto paymentDto = this.getPaymentData(tbOrder);
@@ -694,21 +760,60 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
         tbOrder.setDeductionCount(tbOrder.getDeductionCount() + 1);
         tbOrder.setDeductionTime(new Date());
 
-        boolean update = super.updateById(tbOrder);
-        return update;
+        return super.updateById(tbOrder);
+    }
+
+    /**
+     * 订单补扣款——按车,并且未扣款
+     */
+    public boolean deductionByVeNo(String veNo, Long id) {
+        LambdaQueryWrapper<TbOrder> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(TbOrder::getVeNo, veNo);
+        wrapper.eq(TbOrder::getSaleMainId, id);
+        wrapper.ne(TbOrder::getSxb010Status, 1).orderByDesc(TbOrder::getCreateTime);
+        List<TbOrder> tbOrders = tbOrderMapper.selectList(wrapper);
+        if (!tbOrders.isEmpty()) {
+            for (TbOrder tbOrder : tbOrders) {
+                PaymentDto paymentDto = this.getPaymentData(tbOrder);
+                StaticLog.info("\n---订单补扣款——按车---sendSXB010——PaymentDto——:{}", JSONUtil.toJsonStr(paymentDto));
+                paymentServerInterface.sendSXB010(paymentDto);
+
+                tbOrder.setDeductionCount(tbOrder.getDeductionCount() + 1);
+                tbOrder.setDeductionTime(new Date());
+            }
+        }
+
+        return super.updateBatchById(tbOrders);
+    }
+
+    List<TbOrder> getDeductionByVeNoList(SoMap so) {
+        LambdaQueryWrapper<TbOrder> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(TbOrder::getVeNo, so.getString("veNo"));
+        wrapper.eq(TbOrder::getSaleMainId, so.getLong("id"));
+        wrapper.ne(TbOrder::getSxb010Status, 1).orderByDesc(TbOrder::getCreateTime);
+        List<TbOrder> tbOrders = tbOrderMapper.selectList(wrapper);
+        return tbOrders;
     }
 
     /*-----           正常业务逻辑    rpc远程调用 -----*/
 
+    /**
+     * 航通发起的退单
+     *
+     * @param htDeclareChargebackDto
+     * @return
+     */
     //进出口申报单退单-逻辑处理
     public boolean chargeback(HtDeclareChargebackDto htDeclareChargebackDto) {
         //查询出被退单的所有边民订单
         LambdaQueryWrapper<TbOrder> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(TbOrder::getTradeAreaId, htDeclareChargebackDto.getFieldCode());
         wrapper.eq(TbOrder::getPreNo, htDeclareChargebackDto.getBillNo());
+        wrapper.eq(TbOrder::getChargebacks, 0);
         List<TbOrder> tbOrderList = this.list(wrapper);
 
         if (tbOrderList.size() <= 0) {
+            log.error("进出口申报单退单:{}不存在", JSONUtil.toJsonStr(htDeclareChargebackDto));
             return false;
         }
         // TODO: 2023/11/27 查验不通过,车辆不通过卡3,调用银行退款划扣申请,从银行第三方账户,退回至边民借记卡账户
@@ -717,23 +822,27 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
             StaticLog.info("\nsendSXB013(进出口申报单退单)——PaymentDto——:{}", JSONUtil.toJsonStr(paymentDto));
             paymentServerInterface.sendSXB013(paymentDto);
         });
-
+        Date now = new Date();
         //修改交易结算单(大订单)的查验结果
         LambdaUpdateWrapper<HtTradeSettlement> updateWrapper = new LambdaUpdateWrapper<>();
-        updateWrapper.set(HtTradeSettlement::getCheckPassStatus, 2);//查验结果[1=查验通过 2=查验不通过]
-        updateWrapper.set(HtTradeSettlement::getCheckPassTime, new Date());//查验时间(不通过)
+        updateWrapper.set(HtTradeSettlement::getChargebacks, 1);
+        updateWrapper.set(HtTradeSettlement::getChargebacksTime, now);
         updateWrapper.eq(HtTradeSettlement::getFieldCode, htDeclareChargebackDto.getFieldCode());
         updateWrapper.eq(HtTradeSettlement::getDeclareId, htDeclareChargebackDto.getDeclareId());
+        updateWrapper.eq(HtTradeSettlement::getCheckPassStatus, 0);
         boolean update = htTradeSettlementService.update(updateWrapper);
 
         //修改边民订单的查验结果
         LambdaUpdateWrapper<TbOrder> updateWrapper1 = new LambdaUpdateWrapper<>();
         updateWrapper1.set(TbOrder::getRefundStatus, 3);//退款中
-        updateWrapper1.set(TbOrder::getRefundTime, new Date());//退款时间
-        updateWrapper1.set(TbOrder::getCheckPassStatus, 2);//查验结果[1=查验通过 2=查验不通过]
-        updateWrapper1.set(TbOrder::getCheckPassTime, new Date());//查验时间(不通过)
+        updateWrapper1.set(TbOrder::getRefundTime, now);//退款时间
+        updateWrapper1.set(TbOrder::getCheckPassTime, now);//查验时间(不通过)
+        updateWrapper1.set(TbOrder::getChargebacks, 1);
+        updateWrapper1.set(TbOrder::getChargebacksTime, now);
+
         updateWrapper1.eq(TbOrder::getTradeAreaId, htDeclareChargebackDto.getFieldCode());
         updateWrapper1.eq(TbOrder::getPreNo, htDeclareChargebackDto.getBillNo());
+        updateWrapper1.eq(TbOrder::getChargebacks, 0);
         boolean update1 = this.update(updateWrapper1);
 
         return update && update1;
@@ -745,7 +854,8 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
         wrapper.eq(TbOrder::getTradeNo, tradeNo);
         List<TbOrder> tbOrderList = this.list(wrapper);
         if (tbOrderList.size() <= 0) {
-            throw new RuntimeException("收到银行退款回执:订单不存在");
+            log.error("收到银行退款回执:{}不存在", tradeNo);
+            return false;
         }
         TbOrder tbOrder = tbOrderList.get(0);
 
@@ -757,45 +867,129 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
         return updateById(tbOrder);
     }
 
-    // TODO: 2023/8/28 系统接收到航通007接口信息:车辆已出一级市场(系统接收到这个信息时,证明已经查验通过,不会有进出口申报单退单)
-    public boolean orderFinish(HtPassCardDTO htPassCardDTO) {
-        String billCode = htPassCardDTO.getBillCode();
-        //获取出了一级市场的所有边民订单
-        LambdaQueryWrapper<TbOrder> wrapper = new LambdaQueryWrapper<>();
-        wrapper.eq(TbOrder::getPreNo, billCode);
-        List<TbOrder> tbOrders = tbOrderMapper.selectList(wrapper);
-        if (tbOrders.isEmpty()) {
-            throw new ServiceException(" ------接收到航通007车辆出卡三接口信息,当前获取到的一级市场的边民订单为空。 单证代码billCode = " + billCode + "\n");
+    /**
+     * 订单补推结关信息给银行
+     */
+    public boolean sendCXB001(Long id) {
+        TbOrder tbOrder = getById(id);
+        if (tbOrder == null) {
+            StaticLog.error("\n----------订单补推结关信息失败:{}不存在", id);
+            return false;
         }
 
-        TbTradeArea area = tbTradeAreaService.getById(tbOrders.get(0).getTradeAreaId());
-        String tradeNos = "";
-        PaymentDto paymentDto = new PaymentDto();
-        for (TbOrder tbOrder : tbOrders) {
-            tradeNos += tbOrder.getTradeNo() + ",";
-            //收到007结关信息后边民即可上架订单,不需等收到打款给外籍商户的成功回执SXB017才能完成订单
-            tbOrder.setFinishTime(new Date());
-            tbOrder.setFinishStatus(FinishStatus.FINISH_STATUS_ONE.getCode());
-
-            //todo: 收到航通007报文即收到海关结关信息,转发结关信息给到银行
-            paymentDto.setTradeNo(tbOrder.getTradeNo());
-            paymentDto.setDeclTime(htPassCardDTO.getCheckTime());
-            paymentDto.setFieldCode(area.getCode());
-            StaticLog.info("\nsendCXB001——PaymentDto——:{}", JSONUtil.toJsonStr(paymentDto));
-            paymentServerInterface.sendCXB001(paymentDto);
-        }
-        this.updateBatchById(tbOrders);
+        HtTradeSettlement htTradeSettlement = htTradeSettlementService.getById(tbOrder.getSaleMainId());
 
+        //todo: 收到航通007报文即收到海关结关信息,转发结关信息给到银行
+        PaymentDto paymentDto = new PaymentDto();
+        paymentDto.setTradeNo(tbOrder.getTradeNo());
+        paymentDto.setDeclTime(htTradeSettlement.getDeclTime());
+        StaticLog.info("\nsendCXB001——PaymentDto——:{}", JSONUtil.toJsonStr(paymentDto));
+        paymentServerInterface.sendCXB001(paymentDto);
 
-        //todo: 调用银行接口发起划扣:将边民划扣至银行第三方账户的货款,支付至外籍商户的账户
+        //todo: 收到航通007报文即收到海关结关信息,转发通车批信息给到银行
         PaymentDto paymentDto2 = new PaymentDto();
-        paymentDto2.setTradeNos(tradeNos);
-        paymentDto2.setVoyageNo(htPassCardDTO.getManifestId());
-        paymentDto2.setVeNo(tbOrders.get(0).getVeNo());
-        paymentDto2.setFieldCode(area.getCode());
+        paymentDto2.setTradeNos(tbOrder.getTradeNo());
+        paymentDto2.setVoyageNo(htTradeSettlement.getVoyageNo());
+        paymentDto2.setVeNo(tbOrder.getVeNo());
         StaticLog.info("\nsendSXB023——PaymentDto——:{}", JSONUtil.toJsonStr(paymentDto2));
         paymentServerInterface.sendSXB023(paymentDto2);
 
+
+        tbOrder.setFinishTime(new Date());
+        tbOrder.setFinishStatus(FinishStatus.FINISH_STATUS_ONE.getCode());
+
+        return updateById(tbOrder);
+    }
+
+    /**
+     * 订单补推结关信息给银行——按车,并且未完成
+     */
+    public boolean sendCXB001ByVeNo(String veNo, Long id) {
+        LambdaQueryWrapper<TbOrder> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(TbOrder::getVeNo, veNo);
+        wrapper.eq(TbOrder::getSaleMainId, id);
+        wrapper.orderByDesc(TbOrder::getCreateTime);
+        List<TbOrder> tbOrders = tbOrderMapper.selectList(wrapper);
+
+        if (!tbOrders.isEmpty()) {
+            HtTradeSettlement htTradeSettlement = htTradeSettlementService.getById(tbOrders.get(0).getSaleMainId());
+            String tradeNos = "";
+            PaymentDto paymentDto = new PaymentDto();
+            for (TbOrder tbOrder : tbOrders) {
+                tradeNos += tbOrder.getTradeNo() + ",";
+                //收到007结关信息后边民即可上架订单,不需等收到打款给外籍商户的成功回执SXB017才能完成订单
+                tbOrder.setFinishTime(new Date());
+                tbOrder.setFinishStatus(FinishStatus.FINISH_STATUS_ONE.getCode());
+
+                //todo: 收到航通007报文即收到海关结关信息,转发结关信息给到银行
+                paymentDto.setTradeNo(tbOrder.getTradeNo());
+                paymentDto.setDeclTime(htTradeSettlement.getDeclTime());
+                StaticLog.info("\nsendCXB001——PaymentDto——:{}", JSONUtil.toJsonStr(paymentDto));
+                log.info("log sendCXB001——PaymentDto——:{}", JSONUtil.toJsonStr(paymentDto));
+                paymentServerInterface.sendCXB001(paymentDto);
+            }
+            this.updateBatchById(tbOrders);
+
+            tradeNos = StringUtils.removeEnd(tradeNos, ",");
+            //todo: 收到航通007报文即收到海关结关信息,转发通车批信息给到银行
+            PaymentDto paymentDto2 = new PaymentDto();
+            paymentDto2.setTradeNos(tradeNos);
+            paymentDto2.setVoyageNo(htTradeSettlement.getVoyageNo());
+            paymentDto2.setVeNo(veNo);
+            StaticLog.info("\nsendSXB023——PaymentDto——:{}", JSONUtil.toJsonStr(paymentDto2));
+            paymentServerInterface.sendSXB023(paymentDto2);
+        }
+        return true;
+    }
+
+    List<TbOrder> getSendCXB001ByVeNoList(SoMap so) {
+        LambdaQueryWrapper<TbOrder> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(TbOrder::getVeNo, so.getString("veNo"));
+        wrapper.eq(TbOrder::getSaleMainId, so.getLong("id"));
+        wrapper.orderByDesc(TbOrder::getCreateTime);
+        List<TbOrder> tbOrders = tbOrderMapper.selectList(wrapper);
+        return tbOrders;
+    }
+
+    // TODO: 2023/8/28 系统接收到航通007接口信息:车辆已出一级市场(系统接收到这个信息时,证明已经查验通过,不会有进出口申报单退单)
+    public boolean orderFinish(HtPassCardDTO htPassCardDTO) {
+        String billCodeStr = htPassCardDTO.getBillCode();
+        List<String> billCodeList = Arrays.stream(billCodeStr.split(",")).collect(Collectors.toList());
+        if (billCodeList.isEmpty()) {
+            StaticLog.error("Invalid bill code:{}", JSONUtil.toJsonStr(htPassCardDTO));
+            return false;
+        }
+        //获取出了一级市场的所有边民订单
+        LambdaQueryWrapper<TbOrder> wrapper = new LambdaQueryWrapper<>();
+        wrapper.in(TbOrder::getPreIeportNo, billCodeList);
+        wrapper.ne(TbOrder::getFinishStatus, 1).orderByDesc(TbOrder::getCreateTime);
+        List<TbOrder> tbOrders = tbOrderMapper.selectList(wrapper);
+        if (!tbOrders.isEmpty()) {
+            String tradeNos = "";
+            PaymentDto paymentDto = new PaymentDto();
+            for (TbOrder tbOrder : tbOrders) {
+                tradeNos += tbOrder.getTradeNo() + ",";
+                //收到007结关信息后边民即可上架订单,不需等收到打款给外籍商户的成功回执SXB017才能完成订单
+                tbOrder.setFinishTime(new Date());
+                tbOrder.setFinishStatus(FinishStatus.FINISH_STATUS_ONE.getCode());
+
+                //todo: 收到航通007报文即收到海关结关信息,转发结关信息给到银行
+                paymentDto.setTradeNo(tbOrder.getTradeNo());
+                paymentDto.setDeclTime(htPassCardDTO.getCheckTime());
+                StaticLog.info("\nsendCXB001——PaymentDto——:{}", JSONUtil.toJsonStr(paymentDto));
+                paymentServerInterface.sendCXB001(paymentDto);
+            }
+            this.updateBatchById(tbOrders);
+
+            tradeNos = StringUtils.removeEnd(tradeNos, ",");
+            //todo: 收到航通007报文即收到海关结关信息,转发通车批信息给到银行
+            PaymentDto paymentDto2 = new PaymentDto();
+            paymentDto2.setTradeNos(tradeNos);
+            paymentDto2.setVoyageNo(htPassCardDTO.getManifestId());
+            paymentDto2.setVeNo(tbOrders.get(0).getVeNo());
+            StaticLog.info("\nsendSXB023——PaymentDto——:{}", JSONUtil.toJsonStr(paymentDto2));
+            paymentServerInterface.sendSXB023(paymentDto2);
+        }
         return true;
     }
 
@@ -814,8 +1008,8 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
         // 更新状态保存交易记录
         if (2 == SXB023Status) {
             tbOrderList.forEach(order -> {
-                order.setTradeStatus(TradeStatus.TRADE_STATUS_Two.getCode()); //支付失败
-                order.setTradeTime(new Date()); //支付回执时间
+                order.setTradeStatus(TradeStatus.TRADE_STATUS_Two.getCode()); //打款失败
+                order.setTradeTime(new Date()); //打款回执时间
                 order.setUpdateTime(new Date());
 
                 boolean result = updateById(order);
@@ -827,8 +1021,8 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
             htTradeSettlement.setFinishStatus(1).setFinishTime(new Date());
             htTradeSettlementService.updateById(htTradeSettlement);
             tbOrderList.forEach(order -> {
-                order.setTradeStatus(TradeStatus.TRADE_STATUS_ONE.getCode()); //已支付
-                order.setTradeTime(new Date()); //支付回执时间
+                order.setTradeStatus(TradeStatus.TRADE_STATUS_ONE.getCode()); //打款成功
+                order.setTradeTime(new Date()); //打款回执时间
                 order.setPayType(0); //支付类型
                 order.setFinishStatus(FinishStatus.FINISH_STATUS_ONE.getCode()); //已完成->完成后可以进行转售
                 order.setFinishTime(new Date());
@@ -920,7 +1114,13 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
             return false;
         }
         Integer orderCount = htTradeSettlement.getOrderCount();
-        htTradeSettlement.setBeOrderCount((orderCount == null ? 0 : orderCount) + 1);
+        Integer beOrderCount = htTradeSettlement.getBeOrderCount();
+        orderCount = orderCount == null ? 0 : orderCount;
+        beOrderCount = beOrderCount == null ? 0 : beOrderCount;
+        if (beOrderCount >= orderCount) {
+            return false;
+        }
+        htTradeSettlement.setBeOrderCount(beOrderCount + 1);
         htTradeSettlementService.updateById(htTradeSettlement);
         return true;
     }
@@ -973,13 +1173,13 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
 
     public List<OrderDto> getOrderListByMainIds(String mainIds) {
         List<Long> idList = Arrays.stream(mainIds.split(",")).mapToLong(Long::parseLong).boxed().collect(Collectors.toList());
-        QueryWrapper<TbOrder>ew=new QueryWrapper<>();
-        ew.in("sale_main_id",idList);
-        List<TbOrder>list=list(ew);
-        List<OrderDto>dtos=new ArrayList<>();
+        QueryWrapper<TbOrder> ew = new QueryWrapper<>();
+        ew.in("sale_main_id", idList);
+        List<TbOrder> list = list(ew);
+        List<OrderDto> dtos = new ArrayList<>();
         for (TbOrder tbOrder : list) {
-            OrderDto orderDto=new OrderDto();
-            BeanUtils.copyProperties(tbOrder,orderDto);
+            OrderDto orderDto = new OrderDto();
+            BeanUtils.copyProperties(tbOrder, orderDto);
             dtos.add(orderDto);
         }
         return dtos;
@@ -988,4 +1188,63 @@ public class TbOrderService extends ServiceImpl<TbOrderMapper, TbOrder> implemen
     public List<TbOrder> getOnSaleList(SoMap so) {
         return tbOrderMapper.getOnSaleList(so);
     }
+
+
+    public Map<String, Object> staticsStatus(Long saleMainId) {
+        SoMap soMap = new SoMap();
+        soMap.put("saleMainId", saleMainId);
+        List<TbOrder> list = tbOrderMapper.getList(soMap);
+        int total = list.size();
+        List<TbOrder> upList = list.stream().filter(tbOrder -> !Objects.isNull(tbOrder.getUpPrice())).collect(Collectors.toList());
+        int upSize = upList.size();
+        double upTotalPrice = upList.stream().collect(Collectors.summarizingDouble(order -> order.getUpPrice().doubleValue())).getSum();
+        List<TbOrder> saleList = list.stream().filter(tbOrder -> tbOrder.getResaleStatus() == 1).collect(Collectors.toList());
+        int saleSize = saleList.size();
+        Map<String, Object> resultMap = new HashMap<>();
+        resultMap.put("upTotalPrice", upTotalPrice);
+        resultMap.put("upSize", upSize);
+        resultMap.put("notUpSize", total - upSize);
+        resultMap.put("saleSize", saleSize);
+        resultMap.put("notSaleSize", total - saleSize);
+        return resultMap;
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    public void cancelSale(Long id) {
+        TbOrder tbOrder = getById(id);
+        if (tbOrder.getBeingOrder() == 1) {
+            throw new AjaxError("该订单在二级市场被下单,无法取消转售");
+        }
+        tbOrder.setResaleStatus(0);
+        HtTradeSettlement htTradeSettlement = htTradeSettlementService.getById(tbOrder.getSaleMainId());
+        htTradeSettlement.setOnSaleCount(htTradeSettlement.getOnSaleCount() - 1);
+        boolean result = FeignFactory.levelTwoServerInterface.removeOnSaleOrderByLevelOneOrderId(id);
+        if (!result) {
+            throw new AjaxError("无法撤销转售");
+        }
+        updateById(tbOrder);
+        htTradeSettlementService.updateById(htTradeSettlement);
+
+    }
+
+    public void cancelSaleBatch(List<Long> ids) {
+        String idsStr = ids.stream().map(id -> id + "").collect(Collectors.joining(","));
+        List<TbOrder> orders = tbOrderMapper.selectBatchIds(ids);
+        TbOrder tbOrder = orders.get(0);
+        HtTradeSettlement htTradeSettlement = htTradeSettlementService.getById(tbOrder.getSaleMainId());
+        boolean result = FeignFactory.levelTwoServerInterface.removeOnSaleOrderByLevelOneOrderIds(idsStr);
+        if (!result) {
+            throw new AjaxError("无法撤销转售");
+        }
+        for (TbOrder order : orders) {
+            order.setResaleStatus(0);
+            htTradeSettlement.setOnSaleCount(htTradeSettlement.getOnSaleCount() - 1);
+        }
+        this.updateBatchById(orders);
+        htTradeSettlementService.updateById(htTradeSettlement);
+    }
+
+    public double sumUpPrice(Long htTradeSettlementId) {
+        return tbOrderMapper.sumUpPrice(htTradeSettlementId);
+    }
 }

+ 9 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_order/vo/OrderVo.java

@@ -54,11 +54,18 @@ public class OrderVo {
      * 总金额
      */
     private Double totalPrice;
-
+    /**
+     * 买家ID
+     */
+    private Long buyUserId;
     /**
      * 买家名称
      */
     private String buyUserName;
+    /**
+     * 买家手机号码
+     */
+    private String phone;
 
     /**
      * 买家类型(1=边民,2=组长)
@@ -243,4 +250,5 @@ public class OrderVo {
     private Date upTime;
 
     private BigDecimal upPrice;
+    private Date createTime;
 }

+ 26 - 18
sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeople.java

@@ -14,7 +14,7 @@ import java.util.Date;
 
 /**
  * Model: tb_people -- 边民
- * @author yzs 
+ * @author yzs
  */
 @Data
 @Accessors(chain = true)
@@ -24,15 +24,15 @@ public class TbPeople extends Model<TbPeople> implements Serializable {
 
 	// ---------- 模块常量 ----------
 	/**
-	 * 序列化版本id 
+	 * 序列化版本id
 	 */
-	private static final long serialVersionUID = 1L;	
+	private static final long serialVersionUID = 1L;
 	/**
-	 * 此模块对应的表名 
+	 * 此模块对应的表名
 	 */
-	public static final String TABLE_NAME = "tb_people";	
+	public static final String TABLE_NAME = "tb_people";
 	/**
-	 * 此模块对应的权限码 
+	 * 此模块对应的权限码
 	 */
 	public static final String PERMISSION_CODE = "tb-people";
 	public static final String PERMISSION_CODE_ADD = "tb-people-add";
@@ -45,23 +45,23 @@ public class TbPeople extends Model<TbPeople> implements Serializable {
 
 	// ---------- 表中字段 ----------
 	/**
-	 * 主键 
+	 * 主键
 	 */
 	@TableId(type = IdType.AUTO)
 	private Long id;
 
 	/**
-	 * 互市区id 
+	 * 互市区id
 	 */
-	private Long tradeAreaId;	
+	private Long tradeAreaId;
 
 	/**
-	 * 互市区名称 
+	 * 互市区名称
 	 */
-	private String tradeAreaName;	
+	private String tradeAreaName;
 
 	/**
-	 * 姓名 
+	 * 姓名
 	 */
 	private String name;
 
@@ -273,22 +273,22 @@ public class TbPeople extends Model<TbPeople> implements Serializable {
 	private Date expiry;
 
 	/**
-	 * 备案编号,如果为新增备案,传空值;如果为变更备案,必须传值; 
+	 * 备案编号,如果为新增备案,传空值;如果为变更备案,必须传值;
 	 */
-	private String putrecNo;	
+	private String putrecNo;
 
 	/**
-	 * 地方政府编号 
+	 * 地方政府编号
 	 */
-	private String localGovernmentNo;	
+	private String localGovernmentNo;
 
 	/**
-	 * 备案状态:默认 0=待申报,1=已申报,2=备案通过,3=备案失败 
+	 * 备案状态:默认 0=待申报,1=已申报,2=备案通过,3=备案失败
 	 */
 	private String filingStatus;
 
 	/**
-	 *  场所编码 
+	 *  场所编码
 	 */
 	private String fieldCode;
 
@@ -296,6 +296,14 @@ public class TbPeople extends Model<TbPeople> implements Serializable {
 
 	private Long shopId;
 
+
+	//证件类型
+	private String papersType;
+	//国籍
+	private String nationality;
+
+
+
 	/**
 	 *  服务点
 	 */

+ 89 - 10
sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleAppController.java

@@ -2,14 +2,21 @@ package com.pj.tb_people;
 
 import cn.dev33.satoken.annotation.SaCheckPermission;
 import com.pj.api.dto.BankInfoDto;
+import com.pj.current.dto.APPLoginUserInfo;
+import com.pj.current.satoken.StpAPPUserUtil;
+import com.pj.tb_group.TbGroup;
+import com.pj.tb_group.TbGroupService;
 import com.pj.utils.sg.AjaxJson;
+import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 import java.util.List;
 
 /**
  * Controller: tb_people -- 边民(app接口)
+ *
  * @Author Mechrevo
  * @Date 2023 07 24 14 56
  **/
@@ -19,34 +26,106 @@ public class TbPeopleAppController {
 
     @Autowired
     private TbPeopleService tbPeopleService;
+    @Resource
+    private TbGroupService tbGroupService;
 
-    /** 查个人信息 - 根据id */
+    /**
+     * 查个人信息 - 根据id
+     */
     @RequestMapping("getById")
-    public AjaxJson getById(String id){
+    public AjaxJson getById(String id) {
         TbPeople t = tbPeopleService.getById(id);
         return AjaxJson.getSuccessData(t);
     }
 
-    /** 改个人信息 */
+    /**
+     * 改个人信息
+     */
     @RequestMapping("update")
-    public AjaxJson update(TbPeople t){
+    public AjaxJson update(TbPeople t) {
+        if (!StpAPPUserUtil.isLogin()) {
+            return AjaxJson.getError("未登录");
+        }
         tbPeopleService.update(t);
         return AjaxJson.getSuccess();
     }
 
-    /** 边民保存银行卡信息 */
+    @RequestMapping("getGroupPeople")
+    public AjaxJson getGroupPeople() {
+        APPLoginUserInfo loginUserInfo = StpAPPUserUtil.getAPPLoginInfo();
+        Long fkId = loginUserInfo.getFk();
+        if (loginUserInfo.getUserType() != 2) {
+            return AjaxJson.getSuccess();
+        }
+        TbPeople t = tbPeopleService.getById(fkId);
+        if (t.getGroupId()==null){
+            return AjaxJson.getSuccess();
+        }
+        SoMap soMap = SoMap.getRequestSoMap();
+        soMap.put("groupId", t.getGroupId());
+        List<TbPeople> list = tbPeopleService.getList(soMap.startPage());
+        return AjaxJson.getPageData(soMap.getDataCount(), list);
+    }
+
+    /**
+     * 加入互助组
+     */
+    @RequestMapping("joinGroup")
+    public AjaxJson joinGroup(@RequestParam Long groupId, @RequestParam String groupName) {
+        if (!StpAPPUserUtil.isLogin()) {
+            return AjaxJson.getError("未登录");
+        }
+        TbPeople t = tbPeopleService.getById(StpAPPUserUtil.getAPPLoginInfo().getFk());
+        t.setGroupId(groupId).setGroupName(groupName);
+        tbPeopleService.updateById(t);
+        return AjaxJson.getSuccess();
+    }
+
+
+    /**
+     * 互助组信息查询
+     */
+    @RequestMapping("getGroupInfo")
+    public AjaxJson getGroupInfo() {
+        if (!StpAPPUserUtil.isLogin()) {
+            return AjaxJson.getError("未登录");
+        }
+        APPLoginUserInfo loginUserInfo = StpAPPUserUtil.getAPPLoginInfo();
+        Long fkId = loginUserInfo.getFk();
+        if (loginUserInfo.getUserType() != 1) {
+            return AjaxJson.getSuccess();
+        }
+        TbPeople t = tbPeopleService.getById(fkId);
+        Long groupId = t.getGroupId();
+        TbGroup tbGroup = tbGroupService.getById(groupId);
+        if (tbGroup != null) {
+            return AjaxJson.getSuccessData(tbGroup);
+        }
+        return AjaxJson.getSuccess();
+    }
+
+
+    /**
+     * 边民保存银行卡信息
+     */
     @RequestMapping("rpc/saveBankInfo")
-    public boolean saveBankByPeople(@RequestParam("id")Long id, @RequestParam("bankName")String bankName, @RequestParam("bankAccount")String bankAccount) {
-        return tbPeopleService.saveBankByPeople(id, bankName, bankAccount);
+    @Deprecated
+    public boolean saveBankByPeople(@RequestParam("id") Long id, @RequestParam("bankName") String bankName, @RequestParam("bankAccount") String bankAccount) {
+       return false;
+       // return tbPeopleService.saveBankByPeople(id, bankName, bankAccount,bankName);
     }
 
-    /** 根据边民姓名与身份证号查询边民是否存在 */
+    /**
+     * 根据边民姓名与身份证号查询边民是否存在
+     */
     @PostMapping("rpc/getByidCard")
-    public boolean getByidCard(@RequestParam("name")String name, @RequestParam("idCard")String idCard) {
+    public boolean getByidCard(@RequestParam("name") String name, @RequestParam("idCard") String idCard) {
         return tbPeopleService.getByidCard(name, idCard);
     }
 
-    /** 边民备案验证查询-银行回复新开户或变更数据 */
+    /**
+     * 边民备案验证查询-银行回复新开户或变更数据
+     */
     @PostMapping("rpc/updateBySXB005")
     public boolean updateBySXB005(@RequestBody BankInfoDto bankInfoDto) {
         return tbPeopleService.updateBySXB005(bankInfoDto);

+ 26 - 12
sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleController.java

@@ -3,9 +3,11 @@ package com.pj.tb_people;
 import java.io.IOException;
 import java.util.List;
 
+import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
 import cn.hutool.log.StaticLog;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.pj.api.consts.FeignFactory;
 import com.pj.api.dto.AppUserDto;
 import com.pj.api.dto.HtPeopleDto;
 import com.pj.api.dto.PeopleDto;
@@ -95,6 +97,7 @@ public class TbPeopleController {
         tbPeopleService.bindShop(shopVO);
         return AjaxJson.getSuccess();
     }
+
     @RequestMapping("removeBind")
     @SaCheckPermission(TbPeople.PERMISSION_CODE_BIND_SHOP)
     public AjaxJson removeBind(String id) {
@@ -102,7 +105,9 @@ public class TbPeopleController {
         return AjaxJson.getSuccess();
     }
 
-    /** 移除组内边民 */
+    /**
+     * 移除组内边民
+     */
     @RequestMapping("leaveGroup")
     @SaCheckPermission(TbPeople.PERMISSION_CODE_EDIT)
     public AjaxJson leaveGroup(@Validated LeaveGroupDto leaveGroupDto) {
@@ -113,7 +118,7 @@ public class TbPeopleController {
      * 查 - 根据id
      */
     @RequestMapping("getById")
-	@SaCheckPermission(TbPeople.PERMISSION_CODE)
+    @SaCheckPermission(TbPeople.PERMISSION_CODE)
     public AjaxJson getById(String id) {
         TbPeople t = tbPeopleService.getById(id);
         return AjaxJson.getSuccessData(t);
@@ -190,7 +195,7 @@ public class TbPeopleController {
     @RequestMapping("applyAddGroup")
     public AjaxJson addAppleGroup(@RequestParam("peopleIds") String peopleIds, @RequestParam("groupId") Long groupId) {
         String[] peopleIdarr = peopleIds.split(",");
-        for (String peopleId: peopleIdarr) {
+        for (String peopleId : peopleIdarr) {
             tbPeopleService.applyAddGroup(Long.valueOf(peopleId), groupId);
         }
         return AjaxJson.getSuccess("申请成功等待组长批准");
@@ -210,6 +215,8 @@ public class TbPeopleController {
         return ajaxJson;
     }
 
+
+
     /**
      * 组长是否同意申请
      *
@@ -220,7 +227,7 @@ public class TbPeopleController {
     public AjaxJson passApply(@RequestParam("groupId") Long groupId, @RequestParam("peopleIds") String peopleIds, @RequestParam("approve") int approve) {
         approve = 1;//同意
         String[] peopleIdarr = peopleIds.split(",");
-        for (String peopleId: peopleIdarr) {
+        for (String peopleId : peopleIdarr) {
             tbPeopleService.passApply(groupId, Long.valueOf(peopleId), approve);
         }
         return AjaxJson.getSuccess("边民加入互助组成功");
@@ -228,24 +235,29 @@ public class TbPeopleController {
 
     /**
      * 边民扫脸确认进境申报
+     *
      * @param orderID
      * @return
      */
     @PostMapping("entryDeclaration")
-    public AjaxJson entryDeclaration(Long orderID){
+    public AjaxJson entryDeclaration(Long orderID) {
         boolean declaration = tbPeopleService.entryDeclaration(orderID);
-        if(declaration)return AjaxJson.getSuccess();
+        if (declaration) return AjaxJson.getSuccess();
         return AjaxJson.getError();
     }
-    /** 保存银行卡信息 */
+
+    /**
+     * 保存银行卡信息
+     */
     @RequestMapping("saveBankInfo")
-    public AjaxJson saveBankByPeople(@RequestParam("id")Long id, @RequestParam("bankName")String bankName, @RequestParam("bankAccount")String bankAccount) {
-        boolean result = tbPeopleService.saveBankByPeople(id, bankName, bankAccount);
+    public AjaxJson saveBankByPeople(@RequestParam("id") Long id, @RequestParam("bankNo") String bankNo, @RequestParam("bankAccount") String bankAccount, @RequestParam("bankName") String bankName) {
+        boolean result = tbPeopleService.saveBankByPeople(id, bankNo, bankAccount,bankName);
         if (result) {
             return AjaxJson.getSuccess("修改成功!");
         }
         return AjaxJson.getError("修改失败!");
     }
+
     /**
      * 数据导入接口
      *
@@ -285,7 +297,7 @@ public class TbPeopleController {
     @RequestMapping("getPeopleForGroup")
     @SaCheckPermission(TbPeople.PERMISSION_CODE)
     public AjaxJson getPeopleForGroup(@RequestParam Long tradeAreaId) {
-        return AjaxJson.getSuccessData(tbPeopleService.getPeopleForGroup(tradeAreaId,1));
+        return AjaxJson.getSuccessData(tbPeopleService.getPeopleForGroup(tradeAreaId, 1));
     }
 
 
@@ -319,9 +331,11 @@ public class TbPeopleController {
         return list;
     }
 
-    /** 根据航通主键查询appUser */
+    /**
+     * 根据航通主键查询appUser
+     */
     @RequestMapping("rpc/getAppUserByBorderPutrecNo")
-    public AppUserDto getAppUserByPlatSeqNo(@RequestParam("borderPutrecNo") String borderPutrecNo){
+    public AppUserDto getAppUserByPlatSeqNo(@RequestParam("borderPutrecNo") String borderPutrecNo) {
         AppUserDto appUserByPlatSeqNo = tbPeopleService.getAppUserByBorderPutrecNo(borderPutrecNo);
         return appUserByPlatSeqNo;
     }

+ 17 - 9
sp-service/level-one-server/src/main/java/com/pj/tb_people/TbPeopleService.java

@@ -627,6 +627,11 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
     PeopleDto getRpcById(Long id) {
         TbPeople byId = super.getById(id);
         PeopleDto peopleDto = new PeopleDto();
+        TbGroup tbGroup = tbGroupMapper.selectById(byId.getGroupId());
+        if (tbGroup!=null) {
+            peopleDto.setLeaderName(tbGroup.getLeaderName());
+            peopleDto.setLeaderPhone(tbGroup.getLeaderPhone());
+        }
         BeanUtils.copyProperties(byId, peopleDto);
         return peopleDto;
     }
@@ -699,8 +704,9 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
     /**
      * 边民保存银行卡信息
      */
-    public boolean saveBankByPeople(Long id, String bankName, String bankAccount) {
+    public boolean saveBankByPeople(Long id, String bankNo, String bankAccount,String bankName) {
         LambdaUpdateWrapper<TbPeople> wrapper = new LambdaUpdateWrapper<>();
+        wrapper.set(TbPeople::getBankNo, bankNo);
         wrapper.set(TbPeople::getBankName, bankName);
         wrapper.set(TbPeople::getBankCode, bankAccount);
         wrapper.eq(TbPeople::getId, id);
@@ -728,6 +734,8 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
         wrapper.set(TbPeople::getPhone, bankInfoDto.getTel());
         wrapper.set(TbPeople::getBankNo, bankInfoDto.getPayBankCode());
         wrapper.set(TbPeople::getBankCode, bankInfoDto.getAccount());
+        wrapper.set(TbPeople::getPapersType, bankInfoDto.getPapersType());
+        wrapper.set(TbPeople::getNationality, bankInfoDto.getNationality());
 
         wrapper.eq(TbPeople::getIdCard, bankInfoDto.getPapersNo());
         wrapper.eq(TbPeople::getName, bankInfoDto.getName());
@@ -768,14 +776,14 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
     }
 
     public void editPhone(EditPhoneVO editPhoneVO) {
-        String phone=editPhoneVO.getPhone();
+        String phone = editPhoneVO.getPhone();
         TbPeople tbPeople = getById(editPhoneVO.getId());
         if (tbPeople == null) {
             throw new ServiceException("该边民不存在");
         }
-        AppUserDto oldUser  = FeignFactory.adminInterface.findUserByPhone(tbPeople.getPhone());
+        AppUserDto oldUser = FeignFactory.adminInterface.findUserByPhone(tbPeople.getPhone());
         //账号不存在或者存在但不是自己的,则新增
-        if (oldUser == null||!StrUtil.equals(oldUser.getName(),tbPeople.getName())) {
+        if (oldUser == null || !StrUtil.equals(oldUser.getName(), tbPeople.getName())) {
             AppUserCreateDTO appUserCreateDTO = new AppUserCreateDTO();
             appUserCreateDTO.setAuth("1");
             appUserCreateDTO.setPhone(phone);
@@ -784,11 +792,11 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
             appUserCreateDTO.setUserType(UserType.USER_TYPE_PEOPLE.getCode() + "");
             log.info("create user :{}", JSONUtil.toJsonStr(appUserCreateDTO));
             FeignFactory.adminInterface.createAccount(appUserCreateDTO);
-        }else{
+        } else {
             //存在,检查下是否冲突
-            AppUserDto checkUser  = FeignFactory.adminInterface.findUserByPhone(editPhoneVO.getPhone());
-            if (checkUser!= null&&!Objects.equals(checkUser.getFkId(),tbPeople.getId()) ){
-                throw new AjaxError("手机已被【"+checkUser.getName()+"】占用");
+            AppUserDto checkUser = FeignFactory.adminInterface.findUserByPhone(editPhoneVO.getPhone());
+            if (checkUser != null && !Objects.equals(checkUser.getFkId(), tbPeople.getId())) {
+                throw new AjaxError("手机已被【" + checkUser.getName() + "】占用");
             }
             UpdateAccountDTO updateAccountDTO = new UpdateAccountDTO();
             updateAccountDTO.setPhone(phone);
@@ -799,7 +807,7 @@ public class TbPeopleService extends ServiceImpl<TbPeopleMapper, TbPeople> imple
         this.updateById(tbPeople);
 
 
+    }
 
 
-    }
 }

+ 14 - 7
sp-service/level-one-server/src/main/java/com/pj/tb_people_tax_account/TbPeopleTaxAccountController.java

@@ -1,9 +1,10 @@
 package com.pj.tb_people_tax_account;
 
 import java.util.List;
+import com.pj.api.dto.PeopleTaxAccountDto;
 import com.pj.utils.so.SoMap;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
 import com.pj.utils.sg.*;
@@ -78,11 +79,17 @@ public class TbPeopleTaxAccountController {
 	}
 
 
-
-
-
-
-
-
+	/**
+	 * 根据ID获取边民信息
+	 */
+	@PostMapping("rpc/getTaxAccountByPeopleId")
+	public PeopleTaxAccountDto getTaxAccountByPeopleId(@RequestParam("peopleId") Long peopleId) {
+		PeopleTaxAccountDto dto = new PeopleTaxAccountDto();
+		SoMap so = new SoMap();
+		so.put("peopleId",peopleId);
+		List<TbPeopleTaxAccount> list = tbPeopleTaxAccountService.getList(so);
+		if(list.size()>0) BeanUtils.copyProperties(list.get(0), dto);
+		return dto;
+	}
 
 }

+ 1 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_people_tax_account/TbPeopleTaxAccountMapper.xml

@@ -77,7 +77,7 @@
 			<when test='sortType == 23'> update_time desc </when>
 			<when test='sortType == 24'> update_by desc </when>
 			<when test='sortType == 25'> update_name desc </when>
-			<otherwise> id desc </otherwise>
+			<otherwise> create_time desc </otherwise>
 		</choose>
 	</select>
 

+ 1 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_port_news/TbPortNewsAppController.java

@@ -42,7 +42,7 @@ public class TbPortNewsAppController {
     @RequestMapping("getPortNewsList")
     public AjaxJson getPortNewsList() {
         SoMap so = SoMap.getRequestSoMap();
-        so.put("status", 1);
+        so.put("isRelease", 1);
         List<TbPortNews> list = tbPortNewsService.getList(so.startPage());
         return AjaxJson.getPageData(so.getDataCount(), list);
     }

+ 2 - 3
sp-service/level-one-server/src/main/java/com/pj/tb_port_news/TbPortNewsService.java

@@ -40,7 +40,6 @@ public class TbPortNewsService extends ServiceImpl<TbPortNewsMapper, TbPortNews>
     void add(TbPortNews t) {
         PCLoginUserInfo userInfo = StpUserUtil.getPCLoginInfo();
         t.setIsRelease(0)
-                .setStatus(0)
                 .setCreateBy(userInfo.getLoginId())
                 .setCreateName(userInfo.getLoginName())
                 .setCreateTime(new Date());
@@ -126,11 +125,11 @@ public class TbPortNewsService extends ServiceImpl<TbPortNewsMapper, TbPortNews>
      */
     public AjaxJson getPortNewsDetails(Long id) {
         TbPortNews tbPortNews = tbPortNewsMapper.selectById(id);
-        if (tbPortNews != null && tbPortNews.getStatus() == 1) {
+        if (tbPortNews != null && tbPortNews.getIsRelease() == 1) {
             tbPortNews.setReadCount(tbPortNews.getReadCount() + 1);
             tbPortNewsMapper.updateById(tbPortNews);
             return AjaxJson.getSuccessData(tbPortNews);
         }
-        return AjaxJson.getError();
+        return AjaxJson.getError("资讯已下架");
     }
 }

+ 2 - 1
sp-service/level-one-server/src/main/java/com/pj/tb_shop/TbShopMapper.xml

@@ -37,7 +37,8 @@
 			<if test=' this.has("area") '> and area = #{area} </if>
 			<if test=' this.has("status") '> and status = #{status} </if>
 			<if test=' this.has("remark") '> and remark = #{remark} </if>
-			<if test=' this.has("enterpriseName") '> and enterprise_name = #{enterpriseName} </if>
+			<if test=' this.has("enterpriseName") '> and enterprise_name like cancat('%',#{enterpriseName},'%')  </if>
+			<if test=' this.has("ownerName") '> and owner_name like concat('%',#{ownerName},'%')  </if>
 			<if test=' this.has("deleteStatus") '> and delete_status = #{deleteStatus} </if>
 		</where>
 		order by

+ 2 - 2
sp-service/level-one-server/src/main/java/com/pj/tb_shop/TbShopService.java

@@ -354,9 +354,9 @@ public class TbShopService extends ServiceImpl<TbShopMapper, TbShop> implements
         wrapper.set(TbShop::getShopSccd, bankInfoDto.getPapersNo());
         wrapper.set(TbShop::getOwnerTel, bankInfoDto.getTel());
         wrapper.set(TbShop::getBankAccount, bankInfoDto.getAccount());
-        wrapper.set(TbShop::getBank, bankInfoDto.getSwiftCode());
+        wrapper.set(TbShop::getBank, bankInfoDto.getPayBankCode());
         wrapper.set(TbShop::getNationality, bankInfoDto.getNationality());
-        wrapper.set(TbShop::getAbroad, bankInfoDto.getAbroad());
+        //wrapper.set(TbShop::getAbroad, bankInfoDto.getAbroad());
 
         wrapper.eq(TbShop::getOwnerName, bankInfoDto.getName());
 

+ 125 - 0
sp-service/level-one-server/src/main/resources/logback.xml

@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+    <contextName>one</contextName>
+    <property name="LOG_PATH" value="logs"/>
+    <property name="APP_DIR" value="pco"/>
+    <property name="log.maxFileSize" value="10MB"/>
+    <property name="log.maxFileCnt" value="90"/>
+    <property name="log.totalSizeCap" value="10GB"/>
+
+    <appender name="FILE_DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${LOG_PATH}/${APP_DIR}/log_debug.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/debug/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <maxFileSize>${log.maxFileSize}</maxFileSize>
+            <maxHistory>${log.maxFileCnt}</maxHistory>
+            <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
+        </rollingPolicy>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS}|%-5level{10}[%25.25thread{24}]%-40.40logger{39}|-Line:%-3L:%msg%n
+            </pattern>
+            <charset>utf-8</charset>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>debug</level>
+            <onMatch>ACCEPT</onMatch>
+            <!--            <onMismatch>DENY</onMismatch>-->
+        </filter>
+    </appender>
+
+    <appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${LOG_PATH}/${APP_DIR}/log_info.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/info/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <maxFileSize>${log.maxFileSize}</maxFileSize>
+            <maxHistory>${log.maxFileCnt}</maxHistory>
+            <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
+        </rollingPolicy>
+        <append>true</append>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS}|%-5level{10}[%25.25thread{24}]%-40.40logger{39}|-Line:%-3L:%msg%n
+            </pattern>
+            <charset>UTF-8</charset>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>info</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <!--encoder 默认配置为PatternLayoutEncoder-->
+        <encoder>
+            <pattern>%d{yyyy-MM-dd
+                HH:mm:ss.SSS}|%highlight(%-5level{10})[%boldYellow(%25.25thread{24})]%gray(%-50.50logger{49})|-Line:%boldYellow(%-3L):%msg%n
+            </pattern>
+            <charset>UTF-8</charset>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+            <level>info</level>
+        </filter>
+    </appender>
+
+    <appender name="COMM_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${LOG_PATH}/${APP_DIR}/comm_info.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/comm/comm_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <maxFileSize>${log.maxFileSize}</maxFileSize>
+            <maxHistory>${log.maxFileCnt}</maxHistory>
+            <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
+        </rollingPolicy>
+        <append>true</append>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <pattern>%msg%n</pattern>
+            <charset>UTF-8</charset>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>info</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+    <logger name="com.cryann.hsms.driver.netty" additivity="false">
+        <appender-ref ref="COMM_LOG"/>
+    </logger>
+
+    <appender name="SXFX_info_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${LOG_PATH}/${APP_DIR}/SxFx_info.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/SxFx/SxFx_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <maxFileSize>${log.maxFileSize}</maxFileSize>
+            <maxHistory>${log.maxFileCnt}</maxHistory>
+            <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
+        </rollingPolicy>
+        <append>true</append>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <pattern>%d{yyyy-MM-dd
+                HH:mm:ss.SSS}|%highlight(%-5level{10})[%boldYellow(%25.25thread{24})]%gray(%-50.50logger{49})|-Line:%boldYellow(%-3L):%msg%n
+            </pattern>
+            <charset>UTF-8</charset>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>info</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+
+    <logger name="org.springframework" level="WARN"/>
+    <logger name="org.hibernate" level="WARN"/>
+    <logger name="com.apache.ibatis" level="TRACE"/>
+    <logger name="java.sql.Connection" level="DEBUG"/>
+    <logger name="java.sql.Statement" level="DEBUG"/>
+    <logger name="java.sql.PreparedStatement" level="DEBUG"/>
+
+    <!-- 生产环境下,将此级别配置为适合的级别,以免日志文件太多或影响程序性能 -->
+    <root level="INFO">
+        <!-- 生产环境将请stdout,testfile去掉 -->
+        <appender-ref ref="STDOUT"/>
+        <appender-ref ref="FILE_DEBUG"/>
+        <!--<appender-ref ref="FILEWARN"/>-->
+        <appender-ref ref="FILE_INFO"/>
+    </root>
+</configuration>

+ 33 - 4
sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrders.java

@@ -37,6 +37,7 @@ public class TbOrders extends Model<TbOrders> implements Serializable {
 	public static final String PERMISSION_CODE_EDIT = "tb-orders-edit";
 	public static final String PERMISSION_CODE_DEL = "tb-orders-del";
 	public static final String PERMISSION_CODE_EDIT_PRICE = "tb-order-edit-price";
+	public static final String PERMISSION_CODE_DEDUCTION = "tb-orders-deduction";
 
 
 
@@ -227,22 +228,22 @@ public class TbOrders extends Model<TbOrders> implements Serializable {
 	private Double resalePrice;
 
 	/**
-	 * 是否支付(0=未支付,1=支付,2=支付失败)
+	 * 是否支付(0=未支付,1=支付成功,2=支付失败,3=支付中)
 	 */
 	private Integer isPay;
 
 	/**
-	 * 支付时间
+	 * 支付/回执时间
 	 */
 	private Date payTime;
 
 	/**
-	 * 是否缴税缴费(0=未缴费,1=缴费,2=缴费失败)
+	 * 是否缴税缴费(0=未缴费,1=缴费成功,2=缴费失败,3=缴费中)
 	 */
 	private Integer payTax;
 
 	/**
-	 * 缴税缴费时间
+	 * 缴税缴费/回执时间
 	 */
 	private Date payTaxTime;
 
@@ -252,4 +253,32 @@ public class TbOrders extends Model<TbOrders> implements Serializable {
 	private String netWet;
 	private String totalWeight;
 	private String singlePrice;
+
+	/**
+	 * (二级市场)采购商补扣款次数
+	 */
+	private Integer deductionCount;
+	/**
+	 * (二级市场)采购商最近一次补扣款时间
+	 */
+	private Date deductionTime;
+
+	/**
+	 * 申报数量
+	 */
+	private Double buyQty;
+
+	/**
+	 * 第一数量
+	 */
+	private Double buyQty1;
+
+	/**
+	 * 第二数量
+	 */
+	private Double buyQty2;
+	/**
+	 * 下单时间
+	 */
+	private Date orderTime;
 }

+ 3 - 0
sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersApiController.java

@@ -98,6 +98,9 @@ public class TbOrdersApiController {
         List<OrderDto> orderDtos = FeignFactory.levelOneServerInterface.getOrderListByMainIds(ids);
         List<Long> leveloneOrderIds = orderDtos.stream().map(OrderDto::getId).collect(Collectors.toList());
         List<TbOrders> orders = tbOrdersService.findByLevelOneOrderIds(leveloneOrderIds);
+        if (orders.isEmpty()){
+            return AjaxJson.getError("订单不存在");
+        }
         String orderIds = orders.stream().map(obj -> obj.getId() + "").collect(Collectors.joining(","));
         APPLoginUserInfo appLoginInfo = StpAPPUserUtil.getAPPLoginInfo();
         return AjaxJson.toAjax(tbOrdersService.purchaserBuy(orderIds, appLoginInfo.getFk()));

+ 46 - 31
sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersController.java

@@ -13,6 +13,8 @@ import com.pj.current.satoken.StpAPPUserUtil;
 import com.pj.current.satoken.StpUserUtil;
 import com.pj.enummj.DeleteStatus;
 import com.pj.enummj.OrderStatus;
+import com.pj.tb_orders.vo.TbOrdersEmailVo;
+import com.pj.tb_orders.vo.TbOrdersPrintVo;
 import com.pj.utils.so.SoMap;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -38,37 +40,7 @@ public class TbOrdersController {
     @Autowired
     TbOrdersService tbOrdersService;
 
-    /**
-     * 增
-     */
-    @RequestMapping("add")
-    @SaCheckPermission(TbOrders.PERMISSION_CODE_ADD)
-    public AjaxJson add(TbOrders t) {
-        tbOrdersService.add(t);
-        t = tbOrdersService.getById(SP.publicMapper.getPrimarykey());
-        return AjaxJson.getSuccessData(t);
-    }
-
-    /**
-     * 删
-     */
-    @RequestMapping("delete")
-    @SaCheckPermission(TbOrders.PERMISSION_CODE_DEL)
-    public AjaxJson delete(Long id) {
-        tbOrdersService.delete(id);
-        return AjaxJson.getSuccess();
-    }
 
-    /**
-     * 删 - 根据id列表
-     */
-    @RequestMapping("deleteByIds")
-    @SaCheckPermission(TbOrders.PERMISSION_CODE_DEL)
-    public AjaxJson deleteByIds() {
-        List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
-        int line = SP.publicMapper.deleteByIds(TbOrders.TABLE_NAME, ids);
-        return AjaxJson.getByLine(line);
-    }
 
     @RequestMapping("addOrderByResale")
     @SaCheckPermission(TbOrders.PERMISSION_CODE_EDIT_PRICE)
@@ -113,7 +85,7 @@ public class TbOrdersController {
         orders.setCreateName(pcLoginUserInfo.getLoginName());
         orders.setCreateTime(new Date());
 
-        this.add(orders);
+        tbOrdersService.add(orders);
 
         //修改一级市场边民订单转售状态为已转售
         boolean b = FeignFactory.levelOneServerInterface.updateResaleStatus(id);
@@ -213,4 +185,47 @@ public class TbOrdersController {
         return AjaxJson.getSuccessData(so);
     }
 
+
+    /** 采购商补扣款 */
+    @RequestMapping("deduction")
+    @SaCheckPermission(TbOrders.PERMISSION_CODE_DEDUCTION)
+    public AjaxJson deduction(Long id){
+        tbOrdersService.deduction(id);
+        return AjaxJson.getSuccess();
+    }
+
+    /**
+     * 查 - 交易凭证
+     */
+    @RequestMapping("getSubPrint")
+    @SaCheckPermission(TbOrders.PERMISSION_CODE)
+    public AjaxJson getSubPrint(Long id) {
+        TbOrdersPrintVo t = tbOrdersService.getSubPrint(id);
+        return AjaxJson.getSuccessData(t);
+    }
+
+    /**
+     * 查 - 电子协议
+     */
+    @RequestMapping("getSubEmail")
+    @SaCheckPermission(TbOrders.PERMISSION_CODE)
+    public AjaxJson getSubEmail(Long id) {
+        TbOrdersEmailVo t = tbOrdersService.getSubEmail(id);
+        return AjaxJson.getSuccessData(t);
+    }
+
+    /**
+     * 根据一级市场订单删除二级市场订单
+     */
+    @RequestMapping("rpc/removeOnSaleOrderByLevelOneOrderId")
+    public boolean removeOnSaleOrderByLevelOneOrderId(@RequestParam("levelOneOrderId")Long levelOneOrderId) {
+        return tbOrdersService.removeOnSaleOrderByLevelOneOrderId(levelOneOrderId);
+    }
+    /**
+     * 根据一级市场订单删除二级市场订单
+     */
+    @RequestMapping("rpc/removeOnSaleOrderByLevelOneOrderIds")
+    public boolean removeOnSaleOrderByLevelOneOrderId(@RequestParam("levelOneOrderIds")String levelOneOrderIds) {
+        return tbOrdersService.removeOnSaleOrderByLevelOneOrderIds(levelOneOrderIds);
+    }
 }

+ 1 - 1
sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersMapper.xml

@@ -98,7 +98,7 @@
 
 	<select id="getLevelTwoList" resultMap="model">
 		select * from tb_orders where purchaser_id is null and (purchaser_name is null or purchaser_name='')
-		<if test=' this.has("goodsName") '>and goods_name like concat('%', #{goodsName}, '%') or ve_no like upper(concat('%', #{goodsName}, '%'))</if>
+		<if test=' this.has("goodsName") '>and (goods_name like concat('%', #{goodsName}, '%') or ve_no like upper(concat('%', #{goodsName}, '%')) )</if>
 	</select>
 
 	<!--已完成和累计交易额 -->

+ 198 - 55
sp-service/level-two-server/src/main/java/com/pj/tb_orders/TbOrdersService.java

@@ -2,7 +2,10 @@ package com.pj.tb_orders;
 
 import cn.dev33.satoken.stp.StpUtil;
 import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSONUtil;
+import cn.hutool.log.StaticLog;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -35,10 +38,13 @@ import com.pj.tb_item_rules.TbItemRulesService;
 import com.pj.tb_orders.vo.OrderFeeItemVO;
 import com.pj.tb_item_rules.TbItemRulesVo;
 import com.pj.tb_orders.vo.OrderStaticsDTO;
+import com.pj.tb_orders.vo.TbOrdersEmailVo;
+import com.pj.tb_orders.vo.TbOrdersPrintVo;
 import com.pj.tb_orders_cart.TbOrdersCart;
 import com.pj.tb_orders_cart.TbOrdersCartMapper;
 import com.pj.tb_purchaser.TbPurchaser;
 import com.pj.tb_purchaser.TbPurchaserMapper;
+import com.pj.utils.sg.AjaxError;
 import com.pj.utils.so.SoMap;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.BeanUtils;
@@ -120,33 +126,51 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
 
     }
 
-    private PaymentTwoDto getPaymentData(TbOrders t,OrderDto orderOne) {
+    private PaymentTwoDto getPaymentData(TbOrders t, OrderDto orderOne) {
         TradeSettlementDto htTradeSettlement = levelOneServerInterface.getHtTradeSettlementById(orderOne.getSaleMainId());
         PaymentTwoDto paymentTwoDto = new PaymentTwoDto();
         BeanUtils.copyProperties(htTradeSettlement, paymentTwoDto);
 
+        //二级市场订单号
         paymentTwoDto.setOrderNo(t.getOrderNo());
+        //转售金额
+        paymentTwoDto.setResalePrice(BigDecimal.valueOf(t.getResalePrice()));
+        //商品信息
         paymentTwoDto.setBuyQty(orderOne.getBuyQty());
         paymentTwoDto.setGrossWt(orderOne.getGrossWt());
+        paymentTwoDto.setNetWt(orderOne.getNetWt());
         paymentTwoDto.setGoodsName(orderOne.getGoodsNames());
         paymentTwoDto.setGoodsUnit(orderOne.getGoodsUnit());
         paymentTwoDto.setDeclPrice(orderOne.getDeclPrice());
         paymentTwoDto.setCodeTs(orderOne.getCodeTs());
-        //转售金额
-        paymentTwoDto.setResalePrice(BigDecimal.valueOf(t.getResalePrice()));
 
         PeopleDto tbPeople = levelOneServerInterface.getRpcById(orderOne.getBuyUserId());
-        paymentTwoDto.setBankCode(tbPeople.getBankCode());
-        paymentTwoDto.setBankName(tbPeople.getBankName());
-        paymentTwoDto.setBorderName(tbPeople.getName());
-        paymentTwoDto.setBorderidno(tbPeople.getIdCard());
-        paymentTwoDto.setBorderTel(tbPeople.getPhone());
+        StaticLog.info("边民tbPeople:{}", JSONUtil.toJsonStr(tbPeople));
+        if (tbPeople != null) {
+            paymentTwoDto.setBankCode(tbPeople.getBankCode());
+            paymentTwoDto.setBankName(tbPeople.getBankName());
+            paymentTwoDto.setBankNo(tbPeople.getBankNo());
+            paymentTwoDto.setBorderName(tbPeople.getName());
+            paymentTwoDto.setBorderidno(tbPeople.getIdCard());
+            paymentTwoDto.setBorderTel(tbPeople.getPhone());
+            paymentTwoDto.setPapersType(tbPeople.getPapersType());
+            paymentTwoDto.setBorderNationality(tbPeople.getNationality());
+        }
 
         TbPurchaser purchaser = tbPurchaserMapper.selectById(t.getPurchaserId());
-        paymentTwoDto.setPcName(purchaser.getName());
-        paymentTwoDto.setBusinessLicense(purchaser.getBusinessLicense());
-        paymentTwoDto.setPcBankAccount(purchaser.getBankAccount());
-        paymentTwoDto.setPcContact(purchaser.getContact());
+        StaticLog.info("采购商purchaser:{}", JSONUtil.toJsonStr(purchaser));
+        if (purchaser != null) {
+            paymentTwoDto.setPcName(purchaser.getBusinessName());
+            if (purchaser.getType() == 2) {
+                paymentTwoDto.setPcName(purchaser.getName());
+            }
+            paymentTwoDto.setDutyParagraph(purchaser.getDutyParagraph());
+            paymentTwoDto.setPcBankAccount(purchaser.getBankAccount());
+            paymentTwoDto.setPcBankNo(purchaser.getBankNo());
+            paymentTwoDto.setPcContact(purchaser.getContact());
+            paymentTwoDto.setPcIdCard(purchaser.getIdCard());
+            paymentTwoDto.setPcType(purchaser.getType());
+        }
 
         return paymentTwoDto;
     }
@@ -154,32 +178,38 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
     /**
      * 改 收购商购买
      */
-    boolean purchaserBuy(String idStr,Long purchaserId) {
-
+    boolean purchaserBuy(String idStr, Long purchaserId) {
         // 获取收购商ID与名称
         TbPurchaser purchaser = tbPurchaserMapper.selectById(purchaserId);
         if (null == purchaser) throw new RuntimeException("当前收购商账号异常,请重新登录或联系管理员!");
+        log.info("收购商采购:{},{}", purchaser.getName(), idStr);
 
         Long[] idArr = Convert.toLongArray(idStr);
-
-        TbOrders orders = new TbOrders();
-        orders.setPurchaserId(purchaser.getId());
-        orders.setPurchaserName(purchaser.getName());
-
         for (Long id : idArr) {
+            TbOrders orderTwo = this.getById(id);
+            if (orderTwo == null) {
+                log.error(id + "订单不存在");
+                throw new AjaxError("订单不存在!");
+            }
+            if (StrUtil.isNotEmpty(orderTwo.getPurchaserName())) {
+                throw new AjaxError(orderTwo.getOrderNo() + "订单已被购买!");
+            }
+            orderTwo.setPurchaserId(purchaser.getId());
+            orderTwo.setPurchaserName(purchaser.getName());
+            orderTwo.setIsPay(0);//支付中
 
-            orders.setId(id);
-            boolean b = updateById(orders);
+            orderTwo.setOrderTime(new Date());//支付时间
+            boolean b = updateById(orderTwo);
             if (!b) throw new RuntimeException("购买异常,请重新登录或联系管理员!");
 
-            TbOrders orderTwo = getById(id);
             //修改对应的一级市场订单状态:BeingOrder值为已被下单
-            levelOneServerInterface.updateBeingOrder(orderTwo.getLevelOneOrderId());
+            boolean updateResult = levelOneServerInterface.updateBeingOrder(orderTwo.getLevelOneOrderId());
+            if (!updateResult) throw new AjaxError(orderTwo.getOrderNo() + "下单异常");
 
             OrderDto orderOne = levelOneServerInterface.getOrderDtoById(orderTwo.getLevelOneOrderId());
 
             //todo 接收国内采购商的货款支付申请,划扣至边民账户并给出回执 并且同步至航通
-            PaymentTwoDto paymentTwoDto = this.getPaymentData(orderTwo,orderOne);
+            PaymentTwoDto paymentTwoDto = this.getPaymentData(orderTwo, orderOne);
             paymentServerInterface.sendMKT006_NoCommission(paymentTwoDto);
 
             //给每个购买他商品的边民发一条支付成功消息,通知边民发起缴税申请以及缴费申请
@@ -198,6 +228,7 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
 
     /**
      * 收到采购商支付扣款回执:成功——> 边民缴税以及各服务费
+     *
      * @param orderNo 二级市场边民订单-订单编号
      */
     boolean payTax(String orderNo, Integer MKT008Status) {
@@ -210,23 +241,24 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
         OrderDto orderOne = levelOneServerInterface.getOrderDtoById(orderTwo.getLevelOneOrderId());
         if (null == orderOne) new RuntimeException("收到采购商支付扣款回执:一级市场订单不存在");
 
-        if(2==MKT008Status) {//扣款失败
+        if (2 == MKT008Status) {//支付失败
             //todo 订单状态更新
-            orderTwo.setIsPay(2);//支付失败
+            orderTwo.setIsPay(2);
             orderTwo.setPayTime(new Date());
-        }
-        else if(1==MKT008Status) {//扣款成功
+        } else if (1 == MKT008Status) {//支付成功
             //todo 1、订单状态更新
-            orderTwo.setIsPay(1);//支付成功
+            orderTwo.setIsPay(1);
             orderTwo.setPayTime(new Date());
-
+            orderTwo.setOrderFinish(1);//支付成功订单完成
+            //orderTwo.setPayTax(3);//缴费中
+            //orderTwo.setPayTaxTime(new Date());//缴费时间
             //todo 2、同步订单信息,发送航通
-            OrdersDto ordersDto = new OrdersDto();
-            BeanUtils.copyProperties(orderTwo,ordersDto);
-            asyncServerInterface.sendLevelTwoOrdersDto(ordersDto, DataType.DATA_TYPE_FOUR.getCode());
+            /*OrdersDto ordersDto = new OrdersDto();
+            BeanUtils.copyProperties(orderTwo, ordersDto);
+            asyncServerInterface.sendLevelTwoOrdersDto(ordersDto, DataType.DATA_TYPE_FOUR.getCode());*/
 
             //todo 3、系统将服务费自动分账,将分账信息自动发送至银行进行划扣
-            List<TbItemRules> ruleList = new ArrayList<>();
+            /*List<TbItemRules> ruleList = new ArrayList<>();
             List<TbFeeItem> feeItemList = tbFeeItemService.getFeeItems();
             feeItemList.forEach(feeItem -> {
                 ruleList.addAll(tbItemRulesService.getList(new SoMap().set("itemId", feeItem.getId())));
@@ -252,19 +284,20 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
                 List<TbFeeItem> feeItems = feeItemList.stream().filter(feeItem -> feeItem.getId().equals(ruleItem.getItemId())).collect(Collectors.toList());
                 if (feeItems.size() > 0) {
                     TbCompany company = companyService.getById(feeItems.get(0).getCompanyId());
-                    BeanUtils.copyProperties(company,companyDto);
+                    BeanUtils.copyProperties(company, companyDto);
                     companyDto.setChargesPrice(chargesPrice);
                 }
                 companyDtoList.add(companyDto);
             }
 
-            PaymentTwoDto paymentTwoDto = this.getPaymentData(orderTwo,orderOne);
+            PaymentTwoDto paymentTwoDto = this.getPaymentData(orderTwo, orderOne);
             paymentTwoDto.setCompanyDtoList(companyDtoList);
-            paymentServerInterface.sendMKT006(paymentTwoDto);
+            paymentServerInterface.sendMKT006(paymentTwoDto);*/
         }
 
         return updateById(orderTwo);
     }
+
     /**
      * 收到边民缴税以及各服务费回执
      *
@@ -277,12 +310,11 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
         if (list.size() <= 0) new RuntimeException("收到边民缴税以及各服务费回执:二级市场订单不存在");
         TbOrders orderTwo = list.get(0);
 
-        if(2==MKT008Status) {//缴费失败
+        if (2 == MKT008Status) {//缴费失败
             //todo 订单状态更新
             orderTwo.setPayTax(2);
             orderTwo.setPayTaxTime(new Date());
-        }
-        else if(1==MKT008Status) {//缴费成功
+        } else if (1 == MKT008Status) {//缴费成功
             //todo 订单状态更新
             orderTwo.setPayTax(1);
             orderTwo.setPayTaxTime(new Date());
@@ -341,9 +373,6 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
     List<TbOrders> getPCList(SoMap soMap, Integer ordersStatus) {
         //检查登录
         StpUtil.checkLogin();
-        // PC端只能admin进行登录,默认查询所有
-        soMap.put("orderFinish", ordersStatus); // 订单的完成状态
-        soMap.put("sortType", 22);  // 根据时间降序
         return tbOrdersMapper.getList(soMap);
     }
 
@@ -361,7 +390,7 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
         List<TbOrders> levelTwoList = tbOrdersMapper.getLevelTwoList(so);
 
         String typeCode = so.getString("typeCode");
-        if(StringUtils.isNotEmpty(typeCode)) {
+        if (StringUtils.isNotEmpty(typeCode)) {
             List<TbOrders> collect = new ArrayList<>();
             List<Long> goodsIds = levelOneServerInterface.getGoodsIds(typeCode);
             goodsIds.forEach(goodsId -> {
@@ -443,9 +472,12 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
         orders.setCreateTime(new Date());
         orders.setVeNo(orderDto.getVeNo())
                 .setGoodsUnit(orderDto.getGoodsUnit())
-                .setNetWet(orderDto.getNetWt()+"")
-                .setTotalWeight(orderDto.getTotalWeight()+"")
-                .setSinglePrice(orders.getSinglePrice());
+                .setNetWet(orderDto.getNetWt() + "")
+                .setTotalWeight(orderDto.getTotalWeight() + "")
+                .setSinglePrice(orderDto.getDeclPrice() + "")
+                .setBuyQty(orderDto.getBuyQty())
+                .setBuyQty1(orderDto.getBuyQty1())
+                .setBuyQty2(orderDto.getBuyQty2());
         this.add(orders);
 
         //修改一级市场边民订单转售状态为已转售
@@ -457,8 +489,8 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
 
     public OrderFeeItemVO countPrice(SoMap so) {
         OrderDto orderDto = levelOneServerInterface.getOrderDtoById(so.getLong("id"));
-        if (null == orderDto){
-            log.error("当前一级市场订单为空,请联系管理员:{}",so.getLong("id"));
+        if (null == orderDto) {
+            log.error("当前一级市场订单为空,请联系管理员:{}", so.getLong("id"));
             throw new RuntimeException("当前一级市场订单为空,请联系管理员!");
         }
         //目前逻辑为一个边民订单只有一个商品
@@ -466,7 +498,7 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
         List<TbFeeItem> feeItemList = tbFeeItemService.getFeeItems();
 
         BigDecimal TotalPrice = new BigDecimal(orderDto.getTotalPrice());
-        BigDecimal GrossWt = new BigDecimal(orderDto.getNetWt()+"");
+        BigDecimal GrossWt = new BigDecimal(orderDto.getNetWt() + "");
         if (orderDto.getGoodsUnit().contains("千克") || orderDto.getGoodsUnit().contains("kg")) {
             GrossWt = GrossWt.divide(new BigDecimal(1000), 2, RoundingMode.HALF_UP);
         }
@@ -516,7 +548,7 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
         wrapper.eq(TbOrders::getLevelOneOrderId, levelOneOrderId);
         List<TbOrders> tbOrders = tbOrdersMapper.selectList(wrapper);
 
-        if(tbOrders.size()>0) return tbOrders.get(0);
+        if (tbOrders.size() > 0) return tbOrders.get(0);
         return null;
     }
 
@@ -589,27 +621,30 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
 
     /**
      * 根据年份查询每月订单交易额和交易量统计
+     *
      * @param type
      * @param year
      * @return
      */
-    public List<Map<String, Object>> orderStatistics(String type,String year,Long tradeAreaId){
-        return tbOrdersMapper.orderStatistics(type,year,tradeAreaId);
+    public List<Map<String, Object>> orderStatistics(String type, String year, Long tradeAreaId) {
+        return tbOrdersMapper.orderStatistics(type, year, tradeAreaId);
     }
 
     /**
      * 查询所有统计年份
+     *
      * @return
      */
-    public List<Map<String, Object>> selectYear(){
+    public List<Map<String, Object>> selectYear() {
         return tbOrdersMapper.selectYear();
     }
 
     /**
      * 累计交易额
+     *
      * @return
      */
-    public Map<String, Object> totalMoney(Long tradeAreaId){
+    public Map<String, Object> totalMoney(Long tradeAreaId) {
         return tbOrdersMapper.totalMoney(tradeAreaId);
     }
 
@@ -633,4 +668,112 @@ public class TbOrdersService extends ServiceImpl<TbOrdersMapper, TbOrders> imple
     public List<OrderStaticsDTO> getPurchaserStatistics(SoMap so) {
         return tbOrdersMapper.getPurchaserStatistics(so);
     }
+
+    /**
+     * 采购商补扣款
+     */
+    public boolean deduction(Long id) {
+        TbOrders tbOrders = getById(id);
+        if (tbOrders == null) {
+            log.error("采购商补扣款失败:{}不存在", id);
+            return false;
+        }
+
+        OrderDto orderOne = levelOneServerInterface.getOrderDtoById(tbOrders.getLevelOneOrderId());
+        PaymentTwoDto paymentTwoDto = this.getPaymentData(tbOrders, orderOne);
+        StaticLog.info("\n---采购商补扣款---sendMKT006_NoCommission——PaymentTwoDto——:{}", JSONUtil.toJsonStr(paymentTwoDto));
+        paymentServerInterface.sendMKT006_NoCommission(paymentTwoDto);
+        tbOrders.setIsPay(3);
+        tbOrders.setDeductionCount(tbOrders.getDeductionCount() + 1);
+        tbOrders.setDeductionTime(new Date());
+
+        return super.updateById(tbOrders);
+    }
+
+    /**
+     * 查 - 交易凭证
+     */
+    public TbOrdersPrintVo getSubPrint(Long id) {
+        TbOrdersPrintVo vo = new TbOrdersPrintVo();
+
+        TbOrders tbOrders = super.getById(id);
+        BeanUtils.copyProperties(tbOrders, vo);
+
+        List<BankInfoDto> bankInfoList = paymentServerInterface.getListBySource(tbOrders.getOrderNo());
+        if (bankInfoList.size() > 0) vo.setResult(bankInfoList.get(0).getResult());
+
+        PeopleDto people = levelOneServerInterface.getRpcById(tbOrders.getLeaderId());
+        if (people != null) {
+            vo.setIdCard(people.getIdCard());
+            vo.setGroupName(people.getGroupName());
+        }
+
+        return vo;
+    }
+
+    /**
+     * 查 - 电子协议
+     */
+    public TbOrdersEmailVo getSubEmail(Long id) {
+        TbOrdersEmailVo vo = new TbOrdersEmailVo();
+
+        TbOrders tbOrders = super.getById(id);
+        BeanUtils.copyProperties(tbOrders, vo);
+
+        OrderDto orderOne = levelOneServerInterface.getOrderDtoById(tbOrders.getLevelOneOrderId());
+        if (orderOne != null) {
+            vo.setSettleBillNo(orderOne.getSettleBillNo());
+        }
+
+        List<BankInfoDto> bankInfoList = paymentServerInterface.getListBySource(tbOrders.getOrderNo());
+        if (bankInfoList.size() > 0) {
+            vo.setResult(bankInfoList.get(0).getResult());
+        }
+
+        PeopleDto people = levelOneServerInterface.getRpcById(tbOrders.getLeaderId());
+        if (people != null) {
+            vo.setIdCard(people.getIdCard());
+            vo.setGroupName(people.getGroupName());
+        }
+
+        PeopleTaxAccountDto peopleTaxAccount = levelOneServerInterface.getTaxAccountByPeopleId(tbOrders.getLeaderId());
+        if (peopleTaxAccount != null) {
+            vo.setBusinessName(peopleTaxAccount.getBusinessName());
+            vo.setContacts(peopleTaxAccount.getContacts());
+            vo.setPhone(peopleTaxAccount.getPhone());
+            vo.setPeopleBankName(peopleTaxAccount.getBankName());
+            vo.setPeopleBankCode(peopleTaxAccount.getBankCode());
+            vo.setPeopleDutyParagraph(peopleTaxAccount.getDutyParagraph());
+        }
+
+        TbPurchaser purchaser = tbPurchaserMapper.selectById(tbOrders.getPurchaserId());
+        if (purchaser != null) {
+            vo.setPurchaserBusinessName(purchaser.getBusinessName());
+            vo.setLegalPerson(purchaser.getLegalPerson());
+            vo.setPurchaserContact(purchaser.getContact());
+            vo.setPurchaserBankName(purchaser.getBankName());
+            vo.setPurchaserBankAccount(purchaser.getBankAccount());
+            vo.setPurchaserDutyParagraph(purchaser.getDutyParagraph());
+        }
+
+        return vo;
+    }
+
+    public boolean removeOnSaleOrderByLevelOneOrderId(Long levelOneOrderId) {
+        LambdaQueryWrapper<TbOrders> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(TbOrders::getLevelOneOrderId, levelOneOrderId)
+                .eq(TbOrders::getOrderFinish, OrderStatus.ORDER_STATUS_ZERO.getCode()).eq(TbOrders::getIsPay, 0);
+
+        return tbOrdersMapper.delete(wrapper) == 1;
+    }
+
+    public boolean removeOnSaleOrderByLevelOneOrderIds(String levelOneOrderIds) {
+        List<Long> ids = StrUtil.split(levelOneOrderIds, ",").stream().map(Long::valueOf).collect(Collectors.toList());
+        LambdaQueryWrapper<TbOrders> wrapper = new LambdaQueryWrapper<>();
+        wrapper.in(TbOrders::getLevelOneOrderId, ids)
+                .eq(TbOrders::getOrderFinish, OrderStatus.ORDER_STATUS_ZERO.getCode())
+                .eq(TbOrders::getIsPay, 0);
+
+        return tbOrdersMapper.delete(wrapper) == ids.size();
+    }
 }

+ 443 - 0
sp-service/level-two-server/src/main/java/com/pj/tb_orders/vo/TbOrdersEmailVo.java

@@ -0,0 +1,443 @@
+package com.pj.tb_orders.vo;
+
+import com.pj.common.core.annotation.Excel;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+
+@Data
+@Accessors(chain = true)
+public class TbOrdersEmailVo implements Serializable {
+
+	private Long id;
+
+	/**
+	 * 一级市场订单ID
+	 */
+	private Long levelOneOrderId;
+
+	/**
+	 * 订单编号
+	 */
+	private String orderNo;
+
+	/**
+	 * 商品id
+	 */
+	private Long goodsId;
+
+	/**
+	 * 商品名称
+	 */
+	private String goodsName;
+
+	/**
+	 * 商品来源(国家)
+	 */
+	private String goodsFrom;
+
+	/**
+	 * 发货商电话
+	 */
+	private String shipperPhone;
+
+	/**
+	 * 发货商名称
+	 */
+	private String shipperName;
+
+	/**
+	 * 司机ID
+	 */
+	private Long driverId;
+
+	/**
+	 * 司机名称
+	 */
+	private String driverName;
+
+	/**
+	 * 司机电话
+	 */
+	private String driverPhone;
+
+	/**
+	 * 车型ID
+	 */
+	private Long carId;
+
+	/**
+	 * 车牌号
+	 */
+	private String veNo;
+
+	/**
+	 * 收货人名称
+	 */
+	private String consigneeName;
+
+	/**
+	 * 收货人电话号码
+	 */
+	private String consigneePhone;
+
+	/**
+	 * (预留字段) 申报订单号
+	 */
+	private String declarationNumber;
+
+	/**
+	 * 订单完成状态 (0=未完成,1=已完成)
+	 */
+	private Integer orderFinish;
+
+	/**
+	 * 装货地址
+	 */
+	private String loadingAddress;
+
+	/**
+	 * 卸货地址
+	 */
+	private String unloadingAddress;
+
+	/**
+	 * 备注
+	 */
+	private String comment;
+
+	/**
+	 * 更新时间
+	 */
+	private Date updateTime;
+
+
+	/**
+	 * 更新人编号
+	 */
+	private Long updateBy;
+	/**
+	 * 更新人名称
+	 */
+	private String updateName;
+
+	/**
+	 * 删除状态(0=禁用,1=启用)
+	 */
+	private Integer deleteStatus;
+
+	/**
+	 * 创建时间
+	 */
+	private Date createTime;
+
+	/**
+	 * 创建人编号
+	 */
+	private Long createBy;
+
+	/**
+	 * 创建人名称
+	 */
+	private String createName;
+
+	/**
+	 * 贸易区域id
+	 */
+	private Long tradeAreaId;
+
+	/**
+	 * 贸易区域名称
+	 */
+	private String tradeAreaName;
+
+	/**
+	 * 买家ID
+	 */
+	private Long purchaserId;
+
+	/**
+	 * 买家名称
+	 */
+	private String purchaserName;
+
+	/**
+	 * 边民Id
+	 */
+	private Long leaderId;
+	/**
+	 * 边民姓名
+	 */
+	private String leaderName;
+	/**
+	 * 边民手机号
+	 */
+	private String leaderPhone;
+
+	/**
+	 * 二级收购商需求发布表的主键id
+	 */
+	private Long fkGoodsDemandId;
+
+	/**
+	 * 是否收货[0=未收货,1=已收货]
+	 */
+	private Integer isDelivery;
+
+	/**
+	 * 转售金额
+	 */
+	private Double resalePrice;
+
+	/**
+	 * 是否支付(0=未支付,1=支付成功,2=支付失败,3=支付中)
+	 */
+	private Integer isPay;
+
+	/**
+	 * 支付/回执时间
+	 */
+	private Date payTime;
+
+	/**
+	 * 是否缴税缴费(0=未缴费,1=缴费成功,2=缴费失败,3=缴费中)
+	 */
+	private Integer payTax;
+
+	/**
+	 * 缴税缴费/回执时间
+	 */
+	private Date payTaxTime;
+
+	private String bankName;
+	private String bankAccount;
+	private String goodsUnit;
+	private String netWet;
+	private String totalWeight;
+	private String singlePrice;
+
+	/**
+	 * (二级市场)采购商补扣款次数
+	 */
+	private Integer deductionCount;
+	/**
+	 * (二级市场)采购商最近一次补扣款时间
+	 */
+	private Date deductionTime;
+
+	/**
+	 * 申报数量
+	 */
+	private Double buyQty;
+
+	/**
+	 * 第一数量
+	 */
+	private Double buyQty1;
+
+	/**
+	 * 第二数量
+	 */
+	private Double buyQty2;
+
+
+	/**----------- 银行回执字段 begin----------**/
+	/**
+	 * 报文编号
+	 */
+	private String sn;
+	/**
+	 * 报文发送时间
+	 */
+	private String date;
+	/**
+	 * 互市点机构代码
+	 */
+	private String organization;
+	/**
+	 * 银行标识
+	 */
+	private String bankCode;
+	/**
+	 * 报文业务类型
+	 */
+	private String operation;
+	/**
+	 * 消息回执代码:200/202/401/402/403/404/405
+	 */
+	private String code;
+	/**
+	 * 订单号
+	 */
+	private String source;
+	/**
+	 * 扣款成功的流水单号
+	 */
+	private String result;
+	/**
+	 * 回执内容
+	 */
+	private String note;
+	/**
+	 * 订单回执类型	001:扣款订单    002:退款订单    003:打款订单(根据字典表ORDER_TYPE)
+	 */
+	private String type;
+	/**----------- 银行回执字段 end----------**/
+
+
+
+
+	/**----------- 边民表字段 begin----------**/
+	private String idCard;
+	private String groupName;
+	/**----------- 边民表字段 end----------**/
+
+
+
+
+	/**----------- 一级市场订单表字段 begin----------**/
+	/**
+	 * 结算单号
+	 */
+	private String settleBillNo;
+	/**----------- 一级市场订单表字段 end----------**/
+
+
+
+
+	/**----------- 边民-税务开户信息字段 begin----------**/
+	/**
+	 * 个体户名称
+	 */
+	private String businessName;
+
+	/**
+	 * 社会统一信用代码
+	 */
+	private String peopleDutyParagraph;
+
+	/**
+	 * 经营者(边民)
+	 */
+	private String name;
+
+	/**
+	 * 地址
+	 */
+	private String address;
+
+	/**
+	 * 组成形式
+	 */
+	private String form;
+
+	/**
+	 * 联系人
+	 */
+	private String contacts;
+
+	/**
+	 * 联系电话
+	 */
+	private String phone;
+
+	/**
+	 * 经营场所
+	 */
+	private String businessAddress;
+
+	/**
+	 * 经营范围
+	 */
+	private String businessScope;
+
+	/**
+	 * 经营状态
+	 */
+	private String businessStatus;
+
+	/**
+	 * 开户行
+	 */
+	private String peopleBankName;
+
+	/**
+	 * 银行账号
+	 */
+	private String peopleBankCode;
+
+	/**
+	 * 开票商
+	 */
+	private String invoiceBusiness;
+
+	/**
+	 * 开票人
+	 */
+	private String invoicePeople;
+
+	/**
+	 * 收款人
+	 */
+	private String payee;
+
+	/**
+	 * 复核人
+	 */
+	private String checker;
+	/**----------- 边民-税务开户信息字段 begin----------**/
+
+
+
+	/**----------- 收购商-税务开户信息字段 begin----------**/
+	/**
+	 * 姓名
+	 */
+	//private String name;
+
+	/**
+	 * 法人
+	 */
+	private String legalPerson;
+	/**
+	 * 身份证号
+	 */
+	private String purchaserIdCard;
+	/**
+	 * 手机号码
+	 */
+	private String purchaserContact;
+	/**
+	 * 营业执照
+	 */
+	private String businessLicense;
+	/**
+	 * 银行编号
+	 */
+	private String purchaserBankNo;
+	/**
+	 * 银行名称
+	 */
+	private String purchaserBankName;
+	/**
+	 * 银行账号
+	 */
+	private String purchaserBankAccount;
+	/**
+	 * 统一社会信用代码
+	 */
+	private String purchaserDutyParagraph;
+	/**
+	 * 企业名称
+	 */
+	private String purchaserBusinessName;
+	/**
+	 * 邮箱
+	 */
+	private String email;
+	/**----------- 收购商-税务开户信息字段 begin----------**/
+
+}

+ 296 - 0
sp-service/level-two-server/src/main/java/com/pj/tb_orders/vo/TbOrdersPrintVo.java

@@ -0,0 +1,296 @@
+package com.pj.tb_orders.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+
+@Data
+@Accessors(chain = true)
+public class TbOrdersPrintVo implements Serializable {
+
+	private Long id;
+
+	/**
+	 * 一级市场订单ID
+	 */
+	private Long levelOneOrderId;
+
+	/**
+	 * 订单编号
+	 */
+	private String orderNo;
+
+	/**
+	 * 商品id
+	 */
+	private Long goodsId;
+
+	/**
+	 * 商品名称
+	 */
+	private String goodsName;
+
+	/**
+	 * 商品来源(国家)
+	 */
+	private String goodsFrom;
+
+	/**
+	 * 发货商电话
+	 */
+	private String shipperPhone;
+
+	/**
+	 * 发货商名称
+	 */
+	private String shipperName;
+
+	/**
+	 * 司机ID
+	 */
+	private Long driverId;
+
+	/**
+	 * 司机名称
+	 */
+	private String driverName;
+
+	/**
+	 * 司机电话
+	 */
+	private String driverPhone;
+
+	/**
+	 * 车型ID
+	 */
+	private Long carId;
+
+	/**
+	 * 车牌号
+	 */
+	private String veNo;
+
+	/**
+	 * 收货人名称
+	 */
+	private String consigneeName;
+
+	/**
+	 * 收货人电话号码
+	 */
+	private String consigneePhone;
+
+	/**
+	 * (预留字段) 申报订单号
+	 */
+	private String declarationNumber;
+
+	/**
+	 * 订单完成状态 (0=未完成,1=已完成)
+	 */
+	private Integer orderFinish;
+
+	/**
+	 * 装货地址
+	 */
+	private String loadingAddress;
+
+	/**
+	 * 卸货地址
+	 */
+	private String unloadingAddress;
+
+	/**
+	 * 备注
+	 */
+	private String comment;
+
+	/**
+	 * 更新时间
+	 */
+	private Date updateTime;
+
+
+	/**
+	 * 更新人编号
+	 */
+	private Long updateBy;
+	/**
+	 * 更新人名称
+	 */
+	private String updateName;
+
+	/**
+	 * 删除状态(0=禁用,1=启用)
+	 */
+	private Integer deleteStatus;
+
+	/**
+	 * 创建时间
+	 */
+	private Date createTime;
+
+	/**
+	 * 创建人编号
+	 */
+	private Long createBy;
+
+	/**
+	 * 创建人名称
+	 */
+	private String createName;
+
+	/**
+	 * 贸易区域id
+	 */
+	private Long tradeAreaId;
+
+	/**
+	 * 贸易区域名称
+	 */
+	private String tradeAreaName;
+
+	/**
+	 * 买家ID
+	 */
+	private Long purchaserId;
+
+	/**
+	 * 买家名称
+	 */
+	private String purchaserName;
+
+	/**
+	 * 边民Id
+	 */
+	private Long leaderId;
+	/**
+	 * 边民姓名
+	 */
+	private String leaderName;
+	/**
+	 * 边民手机号
+	 */
+	private String leaderPhone;
+
+	/**
+	 * 二级收购商需求发布表的主键id
+	 */
+	private Long fkGoodsDemandId;
+
+	/**
+	 * 是否收货[0=未收货,1=已收货]
+	 */
+	private Integer isDelivery;
+
+	/**
+	 * 转售金额
+	 */
+	private Double resalePrice;
+
+	/**
+	 * 是否支付(0=未支付,1=支付成功,2=支付失败,3=支付中)
+	 */
+	private Integer isPay;
+
+	/**
+	 * 支付/回执时间
+	 */
+	private Date payTime;
+
+	/**
+	 * 是否缴税缴费(0=未缴费,1=缴费成功,2=缴费失败,3=缴费中)
+	 */
+	private Integer payTax;
+
+	/**
+	 * 缴税缴费/回执时间
+	 */
+	private Date payTaxTime;
+
+	private String bankName;
+	private String bankAccount;
+	private String goodsUnit;
+	private String netWet;
+	private String totalWeight;
+	private String singlePrice;
+
+	/**
+	 * (二级市场)采购商补扣款次数
+	 */
+	private Integer deductionCount;
+	/**
+	 * (二级市场)采购商最近一次补扣款时间
+	 */
+	private Date deductionTime;
+
+	/**
+	 * 申报数量
+	 */
+	private Double buyQty;
+
+	/**
+	 * 第一数量
+	 */
+	private Double buyQty1;
+
+	/**
+	 * 第二数量
+	 */
+	private Double buyQty2;
+
+
+	/**----------- 银行回执字段 ----------**/
+	/**
+	 * 报文编号
+	 */
+	private String sn;
+	/**
+	 * 报文发送时间
+	 */
+	private String date;
+	/**
+	 * 互市点机构代码
+	 */
+	private String organization;
+	/**
+	 * 银行标识
+	 */
+	private String bankCode;
+	/**
+	 * 报文业务类型
+	 */
+	private String operation;
+	/**
+	 * 消息回执代码:200/202/401/402/403/404/405
+	 */
+	private String code;
+	/**
+	 * 订单号
+	 */
+	private String source;
+	/**
+	 * 扣款成功的流水单号
+	 */
+	private String result;
+	/**
+	 * 回执内容
+	 */
+	private String note;
+	/**
+	 * 订单回执类型	001:扣款订单    002:退款订单    003:打款订单(根据字典表ORDER_TYPE)
+	 */
+	private String type;
+
+
+	private String idCard;
+	private String groupName;
+}

+ 0 - 54
sp-service/level-two-server/src/main/java/com/pj/tb_purchaser/MethodPurchaserService.java

@@ -36,60 +36,6 @@ public class MethodPurchaserService {
     private TbPurchaserService tbPurchaserService;
 
 
-    public TbPurchaser setPurchaserProperties(PurchaserParam purchaser) throws ParseException {
-        //开始保存收购商信息
-        //注册/认证时间
-        TbPurchaser tbPurchaser = new TbPurchaser();
-        //设置名称
-        tbPurchaser.setName(purchaser.getName());
-        //审核状态
-        tbPurchaser.setJudgeStatus(JudgeStatus.JUDGE_STATUS_ZERO.getCode()); // 待审核
-        //默认未被锁
-        tbPurchaser.setIsLock(IsLock.IS_LOCK_ON.getCode());
-        //注册时间
-        tbPurchaser.setRegisterTime(new Date());
-        //创建时间
-        tbPurchaser.setCreateTime(new Date());
-        //创建人
-        tbPurchaser.setCreateBy(String.valueOf(purchaser.getLoginUserId()));
-        //删除状态:启用
-        tbPurchaser.setDeleteStatus(DeleteStatus.DELETE_STATUS_ON.getCode());
-        //地址
-        tbPurchaser.setAddress(purchaser.getAddress());
-        //计算年龄
-        // 获取当前日期
-        Calendar calendar = Calendar.getInstance();
-        int currentYear = calendar.get(Calendar.YEAR);
-        // 提取身份证号中的出生日期
-        String idNumber = purchaser.getCorporateIdCard();
-        String birthDateStr = idNumber.substring(6, 14);
-        // 将出生日期字符串转换为Date类型
-        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
-        Date birthDate = dateFormat.parse(birthDateStr);
-        // 计算年龄
-        calendar.setTime(birthDate);
-        int birthYear = calendar.get(Calendar.YEAR);
-        int age = currentYear - birthYear;
-        tbPurchaser.setAge(age);
-        //法人
-        tbPurchaser.setLegalPerson(purchaser.getCorporateName());
-        //身份证
-        tbPurchaser.setIdCard(purchaser.getCorporateIdCard());
-        //手机号
-        tbPurchaser.setContact(purchaser.getLinkPhone());
-        //营业执照
-        tbPurchaser.setBusinessLicense(purchaser.getBusinessLicense());
-        //银行编号
-        tbPurchaser.setBankNo(purchaser.getBankNo());
-        //银行账户
-        tbPurchaser.setBankAccount(purchaser.getBankAccount());
-        //银行名称
-        tbPurchaser.setBankName(purchaser.getBankName());
-        //审核状态,默认待审核
-        tbPurchaser.setJudgeStatus(JudgeStatus.JUDGE_STATUS_ZERO.getCode());
-        tbPurchaser.setDutyParagraph(purchaser.getDutyParagraph());
-        return tbPurchaser;
-    }
 
     /**
      * 认证时封装收购商信息

+ 6 - 2
sp-service/level-two-server/src/main/java/com/pj/tb_purchaser/TbPurchaserAppController.java

@@ -53,8 +53,12 @@ public class TbPurchaserAppController {
      * 收购商认证
      */
     @RequestMapping("identification")
-    public AjaxJson identification(@RequestBody @Validated PurchaserParam purchaser) throws ParseException {
-        boolean identification = tbPurchaserService.identification(purchaser);
+    public AjaxJson identification( @Validated PurchaserParam purchaser) throws ParseException {
+        if (!StpAPPUserUtil.isLogin()) {
+            return AjaxJson.getError("用户未登录!!!");
+        }
+        APPLoginUserInfo appLoginInfo=StpAPPUserUtil.getAPPLoginInfo();
+        boolean identification = tbPurchaserService.identification(purchaser,appLoginInfo.getLoginId(),appLoginInfo.getFk());
         if (!identification) return AjaxJson.getError("收购商认证信息提交失败!!!");
 
         return AjaxJson.getSuccess("收购商认证信息已提交,管理员审核中,请耐心等待!");

+ 29 - 24
sp-service/level-two-server/src/main/java/com/pj/tb_purchaser/TbPurchaserService.java

@@ -66,6 +66,11 @@ public class TbPurchaserService extends ServiceImpl<TbPurchaserMapper, TbPurchas
      * 增
      */
     void add(TbPurchaser t) {
+        AppUserDto appUser = FeignFactory.adminInterface.findUserByPhone(t.getContact());
+        if (appUser != null) {
+            throw new ServiceException("新增失败,当前用户的手机号已存在app账户!");
+        }
+
         t.setCreateTime(new Date());
         save(t);
         AppUserCreateDTO createDTO = new AppUserCreateDTO();
@@ -73,6 +78,7 @@ public class TbPurchaserService extends ServiceImpl<TbPurchaserMapper, TbPurchas
         createDTO.setPhone(t.getContact());
         createDTO.setName(t.getName());
         createDTO.setFkId(t.getId());
+
         boolean result = FeignFactory.adminInterface.createAccount(createDTO);
         if (!result) {
             throw new ServiceException("创建账户失败");
@@ -111,30 +117,30 @@ public class TbPurchaserService extends ServiceImpl<TbPurchaserMapper, TbPurchas
     /**
      * 收购商认证
      */
-    boolean identification(PurchaserParam purchaser) throws ParseException {
-        if (null == purchaser) return false;
-        //验证之前是否有被拒的
-        List<TbPurchaser> tbPurchasers = tbPurchaserMapper.selectList(new LambdaQueryWrapper<TbPurchaser>().eq(TbPurchaser::getCreateBy, purchaser.getLoginUserId()));
-        if (tbPurchasers.size() > 0) {
-            tbPurchasers.forEach(item -> {
-                tbPurchaserMapper.deleteById(item.getId());
-            });
+    boolean identification(PurchaserParam purchaser, Long appUserId, Long fkId) throws ParseException {
+        TbPurchaser tbPurchaser = new TbPurchaser();
+        tbPurchaser.setCreateTime(new Date())
+        ;
+        if (fkId != null) {
+            tbPurchaser = getById(fkId);
+            tbPurchaser.setJudgeContent("再次提交审核");
+
+        }
+        tbPurchaser.setJudgeStatus(JudgeStatus.JUDGE_STATUS_ZERO.getCode())
+                .setJudgeTime(null)
+                .setName(purchaser.getName())
+                .setRegisterTime(new Date())
+                .setLegalPerson(purchaser.getLegalPerson())
+                .setContact(purchaser.getContact())
+                .setIdCard(purchaser.getIdCard()).setType(purchaser.getType())
+                .setBusinessLicense(purchaser.getBusinessLicense())
+                .setBankAccount(purchaser.getBankAccount());
+        boolean result = this.saveOrUpdate(tbPurchaser);
+        if (fkId == null) {
+            return FeignFactory.adminInterface.bindFkId(appUserId, tbPurchaser.getId());
         }
-        //身份证号去重
-        String idCard = purchaser.getCorporateIdCard();
-        if (tbPurchaserMapper.selectList(new LambdaQueryWrapper<TbPurchaser>().eq(TbPurchaser::getIdCard, idCard).eq(TbPurchaser::getDeleteStatus, DeleteStatus.DELETE_STATUS_ON.getCode())).size() != 0)
-            throw new RuntimeException("当前身份证号已被认证!");
-        //手机号去重
-        String contact = purchaser.getLinkPhone();
-        if (tbPurchaserMapper.selectList(new LambdaQueryWrapper<TbPurchaser>().eq(TbPurchaser::getContact, contact).eq(TbPurchaser::getDeleteStatus, DeleteStatus.DELETE_STATUS_ON.getCode())).size() != 0)
-            throw new RuntimeException("当前手机号已被认证!");
-        //TODO:是否需要手机发送验证码认证?
-
-        //封装收购商信息
-        TbPurchaser tbPurchaser = methodPurchaserService.setPurchaserProperties(purchaser);
-        // 保存收购商信息
-        int insert = tbPurchaserMapper.insert(tbPurchaser);
-        return insert == 1;
+        return result;
+
     }
 
     /**
@@ -164,7 +170,6 @@ public class TbPurchaserService extends ServiceImpl<TbPurchaserMapper, TbPurchas
                 adminInterface.messageSave(dto);
                 return updateById(tbPurchaser);
             }
-            throw new ServiceException("审核失败");
         }
         return updateById(tbPurchaser);
     }

+ 5 - 15
sp-service/level-two-server/src/main/java/com/pj/tb_purchaser/param/PurchaserParam.java

@@ -16,38 +16,28 @@ import javax.validation.constraints.NotNull;
 @NoArgsConstructor
 public class PurchaserParam {
 
-    @NotNull(message = "登录人ID")
-    private Long loginUserId;
 
     @NotNull(message = "公司名称")
     private String name;
 
-    @NotNull(message = "税号")
-    private String dutyParagraph;
+    private Integer type;
 
     @NotNull(message = "法人姓名")
-    private String corporateName;
+    private String legalPerson;
 
     @NotNull(message = "法人身份证")
-    private String corporateIdCard;
+    private String idCard;
 
     @NotNull(message = "联系号码")
-    private String linkPhone;
+    private String contact;
 
-    @NotNull(message = "银行编号")
-    private String bankNo;
-
-    @NotNull(message = "开户银行")
-    private String bankName;
 
     @NotNull(message = "银行账号")
     private String bankAccount;
 
-    @NotNull(message = "营业执照")
     private String businessLicense;
 
-    @NotNull(message = "地址")
-    private String address;
+
 
 
 

+ 125 - 0
sp-service/level-two-server/src/main/resources/logback.xml

@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+    <contextName>two</contextName>
+    <property name="LOG_PATH" value="logs"/>
+    <property name="APP_DIR" value="pco"/>
+    <property name="log.maxFileSize" value="10MB"/>
+    <property name="log.maxFileCnt" value="90"/>
+    <property name="log.totalSizeCap" value="10GB"/>
+
+    <appender name="FILE_DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${LOG_PATH}/${APP_DIR}/log_debug.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/debug/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <maxFileSize>${log.maxFileSize}</maxFileSize>
+            <maxHistory>${log.maxFileCnt}</maxHistory>
+            <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
+        </rollingPolicy>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS}|%-5level{10}[%25.25thread{24}]%-40.40logger{39}|-Line:%-3L:%msg%n
+            </pattern>
+            <charset>utf-8</charset>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>debug</level>
+            <onMatch>ACCEPT</onMatch>
+            <!--            <onMismatch>DENY</onMismatch>-->
+        </filter>
+    </appender>
+
+    <appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${LOG_PATH}/${APP_DIR}/log_info.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/info/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <maxFileSize>${log.maxFileSize}</maxFileSize>
+            <maxHistory>${log.maxFileCnt}</maxHistory>
+            <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
+        </rollingPolicy>
+        <append>true</append>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS}|%-5level{10}[%25.25thread{24}]%-40.40logger{39}|-Line:%-3L:%msg%n
+            </pattern>
+            <charset>UTF-8</charset>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>info</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <!--encoder 默认配置为PatternLayoutEncoder-->
+        <encoder>
+            <pattern>%d{yyyy-MM-dd
+                HH:mm:ss.SSS}|%highlight(%-5level{10})[%boldYellow(%25.25thread{24})]%gray(%-50.50logger{49})|-Line:%boldYellow(%-3L):%msg%n
+            </pattern>
+            <charset>UTF-8</charset>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+            <level>info</level>
+        </filter>
+    </appender>
+
+    <appender name="COMM_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${LOG_PATH}/${APP_DIR}/comm_info.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/comm/comm_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <maxFileSize>${log.maxFileSize}</maxFileSize>
+            <maxHistory>${log.maxFileCnt}</maxHistory>
+            <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
+        </rollingPolicy>
+        <append>true</append>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <pattern>%msg%n</pattern>
+            <charset>UTF-8</charset>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>info</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+    <logger name="com.cryann.hsms.driver.netty" additivity="false">
+        <appender-ref ref="COMM_LOG"/>
+    </logger>
+
+    <appender name="SXFX_info_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${LOG_PATH}/${APP_DIR}/SxFx_info.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/SxFx/SxFx_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <maxFileSize>${log.maxFileSize}</maxFileSize>
+            <maxHistory>${log.maxFileCnt}</maxHistory>
+            <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
+        </rollingPolicy>
+        <append>true</append>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <pattern>%d{yyyy-MM-dd
+                HH:mm:ss.SSS}|%highlight(%-5level{10})[%boldYellow(%25.25thread{24})]%gray(%-50.50logger{49})|-Line:%boldYellow(%-3L):%msg%n
+            </pattern>
+            <charset>UTF-8</charset>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>info</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+
+    <logger name="org.springframework" level="WARN"/>
+    <logger name="org.hibernate" level="WARN"/>
+    <logger name="com.apache.ibatis" level="TRACE"/>
+    <logger name="java.sql.Connection" level="DEBUG"/>
+    <logger name="java.sql.Statement" level="DEBUG"/>
+    <logger name="java.sql.PreparedStatement" level="DEBUG"/>
+
+    <!-- 生产环境下,将此级别配置为适合的级别,以免日志文件太多或影响程序性能 -->
+    <root level="INFO">
+        <!-- 生产环境将请stdout,testfile去掉 -->
+        <appender-ref ref="STDOUT"/>
+        <appender-ref ref="FILE_DEBUG"/>
+        <!--<appender-ref ref="FILEWARN"/>-->
+        <appender-ref ref="FILE_INFO"/>
+    </root>
+</configuration>

+ 15 - 22
sp-service/payment-server/src/main/java/com/pj/bank_info/BankInfoController.java

@@ -1,23 +1,19 @@
 package com.pj.bank_info;
 
+import java.util.ArrayList;
 import java.util.List;
 
-import cn.hutool.crypto.digest.HMac;
-import cn.hutool.crypto.digest.HmacAlgorithm;
-import cn.hutool.log.StaticLog;
-import com.pj.rabbitmq.MessageSender;
+import com.pj.api.dto.BankInfoDto;
 import com.pj.utils.so.SoMap;
+import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
 import com.pj.utils.sg.*;
 import com.pj.project4sp.SP;
 
-import com.pj.current.satoken.StpUserUtil;
 import cn.dev33.satoken.annotation.SaCheckPermission;
 
-import javax.annotation.Resource;
 
 
 /**
@@ -76,27 +72,24 @@ public class BankInfoController {
 
 	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */
 	@RequestMapping("getList")
-		@SaCheckPermission(BankInfo.PERMISSION_CODE)
 	public AjaxJson getList() {
 		SoMap so = SoMap.getRequestSoMap();
 		List<BankInfo> list = bankInfoService.getList(so.startPage());
 		return AjaxJson.getPageData(so.getDataCount(), list);
 	}
 
-
-	@Resource
-	private MessageSender messageSender;
-	@PostMapping("test")
-	public String test(@RequestBody String str){
-		StaticLog.info("info:{}",str);
-		messageSender.sendToLevelOneMQ(str);
-		byte[] key = "90003".getBytes();
-		HMac mac = new HMac(HmacAlgorithm.HmacSHA256, key);
-		System.out.println(mac.digestBase64("sw10002",false));
-		return "hello";
+	@PostMapping("rpc/getListBySource")
+	public List<BankInfoDto> getListBySource(@RequestParam("source") String source) {
+		SoMap so = new SoMap();
+		so.put("source", source);
+		List<BankInfo> list = bankInfoService.getList(so);
+		List<BankInfoDto> dtoList = new ArrayList<>();
+		list.forEach(item -> {
+			BankInfoDto dto = new BankInfoDto();
+			BeanUtils.copyProperties(item, dto);
+			dtoList.add(dto);
+		});
+		return dtoList;
 	}
 
-
-
-
 }

+ 15 - 15
sp-service/payment-server/src/main/java/com/pj/bank_info/BankInfoMapper.xml

@@ -7,17 +7,17 @@
 
 	<!-- ================================== 查询相关 ================================== -->
 	<!-- select id, sn, date, organization, bankCode, operation, code, source, result, note, create_time from bank_info  -->
-	
+
 	<!-- 通用映射:自动模式 -->
 	<resultMap id="model" autoMapping="true" type="com.pj.bank_info.BankInfo"></resultMap>
-	
+
 	<!-- 公共查询sql片段 -->
 	<sql id="select_sql">
-		select * 
-		from bank_info 
+		select *
+		from bank_info
 	</sql>
 
-	
+
 	<!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
 	<select id="getList" resultMap="model">
 		<include refid="select_sql"></include>
@@ -47,17 +47,17 @@
 			<when test='sortType == 9'> result desc </when>
 			<when test='sortType == 10'> note desc </when>
 			<when test='sortType == 11'> create_time desc </when>
-			<otherwise> id desc </otherwise>
+			<otherwise> create_time desc </otherwise>
 		</choose>
 	</select>
-	
-	
-	
-	
-	
-	
-	
-	
-	
+
+
+
+
+
+
+
+
+
 
 </mapper>

+ 6 - 3
sp-service/payment-server/src/main/java/com/pj/task/BankByteTask.java

@@ -1,5 +1,6 @@
 package com.pj.task;
 
+import cn.hutool.log.StaticLog;
 import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
@@ -81,17 +82,19 @@ public class BankByteTask {
      */
     @Scheduled(cron = "*/10 * * * * ?")  // 每10秒扫描一次
     public void bankByteTask() throws ParserConfigurationException {
+        StaticLog.info("\n  ----------------银行数据处理定时任务开始----------------------");
 
         //扫描表内是否有待处理任务
         List<BankByte> byteList = bankByteMapper.selectList(
                 new LambdaQueryWrapper<BankByte>().eq(BankByte::getFinishStatus, FinishStatus.FINISH_STATUS_ZERO.getCode()).orderByAsc(BankByte::getCreateTime));
         //判断是否有任务,没有则返回
         if (byteList.size() == 0) {
-            System.err.println("\n  ---  暂无待处理【银行回执信息】。" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "\n");
+            StaticLog.info("\n  ---  暂无待处理【银行回执信息】。" + new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "\n");
             return;
         }
         //执行任务处理流程
         for (BankByte item : byteList) {
+            StaticLog.info("\n  ----------------执行任务处理流程----------------------\n" + item.toString());
             // 创建DOM解析器
             DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
             DocumentBuilder builder = factory.newDocumentBuilder();
@@ -320,11 +323,11 @@ public class BankByteTask {
             //(一级市场)订单扣款-成功
             else if(bankInfo.getOperation().equalsIgnoreCase("SXB011")) {
                 //参数:一级市场边民订单-订单编号
-                result = levelOneServerInterface.confirmOrderFromBank(bankInfo.getSource(),1);
+                result = levelOneServerInterface.confirmOrderFromBank(bankInfo.getSource(),bankInfo.getNote(),1);
             }
             //(一级市场)订单扣款-失败
             else if(bankInfo.getOperation().equalsIgnoreCase("SXB012")) {
-                result = levelOneServerInterface.confirmOrderFromBank(bankInfo.getSource(),2);
+                result = levelOneServerInterface.confirmOrderFromBank(bankInfo.getSource(),bankInfo.getNote(),2);
             }
             //(一级市场)订单退款-成功
             else if(bankInfo.getOperation().equalsIgnoreCase("SXB014")) {

+ 1 - 1
sp-service/payment-server/src/main/java/com/pj/task/PaymentService.java

@@ -83,7 +83,7 @@ public class PaymentService {
         paymentDto.setOrderNo("EJSCDD2408261611120098");
         paymentDto.setResalePrice(BigDecimal.valueOf(8450.05));
         paymentDto.setPcName("云南跨境贸易公司");
-        paymentDto.setBusinessLicense("12312312-3");
+        paymentDto.setDutyParagraph("12312312-3");
         paymentDto.setPcBankAccount("0100028613124012");
         paymentDto.setPcContact("15195882701");
 

+ 7 - 0
sp-service/payment-server/src/main/java/com/pj/utils/CryptoUtil.java

@@ -76,4 +76,11 @@ public class CryptoUtil {
         logger.debug("解密出来的 明文:{}", new String(plainBytesDecrypted, StandardCharsets.UTF_8));
         return new String(plainBytesDecrypted, StandardCharsets.UTF_8);
     }
+
+
+    public static void main(String[] args) {
+        String srt="10647709f1b40467917932891d4360bb4759d7b45a931e416fdefc176ece24b941ddd67999dde1e03377cf8ab903abe8cda5e57d8d0f82892a0717fb14faa0fd3604ba07c632ff8c70a9cdf821ff82732122cf2dba8b3e6587cab29ac8fbbe80616fa56a6ce27c92b075ed970523842f12455e488452a82bd15a3693d5643554ec9609459d2ea0ab97145630795b0f333e66d8ae8cb564d57c6272e370fa96de6ef24b01c22063b3f2b60358b14353d363c5e5b77db5f57b20823afedd23a7bbcfaa76e56f730f91c6882d29f3d3a5301b87af39d16712dbf8dcac0aa03d74a485ab22978a6b39ab75bb825a2b3965ff927ff8f82bc9f465c9592f74bd0c14f92e";
+        System.out.println(decrypt(srt));
+
+    }
 }

+ 192 - 97
sp-service/payment-server/src/main/java/com/pj/xml/MessageXML.java

@@ -1,6 +1,7 @@
 package com.pj.xml;
 
 
+import cn.hutool.log.StaticLog;
 import com.pj.api.dto.CompanyDto;
 import com.pj.api.dto.PaymentDto;
 import com.pj.api.dto.PaymentTwoDto;
@@ -8,9 +9,11 @@ import com.pj.bank_info.BankInfo;
 import com.pj.utils.CryptoUtil;
 
 import java.text.SimpleDateFormat;
+import java.util.Arrays;
 import java.util.Date;
 import java.util.List;
 import java.util.UUID;
+import java.util.stream.Collectors;
 
 public class MessageXML {
     static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss sss");
@@ -19,6 +22,7 @@ public class MessageXML {
      * 结关报文:海关数据中心--->银行
      */
     public static String CXB001(PaymentDto paymentDto) {
+        paymentDto.setFieldCode("861501");
         String date = sdf.format(new Date());
         String payload =
                 "<payload xsi:type=\"responseDTO\">\n" +
@@ -28,7 +32,7 @@ public class MessageXML {
                         "<date>" + paymentDto.getDeclTime() + "</date>\n" +    //结关时间	YYYY-MM—DD HH:MM:DD SSS
                 "</payload>";
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" +
-                "<message title=\"边民互市\" xsi:schemaLocation=\"\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n" +
+                "<message title=\"一级市场\" xsi:schemaLocation=\"\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n" +
                 "<headers>\n" +
                 "        <item>\n" +
                 "               <key>sn</key>\n" +
@@ -51,10 +55,12 @@ public class MessageXML {
                 "              <value>CXB001</value>\n" +
                 "       </item>\n" +
                 "</headers>\n" +
-                "<plain>" +
-                CryptoUtil.encrypt(payload)+
-                "</plain>" +
+                payload +
+                //"<plain>" +
+                //CryptoUtil.encrypt(payload)+
+                //"</plain>" +
                 "</message>";
+        StaticLog.info("\n --------发送报文--------CXB001--------" + "\n payload=" + payload +"\n xml=" + xml);
         return xml;
     }
 
@@ -65,13 +71,13 @@ public class MessageXML {
         String date = sdf.format(new Date());
         String payload =" <payload xsi:type=\"responseDTO\">" +
                         "         <code>200</code>\n" +                                 //消息回执代码
-                        "         <source>" + bankInfo.getSn() + "</source>\n" +    //源报文编号
+                        "         <source>" + bankInfo.getSn() + "</source>\n" +        //源报文编号
                         "         <note>边民已备案</note>\n" +                           //回执内容
                         "<results xsi:type=\"vendeeDTO\">\n" +
-                        "         <name>" + bankInfo.getName() + "</name>\n" +                       //边民姓名
-                        "         <papersType>" + bankInfo.getPapersType() + "</papersType>\n" +       //证件类型  0001 身份证
-                        "         <papersNo>" + bankInfo.getPapersNo() + "</papersNo>\n" +             //边民证件号
-                        "         <nationality>" + bankInfo.getNationality() + "</nationality>\n" +  //国籍
+                        "         <name>" + bankInfo.getName() + "</name>\n" +                          //边民姓名
+                        "         <papersType>" + bankInfo.getPapersType() + "</papersType>\n" +        //证件类型  0001 身份证
+                        "         <papersNo>" + bankInfo.getPapersNo() + "</papersNo>\n" +              //边民证件号
+                        "         <nationality>" + bankInfo.getNationality() + "</nationality>\n" +     //国籍
                         "</results>\n" +
                         "</payload>";
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" +
@@ -102,6 +108,7 @@ public class MessageXML {
                 CryptoUtil.encrypt(payload)+
                 "</plain>" +
                 "</message>";
+        StaticLog.info("\n --------发送报文--------SXB003--------" + "\n payload=" + payload +"\n xml=" + xml);
         return xml;
     }
 
@@ -112,7 +119,7 @@ public class MessageXML {
         String date = sdf.format(new Date());
         String payload =" <payload xsi:type=\"responseDTO\">" +
                 "         <code>500</code>\n" +                                 //消息回执代码
-                "         <source>" + bankInfo.getSn() + "</source>\n" +    //源报文编号
+                "         <source>" + bankInfo.getSn() + "</source>\n" +        //源报文编号
                 "         <note>边民未备案</note>\n" +                           //回执内容
                 "</payload>";
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" +
@@ -143,6 +150,7 @@ public class MessageXML {
                 CryptoUtil.encrypt(payload)+
                 "</plain>" +
                 "</message>";
+        StaticLog.info("\n --------发送报文--------SXB004--------" + "\n payload=" + payload +"\n xml=" + xml);
         return xml;
     }
 
@@ -154,13 +162,13 @@ public class MessageXML {
         String payload =
                 " <payload xsi:type=\"responseDTO\">" +
                 "         <code>200</code>\n" +                                 //消息回执代码
-                "         <source>" + bankInfo.getSn() + "</source>\n" +    //源报文编号
+                "         <source>" + bankInfo.getSn() + "</source>\n" +        //源报文编号
                 "         <note>商铺已备案</note>\n" +                           //回执内容
                 "<results xsi:type=\"vendeeDTO\">\n" +
-                "         <name>" + bankInfo.getName() + "</name>\n" +                       //商铺所属人姓名
-                "         <papersType>" + bankInfo.getPapersType() + "</papersType>\n" +       //所属人证件类型  0001 身份证
-                "         <papersNo>" + bankInfo.getPapersNo() + "</papersNo>\n" +             //所属人证件号
-                "         <nationality>" + bankInfo.getNationality() + "</nationality>\n" +  //国籍
+                "         <name>" + bankInfo.getName() + "</name>\n" +                          //商铺所属人姓名
+                "         <papersType>" + bankInfo.getPapersType() + "</papersType>\n" +        //所属人证件类型  0001 身份证
+                "         <papersNo>" + bankInfo.getPapersNo() + "</papersNo>\n" +              //所属人证件号
+                "         <nationality>" + bankInfo.getNationality() + "</nationality>\n" +     //国籍
                 "</results>\n" +
                 "</payload>";
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" +
@@ -191,6 +199,7 @@ public class MessageXML {
                 CryptoUtil.encrypt(payload)+
                 "</plain>" +
                 "</message>";
+        StaticLog.info("\n --------发送报文--------SXB007--------" + "\n payload=" + payload +"\n xml=" + xml);
         return xml;
     }
 
@@ -233,6 +242,7 @@ public class MessageXML {
                 CryptoUtil.encrypt(payload)+
                 "</plain>" +
                 "</message>";
+        StaticLog.info("\n --------发送报文--------SXB008--------" + "\n payload=" + payload +"\n xml=" + xml);
         return xml;
     }
 
@@ -240,41 +250,53 @@ public class MessageXML {
      * 订单扣款:一级市场--->银行
      */
     public static String SXB010(PaymentDto paymentDto) {
+        paymentDto.setFieldCode("861501");
         String date = sdf.format(new Date());
         String payload =
                 "<payload xsi:type=\"orderDTO\">" +
                 "         <sn>" + paymentDto.getTradeNo() + "</sn>\n" +                         //订单号
-                "         <export>false</export>\n" +                                       //出口标识	true:出口,false:进口
+                "         <export>false</export>\n" +                                           //出口标识	true:出口,false:进口
                 "         <organization>" + paymentDto.getFieldCode() + "</organization>\n" +   //互市点机构代码
-                "         <currency>" + paymentDto.getCurrCode() + "</currency>\n" +            //币种
-                "         <type>01</type>\n" +                                              //业务类型	01 代表扣款报文
-                "         <charging>" + paymentDto.getResalePrice() + "</charging>\n" +         //计费金额(二级市场转售总金额)
+                //"         <currency>" + paymentDto.getCurrCode() + "</currency>\n" +          //币种
+                "         <currency>RMB</currency>\n" +                                         //币种
+                "         <type>001</type>\n" +                                                  //业务类型	01 代表扣款报文
+                //"         <charging>" + paymentDto.getResalePrice() + "</charging>\n" +       //计费金额(二级市场转售总金额):charging送0
+                "         <charging>0</charging>\n" +                                           //一级市场订单还没有上架计费:charging送0
                 "         <total>" + paymentDto.getTotalPrice() + "</total>\n" +                //总金额8000.00(一级市场边民订单金额)
                 "         <date>" + paymentDto.getDeclTime() + "</date>\n" +                    //订单时间	YYYY-MM—DD HH:MM:DD SSS
                 "<vendee>\n" +
-                "         <name>" + paymentDto.getBorderName() + "</name>\n" +                 //边民姓名
-                "         <papersType>0001</papersType>\n" +                                 //证件类型  0001 身份证
-                "         <papersNo>" + paymentDto.getBorderidno() + "</papersNo>\n" +           //边民证件号
-                "         <nationality>0001</nationality>\n" +                             //国籍
-                "         <account>" + paymentDto.getBankCode() + "</account>\n" +         //银行账号
-                "         <bankCode>MRCCCNB1</bankCode>\n" +                            //开户行代码
-                "         <tel>" + paymentDto.getBorderTel() + "</tel>\n" +                    //联系电话
+                "         <name>" + paymentDto.getBorderName() + "</name>\n" +                  //边民姓名
+                "         <papersType>" + paymentDto.getPapersType() + "</papersType>\n" +      //证件类型  0001 身份证
+                "         <papersNo>" + paymentDto.getBorderidno() + "</papersNo>\n" +          //边民证件号
+                "         <nationality>" + paymentDto.getBorderNationality() + "</nationality>\n" +  //国籍
+                "         <account>" + paymentDto.getBankCode() + "</account>\n" +              //银行账号
+                "         <bankCode>" + paymentDto.getBankNo() + "</bankCode>\n" +              //开户行代码
+                "         <tel>" + paymentDto.getBorderTel() + "</tel>\n" +                     //联系电话
+                "         <enAddress></enAddress>\n" +
+                "         <bankSignTime></bankSignTime>\n" +
                 "</vendee>\n" +
                 "<vendor>\n" +
-                "         <name>" + paymentDto.getOwnerName() + "</name>\n" +                  //商铺所属人姓名
-                "         <papersType>" + paymentDto.getOwnerIdtype() + "</papersType>\n" +      //所属人证件类型
-                "         <papersNo>12312312-3</papersNo>\n" +                                   //所属人证件号
-                "         <nationality>0001</nationality>\n" +                                 //国籍
-                "         <account>" + paymentDto.getBankAccount() + "</account>\n" +      //银行账号
-                "         <bankCode>MRCCCNB1</bankCode>\n" +                            //开户行代码
-                "         <tel>" + paymentDto.getOwnerTel() + "</tel>\n" +                     //联系电话
+                "         <title></title>\n" +
+                "         <enTitle></enTitle>\n" +
+                "         <name>" + paymentDto.getOwnerName() + "</name>\n" +                   //商铺所属人姓名
+                "         <papersType>" + paymentDto.getOwnerIdtype() + "</papersType>\n" +     //所属人证件类型
+                "         <papersNo>" + paymentDto.getShopSccd() + "</papersNo>\n" +            //所属人证件号
+                "         <nationality>" + paymentDto.getNationality() + "</nationality>\n" +   //国籍
+                "         <account>" + paymentDto.getBankAccount() + "</account>\n" +           //银行账号
+                "         <bankCode>" + paymentDto.getBank() + "</bankCode>\n" +                //开户行代码
+                "         <tel>" + paymentDto.getOwnerTel() + "</tel>\n" +                      //联系电话
+                "         <address></address>\n" +
+                "         <enAddress></enAddress>\n" +
+                "         <abroad></abroad>\n" +
                 "</vendor>\n" +
                 "<items>\n" +
+                "         <code>" + paymentDto.getCodeTs() + "</code>\n" +                      //商品编码
                 "         <name>" + paymentDto.getGoodsName() + "</name>\n" +                   //商品名称
-                "         <unit>" + paymentDto.getGoodsUnit() + "</unit>\n" +                   //商品单位
+                //"         <unit>" + paymentDto.getGoodsUnit() + "</unit>\n" +                 //商品单位
+                "         <unit>0001</unit>\n" +                                                //商品单位——KG
                 "         <price>" + paymentDto.getDeclPrice() + "</price>\n" +                 //商品单价
                 "         <quantity>" + paymentDto.getBuyQty() + "</quantity>\n" +              //商品数量
-                "         <weight>" + paymentDto.getGrossWt() + "</weight>\n" +                 //商品重量
+                "         <weight>" + paymentDto.getNetWt() + "</weight>\n" +                   //商品重量(净重)
                 "         <amount>" + paymentDto.getTotalPrice() + "</amount>\n" +              //金额
                 "</items>\n" +
                 "</payload>";
@@ -306,6 +328,7 @@ public class MessageXML {
                 CryptoUtil.encrypt(payload)+
                 "</plain>" +
                 "</message>";
+        StaticLog.info("\n --------发送报文--------SXB010--------" + "\n payload=" + payload +"\n xml=" + xml);
         return xml;
     }
 
@@ -313,40 +336,52 @@ public class MessageXML {
      * 订单退款:一级市场--->银行
      */
     public static String SXB013(PaymentDto paymentDto) {
+        paymentDto.setFieldCode("861501");
         String date = sdf.format(new Date());
         String payload =
                 "<payload xsi:type=\"orderDTO\">" +
                 "         <sn>" + paymentDto.getTradeNo() + "</sn>\n" +                         //订单号
                 "         <organization>" + paymentDto.getFieldCode() + "</organization>\n" +   //互市点机构代码
-                "         <currency>" + paymentDto.getCurrCode() + "</currency>\n" +            //币种
-                "         <type>02</type>\n" +                                              //业务类型	02代表退款报文
-                "         <charging>" + paymentDto.getResalePrice() + "</charging>\n" +         //计费金额(二级市场转售总金额)
+                //"         <currency>" + paymentDto.getCurrCode() + "</currency>\n" +            //币种
+                "         <currency>RMB</currency>\n" +                                         //币种
+                "         <type>002</type>\n" +                                                  //业务类型	02代表退款报文
+                //"         <charging>" + paymentDto.getResalePrice() + "</charging>\n" +       //计费金额(二级市场转售总金额):charging送0
+                "         <charging>0</charging>\n" +                                           //一级市场订单还没有上架计费:charging送0
                 "         <total>" + paymentDto.getTotalPrice() + "</total>\n" +                //总金额8000.00(一级市场边民订单金额)
                 "         <date>" + paymentDto.getDeclTime() + "</date>\n" +                    //订单时间	YYYY-MM—DD HH:MM:DD SSS
                 "<vendee>\n" +
-                "         <name>" + paymentDto.getBorderName() + "</name>\n" +                 //边民姓名
-                "         <papersType>0001</papersType>\n" +                                 //证件类型  0001 身份证
-                "         <papersNo>" + paymentDto.getBorderidno() + "</papersNo>\n" +           //边民证件号
-                "         <nationality>0001</nationality>\n" +                             //国籍
-                "         <account>" + paymentDto.getBankCode() + "</account>\n" +         //银行账号
-                "         <bankCode>MRCCCNB1</bankCode>\n" +                            //开户行代码
-                "         <tel>" + paymentDto.getBorderTel() + "</tel>\n" +                    //联系电话
+                "         <name>" + paymentDto.getBorderName() + "</name>\n" +                  //边民姓名
+                "         <papersType>" + paymentDto.getPapersType() + "</papersType>\n" +      //证件类型  0001 身份证
+                "         <papersNo>" + paymentDto.getBorderidno() + "</papersNo>\n" +          //边民证件号
+                "         <nationality>" + paymentDto.getBorderNationality() + "</nationality>\n" +  //国籍
+                "         <account>" + paymentDto.getBankCode() + "</account>\n" +              //银行账号
+                "         <bankCode>" + paymentDto.getBankNo() + "</bankCode>\n" +              //开户行代码
+                "         <tel>" + paymentDto.getBorderTel() + "</tel>\n" +                     //联系电话
+                "         <enAddress></enAddress>\n" +
+                "         <bankSignTime></bankSignTime>\n" +
                 "</vendee>\n" +
                 "<vendor>\n" +
-                "         <name>" + paymentDto.getOwnerName() + "</name>\n" +                  //商铺所属人姓名
-                "         <papersType>" + paymentDto.getOwnerIdtype() + "</papersType>\n" +      //所属人证件类型
-                "         <papersNo>12312312-3</papersNo>\n" +                                   //所属人证件号
-                "         <nationality>0001</nationality>\n" +                                 //国籍
-                "         <account>" + paymentDto.getBankAccount() + "</account>\n" +      //银行账号
-                "         <bankCode>MRCCCNB1</bankCode>\n" +                            //开户行代码
-                "         <tel>" + paymentDto.getOwnerTel() + "</tel>\n" +                     //联系电话
+                "         <title></title>\n" +
+                "         <enTitle></enTitle>\n" +
+                "         <name>" + paymentDto.getOwnerName() + "</name>\n" +                   //商铺所属人姓名
+                "         <papersType>" + paymentDto.getOwnerIdtype() + "</papersType>\n" +     //所属人证件类型
+                "         <papersNo>" + paymentDto.getShopSccd() + "</papersNo>\n" +            //所属人证件号
+                "         <nationality>" + paymentDto.getNationality() + "</nationality>\n" +   //国籍
+                "         <account>" + paymentDto.getBankAccount() + "</account>\n" +           //银行账号
+                "         <bankCode>" + paymentDto.getBank() + "</bankCode>\n" +                //开户行代码
+                "         <tel>" + paymentDto.getOwnerTel() + "</tel>\n" +                      //联系电话
+                "         <address></address>\n" +
+                "         <enAddress></enAddress>\n" +
+                "         <abroad></abroad>\n" +
                 "</vendor>\n" +
                 "<items>\n" +
+                "         <code>" + paymentDto.getCodeTs() + "</code>\n" +                      //商品编码
                 "         <name>" + paymentDto.getGoodsName() + "</name>\n" +                   //商品名称
-                "         <unit>" + paymentDto.getGoodsUnit() + "</unit>\n" +                   //商品单位
+                //"         <unit>" + paymentDto.getGoodsUnit() + "</unit>\n" +                   //商品单位
+                "         <unit>0001</unit>\n" +                                                //商品单位——KG
                 "         <price>" + paymentDto.getDeclPrice() + "</price>\n" +                 //商品单价
                 "         <quantity>" + paymentDto.getBuyQty() + "</quantity>\n" +              //商品数量
-                "         <weight>" + paymentDto.getGrossWt() + "</weight>\n" +                 //商品重量
+                "         <weight>" + paymentDto.getNetWt() + "</weight>\n" +                   //商品重量(净重)
                 "         <amount>" + paymentDto.getTotalPrice() + "</amount>\n" +              //金额
                 "</items>\n" +
                 "</payload>";
@@ -379,6 +414,7 @@ public class MessageXML {
                 CryptoUtil.encrypt(payload)+
                 "</plain>" +
                 "</message>";
+        StaticLog.info("\n --------发送报文--------SXB013--------" + "\n payload=" + payload +"\n xml=" + xml);
         return xml;
     }
 
@@ -386,12 +422,18 @@ public class MessageXML {
      * 通关车批信息同步(车出一级市场时):一级市场--->银行
      */
     public static String SXB023(PaymentDto paymentDto) {
+        paymentDto.setFieldCode("861501");
         String date = sdf.format(new Date());
+        List<String> tradeNoList = Arrays.stream(paymentDto.getTradeNos().split(",")).collect(Collectors.toList());
+        String orderXml = "";
+        for (String tradeNo: tradeNoList) {
+            orderXml = orderXml + "<Order>" + tradeNo + "</Order>\n";
+        }
         String payload=
-                "<payload xsi:type=\"carDTO\">" +
+                "<payload xsi:type=\"carpoolDTO\">" +
                 "<registration>" + paymentDto.getVoyageNo() + "</registration>\n" +  //车辆批号
                 "<plateNumber>" + paymentDto.getVeNo() + "</plateNumber>\n" +        //车牌号
-                "<Order>" + paymentDto.getTradeNo() + "</Order>\n" +//订单号	n个
+                        orderXml +//订单号	n个
                 "</payload>";
         String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" +
                 "<message xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:noNamespaceSchemaLocation=\"\">\n" +
@@ -421,6 +463,7 @@ public class MessageXML {
                 CryptoUtil.encrypt(payload)+
                 "</plain>" +
                 "</message>\n";
+        StaticLog.info("\n --------发送报文--------SXB023--------" + "\n payload=" + payload +"\n xml=" + xml);
         return xml;
     }
 
@@ -453,6 +496,7 @@ public class MessageXML {
                 CryptoUtil.encrypt(payload)+
                 "</plain>" +
                 "</message>";
+        StaticLog.info("\n --------发送报文--------MKT002--------" + "\n payload=" + payload +"\n xml=" + xml);
         return xml;
     }
 
@@ -465,7 +509,7 @@ public class MessageXML {
                 " <payload xsi:type=\"vendorDTO\"" +
                         " name=\"" + paymentTwoDto.getOwnerName() + "\"" +         //企业名称
                         " papersType=\"0008\"" +                                    //证件类型  0008 社会统一信用代码(默认)
-                        " papersNo=\"12312312-3\"" +                                //证件号
+                        " papersNo=\"78509372-8\"" +                                //证件号
                         " nationality=\"0001\"" +                                   //国籍
                         " accountNo=\"" + paymentTwoDto.getBankAccount() + "\"" +      //银行账号
                         " bankCode=\"MRCCCNB1\"" +                                  //开户行代码
@@ -484,6 +528,7 @@ public class MessageXML {
                 CryptoUtil.encrypt(payload)+
                 "</plain>" +
                 "</message>";
+        StaticLog.info("\n --------发送报文--------MKT004--------" + "\n payload=" + payload +"\n xml=" + xml);
         return xml;
     }
 
@@ -491,46 +536,60 @@ public class MessageXML {
      * 订单扣款(无手续费):二级市场--->银行
      */
     public static String MKT006_NoCommission(PaymentTwoDto paymentTwoDto) {
+        paymentTwoDto.setFieldCode("861501");
         String date = sdf.format(new Date());
+        String purchaserXml = "<vendee" +//买方基本信息(采购企业)
+                " name=\"" + paymentTwoDto.getPcName() + "\"" +                 //企业名称
+                " papersType=\"0008\"" +                                        //证件类型  0008 社会统一信用代码(默认)
+                " papersNo=\"" + paymentTwoDto.getDutyParagraph() + "\"" +      //证件号
+                " nationality=\"0001\"" +                                       //国籍
+                " accountNo=\"" + paymentTwoDto.getPcBankAccount() + "\"" +     //银行账号
+                " bankCode=\"" + paymentTwoDto.getPcBankNo() + "\"" +           //开户行代码
+                " tel=\"" + paymentTwoDto.getPcContact() + "\"" +               //联系电话
+                "/>\n";
+        if(paymentTwoDto.getPcType() == 2) {
+            purchaserXml = "<vendee" +//买方基本信息(个人采购商)
+                    " name=\"" + paymentTwoDto.getPcName() + "\"" +                 //企业名称
+                    " papersType=\"0001\"" +                                        //证件类型  0001 身份证
+                    " papersNo=\"" + paymentTwoDto.getPcIdCard() + "\"" +           //证件号
+                    " nationality=\"0001\"" +                                       //国籍
+                    " accountNo=\"" + paymentTwoDto.getPcBankAccount() + "\"" +     //银行账号
+                    " bankCode=\"" + paymentTwoDto.getPcBankNo() + "\"" +           //开户行代码
+                    " tel=\"" + paymentTwoDto.getPcContact() + "\"" +               //联系电话
+                    "/>\n";
+        }
         String payload=
                 "<payload xsi:type=\"orderDTO\"" +
-                " sn=\"" + paymentTwoDto.getOrderNo() + "\"" +                         //订单号
-                " organization=\"" + paymentTwoDto.getFieldCode() + "\"" +   //互市点机构代码
-                " currency=\"" + paymentTwoDto.getCurrCode() + "\"" +            //币种
-                " type=\"001\"" +                                                //业务类型	001 代表扣款订单
-                " total=\"" + paymentTwoDto.getResalePrice() + "\"" +               //订单总金额 8150.00 【买方总支付金额】(转售金额)
-                //" actualTotal=\"</actualTotal>\n" +                                     //扣除手续费边民实际到账金额  actualTotal忽略
-                " dateTime=\"" + paymentTwoDto.getDeclTime() + "\"" +            //订单时间	YYYY-MM—DD HH:MM:DD SSS
+                " sn=\"" + paymentTwoDto.getOrderNo() + "\"" +                  //订单号
+                " organization=\"" + paymentTwoDto.getFieldCode() + "\"" +      //互市点机构代码
+                " currency=\"RMB\"" +                                           //币种
+                " type=\"001\"" +                                               //业务类型	001 代表扣款订单
+                " total=\"" + paymentTwoDto.getResalePrice() + "\"" +           //订单总金额 8150.00 【买方总支付金额】(转售金额)
+                //" actualTotal=\"</actualTotal>\n" +                           //扣除手续费边民实际到账金额  actualTotal忽略
+                " dateTime=\"" + date + "\"" +                                  //订单时间	YYYY-MM—DD HH:MM:DD SSS
                 ">" +
 
-                "<vendee" +//买方基本信息(采购企业)
-                " name=\"" + paymentTwoDto.getPcName() + "\"" +                       //企业名称
-                " papersType=\"0008\"" +                                      //证件类型  0008 社会统一信用代码(默认)
-                " papersNo=\"" + paymentTwoDto.getBusinessLicense() + "\"" +        //证件号
-                " nationality=\"0001\"" +                                  //国籍
-                " accountNo=\"" + paymentTwoDto.getPcBankAccount() + "\"" +     //银行账号
-                " bankCode=\"MRCCCNB1\"" +                                   //开户行代码
-                " tel=\"" + paymentTwoDto.getPcContact() + "\"" +                     //联系电话
-                "/>\n" +
+                purchaserXml +
 
                 "<vendor" +//卖方基础信息(边民)
-                " name=\"" + paymentTwoDto.getBorderName() + "\"" +                 //边民姓名
-                " papersType=\"0001\"" +                                    //证件类型  0001 身份证
-                " papersNo=\"" + paymentTwoDto.getBorderidno() + "\"" +           //边民证件号
-                " nationality=\"0001\"" +                                //国籍
-                " accountNo=\"" + paymentTwoDto.getBankCode() + "\"" +        //银行账号
-                " bankCode=\"MRCCCNB1\"" +                                 //开户行代码
-                " tel=\"" + paymentTwoDto.getBorderTel() + "\"" +                   //联系电话
+                " name=\"" + paymentTwoDto.getBorderName() + "\"" +             //边民姓名
+                " papersType=\"" + paymentTwoDto.getPapersType() + "\"" +       //证件类型  0001 身份证
+                " papersNo=\"" + paymentTwoDto.getBorderidno() + "\"" +         //边民证件号
+                " nationality=\"" + paymentTwoDto.getBorderNationality() + "\"" +  //国籍
+                " accountNo=\"" + paymentTwoDto.getBankCode() + "\"" +          //银行账号
+                " bankCode=\"" + paymentTwoDto.getBankNo() + "\"" +             //开户行代码
+                " tel=\"" + paymentTwoDto.getBorderTel() + "\"" +               //联系电话
                 "/>\n" +
 
                 "<items" +//商品明细
-                " code=\"" + paymentTwoDto.getCodeTs() + "\"" +                      //商品编码
-                " name=\"" + paymentTwoDto.getGoodsName() + "\"" +                   //商品名称
-                " unit=\"" + paymentTwoDto.getGoodsUnit() + "\"" +                   //商品单位
-                " price=\"" + paymentTwoDto.getDeclPrice() + "\"" +                 //商品单价
-                " quantity=\"" + paymentTwoDto.getBuyQty() + "\"" +              //商品数量
-                " weight=\"" + paymentTwoDto.getGrossWt() + "\"" +                 //商品重量
-                " amount=\"" + paymentTwoDto.getTotalPrice() + "\"" +              //金额
+                " code=\"" + paymentTwoDto.getCodeTs() + "\"" +             //商品编码
+                " name=\"" + paymentTwoDto.getGoodsName() + "\"" +          //商品名称
+                //" unit=\"" + paymentTwoDto.getGoodsUnit() + "\"" +          //商品单位
+                " unit=\"0001\"" +                                          //商品单位——KG
+                " price=\"" + paymentTwoDto.getDeclPrice() + "\"" +         //商品单价
+                " quantity=\"" + paymentTwoDto.getBuyQty() + "\"" +         //商品数量
+                " weight=\"" + paymentTwoDto.getNetWt() + "\"" +            //商品重量
+                " amount=\"0\"" +                                           //金额
                 "/>\n" +
 
                 "</payload>";
@@ -548,13 +607,18 @@ public class MessageXML {
                          CryptoUtil.encrypt(payload)+
                     "</plain>" +
                 "</message>";
+        StaticLog.info("\n --------发送报文--------MKT006(无计费)--------" + "\n payload=" + payload +"\n xml=" + xml);
         return xml;
     }
 
+
     /**
      * 订单扣款(+手续费):二级市场--->银行
      */
     public static String MKT006(PaymentTwoDto paymentTwoDto) {
+        paymentTwoDto.setFieldCode("861501");
+        paymentTwoDto.setDeclTime("2024-01-17 10:11:55 876");
+        paymentTwoDto.setCurrCode("RMB");
         String date = sdf.format(new Date());
         String chargesXml = chargesXml(paymentTwoDto.getCompanyDtoList(), paymentTwoDto.getOrderNo());
         String payload=
@@ -564,11 +628,11 @@ public class MessageXML {
                 " currency=\"" + paymentTwoDto.getCurrCode() + "\"" +            //币种
                 " type=\"001\"" +                                                //业务类型	001 代表扣款订单
                 " total=\"" + paymentTwoDto.getResalePrice() + "\"" +               //订单总金额 8150.00 【买方总支付金额】(转售金额)
-                " actualTotal=\"" + paymentTwoDto.getTotalPrice() + "\"" +      //扣除手续费边民实际到账金额  actualTotal忽略
+                " actualTotal=\"7490.05\"" +      //扣除手续费边民实际到账金额  actualTotal忽略
                 " dateTime=\"" + paymentTwoDto.getDeclTime() + "\"" +            //订单时间	YYYY-MM—DD HH:MM:DD SSS
                 ">" +
 
-                "<vendee" +//买方基本信息(采购企业)
+                /*"<vendee" +//买方基本信息(采购企业)
                 " name=\"" + paymentTwoDto.getPcName() + "\"" +                       //企业名称
                 " papersType=\"0008\"" +                                      //证件类型  0008 社会统一信用代码(默认)
                 " papersNo=\"" + paymentTwoDto.getBusinessLicense() + "\"" +        //证件号
@@ -576,6 +640,15 @@ public class MessageXML {
                 " accountNo=\"" + paymentTwoDto.getPcBankAccount() + "\"" +     //银行账号
                 " bankCode=\"MRCCCNB1\"" +                                   //开户行代码
                 " tel=\"" + paymentTwoDto.getPcContact() + "\"" +                     //联系电话
+                "/>\n" +*/
+                "<vendee" +//买方基本信息(采购企业)
+                " name=\"云南跨境贸易公司\"" +                       //企业名称
+                " papersType=\"0008\"" +                                      //证件类型  0008 社会统一信用代码(默认)
+                " papersNo=\"12312312-3\"" +        //证件号
+                " nationality=\"0001\"" +                                  //国籍
+                " accountNo=\"0100028613124012\"" +     //银行账号
+                " bankCode=\"MRCCCNB1\"" +                                   //开户行代码
+                " tel=\"15195882701\"" +                     //联系电话
                 "/>\n" +
 
                 "<vendor" +//卖方基础信息(边民)
@@ -613,6 +686,7 @@ public class MessageXML {
                         CryptoUtil.encrypt(payload)+
                     "</plain>" +
                 "</message>";
+        StaticLog.info("\n --------发送报文--------MKT006(有计费)--------" + "\n payload=" + payload +"\n xml=" + xml);
         return xml;
     }
 
@@ -632,7 +706,8 @@ public class MessageXML {
                         " dateTime=\"" + paymentTwoDto.getDeclTime() + "\"" +            //订单时间	YYYY-MM—DD HH:MM:DD SSS
                         ">" +
 
-                        "<vendee" +//买方基本信息(采购企业)
+
+                        /*"<vendee" +//买方基本信息(采购企业)
                         " name=\"" + paymentTwoDto.getPcName() + "\"" +                       //企业名称
                         " papersType=\"0008\"" +                                      //证件类型  0008 社会统一信用代码(默认)
                         " papersNo=\"" + paymentTwoDto.getBusinessLicense() + "\"" +        //证件号
@@ -650,6 +725,26 @@ public class MessageXML {
                         " accountNo=\"" + paymentTwoDto.getBankCode() + "\"" +        //银行账号
                         " bankCode=\"MRCCCNB1\"" +                                 //开户行代码
                         " tel=\"" + paymentTwoDto.getBorderTel() + "\"" +                   //联系电话
+                        "/>\n" +*/
+
+                        "<vendee" +//买方基本信息(采购企业)
+                        " name=\"云南跨境贸易公司\"" +                       //企业名称
+                        " papersType=\"0008\"" +                           //证件类型  0008 社会统一信用代码(默认)
+                        " papersNo=\"12312312-3\"" +                       //证件号
+                        " nationality=\"0001\"" +                          //国籍
+                        " accountNo=\"0100028613124012\"" +                //银行账号
+                        " bankCode=\"MRCCCNB1\"" +                         //开户行代码
+                        " tel=\"15195882701\"" +                           //联系电话
+                        "/>\n" +
+
+                        "<vendor" +//卖方基础信息(边民)
+                        " name=\"" + paymentTwoDto.getBorderName() + "\"" +                 //边民姓名
+                        " papersType=\"0001\"" +                                    //证件类型  0001 身份证
+                        " papersNo=\"" + paymentTwoDto.getBorderidno() + "\"" +           //边民证件号
+                        " nationality=\"0001\"" +                                //国籍
+                        " accountNo=\"" + paymentTwoDto.getBankCode() + "\"" +        //银行账号
+                        " bankCode=\"MRCCCNB1\"" +                                 //开户行代码
+                        " tel=\"" + paymentTwoDto.getBorderTel() + "\"" +                   //联系电话
                         "/>\n" +
 
                         "<items" +//商品明细
@@ -662,6 +757,7 @@ public class MessageXML {
                         " amount=\"" + paymentTwoDto.getTotalPrice() + "\"" +              //金额
                         "/>\n" +
                         "</payload>";
+
         String xml =
                 "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" +
                         "<message xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"\">\n" +
@@ -676,13 +772,17 @@ public class MessageXML {
                         CryptoUtil.encrypt(payload)+
                         "</plain>" +
                         "</message>";
+        StaticLog.info("\n --------发送报文--------MKT007--------" + "\n payload=" + payload +"\n xml=" + xml);
         return xml;
     }
 
-
     private static String chargesXml(List<CompanyDto> companyDtoList, String orderNo) {
         String xml = "";
         for (CompanyDto companyDto : companyDtoList) {
+            companyDto.setName("云南跨境贸易公司");
+            companyDto.setUsci("12312312-3");
+            companyDto.setBankAccount("0100028613124012");
+            companyDto.setContact("15195882701");
             xml += "<charges" +//父级手续费(无子级手续费)
                     " type=\"OPERATING\"" +                                     //手续费类型	数据字典:ChargeType
                     " sn=\"" + orderNo + "\"" +                                 //订单号
@@ -700,10 +800,5 @@ public class MessageXML {
         return xml;
     }
 
-    public static void main(String[] args) {
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss sss");
-        Date day = new Date();
-        String format = sdf.format(day);
-        System.out.println(UUID.randomUUID());
-    }
+
 }

+ 125 - 0
sp-service/payment-server/src/main/resources/logback.xml

@@ -0,0 +1,125 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+    <contextName>pay</contextName>
+    <property name="LOG_PATH" value="logs"/>
+    <property name="APP_DIR" value="pco"/>
+    <property name="log.maxFileSize" value="10MB"/>
+    <property name="log.maxFileCnt" value="90"/>
+    <property name="log.totalSizeCap" value="10GB"/>
+
+    <appender name="FILE_DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${LOG_PATH}/${APP_DIR}/log_debug.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/debug/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <maxFileSize>${log.maxFileSize}</maxFileSize>
+            <maxHistory>${log.maxFileCnt}</maxHistory>
+            <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
+        </rollingPolicy>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS}|%-5level{10}[%25.25thread{24}]%-40.40logger{39}|-Line:%-3L:%msg%n
+            </pattern>
+            <charset>utf-8</charset>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>debug</level>
+            <onMatch>ACCEPT</onMatch>
+            <!--            <onMismatch>DENY</onMismatch>-->
+        </filter>
+    </appender>
+
+    <appender name="FILE_INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${LOG_PATH}/${APP_DIR}/log_info.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/info/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <maxFileSize>${log.maxFileSize}</maxFileSize>
+            <maxHistory>${log.maxFileCnt}</maxHistory>
+            <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
+        </rollingPolicy>
+        <append>true</append>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS}|%-5level{10}[%25.25thread{24}]%-40.40logger{39}|-Line:%-3L:%msg%n
+            </pattern>
+            <charset>UTF-8</charset>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>info</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+        <!--encoder 默认配置为PatternLayoutEncoder-->
+        <encoder>
+            <pattern>%d{yyyy-MM-dd
+                HH:mm:ss.SSS}|%highlight(%-5level{10})[%boldYellow(%25.25thread{24})]%gray(%-50.50logger{49})|-Line:%boldYellow(%-3L):%msg%n
+            </pattern>
+            <charset>UTF-8</charset>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
+            <level>info</level>
+        </filter>
+    </appender>
+
+    <appender name="COMM_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${LOG_PATH}/${APP_DIR}/comm_info.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/comm/comm_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <maxFileSize>${log.maxFileSize}</maxFileSize>
+            <maxHistory>${log.maxFileCnt}</maxHistory>
+            <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
+        </rollingPolicy>
+        <append>true</append>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <pattern>%msg%n</pattern>
+            <charset>UTF-8</charset>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>info</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+    <logger name="com.cryann.hsms.driver.netty" additivity="false">
+        <appender-ref ref="COMM_LOG"/>
+    </logger>
+
+    <appender name="SXFX_info_LOG" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${LOG_PATH}/${APP_DIR}/SxFx_info.log</file>
+        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+            <fileNamePattern>${LOG_PATH}/${APP_DIR}/SxFx/SxFx_info-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
+            <maxFileSize>${log.maxFileSize}</maxFileSize>
+            <maxHistory>${log.maxFileCnt}</maxHistory>
+            <totalSizeCap>${log.totalSizeCap}</totalSizeCap>
+        </rollingPolicy>
+        <append>true</append>
+        <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+            <pattern>%d{yyyy-MM-dd
+                HH:mm:ss.SSS}|%highlight(%-5level{10})[%boldYellow(%25.25thread{24})]%gray(%-50.50logger{49})|-Line:%boldYellow(%-3L):%msg%n
+            </pattern>
+            <charset>UTF-8</charset>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <level>info</level>
+            <onMatch>ACCEPT</onMatch>
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+
+    <logger name="org.springframework" level="WARN"/>
+    <logger name="org.hibernate" level="WARN"/>
+    <logger name="com.apache.ibatis" level="TRACE"/>
+    <logger name="java.sql.Connection" level="DEBUG"/>
+    <logger name="java.sql.Statement" level="DEBUG"/>
+    <logger name="java.sql.PreparedStatement" level="DEBUG"/>
+
+    <!-- 生产环境下,将此级别配置为适合的级别,以免日志文件太多或影响程序性能 -->
+    <root level="INFO">
+        <!-- 生产环境将请stdout,testfile去掉 -->
+        <appender-ref ref="STDOUT"/>
+        <appender-ref ref="FILE_DEBUG"/>
+        <!--<appender-ref ref="FILEWARN"/>-->
+        <appender-ref ref="FILE_INFO"/>
+    </root>
+</configuration>

+ 5 - 1
sp-service/sp-admin/pom.xml

@@ -26,7 +26,11 @@
             <artifactId>sp-base</artifactId>
             <version>${project.parent.version}</version>
         </dependency>
-        
+        <dependency>
+            <groupId>net.coobird</groupId>
+            <artifactId>thumbnailator</artifactId>
+            <version>0.4.8</version>
+        </dependency>
     </dependencies>
 
 

+ 78 - 26
sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserApiController.java

@@ -1,20 +1,25 @@
 package com.pj.project.app_user;
 
-import com.pj.api.dto.AppUserCreateDTO;
+import cn.hutool.core.util.StrUtil;
+import com.pj.api.consts.FeignFactory;
 import com.pj.api.dto.AppUserDto;
-import com.pj.api.dto.UpdateAccountDTO;
+import com.pj.api.dto.PeopleDto;
 import com.pj.current.satoken.StpAPPUserUtil;
+import com.pj.enummj.DeleteStatus;
 import com.pj.project.app_user.dto.ForgetPasswordDto;
 import com.pj.project.app_user.dto.LoginDto;
 import com.pj.project.app_user.dto.RegisterDto;
 import com.pj.project.app_user.vo.AppUserVo;
 import com.pj.utils.sg.AjaxJson;
 import com.pj.utils.so.SoMap;
+
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.io.IOException;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Map;
@@ -27,6 +32,7 @@ import java.util.Map;
  */
 @RestController
 @RequestMapping("/app/AppUser/")
+@Slf4j
 public class AppUserApiController {
 
     /**
@@ -36,42 +42,71 @@ public class AppUserApiController {
     AppUserService appUserService;
 
 
-    /** 修改个人信息 */
+    /**
+     * 修改个人信息
+     */
     @RequestMapping("update")
-    public AjaxJson update(AppUser a){
+    public AjaxJson update(AppUser a) {
         appUserService.update(a);
         return AjaxJson.getSuccess();
     }
 
-    /** 查看个人信息 */
+    /**
+     * 查看个人信息
+     */
     @RequestMapping("getSelfInfo")
-    public AjaxJson getById(){
+    public AjaxJson getById() {
         AppUserVo a = appUserService.getSelfInfo();
         return AjaxJson.getSuccessData(a);
     }
 
-    /** 获取认证状态 */
+    /**
+     * 获取认证状态
+     */
     @RequestMapping("getAuth")
-    public AjaxJson getAuth(){
-        AppUser user=appUserService.getById(StpAPPUserUtil.getAPPLoginInfo().getLoginId());
-        Map so=new HashMap();
-        so.put("auth",user.getAuth());
-        so.put("face",user.getFace());
+    public AjaxJson getAuth() {
+        Map so = new HashMap();
+        AppUser user = appUserService.getById(StpAPPUserUtil.getAPPLoginInfo().getLoginId());
+        if (user.getUserType() == 1) {
+            PeopleDto peopleDto = FeignFactory.levelOneServerInterface.getRpcById(user.getFkId());
+            so.put("groupId", peopleDto.getGroupId());
+            so.put("groupName", peopleDto.getGroupName());
+            so.put("leaderName", peopleDto.getLeaderName());
+            so.put("leaderPhone", peopleDto.getLeaderPhone());
+        }
+        so.put("auth", user.getAuth());
+        so.put("face", user.getFace());
+        so.put("name", user.getName());
+        so.put("phone", user.getPhone());
+
         return AjaxJson.getSuccessData(so);
     }
 
-    /** 边民首次使用APP人脸认证 */
+    /**
+     * 边民首次使用APP人脸认证
+     */
     @PostMapping("face")
-    public AjaxJson face(@RequestPart MultipartFile file,Integer type){
-        appUserService.authFace(StpAPPUserUtil.getAPPLoginInfo().getLoginId(),file,type);
+    public AjaxJson face(@RequestPart MultipartFile file, Integer type) throws Exception {
+        appUserService.authFace(StpAPPUserUtil.getAPPLoginInfo().getLoginId(), file, type);
         return AjaxJson.getSuccess();
     }
-    @PostMapping("faceLogin")
-    public AjaxJson faceLogin(@RequestPart MultipartFile file){
-        return  appUserService.faceLogin(file);
+    @PostMapping("faceTest")
+    public AjaxJson faceTest(@RequestPart MultipartFile file, Integer type) throws Exception {
+        appUserService.authFace(1L, file, type);
+        return AjaxJson.getSuccess();
     }
 
+    @PostMapping("faceImg")
+    public AjaxJson faceImg(String img, Integer type)  throws IOException {
+        if (StrUtil.isEmpty(img)) return AjaxJson.getError("人脸信息为空!");
+        appUserService.authFace(StpAPPUserUtil.getAPPLoginInfo().getLoginId(), img, type);
+        return AjaxJson.getSuccess();
+    }
 
+    @PostMapping("faceLogin")
+    public AjaxJson faceLogin(@RequestPart MultipartFile file) {
+        return appUserService.faceLogin(file);
+    }
 
 
     /**
@@ -91,6 +126,7 @@ public class AppUserApiController {
     public AjaxJson login(@Validated LoginDto dto) {
         return appUserService.login(dto);
     }
+
     @PostMapping("login/purchaser")
     public AjaxJson purchaserLogin(@Validated @RequestBody LoginDto dto) {
         return appUserService.purchaserLogin(dto);
@@ -127,37 +163,53 @@ public class AppUserApiController {
      * 修改密码
      */
     @RequestMapping("modifyPassword")
-    public AjaxJson modifyPassword(@RequestParam("oldPassword") String olePassword,@RequestParam("newPassword")String newPassword,@RequestParam("rePassword")String rePassword) {
-        boolean result = appUserService.modifyPassword(olePassword, newPassword,rePassword);
+    public AjaxJson modifyPassword(@RequestParam("oldPassword") String olePassword, @RequestParam("newPassword") String newPassword, @RequestParam("rePassword") String rePassword) {
+        boolean result = appUserService.modifyPassword(olePassword, newPassword, rePassword);
         if (result) return AjaxJson.getSuccess("密码修改成功!");
         return AjaxJson.getError("密码修改失败!");
     }
 
-    /** 获取银行卡信息 */
+    /**
+     * 获取银行卡信息
+     */
     @RequestMapping("getBankInfo")
-    public AjaxJson getBankInfo(){
+    public AjaxJson getBankInfo() {
         SoMap so = appUserService.getBankInfo();
         return AjaxJson.getSuccessData(so);
     }
 
-    /** 获取银行卡信息 */
+    /**
+     * 获取银行卡信息
+     */
     @RequestMapping("saveBankInfo")
-    public AjaxJson saveBankInfo(){
+    public AjaxJson saveBankInfo() {
         SoMap so = SoMap.getRequestSoMap();
         return AjaxJson.toAjax(appUserService.saveBankInfo(so));
     }
 
     /*-----               正常业务接口👆👆    不越界     rpc远程调用 👇👇                     -----*/
+
     /**
      * 收购商认证
      */
     @PostMapping("rpc/getByPhoneAndUserType")
-    public AppUserDto getByPhoneAndUserType(@RequestParam("phone") String phone,@RequestParam("userType")Integer userType) {
+    public AppUserDto getByPhoneAndUserType(@RequestParam("phone") String phone, @RequestParam("userType") Integer userType) {
         return appUserService.getByPhoneAndUserType(phone, userType);
     }
 
+    /**
+     * 注销账户
+     */
+    @RequestMapping("delete")
+    public AjaxJson delete(Long id){
+        AppUser appUser = new AppUser();
+        appUser.setId(id);
+        appUser.setDeleteStatus(DeleteStatus.DELETE_STATUS_OFF.getCode()); //被逻辑删除
+        appUser.setUpdateTime(new Date());
+        appUserService.update(appUser);
 
-
+        return AjaxJson.getSuccess();
+    }
 
 
 }

+ 205 - 150
sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserController.java

@@ -3,9 +3,11 @@ package com.pj.project.app_user;
 import java.util.Date;
 import java.util.List;
 
+import cn.hutool.core.util.StrUtil;
 import cn.hutool.json.JSONUtil;
 import cn.hutool.log.StaticLog;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.pj.api.consts.FeignFactory;
 import com.pj.api.dto.*;
 
 import com.pj.api.dto.BindShopDTO;
@@ -24,160 +26,213 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
 
 /**
  * Controller: app_user -- 移动端账号
+ *
  * @author qzy
  */
 @RestController
 @RequestMapping("/AppUser/")
 public class AppUserController {
 
-	/** 底层 Service 对象 */
-	@Autowired
-	AppUserService appUserService;
-
-	/** 增 */
-	@RequestMapping("add")
-	@SaCheckPermission(AppUser.PERMISSION_CODE_ADD)
-	public AjaxJson add(AppUser a){
-		appUserService.add(a);
-		a = appUserService.getById(SP.publicMapper.getPrimarykey());
-		return AjaxJson.getSuccessData(a);
-	}
-
-	/** 删 */
-	@RequestMapping("delete")
-	@SaCheckPermission(AppUser.PERMISSION_CODE_DEL)
-	public AjaxJson delete(Long id){
-		 appUserService.delete(id);
-		return AjaxJson.getSuccess();
-	}
-
-	/** 删 - 根据id列表 */
-	@RequestMapping("deleteByIds")
-	@SaCheckPermission(AppUser.PERMISSION_CODE_DEL)
-	public AjaxJson deleteByIds(){
-		List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
-		int line = SP.publicMapper.deleteByIds(AppUser.TABLE_NAME, ids);
-		return AjaxJson.getByLine(line);
-	}
-
-	/** 改 */
-	@RequestMapping("update")
-	@SaCheckPermission(AppUser.PERMISSION_CODE_EDIT)
-	public AjaxJson update(AppUser a){
-		appUserService.update(a);
-		return AjaxJson.getSuccess();
-	}
-
-	/** 修改密码 */
-	@RequestMapping("pass")
-	@SaCheckPermission( AppUser.PERMISSION_CODE_EDIT)
-	public AjaxJson pass(@Validated PassDto dto){
-		StaticLog.info("dto:", JSONUtil.toJsonStr(dto.getPassword()));
-		return AjaxJson.toAjax(appUserService.pass(dto));
-	}
-
-	/** 查 - 根据id */
-	@RequestMapping("getById")
-		@SaCheckPermission(AppUser.PERMISSION_CODE)
-	public AjaxJson getById(Long id){
-		AppUser a = appUserService.getById(id);
-		return AjaxJson.getSuccessData(a);
-	}
-
-	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */
-	@RequestMapping("getList")
-		@SaCheckPermission(AppUser.PERMISSION_CODE)
-	public AjaxJson getList() {
-		SoMap so = SoMap.getRequestSoMap();
-		List<AppUser> list = appUserService.getList(so.startPage());
-		return AjaxJson.getPageData(so.getDataCount(), list);
-	}
-
-	/**
-	 * 更换角色
-	 *
-	 * 当前用户已登录,app点击该按钮时,从缓存获取用户类型与选择要更换的角色id做对比,相同则进入此方法,故在此不做用户角色权限过滤
-	 * @param appRoleId
-	 * @return
-	 */
-	@RequestMapping("updateRole")
-	AjaxJson updateRole(@RequestParam("appRoleId")String appRoleId) {
-		return appUserService.updateRole(appRoleId);
-	}
-
-	/*-----               正常业务接口👆👆    不越界     rpc远程调用 👇👇                     -----*/
-
-
-	/** 启/停边民的app账号登陆限制 */
-	@PostMapping("rpc/isLock")
-	public int isLock(@RequestParam("id") String id,
-						   @RequestParam("type") Integer type,
-						   @RequestParam("status") Integer status) {
-		int lock = appUserService.isLock(id,type,status);
-		return lock;
-	}
-
-	/** 查单个app有效用户 - 根据id */
-	@RequestMapping("rpc/getById")
-	public AppUserDto getAppUserById(@RequestParam("id") Long id){
-		AppUserDto appUser = appUserService.getUserById(id);
-		return appUser;
-	}
-	/** 商户认证 */
-	@PostMapping("rpc/audit")
-	public boolean audit(@RequestBody EnterpriseAuditDto dto){
-		LambdaUpdateWrapper<AppUser> updateWrapper = new LambdaUpdateWrapper<>();
-		updateWrapper.set(AppUser::getAuth, dto.getAuth()).set(AppUser::getAuthTime, new Date()).eq(AppUser::getFkId, dto.getFkId());
-		boolean update = appUserService.update(updateWrapper);
-		return update;
-	}
-
-	/**
-	 * 收购商认证
-	 */
-	@PostMapping("rpc/saveAppUserInfo")
-	public Boolean saveAppUserInfo(@RequestBody AppUserDto appUser) {
-		boolean info = appUserService.saveAppUserInfo(appUser);
-		return info;
-	}
-
-
-
-	/**
-	 * 用户数量统计
-	 * @return
-	 */
-	@RequestMapping("selectUsers")
-	public AjaxJson selectUsers(){
-		return AjaxJson.getSuccessData(appUserService.selectUsers());
-	}
-
-
-	/**
-	 * 创建账号
-	 * @param createDTO
-	 */
-	@PostMapping("rpc/createAppAccount")
-	public boolean createAccount(@RequestBody AppUserCreateDTO createDTO){
-		return appUserService.createUser(createDTO);
-	}
-	@PostMapping("rpc/changeBindShopStatus")
-	public void changeBindShopStatus(@RequestBody BindShopDTO bindShopDTO){
-		appUserService.changeBindShopStatus(bindShopDTO);
-	}
-
-	/** 根据fkId查app用户 */
-	@RequestMapping("rpc/getByFkId")
-	public AppUserDto getAppUserByFkId(@RequestParam("fkId") Long fkId){
-		return appUserService.getAppUserByFkId(fkId);
-	}
-
-	@RequestMapping("rpc/findUserByPhone")
-	public AppUserDto findUserByPhone(@RequestParam("phone") String phone) {
-		return appUserService.findUserByPhone(phone);
-	}
-	@PostMapping("rpc/updateAccount")
-	public int updateAccount(@RequestBody UpdateAccountDTO phone) {
-		return appUserService.updateAccount(phone);
-	}
+    /**
+     * 底层 Service 对象
+     */
+    @Autowired
+    AppUserService appUserService;
+
+    /**
+     * 增
+     */
+    @RequestMapping("add")
+    @SaCheckPermission(AppUser.PERMISSION_CODE_ADD)
+    public AjaxJson add(AppUser a) {
+        appUserService.add(a);
+        a = appUserService.getById(SP.publicMapper.getPrimarykey());
+        return AjaxJson.getSuccessData(a);
+    }
+
+    /**
+     * 删
+     */
+    @RequestMapping("delete")
+    @SaCheckPermission(AppUser.PERMISSION_CODE_DEL)
+    public AjaxJson delete(Long id) {
+        appUserService.delete(id);
+        return AjaxJson.getSuccess();
+    }
+
+    /**
+     * 删 - 根据id列表
+     */
+    @RequestMapping("deleteByIds")
+    @SaCheckPermission(AppUser.PERMISSION_CODE_DEL)
+    public AjaxJson deleteByIds() {
+        List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class);
+        int line = SP.publicMapper.deleteByIds(AppUser.TABLE_NAME, ids);
+        return AjaxJson.getByLine(line);
+    }
+
+    /**
+     * 改
+     */
+    @RequestMapping("update")
+    @SaCheckPermission(AppUser.PERMISSION_CODE_EDIT)
+    public AjaxJson update(AppUser a) {
+        appUserService.update(a);
+        return AjaxJson.getSuccess();
+    }
+
+    /**
+     * 修改密码
+     */
+    @RequestMapping("pass")
+    @SaCheckPermission(AppUser.PERMISSION_CODE_EDIT)
+    public AjaxJson pass(@Validated PassDto dto) {
+        StaticLog.info("dto:", JSONUtil.toJsonStr(dto.getPassword()));
+        return AjaxJson.toAjax(appUserService.pass(dto));
+    }
+
+    /**
+     * 查 - 根据id
+     */
+    @RequestMapping("getById")
+    @SaCheckPermission(AppUser.PERMISSION_CODE)
+    public AjaxJson getById(Long id) {
+        AppUser a = appUserService.getById(id);
+        return AjaxJson.getSuccessData(a);
+    }
+
+    /**
+     * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+     */
+    @RequestMapping("getList")
+    @SaCheckPermission(AppUser.PERMISSION_CODE)
+    public AjaxJson getList() {
+        SoMap so = SoMap.getRequestSoMap();
+        List<AppUser> list = appUserService.getList(so.startPage());
+        return AjaxJson.getPageData(so.getDataCount(), list);
+    }
+
+    /**
+     * 更换角色
+     * <p>
+     * 当前用户已登录,app点击该按钮时,从缓存获取用户类型与选择要更换的角色id做对比,相同则进入此方法,故在此不做用户角色权限过滤
+     *
+     * @param appRoleId
+     * @return
+     */
+    @RequestMapping("updateRole")
+    AjaxJson updateRole(@RequestParam("appRoleId") String appRoleId) {
+        return appUserService.updateRole(appRoleId);
+    }
+
+    @RequestMapping("cleanFace")
+    public AjaxJson cleanFace(@RequestParam("id") Long id) {
+        AppUserDto appUserDto = FeignFactory.adminInterface.getByFkId(id);
+        String faceId = appUserDto.getFaceId();
+        if (StrUtil.isEmpty(faceId)) {
+            return AjaxJson.getSuccess();
+        }
+        appUserService.cleanFace(faceId);
+        return AjaxJson.getSuccess();
+    }
+
+
+
+
+
+
+    /*-----               正常业务接口👆👆    不越界     rpc远程调用 👇👇                     -----*/
+
+
+    /**
+     * 启/停边民的app账号登陆限制
+     */
+    @PostMapping("rpc/isLock")
+    public int isLock(@RequestParam("id") String id,
+                      @RequestParam("type") Integer type,
+                      @RequestParam("status") Integer status) {
+        int lock = appUserService.isLock(id, type, status);
+        return lock;
+    }
+
+    /**
+     * 查单个app有效用户 - 根据id
+     */
+    @RequestMapping("rpc/getById")
+    public AppUserDto getAppUserById(@RequestParam("id") Long id) {
+        AppUserDto appUser = appUserService.getUserById(id);
+        return appUser;
+    }
+
+    /**
+     * 商户认证
+     */
+    @PostMapping("rpc/audit")
+    public boolean audit(@RequestBody EnterpriseAuditDto dto) {
+        LambdaUpdateWrapper<AppUser> updateWrapper = new LambdaUpdateWrapper<>();
+        updateWrapper.set(AppUser::getAuth, dto.getAuth()).set(AppUser::getAuthTime, new Date()).eq(AppUser::getFkId, dto.getFkId());
+        boolean update = appUserService.update(updateWrapper);
+        return update;
+    }
+
+    /**
+     * 收购商认证
+     */
+    @PostMapping("rpc/saveAppUserInfo")
+    public Boolean saveAppUserInfo(@RequestBody AppUserDto appUser) {
+        boolean info = appUserService.saveAppUserInfo(appUser);
+        return info;
+    }
+
+
+    /**
+     * 用户数量统计
+     *
+     * @return
+     */
+    @RequestMapping("selectUsers")
+    public AjaxJson selectUsers() {
+        return AjaxJson.getSuccessData(appUserService.selectUsers());
+    }
+
+
+    /**
+     * 创建账号
+     *
+     * @param createDTO
+     */
+    @PostMapping("rpc/createAppAccount")
+    public boolean createAccount(@RequestBody AppUserCreateDTO createDTO) {
+        return appUserService.createUser(createDTO);
+    }
+
+    @PostMapping("rpc/changeBindShopStatus")
+    public void changeBindShopStatus(@RequestBody BindShopDTO bindShopDTO) {
+        appUserService.changeBindShopStatus(bindShopDTO);
+    }
+
+    /**
+     * 根据fkId查app用户
+     */
+    @PostMapping("rpc/getByFkId")
+    public AppUserDto getAppUserByFkId(@RequestParam("fkId") Long fkId) {
+        return appUserService.getAppUserByFkId(fkId);
+    }
+
+    @RequestMapping("rpc/findUserByPhone")
+    public AppUserDto findUserByPhone(@RequestParam("phone") String phone) {
+        return appUserService.findUserByPhone(phone);
+    }
+
+    @RequestMapping("rpc/bindFkId")
+    public boolean bindFkId(@RequestParam("appUserId") Long appUserId, @RequestParam("fkId") Long fkId) {
+        return appUserService.bindFkId(appUserId, fkId);
+    }
+
+    @PostMapping("rpc/updateAccount")
+    public int updateAccount(@RequestBody UpdateAccountDTO phone) {
+        return appUserService.updateAccount(phone);
+    }
+
+
 }

+ 2 - 0
sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserMapper.java

@@ -31,4 +31,6 @@ public interface AppUserMapper extends BaseMapper <AppUser> {
 	Map<String, Object> selectUsers();
 
     void changeBindShopStatus(@Param("fkId") String fkId, @Param("bindShop")Integer bindShop);
+
+    void cleanFace(String faceId);
 }

+ 3 - 0
sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserMapper.xml

@@ -19,6 +19,9 @@
     <update id="changeBindShopStatus">
 		update app_user set bind_shop=#{bindShop} where fk_id=#{fkId}
 	</update>
+    <update id="cleanFace">
+		update app_user set face_id=null,face=0,face_time=null where face_id=#{faceId}
+	</update>
 
 
     <!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->

+ 80 - 34
sp-service/sp-admin/src/main/java/com/pj/project/app_user/AppUserService.java

@@ -24,13 +24,16 @@ import com.pj.current.satoken.StpUserUtil;
 import com.pj.enummj.DeleteStatus;
 import com.pj.enummj.IsLock;
 import com.pj.enummj.UserType;
-import com.pj.face.factory.FaceFactory;
+
 import com.pj.project.app_user.dto.*;
 import com.pj.project.app_user.vo.AppUserVo;
 import com.pj.project.app_user_login_log.AppUserLoginLog;
 import com.pj.project.app_user_login_log.AppUserLoginLogService;
 import com.pj.project.re_role_menu.ReRoleMenu;
 import com.pj.project.re_role_menu.ReRoleMenuMapper;
+import com.pj.project4sp.face.factory.FaceFactory;
+import com.pj.project4sp.face.handler.VerifyVO;
+import com.pj.project4sp.utils.ImageUtils;
 import com.pj.utils.Aes;
 import com.pj.utils.cache.RedisUtil;
 import com.pj.utils.sg.AjaxError;
@@ -153,6 +156,9 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
      * @return
      */
     AppUserVo getSelfInfo() {
+        if (StpAPPUserUtil.getAPPLoginInfo().getFk() == null) {
+            return null;
+        }
         //查询当前人
         AppUser appUser = appUserMapper.selectById(StpAPPUserUtil.getAPPLoginInfo().getLoginId());
         if (appUser == null) throw new ServiceException("当前用户信息异常!");
@@ -642,7 +648,7 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
     }
 
 
-    public void authFace(Long loginId, MultipartFile file, Integer type) {
+    public void authFace(Long loginId, MultipartFile file, Integer type) throws IOException{
         String img;
         try (InputStream is = file.getInputStream()) {
             img = Base64.encode(is);
@@ -650,20 +656,21 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
         } catch (IOException e) {
             throw new AjaxError("识别失败");
         }
+        byte[]images = ImageUtils.resizeByteImageBase64(img);
+        boolean hasPerson = faceFactory.handler().checkHasPerson(images);
+        if (!hasPerson){
+            throw new AjaxError("请正视摄像头");
+        }
         if (type == 2) {
-            List<String> faceId = faceFactory.handler().faceSearch(img);
-            if (faceId.isEmpty()) {
-                throw new AjaxError("人脸不匹配");
-            }
-            AppUser appUser = null;
-            for (String id : faceId) {
-                AppUser checkUser = findByFaceId(id);
-                if (checkUser != null) {
-                    appUser = checkUser;
+            AppUser db = getById(loginId);
+            VerifyVO result = faceFactory.handler().verify(db.getFaceId(), images);
+            if (!result.isSuccess()) {
+                if (result.getMsg().contains("人员ID不存在")) {
+                    faceFactory.handler().createPersonByBase(db.getFaceId(), db.getName(), images);
+                    return;
                 }
-            }
-            if (appUser == null) {
-                throw new AjaxError("人员信息未找到");
+                log.info("Verification:{},{}", loginId);
+                throw new AjaxError("人脸不匹配");
             }
             return;
         }
@@ -672,31 +679,56 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
         appUser.setFace(1);
         appUser.setFaceTime(new Date()).setFaceId(faceId);
         this.updateById(appUser);
-        faceFactory.handler().createPersonByBase(faceId, appUser.getName(), img);
+        faceFactory.handler().createPersonByBase(faceId, appUser.getName(), images);
     }
 
-    public void authFace(Long loginId, String img) {
-        boolean isLive = faceFactory.handler().checkIsLive(img);
-        if (!isLive) {
-            log.error("人脸注册为非活体人脸:{}", loginId);
-            // throw new AjaxError("非活体人脸");
+    /**
+     * tencen:
+     * secret_id: 'AKIDtmacfdOH97likhhaL971xywwhRH7saCt'
+     * secret_key: '1DOSWWYcl2FWhw7BLOII6zz65ylOzTpS'
+     * groupId: 'gds4f56ds79w1g2d45'
+     * groupName: '天保物流'
+     *
+     * @param loginId
+     * @param img
+     * @param type
+     */
+    public void authFace(Long loginId, String img, Integer type)throws IOException {
+        byte[]byteImageBase64 = ImageUtils.resizeByteImageBase64(img);
+        boolean hasPerson = faceFactory.handler().checkHasPerson(byteImageBase64);
+        if (!hasPerson){
+            throw new AjaxError("请正视摄像头");
+        }
+        if (type == 2) {
+            AppUser db = getById(loginId);
+            String faceId = db.getFaceId();
+            if (StrUtil.isEmpty(faceId)) {
+                throw new AjaxError("人脸未录入");
+            }
+            VerifyVO result = faceFactory.handler().verify(faceId, byteImageBase64);
+            if (!result.isSuccess()) {
+                if (result.getMsg().contains("人员ID不存在")) {
+                    faceFactory.handler().createPersonByBase(faceId, db.getName(), byteImageBase64);
+                    return;
+                }
+                log.info("Verification:{},{}", loginId, img);
+                throw new AjaxError(result.getMsg());
+            }
+            return;
         }
         String faceId = RandomUtil.randomString(32);
         AppUser appUser = this.getById(loginId);
         appUser.setFace(1);
         appUser.setFaceTime(new Date()).setFaceId(faceId);
         this.updateById(appUser);
-        faceFactory.handler().createPersonByBase(faceId, appUser.getName(), img);
+        faceFactory.handler().createPersonByBase(faceId, appUser.getName(), byteImageBase64);
     }
 
     public AjaxJson faceLogin(MultipartFile file) {
         String img;
         try (InputStream is = file.getInputStream()) {
             img = Base64.encode(is);
-            boolean isLive = faceFactory.handler().checkIsLive(img);
-            if (!isLive) {
-                // throw new AjaxError("非活体人脸");
-            }
+
         } catch (IOException e) {
             throw new AjaxError("识别失败");
         }
@@ -802,16 +834,16 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
     }
 
     public AjaxJson purchaserLogin(LoginDto dto) {
-       String phone= dto.getPhone();
-       if (StrUtil.isEmpty(phone)) {
-           return AjaxJson.getError("手机号不正确");
-       }
-       String pwd= dto.getPassword();
+        String phone = dto.getPhone();
+        if (StrUtil.isEmpty(phone)) {
+            return AjaxJson.getError("手机号不正确");
+        }
+        String pwd = dto.getPassword();
         if (StrUtil.isEmpty(pwd)) {
             return AjaxJson.getError("请输入密码");
         }
         AppUser appUser = findByPhone(phone);
-        if (appUser == null|| !Objects.equals(appUser.getUserType(),UserType.USER_TYPE_PURCHASER.getCode())) {
+        if (appUser == null || !Objects.equals(appUser.getUserType(), UserType.USER_TYPE_PURCHASER.getCode())) {
             return AjaxJson.getError("账号不存在");
         }
         if (!passwordEncoder.matches(pwd, appUser.getPassword())) {
@@ -820,11 +852,11 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
         if (appUser.getStatus().equals("0")) {
             return AjaxJson.getError("该账户 " + appUser.getPhone() + " 已停用!");
         }
-        PurchaserDto purchaserDto=  FeignFactory.levelTwoServerInterface.getByPurchaserId(appUser.getFkId());
-        if (purchaserDto==null){
+        PurchaserDto purchaserDto = FeignFactory.levelTwoServerInterface.getByPurchaserId(appUser.getFkId());
+        if (purchaserDto == null) {
             return AjaxJson.getError("商户不存在或未认证");
         }
-        if (purchaserDto.getJudgeStatus()==0){
+        if (purchaserDto.getJudgeStatus() == 0) {
             return AjaxJson.getError("商户未审核");
         }
         //开始执行登录
@@ -844,4 +876,18 @@ public class AppUserService extends ServiceImpl<AppUserMapper, AppUser> implemen
         map.put("companyInfo", companyInfo);
         return AjaxJson.getSuccessData(map);
     }
+
+    public boolean bindFkId(Long appUserId, Long fkId) {
+        AppUser appUser = this.getById(appUserId);
+        if (appUser == null) {
+            return false;
+        }
+        appUser.setFkId(fkId);
+        return this.updateById(appUser);
+    }
+
+    public void cleanFace(String faceId) {
+        faceFactory.handler().deletePerson(faceId);
+        appUserMapper.cleanFace(faceId);
+    }
 }

+ 24 - 0
sp-service/sp-admin/src/main/java/com/pj/project/tb_app/AppApkController.java

@@ -0,0 +1,24 @@
+package com.pj.project.tb_app;
+
+import com.pj.utils.sg.AjaxJson;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import javax.annotation.Resource;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+
+@RestController
+@RequestMapping("app")
+public class AppApkController {
+    @Resource
+    private TbAppService appService;
+
+    @GetMapping("updateInfo")
+    public AjaxJson updateInfo() {
+        TbApp app = appService.findUpApk();
+        return AjaxJson.getSuccessData(app);
+    }
+}

+ 86 - 0
sp-service/sp-admin/src/main/java/com/pj/project/tb_app/TbApp.java

@@ -0,0 +1,86 @@
+package com.pj.project.tb_app;
+
+import java.io.Serializable;
+import java.util.*;
+import com.baomidou.mybatisplus.annotation.*;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.EqualsAndHashCode;
+
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+/**
+ * Model: tb_app -- APK管理
+ * @author lbl 
+ */
+@Data
+@Accessors(chain = true)
+@TableName(TbApp.TABLE_NAME)
+@EqualsAndHashCode(callSuper = false)
+public class TbApp extends Model<TbApp> implements Serializable {
+
+	// ---------- 模块常量 ----------
+	/**
+	 * 序列化版本id 
+	 */
+	private static final long serialVersionUID = 1L;	
+	/**
+	 * 此模块对应的表名 
+	 */
+	public static final String TABLE_NAME = "tb_app";	
+	/**
+	 * 此模块对应的权限码 
+	 */
+	public static final String PERMISSION_CODE = "tb-app";
+	public static final String PERMISSION_CODE_ADD = "tb-app-add";
+	public static final String PERMISSION_CODE_EDIT = "tb-app-edit";
+	public static final String PERMISSION_CODE_DEL = "tb-app-del";
+
+
+
+
+	// ---------- 表中字段 ----------
+	/**
+	 *  
+	 */
+	@TableId(type = IdType.AUTO)
+	private Long id;	
+
+	/**
+	 *  
+	 */
+	private String content;	
+
+	/**
+	 *  
+	 */
+	private String version;	
+
+	/**
+	 *  
+	 */
+	private String url;	
+
+	/**
+	 * 状态(0=下架,1=上架) 
+	 */
+	private Integer status;
+
+	/**
+	 * 创建时间 
+	 */
+	private Date createTime;	
+
+	/**
+	 * 更新时间 
+	 */
+	private Date updateTime;	
+
+
+
+
+
+	
+
+
+}

+ 93 - 0
sp-service/sp-admin/src/main/java/com/pj/project/tb_app/TbAppController.java

@@ -0,0 +1,93 @@
+package com.pj.project.tb_app;
+
+import java.util.List;
+import com.pj.utils.so.SoMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import com.pj.utils.sg.*;
+import com.pj.project4sp.SP;
+
+import cn.dev33.satoken.annotation.SaCheckPermission;
+
+
+/**
+ * Controller: tb_app -- APK管理
+ * @author lbl 
+ */
+@RestController
+@RequestMapping("/TbApp/")
+public class TbAppController {
+
+	/** 底层 Service 对象 */
+	@Autowired
+	TbAppService tbAppService;
+
+	/** 增 */  
+	@RequestMapping("add")
+	@SaCheckPermission(TbApp.PERMISSION_CODE_ADD)
+	public AjaxJson add(TbApp t){
+		tbAppService.add(t);
+		t = tbAppService.getById(SP.publicMapper.getPrimarykey());
+		return AjaxJson.getSuccessData(t);
+	}
+
+	/** 删 */  
+	@RequestMapping("delete")
+	@SaCheckPermission(TbApp.PERMISSION_CODE_DEL)
+	public AjaxJson delete(Long id){
+		 tbAppService.delete(id);
+		return AjaxJson.getSuccess();
+	}
+	
+	/** 删 - 根据id列表 */  
+	@RequestMapping("deleteByIds")
+	@SaCheckPermission(TbApp.PERMISSION_CODE_DEL)
+	public AjaxJson deleteByIds(){
+		List<Long> ids = SoMap.getRequestSoMap().getListByComma("ids", long.class); 
+		int line = SP.publicMapper.deleteByIds(TbApp.TABLE_NAME, ids);
+		return AjaxJson.getByLine(line);
+	}
+	
+	/** 改 */  
+	@RequestMapping("update")
+	@SaCheckPermission(TbApp.PERMISSION_CODE_EDIT)
+	public AjaxJson update(TbApp t){
+		tbAppService.update(t);
+		return AjaxJson.getSuccess();
+	}
+
+	/** 查 - 根据id */  
+	@RequestMapping("getById")
+		@SaCheckPermission(TbApp.PERMISSION_CODE)
+	public AjaxJson getById(Long id){
+		TbApp t = tbAppService.getById(id);
+		return AjaxJson.getSuccessData(t);
+	}
+
+	/** 查集合 - 根据条件(参数为空时代表忽略指定条件) */  
+	@RequestMapping("getList")
+		@SaCheckPermission(TbApp.PERMISSION_CODE)
+	public AjaxJson getList() { 
+		SoMap so = SoMap.getRequestSoMap();
+		List<TbApp> list = tbAppService.getList(so.startPage());
+		return AjaxJson.getPageData(so.getDataCount(), list);
+	}
+	
+	
+	
+	/** 改 - 状态(0=下架,1=上架) */  
+	@RequestMapping("updateStatus")
+	@SaCheckPermission(TbApp.PERMISSION_CODE_EDIT)
+	public AjaxJson updateStatus(Long id, Integer value){
+		int line =tbAppService.updateStatus(id, value);
+		return AjaxJson.getByLine(line);
+	}
+	
+	
+
+	
+	
+	
+
+}

+ 31 - 0
sp-service/sp-admin/src/main/java/com/pj/project/tb_app/TbAppMapper.java

@@ -0,0 +1,31 @@
+package com.pj.project.tb_app;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Mapper;
+
+import com.pj.utils.so.*;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.springframework.stereotype.Repository;
+
+/**
+ * Mapper: tb_app -- APK管理
+ * @author lbl 
+ */
+
+@Mapper
+@Repository
+public interface TbAppMapper extends BaseMapper <TbApp> {
+
+
+
+	/**
+	 * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+	 * @param so 参数集合 
+	 * @return 数据列表 
+	 */
+	List<TbApp> getList(SoMap so);
+
+
+
+}

+ 53 - 0
sp-service/sp-admin/src/main/java/com/pj/project/tb_app/TbAppMapper.xml

@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.pj.project.tb_app.TbAppMapper">
+
+
+
+
+	<!-- ================================== 查询相关 ================================== -->
+	<!-- select id, content, version, url, status, create_time, update_time from tb_app  -->
+	
+	<!-- 通用映射:自动模式 -->
+	<resultMap id="model" autoMapping="true" type="com.pj.project.tb_app.TbApp"></resultMap>
+	
+	<!-- 公共查询sql片段 -->
+	<sql id="select_sql">
+		select * 
+		from tb_app 
+	</sql>
+
+	
+	<!-- 查集合 - 根据条件(参数为空时代表忽略指定条件) [G] -->
+	<select id="getList" resultMap="model">
+		<include refid="select_sql"></include>
+		<where>
+			<if test=' this.has("id") '> and id = #{id} </if>
+			<if test=' this.has("content") '> and content = #{content} </if>
+			<if test=' this.has("version") '> and version = #{version} </if>
+			<if test=' this.has("url") '> and url = #{url} </if>
+			<if test=' this.has("status") '> and status = #{status} </if>
+		</where>
+		order by
+		<choose>
+			<when test='sortType == 1'> id desc </when>
+			<when test='sortType == 2'> content desc </when>
+			<when test='sortType == 3'> version desc </when>
+			<when test='sortType == 4'> url desc </when>
+			<when test='sortType == 5'> status desc </when>
+			<when test='sortType == 6'> create_time desc </when>
+			<when test='sortType == 7'> update_time desc </when>
+			<otherwise> id desc </otherwise>
+		</choose>
+	</select>
+	
+	
+	
+	
+	
+	
+	
+	
+	
+
+</mapper>

+ 85 - 0
sp-service/sp-admin/src/main/java/com/pj/project/tb_app/TbAppService.java

@@ -0,0 +1,85 @@
+package com.pj.project.tb_app;
+
+import java.util.Date;
+import java.util.List;
+
+import com.pj.utils.so.SoMap;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.transaction.annotation.Transactional;
+
+/**
+ * Service: tb_app -- APK管理
+ *
+ * @author lbl
+ */
+@Service
+@Transactional(rollbackFor = Exception.class)
+public class TbAppService extends ServiceImpl<TbAppMapper, TbApp> implements IService<TbApp> {
+
+    /**
+     * 底层 Mapper 对象
+     */
+    @Autowired
+    TbAppMapper tbAppMapper;
+
+    /**
+     * 增
+     */
+    void add(TbApp t) {
+        t.setCreateTime(new Date());
+        save(t);
+    }
+
+    /**
+     * 删
+     */
+    void delete(Long id) {
+        removeById(id);
+    }
+
+    /**
+     * 改
+     */
+    void update(TbApp t) {
+        updateById(t);
+
+    }
+
+    /**
+     * 查
+     */
+    TbApp getById(Long id) {
+        return super.getById(id);
+    }
+
+    /**
+     * 查集合 - 根据条件(参数为空时代表忽略指定条件)
+     */
+    List<TbApp> getList(SoMap so) {
+        return tbAppMapper.getList(so);
+    }
+
+
+    public int updateStatus(Long id, Integer status) {
+        TbApp app = super.getById(id);
+        if (app == null) {
+            return 0;
+        }
+        app.setStatus(status);
+        app.setUpdateTime(new Date());
+        return super.updateById(app) ? 1 : 0;
+    }
+
+    public TbApp findUpApk() {
+        SoMap so = new SoMap();
+        so.put("status", 1);
+        List<TbApp> list = getList(so);
+        if (list!= null && list.size() > 0) {
+            return list.get(0);
+        }
+        return null;
+    }
+}

+ 7 - 2
sp-core/sp-base/src/main/java/com/pj/face/brand/FaceBrand.java → sp-service/sp-admin/src/main/java/com/pj/project4sp/face/brand/FaceBrand.java

@@ -1,4 +1,4 @@
-package com.pj.face.brand;
+package com.pj.project4sp.face.brand;
 
 import lombok.AllArgsConstructor;
 import lombok.Getter;
@@ -17,7 +17,12 @@ public enum FaceBrand {
     /**
      * 百度云
      */
-    BAIDU_SMS("baidu");
+    BAIDU_SMS("baidu"),
+    /**
+     * 虹软
+     */
+    ARCSOFT(""),
+    ;
 
     private String type;
 }

+ 60 - 0
sp-service/sp-admin/src/main/java/com/pj/project4sp/face/factory/FaceEngineFactory.java

@@ -0,0 +1,60 @@
+package com.pj.project4sp.face.factory;
+
+import com.arcsoft.face.EngineConfiguration;
+import com.arcsoft.face.FaceEngine;
+import com.arcsoft.face.enums.ErrorInfo;
+import com.pj.current.config.SystemObject;
+import com.pj.utils.sg.AjaxError;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.pool2.BasePooledObjectFactory;
+import org.apache.commons.pool2.PooledObject;
+import org.apache.commons.pool2.impl.DefaultPooledObject;
+
+@Slf4j
+public class FaceEngineFactory extends BasePooledObjectFactory<FaceEngine> {
+
+    private String appId;
+    private String sdkKey;
+    private String activeKey;
+    private EngineConfiguration engineConfiguration;
+
+
+    public FaceEngineFactory(String appId, String sdkKey, String activeKey, EngineConfiguration engineConfiguration) {
+        this.appId = appId;
+        this.sdkKey = sdkKey;
+        this.activeKey = activeKey;
+        this.engineConfiguration = engineConfiguration;
+    }
+
+
+    @Override
+    public FaceEngine create() {
+
+
+        FaceEngine faceEngine = new FaceEngine(SystemObject.config.getFaceLibs());
+        int activeCode = faceEngine.activeOnline(appId, sdkKey);
+        if (activeCode != ErrorInfo.MOK.getValue() && activeCode != ErrorInfo.MERR_ASF_ALREADY_ACTIVATED.getValue()) {
+            log.error("引擎激活失败" + activeCode);
+            throw new AjaxError( "引擎激活失败" + activeCode);
+        }
+        int initCode = faceEngine.init(engineConfiguration);
+        if (initCode != ErrorInfo.MOK.getValue()) {
+            log.error("引擎初始化失败" + initCode);
+            throw new AjaxError("引擎初始化失败" + initCode);
+        }
+        return faceEngine;
+    }
+
+    @Override
+    public PooledObject<FaceEngine> wrap(FaceEngine faceEngine) {
+        return new DefaultPooledObject<>(faceEngine);
+    }
+
+
+    @Override
+    public void destroyObject(PooledObject<FaceEngine> p) throws Exception {
+        FaceEngine faceEngine = p.getObject();
+        int result = faceEngine.unInit();
+        super.destroyObject(p);
+    }
+}

+ 2 - 5
sp-core/sp-base/src/main/java/com/pj/face/factory/FaceFactory.java → sp-service/sp-admin/src/main/java/com/pj/project4sp/face/factory/FaceFactory.java

@@ -1,14 +1,11 @@
-package com.pj.face.factory;
+package com.pj.project4sp.face.factory;
 
 
-import com.pj.current.config.MyConfig;
 import com.pj.current.config.SystemObject;
-import com.pj.face.handler.IFaceHandler;
-import com.pj.sms.handler.ISmsHandler;
+import com.pj.project4sp.face.handler.IFaceHandler;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import javax.annotation.Resource;
 import java.util.List;
 
 @Service

+ 11 - 5
sp-core/sp-base/src/main/java/com/pj/face/handler/IFaceHandler.java → sp-service/sp-admin/src/main/java/com/pj/project4sp/face/handler/IFaceHandler.java

@@ -1,8 +1,6 @@
-package com.pj.face.handler;
+package com.pj.project4sp.face.handler;
 
-import com.pj.common.core.utils.sign.Base64;
-import com.pj.face.brand.FaceBrand;
-import com.pj.sms.brand.SmsType;
+import com.pj.project4sp.face.brand.FaceBrand;
 
 import java.util.List;
 
@@ -27,6 +25,12 @@ public interface IFaceHandler {
      * @param imageBase 图片base64
      */
     void createPersonByBase(String faceId, String name, String imageBase);
+    void createPersonByBase(String faceId, String name, byte[] imageBase);
+
+    void deletePerson(String faceId);
+    boolean checkHasPerson(String img);
+
+    boolean checkHasPerson( byte[] imageBase);
 
     /**
      * 检查校验
@@ -34,7 +38,9 @@ public interface IFaceHandler {
      * @param baseImage
      * @return
      */
-    boolean verify(String faceId, String baseImage);
+    VerifyVO verify(String faceId, String baseImage);
+
+    VerifyVO verify(String faceId, byte[] imageBytes);
 
     /**
      * 人脸搜索

+ 9 - 0
sp-service/sp-admin/src/main/java/com/pj/project4sp/face/handler/VerifyVO.java

@@ -0,0 +1,9 @@
+package com.pj.project4sp.face.handler;
+
+import lombok.Data;
+
+@Data
+public class VerifyVO {
+    private String msg;
+    private boolean success;
+}

+ 223 - 0
sp-service/sp-admin/src/main/java/com/pj/project4sp/face/handler/impl/ArcsoftFaceHandlerImpl.java

@@ -0,0 +1,223 @@
+package com.pj.project4sp.face.handler.impl;
+
+import cn.hutool.core.io.FileUtil;
+import cn.hutool.core.util.StrUtil;
+import com.arcsoft.face.*;
+import com.arcsoft.face.enums.DetectMode;
+import com.arcsoft.face.enums.DetectOrient;
+import com.arcsoft.face.toolkit.ImageFactory;
+import com.arcsoft.face.toolkit.ImageInfo;
+import com.pj.current.config.SystemObject;
+import com.pj.project4sp.face.brand.FaceBrand;
+import com.pj.project4sp.face.factory.FaceEngineFactory;
+import com.pj.project4sp.face.handler.IFaceHandler;
+import com.pj.project4sp.face.handler.VerifyVO;
+import com.pj.utils.sg.AjaxError;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.pool2.impl.GenericObjectPool;
+import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
+import org.springframework.context.annotation.DependsOn;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.PostConstruct;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Base64;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import static com.arcsoft.face.toolkit.ImageFactory.getRGBData;
+
+/**
+ * 基于ArcSoft Face的人��识别
+ */
+@Service
+@Slf4j
+@DependsOn({"systemObject"})
+public class ArcsoftFaceHandlerImpl implements IFaceHandler {
+
+    //通用人脸识别引擎池
+    private GenericObjectPool<FaceEngine> faceEngineGeneralPool;
+
+
+
+    private ExecutorService compareExecutorService;
+
+    @Override
+    public boolean checkIsLive(String baseImg) {
+        List<LivenessInfo> livenessInfoList = new ArrayList<>();
+        FaceEngine faceEngine = null;
+        try {
+            faceEngine = faceEngineGeneralPool.borrowObject();
+            faceEngine.getLiveness(livenessInfoList);
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new AjaxError("获取识别引擎失败");
+        } finally {
+            if (faceEngine != null) {
+                faceEngineGeneralPool.returnObject(faceEngine);
+            }
+        }
+        return livenessInfoList.get(0).getLiveness() == 1;
+    }
+
+    @Override
+    public void createPersonByBase(String faceId, String name, String imageBase) {
+        byte[] imageBytes = Base64.getDecoder().decode(imageBase);
+        this.createPersonByBase(faceId, name, imageBytes);
+
+    }
+
+    @Override
+    public void createPersonByBase(String faceId, String name, byte[] imageBytes) {
+        String facePath = SystemObject.getFaceImgPath();
+        File outputFile = new File(facePath + File.separator + faceId + ".png");
+        FileUtil.del(outputFile);
+        // 创建输出流
+        try (FileOutputStream fileOutputStream = new FileOutputStream(outputFile)) {
+            // 写入数据到文件
+            fileOutputStream.write(imageBytes);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Override
+    public void deletePerson(String faceId) {
+        String facePath = SystemObject.getFaceImgPath();
+        File outputFile = new File(facePath + File.separator + faceId + ".png");
+        FileUtil.del(outputFile);
+    }
+
+    @Override
+    public boolean checkHasPerson(String img) {
+        byte[] imageBytes = Base64.getDecoder().decode(img);
+        return this.checkHasPerson(imageBytes);
+    }
+
+    @Override
+    public boolean checkHasPerson(byte[] imageBase) {
+        ImageInfo imageInfo = getRGBData(imageBase);
+        List<FaceInfo> faceInfoList = new ArrayList<>();
+        FaceEngine faceEngine = null;
+        try {
+            faceEngine = faceEngineGeneralPool.borrowObject();
+            faceEngine.detectFaces(imageInfo.getImageData(), imageInfo.getWidth(), imageInfo.getHeight(), imageInfo.getImageFormat(), faceInfoList);
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new AjaxError("获取识别引擎失败");
+        } finally {
+            if (faceEngine != null) {
+                faceEngineGeneralPool.returnObject(faceEngine);
+            }
+        }
+        return faceInfoList.size() == 1;
+    }
+
+    @Override
+    public VerifyVO verify(String faceId, String baseImage) {
+
+
+
+        byte[] imageBytes = Base64.getDecoder().decode(baseImage);
+       return this.verify(faceId,imageBytes);
+
+    }
+
+    @Override
+    public VerifyVO verify(String faceId, byte[] imageBytes) {
+        VerifyVO vo = new VerifyVO();
+        String facePath = SystemObject.getFaceImgPath();
+        File file = new File(facePath + File.separator + faceId + ".png");
+        if (!file.exists()) {
+            vo.setMsg("人员ID不存在");
+            return vo;
+        }
+        ImageInfo sourceImageInfo = getRGBData(imageBytes);
+        List<FaceInfo> sourceFaceInfoList = new ArrayList<>();
+        FaceEngine faceEngine = null;
+        try {
+            faceEngine = faceEngineGeneralPool.borrowObject();
+            faceEngine.detectFaces(sourceImageInfo.getImageData(), sourceImageInfo.getWidth(), sourceImageInfo.getHeight(), sourceImageInfo.getImageFormat(), sourceFaceInfoList);
+            if (sourceFaceInfoList.size() == 0) {
+                vo.setMsg("No faces");
+                return vo;
+            }
+            if (sourceFaceInfoList.size() > 1) {
+                vo.setMsg("图片中存在多个人脸");
+                return vo;
+            }
+            FaceInfo faceInfo = sourceFaceInfoList.get(0);
+            FaceFeature sourceFaceFeature = new FaceFeature();
+            faceEngine.extractFaceFeature(sourceImageInfo.getImageData(), sourceImageInfo.getWidth(), sourceImageInfo.getHeight(), sourceImageInfo.getImageFormat(), faceInfo, sourceFaceFeature);
+
+            //目标图片人脸
+            List<FaceInfo> targeFaceInfoList = new ArrayList<>();
+            ImageInfo imageInfo2 = getRGBData(file);
+            faceEngine.detectFaces(imageInfo2.getImageData(), imageInfo2.getWidth(), imageInfo2.getHeight(), imageInfo2.getImageFormat(), targeFaceInfoList);
+            //特征提取
+            FaceFeature targeFaceFeature = new FaceFeature();
+            faceEngine.extractFaceFeature(imageInfo2.getImageData(), imageInfo2.getWidth(), imageInfo2.getHeight(), imageInfo2.getImageFormat(), targeFaceInfoList.get(0), targeFaceFeature);
+
+
+            FaceSimilar faceSimilar = new FaceSimilar();
+            faceEngine.compareFaceFeature(new FaceFeature(targeFaceFeature.getFeatureData()), new FaceFeature(sourceFaceFeature.getFeatureData()), faceSimilar);
+            boolean result = faceSimilar.getScore() > 0.85f;
+            String msg = result ? "人脸一致" : "不匹配";
+            vo.setSuccess(result);
+            vo.setMsg(msg);
+        } catch (Exception e) {
+            e.printStackTrace();
+            throw new AjaxError("获取识别引擎失败");
+        } finally {
+            if (faceEngine != null) {
+                faceEngineGeneralPool.returnObject(faceEngine);
+            }
+        }
+        return vo;
+    }
+
+    @Override
+    public List<String> faceSearch(String baseImg) {
+        return null;
+    }
+
+    @Override
+    public FaceBrand faceBrand() {
+        return FaceBrand.ARCSOFT;
+    }
+
+
+    @PostConstruct
+    public void init() {
+
+        if (!StrUtil.equals(SystemObject.config.getFaceType(), FaceBrand.ARCSOFT.getType())) {
+            return;
+        }
+        String appId = SystemObject.config.getArcsoftAppid();
+        String sdkKey = SystemObject.config.getArcsoftSdkKey();
+        log.info("Initializing------:{}:{}", appId, sdkKey);
+
+        GenericObjectPoolConfig detectPoolConfig = new GenericObjectPoolConfig();
+        detectPoolConfig.setMaxIdle(5);
+        detectPoolConfig.setMaxTotal(5);
+        detectPoolConfig.setMinIdle(5);
+        detectPoolConfig.setLifo(false);
+        EngineConfiguration detectCfg = new EngineConfiguration();
+        FunctionConfiguration detectFunctionCfg = new FunctionConfiguration();
+        detectFunctionCfg.setSupportFaceDetect(true);//开启人脸检测功能
+        detectFunctionCfg.setSupportFaceRecognition(true);//开启人脸识别功能
+        detectCfg.setFunctionConfiguration(detectFunctionCfg);
+        detectCfg.setDetectMode(DetectMode.ASF_DETECT_MODE_IMAGE);//图片检测模式,如果是连续帧的视频流图片,那么改成VIDEO模式
+        detectCfg.setDetectFaceOrientPriority(DetectOrient.ASF_OP_ALL_OUT);//人脸旋转角度
+        faceEngineGeneralPool = new GenericObjectPool(new FaceEngineFactory(appId, sdkKey, null, detectCfg), detectPoolConfig);//底层库算法对象池
+        compareExecutorService = Executors.newFixedThreadPool(5);
+
+
+    }
+
+
+}

+ 110 - 10
sp-core/sp-base/src/main/java/com/pj/face/handler/impl/TencenFaceHandlerImpl.java → sp-service/sp-admin/src/main/java/com/pj/project4sp/face/handler/impl/TencenFaceHandlerImpl.java

@@ -1,9 +1,13 @@
-package com.pj.face.handler.impl;
+package com.pj.project4sp.face.handler.impl;
 
-import com.pj.face.brand.FaceBrand;
-import com.pj.face.handler.IFaceHandler;
-import com.pj.face.properties.TencenProperties;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.log.StaticLog;
+import com.pj.project4sp.face.brand.FaceBrand;
+import com.pj.project4sp.face.handler.IFaceHandler;
+import com.pj.project4sp.face.handler.VerifyVO;
+import com.pj.project4sp.face.properties.TencenProperties;
 import com.pj.utils.sg.AjaxError;
+import com.tencentcloudapi.common.AbstractModel;
 import com.tencentcloudapi.common.Credential;
 import com.tencentcloudapi.common.exception.TencentCloudSDKException;
 import com.tencentcloudapi.common.profile.ClientProfile;
@@ -16,9 +20,8 @@ import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Base64;
 import java.util.List;
-import java.util.Optional;
-import java.util.concurrent.atomic.AtomicReference;
 
 /**
  * 人脸库管理地址
@@ -31,7 +34,9 @@ public class TencenFaceHandlerImpl implements IFaceHandler {
     private TencenProperties tencenProperties;
 
     @Override
-    public boolean verify(String personId, String baseImage) {
+    public VerifyVO verify(String personId, String baseImage) {
+        VerifyVO vo = new VerifyVO();
+        vo.setSuccess(false);
         IaiClient client = this.createClient();
         VerifyPersonRequest req = new VerifyPersonRequest();
         req.setImage(baseImage);
@@ -42,17 +47,30 @@ public class TencenFaceHandlerImpl implements IFaceHandler {
             resp = client.VerifyPerson(req);
         } catch (TencentCloudSDKException e) {
             log.error("verify person : {} fail,{}", personId, e.getMessage());
-            throw new AjaxError(e.getMessage());
+            StaticLog.info("verify person : {} fail,{}", personId, e.getMessage());
+            vo.setMsg(e.getMessage());
+            return vo;
         }
-        return resp != null && resp.getIsMatch();
+        boolean result = resp != null && resp.getIsMatch();
+        vo.setMsg(result ? "成功" : "不匹配");
+        vo.setSuccess(result);
+        return vo;
+    }
+
+    @Override
+    public VerifyVO verify(String faceId, byte[] imageBytes) {
+        String base64Images = Base64.getEncoder().encodeToString(imageBytes);
+        return verify(faceId, base64Images);
     }
 
     /**
      * 查找人脸库
+     *
      * @param baseImg
      * @return
      */
     public List<String> faceSearch(String baseImg) {
+        StaticLog.info("face:{}", baseImg);
         IaiClient client = this.createClient();
         SearchFacesRequest request = new SearchFacesRequest();
         request.setImage(baseImg);
@@ -65,6 +83,8 @@ public class TencenFaceHandlerImpl implements IFaceHandler {
         try {
             response = client.SearchFaces(request);
         } catch (TencentCloudSDKException e) {
+            e.printStackTrace();
+            StaticLog.error("face error: " + e.getMessage());
             throw new AjaxError("无人脸信息");
         }
         Arrays.stream(response.getResults())
@@ -86,13 +106,93 @@ public class TencenFaceHandlerImpl implements IFaceHandler {
         req.setImage(imageBase);
         // 返回的resp是一个CreatePersonResponse的实例,与请求对象对应
         try {
-            client.CreatePerson(req);
+            CreatePersonResponse response = client.CreatePerson(req);
         } catch (TencentCloudSDKException e) {
             e.printStackTrace();
         }
 
     }
 
+    @Override
+    public void createPersonByBase(String faceId, String name, byte[] imageBase) {
+        String base64Images = Base64.getEncoder().encodeToString(imageBase);
+        createPersonByBase(faceId, name, base64Images);
+    }
+
+    @Override
+    public void deletePerson(String faceId) {
+        IaiClient client = this.createClient();
+        DeletePersonRequest request = new DeletePersonRequest();
+        request.setPersonId(faceId);
+        try {
+            DeletePersonResponse response = client.DeletePerson(request);
+            String requestId = response.getRequestId();
+            log.info("delete face : {},{}", faceId, requestId);
+        } catch (TencentCloudSDKException e) {
+            log.error("delete face fail,{}", e.getMessage());
+        }
+    }
+
+    @Override
+    public boolean checkHasPerson(String img) {
+        IaiClient client = this.createClient();
+        // 实例化一个请求对象,每个接口都会对应一个request对象
+        DetectFaceRequest req = new DetectFaceRequest();
+        req.setMaxFaceNum(1L);
+        req.setNeedFaceAttributes(1L);
+        req.setNeedQualityDetection(1L);
+        req.setImage(img);
+        // 返回的resp是一个DetectFaceResponse的实例,与请求对象对应
+        DetectFaceResponse resp = null;
+        try {
+            resp = client.DetectFace(req);
+        } catch (TencentCloudSDKException e) {
+            log.error("Error while:{}", e.getMessage());
+            return false;
+        }
+        if (resp == null || StrUtil.contains(AbstractModel.toJsonString(resp), "NoFaceInPhoto")) {
+            return false;
+        }
+        // 输出json格式的字符串回包
+        log.info(AbstractModel.toJsonString(resp));
+        FaceInfo[] faceInfos = resp.getFaceInfos();
+        if (faceInfos.length > 1) {
+            throw new AjaxError("存在多个人脸");
+        }
+        FaceInfo faceInfo = faceInfos[0];
+        Long score = faceInfo.getFaceQualityInfo().getScore();
+        if (score == null || score < 80) {
+            FaceQualityInfo faceQualityInfo = faceInfo.getFaceQualityInfo();
+            Long brightness = faceQualityInfo.getBrightness();
+            if (brightness == null || brightness < 30) {
+                throw new AjaxError("光线不足");
+            }
+            if (brightness > 70) {
+                throw new AjaxError("光线太亮");
+            }
+            FaceQualityCompleteness completeness = faceQualityInfo.getCompleteness();
+            if (completeness.getMouth() == null || completeness.getMouth() < 50) {
+                throw new AjaxError("请露出嘴巴");
+            }
+            if (completeness.getChin()==null||completeness.getChin()<70) {
+                throw new AjaxError("请露出下巴");
+            }
+            FaceAttributesInfo faceAttributesInfo = faceInfo.getFaceAttributesInfo();
+            if (!faceAttributesInfo.getEyeOpen()) {
+                throw new AjaxError("请睁开眼");
+            }
+
+        }
+
+        return true;
+    }
+
+    @Override
+    public boolean checkHasPerson(byte[] imageBase) {
+        String base64Images = Base64.getEncoder().encodeToString(imageBase);
+        return checkHasPerson(base64Images);
+    }
+
     public boolean checkIsLive(String baseImg) {
         IaiClient client = this.createClient();
         DetectLiveFaceRequest req = new DetectLiveFaceRequest();

+ 111 - 0
sp-service/sp-admin/src/main/java/com/pj/project4sp/face/handler/impl/TencenRespBO.java

@@ -0,0 +1,111 @@
+package com.pj.project4sp.face.handler.impl;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.io.Serializable;
+import java.util.List;
+
+@NoArgsConstructor
+@Data
+public class TencenRespBO implements Serializable {
+
+    @JsonProperty("ImageWidth")
+    private Integer imageWidth;
+    @JsonProperty("ImageHeight")
+    private Integer imageHeight;
+    @JsonProperty("FaceInfos")
+    private List<FaceInfosDTO> faceInfos;
+    @JsonProperty("FaceModelVersion")
+    private String faceModelVersion;
+    @JsonProperty("RequestId")
+    private String requestId;
+
+    @NoArgsConstructor
+    @Data
+    public static class FaceInfosDTO {
+        @JsonProperty("X")
+        private Integer x;
+        @JsonProperty("Y")
+        private Integer y;
+        @JsonProperty("Width")
+        private Integer width;
+        @JsonProperty("Height")
+        private Integer height;
+        @JsonProperty("FaceAttributesInfo")
+        private FaceAttributesInfoDTO faceAttributesInfo;
+        @JsonProperty("FaceQualityInfo")
+        private FaceQualityInfoDTO faceQualityInfo;
+
+        @NoArgsConstructor
+        @Data
+        public static class FaceAttributesInfoDTO {
+            @JsonProperty("Gender")
+            private Integer gender;
+            @JsonProperty("Age")
+            private Integer age;
+            @JsonProperty("Expression")
+            private Integer expression;
+            @JsonProperty("Hat")
+            private Boolean hat;
+            @JsonProperty("Glass")
+            private Boolean glass;
+            @JsonProperty("EyeOpen")
+            private Boolean eyeOpen;
+            @JsonProperty("Mask")
+            private Boolean mask;
+            @JsonProperty("Hair")
+            private HairDTO hair;
+            @JsonProperty("Pitch")
+            private Integer pitch;
+            @JsonProperty("Yaw")
+            private Integer yaw;
+            @JsonProperty("Roll")
+            private Integer roll;
+            @JsonProperty("Beauty")
+            private Integer beauty;
+
+            @NoArgsConstructor
+            @Data
+            public static class HairDTO {
+                @JsonProperty("Length")
+                private Integer length;
+                @JsonProperty("Bang")
+                private Integer bang;
+                @JsonProperty("Color")
+                private Integer color;
+            }
+        }
+
+        @NoArgsConstructor
+        @Data
+        public static class FaceQualityInfoDTO {
+            @JsonProperty("Score")
+            private Integer score;
+            @JsonProperty("Sharpness")
+            private Integer sharpness;
+            @JsonProperty("Brightness")
+            private Integer brightness;
+            @JsonProperty("Completeness")
+            private CompletenessDTO completeness;
+
+            @NoArgsConstructor
+            @Data
+            public static class CompletenessDTO {
+                @JsonProperty("Eyebrow")
+                private Integer eyebrow;
+                @JsonProperty("Eye")
+                private Integer eye;
+                @JsonProperty("Nose")
+                private Integer nose;
+                @JsonProperty("Cheek")
+                private Integer cheek;
+                @JsonProperty("Mouth")
+                private Integer mouth;
+                @JsonProperty("Chin")
+                private Integer chin;
+            }
+        }
+    }
+}

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio