//package cn.freemud.service.impl.calculate;
//
//import cn.freemud.entities.dto.UserLoginInfoDto;
//import cn.freemud.entities.dto.activity.ActivityQueryDto;
//import cn.freemud.entities.dto.calculate.CalculationDiscountResult;
//import cn.freemud.entities.vo.CartGoods;
//import cn.freemud.entities.vo.CouponPromotionVO;
//import cn.freemud.entities.vo.ShoppingCartGoodsResponseVo;
//import cn.freemud.entities.vo.ShoppingCartInfoRequestVo;
//import cn.freemud.handle.CommonFunctionHandle;
//import cn.freemud.service.impl.calculate.CalculationCommonService;
//import cn.freemud.service.impl.calculate.CalculationSharingCartService;
//import cn.freemud.service.impl.calculate.promotion.*;
//import com.alibaba.fastjson.JSON;
//
//import java.util.List;
//
///**
// * @author : xh.Z
// * @email : fisherman0510@163.com
// * @Date : 2022/5/26 15:45
// * @description :
// */
//public class DemoMain {
//
//    public static void main(String[] args) {
//        CalculationDiscountResult discountResult = JSON.parseObject("{\"apportionGoods\":[],\"couponDiscounts\":[],\"deliveryAmount\":0,\"discounts\":[],\"distributionFee\":0,\"goods\":[{\"actualGoodsNumber\":0,\"cartGoodType\":0,\"cartGoodsUid\":\"fc9fc2f1-2ce2-44b7-bc17-068537189159\",\"discountAmount\":0,\"discounts\":[],\"gift\":false,\"goodsId\":\"219187474445045306\",\"goodsQuantity\":1,\"meal\":false,\"nowPrice\":1000,\"originalPrice\":1000,\"realAmount\":1000},{\"actualGoodsNumber\":0,\"cartGoodType\":0,\"cartGoodsUid\":\"6b063f3e-117d-4714-a75b-4560c0f029c4\",\"discountAmount\":0,\"discounts\":[],\"gift\":false,\"goodsId\":\"219068580477539339\",\"goodsQuantity\":1,\"meal\":false,\"nowPrice\":100,\"originalPrice\":100,\"realAmount\":100},{\"actualGoodsNumber\":0,\"cartGoodType\":0,\"cartGoodsUid\":\"43a97b52-c1f1-42ac-8f9d-b62792b8efd0\",\"discountAmount\":0,\"discounts\":[],\"gift\":false,\"goodsId\":\"219187474445045306\",\"goodsQuantity\":1,\"meal\":false,\"nowPrice\":1000,\"originalPrice\":1000,\"realAmount\":1000}],\"isScoreLimit\":0,\"nightDistributionFee\":0,\"originalTotalAmount\":2100,\"spqIdToCartUuid\":{\"88709563134192846728\":[\"6b063f3e-117d-4714-a75b-4560c0f029c4\"],\"88709563134035806084\":[\"fc9fc2f1-2ce2-44b7-bc17-068537189159\"]},\"stocks\":[],\"totalAmount\":2100,\"totalDiscountAmount\":0,\"v3Promotion\":true,\"validCouponMap\":{\"88709563134192846728219068580477539339\":{\"activeCode\":\"M1653543190874265\",\"activityName\":\"商品券\",\"couponCode\":\"88709563134192846728\",\"couponName\":\"商品券\",\"couponType\":4,\"picture\":\"https://picture.sandload.cn/1631702492012.gif\",\"price\":100,\"productBeans\":{\"additionalGroupList\":[],\"barcode\":\"\",\"brandId\":\"220255632887107605\",\"brandName\":\"盛香亭\",\"businessNo\":\"\",\"category\":\"\",\"categoryName\":\"\",\"companyId\":\"2690\",\"customerCode\":\"weishangcheng\",\"finalPrice\":100,\"foreignName\":\"\",\"isDishware\":0,\"isSkuProduct\":0,\"linkedId\":\"\",\"memberDiscount\":0,\"memberDiscountResult\":100,\"name\":\"微商城\",\"openMemberDiscount\":0,\"originalPrice\":100,\"packPrice\":0,\"picture\":\"https://picture.sandload.cn/1631702492012.gif\",\"pid\":\"219068580477539339\",\"productAttributeGroupList\":[],\"productBindingCouponTypes\":[],\"productCode\":\"787\",\"productComboList\":[],\"productGroupList\":[],\"productPictureList\":[{\"sequence\":\"0\",\"type\":\"default\",\"url\":\"https://picture.sandload.cn/1631702492012.gif\"}],\"rawMaterial\":\"\",\"riseSell\":1,\"singleOrder\":0,\"skuList\":[],\"skuSpecValues\":[],\"specification\":\"\",\"status\":2,\"stock\":9999,\"stockLimit\":2,\"tax\":0.01,\"taxId\":\"\",\"type\":1,\"unit\":\"杯\",\"weight\":2.0,\"weightType\":0},\"skuId\":\"219068580477539339\",\"skuName\":\"微商城\",\"spuId\":\"219068580477539339\",\"spuName\":\"微商城\",\"stockLimit\":false,\"todayAvailableTimes\":1},\"88709563134192846728\":{\"$ref\":\"$.validCouponMap.88709563134192846728219068580477539339\"},\"88709563134035806084219187474445045306\":{\"activeCode\":\"E1653543224923331\",\"activityName\":\"换购券\",\"couponCode\":\"88709563134035806084\",\"couponName\":\"换购券\",\"couponType\":4,\"picture\":\"https://picture.sandload.cn/1631788957908.jpg\",\"price\":1000,\"productBeans\":{\"additionalGroupList\":[],\"barcode\":\"\",\"brandId\":\"\",\"brandName\":\"\",\"businessNo\":\"\",\"category\":\"\",\"categoryName\":\"\",\"companyId\":\"2690\",\"customerCode\":\"20210916\",\"finalPrice\":1000,\"foreignName\":\"\",\"isDishware\":0,\"isSkuProduct\":0,\"linkedId\":\"\",\"memberDiscount\":0,\"memberDiscountResult\":100,\"name\":\"玫瑰豉油鸡\",\"openMemberDiscount\":0,\"originalPrice\":1000,\"packPrice\":0,\"picture\":\"https://picture.sandload.cn/1631788957908.jpg\",\"pid\":\"219187474445045306\",\"productAttributeGroupList\":[],\"productBindingCouponTypes\":[],\"productCode\":\"202109\",\"productComboList\":[],\"productGroupList\":[],\"productPictureList\":[{\"sequence\":\"0\",\"type\":\"default\",\"url\":\"https://picture.sandload.cn/1631788957908.jpg\"}],\"rawMaterial\":\"\",\"riseSell\":1,\"singleOrder\":0,\"skuList\":[],\"skuSpecValues\":[],\"specification\":\"\",\"status\":2,\"stock\":9999,\"stockLimit\":1,\"tax\":0.01,\"taxId\":\"\",\"type\":1,\"unit\":\"\",\"weight\":0.0,\"weightType\":0},\"skuId\":\"219187474445045306\",\"skuName\":\"玫瑰豉油鸡\",\"spuId\":\"219187474445045306\",\"spuName\":\"玫瑰豉油鸡\",\"stockLimit\":true,\"todayAvailableTimes\":1},\"88709563134035806084\":{\"$ref\":\"$.validCouponMap.88709563134035806084219187474445045306\"}}}",
//                CalculationDiscountResult.class);
//        List<CartGoods> cartGoodsList = JSON.parseArray("[{\"addCartTime\":1653555686896,\"amount\":1000,\"canUseCoupon\":1,\"cartGoodsUid\":\"43a97b52-c1f1-42ac-8f9d-b62792b8efd0\",\"categoryName\":\"推荐\",\"classificationForeignName\":\"\",\"classificationId\":\"\",\"classificationName\":\"\",\"couponData\":[],\"createTimeMili\":1653555686896,\"currentCouponDiscount\":0,\"customerCode\":\"20210916\",\"finalPrice\":1000,\"foreignName\":\"\",\"goodsId\":\"219187474445045306\",\"goodsType\":5,\"isB3S1Coupon\":0,\"isB3S1CouponGoods\":0,\"isMonthCard\":0,\"isMonthCardGoods\":0,\"isSunnyCoupon\":0,\"isTableware\":false,\"linkedId\":\"\",\"materialAmount\":0,\"memberDiscount\":100,\"name\":\"玫瑰豉油鸡\",\"originalAmount\":1000,\"originalMaterialAmount\":0,\"originalPrice\":1000,\"originalProductType\":1,\"packPrice\":0,\"pic\":\"https://picture.sandload.cn/1631788957908.jpg\",\"productComboList\":[],\"productGroupList\":[],\"productMaterialList\":[],\"qty\":1,\"riseSell\":1,\"singleOrder\":0,\"skuForeignName\":\"\",\"skuId\":\"\",\"skuName\":\"玫瑰豉油鸡\",\"spuForeignName\":\"\",\"spuId\":\"219187474445045306\",\"spuName\":\"玫瑰豉油鸡\",\"stockLimit\":true,\"subForeignName\":\"\",\"subName\":\"\",\"tax\":0.01,\"taxId\":\"\",\"unit\":\"\",\"weight\":0.0,\"weightType\":false},{\"addCartTime\":1653571996024,\"amount\":100,\"canUseCoupon\":1,\"cartGoodsUid\":\"6b063f3e-117d-4714-a75b-4560c0f029c4\",\"couponCode\":\"88709563134192846728\",\"couponData\":[],\"createTimeMili\":1653571996024,\"currentCouponDiscount\":0,\"extra\":[],\"finalPrice\":100,\"goodsId\":\"spq88709563134192846728\",\"goodsType\":7,\"isB3S1Coupon\":0,\"isB3S1CouponGoods\":0,\"isMonthCard\":0,\"isMonthCardGoods\":0,\"isSunnyCoupon\":0,\"isTableware\":false,\"linkedId\":\"\",\"name\":\"微商城\",\"originalAmount\":0,\"originalPrice\":0,\"originalProductType\":1,\"packPrice\":0,\"pic\":\"https://picture.sandload.cn/1631702492012.gif\",\"productComboList\":[],\"productGroupList\":[],\"productMaterialList\":[],\"qty\":1,\"skuId\":\"219068580477539339\",\"skuName\":\"微商城\",\"spuId\":\"219068580477539339\",\"spuName\":\"微商城\",\"stockLimit\":false,\"unit\":\"杯\",\"weight\":2.0,\"weightType\":false},{\"addCartTime\":1653571999650,\"amount\":1000,\"canUseCoupon\":1,\"cartGoodsUid\":\"fc9fc2f1-2ce2-44b7-bc17-068537189159\",\"couponCode\":\"88709563134035806084\",\"couponData\":[],\"createTimeMili\":1653571999650,\"currentCouponDiscount\":0,\"extra\":[],\"finalPrice\":1000,\"goodsId\":\"spq88709563134035806084\",\"goodsType\":7,\"isB3S1Coupon\":0,\"isB3S1CouponGoods\":0,\"isMonthCard\":0,\"isMonthCardGoods\":0,\"isSunnyCoupon\":0,\"isTableware\":false,\"linkedId\":\"\",\"name\":\"玫瑰豉油鸡\",\"originalAmount\":0,\"originalPrice\":0,\"originalProductType\":1,\"packPrice\":0,\"pic\":\"https://picture.sandload.cn/1631788957908.jpg\",\"productComboList\":[],\"productGroupList\":[],\"productMaterialList\":[],\"qty\":1,\"skuId\":\"219187474445045306\",\"skuName\":\"玫瑰豉油鸡\",\"spuId\":\"219187474445045306\",\"spuName\":\"玫瑰豉油鸡\",\"stockLimit\":true,\"unit\":\"\",\"weight\":0.0,\"weightType\":false}]",
//                CartGoods.class);
//        ShoppingCartGoodsResponseVo shoppingCartGoodsResponseVo = JSON.parseObject("{\"currentTime\":1653572025924,\"deliveryAmountList\":[],\"isDiscountDelivery\":false,\"isInsufficientScore\":false,\"newPackAmount\":0,\"originalTotalAmount\":2100,\"packageAmountCollectType\":1,\"shoppingCartGoodsAmount\":2100,\"shoppingCartOriginalGoodsAmount\":2100,\"toastMsgMap\":{},\"totalAmount\":2100,\"totalDiscountAmount\":0,\"verCompat\":0}",
//                ShoppingCartGoodsResponseVo.class);
//        ShoppingCartInfoRequestVo shoppingCartInfoRequestVo = JSON.parseObject("{\"activityCode\":\"\",\"appId\":\"wxa1f272347828dae8\",\"buyType\":0,\"cardCodes\":[\"5826900000012200001\"],\"channelType\":\"saas\",\"couponCode\":\"88709563134192846728\",\"couponCodes\":[{\"couponCode\":\"88709563134192846728\",\"couponType\":0},{\"couponCode\":\"88709563134269278089\",\"couponType\":3,\"discountAmount\":50},{\"couponCode\":\"88709563134035806084\",\"couponType\":4}],\"enableSharing\":0,\"flag\":1,\"menuType\":\"saas\",\"orderType\":1,\"partnerId\":\"2690\",\"reachStoreType\":4,\"receiveId\":\"\",\"sendGoods\":[],\"sessionId\":\"807d1c8733fbd49b5e5c9fb582969a1f161e5c24\",\"shopId\":\"1001\",\"unChooseCouponCode\":\"\",\"useCustomerScore\":2,\"version\":\"2\"}",
//                ShoppingCartInfoRequestVo.class);
//        UserLoginInfoDto userLoginInfoDto = JSON.parseObject("{\"appsecret\":\"\",\"memberId\":\"3653544968271672251\",\"mobile\":\"18868926846\",\"newMemeber\":false,\"openId\":\"o0wG94vYX4dU0D05UZeLr2sq2G5c\",\"partnerId\":\"2690\",\"sessionKey\":\"7O1hhkbebOSfx4v5gGH+3A==\",\"unionId\":\"orw3252-W7Eag3gBYP786K75rF9k\",\"wxAppid\":\"wxa1f272347828dae8\"}",
//                UserLoginInfoDto.class);
//        CouponPromotionVO couponPromotionVO = JSON.parseObject("{\"availableCouponQueryFlag\":\"2\",\"couponCode\":\"88709563134192846728\",\"couponCodes\":[\"88709563134192846728\",\"88709563134269278089\",\"88709563134035806084\"],\"deliveryAmount\":0,\"orderType\":1,\"partnerId\":\"2690\",\"storeId\":\"1001\",\"unChooseCouponCode\":\"\",\"userId\":\"3653544968271672251\"}",
//                CouponPromotionVO.class);
//        ActivityQueryDto activityQueryDto = JSON.parseObject("{\"appId\":\"wxa1f272347828dae8\",\"orderType\":1,\"partnerId\":\"2690\",\"storeId\":\"1001\",\"userId\":\"3653544968271672251\"}",
//                ActivityQueryDto.class);
//        String menuType = "saas";
//        Long deliveryAmount = 0L;
//        String opt = "query_info";
//        String partnerId = "2690";
//        Integer flag = 1;
//        String userId = "3653544968271672251";
//        String storeId = "1001";
//        long nightDistributionFee = 0L;
//
//        CalculationSharingCartService sharingCartService = new CalculationSharingCartService();
//        CalculationCommonService calculationCommonService = new CalculationCommonService();
//        calculationCommonService.setCommonFunctionHandle(new CommonFunctionHandle());
//        sharingCartService.setCalculationCommonService(calculationCommonService);
//        CouponSharingService promotionSharingService = new CouponSharingService();
//        sharingCartService.setPromotionSharingService(promotionSharingService);
//
//        sharingCartService.setFullSharingService(new FullSharingService());
//        sharingCartService.setGiftSharingService(new GiftSharingService());
//        sharingCartService.setAdditionSharingService(new AdditionSharingService());
//        sharingCartService.setScoreSharingService(new ScoreSharingService());
//        sharingCartService.setCalculationCommonService(new CalculationCommonService());
//        sharingCartService.setBuyOneGiveOneSendService(new BuyOneGiveOneSendService());
//        CommonFunctionHandle commonFunctionHandle = new CommonFunctionHandle();
//        calculationCommonService.setCommonFunctionHandle(commonFunctionHandle);
//        sharingCartService.distribute(discountResult, cartGoodsList, shoppingCartGoodsResponseVo, shoppingCartInfoRequestVo, userLoginInfoDto,
//                couponPromotionVO,
//                activityQueryDto,
//                menuType, deliveryAmount, opt, partnerId, flag, userId, storeId, nightDistributionFee);
//
//        System.out.println(JSON.toJSONString(shoppingCartGoodsResponseVo));
//    }
//}
