@ -2,10 +2,13 @@ package com.ruoyi.jjh.declaration.service.impl;
import cn.hutool.core.bean.BeanUtil ;
import cn.hutool.core.collection.CollectionUtil ;
import com.alibaba.fastjson2.JSONArray ;
import com.alibaba.fastjson2.JSONObject ;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper ;
import com.baomidou.mybatisplus.core.toolkit.Wrappers ;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl ;
import com.ruoyi.common.context.SecurityContextHolder ;
import com.ruoyi.common.exception.ServiceException ;
import com.ruoyi.common.utils.DateUtils ;
import com.ruoyi.common.utils.SecurityUtils ;
import com.ruoyi.jjh.declaration.component.TimingRemindService ;
@ -20,16 +23,14 @@ import com.ruoyi.jjh.declaration.service.*;
import com.ruoyi.jjh.ent.entity.JProject ;
import com.ruoyi.jjh.ent.entity.JSmartDeclaration ;
import com.ruoyi.jjh.ent.service.JProjectService ;
import io.swagger.models.auth.In ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.beans.factory.annotation.Value ;
import org.springframework.stereotype.Service ;
import org.springframework.transaction.annotation.Transactional ;
import javax.annotation.Resource ;
import java.util.ArrayList ;
import java.util.List ;
import java.util.Map ;
import java.util.Objects ;
import java.util.* ;
import java.util.concurrent.atomic.AtomicReference ;
import java.util.function.Function ;
import java.util.stream.Collectors ;
@ -142,30 +143,20 @@ public class BmsDeclarationRecordsServiceImpl extends ServiceImpl<BmsDeclaration
@Override
public DeclarationRecordsVo selectBmsDeclarationRecordsById ( Long id ) {
// 获取申请记录
BmsDeclarationRecords declarationRecords = baseMapper. selectBmsDeclarationRecords ById( id ) ;
BmsDeclarationRecords declarationRecords = get ById( id ) ;
DeclarationRecordsVo declarationRecordsVo = new DeclarationRecordsVo ( ) ;
declarationRecordsVo . setBmsDeclarationRecords ( declarationRecords ) ;
// 在线模板记录id
int declarationTemplateType = declarationRecords . getTemplateId ( ) ;
// 详情id
Long detailId = declarationRecords . getDetailId ( ) ;
// 企业的统一社会信用代码
String creditCode = declarationRecords . getCreditCode ( ) ;
// 获取详情数据
iCommonService . getData ( declarationTemplateType , detailId , declarationRecordsVo ) ;
Long declarationTemplateType = declarationRecords . getTemplateId ( ) ;
//企业基本信息
QueryWrapper < BmsEnterpriseBasicInfo > queryWrapper = new QueryWrapper < > ( ) ;
queryWrapper . eq ( "tyshxydm" , creditCode) ;
queryWrapper . eq ( "tyshxydm" , declarationRecords . getCreditCode ( ) ) ;
BmsEnterpriseBasicInfo one = iBmsEnterpriseBasicInfoService . getOne ( queryWrapper ) ;
declarationRecordsVo . setBmsEnterpriseBasicInfo ( one ) ;
declarationRecordsVo . setApprovalInfoList ( iBmsApprovalInfoService . getApprovalInfoList ( id ) ) ;
BmsTemplateRecord items = iBmsTemplateRecordService . getById ( declarationRecords . getTemplateRecordId ( ) ) ;
//获取申报任务标题
declarationRecordsVo . setEnterpriseDirectory ( items . getEnterpriseDirectory ( ) ) ;
declarationRecordsVo . setEnterpriseDirectory ( items . getEnterpriseDirectory ( ) ) ;
return declarationRecordsVo ;
}
@ -186,10 +177,6 @@ public class BmsDeclarationRecordsServiceImpl extends ServiceImpl<BmsDeclaration
return baseMapper . selectBmsDeclarationRecordsZwList ( bmsDeclarationRecordsDto ) ;
}
@Override
public List < BmsMunicipalBureauReviewQueryVo > selectMunicipalBureauReviewList ( ) {
return baseMapper . selectMunicipalBureauReviewList ( ) ;
}
/ * *
* 审 核 列 表
@ -201,107 +188,56 @@ public class BmsDeclarationRecordsServiceImpl extends ServiceImpl<BmsDeclaration
* /
@Override
public List < ApprovalDeclarationRecordsQueryVo > approvalList ( ApprovalDeclarationRecordsQueryDto approvalDeclarationRecordsQueryDto ) {
// approvalDeclarationRecordsQueryDto.setUserIds(iCommonService.getUserIds(SecurityContextHolder.getUserId()));
if ( SecurityUtils . getUserId ( ) . equals ( 1L ) ) {
approvalDeclarationRecordsQueryDto . setApprovalDept ( null ) ;
} else {
// todo SecurityContextHolder.getUserId()失效换成SecurityUtils.getUserId()
approvalDeclarationRecordsQueryDto . setApprovalDept ( SecurityUtils . getDeptId ( ) ) ;
}
return baseMapper . approvalList ( approvalDeclarationRecordsQueryDto ) ;
}
@Override
@Transactional ( rollbackFor = Exception . class )
public int updateBmsApprovalInfo ( BmsApprovalInfoUpdateDto bmsApprovalInfoUpdateDto ) {
Boolean flag = false ;
List < BmsApprovalInfo > approvalInfoList = iBmsApprovalInfoService . lambdaQuery ( ) . eq ( BmsApprovalInfo : : getDeclarationRecordsId , bmsApprovalInfoUpdateDto . getDeclarationRecordsId ( ) ) . orderByAsc ( BmsApprovalInfo : : getSort ) . list ( ) ;
AtomicReference < Long > processId = new AtomicReference < > ( 0 L ) ;
if ( CollectionUtil . isNotEmpty ( approvalInfoList ) ) {
approvalInfoList . forEach ( x - > {
if ( x . getIsReview ( ) . equals ( 0 ) ) {
bmsApprovalInfoUpdateDto . setId ( x . getId ( ) ) ;
bmsApprovalInfoUpdateDto . setSort ( x . getSort ( ) ) ;
BeanUtil . copyProperties ( bmsApprovalInfoUpdateDto , x ) ;
x . setApprovalById ( SecurityContextHolder . getUserId ( ) ) ;
x . setApprovalTime ( DateUtils . getNowDate ( ) ) ;
processId . set ( x . getProcessId ( ) ) ;
}
} ) ;
approvalInfoList . forEach ( x - > {
if ( ( bmsApprovalInfoUpdateDto . getSort ( ) + 1 ) = = x . getSort ( ) ) {
x . setIsReview ( 0 ) ;
}
} ) ;
flag = iBmsApprovalInfoService . saveOrUpdateBatch ( approvalInfoList ) ;
approval ( bmsApprovalInfoUpdateDto , processId . get ( ) ) ;
}
if ( ! flag ) {
return 0 ;
}
return 1 ;
}
@Override
@Transactional ( rollbackFor = Exception . class )
public int updateApprovalInfo ( BmsApprovalInfoUpdateDto bmsApprovalInfoUpdateDto ) {
// 新增审核记录,修改申报记录状态
List < BmsProcessInfo > bmsProcessInfoList = iBmsProcessInfoService . lambdaQuery ( ) . eq ( BmsProcessInfo : : getApprovalType , 0 ) . list ( ) ;
BmsProcessInfo bmsProcessInfo = new BmsProcessInfo ( ) ;
bmsProcessInfoList . forEach ( x - > {
// boolean flag = Arrays.asList(x.getApprovalByIds().split(",")).contains(String.valueOf(SecurityUtils.getUserId()));
if ( Objects . equals ( x . getApprovalDept ( ) , SecurityUtils . getDeptId ( ) ) ) {
BeanUtil . copyProperties ( x , bmsProcessInfo ) ;
}
} ) ;
// 审批记录
List < BmsApprovalInfo > approvalInfoList = iBmsApprovalInfoService . lambdaQuery ( ) . eq ( BmsApprovalInfo : : getDeclarationRecordsId , bmsApprovalInfoUpdateDto . getDeclarationRecordsId ( ) ) . orderByDesc ( BmsApprovalInfo : : getSort ) . list ( ) ;
// 更新审批记录
if ( CollectionUtil . isNotEmpty ( approvalInfoList ) ) {
for ( BmsApprovalInfo x : approvalInfoList ) {
if ( bmsProcessInfo . getId ( ) . equals ( x . getProcessId ( ) ) ) {
// 更新审批记录
Integer sort = x . getSort ( ) ;
bmsApprovalInfoUpdateDto . setId ( x . getId ( ) ) ;
BeanUtil . copyProperties ( bmsApprovalInfoUpdateDto , x ) ;
x . setSort ( sort ) ;
x . setApprovalById ( SecurityUtils . getUserId ( ) ) ;
x . setApprovalDept ( SecurityUtils . getDeptId ( ) ) ;
x . setApprovalTime ( DateUtils . getNowDate ( ) ) ;
x . setIsReview ( 2 ) ;
x . setApprovalStatus ( bmsApprovalInfoUpdateDto . getApprovalStatus ( ) ) ;
iBmsApprovalInfoService . updateById ( x ) ;
}
}
}
// 新增记录
if ( bmsApprovalInfoUpdateDto . getApprovalStatus ( ) . equals ( 1 ) ) {
BmsProcessInfo bmsProcessInfo2 = new BmsProcessInfo ( ) ;
bmsProcessInfoList . forEach ( x - > {
if ( x . getId ( ) . equals ( bmsProcessInfo . getNextProcessId ( ) ) ) {
BeanUtil . copyProperties ( x , bmsProcessInfo2 ) ;
}
} ) ;
if ( BeanUtil . isNotEmpty ( bmsProcessInfo2 ) ) {
BmsApprovalInfo bmsApprovalInfo = new BmsApprovalInfo ( ) ;
bmsApprovalInfo . setProcessId ( bmsProcessInfo2 . getId ( ) ) ;
bmsApprovalInfo . setDeclarationRecordsId ( bmsApprovalInfoUpdateDto . getDeclarationRecordsId ( ) ) ;
bmsApprovalInfo . setApprovalById ( bmsProcessInfo2 . getApprovalById ( ) ) ;
bmsApprovalInfo . setApprovalDept ( bmsProcessInfo2 . getApprovalDept ( ) ) ;
bmsApprovalInfo . setApprovalStatus ( 0 ) ;
bmsApprovalInfo . setSort ( approvalInfoList . size ( ) + 1 ) ;
iBmsApprovalInfoService . saveOrUpdate ( bmsApprovalInfo ) ;
}
List < BmsApprovalInfo > list = iBmsApprovalInfoService . lambdaQuery ( ) . eq ( BmsApprovalInfo : : getDeclarationRecordsId , bmsApprovalInfoUpdateDto . getDeclarationRecordsId ( ) ) . orderByDesc ( BmsApprovalInfo : : getSort ) . list ( ) ;
BmsApprovalInfo ba = list . get ( 0 ) ;
// 如果当前的deptId和最新一条的审批记录一样的话
if ( ba . getApprovalStatus ( ) ! = 0 | | ! Objects . equals ( ba . getApprovalDept ( ) , SecurityUtils . getDeptId ( ) ) ) {
throw new ServiceException ( "无法审批!" ) ;
} else {
ba . setId ( null ) ;
ba . setApprovalById ( SecurityUtils . getUserId ( ) ) ;
ba . setApprovalStatus ( bmsApprovalInfoUpdateDto . getApprovalStatus ( ) ) ;
ba . setApprovalOpinions ( bmsApprovalInfoUpdateDto . getApprovalOpinions ( ) ) ;
ba . setApprovalAttachment ( bmsApprovalInfoUpdateDto . getApprovalAttachment ( ) ) ;
ba . setSort ( list . size ( ) + 1 ) ;
iBmsApprovalInfoService . save ( ba ) ;
}
// 更新记录状态
int num = approval ( bmsApprovalInfoUpdateDto , bmsProcessInfo ) ;
int num = approval ( bmsApprovalInfoUpdateDto , ba . getProcessId ( ) , list . size ( ) + 1 ) ;
return num ;
}
public int approval ( BmsApprovalInfoUpdateDto bmsApprovalInfoUpdateDto , BmsProcessInfo bmsProcessInfo ) {
public int approval ( BmsApprovalInfoUpdateDto bmsApprovalInfoUpdateDto , Long id , Integer a ) {
//获取审批之前的流程
BmsProcessInfo bmsProcessInfo = iBmsProcessInfoService . getById ( id ) ;
if ( bmsApprovalInfoUpdateDto . getApprovalStatus ( ) = = 1 ) {
//根据审批之前的流程获取下一个流程id的详情数据
if ( bmsProcessInfo . getNextProcessId ( ) ! = 0 ) {
BmsProcessInfo newBmsProcessInfo = iBmsProcessInfoService . getById ( bmsProcessInfo . getNextProcessId ( ) ) ;
BmsApprovalInfo ar = new BmsApprovalInfo ( ) ;
ar . setProcessId ( bmsProcessInfo . getNextProcessId ( ) ) ;
ar . setDeclarationRecordsId ( bmsApprovalInfoUpdateDto . getDeclarationRecordsId ( ) ) ;
ar . setApprovalStatus ( 0 ) ;
ar . setApprovalDept ( newBmsProcessInfo . getApprovalDept ( ) ) ;
ar . setSort ( a + 1 ) ;
ar . setIsReview ( 0 ) ;
iBmsApprovalInfoService . save ( ar ) ;
}
}
BmsDeclarationRecords bmsDeclarationRecords = baseMapper . selectById ( bmsApprovalInfoUpdateDto . getDeclarationRecordsId ( ) ) ;
BmsEnterpriseBasicInfo one = iBmsEnterpriseBasicInfoService . lambdaQuery ( ) . eq ( BmsEnterpriseBasicInfo : : getTyshxydm , bmsDeclarationRecords . getCreditCode ( ) ) . one ( ) ;
BmsEnterpriseBasicInfo one = iBmsEnterpriseBasicInfoService . lambdaQuery ( ) . eq ( BmsEnterpriseBasicInfo : : getTyshxydm , bmsDeclarationRecords . getCreditCode ( ) ) . one ( ) ;
JProject jp = new JProject ( ) ;
jp . setId ( bmsDeclarationRecords . getJjhProjectId ( ) ) ;
if ( bmsProcessInfo . getApprovalLevel ( ) . equals ( 0 ) ) {
@ -309,15 +245,15 @@ public class BmsDeclarationRecordsServiceImpl extends ServiceImpl<BmsDeclaration
jp . setStatus ( 2 ) ;
bmsDeclarationRecords . setStatus ( 2L ) ;
}
if ( bmsApprovalInfoUpdateDto . getApprovalStatus ( ) = = 2 ) {
if ( bmsApprovalInfoUpdateDto . getApprovalStatus ( ) = = 2 ) {
jp . setStatus ( 8 ) ;
bmsDeclarationRecords . setStatus ( 8L ) ;
timingRemindImpl . getContact ( one . getTyshxydm ( ) , "您有1个申报任务[初审不通过]" ) ;
timingRemindImpl . getContact ( one . getTyshxydm ( ) , "您有1个申报任务[初审不通过]" ) ;
}
if ( bmsApprovalInfoUpdateDto . getApprovalStatus ( ) = = 3 ) {
if ( bmsApprovalInfoUpdateDto . getApprovalStatus ( ) = = 3 ) {
jp . setStatus ( 10 ) ;
bmsDeclarationRecords . setStatus ( 10L ) ;
timingRemindImpl . getContact ( one . getTyshxydm ( ) , "您有1个申报任务[初审退回],待重新填报" ) ;
timingRemindImpl . getContact ( one . getTyshxydm ( ) , "您有1个申报任务[初审退回],待重新填报" ) ;
}
} else if ( bmsProcessInfo . getApprovalLevel ( ) . equals ( 1 ) ) {
if ( bmsApprovalInfoUpdateDto . getApprovalStatus ( ) = = 1 ) {
@ -326,91 +262,23 @@ public class BmsDeclarationRecordsServiceImpl extends ServiceImpl<BmsDeclaration
} else {
jp . setStatus ( 7 ) ;
bmsDeclarationRecords . setStatus ( 7L ) ;
timingRemindImpl . getContact ( one . getTyshxydm ( ) , "您有1个申报任务[复审不通过]" ) ;
timingRemindImpl . getContact ( one . getTyshxydm ( ) , "您有1个申报任务[复审不通过]" ) ;
}
} else if ( bmsProcessInfo . getApprovalLevel ( ) . equals ( 2 ) ) {
// if (bmsApprovalInfoUpdateDto.getApprovalStatus() == 1) {
// jp.setStatus(4);
// bmsDeclarationRecords.setStatus(4L);
// } else {
// jp.setStatus(6);
// bmsDeclarationRecords.setStatus(6L);
// }
if ( bmsApprovalInfoUpdateDto . getApprovalStatus ( ) = = 1 ) {
jp . setStatus ( 5 ) ;
bmsDeclarationRecords . setStatus ( 5L ) ;
timingRemindImpl . getContact ( one . getTyshxydm ( ) , "您有1个申报任务[终审通过]" ) ;
timingRemindImpl . getContact ( one . getTyshxydm ( ) , "您有1个申报任务[终审通过]" ) ;
} else {
jp . setStatus ( 9 ) ;
bmsDeclarationRecords . setStatus ( 9L ) ;
timingRemindImpl . getContact ( one . getTyshxydm ( ) , "您有1个申报任务[终审不通过]" ) ;
timingRemindImpl . getContact ( one . getTyshxydm ( ) , "您有1个申报任务[终审不通过]" ) ;
}
}
// else if (bmsProcessInfo.getApprovalLevel().equals(3)) {
// if (bmsApprovalInfoUpdateDto.getApprovalStatus() == 1) {
// jp.setStatus(5);
// bmsDeclarationRecords.setStatus(5L);
// } else {
// jp.setStatus(9);
// bmsDeclarationRecords.setStatus(9L);
// }
// }
jProjectService . updateById ( jp ) ;
return baseMapper . updateById ( bmsDeclarationRecords ) ;
}
/ * *
* 审 批
*
* @param bmsApprovalInfoUpdateDto
* @param processId
* @return
* @author emiya . xie
* @create 2023 / 9 / 9 18 : 22
* /
public void approval ( BmsApprovalInfoUpdateDto bmsApprovalInfoUpdateDto , Long processId ) {
BmsProcessInfo bmsProcessInfo = iBmsProcessInfoService . lambdaQuery ( ) . eq ( BmsProcessInfo : : getId , processId ) . list ( ) . get ( 0 ) ;
if ( BeanUtil . isNotEmpty ( bmsProcessInfo ) ) {
BmsDeclarationRecords bmsDeclarationRecords = baseMapper . selectById ( bmsApprovalInfoUpdateDto . getDeclarationRecordsId ( ) ) ;
JProject jp = new JProject ( ) ;
jp . setId ( bmsDeclarationRecords . getJjhProjectId ( ) ) ;
if ( bmsProcessInfo . getApprovalLevel ( ) . equals ( 0 ) ) {
if ( bmsApprovalInfoUpdateDto . getApprovalStatus ( ) = = 1 ) {
jp . setStatus ( 2 ) ;
bmsDeclarationRecords . setStatus ( 2L ) ;
} else {
jp . setStatus ( 8 ) ;
bmsDeclarationRecords . setStatus ( 8L ) ;
}
} else if ( bmsProcessInfo . getApprovalLevel ( ) . equals ( 1 ) ) {
if ( bmsApprovalInfoUpdateDto . getApprovalStatus ( ) = = 1 ) {
jp . setStatus ( 3 ) ;
bmsDeclarationRecords . setStatus ( 3L ) ;
} else {
jp . setStatus ( 7 ) ;
bmsDeclarationRecords . setStatus ( 7L ) ;
}
} else if ( bmsProcessInfo . getApprovalLevel ( ) . equals ( 2 ) ) {
if ( bmsApprovalInfoUpdateDto . getApprovalStatus ( ) = = 1 ) {
jp . setStatus ( 4 ) ;
bmsDeclarationRecords . setStatus ( 4L ) ;
} else {
jp . setStatus ( 6 ) ;
bmsDeclarationRecords . setStatus ( 6L ) ;
}
} else if ( bmsProcessInfo . getApprovalLevel ( ) . equals ( 3 ) ) {
if ( bmsApprovalInfoUpdateDto . getApprovalStatus ( ) = = 1 ) {
jp . setStatus ( 5 ) ;
bmsDeclarationRecords . setStatus ( 5L ) ;
} else {
jp . setStatus ( 9 ) ;
bmsDeclarationRecords . setStatus ( 9L ) ;
}
}
jProjectService . updateById ( jp ) ;
baseMapper . updateById ( bmsDeclarationRecords ) ;
}
}
/ * *
* 新 增 在 线 申 报 记 录
@ -465,164 +333,6 @@ public class BmsDeclarationRecordsServiceImpl extends ServiceImpl<BmsDeclaration
return baseMapper . updateBmsDeclarationRecords ( bmsDeclarationRecords ) ;
}
/ * *
* 市 级 评 定 结 果 确 认
*
* @param municipalReviewDto
* @return { @link int }
* @author emiya . xie
* @create 2023 / 9 / 13 17 : 21
* /
@Override
public int municipalReview ( MunicipalReviewDto municipalReviewDto ) {
List < MunicipalReviewInfoDto > list = municipalReviewDto . getList ( ) ;
// 需要更新的数据
List < BmsDeclarationRecords > reviewrecordsList = new ArrayList < > ( ) ;
// 统一信用代码、年份、申报类型 -- > 申报记录 -->
// 查询企业数据
List < BmsEnterpriseBasicInfo > enterpriseInfoList = iBmsEnterpriseBasicInfoService . lambdaQuery ( ) . list ( ) ;
Map < String , BmsEnterpriseBasicInfo > enterpriseBasicMap = enterpriseInfoList . stream ( ) . collect ( Collectors . toMap ( BmsEnterpriseBasicInfo : : getTyshxydm , Function . identity ( ) ) ) ;
// 匹配企业
List < Long > enterpriseIdList = new ArrayList < > ( ) ;
list . forEach ( x - > {
if ( enterpriseBasicMap . containsKey ( x . getCreditCode ( ) ) ) {
x . setEnterpriseId ( enterpriseBasicMap . get ( x . getCreditCode ( ) ) . getId ( ) ) ;
// 获取对应企业id集合
enterpriseIdList . add ( enterpriseBasicMap . get ( x . getCreditCode ( ) ) . getId ( ) ) ;
}
// 区分状态
if ( x . getResult ( ) . equals ( "通过" ) ) {
x . setStatus ( 5L ) ;
} else {
x . setStatus ( 9L ) ;
}
} ) ;
//获取对应企业的申报记录
List < BmsDeclarationRecords > recordsList = baseMapper . selectList ( Wrappers . lambdaQuery ( BmsDeclarationRecords . class ) . in ( BmsDeclarationRecords : : getEnterpriseId , enterpriseIdList ) . eq ( BmsDeclarationRecords : : getStatus , 4 ) ) ;
if ( CollectionUtil . isNotEmpty ( recordsList ) ) {
// 根据条件对比获取记录id
// 记录id集合
List < Long > declarationIdList = new ArrayList < > ( ) ;
for ( BmsDeclarationRecords records : recordsList ) {
for ( MunicipalReviewInfoDto dto : list ) {
if ( records . getEnterpriseId ( ) . equals ( dto . getEnterpriseId ( ) ) & & records . getYear ( ) . equals ( dto . getYear ( ) ) & & records . getProjectName ( ) . contains ( dto . getDeclarationTypeStr ( ) ) ) {
records . setStatus ( dto . getStatus ( ) ) ;
dto . setDeclarationId ( records . getId ( ) ) ;
declarationIdList . add ( records . getId ( ) ) ;
reviewrecordsList . add ( records ) ;
}
}
}
if ( CollectionUtil . isNotEmpty ( reviewrecordsList ) ) {
Map < Long , MunicipalReviewInfoDto > reviewInfoMap = list . stream ( ) . collect ( Collectors . toMap ( MunicipalReviewInfoDto : : getDeclarationId , Function . identity ( ) ) ) ;
// 查询审批记录并更新
List < BmsApprovalInfo > approvalInfoList = iBmsApprovalInfoService . lambdaQuery ( ) . in ( BmsApprovalInfo : : getDeclarationRecordsId , declarationIdList ) . eq ( BmsApprovalInfo : : getProcessId , 4 ) . eq ( BmsApprovalInfo : : getApprovalStatus , 0 ) . list ( ) ;
// 需要更新的审批数据的id
List < Long > recordsIdList = new ArrayList < > ( ) ;
approvalInfoList . forEach ( x - > {
if ( reviewInfoMap . containsKey ( x . getDeclarationRecordsId ( ) ) ) {
MunicipalReviewInfoDto reviewInfoDto = reviewInfoMap . get ( x . getDeclarationRecordsId ( ) ) ;
if ( reviewInfoDto . getStatus ( ) = = 5 ) {
x . setApprovalStatus ( 1 ) ;
} else {
recordsIdList . add ( x . getDeclarationRecordsId ( ) ) ;
x . setApprovalStatus ( 2 ) ;
x . setIsBeforeData ( 1 ) ;
}
x . setApprovalOpinions ( reviewInfoDto . getResult ( ) ) ;
x . setApprovalById ( SecurityContextHolder . getUserId ( ) ) ;
x . setApprovalTime ( DateUtils . getNowDate ( ) ) ;
}
} ) ;
if ( CollectionUtil . isNotEmpty ( recordsIdList ) ) {
iBmsApprovalInfoService . updateApprovalList ( recordsIdList ) ;
}
// 批量保存记录
boolean b = this . saveOrUpdateBatch ( reviewrecordsList ) ;
// 审查审批记录
iBmsApprovalInfoService . saveOrUpdateBatch ( approvalInfoList ) ;
}
}
return reviewrecordsList . size ( ) ;
}
/ * *
* 市 局 审 批
*
* @param municipalReviewDto
* @return { @link int }
* @author emiya . xie
* @create 2023 / 9 / 17 13 : 59
* /
@Override
public int municipalReviewNew ( MunicipalReviewDto municipalReviewDto ) {
List < BmsMunicipalBureauReviewQueryDto > reviewList = municipalReviewDto . getReviewList ( ) ;
// 需要更新的申报记录
List < BmsDeclarationRecords > recordsUpdate = new ArrayList < > ( ) ;
if ( CollectionUtil . isNotEmpty ( reviewList ) ) {
//TODO
// 1、根据导入的申报记录id获取对应数据
// 2、修改申报记录状态,
// 3、更新申报记录对应的审核记录( 如果是拒绝, 还要修改审核记录的isBeforeData数据状态)
List < Long > ids = reviewList . stream ( ) . map ( BmsMunicipalBureauReviewQueryDto : : getId ) . collect ( Collectors . toList ( ) ) ;
// 查询到的申报记录
List < BmsDeclarationRecords > records = baseMapper . selectList ( Wrappers . lambdaQuery ( BmsDeclarationRecords . class ) . in ( BmsDeclarationRecords : : getId , ids ) . eq ( BmsDeclarationRecords : : getStatus , 4 ) ) ;
// key : 记录id,形成map
Map < Long , BmsDeclarationRecords > recordsMap = records . stream ( ) . collect ( Collectors . toMap ( BmsDeclarationRecords : : getId , Function . identity ( ) ) ) ;
// 查询审批记录并更新
List < BmsApprovalInfo > approvalInfoList = iBmsApprovalInfoService . lambdaQuery ( ) . in ( BmsApprovalInfo : : getDeclarationRecordsId , ids ) . eq ( BmsApprovalInfo : : getProcessId , 4 ) . eq ( BmsApprovalInfo : : getApprovalStatus , 0 ) . list ( ) ;
Map < Long , BmsApprovalInfo > approvalMap = approvalInfoList . stream ( ) . collect ( Collectors . toMap ( BmsApprovalInfo : : getDeclarationRecordsId , Function . identity ( ) ) ) ;
// 需要更新的审批记录
List < BmsApprovalInfo > approvalInfoUpdate = new ArrayList < > ( ) ;
// 需要更新的审批数据的id
List < Long > recordsIdList = new ArrayList < > ( ) ;
reviewList . forEach ( x - > {
if ( recordsMap . containsKey ( x . getId ( ) ) ) {
BmsDeclarationRecords bmsDeclarationRecords = recordsMap . get ( x . getId ( ) ) ;
if ( x . getResult ( ) = = 0 ) {
bmsDeclarationRecords . setStatus ( 5L ) ;
} else {
bmsDeclarationRecords . setStatus ( 9L ) ;
}
recordsUpdate . add ( bmsDeclarationRecords ) ;
}
if ( approvalMap . containsKey ( x . getId ( ) ) ) {
BmsApprovalInfo bmsApprovalInfo = approvalMap . get ( x . getId ( ) ) ;
if ( x . getResult ( ) = = 0 ) {
bmsApprovalInfo . setApprovalStatus ( 1 ) ;
} else {
bmsApprovalInfo . setApprovalStatus ( 2 ) ;
recordsIdList . add ( x . getId ( ) ) ;
}
bmsApprovalInfo . setApprovalOpinions ( x . getOpinion ( ) ) ;
bmsApprovalInfo . setApprovalTime ( DateUtils . getNowDate ( ) ) ;
approvalInfoUpdate . add ( bmsApprovalInfo ) ;
}
} ) ;
if ( CollectionUtil . isNotEmpty ( recordsIdList ) ) {
iBmsApprovalInfoService . updateApprovalList ( recordsIdList ) ;
}
for ( BmsDeclarationRecords a1 : recordsUpdate ) {
JProject jp = new JProject ( ) ;
jp . setId ( a1 . getJjhProjectId ( ) ) ;
jp . setStatus ( Math . toIntExact ( a1 . getStatus ( ) ) ) ;
jProjectService . updateById ( jp ) ;
}
// 批量保存记录
this . saveOrUpdateBatch ( recordsUpdate ) ;
// 审查审批记录
iBmsApprovalInfoService . saveOrUpdateBatch ( approvalInfoUpdate ) ;
}
return recordsUpdate . size ( ) ;
}
/ * *
* 批 量 删 除 在 线 申 报 记 录
@ -647,80 +357,37 @@ public class BmsDeclarationRecordsServiceImpl extends ServiceImpl<BmsDeclaration
}
/ * *
* 根 据 id 集 合 压 缩 所 有 文 件 使 用 类
* /
public String getAllFile ( Long args , Long id ) {
if ( args = = 1 ) {
BmsProjectSettlementAward lh = bmsProjectSettlementAwardService . getById ( id ) ;
return lh . getAgreement ( ) + "," +
lh . getReport ( ) + "," +
lh . getBusinessLicense ( ) + "," +
lh . getOtherMaterials ( ) ;
} else if ( args = = 2 ) {
BmsBigStrongAward zdzq = bmsBigStrongAwardService . getById ( id ) ;
return zdzq . getDevelopmentPlan ( ) ;
} else if ( args = = 3 ) {
BmsCarrierConstructionAward ztjs = bmsCarrierConstructionAwardService . getById ( id ) ;
return ztjs . getSupportingMaterials ( ) + "," +
ztjs . getBusinessLicense ( ) + "," +
ztjs . getFireReport ( ) ;
} else if ( args = = 4 ) {
BmsPlatformConstructionAward ptjs = bmsPlatformConstructionAwardService . getById ( id ) ;
return ptjs . getAgreement ( ) ;
} else if ( args = = 5 ) {
BmsBrandingAward ppdz = bmsBrandingAwardService . getById ( id ) ;
return ppdz . getEvidence ( ) ;
} else if ( args = = 6 ) {
BmsSceneOpeningAward cjkf = bmsSceneOpeningAwardService . getById ( id ) ;
return cjkf . getMaterial ( ) ;
} else if ( args = = 7 ) {
BmsCreditManagement xygl = bmsCreditManagementService . getById ( id ) ;
return xygl . getProjectPlan ( ) + "," + xygl . getUsesFunds ( ) + "," + xygl . getAuditReport ( ) ;
} else if ( args = = 8 ) {
BmsIndustrialInternetAward g5 = bmsIndustrialInternetAwardService . getById ( id ) ;
return g5 . getMaterial ( ) ;
} else if ( args = = 9 ) {
BmsManufacturingServicesAward zzfw = bmsManufacturingServicesAwardService . getById ( id ) ;
return zzfw . getFilingNotice ( ) + "," + zzfw . getInvoice ( ) + "," + zzfw . getAuditReport ( ) + "," + zzfw . getFinancialStatements ( ) ;
} else if ( args = = 10 ) {
BmsLogisticsDevelopmentAward wl = bmsLogisticsDevelopmentAwardService . getById ( id ) ;
return wl . getFilingNotice ( ) + "," + wl . getHonorCertificate ( ) + "," + wl . getAuditReport ( ) + "," + wl . getPlatformName ( ) ;
} else if ( args = = 11 ) {
BmsIntegrationIndustries ly = bmsIntegrationIndustriesService . getById ( id ) ;
return ly . getEvidence ( ) + "," +
ly . getBusinessLicense ( ) + "," +
ly . getTaxPaymentCertificate ( ) + "," +
ly . getAuditReport ( ) + "," +
ly . getEquityStructureChart ( ) + "," +
ly . getDeclarationReport ( ) + "," +
ly . getIndependentAccounting ( ) + "," +
ly . getCapitalVerificationReport ( ) + "," +
ly . getOtherEvidence ( ) ;
} else if ( args = = 12 ) {
BmsOutQuitProducts ly = iBmsOutQuitProductsService . getById ( id ) ;
return ly . getSpecifics ( ) + "," +
ly . getOtherSpecifics ( ) + "," ;
} else {
return null ;
public List < String > getAllFile ( String a ) {
JSONArray js1 = JSONObject . parse ( a ) . getJSONArray ( "fields" ) ;
List < String > strList = new ArrayList < > ( ) ;
for ( Object o : js1 ) {
JSONObject parse = JSONObject . parse ( o . toString ( ) ) ;
if ( "el-upload" . equals ( parse . get ( "tag" ) ) ) {
String [ ] split = parse . get ( "defaultValue" ) . toString ( ) . split ( "," ) ;
strList . addAll ( Arrays . asList ( split ) ) ;
}
}
return strList ;
}
/ * *
* 根 据 企 业 id 和 模 板 id 查 询
*
* @return
* /
@Override
public List < BmsDeclarationRecords > selectET ( Long templateId , List < String > list ) {
return baseMapper . selectET ( templateId , list ) ;
return baseMapper . selectET ( templateId , list ) ;
}
/ * *
* 申 报 模 板 不 限 时 并 且 未 填 报 的
*
* @return
* /
@Override
@ -730,10 +397,13 @@ public class BmsDeclarationRecordsServiceImpl extends ServiceImpl<BmsDeclaration
/ * *
* 获 取 某 个 在 线 记 录 id 可 以 添 加 到 项 目 库 的 数 据
*
* @return
* /
@Override
public JProject getAddProject ( Long id ) {
return baseMapper . getAddProject ( id ) ;
}
}