Authored by bblu

联盟增加APP类型

... ... @@ -8,6 +8,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.yoho.service.model.union.AppTypeModel;
import com.yoho.service.model.union.UnionTypeModel;
/**
... ... @@ -19,19 +20,24 @@ import com.yoho.service.model.union.UnionTypeModel;
public class UnionConstant {
/**
* 新增:app类型
*/
public static Map<Integer, AppTypeModel> appTypeMap = new HashMap<>();
/**
* 联盟类型
*/
public static Map<Integer, UnionTypeModel> unionTypeMap = new HashMap<Integer, UnionTypeModel>();
public static Map<Integer, UnionTypeModel> unionTypeMap = new HashMap<>();
/**
* 安卓系统需要实现的联盟
*/
public static List<String> andriodServiceList = new ArrayList<String>();
public static List<String> andriodServiceList = new ArrayList<>();
/**
* iOS系统需要实现的联盟
*/
public static List<String> iOSServiceList = new ArrayList<String>();
public static List<String> iOSServiceList = new ArrayList<>();
static {
//andriod系统
... ...
... ... @@ -9,6 +9,7 @@ import java.util.Map;
import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import com.yoho.service.model.union.AppTypeModel;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
... ... @@ -28,6 +29,8 @@ public class LoaderData {
@Resource
Map<String, Object> unionTypeMap = null;
@Resource
Map<String, Object> appTypeMap = null;
/**
* 初始化参数
... ... @@ -35,14 +38,23 @@ public class LoaderData {
@PostConstruct
public void init() {
log.info("begin LoaderData");
List<Map<String, Object>> list = (List<Map<String, Object>>) unionTypeMap.get("union_types");
UnionTypeModel unionType = null;
for (Map<String, Object> map : list) {
List<Map<String, Object>> unionTypeList = (List<Map<String, Object>>) unionTypeMap.get("union_types");
UnionTypeModel unionType;
for (Map<String, Object> map : unionTypeList) {
unionType = new UnionTypeModel();
unionType.setValue((int) map.get("value"));
unionType.setName((String) map.get("name"));
UnionConstant.unionTypeMap.put(unionType.getValue(), unionType);
}
List<Map<String, Object>> appTypeList = (List<Map<String, Object>>) appTypeMap.get("app_types");
AppTypeModel appType;
for (Map<String, Object> map : appTypeList) {
appType = new AppTypeModel();
appType.setValue((int) map.get("value"));
appType.setName((String) map.get("name"));
UnionConstant.appTypeMap.put(appType.getValue(), appType);
}
log.info("end LoaderData");
}
}
... ...
... ... @@ -14,5 +14,13 @@
</property>
</bean>
<bean id="appTypeMap" class="org.springframework.beans.factory.config.YamlMapFactoryBean">
<property name="resources">
<list>
<value>classpath:app-type.yml</value>
</list>
</property>
</bean>
</beans>
\ No newline at end of file
... ...
app_types:
- value: 0
name: Yoho!Buy
- value: 1
name: YOHO!BLK
- value: 2
name: Yoho!Now
- value: 3
name: mars
\ No newline at end of file
... ...
... ... @@ -9,6 +9,7 @@ import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
import com.yoho.service.model.union.AppTypeModel;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
... ... @@ -246,6 +247,7 @@ public class UnionServiceImpl implements IUnionService {
return new UnionResponse(203, "have activite in 90 days");
}
UnionTypeModel u = UnionConstant.unionTypeMap.get(Integer.parseInt(click.getUnion_type()));
AppTypeModel a = UnionConstant.appTypeMap.get(request.getApp_type());
//如果是ios系统,还要到大数据表里面判断这个用户是否90天内的活跃用户,如果是的话,这次激活就不成功
String yesterday = DateUtil.dateAdd(DateUtil.getToday("yyyyMMdd"), "d", -1, "yyyyMMdd");
if (ClientTypeEnum.IOS.getName().equals(request.getClient_type())) {
... ... @@ -272,6 +274,7 @@ public class UnionServiceImpl implements IUnionService {
j.put("ip", request.getClientIp());
j.put("collect_ip", "");
j.put("active_type", "15");
j.put("app_type", a == null ? "Yoho!Buy" : a.getName());
activeDingdang.info(j.toString());
}
return new UnionResponse(203, "have activite in 90 days");
... ...