@ -79,6 +79,7 @@ import java.math.RoundingMode;
import java.security.Principal ;
import java.time.LocalDate ;
import java.time.LocalDateTime ;
import java.time.LocalTime ;
import java.time.format.DateTimeFormatter ;
import java.util.* ;
import java.util.concurrent.CompletableFuture ;
@ -3046,21 +3047,20 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru
markersVOS . addAll ( sewageMarkers ) ;
List < Entrustment > entrustmentList1 = this . list ( new LambdaQueryWrapper < Entrustment > ( ) . eq ( Entrustment : : getClientOrgId , orgId )
. eq ( Entrustment : : getStatus , EntrustmentStatusConstants . ENTRUSTMENT_STATUS_CREATED . getStatus ( ) ) ) ;
markersVOS . add ( new MarkersVO ( "案件委托" , entrustmentList1 . size ( ) , "待提交" ) ) ;
// 获取该机构的委托
List < Entrustment > entrustList = this . list ( new LambdaQueryWrapper < Entrustment > ( ) . eq ( Entrustment : : getClientOrgId , orgId ) ) ;
// 根据状态进行分组
Map < Integer , List < Entrustment > > entrustGroupByStatusMap = entrustList . stream ( ) . collect ( Collectors . groupingBy ( Entrustment : : getStatus ) ) ;
List < Entrustment > entrustmentList2 = this . list ( new LambdaQueryWrapper < Entrustment > ( ) . eq ( Entrustment : : getClientOrgId , orgId )
. in ( Entrustment : : getStatus , EntrustmentStatusConstants . ENTRUSTMENT_STATUS_WAITING_DELIVER . getStatus ( ) , EntrustmentStatusConstants . ENTRUSTMENT_STATUS_WAITING_CONFIRM . getStatus ( ) ) ) ;
markersVOS . add ( new MarkersVO ( "案件委托" , entrustmentList2 . size ( ) , "待送检" ) ) ;
markersVOS . add ( new MarkersVO ( "案件委托" , entrustGroupByStatusMap . getOrDefault ( EntrustmentStatusConstants . ENTRUSTMENT_STATUS_CREATED . getStatus ( ) , Collections . EMPTY_LIST ) . size ( ) , "待提交" ) ) ;
List < Entrustment > entrustmentList3 = this . list ( new LambdaQueryWrapper < Entrustment > ( ) . eq ( Entrustment : : getClientOrgId , orgId )
. eq ( Entrustment : : getReturnOrNot , - 1 ) ) ;
markersVOS . add ( new MarkersVO ( "案件委托" , entrustmentList3 . size ( ) , "已退回 ") ) ;
int deliverCount = entrustGroupByStatusMap . getOrDefault ( EntrustmentStatusConstants . ENTRUSTMENT_STATUS_WAITING_DELIVER . getStatus ( ) , Collections . EMPTY_LIST ) . size ( )
+ entrustGroupByStatusMap . getOrDefault ( EntrustmentStatusConstants . ENTRUSTMENT_STATUS_WAITING_CONFIRM . getStatus ( ) , Collections . EMPTY_LIST ) . size ( ) ;
markersVOS . add ( new MarkersVO ( "案件委托" , deliverCount , "待送检 ") ) ;
List < Entrustment > entrustmentList4 = this . list ( new LambdaQueryWrapper < Entrustment > ( ) . eq ( Entrustment : : getClientOrgId , orgId )
. eq ( Entrustment : : getStatus , EntrustmentStatusConstants . ENTRUSTMENT_STATUS_COMPLETED . getStatus ( ) ) ) ;
markersVOS . add ( new MarkersVO ( "案件委托" , entrustmentList4 . size ( ) , "已完成" ) ) ;
markersVOS . add ( new MarkersVO ( "案件委托" , entrustList . stream ( ) . filter ( entrust - > entrust . getReturnOrNot ( ) ! = null & & entrust . getReturnOrNot ( ) . equals ( - 1 ) ) . collect ( Collectors . toList ( ) ) . size ( ) , "已退回" ) ) ;
markersVOS . add ( new MarkersVO ( "案件委托" , entrustGroupByStatusMap . getOrDefault ( EntrustmentStatusConstants . ENTRUSTMENT_STATUS_COMPLETED . getStatus ( ) , Collections . EMPTY_LIST ) . size ( ) , "已完成" ) ) ;
Integer entrustAlterApplyCount = ( int ) entrustAlterApplyService . count ( Wrappers . < EntrustAlterApply > lambdaQuery ( )
. eq ( EntrustAlterApply : : getStatus , EntrustAlterApplyStatus . APPLY_SUCCESS . getStatus ( ) )
@ -3229,29 +3229,11 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru
public List < MarkersVO > getMarkersForEntrustment ( ) {
List < MarkersVO > markersVOS = new ArrayList < > ( ) ;
Map < String , List < Entrustment > > entrustListMap = this . list ( ) . stream ( ) . collect ( Collectors . groupingBy ( entrust - > entrust . getDataSources ( ) + "_" + entrust . getStatus ( ) ) ) ;
List < Entrustment > entrustmentList1 = this . list ( new LambdaQueryWrapper < Entrustment > ( )
. eq ( Entrustment : : getDataSources , 0 )
. eq ( Entrustment : : getStatus , EntrustmentStatusConstants . ENTRUSTMENT_STATUS_WAITING_ACCEPT . getStatus ( ) ) ) ;
List < Entrustment > entrustmentList2 = this . list ( new LambdaQueryWrapper < Entrustment > ( )
. eq ( Entrustment : : getDataSources , 1 )
. eq ( Entrustment : : getStatus , EntrustmentStatusConstants . ENTRUSTMENT_STATUS_WAITING_ACCEPT . getStatus ( ) ) ) ;
List < Entrustment > entrustmentList3 = this . list ( new LambdaQueryWrapper < Entrustment > ( )
. eq ( Entrustment : : getDataSources , 0 )
. eq ( Entrustment : : getStatus , EntrustmentStatusConstants . ENTRUSTMENT_STATUS_ACCEPTED . getStatus ( ) ) ) ;
List < Entrustment > entrustmentList4 = this . list ( new LambdaQueryWrapper < Entrustment > ( )
. eq ( Entrustment : : getDataSources , 1 )
. eq ( Entrustment : : getStatus , EntrustmentStatusConstants . ENTRUSTMENT_STATUS_ACCEPTED . getStatus ( ) ) ) ;
List < Integer > integers1 = new ArrayList < > ( ) ;
List < Integer > integers2 = new ArrayList < > ( ) ;
integers1 . add ( 1 ) ;
integers1 . add ( 2 ) ;
integers2 . add ( 3 ) ;
integers2 . add ( 4 ) ;
// 使用常量定义状态集合,避免重复创建
final List < Integer > REVIEW_STATUS_GROUP1 = Arrays . asList ( 1 , 2 ) ;
final List < Integer > REVIEW_STATUS_GROUP2 = Arrays . asList ( 3 , 4 ) ;
// 创建一个污水系统的统计DTO 初始化统计数量为0
StatisticsDiffStatusJobDTO statisticsDiffStatusSewageJobDTO = new StatisticsDiffStatusJobDTO (
0 , 0 , 0 , 0 , 0 ) ;
@ -3262,29 +3244,58 @@ public class EntrustmentServiceImpl extends ServiceImpl<EntrustmentMapper, Entru
log . error ( "通过查询接口调用获取污水系统统计数据失败!失败原因:{}" , statisticsDiffStatusJobDTOR . getMsg ( ) ) ;
}
ArrayList < Integer > integers = new ArrayList < > ( ) ;
integers . add ( 2 ) ;
markersVOS . add ( new MarkersVO ( EntrustMarkConstants . CASE_ACCEPT , entrustmentList1 . size ( ) , String . format ( "待受理(%s)" , EntrustMarkConstants . PUBLIC_SECURITY_BUREAU ) ) ) ;
markersVOS . add ( new MarkersVO ( EntrustMarkConstants . CASE_ACCEPT , entrustmentList2 . size ( ) , "待受理 (大数据平台)" ) ) ;
markersVOS . add ( new MarkersVO ( EntrustMarkConstants . CASE_ACCEPT , entrustmentList3 . size ( ) , String . format ( "已受理 (%s)" , EntrustMarkConstants . PUBLIC_SECURITY_BUREAU ) ) ) ;
markersVOS . add ( new MarkersVO ( EntrustMarkConstants . CASE_ACCEPT , entrustmentList4 . size ( ) , "已受理 (大数据平台)" ) ) ;
markersVOS . add ( new MarkersVO ( EntrustMarkConstants . CASE_ACCEPT , entrustmentList3 . size ( ) , "检测结果" ) ) ;
markersVOS . add ( new MarkersVO ( EntrustMarkConstants . CASE_ACCEPT ,
entrustListMap . getOrDefault (
StrUtil . join ( "_" , EntrustMarkConstants . LOCAL_SYSTEM , EntrustmentStatusConstants . ENTRUSTMENT_STATUS_WAITING_ACCEPT . getStatus ( ) ) ,
Collections . EMPTY_LIST
) . size ( ) ,
String . format ( "待受理(%s)" , EntrustMarkConstants . PUBLIC_SECURITY_BUREAU ) ) ) ;
markersVOS . add ( new MarkersVO ( EntrustMarkConstants . CASE_ACCEPT ,
entrustListMap . getOrDefault (
StrUtil . join ( "_" , EntrustMarkConstants . THIRD_PARTY_SYSTEM , EntrustmentStatusConstants . ENTRUSTMENT_STATUS_WAITING_ACCEPT . getStatus ( ) ) ,
Collections . EMPTY_LIST
) . size ( ) ,
"待受理 (大数据平台)" ) ) ;
List < Entrustment > entrustListMapOrDefault = entrustListMap . getOrDefault (
StrUtil . join ( "_" , EntrustMarkConstants . LOCAL_SYSTEM , EntrustmentStatusConstants . ENTRUSTMENT_STATUS_ACCEPTED . getStatus ( ) ) , Collections . EMPTY_LIST
) ;
// o.getAcceptTime().isAfter(LocalDateTime.of(LocalDate.now().withDayOfYear(1), LocalTime.MIN)) 筛选出当年的数据
markersVOS . add ( new MarkersVO ( EntrustMarkConstants . CASE_ACCEPT ,
entrustListMapOrDefault . stream ( ) . filter ( o - > o . getAcceptTime ( ) . isAfter ( LocalDateTime . of ( LocalDate . now ( ) . withDayOfYear ( 1 ) , LocalTime . MIN ) ) ) . collect ( Collectors . toList ( ) ) . size ( ) ,
String . format ( "已受理 (%s)" , EntrustMarkConstants . PUBLIC_SECURITY_BUREAU ) ) ) ;
markersVOS . add ( new MarkersVO ( EntrustMarkConstants . CASE_ACCEPT ,
entrustListMap . getOrDefault (
StrUtil . join ( "_" , EntrustMarkConstants . THIRD_PARTY_SYSTEM , EntrustmentStatusConstants . ENTRUSTMENT_STATUS_ACCEPTED . getStatus ( ) ) , Collections . EMPTY_LIST
) . size ( ) ,
"已受理 (大数据平台)" ) ) ;
markersVOS . add ( new MarkersVO ( EntrustMarkConstants . CASE_ACCEPT ,
this . list ( Wrappers . < Entrustment > lambdaQuery ( ) . inSql ( Entrustment : : getId , "SELECT entrust_id FROM b_entrust_material_checkout_result" ) )
. stream ( )
. filter ( o - > o . getAcceptTime ( ) . isAfter ( LocalDateTime . of ( LocalDate . now ( ) . withDayOfYear ( 1 ) , LocalTime . MIN ) ) )
. collect ( Collectors . toList ( ) )
. size ( ) ,
"检测结果" )
) ;
markersVOS . add ( new MarkersVO ( EntrustMarkConstants . REVIEW_OR_APPROVAL ,
this . list ( new LambdaQueryWrapper < Entrustment > ( )
. in ( Entrustment : : getStatus , integers1 )
. eq ( Entrustment : : getDataSources , 0 ) ) . size ( ) , String . format ( "委托审核(%s)" , EntrustMarkConstants . PUBLIC_SECURITY_BUREAU ) ) ) ;
REVIEW_STATUS_GROUP1 . stream ( )
. mapToInt ( status - > entrustListMap . getOrDefault ( EntrustMarkConstants . LOCAL_SYSTEM + "_" + status , Collections . emptyList ( ) ) . size ( ) )
. sum ( ) ,
String . format ( "委托审核(%s)" , EntrustMarkConstants . PUBLIC_SECURITY_BUREAU ) ) ) ;
markersVOS . add ( new MarkersVO ( EntrustMarkConstants . REVIEW_OR_APPROVAL ,
this . list ( new LambdaQueryWrapper < Entrustment > ( )
. in ( Entrustment : : getStatus , integers2 )
. eq ( Entrustment : : getDataSources , 0 ) ) . size ( ) , String . format ( "委托审批(%s)" , EntrustMarkConstants . PUBLIC_SECURITY_BUREAU ) ) ) ;
REVIEW_STATUS_GROUP2 . stream ( )
. mapToInt ( status - > entrustListMap . getOrDefault ( EntrustMarkConstants . LOCAL_SYSTEM + "_" + status , Collections . emptyList ( ) ) . size ( ) )
. sum ( ) ,
String . format ( "委托审批(%s)" , EntrustMarkConstants . PUBLIC_SECURITY_BUREAU ) ) ) ;
markersVOS . add ( new MarkersVO ( EntrustMarkConstants . REVIEW_OR_APPROVAL ,
this . list ( new LambdaQueryWrapper < Entrustment > ( )
. in ( Entrustment : : getStatus , integers1 )
. eq ( Entrustment : : getDataSources , 1 ) ) . size ( ) , "委托审核(大数据平台)" ) ) ;
REVIEW_STATUS_GROUP1 . stream ( )
. mapToInt ( status - > entrustListMap . getOrDefault ( EntrustMarkConstants . THIRD_PARTY_SYSTEM + "_" + status , Collections . emptyList ( ) ) . size ( ) )
. sum ( ) ,
"委托审核(大数据平台)" ) ) ;
markersVOS . add ( new MarkersVO ( EntrustMarkConstants . REVIEW_OR_APPROVAL ,
this . list ( new LambdaQueryWrapper < Entrustment > ( )
. in ( Entrustment : : getStatus , integers2 )
. eq ( Entrustment : : getDataSources , 1 ) ) . size ( ) , "委托审批(大数据平台)" ) ) ;
REVIEW_STATUS_GROUP2 . stream ( )
. mapToInt ( status - > entrustListMap . getOrDefault ( EntrustMarkConstants . LOCAL_SYSTEM + "_" + status , Collections . emptyList ( ) ) . size ( ) )
. sum ( ) ,
"委托审批(大数据平台)" ) ) ;
markersVOS . add ( new MarkersVO ( EntrustMarkConstants . REVIEW_OR_APPROVAL ,
( int ) entrustAlterApplyService . count ( Wrappers . < EntrustAlterApply > lambdaQuery ( )
. eq ( EntrustAlterApply : : getStatus , EntrustAlterApplyStatus . SUBMITTED_WAIT_APPROVE . getStatus ( ) ) ) ,