Commit 6b660b21030aea5939b035ae3994e6c68df5261a
1 parent
a4df684a
驾驶员请求台账排序,油量拆分计算
Showing
5 changed files
with
90 additions
and
14 deletions
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| @@ -309,6 +309,12 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | @@ -309,6 +309,12 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, | ||
| 309 | @RequestParam String code,@RequestParam String xlName, @RequestParam String type) { | 309 | @RequestParam String code,@RequestParam String xlName, @RequestParam String type) { |
| 310 | return scheduleRealInfoService.account(line, date, code, xlName, type); | 310 | return scheduleRealInfoService.account(line, date, code, xlName, type); |
| 311 | } | 311 | } |
| 312 | + | ||
| 313 | + @RequestMapping(value = "/accountPx") | ||
| 314 | + public List<Map<String,Object>> accountPx(@RequestParam String line, @RequestParam String date, | ||
| 315 | + @RequestParam String code,@RequestParam String xlName, @RequestParam String px) { | ||
| 316 | + return scheduleRealInfoService.accountPx(line, date, code, xlName, px); | ||
| 317 | + } | ||
| 312 | 318 | ||
| 313 | @RequestMapping(value = "/correctForm") | 319 | @RequestMapping(value = "/correctForm") |
| 314 | public List<ScheduleRealInfo> correctForm(@RequestParam String line, @RequestParam String startDate, | 320 | public List<ScheduleRealInfo> correctForm(@RequestParam String line, @RequestParam String startDate, |
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
| @@ -506,7 +506,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -506,7 +506,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 506 | long l=Math.round(nextJzyl); | 506 | long l=Math.round(nextJzyl); |
| 507 | double ylxs=l*100/100; | 507 | double ylxs=l*100/100; |
| 508 | // nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); | 508 | // nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); |
| 509 | - yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl)); | 509 | + yh=Arith.add(yh, Arith.sub(nextJzyl,ylxs)); |
| 510 | t.setYh(yh); | 510 | t.setYh(yh); |
| 511 | t.setJzyl(ylxs); | 511 | t.setJzyl(ylxs); |
| 512 | nextJzyl=ylxs; | 512 | nextJzyl=ylxs; |
| @@ -531,7 +531,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -531,7 +531,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 531 | ylxs=l*100/100; | 531 | ylxs=l*100/100; |
| 532 | 532 | ||
| 533 | } | 533 | } |
| 534 | - yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl)); | 534 | + yh=Arith.add(yh, Arith.sub(nextJzyl,ylxs)); |
| 535 | // nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); | 535 | // nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); |
| 536 | 536 | ||
| 537 | t.setYh(yh); | 537 | t.setYh(yh); |
| @@ -1218,8 +1218,8 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1218,8 +1218,8 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1218 | t.setShyy(shyy); | 1218 | t.setShyy(shyy); |
| 1219 | } | 1219 | } |
| 1220 | czyl=t.getCzyl(); | 1220 | czyl=t.getCzyl(); |
| 1221 | -// Double jcyl = t.getCzyl(); | ||
| 1222 | - zyl = jzl; | 1221 | + Double jcyl = t.getCzyl(); |
| 1222 | + zyl = Arith.sub(Arith.add(jcyl, jzl), yl); | ||
| 1223 | Double yh = 0.0; | 1223 | Double yh = 0.0; |
| 1224 | if (zlc > 0 && t.getZlc() > 0) { | 1224 | if (zlc > 0 && t.getZlc() > 0) { |
| 1225 | yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); | 1225 | yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc))); |
| @@ -1229,7 +1229,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1229,7 +1229,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1229 | long l=Math.round(nextJzyl); | 1229 | long l=Math.round(nextJzyl); |
| 1230 | double ylxs=l*100/100; | 1230 | double ylxs=l*100/100; |
| 1231 | // nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); | 1231 | // nextJzyl = Arith.add(nextJzyl,Arith.sub(nextJzyl,ylxs)); |
| 1232 | - yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl)); | 1232 | + yh=Arith.add(yh, Arith.sub(nextJzyl,ylxs)); |
| 1233 | t.setYh(yh); | 1233 | t.setYh(yh); |
| 1234 | t.setJzyl(ylxs); | 1234 | t.setJzyl(ylxs); |
| 1235 | nextJzyl=ylxs; | 1235 | nextJzyl=ylxs; |
| @@ -1252,12 +1252,12 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1252,12 +1252,12 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1252 | long l=0l; | 1252 | long l=0l; |
| 1253 | double ylxs=0.0; | 1253 | double ylxs=0.0; |
| 1254 | if(i==iterator2.size()-1){ | 1254 | if(i==iterator2.size()-1){ |
| 1255 | - ylxs=czyl; | 1255 | + ylxs=yl; |
| 1256 | }else{ | 1256 | }else{ |
| 1257 | l=Math.round(nextJzyl); | 1257 | l=Math.round(nextJzyl); |
| 1258 | ylxs=l*100/100; | 1258 | ylxs=l*100/100; |
| 1259 | } | 1259 | } |
| 1260 | - yh=Arith.add(yh, Arith.sub(ylxs,nextJzyl)); | 1260 | + yh=Arith.add(yh, Arith.sub(nextJzyl,ylxs)); |
| 1261 | t.setYh(yh); | 1261 | t.setYh(yh); |
| 1262 | t.setJzyl(ylxs); | 1262 | t.setJzyl(ylxs); |
| 1263 | nextJzyl=ylxs; | 1263 | nextJzyl=ylxs; |
| @@ -1269,7 +1269,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1269,7 +1269,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1269 | } | 1269 | } |
| 1270 | } | 1270 | } |
| 1271 | repository.save(t); | 1271 | repository.save(t); |
| 1272 | - /*for (int z = 0; z < cylList.size(); z++) { | 1272 | + for (int z = 0; z < cylList.size(); z++) { |
| 1273 | Cyl cyl = cylList.get(z); | 1273 | Cyl cyl = cylList.get(z); |
| 1274 | if (t.getNbbm().equals(cyl.getNbbm())) { | 1274 | if (t.getNbbm().equals(cyl.getNbbm())) { |
| 1275 | cyl.setCyl(t.getJzyl()); | 1275 | cyl.setCyl(t.getJzyl()); |
| @@ -1277,7 +1277,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1277,7 +1277,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1277 | break; | 1277 | break; |
| 1278 | } | 1278 | } |
| 1279 | cylRepository.save(cyl); | 1279 | cylRepository.save(cyl); |
| 1280 | - }*/ | 1280 | + } |
| 1281 | } | 1281 | } |
| 1282 | newMap.put("status", ResponseCode.SUCCESS); | 1282 | newMap.put("status", ResponseCode.SUCCESS); |
| 1283 | } | 1283 | } |
| @@ -1289,6 +1289,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | @@ -1289,6 +1289,7 @@ public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbS | ||
| 1289 | return newMap; | 1289 | return newMap; |
| 1290 | } | 1290 | } |
| 1291 | 1291 | ||
| 1292 | + | ||
| 1292 | @Override | 1293 | @Override |
| 1293 | public String checkJsy(Map<String, Object> map) { | 1294 | public String checkJsy(Map<String, Object> map) { |
| 1294 | // TODO Auto-generated method stub | 1295 | // TODO Auto-generated method stub |
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
| @@ -101,6 +101,8 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | @@ -101,6 +101,8 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | ||
| 101 | List<Map<String,String>> findLpName(String lpName); | 101 | List<Map<String,String>> findLpName(String lpName); |
| 102 | 102 | ||
| 103 | List<Map<String,Object>> account(String line,String date,String code,String xlName, String type); | 103 | List<Map<String,Object>> account(String line,String date,String code,String xlName, String type); |
| 104 | + List<Map<String,Object>> accountPx(String line,String date,String code,String xlName, String px); | ||
| 105 | + | ||
| 104 | 106 | ||
| 105 | List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName,String code, String type); | 107 | List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName,String code, String type); |
| 106 | 108 |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -1811,6 +1811,46 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -1811,6 +1811,46 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 1811 | 1811 | ||
| 1812 | 1812 | ||
| 1813 | @Override | 1813 | @Override |
| 1814 | + public List<Map<String, Object>> accountPx(String line, String date, | ||
| 1815 | + String code, String xlName, String px) { | ||
| 1816 | +// List<Object[]> lsitObj = scheduleRealInfoRepository.accountPx(line, date, code,px); | ||
| 1817 | + List<Map<String, Object>> listMap = new ArrayList<Map<String, Object>>(); | ||
| 1818 | + String sql= "SELECT c.company,r.request_code,FROM_UNIXTIME(r.timestamp/1000,'%Y-%m-%d %T') as date," | ||
| 1819 | + + "c.inside_code FROM bsth_v_report_80 r LEFT JOIN bsth_c_cars c " | ||
| 1820 | + + "ON c.equipment_code = r.device_id where " | ||
| 1821 | + + "FROM_UNIXTIME(r.timestamp/1000,'%Y-%m-%d') = '"+date +"'" | ||
| 1822 | + + "and r.line_id = "+line+" and c.inside_code like '%"+code+"%'" | ||
| 1823 | + + " order by c.inside_code "+px; | ||
| 1824 | + Map<String, Object> map; | ||
| 1825 | + List<Object[]> lsitObj = jdbcTemplate.query(sql, | ||
| 1826 | + new RowMapper<Object[]>() { | ||
| 1827 | + @Override | ||
| 1828 | + public Object[] mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 1829 | + Object[] t = new Object[4]; | ||
| 1830 | + t[0]=rs.getString("company"); | ||
| 1831 | + t[1]=rs.getString("request_code"); | ||
| 1832 | + t[2]=rs.getString("date"); | ||
| 1833 | + t[3]=rs.getString("inside_code"); | ||
| 1834 | + return t; | ||
| 1835 | + } | ||
| 1836 | + }); | ||
| 1837 | + int i = 1; | ||
| 1838 | + for (Object[] obj : lsitObj) { | ||
| 1839 | + if (obj != null) { | ||
| 1840 | + map = new HashMap<String, Object>(); | ||
| 1841 | + map.put("num", i++); | ||
| 1842 | + map.put("xlName", xlName); | ||
| 1843 | + map.put("clZbh", obj[3]); | ||
| 1844 | + map.put("company", obj[0]); | ||
| 1845 | + map.put("requestType", "0x" + Integer.toHexString(Integer.parseInt(obj[1] + "")).toUpperCase()); | ||
| 1846 | + map.put("requestTime", obj[2]); | ||
| 1847 | + listMap.add(map); | ||
| 1848 | + } | ||
| 1849 | + } | ||
| 1850 | + | ||
| 1851 | + return listMap; | ||
| 1852 | + } | ||
| 1853 | + @Override | ||
| 1814 | public List<Map<String, Object>> account(String line, String date, | 1854 | public List<Map<String, Object>> account(String line, String date, |
| 1815 | String code, String xlName, String type) { | 1855 | String code, String xlName, String type) { |
| 1816 | List<Object[]> lsitObj = scheduleRealInfoRepository.account(line, date, code); | 1856 | List<Object[]> lsitObj = scheduleRealInfoRepository.account(line, date, code); |
src/main/resources/static/pages/forms/statement/account.html
| @@ -55,7 +55,7 @@ | @@ -55,7 +55,7 @@ | ||
| 55 | <tr> | 55 | <tr> |
| 56 | <th>序号</th> | 56 | <th>序号</th> |
| 57 | <th>线路</th> | 57 | <th>线路</th> |
| 58 | - <th>车辆</th> | 58 | + <th class="nbbmPx">车辆</th> |
| 59 | <th>所属公司</th> | 59 | <th>所属公司</th> |
| 60 | <th>请求类型</th> | 60 | <th>请求类型</th> |
| 61 | <th>请求时间</th> | 61 | <th>请求时间</th> |
| @@ -140,10 +140,37 @@ | @@ -140,10 +140,37 @@ | ||
| 140 | } | 140 | } |
| 141 | }); | 141 | }); |
| 142 | } | 142 | } |
| 143 | - var line = $("#line").val(); | ||
| 144 | - var xlName = $("#select2-line-container").html(); | ||
| 145 | - var date = $("#date").val(); | ||
| 146 | - var code = $("#code").val(); | 143 | + var line = $("#line").val(); |
| 144 | + var xlName = $("#select2-line-container").html(); | ||
| 145 | + var date = $("#date").val(); | ||
| 146 | + var code = $("#code").val(); | ||
| 147 | + var px="desc"; | ||
| 148 | + $(".nbbmPx").on("click",function(){ | ||
| 149 | + if($("#date").val() == null || $("#date").val().trim().length == 0){ | ||
| 150 | + layer.msg("请选择时间"); | ||
| 151 | + return; | ||
| 152 | + } | ||
| 153 | + if(px=="desc"){ | ||
| 154 | + px="asc"; | ||
| 155 | + }else{ | ||
| 156 | + px="desc"; | ||
| 157 | + } | ||
| 158 | + line = $("#line").val(); | ||
| 159 | + xlName = $("#select2-line-container").html(); | ||
| 160 | + date = $("#date").val(); | ||
| 161 | + code = $("#code").val(); | ||
| 162 | + | ||
| 163 | + $get('/realSchedule/accountPx',{line:line,date:date,code:code,xlName:xlName,px:px},function(result){ | ||
| 164 | + $.each(result, function(i, obj) { | ||
| 165 | + obj.requestType = reqCodeMap[obj.requestType]; | ||
| 166 | + }); | ||
| 167 | + // 把数据填充到模版中 | ||
| 168 | + var tbodyHtml = template('list_account',{list:result}); | ||
| 169 | + // 把渲染好的模版html文本追加到表格中 | ||
| 170 | + $('#forms tbody').html(tbodyHtml); | ||
| 171 | + }); | ||
| 172 | + }) | ||
| 173 | + | ||
| 147 | $("#query").on("click",function(){ | 174 | $("#query").on("click",function(){ |
| 148 | if($("#date").val() == null || $("#date").val().trim().length == 0){ | 175 | if($("#date").val() == null || $("#date").val().trim().length == 0){ |
| 149 | layer.msg("请选择时间"); | 176 | layer.msg("请选择时间"); |