Merge branch 'feature/crm' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into feature/crm
This commit is contained in:
@@ -23,6 +23,7 @@ import java.util.List;
|
||||
|
||||
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 = "管理后台 - 商机")
|
||||
@RestController
|
||||
@@ -80,11 +81,19 @@ public class CrmBusinessController {
|
||||
@PreAuthorize("@ss.hasPermission('crm:business:export')")
|
||||
@OperateLog(type = EXPORT)
|
||||
public void exportBusinessExcel(@Valid CrmBusinessExportReqVO exportReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
HttpServletResponse response) throws IOException {
|
||||
List<CrmBusinessDO> list = businessService.getBusinessList(exportReqVO);
|
||||
// 导出 Excel
|
||||
List<CrmBusinessExcelVO> datas = CrmBusinessConvert.INSTANCE.convertList02(list);
|
||||
ExcelUtils.write(response, "商机.xls", "数据", CrmBusinessExcelVO.class, datas);
|
||||
}
|
||||
|
||||
@PutMapping("/transfer")
|
||||
@Operation(summary = "商机转移")
|
||||
@PreAuthorize("@ss.hasPermission('crm:business:update')")
|
||||
public CommonResult<Boolean> transfer(@Valid @RequestBody CrmBusinessTransferReqVO reqVO) {
|
||||
businessService.businessTransfer(reqVO, getLoginUserId());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -5,12 +5,21 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Schema(description = "管理后台 - 商机创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
public class CrmBusinessCreateReqVO extends CrmBusinessBaseVO {
|
||||
|
||||
@Schema(description = "只读权限的用户编号数组")
|
||||
private Set<Long> roUserIds;
|
||||
|
||||
@Schema(description = "读写权限的用户编号数组")
|
||||
private Set<Long> rwUserIds;
|
||||
|
||||
|
||||
// TODO @ljileo:新建的时候,应该可以传递添加的产品;
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,20 @@
|
||||
package cn.iocoder.yudao.module.crm.controller.admin.business.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 商机转移 Request VO")
|
||||
@Data
|
||||
public class CrmBusinessTransferReqVO {
|
||||
|
||||
@Schema(description = "商机编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430")
|
||||
@NotNull(message = "联系人编号不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "新负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430")
|
||||
@NotNull(message = "新负责人的用户编号不能为空")
|
||||
private Long ownerUserId; // 新的负责人
|
||||
|
||||
}
|
@@ -6,6 +6,7 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Set;
|
||||
|
||||
@Schema(description = "管理后台 - 商机更新 Request VO")
|
||||
@Data
|
||||
@@ -17,6 +18,13 @@ public class CrmBusinessUpdateReqVO extends CrmBusinessBaseVO {
|
||||
@NotNull(message = "主键不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "只读权限的用户编号数组")
|
||||
private Set<Long> roUserIds;
|
||||
|
||||
@Schema(description = "读写权限的用户编号数组")
|
||||
private Set<Long> rwUserIds;
|
||||
|
||||
|
||||
// TODO @ljileo:修改的时候,应该可以传递添加的产品;
|
||||
|
||||
}
|
||||
|
@@ -1,32 +1,30 @@
|
||||
package cn.iocoder.yudao.module.crm.controller.admin.contact;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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 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 cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
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.dal.dataobject.contact.ContactDO;
|
||||
import cn.iocoder.yudao.module.crm.service.contact.ContactService;
|
||||
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 javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
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联系人")
|
||||
@RestController
|
||||
@@ -99,4 +97,12 @@ public class ContactController {
|
||||
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.contactTransfer(reqVO, getLoginUserId());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,9 +1,11 @@
|
||||
package cn.iocoder.yudao.module.crm.controller.admin.contact.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import javax.validation.constraints.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Schema(description = "管理后台 - crm联系人创建 Request VO")
|
||||
@Data
|
||||
@@ -11,4 +13,10 @@ import javax.validation.constraints.*;
|
||||
@ToString(callSuper = true)
|
||||
public class ContactCreateReqVO extends ContactBaseVO {
|
||||
|
||||
@Schema(description = "只读权限的用户编号数组")
|
||||
private Set<Long> roUserIds;
|
||||
|
||||
@Schema(description = "读写权限的用户编号数组")
|
||||
private Set<Long> rwUserIds;
|
||||
|
||||
}
|
||||
|
@@ -1,9 +1,11 @@
|
||||
package cn.iocoder.yudao.module.crm.controller.admin.contact.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import javax.validation.constraints.*;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Schema(description = "管理后台 - crm联系人更新 Request VO")
|
||||
@Data
|
||||
@@ -14,4 +16,10 @@ public class ContactUpdateReqVO extends ContactBaseVO {
|
||||
@Schema(description = "主键", example = "23210")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "只读权限的用户编号数组")
|
||||
private Set<Long> roUserIds;
|
||||
|
||||
@Schema(description = "读写权限的用户编号数组")
|
||||
private Set<Long> rwUserIds;
|
||||
|
||||
}
|
||||
|
@@ -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 javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 联系人转移 Request VO")
|
||||
@Data
|
||||
public class CrmContactTransferReqVO {
|
||||
|
||||
@Schema(description = "联系人编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430")
|
||||
@NotNull(message = "联系人编号不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "新负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430")
|
||||
@NotNull(message = "新负责人的用户编号不能为空")
|
||||
private Long ownerUserId; // 新的负责人
|
||||
|
||||
}
|
@@ -23,6 +23,7 @@ import java.util.List;
|
||||
|
||||
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 = "管理后台 - 合同")
|
||||
@RestController
|
||||
@@ -86,4 +87,13 @@ public class ContractController {
|
||||
ExcelUtils.write(response, "合同.xls", "数据", ContractExcelVO.class, datas);
|
||||
}
|
||||
|
||||
@PutMapping("/transfer")
|
||||
@Operation(summary = "合同转移")
|
||||
@PreAuthorize("@ss.hasPermission('crm:contract:update')")
|
||||
public CommonResult<Boolean> transfer(@Valid @RequestBody CrmContractTransferReqVO reqVO) {
|
||||
contractService.contractTransfer(reqVO, getLoginUserId());
|
||||
return success(true);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -5,6 +5,8 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
@Schema(description = "管理后台 - 合同创建 Request VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -12,9 +14,9 @@ import lombok.ToString;
|
||||
public class ContractCreateReqVO extends ContractBaseVO {
|
||||
|
||||
@Schema(description = "只读权限的用户编号数组")
|
||||
private String roUserIds;
|
||||
private Set<Long> roUserIds;
|
||||
|
||||
@Schema(description = "读写权限的用户编号数组")
|
||||
private String rwUserIds;
|
||||
private Set<Long> rwUserIds;
|
||||
|
||||
}
|
||||
|
@@ -6,6 +6,7 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.Set;
|
||||
|
||||
@Schema(description = "管理后台 - 合同更新 Request VO")
|
||||
@Data
|
||||
@@ -18,9 +19,9 @@ public class ContractUpdateReqVO extends ContractBaseVO {
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "只读权限的用户编号数组")
|
||||
private String roUserIds;
|
||||
private Set<Long> roUserIds;
|
||||
|
||||
@Schema(description = "读写权限的用户编号数组")
|
||||
private String rwUserIds;
|
||||
private Set<Long> rwUserIds;
|
||||
|
||||
}
|
||||
|
@@ -0,0 +1,20 @@
|
||||
package cn.iocoder.yudao.module.crm.controller.admin.contract.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
@Schema(description = "管理后台 - 合同转移 Request VO")
|
||||
@Data
|
||||
public class CrmContractTransferReqVO {
|
||||
|
||||
@Schema(description = "合同编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430")
|
||||
@NotNull(message = "合同编号不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "新负责人的用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "10430")
|
||||
@NotNull(message = "新负责人的用户编号不能为空")
|
||||
private Long ownerUserId; // 新的负责人
|
||||
|
||||
}
|
@@ -19,7 +19,6 @@ import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
@@ -1,13 +1,16 @@
|
||||
package cn.iocoder.yudao.module.crm.controller.admin.customer.vo;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import cn.iocoder.yudao.framework.common.validation.Mobile;
|
||||
import cn.iocoder.yudao.framework.common.validation.Telephone;
|
||||
import cn.iocoder.yudao.module.crm.enums.customer.CrmCustomerLevelEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.validation.constraints.Email;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
@@ -23,15 +26,15 @@ public class CrmCustomerBaseVO {
|
||||
@NotEmpty(message = "客户名称不能为空")
|
||||
private String name;
|
||||
|
||||
// TODO wanwan:这个字段应该只有 RespVO 会有;创建和修改不传递;
|
||||
@Schema(description = "跟进状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||
@NotNull(message = "跟进状态不能为空")
|
||||
private Boolean followUpStatus;
|
||||
@Schema(description = "所属行业", example = "1")
|
||||
private Integer industryId;
|
||||
|
||||
// TODO wanwan:这个字段应该只有 RespVO 会有;创建和修改不传递;
|
||||
@Schema(description = "锁定状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||
@NotNull(message = "锁定状态不能为空")
|
||||
private Boolean lockStatus;
|
||||
@Schema(description = "客户等级", example = "2")
|
||||
@InEnum(CrmCustomerLevelEnum.class)
|
||||
private Integer level;
|
||||
|
||||
@Schema(description = "客户来源", example = "3")
|
||||
private Integer source;
|
||||
|
||||
@Schema(description = "手机", example = "18000000000")
|
||||
@Mobile
|
||||
@@ -44,32 +47,32 @@ public class CrmCustomerBaseVO {
|
||||
@Schema(description = "网址", example = "https://www.baidu.com")
|
||||
private String website;
|
||||
|
||||
@Schema(description = "QQ", example = "123456789")
|
||||
@Size(max = 20, message = "QQ长度不能超过 20 个字符")
|
||||
private String qq;
|
||||
|
||||
@Schema(description = "wechat", example = "123456789")
|
||||
@Size(max = 255, message = "微信长度不能超过 255 个字符")
|
||||
private String wechat;
|
||||
|
||||
@Schema(description = "email", example = "123456789@qq.com")
|
||||
@Email(message = "邮箱格式不正确")
|
||||
@Size(max = 255, message = "邮箱长度不能超过 255 个字符")
|
||||
private String email;
|
||||
|
||||
@Schema(description = "客户描述", example = "任意文字")
|
||||
@Size(max = 4096, message = "客户描述长度不能超过 4096 个字符")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
private String remark;
|
||||
|
||||
// TODO wanwan:这个字段应该只有 RespVO 会有;创建和修改不传递;因为它会在“移交”里面做哈
|
||||
@Schema(description = "负责人的用户编号", example = "25682")
|
||||
@NotNull(message = "负责人不能为空")
|
||||
private Long ownerUserId;
|
||||
|
||||
@Schema(description = "地区编号", example = "20158")
|
||||
private Long areaId;
|
||||
|
||||
@Schema(description = "详细地址", example = "北京市海淀区")
|
||||
private String detailAddress;
|
||||
|
||||
// TODO @芋艿:longitude、latitude 这两个字段删除;
|
||||
@Schema(description = "地理位置经度", example = "116.40341")
|
||||
private String longitude;
|
||||
|
||||
@Schema(description = "地理位置维度", example = "39.92409")
|
||||
private String latitude;
|
||||
|
||||
// TODO wanwan:这个字段应该只有 RespVO 会有;创建和修改不传递;
|
||||
@Schema(description = "最后跟进时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime contactLastTime;
|
||||
|
||||
@Schema(description = "下次联系时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime contactNextTime;
|
||||
|
@@ -11,12 +11,6 @@ import lombok.ToString;
|
||||
@ToString(callSuper = true)
|
||||
public class CrmCustomerCreateReqVO extends CrmCustomerBaseVO {
|
||||
|
||||
// TODO @wanwan:类型应该是传递 List<Long>; 不过这个字段,默认新建的时候不传递,在“移交”功能里管理
|
||||
@Schema(description = "只读权限的用户编号数组")
|
||||
private String roUserIds;
|
||||
|
||||
// TODO @wanwan:类型应该是传递 List<Long>; 不过这个字段,默认新建的时候不传递,在“移交”功能里管理
|
||||
@Schema(description = "读写权限的用户编号数组")
|
||||
private String rwUserIds;
|
||||
// TODO @wanwan:负责人
|
||||
|
||||
}
|
||||
|
@@ -4,6 +4,7 @@ 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.ExcelProperty;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
@@ -35,6 +36,18 @@ public class CrmCustomerExcelVO {
|
||||
@DictFormat(DictTypeConstants.BOOLEAN_STRING)
|
||||
private Boolean dealStatus;
|
||||
|
||||
@ExcelProperty(value = "所属行业", converter = DictConvert.class)
|
||||
@DictFormat(cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_INDUSTRY)
|
||||
private Integer industryId;
|
||||
|
||||
@ExcelProperty(value = "客户等级", converter = DictConvert.class)
|
||||
@DictFormat(cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_LEVEL)
|
||||
private Integer level;
|
||||
|
||||
@ExcelProperty(value = "客户来源", converter = DictConvert.class)
|
||||
@DictFormat(cn.iocoder.yudao.module.crm.enums.DictTypeConstants.CRM_CUSTOMER_SOURCE)
|
||||
private Integer source;
|
||||
|
||||
@ExcelProperty("手机")
|
||||
private String mobile;
|
||||
|
||||
@@ -44,6 +57,18 @@ public class CrmCustomerExcelVO {
|
||||
@ExcelProperty("网址")
|
||||
private String website;
|
||||
|
||||
@ExcelProperty("QQ")
|
||||
private String qq;
|
||||
|
||||
@ExcelProperty("wechat")
|
||||
private String wechat;
|
||||
|
||||
@ExcelProperty("email")
|
||||
private String email;
|
||||
|
||||
@ExcelProperty("客户描述")
|
||||
private String description;
|
||||
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@@ -56,12 +81,6 @@ public class CrmCustomerExcelVO {
|
||||
@ExcelProperty("详细地址")
|
||||
private String detailAddress;
|
||||
|
||||
@ExcelProperty("地理位置经度")
|
||||
private String longitude;
|
||||
|
||||
@ExcelProperty("地理位置维度")
|
||||
private String latitude;
|
||||
|
||||
@ExcelProperty("最后跟进时间")
|
||||
private LocalDateTime contactLastTime;
|
||||
|
||||
|
@@ -14,10 +14,4 @@ public class CrmCustomerExportReqVO {
|
||||
@Schema(description = "手机", example = "18000000000")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "电话", example = "18000000000")
|
||||
private String telephone;
|
||||
|
||||
@Schema(description = "网址", example = "https://www.baidu.com")
|
||||
private String website;
|
||||
|
||||
}
|
||||
|
@@ -18,13 +18,5 @@ public class CrmCustomerPageReqVO extends PageParam {
|
||||
@Schema(description = "手机", example = "18000000000")
|
||||
private String mobile;
|
||||
|
||||
// TODO @wanwan:这个字段不需要哈
|
||||
@Schema(description = "电话", example = "18000000000")
|
||||
private String telephone;
|
||||
|
||||
// TODO @wanwan:这个字段不需要哈
|
||||
@Schema(description = "网址", example = "https://www.baidu.com")
|
||||
private String website;
|
||||
|
||||
// TODO @芋艿:场景;
|
||||
}
|
||||
|
@@ -4,9 +4,12 @@ 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.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 客户 Response VO")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -16,9 +19,22 @@ public class CrmCustomerRespVO extends CrmCustomerBaseVO {
|
||||
@Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "13563")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "跟进状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||
private Boolean followUpStatus;
|
||||
|
||||
@Schema(description = "锁定状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||
private Boolean lockStatus;
|
||||
|
||||
@Schema(description = "成交状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||
private Boolean dealStatus;
|
||||
|
||||
@Schema(description = "负责人的用户编号", example = "25682")
|
||||
private Long ownerUserId;
|
||||
|
||||
@Schema(description = "最后跟进时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime contactLastTime;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private LocalDateTime createTime;
|
||||
|
||||
|
@@ -17,11 +17,4 @@ public class CrmCustomerUpdateReqVO extends CrmCustomerBaseVO {
|
||||
@NotNull(message = "编号不能为空")
|
||||
private Long id;
|
||||
|
||||
// TODO @wanwan:下面两个字段,同 CrmCustomerCreateReqVO
|
||||
@Schema(description = "只读权限的用户编号数组")
|
||||
private String roUserIds;
|
||||
|
||||
@Schema(description = "读写权限的用户编号数组")
|
||||
private String rwUserIds;
|
||||
|
||||
}
|
||||
|
@@ -1,13 +1,14 @@
|
||||
package cn.iocoder.yudao.module.crm.convert.business;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
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.business.vo.*;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 商机 Convert
|
||||
@@ -29,4 +30,12 @@ public interface CrmBusinessConvert {
|
||||
|
||||
List<CrmBusinessExcelVO> convertList02(List<CrmBusinessDO> list);
|
||||
|
||||
default CrmBusinessDO convert(CrmBusinessDO business, CrmBusinessTransferReqVO reqVO, Long userId) {
|
||||
Set<Long> rwUserIds = business.getRwUserIds();
|
||||
rwUserIds.removeIf(item -> ObjUtil.equal(item, userId)); // 移除老负责人
|
||||
rwUserIds.add(reqVO.getOwnerUserId()); // 读写权限加入新的负人
|
||||
return new CrmBusinessDO().setId(business.getId()).setOwnerUserId(reqVO.getOwnerUserId()) // 设置新负责人
|
||||
.setRwUserIds(rwUserIds);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,13 +1,14 @@
|
||||
package cn.iocoder.yudao.module.crm.convert.contact;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
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.dal.dataobject.contact.ContactDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* crm联系人 Convert
|
||||
@@ -31,4 +32,12 @@ public interface ContactConvert {
|
||||
|
||||
List<ContactExcelVO> convertList02(List<ContactDO> list);
|
||||
|
||||
default ContactDO convert(ContactDO contact, CrmContactTransferReqVO reqVO, Long userId) {
|
||||
Set<Long> rwUserIds = contact.getRwUserIds();
|
||||
rwUserIds.removeIf(item -> ObjUtil.equal(item, userId)); // 移除老负责人
|
||||
rwUserIds.add(reqVO.getOwnerUserId()); // 读写权限加入新的负人
|
||||
return new ContactDO().setId(contact.getId()).setOwnerUserId(reqVO.getOwnerUserId()) // 设置新负责人
|
||||
.setRwUserIds(rwUserIds);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,15 +1,14 @@
|
||||
package cn.iocoder.yudao.module.crm.convert.contract;
|
||||
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.ContractCreateReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.ContractExcelVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.ContractRespVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.ContractUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.*;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.contract.ContractDO;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.factory.Mappers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 合同 Convert
|
||||
@@ -33,4 +32,12 @@ public interface ContractConvert {
|
||||
|
||||
List<ContractExcelVO> convertList02(List<ContractDO> list);
|
||||
|
||||
default ContractDO convert(ContractDO contract, CrmContractTransferReqVO reqVO, Long userId) {
|
||||
Set<Long> rwUserIds = contract.getRwUserIds();
|
||||
rwUserIds.removeIf(item -> ObjUtil.equal(item, userId)); // 移除老负责人
|
||||
rwUserIds.add(reqVO.getOwnerUserId()); // 读写权限加入新的负人
|
||||
return new ContractDO().setId(contract.getId()).setOwnerUserId(reqVO.getOwnerUserId()) // 设置新负责人
|
||||
.setRwUserIds(rwUserIds);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,14 +1,17 @@
|
||||
package cn.iocoder.yudao.module.crm.dal.dataobject.business;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.type.JsonLongSetTypeHandler;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatus.CrmBusinessStatusDO;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.businessstatustype.CrmBusinessStatusTypeDO;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 商机 DO
|
||||
@@ -85,16 +88,14 @@ public class CrmBusinessDO extends BaseDO {
|
||||
private Long ownerUserId;
|
||||
/**
|
||||
* 只读权限的用户编号数组
|
||||
*
|
||||
* TODO @lijie:应该是 List<Long>,然后使用下对应的 typehandler
|
||||
*/
|
||||
private String roUserIds;
|
||||
@TableField(typeHandler = JsonLongSetTypeHandler.class)
|
||||
private Set<Long> roUserIds;
|
||||
/**
|
||||
* 读写权限的用户编号数组
|
||||
*
|
||||
* TODO @lijie:应该是 List<Long>,然后使用下对应的 typehandler
|
||||
*/
|
||||
private String rwUserIds;
|
||||
@TableField(typeHandler = JsonLongSetTypeHandler.class)
|
||||
private Set<Long> rwUserIds;
|
||||
/**
|
||||
* 1赢单2输单3无效
|
||||
*
|
||||
|
@@ -1,12 +1,15 @@
|
||||
package cn.iocoder.yudao.module.crm.dal.dataobject.contact;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.type.JsonLongSetTypeHandler;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* crm 联系人 DO
|
||||
@@ -77,4 +80,15 @@ public class ContactDO extends BaseDO {
|
||||
*/
|
||||
private LocalDateTime lastTime;
|
||||
|
||||
/**
|
||||
* 只读权限的用户编号数组
|
||||
*/
|
||||
@TableField(typeHandler = JsonLongSetTypeHandler.class)
|
||||
private Set<Long> roUserIds;
|
||||
/**
|
||||
* 读写权限的用户编号数组
|
||||
*/
|
||||
@TableField(typeHandler = JsonLongSetTypeHandler.class)
|
||||
private Set<Long> rwUserIds;
|
||||
|
||||
}
|
||||
|
@@ -1,12 +1,15 @@
|
||||
package cn.iocoder.yudao.module.crm.dal.dataobject.contract;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.type.JsonLongSetTypeHandler;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 合同 DO
|
||||
@@ -79,11 +82,13 @@ public class ContractDO extends BaseDO {
|
||||
/**
|
||||
* 只读权限的用户编号数组
|
||||
*/
|
||||
private String roUserIds;
|
||||
@TableField(typeHandler = JsonLongSetTypeHandler.class)
|
||||
private Set<Long> roUserIds;
|
||||
/**
|
||||
* 读写权限的用户编号数组
|
||||
*/
|
||||
private String rwUserIds;
|
||||
@TableField(typeHandler = JsonLongSetTypeHandler.class)
|
||||
private Set<Long> rwUserIds;
|
||||
/**
|
||||
* 联系人编号
|
||||
*/
|
||||
|
@@ -1,20 +1,24 @@
|
||||
package cn.iocoder.yudao.module.crm.dal.dataobject.customer;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.type.LongListTypeHandler;
|
||||
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
// TODO 芋艿:调整下字段
|
||||
|
||||
/**
|
||||
* 客户 DO
|
||||
*
|
||||
* @author Wanwan
|
||||
*/
|
||||
@TableName("crm_customer")
|
||||
@TableName(value = "crm_customer", autoResultMap = true)
|
||||
@KeySequence("crm_customer_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@@ -45,6 +49,24 @@ public class CrmCustomerDO extends BaseDO {
|
||||
* 成交状态
|
||||
*/
|
||||
private Boolean dealStatus;
|
||||
/**
|
||||
* 所属行业
|
||||
*
|
||||
* 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants#CRM_CUSTOMER_INDUSTRY}
|
||||
*/
|
||||
private Integer industryId;
|
||||
/**
|
||||
* 客户等级
|
||||
*
|
||||
* 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants#CRM_CUSTOMER_LEVEL}
|
||||
*/
|
||||
private Integer level;
|
||||
/**
|
||||
* 客户来源
|
||||
*
|
||||
* 对应字典 {@link cn.iocoder.yudao.module.crm.enums.DictTypeConstants#CRM_CUSTOMER_SOURCE}
|
||||
*/
|
||||
private Integer source;
|
||||
/**
|
||||
* 手机
|
||||
*/
|
||||
@@ -57,6 +79,22 @@ public class CrmCustomerDO extends BaseDO {
|
||||
* 网址
|
||||
*/
|
||||
private String website;
|
||||
/**
|
||||
* QQ
|
||||
*/
|
||||
private String qq;
|
||||
/**
|
||||
* wechat
|
||||
*/
|
||||
private String wechat;
|
||||
/**
|
||||
* email
|
||||
*/
|
||||
private String email;
|
||||
/**
|
||||
* 客户描述
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@@ -65,15 +103,16 @@ public class CrmCustomerDO extends BaseDO {
|
||||
* 负责人的用户编号
|
||||
*/
|
||||
private Long ownerUserId;
|
||||
// TODO @wanwan:下面两个字段,使用 List<Long>,然后使用 typeHandler = LongListTypeHandler 解决持久化的问题;注意类上需要加 autoResultMap = true
|
||||
/**
|
||||
* 只读权限的用户编号数组
|
||||
*/
|
||||
private String roUserIds;
|
||||
@TableField(typeHandler = LongListTypeHandler.class)
|
||||
private List<Long> roUserIds;
|
||||
/**
|
||||
* 读写权限的用户编号数组
|
||||
*/
|
||||
private String rwUserIds;
|
||||
@TableField(typeHandler = LongListTypeHandler.class)
|
||||
private List<Long> rwUserIds;
|
||||
/**
|
||||
* 地区编号
|
||||
*/
|
||||
@@ -82,15 +121,6 @@ public class CrmCustomerDO extends BaseDO {
|
||||
* 详细地址
|
||||
*/
|
||||
private String detailAddress;
|
||||
// TODO @wanwan:下面两个字段:删除
|
||||
/**
|
||||
* 地理位置经度
|
||||
*/
|
||||
private String longitude;
|
||||
/**
|
||||
* 地理位置维度
|
||||
*/
|
||||
private String latitude;
|
||||
/**
|
||||
* 最后跟进时间
|
||||
*/
|
||||
|
@@ -19,11 +19,10 @@ import java.util.List;
|
||||
public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> {
|
||||
|
||||
default PageResult<CrmCustomerDO> selectPage(CrmCustomerPageReqVO reqVO) {
|
||||
// TODO @Wanwan 填充负责人,所属部门字段;这个可以在 controller 填哈;
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<CrmCustomerDO>()
|
||||
.likeIfPresent(CrmCustomerDO::getName, reqVO.getName())
|
||||
.eqIfPresent(CrmCustomerDO::getMobile, reqVO.getMobile())
|
||||
.eqIfPresent(CrmCustomerDO::getTelephone, reqVO.getTelephone())
|
||||
.likeIfPresent(CrmCustomerDO::getWebsite, reqVO.getWebsite())
|
||||
.orderByDesc(CrmCustomerDO::getId));
|
||||
}
|
||||
|
||||
@@ -31,8 +30,6 @@ public interface CrmCustomerMapper extends BaseMapperX<CrmCustomerDO> {
|
||||
return selectList(new LambdaQueryWrapperX<CrmCustomerDO>()
|
||||
.likeIfPresent(CrmCustomerDO::getName, reqVO.getName())
|
||||
.eqIfPresent(CrmCustomerDO::getMobile, reqVO.getMobile())
|
||||
.eqIfPresent(CrmCustomerDO::getTelephone, reqVO.getTelephone())
|
||||
.likeIfPresent(CrmCustomerDO::getWebsite, reqVO.getWebsite())
|
||||
.orderByDesc(CrmCustomerDO::getId));
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,34 @@
|
||||
package cn.iocoder.yudao.module.crm.framework.utils;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
/**
|
||||
* 数据读写权限校验工具类
|
||||
*
|
||||
* @author HUIHUI
|
||||
*/
|
||||
public class AuthUtil {
|
||||
|
||||
/**
|
||||
* 判断当前数据对用户来说是否是只读的
|
||||
*
|
||||
* @param roUserIds 当前操作数据的只读权限的用户编号数组
|
||||
* @param userId 当前操作数据的用户编号
|
||||
* @return boolean 是/否
|
||||
*/
|
||||
public static boolean isReadOnly(Collection<Long> roUserIds, Long userId) {
|
||||
return roUserIds.contains(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断当前数据对用户来说是否是可读写的
|
||||
*
|
||||
* @param rwUserIds 当前操作数据的读写权限的用户编号数组
|
||||
* @param userId 当前操作数据的用户编号
|
||||
* @return boolean 是/否
|
||||
*/
|
||||
public static boolean isReadAndWrite(Collection<Long> rwUserIds, Long userId) {
|
||||
return rwUserIds.contains(userId);
|
||||
}
|
||||
|
||||
}
|
@@ -1,10 +1,7 @@
|
||||
package cn.iocoder.yudao.module.crm.service.business;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessCreateReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessExportReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessPageReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.business.vo.*;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
@@ -72,4 +69,12 @@ public interface CrmBusinessService {
|
||||
*/
|
||||
List<CrmBusinessDO> getBusinessList(CrmBusinessExportReqVO exportReqVO);
|
||||
|
||||
/**
|
||||
* 商机转移
|
||||
*
|
||||
* @param reqVO 请求
|
||||
* @param userId 用户编号
|
||||
*/
|
||||
void businessTransfer(CrmBusinessTransferReqVO reqVO, Long userId);
|
||||
|
||||
}
|
||||
|
@@ -3,13 +3,12 @@ package cn.iocoder.yudao.module.crm.service.business;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessCreateReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessExportReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessPageReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.business.vo.CrmBusinessUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.business.vo.*;
|
||||
import cn.iocoder.yudao.module.crm.convert.business.CrmBusinessConvert;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.business.CrmBusinessDO;
|
||||
import cn.iocoder.yudao.module.crm.dal.mysql.business.CrmBusinessMapper;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@@ -18,7 +17,8 @@ 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.BUSINESS_NOT_EXISTS;
|
||||
import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.module.crm.framework.utils.AuthUtil.isReadAndWrite;
|
||||
|
||||
/**
|
||||
* 商机 Service 实现类
|
||||
@@ -32,6 +32,9 @@ public class CrmBusinessServiceImpl implements CrmBusinessService {
|
||||
@Resource
|
||||
private CrmBusinessMapper businessMapper;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
@Override
|
||||
public Long createBusiness(CrmBusinessCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
@@ -58,10 +61,12 @@ public class CrmBusinessServiceImpl implements CrmBusinessService {
|
||||
businessMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateBusinessExists(Long id) {
|
||||
if (businessMapper.selectById(id) == null) {
|
||||
private CrmBusinessDO validateBusinessExists(Long id) {
|
||||
CrmBusinessDO crmBusiness = businessMapper.selectById(id);
|
||||
if (crmBusiness == null) {
|
||||
throw exception(BUSINESS_NOT_EXISTS);
|
||||
}
|
||||
return crmBusiness;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -87,4 +92,26 @@ public class CrmBusinessServiceImpl implements CrmBusinessService {
|
||||
return businessMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void businessTransfer(CrmBusinessTransferReqVO reqVO, Long userId) {
|
||||
// 1. 校验商机是否存在
|
||||
CrmBusinessDO business = validateBusinessExists(reqVO.getId());
|
||||
// 1.2. 校验用户是否拥有读写权限
|
||||
if (!isReadAndWrite(business.getRwUserIds(), userId)) {
|
||||
throw exception(BUSINESS_TRANSFER_FAIL_PERMISSION_DENIED);
|
||||
}
|
||||
// 2. 校验新负责人是否存在
|
||||
AdminUserRespDTO user = adminUserApi.getUser(reqVO.getOwnerUserId());
|
||||
if (user == null) {
|
||||
throw exception(BUSINESS_TRANSFER_FAIL_OWNER_USER_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 3. 更新新的负责人
|
||||
CrmBusinessDO updateBusiness = CrmBusinessConvert.INSTANCE.convert(business, reqVO, userId);
|
||||
businessMapper.updateById(updateBusiness);
|
||||
|
||||
// 4. TODO 记录商机转移日志
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -39,7 +39,7 @@ public class CrmClueServiceImpl implements CrmClueService {
|
||||
@Override
|
||||
public Long createClue(CrmClueCreateReqVO createReqVO) {
|
||||
// 校验客户是否存在
|
||||
validateCustomerExists(createReqVO.getCustomerId());
|
||||
customerService.validateCustomer(createReqVO.getCustomerId());
|
||||
// 插入
|
||||
CrmClueDO clue = CrmClueConvert.INSTANCE.convert(createReqVO);
|
||||
clueMapper.insert(clue);
|
||||
@@ -52,7 +52,7 @@ public class CrmClueServiceImpl implements CrmClueService {
|
||||
// 校验存在
|
||||
validateClueExists(updateReqVO.getId());
|
||||
// 校验客户是否存在
|
||||
validateCustomerExists(updateReqVO.getCustomerId());
|
||||
customerService.validateCustomer(updateReqVO.getCustomerId());
|
||||
|
||||
// 更新
|
||||
CrmClueDO updateObj = CrmClueConvert.INSTANCE.convert(updateReqVO);
|
||||
@@ -96,16 +96,4 @@ public class CrmClueServiceImpl implements CrmClueService {
|
||||
return clueMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
// TODO @wanwan:可以在 CrmClueServiceImpl 中,增加一个方法,用于校验客户是否存在;validateCustomer;然后其它方法可以调用它。不过要注意,需要把 CustomerDO 返回,因为其它模块可能要它的信息
|
||||
/**
|
||||
* 校验客户是否存在
|
||||
*
|
||||
* @param customerId 客户id
|
||||
*/
|
||||
private void validateCustomerExists(Long customerId) {
|
||||
if (customerService.getCustomer(customerId) == null) {
|
||||
throw exception(CUSTOMER_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,10 +1,12 @@
|
||||
package cn.iocoder.yudao.module.crm.service.contact;
|
||||
|
||||
import java.util.*;
|
||||
import javax.validation.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
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 javax.validation.Valid;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* crm联系人 Service 接口
|
||||
@@ -67,4 +69,12 @@ public interface ContactService {
|
||||
*/
|
||||
List<ContactDO> getContactList(ContactExportReqVO exportReqVO);
|
||||
|
||||
/**
|
||||
* 联系人编号
|
||||
*
|
||||
* @param reqVO 请求
|
||||
* @param userId 用户编号
|
||||
*/
|
||||
void contactTransfer(CrmContactTransferReqVO reqVO, Long userId);
|
||||
|
||||
}
|
||||
|
@@ -3,13 +3,12 @@ package cn.iocoder.yudao.module.crm.service.contact;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.ContactCreateReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.ContactExportReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.ContactPageReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.contact.vo.ContactUpdateReqVO;
|
||||
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.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@@ -18,7 +17,8 @@ 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;
|
||||
import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.module.crm.framework.utils.AuthUtil.isReadAndWrite;
|
||||
|
||||
/**
|
||||
* crm联系人 Service 实现类
|
||||
@@ -32,6 +32,9 @@ public class ContactServiceImpl implements ContactService {
|
||||
@Resource
|
||||
private ContactMapper contactMapper;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
@Override
|
||||
public Long createContact(ContactCreateReqVO createReqVO) {
|
||||
// TODO @customerId:需要校验存在
|
||||
@@ -61,10 +64,12 @@ public class ContactServiceImpl implements ContactService {
|
||||
contactMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateContactExists(Long id) {
|
||||
if (contactMapper.selectById(id) == null) {
|
||||
private ContactDO validateContactExists(Long id) {
|
||||
ContactDO contact = contactMapper.selectById(id);
|
||||
if (contact == null) {
|
||||
throw exception(CONTACT_NOT_EXISTS);
|
||||
}
|
||||
return contact;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -90,4 +95,26 @@ public class ContactServiceImpl implements ContactService {
|
||||
return contactMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contactTransfer(CrmContactTransferReqVO reqVO, Long userId) {
|
||||
// 1. 校验联系人是否存在
|
||||
ContactDO contact = validateContactExists(reqVO.getId());
|
||||
// 1.2. 校验用户是否拥有读写权限
|
||||
if (!isReadAndWrite(contact.getRwUserIds(), userId)) {
|
||||
throw exception(CONTACT_TRANSFER_FAIL_PERMISSION_DENIED);
|
||||
}
|
||||
// 2. 校验新负责人是否存在
|
||||
AdminUserRespDTO user = adminUserApi.getUser(reqVO.getOwnerUserId());
|
||||
if (user == null) {
|
||||
throw exception(CONTACT_TRANSFER_FAIL_OWNER_USER_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 3. 更新新的负责人
|
||||
ContactDO updateContact = ContactConvert.INSTANCE.convert(contact, reqVO, userId);
|
||||
contactMapper.updateById(updateContact);
|
||||
|
||||
// 4. TODO 记录联系人转移日志
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,10 +1,7 @@
|
||||
package cn.iocoder.yudao.module.crm.service.contract;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.ContractCreateReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.ContractExportReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.ContractPageReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.ContractUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.*;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.contract.ContractDO;
|
||||
|
||||
import javax.validation.Valid;
|
||||
@@ -72,4 +69,12 @@ public interface ContractService {
|
||||
*/
|
||||
List<ContractDO> getContractList(ContractExportReqVO exportReqVO);
|
||||
|
||||
/**
|
||||
* 合同转移
|
||||
*
|
||||
* @param reqVO 请求
|
||||
* @param userId 用户编号
|
||||
*/
|
||||
void contractTransfer(CrmContractTransferReqVO reqVO, Long userId);
|
||||
|
||||
}
|
||||
|
@@ -3,13 +3,12 @@ package cn.iocoder.yudao.module.crm.service.contract;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.ContractCreateReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.ContractExportReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.ContractPageReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.ContractUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.contract.vo.*;
|
||||
import cn.iocoder.yudao.module.crm.convert.contract.ContractConvert;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.contract.ContractDO;
|
||||
import cn.iocoder.yudao.module.crm.dal.mysql.contract.ContractMapper;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@@ -18,7 +17,8 @@ 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.CONTRACT_NOT_EXISTS;
|
||||
import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.*;
|
||||
import static cn.iocoder.yudao.module.crm.framework.utils.AuthUtil.isReadAndWrite;
|
||||
|
||||
/**
|
||||
* 合同 Service 实现类
|
||||
@@ -32,6 +32,9 @@ public class ContractServiceImpl implements ContractService {
|
||||
@Resource
|
||||
private ContractMapper contractMapper;
|
||||
|
||||
@Resource
|
||||
private AdminUserApi adminUserApi;
|
||||
|
||||
@Override
|
||||
public Long createContract(ContractCreateReqVO createReqVO) {
|
||||
// 插入
|
||||
@@ -58,10 +61,12 @@ public class ContractServiceImpl implements ContractService {
|
||||
contractMapper.deleteById(id);
|
||||
}
|
||||
|
||||
private void validateContractExists(Long id) {
|
||||
if (contractMapper.selectById(id) == null) {
|
||||
private ContractDO validateContractExists(Long id) {
|
||||
ContractDO contract = contractMapper.selectById(id);
|
||||
if (contract == null) {
|
||||
throw exception(CONTRACT_NOT_EXISTS);
|
||||
}
|
||||
return contract;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -87,4 +92,26 @@ public class ContractServiceImpl implements ContractService {
|
||||
return contractMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void contractTransfer(CrmContractTransferReqVO reqVO, Long userId) {
|
||||
// 1. 校验合同是否存在
|
||||
ContractDO contract = validateContractExists(reqVO.getId());
|
||||
// 1.2. 校验用户是否拥有读写权限
|
||||
if (!isReadAndWrite(contract.getRwUserIds(), userId)) {
|
||||
throw exception(CONTRACT_TRANSFER_FAIL_PERMISSION_DENIED);
|
||||
}
|
||||
// 2. 校验新负责人是否存在
|
||||
AdminUserRespDTO user = adminUserApi.getUser(reqVO.getOwnerUserId());
|
||||
if (user == null) {
|
||||
throw exception(CONTRACT_TRANSFER_FAIL_OWNER_USER_NOT_EXISTS);
|
||||
}
|
||||
|
||||
// 3. 更新新的负责人
|
||||
ContractDO updateContract = ContractConvert.INSTANCE.convert(contract, reqVO, userId);
|
||||
contractMapper.updateById(updateContract);
|
||||
|
||||
// 4. TODO 记录合同转移日志
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -72,4 +72,12 @@ public interface CrmCustomerService {
|
||||
*/
|
||||
List<CrmCustomerDO> getCustomerList(CrmCustomerExportReqVO exportReqVO);
|
||||
|
||||
/**
|
||||
* 校验客户是否存在
|
||||
*
|
||||
* @param customerId 客户 id
|
||||
* @return 客户
|
||||
*/
|
||||
CrmCustomerDO validateCustomer(Long customerId);
|
||||
|
||||
}
|
||||
|
@@ -1,22 +1,26 @@
|
||||
package cn.iocoder.yudao.module.crm.service.customer;
|
||||
|
||||
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.customer.vo.*;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerConvert;
|
||||
import cn.iocoder.yudao.module.crm.dal.mysql.customer.CrmCustomerMapper;
|
||||
|
||||
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.ListUtil;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerCreateReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerExportReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerPageReqVO;
|
||||
import cn.iocoder.yudao.module.crm.controller.admin.customer.vo.CrmCustomerUpdateReqVO;
|
||||
import cn.iocoder.yudao.module.crm.convert.customer.CrmCustomerConvert;
|
||||
import cn.iocoder.yudao.module.crm.dal.dataobject.customer.CrmCustomerDO;
|
||||
import cn.iocoder.yudao.module.crm.dal.mysql.customer.CrmCustomerMapper;
|
||||
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.iocoder.yudao.module.crm.enums.ErrorCodeConstants.CUSTOMER_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
* 客户 Service 实现类
|
||||
@@ -29,6 +33,8 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
|
||||
|
||||
@Resource
|
||||
private CrmCustomerMapper customerMapper;
|
||||
@Resource
|
||||
private DeptApi deptApi; // TODO @wanwan:拼接数据,可以放到 controller;所以这里的引入,可以考虑放到 controller 哈;
|
||||
|
||||
@Override
|
||||
public Long createCustomer(CrmCustomerCreateReqVO createReqVO) {
|
||||
@@ -43,6 +49,8 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
|
||||
public void updateCustomer(CrmCustomerUpdateReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateCustomerExists(updateReqVO.getId());
|
||||
// TODO 芋艿:数据权限,校验是否可以操作
|
||||
|
||||
// 更新
|
||||
CrmCustomerDO updateObj = CrmCustomerConvert.INSTANCE.convert(updateReqVO);
|
||||
customerMapper.updateById(updateObj);
|
||||
@@ -52,6 +60,8 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
|
||||
public void deleteCustomer(Long id) {
|
||||
// 校验存在
|
||||
validateCustomerExists(id);
|
||||
// TODO 芋艿:数据权限,校验是否可以操作
|
||||
|
||||
// 删除
|
||||
customerMapper.deleteById(id);
|
||||
}
|
||||
@@ -77,6 +87,7 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
|
||||
|
||||
@Override
|
||||
public PageResult<CrmCustomerDO> getCustomerPage(CrmCustomerPageReqVO pageReqVO) {
|
||||
// TODO 芋艿:数据权限,是否可以查询到;
|
||||
return customerMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
@@ -85,4 +96,20 @@ public class CrmCustomerServiceImpl implements CrmCustomerService {
|
||||
return customerMapper.selectList(exportReqVO);
|
||||
}
|
||||
|
||||
// TODO wanwan:service 接口已经注释,实现类就不需要了。
|
||||
/**
|
||||
* 校验客户是否存在
|
||||
*
|
||||
* @param customerId 客户id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public CrmCustomerDO validateCustomer(Long customerId) {
|
||||
CrmCustomerDO customer = getCustomer(customerId);
|
||||
if (Objects.isNull(customer)) {
|
||||
throw exception(CUSTOMER_NOT_EXISTS);
|
||||
}
|
||||
return customer;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -113,8 +113,6 @@ CREATE TABLE IF NOT EXISTS "crm_customer" (
|
||||
"rw_user_ids" varchar,
|
||||
"area_id" bigint,
|
||||
"detail_address" varchar,
|
||||
"longitude" varchar,
|
||||
"latitude" varchar,
|
||||
"contact_last_time" varchar,
|
||||
"contact_next_time" varchar,
|
||||
"creator" varchar DEFAULT '',
|
||||
|
Reference in New Issue
Block a user