TESTNG和MOCK配合使用实例

直接帖代码了

这个是测试类

import java.util.HashMap;
import java.util.Map;

import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;

import com.google.gson.Gson;


public class OperateShopCouponServiceImplTest {
    @InjectMocks
    private OperateShopCouponServiceImpl operateShopCouponServiceImpl;

    @Mock
    private UserInfoService userInfoService;
    @Mock
    private PromotionBaseService promotionBaseService;
    @Mock
    private ShopCouponTemplateSendService shopCouponTemplateSendService;
    @Mock
    private CouponAccountService couponAccountService;
    @Mock
    private ShopFavoriteCommonService shopFavoriteCommonService;
    @Mock
    private OperateShopCouponExportService operateShopCouponExportService;
    @Mock
    private ShopFavoriteGiftService shopFavoriteGiftService;
    @Mock
    private PageShardingDalClient dalClient;
    @SuppressWarnings("unchecked")
    @DataProvider
    public Object[][] dp1() {
        String reqJsonStr = "{'pageCode':'111','pageName':'222','pageChannel':'31'}";
        Map reqMap = new Gson().fromJson(reqJsonStr, Map.class);
        return new Object[][] { { reqMap } };
    }

    @BeforeClass
    public void beforeClass() {
        // 自动将依赖的类注入待测类
        MockitoAnnotations.initMocks(this);
    }

    // 品牌商保存测试
    @SuppressWarnings("unchecked")
    @Test(dataProvider = "dp1", groups = "exectest")
    public void insertPromotionInfoTestP(Map inputMap) {
        Mockito.reset(promotionBaseService);
        // 构造请求参数
        Map paramMap = Mockito.anyMap();
        paramMap.put("showRegion", "1");
        paramMap.put("baseAmount", "1");
        paramMap.put("couponType", "1");
        paramMap.put("assignedRole", "03");
        paramMap.put("rewardAmount", 112222);
        paramMap.put("activityTimesLimit", 1000000000);
        // 执行特定方法,构造返回值
        Map newParamMap = new HashMap();
        newParamMap.put("sendFlag", "");
        newParamMap.put("activityCode", "");
        newParamMap.put("excludeProduct", "");
        newParamMap.put("donationFlag", "");
        newParamMap.put("operationType", "");
        newParamMap.put("showRegion", "");
        newParamMap.put("activityStatus", "");
        newParamMap.put("activityType", "");
        Map supplyInfoMap = new HashMap();
        supplyInfoMap.put("supplierType", "K");
        Mockito.when(userInfoService.getSupplyinfoByCode(newParamMap))
                .thenReturn(supplyInfoMap);
        CouponAccountBean couponAccountBean1 = new CouponAccountBean();
        couponAccountBean1.setReceiveFlag("F");
        Mockito.when(
                couponAccountService.activeCreateAddStop(Mockito
                        .any(CouponAccountBean.class))).thenReturn(
                couponAccountBean1);

        // 调用接口
        operateShopCouponServiceImpl.insertPromotionInfoP(paramMap);
    }


    @SuppressWarnings("unchecked")
    @Test(dataProvider = "dp1", groups = "exectest")
    public void insertPromotionInfoTestP1(Map inputMap) {
        Mockito.reset(promotionBaseService);
        // 构造请求参数
        Map paramMap = Mockito.anyMap();
        paramMap.put("baseAmount", "");
        paramMap.put("channelInfo", "22");
        paramMap.put("assignedRole", "03");
        paramMap.put("rewardAmount", 112222);
        paramMap.put("productCode", "3335526");
        paramMap.put("supplierType", "P");
        paramMap.put("activityTimesLimit", 1000000000);
        // 执行特定方法,构造返回值
        Map newParamMap = new HashMap();
        newParamMap.put("sendFlag", "");
        newParamMap.put("activityCode", "");
        newParamMap.put("excludeProduct", "");
        newParamMap.put("donationFlag", "");
        newParamMap.put("operationType", "");
        newParamMap.put("showRegion", "");
        newParamMap.put("activityStatus", "");
        newParamMap.put("activityType", "");
        Map supplyInfoMap = new HashMap();
        supplyInfoMap.put("supplierType", "K");
        Mockito.when(userInfoService.getSupplyinfoByCode(newParamMap))
                .thenReturn(supplyInfoMap);
        CouponAccountBean couponAccountBean1 = new CouponAccountBean();
        couponAccountBean1.setReceiveFlag("S");
        CouponAccountBean couponAccountBean3 = new CouponAccountBean();
        couponAccountBean3.setReceiveFlag("S");
        Mockito.when(
                couponAccountService.activeCreateAddStop(Mockito
                        .any(CouponAccountBean.class)))
                .thenReturn(couponAccountBean1).thenReturn(couponAccountBean3);
        Mockito.when(
                operateShopCouponExportService.createOrModifyShopCouponInfoP(
                        paramMap, "1")).thenReturn("XXX");
        Map responseMap = new HashMap();
        responseMap.put("flag", "1");
        Mockito.when(operateShopCouponExportService.send(Mockito.anyString()))
                .thenReturn(responseMap);
        CouponAccountBean ticketRuleIdNoticeBean = new CouponAccountBean();
        ticketRuleIdNoticeBean.setReceiveFlag("F");
        Mockito.when(
                couponAccountService.ticketRuleIdNotice(Mockito.anyString(),
                        Mockito.anyString(), Mockito.anyString())).thenReturn(
                ticketRuleIdNoticeBean);

        // 调用接口
        operateShopCouponServiceImpl.insertPromotionInfoP(paramMap);
    }


    @SuppressWarnings("unchecked")
    @Test(dataProvider = "dp1", groups = "exectest")
    public void insertPromotionInfoTestP11(Map inputMap) {
        Mockito.reset(promotionBaseService);
        // 构造请求参数
        Map paramMap = Mockito.anyMap();
        paramMap.put("baseAmount", "1213415");
        paramMap.put("assignedRole", "03");
        paramMap.put("rewardAmount", 112222);
        paramMap.put("activityTimesLimit", 1000000000);
        String[] showRegion = { "33", "22" };
        paramMap.put("showRegion", showRegion);
        String[] channelInfo = { "21", "32" };
        paramMap.put("channelInfo", channelInfo);
        String[] productCode = { "21223355", "3253565" };
        paramMap.put("productCode", productCode);
        // 执行特定方法,构造返回值
        Map newParamMap = new HashMap();
        newParamMap.put("sendFlag", "");
        newParamMap.put("activityCode", "");
        newParamMap.put("excludeProduct", "");
        newParamMap.put("donationFlag", "");
        newParamMap.put("operationType", "");
        newParamMap.put("showRegion", showRegion);
        newParamMap.put("activityStatus", "");
        newParamMap.put("activityType", "");
        Map supplyInfoMap = new HashMap();
        supplyInfoMap.put("supplierType", "S");
        Mockito.when(userInfoService.getSupplyinfoByCode(newParamMap))
                .thenReturn(supplyInfoMap);
        CouponAccountBean couponAccountBean1 = new CouponAccountBean();
        couponAccountBean1.setReceiveFlag("S");
        CouponAccountBean couponAccountBean3 = new CouponAccountBean();
        couponAccountBean3.setReceiveFlag("S");
        Mockito.when(
                couponAccountService.activeCreateAddStop(Mockito
                        .any(CouponAccountBean.class)))
                .thenReturn(couponAccountBean1).thenReturn(couponAccountBean3);
        Mockito.when(
                operateShopCouponExportService.createOrModifyShopCouponInfoP(
                        paramMap, "1")).thenReturn("XXX");
        Map responseMap = new HashMap();
        responseMap.put("flag", "0");
        Mockito.when(operateShopCouponExportService.send(Mockito.anyString()))
                .thenReturn(responseMap);
        CouponAccountBean ticketRuleIdNoticeBean = new CouponAccountBean();
        ticketRuleIdNoticeBean.setReceiveFlag("F");
        Mockito.when(
                couponAccountService.ticketRuleIdNotice(Mockito.anyString(),
                        Mockito.anyString(), Mockito.anyString())).thenReturn(
                ticketRuleIdNoticeBean);
        // 调用接口
        operateShopCouponServiceImpl.insertPromotionInfoP(paramMap);
    }

    @SuppressWarnings("unchecked")
    @Test(dataProvider = "dp1", groups = "exectest")
    public void insertPromotionInfoTestP111(Map inputMap) {
        Mockito.reset(promotionBaseService);
        // 构造请求参数
        Map paramMap = Mockito.anyMap();
        paramMap.put("baseAmount", "");
        paramMap.put("assignedRole", "03");
        paramMap.put("rewardAmount", 112222);
        paramMap.put("activityTimesLimit", 1000000000);
        paramMap.put("startTime", "2017-04-12");
        String[] showRegion = { "66", "55" };
        paramMap.put("showRegion", showRegion);
        String[] channelInfo = { "21", "32" };
        paramMap.put("channelInfo", channelInfo);
        String[] productCode = { "21223355", "3253565" };
        paramMap.put("productCode", productCode);
        Map supplyInfoMap = new HashMap();
        supplyInfoMap.put("supplierType", "K");
        Mockito.when(userInfoService.getSupplyinfoByCode(paramMap))
                .thenReturn(supplyInfoMap);
        CouponAccountBean couponAccountBean1 = new CouponAccountBean();
        couponAccountBean1.setReceiveFlag("S");
        CouponAccountBean couponAccountBean3 = new CouponAccountBean();
        couponAccountBean3.setReceiveFlag("F");
        Mockito.when(
                couponAccountService.activeCreateAddStop(Mockito
                        .any(CouponAccountBean.class)))
                .thenReturn(couponAccountBean1).thenReturn(couponAccountBean3);
        Mockito.when(
                operateShopCouponExportService.createOrModifyShopCouponInfoP(
                        paramMap, "1")).thenReturn("XXX");
        Map responseMap = new HashMap();
        Mockito.when(operateShopCouponExportService.send(Mockito.anyString()))
                .thenReturn(responseMap);
        // 调用接口
        operateShopCouponServiceImpl.insertPromotionInfoP(paramMap);
    }

    @SuppressWarnings("unchecked")
    @Test(dataProvider = "dp1", groups = "exectest")
    public void updatePromotionBasePTest(Map inputMap) {
        Mockito.reset(promotionBaseService);
        // 构造请求参数
        Map paramMap = Mockito.anyMap();
        paramMap.put("baseAmount", "");
        paramMap.put("assignedRole", "03");
        paramMap.put("operateAmount", 10000000);
        paramMap.put("rewardAmount", 112222);
        paramMap.put("activityTimesLimit", 1000000000);
        paramMap.put("startTime", "2017-04-12");
        Map supplyInfoMap = new HashMap();
        supplyInfoMap.put("supplierType", "K");
        Mockito.when(userInfoService.getSupplyinfoByCode(paramMap))
                .thenReturn(supplyInfoMap);
        CouponAccountBean couponAccountBean1 = new CouponAccountBean();
        couponAccountBean1.setReceiveFlag("S");
        CouponAccountBean couponAccountBean3 = new CouponAccountBean();
        couponAccountBean3.setReceiveFlag("F");
        Mockito.when(
                couponAccountService.activeCreateAddStop(Mockito
                        .any(CouponAccountBean.class)))
                .thenReturn(couponAccountBean1).thenReturn(couponAccountBean3);
        Mockito.when(
                operateShopCouponExportService.createOrModifyShopCouponInfoP(
                        paramMap, "1")).thenReturn("XXX");
        Map responseMap = new HashMap();
        Mockito.when(operateShopCouponExportService.send(Mockito.anyString()))
                .thenReturn(responseMap);
        // 调用接口
        operateShopCouponServiceImpl.updatePromotionBaseP(paramMap);
    }

    @SuppressWarnings("unchecked")
    @Test(dataProvider = "dp1", groups = "exectest")
    public void updatePromotionBasePTest1(Map inputMap) {
        Mockito.reset(promotionBaseService);
        // 构造请求参数
        Map paramMap = Mockito.anyMap();
        paramMap.put("baseAmount", "");
        paramMap.put("assignedRole", "03");
        paramMap.put("operateAmount", 10000000);
        paramMap.put("rewardAmount", 112222);
        paramMap.put("activityTimesLimit", 1000000000);
        paramMap.put("startTime", "2017-04-12");
        Map supplyInfoMap = new HashMap();
        supplyInfoMap.put("supplierType", "K");
        Mockito.when(userInfoService.getSupplyinfoByCode(paramMap))
                .thenReturn(supplyInfoMap);
        CouponAccountBean couponAccountBean1 = new CouponAccountBean();
        couponAccountBean1.setReceiveFlag("F");
        Mockito.when(
                couponAccountService.activeCreateAddStop(Mockito
                        .any(CouponAccountBean.class)))
                .thenReturn(couponAccountBean1);
        // 调用接口
        operateShopCouponServiceImpl.updatePromotionBaseP(paramMap);
    }


