客户资源管理后台管理列表查询

master
river 4 years ago
parent cc9c3d5b05
commit 19ab4f5aa6
  1. 4
      dq-financial-api/src/main/java/com/daqing/financial/crms/CustomerControllerApi.java
  2. 2
      dq-financial-api/src/main/java/com/daqing/financial/hrms/DeptControllerApi.java
  3. 21
      dq-financial-api/src/main/java/com/daqing/financial/hrms/EmployeeControllerApi.java
  4. 18
      dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CustomerController.java
  5. 9
      dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/CustomerDao.java
  6. 8
      dq-financial-crms/src/main/java/com/daqing/financial/crms/feign/HrmsFeignService.java
  7. 3
      dq-financial-crms/src/main/java/com/daqing/financial/crms/service/CustomerService.java
  8. 113
      dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerServiceImpl.java
  9. 20
      dq-financial-crms/src/main/resources/mapper/crms/CustomerDao.xml
  10. 34
      dq-financial-crms/src/test/java/com/daqing/financial/crms/DqFinancialCrmsApplicationTests.java
  11. 23
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/EmployeeController.java
  12. 9
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/EmployeeDao.java
  13. 1
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/feign/CrmsFeignService.java
  14. 4
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/EmployeeService.java
  15. 21
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/EmployeeServiceImpl.java
  16. 21
      dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml
  17. 26
      dq-financial-hrms/src/test/java/com/daqing/financial/hrms/DqFinancialHrmsApplicationTests.java
  18. 52
      dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerTO.java
  19. 7
      dq-framework-model/src/main/java/com/daqing/framework/domain/crms/request/CustomerRequest.java
  20. 35
      dq-framework-model/src/main/java/com/daqing/framework/domain/hrms/ext/EmployeeTO.java

@ -18,7 +18,7 @@ public interface CustomerControllerApi {
/** /**
* 列表展示 * 列表展示
*/ */
@ApiOperation(value = "客户信息列表展示", notes = "客户信息列表展示") /*@ApiOperation(value = "客户信息列表展示", notes = "客户信息列表展示")
ResponseResult list(Map<String, Object> params); ResponseResult list(Map<String, Object> params);*/
} }

@ -5,6 +5,8 @@ import com.daqing.framework.model.response.ResponseResult;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import java.util.List;
/** /**
* @Author: gongsj. * @Author: gongsj.
* @Description: 部门管理controllerApi定义 * @Description: 部门管理controllerApi定义

@ -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<Long> ids);
}

@ -29,23 +29,6 @@ public class CustomerController implements CustomerControllerApi {
@Autowired @Autowired
HrmsFeignService hrmsFeignService; HrmsFeignService hrmsFeignService;
/**
* 列表
*/
@Override
@GetMapping("/list")
//@RequiresPermissions("crms:customer:list")
public ResponseResult list(@RequestParam Map<String, Object> params) {
PageUtils page = customerService.queryPage(params);
List<String> 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)); customerService.removeByIds(Arrays.asList(ids));
return ResponseResult.SUCCESS(); return ResponseResult.SUCCESS();
} }
} }

@ -1,17 +1,22 @@
package com.daqing.financial.crms.dao; 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.daqing.framework.domain.crms.CustomerEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; 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.Mapper;
import org.apache.ibatis.annotations.Param;
/** /**
* 记录客户基本信息 * 记录客户基本信息
* *
* @author gongsj * @author gongsj
* @email gongsj@gmail.com * @email gongsj@gmail.com
* @date 2020-09-08 09:57:32 * @date 2020-09-08 09:57:32
*/ */
@Mapper @Mapper
public interface CustomerDao extends BaseMapper<CustomerEntity> { public interface CustomerDao extends BaseMapper<CustomerEntity> {
IPage<CustomerEntity> queryList(Page page, @Param("cr") CustomerRequest customerRequest);
} }

