|
|
|
|
@ -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()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|