|
@@ -41,51 +41,59 @@ public class TscFreegiftService {
|
|
|
*/
|
|
*/
|
|
|
public Collection<Order> getOrderFreegift(Order order) {
|
|
public Collection<Order> getOrderFreegift(Order order) {
|
|
|
|
|
|
|
|
|
|
+ Collection<Order> freegiftGoodsApplyValList = null;
|
|
|
|
|
+
|
|
|
// 1. 장바구니 담긴 상품으로 적용된 사은품 프로모션 정보 조회 (with 상품금액)
|
|
// 1. 장바구니 담긴 상품으로 적용된 사은품 프로모션 정보 조회 (with 상품금액)
|
|
|
Collection<Order> fregiftGoodsApplyAmtList = freegiftDao.getFreeGiftGoodsApplyAmt(order);
|
|
Collection<Order> fregiftGoodsApplyAmtList = freegiftDao.getFreeGiftGoodsApplyAmt(order);
|
|
|
|
|
|
|
|
- int[] freegiftSqArr = new int[fregiftGoodsApplyAmtList.size()];
|
|
|
|
|
-
|
|
|
|
|
- int i = 0;
|
|
|
|
|
-
|
|
|
|
|
- // 사은품시퀀스(FREEGIFT_SQ), 사은품시퀀스합계금액(FREEGIFT_AMT)
|
|
|
|
|
- for (Order fregiftGoodsApplyAmt : fregiftGoodsApplyAmtList) {
|
|
|
|
|
- freegiftSqArr[i] = fregiftGoodsApplyAmt.getFreegiftSq();
|
|
|
|
|
- i++;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- order.setFreegiftSqArr(freegiftSqArr);
|
|
|
|
|
-
|
|
|
|
|
- // 2. 사은품 적용구간 정보 조회
|
|
|
|
|
- Collection<Order> freegiftGoodsApplySectionList = freegiftDao.getFreeGiftGoodsApplySection(order);
|
|
|
|
|
-
|
|
|
|
|
- int[] freegiftSectionSqArr = new int[fregiftGoodsApplyAmtList.size()];
|
|
|
|
|
-
|
|
|
|
|
- int tempFreegiftSectionSq = 0;
|
|
|
|
|
- int k = 0;
|
|
|
|
|
-
|
|
|
|
|
- // 사은품시퀀스(FREEGIFT_SQ), 사은품시퀀스합계금액(FREEGIFT_AMT)
|
|
|
|
|
- for (Order fregiftGoodsApplyAmt : fregiftGoodsApplyAmtList) {
|
|
|
|
|
- int freegiftAmt = fregiftGoodsApplyAmt.getFreegiftAmt();
|
|
|
|
|
|
|
+ // 1.1 장바구니 상품으로 적용된 사은품 여부 판단
|
|
|
|
|
+ if (fregiftGoodsApplyAmtList.size() > 0) {
|
|
|
|
|
+ int[] freegiftSqArr = new int[fregiftGoodsApplyAmtList.size()];
|
|
|
|
|
|
|
|
- // 사은풐구간시퀀스(FREEGIFT_SECTION_SQ, 사은품시퀀스(FREEGIFT_SQ), 사은풐구간금액(SECTION_VAL)
|
|
|
|
|
- for (Order freegiftGoodsApplySection : freegiftGoodsApplySectionList) {
|
|
|
|
|
- int freegiftSectionSq = freegiftGoodsApplySection.getFreegiftSectionSq();
|
|
|
|
|
- int sectionVal = freegiftGoodsApplySection.getSectionVal();
|
|
|
|
|
|
|
+ int i = 0;
|
|
|
|
|
+
|
|
|
|
|
+ // 사은품시퀀스(FREEGIFT_SQ), 사은품시퀀스합계금액(FREEGIFT_AMT)
|
|
|
|
|
+ for (Order fregiftGoodsApplyAmt : fregiftGoodsApplyAmtList) {
|
|
|
|
|
+ freegiftSqArr[i] = fregiftGoodsApplyAmt.getFreegiftSq();
|
|
|
|
|
+ i++;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ order.setFreegiftSqArr(freegiftSqArr);
|
|
|
|
|
+
|
|
|
|
|
+ // 2. 사은품 적용구간 정보 조회
|
|
|
|
|
+ Collection<Order> freegiftGoodsApplySectionList = freegiftDao.getFreeGiftGoodsApplySection(order);
|
|
|
|
|
+
|
|
|
|
|
+ // 2.1 사은품 적용구간이 있는지 판단
|
|
|
|
|
+ if (fregiftGoodsApplyAmtList.size() > 0) {
|
|
|
|
|
+ int[] freegiftSectionSqArr = new int[fregiftGoodsApplyAmtList.size()];
|
|
|
|
|
+
|
|
|
|
|
+ int tempFreegiftSectionSq = 0;
|
|
|
|
|
+ int k = 0;
|
|
|
|
|
|
|
|
- if (freegiftAmt > sectionVal) {
|
|
|
|
|
- tempFreegiftSectionSq = freegiftSectionSq;
|
|
|
|
|
- } else {
|
|
|
|
|
- freegiftSectionSqArr[k] = tempFreegiftSectionSq;
|
|
|
|
|
- k++;
|
|
|
|
|
|
|
+ // 사은품시퀀스(FREEGIFT_SQ), 사은품시퀀스합계금액(FREEGIFT_AMT)
|
|
|
|
|
+ for (Order fregiftGoodsApplyAmt : fregiftGoodsApplyAmtList) {
|
|
|
|
|
+ int freegiftAmt = fregiftGoodsApplyAmt.getFreegiftAmt();
|
|
|
|
|
+
|
|
|
|
|
+ // 사은풐구간시퀀스(FREEGIFT_SECTION_SQ, 사은품시퀀스(FREEGIFT_SQ), 사은풐구간금액(SECTION_VAL)
|
|
|
|
|
+ for (Order freegiftGoodsApplySection : freegiftGoodsApplySectionList) {
|
|
|
|
|
+ int freegiftSectionSq = freegiftGoodsApplySection.getFreegiftSectionSq();
|
|
|
|
|
+ int sectionVal = freegiftGoodsApplySection.getSectionVal();
|
|
|
|
|
+
|
|
|
|
|
+ if (freegiftAmt > sectionVal) {
|
|
|
|
|
+ tempFreegiftSectionSq = freegiftSectionSq;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ freegiftSectionSqArr[k] = tempFreegiftSectionSq;
|
|
|
|
|
+ k++;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ // 3. 사은품 적용구간 의 적용 사은품정보조회
|
|
|
|
|
+ order.setFreegiftSectionSqArr(freegiftSectionSqArr);
|
|
|
|
|
+ freegiftGoodsApplyValList = freegiftDao.getFreeGiftGoodsApplyVal(order);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 3. 사은품 적용구간 의 적용 사은품정보조회
|
|
|
|
|
- order.setFreegiftSectionSqArr(freegiftSectionSqArr);
|
|
|
|
|
- Collection<Order> freegiftGoodsApplyValList = freegiftDao.getFreeGiftGoodsApplyVal(order);
|
|
|
|
|
-
|
|
|
|
|
return freegiftGoodsApplyValList;
|
|
return freegiftGoodsApplyValList;
|
|
|
}
|
|
}
|
|
|
|
|
|