liweidong
张乾翔 3 days ago
parent 601861b169
commit 5b163661a6
  1. 10
      blade-service/blade-desk/src/main/java/org/springblade/desk/energy/pojo/entity/BsDosingRecEntity.java
  2. 3
      blade-service/blade-desk/src/main/java/org/springblade/desk/energy/pojo/entity/BsEpciuPatrolInspectionEntity.java
  3. 2
      blade-service/blade-desk/src/main/java/org/springblade/desk/energy/pojo/entity/BsSafePatrolInspectionEntity.java
  4. 4
      blade-service/blade-desk/src/main/java/org/springblade/desk/energy/service/impl/BsDosingRecServiceImpl.java
  5. 4
      blade-service/blade-desk/src/main/java/org/springblade/desk/energy/service/impl/BsSafePatrolInspectionServiceImpl.java
  6. 12
      blade-service/blade-desk/src/main/java/org/springblade/desk/produce/controller/PdaLoadController.java
  7. 29
      blade-service/blade-desk/src/main/java/org/springblade/desk/produce/controller/PdaSaveController.java
  8. 5
      blade-service/blade-desk/src/main/java/org/springblade/desk/produce/service/impl/PdaLoadServiceImpl.java
  9. 76
      blade-service/blade-desk/src/main/java/org/springblade/desk/produce/service/impl/PdaSaveServiceImpl.java

@ -25,6 +25,7 @@
*/
package org.springblade.desk.energy.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import io.swagger.v3.oas.annotations.media.Schema;
@ -91,18 +92,18 @@ public class BsDosingRecEntity extends BaseEntity {
/**
* 处理类型
*/
//@Schema(description = "处理类型")
@Schema(description = "处理类型")
private Long handleResult;
/**
* 类型1废气加药2废水加药
*/
//@Schema(description = "类型:1、废气加药;2、废水加药")
@Schema(description = "类型:1、废气加药;2、废水加药")
private String dorType;
/**
* 酸雾塔
*/
//@Schema(description = "酸雾塔")
@Schema(description = "酸雾塔")
private Long btId;
@ -138,4 +139,7 @@ public class BsDosingRecEntity extends BaseEntity {
handleResultMap.put(HANDLE_RESULT_WAIT, "待处理");
handleResultMap.put(HANDLE_RESULT_PDA, "PDA已处理");
}
@TableField(exist = false)
private String btCode;
}

