liweidong
张乾翔 2 days ago
parent f26ee8d9dc
commit bf530e253d
  1. 4
      blade-service/blade-desk/src/main/java/org/springblade/desk/energy/mapper/EpciuPatrolInspectionMapper.xml
  2. 4
      blade-service/blade-desk/src/main/java/org/springblade/desk/energy/mapper/SafePatrolInspectionMapper.xml
  3. 25
      blade-service/blade-desk/src/main/java/org/springblade/desk/energy/pojo/entity/BsEpciuPatrolInspectionEntity.java
  4. 10
      blade-service/blade-desk/src/main/java/org/springblade/desk/energy/pojo/entity/BsSafePatrolInspectionEntity.java
  5. 47
      blade-service/blade-desk/src/main/java/org/springblade/desk/energy/service/impl/BsEpciuPatrolInspectionServiceImpl.java
  6. 2
      blade-service/blade-desk/src/main/java/org/springblade/desk/produce/service/IPdaSaveService.java
  7. 7
      blade-service/blade-desk/src/main/java/org/springblade/desk/produce/service/impl/PdaSaveServiceImpl.java

@ -3,13 +3,13 @@
<mapper namespace="org.springblade.desk.energy.mapper.BsEpciuPatrolInspectionMapper">
<!-- 通用查询映射结果 -->
<resultMap id="bsEpciuPatrolInspectionResultMap" type="org.springblade.desk.energy.pojo.entity.BsEpciuPatrolInspectionEntity">
<resultMap id="bsEpciuPatrolInspectionResultMap" type="org.springblade.desk.energy.pojo.vo.BsEpciuPatrolInspectionVO">
<result column="ID" property="id"/>
<result column="EPC_ID" property="epcId"/>
<result column="INS_NUM" property="insNum"/>
<result column="INS_SITE" property="insSite"/>
<result column="INS_MAN" property="insMan"/>
<result column="WAIT_CYCLE" property="waitCycle"/>
<!-- <result column="WAIT_CYCLE" property="waitCycle"/>-->
<result column="INS_MEMO" property="insMemo"/>
<result column="PAR_MEMO" property="parMemo"/>
<result column="LAUNCH_TIME" property="launchTime"/>

@ -3,13 +3,13 @@
<mapper namespace="org.springblade.desk.energy.mapper.BsSafePatrolInspectionMapper">
<!-- 通用查询映射结果 -->
<resultMap id="bsSafePatrolInspectionResultMap" type="org.springblade.desk.energy.pojo.entity.BsSafePatrolInspectionEntity">
<resultMap id="bsSafePatrolInspectionResultMap" type="org.springblade.desk.energy.pojo.vo.BsSafePatrolInspectionVO">
<result column="ID" property="id"/>
<result column="IP_ID" property="ipId"/>
<result column="INS_NUM" property="insNum"/>
<result column="INS_SITE" property="insSite"/>
<result column="INS_MAN" property="insMan"/>
<result column="WAIT_CYCLE" property="waitCycle"/>
<!-- <result column="WAIT_CYCLE" property="waitCycle"/>-->
<result column="INS_MEMO" property="insMemo"/>
<result column="PAR_MEMO" property="parMemo"/>
<result column="LAUNCH_TIME" property="launchTime"/>

@ -25,6 +25,7 @@
*/
package org.springblade.desk.energy.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
@ -32,6 +33,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.desk.energy.util.DateTime;
import org.springblade.desk.energy.util.TimeSpan;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serial;
@ -80,7 +83,8 @@ public class BsEpciuPatrolInspectionEntity extends BaseEntity {
@Schema(description = "等待周期")
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
private Date waitCycle;
@TableField(exist = false)
private String waitCycle;
/**
* 巡检点备注
*/
@ -139,5 +143,22 @@ public class BsEpciuPatrolInspectionEntity extends BaseEntity {
taskStatusMap.put(PREPARE_TEXT, "待检");
taskStatusMap.put(NO_CHECK, "未检");
}
public String getWaitCycle() {
if(this.taskStatus.equals(CHECKED)) {
return "";
}
TimeSpan ts = DateTime.dateDiff(this.launchTime, new Date());
int days = ts.getDays();
int hours = ts.getHours();
int minutes = ts.getMinutes();
String rtnV = ts.getSeconds() + "秒";
if (days > 0) {
rtnV = days + "天" + hours + "时" + minutes + "分";
} else if (hours > 0) {
rtnV = hours + "时" + minutes + "分";
} else if (minutes > 0) {
rtnV = minutes + "分";
}
return rtnV;
}
}

