维修工单状态枚举

This commit is contained in:
Vinjor 2024-10-18 14:41:15 +08:00
parent 309b6484c9
commit 6386be7e7d
4 changed files with 127 additions and 10 deletions

View File

@ -8,14 +8,5 @@ package cn.iocoder.yudao.common;
**/
public class RepairConstants {
public static final String SERVICE_ADVISOR = "维修服务顾问";
public static final String GENERAL_INSPECTION = "维修总检";
public static final String TEAM_LEADER = "班组长";
public static final String REPAIR_STAFF = "维修工";
public static final String REPAIR_WAREHOUSE = "维修仓库管理员";
}

View File

@ -0,0 +1,65 @@
package cn.iocoder.yudao.common;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 维修工单状态枚举
*
* @author vinjor-m
*/
@AllArgsConstructor
@Getter
public enum TicketsStatusEnum {
/**
* 未派工
*/
NO_WORK("04","未派工"),
/**
* 施工中
*/
WORKING("05","施工中"),
/**
* 未结账
*/
NO_PAY("01","未结账"),
/**
* 挂单/记账
*/
ACCOUNTING("06","挂单/记账"),
/**
* 已结账
*/
CHECK_OUT("02","已结账"),
/**
* 已作废
*/
CANCEL("03","已作废");
/**
* 角色code
*/
private String code;
/**
* 角色名称
*/
private String name;
/**
* 根据角色code返回对应的枚举
* @author vinjor-M
* @date 14:23 2024/10/16
* @param code 角色code
* @return cn.iocoder.yudao.common.SystemEnum
**/
public static TicketsStatusEnum getRepairRole(String code) {
for (TicketsStatusEnum roleEnum : TicketsStatusEnum.values()) {
if (roleEnum.getCode().equalsIgnoreCase(code)) {
// 找到对应的枚举
return roleEnum;
}
}
throw new IllegalArgumentException("无效的角色code" + code);
}
}

View File

@ -0,0 +1,57 @@
package cn.iocoder.yudao.common;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 维修工单施工状态枚举
*
* @author vinjor-m
*/
@AllArgsConstructor
@Getter
public enum TicketsWorkStatusEnum {
/**
* 等待接单
*/
WAITING_RECEIVING("01","等待接单"),
/**
* 已接单
*/
RECEIVED("04","已接单"),
/**
* 施工中
*/
DOING("02","施工中"),
/**
* 已完成
*/
END("03","已完成");
/**
* 角色code
*/
private String code;
/**
* 角色名称
*/
private String name;
/**
* 根据角色code返回对应的枚举
* @author vinjor-M
* @date 14:23 2024/10/16
* @param code 角色code
* @return cn.iocoder.yudao.common.SystemEnum
**/
public static TicketsWorkStatusEnum getRepairRole(String code) {
for (TicketsWorkStatusEnum roleEnum : TicketsWorkStatusEnum.values()) {
if (roleEnum.getCode().equalsIgnoreCase(code)) {
// 找到对应的枚举
return roleEnum;
}
}
throw new IllegalArgumentException("无效的角色code" + code);
}
}

View File

@ -5,6 +5,8 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.iocoder.yudao.common.RepairErrorCodeConstants;
import cn.iocoder.yudao.common.RepairRoleEnum;
import cn.iocoder.yudao.common.TicketsStatusEnum;
import cn.iocoder.yudao.common.TicketsWorkStatusEnum;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.base.entity.RepairWorker;
import cn.iocoder.yudao.module.base.service.RepairWorkerService;
@ -166,7 +168,9 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
List<DlRepairTitem> collect = itemList.stream().filter(item -> item.getItemType().equals("02")).collect(Collectors.toList());
ticketsRespVO.setPartStatus(CollectionUtil.isEmpty(collect) ? "01" : "02");
// 工单进行状态 默认是等待接单
ticketsRespVO.setTicketsWorkStatus("01");
ticketsRespVO.setTicketsWorkStatus(TicketsWorkStatusEnum.WAITING_RECEIVING.getCode());
// 工单状态 默认是待派工
ticketsRespVO.setTicketsStatus(TicketsStatusEnum.NO_WORK.getCode());
// 新增主表
baseMapper.insert(ticketsRespVO);