admin
2021-03-18 b37275dba6b782bf3bb3817c4504f6cdef1bef7c
src/test/java/com/hxh/spring/test/ConfigTest.java
@@ -1,6 +1,16 @@
package com.hxh.spring.test;
import com.google.gson.Gson;
import com.yeshi.buwan.dao.system.DetailSystemConfigDao;
import com.yeshi.buwan.dao.system.SystemConfigDao;
import com.yeshi.buwan.domain.HomeType;
import com.yeshi.buwan.domain.jump.JumpDetail;
import com.yeshi.buwan.domain.jump.JumpTypeEnum;
import com.yeshi.buwan.domain.system.DetailSystemConfig;
import com.yeshi.buwan.domain.system.SystemConfig;
import com.yeshi.buwan.job.AdJob;
import com.yeshi.buwan.service.imp.DetailSystemConfigService;
import com.yeshi.buwan.service.inter.system.SystemConfigService;
import org.json.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -9,6 +19,9 @@
import org.springframework.test.context.web.WebAppConfiguration;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:spring.xml"})
@@ -16,18 +29,49 @@
public class ConfigTest {
    @Resource
    private AdJob adJob;
    private SystemConfigService systemConfigService;
    @Resource
    private SystemConfigDao systemConfigDao;
    @Resource
    private DetailSystemConfigDao detailSystemConfigDao;
    @Test
    public void test1() {
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("appId", "10409568");
        jsonObject.put("detailSystemId", "44");
        try {
            adJob.openHWAd(jsonObject.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
    public void addSystemConfig() {
        SystemConfig systemConfig = new SystemConfig();
        systemConfig.setBeizhu("");
        systemConfig.setKey("iqiyi_update_video_name");
        systemConfig.setName("爱奇艺特殊更新的视频名称");
        systemConfig.setValue("《卧底》,没关系,是青春啊!,山海情(原声版),我的时代,你的时代,你好,安怡");
        systemConfig.setCreateTime(new Date());
        systemConfig.setId(SystemConfig.createId(systemConfig.getKey()));
        systemConfigDao.save(systemConfig);
        systemConfig = new SystemConfig();
        systemConfig.setBeizhu("");
        systemConfig.setKey("default_portrait");
        systemConfig.setName("默认头像");
        systemConfig.setValue("https://buwan-1255749512.cos.ap-guangzhou.myqcloud.com/resource/ic_portrait_default.png");
        systemConfig.setCreateTime(new Date());
        systemConfig.setId(SystemConfig.createId(systemConfig.getKey()));
        systemConfigDao.save(systemConfig);
    }
    @Test
    public void addConfig() {
        DetailSystemConfig config = new DetailSystemConfig();
        config.setKey("web_speed_up_host");
        config.setValue("vip.ysdq.yeshitv.com");
        config.setBeizhu("网页加速域名");
        config.setSystemId(new BigInteger(44 + ""));
        config.setMinVersion(106);
        config.setCreatetime(System.currentTimeMillis() + "");
        detailSystemConfigDao.save(config);
    }
}