ip任务端修改

duhanyu
dongdingding 1 week ago
parent 1f03c113ee
commit c83215aca2

@ -384,15 +384,11 @@ public class AssetTaskController extends BaseController {
} }
assetCurrent.setGlym(a.toString()); assetCurrent.setGlym(a.toString());
StringBuilder b = new StringBuilder(); StringBuilder b = new StringBuilder();
if (CollectionUtil.isNotEmpty(assetCurrent.getGlIpList())) { if (assetCurrent.getGlIpList() != null) {
assetCurrent.getGlIpList().forEach(x -> { assetCurrent.setGlIp(assetCurrent.getGlIpList().toString());
if (!Objects.equals(x.getKey(), "") && x.getKey() != null) { } else {
b.append(x.getKey()); assetCurrent.setGlIp("");
b.append(",");
}
});
} }
assetCurrent.setGlIp(b.toString());
// assetCurrent.setCurrentId(null); // assetCurrent.setCurrentId(null);
BeanUtils.copyProperties(assetCurrent, ac); BeanUtils.copyProperties(assetCurrent, ac);
assetCurrentService.updateById(ac); assetCurrentService.updateById(ac);
@ -540,113 +536,7 @@ public class AssetTaskController extends BaseController {
@PostMapping("/jyTj") @PostMapping("/jyTj")
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public AjaxResult tj(@RequestBody @Validated AssetCurrentJyPo assetCurrent) { public AjaxResult tj(@RequestBody @Validated AssetCurrentJyPo assetCurrent) {
// //判断是否是驳回后提交
// QueryWrapper<AssetCurrentJyPo> 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<AssetSupplyChainHistory> 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<AssetBasicNetworkHistory> 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<UnitOtherConcatHistory> 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删除五张表数据 //根据资产id和任务id删除五张表数据
assetCurrentCpService.deletByAssetIdandTaskId(assetCurrent.getId(), assetCurrent.getTaskId()); assetCurrentCpService.deletByAssetIdandTaskId(assetCurrent.getId(), assetCurrent.getTaskId());
assetBusinessFormCpService.deletByAssetIdandTaskId(assetCurrent.getId(), assetCurrent.getTaskId()); assetBusinessFormCpService.deletByAssetIdandTaskId(assetCurrent.getId(), assetCurrent.getTaskId());
@ -677,14 +567,11 @@ public class AssetTaskController extends BaseController {
assetCurrent.setGlym(a.toString()); assetCurrent.setGlym(a.toString());
StringBuilder b = new StringBuilder(); StringBuilder b = new StringBuilder();
if (assetCurrent.getGlIpList() != null) { if (assetCurrent.getGlIpList() != null) {
assetCurrent.getGlIpList().forEach(x -> { assetCurrent.setGlIp(assetCurrent.getGlIpList().toString());
if (!Objects.equals(x.getKey(), "") && x.getKey() != null) { } else {
b.append(x.getKey()); assetCurrent.setGlIp("");
b.append(",");
}
});
} }
assetCurrent.setGlIp(b.toString());
assetCurrent.setStatus(1); assetCurrent.setStatus(1);
Date date = new Date(); Date date = new Date();
assetCurrent.setUpdateTime(date); assetCurrent.setUpdateTime(date);

@ -1,6 +1,8 @@
package com.ruoyi.tc.service.impl; package com.ruoyi.tc.service.impl;
import cn.hutool.core.collection.CollectionUtil; 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.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -386,14 +388,20 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
byId.setGlymList(a1); byId.setGlymList(a1);
} }
List<Acomma> a2 = new ArrayList<>(); List<Acomma> a2 = new ArrayList<>();
if (byId.getGlIp() != null) { if(byId.getGlIp()!=null&& !byId.getGlIp().isEmpty()){
Arrays.asList(byId.getGlIp().split(",")).forEach(x -> { for (Object o : JSONArray.parseArray(byId.getGlIp())) {
Acomma acomma = new Acomma(); 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); a2.add(acomma);
}); }
byId.setGlIpList(a2); byId.setGlIpList(a2);
}else {
byId.setGlIpList(new ArrayList<>());
} }
return byId; return byId;
@ -767,14 +775,10 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
req.getAssetCurrentCpPo().setGlym(a.toString()); req.getAssetCurrentCpPo().setGlym(a.toString());
StringBuilder b = new StringBuilder(); StringBuilder b = new StringBuilder();
if (CollectionUtil.isNotEmpty(req.getAssetCurrentCpPo().getGlIpList())) { if (CollectionUtil.isNotEmpty(req.getAssetCurrentCpPo().getGlIpList())) {
req.getAssetCurrentCpPo().getGlIpList().forEach(x -> { req.getAssetCurrentCpPo().setGlIp(b.toString());
if (!Objects.equals(x.getKey(), "") && x.getKey() != null) { }else{
b.append(x.getKey()); req.getAssetCurrentCpPo().setGlIp("");
b.append(",");
}
});
} }
req.getAssetCurrentCpPo().setGlIp(b.toString());
req.getAssetCurrentCpPo().setStatus(req.getStatus()); req.getAssetCurrentCpPo().setStatus(req.getStatus());
// 设置更新时间 // 设置更新时间
@ -832,14 +836,11 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
req.getAssetCurrentCpPo().setGlym(a.toString()); req.getAssetCurrentCpPo().setGlym(a.toString());
StringBuilder d = new StringBuilder(); StringBuilder d = new StringBuilder();
if (CollectionUtil.isNotEmpty(req.getAssetCurrentCpPo().getGlIpList())) { if (CollectionUtil.isNotEmpty(req.getAssetCurrentCpPo().getGlIpList())) {
req.getAssetCurrentCpPo().getGlIpList().forEach(x -> { req.getAssetCurrentCpPo().setGlIp(b.toString());
if (!Objects.equals(x.getKey(), "") && x.getKey() != null) { }else{
d.append(x.getKey()); req.getAssetCurrentCpPo().setGlIp("");
d.append(",");
}
});
} }
req.getAssetCurrentCpPo().setGlIp(b.toString());
req.getAssetCurrentCpPo().setStatus(req.getStatus()); req.getAssetCurrentCpPo().setStatus(req.getStatus());
// 设置更新时间 // 设置更新时间

Loading…
Cancel
Save