客户资源后台查看和批量删除

master
river 4 years ago
parent c2536a297d
commit 3b6e6b1fa3
  1. 20
      dq-financial-api/src/main/java/com/daqing/financial/crms/CustomerControllerApi.java
  2. 2
      dq-financial-api/src/main/java/com/daqing/financial/hrms/EmployeeControllerApi.java
  3. 21
      dq-financial-crms/src/main/java/com/daqing/financial/crms/controller/CustomerController.java
  4. 3
      dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/CompanyCustomerDao.java
  5. 9
      dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/CustomerDao.java
  6. 3
      dq-financial-crms/src/main/java/com/daqing/financial/crms/dao/PersonalCustomerDao.java
  7. 8
      dq-financial-crms/src/main/java/com/daqing/financial/crms/feign/HrmsFeignService.java
  8. 5
      dq-financial-crms/src/main/java/com/daqing/financial/crms/service/CustomerService.java
  9. 178
      dq-financial-crms/src/main/java/com/daqing/financial/crms/service/impl/CustomerServiceImpl.java
  10. 7
      dq-financial-crms/src/main/resources/mapper/crms/CompanyCustomerDao.xml
  11. 34
      dq-financial-crms/src/main/resources/mapper/crms/CustomerDao.xml
  12. 8
      dq-financial-crms/src/main/resources/mapper/crms/PersonalCustomerDao.xml
  13. 18
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/controller/EmployeeController.java
  14. 2
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/dao/EmployeeDao.java
  15. 2
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/EmployeeService.java
  16. 10
      dq-financial-hrms/src/main/java/com/daqing/financial/hrms/service/impl/EmployeeServiceImpl.java
  17. 5
      dq-financial-hrms/src/main/resources/mapper/hrms/EmployeeDao.xml
  18. 24
      dq-framework-model/src/main/java/com/daqing/framework/domain/crms/PersonalCustomerEntity.java
  19. 4
      dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CrmsConstant.java
  20. 76
      dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerVOCompany.java
  21. 100
      dq-framework-model/src/main/java/com/daqing/framework/domain/crms/ext/CustomerVOPersonal.java

@ -1,9 +1,13 @@
package com.daqing.financial.crms; package com.daqing.financial.crms;
import com.daqing.framework.domain.crms.request.CustomerRequest;
import com.daqing.framework.model.response.ResponseResult; 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 org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -18,7 +22,19 @@ public interface CustomerControllerApi {
/** /**
* 列表展示 * 列表展示
*/ */
/*@ApiOperation(value = "客户信息列表展示", notes = "客户信息列表展示") @ApiOperation(value = "客户信息列表展示", notes = "客户信息列表展示")
ResponseResult list(Map<String, Object> params);*/ ResponseResult queryList(Integer page, Integer size, CustomerRequest customerRequest);
/**
* 客户的详细信息
*/
@ApiOperation(value = "客户的详细信息", notes = "客户的详细信息")
ResponseResult queryDetails(Long id);
/**
* 删除所选客户
*/
@ApiOperation(value = "删除所选客户", notes = "删除所选客户")
ResponseResult deleteCustomer(Long[] ids);
} }

@ -19,4 +19,6 @@ public interface EmployeeControllerApi {
*/ */
@ApiOperation(value = "根据id查询员工的基本信息和部门信息", notes = "根据id查询员工的基本信息和部门信息") @ApiOperation(value = "根据id查询员工的基本信息和部门信息", notes = "根据id查询员工的基本信息和部门信息")
ResponseResult getEmployeeAndDeptById(Long[] ids); ResponseResult getEmployeeAndDeptById(Long[] ids);
ResponseResult getEmployeeById(Long id);
} }

