POS 시스템 소스 코드
Prof. Jong Min Lee이(가) 24일 전에 추가함
UP1~ UP4 강의 자료에 나오는 산출물에 기반하여 만든 POS 시스템 소스 코드입니다.
강의 자료 보면서 참고하기 바랍니다.
첨부한 mvn_wrapper.zip 파일에 있는 파일과 폴더를 PosSystem 폴더에 복사하면
mvn 명령을 사용할 수 있습니다. packate goal을 사용하여 JAR 파일을 만들 수 있습니다.
$ .\mvnw clean package
JAR 파일 만들 때 pom.xml에 아래의 빌드 관련 정보가 추가되어야 합니다.
<!-- fat JAR 생성 -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>deu.se.possystem.PosSystem</mainClass> <!-- 메인 클래스 지정 -->
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
이렇게 해서 JAR 파일이 만들어지면 아래와 같이 실행 가능합니다.
PS F:\temp\PosSystem> java -jar .\target\PosSystem-1.0-SNAPSHOT.jar data = {A0001=[새우깡, 1200], A0002=[우유, 1000], A0003=[단팥빵, 2500]} ps = ProductSpecification{description=새우깡, price=1200, itemId=A0001} ps = ProductSpecification{description=우유, price=1000, itemId=A0002} ps = ProductSpecification{description=단팥빵, price=2500, itemId=A0003} [R001: C01-홍길동] 판매를 시작합니다. [R001: C01-홍길동] 물품 ID = A0001, 개수 = 1 [R001: C01-홍길동] 제품 명세 = ProductSpecification{description=새우깡, price=1200, itemId=A0001} [R001: C01-홍길동] 물품 ID = A0002, 개수 = 2 [R001: C01-홍길동] 제품 명세 = ProductSpecification{description=우유, price=1000, itemId=A0002} [R001: C01-홍길동] 물품 ID = A0003, 개수 = 1 [R001: C01-홍길동] 제품 명세 = ProductSpecification{description=단팥빵, price=2500, itemId=A0003} [R001: C01-홍길동] 판매를 종료합니다. [R001: C01-홍길동] 총액: 5700 [ : C01-홍길동] 고객이 신용 카드로 지불하려고 합니다.. [ : C01-홍길동] Payment = Payment{method=CREDIT CARD, amount=5700, dateTime=2025-05-21T08:54:07.423603100} 종료된 Sale 정보를 저장합니다. 종료된 Sale 정보 = [Sale{items=[ SalesLineItem{productSpec=ProductSpecification{description=새우깡, price=1200, itemId=A0001}, quantity=1}, SalesLineItem{productSpec=ProductSpecification{description=우유, price=1000, itemId=A0002}, quantity=2}, SalesLineItem{productSpec=ProductSpecification{description=단팥빵, price=2500, itemId=A0003}, quantity=1}], casherId=C01-홍길동, dateTime=2025-05-21T08:54:07.400603600, isComplete=true, totalAmount=5700, p=Payment{method=CREDIT CARD, amount=5700, dateTime=2025-05-21T08:54:07.423603100}} ] PS F:\temp\PosSystem>