package com.railway.business.catenary.controller; import com.railway.business.catenary.domain.BusJcbJcxc; import com.railway.business.catenary.domain.BusJcbWjcxc; import com.railway.business.catenary.domain.vo.JcebQueryVo; import com.railway.business.catenary.service.IBusJcbWjcxcService; import com.railway.common.core.controller.BaseController; import com.railway.common.core.domain.AjaxResult; import com.railway.common.core.page.TableDataInfo; import com.railway.system.service.ISysFileService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import java.util.List; import javax.validation.Valid; import org.springframework.beans.factory.annotation.Value; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; /** * @author zhangcaifeng */ @Api(value = "rest/catenary/bus/jcb/wjcxc", tags = "检查表 - 无交叉线岔") @RestController @Validated @RequestMapping(value = "business/catenary/bus/jcb/wjcxc") public class BusJcbWjcxcController extends BaseController { @Value("${railway.template}") public String templatePath; private final IBusJcbWjcxcService busJcbWjcxcService; private final ISysFileService sysFileService; public BusJcbWjcxcController(IBusJcbWjcxcService busJcbWjcxcService, ISysFileService sysFileService) { this.busJcbWjcxcService = busJcbWjcxcService; this.sysFileService = sysFileService; } @ApiOperation(value = "新增") @PostMapping("/add") public AjaxResult add(@Validated @RequestBody BusJcbWjcxc busJcbWjcxc) { return toAjax(busJcbWjcxcService.create(busJcbWjcxc)); } @ApiOperation(value = "删除") @DeleteMapping("/{ids}") public AjaxResult delete(@PathVariable(value = "ids") String[] ids) { return toAjax(busJcbWjcxcService.delete(ids)); } @ApiOperation(value = "更新") @PutMapping("/update") public AjaxResult update(@RequestBody @Valid BusJcbWjcxc busJcbWjcxc) { return toAjax(busJcbWjcxcService.update(busJcbWjcxc)); } @ApiOperation(value = "单个") @GetMapping(value = {"/", "/{id}"}) public AjaxResult getInfo(String id) { BusJcbWjcxc info = busJcbWjcxcService.getInfo(id); AjaxResult ajax = AjaxResult.success(); ajax.put("info", info); return ajax; } @ApiOperation(value = "列表") @GetMapping(value = "list") public TableDataInfo getList(BusJcbWjcxc busJcbWjcxc) { startPage(); List list = busJcbWjcxcService.getList(busJcbWjcxc); return getDataTable(list); } @ApiOperation(value = "获取上次检测值") @GetMapping(value = "/getLastOne") public AjaxResult getLastOne(BusJcbWjcxc busJcbWjcxc) { BusJcbWjcxc info = busJcbWjcxcService.getLastRecord(busJcbWjcxc); AjaxResult ajax = AjaxResult.success(); ajax.put("info", info); return ajax; } @ApiOperation(value = "提交") @PutMapping("/submit") public AjaxResult submit(@RequestBody BusJcbWjcxc busJcbWjcxc) { return toAjax(busJcbWjcxcService.submit(busJcbWjcxc)); } @ApiOperation(value = "退回") @PutMapping("/reject") public AjaxResult reject(@RequestBody BusJcbWjcxc busJcbWjcxc) { return toAjax(busJcbWjcxcService.reject(busJcbWjcxc)); } @ApiOperation(value = "确认") @PutMapping("/confirm") public AjaxResult confirm(@RequestBody BusJcbWjcxc busJcbWjcxc) { return toAjax(busJcbWjcxcService.confirm(busJcbWjcxc)); } @ApiOperation(value = "中心领导确认") @PutMapping("/centerLeaderConfirm") public AjaxResult centerLeaderConfirm(@RequestBody BusJcbWjcxc busJcbWjcxc) { return toAjax(busJcbWjcxcService.centerLeaderConfirm(busJcbWjcxc)); } @ApiOperation(value = "导出检查记录") @GetMapping("/export/{id}") public AjaxResult export(@PathVariable(value = "id") String id) { String localFilePath = busJcbWjcxcService.exportExcel(id); return sysFileService.uploadFile(localFilePath); } @ApiOperation(value = "导出excel") @GetMapping(value = "exportExcel") public AjaxResult exportExcel(JcebQueryVo query) { String localFilePath = busJcbWjcxcService.exportExcel(query); return sysFileService.uploadFile(localFilePath); } }