解决GAT项目Bug:车装车饰费用管理中的装饰费统计(车辆)统计数据不对
2017-03-24 16:30
561 查看
问题描述:
![](https://oscdn.geek-share.com/Uploads/Images/Content/201703/f65885bb975b9db061a683bf4aca2354)
![](https://oscdn.geek-share.com/Uploads/Images/Content/201703/819487d4a7f982dd39bc9d27abccf08a)
解决:断点查看sql语句,并加上参数执行
![](https://oscdn.geek-share.com/Uploads/Images/Content/201703/49d42ea630e6883628cc82c958637902)
发现sql语句统计的不对,nvl2(t2.times, 1, 0),意思是有值为1没值为0
下面的半句已经可以累积次数了,不需要再nvl2(t2.times, 1, 0) as times
![](https://oscdn.geek-share.com/Uploads/Images/Content/201703/3a68fa5a3045404a574ee1e59b189856)
所以修改SQL,直接t2.times
![](https://oscdn.geek-share.com/Uploads/Images/Content/201703/a1b17a01742e459ca1956b7a66a903a7)
![](https://oscdn.geek-share.com/Uploads/Images/Content/201703/6d1cb5f3673b42b94f12a1c439fab7c6)
![](https://oscdn.geek-share.com/Uploads/Images/Content/201703/cf17e0cf26809f3e6b5ea0fcb4bf744e)
测试OK~~
----------------------------------------------------------------------------------------------------------------------
补充说明:参考停车管理里面的车辆统计,
![](https://oscdn.geek-share.com/Uploads/Images/Content/201703/3ed243b895ebcd9ebd8a676b6ec45931)
![](https://oscdn.geek-share.com/Uploads/Images/Content/201703/60fa0c3e08ad825d1f7d3adb6c41f7da)
所以上面的装饰费统计(车辆)sql改为:
![](https://oscdn.geek-share.com/Uploads/Images/Content/201703/daa81402b3b723b7143877050ed75086)
![](https://oscdn.geek-share.com/Uploads/Images/Content/201703/ae6d905f07b20e6a76c794c943f6e372)
![](https://oscdn.geek-share.com/Uploads/Images/Content/201703/415039896da6dc1b0a3a351b9bf2f67f)
测试OK~~
解决:断点查看sql语句,并加上参数执行
发现sql语句统计的不对,nvl2(t2.times, 1, 0),意思是有值为1没值为0
下面的半句已经可以累积次数了,不需要再nvl2(t2.times, 1, 0) as times
所以修改SQL,直接t2.times
select t1.hostno, t2.times, nvl(t2.cost, 0) as cost from (select p.hostid, p.hostno from position_host_info p left join position_host_info_extend e on p.hostid = e.hostid where e.verify_status = 1 and e.process_status <> 4 and e.process_status <> 5 and p.appsysid = 23551 and p.appdeptid = 3) t1 left join (select p.hostno as hostNo, t.host_id, sum(nvl2(t.DECORATE_COST, 1, 0)) as times, sum(nvl(t.DECORATE_COST, 0)) as cost from position_host_info p left join position_host_info_extend e on p.hostid = e.hostid left join COST_DECORATE t on p.hostid = t.host_id and t.PAYMENT_DATE >= to_date('2017-03-20', 'yyyy-mm-dd') and t.PAYMENT_DATE <= to_date('2017-03-24', 'yyyy-mm-dd') where p.appsysid = 23551 and p.appdeptid = 3 and e.verify_status = 1 and e.process_status <> 4 and e.process_status <> 5 and t.apply_status = 11 group by p.hostno, t.host_id) t2 on t1.hostid = t2.host_id
测试OK~~
----------------------------------------------------------------------------------------------------------------------
补充说明:参考停车管理里面的车辆统计,
select t1.hostno, nvl(t2.parkTimes, 0) as parkTimes, nvl(t2.totalParkFee, 0) as totalParkFee from (select p.hostno, p.hostid from position_host_info p where p.status = 1 and (exists (select appsysid, appdeptid from table(get_subdept(8196, 23551, 3)) f where p.APPSYSID = f.appsysid and p.APPDEPTID = f.appdeptid))) t1 left join (select cpf.host_id, cpf.HOST_NO, to_char(count(*)) as parkTimes, to_char(sum(cpf.PARK_FEE)) as totalParkFee from COST_PARK_FEE cpf where (exists (select appsysid, appdeptid from table(get_subdept(8196, 23551, 3)) f where cpf.APPSYSID = f.appsysid and cpf.APPDEPTID = f.appdeptid)) and cpf.PAY_DATE >= to_date('2017-03-20', 'yyyy-mm-dd') and cpf.PAY_DATE <= to_date('2017-03-31', 'yyyy-mm-dd') and cpf.fee_verify = 1 group by cpf.host_id, cpf.HOST_NO) t2 on t1.hostid = t2.host_id
所以上面的装饰费统计(车辆)sql改为:
select t1.hostno, nvl(t2.times,0) as times, nvl(t2.cost, 0) as cost from (select p.hostid, p.hostno from position_host_info p left join position_host_info_extend e on p.hostid = e.hostid where e.verify_status = 1 and e.process_status <> 4 and e.process_status <> 5 and p.appsysid = 23551 and p.appdeptid = 3) t1 left join (select p.hostno as hostNo, t.host_id, sum(nvl2(t.DECORATE_COST, 1, 0)) as times, sum(nvl(t.DECORATE_COST, 0)) as cost from position_host_info p left join position_host_info_extend e on p.hostid = e.hostid left join COST_DECORATE t on p.hostid = t.host_id and t.PAYMENT_DATE >= to_date('2017-03-20', 'yyyy-mm-dd') and t.PAYMENT_DATE <= to_date('2017-03-24', 'yyyy-mm-dd') where p.appsysid = 23551 and p.appdeptid = 3 and e.verify_status = 1 and e.process_status <> 4 and e.process_status <> 5 and t.apply_status = 11 group by p.hostno, t.host_id) t2 on t1.hostid = t2.host_id代码中改成:
测试OK~~
相关文章推荐
- 解决GAT项目Bug:ETC费用统计问题
- 解决GAT项目Bug:轨迹分析查询不到数据
- Oracle-ORA-01722:invalid number-解决GAT项目中车辆维修Bug
- ORA-01722:invalid number-解决GAT项目中车辆维修Bug(续)
- 项目实例:车辆信息统计报表管理系统--FlowLayoutPanel容器的问题
- 解决公务车Bug:加油管理中导入加油费用时,提示:操作失败
- 解决GAT项目Bug:导入Excel的时候没有对日期格式进行验证
- 客运综合管理系统项目—报班统计(车辆调度报班)
- GAT-解决用车审批中,如果调度车辆是通过Excel导入的车辆,会有错误提示Bug
- GAT项目新需求:保险管理增加查询统计(续)
- 解决公务车Bug:过路过桥费用管理中导入路桥费用时,付费方式为苏通卡时不能正常导入
- 项目实例:车辆信息统计报表管理系统--导出PDF怎么调样式?
- GAT-解决车辆基本信息中,删除未返场的车辆时,错误提示信息Bug
- 搬家公司管理系统,能完成车辆管理、订单管理等工作,并给出报表统计数据
- 项目实例:车辆信息统计报表管理系统--WinForm、Web打印设计
- 解决GAT项目Bug: 用车审批中审批人登录系统后,看不到申请人提交的单子
- 解决GAT输入车牌号未带出车辆品牌Bug
- 解决公务车Bug:停车费管理中导入停车费用时报数据库操作异常
- 项目管理之bug数减少原因分析和解决办法
- 项目实例:车辆信息统计报表管理系统--本地化的问题