Authored by zhengwen.ge

从新的表中取数据

package com.yoho.unions.dal;
import com.yoho.unions.dal.model.MktMarketingUrl;
public interface IMktMarketingUrlDAO {
int deleteByPrimaryKey(Long unionType);
MktMarketingUrl selectByPrimaryKey(Long unionType);
}
\ No newline at end of file
... ...
package com.yoho.unions.dal;
import com.yoho.unions.dal.model.UnionDepartmentUrl;
public interface IUnionDepartmentUrlDAO {
int deleteByPrimaryKey(Integer id);
int insert(UnionDepartmentUrl record);
int insertSelective(UnionDepartmentUrl record);
UnionDepartmentUrl selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(UnionDepartmentUrl record);
int updateByPrimaryKey(UnionDepartmentUrl record);
UnionDepartmentUrl selectByUnionType(String unionType);
}
\ No newline at end of file
//package com.yoho.unions.dal;
//
//
//import com.yoho.unions.dal.model.UnionDepartmentUrl;
//
//public interface IUnionDepartmentUrlDAO {
// int deleteByPrimaryKey(Integer id);
//
// int insert(UnionDepartmentUrl record);
//
// int insertSelective(UnionDepartmentUrl record);
//
// UnionDepartmentUrl selectByPrimaryKey(Integer id);
//
// int updateByPrimaryKeySelective(UnionDepartmentUrl record);
//
// int updateByPrimaryKey(UnionDepartmentUrl record);
//
// UnionDepartmentUrl selectByUnionType(String unionType);
//}
\ No newline at end of file
... ...
package com.yoho.unions.dal.model;
public class MktMarketingUrl {
private Long unionType;
private Integer divisionCode;
private Integer classCode;
private Integer channelCode;
private Integer deviceCode;
private String deptId;
private String createId;
private String name;
private String srcUrl;
private String destUrl;
private Integer status;
private Integer createTime;
public Long getUnionType() {
return unionType;
}
public void setUnionType(Long unionType) {
this.unionType = unionType;
}
public Integer getDivisionCode() {
return divisionCode;
}
public void setDivisionCode(Integer divisionCode) {
this.divisionCode = divisionCode;
}
public Integer getClassCode() {
return classCode;
}
public void setClassCode(Integer classCode) {
this.classCode = classCode;
}
public Integer getChannelCode() {
return channelCode;
}
public void setChannelCode(Integer channelCode) {
this.channelCode = channelCode;
}
public Integer getDeviceCode() {
return deviceCode;
}
public void setDeviceCode(Integer deviceCode) {
this.deviceCode = deviceCode;
}
public String getDeptId() {
return deptId;
}
public void setDeptId(String deptId) {
this.deptId = deptId == null ? null : deptId.trim();
}
public String getCreateId() {
return createId;
}
public void setCreateId(String createId) {
this.createId = createId == null ? null : createId.trim();
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getSrcUrl() {
return srcUrl;
}
public void setSrcUrl(String srcUrl) {
this.srcUrl = srcUrl == null ? null : srcUrl.trim();
}
public String getDestUrl() {
return destUrl;
}
public void setDestUrl(String destUrl) {
this.destUrl = destUrl == null ? null : destUrl.trim();
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getCreateTime() {
return createTime;
}
public void setCreateTime(Integer createTime) {
this.createTime = createTime;
}
}
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="com.yoho.unions.dal.IMktMarketingUrlDAO" >
<resultMap id="BaseResultMap" type="com.yoho.unions.dal.model.MktMarketingUrl" >
<id column="union_type" property="unionType" jdbcType="BIGINT" />
<result column="division_code" property="divisionCode" jdbcType="INTEGER" />
<result column="class_code" property="classCode" jdbcType="INTEGER" />
<result column="channel_code" property="channelCode" jdbcType="INTEGER" />
<result column="device_code" property="deviceCode" jdbcType="INTEGER" />
<result column="dept_id" property="deptId" jdbcType="VARCHAR" />
<result column="create_id" property="createId" jdbcType="VARCHAR" />
<result column="name" property="name" jdbcType="VARCHAR" />
<result column="src_url" property="srcUrl" jdbcType="VARCHAR" />
<result column="dest_url" property="destUrl" jdbcType="VARCHAR" />
<result column="status" property="status" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
union_type, division_code, class_code, channel_code, device_code, dept_id, create_id,
name, src_url, dest_url, status, create_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long" >
select
<include refid="Base_Column_List" />
from mkt_marketing_url
where union_type = #{unionType,jdbcType=BIGINT}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long" >
delete from mkt_marketing_url
where union_type = #{unionType,jdbcType=BIGINT}
</delete>
</mapper>
\ No newline at end of file
... ...
... ... @@ -27,10 +27,7 @@
<select id="selectByUnionType" resultMap="BaseResultMap">
select <include refid="Base_Column_List" />
from union_department_url
where union_type = #{union_type}
where union_type = #{union_type} limit 1
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -17,11 +17,11 @@ import com.yoho.unions.common.redis.RedisValueCache;
import com.yoho.unions.common.utils.DateUtil;
import com.yoho.unions.common.utils.HttpUtils;
import com.yoho.unions.dal.IAppActivateIdfaListDAO;
import com.yoho.unions.dal.IUnionDepartmentUrlDAO;
import com.yoho.unions.dal.IMktMarketingUrlDAO;
import com.yoho.unions.dal.IUnionsActiveRecordDAO;
import com.yoho.unions.dal.model.AppActivateIdfaList;
import com.yoho.unions.dal.model.MktMarketingUrl;
import com.yoho.unions.dal.model.UnionDepartmentUrl;
import com.yoho.unions.dal.model.UnionType;
import com.yoho.unions.dal.model.UnionsActiveRecord;
import com.yoho.unions.server.service.MainUnionService;
import org.apache.commons.collections.CollectionUtils;
... ... @@ -57,7 +57,7 @@ public class DDServiceImpl implements MainUnionService {
IUnionsActiveRecordDAO unionsActiveRecordDAO;
@Resource
IUnionDepartmentUrlDAO unionDepartmentUrlDAO;
IMktMarketingUrlDAO mktMarketingUrlDAO;
@Resource
IAppActivateIdfaListDAO appActivateIdfaListDAO;
... ... @@ -177,14 +177,14 @@ public class DDServiceImpl implements MainUnionService {
response.setMsg("app udid had actived");
return response;
}
UnionDepartmentUrl unionDepartmentUrl = redisValueCache.get("yh:union:uniontype:1",UnionDepartmentUrl.class);
if(unionDepartmentUrl==null){
unionDepartmentUrl = unionDepartmentUrlDAO.selectByUnionType("1");
redisValueCache.set("yh:union:newuniontype:1",unionDepartmentUrl,1, TimeUnit.HOURS);
MktMarketingUrl mktMarketingUrl = redisValueCache.get("yh:union:uniontype:1",MktMarketingUrl.class);
if(mktMarketingUrl==null){
mktMarketingUrl = mktMarketingUrlDAO.selectByPrimaryKey(new Long(1));
redisValueCache.set("yh:union:newuniontype:1",mktMarketingUrl,1, TimeUnit.HOURS);
}
UnionTypeModel type = new UnionTypeModel();
type.setName(unionDepartmentUrl.getName());
type.setValue(unionDepartmentUrl.getUnionType());
type.setName(mktMarketingUrl.getName());
type.setValue(String.valueOf(mktMarketingUrl.getUnionType()));
// UnionTypeModel type = UnionConstant.unionTypeMap.get(1);
String yesterday = DateUtil.dateAdd(DateUtil.getToday("yyyyMMdd"), "d", -1, "yyyyMMdd");
if (ClientTypeEnum.IOS.getName().equals(request.getClient_type())) {
... ...
... ... @@ -15,10 +15,10 @@ import com.yoho.unions.common.redis.RedisValueCache;
import com.yoho.unions.common.utils.DateUtil;
import com.yoho.unions.common.utils.HttpUtils;
import com.yoho.unions.dal.IAppActivateIdfaListDAO;
import com.yoho.unions.dal.IUnionDepartmentUrlDAO;
import com.yoho.unions.dal.IMktMarketingUrlDAO;
import com.yoho.unions.dal.IUnionLogsDAO;
import com.yoho.unions.dal.model.AppActivateIdfaList;
import com.yoho.unions.dal.model.UnionDepartmentUrl;
import com.yoho.unions.dal.model.MktMarketingUrl;
import com.yoho.unions.dal.model.UnionLogs;
import com.yoho.unions.server.service.MainUnionService;
import org.apache.commons.codec.binary.Base64;
... ... @@ -52,7 +52,7 @@ public class GDTServiceImpl implements MainUnionService {
IUnionLogsDAO unionLogsDAO;
@Resource
IUnionDepartmentUrlDAO unionDepartmentUrlDAO;
IMktMarketingUrlDAO mktMarketingUrlDAO;
@Resource
RedisValueCache redisValueCache;
... ... @@ -133,14 +133,14 @@ public class GDTServiceImpl implements MainUnionService {
// }
// UnionTypeModel u = UnionConstant.unionTypeMap.get(3);
UnionDepartmentUrl unionDepartmentUrl = redisValueCache.get("yh:union:uniontype:3",UnionDepartmentUrl.class);
if(unionDepartmentUrl==null){
unionDepartmentUrl = unionDepartmentUrlDAO.selectByUnionType("3");
redisValueCache.set("yh:union:uniontype:3",unionDepartmentUrl,3, TimeUnit.HOURS);
MktMarketingUrl mktMarketingUrl = redisValueCache.get("yh:union:uniontype:3",MktMarketingUrl.class);
if(mktMarketingUrl==null){
mktMarketingUrl = mktMarketingUrlDAO.selectByPrimaryKey(new Long(3));
redisValueCache.set("yh:union:uniontype:3",mktMarketingUrl,3, TimeUnit.HOURS);
}
UnionTypeModel u = new UnionTypeModel();
u.setName(unionDepartmentUrl.getName());
u.setValue(unionDepartmentUrl.getUnionType());
u.setName(mktMarketingUrl.getName());
u.setValue(String.valueOf(mktMarketingUrl.getUnionType()));
String yesterday = DateUtil.dateAdd(DateUtil.getToday("yyyyMMdd"), "d", -1, "yyyyMMdd");
if (ClientTypeEnum.IOS.getName().equals(request.getClient_type())) {
List<AppActivateIdfaList> _90DayIdfaList = appActivateIdfaListDAO.selectByIdfaAndDate(new AppActivateIdfaList(Long.valueOf(yesterday), request.getIdfa()));
... ...
... ... @@ -77,7 +77,7 @@ public class UnionServiceImpl implements IUnionService {
RedisValueCache redisValueCache;
@Resource
IUnionDepartmentUrlDAO unionDepartmentUrlDAO;
IMktMarketingUrlDAO mktMarketingUrlDAO;
@Resource
IUnionClickLogsDAO unionClickLogsDAO;
... ... @@ -118,9 +118,9 @@ public class UnionServiceImpl implements IUnionService {
return new UnionResponse(201, "union_type is error");
}
// UnionTypeModel m = UnionConstant.unionTypeMap.get(Integer.parseInt(request.getUnion_type()));
UnionDepartmentUrl type = redisValueCache.get("yh:union:newuniontype:"+request.getUnion_type(),UnionDepartmentUrl.class);
MktMarketingUrl type = redisValueCache.get("yh:union:uniontype:"+request.getUnion_type(),MktMarketingUrl.class);
if(type==null){
type = unionDepartmentUrlDAO.selectByUnionType(request.getUnion_type());
type = mktMarketingUrlDAO.selectByPrimaryKey(Long.valueOf(request.getUnion_type()));
redisValueCache.set("yh:union:uniontype:"+request.getUnion_type(),type,1, TimeUnit.HOURS);
}
if (type == null) {
... ... @@ -360,15 +360,15 @@ public class UnionServiceImpl implements IUnionService {
return new UnionResponse(203, "have activite in 90 days");
}
// UnionTypeModel u = UnionConstant.unionTypeMap.get(Integer.parseInt(click.getUnion_type()));
String unionTypekey = "yh:union:newuniontype:"+click.getUnion_type();
UnionDepartmentUrl unionDepartmentUrl = redisValueCache.get(unionTypekey,UnionDepartmentUrl.class);
if(unionDepartmentUrl==null){
unionDepartmentUrl = unionDepartmentUrlDAO.selectByUnionType(click.getUnion_type());
redisValueCache.set(unionTypekey,unionDepartmentUrl,1, TimeUnit.HOURS);
String unionTypekey = "yh:union:uniontype:"+click.getUnion_type();
MktMarketingUrl mktMarketingUrl = redisValueCache.get(unionTypekey,MktMarketingUrl.class);
if(mktMarketingUrl==null){
mktMarketingUrl = mktMarketingUrlDAO.selectByPrimaryKey(Long.valueOf(click.getUnion_type()));
redisValueCache.set(unionTypekey,mktMarketingUrl,1, TimeUnit.HOURS);
}
UnionTypeModel u = new UnionTypeModel();
u.setName(unionDepartmentUrl.getName());
u.setValue(unionDepartmentUrl.getUnionType());
u.setName(mktMarketingUrl.getName());
u.setValue(String.valueOf(mktMarketingUrl.getUnionType()));
//如果是ios系统,还要到大数据表里面判断这个用户是否90天内的活跃用户,如果是的话,这次激活就不成功
String yesterday = DateUtil.dateAdd(DateUtil.getToday("yyyyMMdd"), "d", -1, "yyyyMMdd");
if (ClientTypeEnum.IOS.getName().equals(request.getClient_type())) {
... ...
... ... @@ -38,5 +38,6 @@ datasources:
- com.yoho.unions.dal.IUnionTypeManageDAO
- com.yoho.unions.dal.IUnionOrderPushDAO
- com.yoho.unions.dal.IUnionDepartmentUrlDAO
- com.yoho.unions.dal.IMktMarketingUrlDAO
readOnlyInSlave: true
\ No newline at end of file
... ...
... ... @@ -39,4 +39,5 @@ datasources:
- com.yoho.unions.dal.IUnionTypeManageDAO
- com.yoho.unions.dal.IUnionOrderPushDAO
- com.yoho.unions.dal.IUnionDepartmentUrlDAO
- com.yoho.unions.dal.IMktMarketingUrlDAO
readOnlyInSlave: true
\ No newline at end of file
... ...