从一开始着手该项目到现在,经历了几次项目功能需求更改,每一次对该项目原有接口的代码解读使得对该项目理解更加深刻。同时,和其他部门负责人在交互上也更加熟练,特别是和前端。产品经理对于项目产品理解是首位。
以下是更改需求之后,所写的接口:
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSort;
import com.hyd.daring.common.response.ResponseData;
import com.hyd.daring.model.module.ModuleScheduleInfo;
import com.hyd.daring.service.IBizTunnelServiceDemo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
@RequestMapping("/")
@RestController
@Validated
@Api(tags = "需求更改-模型数据接口")
@ApiSort(value = 1)
@Slf4j
public class D3ModuleController_Demo {
@Resource
private IBizTunnelServiceDemo tunnelService;
/**
*每种隧道分两种类型 因此创建两种接口 负责单独传输该类型的数据
* @return
*/
@RequestMapping(value = "/scheduleDemo",method = RequestMethod.GET)
@ApiOperation(value = "3D-隧道类型1")
@ApiOperationSupport(order=1)
public ResponseData<ModuleScheduleInfo> shedule(@ApiParam(name = "tunnelId",value = "当前选择的隧道id",required = true) Integer tunnelId) {
ModuleScheduleInfo res=tunnelService.moduleScheduleInfo(tunnelId);
return new ResponseData<>(res);
}
@RequestMapping(value = "/scheduleDemoAnother",method = RequestMethod.GET)
@ApiOperation(value = "3D-隧道类型2")
@ApiOperationSupport(order=1)
public ResponseData<ModuleScheduleInfo> sheduleAonther(@ApiParam(name = "tunnelId",value = "当前选择的隧道id",required = true) Integer tunnelId) {
ModuleScheduleInfo res=tunnelService.moduleScheduleInfoAnother(tunnelId);
return new ResponseData<>(res);
}
@RequestMapping(value = "/scheduleType",method = RequestMethod.GET)
@ApiOperation(value = "3D-隧道各位置最新坐标、进尺、桩号、监控视频、施工工艺视频")
@ApiOperationSupport(order=1)
public ResponseData<ModuleScheduleInfo> sheduleType(@ApiParam(name = "tunnelId",value = "当前选择的隧道id",required = true) Integer tunnelId) {
ModuleScheduleInfo res=tunnelService.moduleSchedule(tunnelId);
return new ResponseData<>(res);
}
}
基于一定的业务逻辑理解