|  |  |  | 
|---|
|  |  |  | import com.doumee.config.annotation.CloudRequiredPermission; | 
|---|
|  |  |  | import com.doumee.core.annotation.excel.ExcelExporter; | 
|---|
|  |  |  | import com.doumee.core.annotation.pr.PreventRepeat; | 
|---|
|  |  |  | import com.doumee.core.model.ApiResponse; | 
|---|
|  |  |  | import com.doumee.core.model.PageData; | 
|---|
|  |  |  | import com.doumee.core.model.PageWrap; | 
|---|
|  |  |  | import com.doumee.service.business.third.model.ApiResponse; | 
|---|
|  |  |  | import com.doumee.service.business.third.model.PageData; | 
|---|
|  |  |  | import com.doumee.service.business.third.model.PageWrap; | 
|---|
|  |  |  | import com.doumee.core.utils.Constants; | 
|---|
|  |  |  | import com.doumee.dao.business.model.Platform; | 
|---|
|  |  |  | import com.doumee.dao.business.model.PlatformGroup; | 
|---|
|  |  |  | import com.doumee.dao.business.model.PlatformJob; | 
|---|
|  |  |  | import com.doumee.dao.web.reqeust.JobOperateDTO; | 
|---|
|  |  |  | import com.doumee.dao.web.reqeust.PlatformDataDTO; | 
|---|
|  |  |  | import com.doumee.dao.web.response.PlatformGroupWorkVO; | 
|---|
|  |  |  | import com.doumee.dao.web.response.PlatformWorkVO; | 
|---|
|  |  |  | import com.doumee.service.business.PlatformGroupService; | 
|---|
|  |  |  | import com.doumee.service.business.PlatformJobService; | 
|---|
|  |  |  | import com.doumee.service.business.PlatformService; | 
|---|
|  |  |  | import com.doumee.service.business.PlatformShowParamService; | 
|---|
|  |  |  | import com.doumee.service.business.third.WmsService; | 
|---|
|  |  |  | import io.swagger.annotations.Api; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  | import org.apache.commons.lang3.StringUtils; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.servlet.http.HttpServletResponse; | 
|---|
|  |  |  | import java.util.List; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author 江蹄蹄 | 
|---|
|  |  |  | * @since 2024/04/28 16:06 | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @Api(tags = "月台信息表") | 
|---|
|  |  |  | @Api(tags = "【后端】月台信息表") | 
|---|
|  |  |  | @RestController | 
|---|
|  |  |  | @RequestMapping(Constants.CLOUD_SERVICE_URL_INDEX+"/business/platform") | 
|---|
|  |  |  | public class PlatformCloudController extends BaseController { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private PlatformService platformService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private PlatformGroupService platformGroupService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private PlatformJobService platformJobService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private PlatformShowParamService platformShowParamService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private WmsService wmsService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreventRepeat | 
|---|
|  |  |  | @ApiOperation("新建") | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping("/updateById") | 
|---|
|  |  |  | @CloudRequiredPermission("business:platform:update") | 
|---|
|  |  |  | public ApiResponse updateById(@RequestBody Platform platform,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | platform.setLoginUserInfo(this.getLoginUser(token)); | 
|---|
|  |  |  | platformService.updateById(platform); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @ApiOperation("根据ID修改状态") | 
|---|
|  |  |  | @PostMapping("/updateStatusById") | 
|---|
|  |  |  | @CloudRequiredPermission("business:platform:update") | 
|---|
|  |  |  | public ApiResponse updateStatusById(@RequestBody Platform platform,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | platform.setLoginUserInfo(this.getLoginUser(token)); | 
|---|
|  |  |  | platformService.updateStatusById(platform); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @CloudRequiredPermission("business:platform:query") | 
|---|
|  |  |  | public ApiResponse<PageData<Platform>> findPage (@RequestBody PageWrap<Platform> pageWrap,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | return ApiResponse.success(platformService.findPage(pageWrap)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("月台作业统计") | 
|---|
|  |  |  | @PostMapping("/platformWorkReportPage") | 
|---|
|  |  |  | @CloudRequiredPermission("business:platform:query") | 
|---|
|  |  |  | public ApiResponse<List<Platform>> platformWorkReportPage (@RequestBody Platform platform,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | return ApiResponse.success(platformService.platformWorkReportList(platform)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("根据月台组获取月台列表信息") | 
|---|
|  |  |  | @GetMapping("/listByGroupId") | 
|---|
|  |  |  | @CloudRequiredPermission("business:platform:query") | 
|---|
|  |  |  | public ApiResponse<List<Platform>> listByGroupId (@RequestParam Integer groupId, @RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | return ApiResponse.success(platformJobService.getPlatformList(groupId,this.getLoginUser(token))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("导出Excel") | 
|---|
|  |  |  | 
|---|
|  |  |  | public ApiResponse findById(@PathVariable Integer id,@RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | return ApiResponse.success(platformService.findById(id)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("获取月台组信息") | 
|---|
|  |  |  | @PostMapping("/getPlatformGroupList") | 
|---|
|  |  |  | @CloudRequiredPermission("business:platform:query") | 
|---|
|  |  |  | public ApiResponse<List<PlatformGroup>>  getPlatformGroupList (@RequestBody PlatformDataDTO platformDataDTO, @RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | return ApiResponse.success(platformGroupService.getAllPlatformGroup(platformDataDTO,getLoginUser(token))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @ApiOperation("获取月台组信息(平台端)") | 
|---|
|  |  |  | @PostMapping("/getPlatformGroupListNew") | 
|---|
|  |  |  | @CloudRequiredPermission("business:platform:query") | 
|---|
|  |  |  | public ApiResponse<List<PlatformGroup>>  getPlatformGroupListNew (@RequestBody PlatformDataDTO platformDataDTO, @RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | return ApiResponse.success(platformGroupService.getAllPlatformGroup(platformDataDTO,getLoginUser(token))); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("获取月台任务信息") | 
|---|
|  |  |  | @GetMapping("/getPlatformWorkData") | 
|---|
|  |  |  | @CloudRequiredPermission("business:platform:query") | 
|---|
|  |  |  | public ApiResponse<PlatformWorkVO>  getPlatformWorkData (@RequestParam Integer platformId, @RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | return ApiResponse.success(platformJobService.getPlatformWorkVOById(platformId)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("更新月台配置信息") | 
|---|
|  |  |  | @GetMapping("/updUserPlatformConfig") | 
|---|
|  |  |  | @CloudRequiredPermission("business:platform:update") | 
|---|
|  |  |  | public ApiResponse  updUserPlatformConfig (@RequestParam List<Integer> ids, @RequestHeader(Constants.HEADER_USER_TOKEN) String token){ | 
|---|
|  |  |  | platformShowParamService.updUserConfig(ids,getLoginUser(token)); | 
|---|
|  |  |  | return ApiResponse.success("操作成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("车辆排队情况") | 
|---|
|  |  |  | @PostMapping("/platformLineUpPage") | 
|---|
|  |  |  | @CloudRequiredPermission("business:platform:query") | 
|---|
|  |  |  | public ApiResponse<PageData<PlatformJob>> platformLineUpPage (@RequestBody PageWrap<PlatformJob> pageWrap, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | return ApiResponse.success(platformJobService.platformCallList(pageWrap)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("叫号列表") | 
|---|
|  |  |  | @PostMapping("/platformCallList") | 
|---|
|  |  |  | @CloudRequiredPermission("business:platform:query") | 
|---|
|  |  |  | public ApiResponse<PageData<PlatformJob>> platformCallList (@RequestBody PageWrap<PlatformJob> pageWrap, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | return ApiResponse.success(platformJobService.platformCallList(pageWrap)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("叫号入园") | 
|---|
|  |  |  | @PostMapping("/platformInPark") | 
|---|
|  |  |  | @CloudRequiredPermission("business:platform:update") | 
|---|
|  |  |  | public ApiResponse platformInPark (@RequestBody JobOperateDTO jobOperateDTO, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | jobOperateDTO.setLoginUserInfo(getLoginUser(token)); | 
|---|
|  |  |  | PlatformJob platformJob = platformJobService.platformInPark(jobOperateDTO); | 
|---|
|  |  |  | platformJobService.sendInPark(platformJob); | 
|---|
|  |  |  | return ApiResponse.success("操作成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("月台叫号") | 
|---|
|  |  |  | @PostMapping("/platformCallNumber") | 
|---|
|  |  |  | @CloudRequiredPermission("business:platform:update") | 
|---|
|  |  |  | public ApiResponse platformCallNumber (@RequestBody JobOperateDTO jobOperateDTO, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | jobOperateDTO.setLoginUserInfo(getLoginUser(token)); | 
|---|
|  |  |  | PlatformJob oldPlatformJob = platformJobService.findById(jobOperateDTO.getJobId()); | 
|---|
|  |  |  | PlatformJob platformJob = platformJobService.platformCallNumber(jobOperateDTO); | 
|---|
|  |  |  | if(Constants.equalsInteger(oldPlatformJob.getStatus(),Constants.PlatformJobStatus.WAIT_CALL.getKey())){ | 
|---|
|  |  |  | platformJobService.sendInPark(platformJob); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | if(!Constants.equalsInteger(platformJob.getType(),Constants.FOUR) | 
|---|
|  |  |  | && StringUtils.isNotBlank(platformJob.getBillCode())){ | 
|---|
|  |  |  | //通知WMS绑定月台信息 | 
|---|
|  |  |  | wmsService.orderPlatformBind(platformJob); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | return ApiResponse.success("操作成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("转移月台") | 
|---|
|  |  |  | @PostMapping("/platformMove") | 
|---|
|  |  |  | @CloudRequiredPermission("business:platform:update") | 
|---|
|  |  |  | public ApiResponse platformMove (@RequestBody JobOperateDTO jobOperateDTO, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | jobOperateDTO.setLoginUserInfo(getLoginUser(token)); | 
|---|
|  |  |  | platformJobService.platformMove(jobOperateDTO); | 
|---|
|  |  |  | return ApiResponse.success("操作成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("月台过号") | 
|---|
|  |  |  | @PostMapping("/platformOverNumber") | 
|---|
|  |  |  | @CloudRequiredPermission("business:platform:update") | 
|---|
|  |  |  | public ApiResponse platformOverNumber (@RequestBody JobOperateDTO jobOperateDTO, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | jobOperateDTO.setLoginUserInfo(getLoginUser(token)); | 
|---|
|  |  |  | PlatformJob platformJob = platformJobService.platformOverNumber(jobOperateDTO); | 
|---|
|  |  |  | platformJobService.cancelInPark(platformJob); | 
|---|
|  |  |  | return ApiResponse.success("操作成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("异常挂起") | 
|---|
|  |  |  | @PostMapping("/platformErr") | 
|---|
|  |  |  | @CloudRequiredPermission("business:platform:update") | 
|---|
|  |  |  | public ApiResponse platformErr (@RequestBody JobOperateDTO jobOperateDTO, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | jobOperateDTO.setLoginUserInfo(getLoginUser(token)); | 
|---|
|  |  |  | platformJobService.platformErr(jobOperateDTO); | 
|---|
|  |  |  | return ApiResponse.success("操作成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("手动开始作业") | 
|---|
|  |  |  | @PostMapping("/beginWork") | 
|---|
|  |  |  | @CloudRequiredPermission("business:platform:update") | 
|---|
|  |  |  | public ApiResponse beginWork (@RequestBody JobOperateDTO jobOperateDTO, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | jobOperateDTO.setLoginUserInfo(getLoginUser(token)); | 
|---|
|  |  |  | PlatformJob platformJob = platformJobService.beginWork(jobOperateDTO); | 
|---|
|  |  |  | platformJobService.cancelInPark(platformJob); | 
|---|
|  |  |  | return ApiResponse.success("操作成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("恢复作业") | 
|---|
|  |  |  | @PostMapping("/restoreWork") | 
|---|
|  |  |  | @CloudRequiredPermission("business:platform:update") | 
|---|
|  |  |  | public ApiResponse restoreWork (@RequestBody JobOperateDTO jobOperateDTO, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | jobOperateDTO.setLoginUserInfo(getLoginUser(token)); | 
|---|
|  |  |  | PlatformJob platformJob = platformJobService.restoreWork(jobOperateDTO); | 
|---|
|  |  |  | return ApiResponse.success("操作成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("完成作业") | 
|---|
|  |  |  | @PostMapping("/finishWork") | 
|---|
|  |  |  | @CloudRequiredPermission("business:platform:update") | 
|---|
|  |  |  | public ApiResponse finishWork (@RequestBody JobOperateDTO jobOperateDTO, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | jobOperateDTO.setLoginUserInfo(getLoginUser(token)); | 
|---|
|  |  |  | PlatformJob platformJob = platformJobService.finishWork(jobOperateDTO); | 
|---|
|  |  |  | //下发离园权限 | 
|---|
|  |  |  | platformJobService.sendInPark(platformJob); | 
|---|
|  |  |  | return ApiResponse.success("操作成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("授权离场") | 
|---|
|  |  |  | @PostMapping("/powerLevel") | 
|---|
|  |  |  | @CloudRequiredPermission("business:platform:update") | 
|---|
|  |  |  | public ApiResponse powerLevel (@RequestBody JobOperateDTO jobOperateDTO, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | jobOperateDTO.setLoginUserInfo(getLoginUser(token)); | 
|---|
|  |  |  | PlatformJob platformJob =  platformJobService.powerLevel(jobOperateDTO); | 
|---|
|  |  |  | //下发离园权限 | 
|---|
|  |  |  | platformJobService.sendInPark(platformJob); | 
|---|
|  |  |  | return ApiResponse.success("操作成功"); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @ApiOperation("获取月台组 等待与异常挂起数据") | 
|---|
|  |  |  | @GetMapping("/getPlatformGroupWork") | 
|---|
|  |  |  | @CloudRequiredPermission("business:platform:query") | 
|---|
|  |  |  | public ApiResponse<PlatformGroupWorkVO> getPlatformGroupWork (@RequestParam Integer platformGroupId, @RequestHeader(Constants.HEADER_USER_TOKEN) String token) { | 
|---|
|  |  |  | return ApiResponse.success(platformGroupService.getPlatformGroupWork(platformGroupId)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|