3 Commits e002ed0ab1 ... c20fe83d3a

Autor SHA1 Mensagem Data
  wanglang c20fe83d3a Merge branch 'master' of http://192.168.0.200:3000/wanglang/trade-platform 1 mês atrás
  wanglang 77e5432d6c 解决冲突 1 mês atrás
  wanglang 56d4a3691a 小图商品相关 1 mês atrás
14 arquivos alterados com 266 adições e 5 exclusões
  1. 1 1
      trade-client/src/main/java/com/trade/client/enterprise/customer/domain/model/LoginMo.java
  2. 15 0
      trade-client/src/main/java/com/trade/client/trade/salescontract/controller/SalesContractController.java
  3. 11 0
      trade-client/src/main/java/com/trade/client/trade/salescontract/service/SalesService.java
  4. 17 1
      trade-client/src/main/java/com/trade/client/trade/salescontract/service/impl/SalesServiceImpl.java
  5. 1 0
      trade-client/src/main/java/com/trade/client/tradingplatform/TradingPlatformService.java
  6. 2 1
      trade-client/src/main/java/com/trade/client/tradingplatform/controller/TradingPlatformController.java
  7. 2 2
      trade-service/src/main/java/com/trade/service/TransStruct.java
  8. 39 0
      trade-service/src/main/java/com/trade/service/system/domain/SuperviseCertificateCode.java
  9. 19 0
      trade-service/src/main/java/com/trade/service/system/mapper/SuperviseCertificateCodeMapper.java
  10. 24 0
      trade-service/src/main/java/com/trade/service/system/service/SuperviseCertificateCodeService.java
  11. 26 0
      trade-service/src/main/java/com/trade/service/system/service/impl/SuperviseCertificateCodeServiceImpl.java
  12. 18 0
      trade-service/src/main/java/com/trade/service/trade/salescontract/service/SalesCommodityService.java
  13. 72 0
      trade-service/src/main/java/com/trade/service/trade/salescontract/service/impl/SalesCommodityServiceImpl.java
  14. 19 0
      trade-service/src/main/resources/mapper/system/SuperviseCertificateCodeMapper.xml

+ 1 - 1
trade-client/src/main/java/com/trade/client/enterprise/customer/domain/model/LoginMo.java

@@ -25,7 +25,7 @@ public class LoginMo {
      * 用户密码
      */
     @NotEmpty(message = "密码不能为空")
-    @Pattern(regexp = "[a-zA-Z0-9]{6,16}", message = "密码必须是6~16位数字和字母的组合")
+    @Pattern(regexp = "^(?=.*[a-zA-Z])(?=.*\\d)(?=.*[@#$%^&*_+-=]).{8,16}$", message = "密码必须是8~16位数字、字母以及特殊字符的组合")
     private String password;
 
     public String getUserName() {

+ 15 - 0
trade-client/src/main/java/com/trade/client/trade/salescontract/controller/SalesContractController.java

@@ -8,6 +8,7 @@ import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import com.trade.service.trade.salescontract.dto.SalesCommodityDto;
 import com.trade.service.trade.salescontract.vo.ImportCommodityVo;
 import org.springframework.web.bind.annotation.*;
 
@@ -24,6 +25,8 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.List;
+
 /**
  * <p>
  * 说明: 销售合同基础信息API接口层
@@ -141,4 +144,16 @@ public class SalesContractController {
     public ResponseResult<ImportCommodityVo> importCommodityFile(@RequestParam("file") MultipartFile file) {
         return ResponseResult.success(salesService.importCommodityFile(file));
     }
+
+    /**
+     * 查询小图商品
+     *
+     * @param name 商品名称
+     * @return 商品信息
+     */
+    @ApiOperation(value = "查询小图商品", notes = "查询小图商品")
+    @GetMapping("/get/commodity")
+    public ResponseResult<List<SalesCommodityDto>> getXiaoTuCommodityList(String name) {
+        return ResponseResult.success(salesService.getXiaoTuCommodityList(name));
+    }
 }

+ 11 - 0
trade-client/src/main/java/com/trade/client/trade/salescontract/service/SalesService.java

@@ -7,11 +7,14 @@ import com.trade.client.trade.salescontract.dto.SalesContractInfoDto;
 import com.trade.common.core.page.GridPage;
 import com.trade.service.trade.salescontract.dto.ContractSearchDto;
 import com.trade.service.trade.salescontract.dto.ContractTermsDto;
+import com.trade.service.trade.salescontract.dto.SalesCommodityDto;
 import com.trade.service.trade.salescontract.vo.ImportCommodityVo;
 import com.trade.service.trade.salescontract.vo.SalesContractInfoVo;
 import com.trade.service.trade.salescontract.vo.SalesContractVo;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.List;
+
 /**
  * @description:销售服务接口
  * @Author: wanglang
@@ -87,4 +90,12 @@ public interface SalesService {
      * @return 商品信息
      */
     ImportCommodityVo importCommodityFile(MultipartFile file);
+
+    /**
+     * 根据商品名称和客户id查询销售商品
+     *
+     * @param name
+     * @return List<SalesCommodityDto>
+     */
+    List<SalesCommodityDto> getXiaoTuCommodityList(String name);
 }

