소스정리
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package net.jwsi.jcms.vpp.api;
|
package net.jwsi.jcms.vpp.api;
|
||||||
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import net.jwsi.jcms.vpp.charger.Chgr;
|
||||||
import net.jwsi.jcms.vpp.provider.ProviderDto;
|
import net.jwsi.jcms.vpp.provider.ProviderDto;
|
||||||
import net.jwsi.jcms.vpp.station.StationDto;
|
import net.jwsi.jcms.vpp.station.StationDto;
|
||||||
import org.springframework.core.ParameterizedTypeReference;
|
import org.springframework.core.ParameterizedTypeReference;
|
||||||
@@ -44,4 +45,17 @@ public class ApiClient {
|
|||||||
.retrieve()
|
.retrieve()
|
||||||
.body(new ParameterizedTypeReference<ApiResponse<List<ProviderDto>>>() {});
|
.body(new ParameterizedTypeReference<ApiResponse<List<ProviderDto>>>() {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ApiResponse<List<Chgr>> fetchChgr(String baseUrl, String token) {
|
||||||
|
URI uri = UriComponentsBuilder.fromUriString(baseUrl)
|
||||||
|
.path("/api/charge/list")
|
||||||
|
.build()
|
||||||
|
.toUri();
|
||||||
|
|
||||||
|
return restClient.post()
|
||||||
|
.uri(uri)
|
||||||
|
.header("Authorization", "Bearer " + token)
|
||||||
|
.retrieve()
|
||||||
|
.body(new ParameterizedTypeReference<ApiResponse<List<Chgr>>>() {});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package net.jwsi.jcms.vpp.charger;
|
||||||
|
|
||||||
|
import jakarta.persistence.Entity;
|
||||||
|
import jakarta.persistence.Id;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import net.jwsi.jcms.base.BaseStEntity;
|
||||||
|
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@ToString
|
||||||
|
@Entity(name = "vpp_chgr")
|
||||||
|
public class Chgr extends BaseStEntity {
|
||||||
|
@Id
|
||||||
|
private String chgrId; //충전기 id(pk)
|
||||||
|
private String providerId; //충전사업자 id(pk) @Id
|
||||||
|
private String stId; //충전소 id(pk) @Id
|
||||||
|
private String stNm; //충전소 명
|
||||||
|
private String chgrNm; //충전기 명
|
||||||
|
private String speedTpCd; //충전기속도 코드
|
||||||
|
private String chgrTypeCd; //충전기타입 코드
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package net.jwsi.jcms.vpp.charger;
|
||||||
|
|
||||||
|
import net.jwsi.jcms.base.BaseController;
|
||||||
|
import net.jwsi.jcms.exception.JsonDataException;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class ChgrController extends BaseController<Chgr,String,ChgrRepository,ChgrService> {
|
||||||
|
|
||||||
|
|
||||||
|
public ChgrController(ChgrService service) {
|
||||||
|
super(service);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void chkSelectList(List list) throws JsonDataException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void chkSelect(Chgr data) throws JsonDataException {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package net.jwsi.jcms.vpp.charger;
|
||||||
|
|
||||||
|
import net.jwsi.jcms.base.BaseRecStRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public interface ChgrRepository extends BaseRecStRepository<Chgr,String> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package net.jwsi.jcms.vpp.charger;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.jwsi.jcms.base.BaseService;
|
||||||
|
import net.jwsi.jcms.base.EnumSqlType;
|
||||||
|
import net.jwsi.jcms.utils.HttpUtil;
|
||||||
|
import net.jwsi.jcms.utils.LoginUtil;
|
||||||
|
import net.jwsi.jcms.vpp.api.ApiClient;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.data.domain.Page;
|
||||||
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class ChgrService extends BaseService<Chgr,String,ChgrRepository> {
|
||||||
|
|
||||||
|
private final ApiClient apiClient;
|
||||||
|
@Value("${jcms.api.base-url}")
|
||||||
|
private String baseUrl;
|
||||||
|
|
||||||
|
@Value("${jcms.api.token}")
|
||||||
|
private String apiToken;
|
||||||
|
public ChgrService(ChgrRepository repository, ApiClient apiClient) {
|
||||||
|
super(repository);
|
||||||
|
this.apiClient = apiClient;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Integer getUserId() {
|
||||||
|
return HttpUtil.getUserId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected String getUserName(Integer id) {
|
||||||
|
return LoginUtil.getUserName(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Chgr newSearchParam(Chgr chgr) {
|
||||||
|
if(chgr == null){ chgr = new Chgr();}
|
||||||
|
return chgr;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected EnumSqlType useSqlTyp() {
|
||||||
|
return EnumSqlType.SPECIFICATION;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Specification<Chgr> getSpecification(Chgr chgr) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Page<Chgr> _selectPage(Chgr chgr) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected List<Chgr> _selectList(Chgr chgr) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
package net.jwsi.jcms.vpp.charger;
|
||||||
|
|
||||||
|
public class ChgrSpecification {
|
||||||
|
}
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package net.jwsi.jcms.vpp.charger;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class ResponseDto {
|
||||||
|
private String providerId;
|
||||||
|
private String stId;
|
||||||
|
private String stNm;
|
||||||
|
private String chgrId;
|
||||||
|
private String chgrNm;
|
||||||
|
private String speedTp;
|
||||||
|
private String chgrType;
|
||||||
|
private double gpsXpos;
|
||||||
|
private double gpsYpos;
|
||||||
|
private String locInfo;
|
||||||
|
private String memshOnly;
|
||||||
|
private String installYy;
|
||||||
|
private String simulRechg;
|
||||||
|
private String simulChgrId;
|
||||||
|
|
||||||
|
public Chgr toEntity(){
|
||||||
|
Chgr chgr = new Chgr();
|
||||||
|
chgr.setChgrId(this.chgrId);
|
||||||
|
chgr.setStId(this.stId);
|
||||||
|
chgr.setStNm(this.stNm);
|
||||||
|
chgr.setChgrNm(this.chgrNm);
|
||||||
|
chgr.setSpeedTpCd(this.speedTp);
|
||||||
|
chgr.setChgrTypeCd(this.chgrType);
|
||||||
|
return chgr;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,7 +9,6 @@ import org.springframework.web.bind.annotation.PostMapping;
|
|||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.ResponseBody;
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -28,6 +27,7 @@ public class StationController extends BaseController<Station,String,StationRepo
|
|||||||
|
|
||||||
@GetMapping("list")
|
@GetMapping("list")
|
||||||
public String list() {
|
public String list() {
|
||||||
|
stationService.getStations();
|
||||||
return path + "list";
|
return path + "list";
|
||||||
}
|
}
|
||||||
@PostMapping("list.json")
|
@PostMapping("list.json")
|
||||||
|
|||||||
Reference in New Issue
Block a user