设备导入修改
This commit is contained in:
parent
6229b1b4c7
commit
bf7e1bb5ba
@ -19,7 +19,7 @@ public interface SysIotModelMapper extends BaseMapper<SysIotModel> {
|
||||
|
||||
List<SysIotModelServiceExcel> queryServiceByModelId(Long id);
|
||||
|
||||
Long queryIotModelIdByName(String code);
|
||||
Long queryIotModelIdByCode(String code);
|
||||
|
||||
List<SysIotModelVo> getSysIotModelByType(Integer objectType);
|
||||
|
||||
|
@ -2,12 +2,14 @@ package com.das.modules.equipment.service.impl;
|
||||
|
||||
import cn.dev33.satoken.stp.StpUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.poi.excel.ExcelReader;
|
||||
import cn.hutool.poi.excel.ExcelUtil;
|
||||
import cn.hutool.poi.excel.ExcelWriter;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.das.common.config.SessionUtil;
|
||||
import com.das.common.constant.EquipmentTypeIds;
|
||||
import com.das.common.exceptions.ServiceException;
|
||||
import com.das.common.utils.BeanCopyUtils;
|
||||
import com.das.common.utils.PageDataInfo;
|
||||
@ -41,6 +43,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.rmi.ServerException;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
@ -249,10 +252,19 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
|
||||
List<SysEquipment> delSysEquipmentList = new ArrayList<>();
|
||||
// 遍历
|
||||
for (List<Object> row : list) {
|
||||
if (ObjectUtil.isAllNotEmpty(row.get(4),row.get(1),row.get(5))){
|
||||
throw new ServerException("请检查必填参数:"+row);
|
||||
}
|
||||
if (!Integer.valueOf(row.get(1).toString()).equals(EquipmentTypeIds.EQUIPMENT_TYPE_STATION_WTG) && !Integer.valueOf(row.get(1).toString()).equals(EquipmentTypeIds.EQUIPMENT_TYPE_WIND_FARM)){
|
||||
throw new ServerException("设备类型编码错误"+ row.get(1));
|
||||
}
|
||||
SysEquipment field = new SysEquipment();
|
||||
// 根据编码获取物模型id
|
||||
if (StringUtils.hasText(row.get(2).toString())) {
|
||||
Long iotModelId = sysIotModelMapper.queryIotModelIdByName(row.get(3).toString());
|
||||
Long iotModelId = sysIotModelMapper.queryIotModelIdByCode(row.get(2).toString());
|
||||
if (iotModelId == null){
|
||||
throw new ServerException("物模型编码错误,错误编码:"+ row.get(2).toString());
|
||||
}
|
||||
field.setIotModelId(iotModelId);
|
||||
}
|
||||
if (StringUtils.hasText(row.get(13).toString())) {
|
||||
@ -263,9 +275,9 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
|
||||
field.setObjectType(Integer.valueOf(row.get(1).toString()));
|
||||
field.setCode(row.get(4).toString());
|
||||
field.setName(row.get(5).toString());
|
||||
field.setMadeinFactory(row.get(6).toString());
|
||||
field.setModel(row.get(7).toString());
|
||||
field.setLocation(row.get(8).toString());
|
||||
field.setMadeinFactory(ObjectUtil.isEmpty(row.get(6)) ? null : row.get(6).toString());
|
||||
field.setModel(ObjectUtil.isEmpty(row.get(7)) ? null : row.get(7).toString());
|
||||
field.setLocation(ObjectUtil.isEmpty(row.get(8)) ? null : row.get(8).toString());
|
||||
if (StringUtils.hasText(row.get(9).toString())) {
|
||||
field.setLongitude(Double.valueOf(row.get(9).toString()));
|
||||
}
|
||||
@ -276,9 +288,9 @@ public class SysEquipmentServiceImpl implements SysEquipmentService {
|
||||
if (StringUtils.hasText(row.get(11).toString())) {
|
||||
field.setInstallDate(sf.parse(row.get(11).toString()));
|
||||
}
|
||||
field.setRemarks(row.get(12).toString());
|
||||
field.setBelongLine(row.get(17).toString());
|
||||
field.setStandard(Integer.valueOf(row.get(18).toString()));
|
||||
field.setRemarks(ObjectUtil.isEmpty(row.get(12)) ? null : row.get(12).toString());
|
||||
field.setBelongLine(ObjectUtil.isEmpty(row.get(17)) ? null : row.get(17).toString());
|
||||
field.setStandard(ObjectUtil.isEmpty(row.get(18)) ? null : Integer.valueOf(row.get(18).toString()));
|
||||
if (StringUtils.hasText(row.get(19).toString())) {
|
||||
field.setNominalCapacity(Double.valueOf(row.get(19).toString()));
|
||||
}
|
||||
|
@ -45,7 +45,7 @@
|
||||
where sims.iot_model_id = #{id} order by sims.porder asc
|
||||
</select>
|
||||
|
||||
<select id="queryIotModelIdByName" resultType="java.lang.Long">
|
||||
<select id="queryIotModelIdByCode" resultType="java.lang.Long">
|
||||
select id from sys_iot_model where iot_model_code = #{code}
|
||||
</select>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user