@@ -1,6 +1,7 @@
package org.dromara.sis.service.impl ;
import cn.hutool.core.collection.CollUtil ;
import cn.hutool.core.date.DateUtil ;
import cn.hutool.core.lang.Assert ;
import cn.hutool.core.util.IdUtil ;
import org.apache.dubbo.config.annotation.DubboReference ;
@@ -35,6 +36,7 @@ import org.dromara.sis.mapper.SisAuthRecordMapper;
import org.dromara.sis.service.ISisAuthRecordService ;
import org.springframework.transaction.annotation.Transactional ;
import java.text.SimpleDateFormat ;
import java.util.* ;
/**
@@ -181,7 +183,7 @@ public class SisAuthRecordServiceImpl implements ISisAuthRecordService {
return pId ;
}
private Long syncE8Plat ( RemotePersonAuth bo , byte [ ] imgByte ) {
private Long syncE8Plat ( RemotePersonAuth bo , byte [ ] imgByte ) throws Exception {
log . info ( " e8平台上传照片 " ) ;
String e8ImgUrl = e8PlatformApi . uploadFace ( imgByte ) ;
@@ -206,8 +208,7 @@ public class SisAuthRecordServiceImpl implements ISisAuthRecordService {
voucherReq . setVoucherType ( 70 ) ;
voucherReq . setPersonID ( e8Id ) ;
voucherReq . setTxtData ( e8ImgUrl ) ;
voucherReq . setStartTime ( bo . getBegDate ( ) . toString ( ) ) ;
voucherReq . setEndTime ( bo . getEndDate ( ) . toString ( ) ) ;
voucherReq . setCardType ( 34 ) ;
Long voucherId = e8PlatformApi . issueVoucher ( voucherReq ) ;
Assert . notNull ( voucherId , " e8平台发行凭证失败 " ) ;
log . info ( " e8平台发行凭证成功 " ) ;
@@ -219,15 +220,16 @@ public class SisAuthRecordServiceImpl implements ISisAuthRecordService {
// 初始化赋值
CustomerAuthAddReq authReq = new CustomerAuthAddReq ( ) ;
authReq . setPersonIds ( List . of ( e8Id ) ) ;
authReq . setStartTime ( bo . getBegDate ( ) . toString ( ) ) ;
authReq . setEndTime ( bo . getEndDate ( ) . toString ( ) ) ;
authReq . setStartTime ( DateUtil . format ( bo. getBegDate ( ) , " yyyy-MM-dd HH:mm:ss " ) ) ;
authReq . setEndTime ( DateUtil . format ( bo. getEndDate ( ) , " yyyy-MM-dd HH:mm:ss " ) ) ;
List < CustomerAuthAddReq . AuthGroupData > list = new ArrayList < > ( ) ;
SisAccessControlVo accessControlVo ;
for ( Long deviceId : deviceIds ) {
accessControlVo = sisAccessControlService . queryById ( deviceId ) ;
CustomerAuthAddReq . AuthGroupData authData = new CustomerAuthAddReq . AuthGroupData ( ) ;
authData . setId ( Long . parseLong ( accessControlVo . getOutDoorCode ( ) ) ) ;
authData . setType ( 1 ) ;
authData . setType ( 0 ) ;
authData . setGatewayType ( 1 ) ;
list . add ( authData ) ;
}
authReq . setAuthData ( list ) ;
@@ -237,7 +239,7 @@ public class SisAuthRecordServiceImpl implements ISisAuthRecordService {
Assert . isTrue ( flag , " E8平台授权失败! " ) ;
log . info ( " E8平台授权完成! " ) ;
}
return e8PlatformApi . addCustomer ( req ) . getId ( ) ;
return e8Id ;
}
/**