@ -1,16 +1,18 @@
package com.weaver.seconddev.interfaces.htjt.util ;
import java.text.SimpleDateFormat ;
import java.util.Date ;
import java.util.HashMap ;
import java.util.Map ;
import com.weaver.common.hrm.util.HrmContextUtil ;
import com.weaver.common.i18n.tool.util.I18nContextUtil ;
import com.weaver.verupgrade.conn.CONN_TYPE ;
import org.slf4j.Logger ;
import org.slf4j.LoggerFactory ;
import com.weaver.verupgrade.general.Util ;
import com.weaver.ebuilder.form.client.ebform.data.EbFormDataDubboService ;
import com.weaver.framework.rpc.annotation.RpcReference ;
import com.weaver.teams.domain.user.SimpleEmployee ;
import com.weaver.verupgrade.conn.RecordSet ;
import com.weaver.verupgrade.formmode.setup.ModeRightInfo ;
import com.weaver.verupgrade.conn.CONN_TYPE ;
import lombok.extern.slf4j.Slf4j ;
import org.springframework.beans.factory.annotation.Autowired ;
import org.springframework.stereotype.Service ;
import java.text.SimpleDateFormat ;
import java.util.Date ;
/ * *
* createby
@ -18,94 +20,56 @@ import com.weaver.verupgrade.formmode.setup.ModeRightInfo;
* version v1
* desc
* /
@Service
@Slf4j
public class LogUtil {
private static final org . slf4j . Logger logger_aada5a9c = LoggerFactory . getLogger ( LogUtil . class ) ;
// 0 接收 1 推送
private String lx = "" ;
// 标题
private String bt = "" ;
// 流程id
private String lcid = "" ;
// 流程类型id
private String lclxid = "" ;
// 接口类名
private String jklm = "" ;
// 接口状态 0成功 1失败 2异常
private String jkzt = "" ;
// 返回消息
private String fhxx = "" ;
// 推送参数
private String tscs = "" ;
private String lx = "" ; //0 接收 1 推送
private String bt = "" ; //标题
private String lcid = "" ; //流程id
private String lclxid = "" ; //流程类型id
private String jklm = "" ; //接口类名
private String jkzt = "" ; //接口状态 0成功 1失败 2异常
private String fhxx = "" ; // 返回消息
private String tscs = "" ; // 推送参数
/ * *
*
* /
public void insertLog ( ) {
//TODO custom 已解决 ConnStatement
InsertUtil iu = new InsertUtil ( ) ;
String tablename = "uf_interface_log" ;
//TODO custom 已解决 ConnStatement
String modeid = iu . getModeId ( tablename ) ;
// String modeid ="";
SimpleDateFormat sdf = new SimpleDateFormat ( "yyyy-MM-dd" ) ;
SimpleDateFormat sdf1 = new SimpleDateFormat ( "HH:mm:ss" ) ;
SimpleDateFormat sdf2 = new SimpleDateFormat ( "HH:mm" ) ;
String nowDate = sdf . format ( new Date ( ) ) ;
String nowTime = sdf1 . format ( new Date ( ) ) ;
String nowTime2 = sdf2 . format ( new Date ( ) ) ;
String uuid = java . util . UUID . randomUUID ( ) . toString ( ) ;
Map < String , String > map = new HashMap < > ( ) ;
map . put ( "modedatacreatedate" , nowDate ) ;
map . put ( "modedatacreatetime" , nowTime ) ;
map . put ( "modedatacreater" , "1" ) ;
map . put ( "modedatacreatertype" , "0" ) ;
map . put ( "formmodeid" , modeid ) ;
map . put ( "modeuuid" , uuid ) ;
map . put ( "dyrq" , nowDate ) ;
map . put ( "dysj" , nowTime2 ) ;
//
map . put ( "lx" , this . lx ) ;
//
map . put ( "bt" , this . bt ) ;
//
map . put ( "lcid" , this . lcid ) ;
//
map . put ( "lclxid" , this . lclxid ) ;
//
map . put ( "jklm" , this . jklm ) ;
//
map . put ( "jkzt" , this . jkzt ) ;
//
map . put ( "fhxx" , this . fhxx ) ;
//
map . put ( "tscs" , this . tscs ) ;
//TODO custom 已解决 ConnStatement
iu . insert ( map , tablename ) ;
String billid = "" ;
RecordSet rs = I18nContextUtil . getBean ( RecordSet . class ) ;
String sql = "select max(id) as billid from " + tablename + " where modeuuid='" + uuid + "'" ;
String poolname = CONN_TYPE . workflow . getType ( ) ;
// TODO E10执行sql方法第二参数必须指定源, 默认使用流程源, 单体客户无需修改, 微服务/组合客户需根据查询表所属服务切换源,或使用外部数据源
rs . executeSql ( sql , poolname ) ;
if ( rs . next ( ) ) {
billid = Util . null2String ( rs . getString ( "billid" ) ) ;
}
if ( ! "" . equals ( billid ) ) {
ModeRightInfo ModeRightInfo = I18nContextUtil . getBean ( ModeRightInfo . class ) ;
/ * TODO 方 法 参 数 : Integer . valueOf ( "1" ) 类 型 发 生 变 化 e9 类 型 : java . lang . Integer e10 类 型 : long
TODO 方 法 参 数 : Util . getIntValue ( modeid ) 类 型 发 生 变 化 e9 类 型 : int e10 类 型 : long
TODO 方 法 参 数 : Integer . valueOf ( billid ) 类 型 发 生 变 化 e9 类 型 : java . lang . Integer e10 类 型 : long
TODO // 创建人字段已废弃 默认是用billid 数据对应的数据创建人*/
ModeRightInfo . editModeDataShare ( Integer . valueOf ( "1" ) , Util . getIntValue ( modeid ) , Integer . valueOf ( billid ) ) ;
@RpcReference ( group = "ebuilderform" )
private EbFormDataDubboService ebFormDataDubboService ;
public void insertLog ( String tenantKey ) {
try {
String tablename = "uf_interface_log" ;
if ( "t6kj9c07jr" . equals ( tenantKey ) ) {
tablename = "uf_interface_log" ;
} else if ( "tttit1yc38" . equals ( tenantKey ) ) { //光电
tablename = "ftab_277_tttit1yc38" ;
} else if ( "tejiddakia" . equals ( tenantKey ) ) { //华海
tablename = "ftab_277_tejiddakia" ;
}
TransUtil tu = new TransUtil ( ) ;
String modeid = tu . getModeId ( tablename , tenantKey ) ;
SimpleDateFormat sdf = new SimpleDateFormat ( "yyyy-MM-dd" ) ;
SimpleDateFormat sdf1 = new SimpleDateFormat ( "HH:mm:ss" ) ;
SimpleDateFormat sdf2 = new SimpleDateFormat ( "HH:mm" ) ;
String nowDate = sdf . format ( new Date ( ) ) ;
String nowTime = sdf1 . format ( new Date ( ) ) ;
String nowTime2 = sdf2 . format ( new Date ( ) ) ;
String uuid = java . util . UUID . randomUUID ( ) . toString ( ) ;
String ryid = tu . getsysadminid ( tenantKey ) ;
SimpleEmployee user = HrmContextUtil . build ( Long . valueOf ( ryid ) , tenantKey ) ;
Long recodId = ebFormDataDubboService . addEmptyData ( Long . valueOf ( modeid ) , user ) ;
String sql = "update e10_common.dbo." + tablename + " set dyrq=?,dysj=?,lx=?,bt=?,lcid=?,lclxid=?,jklm=?,jkzt=?,fhxx=?,tscs=? where id=" + recodId ;
RecordSet rs = I18nContextUtil . getBean ( RecordSet . class ) ;
String poolname = CONN_TYPE . ebuilder . getType ( ) ;
rs . setTenantKey ( tenantKey ) ;
rs . executeUpdate ( sql , poolname , nowDate , nowTime2 , this . lx , this . bt , this . lcid , this . lclxid , this . jklm , this . jkzt , this . fhxx , this . tscs ) ;
} catch ( Exception e ) {
log . error ( "LogUtil insertLog error" , e ) ;
}
}
public String getLx ( ) {
@ -171,4 +135,6 @@ public class LogUtil {
public void setTscs ( String tscs ) {
this . tscs = tscs ;
}
}