Authored by ping

Merge branch 'userDay'

Showing 28 changed files with 1404 additions and 77 deletions
... ... @@ -13,3 +13,4 @@ controller/target/
*.iml
*.class
other/
target/
... ...
... ... @@ -73,6 +73,29 @@ public class SendCouponHelper {
return result;
}
/**
* 发送有货币
*
* @param uid
* @param num
* @return
*/
public boolean sendYOHOBi(int uid, int num, int type) {
YohoCoinRecordReq req = buildYohoCoinCostReq(uid, num, type);
final String serviceName = "users.addRecord";
boolean result = false;
try {
log.info("BrandActivityServiceImpl sendYOHOBi req------ is {}", req);
CommonRspBO rspBO = serviceCaller.call(serviceName, req, CommonRspBO.class);
if (rspBO != null && rspBO.getCode() == 200) {
result = true;
}
} catch (Exception e) {
log.warn("in method sendYOHOBIEvent ,invoke {} occurs error,detail is {}", serviceName, e);
}
return result;
}
// 构造参数
private YohoCoinRecordReq buildYohoCoinCostReq(int uid, int num) {
YohoCoinRecordReq req = new YohoCoinRecordReq();
... ... @@ -93,4 +116,26 @@ public class SendCouponHelper {
req.setHistory(yohoCoinLogReqBO);
return req;
}
// 构造参数
private YohoCoinRecordReq buildYohoCoinCostReq(int uid, int num, int type) {
YohoCoinRecordReq req = new YohoCoinRecordReq();
YohoCoinCostReqBO yohoCoinCostReq = new YohoCoinCostReqBO();
yohoCoinCostReq.setUid(uid);
yohoCoinCostReq.setNum(num);
yohoCoinCostReq.setType(Byte.valueOf(String.valueOf(type)));// 抽奖送币
yohoCoinCostReq.setParams("{}");
yohoCoinCostReq.setOrderCode("0");
req.setCost(yohoCoinCostReq);
YohoCoinLogReqBO yohoCoinLogReqBO = new YohoCoinLogReqBO();
yohoCoinLogReqBO.setUid(uid);
yohoCoinLogReqBO.setChangeNum(Short.valueOf(String.valueOf(num)));
yohoCoinLogReqBO.setChangeType(Byte.valueOf(String.valueOf(type)));
yohoCoinLogReqBO.setChangeParams("{}");
req.setHistory(yohoCoinLogReqBO);
return req;
}
}
... ...
... ... @@ -16,7 +16,8 @@ public enum CacheKeyEnum {
DRAWLINE_ACTIVITYBO("yh:act_activitybo:", "drawline.activitybo.redisSwitch", "drawline.activitybo.redisExpire", "限购排队活动信息(BO)"),
DRAWLINE_QUEUELIST("yh:act_queuelist:", "drawline.queuelist.redisSwitch", "drawline.queuelist.redisExpire", "活动排队列表"),
DRAWLINE_USERACTIVITY("yh:act_useractivity:", "drawline.useractivity.redisSwitch", "drawline.useractivity.redisExpire", "活动排队列表"),
DRAWLINE_LUCKYUSERLIST("yh:act_luckyuser:", "drawline.luckyuserlist.redisSwitch", "drawline.luckyuserlist.redisExpire", "中奖用户信息列表");
DRAWLINE_LUCKYUSERLIST("yh:act_luckyuser:", "drawline.luckyuserlist.redisSwitch", "drawline.luckyuserlist.redisExpire", "中奖用户信息列表"),
USERDAY_DRAWPRIZENUM("yh:act_userday:drawPrizeNum", "userday.drawPrizeNum.redisSwitch", "userday.drawPrizeNum.redisExpire", "会员日虚拟参与抽奖人数");
// 缓存的key
private String cacheKey;
... ...
... ... @@ -280,6 +280,32 @@ public class RedisValueCache {
}
}
/**
* 清除
*
* @param cacheEnum
* 缓存开关的枚举
* @param obj
* key的后缀
*
*/
public Long increment(CacheKeyEnum cacheEnum, Object obj, long delta, long timeout, TimeUnit unit) {
logger.debug("Enter increment valueOperation redis value. cacheEnum is {}, obj is {}, delta is {}, timeout is {}, unit is {}", cacheEnum, obj, delta, timeout, unit);
try {
String cacheKey = CacheKeyHelper.getCacheKeyAndCheck(cacheEnum, obj);
// 如果获取的key为空,则说明缓存开关是关闭的
if (StringUtils.isEmpty(cacheKey)) {
return null;
}
Long result = yhValueOperations.increment(cacheKey, delta);
yHRedisTemplate.longExpire(cacheKey, timeout, unit);
return result;
} catch (Exception e) {
logger.warn("Redis exception. value redis increment . cacheEnum is {}, obj is {}, exception msg is {}", cacheEnum, obj, e.getMessage());
}
return null;
}
public static void main(String[] args) {
String str = "12345";
String jsonStr = JSON.toJSONString(str);
... ...
package com.yoho.activity.controller;
import com.yoho.activity.common.ApiResponse;
import com.yoho.activity.service.IUserdayLeaveWordsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
/**
* 会员日,留言
*/
@Controller
@RequestMapping("/UserdayLeaveWordsController")
public class UserdayLeaveWordsController {
private static final Logger log = LoggerFactory.getLogger(UserdayLeaveWordsController.class);
@Autowired
IUserdayLeaveWordsService userdayLeaveWordsService;
/**
* 查询留言列表
*
* @param uid
* @return
* @throws Exception
*/
@RequestMapping("/queryLeaveWordsList")
@ResponseBody
public ApiResponse queryLeaveWordsList(int uid) throws Exception {
log.debug("enter queryLeaveWordsList. param uid={}", uid);
List<String> contentList = userdayLeaveWordsService.queryLeaveWordsList(uid);
return new ApiResponse(contentList);
}
/**
* 新增留言
*
* @param uid
* @return
* @throws Exception
*/
@RequestMapping("/addLeaveWords")
@ResponseBody
public ApiResponse addLeaveWords(int uid, String nick_name, String content) throws Exception {
log.debug("enter addLeaveWords. param uid={}, nick_name={}, content={}", uid, nick_name, content);
int drawNum = userdayLeaveWordsService.addLeaveWords(uid, nick_name, content);
return new ApiResponse(drawNum);
}
}
... ...
package com.yoho.activity.controller;
import java.util.List;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.yoho.activity.common.ApiResponse;
import com.yoho.activity.service.IUserdayPrizeLogService;
import com.yoho.service.model.activity.userday.response.UserdayPrizeLogResponseBO;
/**
* 会员日,中奖纪录
*/
@Controller
@RequestMapping("/UserdayPrizeLogController")
public class UserdayPrizeLogController {
private static final Logger log = LoggerFactory.getLogger(UserdayPrizeLogController.class);
@Autowired
IUserdayPrizeLogService userdayPrizeLogService;
/**
* 用户抽奖
* @param uid
* @param prize_type
* @return
* @throws Exception
*/
@RequestMapping("/addPrizeLog")
@ResponseBody
public ApiResponse addPrizeLog(int uid, int prize_type) throws Exception {
log.info("enter addPrizeLog. param uid={}, prize_type={}", uid, prize_type);
int result = userdayPrizeLogService.addPrizeLog(uid, prize_type);
return new ApiResponse(result);
}
/**
* 查询是否抽过奖
* @param uid
* @param prize_type
* @return
* @throws Exception
*/
@RequestMapping("/existsPrizeLog")
@ResponseBody
public ApiResponse existsPrizeLog(int uid, int prize_type) throws Exception {
log.info("enter existsPrizeLog. param uid={}, prize_type={}", uid, prize_type);
boolean result = userdayPrizeLogService.existsPrizeLog(uid, prize_type);
return new ApiResponse(result);
}
/**
* 查询中奖纪录
* @param uid
* @param prize_type
* @return
* @throws Exception
*/
@RequestMapping("/queryPrizeLog")
@ResponseBody
public ApiResponse queryPrizeLog(int uid, int prize_type) throws Exception {
log.info("enter queryPrizeLog. param uid={}, prize_type={}", uid, prize_type);
List<UserdayPrizeLogResponseBO> list = userdayPrizeLogService.queryPrizeLog(uid, prize_type);
if (CollectionUtils.isEmpty(list)) {
log.warn("queryPrizeLog error. result is empty");
}
return new ApiResponse(list);
}
/**
* 查询参与抽奖人数
* @param prize_type
* @return
* @throws Exception
*/
@RequestMapping("/queryPrizeLogNum")
@ResponseBody
public ApiResponse queryPrizeLogNum(int prize_type) throws Exception {
log.info("enter queryPrizeLogNum. param prize_type={}", prize_type);
int num = userdayPrizeLogService.queryPrizeLogNum(prize_type);
return new ApiResponse(num);
}
}
... ...
package com.yoho.activity.controller;
import com.yoho.activity.common.ApiResponse;
import com.yoho.activity.common.utils.DateUtils;
import com.yoho.activity.service.IUserdaySigninService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
/**
* 会员日,签到
*/
@Controller
@RequestMapping("/UserdaySigninController")
public class UserdaySigninController {
private static final Logger log = LoggerFactory.getLogger(UserdaySigninController.class);
@Autowired
IUserdaySigninService userdaySigninService;
@Value("${userday.open.day}")
String userdayDay;
@RequestMapping("/signin")
@ResponseBody
public ApiResponse signin(int uid) throws Exception {
log.info("enter signin. param uid={}", uid);
userdaySigninService.signin(uid);
return new ApiResponse("");
}
@RequestMapping("/isUserday")
@ResponseBody
public ApiResponse isUserday() throws Exception {
log.info("enter isUserday.");
String day = DateUtils.getToday("dd");
return new ApiResponse(day.equals(userdayDay));
}
}
... ...
package com.yoho.userday.dal;
import com.yoho.userday.dal.model.UserdayLeaveWords;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface IUserdayLeaveWordsDAO {
int deleteByPrimaryKey(Integer id);
int insert(UserdayLeaveWords record);
int insertSelective(UserdayLeaveWords record);
UserdayLeaveWords selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(UserdayLeaveWords record);
int updateByPrimaryKey(UserdayLeaveWords record);
List<UserdayLeaveWords> selectLeaveWordsList(@Param("uid") int uid);
}
\ No newline at end of file
... ...
package com.yoho.userday.dal;
import com.yoho.userday.dal.model.UserdayPrizeLog;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface IUserdayPrizeLogDAO {
int deleteByPrimaryKey(Integer id);
int insert(UserdayPrizeLog record);
int insertSelective(UserdayPrizeLog record);
UserdayPrizeLog selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(UserdayPrizeLog record);
int updateByPrimaryKey(UserdayPrizeLog record);
UserdayPrizeLog selectByUidForLeaveWords(Integer uid);
int insertLog(UserdayPrizeLog userdayPrizeLog);
List<UserdayPrizeLog> selectByUidAndPrizeType(@Param("uid") int uid, @Param("prizeType") int prizeType);
int selectNumByPrizeType(@Param("prizeType") int prize_type);
}
\ No newline at end of file
... ...
package com.yoho.userday.dal.model;
import com.yoho.queue.dal.model.BaseModel;
public class UserdayLeaveWords extends BaseModel {
/**
*
*/
private static final long serialVersionUID = 942434561096687953L;
private Integer id;
private Integer uid;
private String nickName;
private String content;
private Integer createTime;
public UserdayLeaveWords() {
}
public UserdayLeaveWords(Integer uid, String nickName, String content, Integer createTime) {
this.uid = uid;
this.nickName = nickName;
this.content = content;
this.createTime = createTime;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
public String getNickName() {
return nickName;
}
public void setNickName(String nickName) {
this.nickName = nickName == null ? null : nickName.trim();
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content == null ? null : content.trim();
}
public Integer getCreateTime() {
return createTime;
}
public void setCreateTime(Integer createTime) {
this.createTime = createTime;
}
}
\ No newline at end of file
... ...
package com.yoho.userday.dal.model;
import com.yoho.queue.dal.model.BaseModel;
public class UserdayPrizeLog extends BaseModel {
/**
*
*/
private static final long serialVersionUID = 5461693433522015877L;
private Integer id;
private Integer uid;
// 奖品类型:1-有货币,2-优惠券
private Integer prizeType;
// 奖品值:prizeType为1时即有货币数量,为2时即优惠券id
private Integer prizeValue;
private Integer winningDate;
private Integer createTime;
public UserdayPrizeLog() {
}
public UserdayPrizeLog(Integer uid, Integer prizeType, Integer prizeValue, Integer createTime) {
this.uid = uid;
this.prizeType = prizeType;
this.prizeValue = prizeValue;
this.createTime = createTime;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getUid() {
return uid;
}
public void setUid(Integer uid) {
this.uid = uid;
}
public Integer getPrizeType() {
return prizeType;
}
public void setPrizeType(Integer prizeType) {
this.prizeType = prizeType;
}
public Integer getPrizeValue() {
return prizeValue;
}
public void setPrizeValue(Integer prizeValue) {
this.prizeValue = prizeValue;
}
public Integer getWinningDate() {
return winningDate;
}
public void setWinningDate(Integer winningDate) {
this.winningDate = winningDate;
}
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.userday.dal.IUserdayLeaveWordsDAO">
<resultMap id="BaseResultMap" type="com.yoho.userday.dal.model.UserdayLeaveWords">
<id column="id" property="id" jdbcType="INTEGER" />
<result column="uid" property="uid" jdbcType="INTEGER" />
<result column="nick_name" property="nickName" jdbcType="VARCHAR" />
<result column="content" property="content" jdbcType="VARCHAR" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List">
id, uid, nick_name, content, create_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
select
<include refid="Base_Column_List" />
from userday_leave_words
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from userday_leave_words
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yoho.userday.dal.model.UserdayLeaveWords">
insert into userday_leave_words (id, uid, nick_name,
content, create_time)
values (#{id,jdbcType=INTEGER}, #{uid,jdbcType=INTEGER}, #{nickName,jdbcType=VARCHAR},
#{content,jdbcType=VARCHAR}, #{createTime,jdbcType=INTEGER})
</insert>
<insert id="insertSelective" parameterType="com.yoho.userday.dal.model.UserdayLeaveWords">
insert into userday_leave_words
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="uid != null">
uid,
</if>
<if test="nickName != null">
nick_name,
</if>
<if test="content != null">
content,
</if>
<if test="createTime != null">
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="uid != null">
#{uid,jdbcType=INTEGER},
</if>
<if test="nickName != null">
#{nickName,jdbcType=VARCHAR},
</if>
<if test="content != null">
#{content,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
#{createTime,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.userday.dal.model.UserdayLeaveWords">
update userday_leave_words
<set>
<if test="uid != null">
uid = #{uid,jdbcType=INTEGER},
</if>
<if test="nickName != null">
nick_name = #{nickName,jdbcType=VARCHAR},
</if>
<if test="content != null">
content = #{content,jdbcType=VARCHAR},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yoho.userday.dal.model.UserdayLeaveWords">
update userday_leave_words
set uid = #{uid,jdbcType=INTEGER},
nick_name = #{nickName,jdbcType=VARCHAR},
content = #{content,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectLeaveWordsList" resultMap="BaseResultMap">
select <include refid="Base_Column_List" /> from userday_leave_words where uid =#{uid} order by create_time desc
</select>
</mapper>
\ 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.userday.dal.IUserdayPrizeLogDAO">
<resultMap id="BaseResultMap" type="com.yoho.userday.dal.model.UserdayPrizeLog">
<id column="id" property="id" jdbcType="INTEGER" />
<result column="uid" property="uid" jdbcType="INTEGER" />
<result column="prize_type" property="prizeType" jdbcType="INTEGER" />
<result column="prize_value" property="prizeValue" jdbcType="INTEGER" />
<result column="winning_date" property="winningDate" jdbcType="INTEGER" />
<result column="create_time" property="createTime" jdbcType="INTEGER" />
</resultMap>
<sql id="Base_Column_List">
id, uid, prize_type, prize_value, winning_date, create_time
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer">
select
<include refid="Base_Column_List" />
from userday_prize_log
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from userday_prize_log
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yoho.userday.dal.model.UserdayPrizeLog">
insert into userday_prize_log (id, uid, prize_type,
prize_value, winning_date, create_time
)
values (#{id,jdbcType=INTEGER}, #{uid,jdbcType=INTEGER}, #{prizeType,jdbcType=INTEGER},
#{prizeValue,jdbcType=INTEGER}, #{winningDate,jdbcType=INTEGER}, #{createTime,jdbcType=INTEGER}
)
</insert>
<insert id="insertSelective" parameterType="com.yoho.userday.dal.model.UserdayPrizeLog">
insert into userday_prize_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="uid != null">
uid,
</if>
<if test="prizeType != null">
prize_type,
</if>
<if test="prizeValue != null">
prize_value,
</if>
<if test="winningDate != null">
winning_date,
</if>
<if test="createTime != null">
create_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="uid != null">
#{uid,jdbcType=INTEGER},
</if>
<if test="prizeType != null">
#{prizeType,jdbcType=INTEGER},
</if>
<if test="prizeValue != null">
#{prizeValue,jdbcType=INTEGER},
</if>
<if test="winningDate != null">
#{winningDate,jdbcType=INTEGER},
</if>
<if test="createTime != null">
#{createTime,jdbcType=INTEGER},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.userday.dal.model.UserdayPrizeLog">
update userday_prize_log
<set>
<if test="uid != null">
uid = #{uid,jdbcType=INTEGER},
</if>
<if test="prizeType != null">
prize_type = #{prizeType,jdbcType=INTEGER},
</if>
<if test="prizeValue != null">
prize_value = #{prizeValue,jdbcType=INTEGER},
</if>
<if test="winningDate != null">
winning_date = #{winningDate,jdbcType=INTEGER},
</if>
<if test="createTime != null">
create_time = #{createTime,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yoho.userday.dal.model.UserdayPrizeLog">
update userday_prize_log
set uid = #{uid,jdbcType=INTEGER},
prize_type = #{prizeType,jdbcType=INTEGER},
prize_value = #{prizeValue,jdbcType=INTEGER},
winning_date = #{winningDate,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
<select id="selectByUidForLeaveWords" resultMap="BaseResultMap" parameterType="java.lang.Integer">
select
<include refid="Base_Column_List" />
from userday_prize_log
where uid = #{uid,jdbcType=INTEGER} and prize_type = 2 and winning_date = UNIX_TIMESTAMP(CURRENT_DATE()) limit 1
</select>
<select id="selectByUidAndPrizeType" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from userday_prize_log
where uid = #{uid,jdbcType=INTEGER} and prize_type = #{prizeType,jdbcType=INTEGER} and winning_date = UNIX_TIMESTAMP(CURRENT_DATE())
ORDER BY create_time DESC
</select>
<select id="selectNumByPrizeType" resultType="java.lang.Integer">
select IFNULL(COUNT(DISTINCT uid), 0) from userday_prize_log where prize_type = #{prizeType,jdbcType=INTEGER}
</select>
<insert id="insertLog" parameterType="com.yoho.userday.dal.model.UserdayPrizeLog">
insert into userday_prize_log (uid, prize_type,
prize_value, winning_date, create_time
)
values (#{uid,jdbcType=INTEGER}, #{prizeType,jdbcType=INTEGER},
#{prizeValue,jdbcType=INTEGER}, UNIX_TIMESTAMP(CURRENT_DATE()), #{createTime,jdbcType=INTEGER}
)
</insert>
</mapper>
\ No newline at end of file
... ...
package com.yoho.activity.service;
import com.yoho.userday.dal.model.UserdayPrizeLog;
import java.util.List;
/**
* 会员日,抽奖
*/
public interface IUserdayDrawPrizeService {
int drawPrize(int uid) throws Exception;
boolean existsPrizeLog(List<UserdayPrizeLog> userdayPrizeLogList);
}
... ...
package com.yoho.activity.service;
import java.util.List;
/**
* 会员日,留言
*/
public interface IUserdayLeaveWordsService {
List<String> queryLeaveWordsList(int uid) throws Exception;
int addLeaveWords(int uid, String nick_name, String content) throws Exception;
}
... ...
package com.yoho.activity.service;
import java.util.List;
import com.yoho.service.model.activity.userday.response.UserdayPrizeLogResponseBO;
import com.yoho.userday.dal.model.UserdayPrizeLog;
/**
* 会员日,中奖记录
*/
public interface IUserdayPrizeLogService {
UserdayPrizeLog queryPrizeLogForLeaveWords(int uid) throws Exception;
int addPrizeLog(int uid, int prize_type) throws Exception;
boolean existsPrizeLog(int uid, int prize_type) throws Exception;
/**
* 查询中奖纪录
* @param uid
* @param prize_type
* @return
* @throws Exception
*/
List<UserdayPrizeLogResponseBO> queryPrizeLog(int uid, int prize_type) throws Exception;
int queryPrizeLogNum(int prize_type);
}
... ...
package com.yoho.activity.service;
/**
* 会员日,签到
*/
public interface IUserdaySigninService {
void signin(int uid) throws Exception;
}
... ...
package com.yoho.activity.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.yoho.activity.common.helper.SendCouponHelper;
import com.yoho.activity.service.IUserdayDrawPrizeService;
import com.yoho.error.exception.ServiceException;
import com.yoho.userday.dal.model.UserdayPrizeLog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Random;
/**
* 会员日,抽奖
*/
@Service
public class UserdayDrawCouponServiceImpl implements IUserdayDrawPrizeService {
private static final Logger log = LoggerFactory.getLogger(UserdayDrawCouponServiceImpl.class);
@Autowired
private SendCouponHelper sendCouponHelper;
@Value("${userday.coupon}")
private String prizeConpon;
@Override
public int drawPrize(int uid) throws Exception {
log.info("enter drawPrize. param uid={}", uid);
// (1)校验uid
if (1 > uid) {
throw new ServiceException(401, "参数不合法");
}
// (2)根据中奖规则获取优惠券id
int couponId;
int random = new Random().nextInt(100);
if (994 < random) {
couponId = 20;
} else {
couponId = 10;
}
log.info("drawPrize: draw prize complete. uid={}, couponId={}, random={}", uid, couponId, random);
// (3)发送优惠券
if (0 < couponId) {
JSONObject j = JSONObject.parseObject(prizeConpon);
sendCouponHelper.sendCoupon(j.getString(String.valueOf(couponId)), uid);
}
// (4)返回
return couponId;
}
@Override
public boolean existsPrizeLog(List<UserdayPrizeLog> userdayPrizeLogList) {
log.debug("enter existsPrizeLog.");
// 返回
if (null != userdayPrizeLogList && 0 < userdayPrizeLogList.size()) {
return true;
}
return false;
}
}
... ...
package com.yoho.activity.service.impl;
import com.yoho.activity.common.helper.SendCouponHelper;
import com.yoho.activity.service.IUserdayDrawPrizeService;
import com.yoho.core.rest.client.ServiceCaller;
import com.yoho.error.exception.ServiceException;
import com.yoho.service.model.request.YohoCoinLogReqBO;
import com.yoho.userday.dal.model.UserdayPrizeLog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Random;
/**
* 会员日,抽奖
*/
@Service
public class UserdayDrawYohoCoinServiceImpl implements IUserdayDrawPrizeService {
private static final Logger log = LoggerFactory.getLogger(UserdayDrawYohoCoinServiceImpl.class);
@Autowired
private SendCouponHelper sendCouponHelper;
@Resource
ServiceCaller serviceCaller;
@Override
public int drawPrize(int uid) throws Exception {
log.info("enter drawPrize. param uid={}", uid);
// (1)校验uid
if (1 > uid) {
throw new ServiceException(401, "参数不合法");
}
// (2)判断有货币数量是否足够抽奖
YohoCoinLogReqBO yohoCoinLogReqBO = new YohoCoinLogReqBO();
yohoCoinLogReqBO.setUid(uid);
int num = serviceCaller.call("users.getYohoCoinNum", yohoCoinLogReqBO, Integer.class);
if (20 > num) {
throw new ServiceException(402, "有货币数量不足");
}
// (3)消耗有货币用于抽奖
sendCouponHelper.sendYOHOBi(uid, -20, 12);
// (4)根据中奖规则获取有货币数量
int yohoCoinNum = 0;
int random = new Random().nextInt(1000);
if (999 == random) {
yohoCoinNum = 1000;
} else if (993 < random) {
yohoCoinNum = 200;
} else if (983 < random) {
yohoCoinNum = 100;
} else if (883 < random) {
yohoCoinNum = 50;
} else if (483 < random) {
yohoCoinNum = 20;
}
log.info("drawPrize: draw prize complete. uid={}, yohoCoinNum={}, random={}", uid, yohoCoinNum, random);
// (5)发送有货币
if (0 < yohoCoinNum) {
sendCouponHelper.sendYOHOBi(uid, yohoCoinNum, 6);
}
// (6)返回
return yohoCoinNum;
}
@Override
public boolean existsPrizeLog(List<UserdayPrizeLog> userdayPrizeLogList) {
log.debug("enter existsPrizeLog.");
// (1)校验userdayPrizeLogList
if (null == userdayPrizeLogList || 0 == userdayPrizeLogList.size()) {
return false;
}
// (2)循环列表判断是否中奖
for (UserdayPrizeLog userdayPrizeLog : userdayPrizeLogList) {
if (null == userdayPrizeLog || null == userdayPrizeLog.getPrizeValue()) {
continue;
}
if (0 < userdayPrizeLog.getPrizeValue()) {
return true;
}
}
return false;
}
}
... ...
package com.yoho.activity.service.impl;
import com.yoho.activity.service.IUserdayLeaveWordsService;
import com.yoho.activity.service.IUserdayPrizeLogService;
import com.yoho.core.common.utils.DateUtil;
import com.yoho.error.exception.ServiceException;
import com.yoho.userday.dal.IUserdayLeaveWordsDAO;
import com.yoho.userday.dal.model.UserdayLeaveWords;
import com.yoho.userday.dal.model.UserdayPrizeLog;
import org.apache.commons.lang3.StringEscapeUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* 会员日,留言
*/
@Service
public class UserdayLeaveWordsServiceImpl implements IUserdayLeaveWordsService {
private static final Logger log = LoggerFactory.getLogger(UserdayLeaveWordsServiceImpl.class);
@Autowired
private IUserdayLeaveWordsDAO userdayLeaveWordsDAO;
@Autowired
private IUserdayPrizeLogService userdayPrizeLogService;
@Override
public List<String> queryLeaveWordsList(int uid) throws Exception {
log.info("enter queryLeaveWordsList. param uid={}", uid);
// (1)uid 校验
if (0 > uid) {
throw new ServiceException(401, "参数不合法");
}
// (2)查询列表
//查询自己的留言
List<UserdayLeaveWords> userdayLeaveWordsList = userdayLeaveWordsDAO.selectLeaveWordsList(uid);
if (userdayLeaveWordsList == null) {
userdayLeaveWordsList = new ArrayList<>();
}
//查询公共留言
userdayLeaveWordsList.addAll(userdayLeaveWordsDAO.selectLeaveWordsList(0));
// (3)组装数据并返回
List<String> result = new ArrayList<>();
for (UserdayLeaveWords userdayLeaveWords : userdayLeaveWordsList) {
if (null == userdayLeaveWords) {
continue;
}
result.add(new StringBuilder("用户").append(userdayLeaveWords.getNickName()).append(":").append(userdayLeaveWords.getContent()).toString());
}
return result;
}
@Override
public int addLeaveWords(int uid, String nick_name, String content) throws Exception {
log.info("enter addLeaveWords. param uid={}, nick_name={}, content={}", uid, nick_name, content);
// (1)参数校验:uid, nick_name, content
if (1 > uid || StringUtils.isBlank(nick_name) || StringUtils.isBlank(content)) {
throw new ServiceException(401, "参数不合法");
}
// (2)nick_name模糊化
nick_name = blurNickName(nick_name);
// (3)保存记录
UserdayLeaveWords userdayLeaveWords = new UserdayLeaveWords(uid, nick_name, StringEscapeUtils.escapeHtml4(content), DateUtil.currentTimeSeconds());
userdayLeaveWordsDAO.insertSelective(userdayLeaveWords);
// (4)查询用户中奖记录,获取用户剩余中奖记录
UserdayPrizeLog userdayPrizeLog = userdayPrizeLogService.queryPrizeLogForLeaveWords(uid);
if (null == userdayPrizeLog) {
return 1;
} else {
return 0;
}
}
private String blurNickName(String nick_name) {
if (StringUtils.isBlank(nick_name)) {
return nick_name;
}
if (nick_name.contains("*")) {
return nick_name;
}
if (nick_name.matches("\\d{11}")) {
return nick_name.substring(0, 3) + "****" + nick_name.substring(7);
}
if (2 == nick_name.length()) {
return nick_name.substring(0, 1) + "*";
}
if (3 == nick_name.length()) {
return nick_name.substring(0, 1) + "*" + nick_name.substring(2);
}
if (4 == nick_name.length()) {
return nick_name.substring(0, 1) + "**" + nick_name.substring(3);
}
if (4 < nick_name.length()) {
return nick_name.substring(0, 1) + "****" + nick_name.substring(nick_name.length() - 1);
}
return nick_name;
}
public static void main(String[] args) {
UserdayLeaveWordsServiceImpl u = new UserdayLeaveWordsServiceImpl();
System.out.println(u.blurNickName(" "));
System.out.println(u.blurNickName("啊"));
System.out.println(u.blurNickName("保存"));
System.out.println(u.blurNickName("第二份"));
System.out.println(u.blurNickName("改时间看"));
System.out.println(u.blurNickName("里卖弄拍去"));
System.out.println(u.blurNickName("12365984521"));
}
}
... ...
package com.yoho.activity.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import com.yoho.activity.common.redis.CacheKeyEnum;
import com.yoho.activity.common.redis.RedisValueCache;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import com.yoho.activity.common.utils.DateUtils;
import com.yoho.activity.service.IUserdayDrawPrizeService;
import com.yoho.activity.service.IUserdayPrizeLogService;
import com.yoho.core.common.utils.DateUtil;
import com.yoho.error.exception.ServiceException;
import com.yoho.service.model.activity.userday.response.UserdayPrizeLogResponseBO;
import com.yoho.userday.dal.IUserdayPrizeLogDAO;
import com.yoho.userday.dal.model.UserdayPrizeLog;
/**
* 会员日,中奖记录
*/
@Service
public class UserdayPrizeLogServiceImpl implements IUserdayPrizeLogService {
private static final Logger log = LoggerFactory.getLogger(UserdayPrizeLogServiceImpl.class);
@Autowired
private IUserdayPrizeLogDAO userdayPrizeLogDAO;
@Resource(name = "userdayDrawPrizeService")
Map<Integer, IUserdayDrawPrizeService> userdayDrawPrizeServiceMap;
@Resource
RedisValueCache redisValueCache;
@Value("${userday.open.day}")
String userdayOpenDay;
@Override
public UserdayPrizeLog queryPrizeLogForLeaveWords(int uid) throws Exception {
log.info("enter queryPrizeLogForLeaveWords. param uid={}", uid);
// (1)校验uid
if (1 > uid) {
throw new ServiceException(401, "参数不合法");
}
return userdayPrizeLogDAO.selectByUidForLeaveWords(uid);
}
@Override
public int addPrizeLog(int uid, int prize_type) throws Exception {
log.info("enter addPrizeLog. param uid={}, prize_type={}", uid, prize_type);
// (1)校验uid, prize_type
if (1 > uid || 1 > prize_type) {
throw new ServiceException(401, "参数不合法");
}
IUserdayDrawPrizeService userdayDrawPrizeService = userdayDrawPrizeServiceMap.get(prize_type);
if (null == userdayDrawPrizeService) {
throw new ServiceException(401, "参数不合法");
}
// (2)校验当天是否是会员日
String dateStr = DateUtil.getcurrentDate();
if (!userdayOpenDay.equals(dateStr.substring(8, 10))) {
throw new ServiceException(403, "非会员日,不允许抽奖");
}
// (3)是否参加过疯狂大转盘
if (2 == prize_type) {
List<UserdayPrizeLog> userdayPrizeLogList = userdayPrizeLogDAO.selectByUidAndPrizeType(uid, prize_type);
if (null != userdayPrizeLogList && 0 < userdayPrizeLogList.size()) {
throw new ServiceException(406, "您今天已经参加过疯狂大转盘");
}
}
// (4)获取奖品值
int prize_value = userdayDrawPrizeService.drawPrize(uid);
// (5)保存抽奖日志
UserdayPrizeLog userdayPrizeLog = new UserdayPrizeLog(uid, prize_type, prize_value, DateUtil.currentTimeSeconds());
userdayPrizeLogDAO.insertLog(userdayPrizeLog);
return prize_value;
}
@Override
public boolean existsPrizeLog(int uid, int prize_type) throws Exception {
log.info("enter existsPrizeLog. param uid={}, prize_type={}", uid, prize_type);
// (1)校验uid, prize_type
if (1 > uid || 1 > prize_type) {
throw new ServiceException(401, "参数不合法");
}
IUserdayDrawPrizeService userdayDrawPrizeService = userdayDrawPrizeServiceMap.get(prize_type);
if (null == userdayDrawPrizeService) {
throw new ServiceException(401, "参数不合法");
}
// (2)查询当天中奖日志
List<UserdayPrizeLog> userdayPrizeLogList = userdayPrizeLogDAO.selectByUidAndPrizeType(uid, prize_type);
// (3)返回
return userdayDrawPrizeService.existsPrizeLog(userdayPrizeLogList);
}
@Override
public List<UserdayPrizeLogResponseBO> queryPrizeLog(int uid, int prize_type) throws Exception {
log.info("enter queryPrizeLog. param uid={}, prize_type={}", uid, prize_type);
// (1)校验uid, prize_type
if (1 > uid || 1 > prize_type) {
throw new ServiceException(401, "参数不合法");
}
// (2)查询当天中奖日志
List<UserdayPrizeLog> userdayPrizeLogList = userdayPrizeLogDAO.selectByUidAndPrizeType(uid, prize_type);
if (CollectionUtils.isEmpty(userdayPrizeLogList)) {
return null;
}
List<UserdayPrizeLogResponseBO> list = new ArrayList<>(userdayPrizeLogList.size());
UserdayPrizeLogResponseBO bo = null;
for (UserdayPrizeLog dal : userdayPrizeLogList) {
bo = new UserdayPrizeLogResponseBO();
BeanUtils.copyProperties(dal, bo);
bo.setWinningTime(DateUtils.long2DateStr(((long) bo.getCreateTime()) * 1000, "HH:mm"));
list.add(bo);
}
// (3)返回
return list;
}
@Override
public int queryPrizeLogNum(int prize_type) {
log.info("enter queryPrizeLogNum. param prize_type={}", prize_type);
int realNum = userdayPrizeLogDAO.selectNumByPrizeType(prize_type);
Integer virtualNum = redisValueCache.get(CacheKeyEnum.USERDAY_DRAWPRIZENUM, "", Integer.class);
return realNum + (null == virtualNum ? 0 : virtualNum);
}
}
... ...
package com.yoho.activity.service.impl;
import com.yoho.activity.common.helper.SendCouponHelper;
import com.yoho.activity.service.IUserdaySigninService;
import com.yoho.core.common.utils.DateUtil;
import com.yoho.core.redis.YHValueOperations;
import com.yoho.error.exception.ServiceException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.concurrent.TimeUnit;
/**
* 会员日,签到
*/
@Service
public class UserdaySigninServiceImpl implements IUserdaySigninService {
private static final Logger log = LoggerFactory.getLogger(UserdaySigninServiceImpl.class);
@Autowired
private SendCouponHelper sendCouponHelper;
@Resource(name = "yhValueOperations")
YHValueOperations<String, String> yhValueOperations;
@Value("${userday.open.day}")
String userdayOpenDay;
@Override
public void signin(int uid) throws Exception {
log.info("enter signin. param uid={}", uid);
// (1)校验uid
if (1 > uid) {
throw new ServiceException(401, "参数不合法");
}
// (2)校验当天是否是会员日
String dateStr = DateUtil.getcurrentDate();
if (!userdayOpenDay.equals(dateStr.substring(8, 10))) {
throw new ServiceException(403, "非会员日,不允许签到");
}
// (3)校验用户是否已经签到
String key = "yh:activity:userday:" + uid + "_" + dateStr;
String s = yhValueOperations.get(key);
if ("1".equals(s)) {
throw new ServiceException(405, "您已领取过");
}
// (4)发送有货币,完成签到
sendCouponHelper.sendYOHOBi(uid, 100, 5);
// (5)redis记录用户签到记录
yhValueOperations.set(key, "1", 31, TimeUnit.DAYS);
}
}
... ...
package com.yoho.activity.service.timer;
import com.yoho.activity.common.redis.CacheKeyEnum;
import com.yoho.activity.common.redis.RedisValueCache;
import com.yoho.core.common.utils.DateUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.concurrent.TimeUnit;
/**
* 会员日:每分钟增加抽奖人数定时任务
*/
@Component
public class UserdayDrawPrizeNumTimer {
private static final Logger log = LoggerFactory.getLogger(UserdayDrawPrizeNumTimer.class);
@Resource
RedisValueCache redisValueCache;
@Value("${userday.open.day}")
String userdayOpenDay;
@Scheduled(fixedDelay = 60 * 1000)
public void run() {
log.info("UserdayDrawPrizeNumTimer run.");
// (1)校验当天是否是会员日
String dateStr = DateUtil.getcurrentDate();
if (!userdayOpenDay.equals(dateStr.substring(8, 10))) {
return;
}
redisValueCache.increment(CacheKeyEnum.USERDAY_DRAWPRIZENUM, "", 10, 2, TimeUnit.MINUTES);
}
}
... ...
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.springframework.org/schema/beans"
xsi:schemaLocation="http://www.springframework.org/schema/beans
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- secutity configs -->
<bean id="securityConfigMap" class="org.springframework.beans.factory.config.YamlMapFactoryBean">
<property name="resources">
<list>
<value>classpath:security-key.yml</value>
</list>
</property>
</bean>
<!-- secutity configs -->
<bean id="securityConfigMap" class="org.springframework.beans.factory.config.YamlMapFactoryBean">
<property name="resources">
<list>
<value>classpath:security-key.yml</value>
</list>
</property>
</bean>
<bean id="securityInterceptor" class="com.yoho.activity.common.interceptor.SecurityInterceptor">
<property name="keyConfigMap" ref="securityConfigMap" />
<property name="isDebugEnable" value="${is_debug_enable:true}" />
<property name="excludeUrls">
<list>
<value>/LuckyUserNoticeRest/noticeByActId/</value>
<value>/LuckyDrawHandlerRest/luckyDraw/</value>
<value>.+/CocacolaController/.+</value>
<value>.+/CouponActivityController/.+</value>
<value>.+/staticFileManage/.+</value>
<value>.+/TencentMktController/.+</value>
<value>.+/ActVoteResultController/.+</value>
<value>.+/favorite/.+</value>
<value>.+/brandDraw/.+</value>
</list>
</property>
<property name="excludeMethods">
<list>
<value>app.drawline.sendAwardToLuckyUser</value>
<value>app.drawline.executeAddWhiteUser</value>
<value>app.drawline.executeAddVirtualUser</value>
</list>
</property>
</bean>
<bean id="securityInterceptor" class="com.yoho.activity.common.interceptor.SecurityInterceptor">
<property name="keyConfigMap" ref="securityConfigMap" />
<property name="isDebugEnable" value="${is_debug_enable:true}" />
<property name="excludeUrls">
<list>
<value>/LuckyUserNoticeRest/noticeByActId/</value>
<value>/LuckyDrawHandlerRest/luckyDraw/</value>
<value>.+/CocacolaController/.+</value>
<value>.+/CouponActivityController/.+</value>
<value>.+/staticFileManage/.+</value>
<value>.+/TencentMktController/.+</value>
<value>.+/ActVoteResultController/.+</value>
<value>.+/favorite/.+</value>
<value>.+/brandDraw/.+</value>
</list>
</property>
<property name="excludeMethods">
<list>
<value>app.drawline.sendAwardToLuckyUser</value>
<value>app.drawline.executeAddWhiteUser</value>
<value>app.drawline.executeAddVirtualUser</value>
</list>
</property>
</bean>
</beans>
... ...
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util" xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
... ... @@ -12,44 +11,46 @@
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">
<context:component-scan base-package="com.yoho" />
<mvc:annotation-driven />
<!-- 装在properties文件 -->
<context:property-placeholder location="classpath*:config.properties,classpath*:zookeeper.properties" />
<context:component-scan base-package="com.yoho" />
<mvc:annotation-driven />
<!-- 装在properties文件 -->
<context:property-placeholder location="classpath*:config.properties" />
<!-- <bean id="restServiceBeanRegistry" class="com.yoho.core.rest.spring.RestServiceBeanRegistry">
<property name="registry" ref="serviceRegistry"></property>
</bean> -->
<bean id="serviceGlobalExceptionHandler" class="com.yoho.error.exception.handler.ServiceGlobalExceptionHandler"/>
<!-- 启动SpringMVC的注解功能,完成请求和注解POJO的映射 -->
<bean
class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="messageConverters">
<list>
<ref bean="stringConverter" />
<ref bean="jsonConverter" />
</list>
</property>
</bean>
<bean id="stringConverter"
class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/plain;charset=UTF-8</value>
</list>
</property>
</bean>
<!-- 输出对象转JSON支持 -->
<bean id="jsonConverter"
class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
</bean>
<mvc:interceptors>
<ref bean="securityInterceptor" />
<ref bean="threadProfileInterceptor"/>
</mvc:interceptors>
<bean id="serviceGlobalExceptionHandler" class="com.yoho.error.exception.handler.ServiceGlobalExceptionHandler" />
<!-- 启动SpringMVC的注解功能,完成请求和注解POJO的映射 -->
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="messageConverters">
<list>
<ref bean="stringConverter" />
<ref bean="jsonConverter" />
</list>
</property>
</bean>
<bean id="stringConverter" class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/plain;charset=UTF-8</value>
</list>
</property>
</bean>
<!-- 输出对象转JSON支持 -->
<bean id="jsonConverter" class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter"></bean>
<util:map id="userdayDrawPrizeService" key-type="java.lang.Integer"
value-type="com.yoho.activity.service.IUserdayDrawPrizeService">
<entry key="1" value-ref="userdayDrawYohoCoinServiceImpl"></entry>
<entry key="2" value-ref="userdayDrawCouponServiceImpl"></entry>
</util:map>
<mvc:interceptors>
<ref bean="securityInterceptor" />
<ref bean="threadProfileInterceptor" />
</mvc:interceptors>
</beans>
\ No newline at end of file
... ...
... ... @@ -26,7 +26,7 @@ redis.proxy.auth=
execute.timetask.host=192.168.90.9
#zkAddress
zkAddress=192.168.102.211:2181
zkAddress=192.168.102.205:2181
# web context
web.context=activity
... ... @@ -70,3 +70,8 @@ tencentmkt.shareUrl=http://service.yoho.cn/activity/tencentMkt/index.html
rabbit_host=192.168.102.162:32810
rabbit_user=yoho
rabbit_password=yoho
userday.coupon={"20":"14146", "10":"14144"}
userday.open.day=18
userday.drawPrizeNum.redisSwitch=true
\ No newline at end of file
... ...
... ... @@ -18,6 +18,8 @@
<property name="orderShare.recevied.maxNum" defaultValue="5" description="每个分享最多老用户领取优惠券个数" />
<property name="orderShare.shareUrl" defaultValue="http://m.yohobuy.com/coupon/index" description="订单分享的链接地址" />
<property name="tencentmkt.shareUrl" defaultValue="http://service.yoho.cn/activity/tencentMkt/index.html" description="市场活动推广的链接地址" />
<property name="userday.open.day" defaultValue="28" description="会员日活动,的日期" />
<property name="userday.coupon" defaultValue="{\&quot;20\&quot;:\&quot;14146\&quot;, \&quot;10\&quot;:\&quot;14144\&quot;}" description="会员日活动,优惠券id" />
</group>
<script>
<generate template="META-INF/autoconf/databases.yml" destfile="WEB-INF/classes/databases.yml" />
... ...
... ... @@ -63,4 +63,8 @@ tencentmkt.shareUrl=${tencentmkt.shareUrl}
rabbit_host=${rabbit_host}
rabbit_user=${rabbit_user}
rabbit_password =${rabbit_password}
\ No newline at end of file
rabbit_password =${rabbit_password}
userday.coupon=${userday.coupon}
userday.open.day=${userday.open.day}
userday.drawPrizeNum.redisSwitch=true
\ No newline at end of file
... ...