This commit is contained in:
wangliwen 2022-04-26 16:32:26 +08:00
parent aff4b37d5c
commit 9e8401ea8e
1 changed files with 8 additions and 1 deletions

View File

@ -148,7 +148,14 @@ public class DemandDataListener implements TaskListener, ExecutionListener, Acti
private void complete(DelegateTask delegateTask) { private void complete(DelegateTask delegateTask) {
Map<String, Object> kv = delegateTask.getVariables(); Map<String, Object> kv = delegateTask.getVariables();
Gson gson = new Gson(); GsonBuilder builder = new GsonBuilder();
builder.registerTypeAdapter(Date.class, new JsonDeserializer<Date>() {
public Date deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
return new Date(json.getAsJsonPrimitive().getAsLong());
}
});
Gson gson = builder.create();
JsonElement jsonElement = gson.toJsonTree(kv); JsonElement jsonElement = gson.toJsonTree(kv);
TDemandDataDTO demandDataDTO = gson.fromJson(jsonElement, TDemandDataDTO.class); TDemandDataDTO demandDataDTO = gson.fromJson(jsonElement, TDemandDataDTO.class);