Commit 1a8ac062 authored by tianbo's avatar tianbo

Merge branch 'develop_tzs_register' of…

Merge branch 'develop_tzs_register' of http://39.98.45.134:8090/moa/amos-boot-biz into develop_tzs_register
parents 9adfac96 2872db10
package com.yeejoin.amos.boot.module.elevator.api.dto;
import com.yeejoin.amos.boot.biz.common.dto.BaseDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
*
*
* @author system_generator
* @date 2023-11-02
*/
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value="AlertFormRecordDto", description="")
public class AlertFormRecordDto extends BaseDto {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "警情id")
private Long alertCalledId;
@ApiModelProperty(value = "警情类型")
private String alertTypeCode;
@ApiModelProperty(value = "救援人姓名")
private String name;
@ApiModelProperty(value = "救援人电话")
private String phone;
@ApiModelProperty(value = "被困人数")
private Integer trappedNum;
@ApiModelProperty(value = "受伤人数")
private Integer injuredNum;
@ApiModelProperty(value = "死亡人数")
private Integer dieNum;
@ApiModelProperty(value = "被困楼层")
private Integer trappedFloorNum;
@ApiModelProperty(value = "是否有光照")
private Integer isLight;
@ApiModelProperty(value = "被困时间")
private Date trappedTime;
@ApiModelProperty(value = "事件描述")
private String description;
@ApiModelProperty(value = "故障报修描述")
private String faultReport;
@ApiModelProperty(value = "投诉咨询描述")
private String complaintConsulttation;
@ApiModelProperty(value = "备注")
private String remarks;
}
package com.yeejoin.amos.boot.module.elevator.api.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.util.Date;
/**
* @author system_generator
* @date 2023-11-02
*/
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("tz_alert_form_record")
public class AlertFormRecord extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 警情id
*/
@TableField("alert_called_id")
private Long alertCalledId;
/**
* 警情类型
*/
@TableField("alert_type_code")
private String alertTypeCode;
/**
* 救援人姓名
*/
@TableField("name")
private String name;
/**
* 救援人电话
*/
@TableField("phone")
private String phone;
/**
* 被困人数
*/
@TableField("trapped_num")
private Integer trappedNum;
/**
* 受伤人数
*/
@TableField("injured_num")
private Integer injuredNum;
/**
* 死亡人数
*/
@TableField("die_num")
private Integer dieNum;
/**
* 被困楼层
*/
@TableField("trapped_floor_num")
private Integer trappedFloorNum;
/**
* 是否有光照
*/
@TableField("is_light")
private Integer isLight;
/**
* 被困时间
*/
@TableField("trapped_time")
private Date trappedTime;
/**
* 事件描述
*/
@TableField("description")
private String description;
/**
* 故障报修描述
*/
@TableField("fault_report")
private String faultReport;
/**
* 投诉咨询描述
*/
@TableField("complaint_consulttation")
private String complaintConsulttation;
/**
* 备注
*/
@TableField("remarks")
private String remarks;
}
package com.yeejoin.amos.boot.module.elevator.api.entity;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
......@@ -32,6 +34,8 @@ public class AlertStatistics extends BaseEntity {
* 监管单位名称
*/
@TableField("supervisory_unit_name")
@ColumnWidth(30)
@ExcelProperty(value = "区 域", index = 0)
private String supervisoryUnitName;
/**
......@@ -44,6 +48,7 @@ public class AlertStatistics extends BaseEntity {
* 电梯总数
*/
@TableField("elevator_num")
@ExcelProperty(value = "电梯总数(台)", index = 1)
private Integer elevatorNum;
/**
......@@ -68,18 +73,21 @@ public class AlertStatistics extends BaseEntity {
* 解救人员
*/
@TableField("rescue_personnel")
@ExcelProperty(value = "解救被困人员(起)", index = 5)
private Integer rescuePersonnel;
/**
* 投诉建议
*/
@TableField("complaint")
@ExcelProperty(value = "投诉建议(条)", index = 6)
private Integer complaint;
/**
* 故障率
*/
@TableField("failure_rate")
@ExcelProperty(value = "电梯故障率", index = 7)
private String failureRate;
/**
......@@ -100,4 +108,15 @@ public class AlertStatistics extends BaseEntity {
@TableField("end_date")
private String endDate;
@ExcelProperty(value = "电梯应急总事件(起)", index = 2)
@TableField(exist = false)
private String avgDaysEmergencyEvents;
@ExcelProperty(value = "困 人(起)", index = 3)
@TableField(exist = false)
private String avgDaysTrappedPeople;
@ExcelProperty(value = "故 障(起)", index = 4)
@TableField(exist = false)
private String avgDaysBreakdownRescue;
}
package com.yeejoin.amos.boot.module.elevator.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.elevator.api.entity.AlertFormRecord;
import java.util.List;
/**
* Mapper 接口
*
* @author system_generator
* @date 2023-11-02
*/
public interface AlertFormRecordMapper extends BaseMapper<AlertFormRecord> {
List<AlertFormRecord> getRecordByCalledId(Long alertCalledId);
}
package com.yeejoin.amos.boot.module.elevator.api.service;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertFormRecordDto;
import com.yeejoin.amos.boot.module.elevator.api.entity.AlertFormRecord;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
import java.util.Map;
/**
* 接口类
*
* @author system_generator
* @date 2023-11-02
*/
public interface IAlertFormRecordService {
/**
* 保存警情修改记录
*
* @param map 包含新旧数据的map
* @return
*/
ResponseModel<Object> saveAlertFormRecord(Map<String, AlertFormRecordDto> map);
/**
* 根据警情id查询所有修改记录
* @param alertCalledId 警情id
* @return 记录
*/
List<AlertFormRecord> allAlertFormRecordByCalledId(Long alertCalledId);
}
package com.yeejoin.amos.boot.module.elevator.api.service;
import com.yeejoin.amos.boot.module.elevator.api.entity.AlertStatistics;
import java.text.ParseException;
import java.util.List;
public interface IAlertStatisticsService {
void statisticalGeneration();
List<AlertStatistics> getList(String date) throws ParseException;
}
package com.yeejoin.amos.boot.module.elevator.api.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.amos.boot.biz.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@Data
public class AlertStatisticsExportVo {
@ExcelProperty(value = "序号", index = 0)
private Integer number;
/**
* 监管单位名称
*/
@ColumnWidth(30)
@ExcelProperty(value = "区 域", index = 1)
private String supervisoryUnitName;
/**
* 电梯总数
*/
@TableField("elevator_num")
@ExcelProperty(value = "电梯总数(台)", index = 2)
private Integer elevatorNum;
@ExcelProperty(value = "电梯应急总事件(起)", index = 3)
private String avgDaysEmergencyEvents;
@ExcelProperty(value = "困 人(起)", index = 4)
private String avgDaysTrappedPeople;
@ExcelProperty(value = "故 障(起)", index = 5)
private String avgDaysBreakdownRescue;
/**
* 解救人员
*/
@ExcelProperty(value = "解救被困人员(起)", index = 6)
private Integer rescuePersonnel;
/**
* 投诉建议
*/
@ExcelProperty(value = "投诉建议(条)", index = 7)
private Integer complaint;
/**
* 故障率
*/
@ExcelProperty(value = "电梯故障率", index = 8)
private String failureRate;
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.elevator.api.mapper.AlertFormRecordMapper">
<select id="getRecordByCalledId"
resultType="com.yeejoin.amos.boot.module.elevator.api.entity.AlertFormRecord">
SELECT *
FROM tz_alert_form_record afr
WHERE afr.is_delete = 0
<if test="TzCarcylRegDto!=null and TzCarcylRegDto!='' ">
AND afr.alert_called_id = #{alertCalledId}
</if>
ORDER BY afr.rec_date
</select>
</mapper>
package com.yeejoin.amos.boot.module.elevator.biz.controller;
import cn.hutool.core.util.ObjectUtil;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertFormRecordDto;
import com.yeejoin.amos.boot.module.elevator.api.service.IAlertFormRecordService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.Map;
/**
* 警情接警修改记录Api
*/
@RestController
@Api(tags = "警情接警修改记录Api")
@RequestMapping(value = "/alert-update")
public class AlertFormRecordController {
@Autowired
private IAlertFormRecordService iAlertFormRecordService;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/saveRecord")
@ApiOperation(httpMethod = "POST", value = "新增警情接警填报记录", notes = "新增警情接警填报记录")
public ResponseModel<Object> saveMobile(@RequestBody Map<String, AlertFormRecordDto> map) {
if (ObjectUtil.isNotEmpty(map.get("oldData")) && ObjectUtil.isNotEmpty(map.get("newData"))) {
return ResponseHelper.buildResponse(iAlertFormRecordService.saveAlertFormRecord(map));
} else {
return ResponseHelper.buildResponse("缺少数据");
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping(value = "/recordByCalledId")
@ApiOperation(httpMethod = "POST", value = "根据警情id查询修改记录", notes = "根据警情id查询修改记录")
public ResponseModel<Object> saveMobile(@RequestParam("alertCalledId") String alertCalledId) {
return ResponseHelper.buildResponse(iAlertFormRecordService.allAlertFormRecordByCalledId(Long.valueOf(alertCalledId)));
}
}
package com.yeejoin.amos.boot.module.elevator.biz.controller;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.elevator.api.dto.TemplateDto;
import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil;
import com.yeejoin.amos.boot.module.elevator.api.entity.AlertStatistics;
import com.yeejoin.amos.boot.module.elevator.api.service.IAlertStatisticsService;
import com.yeejoin.amos.boot.module.elevator.api.vo.AlertStatisticsExportVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletResponse;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@RestController
@Api(tags = "统计Api")
......@@ -31,4 +44,46 @@ public class StatisticsController extends BaseController {
alertStatisticsService.statisticalGeneration();
return ResponseHelper.buildResponse("success");
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getList")
@ApiOperation(httpMethod = "GET", value = "查询统计信息", notes = "查询统计信息")
public ResponseModel<Object> getList(@RequestParam(value = "date", required = false) String date) throws ParseException {
if (ObjectUtils.isEmpty(date)) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
Date nowDate = cal.getTime();
date = format.format(nowDate);
}
Page<AlertStatistics> alertStatisticsPage = new Page<>();
alertStatisticsPage.setRecords(alertStatisticsService.getList(date));
return ResponseHelper.buildResponse(alertStatisticsPage);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/exportData")
@ApiOperation(httpMethod = "GET", value = "监管单位统计信息导出", notes = "监管单位统计信息导出")
public void exportData(HttpServletResponse response, @RequestParam(value = "date", required = false) String date) throws ParseException {
if (ObjectUtils.isEmpty(date)) {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM");
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
Date nowDate = cal.getTime();
date = format.format(nowDate);
}
ArrayList<AlertStatisticsExportVo> exportVos = new ArrayList<>();
List<AlertStatistics> list = alertStatisticsService.getList(date);
int number = 1;
for (AlertStatistics item : list) {
AlertStatisticsExportVo vo = new AlertStatisticsExportVo();
BeanUtil.copyProperties(item, vo);
vo.setNumber(number);
number = number + 1;
exportVos.add(vo);
}
ExcelUtil.createTemplate(response, "各地监控中心电梯月度情况综述", "各地监控中心电梯月度情况综述", exportVos, AlertStatisticsExportVo.class, null, false);
}
}
package com.yeejoin.amos.boot.module.elevator.biz.service.impl;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.elevator.api.common.BizCommonConstant;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertStatisticsDto;
import com.yeejoin.amos.boot.module.elevator.api.entity.AlertStatistics;
import com.yeejoin.amos.boot.module.elevator.api.mapper.AlertStatisticsMapper;
import com.yeejoin.amos.boot.module.elevator.api.service.IAlertStatisticsService;
import net.javacrumbs.shedlock.spring.annotation.SchedulerLock;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
......@@ -27,6 +33,8 @@ public class AlertStatisticsServiceImpl extends BaseService<AlertStatisticsDto,
@Override
@Scheduled(cron = "0 0 0 1 * ?")
@SchedulerLock(name = "statisticalGeneration", lockAtMostFor = "PT10M", lockAtLeastFor = "PT10M")
public void statisticalGeneration() {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Calendar cal = Calendar.getInstance();
......@@ -63,4 +71,73 @@ public class AlertStatisticsServiceImpl extends BaseService<AlertStatisticsDto,
}
return data;
}
@Override
public List<AlertStatistics> getList(String date) throws ParseException {
LambdaQueryWrapper<AlertStatistics> lambda = new QueryWrapper<AlertStatistics>().lambda();
lambda.eq(AlertStatistics::getStatisticsDate, date);
List<AlertStatistics> alertStatistics = this.getBaseMapper().selectList(lambda);
AlertStatistics statistics = new AlertStatistics();
String startDate = null;
String endDate = null;
for (AlertStatistics item : alertStatistics) {
if (ObjectUtils.isEmpty(startDate)) {
startDate = item.getStartDate();
}
if (ObjectUtils.isEmpty(endDate)) {
endDate = item.getEndDate();
}
item.setAvgDaysEmergencyEvents(String.valueOf(item.getEmergencyEvents()));
item.setAvgDaysBreakdownRescue(String.valueOf(item.getBreakdownRescue()));
item.setAvgDaysTrappedPeople(String.valueOf(item.getTrappedPeople()));
statistics.setElevatorNum(ObjectUtils.isEmpty(statistics.getElevatorNum()) ? item.getElevatorNum() : item.getElevatorNum() + statistics.getElevatorNum());
statistics.setEmergencyEvents(ObjectUtils.isEmpty(statistics.getEmergencyEvents()) ? item.getEmergencyEvents() : item.getEmergencyEvents() + statistics.getEmergencyEvents());
statistics.setTrappedPeople(ObjectUtils.isEmpty(statistics.getTrappedPeople()) ? item.getTrappedPeople() : item.getTrappedPeople() + statistics.getTrappedPeople());
statistics.setBreakdownRescue(ObjectUtils.isEmpty(statistics.getBreakdownRescue()) ? item.getBreakdownRescue() : item.getBreakdownRescue() + statistics.getBreakdownRescue());
statistics.setRescuePersonnel(ObjectUtils.isEmpty(statistics.getRescuePersonnel()) ? item.getRescuePersonnel() : item.getRescuePersonnel() + statistics.getRescuePersonnel());
statistics.setComplaint(ObjectUtils.isEmpty(statistics.getComplaint()) ? item.getComplaint() : item.getComplaint() + statistics.getComplaint());
statistics.setAvgDaysEmergencyEvents(ObjectUtils.isEmpty(statistics.getEmergencyEvents()) ? String.valueOf(item.getEmergencyEvents()) : String.valueOf(item.getEmergencyEvents() + statistics.getEmergencyEvents()));
statistics.setAvgDaysTrappedPeople(ObjectUtils.isEmpty(statistics.getTrappedPeople()) ? String.valueOf(item.getTrappedPeople()) : String.valueOf(item.getTrappedPeople() + statistics.getTrappedPeople()));
statistics.setAvgDaysBreakdownRescue(ObjectUtils.isEmpty(statistics.getBreakdownRescue()) ? String.valueOf(item.getBreakdownRescue()) : String.valueOf(item.getBreakdownRescue() + statistics.getBreakdownRescue()));
}
statistics.setSupervisoryUnitName("合计");
DecimalFormat decimalFormat = new DecimalFormat("0.000");
DecimalFormat decimalFormatAvg = new DecimalFormat("0.0");
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
if (ObjectUtils.isEmpty(statistics.getEmergencyEvents()) || ObjectUtils.isEmpty(statistics.getElevatorNum()) || statistics.getEmergencyEvents() == 0 || statistics.getElevatorNum() == 0) {
statistics.setFailureRate("0%");
} else {
BigDecimal bigDecimal = new BigDecimal(statistics.getEmergencyEvents().toString());
BigDecimal bigDecimal1 = new BigDecimal(statistics.getElevatorNum().toString());
BigDecimal divide = bigDecimal.divide(bigDecimal1, 6, BigDecimal.ROUND_HALF_UP).multiply(new BigDecimal("100"));
statistics.setFailureRate(decimalFormat.format(divide) + "%");
}
alertStatistics.add(statistics);
AlertStatistics avg = new AlertStatistics();
avg.setSupervisoryUnitName("平均每天");
long days = DateUtil.betweenDay(simpleDateFormat.parse(startDate), simpleDateFormat.parse(endDate), true);
int avgNum = Integer.parseInt(String.valueOf(days));
if (!ObjectUtils.isEmpty(statistics.getEmergencyEvents()) && statistics.getEmergencyEvents() != 0 && avgNum != 0) {
BigDecimal bigDecimal = new BigDecimal(statistics.getEmergencyEvents().toString());
BigDecimal bigDecimal1 = new BigDecimal(avgNum);
BigDecimal divide = bigDecimal.divide(bigDecimal1, 6, BigDecimal.ROUND_HALF_UP);
avg.setAvgDaysEmergencyEvents(decimalFormatAvg.format(divide));
}
if (!ObjectUtils.isEmpty(statistics.getTrappedPeople()) && statistics.getTrappedPeople() != 0 && avgNum != 0) {
BigDecimal bigDecimal = new BigDecimal(statistics.getTrappedPeople().toString());
BigDecimal bigDecimal1 = new BigDecimal(avgNum);
BigDecimal divide = bigDecimal.divide(bigDecimal1, 6, BigDecimal.ROUND_HALF_UP);
avg.setAvgDaysTrappedPeople(decimalFormatAvg.format(divide));
}
if (!ObjectUtils.isEmpty(statistics.getBreakdownRescue()) && statistics.getBreakdownRescue() != 0 && avgNum != 0) {
BigDecimal bigDecimal = new BigDecimal(statistics.getBreakdownRescue().toString());
BigDecimal bigDecimal1 = new BigDecimal(avgNum);
BigDecimal divide = bigDecimal.divide(bigDecimal1, 6, BigDecimal.ROUND_HALF_UP);
avg.setAvgDaysBreakdownRescue(decimalFormatAvg.format(divide));
}
alertStatistics.add(avg);
return alertStatistics;
}
}
\ No newline at end of file
package com.yeejoin.amos.boot.module.elevator.flc.biz.service.impl;
import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import com.yeejoin.amos.boot.module.elevator.api.dto.AlertFormRecordDto;
import com.yeejoin.amos.boot.module.elevator.api.entity.AlertFormRecord;
import com.yeejoin.amos.boot.module.elevator.api.mapper.AlertFormRecordMapper;
import com.yeejoin.amos.boot.module.elevator.api.service.IAlertFormRecordService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
import java.util.Map;
/**
* 服务实现类
*
* @author system_generator
* @date 2023-11-02
*/
@Service
public class AlertFormRecordServiceImpl extends BaseService<AlertFormRecordDto, AlertFormRecord, AlertFormRecordMapper> implements IAlertFormRecordService {
@Autowired
private AlertFormRecordMapper alertFormRecordMapper;
/**
* 保存警情修改记录
*
* @param map 包含新旧数据的map
* @return
*/
@Override
@Transactional
public ResponseModel saveAlertFormRecord(Map<String, AlertFormRecordDto> map) {
try {
AlertFormRecordDto oldData = map.get("oldData");
AlertFormRecordDto newData = map.get("newData");
List<AlertFormRecord> recordByCalledId = alertFormRecordMapper.getRecordByCalledId(newData.getAlertCalledId());
AlertFormRecord record = new AlertFormRecord();
//第一次修改,保存旧记录
if (recordByCalledId.isEmpty()) {
BeanUtils.copyProperties(oldData, record);
record.setRecDate(oldData.getTrappedTime());
alertFormRecordMapper.insert(record);
}
BeanUtils.copyProperties(newData, record);
alertFormRecordMapper.insert(record);
return ResponseHelper.buildResponse("保存警情记录成功");
} catch (Exception e) {
log.error(e.getMessage(), e);
return CommonResponseUtil.failure("保存警情记录失败");
}
}
/**
* 根据警情id查询所有修改记录
*
* @param alertCalledId 警情id
* @return 记录
*/
@Override
public List<AlertFormRecord> allAlertFormRecordByCalledId(Long alertCalledId) {
return alertFormRecordMapper.getRecordByCalledId(alertCalledId);
}
}
\ No newline at end of file
......@@ -549,7 +549,7 @@ public class RouteServiceImpl extends ServiceImpl<RouteMapper, Route> implement
if (oldRoutePointList != null && oldRoutePointList.size() > 0) {
RoutePoint RoutePoint = oldRoutePointList.get(0);
if (!"".equals(RoutePoint.getExcludeItems()) && !RoutePoint.getExcludeItems().isEmpty()){
if (!"".equals(RoutePoint.getExcludeItems()) && RoutePoint.getExcludeItems() != null){
List<Long> split = Arrays.asList(RoutePoint.getExcludeItems().split(",")).stream().map(Long::parseLong).collect(Collectors.toList());
Set<Long> allPointInputItemIdSet = iPointInputItemDao.getPointInputItemByPointIdAndClassifyId(pointId, classifyId)
......
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