Authored by ping

市场推广,订单分享活动修改

... ... @@ -44,6 +44,8 @@ public class TencentMktActivityBO extends BaseModel {
private String pcLink;
private String secondScreenPic;
private Integer couponId;
public Integer getId() {
return id;
... ... @@ -180,4 +182,12 @@ public class TencentMktActivityBO extends BaseModel {
public void setSecondScreenPic(String secondScreenPic) {
this.secondScreenPic = secondScreenPic;
}
public Integer getCouponId() {
return couponId;
}
public void setCouponId(Integer couponId) {
this.couponId = couponId;
}
}
... ...
... ... @@ -77,10 +77,10 @@ public class TencentMktController {
*/
@RequestMapping("/validRegCodeAndSendCode")
@ResponseBody
public ApiResponse validRegCodeAndSendCode(String code, String area, String mobile, String client_id) throws ServiceException {
log.info("validRegCodeAndSendCode with code={},area={}, mobile={},", code, area, mobile);
ApiResponse response = tencentMktService.validCodeAndSendCode(code, area, mobile, client_id);
log.info("validRegCodeAndSendCode with code={}, area={}, mobile={}, response={}",code, area, mobile, response);
public ApiResponse validRegCodeAndSendCode(String code, String area, String mobile, String client_id, String activityCode) throws ServiceException {
log.info("validRegCodeAndSendCode with code={},area={}, mobile={}, activityCode={}", code, area, mobile, activityCode);
ApiResponse response = tencentMktService.validCodeAndSendCode(code, area, mobile, client_id, activityCode);
log.info("validRegCodeAndSendCode with code={}, area={}, mobile={}, response={}, activityCode={}",code, area, mobile, response, activityCode);
return response;
}
... ...
... ... @@ -8,8 +8,6 @@ public interface ITencentMktActivityDAO {
int insert(TencentMktActivity record);
int insertSelective(TencentMktActivity record);
TencentMktActivity selectByPrimaryKey(Integer id);
TencentMktActivity selectByActivityCode(String activityCode);
... ...
... ... @@ -43,6 +43,8 @@ public class TencentMktActivity extends BaseModel {
private Byte status;
private String secondScreenPic;
private Integer couponId;
public Integer getId() {
return id;
... ... @@ -187,4 +189,12 @@ public class TencentMktActivity extends BaseModel {
public void setSecondScreenPic(String secondScreenPic) {
this.secondScreenPic = secondScreenPic;
}
public Integer getCouponId() {
return couponId;
}
public void setCouponId(Integer couponId) {
this.couponId = couponId;
}
}
\ No newline at end of file
... ...
... ... @@ -20,11 +20,12 @@
<result column="create_time" property="createTime" jdbcType="INTEGER" />
<result column="status" property="status" jdbcType="TINYINT" />
<result column="second_screen_pic" property="secondScreenPic" jdbcType="VARCHAR" />
<result column="coupon_id" property="couponId" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List" >
id, activity_code, activity_name, h5_title, activity_normal_pic, activity_end_pic,
share_img_url, share_title, share_content, pc_link, activity_desc, begin_time, end_time,
coupon_pic, button_link, create_time, status, second_screen_pic
coupon_pic, button_link, create_time, status, second_screen_pic, coupon_id
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
... ... @@ -49,122 +50,13 @@
share_img_url, share_title, share_content,
pc_link, activity_desc, begin_time,
end_time, coupon_pic, button_link,
create_time, status)
create_time, status, coupon_id)
values (#{id,jdbcType=INTEGER}, #{activityCode,jdbcType=VARCHAR}, #{activityName,jdbcType=VARCHAR},
#{h5Title,jdbcType=VARCHAR}, #{activityNormalPic,jdbcType=VARCHAR}, #{activityEndPic,jdbcType=VARCHAR},
#{shareImgUrl,jdbcType=VARCHAR}, #{shareTitle,jdbcType=VARCHAR}, #{shareContent,jdbcType=VARCHAR},
#{pcLink,jdbcType=VARCHAR}, #{activityDesc,jdbcType=VARCHAR}, #{beginTime,jdbcType=INTEGER},
#{endTime,jdbcType=INTEGER}, #{couponPic,jdbcType=VARCHAR}, #{buttonLink,jdbcType=VARCHAR},
#{createTime,jdbcType=INTEGER}, #{status,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.yoho.coupon.dal.model.TencentMktActivity" >
insert into tencent_mkt_activity
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="id != null" >
id,
</if>
<if test="activityCode != null" >
activity_code,
</if>
<if test="activityName != null" >
activity_name,
</if>
<if test="h5Title != null" >
h5_title,
</if>
<if test="activityNormalPic != null" >
activity_normal_pic,
</if>
<if test="activityEndPic != null" >
activity_end_pic,
</if>
<if test="shareImgUrl != null" >
share_img_url,
</if>
<if test="shareTitle != null" >
share_title,
</if>
<if test="shareContent != null" >
share_content,
</if>
<if test="pcLink != null" >
pc_link,
</if>
<if test="activityDesc != null" >
activity_desc,
</if>
<if test="beginTime != null" >
begin_time,
</if>
<if test="endTime != null" >
end_time,
</if>
<if test="couponPic != null" >
coupon_pic,
</if>
<if test="buttonLink != null" >
button_link,
</if>
<if test="createTime != null" >
create_time,
</if>
<if test="status != null" >
status,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="id != null" >
#{id,jdbcType=INTEGER},
</if>
<if test="activityCode != null" >
#{activityCode,jdbcType=VARCHAR},
</if>
<if test="activityName != null" >
#{activityName,jdbcType=VARCHAR},
</if>
<if test="h5Title != null" >
#{h5Title,jdbcType=VARCHAR},
</if>
<if test="activityNormalPic != null" >
#{activityNormalPic,jdbcType=VARCHAR},
</if>
<if test="activityEndPic != null" >
#{activityEndPic,jdbcType=VARCHAR},
</if>
<if test="shareImgUrl != null" >
#{shareImgUrl,jdbcType=VARCHAR},
</if>
<if test="shareTitle != null" >
#{shareTitle,jdbcType=VARCHAR},
</if>
<if test="shareContent != null" >
#{shareContent,jdbcType=VARCHAR},
</if>
<if test="pcLink != null" >
#{pcLink,jdbcType=VARCHAR},
</if>
<if test="activityDesc != null" >
#{activityDesc,jdbcType=VARCHAR},
</if>
<if test="beginTime != null" >
#{beginTime,jdbcType=INTEGER},
</if>
<if test="endTime != null" >
#{endTime,jdbcType=INTEGER},
</if>
<if test="couponPic != null" >
#{couponPic,jdbcType=VARCHAR},
</if>
<if test="buttonLink != null" >
#{buttonLink,jdbcType=VARCHAR},
</if>
<if test="createTime != null" >
#{createTime,jdbcType=INTEGER},
</if>
<if test="status != null" >
#{status,jdbcType=TINYINT},
</if>
</trim>
#{createTime,jdbcType=INTEGER}, #{status,jdbcType=TINYINT}, #{couponId})
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.coupon.dal.model.TencentMktActivity" >
update tencent_mkt_activity
... ... @@ -237,7 +129,8 @@
coupon_pic = #{couponPic,jdbcType=VARCHAR},
button_link = #{buttonLink,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=INTEGER},
status = #{status,jdbcType=TINYINT}
status = #{status,jdbcType=TINYINT},
coupon_id=#{couponId}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
... ...
... ... @@ -37,7 +37,7 @@ public interface ITencentMktService {
* @return
* @throws ServiceException
*/
public ApiResponse validCodeAndSendCode(String code, String area, String mobile, String client_id) throws ServiceException;
public ApiResponse validCodeAndSendCode(String code, String area, String mobile, String client_id, String activityCode) throws ServiceException;
/**
* 查询活動
... ...
... ... @@ -22,6 +22,7 @@ import com.yoho.activity.common.bo.TencentMktBO;
import com.yoho.activity.common.constatns.Constant;
import com.yoho.activity.common.convert.TencentMktActivityConvert;
import com.yoho.activity.common.helper.ClientSecretHelper;
import com.yoho.activity.common.helper.SendCouponHelper;
import com.yoho.activity.common.helper.SendSMSHelper;
import com.yoho.activity.common.redis.CacheKeyHelper;
import com.yoho.activity.common.utils.DateUtils;
... ... @@ -72,6 +73,9 @@ public class TencentMktServiceImpl implements ITencentMktService {
private String shareUrl;
@Resource
SendCouponHelper sendCouponHelper;
@Resource
SendSMSHelper sendSMSHelper;
public static final String TENCENT_MKT__ACTIVITY_CACHEKEY = "yh:activity:tencentmkt:";
... ... @@ -123,13 +127,13 @@ public class TencentMktServiceImpl implements ITencentMktService {
}
@Override
public ApiResponse validCodeAndSendCode(String code, String area, String mobile, String client_id) throws ServiceException {
log.debug("validRegCodeAndSendCode with code={}, area={}, mobile={}", code, area, mobile);
public ApiResponse validCodeAndSendCode(String code, String area, String mobile, String client_id, String activityCode) throws ServiceException {
log.debug("validRegCodeAndSendCode with code={}, area={}, mobile={}, activityCode={}", code, area, mobile, activityCode);
// 验证验证码
ApiResponse response = validRegCode(code, area, mobile);
if (Constant.CODE_SUCCESS != response.getCode()) {
log.warn("validCodeAndSendCode error validCode is error with code={}, area={}, mobile={}", code, area, mobile);
log.warn("validCodeAndSendCode error validCode is error with code={}, area={}, mobile={}, activityCode={}", code, area, mobile, activityCode);
response.setMessage("验证码错误");
return response;
}
... ... @@ -138,7 +142,7 @@ public class TencentMktServiceImpl implements ITencentMktService {
// 老用户则直接返回
response = register(area, mobile, "web");
if (Constant.CODE_SUCCESS != response.getCode()) {
log.warn("validCodeAndSendCode error register error with code={}, area={}, mobile={}", code, area, mobile);
log.warn("validCodeAndSendCode error register error with code={}, area={}, mobile={}, activityCode={}", code, area, mobile, activityCode);
return response;
}
JSONObject registerJSON = (JSONObject) response.getData();
... ... @@ -146,10 +150,22 @@ public class TencentMktServiceImpl implements ITencentMktService {
int uid = registerJSON.getIntValue("uid");
String password = registerJSON.getString("password");
//新用户,发送额外券
//根据活动id,获取活动详情
TencentMktActivityBO bo = getActivityInfoByCode(activityCode);
if (bo.getCouponId() != null && bo.getCouponId() != 0) {
//如果配置了优惠券,则发券
try {
sendCouponHelper.sendCoupon(bo.getCouponId().toString(), uid);
} catch (Exception e) {
log.error("send coupon error. with mobile={}, uid={}, activityCode={}, couponId={}", mobile, uid, activityCode, bo.getCouponId(), e);
}
}
//如果是新用户,则发送提醒短信
sendNoticeSms(mobile, password);
//调用成功,记录日志
//调用成功,记录日志 ------ 这段代码无效
JSONObject logJson = new JSONObject();
logJson.put("uid", uid);
logJson.put("client_id", client_id);
... ...
... ... @@ -26,7 +26,7 @@ redis.proxy.auth=
execute.timetask.host=192.168.90.9
#zkAddress
zkAddress=192.168.102.205:2181
zkAddress=192.168.102.211:2181
# web context
web.context=activity
... ... @@ -63,7 +63,7 @@ orderShare.shareUrl=http://m.yohobuy.com/coupon/index
tencentmkt.shareUrl=http://service.yoho.cn/activity/tencentMkt/index.html
userday.coupon.oct={}
... ...