@ -1,5 +1,6 @@
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 ;
@ -15,7 +16,6 @@ import com.ruoyi.tc.entity.response.AssetdwHcResponse;
import com.ruoyi.tc.historyService.* ;
import com.ruoyi.tc.mapper.AssetTaskMapper ;
import com.ruoyi.tc.service.* ;
import lombok.SneakyThrows ;
import org.springframework.stereotype.Service ;
import javax.annotation.Resource ;
@ -169,41 +169,6 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
* /
@Override
public void insert ( AssetTask assetTask ) {
int a = 0 ;
//遍历单位
String [ ] taskParts = assetTask . getDwmc ( ) . split ( "," ) ;
int current = 0 ;
int xcx = 0 ;
int gzh = 0 ;
int email = 0 ;
int app = 0 ;
int totalCount = 0 ;
for ( String part : taskParts ) {
//根据单位查询所有资产
//web
// 遍历资产类型字段
String [ ] uParts = assetTask . getType ( ) . split ( "," ) ;
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 ( ) ;
@ -226,55 +191,18 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
assetCurrentResponse . setTaskId ( id ) ;
}
assetCurrentCpService . saveBatch ( list ) ;
List < AssetBusinessFormCpPo > assetBusinessFormCpResponseList = new ArrayList < > ( ) ;
for ( AssetCurrentCpPo assetCurrentResponse : list ) {
//新增新监管业务形态
//根据资产id查询新监管业务形态主表id
List < AssetBusinessFormCpPo > bussList = assetBusinessFormCpService . findByassetId ( assetCurrentResponse . getId ( ) ) ;
if ( bussList ! = null ) {
for ( AssetBusinessFormCpPo assetBusinessFormCpResponse : bussList ) {
if ( assetCurrentResponse . getXjgywxt ( ) ! = null ) {
assetCurrentResponse . getXjgywxt ( ) . setAssetId ( assetBusinessFormCpResponse . getAssetId ( ) ) ;
assetCurrentResponse . getXjgywxt ( ) . setTaskId ( id ) ;
assetBusinessFormCpResponseList . add ( assetCurrentResponse . getXjgywxt ( ) ) ;
}
}
assetBusinessFormCpService . saveBatch ( assetBusinessFormCpResponseList ) ;
}
//根据资产id查询供应链主表id-
List < AssetSupplyChainCpPo > supplyChainList = assetSupplyChainCpService . findByassetId ( assetCurrentResponse . getId ( ) ) ;
if ( supplyChainList ! = null ) {
for ( AssetSupplyChainCpPo items : supplyChainList ) {
items . setAssetId ( assetCurrentResponse . getId ( ) ) ;
items . setSupplyId ( items . getSupplyId ( ) ) ;
items . setTaskId ( id ) ;
//新增供应链
}
assetSupplyChainCpService . saveBatch ( supplyChainList ) ;
}
List < AssetBasicNetworkCpPo > BasicNetworkCpList = assetBasicNetworkCpService . findByassetId ( assetCurrentResponse . getId ( ) ) ;
if ( BasicNetworkCpList ! = null ) {
for ( AssetBasicNetworkCpPo items : BasicNetworkCpList ) {
//根据资产id查询基础网络主表id
items . setAssetId ( assetCurrentResponse . getId ( ) ) ;
items . setNetworkId ( items . getNetworkId ( ) ) ;
items . setTaskId ( id ) ;
//新增基础网络
}
assetBasicNetworkCpService . saveBatch ( BasicNetworkCpList ) ;
}
List < UnitOtherConcatCpPo > unitOtherConcatList = unitOtherConcatCpService . findByassetId ( assetCurrentResponse . getId ( ) ) ;
if ( unitOtherConcatList ! = null ) {
for ( UnitOtherConcatCpPo items : unitOtherConcatList ) {
//根据资产id查询其他联系人主表id
items . setAssetId ( assetCurrentResponse . getId ( ) ) ;
items . setConcatId ( items . getConcatId ( ) ) ;
items . setTaskId ( id ) ;
//新增其他联系人
}
unitOtherConcatCpService . saveBatch ( unitOtherConcatList ) ;
}
}
//新增新监管业务形态
List < AssetBusinessFormCpPo > bussList = assetBusinessFormCpService . findByassetId ( assetTask . getTaskId ( ) ) ;
assetBusinessFormCpService . saveBatch ( bussList ) ;
//新增供应链
List < AssetSupplyChainCpPo > supplyChainList = assetSupplyChainCpService . findByassetId ( assetTask . getTaskId ( ) ) ;
assetSupplyChainCpService . saveBatch ( supplyChainList ) ;
//新增基础网络
List < AssetBasicNetworkCpPo > BasicNetworkCpList = assetBasicNetworkCpService . findByassetId ( assetTask . getTaskId ( ) ) ;
assetBasicNetworkCpService . saveBatch ( BasicNetworkCpList ) ;
//新增其他联系人
List < UnitOtherConcatCpPo > unitOtherConcatList = unitOtherConcatCpService . findByassetId ( assetTask . getTaskId ( ) ) ;
unitOtherConcatCpService . saveBatch ( unitOtherConcatList ) ;
}
} else if ( assetPart . equals ( "1" ) ) {
//遍历小程序资产单位
@ -285,16 +213,14 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
queryWrapper . eq ( "ssdw" , part ) ;
queryWrapper . eq ( "del_flag" , 0 ) ;
List < AssetMiniPrograms > list = assetMiniProgramsService . lambdaQuery ( ) . eq ( AssetMiniPrograms : : getSsdw , part ) . eq ( AssetMiniPrograms : : getDelFlag , 0 ) . list ( ) ;
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 ( ) ) ; // 收集到列表中
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" ) ) {
@ -306,16 +232,14 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
queryWrapper . eq ( "ssdw" , part ) ;
queryWrapper . eq ( "del_flag" , 0 ) ;
List < AssetOfficialAccount > list = assetOfficialAccountService . lambdaQuery ( ) . eq ( AssetOfficialAccount : : getSsdw , part ) . eq ( AssetOfficialAccount : : getDelFlag , 0 ) . list ( ) ;
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 ( ) ) ; // 收集到列表中
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" ) ) {
@ -328,16 +252,14 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
queryWrapper . eq ( "del_flag" , 0 ) ;
List < AssetEmail > list = assetEmailService . lambdaQuery ( ) . eq ( AssetEmail : : getSsdw , part ) . eq ( AssetEmail : : getDelFlag , 0 ) . list ( ) ;
;
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 ( ) ) ; // 收集到列表中
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" ) ) {
@ -349,16 +271,14 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
queryWrapper . eq ( "ssdw" , part ) ;
queryWrapper . eq ( "del_flag" , 0 ) ;
List < AssetApp > list = assetAppService . lambdaQuery ( ) . eq ( AssetApp : : getSsdw , part ) . eq ( AssetApp : : getDelFlag , 0 ) . list ( ) ;
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 ( ) ) ; // 收集到列表中
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 ) ;
}
}
@ -420,6 +340,36 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
}
@Override
public AssetCurrentHistory webHistory ( Long id ) {
QueryWrapper < AssetCurrentHistory > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "current_id" , id ) ;
AssetCurrentHistory byId = assetCurrentHistoryService . getOne ( queryWrapper ) ;
byId . setGylxxList ( assetSupplyChainCpService . lambdaQuery ( ) . eq ( AssetSupplyChainCpPo : : getAssetId , byId . getId ( ) ) . eq ( AssetSupplyChainCpPo : : getDelFlag , "0" ) . eq ( AssetSupplyChainCpPo : : getTaskId , byId . getTaskId ( ) ) . list ( ) ) ;
byId . setJcwlList ( assetBasicNetworkCpService . lambdaQuery ( ) . eq ( AssetBasicNetworkCpPo : : getAssetId , byId . getId ( ) ) . eq ( AssetBasicNetworkCpPo : : getDelFlag , "0" ) . eq ( AssetBasicNetworkCpPo : : getTaskId , byId . getTaskId ( ) ) . list ( ) ) ;
byId . setXjgywxt ( assetBusinessFormCpService . lambdaQuery ( ) . eq ( AssetBusinessFormCpPo : : getAssetId , byId . getId ( ) ) . eq ( AssetBusinessFormCpPo : : getDelFlag , "0" ) . eq ( AssetBusinessFormCpPo : : getTaskId , byId . getTaskId ( ) ) . one ( ) ) ;
byId . setOtherConcat ( unitOtherConcatCpService . lambdaQuery ( ) . eq ( UnitOtherConcatCpPo : : getAssetId , byId . getId ( ) ) . eq ( UnitOtherConcatCpPo : : getDelFlag , "0" ) . eq ( UnitOtherConcatCpPo : : getTaskId , byId . getTaskId ( ) ) . 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 byId ;
}
@Override
public AssetMiniProgramsCpPo minitaskSh ( int taskId , int assetId ) {
QueryWrapper < AssetMiniProgramsCpPo > queryWrapper = new QueryWrapper < > ( ) ;
@ -428,6 +378,13 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
return assetMiniProgramsCpService . getOne ( queryWrapper ) ;
}
@Override
public AssetMiniProgramsHistory miniHistory ( Long id ) {
QueryWrapper < AssetMiniProgramsHistory > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "mini_id" , id ) ;
return assetMiniProgramsHistoryService . getOne ( queryWrapper ) ;
}
@Override
public AssetOfficialAccountCpPo officetaskSh ( int taskId , int assetId ) {
QueryWrapper < AssetOfficialAccountCpPo > queryWrapper = new QueryWrapper < > ( ) ;
@ -456,6 +413,32 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
return byId ;
}
@Override
public AssetOfficialAccountHistory officeHistory ( Long id ) {
QueryWrapper < AssetOfficialAccountHistory > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "account_id" , id ) ;
AssetOfficialAccountHistory byId = assetOfficialAccountHistoryService . getOne ( queryWrapper ) ;
List < AssetOfficialAccountMenu > a1 = new ArrayList < > ( ) ;
String [ ] s1 = byId . getCdmc ( ) . split ( "\\|" ) ;
String [ ] s2 = byId . getCdlj ( ) . split ( "\\|" ) ;
String [ ] s3 = byId . getCdlx ( ) . split ( "\\|" ) ;
for ( int i = 0 ; i < s1 . length ; i + + ) {
AssetOfficialAccountMenu as = new AssetOfficialAccountMenu ( ) ;
if ( s1 [ i ] ! = null & & ! Objects . equals ( s1 [ i ] , "" ) ) {
as . setCdmc ( s1 [ i ] ) ;
}
if ( s2 [ i ] ! = null & & ! Objects . equals ( s2 [ i ] , "" ) ) {
as . setCdlj ( s2 [ i ] ) ;
}
if ( s3 [ i ] ! = null & & ! Objects . equals ( s3 [ i ] , "" ) ) {
as . setCdlx ( s3 [ i ] ) ;
}
a1 . add ( as ) ;
}
byId . setCdList ( a1 ) ;
return byId ;
}
@Override
public AssetEmailCpPo emailtaskSh ( int taskId , int assetId ) {
QueryWrapper < AssetEmailCpPo > queryWrapper = new QueryWrapper < > ( ) ;
@ -464,6 +447,14 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
return assetEmailCpService . getOne ( queryWrapper ) ;
}
@Override
public AssetEmailHistory emailHistory ( Long id ) {
QueryWrapper < AssetEmailHistory > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "eamil_id" , id ) ;
return assetEmailHistoryService . getOne ( queryWrapper ) ;
}
@Override
public AssetAppCpPo apptaskSh ( int taskId , int assetId ) {
QueryWrapper < AssetAppCpPo > queryWrapper = new QueryWrapper < > ( ) ;
@ -472,6 +463,14 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
return assetAppCpService . getOne ( queryWrapper ) ;
}
@Override
public AssetAppHistory appHistory ( Long id ) {
QueryWrapper < AssetAppHistory > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "app_id" , id ) ;
return assetAppHistoryService . getOne ( queryWrapper ) ;
}
@Override
public Page < AssestTaskXqresponse > zcHc ( Page < AssestTaskXqresponse > assetTask , AssestTaskXqRequest pageRequest ) {
assetTask . setOptimizeCountSql ( false ) ;
@ -494,9 +493,9 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
return result ;
}
@SneakyThrows
@Override
public int sh ( AssetCurrentShRequest req ) {
public int sh ( AssetCurrentShRequest req ) throws ParseException {
//根据taskid获取当前任务的count数量
AssetTask assetTask = assetTaskDao . getByTaskId ( req . getTaskId ( ) ) ;
// 获取当前时间
@ -511,8 +510,8 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
getTaskStatus ( req ) ;
if ( req . getBtgyy ( ) ! = null ) {
assetTaskDao . sh ( req ) ;
//修改子表和新增历史表
updateZiandHistory ( req , date ) ;
// //修改子表和新增历史表
// updateZiandHistory(req, date);
} else {
//修改子表和新增历史表
updateZiandHistory ( req , date ) ;
@ -527,8 +526,8 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
getTaskStatus ( req ) ;
if ( req . getBtgyy ( ) ! = null ) {
assetTaskDao . xcxsh ( req ) ;
//修改子表和新增历史表
updateMinZiandHistory ( req , date ) ;
// //修改子表和新增历史表
// updateMinZiandHistory(req, date);
} else {
//修改子表和新增历史表
updateMinZiandHistory ( req , date ) ;
@ -544,8 +543,8 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
getTaskStatus ( req ) ;
if ( req . getBtgyy ( ) ! = null ) {
assetTaskDao . gzhsh ( req ) ;
//修改子表和历史表新增
updateGzhZiandHistory ( req , date ) ;
// //修改子表和历史表新增
// updateGzhZiandHistory(req, date);
} else {
//修改子表和历史表新增
updateGzhZiandHistory ( req , date ) ;
@ -561,8 +560,8 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
getTaskStatus ( req ) ;
if ( req . getBtgyy ( ) ! = null ) {
assetTaskDao . emailsh ( req ) ;
//修改子表和历史表新增
updateEmailZiandHistory ( req , date ) ;
// //修改子表和历史表新增
// updateEmailZiandHistory(req, date);
} else {
//修改子表和历史表新增
updateEmailZiandHistory ( req , date ) ;
@ -578,8 +577,8 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
getTaskStatus ( req ) ;
if ( req . getBtgyy ( ) ! = null ) {
assetTaskDao . appsh ( req ) ;
//修改子表和历史表新增
updateAppZiandHistory ( req , date ) ;
// //修改子表和历史表新增
// updateAppZiandHistory(req, date);
} else {
//修改子表和历史表新增
updateAppZiandHistory ( req , date ) ;
@ -591,35 +590,35 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
AssetTask finalTask = assetTaskDao . getByTaskId ( req . getTaskId ( ) ) ;
LocalDateTime finishTime = null ;
//根据任务id查询是否进行中
Integer jxz = assetTaskDao . getJxz ( req . getTaskId ( ) ) ;
if ( jxz > 0 ) {
//进行中
finalTask . setTaskStatus ( 1 ) ;
finalTask . setTaskFinishTime ( finishTime ) ;
assetTaskService . update ( finalTask ) ;
} else {
//根据任务id查询是否超期
String ifcq = assetTaskDao . getifcq ( req . getTaskId ( ) ) ;
String taskDeadline = finalTask . getTaskDeadline ( ) ; // 定义日期格式,确保格式与字符串一致
SimpleDateFormat dateFormat = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss" ) ; // 根据你的时间格式调整
// 将字符串转换为日期对象
Date ifcqDate = dateFormat . parse ( ifcq ) ;
Date taskDeadlineDate = dateFormat . parse ( taskDeadline ) ;
// 比较两个日期
if ( ifcqDate . before ( taskDeadlineDate ) ) {
//超期完成
finalTask . setTaskStatus ( 3 ) ;
finishTime = LocalDateTime . now ( ) ;
finalTask . setTaskFinishTime ( finishTime ) ;
assetTaskService . update ( finalTask ) ;
} else if ( ifcqDate . after ( taskDeadlineDate ) ) {
//正常完成
finalTask . setTaskStatus ( 2 ) ;
finishTime = LocalDateTime . now ( ) ;
finalTask . setTaskFinishTime ( finishTime ) ;
assetTaskService . update ( finalTask ) ;
}
}
Integer jxz = assetTaskDao . getJxz ( req . getTaskId ( ) ) ;
if ( jxz > 0 ) {
//进行中
finalTask . setTaskStatus ( 1 ) ;
finalTask . setTaskFinishTime ( finishTime ) ;
assetTaskService . update ( finalTask ) ;
} else {
//根据任务id查询是否超期
String ifcq = assetTaskDao . getifcq ( req . getTaskId ( ) ) ;
String taskDeadline = finalTask . getTaskDeadline ( ) ; // 定义日期格式,确保格式与字符串一致
SimpleDateFormat dateFormat = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss" ) ; // 根据你的时间格式调整
// 将字符串转换为日期对象
Date ifcqDate = dateFormat . parse ( ifcq ) ;
Date taskDeadlineDate = dateFormat . parse ( taskDeadline ) ;
// 比较两个日期
if ( ifcqDate . before ( taskDeadlineDate ) ) {
//超期完成
finalTask . setTaskStatus ( 3 ) ;
finishTime = LocalDateTime . now ( ) ;
finalTask . setTaskFinishTime ( finishTime ) ;
assetTaskService . update ( finalTask ) ;
} else if ( ifcqDate . after ( taskDeadlineDate ) ) {
//正常完成
finalTask . setTaskStatus ( 2 ) ;
finishTime = LocalDateTime . now ( ) ;
finalTask . setTaskFinishTime ( finishTime ) ;
assetTaskService . update ( finalTask ) ;
}
}
return 0 ;
}
@ -631,6 +630,7 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
//新增历史记录表
AssetAppHistory assetAppHistory = new AssetAppHistory ( ) ;
BeanUtils . copyProperties ( req . getAssetAppCpPo ( ) , assetAppHistory ) ;
assetAppHistory . setAppId ( null ) ;
assetAppHistoryService . save ( assetAppHistory ) ;
}
@ -641,6 +641,7 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
//新增历史记录表
AssetEmailHistory assetEmailHistory = new AssetEmailHistory ( ) ;
BeanUtils . copyProperties ( req . getAssetEmailCpPo ( ) , assetEmailHistory ) ;
assetEmailHistory . setEmailId ( null ) ;
assetEmailHistoryService . save ( assetEmailHistory ) ;
}
@ -664,6 +665,7 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
//新增历史记录表
AssetOfficialAccountHistory assetOfficialAccountHistory = new AssetOfficialAccountHistory ( ) ;
BeanUtils . copyProperties ( req . getAssetOfficialAccountCpPo ( ) , assetOfficialAccountHistory ) ;
assetOfficialAccountHistory . setAccountId ( null ) ;
assetOfficialAccountHistoryService . save ( assetOfficialAccountHistory ) ;
}
@ -674,6 +676,7 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
//新增历史记录表
AssetMiniProgramsHistory assetMiniProgramsHistory = new AssetMiniProgramsHistory ( ) ;
BeanUtils . copyProperties ( req . getAssetMiniProgramsCpPo ( ) , assetMiniProgramsHistory ) ;
assetMiniProgramsHistory . setMiniId ( null ) ;
assetMiniProgramsHistoryService . save ( assetMiniProgramsHistory ) ;
}
@ -685,7 +688,7 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
unitOtherConcatCpService . deletByAssetIdandTaskId ( req . getAssetCurrentCpPo ( ) . getId ( ) , req . getAssetCurrentCpPo ( ) . getTaskId ( ) ) ;
assetBasicNetworkCpService . deletByAssetIdandTaskId ( req . getAssetCurrentCpPo ( ) . getId ( ) , req . getAssetCurrentCpPo ( ) . getTaskId ( ) ) ;
StringBuilder a = new StringBuilder ( ) ;
if ( ! req . getAssetCurrentCpPo ( ) . getGlymList ( ) . isEmpty ( ) ) {
if ( CollectionUtil . isNotEmpty ( req . getAssetCurrentCpPo ( ) . getGlymList ( ) ) ) {
req . getAssetCurrentCpPo ( ) . getGlymList ( ) . forEach ( x - > {
if ( ! Objects . equals ( x . getKey ( ) , "" ) & & x . getKey ( ) ! = null ) {
a . append ( x . getKey ( ) ) ;
@ -695,7 +698,7 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
}
req . getAssetCurrentCpPo ( ) . setGlym ( a . toString ( ) ) ;
StringBuilder b = new StringBuilder ( ) ;
if ( ! req . getAssetCurrentCpPo ( ) . getGlIpList ( ) . isEmpty ( ) ) {
if ( CollectionUtil . isNotEmpty ( req . getAssetCurrentCpPo ( ) . getGlIpList ( ) ) ) {
req . getAssetCurrentCpPo ( ) . getGlIpList ( ) . forEach ( x - > {
if ( ! Objects . equals ( x . getKey ( ) , "" ) & & x . getKey ( ) ! = null ) {
b . append ( x . getKey ( ) ) ;
@ -749,7 +752,7 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
private void saveHistory ( AssetCurrentShRequest req , StringBuilder a , StringBuilder b , Date date , AssetCurrentHistory assetCurrentHistory ) {
//新增历史记录
StringBuilder c = new StringBuilder ( ) ;
if ( ! req . getAssetCurrentCpPo ( ) . getGlymList ( ) . isEmpty ( ) ) {
if ( CollectionUtil . isNotEmpty ( req . getAssetCurrentCpPo ( ) . getGlymList ( ) ) ) {
req . getAssetCurrentCpPo ( ) . getGlymList ( ) . forEach ( x - > {
if ( ! Objects . equals ( x . getKey ( ) , "" ) & & x . getKey ( ) ! = null ) {
c . append ( x . getKey ( ) ) ;
@ -759,7 +762,7 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
}
req . getAssetCurrentCpPo ( ) . setGlym ( a . toString ( ) ) ;
StringBuilder d = new StringBuilder ( ) ;
if ( ! req . getAssetCurrentCpPo ( ) . getGlIpList ( ) . isEmpty ( ) ) {
if ( CollectionUtil . isNotEmpty ( req . getAssetCurrentCpPo ( ) . getGlIpList ( ) ) ) {
req . getAssetCurrentCpPo ( ) . getGlIpList ( ) . forEach ( x - > {
if ( ! Objects . equals ( x . getKey ( ) , "" ) & & x . getKey ( ) ! = null ) {
d . append ( x . getKey ( ) ) ;
@ -773,6 +776,7 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
// 设置更新时间
req . getAssetCurrentCpPo ( ) . setUpdateTime ( date ) ;
BeanUtils . copyProperties ( req . getAssetCurrentCpPo ( ) , assetCurrentHistory ) ;
assetCurrentHistory . setCurrentId ( null ) ;
assetCurrentHistoryService . save ( assetCurrentHistory ) ;
//新增新监管业务形态历史表
@ -782,6 +786,7 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
AssetBusinessFormHistory assetBusinessFormHistory = new AssetBusinessFormHistory ( ) ;
assetBusinessFormHistory . setCopyId ( req . getAssetCurrentCpPo ( ) . getCurrentId ( ) ) ;
BeanUtils . copyProperties ( req . getAssetCurrentCpPo ( ) . getXjgywxt ( ) , assetBusinessFormHistory ) ;
assetBusinessFormHistory . setBusinessId ( null ) ;
assetBusinessFormHistoryService . save ( assetBusinessFormHistory ) ;
}
@ -792,14 +797,13 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
}
//新增供应链历史表
List < AssetSupplyChainHistory > assetSupplyChainHistoryList = req . getAssetCurrentCpPo ( ) . getGylxxList ( ) . stream ( )
. map ( cpPo - > {
AssetSupplyChainHistory assetSupplyChainHistory = new AssetSupplyChainHistory ( ) ;
assetSupplyChainHistory . setCopyId ( req . getAssetCurrentCpPo ( ) . getCurrentId ( ) ) ;
BeanUtils . copyProperties ( cpPo , assetSupplyChainHistory ) ; // 复制属性
return assetSupplyChainHistory ; // 返回新对象
} )
. collect ( Collectors . toList ( ) ) ; // 收集到列表中
List < AssetSupplyChainHistory > assetSupplyChainHistoryList = req . getAssetCurrentCpPo ( ) . getGylxxList ( ) . stream ( ) . map ( cpPo - > {
AssetSupplyChainHistory assetSupplyChainHistory = new AssetSupplyChainHistory ( ) ;
assetSupplyChainHistory . setCopyId ( req . getAssetCurrentCpPo ( ) . getCurrentId ( ) ) ;
BeanUtils . copyProperties ( cpPo , assetSupplyChainHistory ) ; // 复制属性
assetSupplyChainHistory . setSupplyId ( null ) ;
return assetSupplyChainHistory ; // 返回新对象
} ) . collect ( Collectors . toList ( ) ) ; // 收集到列表中
assetSupplyChainHistoryService . saveBatch ( assetSupplyChainHistoryList ) ;
}
if ( ! req . getAssetCurrentCpPo ( ) . getJcwlList ( ) . isEmpty ( ) ) {
@ -809,14 +813,13 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
}
//新增基础网络历史表
List < AssetBasicNetworkHistory > assetSupplyChainHistoryList = req . getAssetCurrentCpPo ( ) . getJcwlList ( ) . stream ( )
. map ( cpPo - > {
AssetBasicNetworkHistory assetBasicNetworkHistory = new AssetBasicNetworkHistory ( ) ;
assetBasicNetworkHistory . setCopyId ( req . getAssetCurrentCpPo ( ) . getCurrentId ( ) ) ;
BeanUtils . copyProperties ( cpPo , assetBasicNetworkHistory ) ; // 复制属性
return assetBasicNetworkHistory ; // 返回新对象
} )
. collect ( Collectors . toList ( ) ) ; // 收集到列表中
List < AssetBasicNetworkHistory > assetSupplyChainHistoryList = req . getAssetCurrentCpPo ( ) . getJcwlList ( ) . stream ( ) . map ( cpPo - > {
AssetBasicNetworkHistory assetBasicNetworkHistory = new AssetBasicNetworkHistory ( ) ;
assetBasicNetworkHistory . setCopyId ( req . getAssetCurrentCpPo ( ) . getCurrentId ( ) ) ;
BeanUtils . copyProperties ( cpPo , assetBasicNetworkHistory ) ; // 复制属性
assetBasicNetworkHistory . setNetworkId ( null ) ;
return assetBasicNetworkHistory ; // 返回新对象
} ) . collect ( Collectors . toList ( ) ) ; // 收集到列表中
assetBasicNetworkHistoryService . saveBatch ( assetSupplyChainHistoryList ) ;
}
if ( ! req . getAssetCurrentCpPo ( ) . getOtherConcat ( ) . isEmpty ( ) ) {
@ -825,14 +828,13 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
items . setTaskId ( req . getAssetCurrentCpPo ( ) . getTaskId ( ) ) ;
}
//新增其他联系人
List < UnitOtherConcatHistory > unitOtherConcatHistoryList = req . getAssetCurrentCpPo ( ) . getOtherConcat ( ) . stream ( )
. map ( cpPo - > {
UnitOtherConcatHistory unitOtherConcatHistory = new UnitOtherConcatHistory ( ) ;
unitOtherConcatHistory . setCopyId ( req . getAssetCurrentCpPo ( ) . getCurrentId ( ) ) ;
BeanUtils . copyProperties ( cpPo , unitOtherConcatHistory ) ; // 复制属性
return unitOtherConcatHistory ; // 返回新对象
} )
. collect ( Collectors . toList ( ) ) ; // 收集到列表中
List < UnitOtherConcatHistory > unitOtherConcatHistoryList = req . getAssetCurrentCpPo ( ) . getOtherConcat ( ) . stream ( ) . map ( cpPo - > {
UnitOtherConcatHistory unitOtherConcatHistory = new UnitOtherConcatHistory ( ) ;
unitOtherConcatHistory . setCopyId ( req . getAssetCurrentCpPo ( ) . getCurrentId ( ) ) ;
BeanUtils . copyProperties ( cpPo , unitOtherConcatHistory ) ; // 复制属性
unitOtherConcatHistory . setUnitId ( null ) ;
return unitOtherConcatHistory ; // 返回新对象
} ) . collect ( Collectors . toList ( ) ) ; // 收集到列表中
unitOtherConcatHistoryService . saveBatch ( unitOtherConcatHistoryList ) ;
}
}
@ -862,6 +864,7 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
//将子表数据复制到主表中
AssetOfficialAccount assetOfficialAccount = new AssetOfficialAccount ( ) ;
BeanUtils . copyProperties ( assetOfficialAccountCpPo , assetOfficialAccount ) ; // 复制属性
assetOfficialAccount . setId ( null ) ;
assetOfficialAccountService . save ( assetOfficialAccount ) ;
}
@ -950,7 +953,7 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
//web
private void taskSaveOrDelete ( AssetCurrentShRequest req ) {
// 根据资产id查询五张数据
AssetCurrentCpPo currentCpPo = assetCurrentCpService . findByTaskId ( req . getAssetId ( ) );
AssetCurrentCpPo currentCpPo = assetCurrentCpService . findByTaskId ( req . getAssetId ( ) , req . getTaskId ( ) );
//删除主表原有数据
if ( currentCpPo ! = null ) {
assetCurrentService . deleteIdList ( currentCpPo . getId ( ) ) ;
@ -962,47 +965,64 @@ public class AssetTaskServiceImpl extends ServiceImpl<AssetTaskMapper, AssetTask
}
//AssetBusinessFormCpPo
AssetBusinessFormCpPo businessFormCpPo = assetBusinessFormCpService . findByTaskId ( req . getAssetId ( ) ) ;
List < AssetBusinessFormCpPo > businessFormCpPo = assetBusinessFormCpService . findByTaskId ( req . getAssetId ( ) , req . getTaskId ( ) ) ;
List < Long > businessList = businessFormCpPo . stream ( ) . map ( AssetBusinessFormCpPo : : getAssetId ) . collect ( Collectors . toList ( ) ) ;
//删除原有数据
if ( businessFormCpPo ! = null ) {
assetBusinessFormService . deleteIdList ( Collections. singletonList ( businessFormCpPo . getAssetId ( ) ) ) ;
if ( CollectionUtil. isNotEmpty ( businessList ) ) {
assetBusinessFormService . deleteIdList ( businessList ) ;
//将子表数据复制到主表中
AssetBusinessForm businessForm = new AssetBusinessForm ( ) ;
BeanUtils . copyProperties ( businessFormCpPo , businessForm ) ; // 复制属性
businessForm . setId ( null ) ;
assetBusinessFormService . save ( businessForm ) ;
List < AssetBusinessForm > businessFormCpPoList = req . getAssetCurrentCpPo ( ) . getOtherConcat ( ) . stream ( ) . map ( cpPo - > {
AssetBusinessForm assetBusinessForm = new AssetBusinessForm ( ) ;
BeanUtils . copyProperties ( cpPo , assetBusinessForm ) ; // 复制属性
assetBusinessForm . setId ( null ) ;
return assetBusinessForm ; // 返回新对象
} ) . collect ( Collectors . toList ( ) ) ;
assetBusinessFormService . saveBatch ( businessFormCpPoList ) ;
}
//AssetBasicNetworkCpPo
AssetBasicNetworkCpPo networkCpPo = assetBasicNetworkCpService . findByTaskId ( req . getAssetId ( ) ) ;
List < AssetBasicNetworkCpPo > networkCpPo = assetBasicNetworkCpService . findByTaskId ( req . getAssetId ( ) , req . getTaskId ( ) ) ;
List < Long > netWorkList = networkCpPo . stream ( ) . map ( AssetBasicNetworkCpPo : : getAssetId ) . collect ( Collectors . toList ( ) ) ;
//删除原有数据
if ( networkCpPo ! = null ) {
assetBasicNetworkService . deleteIdList ( Collections . singletonList ( networkCpPo . getAssetId ( ) ) ) ;
AssetBasicNetwork network = new AssetBasicNetwork ( ) ;
BeanUtils . copyProperties ( networkCpPo , network ) ;
network . setId ( null ) ;
assetBasicNetworkService . save ( network ) ;
if ( CollectionUtil . isNotEmpty ( netWorkList ) ) {
assetBasicNetworkService . deleteIdList ( netWorkList ) ;
List < AssetBasicNetwork > networksCpPoList = req . getAssetCurrentCpPo ( ) . getOtherConcat ( ) . stream ( ) . map ( cpPo - > {
AssetBasicNetwork assetBasicNetwork = new AssetBasicNetwork ( ) ;
BeanUtils . copyProperties ( cpPo , assetBasicNetwork ) ; // 复制属性
assetBasicNetwork . setId ( null ) ;
return assetBasicNetwork ; // 返回新对象
} ) . collect ( Collectors . toList ( ) ) ;
assetBasicNetworkService . saveBatch ( networksCpPoList ) ;
}
//AssetSupplyChainCpPo
AssetSupplyChainCpPo supplyChainCpPo = assetSupplyChainCpService . findByTaskId ( req . getAssetId ( ) ) ;
List < AssetSupplyChainCpPo > supplyChainCpPo = assetSupplyChainCpService . findByTaskId ( req . getAssetId ( ) , req . getTaskId ( ) ) ;
List < Long > supplyList = supplyChainCpPo . stream ( ) . map ( AssetSupplyChainCpPo : : getAssetId ) . collect ( Collectors . toList ( ) ) ;
//删除原有数据
if ( supplyChainCpPo ! = null ) {
assetSupplyChainService . deleteIdList ( Collections . singletonList ( supplyChainCpPo . getAssetId ( ) ) ) ;
AssetSupplyChain supplyChain = new AssetSupplyChain ( ) ;
BeanUtils . copyProperties ( supplyChainCpPo , supplyChain ) ;
supplyChain . setId ( null ) ;
assetSupplyChainService . save ( supplyChain ) ;
if ( CollectionUtil . isNotEmpty ( supplyList ) ) {
assetSupplyChainService . deleteIdList ( supplyList ) ;
List < AssetSupplyChain > supplyChainList = req . getAssetCurrentCpPo ( ) . getOtherConcat ( ) . stream ( ) . map ( cpPo - > {
AssetSupplyChain assetSupplyChain = new AssetSupplyChain ( ) ;
BeanUtils . copyProperties ( cpPo , assetSupplyChain ) ; // 复制属性
assetSupplyChain . setId ( null ) ;
return assetSupplyChain ; // 返回新对象
} ) . collect ( Collectors . toList ( ) ) ;
assetSupplyChainService . saveBatch ( supplyChainList ) ;
}
//UnitOtherConcatCpPo
UnitOtherConcatCpPo unitOtherConcatCpPo = unitOtherConcatCpService . findByTaskId ( req . getAssetId ( ) ) ;
List < UnitOtherConcatCpPo > unitOtherConcatCpPo = unitOtherConcatCpService . findByTaskId ( req . getAssetId ( ) , req . getTaskId ( ) ) ;
List < Long > unitList = unitOtherConcatCpPo . stream ( ) . map ( UnitOtherConcatCpPo : : getAssetId ) . collect ( Collectors . toList ( ) ) ;
//删除原有数据
if ( unitOtherConcatCpPo ! = null ) {
unitOtherConcatService . deleteIdList ( Collections . singletonList ( unitOtherConcatCpPo . getAssetId ( ) ) ) ;
UnitOtherConcat unitOtherConcat = new UnitOtherConcat ( ) ;
BeanUtils . copyProperties ( unitOtherConcatCpPo , unitOtherConcat ) ; // 复制属性
unitOtherConcat . setConcatId ( null ) ;
unitOtherConcatService . save ( unitOtherConcat ) ;
if ( CollectionUtil . isNotEmpty ( unitList ) ) {
unitOtherConcatService . deleteIdList ( unitList ) ;
List < UnitOtherConcat > unitOtherConcatList = req . getAssetCurrentCpPo ( ) . getOtherConcat ( ) . stream ( ) . map ( cpPo - > {
UnitOtherConcat unitOtherConcat = new UnitOtherConcat ( ) ;
BeanUtils . copyProperties ( cpPo , unitOtherConcat ) ; // 复制属性
unitOtherConcat . setConcatId ( null ) ;
return unitOtherConcat ; // 返回新对象
} ) . collect ( Collectors . toList ( ) ) ;
unitOtherConcatService . saveBatch ( unitOtherConcatList ) ;
}
}