| | |
| | | @Map("ticheng_order_statisticed_msg")
|
| | | private String tichengOrderStatisticedMsg;
|
| | |
|
| | | // 分享赚和邀请赚上月收入到账提示
|
| | | // 邀请赚上月收入到账提示
|
| | |
|
| | | @Map("share_invite_money_recieve_title")
|
| | | private String shareInviteMoneyRecieveTitle;
|
| | | @Map("share_invite_money_recieve_push")
|
| | | private String shareInviteMoneyRecievePush;
|
| | | @Map("share_invite_money_recieve_msg")
|
| | | private String shareInviteMoneyRecieveMsg;
|
| | | @Map("invite_money_recieve_title")
|
| | | private String inviteMoneyRecieveTitle;
|
| | | @Map("invite_money_recieve_push")
|
| | | private String inviteMoneyRecievePush;
|
| | | @Map("invite_money_recieve_msg")
|
| | | private String inviteMoneyRecieveMsg;
|
| | | |
| | | //分享赚商业收入到账提示
|
| | | @Map("share_money_recieve_title")
|
| | | private String shareMoneyRecieveTitle;
|
| | | @Map("share_money_recieve_push")
|
| | | private String shareMoneyRecievePush;
|
| | | @Map("share_money_recieve_msg")
|
| | | private String shareMoneyRecieveMsg;
|
| | | |
| | |
|
| | | // 售后维权订单扣款提示
|
| | |
|
| | |
| | | @Map("weiquan_drawback_fanli_push")
|
| | | private String weiquanDrawbackFanliPush;
|
| | |
|
| | | |
| | | //邀请赚维权
|
| | | @Map("weiquan_drawback_invite_title")
|
| | | private String weiquanDrawbackInviteTitle;
|
| | |
|
| | | @Map("weiquan_drawback_invite_msg")
|
| | | private String weiquanDrawbackInviteMsg;
|
| | |
|
| | | @Map("weiquan_drawback_invite_push")
|
| | | private String weiquanDrawbackInvitePush;
|
| | | |
| | | |
| | | //分享赚维权
|
| | | @Map("weiquan_drawback_share_title")
|
| | | private String weiquanDrawbackShareTitle;
|
| | |
|
| | |
| | | private String alipayAccountValidMsg;
|
| | |
|
| | |
|
| | |
|
| | | public String getInviteMoneyRecieveTitle() {
|
| | | return inviteMoneyRecieveTitle;
|
| | | }
|
| | |
|
| | | public void setInviteMoneyRecieveTitle(String inviteMoneyRecieveTitle) {
|
| | | this.inviteMoneyRecieveTitle = inviteMoneyRecieveTitle;
|
| | | }
|
| | |
|
| | | public String getInviteMoneyRecievePush() {
|
| | | return inviteMoneyRecievePush;
|
| | | }
|
| | |
|
| | | public void setInviteMoneyRecievePush(String inviteMoneyRecievePush) {
|
| | | this.inviteMoneyRecievePush = inviteMoneyRecievePush;
|
| | | }
|
| | |
|
| | | public String getInviteMoneyRecieveMsg() {
|
| | | return inviteMoneyRecieveMsg;
|
| | | }
|
| | |
|
| | | public void setInviteMoneyRecieveMsg(String inviteMoneyRecieveMsg) {
|
| | | this.inviteMoneyRecieveMsg = inviteMoneyRecieveMsg;
|
| | | }
|
| | |
|
| | | public String getShareMoneyRecieveTitle() {
|
| | | return shareMoneyRecieveTitle;
|
| | | }
|
| | |
|
| | | public void setShareMoneyRecieveTitle(String shareMoneyRecieveTitle) {
|
| | | this.shareMoneyRecieveTitle = shareMoneyRecieveTitle;
|
| | | }
|
| | |
|
| | | public String getShareMoneyRecievePush() {
|
| | | return shareMoneyRecievePush;
|
| | | }
|
| | |
|
| | | public void setShareMoneyRecievePush(String shareMoneyRecievePush) {
|
| | | this.shareMoneyRecievePush = shareMoneyRecievePush;
|
| | | }
|
| | |
|
| | | public String getShareMoneyRecieveMsg() {
|
| | | return shareMoneyRecieveMsg;
|
| | | }
|
| | |
|
| | | public void setShareMoneyRecieveMsg(String shareMoneyRecieveMsg) {
|
| | | this.shareMoneyRecieveMsg = shareMoneyRecieveMsg;
|
| | | }
|
| | |
|
| | | public String getWeiquanDrawbackInviteTitle() {
|
| | | return weiquanDrawbackInviteTitle;
|
| | | }
|
| | |
|
| | | public void setWeiquanDrawbackInviteTitle(String weiquanDrawbackInviteTitle) {
|
| | | this.weiquanDrawbackInviteTitle = weiquanDrawbackInviteTitle;
|
| | | }
|
| | |
|
| | | public String getWeiquanDrawbackInviteMsg() {
|
| | | return weiquanDrawbackInviteMsg;
|
| | | }
|
| | |
|
| | | public void setWeiquanDrawbackInviteMsg(String weiquanDrawbackInviteMsg) {
|
| | | this.weiquanDrawbackInviteMsg = weiquanDrawbackInviteMsg;
|
| | | }
|
| | |
|
| | | public String getWeiquanDrawbackInvitePush() {
|
| | | return weiquanDrawbackInvitePush;
|
| | | }
|
| | |
|
| | | public void setWeiquanDrawbackInvitePush(String weiquanDrawbackInvitePush) {
|
| | | this.weiquanDrawbackInvitePush = weiquanDrawbackInvitePush;
|
| | | }
|
| | |
|
| | | public String getAlipayAccountValidTitle() {
|
| | | return alipayAccountValidTitle;
|
| | |
| | | this.orderFanliRecieveTitle = orderFanliRecieveTitle;
|
| | | }
|
| | |
|
| | | public String getShareInviteMoneyRecieveTitle() {
|
| | | return shareInviteMoneyRecieveTitle;
|
| | | }
|
| | |
|
| | | public void setShareInviteMoneyRecieveTitle(String shareInviteMoneyRecieveTitle) {
|
| | | this.shareInviteMoneyRecieveTitle = shareInviteMoneyRecieveTitle;
|
| | | }
|
| | |
|
| | | public String getWeiquanDrawbackFanliTitle() {
|
| | | return weiquanDrawbackFanliTitle;
|
| | |
| | | this.orderFanliRecieveMsg = orderFanliRecieveMsg;
|
| | | }
|
| | |
|
| | | public String getShareInviteMoneyRecievePush() {
|
| | | return shareInviteMoneyRecievePush;
|
| | | }
|
| | |
|
| | | public void setShareInviteMoneyRecievePush(String shareInviteMoneyRecievePush) {
|
| | | this.shareInviteMoneyRecievePush = shareInviteMoneyRecievePush;
|
| | | }
|
| | |
|
| | | public String getShareInviteMoneyRecieveMsg() {
|
| | | return shareInviteMoneyRecieveMsg;
|
| | | }
|
| | |
|
| | | public void setShareInviteMoneyRecieveMsg(String shareInviteMoneyRecieveMsg) {
|
| | | this.shareInviteMoneyRecieveMsg = shareInviteMoneyRecieveMsg;
|
| | | }
|
| | |
|
| | | public String getWeiquanDrawbackFanliMsg() {
|
| | | return weiquanDrawbackFanliMsg;
|
| | |
| | | <foreach collection="dateFormat" index="index" item="item" separator="UNION ALL" > |
| | | <trim prefix="(" suffix=")" > |
| | | SELECT |
| | | a.time as dateFormate ,a.money as income ,b.money as expend |
| | | a.time as dateFormate , if(a.money is null,0,a.money) as income ,if(b.money is null,0,b.money) as expend |
| | | FROM |
| | | ( |
| | | SELECT DATE_FORMAT( |
| | |
| | | import com.yeshi.fanli.dao.mybatis.ThreeSaleMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.UserInfoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.hongbao.HongBaoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.money.UserMoneyDetailMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.OrderItemMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.OrderMapper;
|
| | | import com.yeshi.fanli.entity.admin.OrderAdmin;
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.ThreeSaleGift;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.common.Config;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.entity.taobao.OrderVital;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.exception.money.UserMoneyDetailException;
|
| | | 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.util.factory.AccountDetailsFactory;
|
| | | import com.yeshi.fanli.util.factory.AccountMessageFactory;
|
| | | import com.yeshi.fanli.util.factory.HongBaoFactory;
|
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
|
| | | import com.yeshi.fanli.util.push.XiaoMiPushUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserNotificationService userNotificationService;
|
| | | |
| | | @Resource
|
| | | private UserMoneyDetailMapper userMoneyDetailMapper;
|
| | |
|
| | | private static final String NEW_USER_HONGBAO = "new_user_hongbao";
|
| | |
|
| | |
| | |
|
| | | AccountDetails ac = AccountDetailsFactory.create("+" + money, AccountDetailsFactory.XINREN, null, null, form);
|
| | | accountDetailsMapper.insertSelective(ac);
|
| | | // 新版资金明细
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createNewerHongBao(hongBao);
|
| | | userMoneyDetail.setId(ac.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | userInfoMapper.addHongBaoByUid(form.getId(), new BigDecimal(money));
|
| | | userNotificationService.newerHongBao(form.getId(), new BigDecimal(money));
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.ThreeSaleGiftMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.UserInfoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.hongbao.HongBaoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.money.UserMoneyDetailMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.OrderItemMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.OrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.share.PidUserMapper;
|
| | |
| | | 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.taobao.PidOrder;
|
| | | import com.yeshi.fanli.entity.taobao.PidUser;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | |
| | | import com.yeshi.fanli.exception.ObjectStateException;
|
| | | import com.yeshi.fanli.exception.OrderItemException;
|
| | | 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.hongbao.AccountDetailsHongBaoMapService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | |
| | | 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.UserMoneyDetailFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
|
| | |
|
| | | @Service
|
| | |
| | |
|
| | | @Resource
|
| | | private AccountDetailsHongBaoMapService accountDetailsHongBaoMapService;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyDetailMapper userMoneyDetailMapper;
|
| | |
|
| | | @Override
|
| | | public void processOrder(Map<String, List<TaoBaoOrder>> orders) {
|
| | |
| | | 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());
|
| | |
|
| | |
| | |
|
| | | List<Long> hbIdList = new ArrayList<>();
|
| | |
|
| | | BigDecimal money = new BigDecimal(0);
|
| | | BigDecimal invitemoney = new BigDecimal(0);
|
| | | // 需要判断退款的订单号
|
| | | Set<String> drawBackOrders = new HashSet<String>();
|
| | | for (HongBao hongBao : hongBaoList) {
|
| | |
| | |
|
| | | hongBao = hongBaoMapper.selectByPrimaryKeyForUpdate(hongBao.getId());
|
| | | if (hongBao.getState() == HongBao.STATE_BUKELINGQU || hongBao.getState() == HongBao.STATE_KELINGQU) {
|
| | | money = money.add(hongBao.getMoney());
|
| | | invitemoney = invitemoney.add(hongBao.getMoney());
|
| | | HongBao updateHongBao = new HongBao();
|
| | | updateHongBao.setId(hongBao.getId());
|
| | | updateHongBao.setGetTime(System.currentTimeMillis());
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | |
| | | /**
|
| | | * 处理顶级分享赚
|
| | | * 处理一级二级分享赚(属于邀请赚类型)
|
| | | */
|
| | |
|
| | | List<HongBao> totalHongBaoList = new ArrayList<>();
|
| | | // 查询UID的二级或者三级分享赚订单
|
| | | // TODO 暂时查询10000条数据,后面再做分页
|
| | | List<HongBao> hbList = hongBaoMapper.selectCanBalanceHongBaoByTypeAndUid(HongBao.TYPE_SHARE_YIJI, uid, 10000);
|
| | |
|
| | | if (hbList != null && hbList.size() > 0)
|
| | | totalHongBaoList.addAll(hbList);
|
| | |
|
| | | hbList = hongBaoMapper.selectCanBalanceHongBaoByTypeAndUid(HongBao.TYPE_SHARE_ERJI, uid, 10000);
|
| | | if (hbList != null && hbList.size() > 0)
|
| | | totalHongBaoList.addAll(hbList);
|
| | |
|
| | | for (HongBao hb : totalHongBaoList) {
|
| | | if (hb.getState() == HongBao.STATE_BUKELINGQU || hb.getState() == HongBao.STATE_KELINGQU) {
|
| | | hb = filterWeiQuanINGHongBao(hb);
|
| | | if (hb == null)
|
| | | continue;
|
| | | invitemoney = invitemoney.add(hb.getMoney());
|
| | | HongBao updateHongBao = new HongBao();
|
| | | updateHongBao.setId(hb.getId());
|
| | | updateHongBao.setGetTime(System.currentTimeMillis());
|
| | | updateHongBao.setState(HongBao.STATE_YILINGQU);
|
| | | hongBaoMapper.updateByPrimaryKeySelective(updateHongBao);
|
| | | // 添加到红包返利记录集合
|
| | | hbIdList.add(hb.getId());
|
| | | if (!StringUtil.isNullOrEmpty(hb.getOrderId()))
|
| | | drawBackOrders.add(hb.getOrderId());
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | | // 邀请赚到账
|
| | | if (invitemoney.compareTo(new BigDecimal(0)) > 0) {
|
| | | userInfoMapper.addHongBaoByUid(uid, invitemoney);
|
| | | // 添加记录
|
| | | AccountDetails accountDetails = AccountDetailsFactory.create("+" + invitemoney,
|
| | | AccountDetailsFactory.TICHENG, null, null, new UserInfo(uid));
|
| | | accountDetailsMapper.insertSelective(accountDetails);
|
| | |
|
| | | // 添加新版详情记录
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createInvite(uid, 0, 0, 0, invitemoney,
|
| | | new Date());
|
| | | userMoneyDetail.setId(accountDetails.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | // 记录返利红包与资金详情的对应关系
|
| | |
|
| | | // 添加到红包返利记录集合
|
| | | accountDetailsHongBaoMapService.saveAccountDetailsHongBaoMap(hbIdList, accountDetails.getId());
|
| | |
|
| | | // 发送推送
|
| | | try {
|
| | | // 提成到账消息通知
|
| | | userNotificationService.tiChengInviteRecieved(uid, invitemoney);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | for (String orderId : drawBackOrders)
|
| | | taoBaoWeiQuanDrawBackService.doWeiQuanInvite(orderId);
|
| | | }
|
| | |
|
| | | hbIdList.clear();
|
| | | drawBackOrders.clear();
|
| | |
|
| | | /**
|
| | | * 处理分享赚
|
| | | */
|
| | | BigDecimal sharemoney = new BigDecimal(0);
|
| | | // 查询UID的分享赚订单
|
| | | List<PidOrder> pidOrderList = pidOrderMapper.getCanBalanceListByUid(uid);
|
| | | for (PidOrder pidOrder : pidOrderList) {
|
| | |
| | | if (hongBao == null)
|
| | | continue;
|
| | | if (hongBao.getState() == HongBao.STATE_BUKELINGQU || hongBao.getState() == HongBao.STATE_KELINGQU) {
|
| | | money = money.add(hongBao.getMoney());
|
| | | sharemoney = sharemoney.add(hongBao.getMoney());
|
| | | HongBao updateHongBao = new HongBao();
|
| | | updateHongBao.setId(hongBao.getId());
|
| | | updateHongBao.setGetTime(System.currentTimeMillis());
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 处理一级二级分享赚
|
| | | */
|
| | |
|
| | | List<HongBao> totalHongBaoList = new ArrayList<>();
|
| | | // 查询UID的二级或者三级分享赚订单
|
| | | // TODO 暂时查询10000条数据,后面再做分页
|
| | | List<HongBao> hbList = hongBaoMapper.selectCanBalanceHongBaoByTypeAndUid(HongBao.TYPE_SHARE_YIJI, uid, 10000);
|
| | |
|
| | | if (hbList != null && hbList.size() > 0)
|
| | | totalHongBaoList.addAll(hbList);
|
| | |
|
| | | hbList = hongBaoMapper.selectCanBalanceHongBaoByTypeAndUid(HongBao.TYPE_SHARE_ERJI, uid, 10000);
|
| | | if (hbList != null && hbList.size() > 0)
|
| | | totalHongBaoList.addAll(hbList);
|
| | |
|
| | | for (HongBao hb : totalHongBaoList) {
|
| | | if (hb.getState() == HongBao.STATE_BUKELINGQU || hb.getState() == HongBao.STATE_KELINGQU) {
|
| | | hb = filterWeiQuanINGHongBao(hb);
|
| | | if (hb == null)
|
| | | continue;
|
| | | money = money.add(hb.getMoney());
|
| | | HongBao updateHongBao = new HongBao();
|
| | | updateHongBao.setId(hb.getId());
|
| | | updateHongBao.setGetTime(System.currentTimeMillis());
|
| | | updateHongBao.setState(HongBao.STATE_YILINGQU);
|
| | | hongBaoMapper.updateByPrimaryKeySelective(updateHongBao);
|
| | | // 添加到红包返利记录集合
|
| | | hbIdList.add(hb.getId());
|
| | | if (!StringUtil.isNullOrEmpty(hb.getOrderId()))
|
| | | drawBackOrders.add(hb.getOrderId());
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 增加用户资金记录
|
| | | * 分享赚到账
|
| | | */
|
| | |
|
| | | if (money.compareTo(new BigDecimal(0)) > 0) {
|
| | | userInfoMapper.addHongBaoByUid(uid, money);
|
| | | if (sharemoney.compareTo(new BigDecimal(0)) > 0) {
|
| | | userInfoMapper.addHongBaoByUid(uid, sharemoney);
|
| | | // 添加记录
|
| | | AccountDetails accountDetails = AccountDetailsFactory.create("+" + money, AccountDetailsFactory.TICHENG,
|
| | | null, null, new UserInfo(uid));
|
| | | AccountDetails accountDetails = AccountDetailsFactory.create("+" + sharemoney,
|
| | | AccountDetailsFactory.SHARE_GOODS, null, null, new UserInfo(uid));
|
| | | accountDetailsMapper.insertSelective(accountDetails);
|
| | |
|
| | | // 添加新版详情记录
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createShare(uid, 0, 0, 0, sharemoney,
|
| | | new Date());
|
| | | userMoneyDetail.setId(accountDetails.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | // 记录返利红包与资金详情的对应关系
|
| | |
|
| | | // 添加到红包返利记录集合
|
| | |
| | | // 发送推送
|
| | | try {
|
| | | // 提成到账消息通知
|
| | | userNotificationService.tiChengRecieved(uid, money);
|
| | | userNotificationService.tiChengShareRecieved(uid, sharemoney);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | for (String orderId : drawBackOrders)
|
| | | taoBaoWeiQuanDrawBackService.doWeiQuanShare(orderId);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.factory.AccountDetailsFactory;
|
| | | import com.yeshi.fanli.util.factory.HongBaoFactory;
|
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
|
| | |
|
| | | @Service
|
| | |
| | | // 结算到账户
|
| | |
|
| | | @Override
|
| | | public void balanceOrder() {
|
| | | // 获取到该月25日可结算的订单
|
| | | List<PidOrder> list = pidOrderMapper.getCanBalanceList(1000);
|
| | | if (list != null) {
|
| | | Map<String, List<PidOrder>> map = parseOrderMap(list);
|
| | | Iterator<String> its = map.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | | String orderId = its.next();
|
| | | List<PidOrder> orders = map.get(orderId);
|
| | | for (int i = 0; i < orders.size(); i++)
|
| | | balanceOrder(orders.get(i));
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void compareOrderAndHongBao() {
|
| | | List<PidOrder> list = pidOrderMapper.selectByState("订单付款", 100);
|
| | | list.addAll(pidOrderMapper.selectByState("订单结算", 100));
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void balanceOrder(PidOrder pidOrder) {
|
| | | if (pidOrder.getHongBao() == null)
|
| | | return;
|
| | | // 查找红包
|
| | | HongBao hongBao = hongBaoMapper.selectByPrimaryKey(pidOrder.getHongBao().getId());
|
| | | if (hongBao.getState() == HongBao.STATE_SHIXIAO || hongBao.getState() == HongBao.STATE_YILINGQU)
|
| | | return;
|
| | |
|
| | | HongBao updateHongBao = new HongBao();
|
| | | updateHongBao.setId(hongBao.getId());
|
| | | updateHongBao.setGetTime(System.currentTimeMillis());
|
| | | updateHongBao.setState(HongBao.STATE_YILINGQU);
|
| | | hongBaoMapper.updateByPrimaryKeySelective(updateHongBao);
|
| | |
|
| | | // 加入用户余额
|
| | | userInfoMapper.addHongBaoByUid(hongBao.getUserInfo().getId(), hongBao.getMoney());
|
| | | // 加入账户明细
|
| | | AccountDetails ad = AccountDetailsFactory.create("+" + hongBao.getMoney(), AccountDetailsFactory.SHARE_GOODS,
|
| | | null, null, hongBao.getUserInfo());
|
| | | accountDetailsMapper.insertSelective(ad);
|
| | | try {
|
| | | userNotificationService.tiChengRecieved(hongBao.getUserInfo().getId(), hongBao.getMoney());
|
| | | } catch (Exception e) {
|
| | | }
|
| | |
|
| | | PidOrder updatePidOrder = new PidOrder();
|
| | | updatePidOrder.setId(pidOrder.getId());
|
| | | updatePidOrder.setAccountBalance(true);
|
| | | updatePidOrder.setAccountBalanceTime(new Date());
|
| | | pidOrderMapper.updateByPrimaryKeySelective(updatePidOrder);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void weiQuan(String orderId) {
|
| | |
| | | AccountDetailsFactory.SHARE_GOODS_DRAWBACK, null, null, hongBao.getUserInfo());
|
| | | accountDetailsMapper.insertSelective(ad);
|
| | |
|
| | | |
| | | |
| | |
|
| | | // 维权通知
|
| | | try {
|
| | | userNotificationService.weiQuanTiCheng(hongBao.getUserInfo().getId(), orderId,
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.AccountDetailsMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.UserInfoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.hongbao.HongBaoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.money.UserMoneyDetailMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoOrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanDrawBackMapper;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountDetails;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanDrawBack;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | 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.taobao.TaoBaoWeiQuanDrawBackService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoWeiQuanOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.UserNotificationService;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.factory.AccountDetailsFactory;
|
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
|
| | |
|
| | | @Service
|
| | | public class TaoBaoWeiQuanDrawBackServiceImpl implements TaoBaoWeiQuanDrawBackService {
|
| | |
| | |
|
| | | @Resource
|
| | | private UserInfoMapper userInfoMapper;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyDetailMapper userMoneyDetailMapper;
|
| | |
|
| | | @Resource
|
| | | private AccountDetailsMapper accountDetailsMapper;
|
| | |
| | | BigDecimal userGetMoney = fanMoneyMap.get(uid);
|
| | | BigDecimal fanMoney = new BigDecimal("0");
|
| | | // 统计用户在这个单中需要扣除的资金
|
| | | TaoBaoWeiQuanDrawBack weiQuanDrawBack = null;
|
| | | for (TaoBaoWeiQuanOrder weiQuanOrder : list) {
|
| | | TaoBaoWeiQuanDrawBack weiQuanDrawBack = taoBaoWeiQuanDrawBackMapper
|
| | | .selectByOrderItemIdAndUid(weiQuanOrder.getOrderItemId(), uid);
|
| | | weiQuanDrawBack = taoBaoWeiQuanDrawBackMapper.selectByOrderItemIdAndUid(weiQuanOrder.getOrderItemId(),
|
| | | uid);
|
| | | if (weiQuanDrawBack != null)
|
| | | continue;
|
| | | // 退款的资金
|
| | |
| | | AccountDetails accountDetails = AccountDetailsFactory.create("-" + drawBackMoney,
|
| | | AccountDetailsFactory.SHARE_GOODS_DRAWBACK, null, null, new UserInfo(uid));
|
| | | accountDetailsMapper.insertSelective(accountDetails);
|
| | | // 新版资金记录
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createFanLiWeiQuan(uid, weiQuanDrawBack,
|
| | | drawBackMoney);
|
| | | userMoneyDetail.setId(accountDetails.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | userNotificationService.weiQuanFanli(uid, orderId, drawBackMoney);
|
| | | }
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void doWeiQuanShare(String orderId) throws TaoBaoWeiQuanException {
|
| | | if (StringUtil.isNullOrEmpty(orderId))
|
| | |
| | | BigDecimal userGetMoney = fanMoneyMap.get(uid);
|
| | | BigDecimal fanMoney = new BigDecimal("0");
|
| | | // 统计用户在这个单中需要扣除的资金
|
| | | TaoBaoWeiQuanDrawBack weiQuanDrawBack = null;
|
| | | for (TaoBaoWeiQuanOrder weiQuanOrder : list) {
|
| | | TaoBaoWeiQuanDrawBack weiQuanDrawBack = taoBaoWeiQuanDrawBackMapper
|
| | | .selectByOrderItemIdAndUid(weiQuanOrder.getOrderItemId(), uid);
|
| | | weiQuanDrawBack = taoBaoWeiQuanDrawBackMapper.selectByOrderItemIdAndUid(weiQuanOrder.getOrderItemId(),
|
| | | uid);
|
| | | if (weiQuanDrawBack != null)
|
| | | continue;
|
| | | // 退款的资金
|
| | |
| | | AccountDetails accountDetails = AccountDetailsFactory.create("-" + drawBackMoney,
|
| | | AccountDetailsFactory.SHARE_GOODS_DRAWBACK, null, null, new UserInfo(uid));
|
| | | accountDetailsMapper.insertSelective(accountDetails);
|
| | | // 新版资金记录
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createShareWeiQuan(uid, weiQuanDrawBack,
|
| | | drawBackMoney);
|
| | | userMoneyDetail.setId(accountDetails.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | userNotificationService.weiQuanTiCheng(uid, orderId, drawBackMoney);
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | | public void doWeiQuanInvite(String orderId) throws TaoBaoWeiQuanException {
|
| | | if (StringUtil.isNullOrEmpty(orderId))
|
| | | throw new TaoBaoWeiQuanException(1, "订单号为空值");
|
| | | // 查询是否为维权订单
|
| | | List<TaoBaoWeiQuanOrder> list = taoBaoWeiQuanOrderService.getWeiQuanSuccessOrders(orderId);
|
| | | if (list == null || list.size() == 0)
|
| | | return;
|
| | | // 查询订单库
|
| | | List<TaoBaoOrder> orderList = taoBaoOrderMapper.selectTaoBaoOrderByOrderId(orderId);
|
| | | // 计算淘宝联盟返给平台的资金
|
| | | BigDecimal sumFee = new BigDecimal("0");
|
| | | for (TaoBaoOrder order : orderList)
|
| | | if (order.getOrderState().equalsIgnoreCase("订单结算"))
|
| | | sumFee = sumFee.add(order.geteIncome());
|
| | | // 获取和该订单号有关联的用户
|
| | | // 获取主红包(同一个订单号的单只会对应同一个用户)
|
| | | List<HongBao> mainHongBaoList = hongBaoMapper.selectByOrderIdWithoutChild(orderId);
|
| | | if (mainHongBaoList == null || mainHongBaoList.size() == 0)
|
| | | return;
|
| | |
|
| | | // 主用户ID
|
| | | Map<Long, BigDecimal> fanMoneyMap = new HashMap<>();
|
| | |
|
| | | if (mainHongBaoList != null)
|
| | | for (HongBao hongBao : mainHongBaoList) {
|
| | | if (hongBao.getState() == HongBao.STATE_SHIXIAO)
|
| | | continue;
|
| | | // 返利红包不计入
|
| | | if (hongBao.getType() != HongBao.TYPE_TAOBAO) {
|
| | | // 累计主红包的金额
|
| | | if (fanMoneyMap.get(hongBao.getUserInfo().getId()) == null) {
|
| | | fanMoneyMap.put(hongBao.getUserInfo().getId(), hongBao.getMoney());
|
| | | } else
|
| | | fanMoneyMap.put(hongBao.getUserInfo().getId(),
|
| | | fanMoneyMap.get(hongBao.getUserInfo().getId()).add(hongBao.getMoney()));
|
| | | }
|
| | | // 累计子红包的金额
|
| | | List<HongBao> childHongBaoList = hongBaoMapper.selectChildHongBaoByPid(hongBao.getId());
|
| | | if (childHongBaoList != null)
|
| | | for (HongBao child : childHongBaoList) {
|
| | | if (child.getState() == HongBao.STATE_SHIXIAO)
|
| | | continue;
|
| | | if (fanMoneyMap.get(child.getUserInfo().getId()) == null) {
|
| | | fanMoneyMap.put(child.getUserInfo().getId(), child.getMoney());
|
| | | } else
|
| | | fanMoneyMap.put(child.getUserInfo().getId(),
|
| | | fanMoneyMap.get(child.getUserInfo().getId()).add(child.getMoney()));
|
| | | }
|
| | | }
|
| | |
|
| | | // 计算每个用户的返利比例
|
| | | Iterator<Long> its = fanMoneyMap.keySet().iterator();
|
| | | while (its.hasNext()) {
|
| | | Long uid = its.next();
|
| | | BigDecimal userGetMoney = fanMoneyMap.get(uid);
|
| | | BigDecimal fanMoney = new BigDecimal("0");
|
| | | // 统计用户在这个单中需要扣除的资金
|
| | | TaoBaoWeiQuanDrawBack weiQuanDrawBack = null;
|
| | | for (TaoBaoWeiQuanOrder weiQuanOrder : list) {
|
| | | weiQuanDrawBack = taoBaoWeiQuanDrawBackMapper.selectByOrderItemIdAndUid(weiQuanOrder.getOrderItemId(),
|
| | | uid);
|
| | | if (weiQuanDrawBack != null)
|
| | | continue;
|
| | | // 退款的资金
|
| | | fanMoney = fanMoney.add(weiQuanOrder.getFanMoney());
|
| | | // 插入记录
|
| | | weiQuanDrawBack = new TaoBaoWeiQuanDrawBack();
|
| | | weiQuanDrawBack.setCreateTime(new Date());
|
| | | // TODO 暂时设为0
|
| | | weiQuanDrawBack.setDrawBackMoney(new BigDecimal(0));
|
| | | weiQuanDrawBack.setOrderId(weiQuanOrder.getOrderId());
|
| | | weiQuanDrawBack.setOrderItemId(weiQuanOrder.getOrderItemId());
|
| | | weiQuanDrawBack.setUser(new UserInfo(uid));
|
| | | taoBaoWeiQuanDrawBackMapper.insertSelective(weiQuanDrawBack);
|
| | | }
|
| | |
|
| | | if (fanMoney.compareTo(new BigDecimal("0")) <= 0)
|
| | | continue;
|
| | |
|
| | | // 退款金额
|
| | | BigDecimal drawBackMoney = MoneyBigDecimalUtil.div(userGetMoney.multiply(fanMoney), sumFee);
|
| | | userInfoMapper.subHongBaoByUid(uid, drawBackMoney);
|
| | | // 添加资金记录
|
| | | AccountDetails accountDetails = AccountDetailsFactory.create("-" + drawBackMoney,
|
| | | AccountDetailsFactory.SHARE_GOODS_DRAWBACK, null, null, new UserInfo(uid));
|
| | | accountDetailsMapper.insertSelective(accountDetails);
|
| | |
|
| | | // 新版资金记录
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createInviteWeiQuan(uid, weiQuanDrawBack,
|
| | | drawBackMoney);
|
| | | userMoneyDetail.setId(accountDetails.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | //
|
| | |
|
| | | userNotificationService.weiQuanTiCheng(uid, orderId, drawBackMoney);
|
| | | }
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.AlipayAccountValidNormalHistoryMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.BindingAccountMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.UserInfoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.money.UserMoneyDetailMapper;
|
| | | import com.yeshi.fanli.dao.user.BindingAccountDao;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountDetails;
|
| | | import com.yeshi.fanli.entity.bus.user.AlipayAccountValidNormalHistory;
|
| | | import com.yeshi.fanli.entity.bus.user.BindingAccount;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.exception.AlipayAccountException;
|
| | | import com.yeshi.fanli.exception.AlipayTransferException;
|
| | | import com.yeshi.fanli.exception.BindingAccountException;
|
| | | import com.yeshi.fanli.exception.money.UserMoneyDetailException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.user.BindingAccountService;
|
| | | import com.yeshi.fanli.service.inter.user.UserNotificationService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.factory.AccountDetailsFactory;
|
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | |
| | | private AccountDetailsMapper accountDetailsMapper;
|
| | | @Resource
|
| | | private UserNotificationService userNotificationService;
|
| | | |
| | | @Resource
|
| | | private UserMoneyDetailMapper userMoneyDetailMapper;
|
| | |
|
| | | public List<BindingAccount> getBindingAccountByUid(long uid) {
|
| | | return bindingAccountDao.list("from BindingAccount ba where ba.userInfo.id=?", new Serializable[] { uid });
|
| | |
| | | AccountDetails accountDetails = AccountDetailsFactory.create("-" + money.toString(),
|
| | | AccountDetailsFactory.VALID_ALIPAY_ACCOUNT, null, null, new UserInfo(uid));
|
| | | accountDetailsMapper.insertSelective(accountDetails);
|
| | | // 新版资金
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createExtractAccountValid(history, money);
|
| | | userMoneyDetail.setId(accountDetails.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | userNotificationService.alipayAccountValidRight(uid, money, account);
|
| | |
|
| | | }
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.SystemMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.UserInfoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.hongbao.HongBaoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.money.UserMoneyDetailMapper;
|
| | | import com.yeshi.fanli.dao.user.AccountDetailsDao;
|
| | | import com.yeshi.fanli.dao.user.AccountMessageDao;
|
| | | import com.yeshi.fanli.dao.user.ExtractDao;
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.PayInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.common.AdminUser;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.exception.ExtractException;
|
| | | import com.yeshi.fanli.exception.NotExistObjectException;
|
| | | import com.yeshi.fanli.exception.ObjectStateException;
|
| | | import com.yeshi.fanli.exception.money.UserMoneyDetailException;
|
| | | 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.hongbao.HongBaoService;
|
| | | import com.yeshi.fanli.service.inter.push.PushService;
|
| | | import com.yeshi.fanli.service.inter.user.AccountDetailsService;
|
| | | import com.yeshi.fanli.service.inter.user.AccountMessageService;
|
| | |
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.factory.AccountDetailsFactory;
|
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private UserNotificationService userNotificationService;
|
| | | |
| | | @Resource
|
| | | private UserMoneyDetailMapper userMoneyDetailMapper;
|
| | |
|
| | | @Resource
|
| | | private AlipayAccountValidNormalHistoryMapper alipayAccountValidNormalHistoryMapper;
|
| | |
| | | AccountDetails ad = AccountDetailsFactory.create("+" + find.getMoney(), AccountDetailsFactory.HUIKUAN, null,
|
| | | find, find.getUserInfo());
|
| | | accountDetailsMapper.insertSelective(ad);
|
| | | // 新版资金详情
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createExtractReject(find);
|
| | | userMoneyDetail.setId(find.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e2) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e2);
|
| | | } catch (Exception e3) {
|
| | | e3.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | try {
|
| | | UserMoneyDetailFactory.createExtractReject(find);
|
| | | } catch (UserMoneyDetailException e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | |
|
| | | try {
|
| | | userNotificationService.extractWrong(user.getId(), find,
|
| | | TimeUtil.getGernalTime(find.getExtractTime(), "yyyy-MM-dd HH:mm"));
|
| | |
| | | AccountDetails ad = AccountDetailsFactory.create("-" + extract.getMoney(), AccountDetailsFactory.TIXIAN, null,
|
| | | extract, user);
|
| | | accountDetailsMapper.insertSelective(ad);
|
| | | |
| | | // 新版资金详情
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createExtract(extract);
|
| | | userMoneyDetail.setId(extract.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e2) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e2);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | userNotificationService.extractApply(extract.getUserInfo().getId());
|
| | |
|
| | |
| | | null, extract, extract.getUserInfo());
|
| | | accountDetailsMapper.insertSelective(ad);
|
| | |
|
| | | // 新版资金详情
|
| | | try {
|
| | | UserMoneyDetail userMoneyDetail = UserMoneyDetailFactory.createExtractReject(extract);
|
| | | userMoneyDetail.setId(extract.getId());
|
| | | userMoneyDetailMapper.insert(userMoneyDetail);
|
| | | } catch (UserMoneyDetailException e2) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e2);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | try {
|
| | |
|
| | | userNotificationService.extractTransferFail(user.getId(),
|
| | |
| | | import java.util.ArrayList;
|
| | | import java.util.Calendar;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.HashSet;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | |
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTimeInMillis(list.get(0).getCreateTime().getTime());
|
| | | UserMoneyDetailHistoryVO vo = new UserMoneyDetailHistoryVO();
|
| | | vo.setMonth(new UserMonthMoneyVO(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH)));
|
| | | vo.setMonth(new UserMonthMoneyVO(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH)+1));
|
| | | finalList.add(vo);
|
| | | }
|
| | | } else {// 二次请求
|
| | |
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTimeInMillis(list.get(i).getCreateTime().getTime());
|
| | | UserMoneyDetailHistoryVO vo = new UserMoneyDetailHistoryVO();
|
| | | vo.setMonth(new UserMonthMoneyVO(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH)));
|
| | | vo.setMonth(new UserMonthMoneyVO(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH)+1));
|
| | | finalList.add(vo);
|
| | | }
|
| | | UserMoneyDetailHistoryVO vo = new UserMoneyDetailHistoryVO();
|
| | |
| | | // 统计月资金
|
| | |
|
| | | Map<Integer, UserMoneyDetailHistoryVO> monthMap = new TreeMap<>();
|
| | | if(finalList.size()>1)
|
| | | for (int i = 0; i < finalList.size(); i++) {
|
| | | if (finalList.get(i).getMonth() != null)
|
| | | monthMap.put(i, finalList.get(i));
|
| | | }
|
| | |
|
| | | if (!monthMap.isEmpty()) {
|
| | | List<String> dateFormat = new ArrayList<>();
|
| | | Iterator<Integer> keys = monthMap.keySet().iterator();
|
| | | while (keys.hasNext()) {
|
| | |
| | | finalList.get(key).getMonth().setIncome(voList.get(p).getIncome());
|
| | | p++;
|
| | | }
|
| | | }
|
| | | return finalList;
|
| | | }
|
| | |
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.exception.PushException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.push.PushService;
|
| | | import com.yeshi.fanli.service.inter.user.SMSService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserNotificationService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | | public class UserNotificationServiceImpl implements UserNotificationService {
|
| | |
| | |
|
| | | @Override
|
| | | public void newerHongBao(Long uid, BigDecimal money) {
|
| | | if(Constant.IS_TEST)
|
| | | return;
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getNewerHongbaoTitle(),
|
| | | Constant.znxConfig.getNewerHongbaoMsg().replace("[金额]", money.toString()));
|
| | |
| | |
|
| | | @Override
|
| | | public void orderFanliRecieved(Long uid, String orderId, BigDecimal money) {
|
| | | if(Constant.IS_TEST)
|
| | | return;
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getOrderFanliRecieveTitle(), Constant.znxConfig
|
| | | .getOrderFanliRecieveMsg().replace("[订单号]", orderId).replace("[金额]", money.toString()));
|
| | |
| | |
|
| | | @Override
|
| | | public void tiChengRecieved(Long uid, BigDecimal money) {
|
| | | if(Constant.IS_TEST)
|
| | | return;
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getShareInviteMoneyRecieveTitle(),
|
| | | Constant.znxConfig.getShareInviteMoneyRecieveMsg().replace("[金额]", money.toString()));
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getShareMoneyRecieveTitle(),
|
| | | Constant.znxConfig.getShareMoneyRecieveMsg().replace("[金额]", money.toString()));
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | |
|
| | | @Override
|
| | | public void orderFanliStatisticed(Long uid, String orderId) {
|
| | | if(Constant.IS_TEST)
|
| | | return;
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getFanliOrderStatisticedTitle(),
|
| | | Constant.znxConfig.getFanliOrderStatisticedMsg().replace("[订单号]", orderId));
|
| | |
| | |
|
| | | @Override
|
| | | public void tiChengStatisticed(Long uid, String orderId, BigDecimal money) {
|
| | | if(Constant.IS_TEST)
|
| | | return;
|
| | | orderId = orderId.substring(0, orderId.length() - 6) + "******";
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getTichengOrderStatisticedTitle(), Constant.znxConfig
|
| | |
| | |
|
| | | @Override
|
| | | public void weiQuanFanli(Long uid, String orderId, BigDecimal money) {
|
| | | if(Constant.IS_TEST)
|
| | | return;
|
| | | // 只发送站内信
|
| | | AccountMessage am = new AccountMessage();
|
| | | am.setContent(Constant.znxConfig.getWeiquanDrawbackFanliMsg().replace("[订单号]", orderId).replace("[金额]",
|
| | |
| | |
|
| | | @Override
|
| | | public void weiQuanTiCheng(Long uid, String orderId, BigDecimal money) {
|
| | | if(Constant.IS_TEST)
|
| | | return;
|
| | | orderId = orderId.substring(0, orderId.length() - 6) + "******";
|
| | | AccountMessage am = new AccountMessage();
|
| | | am.setContent(Constant.znxConfig.getWeiquanDrawbackShareMsg().replace("[订单号]", orderId).replace("[金额]",
|
| | |
| | |
|
| | | @Override
|
| | | public void extractApply(Long uid) {
|
| | | if(Constant.IS_TEST)
|
| | | return;
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getExtractApplayTitle(),
|
| | | Constant.znxConfig.getExtractApplayMsg());
|
| | |
| | |
|
| | | @Override
|
| | | public void extractTransferFail(Long uid, String time) {
|
| | | if(Constant.IS_TEST)
|
| | | return;
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getExtractTransferFailTitle(),
|
| | | Constant.znxConfig.getExtractTransferFailMsg().replace("[时间]", time));
|
| | |
| | |
|
| | | @Override
|
| | | public void extractWrong(Long uid, Extract extract, String time) {
|
| | | if(Constant.IS_TEST)
|
| | | return;
|
| | | // 提现失败短信通知
|
| | | // try {
|
| | | // UserInfo user = userInfoService.getUserById(uid);
|
| | |
| | |
|
| | | @Override
|
| | | public void extractSuccess(Long uid, Extract extract, String time) {
|
| | | if(Constant.IS_TEST)
|
| | | return;
|
| | | // 提现成功短信通知
|
| | | // try {
|
| | | // UserInfo user = userInfoService.getUserById(uid);
|
| | |
| | |
|
| | | @Override
|
| | | public void alipayAccountValidRight(Long uid, BigDecimal money, String account) {
|
| | | if(Constant.IS_TEST)
|
| | | return;
|
| | | BindingAccount ba = new BindingAccount();
|
| | | ba.setAccount(account);
|
| | | ba.setName("**");
|
| | |
| | | accountMessageMapper.insertSelective(am);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void tiChengInviteRecieved(Long uid, BigDecimal money) {
|
| | | if(Constant.IS_TEST)
|
| | | return;
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getInviteMoneyRecieveTitle(),
|
| | | Constant.znxConfig.getInviteMoneyRecieveMsg().replace("[金额]", money.toString()));
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void tiChengShareRecieved(Long uid, BigDecimal money) {
|
| | | if(Constant.IS_TEST)
|
| | | return;
|
| | | try {
|
| | | pushService.pushZNX(uid, Constant.znxConfig.getShareMoneyRecieveTitle(),
|
| | | Constant.znxConfig.getShareMoneyRecieveMsg().replace("[金额]", money.toString()));
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public void doPidOrder(String orderId);
|
| | |
|
| | | /**
|
| | | * 结算订单,将订单中的余额结算
|
| | | */
|
| | | public void balanceOrder();
|
| | |
|
| | | /**
|
| | | * 按单个订单结算
|
| | | * |
| | | * @param pidOrder
|
| | | */
|
| | | public void balanceOrder(PidOrder pidOrder);
|
| | |
|
| | | /**
|
| | | * 对比分享赚订单与红包
|
| | |
| | | public void doWeiQuanFanli(String orderId) throws TaoBaoWeiQuanException;
|
| | |
|
| | | /**
|
| | | * 处理维权-子订单(分享赚与邀请赚)
|
| | | * 处理维权-子订单(分享赚)
|
| | | *
|
| | | * @param hongBao
|
| | | */
|
| | | public void doWeiQuanShare(String orderId) throws TaoBaoWeiQuanException;
|
| | |
|
| | | /**
|
| | | * 维权处理-子订单(邀请赚)
|
| | | * |
| | | * @param orderId
|
| | | * @throws TaoBaoWeiQuanException
|
| | | */
|
| | | public void doWeiQuanInvite(String orderId) throws TaoBaoWeiQuanException;
|
| | | }
|
| | |
| | | * @param money
|
| | | */
|
| | | public void tiChengRecieved(Long uid, BigDecimal money);
|
| | | |
| | | |
| | | /**
|
| | | * 邀请提成到账
|
| | | * @param uid
|
| | | * @param money
|
| | | */
|
| | | public void tiChengInviteRecieved(Long uid, BigDecimal money);
|
| | | |
| | | |
| | | /**
|
| | | * 分享提成到账
|
| | | * @param uid
|
| | | * @param money
|
| | | */
|
| | | public void tiChengShareRecieved(Long uid, BigDecimal money);
|
| | |
|
| | |
|
| | | /**
|
| | | * 订单被统计
|
| | |
| | | * @param hongBaoList
|
| | | * @return
|
| | | */
|
| | | public static UserMoneyDetail createFanLi(Long uid, String orderId, int orderType, BigDecimal money)
|
| | | public static UserMoneyDetail createFanLi(Long uid, String orderId, int orderType,Long hbId, BigDecimal money)
|
| | | throws UserMoneyDetailException {
|
| | |
|
| | | if (StringUtil.isNullOrEmpty(orderId))
|
| | |
| | | UserMoneyDetail detail = new UserMoneyDetail();
|
| | | detail.setCreateTime(new Date());
|
| | | detail.setIdentifyCode(
|
| | | StringUtil.Md5(UserMoneyDetailTypeEnum.fanli.name() + "-" + uid + "-" + orderType + "-" + orderId));
|
| | | StringUtil.Md5(UserMoneyDetailTypeEnum.fanli.name() + "-" + uid + "-" + orderType + "-" + orderId+"-"+hbId));
|
| | | detail.setMoney(money);
|
| | | detail.setTitle(UserMoneyDetailTypeEnum.fanli.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.fanli);
|
| | |
| | | detail.setMoney(money);
|
| | | detail.setTitle(timeF + UserMoneyDetailTypeEnum.invite.getDesc());
|
| | | detail.setType(UserMoneyDetailTypeEnum.invite);
|
| | | if (validCount != 0 || weiQuanCount != 0 || invalidCount != 0)
|
| | | detail.setDescInfo(String.format("有效订单:%s笔 维权订单:%s笔 失效订单:%s笔", validCount, weiQuanCount, invalidCount));
|
| | | detail.setUpdateTime(new Date());
|
| | | detail.setUserInfo(new UserInfo(uid));
|
| | |
| | |
|
| | |
|
| | |
|
| | | #分享赚和邀请赚上月收入到账提示
|
| | | share_invite_money_recieve_title=分享奖金和邀请奖金上月收入到账提示
|
| | | share_invite_money_recieve_push=来自你的分享奖金和邀请奖金上月提成收入总计:¥[金额]元已经转入到你的余额中
|
| | | share_invite_money_recieve_msg=来自你的分享奖金和邀请奖金上月提成收入总计:¥[金额]元已经转入到你的余额中
|
| | | #邀请赚上月收入到账提示
|
| | | invite_money_recieve_title=邀请奖金上月收入到账提示
|
| | | invite_money_recieve_push=来自你的邀请奖金上月收入总计:¥[金额]元已经转入到你的余额中
|
| | | invite_money_recieve_msg=来自你的邀请奖金上月收入总计:¥[金额]元已经转入到你的余额中
|
| | |
|
| | |
|
| | | #分享赚上月收入到账提示
|
| | | share_money_recieve_title=分享奖金上月收入到账提示
|
| | | share_money_recieve_push=来自你的分享奖金上月收入总计:¥[金额]元已经转入到你的余额中
|
| | | share_money_recieve_msg=来自你的分享奖金上月收入总计:¥[金额]元已经转入到你的余额中
|
| | |
|
| | |
|
| | |
|
| | | #售后维权订单扣款提示
|
| | | weiquan_drawback_fanli_title=售后维权订单扣款提示
|
| | |
| | | weiquan_drawback_fanli_msg=您有一个【订单号:[订单号]】 的返利订单,淘宝已维权成功退款,其 订单对应的提成 ¥[金额]元,将从你的余额中扣出。因为订单出现退款或售后,淘宝将会扣除相应返利,所以返利券也无法提供返利,非常遗憾。温馨提示:请勿恶意提交售后申请,淘宝会对其做相应的处罚;我们也倡导用户诚信网购。
|
| | |
|
| | |
|
| | | weiquan_drawback_invite_title=售后维权订单扣款提示
|
| | | weiquan_drawback_invite_push=您有一个【订单号:[订单号]】的邀请订单,淘宝已维权成功退款,其 订单对应的返利 ¥[金额]元,将从你的余额中扣出。因为订单出现退款或售后,淘宝将会扣除相应返利,所以返利券也无法提供奖金,非常遗憾。温馨提示:请勿恶意提交售后申请,淘宝会对其做相应的处罚;我们也倡导用户诚信网购。
|
| | | weiquan_drawback_invite_msg=您有一个【订单号:[订单号]】 的邀请订单,淘宝已维权成功退款,其 订单对应的提成 ¥[金额]元,将从你的余额中扣出。因为订单出现退款或售后,淘宝将会扣除相应返利,所以返利券也无法提供奖金,非常遗憾。温馨提示:请勿恶意提交售后申请,淘宝会对其做相应的处罚;我们也倡导用户诚信网购。
|
| | |
|
| | |
|
| | | weiquan_drawback_share_title=售后维权订单扣款提示
|
| | | weiquan_drawback_share_push=您有一个【订单号:[订单号]】的奖金订单,淘宝已维权成功退款,其 订单对应的返利 ¥[金额]元,将从你的余额中扣出。因为订单出现退款或售后,淘宝将会扣除相应返利,所以返利券也无法提供奖金,非常遗憾。温馨提示:请勿恶意提交售后申请,淘宝会对其做相应的处罚;我们也倡导用户诚信网购。
|
| | | weiquan_drawback_share_msg=您有一个【订单号:[订单号]】 的奖金订单,淘宝已维权成功退款,其 订单对应的提成 ¥[金额]元,将从你的余额中扣出。因为订单出现退款或售后,淘宝将会扣除相应返利,所以返利券也无法提供奖金,非常遗憾。温馨提示:请勿恶意提交售后申请,淘宝会对其做相应的处罚;我们也倡导用户诚信网购。
|
| | | weiquan_drawback_share_push=您有一个【订单号:[订单号]】的分享订单,淘宝已维权成功退款,其 订单对应的返利 ¥[金额]元,将从你的余额中扣出。因为订单出现退款或售后,淘宝将会扣除相应返利,所以返利券也无法提供奖金,非常遗憾。温馨提示:请勿恶意提交售后申请,淘宝会对其做相应的处罚;我们也倡导用户诚信网购。
|
| | | weiquan_drawback_share_msg=您有一个【订单号:[订单号]】 的分享订单,淘宝已维权成功退款,其 订单对应的提成 ¥[金额]元,将从你的余额中扣出。因为订单出现退款或售后,淘宝将会扣除相应返利,所以返利券也无法提供奖金,非常遗憾。温馨提示:请勿恶意提交售后申请,淘宝会对其做相应的处罚;我们也倡导用户诚信网购。
|
| | |
|
| | |
|
| | |
|