Selaa lähdekoodia

fix: 添加审核判断

32197351@qq.com 1 vuosi sitten
vanhempi
commit
533a2ccdc8

+ 33 - 0
itdmServer/module-iTDM/src/main/java/org/jeecg/modules/weituo/common/ShenheStatus.java

@@ -0,0 +1,33 @@
+package org.jeecg.modules.weituo.common;
+
+import lombok.Getter;
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.Arrays;
+
+@Getter
+public enum ShenheStatus {
+    w("0", "未审核"),
+    t("1", "审核通过"),
+
+    j("2", "审核拒绝"),
+
+    ;
+
+
+    ShenheStatus(String code, String name) {
+        this.code = code;
+        this.name = name;
+    }
+
+    private  String code;
+    private  String name;
+
+
+    public static final String  getCode(String code) {
+        if (StringUtils.isEmpty(code)) {
+            return null;
+        }
+        return Arrays.stream(ShenheStatus.values()).filter(i -> code.equals(i.getCode())).map(i -> i.getName()).findFirst().orElse(null);
+    }
+}

+ 6 - 1
itdmServer/module-iTDM/src/main/java/org/jeecg/modules/weituo/service/impl/ItdmWeituoInfoServiceImpl.java

@@ -1,6 +1,8 @@
 package org.jeecg.modules.weituo.service.impl;
 
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import org.jeecg.common.exception.JeecgBootException;
+import org.jeecg.modules.weituo.common.ShenheStatus;
 import org.jeecg.modules.weituo.convert.WeituoConvert;
 import org.jeecg.modules.weituo.dto.WeituoInsertCommand;
 import org.jeecg.modules.weituo.dto.WeituoUpdateCommand;
@@ -43,6 +45,7 @@ public class ItdmWeituoInfoServiceImpl extends ServiceImpl<ItdmWeituoInfoMapper,
     public void saveWeituo(WeituoInsertCommand command) {
 
         ItdmWeituoInfo itdmWeituoInfo = WeituoConvert.INSTANCE.convert(command);
+        itdmWeituoInfo.setShenheStatus("0");
 
 
         this.baseMapper.insert(itdmWeituoInfo);
@@ -70,7 +73,9 @@ public class ItdmWeituoInfoServiceImpl extends ServiceImpl<ItdmWeituoInfoMapper,
     @Override
     public void updateWeituo(WeituoUpdateCommand command) {
         ItdmWeituoInfo itdmWeituoInfo = WeituoConvert.INSTANCE.convert(command);
-
+        if (itdmWeituoInfo.getShenheStatus().equals(ShenheStatus.t.getCode())) {
+            throw new JeecgBootException("审核通过不能修改数据");
+        }
 
         this.baseMapper.updateById(itdmWeituoInfo);