Browse Source

提供客户查询接口

wanglang 2 weeks ago
parent
commit
003a9d68dc

+ 8 - 0
trade-admin/pom.xml

@@ -40,6 +40,14 @@
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-web</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-openfeign</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-loadbalancer</artifactId>
+        </dependency>
         <dependency>
             <groupId>org.springframework.boot</groupId>
             <artifactId>spring-boot-starter-test</artifactId>

+ 4 - 1
trade-admin/src/main/java/com/trade/admin/TradeAdminApplication.java

@@ -4,6 +4,7 @@ import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import org.springframework.cloud.openfeign.EnableFeignClients;
 import org.springframework.scheduling.annotation.EnableScheduling;
 
 @SpringBootApplication(exclude = {
@@ -12,9 +13,11 @@ import org.springframework.scheduling.annotation.EnableScheduling;
         "com.trade.*"
 })
 @MapperScan({
-        "com.trade.admin.*.mapper", "com.trade.admin.*.*.mapper","com.trade.service.*.mapper","com.trade.service.*.*.mapper"
+        "com.trade.admin.*.mapper", "com.trade.admin.*.*.mapper", "com.trade.service.*.mapper",
+        "com.trade.service.*.*.mapper"
 })
 @EnableScheduling
+@EnableFeignClients
 public class TradeAdminApplication {
 
     public static void main(String[] args) {

+ 22 - 0
trade-admin/src/main/java/com/trade/admin/enterprise/customer/dto/CustomerUserDto.java

@@ -0,0 +1,22 @@
+package com.trade.admin.enterprise.customer.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * @description:
+ * @Author: wanglang
+ * @Date: 2024/11/7 14:44
+ * @Version: 1.0
+ */
+@Data
+public class CustomerUserDto {
+
+    @ApiModelProperty(name = "identifierNo", value = "账号ID")
+    private String identifierNo;
+    @ApiModelProperty(name = "nickname", value = "昵称/会员名称")
+    private String nickname;
+    private String xtUid;
+    private String phoneNumber;
+    private String email;
+}

+ 28 - 0
trade-admin/src/main/java/com/trade/admin/enterprise/customer/service/CustomerUserService.java

@@ -0,0 +1,28 @@
+package com.trade.admin.enterprise.customer.service;
+
+import com.trade.admin.enterprise.customer.dto.CustomerUserDto;
+import com.trade.common.core.domain.ResponseResult;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+/**
+ * @description:
+ * @Author: wanglang
+ * @Date: 2024/11/7
+ * @Version: 1.0
+ */
+@Component
+@FeignClient(name = "trade-client")
+public interface CustomerUserService {
+
+    /**
+     * 获取C端客户用户信息
+     *
+     * @param customerUserId customerUserId
+     * @return true/false
+     */
+    @GetMapping("/client/api/customerUser/get")
+    ResponseResult<CustomerUserDto> getCustomerUser(@RequestParam(value = "customerUserId") String customerUserId);
+}

+ 16 - 0
trade-admin/src/main/java/com/trade/admin/finance/paymentcollection/service/impl/BPaymentCollectionServiceImpl.java

@@ -4,6 +4,8 @@ import com.alibaba.fastjson2.JSON;
 import com.github.pagehelper.Page;
 import com.github.pagehelper.PageHelper;
 import com.trade.admin.business.separateaccounts.service.BSeparateAccountsService;
+import com.trade.admin.enterprise.customer.dto.CustomerUserDto;
+import com.trade.admin.enterprise.customer.service.CustomerUserService;
 import com.trade.admin.finance.paymentcollection.dto.BankAccountDto;
 import com.trade.admin.finance.paymentcollection.dto.BillingIncomeDetailDto;
 import com.trade.admin.finance.paymentcollection.dto.BillingIncomeInfoDto;
@@ -11,8 +13,11 @@ import com.trade.admin.finance.paymentcollection.dto.TradeRepaymentDto;
 import com.trade.admin.finance.paymentcollection.service.BPaymentCollectionService;
 import com.trade.admin.system.security.utils.SecurityUtils;
 import com.trade.admin.trade.exportrebate.service.ExportTaxRebateService;
+import com.trade.common.constant.HttpStatus;
+import com.trade.common.core.domain.ResponseResult;
 import com.trade.common.core.page.GridPage;
 import com.trade.common.exception.ServiceException;
+import com.trade.common.utils.DateUtils;
 import com.trade.common.utils.LoggerUtil;
 import com.trade.common.utils.StringUtils;
 import com.trade.common.utils.bean.BeanCopyUtils;
@@ -97,6 +102,8 @@ public class BPaymentCollectionServiceImpl implements BPaymentCollectionService
     private OrderReceivePaymentAssociationService orderReceivePaymentAssociationService;
     @Resource
     private ISalesOrderGoodsService iSalesOrderGoodsService;
+    @Resource
+    private CustomerUserService customerUserService;
 
     @Override
     public GridPage<BillingIncomePageVo> queryListByPage(BillingIncomeSearchDto incomeSearchDto) {
@@ -236,6 +243,15 @@ public class BPaymentCollectionServiceImpl implements BPaymentCollectionService
                 }
             }
         }
