Commit 41c0df1b authored by 李腾威's avatar 李腾威

报警时一般火灾失火时间赋值修正

parent 83421d42
package com.yeejoin.amos.boot.module.jcs.biz.controller;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import com.alibaba.fastjson.JSONArray;
import org.apache.commons.lang3.StringUtils;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PathVariable;
......@@ -109,7 +113,7 @@ public class AlertFormController extends BaseController {
/**
* 根据表态类型code查询表单数据项
* @param id
* @param
* @return
*/
......@@ -120,7 +124,18 @@ public class AlertFormController extends BaseController {
List<AlertFormInitDto> list=new ArrayList<AlertFormInitDto>();
if(redisUtils.hasKey(RedisKey.FORM_CODE+code)){
Object obj= redisUtils.get(RedisKey.FORM_CODE+code);
return ResponseHelper.buildResponse(obj);
JSONArray arr = (JSONArray) obj;
List<AlertFormInitDto> list1 = arr.toJavaList(AlertFormInitDto.class);
for (AlertFormInitDto alertFormInitDto: list1) {
if(alertFormInitDto.getKey().equals("fireTime")) {
Date date = new Date();
alertFormInitDto.setDefaultValue(date);
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateString = formatter.format(date);
alertFormInitDto.getFormItemDescr().setFieldValue(dateString);
}
}
return ResponseHelper.buildResponse(JSON.toJSON(list1));
}else{
list= iAlertFormService.getFormlist(code);
redisUtils.set(RedisKey.FORM_CODE+code,JSON.toJSON(list),time);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment