添加根据standCode获取bridgeCode的代码
This commit is contained in:
@@ -2,18 +2,24 @@ package com.gzzn.omms.adminapi.controller.basicdata;
|
|||||||
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.apache.commons.collections.CollectionUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.gzzn.omms.adminapi.domain.secondary.dao.basicdata.OrmsStandAirbridgeDao;
|
||||||
import com.gzzn.omms.adminapi.domain.secondary.dao.basicdata.OrmsStandDao;
|
import com.gzzn.omms.adminapi.domain.secondary.dao.basicdata.OrmsStandDao;
|
||||||
import com.gzzn.omms.adminapi.domain.secondary.entity.baiscdata.OrmsStand;
|
import com.gzzn.omms.adminapi.domain.secondary.entity.baiscdata.OrmsStand;
|
||||||
|
import com.gzzn.omms.adminapi.domain.secondary.entity.baiscdata.OrmsStandAirbridge;
|
||||||
import com.gzzn.omms.adminapi.dto.ResponseDto;
|
import com.gzzn.omms.adminapi.dto.ResponseDto;
|
||||||
import com.gzzn.omms.adminapi.dto.basicdata.OrmsStandDto;
|
import com.gzzn.omms.adminapi.dto.basicdata.OrmsStandDto;
|
||||||
import com.gzzn.omms.adminapi.dto.basicdata.convert.OrmsStandConvert;
|
import com.gzzn.omms.adminapi.dto.basicdata.convert.OrmsStandConvert;
|
||||||
|
import com.gzzn.omms.adminapi.enums.ResultCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机位
|
* 机位
|
||||||
@@ -28,6 +34,11 @@ public class OrmsStandController {
|
|||||||
*/
|
*/
|
||||||
@Autowired
|
@Autowired
|
||||||
private OrmsStandDao ormsStandDao;
|
private OrmsStandDao ormsStandDao;
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OrmsStandAirbridgeDao ormsStandAirbridgeDao;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 机位Dto接口
|
* 机位Dto接口
|
||||||
*/
|
*/
|
||||||
@@ -50,4 +61,26 @@ public class OrmsStandController {
|
|||||||
|
|
||||||
return ResponseDto.success(ormsStandListDto);
|
return ResponseDto.success(ormsStandListDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定机位的登机桥信息
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@ApiOperation(value="获取指定机位的登机桥代码",tags="基础数据")
|
||||||
|
@GetMapping(value="/basicdata/ormsStands/{standCode}/airbridgeCode")
|
||||||
|
public ResponseDto<List<String>> getAirbridgeCodeByStandCode(@PathVariable String standCode) {
|
||||||
|
List<OrmsStandAirbridge> lsAirbridges = ormsStandAirbridgeDao.findByStandCode(standCode);
|
||||||
|
|
||||||
|
List<String> lsAirbridgesCode = new ArrayList<String>();
|
||||||
|
if(!CollectionUtils.isEmpty(lsAirbridges))
|
||||||
|
{
|
||||||
|
lsAirbridgesCode = lsAirbridges.stream().map(node->{
|
||||||
|
return node.getId().getAirbridgeCode();
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return ResponseDto.success(lsAirbridgesCode);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
package com.gzzn.omms.adminapi.domain.secondary.dao.basicdata;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.springframework.data.jpa.repository.Query;
|
||||||
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
|
||||||
|
import com.gzzn.omms.adminapi.domain.secondary.entity.baiscdata.OrmsStandAirbridge;
|
||||||
|
import com.gzzn.omms.adminapi.domain.secondary.entity.baiscdata.OrmsStandAirbridgePK;
|
||||||
|
|
||||||
|
public interface OrmsStandAirbridgeDao extends CrudRepository<OrmsStandAirbridge, OrmsStandAirbridgePK> {
|
||||||
|
|
||||||
|
@Query("select o from OrmsStandAirbridge o where o.id.standCode = ?1")
|
||||||
|
public List<OrmsStandAirbridge> findByStandCode(String standCode);
|
||||||
|
}
|
||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
package com.gzzn.omms.adminapi.domain.secondary.entity.baiscdata;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The persistent class for the ORMS_STAND_AIRBRIDGE database table.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name="ORMS_STAND_AIRBRIDGE")
|
||||||
|
@NamedQuery(name="OrmsStandAirbridge.findAll", query="SELECT o FROM OrmsStandAirbridge o")
|
||||||
|
public class OrmsStandAirbridge implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@EmbeddedId
|
||||||
|
private OrmsStandAirbridgePK id;
|
||||||
|
|
||||||
|
public OrmsStandAirbridge() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public OrmsStandAirbridgePK getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(OrmsStandAirbridgePK id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+57
@@ -0,0 +1,57 @@
|
|||||||
|
package com.gzzn.omms.adminapi.domain.secondary.entity.baiscdata;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The primary key class for the ORMS_STAND_AIRBRIDGE database table.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Embeddable
|
||||||
|
public class OrmsStandAirbridgePK implements Serializable {
|
||||||
|
//default serial version id, required for serializable classes.
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@Column(name="STAND_CODE")
|
||||||
|
private String standCode;
|
||||||
|
|
||||||
|
@Column(name="AIRBRIDGE_CODE")
|
||||||
|
private String airbridgeCode;
|
||||||
|
|
||||||
|
public OrmsStandAirbridgePK() {
|
||||||
|
}
|
||||||
|
public String getStandCode() {
|
||||||
|
return this.standCode;
|
||||||
|
}
|
||||||
|
public void setStandCode(String standCode) {
|
||||||
|
this.standCode = standCode;
|
||||||
|
}
|
||||||
|
public String getAirbridgeCode() {
|
||||||
|
return this.airbridgeCode;
|
||||||
|
}
|
||||||
|
public void setAirbridgeCode(String airbridgeCode) {
|
||||||
|
this.airbridgeCode = airbridgeCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean equals(Object other) {
|
||||||
|
if (this == other) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!(other instanceof OrmsStandAirbridgePK)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
OrmsStandAirbridgePK castOther = (OrmsStandAirbridgePK)other;
|
||||||
|
return
|
||||||
|
this.standCode.equals(castOther.standCode)
|
||||||
|
&& this.airbridgeCode.equals(castOther.airbridgeCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int hash = 17;
|
||||||
|
hash = hash * prime + this.standCode.hashCode();
|
||||||
|
hash = hash * prime + this.airbridgeCode.hashCode();
|
||||||
|
|
||||||
|
return hash;
|
||||||
|
}
|
||||||
|
}
|
||||||
+38
@@ -0,0 +1,38 @@
|
|||||||
|
package com.gzzn.omms.adminapi.controller.basicdata;
|
||||||
|
|
||||||
|
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
|
||||||
|
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
|
||||||
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
|
||||||
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
|
||||||
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.http.MediaType;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
import org.springframework.test.web.servlet.MockMvc;
|
||||||
|
import org.springframework.test.web.servlet.ResultHandler;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest
|
||||||
|
@AutoConfigureMockMvc
|
||||||
|
public class OrmsStandControllerTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MockMvc mvc;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testGetAirbridgeCodeByStandCode() throws Exception
|
||||||
|
{
|
||||||
|
mvc.
|
||||||
|
perform(get("/basicdata/ormsStands/{standCode}/airbridgeCode","147"))
|
||||||
|
.andExpect(status().isOk())
|
||||||
|
.andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8))
|
||||||
|
.andExpect(jsonPath("$.is_success").value(true))
|
||||||
|
.andDo(print())
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
package com.gzzn.omms.adminapi.domain.secondary.dao.basicdata;
|
||||||
|
|
||||||
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
|
||||||
|
import com.gzzn.omms.adminapi.domain.secondary.entity.baiscdata.OrmsStandAirbridge;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@SpringBootTest
|
||||||
|
public class OrmsStandAirbridgeDaoTest {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private OrmsStandAirbridgeDao ormsStandAirbridgeDao;
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFindByStandCode()
|
||||||
|
{
|
||||||
|
List<OrmsStandAirbridge> ls = ormsStandAirbridgeDao.findByStandCode("147");
|
||||||
|
assertThat(ls).isNotEmpty().hasSize(2);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user