From a03f2e92ffa07820a307506a4dd5883db4bf383d Mon Sep 17 00:00:00 2001 From: river <1376754470@qq.com> Date: Fri, 11 Dec 2020 16:20:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=89=8D=E5=90=8E=E5=8F=B0?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E5=88=97=E8=A1=A8=E5=AE=A2=E6=88=B7=E7=BB=8F?= =?UTF-8?q?=E7=90=86=E5=90=8D=E7=A7=B0=E5=92=8C=E9=83=A8=E9=97=A8=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CustomerServiceImpl.java | 208 +++++++++--------- .../impl/CustomerWorkbenchServiceImpl.java | 60 ++--- .../DgWorkConferenceConsiderServiceImpl.java | 15 +- .../service/impl/EmployeeServiceImpl.java | 109 ++++----- 4 files changed, 199 insertions(+), 193 deletions(-) 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 d6eaba47..52a04b69 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 @@ -82,26 +82,33 @@ public class CustomerServiceImpl extends ServiceImpl customers = customerEntityIPage.getRecords(); // 获取所有的客户经理id - Long[] managerIds = customers.stream().map(CustomerEntity::getManager).toArray(Long[]::new); - - if (managerIds.length != 0) { - //TODO 远程调用查询客户经理信息的接口 - ResponseResult responseResult = hrmsFeignService.getEmployeeAndDeptById(managerIds); - List employeeTO = (List) responseResult.getData(); - if (employeeTO != null){ - // 将客户信息和客户经理及部门信息拼装起来 - List customerTOS = this.jointCustomerEmployee(customers, employeeTO); - // 属性拷贝,将泛型为CustomerEntity类型的IPage的属性拷贝给泛型为CustomerTO类型的IPage,才能赋值给PageUtils - IPage iPage = new Page<>(); - BeanUtils.copyProperties(customerEntityIPage, iPage); - iPage.setRecords(customerTOS); - return new PageUtils(iPage); - }else { - return new PageUtils(customerEntityIPage); + Long[] managerIds = new Long[customers.size()]; + for (int i = 0; i < customers.size(); i++) { + if (customers.get(i).getManager() != null) { + managerIds[i] = customers.get(i).getManager(); + } else { + managerIds[i] = 0L; } + } + // 属性拷贝,将泛型为CustomerEntity类型的IPage的属性拷贝给泛型为CustomerTO类型的IPage,才能赋值给PageUtils + IPage iPage = new Page<>(); + BeanUtils.copyProperties(customerEntityIPage, iPage); + List listResponse = new ArrayList<>(); + // 获取所有的客户经理名称和部门名称 + ResponseResult> responseResult = hrmsFeignService.getEmployeeAndDeptById(managerIds); + List employeeTO = responseResult.getData(); + if (employeeTO != null) { + // 将客户信息和客户经理及部门信息拼装起来 + listResponse = this.jointCustomerEmployee(customers, employeeTO); } else { - return new PageUtils(customerEntityIPage); + for (CustomerEntity customer : customers) { + CustomerTO customerTO = new CustomerTO(); + BeanUtils.copyProperties(customer, customerTO); + listResponse.add(customerTO); + } } + iPage.setRecords(listResponse); + return new PageUtils(iPage); } /** @@ -113,7 +120,7 @@ public class CustomerServiceImpl extends ServiceImpl().SUCCESS(customerPersonalDTO); - } else if (Objects.equals(customer.getType(),CrmsConstant.CustomerType.COMPANY_CUSTOMER.getType())){ - // CompanyCustomerEntity companyCustomerEntity = companyCustomerDao.queryCompanyCustomerById(id); + } else if (Objects.equals(customer.getType(), CrmsConstant.CustomerType.COMPANY_CUSTOMER.getType())) { + // CompanyCustomerEntity companyCustomerEntity = companyCustomerDao.queryCompanyCustomerById(id); CompanyCustomerEntity companyCustomerEntity = companyCustomerDao.selectOne(new QueryWrapper() - .eq("customer_id",id)); + .eq("customer_id", id)); // 封装企业类型客户信息 CustomerCompanyDTO customerCompanyDTO = this.setCompany(customer, companyCustomerEntity); return new ResponseResult().SUCCESS(customerCompanyDTO); - }else { + } else { return new ResponseResult(CommonCode.INEXISTENCE); } } @@ -144,7 +151,7 @@ public class CustomerServiceImpl extends ServiceImpl employee = hrmsFeignService.getEmployeeById(customer.getManager()); - if (employee.getData() != null){ + if (employee.getData() != null) { // 客户经理姓名 name = hrmsFeignService.getEmployeeById(customer.getManager()).getData().getName(); } @@ -166,12 +173,12 @@ public class CustomerServiceImpl extends ServiceImpl().SUCCESS(customerPersonalVO); - } else if (Objects.equals(customer.getType(),CrmsConstant.CustomerType.COMPANY_CUSTOMER.getType())){ + } else if (Objects.equals(customer.getType(), CrmsConstant.CustomerType.COMPANY_CUSTOMER.getType())) { CompanyCustomerEntity companyCustomerEntity = companyCustomerDao.queryCompanyCustomerById(id); // 封装企业类型客户信息 CustomerCompanyVO customerCompanyVO = this.setCompany(customer, name, companyCustomerEntity); return new ResponseResult().SUCCESS(customerCompanyVO); - }else { + } else { return new ResponseResult(CommonCode.INEXISTENCE); } } @@ -184,7 +191,7 @@ public class CustomerServiceImpl extends ServiceImpl updateCustomerById(Long[] ids) { - if (ids == null || ids.length == 0){ + if (ids == null || ids.length == 0) { return null; } //TODO 远程调用审批模块判断所选客户是否在审批,返回正在审批的客户的id集合Long[] idArray @@ -209,10 +216,10 @@ public class CustomerServiceImpl extends ServiceImpl companyList = new ArrayList<>(); List personalList = new ArrayList<>(); List longList = customerDao.listCustomerId(); - if (longList != null){ + if (longList != null) { for (Long id : longList) { ResponseResult responseResult = this.getCustomerById(id); - if ((responseResult.getData()).getClass() == CustomerCompanyVO.class){ + if ((responseResult.getData()).getClass() == CustomerCompanyVO.class) { companyList.add((CustomerCompanyVO) responseResult.getData()); - }else { + } else { personalList.add((CustomerPersonalVO) responseResult.getData()); } } } - ExcelUtil.writeExcelWithSheets(response,personalList,"客户资源信息一览表","个人类型",new CustomerPersonalVO()) - .write(companyList,"企业类型",new CustomerCompanyVO()) + ExcelUtil.writeExcelWithSheets(response, personalList, "客户资源信息一览表", "个人类型", new CustomerPersonalVO()) + .write(companyList, "企业类型", new CustomerCompanyVO()) .finish(); - }catch (Exception e){ + } catch (Exception e) { ExceptionCast.cast(CrmsCode.CUSTOMER_EXPORT_EXSIT); } } @@ -321,27 +329,28 @@ public class CustomerServiceImpl extends ServiceImpl companyTemplates = new ArrayList<>(); List personalTemplates = new ArrayList<>(); - ExcelUtil.writeExcelWithSheets(response,personalTemplates,"客户资源信息表模板","个人类型",new PersonalTemplate()) - .write(companyTemplates,"企业类型",new CompanyTemplate()) + ExcelUtil.writeExcelWithSheets(response, personalTemplates, "客户资源信息表模板", "个人类型", new PersonalTemplate()) + .write(companyTemplates, "企业类型", new CompanyTemplate()) .finish(); - }catch (Exception e){ + } catch (Exception e) { ExceptionCast.cast(CrmsCode.CUSTOMER_EXPORTTEMPLATE_EXSIT); } } /** * 导入excel数据 + * * @param excel */ @Transactional @Override public ResponseResult excelImportCustomer(MultipartFile excel) { //TODO 导入excel数据到数据库,思路耗时太长,有待优化 - if (excel.isEmpty()){ + if (excel.isEmpty()) { ExceptionCast.cast(CrmsCode.NOT_NULL); } try { - List personalList = ExcelUtil.readExcel(excel,new PersonalTemplate(), 1); + List personalList = ExcelUtil.readExcel(excel, new PersonalTemplate(), 1); List companyList = ExcelUtil.readExcel(excel, new CompanyTemplate(), 2); List nameList = hrmsFeignService.listEmployeeName().getData(); CustomerPersonalTOI customerPersonalTOI; @@ -350,44 +359,44 @@ public class CustomerServiceImpl extends ServiceImpl().SUCCESS("导入数据失败,员工"+manager.getManager()+"不存在"); + if (customerPersonalTOI.getManager() == null) { + return new ResponseResult().SUCCESS("导入数据失败,员工" + manager.getManager() + "不存在"); } } this.saveCustomerPersonal(customerPersonalTOI); } // 企业类型 - for (Object company : companyList){ + for (Object company : companyList) { CustomerCompanyTOI customerCompanyTOI = new CustomerCompanyTOI(); manager = new ManagerName(); customerCompanyTOI.setType(1); - BeanUtils.copyProperties(company,customerCompanyTOI); - BeanUtils.copyProperties(company,manager); + BeanUtils.copyProperties(company, customerCompanyTOI); + BeanUtils.copyProperties(company, manager); // 根据客户经理名称找到对应的员工id - if (nameList != null && manager.getManager() != null){ - for (EmployeeVO employeeVO : nameList){ - if (Objects.equals(manager.getManager(),employeeVO.getName())){ + if (nameList != null && manager.getManager() != null) { + for (EmployeeVO employeeVO : nameList) { + if (Objects.equals(manager.getManager(), employeeVO.getName())) { customerCompanyTOI.setManager(employeeVO.getId()); } } - if (customerCompanyTOI.getManager() == null){ - return new ResponseResult().SUCCESS("导入数据失败,员工"+manager.getManager()+"不存在"); + if (customerCompanyTOI.getManager() == null) { + return new ResponseResult().SUCCESS("导入数据失败,员工" + manager.getManager() + "不存在"); } } this.saveCustomerCompany(customerCompanyTOI); } return ResponseResult.SUCCESS(); - }catch (Exception e){ + } catch (Exception e) { return new ResponseResult().SUCCESS("导入数据失败,请检查文件和数据格式或稍后再试"); } } @@ -410,7 +419,7 @@ public class CustomerServiceImpl extends ServiceImpl pageCheckout(Integer page, Integer size) { + private Page pageCheckout(Integer page, Integer size) { // 查询客户有效总条数 Integer count = this.count(new QueryWrapper().eq("del_or_not", CrmsConstant.NOT_DELETE)); if (size == null || size < 1) { @@ -467,24 +476,19 @@ public class CustomerServiceImpl extends ServiceImpl queryCompanyCodeAndName(int type) { - Listlist = customerDao.queryCompanyCodeAndName(type); + List list = customerDao.queryCompanyCodeAndName(type); return list; } @@ -555,10 +559,10 @@ public class CustomerServiceImpl extends ServiceImpl relatedList = new ArrayList<>(); List intList = companyCustomerReq.getRelatedId(); - for(int i=0;i0){ + if (customer == true && company > 0) { return true; } return false; @@ -592,34 +596,34 @@ public class CustomerServiceImpl extends ServiceImpl() - .eq("customer_id",companyCustomerEntity.getCustomerId())); + .eq("customer_id", companyCustomerEntity.getCustomerId())); //根据企业id删除关联关系 - crmsCustomerRelatedMapper.delete(new QueryWrapper().eq("customer_id",companyCustomerEntity.getId())); + crmsCustomerRelatedMapper.delete(new QueryWrapper().eq("customer_id", companyCustomerEntity.getId())); //绑定关联关系 List relatedList = new ArrayList<>(); List intList = companyCustomerReq.getRelatedId(); - for(int i=0;i0){ + if (relatedList.size() > 0) { crmsCustomerRelatedService.insertCustomerRelated(relatedList); } - if(customer==true && company>0){ + if (customer == true && company > 0) { return true; } return false; diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerWorkbenchServiceImpl.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerWorkbenchServiceImpl.java index b8872bd2..21d1d9a1 100644 --- a/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerWorkbenchServiceImpl.java +++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerWorkbenchServiceImpl.java @@ -62,40 +62,44 @@ public class CustomerWorkbenchServiceImpl extends ServiceImpl customerEntityIPage = this.getBaseMapper().queryList(new Page(page, size), cwr); List customers = customerEntityIPage.getRecords(); // 获取所有的客户经理id - Long[] managerIds = customers.stream().map(CustomerEntityResponse::getManager).toArray(Long[]::new); + Long[] managerIds = new Long[customers.size()]; + for (int i = 0; i < customers.size(); i++) { + if (customers.get(i).getManager() != null) { + managerIds[i] = customers.get(i).getManager(); + } else { + managerIds[i] = 0L; + } + } // 获取所有的客户id Long[] customerIds = customers.stream().map(CustomerEntityResponse::getId).toArray(Long[]::new); // 返回列表实体类集合 - List customerWorkbenchListVOS = new ArrayList<>(); - for (int i = 0; i < customers.size(); i++) { - CustomerWorkbenchListVO customerWorkbenchListVO = new CustomerWorkbenchListVO(); - BeanUtils.copyProperties(customers.get(i), customerWorkbenchListVO); - customerWorkbenchListVOS.add(customerWorkbenchListVO); - } - System.out.println(customerWorkbenchListVOS); - if (managerIds.length != 0) { - // 远程调用查询客户对应的客户经理信息 - ResponseResult responseResult = hrmsFeignService.getEmployeeAndDeptById(managerIds); - List employeeTOs = (List) responseResult.getData(); - if (employeeTOs != null) { - customerWorkbenchListVOS = this.jointCustomerEmployee(customers, employeeTOs); + List listResponse = new ArrayList<>(); + // 远程调用查询客户对应的客户经理信息 + ResponseResult> responseResult = hrmsFeignService.getEmployeeAndDeptById(managerIds); + List employeeTOs = responseResult.getData(); + if (employeeTOs != null) { + listResponse = this.jointCustomerEmployee(customers, employeeTOs); + } else { + for (CustomerEntityResponse customer : customers) { + CustomerWorkbenchListVO workbenchListVO = new CustomerWorkbenchListVO(); + BeanUtils.copyProperties(customer, workbenchListVO); + listResponse.add(workbenchListVO); } } if (customerIds.length != 0) { // TODO:远程调用担保服务查询每个客户的审批状态 - for (CustomerWorkbenchListVO customerWorkbenchListVO : customerWorkbenchListVOS) { + for (CustomerWorkbenchListVO customerWorkbenchListVO : listResponse) { customerWorkbenchListVO.setStatus(2); } if (cwr.getStatus() != null && (cwr.getStatus() == 0 || cwr.getStatus() == 1 || cwr.getStatus() == 2)) { // 筛选状态 - customerWorkbenchListVOS.removeIf(customerWorkbenchListVO -> !Objects.equals(customerWorkbenchListVO.getStatus(), cwr.getStatus())); + listResponse.removeIf(customerWorkbenchListVO -> !Objects.equals(customerWorkbenchListVO.getStatus(), cwr.getStatus())); } } - System.out.println(customerWorkbenchListVOS); // 属性拷贝,将泛型为CustomerEntity类型的IPage的属性拷贝给泛型为CustomerTO类型的IPage,才能赋值给PageUtils IPage iPage = new Page<>(); BeanUtils.copyProperties(customerEntityIPage, iPage); - iPage.setRecords(customerWorkbenchListVOS); + iPage.setRecords(listResponse); return new PageUtils(iPage); } @@ -252,26 +256,22 @@ public class CustomerWorkbenchServiceImpl extends ServiceImpl jointCustomerEmployee(List customers, List employeeTO) { - List customerWorkbenchListVOS = new ArrayList<>();// 用于拼装客户信息和员工及部门信息的集合 + List listResponse = new ArrayList<>();// 用于拼装客户信息和员工及部门信息的集合 CustomerWorkbenchListVO customerWorkbenchListVO; // 将客户信息和客户经理及部门信息拼装起来 for (CustomerEntityResponse customer : customers) { // 每一个客户对应一个不同的对象 customerWorkbenchListVO = new CustomerWorkbenchListVO(); - for (EmployeeTO anEmployeeTO : employeeTO) { - if (Objects.equals(customer.getManager(), anEmployeeTO.getId())) { - BeanUtils.copyProperties(customer, customerWorkbenchListVO); - customerWorkbenchListVO.setManager(anEmployeeTO.getEmpName()); - customerWorkbenchListVO.setDepartments(anEmployeeTO.getDeptNames()); - customerWorkbenchListVOS.add(customerWorkbenchListVO); + for (int i = 0; i < employeeTO.size(); i++) { + if (customer.getManager() != null && customer.getManager().equals(employeeTO.get(i).getId())) { + customerWorkbenchListVO.setManager(employeeTO.get(i).getEmpName()); + customerWorkbenchListVO.setDepartments(employeeTO.get(i).getDeptNames()); } } - if (!Objects.equals(customerWorkbenchListVO.getId(), customer.getId())) { - BeanUtils.copyProperties(customer, customerWorkbenchListVO); - customerWorkbenchListVOS.add(customerWorkbenchListVO); - } + BeanUtils.copyProperties(customer, customerWorkbenchListVO); + listResponse.add(customerWorkbenchListVO); } - return customerWorkbenchListVOS; + return listResponse; } /** diff --git a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgWorkConferenceConsiderServiceImpl.java b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgWorkConferenceConsiderServiceImpl.java index 69193331..759ad3cf 100644 --- a/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgWorkConferenceConsiderServiceImpl.java +++ b/dq-financial-guarantee/src/main/java/com/daqing/financial/guarantee/service/impl/DgWorkConferenceConsiderServiceImpl.java @@ -107,20 +107,21 @@ public class DgWorkConferenceConsiderServiceImpl extends ServiceImpl> responseResult = hrmsFeignService.listEmpNameByUserId(userIds); System.out.println(responseResult.getData()); - List workConferenceResponses = new ArrayList<>(); + List listResponse = new ArrayList<>(); if (responseResult.getData() != null) { // 将对应的userId转换为name - workConferenceResponses = this.transitionUserName(dgWorkConferencePOS, responseResult.getData()); + listResponse = this.transitionUserName(dgWorkConferencePOS, responseResult.getData()); } else { - for (int i = 0; i < dgWorkConferencePOS.size(); i++) { - DgWorkConferenceResponse workConferenceResponse = new DgWorkConferenceResponse(); - BeanUtils.copyProperties(dgWorkConferencePOS.get(i), workConferenceResponse); - workConferenceResponses.add(workConferenceResponse); + for (DgWorkConferencePO workConferencePO : dgWorkConferencePOS) { + DgWorkConferenceResponse workConference = new DgWorkConferenceResponse(); + BeanUtils.copyProperties(workConferencePO, workConference); + listResponse.add(workConference); } } + // 分页属性复制并返回 IPage iPage = new Page<>(); BeanUtils.copyProperties(list, iPage); - iPage.setRecords(workConferenceResponses); + iPage.setRecords(listResponse); return new PageUtils(iPage); } 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 143b68fa..6856fee3 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 @@ -56,7 +56,7 @@ public class EmployeeServiceImpl extends ServiceImpl= user.getDisableEndTime().getTime()){ + if (user.getDisableStartTime().getTime() >= user.getDisableEndTime().getTime()) { ExceptionCast.cast(HrmsCode.EMPLOYEE_DISABLE_TIME_ERROR); } Long userId = this.getBaseMapper().getUserId(employeeDisableRequest.getEmployeeId()); if (user.getDisableStartTime().getTime() <= (new Date()).getTime() - && (new Date()).getTime() <= user.getDisableEndTime().getTime()){ + && (new Date()).getTime() <= user.getDisableEndTime().getTime()) { user.setId(userId); user.setStatus(PromptSuccess.STOP_STATUS); return this.getBaseMapper().startOrStop(user); - }else if (user.getDisableStartTime().getTime() > (new Date()).getTime()){ + } else if (user.getDisableStartTime().getTime() > (new Date()).getTime()) { user.setId(userId); user.setStatus(PromptSuccess.UPCOMING_STOP_STATUS); return this.getBaseMapper().startOrStop(user); - }else { + } else { return false; } } @@ -136,7 +136,7 @@ public class EmployeeServiceImpl extends ServiceImpl users = this.getBaseMapper().listDisableTime(); - if (users.size() != 0){ + if (users.size() != 0) { for (UserEntity user : users) { if (user.getDisableStartTime().getTime() <= (new Date()).getTime() - && (new Date()).getTime() <= user.getDisableEndTime().getTime()){ + && (new Date()).getTime() <= user.getDisableEndTime().getTime()) { user.setStatus(PromptSuccess.STOP_STATUS); this.getBaseMapper().startOrStop(user); - }else if ((new Date()).getTime() < user.getDisableStartTime().getTime()){ + } else if ((new Date()).getTime() < user.getDisableStartTime().getTime()) { user.setStatus(PromptSuccess.UPCOMING_STOP_STATUS); this.getBaseMapper().startOrStop(user); - }else if ((new Date()).getTime() > user.getDisableEndTime().getTime()){ + } else if ((new Date()).getTime() > user.getDisableEndTime().getTime()) { user.setStatus(PromptSuccess.START_STATUS); user.setDisableStartTime(null); user.setDisableEndTime(null); @@ -206,9 +206,9 @@ public class EmployeeServiceImpl extends ServiceImpl list = permissionDao.listPermissionByRoleIds(roleIds); if (list.size() != 0) { // 去重 - Map map = new HashMap<>(); + Map map = new HashMap<>(); for (RolePermissionResponse rolePermissionResponse : list) { - map.put(rolePermissionResponse.getPermissionId(),rolePermissionResponse); + map.put(rolePermissionResponse.getPermissionId(), rolePermissionResponse); } list.clear(); for (Long key : map.keySet()) { @@ -233,15 +233,15 @@ public class EmployeeServiceImpl extends ServiceImpl list = permissionDao.listPermissionByRoleIds(ids); if (list.size() != 0) { - // 去重 - Map map = new HashMap<>(); - for (RolePermissionResponse rolePermissionResponse : list) { - map.put(rolePermissionResponse.getPermissionId(),rolePermissionResponse); - } - list.clear(); - for (Long key : map.keySet()) { - list.add(map.get(key)); - } + // 去重 + Map map = new HashMap<>(); + for (RolePermissionResponse rolePermissionResponse : list) { + map.put(rolePermissionResponse.getPermissionId(), rolePermissionResponse); + } + list.clear(); + for (Long key : map.keySet()) { + list.add(map.get(key)); + } return this.getRolePermissionTreeList(list, 0L); } else { return null; @@ -267,43 +267,43 @@ public class EmployeeServiceImpl extends ServiceImpl 0){ + if (numberCount > 0) { ExceptionCast.cast(HrmsCode.EMPLOYEE_JOB_NUMBER_EXIST); } } // 账号判重 - if (employeeRepetition != null && !Objects.equals(employeeInfoVO.getAccount(),employeeRepetition.getAccount())){ + if (employeeRepetition != null && !Objects.equals(employeeInfoVO.getAccount(), employeeRepetition.getAccount())) { Integer accountCount = this.getBaseMapper().userAccountCount(employeeInfoVO.getAccount()); - if (accountCount > 0){ + if (accountCount > 0) { ExceptionCast.cast(HrmsCode.EMPLOYEE_USER_ACCOUNT_EXIST); } } // 姓名判重,如果重复,自动在后面加字母"A、B、C、D、E" - if (employeeRepetition != null && !Objects.equals(employeeInfoVO.getName(),employeeRepetition.getName())){ + if (employeeRepetition != null && !Objects.equals(employeeInfoVO.getName(), employeeRepetition.getName())) { String name = employeeInfoVO.getName(); - for (int i = 0;i < PromptSuccess.LETTERS.length;i++){ + for (int i = 0; i < PromptSuccess.LETTERS.length; i++) { Integer nameCount = this.getBaseMapper().employeeNameCount(name); - if (nameCount > 0){ + if (nameCount > 0) { name = employeeInfoVO.getName() + PromptSuccess.LETTERS[i]; - }else { + } else { employeeInfoVO.setName(name); break; } - if (i == PromptSuccess.LETTERS.length - 1){ + if (i == PromptSuccess.LETTERS.length - 1) { ExceptionCast.cast(HrmsCode.EMPLOYEE_REPETITION_EXCEED); } } @@ -342,28 +342,28 @@ public class EmployeeServiceImpl extends ServiceImpl 0){ + if (numberCount > 0) { ExceptionCast.cast(HrmsCode.EMPLOYEE_JOB_NUMBER_EXIST); } Integer accountCount = this.getBaseMapper().userAccountCount(employeeInfoVO.getAccount()); - if (accountCount > 0){ + if (accountCount > 0) { ExceptionCast.cast(HrmsCode.EMPLOYEE_USER_ACCOUNT_EXIST); } String name = employeeInfoVO.getName(); - for (int i = 0;i < PromptSuccess.LETTERS.length;i++){ + for (int i = 0; i < PromptSuccess.LETTERS.length; i++) { Integer nameCount = this.getBaseMapper().employeeNameCount(name); - if (nameCount > 0){ + if (nameCount > 0) { name = employeeInfoVO.getName() + PromptSuccess.LETTERS[i]; - }else { + } else { employeeInfoVO.setName(name); break; } - if (i == PromptSuccess.LETTERS.length - 1){ + if (i == PromptSuccess.LETTERS.length - 1) { ExceptionCast.cast(HrmsCode.EMPLOYEE_REPETITION_EXCEED); } } @@ -430,7 +430,7 @@ public class EmployeeServiceImpl extends ServiceImpl 0){ + if (jobNumberCount > 0) { ExceptionCast.cast(HrmsCode.EMPLOYEE_JOB_NUMBER_EXIST); } Integer accountCount = this.getBaseMapper().userAccountCount(employeeExcelImport.getAccount()); - if (accountCount > 0){ + if (accountCount > 0) { ExceptionCast.cast(HrmsCode.EMPLOYEE_USER_ACCOUNT_EXIST); } String name = employeeExcelImport.getName(); - for (int i = 0;i < PromptSuccess.LETTERS.length;i++){ + for (int i = 0; i < PromptSuccess.LETTERS.length; i++) { Integer nameCount = this.getBaseMapper().employeeNameCount(name); - if (nameCount > 0){ + if (nameCount > 0) { name = employeeExcelImport.getName() + PromptSuccess.LETTERS[i]; - }else { + } else { employeeExcelImport.setName(name); break; } - if (i == PromptSuccess.LETTERS.length - 1){ + if (i == PromptSuccess.LETTERS.length - 1) { ExceptionCast.cast(HrmsCode.EMPLOYEE_REPETITION_EXCEED); } } @@ -486,7 +486,7 @@ public class EmployeeServiceImpl extends ServiceImpl getEmployeeAndDeptById(List ids) { + return this.getBaseMapper().getEmployeeAndDeptById(ids); } /** * 根据userId查询员工的头像 + * * @return */ @Override @@ -599,11 +601,10 @@ public class EmployeeServiceImpl extends ServiceImpl list) { return this.getBaseMapper().insertUsrRole(list); @@ -615,7 +616,7 @@ public class EmployeeServiceImpl extends ServiceImpl 0){ + if (i > 0) { return true; }