75 lines
2.4 KiB
Java
75 lines
2.4 KiB
Java
package com.tenwa.reckon.help;
|
|
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.amarsoft.are.ARE;
|
|
import com.amarsoft.are.jbo.JBOException;
|
|
import com.amarsoft.are.log.Log;
|
|
import com.amarsoft.are.util.StringFunction;
|
|
import com.amarsoft.awe.util.SqlObject;
|
|
import com.amarsoft.awe.util.Transaction;
|
|
import com.tenwa.comm.exception.BusinessException;
|
|
import com.tenwa.comm.util.jboutil.DataOperatorUtil;
|
|
import com.tenwa.reckon.util.DateUtil;
|
|
import com.tenwa.reckon.util.UUIDUtil;
|
|
|
|
public class CalculationLogUtil {
|
|
private static Log logger=ARE.getLog();
|
|
|
|
public static void insertCalculationFailLog(String flow_unid,String message,String message_position) {
|
|
Transaction tran = Transaction.createTransaction("als");
|
|
try {
|
|
String project_no = "";
|
|
String application_no = "";
|
|
List<Map<String, String>> pslData = DataOperatorUtil.getDataBySql("SELECT project_no,application_no FROM lb_project_info_temp WHERE flowunid='"+flow_unid+"'");
|
|
if(pslData != null && pslData.size() > 0){
|
|
project_no = pslData.get(0).get("project_no") == null ? "" : pslData.get(0).get("project_no");
|
|
application_no = pslData.get(0).get("application_no") == null ? "" : pslData.get(0).get("application_no");
|
|
}
|
|
String sql = "INSERT INTO lb_calculation_fail_log (id,project_no,flow_unid,application_no,message,inputtime,message_position) VALUES"
|
|
+ " ('"+UUIDUtil.getUUID()+"','"+project_no+"','"+flow_unid+"','"+application_no+"','"+message+"','"+DateUtil.getSystemTimeByFormat("yyyy/MM/dd HH:mm:ss")+"','"+message_position+"') ";
|
|
SqlObject so = new SqlObject("");
|
|
so.setOriginalSql(sql);
|
|
tran.executeSQL(so);
|
|
tran.commit();
|
|
} catch (Exception e) {
|
|
logger.info(e.getMessage());
|
|
logger.info("ÐÂÔö²âËãÈÕ־ʧ°Ü");
|
|
e.printStackTrace();
|
|
try {
|
|
if(tran != null)
|
|
tran.rollback();
|
|
} catch (JBOException e1) {
|
|
e1.printStackTrace();
|
|
}
|
|
}finally{
|
|
try {
|
|
if(tran != null){
|
|
tran.disConnect();
|
|
}
|
|
} catch (JBOException e) {
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
}
|
|
public static void main(String[] args) {
|
|
try {
|
|
int a = 10 ;
|
|
int b = 0 ;
|
|
System.out.println(a/b);
|
|
|
|
throw new BusinessException( "ROAСÓÚ²úÆ·ÅäÖã¡" );
|
|
}catch(Exception e ){
|
|
e.getStackTrace();
|
|
|
|
Object json = JSON.toJSON(e.getStackTrace());
|
|
System.out.println(json.toString());
|
|
System.out.println(e.toString());
|
|
}
|
|
}
|
|
}
|