From 4242aade431ed6c3eb9256d7fc63b41ef304aa8d Mon Sep 17 00:00:00 2001 From: river <1376754470@qq.com> Date: Tue, 15 Sep 2020 21:09:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E8=B5=84=E6=BA=90=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E6=96=B0=E5=A2=9E=E5=92=8C=E4=B8=AA=E4=BA=BA=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../financial/crms/CustomerControllerApi.java | 21 +++ .../financial/hrms/DeptControllerApi.java | 6 + .../financial/hrms/EmployeeControllerApi.java | 4 +- .../crms/controller/CustomerController.java | 45 ++++++ .../crms/dao/CompanyCustomerDao.java | 2 + .../financial/crms/dao/CustomerDao.java | 4 + .../crms/dao/PersonalCustomerDao.java | 4 + .../crms/feign/HrmsFeignService.java | 1 + .../crms/service/CustomerService.java | 8 + .../service/impl/CustomerServiceImpl.java | 151 ++++++++++++------ .../mapper/crms/CompanyCustomerDao.xml | 7 + .../resources/mapper/crms/CustomerDao.xml | 14 ++ .../mapper/crms/PersonalCustomerDao.xml | 21 +++ .../hrms/controller/DeptController.java | 10 ++ .../daqing/financial/hrms/dao/DeptDao.java | 5 + .../financial/hrms/dao/EmployeeDao.java | 3 + .../financial/hrms/service/DeptService.java | 3 + .../hrms/service/impl/DeptServiceImpl.java | 34 +++- .../main/resources/mapper/hrms/DeptDao.xml | 6 + .../resources/mapper/hrms/EmployeeDao.xml | 11 ++ .../domain/crms/ext/CustomerCompanyTO.java | 26 +++ ...rVOCompany.java => CustomerCompanyVO.java} | 4 +- .../domain/crms/ext/CustomerPersonalTO.java | 27 ++++ ...OPersonal.java => CustomerPersonalVO.java} | 4 +- .../framework/domain/hrms/DepartmentVO.java | 55 +++++++ .../framework/domain/hrms/ext/EmployeeVO.java | 25 +++ 26 files changed, 445 insertions(+), 56 deletions(-) create mode 100644 dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerCompanyTO.java rename dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/{CustomerVOCompany.java => CustomerCompanyVO.java} (92%) create mode 100644 dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerPersonalTO.java rename dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/{CustomerVOPersonal.java => CustomerPersonalVO.java} (94%) create mode 100644 dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/DepartmentVO.java create mode 100644 dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeVO.java diff --git a/dq-financial-api/src/main/java/com/daqing/financial/crms/CustomerControllerApi.java b/dq-financial-api/src/main/java/com/daqing/financial/crms/CustomerControllerApi.java index 8db793db..6edc92d8 100644 --- a/dq-financial-api/src/main/java/com/daqing/financial/crms/CustomerControllerApi.java +++ b/dq-financial-api/src/main/java/com/daqing/financial/crms/CustomerControllerApi.java @@ -1,5 +1,9 @@ package com.daqing.financial.crms; +import com.daqing.framework.domain.crms.CustomerEntity; +import com.daqing.framework.domain.crms.PersonalCustomerEntity; +import com.daqing.framework.domain.crms.ext.CustomerCompanyTO; +import com.daqing.framework.domain.crms.ext.CustomerPersonalTO; import com.daqing.framework.domain.crms.request.CustomerRequest; import com.daqing.framework.model.response.ResponseResult; import io.swagger.annotations.Api; @@ -37,4 +41,21 @@ public interface CustomerControllerApi { @ApiOperation(value = "删除所选客户", notes = "删除所选客户") ResponseResult deleteCustomer(Long[] ids); + /** + * 插入个人类型客户信息 + */ + @ApiOperation(value = "插入个人类型客户信息", notes = "插入个人类型客户信息") + ResponseResult savePersonal(CustomerPersonalTO customerPersonalTO); + + /** + * 插入企业类型客户信息 + */ + @ApiOperation(value = "插入企业类型客户信息", notes = "插入企业类型客户信息") + ResponseResult saveCompany(CustomerCompanyTO customerCompanyTO); + + /** + * 更新个人类型客户信息 + */ + @ApiOperation(value = "更新个人类型客户信息", notes = "更新个人类型客户信息") + ResponseResult updatePersonal(CustomerPersonalTO customerPersonalTO); } diff --git a/dq-financial-api/src/main/java/com/daqing/financial/hrms/DeptControllerApi.java b/dq-financial-api/src/main/java/com/daqing/financial/hrms/DeptControllerApi.java index 4990e3cf..90225fab 100644 --- a/dq-financial-api/src/main/java/com/daqing/financial/hrms/DeptControllerApi.java +++ b/dq-financial-api/src/main/java/com/daqing/financial/hrms/DeptControllerApi.java @@ -50,4 +50,10 @@ public interface DeptControllerApi { */ @ApiOperation(value = "根据id数组批量删除部门信息", notes = "根据id数组批量删除部门信息") ResponseResult delete(Long[] ids); + + /** + * 查询所有部门及部门下的员工信息 + */ + @ApiOperation(value = "查询所有部门及部门下的员工信息", notes = "查询所有部门及部门下的员工信息") + ResponseResult trees(); } diff --git a/dq-financial-api/src/main/java/com/daqing/financial/hrms/EmployeeControllerApi.java b/dq-financial-api/src/main/java/com/daqing/financial/hrms/EmployeeControllerApi.java index b15b0284..997cf8ee 100644 --- a/dq-financial-api/src/main/java/com/daqing/financial/hrms/EmployeeControllerApi.java +++ b/dq-financial-api/src/main/java/com/daqing/financial/hrms/EmployeeControllerApi.java @@ -12,12 +12,10 @@ import io.swagger.annotations.ApiOperation; @Api(value = "员工管理相关操作", tags = "提供员工信息增删改查等相关方法") public interface EmployeeControllerApi { - /** - * 根据id查询员工的基本信息和部门信息 - */ @ApiOperation(value = "根据id查询员工的基本信息和部门信息", notes = "根据id查询员工的基本信息和部门信息") ResponseResult getEmployeeAndDeptById(Long[] ids); + @ApiOperation(value = "根据id查询员工姓名", notes = "根据id查询员工姓名") ResponseResult getEmployeeById(Long id); /** diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CustomerController.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CustomerController.java index 8dd4a171..da6cceb4 100644 --- a/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CustomerController.java +++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CustomerController.java @@ -2,6 +2,8 @@ package com.daqing.financial.crms.controller; import com.daqing.financial.crms.CustomerControllerApi; import com.daqing.financial.crms.service.CustomerService; +import com.daqing.framework.domain.crms.ext.CustomerCompanyTO; +import com.daqing.framework.domain.crms.ext.CustomerPersonalTO; import com.daqing.framework.domain.crms.request.CustomerRequest; import com.daqing.framework.model.response.ResponseResult; import com.daqing.framework.utils.PageUtils; @@ -25,6 +27,19 @@ public class CustomerController implements CustomerControllerApi { @Autowired private CustomerService customerService; + /*@Autowired + private HrmsFeignService hrmsFeignService;*/ + + /** + * 列表 + */ + /*@GetMapping("/hrms_list")*/ + //@RequiresPermissions("hrms:dept:list") + /* public ResponseResult hrmsList() { + Map params = new HashMap<>(); + return hrmsFeignService.list(params); + }*/ + /** * 查询客户列表(所有)、根据创建时间筛选、根据客户类型筛选、根据客户编号或者名称搜索 */ @@ -52,4 +67,34 @@ public class CustomerController implements CustomerControllerApi { return new ResponseResult>().SUCCESS(customerService.updateCustomerById(ids)); } + + /** + * 保存个人类型客户信息 + */ + @PostMapping("/savePersonal") + @Override + public ResponseResult savePersonal(@RequestBody CustomerPersonalTO customerPersonalTO) { + boolean result = customerService.saveCustomerPersonal(customerPersonalTO.getCustomerEntity(), customerPersonalTO.getPersonalCustomerEntity()); + return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL(); + } + + /** + * 保存企业类型客户信息 + */ + @PostMapping("/saveCompany") + @Override + public ResponseResult saveCompany(@RequestBody CustomerCompanyTO customerCompanyTO) { + boolean result = customerService.saveCustomerCompany(customerCompanyTO.getCustomerEntity(), customerCompanyTO.getCompanyCustomerEntity()); + return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL(); + } + + /** + * 更新个人类型客户信息 + */ + @PostMapping("/updatePersonal") + @Override + public ResponseResult updatePersonal(@RequestBody CustomerPersonalTO customerPersonalTO) { + boolean result = customerService.updateCustomerPersonal(customerPersonalTO.getCustomerEntity(), customerPersonalTO.getPersonalCustomerEntity()); + return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL(); + } } diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/CompanyCustomerDao.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/CompanyCustomerDao.java index 850175a1..12c13935 100644 --- a/dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/CompanyCustomerDao.java +++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/CompanyCustomerDao.java @@ -15,4 +15,6 @@ import org.apache.ibatis.annotations.Mapper; public interface CompanyCustomerDao extends BaseMapper { CompanyCustomerEntity queryCompanyCustomerById(Long id); + + boolean saveCompanyCustomer(CompanyCustomerEntity companyCustomerEntity); } diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/CustomerDao.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/CustomerDao.java index 8c3416f3..a3fe1256 100644 --- a/dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/CustomerDao.java +++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/CustomerDao.java @@ -28,4 +28,8 @@ public interface CustomerDao extends BaseMapper { void updateCustomerById(@Param("ids") List ids); List queryCustomerNameById(@Param("ids") List ids); + + boolean saveCustomer(CustomerEntity customerEntity); + + boolean updateCustomer(CustomerEntity customerEntity); } diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/PersonalCustomerDao.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/PersonalCustomerDao.java index 70d26017..c0254351 100644 --- a/dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/PersonalCustomerDao.java +++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/PersonalCustomerDao.java @@ -15,4 +15,8 @@ import org.apache.ibatis.annotations.Mapper; public interface PersonalCustomerDao extends BaseMapper { PersonalCustomerEntity queryPersonalCustomerById(Long id); + + boolean savePersonalCustomer(PersonalCustomerEntity personalCustomerEntity); + + boolean updatePersonalCustomer(PersonalCustomerEntity personalCustomerEntity); } diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/feign/HrmsFeignService.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/feign/HrmsFeignService.java index 5454b05d..4dd7c1ea 100644 --- a/dq-financial-crms/src/main/java/com/daqing/financial/crms/feign/HrmsFeignService.java +++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/feign/HrmsFeignService.java @@ -24,4 +24,5 @@ public interface HrmsFeignService { @GetMapping("/hrms/employee/getEmployeeById") ResponseResult getEmployeeById(@RequestParam("id") Long id); + } diff --git a/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/CustomerService.java b/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/CustomerService.java index 86c06314..5c1596e8 100644 --- a/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/CustomerService.java +++ b/dq-financial-crms/src/main/java/com/daqing/financial/crms/service/CustomerService.java @@ -1,6 +1,8 @@ package com.daqing.financial.crms.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.daqing.framework.domain.crms.CompanyCustomerEntity; +import com.daqing.framework.domain.crms.PersonalCustomerEntity; import com.daqing.framework.domain.crms.request.CustomerRequest; import com.daqing.framework.model.response.ResponseResult; import com.daqing.framework.utils.PageUtils; @@ -23,5 +25,11 @@ public interface CustomerService extends IService { ResponseResult queryCustomerById(Long id); List updateCustomerById(Long[] ids); + + boolean saveCustomerPersonal(CustomerEntity customerEntity, PersonalCustomerEntity personalCustomerEntity); + + boolean saveCustomerCompany(CustomerEntity customerEntity, CompanyCustomerEntity companyCustomerEntity); + + boolean updateCustomerPersonal(CustomerEntity customerEntity, PersonalCustomerEntity personalCustomerEntity); } 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 a716ba9f..4cd02430 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 @@ -14,18 +14,18 @@ import com.daqing.framework.domain.crms.CustomerEntity; import com.daqing.framework.domain.crms.PersonalCustomerEntity; import com.daqing.framework.domain.crms.ext.CrmsConstant; import com.daqing.framework.domain.crms.ext.CustomerTO; -import com.daqing.framework.domain.crms.ext.CustomerVOCompany; -import com.daqing.framework.domain.crms.ext.CustomerVOPersonal; +import com.daqing.framework.domain.crms.ext.CustomerCompanyVO; +import com.daqing.framework.domain.crms.ext.CustomerPersonalVO; import com.daqing.framework.domain.crms.request.CustomerRequest; -import com.daqing.framework.domain.hrms.EmployeeEntity; import com.daqing.framework.domain.hrms.ext.EmployeeTO; import com.daqing.framework.model.response.ResponseResult; import com.daqing.framework.utils.PageUtils; +import com.daqing.framework.utils.SnowflakeIdUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; -import javax.annotation.Resource; import java.text.SimpleDateFormat; import java.util.*; @@ -107,13 +107,13 @@ public class CustomerServiceImpl extends ServiceImpl().SUCCESS(customerVOPersonal); + CustomerPersonalVO customerPersonalVO = this.setPersonal(customer, name, personalCustomerEntity); + return new ResponseResult().SUCCESS(customerPersonalVO); } else { CompanyCustomerEntity companyCustomerEntity = companyCustomerDao.queryCompanyCustomerById(id); //封装企业类型客户信息 - CustomerVOCompany customerVOCompany = this.setCompany(customer, name, companyCustomerEntity); - return new ResponseResult().SUCCESS(customerVOCompany); + CustomerCompanyVO customerCompanyVO = this.setCompany(customer, name, companyCustomerEntity); + return new ResponseResult().SUCCESS(customerCompanyVO); } } @@ -136,6 +136,57 @@ public class CustomerServiceImpl extends ServiceImpl + + + INSERT INTO crms_company_customer + (id,registered_capital,industry,years,region,shareholder,affiliated_company,emp_num,linkman,business_source,customer_id) + values (#{id},#{registeredCapital},#{industry},#{years},#{region},#{shareholder},#{affiliatedCompany},#{empNum},#{linkman}, + #{businessSource},#{customerId}); + \ No newline at end of file diff --git a/dq-financial-crms/src/main/resources/mapper/crms/CustomerDao.xml b/dq-financial-crms/src/main/resources/mapper/crms/CustomerDao.xml index f0c501b6..af1020c3 100644 --- a/dq-financial-crms/src/main/resources/mapper/crms/CustomerDao.xml +++ b/dq-financial-crms/src/main/resources/mapper/crms/CustomerDao.xml @@ -69,4 +69,18 @@ + + + INSERT INTO crms_customer + (id,code,type,manager,name,addr,phone,del_or_not,status,create_time,motify_time) + VALUES (#{id},#{code},#{type},#{manager},#{name},#{addr},#{phone},0,0,#{createTime},#{motifyTime}) + + + + + UPDATE crms_customer + SET manager=#{manager},name=#{name},addr=#{addr},phone=#{phone},motify_time=#{motifyTime} + WHERE id = #{id} + + \ No newline at end of file diff --git a/dq-financial-crms/src/main/resources/mapper/crms/PersonalCustomerDao.xml b/dq-financial-crms/src/main/resources/mapper/crms/PersonalCustomerDao.xml index 1879e96e..01258b7e 100644 --- a/dq-financial-crms/src/main/resources/mapper/crms/PersonalCustomerDao.xml +++ b/dq-financial-crms/src/main/resources/mapper/crms/PersonalCustomerDao.xml @@ -33,4 +33,25 @@ WHERE customer_id = #{id} + + + INSERT INTO crms_personal_customer + (id,customer_id,id_card,age,gender,marital_status,education,employer,position,working_years,social_security_num,living_situation + ,residence_addr,business_source,emergency_linkman,emergency_linkman_relationship,emergency_linkman_phone) + VALUES (#{id},#{customerId},#{idCard},#{age},#{gender},#{maritalStatus},#{education},#{employer},#{position},#{workingYears}, + #{socialSecurityNum},#{livingSituation},#{residenceAddr},#{businessSource},#{emergencyLinkman},#{emergencyLinkmanRelationship}, + #{emergencyLinkmanPhone}); + + + + + UPDATE crms_personal_customer + SET id_card=#{idCard},age=#{age},gender=#{gender},marital_status=#{maritalStatus},education=#{education}, + employer=#{employer},position=#{position},working_years=#{workingYears},social_security_num=#{socialSecurityNum}, + living_situation=#{livingSituation},residence_addr=#{residenceAddr},business_source=#{businessSource}, + emergency_linkman=#{emergencyLinkman},emergency_linkman_relationship=#{emergencyLinkmanRelationship}, + emergency_linkman_phone=#{emergencyLinkmanPhone} + WHERE customer_id = #{customer_id} + + \ No newline at end of file diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/DeptController.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/DeptController.java index a58f12e2..0a5c2482 100644 --- a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/DeptController.java +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/DeptController.java @@ -2,6 +2,7 @@ package com.daqing.financial.hrms.controller; import com.daqing.financial.hrms.DeptControllerApi; import com.daqing.financial.hrms.service.DeptService; +import com.daqing.framework.domain.hrms.DepartmentVO; import com.daqing.framework.domain.hrms.DeptEntity; import com.daqing.framework.domain.hrms.request.DeptAddRequest; import com.daqing.framework.model.response.ResponseResult; @@ -95,4 +96,13 @@ public class DeptController implements DeptControllerApi { boolean result = deptService.deleteByIds(ids); return result ? ResponseResult.SUCCESS() : ResponseResult.FAIL(); } + + /** + *所有部门及员工 + */ + @Override + @GetMapping("/trees") + public ResponseResult trees() { + return new ResponseResult>().SUCCESS(deptService.listDepartmentAndEmployeeTree()); + } } diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/DeptDao.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/DeptDao.java index b93ff55e..95e8328b 100644 --- a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/DeptDao.java +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/DeptDao.java @@ -1,6 +1,7 @@ package com.daqing.financial.hrms.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.daqing.framework.domain.hrms.DepartmentVO; import com.daqing.framework.domain.hrms.DeptEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -20,5 +21,9 @@ public interface DeptDao extends BaseMapper { Integer getEmpDeptCount(@Param("deptId") Long deptId); +<<<<<<< Updated upstream List getByPositionId(@Param("positionId") Long positionId); +======= + List listDepartment(); +>>>>>>> Stashed changes } diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/EmployeeDao.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/EmployeeDao.java index 329918f7..97455798 100644 --- a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/EmployeeDao.java +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/EmployeeDao.java @@ -3,6 +3,7 @@ package com.daqing.financial.hrms.dao; import com.daqing.framework.domain.hrms.EmployeeEntity; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.daqing.framework.domain.hrms.ext.EmployeeTO; +import com.daqing.framework.domain.hrms.ext.EmployeeVO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -21,4 +22,6 @@ public interface EmployeeDao extends BaseMapper { List getEmployeeAndDeptById(@Param("ids") List ids); EmployeeEntity getEmployeeById(Long id); + + List listEmployeeByDeptId(Long id); } diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/DeptService.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/DeptService.java index 0ae38e3d..e889d69a 100644 --- a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/DeptService.java +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/DeptService.java @@ -1,6 +1,7 @@ package com.daqing.financial.hrms.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.daqing.framework.domain.hrms.DepartmentVO; import com.daqing.framework.domain.hrms.DeptEntity; import com.daqing.framework.domain.hrms.request.DeptAddRequest; @@ -22,5 +23,7 @@ public interface DeptService extends IService { boolean updateDept(DeptEntity dept); boolean deleteByIds(Long[] ids); + + List listDepartmentAndEmployeeTree(); } diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/DeptServiceImpl.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/DeptServiceImpl.java index b93d3230..5779712a 100644 --- a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/DeptServiceImpl.java +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/DeptServiceImpl.java @@ -3,7 +3,9 @@ package com.daqing.financial.hrms.service.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.daqing.financial.hrms.dao.DeptDao; +import com.daqing.financial.hrms.dao.EmployeeDao; import com.daqing.financial.hrms.service.DeptService; +import com.daqing.framework.domain.hrms.DepartmentVO; import com.daqing.framework.domain.hrms.DeptEntity; import com.daqing.framework.domain.hrms.request.DeptAddRequest; import com.daqing.framework.domain.hrms.response.HrmsCode; @@ -11,6 +13,7 @@ import com.daqing.framework.exception.ExceptionCast; import com.daqing.framework.utils.SnowflakeIdUtils; import org.apache.commons.lang.StringUtils; import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.Arrays; @@ -23,6 +26,12 @@ import java.util.stream.Collectors; @Service("deptService") public class DeptServiceImpl extends ServiceImpl implements DeptService { + @Autowired + private DeptDao deptDao; + + @Autowired + private EmployeeDao employeeDao; + /** * 保存一条部门信息 * @@ -100,7 +109,10 @@ public class DeptServiceImpl extends ServiceImpl implements private List getDeptTreeList(List list, Long parentId) { return list.stream() .filter(dept -> parentId.equals(dept.getParentId())) - .peek(dept -> dept.setChildren(getDeptTreeList(list, dept.getId()))) + .peek(dept -> { + dept.setChildren(getDeptTreeList(list, dept.getId())); + + }) .sorted(Comparator.comparingInt(menu -> (menu.getSort() == null ? 0 : menu.getSort()))) .collect(Collectors.toList()); } @@ -137,4 +149,24 @@ public class DeptServiceImpl extends ServiceImpl implements }); return this.removeByIds(list); } + + /** + * 获取所有的部门及部门下的员工信息 + * @return + */ + @Override + public List listDepartmentAndEmployeeTree() { + return this.getListDepartmentAndEmployeeTree(deptDao.listDepartment(), 0L); + } + + private List getListDepartmentAndEmployeeTree(List list, Long parentId){ + return list.stream() + .filter(dept -> parentId.equals(dept.getParentId())) // 过滤出部门id为所选id的部门信息(也为递归的结果条件,找不到所对应的部门id) + .peek(dept -> { + dept.setChildren(getListDepartmentAndEmployeeTree(list, dept.getId())); // 设置该部门的子部门:递归调用 + dept.setEmployee(employeeDao.listEmployeeByDeptId(dept.getId())); // 设置该部门下面的所有员工 + }) + .sorted(Comparator.comparingInt(menu -> (menu.getSort() == null ? 0 : menu.getSort()))) // 根据所选排序信息进行排序 + .collect(Collectors.toList()); + } } \ No newline at end of file diff --git a/dq-financial-hrms/src/main/resources/mapper/hrms/DeptDao.xml b/dq-financial-hrms/src/main/resources/mapper/hrms/DeptDao.xml index 0bd60024..294e0608 100644 --- a/dq-financial-hrms/src/main/resources/mapper/hrms/DeptDao.xml +++ b/dq-financial-hrms/src/main/resources/mapper/hrms/DeptDao.xml @@ -13,6 +13,7 @@ + @@ -30,4 +31,9 @@ dp.position_id = #{positionId} + + \ No newline at end of file diff --git a/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml b/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml index 25001055..ca722c24 100644 --- a/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml +++ b/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml @@ -46,4 +46,15 @@ + + + \ No newline at end of file diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerCompanyTO.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerCompanyTO.java new file mode 100644 index 00000000..febc0b8b --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerCompanyTO.java @@ -0,0 +1,26 @@ +package com.daqing.framework.domain.crms.ext; + +import com.daqing.framework.domain.crms.CompanyCustomerEntity; +import com.daqing.framework.domain.crms.CustomerEntity; +import lombok.Data; +import lombok.ToString; + +import java.io.Serializable; + +/** + * @auther River + * @date 2020/9/15 20:20 + */ +@Data +@ToString +public class CustomerCompanyTO implements Serializable { + + /** + * 客户基本信息 + */ + private CustomerEntity customerEntity; + /** + * 企业类型信息 + */ + private CompanyCustomerEntity companyCustomerEntity; +} diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerVOCompany.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerCompanyVO.java similarity index 92% rename from dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerVOCompany.java rename to dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerCompanyVO.java index 9b0692bd..d2b6b281 100644 --- a/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerVOCompany.java +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerCompanyVO.java @@ -6,12 +6,14 @@ import lombok.ToString; import java.io.Serializable; /** + * 企业类型客户返回信息包装类 + * * @auther River * @date 2020/9/14 10:48 */ @Data @ToString -public class CustomerVOCompany implements Serializable { +public class CustomerCompanyVO implements Serializable { /** * 客户编号 diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerPersonalTO.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerPersonalTO.java new file mode 100644 index 00000000..f0a1b18b --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerPersonalTO.java @@ -0,0 +1,27 @@ +package com.daqing.framework.domain.crms.ext; + +import com.daqing.framework.domain.crms.CustomerEntity; +import com.daqing.framework.domain.crms.PersonalCustomerEntity; +import lombok.Data; +import lombok.ToString; + +import java.io.Serializable; + +/** + * @auther River + * @date 2020/9/15 19:57 + */ +@Data +@ToString +public class CustomerPersonalTO implements Serializable { + + /** + * 客户基本信息 + */ + private CustomerEntity customerEntity; + + /** + * 客户个人信息 + */ + private PersonalCustomerEntity personalCustomerEntity; +} diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerVOPersonal.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerPersonalVO.java similarity index 94% rename from dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerVOPersonal.java rename to dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerPersonalVO.java index 3162f4eb..6ab5b6fe 100644 --- a/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerVOPersonal.java +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerPersonalVO.java @@ -6,12 +6,14 @@ import lombok.ToString; import java.io.Serializable; /** + * 个人类型返回信息包装类 + * * @auther River * @date 2020/9/11 17:28 */ @Data @ToString -public class CustomerVOPersonal implements Serializable { +public class CustomerPersonalVO implements Serializable { /** * 客户编号 diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/DepartmentVO.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/DepartmentVO.java new file mode 100644 index 00000000..c4eb1399 --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/DepartmentVO.java @@ -0,0 +1,55 @@ +package com.daqing.framework.domain.hrms; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.daqing.framework.domain.hrms.ext.EmployeeVO; +import com.fasterxml.jackson.annotation.JsonInclude; +import lombok.Data; +import lombok.ToString; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +/** + * 封装所有部门及部门下所有员工的包装类 + * + * @auther River + * @date 2020/9/15 9:44 + */ +@Data +@ToString +public class DepartmentVO implements Serializable{ + + /** + * 主键 + */ + @TableId(value = "id", type = IdType.INPUT) + private Long id; + /** + * 部门名称 + */ + private String name; + /** + * 上级部门id + */ + private Long parentId; + /** + * 排序 + */ + private Integer sort; + /** + * 子部门 + */ + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @TableField(exist = false) + private List children; + + /** + * 该级部门下面的员工 + */ + @JsonInclude(JsonInclude.Include.NON_EMPTY) + @TableField(exist = false) + private List employee; +} diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeVO.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeVO.java new file mode 100644 index 00000000..82ccda76 --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeVO.java @@ -0,0 +1,25 @@ +package com.daqing.framework.domain.hrms.ext; + +import lombok.Data; +import lombok.ToString; + +import java.io.Serializable; + +/** + * @auther River + * @date 2020/9/15 16:46 + */ +@Data +@ToString +public class EmployeeVO implements Serializable{ + + /** + * id + */ + private Long id; + + /** + * 员工姓名 + */ + private String name; +}