Authored by chenjian

Merge branch 'orderShare' of http://git.yoho.cn/yoho30/yohobuy-activity into orderShare

... ... @@ -20,122 +20,86 @@ import com.yoho.service.model.activity.drawline.response.DrawOrderShareCouponRes
/**
*
* 分享优惠券
*
* @author gemingdan
*
*/
@Controller
@RequestMapping("/OrderShareController")
public class OrderShareController {
private static Logger logger = LoggerFactory.getLogger(OrderShareController.class);
@Resource
IOrderShareActivityService orderShareActivityService;
@Resource
IUserShareHistoryService userShareHistoryService;
/**
* 根据活动编号,查询活动详细信息(包括,所有可配置信息)
*
* @return
*/
@RequestMapping(params="methods=getActivityInfo")
@RequestMapping(params = "methods=app.activity.getActivityInfo")
@ResponseBody
public ApiResponse getActivityInfo(int id){
logger.info("getActivityInfo param id={}",id);
OrderShareActivityBO data = orderShareActivityService.getActivityInfoById(id);
public ApiResponse getActivityInfo() {
logger.info("getActivityInfo");
OrderShareActivityBO data = orderShareActivityService.getActivityInfoById();
return new ApiResponse(data);
}
/**
* 查询该订单是否可以分享
*
* @param orderno
* @param uid
* @return flag=1可以分享,flag=2表示不存在分享活动, flag=3表示分享活动已结束, flag=4表示分享活动未开始, flag=5表示用户当天已达到分享最大数
*/
@RequestMapping("/getInfoOfOrderShare")
@ResponseBody
public ApiResponse getInfoOfOrderShare(UserShareHistoryVO request){
logger.info("getActivityInfo param request={}",request);
OrderShareBO data =orderShareActivityService.getShareInfo(request.getOrdercode(), request.getUid());
return new ApiResponse(data);
}
/**
* 生成该用户的分享
* @return
*/
@RequestMapping(params="methods=createShareUrl")
@ResponseBody
public ApiResponse createShareUrl(Object request){
logger.info("createShareUrl param request={}",request);
String data=null;
return new ApiResponse(data);
}
/**
* 查询该链接领取优惠券的次数
* @return
* @return flag=1可以分享,flag=2表示不存在分享活动, flag=3表示分享活动已结束, flag=4表示分享活动未开始,
* flag=5表示用户当天已达到分享最大数
*/
@RequestMapping(params="methods=getReceivedNum")
@RequestMapping(params = "method=app.activity.getInfoOfOrderShare")
@ResponseBody
public ApiResponse getReceivedNum(int id){
logger.info("getReceivedNum param id={}",id);
int data=0;
public ApiResponse getInfoOfOrderShare(UserShareHistoryVO request) {
logger.info("getActivityInfo param request={}", request);
OrderShareBO data = orderShareActivityService.getShareInfo(request.getOrdercode(), request.getUid());
return new ApiResponse(data);
}
/**
* 查询该活动是否过期
* 订单分享活动领券
*
* @param mobile
* @param activityId
* @param orderCode
* @return
*/
@RequestMapping(params="methods=getStatus")
@RequestMapping(params = "method=app.order.drawOrderShareCoupon")
@ResponseBody
public ApiResponse getStatus(int id){
logger.info("getStatus param id={}",id);
Object data=null;
return new ApiResponse(data);
public ApiResponse drawOrderShareCoupon(@RequestParam(value = "mobile", required = true) String mobile, @RequestParam(value = "activityId", required = true) int activityId, @RequestParam(value = "orderCode", required = true) long orderCode) {
logger.info("drawOrderShareCoupon enter, mobile: {}, activityId: {}, orderCode: {}", mobile, activityId, orderCode);
DrawOrderShareCouponRespBO respBO = orderShareActivityService.drawOrderShareCoupon(mobile, activityId, orderCode);
return new ApiResponse.ApiResponseBuilder().code(200).data(respBO).message("ok").build();
}
/**
* 订单分享活动领券
* 新用户注册(带验证码)并领券
*
* @param mobile
* @param activityId
* @param orderCode
* @param identifyCode
* @return
*/
@RequestMapping(params = "method=app.order.drawOrderShareCoupon")
@ResponseBody
public ApiResponse drawOrderShareCoupon(@RequestParam(value = "mobile", required = true) String mobile,
@RequestParam(value = "activityId", required = true) int activityId,
@RequestParam(value = "orderCode", required = true) long orderCode) {
logger.info("drawOrderShareCoupon enter, mobile: {}, activityId: {}, orderCode: {}", mobile, activityId, orderCode);
DrawOrderShareCouponRespBO respBO = orderShareActivityService.drawOrderShareCoupon(mobile, activityId, orderCode);
@RequestMapping(params = "method=app.order.registerAndSendCoupon")
@ResponseBody
public ApiResponse registerAndSendCoupon(@RequestParam(value = "mobile", required = true) String mobile, @RequestParam(value = "activityId", required = true) int activityId, @RequestParam(value = "orderCode", required = true) long orderCode, @RequestParam(value = "identifyCode", required = true) String identifyCode) {
logger.info("registerAndSendCoupon enter, mobile: {}, activityId: {}, orderCode: {}, identifyCode : {}", mobile, activityId, orderCode, identifyCode);
DrawOrderShareCouponRespBO respBO = orderShareActivityService.registerAndSendCoupon(mobile, activityId, orderCode, identifyCode);
return new ApiResponse.ApiResponseBuilder().code(200).data(respBO).message("ok").build();
}
/**
* 新用户注册(带验证码)并领券
* @param mobile
* @param activityId
* @param orderCode
* @param identifyCode
* @return
*/
@RequestMapping(params = "method=app.order.registerAndSendCoupon")
@ResponseBody
public ApiResponse registerAndSendCoupon(@RequestParam(value = "mobile", required = true) String mobile,
@RequestParam(value = "activityId", required = true) int activityId,
@RequestParam(value = "orderCode", required = true) long orderCode,
@RequestParam(value = "identifyCode", required = true) String identifyCode) {
logger.info("registerAndSendCoupon enter, mobile: {}, activityId: {}, orderCode: {}, identifyCode : {}", mobile, activityId, orderCode, identifyCode);
DrawOrderShareCouponRespBO respBO = orderShareActivityService.registerAndSendCoupon(mobile, activityId, orderCode, identifyCode);
return new ApiResponse.ApiResponseBuilder().code(200).data(respBO).message("ok").build();
}
}
... ...
package com.yoho.coupon.dal;
import com.yoho.coupon.dal.model.OrderShareCoupon;
public interface IOrderShareCouponDAO {
int deleteByPrimaryKey(Integer id);
int insert(OrderShareCoupon record);
int insertSelective(OrderShareCoupon record);
OrderShareCoupon selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(OrderShareCoupon record);
int updateByPrimaryKey(OrderShareCoupon record);
}
\ No newline at end of file
... ...
package com.yoho.coupon.dal.model;
import com.yoho.queue.dal.model.BaseModel;
public class OrderShareCoupon extends BaseModel {
/**
*
*/
private static final long serialVersionUID = -190907556765459407L;
private Integer id;
private String couponId;
private String couponName;
private String useDate;
private Integer couponType;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCouponId() {
return couponId;
}
public void setCouponId(String couponId) {
this.couponId = couponId == null ? null : couponId.trim();
}
public String getCouponName() {
return couponName;
}
public void setCouponName(String couponName) {
this.couponName = couponName == null ? null : couponName.trim();
}
public String getUseDate() {
return useDate;
}
public void setUseDate(String useDate) {
this.useDate = useDate == null ? null : useDate.trim();
}
public Integer getCouponType() {
return couponType;
}
public void setCouponType(Integer couponType) {
this.couponType = couponType;
}
}
\ 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.coupon.dal.IOrderShareCouponDAO">
<resultMap id="BaseResultMap" type="com.yoho.coupon.dal.model.OrderShareCoupon">
<id column="id" property="id" jdbcType="INTEGER" />
<result column="coupon_id" property="couponId" jdbcType="VARCHAR" />
<result column="coupon_name" property="couponName" jdbcType="VARCHAR" />
<result column="use_date" property="useDate" jdbcType="VARCHAR" />
<result column="coupon_type" property="couponType" jdbcType="TINYINT" />
</resultMap>
<sql id="Base_Column_List">
id, coupon_id, coupon_name, use_date, coupon_type
</sql>
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
parameterType="java.lang.Integer">
select
<include refid="Base_Column_List" />
from order_share_coupon
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from order_share_coupon
where id = #{id,jdbcType=INTEGER}
</delete>
<insert id="insert" parameterType="com.yoho.coupon.dal.model.OrderShareCoupon">
insert into order_share_coupon (id, coupon_id, coupon_name,
use_date, coupon_type)
values (#{id,jdbcType=INTEGER}, #{couponId,jdbcType=VARCHAR},
#{couponName,jdbcType=VARCHAR},
#{useDate,jdbcType=VARCHAR}, #{couponType,jdbcType=TINYINT})
</insert>
<insert id="insertSelective" parameterType="com.yoho.coupon.dal.model.OrderShareCoupon">
insert into order_share_coupon
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="couponId != null">
coupon_id,
</if>
<if test="couponName != null">
coupon_name,
</if>
<if test="useDate != null">
use_date,
</if>
<if test="couponType != null">
coupon_type,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="couponId != null">
#{couponId,jdbcType=VARCHAR},
</if>
<if test="couponName != null">
#{couponName,jdbcType=VARCHAR},
</if>
<if test="useDate != null">
#{useDate,jdbcType=VARCHAR},
</if>
<if test="couponType != null">
#{couponType,jdbcType=TINYINT},
</if>
</trim>
</insert>
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.coupon.dal.model.OrderShareCoupon">
update order_share_coupon
<set>
<if test="couponId != null">
coupon_id = #{couponId,jdbcType=VARCHAR},
</if>
<if test="couponName != null">
coupon_name = #{couponName,jdbcType=VARCHAR},
</if>
<if test="useDate != null">
use_date = #{useDate,jdbcType=VARCHAR},
</if>
<if test="couponType != null">
coupon_type = #{couponType,jdbcType=TINYINT},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.yoho.coupon.dal.model.OrderShareCoupon">
update order_share_coupon
set coupon_id = #{couponId,jdbcType=VARCHAR},
coupon_name = #{couponName,jdbcType=VARCHAR},
use_date = #{useDate,jdbcType=VARCHAR},
coupon_type = #{couponType,jdbcType=TINYINT}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>
\ No newline at end of file
... ...
... ... @@ -7,11 +7,10 @@ import com.yoho.activity.common.bo.OrderShareBO;
public interface IOrderShareActivityService {
/**
* 根据id查询订单分享活动详情
* @param id
* 获取有效的活动详情
* @return
*/
public OrderShareActivityBO getActivityInfoById(Integer id);
public OrderShareActivityBO getActivityInfoById();
/**
* 查询用户订单分享状况
... ...
... ... @@ -65,11 +65,11 @@ public class OrderShareActivityServiceImpl implements IOrderShareActivityService
private int orderShareOldUserLimit;
@Override
public OrderShareActivityBO getActivityInfoById(Integer id) {
// TODO Auto-generated method stub
OrderShareActivity db = orderShareActivityDAO.selectByPrimaryKey(id);
if (db == null)
public OrderShareActivityBO getActivityInfoById() {
OrderShareActivity db = orderShareActivityDAO.selectOne();
if (db == null) {
return null;
}
return OrderShareActivityConvert.db2bo(db);
}
... ...