@ -25,6 +25,7 @@
*/
package org.springblade.desk.energy.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
@ -79,10 +80,11 @@ public class BsSafePatrolInspectionEntity extends BaseEntity {
/**
* 等待周期
*/
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
@Schema(description = "等待周期")
private Date waitCycle;
//@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
//@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
//@Schema(description = "等待周期")
@TableField(exist = false)
private String waitCycle;
/**
* 巡检点备注
*/

@ -26,13 +26,16 @@
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;
import jakarta.annotation.Resource;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.desk.energy.excel.BsEpciuPatrolInspectionExcel;
import org.springblade.desk.energy.mapper.BsEpciuPatrolInspectionMapper;
import org.springblade.desk.energy.pojo.entity.BsEpciuInspectionPointEntity;
@ -44,13 +47,12 @@ import org.springblade.desk.energy.service.IBsEpciuInspectionPointService;
import org.springblade.desk.energy.service.IBsEpciuPatrolInspectionService;
import org.springblade.desk.energy.service.IBsSafeInspectionPointService;
import org.springblade.desk.energy.service.IBsSafePatrolInspectionService;
import org.springblade.system.feign.IUserClient;
import org.springblade.system.pojo.entity.User;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;
/**
@ -65,6 +67,8 @@ public class BsEpciuPatrolInspectionServiceImpl extends BaseServiceImpl<BsEpciuP
private final IBsEpciuInspectionPointService bsEpciuInspectionPointService;
@Resource
IUserClient userClient;
@Override
public IPage<BsEpciuPatrolInspectionVO> selectBsEpciuPatrolInspectionPage(IPage<BsEpciuPatrolInspectionVO> page, BsEpciuPatrolInspectionVO bsEpciuPatrolInspection) {
if(bsEpciuPatrolInspection.getQueryLaunchTime()!=null){
@ -74,7 +78,31 @@ public class BsEpciuPatrolInspectionServiceImpl extends BaseServiceImpl<BsEpciuP
bsEpciuPatrolInspection.setStartTestDate(bsEpciuPatrolInspection.getQueryTestTime().split(",")[0]);
bsEpciuPatrolInspection.setEndTestDate(bsEpciuPatrolInspection.getQueryTestTime().split(",")[1]);
}
return page.setRecords(baseMapper.selectBsEpciuPatrolInspectionPage(page, bsEpciuPatrolInspection));
IPage<BsEpciuPatrolInspectionVO> bsEpciuPatrolInspectionVOIPage =
page.setRecords(baseMapper.selectBsEpciuPatrolInspectionPage(page, bsEpciuPatrolInspection));
Set<String> manIds =
bsEpciuPatrolInspectionVOIPage.getRecords().stream().map(BsEpciuPatrolInspectionVO::getInsMan).collect(Collectors.toSet());
if (CollUtil.isNotEmpty(manIds)) {
String userId = Func.toStr(manIds);
List<User> users = new ArrayList<>();
try {
users = userClient.userUNListByIds(userId);
} catch (Exception e) {
e.printStackTrace();
return bsEpciuPatrolInspectionVOIPage;
}
if (CollUtil.isEmpty( users)){
return bsEpciuPatrolInspectionVOIPage;
}
Map<String, String> userMap = users.stream().collect(Collectors.toMap(s -> s.getId().toString(), User::getName));
bsEpciuPatrolInspectionVOIPage.getRecords().forEach(bsEpciuPatrolInspectionVO -> {
bsEpciuPatrolInspectionVO.setInsMan(userMap.getOrDefault(bsEpciuPatrolInspectionVO.getInsMan(),bsEpciuPatrolInspectionVO.getInsMan()));
});
}
return bsEpciuPatrolInspectionVOIPage;
}
@ -201,10 +229,14 @@ public class BsEpciuPatrolInspectionServiceImpl extends BaseServiceImpl<BsEpciuP
//query.setParameter("taskStatusText", EpPatrolInspection.PREPARE_TEXT);
//query.setParameter("code", code);
//query.executeUpdate();
Date date = new Date();
BsEpciuPatrolInspectionEntity bsEpciuPatrolInspection = getById(epPatrolInspection.getId());
bsEpciuPatrolInspection.setTaskStatus(BsEpciuPatrolInspectionEntity.CHECKED.toString());
bsEpciuPatrolInspection.setTestTime(new Date());
bsEpciuPatrolInspection.setTestTime(date);
bsEpciuPatrolInspection.setInsMan(AuthUtil.getUserId().toString());
bsEpciuPatrolInspection.setPath(epPatrolInspection.getPath());
bsEpciuPatrolInspection.setParMemo(epPatrolInspection.getParMemo());
updateById(bsEpciuPatrolInspection);
// 将其他同类的巡检任务置为未检
List<BsEpciuInspectionPointEntity> safeInspectionPointList = bsEpciuInspectionPointService.listByCode(bsEpciuPatrolInspection.getInsNum());
@ -213,6 +245,9 @@ public class BsEpciuPatrolInspectionServiceImpl extends BaseServiceImpl<BsEpciuP
.in(BsEpciuPatrolInspectionEntity::getEpcId, pointIds)
.eq(BsEpciuPatrolInspectionEntity::getTaskStatus, BsEpciuPatrolInspectionEntity.PREPARE_TEXT.toString())
.set(BsEpciuPatrolInspectionEntity::getTaskStatus, BsEpciuPatrolInspectionEntity.NO_CHECK.toString()));
safeInspectionPointList.forEach(point -> point.setLastInsCycle(date));
bsEpciuInspectionPointService.updateBatchById(safeInspectionPointList);
}
}

@ -66,7 +66,7 @@ public interface IPdaSaveService extends BaseService<WorkPlan> {
boolean receiveNoProcessOrder();
void saveSafetyInspection(String code, String man, String memo);
void saveSafetyInspection(String code, String memo,String pathStr);
void savePatrolIns(BsEpciuPatrolInspectionEntity epPatrolInspection);

@ -878,6 +878,7 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan
* }
* */
@Override
@Transactional
public void saveSafetyInspection(String code, String memo,String pathStr) {
// 根据编码去拿未检验的数据
List<BsSafePatrolInspectionEntity> spiList = inspectionService.getByCode(code);
@ -893,7 +894,10 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan
//User user = users.get(0);
BladeUser user = AuthUtil.getUser();
Date date = new Date();
//巡检任务 定时任务 触发位置: OrderSafeJob.java
//定时任务原配置:0 0 0,2,5,7 * * ? (每天 0点、2点、5点、7点执行),即当前任务超时一小时但下一个任务(定时任务未执行)算未准时完成
//else 缺卡(默认处理)
// // TODO: 2026/4/24 整理定时任务逻辑
for (BsSafePatrolInspectionEntity safePatrolInspection : spiList) {
// 不超过一个小时算正常检验
if (new Date().getTime() - safePatrolInspection.getLaunchTime().getTime() <= 60 * 60 * 1000) {
@ -914,6 +918,7 @@ public class PdaSaveServiceImpl extends BaseServiceImpl<WorkPlanMapper, WorkPlan
// 超过一个小时但是下个任务已触发
safePatrolInspection.setTaskStatus(BsSafePatrolInspectionEntity.NO_CHECK.toString());
}
}
safePatrolInspection.setTestTime(date);
safePatrolInspection.setInsMan(user.getUserName());

Loading…
Cancel
Save