    @SuppressWarnings("unchecked")
    @Test(dataProvider = "dp1", groups = "exectest")
    public void updatePromotionBasePTest11(Map inputMap) {
        Mockito.reset(promotionBaseService);
        // 构造请求参数
        Map paramMap = Mockito.anyMap();
        paramMap.put("baseAmount", "");
        paramMap.put("assignedRole", "03");
        paramMap.put("operateAmount", 10000000);
        paramMap.put("rewardAmount", 112222);
        paramMap.put("activityTimesLimit", 1000000000);
        paramMap.put("startTime", "2017-04-12");
        Map supplyInfoMap = new HashMap();
        supplyInfoMap.put("supplierType", "K");
        Mockito.when(userInfoService.getSupplyinfoByCode(paramMap))
                .thenReturn(supplyInfoMap);
        CouponAccountBean couponAccountBean1 = new CouponAccountBean();
        couponAccountBean1.setReceiveFlag("S");
        CouponAccountBean couponAccountBean3 = new CouponAccountBean();
        couponAccountBean3.setReceiveFlag("S");
        Mockito.when(
                couponAccountService.activeCreateAddStop(Mockito
                        .any(CouponAccountBean.class)))
                .thenReturn(couponAccountBean1).thenReturn(couponAccountBean3);
        Mockito.when(
                operateShopCouponExportService.createOrModifyShopCouponInfoP(
                        paramMap, "2")).thenReturn("XXX");
        Map responseMap = new HashMap();
        responseMap.put("flag", "1");
        Mockito.when(operateShopCouponExportService.send(Mockito.anyString()))
                .thenReturn(responseMap);
        // 调用接口
        operateShopCouponServiceImpl.updatePromotionBaseP(paramMap);
    }
    
 更新测试
    @SuppressWarnings("unchecked")
    @Test(dataProvider = "dp1", groups = "exectest")
    public void updatePromotionBasePTest111(Map inputMap) {
        Mockito.reset(promotionBaseService);
        // 构造请求参数
        Map paramMap = Mockito.anyMap();
        paramMap.put("baseAmount", "");
        paramMap.put("assignedRole", "03");
        paramMap.put("operateAmount", 10000000);
        paramMap.put("rewardAmount", 112222);
        paramMap.put("activityTimesLimit", 1000000000);
        paramMap.put("startTime", "2017-04-12");
        Map supplyInfoMap = new HashMap();
        supplyInfoMap.put("supplierType", "K");
        Mockito.when(userInfoService.getSupplyinfoByCode(paramMap))
                .thenReturn(supplyInfoMap);
        CouponAccountBean couponAccountBean1 = new CouponAccountBean();
        couponAccountBean1.setReceiveFlag("S");
        CouponAccountBean couponAccountBean3 = new CouponAccountBean();
        couponAccountBean3.setReceiveFlag("S");
        Mockito.when(
                couponAccountService.activeCreateAddStop(Mockito
                        .any(CouponAccountBean.class)))
                .thenReturn(couponAccountBean1).thenReturn(couponAccountBean3);
        Mockito.when(
                operateShopCouponExportService.createOrModifyShopCouponInfoP(
                        paramMap, "2")).thenReturn("XXX");
        Map responseMap = new HashMap();
        responseMap.put("flag", "0");
        Mockito.when(operateShopCouponExportService.send(Mockito.anyString()))
                .thenReturn(responseMap);
        // 调用接口
        operateShopCouponServiceImpl.updatePromotionBaseP(paramMap);
    }
异常测试
    @SuppressWarnings("unchecked")
    @Test(expectedExceptions = MpmsSystemException.class)
    public void insertPromotionInfoRuntimeExceptionTestP() {
        // 构造请求参数
        Map paramMap = Mockito.anyMap();
        paramMap.put("showRegion", "3");
        paramMap.put("baseAmount", "");
        paramMap.put("assignedRole", "03");
        paramMap.put("rewardAmount", 112222);
        paramMap.put("activityTimesLimit", 1000000000);
        paramMap.put("startTime", "2017-04-12");
        // 执行特定方法,构造返回值
        Map newParamMap = new HashMap();
        newParamMap.put("sendFlag", "");
        newParamMap.put("activityCode", "");
        newParamMap.put("excludeProduct", "");
        newParamMap.put("donationFlag", "");
        newParamMap.put("operationType", "");
        newParamMap.put("showRegion", "");
        newParamMap.put("activityStatus", "");
        newParamMap.put("activityType", "");
        Map supplyInfoMap = new HashMap();
        supplyInfoMap.put("supplierType", "C");
        Mockito.when(userInfoService.getSupplyinfoByCode(newParamMap))
                .thenReturn(supplyInfoMap);
        Mockito.when(userInfoService.getSupplyinfoByCode(newParamMap))
                .thenReturn(supplyInfoMap);
        Mockito.doThrow(RuntimeException.class).when(promotionBaseService)
                .savePromotionBaseP((Map[]) Mockito.anyVararg());

        operateShopCouponServiceImpl.insertPromotionInfoP(paramMap);
    }

    @SuppressWarnings("unchecked")
    @Test(dataProvider = "dp1", groups = "exectest")
    public void insertPromotionInfoTest(Map inputMap) {
        // 构造请求参数
        Map paramMap = Mockito.anyMap();
        paramMap.put("showRegion", "1");
        paramMap.put("baseAmount", "1");
        paramMap.put("assignedRole", "03");

        // 执行特定方法,构造返回值
        Map newParamMap = new HashMap();
        newParamMap.put("sendFlag", "");
        newParamMap.put("activityCode", "");
        newParamMap.put("excludeProduct", "");
        newParamMap.put("donationFlag", "");
        newParamMap.put("operationType", "");
        newParamMap.put("showRegion", "");
        newParamMap.put("activityStatus", "");
        newParamMap.put("activityType", "");

        Map supplyInfoMap = new HashMap();
        supplyInfoMap.put("supplierType", "K");
        Mockito.when(userInfoService.getSupplyinfoByCode(newParamMap))
                .thenReturn(supplyInfoMap);

        // 调用接口
        operateShopCouponServiceImpl.insertPromotionInfo(paramMap);
    }


    @SuppressWarnings("unchecked")
    @Test(dataProvider = "dp1", groups = "exectest")
    public void insertPromotionInfoTest1(Map inputMap) {
        // 构造请求参数
        Map paramMap = Mockito.anyMap();
        paramMap.put("showRegion", "3");
        paramMap.put("baseAmount", "");
        // 执行特定方法,构造返回值
        Map newParamMap = new HashMap();
        newParamMap.put("sendFlag", "");
        newParamMap.put("activityCode", "");
        newParamMap.put("excludeProduct", "");
        newParamMap.put("donationFlag", "");
        newParamMap.put("operationType", "");
        newParamMap.put("showRegion", "");
        newParamMap.put("activityStatus", "");
        newParamMap.put("activityType", "");

        Map supplyInfoMap = new HashMap();
        supplyInfoMap.put("supplierType", "K");
        Mockito.when(userInfoService.getSupplyinfoByCode(newParamMap))
                .thenReturn(supplyInfoMap);
        // 调用接口
        operateShopCouponServiceImpl.insertPromotionInfo(paramMap);
    }


    @SuppressWarnings("unchecked")
    @Test(dataProvider = "dp1", groups = "exectest")
    public void insertPromotionInfoTest11(Map inputMap) {
        // 构造请求参数
        Map paramMap = Mockito.anyMap();
        paramMap.put("showRegion", "3");
        paramMap.put("baseAmount", "0");
        // 执行特定方法,构造返回值
        Map newParamMap = new HashMap();
        newParamMap.put("sendFlag", "");
        newParamMap.put("activityCode", "");
        newParamMap.put("excludeProduct", "");
        newParamMap.put("donationFlag", "");
        newParamMap.put("operationType", "");
        newParamMap.put("showRegion", "");
        newParamMap.put("activityStatus", "");
        newParamMap.put("activityType", "");
        Map supplyInfoMap = new HashMap();
        supplyInfoMap.put("supplierType", "K");
        Mockito.when(userInfoService.getSupplyinfoByCode(newParamMap))
                .thenReturn(supplyInfoMap);
        // 调用接口
        operateShopCouponServiceImpl.insertPromotionInfo(paramMap);
    }

    @SuppressWarnings("unchecked")
    @Test(dataProvider = "dp1", groups = "exectest")
    public void insertPromotionInfoTest2(Map inputMap) {
        // 构造请求参数
        Map paramMap = Mockito.anyMap();
        paramMap.put("showRegion", "");
        paramMap.put("baseAmount", "1");
        // 执行特定方法,构造返回值
        Map newParamMap = new HashMap();
        newParamMap.put("sendFlag", "");
        newParamMap.put("activityCode", "");
        newParamMap.put("excludeProduct", "");
        newParamMap.put("donationFlag", "");
        newParamMap.put("operationType", "");
        newParamMap.put("showRegion", "");
        newParamMap.put("activityStatus", "");
        newParamMap.put("activityType", "");
        newParamMap.put("assignedRole", "02");
        Map supplyInfoMap = new HashMap();
        supplyInfoMap.put("supplierType", "C");
        Mockito.when(userInfoService.getSupplyinfoByCode(newParamMap))
                .thenReturn(supplyInfoMap);
        // 调用接口
        operateShopCouponServiceImpl.insertPromotionInfo(paramMap);
    }

    @SuppressWarnings("unchecked")
    @Test(dataProvider = "dp1", groups = "exectest")
    public void insertPromotionInfoTest22(Map inputMap) {
        // 构造请求参数
        Map paramMap = Mockito.anyMap();
        paramMap.put("showRegion", "");
        paramMap.put("baseAmount", "");
        paramMap.put("isShop", "Y");
        paramMap.put("excludeProduct", "2");
        // 执行特定方法,构造返回值
        Map newParamMap = new HashMap();
        newParamMap.put("sendFlag", "");
        newParamMap.put("activityCode", "");
        newParamMap.put("excludeProduct", "");
        newParamMap.put("donationFlag", "");
        newParamMap.put("operationType", "");
        newParamMap.put("showRegion", "");
        newParamMap.put("activityStatus", "");
        newParamMap.put("activityType", "");
        Map supplyInfoMap = new HashMap();
        supplyInfoMap.put("supplierType", "C");
        Mockito.when(userInfoService.getSupplyinfoByCode(newParamMap))
                .thenReturn(supplyInfoMap);
        // 调用接口
        operateShopCouponServiceImpl.insertPromotionInfo(paramMap);
    }


    @SuppressWarnings("unchecked")
    @Test(dataProvider = "dp1", groups = "exectest")
    public void insertPromotionInfoTest222(Map inputMap) {
        // 构造请求参数
        Map paramMap = Mockito.anyMap();
        paramMap.put("showRegion", "");
        paramMap.put("baseAmount", "");
        paramMap.put("isShop", "Y");
        paramMap.put("excludeProduct", "1");
        // 执行特定方法,构造返回值
        Map newParamMap = new HashMap();
        newParamMap.put("sendFlag", "");
        newParamMap.put("activityCode", "");
        newParamMap.put("excludeProduct", "");
        newParamMap.put("donationFlag", "");
        newParamMap.put("operationType", "");
        newParamMap.put("showRegion", "");
        newParamMap.put("activityStatus", "");
        newParamMap.put("activityType", "");
        Map supplyInfoMap = new HashMap();
        supplyInfoMap.put("supplierType", "C");
        Mockito.when(userInfoService.getSupplyinfoByCode(newParamMap))
                .thenReturn(supplyInfoMap);
        // 调用接口
        operateShopCouponServiceImpl.insertPromotionInfo(paramMap);
    }

    @SuppressWarnings("unchecked")
    @Test(dataProvider = "dp1", groups = "exectest")
    public void insertPromotionInfoTest2222(Map inputMap) {
        // 构造请求参数
        Map paramMap = Mockito.anyMap();
        paramMap.put("showRegion", "");
        paramMap.put("baseAmount", "0");
        paramMap.put("isShop", "N");
        // 执行特定方法,构造返回值
        Map newParamMap = new HashMap();
        newParamMap.put("sendFlag", "");
        newParamMap.put("activityCode", "");
        newParamMap.put("excludeProduct", "");
        newParamMap.put("donationFlag", "");
        newParamMap.put("operationType", "");
        newParamMap.put("showRegion", "");
        newParamMap.put("activityStatus", "");
        newParamMap.put("activityType", "");
        Map supplyInfoMap = new HashMap();
        supplyInfoMap.put("supplierType", "C");
        Mockito.when(userInfoService.getSupplyinfoByCode(newParamMap))
                .thenReturn(supplyInfoMap);
        // 调用接口
        operateShopCouponServiceImpl.insertPromotionInfo(paramMap);
    }
}

下面贴上被测试类

import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;



@Service
public class OperateShopCouponServiceImpl implements OperateShopCouponService {

