Commit 9a1ac028641fc567dc7ac30db6e7eaa6cf68f113
Merge remote-tracking branch 'origin/jiading_test' into jiading_test
Showing
12 changed files
with
1076 additions
and
203 deletions
Too many changes to show.
To preserve performance only 12 of 19 files are displayed.
src/main/java/com/bsth/controller/calc/CalcDlbController.java
0 → 100644
| 1 | +package com.bsth.controller.calc; | |
| 2 | + | |
| 3 | +import java.text.SimpleDateFormat; | |
| 4 | +import java.util.Date; | |
| 5 | +import java.util.HashMap; | |
| 6 | +import java.util.Map; | |
| 7 | + | |
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 9 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 10 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 11 | +import org.springframework.web.bind.annotation.RestController; | |
| 12 | + | |
| 13 | +import com.bsth.common.ResponseCode; | |
| 14 | +import com.bsth.service.calc.CalcDlbService; | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * Created by 20/05/27. | |
| 18 | + */ | |
| 19 | +@RestController | |
| 20 | +@RequestMapping("calc_dlb") | |
| 21 | +public class CalcDlbController { | |
| 22 | + | |
| 23 | + @Autowired | |
| 24 | + CalcDlbService service; | |
| 25 | + | |
| 26 | + @RequestMapping(value="/updateDlb") | |
| 27 | + public Map<String, Object> generateDaliy(@RequestParam Map<String, Object> map) throws Exception{ | |
| 28 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
| 29 | + Date d = new Date(); | |
| 30 | + d.setTime(d.getTime() - (1l*1000*60*60*24)); //默认前一天 | |
| 31 | + String date = ""; | |
| 32 | + if(map.containsKey("date") && map.get("date")!=null){ | |
| 33 | + date=map.get("date").toString().trim(); | |
| 34 | + } | |
| 35 | + | |
| 36 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 37 | + m.put("date", date); | |
| 38 | + try { | |
| 39 | + sdf.format(sdf.parse(date)); //校验日期格式 | |
| 40 | + | |
| 41 | +// m.put("status", service.impElectric(date)); | |
| 42 | + service.impElectric(date); | |
| 43 | + m.put("status", ResponseCode.SUCCESS); | |
| 44 | + | |
| 45 | + } catch (Exception e) { | |
| 46 | + // TODO: handle exception | |
| 47 | + e.printStackTrace(); | |
| 48 | + m.put("status", ResponseCode.ERROR); | |
| 49 | + return m; | |
| 50 | + } | |
| 51 | + return m; | |
| 52 | + } | |
| 53 | + | |
| 54 | +} | ... | ... |
src/main/java/com/bsth/entity/oil/Dlb.java
| ... | ... | @@ -39,11 +39,13 @@ public class Dlb { |
| 39 | 39 | private String jhsj; |
| 40 | 40 | //耗电 |
| 41 | 41 | private Double hd=0.0; |
| 42 | + //损耗 | |
| 42 | 43 | private Double sh=0.0; |
| 43 | 44 | private String shyy; |
| 44 | 45 | private Double zlc=0.0; |
| 45 | 46 | private int yhlx; |
| 46 | - | |
| 47 | + | |
| 48 | + //当前存入百公里油耗 | |
| 47 | 49 | private Double ns=0.0; |
| 48 | 50 | private Double fyylc=0.0; |
| 49 | 51 | private Double jhzlc=0.0; | ... | ... |
src/main/java/com/bsth/repository/oil/DlbRepository.java
| ... | ... | @@ -26,13 +26,22 @@ public interface DlbRepository extends BaseRepository<Dlb, Integer>{ |
| 26 | 26 | List<Dlb> obtainYlbefore(String rq,String gsdm,String fgsdm,String xlbm,String nbbm); |
| 27 | 27 | /** |
| 28 | 28 | * 当天DLB信息 |
| 29 | - * @param rq | |
| 29 | + * @param rq, xlbm(like) | |
| 30 | 30 | * @return |
| 31 | 31 | */ |
| 32 | 32 | @Query(value="SELECT * FROM bsth_c_dlb where rq=?1 and ssgsdm like %?2% " |
| 33 | 33 | + " and fgsdm like %?3%" |
| 34 | 34 | + " and xlbm like %?4% and nbbm like %?5% order by ?6 asc",nativeQuery=true) |
| 35 | 35 | List<Dlb> obtainDl(String rq,String gsbm,String fgsdm,String xlbm,String nbbm,String px); |
| 36 | + /** | |
| 37 | + * 当天DLB信息 | |
| 38 | + * @param rq, xlbm(=) | |
| 39 | + * @return | |
| 40 | + */ | |
| 41 | + @Query(value="SELECT * FROM bsth_c_dlb where rq=?1 and ssgsdm like %?2% " | |
| 42 | + + " and fgsdm like %?3%" | |
| 43 | + + " and xlbm = ?4 and nbbm like %?5% order by ?6 asc",nativeQuery=true) | |
| 44 | + List<Dlb> obtainDlEq(String rq,String gsbm,String fgsdm,String xlbm,String nbbm,String px); | |
| 36 | 45 | |
| 37 | 46 | @Query(value="select s from Dlb s " |
| 38 | 47 | + " where to_days(s.rq)=to_days(?1) " | ... | ... |
src/main/java/com/bsth/service/calc/CalcDlbService.java
0 → 100644
src/main/java/com/bsth/service/calc/impl/CalcDlbServiceImpl.java
0 → 100644
| 1 | +package com.bsth.service.calc.impl; | |
| 2 | + | |
| 3 | +import java.io.BufferedReader; | |
| 4 | +import java.io.InputStreamReader; | |
| 5 | +import java.math.BigDecimal; | |
| 6 | +import java.net.HttpURLConnection; | |
| 7 | +import java.net.URL; | |
| 8 | +import java.sql.PreparedStatement; | |
| 9 | +import java.sql.ResultSet; | |
| 10 | +import java.sql.SQLException; | |
| 11 | +import java.text.SimpleDateFormat; | |
| 12 | +import java.util.ArrayList; | |
| 13 | +import java.util.Calendar; | |
| 14 | +import java.util.Collections; | |
| 15 | +import java.util.Comparator; | |
| 16 | +import java.util.Date; | |
| 17 | +import java.util.HashMap; | |
| 18 | +import java.util.HashSet; | |
| 19 | +import java.util.Iterator; | |
| 20 | +import java.util.List; | |
| 21 | +import java.util.Map; | |
| 22 | +import java.util.Set; | |
| 23 | + | |
| 24 | +import com.alibaba.fastjson.JSONObject; | |
| 25 | +import com.bsth.entity.realcontrol.ChildTaskPlan; | |
| 26 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 27 | +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | |
| 28 | +import com.bsth.service.calc.CalcDlbService; | |
| 29 | +import com.bsth.util.Arith; | |
| 30 | + | |
| 31 | +import org.joda.time.format.DateTimeFormat; | |
| 32 | +import org.joda.time.format.DateTimeFormatter; | |
| 33 | +import org.slf4j.Logger; | |
| 34 | +import org.slf4j.LoggerFactory; | |
| 35 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 36 | +import org.springframework.jdbc.core.BatchPreparedStatementSetter; | |
| 37 | +import org.springframework.jdbc.core.JdbcTemplate; | |
| 38 | +import org.springframework.jdbc.core.RowMapper; | |
| 39 | +import org.springframework.jdbc.datasource.DataSourceTransactionManager; | |
| 40 | +import org.springframework.stereotype.Service; | |
| 41 | +import org.springframework.transaction.TransactionDefinition; | |
| 42 | +import org.springframework.transaction.TransactionStatus; | |
| 43 | +import org.springframework.transaction.support.DefaultTransactionDefinition; | |
| 44 | + | |
| 45 | +/** | |
| 46 | + * Created by 20/05/27. | |
| 47 | + */ | |
| 48 | +@Service | |
| 49 | +public class CalcDlbServiceImpl implements CalcDlbService { | |
| 50 | + | |
| 51 | + @Autowired | |
| 52 | + JdbcTemplate jdbcTemplate; | |
| 53 | + | |
| 54 | + @Autowired | |
| 55 | + ScheduleRealInfoRepository scheRepository; | |
| 56 | + | |
| 57 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 58 | + | |
| 59 | + final DateTimeFormatter dtf = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm"); | |
| 60 | + | |
| 61 | + | |
| 62 | + /** | |
| 63 | + * @throws Exception | |
| 64 | + */ | |
| 65 | + public void impElectric(String date) throws Exception{ | |
| 66 | + try { | |
| 67 | + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); | |
| 68 | + Calendar calendar2 = Calendar.getInstance(); | |
| 69 | + calendar2.setTime(new Date()); | |
| 70 | + int hours= calendar2.get(Calendar.HOUR_OF_DAY); | |
| 71 | + | |
| 72 | +// if(hoursC>=8 && hours<9){//每天8点到9点间执行 | |
| 73 | + if(true){ //无更新时点限制 | |
| 74 | + //查询所有车辆 | |
| 75 | + String sql = "select inside_code,branche_company_code, ny_type from bsth_c_cars"; | |
| 76 | + | |
| 77 | + List<Map<String, String>> listMap= jdbcTemplate.query(sql, new RowMapper<Map<String,String>>(){ | |
| 78 | + @Override | |
| 79 | + public Map<String, String> mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 80 | + Map<String, String> m=new HashMap<String, String>(); | |
| 81 | + m.put("insideCode", rs.getString("inside_code")); | |
| 82 | + m.put("brancheCompanyCode", rs.getString("branche_company_code")); | |
| 83 | + m.put("nyType", rs.getString("ny_type")); | |
| 84 | + return m; | |
| 85 | + } | |
| 86 | + }); | |
| 87 | + Map<String, String> map=new HashMap<String, String>(); | |
| 88 | + Map<String, String> nyTypeMap=new HashMap<String, String>(); | |
| 89 | + for (int i = 0; i < listMap.size(); i++) { | |
| 90 | + Map<String, String> m=listMap.get(i); | |
| 91 | + map.put(m.get("insideCode"), m.get("brancheCompanyCode")); | |
| 92 | + nyTypeMap.put(m.get("insideCode"), m.get("nyType")); | |
| 93 | + } | |
| 94 | +// Date dNow = new Date(); | |
| 95 | +// Calendar calendar = Calendar.getInstance(); | |
| 96 | +// calendar.setTime(dNow); | |
| 97 | +// calendar.add(Calendar.DAY_OF_MONTH, -1); | |
| 98 | +// Date dBefore = calendar.getTime(); | |
| 99 | +// String date = sdf.format(dBefore); | |
| 100 | + String json = this.getHttpInterface("https://web.enneagon.com/exchange/pub/rest/vehicle/getJiaDingBusDailyData?scheduleDate="+date); | |
| 101 | + List<Map<String, Object>> list=(List<Map<String, Object>>) JSONObject.parse(json); | |
| 102 | + if(list.size()>0){ | |
| 103 | + savePush(list, date, map); | |
| 104 | + } | |
| 105 | + | |
| 106 | + //第一步获取从排班表获取日期,人,车,线,路牌,里程 | |
| 107 | + List<ScheduleRealInfo> findByDate = scheRepository.findByDate(date); | |
| 108 | + Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); | |
| 109 | + for(ScheduleRealInfo s : findByDate){ | |
| 110 | + String key = s.getGsBm() + "/" + s.getFgsBm() + "/" + s.getXlBm() + "/" + s.getLpName() + "/" + s.getClZbh() + "/" + s.getjGh(); | |
| 111 | + if(!(keyMap.containsKey(key))){ | |
| 112 | + keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | |
| 113 | + } | |
| 114 | + keyMap.get(key).add(s); | |
| 115 | + } | |
| 116 | + | |
| 117 | + List<Map<String, Object>> list1 = new ArrayList<Map<String, Object>>(); | |
| 118 | + List<Map<String, Object>> list2 = (List<Map<String, Object>>) JSONObject.parse(json); | |
| 119 | + Set<String> set = new HashSet<String>(); | |
| 120 | + Map<String, List<Map<String, Object>>> keyMap1 = new HashMap<String, List<Map<String, Object>>>(); | |
| 121 | + Map<String, List<Map<String, Object>>> keyMap2 = new HashMap<String, List<Map<String, Object>>>(); | |
| 122 | + | |
| 123 | + for(String key : keyMap.keySet()){ | |
| 124 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 125 | + List<ScheduleRealInfo> list3 = keyMap.get(key); | |
| 126 | + double sjzgl = 0; | |
| 127 | + String gsName = "", fgsName = "", xlName = "", jName = "", red = "", fcsj = ""; | |
| 128 | + for (ScheduleRealInfo scheduleRealInfo : list3) { | |
| 129 | + | |
| 130 | + //取最小的发车时间 | |
| 131 | + String fcsjA = "", redA = ""; | |
| 132 | + if(scheduleRealInfo.getFcsjActual() != null && scheduleRealInfo.getFcsjActual().trim().length() > 0){ | |
| 133 | + fcsjA = scheduleRealInfo.getFcsjActual(); | |
| 134 | + } else if(scheduleRealInfo.getFcsj() != null && scheduleRealInfo.getFcsj().trim().length() > 0){ | |
| 135 | + fcsjA = scheduleRealInfo.getFcsj(); | |
| 136 | + } | |
| 137 | + if(scheduleRealInfo.getRealExecDate() != null && scheduleRealInfo.getRealExecDate().trim().length() > 0){ | |
| 138 | + redA = scheduleRealInfo.getRealExecDate(); | |
| 139 | + } else { | |
| 140 | + redA = date; | |
| 141 | + } | |
| 142 | + if(fcsjA.trim().length() > 0){ | |
| 143 | + if(fcsj.length() == 0 || dtf.parseMillis(redA+fcsjA) < dtf.parseMillis(red+fcsj)){ | |
| 144 | + fcsj = fcsjA; | |
| 145 | + red = redA; | |
| 146 | + } | |
| 147 | + } | |
| 148 | + | |
| 149 | + if(scheduleRealInfo.getGsName() != null && scheduleRealInfo.getGsName().trim().length() > 0){ | |
| 150 | + gsName = scheduleRealInfo.getGsName(); | |
| 151 | + } | |
| 152 | + if(scheduleRealInfo.getFgsName() != null && scheduleRealInfo.getFgsName().trim().length() > 0){ | |
| 153 | + fgsName = scheduleRealInfo.getFgsName(); | |
| 154 | + } | |
| 155 | + if(scheduleRealInfo.getXlName() != null && scheduleRealInfo.getXlName().trim().length() > 0){ | |
| 156 | + xlName = scheduleRealInfo.getXlName(); | |
| 157 | + } | |
| 158 | + if(scheduleRealInfo.getjName() != null && scheduleRealInfo.getjName().trim().length() > 0){ | |
| 159 | + jName = scheduleRealInfo.getjName(); | |
| 160 | + } | |
| 161 | + | |
| 162 | + //开始算里程 | |
| 163 | + if (!isInOut(scheduleRealInfo)) { | |
| 164 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | |
| 165 | + if(!scheduleRealInfo.isSflj()){ | |
| 166 | + if(childTaskPlans.isEmpty()){ | |
| 167 | + if(!scheduleRealInfo.isDestroy()){ | |
| 168 | + //非子任务 实际里程 | |
| 169 | + double jhlcOrig=scheduleRealInfo.getJhlcOrig()==null?0:scheduleRealInfo.getJhlcOrig(); | |
| 170 | + double jhlc=scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc(); | |
| 171 | + if(jhlc-jhlcOrig>0){ | |
| 172 | + sjzgl=Arith.add(sjzgl,jhlcOrig); | |
| 173 | + }else{ | |
| 174 | + sjzgl=Arith.add(sjzgl,jhlc); | |
| 175 | + } | |
| 176 | + } | |
| 177 | + //临加里程 | |
| 178 | + double jhlc=scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc(); | |
| 179 | + double jhlcOrig=scheduleRealInfo.getJhlcOrig()==null?0:scheduleRealInfo.getJhlcOrig(); | |
| 180 | + double zjlc=Arith.sub(jhlc, jhlcOrig); | |
| 181 | + if(zjlc>0){ | |
| 182 | + sjzgl=Arith.add(zjlc, sjzgl); | |
| 183 | + } | |
| 184 | + } else { | |
| 185 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 186 | + while (it.hasNext()) { | |
| 187 | + ChildTaskPlan childTaskPlan = it.next(); | |
| 188 | + if(childTaskPlan.getMileageType().equals("service") | |
| 189 | + &&"正常".equals(childTaskPlan.getType1()) | |
| 190 | + && childTaskPlan.getCcId()==null){ | |
| 191 | + //子任务 实际里程 | |
| 192 | + if (!childTaskPlan.isDestroy()) { | |
| 193 | + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | |
| 194 | + sjzgl=Arith.add(sjzgl,jhgl); | |
| 195 | + } | |
| 196 | + } else if(childTaskPlan.getMileageType().equals("empty") && childTaskPlan.getCcId()==null){ | |
| 197 | + //空驶公里 | |
| 198 | + if (!childTaskPlan.isDestroy()) { | |
| 199 | + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | |
| 200 | + sjzgl=Arith.add(sjzgl,jhgl); | |
| 201 | + } | |
| 202 | + } else if("service".equals(childTaskPlan.getMileageType())&&"临加".equals(childTaskPlan.getType1()) | |
| 203 | + && childTaskPlan.getCcId()==null){ | |
| 204 | + //临加里程 | |
| 205 | + if (!childTaskPlan.isDestroy()) { | |
| 206 | + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | |
| 207 | + sjzgl=Arith.add(sjzgl,jhgl); | |
| 208 | + } | |
| 209 | + } | |
| 210 | + } | |
| 211 | + } | |
| 212 | + } else { | |
| 213 | + //临加里程 | |
| 214 | + if(childTaskPlans.isEmpty()){ | |
| 215 | + sjzgl=Arith.add(sjzgl,scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc()); | |
| 216 | + }else{ | |
| 217 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 218 | + while (it.hasNext()) { | |
| 219 | + ChildTaskPlan childTaskPlan = it.next(); | |
| 220 | + if(childTaskPlan.getMileageType().equals("service") && childTaskPlan.getCcId()==null){ | |
| 221 | + if (!childTaskPlan.isDestroy()) { | |
| 222 | + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | |
| 223 | + sjzgl=Arith.add(sjzgl,jhgl); | |
| 224 | + } | |
| 225 | + } | |
| 226 | + } | |
| 227 | + } | |
| 228 | + } | |
| 229 | + } else { | |
| 230 | + //进出场里程 | |
| 231 | + Set<ChildTaskPlan> childTaskPlans = scheduleRealInfo.getcTasks(); | |
| 232 | + if(childTaskPlans.isEmpty()){ | |
| 233 | + if(!scheduleRealInfo.isDestroy()){ | |
| 234 | + sjzgl=Arith.add(sjzgl, scheduleRealInfo.getJhlc()==null?0:scheduleRealInfo.getJhlc()); | |
| 235 | + } | |
| 236 | + }else{ | |
| 237 | + Iterator<ChildTaskPlan> it = childTaskPlans.iterator(); | |
| 238 | + while (it.hasNext()) { | |
| 239 | + ChildTaskPlan childTaskPlan = it.next(); | |
| 240 | + if(childTaskPlan.getMileageType().equals("empty") && childTaskPlan.getCcId()==null){ | |
| 241 | + if (!childTaskPlan.isDestroy()) { | |
| 242 | + Float jhgl=childTaskPlan.getMileage()==null?0:childTaskPlan.getMileage(); | |
| 243 | + sjzgl=Arith.add(sjzgl,jhgl); | |
| 244 | + } | |
| 245 | + } | |
| 246 | + } | |
| 247 | + } | |
| 248 | + } | |
| 249 | + } | |
| 250 | + String[] split = key.split("/"); | |
| 251 | + m.put("red", red); | |
| 252 | + m.put("fcsj", fcsj); | |
| 253 | + m.put("gsName", gsName); | |
| 254 | + m.put("fgsName", fgsName); | |
| 255 | + m.put("date", date); | |
| 256 | + m.put("gsBm", split[0]); | |
| 257 | + m.put("fgsBm", split[1]); | |
| 258 | + m.put("xlBm", split[2]); | |
| 259 | + m.put("xlName", xlName); | |
| 260 | + m.put("lpName", split[3]); | |
| 261 | + m.put("clZbh", split[4]); | |
| 262 | + m.put("jGh", split[5]); | |
| 263 | + m.put("jName", jName); | |
| 264 | + m.put("sjzgl", sjzgl); | |
| 265 | + list1.add(m); | |
| 266 | + } | |
| 267 | + | |
| 268 | + //第二步根据日期,车辆匹配 | |
| 269 | + for(Map<String, Object> m : list1){//里程 | |
| 270 | + String key = m.get("date").toString() + "/" + m.get("clZbh").toString(); | |
| 271 | + if(!(keyMap1.containsKey(key))){ | |
| 272 | + keyMap1.put(key, new ArrayList<Map<String, Object>>()); | |
| 273 | + } | |
| 274 | + keyMap1.get(key).add(m); | |
| 275 | + set.add(key); | |
| 276 | + } | |
| 277 | + for(Map<String, Object> m : list2){//加电量 | |
| 278 | + String key = m.get("scheduleDate").toString() + "/" + m.get("insideCode").toString(); | |
| 279 | + if(!(keyMap2.containsKey(key))){ | |
| 280 | + keyMap2.put(key, new ArrayList<Map<String, Object>>()); | |
| 281 | + } | |
| 282 | + keyMap2.get(key).add(m); | |
| 283 | + set.add(key); | |
| 284 | + } | |
| 285 | + | |
| 286 | + //第三步 一车多单进行拆分 | |
| 287 | + final List<Map<String, Object>> list5 = new ArrayList<Map<String, Object>>(); | |
| 288 | + | |
| 289 | + for(String key : set){ | |
| 290 | +// Map<String, Object> resMap = new HashMap<String, Object>(); | |
| 291 | + List<Map<String, Object>> list3 = keyMap1.get(key); | |
| 292 | + List<Map<String, Object>> list4 = keyMap2.get(key); | |
| 293 | + | |
| 294 | + double jdl = 0d; | |
| 295 | + if(list4 != null){ | |
| 296 | + for(Map<String, Object> m : list4){ | |
| 297 | + jdl = Arith.add(jdl, m.get("sum").toString()); | |
| 298 | + } | |
| 299 | + } | |
| 300 | + | |
| 301 | + String clZbh = key.split("/")[1]; | |
| 302 | + if(jdl < 0.01d){ | |
| 303 | + if(nyTypeMap.get(clZbh) != null | |
| 304 | + && "1".equals(nyTypeMap.get(clZbh).toString()) //1:全电;2:油电混合 | |
| 305 | + && "2".equals(nyTypeMap.get(clZbh).toString())){ | |
| 306 | + //加电量为0情况下,只取电车 | |
| 307 | + } else { | |
| 308 | + continue; | |
| 309 | + } | |
| 310 | + } | |
| 311 | + | |
| 312 | + if(list3 != null && list3.size() > 0){ | |
| 313 | + | |
| 314 | + if(list3.size() > 1){ //多条时,排序 | |
| 315 | + Collections.sort(list3, new Comparator<Map<String, Object>>() { | |
| 316 | + @Override | |
| 317 | + public int compare(Map<String, Object> c1, Map<String, Object> c2) { | |
| 318 | + String k1 = c1.get("red").toString() + c1.get("fcsj").toString(); | |
| 319 | + String k2 = c2.get("red").toString() + c2.get("fcsj").toString(); | |
| 320 | + | |
| 321 | + if(c1.get("fcsj").toString().length() == 0){ | |
| 322 | + return -1; | |
| 323 | + } | |
| 324 | + if(c2.get("fcsj").toString().length() == 0){ | |
| 325 | + return 1; | |
| 326 | + } | |
| 327 | + | |
| 328 | + long l1 = dtf.parseMillis(k1); | |
| 329 | + long l2 = dtf.parseMillis(k2); | |
| 330 | + | |
| 331 | + long diff = l1 - l2; | |
| 332 | + if (diff > 0l) { | |
| 333 | + return 1; | |
| 334 | + } else if (diff < 0l) { | |
| 335 | + return -1; | |
| 336 | + } | |
| 337 | + return 0; //相等为0 | |
| 338 | + } | |
| 339 | + }); | |
| 340 | + } | |
| 341 | + | |
| 342 | + double zgl = 0; | |
| 343 | + for(Map<String, Object> m : list3){ | |
| 344 | + zgl = Arith.add(zgl, m.get("sjzgl").toString()); | |
| 345 | + } | |
| 346 | + double jdl_ = Arith.add(0, jdl);//为保精度计算最后总数不变,一车多单情况最后一条直接用减剩下的值 | |
| 347 | + for(int i = 0; i < list3.size(); i++){ | |
| 348 | + Map<String, Object> m = list3.get(i); | |
| 349 | + m.put("jcsx", i + 1); //顺序 | |
| 350 | + | |
| 351 | + if(i == (list3.size() - 1)){ //最后一条 | |
| 352 | + m.put("jdl", jdl_); | |
| 353 | + } else { | |
| 354 | + if(m.get("sjzgl") != null && !("0".equals(m.get("sjzgl").toString()))){ | |
| 355 | + double mul = Arith.mul(jdl, Arith.div(m.get("sjzgl").toString(), zgl, 2)); | |
| 356 | + double div = Arith.div(mul, 1, 2); //除1,利用工具类以去除小数点 | |
| 357 | + jdl_ = Arith.sub(jdl_, div); | |
| 358 | + m.put("jdl", div); | |
| 359 | + } else { | |
| 360 | + m.put("jdl", "0"); | |
| 361 | + } | |
| 362 | + } | |
| 363 | + | |
| 364 | + if(m.get("sjzgl") != null && new BigDecimal(m.get("sjzgl").toString()).doubleValue() > 0d | |
| 365 | + && new BigDecimal(m.get("jdl").toString()).doubleValue() > 0d){ | |
| 366 | + double mul = Arith.mul(Arith.div(m.get("jdl").toString(), m.get("sjzgl").toString(), 4), 100); | |
| 367 | + m.put("hdl",mul); | |
| 368 | + } else { | |
| 369 | + m.put("hdl", 0); | |
| 370 | + } | |
| 371 | + list5.add(m); | |
| 372 | + } | |
| 373 | + } else if(list4 != null && list4.size() > 0){ | |
| 374 | + Map<String, Object> map2 = list4.get(0); | |
| 375 | + Map<String, Object> m = new HashMap<String, Object>(); | |
| 376 | + m.put("fcsj", ""); | |
| 377 | + m.put("jcsx", "1"); | |
| 378 | + m.put("gsName", ""); | |
| 379 | + m.put("fgsName", ""); | |
| 380 | + m.put("date", date); | |
| 381 | + m.put("gsBm", "24"); | |
| 382 | + m.put("fgsBm", map.get(map2.get("insideCode").toString())==null?"":map.get(map2.get("insideCode").toString()).toString()); | |
| 383 | + m.put("xlBm", ""); | |
| 384 | + m.put("xlName", ""); | |
| 385 | + m.put("lpName", ""); | |
| 386 | + m.put("clZbh", map2.get("insideCode").toString()); | |
| 387 | + m.put("jGh", ""); | |
| 388 | + m.put("jName", ""); | |
| 389 | + m.put("sjzgl", 0); //总里程 | |
| 390 | + m.put("jdl", jdl); //加电量(耗电量) | |
| 391 | + m.put("hdl", 0); //百公里耗电 | |
| 392 | + list5.add(m); | |
| 393 | + } | |
| 394 | + } | |
| 395 | + | |
| 396 | + //第四部保存入库 | |
| 397 | + SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 398 | + String createDate = sdf2.format(new Date()); | |
| 399 | + for(Map<String, Object> m : list5){ | |
| 400 | + m.put("created", "aotu"); //代表定时器自动生成 | |
| 401 | + m.put("createDate", createDate); | |
| 402 | + } | |
| 403 | +// String deleteSql = "delete from bsth_c_hdl where date='" + date + "' and created = 'aotu'"; | |
| 404 | + String deleteSql = "delete from bsth_c_dlb where rq = '" + date + "'"; | |
| 405 | + jdbcTemplate.batchUpdate(deleteSql); //先删除这一天的数据 | |
| 406 | +// String insertSql = "insert into bsth_c_hdl(gs_bm, fgs_bm, gs_name, fgs_name, date, nbbm, j_gh, j_name," | |
| 407 | +// + " xl_bm, xl_name, lp_name, jdl, sjzgl, hdl, created, create_date) " | |
| 408 | +// + " VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; | |
| 409 | + String insertSql = "insert into bsth_c_dlb(ssgsdm, fgsdm, rq, czcd, jzcd, nbbm, jsy, jname," | |
| 410 | + + " xlbm, linename, lp, cdl, hd, zlc, ns, createtime, jhsj, jcsx, nylx, yhlx, jhbc, jhzbc," | |
| 411 | + + " fyylc, jhfyylc, jhzlc, jzlc, sfkt, sh, sjbc, sjzbc) " | |
| 412 | + + " VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; | |
| 413 | + jdbcTemplate.batchUpdate(insertSql, new BatchPreparedStatementSetter() { | |
| 414 | + | |
| 415 | + @Override | |
| 416 | + public void setValues(PreparedStatement ps, int i) throws SQLException { | |
| 417 | + Map<String, Object> m = list5.get(i); | |
| 418 | + ps.setString(1, "24"); | |
| 419 | + ps.setString(2, m.get("fgsBm").toString()); | |
| 420 | + ps.setString(3, m.get("date").toString()); | |
| 421 | + ps.setString(4, "100"); | |
| 422 | + ps.setString(5, "100"); | |
| 423 | + ps.setString(6, m.get("clZbh").toString()); | |
| 424 | + ps.setString(7, m.get("jGh").toString()); | |
| 425 | + ps.setString(8, m.get("jName").toString()); | |
| 426 | + ps.setString(9, m.get("xlBm").toString()); | |
| 427 | + ps.setString(10, m.get("xlName").toString()); | |
| 428 | + ps.setString(11, m.get("lpName").toString()); | |
| 429 | + ps.setString(12, m.get("jdl").toString()); | |
| 430 | + ps.setString(13, m.get("jdl").toString()); | |
| 431 | + ps.setString(14, m.get("sjzgl").toString()); | |
| 432 | + ps.setString(15, m.get("hdl").toString()); | |
| 433 | + ps.setString(16, m.get("createDate").toString()); | |
| 434 | + ps.setString(17, m.get("fcsj").toString()); | |
| 435 | + ps.setString(18, m.get("jcsx").toString()); | |
| 436 | + ps.setString(19, "0"); | |
| 437 | + ps.setString(20, "0"); | |
| 438 | + ps.setString(21, "0"); | |
| 439 | + ps.setString(22, "0"); | |
| 440 | + ps.setString(23, "0"); | |
| 441 | + ps.setString(24, "0"); | |
| 442 | + ps.setString(25, "0"); | |
| 443 | + ps.setString(26, "0"); | |
| 444 | + ps.setString(27, "0"); | |
| 445 | + ps.setString(28, "0"); | |
| 446 | + ps.setString(29, "0"); | |
| 447 | + ps.setString(30, "0"); | |
| 448 | + } | |
| 449 | + | |
| 450 | + @Override | |
| 451 | + public int getBatchSize() { | |
| 452 | + return list5.size(); | |
| 453 | + } | |
| 454 | + }); | |
| 455 | + } | |
| 456 | + }catch (Exception e) { | |
| 457 | + // TODO Auto-generated catch block | |
| 458 | + throw e; | |
| 459 | + }finally{ | |
| 460 | + logger.info("setDDRB:"); | |
| 461 | + } | |
| 462 | + } | |
| 463 | + | |
| 464 | + private void savePush(final List<Map<String, Object>> list,final String rq,final Map<String, String> map) { | |
| 465 | + String sql = "insert into bsth_c_jdl(rq, gs_bm, fgs_bm,jdl, " | |
| 466 | + + " nbbm,adding_time,remarks) " + | |
| 467 | + " VALUES(?,?,?,?,?,?,?)"; | |
| 468 | + | |
| 469 | + //编程式事务 | |
| 470 | + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource()); | |
| 471 | + DefaultTransactionDefinition def = new DefaultTransactionDefinition(); | |
| 472 | + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED); | |
| 473 | + TransactionStatus status = tran.getTransaction(def); | |
| 474 | + try { | |
| 475 | + String sql2="delete from bsth_c_jdl where rq='"+rq+"' and remarks='JKSJ'"; | |
| 476 | + jdbcTemplate.batchUpdate(sql2); | |
| 477 | + jdbcTemplate.batchUpdate(sql, new BatchPreparedStatementSetter() { | |
| 478 | + | |
| 479 | + @Override | |
| 480 | + public void setValues(PreparedStatement ps, int i) throws SQLException { | |
| 481 | + Map<String, Object> t = list.get(i); | |
| 482 | + ps.setString(1, t.get("scheduleDate").toString()); | |
| 483 | + ps.setString(2, "24"); | |
| 484 | + ps.setString(3, map.get(t.get("insideCode").toString())==null?"":map.get(t.get("insideCode").toString()).toString()); | |
| 485 | + ps.setString(4, t.get("sum").toString()); | |
| 486 | + ps.setString(5, t.get("insideCode").toString()); | |
| 487 | + ps.setString(6, t.get("addingTime").toString()); | |
| 488 | + ps.setString(7, "JKSJ"); //代表来源接口数据 | |
| 489 | + | |
| 490 | + } | |
| 491 | + | |
| 492 | + @Override | |
| 493 | + public int getBatchSize() { | |
| 494 | + return list.size(); | |
| 495 | + } | |
| 496 | + }); | |
| 497 | + | |
| 498 | + tran.commit(status); | |
| 499 | + } catch (Exception e) { | |
| 500 | + tran.rollback(status); | |
| 501 | + logger.error("", e); | |
| 502 | + } | |
| 503 | + } | |
| 504 | + | |
| 505 | + public static boolean isInOut(ScheduleRealInfo s){ | |
| 506 | + boolean fage=false; | |
| 507 | + if(s.getBcType().equals("in")){ | |
| 508 | + fage=true; | |
| 509 | + } | |
| 510 | + if(s.getBcType().equals("out")){ | |
| 511 | + fage=true; | |
| 512 | + } | |
| 513 | + if(s.getBcType().equals("ldks")){ | |
| 514 | + fage=true; | |
| 515 | + } | |
| 516 | + | |
| 517 | + return fage; | |
| 518 | + } | |
| 519 | + | |
| 520 | + public static String getHttpInterface(String path){ | |
| 521 | + BufferedReader in = null; | |
| 522 | + StringBuffer result = null; | |
| 523 | + try { | |
| 524 | + URL url = new URL(path); | |
| 525 | + //打开和url之间的连接 | |
| 526 | + HttpURLConnection connection = (HttpURLConnection) url.openConnection(); | |
| 527 | + connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); | |
| 528 | + connection.setRequestProperty("Charset", "utf-8"); | |
| 529 | + connection.connect(); | |
| 530 | + | |
| 531 | + result = new StringBuffer(); | |
| 532 | + //读取URL的响应 | |
| 533 | + in = new BufferedReader(new InputStreamReader( | |
| 534 | + connection.getInputStream(),"utf-8")); | |
| 535 | + String line; | |
| 536 | + while ((line = in.readLine()) != null) { | |
| 537 | + | |
| 538 | + result.append(line); | |
| 539 | + } | |
| 540 | + return result.toString(); | |
| 541 | + } catch (Exception e) { | |
| 542 | + e.printStackTrace(); | |
| 543 | + }finally { | |
| 544 | + try { | |
| 545 | + if (in != null) { | |
| 546 | + in.close(); | |
| 547 | + } | |
| 548 | + } catch (Exception e2) { | |
| 549 | + e2.printStackTrace(); | |
| 550 | + } | |
| 551 | + } | |
| 552 | + return null; | |
| 553 | + } | |
| 554 | + | |
| 555 | +} | ... | ... |
src/main/java/com/bsth/service/impl/BusIntervalServiceImpl.java
| ... | ... | @@ -2682,6 +2682,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 2682 | 2682 | double jzl = 0.0; |
| 2683 | 2683 | double zlc = 0.0; |
| 2684 | 2684 | String rylx=""; |
| 2685 | + double ccyl_ = 0.0; | |
| 2686 | + double jcyl_ = 0.0; | |
| 2687 | + double yh_ = 0.0; | |
| 2688 | + double jzl_ = 0.0; | |
| 2685 | 2689 | // List<Ylb> listYlb = ylbRepository.queryListYlb(fcrq, s.getClZbh(), s.getjGh(),xlbm); |
| 2686 | 2690 | // List<Dlb> listDlb = dlbRepository.queryListDlb(fcrq, s.getClZbh(), s.getjGh(),xlbm); |
| 2687 | 2691 | List<Ylb> listYlb = ylbMap.get(jsy + nbbm); |
| ... | ... | @@ -2690,57 +2694,105 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 2690 | 2694 | // List<Cars> listCars = carsRepository.findCarsByCode(s.getClZbh()); |
| 2691 | 2695 | List<Cars> listCars = carMap.get(s.getClZbh()); |
| 2692 | 2696 | if (listCars != null && listCars.size() > 0) { |
| 2693 | - if(listCars.get(0).getSfdc()!=null){ | |
| 2694 | - if (listCars.get(0).getSfdc()) { | |
| 2695 | - type = 1; | |
| 2696 | - if(listDlb != null) | |
| 2697 | - for (int i = 0; i < listDlb.size(); i++) { | |
| 2698 | - Dlb d = listDlb.get(i); | |
| 2699 | - if (d.getLp() == null) { | |
| 2700 | - ccyl = Arith.add(ccyl, d.getCzcd()); | |
| 2701 | - jcyl = Arith.add(jcyl, d.getJzcd()); | |
| 2702 | - yh = Arith.add(yh, d.getHd()); | |
| 2703 | - jzl = Arith.add(jzl, d.getCdl()); | |
| 2704 | - zlc = Arith.add(zlc, d.getZlc()); | |
| 2705 | - } else { | |
| 2706 | - if (d.getLp().equals(s.getLpName())) { | |
| 2707 | - ccyl = Arith.add(ccyl, d.getCzcd()); | |
| 2708 | - jcyl = Arith.add(jcyl, d.getJzcd()); | |
| 2709 | - yh = Arith.add(yh, d.getHd()); | |
| 2710 | - jzl = Arith.add(jzl, d.getCdl()); | |
| 2711 | - zlc = Arith.add(zlc, d.getZlc()); | |
| 2712 | - } | |
| 2713 | - } | |
| 2714 | - | |
| 2715 | - } | |
| 2716 | - } else { | |
| 2717 | - type = 0; | |
| 2718 | - if(listYlb != null) | |
| 2719 | - for (int i = 0; i < listYlb.size(); i++) { | |
| 2720 | - Ylb y = listYlb.get(i); | |
| 2721 | - if (y.getLp() == null) { | |
| 2722 | - ccyl = Arith.add(ccyl, y.getCzyl()); | |
| 2723 | - jcyl = Arith.add(jcyl, y.getJzyl()); | |
| 2724 | - yh = Arith.add(yh, y.getYh()); | |
| 2725 | - jzl = Arith.add(jzl, y.getJzl()); | |
| 2726 | - zlc = Arith.add(zlc, y.getZlc()); | |
| 2727 | - if(dMap.get(y.getRylx())!=null) | |
| 2728 | - rylx=dMap.get(y.getRylx()).toString(); | |
| 2729 | - } else { | |
| 2730 | - if (y.getLp().equals(s.getLpName())) { | |
| 2731 | - ccyl = Arith.add(ccyl, y.getCzyl()); | |
| 2732 | - jcyl = Arith.add(jcyl, y.getJzyl()); | |
| 2733 | - yh = Arith.add(yh, y.getYh()); | |
| 2734 | - jzl = Arith.add(jzl, y.getJzl()); | |
| 2735 | - zlc = Arith.add(zlc, y.getZlc()); | |
| 2736 | - if(dMap.get(y.getRylx())!=null) | |
| 2737 | - rylx=dMap.get(y.getRylx()).toString(); | |
| 2738 | - | |
| 2739 | - } | |
| 2740 | - } | |
| 2741 | - } | |
| 2742 | - } | |
| 2743 | - } | |
| 2697 | + if (listCars.get(0).getNyType() != null) { | |
| 2698 | + if ("1".equals(listCars.get(0).getNyType().toString())) { //全电 | |
| 2699 | +// List<Dlb> listDlb = dlbRepository.queryListDlb(fcrq, s.getClZbh(), s.getjGh(), xlbm); | |
| 2700 | + type = 1; | |
| 2701 | + if(listDlb != null){ | |
| 2702 | + for (int i = 0; i < listDlb.size(); i++) { | |
| 2703 | + Dlb d = listDlb.get(i); | |
| 2704 | + if (d.getLp() == null) { | |
| 2705 | + ccyl = Arith.add(ccyl, d.getCzcd()); | |
| 2706 | + jcyl = Arith.add(jcyl, d.getJzcd()); | |
| 2707 | + yh = Arith.add(yh, d.getHd()); | |
| 2708 | + jzl = Arith.add(jzl, d.getCdl()); | |
| 2709 | + zlc = Arith.add(zlc, d.getZlc()); | |
| 2710 | + } else { | |
| 2711 | + if (d.getLp().equals(s.getLpName())) { | |
| 2712 | + ccyl = Arith.add(ccyl, d.getCzcd()); | |
| 2713 | + jcyl = Arith.add(jcyl, d.getJzcd()); | |
| 2714 | + yh = Arith.add(yh, d.getHd()); | |
| 2715 | + jzl = Arith.add(jzl, d.getCdl()); | |
| 2716 | + zlc = Arith.add(zlc, d.getZlc()); | |
| 2717 | + } | |
| 2718 | + } | |
| 2719 | + } | |
| 2720 | + } | |
| 2721 | + } else if("2".equals(listCars.get(0).getNyType().toString())){ //油点混合 | |
| 2722 | +// List<Ylb> listYlb = ylbRepository.queryListYlb(fcrq, s.getClZbh(), s.getjGh(), xlbm); | |
| 2723 | +// List<Dlb> listDlb = dlbRepository.queryListDlb(fcrq, s.getClZbh(), s.getjGh(), xlbm); | |
| 2724 | + type = 2; | |
| 2725 | + if(listYlb != null){ | |
| 2726 | + for (int i = 0; i < listYlb.size(); i++) { | |
| 2727 | + Ylb y = listYlb.get(i); | |
| 2728 | + if (y.getLp() == null) { | |
| 2729 | + ccyl = Arith.add(ccyl, y.getCzyl()); | |
| 2730 | + jcyl = Arith.add(jcyl, y.getJzyl()); | |
| 2731 | + yh = Arith.add(yh, y.getYh()); | |
| 2732 | + jzl = Arith.add(jzl, y.getJzl()); | |
| 2733 | + zlc = Arith.add(zlc, y.getZlc()); | |
| 2734 | + if(dMap.get(y.getRylx())!=null) | |
| 2735 | + rylx =dMap.get(y.getRylx()).toString(); | |
| 2736 | + } else { | |
| 2737 | + if (y.getLp().equals(s.getLpName())) { | |
| 2738 | + ccyl = Arith.add(ccyl, y.getCzyl()); | |
| 2739 | + jcyl = Arith.add(jcyl, y.getJzyl()); | |
| 2740 | + yh = Arith.add(yh, y.getYh()); | |
| 2741 | + jzl = Arith.add(jzl, y.getJzl()); | |
| 2742 | + zlc = Arith.add(zlc, y.getZlc()); | |
| 2743 | + if(dMap.get(y.getRylx())!=null) | |
| 2744 | + rylx =dMap.get(y.getRylx()).toString(); | |
| 2745 | + } | |
| 2746 | + } | |
| 2747 | + } | |
| 2748 | + } | |
| 2749 | + if(listDlb != null){ | |
| 2750 | + for (int i = 0; i < listDlb.size(); i++) { | |
| 2751 | + Dlb d = listDlb.get(i); | |
| 2752 | + if (d.getLp() == null) { | |
| 2753 | + ccyl_ = Arith.add(ccyl_, d.getCzcd()); | |
| 2754 | + jcyl_ = Arith.add(jcyl_, d.getJzcd()); | |
| 2755 | + yh_ = Arith.add(yh_, d.getHd()); | |
| 2756 | + jzl_ = Arith.add(jzl, d.getCdl()); | |
| 2757 | + } else { | |
| 2758 | + if (d.getLp().equals(s.getLpName())) { | |
| 2759 | + ccyl_ = Arith.add(ccyl_, d.getCzcd()); | |
| 2760 | + jcyl_ = Arith.add(jcyl_, d.getJzcd()); | |
| 2761 | + yh_ = Arith.add(yh_, d.getHd()); | |
| 2762 | + jzl_ = Arith.add(jzl_, d.getCdl()); | |
| 2763 | + } | |
| 2764 | + } | |
| 2765 | + } | |
| 2766 | + } | |
| 2767 | + } else { | |
| 2768 | +// List<Ylb> listYlb = ylbRepository.queryListYlb(fcrq, s.getClZbh(), s.getjGh(), xlbm); | |
| 2769 | + type = 0; | |
| 2770 | + if(listYlb != null){ | |
| 2771 | + for (int i = 0; i < listYlb.size(); i++) { | |
| 2772 | + Ylb y = listYlb.get(i); | |
| 2773 | + if (y.getLp() == null) { | |
| 2774 | + ccyl = Arith.add(ccyl, y.getCzyl()); | |
| 2775 | + jcyl = Arith.add(jcyl, y.getJzyl()); | |
| 2776 | + yh = Arith.add(yh, y.getYh()); | |
| 2777 | + jzl = Arith.add(jzl, y.getJzl()); | |
| 2778 | + zlc = Arith.add(zlc, y.getZlc()); | |
| 2779 | + if(dMap.get(y.getRylx())!=null) | |
| 2780 | + rylx =dMap.get(y.getRylx()).toString(); | |
| 2781 | + } else { | |
| 2782 | + if (y.getLp().equals(s.getLpName())) { | |
| 2783 | + ccyl = Arith.add(ccyl, y.getCzyl()); | |
| 2784 | + jcyl = Arith.add(jcyl, y.getJzyl()); | |
| 2785 | + yh = Arith.add(yh, y.getYh()); | |
| 2786 | + jzl = Arith.add(jzl, y.getJzl()); | |
| 2787 | + zlc = Arith.add(zlc, y.getZlc()); | |
| 2788 | + if(dMap.get(y.getRylx())!=null) | |
| 2789 | + rylx =dMap.get(y.getRylx()).toString(); | |
| 2790 | + } | |
| 2791 | + } | |
| 2792 | + } | |
| 2793 | + } | |
| 2794 | + } | |
| 2795 | + } | |
| 2744 | 2796 | } |
| 2745 | 2797 | double jylc=ylbMapJylc.get(line+"-"+jGh+"-"+nbbm+"-"+lpName)==null?0.0:ylbMapJylc.get(line+"-"+jGh+"-"+nbbm+"-"+lpName); |
| 2746 | 2798 | Map.put("jylc", jylc); |
| ... | ... | @@ -2749,6 +2801,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 2749 | 2801 | Map.put("yh", yh); |
| 2750 | 2802 | Map.put("ccyl", ccyl); |
| 2751 | 2803 | Map.put("jcyl", jcyl); |
| 2804 | + Map.put("jzl_", jzl_); | |
| 2805 | + Map.put("yh_", yh_); | |
| 2806 | + Map.put("ccyl_", ccyl_); | |
| 2807 | + Map.put("jcyl_", jcyl_); | |
| 2752 | 2808 | Map.put("type", type); |
| 2753 | 2809 | Map.put("zlc", zlc); |
| 2754 | 2810 | Map.put("xlName", s.getXlName()); |
| ... | ... | @@ -2964,8 +3020,10 @@ public class BusIntervalServiceImpl implements BusIntervalService { |
| 2964 | 3020 | String xls=""; |
| 2965 | 3021 | if(Map.get("type").toString().equals("0")){ |
| 2966 | 3022 | xls="waybill_minhang.xls"; |
| 2967 | - }else{ | |
| 3023 | + } else if(Map.get("type").toString().equals("1")){ | |
| 2968 | 3024 | xls="waybill_minhang_dl.xls"; |
| 3025 | + } else { | |
| 3026 | + xls="waybill_minhang_yd.xls"; | |
| 2969 | 3027 | } |
| 2970 | 3028 | Map.put("sheetName", jName + "-" + clZbh + "-" + lpName); |
| 2971 | 3029 | ee.excelReplace(list1, new Object[]{Map}, path1 + "mould/"+xls, | ... | ... |
src/main/java/com/bsth/service/jdtest/impl/JdtestServiceImpl.java
| ... | ... | @@ -14,13 +14,13 @@ import org.springframework.jdbc.core.JdbcTemplate; |
| 14 | 14 | import org.springframework.jdbc.core.RowMapper; |
| 15 | 15 | import org.springframework.stereotype.Service; |
| 16 | 16 | |
| 17 | -import com.bsth.entity.mcy_forms.Daily; | |
| 18 | 17 | import com.bsth.entity.oil.Dlb; |
| 19 | 18 | import com.bsth.entity.oil.Ylb; |
| 20 | 19 | import com.bsth.entity.oil.Ylxxb; |
| 21 | 20 | import com.bsth.entity.realcontrol.ChildTaskPlan; |
| 22 | 21 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 23 | 22 | import com.bsth.entity.sys.Dictionary; |
| 23 | +import com.bsth.repository.oil.DlbRepository; | |
| 24 | 24 | import com.bsth.repository.oil.YlbRepository; |
| 25 | 25 | import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; |
| 26 | 26 | import com.bsth.service.jdtest.JdtestService; |
| ... | ... | @@ -40,6 +40,8 @@ public class JdtestServiceImpl implements JdtestService { |
| 40 | 40 | @Autowired |
| 41 | 41 | YlbRepository ylbRepository; |
| 42 | 42 | @Autowired |
| 43 | + DlbRepository dlbRepository; | |
| 44 | + @Autowired | |
| 43 | 45 | DictionaryService dictionaryService; |
| 44 | 46 | @Override |
| 45 | 47 | public List<Ylxxb> cwjyList(Map<String, Object> map) { |
| ... | ... | @@ -159,13 +161,26 @@ public class JdtestServiceImpl implements JdtestService { |
| 159 | 161 | }else{ |
| 160 | 162 | listYlb=ylbRepository.obtainYlEq(map.get("date").toString(), "", "", xlbm, "", "xlbm"); |
| 161 | 163 | } |
| 162 | - Map<String, Ylb> mapYlb=new HashMap<>(); | |
| 164 | + Map<String, Ylb> mapYlb=new HashMap<String, Ylb>(); | |
| 163 | 165 | for (int j = 0; j < listYlb.size(); j++) { |
| 164 | 166 | Ylb y=listYlb.get(j); |
| 165 | 167 | if(mapYlb.get(y.getXlbm()+y.getJsy()+y.getNbbm()+y.getLp())==null){ |
| 166 | 168 | mapYlb.put(y.getXlbm()+y.getJsy()+y.getNbbm()+y.getLp(), y); |
| 167 | 169 | } |
| 168 | 170 | } |
| 171 | + List<Dlb> listDlb=new ArrayList<Dlb>(); | |
| 172 | + if(xlbm.equals("")){ | |
| 173 | + listDlb=dlbRepository.obtainDl(map.get("date").toString(), gsbm, fgsbm, xlbm, "", "xlbm"); | |
| 174 | + }else{ | |
| 175 | + listDlb=dlbRepository.obtainDlEq(map.get("date").toString(), "", "", xlbm, "", "xlbm"); | |
| 176 | + } | |
| 177 | + Map<String, Dlb> mapDlb=new HashMap<String, Dlb>(); | |
| 178 | + for (int i = 0; i < listDlb.size(); i++) { | |
| 179 | + Dlb d = listDlb.get(i); | |
| 180 | + if(mapDlb.get(d.getXlbm()+d.getJsy()+d.getNbbm()+d.getLp()) == null){ | |
| 181 | + mapDlb.put(d.getXlbm()+d.getJsy()+d.getNbbm()+d.getLp(), d); | |
| 182 | + } | |
| 183 | + } | |
| 169 | 184 | |
| 170 | 185 | List<ScheduleRealInfo> sList; |
| 171 | 186 | List<ScheduleRealInfo> jList; |
| ... | ... | @@ -180,6 +195,7 @@ public class JdtestServiceImpl implements JdtestService { |
| 180 | 195 | double czyl_z=0.0; |
| 181 | 196 | double jzl_z=0.0; |
| 182 | 197 | double yh_z=0.0; |
| 198 | + double dh_z=0.0; | |
| 183 | 199 | int jhbc_z=0; |
| 184 | 200 | double jhlc_z=0.0; |
| 185 | 201 | int sjbc_z=0; |
| ... | ... | @@ -193,6 +209,7 @@ public class JdtestServiceImpl implements JdtestService { |
| 193 | 209 | double czyl_line=0.0; |
| 194 | 210 | double jzl_line=0.0; |
| 195 | 211 | double yh_line=0.0; |
| 212 | + double dh_line=0.0; | |
| 196 | 213 | int jhbc_line=0; |
| 197 | 214 | double jhlc_line=0.0; |
| 198 | 215 | int sjbc_line=0; |
| ... | ... | @@ -209,6 +226,7 @@ public class JdtestServiceImpl implements JdtestService { |
| 209 | 226 | double czyl=0.0; |
| 210 | 227 | double jzl=0.0; |
| 211 | 228 | double yh=0.0; |
| 229 | + double dh=0.0; //电耗 | |
| 212 | 230 | String rylx=""; |
| 213 | 231 | if(mapYlb.get(m.get("xlBm").toString()+m.get("jGh").toString()+m.get("clZbh").toString()+m.get("lp").toString())!=null){ |
| 214 | 232 | Ylb t=mapYlb.get(m.get("xlBm").toString()+m.get("jGh").toString()+m.get("clZbh").toString()+m.get("lp").toString()); |
| ... | ... | @@ -225,6 +243,10 @@ public class JdtestServiceImpl implements JdtestService { |
| 225 | 243 | } |
| 226 | 244 | } |
| 227 | 245 | } |
| 246 | + if(mapDlb.get(m.get("xlBm").toString()+m.get("jGh").toString()+m.get("clZbh").toString()+m.get("lp").toString())!=null){ | |
| 247 | + Dlb d=mapDlb.get(m.get("xlBm").toString()+m.get("jGh").toString()+m.get("clZbh").toString()+m.get("lp").toString()); | |
| 248 | + dh = d.getHd(); | |
| 249 | + } | |
| 228 | 250 | m.put("jylc",jylc); |
| 229 | 251 | jylc_z=Arith.add(jylc, jylc_z); |
| 230 | 252 | m.put("jzyl",jzyl); |
| ... | ... | @@ -236,7 +258,8 @@ public class JdtestServiceImpl implements JdtestService { |
| 236 | 258 | m.put("yh", yh); |
| 237 | 259 | yh_z=Arith.add(yh, yh_z); |
| 238 | 260 | m.put("rylx", rylx); |
| 239 | - m.put("dh", ""); | |
| 261 | + m.put("dh", dh); | |
| 262 | + dh_z=Arith.add(dh, dh_z); | |
| 240 | 263 | for (int j = 0; j < lists.size(); j++) { |
| 241 | 264 | ScheduleRealInfo s=lists.get(j); |
| 242 | 265 | if(m.get("xlBm").toString().equals(s.getXlBm()) && |
| ... | ... | @@ -263,6 +286,7 @@ public class JdtestServiceImpl implements JdtestService { |
| 263 | 286 | double jhlc=culateMileageService.culateJhgl(jList); |
| 264 | 287 | jhlc_z=Arith.add(jhlc, jhlc_z); |
| 265 | 288 | int sjbc=culateMileageService.culateSjbc(sList, "")+culateMileageService.culateLjbc(sList, ""); |
| 289 | + sjbc_z=sjbc+sjbc_z; | |
| 266 | 290 | double ljgl=culateMileageService.culateLjgl(sList); |
| 267 | 291 | double sjgl=culateMileageService.culateSjgl(sList); |
| 268 | 292 | double sjzlc=Arith.add(ljgl, sjgl); |
| ... | ... | @@ -284,127 +308,154 @@ public class JdtestServiceImpl implements JdtestService { |
| 284 | 308 | m.put("zlc2", zlc2); |
| 285 | 309 | listAll.add(m); |
| 286 | 310 | //线路小计 |
| 287 | - if (i < list.size() - 1) { | |
| 288 | - if ((list.get(i+1).get("xlBm").toString()).equals(list.get(i).get("xlBm").toString())) { | |
| 289 | - jylc_line=Arith.add(jylc_line, jylc); | |
| 290 | - jzyl_line=Arith.add(jzyl_line, jzyl); | |
| 291 | - czyl_line=Arith.add(czyl_line, czyl); | |
| 292 | - jzl_line=Arith.add(jzl_line, jzl); | |
| 293 | - yh_line=Arith.add(yh_line, yh); | |
| 294 | - jhbc_line=jhbc_line+jhbc; | |
| 295 | - jhlc_line=Arith.add(jhlc_line,jhlc); | |
| 296 | - sjbc_line=sjbc_line+sjbc; | |
| 297 | - sjzlc_line=Arith.add(sjzlc_line, sjzlc); | |
| 298 | - kszlc_line=Arith.add(kszlc_line,kszlc); | |
| 299 | - zlc_line=Arith.add(zlc_line, zlc); | |
| 300 | - zlc_line2=Arith.add(zlc_line2, zlc2); | |
| 301 | - } else { | |
| 302 | - jylc_line=Arith.add(jylc_line, jylc); | |
| 303 | - jzyl_line=Arith.add(jzyl_line, jzyl); | |
| 304 | - czyl_line=Arith.add(czyl_line, czyl); | |
| 305 | - jzl_line=Arith.add(jzl_line, jzl); | |
| 306 | - yh_line=Arith.add(yh_line, yh); | |
| 307 | - jhbc_line=jhbc_line+jhbc; | |
| 308 | - jhlc_line=Arith.add(jhlc_line,jhlc); | |
| 309 | - sjbc_line=sjbc_line+sjbc; | |
| 310 | - sjzlc_line=Arith.add(sjzlc_line, sjzlc); | |
| 311 | - kszlc_line=Arith.add(kszlc_line,kszlc); | |
| 312 | - zlc_line=Arith.add(zlc_line, zlc); | |
| 313 | - zlc_line2=Arith.add(zlc_line2, zlc2); | |
| 314 | - | |
| 315 | - Map<String, Object> mmm=new HashMap<>(); | |
| 316 | - mmm.put("xlName", "小计"); | |
| 317 | - mmm.put("lp", ""); | |
| 318 | - mmm.put("jGh", ""); | |
| 319 | - mmm.put("clZbh", ""); | |
| 320 | - mmm.put("jName", ""); | |
| 321 | - mmm.put("jhbc", jhbc_line); | |
| 322 | - mmm.put("jhlc", jhlc_line); | |
| 323 | - mmm.put("sjbc", sjbc_line); | |
| 324 | - mmm.put("sjzlc", sjzlc_line); | |
| 325 | - mmm.put("kszlc",kszlc_line); | |
| 326 | - mmm.put("jylc", jylc_line); | |
| 327 | - mmm.put("zlc", zlc_line); | |
| 328 | - mmm.put("zlc2", zlc_line2); | |
| 329 | - mmm.put("jzyl",jzyl_line); | |
| 330 | - mmm.put("czyl",czyl_line); | |
| 331 | - mmm.put("jzl", jzl_line); | |
| 332 | - mmm.put("yh", yh_line); | |
| 333 | - mmm.put("rylx", ""); | |
| 334 | - mmm.put("dh",""); | |
| 335 | - listAll.add(mmm); | |
| 336 | - jylc_line=0.0; | |
| 337 | - jzyl_line=0.0; | |
| 338 | - czyl_line=0.0; | |
| 339 | - jzl_line=0.0; | |
| 340 | - yh_line=0.0; | |
| 341 | - jhbc_line=0; | |
| 342 | - jhlc_line=0.0; | |
| 343 | - sjbc_line=0; | |
| 344 | - sjzlc_line=0.0; | |
| 345 | - kszlc_line=0.0; | |
| 346 | - zlc_line=0.0; | |
| 347 | - zlc_line2=0.0; | |
| 348 | - } | |
| 349 | - } else { | |
| 350 | - if ((list.get(i).get("xlBm").toString()).equals(list.get(i - 1).get("xlBm").toString())) { | |
| 351 | - jylc_line=Arith.add(jylc_line, jylc); | |
| 352 | - jzyl_line=Arith.add(jzyl_line, jzyl); | |
| 353 | - czyl_line=Arith.add(czyl_line, czyl); | |
| 354 | - jzl_line=Arith.add(jzl_line, jzl); | |
| 355 | - yh_line=Arith.add(yh_line, yh); | |
| 356 | - jhbc_line=jhbc_line+jhbc; | |
| 357 | - jhlc_line=Arith.add(jhlc_line,jhlc); | |
| 358 | - sjbc_line=sjbc_line+sjbc; | |
| 359 | - sjzlc_line=Arith.add(sjzlc_line, sjzlc); | |
| 360 | - kszlc_line=Arith.add(kszlc_line,kszlc); | |
| 361 | - zlc_line=Arith.add(zlc_line, zlc); | |
| 362 | - zlc_line2=Arith.add(zlc_line2, zlc2); | |
| 363 | - Map<String, Object> mmm=new HashMap<>(); | |
| 364 | - mmm.put("xlName", "小计"); | |
| 365 | - mmm.put("lp", ""); | |
| 366 | - mmm.put("jGh", ""); | |
| 367 | - mmm.put("clZbh", ""); | |
| 368 | - mmm.put("jName", ""); | |
| 369 | - mmm.put("jhbc", jhbc_line); | |
| 370 | - mmm.put("jhlc", jhlc_line); | |
| 371 | - mmm.put("sjbc", sjbc_line); | |
| 372 | - mmm.put("sjzlc", sjzlc_line); | |
| 373 | - mmm.put("kszlc",kszlc_line); | |
| 374 | - mmm.put("jylc", jylc_line); | |
| 375 | - mmm.put("zlc", zlc_line); | |
| 376 | - mmm.put("zlc2", zlc_line2); | |
| 377 | - mmm.put("jzyl",jzyl_line); | |
| 378 | - mmm.put("czyl",czyl_line); | |
| 379 | - mmm.put("jzl", jzl_line); | |
| 380 | - mmm.put("yh", yh_line); | |
| 381 | - mmm.put("rylx", ""); | |
| 382 | - mmm.put("dh",""); | |
| 383 | - listAll.add(mmm); | |
| 384 | - } else { | |
| 385 | - | |
| 386 | - Map<String, Object> mmm=new HashMap<>(); | |
| 387 | - mmm.put("xlName", "小计"); | |
| 388 | - mmm.put("lp", ""); | |
| 389 | - mmm.put("jGh", ""); | |
| 390 | - mmm.put("clZbh", ""); | |
| 391 | - mmm.put("jName", ""); | |
| 392 | - mmm.put("jhbc", jhbc); | |
| 393 | - mmm.put("jhlc", jhlc); | |
| 394 | - mmm.put("sjbc", sjbc); | |
| 395 | - mmm.put("sjzlc", sjzlc); | |
| 396 | - mmm.put("kszlc",kszlc); | |
| 397 | - mmm.put("jylc", jylc_line); | |
| 398 | - mmm.put("zlc", zlc); | |
| 399 | - mmm.put("zlc2", zlc2); | |
| 400 | - mmm.put("jzyl",jzyl); | |
| 401 | - mmm.put("czyl",czyl); | |
| 402 | - mmm.put("jzl", jzl); | |
| 403 | - mmm.put("yh", yh); | |
| 404 | - mmm.put("rylx", ""); | |
| 405 | - mmm.put("dh",""); | |
| 406 | - listAll.add(mmm); | |
| 407 | - } | |
| 311 | + if(list.size()==1){ | |
| 312 | + Map<String, Object> mmm=new HashMap<>(); | |
| 313 | + mmm.put("xlName", "小计"); | |
| 314 | + mmm.put("lp", ""); | |
| 315 | + mmm.put("jGh", ""); | |
| 316 | + mmm.put("clZbh", ""); | |
| 317 | + mmm.put("jName", ""); | |
| 318 | + mmm.put("jhbc", jhbc); | |
| 319 | + mmm.put("jhlc", jhlc); | |
| 320 | + mmm.put("sjbc", sjbc); | |
| 321 | + mmm.put("sjzlc", sjzlc); | |
| 322 | + mmm.put("kszlc",kszlc); | |
| 323 | + mmm.put("jylc", jylc_line); | |
| 324 | + mmm.put("zlc", zlc); | |
| 325 | + mmm.put("zlc2", zlc2); | |
| 326 | + mmm.put("jzyl",jzyl); | |
| 327 | + mmm.put("czyl",czyl); | |
| 328 | + mmm.put("jzl", jzl); | |
| 329 | + mmm.put("yh", yh); | |
| 330 | + mmm.put("rylx", ""); | |
| 331 | + mmm.put("dh", dh); | |
| 332 | + listAll.add(mmm); | |
| 333 | + }else{ | |
| 334 | + if (i < list.size() - 1) { | |
| 335 | + if ((list.get(i+1).get("xlBm").toString()).equals(list.get(i).get("xlBm").toString())) { | |
| 336 | + jylc_line=Arith.add(jylc_line, jylc); | |
| 337 | + jzyl_line=Arith.add(jzyl_line, jzyl); | |
| 338 | + czyl_line=Arith.add(czyl_line, czyl); | |
| 339 | + jzl_line=Arith.add(jzl_line, jzl); | |
| 340 | + yh_line=Arith.add(yh_line, yh); | |
| 341 | + dh_line=Arith.add(dh_line, dh); | |
| 342 | + jhbc_line=jhbc_line+jhbc; | |
| 343 | + jhlc_line=Arith.add(jhlc_line,jhlc); | |
| 344 | + sjbc_line=sjbc_line+sjbc; | |
| 345 | + sjzlc_line=Arith.add(sjzlc_line, sjzlc); | |
| 346 | + kszlc_line=Arith.add(kszlc_line,kszlc); | |
| 347 | + zlc_line=Arith.add(zlc_line, zlc); | |
| 348 | + zlc_line2=Arith.add(zlc_line2, zlc2); | |
| 349 | + } else { | |
| 350 | + jylc_line=Arith.add(jylc_line, jylc); | |
| 351 | + jzyl_line=Arith.add(jzyl_line, jzyl); | |
| 352 | + czyl_line=Arith.add(czyl_line, czyl); | |
| 353 | + jzl_line=Arith.add(jzl_line, jzl); | |
| 354 | + yh_line=Arith.add(yh_line, yh); | |
| 355 | + dh_line=Arith.add(dh_line, dh); | |
| 356 | + jhbc_line=jhbc_line+jhbc; | |
| 357 | + jhlc_line=Arith.add(jhlc_line,jhlc); | |
| 358 | + sjbc_line=sjbc_line+sjbc; | |
| 359 | + sjzlc_line=Arith.add(sjzlc_line, sjzlc); | |
| 360 | + kszlc_line=Arith.add(kszlc_line,kszlc); | |
| 361 | + zlc_line=Arith.add(zlc_line, zlc); | |
| 362 | + zlc_line2=Arith.add(zlc_line2, zlc2); | |
| 363 | + | |
| 364 | + Map<String, Object> mmm=new HashMap<>(); | |
| 365 | + mmm.put("xlName", "小计"); | |
| 366 | + mmm.put("lp", ""); | |
| 367 | + mmm.put("jGh", ""); | |
| 368 | + mmm.put("clZbh", ""); | |
| 369 | + mmm.put("jName", ""); | |
| 370 | + mmm.put("jhbc", jhbc_line); | |
| 371 | + mmm.put("jhlc", jhlc_line); | |
| 372 | + mmm.put("sjbc", sjbc_line); | |
| 373 | + mmm.put("sjzlc", sjzlc_line); | |
| 374 | + mmm.put("kszlc",kszlc_line); | |
| 375 | + mmm.put("jylc", jylc_line); | |
| 376 | + mmm.put("zlc", zlc_line); | |
| 377 | + mmm.put("zlc2", zlc_line2); | |
| 378 | + mmm.put("jzyl",jzyl_line); | |
| 379 | + mmm.put("czyl",czyl_line); | |
| 380 | + mmm.put("jzl", jzl_line); | |
| 381 | + mmm.put("yh", yh_line); | |
| 382 | + mmm.put("rylx", ""); | |
| 383 | + mmm.put("dh", dh_line); | |
| 384 | + listAll.add(mmm); | |
| 385 | + jylc_line=0.0; | |
| 386 | + jzyl_line=0.0; | |
| 387 | + czyl_line=0.0; | |
| 388 | + jzl_line=0.0; | |
| 389 | + yh_line=0.0; | |
| 390 | + dh_line=0.0; | |
| 391 | + jhbc_line=0; | |
| 392 | + jhlc_line=0.0; | |
| 393 | + sjbc_line=0; | |
| 394 | + sjzlc_line=0.0; | |
| 395 | + kszlc_line=0.0; | |
| 396 | + zlc_line=0.0; | |
| 397 | + zlc_line2=0.0; | |
| 398 | + } | |
| 399 | + } else { | |
| 400 | + if ((list.get(i).get("xlBm").toString()).equals(list.get(i - 1).get("xlBm").toString())) { | |
| 401 | + jylc_line=Arith.add(jylc_line, jylc); | |
| 402 | + jzyl_line=Arith.add(jzyl_line, jzyl); | |
| 403 | + czyl_line=Arith.add(czyl_line, czyl); | |
| 404 | + jzl_line=Arith.add(jzl_line, jzl); | |
| 405 | + yh_line=Arith.add(yh_line, yh); | |
| 406 | + dh_line=Arith.add(dh_line, dh); | |
| 407 | + jhbc_line=jhbc_line+jhbc; | |
| 408 | + jhlc_line=Arith.add(jhlc_line,jhlc); | |
| 409 | + sjbc_line=sjbc_line+sjbc; | |
| 410 | + sjzlc_line=Arith.add(sjzlc_line, sjzlc); | |
| 411 | + kszlc_line=Arith.add(kszlc_line,kszlc); | |
| 412 | + zlc_line=Arith.add(zlc_line, zlc); | |
| 413 | + zlc_line2=Arith.add(zlc_line2, zlc2); | |
| 414 | + Map<String, Object> mmm=new HashMap<>(); | |
| 415 | + mmm.put("xlName", "小计"); | |
| 416 | + mmm.put("lp", ""); | |
| 417 | + mmm.put("jGh", ""); | |
| 418 | + mmm.put("clZbh", ""); | |
| 419 | + mmm.put("jName", ""); | |
| 420 | + mmm.put("jhbc", jhbc_line); | |
| 421 | + mmm.put("jhlc", jhlc_line); | |
| 422 | + mmm.put("sjbc", sjbc_line); | |
| 423 | + mmm.put("sjzlc", sjzlc_line); | |
| 424 | + mmm.put("kszlc",kszlc_line); | |
| 425 | + mmm.put("jylc", jylc_line); | |
| 426 | + mmm.put("zlc", zlc_line); | |
| 427 | + mmm.put("zlc2", zlc_line2); | |
| 428 | + mmm.put("jzyl",jzyl_line); | |
| 429 | + mmm.put("czyl",czyl_line); | |
| 430 | + mmm.put("jzl", jzl_line); | |
| 431 | + mmm.put("yh", yh_line); | |
| 432 | + mmm.put("rylx", ""); | |
| 433 | + mmm.put("dh", dh_line); | |
| 434 | + listAll.add(mmm); | |
| 435 | + } else { | |
| 436 | + Map<String, Object> mmm=new HashMap<>(); | |
| 437 | + mmm.put("xlName", "小计"); | |
| 438 | + mmm.put("lp", ""); | |
| 439 | + mmm.put("jGh", ""); | |
| 440 | + mmm.put("clZbh", ""); | |
| 441 | + mmm.put("jName", ""); | |
| 442 | + mmm.put("jhbc", jhbc); | |
| 443 | + mmm.put("jhlc", jhlc); | |
| 444 | + mmm.put("sjbc", sjbc); | |
| 445 | + mmm.put("sjzlc", sjzlc); | |
| 446 | + mmm.put("kszlc",kszlc); | |
| 447 | + mmm.put("jylc", jylc_line); | |
| 448 | + mmm.put("zlc", zlc); | |
| 449 | + mmm.put("zlc2", zlc2); | |
| 450 | + mmm.put("jzyl",jzyl); | |
| 451 | + mmm.put("czyl",czyl); | |
| 452 | + mmm.put("jzl", jzl); | |
| 453 | + mmm.put("yh", yh); | |
| 454 | + mmm.put("rylx", ""); | |
| 455 | + mmm.put("dh", dh); | |
| 456 | + listAll.add(mmm); | |
| 457 | + } | |
| 458 | + } | |
| 408 | 459 | } |
| 409 | 460 | } |
| 410 | 461 | Map<String, Object> mmp=new HashMap<>(); |
| ... | ... | @@ -426,7 +477,7 @@ public class JdtestServiceImpl implements JdtestService { |
| 426 | 477 | mmp.put("jzl", jzl_z); |
| 427 | 478 | mmp.put("yh", yh_z); |
| 428 | 479 | mmp.put("rylx", ""); |
| 429 | - mmp.put("dh",""); | |
| 480 | + mmp.put("dh", dh_z); | |
| 430 | 481 | listAll.add(mmp); |
| 431 | 482 | return listAll; |
| 432 | 483 | } | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -1162,8 +1162,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 1162 | 1162 | String xls = ""; |
| 1163 | 1163 | if (map.get("type").toString().equals("0")) { |
| 1164 | 1164 | xls = "waybill_minhang.xls"; |
| 1165 | + } else if (map.get("type").toString().equals("1")){ | |
| 1166 | + xls = "waybill_minhang_dl.xls"; | |
| 1165 | 1167 | } else { |
| 1166 | - xls = "waybill_minhang_dl.xls"; | |
| 1168 | + xls = "waybill_minhang_yd.xls"; | |
| 1167 | 1169 | } |
| 1168 | 1170 | |
| 1169 | 1171 | |
| ... | ... | @@ -4610,10 +4612,14 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 4610 | 4612 | Double jzl = 0.0; |
| 4611 | 4613 | Double zlc = 0.0; |
| 4612 | 4614 | String rylx=""; |
| 4615 | + Double ccyl_ = 0.0; | |
| 4616 | + Double jcyl_ = 0.0; | |
| 4617 | + Double yh_ = 0.0; | |
| 4618 | + Double jzl_ = 0.0; | |
| 4613 | 4619 | List<Cars> listCars = carsRepository.findCarsByCode(s.getClZbh()); |
| 4614 | 4620 | if (listCars.size() > 0) { |
| 4615 | - if (listCars.get(0).getSfdc() != null) { | |
| 4616 | - if (listCars.get(0).getSfdc()) { | |
| 4621 | + if (listCars.get(0).getNyType() != null) { | |
| 4622 | + if ("1".equals(listCars.get(0).getNyType().toString())) { //全电 | |
| 4617 | 4623 | List<Dlb> listDlb = dlbRepository.queryListDlb(fcrq, s.getClZbh(), s.getjGh(), xlbm); |
| 4618 | 4624 | type = 1; |
| 4619 | 4625 | for (int i = 0; i < listDlb.size(); i++) { |
| ... | ... | @@ -4633,7 +4639,48 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 4633 | 4639 | zlc = Arith.add(zlc, d.getZlc()); |
| 4634 | 4640 | } |
| 4635 | 4641 | } |
| 4636 | - | |
| 4642 | + } | |
| 4643 | + } else if("2".equals(listCars.get(0).getNyType().toString())){ //油点混合 | |
| 4644 | + List<Ylb> listYlb = ylbRepository.queryListYlb(fcrq, s.getClZbh(), s.getjGh(), xlbm); | |
| 4645 | + List<Dlb> listDlb = dlbRepository.queryListDlb(fcrq, s.getClZbh(), s.getjGh(), xlbm); | |
| 4646 | + type = 2; | |
| 4647 | + for (int i = 0; i < listYlb.size(); i++) { | |
| 4648 | + Ylb y = listYlb.get(i); | |
| 4649 | + if (y.getLp() == null) { | |
| 4650 | + ccyl = Arith.add(ccyl, y.getCzyl()); | |
| 4651 | + jcyl = Arith.add(jcyl, y.getJzyl()); | |
| 4652 | + yh = Arith.add(yh, y.getYh()); | |
| 4653 | + jzl = Arith.add(jzl, y.getJzl()); | |
| 4654 | + zlc = Arith.add(zlc, y.getZlc()); | |
| 4655 | + if(dMap.get(y.getRylx())!=null) | |
| 4656 | + rylx =dMap.get(y.getRylx()).toString(); | |
| 4657 | + } else { | |
| 4658 | + if (y.getLp().equals(s.getLpName())) { | |
| 4659 | + ccyl = Arith.add(ccyl, y.getCzyl()); | |
| 4660 | + jcyl = Arith.add(jcyl, y.getJzyl()); | |
| 4661 | + yh = Arith.add(yh, y.getYh()); | |
| 4662 | + jzl = Arith.add(jzl, y.getJzl()); | |
| 4663 | + zlc = Arith.add(zlc, y.getZlc()); | |
| 4664 | + if(dMap.get(y.getRylx())!=null) | |
| 4665 | + rylx =dMap.get(y.getRylx()).toString(); | |
| 4666 | + } | |
| 4667 | + } | |
| 4668 | + } | |
| 4669 | + for (int i = 0; i < listDlb.size(); i++) { | |
| 4670 | + Dlb d = listDlb.get(i); | |
| 4671 | + if (d.getLp() == null) { | |
| 4672 | + ccyl_ = Arith.add(ccyl_, d.getCzcd()); | |
| 4673 | + jcyl_ = Arith.add(jcyl_, d.getJzcd()); | |
| 4674 | + yh_ = Arith.add(yh_, d.getHd()); | |
| 4675 | + jzl_ = Arith.add(jzl, d.getCdl()); | |
| 4676 | + } else { | |
| 4677 | + if (d.getLp().equals(s.getLpName())) { | |
| 4678 | + ccyl_ = Arith.add(ccyl_, d.getCzcd()); | |
| 4679 | + jcyl_ = Arith.add(jcyl_, d.getJzcd()); | |
| 4680 | + yh_ = Arith.add(yh_, d.getHd()); | |
| 4681 | + jzl_ = Arith.add(jzl_, d.getCdl()); | |
| 4682 | + } | |
| 4683 | + } | |
| 4637 | 4684 | } |
| 4638 | 4685 | } else { |
| 4639 | 4686 | List<Ylb> listYlb = ylbRepository.queryListYlb(fcrq, s.getClZbh(), s.getjGh(), xlbm); |
| ... | ... | @@ -4661,6 +4708,49 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 4661 | 4708 | } |
| 4662 | 4709 | } |
| 4663 | 4710 | } |
| 4711 | + } else { | |
| 4712 | + //油点混合 | |
| 4713 | + List<Ylb> listYlb = ylbRepository.queryListYlb(fcrq, s.getClZbh(), s.getjGh(), xlbm); | |
| 4714 | + List<Dlb> listDlb = dlbRepository.queryListDlb(fcrq, s.getClZbh(), s.getjGh(), xlbm); | |
| 4715 | + type = 2; | |
| 4716 | + for (int i = 0; i < listYlb.size(); i++) { | |
| 4717 | + Ylb y = listYlb.get(i); | |
| 4718 | + if (y.getLp() == null) { | |
| 4719 | + ccyl = Arith.add(ccyl, y.getCzyl()); | |
| 4720 | + jcyl = Arith.add(jcyl, y.getJzyl()); | |
| 4721 | + yh = Arith.add(yh, y.getYh()); | |
| 4722 | + jzl = Arith.add(jzl, y.getJzl()); | |
| 4723 | + zlc = Arith.add(zlc, y.getZlc()); | |
| 4724 | + if(dMap.get(y.getRylx())!=null) | |
| 4725 | + rylx =dMap.get(y.getRylx()).toString(); | |
| 4726 | + } else { | |
| 4727 | + if (y.getLp().equals(s.getLpName())) { | |
| 4728 | + ccyl = Arith.add(ccyl, y.getCzyl()); | |
| 4729 | + jcyl = Arith.add(jcyl, y.getJzyl()); | |
| 4730 | + yh = Arith.add(yh, y.getYh()); | |
| 4731 | + jzl = Arith.add(jzl, y.getJzl()); | |
| 4732 | + zlc = Arith.add(zlc, y.getZlc()); | |
| 4733 | + if(dMap.get(y.getRylx())!=null) | |
| 4734 | + rylx =dMap.get(y.getRylx()).toString(); | |
| 4735 | + } | |
| 4736 | + } | |
| 4737 | + } | |
| 4738 | + for (int i = 0; i < listDlb.size(); i++) { | |
| 4739 | + Dlb d = listDlb.get(i); | |
| 4740 | + if (d.getLp() == null) { | |
| 4741 | + ccyl_ = Arith.add(ccyl_, d.getCzcd()); | |
| 4742 | + jcyl_ = Arith.add(jcyl_, d.getJzcd()); | |
| 4743 | + yh_ = Arith.add(yh_, d.getHd()); | |
| 4744 | + jzl_ = Arith.add(jzl, d.getCdl()); | |
| 4745 | + } else { | |
| 4746 | + if (d.getLp().equals(s.getLpName())) { | |
| 4747 | + ccyl_ = Arith.add(ccyl_, d.getCzcd()); | |
| 4748 | + jcyl_ = Arith.add(jcyl_, d.getJzcd()); | |
| 4749 | + yh_ = Arith.add(yh_, d.getHd()); | |
| 4750 | + jzl_ = Arith.add(jzl_, d.getCdl()); | |
| 4751 | + } | |
| 4752 | + } | |
| 4753 | + } | |
| 4664 | 4754 | } |
| 4665 | 4755 | } |
| 4666 | 4756 | |
| ... | ... | @@ -4669,6 +4759,10 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 4669 | 4759 | map.put("yh", yh); |
| 4670 | 4760 | map.put("ccyl", ccyl); |
| 4671 | 4761 | map.put("jcyl", jcyl); |
| 4762 | + map.put("jzl_", jzl_); | |
| 4763 | + map.put("yh_", yh_); | |
| 4764 | + map.put("ccyl_", ccyl_); | |
| 4765 | + map.put("jcyl_", jcyl_); | |
| 4672 | 4766 | map.put("type", type); |
| 4673 | 4767 | map.put("zlc", zlc); |
| 4674 | 4768 | map.put("xlName", s.getXlName()); |
| ... | ... | @@ -5203,20 +5297,22 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 5203 | 5297 | fcsjm = String.valueOf(fcsjActural_ - fcsj_); |
| 5204 | 5298 | } |
| 5205 | 5299 | } |
| 5206 | - String[] dfsj_s =schedule.getDfsj().split(":"); | |
| 5207 | - Long dfsj_ = Long.parseLong(dfsj_s[0]) * 60 + Long.parseLong(dfsj_s[1]); | |
| 5208 | - if ((dfsj_ - fcsjActural_) > 0) { | |
| 5209 | - if(dfsj_ - fcsjActural_>1200){ | |
| 5210 | - dfsjm=String.valueOf(1440-(dfsj_ - fcsjActural_)); | |
| 5211 | - }else{ | |
| 5212 | - dfsjk = String.valueOf(dfsj_ - fcsjActural_); | |
| 5213 | - } | |
| 5214 | - } else { | |
| 5215 | - if(fcsjActural_ - dfsj_>1200){ | |
| 5216 | - dfsjk= String.valueOf(1440-(fcsjActural_ - dfsj_)); | |
| 5217 | - }else{ | |
| 5218 | - dfsjm = String.valueOf(fcsjActural_ - dfsj_); | |
| 5219 | - } | |
| 5300 | + if(df.equals("df")){ | |
| 5301 | + String[] dfsj_s =schedule.getDfsj().split(":"); | |
| 5302 | + Long dfsj_ = Long.parseLong(dfsj_s[0]) * 60 + Long.parseLong(dfsj_s[1]); | |
| 5303 | + if ((dfsj_ - fcsjActural_) > 0) { | |
| 5304 | + if(dfsj_ - fcsjActural_>1200){ | |
| 5305 | + dfsjm=String.valueOf(1440-(dfsj_ - fcsjActural_)); | |
| 5306 | + }else{ | |
| 5307 | + dfsjk = String.valueOf(dfsj_ - fcsjActural_); | |
| 5308 | + } | |
| 5309 | + } else { | |
| 5310 | + if(fcsjActural_ - dfsj_>1200){ | |
| 5311 | + dfsjk= String.valueOf(1440-(fcsjActural_ - dfsj_)); | |
| 5312 | + }else{ | |
| 5313 | + dfsjm = String.valueOf(fcsjActural_ - dfsj_); | |
| 5314 | + } | |
| 5315 | + } | |
| 5220 | 5316 | } |
| 5221 | 5317 | } |
| 5222 | 5318 | if(df.equals("df")){ | ... | ... |
src/main/java/com/bsth/service/schedule/datatools/TTInfoDetailDataToolsImpl.java
| ... | ... | @@ -348,7 +348,7 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail |
| 348 | 348 | for (int r = 1; r < sheet.getRows(); r++) { |
| 349 | 349 | List<FcInfo> fcInfos = new ArrayList<>(); |
| 350 | 350 | // 每行第一列都是路牌 |
| 351 | - fcInfos.add(new FcInfo(null, null, sheet.getCell(0, r).getContents(), null, null, null, null, null)); // 用fcsj放置路牌显示 | |
| 351 | + fcInfos.add(new FcInfo(null, null, sheet.getCell(0, r).getContents(), null, null, null, null, null, null)); // 用fcsj放置路牌显示 | |
| 352 | 352 | |
| 353 | 353 | int bc_ks = 0; // 空驶班次 |
| 354 | 354 | int bc_yy = 0; // 营运班次 |
| ... | ... | @@ -373,7 +373,9 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail |
| 373 | 373 | |
| 374 | 374 | String ists = content == null ? "" : content[9]; // 是否停驶 |
| 375 | 375 | |
| 376 | - FcInfo fcInfo = new FcInfo(ttdid_str, bctype, fcsj, xldir, isfb, qdzCode, zdzCode, ists); | |
| 376 | + String bcsj = content == null ? "" : content[10]; // 班次时间 | |
| 377 | + | |
| 378 | + FcInfo fcInfo = new FcInfo(ttdid_str, bctype, fcsj, xldir, isfb, qdzCode, zdzCode, ists, bcsj); | |
| 377 | 379 | |
| 378 | 380 | if (StringUtils.isNotEmpty(fzdname)) |
| 379 | 381 | headarrays[c] = fzdname; |
| ... | ... | @@ -407,10 +409,10 @@ public class TTInfoDetailDataToolsImpl implements DataToolsService, TTInfoDetail |
| 407 | 409 | } |
| 408 | 410 | |
| 409 | 411 | // 添加一列 空驶班次/空驶里程,fcsj放置数据 |
| 410 | - fcInfos.add(new FcInfo(null, null, String.format("%d/%.3f", bc_ks, lc_ks), null, null, null, null, null)); | |
| 412 | + fcInfos.add(new FcInfo(null, null, String.format("%d/%.3f", bc_ks, lc_ks), null, null, null, null, null, null)); | |
| 411 | 413 | |
| 412 | 414 | // 添加一列 营运班次/营运里程,fcsj放置数据 |
| 413 | - fcInfos.add(new FcInfo(null, null, String.format("%d/%.3f", bc_yy, lc_yy), null, null, null, null, null)); | |
| 415 | + fcInfos.add(new FcInfo(null, null, String.format("%d/%.3f", bc_yy, lc_yy), null, null, null, null, null, null)); | |
| 414 | 416 | |
| 415 | 417 | editInfo.getContents().add(fcInfos); |
| 416 | 418 | } | ... | ... |
src/main/java/com/bsth/service/schedule/datatools/TTInfoDetailForEdit.java
| ... | ... | @@ -31,6 +31,8 @@ public interface TTInfoDetailForEdit { |
| 31 | 31 | private String zdzCode; |
| 32 | 32 | /** 是否停驶 */ |
| 33 | 33 | private Boolean ists; |
| 34 | + /** 班次时间 */ | |
| 35 | + private String bcsj; | |
| 34 | 36 | |
| 35 | 37 | public FcInfo() { |
| 36 | 38 | } |
| ... | ... | @@ -43,7 +45,8 @@ public interface TTInfoDetailForEdit { |
| 43 | 45 | String isfb, |
| 44 | 46 | String qdzCode, |
| 45 | 47 | String zdzCode, |
| 46 | - String ists) { | |
| 48 | + String ists, | |
| 49 | + String bcsj) { | |
| 47 | 50 | this.ttdid = StringUtils.isEmpty(ttdid_str) ? null : Long.valueOf(ttdid_str); |
| 48 | 51 | this.bc_type = bc_type; |
| 49 | 52 | this.fcsj = fcsj; |
| ... | ... | @@ -69,6 +72,10 @@ public interface TTInfoDetailForEdit { |
| 69 | 72 | else |
| 70 | 73 | this.ists = false; |
| 71 | 74 | |
| 75 | + if (StringUtils.isNotEmpty(bcsj) && !"null".equals(bcsj)) { | |
| 76 | + this.bcsj = bcsj; | |
| 77 | + } | |
| 78 | + | |
| 72 | 79 | } |
| 73 | 80 | |
| 74 | 81 | public Long getTtdid() { |
| ... | ... | @@ -134,6 +141,14 @@ public interface TTInfoDetailForEdit { |
| 134 | 141 | public void setIsts(Boolean ists) { |
| 135 | 142 | this.ists = ists; |
| 136 | 143 | } |
| 144 | + | |
| 145 | + public String getBcsj() { | |
| 146 | + return bcsj; | |
| 147 | + } | |
| 148 | + | |
| 149 | + public void setBcsj(String bcsj) { | |
| 150 | + this.bcsj = bcsj; | |
| 151 | + } | |
| 137 | 152 | } |
| 138 | 153 | |
| 139 | 154 | /** | ... | ... |
src/main/java/com/bsth/service/schedule/impl/plan/kBase3/validate/timetable/ErrorBcCountFunction.java
| ... | ... | @@ -59,10 +59,16 @@ public class ErrorBcCountFunction implements AccumulateFunction { |
| 59 | 59 | return; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | + // 判定条件(数据库中的对应字段没有非空约束),与界面saTimeTable.js的validInfo方法对应 | |
| 63 | + // 1、起点站编码,名字为空 | |
| 64 | + // 2、终点站编码,名字为空 | |
| 65 | + // 3、班次时间 | |
| 66 | + // TODO:其他再议 | |
| 62 | 67 | if (StringUtils.isEmpty(ttInfoDetail.getQdzCode()) || |
| 63 | 68 | StringUtils.isEmpty(ttInfoDetail.getQdzName()) || |
| 64 | 69 | StringUtils.isEmpty(ttInfoDetail.getZdzCode()) || |
| 65 | - StringUtils.isEmpty(ttInfoDetail.getZdzName()) ) { | |
| 70 | + StringUtils.isEmpty(ttInfoDetail.getZdzName()) || | |
| 71 | + (ttInfoDetail.getBcsj() == null) ) { | |
| 66 | 72 | |
| 67 | 73 | errorCountData.errorcount ++; |
| 68 | 74 | } | ... | ... |
src/main/resources/META-INF/drools.packagebuilder.conf
0 → 100644
| 1 | +# 貌似用import accumulate报错,使用配置文件方式 | |
| 2 | + | |
| 3 | +drools.accumulate.function.gidscount = com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidsCountFunction | |
| 4 | +drools.accumulate.function.gidfbtime = com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidFbTimeFunction | |
| 5 | +drools.accumulate.function.gidfbfcno = com.bsth.service.schedule.impl.plan.kBase1.core.shiftloop.GidFbFcnoFunction | |
| 6 | + | |
| 7 | +drools.accumulate.function.lpinforesult = com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.LpInfoResultsFunction | |
| 8 | +drools.accumulate.function.minruleqyrq = com.bsth.service.schedule.impl.plan.kBase1.core.ttinfo.MinRuleQyrqFunction | |
| 9 | + | |
| 10 | +drools.accumulate.function.vrb = com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidRepeatBcFunction | |
| 11 | +drools.accumulate.function.vwrb = com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidWholeRerunBcFunction | |
| 12 | +drools.accumulate.function.vwlp = com.bsth.service.schedule.impl.plan.kBase1.core.validate.ValidWantLpFunction | ... | ... |