최초 커밋

master
mjkhan21 10 months ago
commit 2a7444b1fb

6
.gitignore vendored

@ -0,0 +1,6 @@
/.classpath
/.factorypath
/.project
/.settings/
/logs/
/target/

@ -0,0 +1,140 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>cokr.xit.interfaces</groupId>
<artifactId>xit-postplus</artifactId>
<version>23.04.01-SNAPSHOT</version>
<packaging>jar</packaging>
<name>xit-postplus</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>17</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
</properties>
<repositories>
<repository>
<id>mvn2s</id>
<url>https://repo1.maven.org/maven2/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>egovframe</id>
<url>https://maven.egovframe.go.kr/maven/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>maven-public</id>
<url>https://nas.xit.co.kr:8888/repository/maven-public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>cokr.xit.interfaces</groupId>
<artifactId>xit-filejob</artifactId>
<version>23.04.01-SNAPSHOT</version>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<directory>${basedir}/target</directory>
<finalName>${artifactId}-${version}</finalName>
<resources>
<resource><directory>${basedir}/src/main/resources</directory></resource>
</resources>
<testResources>
<testResource><directory>${basedir}/src/test/resources</directory></testResource>
<testResource><directory>${basedir}/src/main/resources</directory></testResource>
</testResources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<includes>
<include>**/*.class</include>
</includes>
</configuration>
</plugin>
<!-- EMMA -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<skipTests>true</skipTests>
<reportFormat>xml</reportFormat>
<excludes>
<exclude>**/Abstract*.java</exclude>
<exclude>**/*Suite.java</exclude>
</excludes>
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>emma-maven-plugin</artifactId>
<inherited>true</inherited>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Javadoc -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
</plugin>
</plugins>
</build>
<!-- Nexus deploy -->
<distributionManagement>
<snapshotRepository>
<id>maven-snapshot</id>
<url>https://nas.xit.co.kr:8888/repository/maven-snapshots/</url>
</snapshotRepository>
<repository>
<id>maven-release</id>
<url>https://nas.xit.co.kr:8888/repository/maven-releases/</url>
</repository>
</distributionManagement>
<!-- Nexus deploy -->
</project>

@ -0,0 +1,70 @@
package cokr.xit.interfaces.postplus;
import java.util.Collections;
import java.util.Map;
import org.springframework.core.io.ClassPathResource;
import cokr.xit.foundation.AbstractComponent;
import cokr.xit.foundation.data.JSON;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class Postplus extends AbstractComponent {
public static enum Service {
PST("PST"), SMS("SMS"), KKO("KKO");
private String code;
private Service(String code) {
this.code = code;
}
public String getCode() {
return this.code;
}
}
private static Postplus conf;
public static Postplus get() {
if (conf == null)
try {
ClassPathResource res = new ClassPathResource("intf-conf/xit-postplus.conf");
conf = new JSON().parse(res.getInputStream(), Postplus.class);
} catch (Exception e) {
throw runtimeException(e);
}
return conf;
}
private String
host,
version;
private boolean test;
private Map<String, String>
urls,
apiKeys;
public String getTest() {
return test ? "Y" : "N";
}
public String apiKey(String key) {
return !isEmpty(apiKeys) ? apiKeys.get(key) : null;
}
private Map<String, String> urls() {
return ifEmpty(urls, Collections::emptyMap);
}
public String requestProductionURL() {
return getHost() + urls().getOrDefault("requestProduction", "/po/api/postplusPstMsrApi.do");
}
public String productionStatusURL() {
return getHost() + urls().getOrDefault("productionStatus", "/po/api/postplusPstStatusApi.do");
}
}

@ -0,0 +1,59 @@
package cokr.xit.interfaces.postplus.post;
import java.io.InputStream;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
import cokr.xit.foundation.data.Named;
import cokr.xit.foundation.web.AbstractController;
import cokr.xit.interfaces.postplus.post.service.PostService;
import cokr.xit.interfaces.postplus.post.service.StatusResponse;
@RequestMapping(name = "포스트플러스 우편연계", value = "/intf/postplus/post", produces = MediaType.APPLICATION_JSON_VALUE)
public class PostController extends AbstractController {
@Resource(name = "postService")
private PostService postService;
/** .
* @param apiID apiKey
* @param master
* @param details
* @param attachments
* @return
*/
@PostMapping(name = "우편제작 신청", value = "/request")
public PostResponse requestProduction(
String apiID,
PstMsr.Master master,
List<PstMsr.Detail> details,
@RequestParam(required = false) List<MultipartFile> attachments
) {
List<Named<InputStream>> uploads = !isEmpty(attachments) ? attachments.stream()
.map(attached -> {
try {
return new Named<InputStream>(attached.getOriginalFilename(), attached.getInputStream());
} catch (Exception e) {
throw runtimeException(e);
}
})
.toList() : null;
return postService.requestProduction(apiID, master, details, uploads);
}
/** .
* @param apiID apiKey
* @param intfID
* @return
*/
@PostMapping(name = "신청우편 상태 조회", value = "/status")
public List<StatusResponse> getProductionStatus(String apiID, String intfID) {
return postService.getProductionStatus(apiID, intfID);
}
}

