2016-09-18 Text, 2016-09-18text

Source: Internet
Author: User

2016-09-18 Text, 2016-09-18text

Public void getHighConsMeterData (String jssj) throws Exception {HashMap <String, String> map = new HashMap <String, String> (); map. put ("1", "'000000'"); // Forward Active total map. put ("9", "'000000'"); // map the Forward Active point. put ("10", "'000000'"); // map the total Forward Active Power peaks. put ("12", "'000000'"); // map the Forward Active Valley. put ("11", "'000000'"); // forward total flat map. put ("5", "'000000'"); // reverse active total map. put ("13", "'000000'"); // reverse active point map. put ("14", "'000000 '");// Map of the total reverse Active Power peaks. put ("16", "'000000'"); // reverse active total flat map. put ("15", "'000000'"); // reverse active Valley map. put ("2", "'000000'"); // forward total reactive power map. put ("6", "'000000'"); // reverse total reactive map. put ("3", "'000000'"); // reactive (Q1 quadrant) map. put ("4", "'000000'"); // reactive (Q2 quadrant) map. put ("7", "'000000'"); // reactive (Q3 quadrant) map. put ("8", "'000000'"); // reactive (Q4 quadrant) Date datetmp = new Date (); int hour = datetmp. getHours (); String datatime = jssj; String columnName = "r1 ";// Judging time if (hour <12) {datatime = jssj + "000000"; columnName = "r1" ;}else {datatime = jssj + "120000 "; columnName = "r49";} hql. setHql ("drop table if exists prepay_high_cons_upload_data"); hql.exe cuteUpdate (); StringBuffer sb = new StringBuffer (); sb. append ("create table prepay_high_cons_upload_data row format delimited fields terminated? As "); sb. append ("select coll_obj_id,"); sb. append ("org_no,"); sb. append ("coll_item_code,"); sb. append ("'" + datatime + "'data_time,"); sb. append ("data_value,"); sb. append ("'" + jssj + "'write_time"); sb. append ("from ("); Iterator iter = map. entrySet (). iterator (); while (iter. hasNext () {Map. entry entry = (Map. entry) iter. next (); String key = (String) entry. getKey (); String val = (Str Ing) entry. getValue (); if (iter. hasNext () {sb. append ("select pc. coll_obj_id, "); sb. append ("pc.org _ no,"); sb. append ("" + val + "coll_item_code,"); sb. append ("em. data_date data_time, "); sb. append ("COALESCE (em. "+ columnName +", em. r1) data_value "); sb. append ("from e_mp_read_curve_prepay em"); sb. append ("join prepay_collobjid_data_usual pc on pc. sp_id = em. id "); sb. append ("where pc. cons_sort_code! = '02' "); sb. append (" and pc. cons_sort_code! = '03' "); sb. append ("and em. "+ columnName +" is not null "); sb. append ("and em. data_type = '"+ key +"' "); sb. append ("union all");} else {sb. append ("select pc. coll_obj_id, "); sb. append ("pc.org _ no,"); sb. append ("" + val + "coll_item_code,"); sb. append ("em. data_date data_time, "); sb. append ("COALESCE (em. "+ columnName +", em. r1) data_value "); sb. append ("from e_mp_read_curve_prepay em"); sb. appe Nd ("join prepay_collobjid_data_usual pc on pc. sp_id = em. id"); sb. append ("where pc. cons_sort_code! = '02' "); sb. append (" and pc. cons_sort_code! = '03' "); sb. append ("and em. "+ columnName +" is not null "); sb. append ("and em. data_date = '"+ jssj +"' "); sb. append ("and em. data_type = '"+ key +"' ") ;}} sb. append (") a"); hql. setHql (sb. toString (); hql. setString (1, Constants.SEPARATOR);hql.exe cuteUpdate ();}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.