@ -116,6 +116,9 @@ public class BsEpciuPatrolInspectionEntity extends BaseEntity {
@Schema(description = "巡检点类型")
private String insType;
@Schema(description = "图片地址")
private String path;
/**
* 待检
*/

@ -111,6 +111,8 @@ public class BsSafePatrolInspectionEntity extends BaseEntity {
*/
@Schema(description = "任务状态:1、已检,2、待检,3、未准时完成")
private String taskStatus;
@Schema(description = "图片地址")
private String path;
///**
// * 待检

@ -128,7 +128,9 @@ public class BsDosingRecServiceImpl extends BaseServiceImpl<BsDosingRecMapper, B
.eq(BsDosingRecEntity::getHandleResult, HANDLE_RESULT_WAIT)
.orderByDesc(BsDosingRecEntity::getDosingTime));
if (bsDosingRecEntities.size() > 0) {
return bsDosingRecEntities.get(0);
BsDosingRecEntity bsDosingRecEntity = bsDosingRecEntities.get(0);
bsDosingRecEntity.setBtCode(code);
return bsDosingRecEntity;
} else {
throw new RuntimeException("未查询到有效数据");
}

@ -25,6 +25,7 @@
*/
package org.springblade.desk.energy.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -120,6 +121,9 @@ public class BsSafePatrolInspectionServiceImpl extends BaseServiceImpl<BsSafePat
List<BsSafeInspectionPointEntity> bsSafeInspectionPointEntities = bsSafeInspectionPointService.listByCode(code);
List<Long> ipIds = bsSafeInspectionPointEntities.stream().map(BsSafeInspectionPointEntity::getId).toList();
if (CollUtil.isEmpty(ipIds)){
return CollUtil.newArrayList();
}
return list(Wrappers.lambdaQuery(BsSafePatrolInspectionEntity.class)
.in(BsSafePatrolInspectionEntity::getIpId, ipIds)
.eq(BsSafePatrolInspectionEntity::getTaskStatus, BsSafePatrolInspectionEntity.PREPARE_TEXT)

@ -116,26 +116,26 @@ public class PdaLoadController {
@ApiOperationSupport(order = 11)
@Operation(summary = "根据巡检器编码查询数据,查询安全巡检任务", description = "")
@GetMapping("/getInspectionByEcCode/{code}")
public ResultInfo getInspectionByEcCode(@PathVariable String code, HttpServletRequest request) throws Exception {
return ResultInfo.ok(pdaLoadService.getInspectionByEcCode(code, true,request));
public R getInspectionByEcCode(@PathVariable String code, HttpServletRequest request) throws Exception {
return R.data(pdaLoadService.getInspectionByEcCode(code, true,request));
}
@Operation(summary = "根据巡检器编码查询环保巡检数据", description = "")
@PostMapping("/getInspectionBySan")
public ResultInfo getInspectionBySan(@RequestBody JSONObject data) throws Exception {
public R getInspectionBySan(@RequestBody JSONObject data) throws Exception {
Short eipType = data.getShort("eipType");
String code = data.getString("code");
return ResultInfo.ok(pdaLoadService.getInspectionBySan(code, eipType));
return R.data(pdaLoadService.getInspectionBySan(code, eipType));
}
@Operation(summary = "根据酸雾塔编码查询数据", description = "")
@GetMapping("/epDosingRecByCode/{code}")
public ResultInfo epDosingRecByCode(@PathVariable String code) throws Exception {
return ResultInfo.ok(pdaLoadService.epDosingRecByCode(code));
public R epDosingRecByCode(@PathVariable String code) throws Exception {
return R.data(pdaLoadService.epDosingRecByCode(code));
}
}

@ -1,5 +1,6 @@
package org.springblade.desk.produce.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import io.swagger.v3.oas.annotations.Operation;
@ -24,6 +25,7 @@ import org.springblade.desk.produce.service.IPdaSaveService;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.stream.Collectors;
/**
* @ClassName PdaLoadController
@ -137,36 +139,43 @@ public class PdaSaveController {
@Operation(summary = "安全巡检处理,修改安全巡检任务", description = "")
@PostMapping(value = "/saveByInspection")
public ResultInfo saveSafetyInspection(@RequestBody JSONObject params) throws Exception {
public R saveSafetyInspection(@RequestBody JSONObject params) throws Exception {
if (params == null || params.size() == 0) {
throw new BusinessException("参数传递异常!");
}
String code = params.getString("code");
String man = params.getString("reviewMan");
//String man = params.getString("reviewMan");
String memo = params.getString("memo");
JSONArray path = params.getJSONArray("path");
String pathStr = null;
if (path != null && path.size() > 0) {
pathStr = path.stream().map(Object::toString).collect(Collectors.joining(","));
}
if (code == null || man == null) {
if (code == null
//|| man == null
) {
throw new BusinessException("参数传递异常!");
}
log.info("安全巡检处理传递参数---编码:" + code + " 人员:" + man + " 备注:" + memo);
pdaSaveService.saveSafetyInspection(code, man, memo);
return ResultInfo.ok();
log.info("安全巡检处理传递参数---编码:" + code + " 备注:" + memo);
pdaSaveService.saveSafetyInspection(code, memo,pathStr);
return R.success();
}
@Operation(summary = "环保巡检检验", description = "")
@RequestMapping(value = "/savePatrolIns", method = RequestMethod.POST)
public ResultInfo savePatrolIns(@RequestBody BsEpciuPatrolInspectionEntity epPatrolInspection) {
public R savePatrolIns(@RequestBody BsEpciuPatrolInspectionEntity epPatrolInspection) {
pdaSaveService.savePatrolIns(epPatrolInspection);
return ResultInfo.ok();
return R.success();
}
@Operation(summary = "酸雾塔报警处理", description = "")
@PostMapping("/saveEpDosingRec")
public ResultInfo saveEpDosingRec(@RequestBody BsDosingRecEntity epDosingRec, HttpServletRequest request) throws Exception {
public R saveEpDosingRec(@RequestBody BsDosingRecEntity epDosingRec, HttpServletRequest request) throws Exception {
pdaSaveService.saveEpDosingRec(epDosingRec);
return ResultInfo.ok();
return R.success();
}
}

@ -453,12 +453,13 @@ public class PdaLoadServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan
List<BsSafePatrolInspectionEntity> piList = inspectionService.getByCode(code);
piList = piList.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() ->
new TreeSet<>(Comparator.comparing(BsSafePatrolInspectionEntity::getIpId))), ArrayList::new));
if (piList == null || piList.size() == 0) {
if (null == piList || piList.size() == 0) {
if (flag) {
throw new RuntimeException("未查询到安全巡检任务,product.noPatrolCheckTask");
}
}
return piList;
//配合前端显示
return List.of(piList.get(0));
}

@ -14,6 +14,7 @@ import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.desk.dashboard.pojo.entity.*;
@ -826,22 +827,71 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan
}
}
/**
* TODO: 2026/4/23 参考旧mes 接口 /webapi/saveSafetyInspection
* {
* // 根据编码去拿未检验的数据
*
* List<SafePatrolInspection> spiList = safePatrolInspectionDao.getByCode(code);
*
* if (spiList == null || spiList.size() == 0) {
* throw new BusinessException("根据编码未找到需要处理数据");
* }
*
* PfUserInfo userByLdapName = epDosingRecDao.getUserByLdapName(man);
*
* if (userByLdapName == null || userByLdapName.getUserId() == null) {
* throw new BusinessException("根据域账号未找到对应的处理人");
* }
*
* Date date = new Date();
* for (SafePatrolInspection safePatrolInspection : spiList) {
* // 如果在一个小时内将生成的任务处理掉那么算准时完成,在一个小时以后并且下个任务未生成之前处理 算未准时完成,如果在下个任务生成时还未处理算缺卡,并将任务改为缺卡,7点生成的任务除外特殊算(8点查询有任务改为缺卡)
*
* // 不超过一个小时算正常检验
* if (new Date().getTime() - safePatrolInspection.getLaunchTime().getTime() <= 60 * 60 * 1000) {
* safePatrolInspection.setTaskStatus(SafePatrolInspection.CHECKED);
* }else {
* // 超过一个小时但是下个任务并没有触发
* int hours = safePatrolInspection.getLaunchTime().getHours();
* int hours1 = new Date().getHours();
* if (hours == 0 && hours1 < 2) {
* safePatrolInspection.setTaskStatus(SafePatrolInspection.NOT_ON_TIME);
* } else if (hours == 2 && hours1 < 5) {
* safePatrolInspection.setTaskStatus(SafePatrolInspection.NOT_ON_TIME);
* } else if (hours == 5 && hours1 < 7) {
* safePatrolInspection.setTaskStatus(SafePatrolInspection.NOT_ON_TIME);
* } else if (hours == 7 && hours1 < 8) {
* safePatrolInspection.setTaskStatus(SafePatrolInspection.NOT_ON_TIME);
* } else {
* // 超过一个小时但是下个任务已触发
* safePatrolInspection.setTaskStatus(SafePatrolInspection.NO_CHECK);
* }
* }
* safePatrolInspection.setTestTime(date);
* safePatrolInspection.setInsMan(userByLdapName);
* safePatrolInspection.setParMemo(memo);
* SafeInspectionPoint safeInspectionPoint = safeInspectionPointService.getByKey(safePatrolInspection.getIpId());
* safeInspectionPoint.setLastInsCycle(date);
* this.updateOldPatrol(safePatrolInspection.getIpId(), safePatrolInspection.getLaunchTime(), userByLdapName.getUserId());
* }
* }
* */
@Override
public void saveSafetyInspection(String code, String man, String memo) {
public void saveSafetyInspection(String code, String memo,String pathStr) {
// 根据编码去拿未检验的数据
List<BsSafePatrolInspectionEntity> spiList = inspectionService.getByCode(code);
if (spiList == null || spiList.size() == 0) {
throw new RuntimeException("根据编码未找到需要处理数据");
}
List<User> users = userClient.listByNameNolike(man);
if (CollUtil.isEmpty(users)) {
throw new RuntimeException("根据域账号未找到对应的处理人");
}
User user = users.get(0);
//List<User> users = userClient.listByNameNolike(man);
//
//if (CollUtil.isEmpty(users)) {
// throw new RuntimeException("根据域账号未找到对应的处理人");
//}
//User user = users.get(0);
BladeUser user = AuthUtil.getUser();
Date date = new Date();
for (BsSafePatrolInspectionEntity safePatrolInspection : spiList) {
@ -866,11 +916,15 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan
}
}
safePatrolInspection.setTestTime(date);
safePatrolInspection.setInsMan(man);
safePatrolInspection.setInsMan(user.getUserName());
safePatrolInspection.setParMemo(memo);
safePatrolInspection.setPath(pathStr);
// // TODO: 区别旧mes 显示修改 inspectionService.updateById(safePatrolInspection);bsSafeInspectionPointService.updateById(safeInspectionPoint);
inspectionService.updateById(safePatrolInspection);
BsSafeInspectionPointEntity safeInspectionPoint = bsSafeInspectionPointService.getByKey(safePatrolInspection.getIpId());
safeInspectionPoint.setLastInsCycle(date);
inspectionService.updateOldPatrol(safePatrolInspection.getIpId(), safePatrolInspection.getLaunchTime(), user.getId());
bsSafeInspectionPointService.updateById(safeInspectionPoint);
inspectionService.updateOldPatrol(safePatrolInspection.getIpId(), safePatrolInspection.getLaunchTime(), user.getUserId());
}
}

Loading…
Cancel
Save