|
@@ -251,16 +251,13 @@ public class OrderHandler {
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ Integer num[] = new Integer[0];
|
|
|
if(toothKidsbrush > 0){
|
|
|
- addFullReduction(5,cartDtos);
|
|
|
+ addFullReduction(5,cartDtos,num);
|
|
|
}
|
|
|
if(toothAuthbrush > 0 || toothKidsbrush > 0){
|
|
|
- addFullReduction(1,cartDtos);
|
|
|
+ num = new Integer[]{toothKidsbrush+toothAuthbrush};
|
|
|
+ addFullReduction(1,cartDtos,num);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -324,7 +321,7 @@ public class OrderHandler {
|
|
|
}
|
|
|
String[] brushelEls = brushelEment.split("-");
|
|
|
for(String brushelEl : brushelEls){
|
|
|
- if(cartDto.getProductType().equals(Integer.valueOf(brushelEl))){
|
|
|
+ if(cartDto.getCartProductId().equals(Integer.valueOf(brushelEl))){
|
|
|
brushFlag += cartDto.getCartNum();
|
|
|
}
|
|
|
}
|
|
@@ -552,15 +549,13 @@ public class OrderHandler {
|
|
|
|
|
|
|
|
|
if (activityDate.isStatus()) {
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ Integer num[] = new Integer[0];
|
|
|
if(toothKidsbrush > 0){
|
|
|
- addFullReduction(5,cartDtos);
|
|
|
+ addFullReduction(5,cartDtos,num);
|
|
|
}
|
|
|
if(toothAuthbrush > 0 || toothKidsbrush > 0){
|
|
|
- addFullReduction(1,cartDtos);
|
|
|
+ num = new Integer[]{toothKidsbrush+toothAuthbrush};
|
|
|
+ addFullReduction(1,cartDtos,num);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -673,7 +668,7 @@ public class OrderHandler {
|
|
|
|
|
|
String[] brushelEls = brushelEment.split("-");
|
|
|
for(String brushelEl : brushelEls){
|
|
|
- if(cartDto.getProductType().equals(Integer.valueOf(brushelEl)) && cartDto.getCartProductId() != 310){
|
|
|
+ if(cartDto.getCartProductId().equals(Integer.valueOf(brushelEl))){
|
|
|
brush1Flag = true;
|
|
|
brush2Flag = true;
|
|
|
|
|
@@ -1097,25 +1092,25 @@ public class OrderHandler {
|
|
|
* @param cartDtos
|
|
|
* @return
|
|
|
*/
|
|
|
- private void addFullReduction(Integer type, List<CartDto> cartDtos){
|
|
|
+ private void addFullReduction(Integer type, List<CartDto> cartDtos,Integer num[]){
|
|
|
switch (type){
|
|
|
case 5 :
|
|
|
- addCartDtos(cartDtos,322);
|
|
|
- break;
|
|
|
- case 4 :
|
|
|
- addCartDtos(cartDtos,314);
|
|
|
- addCartDtos(cartDtos,321);
|
|
|
- break;
|
|
|
- case 3 :
|
|
|
- addCartDtos(cartDtos,314);
|
|
|
- addCartDtos(cartDtos,315);
|
|
|
- break;
|
|
|
- case 2 :
|
|
|
- addCartDtos(cartDtos,314);
|
|
|
- addCartDtos(cartDtos,322);
|
|
|
+ addCartDtos(cartDtos,322,1);
|
|
|
break;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
case 1 :
|
|
|
- addCartDtos(cartDtos,314);
|
|
|
+ addCartDtos(cartDtos,314,num[0]);
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
@@ -1127,7 +1122,7 @@ public class OrderHandler {
|
|
|
* @param
|
|
|
* @return
|
|
|
*/
|
|
|
- private void addCartDtos(List<CartDto> cartDtos,Integer id){
|
|
|
+ private void addCartDtos(List<CartDto> cartDtos,Integer id,Integer num){
|
|
|
boolean flag = false;
|
|
|
for (CartDto cartDto : cartDtos) {
|
|
|
if(id.equals(cartDto.getCartColorId())){
|
|
@@ -1135,7 +1130,7 @@ public class OrderHandler {
|
|
|
}
|
|
|
}
|
|
|
if(!flag){
|
|
|
- CartDto cd = getGiftCartDtos(id);
|
|
|
+ CartDto cd = getGiftCartDtos(id,num);
|
|
|
cartDtos.add(cd);
|
|
|
}
|
|
|
}
|
|
@@ -1145,7 +1140,7 @@ public class OrderHandler {
|
|
|
* @param colorId
|
|
|
* @return
|
|
|
*/
|
|
|
- private CartDto getGiftCartDtos(Integer colorId){
|
|
|
+ private CartDto getGiftCartDtos(Integer colorId,Integer num){
|
|
|
CartDto cartDto = new CartDto();
|
|
|
Product product = productInfoService.selectProductByColorId(colorId);
|
|
|
if((product.getColorSoldNum()+1) > product.getColorAllNum()){
|
|
@@ -1154,7 +1149,7 @@ public class OrderHandler {
|
|
|
cartDto.setCartId(1);
|
|
|
cartDto.setCartProductId(product.getProductId());
|
|
|
cartDto.setCartColorId(colorId);
|
|
|
- cartDto.setCartNum(1);
|
|
|
+ cartDto.setCartNum(num);
|
|
|
cartDto.setProductName(product.getProductName());
|
|
|
cartDto.setProductType(product.getProductTypeId());
|
|
|
cartDto.setProductPrice(product.getColorDiscount());
|