@ -0,0 +1,15 @@
package cokr.xit.interfaces.postplus.post;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class PostResponse {
@JsonProperty("결과")
private String result;
@JsonProperty("비고")
private String remark;
}

@ -0,0 +1,548 @@
package cokr.xit.interfaces.postplus.post;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.util.List;
import cokr.xit.foundation.AbstractComponent;
import cokr.xit.foundation.data.DataObject;
import cokr.xit.foundation.data.Named;
import cokr.xit.interfaces.postplus.Postplus;
/**
* @author mjkhan
*/
public class PstMsr extends AbstractComponent {
/**
* @author mjkhan
*/
public static class Master {
private static final List<String> cols = List.of(new String[] {
"버전", "테스트여부", "서비스", "연계식별키", "봉투",
"봉투창", "흑백칼라", "단면양면", "배달", "템플릿코드",
"템플릿출력여부", "수취인수", "여백생성유무", "주소페이지유무", "맞춤자제유무",
"메일머지유무", "동봉물유무", "반송여부", "스테이플러유무", "로고파일",
"발송인명", "발송인우편번호", "발송인주소", "발송인상세주소", "발송인전화번호"
});
/** 버전 */
private String version;
/** 테스트여부 */
private String testYN;
/** 서비스 */
private String service;
/** 연계식별키 */
private String intfID;
/** 봉투 */
private String envelop;
/** 봉투창 */
private String envelopWindow;
/** 흑백칼라 */
private String bwColor;
/** 단면양면 */
private String faceType;
/** 배달 */
private String delivery;
/** 템플릿코드 */
private String templateCode;
/** 템플릿출력여부 */
private String templatePrint;
/** 수취인수 */
private String recipientCount;
/** 여백생성유무 */
private String marginYN;
/** 주소페이지유무 */
private String addressPageYN;
/** 맞춤자제유무 */
private String orderYN;
/** 메일머지유무 */
private String mailMergeYN;
/** 동봉물유무 */
private String enclosedYN;
/** 반송여부 */
private String returnYN;
/** 스테이플러유무 */
private String staplerYN;
/** 로고파일 */
private String logoFile;
/** 발송인명 */
private String senderName;
/** 발송인우편번호 */
private String senderZipcode;
/** 발송인주소 */
private String senderAddress;
/** 발송인상세주소 */
private String senderDetailAddress;
/** 발송인전화번호 */
private String senderPhoneNo;
/** .
* @param version
* @return Master
*/
public Master setVersion(String version) {
this.version = version;
return this;
}
/** .
* @param testYN
* @return Master
*/
public Master setTestYN(String testYN) {
this.testYN = testYN;
return this;
}
/** .
* @param service
* @return Master
*/
public Master setService(String service) {
this.service = service;
return this;
}
/** .
* @param intfID
* @return Master
*/
public Master setIntfID(String intfID) {
this.intfID = intfID;
return this;
}
/** .
* @param envelop
* @return Master
*/
public Master setEnvelop(String envelop) {
this.envelop = envelop;
return this;
}
/** .
* @param envelopWindow
* @return Master
*/
public Master setEnvelopWindow(String envelopWindow) {
this.envelopWindow = envelopWindow;
return this;
}
/** .
* @param bwColor
* @return Master
*/
public Master setBwColor(String bwColor) {
this.bwColor = bwColor;
return this;
}
/** .
* @param faceType
* @return Master
*/
public Master setFaceType(String faceType) {
this.faceType = faceType;
return this;
}
/** .
* @param delivery
* @return Master
*/
public Master setDelivery(String delivery) {
this.delivery = delivery;
return this;
}
/**릿 .
* @param templateCode 릿
* @return Master
*/
public Master setTemplateCode(String templateCode) {
this.templateCode = templateCode;
return this;
}
/**릿 .
* @param templatePrint 릿
* @return Master
*/
public Master setTemplatePrint(String templatePrint) {
this.templatePrint = templatePrint;
return this;
}
/** .
* @param recipientCount
* @return Master
*/
public Master setRecipientCount(String recipientCount) {
this.recipientCount = recipientCount;
return this;
}
/** .
* @param marginYN
* @return Master
*/
public Master setMarginYN(String marginYN) {
this.marginYN = marginYN;
return this;
}
/** .
* @param addressPageYN
* @return Master
*/
public Master setAddressPageYN(String addressPageYN) {
this.addressPageYN = addressPageYN;
return this;
}
/** .
* @param orderYN
* @return Master
*/
public Master setOrderYN(String orderYN) {
this.orderYN = orderYN;
return this;
}
/** .
* @param mailMergeYN
* @return Master
*/
public Master setMailMergeYN(String mailMergeYN) {
this.mailMergeYN = mailMergeYN;
return this;
}
/** .
* @param enclosedYN
* @return Master
*/
public Master setEnclosedYN(String enclosedYN) {
this.enclosedYN = enclosedYN;
return this;
}
/** .
* @param returnYN
* @return Master
*/
public Master setReturnYN(String returnYN) {
this.returnYN = returnYN;
return this;
}
/** .
* @param staplerYN
* @return Master
*/
public Master setStaplerYN(String staplerYN) {
this.staplerYN = staplerYN;
return this;
}
/** .
* @param logoFile
* @return Master
*/
public Master setLogoFile(String logoFile) {
this.logoFile = logoFile;
return this;
}
/** .
* @param senderName
* @return Master
*/
public Master setSenderName(String senderName) {
this.senderName = senderName;
return this;
}
/** .
* @param senderZipcode
* @return Master
*/
public Master setSenderZipcode(String senderZipcode) {
this.senderZipcode = senderZipcode;
return this;
}
/** .
* @param senderAddress
* @return Master
*/
public Master setSenderAddress(String senderAddress) {
this.senderAddress = senderAddress;
return this;
}
/** .
* @param senderDetailAddress
* @return Master
*/
public Master setSenderDetailAddress(String senderDetailAddress) {
this.senderDetailAddress = senderDetailAddress;
return this;
}
/** .
* @param senderPhoneNo
* @return Master
*/
public Master setSenderPhoneNo(String senderPhoneNo) {
this.senderPhoneNo = senderPhoneNo;
return this;
}
/** .
* @return
*/
public DataObject toRequest() {
List<String> row = List.of(new String[] {
ifEmpty(version, Postplus.get()::getVersion),
ifEmpty(testYN, Postplus.get()::getTest),
ifEmpty(service, Postplus.Service.PST::getCode),
blankIfEmpty(intfID),
blankIfEmpty(envelop),
blankIfEmpty(envelopWindow),
blankIfEmpty(bwColor),
blankIfEmpty(faceType),
blankIfEmpty(delivery),
blankIfEmpty(templateCode),
blankIfEmpty(templatePrint),
blankIfEmpty(recipientCount),
blankIfEmpty(marginYN),
blankIfEmpty(addressPageYN),
blankIfEmpty(orderYN),
blankIfEmpty(mailMergeYN),
blankIfEmpty(enclosedYN),
blankIfEmpty(returnYN),
blankIfEmpty(staplerYN),
blankIfEmpty(logoFile),
blankIfEmpty(senderName),
blankIfEmpty(senderZipcode),
blankIfEmpty(senderAddress),
blankIfEmpty(senderDetailAddress),
blankIfEmpty(senderPhoneNo)
});
return new DataObject()
.set("cols", cols)
.set("rows", row);
}
}
/**
* @author mjkhan
*/
public static class Detail {
private static final List<String> cols = List.of(new String[] {
"순번", "이름", "우편번호", "주소", "상세주소",
"전화번호", "첨부파일", "가변1", "가변2", "가변3", "가변4"
});
public static DataObject toRequest(List<Detail> details) {
List<List<String>> rows = details.stream()
.map(Detail::toRow)
.toList();
return new DataObject()
.set("cols", cols)
.set("rows", rows);
}
/** 순번 */
private String seq;
/** 이름 */
private String name;
/** 우편번호 */
private String zipcode;
/** 주소 */
private String address;
/** 상세주소 */
private String detailAddress;
/** 전화번호 */
private String phoneNo;
/** 첨부파일 */
private String attachment;
/** 가변1 */
private String reserved1;
/** 가변2 */
private String reserved2;
/** 가변3 */
private String reserved3;
/** 가변4 */
private String reserved4;
/** .
* @param seq
* @return Detail
*/
public Detail setSeq(String seq) {
this.seq = seq;
return this;
}
/** .
* @param name
* @return Detail
*/
public Detail setName(String name) {
this.name = name;
return this;
}
/** .
* @param zipcode
* @return Detail
*/
public Detail setZipcode(String zipcode) {
this.zipcode = zipcode;
return this;
}
/** .
* @param address
* @return Detail
*/
public Detail setAddress(String address) {
this.address = address;
return this;
}
/** .
* @param detailAddress
* @return Detail
*/
public Detail setDetailAddress(String detailAddress) {
this.detailAddress = detailAddress;
return this;
}
/** .
* @param phoneNo
* @return Detail
*/
public Detail setPhoneNo(String phoneNo) {
this.phoneNo = phoneNo;
return this;
}
/** .
* @param attachment
* @return Detail
*/
public Detail setAttachment(String attachment) {
this.attachment = attachment;
return this;
}
/**1 .
* @param reserved1 1
* @return Detail
*/
public Detail setReserved1(String reserved1) {
this.reserved1 = reserved1;
return this;
}
/**2 .
* @param reserved2 2
* @return Detail
*/
public Detail setReserved2(String reserved2) {
this.reserved2 = reserved2;
return this;
}
/**3 .
* @param reserved3 3
* @return Detail
*/
public Detail setReserved3(String reserved3) {
this.reserved3 = reserved3;
return this;
}
/**4 .
* @param reserved4 4
* @return Detail
*/
public Detail setReserved4(String reserved4) {
this.reserved4 = reserved4;
return this;
}
/** .
* @return
*/
public List<String> toRow() {
return List.of(new String[] {
blankIfEmpty(seq),
blankIfEmpty(name),
blankIfEmpty(zipcode),
blankIfEmpty(address),
blankIfEmpty(detailAddress),
blankIfEmpty(phoneNo),
blankIfEmpty(attachment),
blankIfEmpty(reserved1),
blankIfEmpty(reserved2),
blankIfEmpty(reserved3),
blankIfEmpty(reserved4)
});
}
}
/** {@code Named<InputStream>} .
* @param file
* @return {@code Named<InputStream>}
*/
public static Named<InputStream> toNamedInputStream(File file) {
try {
return new Named<InputStream>(file.getName(), new FileInputStream(file));
} catch (Exception e) {
throw runtimeException(e);
}
}
private Master master;
private List<Detail> details;
/** .
* @param master
* @return PstMsr
*/
public PstMsr setMaster(Master master) {
this.master = master;
return this;
}
/** .
* @param details
* @return PstMsr
*/
public PstMsr setDetails(List<Detail> details) {
int size = details != null ? details.size() : 0;
for (int i = 0; i < size; ++i)
details.get(i).setSeq(Integer.toString(i + 1));
this.details = details;
return this;
}
/** .
* @return
*/
public DataObject toRequest() {
return new DataObject()
.set("master", master.toRequest())
.set("detail", Detail.toRequest(details));
}
}