@ -46,8 +46,25 @@ public class CustomerController implements CustomerControllerApi {
@GetMapping("/queryList") @GetMapping("/queryList")
public ResponseResult queryList(@RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, CustomerRequest customerRequest) { public ResponseResult queryList(@RequestParam(value = "page", required = false) Integer page, @RequestParam(value = "size", required = false) Integer size, CustomerRequest customerRequest) {
PageUtils list = customerService.queryList(page, size, customerRequest); return new ResponseResult<PageUtils>().SUCCESS(customerService.queryList(page, size, customerRequest));
}
/**
* 根据客户id查询客户的详细信息
*/
@GetMapping("/queryDetails")
public ResponseResult queryDetails(@RequestParam("id") Long id){
return customerService.queryCustomerById(id);
}
/**
* 根据客户id删除所选客户
*/
@Override
@DeleteMapping("/deleteCustomer")
public ResponseResult deleteCustomer(@RequestBody Long[] ids){
return new ResponseResult<PageUtils>().SUCCESS(list); return new ResponseResult<List<String>>().SUCCESS(customerService.updateCustomerById(ids));
} }
} }

@ -13,5 +13,6 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface CompanyCustomerDao extends BaseMapper<CompanyCustomerEntity> { public interface CompanyCustomerDao extends BaseMapper<CompanyCustomerEntity> {
CompanyCustomerEntity queryCompanyCustomerById(Long id);
} }

@ -4,10 +4,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; 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.PersonalCustomerEntity;
import com.daqing.framework.domain.crms.request.CustomerRequest; 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; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 记录客户基本信息 * 记录客户基本信息
* *
@ -19,4 +22,10 @@ import org.apache.ibatis.annotations.Param;
public interface CustomerDao extends BaseMapper<CustomerEntity> { public interface CustomerDao extends BaseMapper<CustomerEntity> {
IPage<CustomerEntity> queryList(Page page, @Param("cr") CustomerRequest customerRequest); IPage<CustomerEntity> queryList(Page page, @Param("cr") CustomerRequest customerRequest);
CustomerEntity queryCustomerById(Long id);
void updateCustomerById(@Param("ids") List<Long> ids);
List<String> queryCustomerNameById(@Param("ids") List<Long> ids);
} }

@ -13,5 +13,6 @@ import org.apache.ibatis.annotations.Mapper;
*/ */
@Mapper @Mapper
public interface PersonalCustomerDao extends BaseMapper<PersonalCustomerEntity> { public interface PersonalCustomerDao extends BaseMapper<PersonalCustomerEntity> {
PersonalCustomerEntity queryPersonalCustomerById(Long id);
} }

@ -1,5 +1,6 @@
package com.daqing.financial.crms.feign; package com.daqing.financial.crms.feign;
import com.daqing.framework.domain.hrms.EmployeeEntity;
import com.daqing.framework.domain.hrms.ext.EmployeeTO; import com.daqing.framework.domain.hrms.ext.EmployeeTO;
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;
@ -18,6 +19,9 @@ public interface HrmsFeignService {
@GetMapping("/hrms/dept/list") @GetMapping("/hrms/dept/list")
ResponseResult list(@RequestParam Map<String, Object> params); ResponseResult list(@RequestParam Map<String, Object> params);
@GetMapping("/hrms/employee/getEmployeeAndDeptById/{ids}") // 远程调用传递集合类型的参数必须以数组封装,不然会导致数据接收不完整 @GetMapping("/hrms/employee/getEmployeeAndDeptById") // 远程调用传递集合类型的参数必须以数组封装,不然会导致数据接收不完整
ResponseResult<List<EmployeeTO>> getEmployeeAndDeptById(@PathVariable("ids") Long[] ids); ResponseResult<List<EmployeeTO>> getEmployeeAndDeptById(@RequestParam("ids") Long[] ids);
@GetMapping("/hrms/employee/getEmployeeById")
ResponseResult<EmployeeEntity> getEmployeeById(@RequestParam("id") Long id);
} }

