From 4cceee2ced8d9ed1d8e8d08213372cc8a77ac601 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期一, 30 三月 2026 11:24:54 +0800
Subject: [PATCH] yys 转移设备相关代码
---
src/main/java/com/ruoyi/device/service/impl/DeviceLedgerServiceImpl.java | 33 +++++++++++++++++----------------
1 files changed, 17 insertions(+), 16 deletions(-)
diff --git a/src/main/java/com/ruoyi/device/service/impl/DeviceLedgerServiceImpl.java b/src/main/java/com/ruoyi/device/service/impl/DeviceLedgerServiceImpl.java
index 420ed9a..bb8ac01 100644
--- a/src/main/java/com/ruoyi/device/service/impl/DeviceLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/device/service/impl/DeviceLedgerServiceImpl.java
@@ -1,8 +1,6 @@
package com.ruoyi.device.service.impl;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.utils.SecurityUtils;
@@ -24,7 +22,7 @@
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
-import java.time.ZoneOffset;
+import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -47,11 +45,11 @@
@Override
public AjaxResult saveDeviceLedger(DeviceLedger deviceLedger) {
- LambdaQueryWrapper<DeviceLedger> deviceLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>();
- deviceLedgerLambdaQueryWrapper.eq(DeviceLedger::getDeviceModel,deviceLedger.getDeviceModel());
- if (this.count(deviceLedgerLambdaQueryWrapper) > 0) {
- return AjaxResult.error("璁惧鍨嬪彿宸插瓨鍦�");
- }
+// LambdaQueryWrapper<DeviceLedger> deviceLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>();
+// deviceLedgerLambdaQueryWrapper.eq(DeviceLedger::getDeviceModel,deviceLedger.getDeviceModel());
+// if (this.count(deviceLedgerLambdaQueryWrapper) > 0) {
+// return AjaxResult.error("璁惧鍨嬪彿宸插瓨鍦�");
+// }
boolean save = this.save(deviceLedger);
if (save){
return AjaxResult.success();
@@ -106,15 +104,18 @@
ExcelUtil<DeviceLedgerExeclDto> util = new ExcelUtil<DeviceLedgerExeclDto>(DeviceLedgerExeclDto.class);
List<DeviceLedgerExeclDto> userList = util.importExcel(file.getInputStream());
userList.forEach(c -> {
- DeviceLedger deviceLedger = new DeviceLedger();
- SysUser sysUser = sysUserMapper.selectUserByUserName(c.getCreateUser());
- if (sysUser!=null) {
- deviceLedger.setCreateUser(sysUser.getUserId().intValue());
- }else {
- deviceLedger.setCreateUser(SecurityUtils.getUserId().intValue());
+ for (Integer i = 0; i < c.getNumber(); i++) {
+ DeviceLedger deviceLedger = new DeviceLedger();
+ SysUser sysUser = sysUserMapper.selectUserByUserName(c.getCreateUser());
+ if (sysUser!=null) {
+ deviceLedger.setCreateUser(sysUser.getUserId().intValue());
+ }else {
+ deviceLedger.setCreateUser(SecurityUtils.getUserId().intValue());
+ }
+ BeanUtils.copyProperties(c,deviceLedger);
+ deviceLedger.setNumber(new BigDecimal(1));
+ deviceLedgerMapper.insert(deviceLedger);
}
- BeanUtils.copyProperties(c,deviceLedger);
- deviceLedgerMapper.insert(deviceLedger);
});
return true;
--
Gitblit v1.9.3