diff --git a/src_core/com/tenwa/jbo/manager/DataUtil.java b/src_core/com/tenwa/jbo/manager/DataUtil.java index bd51acbb4..a702d6425 100644 --- a/src_core/com/tenwa/jbo/manager/DataUtil.java +++ b/src_core/com/tenwa/jbo/manager/DataUtil.java @@ -3343,7 +3343,7 @@ public class DataUtil { } public static String getFlowLog(String flowunid) throws Exception { - List> datas = query("select * from ( select a.serialno, a.phaseno, a.phasename, a.begintime, a.endtime, nvl(getUserName(b.INPUTUSER),a.username) as username, nvl(GETORGNAME(b.INPUTORG),a.orgname) as orgname, ( case when b.updatetime is null then b.inputtime else b.updatetime end ) opiniontime, b.phaseopinion, a.phaseopinion1, phaseaction from flow_task a left join flow_opinion b on a.serialno = b.serialno where a.objectno = ? " + + List> datas = query("select * from ( select a.serialno, a.phaseno, a.phasename, a.begintime, a.endtime, ifnull(getUserName(b.INPUTUSER),a.username) as username, ifnull(GETORGNAME(b.INPUTORG),a.orgname) as orgname, ( case when b.updatetime is null then b.inputtime else b.updatetime end ) opiniontime, b.phaseopinion, a.phaseopinion1, phaseaction from flow_task a left join flow_opinion b on a.serialno = b.serialno where a.objectno = ? " + //"union all " + //"select '' serialno, a.phaseno, b.phasename, '' begintime, '' endtime, '' username, '' orgname, '' opiniontime, to_clob('') phaseopinion, '' phaseopinion1, '' phaseaction from flow_task a left join flow_task b on a.assignedtaskno = b.serialno where a.objectno = ? and a.assignedtaskno = b.serialno " + //"union all " + @@ -3987,11 +3987,11 @@ public class DataUtil { public static String getDiscount(JBOTransaction tx, String flowunid, boolean flag) throws Exception { List> discount; if (flag) { - discount = query("select wm_concat( nvl( c.interests, 0 ) || '@' || a.id ) discount from lb_equipment_car_temp a" + + discount = query("select wm_concat( ifnull( c.interests, 0 ) || '@' || a.id ) discount from lb_equipment_car_temp a" + " left join lb_commercial_interests c on a.car_date_id = c.id and trunc( sysdate ) between" + " to_date( c.interestsbegin, 'yyyy/mm/dd' ) and to_date( c.interestsover, 'yyyy/mm/dd' ) where c.id is not null and a.flowunid = ? order by a.id", tx, flowunid); } else { - discount = query("select wm_concat( nvl( c.interests, 0 ) || '@' || a.id ) discount from lb_equipment_car_temp a" + + discount = query("select wm_concat( ifnull( c.interests, 0 ) || '@' || a.id ) discount from lb_equipment_car_temp a" + " left join lb_cardata_model_interests c on a.car_date_id = c.id and trunc( sysdate ) between" + " to_date( c.interestsbegin, 'yyyy/mm/dd' ) and to_date( c.interestsover, 'yyyy/mm/dd' ) where c.id is not null and a.flowunid = ? order by a.id", tx, flowunid); } @@ -4003,7 +4003,7 @@ public class DataUtil { } public static String getDiscountByCarId(String carId, JBOTransaction tx) throws Exception { - List> discount = query("select nvl( interests, -1 ) interest from lb_commercial_interests where id = ? and trunc( sysdate ) between" + + List> discount = query("select ifnull( interests, -1 ) interest from lb_commercial_interests where id = ? and trunc( sysdate ) between" + " to_date( interestsbegin, 'yyyy/mm/dd' ) and to_date( interestsover, 'yyyy/mm/dd' )", tx, carId); if (discount.size() == 0 || discount.get(0).get("INTEREST") == null) { return "-1"; @@ -4013,7 +4013,7 @@ public class DataUtil { } public static String getActualDiscount(JBOTransaction tx, String flowunid) throws Exception { - List> discount = query("select sum( nvl( actual_discount, 0 ) ) discount from lb_equipment_car_temp where flowunid = ?", tx, flowunid); + List> discount = query("select sum( ifnull( actual_discount, 0 ) ) discount from lb_equipment_car_temp where flowunid = ?", tx, flowunid); if (discount.size() == 0 || discount.get(0).get("DISCOUNT") == null) { return "0"; } else { @@ -4024,9 +4024,9 @@ public class DataUtil { public static String getPrice(JBOTransaction tx, String flowunid, boolean flag) throws Exception { List> price; if (flag) { - price = query("select wm_concat( id || '@' || ( transactionprice + nvl( equip_purchase_tax, 0 ) + nvl( equip_insurance, 0 ) + nvl( accessory_money, 0 ) + nvl( upper_equipment, 0 ) ) || '@' || nvl( price, 0 ) ) price from lb_equipment_car_temp where flowunid = ? order by id", tx, flowunid); + price = query("select wm_concat( id || '@' || ( transactionprice + ifnull( equip_purchase_tax, 0 ) + ifnull( equip_insurance, 0 ) + ifnull( accessory_money, 0 ) + ifnull( upper_equipment, 0 ) ) || '@' || ifnull( price, 0 ) ) price from lb_equipment_car_temp where flowunid = ? order by id", tx, flowunid); } else { - price = query("select wm_concat( id || '@' || transactionprice || '@' || nvl( price, 0 ) ) price from lb_equipment_car_temp where flowunid = ? order by id", tx, flowunid); + price = query("select wm_concat( id || '@' || transactionprice || '@' || ifnull( price, 0 ) ) price from lb_equipment_car_temp where flowunid = ? order by id", tx, flowunid); } if (price.size() == 0 || price.get(0).get("PRICE") == null) { @@ -4037,7 +4037,7 @@ public class DataUtil { } public static String getPrice1(JBOTransaction tx, String flowunid) throws Exception { - String sql = "select nvl(SUM(TOTALPRICE),0) as TOTALPRICE from LB_EQUIPMENT_CAR_TEMP o where o.flowunid=? "; + String sql = "select ifnull(SUM(TOTALPRICE),0) as TOTALPRICE from LB_EQUIPMENT_CAR_TEMP o where o.flowunid=? "; List> map = DataUtil.query(sql, tx, flowunid); String price = map.get(0).get("TOTALPRICE"); return price; @@ -4045,7 +4045,7 @@ public class DataUtil { //获取增融比例 public static String getFinancingPro(JBOTransaction tx, String flowunid) throws Exception { - List> price = query("select nvl(round(sum(INCREASE_FINANCING)/sum(EQUIP_PRICE),2)*100,0) as proportion from LB_EQUIPMENT_CAR_TEMP where FLOWUNID=?", tx, flowunid); + List> price = query("select ifnull(round(sum(INCREASE_FINANCING)/sum(EQUIP_PRICE),2)*100,0) as proportion from LB_EQUIPMENT_CAR_TEMP where FLOWUNID=?", tx, flowunid); String financingPro = price.get(0).get("PROPORTION"); return financingPro; } @@ -4206,7 +4206,7 @@ public class DataUtil { public static String getUnIncomePlanList(String paymentNumber) throws Exception { List> planList = query("select case when max(zero_rent_max_plan_list)>=max(min_plan_list) and max(zero_rent_max_plan_list)< max(max_plan_list) then max(zero_rent_max_plan_list)+1||'@'||max(max_plan_list)" - + " when max(nvl(zero_rent_max_plan_list,0))=0 then max(min_plan_list)|| '@' || max(max_plan_list) WHEN max( zero_rent_max_plan_list ) < max( min_plan_list ) then" + + " when max(ifnull(zero_rent_max_plan_list,0))=0 then max(min_plan_list)|| '@' || max(max_plan_list) WHEN max( zero_rent_max_plan_list ) < max( min_plan_list ) then" + " max( min_plan_list ) || '@' || max( max_plan_list ) else '0' end as planList from (select min(plan_list) as min_plan_list,max(plan_list) as max_plan_list,0 as zero_rent_max_plan_list from vi_lc_rent_plan vlrp where payment_number = ?" + " and fact_rent = 0 and vlrp.RENT > 0 union all select 0 as min_plan_list,0 as max_plan_list,max(plan_list) as zero_rent_max_plan_list from vi_lc_rent_plan vlrp where payment_number = ? and vlrp.RENT = 0) vlrp", paymentNumber, paymentNumber); if (planList.size() > 0 && !"0".equals(planList.get(0).get("PLANLIST"))) { @@ -4446,17 +4446,17 @@ public class DataUtil { table = "lb_equipment_car_temp"; } if ("lines01".equals(businessLine) || "lines04".equals(businessLine)) { - datas = query("select sum( nvl( transactionprice, 0 ) ) + sum( nvl( equip_purchase_tax, 0 ) ) + sum( nvl( equip_insurance, 0 ) ) + sum( nvl( accessory_money, 0 ) ) + sum( nvl( upper_equipment, 0 ) ) equipAmt from lb_equipment_car_temp where flowunid = ?", flowunid); + datas = query("select sum( ifnull( transactionprice, 0 ) ) + sum( ifnull( equip_purchase_tax, 0 ) ) + sum( ifnull( equip_insurance, 0 ) ) + sum( ifnull( accessory_money, 0 ) ) + sum( ifnull( upper_equipment, 0 ) ) equipAmt from lb_equipment_car_temp where flowunid = ?", flowunid); } else if ("lines02".equals(businessLine)) { - datas = query("select sum( nvl( transactionprice, 0 ) ) equipAmt from lb_equipment_car_temp where flowunid = ?", flowunid); + datas = query("select sum( ifnull( transactionprice, 0 ) ) equipAmt from lb_equipment_car_temp where flowunid = ?", flowunid); } else if ("lines".equals(businessLine)) { - datas = query("select sum( nvl( equip_price, 0 ) ) equipAmt from lb_indent_equipment_temp where flowunid = ?", flowunid); + datas = query("select sum( ifnull( equip_price, 0 ) ) equipAmt from lb_indent_equipment_temp where flowunid = ?", flowunid); } else { - datas = query("select sum( nvl( equip_price, 0 ) ) equipAmt from " + table + " where flowunid = ?", flowunid); + datas = query("select sum( ifnull( equip_price, 0 ) ) equipAmt from " + table + " where flowunid = ?", flowunid); } // 项目立项工程机械业务线查询lb_equipment_temp表 if (!flag && "lines04".equals(businessLine) && datas.size() == 0) { - datas = query("select sum( nvl( equip_price, 0 ) ) equipAmt from " + table + " where flowunid = ?", flowunid); + datas = query("select sum( ifnull( equip_price, 0 ) ) equipAmt from " + table + " where flowunid = ?", flowunid); } if (datas.size() > 0 && datas.get(0).get("EQUIPAMT") != null) { return datas.get(0).get("EQUIPAMT");