Antiloveg 8 anos atrás
pai
commit
1e19ea835a

+ 58 - 0
src/main/java/com/goafanti/common/enums/DemandStatus.java

@@ -0,0 +1,58 @@
+package com.goafanti.common.enums;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.commons.lang3.StringUtils;
+
+public enum DemandStatus {
+	
+	ONGOING(0, "进行中"),
+	UNRESOLVED(1,"未解决"),
+	SOLVED(2,"已解决"),
+	OTHER(3, "其他");
+
+	private DemandStatus(Integer code, String desc) {
+		this.code = code;
+		this.desc = desc;
+	}
+
+	private static Map<Integer, DemandStatus> status = new HashMap<Integer, DemandStatus>();
+
+	static {
+		for (DemandStatus value : DemandStatus.values()) {
+			status.put(value.getCode(), value);
+		}
+	}
+
+	public static DemandStatus getStatus(Integer code) {
+		if (containsType(code)) {
+			return status.get(code);
+		}
+		return OTHER;
+	}
+
+	public static DemandStatus getStatus(String code) {
+		if (StringUtils.isNumeric(code)) {
+			return getStatus(Integer.parseInt(code));
+		}
+		return OTHER;
+	}
+
+	public static boolean containsType(Integer code) {
+		return status.containsKey(code);
+	}
+
+	private Integer	code;
+	private String	desc;
+
+	public Integer getCode() {
+		return code;
+	}
+
+	public String getDesc() {
+		return desc;
+	}
+	
+
+}

+ 2 - 0
src/main/java/com/goafanti/demand/service/impl/DemandServiceImpl.java

@@ -17,6 +17,7 @@ import com.goafanti.common.dao.DemandMapper;
 import com.goafanti.common.enums.DeleteStatus;
 import com.goafanti.common.enums.DemandDataCategory;
 import com.goafanti.common.enums.DemandReleaseStatus;
+import com.goafanti.common.enums.DemandStatus;
 import com.goafanti.common.model.Demand;
 import com.goafanti.common.model.DemandLog;
 import com.goafanti.common.utils.DateUtils;
@@ -280,6 +281,7 @@ public class DemandServiceImpl extends BaseMybatisDao<DemandMapper> implements D
 		
 		if (DemandReleaseStatus.RELEASED.getCode().equals(d.getReleaseStatus())){
 			d.setReleaseDate(now.getTime());
+			d.setStatus(DemandStatus.ONGOING.getCode());
 			DemandLog log = new DemandLog();
 			log.setId(UUID.randomUUID().toString());
 			log.setDemandId(d.getId());