/*
 * Decompiled with CFR 0.152.
 * 
 * Could not load the following classes:
 *  net.sf.json.JSONArray
 *  net.sf.json.JSONObject
 */
package com.hst.taxService.service.imp;

import com.hst.common.domain.TaxCommonReturnDomain;
import com.hst.common.util.HstJsonUtil;
import com.hst.framework.constants.AppServiceConstants;
import com.hst.framework.util.HstDateUtil;
import com.hst.taxService.domain.MessAppDomain;
import com.hst.taxService.domain.NsrMessAppDomain;
import com.hst.taxService.domain.NsrMessReturnDomain;
import com.hst.taxService.domain.PublicQueryReturnDomain;
import java.text.DecimalFormat;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.List;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public class Test {
    public static void main(String[] args) {
        TaxCommonReturnDomain ret = new TaxCommonReturnDomain();
        ret.setCode("0");
        ret.setMess("\u5904\u7406\u6210\u529f\uff01");
        JSONObject jsonObject = new JSONObject();
        jsonObject.accumulate("result", (Object)ret);
        System.out.println(jsonObject.toString());
        System.out.println(HstJsonUtil.beanToJson(ret));
        String s = "{\"result\":{\"code\":\"0\",\"mess\":\"\u5904\u7406\u6210\u529f\uff01\"}}";
        JSONObject jsonObj = JSONObject.fromObject((Object)s);
        JSONObject result = jsonObj.getJSONObject("result");
        System.out.println("code:" + result.getString("code") + "mess:" + result.getString("mess"));
        s = "{\"results\":[\"\u5f20\u4e09\",\"\u674e\u56db\",\"\u738b\u4e94\"]}";
        jsonObj = JSONObject.fromObject((Object)s);
        JSONArray jsonarr = jsonObj.getJSONArray("results");
        int i = 0;
        while (i < jsonarr.size()) {
            System.out.println(jsonarr.getString(i));
            ++i;
        }
        s = "{\"code\":\"0\",\"mess\":\"\u5904\u7406\u6210\u529f\uff01\"}";
        jsonObj = JSONObject.fromObject((Object)s);
        try {
            TaxCommonReturnDomain returnDomain = HstJsonUtil.jsonToBean(s, TaxCommonReturnDomain.class);
            System.out.println(returnDomain.getMess());
        }
        catch (Exception e) {
            e.printStackTrace();
        }
        ArrayList<TaxCommonReturnDomain> dataList = new ArrayList<TaxCommonReturnDomain>();
        TaxCommonReturnDomain app = new TaxCommonReturnDomain();
        app.setCode("0");
        app.setMess("\u5904\u7406\u6210\u529f\uff01");
        dataList.add(app);
        TaxCommonReturnDomain app2 = new TaxCommonReturnDomain();
        app2.setCode("1");
        app2.setMess("\u5904\u7406\u5931\u8d25\uff01");
        dataList.add(app2);
        JSONObject json = new JSONObject();
        json.accumulate("dataList", dataList);
        System.out.println(json.toString());
        String message = "Cause: java.sql.SQLException: ORA-2000: \u9519\u8bef\uff1aORA-06512: ?\"P_TM_APP_GETZCYZM\", line 111";
        int oraIndex = message.indexOf("ORA-");
        if (oraIndex > 0 && (message = message.substring(oraIndex)).length() >= 4) {
            int secondOraIndex = message.substring(4, message.length()).indexOf("ORA");
            System.out.println(message);
            if (secondOraIndex > 0) {
                message = message.substring(0, secondOraIndex + 4);
            }
            int thirdOraIndex = message.indexOf("ORA-");
            System.out.println(message);
            if (thirdOraIndex >= 0) {
                message = message.substring(thirdOraIndex + 4, thirdOraIndex + 8);
            }
            System.out.println(message);
        }
        System.out.println(message);
        String TIME_DATETIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
        String dateStr = "2014-01-06 15:10:00";
        GregorianCalendar gc = new GregorianCalendar();
        SimpleDateFormat df = new SimpleDateFormat(TIME_DATETIME_FORMAT);
        Date date = df.parse(dateStr, new ParsePosition(0));
        gc.setTime(date);
        gc.add(12, 30);
        System.out.println(df.format(gc.getTime()));
        System.out.println(AppServiceConstants.TAX_APP_ERROR);
        AppServiceConstants.TAX_APP_ERROR = "11111";
        System.out.println(AppServiceConstants.TAX_APP_ERROR);
        AppServiceConstants.TAX_APP_ERROR = "356767";
        System.out.println(AppServiceConstants.TAX_APP_ERROR);
        try {
            System.out.println(HstDateUtil.toDateString(new Date(), AppServiceConstants.TIME_DATETIME_FORMAT));
        }
        catch (Exception e) {
            e.printStackTrace();
        }
        int length = 20;
        long num = 1L;
        double random = Math.random();
        if (random < 0.1) {
            random += 0.1;
        }
        int i2 = 0;
        while (i2 < length) {
            num *= 10L;
            ++i2;
        }
        double ret_num = random * (double)num;
        DecimalFormat dformat = new DecimalFormat("0");
        System.out.println(dformat.format(ret_num));
        StringBuffer sb = new StringBuffer();
        sb.append("12344,23657,");
        System.out.println(sb.substring(0, sb.length() - 1));
        String a = "2014-9-1";
        String b = "2014-10-3";
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        try {
            Calendar a2 = Calendar.getInstance();
            Calendar b2 = Calendar.getInstance();
            a2.setTime(format.parse(a));
            b2.setTime(format.parse(b));
            int result2 = (b2.get(1) - a2.get(1)) * 12 + (b2.get(2) - a2.get(2));
            System.out.println("result is: " + result2);
            System.out.println(b2.get(1) * 12 + b2.get(2) - (a2.get(1) * 12 + a2.get(2)) + 1);
        }
        catch (Exception ex) {
            System.err.println(ex.toString());
        }
        NsrMessReturnDomain messReturnDomain = new NsrMessReturnDomain();
        messReturnDomain.setCode("00");
        messReturnDomain.setNsrsbh("12345678");
        ArrayList<TaxCommonReturnDomain> lists = new ArrayList<TaxCommonReturnDomain>();
        int i3 = 1;
        while (i3 <= 2) {
            TaxCommonReturnDomain addr = new TaxCommonReturnDomain();
            addr.setCode("\u7b2c" + i3 + "\u4e2acode");
            addr.setMess("\u7b2c" + i3 + "\u4e2amess");
            lists.add(addr);
            ++i3;
        }
        JSONArray jsonArr = JSONArray.fromObject(lists);
        System.out.println(jsonArr);
        HashMap<String, Class<TaxCommonReturnDomain>> map = new HashMap<String, Class<TaxCommonReturnDomain>>();
        map.put("list", TaxCommonReturnDomain.class);
        List listAdds = JSONArray.toList((JSONArray)jsonArr, TaxCommonReturnDomain.class, map);
        for (TaxCommonReturnDomain add : listAdds) {
            System.out.println(String.valueOf(add.getCode()) + "\t" + add.getMess());
        }
        String strList = "{\"bid\":\"tm.login\",\"sid\":\"dsfsadfsdte4676XXh\",\"uid\":\"12344\",\"dataList\":[{\"messXh\":\"111\"},{\"messXh\":\"222\"}]}";
        HashMap<String, Class> classMap = new HashMap<String, Class>();
        classMap.put("dataList", MessAppDomain.class);
        NsrMessAppDomain mess = HstJsonUtil.jsonToBeanToList(strList, NsrMessAppDomain.class, classMap);
        System.out.println(String.valueOf(mess.getBid()) + ":" + mess.getDataList().get(0).getMessXh());
        PublicQueryReturnDomain publicQuery = new PublicQueryReturnDomain();
        publicQuery.setCode("00");
        ArrayList<String> strdata = new ArrayList<String>();
        strdata.add("1123333");
        strdata.add("11233334556");
        ArrayList<String> strdata2 = new ArrayList<String>();
        strdata2.add("78900");
        strdata2.add("657788");
        ArrayList<List<String>> list2 = new ArrayList<List<String>>();
        list2.add(strdata);
        list2.add(strdata2);
        publicQuery.setDataList(list2);
        System.out.println(HstJsonUtil.beanToJson(publicQuery));
        String sss = "123456789";
        System.out.println(sss.substring(5, 8));
        String sql = "SELECT '' NSRSBH,'' JBDM,'' CFTJ,'' MESS FROM TM_SSTX_DEFINE WHERE SS_SWJG_DM=%SWJG_DM% AND CJRQ >=%RQ_Q% AND  CJRQ < %RQ_Z%";
        sql = sql.replaceAll("%SWJG_DM%", "13301");
        System.out.println(sql);
    }
}
