✨ CRM:完成商机状态的变更
parent
740e9297fa
commit
c97c9f882e
@ -0,0 +1,45 @@
|
||||
package cn.iocoder.yudao.module.crm.enums.business;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 商机的结束状态枚举
|
||||
*
|
||||
* @author lzxhqs
|
||||
*/
|
||||
@RequiredArgsConstructor
|
||||
@Getter
|
||||
public enum CrmBusinessEndStatusEnum implements IntArrayValuable {
|
||||
|
||||
WIN(1, "赢单"),
|
||||
LOSE(2, "输单"),
|
||||
INVALID(3, "无效");
|
||||
|
||||
public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CrmBusinessEndStatusEnum::getStatus).toArray();
|
||||
|
||||
/**
|
||||
* 场景类型
|
||||
*/
|
||||
private final Integer status;
|
||||
/**
|
||||
* 场景名称
|
||||
*/
|
||||
private final String name;
|
||||
|
||||
@Override
|
||||
public int[] array() {
|
||||
return ARRAYS;
|
||||
}
|
||||
|
||||
public static CrmBusinessEndStatusEnum fromStatus(Integer status) {
|
||||
return Arrays.stream(values())
|
||||
.filter(value -> value.getStatus().equals(status))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package cn.iocoder.yudao.module.crm.controller.admin.business.vo.business;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.validation.InEnum;
|
||||
import cn.iocoder.yudao.module.crm.enums.business.CrmBusinessEndStatusEnum;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.AssertTrue;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - CRM 商机更新状态 Request VO")
|
||||
@Data
|
||||
public class CrmBusinessUpdateStatusReqVO {
|
||||
|
||||
@Schema(description = "商机编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "32129")
|
||||
@NotNull(message = "商机编号不能为空")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "状态编号", example = "1")
|
||||
private Long statusId;
|
||||
|
||||
@Schema(description = "结束状态", example = "1")
|
||||
@InEnum(value = CrmBusinessEndStatusEnum.class)
|
||||
private Integer endStatus;
|
||||
|
||||
@AssertTrue(message = "变更状态不正确")
|
||||
public boolean isStatusValid() {
|
||||
return statusId != null || endStatus != null;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue