Sfoglia il codice sorgente

下单改使用供应商税率

zhijiezhao 1 anno fa
parent
commit
7898d487dd

+ 0 - 43
src/main/java/com/caimei365/order/service/impl/OrderClubServiceImpl.java

@@ -595,7 +595,6 @@ public class OrderClubServiceImpl implements OrderClubService {
             return ResponseJson.error("订单异常!", null);
         }
         Date date = new Date();
-        String curDateStr = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss")).format(date);
         String note = "【取消订单】";
         // 余额退回原账户
         if (null != shopOrder.getAccountAmount() && MathUtil.compare(shopOrder.getAccountAmount(), 0) > 0) {
@@ -632,17 +631,6 @@ public class OrderClubServiceImpl implements OrderClubService {
                 }
             });
         }
-        //推送信息中心-取消订单
-        /*MessageCenter messageCenter = new MessageCenter();
-        messageCenter.setShopID(null);
-        messageCenter.setClubID(order.getClubId());
-        messageCenter.setUserType(1);
-        messageCenter.setMessageType(1);
-        messageCenter.setOrderMessageType(4);
-        messageCenter.setOrderID(orderId);
-        messageCenter.setContent("您的订单已成功取消!");
-        messageCenter.setTime(curDateStr);
-        orderClubMapper.addMessageCenter(messageCenter);*/
         // 子订单状态
         List<Integer> shopOrderStatus = orderClubMapper.getShopOrderStatus(shopOrder.getOrderId());
         boolean flag = false;
@@ -666,37 +654,6 @@ public class OrderClubServiceImpl implements OrderClubService {
             int beans = userBeans + beansHistory.getNum();
             productService.updateUserBeans(beansHistory, beans, note);
         }