@ -2,9 +2,13 @@ package com.daqing.financial.crms.feign;
import com.daqing.framework.model.response.ResponseResult; import com.daqing.framework.model.response.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping; 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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -14,6 +18,8 @@ import java.util.Map;
public interface HrmsFeignService { public interface HrmsFeignService {
@GetMapping("/hrms/dept/list") @GetMapping("/hrms/dept/list")
public ResponseResult list(@RequestParam Map<String, Object> params); ResponseResult list(@RequestParam Map<String, Object> params);
@GetMapping("/hrms/employee/getEmployeeAndDeptById/{ids}")
ResponseResult getEmployeeAndDeptById(@PathVariable("ids") List<Long> ids);
} }

@ -16,8 +16,7 @@ import java.util.Map;
*/ */
public interface CustomerService extends IService<CustomerEntity> { public interface CustomerService extends IService<CustomerEntity> {
/*PageUtils queryPage(Map<String, Object> params);*/
PageUtils queryList(Integer page, Integer size, CustomerRequest customerRequest); PageUtils queryList(Integer page, Integer size, CustomerRequest customerRequest);
} }

@ -1,43 +1,124 @@
package com.daqing.financial.crms.service.impl; 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.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.daqing.financial.crms.dao.CustomerDao; import com.daqing.financial.crms.dao.CustomerDao;
import com.daqing.financial.crms.feign.HrmsFeignService;
import com.daqing.financial.crms.service.CustomerService; import com.daqing.financial.crms.service.CustomerService;
import com.daqing.framework.domain.crms.CustomerEntity; 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.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.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 org.springframework.stereotype.Service;
import java.util.Map; import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
@Service("customerService") @Service("customerService")
public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity> implements CustomerService { public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity> implements CustomerService {
/*@Override @Autowired
public PageUtils queryPage(Map<String, Object> params) { private CustomerDao customerDao;
IPage<CustomerEntity> page = this.page(
new Query<CustomerEntity>().getPage(params), @Autowired
new QueryWrapper<CustomerEntity>() private HrmsFeignService hrmsFeignService;
);
public void t() {
hrmsFeignService.list(new HashMap<>());
}
return new PageUtils(page);
}*/
/** /**
* 查询客户列表(所有)根据创建时间筛选根据客户类型筛选根据客户编号或者名称搜索 * 查询客户列表(所有)根据创建时间筛选根据客户类型筛选根据客户编号或者名称搜索
* @param page *
* @param size * @param page 当前页
* @param customerRequest * @param size 每页条数
* @return * @param customerRequest 请求参数
* @return 所有客户以及信息集合
*/ */
@Override @Override
public PageUtils queryList(Integer page, Integer size, CustomerRequest customerRequest) { 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<Object> pages = new Page<>(page, size);
IPage<CustomerEntity> customerEntityIPage = customerDao.queryList(pages, customerRequest);
// 获取所有的客户基本信息
List<CustomerEntity> customers = customerEntityIPage.getRecords();
// 获取所有的客户经理id
List<Long> ids = customers.stream().map(CustomerEntity::getId).collect(Collectors.toList());
// 用于拼装客户信息和员工及部门信息的集合
List<CustomerTO> customerTOS = new ArrayList<>();
CustomerTO customerTO = new CustomerTO();
//TODO 远程调用查询客户经理信息的接口
ResponseResult responseResult = hrmsFeignService.getEmployeeAndDeptById(ids);
List<EmployeeTO> employeeTO = (List<EmployeeTO>) responseResult.getData();
/*String data = (String) responseResult.getData();
List<EmployeeTO> 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<CustomerTO> 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());
}
} }

@ -20,5 +20,25 @@
<result property="motifyTime" column="motify_time"/> <result property="motifyTime" column="motify_time"/>
</resultMap> </resultMap>
<!-- 查询客户列表(所有)、根据创建时间筛选、根据客户类型筛选、根据客户编号或者名称搜索 -->
<select id="queryList" parameterType="com.daqing.framework.domain.crms.request.CustomerRequest" resultType="com.daqing.framework.domain.crms.CustomerEntity">
SELECT id,code,type,name,phone,manager
FROM crms_customer
WHERE del_or_not = 0
<if test="cr.codeOrName != null and cr.codeOrName != '' ">
AND name LIKE CONCAT('%',#{cr.codeOrName},'%')
OR code LIKE CONCAT('%',#{cr.codeOrName},'%')
</if>
<if test="cr.customerType != null and cr.customerType != '' ">
AND type = #{cr.customerType}
</if>
<if test="cr.startTime != null and cr.startTime != '' ">
AND create_time &gt;= #{cr.startTime}
</if>
<if test="cr.endTime != null and cr.endTime != '' ">
AND create_time &lt;= #{cr.endTime}
</if>
ORDER BY create_time DESC
</select>
</mapper> </mapper>

@ -1,13 +1,43 @@
package com.daqing.financial.crms; 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.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.List;
@SpringBootTest @SpringBootTest
class DqFinancialCrmsApplicationTests { @RunWith(SpringRunner.class)
public class DqFinancialCrmsApplicationTests {
@Autowired
private CustomerServiceImpl customerServiceimpl;
CustomerRequest customerRequest = new CustomerRequest();
@Test @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<CustomerTO> list1 = (List<CustomerTO>) list.getList();
list1.forEach(customerEntity -> System.out.println(customerEntity));
} }
@Test
public void t() {
customerServiceimpl.t();
}
} }

@ -1,13 +1,14 @@
package com.daqing.financial.hrms.controller; package com.daqing.financial.hrms.controller;
import com.daqing.financial.hrms.EmployeeControllerApi;
import com.daqing.financial.hrms.service.EmployeeService; import com.daqing.financial.hrms.service.EmployeeService;
import com.daqing.framework.domain.hrms.EmployeeEntity; import com.daqing.framework.domain.hrms.EmployeeEntity;
import com.daqing.framework.model.response.ResponseResult; import com.daqing.framework.model.response.ResponseResult;
import com.daqing.framework.utils.PageUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.Map; import java.util.Map;
@ -20,21 +21,16 @@ import java.util.Map;
*/ */
@RestController @RestController
@RequestMapping("hrms/employee") @RequestMapping("hrms/employee")
public class EmployeeController { public class EmployeeController implements EmployeeControllerApi{
@Autowired @Autowired
private EmployeeService employeeService; private EmployeeService employeeService;
/**
* 列表
*/
@GetMapping("/list") @GetMapping("/list")
//@RequiresPermissions("hrms:employee:list") //@RequiresPermissions("hrms:employee:info")
public ResponseResult list(@RequestParam Map<String, Object> params) { public ResponseResult list(@RequestParam Map<String, Object> params) {
PageUtils page = employeeService.queryPage(params);
return ResponseResult.SUCCESS(); return ResponseResult.SUCCESS();
} }
/** /**
* 信息 * 信息
*/ */
@ -78,4 +74,15 @@ public class EmployeeController {
return ResponseResult.SUCCESS(); return ResponseResult.SUCCESS();
} }
/**
* 根据id查询员工的基本信息和部门信息
* @param ids
* @return
*/
@GetMapping("/getEmployeeAndDeptById/{ids}")
@Override
public ResponseResult getEmployeeAndDeptById(@PathVariable("ids") List<Long> ids) {
return new ResponseResult<>(true,10000, employeeService.getEmployeeAndDeptById(ids),"success");
}
} }

@ -1,8 +1,14 @@
package com.daqing.financial.hrms.dao; 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.daqing.framework.domain.hrms.EmployeeEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; 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.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 记录员工的基本信息如姓名电话部门等 * 记录员工的基本信息如姓名电话部门等
@ -13,5 +19,6 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface EmployeeDao extends BaseMapper<EmployeeEntity> { public interface EmployeeDao extends BaseMapper<EmployeeEntity> {
List<EmployeeTO> getEmployeeAndDeptById(@Param("ids") List<Long> ids);
} }

@ -2,6 +2,7 @@ package com.daqing.financial.hrms.feign;
import com.daqing.framework.model.response.ResponseResult; import com.daqing.framework.model.response.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;

@ -1,9 +1,11 @@
package com.daqing.financial.hrms.service; package com.daqing.financial.hrms.service;
import com.baomidou.mybatisplus.extension.service.IService; 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.utils.PageUtils;
import com.daqing.framework.domain.hrms.EmployeeEntity; import com.daqing.framework.domain.hrms.EmployeeEntity;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -15,6 +17,6 @@ import java.util.Map;
*/ */
public interface EmployeeService extends IService<EmployeeEntity> { public interface EmployeeService extends IService<EmployeeEntity> {
PageUtils queryPage(Map<String, Object> params); List<EmployeeTO> getEmployeeAndDeptById(List<Long> ids);
} }

@ -1,13 +1,9 @@
package com.daqing.financial.hrms.service.impl; package com.daqing.financial.hrms.service.impl;
import com.daqing.framework.domain.hrms.ext.EmployeeTO;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Map; import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.financial.hrms.dao.EmployeeDao;
import com.daqing.framework.domain.hrms.EmployeeEntity; import com.daqing.framework.domain.hrms.EmployeeEntity;
import com.daqing.financial.hrms.service.EmployeeService; import com.daqing.financial.hrms.service.EmployeeService;
@ -16,14 +12,15 @@ import com.daqing.financial.hrms.service.EmployeeService;
@Service("employeeService") @Service("employeeService")
public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao, EmployeeEntity> implements EmployeeService { public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao, EmployeeEntity> implements EmployeeService {
/**
* 根据员工id查询员工的姓名和部门信息
* @param ids
* @return
*/
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public List<EmployeeTO> getEmployeeAndDeptById(List<Long> ids) {
IPage<EmployeeEntity> page = this.page(
new Query<EmployeeEntity>().getPage(params),
new QueryWrapper<EmployeeEntity>()
);
return new PageUtils(page); return this.getBaseMapper().getEmployeeAndDeptById(ids);
} }
} }

@ -18,6 +18,25 @@
<result property="headPortaritUrl" column="head_portarit_url"/> <result property="headPortaritUrl" column="head_portarit_url"/>
<result property="userId" column="user_id"/> <result property="userId" column="user_id"/>
</resultMap> </resultMap>
<resultMap type="com.daqing.framework.domain.hrms.ext.EmployeeTO" id="employeeTO">
<id property="id" column="eid"/>
<result property="empName" column="emp_name"/>
<collection property="deptNames" ofType="string">
<result column="dept_name"/> <!-- 员工和部门是多对多,从单个员工的角度看为一对多 -->
</collection>
</resultMap>
<select id="getEmployeeAndDeptById" resultMap="employeeTO">
SELECT e.id eid,e.name emp_name,d.name dept_name
FROM hrms_employee e
LEFT JOIN hrms_employee_dept ed
ON e.id = ed.employee_id
LEFT JOIN hrms_dept d
ON d.id = ed.dept_id
WHERE e.id =
<foreach collection="ids" open="(" separator="," close=")" item="id">
#{id}
</foreach>
</select>
</mapper> </mapper>

@ -1,13 +1,35 @@
package com.daqing.financial.hrms; 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.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.util.ArrayList;
import java.util.List;
@SpringBootTest @SpringBootTest
class DqFinancialHrmsApplicationTests { @RunWith(SpringRunner.class)
public class DqFinancialHrmsApplicationTests {
@Autowired
private EmployeeServiceImpl employeeServiceimpl;
List<Long> ids = new ArrayList<>();
@Test @Test
void contextLoads() { public void contextLoads() {
ids.add(1L);
List<EmployeeTO> list = employeeServiceimpl.getEmployeeAndDeptById(ids);
for (EmployeeTO employeeTO : list) {
System.out.println(employeeTO);
}
} }
} }

@ -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<String> departments;
}

@ -1,15 +1,10 @@
package com.daqing.framework.domain.crms.request; 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 lombok.Data;
import java.io.Serializable;
import lombok.ToString; import lombok.ToString;
import java.io.Serializable;
/** /**
* 记录客户基本信息 * 记录客户基本信息

@ -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<String> deptNames;
}
Loading…
Cancel
Save