Commit 4529299b authored by liuzeheng's avatar liuzeheng

我的客户列表支持多选

parent bdef71b4
......@@ -29,6 +29,21 @@ public interface CustomerMapper extends BaseMapperX<CustomerDO> {
List<CustomerDO> getMyPage(@Param("start") int start, @Param("size") int size, @Param("query")CustomerPageReqDTO customerPageReqDTO);
List<CustomerDO> getWaitToAssignedCustomerPageReq(@Param("start") int start, @Param("size") int size, @Param("query")CustomerPageReqDTO customerPageReqDTO);
/**
* 分页列表统计total
* @param pageReqVO
* @return
*/
long getWaitToAssignedCustomerPageReqCount( @Param("query") CustomerPageReqDTO pageReqVO);
/**
* 待分配客户列表导出, 用于 Excel 导出 支持多筛选
* @param
* @return
*/
List<CustomerDO> getWaitToAssignedCustomerListReq( @Param("query")CustomerExportReqDTO customerPageReqDTO);
long getMyPageCount( @Param("query") CustomerPageReqDTO pageReqVO);
List<CustomerDO> getCustomerExcelVoList(@Param(Constants.WRAPPER) Wrapper<CustomerDO> queryWrapper);
......
......@@ -37,7 +37,7 @@ public class CustomerExportReqDTO {
private List<Integer> resourceType;
@ApiModelProperty(value = "跟进客服")
private Long customerService;
private List<Long> customerService;
@ApiModelProperty(value = "客户状态")
private List<Integer> status;
......
......@@ -46,7 +46,7 @@ public class CustomerPageReqDTO extends PageParam {
@ApiModelProperty(value = "跟进客服")
private Long customerService;
private List<Long> customerService;
@ApiModelProperty(value = "客户状态")
private List<Integer> status;
......
......@@ -99,6 +99,12 @@ public interface CustomerService extends IService<CustomerDO> {
*/
PageResult<CustomerDO> getCustomerPage(CustomerPageReqVO pageReqVO);
/**
* 获取我的客户分页 ,入参支持多选
* @param pageReqVO
* @param page
* @return
*/
PageResult<CustomerDO> getMyCustomerPage(CustomerPageReqDTO pageReqVO, PageVO page);
/**
......@@ -142,6 +148,12 @@ public interface CustomerService extends IService<CustomerDO> {
*/
PageResult<CustomerDO> getWaitToAssignedCustomerPage(CustomerPageReqVO pageReqVO);
/**
* 获得待分配客户分页 支持多选
* @param pageReqVO
* @return
*/
PageResult<CustomerDO> getWaitToAssignedCustomerPageReq(CustomerPageReqDTO pageReqVO,PageVO page);
/**
* 待分配客户列表导出, 用于 Excel 导出
......@@ -151,6 +163,12 @@ public interface CustomerService extends IService<CustomerDO> {
*/
List<CustomerDO> getWaitToAssignedCustomerExcelVoList(CustomerExportReqVO exportReqVO);
/**
* 待分配客户列表导出, 用于 Excel 导出 支持多筛选
* @param exportReqVO
* @return
*/
List<CustomerDO> getWaitToAssignedCustomerExcelVoListReq(CustomerExportReqDTO exportReqVO);
/**
* 获得公海池客户分页
*
......
......@@ -1286,6 +1286,26 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
return new PageResult<>(mpPage.getRecords(), mpPage.getTotal());
}
/**
* 获得待分配客户列表 支持多个筛选
* @param pageReqVO
* @param page
* @return
*/
@Override
public PageResult<CustomerDO> getWaitToAssignedCustomerPageReq(CustomerPageReqDTO pageReqVO,PageVO page) {
pageReqVO.setIsInOpenSea(false) ;
pageReqVO.setIsCustomerServiceConfirmed(false) ;
pageReqVO.setCustomerService(null) ;
IPage<CustomerDO> mpPage = MyBatisUtils.buildPage(page);
log.warn(I18nMessage.getLang().toString());
int start = (page.getPage() - 1) * page.getRows();
int size = page.getRows();
List<CustomerDO> list = customerMapper.getWaitToAssignedCustomerPageReq(start,size,pageReqVO);
long total = customerMapper.getWaitToAssignedCustomerPageReqCount(pageReqVO) ;
return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize());
}
@Override
public List<CustomerDO> getWaitToAssignedCustomerExcelVoList(CustomerExportReqVO exportReqVO) {
LambdaQueryWrapper<CustomerDO> customerDOLambdaQueryWrapperX = new LambdaQueryWrapperX<CustomerDO>()
......@@ -1333,6 +1353,10 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
return customerMapper.getCustomerExcelVoList(customerDOLambdaQueryWrapperX);
}
@Override
public List<CustomerDO> getWaitToAssignedCustomerExcelVoListReq(CustomerExportReqDTO exportReqVO) {
return customerMapper.getWaitToAssignedCustomerListReq(exportReqVO) ;
}
@Override
public PageResult<CustomerDO> getWaitToConfirmCustomerPage(CustomerPageReqVO pageReqVO) {
......
......@@ -21,6 +21,7 @@ import cn.iocoder.yudao.module.customer.dal.dataobject.customer.commission.Custo
import cn.iocoder.yudao.module.customer.dal.dataobject.customerBank.CustomerBankDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerContacts.CustomerContactsDO;
import cn.iocoder.yudao.module.customer.dto.CustomerDelayApprovalInfoDto;
import cn.iocoder.yudao.module.customer.dto.CustomerExportReqDTO;
import cn.iocoder.yudao.module.customer.dto.CustomerHandoverApprovalInfoDto;
import cn.iocoder.yudao.module.customer.dto.CustomerPageReqDTO;
import cn.iocoder.yudao.module.customer.service.customer.CustomerService;
......@@ -379,7 +380,7 @@ public class CustomerController {
@GetMapping("/get-potential")
@ApiOperation("获得潜在客户列表")
// @PreAuthorize("@ss.hasPermission('ecw:customer:query')")
public CommonResult<PageResult<CustomerRespVO>> getPotentialList(@Valid CustomerPageReqVO pageVO) {
public CommonResult<PageResult<CustomerRespVO>> getPotentialList(@Valid CustomerPageReqDTO pageVO,PageVO page) {
// 20230331 全部客户列表,当客户经理不是空时,排除公海客户
if (pageVO.getCustomerService() != null) {
......@@ -389,16 +390,17 @@ public class CustomerController {
//设置潜在客户标识
pageVO.setIsPotential(true);
PageResult<CustomerDO> pageResult = customerService.getCustomerPage(pageVO);
//PageResult<CustomerDO> pageResult = customerService.getCustomerPage(pageVO);
PageResult<CustomerDO> pageResult = customerService.getMyCustomerPage(pageVO,page);
return success(CustomerConvert.INSTANCE.convertPage(pageResult));
}
@GetMapping("/get-wait-for-distribution")
@ApiOperation("获得待分配客户列表")
// @PreAuthorize("@ss.hasPermission('ecw:customer:query')")
public CommonResult<PageResult<CustomerRespVO>> getWaitForDistributionList(@Valid CustomerPageReqVO customerPageReqVO) {
public CommonResult<PageResult<CustomerRespVO>> getWaitForDistributionList(@Valid CustomerPageReqDTO customerPageReqVO,PageVO page) {
PageResult<CustomerDO> pageResult = customerService.getWaitToAssignedCustomerPage(customerPageReqVO);
PageResult<CustomerDO> pageResult = customerService.getWaitToAssignedCustomerPageReq(customerPageReqVO,page);
return success(CustomerConvert.INSTANCE.convertPage(pageResult));
}
......@@ -497,7 +499,10 @@ public class CustomerController {
// @PreAuthorize("@ss.hasPermission('ecw:customer:query')")
public CommonResult<PageResult<CustomerRespVO>> getMine(@Valid CustomerPageReqDTO customerPageReqVO, PageVO page ) {
customerPageReqVO.setCustomerService(WebFrameworkUtils.getLoginUserId());
//customerPageReqVO.setCustomerService(WebFrameworkUtils.getLoginUserId());
List<Long> setCustomerService = new ArrayList<>();
setCustomerService.add(WebFrameworkUtils.getLoginUserId()) ;
customerPageReqVO.setCustomerService(setCustomerService) ;
//未被接收
customerPageReqVO.setIsCustomerServiceConfirmed(true);
......@@ -576,13 +581,14 @@ public class CustomerController {
@GetMapping("/page")
@ApiOperation("获得客户分页")
@PreAuthorize("@ss.hasPermission('ecw:customer:query')")
public CommonResult<PageResult<CustomerRespVO>> getCustomerPage(@Valid CustomerPageReqVO pageVO) {
public CommonResult<PageResult<CustomerRespVO>> getCustomerPage(@Valid CustomerPageReqDTO pageVO,PageVO page) {
// 20230331 全部客户列表,当客户经理不是空时,排除公海客户
if (pageVO.getCustomerService() != null) {
pageVO.setIsInOpenSea(false);
}
PageResult<CustomerDO> pageResult = customerService.getCustomerPage(pageVO);
//PageResult<CustomerDO> pageResult = customerService.getCustomerPage(pageVO);
PageResult<CustomerDO> pageResult = customerService.getMyCustomerPage(pageVO,page);
return success(CustomerConvert.INSTANCE.convertPage(pageResult));
}
......@@ -603,7 +609,30 @@ public class CustomerController {
return success(CustomerConvert.INSTANCE.convertPage(pageResult));
}
/**
* 支持多选
* @param exportReqVO
* @param downloadTypeEnum
* @param fileName
*/
private void sendFileMake(CustomerExportReqDTO exportReqVO, DownloadTypeEnum downloadTypeEnum, String fileName) {
FileMakeReqDTO reqDTO = new FileMakeReqDTO();
reqDTO.setType(downloadTypeEnum.getType());
reqDTO.setName(fileName);
reqDTO.setFileSuffix("xlsx");
reqDTO.setTemporaryFile(true);
reqDTO.setUserType(2);
reqDTO.setLang(I18nMessage.getLang());
reqDTO.setRequestParams(JSONObject.toJSONString(exportReqVO));
fileMakeApi.sendFileMake(reqDTO);
}
/**
* 单选
* @param exportReqVO
* @param downloadTypeEnum
* @param fileName
*/
private void sendFileMake(CustomerExportReqVO exportReqVO, DownloadTypeEnum downloadTypeEnum, String fileName) {
FileMakeReqDTO reqDTO = new FileMakeReqDTO();
reqDTO.setType(downloadTypeEnum.getType());
......@@ -619,7 +648,7 @@ public class CustomerController {
@GetMapping("/export-excel")
@ApiOperation("全部客户导出")
@OperateLog(type = EXPORT)
public CommonResult<Boolean> exportCustomerExcel(@Valid CustomerExportReqVO exportReqVO,
public CommonResult<Boolean> exportCustomerExcel(@Valid CustomerExportReqDTO exportReqVO,
HttpServletResponse response) throws IOException {
sendFileMake(exportReqVO, DownloadTypeEnum.CUSTOMER_EXCEL_EXPORT, "客户导出Excel");
return success(true);
......@@ -628,13 +657,16 @@ public class CustomerController {
@GetMapping("/mine-export-excel")
@ApiOperation("我的客户列表导出")
@OperateLog(type = EXPORT)
public CommonResult<Boolean> exportMyCustomerExcel(@Valid CustomerExportReqVO exportReqVO,
public CommonResult<Boolean> exportMyCustomerExcel(@Valid CustomerExportReqDTO exportReqVO,
HttpServletResponse response) throws IOException {
exportReqVO.setCustomerService(WebFrameworkUtils.getLoginUserId());
//exportReqVO.setCustomerService(WebFrameworkUtils.getLoginUserId());
//未被接收
exportReqVO.setIsCustomerServiceConfirmed(true);
// customerPageReqVO.setFlag4QueryCondition("Y");
List<Long> setCustomerService = new ArrayList<>();
setCustomerService.add(WebFrameworkUtils.getLoginUserId()) ;
exportReqVO.setCustomerService(setCustomerService) ;
sendFileMake(exportReqVO, DownloadTypeEnum.CUSTOMER_MINE_EXCEL_EXPORT, "我的客户导出Excel");
return success(true);
......@@ -663,7 +695,7 @@ public class CustomerController {
@GetMapping("/wait-distribution-export-excel")
@ApiOperation("待分配客户列表导出")
@OperateLog(type = EXPORT)
public CommonResult<Boolean> exportWaitDistributionCustomerExcel(@Valid CustomerExportReqVO exportReqVO,
public CommonResult<Boolean> exportWaitDistributionCustomerExcel(@Valid CustomerExportReqDTO exportReqVO,
HttpServletResponse response) throws IOException {
sendFileMake(exportReqVO, DownloadTypeEnum.CUSTOMER_WAIT_DISTRIBUTION_PUBLIC_EXCEL_EXPORT, "待分配客户导出Excel");
return success(true);
......@@ -672,9 +704,9 @@ public class CustomerController {
@GetMapping("/potential-export-excel")
@ApiOperation("潜在客户列表导出")
@OperateLog(type = EXPORT)
public CommonResult<Boolean> exportPotentialCustomerExcel(@Valid CustomerExportReqVO exportReqVO,
public CommonResult<Boolean> exportPotentialCustomerExcel(@Valid CustomerExportReqDTO exportReqVO,
HttpServletResponse response) throws IOException {
if (exportReqVO.getCustomerService() != null) {
if (CollectionUtil.isNotEmpty(exportReqVO.getCustomerService()) ) {
exportReqVO.setIsInOpenSea(false);
}
//设置潜在客户标识
......
......@@ -912,58 +912,62 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
order.setCustomerId(orderConsignorDO.getCustomerId());
} else {
// 非控货订单 + 付款人为发货人 归属发货人, 其他归属收货人
if (order.getDrawee() == 1) {
order.setCustomerId(orderConsignorDO.getCustomerId());
} else {
customerType = 2;
order.setCustomerId(orderConsigneeDO.getCustomerId());
}
}
// if (order.getDrawee() == 1) {
// order.setCustomerId(orderConsignorDO.getCustomerId());
// } else {
// customerType = 2;
// order.setCustomerId(orderConsigneeDO.getCustomerId());
// }
// 补充业绩规则判断
if (!consignorDO.getNoConsignee() && !order.getHasConsignee()) {//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
order.setCustomerId(orderConsignorDO.getCustomerId());
}
if (order.getDrawee() == 1) {//发货人付款
if (order.getDrawee() == 1 && createReqVO.getOfferId() != null) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
order.setCustomerId(orderConsignorDO.getCustomerId());
} else if (order.getDrawee() == 1 && consignorDO.getDefaultPay()) {// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
// 补充业绩规则判断
if (!consignorDO.getNoConsignee() && !order.getHasConsignee()) {//发货人档案设置控货无收货人且订单无收获人,归属发货人业绩 -- 层级2
order.setCustomerId(orderConsignorDO.getCustomerId());
}
} else if (order.getDrawee() == 2) {//收货人付款 层级5 第一个
order.setCustomerId(orderConsigneeDO.getCustomerId());
} else if (order.getDrawee() == 3) { //自定义付款
List<CustomDraweeVO> list = JSONObject.parseArray(order.getCustomDrawee(), CustomDraweeVO.class);
if (CollectionUtil.isNotEmpty(list)) {
}else{
if (order.getDrawee() == 1) {//发货人付款
if (order.getDrawee() == 1 && createReqVO.getOfferId() != null) {//如果是发货人付款且关联报价单,业绩归属发货人 --层级3 第一个
order.setCustomerId(orderConsignorDO.getCustomerId());
} else if (order.getDrawee() == 1 && consignorDO.getDefaultPay()) {// 如果是发货人付款且档案设置默认付运费 --层级4 第一个
order.setCustomerId(orderConsignorDO.getCustomerId());
}
} else if (order.getDrawee() == 2) {//收货人付款 层级5 第一个
order.setCustomerId(orderConsigneeDO.getCustomerId());
} else if (order.getDrawee() == 3) { //自定义付款
List<CustomDraweeVO> list = JSONObject.parseArray(order.getCustomDrawee(), CustomDraweeVO.class);
if (CollectionUtil.isNotEmpty(list)) {
List<CustomDraweeVO> freightList = list.stream().filter(s -> s.getName().equals("freight")).collect(Collectors.toList());
List<CustomDraweeVO> clearanceFeeList = list.stream().filter(s -> s.getName().equals("clearanceFee")).collect(Collectors.toList());
int freight = freightList.get(0).getValue();//运费
int clearanceFee = clearanceFeeList.get(0).getValue();//清关费
if (createReqVO.getOfferId() != null && (order.getDrawee() == 3 && freight == 1)) {//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
order.setCustomerId(orderConsignorDO.getCustomerId());
} else if (createReqVO.getOfferId() != null && (order.getDrawee() == 3 && clearanceFee == 1)) {//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
order.setCustomerId(orderConsignorDO.getCustomerId());
} else if (consignorDO.getDefaultPay() && (order.getDrawee() == 3 && freight == 1)) { //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
} else if (consignorDO.getDefaultPay() && (order.getDrawee() == 3 && clearanceFee == 1)) {// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
} else if (!consignorDO.getDefaultPay() && (order.getDrawee() == 3 && freight == 2) || (order.getDrawee() == 3 && clearanceFee == 2)) {//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
order.setCustomerId(orderConsigneeDO.getCustomerId());
order.setSalesmanId(orderConsigneeDO.getCustomerId());
List<CustomDraweeVO> freightList = list.stream().filter(s -> s.getName().equals("freight")).collect(Collectors.toList());
List<CustomDraweeVO> clearanceFeeList = list.stream().filter(s -> s.getName().equals("clearanceFee")).collect(Collectors.toList());
int freight = freightList.get(0).getValue();//运费
int clearanceFee = clearanceFeeList.get(0).getValue();//清关费
}
if (createReqVO.getOfferId() != null && (order.getDrawee() == 3 && freight == 1)) {//层级3 第二个 订单关联报价单 && 自定义付款 且发货人付运费
order.setCustomerId(orderConsignorDO.getCustomerId());
} else if (createReqVO.getOfferId() != null && (order.getDrawee() == 3 && clearanceFee == 1)) {//层级3 第三个 订单关联报价单 && 自定义付款 且发货人付清关费
order.setCustomerId(orderConsignorDO.getCustomerId());
} else if (consignorDO.getDefaultPay() && (order.getDrawee() == 3 && freight == 1)) { //层级4 第二个 发货人档案设置默认付运费 且发货人付运费 业绩归属 发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
} else if (consignorDO.getDefaultPay() && (order.getDrawee() == 3 && clearanceFee == 1)) {// 层级4 第三个 发货人档案设置默认付运费 且发货人付清关费 业绩归属发货人
order.setCustomerId(orderConsignorDO.getCustomerId());
} else if (!consignorDO.getDefaultPay() && (order.getDrawee() == 3 && freight == 2) || (order.getDrawee() == 3 && clearanceFee == 2)) {//层级5 第二、第三点 自定义付款且收款人付运费 或自定义付款且收款人付清关费 ,业绩归属收货人
order.setCustomerId(orderConsigneeDO.getCustomerId());
order.setSalesmanId(orderConsigneeDO.getCustomerId());
}
} else {
//业绩归属公司
order.setCustomerId(0L);
order.setSalesmanId(0L);
}
}
} else {
//业绩归属公司
order.setCustomerId(0L);
order.setSalesmanId(0L);
//end
}
//end
// if(createReqVO.getOfferId()!=null && order.getDrawee()==1){//订单关联报价单 && 发货人付款
......
......@@ -8,6 +8,7 @@ import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.module.customer.convert.customer.CustomerConvert;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO;
import cn.iocoder.yudao.module.customer.dto.CustomerExportReqDTO;
import cn.iocoder.yudao.module.customer.dto.CustomerPageReqDTO;
import cn.iocoder.yudao.module.customer.service.customer.CustomerService;
import cn.iocoder.yudao.module.customer.service.indirectCustomer.IndirectCustomerService;
import cn.iocoder.yudao.module.customer.vo.customer.vo.CustomerExcelVO;
......@@ -56,8 +57,8 @@ public class CustomerExcelExportListener {
@EventListener(CustomerExcelExportPushEvent.class)
public void customerExcelExportPushEvent(CustomerExcelExportPushEvent event) {
CustomerExportReqVO exportReqVO = JSONObject.parseObject(event.getRequestParams(), CustomerExportReqVO.class);
List<CustomerDO> list = customerService.getCustomerExcelVoList(exportReqVO);
CustomerExportReqDTO exportReqVO = JSONObject.parseObject(event.getRequestParams(), CustomerExportReqDTO.class);
List<CustomerDO> list = customerService.getMyCustomerExcelVoList(exportReqVO);
makeExcelUpload(event, list);
}
......@@ -108,8 +109,11 @@ public class CustomerExcelExportListener {
*/
@EventListener(CustomerWaitDistributionExcelExportPushEvent.class)
public void customerWaitDistributionExcelExportPushEvent(CustomerWaitDistributionExcelExportPushEvent event) {
CustomerExportReqVO exportReqVO = JSONObject.parseObject(event.getRequestParams(), CustomerExportReqVO.class);
List<CustomerDO> list = customerService.getWaitToAssignedCustomerExcelVoList(exportReqVO);
CustomerExportReqDTO exportReqVO = JSONObject.parseObject(event.getRequestParams(), CustomerExportReqDTO.class);
exportReqVO.setIsInOpenSea(false) ;
exportReqVO.setIsCustomerServiceConfirmed(false) ;
exportReqVO.setCustomerService(null) ;
List<CustomerDO> list = customerService.getWaitToAssignedCustomerExcelVoListReq(exportReqVO);
makeExcelUpload(event, list);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment