diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetTaskController.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetTaskController.java index b898439..297814f 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetTaskController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/controller/AssetTaskController.java @@ -384,15 +384,11 @@ public class AssetTaskController extends BaseController { } assetCurrent.setGlym(a.toString()); StringBuilder b = new StringBuilder(); - if (CollectionUtil.isNotEmpty(assetCurrent.getGlIpList())) { - assetCurrent.getGlIpList().forEach(x -> { - if (!Objects.equals(x.getKey(), "") && x.getKey() != null) { - b.append(x.getKey()); - b.append(","); - } - }); + if (assetCurrent.getGlIpList() != null) { + assetCurrent.setGlIp(assetCurrent.getGlIpList().toString()); + } else { + assetCurrent.setGlIp(""); } - assetCurrent.setGlIp(b.toString()); // assetCurrent.setCurrentId(null); BeanUtils.copyProperties(assetCurrent, ac); assetCurrentService.updateById(ac); @@ -540,113 +536,7 @@ public class AssetTaskController extends BaseController { @PostMapping("/jyTj") @Transactional(rollbackFor = Exception.class) public AjaxResult tj(@RequestBody @Validated AssetCurrentJyPo assetCurrent) { -// //判断是否是驳回后提交 -// QueryWrapper queryWrapper = new QueryWrapper<>(); -// queryWrapper.eq("current_id", assetCurrent.getCurrentId()); -// AssetCurrentJyPo assetCurrentJyPo = assetCurrentJyService.getOne(queryWrapper); -// if (assetCurrentJyPo.getStatus() == 4) { -// // 获取当前时间 -// LocalDateTime localDateTime = LocalDateTime.now(); -// // 转换为 Date -// Date date = Date.from(localDateTime.atZone(ZoneId.systemDefault()).toInstant()); -// //新增历史记录 -// StringBuilder e = new StringBuilder(); -// if (CollectionUtil.isNotEmpty(assetCurrent.getGlymList())) { -// assetCurrent.getGlymList().forEach(x -> { -// if (!Objects.equals(x.getKey(), "") && x.getKey() != null) { -// e.append(x.getKey()); -// e.append(","); -// } -// }); -// } -// assetCurrent.setGlym(e.toString()); -// StringBuilder f = new StringBuilder(); -// if (CollectionUtil.isNotEmpty(assetCurrent.getGlIpList())) { -// assetCurrent.getGlIpList().forEach(x -> { -// if (!Objects.equals(x.getKey(), "") && x.getKey() != null) { -// f.append(x.getKey()); -// f.append(","); -// } -// }); -// } -// assetCurrent.setGlym(e.toString()); -// -// -// assetCurrent.setGlIp(f.toString()); -// assetCurrent.setStatus(assetCurrent.getStatus()); -// AssetCurrentHistory assetCurrentHistory = new AssetCurrentHistory(); -// // 设置更新时间 -// assetCurrent.setUpdateTime(date); -// BeanUtils.copyProperties(assetCurrent, assetCurrentHistory); -// assetCurrentHistory.setCurrentId(null); -// assetCurrentHistory.setStatus(4); -// assetCurrentHistoryService.save(assetCurrentHistory); // -// //新增新监管业务形态历史表 -// if (assetCurrent.getXjgywxt() != null) { -// assetCurrent.getXjgywxt().setAssetId(assetCurrent.getId()); -// assetCurrent.getXjgywxt().setTaskId(assetCurrent.getTaskId()); -// AssetBusinessFormHistory assetBusinessFormHistory = new AssetBusinessFormHistory(); -// assetBusinessFormHistory.setCopyId(assetCurrent.getCurrentId()); -// BeanUtils.copyProperties(assetCurrent.getXjgywxt(), assetBusinessFormHistory); -// assetBusinessFormHistory.setBusinessId(null); -// assetBusinessFormHistoryService.save(assetBusinessFormHistory); -// -// } -// if (!assetCurrent.getGylxxList().isEmpty()) { -// for (AssetSupplyChainJyPo items : assetCurrent.getGylxxList()) { -// items.setAssetId(assetCurrent.getId()); -// items.setTaskId(assetCurrent.getTaskId()); -// -// } -// //新增供应链历史表 -// List assetSupplyChainHistoryList = assetCurrent.getGylxxList().stream() -// .map(cpPo -> { -// AssetSupplyChainHistory assetSupplyChainHistory = new AssetSupplyChainHistory(); -// assetSupplyChainHistory.setCopyId(assetCurrent.getCurrentId()); -// BeanUtils.copyProperties(cpPo, assetSupplyChainHistory); // 复制属性 -// assetSupplyChainHistory.setSupplyId(null); -// return assetSupplyChainHistory; // 返回新对象 -// }) -// .collect(Collectors.toList()); // 收集到列表中 -// assetSupplyChainHistoryService.saveBatch(assetSupplyChainHistoryList); -// } -// if (!assetCurrent.getJcwlList().isEmpty()) { -// for (AssetBasicNetworkJyPo items : assetCurrent.getJcwlList()) { -// items.setAssetId(assetCurrent.getId()); -// items.setTaskId(assetCurrent.getTaskId()); -// -// } -// //新增基础网络历史表 -// List assetSupplyChainHistoryList = assetCurrent.getJcwlList().stream() -// .map(cpPo -> { -// AssetBasicNetworkHistory assetBasicNetworkHistory = new AssetBasicNetworkHistory(); -// assetBasicNetworkHistory.setCopyId(assetCurrent.getCurrentId()); -// BeanUtils.copyProperties(cpPo, assetBasicNetworkHistory); // 复制属性 -// assetBasicNetworkHistory.setNetworkId(null); -// return assetBasicNetworkHistory; // 返回新对象 -// }) -// .collect(Collectors.toList()); // 收集到列表中 -// assetBasicNetworkHistoryService.saveBatch(assetSupplyChainHistoryList); -// } -// if (!assetCurrent.getOtherConcat().isEmpty()) { -// for (UnitOtherConcatJyPo items : assetCurrent.getOtherConcat()) { -// items.setAssetId(assetCurrent.getId()); -// items.setTaskId(assetCurrent.getTaskId()); -// } -// //新增其他联系人 -// List unitOtherConcatHistoryList = assetCurrent.getOtherConcat().stream() -// .map(cpPo -> { -// UnitOtherConcatHistory unitOtherConcatHistory = new UnitOtherConcatHistory(); -// unitOtherConcatHistory.setCopyId(assetCurrent.getCurrentId()); -// BeanUtils.copyProperties(cpPo, unitOtherConcatHistory); // 复制属性 -// unitOtherConcatHistory.setConcatId(null); -// return unitOtherConcatHistory; // 返回新对象 -// }) -// .collect(Collectors.toList()); // 收集到列表中 -// unitOtherConcatHistoryService.saveBatch(unitOtherConcatHistoryList); -// } -// } //根据资产id和任务id删除五张表数据 assetCurrentCpService.deletByAssetIdandTaskId(assetCurrent.getId(), assetCurrent.getTaskId()); assetBusinessFormCpService.deletByAssetIdandTaskId(assetCurrent.getId(), assetCurrent.getTaskId()); @@ -677,14 +567,11 @@ public class AssetTaskController extends BaseController { assetCurrent.setGlym(a.toString()); StringBuilder b = new StringBuilder(); if (assetCurrent.getGlIpList() != null) { - assetCurrent.getGlIpList().forEach(x -> { - if (!Objects.equals(x.getKey(), "") && x.getKey() != null) { - b.append(x.getKey()); - b.append(","); - } - }); + assetCurrent.setGlIp(assetCurrent.getGlIpList().toString()); + } else { + assetCurrent.setGlIp(""); } - assetCurrent.setGlIp(b.toString()); + assetCurrent.setStatus(1); Date date = new Date(); assetCurrent.setUpdateTime(date); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetTaskServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetTaskServiceImpl.java index f020d67..01f684c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetTaskServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/tc/service/impl/AssetTaskServiceImpl.java @@ -1,6 +1,8 @@ package com.ruoyi.tc.service.impl; import cn.hutool.core.collection.CollectionUtil; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; @@ -386,14 +388,20 @@ public class AssetTaskServiceImpl extends ServiceImpl a2 = new ArrayList<>(); - if (byId.getGlIp() != null) { - Arrays.asList(byId.getGlIp().split(",")).forEach(x -> { + if(byId.getGlIp()!=null&& !byId.getGlIp().isEmpty()){ + for (Object o : JSONArray.parseArray(byId.getGlIp())) { Acomma acomma = new Acomma(); - acomma.setKey(x); + JSONObject jsonObject = JSONObject.parseObject(o.toString()); + acomma.setKey(jsonObject.get("key").toString()); + acomma.setIpType(jsonObject.get("ipType").toString()); + acomma.setPort(jsonObject.get("port").toString()); a2.add(acomma); - }); + } byId.setGlIpList(a2); + }else { + byId.setGlIpList(new ArrayList<>()); } + return byId; @@ -767,14 +775,10 @@ public class AssetTaskServiceImpl extends ServiceImpl { - if (!Objects.equals(x.getKey(), "") && x.getKey() != null) { - b.append(x.getKey()); - b.append(","); - } - }); + req.getAssetCurrentCpPo().setGlIp(b.toString()); + }else{ + req.getAssetCurrentCpPo().setGlIp(""); } - req.getAssetCurrentCpPo().setGlIp(b.toString()); req.getAssetCurrentCpPo().setStatus(req.getStatus()); // 设置更新时间 @@ -832,14 +836,11 @@ public class AssetTaskServiceImpl extends ServiceImpl { - if (!Objects.equals(x.getKey(), "") && x.getKey() != null) { - d.append(x.getKey()); - d.append(","); - } - }); + req.getAssetCurrentCpPo().setGlIp(b.toString()); + }else{ + req.getAssetCurrentCpPo().setGlIp(""); } - req.getAssetCurrentCpPo().setGlIp(b.toString()); + req.getAssetCurrentCpPo().setStatus(req.getStatus()); // 设置更新时间