mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-04 20:28:44 +08:00 
			
		
		
		
	crm:code review 联系人
This commit is contained in:
		@@ -86,24 +86,23 @@ public class ContactController {
 | 
			
		||||
    @PreAuthorize("@ss.hasPermission('crm:contact:query')")
 | 
			
		||||
    public CommonResult<ContactRespVO> getContact(@RequestParam("id") Long id) {
 | 
			
		||||
        ContactDO contact = contactService.getContact(id);
 | 
			
		||||
        if(contact == null){
 | 
			
		||||
        if (contact == null) {
 | 
			
		||||
            throw exception(ErrorCodeConstants.CONTACT_NOT_EXISTS);
 | 
			
		||||
        }
 | 
			
		||||
        //1.获取用户名
 | 
			
		||||
        // 1. 获取用户名
 | 
			
		||||
        Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(CollUtil.removeNull(Lists.newArrayList(
 | 
			
		||||
                NumberUtil.parseLong(contact.getCreator()),contact.getOwnerUserId())));
 | 
			
		||||
        //2.获取客户信息
 | 
			
		||||
        List<CrmCustomerDO> crmCustomerDOList = crmCustomerService.getCustomerList(Collections.singletonList(contact.getCustomerId()));
 | 
			
		||||
        //3.直属上级
 | 
			
		||||
        List<ContactDO> contactList = contactService.getContactList(Collections.singletonList(contact.getParentId()));
 | 
			
		||||
        ContactRespVO contactRespVO  = ContactConvert.INSTANCE.convert(contact,userMap,crmCustomerDOList,contactList);
 | 
			
		||||
        return success(contactRespVO);
 | 
			
		||||
                NumberUtil.parseLong(contact.getCreator()), contact.getOwnerUserId())));
 | 
			
		||||
        // 2. 获取客户信息
 | 
			
		||||
        List<CrmCustomerDO> customerList = crmCustomerService.getCustomerList(Collections.singletonList(contact.getCustomerId()));
 | 
			
		||||
        // 3. 直属上级
 | 
			
		||||
        List<ContactDO> parentContactList = contactService.getContactList(Collections.singletonList(contact.getParentId()));
 | 
			
		||||
        return success(ContactConvert.INSTANCE.convert(contact, userMap, customerList, parentContactList));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @GetMapping("/simple-all-list")
 | 
			
		||||
    @Operation(summary = "获得联系人列表")
 | 
			
		||||
    @PreAuthorize("@ss.hasPermission('crm:contact:query')")
 | 
			
		||||
    public CommonResult<List<ContactSimpleRespVO>> simpleAlllist() {
 | 
			
		||||
        // TODO @zyna:方法名改成,getContactList;方法命名,要动名词,get 动词;all 可以去掉,因为没条件,自然是全部
 | 
			
		||||
    public CommonResult<List<ContactSimpleRespVO>> getContactList() {
 | 
			
		||||
        List<ContactDO> list = contactService.getContactList();
 | 
			
		||||
        return success(ContactConvert.INSTANCE.convertAllList(list));
 | 
			
		||||
    }
 | 
			
		||||
@@ -112,11 +111,12 @@ public class ContactController {
 | 
			
		||||
    @Operation(summary = "获得联系人分页")
 | 
			
		||||
    @PreAuthorize("@ss.hasPermission('crm:contact:query')")
 | 
			
		||||
    public CommonResult<PageResult<ContactRespVO>> getContactPage(@Valid ContactPageReqVO pageVO) {
 | 
			
		||||
        PageResult<ContactDO> pageData = contactService.getContactPage(pageVO);
 | 
			
		||||
        List<ContactRespVO>  contactRespVOList = convertFieldValue2Name(pageData.getList());
 | 
			
		||||
        PageResult<ContactRespVO> pageDataReturn = ContactConvert.INSTANCE.convertPage(pageData);
 | 
			
		||||
        pageDataReturn.setList(contactRespVOList);
 | 
			
		||||
        return success(pageDataReturn);
 | 
			
		||||
        PageResult<ContactDO> pageResult = contactService.getContactPage(pageVO);
 | 
			
		||||
        if (CollUtil.isEmpty(pageResult.getList())) {
 | 
			
		||||
            return success(PageResult.empty(pageResult.getTotal()));
 | 
			
		||||
        }
 | 
			
		||||
        List<ContactRespVO> contactVOList = convertFieldValue2Name(pageResult.getList());
 | 
			
		||||
        return success(new PageResult<>(contactVOList, pageResult.getTotal()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // TODO @zyna:可以看下新的导出写法,这里调整下
 | 
			
		||||
@@ -127,27 +127,31 @@ public class ContactController {
 | 
			
		||||
    public void exportContactExcel(@Valid ContactPageReqVO exportReqVO,
 | 
			
		||||
              HttpServletResponse response) throws IOException {
 | 
			
		||||
        List<ContactDO> list = contactService.getContactList(exportReqVO);
 | 
			
		||||
        // TODO @zya:可以改成直接调用 getContactPage 方法;只要把 ContactPageReqVO 设置成不分页,PAGE_SIZE_NONE
 | 
			
		||||
        // 导出 Excel
 | 
			
		||||
        List<ContactRespVO>  contactRespVOList = convertFieldValue2Name(list);
 | 
			
		||||
        ExcelUtils.write(response, "crm联系人.xls", "数据", ContactRespVO.class, contactRespVOList);
 | 
			
		||||
        ExcelUtils.write(response, "crm 联系人.xls", "数据", ContactRespVO.class, contactRespVOList);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // TODO 芋艿:后续会合并下,
 | 
			
		||||
    /**
 | 
			
		||||
     * 翻译字段名称
 | 
			
		||||
     * @param contactDOList 联系人List
 | 
			
		||||
     * @return List<ContactRespVO>
 | 
			
		||||
     */
 | 
			
		||||
    private List<ContactRespVO> convertFieldValue2Name(List<ContactDO> contactDOList){
 | 
			
		||||
        //1.获取客户列表
 | 
			
		||||
        // 1. 获取客户列表
 | 
			
		||||
        // TODO @zyna:简单的转换,可以使用 CollectionUtils.convertSet
 | 
			
		||||
        List<Long> customerIdList = contactDOList.stream().map(ContactDO::getCustomerId).distinct().collect(Collectors.toList());
 | 
			
		||||
        List<CrmCustomerDO> crmCustomerDOList = crmCustomerService.getCustomerList(customerIdList);
 | 
			
		||||
        //2.获取创建人、责任人列表
 | 
			
		||||
        // 2. 获取创建人、责任人列表
 | 
			
		||||
        // TODO @zyna:简单的转换,可以使用 CollectionUtils.convertSetByFlatMap
 | 
			
		||||
        List<Long> userIdsList =  contactDOList.stream().flatMap(item-> Stream.of(Long.parseLong(item.getCreator()),item.getOwnerUserId()).distinct()).collect(Collectors.toList());
 | 
			
		||||
        Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(userIdsList);
 | 
			
		||||
        //3.直属上级
 | 
			
		||||
        // 3. 直属上级
 | 
			
		||||
        List<Long> contactIdsList =  contactDOList.stream().map(ContactDO::getParentId).distinct().collect(Collectors.toList());
 | 
			
		||||
        List<ContactDO> contactList = contactService.getContactList(contactIdsList);
 | 
			
		||||
        List<ContactRespVO> pageResult =ContactConvert.INSTANCE.converList(contactDOList,userMap,crmCustomerDOList,contactList);
 | 
			
		||||
        return pageResult;
 | 
			
		||||
        return ContactConvert.INSTANCE.converList(contactDOList,userMap,crmCustomerDOList,contactList);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -4,11 +4,11 @@ import cn.iocoder.yudao.framework.common.validation.Mobile;
 | 
			
		||||
import cn.iocoder.yudao.framework.common.validation.Telephone;
 | 
			
		||||
import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat;
 | 
			
		||||
import cn.iocoder.yudao.framework.excel.core.convert.DictConvert;
 | 
			
		||||
import cn.iocoder.yudao.module.infra.enums.DictTypeConstants;
 | 
			
		||||
import com.alibaba.excel.annotation.ExcelIgnore;
 | 
			
		||||
import com.alibaba.excel.annotation.ExcelProperty;
 | 
			
		||||
import io.swagger.v3.oas.annotations.media.Schema;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
import org.apache.skywalking.apm.toolkit.trace.IgnoredException;
 | 
			
		||||
import org.springframework.format.annotation.DateTimeFormat;
 | 
			
		||||
 | 
			
		||||
import javax.validation.constraints.Email;
 | 
			
		||||
@@ -35,25 +35,24 @@ public class ContactBaseVO {
 | 
			
		||||
    @ExcelIgnore
 | 
			
		||||
    private Long customerId;
 | 
			
		||||
 | 
			
		||||
    @ExcelProperty(value = "性别",converter = DictConvert.class ,order = 3)
 | 
			
		||||
    @ExcelProperty(value = "性别", converter = DictConvert.class, order = 3)
 | 
			
		||||
    @DictFormat(cn.iocoder.yudao.module.system.enums.DictTypeConstants.USER_SEX)
 | 
			
		||||
    @Schema(description = "性别")
 | 
			
		||||
    private Integer sex;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "职位")
 | 
			
		||||
    @ExcelProperty(value = "职位",order = 3)
 | 
			
		||||
    @ExcelProperty(value = "职位", order = 3)
 | 
			
		||||
    private String post;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "是否关键决策人")
 | 
			
		||||
    @ExcelProperty(value = "是否关键决策人",converter = DictConvert.class,order = 3)
 | 
			
		||||
    @DictFormat(cn.iocoder.yudao.module.system.enums.DictTypeConstants.INFRA_BOOLEAN_STRING)
 | 
			
		||||
    @ExcelProperty(value = "是否关键决策人", converter = DictConvert.class, order = 3)
 | 
			
		||||
    @DictFormat(DictTypeConstants.BOOLEAN_STRING)
 | 
			
		||||
    private Boolean master;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "直属上级", example = "23457")
 | 
			
		||||
    @ExcelIgnore
 | 
			
		||||
    private Long parentId;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "手机号",example = "1387171766")
 | 
			
		||||
    @Mobile
 | 
			
		||||
    @ExcelProperty(value = "手机号",order = 4)
 | 
			
		||||
@@ -98,7 +97,7 @@ public class ContactBaseVO {
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "负责人用户编号", example = "14334")
 | 
			
		||||
    @NotNull(message = "负责人不能为空")
 | 
			
		||||
    @ExcelIgnore
 | 
			
		||||
    @ExcelIgnore // TODO @zyna:可以使用 ExcelIgnoreUnannotated
 | 
			
		||||
    private Long ownerUserId;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "地区编号", example = "20158")
 | 
			
		||||
 
 | 
			
		||||
@@ -11,13 +11,13 @@ import java.time.LocalDateTime;
 | 
			
		||||
 | 
			
		||||
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
 | 
			
		||||
@EqualsAndHashCode(callSuper = true)
 | 
			
		||||
@ToString(callSuper = true)
 | 
			
		||||
public class ContactPageReqVO extends PageParam {
 | 
			
		||||
 | 
			
		||||
    // TODO @zyna:筛选条件
 | 
			
		||||
    // TODO @zyna:筛选条件(多余的可以删除哈)还有部分 example 少了,可以补充下;
 | 
			
		||||
    // ●客户:
 | 
			
		||||
    // ●姓名:
 | 
			
		||||
    // ●手机、电话、座机、QQ、微信、邮箱
 | 
			
		||||
@@ -26,13 +26,13 @@ public class ContactPageReqVO extends PageParam {
 | 
			
		||||
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
 | 
			
		||||
    private LocalDateTime[] nextTime;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "手机号",example = "13898273941")
 | 
			
		||||
    @Schema(description = "手机号", example = "13898273941")
 | 
			
		||||
    private String mobile;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "电话",example = "021-383773")
 | 
			
		||||
    @Schema(description = "电话", example = "021-383773")
 | 
			
		||||
    private String telephone;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "电子邮箱",example = "111@22.com")
 | 
			
		||||
    @Schema(description = "电子邮箱", example = "111@22.com")
 | 
			
		||||
    private String email;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "客户编号", example = "10795")
 | 
			
		||||
@@ -61,10 +61,10 @@ public class ContactPageReqVO extends PageParam {
 | 
			
		||||
    @Schema(description = "职位")
 | 
			
		||||
    private String post;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "QQ",example = "3882872")
 | 
			
		||||
    @Schema(description = "QQ", example = "3882872")
 | 
			
		||||
    private Long qq;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "微信",example = "zzZ98373")
 | 
			
		||||
    @Schema(description = "微信", example = "zzZ98373")
 | 
			
		||||
    private String wechat;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "性别")
 | 
			
		||||
 
 | 
			
		||||