@ -0,0 +1,29 @@
package cokr.xit.interfaces.postplus.post.service;
import java.io.InputStream;
import java.util.List;
import cokr.xit.foundation.data.Named;
import cokr.xit.interfaces.postplus.post.PostResponse;
import cokr.xit.interfaces.postplus.post.PstMsr;
/**
* @author mjkhan
*/
public interface PostService {
/** .
* @param apiID apiKey
* @param master
* @param details
* @param attachments
* @return
*/
PostResponse requestProduction(String apiID, PstMsr.Master master, List<PstMsr.Detail> details, List<Named<InputStream>> attachments);
/** .
* @param apiID apiKey
* @param intfID
* @return
*/
List<StatusResponse> getProductionStatus(String apiID, String intfID);
}

@ -0,0 +1,37 @@
package cokr.xit.interfaces.postplus.post.service;
import java.util.List;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonProperty;
import cokr.xit.interfaces.postplus.post.PostResponse;
import lombok.Getter;
import lombok.Setter;
@Getter
@Setter
public class StatusResponse extends PostResponse {
@JsonProperty("신청일자")
private String reqDate;
@JsonProperty("봉투")
private String envelop;
@JsonProperty("배달")
private String delivery;
@JsonProperty("흑백칼라")
private String bwColor;
@JsonProperty("단면양면")
private String faceType;
@JsonProperty("발송건수")
private String sendCount;
@JsonProperty("상태")
private String status;
@JsonProperty("시작등기번호")
private String startRegNo;
@JsonProperty("종료등기번호")
private String endRegNo;
@JsonProperty("연계식별키")
private String intfID;
@JsonProperty("순번등기번호")
private List<Map<String, String>> sortedRegNos;
}

