| | |
| | | package com.agentdriving.user.modular.system.service.impl; |
| | | |
| | | import com.agentdriving.user.core.util.ToolUtil; |
| | | import com.agentdriving.user.modular.system.dao.SystemConfigMapper; |
| | | import com.agentdriving.user.modular.system.model.SystemConfig; |
| | | import com.agentdriving.user.modular.system.service.ISystemConfigService; |
| | |
| | | SystemConfig systemConfig = this.selectOne(new EntityWrapper<SystemConfig>().eq("type", 5)); |
| | | PriceRulesWarpper priceRulesWarpper = new PriceRulesWarpper(); |
| | | if(null != systemConfig){ |
| | | //{"ChargeStandard":[{"num1":"06:00","num2":"08:00","num3":2,"num4":2,"num5":2,"num6":2,"num7":2,"num8":2,"num9":2,"num10":2,"num11":2},{"num1":"06:00","num2":"08:00","num3":1,"num4":1,"num5":1,"num6":1,"num7":2,"num8":2,"num9":2,"num10":2,"num11":2},{"num1":"00:00","num2":"10:00","num3":3,"num4":3,"num5":3,"num6":3,"num7":3,"num8":3,"num9":3,"num10":3,"num11":3}],"ExtraCost":{"num1":1,"num2":1,"num3":1,"num4":1,"num5":1,"num6":1,"num7":1,"num8":1,"num9":1}} |
| | | JSONObject jsonObject = JSON.parseObject(systemConfig.getContent()); |
| | | JSONArray chargeStandard = jsonObject.getJSONArray("ChargeStandard"); |
| | | List<Map<String, Object>> basePrice = new ArrayList<>(); |
| | |
| | | JSONObject jsonObject1 = chargeStandard.getJSONObject(i); |
| | | String num1 = jsonObject1.getString("num1"); |
| | | String num2 = jsonObject1.getString("num2"); |
| | | Double num3 = jsonObject1.getDouble("num3"); |
| | | JSONArray num3 = jsonObject1.getJSONArray("num3"); |
| | | Double num4 = jsonObject1.getDouble("num4"); |
| | | Double num5 = jsonObject1.getDouble("num5"); |
| | | Double num6 = jsonObject1.getDouble("num6"); |
| | | Double num7 = jsonObject1.getDouble("num7"); |
| | | Double num8 = jsonObject1.getDouble("num8"); |
| | | Double num9 = jsonObject1.getDouble("num9"); |
| | | Double num10 = jsonObject1.getDouble("num10"); |
| | | Double num11 = jsonObject1.getDouble("num11"); |
| | | |
| | | |
| | | Map<String, Object> map1 = new HashMap<>(); |
| | | map1.put("time", num1 + "-" + num2); |
| | | map1.put("startingMileage", num3 + "公里(包含" + num3 + "公里)"); |
| | | map1.put("startingPrice", num4 + "元"); |
| | | map1.put("exceedStartingPrice", num6 + "元/" + num5 + "公里"); |
| | | map1.put("time", ToolUtil.isEmpty(num1) ? "其他时段" : num1 + "-" + num2); |
| | | List<Map<String, String>> list = new ArrayList<>(); |
| | | for (int j = 0; j < num3.size(); j++) { |
| | | Map<String, String> map = new HashMap<>(); |
| | | JSONObject jsonObject2 = num3.getJSONObject(j); |
| | | Double num1_1 = jsonObject2.getDouble("num1"); |
| | | Double num2_1 = jsonObject2.getDouble("num2"); |
| | | Double num3_1 = jsonObject2.getDouble("num3"); |
| | | map.put("startingMileage", num1_1 + "-" + num2_1 + "公里(含" + num2_1 + "公里)"); |
| | | map.put("startingPrice", num3_1 + "元"); |
| | | list.add(map); |
| | | } |
| | | map1.put("data", list); |
| | | basePrice.add(map1); |
| | | |
| | | Map<String, Object> map2 = new HashMap<>(); |
| | | map2.put("time", num1 + "-" + num2); |
| | | map2.put("startingMileage", num7 + "-" + num8 + "公里"); |
| | | map2.put("startingPrice", num9 + "元"); |
| | | map2.put("exceedStartingPrice", num11 + "元/" + num10 + "公里"); |
| | | map2.put("time", ToolUtil.isEmpty(num1) ? "其他时段" : num1 + "-" + num2); |
| | | map2.put("startingMileage", num4 + "-" + num5 + "公里"); |
| | | map2.put("startingPrice", num6 + "元"); |
| | | map2.put("exceedStartingPrice", num7 + "元/" + num8 + "公里"); |
| | | longDistanceCharges.add(map2); |
| | | } |
| | | priceRulesWarpper.setBasePrice(JSON.toJSONString(basePrice)); |