Commit ba7a8458 authored by liuzeheng's avatar liuzeheng

我的客户列表支持多选

parent f43a292e
......@@ -2,7 +2,9 @@ package cn.iocoder.yudao.module.customer.dal.mysql.customer;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
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.CustomerOrderQueryDTO;
import cn.iocoder.yudao.module.customer.dto.CustomerPageReqDTO;
import cn.iocoder.yudao.module.customer.vo.customer.vo.CustomerDetailRespVO;
import cn.iocoder.yudao.module.customer.vo.customer.vo.CustomerSelectReqVO;
import cn.iocoder.yudao.module.customer.vo.customerDetail.CustomerOrderBackPageVO;
......@@ -25,8 +27,14 @@ public interface CustomerMapper extends BaseMapperX<CustomerDO> {
IPage<CustomerDO> getPage(IPage<CustomerDO> page,
@Param(Constants.WRAPPER) Wrapper<CustomerDO> queryWrapper);
List<CustomerDO> getMyPage(@Param("start") int start, @Param("size") int size, @Param("query")CustomerPageReqDTO customerPageReqDTO);
long getMyPageCount( @Param("query") CustomerPageReqDTO pageReqVO);
List<CustomerDO> getCustomerExcelVoList(@Param(Constants.WRAPPER) Wrapper<CustomerDO> queryWrapper);
List<CustomerDO> getMyCustomerExcelVoList( @Param("query") CustomerExportReqDTO pageReqVO);
List<CustomerDO> getList(@Param(Constants.WRAPPER) Wrapper<CustomerDO> queryWrapper);
List<CustomerDO> searchCustomer(@Param("reqVO") CustomerSelectReqVO customerSelectReqVO);
......@@ -182,4 +190,5 @@ public interface CustomerMapper extends BaseMapperX<CustomerDO> {
List<CustomerOrderBackPageVO> orderList(@Param("start") int start, @Param("size") int size, @Param("query") CustomerOrderQueryDTO query);
}
package cn.iocoder.yudao.module.customer.dto;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Data
public class CustomerExportReqDTO {
@ApiModelProperty(value = "客户编号")
private String number;
@ApiModelProperty(value = "客户名称")
private String name;
@ApiModelProperty(value = "客户等级")
private List<Integer> level;
@ApiModelProperty(value = "客户来源")
private List<Integer> source;
@ApiModelProperty(value = "客户类别")
private List<String> type;
@ApiModelProperty(value = "客户货运类型", notes = "参见customer_transport_type数据字典")
private String transportType;
@ApiModelProperty(value = "客户资源类型", notes = "参见customer_resource_type数据字典")
private List<Integer> resourceType;
@ApiModelProperty(value = "跟进客服")
private Long customerService;
@ApiModelProperty(value = "客户状态")
private List<Integer> status;
@ApiModelProperty(value = "部门")
private String department;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始创建时间")
private Date beginCreateTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束创建时间")
private Date endCreateTime;
@ApiModelProperty(value = "主联系人")
private String defaultContactName;
@ApiModelProperty(value = "主联系电话")
private String defaultContactPhone;
@ApiModelProperty(value = "信用等级")
private List<Integer> creditLevel;
@ApiModelProperty(value = "国家")
private List<Integer> country;
@ApiModelProperty(value = "是否在公海")
private Boolean isInOpenSea;
@ApiModelProperty(value = "是否潜在客户")
private Boolean isPotential;
//api不显示此3个字段
//是否接收,后台使用
@JsonIgnore
private Boolean isCustomerServiceConfirmed;
//因接口公用方法新增:24小时内数据查询条件标识
private String flag4QueryCondition;
private List<Integer> marketType;
}
package cn.iocoder.yudao.module.customer.dto;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@ApiModel("管理后台 - 客户分页 Request DTO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class CustomerPageReqDTO extends PageParam {
@ApiModelProperty(value = "客户编号")
private String number;
@ApiModelProperty(value = "客户名称")
private String name;
@ApiModelProperty(value = "客户等级")
private List<Integer> level;
@ApiModelProperty(value = "客户来源")
private List<Integer> source;
@ApiModelProperty(value = "客户类别")
private List<String> type;
@ApiModelProperty(value = "客户货运类型", notes = "参见customer_transport_type数据字典")
private String transportType;
@ApiModelProperty(value = "客户资源类型", notes = "参见customer_resource_type数据字典")
private List<Integer> resourceType;
@ApiModelProperty(value = "市场获客", notes = "参见customer_market_type数据字典")
private List<Integer> marketType;
@ApiModelProperty(value = "跟进客服")
private Long customerService;
@ApiModelProperty(value = "客户状态")
private List<Integer> status;
@ApiModelProperty(value = "部门")
private String department;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始创建时间")
private Date beginCreateTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束创建时间")
private Date endCreateTime;
@ApiModelProperty(value = "主联系人")
private String defaultContactName;
@ApiModelProperty(value = "主联系电话")
private String defaultContactPhone;
@ApiModelProperty(value = "信用等级")
private List<Integer> creditLevel;
@ApiModelProperty(value = "国家")
private List<Integer> country;
//api不显示此3个字段
//是否接收,后台使用
@JsonIgnore
private Boolean isCustomerServiceConfirmed;
//因接口公用方法新增:24小时内数据查询条件标识
private String flag4QueryCondition;
@ApiModelProperty(value = "是否在公海")
private Boolean isInOpenSea;
@ApiModelProperty(value = "是否潜在客户")
private Boolean isPotential;
}
......@@ -2,10 +2,13 @@ package cn.iocoder.yudao.module.customer.service.customer;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO;
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.vo.customer.vo.*;
import cn.iocoder.yudao.module.ecw.enums.CustomerOperateTypeEnum;
import cn.iocoder.yudao.module.ecw.enums.CustomerStatusEnum;
......@@ -96,6 +99,8 @@ public interface CustomerService extends IService<CustomerDO> {
*/
PageResult<CustomerDO> getCustomerPage(CustomerPageReqVO pageReqVO);
PageResult<CustomerDO> getMyCustomerPage(CustomerPageReqDTO pageReqVO, PageVO page);
/**
* 获得部门客户分页
*
......@@ -170,6 +175,8 @@ public interface CustomerService extends IService<CustomerDO> {
*/
List<CustomerDO> getCustomerExcelVoList(CustomerExportReqVO exportReqVO);
List<CustomerDO> getMyCustomerExcelVoList(CustomerExportReqDTO exportReqVO);
/**
* 获得客户列表, 用于 Excel 导出
*
......
......@@ -25,6 +25,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
......@@ -47,10 +48,7 @@ import cn.iocoder.yudao.module.customer.dal.mysql.customerAirLog.CustomerAirLogM
import cn.iocoder.yudao.module.customer.dal.mysql.customerBank.CustomerBankMapper;
import cn.iocoder.yudao.module.customer.dal.mysql.customerContacts.CustomerContactsMapper;
import cn.iocoder.yudao.module.customer.dal.mysql.customerPublicCatchLog.CustomerPublicCatchLogMapper;
import cn.iocoder.yudao.module.customer.dto.CustomerDelayApprovalInfoDto;
import cn.iocoder.yudao.module.customer.dto.CustomerHandoverApprovalInfoDto;
import cn.iocoder.yudao.module.customer.dto.CustomerHandoverDetailDto;
import cn.iocoder.yudao.module.customer.dto.CustomerOrderQueryDTO;
import cn.iocoder.yudao.module.customer.dto.*;
import cn.iocoder.yudao.module.customer.service.customerApproval.CustomerApprovalService;
import cn.iocoder.yudao.module.customer.service.customerContacts.CustomerContactsService;
import cn.iocoder.yudao.module.customer.service.customerOperateLog.CustomerOperateLogService;
......@@ -1118,6 +1116,18 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
return new PageResult<>(mpPage.getRecords(), mpPage.getTotal());
}
@Override
public PageResult<CustomerDO> getMyCustomerPage(CustomerPageReqDTO pageReqVO, PageVO page) {
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.getMyPage(start,size,pageReqVO);
long total = customerMapper.getMyPageCount(pageReqVO) ;
return new PageResult<>(list, total, mpPage.getSize(), page.getPage(), (total + mpPage.getSize() - 1) / mpPage.getSize());
}
@Override
public PageResult<CustomerDO> getDeptCustomerPage(CustomerPageReqVO reqVO) {
IPage<CustomerDO> mpPage = MyBatisUtils.buildPage(reqVO);
......@@ -1572,6 +1582,11 @@ public class CustomerServiceImpl extends AbstractService<CustomerMapper, Custome
return customerMapper.getCustomerExcelVoList(customerDOLambdaQueryWrapperX);
}
@Override
public List<CustomerDO> getMyCustomerExcelVoList(CustomerExportReqDTO reqVO) {
return customerMapper.getMyCustomerExcelVoList(reqVO);
}
@Override
public PageResult<CustomerDO> searchCustomer(CustomerSelectReqVO customerSelectReqVO) {
......
......@@ -11,6 +11,7 @@ import cn.iocoder.yudao.framework.i18n.core.I18nMessage;
import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
import cn.iocoder.yudao.module.customer.convert.customer.CustomerConvert;
......@@ -21,6 +22,7 @@ import cn.iocoder.yudao.module.customer.dal.dataobject.customerBank.CustomerBank
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.CustomerHandoverApprovalInfoDto;
import cn.iocoder.yudao.module.customer.dto.CustomerPageReqDTO;
import cn.iocoder.yudao.module.customer.service.customer.CustomerService;
import cn.iocoder.yudao.module.customer.service.customer.commission.CustomerCommissionService;
import cn.iocoder.yudao.module.customer.service.customerBank.CustomerBankService;
......@@ -493,7 +495,7 @@ public class CustomerController {
@GetMapping("/get-mine")
@ApiOperation("获得我的客户列表")
// @PreAuthorize("@ss.hasPermission('ecw:customer:query')")
public CommonResult<PageResult<CustomerRespVO>> getMine(@Valid CustomerPageReqVO customerPageReqVO) {
public CommonResult<PageResult<CustomerRespVO>> getMine(@Valid CustomerPageReqDTO customerPageReqVO, PageVO page ) {
customerPageReqVO.setCustomerService(WebFrameworkUtils.getLoginUserId());
......@@ -502,7 +504,7 @@ public class CustomerController {
// customerPageReqVO.setFlag4QueryCondition("Y");
PageResult<CustomerDO> pageResult = customerService.getCustomerPage(customerPageReqVO);
PageResult<CustomerDO> pageResult = customerService.getMyCustomerPage(customerPageReqVO ,page);
return success(CustomerConvert.INSTANCE.convertPage(pageResult));
}
......
......@@ -195,6 +195,79 @@ public interface ProductMapper extends BaseMapperX<ProductDO> {
;
}
@ResultType(ProductDO.class)
@Select({
"<script>",
"select t.*, c.nickname as creator_name, u.nickname as updater_name ",
"from ecw_product t ",
"left join system_user c on t.creator = c.id ",
"left join system_user u on t.updater = u.id ",
"where t.deleted = 0 ",
"<when test = 'query.productCode != null and query.productCode != \"\"'>",
"AND t.`product_code` like concat('%',concat(#{query.productCode},'%'))",
"</when>",
"<when test = 'query.customsCode != null and query.customsCode != \"\"'>",
"AND t.`customs_code` like concat('%',concat(#{query.customsCode},'%'))",
"</when>",
/* "<when test = 'query.typeId != null'>",
"AND t.`type_id` = #{query.typeId}",
"</when>",*/
"<when test=\"query.typeId != null and query.typeId.size()>0\">" +
" <when test=\"query.typeId != null and query.typeId != '' and query.typeId.size()==1 \">" +
" AND t.`type_id` =\n" +
" <foreach item='typeId' index='index' collection='query.typeId' >\n" +
" #{typeId}" +
" </foreach>" +
" </when>" +
" <when test=\"query.typeId != null and query.typeId != '' and query.typeId.size()>1 \">" +
" AND t.`type_id` in " +
" <foreach item='typeId' index='index' collection='query.typeId' open='(' separator=',' close=')'>" +
" #{typeId}" +
" </foreach>" +
" </when>" +
"</when>",
"<when test = 'query.status != null'>",
"AND t.`status` = #{query.status}",
"</when>",
"<when test = 'query.auditStatus != null'>",
"AND t.`audit_status` = #{query.auditStatus}",
"</when>",
"<when test = 'query.titleZh != null and query.titleZh != \"\"'>",
"AND (t.`title_zh` like concat('%',concat(#{query.titleZh},'%')) or t.`title_en` like concat('%',concat(#{query.titleZh},'%')))",
"</when>",
// "<when test = 'query.attrId != null and query.attrId != \"\" '>",
"<when test=\"query.attrId != null and query.attrId.size()>0\">" ,
"<when test=\"query.attrId != null and query.attrId != '' and query.attrId.size()==1 \">" +
"<foreach item='attrId' index=\"index\" collection='query.attrId' >" +
"AND t.`attr_id` = #{attrId}" +
"</foreach>" +
"</when>",
"<when test=\"query.attrId != null and query.attrId != '' and query.attrId.size()>1 \">" +
"AND (1!=1 " +
" <foreach item='attrId' index='index' collection='query.attrId'>" +
" OR FIND_IN_SET(t.`attr_id`, #{attrId})"+
"</foreach>" +
" )" +
"</when>",
// "AND FIND_IN_SET(t.`attr_id`, #{query.attrId})",
"</when>",
"order by t.id desc",
"</script>"
})
List<ProductDO> selectListReq(@Param("query") ProductReqDTO reqVO) ;
default List<ProductDO> selectIdList(ProductPageReqVO reqVO) {
return selectList(new LambdaQueryWrapperX<ProductDO>()
.likeIfPresent(ProductDO::getProductCode, reqVO.getProductCode())
......@@ -240,6 +313,7 @@ public interface ProductMapper extends BaseMapperX<ProductDO> {
}
List<ProductTypeNumVO> getProductTypeNumList(List<Long> list);
......
......@@ -10,6 +10,7 @@ import cn.iocoder.yudao.module.product.convert.product.ProductConvert;
import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductAttrDO;
import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductDO;
import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductTypeDO;
import cn.iocoder.yudao.module.product.dto.ProductReqDTO;
import cn.iocoder.yudao.module.product.enums.AuditEnum;
import cn.iocoder.yudao.module.product.service.product.ProductAttrService;
import cn.iocoder.yudao.module.product.service.product.ProductService;
......@@ -81,10 +82,11 @@ public class ProductExcelExportListener {
}
String fileName = event.getUserId().toString().concat(StrUtil.DASHED).concat(event.getUserType().toString()).concat(StrUtil.DASHED).concat(nowTime).concat("product.xlsx");
ProductExportReqVO exportReqVO = JSONObject.parseObject(event.getRequestParams(), ProductExportReqVO.class);
//ProductExportReqVO exportReqVO = JSONObject.parseObject(event.getRequestParams(), ProductExportReqVO.class);
ProductReqDTO exportReqVO = JSONObject.parseObject(event.getRequestParams(), ProductReqDTO.class);
exportReqVO.setFilter(false);
List<ProductDO> list = productService.getProductList(exportReqVO);
//List<ProductDO> list = productService.getProductList(exportReqVO);
List<ProductDO> list = productService.getProductListResp(exportReqVO);
if(CollectionUtil.isEmpty(list)) return;
List<ProductAttrDO> attrList = productAttrService.getProductAttrList(new ProductAttrExportReqVO());
......
......@@ -70,6 +70,7 @@ public interface ProductService {
*/
List<ProductDO> getProductList();
/**
* 获得产品分页
*
......@@ -82,6 +83,7 @@ public interface ProductService {
List<ProductDO> getProductList(ProductPageReqVO pageReqVO);
List<ProductDO> getProductListResp(ProductReqDTO pageReqVO);
/**
* 获得产品列表, 用于 Excel 导出
*
......
......@@ -352,6 +352,8 @@ public class ProductServiceImpl implements ProductService {
);
}
@Override
public List<ProductDO> getProductList(List<Long> idList) {
return productMapper.selectList(
......@@ -427,6 +429,14 @@ public class ProductServiceImpl implements ProductService {
return productMapper.selectList(pageReqVO);
}
@Override
public List<ProductDO> getProductListResp(ProductReqDTO pageReqVO) {
if (pageReqVO.isFilter()) {
pageReqVO.setAuditStatus(2);
}
return productMapper.selectListReq(pageReqVO);
}
@Override
public List<ProductDO> getProductList(ProductExportReqVO exportReqVO) {
if (exportReqVO.isFilter()) {
......
......@@ -7,6 +7,7 @@ import cn.iocoder.yudao.framework.apollo.core.event.export.base.CustomerExportEv
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.service.customer.CustomerService;
import cn.iocoder.yudao.module.customer.service.indirectCustomer.IndirectCustomerService;
import cn.iocoder.yudao.module.customer.vo.customer.vo.CustomerExcelVO;
......@@ -67,8 +68,8 @@ public class CustomerExcelExportListener {
*/
@EventListener(CustomerMineExcelExportPushEvent.class)
public void customerMineExcelExportPushEvent(CustomerMineExcelExportPushEvent 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);
}
......
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