|
|
@@ -9,8 +9,6 @@ import java.util.Comparator;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
|
|
|
-import com.style24.front.biz.thirdparty.EigeneaiApi;
|
|
|
-import com.style24.persistence.domain.eigene.Eigeneai;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.core.env.Environment;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
@@ -23,7 +21,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
-import com.gagaframework.web.parameter.GagaMap;
|
|
|
import com.style24.core.biz.service.TscKcpService;
|
|
|
import com.style24.core.biz.service.TscOrderService;
|
|
|
import com.style24.core.support.env.TscConstants;
|
|
|
@@ -32,6 +29,7 @@ import com.style24.front.biz.service.TsfCartService;
|
|
|
import com.style24.front.biz.service.TsfCouponService;
|
|
|
import com.style24.front.biz.service.TsfGoodsService;
|
|
|
import com.style24.front.biz.service.TsfOrderService;
|
|
|
+import com.style24.front.biz.thirdparty.EigeneaiApi;
|
|
|
import com.style24.front.support.controller.TsfBaseController;
|
|
|
import com.style24.front.support.security.session.TsfSession;
|
|
|
import com.style24.persistence.domain.Cart;
|
|
|
@@ -39,9 +37,13 @@ import com.style24.persistence.domain.Coupon;
|
|
|
import com.style24.persistence.domain.Goods;
|
|
|
import com.style24.persistence.domain.Login;
|
|
|
import com.style24.persistence.domain.Order;
|
|
|
+import com.style24.persistence.domain.eigene.Eigeneai;
|
|
|
+import com.style24.persistence.domain.eigene.Item;
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
+import com.gagaframework.web.parameter.GagaMap;
|
|
|
+
|
|
|
/**
|
|
|
* 장바구니 Controller
|
|
|
*
|
|
|
@@ -90,7 +92,7 @@ public class TsfCartController extends TsfBaseController {
|
|
|
public ModelAndView cartListForm() {
|
|
|
ModelAndView mav = new ModelAndView();
|
|
|
Cart cart = new Cart();
|
|
|
- if(TsfSession.isLogin()) {
|
|
|
+ if (TsfSession.isLogin()) {
|
|
|
cart.setCustNo(TsfSession.getInfo().getCustNo());
|
|
|
} else {
|
|
|
cart.setCustNo(0);
|
|
|
@@ -98,14 +100,14 @@ public class TsfCartController extends TsfBaseController {
|
|
|
}
|
|
|
|
|
|
Collection<Cart> cartList = cartService.getAllCartList(cart);
|
|
|
- if(cartList != null && cartList.size() > 0) {
|
|
|
+ if (cartList != null && cartList.size() > 0) {
|
|
|
// 장바구니 상품이 있을 경우
|
|
|
Collection<Eigeneai.Result> itemList = eigeneaiApi.getRelatedGoodsList(cartList, 20);
|
|
|
mav.addObject("recomGoodsList", itemList);
|
|
|
mav.addObject("cartSize", cartList.size());
|
|
|
} else {
|
|
|
// 장바구니 상품이 없을 경우
|
|
|
- Collection<Eigeneai.Item> itemList = eigeneaiApi.getRealtimeViewGoodsList(20);
|
|
|
+ Collection<Item> itemList = eigeneaiApi.getRealtimeViewGoodsList(20);
|
|
|
mav.addObject("recomGoodsList", itemList);
|
|
|
mav.addObject("cartSize", 0);
|
|
|
}
|
|
|
@@ -139,7 +141,7 @@ public class TsfCartController extends TsfBaseController {
|
|
|
public GagaMap createCart(@RequestBody Collection<Cart> params) {
|
|
|
GagaMap result = cartService.saveCartInfo(params);
|
|
|
String cartGb = String.valueOf(result.get("cartGb"));
|
|
|
- if("C".equals(cartGb) || cartGb.equals(TscConstants.CartGb.CART.value())) {
|
|
|
+ if ("C".equals(cartGb) || cartGb.equals(TscConstants.CartGb.CART.value())) {
|
|
|
cartService.deleteOldCart();
|
|
|
}
|
|
|
|
|
|
@@ -153,20 +155,20 @@ public class TsfCartController extends TsfBaseController {
|
|
|
int shotCanYn = coreOrderService.getDailyDeliveryCheck(param);
|
|
|
|
|
|
// 10시 이전에만 총알 배송 가능 여부 체크
|
|
|
- if(shotCanYn == 1) {
|
|
|
- SimpleDateFormat format = new SimpleDateFormat ( "MM/dd");
|
|
|
+ if (shotCanYn == 1) {
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("MM/dd");
|
|
|
Date time = new Date();
|
|
|
|
|
|
param.setShotCanYn("Y");
|
|
|
param.setShotDelvDt(format.format(time));
|
|
|
} else {
|
|
|
- SimpleDateFormat format = new SimpleDateFormat ( "MM/dd");
|
|
|
+ SimpleDateFormat format = new SimpleDateFormat("MM/dd");
|
|
|
Date time = new Date();
|
|
|
param.setShotCanYn("N");
|
|
|
param.setShotDelvDt(format.format(time));
|
|
|
}
|
|
|
|
|
|
- if(param.getShotDelvUseYn() == null) {
|
|
|
+ if (param.getShotDelvUseYn() == null) {
|
|
|
param.setShotDelvUseYn(param.getShotCanYn());
|
|
|
}
|
|
|
|
|
|
@@ -210,21 +212,21 @@ public class TsfCartController extends TsfBaseController {
|
|
|
|
|
|
// 수량 및 금액 다다익선 최소 조건 조회
|
|
|
DecimalFormat format = new DecimalFormat("###,###");
|
|
|
- List<Order> tmtbSalesValueList = (ArrayList<Order>) cartService.selectTmtbSalesValueList(param);
|
|
|
+ List<Order> tmtbSalesValueList = (ArrayList<Order>)cartService.selectTmtbSalesValueList(param);
|
|
|
// 조건 멘트 적용
|
|
|
List<StringBuilder> tmtbDcDescList = new ArrayList<StringBuilder>();
|
|
|
- for(Order tmtbDcValue : tmtbSalesValueList) {
|
|
|
- if(!StringUtils.isEmpty(tmtbDcValue.getDefaultYn()) && "Y".equals(tmtbDcValue.getDefaultYn())) {
|
|
|
+ for (Order tmtbDcValue : tmtbSalesValueList) {
|
|
|
+ if (!StringUtils.isEmpty(tmtbDcValue.getDefaultYn()) && "Y".equals(tmtbDcValue.getDefaultYn())) {
|
|
|
StringBuilder tmtbDcDesc = new StringBuilder();
|
|
|
- if(TscConstants.ApplyGb.QTY.value().equals(tmtbDcValue.getSectionGb())) {
|
|
|
+ if (TscConstants.ApplyGb.QTY.value().equals(tmtbDcValue.getSectionGb())) {
|
|
|
tmtbDcDesc.append(tmtbDcValue.getSectionVal()).append("개 이상 구매시 ");
|
|
|
} else if (TscConstants.ApplyGb.AMT.value().equals(tmtbDcValue.getSectionGb())) {
|
|
|
tmtbDcDesc.append(format.format(tmtbDcValue.getSectionVal())).append("원 이상 구매시 ");
|
|
|
}
|
|
|
|
|
|
- if(TscConstants.DcWay.AMT.value().equals(tmtbDcValue.getDcWay())) {
|
|
|
+ if (TscConstants.DcWay.AMT.value().equals(tmtbDcValue.getDcWay())) {
|
|
|
tmtbDcDesc.append(format.format(tmtbDcValue.getDcVal())).append("원 할인");
|
|
|
- } else if(TscConstants.DcWay.RATE.value().equals(tmtbDcValue.getDcWay())) {
|
|
|
+ } else if (TscConstants.DcWay.RATE.value().equals(tmtbDcValue.getDcWay())) {
|
|
|
tmtbDcDesc.append(tmtbDcValue.getDcVal()).append("% 할인");
|
|
|
}
|
|
|
|
|
|
@@ -254,7 +256,7 @@ public class TsfCartController extends TsfBaseController {
|
|
|
@PostMapping("/login/info")
|
|
|
public Login selectLoginInfo(Order param) {
|
|
|
Login result = new Login();
|
|
|
- if(TsfSession.isLogin()) {
|
|
|
+ if (TsfSession.isLogin()) {
|
|
|
result = TsfSession.getInfo();
|
|
|
} else {
|
|
|
result.setCustNo(0);
|
|
|
@@ -343,7 +345,7 @@ public class TsfCartController extends TsfBaseController {
|
|
|
|
|
|
result = cartService.updateCartOption(param);
|
|
|
|
|
|
- if("SUCCESS".equals(result.get("status"))) {
|
|
|
+ if ("SUCCESS".equals(result.get("status"))) {
|
|
|
result.put("message", message.getMessage("SUCC_0009"));
|
|
|
}
|
|
|
|
|
|
@@ -392,7 +394,7 @@ public class TsfCartController extends TsfBaseController {
|
|
|
cart.setImgPath1(env.getProperty("upload.goods.view"));
|
|
|
|
|
|
// 현재 주문 가능 수량순으로 정렬
|
|
|
- Collections.sort((ArrayList<Order>) cart.getDelvAllCartList(), new Comparator<Order>() {
|
|
|
+ Collections.sort((ArrayList<Order>)cart.getDelvAllCartList(), new Comparator<Order>() {
|
|
|
@Override
|
|
|
public int compare(Order c1, Order c2) {
|
|
|
return c1.getOrdCanQty() - c2.getOrdCanQty();
|
|
|
@@ -401,28 +403,28 @@ public class TsfCartController extends TsfBaseController {
|
|
|
});
|
|
|
|
|
|
List<Order> cartList = new ArrayList<>();
|
|
|
- for(Order oneData : cart.getDelvAllCartList()) {
|
|
|
- if(oneData.getOrdCanQty() < 6 && oneData.getOrdCanQty() > 0) {
|
|
|
+ for (Order oneData : cart.getDelvAllCartList()) {
|
|
|
+ if (oneData.getOrdCanQty() < 6 && oneData.getOrdCanQty() > 0) {
|
|
|
cartList.add(oneData);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
// 장바구니 등록 최신순 정렬
|
|
|
- Collections.sort((ArrayList<Order>) cart.getDelvAllCartList(), new Comparator<Order>() {
|
|
|
+ Collections.sort((ArrayList<Order>)cart.getDelvAllCartList(), new Comparator<Order>() {
|
|
|
@Override
|
|
|
public int compare(Order c1, Order c2) {
|
|
|
return c2.getCartSq() - c1.getCartSq(); //역순 정렬
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- for(Order oneData : cart.getDelvAllCartList()) {
|
|
|
- if(oneData.getOrdCanQty() > 5) {
|
|
|
+ for (Order oneData : cart.getDelvAllCartList()) {
|
|
|
+ if (oneData.getOrdCanQty() > 5) {
|
|
|
cartList.add(oneData);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- for(Order oneData : cart.getDelvAllCartList()) {
|
|
|
- if(oneData.getOrdCanQty() < 1) {
|
|
|
+ for (Order oneData : cart.getDelvAllCartList()) {
|
|
|
+ if (oneData.getOrdCanQty() < 1) {
|
|
|
cartList.add(oneData);
|
|
|
}
|
|
|
}
|
|
|
@@ -454,7 +456,7 @@ public class TsfCartController extends TsfBaseController {
|
|
|
public Goods selectTmtbSalesGoodsOptCd(@RequestBody Goods param) {
|
|
|
Collection<Goods> goodsList = cartService.selectTmtbSalesGoodsOptCd(param);
|
|
|
Goods result = new Goods();
|
|
|
- for(Goods goods : goodsList) {
|
|
|
+ for (Goods goods : goodsList) {
|
|
|
result = goods; // goodsList는 상품정보 1라인만 조회됨
|
|
|
}
|
|
|
|