|
|
@ -1,5 +1,6 @@
|
|
|
|
package com.ruoyi.tc.service.impl;
|
|
|
|
package com.ruoyi.tc.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
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.common.utils.bean.BeanUtils;
|
|
|
|
import com.ruoyi.common.utils.bean.BeanUtils;
|
|
|
@ -13,11 +14,13 @@ 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.*;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
|
@ -68,6 +71,7 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
private UnitOtherConcatService unitOtherConcatService;
|
|
|
|
private UnitOtherConcatService unitOtherConcatService;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 通过ID查询单条数据
|
|
|
|
* 通过ID查询单条数据
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -100,7 +104,8 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public void insert(AssetTask assetTask) {
|
|
|
|
public void insert(AssetTask assetTask) {
|
|
|
|
//任务新增
|
|
|
|
//任务新增
|
|
|
|
int id = assetTaskDao.insert(assetTask);
|
|
|
|
assetTaskDao.insert(assetTask);
|
|
|
|
|
|
|
|
int id = assetTask.getId();
|
|
|
|
//新增流程节点
|
|
|
|
//新增流程节点
|
|
|
|
AssetLc assetLc = new AssetLc();
|
|
|
|
AssetLc assetLc = new AssetLc();
|
|
|
|
assetLc.setTaskId(id);
|
|
|
|
assetLc.setTaskId(id);
|
|
|
@ -122,11 +127,12 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
|
|
|
|
List<AssetBusinessFormCpPo> bussList = assetBusinessFormCpService.findByassetId(assetCurrentResponse.getId());
|
|
|
|
List<AssetBusinessFormCpPo> bussList = assetBusinessFormCpService.findByassetId(assetCurrentResponse.getId());
|
|
|
|
if (bussList != null) {
|
|
|
|
if (bussList != null) {
|
|
|
|
for (AssetBusinessFormCpPo assetBusinessFormCpResponse : bussList) {
|
|
|
|
for (AssetBusinessFormCpPo assetBusinessFormCpResponse : bussList) {
|
|
|
|
assetCurrentResponse.getXjgywxt().setBusinessId(assetBusinessFormCpResponse.getBusinessId());
|
|
|
|
if (assetCurrentResponse.getXjgywxt() != null) {
|
|
|
|
assetCurrentResponse.getXjgywxt().setAssetId(assetCurrentResponse.getId());
|
|
|
|
assetCurrentResponse.getXjgywxt().setAssetId(assetBusinessFormCpResponse.getAssetId());
|
|
|
|
assetCurrentResponse.getXjgywxt().setTaskId(id);
|
|
|
|
assetCurrentResponse.getXjgywxt().setTaskId(id);
|
|
|
|
assetBusinessFormCpResponseList.add(assetCurrentResponse.getXjgywxt());
|
|
|
|
assetBusinessFormCpResponseList.add(assetCurrentResponse.getXjgywxt());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
assetBusinessFormCpService.saveBatch(assetBusinessFormCpResponseList);
|
|
|
|
assetBusinessFormCpService.saveBatch(assetBusinessFormCpResponseList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//根据资产id查询供应链主表id-
|
|
|
|
//根据资产id查询供应链主表id-
|
|
|
@ -217,7 +223,12 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public Page<AssestTaskXqresponse> zcHc(Page<AssestTaskXqresponse> assetTask, AssestTaskXqRequest pageRequest) {
|
|
|
|
public Page<AssestTaskXqresponse> zcHc(Page<AssestTaskXqresponse> assetTask, AssestTaskXqRequest pageRequest) {
|
|
|
|
assetTask.setOptimizeCountSql(false);
|
|
|
|
assetTask.setOptimizeCountSql(false);
|
|
|
|
return assetTaskDao.zcHc(assetTask, pageRequest);
|
|
|
|
Page<AssestTaskXqresponse> result = assetTaskDao.zcHc(assetTask, pageRequest);
|
|
|
|
|
|
|
|
// 确保 records 不为 null
|
|
|
|
|
|
|
|
if (result.getRecords() == null) {
|
|
|
|
|
|
|
|
result.setRecords(new ArrayList<>()); // 设置为空数组
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -227,11 +238,11 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
|
|
|
|
if (req.getStatus() == 3) {
|
|
|
|
if (req.getStatus() == 3) {
|
|
|
|
assetLc.setTaskId(req.getTaskId());
|
|
|
|
assetLc.setTaskId(req.getTaskId());
|
|
|
|
assetLc.setXfTime(LocalDateTime.now());
|
|
|
|
assetLc.setXfTime(LocalDateTime.now());
|
|
|
|
assetLc.setAssetName("管理员审核通过");
|
|
|
|
assetLc.setAssetName("管理员审核通过"+req.getXtmc());
|
|
|
|
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("管理员审核不通过"+req.getXtmc());
|
|
|
|
assetLc.setXfTime(LocalDateTime.now());
|
|
|
|
assetLc.setXfTime(LocalDateTime.now());
|
|
|
|
assetLcService.insert(assetLc);
|
|
|
|
assetLcService.insert(assetLc);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -244,6 +255,7 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
|
|
|
|
boolean allApproved = list.stream().allMatch(item -> item.getStatus() == 3);
|
|
|
|
boolean allApproved = list.stream().allMatch(item -> item.getStatus() == 3);
|
|
|
|
boolean hasExpired = list.stream().anyMatch(item -> item.getDeadstatus() == 6);
|
|
|
|
boolean hasExpired = list.stream().anyMatch(item -> item.getDeadstatus() == 6);
|
|
|
|
boolean hasRejected = list.stream().anyMatch(item -> item.getStatus() == 4);
|
|
|
|
boolean hasRejected = list.stream().anyMatch(item -> item.getStatus() == 4);
|
|
|
|
|
|
|
|
boolean hased = list.stream().anyMatch(item -> item.getStatus() == 5);
|
|
|
|
LocalDateTime finishTime = null;
|
|
|
|
LocalDateTime finishTime = null;
|
|
|
|
if (hasPendingApproval) {
|
|
|
|
if (hasPendingApproval) {
|
|
|
|
// 资产状态存在待审批,任务状态为进行中
|
|
|
|
// 资产状态存在待审批,任务状态为进行中
|
|
|
@ -260,7 +272,20 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
|
|
|
|
taskSaveOrDelete(req);
|
|
|
|
taskSaveOrDelete(req);
|
|
|
|
} else if (hasRejected) {
|
|
|
|
} else if (hasRejected) {
|
|
|
|
// 审核不通过
|
|
|
|
// 审核不通过
|
|
|
|
taskStatus = 4;
|
|
|
|
taskStatus = 1;
|
|
|
|
|
|
|
|
} else if (hased && !hasRejected && !hasExpired) {
|
|
|
|
|
|
|
|
//存在已报废并且其他都已完成 且未超期
|
|
|
|
|
|
|
|
taskStatus = 2;
|
|
|
|
|
|
|
|
finishTime = LocalDateTime.now();
|
|
|
|
|
|
|
|
taskSaveOrDelete(req);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else if(hased && !hasRejected && hasExpired){
|
|
|
|
|
|
|
|
//存在已报废并且其他都已完成 且未超期
|
|
|
|
|
|
|
|
taskStatus = 3;
|
|
|
|
|
|
|
|
finishTime = LocalDateTime.now();
|
|
|
|
|
|
|
|
taskSaveOrDelete(req);
|
|
|
|
|
|
|
|
} else if (hased && !hasPendingApproval && !allApproved && ! hasExpired && !hasRejected) {
|
|
|
|
|
|
|
|
taskStatus = 3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//修改主表任务状态
|
|
|
|
//修改主表任务状态
|
|
|
|
assetTaskDao.updateByTaskId(taskStatus, req.getTaskId(), finishTime);
|
|
|
|
assetTaskDao.updateByTaskId(taskStatus, req.getTaskId(), finishTime);
|
|
|
@ -274,7 +299,10 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
|
|
|
|
.map(AssetCurrentCpPo::getId)
|
|
|
|
.map(AssetCurrentCpPo::getId)
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
//删除原有数据
|
|
|
|
//删除原有数据
|
|
|
|
assetCurrentService.removeBatchByIds(idList);
|
|
|
|
if (CollectionUtil.isNotEmpty(idList)) {
|
|
|
|
|
|
|
|
assetCurrentService.deleteIdList(idList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//将子表数据复制到主表中
|
|
|
|
//将子表数据复制到主表中
|
|
|
|
List<AssetCurrent> currentNewList = currentList.stream()
|
|
|
|
List<AssetCurrent> currentNewList = currentList.stream()
|
|
|
|
.map(cpPo -> {
|
|
|
|
.map(cpPo -> {
|
|
|
@ -290,7 +318,10 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
|
|
|
|
.map(AssetBusinessFormCpPo::getAssetId)
|
|
|
|
.map(AssetBusinessFormCpPo::getAssetId)
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
//删除原有数据
|
|
|
|
//删除原有数据
|
|
|
|
assetBusinessFormService.removeBatchByIds(bussinessidList);
|
|
|
|
if (CollectionUtil.isNotEmpty(bussinessidList)) {
|
|
|
|
|
|
|
|
assetBusinessFormService.deleteIdList(bussinessidList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//将子表数据复制到主表中
|
|
|
|
//将子表数据复制到主表中
|
|
|
|
List<AssetBusinessForm> bussinessNewList = bussinessList.stream()
|
|
|
|
List<AssetBusinessForm> bussinessNewList = bussinessList.stream()
|
|
|
|
.map(cpPo -> {
|
|
|
|
.map(cpPo -> {
|
|
|
@ -306,7 +337,10 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
|
|
|
|
.map(AssetBasicNetworkCpPo::getAssetId)
|
|
|
|
.map(AssetBasicNetworkCpPo::getAssetId)
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
//删除原有数据
|
|
|
|
//删除原有数据
|
|
|
|
assetBasicNetworkService.removeBatchByIds(netWorkidList);
|
|
|
|
if (CollectionUtil.isNotEmpty(netWorkidList)) {
|
|
|
|
|
|
|
|
assetBasicNetworkService.deleteIdList(netWorkidList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//将子表数据复制到主表中
|
|
|
|
//将子表数据复制到主表中
|
|
|
|
List<AssetBasicNetwork> netWorkNewList = netWorkList.stream()
|
|
|
|
List<AssetBasicNetwork> netWorkNewList = netWorkList.stream()
|
|
|
|
.map(cpPo -> {
|
|
|
|
.map(cpPo -> {
|
|
|
@ -322,10 +356,14 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
|
|
|
|
.map(AssetSupplyChainCpPo::getAssetId)
|
|
|
|
.map(AssetSupplyChainCpPo::getAssetId)
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
//删除原有数据
|
|
|
|
//删除原有数据
|
|
|
|
assetSupplyChainService.removeBatchByIds(SupplyChainidList);
|
|
|
|
if (CollectionUtil.isNotEmpty(SupplyChainidList)) {
|
|
|
|
|
|
|
|
assetSupplyChainService.deleteIdList(SupplyChainidList);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
List<AssetSupplyChain> SupplyChainNewList = SupplyChainList.stream()
|
|
|
|
List<AssetSupplyChain> SupplyChainNewList = SupplyChainList.stream()
|
|
|
|
.map(cpPo -> {
|
|
|
|
.map(cpPo -> {
|
|
|
|
AssetSupplyChain supplyChain = new AssetSupplyChain();
|
|
|
|
AssetSupplyChain supplyChain = new AssetSupplyChain();
|
|
|
|
|
|
|
|
supplyChain.setId(null);
|
|
|
|
BeanUtils.copyProperties(cpPo, supplyChain); // 复制属性
|
|
|
|
BeanUtils.copyProperties(cpPo, supplyChain); // 复制属性
|
|
|
|
return supplyChain; // 返回新对象
|
|
|
|
return supplyChain; // 返回新对象
|
|
|
|
})
|
|
|
|
})
|
|
|
@ -337,7 +375,9 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
|
|
|
|
.map(UnitOtherConcatCpPo::getAssetId)
|
|
|
|
.map(UnitOtherConcatCpPo::getAssetId)
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
//删除原有数据
|
|
|
|
//删除原有数据
|
|
|
|
unitOtherConcatService.removeBatchByIds(UnitOtherConcatidList);
|
|
|
|
if (CollectionUtil.isNotEmpty(UnitOtherConcatidList)) {
|
|
|
|
|
|
|
|
unitOtherConcatService.deleteIdList(UnitOtherConcatidList);
|
|
|
|
|
|
|
|
}
|
|
|
|
List<UnitOtherConcat> UnitOtherConcatNewList = UnitOtherConcatList.stream()
|
|
|
|
List<UnitOtherConcat> UnitOtherConcatNewList = UnitOtherConcatList.stream()
|
|
|
|
.map(cpPo -> {
|
|
|
|
.map(cpPo -> {
|
|
|
|
UnitOtherConcat unitOtherConcat = new UnitOtherConcat();
|
|
|
|
UnitOtherConcat unitOtherConcat = new UnitOtherConcat();
|
|
|
@ -345,7 +385,6 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
|
|
|
|
return unitOtherConcat; // 返回新对象
|
|
|
|
return unitOtherConcat; // 返回新对象
|
|
|
|
})
|
|
|
|
})
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
assetSupplyChainService.saveBatch(SupplyChainNewList);
|
|
|
|
|
|
|
|
unitOtherConcatService.saveBatch(UnitOtherConcatNewList);
|
|
|
|
unitOtherConcatService.saveBatch(UnitOtherConcatNewList);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|