mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2025-02-23 04:30:34 +08:00
crm联系人第二版新增字段
This commit is contained in:
parent
8efdf3141a
commit
7598ed05cf
@ -1,32 +1,43 @@
|
|||||||
package cn.iocoder.yudao.module.crm.controller.admin.contact;
|
package cn.iocoder.yudao.module.crm.controller.admin.contact;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerExportReqVO;
|
||||||
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.*;
|
import cn.iocoder.yudao.module.crm.service.customer.CrmCustomerService;
|
||||||
import cn.iocoder.yudao.module.crm.convert.contact.ContactConvert;
|
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||||
import cn.iocoder.yudao.module.crm.dal.dataobject.contact.ContactDO;
|
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||||
import cn.iocoder.yudao.module.crm.service.contact.ContactService;
|
import com.google.common.collect.Lists;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import javax.validation.Valid;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
|
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import javax.servlet.http.*;
|
||||||
|
import java.util.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
import java.util.stream.Collectors;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||||
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
|
|
||||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
|
||||||
|
|
||||||
@Tag(name = "管理后台 - CRM 联系人")
|
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
|
||||||
|
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.crm.dal.dataobject.contact.ContactDO;
|
||||||
|
import cn.iocoder.yudao.module.crm.convert.contact.ContactConvert;
|
||||||
|
import cn.iocoder.yudao.module.crm.service.contact.ContactService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - crm联系人")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/crm/contact")
|
@RequestMapping("/crm/contact")
|
||||||
@Validated
|
@Validated
|
||||||
@ -34,12 +45,16 @@ public class ContactController {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private ContactService contactService;
|
private ContactService contactService;
|
||||||
|
@Resource
|
||||||
|
private AdminUserApi adminUserApi;
|
||||||
|
@Resource
|
||||||
|
private CrmCustomerService crmCustomerService;
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
@Operation(summary = "创建crm联系人")
|
@Operation(summary = "创建crm联系人")
|
||||||
@PreAuthorize("@ss.hasPermission('crm:contact:create')")
|
@PreAuthorize("@ss.hasPermission('crm:contact:create')")
|
||||||
public CommonResult<Long> createContact(@Valid @RequestBody ContactCreateReqVO createReqVO) {
|
public CommonResult<Long> createContact(@Valid @RequestBody ContactCreateReqVO createReqVO) {
|
||||||
return success(contactService.createContact(createReqVO, getLoginUserId()));
|
return success(contactService.createContact(createReqVO));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/update")
|
@PutMapping("/update")
|
||||||
@ -65,7 +80,12 @@ public class ContactController {
|
|||||||
@PreAuthorize("@ss.hasPermission('crm:contact:query')")
|
@PreAuthorize("@ss.hasPermission('crm:contact:query')")
|
||||||
public CommonResult<ContactRespVO> getContact(@RequestParam("id") Long id) {
|
public CommonResult<ContactRespVO> getContact(@RequestParam("id") Long id) {
|
||||||
ContactDO contact = contactService.getContact(id);
|
ContactDO contact = contactService.getContact(id);
|
||||||
return success(ContactConvert.INSTANCE.convert(contact));
|
ContactRespVO contactRespVO = ContactConvert.INSTANCE.convert(contact);
|
||||||
|
Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(CollUtil.removeNull(Lists.newArrayList(
|
||||||
|
NumberUtil.parseLong(contact.getCreator()))));
|
||||||
|
contactRespVO.setCreatorName(Optional.ofNullable(userMap.get(NumberUtil.parseLong(contact.getCreator()))).map(AdminUserRespDTO::getNickname).orElse(null));
|
||||||
|
contactRespVO.setCustomerName(Optional.ofNullable(crmCustomerService.getCustomer(contact.getCustomerId())).map(CrmCustomerDO::getName).orElse(null));
|
||||||
|
return success(contactRespVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@ -76,13 +96,26 @@ public class ContactController {
|
|||||||
List<ContactDO> list = contactService.getContactList(ids);
|
List<ContactDO> list = contactService.getContactList(ids);
|
||||||
return success(ContactConvert.INSTANCE.convertList(list));
|
return success(ContactConvert.INSTANCE.convertList(list));
|
||||||
}
|
}
|
||||||
|
@GetMapping("/simpleAlllist")
|
||||||
|
@Operation(summary = "获得crm联系人列表")
|
||||||
|
@PreAuthorize("@ss.hasPermission('crm:contact:query')")
|
||||||
|
public CommonResult<List<ContactSimpleRespVO>> simpleAlllist() {
|
||||||
|
List<ContactDO> list = contactService.allContactList();
|
||||||
|
return success(ContactConvert.INSTANCE.convertAllList(list));
|
||||||
|
}
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得crm联系人分页")
|
@Operation(summary = "获得crm联系人分页")
|
||||||
@PreAuthorize("@ss.hasPermission('crm:contact:query')")
|
@PreAuthorize("@ss.hasPermission('crm:contact:query')")
|
||||||
public CommonResult<PageResult<ContactRespVO>> getContactPage(@Valid ContactPageReqVO pageVO) {
|
public CommonResult<PageResult<ContactRespVO>> getContactPage(@Valid ContactPageReqVO pageVO) {
|
||||||
PageResult<ContactDO> pageResult = contactService.getContactPage(pageVO);
|
PageResult<ContactDO> pageData = contactService.getContactPage(pageVO);
|
||||||
return success(ContactConvert.INSTANCE.convertPage(pageResult));
|
PageResult<ContactRespVO> pageResult =ContactConvert.INSTANCE.convertPage(pageData);
|
||||||
|
//待接口实现后修改
|
||||||
|
List<CrmCustomerDO> crmCustomerDOList = crmCustomerService.getCustomerList(new CrmCustomerExportReqVO());
|
||||||
|
Map<Long,CrmCustomerDO> crmCustomerDOMap = crmCustomerDOList.stream().collect(Collectors.toMap(CrmCustomerDO::getId,v->v));
|
||||||
|
pageResult.getList().forEach(item -> {
|
||||||
|
item.setCustomerName(Optional.ofNullable(crmCustomerDOMap.get(item.getCustomerId())).map(CrmCustomerDO::getName).orElse(null));
|
||||||
|
});
|
||||||
|
return success(pageResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/export-excel")
|
@GetMapping("/export-excel")
|
||||||
@ -97,12 +130,4 @@ public class ContactController {
|
|||||||
ExcelUtils.write(response, "crm联系人.xls", "数据", ContactExcelVO.class, datas);
|
ExcelUtils.write(response, "crm联系人.xls", "数据", ContactExcelVO.class, datas);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/transfer")
|
|
||||||
@Operation(summary = "联系人转移")
|
|
||||||
@PreAuthorize("@ss.hasPermission('crm:contact:update')")
|
|
||||||
public CommonResult<Boolean> transfer(@Valid @RequestBody CrmContactTransferReqVO reqVO) {
|
|
||||||
contactService.transferContact(reqVO, getLoginUserId());
|
|
||||||
return success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,17 @@
|
|||||||
package cn.iocoder.yudao.module.crm.controller.admin.contact.vo;
|
package cn.iocoder.yudao.module.crm.controller.admin.contact.vo;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -16,31 +21,19 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
|
|||||||
@Data
|
@Data
|
||||||
public class ContactBaseVO {
|
public class ContactBaseVO {
|
||||||
|
|
||||||
// TODO @zyna:部分字段,缺少 example,需要补充;
|
|
||||||
|
|
||||||
@Schema(description = "联系人名称", example = "张三")
|
|
||||||
@NotNull(message = "姓名不能为空")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Schema(description = "下次联系时间")
|
@Schema(description = "下次联系时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
|
||||||
private LocalDateTime nextTime;
|
private LocalDateTime nextTime;
|
||||||
|
|
||||||
// TODO @zyna:缺少 validator 的校验
|
|
||||||
@Schema(description = "手机号")
|
@Schema(description = "手机号")
|
||||||
private String mobile;
|
private String mobile;
|
||||||
|
|
||||||
// TODO @zyna:缺少 validator 的校验
|
|
||||||
@Schema(description = "电话")
|
@Schema(description = "电话")
|
||||||
private String telephone;
|
private String telephone;
|
||||||
|
|
||||||
// TODO @zyna:缺少 validator 的校验
|
|
||||||
@Schema(description = "电子邮箱")
|
@Schema(description = "电子邮箱")
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
@Schema(description = "职务")
|
|
||||||
private String post;
|
|
||||||
|
|
||||||
// TODO @zyna:非空校验
|
|
||||||
@Schema(description = "客户编号", example = "10795")
|
@Schema(description = "客户编号", example = "10795")
|
||||||
private Long customerId;
|
private Long customerId;
|
||||||
|
|
||||||
@ -50,12 +43,32 @@ public class ContactBaseVO {
|
|||||||
@Schema(description = "备注", example = "你说的对")
|
@Schema(description = "备注", example = "你说的对")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
// TODO @zyna:这个新建的时候,应该不会传递;而是后端默认设置自己为负责人;
|
|
||||||
@Schema(description = "负责人用户编号", example = "7648")
|
|
||||||
private Long ownerUserId;
|
|
||||||
|
|
||||||
@Schema(description = "最后跟进时间")
|
@Schema(description = "最后跟进时间")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
private LocalDateTime lastTime;
|
private LocalDateTime lastTime;
|
||||||
|
|
||||||
|
@Schema(description = "直属上级", example = "23457")
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
@Schema(description = "姓名", example = "芋艿")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "职位")
|
||||||
|
private String post;
|
||||||
|
|
||||||
|
@Schema(description = "QQ")
|
||||||
|
private Long qq;
|
||||||
|
|
||||||
|
@Schema(description = "微信")
|
||||||
|
private String webchat;
|
||||||
|
|
||||||
|
@Schema(description = "性别")
|
||||||
|
private Integer sex;
|
||||||
|
|
||||||
|
@Schema(description = "是否关键决策人")
|
||||||
|
private Boolean policyMakers;
|
||||||
|
|
||||||
|
@Schema(description = "负责人用户编号", example = "14334")
|
||||||
|
private String ownerUserId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
package cn.iocoder.yudao.module.crm.controller.admin.contact.vo;
|
package cn.iocoder.yudao.module.crm.controller.admin.contact.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import javax.validation.constraints.*;
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.ToString;
|
|
||||||
|
|
||||||
@Schema(description = "管理后台 - CRM 联系人创建 Request VO")
|
@Schema(description = "管理后台 - crm联系人创建 Request VO")
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
|
@ -2,6 +2,8 @@ package cn.iocoder.yudao.module.crm.controller.admin.contact.vo;
|
|||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@ -17,12 +19,6 @@ import com.alibaba.excel.annotation.ExcelProperty;
|
|||||||
@Data
|
@Data
|
||||||
public class ContactExcelVO {
|
public class ContactExcelVO {
|
||||||
|
|
||||||
@ExcelProperty("主键")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@ExcelProperty("联系人名称")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@ExcelProperty("下次联系时间")
|
@ExcelProperty("下次联系时间")
|
||||||
private LocalDateTime nextTime;
|
private LocalDateTime nextTime;
|
||||||
|
|
||||||
@ -35,9 +31,6 @@ public class ContactExcelVO {
|
|||||||
@ExcelProperty("电子邮箱")
|
@ExcelProperty("电子邮箱")
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
@ExcelProperty("职务")
|
|
||||||
private String post;
|
|
||||||
|
|
||||||
@ExcelProperty("客户编号")
|
@ExcelProperty("客户编号")
|
||||||
private Long customerId;
|
private Long customerId;
|
||||||
|
|
||||||
@ -47,13 +40,37 @@ public class ContactExcelVO {
|
|||||||
@ExcelProperty("备注")
|
@ExcelProperty("备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
@ExcelProperty("负责人用户编号")
|
|
||||||
private Long ownerUserId;
|
|
||||||
|
|
||||||
@ExcelProperty("创建时间")
|
@ExcelProperty("创建时间")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
@ExcelProperty("最后跟进时间")
|
@ExcelProperty("最后跟进时间")
|
||||||
private LocalDateTime lastTime;
|
private LocalDateTime lastTime;
|
||||||
|
|
||||||
|
@ExcelProperty("主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@ExcelProperty("直属上级")
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
@ExcelProperty("姓名")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ExcelProperty("职位")
|
||||||
|
private String post;
|
||||||
|
|
||||||
|
@ExcelProperty("QQ")
|
||||||
|
private Long qq;
|
||||||
|
|
||||||
|
@ExcelProperty("微信")
|
||||||
|
private String webchat;
|
||||||
|
|
||||||
|
@ExcelProperty("性别")
|
||||||
|
private Integer sex;
|
||||||
|
|
||||||
|
@ExcelProperty("是否关键决策人")
|
||||||
|
private Boolean policyMakers;
|
||||||
|
|
||||||
|
@ExcelProperty("负责人用户编号")
|
||||||
|
private String ownerUserId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package cn.iocoder.yudao.module.crm.controller.admin.contact.vo;
|
package cn.iocoder.yudao.module.crm.controller.admin.contact.vo;
|
||||||
|
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
@ -9,13 +11,10 @@ import org.springframework.format.annotation.DateTimeFormat;
|
|||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - CRM 联系人 Excel 导出 Request VO,参数和 ContactPageReqVO 是一致的")
|
@Schema(description = "管理后台 - crm联系人 Excel 导出 Request VO,参数和 ContactPageReqVO 是一致的")
|
||||||
@Data
|
@Data
|
||||||
public class ContactExportReqVO {
|
public class ContactExportReqVO {
|
||||||
|
|
||||||
@Schema(description = "联系人名称", example = "张三")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Schema(description = "下次联系时间")
|
@Schema(description = "下次联系时间")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
private LocalDateTime[] nextTime;
|
private LocalDateTime[] nextTime;
|
||||||
@ -29,9 +28,6 @@ public class ContactExportReqVO {
|
|||||||
@Schema(description = "电子邮箱")
|
@Schema(description = "电子邮箱")
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
@Schema(description = "职务")
|
|
||||||
private String post;
|
|
||||||
|
|
||||||
@Schema(description = "客户编号", example = "10795")
|
@Schema(description = "客户编号", example = "10795")
|
||||||
private Long customerId;
|
private Long customerId;
|
||||||
|
|
||||||
@ -41,9 +37,6 @@ public class ContactExportReqVO {
|
|||||||
@Schema(description = "备注", example = "你说的对")
|
@Schema(description = "备注", example = "你说的对")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
@Schema(description = "负责人用户编号", example = "7648")
|
|
||||||
private Long ownerUserId;
|
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
private LocalDateTime[] createTime;
|
private LocalDateTime[] createTime;
|
||||||
@ -52,4 +45,28 @@ public class ContactExportReqVO {
|
|||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
private LocalDateTime[] lastTime;
|
private LocalDateTime[] lastTime;
|
||||||
|
|
||||||
|
@Schema(description = "直属上级", example = "23457")
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
@Schema(description = "姓名", example = "芋艿")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "职位")
|
||||||
|
private String post;
|
||||||
|
|
||||||
|
@Schema(description = "QQ")
|
||||||
|
private Long qq;
|
||||||
|
|
||||||
|
@Schema(description = "微信")
|
||||||
|
private String webchat;
|
||||||
|
|
||||||
|
@Schema(description = "性别")
|
||||||
|
private Integer sex;
|
||||||
|
|
||||||
|
@Schema(description = "是否关键决策人")
|
||||||
|
private Boolean policyMakers;
|
||||||
|
|
||||||
|
@Schema(description = "负责人用户编号", example = "14334")
|
||||||
|
private String ownerUserId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,27 +1,22 @@
|
|||||||
package cn.iocoder.yudao.module.crm.controller.admin.contact.vo;
|
package cn.iocoder.yudao.module.crm.controller.admin.contact.vo;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
import lombok.*;
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.EqualsAndHashCode;
|
|
||||||
import lombok.ToString;
|
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - CRM 联系人分页 Request VO")
|
@Schema(description = "管理后台 - crm联系人分页 Request VO")
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
public class ContactPageReqVO extends PageParam {
|
public class ContactPageReqVO extends PageParam {
|
||||||
|
|
||||||
// TODO @芋艿:需要查询的字段;
|
|
||||||
|
|
||||||
@Schema(description = "联系人名称", example = "张三")
|
|
||||||
private String name;
|
|
||||||
|
|
||||||
@Schema(description = "下次联系时间")
|
@Schema(description = "下次联系时间")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
private LocalDateTime[] nextTime;
|
private LocalDateTime[] nextTime;
|
||||||
@ -35,9 +30,6 @@ public class ContactPageReqVO extends PageParam {
|
|||||||
@Schema(description = "电子邮箱")
|
@Schema(description = "电子邮箱")
|
||||||
private String email;
|
private String email;
|
||||||
|
|
||||||
@Schema(description = "职务")
|
|
||||||
private String post;
|
|
||||||
|
|
||||||
@Schema(description = "客户编号", example = "10795")
|
@Schema(description = "客户编号", example = "10795")
|
||||||
private Long customerId;
|
private Long customerId;
|
||||||
|
|
||||||
@ -47,9 +39,6 @@ public class ContactPageReqVO extends PageParam {
|
|||||||
@Schema(description = "备注", example = "你说的对")
|
@Schema(description = "备注", example = "你说的对")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
@Schema(description = "负责人用户编号", example = "7648")
|
|
||||||
private Long ownerUserId;
|
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
private LocalDateTime[] createTime;
|
private LocalDateTime[] createTime;
|
||||||
@ -58,4 +47,28 @@ public class ContactPageReqVO extends PageParam {
|
|||||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
private LocalDateTime[] lastTime;
|
private LocalDateTime[] lastTime;
|
||||||
|
|
||||||
|
@Schema(description = "直属上级", example = "23457")
|
||||||
|
private Long parentId;
|
||||||
|
|
||||||
|
@Schema(description = "姓名", example = "芋艿")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "职位")
|
||||||
|
private String post;
|
||||||
|
|
||||||
|
@Schema(description = "QQ")
|
||||||
|
private Long qq;
|
||||||
|
|
||||||
|
@Schema(description = "微信")
|
||||||
|
private String webchat;
|
||||||
|
|
||||||
|
@Schema(description = "性别")
|
||||||
|
private Integer sex;
|
||||||
|
|
||||||
|
@Schema(description = "是否关键决策人")
|
||||||
|
private Boolean policyMakers;
|
||||||
|
|
||||||
|
@Schema(description = "负责人用户编号", example = "14334")
|
||||||
|
private String ownerUserId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,17 +4,19 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
|||||||
import lombok.*;
|
import lombok.*;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - CRM 联系人 Response VO")
|
@Schema(description = "管理后台 - crm联系人 Response VO")
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
public class ContactRespVO extends ContactBaseVO {
|
public class ContactRespVO extends ContactBaseVO {
|
||||||
|
|
||||||
@Schema(description = "主键", example = "23210")
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
@Schema(description = "创建时间")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
@Schema(description = "创建人")
|
@Schema(description = "创建人")
|
||||||
private String creator;
|
private String creatorName;
|
||||||
|
@Schema(description = "客户")
|
||||||
|
private String customerName;
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "3167")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
package cn.iocoder.yudao.module.crm.controller.admin.contact.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.ToString;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - crm联系人 Response VO")
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
public class ContactSimpleRespVO {
|
||||||
|
@Schema(description = "姓名", example = "芋艿")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "3167")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
}
|
@ -1,17 +1,18 @@
|
|||||||
package cn.iocoder.yudao.module.crm.controller.admin.contact.vo;
|
package cn.iocoder.yudao.module.crm.controller.admin.contact.vo;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.*;
|
||||||
import lombok.EqualsAndHashCode;
|
import java.util.*;
|
||||||
import lombok.ToString;
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
@Schema(description = "管理后台 - CRM 联系人更新 Request VO")
|
@Schema(description = "管理后台 - crm联系人更新 Request VO")
|
||||||
@Data
|
@Data
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
public class ContactUpdateReqVO extends ContactBaseVO {
|
public class ContactUpdateReqVO extends ContactBaseVO {
|
||||||
|
|
||||||
@Schema(description = "主键", example = "23210")
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "3167")
|
||||||
|
@NotNull(message = "主键不能为空")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,16 @@
|
|||||||
package cn.iocoder.yudao.module.crm.convert.contact;
|
package cn.iocoder.yudao.module.crm.convert.contact;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
|
||||||
|
import org.mapstruct.Mapper;
|
||||||
|
import org.mapstruct.factory.Mappers;
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.*;
|
import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.*;
|
||||||
import cn.iocoder.yudao.module.crm.dal.dataobject.contact.ContactDO;
|
import cn.iocoder.yudao.module.crm.dal.dataobject.contact.ContactDO;
|
||||||
import cn.iocoder.yudao.module.crm.service.permission.bo.CrmTransferPermissionReqBO;
|
|
||||||
import org.mapstruct.Mapper;
|
|
||||||
import org.mapstruct.Mapping;
|
|
||||||
import org.mapstruct.Mappings;
|
|
||||||
import org.mapstruct.factory.Mappers;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* crm 联系人 Convert
|
* crm联系人 Convert
|
||||||
*
|
*
|
||||||
* @author 芋道源码
|
* @author 芋道源码
|
||||||
*/
|
*/
|
||||||
@ -32,11 +30,6 @@ public interface ContactConvert {
|
|||||||
PageResult<ContactRespVO> convertPage(PageResult<ContactDO> page);
|
PageResult<ContactRespVO> convertPage(PageResult<ContactDO> page);
|
||||||
|
|
||||||
List<ContactExcelVO> convertList02(List<ContactDO> list);
|
List<ContactExcelVO> convertList02(List<ContactDO> list);
|
||||||
|
List<ContactSimpleRespVO> convertAllList(List<ContactDO> list);
|
||||||
@Mappings({
|
|
||||||
@Mapping(target = "bizId", source = "reqVO.id"),
|
|
||||||
@Mapping(target = "newOwnerUserId", source = "reqVO.id")
|
|
||||||
})
|
|
||||||
CrmTransferPermissionReqBO convert(CrmContactTransferReqVO reqVO, Long userId);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,17 @@
|
|||||||
package cn.iocoder.yudao.module.crm.dal.dataobject.contact;
|
package cn.iocoder.yudao.module.crm.dal.dataobject.contact;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
|
||||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.*;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* crm 联系人 DO
|
* crm联系人 DO
|
||||||
*
|
*
|
||||||
* @author 芋道源码
|
* @author 芋道源码
|
||||||
*/
|
*/
|
||||||
@ -23,15 +25,6 @@ import java.time.LocalDateTime;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class ContactDO extends BaseDO {
|
public class ContactDO extends BaseDO {
|
||||||
|
|
||||||
/**
|
|
||||||
* 主键
|
|
||||||
*/
|
|
||||||
@TableId
|
|
||||||
private Long id;
|
|
||||||
/**
|
|
||||||
* 联系人名称
|
|
||||||
*/
|
|
||||||
private String name;
|
|
||||||
/**
|
/**
|
||||||
* 下次联系时间
|
* 下次联系时间
|
||||||
*/
|
*/
|
||||||
@ -48,14 +41,8 @@ public class ContactDO extends BaseDO {
|
|||||||
* 电子邮箱
|
* 电子邮箱
|
||||||
*/
|
*/
|
||||||
private String email;
|
private String email;
|
||||||
/**
|
|
||||||
* 职务
|
|
||||||
*/
|
|
||||||
private String post;
|
|
||||||
/**
|
/**
|
||||||
* 客户编号
|
* 客户编号
|
||||||
*
|
|
||||||
* TODO @zyna:关联的字段,也要写下
|
|
||||||
*/
|
*/
|
||||||
private Long customerId;
|
private Long customerId;
|
||||||
/**
|
/**
|
||||||
@ -70,5 +57,42 @@ public class ContactDO extends BaseDO {
|
|||||||
* 最后跟进时间
|
* 最后跟进时间
|
||||||
*/
|
*/
|
||||||
private LocalDateTime lastTime;
|
private LocalDateTime lastTime;
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 直属上级
|
||||||
|
*/
|
||||||
|
private Long parentId;
|
||||||
|
/**
|
||||||
|
* 姓名
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
/**
|
||||||
|
* 职位
|
||||||
|
*/
|
||||||
|
private String post;
|
||||||
|
/**
|
||||||
|
* QQ
|
||||||
|
*/
|
||||||
|
private Long qq;
|
||||||
|
/**
|
||||||
|
* 微信
|
||||||
|
*/
|
||||||
|
private String webchat;
|
||||||
|
/**
|
||||||
|
* 性别
|
||||||
|
*/
|
||||||
|
private Integer sex;
|
||||||
|
/**
|
||||||
|
* 是否关键决策人
|
||||||
|
*/
|
||||||
|
private Boolean policyMakers;
|
||||||
|
/**
|
||||||
|
* 负责人用户编号
|
||||||
|
*/
|
||||||
|
private String ownerUserId;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
package cn.iocoder.yudao.module.crm.dal.mysql.contact;
|
package cn.iocoder.yudao.module.crm.dal.mysql.contact;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
|
||||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.ContactExportReqVO;
|
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.ContactPageReqVO;
|
|
||||||
import cn.iocoder.yudao.module.crm.dal.dataobject.contact.ContactDO;
|
import cn.iocoder.yudao.module.crm.dal.dataobject.contact.ContactDO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.*;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* crm联系人 Mapper
|
* crm联系人 Mapper
|
||||||
@ -20,33 +19,45 @@ public interface ContactMapper extends BaseMapperX<ContactDO> {
|
|||||||
|
|
||||||
default PageResult<ContactDO> selectPage(ContactPageReqVO reqVO) {
|
default PageResult<ContactDO> selectPage(ContactPageReqVO reqVO) {
|
||||||
return selectPage(reqVO, new LambdaQueryWrapperX<ContactDO>()
|
return selectPage(reqVO, new LambdaQueryWrapperX<ContactDO>()
|
||||||
.likeIfPresent(ContactDO::getName, reqVO.getName())
|
|
||||||
.betweenIfPresent(ContactDO::getNextTime, reqVO.getNextTime())
|
.betweenIfPresent(ContactDO::getNextTime, reqVO.getNextTime())
|
||||||
.eqIfPresent(ContactDO::getMobile, reqVO.getMobile())
|
.eqIfPresent(ContactDO::getMobile, reqVO.getMobile())
|
||||||
.eqIfPresent(ContactDO::getTelephone, reqVO.getTelephone())
|
.eqIfPresent(ContactDO::getTelephone, reqVO.getTelephone())
|
||||||
.eqIfPresent(ContactDO::getEmail, reqVO.getEmail())
|
.eqIfPresent(ContactDO::getEmail, reqVO.getEmail())
|
||||||
.eqIfPresent(ContactDO::getPost, reqVO.getPost())
|
|
||||||
.eqIfPresent(ContactDO::getCustomerId, reqVO.getCustomerId())
|
.eqIfPresent(ContactDO::getCustomerId, reqVO.getCustomerId())
|
||||||
.eqIfPresent(ContactDO::getAddress, reqVO.getAddress())
|
.eqIfPresent(ContactDO::getAddress, reqVO.getAddress())
|
||||||
.eqIfPresent(ContactDO::getRemark, reqVO.getRemark())
|
.eqIfPresent(ContactDO::getRemark, reqVO.getRemark())
|
||||||
.betweenIfPresent(ContactDO::getCreateTime, reqVO.getCreateTime())
|
.betweenIfPresent(ContactDO::getCreateTime, reqVO.getCreateTime())
|
||||||
.betweenIfPresent(ContactDO::getLastTime, reqVO.getLastTime())
|
.betweenIfPresent(ContactDO::getLastTime, reqVO.getLastTime())
|
||||||
|
.eqIfPresent(ContactDO::getParentId, reqVO.getParentId())
|
||||||
|
.likeIfPresent(ContactDO::getName, reqVO.getName())
|
||||||
|
.eqIfPresent(ContactDO::getPost, reqVO.getPost())
|
||||||
|
.eqIfPresent(ContactDO::getQq, reqVO.getQq())
|
||||||
|
.eqIfPresent(ContactDO::getWebchat, reqVO.getWebchat())
|
||||||
|
.eqIfPresent(ContactDO::getSex, reqVO.getSex())
|
||||||
|
.eqIfPresent(ContactDO::getPolicyMakers, reqVO.getPolicyMakers())
|
||||||
|
.eqIfPresent(ContactDO::getOwnerUserId, reqVO.getOwnerUserId())
|
||||||
.orderByDesc(ContactDO::getId));
|
.orderByDesc(ContactDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
default List<ContactDO> selectList(ContactExportReqVO reqVO) {
|
default List<ContactDO> selectList(ContactExportReqVO reqVO) {
|
||||||
return selectList(new LambdaQueryWrapperX<ContactDO>()
|
return selectList(new LambdaQueryWrapperX<ContactDO>()
|
||||||
.likeIfPresent(ContactDO::getName, reqVO.getName())
|
|
||||||
.betweenIfPresent(ContactDO::getNextTime, reqVO.getNextTime())
|
.betweenIfPresent(ContactDO::getNextTime, reqVO.getNextTime())
|
||||||
.eqIfPresent(ContactDO::getMobile, reqVO.getMobile())
|
.eqIfPresent(ContactDO::getMobile, reqVO.getMobile())
|
||||||
.eqIfPresent(ContactDO::getTelephone, reqVO.getTelephone())
|
.eqIfPresent(ContactDO::getTelephone, reqVO.getTelephone())
|
||||||
.eqIfPresent(ContactDO::getEmail, reqVO.getEmail())
|
.eqIfPresent(ContactDO::getEmail, reqVO.getEmail())
|
||||||
.eqIfPresent(ContactDO::getPost, reqVO.getPost())
|
|
||||||
.eqIfPresent(ContactDO::getCustomerId, reqVO.getCustomerId())
|
.eqIfPresent(ContactDO::getCustomerId, reqVO.getCustomerId())
|
||||||
.eqIfPresent(ContactDO::getAddress, reqVO.getAddress())
|
.eqIfPresent(ContactDO::getAddress, reqVO.getAddress())
|
||||||
.eqIfPresent(ContactDO::getRemark, reqVO.getRemark())
|
.eqIfPresent(ContactDO::getRemark, reqVO.getRemark())
|
||||||
.betweenIfPresent(ContactDO::getCreateTime, reqVO.getCreateTime())
|
.betweenIfPresent(ContactDO::getCreateTime, reqVO.getCreateTime())
|
||||||
.betweenIfPresent(ContactDO::getLastTime, reqVO.getLastTime())
|
.betweenIfPresent(ContactDO::getLastTime, reqVO.getLastTime())
|
||||||
|
.eqIfPresent(ContactDO::getParentId, reqVO.getParentId())
|
||||||
|
.likeIfPresent(ContactDO::getName, reqVO.getName())
|
||||||
|
.eqIfPresent(ContactDO::getPost, reqVO.getPost())
|
||||||
|
.eqIfPresent(ContactDO::getQq, reqVO.getQq())
|
||||||
|
.eqIfPresent(ContactDO::getWebchat, reqVO.getWebchat())
|
||||||
|
.eqIfPresent(ContactDO::getSex, reqVO.getSex())
|
||||||
|
.eqIfPresent(ContactDO::getPolicyMakers, reqVO.getPolicyMakers())
|
||||||
|
.eqIfPresent(ContactDO::getOwnerUserId, reqVO.getOwnerUserId())
|
||||||
.orderByDesc(ContactDO::getId));
|
.orderByDesc(ContactDO::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
package cn.iocoder.yudao.module.crm.service.contact;
|
package cn.iocoder.yudao.module.crm.service.contact;
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import java.util.*;
|
||||||
|
import javax.validation.*;
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.*;
|
import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.*;
|
||||||
import cn.iocoder.yudao.module.crm.dal.dataobject.contact.ContactDO;
|
import cn.iocoder.yudao.module.crm.dal.dataobject.contact.ContactDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import javax.validation.Valid;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* crm联系人 Service 接口
|
* crm联系人 Service 接口
|
||||||
@ -19,10 +17,9 @@ public interface ContactService {
|
|||||||
* 创建crm联系人
|
* 创建crm联系人
|
||||||
*
|
*
|
||||||
* @param createReqVO 创建信息
|
* @param createReqVO 创建信息
|
||||||
* @param userId 用户编号
|
|
||||||
* @return 编号
|
* @return 编号
|
||||||
*/
|
*/
|
||||||
Long createContact(@Valid ContactCreateReqVO createReqVO, Long userId);
|
Long createContact(@Valid ContactCreateReqVO createReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 更新crm联系人
|
* 更新crm联系人
|
||||||
@ -71,11 +68,8 @@ public interface ContactService {
|
|||||||
List<ContactDO> getContactList(ContactExportReqVO exportReqVO);
|
List<ContactDO> getContactList(ContactExportReqVO exportReqVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 联系人编号
|
* 获取所有联系人列表,只返回姓名和id
|
||||||
*
|
* @return 所有联系人列表
|
||||||
* @param reqVO 请求
|
|
||||||
* @param userId 用户编号
|
|
||||||
*/
|
*/
|
||||||
void transferContact(CrmContactTransferReqVO reqVO, Long userId);
|
List<ContactDO> allContactList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,27 +1,22 @@
|
|||||||
package cn.iocoder.yudao.module.crm.service.contact;
|
package cn.iocoder.yudao.module.crm.service.contact;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.*;
|
||||||
|
import cn.iocoder.yudao.module.crm.dal.dataobject.contact.ContactDO;
|
||||||
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
|
|
||||||
|
import cn.iocoder.yudao.module.crm.convert.contact.ContactConvert;
|
||||||
|
import cn.iocoder.yudao.module.crm.dal.mysql.contact.ContactMapper;
|
||||||
|
|
||||||
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.ListUtil;
|
import cn.hutool.core.collection.ListUtil;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
|
||||||
import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.*;
|
|
||||||
import cn.iocoder.yudao.module.crm.convert.contact.ContactConvert;
|
|
||||||
import cn.iocoder.yudao.module.crm.dal.dataobject.contact.ContactDO;
|
|
||||||
import cn.iocoder.yudao.module.crm.dal.mysql.contact.ContactMapper;
|
|
||||||
import cn.iocoder.yudao.module.crm.framework.core.annotations.CrmPermission;
|
|
||||||
import cn.iocoder.yudao.module.crm.framework.enums.CrmBizTypeEnum;
|
|
||||||
import cn.iocoder.yudao.module.crm.framework.enums.CrmPermissionLevelEnum;
|
|
||||||
import cn.iocoder.yudao.module.crm.service.permission.CrmPermissionService;
|
|
||||||
import cn.iocoder.yudao.module.crm.service.permission.bo.CrmPermissionCreateReqBO;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
||||||
import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.CONTACT_NOT_EXISTS;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* crm联系人 Service 实现类
|
* crm联系人 Service 实现类
|
||||||
@ -35,41 +30,25 @@ public class ContactServiceImpl implements ContactService {
|
|||||||
@Resource
|
@Resource
|
||||||
private ContactMapper contactMapper;
|
private ContactMapper contactMapper;
|
||||||
|
|
||||||
@Resource
|
|
||||||
private CrmPermissionService crmPermissionService;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createContact(ContactCreateReqVO createReqVO, Long userId) {
|
public Long createContact(ContactCreateReqVO createReqVO) {
|
||||||
// TODO @customerId:需要校验存在
|
|
||||||
// 插入
|
// 插入
|
||||||
ContactDO contact = ContactConvert.INSTANCE.convert(createReqVO);
|
ContactDO contact = ContactConvert.INSTANCE.convert(createReqVO);
|
||||||
contactMapper.insert(contact);
|
contactMapper.insert(contact);
|
||||||
|
|
||||||
// 创建数据权限
|
|
||||||
crmPermissionService.createPermission(new CrmPermissionCreateReqBO().setBizType(CrmBizTypeEnum.CRM_CONTACTS.getType())
|
|
||||||
.setBizId(contact.getId()).setUserId(userId).setPermissionLevel(CrmPermissionLevelEnum.OWNER.getLevel())); // 设置当前操作的人为负责人
|
|
||||||
|
|
||||||
// 返回
|
// 返回
|
||||||
return contact.getId();
|
return contact.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
@CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTACTS, getIdFor = ContactUpdateReqVO.class,
|
|
||||||
permissionLevel = CrmPermissionLevelEnum.WRITE)
|
|
||||||
public void updateContact(ContactUpdateReqVO updateReqVO) {
|
public void updateContact(ContactUpdateReqVO updateReqVO) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
validateContactExists(updateReqVO.getId());
|
validateContactExists(updateReqVO.getId());
|
||||||
// TODO @customerId:需要校验存在
|
|
||||||
|
|
||||||
// 更新
|
// 更新
|
||||||
ContactDO updateObj = ContactConvert.INSTANCE.convert(updateReqVO);
|
ContactDO updateObj = ContactConvert.INSTANCE.convert(updateReqVO);
|
||||||
contactMapper.updateById(updateObj);
|
contactMapper.updateById(updateObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
|
||||||
@CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTACTS, permissionLevel = CrmPermissionLevelEnum.WRITE)
|
|
||||||
public void deleteContact(Long id) {
|
public void deleteContact(Long id) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
validateContactExists(id);
|
validateContactExists(id);
|
||||||
@ -77,16 +56,13 @@ public class ContactServiceImpl implements ContactService {
|
|||||||
contactMapper.deleteById(id);
|
contactMapper.deleteById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
private ContactDO validateContactExists(Long id) {
|
private void validateContactExists(Long id) {
|
||||||
ContactDO contact = contactMapper.selectById(id);
|
if (contactMapper.selectById(id) == null) {
|
||||||
if (contact == null) {
|
|
||||||
throw exception(CONTACT_NOT_EXISTS);
|
throw exception(CONTACT_NOT_EXISTS);
|
||||||
}
|
}
|
||||||
return contact;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTACTS, permissionLevel = CrmPermissionLevelEnum.READ)
|
|
||||||
public ContactDO getContact(Long id) {
|
public ContactDO getContact(Long id) {
|
||||||
return contactMapper.selectById(id);
|
return contactMapper.selectById(id);
|
||||||
}
|
}
|
||||||
@ -110,15 +86,8 @@ public class ContactServiceImpl implements ContactService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void transferContact(CrmContactTransferReqVO reqVO, Long userId) {
|
public List<ContactDO> allContactList() {
|
||||||
// 1 校验联系人是否存在
|
return contactMapper.selectList();
|
||||||
validateContactExists(reqVO.getId());
|
|
||||||
|
|
||||||
// 2. 数据权限转移
|
|
||||||
crmPermissionService.transferPermission(
|
|
||||||
ContactConvert.INSTANCE.convert(reqVO, userId).setBizType(CrmBizTypeEnum.CRM_CONTACTS.getType()));
|
|
||||||
|
|
||||||
// 3. TODO 记录转移日志
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user