Authored by wangxin

活动内容修改

@@ -209,4 +209,24 @@ public class OrderShareActivityBO extends BaseModel{ @@ -209,4 +209,24 @@ public class OrderShareActivityBO extends BaseModel{
209 this.oldUserCouponPic = oldUserCouponPic; 209 this.oldUserCouponPic = oldUserCouponPic;
210 } 210 }
211 211
  212 + public String getFormatActivityDesc() {
  213 + if (null == activityDesc) {
  214 + return "";
  215 + }
  216 +
  217 + String[] array = activityDesc.split("(\\r\\n|\\r|\\n|\\n\\r)");
  218 + if (array.length > 0) {
  219 + StringBuffer sb = new StringBuffer();
  220 +
  221 + for(String s : array) {
  222 + sb.append("<P>");
  223 + sb.append(s);
  224 + sb.append("</P>");
  225 + }
  226 +
  227 + return sb.toString();
  228 + }
  229 +
  230 + return "";
  231 + }
212 } 232 }
@@ -33,4 +33,26 @@ public class TencentMktBO extends TencentMktActivityBO{ @@ -33,4 +33,26 @@ public class TencentMktBO extends TencentMktActivityBO{
33 public void setShareUrl(String shareUrl) { 33 public void setShareUrl(String shareUrl) {
34 this.shareUrl = shareUrl; 34 this.shareUrl = shareUrl;
35 } 35 }
  36 +
  37 + public String getFormatActivityDesc() {
  38 + String activityDesc = getActivityDesc();
  39 + if (null == activityDesc) {
  40 + return "";
  41 + }
  42 +
  43 + String[] array = activityDesc.split("(\\r\\n|\\r|\\n|\\n\\r)");
  44 + if (array.length > 0) {
  45 + StringBuffer sb = new StringBuffer();
  46 +
  47 + for(String s : array) {
  48 + sb.append("<P>");
  49 + sb.append(s);
  50 + sb.append("</P>");
  51 + }
  52 +
  53 + return sb.toString();
  54 + }
  55 +
  56 + return "";
  57 + }
36 } 58 }
@@ -17,5 +17,5 @@ public interface IOrderShareCouponDAO { @@ -17,5 +17,5 @@ public interface IOrderShareCouponDAO {
17 17
18 int updateByPrimaryKey(OrderShareCoupon record); 18 int updateByPrimaryKey(OrderShareCoupon record);
19 19
20 - OrderShareCoupon selectCouponByDateAndType(@Param("useDate") String useDate, @Param("couponType") int couponType); 20 + OrderShareCoupon selectCouponByDateAndType(@Param("useDate") String useDate, @Param("couponType") int couponType, @Param("activityId") int activityId);
21 } 21 }
@@ -2,7 +2,7 @@ package com.yoho.coupon.dal.model; @@ -2,7 +2,7 @@ package com.yoho.coupon.dal.model;
2 2
3 import com.yoho.queue.dal.model.BaseModel; 3 import com.yoho.queue.dal.model.BaseModel;
4 4
5 -public class OrderShareCoupon extends BaseModel { 5 + public class OrderShareCoupon extends BaseModel {
6 /** 6 /**
7 * 7 *
8 */ 8 */
@@ -18,6 +18,10 @@ public class OrderShareCoupon extends BaseModel { @@ -18,6 +18,10 @@ public class OrderShareCoupon extends BaseModel {
18 18
19 private Integer couponType; 19 private Integer couponType;
20 20
  21 + private Integer activityId;
  22 +
  23 + private String couponPic;
  24 +
21 public Integer getId() { 25 public Integer getId() {
22 return id; 26 return id;
23 } 27 }
@@ -57,4 +61,20 @@ public class OrderShareCoupon extends BaseModel { @@ -57,4 +61,20 @@ public class OrderShareCoupon extends BaseModel {
57 public void setCouponType(Integer couponType) { 61 public void setCouponType(Integer couponType) {
58 this.couponType = couponType; 62 this.couponType = couponType;
59 } 63 }
  64 +
  65 + public Integer getActivityId() {
  66 + return activityId;
  67 + }
  68 +
  69 + public void setActivityId(Integer activityId) {
  70 + this.activityId = activityId;
  71 + }
  72 +
  73 + public String getCouponPic() {
  74 + return couponPic;
  75 + }
  76 +
  77 + public void setCouponPic(String couponPic) {
  78 + this.couponPic = couponPic;
  79 + }
60 } 80 }
@@ -7,9 +7,11 @@ @@ -7,9 +7,11 @@
7 <result column="coupon_name" property="couponName" jdbcType="VARCHAR" /> 7 <result column="coupon_name" property="couponName" jdbcType="VARCHAR" />
8 <result column="use_date" property="useDate" jdbcType="VARCHAR" /> 8 <result column="use_date" property="useDate" jdbcType="VARCHAR" />
9 <result column="coupon_type" property="couponType" jdbcType="TINYINT" /> 9 <result column="coupon_type" property="couponType" jdbcType="TINYINT" />
  10 + <result column="activity_id" property="activityId" jdbcType="INTEGER" />
  11 + <result column="coupon_pic" property="couponPic" jdbcType="VARCHAR" />
10 </resultMap> 12 </resultMap>
11 <sql id="Base_Column_List"> 13 <sql id="Base_Column_List">
12 - id, coupon_id, coupon_name, use_date, coupon_type 14 + id, coupon_id, coupon_name, use_date, coupon_type,activity_id,coupon_pic
13 </sql> 15 </sql>
14 <select id="selectByPrimaryKey" resultMap="BaseResultMap" 16 <select id="selectByPrimaryKey" resultMap="BaseResultMap"
15 parameterType="java.lang.Integer"> 17 parameterType="java.lang.Integer">
@@ -19,7 +21,7 @@ @@ -19,7 +21,7 @@
19 where id = #{id,jdbcType=INTEGER} 21 where id = #{id,jdbcType=INTEGER}
20 </select> 22 </select>
21 <select id="selectCouponByDateAndType" resultMap="BaseResultMap"> 23 <select id="selectCouponByDateAndType" resultMap="BaseResultMap">
22 - select * from order_share_coupon where 1=1 24 + select * from order_share_coupon where activity_id=#{activityId}
23 <if test="useDate != null"> 25 <if test="useDate != null">
24 and use_date=#{useDate} 26 and use_date=#{useDate}
25 </if> 27 </if>
@@ -105,6 +105,16 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService @@ -105,6 +105,16 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService
105 } 105 }
106 106
107 activityBO = OrderShareActivityConvert.db2bo(db); 107 activityBO = OrderShareActivityConvert.db2bo(db);
  108 + //重新设置新老用户券
  109 + OrderShareCoupon newCoupon = orderShareCouponDAO.selectCouponByDateAndType(null, Constant.ORDER_SHARE_USERTYPE_NEW, activityBO.getId());
  110 + if (null != newCoupon) {
  111 + activityBO.setCouponPic(newCoupon.getCouponPic());
  112 + }
  113 + OrderShareCoupon oldCoupon = orderShareCouponDAO.selectCouponByDateAndType(DateUtils.getToday("yyyy-MM-dd"), Constant.ORDER_SHARE_USERTYPE_OLD, activityBO.getId());
  114 + if (null != oldCoupon) {
  115 + activityBO.setOldUserCouponPic(oldCoupon.getCouponPic());
  116 + }
  117 +
108 yhValueOperations.set(ORDER_SHARE_ACTIVITY_CACHEKEY, CacheKeyHelper.value2String(activityBO)); 118 yhValueOperations.set(ORDER_SHARE_ACTIVITY_CACHEKEY, CacheKeyHelper.value2String(activityBO));
109 yHRedisTemplate.longExpire(ORDER_SHARE_ACTIVITY_CACHEKEY, 1, TimeUnit.MINUTES); 119 yHRedisTemplate.longExpire(ORDER_SHARE_ACTIVITY_CACHEKEY, 1, TimeUnit.MINUTES);
110 120
@@ -306,7 +316,7 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService @@ -306,7 +316,7 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService
306 316
307 // 发送优惠券 317 // 发送优惠券
308 // 获取老人优惠券 318 // 获取老人优惠券
309 - OrderShareCouponVO couponVO = drawCoupon(profileInfo.getUid(), Constant.ORDER_SHARE_USERTYPE_OLD); 319 + OrderShareCouponVO couponVO = drawCoupon(profileInfo.getUid(), Constant.ORDER_SHARE_USERTYPE_OLD, activityInfo.getId());
310 if (!couponVO.isDrawCouponSuccess()) { 320 if (!couponVO.isDrawCouponSuccess()) {
311 respBO.setReturnCode(Constant.ORDER_SHARE_SENDCOUPON_ERROR); 321 respBO.setReturnCode(Constant.ORDER_SHARE_SENDCOUPON_ERROR);
312 respBO.setReturnMsg("优惠券已被抢光"); 322 respBO.setReturnMsg("优惠券已被抢光");
@@ -364,7 +374,7 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService @@ -364,7 +374,7 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService
364 374
365 // 3、发送优惠券 375 // 3、发送优惠券
366 // 获取新人优惠券 376 // 获取新人优惠券
367 - OrderShareCouponVO couponVO = drawCoupon(model.getUid(), Constant.ORDER_SHARE_USERTYPE_NEW); 377 + OrderShareCouponVO couponVO = drawCoupon(model.getUid(), Constant.ORDER_SHARE_USERTYPE_NEW, activityInfo.getId());
368 if (!couponVO.isDrawCouponSuccess()) { 378 if (!couponVO.isDrawCouponSuccess()) {
369 respBO.setReturnCode(Constant.ORDER_SHARE_SENDCOUPON_ERROR); 379 respBO.setReturnCode(Constant.ORDER_SHARE_SENDCOUPON_ERROR);
370 respBO.setReturnMsg("优惠券已被抢光"); 380 respBO.setReturnMsg("优惠券已被抢光");
@@ -507,17 +517,17 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService @@ -507,17 +517,17 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService
507 * @param userType 517 * @param userType
508 * @return 518 * @return
509 */ 519 */
510 - private OrderShareCouponVO drawCoupon(int uid, int userType) { 520 + private OrderShareCouponVO drawCoupon(int uid, int userType, int activityId) {
511 log.info("draw orderShare coupon: uid: {}, userType: {}", uid, userType); 521 log.info("draw orderShare coupon: uid: {}, userType: {}", uid, userType);
512 OrderShareCouponVO couponVO = new OrderShareCouponVO(); 522 OrderShareCouponVO couponVO = new OrderShareCouponVO();
513 523
514 //新人券、老人全不一样 524 //新人券、老人全不一样
515 OrderShareCoupon coupon = null; 525 OrderShareCoupon coupon = null;
516 if(userType == Constant.ORDER_SHARE_USERTYPE_OLD) { 526 if(userType == Constant.ORDER_SHARE_USERTYPE_OLD) {
517 - coupon = orderShareCouponDAO.selectCouponByDateAndType(DateUtils.getToday("yyyy-MM-dd"), Constant.ORDER_SHARE_USERTYPE_OLD); 527 + coupon = orderShareCouponDAO.selectCouponByDateAndType(DateUtils.getToday("yyyy-MM-dd"), Constant.ORDER_SHARE_USERTYPE_OLD, activityId);
518 } 528 }
519 else if(userType == Constant.ORDER_SHARE_USERTYPE_NEW) { 529 else if(userType == Constant.ORDER_SHARE_USERTYPE_NEW) {
520 - coupon = orderShareCouponDAO.selectCouponByDateAndType(null, Constant.ORDER_SHARE_USERTYPE_NEW); 530 + coupon = orderShareCouponDAO.selectCouponByDateAndType(null, Constant.ORDER_SHARE_USERTYPE_NEW, activityId);
521 } 531 }
522 532
523 if(coupon == null) { 533 if(coupon == null) {
@@ -84,7 +84,8 @@ @@ -84,7 +84,8 @@
84 84
85 <div class="receive-coupon-page"> 85 <div class="receive-coupon-page">
86 <div class="bg-contain"> 86 <div class="bg-contain">
87 - <img src="http://img11.static.yhbimg.com/yhb-img01/2016/06/17/16/019b5b887d2e78098f9448927df3427da4.png"> 87 + <img class="img1" src="http://img11.static.yhbimg.com/yhb-img01/2016/06/17/16/019b5b887d2e78098f9448927df3427da4.png">
  88 + <img class="img2">
88 </div> 89 </div>
89 <p class="hidden" id="activityEnded"></p> 90 <p class="hidden" id="activityEnded"></p>
90 <p class="hidden" id="newUser"></p> 91 <p class="hidden" id="newUser"></p>
@@ -164,7 +165,13 @@ @@ -164,7 +165,13 @@
164 <div class="mask hidden"></div> 165 <div class="mask hidden"></div>
165 <div class="dialog hidden" id="message"> 166 <div class="dialog hidden" id="message">
166 <span class="close"></span> 167 <span class="close"></span>
167 - <span id="activityDesc"></span> 168 + <span id="activityDesc">
  169 + <div class="activity-message">
  170 + <h3>活动说明</h3>
  171 + <div class="message">
  172 + </div>
  173 + </div>
  174 + </span>
168 </div> 175 </div>
169 176
170 177
1 -  
2 -  
3 - var tipMessage = $('#tipMessage').html();  
4 - var activityID = $('#activityID').html();  
5 - $('#phone').bind('input propertychange', function() { 1 +var tipMessage = $('#tipMessage').html();
  2 +var activityID = $('#activityID').html();
  3 +$('#phone').bind('input propertychange', function() {
6 if ($(this).val().length === 11) { 4 if ($(this).val().length === 11) {
7 $('.input-content div').eq('0').addClass('verification-code'); 5 $('.input-content div').eq('0').addClass('verification-code');
8 } else { 6 } else {
@@ -13,8 +11,8 @@ @@ -13,8 +11,8 @@
13 $('.input-content i').eq('0').addClass('hidden'); 11 $('.input-content i').eq('0').addClass('hidden');
14 } 12 }
15 } 13 }
16 - });  
17 - $('#verification').bind('input propertychange', function() { 14 +});
  15 +$('#verification').bind('input propertychange', function() {
18 if ($(this).val().length === 4) { 16 if ($(this).val().length === 4) {
19 $('.input-content div').eq('1').addClass('get'); 17 $('.input-content div').eq('1').addClass('get');
20 } else { 18 } else {
@@ -25,15 +23,15 @@ @@ -25,15 +23,15 @@
25 $('.input-content i').eq('1').addClass('hidden'); 23 $('.input-content i').eq('1').addClass('hidden');
26 } 24 }
27 } 25 }
28 - }); 26 +});
29 27
30 - if ($('#activityEnded').html()) { 28 +if ($('#activityEnded').html()) {
31 $('.tip-wrap').removeClass('hidden'); 29 $('.tip-wrap').removeClass('hidden');
32 $('.tip-wrap .title').html(tipMessage); 30 $('.tip-wrap .title').html(tipMessage);
33 - } 31 +}
34 32
35 33
36 - function showToast(messages, time) { 34 +function showToast(messages, time) {
37 $('#dialog').removeClass('hidden'); 35 $('#dialog').removeClass('hidden');
38 $('.mask').removeClass('hidden'); 36 $('.mask').removeClass('hidden');
39 $('#dialog .content').html('<p class="phone-error">' + messages + '<p>'); 37 $('#dialog .content').html('<p class="phone-error">' + messages + '<p>');
@@ -42,9 +40,9 @@ @@ -42,9 +40,9 @@
42 $('.mask').addClass('hidden'); 40 $('.mask').addClass('hidden');
43 $('#dialog .content').html(' '); 41 $('#dialog .content').html(' ');
44 }, time); 42 }, time);
45 - } 43 +}
46 44
47 - $(function(){ 45 +$(function() {
48 46
49 $.ajax({ 47 $.ajax({
50 url: '/activity/tencentMkt/TencentMktController/getActivityInfo', 48 url: '/activity/tencentMkt/TencentMktController/getActivityInfo',
@@ -62,7 +60,12 @@ @@ -62,7 +60,12 @@
62 }, false); 60 }, false);
63 }*/ 61 }*/
64 if (data.code === 200) { 62 if (data.code === 200) {
65 - $('.receive-coupon-page .bg-contain img').attr('src', data.bgImg); 63 + $('.receive-coupon-page .bg-contain .img1').attr('src', data.bgImg);
  64 + if (data.secondScreenPic) {
  65 + $('.receive-coupon-page .bg-contain .img2').attr('src', data.secondScreenPic);
  66 + } else {
  67 + $('.receive-coupon-page .bg-contain .img2').addClass('hidden');
  68 + }
66 $('.gain-coupon-centent .coupon img').attr('src', data.couponPic); 69 $('.gain-coupon-centent .coupon img').attr('src', data.couponPic);
67 $('#activityEnded').text(data.ended); 70 $('#activityEnded').text(data.ended);
68 $('#newUser').text(data.newUser); 71 $('#newUser').text(data.newUser);
@@ -76,8 +79,8 @@ @@ -76,8 +79,8 @@
76 $('.gain-coupon-centent .use-coupon-btn .use-coupon').attr('href', data.buttonLink); 79 $('.gain-coupon-centent .use-coupon-btn .use-coupon').attr('href', data.buttonLink);
77 $('.gain-coupon-centent .go-wep').attr('href', data.pcLink); 80 $('.gain-coupon-centent .go-wep').attr('href', data.pcLink);
78 $('.tip .title').html(data.message); 81 $('.tip .title').html(data.message);
79 - $('#activityDesc').html(data.activityDesc);  
80 - if(data.ended) { 82 + $('#activityDesc .message').html(data.formatActivityDesc);
  83 + if (data.ended) {
81 $('.tip-wrap').removeClass('hidden'); 84 $('.tip-wrap').removeClass('hidden');
82 $('.tip-wrap .title').html(data.message); 85 $('.tip-wrap .title').html(data.message);
83 } 86 }
@@ -91,11 +94,11 @@ @@ -91,11 +94,11 @@
91 error: function() { 94 error: function() {
92 showToast('网络错误,稍后再试!', 1400); 95 showToast('网络错误,稍后再试!', 1400);
93 }, 96 },
94 - dataType : "json"  
95 - }); 97 + dataType: "json"
96 }); 98 });
  99 +});
