bug修复

This commit is contained in:
guo 2023-08-14 15:37:20 +08:00
parent 1bae32285f
commit b5ba585585
11 changed files with 119 additions and 52 deletions

View File

@ -1,5 +1,6 @@
package com.zhgd.xmgl.modules.bigdevice.controller;
import com.gexin.fastjson.JSON;
import com.zhgd.annotation.OperLog;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.xmgl.modules.bigdevice.entity.*;
@ -36,8 +37,8 @@ public class GantryCraneApiController {
private IGantryCraneDriverOperatorRecordService gantryCraneDriverOperatorRecordService;
@OperLog(operModul = "龙门吊管理",operType = "编辑龙门吊设备",operDesc = "编辑龙门吊基本信息")
@ApiOperation(value = "编辑龙门吊信息", notes = "编辑龙门吊信息" , httpMethod="POST")
@OperLog(operModul = "龙门吊管理", operType = "编辑龙门吊设备", operDesc = "编辑龙门吊基本信息")
@ApiOperation(value = "编辑龙门吊信息", notes = "编辑龙门吊信息", httpMethod = "POST")
@PostMapping(value = "/updateDev")
public Result<GantryCrane> updateDev(@RequestBody GantryCrane gantryCrane) {
gantryCraneService.updateDev(gantryCrane);
@ -45,37 +46,40 @@ public class GantryCraneApiController {
}
/**
* 添加
* 添加
*
* @param gantryCraneCurrentData
* @return
*/
@ApiOperation(value = " 保存龙门吊实时数据信息", notes = "保存龙门吊实时数据信息" , httpMethod="POST")
@ApiOperation(value = " 保存龙门吊实时数据信息", notes = "保存龙门吊实时数据信息", httpMethod = "POST")
@PostMapping(value = "/saveGantrycraneRealtimeData")
public Result<GantryCraneCurrentData> saveGantrycraneRealtimeData(@RequestBody GantryCraneCurrentData gantryCraneCurrentData) {
gantryCraneCurrentDataService.saveGantryCraneCurrentData(gantryCraneCurrentData);
return Result.ok();
}
@ApiOperation(value = " 添加龙门吊工作循环信息", notes = "添加龙门吊工作循环信息" , httpMethod="POST")
@ApiOperation(value = " 添加龙门吊工作循环信息", notes = "添加龙门吊工作循环信息", httpMethod = "POST")
@PostMapping(value = "/addGantryCraneWorkCycle")
public Result<GantryCraneWorkCycle> add(@RequestBody GantryCraneWorkCycle gantryCraneWorkCycle) {
gantryCraneWorkCycleService.saveGantryCraneWorkCycle(gantryCraneWorkCycle);
return Result.ok();
}
@ApiOperation(value = " 添加龙门吊报警数据表信息", notes = "添加龙门吊报警数据表信息" , httpMethod="POST")
@ApiOperation(value = " 添加龙门吊报警数据表信息", notes = "添加龙门吊报警数据表信息", httpMethod = "POST")
@PostMapping(value = "/addGantryCraneAlarm")
public Result<GantryCraneAlarm> addGantryCraneAlarm(@RequestBody GantryCraneAlarm gantryCraneAlarm) {
log.info("addGantryCraneAlarm:", JSON.toJSONString(gantryCraneAlarm));
gantryCraneAlarmService.saveGantryCraneAlarm(gantryCraneAlarm);
return Result.ok();
}
/**
* 添加
* 添加
*
* @param gantryCraneDriverOperatorRecord
* @return
*/
@ApiOperation(value = " 添加龙门吊司机打卡记录信息", notes = "添加龙门吊司机打卡记录信息" , httpMethod="POST")
@ApiOperation(value = " 添加龙门吊司机打卡记录信息", notes = "添加龙门吊司机打卡记录信息", httpMethod = "POST")
@PostMapping(value = "/add")
public Result<GantryCraneDriverOperatorRecord> addDriverOperatorRecord(@RequestBody GantryCraneDriverOperatorRecord gantryCraneDriverOperatorRecord) {
gantryCraneDriverOperatorRecordService.saveGantryCraneDriverOperatorRecord(gantryCraneDriverOperatorRecord);

View File

@ -181,7 +181,7 @@
AND a.pass_time &lt;= CONCAT(DATE_FORMAT(#{param.endTime}, '%Y-%m-%d'), ' 23:59:59')
</if>
<if test="param.carNumber != null and param.carNumber != ''">
and b.car_number like CONCAT(CONCAT('%', #{param.carNumber}), '%')
and a.car_number like CONCAT(CONCAT('%', #{param.carNumber}), '%')
</if>
<if test="param.type != null">
and a.type = #{param.type}

View File

@ -9,6 +9,7 @@ import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.xmgl.modules.frontier.entity.FrontierProtectionDevAlarm;
import com.zhgd.xmgl.modules.frontier.service.IFrontierProtectionDevAlarmService;
import com.zhgd.xmgl.security.entity.UserInfo;
import com.zhgd.xmgl.security.util.SecurityUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
@ -107,7 +108,7 @@ public class FrontierProtectionDevAlarmController {
result.error500("未找到对应实体");
} else {
if (Objects.equals(frontierProtectionDevAlarm.getHandleDone(), 1)) {
UserInfo userInfo = (UserInfo) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserInfo userInfo = SecurityUtils.getUser();
frontierProtectionDevAlarm.setOperateId(userInfo.getUserId());
frontierProtectionDevAlarm.setOperateTime(new Date());
}

View File

@ -12,6 +12,7 @@ import com.zhgd.xmgl.modules.poisonous.entity.PoisonousGasDevAlarm;
import com.zhgd.xmgl.modules.poisonous.entity.PoisonousGasDevCurrentData;
import com.zhgd.xmgl.modules.poisonous.service.IPoisonousGasDevAlarmService;
import com.zhgd.xmgl.security.entity.UserInfo;
import com.zhgd.xmgl.security.util.SecurityUtils;
import com.zhgd.xmgl.util.DateUtil;
import com.zhgd.xmgl.util.ReflectionUtil;
import io.swagger.annotations.Api;
@ -123,7 +124,7 @@ public class PoisonousGasDevAlarmController {
result.error500("未找到对应实体");
} else {
if (Objects.equals(poisonousGasDevAlarm.getHandleDone(), 1)) {
UserInfo userInfo = (UserInfo) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserInfo userInfo = SecurityUtils.getUser();
poisonousGasDevAlarm.setOperateId(userInfo.getUserId());
poisonousGasDevAlarm.setOperateTime(new Date());
}

View File

@ -1,43 +1,26 @@
package com.zhgd.xmgl.modules.poisonous.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.jeecg.common.system.query.QueryGenerator;
import com.zhgd.jeecg.common.util.oConvertUtils;
import com.zhgd.xmgl.modules.poisonous.entity.PoisonousGasDevCurrentData;
import com.zhgd.xmgl.modules.poisonous.service.IPoisonousGasDevCurrentDataService;
import com.zhgd.xmgl.util.DateUtil;
import com.zhgd.xmgl.util.ReflectionUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.MapUtils;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import org.springframework.web.servlet.ModelAndView;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
@ -95,26 +78,12 @@ public class PoisonousGasDevCurrentDataController {
return Result.success(poisonousGasDevCurrentDataService.queryNewestDatalistGroupByDev(poisonousGasDevCurrentData));
}
/**
* 添加
*
* @param poisonousGasDevCurrentData
* @return
*/
@ApiOperation(value = " 添加有毒气体-数据信息", notes = "添加有毒气体-数据信息", httpMethod = "POST")
@ApiOperation(value = " 添加有毒气体-数据和报警信息", notes = " 添加有毒气体-数据和报警信息", httpMethod = "POST")
@PostMapping(value = "/add")
public Result<PoisonousGasDevCurrentData> add(@RequestBody PoisonousGasDevCurrentData poisonousGasDevCurrentData) {
log.info("添加有毒气体-数据信息:{}", JSON.toJSONString(poisonousGasDevCurrentData));
Result<PoisonousGasDevCurrentData> result = new Result<PoisonousGasDevCurrentData>();
try {
poisonousGasDevCurrentDataService.add(poisonousGasDevCurrentData);
result.success("添加成功!");
} catch (Exception e) {
e.printStackTrace();
log.info(e.getMessage());
result.error500("操作失败");
}
return result;
poisonousGasDevCurrentDataService.add(poisonousGasDevCurrentData);
return Result.ok();
}
/**

View File

@ -102,4 +102,7 @@ public class PoisonousGasDevCurrentData implements Serializable {
@ApiModelProperty(value = "设备位置")
@TableField(exist = false)
private String location;
@ApiModelProperty(value = "报警状态 0正常1低报警2高报警3超量程")
@TableField(exist = false)
private java.lang.Integer alarmType;
}

View File

@ -31,10 +31,7 @@ import org.springframework.web.servlet.ModelAndView;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@ -189,6 +186,53 @@ public class PoisonousGasDevCurrentDataServiceImpl extends ServiceImpl<Poisonous
poisonousGasDevCurrentData.setProjectSn(poisonousGasDev.getProjectSn());
poisonousGasDevCurrentData.setLocation(poisonousGasDev.getLocation());
save(poisonousGasDevCurrentData);
if (!Objects.equals(poisonousGasDevCurrentData.getAlarmType(), 0)) {
//报警
PoisonousGasDevAlarm devAlarm = new PoisonousGasDevAlarm();
String monitorObject = getMonitorObject(poisonousGasDevCurrentData.getGasType());
devAlarm.setMonitorObject(monitorObject);
String alarmTypeName = getAlarmTypeName(poisonousGasDevCurrentData.getAlarmType());
devAlarm.setAlarmDetail(monitorObject + alarmTypeName + ",当前值为" + poisonousGasDevCurrentData.getGasVal() + getUnitName(poisonousGasDevCurrentData.getUnit()));
devAlarm.setDevSn(poisonousGasDev.getDevSn());
devAlarm.setAlarmTime(poisonousGasDevCurrentData.getUploadTime());
devAlarm.setProjectSn(poisonousGasDev.getProjectSn());
devAlarm.setGasVal(poisonousGasDevCurrentData.getGasVal());
devAlarm.setUnit(poisonousGasDevCurrentData.getUnit());
devAlarm.setAlarmType(poisonousGasDevCurrentData.getAlarmType());
poisonousGasDevAlarmMapper.insert(devAlarm);
}
}
private String getAlarmTypeName(Integer alarmType) {
if (alarmType == null) {
return null;
}
//1低报警2高报警3超量程
switch (alarmType) {
case 1:
return "低报警";
case 2:
return "高报警";
case 3:
return "超量程";
}
return null;
}
private String getMonitorObject(Integer gasType) {
if (gasType == null) {
return null;
}
//气体类型1氧气2甲烷3一氧化碳
switch (gasType) {
case 1:
return "氧气";
case 2:
return "甲烷";
case 3:
return "一氧化碳";
}
return null;
}
@NotNull

View File

@ -12,6 +12,7 @@ import com.zhgd.xmgl.modules.smoke.entity.AddAlarmDto;
import com.zhgd.xmgl.modules.smoke.entity.SmokeDevAlarm;
import com.zhgd.xmgl.modules.smoke.service.ISmokeDevAlarmService;
import com.zhgd.xmgl.security.entity.UserInfo;
import com.zhgd.xmgl.security.util.SecurityUtils;
import com.zhgd.xmgl.util.ReflectionUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@ -107,7 +108,7 @@ public class SmokeDevAlarmController {
result.error500("未找到对应实体");
} else {
if (Objects.equals(smokeDevAlarm.getHandleDone(), 1)) {
UserInfo userInfo = (UserInfo) SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserInfo userInfo = SecurityUtils.getUser();
smokeDevAlarm.setOperateId(userInfo.getUserId());
smokeDevAlarm.setOperateTime(new Date());
}

View File

@ -64,6 +64,7 @@ public class StandardAlarmServiceImpl extends ServiceImpl<StandardAlarmMapper, S
List<String> monthList = DateUtil.getMonthDayList(MapUtils.getString(map, "monthTime"));
for (Map<String, Object> param : list) {
map.put("sn", MapUtils.getString(param, "sn"));
map.put("companyType", MapUtils.getString(param, "type"));
List<Map<String, Object>> dataList = standardAlarmMapper.selectStandardAlarmByMonthList(map);
List<Map<String, Object>> tempList = new ArrayList<>();
for (String month : monthList) {

View File

@ -0,0 +1,43 @@
package com.zhgd.xmgl.security.util;
import com.zhgd.xmgl.security.entity.UserInfo;
import lombok.experimental.UtilityClass;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
@UtilityClass
public class SecurityUtils {
/**
* 获取Authentication
*/
public Authentication getAuthentication() {
return SecurityContextHolder.getContext().getAuthentication();
}
/**
* 获取用户
*/
public UserInfo getUser(Authentication authentication) {
Object principal = authentication.getPrincipal();
if (principal instanceof UserInfo) {
return (UserInfo) principal;
}
return null;
}
/**
* 获取用户
*/
public UserInfo getUser() {
Authentication authentication = getAuthentication();
if (authentication == null) {
return null;
}
return getUser(authentication);
}
public static void main(String[] args) {
Authentication authentication = SecurityUtils.getAuthentication();
}
}

View File

@ -205,9 +205,9 @@ public class ProjectTask {
}
/**
* 每天执行一次将今天之前的绿色设备实时数据移到历史表中
* 每天执行一次将今天之前的绿色设备实时数据移到历史表中不执行数据迁移
*/
@Scheduled(cron = "0 0 2 * * ?")
//@Scheduled(cron = "0 0 2 * * ?")
@SchedulerLock(name = "insertDustNoiseHistoryData", lockAtMostFor = 1000 * 60 * 60, lockAtLeastFor = 1000 * 60 * 5)
public void insertDustNoiseHistoryData() {
try {