diff --git a/src/main/java/com/zhgd/xmgl/modules/bigdevice/controller/GantryCraneApiController.java b/src/main/java/com/zhgd/xmgl/modules/bigdevice/controller/GantryCraneApiController.java index 2750b7b3a..5f09eaea5 100644 --- a/src/main/java/com/zhgd/xmgl/modules/bigdevice/controller/GantryCraneApiController.java +++ b/src/main/java/com/zhgd/xmgl/modules/bigdevice/controller/GantryCraneApiController.java @@ -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 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 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 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 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 addDriverOperatorRecord(@RequestBody GantryCraneDriverOperatorRecord gantryCraneDriverOperatorRecord) { gantryCraneDriverOperatorRecordService.saveGantryCraneDriverOperatorRecord(gantryCraneDriverOperatorRecord); diff --git a/src/main/java/com/zhgd/xmgl/modules/car/mapper/xml/CarPassRecordMapper.xml b/src/main/java/com/zhgd/xmgl/modules/car/mapper/xml/CarPassRecordMapper.xml index 20e1ebd1a..47fc7b5a0 100644 --- a/src/main/java/com/zhgd/xmgl/modules/car/mapper/xml/CarPassRecordMapper.xml +++ b/src/main/java/com/zhgd/xmgl/modules/car/mapper/xml/CarPassRecordMapper.xml @@ -181,7 +181,7 @@ AND a.pass_time <= CONCAT(DATE_FORMAT(#{param.endTime}, '%Y-%m-%d'), ' 23:59:59') - and b.car_number like CONCAT(CONCAT('%', #{param.carNumber}), '%') + and a.car_number like CONCAT(CONCAT('%', #{param.carNumber}), '%') and a.type = #{param.type} diff --git a/src/main/java/com/zhgd/xmgl/modules/frontier/controller/FrontierProtectionDevAlarmController.java b/src/main/java/com/zhgd/xmgl/modules/frontier/controller/FrontierProtectionDevAlarmController.java index 2fcecee07..411e16b3d 100644 --- a/src/main/java/com/zhgd/xmgl/modules/frontier/controller/FrontierProtectionDevAlarmController.java +++ b/src/main/java/com/zhgd/xmgl/modules/frontier/controller/FrontierProtectionDevAlarmController.java @@ -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()); } diff --git a/src/main/java/com/zhgd/xmgl/modules/poisonous/controller/PoisonousGasDevAlarmController.java b/src/main/java/com/zhgd/xmgl/modules/poisonous/controller/PoisonousGasDevAlarmController.java index 5a655ce8a..06ec0ed46 100644 --- a/src/main/java/com/zhgd/xmgl/modules/poisonous/controller/PoisonousGasDevAlarmController.java +++ b/src/main/java/com/zhgd/xmgl/modules/poisonous/controller/PoisonousGasDevAlarmController.java @@ -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()); } diff --git a/src/main/java/com/zhgd/xmgl/modules/poisonous/controller/PoisonousGasDevCurrentDataController.java b/src/main/java/com/zhgd/xmgl/modules/poisonous/controller/PoisonousGasDevCurrentDataController.java index ff0d9f717..f7315e884 100644 --- a/src/main/java/com/zhgd/xmgl/modules/poisonous/controller/PoisonousGasDevCurrentDataController.java +++ b/src/main/java/com/zhgd/xmgl/modules/poisonous/controller/PoisonousGasDevCurrentDataController.java @@ -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 add(@RequestBody PoisonousGasDevCurrentData poisonousGasDevCurrentData) { log.info("添加有毒气体-数据信息:{}", JSON.toJSONString(poisonousGasDevCurrentData)); - Result result = new Result(); - 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(); } /** diff --git a/src/main/java/com/zhgd/xmgl/modules/poisonous/entity/PoisonousGasDevCurrentData.java b/src/main/java/com/zhgd/xmgl/modules/poisonous/entity/PoisonousGasDevCurrentData.java index 8e23bbf03..d5e5d4630 100644 --- a/src/main/java/com/zhgd/xmgl/modules/poisonous/entity/PoisonousGasDevCurrentData.java +++ b/src/main/java/com/zhgd/xmgl/modules/poisonous/entity/PoisonousGasDevCurrentData.java @@ -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; } diff --git a/src/main/java/com/zhgd/xmgl/modules/poisonous/service/impl/PoisonousGasDevCurrentDataServiceImpl.java b/src/main/java/com/zhgd/xmgl/modules/poisonous/service/impl/PoisonousGasDevCurrentDataServiceImpl.java index 3728f17d8..21a427710 100644 --- a/src/main/java/com/zhgd/xmgl/modules/poisonous/service/impl/PoisonousGasDevCurrentDataServiceImpl.java +++ b/src/main/java/com/zhgd/xmgl/modules/poisonous/service/impl/PoisonousGasDevCurrentDataServiceImpl.java @@ -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 monthList = DateUtil.getMonthDayList(MapUtils.getString(map, "monthTime")); for (Map param : list) { map.put("sn", MapUtils.getString(param, "sn")); + map.put("companyType", MapUtils.getString(param, "type")); List> dataList = standardAlarmMapper.selectStandardAlarmByMonthList(map); List> tempList = new ArrayList<>(); for (String month : monthList) { diff --git a/src/main/java/com/zhgd/xmgl/security/util/SecurityUtils.java b/src/main/java/com/zhgd/xmgl/security/util/SecurityUtils.java new file mode 100644 index 000000000..911b7754a --- /dev/null +++ b/src/main/java/com/zhgd/xmgl/security/util/SecurityUtils.java @@ -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(); + + } +} diff --git a/src/main/java/com/zhgd/xmgl/task/ProjectTask.java b/src/main/java/com/zhgd/xmgl/task/ProjectTask.java index f4b6c3a21..4b9ee57b4 100644 --- a/src/main/java/com/zhgd/xmgl/task/ProjectTask.java +++ b/src/main/java/com/zhgd/xmgl/task/ProjectTask.java @@ -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 {