Explorar o código

销售合同添加字段

yzc hai 1 ano
pai
achega
7a03a88ca1

+ 5 - 0
hx-common/src/main/java/com/fjhx/common/entity/corporation/po/Corporation.java

@@ -136,4 +136,9 @@ public class Corporation extends BasePo {
      * 海关注册代码
      */
     private String crCode;
+
+    /**
+     * 税号
+     */
+    private String taxationCode;
 }

+ 14 - 0
hx-customer/src/main/java/com/fjhx/customer/entity/customer/po/Customer.java

@@ -106,4 +106,18 @@ public class Customer extends BasePo {
     @TableField(exist = false)
     private Integer count;
 
+    /**
+     * 开户行
+     */
+    private String beneficiaryBank;
+    /**
+     * 行号
+     */
+    private String swiftCode;
+    /**
+     * 银行账号(卡号)
+     */
+    private String beneficiaryAccountNumber;
+
+
 }

+ 56 - 0
hx-jxst/src/main/java/com/fjhx/jxst/entity/sales/po/SalesContract.java

@@ -68,4 +68,60 @@ public class SalesContract extends BasePo {
      */
     private String code;
 
+    /**
+     * 交货期限说明
+     */
+    private String deliveryDateRemark;
+
+    /**
+     * 付款方式说明
+     */
+    private String payMethodRemark;
+
+
+    //卖方信息
+    /**
+     * 卖方公司ID(多公司)
+     */
+    private Long sellCorporationId;
+    /**
+     * 卖方国家表id
+     */
+    private Long sellCountryId;
+    /**
+     * 卖方省份id
+     */
+    private Long sellProvinceId;
+    /**
+     * 卖方城市id
+     */
+    private Long sellCityId;
+    /**
+     * 卖方详细地址
+     */
+    private String sellAddress;
+
+    /**
+     * 收款账号ID(卖方资金账户)
+     */
+    private Long shroffAccountId;
+
+    //买方信息
+    /**
+     * 买方国家表id
+     */
+    private Long buyCountryId;
+    /**
+     * 买方省份id
+     */
+    private Long buyProvinceId;
+    /**
+     * 买方城市id
+     */
+    private Long buyCityId;
+    /**
+     * 买方详细地址
+     */
+    private String buyAddress;
+
 }

+ 5 - 0
hx-jxst/src/main/java/com/fjhx/jxst/entity/sales/po/SalesContractDetails.java

@@ -45,4 +45,9 @@ public class SalesContractDetails extends BasePo {
      */
     private String isCustomized;
 
+    /**
+     * 产品备注
+     */
+    private String productRemark;
+
 }

+ 10 - 0
hx-jxst/src/main/java/com/fjhx/jxst/entity/sales/vo/SalesContractDetailsVo.java

@@ -19,4 +19,14 @@ public class SalesContractDetailsVo extends SalesContractDetails {
      */
     private String productName;
 
+    /**
+     * 产品名称
+     */
+    private String productSpec;
+
+    /**
+     * 产品名称
+     */
+    private String productUnit;
+
 }

+ 69 - 0
hx-jxst/src/main/java/com/fjhx/jxst/entity/sales/vo/SalesContractVo.java

@@ -1,5 +1,6 @@
 package com.fjhx.jxst.entity.sales.vo;
 
+import com.fjhx.customer.entity.customer.po.CustomerUser;
 import com.fjhx.jxst.entity.sales.po.SalesContract;
 import lombok.Getter;
 import lombok.Setter;
@@ -27,4 +28,72 @@ public class SalesContractVo extends SalesContract {
      */
     private List<SalesContractDetailsVo> contractDetailsList;
 
+    /**
+     * 客户用户列表
+     */
+    List<CustomerUser> customerUserList;
+
+    /**
+     * 客户开户行
+     */
+    private String customerBank;
+    /**
+     * 客户行号
+     */
+    private String customerSwiftCode;
+    /**
+     * 客户银行账号(卡号)
+     */
+    private String customerAccountNumber;
+    /**
+     * 客户国家名称
+     */
+    private String buyCountryName;
+    /**
+     * 客户省名称
+     */
+    private String buyProvinceName;
+    /**
+     * 客户市名称
+     */
+    private String buyCityName;
+
+    /**
+     * 卖方公司名称
+     */
+    private String sellCorporationName;
+    /**
+     * 卖方公司电话
+     */
+    private String sellCorporationNumber;
+    /**
+     * 卖方税号
+     */
+    private String sellTaxationCode;
+    /**
+     * 卖方开户银行
+     */
+    private String sellOpeningBank;
+    /**
+     * 卖方行联号
+     */
+    private String sellSwiftCode;
+    /**
+     * 卖方账号
+     */
+    private String sellAccountOpening;
+
+    /**
+     * 卖方国家名称
+     */
+    private String sellCountryName;
+    /**
+     * 卖方省名称
+     */
+    private String sellProvinceName;
+    /**
+     * 卖方市名称
+     */
+    private String sellCityName;
+
 }

+ 57 - 4
hx-jxst/src/main/java/com/fjhx/jxst/service/sales/impl/SalesContractServiceImpl.java

@@ -2,10 +2,19 @@ package com.fjhx.jxst.service.sales.impl;
 
 import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.dynamic.datasource.annotation.DSTransactional;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.fjhx.account.entity.account.po.AccountManagement;
+import com.fjhx.account.service.account.AccountManagementService;
+import com.fjhx.area.utils.CustomizeAreaUtil;
+import com.fjhx.common.entity.corporation.po.Corporation;
+import com.fjhx.common.service.corporation.CorporationService;
+import com.fjhx.common.utils.Assert;
 import com.fjhx.customer.entity.customer.po.Customer;
+import com.fjhx.customer.entity.customer.po.CustomerUser;
 import com.fjhx.customer.service.customer.CustomerService;
+import com.fjhx.customer.service.customer.CustomerUserService;
 import com.fjhx.item.service.product.ProductInfoService;
 import com.fjhx.jxst.entity.sales.dto.SalesContractDto;
 import com.fjhx.jxst.entity.sales.dto.SalesContractSelectDto;
@@ -26,6 +35,7 @@ import org.springframework.transaction.annotation.Transactional;
 import java.math.BigDecimal;
 import java.util.Arrays;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 
@@ -46,6 +56,12 @@ public class SalesContractServiceImpl extends ServiceImpl<SalesContractMapper, S
     private CustomerService customerService;
     @Autowired
     private ProductInfoService productInfoService;
+    @Autowired
+    private CustomerUserService customerUserService;
+    @Autowired
+    private AccountManagementService accountManagementService;
+    @Autowired
+    private CorporationService corporationService;
 
     @Override
     public Page<SalesContractVo> getPage(SalesContractSelectDto dto) {
@@ -71,23 +87,60 @@ public class SalesContractServiceImpl extends ServiceImpl<SalesContractMapper, S
 
     @Override
     public SalesContractVo detail(Long id) {
-        SalesContract SalesContract = this.getById(id);
-        SalesContractVo result = BeanUtil.toBean(SalesContract, SalesContractVo.class);
+        SalesContract salesContract = this.getById(id);
+        Assert.notEmpty(salesContract,"查询不到合同信息");
+        SalesContractVo result = BeanUtil.toBean(salesContract, SalesContractVo.class);
         List<SalesContractDetails> salesContractDetailsList = salesContractDetailsService.list(q -> q.eq(SalesContractDetails::getSalesContractId, result.getId()));
         List<SalesContractDetailsVo> salesContractDetailsVos = BeanUtil.copyToList(salesContractDetailsList, SalesContractDetailsVo.class);
         //赋值产品信息
         productInfoService.attributeAssign(salesContractDetailsVos, SalesContractDetailsVo::getProductId, (item, productInfo) -> {
             item.setProductName(productInfo.getName());
+            item.setProductSpec(productInfo.getSpec());
+            item.setProductUnit(productInfo.getUnit());
         });
         result.setContractDetailsList(salesContractDetailsVos);
-        //赋值客户名称
+        //赋值客户信息
         customerService.attributeAssign(Arrays.asList(result), SalesContractVo::getCustomerId, (item, customer) -> {
             item.setCustomerName(customer.getName());
+            item.setCustomerBank(customer.getBeneficiaryBank());
+            item.setCustomerSwiftCode(customer.getSwiftCode());
+            item.setCustomerAccountNumber(customer.getBeneficiaryAccountNumber());
         });
+        //赋值客户更多联系人
+        List<CustomerUser> customerUserList = customerUserService.list(q -> q.eq(CustomerUser::getCustomerId, salesContract.getCustomerId()));
+        result.setCustomerUserList(customerUserList);
+        //赋值客户国省市名称
+        Map<Long, String> areaMapByIds = CustomizeAreaUtil.getAreaMapByIds(Arrays.asList(
+                result.getBuyCountryId(),
+                result.getBuyProvinceId(),
+                result.getBuyCityId(),
+
+                result.getSellCountryId(),
+                result.getSellProvinceId(),
+                result.getSellCityId())
+        );
+        result.setBuyCountryName(areaMapByIds.get(result.getBuyCountryId()));
+        result.setBuyProvinceName(areaMapByIds.get(result.getBuyProvinceId()));
+        result.setBuyCityName(areaMapByIds.get(result.getBuyCityId()));
+
+        //赋值卖方信息多公司
+        AccountManagement accountManagement = accountManagementService.getById(result.getShroffAccountId());
+        Corporation corporation = corporationService.getById(accountManagement.getCorporationId());
+        result.setSellCorporationName(corporation.getName());
+        result.setSellCorporationNumber(corporation.getCorporationNumber());
+        result.setSellTaxationCode(corporation.getTaxationCode());
+        result.setSellOpeningBank(accountManagement.getOpeningBank());
+        result.setSellSwiftCode(accountManagement.getSwiftCode());
+        result.setSellAccountOpening(accountManagement.getAccountOpening());
+        //赋值卖方国省市名称
+        result.setSellCountryName(areaMapByIds.get(result.getSellCountryId()));
+        result.setSellProvinceName(areaMapByIds.get(result.getSellProvinceId()));
+        result.setSellCityName(areaMapByIds.get(result.getSellCityId()));
+
         return result;
     }
 
-    @Transactional(rollbackFor = Exception.class)
+    @DSTransactional
     @Override
     public void add(SalesContractDto salesContractDto) {
         List<SalesContractDetails> salesContractDetailsList = salesContractDto.getSalesContractDetailsList();