@ -0,0 +1,83 @@
package cokr.xit.interfaces.postplus.post.service.bean;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.net.http.HttpResponse;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import org.springframework.stereotype.Service;
import com.fasterxml.jackson.core.type.TypeReference;
import cokr.xit.foundation.component.AbstractServiceBean;
import cokr.xit.foundation.data.DataObject;
import cokr.xit.foundation.data.JSON;
import cokr.xit.foundation.data.Named;
import cokr.xit.foundation.web.WebClient;
import cokr.xit.interfaces.postplus.Postplus;
import cokr.xit.interfaces.postplus.post.PostResponse;
import cokr.xit.interfaces.postplus.post.PstMsr;
import cokr.xit.interfaces.postplus.post.service.PostService;
import cokr.xit.interfaces.postplus.post.service.StatusResponse;
@Service("postService")
public class PostServiceBean extends AbstractServiceBean implements PostService {
private static String apiKey(String apiID) {
return Postplus.get().apiKey(apiID);
}
private JSON json = new JSON();
@Override
public PostResponse requestProduction(String apiID, PstMsr.Master master, List<PstMsr.Detail> details, List<Named<InputStream>> attachments) {
DataObject pstMsr = new PstMsr()
.setMaster(master)
.setDetails(details)
.toRequest();
String str = json.stringify(pstMsr, true);
log().debug("production request:\n{}", str);
Named<InputStream> pstFile = new Named<>("pstFile.json", new ByteArrayInputStream(str.getBytes(StandardCharsets.UTF_8)));
ArrayList<Named<InputStream>> files = new ArrayList<>();
files.add(pstFile);
files.addAll(ifEmpty(attachments, Collections::emptyList));
try {
HttpResponse<String> hresp = new WebClient().upload(req ->
req.uri(Postplus.get().requestProductionURL())
.data("apiKey", apiKey(apiID))
.data("pstFile", files)
);
String body = hresp.body();
log().debug("response:\n{}", body);
return json.parse(body, PostResponse.class);
} finally {
files.forEach(file -> {
try {
file.getValue().close();
} catch (Exception e) {
throw runtimeException(e);
}
});
}
}
@Override
public List<StatusResponse> getProductionStatus(String apiID, String intfID) {
HttpResponse<String> hresp = new WebClient().post(req ->
req.uri(Postplus.get().productionStatusURL())
.json(json)
.data("apiKey", apiKey(apiID))
.data("inputCode", intfID)
);
String body = hresp.body();
log().debug("response:\n{}", body);
return json.parse(body, new TypeReference<List<StatusResponse>>() {});
}
}

@ -0,0 +1,15 @@
{
"host": "https://t.postplus.co.kr", /* API 서비스 호스트 */
"version": "v1.10",
/* API 키 */
"apiKeys": {
"site0": "00197D16F7FE4A84E9C97F55033339FBE07C8850882FFA26F3E538E0DDF0DB1EFEEC3DB451AE1EE011776DEB1505120A556942FA98240AADD3A73F085313AF693545931B338D1B92365F5B1A8AEBC939E33"
}
/*
, "test": true
"urls": { // 지정하지 않으면 디폴트 URL 사용
"requestProduction": "우편제작 신청 URL",
"productionStatus": "신청우편 상태조회 URL"
}
*/
}

@ -0,0 +1,90 @@
package cokr.xit.interfaces.postplus.post.service;
import java.util.List;
import javax.annotation.Resource;
import org.junit.jupiter.api.Test;
import cokr.xit.foundation.test.TestSupport;
import cokr.xit.interfaces.postplus.Postplus;
import cokr.xit.interfaces.postplus.post.PostResponse;
import cokr.xit.interfaces.postplus.post.PstMsr;
public class PostServiceTest extends TestSupport {
@Resource(name = "postService")
private PostService postService;
private String apiID = "site0";
@Test
void postplus() {
Postplus conf = Postplus.get();
System.out.println("host: " + conf.getHost());
System.out.println("apiKeys: " + conf.getApiKeys());
System.out.println("version: " + conf.getVersion());
System.out.println("test: " + conf.getTest());
System.out.println("requestProductionURL: " + conf.requestProductionURL());
System.out.println("productionStatusURL: " + conf.productionStatusURL());
}
@Test
void requestProduction() {
PstMsr.Master master = new PstMsr.Master()
.setTestYN("Y")
.setIntfID("POST20230428_000001")
.setEnvelop("소봉투")
.setEnvelopWindow("이중창")
.setBwColor("흑백")
.setFaceType("단면")
.setDelivery("일반")
.setTemplateCode("")
.setTemplatePrint("N")
.setRecipientCount("2")
.setMarginYN("N")
.setAddressPageYN("N")
.setOrderYN("N")
.setMailMergeYN("N")
.setEnclosedYN("N")
.setReturnYN("N")
.setStaplerYN("N")
.setLogoFile("N")
.setSenderName("포스토피아")
.setSenderZipcode("5048")
.setSenderAddress("서울특별시 광진구 강변역로2")
.setSenderDetailAddress("서울광진우체국 B동 4층")
.setSenderPhoneNo("1577-8114");
List<PstMsr.Detail> details = List.of(
new PstMsr.Detail()
.setName("홍길동1")
.setZipcode("31010")
.setAddress("서울특별시 광진구 강변역로2")
.setDetailAddress("서울광진우체국 B동 1층")
.setPhoneNo("1012341234")
.setAttachment("pstFile.pdf")
.setReserved1("24926737")
.setReserved2("2021-09-02")
.setReserved3("대출(고정)")
.setReserved4("31,000,000"),
new PstMsr.Detail()
.setName("홍길동2")
.setZipcode("08394")
.setAddress("서울특별시 광진구 강변역로2")
.setDetailAddress("서울광진우체국 B동 2층")
.setPhoneNo("01012341234")
.setAttachment("pstFile.pdf")
.setReserved1("25685047")
.setReserved2("2021-09-02")
.setReserved3("대출B(고정)")
.setReserved4("421,000,000")
);
PostResponse resp = postService.requestProduction(apiID, master, details, null);
}
@Test
void productionStatus() {
}
}

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
<context:component-scan base-package="cokr.xit">
<context:include-filter type="annotation" expression="org.springframework.stereotype.Component"/>
<context:include-filter type="annotation" expression="org.springframework.stereotype.Service"/>
<context:include-filter type="annotation" expression="org.springframework.stereotype.Repository"/>
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
<bean id="antPathMatcher" class="org.springframework.util.AntPathMatcher" />
<bean id="messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
<property name="basenames">
<list>
<value>classpath:message/message-common</value>
<value>classpath:message/authentication-message</value>
<value>classpath:org/egovframe/rte/fdl/property/messages/properties</value>
</list>
</property>
<property name="defaultEncoding" value="UTF-8"/>
<property name="cacheSeconds">
<value>60</value>
</property>
</bean>
<bean id="objectMapper" class="com.fasterxml.jackson.databind.ObjectMapper">
<property name="dateFormat" ref="dateFormat"/>
</bean>
<bean id="dateFormat" class="java.text.SimpleDateFormat">
<constructor-arg index="0" value="yyyy-MM-dd HH:mm"/>
</bean>
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.SessionLocaleResolver">
<property name="defaultLocale" value="ko_KR"/>
</bean>
<bean name="propertyService" class="org.egovframe.rte.fdl.property.impl.EgovPropertyServiceImpl" destroy-method="destroy">
<property name="properties">
<map>
<entry key="tempDir" value="D:/workspace/temp"/>
<entry key="pageUnit" value="10"/>
<entry key="pageSize" value="10"/>
</map>
</property>
<property name="extFileName">
<set>
<map>
<entry key="encoding" value="UTF-8"/>
<entry key="filename" value="classpath*:properties/disabled-parking.properties"/>
</map>
</set>
</property>
</bean>
<bean id="leaveaTrace" class="org.egovframe.rte.fdl.cmmn.trace.LeaveaTrace" />
</beans>