    private static final String ACTIVITY_ID = "activityId";

    private static SnfLogger logger = SnfLoggerFactory.getLogger(OperateShopCouponServiceImpl.class);
    
    private static Logger snlogger = LoggerFactory.getLogger(OperateShopCouponServiceImpl.class);

    private static final String NAMESPACE = OperateShopCouponServiceImpl.class.getName();

    private static final int START_FALG_SIZE = 6;
    
    private static final int END_FLAG_SIZE = 7;
    
    private static final long DEFAULTNUM = 180l * 24 * 60 * 60 * 1000;
    
    @Autowired
    private UserInfoService userInfoService;

    private static  Search4PageDynamicDataReqService search4PageDynamicDataReqService = ServiceLocator.getService(Search4PageDynamicDataReqService.class, null);
 
    private static  FavorActivityGiftService favorActivityGiftService = ServiceLocator.getService(FavorActivityGiftService.class, null);
    
 
    private static  GiftOfReviewService giftOfReviewService = ServiceLocator.getService(GiftOfReviewService.class, null);
    
    private ChangeActivityStatusHttpRequest changeActivityStatusHttpRequest;

    @Autowired
    private PageShardingDalClient dalClient;

    @Autowired
    private PromotionBaseService promotionBaseService;

    @Autowired
    private CommonPromotionService commonPromotionService;
    
    @Autowired
    private CouponAccountService couponAccountService;
    
    @Autowired
    private ShopFavoriteCommonService shopFavoriteCommonService;
    
    @Autowired
    private ShopFavoriteGiftService shopFavoriteGiftService;
    
    
    @Autowired
    private ShopCouponTemplateSendService shopCouponTemplateSendService;
    
    @Autowired
    private OperateShopCouponExportService operateShopCouponExportService;
    
    @EsbEIHttpWired
    public void setChangeActivityStatusHttpRequest(ChangeActivityStatusHttpRequest changeActivityStatusHttpRequest) {
        this.changeActivityStatusHttpRequest = changeActivityStatusHttpRequest;
    }

    @Override
    public int getActivityCountByMonth(Map paramMap) {
        int count = 0;
        paramMap.put("activityType", CommonPromotionConstant.TYPE_13);
        if("P".equals(MapUtils.getString(paramMap, MPMSCommonConstant.SUPPLIER_TYPE))){
            paramMap.put("activityType", CommonPromotionConstant.TYPE_60);
        }
        SimpleDateFormat format1 = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
        SimpleDateFormat format2 = new SimpleDateFormat("yyyy-MM-dd 23:59:59");
        Calendar c = Calendar.getInstance();
        c.add(Calendar.MONTH, 0);
        c.set(Calendar.DAY_OF_MONTH, 1);// 设置为1号,当前日期既为本月第一天
        String firstTime = format1.format(c.getTime());
        // 获取当前月最后一天
        Calendar ca = Calendar.getInstance();
        ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
        String lastTime = format2.format(ca.getTime());
        paramMap.put("firstTime", firstTime);
        paramMap.put("lastTime", lastTime);
        List> countList = dalClient.queryForList(NAMESPACE + ".getActivityCountByMonth", paramMap);
        if (CollectionUtils.isNotEmpty(countList)) {
            count = Integer.parseInt(MapUtils.getString(countList.get(0), "activityCount"));
        }
        return count;
    }

    @Override
    public Map checkTime(Map paramMap) {
        Map returnMap = new HashMap();
        // 空为创建 “true”为编辑可以修改活动开始时间 “false”为编辑不能修改活动开始时间
        String timeFlag = MapUtils.getString(paramMap, "timeFlag");
        long endTime = DateUtils.formatStr2Date(MapUtils.getString(paramMap, "endTime")).getTime();
        long effectStartTime = DateUtils.formatStr2Date(MapUtils.getString(paramMap, "effectStartTime")).getTime();
        long effectEndTime = DateUtils.formatStr2Date(MapUtils.getString(paramMap, "effectEndTime")).getTime();
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd 00:00:00");
        String nowStr = format.format(new Date());
        Date nowDate = DateUtils.formatStr2Date(nowStr);
        long nowDateTime = nowDate.getTime();
        if (StringUtils.isEmpty(timeFlag)) {
            if (effectEndTime < endTime) {
                returnMap.put("flag", false);
                returnMap.put("errorMsg", "effectTimeErr1");
                return returnMap;
            }
            if ((effectEndTime - effectStartTime) > DEFAULTNUM || effectEndTime < effectStartTime) {
                returnMap.put("flag", false);
                returnMap.put("errorMsg", "effectTimeErr2");
                return returnMap;
            }
            if (effectStartTime < nowDateTime) {
                returnMap.put("flag", false);
                returnMap.put("errorMsg", "effectTimeErr3");
                return returnMap;
            }
        } else {
            if (effectEndTime < endTime) {
                returnMap.put("flag", false);
                returnMap.put("errorMsg", "timeErr4");
                return returnMap;
            }
        }

        returnMap.put("flag", true);
        return returnMap;
    }


    @Override
    public String insertPromotionInfo(Map paramMap) {
        String  activityCode = MapUtils.getString(paramMap, "activityCode");
        paramMap.put(CommonPromotionConstant.ACTIVITY_TYPE, CommonPromotionConstant.TYPE_13);
        paramMap.put(CommonPromotionConstant.ACTIVITY_CODE, activityCode);
        paramMap.put(CommonPromotionConstant.ACTIVITY_STATUS, CommonPromotionConstant.P01);
        paramMap.put(CommonPromotionConstant.AWARD_SET_CODE, MapUtils.getString(paramMap, "awardSetCode"));
        paramMap.put(CommonPromotionConstant.OPERATION_TYPE, "A");
        paramMap.put(CommonPromotionConstant.SEND_FLAG, "S10");
        paramMap.put(CommonPromotionConstant.DONATION_FLAG, "0");
        if (StringUtils.isBlank(MapUtils.getString(paramMap, CommonPromotionConstant.EXCLUDE_PRODUCT))) {
            paramMap.put(CommonPromotionConstant.EXCLUDE_PRODUCT, "0");
        }
        paramMap.put(CommonPromotionConstant.ACTIVITY_SHOW_MSG, setShowMsg(paramMap));
        paramMap.put(CommonPromotionConstant.DISCOUNT_NOTE, getDiscountNote(paramMap));

        String showRegion = MapUtils.getString(paramMap, CommonPromotionConstant.SHOW_REGION);
        if (StringUtils.isEmpty(showRegion)) {
            showRegion = "3";
        } else {
            showRegion += ",3";
        }
        paramMap.put(CommonPromotionConstant.SHOW_REGION, showRegion);
        try {
            savePromotionBase(paramMap);
            savePromotionAwardSet(paramMap);
            savePromotionCommSet(paramMap);
            savePromotionAccumulaty(paramMap);
            savePromotionRules(paramMap);
            sendCouponTemplate(paramMap);
        } catch (RuntimeException e) {
            logger.logException(e);
        }
        return activityCode;
    }
    
