From d5449236ef0b3adafb3e4cc872f50479efa0ce7b Mon Sep 17 00:00:00 2001 From: zhangc <zc@123> Date: 星期二, 11 三月 2025 16:10:29 +0800 Subject: [PATCH] 配置信息 --- src/main/java/com/zy/asrs/service/impl/CommandInfoServiceImpl.java | 51 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 48 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/zy/asrs/service/impl/CommandInfoServiceImpl.java b/src/main/java/com/zy/asrs/service/impl/CommandInfoServiceImpl.java index 44dd2aa..e57c059 100644 --- a/src/main/java/com/zy/asrs/service/impl/CommandInfoServiceImpl.java +++ b/src/main/java/com/zy/asrs/service/impl/CommandInfoServiceImpl.java @@ -1,15 +1,22 @@ package com.zy.asrs.service.impl; -import com.zy.asrs.mapper.CommandInfoMapper; -import com.zy.asrs.entity.CommandInfo; -import com.zy.asrs.service.CommandInfoService; +import com.alibaba.fastjson.JSON; import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.zy.asrs.entity.CommandInfo; +import com.zy.asrs.entity.CommandInfoLog; +import com.zy.asrs.mapper.CommandInfoMapper; +import com.zy.asrs.service.CommandInfoLogService; +import com.zy.asrs.service.CommandInfoService; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service("commandInfoService") public class CommandInfoServiceImpl extends ServiceImpl<CommandInfoMapper, CommandInfo> implements CommandInfoService { + + @Autowired + private CommandInfoLogService commandInfoLogService; @Override public List<CommandInfo> selectByTaskNoAndWrkNo(String taskNo, Integer wrkNo) { @@ -20,4 +27,42 @@ public List<CommandInfo> selectByWrkNo(Integer wrkNo) { return this.baseMapper.selectByWrkNo(wrkNo); } + + @Override + public List<CommandInfo> selectByTaskNo(String taskNo) { + return this.baseMapper.selectByTaskNo(taskNo); + } + + @Override + public int saveToHistory(String taskNo) { + int count = 0; + if (this.selectByTaskNo(taskNo).isEmpty()) { + return count; + } + for (CommandInfo commandInfo : this.baseMapper.selectByTaskNo(taskNo)) { + String jsonString = JSON.toJSONString(commandInfo); + CommandInfoLog commandInfoLog = JSON.parseObject(jsonString, CommandInfoLog.class); + commandInfoLog.setId(null); + if (commandInfoLogService.insert(commandInfoLog)) { + count++; + } + } + return count; + } + + @Override + public boolean saveToHistory(Integer id) { + CommandInfo commandInfo = this.baseMapper.selectById(id); + String jsonString = JSON.toJSONString(commandInfo); + CommandInfoLog commandInfoLog = JSON.parseObject(jsonString, CommandInfoLog.class); + commandInfoLog.setId(null); + boolean result1 = commandInfoLogService.insert(commandInfoLog); + Integer result2 = this.baseMapper.deleteById(id); + return result1 && result2 > 0; + } + + @Override + public List<CommandInfo> selectCompleteManualCommand() { + return this.baseMapper.selectCompleteManualCommand(); + } } -- Gitblit v1.9.1