소스정리
This commit is contained in:
@@ -35,3 +35,5 @@ out/
|
|||||||
|
|
||||||
### VS Code ###
|
### VS Code ###
|
||||||
.vscode/
|
.vscode/
|
||||||
|
|
||||||
|
.env
|
||||||
@@ -38,6 +38,7 @@ dependencies {
|
|||||||
implementation 'org.springframework.boot:spring-boot-starter'
|
implementation 'org.springframework.boot:spring-boot-starter'
|
||||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||||
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'
|
||||||
|
implementation 'me.paulschwarz:spring-dotenv:4.0.0'
|
||||||
}
|
}
|
||||||
tasks.named('test') {
|
tasks.named('test') {
|
||||||
useJUnitPlatform()
|
useJUnitPlatform()
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package net.jwsi.jcms_vpp.station;
|
package net.jwsi.jcms_vpp.station;
|
||||||
|
|
||||||
import jakarta.persistence.Entity;
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -11,8 +12,20 @@ import net.jwsi.jcms.base.BaseStEntity;
|
|||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
@Entity(name="vpp_station")
|
@Entity(name="vpp_station")
|
||||||
public class Station extends BaseStEntity {
|
public class Station extends BaseStEntity {
|
||||||
private String providerId;
|
@Id
|
||||||
private String stationId;
|
private String stationId;
|
||||||
}
|
private String providerId;
|
||||||
|
private String stNm;
|
||||||
|
private String addrRdM;
|
||||||
|
private String addrRdD;
|
||||||
|
private String addrLdM;
|
||||||
|
private String addrLdD;
|
||||||
|
private String stFacilTpCd;
|
||||||
|
private String stFacilDTpCd;
|
||||||
|
private String parkingFeeYn;
|
||||||
|
private String parkingFeeDetl;
|
||||||
|
private String pnuNo;
|
||||||
|
private String pnuDoNm;
|
||||||
|
private String pnuDongNm;
|
||||||
|
private String pnuSiNm;
|
||||||
|
}
|
||||||
@@ -1,12 +1,18 @@
|
|||||||
package net.jwsi.jcms_vpp.station;
|
package net.jwsi.jcms_vpp.station;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.jwsi.jcms.base.BaseController;
|
import net.jwsi.jcms.base.BaseController;
|
||||||
import net.jwsi.jcms.base.BaseEntity;
|
import net.jwsi.jcms.base.BaseEntity;
|
||||||
import net.jwsi.jcms.base.BaseService;
|
import net.jwsi.jcms.base.BaseService;
|
||||||
import net.jwsi.jcms.exception.JsonDataException;
|
import net.jwsi.jcms.exception.JsonDataException;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@Slf4j
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/${jcms.manager-path:system}/station/")
|
||||||
public class StationController extends BaseController<Station,String,StationRepository,StationService> {
|
public class StationController extends BaseController<Station,String,StationRepository,StationService> {
|
||||||
|
|
||||||
public StationController(StationService service) {
|
public StationController(StationService service) {
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
package net.jwsi.jcms_vpp.station;
|
package net.jwsi.jcms_vpp.station;
|
||||||
|
|
||||||
import net.jwsi.jcms.base.BaseRecStRepository;
|
import net.jwsi.jcms.base.BaseRecStRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
@Repository
|
||||||
public interface StationRepository extends BaseRecStRepository<Station,String> {
|
public interface StationRepository extends BaseRecStRepository<Station,String> {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,38 +1,60 @@
|
|||||||
package net.jwsi.jcms_vpp.station;
|
package net.jwsi.jcms_vpp.station;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.jwsi.jcms.base.BaseService;
|
import net.jwsi.jcms.base.BaseService;
|
||||||
import net.jwsi.jcms.base.EnumSqlType;
|
import net.jwsi.jcms.base.EnumSqlType;
|
||||||
import org.apache.coyote.Response;
|
import net.jwsi.jcms.utils.HttpUtil;
|
||||||
|
import net.jwsi.jcms.utils.LoginUtil;
|
||||||
|
import net.jwsi.jcms_vpp.Api.ApiResponse;
|
||||||
|
import net.jwsi.jcms_vpp.common.client.ApiClient;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
import org.springframework.web.client.RestClient;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
public class StationService extends BaseService<Station,String,StationRepository> {
|
public class StationService extends BaseService<Station,String,StationRepository> {
|
||||||
|
|
||||||
public StationService(StationRepository repository) {
|
private final ApiClient apiClient;
|
||||||
|
private final String API_TOKEN = System.getenv("API_TOKEN");
|
||||||
|
}
|
||||||
|
|
||||||
|
public StationService(StationRepository repository, ApiClient apiClient) {
|
||||||
super(repository);
|
super(repository);
|
||||||
|
this.apiClient = apiClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<StationDto> getStations() {
|
||||||
|
ApiResponse<List<StationDto>> response = apiClient.fetchStations("http://dev.jinwoosi.co.kr:8072/api/st/list", API_TOKEN);
|
||||||
|
|
||||||
|
if (response != null && Integer.valueOf(200).equals(response.getCode())) {
|
||||||
|
return response.getData(); // List<StationDto> 반환됨
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new RuntimeException("API호출 실패: " + response.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Integer getUserId() {
|
protected Integer getUserId() {
|
||||||
return null;
|
return HttpUtil.getUserId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getUserName(Integer id) {
|
protected String getUserName(Integer id) {
|
||||||
return null;
|
return LoginUtil.getUserName(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Station newSearchParam(Station station) {
|
protected Station newSearchParam(Station station) {
|
||||||
return null;
|
if (station == null) station = new Station();
|
||||||
|
return station;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected EnumSqlType useSqlTyp() {
|
protected EnumSqlType useSqlTyp() {
|
||||||
return null;
|
return EnumSqlType.SPECIFICATION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user