Authored by mingdan.ge

cps活动落地页

@@ -124,6 +124,8 @@ @@ -124,6 +124,8 @@
124 <value>/UnionShareRest/deleteMessage</value> 124 <value>/UnionShareRest/deleteMessage</value>
125 <value>/UnionShareRest/getMessageById</value> 125 <value>/UnionShareRest/getMessageById</value>
126 <value>/UnionShareRest/updateMessage</value> 126 <value>/UnionShareRest/updateMessage</value>
  127 + <value>/UnionShareRest/queryActivityPage</value>
  128 + <value>/UnionShareRest/preJoinActivity</value>
127 </list> 129 </list>
128 </property> 130 </property>
129 <property name="excludeMethods"> 131 <property name="excludeMethods">
  1 +package com.yoho.unions.dal;
  2 +
  3 +import com.yoho.unions.dal.model.UnionShareOrdersActivityPage;
  4 +
  5 +public interface UnionShareOrdersActivityPageMapper {
  6 + int deleteByPrimaryKey(Integer id);
  7 +
  8 + int insert(UnionShareOrdersActivityPage record);
  9 +
  10 + int insertSelective(UnionShareOrdersActivityPage record);
  11 +
  12 + UnionShareOrdersActivityPage selectByPrimaryKey(Integer id);
  13 +
  14 + int updateByPrimaryKeySelective(UnionShareOrdersActivityPage record);
  15 +
  16 + int updateByPrimaryKeyWithBLOBs(UnionShareOrdersActivityPage record);
  17 +
  18 + int updateByPrimaryKey(UnionShareOrdersActivityPage record);
  19 +}
  1 +package com.yoho.unions.dal;
  2 +
  3 +import com.yoho.unions.dal.model.UnionShareOrdersActivityPagePre;
  4 +import org.apache.ibatis.annotations.Param;
  5 +
  6 +public interface UnionShareOrdersActivityPagePreMapper {
  7 + int deleteByPrimaryKey(Integer id);
  8 +
  9 + int insert(UnionShareOrdersActivityPagePre record);
  10 +
  11 + int insertSelective(UnionShareOrdersActivityPagePre record);
  12 +
  13 + UnionShareOrdersActivityPagePre selectByPrimaryKey(Integer id);
  14 + UnionShareOrdersActivityPagePre selectByUidAndPageId(@Param("uid") Integer uid,@Param("pageId") Integer pageId);
  15 +
  16 + int updateByPrimaryKeySelective(UnionShareOrdersActivityPagePre record);
  17 +
  18 + int updateByPrimaryKey(UnionShareOrdersActivityPagePre record);
  19 +}
  1 +package com.yoho.unions.dal.model;
  2 +
  3 +public class UnionShareOrdersActivityPage {
  4 + private Integer id;
  5 +
  6 + private Integer activityId;
  7 +
  8 + private String title;
  9 +
  10 + private String image;
  11 +
  12 + private String url;
  13 +
  14 + private Integer createTime;
  15 +
  16 + private Integer updateTime;
  17 +
  18 + private Integer status;
  19 +
  20 + private String content;
  21 +
  22 + public Integer getId() {
  23 + return id;
  24 + }
  25 +
  26 + public void setId(Integer id) {
  27 + this.id = id;
  28 + }
  29 +
  30 + public Integer getActivityId() {
  31 + return activityId;
  32 + }
  33 +
  34 + public void setActivityId(Integer activityId) {
  35 + this.activityId = activityId;
  36 + }
  37 +
  38 + public String getTitle() {
  39 + return title;
  40 + }
  41 +
  42 + public void setTitle(String title) {
  43 + this.title = title == null ? null : title.trim();
  44 + }
  45 +
  46 + public String getImage() {
  47 + return image;
  48 + }
  49 +
  50 + public void setImage(String image) {
  51 + this.image = image == null ? null : image.trim();
  52 + }
  53 +
  54 + public String getUrl() {
  55 + return url;
  56 + }
  57 +
  58 + public void setUrl(String url) {
  59 + this.url = url == null ? null : url.trim();
  60 + }
  61 +
  62 + public Integer getCreateTime() {
  63 + return createTime;
  64 + }
  65 +
  66 + public void setCreateTime(Integer createTime) {
  67 + this.createTime = createTime;
  68 + }
  69 +
  70 + public Integer getUpdateTime() {
  71 + return updateTime;
  72 + }
  73 +
  74 + public void setUpdateTime(Integer updateTime) {
  75 + this.updateTime = updateTime;
  76 + }
  77 +
  78 + public Integer getStatus() {
  79 + return status;
  80 + }
  81 +
  82 + public void setStatus(Integer status) {
  83 + this.status = status;
  84 + }
  85 +
  86 + public String getContent() {
  87 + return content;
  88 + }
  89 +
  90 + public void setContent(String content) {
  91 + this.content = content == null ? null : content.trim();
  92 + }
  93 +}
  1 +package com.yoho.unions.dal.model;
  2 +
  3 +public class UnionShareOrdersActivityPagePre {
  4 + private Integer id;
  5 +
  6 + private Integer uid;
  7 +
  8 + private Integer activityId;
  9 +
  10 + private Integer pageId;
  11 +
  12 + private Integer createTime;
  13 +
  14 + public Integer getId() {
  15 + return id;
  16 + }
  17 +
  18 + public void setId(Integer id) {
  19 + this.id = id;
  20 + }
  21 +
  22 + public Integer getUid() {
  23 + return uid;
  24 + }
  25 +
  26 + public void setUid(Integer uid) {
  27 + this.uid = uid;
  28 + }
  29 +
  30 + public Integer getActivityId() {
  31 + return activityId;
  32 + }
  33 +
  34 + public void setActivityId(Integer activityId) {
  35 + this.activityId = activityId;
  36 + }
  37 +
  38 + public Integer getPageId() {
  39 + return pageId;
  40 + }
  41 +
  42 + public void setPageId(Integer pageId) {
  43 + this.pageId = pageId;
  44 + }
  45 +
  46 + public Integer getCreateTime() {
  47 + return createTime;
  48 + }
  49 +
  50 + public void setCreateTime(Integer createTime) {
  51 + this.createTime = createTime;
  52 + }
  53 +}
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3 +<mapper namespace="com.yoho.unions.dal.UnionShareOrdersActivityPageMapper" >
  4 + <resultMap id="BaseResultMap" type="com.yoho.unions.dal.model.UnionShareOrdersActivityPage" >
  5 + <id column="id" property="id" jdbcType="INTEGER" />
  6 + <result column="activity_id" property="activityId" jdbcType="INTEGER" />
  7 + <result column="title" property="title" jdbcType="VARCHAR" />
  8 + <result column="image" property="image" jdbcType="VARCHAR" />
  9 + <result column="url" property="url" jdbcType="VARCHAR" />
  10 + <result column="create_time" property="createTime" jdbcType="INTEGER" />
  11 + <result column="update_time" property="updateTime" jdbcType="INTEGER" />
  12 + <result column="status" property="status" jdbcType="INTEGER" />
  13 + </resultMap>
  14 + <resultMap id="ResultMapWithBLOBs" type="com.yoho.unions.dal.model.UnionShareOrdersActivityPage" extends="BaseResultMap" >
  15 + <result column="content" property="content" jdbcType="LONGVARCHAR" />
  16 + </resultMap>
  17 + <sql id="Base_Column_List" >
  18 + id, activity_id, title, image, url, create_time, update_time, status
  19 + </sql>
  20 + <sql id="Blob_Column_List" >
  21 + content
  22 + </sql>
  23 + <select id="selectByPrimaryKey" resultMap="ResultMapWithBLOBs" parameterType="java.lang.Integer" >
  24 + select
  25 + <include refid="Base_Column_List" />
  26 + ,
  27 + <include refid="Blob_Column_List" />
  28 + from union_share_orders_activity_page
  29 + where id = #{id,jdbcType=INTEGER}
  30 + </select>
  31 + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  32 + delete from union_share_orders_activity_page
  33 + where id = #{id,jdbcType=INTEGER}
  34 + </delete>
  35 + <insert id="insert" parameterType="com.yoho.unions.dal.model.UnionShareOrdersActivityPage" >
  36 + insert into union_share_orders_activity_page (id, activity_id, title,
  37 + image, url, create_time,
  38 + update_time, status, content
  39 + )
  40 + values (#{id,jdbcType=INTEGER}, #{activityId,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR},
  41 + #{image,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{createTime,jdbcType=INTEGER},
  42 + #{updateTime,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{content,jdbcType=LONGVARCHAR}
  43 + )
  44 + </insert>
  45 + <insert id="insertSelective" parameterType="com.yoho.unions.dal.model.UnionShareOrdersActivityPage" >
  46 + insert into union_share_orders_activity_page
  47 + <trim prefix="(" suffix=")" suffixOverrides="," >
  48 + <if test="id != null" >
  49 + id,
  50 + </if>
  51 + <if test="activityId != null" >
  52 + activity_id,
  53 + </if>
  54 + <if test="title != null" >
  55 + title,
  56 + </if>
  57 + <if test="image != null" >
  58 + image,
  59 + </if>
  60 + <if test="url != null" >
  61 + url,
  62 + </if>
  63 + <if test="createTime != null" >
  64 + create_time,
  65 + </if>
  66 + <if test="updateTime != null" >
  67 + update_time,
  68 + </if>
  69 + <if test="status != null" >
  70 + status,
  71 + </if>
  72 + <if test="content != null" >
  73 + content,
  74 + </if>
  75 + </trim>
  76 + <trim prefix="values (" suffix=")" suffixOverrides="," >
  77 + <if test="id != null" >
  78 + #{id,jdbcType=INTEGER},
  79 + </if>
  80 + <if test="activityId != null" >
  81 + #{activityId,jdbcType=INTEGER},
  82 + </if>
  83 + <if test="title != null" >
  84 + #{title,jdbcType=VARCHAR},
  85 + </if>
  86 + <if test="image != null" >
  87 + #{image,jdbcType=VARCHAR},
  88 + </if>
  89 + <if test="url != null" >
  90 + #{url,jdbcType=VARCHAR},
  91 + </if>
  92 + <if test="createTime != null" >
  93 + #{createTime,jdbcType=INTEGER},
  94 + </if>
  95 + <if test="updateTime != null" >
  96 + #{updateTime,jdbcType=INTEGER},
  97 + </if>
  98 + <if test="status != null" >
  99 + #{status,jdbcType=INTEGER},
  100 + </if>
  101 + <if test="content != null" >
  102 + #{content,jdbcType=LONGVARCHAR},
  103 + </if>
  104 + </trim>
  105 + </insert>
  106 + <update id="updateByPrimaryKeySelective" parameterType="com.yoho.unions.dal.model.UnionShareOrdersActivityPage" >
  107 + update union_share_orders_activity_page
  108 + <set >
  109 + <if test="activityId != null" >
  110 + activity_id = #{activityId,jdbcType=INTEGER},
  111 + </if>
  112 + <if test="title != null" >
  113 + title = #{title,jdbcType=VARCHAR},
  114 + </if>
  115 + <if test="image != null" >
  116 + image = #{image,jdbcType=VARCHAR},
  117 + </if>
  118 + <if test="url != null" >
  119 + url = #{url,jdbcType=VARCHAR},
  120 + </if>
  121 + <if test="createTime != null" >
  122 + create_time = #{createTime,jdbcType=INTEGER},
  123 + </if>
  124 + <if test="updateTime != null" >
  125 + update_time = #{updateTime,jdbcType=INTEGER},
  126 + </if>
  127 + <if test="status != null" >
  128 + status = #{status,jdbcType=INTEGER},
  129 + </if>
  130 + <if test="content != null" >
  131 + content = #{content,jdbcType=LONGVARCHAR},
  132 + </if>
  133 + </set>
  134 + where id = #{id,jdbcType=INTEGER}
  135 + </update>
  136 + <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.yoho.unions.dal.model.UnionShareOrdersActivityPage" >
  137 + update union_share_orders_activity_page
  138 + set activity_id = #{activityId,jdbcType=INTEGER},
  139 + title = #{title,jdbcType=VARCHAR},
  140 + image = #{image,jdbcType=VARCHAR},
  141 + url = #{url,jdbcType=VARCHAR},
  142 + create_time = #{createTime,jdbcType=INTEGER},
  143 + update_time = #{updateTime,jdbcType=INTEGER},
  144 + status = #{status,jdbcType=INTEGER},
  145 + content = #{content,jdbcType=LONGVARCHAR}
  146 + where id = #{id,jdbcType=INTEGER}
  147 + </update>
  148 + <update id="updateByPrimaryKey" parameterType="com.yoho.unions.dal.model.UnionShareOrdersActivityPage" >
  149 + update union_share_orders_activity_page
  150 + set activity_id = #{activityId,jdbcType=INTEGER},
  151 + title = #{title,jdbcType=VARCHAR},
  152 + image = #{image,jdbcType=VARCHAR},
  153 + url = #{url,jdbcType=VARCHAR},
  154 + create_time = #{createTime,jdbcType=INTEGER},
  155 + update_time = #{updateTime,jdbcType=INTEGER},
  156 + status = #{status,jdbcType=INTEGER}
  157 + where id = #{id,jdbcType=INTEGER}
  158 + </update>
  159 +</mapper>
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3 +<mapper namespace="com.yoho.unions.dal.UnionShareOrdersActivityPagePreMapper" >
  4 + <resultMap id="BaseResultMap" type="com.yoho.unions.dal.model.UnionShareOrdersActivityPagePre" >
  5 + <id column="id" property="id" jdbcType="INTEGER" />
  6 + <result column="uid" property="uid" jdbcType="INTEGER" />
  7 + <result column="activity_id" property="activityId" jdbcType="INTEGER" />
  8 + <result column="page_id" property="pageId" jdbcType="INTEGER" />
  9 + <result column="create_time" property="createTime" jdbcType="INTEGER" />
  10 + </resultMap>
  11 + <sql id="Base_Column_List" >
  12 + id, uid, activity_id, page_id, create_time
  13 + </sql>
  14 + <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
  15 + select
  16 + <include refid="Base_Column_List" />
  17 + from union_share_orders_activity_page_pre
  18 + where id = #{id,jdbcType=INTEGER}
  19 + </select>
  20 + <select id="selectByUidAndPageId" resultMap="BaseResultMap" >
  21 + select
  22 + <include refid="Base_Column_List" />
  23 + from union_share_orders_activity_page_pre
  24 + where page_id = #{pageId,jdbcType=INTEGER} and uid = #{uid,jdbcType=INTEGER}
  25 + </select>
  26 + <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
  27 + delete from union_share_orders_activity_page_pre
  28 + where id = #{id,jdbcType=INTEGER}
  29 + </delete>
  30 + <insert id="insert" parameterType="com.yoho.unions.dal.model.UnionShareOrdersActivityPagePre" >
  31 + insert into union_share_orders_activity_page_pre (id, uid, activity_id,
  32 + page_id, create_time)
  33 + values (#{id,jdbcType=INTEGER}, #{uid,jdbcType=INTEGER}, #{activityId,jdbcType=INTEGER},
  34 + #{pageId,jdbcType=INTEGER}, #{createTime,jdbcType=INTEGER})
  35 + </insert>
  36 + <insert id="insertSelective" parameterType="com.yoho.unions.dal.model.UnionShareOrdersActivityPagePre" >
  37 + insert into union_share_orders_activity_page_pre
  38 + <trim prefix="(" suffix=")" suffixOverrides="," >
  39 + <if test="id != null" >
  40 + id,
  41 + </if>
  42 + <if test="uid != null" >
  43 + uid,
  44 + </if>
  45 + <if test="activityId != null" >
  46 + activity_id,
  47 + </if>
  48 + <if test="pageId != null" >
  49 + page_id,
  50 + </if>
  51 + <if test="createTime != null" >
  52 + create_time,
  53 + </if>
  54 + </trim>
  55 + <trim prefix="values (" suffix=")" suffixOverrides="," >
  56 + <if test="id != null" >
  57 + #{id,jdbcType=INTEGER},
  58 + </if>
  59 + <if test="uid != null" >
  60 + #{uid,jdbcType=INTEGER},
  61 + </if>
  62 + <if test="activityId != null" >
  63 + #{activityId,jdbcType=INTEGER},
  64 + </if>
  65 + <if test="pageId != null" >
  66 + #{pageId,jdbcType=INTEGER},
  67 + </if>
  68 + <if test="createTime != null" >
  69 + #{createTime,jdbcType=INTEGER},
  70 + </if>
  71 + </trim>
  72 + </insert>
  73 + <update id="updateByPrimaryKeySelective" parameterType="com.yoho.unions.dal.model.UnionShareOrdersActivityPagePre" >
  74 + update union_share_orders_activity_page_pre
  75 + <set >
  76 + <if test="uid != null" >
  77 + uid = #{uid,jdbcType=INTEGER},
  78 + </if>
  79 + <if test="activityId != null" >
  80 + activity_id = #{activityId,jdbcType=INTEGER},
  81 + </if>
  82 + <if test="pageId != null" >
  83 + page_id = #{pageId,jdbcType=INTEGER},
  84 + </if>
  85 + <if test="createTime != null" >
  86 + create_time = #{createTime,jdbcType=INTEGER},
  87 + </if>
  88 + </set>
  89 + where id = #{id,jdbcType=INTEGER}
  90 + </update>
  91 + <update id="updateByPrimaryKey" parameterType="com.yoho.unions.dal.model.UnionShareOrdersActivityPagePre" >
  92 + update union_share_orders_activity_page_pre
  93 + set uid = #{uid,jdbcType=INTEGER},
  94 + activity_id = #{activityId,jdbcType=INTEGER},
  95 + page_id = #{pageId,jdbcType=INTEGER},
  96 + create_time = #{createTime,jdbcType=INTEGER}
  97 + where id = #{id,jdbcType=INTEGER}
  98 + </update>
  99 +</mapper>
@@ -317,6 +317,37 @@ public class UnionShareRest { @@ -317,6 +317,37 @@ public class UnionShareRest {
317 UnionShareOrdersActivityLogsBo shareOrderBo = unionShareService.queryActivityOrder(unionShareOrderReqBO.getUid(),unionShareOrderReqBO.getActivityOrderId()); 317 UnionShareOrdersActivityLogsBo shareOrderBo = unionShareService.queryActivityOrder(unionShareOrderReqBO.getUid(),unionShareOrderReqBO.getActivityOrderId());
318 return new UnionResponse(200, "queryActivityOrder success",shareOrderBo); 318 return new UnionResponse(200, "queryActivityOrder success",shareOrderBo);
319 } 319 }
  320 + /**
  321 + * 获取活动落地页数据,及用户参与情况
  322 + * @param req
  323 + * @return
  324 + */
  325 + @RequestMapping("/queryActivityPage")
  326 + @ResponseBody
  327 + public UnionResponse queryActivityPage(@RequestBody UnionShareOrdersActivityPageReq req){
  328 + log.info("UnionShareRest.queryActivityPage req is {}", req);
  329 + if (req == null || req.getId() == null) {
  330 + return new UnionResponse(400, "queryActivityPage id is null");
  331 + }
  332 + UnionShareOrdersActivityPageBo result = unionShareService.queryActivityPage(req);
  333 + return new UnionResponse(200, "queryActivityPage success",result);
  334 + }
  335 + /**
  336 + * 预参加活动
  337 + * @param req
  338 + * @return
  339 + */
  340 + @RequestMapping("/preJoinActivity")
  341 + @ResponseBody
  342 + public UnionResponse preJoinActivity(@RequestBody UnionShareOrdersActivityPageReq req){
  343 + log.info("UnionShareRest.preJoinActivity req is {}", req);
  344 + if (req == null || req.getId() == null || req.getUid() == null) {
  345 + return new UnionResponse(400, "preJoinActivity param error");
  346 + }
  347 + UnionShareOrdersActivityPageRsp result = unionShareService.preJoinActivity(req);
  348 + return new UnionResponse(200, "preJoinActivity success",result);
  349 + }
  350 +
320 351
321 /** 352 /**
322 * 提现记录列表 353 * 提现记录列表
@@ -142,6 +142,15 @@ public interface IUnionShareService { @@ -142,6 +142,15 @@ public interface IUnionShareService {
142 UnionShareOrdersActivityLogsBo queryActivityOrder(Integer uid,Integer activityOrderId); 142 UnionShareOrdersActivityLogsBo queryActivityOrder(Integer uid,Integer activityOrderId);
143 143
144 /** 144 /**
  145 + * 预参加活动
  146 + * */
  147 + UnionShareOrdersActivityPageRsp preJoinActivity(UnionShareOrdersActivityPageReq req);
  148 + /**
  149 + * 查询活动落地页及用户信息
  150 + * */
  151 + UnionShareOrdersActivityPageBo queryActivityPage(UnionShareOrdersActivityPageReq req);
  152 +
  153 + /**
145 * 提现记录列表 154 * 提现记录列表
146 * @param unionShareOrderReqBO 155 * @param unionShareOrderReqBO
147 * @return 156 * @return
@@ -112,6 +112,12 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -112,6 +112,12 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
112 @Autowired 112 @Autowired
113 UnionShareUserInviteMapper unionShareUserInviteMapper; 113 UnionShareUserInviteMapper unionShareUserInviteMapper;
114 114
  115 + @Autowired
  116 + UnionShareOrdersActivityPageMapper unionOrdersActivityPageMapper;
  117 +
  118 + @Autowired
  119 + UnionShareOrdersActivityPagePreMapper unionOrdersActivityPagePreMapper;
  120 +
115 @Resource 121 @Resource
116 RedisValueCache redisValueCache; 122 RedisValueCache redisValueCache;
117 @Resource 123 @Resource
@@ -651,7 +657,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -651,7 +657,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
651 unionShareUserInviteMapper.insertSelective(newObj); 657 unionShareUserInviteMapper.insertSelective(newObj);
652 //清缓存 658 //清缓存
653 redisHashCache.delete(ShareOrdersKeyEnum.INVITE_LIST.getPreKey(),inviterUid); 659 redisHashCache.delete(ShareOrdersKeyEnum.INVITE_LIST.getPreKey(),inviterUid);
654 - redisHashCache.delete(ShareOrdersKeyEnum.UNION_TYPE.getPreKey(),inviterUid); 660 + redisHashCache.delete(ShareOrdersKeyEnum.UNION_TYPE.getPreKey(),inviterUid,"shareTotal");
655 return; 661 return;
656 } 662 }
657 //老用户更新粉丝注册有赚7天内订单统计数据 663 //老用户更新粉丝注册有赚7天内订单统计数据
@@ -682,7 +688,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -682,7 +688,7 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
682 logger.info("updateInviterHistory end.inviterUid is {},unionShareUser is {},isNew is {},updateObj is {}.",inviterUid,unionShareUser,isNew,updateObj); 688 logger.info("updateInviterHistory end.inviterUid is {},unionShareUser is {},isNew is {},updateObj is {}.",inviterUid,unionShareUser,isNew,updateObj);
683 //清缓存 689 //清缓存
684 redisHashCache.delete(ShareOrdersKeyEnum.INVITE_LIST.getPreKey(),inviterUid); 690 redisHashCache.delete(ShareOrdersKeyEnum.INVITE_LIST.getPreKey(),inviterUid);
685 - redisHashCache.delete(ShareOrdersKeyEnum.UNION_TYPE.getPreKey(),inviterUid); 691 + redisHashCache.delete(ShareOrdersKeyEnum.UNION_TYPE.getPreKey(),inviterUid,"shareTotal");
686 } 692 }
687 693
688 public MktMarketingUrl buildMktMarketingUrl(int uid) { 694 public MktMarketingUrl buildMktMarketingUrl(int uid) {
@@ -1221,6 +1227,94 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport @@ -1221,6 +1227,94 @@ public class UnionShareServiceImpl implements IUnionShareService,IBusinessExport
1221 addToRedis(ShareOrdersKeyEnum.ACTIVITY_ORDER,uid,activityLogBo, activityOrderId.toString()); 1227 addToRedis(ShareOrdersKeyEnum.ACTIVITY_ORDER,uid,activityLogBo, activityOrderId.toString());
1222 return activityLogBo; 1228 return activityLogBo;
1223 } 1229 }
  1230 +
  1231 + /**
  1232 + * 预参加活动:1-参与成功 2-已参加过 3-不满足参加条件 4-活动未开始 5-活动已结束
  1233 + * */
  1234 + public UnionShareOrdersActivityPageRsp preJoinActivity(UnionShareOrdersActivityPageReq req){
  1235 + UnionShareOrdersActivityPageRsp resp = new UnionShareOrdersActivityPageRsp();
  1236 + //判断用户是否参与过
  1237 + UnionShareOrdersActivityPagePre unionShareOrdersActivityPagePre = unionOrdersActivityPagePreMapper.selectByUidAndPageId(req.getUid(), req.getId());
  1238 + if (unionShareOrdersActivityPagePre != null) {
  1239 + resp.setResult(2);
  1240 + resp.setMessage("已参加");
  1241 + return resp;
  1242 + }
  1243 + //查询落地页
  1244 + UnionShareOrdersActivityPage unionShareOrdersActivityPage = unionOrdersActivityPageMapper.selectByPrimaryKey(req.getId());
  1245 + if (unionShareOrdersActivityPage == null) {
  1246 + throw new ServiceException(ServiceError.PARAM_ERROR);
  1247 + }
  1248 + //查询活动
  1249 + UnionShareOrdersActivity activity = unionShareOrdersActivityMapper.selectByPrimaryKey(unionShareOrdersActivityPage.getActivityId());
  1250 + if (activity == null) {
  1251 + //活动不存在,数据配置有问题
  1252 + throw new ServiceException(ServiceError.PARAM_ERROR);
  1253 + }
  1254 +
  1255 + //判断是否活动期间
  1256 + int now = DateUtil.getCurrentTimeSecond();
  1257 + if(activity.getStartTime()>now){
  1258 + resp.setResult(4);
  1259 + resp.setMessage("活动未开始");
  1260 + return resp;
  1261 + }else if(activity.getEndTime()<now){
  1262 + resp.setResult(5);
  1263 + resp.setMessage("活动已结束");
  1264 + return resp;
  1265 + }
  1266 + //判断用户是否有参加活动的权限
  1267 +
  1268 +
  1269 + //参与活动
  1270 + UnionShareOrdersActivityPagePre insertObj = new UnionShareOrdersActivityPagePre();
  1271 + insertObj.setActivityId(activity.getId());
  1272 + insertObj.setPageId(req.getId());
  1273 + insertObj.setUid(req.getUid());
  1274 + insertObj.setCreateTime(now);
  1275 + int result=unionOrdersActivityPagePreMapper.insertSelective(insertObj);
  1276 + //todo 清缓存
  1277 + resp.setResult(result);
  1278 + return resp;
  1279 + }
  1280 +
  1281 + /**
  1282 + * 查询活动落地页及用户信息
  1283 + * */
  1284 + @Override
  1285 + public UnionShareOrdersActivityPageBo queryActivityPage(UnionShareOrdersActivityPageReq req){
  1286 + //查缓存
  1287 + UnionShareOrdersActivityPageBo result = new UnionShareOrdersActivityPageBo();
  1288 + UnionShareOrdersActivityPage unionShareOrdersActivityPage = unionOrdersActivityPageMapper.selectByPrimaryKey(req.getId());
  1289 + if (unionShareOrdersActivityPage == null) {
  1290 + throw new ServiceException(ServiceError.PARAM_ERROR);
  1291 + }
  1292 + BeanUtils.copyProperties(unionShareOrdersActivityPage,result);
  1293 + UnionShareOrdersActivity activity = unionShareOrdersActivityMapper.selectByPrimaryKey(unionShareOrdersActivityPage.getActivityId());
  1294 + if (activity == null) {
  1295 + //活动不存在,数据配置有问题
  1296 + result.setStatus(1);//1-未开始,2-已开始未参加,3-已参加,4-已结束
  1297 + }
  1298 + int now = DateUtil.getCurrentTimeSecond();
  1299 + if (activity.getStartTime() > now) {
  1300 + result.setStatus(1);
  1301 + } else if (activity.getEndTime() < now) {
  1302 + result.setStatus(4);
  1303 + } else if (req.getUid()==null||req.getUid()<=0) {
  1304 + result.setStatus(2);
  1305 + } else {
  1306 + result.setStatus(3);
  1307 + //判断用户是否参与过
  1308 + UnionShareOrdersActivityPagePre unionShareOrdersActivityPagePre = unionOrdersActivityPagePreMapper.selectByUidAndPageId(req.getUid(), req.getId());
  1309 + if (unionShareOrdersActivityPagePre == null) {
  1310 + result.setStatus(2);
  1311 + }
  1312 + }
  1313 + //加缓存
  1314 + return result;
  1315 + }
  1316 +
  1317 +
1224 private void dealWithOrderStatus(ShareOrderBo shareOrderBo) { 1318 private void dealWithOrderStatus(ShareOrderBo shareOrderBo) {
1225 //10.待确认 20.待提现 30.提现中 40.提现成功 91.订单取消 92.订单退货 93.订单换货 100.不可结算 1319 //10.待确认 20.待提现 30.提现中 40.提现成功 91.订单取消 92.订单退货 93.订单换货 100.不可结算
1226 switch (Integer.valueOf(shareOrderBo.getStatus())){ 1320 switch (Integer.valueOf(shareOrderBo.getStatus())){
@@ -83,6 +83,8 @@ datasources: @@ -83,6 +83,8 @@ datasources:
83 - com.yoho.unions.dal.UnionShareOrdersMonthMapper 83 - com.yoho.unions.dal.UnionShareOrdersMonthMapper
84 - com.yoho.unions.dal.UnionShareMessageMapper 84 - com.yoho.unions.dal.UnionShareMessageMapper
85 - com.yoho.unions.dal.UnionShareUserInviteMapper 85 - com.yoho.unions.dal.UnionShareUserInviteMapper
  86 + - com.yoho.unions.dal.UnionShareOrdersActivityPagePreMapper
  87 + - com.yoho.unions.dal.UnionShareOrdersActivityPageMapper
86 88
87 89
88 90
@@ -75,6 +75,8 @@ datasources: @@ -75,6 +75,8 @@ datasources:
75 - com.yoho.unions.dal.UnionShareOrdersMonthMapper 75 - com.yoho.unions.dal.UnionShareOrdersMonthMapper
76 - com.yoho.unions.dal.UnionShareMessageMapper 76 - com.yoho.unions.dal.UnionShareMessageMapper
77 - com.yoho.unions.dal.UnionShareUserInviteMapper 77 - com.yoho.unions.dal.UnionShareUserInviteMapper
  78 + - com.yoho.unions.dal.UnionShareOrdersActivityPagePreMapper
  79 + - com.yoho.unions.dal.UnionShareOrdersActivityPageMapper
78 80
79 bigdata_yh_unions: 81 bigdata_yh_unions:
80 servers: 82 servers: