Commit 2dbfb7d7 authored by 全洪江's avatar 全洪江

重构客户模块

parent 827d32b7
...@@ -35,10 +35,10 @@ ...@@ -35,10 +35,10 @@
<li id="customerBaseInfo" divid="customerBaseInfoDiv">客户基本信息</li> <li id="customerBaseInfo" divid="customerBaseInfoDiv">客户基本信息</li>
<li id="customerDebtContact" divid="customerDebtContactDiv">催货款通知邮箱</li> <li id="customerDebtContact" divid="customerDebtContactDiv">催货款通知邮箱</li>
<li id="customerOtherInfo" divid="customerOtherInfoDiv">其他信息</li> <li id="customerOtherInfo" divid="customerOtherInfoDiv">其他信息</li>
<li id="customerBrand" divid="customerBrandDiv">品牌信息字段</li> <li id="customerBrand" divid="customerBrandDiv">品牌信息</li>
<li id="customerBank" divid="customerBankDiv">银行数据表字段</li> <li id="customerBank" divid="customerBankDiv">银行数据表</li>
<li id="customerCompany" divid="customerCompanyDiv">公司代码字段</li> <li id="customerCompany" divid="customerCompanyDiv">公司代码</li>
<li id="customerSale" divid="customerSaleDiv">销售组织字段</li> <li id="customerSale" divid="customerSaleDiv">销售组织</li>
</ul> </ul>
</div> </div>
...@@ -116,17 +116,8 @@ ...@@ -116,17 +116,8 @@
<x:inputC name="customerCollectionDeadline" label="客户收账截止日" required="true" labelCol="1" fieldCol="2"/><%--sap、金库--%> <x:inputC name="customerCollectionDeadline" label="客户收账截止日" required="true" labelCol="1" fieldCol="2"/><%--sap、金库--%>
<x:inputC name="orderAbnormalDeadline" label="订单统计异常期限" required="true" labelCol="1" fieldCol="2"/><%--sap、金库--%> <x:inputC name="orderAbnormalDeadline" label="订单统计异常期限" required="true" labelCol="1" fieldCol="2"/><%--sap、金库--%>
<x:inputC name="deduction" label="扣款百分比" maxLength="32" labelCol="1" fieldCol="2"/><%--金库--%> <x:inputC name="deduction" label="扣款百分比" maxLength="32" labelCol="1" fieldCol="2"/><%--金库--%>
<x:selectC name="quotationCurrency" label="币别" dictionary="currency" labelCol="1" fieldCol="2"/><%--金库、sap销售组织字段--%> <x:selectC name="quotationCurrency" label="币别" dictionary="currency" labelCol="1" fieldCol="2"/><%--金库、sap销售组织字段--%>
...@@ -137,54 +128,17 @@ ...@@ -137,54 +128,17 @@
<x:inputC name="customerFactoryCode" label="工厂代号" labelCol="1" fieldCol="2" maxLength="50"/><%--sap品牌--%> <x:inputC name="customerFactoryCode" label="工厂代号" labelCol="1" fieldCol="2" maxLength="50"/><%--sap品牌--%>
<x:inputC name="BANKL" label="开户银行代码" labelCol="1" fieldCol="2"/> <x:inputC name="BANKL" label="开户银行代码" labelCol="1" fieldCol="2"/>
<x:inputC name="customerBankDeposit" label="开户银行" labelCol="1" fieldCol="2"/> <x:inputC name="customerBankDeposit" label="开户银行" labelCol="1" fieldCol="2"/>
<x:inputC name="customerAccountNo" label="银行账户" labelCol="1" fieldCol="2"/> <x:inputC name="customerAccountNo" label="银行账户" labelCol="1" fieldCol="2"/>
<x:inputC name="customerAccountName" label="户名" labelCol="1" fieldCol="2"/> <x:inputC name="customerAccountName" label="户名" labelCol="1" fieldCol="2"/>
<x:inputC name="customerCorporation" label="公司法人" labelCol="1" fieldCol="2"/> <x:inputC name="customerCorporation" label="公司法人" labelCol="1" fieldCol="2"/>
<x:inputC name="businessRegistrationNumber" label="工商注册号" labelCol="1" fieldCol="2"/> <x:inputC name="businessRegistrationNumber" label="工商注册号" labelCol="1" fieldCol="2"/>
<x:inputC name="nationalTaxRegistrationNumber" label="国税注册号" labelCol="1" fieldCol="2"/> <x:inputC name="nationalTaxRegistrationNumber" label="国税注册号" labelCol="1" fieldCol="2"/>
<x:selectC name="orderKind" label="订单性质" dictionary="orderKind" labelCol="1" fieldCol="2"/> <x:selectC name="orderKind" label="订单性质" dictionary="orderKind" labelCol="1" fieldCol="2"/>
<x:inputC name="customerBrand" label="品牌" labelCol="1" fieldCol="2"/> <x:inputC name="customerBrand" label="品牌" labelCol="1" fieldCol="2"/>
<x:inputC name="customerAddress" label="收货地址" labelCol="1" fieldCol="2" required="true"/> <x:inputC name="customerAddress" label="收货地址" labelCol="1" fieldCol="2" required="true"/>
<x:inputC name="remark" label="备注" labelCol="1" fieldCol="2"/> <x:inputC name="remark" label="备注" labelCol="1" fieldCol="2"/>
<%--sap--%> <%--sap--%>
<%-- <x:inputC name="BUKRS" label="公司代码" labelCol="1" fieldCol="2"/>--%> <%-- <x:inputC name="BUKRS" label="公司代码" labelCol="1" fieldCol="2"/>--%>
......
package com.huigou.topsun.customer.application; package com.huigou.topsun.customer.application;
import com.huigou.topsun.customer.domain.*; import com.huigou.topsun.customer.domain.*;
import com.huigou.topsun.customer.domain.dto.CustomerDto;
import com.huigou.topsun.customer.domain.query.CustomerQueryRequest; import com.huigou.topsun.customer.domain.query.CustomerQueryRequest;
import com.huigou.topsun.customer.domain.vo.CustomerListVo; import com.huigou.topsun.customer.domain.vo.CustomerListVo;
import com.huigou.topsun.customer.domain.vo.CustomerVo; import com.huigou.topsun.customer.domain.vo.CustomerVo;
...@@ -20,7 +21,7 @@ public interface CustomerApplication { ...@@ -20,7 +21,7 @@ public interface CustomerApplication {
void deleteContactByIds(List<String> ids); void deleteContactByIds(List<String> ids);
CustomerVo saveCustomer(CustomerVo customerVo, List<CustomerContact> customerContactList, List<CustomerDebtContact> baoshenEmailList, List<CustomerDebtContact> customerEmailList, List<CustomerRelated> customerRelatedList, List<CustomerPayInfo> customerPayInfoList); CustomerDto saveCustomer(CustomerDto customerDto, List<CustomerContact> customerContactList, List<CustomerDebtContact> baoshenEmailList, List<CustomerDebtContact> customerEmailList, List<CustomerRelated> customerRelatedList, List<CustomerPayInfo> customerPayInfoList);
void deleteCustomerAndAffiliatedInfoByCustomerId(List<String> customerIds); void deleteCustomerAndAffiliatedInfoByCustomerId(List<String> customerIds);
......
...@@ -6,6 +6,7 @@ import com.huigou.data.query.model.QueryDescriptor; ...@@ -6,6 +6,7 @@ import com.huigou.data.query.model.QueryDescriptor;
import com.huigou.data.query.model.QueryModel; import com.huigou.data.query.model.QueryModel;
import com.huigou.topsun.customer.application.*; import com.huigou.topsun.customer.application.*;
import com.huigou.topsun.customer.domain.*; import com.huigou.topsun.customer.domain.*;
import com.huigou.topsun.customer.domain.dto.CustomerDto;
import com.huigou.topsun.customer.domain.query.CustomerQueryRequest; import com.huigou.topsun.customer.domain.query.CustomerQueryRequest;
import com.huigou.topsun.customer.domain.vo.CustomerContactVo; import com.huigou.topsun.customer.domain.vo.CustomerContactVo;
import com.huigou.topsun.customer.domain.vo.CustomerListVo; import com.huigou.topsun.customer.domain.vo.CustomerListVo;
...@@ -118,10 +119,10 @@ public class CustomerApplicationImpl extends BaseApplication implements Customer ...@@ -118,10 +119,10 @@ public class CustomerApplicationImpl extends BaseApplication implements Customer
*/ */
@Override @Override
public CustomerVo saveCustomer(CustomerVo customerVo, List<CustomerContact> customerContactList, List<CustomerDebtContact> baoshenEmailList, List<CustomerDebtContact> customerEmailList, List<CustomerRelated> customerRelatedList, List<CustomerPayInfo> customerPayInfoList) { public CustomerDto saveCustomer(CustomerDto customerDto, List<CustomerContact> customerContactList, List<CustomerDebtContact> baoshenEmailList, List<CustomerDebtContact> customerEmailList, List<CustomerRelated> customerRelatedList, List<CustomerPayInfo> customerPayInfoList) {
Customer customer = getCustomer(customerVo); Customer customer = getCustomer(customerDto);
CustomerBank customerBank = getCustomerBank(customerVo); CustomerBank customerBank = getCustomerBank(customerDto);
CustomerOrder customerOrder = getCustomerOrder(customerVo); CustomerOrder customerOrder = getCustomerOrder(customerDto);
Customer saveCustomer = customerRepository.saveAndFlush(customer); Customer saveCustomer = customerRepository.saveAndFlush(customer);
String customerId = saveCustomer.getCustomerId(); String customerId = saveCustomer.getCustomerId();
customerBank.setCustomerId(customerId); customerBank.setCustomerId(customerId);
...@@ -154,11 +155,11 @@ public class CustomerApplicationImpl extends BaseApplication implements Customer ...@@ -154,11 +155,11 @@ public class CustomerApplicationImpl extends BaseApplication implements Customer
customerPayInfo.setCustomerId(customerId); customerPayInfo.setCustomerId(customerId);
customerPayInfoRepository.saveAndFlush(customerPayInfo); customerPayInfoRepository.saveAndFlush(customerPayInfo);
}); });
CustomerVo saveCustomerVo = new CustomerVo(); CustomerDto saveCustomerDto = new CustomerDto();
BeanUtils.copyProperties(saveCustomer, saveCustomerVo); BeanUtils.copyProperties(saveCustomer, saveCustomerDto);
BeanUtils.copyProperties(saveCustomerBank, saveCustomerVo); BeanUtils.copyProperties(saveCustomerBank, saveCustomerDto);
BeanUtils.copyProperties(saveCustomerOrder, saveCustomerVo); BeanUtils.copyProperties(saveCustomerOrder, saveCustomerDto);
return saveCustomerVo; return saveCustomerDto;
} }
@Override @Override
...@@ -233,21 +234,21 @@ public class CustomerApplicationImpl extends BaseApplication implements Customer ...@@ -233,21 +234,21 @@ public class CustomerApplicationImpl extends BaseApplication implements Customer
} }
public Customer getCustomer(CustomerVo customerVo) { public Customer getCustomer(CustomerDto customerDto) {
Customer customer = new Customer(); Customer customer = new Customer();
BeanUtils.copyProperties(customerVo, customer); BeanUtils.copyProperties(customerDto, customer);
return customer; return customer;
} }
public CustomerBank getCustomerBank(CustomerVo customerVo) { public CustomerBank getCustomerBank(CustomerDto customerDto) {
CustomerBank customerBank = new CustomerBank(); CustomerBank customerBank = new CustomerBank();
BeanUtils.copyProperties(customerVo, customerBank); BeanUtils.copyProperties(customerDto, customerBank);
return customerBank; return customerBank;
} }
public CustomerOrder getCustomerOrder(CustomerVo customerVo) { public CustomerOrder getCustomerOrder(CustomerDto customerDto) {
CustomerOrder customerOrder = new CustomerOrder(); CustomerOrder customerOrder = new CustomerOrder();
BeanUtils.copyProperties(customerVo, customerOrder); BeanUtils.copyProperties(customerDto, customerOrder);
return customerOrder; return customerOrder;
} }
} }
package com.huigou.topsun.customer.application; package com.huigou.topsun.customer.application;
import com.huigou.topsun.customer.domain.CustomerContact; import com.huigou.topsun.customer.domain.CustomerContact;
import com.huigou.topsun.customer.domain.sap.CustomerDto; import com.huigou.topsun.customer.domain.dto.SapCustomerDto;
import com.huigou.topsun.customer.domain.vo.CustomerVo; import com.huigou.topsun.customer.domain.vo.CustomerVo;
public interface SapCustomerApplication { public interface SapCustomerApplication {
CustomerDto submitCustomerToSAP(CustomerVo customerVo, CustomerContact customerContact); SapCustomerDto submitCustomerToSAP(CustomerVo customerVo, CustomerContact customerContact);
} }
...@@ -4,8 +4,9 @@ import com.huigou.topsun.customer.application.CustomerBaseInfoApplication; ...@@ -4,8 +4,9 @@ import com.huigou.topsun.customer.application.CustomerBaseInfoApplication;
import com.huigou.topsun.customer.application.CustomerApplication; import com.huigou.topsun.customer.application.CustomerApplication;
import com.huigou.topsun.customer.application.SapCustomerApplication; import com.huigou.topsun.customer.application.SapCustomerApplication;
import com.huigou.topsun.customer.domain.*; import com.huigou.topsun.customer.domain.*;
import com.huigou.topsun.customer.domain.dto.CustomerDto;
import com.huigou.topsun.customer.domain.query.CustomerQueryRequest; import com.huigou.topsun.customer.domain.query.CustomerQueryRequest;
import com.huigou.topsun.customer.domain.sap.CustomerDto; import com.huigou.topsun.customer.domain.dto.SapCustomerDto;
import com.huigou.topsun.customer.domain.vo.CustomerListVo; import com.huigou.topsun.customer.domain.vo.CustomerListVo;
import com.huigou.topsun.customer.domain.vo.CustomerVo; import com.huigou.topsun.customer.domain.vo.CustomerVo;
import com.huigou.topsun.customer.domain.vo.ReturnCustomerListVo; import com.huigou.topsun.customer.domain.vo.ReturnCustomerListVo;
...@@ -129,15 +130,14 @@ public class CustomerController extends CommonController { ...@@ -129,15 +130,14 @@ public class CustomerController extends CommonController {
*/ */
public String saveCustomer() { public String saveCustomer() {
SDO sdo = getSDO(); SDO sdo = getSDO();
CustomerVo customerVo = sdo.toObject(CustomerVo.class); CustomerDto customerDto = sdo.toObject(CustomerDto.class);
List<CustomerContact> customerContactList = sdo.getList("contactList", CustomerContact.class); List<CustomerContact> customerContactList = sdo.getList("contactList", CustomerContact.class);
List<CustomerDebtContact> baoshenEmailList = sdo.getList("baoshenEmailList", CustomerDebtContact.class); List<CustomerDebtContact> baoshenEmailList = sdo.getList("baoshenEmailList", CustomerDebtContact.class);
List<CustomerDebtContact> customerEmailList = sdo.getList("customerEmailList", CustomerDebtContact.class); List<CustomerDebtContact> customerEmailList = sdo.getList("customerEmailList", CustomerDebtContact.class);
List<CustomerRelated> customerRelatedList = sdo.getList("customerRelatedList", CustomerRelated.class); List<CustomerRelated> customerRelatedList = sdo.getList("customerRelatedList", CustomerRelated.class);
List<CustomerPayInfo> customerPayInfoList = sdo.getList("customerPayInfoList", CustomerPayInfo.class); List<CustomerPayInfo> customerPayInfoList = sdo.getList("customerPayInfoList", CustomerPayInfo.class);
customerDto = customerApplication.saveCustomer(customerDto, customerContactList, baoshenEmailList, customerEmailList, customerRelatedList, customerPayInfoList);
customerVo = customerApplication.saveCustomer(customerVo, customerContactList, baoshenEmailList, customerEmailList, customerRelatedList, customerPayInfoList); return success(customerDto);
return success(customerVo);
} }
...@@ -147,8 +147,8 @@ public class CustomerController extends CommonController { ...@@ -147,8 +147,8 @@ public class CustomerController extends CommonController {
CustomerVo customerVo = sdo.toObject(CustomerVo.class); CustomerVo customerVo = sdo.toObject(CustomerVo.class);
List<CustomerContact> customerContactList = sdo.getList("contactList", CustomerContact.class); List<CustomerContact> customerContactList = sdo.getList("contactList", CustomerContact.class);
CustomerContact customerContact = customerContactList.get(0); CustomerContact customerContact = customerContactList.get(0);
CustomerDto customerDto = sapCustomerApplication.submitCustomerToSAP(customerVo, customerContact); SapCustomerDto sapCustomerDto = sapCustomerApplication.submitCustomerToSAP(customerVo, customerContact);
return JSONUtil.toString(customerDto); return JSONUtil.toString(sapCustomerDto);
} }
// /** // /**
......
package com.huigou.topsun.customer.domain.dto;
import com.alibaba.fastjson.JSON;
import com.huigou.topsun.customer.domain.Customer;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class CustomerDto implements Serializable {
/**
* 客户id
*/
private String customerId;
/**
* 客户编码
*/
private String customerCode;
/**
* 客户全称
*/
private String customerName;
/**
* 客户简称
*/
private String customerShortName;
/**
* 客户工作时间
*/
private Date customerWorkTime;
/**
* 客户英文名称
*/
private String customerEnName;
/**
* 客户英文名称简称
*/
private String customerEnShortName;
/**
* 省份编码
*/
private String provinceCode;
/**
* 一级省份编码
*/
private String primaryProvinceCode;
/**
* 二级省份编码
*/
private String secondProvinceCode;
/**
* 省份
*/
private String province;
/**
* 地级市
*/
private String city;
/**
* 区县
*/
private String county;
// /**
// * 省份信息
// */
// private String provinceInfo;
/**
* 客户等级
*/
private String customerLevel;
/**
* 工厂代号
*/
private String customerFactoryCode;
/**
* 地址
*/
private String customerAddress;
/**
* 所属集团
*/
private String customerGroup;
/**
* 邮编
*/
private String customerZipCode;
/**
* 开户银行id
*/
private String customerBankId;
/**
* 开户银行
*/
private String customerBankDeposit;
/**
* 银行账号
*/
private String customerAccountNo;
/**
* 户名
*/
private String customerAccountName;
/**
* 公司法人
*/
private String customerCorporation;
/**
* 工商注册号
*/
private String businessRegistrationNumber;
/**
* 国税注册号
*/
private String nationalTaxRegistrationNumber;
/**
* 客户订单信息id
*/
private String customerOrderId;
/**
* 请款要求
*/
private String paymentRequest;
/**
* 扣款百分比
*/
private Integer deduction;
/**
* 是否要求签回货单
*/
private String signedBack;
/**
* 是否用客户系统货单
*/
private String customerSysOrder;
/**
* 报价币别(currency)
*/
private String quotationCurrency;
/**
* 金额小数位数
*/
private Integer decimalPlaces;
/**
* 签回方式(signedStyle)
*/
private String signedStyle;
/**
* 月结方式(monthlySettlementMethod)
*/
private String monthlySettlementMethod;
/**
* 做账难度等级(accountDifficultLevel)
*/
private String accountDifficultLevel;
/**
* 盖章方式(stampMethod)
*/
private String stampMethod;
/**
* 请款联(paymentRequestForm)
*/
private String paymentRequestForm;
/**
* 客户联(customerReceipt)
*/
private String customerReceipt;
/**
* 订单性质(orderKind)
*/
private String orderKind;
/**
* 品牌
*/
private String customerBrand;
/**
* 收货方签字要求
*/
private String receiverSignatureRequire;
/**
* 出货方式(shipMethod)
*/
private String shipMethod;
/**
* 路线(route)
*/
private String route;
/**
* 备注
*/
private String remark;
/**
* 订单要求(orderRequire)
*/
private String orderRequire;
/**
* 验收要求
*/
private String acceptanceRequire;
/**
* 客户系统验收要求
*/
private String customerSysAcceptanceRequire;
/**
* 做账截止日期
*/
private Integer accountDeadline;
/**
* 客户收账单截止日
*/
private Integer customerCollectionDeadline;
/**
* 订单统计异常期限
*/
private Integer orderAbnormalDeadline;
/**
* 送货单统计异常期限
*/
private Integer shipAbnormalDeadline;
/**
* 请款期限
*/
private Integer paymentDeadline;
/**
* 产品检验报告类型(productInspectionReportType)
*/
private String productInspectionReportType;
/**
* 货单打印要求(shipPrintRequire)
*/
private String shipPrintRequire;
/**
* 货单是否打印送货日期
*/
private String isPrintDeliveryDate;
/**
* 是否开发票
*/
private String needInvoice;
/**
* 生产发货方式(productionDeliveryMethod)
*/
private String productionDeliveryMethod;
public String getCustomerId() {
return customerId;
}
public static CustomerDto getCustomerDto(Customer customer){
return JSON.parseObject(JSON.toJSONString(customer), CustomerDto.class);
}
public static Customer getCustomer(CustomerDto customerDto){
return JSON.parseObject(JSON.toJSONString(customerDto),Customer.class);
}
}
package com.huigou.topsun.customer.domain.sap; package com.huigou.topsun.customer.domain.dto;
import lombok.Data; import lombok.Data;
@Data @Data
public class CustomerDto { public class SapCustomerDto {
/** /**
* 账目组 * 账目组
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment