New file |
| | |
| | | package com.yeshi.fanli.aspect;
|
| | |
|
| | | import java.io.IOException;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import org.aspectj.lang.ProceedingJoinPoint;
|
| | | import org.aspectj.lang.annotation.Around;
|
| | | import org.aspectj.lang.annotation.Aspect;
|
| | | import org.springframework.core.annotation.Order;
|
| | | import org.springframework.stereotype.Component;
|
| | | import org.springframework.web.context.request.RequestContextHolder;
|
| | | import org.springframework.web.context.request.ServletRequestAttributes;
|
| | |
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | |
|
| | | /**
|
| | | * 活跃用户处理
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | //@Component
|
| | | //@Aspect
|
| | | //@Order(6)
|
| | | public class ActiveUserAspect {
|
| | |
|
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | |
|
| | | @Resource
|
| | | private UserSystemCouponService userSystemCouponService;
|
| | |
|
| | | public static final String EDP = "execution(* com.yeshi.fanli.controller.client.*.*(..))";
|
| | |
|
| | | @Around(EDP)
|
| | | public Object activeAround(ProceedingJoinPoint joinPoint) throws Throwable {
|
| | |
|
| | | Object[] args = joinPoint.getArgs();
|
| | | if (!Constant.IS_OUTNET) {
|
| | | return joinPoint.proceed(args); // 外网环境
|
| | | }
|
| | |
|
| | | try {
|
| | |
|
| | | System.out.println("----------活跃验证---------------");
|
| | |
|
| | | ServletRequestAttributes servletContainer = (ServletRequestAttributes) RequestContextHolder
|
| | | .getRequestAttributes();
|
| | |
|
| | | HttpServletRequest request = servletContainer.getRequest();
|
| | |
|
| | | String strUid = request.getParameter("uid");
|
| | | if (strUid == null || strUid.trim().length() == 0) {
|
| | | return joinPoint.proceed(args);
|
| | | }
|
| | |
|
| | | Long uid = Long.parseLong(strUid);
|
| | |
|
| | | String key = "activeUid_" + uid;
|
| | |
|
| | | String cacheValue = redisManager.getCommonString(key);
|
| | | if (cacheValue != null && cacheValue.trim().length() > 0) {
|
| | | return joinPoint.proceed(args);
|
| | | }
|
| | |
|
| | | // 加入缓存
|
| | | redisManager.cacheCommonString("activeUid_" + uid, strUid, 60);
|
| | |
|
| | | AcceptData acceptData = null;
|
| | | for (Object argsobj : args) {
|
| | | if (argsobj instanceof AcceptData) {
|
| | | acceptData = (AcceptData) argsobj;
|
| | | }
|
| | | }
|
| | |
|
| | | if (acceptData == null) {
|
| | | return joinPoint.proceed(args);
|
| | | }
|
| | |
|
| | | int platformType = 0;
|
| | | String platform = acceptData.getPlatform();
|
| | | if ("android".equals(platform)) {
|
| | | platformType = 1;
|
| | | } else if ("ios".equals(platform)) {
|
| | | platformType = 2;
|
| | | }
|
| | | userSystemCouponService.copyLotteryPrize(uid, platformType, acceptData.getDevice());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | } |
| | | |
| | | return joinPoint.proceed(args);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.controller.admin;
|
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.apache.commons.beanutils.PropertyUtils;
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.google.gson.reflect.TypeToken;
|
| | | import com.yeshi.fanli.entity.push.PushCoupon;
|
| | | import com.yeshi.fanli.exception.PushException;
|
| | | import com.yeshi.fanli.exception.push.PushCouponException;
|
| | | import com.yeshi.fanli.service.inter.push.PushCouponRecordService;
|
| | | import com.yeshi.fanli.service.inter.push.PushCouponService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.vo.push.PushCouponVO;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("admin/new/api/v1/pushCoupon")
|
| | | public class PushCouponController {
|
| | |
|
| | |
|
| | | @Resource
|
| | | private PushCouponService pushCouponService;
|
| | |
|
| | | @Resource
|
| | | private PushCouponRecordService pushCouponRecordService;
|
| | | |
| | | /**
|
| | | * 新增/修改
|
| | | * |
| | | * @param callback
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "save")
|
| | | public void save(String callback, PushCoupon pushCoupon, PrintWriter out) {
|
| | | |
| | | try {
|
| | | pushCouponService.save(pushCoupon);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
|
| | | } catch (PushCouponException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 删除
|
| | | * |
| | | * @param callback
|
| | | * @param idArray
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "delete")
|
| | | public void delete(String callback, String idArray, PrintWriter out) {
|
| | |
|
| | | try {
|
| | | if (StringUtil.isNullOrEmpty(idArray)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择操作的数据"));
|
| | | return;
|
| | | }
|
| | |
|
| | | Gson gson = new Gson();
|
| | | List<Long> list = gson.fromJson(idArray, new TypeToken<ArrayList<Long>>() {
|
| | | }.getType());
|
| | |
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("未检测到删除的数据"));
|
| | | return;
|
| | | }
|
| | |
|
| | | pushCouponService.deleteBatchByPrimaryKey(list);
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("删除成功"));
|
| | |
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("删除失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 获取推送信息
|
| | | * |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getPushInfo")
|
| | | public void getPushInfo(String callback, Long id, PrintWriter out) {
|
| | |
|
| | | if (id == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("参数不能为空"));
|
| | | return;
|
| | | }
|
| | |
|
| | | try {
|
| | |
|
| | | PushCoupon pushCoupon = pushCouponService.selectByPrimaryKey(id);
|
| | | if (pushCoupon == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("数据信息已不存在"));
|
| | | return;
|
| | | }
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder();
|
| | | gsonBuilder.serializeNulls();
|
| | | Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd").create();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pushCoupon", gson.toJson(pushCoupon));
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 查询
|
| | | * |
| | | * @param callback
|
| | | * @param pageIndex
|
| | | * @param pageSize
|
| | | * @param key
|
| | | * 模糊查询:说明、标识
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "query")
|
| | | public void query(String callback, Integer pageIndex, Integer pageSize, String key, Integer state, PrintWriter out) {
|
| | |
|
| | | if (pageIndex == null || pageIndex < 1) {
|
| | | pageIndex = 1;
|
| | | }
|
| | |
|
| | | if (pageSize == null || pageSize < 1) {
|
| | | pageSize = Constant.PAGE_SIZE;
|
| | | }
|
| | |
|
| | | try {
|
| | |
|
| | | List<PushCoupon> list = pushCouponService.listQuery((pageIndex - 1) * pageSize, pageSize, key, state);
|
| | |
|
| | | if (list == null || list.size() == 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | | }
|
| | |
|
| | | List<PushCouponVO> listVO = new ArrayList<PushCouponVO>();
|
| | | |
| | | for (PushCoupon pushCoupon : list) {
|
| | | PushCouponVO pushCouponVO = new PushCouponVO();
|
| | | |
| | | PropertyUtils.copyProperties(pushCouponVO, pushCoupon);
|
| | | |
| | | long receivedCount = pushCouponRecordService.countByPushId(pushCoupon.getId());
|
| | | pushCouponVO.setReceivedCount(receivedCount);
|
| | | |
| | | listVO.add(pushCouponVO);
|
| | | }
|
| | |
|
| | | long count = pushCouponService.countQuery(key, state);
|
| | |
|
| | | int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
|
| | | PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
|
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder();
|
| | | gsonBuilder.serializeNulls();
|
| | | Gson gson = gsonBuilder.setDateFormat("yyyy/MM/dd HH:mm:ss").create();
|
| | |
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("pe", pe);
|
| | | data.put("result_list", gson.toJson(listVO));
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | |
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作异常"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 推送
|
| | | * @param id 推送id
|
| | | * @param out
|
| | | * @throws Exception
|
| | | */
|
| | | @RequestMapping(value = "push")
|
| | | public void push(String callback, Long id, PrintWriter out) throws Exception {
|
| | |
|
| | | if (id == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("传递参数不能为空"));
|
| | | return;
|
| | | }
|
| | | try {
|
| | | |
| | | pushCouponService.executePush(id);
|
| | | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("推送成功"));
|
| | | |
| | | } catch (PushException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (PushCouponException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("推送失败"));
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.push; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.push.PushCoupon; |
| | | |
| | | public interface PushCouponMapper extends BaseMapper<PushCoupon> { |
| | | |
| | | /** |
| | | * 后端列表查询 |
| | | * @param start |
| | | * @param count |
| | | * @param key |
| | | * @return |
| | | */ |
| | | List<PushCoupon> listQuery(@Param("start") long start, @Param("count") int count, |
| | | @Param("key") String key, @Param("state") Integer state); |
| | | |
| | | long countQuery(@Param("key") String key, @Param("state") Integer state); |
| | | |
| | | |
| | | /** |
| | | * 有效活动 |
| | | * @return |
| | | */ |
| | | List<PushCoupon> listQueryEffective(); |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.push; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.push.PushCouponRecord; |
| | | |
| | | public interface PushCouponRecordMapper extends BaseMapper<PushCouponRecord>{ |
| | | |
| | | /** |
| | | * 统计推送领取券数量 |
| | | * @param pushId |
| | | * @return |
| | | */ |
| | | long countByPushId(@Param("pushId") Long pushId); |
| | | |
| | | /** |
| | | * 查询用户的领取券记录 |
| | | * @param pushId |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | List<PushCouponRecord> listByUid( @Param("uid") Long uid); |
| | | |
| | | } |
| | |
| | | // 来源: 新人抽奖、邀请奖励
|
| | | public final static String SOURCE_CHOUJIANG = "新人抽奖";
|
| | | public final static String SOURCE_YAOQING = "邀请奖励";
|
| | | public final static String SOURCE_SYSTEM_PUSH = "系统推送";
|
| | |
|
| | | @Expose
|
| | | @Column(name = "usc_id")
|
New file |
| | |
| | | package com.yeshi.fanli.entity.push;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import org.springframework.format.annotation.DateTimeFormat;
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | @Table("yeshi_ec_push_coupon")
|
| | | public class PushCoupon {
|
| | |
|
| | | @Column(name = "pc_id")
|
| | | private Long id;
|
| | |
|
| | | // 显示标题
|
| | | @Column(name = "pc_title")
|
| | | private String title;
|
| | |
|
| | | // 显示内容
|
| | | @Column(name = "pc_content")
|
| | | private String content;
|
| | |
|
| | | // 券数量
|
| | | @Column(name = "pc_amount")
|
| | | private Integer amount;
|
| | |
|
| | | // 券比例
|
| | | @Column(name = "pc_percent")
|
| | | private BigDecimal percent;
|
| | |
|
| | | // 单推用户id,多租id
|
| | | @Column(name = "pc_uids")
|
| | | private String uids;
|
| | |
|
| | | // 单推用户id
|
| | | @Column(name = "pc_remark")
|
| | | private String remark;
|
| | |
|
| | | // 起始时间
|
| | | @DateTimeFormat(pattern = "yyyy-MM-dd")
|
| | | @Column(name = "pc_start_time")
|
| | | private Date startTime;
|
| | |
|
| | | // 结束时间
|
| | | @DateTimeFormat(pattern = "yyyy-MM-dd")
|
| | | @Column(name = "pc_end_time")
|
| | | private Date endTime;
|
| | |
|
| | | // 是否已推送
|
| | | @Column(name = "pc_pushed")
|
| | | private boolean pushed;
|
| | |
|
| | | // 推送时间
|
| | | @Column(name = "pc_push_time")
|
| | | private Date pushTime;
|
| | |
|
| | | @Column(name = "pc_create_time")
|
| | | private Date createTime;
|
| | |
|
| | | @Column(name = "pc_update_time")
|
| | | private Date updateTime;
|
| | |
|
| | | public PushCoupon() {
|
| | | }
|
| | |
|
| | | public PushCoupon(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public String getTitle() {
|
| | | return title;
|
| | | }
|
| | |
|
| | | public void setTitle(String title) {
|
| | | this.title = title;
|
| | | }
|
| | |
|
| | | public String getContent() {
|
| | | return content;
|
| | | }
|
| | |
|
| | | public void setContent(String content) {
|
| | | this.content = content;
|
| | | }
|
| | |
|
| | | public Integer getAmount() {
|
| | | return amount;
|
| | | }
|
| | |
|
| | | public void setAmount(Integer amount) {
|
| | | this.amount = amount;
|
| | | }
|
| | |
|
| | | public BigDecimal getPercent() {
|
| | | return percent;
|
| | | }
|
| | |
|
| | | public void setPercent(BigDecimal percent) {
|
| | | this.percent = percent;
|
| | | }
|
| | |
|
| | | public String getUids() {
|
| | | return uids;
|
| | | }
|
| | |
|
| | | public void setUids(String uids) {
|
| | | this.uids = uids;
|
| | | }
|
| | |
|
| | | public String getRemark() {
|
| | | return remark;
|
| | | }
|
| | |
|
| | | public void setRemark(String remark) {
|
| | | this.remark = remark;
|
| | | }
|
| | |
|
| | | public Date getStartTime() {
|
| | | return startTime;
|
| | | }
|
| | |
|
| | | public void setStartTime(Date startTime) {
|
| | | this.startTime = startTime;
|
| | | }
|
| | |
|
| | | public Date getEndTime() {
|
| | | return endTime;
|
| | | }
|
| | |
|
| | | public void setEndTime(Date endTime) {
|
| | | this.endTime = endTime;
|
| | | }
|
| | |
|
| | | public boolean isPushed() {
|
| | | return pushed;
|
| | | }
|
| | |
|
| | | public void setPushed(boolean pushed) {
|
| | | this.pushed = pushed;
|
| | | }
|
| | |
|
| | | public Date getPushTime() {
|
| | | return pushTime;
|
| | | }
|
| | |
|
| | | public void setPushTime(Date pushTime) {
|
| | | this.pushTime = pushTime;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.push;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | @Table("yeshi_ec_push_coupon_record")
|
| | | public class PushCouponRecord {
|
| | |
|
| | | @Column(name = "pcd_id")
|
| | | private Long id;
|
| | |
|
| | | // 券推送
|
| | | @Column(name = "pcd_push_id")
|
| | | private PushCoupon pushCoupon;
|
| | |
|
| | | // 领取的用户id
|
| | | @Column(name = "pcd_uid")
|
| | | private Long uid;
|
| | | |
| | | @Column(name = "pcd_create_time")
|
| | | private Date createTime;
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public PushCoupon getPushCoupon() {
|
| | | return pushCoupon;
|
| | | }
|
| | |
|
| | | public void setPushCoupon(PushCoupon pushCoupon) {
|
| | | this.pushCoupon = pushCoupon;
|
| | | }
|
| | |
|
| | | public Long getUid() {
|
| | | return uid;
|
| | | }
|
| | |
|
| | | public void setUid(Long uid) {
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | | |
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.exception.push;
|
| | |
|
| | | public class PushCouponException extends Exception {
|
| | | |
| | | private static final long serialVersionUID = 1L;
|
| | | |
| | | private int code;
|
| | | private String msg;
|
| | |
|
| | | public PushCouponException() {}
|
| | | |
| | | public PushCouponException(int code, String msg) {
|
| | | this.code = code;
|
| | | this.msg = msg;
|
| | | }
|
| | |
|
| | | public int getCode() {
|
| | | return code;
|
| | | }
|
| | |
|
| | | public String getMsg() {
|
| | | return msg;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public String getMessage() {
|
| | | return this.msg;
|
| | | }
|
| | |
|
| | | }
|
New 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.yeshi.fanli.dao.mybatis.push.PushCouponMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.push.PushCoupon"> |
| | | <id column="pc_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="pc_title" property="title" jdbcType="VARCHAR"/> |
| | | <result column="pc_content" property="content" jdbcType="VARCHAR"/> |
| | | <result column="pc_amount" property="amount" jdbcType="INTEGER"/> |
| | | <result column="pc_percent" property="percent" jdbcType="DECIMAL"/> |
| | | <result column="pc_uids" property="uids" jdbcType="VARCHAR"/> |
| | | <result column="pc_remark" property="remark" jdbcType="VARCHAR"/> |
| | | <result column="pc_start_time" property="startTime" jdbcType="TIMESTAMP"/> |
| | | <result column="pc_end_time" property="endTime" jdbcType="TIMESTAMP"/> |
| | | <result column="pc_pushed" property="pushed" jdbcType="VARCHAR"/> |
| | | <result column="pc_push_time" property="pushTime" jdbcType="TIMESTAMP"/> |
| | | <result column="pc_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="pc_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">pc_id,pc_title,pc_content,pc_amount,pc_percent,pc_uids,pc_remark,pc_start_time,pc_end_time,pc_pushed,pc_push_time,pc_create_time,pc_update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_push_coupon where pc_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_push_coupon where pc_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.push.PushCoupon" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_push_coupon (pc_id,pc_title,pc_content,pc_amount,pc_percent,pc_uids,pc_remark,pc_start_time,pc_end_time,pc_pushed,pc_push_time,pc_create_time,pc_update_time) values (#{id,jdbcType=BIGINT},#{title,jdbcType=VARCHAR},#{content,jdbcType=VARCHAR},#{amount,jdbcType=INTEGER},#{percent,jdbcType=DECIMAL},#{uids,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{pushed,jdbcType=VARCHAR},#{pushTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.push.PushCoupon" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_push_coupon |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">pc_id,</if> |
| | | <if test="title != null">pc_title,</if> |
| | | <if test="content != null">pc_content,</if> |
| | | <if test="amount != null">pc_amount,</if> |
| | | <if test="percent != null">pc_percent,</if> |
| | | <if test="uids != null">pc_uids,</if> |
| | | <if test="remark != null">pc_remark,</if> |
| | | <if test="startTime != null">pc_start_time,</if> |
| | | <if test="endTime != null">pc_end_time,</if> |
| | | <if test="pushed != null">pc_pushed,</if> |
| | | <if test="pushTime != null">pc_push_time,</if> |
| | | <if test="createTime != null">pc_create_time,</if> |
| | | <if test="updateTime != null">pc_update_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="title != null">#{title,jdbcType=VARCHAR},</if> |
| | | <if test="content != null">#{content,jdbcType=VARCHAR},</if> |
| | | <if test="amount != null">#{amount,jdbcType=INTEGER},</if> |
| | | <if test="percent != null">#{percent,jdbcType=DECIMAL},</if> |
| | | <if test="uids != null">#{uids,jdbcType=VARCHAR},</if> |
| | | <if test="remark != null">#{remark,jdbcType=VARCHAR},</if> |
| | | <if test="startTime != null">#{startTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="pushed != null">#{pushed,jdbcType=VARCHAR},</if> |
| | | <if test="pushTime != null">#{pushTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.push.PushCoupon">update yeshi_ec_push_coupon set pc_title = #{title,jdbcType=VARCHAR},pc_content = #{content,jdbcType=VARCHAR},pc_amount = #{amount,jdbcType=INTEGER},pc_percent = #{percent,jdbcType=DECIMAL},pc_uids = #{uids,jdbcType=VARCHAR},pc_remark = #{remark,jdbcType=VARCHAR},pc_start_time = #{startTime,jdbcType=TIMESTAMP},pc_end_time = #{endTime,jdbcType=TIMESTAMP},pc_pushed = #{pushed,jdbcType=VARCHAR},pc_push_time = #{pushTime,jdbcType=TIMESTAMP},pc_create_time = #{createTime,jdbcType=TIMESTAMP},pc_update_time = #{updateTime,jdbcType=TIMESTAMP} where pc_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.push.PushCoupon">update yeshi_ec_push_coupon |
| | | <set> |
| | | <if test="title != null">pc_title=#{title,jdbcType=VARCHAR},</if> |
| | | <if test="content != null">pc_content=#{content,jdbcType=VARCHAR},</if> |
| | | <if test="amount != null">pc_amount=#{amount,jdbcType=INTEGER},</if> |
| | | <if test="percent != null">pc_percent=#{percent,jdbcType=DECIMAL},</if> |
| | | <if test="uids != null">pc_uids=#{uids,jdbcType=VARCHAR},</if> |
| | | <if test="remark != null">pc_remark=#{remark,jdbcType=VARCHAR},</if> |
| | | <if test="startTime != null">pc_start_time=#{startTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="endTime != null">pc_end_time=#{endTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="pushed != null">pc_pushed=#{pushed,jdbcType=VARCHAR},</if> |
| | | <if test="pushTime != null">pc_push_time=#{pushTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="createTime != null">pc_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">pc_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where pc_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <select id="listQuery" resultMap="BaseResultMap"> |
| | | SELECT <include refid="Base_Column_List" /> FROM yeshi_ec_push_coupon |
| | | WHERE 1=1 |
| | | <if test='key != null and key != ""'> |
| | | AND (pc_title like '%${key}%' or pc_content like '%${key}%') |
| | | </if> |
| | | <if test='state != null'> |
| | | AND pg_is_push = #{state} |
| | | </if> |
| | | ORDER BY pc_create_time desc |
| | | LIMIT ${start},${count} |
| | | </select> |
| | | |
| | | <select id="countQuery" resultType="java.lang.Long"> |
| | | SELECT IFNULL(count(pc_id),0) FROM yeshi_ec_push_coupon |
| | | WHERE 1=1 |
| | | <if test='key != null and key != ""'> |
| | | AND (pc_title like '%${key}%' or pc_content like '%${key}%') |
| | | </if> |
| | | <if test='state != null'> |
| | | AND pc_pushed = #{state} |
| | | </if> |
| | | </select> |
| | | |
| | | <select id="listQueryEffective" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_push_coupon |
| | | WHERE pc_pushed = 1 |
| | | AND DATE_FORMAT(CURDATE(),'%Y%m%d') <![CDATA[ <= ]]>DATE_FORMAT(pc_end_time,'%Y%m%d'); |
| | | </select> |
| | | |
| | | </mapper> |
New 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.yeshi.fanli.dao.mybatis.push.PushCouponRecordMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.push.PushCouponRecord"> |
| | | <id column="pcd_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="pcd_uid" property="uid" jdbcType="BIGINT"/> |
| | | <result column="pcd_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | |
| | | <!-- <association property="pushCoupon" column="pcd_push_id" |
| | | resultMap="com.yeshi.fanli.dao.mybatis.push.PushCouponMapper.BaseResultMap" /> --> |
| | | |
| | | <association property="pushCoupon" column="pcd_push_id" javaType="com.yeshi.fanli.entity.push.PushCoupon"> |
| | | <id column="pcd_push_id" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | |
| | | </resultMap> |
| | | <sql id="Base_Column_List">pcd_id,pcd_push_id,pcd_uid,pcd_create_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_push_coupon_record where pcd_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_push_coupon_record where pcd_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.push.PushCouponRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_push_coupon_record (pcd_id,pcd_push_id,pcd_uid,pcd_create_time) values (#{id,jdbcType=BIGINT},#{pushCoupon.id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.push.PushCouponRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_push_coupon_record |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">pcd_id,</if> |
| | | <if test="pushCoupon != null">pcd_push_id,</if> |
| | | <if test="uid != null">pcd_uid,</if> |
| | | <if test="createTime != null">pcd_create_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="pushCoupon != null">#{pushCoupon.id,jdbcType=BIGINT},</if> |
| | | <if test="uid != null">#{uid,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.push.PushCouponRecord">update yeshi_ec_push_coupon_record set pcd_push_id = #{pushCoupon.id,jdbcType=BIGINT},pcd_uid = #{uid,jdbcType=BIGINT},pcd_create_time = #{createTime,jdbcType=TIMESTAMP} where pcd_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.push.PushCouponRecord"> |
| | | update yeshi_ec_push_coupon_record |
| | | <set> |
| | | <if test="pushCoupon != null">pcd_push_id=#{pushCoupon.id,jdbcType=BIGINT},</if> |
| | | <if test="uid != null">pcd_uid=#{uid,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">pcd_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where pcd_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <select id="listByUid" resultMap="BaseResultMap"> |
| | | SELECT <include refid="Base_Column_List" /> FROM yeshi_ec_push_coupon_record |
| | | WHERE pcd_uid = #{uid} |
| | | </select> |
| | | |
| | | <select id="countByPushId" resultType="java.lang.Long"> |
| | | SELECT IFNULL(count(pcd_id),0) FROM yeshi_ec_push_coupon_record |
| | | WHERE pcd_push_id = #{pushId} |
| | | </select> |
| | | |
| | | |
| | | </mapper> |
New file |
| | |
| | | package com.yeshi.fanli.service.impl.push;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.push.PushCouponRecordMapper;
|
| | | import com.yeshi.fanli.entity.push.PushCouponRecord;
|
| | | import com.yeshi.fanli.service.inter.push.PushCouponRecordService;
|
| | |
|
| | | @Service
|
| | | public class PushCouponRecordServiceImpl implements PushCouponRecordService {
|
| | |
|
| | |
|
| | | @Resource
|
| | | private PushCouponRecordMapper pushCouponRecordMapper;
|
| | |
|
| | | @Override
|
| | | public int deleteByPrimaryKey(Long id) {
|
| | | return pushCouponRecordMapper.deleteByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int insert(PushCouponRecord record) {
|
| | | return pushCouponRecordMapper.insert(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int insertSelective(PushCouponRecord record) {
|
| | | return pushCouponRecordMapper.insertSelective(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public PushCouponRecord selectByPrimaryKey(Long id) {
|
| | | return pushCouponRecordMapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int updateByPrimaryKeySelective(PushCouponRecord record) {
|
| | | return pushCouponRecordMapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int updateByPrimaryKey(PushCouponRecord record) {
|
| | | return pushCouponRecordMapper.updateByPrimaryKey(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countByPushId(Long pushId) {
|
| | | return pushCouponRecordMapper.countByPushId(pushId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<PushCouponRecord> listByUid(Long uid) {
|
| | | return pushCouponRecordMapper.listByUid(uid);
|
| | | }
|
| | |
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.push;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.transaction.Transactional;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.push.PushCouponMapper;
|
| | | import com.yeshi.fanli.entity.push.PushCoupon;
|
| | | import com.yeshi.fanli.exception.PushException;
|
| | | import com.yeshi.fanli.exception.push.PushCouponException;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.push.PushCouponRecordService;
|
| | | import com.yeshi.fanli.service.inter.push.PushCouponService;
|
| | | import com.yeshi.fanli.service.inter.push.PushService;
|
| | |
|
| | | @Service
|
| | | public class PushCouponServiceImpl implements PushCouponService {
|
| | |
|
| | | @Resource
|
| | | private PushService pushService;
|
| | |
|
| | | @Resource
|
| | | private ConfigService configService;
|
| | |
|
| | | @Resource
|
| | | private PushCouponMapper pushCouponMapper;
|
| | | |
| | | @Resource
|
| | | private PushCouponRecordService pushCouponRecordService;
|
| | | |
| | | @Override
|
| | | public int deleteByPrimaryKey(Long id) {
|
| | | return pushCouponMapper.deleteByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int insert(PushCoupon record) {
|
| | | return pushCouponMapper.insert(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int insertSelective(PushCoupon record) {
|
| | | return pushCouponMapper.insertSelective(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public PushCoupon selectByPrimaryKey(Long id) {
|
| | | return pushCouponMapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int updateByPrimaryKeySelective(PushCoupon record) {
|
| | | return pushCouponMapper.updateByPrimaryKeySelective(record);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int updateByPrimaryKey(PushCoupon record) {
|
| | | return pushCouponMapper.updateByPrimaryKey(record);
|
| | | }
|
| | |
|
| | |
|
| | | @Override
|
| | | public List<PushCoupon> listQuery(long start, int count, String key, Integer state) {
|
| | | return pushCouponMapper.listQuery(start, count, key, state);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countQuery(String key, Integer state) {
|
| | | return pushCouponMapper.countQuery(key, state);
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public void save(PushCoupon record) throws PushCouponException {
|
| | | if (record == null) {
|
| | | throw new PushCouponException(1, "参数不正确");
|
| | | }
|
| | |
|
| | | String title = record.getTitle();
|
| | | String content = record.getContent();
|
| | | if (title == null || title.trim().length() == 0 || content == null || content.trim().length() == 0) {
|
| | | throw new PushCouponException(1, "标题或内容不能为空");
|
| | | }
|
| | |
|
| | | Date startTime = record.getStartTime();
|
| | | Date endTime = record.getEndTime();
|
| | | if (startTime == null || endTime == null) {
|
| | | throw new PushCouponException(1, "有效期时间不能为空");
|
| | | }
|
| | |
|
| | | Integer amount = record.getAmount();
|
| | | if (amount == null || amount < 1) {
|
| | | throw new PushCouponException(1, "券数量不能小于1");
|
| | | }
|
| | |
|
| | | Long id = record.getId();
|
| | | if (id == null) {
|
| | | // 新增
|
| | | record.setPushed(false);
|
| | | record.setCreateTime(new Date());
|
| | | record.setUpdateTime(new Date());
|
| | |
|
| | | // 插入数据
|
| | | insert(record);
|
| | | } else {
|
| | | // 修改
|
| | | PushCoupon current = selectByPrimaryKey(id);
|
| | | if (current == null) {
|
| | | throw new PushCouponException(1, "该记录已不存在");
|
| | | }
|
| | |
|
| | | current.setTitle(title);
|
| | | current.setContent(content);
|
| | | current.setAmount(amount);
|
| | | current.setStartTime(startTime);
|
| | | current.setEndTime(endTime);
|
| | | current.setUids(record.getUids());
|
| | | current.setRemark(record.getRemark());
|
| | |
|
| | | // 更新数据
|
| | | updateByPrimaryKey(current);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public void executePush(Long id) throws Exception, PushCouponException, PushException {
|
| | |
|
| | | PushCoupon pushCoupon = selectByPrimaryKey(id);
|
| | | if (pushCoupon == null) {
|
| | | throw new PushCouponException(1, "推送信息已不存在");
|
| | | }
|
| | |
|
| | | String title = pushCoupon.getTitle();
|
| | | String content = pushCoupon.getContent();
|
| | | if (title == null || title.trim().length() == 0 || content == null || content.trim().length() == 0) {
|
| | | throw new PushCouponException(1, "标题或内容不能为空");
|
| | | }
|
| | | |
| | | |
| | | // TODO 推送跳转
|
| | | |
| | | |
| | | String uids = pushCoupon.getUids();
|
| | | if (uids == null || uids.trim().length() == 0) {
|
| | | // 全推
|
| | | //pushService.pushZNX(null, title, content);
|
| | | |
| | | } else {
|
| | | // 指定用户推送
|
| | | String[] uidArray = uids.split(",");
|
| | | |
| | | if (uidArray != null) {
|
| | | for (int i = 0; i < uidArray.length; i++) {
|
| | | String str_uid = uidArray[i];
|
| | | if (str_uid != null && str_uid.trim().length() > 0) {
|
| | | //pushService.pushZNX(Long.parseLong(str_uid), title, content);
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | }
|
| | | |
| | | // 已推送
|
| | | pushCoupon.setPushed(true);
|
| | | // 推送时间
|
| | | pushCoupon.setPushTime(new Date());
|
| | | // 更新时间
|
| | | pushCoupon.setUpdateTime(new Date());
|
| | | |
| | | updateByPrimaryKeySelective(pushCoupon);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public void deleteBatchByPrimaryKey(List<Long> list) {
|
| | | if (list == null || list.size() == 0) {
|
| | | return;
|
| | | }
|
| | | |
| | | for (Long id: list) {
|
| | | long receivedCount = pushCouponRecordService.countByPushId(id);
|
| | | if (receivedCount > 0) {
|
| | | continue;
|
| | | }
|
| | | |
| | | pushCouponMapper.deleteByPrimaryKey(id);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<PushCoupon> listQueryEffective() {
|
| | | return pushCouponMapper.listQueryEffective();
|
| | | }
|
| | | |
| | | }
|
| | |
| | | import com.yeshi.fanli.service.inter.order.HongBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderHongBaoMapService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | | import com.yeshi.fanli.service.inter.push.PushCouponRecordService;
|
| | | import com.yeshi.fanli.service.inter.push.PushCouponService;
|
| | | import com.yeshi.fanli.service.inter.user.DeviceLotteryRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | |
| | | @Resource
|
| | | private CommonOrderCountService commonOrderCountService;
|
| | |
|
| | | @Resource
|
| | | private PushCouponService pushCouponService;
|
| | | |
| | | @Resource
|
| | | private PushCouponRecordService pushCouponRecordService;
|
| | | |
| | | |
| | | @Override
|
| | | public int insertSelective(UserSystemCoupon record) {
|
| | | return userSystemCouponMapper.insertSelective(record);
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.push;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.push.PushCouponRecord;
|
| | |
|
| | | public interface PushCouponRecordService {
|
| | |
|
| | | public int deleteByPrimaryKey(Long id);
|
| | |
|
| | | public int insert(PushCouponRecord record);
|
| | |
|
| | | public int insertSelective(PushCouponRecord record);
|
| | |
|
| | | public PushCouponRecord selectByPrimaryKey(Long id);
|
| | |
|
| | | public int updateByPrimaryKeySelective(PushCouponRecord record);
|
| | |
|
| | | public int updateByPrimaryKey(PushCouponRecord record);
|
| | | |
| | | /**
|
| | | * 统计推送领取券数量
|
| | | * @param pushId
|
| | | * @return
|
| | | */
|
| | | public long countByPushId(Long pushId);
|
| | | |
| | | /**
|
| | | * 查询用户的领取券记录
|
| | | * @param pushId
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public List<PushCouponRecord> listByUid(Long uid);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.push;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.push.PushCoupon;
|
| | | import com.yeshi.fanli.exception.PushException;
|
| | | import com.yeshi.fanli.exception.push.PushCouponException;
|
| | |
|
| | | public interface PushCouponService {
|
| | |
|
| | | public int deleteByPrimaryKey(Long id);
|
| | |
|
| | | public int insert(PushCoupon record);
|
| | |
|
| | | public int insertSelective(PushCoupon record);
|
| | |
|
| | | public PushCoupon selectByPrimaryKey(Long id);
|
| | |
|
| | | public int updateByPrimaryKeySelective(PushCoupon record);
|
| | |
|
| | | public int updateByPrimaryKey(PushCoupon record);
|
| | |
|
| | | public void deleteBatchByPrimaryKey(List<Long> list);
|
| | | |
| | | /**
|
| | | * 后端列表查询
|
| | | * @param start
|
| | | * @param count
|
| | | * @param key
|
| | | * @return
|
| | | */
|
| | | public List<PushCoupon> listQuery(long start, int count, String key, Integer state);
|
| | | |
| | | public long countQuery(String key, Integer state) throws PushCouponException;
|
| | | |
| | |
|
| | | public void save(PushCoupon record) throws PushCouponException;
|
| | |
|
| | | /**
|
| | | * 执行推送
|
| | | * @param id
|
| | | * @throws Exception
|
| | | * @throws PushCouponException
|
| | | * @throws PushException
|
| | | */
|
| | | public void executePush(Long id) throws Exception, PushCouponException, PushException;
|
| | | |
| | | |
| | | /**
|
| | | * 有效活动
|
| | | * @return
|
| | | */
|
| | | public List<PushCoupon> listQueryEffective();
|
| | |
|
| | | |
| | | }
|
| | |
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.UserSystemCoupon;
|
| | | import com.yeshi.fanli.entity.push.PushCoupon;
|
| | | import com.yeshi.fanli.entity.system.SystemCoupon;
|
| | | import com.yeshi.fanli.exception.user.UserSystemCouponException;
|
| | | import com.yeshi.fanli.vo.user.UserSystemCouponRecordVO;
|
| | |
| | | */
|
| | | public void copyLotteryPrize(Long uid, int platform, String device) throws Exception;
|
| | |
|
| | | |
| | | /**
|
| | | * 领取券
|
| | | * @param uid
|
| | | * @throws Exception
|
| | | */
|
| | | public void receivedCoupon(Long uid) throws Exception;
|
| | | |
| | | /**
|
| | | * 根据推送 获取对应的券
|
| | | * @param pushCoupon
|
| | | * @param uid
|
| | | * @throws Exception
|
| | | */
|
| | | public void randomRewardCoupon(PushCoupon pushCoupon, Long uid) throws Exception;
|
| | | |
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.vo.push;
|
| | |
|
| | | import com.yeshi.fanli.entity.push.PushCoupon;
|
| | |
|
| | | public class PushCouponVO extends PushCoupon {
|
| | | |
| | | // 已领取券数量
|
| | | private long receivedCount;
|
| | |
|
| | | public long getReceivedCount() {
|
| | | return receivedCount;
|
| | | }
|
| | |
|
| | | public void setReceivedCount(long receivedCount) {
|
| | | this.receivedCount = receivedCount;
|
| | | }
|
| | | |
| | | }
|