Merge branch 'div' into div-1
Conflicts:
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/ConfigController.java
| | |
| | |
|
| | | import java.io.PrintWriter;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.encrypt.DESUtil;
|
| | |
|
| | | import com.yeshi.fanli.dto.user.UserInviteLevelEnum;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.FloatAD;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.FloatAD.FloatADTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgDeviceReadState;
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserActiveLog;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelUpgradedNotify;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserVIPPreInfo;
|
| | | import com.yeshi.fanli.entity.common.JumpDetailV2;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserActiveLogService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.notify.UserActivedRecordService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserLevelUpgradedNotifyService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPPreInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.ThreadUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.vo.user.UserDialogBtnVO;
|
| | | import com.yeshi.fanli.vo.user.UserDialogVO;
|
| | | import com.yeshi.fanli.vo.user.VIPUpgradedNotifyVO;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private UserVIPPreInfoService userVIPPreInfoService;
|
| | |
|
| | | @Resource
|
| | | private UserLevelUpgradedNotifyService userLevelUpgradedNotifyService;
|
| | |
|
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | |
|
| | | /**
|
| | | * s 首页配置信息
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "closeDialogNotify", method = RequestMethod.POST)
|
| | | public void closeDialogNotify(AcceptData acceptData, Long uid, String id, int type, PrintWriter out) {
|
| | | public void closeDialogNotify(AcceptData acceptData, Long uid, String id, String sourceId, int type,
|
| | | PrintWriter out) {
|
| | |
|
| | | if (uid == null) {
|
| | | out.print(JsonUtil.loadFalseResult("用户未登录"));
|
| | |
| | | }
|
| | | if (id.equalsIgnoreCase("tearcherNotify")) {
|
| | | userActivedRecordService.setTearcherNotified(uid);
|
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | | } else if (id.equalsIgnoreCase("vipUpgradedNotify")) {
|
| | | userLevelUpgradedNotifyService.setNotified(sourceId);
|
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | | } else {
|
| | | out.print(JsonUtil.loadFalseResult("id不存在"));
|
| | |
| | | data.put("tearcherLink", tearcherLink);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
|
| | | // TODO 验证是否是导师
|
| | |
| | | inner.put("ion", "http://img.flqapp.com/resource/vip/icon_vip.png");
|
| | | inner.put("title", "免费升级 享会员权益");
|
| | | inner.put("btnName", "升级会员");
|
| | | |
| | | if (uid != null) {
|
| | | // 是否导师 TODO
|
| | |
|
| | |
| | | }
|
| | | }
|
| | | data.put("vip", inner);
|
| | | } |
| | |
|
| | | if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion()) && uid != null) {
|
| | | UserLevelUpgradedNotify notify = userLevelUpgradedNotifyService.getNeedNotifyByUid(uid);
|
| | | if (notify != null) {
|
| | | Date endTime = getUpgradedTime(uid, notify.getToLevel());
|
| | | Date startTime = getUpgradedTime(uid, notify.getFromLevel());
|
| | | if (endTime != null && startTime != null) {
|
| | | VIPUpgradedNotifyVO notifyVO = new VIPUpgradedNotifyVO();
|
| | | notifyVO.setDay(TimeUtil.getDayDifferenceCount(startTime, endTime));
|
| | | notifyVO.setDetailLink(notify.getToLevel().getDetailLink());
|
| | | notifyVO.setFromLevelName(notify.getFromLevel().getName());
|
| | | notifyVO.setId("vipUpgradedNotify");
|
| | | notifyVO.setSourceId(notify.getId());
|
| | | notifyVO.setToLevel(notify.getToLevel().getTag());
|
| | | notifyVO.setToLevelName(notify.getToLevel().getName());
|
| | | data.put("vipUpgradedNotify", notifyVO);
|
| | | }
|
| | | }
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | out.print(JsonUtil.loadFalseResult("获取失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | // 获取升级时间
|
| | | private Date getUpgradedTime(Long uid, UserLevelEnum level) {
|
| | | Date time = null;
|
| | | if (level == UserLevelEnum.superVIP) {
|
| | | UserVIPInfo vipInfo = userVIPInfoService.selectByUid(uid);
|
| | | if (vipInfo != null && vipInfo.getState() == UserVIPInfo.STATE_SUCCESS)
|
| | | time = vipInfo.getSuccessTime();
|
| | |
|
| | | } else if (level == UserLevelEnum.highVIP || level == UserLevelEnum.normalVIP) {
|
| | | UserVIPPreInfo info = userVIPPreInfoService.selectByUidAndProcess(uid, level.getLevel());
|
| | | if (info != null)
|
| | | time = info.getCreateTime();
|
| | | } else if (level == UserLevelEnum.daRen) {
|
| | |
|
| | | // 成为达人的时间,用户激活时间
|
| | | ThreeSale threeSale = threeSaleSerivce.getByWorkerId(uid);
|
| | | if (threeSale != null && threeSale.getState() == true && threeSale.getSucceedTime() != null) {
|
| | | time = new Date(threeSale.getSucceedTime());
|
| | | } else {// 取用户注册时间
|
| | | UserInfo user = userInfoService.selectAvailableByPrimaryKey(uid);
|
| | | time = new Date(user.getCreatetime());
|
| | | }
|
| | | }
|
| | |
|
| | | return time;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 订单解析配置
|
| | | *
|
| | |
| | | public List<DaTaoKeDetailV2> listPreShareHotGoods(int start, int count, String sortName, BigDecimal minCommission) {
|
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("commission").gt(minCommission.multiply(new BigDecimal(100)).intValue()));
|
| | | |
| | | List<Order> orders = new ArrayList<>();
|
| | | orders.add(new Order(Direction.DESC, sortName));
|
| | | query.with(new Sort(orders)).skip(start);
|
| | | |
| | | query.limit(count);
|
| | | return mongoTemplate.find(query, getEntityClass());
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dao.user.vip;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import org.springframework.data.domain.Sort;
|
| | | import org.springframework.data.domain.Sort.Direction;
|
| | | import org.springframework.data.domain.Sort.Order;
|
| | | import org.springframework.data.mongodb.core.query.Criteria;
|
| | | import org.springframework.data.mongodb.core.query.Query;
|
| | | import org.springframework.stereotype.Repository;
|
| | |
|
| | | import com.yeshi.fanli.dao.MongodbBaseDao;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelUpgradedNotify;
|
| | |
|
| | | @Repository
|
| | | public class UserLevelUpgradedNotifyDao extends MongodbBaseDao<UserLevelUpgradedNotify> {
|
| | |
|
| | | public List<UserLevelUpgradedNotify> listToLevelsByUid(Long uid, List<UserLevelEnum> levelList) {
|
| | | Query query = new Query();
|
| | | Criteria levels = new Criteria();
|
| | | Criteria[] orlevels = new Criteria[levelList.size()];
|
| | | for (int i = 0; i < levelList.size(); i++) {
|
| | | orlevels[i] = Criteria.where("toLevel").is(levelList.get(i).name());
|
| | | }
|
| | | levels.orOperator(orlevels);
|
| | | query.addCriteria(Criteria.where("uid").is(uid).andOperator(levels));
|
| | | return findList(query);
|
| | | }
|
| | |
|
| | | /**
|
| | | * |
| | | * 获取没有通知的列表
|
| | | * @Title: listNotNotifiedByUid
|
| | | * @Description: |
| | | * @param uid
|
| | | * @return |
| | | * List<UserLevelUpgradedNotify> 返回类型
|
| | | * @throws
|
| | | */
|
| | | public List<UserLevelUpgradedNotify> listNotNotifiedByUid(Long uid) {
|
| | | Query query = new Query();
|
| | | query.addCriteria(Criteria.where("uid").is(uid).andOperator(Criteria.where("valid").is(true),
|
| | | Criteria.where("notified").is(false)));
|
| | |
|
| | | List<Order> orders = new ArrayList<>();
|
| | | orders.add(new Order(Direction.DESC, "createTime"));
|
| | | query.with(new Sort(orders));
|
| | |
|
| | | return findList(query);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.dto.mq.order;
|
| | |
|
| | | import com.yeshi.fanli.dto.mq.order.body.BanLiShopOrderMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderConfirmMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMQMsg;
|
| | | import com.yeshi.fanli.dto.mq.order.body.OrderMoneyRecievedMQMsg;
|
| | |
|
| | |
| | | orderUpdate(OrderMoneyRecievedMQMsg.class), // 订单修改
|
| | | orderFanLiActual(OrderMoneyRecievedMQMsg.class), // 订单实时到账
|
| | | orderFanLiDelay(OrderMoneyRecievedMQMsg.class), // 订单到账延时消息
|
| | | orderConfirm(OrderConfirmMQMsg.class),//订单确认收货
|
| | | orderFanLiSeparateByOrderNo(OrderMoneyRecievedMQMsg.class),//订单实时到账,按订单号分离
|
| | | banLiShopOrderDelay(BanLiShopOrderMQMsg.class), // 板栗商城下单
|
| | | banLiShopOrderRefund(BanLiShopOrderMQMsg.class), // 板栗商城订单退款
|
New file |
| | |
| | | package com.yeshi.fanli.dto.mq.order.body;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Date;
|
| | |
|
| | | import com.yeshi.fanli.dto.mq.BaseMQMsgBody;
|
| | |
|
| | | /**
|
| | | * 订单确认收货消息
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public class OrderConfirmMQMsg extends BaseMQMsgBody {
|
| | | private String orderNo;
|
| | | private int sourceType;
|
| | | private BigDecimal settleMent;// 确认收货金额
|
| | | private Long sourceUid;// 产生该订单的用户
|
| | | private Date createTime;// 创建时间
|
| | | private Date placeOrderTime;// 下单时间
|
| | |
|
| | | public OrderConfirmMQMsg(String orderNo, int sourceType, BigDecimal settleMent, Long sourceUid, Date placeOrderTime,
|
| | | Date createTime) {
|
| | | super();
|
| | | this.orderNo = orderNo;
|
| | | this.sourceType = sourceType;
|
| | | this.settleMent = settleMent;
|
| | | this.sourceUid = sourceUid;
|
| | | this.createTime = createTime;
|
| | | this.placeOrderTime = placeOrderTime;
|
| | | }
|
| | |
|
| | | public String getOrderNo() {
|
| | | return orderNo;
|
| | | }
|
| | |
|
| | | public void setOrderNo(String orderNo) {
|
| | | this.orderNo = orderNo;
|
| | | }
|
| | |
|
| | | public int getSourceType() {
|
| | | return sourceType;
|
| | | }
|
| | |
|
| | | public void setSourceType(int sourceType) {
|
| | | this.sourceType = sourceType;
|
| | | }
|
| | |
|
| | | public BigDecimal getSettleMent() {
|
| | | return settleMent;
|
| | | }
|
| | |
|
| | | public void setSettleMent(BigDecimal settleMent) {
|
| | | this.settleMent = settleMent;
|
| | | }
|
| | |
|
| | | public Long getSourceUid() {
|
| | | return sourceUid;
|
| | | }
|
| | |
|
| | | public void setSourceUid(Long sourceUid) {
|
| | | this.sourceUid = sourceUid;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getPlaceOrderTime() {
|
| | | return placeOrderTime;
|
| | | }
|
| | |
|
| | | public void setPlaceOrderTime(Date placeOrderTime) {
|
| | | this.placeOrderTime = placeOrderTime;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | public class MsgMoneyDetail {
|
| | | public enum MsgTypeMoneyTypeEnum {
|
| | | share("分享奖金"),
|
| | | invite("邀请奖金"),
|
| | | invite("团队奖金"),
|
| | | fanli("返利到账"),
|
| | | extract("提现"),
|
| | | extractAutoWX("自动提现"),
|
| | | extractValid("提现账号验证"),
|
| | | shareWeiQuan("分享奖金扣除"),
|
| | | inviteWeiQuan("邀请奖金扣除"),
|
| | | inviteWeiQuan("团队奖金扣除"),
|
| | | fanliWeiQuan("返利扣除"),
|
| | | orderReward("返利奖励"),
|
| | | systemEqualize("系统补齐"),
|
| | |
| | |
|
| | | public enum UserLevelEnum {
|
| | |
|
| | | daRen(0, 0, "快省达人"), normalVIP(3, 30, "普通会员"), highVIP(7, 70, "高级会员"), superVIP(10, 100, "超级会员");
|
| | | daRen(0, 0, "快省达人", "actived", "http://www.baidu.com"),
|
| | | normalVIP(3, 30, "普通会员", "vipPre1", "http://www.baidu.com"),
|
| | | highVIP(7, 70, "高级会员", "vipPre2", "http://www.baidu.com"),
|
| | | superVIP(10, 100, "超级会员", "vip", "http://www.baidu.com");
|
| | |
|
| | | private int level;
|
| | | private int orderRank;
|
| | | private String name;
|
| | | private String tag;
|
| | | private String detailLink;
|
| | |
|
| | | private UserLevelEnum(int level, int orderRank, String name) {
|
| | | private UserLevelEnum(int level, int orderRank, String name, String tag, String detailLink) {
|
| | | this.level = level;
|
| | | this.orderRank = orderRank;
|
| | | this.name = name;
|
| | | this.tag = tag;
|
| | | this.detailLink = detailLink;
|
| | | }
|
| | |
|
| | | public int getLevel() {
|
| | |
| | | return name;
|
| | | }
|
| | |
|
| | | public String getTag() {
|
| | | return tag;
|
| | | }
|
| | |
|
| | | public String getDetailLink() {
|
| | | return detailLink;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.bus.user.vip;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import org.springframework.data.annotation.Id;
|
| | | import org.springframework.data.mongodb.core.index.Indexed;
|
| | | import org.springframework.data.mongodb.core.mapping.Document;
|
| | | import org.springframework.data.mongodb.core.mapping.Field;
|
| | |
|
| | | /**
|
| | | * 用户等级升级提醒
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Document(collection = "userLevelUpgradedNotify")
|
| | | public class UserLevelUpgradedNotify {
|
| | |
|
| | | @Id
|
| | | private String id;
|
| | | @Field
|
| | | @Indexed
|
| | | private Long uid;
|
| | | @Field
|
| | | private UserLevelEnum fromLevel;// 原用户等级
|
| | | @Indexed
|
| | | @Field
|
| | | private UserLevelEnum toLevel;// 新的用户等级
|
| | | @Field
|
| | | private Boolean valid;// 是否有效
|
| | | @Field
|
| | | private Boolean notified;// 是否已经提醒
|
| | | @Field
|
| | | private Date readTime;// 阅读时间
|
| | | @Field
|
| | | private Date createTime;
|
| | | @Field
|
| | | private Date updateTime;
|
| | |
|
| | | public String getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(String id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public Long getUid() {
|
| | | return uid;
|
| | | }
|
| | |
|
| | | public void setUid(Long uid) {
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public UserLevelEnum getFromLevel() {
|
| | | return fromLevel;
|
| | | }
|
| | |
|
| | | public void setFromLevel(UserLevelEnum fromLevel) {
|
| | | this.fromLevel = fromLevel;
|
| | | }
|
| | |
|
| | | public UserLevelEnum getToLevel() {
|
| | | return toLevel;
|
| | | }
|
| | |
|
| | | public void setToLevel(UserLevelEnum toLevel) {
|
| | | this.toLevel = toLevel;
|
| | | }
|
| | |
|
| | | public Boolean getValid() {
|
| | | return valid;
|
| | | }
|
| | |
|
| | | public void setValid(Boolean valid) {
|
| | | this.valid = valid;
|
| | | }
|
| | |
|
| | | public Boolean getNotified() {
|
| | | return notified;
|
| | | }
|
| | |
|
| | | public void setNotified(Boolean notified) {
|
| | | this.notified = notified;
|
| | | }
|
| | |
|
| | | 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;
|
| | | }
|
| | |
|
| | | public Date getReadTime() {
|
| | | return readTime;
|
| | | }
|
| | |
|
| | | public void setReadTime(Date readTime) {
|
| | | this.readTime = readTime;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | public enum UserMoneyDetailTypeEnum {
|
| | | share("分享奖金", "http://img.flqapp.com/resource/money_detail/icon_share.png", ""),
|
| | | invite("邀请奖金", "http://img.flqapp.com/resource/money_detail/icon_invite.png", ""),
|
| | | invite("团队奖金", "http://img.flqapp.com/resource/money_detail/icon_invite.png", ""),
|
| | | inviteAndShare("奖金收入", "http://img.flqapp.com/resource/money_detail/icon_share.png", ""),
|
| | | fanli("返利到账", "http://img.flqapp.com/resource/money_detail/icon_fanli.png", ""),
|
| | | fanliWeiQuan("返利扣除",
|
| | | "http://img.flqapp.com/resource/money_detail/icon_fanli.png",
|
| | | "http://apph5.banliapp.com/AppPage/1.8.0/all_help_content.html?id=214"),
|
| | | inviteWeiQuan("邀请奖金扣除",
|
| | | inviteWeiQuan("团队奖金扣除",
|
| | | "http://img.flqapp.com/resource/money_detail/icon_invite.png",
|
| | | "http://apph5.banliapp.com/AppPage/1.8.0/all_help_content.html?id=214"),
|
| | | shareWeiQuan("分享奖金扣除",
|
| | |
| | | <if test="otherInfo != null">#{otherInfo,jdbcType=VARCHAR},</if>
|
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="materialLibType != null">#{materialLibType,jdbcType=INTEGER}</if>
|
| | | <if test="materialLibType != null">#{materialLibType,jdbcType=INTEGER},</if>
|
| | | <if test="categoryInfo != null">#{categoryInfo,jdbcType=VARCHAR},</if>
|
| | | </trim>
|
| | | </insert>
|
| | |
| | | <if test="otherInfo != null">cg_other_info=#{otherInfo,jdbcType=VARCHAR},</if>
|
| | | <if test="createTime != null">cg_createtime=#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="updateTime != null">cg_updatetime=#{updateTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="id !=null">cg_id =#{id,jdbcType=BIGINT},</if>
|
| | | <if test="materialLibType !=null">cg_material_lib_type
|
| | | =#{materialLibType,jdbcType=INTEGER},</if>
|
| | | <if test="categoryInfo != null">cg_category_info=#{categoryInfo,jdbcType=VARCHAR},</if>
|
| | |
| | | import org.yeshi.utils.entity.DateInfo; |
| | | import org.yeshi.utils.taobao.TbImgUtil; |
| | | |
| | | import com.aliyun.openservices.ons.api.Message; |
| | | import com.aliyun.openservices.ons.api.Producer; |
| | | import com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper; |
| | | import com.yeshi.fanli.dao.mybatis.order.CommonOrderMapper; |
| | | import com.yeshi.fanli.dao.mybatis.order.CommonOrderTradeIdMapMapper; |
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanOrderMapper; |
| | | import com.yeshi.fanli.dto.mq.order.OrderTopicTagEnum; |
| | | import com.yeshi.fanli.dto.mq.order.body.OrderConfirmMQMsg; |
| | | import com.yeshi.fanli.dto.order.CommonOrderAddResultDTO; |
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail; |
| | | import com.yeshi.fanli.entity.accept.AcceptData; |
| | |
| | | import com.yeshi.fanli.util.jd.JDApiUtil; |
| | | import com.yeshi.fanli.util.jd.JDUtil; |
| | | import com.yeshi.fanli.util.pinduoduo.PinDuoDuoApiUtil; |
| | | import com.yeshi.fanli.util.rocketmq.MQMsgBodyFactory; |
| | | import com.yeshi.fanli.util.rocketmq.MQTopicName; |
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil; |
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil; |
| | | import com.yeshi.fanli.util.user.UserLevelUtil; |
| | |
| | | |
| | | @Resource |
| | | private UserInfoService userInfoService; |
| | | |
| | | @Resource(name = "producer") |
| | | private Producer orderProducer; |
| | | |
| | | // 奖励订单图片 |
| | | public final static String PIC_REWARD = "http://img.flqapp.com/resource/order/order_state_reward.png"; |
| | |
| | | newCommonOrder.setUserInfo(new UserInfo(uid)); |
| | | commonOrderList.add(addCommonOrder(newCommonOrder)); |
| | | } |
| | | addConfirmMQMsg(commonOrderList); |
| | | return commonOrderList; |
| | | } |
| | | |
| | | private void addConfirmMQMsg(List<CommonOrderAddResultDTO> resultList) { |
| | | |
| | | // 订单是否新增或者更新过 |
| | | boolean isAddOrUpdate = false; |
| | | for (CommonOrderAddResultDTO dto : resultList) |
| | | if (dto.getType() == CommonOrderAddResultDTO.TYPE_ADD |
| | | || dto.getType() == CommonOrderAddResultDTO.TYPE_UPDATE) { |
| | | isAddOrUpdate = true; |
| | | break; |
| | | } |
| | | boolean hasSettleOrder = false; |
| | | // 查询是否有结算的订单 |
| | | if (isAddOrUpdate) { |
| | | for (CommonOrderAddResultDTO dto : resultList) { |
| | | if (dto.getCommonOrder().getSettleTime() != null && dto.getCommonOrder().getSettlement() != null) { |
| | | hasSettleOrder = true; |
| | | break; |
| | | } |
| | | } |
| | | } |
| | | // 有结算的订单 |
| | | if (hasSettleOrder) { |
| | | if (!Constant.IS_TEST) { |
| | | // 统计结算金额 |
| | | BigDecimal settlement = new BigDecimal("0"); |
| | | CommonOrder firstOrder = null; |
| | | for (CommonOrderAddResultDTO dto : resultList) |
| | | if (dto.getCommonOrder().getSettlement() != null) { |
| | | settlement = settlement.add(dto.getCommonOrder().getSettlement()); |
| | | if (firstOrder == null) |
| | | firstOrder = dto.getCommonOrder(); |
| | | } |
| | | if (firstOrder != null) { |
| | | Date placeDate = firstOrder.getThirdCreateTime(); |
| | | OrderConfirmMQMsg mqMsg = new OrderConfirmMQMsg(firstOrder.getOrderNo(), firstOrder.getSourceType(), |
| | | settlement, firstOrder.getUserInfo().getId(), placeDate, new Date()); |
| | | Message msg = MQMsgBodyFactory.create(MQTopicName.TOPIC_ORDER, OrderTopicTagEnum.orderConfirm, |
| | | mqMsg); |
| | | orderProducer.send(msg); |
| | | } |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public List<CommonOrderAddResultDTO> addJDOrder(JDOrder jdOrder, Long uid) throws CommonOrderException { |
New file |
| | |
| | | package com.yeshi.fanli.service.impl.user.vip;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | | import java.util.UUID;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.user.vip.UserLevelUpgradedNotifyDao;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelUpgradedNotify;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserLevelUpgradedNotifyService;
|
| | |
|
| | | @Service
|
| | | public class UserLevelUpgradedNotifyServiceImpl implements UserLevelUpgradedNotifyService {
|
| | |
|
| | | @Resource
|
| | | private UserLevelUpgradedNotifyDao userLevelUpgradedNotifyDao;
|
| | |
|
| | | @Override
|
| | | public void addUserLevelUpgradedNotify(UserLevelUpgradedNotify notify) {
|
| | | if (notify == null || notify.getUid() == null || notify.getToLevel() == null || notify.getFromLevel() == null) {
|
| | | return;
|
| | | }
|
| | |
|
| | | // 查询是否有当前提醒
|
| | | List<UserLevelEnum> levels = new ArrayList<>();
|
| | | levels.add(notify.getToLevel());
|
| | | List<UserLevelUpgradedNotify> list = userLevelUpgradedNotifyDao.listToLevelsByUid(notify.getUid(), levels);
|
| | | if (list != null)
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | if (list.get(i).getValid() == false)
|
| | | list.remove(i--);
|
| | | }
|
| | |
|
| | | if (list != null && list.size() > 0)
|
| | | return;
|
| | |
|
| | | if (notify.getNotified() == null)
|
| | | notify.setNotified(false);
|
| | |
|
| | | if (notify.getValid() == null)
|
| | | notify.setValid(true);
|
| | |
|
| | | if (notify.getCreateTime() == null)
|
| | | notify.setCreateTime(new Date());
|
| | |
|
| | | if (notify.getId() == null)
|
| | | notify.setId(UUID.randomUUID().toString());
|
| | |
|
| | | userLevelUpgradedNotifyDao.save(notify);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void setNotified(String id) {
|
| | | UserLevelUpgradedNotify notify = userLevelUpgradedNotifyDao.get(id);
|
| | | if (notify == null)
|
| | | return;
|
| | | // 查询低等级的是否已读,如若未读则设为已读
|
| | | if (notify.getToLevel() == UserLevelEnum.highVIP || notify.getToLevel() == UserLevelEnum.superVIP) {
|
| | | List<UserLevelEnum> levels = new ArrayList<>();
|
| | | if (notify.getToLevel() == UserLevelEnum.highVIP) {
|
| | | levels.add(UserLevelEnum.normalVIP);
|
| | | } else {
|
| | | levels.add(UserLevelEnum.normalVIP);
|
| | | levels.add(UserLevelEnum.highVIP);
|
| | | }
|
| | |
|
| | | List<UserLevelUpgradedNotify> list = userLevelUpgradedNotifyDao.listToLevelsByUid(notify.getUid(), levels);
|
| | | if (list != null)
|
| | | for (UserLevelUpgradedNotify item : list) {
|
| | | item.setValid(false);
|
| | | item.setUpdateTime(new Date());
|
| | | userLevelUpgradedNotifyDao.save(item);
|
| | | }
|
| | | }
|
| | | notify.setUpdateTime(new Date());
|
| | | notify.setNotified(true);
|
| | | notify.setReadTime(new Date());
|
| | | userLevelUpgradedNotifyDao.save(notify);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public UserLevelUpgradedNotify getNeedNotifyByUid(Long uid) {
|
| | | List<UserLevelUpgradedNotify> uidList = userLevelUpgradedNotifyDao.listNotNotifiedByUid(uid);
|
| | | if (uidList != null && uidList.size() > 0)
|
| | | return uidList.get(0);
|
| | | return null;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | return process;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public UserVIPPreInfo selectByUidAndProcess(Long uid, int process) {
|
| | | UserVIPPreInfo info = userVIPPreInfoMapper.selectByUidAndProcess(uid, process);
|
| | | return info;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.user.vip;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.vip.UserLevelUpgradedNotify;
|
| | |
|
| | | /**
|
| | | * 用户等级升级通知服务
|
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface UserLevelUpgradedNotifyService {
|
| | |
|
| | | /**
|
| | | * 添加用户等级升级提醒
|
| | | * @Title: addUserLevelUpgradedNotify
|
| | | * @Description: |
| | | * @param notify |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void addUserLevelUpgradedNotify(UserLevelUpgradedNotify notify);
|
| | |
|
| | | /**
|
| | | * 设置已经提醒
|
| | | * @Title: setNotified
|
| | | * @Description: |
| | | * @param id |
| | | * void 返回类型
|
| | | * @throws
|
| | | */
|
| | | public void setNotified(String id);
|
| | | |
| | | |
| | | /**
|
| | | * 获取需要通知的数据
|
| | | * @Title: getNeedNotifyByUid
|
| | | * @Description: |
| | | * @param uid
|
| | | * @return |
| | | * UserLevelUpgradedNotify 返回类型
|
| | | * @throws
|
| | | */
|
| | | public UserLevelUpgradedNotify getNeedNotifyByUid(Long uid);
|
| | |
|
| | | }
|
| | |
| | | * @param inviteSuccess
|
| | | */
|
| | | public void verifyVipPreInfo(Long uid, boolean inviteSuccess);
|
| | | |
| | | /**
|
| | | * 根据用户ID与步骤查询
|
| | | * @Title: selectByUidAndProcess
|
| | | * @Description: |
| | | * @param uid
|
| | | * @param process
|
| | | * @return |
| | | * UserVIPPreInfo 返回类型
|
| | | * @throws
|
| | | */
|
| | | |
| | | public UserVIPPreInfo selectByUidAndProcess(Long uid,int process);
|
| | |
|
| | | }
|
| | |
| | | *
|
| | | */
|
| | | private static final long serialVersionUID = 1L;
|
| | | |
| | |
|
| | | @Expose
|
| | | private int totalCount;// 总数量
|
| | | @Expose
|
| | |
| | | private String link;// 券链接
|
| | | @Expose
|
| | | private String token; // 券口令
|
| | | @Expose
|
| | | private boolean shopCoupon;// 是否为店铺券
|
| | |
|
| | | public boolean isShopCoupon() {
|
| | | return shopCoupon;
|
| | | }
|
| | |
|
| | | public void setShopCoupon(boolean shopCoupon) {
|
| | | this.shopCoupon = shopCoupon;
|
| | | }
|
| | |
|
| | | public int getTotalCount() {
|
| | | return totalCount;
|
New file |
| | |
| | | package com.yeshi.fanli.vo.user;
|
| | |
|
| | | public class VIPUpgradedNotifyVO {
|
| | | private String fromLevelName;// 原来的等级名称
|
| | | private String toLevelName;// 现在的等级名称
|
| | | private String toLevel;// 现在的等级
|
| | | private int day;// 耗时天数
|
| | | private String detailLink;// 权益链接
|
| | | private String id;
|
| | | private String sourceId;
|
| | |
|
| | | public String getFromLevelName() {
|
| | | return fromLevelName;
|
| | | }
|
| | |
|
| | | public void setFromLevelName(String fromLevelName) {
|
| | | this.fromLevelName = fromLevelName;
|
| | | }
|
| | |
|
| | | public String getToLevelName() {
|
| | | return toLevelName;
|
| | | }
|
| | |
|
| | | public void setToLevelName(String toLevelName) {
|
| | | this.toLevelName = toLevelName;
|
| | | }
|
| | |
|
| | | public String getToLevel() {
|
| | | return toLevel;
|
| | | }
|
| | |
|
| | | public void setToLevel(String toLevel) {
|
| | | this.toLevel = toLevel;
|
| | | }
|
| | |
|
| | | public int getDay() {
|
| | | return day;
|
| | | }
|
| | |
|
| | | public void setDay(int day) {
|
| | | this.day = day;
|
| | | }
|
| | |
|
| | | public String getDetailLink() {
|
| | | return detailLink;
|
| | | }
|
| | |
|
| | | public void setDetailLink(String detailLink) {
|
| | | this.detailLink = detailLink;
|
| | | }
|
| | |
|
| | | public String getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(String id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public String getSourceId() {
|
| | | return sourceId;
|
| | | }
|
| | |
|
| | | public void setSourceId(String sourceId) {
|
| | | this.sourceId = sourceId;
|
| | | }
|
| | | }
|