Commit be9cb32a authored by H2T's avatar H2T

敬请报送和救援过程中修改数据产生历史记录

parent 37c8f0c8
...@@ -67,4 +67,10 @@ public class AlertFormRecordDto extends BaseDto { ...@@ -67,4 +67,10 @@ public class AlertFormRecordDto extends BaseDto {
@ApiModelProperty(value = "备注") @ApiModelProperty(value = "备注")
private String remarks; private String remarks;
@ApiModelProperty(value = "信息来源(1:警情报送,2:救援过程,3:警情编辑)")
private String sourcesInfo;
@ApiModelProperty(value = "操作人员真实姓名")
private String recUserRealName;
} }
...@@ -111,4 +111,16 @@ public class AlertFormRecord extends BaseEntity { ...@@ -111,4 +111,16 @@ public class AlertFormRecord extends BaseEntity {
@TableField("remarks") @TableField("remarks")
private String remarks; private String remarks;
/**
* 信息来源(1:警情报送,2:救援过程,3:警情编辑)
*/
@TableField("sources_info")
private String sourcesInfo;
/**
* 操作人员真实姓名
*/
@TableField("rec_user_real_name")
private String recUserRealName;
} }
package com.yeejoin.amos.boot.module.elevator.api.enums;
/**
* 信息来源枚举(1:警情报送,2:救援过程,3:警情编辑)
*/
public enum SourcesInfoEnum {
Submit(1, "警情报送"), Process(2, "救援过程"), Edit(3, "警情编辑");
/**
* 编码
*/
private final Integer code;
/**
* 名称
*/
private final String name;
// 构造方法
SourcesInfoEnum(Integer code, String name) {
this.code = code;
this.name = name;
}
public static SourcesInfoEnum getEnum(Integer code) {
for (SourcesInfoEnum liftDirectionEnum : SourcesInfoEnum.values()) {
if (liftDirectionEnum.getCode().equals(code)) {
return liftDirectionEnum;
}
}
return null;
}
public Integer getCode() {
return code;
}
public String getName() {
return name;
}
}
...@@ -19,10 +19,9 @@ public interface IAlertFormRecordService { ...@@ -19,10 +19,9 @@ public interface IAlertFormRecordService {
/** /**
* 保存警情修改记录 * 保存警情修改记录
* *
* @param map 包含新旧数据的map
* @return * @return
*/ */
ResponseModel<Object> saveAlertFormRecord(Map<String, AlertFormRecordDto> map); ResponseModel<Object> saveAlertFormRecord(AlertFormRecordDto record);
/** /**
* 根据警情id查询所有修改记录 * 根据警情id查询所有修改记录
......
...@@ -4,6 +4,8 @@ package com.yeejoin.amos.boot.module.elevator.api.service; ...@@ -4,6 +4,8 @@ package com.yeejoin.amos.boot.module.elevator.api.service;
import com.yeejoin.amos.boot.module.elevator.api.dto.RescueProcessDto; import com.yeejoin.amos.boot.module.elevator.api.dto.RescueProcessDto;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import java.text.ParseException;
/** /**
* 救援过程表接口类 * 救援过程表接口类
* *
...@@ -24,7 +26,7 @@ public interface IRescueProcessService { ...@@ -24,7 +26,7 @@ public interface IRescueProcessService {
* @param rescueProcessDto * @param rescueProcessDto
* @return * @return
*/ */
Boolean updateByAlertId(RescueProcessDto rescueProcessDto, AgencyUserModel sendUser); Boolean updateByAlertId(RescueProcessDto rescueProcessDto, AgencyUserModel sendUser) throws ParseException;
/** /**
* 根据警情id 更新救援过程表 * 根据警情id 更新救援过程表
......
...@@ -13,6 +13,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey; ...@@ -13,6 +13,7 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil; import com.yeejoin.amos.boot.module.common.api.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.common.biz.service.impl.MaintenanceCompanyServiceImpl; import com.yeejoin.amos.boot.module.common.biz.service.impl.MaintenanceCompanyServiceImpl;
import com.yeejoin.amos.boot.module.elevator.api.enums.SourcesInfoEnum;
import com.yeejoin.amos.boot.module.elevator.biz.service.impl.*; import com.yeejoin.amos.boot.module.elevator.biz.service.impl.*;
import com.yeejoin.amos.boot.module.elevator.api.dto.*; import com.yeejoin.amos.boot.module.elevator.api.dto.*;
import com.yeejoin.amos.boot.module.elevator.api.entity.*; import com.yeejoin.amos.boot.module.elevator.api.entity.*;
...@@ -20,6 +21,7 @@ import com.yeejoin.amos.boot.module.elevator.api.enums.AlertStageEnums; ...@@ -20,6 +21,7 @@ import com.yeejoin.amos.boot.module.elevator.api.enums.AlertStageEnums;
import com.yeejoin.amos.boot.module.elevator.api.service.TzsAuthService; import com.yeejoin.amos.boot.module.elevator.api.service.TzsAuthService;
import com.yeejoin.amos.boot.module.elevator.biz.utils.AlertBeanDtoVoUtils; import com.yeejoin.amos.boot.module.elevator.biz.utils.AlertBeanDtoVoUtils;
import com.yeejoin.amos.boot.module.elevator.biz.utils.BeanDtoVoUtils; import com.yeejoin.amos.boot.module.elevator.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.boot.module.elevator.flc.biz.service.impl.AlertFormRecordServiceImpl;
import com.yeejoin.amos.component.feign.utils.FeignUtil; import com.yeejoin.amos.component.feign.utils.FeignUtil;
import com.yeejoin.amos.feign.privilege.Privilege; import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
...@@ -51,6 +53,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel; ...@@ -51,6 +53,7 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
/** /**
...@@ -112,6 +115,9 @@ public class AlertCalledController extends BaseController { ...@@ -112,6 +115,9 @@ public class AlertCalledController extends BaseController {
private ElevatorServiceImpl iElevatorService; private ElevatorServiceImpl iElevatorService;
@Autowired @Autowired
private AlertFormRecordServiceImpl alertFormRecordService;
@Autowired
CtiServiceImpl ctiService; CtiServiceImpl ctiService;
/** /**
...@@ -141,6 +147,31 @@ public class AlertCalledController extends BaseController { ...@@ -141,6 +147,31 @@ public class AlertCalledController extends BaseController {
} }
AgencyUserModel userModel = reginParams.getUserModel(); AgencyUserModel userModel = reginParams.getUserModel();
alertCalledObjsDto = iAlertCalledService.createAlertCalled(alertCalledObjsDto, userModel); alertCalledObjsDto = iAlertCalledService.createAlertCalled(alertCalledObjsDto, userModel);
try {
//更新警情历史记录表
AlertCalledDto alertCalledDto = alertCalledObjsDto.getAlertCalledDto();
List<AlertFormValue> alertFormValue = alertCalledObjsDto.getAlertFormValue();
HashMap<String, String> formMap = new HashMap<>();
alertFormValue.forEach(x-> formMap.put(x.getFieldCode(),x.getFieldValue()));
AlertFormRecordDto alertFormRecordDto = new AlertFormRecordDto();
alertFormRecordDto.setAlertCalledId(alertCalledDto.getSequenceNbr());
alertFormRecordDto.setAlertTypeCode(alertCalledDto.getAlertSourceCode());
alertFormRecordDto.setName(alertCalledDto.getEmergencyPerson());
alertFormRecordDto.setPhone(alertCalledDto.getContactPhone());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
alertFormRecordDto.setTrappedTime(sdf.parse(formMap.getOrDefault("trapped_time", new Date().toString())));
alertFormRecordDto.setTrappedNum(Integer.parseInt(formMap.getOrDefault("trapped_num", "0")));
alertFormRecordDto.setInjuredNum(Integer.parseInt(formMap.getOrDefault("injured_num", "0")));
alertFormRecordDto.setDieNum(Integer.parseInt(formMap.getOrDefault("die_num", "0")));
alertFormRecordDto.setTrappedFloorNum(Integer.parseInt(formMap.getOrDefault("trapped_floor_num", "0")));
alertFormRecordDto.setIsLight("是".equals(formMap.get("is_light")) ? 1 : 0);
alertFormRecordDto.setDescription((String) formMap.getOrDefault("desc", ""));
alertFormRecordDto.setSourcesInfo(SourcesInfoEnum.Submit.getCode().toString());
alertFormRecordService.saveAlertFormRecord(alertFormRecordDto);
}catch (Exception e){
e.printStackTrace();
}
// 坐席接警后,辅屏由常态化切换为处置态 // 坐席接警后,辅屏由常态化切换为处置态
JSONObject jsonObject = new JSONObject(); JSONObject jsonObject = new JSONObject();
...@@ -221,8 +252,7 @@ public class AlertCalledController extends BaseController { ...@@ -221,8 +252,7 @@ public class AlertCalledController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getAlertInfo") @GetMapping(value = "/getAlertInfo")
@ApiOperation(httpMethod = "GET", value = "警情信息", notes = "警情信息") @ApiOperation(httpMethod = "GET", value = "警情信息", notes = "警情信息")
public ResponseModel<AlertPaperInfoDto> getAlertInfo(@RequestParam Long alertId public ResponseModel<AlertPaperInfoDto> getAlertInfo(@RequestParam Long alertId) {
) {
AlertCalled alertCalled = iAlertCalledService.getById(alertId); AlertCalled alertCalled = iAlertCalledService.getById(alertId);
AlertPaperInfoDto alertPaperInfoDto = new AlertPaperInfoDto(); AlertPaperInfoDto alertPaperInfoDto = new AlertPaperInfoDto();
alertPaperInfoDto.setAlertId(alertCalled.getSequenceNbr()); alertPaperInfoDto.setAlertId(alertCalled.getSequenceNbr());
......
...@@ -33,13 +33,8 @@ public class AlertFormRecordController { ...@@ -33,13 +33,8 @@ public class AlertFormRecordController {
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/saveRecord") @PostMapping(value = "/saveRecord")
@ApiOperation(httpMethod = "POST", value = "新增警情接警填报记录", notes = "新增警情接警填报记录") @ApiOperation(httpMethod = "POST", value = "新增警情接警填报记录", notes = "新增警情接警填报记录")
public ResponseModel<Object> saveRecord(@RequestBody Map<String, AlertFormRecordDto> map) { public ResponseModel<Object> saveRecord(@RequestBody AlertFormRecordDto record) {
return ResponseHelper.buildResponse(iAlertFormRecordService.saveAlertFormRecord(record));
if (ObjectUtil.isNotEmpty(map.get("oldData")) && ObjectUtil.isNotEmpty(map.get("newData"))) {
return ResponseHelper.buildResponse(iAlertFormRecordService.saveAlertFormRecord(map));
} else {
return ResponseHelper.buildResponse("缺少数据");
}
} }
......
...@@ -9,18 +9,18 @@ import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl; ...@@ -9,18 +9,18 @@ import com.yeejoin.amos.boot.biz.common.service.impl.DataDictionaryServiceImpl;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.elevator.api.dto.DispatchPaperFormDto; import com.yeejoin.amos.boot.module.elevator.api.dto.*;
import com.yeejoin.amos.boot.module.elevator.api.dto.DispatchTaskDto;
import com.yeejoin.amos.boot.module.elevator.api.dto.RescueProcessDto;
import com.yeejoin.amos.boot.module.elevator.api.entity.AlertCalled; import com.yeejoin.amos.boot.module.elevator.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.elevator.api.entity.AlertFormValue; import com.yeejoin.amos.boot.module.elevator.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.elevator.api.entity.DispatchPaper; import com.yeejoin.amos.boot.module.elevator.api.entity.DispatchPaper;
import com.yeejoin.amos.boot.module.elevator.api.entity.DispatchTask; import com.yeejoin.amos.boot.module.elevator.api.entity.DispatchTask;
import com.yeejoin.amos.boot.module.elevator.api.entity.RescueProcess; import com.yeejoin.amos.boot.module.elevator.api.entity.RescueProcess;
import com.yeejoin.amos.boot.module.elevator.api.enums.DispatchPaperEnums; import com.yeejoin.amos.boot.module.elevator.api.enums.DispatchPaperEnums;
import com.yeejoin.amos.boot.module.elevator.api.enums.SourcesInfoEnum;
import com.yeejoin.amos.boot.module.elevator.api.mapper.RescueProcessMapper; import com.yeejoin.amos.boot.module.elevator.api.mapper.RescueProcessMapper;
import com.yeejoin.amos.boot.module.elevator.api.service.IRescueProcessService; import com.yeejoin.amos.boot.module.elevator.api.service.IRescueProcessService;
import com.yeejoin.amos.boot.module.elevator.biz.utils.BeanDtoVoUtils; import com.yeejoin.amos.boot.module.elevator.biz.utils.BeanDtoVoUtils;
import com.yeejoin.amos.boot.module.elevator.flc.biz.service.impl.AlertFormRecordServiceImpl;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -31,6 +31,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest; ...@@ -31,6 +31,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
/** /**
...@@ -58,6 +59,9 @@ public class RescueProcessServiceImpl extends BaseService<RescueProcessDto,Rescu ...@@ -58,6 +59,9 @@ public class RescueProcessServiceImpl extends BaseService<RescueProcessDto,Rescu
RepairConsultServiceImpl repairConsultServiceImpl; RepairConsultServiceImpl repairConsultServiceImpl;
@Autowired @Autowired
private AlertFormRecordServiceImpl alertFormRecordService;
@Autowired
AlertCalledServiceImpl iAlertCalledService; AlertCalledServiceImpl iAlertCalledService;
@Autowired @Autowired
...@@ -178,6 +182,29 @@ public class RescueProcessServiceImpl extends BaseService<RescueProcessDto,Rescu ...@@ -178,6 +182,29 @@ public class RescueProcessServiceImpl extends BaseService<RescueProcessDto,Rescu
if (Boolean.TRUE.equals(rescueProcessDto.getCasualtiesStatus())){ if (Boolean.TRUE.equals(rescueProcessDto.getCasualtiesStatus())){
updateMessage(rescueProcessDto, "injured_num"); updateMessage(rescueProcessDto, "injured_num");
updateMessage(rescueProcessDto, "die_num"); updateMessage(rescueProcessDto, "die_num");
try {
//更新警情历史记录表
AlertCalledFormDto calledFormDto = (AlertCalledFormDto)iAlertCalledService.selectAlertCalledById(rescueProcessDto.getAlertId());
List<FormValue> dynamicFormAlert = calledFormDto.getDynamicFormAlert();
HashMap<String, String> formMap = new HashMap<>();
dynamicFormAlert.forEach(x->formMap.put(x.getKey(),x.getValue()));
AlertCalledDto alertCalledDto = calledFormDto.getAlertCalledDto();
AlertFormRecordDto alertFormRecordDto = new AlertFormRecordDto();
alertFormRecordDto.setAlertCalledId(rescueProcessDto.getAlertId());
alertFormRecordDto.setAlertTypeCode(alertCalledDto.getAlarmTypeCode());
alertFormRecordDto.setName(alertCalledDto.getEmergencyPerson());
alertFormRecordDto.setPhone(alertCalledDto.getEmergencyCall());
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
alertFormRecordDto.setTrappedTime(sdf.parse(formMap.getOrDefault("trapped_time",new Date().toString())));
alertFormRecordDto.setTrappedNum(Integer.valueOf(formMap.getOrDefault("trapped_num","0")));
alertFormRecordDto.setTrappedFloorNum(Integer.parseInt(formMap.getOrDefault("trapped_floor_num","0")));
alertFormRecordDto.setInjuredNum(Integer.valueOf(rescueProcessDto.getCasualtiesInfo()));
alertFormRecordDto.setDieNum(Integer.valueOf(rescueProcessDto.getDieNum()));
alertFormRecordDto.setSourcesInfo(SourcesInfoEnum.Process.getCode().toString());
alertFormRecordService.saveAlertFormRecord(alertFormRecordDto);
}catch (Exception e){
e.printStackTrace();
}
redisUtils.del(RedisKey.TZS_ALERTCALLED_ID+rescueProcessDto.getAlertId()); redisUtils.del(RedisKey.TZS_ALERTCALLED_ID+rescueProcessDto.getAlertId());
} }
rescueProcessDto.setDispatchTime(null); rescueProcessDto.setDispatchTime(null);
......
package com.yeejoin.amos.boot.module.elevator.flc.biz.service.impl; package com.yeejoin.amos.boot.module.elevator.flc.biz.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey; import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils; import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil; import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
...@@ -11,23 +12,23 @@ import com.yeejoin.amos.boot.module.elevator.api.entity.AlertCalled; ...@@ -11,23 +12,23 @@ import com.yeejoin.amos.boot.module.elevator.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.elevator.api.entity.AlertFormRecord; import com.yeejoin.amos.boot.module.elevator.api.entity.AlertFormRecord;
import com.yeejoin.amos.boot.module.elevator.api.entity.AlertFormValue; import com.yeejoin.amos.boot.module.elevator.api.entity.AlertFormValue;
import com.yeejoin.amos.boot.module.elevator.api.enums.AlertStageEnums; import com.yeejoin.amos.boot.module.elevator.api.enums.AlertStageEnums;
import com.yeejoin.amos.boot.module.elevator.api.enums.SourcesInfoEnum;
import com.yeejoin.amos.boot.module.elevator.api.mapper.AlertFormRecordMapper; import com.yeejoin.amos.boot.module.elevator.api.mapper.AlertFormRecordMapper;
import com.yeejoin.amos.boot.module.elevator.api.service.IAlertFormRecordService; import com.yeejoin.amos.boot.module.elevator.api.service.IAlertFormRecordService;
import com.yeejoin.amos.boot.module.elevator.biz.service.impl.AlertCalledServiceImpl; import com.yeejoin.amos.boot.module.elevator.biz.service.impl.AlertCalledServiceImpl;
import com.yeejoin.amos.boot.module.elevator.biz.service.impl.AlertFormValueServiceImpl; import com.yeejoin.amos.boot.module.elevator.biz.service.impl.AlertFormValueServiceImpl;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.rdbms.service.BaseService; import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.Date; import java.util.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -68,63 +69,65 @@ public class AlertFormRecordServiceImpl extends BaseService<AlertFormRecordDto, ...@@ -68,63 +69,65 @@ public class AlertFormRecordServiceImpl extends BaseService<AlertFormRecordDto,
} }
/** /**
* 用户单位信息redis获取
**/
public ReginParams getReginParams() {
return JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
}
/**
* 保存警情修改记录 * 保存警情修改记录
* *
* @param map 包含新旧数据的map
* @return * @return
*/ */
@Override @Override
@Transactional @Transactional
public ResponseModel saveAlertFormRecord(Map<String, AlertFormRecordDto> map) { public ResponseModel saveAlertFormRecord(AlertFormRecordDto data) {
try { try {
AlertFormRecordDto oldData = map.get("oldData");
AlertFormRecordDto newData = map.get("newData");
List<AlertFormRecord> recordByCalledId = alertFormRecordMapper.getRecordByCalledId(newData.getAlertCalledId());
AlertFormRecord oldRecord = new AlertFormRecord(); AlertFormRecord oldRecord = new AlertFormRecord();
//第一次修改,保存旧记录
if (recordByCalledId.isEmpty()) {
BeanUtils.copyProperties(oldData, oldRecord);
oldRecord.setEditTime(oldData.getTrappedTime());
alertFormRecordMapper.insert(oldRecord);
}
AlertFormRecord record = new AlertFormRecord(); AlertFormRecord record = new AlertFormRecord();
BeanUtils.copyProperties(newData, record); BeanUtils.copyProperties(data, record);
AgencyUserModel userModel = this.getReginParams().getUserModel();
record.setEditTime(new Date()); record.setEditTime(new Date());
record.setRecUserRealName(userModel.getRealName());
record.setSourcesInfo(Objects.requireNonNull(SourcesInfoEnum.getEnum(Integer.valueOf(record.getSourcesInfo()))).getName());
alertFormRecordMapper.insert(record); alertFormRecordMapper.insert(record);
// 更新警情基本信息
Long alertCalled = record.getAlertCalledId(); Long alertCalled = record.getAlertCalledId();
if (!record.getName().equals(oldRecord.getName())){ // 警情编辑时候更新警情动态表单数据
LambdaUpdateWrapper<AlertCalled> wrapper = new LambdaUpdateWrapper<>(); if (SourcesInfoEnum.Edit.getName().equals(record.getSourcesInfo())){
wrapper.eq(AlertCalled::getSequenceNbr, alertCalled); // 更新警情基本信息
wrapper.set(AlertCalled::getEmergencyPerson, record.getName()); if (!record.getName().equals(oldRecord.getName())){
alertCalledServiceImpl.update(wrapper); LambdaUpdateWrapper<AlertCalled> wrapper = new LambdaUpdateWrapper<>();
} wrapper.eq(AlertCalled::getSequenceNbr, alertCalled);
LambdaQueryWrapper<AlertFormValue> queryWrapper = new LambdaQueryWrapper<>(); wrapper.set(AlertCalled::getEmergencyPerson, record.getName());
queryWrapper.eq(AlertFormValue::getAlertCalledId, alertCalled); alertCalledServiceImpl.update(wrapper);
// 更新警情动态表单数据
List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
HashMap<String, Object> listMap = new HashMap<>();
list.forEach(x -> listMap.put(x.getFieldCode(), x.getFieldValue()));
for (Field field : record.getClass().getDeclaredFields()) {
// 设置为可访问,以访问私有属性
field.setAccessible(true);
String fieldName = convertToUnderline(field.getName());
Object value = field.get(record);
//“是否有光照” 转 文字存储
if ("is_light".equals(fieldName)){
value = (value.equals(1) ? "是" : "否");
} }
try { LambdaQueryWrapper<AlertFormValue> queryWrapper = new LambdaQueryWrapper<>();
//表tz_alert_form_value中的字典名称desc和表tz_alert_form_record中列名称description冲突,做特殊处理 queryWrapper.eq(AlertFormValue::getAlertCalledId, alertCalled);
if (listMap.containsKey(fieldName) || (listMap.containsKey("desc") && fieldName.equals("description"))) { List<AlertFormValue> list = iAlertFormValueService.list(queryWrapper);
LambdaUpdateWrapper<AlertFormValue> wrapper = new LambdaUpdateWrapper<>(); HashMap<String, Object> listMap = new HashMap<>();
wrapper.eq(AlertFormValue::getAlertCalledId, alertCalled); list.forEach(x -> listMap.put(x.getFieldCode(), x.getFieldValue()));
wrapper.eq(AlertFormValue::getFieldCode, fieldName.equals("description") ? "desc" : fieldName); for (Field field : record.getClass().getDeclaredFields()) {
wrapper.set(AlertFormValue::getFieldValue, value); // 设置为可访问,以访问私有属性
iAlertFormValueService.update(wrapper); field.setAccessible(true);
String fieldName = convertToUnderline(field.getName());
Object value = field.get(record);
//“是否有光照” 转 文字存储
if ("is_light".equals(fieldName)){
value = (value.equals(1) ? "是" : "否");
}
try {
//表tz_alert_form_value中的字典名称desc和表tz_alert_form_record中列名称description冲突,做特殊处理
if (listMap.containsKey(fieldName) || (listMap.containsKey("desc") && fieldName.equals("description"))) {
LambdaUpdateWrapper<AlertFormValue> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(AlertFormValue::getAlertCalledId, alertCalled);
wrapper.eq(AlertFormValue::getFieldCode, fieldName.equals("description") ? "desc" : fieldName);
wrapper.set(AlertFormValue::getFieldValue, value);
iAlertFormValueService.update(wrapper);
}
} catch (Exception e) {
e.printStackTrace();
} }
} catch (Exception e) {
e.printStackTrace();
} }
} }
redisUtils.del(RedisKey.TZS_ALERTCALLED_ID + alertCalled); redisUtils.del(RedisKey.TZS_ALERTCALLED_ID + alertCalled);
......
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