|
@@ -199,7 +199,11 @@ public class OrderHandler {
|
|
return msg;
|
|
return msg;
|
|
}
|
|
}
|
|
|
|
|
|
- Integer toothbrush = 0; //牙刷个数
|
|
|
|
|
|
+ Integer toothAllbrush = 0; //牙刷个数
|
|
|
|
+ Integer toothAuthbrush = 0; //成人牙刷个数
|
|
|
|
+ Integer toothKidsbrush = 0; //儿童牙刷个数
|
|
|
|
+
|
|
|
|
+ Integer allAmount = 0; //总金额
|
|
|
|
|
|
/*上朵分销,查看是否为分销*/
|
|
/*上朵分销,查看是否为分销*/
|
|
for (CartDto cd : cartDtos) {
|
|
for (CartDto cd : cartDtos) {
|
|
@@ -214,8 +218,15 @@ public class OrderHandler {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if(cd.getProductType() == 100){ //当订单中有电动牙刷时,+1
|
|
if(cd.getProductType() == 100){ //当订单中有电动牙刷时,+1
|
|
- toothbrush += cd.getCartNum();
|
|
|
|
|
|
+ toothAllbrush += cd.getCartNum();
|
|
|
|
+ }
|
|
|
|
+ if(cd.getColorToothType() == 2){ //牙刷分类 1:非牙刷,非刷头 2:成人牙刷 3:儿童牙刷 4:亲子款(成人+儿童) 5:刷头
|
|
|
|
+ toothAuthbrush += cd.getCartNum();
|
|
|
|
+ }else if(cd.getColorToothType() == 3){
|
|
|
|
+ toothKidsbrush += cd.getCartNum();
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ allAmount += cd.getCartNum()*cd.getProductPrice();
|
|
}
|
|
}
|
|
|
|
|
|
ActivityDate activityDate = activityUtil.doubleTwelve();
|
|
ActivityDate activityDate = activityUtil.doubleTwelve();
|
|
@@ -224,38 +235,36 @@ public class OrderHandler {
|
|
}else{
|
|
}else{
|
|
//非分销渠道,才能有促销
|
|
//非分销渠道,才能有促销
|
|
if(activityDate.isStatus()){
|
|
if(activityDate.isStatus()){
|
|
- if(toothbrush > 3){ //三支以上
|
|
|
|
- CartDto cd1 = getGiftCartDtos(316); //保温杯
|
|
|
|
- if(cd1 != null){
|
|
|
|
- cartDtos.add(cd1);
|
|
|
|
- }
|
|
|
|
- CartDto cd2 = getGiftCartDtos(315);//漱口水
|
|
|
|
- if(cd2 != null){
|
|
|
|
- cartDtos.add(cd2);
|
|
|
|
- }
|
|
|
|
- }else if(toothbrush > 2){ //三支牙刷
|
|
|
|
- CartDto cd1 = getGiftCartDtos(316); //保温杯
|
|
|
|
- if(cd1 != null){
|
|
|
|
- cartDtos.add(cd1);
|
|
|
|
- }
|
|
|
|
- }else if(toothbrush > 1){
|
|
|
|
- CartDto cd2 = getGiftCartDtos(315);//漱口水
|
|
|
|
- if(cd2 != null){
|
|
|
|
- cartDtos.add(cd2);
|
|
|
|
- }
|
|
|
|
- }else if(toothbrush > 0){
|
|
|
|
- CartDto cd3 = getGiftCartDtos(314);//牙膏
|
|
|
|
- if(cd3 != null){
|
|
|
|
- cartDtos.add(cd3);
|
|
|
|
|
|
+
|
|
|
|
+ /*计算促销之后的支付金额*/
|
|
|
|
+ Integer promotionAmout = allAmount; //促销之后的金额
|
|
|
|
+
|
|
|
|
+ SalesActivities sa = new SalesActivities();
|
|
|
|
+ sa.setSalesActivitiesStatus(1);
|
|
|
|
+ sa.setSalesActivitiesType(1);
|
|
|
|
+ sa.setSalesActivitiesScenes(1);
|
|
|
|
+ List<SalesActivities> salesActivitiesList = salesActivitiesService.getSalesActivitiesList(sa);
|
|
|
|
+ activityDate.setSalesActivitiesList(salesActivitiesList);
|
|
|
|
+ for (SalesActivities salesActivities : activityDate.getSalesActivitiesList()){
|
|
|
|
+ if(promotionAmout >= salesActivities.getSalesActivitiesFull()){
|
|
|
|
+ promotionAmout = allAmount - salesActivities.getSalesActivitiesReduction();
|
|
|
|
+ break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+// 1、买任意成人款牙刷送进口艾科弗牙膏
|
|
|
|
+// 2、买任意儿童款牙刷(普通、派火车款,亲子款)加送儿童护齿书籍(进口艾科弗牙膏+儿童护齿书籍)
|
|
|
|
+// 3、满499送进口艾科弗牙膏+进口Ora2漱口水(按实际支付金额)
|
|
|
|
+// 4、满699元送进口艾科弗牙膏+MAC口红(按实际支付金额)
|
|
|
|
+ if(promotionAmout > 69900){
|
|
|
|
+ addFullReduction(4,cartDtos);
|
|
|
|
+ }else if(promotionAmout > 49900){
|
|
|
|
+ addFullReduction(3,cartDtos);
|
|
|
|
+ }else if(toothKidsbrush > 0){
|
|
|
|
+ addFullReduction(2,cartDtos);
|
|
|
|
+ }else if(toothAuthbrush > 0){
|
|
|
|
+ addFullReduction(1,cartDtos);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- SalesActivities salesActivities = new SalesActivities();
|
|
|
|
- salesActivities.setSalesActivitiesStatus(1);
|
|
|
|
- salesActivities.setSalesActivitiesType(1);
|
|
|
|
- salesActivities.setSalesActivitiesScenes(1);
|
|
|
|
- List<SalesActivities> salesActivitiesList = salesActivitiesService.getSalesActivitiesList(salesActivities);
|
|
|
|
- activityDate.setSalesActivitiesList(salesActivitiesList);
|
|
|
|
}
|
|
}
|
|
dto.setActivityDate(activityDate);
|
|
dto.setActivityDate(activityDate);
|
|
}else if("2".equals(isCustomize)){
|
|
}else if("2".equals(isCustomize)){
|
|
@@ -506,53 +515,60 @@ public class OrderHandler {
|
|
cartDtos = cartService.selectCartItemByListId(cartId);
|
|
cartDtos = cartService.selectCartItemByListId(cartId);
|
|
|
|
|
|
|
|
|
|
- Integer toothbrush = 0;
|
|
|
|
|
|
+ Integer toothAllbrush = 0; //牙刷个数
|
|
|
|
+ Integer toothAuthbrush = 0; //成人牙刷个数
|
|
|
|
+ Integer toothKidsbrush = 0; //儿童牙刷个数
|
|
|
|
+ Integer allAmount = 0; //总金额
|
|
|
|
+
|
|
|
|
|
|
for (CartDto cd : cartDtos) {
|
|
for (CartDto cd : cartDtos) {
|
|
if(cd.getProductType() == 100){ //当订单中有电动牙刷时,+1
|
|
if(cd.getProductType() == 100){ //当订单中有电动牙刷时,+1
|
|
- toothbrush += cd.getCartNum();
|
|
|
|
|
|
+ toothAllbrush += cd.getCartNum();
|
|
}
|
|
}
|
|
|
|
+ if(cd.getColorToothType() == 2){ //牙刷分类 1:非牙刷,非刷头 2:成人牙刷 3:儿童牙刷 4:亲子款(成人+儿童) 5:刷头
|
|
|
|
+ toothAuthbrush += cd.getCartNum();
|
|
|
|
+ }else if(cd.getColorToothType() == 3){
|
|
|
|
+ toothKidsbrush += cd.getCartNum();
|
|
|
|
+ }
|
|
|
|
+ allAmount += cd.getCartNum()*cd.getProductPrice();
|
|
}
|
|
}
|
|
|
|
|
|
if(temp.getChannelType() > 0 && temp.getChannelId() > 0){
|
|
if(temp.getChannelType() > 0 && temp.getChannelId() > 0){
|
|
activityDate.setStatus(false);
|
|
activityDate.setStatus(false);
|
|
}else {
|
|
}else {
|
|
|
|
+ /*计算促销之后的支付金额*/
|
|
|
|
+ Integer promotionAmout = allAmount; //促销之后的金额
|
|
|
|
+
|
|
|
|
+ SalesActivities sa = new SalesActivities();
|
|
|
|
+ sa.setSalesActivitiesStatus(1);
|
|
|
|
+ sa.setSalesActivitiesType(1);
|
|
|
|
+ sa.setSalesActivitiesScenes(1);
|
|
|
|
+ List<SalesActivities> salesActivitiesList = salesActivitiesService.getSalesActivitiesList(sa);
|
|
|
|
+ activityDate.setSalesActivitiesList(salesActivitiesList);
|
|
|
|
+ for (SalesActivities salesActivities : activityDate.getSalesActivitiesList()){
|
|
|
|
+ if(promotionAmout >= salesActivities.getSalesActivitiesFull()){
|
|
|
|
+ promotionAmout = allAmount - salesActivities.getSalesActivitiesReduction();
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
//非分销渠道,才能有促销
|
|
//非分销渠道,才能有促销
|
|
if (activityDate.isStatus()) {
|
|
if (activityDate.isStatus()) {
|
|
- if (toothbrush > 3) { //三支以上
|
|
|
|
- CartDto cd1 = getGiftCartDtos(316); //保温杯
|
|
|
|
- if (cd1 != null) {
|
|
|
|
- cartDtos.add(cd1);
|
|
|
|
- }
|
|
|
|
- CartDto cd2 = getGiftCartDtos(315);//漱口水
|
|
|
|
- if (cd2 != null) {
|
|
|
|
- cartDtos.add(cd2);
|
|
|
|
- }
|
|
|
|
- } else if (toothbrush > 2) { //三支牙刷
|
|
|
|
- CartDto cd1 = getGiftCartDtos(316); //保温杯
|
|
|
|
- if (cd1 != null) {
|
|
|
|
- cartDtos.add(cd1);
|
|
|
|
- }
|
|
|
|
- } else if (toothbrush > 1) {
|
|
|
|
- CartDto cd2 = getGiftCartDtos(315);//漱口水
|
|
|
|
- if (cd2 != null) {
|
|
|
|
- cartDtos.add(cd2);
|
|
|
|
- }
|
|
|
|
- } else if (toothbrush > 0) {
|
|
|
|
- CartDto cd3 = getGiftCartDtos(314);//牙膏
|
|
|
|
- if (cd3 != null) {
|
|
|
|
- cartDtos.add(cd3);
|
|
|
|
- }
|
|
|
|
|
|
+// 1、买任意成人款牙刷送进口艾科弗牙膏
|
|
|
|
+// 2、买任意儿童款牙刷(普通、派火车款,亲子款)加送儿童护齿书籍(进口艾科弗牙膏+儿童护齿书籍)
|
|
|
|
+// 3、满499送进口艾科弗牙膏+进口Ora2漱口水(按实际支付金额)
|
|
|
|
+// 4、满699元送进口艾科弗牙膏+MAC口红(按实际支付金额)
|
|
|
|
+ if(promotionAmout > 69900){
|
|
|
|
+ addFullReduction(4,cartDtos);
|
|
|
|
+ }else if(promotionAmout > 49900){
|
|
|
|
+ addFullReduction(3,cartDtos);
|
|
|
|
+ }else if(toothKidsbrush > 0){
|
|
|
|
+ addFullReduction(2,cartDtos);
|
|
|
|
+ }else if(toothAuthbrush > 0){
|
|
|
|
+ addFullReduction(1,cartDtos);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- SalesActivities salesActivities = new SalesActivities();
|
|
|
|
- salesActivities.setSalesActivitiesStatus(1);
|
|
|
|
- salesActivities.setSalesActivitiesType(1);
|
|
|
|
- salesActivities.setSalesActivitiesScenes(1);
|
|
|
|
- List<SalesActivities> salesActivitiesList = salesActivitiesService.getSalesActivitiesList(salesActivities);
|
|
|
|
- activityDate.setSalesActivitiesList(salesActivitiesList);
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
}else if("2".equals(temp.getIsCustomize())){
|
|
}else if("2".equals(temp.getIsCustomize())){
|
|
Integer id = Integer.valueOf(temp.getCartIdStr());
|
|
Integer id = Integer.valueOf(temp.getCartIdStr());
|
|
CustomizedTooth customizedTooth = customizedToothService.getCustomizedToothById(id);
|
|
CustomizedTooth customizedTooth = customizedToothService.getCustomizedToothById(id);
|
|
@@ -1076,6 +1092,45 @@ public class OrderHandler {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * 满赠
|
|
|
|
+ 1、买任意成人款牙刷送进口艾科弗牙膏
|
|
|
|
+ 2、买任意儿童款牙刷(普通、派火车款,亲子款)加送儿童护齿书籍(进口艾科弗牙膏+儿童护齿书籍)
|
|
|
|
+ 3、满499送进口艾科弗牙膏+进口Ora2漱口水(按实际支付金额)
|
|
|
|
+ 4、满699元送进口艾科弗牙膏+MAC口红(按实际支付金额)
|
|
|
|
+ * @param type
|
|
|
|
+ * @param cartDtos
|
|
|
|
+ * @return
|
|
|
|
+ */
|
|
|
|
+ private void addFullReduction(Integer type, List<CartDto> cartDtos){
|
|
|
|
+ switch (type){
|
|
|
|
+ case 4 :
|
|
|
|
+ CartDto cd3 = getGiftCartDtos(314);//牙膏
|
|
|
|
+ CartDto cd4 = getGiftCartDtos(321);//MAC口红
|
|
|
|
+ cartDtos.add(cd3);
|
|
|
|
+ cartDtos.add(cd4);
|
|
|
|
+ break;
|
|
|
|
+ case 3 :
|
|
|
|
+ CartDto cd5 = getGiftCartDtos(314);//牙膏
|
|
|
|
+ CartDto cd6 = getGiftCartDtos(315);//漱口水
|
|
|
|
+ cartDtos.add(cd5);
|
|
|
|
+ cartDtos.add(cd6);
|
|
|
|
+ break;
|
|
|
|
+ case 2 :
|
|
|
|
+ CartDto cd7 = getGiftCartDtos(314);//牙膏
|
|
|
|
+ CartDto cd8 = getGiftCartDtos(322);//儿童护齿书籍
|
|
|
|
+ cartDtos.add(cd7);
|
|
|
|
+ cartDtos.add(cd8);
|
|
|
|
+ break;
|
|
|
|
+ case 1 :
|
|
|
|
+ CartDto cd9 = getGiftCartDtos(314);//牙膏
|
|
|
|
+ cartDtos.add(cd9);
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
* 获取赠品信息
|
|
* 获取赠品信息
|
|
* @param colorId
|
|
* @param colorId
|
|
* @return
|
|
* @return
|