1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465 |
- package com.zhcs.dt.controller.information.annualPlan;
- import java.io.IOException;
- import java.math.BigDecimal;
- import java.math.BigInteger;
- import java.text.SimpleDateFormat;
- import java.util.ArrayList;
- import java.util.Date;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- import java.util.Properties;
- import javax.annotation.Resource;
- import org.springframework.core.io.support.PropertiesLoaderUtils;
- import com.zhcs.dt.service.information.annualPlan.impl.AnnualDailyCompService;
- import com.zhcs.dt.util.PageData;
- public class ShowTableRecodUtil {
- private AnnualDailyCompService annualDailyCompService;
- private String[] dailyPlanType = { "CLEAN_PLAN_COST", "PATROL_PLAN_COST", "SUBGRADE_PLAN_COST",
- "PAVEMENT_PLAN_COST", "BRIDGE_PLAN_COST", "CULVERT_PLAN_COST", "TUNNEL_PLAN_COST", "GREEN_PLAN_COST",
- "SAFE_PLAN_COST", "LINE_PLAN_COST", "CAR_PLAN_COST", "EMERGENCY_PLAN_COST" };
- // private String[] dailyCompType = {"CLEAN_COST", "PATROL_COST", "SUBGRADE_COST","PAVEMENT_COST",
- // "BRIDGE_COST","CULVERT_COST","TUNNEL_COST","GREEN_COST","SAFE_COST","LINE_COST",
- // "CAR_COST","EMERGENCY_COST"};
- private String[] annDailyCompType = { "CLEAN_COST", "PATROL_COST", "SUBGRADE_COST", "PAVEMENT_COST", "BRIDGE_COST",
- "CULVERT_COST", "TUNNEL_COST", "TRAFFIC_SAFE_COST", "ROADSIDE_COST", "GREEN_COST", "MAINT_COST",
- "EMERGENCY_COST" };
- public List<PageData> showTableRecod(AnnualDailyCompService annualDailyCompService, PageData pd) throws Exception {
- this.annualDailyCompService = annualDailyCompService;
- List<PageData> varList = new ArrayList<PageData>();
- PageData varPg = new PageData();
- String tableType = pd.getString("TABLETYPE");
- if ("highway_plan_comp_sumtable".equalsIgnoreCase(tableType)) {
- // 计划费用
- // PageData tempPg = annualDailyCompService.findDaliyPlanRecord(pd); // 日常养护
- // String dailyPlanCost = dailyPlanCostSum(tempPg);
- // varPg = annualDailyCompService.findTableInfo(pd);
- // varPg.put("YEAR", pd.get("YEAR"));
- // varPg = getPlanRecods(putPlanRecods(), varPg, pd);
- // String scientificPlanSum = findScientificPlanSum(pd);
- // if (scientificPlanSum != null) {
- // varPg.put("SCIENTIFIC_DESIGN", Double.parseDouble(scientificPlanSum)); // 科研项目
- // }
- // String equipmentPlanSum = findEquipmentPlanSum(pd);
- // if (equipmentPlanSum != null) {
- // varPg.put("DEVICE_DESIGN", Double.parseDouble(equipmentPlanSum)); // 设备大修
- // }
- // if (dailyPlanCost != "") {
- // varPg.put("DAILY_PLAN_COST", Double.parseDouble(dailyPlanCost));
- // }
- //
- // // 完成费用
- // varPg = getCompRecods(putCompRecods(), varPg, pd);
- pd.put("VIEW_NAME", "annual_comp_sumtable_view");
- varPg = annualDailyCompService.findViewRecords(pd); //获取视图返回结果
- pd.put("FROM_TABLE", "highway_annual_plan_sumtable");
- PageData tempPg = annualDailyCompService.findAllRecods(pd);
- if(tempPg != null){
- if(tempPg.get("DAILY_REMARKS") != null){
- varPg.put("DAILY_REMARKS", tempPg.get("DAILY_REMARKS"));
- }
- if(tempPg.get("PREVENTION_REMARKS") != null){
- varPg.put("PREVENTION_REMARKS", tempPg.get("PREVENTION_REMARKS"));
- }
- if(tempPg.get("REPAIR_REMARKS") != null){
- varPg.put("REPAIR_REMARKS", tempPg.get("REPAIR_REMARKS"));
- }
- if(tempPg.get("TEST_REMARKS") != null){
- varPg.put("TEST_REMARKS", tempPg.get("TEST_REMARKS"));
- }
- if(tempPg.get("SCIENTIFIC_REMARKS") != null){
- varPg.put("SCIENTIFIC_REMARKS", tempPg.get("SCIENTIFIC_REMARKS"));
- }
- if(tempPg.get("DEVICE_REMARKS") != null){
- varPg.put("DEVICE_REMARKS", tempPg.get("DEVICE_REMARKS"));
- }
- if(tempPg.get("RESERVE_REMARKS") != null){
- varPg.put("RESERVE_REMARKS", tempPg.get("RESERVE_REMARKS"));
- }
- }
- varPg = dealCompSum(varPg);
- varList.add(varPg);
- } else if ("highway_daily_plan_statable".equalsIgnoreCase(tableType)) {
- pd.put("FROM_TABLE", "highway_daily_plan_statable");
- varList = annualDailyCompService.getAllRecords(pd); // 计划
- } else if ("highway_prevention_plan_sumtable".equalsIgnoreCase(tableType)) {
- pd.put("FROM_TABLE", "highway_prevention_project_dettable");
- List<PageData> tempList = annualDailyCompService.getAllRecords(pd); // 计划
- for (PageData temppd : tempList) {
- if(temppd.get("QUANTITIES") != null){
- temppd.put("PLAN_QUANTITIES", temppd.get("QUANTITIES"));
- }
- if(temppd.get("AUDIT_FEE") != null){
- temppd.put("PLAN_COST", temppd.get("AUDIT_FEE"));
- }else{
- temppd.put("PLAN_COST", temppd.get("TOTAL_COST"));
- }
- if(temppd.get("SJWCGCL") != null){
- temppd.put("ACTUAL_QUANTITIES", temppd.get("SJWCGCL"));
- }
- temppd.put("PROJECT_TYPE", temppd.get("CATEGORY"));
- temppd.put("SCALE", temppd.get("PROJECT_SCALE"));
- if(temppd.get("OTHER_MATTER") != null){
- temppd.put("REMARKS", temppd.get("OTHER_MATTER"));
- }
- pd.put("FROM_TABLE", "monthly_prevention_completion");
- pd.put("PROJECT_NAME", temppd.get("PROJECT_NAME"));
- Object actualCost = annualDailyCompService.getCompSumForProject(pd); // 获取每个项目的实际费用
- if(actualCost != null){
- BigDecimal actual = getBigDecimal(actualCost);
- temppd.put("ACTUAL_COST", actual);
- }
- if(temppd.get("ACTUAL_COST") != null && temppd.get("PLAN_COST")!= null){
- temppd.put("COMPLETE_RATIO", math(temppd.get("ACTUAL_COST"),temppd.get("PLAN_COST")).toString());
- }
- varList.add(temppd);
- }
- } else if ("highway_repair_comp_sumtable".equalsIgnoreCase(tableType)) {
- pd.put("FROM_TABLE", "highway_repair_project_dettable");
- List<PageData> tempList = annualDailyCompService.getAllRecords(pd); // 计划
- for (PageData temppd : tempList) {
- if(temppd.get("QUANTITIES") != null){
- temppd.put("PLAN_QUANTITIES", temppd.get("QUANTITIES"));
- }
- if(temppd.get("AUDIT_FEE") != null){
- temppd.put("PLAN_COST", temppd.get("AUDIT_FEE"));
- }else if(temppd.get("TOTAL_COST") != null){
- temppd.put("PLAN_COST", temppd.get("TOTAL_COST"));
- }
- if(temppd.get("SJWCGCL") != null){
- temppd.put("ACTUAL_QUANTITIES", temppd.get("SJWCGCL"));
- }
- temppd.put("PROJECT_TYPE", temppd.get("CATEGORY"));
- temppd.put("SCALE", temppd.get("PROJECT_SCALE"));
- if(temppd.get("OTHER_MATTER") != null){
- temppd.put("REMARKS", temppd.get("OTHER_MATTER"));
- }
- pd.put("FROM_TABLE", "monthly_repair_completion");
- pd.put("PROJECT_NAME", temppd.get("PROJECT_NAME"));
- Object actualCost = annualDailyCompService.getCompSumForProject(pd); // 获取每个项目的实际费用
- if(actualCost != null){
- BigDecimal actual = getBigDecimal(actualCost);
- temppd.put("ACTUAL_COST", actual);
- }
- if(temppd.get("ACTUAL_COST") != null && temppd.get("PLAN_COST")!= null){
- if(!"0.0".equals(temppd.get("PLAN_COST").toString())){
- temppd.put("COMPLETE_RATIO", math(temppd.get("ACTUAL_COST"),temppd.get("PLAN_COST")).toString());
- }
- }
- varList.add(temppd);
- }
- } else if ("highway_daily_comp_sumtable".equalsIgnoreCase(tableType)) {
- // pd.put("FROM_TABLE", "highway_daily_plan_statable");
- // List<PageData> tempList = annualDailyCompService.getAllRecords(pd); // 计划
- // PageData temppd = new PageData();
- // if(tempList.size() > 0){
- // temppd = tempList.get(0);
- // }else{
- // temppd = pd;
- // }
- // for(String type : annDailyCompType){
- // pd.put("TYPE", type);
- // String payCost = annualDailyCompService.getDaliyCompRecord(pd); // 获取每个项目的实际费用
- // if(payCost != null){
- // temppd.put(type, payCost);
- // }
- // }
- pd.put("VIEW_NAME", "annual_daily_comp_sumtable_view");
- PageData temppd = annualDailyCompService.findViewRecords(pd); //获取视图返回结果
- if(temppd != null){
- varList.add(temppd);
- }
- } else if ("highway_special_comp_sumtable".equalsIgnoreCase(tableType)) {
- /*pd.put("FROM_TABLE", "highway_special_plan_statable");
- List<PageData> tempList = annualDailyCompService.getAllRecords(pd); // 计划
- for (PageData temppd : tempList) {
- temppd.put("PLAN_COST", temppd.get("ESTIMATION"));
- pd.put("FROM_TABLE", "monthly_special_completion");
- pd.put("PROJECT_NAME", temppd.get("SPECIAL_PROJECT_NAME"));
- String compSum = annualDailyCompService.getCompSumForProject(pd); // 获取每个项目的实际费用
- if (compSum != null) {
- temppd.put("ACTUAL_COST", Double.parseDouble(compSum));
- }
- varList.add(temppd);
- }*/
- pd.put("FROM_TABLE", "highway_special_comp_sumtable_view");
- List<PageData> tempList = annualDailyCompService.getAllRecords(pd); // 计划
- for (PageData temppd : tempList) {
- if(temppd.get("PLAN_COST") != null){
- temppd.put("PLAN_COST", temppd.get("PLAN_COST"));
- }
- Object actualCost = temppd.get("ACTUAL_COST");
- if(actualCost != null){
- BigDecimal actual = getBigDecimal(actualCost);
- temppd.put("ACTUAL_COST", actual);
- }
- varList.add(temppd);
- }
- } else if ("highway_test_comp_sumtable".equalsIgnoreCase(tableType)) {
- // 计划费用
- pd.put("FROM_TABLE", "highway_test_plan_statable");
- List<PageData> tempList = annualDailyCompService.getAllRecords(pd); // 计划
- for (PageData temppd : tempList) {
- if(temppd.get("COST_ESTIMAT") != null){
- temppd.put("PLAN_COST", temppd.get("COST_ESTIMAT"));
- }
- pd.put("FROM_TABLE", "monthly_test_project_completion");
- if(temppd.get("PROJECT_NAME") != null){
- pd.put("PROJECT_NAME", temppd.get("PROJECT_NAME"));
- }
- String compSum = annualDailyCompService.getCompSumForProject(pd); // 获取每个项目的实际费用
- if (compSum != null) {
- BigDecimal actual = getBigDecimal(compSum);
- temppd.put("ACTUAL_COST", actual);
- }
- varList.add(temppd);
- }
- } else if ("highway_scientific_comp_sumtable".equalsIgnoreCase(tableType)) { // 科研项目
- // 计划费用
- pd.put("FROM_TABLE", "highway_scientific_plan_statable");
- List<PageData> tempList = annualDailyCompService.getAllRecords(pd); // 计划
- for (PageData temppd : tempList) {
- temppd.put("PLAN_COST", temppd.get("COST_ESTIMAT"));
- pd.put("FROM_TABLE", "monthly_scientific_project_completion");
- pd.put("PROJECT_NAME", temppd.get("PROJECT_NAME"));
- String compSum = annualDailyCompService.getCompSumForProject(pd); // 获取每个项目的实际费用
- if (compSum != null) {
- temppd.put("ACTUAL_COST", Double.parseDouble(compSum));
- }
- varList.add(temppd);
- }
- } else if ("highway_equipment_overhaul_comp_sumtable".equalsIgnoreCase(tableType)) { // 设备大修
- // 计划费用
- pd.put("FROM_TABLE", "highway_equipment_overhaul_plan_statable");
- List<PageData> tempList = annualDailyCompService.getAllRecords(pd); // 计划
- for (PageData temppd : tempList) {
- temppd.put("PLAN_COST", temppd.get("ESTIMATE_COST"));
- pd.put("FROM_TABLE", "monthly_equipment_overhaul_completion");
- pd.put("PROJECT_NAME", temppd.get("PROJECT_NAME"));
- String compSum = annualDailyCompService.getCompSumForProject(pd); // 获取每个项目的实际费用
- if (compSum != null) {
- temppd.put("ACTUAL_COST", compSum);
- }
- varList.add(temppd);
- }
- } else if ("highway_quality_goals_table".equalsIgnoreCase(tableType)) { // 高速公路养护质量目标表
- PageData temppd = annualDailyCompService.getQualityRecords(pd); // 现状
- /*StringBuffer TECHNOLOGY_STATUS = new StringBuffer();
- if (temppd != null) {
- TECHNOLOGY_STATUS.append("一类桥梁占比:" + temppd.get("ONE_BRIDGE_PRO"));
- TECHNOLOGY_STATUS.append("\r\n");
- TECHNOLOGY_STATUS.append("二类桥梁占比:" + temppd.get("TWO_BRIDGE_PRO"));
- temppd.put("TECHNOLOGY_STATUS", TECHNOLOGY_STATUS.toString());*/
- varList.add(temppd);
- // }
- } else if ("highway_annual_plan_sumtable".equalsIgnoreCase(tableType)) {
- // 计划费用
- /*PageData tempPg = annualDailyCompService.findDaliyPlanRecord(pd); // 日常养护
- String dailyPlanCost = dailyPlanCostSum(tempPg);
- varPg = annualDailyCompService.findTableInfo(pd);
- varPg.put("YEAR", pd.get("YEAR"));
- varPg = getPlanRecods(putPlanRecods(), varPg, pd);
- String scientificPlanSum = findScientificPlanSum(pd);
- if (scientificPlanSum != null) {
- varPg.put("SCIENTIFIC_PLAN_COST", Double.parseDouble(scientificPlanSum)); // 科研项目
- }
- String equipmentPlanSum = findEquipmentPlanSum(pd);
- if (equipmentPlanSum != null) {
- varPg.put("DEVICE_PLAN_COST", Double.parseDouble(equipmentPlanSum)); // 设备大修
- }
- if (dailyPlanCost != "") {
- varPg.put("DAILY_PLAN_COST", Double.parseDouble(dailyPlanCost));
- }
- PageData totalCost = annualDailyCompService.getReserveFeesTotal(pd);
- if (totalCost != null) {
- if(totalCost.get("TOTAL_COST") != null){
- varPg.put("RESERVE_PLAN_COST", Double.parseDouble(totalCost.get("TOTAL_COST").toString()));
- }
- }*/
- //pd.put("VIEW_NAME", "annual_comp_sumtable_view");
- pd.put("VIEW_NAME", "highway_annual_plan_sumtable_view");
- varPg = annualDailyCompService.findViewRecords(pd); //获取视图返回结果
- /*if(varPg != null){
- List<Object> subVar = new ArrayList<Object>();
- subVar.add(varPg.get("MINOR_PREVENTION_DESIGN"));
- subVar.add(varPg.get("MIDDLE_PREVENTION_DESIGN"));
- subVar.add(varPg.get("OVERHAUL_PREVENTION_DESIGN"));
- String sum1 = getSum(subVar);
- if(!"0.0".equalsIgnoreCase(sum1)){
- varPg.put("PREVENTION_PLAN_COST", sum1);
- }
- subVar = new ArrayList<Object>();
- subVar.add(varPg.get("MINOR_REPAIR_DESIGN"));
- subVar.add(varPg.get("MIDDLE_REPAIR_DESIGN"));
- subVar.add(varPg.get("OVERHAUL_DESIGN"));
- String sum2 = getSum(subVar);
- if(!"0.0".equalsIgnoreCase(sum2)){
- varPg.put("REPAIR_PLAN_COST", sum2);
- }
- }*/
- pd.put("FROM_TABLE", "highway_annual_plan_sumtable");
- PageData tempPg = annualDailyCompService.findAllRecods(pd);
- if(tempPg != null){
- if(tempPg.get("DAILY_REMARKS") != null){
- varPg.put("DAILY_REMARKS", tempPg.get("DAILY_REMARKS"));
- }
- if(tempPg.get("PREVENTION_REMARKS") != null){
- varPg.put("PREVENTION_REMARKS", tempPg.get("PREVENTION_REMARKS"));
- }
- if(tempPg.get("REPAIR_REMARKS") != null){
- varPg.put("REPAIR_REMARKS", tempPg.get("REPAIR_REMARKS"));
- }
- if(tempPg.get("TEST_REMARKS") != null){
- varPg.put("TEST_REMARKS", tempPg.get("TEST_REMARKS"));
- }
- if(tempPg.get("SCIENTIFIC_REMARKS") != null){
- varPg.put("SCIENTIFIC_REMARKS", tempPg.get("SCIENTIFIC_REMARKS"));
- }
- if(tempPg.get("DEVICE_REMARKS") != null){
- varPg.put("DEVICE_REMARKS", tempPg.get("DEVICE_REMARKS"));
- }
- if(tempPg.get("RESERVE_REMARKS") != null){
- varPg.put("RESERVE_REMARKS", tempPg.get("RESERVE_REMARKS"));
- }
- }
- varList.add(varPg);
- } else if ("highway_prevention_plan_statable".equalsIgnoreCase(tableType)) { // 预防养护计划统计
- pd.put("FROM_TABLE", tableType);
- varList = annualDailyCompService.getAllRecords(pd); // 计划
- for(PageData tpd: varList){
- if(tpd.get("AUDIT_FEE") != null){
- tpd.put("ESTIMATION", tpd.get("AUDIT_FEE"));
- }
- }
- } else if ("highway_repair_plan_statable".equalsIgnoreCase(tableType)) { // 修复养护计划统计
- pd.put("FROM_TABLE", tableType);
- varList = annualDailyCompService.getAllRecords(pd); // 计划
- for(PageData tpd: varList){
- if(tpd.get("AUDIT_FEE") != null){
- tpd.put("ESTIMATION", tpd.get("AUDIT_FEE"));
- }
- }
- } else if ("highway_special_plan_statable".equalsIgnoreCase(tableType)) { // 专项养护计划统计
- pd.put("FROM_TABLE", tableType);
- varList = annualDailyCompService.getSpecialRecords(pd); // 计划
- for(PageData tpd: varList){
- if(tpd.get("AUDIT_FEE") != null){
- tpd.put("ESTIMATION", tpd.get("AUDIT_FEE"));
- }else if(tpd.get("PROJECT_COST") != null){
- tpd.put("ESTIMATION", tpd.get("PROJECT_COST"));
- }
- }
- } else if ("highway_test_plan_statable".equalsIgnoreCase(tableType)) { // 检测项目计划统计
- pd.put("FROM_TABLE", tableType);
- varList = annualDailyCompService.getAllRecords(pd); // 计划
- for(PageData tpd: varList){
- if(tpd.get("AUDIT_FEE") != null){
- tpd.put("COST_ESTIMAT", tpd.get("AUDIT_FEE"));
- }
- }
- } else if ("highway_scientific_plan_statable".equalsIgnoreCase(tableType)) { // 科研项目计划统计
- pd.put("FROM_TABLE", tableType);
- varList = annualDailyCompService.getAllRecords(pd); // 计划
- for (PageData var : varList) {
- if (var.get("RESEARCH_CONTENTS") != null) {
- var.put("CONTENTS", var.get("RESEARCH_CONTENTS"));
- }
- if(var.get("AUDIT_FEE") != null){
- var.put("COST_ESTIMAT", var.get("AUDIT_FEE"));
- }
- }
- } else if ("highway_equipment_overhaul_plan_statable".equalsIgnoreCase(tableType)) { // 设备大修计划统计
- pd.put("FROM_TABLE", tableType);
- varList = annualDailyCompService.getAllRecords(pd); // 计划
- for(PageData tpd: varList){
- if(tpd.get("AUDIT_FEE") != null){
- tpd.put("ESTIMATE_COST", tpd.get("AUDIT_FEE"));
- }
- }
- } else if ("highway_reserve_fees_sumtable".endsWith(tableType)) { // 预备费
- pd.put("FROM_TABLE", tableType);
- List<PageData> tempList = annualDailyCompService.getAllRecords(pd);
- PageData totalCost = annualDailyCompService.getReserveFeesTotal(pd);
- if (tempList.size() > 0) {
- for (PageData varpd : tempList) {
- BigDecimal actual_cost = getBigDecimal(varpd.get("ACTUAL_COST"));
- varpd.put("ACTUAL_COST", actual_cost);
- varList.add(varpd);
- }
- }
- if (totalCost != null && totalCost.get("TOTAL_COST") != null) {
- pd.put("TOTAL_COST", Double.parseDouble(totalCost.get("TOTAL_COST").toString()));
- }
- //varList.add(pd);
- }
- // 年度总报告数据
- else if ("annual_comp_sumtable".equalsIgnoreCase(tableType)) { // 单位养护计划完成情况汇总表
- varList = getAnnualCompRecods(pd);
- } else if ("annual_daily_comp_sumtable".equalsIgnoreCase(tableType)) { // 日常养护计划完成情况汇总表
- varList = getAnnualDailyCompRecod(pd);
- } else if ("annual_prevention_comp_sumtable".equalsIgnoreCase(tableType)) { // 预防养护计划完成情况汇总表
- varList = getPreventionCompRecod(pd);
- } else if ("annual_repair_comp_sumtable".equalsIgnoreCase(tableType)) { // 单位修复养护计划完成情况汇总表
- varList = getRepairCompRecod(pd);
- } else if ("annual_plan_sumtable".equalsIgnoreCase(tableType)) { // 单位养护计划汇总表
- //varList = getAnnualPlanRecod(pd);
- pd.put("VIEW_NAME", "annual_comp_sumtable_view");
- varList = annualDailyCompService.findViewRecordsList(pd); //获取视图返回结果
- } else if ("annual_daily_plan_sumtable".equalsIgnoreCase(tableType)) { // 单位日常养护计划汇总表
- varList = getAnnualDailyPlanRecod(pd);
- } else if ("annual_prevention_plan_sumtable".equalsIgnoreCase(tableType)) { // 单位预防养护计划汇总表
- //varList = getPreventionPlanRecod(pd);
- pd.put("VIEW_NAME", "annual_prevention_comp_sumtable_view");
- varList = annualDailyCompService.findViewRecordsList(pd); //获取视图返回结果
- } else if ("annual_repair_plan_sumtable".equalsIgnoreCase(tableType)) { // 单位修复养护计划汇总表
- //varList = getRepairPlanRecod(pd);
- pd.put("VIEW_NAME", "annual_repair_comp_sumtable_view");
- varList = annualDailyCompService.findViewRecordsList(pd); //获取视图返回结果
- }
- return varList;
- }
-
- // 算完成比例
- public Double math(Object act_cost, Object plan_cost) throws NumberFormatException, Exception {
- return Double.parseDouble(act_cost.toString())/Double.parseDouble(plan_cost.toString())*100;
- }
-
- // 计算费用/公里
- public Double mathKm(Object act_cost, Object plan_cost) throws NumberFormatException, Exception {
- return Double.parseDouble(act_cost.toString())/Double.parseDouble(plan_cost.toString());
- }
-
- private PageData dealCompSum(PageData varPg){
- if(varPg != null){
- List<Object> subVar = new ArrayList<Object>();
- subVar.add(varPg.get("MINOR_PREVENTION_DESIGN"));
- subVar.add(varPg.get("MIDDLE_PREVENTION_DESIGN"));
- subVar.add(varPg.get("OVERHAUL_PREVENTION_DESIGN"));
- String sum1 = getSum(subVar);
- if(!"0.0".equalsIgnoreCase(sum1)){
- varPg.put("PREVENTION_PLAN_COST", sum1);
- }
- subVar = new ArrayList<Object>();
- subVar.add(varPg.get("MINOR_PREVENTION_COMPLETE"));
- subVar.add(varPg.get("MIDDLE_PREVENTION_COMPLETE"));
- subVar.add(varPg.get("OVERHAUL_PREVENTION_COMPLETE"));
- String sum3 = getSum(subVar);
- if(!"0.0".equalsIgnoreCase(sum3)){
- varPg.put("PREVENTION_COMPLETE_COST", sum3);
- }
- subVar = new ArrayList<Object>();
- subVar.add(varPg.get("MINOR_REPAIR_DESIGN"));
- subVar.add(varPg.get("MIDDLE_REPAIR_DESIGN"));
- subVar.add(varPg.get("OVERHAUL_DESIGN"));
- String sum2 = getSum(subVar);
- if(!"0.0".equalsIgnoreCase(sum2)){
- varPg.put("REPAIR_PLAN_COST", sum2);
- }
- subVar = new ArrayList<Object>();
- subVar.add(varPg.get("MINOR_REPAIR_COMPLETE"));
- subVar.add(varPg.get("MIDDLE_REPAIR_COMPLETE"));
- subVar.add(varPg.get("OVERHAUL_COMPLETE"));
- String sum4 = getSum(subVar);
- if(!"0.0".equalsIgnoreCase(sum4)){
- varPg.put("REPAIR_COMPLETE_COST", sum4);
- }
- if(varPg.get("SPECIAL_DESIGN")!=null){
- varPg.put("SPECIAL_PLAN_COST", varPg.get("SPECIAL_DESIGN"));
- }
- if(varPg.get("SPECIAL_COMPLETE")!=null){
- varPg.put("SPECIAL_COMPLETE_COST", varPg.get("SPECIAL_COMPLETE"));
- }
- if(varPg.get("EMERGENCY_DESIGN")!=null){
- varPg.put("EMERGENCY_PLAN_COST", varPg.get("EMERGENCY_DESIGN"));
- }
- if(varPg.get("EMERGENCY_COMPLETE")!=null){
- varPg.put("EMERGENCY_COMPLETE_COST", varPg.get("EMERGENCY_COMPLETE"));
- }
- if(varPg.get("TEST_DESIGN")!=null){
- varPg.put("TEST_PLAN_COST", varPg.get("TEST_DESIGN"));
- }
- if(varPg.get("TEST_COMPLETE")!=null){
- varPg.put("TEST_COMPLETE_COST", varPg.get("TEST_COMPLETE"));
- }
- if(varPg.get("SCIENTIFIC_DESIGN")!=null){
- varPg.put("SCIENTIFIC_PLAN_COST", varPg.get("SCIENTIFIC_DESIGN"));
- }
- if(varPg.get("SCIENTIFIC_COMPLETE")!=null){
- varPg.put("SCIENTIFIC_COMPLETE_COST", varPg.get("SCIENTIFIC_COMPLETE"));
- }
- if(varPg.get("DEVICE_DESIGN")!=null){
- varPg.put("DEVICE_PLAN_COST", varPg.get("DEVICE_DESIGN"));
- }
- if(varPg.get("DEVICE_COMPLETE")!=null){
- varPg.put("DEVICE_COMPLETE_COST", varPg.get("DEVICE_COMPLETE"));
- }
- if(varPg.get("RESERVE_DESIGN")!=null){
- varPg.put("RESERVE_PLAN_COST", varPg.get("RESERVE_DESIGN"));
- }
- if(varPg.get("RESERVE_COMPLETE")!=null){
- varPg.put("RESERVE_COMPLETE_COST", varPg.get("RESERVE_COMPLETE"));
- }
- if(varPg.get("DAILY_DESIGN")!=null){
- varPg.put("DAILY_PLAN_COST", varPg.get("DAILY_DESIGN"));
- }
- if(varPg.get("DAILY_COMPLETE")!=null){
- varPg.put("DAILY_COMPLETE_COST", varPg.get("DAILY_COMPLETE"));
- }
-
- }
- return varPg;
- }
- private String getSum(List<Object> subVar){
- Double sumNum = (double) 0;
- for(Object var : subVar){
- if(var != null){
- sumNum += Double.parseDouble(var.toString());
- }
- }
- return String.valueOf(sumNum);
- }
- private List<PageData> getAnnualPlanRecod(PageData pd) throws Exception {
- List<PageData> pdateList = annualDailyCompService.getKmInfo(pd);
- for (PageData pdata : pdateList) {
- pd.put("ROAD_ID", pdata.get("ROAD_ID"));
- pd.put("ROAD", pdata.get("ROAD"));
- pdata.put("YEAR", pd.get("YEAR"));
- PageData tempPg = annualDailyCompService.findDaliyPlanRecord(pd); // 日常养护
- String dailyPlanCost = dailyPlanCostSum(tempPg);
- if (dailyPlanCost != null && !"".equals(dailyPlanCost)) {
- pdata.put("DAILY_COST", Double.parseDouble(dailyPlanCost)); // 日常养护计划费用
- }
- pdata = getPreAndRepPlanCost(pd, pdata, "highway_prevention_project_dettable_cost",
- "highway_prevention_project_dettable", "PREVENTION"); // 获取预防养护大中小修的计划费用
- pdata = getPreAndRepPlanCost(pd, pdata, "highway_repair_project_dettable_cost",
- "highway_repair_project_dettable", "REPAIR"); // 获取修复养护大中小修的计划费用
- Map<String, String> tableInfo = new HashMap<String, String>();
- tableInfo.put("highway_special_project_dettable", "SPECIAL"); // 专项养护
- tableInfo.put("highway_test_project_dettable", "TEST_PROJECT"); // 试验检测项目
- pdata = getPlanRecods(tableInfo, pdata, pd);
- String scientificPlanSum = findScientificPlanSum(pd);
- if (scientificPlanSum != null && !"".equals(scientificPlanSum)) {
- pdata.put("SCIENTIFIC", Double.parseDouble(scientificPlanSum)); // 科研项目
- }
- String equipmentPlanSum = findEquipmentPlanSum(pd);
- if (equipmentPlanSum != null && !"".equals(equipmentPlanSum)) {
- pdata.put("DEVICE", Double.parseDouble(equipmentPlanSum)); // 设备大修
- }
- String reservePlanSum = findReservePlanSum(pd);
- if (reservePlanSum != null && !"".equals(reservePlanSum)) {
- pdata.put("RESERVE", Double.parseDouble(reservePlanSum)); // 预备费
- }
- }
- return pdateList;
- }
- private List<PageData> getRepairCompRecod(PageData pd) throws Exception {
- // List<PageData> pdateList = annualDailyCompService.getKmInfo(pd);
- // for (PageData pdata : pdateList) {
- // pd.put("ROAD_ID", pdata.get("ROAD_ID"));
- // pd.put("ROAD", pdata.get("ROAD"));
- // pdata.put("YEAR", pd.get("YEAR"));
- // Map<String, String> tableInfo = new HashMap<String, String>();
- // tableInfo.put("highway_repair_project_dettable", "PLAN_COST"); // 修复养护
- // pdata = getPlanRecods(tableInfo, pdata, pd); // 修复养护计划费用
- // // 按规模和类别统计完成费用
- // Map<String, String> preventionType = getPreventionType(); // 修复养护类型同预防养护
- // pdata = getRepairCompRecods(preventionType, pdata, pd);
- // }
- List<PageData> pdateList = annualDailyCompService.getRepairCompRecod(pd);
- for(PageData tpd : pdateList){
- if(tpd.get("TOTAL")!=null && tpd.get("PLAN_COST")!=null){
- tpd.put("COM_RETIO", math(tpd.get("TOTAL"),tpd.get("PLAN_COST")).toString());
- }
- }
- return pdateList;
- }
- private List<PageData> getRepairPlanRecod(PageData pd) throws Exception {
- List<PageData> pdateList = annualDailyCompService.getKmInfo(pd);
- for (PageData pdata : pdateList) {
- pd.put("ROAD_ID", pdata.get("ROAD_ID"));
- pd.put("ROAD", pdata.get("ROAD"));
- pdata.put("YEAR", pd.get("YEAR"));
- // 按规模和类别统计计划费用
- Map<String, String> preventionType = getPreventionPlanType(); // 修复养护类型同预防养护
- pdata = getRepairPlanRecods(preventionType, pdata, pd);
- }
- return pdateList;
- }
- private List<PageData> getPreventionCompRecod(PageData pd) throws Exception {
- List<PageData> pdateList = annualDailyCompService.getKmInfo(pd);
- for (PageData pdata : pdateList) {
- pd.put("ROAD_ID", pdata.get("ROAD_ID"));
- pd.put("ROAD", pdata.get("ROAD"));
- pdata.put("YEAR", pd.get("YEAR"));
- Map<String, String> tableInfo = new HashMap<String, String>();
- tableInfo.put("highway_prevention_project_dettable", "PLAN_COST"); // 预防养护
- pdata = getPlanRecods(tableInfo, pdata, pd); // 预防养护计划费用
- // 按类别统计完成费用
- Map<String, String> preventionType = getPreventionType();
- pdata = getPreventionCompRecods(preventionType, pdata, pd);
- }
- return pdateList;
- }
- private List<PageData> getPreventionPlanRecod(PageData pd) throws Exception {
- List<PageData> pdateList = annualDailyCompService.getKmInfo(pd);
- for (PageData pdata : pdateList) {
- pd.put("ROAD_ID", pdata.get("ROAD_ID"));
- pd.put("ROAD", pdata.get("ROAD"));
- pdata.put("YEAR", pd.get("YEAR"));
- Map<String, String> tableInfo = new HashMap<String, String>();
- tableInfo.put("highway_prevention_project_dettable", "TOTAL"); // 预防养护
- pdata = getPlanRecods(tableInfo, pdata, pd); // 预防养护计划费用
- // 按类别统计完成费用
- Map<String, String> preventionType = getPreventionPlanType();
- pdata = getPreventionPlanRecods(preventionType, pdata, pd);
- }
- return pdateList;
- }
- private Map<String, String> getPreventionType() throws Exception {
- Map<String, String> preventionType = new HashMap<String, String>();
- preventionType.put("路基", "SUBGRADE_COST");
- preventionType.put("路面", "PAVEMENT_COST");
- preventionType.put("桥涵", "BRIDGE_COST");
- preventionType.put("隧道", "TUNNEL_COST");
- preventionType.put("交安设施", "TRAFFIC_SAFE_COST");
- preventionType.put("沿线设施", "ROADSIDE_COST");
- preventionType.put("绿化", "GREEN_COST");
- preventionType.put("其他", "OTHER_COST");
- return preventionType;
- }
- private Map<String, String> getPreventionPlanType() throws Exception {
- Map<String, String> preventionType = new HashMap<String, String>();
- preventionType.put("路基", "SUBGRADE");
- preventionType.put("路面", "PAVEMENT");
- preventionType.put("桥涵", "BRIDGE");
- preventionType.put("隧道", "TUNNEL");
- preventionType.put("交安设施", "TRAFFIC_SAFE");
- preventionType.put("沿线设施", "ROADSIDE");
- preventionType.put("绿化", "GREEN");
- preventionType.put("其他", "OTHER");
- return preventionType;
- }
- private PageData getPreventionCompRecods(Map<String, String> preventionType, PageData pdata, PageData pd)
- throws Exception {
- Double sumCost = (double) 0;
- for (Map.Entry<String, String> entry : preventionType.entrySet()) {
- System.out.println("key=" + entry.getKey() + "\tvalue=" + entry.getValue());
- pd.put("CATEGORY", entry.getKey());
- String getRecod = annualDailyCompService.findPreventionCompRecods(pd);
- if (getRecod != null) {
- pdata.put(entry.getValue(), Double.parseDouble(getRecod));
- sumCost += Double.parseDouble(getRecod);
- }
- }
- pdata.put("SUM_COST", sumCost);
- return pdata;
- }
- private PageData getPreventionPlanRecods(Map<String, String> preventionType, PageData pdata, PageData pd)
- throws Exception {
- for (Map.Entry<String, String> entry : preventionType.entrySet()) {
- System.out.println("key=" + entry.getKey() + "\tvalue=" + entry.getValue());
- pd.put("CATEGORY", entry.getKey());
- String getRecod = annualDailyCompService.findPreventionPlanRecods(pd);
- if (getRecod != null) {
- pdata.put(entry.getValue(), Double.parseDouble(getRecod));
- }
- }
- return pdata;
- }
- private PageData getRepairCompRecods(Map<String, String> preventionType, PageData pdata, PageData pd)
- throws Exception {
- String[] PROJECT_SCALES = { "小修", "中修", "大修" };
- for (String PROJECT_SCALE : PROJECT_SCALES) {
- pd.put("PROJECT_SCALE", PROJECT_SCALE);
- Double sumCost = 0D;
- for (Map.Entry<String, String> entry : preventionType.entrySet()) {
- System.out.println("key=" + entry.getKey() + "\tvalue=" + entry.getValue());
- pd.put("CATEGORY", entry.getKey());
- String getRecod = annualDailyCompService.findRepairCompRecods(pd);
- if (getRecod != null) {
- if ("小修".equalsIgnoreCase(PROJECT_SCALE)) {
- pdata.put("MIN_" + entry.getValue(), Double.parseDouble(getRecod));
- sumCost += Double.parseDouble(getRecod);
- } else if ("中修".equalsIgnoreCase(PROJECT_SCALE)) {
- pdata.put("MID_" + entry.getValue(), Double.parseDouble(getRecod));
- sumCost += Double.parseDouble(getRecod);
- } else {
- pdata.put("MAX_" + entry.getValue(), Double.parseDouble(getRecod));
- sumCost += Double.parseDouble(getRecod);
- }
- }
- }
- if ("小修".equalsIgnoreCase(PROJECT_SCALE)) {
- pdata.put("MIN_SUM_COST", sumCost);
- } else if ("中修".equalsIgnoreCase(PROJECT_SCALE)) {
- pdata.put("MID_SUM_COST", sumCost);
- } else {
- pdata.put("MAX_SUM_COST", sumCost);
- }
- }
- return pdata;
- }
- private PageData getRepairPlanRecods(Map<String, String> preventionType, PageData pdata, PageData pd)
- throws Exception {
- String[] PROJECT_SCALES = { "小修", "中修", "大修" };
- for (String PROJECT_SCALE : PROJECT_SCALES) {
- pd.put("PROJECT_SCALE", PROJECT_SCALE);
- Double sumCost = 0D;
- for (Map.Entry<String, String> entry : preventionType.entrySet()) {
- System.out.println("key=" + entry.getKey() + "\tvalue=" + entry.getValue());
- pd.put("CATEGORY", entry.getKey());
- String getRecod = annualDailyCompService.findRepairPlanRecods(pd);
- if (getRecod != null) {
- if ("小修".equalsIgnoreCase(PROJECT_SCALE)) {
- pdata.put("MIN_" + entry.getValue(), Double.parseDouble(getRecod));
- sumCost += Double.parseDouble(getRecod);
- } else if ("中修".equalsIgnoreCase(PROJECT_SCALE)) {
- pdata.put("MID_" + entry.getValue(), Double.parseDouble(getRecod));
- sumCost += Double.parseDouble(getRecod);
- } else {
- pdata.put("MAX_" + entry.getValue(), Double.parseDouble(getRecod));
- sumCost += Double.parseDouble(getRecod);
- }
- }
- }
- if ("小修".equalsIgnoreCase(PROJECT_SCALE)) {
- pdata.put("MIN_SUM", sumCost);
- } else if ("中修".equalsIgnoreCase(PROJECT_SCALE)) {
- pdata.put("MID_SUM", sumCost);
- } else {
- pdata.put("MAX_SUM", sumCost);
- }
- }
- return pdata;
- }
- private List<PageData> getAnnualCompRecods(PageData pd) throws Exception {
- // List<PageData> pdateList = annualDailyCompService.getKmInfo(pd);
- // for (PageData pdata : pdateList) {
- // pd.put("ROAD_ID", pdata.get("ROAD_ID"));
- // pd.put("ROAD", pdata.get("ROAD"));
- // pdata.put("YEAR", pd.get("YEAR"));
- // PageData tempPg = annualDailyCompService.findDaliyPlanRecord(pd); // 日常养护
- // String dailyPlanCost = dailyPlanCostSum(tempPg);
- // if (dailyPlanCost != "") {
- // pdata.put("DAILY_DESIGN", Double.parseDouble(dailyPlanCost)); // 日常养护计划费用
- // }
- // pdata = getPreAndRepPlanCost(pd, pdata, "highway_prevention_project_dettable_cost",
- // "highway_prevention_project_dettable", "PREVENTION_DESIGN"); // 获取预防养护大中小修的计划费用
- // pdata = getPreAndRepPlanCost(pd, pdata, "highway_repair_project_dettable_cost",
- // "highway_repair_project_dettable", "REPAIR_DESIGN"); // 获取修复养护大中小修的计划费用
- //
- // Map<String, String> tableInfo = new HashMap<String, String>();
- // tableInfo.put("highway_special_project_dettable", "SPECIAL_DESIGN"); // 专项养护
- // tableInfo.put("highway_test_project_dettable", "TEST_DESIGN"); // 试验检测项目
- // pdata = getPlanRecods(tableInfo, pdata, pd);
- // String scientificPlanSum = findScientificPlanSum(pd);
- // if (scientificPlanSum != null) {
- // pdata.put("SCIENTIFIC_DESIGN", Double.parseDouble(scientificPlanSum)); // 科研项目
- // }
- // String equipmentPlanSum = findEquipmentPlanSum(pd);
- // if (equipmentPlanSum != null) {
- // pdata.put("DEVICE_DESIGN", Double.parseDouble(equipmentPlanSum)); // 设备大修
- // }
- // String reservePlanSum = findReservePlanSum(pd);
- // if (reservePlanSum != "") {
- // pdata.put("RESERVE_DESIGN", Double.parseDouble(reservePlanSum)); // 预备费
- // }
- // // 完成费用
- // pdata = getPreAndRepCompCost(pd, pdata, "monthly_prevention_completion",
- // "highway_prevention_project_dettable", "PREVENTION_COMPLETE"); // 获取预防养护大中小修的完成费用
- // pdata = getPreAndRepCompCost(pd, pdata, "monthly_repair_completion", "highway_repair_project_dettable",
- // "REPAIR_COMPLETE"); // 获取修复养护大中小修的完成费用
- // pdata = getCompRecods(putAnnualCompRecods(), pdata, pd);
- // // 预备费完成
- // String reserveCompSum = findReserveCompSum(pd);
- // if (reserveCompSum != "") {
- // pdata.put("RESERVE_COMPLETE", Double.parseDouble(reserveCompSum)); // 预备费
- // }
- // }
- pd.put("VIEW_NAME", "annual_comp_sumtable_view");
- List<PageData> pdateList = annualDailyCompService.findViewRecordsList(pd); //获取视图返回结果
- Double TOTAL_PREVENTION_DESIGN = 0.0;
- for(PageData tpd : pdateList){
- if(tpd.get("OVERHAUL_DESIGN") != null){
- tpd.put("OVERHAUL_REPAIR_DESIGN", tpd.get("OVERHAUL_DESIGN"));
- }
- if(tpd.get("OVERHAUL_COMPLETE") != null){
- tpd.put("OVERHAUL_REPAIR_COMPLETE", tpd.get("OVERHAUL_COMPLETE"));
- }
- TOTAL_PREVENTION_DESIGN = addThreeNum(tpd.get("MINOR_PREVENTION_DESIGN"), tpd.get("MIDDLE_PREVENTION_DESIGN"), tpd.get("OVERHAUL_PREVENTION_DESIGN"));
- if(TOTAL_PREVENTION_DESIGN != 0.0){
- tpd.put("TOTAL_PREVENTION_DESIGN", TOTAL_PREVENTION_DESIGN);
- }
- TOTAL_PREVENTION_DESIGN = addThreeNum(tpd.get("MINOR_PREVENTION_COMPLETE"), tpd.get("MIDDLE_PREVENTION_COMPLETE"), tpd.get("OVERHAUL_PREVENTION_COMPLETE"));
- if(TOTAL_PREVENTION_DESIGN != 0.0){
- tpd.put("TOTAL_PREVENTION_COMPLETE", TOTAL_PREVENTION_DESIGN);
- }
- TOTAL_PREVENTION_DESIGN = addThreeNum(tpd.get("MINOR_REPAIR_DESIGN"), tpd.get("MIDDLE_REPAIR_DESIGN"), tpd.get("OVERHAUL_DESIGN"));
- if(TOTAL_PREVENTION_DESIGN != 0.0){
- tpd.put("TOTAL_REPAIR_DESIGN", TOTAL_PREVENTION_DESIGN);
- }
- TOTAL_PREVENTION_DESIGN = addThreeNum(tpd.get("MINOR_REPAIR_COMPLETE"), tpd.get("MIDDLE_REPAIR_COMPLETE"), tpd.get("OVERHAUL_COMPLETE"));
- if(TOTAL_PREVENTION_DESIGN != 0.0){
- tpd.put("TOTAL_REPAIR_COMPLETE", TOTAL_PREVENTION_DESIGN);
- }
- //计算比例
- if(tpd.get("DAILY_COMPLETE") != null && tpd.get("DAILY_DESIGN")!= null){
- tpd.put("DAILY_PROPORTION", math(tpd.get("DAILY_COMPLETE"),tpd.get("DAILY_DESIGN")).toString());
- }
- if(tpd.get("DAILY_COMPLETE") != null && tpd.get("CARE_KM")!= null){
- tpd.put("DAILY_KM", mathKm(tpd.get("DAILY_COMPLETE"),tpd.get("CARE_KM")).toString());
- }
- if(tpd.get("MINOR_PREVENTION_COMPLETE") != null && tpd.get("MINOR_PREVENTION_DESIGN")!= null){
- tpd.put("MINOR_PREVENTION_PROPORTION", math(tpd.get("MINOR_PREVENTION_COMPLETE"),tpd.get("MINOR_PREVENTION_DESIGN")).toString());
- }
- if(tpd.get("MIDDLE_PREVENTION_COMPLETE") != null && tpd.get("MIDDLE_PREVENTION_DESIGN")!= null){
- tpd.put("MIDDLE_PREVENTION_PROPORTION", math(tpd.get("MIDDLE_PREVENTION_COMPLETE"),tpd.get("MIDDLE_PREVENTION_DESIGN")).toString());
- }
- if(tpd.get("OVERHAUL_PREVENTION_COMPLETE") != null && tpd.get("OVERHAUL_PREVENTION_DESIGN")!= null){
- tpd.put("OVERHAUL_PREVENTION_PROPORTION", math(tpd.get("OVERHAUL_PREVENTION_COMPLETE"),tpd.get("OVERHAUL_PREVENTION_DESIGN")).toString());
- }
- if(tpd.get("TOTAL_PREVENTION_COMPLETE") != null && tpd.get("TOTAL_PREVENTION_DESIGN")!= null){
- tpd.put("TOTAL_PREVENTION_PROPORTION", math(tpd.get("TOTAL_PREVENTION_COMPLETE"),tpd.get("TOTAL_PREVENTION_DESIGN")).toString());
- }
- if(tpd.get("MINOR_REPAIR_COMPLETE") != null && tpd.get("MINOR_REPAIR_DESIGN")!= null){
- tpd.put("MINOR_REPAIR_PROPORTION", math(tpd.get("MINOR_REPAIR_COMPLETE"),tpd.get("MINOR_REPAIR_DESIGN")).toString());
- }
- if(tpd.get("MIDDLE_REPAIR_COMPLETE") != null && tpd.get("MIDDLE_REPAIR_DESIGN")!= null){
- tpd.put("MIDDLE_REPAIR_PROPORTION", math(tpd.get("MIDDLE_REPAIR_COMPLETE"),tpd.get("MIDDLE_REPAIR_DESIGN")).toString());
- }
- if(tpd.get("OVERHAUL_REPAIR_COMPLETE") != null && tpd.get("OVERHAUL_REPAIR_DESIGN")!= null){
- tpd.put("OVERHAUL_REPAIR_PROPORTION", math(tpd.get("OVERHAUL_REPAIR_COMPLETE"),tpd.get("OVERHAUL_REPAIR_DESIGN")).toString());
- }
- if(tpd.get("TOTAL_REPAIR_COMPLETE") != null && tpd.get("TOTAL_REPAIR_DESIGN")!= null){
- tpd.put("TOTAL_REPAIR_PROPORTION", math(tpd.get("TOTAL_REPAIR_COMPLETE"),tpd.get("TOTAL_REPAIR_DESIGN")).toString());
- }
- if(tpd.get("SPECIAL_COMPLETE") != null && tpd.get("SPECIAL_DESIGN")!= null){
- tpd.put("SPECIAL_PROPORTION", math(tpd.get("SPECIAL_COMPLETE"),tpd.get("SPECIAL_DESIGN")).toString());
- }
- if(tpd.get("EMERGENCY_COMPLETE") != null && tpd.get("EMERGENCY_DESIGN")!= null){
- tpd.put("EMERGENCY_PROPORTION", math(tpd.get("EMERGENCY_COMPLETE"),tpd.get("EMERGENCY_DESIGN")).toString());
- }
- if(tpd.get("TEST_COMPLETE") != null && tpd.get("TEST_DESIGN")!= null){
- tpd.put("TEST_PROPORTION", math(tpd.get("TEST_COMPLETE"),tpd.get("TEST_DESIGN")).toString());
- }
- if(tpd.get("SCIENTIFIC_COMPLETE") != null && tpd.get("SCIENTIFIC_DESIGN")!= null){
- tpd.put("SCIENTIFIC_PROPORTION", math(tpd.get("SCIENTIFIC_COMPLETE"),tpd.get("SCIENTIFIC_DESIGN")).toString());
- }
- if(tpd.get("DEVICE_COMPLETE") != null && tpd.get("DEVICE_DESIGN")!= null){
- tpd.put("DEVICE_PROPORTION", math(tpd.get("DEVICE_COMPLETE"),tpd.get("DEVICE_DESIGN")).toString());
- }
- if(tpd.get("RESERVE_COMPLETE") != null && tpd.get("RESERVE_DESIGN")!= null){
- tpd.put("RESERVE_PROPORTION", math(tpd.get("RESERVE_COMPLETE"),tpd.get("RESERVE_DESIGN")).toString());
- }
- TOTAL_PREVENTION_DESIGN = addNineNum(tpd.get("TOTAL_PREVENTION_DESIGN"),tpd.get("TOTAL_REPAIR_DESIGN"),tpd.get("SPECIAL_DESIGN")
- ,tpd.get("EMERGENCY_DESIGN"),tpd.get("TEST_DESIGN"),tpd.get("SCIENTIFIC_DESIGN"),tpd.get("DEVICE_DESIGN")
- ,tpd.get("RESERVE_DESIGN"),tpd.get("DAILY_DESIGN"));
- if(TOTAL_PREVENTION_DESIGN != 0.0){
- tpd.put("TOTAL_DESIGN", TOTAL_PREVENTION_DESIGN);
- }
- TOTAL_PREVENTION_DESIGN = addNineNum(tpd.get("TOTAL_PREVENTION_COMPLETE"),tpd.get("TOTAL_REPAIR_COMPLETE"),tpd.get("SPECIAL_COMPLETE")
- ,tpd.get("EMERGENCY_COMPLETE"),tpd.get("TEST_COMPLETE"),tpd.get("SCIENTIFIC_COMPLETE"),tpd.get("DEVICE_COMPLETE")
- ,tpd.get("RESERVE_COMPLETE"),tpd.get("DAILY_COMPLETE"));
- if(TOTAL_PREVENTION_DESIGN != 0.0){
- tpd.put("TOTAL_COMPLETE", TOTAL_PREVENTION_DESIGN);
- }
- if(tpd.get("TOTAL_COMPLETE") != null && tpd.get("TOTAL_DESIGN")!= null){
- tpd.put("TOTAL_PROPORTION", math(tpd.get("TOTAL_COMPLETE"),tpd.get("TOTAL_DESIGN")).toString());
- }
- }
- return pdateList;
- }
-
- private Double addNums(List<Object> list){
- Double dou = 0.0;
- for(Object obj : list){
- if(obj != null){
- dou += Double.parseDouble(obj.toString());
- }
- }
- return dou;
- }
-
- private Double addThreeNum(Object obj1, Object obj2, Object obj3){
- Double dou = 0.0;
- if(obj1 != null){
- dou += Double.parseDouble(obj1.toString());
- }
- if(obj2 != null){
- dou += Double.parseDouble(obj2.toString());
- }
- if(obj3 != null){
- dou += Double.parseDouble(obj3.toString());
- }
- return dou;
- }
-
- private Double addNineNum(Object obj1, Object obj2, Object obj3,Object obj4, Object obj5, Object obj6,Object obj7, Object obj8, Object obj9){
- Double dou = 0.0;
- if(obj1 != null){
- dou += Double.parseDouble(obj1.toString());
- }
- if(obj2 != null){
- dou += Double.parseDouble(obj2.toString());
- }
- if(obj3 != null){
- dou += Double.parseDouble(obj3.toString());
- }
- if(obj4 != null){
- dou += Double.parseDouble(obj4.toString());
- }
- if(obj5 != null){
- dou += Double.parseDouble(obj5.toString());
- }
- if(obj6 != null){
- dou += Double.parseDouble(obj6.toString());
- }
- if(obj7 != null){
- dou += Double.parseDouble(obj7.toString());
- }
- if(obj8 != null){
- dou += Double.parseDouble(obj8.toString());
- }
- if(obj9 != null){
- dou += Double.parseDouble(obj9.toString());
- }
- return dou;
- }
-
- private Double add12Num(Object obj1, Object obj2, Object obj3,Object obj4, Object obj5, Object obj6
- ,Object obj7, Object obj8, Object obj9,Object obj10, Object obj11, Object obj12){
- Double dou = 0.0;
- if(obj1 != null){
- dou += Double.parseDouble(obj1.toString());
- }
- if(obj2 != null){
- dou += Double.parseDouble(obj2.toString());
- }
- if(obj3 != null){
- dou += Double.parseDouble(obj3.toString());
- }
- if(obj4 != null){
- dou += Double.parseDouble(obj4.toString());
- }
- if(obj5 != null){
- dou += Double.parseDouble(obj5.toString());
- }
- if(obj6 != null){
- dou += Double.parseDouble(obj6.toString());
- }
- if(obj7 != null){
- dou += Double.parseDouble(obj7.toString());
- }
- if(obj8 != null){
- dou += Double.parseDouble(obj8.toString());
- }
- if(obj9 != null){
- dou += Double.parseDouble(obj9.toString());
- }
- if(obj10 != null){
- dou += Double.parseDouble(obj10.toString());
- }
- if(obj11 != null){
- dou += Double.parseDouble(obj11.toString());
- }
- if(obj12 != null){
- dou += Double.parseDouble(obj12.toString());
- }
- return dou;
- }
-
-
- // 科研项目
- private String findScientificPlanSum(PageData pd) throws Exception {
- String scientificPlanSum = annualDailyCompService.findScientificPlanSum(pd);
- return scientificPlanSum;
- }
- // 设备大修
- private String findEquipmentPlanSum(PageData pd) throws Exception {
- String equipmentPlanSum = annualDailyCompService.findEquipmentPlanSum(pd);
- return equipmentPlanSum;
- }
- // 预备费计划
- private String findReservePlanSum(PageData pd) throws Exception {
- String reservePlanSum = "";
- pd.put("FROM_TABLE", "highway_reserve_fees_sumtable_total");
- PageData allRecods = annualDailyCompService.findAllRecods(pd);
- if (allRecods != null && allRecods.get("TOTAL_COST")!= null) {
- reservePlanSum = allRecods.get("TOTAL_COST").toString();
- }
- return reservePlanSum;
- }
- // 预备费完成
- private String findReserveCompSum(PageData pd) throws Exception {
- String reservePlanSum = "";
- pd.put("FROM_TABLE", "highway_reserve_fees_sumtable");
- PageData allRecods = annualDailyCompService.findAllRecods(pd);
- if (allRecods != null && allRecods.get("ACTUAL_COST")!=null) {
- reservePlanSum = allRecods.get("ACTUAL_COST").toString();
- }
- return reservePlanSum;
- }
- private PageData getPreAndRepPlanCost(PageData pd, PageData pdata, String tableNameA, String tableNameB,
- String kayWords) throws Exception {
- pd.put("FROM_TABLEA", tableNameA);
- pd.put("FROM_TABLEB", tableNameB);
- String[] PROJECT_SCALES = { "小修", "中修", "大修" };
- for (String PROJECT_SCALE : PROJECT_SCALES) {
- pd.put("PROJECT_SCALE", PROJECT_SCALE);
- String getRecod = annualDailyCompService.getPreAndRepPlanCost(pd);
- if (getRecod != null) {
- if ("小修".equalsIgnoreCase(PROJECT_SCALE)) {
- pdata.put("MINOR_" + kayWords, getRecod);
- } else if ("中修".equalsIgnoreCase(PROJECT_SCALE)) {
- pdata.put("MIDDLE_" + kayWords, getRecod);
- } else {
- pdata.put("OVERHAUL_" + kayWords, getRecod);
- }
- }
- }
- return pdata;
- }
- private PageData getPreAndRepCompCost(PageData pd, PageData pdata, String tableNameA, String tableNameB,
- String kayWords) throws Exception {
- pd.put("FROM_TABLEA", tableNameA);
- pd.put("FROM_TABLEB", tableNameB);
- String[] PROJECT_SCALES = { "小修", "中修", "大修" };
- for (String PROJECT_SCALE : PROJECT_SCALES) {
- pd.put("PROJECT_SCALE", PROJECT_SCALE);
- String getRecod = annualDailyCompService.getPreAndRepCompCost(pd);
- if (getRecod != null) {
- if ("小修".equalsIgnoreCase(PROJECT_SCALE)) {
- pdata.put("MINOR_" + kayWords, getRecod);
- } else if ("中修".equalsIgnoreCase(PROJECT_SCALE)) {
- pdata.put("MIDDLE_" + kayWords, getRecod);
- } else {
- pdata.put("OVERHAUL_" + kayWords, getRecod);
- }
- }
- }
- return pdata;
- }
- private List<PageData> getAnnualDailyCompRecod(PageData pd) throws Exception {
- // List<PageData> pdateList = annualDailyCompService.getKmInfo(pd);
- // for (PageData pdata : pdateList) {
- // pdata.put("YEAR", pd.get("YEAR"));
- // PageData queryData = pdata;
- // PageData tempPg = annualDailyCompService.findDaliyPlanRecord(queryData); // 日常养护
- // String dailyPlanCost = dailyPlanCostSum(tempPg);
- // if (dailyPlanCost != "") {
- // pdata.put("PLAN_COST", Double.parseDouble(dailyPlanCost));
- // }
- // for (String dct : annDailyCompType) {
- // queryData.put("TYPE", dct);
- // String compPdate = annualDailyCompService.findDaliyCompRecord(queryData);
- // if (compPdate != null) {
- // pdata.put(dct, compPdate);
- // }
- // }
- // }
- pd.put("VIEW_NAME", "annual_daily_comp_sumtable_view");
- List<PageData> pdateList = annualDailyCompService.findViewRecordsList(pd); //获取视图返回结果
- for(PageData tpd : pdateList){
- Double totalCost = add12Num(tpd.get("CLEAN_COST"),tpd.get("PATROL_COST"),tpd.get("SUBGRADE_COST"),tpd.get("PAVEMENT_COST")
- ,tpd.get("BRIDGE_COST"),tpd.get("CULVERT_COST"),tpd.get("TUNNEL_COST"),tpd.get("GREEN_COST"),tpd.get("SAFE_COST")
- ,tpd.get("LINE_COST"),tpd.get("CAR_COST"),tpd.get("EMERGENCY_COST"));
- if(totalCost != 0.0){
- tpd.put("TOTAL_COST", totalCost);
- }
- if(tpd.get("TOTAL_COST")!=null && tpd.get("CARE_KM")!=null){
- tpd.put("COST_KM", mathKm(tpd.get("TOTAL_COST"),tpd.get("CARE_KM")).toString());
- }
- if(tpd.get("TOTAL_COST")!=null && tpd.get("PLAN_COST")!=null){
- tpd.put("COM_RETIO", math(tpd.get("TOTAL_COST"),tpd.get("PLAN_COST")).toString());
- }
- }
- return pdateList;
- }
- private List<PageData> getAnnualDailyPlanRecod(PageData pd) throws Exception {
- // List<PageData> pdateList = annualDailyCompService.getKmInfo(pd);
- // List<PageData> pdList = new ArrayList<PageData>();
- // for (PageData pdata : pdateList) {
- // pdata.put("YEAR", pd.get("YEAR"));
- // PageData queryData = pdata;
- // PageData tempPg = annualDailyCompService.getDaliyPlanRecord(queryData); // 日常养护
- // if (tempPg != null) {
- // tempPg.put("CARE_KM", pdata.get("CARE_KM"));
- // tempPg.put("DESIGN_KM", pdata.get("DESIGN_KM"));
- // pdList.add(tempPg);
- // }
- // }
- // if (pdList.size() == 0) {
- // pdList = pdateList;
- // }
- pd.put("VIEW_NAME", "annual_daily_comp_sumtable_view");
- List<PageData> pdateList = annualDailyCompService.findViewRecordsList(pd); //获取视图返回结果
- for(PageData tpd : pdateList){
- if(tpd.get("PLAN_COST")!=null && tpd.get("CARE_KM")!=null){
- tpd.put("COST_KM", mathKm(tpd.get("PLAN_COST"),tpd.get("CARE_KM")).toString());
- }
- }
- return pdateList;
- }
- private Map<String, String> putPlanRecods() throws Exception {
- Map<String, String> tableInfo = new HashMap<String, String>();
- tableInfo.put("highway_prevention_project_dettable", "PREVENTION_PLAN_COST"); // 预防养护
- tableInfo.put("highway_repair_project_dettable", "REPAIR_PLAN_COST"); // 修复养护
- tableInfo.put("highway_special_project_dettable", "SPECIAL_PLAN_COST"); // 专项养护
- tableInfo.put("highway_test_project_dettable", "TEST_PLAN_COST"); // 试验检测项目
- return tableInfo;
- }
- private PageData getPlanRecods(Map<String, String> tableInfo, PageData varPg, PageData pd) throws Exception {
- for (Map.Entry<String, String> entry : tableInfo.entrySet()) {
- System.out.println("key=" + entry.getKey() + "\tvalue=" + entry.getValue());
- pd.put("FROM_TABLE", entry.getKey());
- String getRecod = annualDailyCompService.findOtherPlanSum(pd);
- if (getRecod != null) {
- varPg.put(entry.getValue(), Double.parseDouble(getRecod));
- }
- }
- return varPg;
- }
- private Map<String, String> putCompRecods() throws Exception {
- Map<String, String> tableInfo = new HashMap<String, String>();
- tableInfo.put("monthly_daily_completion", "DAILY_COMPLETE_COST"); // 日常养护
- tableInfo.put("monthly_prevention_completion", "PREVENTION_COMPLETE_COST"); // 预防养护
- tableInfo.put("monthly_repair_completion", "REPAIR_COMPLETE_COST"); // 修复养护
- tableInfo.put("monthly_special_completion", "SPECIAL_COMPLETE_COST"); // 专项养护
- tableInfo.put("monthly_test_project_completion", "TEST_COMPLETE_COST"); // 试验检测项目
- tableInfo.put("monthly_scientific_project_completion", "SCIENTIFIC_COMPLETE_COST"); // 科研项目
- tableInfo.put("monthly_equipment_overhaul_completion", "DEVICE_COMPLETE_COST"); // 设备大修
- tableInfo.put("monthly_emergency_completion", "EMERGENCY_COMPLETE_COST"); // 应急
- return tableInfo;
- }
- private Map<String, String> putAnnualCompRecods() throws Exception {
- Map<String, String> tableInfo = new HashMap<String, String>();
- tableInfo.put("monthly_daily_completion", "DAILY_COMPLETE"); // 日常养护
- tableInfo.put("monthly_special_completion", "SPECIAL_COMPLETE"); // 专项养护
- tableInfo.put("monthly_test_project_completion", "TEST_COMPLETE"); // 试验检测项目
- tableInfo.put("monthly_scientific_project_completion", "SCIENTIFIC_COMPLETE"); // 科研项目
- tableInfo.put("monthly_equipment_overhaul_completion", "DEVICE_COMPLETE"); // 设备大修
- tableInfo.put("monthly_emergency_completion", "EMERGENCY_COMPLETE"); // 应急
- return tableInfo;
- }
- private PageData getCompRecods(Map<String, String> tableInfo, PageData varPg, PageData pd) throws Exception {
- for (Map.Entry<String, String> entry : tableInfo.entrySet()) {
- System.out.println("key=" + entry.getKey() + "\tvalue=" + entry.getValue());
- pd.put("FROM_TABLE", entry.getKey());
- String getRecod = annualDailyCompService.findCompSum(pd);
- if (getRecod != null) {
- varPg.put(entry.getValue(), Double.parseDouble(getRecod));
- }
- }
- return varPg;
- }
- private String dailyPlanCostSum(PageData tempPg) {
- String dailySum = "";
- if (tempPg != null) {
- Double DailySumd = 0.00;
- for (String type : dailyPlanType) {
- if (tempPg.get(type) != null) {
- DailySumd += Double.parseDouble(tempPg.get(type).toString());
- }
- }
- dailySum = String.valueOf(DailySumd);
- }
- return dailySum;
- }
- @SuppressWarnings("unused")
- // 获取公司计划费用
- private Double getPlanSum(PageData pd, AnnualDailyCompService annualDailyCompService) throws NumberFormatException, Exception {
- Double planSum = 0.00;
- Double a = 0.00;
- Double b = 0.00;
- Double c = 0.00;
- Double d = 0.00;
- Double e = 0.00;
- Double f = 0.00;
- Double g = 0.00;
- Double h = 0.00;
- Double i = 0.00;
- // 获取公司日常计划费用
- if(annualDailyCompService.getRcyhPlanSum(pd)!=null) {
- a = Double.parseDouble(annualDailyCompService.getRcyhPlanSum(pd));
- }
- // 获取预防养护计划费用
- if(annualDailyCompService.getYfyhPlanSum(pd)!=null) {
- b = Double.parseDouble(annualDailyCompService.getYfyhPlanSum(pd));
- }
- // 获取修复养护计划费用
- if(annualDailyCompService.getXfyhPlanSum(pd)!=null) {
- c = Double.parseDouble(annualDailyCompService.getXfyhPlanSum(pd));
- }
- // 获取专项养护计划费用
- if(annualDailyCompService.getZxyhPlanSum(pd)!=null) {
- d = Double.parseDouble(annualDailyCompService.getZxyhPlanSum(pd));
- }
- // 获取试验检测计划费用
- if(annualDailyCompService.getSyjcPlanSum(pd)!=null) {
- e = Double.parseDouble(annualDailyCompService.getSyjcPlanSum(pd));
- }
- // 获取科研项目计划费用
- if(annualDailyCompService.getKyxmPlanSum(pd)!=null) {
- f = Double.parseDouble(annualDailyCompService.getKyxmPlanSum(pd));
- }
- // 获取设备大修计划费用
- if(annualDailyCompService.getSbdxPlanSum(pd)!=null) {
- g = Double.parseDouble(annualDailyCompService.getSbdxPlanSum(pd));
- }
- // 获取预备费计划费用
- if(annualDailyCompService.getYbfPlanSum(pd)!=null) {
- h = Double.parseDouble(annualDailyCompService.getYbfPlanSum(pd));
- }
- // 获取应急养护计划费用
- if(annualDailyCompService.getYjyhPlanSum(pd)!=null) {
- i = Double.parseDouble(annualDailyCompService.getYjyhPlanSum(pd));
- }
- planSum = a + b + c + d + e + f + g + h + i;
- return planSum;
- }
- @SuppressWarnings("unused")
- // 获取公司完成费用
- private Double getCompSum(PageData pd, AnnualDailyCompService annualDailyCompService) throws NumberFormatException, Exception {
- Double compSum = 0.00;
- Double a = 0.00;
- Double b = 0.00;
- Double c = 0.00;
- Double d = 0.00;
- Double e = 0.00;
- Double f = 0.00;
- Double g = 0.00;
- Double h = 0.00;
- Double i = 0.00;
- // 获取公司日常计划费用
- if(annualDailyCompService.getRcyhCompSum(pd)!=null) {
- a = Double.parseDouble(annualDailyCompService.getRcyhCompSum(pd));
- }
- // 获取预防养护计划费用
- if(annualDailyCompService.getYfyhCompSum(pd)!=null) {
- b = Double.parseDouble(annualDailyCompService.getYfyhCompSum(pd));
- }
- // 获取修复养护计划费用
- if(annualDailyCompService.getXfyhCompSum(pd)!=null) {
- c = Double.parseDouble(annualDailyCompService.getXfyhCompSum(pd));
- }
- // 获取专项养护计划费用
- if(annualDailyCompService.getZxyhCompSum(pd)!=null) {
- d = Double.parseDouble(annualDailyCompService.getZxyhCompSum(pd));
- }
- // 获取试验检测计划费用
- if(annualDailyCompService.getSyjcCompSum(pd)!=null) {
- e = Double.parseDouble(annualDailyCompService.getSyjcCompSum(pd));
- }
- // 获取科研项目计划费用
- if(annualDailyCompService.getKyxmCompSum(pd)!=null) {
- f = Double.parseDouble(annualDailyCompService.getKyxmCompSum(pd));
- }
- // 获取设备大修计划费用
- if(annualDailyCompService.getSbdxCompSum(pd)!=null) {
- g = Double.parseDouble(annualDailyCompService.getSbdxCompSum(pd));
- }
- // 获取预备费计划费用
- if(annualDailyCompService.getYbfCompSum(pd)!=null) {
- h = Double.parseDouble(annualDailyCompService.getYbfCompSum(pd));
- }
- // 获取应急养护计划费用
- if(annualDailyCompService.getYjyhCompSum(pd)!=null) {
- i = Double.parseDouble(annualDailyCompService.getYjyhCompSum(pd));
- }
- compSum = a + b + c + d + e + f + g + h + i;
- return compSum;
- }
- // 算完成比例得方法,保留2位小数
- public Double div(PageData pd, AnnualDailyCompService annualDailyCompService) throws NumberFormatException, Exception {
- BigDecimal b1 = new BigDecimal(this.getPlanSum(pd,annualDailyCompService).toString());
- BigDecimal b2 = new BigDecimal(this.getCompSum(pd,annualDailyCompService).toString());
- if(b1.compareTo(BigDecimal.ZERO)==0) {
- return 0.00;
- }
- return new Double(b2.divide(b1, 2, BigDecimal.ROUND_HALF_UP).doubleValue());
- }
- // 计算公司完成率得分
- public int getPoint(Double proportion, AnnualDailyCompService annualDailyCompService) {
- int point = 0;
- // 完成率大于95的得20分
- if (proportion > 0.95) {
- point = 20;
- }
- // 完成率大于90小于等于0.95的得15分
- if (proportion > 0.90 && proportion <= 0.95) {
- point = 15;
- }
- // 完成率大于等于85小于等于90得10分
- if (proportion >= 0.85 && proportion <= 0.90) {
- point = 10;
- }
- // 完成率小于85的得5分
- if (proportion < 0.85) {
- point = 5;
- }
- return point;
- }
- // 获取上报及时信息
- public int getReportInfo(PageData pd, AnnualDailyCompService annualDailyCompService) throws Exception {
- // 获取改公司所有上报表格时间
- List<PageData> pdList = new ArrayList<PageData>();
- // List dateList = new ArrayList();
- int point = 0;
- //记录如果有不符合时间得就加1
- int a = 0;
- int b = 0;
- int c = 0;
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
- Date pz1 = sdf.parse(this.getProperties("pz1"));
- Date pz2 = sdf.parse(this.getProperties("pz2"));
- pdList = annualDailyCompService.getcompanysReport(pd);
- for (PageData pdData : pdList) {
- Date date = new Date();
- if(pdData.get("SPTIME")!=null) {
- date = sdf.parse(pdData.get("SPTIME").toString()) ;
- }
- if (date.before(pz1)) {
- a = a + 1;
- if (date.before(pz1)&&date.after(pz2)) {
- b = b + 1;
- if (date.before(pz2)) {
- c = c + 1;
- }
- }
- }
- }
- if (a == 0) {
- point = 5;
- }
- if (b == 0) {
- point = 3;
- }
- if (c == 0) {
- point = 1;
- }
- return point;
- }
- // 读取配置文件方法
- public String getProperties(String str) throws IOException {
- Properties properties = PropertiesLoaderUtils.loadAllProperties("plantime.properties");
- String test = properties.getProperty(str);
- return test;
- }
- // 读取编制得分
- public Double getBzPoint(PageData pd,AnnualDailyCompService annualDailyCompService) throws Exception {
- Double bpoint =0.0;
- if(annualDailyCompService.getBzPoint(pd)!=null)
- {
- bpoint = Double.parseDouble(annualDailyCompService.getBzPoint(pd));
- }
- return bpoint;
- }
- // 获取所有公司信息
- public List<PageData> getAllcompanys(AnnualDailyCompService annualDailyCompService,PageData pg) throws Exception {
- PageData pageData = new PageData();
- // 获取公司信息
- List<PageData> compList = annualDailyCompService.getAllcompanys(pageData);
- // 返回前台处理过的公司信息List
- List<PageData> newCompList = new ArrayList<PageData>();
- //前台传入年份year
- // if(pg.getString("EVET_CODE")!=null)
- // {
- String year = pg.getString("EVET_CODE");
- // }
- for (PageData comp : compList) {
- PageData pd = new PageData();
- // 获得公司名字
- String compName = comp.getString("NAME");
- // 获得公司ID
- String compId = comp.getString("BIANMA");
- pd.put("COMPANY_ID", compId);
- pd.put("COMPANY_NAME", compName);
- pd.put("YEAR", year);
- // 获得公司完成比例
- Double proportion = this.div(pd,annualDailyCompService);
- //pd.put("PROPORTION", proportion);
- // 完成率得分
- int wpoint = this.getPoint(proportion,annualDailyCompService);
- pd.put("WPOINT", wpoint);
- // 获取上报及时获取得得分
- int spoint = this.getReportInfo(pd,annualDailyCompService);
- pd.put("SPOINT", spoint);
- //获得编制质量得分
- int bpoint = new Double(this.getBzPoint(pd,annualDailyCompService)).intValue();
- pd.put("BPOINT", bpoint);
- //总分
- int point = wpoint+spoint+bpoint;
- if(!year.equals("2019")) {
- point = 100;
- }
- pd.put("POINT", point);
- newCompList.add(pd);
- }
- return newCompList;
- }
-
-
- /**
- * object => bigdecimal
- * @param value
- * @return
- */
- public static BigDecimal getBigDecimal( Object value ) {
- BigDecimal ret = null;
- if( value != null ) {
- if( value instanceof BigDecimal ) {
- ret = (BigDecimal) value;
- } else if( value instanceof String ) {
- ret = new BigDecimal( (String) value );
- } else if( value instanceof BigInteger ) {
- ret = new BigDecimal( (BigInteger) value );
- } else if( value instanceof Number ) {
- ret = new BigDecimal( ((Number)value).doubleValue() );
- } else {
- throw new ClassCastException("Not possible to coerce ["+value+"] from class "+value.getClass()+" into a BigDecimal.");
- }
- }
- return ret;
- }
- }
|