diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/scheduled/DeviceLedgerScheduledTask.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/scheduled/DeviceLedgerScheduledTask.java index d40b068..ed1af25 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/scheduled/DeviceLedgerScheduledTask.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/equipment/scheduled/DeviceLedgerScheduledTask.java @@ -60,7 +60,10 @@ public class DeviceLedgerScheduledTask { // 取出数据ID 删除数据 JSONObject queryJson = JSONObject.parseObject(JSON.toJSONString(searchResult.getData())); JSONArray data = Optional.ofNullable(queryJson).map(json -> json.getJSONObject("Get")) - .map(json -> json.getJSONArray(ScheduledConstant.DEVICE_LEDGER_CLASS_NAME)).orElse(null); + .map(jsonObject -> { + Optional tableName = jsonObject.keySet().stream().filter(key -> key.contains(ScheduledConstant.DEVICE_LEDGER_CLASS_NAME)).findFirst(); + return tableName.isPresent() ? jsonObject.getJSONArray(tableName.get()) : null; + }).orElse(null); if(Func.isNotEmpty(data)) { List ids = data.stream().map(item -> { JSONObject jsonObject = JSONObject.parseObject(JSON.toJSONString(item)); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/feign/OperAccessTaskClient.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/feign/OperAccessTaskClient.java index a526cd8..b195c78 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/feign/OperAccessTaskClient.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/feign/OperAccessTaskClient.java @@ -131,7 +131,8 @@ public class OperAccessTaskClient implements IOperAccessTaskClient, IAccessTaskC // 确保日期格式一致 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); String formattedDate = sdf.format(task.getPlanStartTime()); - String overview = String.format(overviewTemplate, task.getCreateUserName(), formattedDate, task.getEmName(), task.getActHours(), details); + Integer actHour = Optional.ofNullable(task.getActHours()).orElse(0); + String overview = String.format(overviewTemplate, task.getCreateUserName(), formattedDate, task.getEmName(), actHour, details); return overview; }).filter(Func::isNotEmpty).collect(Collectors.toList()); return R.data(overviewList); diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/feign/TicketInfoClient.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/feign/TicketInfoClient.java index d742272..8be69a0 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/feign/TicketInfoClient.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/feign/TicketInfoClient.java @@ -25,6 +25,8 @@ import org.springblade.core.mp.base.BaseEntity; import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.*; import org.springblade.flow.core.feign.IFlowClient; +import org.springblade.system.user.cache.UserCache; +import org.springblade.system.user.entity.User; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; @@ -37,6 +39,7 @@ import java.time.format.DateTimeFormatter; import java.util.Date; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.concurrent.ExecutionException; import java.util.concurrent.FutureTask; import java.util.stream.Collectors; @@ -303,7 +306,8 @@ public class TicketInfoClient implements ITicketInfoClient { if(Func.isNotEmpty(workTicketList)) { List overviewList = workTicketList.stream().map(workTicketInfo -> { String startTime = workTicketInfo.getPlanStartTime().format(DateUtil.DATETIME_FORMATTER); - return String.format(overviewTemplate, workTicketInfo.getCreateUserName(), startTime, workTicketInfo.getEmName(), workTicketInfo.getWorkContent()); + String createUserName = Optional.ofNullable(workTicketInfo.getCreateUser()).map(UserCache::getUser).map(User::getName).orElse(""); + return String.format(overviewTemplate, createUserName, startTime, workTicketInfo.getEmName(), workTicketInfo.getWorkContent()); }).collect(Collectors.toList()); return R.data(overviewList); }