123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- package com.steerinfo.dil.controller;
- import com.steerinfo.dil.feign.ESFeign;
- import com.steerinfo.dil.model.TmstruckLeaveFactoryResult;
- import com.steerinfo.dil.service.ITmstruckLeaveFactoryResultService;
- 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 com.steerinfo.route.service.impl.RouteServiceImpl;
- import io.swagger.annotations.ApiImplicitParam;
- import io.swagger.annotations.ApiImplicitParams;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.models.auth.In;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.web.bind.annotation.*;
- import java.io.File;
- import java.math.BigDecimal;
- import java.util.Arrays;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map;
- /**
- * TmstruckLeaveFactoryResult RESTful接口:
- * @author generator
- * @version 1.0-SNAPSHORT 2021-09-11 10:32
- * 类描述
- * 修订历史:
- * 日期:2021-09-11
- * 作者:TXF
- * 参考:
- * 描述:TmstruckLeaveFactoryResult RESTful接口
- * @see null
- * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
- */
- @RestController
- @RequestMapping("/${api.version}/tmstruckleavefactoryresults")
- public class TmstruckLeaveFactoryResultController extends BaseRESTfulController {
- @Autowired
- ITmstruckLeaveFactoryResultService tmstruckLeaveFactoryResultService;
- @Autowired
- private RouteServiceImpl routeService;
- @Autowired
- ESFeign esFeign;
- @Autowired
- ColumnDataUtil columnDataUtil;
- @ApiOperation(value="新增汽车出厂实绩:oms远程调用")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "mapValue", value = "总实绩ID、线路终点", required = false, dataType = "Map"),
- })
- @PostMapping("/addLeaveFactory")
- public RESTfulResult addLeaveFactory(@RequestBody(required=false) Map<String,Object> mapValue){
- int i = tmstruckLeaveFactoryResultService.addLeaveFactory(mapValue);
- return success(i);
- }
- @ApiOperation(value="查询出厂实绩")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "mapValue", value = "表头和参数", required = false, dataType = "map"),
- @ApiImplicitParam(name = "apiId(110)", 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("/getLeaveFactoryResult")
- public RESTfulResult getLeaveFactoryResult(@RequestBody(required=false) Map<String,Object> mapValue,
- Integer apiId,
- Integer pageNum,
- Integer pageSize,
- Integer orderType,
- String con,
- String carrierSsoId,
- String userId,
- String userIds){
- int count=0;
- if (userId!=null){
- mapValue.put("userId",userId);
- count++;
- }
- if (userIds!=null){
- mapValue.put("userIds",userIds);
- count++;
- }
- if (orderType!=null){
- mapValue.put("orderTypee", orderType);
- count++;
- }
- if(carrierSsoId != null){
- if(!"null".equals(carrierSsoId)){
- mapValue.put("carrierSsoId", carrierSsoId);
- }
- }
- //框计算
- if(con != null){
- if(!"undefined".equals(con)){
- String index="get_leavefactory_list";//设置要查询的索引名称
- return success(esFeign.getConResult(mapValue,index,apiId,pageNum,pageSize,con));//获取查询结果
- }
- }
- List<Map<String, Object>> allLeaveFactoryResult = null;
- //如果有条件查询则跳过初始化,和创建索引
- if(mapValue.size() == count){
- //将查询结果存入索引中
- allLeaveFactoryResult = tmstruckLeaveFactoryResultService.getLeaveFactoryResult(mapValue);
- Map<String, Object> map = new HashMap<>();
- //添加索引
- map.put("index","get_leavefactory_list");
- //添加id
- map.put("indexId","leaveFactoryId");
- allLeaveFactoryResult.add(map);
- //新建索引
- esFeign.insertIndex(allLeaveFactoryResult);
- //删除
- allLeaveFactoryResult.remove(allLeaveFactoryResult.size()-1);
- }
- if(allLeaveFactoryResult == null)
- allLeaveFactoryResult = tmstruckLeaveFactoryResultService.getLeaveFactoryResult(mapValue);
- PageHelper.startPage(pageNum,pageSize);
- //分页数据
- List<Map<String, Object>> leaveFactoryResult = tmstruckLeaveFactoryResultService.getLeaveFactoryResult(mapValue);
- PageListAdd pageList = columnDataUtil.tableColumnData(apiId, allLeaveFactoryResult,leaveFactoryResult);
- return success(pageList);
- }
- @ApiOperation(value="PAD扫描汽车出厂实绩")
- @ApiImplicitParams({
- @ApiImplicitParam(name = "mapValue", value = "", required = false, dataType = "Map"),
- @ApiImplicitParam(name = "orderNumber", value = "", required = false, dataType = "String"),
- })
- @PostMapping("/addLeaveFactoryResult")
- public RESTfulResult addLeaveFactoryResult(@RequestBody(required=false) Map<String,Object> mapValue){
- //中交新路接口
- // Map<String, Object> parem=tmstruckLeaveFactoryResultService.getTruckFactoryResult("WYSDD2021091000000002");
- // parem.put("turnOf","0");
- // routeService.saveRoute(parem);
- int leaveFactory = 0;
- try {
- leaveFactory = tmstruckLeaveFactoryResultService.leaveFactoryByPDA(mapValue);
- }catch (Exception e){
- return failed(e.getMessage());
- }
- return success(leaveFactory);
- }
- @ApiOperation(value="APP查询汽车出厂实绩")
- @PostMapping("/getLeaveFactoryList")
- public RESTfulResult getLeaveFactoryList(@RequestParam String orderNumber) {
- List<Map<String,Object>> mapList = tmstruckLeaveFactoryResultService.getLeaveFactoryList(orderNumber);
- return success(mapList);
- }
- }
|