From 19ab4f5aa6e9bac7eb4733119acedd4c21b374ba Mon Sep 17 00:00:00 2001 From: river <1376754470@qq.com> Date: Thu, 10 Sep 2020 15:07:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A2=E6=88=B7=E8=B5=84=E6=BA=90=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E5=90=8E=E5=8F=B0=E7=AE=A1=E7=90=86=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../financial/crms/CustomerControllerApi.java | 4 +- .../financial/hrms/DeptControllerApi.java | 2 + .../financial/hrms/EmployeeControllerApi.java | 21 ++++ .../crms/controller/CustomerController.java | 18 --- .../financial/crms/dao/CustomerDao.java | 9 +- .../crms/feign/HrmsFeignService.java | 8 +- .../crms/service/CustomerService.java | 3 +- .../service/impl/CustomerServiceImpl.java | 113 +++++++++++++++--- .../resources/mapper/crms/CustomerDao.xml | 20 ++++ .../crms/DqFinancialCrmsApplicationTests.java | 34 +++++- .../hrms/controller/EmployeeController.java | 23 ++-- .../financial/hrms/dao/EmployeeDao.java | 9 +- .../hrms/feign/CrmsFeignService.java | 1 + .../hrms/service/EmployeeService.java | 4 +- .../service/impl/EmployeeServiceImpl.java | 21 ++-- .../resources/mapper/hrms/EmployeeDao.xml | 21 +++- .../hrms/DqFinancialHrmsApplicationTests.java | 26 +++- .../framework/domain/crms/ext/CustomerTO.java | 52 ++++++++ .../domain/crms/request/CustomerRequest.java | 7 +- .../framework/domain/hrms/ext/EmployeeTO.java | 35 ++++++ 20 files changed, 357 insertions(+), 74 deletions(-) create mode 100644 dq-financial-api/src/main/java/com/daqing/financial/hrms/EmployeeControllerApi.java create mode 100644 dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerTO.java create mode 100644 dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeTO.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 997e3d9b..226cedd3 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 @@ -18,7 +18,7 @@ public interface CustomerControllerApi { /** * 列表展示 */ - @ApiOperation(value = "客户信息列表展示", notes = "客户信息列表展示") - ResponseResult list(Map params); + /*@ApiOperation(value = "客户信息列表展示", notes = "客户信息列表展示") + ResponseResult list(Map params);*/ } 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 06518136..764b3d7d 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 @@ -5,6 +5,8 @@ import com.daqing.framework.model.response.ResponseResult; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import java.util.List; + /** * @Author: gongsj. * @Description: 部门管理controllerApi定义 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 new file mode 100644 index 00000000..9308a79f --- /dev/null +++ b/dq-financial-api/src/main/java/com/daqing/financial/hrms/EmployeeControllerApi.java @@ -0,0 +1,21 @@ +package com.daqing.financial.hrms; + +import com.daqing.framework.model.response.ResponseResult; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; + +import java.util.List; + +/** + * @auther River + * @date 2020/9/9 17:41 + */ +@Api(value = "员工管理相关操作", tags = "提供员工信息增删改查等相关方法") +public interface EmployeeControllerApi { + + /** + * 根据id查询员工的基本信息和部门信息 + */ + @ApiOperation(value = "根据id查询员工的基本信息和部门信息", notes = "根据id查询员工的基本信息和部门信息") + ResponseResult getEmployeeAndDeptById(List ids); +} 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 0aaf8d6a..9ecfef1c 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 @@ -29,23 +29,6 @@ public class CustomerController implements CustomerControllerApi { @Autowired HrmsFeignService hrmsFeignService; - /** - * 列表 - */ - @Override - @GetMapping("/list") - //@RequiresPermissions("crms:customer:list") - public ResponseResult list(@RequestParam Map params) { - PageUtils page = customerService.queryPage(params); - List list = new ArrayList<>(); - list.add("张三"); - list.add("李四"); - list.add("王五"); - list.add("赵六"); - list.add("孙七"); - return new ResponseResult(true, 200, list, "success"); - } - /** * 列表 */ @@ -99,7 +82,6 @@ public class CustomerController implements CustomerControllerApi { customerService.removeByIds(Arrays.asList(ids)); return ResponseResult.SUCCESS(); - } } 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 5bfa77d7..0a449c43 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 @@ -1,17 +1,22 @@ package com.daqing.financial.crms.dao; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.daqing.framework.domain.crms.CustomerEntity; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.daqing.framework.domain.crms.request.CustomerRequest; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; /** * 记录客户基本信息 - * + * * @author gongsj * @email gongsj@gmail.com * @date 2020-09-08 09:57:32 */ @Mapper public interface CustomerDao extends BaseMapper { - + + IPage queryList(Page page, @Param("cr") CustomerRequest customerRequest); } 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 afb44b8f..abd349ab 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 @@ -2,9 +2,13 @@ package com.daqing.financial.crms.feign; import com.daqing.framework.model.response.ResponseResult; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.ResponseBody; +import java.util.List; import java.util.Map; /** @@ -14,6 +18,8 @@ import java.util.Map; public interface HrmsFeignService { @GetMapping("/hrms/dept/list") - public ResponseResult list(@RequestParam Map params); + ResponseResult list(@RequestParam Map params); + @GetMapping("/hrms/employee/getEmployeeAndDeptById/{ids}") + ResponseResult getEmployeeAndDeptById(@PathVariable("ids") List ids); } 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 06040f5d..0e0ee700 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 @@ -16,8 +16,7 @@ import java.util.Map; */ public interface CustomerService extends IService { - /*PageUtils queryPage(Map params);*/ - PageUtils queryList(Integer page, Integer size, CustomerRequest customerRequest); + } 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 f8012264..18777342 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 @@ -1,43 +1,124 @@ package com.daqing.financial.crms.service.impl; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.daqing.financial.crms.dao.CustomerDao; +import com.daqing.financial.crms.feign.HrmsFeignService; import com.daqing.financial.crms.service.CustomerService; import com.daqing.framework.domain.crms.CustomerEntity; +import com.daqing.framework.domain.crms.ext.CustomerTO; import com.daqing.framework.domain.crms.request.CustomerRequest; +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.Query; +import org.springframework.beans.BeanUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.Map; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; @Service("customerService") public class CustomerServiceImpl extends ServiceImpl implements CustomerService { - /*@Override - public PageUtils queryPage(Map params) { - IPage page = this.page( - new Query().getPage(params), - new QueryWrapper() - ); + @Autowired + private CustomerDao customerDao; + + @Autowired + private HrmsFeignService hrmsFeignService; + + + public void t() { + hrmsFeignService.list(new HashMap<>()); + } - return new PageUtils(page); - }*/ /** * 查询客户列表(所有)、根据创建时间筛选、根据客户类型筛选、根据客户编号或者名称搜索 - * @param page - * @param size - * @param customerRequest - * @return + * + * @param page 当前页 + * @param size 每页条数 + * @param customerRequest 请求参数 + * @return 所有客户以及信息集合 */ @Override public PageUtils queryList(Integer page, Integer size, CustomerRequest customerRequest) { - return null; + // 没有选择自定义时间且选择了固定的"3个月内、6个月内、9个月内...."时间 + if (customerRequest.getStartTime() == null && customerRequest.getEndTime() == null && customerRequest.getCreateTime() != null) { + if (customerRequest.getCreateTime() != 0) { + String pastTime = pastTime(customerRequest.getCreateTime()); + customerRequest.setStartTime(pastTime); + } + } + // 选择了自定义时间且选择了固定时间则固定时间无效 + if (customerRequest.getCreateTime() != null && (customerRequest.getStartTime() != null || customerRequest.getEndTime() != null)) { + customerRequest.setCreateTime(null); + } + Page pages = new Page<>(page, size); + IPage customerEntityIPage = customerDao.queryList(pages, customerRequest); + + // 获取所有的客户基本信息 + List customers = customerEntityIPage.getRecords(); + // 获取所有的客户经理id + List ids = customers.stream().map(CustomerEntity::getId).collect(Collectors.toList()); + + // 用于拼装客户信息和员工及部门信息的集合 + List customerTOS = new ArrayList<>(); + CustomerTO customerTO = new CustomerTO(); + //TODO 远程调用查询客户经理信息的接口 + ResponseResult responseResult = hrmsFeignService.getEmployeeAndDeptById(ids); + List employeeTO = (List) responseResult.getData(); + /*String data = (String) responseResult.getData(); + List employeeTO = JSON.parseArray(data, EmployeeTO.class);*/ + + // 将客户信息和客户经理及部门信息拼装起来 + for (CustomerEntity customer : customers) { + 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()); + 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()); + customerTOS.add(customerTO); + } + } + + // 属性拷贝,将泛型为CustomerEntity类型的IPage的属性拷贝给泛型为CustomerTO类型的IPage,才能赋值给PageUtils + IPage iPage = new Page<>(); + BeanUtils.copyProperties(customerEntityIPage, iPage); + iPage.setRecords(customerTOS); + + return new PageUtils(iPage); } + /** + * 得到过去number月内的时间 + * + * @param number + * @return 字符串类型 + */ + private String pastTime(Integer number) { + Date date = new Date(); + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.add(Calendar.MONTH, -number); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:ss:mm"); + return sdf.format(calendar.getTime()); + } } \ 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 e277e9ad..7f80a833 100644 --- a/dq-financial-crms/src/main/resources/mapper/crms/CustomerDao.xml +++ b/dq-financial-crms/src/main/resources/mapper/crms/CustomerDao.xml @@ -20,5 +20,25 @@ + + \ No newline at end of file diff --git a/dq-financial-crms/src/test/java/com/daqing/financial/crms/DqFinancialCrmsApplicationTests.java b/dq-financial-crms/src/test/java/com/daqing/financial/crms/DqFinancialCrmsApplicationTests.java index 11bb9c8f..a9775f0f 100644 --- a/dq-financial-crms/src/test/java/com/daqing/financial/crms/DqFinancialCrmsApplicationTests.java +++ b/dq-financial-crms/src/test/java/com/daqing/financial/crms/DqFinancialCrmsApplicationTests.java @@ -1,13 +1,43 @@ package com.daqing.financial.crms; +import com.daqing.financial.crms.service.impl.CustomerServiceImpl; +import com.daqing.framework.domain.crms.CustomerEntity; +import com.daqing.framework.domain.crms.ext.CustomerTO; +import com.daqing.framework.domain.crms.request.CustomerRequest; +import com.daqing.framework.utils.PageUtils; import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import java.util.List; @SpringBootTest -class DqFinancialCrmsApplicationTests { +@RunWith(SpringRunner.class) +public class DqFinancialCrmsApplicationTests { + + @Autowired + private CustomerServiceImpl customerServiceimpl; + + CustomerRequest customerRequest = new CustomerRequest(); @Test - void contextLoads() { + public void queryListTest(){ + customerRequest.setCodeOrName("20200909"); + /* customerRequest.setStartTime("2020-09-07"); + customerRequest.setEndTime("2020-09-10");*/ + customerRequest.setCustomerType(1); + customerRequest.setCreateTime(3); + PageUtils list = customerServiceimpl.queryList(1, 10, customerRequest); + List list1 = (List) list.getList(); + list1.forEach(customerEntity -> System.out.println(customerEntity)); } + @Test + public void t() { + customerServiceimpl.t(); + } + + } diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/EmployeeController.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/EmployeeController.java index 9c3dfe57..a06529aa 100644 --- a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/EmployeeController.java +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/EmployeeController.java @@ -1,13 +1,14 @@ package com.daqing.financial.hrms.controller; +import com.daqing.financial.hrms.EmployeeControllerApi; import com.daqing.financial.hrms.service.EmployeeService; import com.daqing.framework.domain.hrms.EmployeeEntity; import com.daqing.framework.model.response.ResponseResult; -import com.daqing.framework.utils.PageUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.Arrays; +import java.util.List; import java.util.Map; @@ -20,21 +21,16 @@ import java.util.Map; */ @RestController @RequestMapping("hrms/employee") -public class EmployeeController { +public class EmployeeController implements EmployeeControllerApi{ @Autowired private EmployeeService employeeService; - /** - * 列表 - */ @GetMapping("/list") - //@RequiresPermissions("hrms:employee:list") + //@RequiresPermissions("hrms:employee:info") public ResponseResult list(@RequestParam Map params) { - PageUtils page = employeeService.queryPage(params); return ResponseResult.SUCCESS(); } - /** * 信息 */ @@ -78,4 +74,15 @@ public class EmployeeController { return ResponseResult.SUCCESS(); } + /** + * 根据id查询员工的基本信息和部门信息 + * @param ids + * @return + */ + @GetMapping("/getEmployeeAndDeptById/{ids}") + @Override + public ResponseResult getEmployeeAndDeptById(@PathVariable("ids") List ids) { + + return new ResponseResult<>(true,10000, employeeService.getEmployeeAndDeptById(ids),"success"); + } } 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 133f3de6..a5b6588e 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 @@ -1,8 +1,14 @@ package com.daqing.financial.hrms.dao; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.daqing.framework.domain.hrms.EmployeeEntity; import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.daqing.framework.domain.hrms.ext.EmployeeTO; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 记录员工的基本信息,如姓名、电话、部门等 @@ -13,5 +19,6 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface EmployeeDao extends BaseMapper { - + + List getEmployeeAndDeptById(@Param("ids") List ids); } diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/feign/CrmsFeignService.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/feign/CrmsFeignService.java index 497d52e0..4e11ba06 100644 --- a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/feign/CrmsFeignService.java +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/feign/CrmsFeignService.java @@ -2,6 +2,7 @@ package com.daqing.financial.hrms.feign; import com.daqing.framework.model.response.ResponseResult; import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.stereotype.Component; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; diff --git a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/EmployeeService.java b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/EmployeeService.java index 883003b3..ec23351c 100644 --- a/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/EmployeeService.java +++ b/dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/EmployeeService.java @@ -1,9 +1,11 @@ package com.daqing.financial.hrms.service; import com.baomidou.mybatisplus.extension.service.IService; +import com.daqing.framework.domain.hrms.ext.EmployeeTO; import com.daqing.framework.utils.PageUtils; import com.daqing.framework.domain.hrms.EmployeeEntity; +import java.util.List; import java.util.Map; /** @@ -15,6 +17,6 @@ import java.util.Map; */ public interface EmployeeService extends IService { - PageUtils queryPage(Map params); + List getEmployeeAndDeptById(List ids); } 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 2a394322..538c55a6 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 @@ -1,13 +1,9 @@ package com.daqing.financial.hrms.service.impl; +import com.daqing.framework.domain.hrms.ext.EmployeeTO; import org.springframework.stereotype.Service; -import java.util.Map; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import com.baomidou.mybatisplus.core.metadata.IPage; +import java.util.List; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; -import com.daqing.framework.utils.PageUtils; -import com.daqing.framework.utils.Query; - import com.daqing.financial.hrms.dao.EmployeeDao; import com.daqing.framework.domain.hrms.EmployeeEntity; import com.daqing.financial.hrms.service.EmployeeService; @@ -16,14 +12,15 @@ import com.daqing.financial.hrms.service.EmployeeService; @Service("employeeService") public class EmployeeServiceImpl extends ServiceImpl implements EmployeeService { + /** + * 根据员工id查询员工的姓名和部门信息 + * @param ids + * @return + */ @Override - public PageUtils queryPage(Map params) { - IPage page = this.page( - new Query().getPage(params), - new QueryWrapper() - ); + public List getEmployeeAndDeptById(List ids) { - return new PageUtils(page); + return this.getBaseMapper().getEmployeeAndDeptById(ids); } } \ 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 f1d5df92..ddcfb700 100644 --- a/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml +++ b/dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml @@ -18,6 +18,25 @@ + + + + + + + + - + \ No newline at end of file diff --git a/dq-financial-hrms/src/test/java/com/daqing/financial/hrms/DqFinancialHrmsApplicationTests.java b/dq-financial-hrms/src/test/java/com/daqing/financial/hrms/DqFinancialHrmsApplicationTests.java index d3fa77d4..671e9974 100644 --- a/dq-financial-hrms/src/test/java/com/daqing/financial/hrms/DqFinancialHrmsApplicationTests.java +++ b/dq-financial-hrms/src/test/java/com/daqing/financial/hrms/DqFinancialHrmsApplicationTests.java @@ -1,13 +1,35 @@ package com.daqing.financial.hrms; +import com.daqing.financial.hrms.service.impl.EmployeeServiceImpl; +import com.daqing.framework.domain.crms.CustomerEntity; +import com.daqing.framework.domain.hrms.EmployeeEntity; +import com.daqing.framework.domain.hrms.ext.EmployeeTO; +import com.daqing.framework.utils.PageUtils; import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.test.context.junit4.SpringRunner; + +import java.util.ArrayList; +import java.util.List; @SpringBootTest -class DqFinancialHrmsApplicationTests { +@RunWith(SpringRunner.class) +public class DqFinancialHrmsApplicationTests { + + @Autowired + private EmployeeServiceImpl employeeServiceimpl; + + List ids = new ArrayList<>(); @Test - void contextLoads() { + public void contextLoads() { + ids.add(1L); + List list = employeeServiceimpl.getEmployeeAndDeptById(ids); + for (EmployeeTO employeeTO : list) { + System.out.println(employeeTO); + } } } diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerTO.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerTO.java new file mode 100644 index 00000000..2af040ac --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerTO.java @@ -0,0 +1,52 @@ +package com.daqing.framework.domain.crms.ext; + +import lombok.Data; +import lombok.ToString; + +import java.io.Serializable; +import java.util.List; + +/** + * 返回客户信息包装类 + * + * @auther River + * @date 2020/9/9 10:10 + */ +@Data +@ToString +public class CustomerTO implements Serializable { + + /** + * id + */ + private Long id; + /** + * 客户编号 + */ + private String code; + + /** + * 客户姓名 + */ + private String name; + + /** + * 联系电话 + */ + private String phone; + + /** + * 客户类型 + */ + private Integer type; + + /** + * 客户经理 + */ + private String manager; + + /** + * 所属部门 + */ + private List departments; +} diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/request/CustomerRequest.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/request/CustomerRequest.java index c09488fc..7ae6aac3 100644 --- a/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/request/CustomerRequest.java +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/crms/request/CustomerRequest.java @@ -1,15 +1,10 @@ package com.daqing.framework.domain.crms.request; -import com.baomidou.mybatisplus.annotation.TableId; -import com.baomidou.mybatisplus.annotation.TableName; -import lombok.Data; -import java.io.Serializable; -import java.util.Date; import lombok.Data; +import java.io.Serializable; import lombok.ToString; -import java.io.Serializable; /** * 记录客户基本信息 diff --git a/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeTO.java b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeTO.java new file mode 100644 index 00000000..f5e95114 --- /dev/null +++ b/dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeTO.java @@ -0,0 +1,35 @@ +package com.daqing.framework.domain.hrms.ext; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.ToString; + +import java.io.Serializable; +import java.util.List; + +/** + * @auther River + * @date 2020/9/9 17:53 + */ +@Data +@ToString +@NoArgsConstructor +@AllArgsConstructor +public class EmployeeTO implements Serializable { + + /** + * id + */ + private Long id; + + /** + * 员工姓名 + */ + private String empName; + + /** + * 部门名称 + */ + private List deptNames; +}