97 100
98 - $('#getCoupon').on('click', function() { 101 +$('#getCoupon').on('click', function() {
99 phone = $(this).siblings('input').val(); 102 phone = $(this).siblings('input').val();
100 reg = /[0-9]{11}/; 103 reg = /[0-9]{11}/;
101 if (!reg.test(phone)) { 104 if (!reg.test(phone)) {
@@ -131,10 +134,10 @@ @@ -131,10 +134,10 @@
131 error: function() { 134 error: function() {
132 showToast('网络错误,稍后再试!', 1400); 135 showToast('网络错误,稍后再试!', 1400);
133 }, 136 },
134 - dataType : "json" 137 + dataType: "json"
135 }); 138 });
136 - });  
137 - $('.input-content').on('click', '.get', function() { 139 +});
  140 +$('.input-content').on('click', '.get', function() {
138 $('.input-content div').eq('1').removeClass('get'); 141 $('.input-content div').eq('1').removeClass('get');
139 if ($(this).siblings('input').val().length === 4) { 142 if ($(this).siblings('input').val().length === 4) {
140 $.ajax({ 143 $.ajax({
@@ -163,57 +166,57 @@ @@ -163,57 +166,57 @@
163 error: function() { 166 error: function() {
164 showToast('网络错误,稍后再试!', 1400); 167 showToast('网络错误,稍后再试!', 1400);
165 }, 168 },
166 - dataType : "json" 169 + dataType: "json"
167 }); 170 });
168 } else { 171 } else {
169 showToast('网络错误,稍后再试!', 1400); 172 showToast('网络错误,稍后再试!', 1400);
170 } 173 }
171 - });  
172 - $('.close').on('click', function() { 174 +});
  175 +$('.close').on('click', function() {
173 $('.dialog').addClass('hidden'); 176 $('.dialog').addClass('hidden');
174 $('.mask').addClass('hidden'); 177 $('.mask').addClass('hidden');
175 $('#dialog .content').html(' '); 178 $('#dialog .content').html(' ');
176 - });  
177 - $('.description-btn').on('click', function() { 179 +});
  180 +$('.description-btn').on('click', function() {
178 $('#message').removeClass('hidden'); 181 $('#message').removeClass('hidden');
179 $('.mask').removeClass('hidden'); 182 $('.mask').removeClass('hidden');
180 - }); 183 +});
181 184
182 - $('.gain-description-btn').on('click', function() { 185 +$('.gain-description-btn').on('click', function() {
183 $('#message').removeClass('hidden'); 186 $('#message').removeClass('hidden');
184 $('.mask').removeClass('hidden'); 187 $('.mask').removeClass('hidden');
185 - });  
186 - $('.description').on('click', function() { 188 +});
  189 +$('.description').on('click', function() {
187 $('#message').removeClass('hidden'); 190 $('#message').removeClass('hidden');
188 $('.mask').removeClass('hidden'); 191 $('.mask').removeClass('hidden');
189 - }); 192 +});
190 193
191 - $('.use-coupon-btn').on('click', function() { 194 +$('.use-coupon-btn').on('click', function() {
192 if (window._yas) { 195 if (window._yas) {
193 window._yas.sendCustomInfo({ 196 window._yas.sendCustomInfo({
194 activityID: activityID 197 activityID: activityID
195 }, true); 198 }, true);
196 } 199 }
197 - }); 200 +});
198 201
199 - $('.input-content .clear-mobile').on('click', function() { 202 +$('.input-content .clear-mobile').on('click', function() {
200 $('.input-content input').eq('0').val(''); 203 $('.input-content input').eq('0').val('');
201 $(this).addClass('hidden'); 204 $(this).addClass('hidden');
202 $('.input-content div').eq('0').removeClass(); 205 $('.input-content div').eq('0').removeClass();
203 - }); 206 +});
204 207
205 - $('.input-content .clear-verify').on('click', function() { 208 +$('.input-content .clear-verify').on('click', function() {
206 $('.input-content input').eq('1').val(''); 209 $('.input-content input').eq('1').val('');
207 $(this).addClass('hidden'); 210 $(this).addClass('hidden');
208 $('.input-content div').eq('1').removeClass(); 211 $('.input-content div').eq('1').removeClass();
209 - }); 212 +});
210 213
211 - /** 214 +/**
212 * 分享页面基础参数 215 * 分享页面基础参数
213 * @param {object} sizeInfo [接口原始数据] 216 * @param {object} sizeInfo [接口原始数据]
214 * @return {object} [description] 217 * @return {object} [description]
215 */ 218 */
216 - function getPageInfo(pageInfo) { 219 +function getPageInfo(pageInfo) {
217 var dest = {}; 220 var dest = {};
218 221
219 dest.shareTitle = pageInfo.data.shareTitle; 222 dest.shareTitle = pageInfo.data.shareTitle;
@@ -229,6 +232,8 @@ @@ -229,6 +232,8 @@
229 dest.mobile = pageInfo.data.mobile; 232 dest.mobile = pageInfo.data.mobile;
230 dest.pcLink = pageInfo.data.pcLink; 233 dest.pcLink = pageInfo.data.pcLink;
231 dest.buttonLink = pageInfo.data.buttonLink; 234 dest.buttonLink = pageInfo.data.buttonLink;
  235 + dest.secondScreenPic = pageInfo.data.secondScreenPic;
  236 + dest.formatActivityDesc = pageInfo.data.formatActivityDesc;
232 237
233 if (pageInfo.data.flag === 1) { 238 if (pageInfo.data.flag === 1) {
234 dest.bgImg = pageInfo.data.activityNormalPic; 239 dest.bgImg = pageInfo.data.activityNormalPic;
@@ -241,4 +246,4 @@ @@ -241,4 +246,4 @@
241 // 清空变量,释放内存 246 // 清空变量,释放内存
242 pageInfo = {}; 247 pageInfo = {};
243 return dest; 248 return dest;
244 - };  
  249 +};