| | |
| | | |
| | | import cn.hutool.core.date.DateUnit; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.stylefeng.guns.core.base.controller.BaseController; |
| | | import com.stylefeng.guns.core.base.tips.SuccessTip; |
| | | import com.stylefeng.guns.core.log.LogObjectHolder; |
| | | import com.stylefeng.guns.core.util.ToolUtil; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TAppUserDetailOrderResp; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TDriverCommissionResp; |
| | | import com.stylefeng.guns.modular.system.controller.resp.TOrderResp; |
| | | import com.stylefeng.guns.modular.system.controller.util.ExcelUtil; |
| | | import com.stylefeng.guns.modular.system.enums.OrderStateEnum; |
| | | import com.stylefeng.guns.modular.system.model.TAppUser; |
| | | import com.stylefeng.guns.modular.system.model.TDriver; |
| | | import com.stylefeng.guns.modular.system.model.TOrder; |
| | | import com.stylefeng.guns.modular.system.model.TOrderPosition; |
| | | import com.stylefeng.guns.modular.system.service.ITAppUserService; |
| | | import com.stylefeng.guns.modular.system.service.ITCancelOrderService; |
| | | import com.stylefeng.guns.modular.system.service.ITDriverService; |
| | | import com.stylefeng.guns.modular.system.service.ITOrderService; |
| | | import com.stylefeng.guns.modular.system.util.RedisUtil; |
| | | import com.stylefeng.guns.modular.system.util.ResultUtil; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.springframework.beans.BeanUtils; |
| | | 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.PathVariable; |
| | |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.OutputStream; |
| | | import java.io.*; |
| | | import java.math.BigDecimal; |
| | | import java.text.DateFormat; |
| | | import java.text.SimpleDateFormat; |
| | |
| | | private ITAppUserService tAppUserService; |
| | | @Autowired |
| | | private ITCancelOrderService tCancelOrderService; |
| | | |
| | | @Autowired |
| | | private RedisUtil redisUtil; |
| | | |
| | | @Autowired |
| | | private ITDriverService driverService; |
| | | |
| | | @Value("${filePath}") |
| | | private String filePath; |
| | | |
| | | /** |
| | | * 跳转到首页 |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | @RequestMapping(value = "/getOrderTrack") |
| | | @ResponseBody |
| | | public ResultUtil getOrderTrack(Integer orderDetailId){ |
| | | if(ToolUtil.isNotEmpty(orderDetailId)){ |
| | | try { |
| | | //将数据存储到文件中 |
| | | File file = new File(filePath + orderDetailId + ".json"); |
| | | 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); |
| | | return ResultUtil.success(list); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | }else { |
| | | return ResultUtil.paranErr(); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 关闭订单 |
| | | */ |
| | | @RequestMapping(value = "/cancelOrderUpdate") |
| | | @ResponseBody |
| | | public Object cancelOrderUpdate(@RequestParam Integer tOrderId) { |
| | | TOrder tOrder = tOrderService.selectById(tOrderId); |
| | | tOrder.setState(OrderStateEnum.CANCELED.getCode()); |
| | | tOrderService.updateById(tOrder); |
| | | if(null != tOrder.getDriverId()){ |
| | | redisUtil.delSetValue("orderService", tOrder.getId().toString()); |
| | | TDriver tDriver = driverService.selectById(tOrder.getDriverId()); |
| | | tDriver.setServerStatus(1); |
| | | driverService.updateById(tDriver); |
| | | } |
| | | return SUCCESS_TIP; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取列表 |
| | | */ |