@ -8,6 +8,7 @@ import cn.axzo.nanopart.visa.server.dto.VisaLogDto;
import cn.axzo.nanopart.visa.server.dto.VisaLogParam ;
import cn.axzo.nanopart.visa.server.mapper.ChangeRecordLogDao ;
import cn.axzo.nanopart.visa.server.rpc.VisaOrganizationalNodeUserGateway ;
import cn.axzo.nanopart.visa.server.utils.Constants ;
import cn.axzo.orggateway.api.nodeuser.dto.OrgNodeUserDTO ;
import cn.axzo.orggateway.api.nodeuser.req.ListOrgNodeUserReq ;
import cn.axzo.orgmanax.dto.nodeuser.req.ListNodeUserReq ;
@ -76,6 +77,11 @@ public class ChangeRecordLogServiceImpl extends ServiceImpl<ChangeRecordLogDao,
@Override
public List < ChangeRecordLog > buildLogList ( Long visaId , VisaLogTypeEnum type , VisaLogParam param ) {
if ( Objects . isNull ( visaId ) | | Objects . isNull ( type ) ) {
return Lists . newArrayList ( ) ;
}
List < ChangeRecordLog > logList = Lists . newArrayList ( ) ;
switch ( type ) {
case CHAT_GROUP :
@ -86,7 +92,10 @@ public class ChangeRecordLogServiceImpl extends ServiceImpl<ChangeRecordLogDao,
String userName = this . buildUserName ( param . getPersonId ( ) , param . getOuId ( ) , param . getWorkspaceId ( ) ) ;
builder . action ( type . name ( ) )
. title ( type . getTitle ( ) )
. content ( String . format ( type . getContent ( ) , userName ) ) ;
. content ( String . format ( type . getContent ( ) , userName ) )
. orderBy ( Constants . CHANGE_STATUS_FILE_ORDER_BY )
. visaId ( visaId ) ;
logList . add ( builder . build ( ) ) ;
break ;
case EDIT_FORM :
builder = ChangeRecordLog . builder ( ) ;
@ -95,7 +104,9 @@ public class ChangeRecordLogServiceImpl extends ServiceImpl<ChangeRecordLogDao,
/ / 编辑表单
userName = this . buildUserName ( param . getPersonId ( ) , param . getOuId ( ) , param . getWorkspaceId ( ) ) ;
builder . title ( String . format ( type . getTitle ( ) , userName ) )
. content ( String . format ( type . getContent ( ) , userName ) ) ;
. content ( String . format ( type . getContent ( ) , userName ) )
. orderBy ( Constants . EDIT_FORM_ORDER_BY )
. visaId ( visaId ) ;
logList . add ( builder . build ( ) ) ;
case EDIT_AMOUNT :
if ( Objects . nonNull ( param )
@ -107,7 +118,9 @@ public class ChangeRecordLogServiceImpl extends ServiceImpl<ChangeRecordLogDao,
/ / 编辑金额变化
userName = this . buildUserName ( param . getPersonId ( ) , param . getOuId ( ) , param . getWorkspaceId ( ) ) ;
builder . title ( String . format ( type . getTitle ( ) , userName ) )
. content ( String . format ( type . getContent ( ) , param . getOldAmountChange ( ) . toPlainString ( ) , param . getNewAmountChange ( ) . toPlainString ( ) ) ) ;
. content ( String . format ( type . getContent ( ) , param . getOldAmountChange ( ) . toPlainString ( ) , param . getNewAmountChange ( ) . toPlainString ( ) ) )
. orderBy ( Constants . AMOUNT_CHANGE_ORDER_BY )
. visaId ( visaId ) ;
logList . add ( builder . build ( ) ) ;
}
case UPLOAD_FILE :
@ -116,7 +129,9 @@ public class ChangeRecordLogServiceImpl extends ServiceImpl<ChangeRecordLogDao,
/ / 上传附件
userName = this . buildUserName ( param . getPersonId ( ) , param . getOuId ( ) , param . getWorkspaceId ( ) ) ;
builder . title ( String . format ( type . getTitle ( ) , userName ) )
. content ( String . format ( type . getContent ( ) , userName , param . getUploadAttach ( ) . size ( ) , this . buildAttach ( param . getUploadAttach ( ) ) ) ) ;
. content ( String . format ( type . getContent ( ) , userName , param . getUploadAttach ( ) . size ( ) , this . buildAttach ( param . getUploadAttach ( ) ) ) )
. orderBy ( Constants . ADD_UPLOAD_FILE_ORDER_BY )
. visaId ( visaId ) ;
logList . add ( builder . build ( ) ) ;
}
case DELETE_UPLOAD_FILE :
@ -125,7 +140,9 @@ public class ChangeRecordLogServiceImpl extends ServiceImpl<ChangeRecordLogDao,
/ / 删除附件
userName = this . buildUserName ( param . getPersonId ( ) , param . getOuId ( ) , param . getWorkspaceId ( ) ) ;
builder . title ( String . format ( type . getTitle ( ) , userName ) )
. content ( String . format ( type . getContent ( ) , userName , param . getDeleteAttach ( ) . size ( ) , this . buildAttach ( param . getDeleteAttach ( ) ) ) ) ;
. content ( String . format ( type . getContent ( ) , userName , param . getDeleteAttach ( ) . size ( ) , this . buildAttach ( param . getDeleteAttach ( ) ) ) )
. orderBy ( Constants . DELETE_UPLOAD_FILE_ORDER_BY )
. visaId ( visaId ) ;
logList . add ( builder . build ( ) ) ;
}
break ;
@ -137,6 +154,9 @@ public class ChangeRecordLogServiceImpl extends ServiceImpl<ChangeRecordLogDao,
builder . action ( type . name ( ) ) ;
builder . title ( type . getTitle ( ) ) ;
builder . content ( String . format ( type . getContent ( ) , userName ) ) ;
builder . orderBy ( Constants . CHANGE_STATUS_FILE_ORDER_BY ) ;
builder . visaId ( visaId ) ;
logList . add ( builder . build ( ) ) ;
break ;
case TO_APPRROVE :
ChangeRecord changeRecord = this . changeRecordService . getById ( visaId ) ;
@ -147,6 +167,10 @@ public class ChangeRecordLogServiceImpl extends ServiceImpl<ChangeRecordLogDao,
builder . action ( type . name ( ) ) ;
builder . title ( String . format ( type . getTitle ( ) , changeRecord . getType ( ) . getDesc ( ) ) ) ;
builder . content ( String . format ( type . getContent ( ) , userName , changeRecord . getType ( ) . getDesc ( ) ) ) ;
builder . orderBy ( Constants . CHANGE_STATUS_FILE_ORDER_BY ) ;
builder . visaId ( visaId ) ;
logList . add ( builder . build ( ) ) ;
break ;
case APPROVED_AGRESS :
builder = ChangeRecordLog . builder ( ) ;
/ / 动作 : 审批流 : 某审批人审批通过
@ -155,6 +179,8 @@ public class ChangeRecordLogServiceImpl extends ServiceImpl<ChangeRecordLogDao,
builder . title ( String . format ( type . getTitle ( ) , userName ) ) ;
builder . content ( String . format ( type . getContent ( ) , userName ) ) ;
builder . orderBy ( Constants . CHANGE_STATUS_FILE_ORDER_BY ) ;
builder . visaId ( visaId ) ;
logList . add ( builder . build ( ) ) ;
break ;
case REVERT_APPROVE :
@ -165,6 +191,8 @@ public class ChangeRecordLogServiceImpl extends ServiceImpl<ChangeRecordLogDao,
builder . title ( type . getTitle ( ) ) ;
builder . content ( String . format ( type . getContent ( ) , userName ) ) ;
builder . orderBy ( Constants . CHANGE_STATUS_FILE_ORDER_BY ) ;
builder . visaId ( visaId ) ;
logList . add ( builder . build ( ) ) ;
break ;
case REJECT_APPROVE :
@ -175,6 +203,8 @@ public class ChangeRecordLogServiceImpl extends ServiceImpl<ChangeRecordLogDao,
builder . title ( String . format ( type . getTitle ( ) , userName ) ) ;
builder . content ( String . format ( type . getContent ( ) , userName , param . getReason ( ) ) ) ;
builder . orderBy ( Constants . CHANGE_STATUS_FILE_ORDER_BY ) ;
builder . visaId ( visaId ) ;
logList . add ( builder . build ( ) ) ;
break ;
case TRANSMIT_APPROVE :
@ -185,6 +215,8 @@ public class ChangeRecordLogServiceImpl extends ServiceImpl<ChangeRecordLogDao,
builder . title ( type . getTitle ( ) ) ;
builder . content ( String . format ( type . getContent ( ) , userName , param . getTransmitTo ( ) , param . getReason ( ) ) ) ;
builder . orderBy ( Constants . CHANGE_STATUS_FILE_ORDER_BY ) ;
builder . visaId ( visaId ) ;
logList . add ( builder . build ( ) ) ;
break ;
case FORBIDED :
@ -195,6 +227,10 @@ public class ChangeRecordLogServiceImpl extends ServiceImpl<ChangeRecordLogDao,
builder . action ( type . name ( ) ) ;
builder . title ( type . getTitle ( ) ) ;
builder . content ( String . format ( type . getContent ( ) , userName ) ) ;
builder . orderBy ( Constants . CHANGE_STATUS_FILE_ORDER_BY ) ;
builder . visaId ( visaId ) ;
logList . add ( builder . build ( ) ) ;
break ;
case APPROVE_COMPLETED :
builder = ChangeRecordLog . builder ( ) ;
changeRecord = this . changeRecordService . getById ( visaId ) ;
@ -203,7 +239,10 @@ public class ChangeRecordLogServiceImpl extends ServiceImpl<ChangeRecordLogDao,
builder . action ( type . name ( ) ) ;
builder . title ( String . format ( type . getTitle ( ) , changeRecord . getType ( ) . getDesc ( ) ) ) ;
builder . content ( String . format ( type . getContent ( ) , changeRecord . getType ( ) . getDesc ( ) ) ) ;
builder . orderBy ( Constants . CHANGE_STATUS_FILE_ORDER_BY ) ;
builder . visaId ( visaId ) ;
logList . add ( builder . build ( ) ) ;
break ;
default :
throw new ServiceException ( " 变签日志类型不匹配 " ) ;
}
@ -286,7 +325,8 @@ public class ChangeRecordLogServiceImpl extends ServiceImpl<ChangeRecordLogDao,
return this . lambdaQuery ( ) . eq ( ChangeRecordLog : : getVisaId , dto . getVisaId ( ) )
. eq ( Objects . nonNull ( dto . getLogType ( ) ) , ChangeRecordLog : : getAction , dto . getLogType ( ) )
. eq ( ChangeRecordLog : : getIsDelete , 0 )
. orderByDesc ( ChangeRecordLog : : getUpdateAt )
. orderByDesc ( ChangeRecordLog : : getCreateAt )
. orderByDesc ( ChangeRecordLog : : getOrderBy )
. list ( ) ;
}