diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerServiceImpl.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerServiceImpl.java index 37bfb53a..5c6aabc6 100644 --- a/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerServiceImpl.java +++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerServiceImpl.java @@ -63,12 +63,10 @@ public class CustomerServiceImpl extends ServiceImpl pages = this.pageCheckout(page, size); // 查询所有客户的基本信息 IPage customerEntityIPage = customerDao.queryList(pages, customerRequest); - // 获取所有的客户基本信息 List customers = customerEntityIPage.getRecords(); // 获取所有的客户经理id @@ -78,10 +76,8 @@ public class CustomerServiceImpl extends ServiceImpl employeeTO = (List) responseResult.getData(); - // 将客户信息和客户经理及部门信息拼装起来 List customerTOS = this.jointCustomerEmployee(customers, employeeTO); - // 属性拷贝,将泛型为CustomerEntity类型的IPage的属性拷贝给泛型为CustomerTO类型的IPage,才能赋值给PageUtils IPage iPage = new Page<>(); BeanUtils.copyProperties(customerEntityIPage, iPage); @@ -101,6 +97,33 @@ public class CustomerServiceImpl extends ServiceImpl().SUCCESS(customerPersonalDTO); + } else { + CompanyCustomerEntity companyCustomerEntity = companyCustomerDao.queryCompanyCustomerById(id); + // 封装企业类型客户信息 + CustomerCompanyDTO customerCompanyDTO = this.setCompany(customer, companyCustomerEntity); + return new ResponseResult().SUCCESS(customerCompanyDTO); + } + } + + /** + * 根据id查询客户的信息(导入到excel中) + */ + public ResponseResult getCustomerById(Long id) { + if (id == null){ return new ResponseResult(CommonCode.INVALID_PARAM); } @@ -203,6 +226,9 @@ public class CustomerServiceImpl extends ServiceImpl personalList = new ArrayList<>(); List longList = customerDao.listCustomerId(); for (Long id : longList) { - ResponseResult responseResult = this.queryCustomerById(id); + ResponseResult responseResult = this.getCustomerById(id); if ((responseResult.getData()).getClass() == CustomerCompanyVO.class){ companyList.add((CustomerCompanyVO) responseResult.getData()); }else { @@ -337,7 +366,7 @@ public class CustomerServiceImpl extends ServiceImpl jointCustomerEmployee(List customers, List employeeTO) { List customerTOS = new ArrayList<>();// 用于拼装客户信息和员工及部门信息的集合 CustomerTO customerTO; - // 将客户信息和客户经理及部门信息拼装起来 for (CustomerEntity customer : customers) { // 每一个客户对应一个不同的对象 customerTO = new CustomerTO(); for (EmployeeTO anEmployeeTO : employeeTO) { if (Objects.equals(customer.getManager(), anEmployeeTO.getId())) { - customerTO.setId(customer.getId()); - customerTO.setCode(customer.getCode()); - customerTO.setName(customer.getName()); - customerTO.setPhone(customer.getPhone()); - customerTO.setType(customer.getType()); + BeanUtils.copyProperties(customer,customerTO); customerTO.setManager(anEmployeeTO.getEmpName()); customerTO.setDepartments(anEmployeeTO.getDeptNames()); customerTOS.add(customerTO); } } if (!Objects.equals(customerTO.getId(), customer.getId())) { - customerTO.setId(customer.getId()); - customerTO.setCode(customer.getCode()); - customerTO.setName(customer.getName()); - customerTO.setPhone(customer.getPhone()); - customerTO.setType(customer.getType()); + BeanUtils.copyProperties(customer,customerTO); customerTOS.add(customerTO); } } return customerTOS; } + + /** * 封装个人类型的客户信息 * * @param customer 客户基本信息 - * @param name 客户经理姓名 * @param personal 个人类型信息 * @return */ - private CustomerPersonalVO setPersonal(CustomerEntity customer, String name, PersonalCustomerEntity personal) { + private CustomerPersonalDTO setPersonal(CustomerEntity customer, PersonalCustomerEntity personal) { //BeanUtils能批量封装相同字段名称和类型的属性的值 - CustomerPersonalVO customerPersonalVO = new CustomerPersonalVO(); - customerPersonalVO.setCode(customer.getCode()); - customerPersonalVO.setType(customer.getType()); - customerPersonalVO.setManager(name); - customerPersonalVO.setName(customer.getName()); - customerPersonalVO.setAddr(customer.getAddr()); - customerPersonalVO.setPhone(customer.getPhone()); - customerPersonalVO.setIdCard(personal.getIdCard()); - customerPersonalVO.setAge(personal.getAge()); - customerPersonalVO.setGender(personal.getGender()); - customerPersonalVO.setMaritalStatus(personal.getMaritalStatus()); - customerPersonalVO.setEducation(personal.getEducation()); - customerPersonalVO.setEmployer(personal.getEmployer()); - customerPersonalVO.setPosition(personal.getPosition()); - customerPersonalVO.setWorkingYears(personal.getWorkingYears()); - customerPersonalVO.setSocialSecurityNum(personal.getSocialSecurityNum()); - customerPersonalVO.setLivingSituation(personal.getLivingSituation()); - customerPersonalVO.setResidenceAddr(personal.getResidenceAddr()); - customerPersonalVO.setBusinessSource(personal.getBusinessSource()); - customerPersonalVO.setEmergencyLinkman(personal.getEmergencyLinkman()); - customerPersonalVO.setEmergencyLinkmanRelationship(personal.getEmergencyLinkmanRelationship()); - customerPersonalVO.setEmergencyLinkmanPhone(personal.getEmergencyLinkmanPhone()); - return customerPersonalVO; + CustomerPersonalDTO personalDTO = new CustomerPersonalDTO(); + BeanUtils.copyProperties(customer,personalDTO); + BeanUtils.copyProperties(personal,personalDTO); + return personalDTO; } /** * 封装企业类型的客户信息 * * @param customer 客户基本信息 - * @param name 客户经理姓名 * @param company 企业类型信息 * @return */ + private CustomerCompanyDTO setCompany(CustomerEntity customer, CompanyCustomerEntity company) { + CustomerCompanyDTO companyDTO = new CustomerCompanyDTO(); + BeanUtils.copyProperties(customer,companyDTO); + BeanUtils.copyProperties(company,companyDTO); + return companyDTO; + } + + /** + * 封装企业类型的客户信息(excel) + */ private CustomerCompanyVO setCompany(CustomerEntity customer, String name, CompanyCustomerEntity company) { CustomerCompanyVO customerCompanyVO = new CustomerCompanyVO(); - customerCompanyVO.setCode(customer.getCode()); - customerCompanyVO.setType(customer.getType()); + BeanUtils.copyProperties(customer,customerCompanyVO); + BeanUtils.copyProperties(company,customerCompanyVO); customerCompanyVO.setManager(name); - customerCompanyVO.setName(customer.getName()); - customerCompanyVO.setAddr(customer.getAddr()); - customerCompanyVO.setPhone(customer.getPhone()); - customerCompanyVO.setRegisteredCapital(company.getRegisteredCapital()); - customerCompanyVO.setIndustry(company.getIndustry()); - customerCompanyVO.setYears(company.getYears()); - customerCompanyVO.setRegion(company.getRegion()); - customerCompanyVO.setShareholder(company.getShareholder()); - customerCompanyVO.setAffiliatedCompany(company.getAffiliatedCompany()); - customerCompanyVO.setEmployeeNumber(company.getEmpNum()); - customerCompanyVO.setLinkman(company.getLinkman()); - customerCompanyVO.setBusinessSource(company.getBusinessSource()); return customerCompanyVO; } + + /** + * 封装个人类型的客户信息(excel) + */ + private CustomerPersonalVO setPersonal(CustomerEntity customer, String name, PersonalCustomerEntity personal) { + //BeanUtils能批量封装相同字段名称和类型的属性的值 + CustomerPersonalVO customerPersonalVO = new CustomerPersonalVO(); + BeanUtils.copyProperties(customer,customerPersonalVO); + BeanUtils.copyProperties(personal,customerPersonalVO); + customerPersonalVO.setManager(name); + return customerPersonalVO; + } } \ No newline at end of file diff --git a/dq-financial-crms/target/classes/com/daqing/financial/crms/service/impl/CustomerServiceImpl.class b/dq-financial-crms/target/classes/com/daqing/financial/crms/service/impl/CustomerServiceImpl.class index 547b83fb..a68be868 100644 Binary files a/dq-financial-crms/target/classes/com/daqing/financial/crms/service/impl/CustomerServiceImpl.class and b/dq-financial-crms/target/classes/com/daqing/financial/crms/service/impl/CustomerServiceImpl.class differ diff --git a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/controller/UserLoginController.java b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/controller/UserLoginController.java index 195035db..53ad49d6 100644 --- a/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/controller/UserLoginController.java +++ b/dq-financial-hrms-auth/src/main/java/com/daqing/financial/hrauth/controller/UserLoginController.java @@ -14,7 +14,7 @@ import javax.validation.Valid; /** -* @auther River + * @auther River * @date 2020/9/22 15:27 */ @RestController diff --git a/dq-financial-hrms-auth/src/main/resources/bootstrap.properties b/dq-financial-hrms-auth/src/main/resources/bootstrap.properties index c86389db..3187c1a2 100644 --- a/dq-financial-hrms-auth/src/main/resources/bootstrap.properties +++ b/dq-financial-hrms-auth/src/main/resources/bootstrap.properties @@ -18,9 +18,9 @@ spring.cloud.nacos.config.ext-config[2].data-id=other.yml spring.cloud.nacos.config.ext-config[2].group=dev spring.cloud.nacos.config.ext-config[2].refresh=true -spring.redis.host=127.0.0.1 +spring.redis.host=192.168.232.128 spring.redis.port=6379 -spring.redis.password=123456 +spring.redis.password= spring.redis.database=0 spring.redis.timeout=30000 spring.redis.jedis.pool.max-active=8 diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/EmployeeServiceImpl.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/EmployeeServiceImpl.java index eaedcf4e..0752d78e 100644 --- a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/EmployeeServiceImpl.java +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/EmployeeServiceImpl.java @@ -55,5 +55,4 @@ public class EmployeeServiceImpl extends ServiceImpl #{id} @@ -44,7 +47,12 @@ @@ -55,15 +63,22 @@ ON e.id = ed.employee_id LEFT JOIN hrms_dept d ON ed.dept_id = d.id - WHERE d.id = #{id} + LEFT JOIN hrms_user u + ON e.user_id = u.id + WHERE u.del_or_not = 0 + AND d.id = #{id} + - SELECT name FROM hrms_employee WHERE id = #{id} + SELECT e.name name + FROM hrms_employee e + LEFT JOIN hrms_user u + ON e.user_id = u.id + WHERE u.del_or_not = 0 + AND e.id = #{id} @@ -55,15 +63,22 @@ ON e.id = ed.employee_id LEFT JOIN hrms_dept d ON ed.dept_id = d.id - WHERE d.id = #{id} + LEFT JOIN hrms_user u + ON e.user_id = u.id + WHERE u.del_or_not = 0 + AND d.id = #{id} +