|
|
@ -2,12 +2,13 @@ package com.ruoyi.tc.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
import com.ruoyi.tc.entity.AssetLc;
|
|
|
|
import com.ruoyi.common.utils.bean.BeanUtils;
|
|
|
|
import com.ruoyi.tc.entity.AssetTask;
|
|
|
|
import com.ruoyi.tc.entity.*;
|
|
|
|
import com.ruoyi.tc.entity.po.*;
|
|
|
|
import com.ruoyi.tc.entity.po.*;
|
|
|
|
import com.ruoyi.tc.entity.request.*;
|
|
|
|
import com.ruoyi.tc.entity.request.*;
|
|
|
|
import com.ruoyi.tc.entity.response.AssestTaskXqresponse;
|
|
|
|
import com.ruoyi.tc.entity.response.AssestTaskXqresponse;
|
|
|
|
import com.ruoyi.tc.entity.response.AssetTaskResponse;
|
|
|
|
import com.ruoyi.tc.entity.response.AssetTaskResponse;
|
|
|
|
|
|
|
|
import com.ruoyi.tc.entity.response.AssetTaskStatusResponse;
|
|
|
|
import com.ruoyi.tc.entity.response.AssetdwHcResponse;
|
|
|
|
import com.ruoyi.tc.entity.response.AssetdwHcResponse;
|
|
|
|
import com.ruoyi.tc.mapper.AssetTaskMapper;
|
|
|
|
import com.ruoyi.tc.mapper.AssetTaskMapper;
|
|
|
|
import com.ruoyi.tc.service.*;
|
|
|
|
import com.ruoyi.tc.service.*;
|
|
|
@ -18,6 +19,7 @@ import java.time.LocalDateTime;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 任务主表(AssetTask)表服务实现类
|
|
|
|
* 任务主表(AssetTask)表服务实现类
|
|
|
@ -50,6 +52,22 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private AssetLcService assetLcService;
|
|
|
|
private AssetLcService assetLcService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private AssetCurrentService assetCurrentService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private AssetBusinessFormService assetBusinessFormService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private AssetBasicNetworkService assetBasicNetworkService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private AssetSupplyChainService assetSupplyChainService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
|
|
|
private UnitOtherConcatService unitOtherConcatService;
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 通过ID查询单条数据
|
|
|
|
* 通过ID查询单条数据
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -205,24 +223,135 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public int sh(AssetCurrentShRequest req) {
|
|
|
|
public int sh(AssetCurrentShRequest req) {
|
|
|
|
AssetLc assetLc = new AssetLc();
|
|
|
|
AssetLc assetLc = new AssetLc();
|
|
|
|
if (req.getStatus()==3) {
|
|
|
|
int taskStatus = 0;
|
|
|
|
|
|
|
|
if (req.getStatus() == 3) {
|
|
|
|
assetLc.setTaskId(req.getTaskId());
|
|
|
|
assetLc.setTaskId(req.getTaskId());
|
|
|
|
assetLc.setXfTime(LocalDateTime.now());
|
|
|
|
assetLc.setXfTime(LocalDateTime.now());
|
|
|
|
assetLc.setAssetName("管理员审核通过");
|
|
|
|
assetLc.setAssetName("管理员审核通过");
|
|
|
|
assetLcService.insert(assetLc);
|
|
|
|
assetLcService.insert(assetLc);
|
|
|
|
} else if (req.getStatus()==4) {
|
|
|
|
} else if (req.getStatus() == 4) {
|
|
|
|
assetLc.setTaskId(req.getTaskId());
|
|
|
|
assetLc.setTaskId(req.getTaskId());
|
|
|
|
assetLc.setAssetName("管理员审核不通过");
|
|
|
|
assetLc.setAssetName("管理员审核不通过");
|
|
|
|
assetLc.setXfTime(LocalDateTime.now());
|
|
|
|
assetLc.setXfTime(LocalDateTime.now());
|
|
|
|
assetLcService.insert(assetLc);
|
|
|
|
assetLcService.insert(assetLc);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int a = assetTaskDao.sh(req);
|
|
|
|
|
|
|
|
//单位端资产审核,更新任务表状态
|
|
|
|
|
|
|
|
//查询当前任务下的所有资产状态和完成时间
|
|
|
|
|
|
|
|
List<AssetTaskStatusResponse> list = assetTaskDao.findByTaskId(req.getTaskId());
|
|
|
|
|
|
|
|
// 检查状态
|
|
|
|
|
|
|
|
boolean hasPendingApproval = list.stream().anyMatch(item -> item.getStatus() == 0 || item.getStatus() == 1);
|
|
|
|
|
|
|
|
boolean allApproved = list.stream().allMatch(item -> item.getStatus() == 3);
|
|
|
|
|
|
|
|
boolean hasExpired = list.stream().anyMatch(item -> item.getDeadstatus() == 6);
|
|
|
|
|
|
|
|
boolean hasRejected = list.stream().anyMatch(item -> item.getStatus() == 4);
|
|
|
|
|
|
|
|
LocalDateTime finishTime = null;
|
|
|
|
|
|
|
|
if (hasPendingApproval) {
|
|
|
|
|
|
|
|
// 资产状态存在待审批,任务状态为进行中
|
|
|
|
|
|
|
|
taskStatus = 1;
|
|
|
|
|
|
|
|
} else if (allApproved && !hasPendingApproval && !hasRejected && !hasExpired) {
|
|
|
|
|
|
|
|
// 资产状态全部为已通过中并且全部资产完成时间在任务期限之前
|
|
|
|
|
|
|
|
taskStatus = 2;
|
|
|
|
|
|
|
|
finishTime = LocalDateTime.now();
|
|
|
|
|
|
|
|
taskSaveOrDelete(req);
|
|
|
|
|
|
|
|
} else if (allApproved && !hasPendingApproval && !hasRejected && hasExpired) {
|
|
|
|
|
|
|
|
// 资产状态全部为已通过,资产完成时间有超期的为超期完成
|
|
|
|
|
|
|
|
taskStatus = 3;
|
|
|
|
|
|
|
|
finishTime = LocalDateTime.now();
|
|
|
|
|
|
|
|
taskSaveOrDelete(req);
|
|
|
|
|
|
|
|
} else if (hasRejected) {
|
|
|
|
|
|
|
|
// 审核不通过
|
|
|
|
|
|
|
|
taskStatus = 4;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
//修改主表任务状态
|
|
|
|
|
|
|
|
assetTaskDao.updateByTaskId(taskStatus, req.getTaskId(), finishTime);
|
|
|
|
|
|
|
|
return a;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return assetTaskDao.sh(req);
|
|
|
|
private void taskSaveOrDelete(AssetCurrentShRequest req) {
|
|
|
|
|
|
|
|
// 根据taskid查询五张数据
|
|
|
|
|
|
|
|
List<AssetCurrentCpPo> currentList = assetCurrentCpService.findByTaskId(req.getTaskId());
|
|
|
|
|
|
|
|
List<Long> idList = currentList.stream()
|
|
|
|
|
|
|
|
.map(AssetCurrentCpPo::getId)
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
//删除原有数据
|
|
|
|
|
|
|
|
assetCurrentService.removeBatchByIds(idList);
|
|
|
|
|
|
|
|
//将子表数据复制到主表中
|
|
|
|
|
|
|
|
List<AssetCurrent> currentNewList = currentList.stream()
|
|
|
|
|
|
|
|
.map(cpPo -> {
|
|
|
|
|
|
|
|
AssetCurrent current = new AssetCurrent();
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(cpPo, current); // 复制属性
|
|
|
|
|
|
|
|
return current; // 返回新对象
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.collect(Collectors.toList()); // 收集到列表中
|
|
|
|
|
|
|
|
assetCurrentService.saveBatch(currentNewList);
|
|
|
|
|
|
|
|
//AssetBusinessFormCpPo
|
|
|
|
|
|
|
|
List<AssetBusinessFormCpPo> bussinessList = assetBusinessFormCpService.findByTaskId(req.getTaskId());
|
|
|
|
|
|
|
|
List<Long> bussinessidList = bussinessList.stream()
|
|
|
|
|
|
|
|
.map(AssetBusinessFormCpPo::getAssetId)
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
//删除原有数据
|
|
|
|
|
|
|
|
assetBusinessFormService.removeBatchByIds(bussinessidList);
|
|
|
|
|
|
|
|
//将子表数据复制到主表中
|
|
|
|
|
|
|
|
List<AssetBusinessForm> bussinessNewList = bussinessList.stream()
|
|
|
|
|
|
|
|
.map(cpPo -> {
|
|
|
|
|
|
|
|
AssetBusinessForm businessForm = new AssetBusinessForm();
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(cpPo, businessForm); // 复制属性
|
|
|
|
|
|
|
|
return businessForm; // 返回新对象
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.collect(Collectors.toList()); // 收集到列表中
|
|
|
|
|
|
|
|
assetBusinessFormService.saveBatch(bussinessNewList);
|
|
|
|
|
|
|
|
//AssetBasicNetworkCpPo
|
|
|
|
|
|
|
|
List<AssetBasicNetworkCpPo> netWorkList = assetBasicNetworkCpService.findByTaskId(req.getTaskId());
|
|
|
|
|
|
|
|
List<Long> netWorkidList = netWorkList.stream()
|
|
|
|
|
|
|
|
.map(AssetBasicNetworkCpPo::getAssetId)
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
//删除原有数据
|
|
|
|
|
|
|
|
assetBasicNetworkService.removeBatchByIds(netWorkidList);
|
|
|
|
|
|
|
|
//将子表数据复制到主表中
|
|
|
|
|
|
|
|
List<AssetBasicNetwork> netWorkNewList = netWorkList.stream()
|
|
|
|
|
|
|
|
.map(cpPo -> {
|
|
|
|
|
|
|
|
AssetBasicNetwork network = new AssetBasicNetwork();
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(cpPo, network); // 复制属性
|
|
|
|
|
|
|
|
return network; // 返回新对象
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.collect(Collectors.toList()); // 收集到列表中
|
|
|
|
|
|
|
|
assetBasicNetworkService.saveBatch(netWorkNewList);
|
|
|
|
|
|
|
|
//AssetSupplyChainCpPo
|
|
|
|
|
|
|
|
List<AssetSupplyChainCpPo> SupplyChainList = assetSupplyChainCpService.findByTaskId(req.getTaskId());
|
|
|
|
|
|
|
|
List<Long> SupplyChainidList = SupplyChainList.stream()
|
|
|
|
|
|
|
|
.map(AssetSupplyChainCpPo::getAssetId)
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
//删除原有数据
|
|
|
|
|
|
|
|
assetSupplyChainService.removeBatchByIds(SupplyChainidList);
|
|
|
|
|
|
|
|
List<AssetSupplyChain> SupplyChainNewList = SupplyChainList.stream()
|
|
|
|
|
|
|
|
.map(cpPo -> {
|
|
|
|
|
|
|
|
AssetSupplyChain supplyChain = new AssetSupplyChain();
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(cpPo, supplyChain); // 复制属性
|
|
|
|
|
|
|
|
return supplyChain; // 返回新对象
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
assetSupplyChainService.saveBatch(SupplyChainNewList);
|
|
|
|
|
|
|
|
//UnitOtherConcatCpPo
|
|
|
|
|
|
|
|
List<UnitOtherConcatCpPo> UnitOtherConcatList = unitOtherConcatCpService.findByTaskId(req.getTaskId());
|
|
|
|
|
|
|
|
List<Long> UnitOtherConcatidList = UnitOtherConcatList.stream()
|
|
|
|
|
|
|
|
.map(UnitOtherConcatCpPo::getAssetId)
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
//删除原有数据
|
|
|
|
|
|
|
|
unitOtherConcatService.removeBatchByIds(UnitOtherConcatidList);
|
|
|
|
|
|
|
|
List<UnitOtherConcat> UnitOtherConcatNewList = UnitOtherConcatList.stream()
|
|
|
|
|
|
|
|
.map(cpPo -> {
|
|
|
|
|
|
|
|
UnitOtherConcat unitOtherConcat = new UnitOtherConcat();
|
|
|
|
|
|
|
|
BeanUtils.copyProperties(cpPo, unitOtherConcat); // 复制属性
|
|
|
|
|
|
|
|
return unitOtherConcat; // 返回新对象
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
assetSupplyChainService.saveBatch(SupplyChainNewList);
|
|
|
|
|
|
|
|
unitOtherConcatService.saveBatch(UnitOtherConcatNewList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Page<AssetdwHcResponse> dwHc(Page<AssetdwHcResponse> assetdwHcResponsePage,AssetdwHcRequest req) {
|
|
|
|
public Page<AssetdwHcResponse> dwHc(Page<AssetdwHcResponse> assetdwHcResponsePage, AssetdwHcRequest req) {
|
|
|
|
|
|
|
|
|
|
|
|
return assetTaskDao.dwHc(assetdwHcResponsePage,req);
|
|
|
|
return assetTaskDao.dwHc(assetdwHcResponsePage, req);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|