-//        if (shopOrder.getTotalAmount() != null && shopOrder.getTotalAmount() < 1000) {
-//            //查本单是否扣豆子,有就返回
-//            UserBeansHistoryPo bean = baseMapper.findLowOrder(shopOrder.getShopOrderId());
-//            if (bean != null) {
-//                //有扣豆子记录
-//                UserBeansHistoryPo beansHistory = new UserBeansHistoryPo();
-//                beansHistory.setUserId(shopOrder.getUserId());
-//                beansHistory.setOrderId(shopOrder.getShopOrderId());
-//                beansHistory.setBeansType(16);
-//                beansHistory.setType(1);
-//                beansHistory.setNum(500);
-//                beansHistory.setPushStatus(0);
-//                beansHistory.setAddTime(date);
-//                beansHistory.setDelFlag(0);
-//                int beans = baseMapper.getUserBeans(shopOrder.getUserId()) + 500;
-//                productService.updateUserBeans(beansHistory, beans, note);
-//            }
-//        }
-        //取消订单短信推送(取消推送)
-        /*if (orderClubMapper.getProductOrder(orderId).contains(6060)) {
-            String bindMobile = baseMapper.getBindMobileByUserId(order.getUserId());
-            if (StringUtils.isNotBlank(bindMobile)) {
-                String shortLink = remoteCallService.getShortLink(8, 11, domain + "/user/order/detail.html?orderId=" + orderId);
-                String content = "您已成功取消订单(订单编号:" + order.getOrderNo() + "),订单金额¥" + order.getPayTotalFee() + "。您可关注采美公众号或者访问采美微信小程序和网站查看订单。" +
-                        "平台公众号:微信搜索“采美365网”; 微信小程序:微信搜索“采美采购商城”;网址:www.caimei365.com/t/" + shortLink;
-                boolean sendSms = remoteCallService.getSendSms(1, 11, bindMobile, content);
-                if (!sendSms) {
-                    log.info("取消订单推送失败,orderId>>>>" + orderId);
-                }
-            }
-        }*/
         // 客服确认注册机构,一天内取消有效
         Integer clubStatus = baseMapper.getClubStatus(shopOrder.getUserId());
         if (null != clubStatus && 94 == clubStatus) {

+ 23 - 23
src/main/java/com/caimei365/order/service/impl/SubmitServiceImpl.java

@@ -625,8 +625,8 @@ public class SubmitServiceImpl implements SubmitService {
                     Double productTax = 0d;
                     Double discountTax = 0d;
                     if (taxFlag) {
-                        productTax = MathUtil.div(MathUtil.mul(productPrice, product.getTaxRate()), 100, 2).doubleValue();
-                        discountTax = MathUtil.div(MathUtil.mul(discountPrice, product.getTaxRate()), 100, 2).doubleValue();
+                        productTax = MathUtil.div(MathUtil.mul(productPrice, product.getShopTaxRate()), 100, 2).doubleValue();
+                        discountTax = MathUtil.div(MathUtil.mul(discountPrice, product.getShopTaxRate()), 100, 2).doubleValue();
                     } else if (!Integer.valueOf(1).equals(product.getIncludedTax())) {
                         // 不含税不可开票商品和未知商品,税率置为0
                         product.setTaxRate(0d);
@@ -634,8 +634,8 @@ public class SubmitServiceImpl implements SubmitService {
                     log.info("促销赠品计算:productTax===" + productTax);
                     // 商品价格
                     if (Integer.valueOf(0).equals(product.getIncludedTax())) {
-                        if (null != product.getTaxRate() && product.getTaxRate() > 0d) {
-                            product.setPrice(MathUtil.add(productPrice, MathUtil.mul(productPrice, MathUtil.div(product.getTaxRate(), 100, 2))).doubleValue());
+                        if (null != product.getShopTaxRate() && product.getShopTaxRate() > 0d) {
+                            product.setPrice(MathUtil.add(productPrice, MathUtil.mul(productPrice, MathUtil.div(product.getShopTaxRate(), 100, 2))).doubleValue());
                         }
                     } else {
                         product.setPrice(productPrice);
@@ -698,7 +698,7 @@ public class SubmitServiceImpl implements SubmitService {
                                 BigDecimal svipReduction = MathUtil.sub(productPrice, discountPrice);
                                 if (taxFlag) {
                                     // 商品税费超级会员优惠
-                                    BigDecimal svipTaxReduction = MathUtil.div(MathUtil.mul(svipReduction, product.getTaxRate()), 100, 2);
+                                    BigDecimal svipTaxReduction = MathUtil.div(MathUtil.mul(svipReduction, product.getShopTaxRate()), 100, 2);
                                     svipReduction = MathUtil.add(svipReduction, svipTaxReduction);
                                 }
                                 // 统计超级会员优惠
@@ -758,12 +758,12 @@ public class SubmitServiceImpl implements SubmitService {
                         return ResponseJson.error("商品购买价格不能为0!", null);
                     }
                     // 不含税可开票商品计算税费
-                    if (null == product.getTaxRate() || product.getTaxRate() <= 0) {
+                    if (null == product.getShopTaxRate() || product.getShopTaxRate() <= 0) {
                         product.setTaxRate(0d);
                     }
                     if (taxFlag) {
-                        productTax = MathUtil.div(MathUtil.mul(productPrice, product.getTaxRate()), 100, 2).doubleValue();
-                        discountTax = MathUtil.div(MathUtil.mul(discountPrice, product.getTaxRate()), 100, 2).doubleValue();
+                        productTax = MathUtil.div(MathUtil.mul(productPrice, product.getShopTaxRate()), 100, 2).doubleValue();
+                        discountTax = MathUtil.div(MathUtil.mul(discountPrice, product.getShopTaxRate()), 100, 2).doubleValue();
                     } else if (!Integer.valueOf(1).equals(product.getIncludedTax())) {
                         // 不含税不可开票商品和未知商品,税率置为0
                         product.setTaxRate(0d);
@@ -771,8 +771,8 @@ public class SubmitServiceImpl implements SubmitService {
                     log.info("productTax===" + productTax);
                     // 商品价格
                     if (Integer.valueOf(0).equals(product.getIncludedTax())) {
-                        if (null != product.getTaxRate() && product.getTaxRate() > 0d) {
-                            product.setPrice(MathUtil.add(productPrice, MathUtil.mul(productPrice, MathUtil.div(product.getTaxRate(), 100, 2))).doubleValue());
+                        if (null != product.getShopTaxRate() && product.getShopTaxRate() > 0d) {
+                            product.setPrice(MathUtil.add(productPrice, MathUtil.mul(productPrice, MathUtil.div(product.getShopTaxRate(), 100, 2))).doubleValue());
                         }
                     } else {
                         product.setPrice(productPrice);
@@ -823,7 +823,7 @@ public class SubmitServiceImpl implements SubmitService {
                                         promotionsIds.add(promotions.getId());
                                         promotions.setPromotionsId(promotions.getId());
                                         if (taxFlag) {
-                                            promotions.setTouchPrice( MathUtil.add(promotions.getTouchPrice(), MathUtil.div(MathUtil.mul(promotions.getTouchPrice(), product.getTaxRate()), 100, 2)).doubleValue());
+                                            promotions.setTouchPrice( MathUtil.add(promotions.getTouchPrice(), MathUtil.div(MathUtil.mul(promotions.getTouchPrice(), product.getShopTaxRate()), 100, 2)).doubleValue());
                                         }
                                         promotionList.add(promotions);
                                     }
@@ -844,7 +844,7 @@ public class SubmitServiceImpl implements SubmitService {
                                     promotionsIds.add(promotions.getId());
                                     promotions.setPromotionsId(promotions.getId());
                                     if (taxFlag) {
-                                        promotions.setTouchPrice( MathUtil.add(promotions.getTouchPrice(), MathUtil.div(MathUtil.mul(promotions.getTouchPrice(), product.getTaxRate()), 100, 2)).doubleValue());
+                                        promotions.setTouchPrice( MathUtil.add(promotions.getTouchPrice(), MathUtil.div(MathUtil.mul(promotions.getTouchPrice(), product.getShopTaxRate()), 100, 2)).doubleValue());
                                     }
                                     promotionList.add(promotions);
                                 } else {
@@ -893,7 +893,7 @@ public class SubmitServiceImpl implements SubmitService {
                     // 通过售价*比例得到成本价
                     double costTax = 0d;
                     if (taxFlag) {
-                        costTax = MathUtil.div(MathUtil.mul(product.getCostPrice(), product.getTaxRate()), 100, 2).doubleValue();
+                        costTax = MathUtil.div(MathUtil.mul(product.getCostPrice(), product.getShopTaxRate()), 100, 2).doubleValue();
                     }
                     costPrice = MathUtil.add(product.getCostPrice(), costTax).doubleValue();
                 }
@@ -983,8 +983,8 @@ public class SubmitServiceImpl implements SubmitService {
                 if (StringUtils.isNotEmpty(organizeSkuInfo.getCostCheckFlag()) && "1".equals(organizeSkuInfo.getCostCheckFlag())) {
                     // 固定成本
                     if (taxFlag) {
-                        organizeSkuInfo.setOrganizeCostPrice(MathUtil.add(organizeSkuInfo.getOrganizeCostPrice(), MathUtil.div(MathUtil.mul(organizeSkuInfo.getOrganizeCostPrice(), product.getTaxRate()), 100)).doubleValue());
-                        organizeSkuInfo.setCmCostPrice(MathUtil.add(organizeSkuInfo.getCmCostPrice(), MathUtil.div(MathUtil.mul(organizeSkuInfo.getCmCostPrice(), product.getTaxRate()), 100)).doubleValue());
+                        organizeSkuInfo.setOrganizeCostPrice(MathUtil.add(organizeSkuInfo.getOrganizeCostPrice(), MathUtil.div(MathUtil.mul(organizeSkuInfo.getOrganizeCostPrice(), product.getShopTaxRate()), 100)).doubleValue());
+                        organizeSkuInfo.setCmCostPrice(MathUtil.add(organizeSkuInfo.getCmCostPrice(), MathUtil.div(MathUtil.mul(organizeSkuInfo.getCmCostPrice(), product.getShopTaxRate()), 100)).doubleValue());
                     }
                     product.setOrganizeCostPrice(organizeSkuInfo.getOrganizeCostPrice());
                     product.setCmCostPrice(organizeSkuInfo.getCmCostPrice());
@@ -2251,12 +2251,12 @@ public class SubmitServiceImpl implements SubmitService {
                     return ResponseJson.error("商品购买价格不能为0!", null);
                 }
                 // 不含税可开票商品计算税费
-                if (null == product.getTaxRate() || product.getTaxRate() <= 0) {
+                if (null == product.getShopTaxRate() || product.getShopTaxRate() <= 0) {
                     product.setTaxRate(0d);
                 }
                 if (taxFlag) {
-                    productTax = MathUtil.div(MathUtil.mul(productPrice, product.getTaxRate()), 100, 2).doubleValue();
-                    discountTax = MathUtil.div(MathUtil.mul(discountPrice, product.getTaxRate()), 100, 2).doubleValue();
+                    productTax = MathUtil.div(MathUtil.mul(productPrice, product.getShopTaxRate()), 100, 2).doubleValue();
+                    discountTax = MathUtil.div(MathUtil.mul(discountPrice, product.getShopTaxRate()), 100, 2).doubleValue();
                 } else if (!Integer.valueOf(1).equals(product.getIncludedTax())) {
                     // 不含税不可开票商品和未知商品,税率置为0
                     product.setTaxRate(0d);
@@ -2299,7 +2299,7 @@ public class SubmitServiceImpl implements SubmitService {
                 // 通过售价*比例得到成本价
                 double costTax = 0d;
                 if (taxFlag) {
-                    costTax = MathUtil.div(MathUtil.mul(product.getCostPrice(), product.getTaxRate()), 100, 2).doubleValue();
+                    costTax = MathUtil.div(MathUtil.mul(product.getCostPrice(), product.getShopTaxRate()), 100, 2).doubleValue();
                 }
                 costPrice = MathUtil.add(product.getCostPrice(), costTax).doubleValue();
             }
@@ -2308,7 +2308,7 @@ public class SubmitServiceImpl implements SubmitService {
                 // 通过售价*比例得到成本价
                 double discountTax = 0d;
                 if (taxFlag) {
-                    discountTax = MathUtil.div(MathUtil.mul(product.getDiscountPrice(), product.getTaxRate()), 100, 2).doubleValue();
+                    discountTax = MathUtil.div(MathUtil.mul(product.getDiscountPrice(), product.getShopTaxRate()), 100, 2).doubleValue();
                 }
                 costPrice = MathUtil.div(MathUtil.mul(MathUtil.add(product.getDiscountPrice(), discountTax), product.getCostProportional()), 100, 2).doubleValue();
             }
@@ -2321,7 +2321,7 @@ public class SubmitServiceImpl implements SubmitService {
                 product.setShopTaxRate(product.getTaxRate());
             }
             if (taxFlag) {
-                shopTax = MathUtil.div(MathUtil.mul(MathUtil.div(costPrice, MathUtil.div(MathUtil.add(product.getTaxRate(), 100), 100)), product.getShopTaxRate()), 100, 2).doubleValue();
+                shopTax = MathUtil.div(MathUtil.mul(MathUtil.div(costPrice, MathUtil.div(MathUtil.add(product.getShopTaxRate(), 100), 100)), product.getShopTaxRate()), 100, 2).doubleValue();
             } else if (!Integer.valueOf(1).equals(product.getIncludedTax())) {
                 // 不含税不可开票商品和未知商品,税率置为0
                 product.setShopTaxRate(0d);
@@ -2384,8 +2384,8 @@ public class SubmitServiceImpl implements SubmitService {
             if (StringUtils.isNotEmpty(organizeSkuInfo.getCostCheckFlag()) && "1".equals(organizeSkuInfo.getCostCheckFlag())) {
                 // 固定成本
                 if (taxFlag) {
-                    organizeSkuInfo.setOrganizeCostPrice(MathUtil.add(organizeSkuInfo.getOrganizeCostPrice(), MathUtil.div(MathUtil.mul(organizeSkuInfo.getOrganizeCostPrice(), product.getTaxRate()), 100)).doubleValue());
-                    organizeSkuInfo.setCmCostPrice(MathUtil.add(organizeSkuInfo.getCmCostPrice(), MathUtil.div(MathUtil.mul(organizeSkuInfo.getCmCostPrice(), product.getTaxRate()), 100)).doubleValue());
+                    organizeSkuInfo.setOrganizeCostPrice(MathUtil.add(organizeSkuInfo.getOrganizeCostPrice(), MathUtil.div(MathUtil.mul(organizeSkuInfo.getOrganizeCostPrice(), product.getShopTaxRate()), 100)).doubleValue());
+                    organizeSkuInfo.setCmCostPrice(MathUtil.add(organizeSkuInfo.getCmCostPrice(), MathUtil.div(MathUtil.mul(organizeSkuInfo.getCmCostPrice(), product.getShopTaxRate()), 100)).doubleValue());
                 }
                 product.setOrganizeCostPrice(organizeSkuInfo.getOrganizeCostPrice());
                 product.setCmCostPrice(organizeSkuInfo.getCmCostPrice());