You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
181 lines
14 KiB
Plaintext
181 lines
14 KiB
Plaintext
package GPA;
|
|
|
|
import org.springframework.jdbc.core.JdbcTemplate;
|
|
|
|
import javax.sound.midi.Soundbank;
|
|
import java.util.ArrayList;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
public class GMAIN_TEST {
|
|
public static void main(String[] args) throws Exception {
|
|
|
|
// LogClass.delete("测试数据");
|
|
// JdbcTemplate jdbcTemplate=new JdbcTemplate(new DBUtil().Hikar_DataSource());
|
|
//
|
|
// List list_PARTICIPANT = CommonHelp.getListBySql("select * from TB_PARTICIPANT",jdbcTemplate);
|
|
//
|
|
// List list_LINE_TABLE=CommonHelp.getListBySql("select LINENAME,GBLINEID from line_table",jdbcTemplate);
|
|
//
|
|
// List list_FEEUNIT_TABLE=CommonHelp.getListBySql("select ID,NAME FROM FEEUNIT_TABLE",jdbcTemplate);
|
|
//
|
|
// List list_GANTRY_TABLE=CommonHelp.getListBySql("select * from gantry_table",jdbcTemplate);
|
|
// String sql="select * from gantry_pass_center where passid='014101203823180302389420220616114637'";
|
|
// //011301200123000511468020220418120750
|
|
// //020000140102070009234220220422172438
|
|
// GPA_DATA gpa_data=new GPA_DATA();
|
|
// gpa_data.GetAllETCData(sql,0,1,jdbcTemplate,list_PARTICIPANT,list_LINE_TABLE,list_FEEUNIT_TABLE,list_GANTRY_TABLE);
|
|
//
|
|
//// startGPA s=new startGPA();
|
|
//// String sql_stat="select * from gantry_pass_stat_temp where tradeid='G0065150030002100102022051613200037'";
|
|
//// statTest(jdbcTemplate,sql_stat);
|
|
|
|
|
|
|
|
//超时第一种情况--有出口但是累计金额不相等的
|
|
List<Map<String,Integer>> listTemp=new ArrayList<>();
|
|
for (int i = 0; i <= 6; i++) {
|
|
String sql2_1_1 = "select * from(select * from gantry_pass_center where ishandle=0 and isout=1 and payfee_all!=obuprovpayfeesumafter and ROUND(TO_NUMBER(sysdate - transtime) * 24 * 60)>" + CommonHelp.GetConfigValue("timeOut") + " and ROUND(TO_NUMBER(sysdate - updatetime) * 24 * 60) > " + CommonHelp.GetConfigValue("lastTimeOut")+") t where ora_hash(passid,6)="+i;
|
|
Map map=new HashMap();
|
|
map.put("sql",sql2_1_1);
|
|
map.put("threadid",20+i+1);
|
|
listTemp.add(map);
|
|
}
|
|
|
|
for (Map<String, Integer> stringStringMap : listTemp) {
|
|
System.out.println(stringStringMap.get("sql")+":"+stringStringMap.get("threadid"));
|
|
}
|
|
|
|
String sql2_1_1 = "select * from(select * from gantry_pass_center where ishandle=0 and isout=1 and payfee_all!=obuprovpayfeesumafter and ROUND(TO_NUMBER(sysdate - transtime) * 24 * 60)>" + CommonHelp.GetConfigValue("timeOut") + " and ROUND(TO_NUMBER(sysdate - updatetime) * 24 * 60) > " + CommonHelp.GetConfigValue("lastTimeOut")+") t where ora_hash(passid,6)=0";
|
|
String sql2_1_2 = "select * from(select * from gantry_pass_center where ishandle=0 and isout=1 and payfee_all!=obuprovpayfeesumafter and ROUND(TO_NUMBER(sysdate - transtime) * 24 * 60)>" + CommonHelp.GetConfigValue("timeOut") + " and ROUND(TO_NUMBER(sysdate - updatetime) * 24 * 60) > " + CommonHelp.GetConfigValue("lastTimeOut")+") t where ora_hash(passid,6)=1";
|
|
String sql2_1_3 = "select * from(select * from gantry_pass_center where ishandle=0 and isout=1 and payfee_all!=obuprovpayfeesumafter and ROUND(TO_NUMBER(sysdate - transtime) * 24 * 60)>" + CommonHelp.GetConfigValue("timeOut") + " and ROUND(TO_NUMBER(sysdate - updatetime) * 24 * 60) > " + CommonHelp.GetConfigValue("lastTimeOut")+") t where ora_hash(passid,6)=2";
|
|
String sql2_1_4 = "select * from(select * from gantry_pass_center where ishandle=0 and isout=1 and payfee_all!=obuprovpayfeesumafter and ROUND(TO_NUMBER(sysdate - transtime) * 24 * 60)>" + CommonHelp.GetConfigValue("timeOut") + " and ROUND(TO_NUMBER(sysdate - updatetime) * 24 * 60) > " + CommonHelp.GetConfigValue("lastTimeOut")+") t where ora_hash(passid,6)=3";
|
|
String sql2_1_5 = "select * from(select * from gantry_pass_center where ishandle=0 and isout=1 and payfee_all!=obuprovpayfeesumafter and ROUND(TO_NUMBER(sysdate - transtime) * 24 * 60)>" + CommonHelp.GetConfigValue("timeOut") + " and ROUND(TO_NUMBER(sysdate - updatetime) * 24 * 60) > " + CommonHelp.GetConfigValue("lastTimeOut")+") t where ora_hash(passid,6)=4";
|
|
String sql2_1_6 = "select * from(select * from gantry_pass_center where ishandle=0 and isout=1 and payfee_all!=obuprovpayfeesumafter and ROUND(TO_NUMBER(sysdate - transtime) * 24 * 60)>" + CommonHelp.GetConfigValue("timeOut") + " and ROUND(TO_NUMBER(sysdate - updatetime) * 24 * 60) > " + CommonHelp.GetConfigValue("lastTimeOut")+") t where ora_hash(passid,6)=5";
|
|
String sql2_1_7 = "select * from(select * from gantry_pass_center where ishandle=0 and isout=1 and payfee_all!=obuprovpayfeesumafter and ROUND(TO_NUMBER(sysdate - transtime) * 24 * 60)>" + CommonHelp.GetConfigValue("timeOut") + " and ROUND(TO_NUMBER(sysdate - updatetime) * 24 * 60) > " + CommonHelp.GetConfigValue("lastTimeOut")+") t where ora_hash(passid,6)=6";
|
|
|
|
|
|
//超时第二种情况--累计金额相等但是没有出口的
|
|
String sql2_2_1 = "select * from gantry_pass_center where ishandle=0 and isout=0 and payfee_all=obuprovpayfeesumafter and ROUND(TO_NUMBER(sysdate - transtime) * 24 * 60)>" + CommonHelp.GetConfigValue("timeOut") + " and ROUND(TO_NUMBER(sysdate - updatetime) * 24 * 60) > " + CommonHelp.GetConfigValue("lastTimeOut");
|
|
//超时第三种情况--没有出口累计金额也不相等的
|
|
String sql2_3_1 = "select * from gantry_pass_center where ishandle=0 and isout=0 and payfee_all!=obuprovpayfeesumafter and ROUND(TO_NUMBER(sysdate - transtime) * 24 * 60)>" + CommonHelp.GetConfigValue("timeOut") + " and ROUND(TO_NUMBER(sysdate - updatetime) * 24 * 60) > " + CommonHelp.GetConfigValue("lastTimeOut");
|
|
|
|
|
|
|
|
|
|
}
|
|
public static void statTest(JdbcTemplate jdbcTemplate,String sql){
|
|
try {
|
|
//s.UpdateState(Thread.currentThread().getId());
|
|
List list=jdbcTemplate.queryForList(sql);
|
|
String tollIntervalsId="";
|
|
String stano="";
|
|
String roadno="";
|
|
StringBuilder delete_tradeid=new StringBuilder();
|
|
if (list.size()>0){
|
|
for (int i = 0; i < list.size(); i++) {
|
|
try {
|
|
Map map=(Map) list.get(i);
|
|
String[] tollIntervalsId_temp=map.get("TOLLINTERVALID")==null?null:map.get("TOLLINTERVALID").toString().split("\\|");
|
|
String[] feeGroup_temp=map.get("FEEGROUP")==null?null:map.get("FEEGROUP").toString().split("\\|");
|
|
String[] payfeeGroup_temp=map.get("PAYFEEGROUP")==null?null:map.get("PAYFEEGROUP").toString().split("\\|");
|
|
String[] specialtype_temp=null;
|
|
if (map.get("SPECIALTYPE")!=null){
|
|
if (map.get("SPECIALTYPE").toString().replace(" ","").length()>0){
|
|
specialtype_temp=map.get("SPECIALTYPE").toString().split("\\|");
|
|
}
|
|
}
|
|
|
|
String is_have_gantry_trade_sql="SELECT * FROM gantry_trade_mass where gantryid='" +map.get("GANTRYID").toString() + "' and classdate=TO_DATE('" + map.get("TRANSTIME").toString().substring(0,10) + "', 'yyyy-mm-dd') AND MEDIATYPE = " +map.get("MEDIATYPE") + " AND VEHICLETYPE = " +map.get("VEHICLETYPE");
|
|
List list_trade_ishave=jdbcTemplate.queryForList(is_have_gantry_trade_sql);
|
|
|
|
String boundarytype_sql = "select boundarytype from gantry_table where id='" + map.get("GANTRYID").toString() + "'";
|
|
List boundary=jdbcTemplate.queryForList(boundarytype_sql);
|
|
if (boundary.size()>0){
|
|
|
|
}
|
|
int boundarytype=Integer.valueOf(((Map) jdbcTemplate.queryForList(boundarytype_sql).get(0)).get("BOUNDARYTYPE").toString());
|
|
if (list_trade_ishave.size()>0){
|
|
int feesuccnum=0;
|
|
int feefailenum=0;
|
|
if (map.get("FEECALCRESULT").toString().equals("0") && map.get("TRADERESULT").toString().equals("0")){
|
|
feesuccnum = 1;
|
|
}
|
|
else {
|
|
feefailenum = 1;
|
|
}
|
|
// JSONObject temp=new JSONObject(((Map) list_trade_ishave.get(0)).get("SPECIALTYPE").toString());
|
|
// if (specialtype_temp!=null){
|
|
// for (int j = 0; j < specialtype_temp.length; j++) {
|
|
// String special_value="";
|
|
// if (specil_list.contains(Integer.valueOf(specialtype_temp[j]))){
|
|
//
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
String update_gantry_trade = "update gantry_trade_mass set boundarytype = " + boundarytype + ", feesuccnum = feesuccnum+" + feesuccnum + ", feefailenum = feefailenum+" + feefailenum + ", specialtype = '' where gantryid = '" + map.get("GANTRYID").toString() + "' and classdate = TO_DATE('" +map.get("TRANSTIME").toString().substring(0,10) + "', 'yyyy-mm-dd') and mediatype = " + map.get("MEDIATYPE") + " and vehicletype = " + map.get("VEHICLETYPE");
|
|
jdbcTemplate.update(update_gantry_trade);
|
|
|
|
}
|
|
else {
|
|
String insert_gantry_trade= "insert into gantry_trade_mass (gantryid, classdate, mediatype, vehicletype, boundarytype, feesuccnum, feefailenum, specialtype, feelostnum) values ('" +map.get("GANTRYID").toString() + "', TO_DATE('" + map.get("TRANSTIME").toString().substring(0,10) + "', 'yyyy-mm-dd'), " +map.get("MEDIATYPE") + ", " + map.get("VEHICLETYPE") + ", " + boundarytype + ", 0, 0, '{}', 0) ";
|
|
jdbcTemplate.update(insert_gantry_trade);
|
|
}
|
|
|
|
if (tollIntervalsId_temp!=null && feeGroup_temp!=null && payfeeGroup_temp!=null){
|
|
if (tollIntervalsId_temp.length== feeGroup_temp.length && feeGroup_temp.length==payfeeGroup_temp.length){
|
|
for (int j = 0; j < tollIntervalsId_temp.length; j++) {
|
|
if (tollIntervalsId_temp[j].length()>=16){
|
|
tollIntervalsId=tollIntervalsId_temp[j].substring(0,16);
|
|
String stano_roadno_sql = "select ostano,oroadno from feeunit_table where id='" + tollIntervalsId + "'";
|
|
List stano_roadno_list=jdbcTemplate.queryForList(stano_roadno_sql);
|
|
if (stano_roadno_list.size()>0){
|
|
stano=((Map)stano_roadno_list.get(0)).get("OSTANO").toString();
|
|
roadno=((Map)stano_roadno_list.get(0)).get("OROADNO").toString();
|
|
}
|
|
else {
|
|
stano="0";
|
|
roadno="0";
|
|
}
|
|
|
|
String is_have_sql = "SELECT 1 FROM DUAL WHERE EXISTS (SELECT * FROM gantry_stat where FEEUNITID='" + tollIntervalsId + "' and classdate=TO_DATE('" +map.get("TRANSTIME").toString().substring(0,10) + "', 'yyyy-mm-dd') AND MEDIATYPE = " +map.get("MEDIATYPE") + " AND VEHTYPE = " +map.get("VEHICLETYPE") + " AND ROADNO = " + roadno + " and STANO=" + stano + ")";
|
|
List list_ishave=jdbcTemplate.queryForList(is_have_sql);
|
|
if (list_ishave.size()>0){
|
|
String update_sql = "UPDATE GANTRY_STAT SET VEHCOUNT = VEHCOUNT + 1, CASH = TO_NUMBER(CASH) +TO_NUMBER(" + (payfeeGroup_temp[j].replace(" ","").length() == 0 ? "0" : payfeeGroup_temp[j]) + "), INCASH = TO_NUMBER(INCASH) +TO_NUMBER(" + (feeGroup_temp[j].replace(" ","").length() == 0 ? "0" : feeGroup_temp[j]) + ") where FEEUNITID='" + tollIntervalsId + "' and classdate=TO_DATE('" + map.get("TRANSTIME").toString().substring(0,10) + "', 'yyyy-mm-dd') AND MEDIATYPE = " + map.get("MEDIATYPE") + " AND VEHTYPE = " + map.get("VEHICLETYPE") + " AND ROADNO = " + roadno;
|
|
jdbcTemplate.update(update_sql);
|
|
}
|
|
else {
|
|
String insert_sql = "INSERT INTO GANTRY_STAT(ROADNO,STANO,CLASSDATE,FEEUNITID,MEDIATYPE, VEHTYPE,VEHCLASS,SPECIALTYPE,AXLECOUNT,VEHCOUNT,TRADERESULT,HOLIDAYSTATE,VALIDSTATUS,CASH,INCASH,FEESUMLOCALAFTER,BACKUP1,BACKUP2,BACKUP3,BACKUP4,DATEMARK) VALUES(" + roadno + ", " + stano + ", TO_DATE('" + map.get("TRANSTIME").toString().substring(0,10) + "', 'yyyy-mm-dd'), '" + tollIntervalsId + "', " + map.get("MEDIATYPE") + "," + map.get("VEHICLETYPE") + ", 0, 0, 2, 1, 0, 0, 0," + (payfeeGroup_temp[j].replace(" ","").length() == 0 ? "0" : payfeeGroup_temp[j]) + ", " + (feeGroup_temp[j].replace(" ","").length() == 0 ? "0" : feeGroup_temp[j]) + ", 0, 0, 0, '0','0', SYSDATE)";
|
|
jdbcTemplate.update(insert_sql);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
String delete_sql="delete gantry_pass_stat_temp where tradeid='" +map.get("TRADEID") + "' ";
|
|
jdbcTemplate.update(delete_sql);
|
|
|
|
|
|
}
|
|
catch (Exception e){
|
|
LogClass.error("预分账错误日志:"+e.toString()+","+((Map) list.get(i)).get("TRADEID"));
|
|
}
|
|
}
|
|
}
|
|
|
|
Thread.sleep(1000*30);
|
|
|
|
}
|
|
catch (Exception e){
|
|
LogClass.error("预拆分错误"+e.toString());
|
|
}
|
|
}
|
|
|
|
}
|