    @Override
    public Map insertPromotionInfoP(Map paramMap) {
        Map resultMap = new HashMap();
        String  activityCode = MapUtils.getString(paramMap, "activityCode");
        paramMap.put(CommonPromotionConstant.ACTIVITY_TYPE, CommonPromotionConstant.TYPE_60);
        paramMap.put(CommonPromotionConstant.ACTIVITY_CODE, activityCode);
        paramMap.put(CommonPromotionConstant.ACTIVITY_STATUS, CommonPromotionConstant.P00);
        paramMap.put(CommonPromotionConstant.AWARD_SET_CODE, MapUtils.getString(paramMap, "awardSetCode"));
        paramMap.put(CommonPromotionConstant.OPERATION_TYPE, "A");
        paramMap.put(CommonPromotionConstant.SEND_FLAG, "S10");
        paramMap.put(CommonPromotionConstant.DONATION_FLAG, "0");
        if (StringUtils.isBlank(MapUtils.getString(paramMap, CommonPromotionConstant.EXCLUDE_PRODUCT))) {
            paramMap.put(CommonPromotionConstant.EXCLUDE_PRODUCT, "0");
        }
        paramMap.put(CommonPromotionConstant.ACTIVITY_SHOW_MSG, setShowMsg(paramMap));
        paramMap.put(CommonPromotionConstant.DISCOUNT_NOTE, getDiscountNote(paramMap));

        String showRegion = MapUtils.getString(paramMap, CommonPromotionConstant.SHOW_REGION);
        if (StringUtils.isEmpty(showRegion)) {
            showRegion = "3";
        } else {
            showRegion += ",3";
        }
        paramMap.put(CommonPromotionConstant.SHOW_REGION, showRegion);
        try {
            savePromotionBaseP(paramMap);
            savePromotionAwardSet(paramMap);
            savePromotionAccumulaty(paramMap);
            savePromotionRules(paramMap);
        } catch (RuntimeException e) {
            logger.logException(e);
            throw new MpmsSystemException("券活动创建失败!"); // 回滚事务
        }
        
     // 冻结资源
        CouponAccountBean  activeCreateAddStopBean = new CouponAccountBean();
        BigDecimal rewardAmountB = new BigDecimal(MapUtils.getString(paramMap, CommonPromotionConstant.REWARD_AMOUNT));
        BigDecimal activityTimesLimitB = new BigDecimal(MapUtils.getString(paramMap, CommonPromotionConstant.ACTIVITY_TIMES_LIMIT));
        // 冻结金额
        BigDecimal operateAmount = rewardAmountB.multiply(activityTimesLimitB);
        // 操作流水号
        activeCreateAddStopBean.setSupplierCode(MapUtils.getString(paramMap, MPMSCommonConstant.SUPPLIER_CODE_P,""));
        activeCreateAddStopBean.setOperateNumber(EventNoUtil.getEventNum("MPMS"));
        activeCreateAddStopBean.setSopActiveId(activityCode);
        activeCreateAddStopBean.setTicketRuleId("");
        activeCreateAddStopBean.setActiveDescribe("活动专享券");
        // 1代表活动创建冻结金额
        activeCreateAddStopBean.setOperateFlag("1");
        activeCreateAddStopBean.setOperateAmount(operateAmount);
        activeCreateAddStopBean.setActiveStartTime(MapUtils.getString(paramMap, CommonPromotionConstant.START_TIME));
        
        
        // 记录流水封装实体参数
        PromotionResourceSerial promotionResourceSerial = new PromotionResourceSerial();
        promotionResourceSerial.setSerialNum(activeCreateAddStopBean.getOperateNumber());
        promotionResourceSerial.setSupplierCode(MapUtils.getString(paramMap, MPMSCommonConstant.SUPPLIER_CODE, ""));
        promotionResourceSerial.setBrandProviderCode(activeCreateAddStopBean.getSupplierCode());
        promotionResourceSerial.setActivityId("");
        promotionResourceSerial.setActivityCode(activeCreateAddStopBean.getSopActiveId());
        promotionResourceSerial.setOperateAmount(operateAmount);
        promotionResourceSerial.setActivityType(CommonPromotionConstant.TYPE_60);
        promotionResourceSerial.setCreateTime(DateUtils.formatDate2Str());
        promotionResourceSerial.setUpdateTime(DateUtils.formatDate2Str());
        promotionResourceSerial.setStartTime(activeCreateAddStopBean.getActiveStartTime());
        
        // 调用冻结接口
        CouponAccountBean couponAccountBean1 = couponAccountService.activeCreateAddStop(activeCreateAddStopBean);
        if("F".equals(couponAccountBean1.getReceiveFlag())){
         // 冻结金额失败【记录冻结流水】
            promotionResourceSerial.setOperateType(activeCreateAddStopBean.getOperateFlag());
            promotionResourceSerial.setRemark(couponAccountBean1.getActiveDescribe());
            promotionResourceSerial.setStatus("-1");// 状态  0:待处理(默认), 1:成功  -1:失败
            shopFavoriteCommonService.insertPromotionResourceSerial(promotionResourceSerial);
            resultMap.put("flag", false);
            resultMap.put("errorMsg", couponAccountBean1.getReceiveDescribe());
            resultMap.put("errorCode", "1");
        }else{
            // 冻结成功记录流水
            promotionResourceSerial.setOperateType(activeCreateAddStopBean.getOperateFlag());
            promotionResourceSerial.setRemark("活动创建冻结金额成功");
            promotionResourceSerial.setStatus("1");// 状态  0:待处理(默认), 1:成功  -1:失败
            shopFavoriteCommonService.insertPromotionResourceSerial(promotionResourceSerial);
            String xmlMessage = operateShopCouponExportService.createOrModifyShopCouponInfoP(paramMap,"1");
            Map responseMap = operateShopCouponExportService.send(xmlMessage);
            String flag = MapUtils.getString(responseMap, "flag","0");
            if("1".equals(flag)){//券创建成功
                String activityId = MapUtils.getString(responseMap, "activityId","");
                String activitySecretKey = MapUtils.getString(responseMap, "activitySecretKey","");
                String supplierCode = MapUtils.getString(paramMap, MPMSCommonConstant.SUPPLIER_CODE, "");
                paramMap.put("activityId", MapUtils.getString(responseMap, "activityId",""));
                paramMap.put("activitySecretKey", MapUtils.getString(responseMap, "activitySecretKey",""));
                // 更新活动状态
                shopFavoriteGiftService.updatePromotionBaseAndExpandData(supplierCode, activityCode, activityId, activitySecretKey);
                
                // 同步数据到数据超市
                sendCouponTemplate(paramMap);
                // 券规则ID通知接口
                CouponAccountBean ticketRuleIdNoticeBean =  couponAccountService.ticketRuleIdNotice(activeCreateAddStopBean.getSupplierCode(), activityCode, activityId);
                if("F".equals(ticketRuleIdNoticeBean.getReceiveFlag())){
                    // 券规则通知失败记录日志
                    snlogger.error("券规则ID通知失败,失败原因!" + ticketRuleIdNoticeBean.getReceiveDescribe()+"--店铺编码shopId:" + supplierCode);
                }
                resultMap.put("flag", true);
            }else{
                // 解冻[促销中心创建活动异常] 3代表活动创建失败解冻金额
                activeCreateAddStopBean.setOperateFlag("3");
                CouponAccountBean couponAccountBean3 = couponAccountService.activeCreateAddStop(activeCreateAddStopBean);
                // 记录解冻日志记录
                if("F".equals(couponAccountBean3.getReceiveFlag())){
                    // 解冻记录流水
                    promotionResourceSerial.setOperateType(activeCreateAddStopBean.getOperateFlag());
                    promotionResourceSerial.setRemark(couponAccountBean3.getReceiveDescribe());
                    promotionResourceSerial.setStatus("-1");// 状态  0:待处理(默认), 1:成功  -1:失败
                    shopFavoriteCommonService.insertPromotionResourceSerial(promotionResourceSerial);
                    resultMap.put("errorMsg", couponAccountBean3.getReceiveDescribe());
                }else{
                    // 解冻成功记录流水
                    promotionResourceSerial.setOperateType(activeCreateAddStopBean.getOperateFlag());
                    promotionResourceSerial.setRemark("活动创建失败解冻金额成功");
                    promotionResourceSerial.setStatus("1");// 状态  0:待处理(默认), 1:成功  -1:失败
                    shopFavoriteCommonService.insertPromotionResourceSerial(promotionResourceSerial);
                    resultMap.put("errorMsg", MapUtils.getString(responseMap, "message",""));
                }
                resultMap.put("flag", false);
                resultMap.put("errorCode", "1");
            }
        }
        
        return resultMap;
    }

 
    private void sendCouponTemplate(Map paramMap) {
        //判断券模版类型:03会员超市
        if("03".equals(paramMap.get("assignedRole"))){
            CouponTemplate couponTemplate=new CouponTemplate();
            //劵编码
            couponTemplate.setCouponCode(MapUtils.getString(paramMap, ACTIVITY_ID));
            //劵名称
            couponTemplate.setCouponName(MapUtils.getString(paramMap, "activityName"));
            //奖励触发事件c商家"31"代运营商家"63"
            if("P".equals(MapUtils.getString(paramMap, MPMSCommonConstant.SUPPLIER_TYPE))){
                //店铺编码
                couponTemplate.setSupplierCode(MapUtils.getString(paramMap, MPMSCommonConstant.SUPPLIER_CODE_P));
                couponTemplate.setBonusTrigerId("63");
            } else{
                couponTemplate.setBonusTrigerId("31");
                //店铺编码
                couponTemplate.setSupplierCode(MapUtils.getString(paramMap, MPMSCommonConstant.SUPPLIER_CODE));
            }
            //劵密钥
            couponTemplate.setSecretKey(MapUtils.getString(paramMap, "activitySecretKey"));
            //金额
            couponTemplate.setAmmount(MapUtils.getString(paramMap, "rewardAmount"));
            //使用门槛
            couponTemplate.setUseThreshold(MapUtils.getString(paramMap, "baseAmount"));
            //有效期
            couponTemplate.setValidateTime(MapUtils.getString(paramMap, "effectEndTime"));
            //创建时间 定向发劵活动创建时间就是活动开始时间
            couponTemplate.setCreateTime(MapUtils.getString(paramMap, "startTime"));
            List couponTemplateList= new ArrayList();
            couponTemplateList.add(couponTemplate);
            //调用发送接口
            shopCouponTemplateSendService.syncCouponTemplateInfo(couponTemplateList);
        }
        
    }
    private String getDiscountNote(Map paramMap) {
        Map supplyInfoMap = userInfoService.getSupplyinfoByCode(paramMap);
        String showMsg = "";
        String baseAmount = MapUtils.getString(paramMap, CommonPromotionConstant.BASE_AMOUNT);
        if("K".equals(MapUtils.getString(supplyInfoMap, MPMSCommonConstant.SUPPLIER_TYPE,""))){
            if (StringUtils.isNotBlank(baseAmount) && Integer.parseInt(baseAmount) > 0) {
                showMsg += "满" + baseAmount + "元使用,限部分商品使用";
            } else {
                showMsg += "无订单金额限制,限部分商品使用";
                
            }
        }else{            
            if (StringUtils.isNotBlank(baseAmount) && Integer.parseInt(baseAmount) > 0) {
                showMsg += "满" + baseAmount + "元使用,";
            } else {
                showMsg += "无订单金额限制,";
                
            }
            if ("N".equals(MapUtils.getString(paramMap, CommonPromotionConstant.IS_SHOP))) {
                showMsg += "限该店铺内部分商品使用";
            } else {
                showMsg += "限该店铺内使用";
                if ("1".equals(MapUtils.getString(paramMap, CommonPromotionConstant.EXCLUDE_PRODUCT))) {
                    showMsg += ",部分商品不参与用券";
                }
            }
        }
        return showMsg;
    }

    private String setShowMsg(Map paramMap) {
        String discountNote = "";
        String rewardAmount = MapUtils.getString(paramMap, CommonPromotionConstant.REWARD_AMOUNT);
        String couponType = MapUtils.getString(paramMap, CommonPromotionConstant.COUPON_TYPE);
        if ("1".equals(couponType)) {
            discountNote = "店铺云券(" + rewardAmount + "元)";
        } else {
            discountNote = "店铺易券(" + rewardAmount + "元)";
        }
        return discountNote;
    }


    @SuppressWarnings("unchecked")
    private void savePromotionBase(Map paramMap) {
        Map[] paramArray = new HashMap[0];
        Map param = new HashMap();
        param.put(CommonPromotionConstant.ACTIVITY_CODE,
                MapUtils.getString(paramMap, CommonPromotionConstant.ACTIVITY_CODE));
        param.put(CommonPromotionConstant.ACTIVITY_TYPE, CommonPromotionConstant.TYPE_13);
        param.put(CommonPromotionConstant.ACTIVITY_NAME,
                MapUtils.getString(paramMap, CommonPromotionConstant.ACTIVITY_NAME));
        param.put(CommonPromotionConstant.ACTIVITY_SHOW_MSG,
                MapUtils.getString(paramMap, CommonPromotionConstant.ACTIVITY_SHOW_MSG));
        param.put(CommonPromotionConstant.WARM_UP_TIME, "");
        param.put(CommonPromotionConstant.START_TIME, MapUtils.getString(paramMap, CommonPromotionConstant.START_TIME));
        param.put(CommonPromotionConstant.END_TIME, MapUtils.getString(paramMap, CommonPromotionConstant.END_TIME));
        param.put(CommonPromotionConstant.ACTIVITY_STATUS,
                MapUtils.getString(paramMap, CommonPromotionConstant.ACTIVITY_STATUS));
        param.put(CommonPromotionConstant.IS_CYCLE_TIME, "");
        param.put(CommonPromotionConstant.EVERY_START_TIME, "");
        param.put(CommonPromotionConstant.EVERY_END_TIME, "");
        param.put(CommonPromotionConstant.CYCLE_TIME_TYPE, "");
        param.put(CommonPromotionConstant.CYCLE_TIME_VALUE, "");
        param.put(CommonPromotionConstant.DYNAMIC_TIME, "");
        param.put(CommonPromotionConstant.DYNAMIC_DISTANCE_TIME_DELAY, "");
        param.put(CommonPromotionConstant.IS_ALL_CHANNEL, "N");

        // 获取渠道
        Object channelInfoObj = MapUtils.getObject(paramMap, CommonPromotionConstant.CHANNEL_INFO);
        // 判断是否只有一个渠道
        if (channelInfoObj instanceof String) {
            param.put(CommonPromotionConstant.CHANNEL_INFO,
                    MapUtils.getString(paramMap, CommonPromotionConstant.CHANNEL_INFO));
        } else {
            String[] channelInfoArr = (String[]) MapUtils.getObject(paramMap, CommonPromotionConstant.CHANNEL_INFO);
            String channelInfos = "";
            if (ArrayUtils.isNotEmpty(channelInfoArr)) {
                for (String channelInfo : channelInfoArr) {
                    channelInfos += channelInfo + ",";
                }
                channelInfos = channelInfos.substring(0, channelInfos.length() - 1);
            }
            param.put(CommonPromotionConstant.CHANNEL_INFO, channelInfos);
        }

        // param.put(CommonPromotionConstant.CHANNEL_INFO, "31");
        param.put(CommonPromotionConstant.IS_ALL_AREA, "");
        param.put(CommonPromotionConstant.ACTIVITY_SCOPE_TYPE, "");
        param.put(CommonPromotionConstant.AREA, "");
        param.put(CommonPromotionConstant.CUSTOMERS, "");
        param.put(CommonPromotionConstant.CUSTOMERS_CODE, "");
        param.put(CommonPromotionConstant.NOTICE_TYPE, "");
        param.put(CommonPromotionConstant.NOTICE_MSG, "");
        param.put(CommonPromotionConstant.IS_LIMIT, "");
        param.put(CommonPromotionConstant.ACTIVITY_TIMES_LIMIT,
                MapUtils.getString(paramMap, CommonPromotionConstant.ACTIVITY_TIMES_LIMIT));
        param.put(CommonPromotionConstant.DAY_TIMES_LIMIT, "");
        param.put(CommonPromotionConstant.PEOPLE_ACTIVITY_TIMES_LIMIT,
                MapUtils.getString(paramMap, CommonPromotionConstant.PEOPLE_ACTIVITY_TIMES_LIMIT));
        param.put(CommonPromotionConstant.PEOPLE_DAY_TIMES_LIMIT, "");
        param.put(CommonPromotionConstant.ALL_QUOTA_LIMIT, "");
        param.put(CommonPromotionConstant.DAY_QUOTA_LIMIT, "");
        param.put(CommonPromotionConstant.PEOPLE_DAY_QUOTA_LIMIT, "");
        param.put(CommonPromotionConstant.PEOPLE_QUOTA_LIMIT, "");
        param.put(CommonPromotionConstant.MIN_LIMIT, "");
        param.put(CommonPromotionConstant.MAX_LIMIT, "");
        param.put(CommonPromotionConstant.ACCOUNT_LIMIT_TYPE, "");
        param.put(CommonPromotionConstant.DISTRIBUTION_LIMIT_TYPE, "");
        param.put(CommonPromotionConstant.PAYMENT_TYPE, "");
        param.put(CommonPromotionConstant.SUPPLIER_CODE,
                MapUtils.getString(paramMap, CommonPromotionConstant.SUPPLIER_CODE));
        param.put(CommonPromotionConstant.EXCLUDE_PRODUCT,
                MapUtils.getString(paramMap, CommonPromotionConstant.EXCLUDE_PRODUCT));
        param.put(CommonPromotionConstant.IS_SHOP, MapUtils.getString(paramMap, CommonPromotionConstant.IS_SHOP));
        param.put(CommonPromotionConstant.ACTIVITY_PATTERN,
                MapUtils.getString(paramMap, CommonPromotionConstant.ACTIVITY_PATTERN));

        // 获取渠道
        Object showRegion = MapUtils.getObject(paramMap, CommonPromotionConstant.SHOW_REGION);
        // 判断是否只有一个渠道
        if (showRegion instanceof String) {
            param.put(CommonPromotionConstant.SHOW_REGION, showRegion);
        } else {
            String[] showRegionArr = (String[]) MapUtils.getObject(paramMap, CommonPromotionConstant.SHOW_REGION);
            String showRegions = "";
            if (ArrayUtils.isNotEmpty(showRegionArr)) {
                for (String channelInfo : showRegionArr) {
                    showRegions += channelInfo + ",";
                }
                showRegions = showRegions.substring(0, showRegions.length() - 1);
            }
            param.put(CommonPromotionConstant.SHOW_REGION, showRegions);
        }
        param.put(CommonPromotionConstant.DONATION_FLAG,
                MapUtils.getString(paramMap, CommonPromotionConstant.DONATION_FLAG));
        param.put(CommonPromotionConstant.ASSIGNED_ROLE,
                MapUtils.getString(paramMap, CommonPromotionConstant.ASSIGNED_ROLE));
        // 增加活动id和密钥
        param.put(ACTIVITY_ID,MapUtils.getString(paramMap, ACTIVITY_ID));
        param.put("activitySecretKey",MapUtils.getString(paramMap, "activitySecretKey"));
        paramArray = ArrayUtils.add(paramArray, param);
        promotionBaseService.saveOperatePromotionBase(paramArray);
        promotionBaseService.saveOperatePromotionBaseExpand(paramArray);
    }
    