+        if (BillingConstant.PAYMENT_TYPE_EXPORT_TAX_REFUND_SERVICE_FEE.equals(income.getPaymentType())) {
+            ResponseResult<CustomerUserDto> customerUserRr = customerUserService
+                    .getCustomerUser(String.valueOf(income.getCustomerUserId()));
+            if (customerUserRr.getCode() != HttpStatus.SUCCESS || customerUserRr.getData() == null) {
+                throw new ServiceException("获取客户信息异常", HttpStatus.BAD_REQUEST);
+            }
+            enterpriseBaseService.taxRebateServiceFeePayment(income.getCustomerUserId(),
+                    customerUserRr.getData().getXtUid(), DateUtils.parseLocalDate2Date(reviewDto.getActualEntryDate()));
+        }
         try {
             if (fileStorage != null) {
                 filingDocService.newTaskBySalesOrderNo(income.getSaleOrderNo(), 2);

+ 9 - 4
trade-admin/src/main/java/com/trade/admin/trade/purchaseorder/controller/PurchaseInvoiceApiController.java

@@ -1,11 +1,10 @@
 package com.trade.admin.trade.purchaseorder.controller;
 
+import com.trade.admin.enterprise.customer.dto.CustomerUserDto;
+import com.trade.admin.enterprise.customer.service.CustomerUserService;
 import com.trade.admin.job.PurchaseInvoiceSchedule;
 import com.trade.common.core.domain.ResponseResult;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import javax.annotation.Resource;
 import java.util.List;
@@ -22,10 +21,16 @@ public class PurchaseInvoiceApiController {
 
     @Resource
     private PurchaseInvoiceSchedule purchaseInvoiceSchedule;
+    @Resource
+    private CustomerUserService customerUserService;
 
     @PostMapping("/pullInvoiceDetail")
     public ResponseResult<Boolean> pullInvoiceDetail(@RequestBody List<Long> orderIds) {
         purchaseInvoiceSchedule.pullInvoiceDetail(orderIds);
         return ResponseResult.success(true);
     }
+    @GetMapping("/getCustomerUser")
+    public ResponseResult<CustomerUserDto> getCustomerUser(String userId) {
+        return customerUserService.getCustomerUser(userId);
+    }
 }

+ 45 - 0
trade-client/src/main/java/com/trade/client/enterprise/customer/controller/CustomerUserApiController.java

@@ -0,0 +1,45 @@
+/**
+ * @filename:CustomerUserApiController 2024年11月07日
+ * @project trade-client V1.0 Copyright(c) 2024 wanglang Co. Ltd. All right reserved.
+ */
+package com.trade.client.enterprise.customer.controller;
+
+import javax.annotation.Resource;
+
+import org.springframework.web.bind.annotation.*;
+
+import com.trade.client.enterprise.customer.domain.CustomerUser;
+
+import com.trade.client.enterprise.customer.service.CustomerUserService;
+import com.trade.common.core.domain.ResponseResult;
+
+import io.swagger.annotations.Api;
+
+/**
+ * <p>
+ * 说明: 客户API接口
+ * </P>
+ * 
+ * @version: V1.0
+ * @author: wanglang
+ * @date: 2024年11月07日
+ */
+@Api(tags = "客户API接口", value = "客户API接口")
+@RestController
+@RequestMapping("/api/customerUser")
+public class CustomerUserApiController {
+
+    @Resource
+    private CustomerUserService customerUserService;
+
+    /**
+     * 获取客户id
+     *
+     * @param customerUserId 客户id
+     * @return ResponseResult<CustomerUser>
+     */
+    @GetMapping(value = "/get")
+    public ResponseResult<CustomerUser> checkCode(String customerUserId) {
+        return ResponseResult.success(customerUserService.getById(customerUserId));
+    }
+}

+ 2 - 3
trade-client/src/main/java/com/trade/client/security/config/WebSecurityConfigurer.java

@@ -71,14 +71,13 @@ public class WebSecurityConfigurer {
                 .permitAll()
                 // 对于登录login 注册register 验证码captchaImage 允许匿名访问
                 .antMatchers("/customerUser/login", "/customerUser/register", "/captchaImage", "/test/**",
-                        "/message/sendSms", "/customerUser/update/pwd", "/creditScoreQuota/**", "/qcc/**",
+                        "/message/sendSms", "/customerUser/update/pwd", "/creditScoreQuota/**", "/qcc/**", "/api/**",
                         "/notice/signStatus", "/file_storage_oss/preview/**")
                 .permitAll().antMatchers("/fileResource/**/*.png", "/fileResource/**/*.jpg", "/fileResource/**/*.jpeg")
                 .permitAll()
                 // 静态资源,可匿名访问
                 .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js").permitAll()
-                .antMatchers("/swagger-ui.html", "/swagger-resources/**",
-                        "/webjars/**", "/*/api-docs", "/druid/**")
+                .antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**")
                 .permitAll()
                 // 除上面外的所有请求全部需要鉴权认证
                 .anyRequest().authenticated().and().headers().frameOptions().disable();