+ 17 - 1
trade-client/src/main/java/com/trade/client/trade/salescontract/service/impl/SalesServiceImpl.java

@@ -322,9 +322,9 @@ public class SalesServiceImpl implements SalesService {
         List<SalesCommodityDto> pass = new ArrayList<>();
         List<SalesCommodityDto> error = new ArrayList<>();
         Iterator<Row> rows = sheet.rowIterator();
+        CustomerUser customerUser = customerUserService.getCustomerUser();
         EnterpriseDto enterpriseDto = enterpriseService.queryMyEnterprise();
         String exportType = enterpriseDto.getExportType();
-        // todo 缺少与小图接口校验部分
         while (rows.hasNext()) {
             Row row = rows.next();
             if (row.getRowNum() == 0) {
@@ -359,6 +359,16 @@ public class SalesServiceImpl implements SalesService {
             cell = row.getCell(2);
             if (cell != null && StringUtils.isNotBlank(cell.getStringCellValue())) {
                 salesCommodityDto.setHsCode(cell.getStringCellValue());
+                List<SalesCommodityDto> salesCommodityDtos = salesCommodityService.getXiaoTuCommodityList(
+                        salesCommodityDto.getHsCode(), customerUser.getXtUid(), customerUser.getId(), false);
+                if (salesCommodityDtos != null && salesCommodityDtos.size() > 0) {
+                    SalesCommodityDto salesCommodityTemp = salesCommodityDtos.get(0);
+                    if (StringUtils.isNotEmpty(salesCommodityTemp.getErrors())) {
+                        stringBuffer.append(salesCommodityTemp.getErrors() + ",");
+                    }
+                } else {
+                    stringBuffer.append("商品不存在,");
+                }
             } else {
                 stringBuffer.append("HS编码为空,");
             }
@@ -406,6 +416,12 @@ public class SalesServiceImpl implements SalesService {
         return importCommodityVo;
     }
 
+    @Override
+    public List<SalesCommodityDto> getXiaoTuCommodityList(String name) {
+        CustomerUser customerUser = customerUserService.getCustomerUser();
+        return salesCommodityService.getXiaoTuCommodityList(name, customerUser.getXtUid(), customerUser.getId(), false);
+    }
+
     /**
      * 校验销售合同参数
      * 

+ 1 - 0
trade-client/src/main/java/com/trade/client/tradingplatform/TradingPlatformService.java

@@ -1,6 +1,7 @@
 package com.trade.client.tradingplatform;
 
 
+
 import com.trade.service.tradingplatform.dto.TradingPlatformDto;
 
 import java.util.List;

+ 2 - 1
trade-client/src/main/java/com/trade/client/tradingplatform/controller/TradingPlatformController.java

@@ -3,10 +3,11 @@ package com.trade.client.tradingplatform.controller;
 import javax.annotation.Resource;
 
 import com.trade.client.tradingplatform.TradingPlatformService;
+import com.trade.service.tradingplatform.dto.TradingPlatformDto;
 import org.springframework.web.bind.annotation.*;
 
 import com.trade.common.core.domain.ResponseResult;
-import com.trade.service.tradingplatform.dto.TradingPlatformDto;
+
 
 import java.util.List;
 

+ 2 - 2
trade-service/src/main/java/com/trade/service/TransStruct.java

@@ -20,7 +20,6 @@ import com.trade.service.trade.salesorder.dto.SalesOrderDeliverDTO;
 import com.trade.service.trade.salesorder.vo.SalesOrderPayInfoVO;
 import com.trade.service.trade.salesorder.vo.SalesOrderVO;
 import com.trade.service.tradingplatform.domain.TradingPlatformQualification;
-import com.trade.service.tradingplatform.dto.TradingPlatformQualificationDto;
 import org.mapstruct.*;
 
 import java.math.BigDecimal;
@@ -74,7 +73,8 @@ public interface TransStruct {
             @Mapping(target = "gmtCreate", ignore = true), @Mapping(target = "updateBy", ignore = true),
             @Mapping(target = "gmtModified", ignore = true)
     })
-    TradingPlatformQualification transDto2TradingPlatformQualification(TradingPlatformQualificationDto notifyDto);
+    TradingPlatformQualification transDto2TradingPlatformQualification(
+            com.trade.service.tradingplatform.dto.TradingPlatformQualificationDto notifyDto);
 
     class MapStruct {
 

+ 39 - 0
trade-service/src/main/java/com/trade/service/system/domain/SuperviseCertificateCode.java

@@ -0,0 +1,39 @@
+/**
+ * @filename:SuperviseCertificateCode 2024-09-21
+ * @project KJT v1.0.0 Copyright(c) 2024 wanglang Co. Ltd. All right reserved.
+ */
+package com.trade.service.system.domain;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.trade.common.core.domain.BizBaseEntity;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @Description:小图监管证件码值实体类
+ * @version: v1.0.0
+ * @author: wanglang
+ */
+@Data
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+public class SuperviseCertificateCode extends BizBaseEntity<SuperviseCertificateCode> {
+
+    private static final long serialVersionUID = 1726800899653L;
+    @ApiModelProperty(name = "code", value = "监管证件代码")
+    private String code;
+    @ApiModelProperty(name = "name", value = "名称")
+    private String name;
+    @ApiModelProperty(name = "source", value = "来源")
+    private String source;
+    @ApiModelProperty(name = "remark", value = "备注")
+    private String remark;
+}

+ 19 - 0
trade-service/src/main/java/com/trade/service/system/mapper/SuperviseCertificateCodeMapper.java

@@ -0,0 +1,19 @@
+/**
+ * @filename:SuperviseCertificateCodeMapper 2024-09-21
+ * @project KJT v1.0.0 Copyright(c) 2024 wanglang Co. Ltd. All right reserved.
+ */
+package com.trade.service.system.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.trade.service.system.domain.SuperviseCertificateCode;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * @Description:小图监管证件码值数据访问层
+ * @version: v1.0.0
+ * @author: wanglang
+ */
+@Mapper
+public interface SuperviseCertificateCodeMapper extends BaseMapper<SuperviseCertificateCode> {
+}

+ 24 - 0
trade-service/src/main/java/com/trade/service/system/service/SuperviseCertificateCodeService.java

@@ -0,0 +1,24 @@
+/**
+ * @filename:SuperviseCertificateCodeService 2024-09-21
+ * @project KJT v1.0.0 Copyright(c) 2024 wanglang Co. Ltd. All right reserved.
+ */
+package com.trade.service.system.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.trade.service.system.domain.SuperviseCertificateCode;
+
+/**
+ * @Description:小图监管证件码值服务层
+ * @version: v1.0.0
+ * @author: wanglang
+ */
+public interface SuperviseCertificateCodeService extends IService<SuperviseCertificateCode> {
+
+    /**
+     * 根据code查询数量
+     * 
+     * @param code
+     * @return
+     */
+    Long countByCode(String code);
+}

+ 26 - 0
trade-service/src/main/java/com/trade/service/system/service/impl/SuperviseCertificateCodeServiceImpl.java

@@ -0,0 +1,26 @@
+/**
+ * @filename:SuperviseCertificateCodeServiceImpl 2024-09-21
+ * @project KJT v1.0.0 Copyright(c) 2024 wanglang Co. Ltd. All right reserved.
+ */
+package com.trade.service.system.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.trade.service.system.domain.SuperviseCertificateCode;
+import com.trade.service.system.mapper.SuperviseCertificateCodeMapper;
+import com.trade.service.system.service.SuperviseCertificateCodeService;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+
+/**
+ * @Description:小图监管证件码值服务实现
+ * @version: v1.0.0
+ * @author: wanglang
+ */
+@Service
+public class SuperviseCertificateCodeServiceImpl extends ServiceImpl<SuperviseCertificateCodeMapper, SuperviseCertificateCode> implements SuperviseCertificateCodeService {
+
+    @Override
+    public Long countByCode(String code) {
+        return this.baseMapper.selectCount(new QueryWrapper<SuperviseCertificateCode>().eq("code", code));
+    }
+}

+ 18 - 0
trade-service/src/main/java/com/trade/service/trade/salescontract/service/SalesCommodityService.java

@@ -6,6 +6,7 @@ package com.trade.service.trade.salescontract.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.trade.service.trade.salescontract.domain.SalesCommodity;
+import com.trade.service.trade.salescontract.dto.SalesCommodityDto;
 import com.trade.service.trade.salescontract.vo.SalesCommoditySearch;
 
 import java.util.List;
@@ -25,5 +26,22 @@ public interface SalesCommodityService extends IService<SalesCommodity> {
      */
     List<SalesCommodity> queryBySalesContractId(Long salesContractId);
 
+    /**
+     * 根据销售合同id 和name查询销售商品
+     * 
+     * @param search
+     * @return
+     */
     List<SalesCommodity> getContractCommodityList(SalesCommoditySearch search);
+
+    /**
+     * 根据商品名称和客户id查询销售商品
+     * 
+     * @param name
+     * @param xtUid
+     * @param customerId
+     * @param isImport
+     * @return List<SalesCommodityDto>
+     */
+    List<SalesCommodityDto> getXiaoTuCommodityList(String name, String xtUid, Long customerId, boolean isImport);
 }

+ 72 - 0
trade-service/src/main/java/com/trade/service/trade/salescontract/service/impl/SalesCommodityServiceImpl.java

@@ -6,12 +6,26 @@ package com.trade.service.trade.salescontract.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.trade.service.enterprise.customer.domain.Enterprise;
+import com.trade.service.enterprise.customer.service.EnterpriseBaseService;
 import com.trade.service.trade.salescontract.domain.SalesCommodity;
+import com.trade.service.trade.salescontract.dto.SalesCommodityDto;
 import com.trade.service.trade.salescontract.mapper.SalesCommodityMapper;
 import com.trade.service.trade.salescontract.service.SalesCommodityService;
 import com.trade.service.trade.salescontract.vo.SalesCommoditySearch;
+import com.trade.common.exception.ServiceException;
+import com.trade.common.utils.StringUtils;
+import com.trade.service.DictConstants;
+import com.trade.service.system.service.SuperviseCertificateCodeService;
+import com.trade.service.thirdparty.xiaotu.dto.BusinessCommonRequest;
+import com.trade.service.thirdparty.xiaotu.dto.CommodityCustomsTariffRespose;
+import com.trade.service.thirdparty.xiaotu.dto.CommodityRequest;
+import com.trade.service.thirdparty.xiaotu.dto.CommodityResponse;
+import com.trade.service.thirdparty.xiaotu.service.XiaotuRequestService;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.Resource;
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -22,6 +36,13 @@ import java.util.List;
 @Service
 public class SalesCommodityServiceImpl extends ServiceImpl<SalesCommodityMapper, SalesCommodity> implements SalesCommodityService {
 
+    @Resource
+    private XiaotuRequestService xiaotuRequestService;
+    @Resource
+    private EnterpriseBaseService enterpriseBaseService;
+    @Resource
+    private SuperviseCertificateCodeService superviseCertificateCodeService;
+
     @Override
     public List<SalesCommodity> queryBySalesContractId(Long salesContractId) {
         return this.baseMapper.selectBySalesContractId(salesContractId);
@@ -36,4 +57,55 @@ public class SalesCommodityServiceImpl extends ServiceImpl<SalesCommodityMapper,
         }
         return this.list(queryWrapper);
     }
+
+    @Override
+    public List<SalesCommodityDto> getXiaoTuCommodityList(String name, String xtUid, Long customerId,
+            boolean isImport) {
+        Enterprise enterprise = enterpriseBaseService.getEnterpriseByCustomerId(customerId);
+        CommodityRequest commodityRequest = new CommodityRequest();
+        if (!isImport) {
+            commodityRequest.setCksptssplxDm(CommodityRequest.OTHER);
+        }
+        commodityRequest.setCkspdm(name);
+        BusinessCommonRequest businessCommonRequest = new BusinessCommonRequest();
+        businessCommonRequest.setXtUid(xtUid);
+        businessCommonRequest.setCustomerId(customerId);
+        businessCommonRequest.setXtEid(enterprise.getXtEid());
+        CommodityResponse commodityResponse = xiaotuRequestService.taxRefundRateInquiry(commodityRequest,
+                businessCommonRequest);
+        if (commodityResponse == null || StringUtils.isEmpty(commodityResponse.getSpid())) {
+            throw new ServiceException("未检索到商品信息");
+        }
+        CommodityCustomsTariffRespose commodityCustomsTariffRespose = xiaotuRequestService
+                .commodityCustomsTariffInquiry(commodityResponse.getSpid(), businessCommonRequest);
+        List<SalesCommodityDto> salesCommodityDtos = new ArrayList<>();
+        for (CommodityCustomsTariffRespose.Spmhgszinfo spmhgszinfo : commodityCustomsTariffRespose.getSPMHGSZINFO()) {
+            SalesCommodityDto salesCommodityDto = new SalesCommodityDto();
+            salesCommodityDto.setHsCode(spmhgszinfo.getHSCODE());
+            salesCommodityDto.setName(spmhgszinfo.getHSNAME());
+            salesCommodityDto.setMeasurementUnit(commodityCustomsTariffRespose.getHGJLDWMC());
+            salesCommodityDto.setExportTaxRebateRate(commodityCustomsTariffRespose.getTSL());
+            salesCommodityDto.setAddedTaxRate(commodityCustomsTariffRespose.getZSSLJH());
+            if (isImport) {
+                if (commodityRequest.PROHIBITION_EXPORT.equals(commodityCustomsTariffRespose.getCKSPTSSPLX_DM())) {
+                    salesCommodityDto.setErrors("该商品禁止出口");
+                }
+                if (commodityRequest.TAX_FREE.equals(commodityCustomsTariffRespose.getCKSPTSSPLX_DM())) {
+                    salesCommodityDto.setErrors("该商品为免税商品");
+                }
+            }
+            if (DictConstants.EXPORT_TYPE_PROXY.equals(enterprise.getExportType())) {
+                Long count = superviseCertificateCodeService.countByCode(spmhgszinfo.getHSHGJGTJ());
+                if (count != null && count > 0) {
+                    salesCommodityDto.setErrors("该商品为监管商品");
+                }
+            }
+            if (!isImport && StringUtils.isEmpty(salesCommodityDto.getErrors())) {
+                salesCommodityDtos.add(salesCommodityDto);
+            } else {
+                salesCommodityDtos.add(salesCommodityDto);
+            }
+        }
+        return salesCommodityDtos;
+    }
 }

+ 19 - 0
trade-service/src/main/resources/mapper/system/SuperviseCertificateCodeMapper.xml

@@ -0,0 +1,19 @@
+<?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.trade.service.system.mapper.SuperviseCertificateCodeMapper">
+
+	<resultMap id="BaseResultMap" type="com.trade.service.system.domain.SuperviseCertificateCode">
+		<id column="id" property="id" />
+		<id column="code" property="code" />
+		<id column="name" property="name" />
+		<id column="source" property="source" />
+		<id column="remark" property="remark" />
+		<id column="deleted" property="deleted" />
+		<id column="gmt_create" property="gmtCreate" />
+		<id column="gmt_modified" property="gmtModified" />
+	</resultMap>
+	<sql id="Base_Column_List">
+		id, code, name, source, remark, deleted, gmt_create, gmt_modified
+	</sql>
+
+</mapper>