    @SuppressWarnings("unchecked")
    private void savePromotionBaseP(Map paramMap) {
        Map[] paramArray = new HashMap[0];
        Map param = new HashMap();
        param.put(CommonPromotionConstant.ACTIVITY_CODE,
                MapUtils.getString(paramMap, CommonPromotionConstant.ACTIVITY_CODE));
        param.put(CommonPromotionConstant.ACTIVITY_TYPE, CommonPromotionConstant.TYPE_60);
        param.put(CommonPromotionConstant.ACTIVITY_NAME,
                MapUtils.getString(paramMap, CommonPromotionConstant.ACTIVITY_NAME));
        param.put(CommonPromotionConstant.ACTIVITY_SHOW_MSG,
                MapUtils.getString(paramMap, CommonPromotionConstant.ACTIVITY_SHOW_MSG));
        param.put(CommonPromotionConstant.ACTIVITY_SHOW_MSG_K,
                MapUtils.getString(paramMap, CommonPromotionConstant.ACTIVITY_SHOW_MSG_K));
        param.put(CommonPromotionConstant.WARM_UP_TIME, "");
        param.put(CommonPromotionConstant.START_TIME, MapUtils.getString(paramMap, CommonPromotionConstant.START_TIME));
        param.put(CommonPromotionConstant.END_TIME, MapUtils.getString(paramMap, CommonPromotionConstant.END_TIME));
        param.put(CommonPromotionConstant.ACTIVITY_STATUS,
                MapUtils.getString(paramMap, CommonPromotionConstant.ACTIVITY_STATUS));
        param.put(CommonPromotionConstant.IS_CYCLE_TIME, "");
        param.put(CommonPromotionConstant.EVERY_START_TIME, MapUtils.getString(paramMap, CommonPromotionConstant.EVERY_START_TIME, ""));
        param.put(CommonPromotionConstant.EVERY_END_TIME, MapUtils.getString(paramMap, CommonPromotionConstant.EVERY_END_TIME, ""));
        param.put(CommonPromotionConstant.CYCLE_TIME_TYPE, "");
        param.put(CommonPromotionConstant.CYCLE_TIME_VALUE, "");
        param.put(CommonPromotionConstant.DYNAMIC_TIME, "");
        param.put(CommonPromotionConstant.DYNAMIC_DISTANCE_TIME_DELAY, "");
        param.put(CommonPromotionConstant.IS_ALL_CHANNEL, "N");

        // 获取渠道
        Object channelInfoObj = MapUtils.getObject(paramMap, CommonPromotionConstant.CHANNEL_INFO);
        // 判断是否只有一个渠道
        if (channelInfoObj instanceof String) {
            param.put(CommonPromotionConstant.CHANNEL_INFO,
                    MapUtils.getString(paramMap, CommonPromotionConstant.CHANNEL_INFO));
        } else {
            String[] channelInfoArr = (String[]) MapUtils.getObject(paramMap, CommonPromotionConstant.CHANNEL_INFO);
            String channelInfos = "";
            if (ArrayUtils.isNotEmpty(channelInfoArr)) {
                for (String channelInfo : channelInfoArr) {
                    channelInfos += channelInfo + ",";
                }
                channelInfos = channelInfos.substring(0, channelInfos.length() - 1);
            }
            param.put(CommonPromotionConstant.CHANNEL_INFO, channelInfos);
        }

        param.put(CommonPromotionConstant.IS_ALL_AREA, "");
        param.put(CommonPromotionConstant.ACTIVITY_SCOPE_TYPE, "");
        param.put(CommonPromotionConstant.AREA, "");
        param.put(CommonPromotionConstant.CUSTOMERS, "");
        param.put(CommonPromotionConstant.CUSTOMERS_CODE, "");
        param.put(CommonPromotionConstant.NOTICE_TYPE, "");
        param.put(CommonPromotionConstant.NOTICE_MSG, "");
        param.put(CommonPromotionConstant.IS_LIMIT, "");
        param.put(CommonPromotionConstant.ACTIVITY_TIMES_LIMIT,
                MapUtils.getString(paramMap, CommonPromotionConstant.ACTIVITY_TIMES_LIMIT));
        param.put(CommonPromotionConstant.DAY_TIMES_LIMIT, MapUtils.getString(paramMap, CommonPromotionConstant.DAY_TIMES_LIMIT));
        param.put(CommonPromotionConstant.PEOPLE_ACTIVITY_TIMES_LIMIT,
                MapUtils.getString(paramMap, CommonPromotionConstant.PEOPLE_ACTIVITY_TIMES_LIMIT));
        param.put(CommonPromotionConstant.PEOPLE_DAY_TIMES_LIMIT, "");
        param.put(CommonPromotionConstant.ALL_QUOTA_LIMIT, "");
        param.put(CommonPromotionConstant.DAY_QUOTA_LIMIT, "");
        param.put(CommonPromotionConstant.PEOPLE_DAY_QUOTA_LIMIT, "");
        param.put(CommonPromotionConstant.PEOPLE_QUOTA_LIMIT, "");
        param.put(CommonPromotionConstant.MIN_LIMIT, "");
        param.put(CommonPromotionConstant.MAX_LIMIT, "");
        param.put(CommonPromotionConstant.ACCOUNT_LIMIT_TYPE, "");
        param.put(CommonPromotionConstant.DISTRIBUTION_LIMIT_TYPE, "");
        param.put(CommonPromotionConstant.PAYMENT_TYPE, "");
        param.put(CommonPromotionConstant.SUPPLIER_CODE,
                MapUtils.getString(paramMap, CommonPromotionConstant.SUPPLIER_CODE));
        param.put(CommonPromotionConstant.EXCLUDE_PRODUCT,
                MapUtils.getString(paramMap, CommonPromotionConstant.EXCLUDE_PRODUCT));
        param.put(CommonPromotionConstant.IS_SHOP, MapUtils.getString(paramMap, CommonPromotionConstant.IS_SHOP));
        param.put(CommonPromotionConstant.ACTIVITY_PATTERN,
                MapUtils.getString(paramMap, CommonPromotionConstant.ACTIVITY_PATTERN));

        // 获取渠道
        Object showRegion = MapUtils.getObject(paramMap, CommonPromotionConstant.SHOW_REGION);
        // 判断是否只有一个渠道
        if (showRegion instanceof String) {
            param.put(CommonPromotionConstant.SHOW_REGION, showRegion);
        } else {
            String[] showRegionArr = (String[]) MapUtils.getObject(paramMap, CommonPromotionConstant.SHOW_REGION);
            String showRegions = "";
            if (ArrayUtils.isNotEmpty(showRegionArr)) {
                for (String channelInfo : showRegionArr) {
                    showRegions += channelInfo + ",";
                }
                showRegions = showRegions.substring(0, showRegions.length() - 1);
            }
            param.put(CommonPromotionConstant.SHOW_REGION, showRegions);
        }
        param.put(CommonPromotionConstant.DONATION_FLAG,
                MapUtils.getString(paramMap, CommonPromotionConstant.DONATION_FLAG));
        param.put(CommonPromotionConstant.ASSIGNED_ROLE,
                MapUtils.getString(paramMap, CommonPromotionConstant.ASSIGNED_ROLE));
        param.put("supplierType", MapUtils.getString(paramMap, CommonPromotionConstant.SUPPLIER_TYPE,""));
        param.put("supplierCodeP", MapUtils.getString(paramMap, MPMSCommonConstant.SUPPLIER_CODE_P,""));
        paramArray = ArrayUtils.add(paramArray, param);
        promotionBaseService.savePromotionBaseP(paramArray);
        promotionBaseService.savePromotionBaseExpandP(paramArray);
    }



    @SuppressWarnings("unchecked")
    private void savePromotionAwardSet(Map paramMap) {
        Map[] paramArray = new HashMap[0];
        Map param = new HashMap();
        param.put(CommonPromotionConstant.ACTIVITY_CODE,
                MapUtils.getString(paramMap, CommonPromotionConstant.ACTIVITY_CODE));
        param.put(CommonPromotionConstant.AWARD_SET_CODE,
                MapUtils.getString(paramMap, CommonPromotionConstant.AWARD_SET_CODE));
        param.put(CommonPromotionConstant.REWARD_PROVIDE_TYPE, "13");
        param.put(CommonPromotionConstant.SUPPLIER_CODE,
                MapUtils.getString(paramMap, CommonPromotionConstant.SUPPLIER_CODE));
        paramArray = ArrayUtils.add(paramArray, param);
        promotionBaseService.savePromotionAwardSet(paramArray);
    }

    @Override
    public void updatePromotionStatus(Map paramMap) {
        dalClient.execute(NAMESPACE + ".updatePromotionStatus", paramMap);
    }
    
    @Override
    public void updatePromotionActivityId(Map paramMap){
        dalClient.execute(NAMESPACE + ".updatePromotionCouponId", paramMap);
        dalClient.execute(NAMESPACE + ".updatePromotionSecretKey", paramMap);
    }


    @SuppressWarnings("unchecked")
    private void savePromotionCommSet(Map paramMap) {
        Object obj = MapUtils.getObject(paramMap, CommonPromotionConstant.PRODUCT_CODE);
        Map[] paramArray = new HashMap[0];
        if (obj instanceof String) {
            Map param = new HashMap();
            param.put(CommonPromotionConstant.COMMODITY_SET_CODE,
                    MapUtils.getString(paramMap, CommonPromotionConstant.AWARD_SET_CODE));
            param.put(CommonPromotionConstant.COMMODITY_SET_TYPE, "");
            param.put(CommonPromotionConstant.PRODUCT_TYPE,
                    MapUtils.getString(paramMap, CommonPromotionConstant.PRODUCT_TYPE));
            param.put(CommonPromotionConstant.PRODUCT_CODE,
                    MapUtils.getString(paramMap, CommonPromotionConstant.PRODUCT_CODE));
            param.put(CommonPromotionConstant.PARENT_PRODUCT_CODE,
                    MapUtils.getString(paramMap, CommonPromotionConstant.PARENT_PRODUCT_CODE));
            param.put(CommonPromotionConstant.OPERATE_TYPE, "1");
            param.put(CommonPromotionConstant.SUPPLIER_CODE,
                    MapUtils.getString(paramMap, CommonPromotionConstant.SUPPLIER_CODE));
            param.put(CommonPromotionConstant.CATEGORY_CODE,
                    MapUtils.getString(paramMap, CommonPromotionConstant.CATEGORY_CODE));
            param.put(CommonPromotionConstant.BRAND_CODE,
                    MapUtils.getString(paramMap, CommonPromotionConstant.BRAND_CODE));
            param.put(CommonPromotionConstant.PRODUCT_NAME,
                    MapUtils.getString(paramMap, CommonPromotionConstant.PRODUCT_NAME));
            param.put(CommonPromotionConstant.RELATION_FLAG, "");
            paramArray = ArrayUtils.add(paramArray, param);
        } else {
            String[] productCodes = (String[]) paramMap.get(CommonPromotionConstant.PRODUCT_CODE);
            String[] productTypes = (String[]) paramMap.get(CommonPromotionConstant.PRODUCT_TYPE);
            String[] parentProductCodes = (String[]) paramMap.get(CommonPromotionConstant.PARENT_PRODUCT_CODE);
            String[] categoryCodes = (String[]) paramMap.get(CommonPromotionConstant.CATEGORY_CODE);
            String[] brandCodes = (String[]) paramMap.get(CommonPromotionConstant.BRAND_CODE);
            String[] prodcutNames = (String[]) paramMap.get(CommonPromotionConstant.PRODUCT_NAME);
            if (ArrayUtils.isNotEmpty(productCodes)) {
                for (int i = 0; i < productCodes.length; i++) {
                    Map param = new HashMap();
                    param.put(CommonPromotionConstant.COMMODITY_SET_CODE,
                            MapUtils.getString(paramMap, CommonPromotionConstant.AWARD_SET_CODE));
                    param.put(CommonPromotionConstant.COMMODITY_SET_TYPE, "");
                    param.put(CommonPromotionConstant.PRODUCT_TYPE, productTypes[i] == null ? "" : productTypes[i]);
                    param.put(CommonPromotionConstant.PRODUCT_CODE, productCodes[i] == null ? "" : productCodes[i]);
                    param.put(CommonPromotionConstant.PARENT_PRODUCT_CODE, parentProductCodes[i] == null ? ""
                            : parentProductCodes[i]);
                    param.put(CommonPromotionConstant.OPERATE_TYPE, "1");
                    param.put(CommonPromotionConstant.SUPPLIER_CODE,
                            MapUtils.getString(paramMap, CommonPromotionConstant.SUPPLIER_CODE));
                    param.put(CommonPromotionConstant.CATEGORY_CODE, categoryCodes[i] == null ? "" : categoryCodes[i]);
                    param.put(CommonPromotionConstant.BRAND_CODE, brandCodes[i] == null ? "" : brandCodes[i]);
                    param.put(CommonPromotionConstant.PRODUCT_NAME, prodcutNames[i] == null ? "" : prodcutNames[i]);
                    param.put(CommonPromotionConstant.RELATION_FLAG, "");
                    paramArray = ArrayUtils.add(paramArray, param);
                }
            }

        }
        promotionBaseService.savePromotionCommSet(paramArray);
    }

