| | |
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.InviteGetMoneyService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemService;
|
| | | import com.yeshi.fanli.service.inter.goods.ShareGoodsService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
|
| | |
| | |
|
| | | switch (type) {
|
| | | case MSG_TYPE_ORDER:
|
| | | msgOrderDetailService.readMsgByUid(uid);
|
| | | userMsgReadStateService.readOrderMsg(uid);
|
| | | List<MsgOrderDetail> detailList = msgOrderDetailService.listMsgOrderDetail(uid, page);
|
| | | count = msgOrderDetailService.countMsgOrderDetail(uid);
|
| | | if (detailList != null)
|
| | |
| | | list.add(UserMsgVOFactory.create(detail));
|
| | | break;
|
| | | case MSG_TYPE_MONEY:
|
| | | msgMoneyDetailService.readMsgByUid(uid);
|
| | | userMsgReadStateService.readMoneyMsg(uid);
|
| | | List<MsgMoneyDetail> detailList1 = msgMoneyDetailService.listMsgMoneyDetail(uid, page);
|
| | | count = msgMoneyDetailService.countMsgMoneyDetail(uid);
|
| | | if (detailList1 != null)
|
| | |
| | | list.add(UserMsgVOFactory.create(detail));
|
| | | break;
|
| | | case MSG_TYPE_ACCOUNT:
|
| | | msgAccountDetailService.readMsgByUid(uid);
|
| | | userMsgReadStateService.readAccountMsg(uid);
|
| | | List<MsgAccountDetail> detailList2 = msgAccountDetailService.listMsgAccountDetail(uid, page);
|
| | | count = msgAccountDetailService.countMsgAccountDetail(uid);
|
| | | if (detailList2 != null)
|
| | |
| | | list.add(UserMsgVOFactory.create(detail));
|
| | | break;
|
| | | case MSG_TYPE_INVITE:
|
| | | msgInviteDetailService.readMsgByUid(uid);
|
| | | userMsgReadStateService.readInviteMsg(uid);
|
| | | List<MsgInviteDetail> detailList3 = msgInviteDetailService.listMsgInviteDetail(uid, page);
|
| | | count = msgInviteDetailService.countMsgInviteDetail(uid);
|
| | | if (detailList3 != null)
|
| | |
| | | JSONObject data = JSONObject.fromObject(JsonUtil.getApiCommonGson().toJson(num));
|
| | | data.put("totalCount", num.getTypeAccount() + num.getTypeInvite() + num.getTypeMoney() + num.getTypeOrder()
|
| | | + num.getTypeScore() + num.getTypeSystem());
|
| | | JSONObject root = new JSONObject();
|
| | | root.put("data", data);
|
| | | root.put("count", 1);
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | | private String getTimeDesc(Date nowDate, Date targetDate) {
|
| | |
| | | }
|
| | |
|
| | | vo.setGoodsList(goodsList);
|
| | | vo.setTitle("猜你喜欢");
|
| | | vo.setIcon("http://img.flqapp.com/resource/msg/icon_msg_guess_like.png");
|
| | | volist.add(vo);
|
| | | }
|
| | |
|
| | | if (volist.size() < Constant.PAGE_SIZE) {
|
| | | if (volist.size() > 0 && volist.size() < Constant.PAGE_SIZE) {
|
| | | // 添加欢迎语
|
| | | UserHomeMsgVO vo = new UserHomeMsgVO();
|
| | | vo.setContent("恭喜你,成为返利券的用户\n独家优惠券帮你省钱;\n参与奖金活动帮你赚钱;\n让返利券成为你的省钱助手吧!");
|
| | |
| | | JSONObject root = new JSONObject();
|
| | | root.put("msgList", new Gson().toJson(volist));
|
| | | if (page == 1) {
|
| | | UserMsgUnReadNum num = userMsgReadStateService.getReadStateByUid(uid);
|
| | | UserSystemMsg usm = userSystemMsgService.getLatestUserSystemMsg(uid);
|
| | | if (usm != null)
|
| | | root.put("systemMsg", new UserSystemMsgVO(usm.getId(), usm.getType().name(), usm.getSolved(),
|
| | | usm.getTitle(), usm.getContent(),
|
| | | usm.getTimeTag() == 1 ? "http://img.flqapp.com/resource/msg/icon_emergent.png" : "",
|
| | | Constant.systemCommonConfig.getDefaultPortrait(), getTimeDesc(now, usm.getCreateTime())));
|
| | | root.put("systemMsg",
|
| | | new UserSystemMsgVO(usm.getId(), usm.getType().name(), usm.getSolved(), usm.getTitle(),
|
| | | usm.getContent(),
|
| | | usm.getTimeTag() == 1 ? "http://img.flqapp.com/resource/msg/icon_emergent.png" : "",
|
| | | Constant.systemCommonConfig.getDefaultPortrait(), getTimeDesc(now, usm.getCreateTime()),
|
| | | num.getTypeSystem()));
|
| | | }
|
| | | root.put("count", count);
|
| | | out.print(JsonUtil.loadTrueResult(root));
|
| | |
| | | voList.add(new UserSystemMsgVO(usm.getId(), usm.getType().name(), usm.getSolved(), usm.getTitle(),
|
| | | usm.getContent(),
|
| | | usm.getTimeTag() == 1 ? "http://img.flqapp.com/resource/msg/icon_emergent.png" : "", null,
|
| | | usm.getCreateTime().getTime() + ""));
|
| | | usm.getCreateTime().getTime() + "", 0));
|
| | | }
|
| | | long count = userSystemMsgService.countUserSystemMsg(uid);
|
| | |
|
| | | userSystemMsgService.readMsgByUid(uid);
|
| | | userMsgReadStateService.readUserSystemMsg(uid);
|
| | |
|
| | | JSONObject root = new JSONObject();
|
| | | root.put("data", voList);
|
| | |
| | | MsgOrderDetail selectByUidAndOrderId(@Param("uid") Long uid, @Param("orderId") String orderId); |
| | | |
| | | List<MsgOrderDetail> listByUid(@Param("uid") Long uid, @Param("start") long start, @Param("count") int count); |
| | | |
| | | List<MsgOrderDetail> listByOrderId(@Param("orderId") String orderId); |
| | | |
| | | Long countByUid(@Param("uid") Long uid); |
| | | |
| | |
| | | @Table("yeshi_ec_msg_money")
|
| | | public class MsgMoneyDetail {
|
| | | public enum MsgTypeMoneyTypeEnum {
|
| | | share("分享奖金"), invite("邀请奖金"), fanli("返利到账"), extract("提现"), extractValid("提现账号验证");
|
| | | share("分享奖金"), invite("邀请奖金"), fanli("返利到账"), extract("提现"), extractValid("提现账号验证"), shareWeiQuan(
|
| | | "分享奖金扣除"), inviteWeiQuan("邀请奖金扣除"), fanliWeiQuan("返利扣除");
|
| | | private final String desc;
|
| | |
|
| | | private MsgTypeMoneyTypeEnum(String desc) {
|
| | |
| | | // 红包ID
|
| | | @Column(name = "ho_hongbao_id")
|
| | | private HongBaoV2 hongBaoV2;
|
| | | |
| | |
|
| | | // 订单ID
|
| | | @Column(name = "ho_order_id")
|
| | | private CommonOrder commonOrder;
|
| | |
| | | // 创建时间
|
| | | @Column(name = "cog_create_time")
|
| | | private Date createTime;
|
| | | |
| | |
|
| | | public HongBaoOrder() {
|
| | | |
| | |
|
| | | }
|
| | | |
| | |
|
| | | public HongBaoOrder(CommonOrder commonOrder, HongBaoV2 hongBao) {
|
| | | this.commonOrder = commonOrder;
|
| | | this.hongBaoV2 = hongBao;
|
| | | }
|
| | |
|
| | | public HongBaoOrder(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.msg.UserInviteMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private ThreeSaleSerivce ThreeSaleSerivce;
|
| | | @Resource
|
| | | private UserInviteMsgNotificationService userInviteMsgNotificationService;
|
| | |
|
| | | @Resource
|
| | | private UserInfoService userInfoService;
|
| | |
| | | // 更新邀请过期: 60天未被邀请成功、60天未登陆系统
|
| | | if (list.size() > 0) {
|
| | | ThreeSaleSerivce.updateExpire(list);
|
| | | for (Long id : listFailed) {
|
| | | // 通知
|
| | | ThreeSale ts = ThreeSaleSerivce.selectByPrimaryKey(id);
|
| | | if (ts != null)
|
| | | userInviteMsgNotificationService.inviteFail(ts.getBoss().getId(), ts);
|
| | | }
|
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | |
| | | from yeshi_ec_msg_order where mo_uid = #{uid,jdbcType=BIGINT} and |
| | | mo_order_id=#{orderId} |
| | | </select> |
| | | |
| | | |
| | | <select id="listByOrderId" resultMap="BaseResultMap" parameterType="java.lang.String"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_msg_order where mo_order_id = #{orderId} |
| | | </select> |
| | | |
| | | |
| | | <select id="listByUid" resultMap="BaseResultMap"> |
| | | select |
| | |
| | | System.out.println("订单:" + order);
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void addHongBao(Order order, TaoBaoOrder taoBaoOrder, Long orderItemId) {
|
| | | OrderItem orderItem = orderItemMapper.selectByPrimaryKey(orderItemId);
|
| | | // 订单返利比例
|
| | | BigDecimal proportion = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal baseRate = proportion.divide(new BigDecimal(100));
|
| | |
|
| | | // 创建红包
|
| | | JSONObject data = new JSONObject();
|
| | | HongBao hongBao = null;
|
| | | if (taoBaoOrder.getOrderState().equalsIgnoreCase("订单结算"))
|
| | | // 订单结算应该取结算金额与预估收入
|
| | | hongBao = HongBaoFactory.createHongBao(MoneyBigDecimalUtil.mul(baseRate, taoBaoOrder.geteIncome()),
|
| | | data.toString(), order.getId(), null, order.getUserInfo(), 1, taoBaoOrder.getSettlement(),
|
| | | taoBaoOrder.getAuctionId());
|
| | | else
|
| | | hongBao = HongBaoFactory.createHongBao(MoneyBigDecimalUtil.mul(baseRate, taoBaoOrder.getEstimate()),
|
| | | data.toString(), order.getId(), null, order.getUserInfo(), 1, taoBaoOrder.getPayment(),
|
| | | taoBaoOrder.getAuctionId());
|
| | |
|
| | | hongBao.setOrderId(taoBaoOrder.getOrderId());
|
| | | hongBao.setOrderItemId(orderItem.getId());
|
| | | hongBao.setPreGettime(0L);
|
| | | if (taoBaoOrder.getOrderState().equalsIgnoreCase("订单结算")
|
| | | && !StringUtil.isNullOrEmpty(taoBaoOrder.getSettlementTime()))
|
| | | hongBao.setBalanceTime(
|
| | | new Date(TimeUtil.convertToTimeTemp(taoBaoOrder.getSettlementTime(), "yyyy-MM-dd HH:mm:ss")));
|
| | |
|
| | | UserInfo boss = threeSaleMapper.selectBoss(order.getUserInfo().getId());
|
| | |
|
| | | if (boss != null) {
|
| | | hongBao.setHasChild(true);
|
| | | }
|
| | |
|
| | | // 如果失效就判定已经失效
|
| | | if (taoBaoOrder.getOrderState().equalsIgnoreCase("订单失效"))
|
| | | hongBao.setState(HongBao.STATE_SHIXIAO);
|
| | |
|
| | | hongBaoMapper.insertSelective(hongBao);
|
| | | // 通知用户订单被统计
|
| | | if (!taoBaoOrder.getOrderState().equalsIgnoreCase("订单失效")) {
|
| | | try {
|
| | | userNotificationService.orderFanliStatisticed(hongBao.getUserInfo().getId(), order.getOrderId());
|
| | | } catch (Exception e) {
|
| | | }
|
| | | }
|
| | |
|
| | | // 提成订单不处理失效订单
|
| | | if (taoBaoOrder.getOrderState().equalsIgnoreCase("订单失效"))
|
| | | return;
|
| | | if (boss != null) {
|
| | | // 计算上级返利金额
|
| | | HongBaoManage hbm = hongBaoManageMapper
|
| | | .selectByKey("sale_6_" + (boss.getRank() == null ? 0 : boss.getRank()));
|
| | | BigDecimal rate = null;
|
| | | if (hbm == null)
|
| | | rate = new BigDecimal(0);
|
| | | else
|
| | | rate = new BigDecimal(hbm.getValue()).divide(new BigDecimal(100));
|
| | | if (rate.compareTo(new BigDecimal(0)) > 0) {
|
| | | HongBao hongBao2 = null;
|
| | | if (taoBaoOrder.getOrderState().equalsIgnoreCase("订单结算")) {
|
| | | // 订单结算应该取结算金额与预估收入
|
| | | hongBao2 = HongBaoFactory.createHongBao(
|
| | | MoneyBigDecimalUtil.mul(rate, MoneyBigDecimalUtil.mul(taoBaoOrder.geteIncome(), baseRate)),
|
| | | null, hongBao, boss, Constant.ONESALE);
|
| | | } else {
|
| | | hongBao2 = HongBaoFactory.createHongBao(
|
| | | MoneyBigDecimalUtil.mul(rate, MoneyBigDecimalUtil.mul(taoBaoOrder.getEstimate(), baseRate)),
|
| | | null, hongBao, boss, Constant.ONESALE);
|
| | | }
|
| | |
|
| | | HongBaoFactory.createHongBao(
|
| | | MoneyBigDecimalUtil.mul(rate, MoneyBigDecimalUtil.mul(taoBaoOrder.getEstimate(), baseRate)),
|
| | | null, hongBao, boss, Constant.ONESALE);
|
| | | // 设置订单号
|
| | | hongBao2.setOrderId(taoBaoOrder.getOrderId());
|
| | |
|
| | | hongBaoMapper.insertSelective(hongBao2);
|
| | |
|
| | | try {
|
| | | // 通知提成订单被统计
|
| | | userNotificationService.tiChengStatisticed(hongBao2.getUserInfo().getId(), hongBao2.getOrderId(),
|
| | | hongBao2.getMoney());
|
| | | } catch (Exception e) {
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | UserInfo boss2 = threeSaleMapper.selectBoss(boss.getId());
|
| | | // 计算上上级返利
|
| | | if (boss2 != null) {
|
| | | hbm = hongBaoManageMapper.selectByKey("sale_7_" + (boss.getRank() == null ? 0 : boss.getRank()));
|
| | | if (hbm == null)
|
| | | rate = new BigDecimal(0);
|
| | | else
|
| | | rate = new BigDecimal(hbm.getValue()).divide(new BigDecimal(100));
|
| | | if (rate.compareTo(new BigDecimal(0)) > 0) {
|
| | | // 订单结算应该取结算金额与预估收入
|
| | | HongBao hongBao3 = null;
|
| | | if (taoBaoOrder.getOrderState().equalsIgnoreCase("订单结算"))
|
| | | hongBao3 = HongBaoFactory.createHongBao(
|
| | | MoneyBigDecimalUtil.mul(rate,
|
| | | MoneyBigDecimalUtil.mul(taoBaoOrder.geteIncome(), baseRate)),
|
| | | null, hongBao, boss2, Constant.TWOSALE);
|
| | | else
|
| | | hongBao3 = HongBaoFactory.createHongBao(
|
| | | MoneyBigDecimalUtil.mul(rate,
|
| | | MoneyBigDecimalUtil.mul(taoBaoOrder.getEstimate(), baseRate)),
|
| | | null, hongBao, boss2, Constant.TWOSALE);
|
| | | // 设置返利订单号
|
| | | hongBao3.setOrderId(taoBaoOrder.getOrderId());
|
| | | hongBaoMapper.insertSelective(hongBao3);
|
| | |
|
| | | try {
|
| | | // 通知提成订单被统计
|
| | | userNotificationService.tiChengStatisticed(hongBao3.getUserInfo().getId(),
|
| | | hongBao3.getOrderId(), hongBao3.getMoney());
|
| | | } catch (Exception e) {
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getTotalTiChengMoney(Long uid) {
|
| | |
| | | import java.util.Comparator;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.HashSet;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.Set;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoOrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanOrderMapper;
|
| | | import com.yeshi.fanli.dto.HongBaoDTO;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | |
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.msg.UserOrderMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserNotificationService;
|
| | |
| | |
|
| | | @Resource
|
| | | private PidOrderMapper pidOrderMapper;
|
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
|
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | |
|
| | | @Resource
|
| | | private UserNotificationService userNotificationService;
|
| | |
|
| | | @Resource
|
| | | private UserOrderMsgNotificationService userOrderMsgNotificationService;
|
| | |
|
| | | @Override
|
| | | public int insert(HongBaoV2 record) {
|
| | |
| | |
|
| | | }
|
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
|
| | | @Resource
|
| | | private ThreeSaleSerivce threeSaleSerivce;
|
| | |
|
| | | @Resource
|
| | | private UserNotificationService userNotificationService;
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void addHongBao(List<CommonOrder> commonOrderList, int type) throws HongBaoException {
|
| | |
|
| | | Set<Integer> stateSet = new HashSet<>();// 订单状态Set
|
| | | if (commonOrderList != null && commonOrderList.size() > 0) {
|
| | | Map<Integer, HongBaoV2> notificationMap = new HashMap<>();
|
| | | Map<Integer, HongBaoOrder> notificationMap = new HashMap<>();
|
| | | int goodsCount = 0;
|
| | | boolean hasAdd = false;
|
| | | for (CommonOrder commonOrder : commonOrderList) {
|
| | | stateSet.add(commonOrder.getState());
|
| | | goodsCount += commonOrder.getCount();
|
| | | if (commonOrder == null || commonOrder.getId() == null || commonOrder.getUserInfo() == null)
|
| | | throw new HongBaoException(1, "订单信息不完整");
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(commonOrder.getId());
|
| | | if (hongBaoOrder == null) {
|
| | | saveHongBao(commonOrder, type, notificationMap);
|
| | | hasAdd = true;
|
| | | } else {
|
| | | updateHongBao(hongBaoOrder, commonOrder, type);
|
| | | updateHongBao(hongBaoOrder, commonOrder, type, notificationMap);
|
| | | }
|
| | | }
|
| | | /**
|
| | | * 通知用户的返利情况
|
| | | */
|
| | | Iterator<Integer> its = notificationMap.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | | Integer t = its.next();
|
| | | HongBaoV2 notify = notificationMap.get(t);
|
| | | String orderId = commonOrderList.get(0).getOrderNo();
|
| | | Long uid = notify.getUserInfo().getId();
|
| | | BigDecimal money = notify.getMoney();
|
| | | switch (t) {
|
| | | case HongBaoV2.TYPE_ZIGOU:
|
| | | userNotificationService.orderFanliStatisticed(uid, orderId);
|
| | | break;
|
| | | case HongBaoV2.TYPE_SHARE_GOODS:
|
| | | userNotificationService.orderShareStatisticed(uid, orderId, money);
|
| | | break;
|
| | | case HongBaoV2.TYPE_YIJI:
|
| | | userNotificationService.orderInviteStatisticed(uid, orderId, money);
|
| | | break;
|
| | | case HongBaoV2.TYPE_ERJI:
|
| | | userNotificationService.orderInviteStatisticed(uid, orderId, money);
|
| | | break;
|
| | | int state = getOrderState(stateSet);
|
| | | if (hasAdd) {
|
| | | Iterator<Integer> its = notificationMap.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | |
|
| | | Integer t = its.next();
|
| | | HongBaoV2 notify = notificationMap.get(t).getHongBaoV2();
|
| | | CommonOrder commonOrder = notificationMap.get(t).getCommonOrder();
|
| | | String orderId = commonOrderList.get(0).getOrderNo();
|
| | | Long uid = notify.getUserInfo().getId();
|
| | | BigDecimal money = notify.getMoney();
|
| | | switch (t) {
|
| | | case HongBaoV2.TYPE_ZIGOU:
|
| | | userNotificationService.orderFanliStatisticed(uid, orderId, goodsCount, MsgOrderDetail.STATE_FK,
|
| | | null, money);
|
| | | userOrderMsgNotificationService.orderFanLiStatistic(uid, orderId, commonOrder.getPayment(),
|
| | | money, goodsCount, state);
|
| | | break;
|
| | | case HongBaoV2.TYPE_SHARE_GOODS:
|
| | | userNotificationService.orderShareStatisticed(uid, orderId, goodsCount, MsgOrderDetail.STATE_FK,
|
| | | null, money);
|
| | | userOrderMsgNotificationService.orderShareStatistic(uid, orderId, commonOrder.getPayment(),
|
| | | money, goodsCount, state);
|
| | | break;
|
| | | case HongBaoV2.TYPE_YIJI:
|
| | | userNotificationService.orderInviteStatisticed(uid, orderId, goodsCount,
|
| | | MsgOrderDetail.STATE_FK, null, money);
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, commonOrder.getPayment(),
|
| | | money, goodsCount, state);
|
| | | break;
|
| | | case HongBaoV2.TYPE_ERJI:
|
| | | userNotificationService.orderInviteStatisticed(uid, orderId, goodsCount,
|
| | | MsgOrderDetail.STATE_FK, null, money);
|
| | | userOrderMsgNotificationService.orderInviteStatistic(uid, orderId, commonOrder.getPayment(),
|
| | | money, goodsCount, state);
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | // 添加新版本通知
|
| | |
|
| | | if (!hasAdd) {
|
| | | Iterator<Integer> its = notificationMap.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | | Integer t = its.next();
|
| | | HongBaoV2 notify = notificationMap.get(t).getHongBaoV2();
|
| | | CommonOrder commonOrder = notificationMap.get(t).getCommonOrder();
|
| | | String orderId = commonOrderList.get(0).getOrderNo();
|
| | | Long uid = notify.getUserInfo().getId();
|
| | | BigDecimal money = notify.getMoney();
|
| | | switch (t) {
|
| | | case HongBaoV2.TYPE_ZIGOU:
|
| | | userOrderMsgNotificationService.orderFanLiStateChanged(uid, orderId, commonOrder.getPayment(),
|
| | | money, state);
|
| | | break;
|
| | | case HongBaoV2.TYPE_SHARE_GOODS:
|
| | | userOrderMsgNotificationService.orderShareStateChanged(uid, orderId, commonOrder.getPayment(),
|
| | | money, state);
|
| | | break;
|
| | | case HongBaoV2.TYPE_YIJI:
|
| | | userOrderMsgNotificationService.orderInviteStateChanged(uid, orderId, commonOrder.getPayment(),
|
| | | money, state);
|
| | | break;
|
| | | case HongBaoV2.TYPE_ERJI:
|
| | | userOrderMsgNotificationService.orderInviteStateChanged(uid, orderId, commonOrder.getPayment(),
|
| | | money, state);
|
| | | break;
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | private int getOrderState(Set<Integer> states) {
|
| | | if (states.size() == 1)
|
| | | return states.iterator().next();
|
| | | Iterator<Integer> its = states.iterator();
|
| | | while (its.hasNext()) {
|
| | | int tempState = its.next();
|
| | | if (tempState == CommonOrder.STATE_FK)
|
| | | return CommonOrder.STATE_FK;
|
| | | else if (tempState == CommonOrder.STATE_JS)
|
| | | return CommonOrder.STATE_JS;
|
| | | }
|
| | | return CommonOrder.STATE_SX;
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | private void updateHongBao(HongBaoOrder hongBaoOrder, CommonOrder commonOrder, int type) throws HongBaoException {
|
| | | private void updateHongBao(HongBaoOrder hongBaoOrder, CommonOrder commonOrder, int type,
|
| | | Map<Integer, HongBaoOrder> notificationMap) throws HongBaoException {
|
| | | System.out.println(commonOrder.getOrderNo());
|
| | | HongBaoV2 oldHongBao = hongBaoV2Mapper.selectByPrimaryKey(hongBaoOrder.getHongBaoV2().getId());
|
| | | if (oldHongBao == null)
|
| | |
| | | hongBao.setMoney(new BigDecimal(0));
|
| | | }
|
| | | hongBaoV2Mapper.updateByPrimaryKeySelective(hongBao);
|
| | |
|
| | | // 加入通知
|
| | | if (notificationMap.get(type) == null) {
|
| | | HongBaoV2 tempHongBao = new HongBaoV2(hongBao.getId());
|
| | | tempHongBao.setUserInfo(hongBao.getUserInfo());
|
| | | tempHongBao.setMoney(hongBao.getMoney());
|
| | | CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
|
| | | tempCommonOrder.setPayment(commonOrder.getPayment());
|
| | | notificationMap.put(type, new HongBaoOrder(tempCommonOrder, tempHongBao));
|
| | | } else {
|
| | | // 增加付款金额与资金
|
| | | HongBaoOrder tempHongBaoOrder = notificationMap.get(type);
|
| | | tempHongBaoOrder.getCommonOrder()
|
| | | .setPayment(tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
|
| | | tempHongBaoOrder.getHongBaoV2()
|
| | | .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(hongBao.getMoney()));
|
| | | notificationMap.put(type, tempHongBaoOrder);
|
| | | }
|
| | |
|
| | | // 获取子红包
|
| | | List<HongBaoV2> children = hongBaoV2Mapper.listChildrenById(hongBao.getId());
|
| | |
| | | MoneyBigDecimalUtil.mul(hongBao.getMoney(), rate.divide(new BigDecimal(100))));
|
| | | }
|
| | | hongBaoV2Mapper.updateByPrimaryKeySelective(childUpdate);
|
| | |
|
| | | // 加入通知
|
| | | if (notificationMap.get(type) == null) {
|
| | | HongBaoV2 tempHongBao = new HongBaoV2(child.getId());
|
| | | tempHongBao.setUserInfo(child.getUserInfo());
|
| | | tempHongBao.setMoney(child.getMoney());
|
| | | CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
|
| | | tempCommonOrder.setPayment(commonOrder.getPayment());
|
| | | notificationMap.put(type, new HongBaoOrder(tempCommonOrder, tempHongBao));
|
| | | } else {
|
| | | // 增加付款金额与资金
|
| | | HongBaoOrder tempHongBaoOrder = notificationMap.get(type);
|
| | | tempHongBaoOrder.getCommonOrder().setPayment(
|
| | | tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
|
| | | tempHongBaoOrder.getHongBaoV2()
|
| | | .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(child.getMoney()));
|
| | | notificationMap.put(type, tempHongBaoOrder);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | } else if (type == HongBaoV2.TYPE_SHARE_GOODS) {
|
| | |
| | | hongBao.setMoney(new BigDecimal(0));
|
| | | }
|
| | | hongBaoV2Mapper.updateByPrimaryKeySelective(hongBao);
|
| | | // 通知
|
| | | if (notificationMap.get(type) == null) {
|
| | | HongBaoV2 tempHongBao = new HongBaoV2(hongBao.getId());
|
| | | tempHongBao.setUserInfo(hongBao.getUserInfo());
|
| | | tempHongBao.setMoney(hongBao.getMoney());
|
| | | CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
|
| | | tempCommonOrder.setPayment(commonOrder.getPayment());
|
| | | notificationMap.put(type, new HongBaoOrder(tempCommonOrder, tempHongBao));
|
| | | } else {
|
| | | // 增加付款金额与资金
|
| | | HongBaoOrder tempHongBaoOrder = notificationMap.get(type);
|
| | | tempHongBaoOrder.getCommonOrder()
|
| | | .setPayment(tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
|
| | | tempHongBaoOrder.getHongBaoV2()
|
| | | .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(hongBao.getMoney()));
|
| | | notificationMap.put(type, tempHongBaoOrder);
|
| | | }
|
| | |
|
| | | // 获取子红包
|
| | | List<HongBaoV2> children = hongBaoV2Mapper.listChildrenById(hongBao.getId());
|
| | |
| | | }
|
| | |
|
| | | @Transactional
|
| | | private void saveHongBao(CommonOrder commonOrder, int type, Map<Integer, HongBaoV2> notificationMap)
|
| | | private void saveHongBao(CommonOrder commonOrder, int type, Map<Integer, HongBaoOrder> notificationMap)
|
| | | throws HongBaoException {
|
| | | if (type == HongBaoV2.TYPE_ZIGOU) {// 获取自购的返利比例
|
| | | BigDecimal fanliRate = hongBaoManageService.getFanLiRate(commonOrder.getCreateTime().getTime());
|
| | |
| | | hongBaoOrder.setHongBaoV2(hongBao);
|
| | | hongBaoOrderMapper.insertSelective(hongBaoOrder);
|
| | | // 加入通知
|
| | | if (notificationMap.get(type) == null)
|
| | | notificationMap.put(type, hongBao);
|
| | | else {
|
| | | notificationMap.get(type).setMoney(notificationMap.get(type).getMoney().add(hongBao.getMoney()));
|
| | | if (notificationMap.get(type) == null) {
|
| | | HongBaoV2 tempHongBao = new HongBaoV2(hongBao.getId());
|
| | | tempHongBao.setUserInfo(hongBao.getUserInfo());
|
| | | tempHongBao.setMoney(hongBao.getMoney());
|
| | | CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
|
| | | tempCommonOrder.setPayment(commonOrder.getPayment());
|
| | | notificationMap.put(type, new HongBaoOrder(tempCommonOrder, tempHongBao));
|
| | | } else {
|
| | | // 增加付款金额与资金
|
| | | HongBaoOrder tempHongBaoOrder = notificationMap.get(type);
|
| | | tempHongBaoOrder.getCommonOrder()
|
| | | .setPayment(tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
|
| | | tempHongBaoOrder.getHongBaoV2()
|
| | | .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(hongBao.getMoney()));
|
| | | notificationMap.put(type, tempHongBaoOrder);
|
| | | }
|
| | |
|
| | | UserInfo boss = threeSaleSerivce.getBoss(user.getId());
|
| | |
| | | }
|
| | | hongBaoV2Mapper.insertSelective(firstHongbao);
|
| | | // 用户通知
|
| | | if (notificationMap.get(HongBaoV2.TYPE_YIJI) == null)
|
| | | notificationMap.put(HongBaoV2.TYPE_YIJI, firstHongbao);
|
| | | else {
|
| | | notificationMap.get(HongBaoV2.TYPE_YIJI)
|
| | | .setMoney(notificationMap.get(HongBaoV2.TYPE_YIJI).getMoney().add(firstHongbao.getMoney()));
|
| | | if (notificationMap.get(type) == null) {
|
| | | HongBaoV2 tempHongBao = new HongBaoV2(firstHongbao.getId());
|
| | | tempHongBao.setUserInfo(firstHongbao.getUserInfo());
|
| | | tempHongBao.setMoney(firstHongbao.getMoney());
|
| | | CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
|
| | | tempCommonOrder.setPayment(commonOrder.getPayment());
|
| | | notificationMap.put(type, new HongBaoOrder(tempCommonOrder, tempHongBao));
|
| | | } else {
|
| | | // 增加付款金额与资金
|
| | | HongBaoOrder tempHongBaoOrder = notificationMap.get(type);
|
| | | tempHongBaoOrder.getCommonOrder()
|
| | | .setPayment(tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
|
| | | tempHongBaoOrder.getHongBaoV2()
|
| | | .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(firstHongbao.getMoney()));
|
| | | notificationMap.put(type, tempHongBaoOrder);
|
| | | }
|
| | |
|
| | | // 插入二级子红包
|
| | |
| | | hongBaoV2Mapper.insertSelective(secondHongbao);
|
| | |
|
| | | // 用户通知
|
| | | if (notificationMap.get(HongBaoV2.TYPE_ERJI) == null)
|
| | | notificationMap.put(HongBaoV2.TYPE_ERJI, secondHongbao);
|
| | | else {
|
| | | notificationMap.get(HongBaoV2.TYPE_ERJI).setMoney(
|
| | | notificationMap.get(HongBaoV2.TYPE_ERJI).getMoney().add(secondHongbao.getMoney()));
|
| | | if (notificationMap.get(type) == null) {
|
| | | HongBaoV2 tempHongBao = new HongBaoV2(secondHongbao.getId());
|
| | | tempHongBao.setUserInfo(secondHongbao.getUserInfo());
|
| | | tempHongBao.setMoney(secondHongbao.getMoney());
|
| | | CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
|
| | | tempCommonOrder.setPayment(commonOrder.getPayment());
|
| | | notificationMap.put(type, new HongBaoOrder(tempCommonOrder, tempHongBao));
|
| | | } else {
|
| | | // 增加付款金额与资金
|
| | | HongBaoOrder tempHongBaoOrder = notificationMap.get(type);
|
| | | tempHongBaoOrder.getCommonOrder().setPayment(
|
| | | tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
|
| | | tempHongBaoOrder.getHongBaoV2()
|
| | | .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(secondHongbao.getMoney()));
|
| | | notificationMap.put(type, tempHongBaoOrder);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | hongBaoOrder.setHongBaoV2(hongBao);
|
| | | hongBaoOrderMapper.insertSelective(hongBaoOrder);
|
| | |
|
| | | if (notificationMap.get(type) == null)
|
| | | notificationMap.put(type, hongBao);
|
| | | else {
|
| | | notificationMap.get(type).setMoney(notificationMap.get(type).getMoney().add(hongBao.getMoney()));
|
| | | if (notificationMap.get(type) == null) {
|
| | | HongBaoV2 tempHongBao = new HongBaoV2(hongBao.getId());
|
| | | tempHongBao.setUserInfo(hongBao.getUserInfo());
|
| | | tempHongBao.setMoney(hongBao.getMoney());
|
| | | CommonOrder tempCommonOrder = new CommonOrder(commonOrder.getId());
|
| | | tempCommonOrder.setPayment(commonOrder.getPayment());
|
| | | notificationMap.put(type, new HongBaoOrder(tempCommonOrder, tempHongBao));
|
| | | } else {
|
| | | // 增加付款金额与资金
|
| | | HongBaoOrder tempHongBaoOrder = notificationMap.get(type);
|
| | | tempHongBaoOrder.getCommonOrder()
|
| | | .setPayment(tempHongBaoOrder.getCommonOrder().getPayment().add(commonOrder.getPayment()));
|
| | | tempHongBaoOrder.getHongBaoV2()
|
| | | .setMoney(tempHongBaoOrder.getHongBaoV2().getMoney().add(hongBao.getMoney()));
|
| | | notificationMap.put(type, tempHongBaoOrder);
|
| | | }
|
| | |
|
| | | // 修改统计数据
|
| | |
| | | import com.yeshi.fanli.service.inter.config.InviteGetMoneyService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.msg.UserInviteMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private ThreeSaleMapper threeSaleMapper;
|
| | | |
| | | @Resource
|
| | | private UserInviteMsgNotificationService userInviteMsgNotificationService;
|
| | |
|
| | | public UserInfo getBoss(final long uid) {
|
| | | return (UserInfo) dao.excute(new HibernateCallback<UserInfo>() {
|
| | |
| | | threeSale.setUpdateTime(java.lang.System.currentTimeMillis());
|
| | | threeSale.setWorker(inviteeUser);
|
| | | threeSaleMapper.insertSelective(threeSale);
|
| | | |
| | | //创建通知
|
| | | userInviteMsgNotificationService.inviteScan(inviter.getId(), threeSale);
|
| | | |
| | | |
| | | } else {// 是已经存在的用户
|
| | |
|
| | | // 用户已经存在我们的用户库中
|
| | |
| | | threeSale.setUpdateTime(java.lang.System.currentTimeMillis());
|
| | | threeSale.setWorker(invitee);
|
| | | threeSaleMapper.insertSelective(threeSale);
|
| | |
|
| | | userInviteMsgNotificationService.inviteScan(inviter.getId(), threeSale);
|
| | | // threeSaleSerivce.bind(invitee, inviter);
|
| | |
|
| | | } else {
|
| | |
| | | dao.update(threeSale);
|
| | | if (inviter != null)
|
| | | reComputeUserRank(inviter.getId());
|
| | | //通知
|
| | | userInviteMsgNotificationService.inviteSuccess(inviter.getId(), threeSale);
|
| | | // }
|
| | | // });
|
| | | }
|
| | |
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.msg.MsgOrderDetailMapper;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.exception.msg.MsgOrderDetailException;
|
| | | import com.yeshi.fanli.service.inter.msg.MsgOrderDetailService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | | update.setBeiZhu(detail.getBeiZhu());
|
| | | msgOrderDetailMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | msgOrderDetailMapper.setMsgReadByUid(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void updateMsgOrderDetail(MsgOrderDetail detail) throws MsgOrderDetailException {
|
| | | if (detail == null)
|
| | | throw new MsgOrderDetailException(1, "消息为空");
|
| | | if (detail.getOrderId() == null || detail.getState() == null || detail.getUser() == null)
|
| | | throw new MsgOrderDetailException(2, "消息不完整");
|
| | |
|
| | | MsgOrderDetail msg = msgOrderDetailMapper.selectByUidAndOrderId(detail.getUser().getId(), detail.getOrderId());
|
| | | if (msg == null)
|
| | | return;
|
| | |
|
| | | if (msg.getState() == CommonOrder.STATE_WQ)
|
| | | return;
|
| | |
|
| | | MsgOrderDetail update = new MsgOrderDetail();
|
| | | update.setId(detail.getId());
|
| | | update.setHongBaoMoney(detail.getHongBaoMoney());
|
| | | update.setPayMoney(detail.getPayMoney());
|
| | | if (detail.getState().intValue() != msg.getState()) {
|
| | | update.setState(detail.getState());
|
| | | update.setUpdateTime(new Date());
|
| | | }
|
| | | msgOrderDetailMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<MsgOrderDetail> listMsgOrderByOrderId(String orderId) {
|
| | | return msgOrderDetailMapper.listByOrderId(orderId);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.msg;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgAccountDetail;
|
| | | import com.yeshi.fanli.exception.msg.MsgAccountDetailException;
|
| | | import com.yeshi.fanli.service.inter.msg.MsgAccountDetailService;
|
| | | import com.yeshi.fanli.service.inter.msg.UserAccountMsgNotificationService;
|
| | | import com.yeshi.fanli.util.factory.msg.MsgAccountDetailFactory;
|
| | |
|
| | | @Service
|
| | | public class UserAccountMsgNotificationServiceImpl implements UserAccountMsgNotificationService {
|
| | |
|
| | | @Resource
|
| | | private MsgAccountDetailService msgAccountDetailService;
|
| | |
|
| | | @Override
|
| | | public void bindingSuccess(Long uid, int type) {
|
| | | MsgAccountDetail detail = MsgAccountDetailFactory.createBindingAccount(uid, type);
|
| | | try {
|
| | | msgAccountDetailService.addMsgAccountDetail(detail);
|
| | | } catch (MsgAccountDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void unBindingSuccess(Long uid, int type) {
|
| | | MsgAccountDetail detail = MsgAccountDetailFactory.createUnBindingAccount(uid, type);
|
| | | try {
|
| | | msgAccountDetailService.addMsgAccountDetail(detail);
|
| | | } catch (MsgAccountDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void changeBindingSuccess(Long uid, int type) {
|
| | | MsgAccountDetail detail = MsgAccountDetailFactory.createChangeBindingAccount(uid, type);
|
| | | try {
|
| | | msgAccountDetailService.addMsgAccountDetail(detail);
|
| | | } catch (MsgAccountDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void connectSuccess(Long uid, Long lessUid) {
|
| | | MsgAccountDetail detail = MsgAccountDetailFactory.createConnectAccount(uid, lessUid);
|
| | | try {
|
| | | msgAccountDetailService.addMsgAccountDetail(detail);
|
| | | } catch (MsgAccountDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void userRank(Long uid, String orderType, int orderCount, String rankName) {
|
| | | MsgAccountDetail detail = MsgAccountDetailFactory.createUserRank(uid, orderType, orderCount, rankName);
|
| | | try {
|
| | | msgAccountDetailService.addMsgAccountDetail(detail);
|
| | | } catch (MsgAccountDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.msg;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | | import com.yeshi.fanli.service.inter.msg.UserInviteMsgNotificationService;
|
| | |
|
| | | @Service
|
| | | public class UserInviteMsgNotificationServiceImpl implements UserInviteMsgNotificationService{
|
| | |
|
| | | @Override
|
| | | public void inviteScan(Long uid, ThreeSale sale) {
|
| | | // TODO Auto-generated method stub
|
| | | |
| | | }
|
| | |
|
| | | @Override
|
| | | public void inviteSuccess(Long uid, ThreeSale sale) {
|
| | | // TODO Auto-generated method stub
|
| | | |
| | | }
|
| | |
|
| | | @Override
|
| | | public void inviteFail(Long uid, ThreeSale sale) {
|
| | | // TODO Auto-generated method stub
|
| | | |
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.msg;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail;
|
| | | import com.yeshi.fanli.entity.bus.user.AlipayAccountValidNormalHistory;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.exception.msg.MsgMoneyDetailException;
|
| | | import com.yeshi.fanli.service.inter.msg.MsgMoneyDetailService;
|
| | | import com.yeshi.fanli.service.inter.msg.UserMoneyMsgNotificationService;
|
| | | import com.yeshi.fanli.util.factory.msg.MsgMoneyDetailFactory;
|
| | |
|
| | | @Service
|
| | | public class UserMoneyMsgNotificationServiceImpl implements UserMoneyMsgNotificationService {
|
| | |
|
| | | @Resource
|
| | | private MsgMoneyDetailService msgMoneyDetailService;
|
| | |
|
| | | @Override
|
| | | public void extractApplay(Extract extract) {
|
| | | MsgMoneyDetail detail = MsgMoneyDetailFactory.createExtractApplyMsg(extract, extract.getUserInfo().getId(),
|
| | | null);
|
| | | try {
|
| | | msgMoneyDetailService.addMsgMoneyDetail(detail);
|
| | | } catch (MsgMoneyDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void extractFail(Extract extract, String stateDesc) {
|
| | | MsgMoneyDetail detail = MsgMoneyDetailFactory.createExtractFailMsg(extract, extract.getUserInfo().getId(),
|
| | | stateDesc);
|
| | | try {
|
| | | msgMoneyDetailService.addMsgMoneyDetail(detail);
|
| | | } catch (MsgMoneyDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void extractSuccess(Extract extract) {
|
| | | MsgMoneyDetail detail = MsgMoneyDetailFactory.createExtractSuccessMsg(extract, extract.getUserInfo().getId(),
|
| | | null);
|
| | | try {
|
| | | msgMoneyDetailService.addMsgMoneyDetail(detail);
|
| | | } catch (MsgMoneyDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void alipayAccountValid(AlipayAccountValidNormalHistory history) {
|
| | | MsgMoneyDetail detail = MsgMoneyDetailFactory.createAlipayAccountValidMsg(history, history.getUid(),
|
| | | "重庆椰视网络有限公司", new BigDecimal("0.1"), null);
|
| | | try {
|
| | | msgMoneyDetailService.addMsgMoneyDetail(detail);
|
| | | } catch (MsgMoneyDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void fanliOrderReceived(Long uid, String orderId, int goodsCount, BigDecimal money, BigDecimal balance) {
|
| | | MsgMoneyDetail detail = MsgMoneyDetailFactory.createFailiMsg(money, balance, orderId, goodsCount, uid, null);
|
| | | try {
|
| | | msgMoneyDetailService.addMsgMoneyDetail(detail);
|
| | | } catch (MsgMoneyDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void fanliOrderWeiQuan(Long uid, String orderId, BigDecimal money, BigDecimal balance) {
|
| | | MsgMoneyDetail detail = MsgMoneyDetailFactory.createFailiWeiQuanMsg(uid, orderId, money, balance, null);
|
| | | try {
|
| | | msgMoneyDetailService.addMsgMoneyDetail(detail);
|
| | | } catch (MsgMoneyDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void shareOrderReceived(Long uid, int orderCount, int goodsCount, BigDecimal money, BigDecimal balance) {
|
| | | MsgMoneyDetail detail = MsgMoneyDetailFactory.createShareMsg(money, balance, orderCount, goodsCount, uid, null);
|
| | | try {
|
| | | msgMoneyDetailService.addMsgMoneyDetail(detail);
|
| | | } catch (MsgMoneyDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void shareOrderWeiQuan(Long uid, String orderId, BigDecimal money, BigDecimal balance) {
|
| | | MsgMoneyDetail detail = MsgMoneyDetailFactory.createShareWeiQuanMsg(uid, orderId, money, balance, null);
|
| | | try {
|
| | | msgMoneyDetailService.addMsgMoneyDetail(detail);
|
| | | } catch (MsgMoneyDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void inviteOrderReceived(Long uid, int orderCount, int goodsCount, BigDecimal money, BigDecimal balance) {
|
| | | MsgMoneyDetail detail = MsgMoneyDetailFactory.createInviteMsg(money, balance, orderCount, goodsCount, uid,
|
| | | null);
|
| | | try {
|
| | | msgMoneyDetailService.addMsgMoneyDetail(detail);
|
| | | } catch (MsgMoneyDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void inviteOrderWeiQuan(Long uid, String orderId, BigDecimal money, BigDecimal balance) {
|
| | | MsgMoneyDetail detail = MsgMoneyDetailFactory.createInviteWeiQuanMsg(uid, orderId, money, balance, null);
|
| | | try {
|
| | | msgMoneyDetailService.addMsgMoneyDetail(detail);
|
| | | } catch (MsgMoneyDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | @Override
|
| | | public void addOrderMsgUnReadCount(Long uid, int count) {
|
| | | getUserMsgUnReadNum(uid);
|
| | | UserMsgUnReadNum num = getUserMsgUnReadNum(uid);
|
| | | UserMsgUnReadNum update = new UserMsgUnReadNum();
|
| | | update.setId(num.getId());
|
| | | update.setTypeOrder(num.getTypeOrder() + count);
|
| | | update.setUpdateTime(new Date());
|
| | | userMsgUnReadNumMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void addAccountMsgUnReadCount(Long uid, int count) {
|
| | | getUserMsgUnReadNum(uid);
|
| | | UserMsgUnReadNum num = getUserMsgUnReadNum(uid);
|
| | | UserMsgUnReadNum update = new UserMsgUnReadNum();
|
| | | update.setId(num.getId());
|
| | | update.setTypeAccount(num.getTypeAccount() + count);
|
| | | update.setUpdateTime(new Date());
|
| | | userMsgUnReadNumMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void addMoneyMsgUnReadCount(Long uid, int count) {
|
| | | getUserMsgUnReadNum(uid);
|
| | | UserMsgUnReadNum num = getUserMsgUnReadNum(uid);
|
| | | UserMsgUnReadNum update = new UserMsgUnReadNum();
|
| | | update.setId(num.getId());
|
| | | update.setTypeMoney(num.getTypeMoney() + count);
|
| | | update.setUpdateTime(new Date());
|
| | | userMsgUnReadNumMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void addInviteMsgUnReadCount(Long uid, int count) {
|
| | | getUserMsgUnReadNum(uid);
|
| | | UserMsgUnReadNum num = getUserMsgUnReadNum(uid);
|
| | | UserMsgUnReadNum update = new UserMsgUnReadNum();
|
| | | update.setId(num.getId());
|
| | | update.setTypeInvite(num.getTypeInvite() + count);
|
| | | update.setUpdateTime(new Date());
|
| | | userMsgUnReadNumMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void addSystemMsgUnReadCount(Long uid, int count) {
|
| | | getUserMsgUnReadNum(uid);
|
| | | UserMsgUnReadNum num = getUserMsgUnReadNum(uid);
|
| | | UserMsgUnReadNum update = new UserMsgUnReadNum();
|
| | | update.setId(num.getId());
|
| | | update.setTypeSystem(num.getTypeSystem() + count);
|
| | | update.setUpdateTime(new Date());
|
| | | userMsgUnReadNumMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | @Override
|
| | | public void readOrderMsg(Long uid) {
|
| | | msgOrderDetailService.readMsgByUid(uid);
|
| | | UserMsgUnReadNum num = getUserMsgUnReadNum(uid);
|
| | | UserMsgUnReadNum update = new UserMsgUnReadNum();
|
| | | update.setId(num.getId());
|
| | | update.setTypeOrder(0);
|
| | | update.setUpdateTime(new Date());
|
| | | userMsgUnReadNumMapper.updateByPrimaryKeySelective(update);
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void readAccountMsg(Long uid) {
|
| | | msgAccountDetailService.readMsgByUid(uid);
|
| | | UserMsgUnReadNum num = getUserMsgUnReadNum(uid);
|
| | | UserMsgUnReadNum update = new UserMsgUnReadNum();
|
| | | update.setId(num.getId());
|
| | | update.setTypeAccount(0);
|
| | | update.setUpdateTime(new Date());
|
| | | userMsgUnReadNumMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void readMoneyMsg(Long uid) {
|
| | | msgMoneyDetailService.readMsgByUid(uid);
|
| | | UserMsgUnReadNum num = getUserMsgUnReadNum(uid);
|
| | | UserMsgUnReadNum update = new UserMsgUnReadNum();
|
| | | update.setId(num.getId());
|
| | | update.setTypeMoney(0);
|
| | | update.setUpdateTime(new Date());
|
| | | userMsgUnReadNumMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void readInviteMsg(Long uid) {
|
| | | msgInviteDetailService.readMsgByUid(uid);
|
| | | UserMsgUnReadNum num = getUserMsgUnReadNum(uid);
|
| | | UserMsgUnReadNum update = new UserMsgUnReadNum();
|
| | | update.setId(num.getId());
|
| | | update.setTypeInvite(0);
|
| | | update.setUpdateTime(new Date());
|
| | | userMsgUnReadNumMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void readUserSystemMsg(Long uid) {
|
| | | userSystemMsgService.readMsgByUid(uid);
|
| | |
|
| | | UserMsgUnReadNum num = getUserMsgUnReadNum(uid);
|
| | | UserMsgUnReadNum update = new UserMsgUnReadNum();
|
| | | update.setId(num.getId());
|
| | | update.setTypeSystem(0);
|
| | | update.setUpdateTime(new Date());
|
| | | userMsgUnReadNumMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | |
|
| | | @Transactional
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.msg;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail;
|
| | | import com.yeshi.fanli.exception.msg.MsgOrderDetailException;
|
| | | import com.yeshi.fanli.service.inter.msg.MsgOrderDetailService;
|
| | | import com.yeshi.fanli.service.inter.msg.UserOrderMsgNotificationService;
|
| | | import com.yeshi.fanli.util.factory.msg.MsgOrderDetailFactory;
|
| | |
|
| | | @Service
|
| | | public class UserOrderMsgNotificationServiceImpl implements UserOrderMsgNotificationService {
|
| | |
|
| | | @Resource
|
| | | private MsgOrderDetailService msgOrderDetailService;
|
| | |
|
| | | @Override
|
| | | public void orderFanLiStatistic(Long uid, String orderId, BigDecimal payMoney, BigDecimal money, int goodsCount,
|
| | | int orderState) {
|
| | | MsgOrderDetail detail = MsgOrderDetailFactory.createFanLiOrder(uid, orderId, goodsCount, orderState, payMoney,
|
| | | money, null);
|
| | | try {
|
| | | msgOrderDetailService.addMsgOrderDetail(detail);
|
| | | } catch (MsgOrderDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void orderFanLiStateChanged(Long uid, String orderId, BigDecimal payMoney, BigDecimal money,
|
| | | int orderState) {
|
| | | MsgOrderDetail detail = MsgOrderDetailFactory.createFanLiOrder(uid, orderId, 0, orderState, payMoney, money,
|
| | | null);
|
| | | try {
|
| | | msgOrderDetailService.updateMsgOrderDetail(detail);
|
| | | } catch (MsgOrderDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void orderShareStatistic(Long uid, String orderId, BigDecimal payMoney, BigDecimal money, int goodsCount,
|
| | | int orderState) {
|
| | | MsgOrderDetail detail = MsgOrderDetailFactory.createShareOrder(uid, orderId, goodsCount, orderState, payMoney,
|
| | | money, null);
|
| | | try {
|
| | | msgOrderDetailService.addMsgOrderDetail(detail);
|
| | | } catch (MsgOrderDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void orderShareStateChanged(Long uid, String orderId, BigDecimal payMoney, BigDecimal money,
|
| | | int orderState) {
|
| | | MsgOrderDetail detail = MsgOrderDetailFactory.createShareOrder(uid, orderId, 0, orderState, payMoney, money,
|
| | | null);
|
| | | try {
|
| | | msgOrderDetailService.updateMsgOrderDetail(detail);
|
| | | } catch (MsgOrderDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void orderInviteStatistic(Long uid, String orderId, BigDecimal payMoney, BigDecimal money, int goodsCount,
|
| | | int orderState) {
|
| | | MsgOrderDetail detail = MsgOrderDetailFactory.createInviteOrder(uid, orderId, goodsCount, orderState, payMoney,
|
| | | money, null);
|
| | | try {
|
| | | msgOrderDetailService.addMsgOrderDetail(detail);
|
| | | } catch (MsgOrderDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void orderInviteStateChanged(Long uid, String orderId, BigDecimal payMoney, BigDecimal money,
|
| | | int orderState) {
|
| | | MsgOrderDetail detail = MsgOrderDetailFactory.createInviteOrder(uid, orderId, 0, orderState, payMoney, money,
|
| | | null);
|
| | | try {
|
| | | msgOrderDetailService.updateMsgOrderDetail(detail);
|
| | | } catch (MsgOrderDetailException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanOrderMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountDetails;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoExtra;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.MoneyRecord;
|
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | | import com.yeshi.fanli.entity.bus.user.OrderItem;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoUnionConfig;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaobaoOrderHongBao;
|
| | | import com.yeshi.fanli.exception.HongBaoException;
|
| | | import com.yeshi.fanli.exception.ObjectStateException;
|
| | | import com.yeshi.fanli.exception.OrderItemException;
|
| | |
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.msg.UserMoneyMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.LostOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderItemServcie;
|
| | |
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoWeiQuanDrawBackService;
|
| | | import com.yeshi.fanli.service.inter.user.UserNotificationService;
|
| | | import com.yeshi.fanli.util.CMQManager;
|
| | | import com.yeshi.fanli.util.HongBaoUtil;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private HongBaoV2Mapper hongBaoV2Mapper;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
|
| | |
|
| | | @Override
|
| | | public void processOrder(Map<String, List<TaoBaoOrder>> orders) {
|
| | |
| | | return validCount >= list.size();
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public void processShopingFanliOrder(String orderId, List<TaoBaoOrder> orderList)
|
| | | throws HongBaoException, OrderItemException {
|
| | |
|
| | | List<TaoBaoUnionConfig> configList = taoBaoUnionConfigService.getConfigByTypeCache(PidUser.TYPE_FANLI_ANDROID);
|
| | |
|
| | | Order oldOrder = orderMapper.selectOrderByOrderId(orderId);
|
| | | // 原来不存在订单
|
| | | if (oldOrder == null && orderList.size() > 0) {
|
| | | // 获取产生订单的PID
|
| | | String mediaId = orderList.get(0).getSourceMediaId();
|
| | | String adzoneId = orderList.get(0).getAdPositionId();
|
| | | String pid = String.format("mm_%s_%s_%s", configList.get(0).getAccountId(), mediaId, adzoneId);
|
| | | // 查询该PID是否有对应的用户
|
| | | PidUser pidUser = pidUserMapper.selectByPid(pid);
|
| | | // 判断是否属于返利的PID
|
| | | if (pidUser != null && (pidUser.getType() == PidUser.TYPE_FANLI_ANDROID
|
| | | || pidUser.getType() == PidUser.TYPE_FANLI_IOS)) {
|
| | | // 如果是订单失效就不处理
|
| | | // 2018-08-02开始生效
|
| | | if (isOrderValid(orderList))
|
| | | if (TimeUtil.convertToTimeTemp(orderList.get(0).getCreateTime(), "yyyy-MM-dd HH:mm:ss") < TimeUtil
|
| | | .convertToTimeTemp("2018-08-02", "yyyy-MM-dd"))
|
| | | return;
|
| | |
|
| | | // 添加到订单中去
|
| | | Order order = new Order();
|
| | | order.setBeizhu("PID返利订单");
|
| | | order.setCreatetime(System.currentTimeMillis());
|
| | | order.setOrderId(orderId);
|
| | | order.setOrderType(1);
|
| | | order.setState(Order.STATE_YIZHIFU);
|
| | | order.setUserInfo(new UserInfo(pidUser.getUid()));
|
| | | order.setVersion(2);
|
| | |
|
| | | // 加入到订单表
|
| | | orderMapper.insertSelective(order);
|
| | | oldOrder = order;
|
| | | }
|
| | | }
|
| | |
|
| | | if (oldOrder != null) {// 该订单号可以返利
|
| | | // 原来失效的订单不再处理
|
| | | // if (oldOrder.getState() == Order.STATE_SHIXIAO)
|
| | | // return;
|
| | | // 更新订单的状态
|
| | | Order updateOrder = new Order();
|
| | | updateOrder.setId(oldOrder.getId());
|
| | | updateOrder.setThirdCreateTime(
|
| | | new Date(TimeUtil.convertToTimeTemp(orderList.get(0).getCreateTime(), "yyyy-MM-dd HH:mm:ss")));
|
| | |
|
| | | if (isOrderValid(orderList)) {
|
| | | // 处理订单失效
|
| | | updateOrder.setState(Order.STATE_SHIXIAO);
|
| | | if (oldOrder.getState() == Order.STATE_YIZHIFU)
|
| | | updateOrder.setDrawbackTime(System.currentTimeMillis());
|
| | | updateOrder.setThirdState("订单失效");
|
| | | } else// 计算订单的总金额
|
| | | {
|
| | | BigDecimal money = new BigDecimal(0);
|
| | | for (TaoBaoOrder o : orderList) {
|
| | | if (o.getOrderState().equalsIgnoreCase("订单结算"))
|
| | | money = money.add(o.getSettlement());
|
| | | else {
|
| | | money = money.add(o.getPayment());
|
| | | }
|
| | | }
|
| | | updateOrder.setMoney(money);
|
| | | String thirdState = null;
|
| | | for (TaoBaoOrder o : orderList)
|
| | | if (!o.getOrderState().equalsIgnoreCase("订单失效")) {
|
| | | thirdState = o.getOrderState();
|
| | | break;
|
| | | }
|
| | | updateOrder.setThirdState(thirdState);
|
| | | }
|
| | | orderMapper.updateByPrimaryKeySelective(updateOrder);
|
| | | Order order = oldOrder;
|
| | | // 订单返利比例
|
| | | BigDecimal rate = hongBaoManageService.getFanLiRate();
|
| | |
|
| | | // 查找是否存在红包
|
| | | List<HongBao> hongBaoList = hongBaoMapper.selectByOid(order.getId());
|
| | | // 还没有加入有效的订单
|
| | | if ((hongBaoList == null || hongBaoList.size() == 0)) {
|
| | | for (TaoBaoOrder taoBaoOrder : orderList) {
|
| | | // 创建OrderItem;
|
| | | OrderItem orderItem = orderItemService.addOrderItem(taoBaoOrder, order, rate);
|
| | | hongBaoService.addHongBao(order, taoBaoOrder, orderItem.getId());
|
| | | }
|
| | | } else if (hongBaoList.size() > 0)// 原来已经存在订单了
|
| | | {
|
| | | List<TaobaoOrderHongBao> sortList = HongBaoUtil.sortHongBaoAndTaoBaoOrder(orderList, hongBaoList);
|
| | | orderList = new ArrayList<>();
|
| | | hongBaoList = new ArrayList<>();
|
| | | if (sortList != null)
|
| | | for (TaobaoOrderHongBao tb : sortList) {
|
| | | orderList.add(tb.taoBaoOrder);
|
| | | hongBaoList.add(tb.hongBao);
|
| | | }
|
| | |
|
| | | if (orderList.size() != hongBaoList.size()) {
|
| | | LogHelper.userOrder("红包数和订单数不对等:" + orderId);
|
| | | return;
|
| | | }
|
| | |
|
| | | for (int i = 0; i < orderList.size(); i++) {
|
| | | hongBaoService.updateHongBao(hongBaoList.get(i), orderList.get(i));
|
| | | orderItemService.updateOrderItem(orderList.get(i), hongBaoList.get(i).getOrderItemId(), rate);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public void fanli(HongBao hb) throws TaoBaoWeiQuanException {
|
| | | // 查询最新的红包数据
|
| | | hb = hongBaoMapper.selectByPrimaryKeyForUpdate(hb.getId());
|
| | | // 维权中的不返利
|
| | | List<TaoBaoWeiQuanOrder> taoBaoWeiQuanList = taoBaoWeiQuanOrderMapper
|
| | | .selectListByOrderIdAndState(hb.getOrderId(), "维权创建");
|
| | | if (taoBaoWeiQuanList != null && taoBaoWeiQuanList.size() > 0)
|
| | | return;
|
| | |
|
| | | taoBaoWeiQuanList = taoBaoWeiQuanOrderMapper.selectListByOrderIdAndState(hb.getOrderId(), "等待处理");
|
| | | if (taoBaoWeiQuanList != null && taoBaoWeiQuanList.size() > 0)
|
| | | return;
|
| | |
|
| | | long currentTimeMillis = System.currentTimeMillis();
|
| | | if (hb.getState() != HongBao.STATE_SHIXIAO) {
|
| | | // 设置为已返利
|
| | | // 处理主红包
|
| | | if (hb.getState() != HongBao.STATE_SHIXIAO && hb.getState() != HongBao.STATE_YILINGQU
|
| | | && hb.getType() == HongBao.TYPE_TAOBAO) {
|
| | | OrderItem orderItem = null;
|
| | | if (hb.getOrderItemId() != null) {
|
| | | orderItem = orderItemMapper.selectByPrimaryKey(hb.getOrderItemId());
|
| | | OrderItem updateOrderItem = new OrderItem();
|
| | | updateOrderItem.setId(orderItem.getId());
|
| | | updateOrderItem.setFanTime(currentTimeMillis);
|
| | | updateOrderItem.setState(OrderItem.STATE_DAOZHANG);
|
| | | orderItemMapper.updateByPrimaryKeySelective(updateOrderItem);
|
| | | }
|
| | | // 如果红包没被领取
|
| | | HongBao updateHongBao = new HongBao();
|
| | | updateHongBao.setId(hb.getId());
|
| | | updateHongBao.setState(HongBao.STATE_YILINGQU);
|
| | | updateHongBao.setGetTime(currentTimeMillis);
|
| | | hongBaoMapper.updateByPrimaryKeySelective(updateHongBao);
|
| | | userInfoMapper.addHongBaoByUid(hb.getUserInfo().getId(), hb.getMoney());
|
| | |
|
| | | // ...消息、明细
|
| | | HongBaoExtra hongBaoExtra = HongBaoUtil.convert(hb);
|
| | | // 明细操作(如果服务器性好了后,可改成异步)
|
| | | MoneyRecord moneyRecord = new MoneyRecord(hb.getUserInfo(), hb, hb.getMoney(), hongBaoExtra.getTitle(),
|
| | | "", currentTimeMillis, 1);
|
| | | moneyRecordMapper.insertSelective(moneyRecord);
|
| | | AccountDetails accountDetails = AccountDetailsFactory.create("+" + hb.getMoney(),
|
| | | AccountDetailsFactory.FANLI, orderItem, null, hb.getUserInfo());
|
| | | accountDetailsMapper.insertSelective(accountDetails);
|
| | |
|
| | | // 插入新版资金明细
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createFanLi(hb.getUserInfo().getId(),
|
| | | hb.getOrderId(), 1, hb.getId(), hb.getMoney());
|
| | | userMoneyDetail.setId(accountDetails.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e1) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e1);
|
| | | } catch (Exception e2) {
|
| | | e2.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | // 添加资金明细与红包的映射关系
|
| | | accountDetailsHongBaoMapService.saveAccountDetailsHongBaoMap(hb.getId(), accountDetails.getId());
|
| | |
|
| | | // 维权扣款(2018-08-05后开始实行)
|
| | | if (hb.getBalanceTime() != null
|
| | | && hb.getBalanceTime().getTime() >= TimeUtil.convertToTimeTemp("2018-08-05", "yyyy-MM-dd")) {
|
| | | taoBaoWeiQuanDrawBackService.doWeiQuanFanli(hb.getOrderId());
|
| | | }
|
| | |
|
| | | // 站内信+推送
|
| | | try {
|
| | | userNotificationService.orderFanliRecieved(hb.getUserInfo().getId(), orderItem.getOrderId(),
|
| | | orderItem.getFanMoney());
|
| | | } catch (Exception e) {
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Resource
|
| | | private HongBaoOrderMapper hongBaoOrderMapper;
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public void fanli(HongBaoV2 hb) throws TaoBaoWeiQuanException {
|
| | | public void fanli(HongBaoV2 hb1) throws TaoBaoWeiQuanException {
|
| | | // 查询最新的红包数据
|
| | | hb = hongBaoV2Mapper.selectByPrimaryKeyForUpdate(hb.getId());
|
| | | hb1 = hongBaoV2Mapper.selectByPrimaryKeyForUpdate(hb1.getId());
|
| | | // 查询红包相关联的订单
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByHongBaoId(hb.getId());
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByHongBaoId(hb1.getId());
|
| | | if (hongBaoOrder == null) {
|
| | | LogHelper.error("返利失败:" + hb.getId());
|
| | | LogHelper.error("返利失败:" + hb1.getId());
|
| | | return;
|
| | | }
|
| | | // 维权中的不返利
|
| | |
| | | if (taoBaoWeiQuanList != null && taoBaoWeiQuanList.size() > 0)
|
| | | return;
|
| | |
|
| | | long currentTimeMillis = System.currentTimeMillis();
|
| | | if (hb.getState() != HongBao.STATE_SHIXIAO) {
|
| | | // 设置为已返利
|
| | | // 处理主红包
|
| | | if (hb.getState() != HongBaoV2.STATE_SHIXIAO && hb.getState() != HongBaoV2.STATE_YILINGQU
|
| | | && hb.getType() == HongBaoV2.TYPE_ZIGOU) {
|
| | | // 如果红包没被领取
|
| | | HongBaoV2 updateHongBao = new HongBaoV2();
|
| | | updateHongBao.setId(hb.getId());
|
| | | updateHongBao.setState(HongBaoV2.STATE_YILINGQU);
|
| | | updateHongBao.setGetTime(new Date(currentTimeMillis));
|
| | | hongBaoV2Mapper.updateByPrimaryKeySelective(updateHongBao);
|
| | | userInfoMapper.addHongBaoByUid(hb.getUserInfo().getId(), hb.getMoney());
|
| | | // 查询同一订单号的红包
|
| | | List<CommonOrder> orderList = commonOrderService.listBySourceTypeAndOrderId(
|
| | | hongBaoOrder.getCommonOrder().getSourceType(), hongBaoOrder.getCommonOrder().getOrderNo());
|
| | | List<HongBaoV2> hongBaoList = new ArrayList<>();
|
| | | Map<Long, BigDecimal> userMoney = new HashMap<>();
|
| | | Map<Long, List<HongBaoV2>> userHongBao = new HashMap<>();
|
| | | Map<Long, Integer> userGoodsCount = new HashMap<>();
|
| | | // Map<Long, BigDecimal> userPayMent = new HashMap<>();
|
| | | for (CommonOrder co : orderList) {
|
| | | hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(co.getId());
|
| | | hongBaoList.add(hongBaoOrder.getHongBaoV2());
|
| | | Long uid = co.getUserInfo().getId();
|
| | | if (userGoodsCount.get(uid) == null)
|
| | | userGoodsCount.put(uid, co.getCount());
|
| | | else
|
| | | userGoodsCount.put(uid, Integer.valueOf(co.getCount() + userGoodsCount.get(uid)));
|
| | | // if (userPayMent.get(uid) == null)
|
| | | // userPayMent.put(uid, new BigDecimal(0));
|
| | | // if (co.getState() == CommonOrder.STATE_JS)
|
| | | // userPayMent.put(uid,
|
| | | // userPayMent.get(uid).add(co.getSettlement()));
|
| | | // else
|
| | | // userPayMent.put(uid, userPayMent.get(uid).add(co.getPayment()));
|
| | | }
|
| | |
|
| | | AccountDetails accountDetails = AccountDetailsFactory.create("+" + hb.getMoney(),
|
| | | AccountDetailsFactory.FANLI, null, null, hb.getUserInfo());
|
| | | accountDetailsMapper.insertSelective(accountDetails);
|
| | | for (HongBaoV2 hb : hongBaoList) {
|
| | | long currentTimeMillis = System.currentTimeMillis();
|
| | | if (hb.getState() != HongBao.STATE_SHIXIAO) {
|
| | | // 设置为已返利
|
| | | // 处理主红包
|
| | | if (hb.getState() != HongBaoV2.STATE_SHIXIAO && hb.getState() != HongBaoV2.STATE_YILINGQU
|
| | | && hb.getType() == HongBaoV2.TYPE_ZIGOU) {
|
| | | // 如果红包没被领取
|
| | | Long uid = hb.getUserInfo().getId();
|
| | | HongBaoV2 updateHongBao = new HongBaoV2();
|
| | | updateHongBao.setId(hb.getId());
|
| | | updateHongBao.setState(HongBaoV2.STATE_YILINGQU);
|
| | | updateHongBao.setGetTime(new Date(currentTimeMillis));
|
| | | hongBaoV2Mapper.updateByPrimaryKeySelective(updateHongBao);
|
| | | if (userMoney.get(uid) == null)
|
| | | userMoney.put(uid, hb.getMoney());
|
| | | else
|
| | | userMoney.put(uid, userMoney.get(uid).add(hb.getMoney()));
|
| | |
|
| | | // 插入新版资金明细
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createFanLi(hb.getUserInfo().getId(),
|
| | | hongBaoOrder.getCommonOrder().getOrderNo(), hongBaoOrder.getCommonOrder().getSourceType(),
|
| | | hb.getId(), hb.getMoney());
|
| | | userMoneyDetail.setId(accountDetails.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e1) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e1);
|
| | | } catch (Exception e2) {
|
| | | e2.printStackTrace();
|
| | | }
|
| | | // 添加红包到用户
|
| | | if (userHongBao.get(uid) == null)
|
| | | userHongBao.put(uid, new ArrayList<>());
|
| | | userHongBao.get(uid).add(hb);
|
| | | }
|
| | |
|
| | | // 添加资金明细与红包的映射关系
|
| | | accountDetailsHongBaoMapService.saveAccountDetailsHongBaoMap(hb.getId(), accountDetails.getId());
|
| | |
|
| | | // 维权扣款(2018-08-05后开始实行)
|
| | | if (hongBaoOrder.getCommonOrder().getSettleTime() != null && hongBaoOrder.getCommonOrder()
|
| | | .getSettleTime().getTime() >= TimeUtil.convertToTimeTemp("2018-08-05", "yyyy-MM-dd")) {
|
| | | taoBaoWeiQuanDrawBackService.doWeiQuanFanli(hongBaoOrder.getCommonOrder().getOrderNo());
|
| | | }
|
| | |
|
| | | // 站内信+推送
|
| | | try {
|
| | | userNotificationService.orderFanliRecieved(hb.getUserInfo().getId(),
|
| | | hongBaoOrder.getCommonOrder().getOrderNo(), hb.getMoney());
|
| | | } catch (Exception e) {
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | |
|
| | | Iterator<Long> its = userMoney.keySet().iterator();
|
| | |
|
| | | while (its.hasNext()) {
|
| | | // 将自己添加到用户
|
| | | Long uid = its.next();
|
| | | BigDecimal money = userMoney.get(uid);
|
| | | userInfoMapper.addHongBaoByUid(uid, money);
|
| | |
|
| | | AccountDetails accountDetails = AccountDetailsFactory.create("+" + money, AccountDetailsFactory.FANLI, null,
|
| | | null, new UserInfo(uid));
|
| | | accountDetailsMapper.insertSelective(accountDetails);
|
| | |
|
| | | // 插入新版资金明细
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createFanLi(uid,
|
| | | hongBaoOrder.getCommonOrder().getOrderNo(), hongBaoOrder.getCommonOrder().getSourceType(), null,
|
| | | money);
|
| | | userMoneyDetail.setId(accountDetails.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e1) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e1);
|
| | | } catch (Exception e2) {
|
| | | e2.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | // 添加资金明细与红包的映射关系
|
| | | for (HongBaoV2 v2 : userHongBao.get(uid)) {
|
| | | accountDetailsHongBaoMapService.saveAccountDetailsHongBaoMap(v2.getId(), accountDetails.getId());
|
| | | }
|
| | |
|
| | | // 站内信+推送
|
| | | UserInfo user = userInfoMapper.selectByPrimaryKey(uid);
|
| | | try {
|
| | | userNotificationService.orderFanliRecieved(uid, hongBaoOrder.getCommonOrder().getOrderNo(),
|
| | | userGoodsCount.get(uid), user.getMyHongBao(), money);
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | // 新版通知
|
| | | userMoneyMsgNotificationService.fanliOrderReceived(uid, hongBaoOrder.getCommonOrder().getOrderNo(),
|
| | | userGoodsCount.get(uid), money, user.getMyHongBao());
|
| | |
|
| | | }
|
| | |
|
| | | // 维权扣款(2018-08-05后开始实行)
|
| | | if (hongBaoOrder.getCommonOrder().getSettleTime() != null && hongBaoOrder.getCommonOrder().getSettleTime()
|
| | | .getTime() >= TimeUtil.convertToTimeTemp("2018-08-05", "yyyy-MM-dd")) {
|
| | | taoBaoWeiQuanDrawBackService.doWeiQuanFanli(hongBaoOrder.getCommonOrder().getOrderNo());
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | List<Long> hbIdList = new ArrayList<>();
|
| | |
|
| | | BigDecimal invitemoney = new BigDecimal(0);
|
| | | Set<String> inviteOrders = new HashSet<>();
|
| | | int inviteGoodsCount = 0;
|
| | |
|
| | | // 需要判断退款的订单号
|
| | | Set<String> drawBackOrders = new HashSet<String>();
|
| | | for (HongBaoV2 hongBao : hongBaoList) {
|
| | |
| | | hongBaoV2Mapper.updateByPrimaryKeySelective(updateHongBao);
|
| | | // 添加到红包返利记录集合
|
| | | hbIdList.add(hongBao.getId());
|
| | |
|
| | | // 2018-08-05 过后的订单才处理维权
|
| | |
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByHongBaoId(hongBao.getParent().getId());
|
| | | inviteGoodsCount += hongBaoOrder.getCommonOrder().getCount();
|
| | | inviteOrders.add(hongBaoOrder.getCommonOrder().getOrderNo());
|
| | |
|
| | | Date balanceTime = hongBaoOrder.getCommonOrder().getSettleTime();
|
| | | if (balanceTime != null
|
| | |
| | | hbIdList.add(hb.getId());
|
| | |
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByHongBaoId(hb.getParent().getId());
|
| | | inviteGoodsCount += hongBaoOrder.getCommonOrder().getCount();
|
| | | inviteOrders.add(hongBaoOrder.getCommonOrder().getOrderNo());
|
| | | if (!StringUtil.isNullOrEmpty(hongBaoOrder.getCommonOrder().getOrderNo()))
|
| | | drawBackOrders.add(hongBaoOrder.getCommonOrder().getOrderNo());
|
| | | }
|
| | |
| | | // 发送推送
|
| | | try {
|
| | | // 提成到账消息通知
|
| | | userNotificationService.tiChengInviteRecieved(uid, invitemoney);
|
| | | userNotificationService.tiChengInviteRecieved(uid, inviteOrders.size(), inviteGoodsCount, null,
|
| | | invitemoney);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | // 新版通知
|
| | | userMoneyMsgNotificationService.inviteOrderReceived(uid, inviteOrders.size(), inviteGoodsCount, invitemoney,
|
| | | userInfoMapper.selectByPrimaryKey(uid).getMyHongBao());
|
| | |
|
| | | for (String orderId : drawBackOrders)
|
| | | taoBaoWeiQuanDrawBackService.doWeiQuanInvite(orderId);
|
| | | }
|
| | |
| | | /**
|
| | | * 处理分享赚
|
| | | */
|
| | |
|
| | | int shareGoodsCount = 0;
|
| | | Set<String> shareOrders = new HashSet<>();
|
| | | BigDecimal sharemoney = new BigDecimal(0);
|
| | | // 查询UID的分享赚订单
|
| | | types.clear();
|
| | |
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByHongBaoId(hongBao.getId());
|
| | | if (hongBaoOrder != null)
|
| | | balanceTime = hongBaoOrder.getCommonOrder().getSettleTime();
|
| | | shareOrders.add(hongBaoOrder.getCommonOrder().getOrderNo());
|
| | | if (balanceTime != null
|
| | | && balanceTime.getTime() >= TimeUtil.convertToTimeTemp("2018-08-05", "yyyy-MM-dd")) {
|
| | | drawBackOrders.add(hongBaoOrder.getCommonOrder().getOrderNo());
|
| | |
| | | // 发送推送
|
| | | try {
|
| | | // 提成到账消息通知
|
| | | userNotificationService.tiChengShareRecieved(uid, sharemoney);
|
| | | userNotificationService.tiChengShareRecieved(uid, shareOrders.size(), shareGoodsCount, null,
|
| | | sharemoney);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | // 新版通知
|
| | | userMoneyMsgNotificationService.shareOrderReceived(uid, shareOrders.size(), shareGoodsCount, sharemoney,
|
| | | userInfoMapper.selectByPrimaryKey(uid).getMyHongBao());
|
| | |
|
| | | for (String orderId : drawBackOrders)
|
| | | taoBaoWeiQuanDrawBackService.doWeiQuanShare(orderId);
|
| | | }
|
| | |
| | | }
|
| | |
|
| | |
|
| | | try {
|
| | | // 第三方提成订单被统计的通知
|
| | | userNotificationService.tiChengStatisticed(hongBao.getUserInfo().getId(),
|
| | | hongBao.getOrderId(), hongBao.getMoney());
|
| | | } catch (Exception e) {
|
| | |
|
| | | }
|
| | |
|
| | | PidOrder updatePidOrder = new PidOrder();
|
| | | updatePidOrder.setId(order.getId());
|
| | | updatePidOrder.setLocalUpdateTime(new Date());
|
| | |
| | | hongBao2.setOrderId(order.getOrderId());
|
| | |
|
| | | hongBaoMapper.insertSelective(hongBao2);
|
| | | try {
|
| | | // 第三方提成订单被统计的通知
|
| | | userNotificationService.tiChengStatisticed(hongBao2.getUserInfo().getId(),
|
| | | hongBao2.getOrderId(), hongBao2.getMoney());
|
| | | } catch (Exception e) {
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | |
|
| | |
| | | hongBao3.setOrderId(order.getOrderId());
|
| | | hongBaoMapper.insertSelective(hongBao3);
|
| | |
|
| | | try {
|
| | | // 第三方提成订单被统计的通知
|
| | | userNotificationService.tiChengStatisticed(hongBao3.getUserInfo().getId(),
|
| | | hongBao3.getOrderId(), hongBao3.getMoney());
|
| | | } catch (Exception e) {
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.exception.TaoBaoWeiQuanException;
|
| | | import com.yeshi.fanli.exception.money.UserMoneyDetailException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.msg.UserMoneyMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoWeiQuanDrawBackService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoWeiQuanOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.UserNotificationService;
|
| | |
| | |
|
| | | @Resource
|
| | | private HongBaoOrderMapper hongBaoOrderMapper;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
|
| | |
|
| | | @Override
|
| | | public void addWeiQuanDrawBack(TaoBaoWeiQuanDrawBack taoBaoWeiQuanDrawBack) {
|
| | |
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | // 新版通知
|
| | | userMoneyMsgNotificationService.fanliOrderWeiQuan(uid, orderId, drawBackMoney,
|
| | | userInfoMapper.selectByPrimaryKey(uid).getMyHongBao());
|
| | |
|
| | | userNotificationService.weiQuanFanli(uid, orderId, drawBackMoney);
|
| | | }
|
| | |
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | userMoneyMsgNotificationService.shareOrderWeiQuan(uid, orderId, drawBackMoney,
|
| | | userInfoMapper.selectByPrimaryKey(uid).getMyHongBao());
|
| | |
|
| | | userNotificationService.weiQuanTiCheng(uid, orderId, drawBackMoney);
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | //
|
| | | // 新版通知
|
| | | userMoneyMsgNotificationService.inviteOrderWeiQuan(uid, orderId, drawBackMoney,
|
| | | userInfoMapper.selectByPrimaryKey(uid).getMyHongBao());
|
| | |
|
| | | userNotificationService.weiQuanTiCheng(uid, orderId, drawBackMoney);
|
| | | }
|
| | |
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanOrderMapper;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail.MsgTypeOrderTypeEnum;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.service.inter.msg.MsgOrderDetailService;
|
| | | import com.yeshi.fanli.service.inter.msg.UserOrderMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoWeiQuanOrderService;
|
| | |
|
| | | @Service
|
| | | public class TaoBaoWeiQuanOrderServiceImpl implements TaoBaoWeiQuanOrderService {
|
| | | @Resource
|
| | | private TaoBaoWeiQuanOrderMapper taoBaoWeiQuanOrderMapper;
|
| | |
|
| | | @Resource
|
| | | private UserOrderMsgNotificationService userOrderMsgNotificationService;
|
| | |
|
| | | @Resource
|
| | | private MsgOrderDetailService msgOrderDetailService;
|
| | |
|
| | | @Override
|
| | | public void addWeiQuanOrder(TaoBaoWeiQuanOrder order) {
|
| | |
| | | update.setUpdateTime(new Date());
|
| | | update.setWeiQuanFinishTime(order.getWeiQuanFinishTime());
|
| | | taoBaoWeiQuanOrderMapper.updateByPrimaryKeySelective(update);
|
| | |
|
| | | try {
|
| | | if (order.getState().equalsIgnoreCase("维权成功")) {
|
| | | List<MsgOrderDetail> msgList = msgOrderDetailService.listMsgOrderByOrderId(order.getOrderId());
|
| | | for (MsgOrderDetail msg : msgList) {
|
| | | if (msg.getType() == MsgTypeOrderTypeEnum.fanli) {
|
| | | userOrderMsgNotificationService.orderFanLiStateChanged(msg.getUser().getId(),
|
| | | order.getOrderId(), null, null, CommonOrder.STATE_WQ);
|
| | | } else if (msg.getType() == MsgTypeOrderTypeEnum.invite) {
|
| | | userOrderMsgNotificationService.orderInviteStateChanged(msg.getUser().getId(),
|
| | | order.getOrderId(), null, null, CommonOrder.STATE_WQ);
|
| | | } else if (msg.getType() == MsgTypeOrderTypeEnum.share) {
|
| | | userOrderMsgNotificationService.orderShareStateChanged(msg.getUser().getId(),
|
| | | order.getOrderId(), null, null, CommonOrder.STATE_WQ);
|
| | | }
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | |
|
| | | }
|
| | | } else {
|
| | | order.setCreateTime(new Date());
|
| | | order.setUpdateTime(new Date());
|
| | |
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.SystemConfigService;
|
| | | import com.yeshi.fanli.service.inter.msg.UserMoneyMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.push.PushService;
|
| | | import com.yeshi.fanli.service.inter.user.AccountDetailsService;
|
| | | import com.yeshi.fanli.service.inter.user.AccountMessageService;
|
| | |
| | | private UserMoneyDetailMapper userMoneyDetailMapper;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyMsgNotificationService userMoneyMsgNotificationService;
|
| | |
|
| | | @Resource
|
| | | private AlipayAccountValidNormalHistoryMapper alipayAccountValidNormalHistoryMapper;
|
| | |
|
| | | public List<Extract> getExtractInfoByUid(long uid) {
|
| | |
| | | @Transactional
|
| | | public synchronized void rejectExtract(long id, String reason, long extractTime, AdminUser admin)
|
| | | throws ObjectStateException, NotExistObjectException {
|
| | | Extract find = extractDao.find(Extract.class, id);
|
| | | Extract find = extractMapper.selectByPrimaryKey(id);
|
| | |
|
| | | if (find == null) {
|
| | | throw new NotExistObjectException("不存在该对象");
|
| | |
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | // 新版通知
|
| | | userMoneyMsgNotificationService.extractFail(find, reason);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | }
|
| | |
|
| | | userNotificationService.extractApply(extract.getUserInfo().getId());
|
| | | // 添加新版通知
|
| | | userMoneyMsgNotificationService.extractApplay(extract);
|
| | |
|
| | | if ("是".equals(autoExtract)) {
|
| | | LogHelper.userInfo("uid=" + user.getId() + ",提交转账申请!");
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | // 新版提现
|
| | | userMoneyMsgNotificationService.extractFail(extract, null);
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | // 新版通知
|
| | | userMoneyMsgNotificationService.extractSuccess(extract);
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | import com.yeshi.fanli.exception.UserAccountException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoService;
|
| | | import com.yeshi.fanli.service.inter.msg.UserAccountMsgNotificationService;
|
| | | import com.yeshi.fanli.service.inter.user.SpreadUserImgService;
|
| | | import com.yeshi.fanli.service.inter.user.UserAccountService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.factory.AccountDetailsFactory;
|
| | | import com.yeshi.fanli.util.factory.msg.MsgAccountDetailFactory;
|
| | | import com.yeshi.fanli.util.wx.WXLoginUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
| | |
|
| | | @Resource
|
| | | private SpreadUserImgService spreadUserImgService;
|
| | |
|
| | | @Resource
|
| | | private UserAccountMsgNotificationService userAccountMsgNotificationService;
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | |
| | | // 绑定关系
|
| | | UserInfo updateUserInfo = new UserInfo(userInfo.getId());
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(lastUser.getPhone()))
|
| | | if (!StringUtil.isNullOrEmpty(lastUser.getPhone())) {
|
| | | updateUserInfo.setPhone(lastUser.getPhone());
|
| | |
|
| | | userAccountMsgNotificationService.bindingSuccess(userInfo.getId(),
|
| | | MsgAccountDetailFactory.TYPE_PHONE);
|
| | | }
|
| | | if (!StringUtil.isNullOrEmpty(lastUser.getOpenid())) {
|
| | | updateUserInfo.setOpenid(lastUser.getOpenid());
|
| | | updateUserInfo.setTbName(lastUser.getTbName());
|
| | | updateUserInfo.setTbPic(lastUser.getTbPic());
|
| | | userAccountMsgNotificationService.bindingSuccess(userInfo.getId(),
|
| | | MsgAccountDetailFactory.TYPE_TB);
|
| | | }
|
| | | updateUserInfo.setLastLoginTime(System.currentTimeMillis());
|
| | | userInfoMapper.updateByPrimaryKeySelective(updateUserInfo);
|
| | |
| | | moneyRecordMapper.insertSelective(moneyRecord);
|
| | | }
|
| | |
|
| | | userAccountMsgNotificationService.connectSuccess(mainUser.getId(), lessUser.getId());
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | UserInfo update = new UserInfo(user.getId());
|
| | | update.setPhone(phone);
|
| | | userInfoMapper.updateByPrimaryKeySelective(update);
|
| | | userAccountMsgNotificationService.bindingSuccess(uid, MsgAccountDetailFactory.TYPE_PHONE);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | UserInfo updateUserInfo = new UserInfo(uid);
|
| | | updateUserInfo.setPhone("");
|
| | | userInfoMapper.updateByPrimaryKeySelective(updateUserInfo);
|
| | | userAccountMsgNotificationService.unBindingSuccess(uid, MsgAccountDetailFactory.TYPE_PHONE);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | update.setPortrait(tbPortrait);
|
| | | }
|
| | | userInfoMapper.updateByPrimaryKeySelective(update);
|
| | |
|
| | | userAccountMsgNotificationService.bindingSuccess(uid, MsgAccountDetailFactory.TYPE_TB);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | }
|
| | |
|
| | | userInfoMapper.updateByPrimaryKeySelective(update);
|
| | |
|
| | | userAccountMsgNotificationService.unBindingSuccess(uid, MsgAccountDetailFactory.TYPE_TB);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | updateUserInfo.setPortrait(Constant.systemCommonConfig.getDefaultPortrait());
|
| | | }
|
| | | userInfoMapper.updateByPrimaryKeySelective(updateUserInfo);
|
| | |
|
| | | userAccountMsgNotificationService.changeBindingSuccess(uid, MsgAccountDetailFactory.TYPE_WX);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public void orderFanliRecieved(Long uid, String orderId, BigDecimal money) {
|
| | | public void orderFanliRecieved(Long uid, String orderId, int goodsCount, BigDecimal balance, BigDecimal money) {
|
| | | if (Constant.IS_TEST)
|
| | | return;
|
| | | try {
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public void orderFanliStatisticed(Long uid, String orderId) {
|
| | | public void orderFanliStatisticed(Long uid, String orderId, int goodsCount, int orderState, BigDecimal payMoney,
|
| | | BigDecimal money) {
|
| | | if (Constant.IS_TEST)
|
| | | return;
|
| | | try {
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public void tiChengInviteRecieved(Long uid, BigDecimal money) {
|
| | | public void tiChengInviteRecieved(Long uid, int orderCount, int goodsCount, BigDecimal balance, BigDecimal money) {
|
| | | if (Constant.IS_TEST)
|
| | | return;
|
| | | try {
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public void tiChengShareRecieved(Long uid, BigDecimal money) {
|
| | | public void tiChengShareRecieved(Long uid, int orderCount, int goodsCount, BigDecimal balance, BigDecimal money) {
|
| | | if (Constant.IS_TEST)
|
| | | return;
|
| | | try {
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public void orderShareStatisticed(Long uid, String orderId, BigDecimal money) {
|
| | | public void orderShareStatisticed(Long uid, String orderId, int goodsCount, int orderState, BigDecimal payMoney,
|
| | | BigDecimal money) {
|
| | | if (Constant.IS_TEST)
|
| | | return;
|
| | | orderId = orderId.substring(0, orderId.length() - 6) + "******";
|
| | |
| | | }
|
| | |
|
| | | @Override
|
| | | public void orderInviteStatisticed(Long uid, String orderId, BigDecimal money) {
|
| | | public void orderInviteStatisticed(Long uid, String orderId, int goodsCount, int orderState, BigDecimal payMoney,
|
| | | BigDecimal money) {
|
| | | if (Constant.IS_TEST)
|
| | | return;
|
| | | orderId = orderId.substring(0, orderId.length() - 6) + "******";
|
| | |
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public void connectHongBaoAndOrderItem();
|
| | |
|
| | | public void addHongBao(Order order, TaoBaoOrder taoBaoOrder, Long orderItemId);
|
| | |
|
| | | public void updateHongBao(HongBao hongBao, TaoBaoOrder taoBaoOrder);
|
| | |
|
| | | /**
|
| | | * 累计提成订单数量(包含无效的订单)
|
| | | *
|
| | |
| | | public void addMsgOrderDetail(MsgOrderDetail detail) throws MsgOrderDetailException;
|
| | |
|
| | | /**
|
| | | * 根据订单号用户ID更新数据
|
| | | * |
| | | * @param detail
|
| | | * @throws MsgOrderDetailException
|
| | | */
|
| | | public void updateMsgOrderDetail(MsgOrderDetail detail) throws MsgOrderDetailException;
|
| | |
|
| | | /**
|
| | | * 订单消息列表
|
| | | *
|
| | | * @param uid
|
| | |
| | | public List<MsgOrderDetail> listMsgOrderDetail(Long uid, int page);
|
| | |
|
| | | /**
|
| | | * 根据订单号获取
|
| | | * @return
|
| | | */
|
| | | public List<MsgOrderDetail> listMsgOrderByOrderId(String orderId);
|
| | |
|
| | | /**
|
| | | * 订单消息数
|
| | | *
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public long countMsgOrderDetail(Long uid);
|
| | | |
| | |
|
| | | /**
|
| | | * 设置所有消息已读
|
| | | *
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.msg;
|
| | |
|
| | | /**
|
| | | * 用户账户消息通知
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface UserAccountMsgNotificationService {
|
| | |
|
| | | /**
|
| | | * 绑定成功
|
| | | * |
| | | * @param uid
|
| | | * @param type
|
| | | */
|
| | | public void bindingSuccess(Long uid, int type);
|
| | |
|
| | | /**
|
| | | * 解绑成功
|
| | | * |
| | | * @param uid
|
| | | * @param type
|
| | | */
|
| | | public void unBindingSuccess(Long uid, int type);
|
| | |
|
| | | /**
|
| | | * 取消绑定成功
|
| | | * |
| | | * @param uid
|
| | | * @param type
|
| | | */
|
| | | public void changeBindingSuccess(Long uid, int type);
|
| | |
|
| | | /**
|
| | | * 账号合并成功
|
| | | * |
| | | * @param uid
|
| | | * @param lessUid
|
| | | */
|
| | | public void connectSuccess(Long uid, Long lessUid);
|
| | |
|
| | | /**
|
| | | * 用户等级变化
|
| | | * |
| | | * @param uid
|
| | | * @param orderType
|
| | | * -订单类型(邀请订单/返利订单/分享订单)
|
| | | * @param orderCount
|
| | | * @param rankName
|
| | | */
|
| | | public void userRank(Long uid, String orderType, int orderCount, String rankName);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.msg;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.ThreeSale;
|
| | |
|
| | | /**
|
| | | * 用户邀请消息通知
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface UserInviteMsgNotificationService {
|
| | |
|
| | | /**
|
| | | * 二维码扫描
|
| | | * |
| | | * @param uid
|
| | | * @param sale
|
| | | */
|
| | | public void inviteScan(Long uid, ThreeSale sale);
|
| | |
|
| | | /**
|
| | | * 邀请成功
|
| | | * |
| | | * @param uid
|
| | | * @param sale
|
| | | */
|
| | | public void inviteSuccess(Long uid, ThreeSale sale);
|
| | |
|
| | | /**
|
| | | * 邀请失败
|
| | | * |
| | | * @param uid
|
| | | * @param sale
|
| | | */
|
| | | public void inviteFail(Long uid, ThreeSale sale);
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.msg;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.AlipayAccountValidNormalHistory;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | |
|
| | | /**
|
| | | * 用户资金消息通知
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface UserMoneyMsgNotificationService {
|
| | |
|
| | | /**
|
| | | * 提现申请
|
| | | * |
| | | * @param extract
|
| | | */
|
| | | public void extractApplay(Extract extract);
|
| | |
|
| | | /**
|
| | | * 提现失败
|
| | | * |
| | | * @param extract
|
| | | * @param stateDesc
|
| | | */
|
| | | public void extractFail(Extract extract, String stateDesc);
|
| | |
|
| | | /**
|
| | | * 提现成功
|
| | | * |
| | | * @param extract
|
| | | */
|
| | | public void extractSuccess(Extract extract);
|
| | |
|
| | | /**
|
| | | * 支付宝账号验证
|
| | | * |
| | | * @param history
|
| | | */
|
| | | public void alipayAccountValid(AlipayAccountValidNormalHistory history);
|
| | |
|
| | | /**
|
| | | * 返利订单到账
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param goodsCount
|
| | | * @param money
|
| | | * @param balance
|
| | | */
|
| | | public void fanliOrderReceived(Long uid, String orderId, int goodsCount, BigDecimal money, BigDecimal balance);
|
| | |
|
| | | /**
|
| | | * 返利订单维权
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param money
|
| | | * @param balance
|
| | | */
|
| | | public void fanliOrderWeiQuan(Long uid, String orderId, BigDecimal money, BigDecimal balance);
|
| | |
|
| | | /**
|
| | | * 分享赚订单被统计
|
| | | * |
| | | * @param uid
|
| | | * @param orderCount
|
| | | * @param goodsCount
|
| | | * @param money
|
| | | * @param balance
|
| | | */
|
| | | public void shareOrderReceived(Long uid, int orderCount, int goodsCount, BigDecimal money, BigDecimal balance);
|
| | |
|
| | | /**
|
| | | * 分享订单维权
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param money
|
| | | * @param balance
|
| | | */
|
| | |
|
| | | public void shareOrderWeiQuan(Long uid, String orderId, BigDecimal money, BigDecimal balance);
|
| | |
|
| | | /**
|
| | | * 邀请赚订单被统计
|
| | | * |
| | | * @param uid
|
| | | * @param orderCount
|
| | | * @param goodsCount
|
| | | * @param money
|
| | | * @param balance
|
| | | */
|
| | | public void inviteOrderReceived(Long uid, int orderCount, int goodsCount, BigDecimal money, BigDecimal balance);
|
| | |
|
| | | /**
|
| | | * 邀请订单维权
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param money
|
| | | * @param balance
|
| | | */
|
| | | public void inviteOrderWeiQuan(Long uid, String orderId, BigDecimal money, BigDecimal balance);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.msg;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | /**
|
| | | * 用户订单消息通知
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface UserOrderMsgNotificationService {
|
| | | /**
|
| | | * 返利订单统计
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param payMoney
|
| | | * @param money
|
| | | * @param goodsCount
|
| | | * @param orderState
|
| | | */
|
| | |
|
| | | public void orderFanLiStatistic(Long uid, String orderId, BigDecimal payMoney, BigDecimal money, int goodsCount,
|
| | | int orderState);
|
| | |
|
| | | /**
|
| | | * 返利订单状态改变
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param payMoney
|
| | | * @param money
|
| | | * @param orderState
|
| | | */
|
| | | public void orderFanLiStateChanged(Long uid, String orderId, BigDecimal payMoney, BigDecimal money, int orderState);
|
| | |
|
| | | /**
|
| | | * 分享订单统计
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param payMoney
|
| | | * @param money
|
| | | * @param goodsCount
|
| | | * @param orderState
|
| | | */
|
| | | public void orderShareStatistic(Long uid, String orderId, BigDecimal payMoney, BigDecimal money, int goodsCount,
|
| | | int orderState);
|
| | |
|
| | | /**
|
| | | * 分享订单状态改变
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param payMoney
|
| | | * @param money
|
| | | * @param orderState
|
| | | */
|
| | | public void orderShareStateChanged(Long uid, String orderId, BigDecimal payMoney, BigDecimal money, int orderState);
|
| | |
|
| | | /**
|
| | | * 邀请订单统计
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param payMoney
|
| | | * @param money
|
| | | * @param goodsCount
|
| | | * @param orderState
|
| | | */
|
| | | public void orderInviteStatistic(Long uid, String orderId, BigDecimal payMoney, BigDecimal money, int goodsCount,
|
| | | int orderState);
|
| | |
|
| | | /**
|
| | | * 邀请订单状态改变
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param payMoney
|
| | | * @param money
|
| | | * @param orderState
|
| | | */
|
| | | public void orderInviteStateChanged(Long uid, String orderId, BigDecimal payMoney, BigDecimal money,
|
| | | int orderState);
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public void processShopingFanliOrder(Map<String, List<TaoBaoOrder>> orders);
|
| | |
|
| | | public void processShopingFanliOrder(String orderId, List<TaoBaoOrder> orderList)
|
| | | throws HongBaoException, OrderItemException;
|
| | |
|
| | | /**
|
| | | * 处理分享商品订单
|
| | |
| | | */
|
| | | public void fanli();
|
| | |
|
| | | /**
|
| | | * 购物返利
|
| | | * |
| | | * @param hongBao
|
| | | * type=1的主红包
|
| | | */
|
| | | public void fanli(HongBao hongBao) throws TaoBaoWeiQuanException;
|
| | | |
| | |
|
| | |
|
| | | /**
|
| | | * 购物返利
|
| | |
| | | public void newerHongBao(Long uid, BigDecimal money);
|
| | |
|
| | | /**
|
| | | * 订单返利到账
|
| | | * 返利到账通知
|
| | | *
|
| | | * @param uid
|
| | | * -用户ID
|
| | | * @param orderId
|
| | | * @param money
|
| | | * -订单号
|
| | | * @param goodsCount
|
| | | * -商品数量
|
| | | * @param balance-账户余额
|
| | | * @param money-返利资金
|
| | | */
|
| | | public void orderFanliRecieved(Long uid, String orderId, BigDecimal money);
|
| | | public void orderFanliRecieved(Long uid, String orderId, int goodsCount, BigDecimal balance,
|
| | | BigDecimal money);
|
| | |
|
| | | /**
|
| | | * 提成到账
|
| | |
| | | public void tiChengRecieved(Long uid, BigDecimal money);
|
| | |
|
| | | /**
|
| | | * 邀请提成到账
|
| | | * 邀请到账
|
| | | *
|
| | | * @param uid
|
| | | * @param money
|
| | | * @param orderCount-订单数
|
| | | * @param goodsCount-商品数
|
| | | * @param balance-账户余额
|
| | | * @param money-资金
|
| | | */
|
| | | public void tiChengInviteRecieved(Long uid, BigDecimal money);
|
| | | public void tiChengInviteRecieved(Long uid, int orderCount, int goodsCount, BigDecimal balance, BigDecimal money);
|
| | |
|
| | | /**
|
| | | * 分享提成到账
|
| | | *
|
| | | * @param uid
|
| | | * @param orderCount
|
| | | * @param goodsCount
|
| | | * @param balance
|
| | | * @param money
|
| | | */
|
| | | public void tiChengShareRecieved(Long uid, BigDecimal money);
|
| | | public void tiChengShareRecieved(Long uid, int orderCount, int goodsCount, BigDecimal balance, BigDecimal money);
|
| | |
|
| | | /**
|
| | | * 订单被统计
|
| | | *
|
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param goodsCount-商品数
|
| | | * @param orderState-订单状态
|
| | | * @param payMoney-付款金额
|
| | | * @param money-佣金
|
| | | */
|
| | | public void orderFanliStatisticed(Long uid, String orderId);
|
| | | public void orderFanliStatisticed(Long uid, String orderId, int goodsCount, int orderState, BigDecimal payMoney,
|
| | | BigDecimal money);
|
| | |
|
| | | /**
|
| | | * 提成订单被统计
|
| | |
| | | * @param orderId
|
| | | * @param money
|
| | | */
|
| | | public void tiChengStatisticed(Long uid, String orderId, BigDecimal money);
|
| | | public void tiChengStatisticed(Long uid, String orderId,BigDecimal money);
|
| | |
|
| | | /**
|
| | | * 分享订单被统计
|
| | | *
|
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param goodsCount
|
| | | * @param orderState
|
| | | * @param payMoney
|
| | | * @param money
|
| | | */
|
| | | public void orderShareStatisticed(Long uid, String orderId, BigDecimal money);
|
| | | public void orderShareStatisticed(Long uid, String orderId, int goodsCount, int orderState, BigDecimal payMoney,
|
| | | BigDecimal money);
|
| | |
|
| | | /**
|
| | | * 邀请订单被统计
|
| | | *
|
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param goodsCount
|
| | | * @param orderState
|
| | | * @param payMoney
|
| | | * @param money
|
| | | */
|
| | | public void orderInviteStatisticed(Long uid, String orderId, BigDecimal money);
|
| | | public void orderInviteStatisticed(Long uid, String orderId, int goodsCount, int orderState, BigDecimal payMoney,
|
| | | BigDecimal money);
|
| | |
|
| | | /**
|
| | | * 维权返利订单扣款
|
| | |
| | | public class Constant {
|
| | | public static boolean IS_TASK = false;
|
| | | // 外网环境
|
| | | public static boolean IS_OUTNET = true;
|
| | | public static boolean IS_OUTNET = false;
|
| | |
|
| | | public static boolean IS_TEST = false;
|
| | | public static boolean IS_TEST = true;
|
| | |
|
| | | public static int PAGE_SIZE = 20;
|
| | | public static int[] TASK_TYPE = { 1001, 1002, 1003, 1004, 1005, 1006, 1007, 1008// 微信任务类型编号
|
| | |
| | | if (Constant.IS_TASK) {
|
| | | doExtractResult();// 处理提现结果
|
| | | doTaoBaoOrders();// 处理淘宝订单
|
| | | doOrderFanLi();// 处理订单返利
|
| | | doOrderFanLiNew();//新版返利
|
| | | doOrderFanLiNew();// 新版返利
|
| | | doOrderTiChengFanLi();// 处理订单提成返利
|
| | | doWeiQuanOrder();// 处理维权订单
|
| | | doPushIOS();// 处理发送IOS消息
|
| | |
| | | }
|
| | | });
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 处理淘宝订单返利
|
| | | */
|
| | | public void doOrderFanLi() {
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | while (true) {
|
| | | try {
|
| | | Map<String, HongBao> map = CMQManager.getInstance().consumeFanLiMsg(16);
|
| | | if (map != null) {
|
| | | Iterator<String> its = map.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | | String handler = its.next();
|
| | | try {
|
| | | orderProcessService.fanli(map.get(handler));
|
| | | CMQManager.getInstance().deleteFanLiMsg(handler);
|
| | | } catch (TaoBaoWeiQuanException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | |
|
| | | import java.lang.reflect.InvocationTargetException;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import org.apache.commons.beanutils.PropertyUtils;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.BindingAccount;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | | return result;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 过滤支付宝账号,中间用*代替
|
| | | * |
| | | * @param bindingAccountList
|
| | | * @return
|
| | | */
|
| | | public static List<BindingAccount> filterBindingAccount(List<BindingAccount> bindingAccountList) {
|
| | | List<BindingAccount> accountList = new ArrayList<>();
|
| | |
|
| | | if (bindingAccountList != null)
|
| | | for (BindingAccount bindingAccount : bindingAccountList) {
|
| | | accountList.add(filterBindingAccount(bindingAccount));
|
| | | }
|
| | | return accountList;
|
| | | }
|
| | |
|
| | | public static BindingAccount filterBindingAccount(BindingAccount bindingAccount) {
|
| | |
|
| | | BindingAccount dest = new BindingAccount();
|
| | | try {
|
| | | PropertyUtils.copyProperties(dest, bindingAccount);
|
| | | if (!StringUtil.isNullOrEmpty(dest.getAccount()) && !StringUtil.isNullOrEmpty(dest.getName())) {
|
| | | String name = "";
|
| | | if ((dest.getName() + "").length() > 2)
|
| | | for (int i = 0; i < (dest.getName() + "").length(); i++) {
|
| | | if (i == 0)
|
| | | name += dest.getName().charAt(i);
|
| | | else
|
| | | name += "*";
|
| | | }
|
| | | else
|
| | | name = dest.getName().charAt(0) + "*";
|
| | | dest.setName(name);
|
| | |
|
| | | String account = "";
|
| | | if (dest.getAccount().indexOf("@") > -1) {// 邮箱
|
| | | int index = dest.getAccount().indexOf("@");
|
| | |
|
| | | for (int i = 0; i < dest.getAccount().length(); i++) {
|
| | | if (i < 3 || i >= index)
|
| | | account += dest.getAccount().charAt(i);
|
| | | else
|
| | | account += "*";
|
| | | }
|
| | | } else if (StringUtil.isMobile(dest.getAccount())) {// 电话
|
| | | account = dest.getAccount().substring(0, 3) + "*****"
|
| | | + dest.getAccount().substring(dest.getAccount().length() - 2, dest.getAccount().length());
|
| | |
|
| | | } else {// 其他
|
| | | if (dest.getAccount().length() >= 6) {
|
| | | for (int i = 0; i < dest.getAccount().length(); i++) {
|
| | | if (i < 3 || i >= dest.getAccount().length() - 2)
|
| | | account += dest.getAccount().charAt(i);
|
| | | else
|
| | | account += "*";
|
| | | }
|
| | | } else {
|
| | | for (int i = 0; i < dest.getAccount().length(); i++) {
|
| | | if (i < 1 || i >= dest.getAccount().length() - 1)
|
| | | account += dest.getAccount().charAt(i);
|
| | | else
|
| | | account += "*";
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | dest.setAccount(account);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | }
|
| | |
|
| | | return dest;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | return detail;
|
| | | }
|
| | |
|
| | | // TODO 账号等级
|
| | | // 账号等级
|
| | | public static MsgAccountDetail createUserRank(Long uid, String orderType, int orderCount, String rankName) {
|
| | | if (uid == null || rankName == null)
|
| | | return null;
|
| | |
|
| | | String msg = String.format(
|
| | | "恭喜你,上月<highlight>%s</highlight>订单达到<highlight>%s</highlight>单,已为你升级为<highlight>%s</highlight>用户,将会获得对应的福利和特权。",
|
| | | orderType, orderCount + "", rankName);
|
| | | MsgAccountDetail detail = new MsgAccountDetail();
|
| | | detail.setBeiZhu("无");
|
| | | detail.setContent(msg);
|
| | | detail.setTitle("账号等级");
|
| | | detail.setType(MsgTypeAccountTypeEnum.level);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setRead(false);
|
| | | return detail;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | public class MsgMoneyDetailFactory {
|
| | |
|
| | |
| | | if (extract == null || uid == null)
|
| | | return null;
|
| | | MsgMoneyDetail detail = new MsgMoneyDetail();
|
| | | detail.setBeiZhu( beiZhu);
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setExtract(extract);
|
| | | detail.setMoney(extract.getMoney());
|
| | | detail.setMsgType(MsgTypeMoneyTypeEnum.extract);
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setStateDesc("人工审核中");
|
| | | return detail;
|
| | | }
|
| | |
|
| | |
| | | detail.setMsgType(MsgTypeMoneyTypeEnum.extract);
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setStateDesc("提现成功");
|
| | | return detail;
|
| | | }
|
| | |
|
| | |
| | | if (extract == null || uid == null)
|
| | | return null;
|
| | | MsgMoneyDetail detail = new MsgMoneyDetail();
|
| | | detail.setBeiZhu( beiZhu);
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setExtract(extract);
|
| | | detail.setMoney(extract.getMoney());
|
| | | detail.setMsgType(MsgTypeMoneyTypeEnum.extract);
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | detail.setStateDesc("提现失败");
|
| | | return detail;
|
| | | }
|
| | |
|
| | |
| | | return null;
|
| | | MsgMoneyDetail detail = new MsgMoneyDetail();
|
| | | detail.setAlipayAccountValid(valid);
|
| | | detail.setBeiZhu( beiZhu);
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setMoney(money);
|
| | | detail.setStateDesc(String
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 返利维权
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param money
|
| | | * @param balance
|
| | | * @param beiZhu
|
| | | * @return
|
| | | */
|
| | | public static MsgMoneyDetail createFailiWeiQuanMsg(Long uid, String orderId, BigDecimal money, BigDecimal balance,
|
| | | String beiZhu) {
|
| | | if (money == null || orderId == null || money == null || uid == null)
|
| | | return null;
|
| | |
|
| | | MsgMoneyDetail detail = new MsgMoneyDetail();
|
| | | detail.setBalance(balance);
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setMoney(money);
|
| | | detail.setMsgType(MsgTypeMoneyTypeEnum.fanliWeiQuan);
|
| | | detail.setOrderId(orderId);
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | |
|
| | | return detail;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 邀请赚到账
|
| | | *
|
| | | * @param money
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 邀请赚维权
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param money
|
| | | * @param balance
|
| | | * @param beiZhu
|
| | | * @return
|
| | | */
|
| | | public static MsgMoneyDetail createInviteWeiQuanMsg(Long uid, String orderId, BigDecimal money, BigDecimal balance,
|
| | | String beiZhu) {
|
| | | if (money == null || orderId == null || money == null || uid == null)
|
| | | return null;
|
| | |
|
| | | MsgMoneyDetail detail = new MsgMoneyDetail();
|
| | | detail.setBalance(balance);
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setMoney(money);
|
| | | detail.setMsgType(MsgTypeMoneyTypeEnum.inviteWeiQuan);
|
| | | detail.setOrderId(orderId);
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | |
|
| | | return detail;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 分享赚到账
|
| | | *
|
| | | * @param money
|
| | |
| | |
|
| | | MsgMoneyDetail detail = new MsgMoneyDetail();
|
| | | detail.setBalance(balance);
|
| | | detail.setBeiZhu( beiZhu);
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setGoodsCount(goodsCount);
|
| | | detail.setMoney(money);
|
| | |
| | | return detail;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 分享赚维权
|
| | | * |
| | | * @param uid
|
| | | * @param orderId
|
| | | * @param money
|
| | | * @param balance
|
| | | * @param beiZhu
|
| | | * @return
|
| | | */
|
| | | public static MsgMoneyDetail createShareWeiQuanMsg(Long uid, String orderId, BigDecimal money, BigDecimal balance,
|
| | | String beiZhu) {
|
| | | if (money == null || orderId == null || money == null || uid == null)
|
| | | return null;
|
| | | MsgMoneyDetail detail = new MsgMoneyDetail();
|
| | | detail.setBalance(balance);
|
| | | detail.setBeiZhu(beiZhu);
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setMoney(money);
|
| | | detail.setMsgType(MsgTypeMoneyTypeEnum.shareWeiQuan);
|
| | | detail.setOrderId(orderId);
|
| | | detail.setRead(false);
|
| | | detail.setUser(new UserInfo(uid));
|
| | | return detail;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.entity.bus.msg.MsgMoneyDetail.MsgTypeMoneyTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail;
|
| | | import com.yeshi.fanli.entity.bus.msg.MsgOrderDetail.MsgTypeOrderTypeEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.BindingAccount;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.account.UserUtil;
|
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO;
|
| | | import com.yeshi.fanli.vo.msg.CommonMsgItemVO;
|
| | | import com.yeshi.fanli.vo.msg.UserMsgVO;
|
| | |
| | | // 提现
|
| | | if (msg.getMsgType() == MsgTypeMoneyTypeEnum.extract) {
|
| | |
|
| | | contentList.add(new ClientTextStyleVO(
|
| | | "支付宝:" + msg.getExtract().getName() + " " + msg.getExtract().getAccount(), COLOR_CONTENT));
|
| | | BindingAccount ba = new BindingAccount();
|
| | | ba.setAccount(msg.getExtract().getAccount());
|
| | | ba.setName(msg.getExtract().getName());
|
| | | ba = UserUtil.filterBindingAccount(ba);
|
| | |
|
| | | contentList.add(new ClientTextStyleVO("支付宝:" + ba.getName() + " " + ba.getAccount(), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("提现账号", COLOR_CONTENT), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | |
| | | return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_extract.png", "提现",
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | | } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.extractValid) {
|
| | | BindingAccount ba = new BindingAccount();
|
| | | ba.setAccount(msg.getAlipayAccountValid().getAccount());
|
| | | ba.setName(msg.getAlipayAccountValid().getName());
|
| | | ba = UserUtil.filterBindingAccount(ba);
|
| | |
|
| | | // 支付宝验证
|
| | | contentList.add(new ClientTextStyleVO(
|
| | | "支付宝:" + msg.getAlipayAccountValid().getName() + " " + msg.getAlipayAccountValid().getAccount(),
|
| | | COLOR_CONTENT));
|
| | | contentList.add(new ClientTextStyleVO("支付宝:" + ba.getName() + " " + ba.getAccount(), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("提现账号", COLOR_CONTENT), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | |
| | | ca.add(Calendar.MONTH, -1);
|
| | | String date = ca.get(Calendar.YEAR) + "年" + (ca.get(Calendar.MONTH) + 1) + "月";
|
| | |
|
| | | return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_share_money.png",
|
| | | date + msg.getMsgType().getDesc(),
|
| | | if (msg.getMsgType() == MsgTypeMoneyTypeEnum.share)
|
| | | return new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_share_money.png",
|
| | | date + msg.getMsgType().getDesc(),
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | | else
|
| | | new UserMsgVO("http://img.flqapp.com/resource/msg/icon_msg_invite_money.png",
|
| | | date + msg.getMsgType().getDesc(),
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | |
|
| | | } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.fanliWeiQuan) {
|
| | | contentList.add(new ClientTextStyleVO(msg.getOrderId(), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("返利订单", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("订单维权", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("扣除说明", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getMoney()) + "",
|
| | | COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("返利扣除", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getBalance()) + "",
|
| | | 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_fanli.png", msg.getMsgType().getDesc(),
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | | } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.shareWeiQuan) {
|
| | | contentList.add(new ClientTextStyleVO(msg.getOrderId(), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("邀请订单", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("订单维权", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("扣除说明", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getMoney()) + "",
|
| | | COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("奖金扣除", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getBalance()) + "",
|
| | | 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_share.png", msg.getMsgType().getDesc(),
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | | } else if (msg.getMsgType() == MsgTypeMoneyTypeEnum.inviteWeiQuan) {
|
| | | contentList.add(new ClientTextStyleVO(msg.getOrderId(), COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("邀请订单", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("订单维权", COLOR_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("扣除说明", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getMoney()) + "",
|
| | | COLOR_HIGHLIGHT_CONTENT));
|
| | | items.add(new CommonMsgItemVO(new ClientTextStyleVO("奖金扣除", COLOR_TITLE), contentList));
|
| | |
|
| | | contentList = new ArrayList<>();
|
| | | contentList.add(new ClientTextStyleVO("¥" + MoneyBigDecimalUtil.getWithNoZera(msg.getBalance()) + "",
|
| | | 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", msg.getMsgType().getDesc(),
|
| | | msg.getUpdateTime() == null ? msg.getCreateTime() : msg.getUpdateTime(), items);
|
| | | }
|
| | |
|
| | |
| | | public final static String TYPE_GOODS_2 = "goods_2";
|
| | | public final static String TYPE_GOODS_3 = "goods_3";
|
| | |
|
| | | private String icon;
|
| | | private String type;
|
| | | private String title;
|
| | | private String content;
|
| | |
| | | public void setGoodsList(List<TaoBaoGoodsBrief> goodsList) {
|
| | | this.goodsList = goodsList;
|
| | | }
|
| | |
|
| | | public String getIcon() {
|
| | | return icon;
|
| | | }
|
| | |
|
| | | public void setIcon(String icon) {
|
| | | this.icon = icon;
|
| | | }
|
| | | }
|
| | |
| | | private String content;
|
| | | private String timeTag;
|
| | | private String createTime;
|
| | | private int unReadCount;
|
| | |
|
| | | public UserSystemMsgVO(Long id, String type, Boolean solved, String title, String content, String timeTag,
|
| | | String portrait, String createTime) {
|
| | | String portrait, String createTime, int unReadCount) {
|
| | | this.id = id;
|
| | | this.type = type;
|
| | | this.solved = solved;
|
| | |
| | | this.timeTag = timeTag;
|
| | | this.portrait = portrait;
|
| | | this.createTime = createTime;
|
| | | this.unReadCount = unReadCount;
|
| | | }
|
| | |
|
| | | public UserSystemMsgVO() {
|
| | |
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public int getUnReadCount() {
|
| | | return unReadCount;
|
| | | }
|
| | |
|
| | | public void setUnReadCount(int unReadCount) {
|
| | | this.unReadCount = unReadCount;
|
| | | }
|
| | |
|
| | | public String getPortrait() {
|
| | | return portrait;
|
| | | }
|