@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
">
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
<property name="driverClassName" value="net.sf.log4jdbc.sql.jdbcapi.DriverSpy"/>
<property name="url" value="jdbc:log4jdbc:mariadb://localhost:3306/xit-base?useUnicode=true&amp;characterEncoding=utf8&amp;serverTimezone=Asia/Seoul&amp;useSSL=false" />
<property name="username" value="root"/>
<property name="password" value="mjkhan"/>
</bean>
<bean id="databaseIdProvider" class="org.apache.ibatis.mapping.VendorDatabaseIdProvider">
<property name="properties">
<props>
<prop key="Oracle">oracle</prop>
<prop key="MariaDB">mariadb</prop>
</props>
</property>
</bean>
<bean id="sqlSession" class="org.mybatis.spring.SqlSessionFactoryBean"
p:dataSource-ref="dataSource"
p:configLocation="classpath:sql/mybatis-config.xml"
p:mapperLocations="classpath:sql/mapper/**/*.xml"
p:databaseIdProvider-ref="databaseIdProvider"/>
<bean id="mapperConfigurer" class="org.egovframe.rte.psl.dataaccess.mapper.MapperConfigurer">
<property name="basePackage" value="cokr.xit" />
<property name="sqlSessionFactoryBeanName" value="sqlSession"/>
</bean>
<bean id="txManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>
<tx:advice id="txAdvice" transaction-manager="txManager">
<tx:attributes>
<tx:method name="*" rollback-for="Exception"/>
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="serviceMethod" expression="execution(* cokr.xit..service.bean.*ServiceBean.*(..))" />
<aop:pointcut id="requiredTx" expression="execution(* cokr.xit..service.bean.*ServiceBean.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="requiredTx" />
</aop:config>
</beans>

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cokr.xit.foundation.test.TestMapper">
<insert id="insert" parameterType="map">${sql}</insert>
<update id="update" parameterType="map">${sql}</update>
<delete id="delete" parameterType="map">${sql}</delete>
<update id="commit">COMMIT</update>
</mapper>

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<setting name="mapUnderscoreToCamelCase" value="false"/>
<setting name="cacheEnabled" value="false" />
<setting name="jdbcTypeForNull" value="NULL" />
<setting name="callSettersOnNulls" value="true"/>
</settings>
<typeAliases>
<typeAlias alias="egovMap" type="org.egovframe.rte.psl.dataaccess.util.EgovMap"/>
<typeAlias alias="dataobject" type="cokr.xit.foundation.data.DataObject"/>
</typeAliases>
<typeHandlers>
<typeHandler handler="cokr.xit.foundation.data.RowValueHandler" javaType="java.lang.Object"/>
</typeHandlers>
<plugins>
<plugin interceptor="cokr.xit.foundation.data.paging.MapperSupport" />
</plugins>
</configuration>
Loading…
Cancel
Save