| | |
| | | String endTime, Integer coupon, PrintWriter out){
|
| | | try {
|
| | |
|
| | | if (coupon == null || (coupon != 1 && coupon != 2)) {
|
| | | if (coupon == null || (coupon.intValue() < 0 && coupon.intValue() > 4)) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("券类型不正确"));
|
| | | return;
|
| | | }
|
| | |
| | | for (int i = 0; i < arrayKeys.size(); i++) {
|
| | | String name = arrayKeys.get(i).toString();
|
| | | JSONObject params = new JSONObject();
|
| | | params.put("searchKey", name);
|
| | | params.put("content", name);
|
| | |
|
| | | SearchKeyVO keyVO = new SearchKeyVO();
|
| | | keyVO.setName(name);
|
| | |
| | | * @return
|
| | | */
|
| | | List<IntegralTaskRecord> listDaySignRecord(@Param("uid") Long uid, @Param("cid") Long cid);
|
| | | |
| | | |
| | | /**
|
| | | * 连续签到情况
|
| | | * |
| | | * @param uid
|
| | | * @param cid
|
| | | * @param sortState
|
| | | * 1倒序-创建时间
|
| | | * @return
|
| | | */
|
| | | List<IntegralTaskRecord> listDateSignRecord(@Param("uid") Long uid, @Param("cid") Long cid);
|
| | |
|
| | | /**
|
| | | * 近7天签到情况
|
New file |
| | |
| | | package com.yeshi.fanli.dto.msg;
|
| | |
|
| | | public class MsgInviteContentDTO {
|
| | |
|
| | | private String title; // 标题
|
| | | private String state; // 状态
|
| | | private String code; // 邀请码
|
| | | private String inviter; // 领取人信息
|
| | | private String mode; // 赠送时间
|
| | |
|
| | | public String getTitle() {
|
| | | return title;
|
| | | }
|
| | |
|
| | | public void setTitle(String title) {
|
| | | this.title = title;
|
| | | }
|
| | |
|
| | | public String getState() {
|
| | | return state;
|
| | | }
|
| | |
|
| | | public void setState(String state) {
|
| | | this.state = state;
|
| | | }
|
| | |
|
| | | public String getCode() {
|
| | | return code;
|
| | | }
|
| | |
|
| | | public void setCode(String code) {
|
| | | this.code = code;
|
| | | }
|
| | |
|
| | | public String getInviter() {
|
| | | return inviter;
|
| | | }
|
| | |
|
| | | public void setInviter(String inviter) {
|
| | | this.inviter = inviter;
|
| | | }
|
| | |
|
| | | public String getMode() {
|
| | | return mode;
|
| | | }
|
| | |
|
| | | public void setMode(String mode) {
|
| | | this.mode = mode;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | @Table("yeshi_ec_msg_invite")
|
| | | public class MsgInviteDetail {
|
| | | public enum MsgTypeInviteTypeEnum {
|
| | | invite("邀请消息"), exchangeCode("恭喜你,邀请码兑换成功");
|
| | | invite("邀请消息"), exchangeCode("恭喜你,邀请码兑换成功"), receiveGift ("领取礼品");
|
| | | private final String desc;
|
| | |
|
| | | private MsgTypeInviteTypeEnum(String desc) {
|
| | |
| | | DATE(d.ir_create_time) |
| | | ORDER BY d.ir_create_time desc
|
| | | </select>
|
| | | |
| | | |
| | | <select id="listDateSignRecord" resultMap="BaseResultMap">
|
| | | SELECT * FROM yeshi_ec_integral_task_record d
|
| | | WHERE d.`ir_uid` = #{uid}
|
| | | <if test="cid!=null">
|
| | | and d.ir_cid=#{cid}
|
| | | </if>
|
| | | ORDER BY d.ir_create_time desc
|
| | | </select>
|
| | |
|
| | | <select id="listSignRecordByDateTime" resultMap="BaseResultMap">
|
| | | SELECT * FROM yeshi_ec_integral_task_record d
|
| | |
| | | DailySignVO dailySignVO = new DailySignVO();
|
| | |
|
| | | Long cid = taskClass.getId();
|
| | | List<IntegralTaskRecord> listRecord = integralTaskRecordService.getSignDaysRecord(uid, cid);
|
| | | if (listRecord != null && listRecord.size() > 0) {
|
| | | for (int i = listRecord.size() - 1; i >= 0; i--) {
|
| | | IntegralTaskRecord taskRecord = listRecord.get(i);
|
| | | List<IntegralTaskRecord> listRecord7Days = integralTaskRecordService.getSign7DaysRecord(uid, cid);
|
| | | if (listRecord7Days != null && listRecord7Days.size() > 0) {
|
| | | for (int i = listRecord7Days.size() - 1; i >= 0; i--) {
|
| | | IntegralTaskRecord taskRecord = listRecord7Days.get(i);
|
| | | SignDateVO signDateVO = new SignDateVO();
|
| | | signDateVO.setLightUp(true);
|
| | | signDateVO.setGoldCoin("+" + taskRecord.getGoldCoin());
|
| | |
| | | signDateVO.setDate(before);
|
| | | }
|
| | | listSign.add(signDateVO);
|
| | | |
| | | if (listSign.size() >= 7) {
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | |
| | | dailySignVO.setDays(listSign.size());
|
| | | List<IntegralTaskRecord> listRecord = integralTaskRecordService.getSignDaysRecord(uid, cid);
|
| | | if(listRecord == null) {
|
| | | dailySignVO.setDays(0);
|
| | | } else {
|
| | | dailySignVO.setDays(listRecord.size());
|
| | | }
|
| | |
|
| | | if (listSign.size() < 7) {
|
| | | List<IntegralTask> listTask = integralTaskService.listByCid(cid);
|
| | |
| | | j++;
|
| | | }
|
| | | }
|
| | | |
| | | if (listSign.size() > 7) {
|
| | | listSign = listSign.subList(listSign.size() - 7, listSign.size() - 1);
|
| | | }
|
| | | |
| | | dailySignVO.setListDate(listSign);
|
| | | return dailySignVO;
|
| | | }
|
| | |
| | | List<IntegralTaskRecord> listRecord = new ArrayList<IntegralTaskRecord>();
|
| | | try {
|
| | | // 签到时间正序序查询近7天数据
|
| | | List<IntegralTaskRecord> list = integralTaskRecordMapper.listDaySignRecord(uid, cid);
|
| | | List<IntegralTaskRecord> list = integralTaskRecordMapper.listDateSignRecord(uid, cid);
|
| | | if (list != null && list.size() > 0) {
|
| | | Date date = new Date();
|
| | | for (IntegralTaskRecord record : list) {
|
| | |
| | | return listRecord;
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public List<IntegralTaskRecord> getSign7DaysRecord(long uid, Long cid) {
|
| | | List<IntegralTaskRecord> listRecord = new ArrayList<IntegralTaskRecord>();
|
| | | try {
|
| | | // 签到时间正序序查询近7天数据
|
| | | List<IntegralTaskRecord> list = integralTaskRecordMapper.listDaySignRecord(uid, cid);
|
| | | if (list != null && list.size() > 0) {
|
| | | Date date = new Date();
|
| | | for (IntegralTaskRecord record : list) {
|
| | | Date createTime = record.getCreateTime();
|
| | | if (DateUtil.daysBetween2(createTime, date) > 1) {
|
| | | break; // 天数未连续
|
| | | }
|
| | | date = createTime;
|
| | | listRecord.add(record);
|
| | | |
| | | if(listRecord.size() >= 7)
|
| | | break;
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | return listRecord;
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<IntegralTaskRecord> listNotReceived(int count, long uid) {
|
| | | return integralTaskRecordMapper.listNotReceived(count, uid);
|
| | |
| | | msgInviteDetailMapper.deleteByThreeSaleId(sale.getId());
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void insertSelective(MsgInviteDetail detail) {
|
| | | msgInviteDetailMapper.insertSelective(detail);
|
| | | userMsgReadStateService.addInviteMsgUnReadCount(detail.getUser().getId(), 1);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dto.msg.MsgInviteContentDTO;
|
| | | import com.yeshi.fanli.dto.push.PushContentDTO;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | |
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | @Override
|
| | | public void receiveGift(Long uid, String beizu, MsgInviteContentDTO content) {
|
| | | MsgInviteDetail detail = MsgInviteDetailFactory.receiveGift(uid, beizu, content);
|
| | | msgInviteDetailService.insertSelective(detail);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.user.TokenRecordMapper;
|
| | | import com.yeshi.fanli.dto.msg.MsgInviteContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherGiveContentDTO;
|
| | | import com.yeshi.fanli.entity.bus.tlj.UserTaoLiJinGiveRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.TokenRecord;
|
| | |
| | | import com.yeshi.fanli.service.inter.config.SystemCouponService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.integral.IntegralGetService;
|
| | | import com.yeshi.fanli.service.inter.msg.UserInviteMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.msg.UserOtherMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinGiveRecordService;
|
| | | import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService;
|
| | |
| | |
|
| | | @Resource
|
| | | private SystemCouponService systemCouponService;
|
| | | |
| | | @Resource
|
| | | private UserInviteMsgNotificationService userInviteMsgNotificationService;
|
| | |
|
| | |
|
| | | @Override
|
| | |
| | | msgOther.setGiveTime(sd.format(giveRecord.getGiveTime()));
|
| | | msgOther.setReceiveTime(sd.format(new Date()));
|
| | | userOtherMsgNotificationService.tokenGiveMsg(giveUid, beiZhu, msgOther);
|
| | | |
| | | // 激活邀请信息
|
| | | if (addTeam)
|
| | | addInviteMsg(uid, giveUid, "免单券");
|
| | | }
|
| | | });
|
| | | } else if (tokenType == TokenTypeEnum.rebatePercentCoupon) {
|
| | |
| | | msgOther.setGiveTime(sd.format(giveRecord.getGiveTime()));
|
| | | msgOther.setReceiveTime(sd.format(new Date()));
|
| | | userOtherMsgNotificationService.tokenGiveMsg(giveUid, beiZhu, msgOther);
|
| | | |
| | | // 激活邀请信息
|
| | | if (addTeam)
|
| | | addInviteMsg(uid, giveUid, "返利奖励券");
|
| | | }
|
| | | });
|
| | | } else if (tokenType == TokenTypeEnum.taoLiJin) {
|
| | |
| | | msgOther.setGiveTime(sd.format(giveRecord.getGiveTime()));
|
| | | msgOther.setReceiveTime(sd.format(new Date()));
|
| | | userOtherMsgNotificationService.tokenGiveMsg(giveUid, beiZhu, msgOther);
|
| | | |
| | | // 激活邀请信息
|
| | | if (addTeam)
|
| | | addInviteMsg(uid, giveUid, amount.setScale(2) + "元推广红包");
|
| | | }
|
| | | });
|
| | | } catch (UserTaoLiJinOriginException e) {
|
| | |
| | | }
|
| | |
|
| | |
|
| | | private void addInviteMsg(Long uid, Long giveUid, String giftName) {
|
| | | try {
|
| | | UserInfo user = userInfoService.selectByPKey(giveUid);
|
| | | UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
|
| | | MsgInviteContentDTO msgInvite = new MsgInviteContentDTO();
|
| | | msgInvite.setTitle("邀请消息");
|
| | | msgInvite.setState("成功激活邀请");
|
| | | msgInvite.setCode("你的邀请码:" + userInfoExtra.getInviteCode());
|
| | | msgInvite.setInviter("昵称:"+user.getNickName());
|
| | | msgInvite.setMode("成功领取邀请人的" + giftName);
|
| | | userInviteMsgNotificationService.receiveGift(uid, "邀请关系一旦确立无法更改 ", msgInvite);
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | }
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<TokenRecord> overdueList(int count) {
|
| | | return tokenRecordMapper.overdueList(count);
|
| | |
| | | */
|
| | | public void firstSharerOrderRewardBoss(Long uid, Long originUid, String beizu);
|
| | |
|
| | | /**
|
| | | * 7天签到记录
|
| | | * @param uid
|
| | | * @param cid
|
| | | * @return
|
| | | */
|
| | | public List<IntegralTaskRecord> getSign7DaysRecord(long uid, Long cid);
|
| | |
|
| | | }
|
| | |
| | | * @param sale
|
| | | */
|
| | | public void deleteByThreeSale(ThreeSale sale);
|
| | |
|
| | | public void insertSelective(MsgInviteDetail detail);
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.msg;
|
| | |
|
| | | import com.yeshi.fanli.dto.msg.MsgInviteContentDTO;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | |
|
| | | /**
|
| | |
| | | * @param sale
|
| | | */
|
| | | public void inviteFail(Long uid, ThreeSale sale);
|
| | |
|
| | | /**
|
| | | * 领取券、红包激活邀请
|
| | | * @param uid
|
| | | * @param beizu
|
| | | * @param content
|
| | | */
|
| | | public void receiveGift(Long uid, String beizu, MsgInviteContentDTO content);
|
| | | }
|
| | |
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.msg.MsgInviteContentDTO;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail.MsgTypeInviteTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | |
| | | detail.setUser(new UserInfo(uid));
|
| | | return detail;
|
| | | }
|
| | | |
| | | |
| | | /**
|
| | | * 领取信息激活邀请关系
|
| | | * |
| | | * @param threeSale
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public static MsgInviteDetail receiveGift(Long uid, String beiZhu, MsgInviteContentDTO content) {
|
| | | if (content == null || uid == null)
|
| | | return null;
|
| | |
|
| | | MsgInviteDetail detail = new MsgInviteDetail();
|
| | | if (StringUtil.isNullOrEmpty(beiZhu))
|
| | | detail.setBeiZhu("无");
|
| | | else
|
| | | detail.setBeiZhu(beiZhu);
|
| | | |
| | | detail.setCreateTime(new Date());
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setDesc(new Gson().toJson(content));
|
| | | detail.setMsgType(MsgTypeInviteTypeEnum.receiveGift);
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | return detail;
|
| | | }
|
| | | }
|
| | |
| | | import java.util.List;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.msg.MsgInviteContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherCouponActivateDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherCouponContentDTO;
|
| | | import com.yeshi.fanli.dto.msg.MsgOtherExchangeContentDTO;
|
| | |
| | | import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail.MsgTypeAccountTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgInviteDetail.MsgTypeInviteTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail;
|
| | |
| | | * @return
|
| | | */
|
| | | public static UserMsgVO create(MsgInviteDetail msg) {
|
| | | MsgTypeInviteTypeEnum msgType = msg.getMsgType();
|
| | | if (msgType != null && msgType == MsgTypeInviteTypeEnum.receiveGift) {
|
| | | if (StringUtil.isNullOrEmpty(msg.getDesc()))
|
| | | return null;
|
| | | |
| | | MsgInviteContentDTO dto = new Gson().fromJson(msg.getDesc(), MsgInviteContentDTO.class);
|
| | | if (dto == null)
|
| | | return null;
|
| | | |
| | | List<CommonMsgItemVO> items = new ArrayList<>();
|
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | |
| | | if (!StringUtil.isNullOrEmpty(dto.getState())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getState() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("状态", COLOR_TITLE), contentList));
|
| | | }
|
| | | |
| | | |
| | | if (!StringUtil.isNullOrEmpty(dto.getCode())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getCode() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("邀请码", COLOR_TITLE), contentList));
|
| | | }
|
| | | |
| | | |
| | | if (!StringUtil.isNullOrEmpty(dto.getInviter())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getInviter() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("邀请人", COLOR_TITLE), contentList));
|
| | | }
|
| | | |
| | | |
| | | if (!StringUtil.isNullOrEmpty(dto.getMode())) {
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(dto.getMode() + "", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("激活方式", COLOR_TITLE), contentList));
|
| | | }
|
| | | |
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO(StringUtil.isNullOrEmpty(msg.getBeiZhu()) ? "无" : msg.getBeiZhu(),
|
| | | COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("备注", COLOR_TITLE), contentList));
|
| | |
|
| | | return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_invite.png", dto.getTitle(),
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | | } |
| | | |
| | | if (msg.getInviteUser() == null || msg.getInviteUser().getWorker() == null)
|
| | | return null;
|
| | | |
| | | List<CommonMsgItemVO> items = new ArrayList<>();
|
| | | List<ClientTextStyleVO> contentList = new ArrayList<>();
|
| | | LogHelper.test("邀请消息:" + new Gson().toJson(msg));
|