|
|
|
@ -1,50 +1,28 @@
|
|
|
|
|
package com.ruoyi.tc.service.impl;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollectionUtil;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
import com.ruoyi.common.utils.bean.BeanUtils;
|
|
|
|
|
import com.ruoyi.tc.entity.AssetBasicNetwork;
|
|
|
|
|
import com.ruoyi.tc.entity.AssetBusinessForm;
|
|
|
|
|
import com.ruoyi.tc.entity.AssetCurrent;
|
|
|
|
|
import com.ruoyi.tc.entity.AssetLc;
|
|
|
|
|
import com.ruoyi.tc.entity.AssetSupplyChain;
|
|
|
|
|
import com.ruoyi.tc.entity.AssetTask;
|
|
|
|
|
import com.ruoyi.tc.entity.UnitOtherConcat;
|
|
|
|
|
import com.ruoyi.tc.entity.po.AssetBasicNetworkCpPo;
|
|
|
|
|
import com.ruoyi.tc.entity.po.AssetBusinessFormCpPo;
|
|
|
|
|
import com.ruoyi.tc.entity.po.AssetCurrentCpPo;
|
|
|
|
|
import com.ruoyi.tc.entity.po.AssetSupplyChainCpPo;
|
|
|
|
|
import com.ruoyi.tc.entity.po.UnitOtherConcatCpPo;
|
|
|
|
|
import com.ruoyi.tc.entity.request.Acomma;
|
|
|
|
|
import com.ruoyi.tc.entity.request.AssestTaskXqRequest;
|
|
|
|
|
import com.ruoyi.tc.entity.request.AssetCurrentShRequest;
|
|
|
|
|
import com.ruoyi.tc.entity.request.AssetTaskPageRequest;
|
|
|
|
|
import com.ruoyi.tc.entity.request.AssetdwHcRequest;
|
|
|
|
|
import com.ruoyi.tc.entity.*;
|
|
|
|
|
import com.ruoyi.tc.entity.po.*;
|
|
|
|
|
import com.ruoyi.tc.entity.request.*;
|
|
|
|
|
import com.ruoyi.tc.entity.response.AssestTaskXqresponse;
|
|
|
|
|
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.mapper.AssetTaskMapper;
|
|
|
|
|
import com.ruoyi.tc.service.AssetBasicNetworkCpService;
|
|
|
|
|
import com.ruoyi.tc.service.AssetBasicNetworkService;
|
|
|
|
|
import com.ruoyi.tc.service.AssetBusinessFormCpService;
|
|
|
|
|
import com.ruoyi.tc.service.AssetBusinessFormService;
|
|
|
|
|
import com.ruoyi.tc.service.AssetCurrentCpService;
|
|
|
|
|
import com.ruoyi.tc.service.AssetCurrentService;
|
|
|
|
|
import com.ruoyi.tc.service.AssetLcService;
|
|
|
|
|
import com.ruoyi.tc.service.AssetSupplyChainCpService;
|
|
|
|
|
import com.ruoyi.tc.service.AssetSupplyChainService;
|
|
|
|
|
import com.ruoyi.tc.service.AssetTaskService;
|
|
|
|
|
import com.ruoyi.tc.service.UnitOtherConcatCpService;
|
|
|
|
|
import com.ruoyi.tc.service.UnitOtherConcatService;
|
|
|
|
|
import com.ruoyi.tc.service.*;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import java.time.LocalDate;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Optional;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -81,7 +59,8 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
|
|
|
|
|
@Resource
|
|
|
|
|
private AssetCurrentService assetCurrentService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private AssetOfficialAccountService assetOfficialAccountService;
|
|
|
|
|
@Resource
|
|
|
|
|
private AssetBusinessFormService assetBusinessFormService;
|
|
|
|
|
|
|
|
|
@ -95,6 +74,35 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
|
|
|
|
|
@Resource
|
|
|
|
|
private UnitOtherConcatService unitOtherConcatService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private AssetMiniProgramsService assetMiniProgramsService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private AssetMiniProgramsCpService assetMiniProgramsCpService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private AssetOfficialAccountCpService assetOfficialAccountCpService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private AssetEmailCpService assetEmailCpService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private AssetEmailService assetEmailService;
|
|
|
|
|
@Resource
|
|
|
|
|
private AssetAppService assetAppService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private AssetAppCpService assetAppCpService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private UnitService unitService;
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private AssetTaskService assetTaskService;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 通过ID查询单条数据
|
|
|
|
|
*
|
|
|
|
@ -106,6 +114,7 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
|
|
|
|
|
return assetTaskDao.queryById(id);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 分页查询
|
|
|
|
|
*
|
|
|
|
@ -125,6 +134,42 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public void insert(AssetTask assetTask) {
|
|
|
|
|
int a = 0;
|
|
|
|
|
//遍历单位
|
|
|
|
|
String[] taskParts = assetTask.getDwmc().split(",");
|
|
|
|
|
for (String part : taskParts) {
|
|
|
|
|
//根据单位查询所有资产
|
|
|
|
|
//web
|
|
|
|
|
// 遍历资产类型字段
|
|
|
|
|
String[] uParts = assetTask.getType().split(",");
|
|
|
|
|
int current = 0;
|
|
|
|
|
int xcx = 0;
|
|
|
|
|
int gzh = 0;
|
|
|
|
|
int email = 0;
|
|
|
|
|
int app = 0;
|
|
|
|
|
int totalCount = 0;
|
|
|
|
|
for (String qq : uParts) {
|
|
|
|
|
|
|
|
|
|
if (qq.equals("0")) {
|
|
|
|
|
current = assetCurrentService.findBydwmc(part);
|
|
|
|
|
totalCount += current;
|
|
|
|
|
} else if (qq.equals("1")) {
|
|
|
|
|
xcx = assetMiniProgramsService.findBydwmc(part);
|
|
|
|
|
totalCount += xcx;
|
|
|
|
|
} else if (qq.equals("2")) {
|
|
|
|
|
gzh = assetOfficialAccountService.findBydwmc(part);
|
|
|
|
|
totalCount += gzh;
|
|
|
|
|
} else if (qq.equals("3")) {
|
|
|
|
|
email = assetEmailService.findBydwmc(part);
|
|
|
|
|
totalCount += email;
|
|
|
|
|
} else if (qq.equals("4")) {
|
|
|
|
|
app = assetAppService.findBydwmc(part);
|
|
|
|
|
totalCount += app;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
assetTask.setTotalCount(totalCount);
|
|
|
|
|
}
|
|
|
|
|
//任务新增
|
|
|
|
|
assetTaskDao.insert(assetTask);
|
|
|
|
|
int id = assetTask.getId();
|
|
|
|
@ -134,6 +179,11 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
|
|
|
|
|
assetLc.setXfTime(LocalDateTime.now());
|
|
|
|
|
assetLc.setAssetName("管理员任务下发");
|
|
|
|
|
assetLcService.insert(assetLc);
|
|
|
|
|
// 遍历资产类型字段
|
|
|
|
|
String[] assetParts = assetTask.getType().split(",");
|
|
|
|
|
for (String assetPart : assetParts) {
|
|
|
|
|
if (assetPart.equals("0")) {
|
|
|
|
|
//遍历单位
|
|
|
|
|
String[] parts = assetTask.getDwmc().split(",");
|
|
|
|
|
for (String part : parts) {
|
|
|
|
|
//根据单位名称查询资产
|
|
|
|
@ -192,8 +242,94 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else if (assetPart.equals("1")) {
|
|
|
|
|
//遍历小程序资产单位
|
|
|
|
|
String[] parts = assetTask.getDwmc().split(",");
|
|
|
|
|
for (String part : parts) {
|
|
|
|
|
//根据单位名称查询资产
|
|
|
|
|
QueryWrapper<AssetMiniPrograms> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
queryWrapper.eq("ssdw", part);
|
|
|
|
|
queryWrapper.eq("isbf", 0);
|
|
|
|
|
List<AssetMiniPrograms> list = assetMiniProgramsService.list(queryWrapper);
|
|
|
|
|
List<AssetMiniProgramsCpPo> miniProgramsNewList = list.stream()
|
|
|
|
|
.map(cpPo -> {
|
|
|
|
|
AssetMiniProgramsCpPo assetMiniProgramsCpPo = new AssetMiniProgramsCpPo();
|
|
|
|
|
assetMiniProgramsCpPo.setTaskId(id);
|
|
|
|
|
assetMiniProgramsCpPo.setStatus(0);
|
|
|
|
|
assetMiniProgramsCpPo.setAssetId(cpPo.getId());
|
|
|
|
|
BeanUtils.copyProperties(cpPo, assetMiniProgramsCpPo); // 复制属性
|
|
|
|
|
return assetMiniProgramsCpPo; // 返回新对象
|
|
|
|
|
})
|
|
|
|
|
.collect(Collectors.toList()); // 收集到列表中
|
|
|
|
|
assetMiniProgramsCpService.saveBatch(miniProgramsNewList);
|
|
|
|
|
}
|
|
|
|
|
} else if (assetPart.equals("2")) {
|
|
|
|
|
//遍历公众号资产单位
|
|
|
|
|
String[] parts = assetTask.getDwmc().split(",");
|
|
|
|
|
for (String part : parts) {
|
|
|
|
|
//根据单位名称查询资产
|
|
|
|
|
QueryWrapper<AssetOfficialAccount> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
queryWrapper.eq("ssdw", part);
|
|
|
|
|
queryWrapper.eq("isbf", 0);
|
|
|
|
|
List<AssetOfficialAccount> list = assetOfficialAccountService.list(queryWrapper);
|
|
|
|
|
List<AssetOfficialAccountCpPo> officialAccountProgramsNewList = list.stream()
|
|
|
|
|
.map(cpPo -> {
|
|
|
|
|
AssetOfficialAccountCpPo assetOfficialAccountCpPo = new AssetOfficialAccountCpPo();
|
|
|
|
|
assetOfficialAccountCpPo.setTaskId(id);
|
|
|
|
|
assetOfficialAccountCpPo.setStatus(0);
|
|
|
|
|
assetOfficialAccountCpPo.setAssetId(cpPo.getId());
|
|
|
|
|
BeanUtils.copyProperties(cpPo, assetOfficialAccountCpPo); // 复制属性
|
|
|
|
|
return assetOfficialAccountCpPo; // 返回新对象
|
|
|
|
|
})
|
|
|
|
|
.collect(Collectors.toList()); // 收集到列表中
|
|
|
|
|
assetOfficialAccountCpService.saveBatch(officialAccountProgramsNewList);
|
|
|
|
|
}
|
|
|
|
|
} else if (assetPart.equals("3")) {
|
|
|
|
|
//遍历电子邮件资产单位
|
|
|
|
|
String[] parts = assetTask.getDwmc().split(",");
|
|
|
|
|
for (String part : parts) {
|
|
|
|
|
//根据单位名称查询资产
|
|
|
|
|
QueryWrapper<AssetEmail> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
queryWrapper.eq("ssdw", part);
|
|
|
|
|
queryWrapper.eq("isbf", 0);
|
|
|
|
|
List<AssetEmail> list = assetEmailService.list(queryWrapper);
|
|
|
|
|
List<AssetEmailCpPo> emailCpNewList = list.stream()
|
|
|
|
|
.map(cpPo -> {
|
|
|
|
|
AssetEmailCpPo emailCpPo = new AssetEmailCpPo();
|
|
|
|
|
emailCpPo.setTaskId(id);
|
|
|
|
|
emailCpPo.setAssetId(cpPo.getId());
|
|
|
|
|
emailCpPo.setStatus(0);
|
|
|
|
|
BeanUtils.copyProperties(cpPo, emailCpPo); // 复制属性
|
|
|
|
|
return emailCpPo; // 返回新对象
|
|
|
|
|
})
|
|
|
|
|
.collect(Collectors.toList()); // 收集到列表中
|
|
|
|
|
assetEmailCpService.saveBatch(emailCpNewList);
|
|
|
|
|
}
|
|
|
|
|
} else if (assetPart.equals("4")) {
|
|
|
|
|
//遍历资产移动应用程序资产单位
|
|
|
|
|
String[] parts = assetTask.getDwmc().split(",");
|
|
|
|
|
for (String part : parts) {
|
|
|
|
|
//根据单位名称查询资产
|
|
|
|
|
QueryWrapper<AssetApp> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
queryWrapper.eq("ssdw", part);
|
|
|
|
|
queryWrapper.eq("isbf", 0);
|
|
|
|
|
List<AssetApp> list = assetAppService.list(queryWrapper);
|
|
|
|
|
List<AssetAppCpPo> appCpNewList = list.stream()
|
|
|
|
|
.map(cpPo -> {
|
|
|
|
|
AssetAppCpPo appCpPo = new AssetAppCpPo();
|
|
|
|
|
appCpPo.setTaskId(id);
|
|
|
|
|
appCpPo.setAssetId(cpPo.getId());
|
|
|
|
|
appCpPo.setStatus(0);
|
|
|
|
|
BeanUtils.copyProperties(cpPo, appCpPo); // 复制属性
|
|
|
|
|
return appCpPo; // 返回新对象
|
|
|
|
|
})
|
|
|
|
|
.collect(Collectors.toList()); // 收集到列表中
|
|
|
|
|
assetAppCpService.saveBatch(appCpNewList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 修改数据
|
|
|
|
@ -220,6 +356,7 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public AssetCurrentCpPo taskSh(int taskId, int assetId) {
|
|
|
|
|
|
|
|
|
|
AssetCurrentCpPo byId = assetTaskDao.findBytaskIdandAssestId(taskId, assetId);
|
|
|
|
|
byId.setGylxxList(assetSupplyChainCpService.lambdaQuery().eq(AssetSupplyChainCpPo::getAssetId, assetId).eq(AssetSupplyChainCpPo::getDelFlag, "0").eq(AssetSupplyChainCpPo::getTaskId, taskId).list());
|
|
|
|
|
byId.setJcwlList(assetBasicNetworkCpService.lambdaQuery().eq(AssetBasicNetworkCpPo::getAssetId, assetId).eq(AssetBasicNetworkCpPo::getDelFlag, "0").eq(AssetBasicNetworkCpPo::getTaskId, taskId).list());
|
|
|
|
@ -240,12 +377,57 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
|
|
|
|
|
});
|
|
|
|
|
byId.setGlIpList(a2);
|
|
|
|
|
return byId;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public AssetMiniProgramsCpPo minitaskSh(int taskId, int assetId) {
|
|
|
|
|
QueryWrapper<AssetMiniProgramsCpPo> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
queryWrapper.eq("asset_id", assetId);
|
|
|
|
|
queryWrapper.eq("task_id", taskId);
|
|
|
|
|
return assetMiniProgramsCpService.getOne(queryWrapper);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public AssetOfficialAccountCpPo officetaskSh(int taskId, int assetId) {
|
|
|
|
|
QueryWrapper<AssetOfficialAccountCpPo> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
queryWrapper.eq("asset_id", assetId);
|
|
|
|
|
queryWrapper.eq("task_id", taskId);
|
|
|
|
|
return assetOfficialAccountCpService.getOne(queryWrapper);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public AssetEmailCpPo emailtaskSh(int taskId, int assetId) {
|
|
|
|
|
QueryWrapper<AssetEmailCpPo> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
queryWrapper.eq("asset_id", assetId);
|
|
|
|
|
queryWrapper.eq("task_id", taskId);
|
|
|
|
|
return assetEmailCpService.getOne(queryWrapper);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public AssetAppCpPo apptaskSh(int taskId, int assetId) {
|
|
|
|
|
QueryWrapper<AssetAppCpPo> queryWrapper = new QueryWrapper<>();
|
|
|
|
|
queryWrapper.eq("asset_id", assetId);
|
|
|
|
|
queryWrapper.eq("task_id", taskId);
|
|
|
|
|
return assetAppCpService.getOne(queryWrapper);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Page<AssestTaskXqresponse> zcHc(Page<AssestTaskXqresponse> assetTask, AssestTaskXqRequest pageRequest) {
|
|
|
|
|
assetTask.setOptimizeCountSql(false);
|
|
|
|
|
Page<AssestTaskXqresponse> result = assetTaskDao.zcHc(assetTask, pageRequest);
|
|
|
|
|
Page<AssestTaskXqresponse> result = null;
|
|
|
|
|
if (pageRequest.getType().equals("0")) {
|
|
|
|
|
result = assetTaskDao.zcHc(assetTask, pageRequest);
|
|
|
|
|
} else if (pageRequest.getType().equals("1")) {
|
|
|
|
|
result = assetTaskDao.xcxZcHc(assetTask, pageRequest);
|
|
|
|
|
} else if (pageRequest.getType().equals("2")) {
|
|
|
|
|
result = assetTaskDao.gzhZcHc(assetTask, pageRequest);
|
|
|
|
|
} else if (pageRequest.getType().equals("3")) {
|
|
|
|
|
result = assetTaskDao.emailZcHc(assetTask, pageRequest);
|
|
|
|
|
} else if (pageRequest.getType().equals("4")) {
|
|
|
|
|
result = assetTaskDao.appZcHc(assetTask, pageRequest);
|
|
|
|
|
}
|
|
|
|
|
// 确保 records 不为 null
|
|
|
|
|
if (result.getRecords() == null) {
|
|
|
|
|
result.setRecords(new ArrayList<>()); // 设置为空数组
|
|
|
|
@ -255,69 +437,214 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public int sh(AssetCurrentShRequest req) {
|
|
|
|
|
AssetLc assetLc = new AssetLc();
|
|
|
|
|
int taskStatus = 0;
|
|
|
|
|
if (req.getStatus() == 3) {
|
|
|
|
|
assetLc.setTaskId(req.getTaskId());
|
|
|
|
|
assetLc.setXfTime(LocalDateTime.now());
|
|
|
|
|
assetLc.setAssetName("管理员审核通过"+req.getXtmc());
|
|
|
|
|
assetLcService.insert(assetLc);
|
|
|
|
|
} else if (req.getStatus() == 4) {
|
|
|
|
|
assetLc.setTaskId(req.getTaskId());
|
|
|
|
|
assetLc.setAssetName("管理员审核不通过"+req.getXtmc());
|
|
|
|
|
assetLc.setXfTime(LocalDateTime.now());
|
|
|
|
|
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);
|
|
|
|
|
boolean hased = list.stream().anyMatch(item -> item.getStatus() == 5);
|
|
|
|
|
//根据taskid获取当前任务的count数量
|
|
|
|
|
AssetTask assetTask = assetTaskDao.getByTaskId(req.getTaskId());
|
|
|
|
|
if (req.getType() == 0) {
|
|
|
|
|
//web资产
|
|
|
|
|
//是否超期
|
|
|
|
|
ifCq(req, assetTask);
|
|
|
|
|
//创建任务流程
|
|
|
|
|
getTaskStatus(req);
|
|
|
|
|
assetTaskDao.sh(req);
|
|
|
|
|
} else if (req.getType() == 1) {
|
|
|
|
|
//小程序资产
|
|
|
|
|
//创建任务流程
|
|
|
|
|
ifCq(req, assetTask);
|
|
|
|
|
getTaskStatus(req);
|
|
|
|
|
assetTaskDao.xcxsh(req);
|
|
|
|
|
} else if (req.getType() == 2) {
|
|
|
|
|
//公众号资产
|
|
|
|
|
//创建任务流程
|
|
|
|
|
ifCq(req, assetTask);
|
|
|
|
|
getTaskStatus(req);
|
|
|
|
|
assetTaskDao.gzhsh(req);
|
|
|
|
|
} else if (req.getType() == 3) {
|
|
|
|
|
//电子邮件
|
|
|
|
|
//创建任务流程
|
|
|
|
|
ifCq(req, assetTask);
|
|
|
|
|
getTaskStatus(req);
|
|
|
|
|
assetTaskDao.emailsh(req);
|
|
|
|
|
} else if (req.getType() == 4) {
|
|
|
|
|
//app
|
|
|
|
|
//创建任务流程
|
|
|
|
|
ifCq(req, assetTask);
|
|
|
|
|
getTaskStatus(req);
|
|
|
|
|
assetTaskDao.appsh(req);
|
|
|
|
|
}
|
|
|
|
|
AssetTask finalTask = assetTaskDao.getByTaskId(req.getTaskId());
|
|
|
|
|
//判断当前任务资产是否全部审核完成
|
|
|
|
|
int deadlineCount = Optional.ofNullable(finalTask.getDeadlineCount()).orElse(0);
|
|
|
|
|
int count = Optional.ofNullable(finalTask.getCount()).orElse(0);
|
|
|
|
|
int totalCount = Optional.ofNullable(finalTask.getTotalCount()).orElse(0);
|
|
|
|
|
int ygt = Optional.ofNullable(finalTask.getYgt()).orElse(0);
|
|
|
|
|
LocalDateTime finishTime = null;
|
|
|
|
|
String btgyy=null;
|
|
|
|
|
if (hasPendingApproval) {
|
|
|
|
|
// 资产状态存在待审批,任务状态为进行中
|
|
|
|
|
taskStatus = 1;
|
|
|
|
|
} else if (allApproved && !hasPendingApproval && !hasRejected && !hasExpired) {
|
|
|
|
|
// 资产状态全部为已通过中并且全部资产完成时间在任务期限之前
|
|
|
|
|
taskStatus = 2;
|
|
|
|
|
if (ygt + count >= totalCount && deadlineCount == 0) {
|
|
|
|
|
//关停和通过数量=全部数量并且超期完成数量为0 状态是正常完成 status=2
|
|
|
|
|
finalTask.setTaskStatus(2);
|
|
|
|
|
finishTime = LocalDateTime.now();
|
|
|
|
|
finalTask.setTaskFinishTime(finishTime);
|
|
|
|
|
assetTaskService.update(finalTask);
|
|
|
|
|
//同步主表数据 web
|
|
|
|
|
taskSaveOrDelete(req);
|
|
|
|
|
} else if (allApproved && !hasPendingApproval && !hasRejected && hasExpired) {
|
|
|
|
|
// 资产状态全部为已通过,资产完成时间有超期的为超期完成
|
|
|
|
|
taskStatus = 3;
|
|
|
|
|
syb(req);
|
|
|
|
|
|
|
|
|
|
} else if (deadlineCount + count + ygt >= totalCount && deadlineCount != 0) {
|
|
|
|
|
//超期完成和通过数量=全部数量并且超期完成数量不为0 状态是超期完成 status=3
|
|
|
|
|
finalTask.setTaskStatus(3);
|
|
|
|
|
finishTime = LocalDateTime.now();
|
|
|
|
|
finalTask.setTaskFinishTime(finishTime);
|
|
|
|
|
assetTaskService.update(finalTask);
|
|
|
|
|
|
|
|
|
|
//同步主表数据 web
|
|
|
|
|
taskSaveOrDelete(req);
|
|
|
|
|
} else if (hasRejected) {
|
|
|
|
|
// 审核不通过
|
|
|
|
|
taskStatus = 1;
|
|
|
|
|
btgyy=req.getBtgyy();
|
|
|
|
|
syb(req);
|
|
|
|
|
} else {
|
|
|
|
|
// 状态是进行中 status=1
|
|
|
|
|
finalTask.setTaskStatus(1);
|
|
|
|
|
String btgyy = req.getBtgyy();
|
|
|
|
|
assetTaskService.update(finalTask);
|
|
|
|
|
//修改不通过原因
|
|
|
|
|
if (req.getType()==0){
|
|
|
|
|
assetCurrentCpService.updateByAssetId(req.getAssetId(), req.getTaskId(), btgyy);
|
|
|
|
|
} else if (hased && !hasRejected && !hasExpired) {
|
|
|
|
|
//存在已报废并且其他都已完成 且未超期
|
|
|
|
|
taskStatus = 2;
|
|
|
|
|
finishTime = LocalDateTime.now();
|
|
|
|
|
taskSaveOrDelete(req);
|
|
|
|
|
}else if(req.getType()==1){
|
|
|
|
|
assetMiniProgramsCpService.updateByAssetId(req.getAssetId(), req.getTaskId(), btgyy);
|
|
|
|
|
}else if(req.getType()==2){
|
|
|
|
|
assetOfficialAccountCpService.updateByAssetId(req.getAssetId(), req.getTaskId(), btgyy);
|
|
|
|
|
}else if(req.getType()==3){
|
|
|
|
|
assetEmailCpService.updateByAssetId(req.getAssetId(), req.getTaskId(), btgyy);
|
|
|
|
|
}else if(req.getType()==4){
|
|
|
|
|
assetAppCpService.updateByAssetId(req.getAssetId(), req.getTaskId(), btgyy);
|
|
|
|
|
}
|
|
|
|
|
else if(hased && !hasRejected && hasExpired){
|
|
|
|
|
//存在已报废并且其他都已完成 且未超期
|
|
|
|
|
taskStatus = 3;
|
|
|
|
|
finishTime = LocalDateTime.now();
|
|
|
|
|
taskSaveOrDelete(req);
|
|
|
|
|
} else if (hased && !hasPendingApproval && !allApproved && ! hasExpired && !hasRejected) {
|
|
|
|
|
taskStatus = 3;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void syb(AssetCurrentShRequest req) {
|
|
|
|
|
//app 小程序 邮件 公众号
|
|
|
|
|
List<AssetAppCpPo> appList = assetAppCpService.findByTaskId(req.getTaskId());
|
|
|
|
|
List<AssetEmailCpPo> emailCpPoListList = assetEmailCpService.findByTaskId(req.getTaskId());
|
|
|
|
|
List<AssetMiniProgramsCpPo> miniProgramsCpPoListList = assetMiniProgramsCpService.findByTaskId(req.getTaskId());
|
|
|
|
|
List<AssetOfficialAccountCpPo> officialAccountCpPoListList = assetOfficialAccountCpService.findByTaskId(req.getTaskId());
|
|
|
|
|
//app
|
|
|
|
|
List<Long> appidList = appList.stream()
|
|
|
|
|
.map(AssetAppCpPo::getAssetId)
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
//删除原有数据
|
|
|
|
|
if (CollectionUtil.isNotEmpty(appidList)) {
|
|
|
|
|
assetAppService.deleteIdList(appidList);
|
|
|
|
|
}
|
|
|
|
|
//将子表数据复制到主表中
|
|
|
|
|
List<AssetApp> appNewList = appList.stream()
|
|
|
|
|
.map(cpPo -> {
|
|
|
|
|
AssetApp current = new AssetApp();
|
|
|
|
|
BeanUtils.copyProperties(cpPo, current); // 复制属性
|
|
|
|
|
return current; // 返回新对象
|
|
|
|
|
})
|
|
|
|
|
.collect(Collectors.toList()); // 收集到列表中
|
|
|
|
|
assetAppService.saveBatch(appNewList);
|
|
|
|
|
|
|
|
|
|
//邮件
|
|
|
|
|
List<Long> emailidList = emailCpPoListList.stream()
|
|
|
|
|
.map(AssetEmailCpPo::getAssetId)
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
//删除原有数据
|
|
|
|
|
if (CollectionUtil.isNotEmpty(emailidList)) {
|
|
|
|
|
assetEmailService.deleteIdList(emailidList);
|
|
|
|
|
}
|
|
|
|
|
//修改主表任务状态
|
|
|
|
|
assetTaskDao.updateByTaskId(taskStatus, req.getTaskId(), finishTime);
|
|
|
|
|
return a;
|
|
|
|
|
//将子表数据复制到主表中
|
|
|
|
|
List<AssetEmail> emailNewList = appList.stream()
|
|
|
|
|
.map(cpPo -> {
|
|
|
|
|
AssetEmail current = new AssetEmail();
|
|
|
|
|
BeanUtils.copyProperties(cpPo, current); // 复制属性
|
|
|
|
|
return current; // 返回新对象
|
|
|
|
|
})
|
|
|
|
|
.collect(Collectors.toList()); // 收集到列表中
|
|
|
|
|
assetEmailService.saveBatch(emailNewList);
|
|
|
|
|
|
|
|
|
|
//小程序
|
|
|
|
|
List<Long> miniidList = miniProgramsCpPoListList.stream()
|
|
|
|
|
.map(AssetMiniProgramsCpPo::getAssetId)
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
//删除原有数据
|
|
|
|
|
if (CollectionUtil.isNotEmpty(miniidList)) {
|
|
|
|
|
assetMiniProgramsService.deleteIdList(miniidList);
|
|
|
|
|
}
|
|
|
|
|
//将子表数据复制到主表中
|
|
|
|
|
List<AssetMiniPrograms> miniNewList = appList.stream()
|
|
|
|
|
.map(cpPo -> {
|
|
|
|
|
AssetMiniPrograms current = new AssetMiniPrograms();
|
|
|
|
|
BeanUtils.copyProperties(cpPo, current); // 复制属性
|
|
|
|
|
return current; // 返回新对象
|
|
|
|
|
})
|
|
|
|
|
.collect(Collectors.toList()); // 收集到列表中
|
|
|
|
|
assetMiniProgramsService.saveBatch(miniNewList);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//公众号
|
|
|
|
|
List<Long> officialidList = officialAccountCpPoListList.stream()
|
|
|
|
|
.map(AssetOfficialAccountCpPo::getAssetId)
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
//删除原有数据
|
|
|
|
|
if (CollectionUtil.isNotEmpty(officialidList)) {
|
|
|
|
|
assetOfficialAccountService.deleteIdList(officialidList);
|
|
|
|
|
}
|
|
|
|
|
//将子表数据复制到主表中
|
|
|
|
|
List<AssetOfficialAccount> officialNewList = appList.stream()
|
|
|
|
|
.map(cpPo -> {
|
|
|
|
|
AssetOfficialAccount current = new AssetOfficialAccount();
|
|
|
|
|
BeanUtils.copyProperties(cpPo, current); // 复制属性
|
|
|
|
|
return current; // 返回新对象
|
|
|
|
|
})
|
|
|
|
|
.collect(Collectors.toList()); // 收集到列表中
|
|
|
|
|
assetOfficialAccountService.saveBatch(officialNewList);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ifCq(AssetCurrentShRequest req, AssetTask assetTask) {
|
|
|
|
|
|
|
|
|
|
if (req.getStatus().equals(3)) {
|
|
|
|
|
AssetTask newAssetTask = new AssetTask();
|
|
|
|
|
//比较是否超期
|
|
|
|
|
int deadlineStatus = extracted(assetTask);
|
|
|
|
|
int deadlineCount = Optional.ofNullable(assetTask.getDeadlineCount()).orElse(0);
|
|
|
|
|
int count = Optional.ofNullable(assetTask.getCount()).orElse(0);
|
|
|
|
|
BeanUtils.copyProperties(assetTask, newAssetTask);
|
|
|
|
|
if (deadlineStatus == 1) {
|
|
|
|
|
//超期
|
|
|
|
|
newAssetTask.setDeadlineCount(deadlineCount + 1);
|
|
|
|
|
assetTaskService.update(newAssetTask);
|
|
|
|
|
} else {
|
|
|
|
|
newAssetTask.setCount(count + 1);
|
|
|
|
|
assetTaskService.update(newAssetTask);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//当前时间喝任务截至时间比较
|
|
|
|
|
private int extracted(AssetTask assetTask) {
|
|
|
|
|
int status = 0;
|
|
|
|
|
// 获取当前时间
|
|
|
|
|
LocalDate now = LocalDate.now();
|
|
|
|
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
|
|
|
|
String formattedDateTime = formatter.format(now);
|
|
|
|
|
//获取任务截至时间
|
|
|
|
|
String deadLine = assetTask.getTaskDeadline();
|
|
|
|
|
// 转换为 LocalDateTime
|
|
|
|
|
LocalDate deadlineDate = LocalDate.parse(deadLine, formatter);
|
|
|
|
|
LocalDate currentDate = LocalDate.parse(formattedDateTime, formatter);
|
|
|
|
|
if (deadlineDate.isBefore(currentDate)) {
|
|
|
|
|
//超期
|
|
|
|
|
status = 1;
|
|
|
|
|
} else {
|
|
|
|
|
//未超期
|
|
|
|
|
status = 2;
|
|
|
|
|
}
|
|
|
|
|
return status;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//web
|
|
|
|
|
private void taskSaveOrDelete(AssetCurrentShRequest req) {
|
|
|
|
|
// 根据taskid查询五张数据
|
|
|
|
|
List<AssetCurrentCpPo> currentList = assetCurrentCpService.findByTaskId(req.getTaskId());
|
|
|
|
@ -424,4 +751,74 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
|
|
|
|
|
public List<AssetTask> taskList(String dwmc) {
|
|
|
|
|
return assetTaskDao.taskList(dwmc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void updateYgtByTaskId(Integer taskId, Integer count) {
|
|
|
|
|
assetTaskDao.updateYgtByTaskId(taskId, count);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//创建任务流程
|
|
|
|
|
private void getTaskStatus(AssetCurrentShRequest req) {
|
|
|
|
|
AssetLc assetLc = new AssetLc();
|
|
|
|
|
int taskStatus = 0;
|
|
|
|
|
if (req.getStatus() == 3) {
|
|
|
|
|
assetLc.setTaskId(req.getTaskId());
|
|
|
|
|
assetLc.setXfTime(LocalDateTime.now());
|
|
|
|
|
assetLc.setAssetName("管理员审核通过" + req.getXtmc());
|
|
|
|
|
assetLcService.insert(assetLc);
|
|
|
|
|
} else if (req.getStatus() == 4) {
|
|
|
|
|
assetLc.setTaskId(req.getTaskId());
|
|
|
|
|
assetLc.setAssetName("管理员审核不通过" + req.getXtmc());
|
|
|
|
|
assetLc.setXfTime(LocalDateTime.now());
|
|
|
|
|
assetLcService.insert(assetLc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// //单位端资产审核,更新任务表状态
|
|
|
|
|
// //查询当前任务下的所有资产状态和完成时间
|
|
|
|
|
// 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);
|
|
|
|
|
// boolean hased = list.stream().anyMatch(item -> item.getStatus() == 5);
|
|
|
|
|
// LocalDateTime finishTime = null;
|
|
|
|
|
// String btgyy = 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 = 1;
|
|
|
|
|
// btgyy = req.getBtgyy();
|
|
|
|
|
// //修改不通过原因
|
|
|
|
|
// assetCurrentCpService.updateByAssetId(req.getAssetId(), req.getTaskId(), btgyy);
|
|
|
|
|
// } 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);
|
|
|
|
|
}
|