New file |
| | |
| | | package com.stylefeng.guns.modular.system.controller.specialTrain; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | 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.shiro.ShiroKit; |
| | | import com.stylefeng.guns.core.util.DateUtil; |
| | | import com.stylefeng.guns.core.util.ExcelExportUtil; |
| | | import com.stylefeng.guns.core.util.SinataUtil; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.controller.util.PushUtil; |
| | | import com.stylefeng.guns.modular.system.dao.OrderCancelMapper; |
| | | import com.stylefeng.guns.modular.system.model.*; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.HttpRequestUtil; |
| | | import com.stylefeng.guns.modular.system.util.PushMinistryOfTransportUtil; |
| | | import com.stylefeng.guns.modular.system.util.PushURL; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.BufferedReader; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.InputStreamReader; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 专车订单控制器 |
| | | * |
| | | * @author fengshuonan |
| | | * @Date 2020-09-02 17:28:59 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("/tOrderPrivateCarConfirm") |
| | | public class TOrderPrivateCarConfirmController extends BaseController { |
| | | |
| | | private String PREFIXCONFIRM = "/system/tOrderPrivateCarConfirm/"; |
| | | |
| | | @Autowired |
| | | private ITOrderPrivateCarService tOrderPrivateCarService; |
| | | |
| | | @Autowired |
| | | private ITServerCarmodelService tServerCarmodelService; |
| | | |
| | | @Autowired |
| | | private ITOrderPositionService tOrderPositionService; |
| | | |
| | | @Autowired |
| | | private ITDriverService tDriverService; |
| | | |
| | | @Autowired |
| | | private PushMinistryOfTransportUtil pushMinistryOfTransportUtil; |
| | | |
| | | @Resource |
| | | private OrderCancelMapper orderCancelMapper; |
| | | |
| | | @Value("${pushMinistryOfTransport}") |
| | | private boolean pushMinistryOfTransport; |
| | | |
| | | @Value("${filePath}") |
| | | private String filePath; |
| | | |
| | | |
| | | /** |
| | | * 跳转到修改专车订单 |
| | | */ |
| | | @RequestMapping("/tOrderPrivateCar_orderDetail/{tOrderPrivateCarId}") |
| | | public String tOrderPrivateCarUpdate(@PathVariable Integer tOrderPrivateCarId, Model model) { |
| | | Map<String, Object> item = tOrderPrivateCarService.getPrivateCarOrderDetailById(tOrderPrivateCarId); |
| | | model.addAttribute("item",item); |
| | | return PREFIXCONFIRM + "tOrderPrivateCar_orderDetail.html"; |
| | | } |
| | | |
| | | /** |
| | | * 跳转到专车订单首页 |
| | | */ |
| | | @RequestMapping("") |
| | | public String confirmIndex(Model model) { |
| | | //服务专车车型 |
| | | List<TServerCarmodel> carmodelList = tServerCarmodelService.selectList(new EntityWrapper<TServerCarmodel>().eq("type", 1).eq("state", 1) |
| | | ); |
| | | model.addAttribute("carmodelList",carmodelList); |
| | | return PREFIXCONFIRM + "tOrderPrivateCar.html"; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 跳转到确认金额页面 |
| | | */ |
| | | @RequestMapping("/toConfirmMoney/{tOrderPrivateCarId}") |
| | | public String toConfirmMoney(@PathVariable Integer tOrderPrivateCarId, Model model) { |
| | | Map<String, Object> item = tOrderPrivateCarService.getPrivateCarOrderDetailById(tOrderPrivateCarId); |
| | | model.addAttribute("item",item); |
| | | return PREFIXCONFIRM + "toConfirmMoney.html"; |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 获取专车订单列表 |
| | | */ |
| | | @RequestMapping(value = "/listConfirm") |
| | | @ResponseBody |
| | | public Object listConfirm(String insertTime, |
| | | String orderNum, |
| | | Integer orderSource, |
| | | String userName, |
| | | String userPhone, |
| | | String passengers, |
| | | String passengersPhone, |
| | | Integer serverCarModelId, |
| | | String driver, |
| | | Integer state, |
| | | Integer smsNumber) { |
| | | String beginTime = null; |
| | | String endTime = null; |
| | | if (SinataUtil.isNotEmpty(insertTime)){ |
| | | String[] timeArray = insertTime.split(" - "); |
| | | beginTime = timeArray[0]; |
| | | endTime = timeArray[1]; |
| | | } |
| | | Page<Map<String, Object>> page = new PageFactory<Map<String, Object>>().defaultPage(); |
| | | page.setRecords(tOrderPrivateCarService.getPrivateCarOrderListConfirm(page,beginTime,endTime,ShiroKit.getUser().getRoleType(),ShiroKit.getUser().getObjectId(),orderNum,orderSource,userName,userPhone,passengers,passengersPhone,serverCarModelId,driver,state,smsNumber)); |
| | | return super.packForBT(page); |
| | | } |
| | | |
| | | |
| | | |
| | | private ResultUtil resultUtil; |
| | | |
| | | /** |
| | | * 获取订单轨迹 |
| | | * @param orderDetailId |
| | | * @return |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping(value = "/getOrderTrack", method = RequestMethod.POST) |
| | | public ResultUtil getOrderTrack(String orderDetailId){ |
| | | if(ToolUtil.isNotEmpty(orderDetailId)){ |
| | | try { |
| | | // List<TOrderPosition> list = tOrderPositionService.selectList(new EntityWrapper<TOrderPosition>().eq("orderType", 1).eq("orderId", orderDetailId).orderBy("insertTime")); |
| | | /*if(list.size() == 0){ |
| | | return ResultUtil.error("该订单没有运行轨迹"); |
| | | }*/ |
| | | //将数据存储到文件中 |
| | | File file = new File(filePath + orderDetailId + "_1.txt"); |
| | | if(!file.exists()){ |
| | | return ResultUtil.success(new ArrayList<>()); |
| | | } |
| | | //读取文件(字符流) |
| | | 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); |
| | | resultUtil = ResultUtil.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | resultUtil = ResultUtil.runErr(); |
| | | } |
| | | }else { |
| | | resultUtil = ResultUtil.paranErr(); |
| | | } |
| | | return resultUtil; |
| | | } |
| | | |
| | | @Autowired |
| | | private ITCompanyService companyService; |
| | | |
| | | @Autowired |
| | | private ITDriverService driverService; |
| | | |
| | | @Autowired |
| | | private IIncomeService incomeService; |
| | | |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private PushUtil pushUtil; |
| | | /** |
| | | * 支付专车订单 |
| | | */ |
| | | @RequestMapping(value = "/confirmMoney") |
| | | @ResponseBody |
| | | public Object confirmMoney(Integer id,BigDecimal money) { |
| | | TOrderPrivateCar orderPrivateCar = tOrderPrivateCarService.selectById(id); |
| | | orderPrivateCar.setAbnormalMoney(orderPrivateCar.getOrderMoney()); |
| | | orderPrivateCar.setOrderMoney(money); |
| | | orderPrivateCar.setIsException(0); |
| | | orderPrivateCar.setPriceAuditState(2); |
| | | orderPrivateCar.setState(7); |
| | | orderPrivateCar.updateById(); |
| | | // 推送消息 |
| | | TOrderPrivateCar finalOrderPrivateCar = orderPrivateCar; |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, finalOrderPrivateCar.getUserId(), finalOrderPrivateCar.getId(), 1, finalOrderPrivateCar.getState()); |
| | | pushUtil.pushOrderState(2, finalOrderPrivateCar.getDriverId(), finalOrderPrivateCar.getId(), 1, finalOrderPrivateCar.getState()); |
| | | } |
| | | }).start(); |
| | | return SUCCESS_TIP; |
| | | } |
| | | } |