    @SuppressWarnings("unchecked")
    private void savePromotionAccumulaty(Map paramMap) {
        Map[] paramArray = new HashMap[0];
        Map param = new HashMap();
        param.put(CommonPromotionConstant.AWARD_SET_CODE,
                MapUtils.getString(paramMap, CommonPromotionConstant.AWARD_SET_CODE));
        param.put(CommonPromotionConstant.LEVEL_NUMBER, "1");
        param.put(CommonPromotionConstant.LEVEL_CODE,
                MapUtils.getString(paramMap, CommonPromotionConstant.AWARD_SET_CODE) + "1");
        param.put(CommonPromotionConstant.BASE_ADDUP_TYPE, "1");
        param.put(CommonPromotionConstant.BASE_AMOUNT,
                MapUtils.getString(paramMap, CommonPromotionConstant.BASE_AMOUNT));
        param.put(CommonPromotionConstant.BASE_QUANTIFIER_TYPE, "1");
        param.put(CommonPromotionConstant.SUPPLIER_CODE,
                MapUtils.getString(paramMap, CommonPromotionConstant.SUPPLIER_CODE));
        paramArray = ArrayUtils.add(paramArray, param);
        promotionBaseService.savePromotionAccumulaty(paramArray);
    }


    @SuppressWarnings("unchecked")
    private void savePromotionRules(Map paramMap) {
        Map[] paramArray = new HashMap[0];
        Map param = new HashMap();
        param.put(CommonPromotionConstant.LEVEL_CODE,
                MapUtils.getString(paramMap, CommonPromotionConstant.AWARD_SET_CODE) + "1");
        param.put(CommonPromotionConstant.REWARD_TYPE, "2");
        param.put(CommonPromotionConstant.REWARD_ADDUP_TYPE, "1");
        param.put(CommonPromotionConstant.REWARD_AMOUNT,
                MapUtils.getString(paramMap, CommonPromotionConstant.REWARD_AMOUNT));
        param.put(CommonPromotionConstant.REWARD_QUANTIFIER_TYPE, "1");
        param.put(CommonPromotionConstant.MAX_REWARD_AMOUNT, "");
        param.put(CommonPromotionConstant.MIN_REWARD_AMOUNT, "");
        param.put(CommonPromotionConstant.PROVINCE_CODE, "");
        param.put(CommonPromotionConstant.GIFT_SELECT_AMOUNT, "");
        param.put(CommonPromotionConstant.SINGLE_MAX_REWARD_AMOUNT, "");
        param.put(CommonPromotionConstant.NOTICE_TYPE, "");
        param.put(CommonPromotionConstant.NOTICE_MSG, "");
        param.put(CommonPromotionConstant.DISCOUNT_NOTE,
                MapUtils.getString(paramMap, CommonPromotionConstant.DISCOUNT_NOTE));
        param.put(CommonPromotionConstant.ACTIVITY_TIMES_LIMIT, "");
        param.put(CommonPromotionConstant.DAY_TIMES_LIMIT, "");
        param.put(CommonPromotionConstant.PEOPLE_ACTIVITY_TIMES_LIMIT, "");
        param.put(CommonPromotionConstant.PEOPLE_DAY_TIMES_LIMIT, "");
        param.put(CommonPromotionConstant.ALL_QUOTA_LIMIT, "");
        param.put(CommonPromotionConstant.DAY_QUOTA_LIMIT, "");
        param.put(CommonPromotionConstant.PEOPLE_DAY_QUOTA_LIMIT, "");
        param.put(CommonPromotionConstant.PEOPLE_QUOTA_LIMIT, "");
        param.put(CommonPromotionConstant.COUPON_TYPE,
                MapUtils.getString(paramMap, CommonPromotionConstant.COUPON_TYPE));
        param.put(CommonPromotionConstant.COUPON_NO, "");
        param.put(CommonPromotionConstant.COUPON_FORM, "");
        param.put(CommonPromotionConstant.SUPPLIER_CODE,
                MapUtils.getString(paramMap, CommonPromotionConstant.SUPPLIER_CODE));
        param.put(CommonPromotionConstant.EFFECT_START_TIME,
                MapUtils.getString(paramMap, CommonPromotionConstant.EFFECT_START_TIME));
        param.put(CommonPromotionConstant.EFFECT_END_TIME,
                MapUtils.getString(paramMap, CommonPromotionConstant.EFFECT_END_TIME));
        paramArray = ArrayUtils.add(paramArray, param);
        promotionBaseService.savePromotionRules(paramArray);

    }

    /**
     *
     * 功能描述: 保存促销接口记录表

     * 〈功能详细描述〉
     *
     * @param paramMap
     * @see [相关类/方法](可选)
     * @since [产品/模块版本](可选)
     */
    public void savePromotionIntfRecord(Map paramMap) {
        Map param = new HashMap();
        param.put(CommonPromotionConstant.ACTIVITY_CODE,
                MapUtils.getString(paramMap, CommonPromotionConstant.ACTIVITY_CODE, ""));
        param.put(CommonPromotionConstant.ACTIVITY_TYPE,
                MapUtils.getString(paramMap, CommonPromotionConstant.ACTIVITY_TYPE, CommonPromotionConstant.TYPE_13));
        param.put(CommonPromotionConstant.OPERATION_TYPE,
                MapUtils.getString(paramMap, CommonPromotionConstant.OPERATION_TYPE, ""));
        param.put(CommonPromotionConstant.OPERATE_NAME,
                MapUtils.getString(paramMap, CommonPromotionConstant.USER_NAME, ""));
        param.put(CommonPromotionConstant.OPERATION_DESC,
                MapUtils.getString(paramMap, CommonPromotionConstant.OPERATION_DESC, ""));
        param.put(CommonPromotionConstant.IP_ADDRESS, CodeUtil.getIPAddress(paramMap));
        param.put(CommonPromotionConstant.SUPPLIER_CODE,
                MapUtils.getString(paramMap, CommonPromotionConstant.SUPPLIER_CODE));
        param.put(CommonPromotionConstant.SEND_FLAG,
                MapUtils.getString(paramMap, CommonPromotionConstant.SEND_FLAG, ""));
        param.put(CommonPromotionConstant.RECEVE_FLAG,
                MapUtils.getString(paramMap, CommonPromotionConstant.RECEVE_FLAG, "I")); // 默认I,创建和修改
        param.put(CommonPromotionConstant.FAIL_REASION,
                MapUtils.getString(paramMap, CommonPromotionConstant.FAIL_REASION, ""));
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        param.put(CommonPromotionConstant.SEND_TIME, sdf.format(new Date()));
        param.put(CommonPromotionConstant.RECEVE_TIME, null);
        Number num = promotionBaseService.savePromotionIntfRecord4PrimaryKey(param);
        paramMap.put("versionNum", num);
    }
    
    public Number doVersionNum(Map paramMap, String operationType, String operationDesc) {
        Map param = new HashMap();
        param.put(CommonPromotionConstant.ACTIVITY_CODE, MapUtils.getString(paramMap, CommonPromotionConstant.ACTIVITY_CODE, ""));
        param.put(CommonPromotionConstant.ACTIVITY_TYPE, MapUtils.getString(paramMap, CommonPromotionConstant.ACTIVITY_TYPE, CommonPromotionConstant.TYPE_13));
        param.put(CommonPromotionConstant.OPERATION_TYPE, operationType);
        param.put(CommonPromotionConstant.OPERATION_DESC, operationDesc);
        param.put(CommonPromotionConstant.SEND_FLAG, "S20");
        param.put(CommonPromotionConstant.RECEVE_FLAG, "S");
        param.put(CommonPromotionConstant.OPERATE_NAME, MapUtils.getString(paramMap, CommonPromotionConstant.USER_NAME, ""));
        param.put(CommonPromotionConstant.IP_ADDRESS, CodeUtil.getIPAddress(paramMap));
        param.put(CommonPromotionConstant.SUPPLIER_CODE, MapUtils.getString(paramMap, CommonPromotionConstant.SUPPLIER_CODE));
        param.put(CommonPromotionConstant.FAIL_REASION, MapUtils.getString(paramMap, CommonPromotionConstant.FAIL_REASION, ""));
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        param.put(CommonPromotionConstant.SEND_TIME, sdf.format(new Date()));
        param.put(CommonPromotionConstant.RECEVE_TIME, sdf.format(new Date()));
        Number num = promotionBaseService.savePromotionIntfRecord4PrimaryKey(param);
        return num;
    }
    
    public Number doVersionNumModify(Map paramMap, String operationType, String operationDesc) {
        Map param = new HashMap();
        param.put(CommonPromotionConstant.ACTIVITY_CODE, MapUtils.getString(paramMap, CommonPromotionConstant.ACTIVITY_CODE, ""));
        if("P".equals(MapUtils.getString(paramMap, MPMSCommonConstant.SUPPLIER_TYPE,""))){
            param.put(CommonPromotionConstant.ACTIVITY_TYPE, MapUtils.getString(paramMap, CommonPromotionConstant.ACTIVITY_TYPE, CommonPromotionConstant.TYPE_60));
        }else{            
            param.put(CommonPromotionConstant.ACTIVITY_TYPE, MapUtils.getString(paramMap, CommonPromotionConstant.ACTIVITY_TYPE, CommonPromotionConstant.TYPE_13));
        }
        param.put(CommonPromotionConstant.OPERATION_TYPE, operationType);
        param.put(CommonPromotionConstant.OPERATION_DESC, operationDesc);
        param.put(CommonPromotionConstant.SEND_FLAG, "S20");
        param.put(CommonPromotionConstant.RECEVE_FLAG, "S");
        param.put(CommonPromotionConstant.OPERATE_NAME, MapUtils.getString(paramMap, CommonPromotionConstant.USER_NAME, ""));
        param.put(CommonPromotionConstant.IP_ADDRESS, CodeUtil.getIPAddress(paramMap));
        param.put(CommonPromotionConstant.SUPPLIER_CODE, MapUtils.getString(paramMap, CommonPromotionConstant.SUPPLIER_CODE));
        param.put(CommonPromotionConstant.FAIL_REASION, MapUtils.getString(paramMap, CommonPromotionConstant.FAIL_REASION, ""));
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        param.put(CommonPromotionConstant.SEND_TIME, sdf.format(new Date()));
        param.put(CommonPromotionConstant.RECEVE_TIME, sdf.format(new Date()));
        //暂时用这个字段存放吧
        param.put("activityName", MapUtils.getString(paramMap, "oldActivityTimesLimit",""));
        param.put("editActivityName", MapUtils.getString(paramMap, "activityTimesLimit", ""));
        Number num = promotionBaseService.savePromotionIntfRecord4PrimaryKey(param);
        return num;
    }

