|
|
@ -77,7 +77,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity |
|
|
|
// 时间参数校验
|
|
|
|
// 时间参数校验
|
|
|
|
this.timeCheckout(customerRequest.getCreateTime(), customerRequest.getStartTime(), customerRequest.getEndTime(), customerRequest); |
|
|
|
this.timeCheckout(customerRequest.getCreateTime(), customerRequest.getStartTime(), customerRequest.getEndTime(), customerRequest); |
|
|
|
// 分页参数校验
|
|
|
|
// 分页参数校验
|
|
|
|
if (page == null || size == null) { |
|
|
|
if (page == null || page < 1 || size == null || size < 1) { |
|
|
|
page = 1; |
|
|
|
page = 1; |
|
|
|
size = 10; |
|
|
|
size = 10; |
|
|
|
} |
|
|
|
} |
|
|
@ -336,7 +336,7 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity |
|
|
|
//TODO 查询所有的客户详细信息,并按照类型封装,后续有待优化,消耗时间太长
|
|
|
|
//TODO 查询所有的客户详细信息,并按照类型封装,后续有待优化,消耗时间太长
|
|
|
|
try { |
|
|
|
try { |
|
|
|
List<CustomerCompanyVO> companyList = new ArrayList<>(); |
|
|
|
List<CustomerCompanyVO> companyList = new ArrayList<>(); |
|
|
|
List<CustomerPersonalVO> personalList = new ArrayList<>(); |
|
|
|
/*List<CustomerPersonalVO> personalList = new ArrayList<>(); |
|
|
|
List<Long> longList = customerDao.listCustomerId(); |
|
|
|
List<Long> longList = customerDao.listCustomerId(); |
|
|
|
if (longList != null) { |
|
|
|
if (longList != null) { |
|
|
|
for (Long id : longList) { |
|
|
|
for (Long id : longList) { |
|
|
@ -350,6 +350,17 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity |
|
|
|
} |
|
|
|
} |
|
|
|
ExcelUtil.writeExcelWithSheets(response, personalList, "客户资源信息一览表", "个人类型", new CustomerPersonalVO()) |
|
|
|
ExcelUtil.writeExcelWithSheets(response, personalList, "客户资源信息一览表", "个人类型", new CustomerPersonalVO()) |
|
|
|
.write(companyList, "企业类型", new CustomerCompanyVO()) |
|
|
|
.write(companyList, "企业类型", new CustomerCompanyVO()) |
|
|
|
|
|
|
|
.finish();*/ |
|
|
|
|
|
|
|
List<Long> longList = customerDao.listCompanyCustomerIds(); |
|
|
|
|
|
|
|
if (null != longList) { |
|
|
|
|
|
|
|
for (Long id : longList) { |
|
|
|
|
|
|
|
ResponseResult responseResult = this.getCustomerById(id); |
|
|
|
|
|
|
|
if (null != responseResult) { |
|
|
|
|
|
|
|
companyList.add((CustomerCompanyVO) responseResult.getData()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
ExcelUtil.writeExcelWithSheets(response, companyList,"客户资源信息一览表","企业类型", new CustomerCompanyVO()) |
|
|
|
.finish(); |
|
|
|
.finish(); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
ExceptionCast.cast(CrmsCode.CUSTOMER_EXPORT_EXSIT); |
|
|
|
ExceptionCast.cast(CrmsCode.CUSTOMER_EXPORT_EXSIT); |
|
|
@ -363,9 +374,11 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity |
|
|
|
public void excelTemplate(HttpServletResponse response) { |
|
|
|
public void excelTemplate(HttpServletResponse response) { |
|
|
|
try { |
|
|
|
try { |
|
|
|
List<CompanyTemplate> companyTemplates = new ArrayList<>(); |
|
|
|
List<CompanyTemplate> companyTemplates = new ArrayList<>(); |
|
|
|
List<PersonalTemplate> personalTemplates = new ArrayList<>(); |
|
|
|
/*List<PersonalTemplate> personalTemplates = new ArrayList<>(); |
|
|
|
ExcelUtil.writeExcelWithSheets(response, personalTemplates, "客户资源信息表模板", "个人类型", new PersonalTemplate()) |
|
|
|
ExcelUtil.writeExcelWithSheets(response, personalTemplates, "客户资源信息表模板", "个人类型", new PersonalTemplate()) |
|
|
|
.write(companyTemplates, "企业类型", new CompanyTemplate()) |
|
|
|
.write(companyTemplates, "企业类型", new CompanyTemplate()) |
|
|
|
|
|
|
|
.finish();*/ |
|
|
|
|
|
|
|
ExcelUtil.writeExcelWithSheets(response, companyTemplates,"客户资源信息表模板","企业类型", new CompanyTemplate()) |
|
|
|
.finish(); |
|
|
|
.finish(); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception e) { |
|
|
|
ExceptionCast.cast(CrmsCode.CUSTOMER_EXPORTTEMPLATE_EXSIT); |
|
|
|
ExceptionCast.cast(CrmsCode.CUSTOMER_EXPORTTEMPLATE_EXSIT); |
|
|
@ -385,17 +398,17 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity |
|
|
|
ExceptionCast.cast(CrmsCode.NOT_NULL); |
|
|
|
ExceptionCast.cast(CrmsCode.NOT_NULL); |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
try { |
|
|
|
List<Object> personalList = ExcelUtil.readExcel(excel, new PersonalTemplate(), 1); |
|
|
|
List<Object> companyList = ExcelUtil.readExcel(excel, new CompanyTemplate(), 1); |
|
|
|
List<Object> companyList = ExcelUtil.readExcel(excel, new CompanyTemplate(), 2); |
|
|
|
/*List<Object> personalList = ExcelUtil.readExcel(excel, new PersonalTemplate(), 1); |
|
|
|
/*List<EmployeeVO> nameList = hrmsFeignService.listEmployeeName().getData();*/ |
|
|
|
List<EmployeeVO> nameList = hrmsFeignService.listEmployeeName().getData(); |
|
|
|
CustomerPersonalTOI customerPersonalTOI; |
|
|
|
CustomerPersonalTOI customerPersonalTOI; |
|
|
|
/*ManagerName manager; // 客户名称*/ |
|
|
|
ManagerName manager; // 客户名称
|
|
|
|
// 个人类型
|
|
|
|
// 个人类型
|
|
|
|
for (Object personal : personalList) { |
|
|
|
for (Object personal : personalList) { |
|
|
|
customerPersonalTOI = new CustomerPersonalTOI(); |
|
|
|
customerPersonalTOI = new CustomerPersonalTOI(); |
|
|
|
customerPersonalTOI.setType(0); |
|
|
|
customerPersonalTOI.setType(0); |
|
|
|
BeanUtils.copyProperties(personal, customerPersonalTOI); |
|
|
|
BeanUtils.copyProperties(personal, customerPersonalTOI); |
|
|
|
/*manager = new ManagerName(); |
|
|
|
manager = new ManagerName(); |
|
|
|
BeanUtils.copyProperties(personal, manager); |
|
|
|
BeanUtils.copyProperties(personal, manager); |
|
|
|
// 根据客户经理名称找到对应的员工id
|
|
|
|
// 根据客户经理名称找到对应的员工id
|
|
|
|
if (nameList != null && manager.getManager() != null) { |
|
|
|
if (nameList != null && manager.getManager() != null) { |
|
|
@ -407,9 +420,9 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity |
|
|
|
if (customerPersonalTOI.getManager() == null) { |
|
|
|
if (customerPersonalTOI.getManager() == null) { |
|
|
|
return new ResponseResult<String>().FAIL("导入数据失败,员工" + manager.getManager() + "不存在"); |
|
|
|
return new ResponseResult<String>().FAIL("导入数据失败,员工" + manager.getManager() + "不存在"); |
|
|
|
} |
|
|
|
} |
|
|
|
}*/ |
|
|
|
|
|
|
|
this.saveCustomerPersonal(customerPersonalTOI); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
this.saveCustomerPersonal(customerPersonalTOI); |
|
|
|
|
|
|
|
}*/ |
|
|
|
// 企业类型
|
|
|
|
// 企业类型
|
|
|
|
for (Object company : companyList) { |
|
|
|
for (Object company : companyList) { |
|
|
|
CompanyCustomerRequest companyCustomerRequest = new CompanyCustomerRequest(); |
|
|
|
CompanyCustomerRequest companyCustomerRequest = new CompanyCustomerRequest(); |
|
|
|