@ -70,7 +70,35 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
if ( Objects . nonNull ( param . getCreateTime ( ) ) & & param . getCreateTime ( ) . size ( ) = = 2 ) {
queryWrapper . between ( "mc.create_time" , param . getCreateTime ( ) . get ( 0 ) , param . getCreateTime ( ) . get ( 1 ) ) ;
}
return baseMapper . queryPage ( Page . of ( param . getCurrent ( ) , param . getSize ( ) ) , queryWrapper ) ;
Page < ModelClueModel > modelClueModelPage = baseMapper . queryPage ( Page . of ( param . getCurrent ( ) , param . getSize ( ) ) , queryWrapper ) ;
genaratePolice ( modelClueModelPage ) ;
return modelClueModelPage ;
}
private static void genaratePolice ( Page < ModelClueModel > modelClueModelPage ) {
if ( ! modelClueModelPage . getRecords ( ) . isEmpty ( ) ) {
List < ModelClueModel > records = modelClueModelPage . getRecords ( ) ;
for ( ModelClueModel record : records ) {
if ( record . getInvolvePoliceName ( ) ! = null ) {
StringBuilder result = new StringBuilder ( ) ;
String [ ] names = record . getInvolvePoliceName ( ) . split ( "," ) ;
String [ ] empNos = record . getInvolvePoliceEmpNo ( ) ! = null ? record . getInvolvePoliceEmpNo ( ) . split ( "," ) : new String [ 0 ] ;
int maxLen = Math . max ( names . length , empNos . length ) ;
for ( int i = 0 ; i < maxLen ; i + + ) {
if ( i > 0 ) {
result . append ( " " ) ;
}
if ( i < names . length ) {
result . append ( names [ i ] ) ;
}
if ( i < empNos . length ) {
result . append ( empNos [ i ] ) ;
}
}
record . setInvolvePoliceName ( result . toString ( ) ) ;
}
}
}
}
public List < ModelClue > listByUnDistributed ( Integer modelId ) {
@ -198,10 +226,10 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
System . out . println ( "模型" + modelId + "查询数据库完毕,数量为:" + modelClues . size ( ) ) ;
}
List < String > uniqueKeys = modelClues . stream ( ) . map ( ModelClue : : getUniqueKey ) . filter ( k - > k ! = null & & ! k . isEmpty ( ) ) . toList ( ) ;
List < String > oldUniqueKeys = this . listObjs ( new LambdaQueryWrapper < ModelClue > ( ) . select ( ModelClue : : getUniqueKey ) . eq ( ModelClue : : getStatus , 0 ) . eq ( ModelClue : : getModelId , modelId ) , String : : valueOf ) ;
List < String > oldUniqueKeys = this . listObjs ( new LambdaQueryWrapper < ModelClue > ( ) . select ( ModelClue : : getUniqueKey ) . n e( ModelClue : : getDistributionState , "2" ) . eq ( ModelClue : : getModelId , modelId ) , String : : valueOf ) ;
List < String > changeStatusIds = oldUniqueKeys . stream ( ) . filter ( item - > ! uniqueKeys . contains ( item ) ) . toList ( ) ;
if ( ! changeStatusIds . isEmpty ( ) ) {
modelClueMapper . update ( null , new LambdaUpdateWrapper < ModelClue > ( ) . in ( ModelClue : : getUniqueKey , changeStatusIds ) . set ( ModelClue : : getStatus , 1 ) ) ;
modelClueMapper . update ( null , new LambdaUpdateWrapper < ModelClue > ( ) . in ( ModelClue : : getUniqueKey , changeStatusIds ) . set ( ModelClue : : getDistributionState , "2" ) ) ;
}
List < String > needsInsertIds = uniqueKeys . stream ( ) . filter ( item - > ! oldUniqueKeys . contains ( item ) ) . toList ( ) ;
if ( needsInsertIds . isEmpty ( ) ) {
@ -216,7 +244,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
String keyColumn = ( String ) data . get ( originalFieldName ) ;
if ( Objects . equals ( keyColumn , modelClue . getUniqueKey ( ) ) ) {
modelClue . setData ( JSONObject . toJSONString ( data ) ) ;
modelClue . setStatus ( 0 ) ;
modelClue . setDistributionState ( "0" ) ;
SupExternalDepart supExternalDepart = supExternalDepartMapper . selectOne ( new LambdaQueryWrapper < SupExternalDepart > ( ) . eq ( SupExternalDepart : : getExternalId , modelClue . getInvolveDepartId ( ) ) . last ( "LIMIT 1" ) ) ;
if ( supExternalDepart ! = null & & supExternalDepart . getInternalShortName ( ) ! = null & & ! supExternalDepart . getInternalShortName ( ) . isEmpty ( ) ) {
modelClue . setInvolveDepartName ( supExternalDepart . getInternalShortName ( ) ) ;
@ -238,7 +266,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
String involvePoliceName = ( bar1 ! = null & & ! bar1 . isEmpty ( ) & & bar2 ! = null & & ! bar2 . isEmpty ( ) )
? bar1 + "," + bar2
: ( bar1 ! = null & & ! bar1 . isEmpty ( ) ) ? bar1
: ( bar2 ! = null & & ! bar2 . isEmpty ( ) ) ? bar2 : "无数据" ;
: ( bar2 ! = null & & ! bar2 . isEmpty ( ) ) ? bar2 : "无警号 数据" ;
modelClue . setInvolvePoliceName ( involvePoliceName ) ;
String bar1jh = ( String ) data . get ( "bar1jh" ) ;
String bar2jh = ( String ) data . get ( "bar2jh" ) ;
@ -251,7 +279,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
} else if ( bar2jh ! = null & & ! bar2jh . isEmpty ( ) ) {
modelClue . setInvolvePoliceEmpNo ( bar2jh ) ;
} else {
modelClue . setInvolvePoliceEmpNo ( "无数据" ) ;
modelClue . setInvolvePoliceEmpNo ( "无警号 数据" ) ;
}
}
if ( modelId = = 10 | | modelId = = 11 | | modelId = = 12 | | modelId = = 13 | | modelId = = 14 | | modelId = = 15 ) { // 案件基本信息表
@ -269,8 +297,8 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
modelClue . setInvolvePoliceEmpNo ( ( String ) bar2 . get ( "JH" ) ) ;
modelClue . setInvolvePoliceName ( ( String ) bar2 . get ( "XM" ) ) ;
} else {
modelClue . setInvolvePoliceEmpNo ( "无数据" ) ;
modelClue . setInvolvePoliceName ( "无数据" ) ;
modelClue . setInvolvePoliceEmpNo ( "无警号 数据" ) ;
modelClue . setInvolvePoliceName ( "无姓名 数据" ) ;
}
}
}
@ -287,34 +315,39 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
+ "日仍未受理。" + thingDesc ) ;
} else if ( modelId = = 3 ) { // 3号模型:执法办案场所登记时长超时问题监督模型
if ( data . get ( "lksj" ) ! = null & & ! data . get ( "lksj" ) . equals ( "" ) ) {
modelClue . setThingDesc ( "姓名 " + data . get ( "xm" )
+ ", 身份证号" + data . get ( "zjhm" )
+ ",于" + formatStringDate ( ( String ) data . get ( "djsj" ) )
modelClue . setThingDesc ( "发现执法场所人员“ " + data . get ( "xm" )
+ "”( 身份证号" + data . get ( "zjhm" )
+ ") ,于" + getDateMinuteString ( data . get ( "djsj" ) )
+ "登记进入" + modelClue . getInvolveDepartName ( )
+ ",离开时间为" + formatStringDate ( ( String ) data . get ( "lksj" ) )
+ ",超过了48小时。" ) ;
+ "执法办案区,但直至" + getDateMinuteString ( data . get ( "lksj" ) )
+ "才登记离开,停留时长" + calculateMinutesBetween ( data . get ( "djsj" ) , data . get ( "lksj" ) )
+ ",用时超过了48小时以上,存在人员进入执法办案场所超时的问题。" ) ;
} else {
modelClue . setThingDesc ( "姓名 " + data . get ( "xm" )
+ ", 身份证号" + data . get ( "zjhm" )
+ ",于" + formatStringDate ( ( String ) data . get ( "djsj" ) )
modelClue . setThingDesc ( "发现执法场所人员“ " + data . get ( "xm" )
+ "”( 身份证号" + data . get ( "zjhm" )
+ ") ,于" + getDateMinuteString ( data . get ( "djsj" ) )
+ "登记进入" + modelClue . getInvolveDepartName ( )
+ ",没有离开时间。" ) ;
+ "执法办案区 ,但 没有离开时间,用时超过了48小时以上,存在人员进入执法办案场所超时的问题 。" ) ;
}
} else if ( modelId = = 10 ) { // 10号模型:案件受理不及时的异常数据
String calculateDays = calculateDaysBetween ( data . get ( "BARQ" ) , data . get ( "SLRQ" ) ) ;
if ( calculateDays ! = null ) {
String calculateMinutes = calculateMinutesBetween ( data . get ( "BARQ" ) , data . get ( "SLRQ" ) ) ;
if ( calculateDays ! = null & & ! calculateMinutes . equals ( " 无时间数据 " ) ) {
modelClue . setThingDesc (
"发现编号为" + getAjbh ( data )
+ "的" + data . get ( "AJBZmc" ) + "案件,报案日期为" + getDateMinuteString ( data . get ( "BARQ" ) )
+ ",但受理日期为" + getDateMinuteString ( data . get ( "SLRQ" ) )
+ ",受理时间超过了报案日期" + calculateDaysBetween ( data . get ( "BARQ" ) , data . get ( "SLRQ" ) )
+ "日,当前案件状态为“" + data . get ( "AJZTmc" ) + "”,存在案件受理不及时的问题。" ) ;
"发现" + modelClue . getInvolveDepartName ( ) + "受理的“" + data . get ( "AJMC" )
+ "”(【" + data . get ( "AJBZmc" ) + "】编号:" + getAjbh ( data )
+ "),报案日期为" + getDateMinuteString ( data . get ( "BARQ" ) )
+ ",但办案单位的受理日期为" + getDateMinuteString ( data . get ( "SLRQ" ) )
+ ",共用时" + calculateMinutes
+ ",案件受理时间超过" + calculateDays
+ "日以上,存在案件受理不及时的问题,目前案件状态为“" + data . get ( "AJZTmc" ) + "”。" ) ;
} else {
modelClue . setThingDesc (
"发现编号为" + getAjbh ( data )
+ "的" + data . get ( "AJBZmc" ) + "案件,报案日期为" + getDateMinuteString ( data . get ( "BARQ" ) )
+ ",但受理日期为" + getDateMinuteString ( data . get ( "SLRQ" ) )
+ ",受理时间超过了报案日期,当前案件状态为“" + data . get ( "AJZTmc" ) + "”,存在案件受理不及时的问题。" ) ;
"发现" + modelClue . getInvolveDepartName ( ) + "受理的“" + data . get ( "AJMC" )
+ "”(【" + data . get ( "AJBZmc" ) + "】编号:" + getAjbh ( data )
+ "),报案日期为" + getDateMinuteString ( data . get ( "BARQ" ) )
+ ",但办案单位的受理日期" + getDateMinuteString ( data . get ( "SLRQ" ) )
+ ",存在案件受理不及时的问题,目前案件状态为“" + data . get ( "AJZTmc" ) + "”。" ) ;
}
} else if ( modelId = = 11 ) { // 11号模型:立案不及时的异常数据(7天)
modelClue . setThingDesc ( "该" + data . get ( "AJBZmc" )
@ -348,10 +381,11 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
+ ",当前案件状态为“" + data . get ( "AJZTmc" )
+ "”,立案不及时。" ) ;
} else if ( modelId = = 15 ) { // 15号模型:未录入受害人员的异常数据
modelClue . setThingDesc ( "该" + data . get ( "AJBZmc" )
+ "案件编号为" + getAjbh ( data )
+ ",受理日期为" + getDateMinuteString ( data . get ( "SLRQ" ) )
+ ",没有录入受害人。" ) ;
modelClue . setThingDesc (
"发现" + modelClue . getInvolveDepartName ( ) + "受理的“" + data . get ( "AJMC" )
+ "”(【" + data . get ( "AJBZmc" ) + "】编号:" + getAjbh ( data )
+ "),其案件定性为“" + data . get ( "AJLBmc" )
+ "”,应至少有一名受害人,但办案单位没有录入,存在未录入受害人员的异常情况。" ) ;
}
}
@ -421,7 +455,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
}
for ( ModelClue jjdModelClue : jjdModelClues3 ) {
if ( zfqymModelClues3 . isEmpty ( ) ) {
jjdModelClue . setStatus ( 0 ) ;
jjdModelClue . setDistributionState ( "0" ) ;
jjdModelClue . setThingDesc ( "在" + params . get ( 0 ) + "到" + params . get ( 1 ) + "之间," + jjdModelClue . getInvolveDepartName ( )
+ "的总警情数为" + jjdModelClue . getZjjs ( )
+ ",执法场所登记数为0"
@ -439,7 +473,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
BigDecimal zjjs = BigDecimal . valueOf ( jjdModelClue . getZjjs ( ) ) ;
BigDecimal bl = zfcsdjs . divide ( zjjs , 2 , RoundingMode . HALF_UP ) ;
jjdModelClue . setBl ( bl ) ;
jjdModelClue . setStatus ( 0 ) ;
jjdModelClue . setDistributionState ( "0" ) ;
jjdModelClue . setThingDesc ( "在" + params . get ( 0 ) + "到" + params . get ( 1 ) + "之间," + jjdModelClue . getInvolveDepartName ( )
+ "的总警情数为" + jjdModelClue . getZjjs ( )
+ ",执法场所登记数为" + jjdModelClue . getZfcsdjs ( )
@ -452,7 +486,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
}
}
if ( ! found ) {
jjdModelClue . setStatus ( 0 ) ;
jjdModelClue . setDistributionState ( "0" ) ;
jjdModelClue . setThingDesc ( "在" + params . get ( 0 ) + "到" + params . get ( 1 ) + "之间," + jjdModelClue . getInvolveDepartName ( )
+ "的总警情数为" + jjdModelClue . getZjjs ( )
+ ",执法场所登记数为0"
@ -479,19 +513,19 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
if ( sfzhMap . isEmpty ( ) ) {
return ;
}
String selectSfzh2 = "SELECT a.zj AS uniqueKey, a.sfzh AS negative_id, a.badwid AS involve_depart_id, a.badwmc AS involve_depart_name, a.bar1xm, a.bar2xm, a.bar1id, a.bar2id, a.sfzh, a.xm FROM dwd_wp_zfba_qbhsjds a INNER JOIN (SELECT sfzh, MAX(STR_TO_DATE(pzrq, '%Y%m%d%H%i%s')) AS max_create_time FROM dwd_wp_zfba_qbhsjds WHERE STR_TO_DATE(pzrq, '%Y%m%d%H%i%s') BETWEEN '" + params . get ( 0 ) + " 00:00:00' AND '" + params . get ( 1 ) + " 00:00:00' GROUP BY sfzh) b ON a.sfzh = b.sfzh AND STR_TO_DATE(a.pzrq, '%Y%m%d%H%i%s') = b.max_create_time;" ;
String selectSfzh2 = "SELECT a.zj AS uniqueKey, a.sfzh AS negative_id_ex , a.badwid AS involve_depart_id, a.badwmc AS involve_depart_name, a.bar1xm, a.bar2xm, a.bar1id, a.bar2id, a.sfzh, a.xm FROM dwd_wp_zfba_qbhsjds a INNER JOIN (SELECT sfzh, MAX(STR_TO_DATE(pzrq, '%Y%m%d%H%i%s')) AS max_create_time FROM dwd_wp_zfba_qbhsjds WHERE STR_TO_DATE(pzrq, '%Y%m%d%H%i%s') BETWEEN '" + params . get ( 0 ) + " 00:00:00' AND '" + params . get ( 1 ) + " 00:00:00' GROUP BY sfzh) b ON a.sfzh = b.sfzh AND STR_TO_DATE(a.pzrq, '%Y%m%d%H%i%s') = b.max_create_time;" ;
List < Map < String , Object > > newModelClues = modelClueDataMapper . selectByUniqueKeys ( selectSfzh2 ) ;
for ( Map < String , Object > modelClue : newModelClues ) {
if ( ! sfzhMap . containsKey ( ( String ) modelClue . get ( "sfzh" ) ) ) {
continue ;
}
Long count = baseMapper . selectCount ( new LambdaQueryWrapper < ModelClue > ( ) . eq ( ModelClue : : getNegativeId , modelClue . get ( "sfzh" ) ) ) ;
Long count = baseMapper . selectCount ( new LambdaQueryWrapper < ModelClue > ( ) . eq ( ModelClue : : getNegativeIdEx , modelClue . get ( "sfzh" ) ) ) ;
if ( count > 0 ) {
continue ;
}
ModelClue newModelClue = new ModelClue ( ) ;
newModelClue . setUniqueKey ( ( String ) modelClue . get ( "uniqueKey" ) ) ;
newModelClue . setNegativeId ( ( String ) modelClue . get ( "negative_id" ) ) ;
newModelClue . setNegativeIdEx ( ( String ) modelClue . get ( "negative_id_ex " ) ) ;
if ( modelClue . get ( "involve_depart_id" ) ! = null ) {
SupExternalDepart supExternalDepart = supExternalDepartMapper . selectOne ( new LambdaQueryWrapper < SupExternalDepart > ( ) . eq ( SupExternalDepart : : getExternalId , modelClue . get ( "involve_depart_id" ) ) . last ( "LIMIT 1" ) ) ;
if ( supExternalDepart ! = null ) {
@ -510,7 +544,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
} else if ( modelClue . get ( "bar2xm" ) ! = null ) {
newModelClue . setInvolvePoliceName ( ( String ) modelClue . get ( "bar2xm" ) ) ;
} else {
newModelClue . setInvolvePoliceName ( "无数据" ) ;
newModelClue . setInvolvePoliceName ( "无姓名 数据" ) ;
}
Map < String , Object > bar1 = modelClueDataMapper . selectBAR ( ( String ) modelClue . get ( "bar1id" ) ) ;
Map < String , Object > bar2 = modelClueDataMapper . selectBAR ( ( String ) modelClue . get ( "bar2id" ) ) ;
@ -523,14 +557,16 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
} else if ( jh2 ! = null ) {
newModelClue . setInvolvePoliceEmpNo ( jh2 ) ;
} else {
newModelClue . setInvolvePoliceEmpNo ( "无数据" ) ;
newModelClue . setInvolvePoliceEmpNo ( "无警号 数据" ) ;
}
newModelClue . setData ( JSONObject . toJSONString ( modelClue ) ) ;
newModelClue . setStatus ( 0 ) ;
newModelClue . setThingDesc ( "在" + getDateString ( params . get ( 0 ) ) + "到" + getDateString ( params . get ( 1 ) ) + "之间,"
+ modelClue . get ( "xm" )
+ "(身份证号:" + modelClue . get ( "sfzh" ) + ")的取保次数为"
+ sfzhMap . get ( ( String ) modelClue . get ( "sfzh" ) ) + "次,大于2次,属于多次取保异常数据。" ) ;
newModelClue . setDistributionState ( "0" ) ;
newModelClue . setThingDesc (
"发现违法犯罪嫌疑人员" + modelClue . get ( "xm" ) + "(身份证号:" + modelClue . get ( "sfzh" )
+ "),在" + getDateString ( params . get ( 0 ) ) + "到" + getDateString ( params . get ( 1 ) ) + "之间,"
+ "被取保次数为" + sfzhMap . get ( ( String ) modelClue . get ( "sfzh" ) )
+ "次,属于多次取保异常情况,目前最新办案单位为" + newModelClue . getInvolveDepartName ( )
+ ",请予以重点关注。" ) ;
modelClues . add ( newModelClue ) ;
sfzhMap . remove ( ( String ) modelClue . get ( "sfzh" ) ) ;
}
@ -579,7 +615,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
private List < ModelClue > getModelCluesForModel2 ( String param , List < ModelClue > modelClues ) {
List < ModelClue > modelClues1 = new ArrayList < > ( ) ;
List < String > params = parseSqlForModel2 ( param ) ;
String preSql = "SELECT a.jjdbh AS uniqueKey, a.jjdbh AS negative_id, a.gxdwmc AS involve_depart_name, a.gxdwdm AS involve_depart_id FROM dwd_asj_zhtx_jjd a WHERE (a.jqxzdm LIKE '01%' OR a.jqxzdm LIKE '02%') AND a.bjnr LIKE '%" ;
String preSql = "SELECT a.jjdbh AS uniqueKey, a.jjdbh AS negative_id_ex , a.gxdwmc AS involve_depart_name, a.gxdwdm AS involve_depart_id FROM dwd_asj_zhtx_jjd a WHERE (a.jqxzdm LIKE '01%' OR a.jqxzdm LIKE '02%') AND a.bjnr LIKE '%" ;
String postSql = "%' AND NOT EXISTS (SELECT 1 FROM dwd_asj_sjjhygx_jjcjxxb b WHERE b.BARLXDH = a.bjdh) AND a.bjsj BETWEEN '" + params . get ( 0 ) + " 00:00:00' AND '" + params . get ( 1 ) + " 00:00:00';" ;
genarateModelCluesForModel2 ( preSql , postSql , modelClues1 ) ;
List < String > uniqueKeys = modelClues1 . stream ( ) . map ( ModelClue : : getUniqueKey ) . filter ( k - > k ! = null & & ! k . isEmpty ( ) ) . toList ( ) ;
@ -593,7 +629,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
String keyColumn = ( String ) data . get ( "jjdbh" ) ;
if ( Objects . equals ( keyColumn , modelClue . getUniqueKey ( ) ) ) {
modelClue . setData ( JSONObject . toJSONString ( data ) ) ;
modelClue . setStatus ( 0 ) ;
modelClue . setDistributionState ( "0" ) ;
String jqxz = "" ;
jqxz = summarizeAttribute ( data , jqxz ) ;
modelClue . setThingDesc ( "该" + jqxz
@ -607,7 +643,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
modelClues . addAll ( modelClues1 ) ;
}
List < ModelClue > modelClues2 = new ArrayList < > ( ) ;
String preSql2 = "SELECT a.jjdbh AS uniqueKey, a.jjdbh AS negative_id, a.gxdwmc AS involve_depart_name, a.gxdwdm AS involve_depart_id FROM dwd_asj_zhtx_jjd a WHERE (a.jqxzdm LIKE '01%' OR a.jqxzdm LIKE '02%') AND a.bjnr LIKE '%" ;
String preSql2 = "SELECT a.jjdbh AS uniqueKey, a.jjdbh AS negative_id_ex , a.gxdwmc AS involve_depart_name, a.gxdwdm AS involve_depart_id FROM dwd_asj_zhtx_jjd a WHERE (a.jqxzdm LIKE '01%' OR a.jqxzdm LIKE '02%') AND a.bjnr LIKE '%" ;
String postSql2 = "%' AND EXISTS (SELECT 1 FROM dwd_asj_sjjhygx_jjcjxxb b WHERE b.lasj IS NOT NULL AND b.basj < DATE_SUB(STR_TO_DATE(b.lasj, '%Y%m%d%H%i%s') , INTERVAL 7 DAY) AND b.BARLXDH = a.bjdh AND STR_TO_DATE(b.lasj, '%Y%m%d%H%i%s') > a.bjsj) AND a.bjsj BETWEEN '" + params . get ( 0 ) + " 00:00:00' AND '" + params . get ( 1 ) + " 00:00:00' ORDER BY a.bjsj desc LIMIT 1;" ;
genarateModelCluesForModel2 ( preSql2 , postSql2 , modelClues2 ) ;
List < String > uniqueKeys2 = modelClues2 . stream ( ) . map ( ModelClue : : getUniqueKey ) . filter ( k - > k ! = null & & ! k . isEmpty ( ) ) . toList ( ) ;
@ -619,7 +655,7 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
String keyColumn = ( String ) data . get ( "jjdbh" ) ;
if ( Objects . equals ( keyColumn , modelClue . getUniqueKey ( ) ) ) {
modelClue . setData ( JSONObject . toJSONString ( data ) ) ;
modelClue . setStatus ( 0 ) ;
modelClue . setDistributionState ( "0" ) ;
String jqxz = "" ;
jqxz = summarizeAttribute ( data , jqxz ) ;
modelClue . setThingDesc ( "该" + jqxz
@ -695,10 +731,21 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
DateTimeFormatter formatter = DateTimeFormatter . ofPattern ( "yyyy年MM月dd日HH时mm分" ) ;
return formatter . format ( localDateTime ) ;
} catch ( Exception ex ) {
try {
time = String . valueOf ( param ) ;
SimpleDateFormat sdf = new SimpleDateFormat ( "yyyyMMddHHmmss" ) ;
Date parse = sdf . parse ( time ) ;
Instant instant = parse . toInstant ( ) ;
ZoneId zoneId = ZoneId . systemDefault ( ) ;
LocalDateTime localDateTime = instant . atZone ( zoneId ) . toLocalDateTime ( ) ;
DateTimeFormatter formatter = DateTimeFormatter . ofPattern ( "yyyy年MM月dd日HH时mm分" ) ;
return formatter . format ( localDateTime ) ;
} catch ( Exception exx ) {
log . info ( "日期转换异常{}" , time , ex ) ;
}
}
}
}
return " 无时间数据 " ;
}
@ -732,6 +779,53 @@ public class ModelClueService extends ServiceImpl<ModelClueMapper, ModelClue> {
}
}
public static String calculateMinutesBetween ( Object param1 , Object param2 ) {
if ( param1 = = null | | param2 = = null ) {
return " 无时间数据 " ;
}
try {
SimpleDateFormat sdf = new SimpleDateFormat ( "yyyy-MM-dd'T'HH:mm:ss" ) ;
Date date1 = sdf . parse ( String . valueOf ( param1 ) ) ;
Date date2 = sdf . parse ( String . valueOf ( param2 ) ) ;
LocalDateTime dateTime1 = date1 . toInstant ( ) . atZone ( ZoneId . systemDefault ( ) ) . toLocalDateTime ( ) ;
LocalDateTime dateTime2 = date2 . toInstant ( ) . atZone ( ZoneId . systemDefault ( ) ) . toLocalDateTime ( ) ;
long totalMillis = ChronoUnit . MILLIS . between ( dateTime1 , dateTime2 ) ;
long days = totalMillis / ( 1000 * 60 * 60 * 24 ) ;
long hours = ( totalMillis % ( 1000 * 60 * 60 * 24 ) ) / ( 1000 * 60 * 60 ) ;
long minutes = ( totalMillis % ( 1000 * 60 * 60 ) ) / ( 1000 * 60 ) ;
return days + "天" + hours + "时" + minutes + "分" ;
} catch ( Exception e ) {
try {
SimpleDateFormat sdf = new SimpleDateFormat ( "yyyy-MM-dd HH:mm:ss.S" ) ;
Date date1 = sdf . parse ( String . valueOf ( param1 ) ) ;
Date date2 = sdf . parse ( String . valueOf ( param2 ) ) ;
LocalDateTime dateTime1 = date1 . toInstant ( ) . atZone ( ZoneId . systemDefault ( ) ) . toLocalDateTime ( ) ;
LocalDateTime dateTime2 = date2 . toInstant ( ) . atZone ( ZoneId . systemDefault ( ) ) . toLocalDateTime ( ) ;
long totalMillis = ChronoUnit . MILLIS . between ( dateTime1 , dateTime2 ) ;
long days = totalMillis / ( 1000 * 60 * 60 * 24 ) ;
long hours = ( totalMillis % ( 1000 * 60 * 60 * 24 ) ) / ( 1000 * 60 * 60 ) ;
long minutes = ( totalMillis % ( 1000 * 60 * 60 ) ) / ( 1000 * 60 ) ;
return days + "天" + hours + "时" + minutes + "分" ;
} catch ( Exception ex ) {
try {
SimpleDateFormat sdf = new SimpleDateFormat ( "yyyyMMddHHmmss" ) ;
Date date1 = sdf . parse ( String . valueOf ( param1 ) ) ;
Date date2 = sdf . parse ( String . valueOf ( param2 ) ) ;
LocalDateTime dateTime1 = date1 . toInstant ( ) . atZone ( ZoneId . systemDefault ( ) ) . toLocalDateTime ( ) ;
LocalDateTime dateTime2 = date2 . toInstant ( ) . atZone ( ZoneId . systemDefault ( ) ) . toLocalDateTime ( ) ;
long totalMillis = ChronoUnit . MILLIS . between ( dateTime1 , dateTime2 ) ;
long days = totalMillis / ( 1000 * 60 * 60 * 24 ) ;
long hours = ( totalMillis % ( 1000 * 60 * 60 * 24 ) ) / ( 1000 * 60 * 60 ) ;
long minutes = ( totalMillis % ( 1000 * 60 * 60 ) ) / ( 1000 * 60 ) ;
return days + "天" + hours + "时" + minutes + "分" ;
} catch ( Exception exx ) {
ex . printStackTrace ( ) ;
return " 无时间数据 " ;
}
}
}
}
public static String generateNewSql ( String originalSql , List < String > uniqueKeys ) {
Pattern tablePattern = Pattern . compile ( "FROM\\s+(\\w+)" , Pattern . CASE_INSENSITIVE ) ;
Matcher tableMatcher = tablePattern . matcher ( originalSql ) ;