| | |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.common.constant.factory.PageFactory; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import com.stylefeng.guns.core.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.shiro.ShiroUser; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.InputStreamReader; |
| | | import java.io.*; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | |
| | | |
| | | @Autowired |
| | | private ITOrderPositionService tOrderPositionService; |
| | | |
| | | @Autowired |
| | | private ITPubTransactionDetailsService pubTransactionDetailsService; |
| | | private ResultUtil resultUtil; |
| | | |
| | | @Value("${filePath}") |
| | |
| | | } |
| | | |
| | | /** |
| | | * 跳转到修改出租车订单 |
| | | */ |
| | | @RequestMapping("/tOrderCrossCity_update/{tOrderCrossCityId}") |
| | | public String tOrderCrossCity_update(@PathVariable Integer tOrderCrossCityId, Model model) throws IOException { |
| | | Map<String, Object> tOrderTaxi = tOrderCrossCityService.getTaxiOrderDetailById(tOrderCrossCityId); |
| | | model.addAttribute("item",tOrderTaxi); |
| | | // 查询线路 |
| | | TLine line = itLineService.selectById(Integer.parseInt(tOrderTaxi.get("lineId").toString())); |
| | | model.addAttribute("line",line); |
| | | // 查询司机扣款 |
| | | List<TPubTransactionDetails> tPubTransactionDetails = pubTransactionDetailsService.selectList(new EntityWrapper<TPubTransactionDetails>() |
| | | .eq("userId", tOrderTaxi.get("driverId")) |
| | | .eq("orderId", tOrderTaxi.get("id")) |
| | | .eq("type", 1) |
| | | .eq("userType", 2)); |
| | | if(CollectionUtils.isEmpty(tPubTransactionDetails)){ |
| | | model.addAttribute("companyMoney",""); |
| | | model.addAttribute("driverMoney",""); |
| | | }else { |
| | | TPubTransactionDetails pubTransactionDetailCompany = tPubTransactionDetails.stream().filter(e -> e.getOrderType().equals(6)).findFirst().orElse(null); |
| | | if(Objects.nonNull(pubTransactionDetailCompany)){ |
| | | model.addAttribute("companyMoney",pubTransactionDetailCompany.getMoney()); |
| | | }else { |
| | | model.addAttribute("companyMoney",""); |
| | | } |
| | | TPubTransactionDetails pubTransactionDetailDriver = tPubTransactionDetails.stream().filter(e -> e.getOrderType().equals(3)).findFirst().orElse(null); |
| | | if(Objects.nonNull(pubTransactionDetailDriver)){ |
| | | model.addAttribute("driverMoney",pubTransactionDetailDriver.getMoney()); |
| | | }else { |
| | | model.addAttribute("driverMoney",""); |
| | | } |
| | | } |
| | | if(tOrderTaxi.get("payManner")!=null && Integer.parseInt(tOrderTaxi.get("payManner").toString()) == 1){ |
| | | model.addAttribute("payMannerStr","线上收款"); |
| | | }else { |
| | | model.addAttribute("payMannerStr","计费打表"); |
| | | } |
| | | LogObjectHolder.me().set(tOrderTaxi); |
| | | try{ |
| | | //将数据存储到文件中 |
| | | File file = new File(filePath + tOrderCrossCityId + "_3.txt"); |
| | | |
| | | //读取文件(字符流) |
| | | BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file),"UTF-8")); |
| | | //循环取出数据 |
| | | String str = null; |
| | | StringBuffer sb = new StringBuffer(); |
| | | while ((str = in.readLine()) != null) { |
| | | sb.append(str); |
| | | } |
| | | List<TOrderPosition> list = JSONArray.parseArray(sb.toString(), TOrderPosition.class); |
| | | List<Map> maps = new ArrayList<>(); |
| | | for (TOrderPosition tOrderPosition : list) { |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("lon",tOrderPosition.getLon()); |
| | | map.put("lat",tOrderPosition.getLat()); |
| | | maps.add(map); |
| | | } |
| | | |
| | | // resultUtil = ResultUtil.success(list); |
| | | // 将maps转化为jsonArray字符串 |
| | | // 使用 Gson 转换为 JSON 字符串 |
| | | // Gson gson = new Gson(); |
| | | // String jsonString = gson.toJson(maps); |
| | | // System.out.println(jsonString); |
| | | model.addAttribute("guiji",maps); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | resultUtil = ResultUtil.runErr(); |
| | | model.addAttribute("guiji",""); |
| | | } |
| | | return PREFIX + "tOrderCrossCity_edit.html"; |
| | | } |
| | | |
| | | /** |
| | | * 获取订单轨迹 |
| | | * @param orderDetailId |
| | | * @return |