import com.gic.haoban.manage.api.service.content.MallOrderStatusChangeApiService;
import com.gic.haoban.manage.service.pojo.bo.content.message.InteractRecordMessageBO;
import com.gic.haoban.manage.service.service.content.message.InteractRecordMessageService;
import com.sun.org.apache.bcel.internal.generic.DADD;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import java.util.Date;
import java.util.UUID;

/**
 * @Author MUSI
 * @Date 2023/4/6 10:13 AM
 * @Description
 * @Version
 **/

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext-conf.xml"})
public class InteractRecordMessageServiceTest {

    @Autowired
    InteractRecordMessageService interactRecordMessageService;
    @Autowired
    MallOrderStatusChangeApiService mallOrderStatusChangeApiService;

    String eid = "ff8080815dacd3a2015dacd3ef5c0000";
    String wxEid = "ca66a01b79474c40b3e7c7f93daf1a3b";
    String staffId = "e608b51b267e4943b87e222a343b4f25";
    String clerkId = "300b60c7f8874ca2b9cc696ad6b6a480";
    //String memberId = "ff8080818147efc8018148d1759903c8";
    String memberId = "ff80808187210d2b018721e9cc6c0036";

    String materialId = "510923843246776342";

    @Test
    public void dealRecord() {
        String runningUUid = UUID.randomUUID().toString();
        InteractRecordMessageBO interactRecordMessageBO = new InteractRecordMessageBO();
        interactRecordMessageBO.setEnterpriseId(eid);
        interactRecordMessageBO.setMaterialId(materialId);
        interactRecordMessageBO.setMemberId(memberId);
        interactRecordMessageBO.setUnionId(memberId);
        interactRecordMessageBO.setClerkId(clerkId);
        interactRecordMessageBO.setStoreId("ff8080816e216c04016e34294282004a");
        interactRecordMessageBO.setChannelSource(1);
        interactRecordMessageBO.setEventType(1);
        interactRecordMessageBO.setDurationTime(3200);
        interactRecordMessageBO.setGoodsId(runningUUid);
        interactRecordMessageBO.setLastAccessTime(new Date().getTime());
        interactRecordMessageService.dealRecord(interactRecordMessageBO);
    }


    @Test
    public void mallOrderStatusChangeTest(){
        String params  ="{\"orderNumber\":\"6230408781099580\",\"toStatus\":2,\"fromStatus\":1,\"orderId\":\"c08691af8297480db3d25ef5ef19e863\",\"enterpriseId\":\"ff8080815dacd3a2015dacd3ef5c0000\",\"mqTraceId\":\"244806167-1-1680932807.425-/gic-thirdparty/wxmall_payment_result_notice\",\"memberId\":\"ff8080818147efc8018148d1759903c8\"}";
        mallOrderStatusChangeApiService.mallOrderStatusChange(params);
    }
}
