1:增加多选枚举的功能。
parent
f85dd4cbe5
commit
6be9a55983
@ -0,0 +1,25 @@
|
||||
package cn.estsh.i3plus.pojo.aps.converter;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonParser;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
||||
import com.fasterxml.jackson.databind.JsonDeserializer;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class CustomDateDeserializer extends JsonDeserializer<Date> {
|
||||
public static SimpleDateFormat DATETIME_FORMATOR = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@Override
|
||||
public Date deserialize(JsonParser jsonParser, DeserializationContext deserializationContext) throws IOException, JsonProcessingException {
|
||||
try {
|
||||
return DATETIME_FORMATOR.parse(jsonParser.getText());
|
||||
} catch (ParseException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package cn.estsh.i3plus.pojo.aps.converter;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonGenerator;
|
||||
import com.fasterxml.jackson.databind.JsonSerializer;
|
||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
public class CustomDateSerializer extends JsonSerializer<Date> {
|
||||
public static SimpleDateFormat DATETIME_FORMATOR = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@Override
|
||||
public void serialize(Date date, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
|
||||
jsonGenerator.writeString(DATETIME_FORMATOR.format(date));
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package cn.estsh.i3plus.pojo.aps.enums;
|
||||
|
||||
public enum CALENDAR_WEEK {
|
||||
NONE(0), // 不进行任何制约
|
||||
MONDAY(1), // 星期一
|
||||
TUESDAY(2), // 星期二
|
||||
WEDNESDAY(4), // 星期三
|
||||
THURSDAY(8), // 星期四
|
||||
FRIDAY(16), // 星期五
|
||||
SATURDAY(32), // 星期六
|
||||
SUNDAY(64); // 星期天
|
||||
|
||||
private int _value;
|
||||
|
||||
CALENDAR_WEEK(int value) {
|
||||
_value = value;
|
||||
}
|
||||
|
||||
public int value() {
|
||||
return this._value;
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
package cn.estsh.i3plus.pojo.aps.enums;
|
||||
|
||||
public enum RULE_TYPE {
|
||||
CANCEL_PLAN,
|
||||
MAT_CALC,
|
||||
HEURISTIC,
|
||||
FIELD_SET
|
||||
}
|
@ -1,26 +1,23 @@
|
||||
package cn.estsh.i3plus.pojo.aps.model;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import cn.estsh.i3plus.pojo.aps.converter.CustomDateDeserializer;
|
||||
import cn.estsh.i3plus.pojo.aps.converter.CustomDateSerializer;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class GanttCalendarModel {
|
||||
@Data
|
||||
public static class Block {
|
||||
private Long resourceId;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date beginTime;
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date endTime;
|
||||
private Boolean onDuty;
|
||||
}
|
||||
private Long resourceId;
|
||||
private List<Block> timeBlocks = new ArrayList<>();
|
||||
private Long parent;
|
||||
@JsonSerialize(using = CustomDateSerializer.class)
|
||||
@JsonDeserialize(using = CustomDateDeserializer.class)
|
||||
private Date start_date;
|
||||
@JsonSerialize(using = CustomDateSerializer.class)
|
||||
@JsonDeserialize(using = CustomDateDeserializer.class)
|
||||
private Date end_date;
|
||||
private String color;
|
||||
private Long id;
|
||||
private String text;
|
||||
}
|
||||
|
Loading…
Reference in New Issue