!86 refactor(xispeak): 提取公共常量BpmStatus枚举,统一bpmStatus字段类型为String
Merge pull request !86 from wsm/feature/multi_depart_import
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
package org.jeecg.modules.bg.constant;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 流程业务状态
|
||||
*/
|
||||
public enum BpmStatus {
|
||||
|
||||
NOT_START("1", "未发起"),
|
||||
SUPERVISING("2", "督办中"),
|
||||
FINISH("3", "已完成");
|
||||
|
||||
private final String code;
|
||||
private final String label;
|
||||
|
||||
BpmStatus(String code, String label) {
|
||||
this.code = code;
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public static BpmStatus fromCode(String code) {
|
||||
if (code == null) return null;
|
||||
return Arrays.stream(values())
|
||||
.filter(s -> s.code.equals(code))
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
}
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package org.jeecg.modules.bg.constant;
|
||||
|
||||
/**
|
||||
* 监督模块通用常量
|
||||
*/
|
||||
public final class SupervisionConstant {
|
||||
|
||||
private SupervisionConstant() {
|
||||
throw new UnsupportedOperationException("This is a constant class and cannot be instantiated");
|
||||
}
|
||||
|
||||
/** 删除标记 */
|
||||
public static final class DelFlag {
|
||||
/** 未删除 */
|
||||
public static final String NORMAL = "0";
|
||||
/** 已删除 */
|
||||
public static final String DELETED = "1";
|
||||
}
|
||||
|
||||
/** Java 属性名(用于反射/PropertyUtils) */
|
||||
public static final class ClassFieldName {
|
||||
public static final String BPM_STATUS_NAME = "bpmStatus";
|
||||
public static final String DEL_FLAG_NAME = "delFlag";
|
||||
}
|
||||
}
|
||||
+1
@@ -15,4 +15,5 @@ public final class XiSpeakConstant {
|
||||
public static final int FINISHED = 1; // 已完成
|
||||
public static final int UN_FINISHED = 0; // 未完成
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+15
-5
@@ -20,6 +20,9 @@ import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.system.query.QueryGenerator;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.common.system.vo.SelectTreeModel;
|
||||
import org.jeecg.modules.bg.constant.BpmStatus;
|
||||
import org.jeecg.modules.bg.constant.SupervisionConstant;
|
||||
|
||||
import org.jeecg.modules.bg.xispeak.entity.BgXiSpeak;
|
||||
import org.jeecg.modules.bg.xispeak.entity.BgXiSpeakFeedback;
|
||||
import org.jeecg.modules.bg.xispeak.service.IBgXiSpeakService;
|
||||
@@ -28,6 +31,8 @@ import org.jeecg.modules.bg.xispeak.service.IBgXiSpeakFeedbackService;
|
||||
import org.jeecg.modules.bg.xispeak.dto.BgXiSpeakBpmSaveDTO;
|
||||
import org.flowable.engine.RuntimeService;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import org.jeecg.modules.demo.bgpartymatter.constant.BgPartymatterConstant;
|
||||
import org.jeecg.modules.demo.bgpartymatter.entity.BgPartymatter;
|
||||
import org.jeecg.modules.tasktask.entity.TaskTask;
|
||||
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
||||
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
||||
@@ -114,15 +119,15 @@ public class BgXiSpeakController extends JeecgController<BgXiSpeak, IBgXiSpeakSe
|
||||
int notStarted = 0, inProgress = 0, overdue = 0, completed = 0;
|
||||
java.time.LocalDate today = java.time.LocalDate.now();
|
||||
for (BgXiSpeak item : list) {
|
||||
Integer status = item.getBpmStatus();
|
||||
if (Integer.valueOf(1).equals(status)) {
|
||||
BpmStatus bpmStatus = BpmStatus.fromCode(item.getBpmStatus());
|
||||
if (bpmStatus == BpmStatus.NOT_START) {
|
||||
notStarted++;
|
||||
} else if (Integer.valueOf(2).equals(status)) {
|
||||
} else if (bpmStatus == BpmStatus.SUPERVISING) {
|
||||
inProgress++;
|
||||
if (item.getDeadline() != null && item.getDeadline().toInstant().atZone(java.time.ZoneId.systemDefault()).toLocalDate().isBefore(today)) {
|
||||
overdue++;
|
||||
}
|
||||
} else if (Integer.valueOf(3).equals(status)) {
|
||||
} else if (bpmStatus == BpmStatus.FINISH) {
|
||||
completed++;
|
||||
}
|
||||
}
|
||||
@@ -414,7 +419,12 @@ public class BgXiSpeakController extends JeecgController<BgXiSpeak, IBgXiSpeakSe
|
||||
@RequiresPermissions("bg.xispeak:bg_xi_speak:importExcel")
|
||||
@RequestMapping(value = "/importExcelByEasyExcel", method = RequestMethod.POST)
|
||||
public Result<?> importExcelByEasyExcel(HttpServletRequest request) {
|
||||
return super.importExcelByEasyExcel(request, BgXiSpeak.class);
|
||||
return super.importExcelByEasyExcel(request,BgXiSpeak.class,
|
||||
Map.of(
|
||||
SupervisionConstant.ClassFieldName.BPM_STATUS_NAME,
|
||||
BpmStatus.NOT_START.getCode(),
|
||||
SupervisionConstant.ClassFieldName.DEL_FLAG_NAME,
|
||||
SupervisionConstant.DelFlag.NORMAL));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -183,7 +183,7 @@ public class BgXiSpeak implements Serializable {
|
||||
/**流程引擎状态字段*/
|
||||
@Dict( dicCode = "super_status" )
|
||||
@Schema(description = "督办状态")
|
||||
private java.lang.Integer bpmStatus;
|
||||
private java.lang.String bpmStatus;
|
||||
/**督办次数*/
|
||||
@Excel(name = "督办次数", width = 15)
|
||||
@ExcelColumn(name = "督办次数", width = 15)
|
||||
|
||||
+1
-1
@@ -157,7 +157,7 @@ public class BgXiSpeakFeedback implements Serializable {
|
||||
/**流程引擎状态字段*/
|
||||
@Excel(name = "流程引擎状态字段", width = 15)
|
||||
@Schema(description = "流程引擎状态字段")
|
||||
private java.lang.Integer bpmStatus;
|
||||
private java.lang.String bpmStatus;
|
||||
|
||||
/**审批信息Map*/
|
||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||
|
||||
+2
-1
@@ -9,6 +9,7 @@ import java.util.Objects;
|
||||
import org.jeecg.common.exception.JeecgBootException;
|
||||
import org.jeecg.common.util.oConvertUtils;
|
||||
import org.jeecg.common.system.vo.SelectTreeModel;
|
||||
import org.jeecg.modules.bg.constant.BpmStatus;
|
||||
import org.jeecg.modules.bg.xispeak.entity.BgXiSpeak;
|
||||
import org.jeecg.modules.bg.xispeak.entity.DeptApproveDetail;
|
||||
import org.jeecg.modules.bg.xispeak.entity.DeptApproveDetailMap;
|
||||
@@ -53,7 +54,7 @@ public class BgXiSpeakServiceImpl extends ServiceImpl<BgXiSpeakMapper, BgXiSpeak
|
||||
//新增时设置hasChild为0
|
||||
bgXiSpeak.setHasChild(IBgXiSpeakService.NOCHILD);
|
||||
if (bgXiSpeak.getBpmStatus() == null) {
|
||||
bgXiSpeak.setBpmStatus(1);
|
||||
bgXiSpeak.setBpmStatus(BpmStatus.NOT_START.getCode());
|
||||
}
|
||||
if(oConvertUtils.isEmpty(bgXiSpeak.getPid())){
|
||||
bgXiSpeak.setPid(IBgXiSpeakService.ROOT_PID_VALUE);
|
||||
|
||||
Reference in New Issue
Block a user