|  |  | 
 |  |  | package com.doumee.cloud.board; | 
 |  |  |  | 
 |  |  | import com.doumee.api.BaseController; | 
 |  |  | import  com.doumee.api.BaseController; | 
 |  |  | import com.doumee.config.annotation.LoginNoRequired; | 
 |  |  | import com.doumee.core.model.ApiResponse; | 
 |  |  | import com.doumee.service.business.third.model.ApiResponse; | 
 |  |  | import com.doumee.service.business.third.model.request.TmsOrderInfoRequest; | 
 |  |  | import com.doumee.service.business.third.model.request.TmsOrderNoFinishListRequest; | 
 |  |  | import com.doumee.service.business.third.model.response.TmsBasePageResponse; | 
 |  |  | import com.doumee.service.business.third.model.response.TmsOrderInfoResponse; | 
 |  |  | import com.doumee.service.business.third.model.response.TmsOrderNoFinishListResponse; | 
 |  |  | import com.doumee.core.utils.Constants; | 
 |  |  | import com.doumee.core.utils.DateUtil; | 
 |  |  | import com.doumee.dao.business.model.TmsFactoryParam; | 
 |  |  | import com.doumee.dao.web.response.platformReport.*; | 
 |  |  | import com.doumee.service.business.third.BoardService; | 
 |  |  | import com.doumee.service.business.third.TmsService; | 
 |  |  | import io.swagger.annotations.*; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | import org.apache.commons.lang3.StringUtils; | 
 |  |  | import org.springframework.web.bind.annotation.GetMapping; | 
 |  |  | import org.springframework.web.bind.annotation.RequestMapping; | 
 |  |  | import org.springframework.web.bind.annotation.RequestParam; | 
 |  |  | import org.springframework.web.bind.annotation.RestController; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | import org.springframework.web.bind.annotation.*; | 
 |  |  |  | 
 |  |  | import java.math.BigDecimal; | 
 |  |  | import java.util.ArrayList; | 
 |  |  | import java.util.Date; | 
 |  |  | import java.util.List; | 
 |  |  | import java.util.Random; | 
 |  |  |  | 
 |  |  | /** | 
 |  |  |  * Created by IntelliJ IDEA. | 
 |  |  | 
 |  |  | @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/board/api/wholeProvince") | 
 |  |  | public class WholeProvinceController extends BaseController { | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private TmsService tmsService; | 
 |  |  |     @Autowired | 
 |  |  |     private BoardService boardService; | 
 |  |  |     @LoginNoRequired | 
 |  |  |     @ApiOperation("中心数据") | 
 |  |  |     @ApiOperation("中心数据(废弃)") | 
 |  |  |     @GetMapping("/centerData") | 
 |  |  |     public ApiResponse<WholeProvinceBoardVO> centerData() { | 
 |  |  |         WholeProvinceBoardVO data = new WholeProvinceBoardVO(); | 
 |  |  |         Random random = new Random(); | 
 |  |  |  | 
 |  |  |         data.setYearOutTotal(BigDecimal.valueOf(random.nextInt(200))); | 
 |  |  |         data.setYearOutTotalOnYear(BigDecimal.valueOf(random.nextInt(10))); | 
 |  |  |         data.setYearOutTimes(random.nextInt(200)); | 
 |  |  |         data.setYearProvinceRata(BigDecimal.valueOf(random.nextInt(100)).divide(new BigDecimal(100),2,BigDecimal.ROUND_HALF_UP)); | 
 |  |  |  | 
 |  |  |         data.setYearInPlanTotal(BigDecimal.valueOf(random.nextInt(200))); | 
 |  |  |         data.setYearInTotal(BigDecimal.valueOf(random.nextInt(data.getYearInPlanTotal().intValue()))); | 
 |  |  |         data.setYearInTotalOnYear(BigDecimal.valueOf(random.nextInt(10))); | 
 |  |  |         data.setYearInTimes(random.nextInt(200)); | 
 |  |  |  | 
 |  |  |         data.setOutPlanTotal(BigDecimal.valueOf(random.nextInt(200))); | 
 |  |  |         data.setOutPlanTimes(random.nextInt(200)); | 
 |  |  |         data.setOutTotal(BigDecimal.valueOf(random.nextInt(data.getOutPlanTotal().intValue()))); | 
 |  |  |         data.setOutTimes(random.nextInt(data.getOutPlanTimes())); | 
 |  |  |         data.setOutRata(BigDecimal.valueOf(random.nextInt(100))); | 
 |  |  |  | 
 |  |  |     @ApiImplicitParams({ | 
 |  |  |             @ApiImplicitParam(paramType = "query", dataType = "String", name = "factoryCode", value = "查询类型厂区编码", required = false) | 
 |  |  |     }) | 
 |  |  |     public ApiResponse<WholeProvinceBoardVO> centerData(@RequestParam(required = false) String factoryCode) { | 
 |  |  |         WholeProvinceBoardVO data = boardService.centerProvinceData(  factoryCode); | 
 |  |  |         return ApiResponse.success(data); | 
 |  |  |     } | 
 |  |  |     @LoginNoRequired | 
 |  |  |     @ApiOperation("中心数据(更新版本)") | 
 |  |  |     @GetMapping("/centerDataNew") | 
 |  |  |     @ApiImplicitParams({ | 
 |  |  |             @ApiImplicitParam(paramType = "query", dataType = "String", name = "factoryCode", value = "查询类型厂区编码", required = false) | 
 |  |  |     }) | 
 |  |  |     public ApiResponse<WholeProvinceBoardVO> centerDataNew(@RequestParam(required = false) String factoryCode) { | 
 |  |  |         WholeProvinceBoardVO data = boardService.centerProvinceDataNew(  factoryCode); | 
 |  |  |         return ApiResponse.success(data); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | 
 |  |  |     @LoginNoRequired | 
 |  |  |     @ApiOperation("近七日到货情况") | 
 |  |  |     @GetMapping("/arriveGoodsList") | 
 |  |  |     public ApiResponse<List<ArriveGoodsVO>> arriveGoodsList() { | 
 |  |  |         List<ArriveGoodsVO> list = new ArrayList<>(); | 
 |  |  |         Random random = new Random(); | 
 |  |  |         List<String> dayList = DateUtil.getBeforDays(new Date(),7); | 
 |  |  |         for (String str:dayList) { | 
 |  |  |             ArriveGoodsVO data = new ArriveGoodsVO(); | 
 |  |  |             data.setDateStr(str); | 
 |  |  |             data.setArriveNum(new BigDecimal(random.nextInt(1000))); | 
 |  |  |             data.setInTransitNum(new BigDecimal(random.nextInt(1000))); | 
 |  |  |             list.add(data); | 
 |  |  |  | 
 |  |  |         } | 
 |  |  |         return ApiResponse.success(list); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @LoginNoRequired | 
 |  |  |     @ApiOperation("当前运输任务") | 
 |  |  |     @GetMapping("/transportTaskList") | 
 |  |  |     public ApiResponse<List<TransportTaskVO>> transportTaskList() { | 
 |  |  |         List<TransportTaskVO> list = new ArrayList<>(); | 
 |  |  |         Random random = new Random(); | 
 |  |  |         for (int i = 1; i < 11; i++) { | 
 |  |  |             TransportTaskVO data = new TransportTaskVO(); | 
 |  |  |             data.setCarNo("皖A8" + random.nextInt(9) + random.nextInt(9) + random.nextInt(9) + random.nextInt(9)); | 
 |  |  |             data.setStatusStr("到达卸货地"); | 
 |  |  |             data.setAddress("安徽合肥"); | 
 |  |  |             data.setTaskDate(new Date()); | 
 |  |  |             list.add(data); | 
 |  |  |         } | 
 |  |  |         return ApiResponse.success(list); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @LoginNoRequired | 
 |  |  |     @ApiOperation("进销存运营") | 
 |  |  |     @GetMapping("/salesOperationList") | 
 |  |  |     @ApiImplicitParams({ | 
 |  |  |             @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "queryType", value = "查询类型:0=周;1=月;2=年;", required = true), | 
 |  |  |             @ApiImplicitParam(paramType = "query", dataType = "String", name = "factoryCode", value = "查询类型厂区编码", required = false) | 
 |  |  |     }) | 
 |  |  |     public ApiResponse<List<SalesOperationVO>> salesOperationList(@RequestParam Integer queryType) { | 
 |  |  |         List<SalesOperationVO> list = new ArrayList<>(); | 
 |  |  |         Random random = new Random(); | 
 |  |  |         List<String> dayList = DateUtil.getBeforDays(new Date(),7); | 
 |  |  |         if(Constants.equalsInteger(queryType,Constants.ONE)){ | 
 |  |  |             dayList = DateUtil.getBeforDays(new Date(),30); | 
 |  |  |         }else if(Constants.equalsInteger(queryType,Constants.TWO)){ | 
 |  |  |             dayList = DateUtil.getBeforMonth(new Date(),12); | 
 |  |  |         } | 
 |  |  |         for (String str:dayList) { | 
 |  |  |             SalesOperationVO data = new SalesOperationVO(); | 
 |  |  |             data.setDateStr(str); | 
 |  |  |             data.setStockNum(new BigDecimal(random.nextInt(1000))); | 
 |  |  |             data.setTotalInNum(new BigDecimal(random.nextInt(1000))); | 
 |  |  |             data.setTotalOutNum(new BigDecimal(random.nextInt(1000))); | 
 |  |  |             list.add(data); | 
 |  |  |         } | 
 |  |  |     public ApiResponse<List<LastSevenDaysOrderVo>>  arriveGoodsList(@RequestParam(required = false) String factoryCode) { | 
 |  |  |         List<LastSevenDaysOrderVo> list = boardService.arriveGoodsList(factoryCode); | 
 |  |  |         return ApiResponse.success(list); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @LoginNoRequired | 
 |  |  |     @ApiOperation("订单在途跟踪-累计出库量") | 
 |  |  |     @GetMapping("/totalOutQtyNum") | 
 |  |  |     @ApiImplicitParams({ | 
 |  |  |             @ApiImplicitParam(paramType = "query", dataType = "Integer", name = "type", value = "查询类型 0本月 1本周 2本年", required = false), | 
 |  |  |             @ApiImplicitParam(paramType = "query", dataType = "String", name = "factoryCode", value = "查询类型厂区编码", required = false) | 
 |  |  |     }) | 
 |  |  |     public ApiResponse<TotalOutQtyNumVO> totalOutQtyNum(@RequestParam Integer type,@RequestParam(required = false) String factoryCode) { | 
 |  |  |         TotalOutQtyNumVO result = boardService.totalOutQtyNum(type,factoryCode); | 
 |  |  |  | 
 |  |  |         return ApiResponse.success(result); | 
 |  |  |     } | 
 |  |  |     @LoginNoRequired | 
 |  |  |     @ApiOperation("所有烟厂集合") | 
 |  |  |     @GetMapping("/factoryList") | 
 |  |  |     public ApiResponse<List<TmsFactoryParam>> factoryList() { | 
 |  |  |         List<TmsFactoryParam> list = boardService.factoryList(); | 
 |  |  |         return ApiResponse.success(list); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @LoginNoRequired | 
 |  |  |     @ApiOperation("仓库资源利用率") | 
 |  |  |     @GetMapping("/inventoryUseRate") | 
 |  |  |     public ApiResponse<WholeProvinceZXTVO> inventoryUseRate( ) { | 
 |  |  |         WholeProvinceZXTVO  list = boardService.inventoryUseRate(); | 
 |  |  |         return ApiResponse.success(list); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @LoginNoRequired | 
 |  |  |     @ApiOperation("库存利用率") | 
 |  |  |     @GetMapping("/energyDataList") | 
 |  |  |     public ApiResponse<List<StockRataVO>> energyDataList() { | 
 |  |  |         List<StockRataVO> energyDataVOList = new ArrayList<>(); | 
 |  |  |         Random random = new Random(); | 
 |  |  |         for (int i = 1; i <= 5; i++) { | 
 |  |  |             StockRataVO data = new StockRataVO(); | 
 |  |  |             data.setPlaceName("地点_"+i); | 
 |  |  |             data.setNowStockNum(new BigDecimal(random.nextInt(200))); | 
 |  |  |             data.setStockRataNum(new BigDecimal(random.nextInt(200))); | 
 |  |  |             data.setTotalStockNum(new BigDecimal(random.nextInt(100))); | 
 |  |  |             energyDataVOList.add(data); | 
 |  |  |         } | 
 |  |  |         return ApiResponse.success(energyDataVOList); | 
 |  |  |     @ApiOperation("运力资源利用率") | 
 |  |  |     @GetMapping("/tranportAbilityUseRate") | 
 |  |  |     public ApiResponse<WholeProvinceZXTVO> tranportAbilityUseRate( ) { | 
 |  |  |         WholeProvinceZXTVO  list = boardService.tranportAbilityUseRate(); | 
 |  |  |         return ApiResponse.success(list); | 
 |  |  |     } | 
 |  |  |     @LoginNoRequired | 
 |  |  |     @ApiOperation("出库能力利用率") | 
 |  |  |     @GetMapping("/outAbilityUseRate") | 
 |  |  |     public ApiResponse<WholeProvinceZXTVO> outAbilityUseRate( ) { | 
 |  |  |         WholeProvinceZXTVO  list = boardService.outAbilityUseRate(); | 
 |  |  |         return ApiResponse.success(list); | 
 |  |  |     } | 
 |  |  |     @LoginNoRequired | 
 |  |  |     @ApiOperation("地图本月本年总出库量统计集合(按省份)") | 
 |  |  |     @GetMapping("/mapYearAndMonthOutList") | 
 |  |  |     @ApiImplicitParams({ | 
 |  |  |             @ApiImplicitParam(paramType = "query", dataType = "String", name = "factoryCode", value = "查询类型厂区编码", required = false) | 
 |  |  |     }) | 
 |  |  |     public ApiResponse<List<WholeProvinceMapVO>> mapYearAndMonthOutList( @RequestParam(required = false) String factoryCode) { | 
 |  |  |         List<WholeProvinceMapVO>  list = boardService.mapYearAndMonthOutList(factoryCode); | 
 |  |  |         return ApiResponse.success(list); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |  | 
 |  |  |     @ApiOperation("订单任务合同列表接口") | 
 |  |  |     @LoginNoRequired | 
 |  |  |     @ApiOperation("上月油耗排行") | 
 |  |  |     @GetMapping("/lastMonthOil") | 
 |  |  |     public ApiResponse<List<OilDataVO>> lastMonthOil() { | 
 |  |  |         List<OilDataVO> oilDataVOList = new ArrayList<>(); | 
 |  |  |         Random random = new Random(); | 
 |  |  |         BigDecimal maxOil = BigDecimal.ZERO; | 
 |  |  |         BigDecimal lastOil = BigDecimal.ZERO; | 
 |  |  |         for (int i = 1; i <= 7; i++) { | 
 |  |  |             OilDataVO oilDataVO = new OilDataVO(); | 
 |  |  |             oilDataVO.setCarNo("皖A8" + random.nextInt(9) + random.nextInt(9) + random.nextInt(9) + random.nextInt(9)); | 
 |  |  |             if(i==1){ | 
 |  |  |                 oilDataVO.setQuantity(new BigDecimal(random.nextInt(100))); | 
 |  |  |                 maxOil = oilDataVO.getQuantity(); | 
 |  |  |             }else{ | 
 |  |  |                 oilDataVO.setQuantity(new BigDecimal(random.nextInt(lastOil.intValue()))); | 
 |  |  |             } | 
 |  |  |             lastOil = oilDataVO.getQuantity(); | 
 |  |  |             oilDataVO.setMaxOil(maxOil); | 
 |  |  |             oilDataVOList.add(oilDataVO); | 
 |  |  |         } | 
 |  |  |         return ApiResponse.success(oilDataVOList); | 
 |  |  |     @PostMapping("/orderList") | 
 |  |  |     @ApiImplicitParams({ | 
 |  |  |             @ApiImplicitParam(paramType = "query", dataType = "String", name = "factoryCode", value = "查询类型厂区编码", required = false) | 
 |  |  |     }) | 
 |  |  |     public ApiResponse<TmsBasePageResponse<TmsOrderNoFinishListResponse>> orderNoFinishList(@RequestBody TmsOrderNoFinishListRequest param )   { | 
 |  |  |         TmsBasePageResponse<TmsOrderNoFinishListResponse> list = boardService.orderNoFinishList(param); | 
 |  |  |         return  ApiResponse.success(list); | 
 |  |  |     } | 
 |  |  |     @ApiOperation("合同详情接口") | 
 |  |  |     @LoginNoRequired | 
 |  |  |     @PostMapping("/orderInfo") | 
 |  |  |     public ApiResponse<TmsOrderInfoResponse> ordreInfo(@RequestBody TmsOrderInfoRequest request )   { | 
 |  |  |         return ApiResponse.success(tmsService.orderInfo(request)); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  | } |