Commit aeeee127 by jianan

Fna接口17

parent a3cfba5b
......@@ -2,10 +2,7 @@ package com.yd.csf.api.service.impl;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yd.auth.core.dto.AuthUserDto;
import com.yd.auth.core.utils.SecurityUtil;
import com.yd.common.enums.CommonEnum;
import com.yd.common.enums.ResultCode;
import com.yd.common.exception.BusinessException;
import com.yd.common.result.Result;
import com.yd.common.utils.RandomStringGenerator;
......@@ -16,11 +13,8 @@ import com.yd.csf.feign.request.appointmentfile.ApiAppointmentFileEditRequest;
import com.yd.csf.feign.request.appointmentfile.ApiAppointmentFilePageRequest;
import com.yd.csf.feign.response.appointmentfile.ApiAppointmentFilePageResponse;
import com.yd.csf.service.model.AppointmentFile;
import com.yd.csf.service.model.Policyholder;
import com.yd.csf.service.service.IAppointmentFileService;
import com.yd.user.feign.response.sysuser.ApiSysUserPageResponse;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......
......@@ -10,4 +10,5 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface CustomerExpandService extends IService<CustomerExpand> {
CustomerExpand getByCustomerBizId(String customerBizId);
}
package com.yd.csf.service.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yd.csf.service.model.CustomerExpand;
import com.yd.csf.service.service.CustomerExpandService;
......@@ -15,6 +16,10 @@ import org.springframework.stereotype.Service;
public class CustomerExpandServiceImpl extends ServiceImpl<CustomerExpandMapper, CustomerExpand>
implements CustomerExpandService{
@Override
public CustomerExpand getByCustomerBizId(String customerBizId) {
return baseMapper.selectOne(new LambdaQueryWrapper<CustomerExpand>().eq(CustomerExpand::getCustomerBizId, customerBizId));
}
}
......
......@@ -28,6 +28,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
......@@ -54,7 +55,39 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
@Override
public CustomerVO getCustomerVO(Customer customer) {
return CustomerVO.objToVo(customer);
CustomerVO customerVO = CustomerVO.objToVo(customer);
// 1. 关联查询扩展信息
CustomerExpand customerExpand = customerExpandService.getByCustomerBizId(customer.getCustomerBizId());
if (customerExpand != null) {
CustomerExpandVO customerExpandVO = CustomerExpandVO.objToVo(customerExpand);
List<AddressVO> addressList = new ArrayList<>();
if (customerExpand.getResidenceAddress() != null) {
AddressVO addressVO = GSON.fromJson(customerExpand.getResidenceAddress(), AddressVO.class);
addressVO.setType("residenceAddress");
addressList.add(addressVO);
}
if (customerExpand.getResidentialAddress() != null) {
AddressVO addressVO = GSON.fromJson(customerExpand.getResidentialAddress(), AddressVO.class);
addressVO.setType("residentialAddress");
addressList.add(addressVO);
}
if (customerExpand.getMailingAddress() != null) {
AddressVO addressVO = GSON.fromJson(customerExpand.getMailingAddress(), AddressVO.class);
addressVO.setType("mailingAddress");
addressList.add(addressVO);
}
if (customerExpand.getCompanyAddress() != null) {
AddressVO addressVO = GSON.fromJson(customerExpand.getCompanyAddress(), AddressVO.class);
addressVO.setType("companyAddress");
addressList.add(addressVO);
}
customerExpandVO.setAddressList(addressList);
customerVO.setCustomerExpand(customerExpandVO);
}
return customerVO;
}
@Override
......@@ -66,22 +99,24 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerMapper, Customer>
public CustomerExpand getCustomerExpand(CustomerAddRequest customerAddRequest) {
CustomerExpand customerExpand = new CustomerExpand();
BeanUtils.copyProperties(customerAddRequest, customerExpand);
AddressVO residenceAddress = customerAddRequest.getResidenceAddress();
if (residenceAddress != null) {
customerExpand.setResidenceAddress(residenceAddress.toString());
}
AddressVO residentialAddress = customerAddRequest.getResidentialAddress();
if (residentialAddress != null) {
customerExpand.setResidentialAddress(residentialAddress.toString());
}
AddressVO mailingAddress = customerAddRequest.getMailingAddress();
if (mailingAddress != null) {
customerExpand.setMailingAddress(mailingAddress.toString());
}
AddressVO companyAddress = customerAddRequest.getCompanyAddress();
if (companyAddress != null) {
customerExpand.setCompanyAddress(companyAddress.toString());
List<AddressVO> addressList = customerAddRequest.getAddressList();
if (CollUtil.isNotEmpty(addressList)) {
for (AddressVO addressVO : addressList) {
if ("residenceAddress".equals(addressVO.getType())) {
customerExpand.setResidenceAddress(GSON.toJson(addressVO));
}
if ("residentialAddress".equals(addressVO.getType())) {
customerExpand.setResidentialAddress(GSON.toJson(addressVO));
}
if ("mailingAddress".equals(addressVO.getType())) {
customerExpand.setMailingAddress(GSON.toJson(addressVO));
}
if ("companyAddress".equals(addressVO.getType())) {
customerExpand.setCompanyAddress(GSON.toJson(addressVO));
}
}
}
return customerExpand;
}
......
......@@ -7,6 +7,7 @@ import org.springframework.beans.BeanUtils;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;
/**
* 客户扩展信息视图
......@@ -52,25 +53,7 @@ public class CustomerExpandVO implements Serializable {
@Schema(description = "是否长期出国")
private String longtimeAbroad;
/**
* 居住地址
*/
private AddressVO residenceAddress;
/**
* 住宅地址
*/
private AddressVO residentialAddress;
/**
* 邮寄地址
*/
private AddressVO mailingAddress;
/**
* 公司地址
*/
private AddressVO companyAddress;
private List<AddressVO> addressList;
/**
* 公司名称
......
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