|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import  com.doumee.api.BaseController; | 
|---|
|  |  |  | import com.doumee.config.annotation.LoginNoRequired; | 
|---|
|  |  |  | import com.doumee.core.model.ApiResponse; | 
|---|
|  |  |  | import com.doumee.core.tms.model.request.TmsOrderInfoRequest; | 
|---|
|  |  |  | import com.doumee.core.tms.model.request.TmsOrderListPagerRequest; | 
|---|
|  |  |  | import com.doumee.core.tms.model.request.TmsOrderListParamRequest; | 
|---|
|  |  |  | import com.doumee.core.tms.model.request.TmsOrderListRequest; | 
|---|
|  |  |  | import com.doumee.core.tms.model.response.TmsBasePageResponse; | 
|---|
|  |  |  | import com.doumee.core.tms.model.response.TmsOrderInfoResponse; | 
|---|
|  |  |  | import com.doumee.core.tms.model.response.TmsOrderListResponse; | 
|---|
|  |  |  | 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.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. | 
|---|
|  |  |  | 
|---|
|  |  |  | @LoginNoRequired | 
|---|
|  |  |  | @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("/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); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @ApiImplicitParams({ | 
|---|
|  |  |  | @ApiImplicitParam(paramType = "query", dataType = "String", name = "factoryCode", value = "查询类型厂区编码", required = false) | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | public ApiResponse<List<LastSevenDaysOrderVo>>  arriveGoodsList(@RequestParam(required = false) String factoryCode) { | 
|---|
|  |  |  | List<LastSevenDaysOrderVo> list = boardService.arriveGoodsList(factoryCode); | 
|---|
|  |  |  | 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("/totalOutQtyNum") | 
|---|
|  |  |  | public ApiResponse<TotalOutQtyNumVO> totalOutQtyNum() { | 
|---|
|  |  |  | TotalOutQtyNumVO result = boardService.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); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | WholeProvinceZXTVO  list = boardService.inventoryUseRate(); | 
|---|
|  |  |  | return ApiResponse.success(list); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @LoginNoRequired | 
|---|
|  |  |  | @ApiOperation("运力资源利用率") | 
|---|
|  |  |  | @GetMapping("/tranportAbilityUseRate") | 
|---|
|  |  |  | 
|---|
|  |  |  | @LoginNoRequired | 
|---|
|  |  |  | @ApiOperation("地图本月本年总出库量统计集合(按省份)") | 
|---|
|  |  |  | @GetMapping("/mapYearAndMonthOutList") | 
|---|
|  |  |  | public ApiResponse<List<WholeProvinceMapVO>> mapYearAndMonthOutList( ) { | 
|---|
|  |  |  | List<WholeProvinceMapVO>  list = boardService.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 | 
|---|
|  |  |  | @PostMapping("/orderList") | 
|---|
|  |  |  | public ApiResponse<TmsBasePageResponse<TmsOrderListResponse>> orderList(@RequestBody TmsOrderListRequest param )   { | 
|---|
|  |  |  | if(param == null){ | 
|---|
|  |  |  | param = new TmsOrderListRequest(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(param.getParameters() == null){ | 
|---|
|  |  |  | param.setParameters( new TmsOrderListParamRequest()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(param.getPager() == null){ | 
|---|
|  |  |  | param.setPager( new TmsOrderListPagerRequest()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(param.getPager().getPage() == null){ | 
|---|
|  |  |  | param.getPager().setPage(1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(param.getPager().getRows() == null){ | 
|---|
|  |  |  | param.getPager().setRows(10); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(StringUtils.isBlank(param.getParameters().getPhoneNumber())){ | 
|---|
|  |  |  | param.getParameters().setPhoneNumber("00000000000");//手机号必填 | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(param.getParameters().getContractNumbers()==null || param.getParameters().getContractNumbers().size()==0){ | 
|---|
|  |  |  | param.getParameters().setContractNumbers(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return  ApiResponse.success(tmsService.orderList(param)); | 
|---|
|  |  |  | @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)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|