    @Override
    public List> getPromotionProdById(Map paramMap) {
        List> prodList = promotionBaseService.getPromotionProdById(paramMap);
        List> addProdList = new ArrayList>();
        String supplierCode = MapUtils.getString(paramMap, "supplierCode");
        if (CollectionUtils.isNotEmpty(prodList)) {
            for (Map prodInfo : prodList) {
                if ("01".equals(MapUtils.getString(prodInfo, "productType"))) {
                    prodInfo.put("supplierCode", MapUtils.getString(paramMap, "supplierCode"));
                    // prodInfo.put("parentCode", MapUtils.getString(prodInfo, "parentProductCode"));
                    prodInfo.put("productCodes", MapUtils.getString(prodInfo, "parentProductCode"));

                    // List> subProdList = commodityServcie.getCommodityCmList(prodInfo);
                    String parentProductCode = MapUtils.getString(prodInfo, "parentProductCode");
                    List> subProdList = commonPromotionService.getChildCommondityListByParentCode(
                            parentProductCode, supplierCode);
                    if (CollectionUtils.isNotEmpty(subProdList)) {
                        for (Map subProdMap : subProdList) {
                            Map prodMap2 = new HashMap();
                            prodMap2.put("commoditySetCode", MapUtils.getString(paramMap, "commoditySetCode"));
                            prodMap2.put("commoditySetType", "1");
                            prodMap2.put("productCode", MapUtils.getString(subProdMap, "productCode"));
                            prodMap2.put("productName", MapUtils.getString(subProdMap, "productName"));
                            prodMap2.put("operateType", "1");
                            prodMap2.put("syncFlag", "N");
                            // prodMap2.put("parentProductCode", MapUtils.getString(subProdMap, "parentCode"));
                            prodMap2.put("parentProductCode", MapUtils.getString(prodInfo, "productCode"));
                            // prodMap2.put("productType", MapUtils.getString(subProdMap, "cmType"));
                            prodMap2.put("productType", "02");
                            prodMap2.put("supplierCode", MapUtils.getString(paramMap, "supplierCode"));
                            prodMap2.put("categoryCode", MapUtils.getString(prodInfo, "categoryCode"));
                            prodMap2.put(
                                    "brandCode",
                                    MapUtils.getString(prodInfo, "brandCode").substring(
                                            MapUtils.getString(prodInfo, "brandCode").length() - 4,
                                            MapUtils.getString(prodInfo, "brandCode").length()));
                            prodMap2.put("relationFlag", "0");
                            addProdList.add(prodMap2);
                        }
                    }
                }
            }
            prodList.addAll(addProdList);
        }
        if (CollectionUtils.isNotEmpty(prodList)) {
            commonPromotionService.setCommondityListAttribute(prodList, supplierCode, false, false, false);
        }
        return prodList;
    }

    public List getInfoListByKey(Map paramMap, String keyWord) {
        List infoList = new ArrayList();
        if (StringUtils.isNotBlank(MapUtils.getString(paramMap, keyWord))) {
            if (MapUtils.getString(paramMap, keyWord).indexOf(',') > 0) {// NOSONAR
                String[] infoArr = MapUtils.getString(paramMap, keyWord).split(",");
                for (int i = 0; i < infoArr.length; i++) {
                    infoList.add(infoArr[i]);
                }
            } else {
                infoList.add(MapUtils.getString(paramMap, keyWord));
            }
        }
        return infoList;
    }

    @Override
    public void updatePromotionBase(Map paramMap) {
        dalClient.execute(NAMESPACE + ".updatePromotionBase", paramMap);
    }
    
    @Override
    public Map updatePromotionBaseP(Map paramMap) {
        
        // 冻结券账户
        CouponAccountBean  activeCreateAddStopBean = new CouponAccountBean();
        activeCreateAddStopBean.setSupplierCode(MapUtils.getString(paramMap, MPMSCommonConstant.SUPPLIER_CODE_P,""));
        activeCreateAddStopBean.setOperateNumber(EventNoUtil.getEventNum("MPMS"));// 操作流水号
        activeCreateAddStopBean.setSopActiveId(MapUtils.getString(paramMap, "activityCode"));
        activeCreateAddStopBean.setTicketRuleId(MapUtils.getString(paramMap, "activityId"));
        activeCreateAddStopBean.setActiveDescribe("活动专享券");
        activeCreateAddStopBean.setOperateFlag("2");// 2代表活动追加冻结金额
        
        activeCreateAddStopBean.setOperateAmount(new BigDecimal(MapUtils.getString(paramMap, "operateAmount")));// 冻结金额
        activeCreateAddStopBean.setActiveStartTime(MapUtils.getString(paramMap, "startTime"));
        
        
        // 记录流水封装实体参数
        PromotionResourceSerial promotionResourceSerial = new PromotionResourceSerial();
        promotionResourceSerial.setSerialNum(activeCreateAddStopBean.getOperateNumber());
        promotionResourceSerial.setSupplierCode(MapUtils.getString(paramMap, MPMSCommonConstant.SUPPLIER_CODE, ""));
        promotionResourceSerial.setBrandProviderCode(activeCreateAddStopBean.getSupplierCode());
        promotionResourceSerial.setActivityId(activeCreateAddStopBean.getTicketRuleId());
        promotionResourceSerial.setActivityCode(activeCreateAddStopBean.getSopActiveId());
        promotionResourceSerial.setOperateAmount(activeCreateAddStopBean.getOperateAmount());
        promotionResourceSerial.setActivityType(CommonPromotionConstant.TYPE_60);
        promotionResourceSerial.setCreateTime(DateUtils.formatDate2Str());
        promotionResourceSerial.setUpdateTime(DateUtils.formatDate2Str());
        promotionResourceSerial.setStartTime(activeCreateAddStopBean.getActiveStartTime());
        
        Map resultMap = new HashMap();
        // 调用冻结接口
        CouponAccountBean couponAccountBean1 = couponAccountService.activeCreateAddStop(activeCreateAddStopBean);
        if("F".equals(couponAccountBean1.getReceiveFlag())){
            // 追加冻结金额失败【记录冻结流水】
            promotionResourceSerial.setOperateType(activeCreateAddStopBean.getOperateFlag());
            promotionResourceSerial.setRemark(couponAccountBean1.getActiveDescribe());
            promotionResourceSerial.setStatus("-1");// 状态  0:待处理(默认), 1:成功  -1:失败
            shopFavoriteCommonService.insertPromotionResourceSerial(promotionResourceSerial);
            
            resultMap.put("flag", false);
            resultMap.put("errorMsg", couponAccountBean1.getReceiveDescribe());
            return resultMap;
        }else{
            // 活动追加冻结金额成功记录流水
            promotionResourceSerial.setOperateType(activeCreateAddStopBean.getOperateFlag());
            promotionResourceSerial.setRemark("活动追加冻结金额成功");
            promotionResourceSerial.setStatus("1");// 状态  0:待处理(默认), 1:成功  -1:失败
            shopFavoriteCommonService.insertPromotionResourceSerial(promotionResourceSerial);
            
            paramMap.put("versionNum", this.doVersionNumModify(paramMap,"M","编辑券活动"));
            
            String xmlMessage = operateShopCouponExportService.createOrModifyShopCouponInfoP(paramMap,"2");
            Map responseMap = operateShopCouponExportService.send(xmlMessage);
            String flag = MapUtils.getString(responseMap, "flag","0");
            if("1".equals(flag)){//券创建成功
                dalClient.execute(NAMESPACE + ".updatePromotionBase", paramMap);
                resultMap.put("flag", true);
            }else{
                // 解冻[促销中心创建活动异常]
                activeCreateAddStopBean.setOperateFlag("4");// 4代表活动追加失败解冻金额
                CouponAccountBean couponAccountBean3 = couponAccountService.activeCreateAddStop(activeCreateAddStopBean);
                if("F".equals(couponAccountBean3.getReceiveFlag())){
                    
                    // 追加解冻失败记录流水
                    promotionResourceSerial.setOperateType(activeCreateAddStopBean.getOperateFlag());
                    promotionResourceSerial.setRemark(couponAccountBean3.getReceiveDescribe());
                    promotionResourceSerial.setStatus("-1");// 状态  0:待处理(默认), 1:成功  -1:失败
                    shopFavoriteCommonService.insertPromotionResourceSerial(promotionResourceSerial);
                    
                    resultMap.put("flag", false);
                    resultMap.put("errorMsg", couponAccountBean3.getReceiveDescribe());
                }else{
                    // 追加解冻成功记录流水
                    promotionResourceSerial.setOperateType(activeCreateAddStopBean.getOperateFlag());
                    promotionResourceSerial.setRemark("活动追加失败解冻金额成功");
                    promotionResourceSerial.setStatus("1");// 状态  0:待处理(默认), 1:成功  -1:失败
                    shopFavoriteCommonService.insertPromotionResourceSerial(promotionResourceSerial);
                    
                    resultMap.put("flag", false);
                    resultMap.put("errorMsg", MapUtils.getString(responseMap, "message",""));
                }
                
            }
            
        }
        
        return resultMap;
    }

    @Override
    public Page getLogPageList(Map paramMap) {
        return dalClient.queryForListPage(NAMESPACE + ".getLogPageList", paramMap);
    }

    // ******************************************************************

    @Override
    public Page getPromotionActivityAndReward(Map paramMap) {
        return dalClient.queryForListPage(NAMESPACE + ".getPromotionActivityAndReward", NAMESPACE
                + ".getPromotionActivityAndRewardCount", paramMap);
    }

    @Override
    public Map getActivityId(Map paramMap) {
        return dalClient.queryForMap(NAMESPACE + ".getActivityId", paramMap);
    }
    
    @Override
    public Map getActivityCode(Map paramMap) {
        return dalClient.queryForMap(NAMESPACE + ".getActivityCode", paramMap);
    }
    

    public boolean changeActivityStatus(Map paramMap, String operateType) {
        boolean flag = false;
        paramMap.put(CommonPromotionConstant.OPERATION_TYPE, operateType);
        if ("P".equals(operateType)) {
            paramMap.put(CommonPromotionConstant.OPERATE_TYPE, "5");
        } else if ("D".equals(operateType)) {
            paramMap.put(CommonPromotionConstant.OPERATE_TYPE, "6");
        } else if ("F".equals(operateType)) {
            paramMap.put(CommonPromotionConstant.OPERATE_TYPE, "4");
        }
        flag = doSend(paramMap);
        return flag;
    }

    /**
     *
     * 功能描述: 终止 暂停 恢复 发送http报文方法

     * 〈功能详细描述〉
     *
     * @param paramMap
     * @return
     * @see [相关类/方法](可选)
     * @since [产品/模块版本](可选)
     */
    boolean doSend(Map paramMap) {
        boolean flag = false;
        Map activityIdMap = dalClient.queryForMap(NAMESPACE + ".getActivityId", paramMap);
        Map sendMap = new HashMap();
        Map tmpMap = new HashMap();
        if (MapUtils.isNotEmpty(activityIdMap)) {
            sendMap.put(CommonPromotionConstant.ACTIVITY_ID,
                    MapUtils.getString(activityIdMap, CommonPromotionConstant.ACTIVITY_ID));
            sendMap.put(CommonPromotionConstant.OPERATE_ID,
                    MapUtils.getString(paramMap, CommonPromotionConstant.USER_NAME));
            sendMap.put(CommonPromotionConstant.OPERATE_TYPE,
                    MapUtils.getString(paramMap, CommonPromotionConstant.OPERATE_TYPE));
            sendMap.put(CommonPromotionConstant.ACTIVITY_SOURCE, "2");
            tmpMap.put("data", sendMap);
            try {
                String xmlMessage = MessageParser.objectToMessage(tmpMap);
                xmlMessage = xmlMessage.substring(START_FALG_SIZE, xmlMessage.length() - END_FLAG_SIZE);
                // 发送
                MbfResponse response = changeActivityStatusHttpRequest.ChangeActivityStatusRequestMsg(xmlMessage);

                // 解析结果
                Map returnMap = parseLockResponse(response);
                if (MapUtils.isNotEmpty(returnMap)) {
                    if ("1".equals(MapUtils.getString(returnMap, "returnFlag"))) {
                        if ("D".equals(MapUtils.getString(paramMap, CommonPromotionConstant.OPERATION_TYPE))) {
                            paramMap.put(CommonPromotionConstant.ACTIVITY_STATUS, CommonPromotionConstant.P02);
                        } else if ("P".equals(MapUtils.getString(paramMap, CommonPromotionConstant.OPERATION_TYPE))) {
                            paramMap.put(CommonPromotionConstant.ACTIVITY_STATUS, CommonPromotionConstant.P06);
                        } else if ("F".equals(MapUtils.getString(paramMap, CommonPromotionConstant.OPERATION_TYPE))) {
                            paramMap.put(CommonPromotionConstant.ACTIVITY_STATUS, CommonPromotionConstant.P01);
                        }
                        updatePromotionBaseAndExpand(paramMap);
                        paramMap.put("receveFlag", "S");
                        flag = true;
                    } else {
                        paramMap.put("receveFlag", "F");
                        paramMap.put(CommonPromotionConstant.FAIL_REASION, MapUtils.getString(returnMap, "returnMsg"));
                    }
                } else {
                    paramMap.put("receveFlag", "F");
                    paramMap.put(CommonPromotionConstant.FAIL_REASION, "操作超时");
                }
            } catch (RuntimeException e) {
                paramMap.put("receveFlag", "F");
                paramMap.put(CommonPromotionConstant.FAIL_REASION, "操作超时");
                logger.logException(e);
            } catch (RscException e) {
                paramMap.put("receveFlag", "F");
                paramMap.put(CommonPromotionConstant.FAIL_REASION, "操作超时");
                logger.logException(e);
            }
            paramMap.put(CommonPromotionConstant.SEND_FLAG, "S20");

            paramMap.put(CommonPromotionConstant.VERSION, null); // 暂停,终止,回复,只记录操作日志,不记录版本
            savePromotionIntfRecord(paramMap); // 保存日志
        }
        return flag;
    }

