Commit 4db916d7 by jianan

客户证件列表

parent 55e1f09d
...@@ -2,7 +2,6 @@ package com.yd.csf.api.controller; ...@@ -2,7 +2,6 @@ package com.yd.csf.api.controller;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yd.base.feign.client.relobjectcertificate.ApiRelObjectCertificateFeignClient;
import com.yd.common.enums.CommonEnum; import com.yd.common.enums.CommonEnum;
import com.yd.common.enums.ResultCode; import com.yd.common.enums.ResultCode;
import com.yd.common.exception.BusinessException; import com.yd.common.exception.BusinessException;
...@@ -14,9 +13,7 @@ import com.yd.csf.service.common.ErrorCode; ...@@ -14,9 +13,7 @@ import com.yd.csf.service.common.ErrorCode;
import com.yd.csf.service.dto.CustomerAddRequest; import com.yd.csf.service.dto.CustomerAddRequest;
import com.yd.csf.service.dto.CustomerQueryRequest; import com.yd.csf.service.dto.CustomerQueryRequest;
import com.yd.csf.service.dto.CustomerUpdateRequest; import com.yd.csf.service.dto.CustomerUpdateRequest;
import com.yd.csf.service.dto.TaxCountry;
import com.yd.csf.service.model.Customer; import com.yd.csf.service.model.Customer;
import com.yd.csf.service.model.Taxation;
import com.yd.csf.service.service.CustomerService; import com.yd.csf.service.service.CustomerService;
import com.yd.csf.service.vo.CustomerVO; import com.yd.csf.service.vo.CustomerVO;
...@@ -28,7 +25,6 @@ import org.springframework.web.bind.annotation.*; ...@@ -28,7 +25,6 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -48,8 +44,6 @@ public class ApiCustomerController { ...@@ -48,8 +44,6 @@ public class ApiCustomerController {
private CustomerService customerService; private CustomerService customerService;
@Resource @Resource
private ApiTaxationService apiTaxationService; private ApiTaxationService apiTaxationService;
@Resource
private ApiRelObjectCertificateFeignClient apiRelObjectCertificateFeignClient;
/** /**
* 创建客户 * 创建客户
...@@ -173,32 +167,7 @@ public class ApiCustomerController { ...@@ -173,32 +167,7 @@ public class ApiCustomerController {
customerService.queryDependentsNum(customer); customerService.queryDependentsNum(customer);
// 获取封装类 // 获取封装类
CustomerVO customerVO = customerService.getCustomerVO(customer); return Result.success(customerService.getCustomerVO(customer));
// 查询税务列表信息
customerVO.setApiTaxationDtoList(apiTaxationDtoList(customerBizId));
return Result.success(customerVO);
}
/**
* 查询税务列表信息
* @param customerBizId
* @return
*/
public List<TaxCountry> apiTaxationDtoList(String customerBizId) {
List<TaxCountry> apiTaxationDtoList = new ArrayList<>();
//查询客户税务列表信息
Result<List<Taxation>> listResult = apiTaxationService.list(ApiObjectTaxationDto.builder().objectBizId(customerBizId).build());
if (!CollUtil.isEmpty(listResult.getData())) {
apiTaxationDtoList = listResult.getData().stream().map(d -> {
TaxCountry taxCountry = new TaxCountry();
taxCountry.setTaxCountry(d.getTaxCountry());
taxCountry.setTaxId(d.getTaxId());
return taxCountry;
}).collect(Collectors.toList());
}
return apiTaxationDtoList;
} }
/** /**
...@@ -235,9 +204,7 @@ public class ApiCustomerController { ...@@ -235,9 +204,7 @@ public class ApiCustomerController {
Page<Customer> customerPage = customerService.page(new Page<>(current, size), Page<Customer> customerPage = customerService.page(new Page<>(current, size),
customerService.getQueryWrapper(customerQueryRequest)); customerService.getQueryWrapper(customerQueryRequest));
// 获取封装类 // 获取封装类
Page<CustomerVO> customerVOPage = customerService.getCustomerVOPage(customerPage); return Result.success(customerService.getCustomerVOPage(customerPage));
return Result.success(customerVOPage);
} }
} }
...@@ -83,6 +83,11 @@ public class Customer implements Serializable { ...@@ -83,6 +83,11 @@ public class Customer implements Serializable {
private Object taxList; private Object taxList;
/** /**
* 证件列表
*/
private Object certificateList;
/**
* 吸烟情况(字典) * 吸烟情况(字典)
*/ */
private String smokingStatus; private String smokingStatus;
......
...@@ -5,12 +5,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -5,12 +5,9 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yd.csf.service.dto.CustomerAddRequest; import com.yd.csf.service.dto.CustomerAddRequest;
import com.yd.csf.service.dto.CustomerQueryRequest; import com.yd.csf.service.dto.CustomerQueryRequest;
import com.yd.csf.service.dto.CustomerUpdateRequest; import com.yd.csf.service.dto.CustomerUpdateRequest;
import com.yd.csf.service.dto.FnaQueryRequest;
import com.yd.csf.service.model.Customer; import com.yd.csf.service.model.Customer;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yd.csf.service.model.CustomerExpand;
import com.yd.csf.service.vo.CustomerVO; import com.yd.csf.service.vo.CustomerVO;
import com.yd.csf.service.vo.FnaVO;
import java.util.Map; import java.util.Map;
...@@ -26,8 +23,6 @@ public interface CustomerService extends IService<Customer> { ...@@ -26,8 +23,6 @@ public interface CustomerService extends IService<Customer> {
Wrapper<Customer> getQueryWrapper(CustomerQueryRequest customerQueryRequest); Wrapper<Customer> getQueryWrapper(CustomerQueryRequest customerQueryRequest);
CustomerExpand getCustomerExpand(CustomerAddRequest customerAddRequest);
Page<CustomerVO> getCustomerVOPage(Page<Customer> customerPage); Page<CustomerVO> getCustomerVOPage(Page<Customer> customerPage);
Customer getByCustomerBizId(String customerBizId); Customer getByCustomerBizId(String customerBizId);
......
...@@ -9,26 +9,20 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; ...@@ -9,26 +9,20 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.gson.Gson; import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import com.yd.base.feign.client.relobjectcertificate.ApiRelObjectCertificateFeignClient; import com.yd.base.feign.client.relobjectcertificate.ApiRelObjectCertificateFeignClient;
import com.yd.base.feign.dto.ApiCertificateDto;
import com.yd.base.feign.request.relobjectcertificate.ApiRelObjectCertificateListAddRequest; import com.yd.base.feign.request.relobjectcertificate.ApiRelObjectCertificateListAddRequest;
import com.yd.base.feign.request.relobjectcertificate.ApiRelObjectCertificateListRequest;
import com.yd.base.feign.response.relobjectcertificate.ApiRelObjectCertificateListResponse;
import com.yd.common.enums.CommonEnum; import com.yd.common.enums.CommonEnum;
import com.yd.common.exception.BusinessException; import com.yd.common.exception.BusinessException;
import com.yd.common.result.Result;
import com.yd.common.utils.RandomStringGenerator; import com.yd.common.utils.RandomStringGenerator;
import com.yd.csf.service.common.ErrorCode; import com.yd.csf.service.common.ErrorCode;
import com.yd.csf.service.dao.CustomerMapper; import com.yd.csf.service.dao.CustomerMapper;
import com.yd.csf.service.dto.*; import com.yd.csf.service.dto.*;
import com.yd.csf.service.model.Customer; import com.yd.csf.service.model.Customer;
import com.yd.csf.service.model.CustomerExpand;
import com.yd.csf.service.model.FnaForm; import com.yd.csf.service.model.FnaForm;
import com.yd.csf.service.service.CustomerService; import com.yd.csf.service.service.CustomerService;
import com.yd.csf.service.service.FnaFormService; import com.yd.csf.service.service.FnaFormService;
import com.yd.csf.service.service.FnaService; import com.yd.csf.service.service.FnaService;
import com.yd.csf.service.utils.GSONUtil; import com.yd.csf.service.utils.GSONUtil;
import com.yd.csf.service.utils.ValidateUtil; import com.yd.csf.service.utils.ValidateUtil;
import com.yd.csf.service.vo.AddressVO;
import com.yd.csf.service.vo.CustomerVO; import com.yd.csf.service.vo.CustomerVO;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -64,31 +58,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> ...@@ -64,31 +58,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
@Override @Override
public CustomerVO getCustomerVO(Customer customer) { public CustomerVO getCustomerVO(Customer customer) {
CustomerVO customerVO = CustomerVO.objToVo(customer); return CustomerVO.objToVo(customer);
// 查询证件列表信息
customerVO.setApiCertificateDtoList(apiCertificateDtoList(customerVO.getCustomerBizId()));
return customerVO;
}
/**
* 查询证件列表信息
* @param customerBizId
* @return
*/
public List<ApiCertificateDto> apiCertificateDtoList(String customerBizId) {
List<ApiCertificateDto> apiCertificateDtoList = new ArrayList<>();
//查询客户证件列表信息
Result<List<ApiRelObjectCertificateListResponse>> result = apiRelObjectCertificateFeignClient.list(ApiRelObjectCertificateListRequest.builder()
.objectBizId(customerBizId)
.build());
if (!org.springframework.util.CollectionUtils.isEmpty(result.getData())) {
apiCertificateDtoList = result.getData().stream().map(dto -> {
ApiCertificateDto apiCertificateDto = new ApiCertificateDto();
BeanUtils.copyProperties(dto, apiCertificateDto);
return apiCertificateDto;
}).collect(Collectors.toList());
}
return apiCertificateDtoList;
} }
@Override @Override
...@@ -108,18 +78,6 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> ...@@ -108,18 +78,6 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
} }
@Override @Override
public CustomerExpand getCustomerExpand(CustomerAddRequest customerAddRequest) {
CustomerExpand customerExpand = new CustomerExpand();
BeanUtils.copyProperties(customerAddRequest, customerExpand, "addressList");
List<AddressVO> addressList = customerAddRequest.getAddressList();
if (CollUtil.isNotEmpty(addressList)) {
customerExpand.setAddressList(GSON.toJson(addressList));
}
return customerExpand;
}
@Override
public Page<CustomerVO> getCustomerVOPage(Page<Customer> customerPage) { public Page<CustomerVO> getCustomerVOPage(Page<Customer> customerPage) {
List<Customer> customerList = customerPage.getRecords(); List<Customer> customerList = customerPage.getRecords();
Page<CustomerVO> customerVOPage = new Page<>(customerPage.getCurrent(), customerPage.getSize(), customerPage.getTotal()); Page<CustomerVO> customerVOPage = new Page<>(customerPage.getCurrent(), customerPage.getSize(), customerPage.getTotal());
...@@ -146,11 +104,19 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> ...@@ -146,11 +104,19 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
} }
// 客户主表信息 // 客户主表信息
Customer customer = new Customer(); Customer customer = new Customer();
BeanUtils.copyProperties(customerAddRequest, customer, "addressList"); BeanUtils.copyProperties(customerAddRequest, customer, "addressList", "apiCertificateDtoList");
// 地址列表 // 地址列表
if (CollUtil.isNotEmpty(customerAddRequest.getAddressList())) { if (CollUtil.isNotEmpty(customerAddRequest.getAddressList())) {
customer.setAddressList(GSON.toJson(customerAddRequest.getAddressList())); customer.setAddressList(GSON.toJson(customerAddRequest.getAddressList()));
} }
// 税务国家列表冗余存储
if (CollUtil.isNotEmpty(customerAddRequest.getApiTaxationDtoList())) {
customer.setTaxList(GSON.toJson(customerAddRequest.getApiTaxationDtoList()));
}
// 证件列表冗余存储
if (CollUtil.isNotEmpty(customerAddRequest.getApiCertificateDtoList())) {
customer.setCertificateList(GSON.toJson(customerAddRequest.getApiCertificateDtoList()));
}
// 校验客户主表信息 // 校验客户主表信息
validCustomer(customer); validCustomer(customer);
...@@ -202,11 +168,19 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer> ...@@ -202,11 +168,19 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
throw new BusinessException(ErrorCode.NOT_FOUND_ERROR.getCode(), ErrorCode.NOT_FOUND_ERROR.getMessage()); throw new BusinessException(ErrorCode.NOT_FOUND_ERROR.getCode(), ErrorCode.NOT_FOUND_ERROR.getMessage());
} }
BeanUtils.copyProperties(customerUpdateRequest, oldCustomer, "customerBizId"); BeanUtils.copyProperties(customerUpdateRequest, oldCustomer, "customerBizId", "apiCertificateDtoList");
// 地址列表 // 地址列表
if (CollUtil.isNotEmpty(customerUpdateRequest.getAddressList())) { if (CollUtil.isNotEmpty(customerUpdateRequest.getAddressList())) {
oldCustomer.setAddressList(GSON.toJson(customerUpdateRequest.getAddressList())); oldCustomer.setAddressList(GSON.toJson(customerUpdateRequest.getAddressList()));
} }
// 税务国家列表冗余存储
if (CollUtil.isNotEmpty(customerUpdateRequest.getApiTaxationDtoList())) {
oldCustomer.setTaxList(GSON.toJson(customerUpdateRequest.getApiTaxationDtoList()));
}
// 证件列表冗余存储
if (CollUtil.isNotEmpty(customerUpdateRequest.getApiCertificateDtoList())) {
oldCustomer.setCertificateList(GSON.toJson(customerUpdateRequest.getApiCertificateDtoList()));
}
// 数据校验 // 数据校验
customerService.validCustomer(oldCustomer); customerService.validCustomer(oldCustomer);
// 更新主表 // 更新主表
......
...@@ -392,7 +392,7 @@ public class CustomerVO implements Serializable { ...@@ -392,7 +392,7 @@ public class CustomerVO implements Serializable {
CustomerVO customerVO = new CustomerVO(); CustomerVO customerVO = new CustomerVO();
BeanUtils.copyProperties(customer, customerVO); BeanUtils.copyProperties(customer, customerVO);
if (ObjectUtils.isNotEmpty(customer.getAddressList())) { if (ObjectUtils.isNotEmpty(customer.getAddressList())) {
List<AddressVO> addressList = GSONUtil.fromJson((String) customer.getAddressList(), new TypeToken<List<AddressVO>>() { List<AddressVO> addressList = GSONUtil.fromJson(customer.getAddressList(), new TypeToken<List<AddressVO>>() {
}.getType()); }.getType());
customerVO.setAddressList(addressList); customerVO.setAddressList(addressList);
} }
...@@ -401,6 +401,11 @@ public class CustomerVO implements Serializable { ...@@ -401,6 +401,11 @@ public class CustomerVO implements Serializable {
}.getType()); }.getType());
customerVO.setApiTaxationDtoList(taxList); customerVO.setApiTaxationDtoList(taxList);
} }
if (ObjectUtils.isNotEmpty(customer.getCertificateList())) {
List<ApiCertificateDto> certificateList = GSONUtil.fromJson((String) customer.getCertificateList(), new TypeToken<List<ApiCertificateDto>>() {
}.getType());
customerVO.setApiCertificateDtoList(certificateList);
}
return customerVO; return customerVO;
} }
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
<result property="birthplace" column="birthplace" /> <result property="birthplace" column="birthplace" />
<result property="isOtherCountry" column="is_other_country" /> <result property="isOtherCountry" column="is_other_country" />
<result property="taxList" column="tax_list" /> <result property="taxList" column="tax_list" />
<result property="certificateList" column="certificate_list" />
<result property="smokingStatus" column="smoking_status" /> <result property="smokingStatus" column="smoking_status" />
<result property="maritalStatus" column="marital_status" /> <result property="maritalStatus" column="marital_status" />
<result property="educationLevel" column="education_level" /> <result property="educationLevel" column="education_level" />
...@@ -71,7 +72,7 @@ ...@@ -71,7 +72,7 @@
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id,customer_biz_id,name_cn,name_py_en,document_type,id_number, id,customer_biz_id,name_cn,name_py_en,document_type,id_number,
gender,birthday,age,nationality,birthplace, gender,birthday,age,nationality,birthplace,
is_other_country,tax_list,smoking_status,marital_status,education_level,is_retirement, is_other_country,tax_list,certificate_list,smoking_status,marital_status,education_level,is_retirement,
retirement_age,height,weight,bmi,risk_appetite, retirement_age,height,weight,bmi,risk_appetite,
dependents_num,mobile_code,mobile,residence_mobile_code,residence_mobile, dependents_num,mobile_code,mobile,residence_mobile_code,residence_mobile,
landline_code,landline,email,certificate_address,mailing_address, landline_code,landline,email,certificate_address,mailing_address,
......
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