|
|
|
@ -11,6 +11,9 @@ import com.ruoyi.common.utils.SecurityUtils;
|
|
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
|
|
import com.ruoyi.tc.entity.*;
|
|
|
|
|
import com.ruoyi.tc.entity.po.*;
|
|
|
|
|
import com.ruoyi.tc.entity.request.Acomma;
|
|
|
|
|
import com.ruoyi.tc.entity.request.AssetAuditPageRequest;
|
|
|
|
|
import com.ruoyi.tc.entity.request.AssetAuditRequest;
|
|
|
|
|
import com.ruoyi.tc.entity.request.AssetCurrentPageRequest;
|
|
|
|
|
import com.ruoyi.tc.service.*;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
@ -25,6 +28,7 @@ import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import javax.validation.Valid;
|
|
|
|
|
import java.io.Serializable;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -77,6 +81,23 @@ public class AssetCurrentController extends BaseController {
|
|
|
|
|
@Resource
|
|
|
|
|
private UnitService unitService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private AssetCurrentJyService assetCurrentJyService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private AssetBusinessFormJyService assetBusinessFormJyService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private AssetSupplyChainJyService assetSupplyChainJyService ;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private UnitOtherConcatJyservice unitOtherConcatJyservice;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private AssetBasicNetworkJyService assetBasicNetworkJyService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 分页查询所有数据
|
|
|
|
|
*
|
|
|
|
@ -169,46 +190,246 @@ public class AssetCurrentController extends BaseController {
|
|
|
|
|
//获取新增资产id
|
|
|
|
|
Long id = assetCurrent.getId();
|
|
|
|
|
Integer i = unitService.selectTaskId(assetCurrent.getDwmc(), "0");
|
|
|
|
|
|
|
|
|
|
//新增资产复制主表
|
|
|
|
|
AssetCurrentCpPo assetCurrentCpPo = new AssetCurrentCpPo();
|
|
|
|
|
BeanUtil.copyProperties(assetCurrent, assetCurrentCpPo);
|
|
|
|
|
assetCurrentCpPo.setTaskId(i);
|
|
|
|
|
assetCurrentCpService.save(assetCurrentCpPo);
|
|
|
|
|
//新增新监管业务形态
|
|
|
|
|
//根据资产id查询新监管业务形态主表id
|
|
|
|
|
if (assetCurrent.getXjgywxt() != null) {
|
|
|
|
|
assetCurrentCpPo.getXjgywxt().setAssetId(id);
|
|
|
|
|
assetCurrentCpPo.getXjgywxt().setTaskId(i);
|
|
|
|
|
assetBusinessFormCpService.save(assetCurrentCpPo.getXjgywxt());
|
|
|
|
|
}
|
|
|
|
|
if (assetCurrent.getGylxxList() != null) {
|
|
|
|
|
for (AssetSupplyChainCpPo items : assetCurrentCpPo.getGylxxList()) {
|
|
|
|
|
items.setAssetId(id);
|
|
|
|
|
items.setTaskId(i);
|
|
|
|
|
if(i!=null){
|
|
|
|
|
//新增资产复制主表
|
|
|
|
|
AssetCurrentCpPo assetCurrentCpPo = new AssetCurrentCpPo();
|
|
|
|
|
BeanUtil.copyProperties(assetCurrent, assetCurrentCpPo);
|
|
|
|
|
assetCurrentCpPo.setTaskId(i);
|
|
|
|
|
assetCurrentCpService.save(assetCurrentCpPo);
|
|
|
|
|
//新增新监管业务形态
|
|
|
|
|
//根据资产id查询新监管业务形态主表id
|
|
|
|
|
if (assetCurrent.getXjgywxt() != null) {
|
|
|
|
|
assetCurrentCpPo.getXjgywxt().setAssetId(id);
|
|
|
|
|
assetCurrentCpPo.getXjgywxt().setTaskId(i);
|
|
|
|
|
assetBusinessFormCpService.save(assetCurrentCpPo.getXjgywxt());
|
|
|
|
|
}
|
|
|
|
|
if (assetCurrent.getGylxxList() != null) {
|
|
|
|
|
for (AssetSupplyChainCpPo items : assetCurrentCpPo.getGylxxList()) {
|
|
|
|
|
items.setAssetId(id);
|
|
|
|
|
items.setTaskId(i);
|
|
|
|
|
}
|
|
|
|
|
//新增供应链
|
|
|
|
|
assetSupplyChainCpService.saveBatch(assetCurrentCpPo.getGylxxList());
|
|
|
|
|
}
|
|
|
|
|
if (assetCurrent.getJcwlList() != null) {
|
|
|
|
|
for (AssetBasicNetworkCpPo items : assetCurrentCpPo.getJcwlList()) {
|
|
|
|
|
items.setAssetId(assetCurrent.getId());
|
|
|
|
|
items.setTaskId(i);
|
|
|
|
|
}
|
|
|
|
|
//新增基础网络
|
|
|
|
|
assetBasicNetworkCpService.saveBatch(assetCurrentCpPo.getJcwlList());
|
|
|
|
|
}
|
|
|
|
|
if (assetCurrent.getOtherConcat() != null) {
|
|
|
|
|
for (UnitOtherConcatCpPo items : assetCurrentCpPo.getOtherConcat()) {
|
|
|
|
|
items.setAssetId(assetCurrent.getId());
|
|
|
|
|
items.setTaskId(i);
|
|
|
|
|
}
|
|
|
|
|
//新增其他联系人
|
|
|
|
|
unitOtherConcatCpService.saveBatch(assetCurrentCpPo.getOtherConcat());
|
|
|
|
|
}
|
|
|
|
|
//新增供应链
|
|
|
|
|
assetSupplyChainCpService.saveBatch(assetCurrentCpPo.getGylxxList());
|
|
|
|
|
}
|
|
|
|
|
if (assetCurrent.getJcwlList() != null) {
|
|
|
|
|
for (AssetBasicNetworkCpPo items : assetCurrentCpPo.getJcwlList()) {
|
|
|
|
|
items.setAssetId(assetCurrent.getId());
|
|
|
|
|
items.setTaskId(i);
|
|
|
|
|
return success();
|
|
|
|
|
}
|
|
|
|
|
//=================================================
|
|
|
|
|
/**
|
|
|
|
|
* 单位自编辑进行校验
|
|
|
|
|
*/
|
|
|
|
|
@ApiOperation(value = "单位自编辑进行校验")
|
|
|
|
|
@PreAuthorize("@ss.hasAnyRoles('unit')")
|
|
|
|
|
@PostMapping("/unitEdit")
|
|
|
|
|
public AjaxResult unitEdit(@RequestBody @Valid AssetCurrentJyPo assetCurrentJyPo) {
|
|
|
|
|
AssetCurrentJyPo one = assetCurrentJyService.lambdaQuery().eq(AssetCurrentJyPo::getXtmc, assetCurrentJyPo.getXtmc())
|
|
|
|
|
.eq(AssetCurrentJyPo::getDwmc, assetCurrentJyPo.getDwmc()).isNull(AssetCurrentJyPo::getTaskId).one();
|
|
|
|
|
assetCurrentJyPo.setAuditState("1");
|
|
|
|
|
assetCurrentJyPo.setAuditYy(null);
|
|
|
|
|
if (one != null) {
|
|
|
|
|
assetCurrentJyPo.setCurrentId(one.getCurrentId());
|
|
|
|
|
assetCurrentJyService.updateById(assetCurrentJyPo);
|
|
|
|
|
|
|
|
|
|
QueryWrapper<AssetSupplyChainJyPo> queryWrapper2 = new QueryWrapper<>();
|
|
|
|
|
queryWrapper2.eq("asset_id", assetCurrentJyPo.getId());
|
|
|
|
|
assetSupplyChainJyService.remove(queryWrapper2);
|
|
|
|
|
QueryWrapper<AssetBasicNetworkJyPo> queryWrapper3 = new QueryWrapper<>();
|
|
|
|
|
queryWrapper3.eq("asset_id", assetCurrentJyPo.getId());
|
|
|
|
|
assetBasicNetworkJyService.remove(queryWrapper3);
|
|
|
|
|
QueryWrapper<AssetBusinessFormJyPo> queryWrapper4 = new QueryWrapper<>();
|
|
|
|
|
queryWrapper4.eq("asset_id", assetCurrentJyPo.getId());
|
|
|
|
|
assetBusinessFormJyService.remove(queryWrapper4);
|
|
|
|
|
QueryWrapper<UnitOtherConcatJyPo> queryWrapper5 = new QueryWrapper<>();
|
|
|
|
|
queryWrapper5.eq("asset_id", assetCurrentJyPo.getId());
|
|
|
|
|
unitOtherConcatJyservice.remove(queryWrapper5);
|
|
|
|
|
if (assetCurrentJyPo.getXjgywxt() != null) {
|
|
|
|
|
assetCurrentJyPo.getXjgywxt().setAssetId(assetCurrentJyPo.getId());
|
|
|
|
|
assetBusinessFormJyService.save(assetCurrentJyPo.getXjgywxt());
|
|
|
|
|
}
|
|
|
|
|
if (assetCurrentJyPo.getGylxxList() != null) {
|
|
|
|
|
for (AssetSupplyChainJyPo items : assetCurrentJyPo.getGylxxList()) {
|
|
|
|
|
items.setAssetId(assetCurrentJyPo.getId());
|
|
|
|
|
}
|
|
|
|
|
//新增供应链
|
|
|
|
|
assetSupplyChainJyService.saveBatch(assetCurrentJyPo.getGylxxList());
|
|
|
|
|
}
|
|
|
|
|
if (assetCurrentJyPo.getJcwlList() != null) {
|
|
|
|
|
for (AssetBasicNetworkJyPo items : assetCurrentJyPo.getJcwlList()) {
|
|
|
|
|
items.setAssetId(assetCurrentJyPo.getId());
|
|
|
|
|
}
|
|
|
|
|
//新增基础网络
|
|
|
|
|
assetBasicNetworkJyService.saveBatch(assetCurrentJyPo.getJcwlList());
|
|
|
|
|
}
|
|
|
|
|
if (assetCurrentJyPo.getOtherConcat() != null) {
|
|
|
|
|
for (UnitOtherConcatJyPo items : assetCurrentJyPo.getOtherConcat()) {
|
|
|
|
|
items.setAssetId(assetCurrentJyPo.getId());
|
|
|
|
|
}
|
|
|
|
|
//新增其他联系人
|
|
|
|
|
unitOtherConcatJyservice.saveBatch(assetCurrentJyPo.getOtherConcat());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
AssetCurrentCpPo acc = new AssetCurrentCpPo();
|
|
|
|
|
BeanUtil.copyProperties(assetCurrentJyPo, acc);
|
|
|
|
|
assetCurrentCpService.save(acc);
|
|
|
|
|
if (acc.getXjgywxt() != null) {
|
|
|
|
|
acc.getXjgywxt().setAssetId(acc.getId());
|
|
|
|
|
assetBusinessFormCpService.save(acc.getXjgywxt());
|
|
|
|
|
}
|
|
|
|
|
if (acc.getGylxxList() != null) {
|
|
|
|
|
for (AssetSupplyChainCpPo items : acc.getGylxxList()) {
|
|
|
|
|
items.setAssetId(acc.getId());
|
|
|
|
|
}
|
|
|
|
|
//新增供应链
|
|
|
|
|
assetSupplyChainCpService.saveBatch(acc.getGylxxList());
|
|
|
|
|
}
|
|
|
|
|
if (acc.getJcwlList() != null) {
|
|
|
|
|
for (AssetBasicNetworkCpPo items : acc.getJcwlList()) {
|
|
|
|
|
items.setAssetId(acc.getId());
|
|
|
|
|
}
|
|
|
|
|
//新增基础网络
|
|
|
|
|
assetBasicNetworkCpService.saveBatch(acc.getJcwlList());
|
|
|
|
|
}
|
|
|
|
|
if (acc.getOtherConcat() != null) {
|
|
|
|
|
for (UnitOtherConcatCpPo items : acc.getOtherConcat()) {
|
|
|
|
|
items.setAssetId(acc.getId());
|
|
|
|
|
}
|
|
|
|
|
//新增其他联系人
|
|
|
|
|
unitOtherConcatCpService.saveBatch(acc.getOtherConcat());
|
|
|
|
|
}
|
|
|
|
|
//新增基础网络
|
|
|
|
|
assetBasicNetworkCpService.saveBatch(assetCurrentCpPo.getJcwlList());
|
|
|
|
|
}
|
|
|
|
|
if (assetCurrent.getOtherConcat() != null) {
|
|
|
|
|
for (UnitOtherConcatCpPo items : assetCurrentCpPo.getOtherConcat()) {
|
|
|
|
|
items.setAssetId(assetCurrent.getId());
|
|
|
|
|
items.setTaskId(i);
|
|
|
|
|
|
|
|
|
|
return success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 分页查询管理端或者单位端审核列表
|
|
|
|
|
*
|
|
|
|
|
* @param as 查询实体
|
|
|
|
|
* @return 所有数据
|
|
|
|
|
*/
|
|
|
|
|
@ApiOperation(value = "分页查询管理端或者单位端审核列表", response = AssetCurrentCpPo.class)
|
|
|
|
|
@GetMapping("/getAuditList")
|
|
|
|
|
public AjaxResult getAuditList(AssetAuditPageRequest as) {
|
|
|
|
|
Page<AssetCurrentJyPo> page = new Page<>();
|
|
|
|
|
page.setSize(as.getSize());
|
|
|
|
|
page.setCurrent(as.getCurrent());
|
|
|
|
|
try {
|
|
|
|
|
if (!SecurityUtils.getLoginUser().getUser().isAdmin() && !SecurityUtils.hasRole("common")) {
|
|
|
|
|
as.setDwmc(SecurityUtils.getLoginUser().getUser().getNickName());
|
|
|
|
|
}
|
|
|
|
|
//新增其他联系人
|
|
|
|
|
unitOtherConcatCpService.saveBatch(assetCurrentCpPo.getOtherConcat());
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
throw new ServiceException("获取用户信息异常");
|
|
|
|
|
}
|
|
|
|
|
return success(assetCurrentJyService.getAuditList(page, as));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 查看中间数据详情
|
|
|
|
|
*/
|
|
|
|
|
@ApiOperation(value = "单位端查看中间数据详情", response = AssetCurrentCpPo.class)
|
|
|
|
|
@GetMapping("/lookInfo/{id}")
|
|
|
|
|
public AjaxResult lookInfo(@PathVariable Long id) {
|
|
|
|
|
AssetCurrentCpPo byId = assetCurrentCpService.getById(id);
|
|
|
|
|
byId.setGylxxList(assetSupplyChainCpService.lambdaQuery().eq(AssetSupplyChainCpPo::getAssetId ,byId.getId()).list());
|
|
|
|
|
byId.setJcwlList(assetBasicNetworkCpService.lambdaQuery().eq(AssetBasicNetworkCpPo::getAssetId, byId.getId()).list());
|
|
|
|
|
byId.setXjgywxt(assetBusinessFormCpService.lambdaQuery().eq(AssetBusinessFormCpPo::getAssetId, byId.getId()).one());
|
|
|
|
|
byId.setOtherConcat(unitOtherConcatCpService.lambdaQuery().eq(UnitOtherConcatCpPo::getAssetId, byId.getId()).list());
|
|
|
|
|
List<Acomma> a1 = new ArrayList<>();
|
|
|
|
|
if(byId.getGlym()!=null){
|
|
|
|
|
Arrays.asList(byId.getGlym().split(",")).forEach(x -> {
|
|
|
|
|
Acomma acomma = new Acomma();
|
|
|
|
|
acomma.setKey(x);
|
|
|
|
|
a1.add(acomma);
|
|
|
|
|
});
|
|
|
|
|
byId.setGlymList(a1);
|
|
|
|
|
}
|
|
|
|
|
List<Acomma> a2 = new ArrayList<>();
|
|
|
|
|
if(byId.getGlIp()!=null){
|
|
|
|
|
Arrays.asList(byId.getGlIp().split(",")).forEach(x -> {
|
|
|
|
|
Acomma acomma = new Acomma();
|
|
|
|
|
acomma.setKey(x);
|
|
|
|
|
a2.add(acomma);
|
|
|
|
|
});
|
|
|
|
|
byId.setGlIpList(a2);
|
|
|
|
|
}
|
|
|
|
|
return success(byId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 管理端审核
|
|
|
|
|
*
|
|
|
|
|
* @param as 查询实体
|
|
|
|
|
* @return 所有数据
|
|
|
|
|
*/
|
|
|
|
|
@PreAuthorize("@ss.hasAnyRoles('admin,common')")
|
|
|
|
|
@ApiOperation(value = "管理端审核")
|
|
|
|
|
@PostMapping("/audit")
|
|
|
|
|
public AjaxResult audit(@Valid @RequestBody AssetAuditRequest as) {
|
|
|
|
|
AssetCurrentCpPo ass = new AssetCurrentCpPo();
|
|
|
|
|
BeanUtil.copyProperties(as, ass);
|
|
|
|
|
assetCurrentCpService.updateById(ass);
|
|
|
|
|
//通过数据同步
|
|
|
|
|
if ("2".equals(as.getAuditState())) {
|
|
|
|
|
AssetCurrentCpPo byId = assetCurrentCpService.getById(as.getCurrentId());
|
|
|
|
|
AssetCurrent assetCurrent = new AssetCurrent();
|
|
|
|
|
BeanUtil.copyProperties(byId, assetCurrent);
|
|
|
|
|
//修改主表
|
|
|
|
|
assetCurrentService.updateById(assetCurrent);
|
|
|
|
|
//删除副表数据然后再添加
|
|
|
|
|
assetSupplyChainService.deleteByAssetIds(assetCurrent.getId());
|
|
|
|
|
assetBasicNetworkService.deleteByAssetIds(assetCurrent.getId());
|
|
|
|
|
assetBusinessFormService.deleteByAssetIds(assetCurrent.getId());
|
|
|
|
|
unitOtherConcatService.deleteByAssetIds(assetCurrent.getId());
|
|
|
|
|
|
|
|
|
|
List<AssetSupplyChainCpPo> list = assetSupplyChainCpService.lambdaQuery().eq(AssetSupplyChainCpPo::getAssetId, byId.getId()).isNull(AssetSupplyChainCpPo::getTaskId).list();
|
|
|
|
|
list.forEach(x -> {
|
|
|
|
|
AssetSupplyChain a1 = new AssetSupplyChain();
|
|
|
|
|
BeanUtil.copyProperties(x, a1);
|
|
|
|
|
assetSupplyChainService.save(a1);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
List<AssetBasicNetworkCpPo> list1 = assetBasicNetworkCpService.lambdaQuery().eq(AssetBasicNetworkCpPo::getAssetId, byId.getId()).isNull(AssetBasicNetworkCpPo::getTaskId).list();
|
|
|
|
|
list1.forEach(x -> {
|
|
|
|
|
AssetBasicNetwork a2 = new AssetBasicNetwork();
|
|
|
|
|
BeanUtil.copyProperties(x, a2);
|
|
|
|
|
assetBasicNetworkService.save(a2);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
List<AssetBusinessFormCpPo> list2 = assetBusinessFormCpService.lambdaQuery().eq(AssetBusinessFormCpPo::getAssetId, byId.getId()).isNull(AssetBusinessFormCpPo::getTaskId).list();
|
|
|
|
|
list2.forEach(x -> {
|
|
|
|
|
AssetBusinessForm a3 = new AssetBusinessForm();
|
|
|
|
|
BeanUtil.copyProperties(x, a3);
|
|
|
|
|
assetBusinessFormService.save(a3);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
List<UnitOtherConcatCpPo> list3 = unitOtherConcatCpService.lambdaQuery().eq(UnitOtherConcatCpPo::getAssetId, byId.getId()).isNull(UnitOtherConcatCpPo::getTaskId).list();
|
|
|
|
|
list3.forEach(x -> {
|
|
|
|
|
UnitOtherConcat a4 = new UnitOtherConcat();
|
|
|
|
|
BeanUtil.copyProperties(x, a4);
|
|
|
|
|
unitOtherConcatService.save(a4);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
return success();
|
|
|
|
|
}
|
|
|
|
|
//=================================================
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 修改数据
|
|
|
|
|