123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242 |
- package com.steerinfo.dil.controller;
- import com.steerinfo.dil.feign.ESFeign;
- import com.steerinfo.dil.feign.TmsTruckFeign;
- import com.steerinfo.dil.model.OmstruckOrder;
- import com.steerinfo.dil.service.impl.OmstruckOrderSeparateServiceImpl;
- import com.steerinfo.dil.util.BaseRESTfulController;
- import com.steerinfo.dil.util.ColumnDataUtil;
- import com.steerinfo.dil.util.PageListAdd;
- import com.steerinfo.framework.controller.RESTfulResult;
- import com.steerinfo.framework.service.pagehelper.PageHelper;
- import io.swagger.annotations.ApiImplicitParam;
- import io.swagger.annotations.ApiImplicitParams;
- import io.swagger.annotations.ApiOperation;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.math.BigDecimal;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- /**
- * @ author :TXF
- * @ time :2021/12/3 15:07
- */
- @RestController
- @RequestMapping("/${api.version}/omstruckorderseparates")
- public class OmstruckOrderSeparateController extends BaseRESTfulController {
- @Autowired
- OmstruckOrderSeparateServiceImpl omstruckOrderSeparateService;
- @Autowired
- private TmsTruckFeign tmsTruckFeign;
- @Autowired
- ColumnDataUtil columnDataUtil;
- @Autowired
- ESFeign esFeign;
- @PostMapping("/getOrderMes")
- public RESTfulResult getMes(@RequestBody(required = false) Map<String, Object> map){
- Integer integer = tmsTruckFeign.addTotalResult(map);
- return success(integer);
- }
- /**
- * 添加退货实绩关闭当前订单
- * @param map
- * @return
- */
- @PostMapping("/returnOrderCloseOrder")
- public RESTfulResult returnOrderCloseOrder(@RequestBody(required = false) Map<String, Object> map){
- Integer result = omstruckOrderSeparateService.returnOrderCloseOrder(map);
- return success(result);
- }
- /**
- * 根据运单id查询实绩位置
- * @param map
- * @return
- */
- @PostMapping("/getOrderResult")
- public List<Map<String,Object>> getOrderResult(@RequestBody Map<String,Object> map){
- Integer orderId = (Integer) map.get("orderId");
- String orderNumber = (String) map.get("orderNumber");
- List<Map<String, Object>> result = null;
- if (orderId != null) {
- result = omstruckOrderSeparateService.getOrderResult(new BigDecimal(orderId));
- }
- else {
- result = omstruckOrderSeparateService.getOrderNumberResult(orderNumber);
- }
- return result;
- }
- /**
- * 发送消息到 websocket 推送消息
- * @param map
- */
- @PostMapping("/pushMesToWebsocket")
- public RESTfulResult pushMesToWebsocket(@RequestBody Map<String,Object> map) {
- String s = omstruckOrderSeparateService.pushMesToWebsocket(map);
- return success(s);
- }
- @ApiOperation(value = "查看承运商所属的订单")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
- @ApiImplicitParam(name = "apiId(86)", value = "动态表头", required = false, dataType = "Integer"),
- @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
- @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
- @ApiImplicitParam(name = "status", value = "状态码", required = false, dataType = "Integer"),
- })
- @PostMapping("/getInputOrderList")
- public RESTfulResult getInputOrderList(@RequestBody(required = false) Map<String, Object> mapValue,
- Integer apiId,
- Integer pageNum,
- Integer pageSize,
- Integer carrierId,
- Integer orderType,
- Integer orderStatus,
- String con) {
- int count = 0;
- if (orderStatus != null) {
- mapValue.put("orderStatus", orderStatus);
- count++;
- }
- if (orderType != null) {
- mapValue.put("orderType", orderType);
- count++;
- }
- if (carrierId != null) {
- mapValue.put("carrierId", carrierId);
- count++;
- }
- //框计算
- if (con != null) {
- if (!"undefined".equals(con)) {
- String index = "get_input_order_list";//设置要查询的索引名称
- return success(esFeign.getConResult(mapValue, index, apiId, pageNum, pageSize, con));//获取查询结果
- }
- }
- //不分页筛选数据
- List<Map<String, Object>> allTruckOrder = null;
- //如果有条件查询则跳过初始化,和创建索引
- if (mapValue.size() == count) {
- //将查询结果存入索引中
- allTruckOrder = omstruckOrderSeparateService.getInputOrderList(mapValue);
- Map<String, Object> map = new HashMap<>();
- //添加索引
- map.put("index", "get_input_order_list");
- //添加id
- map.put("indexId", "truckOrderId");
- allTruckOrder.add(map);
- //新建索引
- esFeign.insertIndex(allTruckOrder);
- //删除
- allTruckOrder.remove(allTruckOrder.size() - 1);
- }
- if (allTruckOrder == null)
- allTruckOrder = omstruckOrderSeparateService.getInputOrderList(mapValue);
- PageHelper.startPage(pageNum, pageSize);
- //分页数据
- List<Map<String, Object>> truckOrder = omstruckOrderSeparateService.getInputOrderList(mapValue);
- PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allTruckOrder, truckOrder);
- return success(pageList);
- }
- @ApiOperation(value = "查询所有的零星物资订单")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
- @ApiImplicitParam(name = "apiId(86)", value = "动态表头", required = false, dataType = "Integer"),
- @ApiImplicitParam(name = "pageNum", value = "页码", required = false, dataType = "Integer"),
- @ApiImplicitParam(name = "pageSize", value = "页", required = false, dataType = "Integer"),
- @ApiImplicitParam(name = "orderStatus", value = "状态码", required = false, dataType = "Integer"),
- })
- @PostMapping("/getOthersOrderMesToSend")
- public RESTfulResult getOthersOrderMesToSend(@RequestBody(required = false) Map<String, Object> mapValue,
- Integer apiId,
- Integer pageNum,
- Integer pageSize,
- Integer type,
- Integer orderStatus,
- String carrierId,
- String con) {
- int count = 0;
- if (orderStatus != null) {
- mapValue.put("status", orderStatus);
- count++;
- }
- if (type != null) {
- mapValue.put("type", type);
- count++;
- }
- if (carrierId != null && !"undefined".equals(carrierId)) {
- mapValue.put("carrierId", carrierId);
- count++;
- }
- //框计算
- if (con != null) {
- if (!"undefined".equals(con)) {
- String index = "get_others_order_list";//设置要查询的索引名称
- return success(esFeign.getConResult(mapValue, index, apiId, pageNum, pageSize, con));//获取查询结果
- }
- }
- //不分页筛选数据
- List<Map<String, Object>> allMes = null;
- //如果有条件查询则跳过初始化,和创建索引
- if (mapValue.size() == count) {
- //将查询结果存入索引中
- allMes = omstruckOrderSeparateService.getOthersOrderMesToSend(mapValue);
- Map<String, Object> map = new HashMap<>();
- //添加索引
- map.put("index", "get_others_order_list");
- //添加id
- map.put("indexId", "othersOrderId");
- allMes.add(map);
- //新建索引
- esFeign.insertIndex(allMes);
- //删除
- allMes.remove(allMes.size() - 1);
- }
- if (allMes == null)
- allMes = omstruckOrderSeparateService.getOthersOrderMesToSend(mapValue);
- PageHelper.startPage(pageNum, pageSize);
- //分页数据
- List<Map<String, Object>> mes = omstruckOrderSeparateService.getOthersOrderMesToSend(mapValue);
- PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allMes, mes);
- return success(pageList);
- }
- /**
- * 根据运输订单id修改运力id
- * @param omstruckOrder
- */
- @PostMapping("/updateOmstruckOrder")
- public RESTfulResult updateOmstruckOrder(@RequestBody(required = false) OmstruckOrder omstruckOrder){
- int i = omstruckOrderSeparateService.updateOmstruckOrder(omstruckOrder);
- return success(i);
- }
- @PostMapping("getUnloadOrderMaterial")
- public RESTfulResult getUnloadOrderMaterial(@RequestBody(required = false) Map<String,Object>map) {
- return success(omstruckOrderSeparateService.getUnloadOrderMaterial(map));
- }
- /**
- * 承运商销售分派运输订单给司机
- * @param mapValue
- * @return
- */
- @PostMapping("/addSaleTruckOrder")
- public RESTfulResult addSaleTruckOrder(@RequestBody Map<String, Object> mapValue){
- Integer result = omstruckOrderSeparateService.addSaleTruckOrder(mapValue);
- return success(result);
- }
- }
|