@@ -172,6 +172,8 @@ public class CrmCustomerController {
 | 
			
		||||
        customerService.receiveCustomer(ids, ownerUserId);
 | 
			
		||||
        return success(true);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // TODO 芋艿:这个接口要调整下
 | 
			
		||||
    @GetMapping("/query-all-list")
 | 
			
		||||
    @Operation(summary = "查询客户列表")
 | 
			
		||||
    @PreAuthorize("@ss.hasPermission('crm:customer:all')")
 | 
			
		||||
@@ -180,4 +182,5 @@ public class CrmCustomerController {
 | 
			
		||||
        List<CrmCustomerQueryAllRespVO> data = CrmCustomerConvert.INSTANCE.convertQueryAll(crmCustomerDOList);
 | 
			
		||||
        return success(data);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -3,13 +3,15 @@ package cn.iocoder.yudao.module.crm.controller.admin.customer.vo;
 | 
			
		||||
import io.swagger.v3.oas.annotations.media.Schema;
 | 
			
		||||
import lombok.Data;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// TODO 芋艿:这块要统一下;
 | 
			
		||||
@Schema(description = "管理后台 - CRM 全部客户 Response VO")
 | 
			
		||||
@Data
 | 
			
		||||
public class CrmCustomerQueryAllRespVO{
 | 
			
		||||
    @Schema(description = "客户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
 | 
			
		||||
    private String name;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "13563")
 | 
			
		||||
    private Long id;
 | 
			
		||||
 | 
			
		||||
    @Schema(description = "客户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
 | 
			
		||||
    private String name;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -46,7 +46,8 @@ public interface ContactConvert {
 | 
			
		||||
    CrmPermissionTransferReqBO convert(CrmContactTransferReqVO reqVO, Long userId);
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 详情信息
 | 
			
		||||
     * 转换详情信息
 | 
			
		||||
     *
 | 
			
		||||
     * @param contactDO 联系人
 | 
			
		||||
     * @param userMap 用户列表
 | 
			
		||||
     * @param crmCustomerDOList 客户
 | 
			
		||||
@@ -54,26 +55,28 @@ public interface ContactConvert {
 | 
			
		||||
     */
 | 
			
		||||
    default  ContactRespVO convert(ContactDO contactDO, Map<Long, AdminUserRespDTO> userMap, List<CrmCustomerDO> crmCustomerDOList,
 | 
			
		||||
                                   List<ContactDO> contactList) {
 | 
			
		||||
        ContactRespVO contactRespVO = convert(contactDO);
 | 
			
		||||
        setUserInfo(contactRespVO,userMap);
 | 
			
		||||
        Map<Long,CrmCustomerDO> crmCustomerDOMap = crmCustomerDOList.stream().collect(Collectors.toMap(CrmCustomerDO::getId,v->v));
 | 
			
		||||
        Map<Long,ContactDO> contactDOMap = contactList.stream().collect(Collectors.toMap(ContactDO::getId,v->v));
 | 
			
		||||
        findAndThen(crmCustomerDOMap,contactDO.getCustomerId(),customer -> {contactRespVO.setCustomerName(customer.getName());});
 | 
			
		||||
        findAndThen(contactDOMap,contactDO.getParentId(),contactDOInner -> {contactRespVO.setParentName(contactDOInner.getName());});
 | 
			
		||||
        return contactRespVO;
 | 
			
		||||
    }
 | 
			
		||||
    default  List<ContactRespVO> converList(List<ContactDO> contactDOList, Map<Long, AdminUserRespDTO> userMap,
 | 
			
		||||
                                                   List<CrmCustomerDO> crmCustomerDOList , List<ContactDO> contactList){
 | 
			
		||||
        List<ContactRespVO> result = convertList(contactDOList);
 | 
			
		||||
        ContactRespVO contactVO = convert(contactDO);
 | 
			
		||||
        setUserInfo(contactVO, userMap);
 | 
			
		||||
        Map<Long,CrmCustomerDO> ustomerMap = crmCustomerDOList.stream().collect(Collectors.toMap(CrmCustomerDO::getId,v->v));
 | 
			
		||||
        Map<Long,ContactDO> contactMap = contactList.stream().collect(Collectors.toMap(ContactDO::getId,v->v));
 | 
			
		||||
        Map<Long,CrmCustomerDO> customerMap = crmCustomerDOList.stream().collect(Collectors.toMap(CrmCustomerDO::getId,v->v));
 | 
			
		||||
        findAndThen(ustomerMap, contactDO.getCustomerId(), customer -> contactVO.setCustomerName(customer.getName()));
 | 
			
		||||
        findAndThen(contactMap, contactDO.getParentId(), contact -> contactVO.setParentName(contact.getName()));
 | 
			
		||||
        return contactVO;
 | 
			
		||||
    }
 | 
			
		||||
    default  List<ContactRespVO> converList(List<ContactDO> contactList, Map<Long, AdminUserRespDTO> userMap,
 | 
			
		||||
                                            List<CrmCustomerDO> customerList, List<ContactDO> parentContactList) {
 | 
			
		||||
        List<ContactRespVO> result = convertList(contactList);
 | 
			
		||||
        // TODO @zyna:简单的转换,可以使用 CollectionUtils.convertMap
 | 
			
		||||
        Map<Long, ContactDO> parentContactMap = parentContactList.stream().collect(Collectors.toMap(ContactDO::getId,v->v));
 | 
			
		||||
        Map<Long, CrmCustomerDO> customerMap = customerList.stream().collect(Collectors.toMap(CrmCustomerDO::getId,v->v));
 | 
			
		||||
        result.forEach(item -> {
 | 
			
		||||
            setUserInfo(item, userMap);
 | 
			
		||||
            findAndThen(customerMap,item.getCustomerId(),customer -> {item.setCustomerName(customer.getName());});
 | 
			
		||||
            findAndThen(contactMap,item.getParentId(),contactDO -> {item.setParentName(contactDO.getName());});
 | 
			
		||||
            findAndThen(parentContactMap,item.getParentId(),contactDO -> {item.setParentName(contactDO.getName());});
 | 
			
		||||
        });
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 设置用户信息
 | 
			
		||||
     *
 | 
			
		||||
@@ -87,4 +90,5 @@ public interface ContactConvert {
 | 
			
		||||
        });
 | 
			
		||||
        findAndThen(userMap, Long.parseLong(contactRespVO.getCreator()), user -> contactRespVO.setCreatorName(user.getNickname()));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -72,9 +72,7 @@ public interface CrmCustomerConvert {
 | 
			
		||||
    default PageResult<CrmCustomerRespVO> convertPage(PageResult<CrmCustomerDO> pageResult, Map<Long, AdminUserRespDTO> userMap,
 | 
			
		||||
                                                      Map<Long, DeptRespDTO> deptMap) {
 | 
			
		||||
        PageResult<CrmCustomerRespVO> result = convertPage(pageResult);
 | 
			
		||||
        result.getList().forEach(item -> {
 | 
			
		||||
            setUserInfo(item, userMap, deptMap);
 | 
			
		||||
        });
 | 
			
		||||
        result.getList().forEach(item -> setUserInfo(item, userMap, deptMap));
 | 
			
		||||
        return result;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -82,6 +80,6 @@ public interface CrmCustomerConvert {
 | 
			
		||||
 | 
			
		||||
    CrmCustomerPoolConfigDO convert(CrmCustomerPoolConfigSaveReqVO updateReqVO);
 | 
			
		||||
 | 
			
		||||
    CrmCustomerQueryAllRespVO convertQueryAll(CrmCustomerDO crmCustomerDO);
 | 
			
		||||
    List<CrmCustomerQueryAllRespVO> convertQueryAll(List<CrmCustomerDO> crmCustomerDO);
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,6 @@ 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 io.swagger.v3.oas.annotations.media.Schema;
 | 
			
		||||
import lombok.*;
 | 
			
		||||
 | 
			
		||||
import java.time.LocalDateTime;
 | 
			
		||||
@@ -23,6 +22,7 @@ import java.time.LocalDateTime;
 | 
			
		||||
@NoArgsConstructor
 | 
			
		||||
@AllArgsConstructor
 | 
			
		||||
public class ContactDO extends BaseDO {
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 主键
 | 
			
		||||
     */
 | 
			
		||||
@@ -61,7 +61,9 @@ public class ContactDO extends BaseDO {
 | 
			
		||||
     */
 | 
			
		||||
    private LocalDateTime lastTime;
 | 
			
		||||
    /**
 | 
			
		||||
     * 直属上级 @link ContactDO#id
 | 
			
		||||
     * 直属上级
 | 
			
		||||
     *
 | 
			
		||||
     * 关联 {@link ContactDO#id}
 | 
			
		||||
     */
 | 
			
		||||
    private Long parentId;
 | 
			
		||||
    /**
 | 
			
		||||
@@ -82,7 +84,8 @@ public class ContactDO extends BaseDO {
 | 
			
		||||
    private String wechat;
 | 
			
		||||
    /**
 | 
			
		||||
     * 性别
 | 
			
		||||
     * @See 字典配置
 | 
			
		||||
     *
 | 
			
		||||
     * 枚举 {@link cn.iocoder.yudao.module.system.enums.common.SexEnum}
 | 
			
		||||
     */
 | 
			
		||||
    private Integer sex;
 | 
			
		||||
    /**
 | 
			
		||||
@@ -91,8 +94,16 @@ public class ContactDO extends BaseDO {
 | 
			
		||||
    private Boolean master;
 | 
			
		||||
    /**
 | 
			
		||||
     * 负责人用户编号
 | 
			
		||||
     *
 | 
			
		||||
     * 关联 AdminUserDO 的 id 字段
 | 
			
		||||
     */
 | 
			
		||||
    private Long ownerUserId;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 所在地
 | 
			
		||||
     *
 | 
			
		||||
     * 关联 {@link cn.iocoder.yudao.framework.ip.core.Area#getId()} 字段
 | 
			
		||||
     */
 | 
			
		||||
    private Integer areaId;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -56,7 +56,7 @@ public class ContactServiceImpl implements ContactService {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    @CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTACTS,bizId = "#updateReqVO.id", level = CrmPermissionLevelEnum.WRITE)
 | 
			
		||||
    @CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTACTS, bizId = "#updateReqVO.id", level = CrmPermissionLevelEnum.WRITE)
 | 
			
		||||
    public void updateContact(ContactUpdateReqVO updateReqVO) {
 | 
			
		||||
        // 校验存在
 | 
			
		||||
        validateContactExists(updateReqVO.getId());
 | 
			
		||||
@@ -67,7 +67,7 @@ public class ContactServiceImpl implements ContactService {
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @Transactional(rollbackFor = Exception.class)
 | 
			
		||||
    @CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTACTS,bizId = "#id", level = CrmPermissionLevelEnum.WRITE)
 | 
			
		||||
    @CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTACTS, bizId = "#id", level = CrmPermissionLevelEnum.WRITE)
 | 
			
		||||
    public void deleteContact(Long id) {
 | 
			
		||||
        // 校验存在
 | 
			
		||||
        validateContactExists(id);
 | 
			
		||||
@@ -82,7 +82,7 @@ public class ContactServiceImpl implements ContactService {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    @CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTACTS,bizId = "#id", level = CrmPermissionLevelEnum.READ)
 | 
			
		||||
    @CrmPermission(bizType = CrmBizTypeEnum.CRM_CONTACTS, bizId = "#id", level = CrmPermissionLevelEnum.READ)
 | 
			
		||||
    public ContactDO getContact(Long id) {
 | 
			
		||||
        return contactMapper.selectById(id);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user