@ -2,9 +2,11 @@ package com.daqing.financial.crms.service;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.daqing.framework.domain.crms.request.CustomerRequest; import com.daqing.framework.domain.crms.request.CustomerRequest;
import com.daqing.framework.model.response.ResponseResult;
import com.daqing.framework.utils.PageUtils; import com.daqing.framework.utils.PageUtils;
import com.daqing.framework.domain.crms.CustomerEntity; import com.daqing.framework.domain.crms.CustomerEntity;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
@ -18,5 +20,8 @@ public interface CustomerService extends IService<CustomerEntity> {
PageUtils queryList(Integer page, Integer size, CustomerRequest customerRequest); PageUtils queryList(Integer page, Integer size, CustomerRequest customerRequest);
ResponseResult queryCustomerById(Long id);
List<String> updateCustomerById(Long[] ids);
} }

@ -4,13 +4,20 @@ 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.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.CompanyCustomerDao;
import com.daqing.financial.crms.dao.CustomerDao; import com.daqing.financial.crms.dao.CustomerDao;
import com.daqing.financial.crms.dao.PersonalCustomerDao;
import com.daqing.financial.crms.feign.HrmsFeignService; 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.CompanyCustomerEntity;
import com.daqing.framework.domain.crms.CustomerEntity; 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.CrmsConstant;
import com.daqing.framework.domain.crms.ext.CustomerTO; 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.request.CustomerRequest; 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.domain.hrms.ext.EmployeeTO;
import com.daqing.framework.model.response.ResponseResult; import com.daqing.framework.model.response.ResponseResult;
import com.daqing.framework.utils.PageUtils; import com.daqing.framework.utils.PageUtils;
@ -18,6 +25,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
@ -28,6 +36,12 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
@Autowired @Autowired
private CustomerDao customerDao; private CustomerDao customerDao;
@Autowired
private PersonalCustomerDao personalCustomerDao;
@Autowired
private CompanyCustomerDao companyCustomerDao;
@Autowired @Autowired
private HrmsFeignService hrmsFeignService; private HrmsFeignService hrmsFeignService;
@ -42,12 +56,12 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
@Override @Override
public PageUtils queryList(Integer page, Integer size, CustomerRequest customerRequest) { public PageUtils queryList(Integer page, Integer size, CustomerRequest customerRequest) {
// 选择某段时间内客户信息的时间参数校验 // 时间参数校验
timeCheckout(customerRequest.getCreateTime(),customerRequest.getStartTime(),customerRequest.getEndTime(),customerRequest); this.timeCheckout(customerRequest.getCreateTime(), customerRequest.getStartTime(), customerRequest.getEndTime(), customerRequest);
//分页参数校验 // 分页参数校验
Page<Object> pages = pageCheckout(page, size); Page<Object> pages = this.pageCheckout(page, size);
//查询所有客户的基本信息 // 查询所有客户的基本信息
IPage<CustomerEntity> customerEntityIPage = customerDao.queryList(pages, customerRequest); IPage<CustomerEntity> customerEntityIPage = customerDao.queryList(pages, customerRequest);
// 获取所有的客户基本信息 // 获取所有的客户基本信息
@ -55,33 +69,88 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
// 获取所有的客户经理id // 获取所有的客户经理id
Long[] ids = customers.stream().map(CustomerEntity::getId).toArray(Long[]::new); Long[] ids = customers.stream().map(CustomerEntity::getId).toArray(Long[]::new);
//TODO 远程调用查询客户经理信息的接口 if (ids != null && ids.length != 0) {
ResponseResult responseResult = hrmsFeignService.getEmployeeAndDeptById(ids); //TODO 远程调用查询客户经理信息的接口
List<EmployeeTO> employeeTO = (List<EmployeeTO>) responseResult.getData(); ResponseResult responseResult = hrmsFeignService.getEmployeeAndDeptById(ids);
List<EmployeeTO> employeeTO = (List<EmployeeTO>) responseResult.getData();
// 将客户信息和客户经理及部门信息拼装起来 // 将客户信息和客户经理及部门信息拼装起来
List<CustomerTO> customerTOS = jointCustomerEmployee(customers, employeeTO); List<CustomerTO> customerTOS = this.jointCustomerEmployee(customers, employeeTO);
// 属性拷贝,将泛型为CustomerEntity类型的IPage的属性拷贝给泛型为CustomerTO类型的IPage,才能赋值给PageUtils // 属性拷贝,将泛型为CustomerEntity类型的IPage的属性拷贝给泛型为CustomerTO类型的IPage,才能赋值给PageUtils
IPage<CustomerTO> iPage = new Page<>(); IPage<CustomerTO> iPage = new Page<>();
BeanUtils.copyProperties(customerEntityIPage, iPage); BeanUtils.copyProperties(customerEntityIPage, iPage);
iPage.setRecords(customerTOS); iPage.setRecords(customerTOS);
return new PageUtils(iPage);
} else {
return new PageUtils(customerEntityIPage);
}
}
/**
* 根据id查询客户的信息
*
* @param id 客户id
* @return
*/
@Override
public ResponseResult queryCustomerById(Long id) {
return new PageUtils(iPage); // 员工基本信息
CustomerEntity customer = customerDao.queryCustomerById(id);
if (customer == null) {
return new ResponseResult<CustomerEntity>().SUCCESS(null);
}
// 客户经理姓名
String name = hrmsFeignService.getEmployeeById(customer.getManager()).getData().getName();
// 判断该客户的类型
if (Objects.equals(customer.getType(), CrmsConstant.CustomerType.PERSONAL_CUSTOMER.getType())) {
PersonalCustomerEntity personalCustomerEntity = personalCustomerDao.queryPersonalCustomerById(id);
//封装个人类型客户信息
CustomerVOPersonal customerVOPersonal = this.setPersonal(customer, name, personalCustomerEntity);
return new ResponseResult<CustomerVOPersonal>().SUCCESS(customerVOPersonal);
} else {
CompanyCustomerEntity companyCustomerEntity = companyCustomerDao.queryCompanyCustomerById(id);
//封装企业类型客户信息
CustomerVOCompany customerVOCompany = this.setCompany(customer, name, companyCustomerEntity);
return new ResponseResult<CustomerVOCompany>().SUCCESS(customerVOCompany);
}
}
/**
* 根据id更新是否删除字段
*
* @param ids 客户id集合
* @return
*/
@Override
public List<String> updateCustomerById(Long[] ids) {
//TODO 远程调用审批模块判断所选客户是否在审批,返回正在审批的客户的id集合Long[] idArray
List<Long> idArray = new ArrayList<>();// 假设为返回的正在审批的客户id集合
if (idArray.size() == 0 || idArray == null) {
customerDao.updateCustomerById(Arrays.asList(ids));
return new ArrayList<>();
} else {
return customerDao.queryCustomerNameById(idArray);
}
} }
/** /**
* 选择某段时间内客户信息的时间参数校验 * 选择某段时间内客户信息的时间参数校验
*
* @param createTime 创建时间 * @param createTime 创建时间
* @param startTime 起始时间 * @param startTime 起始时间
* @param endTime 结束时间 * @param endTime 结束时间
*/ */
private void timeCheckout(Integer createTime, String startTime, String endTime, CustomerRequest customerRequest){ private void timeCheckout(Integer createTime, String startTime, String endTime, CustomerRequest customerRequest) {
// 没有选择自定义时间且选择了固定的"3个月内、6个月内、9个月内...."时间 // 没有选择自定义时间且选择了固定的"3个月内、6个月内、9个月内...."时间
if (startTime == null && endTime == null && createTime != null) { if (startTime == null && endTime == null && createTime != null) {
if (createTime != 0) { if (createTime == 3 || createTime == 6 || createTime == 9 || createTime == 12) {
String pastTime = pastTime(createTime); String pastTime = this.pastTime(createTime);
customerRequest.setStartTime(pastTime); customerRequest.setStartTime(pastTime);
} else {
customerRequest.setStartTime(null);
} }
} }
// 选择了自定义时间且选择了固定时间则固定时间无效 // 选择了自定义时间且选择了固定时间则固定时间无效
@ -107,10 +176,11 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
/** /**
* 分页参数校验 * 分页参数校验
*
* @param page 当前页 * @param page 当前页
* @param size 每页条数 * @param size 每页条数
*/ */
private Page<Object> pageCheckout(Integer page, Integer size){ private Page<Object> pageCheckout(Integer page, Integer size) {
Integer count = this.count(new QueryWrapper<CustomerEntity>().eq("del_or_not", CrmsConstant.NOT_DELETE));//查询客户有效总条数 Integer count = this.count(new QueryWrapper<CustomerEntity>().eq("del_or_not", CrmsConstant.NOT_DELETE));//查询客户有效总条数
if (size == null || size < 1) { if (size == null || size < 1) {
size = 10; size = 10;
@ -128,11 +198,12 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
/** /**
* 拼接客户及其对应的客户经理及部门信息 * 拼接客户及其对应的客户经理及部门信息
* @param customers 客户基本信息集合 *
* @param customers 客户基本信息集合
* @param employeeTO 员工及部门信息集合 * @param employeeTO 员工及部门信息集合
* @return * @return
*/ */
private List<CustomerTO> jointCustomerEmployee(List<CustomerEntity> customers, List<EmployeeTO> employeeTO){ private List<CustomerTO> jointCustomerEmployee(List<CustomerEntity> customers, List<EmployeeTO> employeeTO) {
List<CustomerTO> customerTOS = new ArrayList<>();// 用于拼装客户信息和员工及部门信息的集合 List<CustomerTO> customerTOS = new ArrayList<>();// 用于拼装客户信息和员工及部门信息的集合
CustomerTO customerTO; CustomerTO customerTO;
@ -163,4 +234,67 @@ public class CustomerServiceImpl extends ServiceImpl<CustomerDao, CustomerEntity
} }
return customerTOS; return customerTOS;
} }
/**
* 封装个人类型的客户信息
*
* @param customer 客户基本信息
* @param name 客户经理姓名
* @param personal 个人类型信息
* @return
*/
private CustomerVOPersonal setPersonal(CustomerEntity customer, String name, PersonalCustomerEntity personal) {
//BeanUtils能批量封装相同字段名称和类型的属性的值
CustomerVOPersonal customerVOPersonal = new CustomerVOPersonal();
customerVOPersonal.setCode(customer.getCode());
customerVOPersonal.setType(customer.getType());
customerVOPersonal.setManager(name);
customerVOPersonal.setName(customer.getName());
customerVOPersonal.setAddress(customer.getAddr());
customerVOPersonal.setPhone(customer.getPhone());
customerVOPersonal.setIdCard(personal.getIdCard());
customerVOPersonal.setAge(personal.getAge());
customerVOPersonal.setGender(personal.getGender());
customerVOPersonal.setMaritalStatus(personal.getMaritalStatus());
customerVOPersonal.setEducation(personal.getEducation());
customerVOPersonal.setEmployer(personal.getEmployer());
customerVOPersonal.setPosition(personal.getPosition());
customerVOPersonal.setWorkingYears(personal.getWorkingYears());
customerVOPersonal.setSocialSecurityNum(personal.getSocialSecurityNum());
customerVOPersonal.setLivingSituation(personal.getLivingSituation());
customerVOPersonal.setResidenceAddr(personal.getResidenceAddr());
customerVOPersonal.setBusinessSource(personal.getBusinessSource());
customerVOPersonal.setEmergencyLinkman(personal.getEmergencyLinkman());
customerVOPersonal.setEmergencyLinkmanRelationship(personal.getEmergencyLinkmanRelationship());
customerVOPersonal.setEmergencyLinkmanPhone(personal.getEmergencyLinkmanPhone());
return customerVOPersonal;
}
/**
* 封装企业类型的客户信息
*
* @param customer 客户基本信息
* @param name 客户经理姓名
* @param company 企业类型信息
* @return
*/
private CustomerVOCompany setCompany(CustomerEntity customer, String name, CompanyCustomerEntity company) {
CustomerVOCompany customerVOCompany = new CustomerVOCompany();
customerVOCompany.setCode(customer.getCode());
customerVOCompany.setType(customer.getType());
customerVOCompany.setManager(name);
customerVOCompany.setName(customer.getName());
customerVOCompany.setAddress(customer.getAddr());
customerVOCompany.setPhone(customer.getPhone());
customerVOCompany.setRegisteredCapital(company.getRegisteredCapital());
customerVOCompany.setIndustry(company.getIndustry());
customerVOCompany.setYears(company.getYears());
customerVOCompany.setRegion(company.getRegion());
customerVOCompany.setShareholder(company.getShareholder());
customerVOCompany.setAffiliatedCompany(company.getAffiliatedCompany());
customerVOCompany.setEmployeeNumber(company.getEmpNum());
customerVOCompany.setLinkman(company.getLinkman());
customerVOCompany.setBusinessSource(company.getBusinessSource());
return customerVOCompany;
}
} }

@ -18,5 +18,12 @@
<result property="customerId" column="customer_id"/> <result property="customerId" column="customer_id"/>
</resultMap> </resultMap>
<!-- 根据客户基本信息id查询企业类型客户的信息 -->
<select id="queryCompanyCustomerById" parameterType="long" resultType="com.daqing.framework.domain.crms.CompanyCustomerEntity">
SELECT registered_capital,industry,years,region,shareholder,affiliated_company,emp_num,linkman,business_source
FROM crms_company_customer
WHERE customer_id = #{id}
</select>
</mapper> </mapper>

@ -26,10 +26,9 @@
FROM crms_customer FROM crms_customer
WHERE del_or_not = 0 WHERE del_or_not = 0
<if test="cr.codeOrName != null and cr.codeOrName != '' "> <if test="cr.codeOrName != null and cr.codeOrName != '' ">
AND name LIKE CONCAT('%',#{cr.codeOrName},'%') AND (name LIKE CONCAT('%',#{cr.codeOrName},'%') OR code LIKE CONCAT('%',#{cr.codeOrName},'%'))
OR code LIKE CONCAT('%',#{cr.codeOrName},'%')
</if> </if>
<if test="cr.customerType != null and cr.customerType != '' "> <if test="cr.customerType != null">
AND type = #{cr.customerType} AND type = #{cr.customerType}
</if> </if>
<if test="cr.startTime != null and cr.startTime != '' "> <if test="cr.startTime != null and cr.startTime != '' ">
@ -41,4 +40,33 @@
ORDER BY create_time DESC ORDER BY create_time DESC
</select> </select>
<!-- 根据id查询客户的基本信息 -->
<select id="queryCustomerById" parameterType="long" resultType="com.daqing.framework.domain.crms.CustomerEntity">
SELECT id,code,type,manager,name,addr,phone
FROM crms_customer
WHERE del_or_not = 0
AND id = #{id}
</select>
<!-- 根据id更新是否删除字段 -->
<update id="updateCustomerById" >
UPDATE crms_customer
SET del_or_not = 1
WHERE id IN
<foreach collection="ids" open="(" close=")" separator="," item="id">
#{id}
</foreach>
</update>
<!-- 根据id查询客户姓名 -->
<select id="queryCustomerNameById" resultType="string">
SELECT name
FROM crms_customer
WHERE del_or_not = 0
AND id IN
<foreach collection="ids" open="(" close=")" separator="," item="id">
#{id}
</foreach>
</select>
</mapper> </mapper>

@ -24,5 +24,13 @@
<result property="emergencyLinkmanPhone" column="emergency_linkman_phone"/> <result property="emergencyLinkmanPhone" column="emergency_linkman_phone"/>
</resultMap> </resultMap>
<!-- 根据客户基本信息id查询个人类型客户的信息 -->
<select id="queryPersonalCustomerById" parameterType="long" resultType="com.daqing.framework.domain.crms.PersonalCustomerEntity">
SELECT 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
FROM crms_personal_customer
WHERE customer_id = #{id}
</select>
</mapper> </mapper>

@ -22,7 +22,7 @@ import java.util.Map;
*/ */
@RestController @RestController
@RequestMapping("hrms/employee") @RequestMapping("hrms/employee")
public class EmployeeController implements EmployeeControllerApi{ public class EmployeeController implements EmployeeControllerApi {
@Autowired @Autowired
private EmployeeService employeeService; private EmployeeService employeeService;
@ -78,13 +78,25 @@ public class EmployeeController implements EmployeeControllerApi{
/** /**
* 根据id查询员工的基本信息和部门信息 * 根据id查询员工的基本信息和部门信息
*
* @param ids * @param ids
* @return * @return
*/ */
@Override @Override
@GetMapping("/getEmployeeAndDeptById/{ids}") @GetMapping("/getEmployeeAndDeptById")
public ResponseResult getEmployeeAndDeptById(@RequestBody @PathVariable("ids") Long[] ids) { public ResponseResult getEmployeeAndDeptById(@RequestParam("ids") Long[] ids) {
List<EmployeeTO> employeeTO = employeeService.getEmployeeAndDeptById(Arrays.asList(ids)); List<EmployeeTO> employeeTO = employeeService.getEmployeeAndDeptById(Arrays.asList(ids));
return new ResponseResult<List<EmployeeTO>>().SUCCESS(employeeTO); return new ResponseResult<List<EmployeeTO>>().SUCCESS(employeeTO);
} }
/**
* 根据id查询员工姓名
* @param id
* @return
*/
@Override
@GetMapping("/getEmployeeById")
public ResponseResult getEmployeeById(@RequestParam("id") Long id) {
return new ResponseResult<EmployeeEntity>().SUCCESS(employeeService.getEmployeeById(id));
}
} }

@ -19,4 +19,6 @@ import java.util.List;
public interface EmployeeDao extends BaseMapper<EmployeeEntity> { public interface EmployeeDao extends BaseMapper<EmployeeEntity> {
List<EmployeeTO> getEmployeeAndDeptById(@Param("ids") List<Long> ids); List<EmployeeTO> getEmployeeAndDeptById(@Param("ids") List<Long> ids);
EmployeeEntity getEmployeeById(Long id);
} }

@ -18,5 +18,7 @@ import java.util.Map;
public interface EmployeeService extends IService<EmployeeEntity> { public interface EmployeeService extends IService<EmployeeEntity> {
List<EmployeeTO> getEmployeeAndDeptById(List<Long> ids); List<EmployeeTO> getEmployeeAndDeptById(List<Long> ids);
EmployeeEntity getEmployeeById(Long id);
} }

@ -22,4 +22,14 @@ public class EmployeeServiceImpl extends ServiceImpl<EmployeeDao, EmployeeEntity
return this.getBaseMapper().getEmployeeAndDeptById(ids); return this.getBaseMapper().getEmployeeAndDeptById(ids);
} }
/**
* 根据id查询员工的id
* @param id
* @return
*/
@Override
public EmployeeEntity getEmployeeById(Long id) {
return this.getBaseMapper().getEmployeeById(id);
}
} }

@ -41,4 +41,9 @@
#{id} #{id}
</foreach> </foreach>
</select> </select>
<!-- 根据id查询员工姓名 -->
<select id="getEmployeeById" parameterType="long" resultType="com.daqing.framework.domain.hrms.EmployeeEntity">
SELECT name FROM hrms_employee WHERE id = #{id}
</select>
</mapper> </mapper>

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
import lombok.Data; import lombok.Data;
import lombok.ToString;
/** /**
* 个人类型客户信息表 * 个人类型客户信息表
@ -17,6 +18,7 @@ import lombok.Data;
*/ */
@Data @Data
@TableName("crms_personal_customer") @TableName("crms_personal_customer")
@ToString
public class PersonalCustomerEntity implements Serializable { public class PersonalCustomerEntity implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
@ -46,47 +48,47 @@ public class PersonalCustomerEntity implements Serializable {
*/ */
private Integer maritalStatus; private Integer maritalStatus;
/** /**
* * 学历
*/ */
private String education; private String education;
/** /**
* * 工作单位
*/ */
private String employer; private String employer;
/** /**
* * 职务
*/ */
private String position; private String position;
/** /**
* * 工作年限
*/ */
private Integer workingYears; private Integer workingYears;
/** /**
* * 社保账号
*/ */
private String socialSecurityNum; private String socialSecurityNum;
/** /**
* * 居住情况
*/ */
private String livingSituation; private String livingSituation;
/** /**
* * 户籍地址
*/ */
private String residenceAddr; private String residenceAddr;
/** /**
* * 业务来源
*/ */
private String businessSource; private String businessSource;
/** /**
* * 紧急联系人
*/ */
private String emergencyLinkman; private String emergencyLinkman;
/** /**
* * 紧急联系人关系
*/ */
private String emergencyLinkmanRelationship; private String emergencyLinkmanRelationship;
/** /**
* * 紧急联系人电话
*/ */
private String emergencyLinkmanPhone; private String emergencyLinkmanPhone;

@ -50,11 +50,11 @@ public class CrmsConstant {
* 客户类型1企业类型0个人类型 * 客户类型1企业类型0个人类型
*/ */
@AllArgsConstructor @AllArgsConstructor
public enum customerType { public enum CustomerType {
/** /**
* 个人类型 * 个人类型
*/ */
PONSONAL_CUSTOMER(0, "个人类型"), PERSONAL_CUSTOMER(0, "个人类型"),
/** /**
* 企业类型 * 企业类型
*/ */

@ -0,0 +1,76 @@
package com.daqing.framework.domain.crms.ext;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
/**
* @auther River
* @date 2020/9/14 10:48
*/
@Data
@ToString
public class CustomerVOCompany implements Serializable {
/**
* 客户编号
*/
private String code;
/**
* 客户类型1企业类型0个人类型
*/
private Integer type;
/**
* 客户经理
*/
private String manager;
/**
* 客户名称
*/
private String name;
/**
* 联系地址
*/
private String address;
/**
* 联系电话
*/
private String phone;
/**
* 注册资金
*/
private String registeredCapital;
/**
* 所属行业
*/
private String industry;
/**
* 成立年限
*/
private Integer years;
/**
* 所在区域
*/
private String region;
/**
* 股东名称
*/
private String shareholder;
/**
* 关联企业
*/
private String affiliatedCompany;
/**
* 员工个数
*/
private String employeeNumber;
/**
* 联系人
*/
private String linkman;
/**
* 业务来源
*/
private String businessSource;
}

@ -0,0 +1,100 @@
package com.daqing.framework.domain.crms.ext;
import lombok.Data;
import lombok.ToString;
import java.io.Serializable;
/**
* @auther River
* @date 2020/9/11 17:28
*/
@Data
@ToString
public class CustomerVOPersonal implements Serializable {
/**
* 客户编号
*/
private String code;
/**
* 客户类型1企业类型0个人类型
*/
private Integer type;
/**
* 客户经理
*/
private String manager;
/**
* 客户名称
*/
private String name;
/**
* 联系地址
*/
private String address;
/**
* 联系电话
*/
private String phone;
/**
* 身份证号
*/
private String idCard;
/**
* 年龄
*/
private Integer age;
/**
* 性别10
*/
private Integer gender;
/**
* 婚姻状况1已婚0未婚
*/
private Integer maritalStatus;
/**
* 学历
*/
private String education;
/**
* 工作单位
*/
private String employer;
/**
* 职务
*/
private String position;
/**
* 工作年限
*/
private Integer workingYears;
/**
* 社保账号
*/
private String socialSecurityNum;
/**
* 居住情况
*/
private String livingSituation;
/**
* 户籍地址
*/
private String residenceAddr;
/**
* 业务来源
*/
private String businessSource;
/**
* 紧急联系人
*/
private String emergencyLinkman;
/**
* 紧急联系人关系
*/
private String emergencyLinkmanRelationship;
/**
* 紧急联系人电话
*/
private String emergencyLinkmanPhone;
}
Loading…
Cancel
Save