    @Override
    public void updatePromotionBaseAndExpand(Map paramMap) {
        dalClient.execute(NAMESPACE + ".updatePromotionBase", paramMap);
    }

    @SuppressWarnings("unchecked")
    private Map parseLockResponse(MbfResponse response) {
        Map returnMap = new HashMap();
        // 解析XML
        Map responseMap = MessageParser.messageToObject(response.toString());
        Map mapOutput = MapUtils.getMap(MapUtils.getMap(responseMap, "MbfService"), "output1");
        String returnFlag = MapUtils.getString(mapOutput, "returnFlag");
        String returnMsg = MapUtils.getString(mapOutput, "returnMsg");
        returnMap.put("returnFlag", returnFlag);
        returnMap.put("returnMsg", returnMsg);
        return returnMap;
    }

    @Override
    public Map getPromotionActivityDetail(Map paramMap) {
        return dalClient.queryForMap(NAMESPACE + ".getPromotionActivityDetail", paramMap);
    }
    
    @Override
    public Map getPromotionActivityDetailP(Map paramMap) {
        return dalClient.queryForMap(NAMESPACE + ".getPromotionActivityDetailP", paramMap);
    }

    @Override
    public String judgeIsOldActivity(Map activityMap) {
        String oldFlag = "N";
        String activityId = MapUtils.getString(activityMap, ACTIVITY_ID);
        if (StringUtils.isNotBlank(activityId) && activityId.length() == 20) {
            oldFlag = "Y";
        }
        return oldFlag;
    }
    
    @Override
    public Map getLastOperationLog(Map paramMap){
        return dalClient.queryForMap(NAMESPACE + ".getLastOperationLog", paramMap);
    }
    
    @Override
    public Map getCouponDynamicData(String activityId){
        Map returnMap = new HashMap();
        try{
            Search4PageDynamicDataInputDto inDto = new Search4PageDynamicDataInputDto();
            
            ActivityDetailInDto activityDetailInDto = new ActivityDetailInDto();
            activityDetailInDto.setActivityId(activityId);
            
            List activityList = new ArrayList();
            activityList.add(activityDetailInDto);
            
            inDto.setActivityList(activityList);
            snlogger.info("调用券剩余量请求报文inDto:" + inDto.toString());
            Search4PageDynamicDataOutputDto dataOutputDto= search4PageDynamicDataReqService.searchDynamicData(inDto);
            snlogger.info("调用券剩余量响应报文dataOutputDto:" + dataOutputDto.toString());
            String resultFlag = dataOutputDto.getResultFlag();
            if("1".equals(resultFlag)){
                List outDtoActivityList = dataOutputDto.getActivityList();
                if(CollectionUtils.isNotEmpty(outDtoActivityList)){
                    for (ActivityDetailOutDto activityDetailOutDto : outDtoActivityList) {
                        // 【活动剩余次数】剩余量
                        String remainCount = activityDetailOutDto.getRemainCount();
                        returnMap.put("resultFlag", "1");
                        returnMap.put("remainCount", remainCount);
                    }
                    return returnMap;
                }else{
                    returnMap.put("resultFlag", "2");
                }
            }else{
                returnMap.put("resultFlag", "0");
            }
        }catch(RuntimeException re){
            returnMap.put("resultFlag", "0");
            snlogger.error("rsf客户端请求接口发生异常 RscException code:" + re.getCause(), re);
        }catch(Exception e){
            returnMap.put("resultFlag", "0");
            snlogger.error("rsf客户端请求接口发生异常 RscException code:" + e.getCause(), e);
        }
        return returnMap;
    }
    
    @Override
    public Map mergeShopActivityInfo(Map paramMap){
        Map returnMap = new HashMap();
        try{
            ShopActivityInfoDto shopActivityInfoDto = new ShopActivityInfoDto();
            shopActivityInfoDto.setSupplierCode("00" + MapUtils.getString(paramMap, "supplierCode",""));
            shopActivityInfoDto.setTerminateFlag(MapUtils.getString(paramMap, "terminateFlag",""));//1:终止;0:创建;2:更新
            shopActivityInfoDto.setActivityCode(MapUtils.getString(paramMap, "activityCode",""));
            if(!"1".equals(MapUtils.getString(paramMap, "terminateFlag",""))){            
                shopActivityInfoDto.setStartTime(MapUtils.getString(paramMap, "startTime",""));
                shopActivityInfoDto.setEndTime(MapUtils.getString(paramMap, "endTime",""));
                shopActivityInfoDto.setUrl(MapUtils.getString(paramMap, "url",""));
                
                List activityGiftInfoList = new ArrayList();
                ShopActivityGiftInfo shopActivityGiftInfo = new ShopActivityGiftInfo();
                shopActivityGiftInfo.setRewardType(MapUtils.getString(paramMap, "rewardType",""));
                shopActivityGiftInfo.setActivityId(MapUtils.getString(paramMap, ACTIVITY_ID,""));
                shopActivityGiftInfo.setActivitySecretKey(MapUtils.getString(paramMap, "activitySecretKey",""));
                shopActivityGiftInfo.setBonusAmout(MapUtils.getString(paramMap, "bonusAmout",""));
                activityGiftInfoList.add(shopActivityGiftInfo);
                
                shopActivityInfoDto.setActivityGiftInfoList(activityGiftInfoList);
            }
            String str = "[supplierCode=" + shopActivityInfoDto.getSupplierCode() + ",terminateFlag="
                    + shopActivityInfoDto.getTerminateFlag() + ",activityCode=" + shopActivityInfoDto.getActivityCode()
                    + ",startTime=" + shopActivityInfoDto.getStartTime() + ",endTime="
                    + shopActivityInfoDto.getEndTime() + ", url=" + shopActivityInfoDto.getUrl() + ", rewardType="
                    + MapUtils.getString(paramMap, "rewardType", "") + ", activityId="
                    + MapUtils.getString(paramMap, ACTIVITY_ID, "") + ", activitySecretKey="
                    + MapUtils.getString(paramMap, "activitySecretKey", "") + ", activitySecretKey="
                    + MapUtils.getString(paramMap, "bonusAmout", "") + "]";
            snlogger.info("调用收藏接口推送活动信息请求报文shopActivityInfoDto:" + str);
            BaseRtnDto baseRtnDto = favorActivityGiftService.mergeShopActivityInfo(shopActivityInfoDto);
            snlogger.info("调用收藏接口推送活动信息响应报文baseRtnDto:" + baseRtnDto.getReturnFlag() + "--" + baseRtnDto.getReturnMessage());
            returnMap.put("returnFlag", baseRtnDto.getReturnFlag());
            if(!"0".equals(baseRtnDto.getReturnFlag())){// 失败的情况返回个错误信息
                returnMap.put("returnMessage", baseRtnDto.getReturnMessage());
            }
        }catch(RuntimeException re){
            snlogger.error("rsf客户端请求接口mergeShopActivityInfo发生异常 RscException code:" + re.getCause(), re);
            returnMap.put("returnFlag", "1");
            returnMap.put("returnMessage", "系统异常");
        }catch(Exception e){
            snlogger.error("rsf客户端请求接口mergeShopActivityInfo发生异常 RscException code:" + e.getCause(), e);
            returnMap.put("returnFlag", "1");
            returnMap.put("returnMessage", "系统异常");
        }
        return returnMap;
    }
    
    @SuppressWarnings("unchecked")
    @Override
    public Map sendReviewctivityInfo(Map paramMap){
        Map returnMap = new HashMap();
        try{
            GiftOfReviewDTO giftOfReviewDTO = new GiftOfReviewDTO();
            giftOfReviewDTO.setSupplierCode("00" + MapUtils.getString(paramMap, "supplierCode",""));
            giftOfReviewDTO.setActivityCode(MapUtils.getString(paramMap, "activityCode",""));
            //1-创建,2-修改 3-终止
            giftOfReviewDTO.setUpdateFlag(MapUtils.getString(paramMap, "updateFlag",""));
            
            if(!"3".equals(MapUtils.getString(paramMap, "updateFlag",""))){// 不是终止                
                giftOfReviewDTO.setActivityStartTime(MapUtils.getString(paramMap, "startTime",""));
                giftOfReviewDTO.setActivityEndTime(MapUtils.getString(paramMap, "endTime",""));
                giftOfReviewDTO.setRewardType(MapUtils.getString(paramMap, "rewardType",""));
                giftOfReviewDTO.setActivityId(MapUtils.getString(paramMap, ACTIVITY_ID,""));
                giftOfReviewDTO.setActivitySecretKey(MapUtils.getString(paramMap, "activitySecretKey",""));
                giftOfReviewDTO.setBonusAmout(MapUtils.getString(paramMap, "bonusAmout",""));
                giftOfReviewDTO.setMoney(MapUtils.getString(paramMap, "money",""));
                
                // 只有创建的时候有商品范围集
                if("1".equals(MapUtils.getString(paramMap, "updateFlag",""))){
                    List cmmdtyCodeOfGiftDTOList = new ArrayList();
                    String isShop = MapUtils.getString(paramMap, "actProductRef","");//actProductRef:01是全店铺  02 部分商品
                    if("02".equals(isShop)){//如果是指定商品
                        if(null != MapUtils.getObject(paramMap, "productList")){
                            List> productList = (List>)MapUtils.getObject(paramMap, "productList");
                            if(CollectionUtils.isNotEmpty(productList)){
                                for (Map productMap : productList) {
                                    CmmdtyCodeOfGiftDTO cmmdtyCodeOfGiftDTO = new CmmdtyCodeOfGiftDTO();
                                    if(!"02".equals(MapUtils.getString(productMap, "cmType"))){
                                        cmmdtyCodeOfGiftDTO.setSellerNo("000000000" + MapUtils.getString(productMap, "productCode"));
                                        cmmdtyCodeOfGiftDTO.setCommonFlag(MapUtils.getString(productMap, "cmType"));
                                        cmmdtyCodeOfGiftDTOList.add(cmmdtyCodeOfGiftDTO);
                                    }
                                }
                            }
                        }
                    }else{//如果是全店铺
                        CmmdtyCodeOfGiftDTO cmmdtyCodeOfGiftDTO = new CmmdtyCodeOfGiftDTO();
                        cmmdtyCodeOfGiftDTO.setSellerNo("*");
                        cmmdtyCodeOfGiftDTOList.add(cmmdtyCodeOfGiftDTO);
                    }
                    giftOfReviewDTO.setGoodsSetList(cmmdtyCodeOfGiftDTOList);
                }
            }
            String str = "[supplierCode=" + giftOfReviewDTO.getSupplierCode() + ",updateFlag="
                    + giftOfReviewDTO.getUpdateFlag() + ",activityCode=" + giftOfReviewDTO.getActivityCode()
                    + ",startTime=" + giftOfReviewDTO.getActivityStartTime() + ",endTime="
                    + giftOfReviewDTO.getActivityEndTime() + ", rewardType=" + giftOfReviewDTO.getRewardType()
                    + ", activityId=" + giftOfReviewDTO.getActivityId() + ", activitySecretKey="
                    + giftOfReviewDTO.getActivitySecretKey() + ", bonusAmout=" + giftOfReviewDTO.getBonusAmout()
                    + ", money=" + giftOfReviewDTO.getMoney() + "]";
            snlogger.info("调用评价接口推送活动信息请求报文giftOfReviewDTO:" + str);
            // 调用评价接口
            ReceiveActivityReturnDTO receiveActivityReturnDTO = giftOfReviewService.receiveActivity(giftOfReviewDTO);
            snlogger.info("调用评价接口推送活动信息请求报文receiveActivityReturnDTO:" + receiveActivityReturnDTO.getReturnCode() + "--" + receiveActivityReturnDTO.getReturnMsg());
            
            if("1".equals(receiveActivityReturnDTO.getReturnCode())){//成功
                returnMap.put("returnFlag", "0");
            }else{// 失败的情况返回个错误信息
                returnMap.put("returnFlag", "1");
                returnMap.put("returnMessage", receiveActivityReturnDTO.getReturnMsg());
            }
            
        }catch(RuntimeException re){
            snlogger.error("rsf客户端请求接口sendReviewctivityInfo发生异常 RscException code:" + re.getCause(), re);
            returnMap.put("returnFlag", "1");
            returnMap.put("returnMessage", "系统异常");
        }catch(Exception e){
            snlogger.error("rsf客户端请求接口sendReviewctivityInfo发生异常 RscException code:" + e.getCause(), e);
            returnMap.put("returnFlag", "1");
            returnMap.put("returnMessage", "系统异常");
        }
        return returnMap;
    }
    
    @Override
    public void deleteLog(Map paramMap){
        dalClient.execute(NAMESPACE + ".deleteLog", paramMap);
    }

}


你可能感兴趣的:(测试)