Authored by caoyan

Cps消息列表

... ... @@ -18,7 +18,8 @@ public enum ShareOrdersKeyEnum {
ACTIVITY("yh:union:share:activity:","type:{}:id:{}",120,"活动"),
ORDER_STATISTICS_INFO("yh:union:share:statisticsInfo:","uid:{}:queryTimeType:{}",600,"统计数据"),
RANK_LIST("yh:union:share:ranklist:","type:{}:start:{}:limit:{}",86400,"达人排行榜"),
RANK_INFO("yh:union:share:rank:","date:{}:type:{}",300,"个人排行");
RANK_INFO("yh:union:share:rank:","date:{}:type:{}",300,"个人排行"),
MESSAGE_LIST("yh:union:share:settlementList:","key:{}:page:{}:limit:{}",600,"提现列表");
private String preKey;
... ...
package com.yoho.unions.dal;
import java.util.List;
import com.yoho.service.model.union.request.UnionShareMessageReqBO;
import com.yoho.unions.dal.model.UnionShareMessage;
public interface UnionShareMessageMapper {
int deleteByPrimaryKey(Integer id);
int insert(UnionShareMessage record);
int insertSelective(UnionShareMessage record);
UnionShareMessage selectByPrimaryKey(Integer id);
int updateByPrimaryKey(UnionShareMessage record);
int selectTotalByCondition(UnionShareMessageReqBO req);
List<UnionShareMessage> selectByCondition(UnionShareMessageReqBO req);
}
\ No newline at end of file
... ...
package com.yoho.unions.dal.model;
import com.yoho.service.model.union.request.BaseBO;
public class UnionShareMessage extends BaseBO {
/**
*
*/
private static final long serialVersionUID = -5701819989423347203L;
private Integer id;
private String content;
private String image;
private String url;
private int priority;
private Integer startTime;
private Integer endTime;
private Integer createTime;
private Integer updateTime;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getImage() {
return image;
}
public void setImage(String image) {
this.image = image;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public int getPriority() {
return priority;
}
public void setPriority(int priority) {
this.priority = priority;
}
public Integer getStartTime() {
return startTime;
}
public void setStartTime(Integer startTime) {
this.startTime = startTime;
}
public Integer getEndTime() {
return endTime;
}
public void setEndTime(Integer endTime) {
this.endTime = endTime;
}
public Integer getCreateTime() {
return createTime;
}
public void setCreateTime(Integer createTime) {
this.createTime = createTime;
}
public Integer getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Integer updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
return "UnionShareMessage{" +
"id=" + id +
", content='" + content + '\'' +
", image='" + image + '\'' +
", url=" + url +
", priority=" + priority +
", startTime='" + startTime + '\'' +
", endTime=" + endTime +
", createTime='" + createTime + '\'' +
", updateTime=" + updateTime +
'}';
}
}
\ 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.UnionShareMessageMapper" >
<resultMap id="BaseResultMap" type="com.yoho.unions.dal.model.UnionShareMessage" >
<id column="id" property="id" jdbcType="INTEGER" />
<result column="content" property="content" jdbcType="VARCHAR" />
<result column="image" property="image" jdbcType="VARCHAR" />
<result column="url" property="url" jdbcType="VARCHAR" />
<result column="priority" property="priority" jdbcType="INTEGER" />
<result column="start_time" property="startTime" jdbcType="INTEGER" />
<result column="end_time" property="endTime" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
id, content, image, url, priority, start_time, end_time,
create_time, update_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from union_share_message
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from union_share_message
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yoho.unions.dal.model.UnionShareMessage" >
insert into union_share_message (content, image, url, priority, start_time, end_time,
create_time, update_time)
values (#{content,jdbcType=VARCHAR}, #{image,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{priority,jdbcType=INTEGER},
#{startTime,jdbcType=INTEGER}, #{endTime,jdbcType=INTEGER}, #{createTime,jdbcType=INTEGER},
#{updateTime,jdbcType=INTEGER}
)
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.unions.dal.model.UnionShareMessage" >
update union_share_message
<set >
<if test="content != null" >
content = #{content,jdbcType=VARCHAR},
</if>
<if test="image != null" >
image = #{image,jdbcType=VARCHAR},
</if>
<if test="url != null" >
url = #{url,jdbcType=VARCHAR},
</if>
<if test="priority != null" >
priority = #{priority,jdbcType=INTEGER},
</if>
<if test="startTime != null" >
start_time = #{startTime,jdbcType=INTEGER},
</if>
<if test="endTime != null" >
end_time = #{endTime,jdbcType=INTEGER},
</if>
<if test="updateTime != null" >
update_time = #{updateTime,jdbcType=DECIMAL},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<sql id="Query_Message_Sql" >
<if test="startTime != null">
and start_time &gt;= #{startTime}
</if>
<if test="endTime != null">
and end_time &lt;= #{endTime}
</if>
<if test="isEffective != null and isEffective==true">
and start_time &lt;= UNIX_TIMESTAMP() and end_time &gt;=UNIX_TIMESTAMP()
</if>
</sql>
<select id="selectTotalByCondition" resultType="java.lang.Integer"
parameterType="com.yoho.service.model.union.request.UnionShareMessageReqBO">
select count(id)
from union_share_message
where 1=1
<include refid="Query_Message_Sql" />
</select>
<select id="selectByCondition" resultMap="BaseResultMap"
parameterType="com.yoho.service.model.union.request.UnionShareMessageReqBO">
select <include refid="Base_Column_List" />
from union_share_message
where 1=1
<include refid="Query_Message_Sql" />
order by priority desc, update_time desc
<if test="start!=null and size != null">
limit #{start},#{size}
</if>
</select>
</mapper>
\ No newline at end of file
... ...
... ... @@ -5,7 +5,7 @@
<parent>
<groupId>com.yoho</groupId>
<artifactId>parent</artifactId>
<version>1.4.4-SNAPSHOT</version>
<version>1.4.5-SNAPSHOT</version>
</parent>
<groupId>com.yoho.dsf</groupId>
<artifactId>yoho-unions</artifactId>
... ...
package com.yoho.unions.server.restapi;
import java.math.BigDecimal;
import java.util.*;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import com.yoho.core.common.utils.DateUtil;
import com.yoho.service.model.union.bo.*;
import com.yoho.unions.server.task.CpsOrderExtraActivityTask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
... ... @@ -16,12 +16,24 @@ import org.springframework.web.bind.annotation.ResponseBody;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yoho.core.common.utils.DateUtil;
import com.yoho.core.common.utils.JsonUtil;
import com.yoho.core.dal.datasource.annotation.Database;
import com.yoho.core.rest.annotation.ServiceDesc;
import com.yoho.error.ServiceError;
import com.yoho.error.exception.ServiceException;
import com.yoho.service.model.union.bo.IdOrIdsBo;
import com.yoho.service.model.union.bo.ShareOrderBo;
import com.yoho.service.model.union.bo.ShareSettlementBo;
import com.yoho.service.model.union.bo.ShareUserSettlementInfoBo;
import com.yoho.service.model.union.bo.UninoShareIncomeRankBo;
import com.yoho.service.model.union.bo.UnionShareBankBo;
import com.yoho.service.model.union.bo.UnionShareOrdersActivityLogsBo;
import com.yoho.service.model.union.bo.UnionShareUserBankBo;
import com.yoho.service.model.union.bo.UnionShareUserBo;
import com.yoho.service.model.union.bo.UnionShareVirtualAddBo;
import com.yoho.service.model.union.request.UninoShareIncomeRankReqBo;
import com.yoho.service.model.union.request.UnionShareMessageReqBO;
import com.yoho.service.model.union.request.UnionShareOrderReqBO;
import com.yoho.service.model.union.request.UnionShareOrderSearchReqBO;
import com.yoho.service.model.union.request.UnionShareOrdersMonthReqBO;
... ... @@ -35,11 +47,12 @@ import com.yoho.service.model.union.response.UnionShareStatisticsRspBO;
import com.yoho.service.model.union.response.UnionShareUserApplyListBo;
import com.yoho.service.model.union.response.UnionShareUserBankListBO;
import com.yoho.unions.common.ApiResponse;
import com.yoho.unions.common.Response;
import com.yoho.unions.dal.model.UnionShareMessage;
import com.yoho.unions.dal.model.UnionShareOrders;
import com.yoho.unions.dal.model.UnionShareOrdersMonth;
import com.yoho.unions.dal.model.UnionShareSettlement;
import com.yoho.unions.server.service.IUnionShareService;
import com.yoho.unions.server.task.CpsOrderExtraActivityTask;
/**
* Created by mingdan.ge on 2018/5/14.
... ... @@ -503,4 +516,17 @@ public class UnionShareRest {
PageResponseBO<UnionShareOrdersMonth> result = unionShareService.queryUnionShareOrdersMonthList(req);
return new UnionResponse(200, "queryUnionShareOrdersMonthList success",result);
}
/**
* 查询消息列表,提供给gateway使用
* @param req
* @return
*/
@RequestMapping("/queryMessageList")
@ResponseBody
public UnionResponse queryMessageList(@RequestBody UnionShareMessageReqBO req){
log.info("queryMessageList parm is {}", req);
PageResponseBO<UnionShareMessage> result = unionShareService.queryUnionShareMessageList(req);
return new UnionResponse(200, "queryMessageList success",result);
}
}
... ...
... ... @@ -18,6 +18,7 @@ import com.yoho.service.model.union.bo.UnionShareUserBankBo;
import com.yoho.service.model.union.bo.UnionShareUserBo;
import com.yoho.service.model.union.bo.UnionShareVirtualAddBo;
import com.yoho.service.model.union.request.UninoShareIncomeRankReqBo;
import com.yoho.service.model.union.request.UnionShareMessageReqBO;
import com.yoho.service.model.union.request.UnionShareOrderReqBO;
import com.yoho.service.model.union.request.UnionShareOrderSearchReqBO;
import com.yoho.service.model.union.request.UnionShareOrdersMonthReqBO;
... ... @@ -29,6 +30,7 @@ import com.yoho.service.model.union.response.PageUnionShareOrderRspBO;
import com.yoho.service.model.union.response.UnionShareStatisticsRspBO;
import com.yoho.service.model.union.response.UnionShareUserApplyListBo;
import com.yoho.service.model.union.response.UnionShareUserBankListBO;
import com.yoho.unions.dal.model.UnionShareMessage;
import com.yoho.unions.dal.model.UnionShareOrders;
import com.yoho.unions.dal.model.UnionShareOrdersActivity;
import com.yoho.unions.dal.model.UnionShareOrdersMonth;
... ... @@ -237,4 +239,11 @@ public interface IUnionShareService {
PageResponseBO<UnionShareOrdersMonth> queryUnionShareOrdersMonthList(UnionShareOrdersMonthReqBO req);
void clearActivityCache(int activityId);
/**
* 查询消息列表
* @param req
* @return
*/
PageResponseBO<UnionShareMessage> queryUnionShareMessageList(UnionShareMessageReqBO req);
}
... ...
... ... @@ -57,6 +57,7 @@ import com.yoho.service.model.union.bo.UnionShareUserBankBo;
import com.yoho.service.model.union.bo.UnionShareUserBo;
import com.yoho.service.model.union.bo.UnionShareVirtualAddBo;
import com.yoho.service.model.union.request.UninoShareIncomeRankReqBo;
import com.yoho.service.model.union.request.UnionShareMessageReqBO;
import com.yoho.service.model.union.request.UnionShareOrderReqBO;
import com.yoho.service.model.union.request.UnionShareOrderSearchReqBO;
import com.yoho.service.model.union.request.UnionShareOrdersMonthReqBO;
... ... @@ -88,6 +89,7 @@ import com.yoho.unions.convert.BeanConvert;
import com.yoho.unions.convert.Convert;
import com.yoho.unions.dal.IMktMarketingUrlDAO;
import com.yoho.unions.dal.UnionShareBigDataClickMapper;
import com.yoho.unions.dal.UnionShareMessageMapper;
import com.yoho.unions.dal.UnionShareOrdersActivityItemMapper;
import com.yoho.unions.dal.UnionShareOrdersActivityLogsMapper;
import com.yoho.unions.dal.UnionShareOrdersActivityMapper;
... ... @@ -100,6 +102,7 @@ import com.yoho.unions.dal.UnionShareUserBankMapper;
import com.yoho.unions.dal.UnionShareUserMapper;
import com.yoho.unions.dal.model.MktMarketingUrl;
import com.yoho.unions.dal.model.UnionShareBigDataClick;
import com.yoho.unions.dal.model.UnionShareMessage;
import com.yoho.unions.dal.model.UnionShareOrders;
import com.yoho.unions.dal.model.UnionShareOrdersActivity;
import com.yoho.unions.dal.model.UnionShareOrdersActivityItem;
... ... @@ -152,6 +155,8 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
UnionShareOrdersMonthMapper unionShareOrdersMonthMapper;
@Autowired
UnionShareBigDataClickMapper unionShareBigDataClickMapper;
@Autowired
UnionShareMessageMapper unionShareMessageMapper;
@Resource
RedisValueCache redisValueCache;
@Resource
... ... @@ -2328,6 +2333,36 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
return result;
}
@Override
public PageResponseBO<UnionShareMessage> queryUnionShareMessageList(UnionShareMessageReqBO req) {
logger.info("queryUnionShareMessageList.req is {}",req);
PageResponseBO<UnionShareMessage> cacheResult = getFromRedis(ShareOrdersKeyEnum.MESSAGE_LIST, 0,
PageResponseBO.class, String.valueOf(req.getPage()), String.valueOf(req.getSize()));
if (cacheResult != null) {
logger.debug("UnionShareServiceImpl :: queryUnionShareMessageList get redis cache,cacheResult is {}",cacheResult);
return cacheResult;
}
req.setEffective(true);//查询有效期内的消息
int total=unionShareMessageMapper.selectTotalByCondition(req);
if(total==0){
logger.info("queryUnionShareMessageList end.req is {},total is 0",req);
return null;
}
List<UnionShareMessage> list = unionShareMessageMapper.selectByCondition(req);
PageResponseBO<UnionShareMessage> result=new PageResponseBO<>();
result.setList(list);
result.setPage(req.getPage());
result.setSize(req.getSize());
result.setTotal(total);
//设置缓存
addToRedis(ShareOrdersKeyEnum.MESSAGE_LIST, 0, result,String.valueOf(req.getPage()), String.valueOf(req.getSize()));
return result;
}
private int getClickNum(Integer uid, Integer startDate, Integer endDate) {
UnionShareUser unionShareUser = unionShareUserMapper.selectByUid(uid);
if(null == unionShareUser) {
... ...
... ... @@ -81,6 +81,7 @@ datasources:
- com.yoho.unions.dal.UnionShareOrdersActivityMapper
- com.yoho.unions.dal.UnionShareOrdersActivityItemMapper
- com.yoho.unions.dal.UnionShareOrdersMonthMapper
- com.yoho.unions.dal.UnionShareMessageMapper
... ...
... ... @@ -73,6 +73,7 @@ datasources:
- com.yoho.unions.dal.UnionShareOrdersActivityMapper
- com.yoho.unions.dal.UnionShareOrdersActivityItemMapper
- com.yoho.unions.dal.UnionShareOrdersMonthMapper
- com.yoho.unions.dal.UnionShareMessageMapper
bigdata_yh_unions:
servers:
... ...