|
|
@ -5,14 +5,15 @@ import cn.hutool.core.bean.BeanUtil;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
import com.ruoyi.common.core.controller.BaseController;
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
|
|
|
|
|
import com.ruoyi.common.exception.ServiceException;
|
|
|
|
|
|
|
|
import com.ruoyi.common.utils.SecurityUtils;
|
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
|
import com.ruoyi.tc.entity.*;
|
|
|
|
import com.ruoyi.tc.entity.*;
|
|
|
|
import com.ruoyi.tc.entity.request.AssetCurrentPageRequest;
|
|
|
|
import com.ruoyi.tc.entity.request.AssetCurrentPageRequest;
|
|
|
|
import com.ruoyi.tc.service.AssetBasicNetworkService;
|
|
|
|
import com.ruoyi.tc.service.*;
|
|
|
|
import com.ruoyi.tc.service.AssetCurrentService;
|
|
|
|
|
|
|
|
import com.ruoyi.tc.service.AssetSupplyChainService;
|
|
|
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
|
@ -44,17 +45,33 @@ public class AssetCurrentController extends BaseController {
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private AssetBasicNetworkService assetBasicNetworkService;
|
|
|
|
private AssetBasicNetworkService assetBasicNetworkService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private AssetBusinessFormService assetBusinessFormService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private UnitOtherConcatService unitOtherConcatService;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 分页查询所有数据
|
|
|
|
* 分页查询所有数据
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* @param page 分页对象
|
|
|
|
|
|
|
|
* @param as 查询实体
|
|
|
|
* @param as 查询实体
|
|
|
|
* @return 所有数据
|
|
|
|
* @return 所有数据
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "分页查询所有数据", response = AssetCurrent.class)
|
|
|
|
@ApiOperation(value = "分页查询所有数据", response = AssetCurrent.class)
|
|
|
|
@GetMapping
|
|
|
|
@GetMapping
|
|
|
|
public AjaxResult selectAll(Page<AssetCurrent> page, AssetCurrentPageRequest as) {
|
|
|
|
public AjaxResult selectAll(AssetCurrentPageRequest as) {
|
|
|
|
|
|
|
|
Page<AssetCurrent> page = new Page<>();
|
|
|
|
|
|
|
|
page.setSize(as.getSize());
|
|
|
|
|
|
|
|
page.setCurrent(as.getCurrent());
|
|
|
|
|
|
|
|
String nickName = null;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
if (!SecurityUtils.getLoginUser().getUser().isAdmin() || !SecurityUtils.hasRole("common")) {
|
|
|
|
|
|
|
|
nickName = SecurityUtils.getLoginUser().getUser().getNickName();
|
|
|
|
|
|
|
|
as.setDwmc(nickName);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
throw new ServiceException("获取用户信息异常");
|
|
|
|
|
|
|
|
}
|
|
|
|
return success(assetCurrentService.page(page, as));
|
|
|
|
return success(assetCurrentService.page(page, as));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -67,7 +84,7 @@ public class AssetCurrentController extends BaseController {
|
|
|
|
@ApiOperation(value = "通过主键查询单条数据", response = AssetCurrent.class)
|
|
|
|
@ApiOperation(value = "通过主键查询单条数据", response = AssetCurrent.class)
|
|
|
|
@GetMapping("{id}")
|
|
|
|
@GetMapping("{id}")
|
|
|
|
public AjaxResult selectOne(@PathVariable Serializable id) {
|
|
|
|
public AjaxResult selectOne(@PathVariable Serializable id) {
|
|
|
|
return success(assetCurrentService.getById(id));
|
|
|
|
return success(assetCurrentService.selectOne(id));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -78,8 +95,36 @@ public class AssetCurrentController extends BaseController {
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@ApiOperation(value = "新增数据")
|
|
|
|
@ApiOperation(value = "新增数据")
|
|
|
|
@PostMapping
|
|
|
|
@PostMapping
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
public AjaxResult insert(@RequestBody @Valid AssetCurrent assetCurrent) {
|
|
|
|
public AjaxResult insert(@RequestBody @Valid AssetCurrent assetCurrent) {
|
|
|
|
return success(assetCurrentService.save(assetCurrent));
|
|
|
|
assetCurrentService.save(assetCurrent);
|
|
|
|
|
|
|
|
//新增新监管业务形态
|
|
|
|
|
|
|
|
if (assetCurrent.getXjgywxt() != null) {
|
|
|
|
|
|
|
|
assetCurrent.getXjgywxt().setAssetId(assetCurrent.getId());
|
|
|
|
|
|
|
|
assetBusinessFormService.save(assetCurrent.getXjgywxt());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!assetCurrent.getGylxxList().isEmpty()) {
|
|
|
|
|
|
|
|
for (AssetSupplyChain items : assetCurrent.getGylxxList()) {
|
|
|
|
|
|
|
|
items.setAssetId(assetCurrent.getId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//新增供应链
|
|
|
|
|
|
|
|
assetSupplyChainService.saveBatch(assetCurrent.getGylxxList());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!assetCurrent.getJcwlList().isEmpty()) {
|
|
|
|
|
|
|
|
for (AssetBasicNetwork items : assetCurrent.getJcwlList()) {
|
|
|
|
|
|
|
|
items.setAssetId(assetCurrent.getId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//新增基础网络
|
|
|
|
|
|
|
|
assetBasicNetworkService.saveBatch(assetCurrent.getJcwlList());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!assetCurrent.getOtherConcat().isEmpty()) {
|
|
|
|
|
|
|
|
for (UnitOtherConcat items : assetCurrent.getOtherConcat()) {
|
|
|
|
|
|
|
|
items.setAssetId(assetCurrent.getId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//新增其他联系人
|
|
|
|
|
|
|
|
unitOtherConcatService.saveBatch(assetCurrent.getOtherConcat());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return success();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -91,7 +136,33 @@ public class AssetCurrentController extends BaseController {
|
|
|
|
@ApiOperation(value = "修改数据")
|
|
|
|
@ApiOperation(value = "修改数据")
|
|
|
|
@PutMapping
|
|
|
|
@PutMapping
|
|
|
|
public AjaxResult update(@RequestBody @Valid AssetCurrent assetCurrent) {
|
|
|
|
public AjaxResult update(@RequestBody @Valid AssetCurrent assetCurrent) {
|
|
|
|
return success(assetCurrentService.updateById(assetCurrent));
|
|
|
|
assetCurrentService.updateById(assetCurrent);
|
|
|
|
|
|
|
|
if (assetCurrent.getXjgywxt() != null) {
|
|
|
|
|
|
|
|
assetCurrent.getXjgywxt().setAssetId(assetCurrent.getId());
|
|
|
|
|
|
|
|
assetBusinessFormService.saveOrUpdate(assetCurrent.getXjgywxt());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!assetCurrent.getGylxxList().isEmpty()) {
|
|
|
|
|
|
|
|
for (AssetSupplyChain items : assetCurrent.getGylxxList()) {
|
|
|
|
|
|
|
|
items.setAssetId(assetCurrent.getId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//新增供应链
|
|
|
|
|
|
|
|
assetSupplyChainService.saveOrUpdateBatch(assetCurrent.getGylxxList());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!assetCurrent.getJcwlList().isEmpty()) {
|
|
|
|
|
|
|
|
for (AssetBasicNetwork items : assetCurrent.getJcwlList()) {
|
|
|
|
|
|
|
|
items.setAssetId(assetCurrent.getId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//新增基础网络
|
|
|
|
|
|
|
|
assetBasicNetworkService.saveOrUpdateBatch(assetCurrent.getJcwlList());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!assetCurrent.getOtherConcat().isEmpty()) {
|
|
|
|
|
|
|
|
for (UnitOtherConcat items : assetCurrent.getOtherConcat()) {
|
|
|
|
|
|
|
|
items.setAssetId(assetCurrent.getId());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//新增其他联系人
|
|
|
|
|
|
|
|
unitOtherConcatService.saveOrUpdateBatch(assetCurrent.getOtherConcat());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return success();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -103,7 +174,12 @@ public class AssetCurrentController extends BaseController {
|
|
|
|
@ApiOperation(value = "删除数据")
|
|
|
|
@ApiOperation(value = "删除数据")
|
|
|
|
@DeleteMapping
|
|
|
|
@DeleteMapping
|
|
|
|
public AjaxResult delete(@RequestParam("idList") List<Long> idList) {
|
|
|
|
public AjaxResult delete(@RequestParam("idList") List<Long> idList) {
|
|
|
|
return success(assetCurrentService.removeByIds(idList));
|
|
|
|
assetSupplyChainService.deleteByAssetIds(idList);
|
|
|
|
|
|
|
|
assetBasicNetworkService.deleteByAssetIds(idList);
|
|
|
|
|
|
|
|
assetBusinessFormService.deleteByAssetIds(idList);
|
|
|
|
|
|
|
|
unitOtherConcatService.deleteByAssetIds(idList);
|
|
|
|
|
|
|
|
assetCurrentService.deleteByUnitIds(idList);
|
|
|
|
|
|
|
|
return success();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
@ -128,18 +204,18 @@ public class AssetCurrentController extends BaseController {
|
|
|
|
for (AssetCurrent x : list) {
|
|
|
|
for (AssetCurrent x : list) {
|
|
|
|
//对应的资产
|
|
|
|
//对应的资产
|
|
|
|
AssetExport assetExport = new AssetExport();
|
|
|
|
AssetExport assetExport = new AssetExport();
|
|
|
|
BeanUtil.copyProperties(x,assetExport);
|
|
|
|
BeanUtil.copyProperties(x, assetExport);
|
|
|
|
//查找对应的系统建设单位
|
|
|
|
//查找对应的系统建设单位
|
|
|
|
AssetSupplyChain jsdw = assetSupplyChainService.getJsdw(x.getId());
|
|
|
|
AssetSupplyChain jsdw = assetSupplyChainService.getJsdw(x.getId());
|
|
|
|
BeanUtil.copyProperties(jsdw,assetExport);
|
|
|
|
BeanUtil.copyProperties(jsdw, assetExport);
|
|
|
|
|
|
|
|
|
|
|
|
List<AssetBasicNetwork> byList = assetBasicNetworkService.getByAssetId(x.getId());
|
|
|
|
List<AssetBasicNetwork> byList = assetBasicNetworkService.getByAssetId(x.getId());
|
|
|
|
for (AssetBasicNetwork items : byList) {
|
|
|
|
for (AssetBasicNetwork items : byList) {
|
|
|
|
if(items.getType() == 1){
|
|
|
|
if (items.getType() == 1) {
|
|
|
|
//查找对应的服务器信息
|
|
|
|
//查找对应的服务器信息
|
|
|
|
BeanUtil.copyProperties(items,assetExport);
|
|
|
|
BeanUtil.copyProperties(items, assetExport);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(items.getType() == 2){
|
|
|
|
if (items.getType() == 2) {
|
|
|
|
//查找对应网络设备
|
|
|
|
//查找对应网络设备
|
|
|
|
assetExport.setWlpp(items.getPp());
|
|
|
|
assetExport.setWlpp(items.getPp());
|
|
|
|
assetExport.setWlyjxh(items.getYjxh());
|
|
|
|
assetExport.setWlyjxh(items.getYjxh());
|
|
|
@ -150,7 +226,7 @@ public class AssetCurrentController extends BaseController {
|
|
|
|
assetExport.setWlsbIp(items.getSbIp());
|
|
|
|
assetExport.setWlsbIp(items.getSbIp());
|
|
|
|
assetExport.setWlyjyt(items.getYjyt());
|
|
|
|
assetExport.setWlyjyt(items.getYjyt());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(items.getType() == 3){
|
|
|
|
if (items.getType() == 3) {
|
|
|
|
//查找对应安全设备
|
|
|
|
//查找对应安全设备
|
|
|
|
assetExport.setAqwlpp(items.getPp());
|
|
|
|
assetExport.setAqwlpp(items.getPp());
|
|
|
|
assetExport.setAqwlsblx(items.getSblx());
|
|
|
|
assetExport.setAqwlsblx(items.getSblx());
|
|
|
@ -175,17 +251,17 @@ public class AssetCurrentController extends BaseController {
|
|
|
|
for (AssetExport items : proList) {
|
|
|
|
for (AssetExport items : proList) {
|
|
|
|
AssetCurrent as = new AssetCurrent();
|
|
|
|
AssetCurrent as = new AssetCurrent();
|
|
|
|
//copy新增到新的现有资产表里面
|
|
|
|
//copy新增到新的现有资产表里面
|
|
|
|
BeanUtil.copyProperties(items,as);
|
|
|
|
BeanUtil.copyProperties(items, as);
|
|
|
|
assetCurrentService.save(as);
|
|
|
|
assetCurrentService.save(as);
|
|
|
|
//新增系统建设单位
|
|
|
|
//新增系统建设单位
|
|
|
|
AssetSupplyChain s1 = new AssetSupplyChain();
|
|
|
|
AssetSupplyChain s1 = new AssetSupplyChain();
|
|
|
|
BeanUtil.copyProperties(items,s1);
|
|
|
|
BeanUtil.copyProperties(items, s1);
|
|
|
|
s1.setType(5);
|
|
|
|
s1.setType(5);
|
|
|
|
s1.setAssetId(as.getId());
|
|
|
|
s1.setAssetId(as.getId());
|
|
|
|
assetSupplyChainService.save(s1);
|
|
|
|
assetSupplyChainService.save(s1);
|
|
|
|
//新增服务器信息
|
|
|
|
//新增服务器信息
|
|
|
|
AssetBasicNetwork a1 = new AssetBasicNetwork();
|
|
|
|
AssetBasicNetwork a1 = new AssetBasicNetwork();
|
|
|
|
BeanUtil.copyProperties(items,a1);
|
|
|
|
BeanUtil.copyProperties(items, a1);
|
|
|
|
a1.setType(1);
|
|
|
|
a1.setType(1);
|
|
|
|
a1.setAssetId(as.getId());
|
|
|
|
a1.setAssetId(as.getId());
|
|
|
|
assetBasicNetworkService.save(a1);
|
|
|
|
assetBasicNetworkService.save(a1);
|
|
|
|