Merge branch 'dev-hongbao'
| | |
| | | } catch (SwiperPictureException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | |
| | | data.put("desc", configService.get("invite_desc"));
|
| | | |
| | |
|
| | | com.alibaba.fastjson.JSONObject root = new com.alibaba.fastjson.JSONObject();
|
| | | root.put("code", 0);
|
| | |
| | | import javax.servlet.http.HttpServletRequest;
|
| | | import javax.servlet.http.HttpSession;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.alipay.api.AlipayApiException;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.user.BindingAccount;
|
| | |
| | | import com.yeshi.fanli.service.inter.config.SystemService;
|
| | | 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.hongbao.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.order.LostOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderItemServcie;
|
| | |
| | | import com.yeshi.fanli.service.inter.user.TBPidService;
|
| | | import com.yeshi.fanli.service.inter.user.UserAccountService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.GsonUtil;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.account.UserUtil;
|
| | | import com.yeshi.fanli.util.wx.WXLoginUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | /**
|
| | | * 账户系统
|
| | |
| | |
|
| | | @Resource
|
| | | private HongBaoService hongBaoService;
|
| | | |
| | | @Resource
|
| | | private HongBaoV2Service hongBaoV2Service;
|
| | |
|
| | | @Resource
|
| | | private BindingAccountService bindingAccountService;
|
| | |
| | | }
|
| | |
|
| | | BigDecimal moneyLastMonth = inviteGetMoneyService.getMoneyLastMonth(uid + "");
|
| | | BigDecimal unOpenmoney = hongBaoService.getUnOpenHongBaoByUid(uid);
|
| | | BigDecimal totalFanMoney = hongBaoService.getMyTotalHongBaoByUid(user.getId());
|
| | | BigDecimal unOpenmoney = hongBaoV2Service.getUnRecievedFanLiMoney(uid);
|
| | | BigDecimal totalFanMoney = hongBaoV2Service.getTotalFanLiMoney(uid);
|
| | | JSONObject data = new JSONObject();
|
| | | // IOS端数字按照字符串处理
|
| | | if ("ios".equalsIgnoreCase(acceptData.getPlatform()) && Integer.parseInt(acceptData.getVersion()) > 33) {
|
| | |
| | | data.put("money", user.getMyHongBao().toString());
|
| | | data.put("unGetMoney", unOpenmoney.toString());
|
| | | data.put("totalFanLiMoney", totalFanMoney.toString());// 累计返利
|
| | | data.put("totalTiChengMoney", hongBaoService.getTotalTiChengMoney(uid).toString());// 累计提成
|
| | | data.put("totalUnGetTiChengMoney", hongBaoService.getUnGetTiChengMoney(uid).toString()); // 未到账提成
|
| | | data.put("totalTiChengMoney", hongBaoV2Service.getTotalTiChengMoney(uid).toString());// 累计提成
|
| | | data.put("totalUnGetTiChengMoney", hongBaoV2Service.getUnGetTiChengMoney(uid).toString()); // 未到账提成
|
| | | // 展示提成数据
|
| | | data.put("showTiCheng", hongBaoService.getTotalTiChengCount(uid) > 0);
|
| | | } else {
|
| | |
| | | data.put("money", user.getMyHongBao());
|
| | | data.put("unGetMoney", unOpenmoney);
|
| | | data.put("totalFanLiMoney", totalFanMoney);// 累计返利
|
| | | data.put("totalTiChengMoney", hongBaoService.getTotalTiChengMoney(uid));// 累计提成
|
| | | data.put("totalUnGetTiChengMoney", hongBaoService.getUnGetTiChengMoney(uid)); // 未到账提成
|
| | | data.put("totalTiChengMoney", hongBaoV2Service.getTotalTiChengMoney(uid));// 累计提成
|
| | | data.put("totalUnGetTiChengMoney", hongBaoV2Service.getUnGetTiChengMoney(uid)); // 未到账提成
|
| | | // 展示提成数据
|
| | | data.put("showTiCheng", hongBaoService.getTotalTiChengCount(uid) > 0);
|
| | | data.put("showTiCheng", hongBaoV2Service.getTotalTiChengCount(uid) > 0);
|
| | | }
|
| | |
|
| | | user.setNoOpenHongBao(unOpenmoney);
|
| | |
| | | import org.yeshi.utils.IPUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.NumberUtil;
|
| | | import org.yeshi.utils.taobao.TbImgUtil;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | |
| | | import com.google.gson.JsonPrimitive;
|
| | | import com.google.gson.JsonSerializationContext;
|
| | | import com.google.gson.JsonSerializer;
|
| | | import com.yeshi.fanli.dto.HongBaoDTO;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountDetails;
|
| | | import com.yeshi.fanli.entity.bus.user.AccountMessage;
|
| | |
| | | import com.yeshi.fanli.entity.goods.CollectionGoodsV2;
|
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | import com.yeshi.fanli.entity.system.System;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra;
|
| | |
| | | import com.yeshi.fanli.service.inter.goods.CollectionGoodsV2Service;
|
| | | 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.hongbao.ThreeSaleExtraInfoSerivce;
|
| | | import com.yeshi.fanli.service.inter.hongbao.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.LostOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderItemServcie;
|
| | | import com.yeshi.fanli.service.inter.order.OrderService;
|
| | |
| | | import com.yeshi.fanli.util.account.UserUtil;
|
| | | import com.yeshi.fanli.util.email.MailSenderUtil;
|
| | | import com.yeshi.fanli.util.factory.AccountDetailsFactory;
|
| | | import com.yeshi.fanli.util.factory.HongBaoFactory;
|
| | | import com.yeshi.fanli.util.factory.OrderItemFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import com.yeshi.fanli.util.wx.WXLoginUtil;
|
| | |
| | | @Resource
|
| | | private OrderItemServcie orderItemServcie;
|
| | |
|
| | |
|
| | | @Resource
|
| | | private AccountMessageService accountMessageService;
|
| | |
|
| | |
| | |
|
| | | @Resource
|
| | | private UserMoneyDetailService userMoneyDetailService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoOrderService hongBaoOrderService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoV2Service hongBaoV2Service;
|
| | |
|
| | | private static final String PASSWORD_MAX_ERROR = "password_max_error";
|
| | | private static final String EXTRACT_MIN_MONEY = "extract_min_money";
|
| | |
| | |
|
| | | @RequestMapping("findOrderItemList")
|
| | | public void findOrderItemList(AcceptData acceptData, long uid, int page, PrintWriter out) {
|
| | | List<OrderItem> list = orderItemServcie.findOrderItemList(uid, page);
|
| | | list.parallelStream().forEach(oi -> {
|
| | | oi.setDesc();
|
| | | });
|
| | | int count = orderItemServcie.getCount(uid);
|
| | | List<HongBaoOrder> list = hongBaoOrderService.listFanLiOrder(uid, page, Constant.PAGE_SIZE);
|
| | |
|
| | | List<OrderItem> orderList = new ArrayList<>();
|
| | | for (HongBaoOrder oi : list) {
|
| | | OrderItem orderItem = OrderItemFactory.create(oi);
|
| | | orderItem.setDesc();
|
| | | orderItem.setPicture(TbImgUtil.getTBSize220Img(orderItem.getPicture()));
|
| | | orderList.add(orderItem);
|
| | | }
|
| | | long count = hongBaoOrderService.countFanLiOrder(uid);
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().create();
|
| | | JSONObject data = new JSONObject();
|
| | | data.put("list", gson.toJson(list));
|
| | | data.put("list", gson.toJson(orderList));
|
| | | data.put("count", count);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
| | | */
|
| | | @RequestMapping("getTiChengOrderList")
|
| | | public void getTiChengOrderList(AcceptData acceptData, long uid, int page, PrintWriter out) {
|
| | | List<HongBao> list = hongBaoService.getTiChengHongBaoList(uid, page);
|
| | | long count = hongBaoService.getTiChengHongBaoListCount(uid);
|
| | | List<HongBaoDTO> hongBaoDTOList = hongBaoV2Service.listJiangJinByUid(uid, page, Constant.PAGE_SIZE);
|
| | | List<HongBao> list = new ArrayList<>();
|
| | | if (hongBaoDTOList != null)
|
| | | for (HongBaoDTO dto : hongBaoDTOList) {
|
| | | list.add(HongBaoFactory.createHongBao(dto));
|
| | | }
|
| | | long count = hongBaoV2Service.countJiangJinByUid(uid);
|
| | | List<OrderItem> orderItemList = HongBaoUtil.convertToTiChengOrder(list);
|
| | | Gson gson = JsonUtil.getApiCommonGson();
|
| | | JSONObject data = new JSONObject();
|
| | |
| | | package com.yeshi.fanli.dao.mybatis; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.dto.HongBaoDTO; |
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2; |
| | | |
| | | public interface HongBaoV2Mapper extends BaseMapper<HongBaoV2> { |
| | | |
| | | HongBaoV2 selectByPrimaryKeyForUpdate(Long id); |
| | | |
| | | /** |
| | | * 获取子红包列表 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | List<HongBaoV2> listChildrenById(Long id); |
| | | |
| | | /** |
| | | * 获取奖金列表(1.4.9之前) |
| | | * |
| | | * @param uid |
| | | * @param start |
| | | * @param count |
| | | * @return |
| | | */ |
| | | List<HongBaoDTO> listJiangJinByUid(@Param("uid") Long uid, @Param("start") long start, @Param("count") int count); |
| | | |
| | | /** |
| | | * 获取奖金数量(1.4.9之前) |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | Long countJiangJinByUid(Long uid); |
| | | |
| | | /** |
| | | * 获取总的提成金额 |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | BigDecimal getTotalTiChengMoney(Long uid); |
| | | |
| | | /** |
| | | * 获取总的提成笔数 |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | int getTotalTiChengCount(Long uid); |
| | | |
| | | /** |
| | | * 获取还未到账的提成金额 |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | BigDecimal getUnGetTiChengMoney(Long uid); |
| | | |
| | | /** |
| | | * 获取总共返利金额 |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | BigDecimal getTotalFanLiMoney(Long uid); |
| | | |
| | | /** |
| | | * 获取还未到账的金额 |
| | | * |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | BigDecimal getUnRecievedFanLiMoney(Long uid); |
| | | |
| | | /** |
| | | * 根据红包类型获取结算列表 |
| | | * |
| | | * @param type |
| | | * @param count |
| | | * @return |
| | | */ |
| | | List<HongBaoV2> listCanBalanceHongBaoByType(@Param("type") int type, @Param("count") int count); |
| | | |
| | | /** |
| | | * 获取能够结算的分享赚和邀请赚的用户列表 |
| | | * |
| | | * @param count |
| | | * @return |
| | | */ |
| | | List<Long> listUidCanBanlanceShareAndInvite(int count); |
| | | |
| | | /** |
| | | * 根据用户ID,类型获取能够结算的红包 |
| | | * |
| | | * @param type |
| | | * @param uid |
| | | * @param count |
| | | * @return |
| | | */ |
| | | List<HongBaoV2> listCanBalanceHongBaoByTypeAndUid(@Param("types") List<Integer> type, @Param("uid") Long uid, |
| | | @Param("count") int count); |
| | | |
| | | } |
| | |
| | | HongBaoOrder selectByCommonOrderId(Long id); |
| | | |
| | | /** |
| | | * 根据红包ID查询对象 |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | HongBaoOrder selectByHongBaoId(Long id); |
| | | |
| | | /** |
| | | * 返利订单列表(1.4.9之前) |
| | | * |
| | | * @param uid |
New file |
| | |
| | | package com.yeshi.fanli.dto;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | |
|
| | | public class HongBaoDTO extends HongBaoV2 {
|
| | | private String orderId;
|
| | | private BigDecimal payMoney;
|
| | | private BigDecimal settlement;
|
| | |
|
| | | public String getOrderId() {
|
| | | return orderId;
|
| | | }
|
| | |
|
| | | public void setOrderId(String orderId) {
|
| | | this.orderId = orderId;
|
| | | }
|
| | |
|
| | | public BigDecimal getPayMoney() {
|
| | | return payMoney;
|
| | | }
|
| | |
|
| | | public void setPayMoney(BigDecimal payMoney) {
|
| | | this.payMoney = payMoney;
|
| | | }
|
| | |
|
| | | public BigDecimal getSettlement() {
|
| | | return settlement;
|
| | | }
|
| | |
|
| | | public void setSettlement(BigDecimal settlement) {
|
| | | this.settlement = settlement;
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | public enum UserMoneyDetailTypeEnum {
|
| | | share("分享奖金", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_share.png", ""), invite("邀请奖金", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_invite.png", ""), inviteAndShare("奖金收入", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_share.png", ""), fanli("返利到账", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_fanli.png",
|
| | | ""), fanliWeiQuan("返利扣除", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_fanli.png", ""), inviteWeiQuan("邀请奖金扣除", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_invite.png", ""), shareWeiQuan("分享奖金扣除", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_share.png",
|
| | | ""), weiQuan("售后订单扣款", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_fanli.png", ""), systemEqualize("系统补齐", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_system.png", ""), scoreConvert("积分兑换", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_score.png",
|
| | | ""), hongbao("官方红包", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_hongbao.png", "http://www.baidu.com"), hongbaoDeduct("红包退款", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_hongbao.png",
|
| | | ""), fanliWeiQuan("返利扣除", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_fanli.png", "http://apph5.yeshitv.com/apppage/flq_whyMoneyDel.html"), inviteWeiQuan("邀请奖金扣除", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_invite.png", "http://apph5.yeshitv.com/apppage/flq_whyMoneyDel.html"), shareWeiQuan("分享奖金扣除", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_share.png",
|
| | | "http://apph5.yeshitv.com/apppage/flq_whyMoneyDel.html"), weiQuan("售后订单扣款", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_fanli.png", "http://apph5.yeshitv.com/apppage/flq_whyMoneyDel.html"), systemEqualize("系统补齐", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_system.png", ""), scoreConvert("积分兑换", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_score.png",
|
| | | ""), hongbao("官方红包", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_hongbao.png", "http://apph5.yeshitv.com/apppage/flq_whyMoneyDel.html"), hongbaoDeduct("红包退款", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_hongbao.png",
|
| | | ""), buyScore("购买积分", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_score.png", ""), extract("提现", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_extract.png",
|
| | | ""), extractVerify("提现验证", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_extract.png", ""), extractReject("提现被拒", "http://ec-1255749512.file.myqcloud.com/resource/money_detail/icon_extract.png", "");
|
| | | private final String desc;
|
| | |
| | | orderProcessService.weiQuanOrder(orderList);
|
| | | }
|
| | |
|
| | | // 处理分享商品所产生的订单
|
| | | @Scheduled(cron = "0 0/2 * * * ? ")
|
| | | public void doPidOrder() {
|
| | | if (!Constant.IS_TASK)
|
| | | return;
|
| | | pidOrderService.doPidOrder();
|
| | | }
|
| | | // 处理分享商品所产生的订单(后续版本废除)
|
| | | // @Scheduled(cron = "0 0/2 * * * ? ")
|
| | | // public void doPidOrder() {
|
| | | // if (!Constant.IS_TASK)
|
| | | // return;
|
| | | // pidOrderService.doPidOrder();
|
| | | // }
|
| | |
|
| | | // 每6个小时执行一次
|
| | | @Scheduled(cron = "0 0 0/6 * * ? ")
|
| | |
| | | |
| | | <!-- <association property="userInfo" column="hb_uid" resultMap="com.yeshi.fanli.dao.mybatis.UserInfoMapper.BaseResultMap"/> --> |
| | | </resultMap> |
| | | |
| | | |
| | | |
| | | <resultMap id="BaseDTOResultMap" type="com.yeshi.fanli.dto.HongBaoDTO"> |
| | | <id column="hb_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="hb_urank" property="urank" jdbcType="INTEGER" /> |
| | | <result column="hb_money" property="money" jdbcType="DECIMAL" /> |
| | | <result column="hb_type" property="type" jdbcType="INTEGER" /> |
| | | <result column="hb_state" property="state" jdbcType="INTEGER" /> |
| | | <result column="hb_version" property="version" jdbcType="INTEGER" /> |
| | | <result column="hb_beizhu" property="beizhu" jdbcType="VARCHAR" /> |
| | | <result column="hb_pre_get_time" property="preGetTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <result column="hb_get_time" property="getTime" jdbcType="TIMESTAMP" /> |
| | | <result column="hb_create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="hb_update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | |
| | | <result column="orderId" property="orderId" jdbcType="VARCHAR" /> |
| | | |
| | | <result column="payMoney" property="payMoney" jdbcType="DECIMAL" /> |
| | | |
| | | <result column="settlement" property="settlement" jdbcType="DECIMAL" /> |
| | | |
| | | <association property="userInfo" column="hb_uid" |
| | | javaType="com.yeshi.fanli.entity.bus.user.UserInfo"> |
| | | <id column="hb_uid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | <association property="parent" column="hb_pid" |
| | | javaType="com.yeshi.fanli.entity.bus.user.HongBaoV2"> |
| | | <id column="hb_pid" property="id" jdbcType="BIGINT" /> |
| | | </association> |
| | | |
| | | </resultMap> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <sql id="Base_Column_List">hb_id,hb_uid,hb_urank,hb_pid,hb_money,hb_type,hb_state,hb_version,hb_beizhu,hb_pre_get_time,hb_get_time,hb_create_time,hb_update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | |
| | | </select> |
| | | |
| | | |
| | | <select id="selectByPrimaryKeyForUpdate" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_hongbao_v2 where hb_id = #{id,jdbcType=BIGINT} for |
| | | update |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="listChildrenById" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | |
| | | </select> |
| | | |
| | | |
| | | <select id="listCanBalanceHongBaoByType" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | FROM yeshi_ec_hongbao_v2 h WHERE h.`hb_version`=2 AND |
| | | h.`hb_type`=#{type} AND (h.`hb_state`=2) AND |
| | | h.`hb_pre_get_time` IS NOT |
| | | NULL AND h.`hb_pre_get_time` |
| | | <![CDATA[ <]]> |
| | | NOW() limit #{count} |
| | | </select> |
| | | |
| | | <!-- 获取用户奖金列表 --> |
| | | <select id="listJiangJinByUid" resultMap="BaseDTOResultMap"> |
| | | SELECT |
| | | hhh.*,co.`co_order_no` AS orderId,co.`co_payment` AS |
| | | payMoney,co.`co_settlement` AS settlement FROM |
| | | ( |
| | | SELECT |
| | | hh.*,IF(h.`hb_id` IS NOT NULL,h.`hb_id`,hh.hb_id) AS hid FROM |
| | | ( |
| | | SELECT |
| | | h.* FROM yeshi_ec_hongbao_v2 h WHERE h.hb_uid=#{uid} and |
| | | (h.`hb_type`=6 OR h.`hb_type`=7 |
| | | OR h.`hb_type`=20 OR h.`hb_type`=21 OR |
| | | h.`hb_type`=22) AND |
| | | h.`hb_version`=2 ORDER BY h.`hb_create_time` DESC |
| | | limit #{start},#{count} |
| | | ) hh |
| | | LEFT JOIN yeshi_ec_hongbao_v2 h ON |
| | | hh.hb_pid IS NOT NULL AND |
| | | h.`hb_id`=hh.hb_pid |
| | | ) hhh LEFT JOIN |
| | | yeshi_ec_hongbao_order ho ON ho.`ho_hongbao_id`=hhh.hid |
| | | LEFT JOIN |
| | | yeshi_ec_common_order co ON co.`co_id`=ho.`ho_order_id` |
| | | </select> |
| | | |
| | | |
| | | <!-- 获取用户奖金列表 --> |
| | | <select id="countJiangJinByUid" resultType="java.lang.Long"> |
| | | SELECT count(h.hb_id) |
| | | FROM yeshi_ec_hongbao_v2 h WHERE h.hb_uid=#{0} and (h.`hb_type`=6 OR |
| | | h.`hb_type`=7 |
| | | OR h.`hb_type`=20 OR h.`hb_type`=21 OR h.`hb_type`=22) |
| | | AND |
| | | h.`hb_version`=2 |
| | | </select> |
| | | |
| | | <!-- 获取总的提成金额 --> |
| | | <select id="getTotalTiChengMoney" resultType="java.math.BigDecimal" |
| | | parameterType="java.lang.Long"> |
| | | SELECT IF(a.money IS NULL,0,a.money ) FROM (SELECT |
| | | SUM(h.`hb_money`) AS money FROM `yeshi_ec_hongbao_v2` h WHERE |
| | | h.`hb_uid`=#{0} |
| | | AND h.`hb_state`=3 AND (h.`hb_type`=20 OR |
| | | h.`hb_type`=21 OR h.`hb_type`=22 OR |
| | | h.`hb_type`=6 OR h.`hb_type`=7)) a |
| | | </select> |
| | | |
| | | <!-- 获取总的提成笔数 --> |
| | | <select id="getTotalTiChengCount" resultType="java.lang.Integer" |
| | | parameterType="java.lang.Long"> |
| | | SELECT |
| | | count(*) FROM `yeshi_ec_hongbao_v2` h |
| | | WHERE |
| | | h.`hb_uid`=#{0} AND (h.`hb_type`=20 OR h.`hb_type`=21 OR |
| | | h.`hb_type`=22 OR |
| | | h.`hb_type`=6 OR h.`hb_type`=7) |
| | | </select> |
| | | |
| | | <!-- 获取还未到账的提成金额 --> |
| | | <select id="getUnGetTiChengMoney" resultType="java.math.BigDecimal" |
| | | parameterType="java.lang.Long"> |
| | | SELECT IF(a.money IS NULL,0,a.money ) FROM (SELECT |
| | | SUM(h.`hb_money`) AS money FROM `yeshi_ec_hongbao_v2` h WHERE |
| | | h.`hb_uid`=#{0} |
| | | AND (h.`hb_state`=1 OR h.hb_state=2 )AND |
| | | (h.`hb_type`=20 OR h.`hb_type`=21 OR |
| | | h.`hb_type`=22 OR h.`hb_type`=6 OR |
| | | h.`hb_type`=7)) a |
| | | </select> |
| | | |
| | | |
| | | <select id="getTotalFanLiMoney" resultType="java.math.BigDecimal" |
| | | parameterType="java.lang.Long"> |
| | | SELECT SUM(h.`hb_money`) FROM yeshi_ec_hongbao_v2 h |
| | | WHERE h.`hb_uid`=#{uid} AND h.`hb_type`=1 AND h.`hb_state`=3 |
| | | </select> |
| | | |
| | | <select id="getUnRecievedFanLiMoney" resultType="java.math.BigDecimal" |
| | | parameterType="java.lang.Long"> |
| | | SELECT SUM(h.`hb_money`) FROM yeshi_ec_hongbao_v2 h |
| | | WHERE h.`hb_uid`=#{uid} AND h.`hb_type`=1 AND (h.`hb_state`=1 OR |
| | | h.`hb_state`=2) |
| | | </select> |
| | | |
| | | |
| | | <select id="listUidCanBanlanceShareAndInvite" resultType="java.lang.Long" |
| | | parameterType="java.lang.Integer"> |
| | | |
| | | SELECT DISTINCT( h.`hb_uid`) FROM yeshi_ec_hongbao_v2 h |
| | | WHERE |
| | | (`hb_type`=6 OR |
| | | `hb_type`=7 OR `hb_type`=20 OR `hb_type`=21 OR |
| | | `hb_type`=22 ) AND |
| | | `hb_version`=2 AND (hb_state=1 OR hb_state=2) AND |
| | | hb_pre_get_time IS |
| | | NOT NULL AND hb_pre_get_time>0 AND |
| | | NOW()>=hb_pre_get_time limit #{0} |
| | | |
| | | </select> |
| | | |
| | | |
| | | <select id="listCanBalanceHongBaoByTypeAndUid" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_hongbao_v2 where hb_uid=#{uid} and `version`=2 |
| | | |
| | | <foreach collection="types" item="type" open=" and (" |
| | | separator=" or " close=")"> |
| | | hb_type = |
| | | #{type} |
| | | </foreach> |
| | | |
| | | and |
| | | (hb_state=1 or hb_state=2) and |
| | | hb_pre_get_time IS NOT NULL AND |
| | | hb_pre_get_time>0 AND |
| | | NOW()>=hb_pre_get_time limit |
| | | #{count} |
| | | </select> |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_hongbao_v2 where hb_id = #{id,jdbcType=BIGINT}</delete> |
| | | yeshi_ec_hongbao_v2 where hb_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.HongBaoV2" |
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_hongbao_v2 |
| | | (hb_id,hb_uid,hb_urank,hb_pid,hb_money,hb_type,hb_state,hb_version,hb_beizhu,hb_pre_get_time,hb_get_time,hb_create_time,hb_update_time) |
| | |
| | | from yeshi_ec_hongbao_order where ho_order_id = #{0} |
| | | </select> |
| | | |
| | | <select id="selectByHongBaoId" resultMap="BaseDetailResultMap" |
| | | parameterType="java.lang.Long"> |
| | | SELECT * FROM (SELECT * FROM yeshi_ec_hongbao_order ho WHERE |
| | | ho.`ho_hongbao_id`=#{0} ) ho LEFT JOIN yeshi_ec_hongbao_v2 h ON |
| | | h.`hb_id`=ho.`ho_hongbao_id` LEFT JOIN yeshi_ec_common_order o ON |
| | | o.`co_id`=ho.`ho_order_id` |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="listFanLiOrder" resultMap="BaseDetailResultMap"> |
| | | SELECT * FROM (SELECT * |
| | |
| | | FROM
|
| | | `yeshi_ec_share_tao_password` yestp
|
| | | WHERE
|
| | | yestp.`auctionId` = #{auctionId}
|
| | | yestp.`auctionId` =
|
| | | #{auctionId}
|
| | | AND
|
| | | yestp.`pid` = #{pid};
|
| | | </select>
|
| | |
| | | FROM
|
| | | `yeshi_ec_share_tao_password` yestp
|
| | | WHERE
|
| | | yestp.`auctionId` = #{auctionId}
|
| | | yestp.`auctionId` =
|
| | | #{auctionId}
|
| | | AND
|
| | | yestp.`pid` = #{pid};
|
| | | </select>
|
| | |
| | | FROM
|
| | | `yeshi_ec_threesale` yet
|
| | | WHERE
|
| | | yet.`boss_id` = #{uid}
|
| | | yet.`boss_id` =
|
| | | #{uid}
|
| | | AND
|
| | | yet.`state` = '1'
|
| | | </select>
|
| | |
| | | FROM
|
| | | `yeshi_ec_threesale` yet
|
| | | WHERE
|
| | | yet.`boss_id` = ANY(
|
| | | yet.`boss_id` =
|
| | | ANY(
|
| | | SELECT
|
| | | yet.`worker_id`
|
| | | FROM
|
| | |
| | | <!-- 查询我的今日收益 -->
|
| | | <select id="getMoneyToday" resultType="java.math.BigDecimal">
|
| | | SELECT
|
| | | SUM(yeh.`money`)
|
| | | SUM(yeh.`hb_money`)
|
| | | FROM
|
| | | `yeshi_ec_hongbao` yeh
|
| | | `yeshi_ec_hongbao_v2` yeh
|
| | | WHERE
|
| | | (yeh.`state` = '1' OR yeh.`state` = '2' OR yeh.`state` = '3')
|
| | | (yeh.`hb_state` = '1' OR yeh.`hb_state`
|
| | | = '2' OR yeh.`hb_state` = '3')
|
| | | AND
|
| | | (yeh.`type` = '6' OR yeh.`type` = '7' OR yeh.`type` = '20' OR yeh.`type` = '21' OR yeh.`type` = '22')
|
| | | (yeh.`hb_type` = '6' OR yeh.`hb_type`
|
| | | = '7' OR yeh.`hb_type` = '20' OR yeh.`hb_type` = '21' OR yeh.`hb_type`
|
| | | = '22')
|
| | | AND
|
| | | yeh.`uid` = #{uid}
|
| | | yeh.`hb_uid` = #{uid}
|
| | | AND
|
| | | FROM_UNIXTIME(yeh.createtime/1000,'%Y-%m-%d') = FROM_UNIXTIME(UNIX_TIMESTAMP(),'%Y-%m-%d');
|
| | | FROM_UNIXTIME(yeh.hb_create_time/1000,'%Y-%m-%d') =
|
| | | FROM_UNIXTIME(UNIX_TIMESTAMP(),'%Y-%m-%d');
|
| | | </select>
|
| | |
|
| | | <!-- 查询我的本月预估收益 -->
|
| | | <select id="getMoneyMonth" resultType="java.math.BigDecimal">
|
| | | SELECT
|
| | | SUM(yeh.`money`)
|
| | | SUM(yeh.`hb_money`)
|
| | | FROM
|
| | | `yeshi_ec_hongbao` yeh
|
| | | `yeshi_ec_hongbao_v2` yeh
|
| | | WHERE
|
| | | (yeh.`state` = '1' OR yeh.`state` = '2' OR yeh.`state` = '3')
|
| | | (yeh.`hb_state` = '1' OR
|
| | | yeh.`hb_state` = '2' OR yeh.`hb_state` = '3')
|
| | | AND
|
| | | (yeh.`type` = '6' OR yeh.`type` = '7' OR yeh.`type` = '20' OR yeh.`type` = '21' OR yeh.`type` = '22')
|
| | | (yeh.`hb_type` = '6'
|
| | | OR yeh.`hb_type` = '7' OR yeh.`hb_type` = '20' OR yeh.`hb_type` = '21'
|
| | | OR yeh.`hb_type` = '22')
|
| | | AND
|
| | | yeh.`uid` = #{uid}
|
| | | yeh.`hb_uid` = #{uid}
|
| | | AND
|
| | | FROM_UNIXTIME(yeh.createtime/1000,'%Y-%m') = FROM_UNIXTIME(UNIX_TIMESTAMP(),'%Y-%m');
|
| | | FROM_UNIXTIME(yeh.hb_create_time/1000,'%Y-%m') =
|
| | | FROM_UNIXTIME(UNIX_TIMESTAMP(),'%Y-%m');
|
| | | </select>
|
| | |
|
| | |
|
| | | <!-- 查询我的上月预估收益 -->
|
| | | <select id="getMoneyLastMonth" resultType="java.math.BigDecimal">
|
| | | SELECT
|
| | | (SELECT
|
| | | IF(
|
| | | SUM(h.`money`) IS NULL,
|
| | | 0,
|
| | | SUM(h.`money`)
|
| | | )
|
| | | FROM
|
| | | `yeshi_ec_hongbao` h
|
| | | LEFT JOIN yeshi_ec_hongbao hp
|
| | | ON hp.`id` = h.`pid`
|
| | | WHERE h.uid = #{uid}
|
| | | AND (
|
| | | h.state = 1
|
| | | OR h.state = 2
|
| | | OR h.state = 3
|
| | | )
|
| | | AND (h.`type` = 6
|
| | | OR h.`type` = 7)
|
| | | AND hp.`balance_time` IS NOT NULL
|
| | | AND DATE_FORMAT(hp.`balance_time`, '%Y-%m') = DATE_FORMAT(
|
| | | DATE_SUB(CURDATE(), INTERVAL 1 MONTH),
|
| | | '%Y-%m'
|
| | | )) +
|
| | | (SELECT
|
| | | IF(SUM(h.money) IS NULL, 0, SUM(h.money))
|
| | | FROM
|
| | | yeshi_ec_hongbao h
|
| | | WHERE h.uid = #{uid}
|
| | | AND (h.type = 20 OR h.type = 21 OR h.type = 22)
|
| | | AND (
|
| | | h.state = 1
|
| | | OR h.state = 2
|
| | | OR h.state = 3
|
| | | )
|
| | | AND h.`balance_time` IS NOT NULL
|
| | | AND DATE_FORMAT(h.`balance_time`, '%Y-%m') = DATE_FORMAT(
|
| | | DATE_SUB(CURDATE(), INTERVAL 1 MONTH),
|
| | | '%Y-%m'
|
| | | ))
|
| | | SUM(h.`hb_money`) FROM yeshi_ec_hongbao_v2 h WHERE h.`hb_uid`=#{0}
|
| | | AND (h.`hb_state`=1 OR h.`hb_state`=2 OR h.`hb_state`=3) AND
|
| | | (h.`hb_type`=6 OR h.`hb_type`=7 OR h.`hb_type`=20 OR h.`hb_type`=21 OR
|
| | | h.`hb_type`=22 ) AND h.`hb_pre_get_time` IS NOT NULL AND
|
| | | DATE_FORMAT(h.`hb_pre_get_time`,'%Y-%m')=DATE_FORMAT(NOW(),'%Y-%m');
|
| | | </select>
|
| | |
|
| | |
|
| | |
| | |
|
| | | <!-- 查询活动规则 -->
|
| | | <select id="getActivityRules" resultType="String">
|
| | | SELECT yesc.`value` FROM `yeshi_ec_system_clientparams` yesc WHERE yesc.`key` = #{key};
|
| | | SELECT yesc.`value`
|
| | | FROM `yeshi_ec_system_clientparams` yesc WHERE yesc.`key` = #{key};
|
| | | </select>
|
| | |
|
| | | <!-- 修改活动规则 -->
|
| | | <update id="editActivityRules">
|
| | | UPDATE `yeshi_ec_system_clientparams` yesc SET yesc.`value` = #{value} WHERE yesc.`key` = #{key};
|
| | | UPDATE `yeshi_ec_system_clientparams` yesc SET
|
| | | yesc.`value` = #{value} WHERE yesc.`key` = #{key};
|
| | | </update>
|
| | |
|
| | |
|
| | |
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.HongBaoV2Mapper;
|
| | | import com.yeshi.fanli.dao.mybatis.PidOrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.hongbao.HongBaoMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.CommonOrderMapper;
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.order.OrderMapper;
|
| | | 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.user.HongBao;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.CommonOrderGoods;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.PidOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.exception.HongBaoException;
|
| | | import com.yeshi.fanli.exception.share.UserShareGoodsRecordException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | 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.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserShareGoodsGroupService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
| | |
|
| | | @Resource
|
| | | private TaoBaoWeiQuanOrderMapper taoBaoWeiQuanOrderMapper;
|
| | |
|
| | | @Resource
|
| | | private UserShareGoodsGroupService userShareGoodsGroupService;
|
| | |
|
| | | @Resource
|
| | | private PidOrderMapper pidOrderMapper;
|
| | |
|
| | | @Override
|
| | | public int insert(HongBaoV2 record) {
|
| | |
| | | if (hb.getParent() != null)
|
| | | v2.setParent(new HongBaoV2(hb.getParent().getId()));
|
| | |
|
| | | if (hb.getType() == HongBao.TYPE_SHARE_GOODS) {
|
| | | if (hb.getBalanceTime() != null)
|
| | | v2.setPreGetTime(new Date(hb.getPreGettime()));
|
| | | else
|
| | | v2.setPreGetTime(null);
|
| | | } else {
|
| | | if (hb.getPreGettime() == null || hb.getPreGettime() == 0)
|
| | | v2.setPreGetTime(null);
|
| | | else
|
| | | v2.setPreGetTime(new Date(hb.getPreGettime()));
|
| | | }
|
| | |
|
| | | v2.setState(hb.getState());
|
| | | if (hb.getState() == 1 && hb.getBalanceTime() != null) {
|
| | | v2.setState(HongBaoV2.STATE_KELINGQU);
|
| | | }
|
| | | v2.setType(type);
|
| | | v2.setUpdateTime(new Date(hb.getCreatetime()));
|
| | | v2.setUrank(hb.getUrank());
|
| | |
| | |
|
| | | if (list.size() <= 0)
|
| | | return;
|
| | | if (list.get(0).getType() == 20)
|
| | | for (HongBao hb1 : list) {
|
| | | PidOrder pidOrder = pidOrderMapper.getPidOrderByHongBaoId(hb1.getId());
|
| | | if (pidOrder != null)
|
| | | hb1.setAuctionId(pidOrder.getAuctionId());
|
| | |
|
| | | }
|
| | |
|
| | | List<TaoBaoOrder> orderList = taoBaoOrderMapper.selectTaoBaoOrderByOrderId(orderId);
|
| | |
|
| | | if (orderList == null || orderList.size() < list.size()) {
|
| | |
| | |
|
| | | // 按照auctionId,payMoney排序
|
| | | Comparator<HongBao> cm = new Comparator<HongBao>() {
|
| | |
|
| | | @Override
|
| | | public int compare(HongBao o1, HongBao o2) {
|
| | | return o1.getAuctionId() == o2.getAuctionId()
|
| | | ? (o1.getPayMoney().subtract(o2.getPayMoney()).compareTo(new BigDecimal(0)))
|
| | | : (int) (o1.getAuctionId() - o2.getAuctionId());
|
| | | if (o1.getAuctionId().longValue() < o2.getAuctionId().longValue())
|
| | | return -3;
|
| | | else if (o1.getAuctionId().longValue() > o2.getAuctionId().longValue()) {
|
| | | return 3;
|
| | | } else {
|
| | | if (o1.getState() - o2.getState() > 0)
|
| | | return 2;
|
| | | else if (o1.getState() - o2.getState() < 0)
|
| | | return -2;
|
| | | else {
|
| | | if (o1.getPayMoney().compareTo(o2.getPayMoney()) >= 0)
|
| | | return 1;
|
| | | else
|
| | | return -1;
|
| | | }
|
| | | }
|
| | | }
|
| | | };
|
| | |
|
| | |
| | |
|
| | | @Override
|
| | | public int compare(TaoBaoOrder o1, TaoBaoOrder o2) {
|
| | | return o1.getAuctionId() == o2.getAuctionId()
|
| | | ? (o1.getPayment().subtract(o2.getPayment()).compareTo(new BigDecimal(0)))
|
| | | : (int) (o1.getAuctionId() - o2.getAuctionId());
|
| | |
|
| | | if (o1.getAuctionId().longValue() < o2.getAuctionId().longValue())
|
| | | return -3;
|
| | | else if (o1.getAuctionId().longValue() > o2.getAuctionId().longValue()) {
|
| | | return 3;
|
| | | } else {
|
| | | if (o1.getPayment().compareTo(o2.getPayment()) < 0)
|
| | | return 2;
|
| | | else
|
| | | return -2;
|
| | | }
|
| | | }
|
| | | };
|
| | |
|
| | | Collections.sort(orderList, cmOrder);
|
| | |
|
| | | for (TaoBaoOrder t : orderList)
|
| | | System.out.println(t.getAuctionId());
|
| | |
|
| | | for (int i = 0; i < list.size(); i++) {
|
| | | CommonOrder commonOrder = TaoBaoOrderUtil.convert(orderList.get(i));
|
| | |
| | | // 以实际收入为准计算预估收益
|
| | | if (hongBao.getState() == HongBaoV2.STATE_KELINGQU) {
|
| | | childUpdate.setMoney(
|
| | | MoneyBigDecimalUtil.mul(commonOrder.geteIncome(), rate.divide(new BigDecimal(100))));
|
| | | MoneyBigDecimalUtil.mul(hongBao.getMoney(), rate.divide(new BigDecimal(100))));
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTime(commonOrder.getSettleTime());
|
| | | calendar.add(Calendar.MONTH, 1);
|
| | |
| | | "yyyy-M-dd")));
|
| | | } else if (hongBao.getState() == HongBaoV2.STATE_BUKELINGQU) {
|
| | | childUpdate.setMoney(
|
| | | MoneyBigDecimalUtil.mul(commonOrder.getEstimate(), rate.divide(new BigDecimal(100))));
|
| | | MoneyBigDecimalUtil.mul(hongBao.getMoney(), rate.divide(new BigDecimal(100))));
|
| | | }
|
| | | hongBaoV2Mapper.updateByPrimaryKeySelective(childUpdate);
|
| | | }
|
| | |
| | | // 以实际收入为准计算预估收益
|
| | | if (CommonOrder.STATE_JS == commonOrder.getState()) {
|
| | | childUpdate.setMoney(
|
| | | MoneyBigDecimalUtil.mul(commonOrder.geteIncome(), rate.divide(new BigDecimal(100))));
|
| | | MoneyBigDecimalUtil.mul(hongBao.getMoney(), rate.divide(new BigDecimal(100))));
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTime(commonOrder.getSettleTime());
|
| | | calendar.add(Calendar.MONTH, 1);
|
| | |
| | | System.out.println("");
|
| | |
|
| | | childUpdate.setMoney(
|
| | | MoneyBigDecimalUtil.mul(commonOrder.getEstimate(), rate.divide(new BigDecimal(100))));
|
| | | MoneyBigDecimalUtil.mul(hongBao.getMoney(), rate.divide(new BigDecimal(100))));
|
| | | }
|
| | | hongBaoV2Mapper.updateByPrimaryKeySelective(childUpdate);
|
| | | }
|
| | |
| | |
|
| | | if (hongBao.getState() == HongBaoV2.STATE_KELINGQU) {
|
| | | firstHongbao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(commonOrder.geteIncome(), firstRate.divide(new BigDecimal(100))));
|
| | | MoneyBigDecimalUtil.mul(hongBao.getMoney(), firstRate.divide(new BigDecimal(100))));
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTime(commonOrder.getSettleTime());
|
| | | calendar.add(Calendar.MONTH, 1);
|
| | |
| | | "yyyy-M-dd")));
|
| | | } else if (hongBao.getState() == HongBaoV2.STATE_BUKELINGQU) {
|
| | | firstHongbao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(commonOrder.getEstimate(), firstRate.divide(new BigDecimal(100))));
|
| | | MoneyBigDecimalUtil.mul(hongBao.getMoney(), firstRate.divide(new BigDecimal(100))));
|
| | | }
|
| | | hongBaoV2Mapper.insertSelective(firstHongbao);
|
| | |
|
| | |
| | | secondHongbao.setVersion(2);
|
| | | secondHongbao.setState(hongBao.getState());
|
| | | if (hongBao.getState() == HongBaoV2.STATE_KELINGQU) {
|
| | | firstHongbao.setMoney(MoneyBigDecimalUtil.mul(commonOrder.geteIncome(),
|
| | | secondRate.divide(new BigDecimal(100))));
|
| | | firstHongbao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(hongBao.getMoney(), secondRate.divide(new BigDecimal(100))));
|
| | | Calendar calendar = Calendar.getInstance();
|
| | | calendar.setTime(commonOrder.getSettleTime());
|
| | | calendar.add(Calendar.MONTH, 1);
|
| | |
| | | calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1) + "-25",
|
| | | "yyyy-M-dd")));
|
| | | } else if (hongBao.getState() == HongBaoV2.STATE_BUKELINGQU) {
|
| | | secondHongbao.setMoney(MoneyBigDecimalUtil.mul(commonOrder.getEstimate(),
|
| | | secondRate.divide(new BigDecimal(100))));
|
| | | secondHongbao.setMoney(
|
| | | MoneyBigDecimalUtil.mul(hongBao.getMoney(), secondRate.divide(new BigDecimal(100))));
|
| | | }
|
| | | hongBaoV2Mapper.insertSelective(secondHongbao);
|
| | | }
|
| | |
| | | hongBaoOrder.setCreateTime(new Date());
|
| | | hongBaoOrder.setHongBaoV2(hongBao);
|
| | | hongBaoOrderMapper.insertSelective(hongBaoOrder);
|
| | |
|
| | | // 修改统计数据
|
| | | Long goodsId = commonOrder.getCommonOrderGoods().getId();
|
| | | // 查询商品
|
| | | CommonOrderGoods goods = commonOrderGoodsMapper.selectByPrimaryKey(goodsId);
|
| | |
|
| | | HongBao hb = new HongBao();
|
| | | if (goods != null)
|
| | | hb.setAuctionId(Long.parseLong(goods.getGoodsId()));
|
| | | hb.setUserInfo(hongBao.getUserInfo());
|
| | | hb.setMoney(hongBao.getMoney());
|
| | |
|
| | | try {
|
| | | userShareGoodsGroupService.updateOrderRecord(hb);
|
| | | } catch (UserShareGoodsRecordException e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | } catch (Exception e1) {
|
| | | e1.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | } else
|
| | | throw new HongBaoException(2, "type错误");
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<HongBaoDTO> listJiangJinByUid(Long uid, int page, int pageSize) {
|
| | | return hongBaoV2Mapper.listJiangJinByUid(uid, (page - 1) * pageSize, pageSize);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countJiangJinByUid(Long uid) {
|
| | | Long count = hongBaoV2Mapper.countJiangJinByUid(uid);
|
| | | return count == null ? 0 : count;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getTotalTiChengMoney(Long uid) {
|
| | |
|
| | | return hongBaoV2Mapper.getTotalTiChengMoney(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int getTotalTiChengCount(Long uid) {
|
| | | return hongBaoV2Mapper.getTotalTiChengCount(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getUnGetTiChengMoney(Long uid) {
|
| | | return hongBaoV2Mapper.getUnGetTiChengMoney(uid);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getTotalFanLiMoney(Long uid) {
|
| | | BigDecimal money = hongBaoV2Mapper.getTotalFanLiMoney(uid);
|
| | | return money == null ? new BigDecimal(0) : money;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public BigDecimal getUnRecievedFanLiMoney(Long uid) {
|
| | | BigDecimal money = hongBaoV2Mapper.getUnRecievedFanLiMoney(uid);
|
| | | return money == null ? new BigDecimal(0) : money;
|
| | | }
|
| | | }
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.order.CommonOrderGoodsMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.CommonOrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoWeiQuanOrderMapper;
|
| | | 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.entity.order.CommonOrder;
|
| | |
| | | commonOrder.setUserInfo(new UserInfo(uid));
|
| | | commonOrder.setCreateTime(new Date());
|
| | | commonOrderMapper.insertSelective(commonOrder);
|
| | | |
| | |
|
| | | return commonOrder;
|
| | | } else {// 修改
|
| | | // 已经结算或者已经失效的订单不处理
|
| | |
| | | import com.yeshi.fanli.dao.mybatis.AccountDetailsMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.AccountMessageMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.HongBaoManageMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.HongBaoV2Mapper;
|
| | | import com.yeshi.fanli.dao.mybatis.MoneyRecordMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.PidOrderMapper;
|
| | | 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.HongBaoOrderMapper;
|
| | | 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.UserInfo;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | 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.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.factory.AccountDetailsFactory;
|
| | | import com.yeshi.fanli.util.factory.UserMoneyDetailFactory;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoOrderUtil;
|
| | |
|
| | | @Service
|
| | | public class OrderProcessServiceImpl implements OrderProcessService {
|
| | |
| | |
|
| | | @Resource
|
| | | private UserMoneyDetailMapper userMoneyDetailMapper;
|
| | |
|
| | | @Resource
|
| | | private HongBaoV2Mapper hongBaoV2Mapper;
|
| | |
|
| | | @Override
|
| | | public void processOrder(Map<String, List<TaoBaoOrder>> orders) {
|
| | |
| | | @Override
|
| | | public void fanli() {
|
| | | // 获取主红包
|
| | | List<HongBao> hongBaoList = hongBaoMapper.selectCanBalanceHongBaoByType(HongBao.TYPE_TAOBAO, 100);
|
| | | List<HongBaoV2> hongBaoList = hongBaoV2Mapper.listCanBalanceHongBaoByType(HongBao.TYPE_TAOBAO, 100);
|
| | | //
|
| | | // /**
|
| | | // * 需要实时更新待返利的订单
|
| | |
| | | /**
|
| | | * 开始返利
|
| | | */
|
| | | for (HongBao hb : hongBaoList) {
|
| | | for (HongBaoV2 hb : hongBaoList) {
|
| | | //
|
| | | if (hb.getState() == HongBao.STATE_SHIXIAO || hb.getState() == HongBao.STATE_YILINGQU)
|
| | | if (hb.getState() == HongBaoV2.STATE_SHIXIAO || hb.getState() == HongBaoV2.STATE_YILINGQU)
|
| | | continue;
|
| | |
|
| | | if (hb.getPreGettime() == null || hb.getPreGettime() == 0
|
| | | || hb.getPreGettime() > System.currentTimeMillis())
|
| | | if (hb.getPreGetTime() == null || hb.getPreGetTime().getTime() == 0
|
| | | || hb.getPreGetTime().getTime() > System.currentTimeMillis())
|
| | | continue;
|
| | | try {
|
| | | CMQManager.getInstance().addFanLiMsg(hb);
|
| | | CMQManager.getInstance().addFanLiMsgNew(hb);
|
| | | } catch (Exception e) {
|
| | | try {
|
| | | LogHelper.errorDetailInfo(e);
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Resource
|
| | | private HongBaoOrderMapper hongBaoOrderMapper;
|
| | |
|
| | | @Override
|
| | | @Transactional
|
| | | public void fanli(HongBaoV2 hb) throws TaoBaoWeiQuanException {
|
| | | // 查询最新的红包数据
|
| | | hb = hongBaoV2Mapper.selectByPrimaryKeyForUpdate(hb.getId());
|
| | | // 查询红包相关联的订单
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByHongBaoId(hb.getId());
|
| | | if (hongBaoOrder == null) {
|
| | | LogHelper.error("返利失败:" + hb.getId());
|
| | | return;
|
| | | }
|
| | | // 维权中的不返利
|
| | | List<TaoBaoWeiQuanOrder> taoBaoWeiQuanList = taoBaoWeiQuanOrderMapper
|
| | | .selectListByOrderIdAndState(hongBaoOrder.getCommonOrder().getOrderNo(), "维权创建");
|
| | | if (taoBaoWeiQuanList != null && taoBaoWeiQuanList.size() > 0)
|
| | | return;
|
| | |
|
| | | taoBaoWeiQuanList = taoBaoWeiQuanOrderMapper
|
| | | .selectListByOrderIdAndState(hongBaoOrder.getCommonOrder().getOrderNo(), "等待处理");
|
| | | 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());
|
| | |
|
| | | AccountDetails accountDetails = AccountDetailsFactory.create("+" + hb.getMoney(),
|
| | | AccountDetailsFactory.FANLI, null, null, hb.getUserInfo());
|
| | | accountDetailsMapper.insertSelective(accountDetails);
|
| | |
|
| | | // 插入新版资金明细
|
| | | 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();
|
| | | }
|
| | | }
|
| | |
|
| | | // 添加资金明细与红包的映射关系
|
| | | 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) {
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void weiQuanOrder(List<TaoBaoWeiQuanOrder> orderList) {
|
| | | if (orderList != null)
|
| | |
| | | @Override
|
| | | public void fanliInvaiteAndShare() {
|
| | | // 查出邀请赚与分享赚该返利的用户ID
|
| | | List<Long> shareUids = pidOrderMapper.getUidCanBalanceList();
|
| | | List<Long> inviteUids = hongBaoMapper.selectUidCanBalanceHongBaoByChildHongBao();
|
| | | List<Long> inviteAndShareUids = hongBaoV2Mapper.listUidCanBanlanceShareAndInvite(1000);
|
| | | Set<Long> uidSets = new HashSet<>();
|
| | | if (shareUids != null)
|
| | | for (Long uid : shareUids)
|
| | | uidSets.add(uid);
|
| | | if (inviteUids != null)
|
| | | for (Long uid : inviteUids)
|
| | | if (inviteAndShareUids != null)
|
| | | for (Long uid : inviteAndShareUids)
|
| | | uidSets.add(uid);
|
| | | // 根据用户ID
|
| | | Iterator<Long> its = uidSets.iterator();
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | private HongBao filterWeiQuanINGHongBao(HongBao hongBao) {
|
| | | private HongBaoV2 filterWeiQuanINGHongBao(HongBaoV2 hongBao) {
|
| | |
|
| | | long hbId = hongBao.getId();
|
| | | if (hongBao.getParent() != null) {
|
| | | hbId = hongBao.getParent().getId();
|
| | | }
|
| | |
|
| | | HongBaoOrder hongbaoOrder = hongBaoOrderMapper.selectByHongBaoId(hbId);
|
| | |
|
| | | if (hongbaoOrder == null)
|
| | | return null;
|
| | |
|
| | | List<TaoBaoWeiQuanOrder> taoBaoWeiQuanList = taoBaoWeiQuanOrderMapper
|
| | | .selectListByOrderIdAndState(hongBao.getOrderId(), "维权创建");
|
| | | .selectListByOrderIdAndState(hongbaoOrder.getCommonOrder().getOrderNo(), "维权创建");
|
| | |
|
| | | List<TaoBaoWeiQuanOrder> taoBaoWeiQuanList1 = taoBaoWeiQuanOrderMapper
|
| | | .selectListByOrderIdAndState(hongBao.getOrderId(), "等待处理");
|
| | | .selectListByOrderIdAndState(hongbaoOrder.getCommonOrder().getOrderNo(), "等待处理");
|
| | | if ((taoBaoWeiQuanList != null && taoBaoWeiQuanList.size() > 0)
|
| | | || (taoBaoWeiQuanList1 != null && taoBaoWeiQuanList1.size() > 0)) {
|
| | | return null;
|
| | |
| | | * 处理邀请赚订单
|
| | | */
|
| | | // 查询UID的邀请赚订单
|
| | | List<HongBao> hongBaoList = hongBaoMapper.selectCanBalanceHongBaoByChildHongBaoAndUid(uid);
|
| | | List<Integer> types = new ArrayList<>();
|
| | | types.add(HongBaoV2.TYPE_YIJI);
|
| | | types.add(HongBaoV2.TYPE_ERJI);
|
| | | List<HongBaoV2> hongBaoList = hongBaoV2Mapper.listCanBalanceHongBaoByTypeAndUid(types, uid, 1000);
|
| | |
|
| | | List<Long> hbIdList = new ArrayList<>();
|
| | |
|
| | | BigDecimal invitemoney = new BigDecimal(0);
|
| | | // 需要判断退款的订单号
|
| | | Set<String> drawBackOrders = new HashSet<String>();
|
| | | for (HongBao hongBao : hongBaoList) {
|
| | | for (HongBaoV2 hongBao : hongBaoList) {
|
| | | hongBao = filterWeiQuanINGHongBao(hongBao);
|
| | | if (hongBao == null)
|
| | | continue;
|
| | |
|
| | | hongBao = hongBaoMapper.selectByPrimaryKeyForUpdate(hongBao.getId());
|
| | | if (hongBao.getState() == HongBao.STATE_BUKELINGQU || hongBao.getState() == HongBao.STATE_KELINGQU) {
|
| | | hongBao = hongBaoV2Mapper.selectByPrimaryKeyForUpdate(hongBao.getId());
|
| | | if (hongBao.getState() == HongBaoV2.STATE_BUKELINGQU || hongBao.getState() == HongBaoV2.STATE_KELINGQU) {
|
| | | invitemoney = invitemoney.add(hongBao.getMoney());
|
| | | HongBao updateHongBao = new HongBao();
|
| | | HongBaoV2 updateHongBao = new HongBaoV2();
|
| | | updateHongBao.setId(hongBao.getId());
|
| | | updateHongBao.setGetTime(System.currentTimeMillis());
|
| | | updateHongBao.setState(HongBao.STATE_YILINGQU);
|
| | | hongBaoMapper.updateByPrimaryKeySelective(updateHongBao);
|
| | | updateHongBao.setGetTime(new Date());
|
| | | updateHongBao.setState(HongBaoV2.STATE_YILINGQU);
|
| | | hongBaoV2Mapper.updateByPrimaryKeySelective(updateHongBao);
|
| | | // 添加到红包返利记录集合
|
| | | hbIdList.add(hongBao.getId());
|
| | | // 2018-08-05 过后的订单才处理维权
|
| | | Date balanceTime = null;
|
| | | if (hongBao.getParent() != null)
|
| | | balanceTime = hongBao.getParent().getBalanceTime();
|
| | | else
|
| | | balanceTime = hongBao.getBalanceTime();
|
| | |
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByHongBaoId(hongBao.getParent().getId());
|
| | |
|
| | | Date balanceTime = hongBaoOrder.getCommonOrder().getSettleTime();
|
| | | if (balanceTime != null
|
| | | && balanceTime.getTime() >= TimeUtil.convertToTimeTemp("2018-08-05", "yyyy-MM-dd")) {
|
| | | if (!StringUtil.isNullOrEmpty(hongBao.getOrderId()))
|
| | | drawBackOrders.add(hongBao.getOrderId());
|
| | | else if (hongBao.getParent() != null && !StringUtil.isNullOrEmpty(hongBao.getParent().getOrderId()))
|
| | | drawBackOrders.add(hongBao.getParent().getOrderId());
|
| | | if (!StringUtil.isNullOrEmpty(hongBaoOrder.getCommonOrder().getOrderNo()))
|
| | | drawBackOrders.add(hongBaoOrder.getCommonOrder().getOrderNo());
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | * 处理一级二级分享赚(属于邀请赚类型)
|
| | | */
|
| | |
|
| | | List<HongBao> totalHongBaoList = new ArrayList<>();
|
| | | List<HongBaoV2> totalHongBaoList = new ArrayList<>();
|
| | | // 查询UID的二级或者三级分享赚订单
|
| | | // TODO 暂时查询10000条数据,后面再做分页
|
| | | List<HongBao> hbList = hongBaoMapper.selectCanBalanceHongBaoByTypeAndUid(HongBao.TYPE_SHARE_YIJI, uid, 10000);
|
| | | types.clear();
|
| | | types.add(HongBaoV2.TYPE_SHARE_YIJI);
|
| | | types.add(HongBaoV2.TYPE_SHARE_ERJI);
|
| | | List<HongBaoV2> hbList = hongBaoV2Mapper.listCanBalanceHongBaoByTypeAndUid(types, 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) {
|
| | | for (HongBaoV2 hb : totalHongBaoList) {
|
| | | if (hb.getState() == HongBaoV2.STATE_BUKELINGQU || hb.getState() == HongBaoV2.STATE_KELINGQU) {
|
| | | hb = filterWeiQuanINGHongBao(hb);
|
| | | if (hb == null)
|
| | | continue;
|
| | | invitemoney = invitemoney.add(hb.getMoney());
|
| | | HongBao updateHongBao = new HongBao();
|
| | | HongBaoV2 updateHongBao = new HongBaoV2();
|
| | | updateHongBao.setId(hb.getId());
|
| | | updateHongBao.setGetTime(System.currentTimeMillis());
|
| | | updateHongBao.setState(HongBao.STATE_YILINGQU);
|
| | | hongBaoMapper.updateByPrimaryKeySelective(updateHongBao);
|
| | | updateHongBao.setGetTime(new Date());
|
| | | updateHongBao.setState(HongBaoV2.STATE_YILINGQU);
|
| | | hongBaoV2Mapper.updateByPrimaryKeySelective(updateHongBao);
|
| | | // 添加到红包返利记录集合
|
| | | hbIdList.add(hb.getId());
|
| | | if (!StringUtil.isNullOrEmpty(hb.getOrderId()))
|
| | | drawBackOrders.add(hb.getOrderId());
|
| | |
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByHongBaoId(hb.getParent().getId());
|
| | | if (!StringUtil.isNullOrEmpty(hongBaoOrder.getCommonOrder().getOrderNo()))
|
| | | drawBackOrders.add(hongBaoOrder.getCommonOrder().getOrderNo());
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | */
|
| | | BigDecimal sharemoney = new BigDecimal(0);
|
| | | // 查询UID的分享赚订单
|
| | | List<PidOrder> pidOrderList = pidOrderMapper.getCanBalanceListByUid(uid);
|
| | | for (PidOrder pidOrder : pidOrderList) {
|
| | | HongBao hongBao = hongBaoMapper.selectByPrimaryKeyForUpdate(pidOrder.getHongBao().getId());
|
| | | types.clear();
|
| | | types.add(HongBaoV2.TYPE_SHARE_GOODS);
|
| | | List<HongBaoV2> hongBaoShareList = hongBaoV2Mapper.listCanBalanceHongBaoByTypeAndUid(types, uid, 10000);
|
| | | for (HongBaoV2 hongBao : hongBaoShareList) {
|
| | | hongBao = hongBaoV2Mapper.selectByPrimaryKeyForUpdate(hongBao.getId());
|
| | | hongBao = filterWeiQuanINGHongBao(hongBao);
|
| | | if (hongBao == null)
|
| | | continue;
|
| | | if (hongBao.getState() == HongBao.STATE_BUKELINGQU || hongBao.getState() == HongBao.STATE_KELINGQU) {
|
| | | if (hongBao.getState() == HongBaoV2.STATE_BUKELINGQU || hongBao.getState() == HongBaoV2.STATE_KELINGQU) {
|
| | | sharemoney = sharemoney.add(hongBao.getMoney());
|
| | | HongBao updateHongBao = new HongBao();
|
| | | HongBaoV2 updateHongBao = new HongBaoV2();
|
| | | updateHongBao.setId(hongBao.getId());
|
| | | updateHongBao.setGetTime(System.currentTimeMillis());
|
| | | updateHongBao.setGetTime(new Date());
|
| | | updateHongBao.setState(HongBao.STATE_YILINGQU);
|
| | | hongBaoMapper.updateByPrimaryKeySelective(updateHongBao);
|
| | | hongBaoV2Mapper.updateByPrimaryKeySelective(updateHongBao);
|
| | | // 添加到红包返利记录集合
|
| | | hbIdList.add(hongBao.getId());
|
| | | // 2018-08-05 过后的订单才处理维权
|
| | | Date balanceTime = null;
|
| | | if (hongBao.getParent() != null)
|
| | | balanceTime = hongBao.getParent().getBalanceTime();
|
| | | else
|
| | | balanceTime = hongBao.getBalanceTime();
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByHongBaoId(hongBao.getId());
|
| | | if (hongBaoOrder != null)
|
| | | balanceTime = hongBaoOrder.getCommonOrder().getSettleTime();
|
| | | if (balanceTime != null
|
| | | && balanceTime.getTime() >= TimeUtil.convertToTimeTemp("2018-08-05", "yyyy-MM-dd")) {
|
| | | drawBackOrders.add(pidOrder.getOrderId());
|
| | | drawBackOrders.add(hongBaoOrder.getCommonOrder().getOrderNo());
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | //统计分享订单的数据
|
| | | try {
|
| | | hongBao.setAuctionId(order.getAuctionId());
|
| | | userShareGoodsGroupService.updateOrderRecord(hongBao);
|
| | | } catch (UserShareGoodsRecordException e1) {
|
| | | try {
|
| | |
| | | package com.yeshi.fanli.service.impl.taobao;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.HashMap;
|
| | | import java.util.Iterator;
|
| | |
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.AccountDetailsMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.HongBaoV2Mapper;
|
| | | 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.CommonOrderMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.order.HongBaoOrderMapper;
|
| | | 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.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | | import com.yeshi.fanli.entity.money.UserMoneyDetail;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | | 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.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.Constant;
|
| | | 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;
|
| | | import com.yeshi.fanli.vo.order.CommonOrderVO;
|
| | |
|
| | | @Service
|
| | | public class TaoBaoWeiQuanDrawBackServiceImpl implements TaoBaoWeiQuanDrawBackService {
|
| | | @Resource
|
| | | private TaoBaoWeiQuanDrawBackMapper taoBaoWeiQuanDrawBackMapper;
|
| | |
|
| | | @Resource
|
| | | private HongBaoMapper hongBaoMapper;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoWeiQuanOrderService taoBaoWeiQuanOrderService;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserNotificationService userNotificationService;
|
| | |
|
| | | @Resource
|
| | | private CommonOrderMapper commonOrderMapper;
|
| | |
|
| | | @Resource
|
| | | private HongBaoV2Mapper hongBaoV2Mapper;
|
| | |
|
| | | @Resource
|
| | | private HongBaoOrderMapper hongBaoOrderMapper;
|
| | |
|
| | | @Override
|
| | | public void addWeiQuanDrawBack(TaoBaoWeiQuanDrawBack taoBaoWeiQuanDrawBack) {
|
| | |
| | | sumFee = sumFee.add(order.geteIncome());
|
| | | // 获取和该订单号有关联的用户
|
| | | // 获取主红包(同一个订单号的单只会对应同一个用户)
|
| | | List<HongBao> mainHongBaoList = hongBaoMapper.selectByOrderIdWithoutChild(orderId);
|
| | | List<CommonOrderVO> typeList = new ArrayList<>();
|
| | | CommonOrderVO cv = new CommonOrderVO();
|
| | | cv.setSourceType(Constant.SOURCE_TYPE_TAOBAO);
|
| | | cv.setOrderNo(orderId);
|
| | | typeList.add(cv);
|
| | |
|
| | | List<CommonOrderVO> commonOrderList = commonOrderMapper.listByOrderNoAndType(typeList);
|
| | | List<HongBaoV2> mainHongBaoList = new ArrayList<>();
|
| | | if (commonOrderList != null)
|
| | | for (CommonOrderVO vo : commonOrderList) {
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(vo.getId());
|
| | | mainHongBaoList.add(hongBaoOrder.getHongBaoV2());
|
| | | }
|
| | | if (mainHongBaoList == null || mainHongBaoList.size() == 0)
|
| | | return;
|
| | | for (int i = 0; i < mainHongBaoList.size(); i++) {
|
| | | // 只处理返利订单
|
| | | if (mainHongBaoList.get(i).getType() != HongBao.TYPE_TAOBAO) {
|
| | | if (mainHongBaoList.get(i).getType() != HongBaoV2.TYPE_ZIGOU) {
|
| | | mainHongBaoList.remove(i);
|
| | | i--;
|
| | | }
|
| | |
| | | Map<Long, BigDecimal> fanMoneyMap = new HashMap<>();
|
| | |
|
| | | if (mainHongBaoList != null)
|
| | | for (HongBao hongBao : mainHongBaoList) {
|
| | | if (hongBao.getState() == HongBao.STATE_SHIXIAO)
|
| | | for (HongBaoV2 hongBao : mainHongBaoList) {
|
| | | if (hongBao.getState() == HongBaoV2.STATE_SHIXIAO)
|
| | | continue;
|
| | | // 累计主红包的金额
|
| | | if (fanMoneyMap.get(hongBao.getUserInfo().getId()) == null) {
|
| | |
| | | sumFee = sumFee.add(order.geteIncome());
|
| | | // 获取和该订单号有关联的用户
|
| | | // 获取主红包(同一个订单号的单只会对应同一个用户)
|
| | | List<HongBao> mainHongBaoList = hongBaoMapper.selectByOrderIdWithoutChild(orderId);
|
| | |
|
| | | List<CommonOrderVO> typeList = new ArrayList<>();
|
| | | CommonOrderVO cv = new CommonOrderVO();
|
| | | cv.setSourceType(Constant.SOURCE_TYPE_TAOBAO);
|
| | | cv.setOrderNo(orderId);
|
| | | typeList.add(cv);
|
| | |
|
| | | List<CommonOrderVO> commonOrderList = commonOrderMapper.listByOrderNoAndType(typeList);
|
| | | List<HongBaoV2> mainHongBaoList = new ArrayList<>();
|
| | | if (commonOrderList != null)
|
| | | for (CommonOrderVO vo : commonOrderList) {
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(vo.getId());
|
| | | mainHongBaoList.add(hongBaoOrder.getHongBaoV2());
|
| | | }
|
| | |
|
| | | if (mainHongBaoList == null || mainHongBaoList.size() == 0)
|
| | | return;
|
| | |
|
| | |
| | | Map<Long, BigDecimal> fanMoneyMap = new HashMap<>();
|
| | |
|
| | | if (mainHongBaoList != null)
|
| | | for (HongBao hongBao : mainHongBaoList) {
|
| | | if (hongBao.getState() == HongBao.STATE_SHIXIAO)
|
| | | for (HongBaoV2 hongBao : mainHongBaoList) {
|
| | | hongBao = hongBaoV2Mapper.selectByPrimaryKey(hongBao.getId());
|
| | | if (hongBao.getState() == HongBaoV2.STATE_SHIXIAO)
|
| | | continue;
|
| | |
|
| | | // 返利红包不计入
|
| | | if (hongBao.getType() != HongBao.TYPE_TAOBAO) {
|
| | | if (hongBao.getType() != HongBaoV2.TYPE_ZIGOU) {
|
| | | // 累计主红包的金额
|
| | | if (fanMoneyMap.get(hongBao.getUserInfo().getId()) == null) {
|
| | | fanMoneyMap.put(hongBao.getUserInfo().getId(), hongBao.getMoney());
|
| | |
| | | fanMoneyMap.get(hongBao.getUserInfo().getId()).add(hongBao.getMoney()));
|
| | | }
|
| | | // 累计子红包的金额
|
| | | List<HongBao> childHongBaoList = hongBaoMapper.selectChildHongBaoByPid(hongBao.getId());
|
| | | List<HongBaoV2> childHongBaoList = hongBaoV2Mapper.listChildrenById(hongBao.getId());
|
| | | if (childHongBaoList != null)
|
| | | for (HongBao child : childHongBaoList) {
|
| | | if (child.getState() == HongBao.STATE_SHIXIAO)
|
| | | for (HongBaoV2 child : childHongBaoList) {
|
| | | if (child.getState() == HongBaoV2.STATE_SHIXIAO)
|
| | | continue;
|
| | | if (fanMoneyMap.get(child.getUserInfo().getId()) == null) {
|
| | | fanMoneyMap.put(child.getUserInfo().getId(), child.getMoney());
|
| | |
| | | sumFee = sumFee.add(order.geteIncome());
|
| | | // 获取和该订单号有关联的用户
|
| | | // 获取主红包(同一个订单号的单只会对应同一个用户)
|
| | | List<HongBao> mainHongBaoList = hongBaoMapper.selectByOrderIdWithoutChild(orderId);
|
| | | List<CommonOrderVO> typeList = new ArrayList<>();
|
| | | CommonOrderVO cv = new CommonOrderVO();
|
| | | cv.setSourceType(Constant.SOURCE_TYPE_TAOBAO);
|
| | | cv.setOrderNo(orderId);
|
| | | typeList.add(cv);
|
| | |
|
| | | List<CommonOrderVO> commonOrderList = commonOrderMapper.listByOrderNoAndType(typeList);
|
| | | List<HongBaoV2> mainHongBaoList = new ArrayList<>();
|
| | | if (commonOrderList != null)
|
| | | for (CommonOrderVO vo : commonOrderList) {
|
| | | HongBaoOrder hongBaoOrder = hongBaoOrderMapper.selectByCommonOrderId(vo.getId());
|
| | | mainHongBaoList.add(hongBaoOrder.getHongBaoV2());
|
| | | }
|
| | | if (mainHongBaoList == null || mainHongBaoList.size() == 0)
|
| | | return;
|
| | |
|
| | |
| | | Map<Long, BigDecimal> fanMoneyMap = new HashMap<>();
|
| | |
|
| | | if (mainHongBaoList != null)
|
| | | for (HongBao hongBao : mainHongBaoList) {
|
| | | if (hongBao.getState() == HongBao.STATE_SHIXIAO)
|
| | | for (HongBaoV2 hongBao : mainHongBaoList) {
|
| | | if (hongBao.getState() == HongBaoV2.STATE_SHIXIAO)
|
| | | continue;
|
| | | // 返利红包不计入
|
| | | if (hongBao.getType() != HongBao.TYPE_TAOBAO) {
|
| | | if (hongBao.getType() != HongBaoV2.TYPE_ZIGOU) {
|
| | | // 累计主红包的金额
|
| | | if (fanMoneyMap.get(hongBao.getUserInfo().getId()) == null) {
|
| | | fanMoneyMap.put(hongBao.getUserInfo().getId(), hongBao.getMoney());
|
| | |
| | | fanMoneyMap.get(hongBao.getUserInfo().getId()).add(hongBao.getMoney()));
|
| | | }
|
| | | // 累计子红包的金额
|
| | | List<HongBao> childHongBaoList = hongBaoMapper.selectChildHongBaoByPid(hongBao.getId());
|
| | | List<HongBaoV2> childHongBaoList = hongBaoV2Mapper.listChildrenById(hongBao.getId());
|
| | | if (childHongBaoList != null)
|
| | | for (HongBao child : childHongBaoList) {
|
| | | if (child.getState() == HongBao.STATE_SHIXIAO)
|
| | | for (HongBaoV2 child : childHongBaoList) {
|
| | | if (child.getState() == HongBaoV2.STATE_SHIXIAO)
|
| | | continue;
|
| | | if (fanMoneyMap.get(child.getUserInfo().getId()) == null) {
|
| | | fanMoneyMap.put(child.getUserInfo().getId(), child.getMoney());
|
| | |
| | | package com.yeshi.fanli.service.inter.hongbao;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.dto.HongBaoDTO;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | |
| | |
|
| | | public HongBaoV2 selectByPrimaryKey(Long id);
|
| | |
|
| | |
|
| | | /**
|
| | | * 添加红包
|
| | | * @param commonOrder 订单对象
|
| | | * @param type 类型
|
| | | * |
| | | * @param commonOrder
|
| | | * 订单对象
|
| | | * @param type
|
| | | * 类型
|
| | | * @throws HongBaoException
|
| | | */
|
| | | public void addHongBao(CommonOrder commonOrder,int type) throws HongBaoException;
|
| | |
| | | */
|
| | | public void convert(HongBao hb);
|
| | |
|
| | | /**
|
| | | * 奖金列表(1.4.9之前的版本)
|
| | | * |
| | | * @param uid
|
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return
|
| | | */
|
| | | public List<HongBaoDTO> listJiangJinByUid(Long uid, int page, int pageSize);
|
| | |
|
| | | /**
|
| | | * 奖金数量(1.4.9之前的版本)
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public long countJiangJinByUid(Long uid);
|
| | |
|
| | | /**
|
| | | * 总共的提成金额
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | |
|
| | | BigDecimal getTotalTiChengMoney(Long uid);
|
| | |
|
| | | /**
|
| | | * 获取总的提成笔数
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | int getTotalTiChengCount(Long uid);
|
| | |
|
| | | /**
|
| | | * 获取还未到账的提成金额
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | BigDecimal getUnGetTiChengMoney(Long uid);
|
| | | |
| | | |
| | | /**
|
| | | * 获取总共返利金额
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | BigDecimal getTotalFanLiMoney(Long uid);
|
| | |
|
| | | /**
|
| | | * 获取还未到账的金额
|
| | | * |
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | BigDecimal getUnRecievedFanLiMoney(Long uid);
|
| | |
|
| | | }
|
| | |
| | | import java.util.Map;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | | import com.yeshi.fanli.entity.taobao.PidOrder;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.exception.HongBaoException;
|
| | |
| | | */
|
| | | public void fanli(HongBao hongBao) throws TaoBaoWeiQuanException;
|
| | |
|
| | | |
| | | /**
|
| | | * 购物返利
|
| | | * @param hongBao type=1的主红包
|
| | | * @throws TaoBaoWeiQuanException
|
| | | */
|
| | | public void fanli(HongBaoV2 hongBao) throws TaoBaoWeiQuanException;
|
| | |
|
| | | /**
|
| | | * 邀请赚返利
|
| | | *
|
| | |
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | | import org.yeshi.utils.CMQUtil;
|
| | |
|
| | | import com.alipay.api.response.AlipayFundTransToaccountTransferResponse;
|
| | | import com.google.gson.Gson;
|
| | |
| | | import com.yeshi.fanli.entity.bus.user.AlipayTransferResultInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.common.AdminUser;
|
| | | import com.yeshi.fanli.entity.push.PushQueueRecord;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import org.yeshi.utils.CMQUtil;
|
| | |
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | public class CMQManager {
|
| | | private static String secretId = "AKIDTlpgJhLjOozvd6QI2XnpfGbgV4NQJk25";
|
| | |
| | |
|
| | | // TODO 返利队列
|
| | | public static String FANLI_ORDER = "fanli-order";
|
| | |
|
| | | // TODO 返利队列
|
| | | public static String FANLI_ORDER_NEW = "fanli-order-new";
|
| | |
|
| | | // TODO 提成订单
|
| | | public static String FANLI_TICHENG_ORDER = "fanli-ticheng-order";
|
| | | // TODO 维权订单
|
| | |
| | | EXTRACT_RESULT += "-" + Constant.systemCommonConfig.getProjectName();
|
| | | PUSH_IOS += "-" + Constant.systemCommonConfig.getProjectName();
|
| | | FANLI_ORDER += "-" + Constant.systemCommonConfig.getProjectName();
|
| | | FANLI_ORDER_NEW += "-" + Constant.systemCommonConfig.getProjectName();
|
| | | FANLI_TICHENG_ORDER += "-" + Constant.systemCommonConfig.getProjectName();
|
| | | ORDER_WEIQUAN += "-" + Constant.systemCommonConfig.getProjectName();
|
| | |
|
| | |
| | | cmqUtil.createQueue(EXTRACT_RESULT);
|
| | | cmqUtil.createQueue(PUSH_IOS);
|
| | | cmqUtil.createQueue(FANLI_ORDER);
|
| | | cmqUtil.createQueue(FANLI_ORDER_NEW);
|
| | | cmqUtil.createQueue(FANLI_TICHENG_ORDER);
|
| | | cmqUtil.createQueue(ORDER_WEIQUAN);
|
| | | cmqUtil.createQueue(GOODS_UPDATE);
|
| | |
| | | cmqUtil.sendMsg(FANLI_ORDER, content);
|
| | | }
|
| | |
|
| | | // 新版订单返利
|
| | | public void addFanLiMsgNew(HongBaoV2 hongBao) {
|
| | | String content = new Gson().toJson(hongBao);
|
| | | cmqUtil.sendMsg(FANLI_ORDER_NEW, content);
|
| | | }
|
| | |
|
| | | public Map<String, HongBao> consumeFanLiMsg(int count) {
|
| | | List<Message> list = cmqUtil.recieveMsg(count, FANLI_ORDER);
|
| | | Map<String, HongBao> map = new HashMap<>();
|
| | |
| | | return map;
|
| | | }
|
| | |
|
| | | |
| | | public Map<String, HongBaoV2> consumeFanLiMsgNew(int count) {
|
| | | List<Message> list = cmqUtil.recieveMsg(count, FANLI_ORDER_NEW);
|
| | | Map<String, HongBaoV2> map = new HashMap<>();
|
| | | if (list != null)
|
| | | for (Message msg : list) {
|
| | | String result = msg.msgBody;
|
| | | if (!StringUtil.isNullOrEmpty(result)) {
|
| | | HongBaoV2 hongBao = new Gson().fromJson(result, HongBaoV2.class);
|
| | | map.put(msg.receiptHandle, hongBao);
|
| | | }
|
| | | }
|
| | | return map;
|
| | | }
|
| | | |
| | |
|
| | | public void deleteFanLiMsg(String receiptHandle) {
|
| | | cmqUtil.deleteMsg(FANLI_ORDER, receiptHandle);
|
| | | }
|
| | |
|
| | | public void deleteFanLiMsgNew(String receiptHandle) {
|
| | | cmqUtil.deleteMsg(FANLI_ORDER_NEW, receiptHandle);
|
| | | }
|
| | |
|
| | | // 提成返利
|
| | | public void addFanLiTiChengMsg(Long uid) {
|
| | | cmqUtil.sendMsg(FANLI_TICHENG_ORDER, uid + "");
|
| | |
| | | import org.springframework.context.event.ContextRefreshedEvent;
|
| | | import org.springframework.core.task.TaskExecutor;
|
| | | import org.springframework.stereotype.Component;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | | import org.yeshi.utils.tencentcloud.entity.COSInitParams;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.AlipayTransferResultInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.push.PushQueueRecord;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | |
| | | import com.yeshi.fanli.service.inter.push.IOSPushService;
|
| | | import com.yeshi.fanli.service.inter.user.ExtractService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | | import org.yeshi.utils.tencentcloud.entity.COSInitParams;
|
| | |
|
| | | /**
|
| | | * 系统初始化
|
| | |
| | | }
|
| | |
|
| | | /**
|
| | | * 处理新版淘宝订单返利
|
| | | */
|
| | | public void doOrderFanLiNew() {
|
| | | executor.execute(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | while (true) {
|
| | | try {
|
| | | Map<String, HongBaoV2> map = CMQManager.getInstance().consumeFanLiMsgNew(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().deleteFanLiMsgNew(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) {
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
| | | });
|
| | | }
|
| | |
|
| | | /**
|
| | | * 处理淘宝提成订单返利
|
| | | */
|
| | | public void doOrderTiChengFanLi() {
|
| | |
| | | package com.yeshi.fanli.util.factory;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.Map;
|
| | |
|
| | | import javax.annotation.PostConstruct;
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Component;
|
| | |
|
| | | import com.yeshi.fanli.dto.HongBaoDTO;
|
| | | import com.yeshi.fanli.entity.bus.user.HongBao;
|
| | | import com.yeshi.fanli.entity.bus.user.Order;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | |
| | |
|
| | | @Component
|
| | | public class HongBaoFactory {
|
| | | |
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
| | |
|
| | | /**
|
| | | *
|
| | | * @param money 金额
|
| | | * @param orderId 系统的订单ID
|
| | | * @param money
|
| | | * 金额
|
| | | * @param orderId
|
| | | * 系统的订单ID
|
| | | * @param parent
|
| | | * @param userInfo
|
| | | * @return
|
| | |
| | | return createHongBao(money, null,orderId, parent, userInfo, null, type,null,null);
|
| | | }
|
| | |
|
| | | public static HongBao createHongBao(BigDecimal money,String param,Long orderId,HongBao parent,UserInfo userInfo,int type) {
|
| | | public static HongBao createHongBao(BigDecimal money, String param, Long orderId, HongBao parent, UserInfo userInfo,
|
| | | int type) {
|
| | | return createHongBao(money, param,orderId, parent, userInfo, null, type,null,null);
|
| | | }
|
| | |
|
| | | public static HongBao createHongBao(BigDecimal money,String param,Long orderId,HongBao parent,UserInfo userInfo,int type,BigDecimal payMoney,Long auctionId) {
|
| | | public static HongBao createHongBao(BigDecimal money, String param, Long orderId, HongBao parent, UserInfo userInfo,
|
| | | int type, BigDecimal payMoney, Long auctionId) {
|
| | | return createHongBao(money, param,orderId, parent, userInfo, null, type,payMoney,auctionId);
|
| | | }
|
| | |
|
| | | public static HongBao createHongBao(BigDecimal money,String param,Long orderId,HongBao parent,UserInfo userInfo,Long preGettime,int type,BigDecimal payMoney,Long auctionId) {
|
| | | public static HongBao createHongBao(BigDecimal money, String param, Long orderId, HongBao parent, UserInfo userInfo,
|
| | | Long preGettime, int type, BigDecimal payMoney, Long auctionId) {
|
| | | HongBao hongBao = new HongBao();
|
| | | long timeMillis = System.currentTimeMillis();
|
| | | hongBao.setCreatetime(timeMillis);
|
| | |
| | | return hongBao;
|
| | | }
|
| | |
|
| | | public static HongBao createHongBao(HongBaoDTO hongBaoDTO) {
|
| | | HongBao hongBao = new HongBao();
|
| | | hongBao.setId(hongBaoDTO.getId());
|
| | | hongBao.setOrderId(hongBaoDTO.getOrderId());
|
| | |
|
| | | if (hongBaoDTO.getSettlement() != null)
|
| | | hongBao.setPayMoney(hongBaoDTO.getSettlement());
|
| | | else
|
| | | hongBao.setPayMoney(hongBaoDTO.getPayMoney());
|
| | |
|
| | | hongBao.setCreatetime(hongBaoDTO.getCreateTime().getTime());
|
| | | hongBao.setMoney(hongBaoDTO.getMoney());
|
| | | hongBao.setState(hongBaoDTO.getState());
|
| | | hongBao.setType(hongBaoDTO.getType());
|
| | | hongBao.setUserInfo(hongBaoDTO.getUserInfo());
|
| | | return hongBao;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.util.factory;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | | import com.yeshi.fanli.entity.bus.user.OrderItem;
|
| | | import com.yeshi.fanli.entity.order.CommonOrder;
|
| | | import com.yeshi.fanli.entity.order.HongBaoOrder;
|
| | |
|
| | | public class OrderItemFactory {
|
| | |
|
| | | public static OrderItem create(HongBaoOrder hongBaoOrder) {
|
| | | OrderItem orderItem = new OrderItem();
|
| | |
|
| | | orderItem.setAuctionId(Long.parseLong(hongBaoOrder.getCommonOrder().getCommonOrderGoods().getGoodsId()));
|
| | | orderItem.setCreateTime(hongBaoOrder.getHongBaoV2().getCreateTime().getTime());
|
| | | orderItem.setFanMoney(hongBaoOrder.getHongBaoV2().getMoney());
|
| | | orderItem.setId(hongBaoOrder.getHongBaoV2().getId());
|
| | | orderItem.setOrderId(hongBaoOrder.getCommonOrder().getOrderNo());
|
| | | if (hongBaoOrder.getCommonOrder().getState() == CommonOrder.STATE_JS)
|
| | | orderItem.setPayMoney(hongBaoOrder.getCommonOrder().getSettlement());
|
| | | else
|
| | | orderItem.setPayMoney(hongBaoOrder.getCommonOrder().getPayment());
|
| | | orderItem.setPicture(hongBaoOrder.getCommonOrder().getCommonOrderGoods().getPicture());
|
| | |
|
| | | switch (hongBaoOrder.getHongBaoV2().getState()) {
|
| | | case HongBaoV2.STATE_BUKELINGQU:
|
| | | orderItem.setState(OrderItem.STATE_YIZHIFU);
|
| | | break;
|
| | | case HongBaoV2.STATE_KELINGQU:
|
| | | orderItem.setState(OrderItem.STATE_JIESUAN);
|
| | | break;
|
| | | case HongBaoV2.STATE_SHIXIAO:
|
| | | orderItem.setState(OrderItem.STATE_TUIKUAN);
|
| | | break;
|
| | | case HongBaoV2.STATE_YILINGQU:
|
| | | orderItem.setState(OrderItem.STATE_DAOZHANG);
|
| | | break;
|
| | | }
|
| | |
|
| | | orderItem.setTitle(hongBaoOrder.getCommonOrder().getCommonOrderGoods().getTitle());
|
| | |
|
| | | return orderItem;
|
| | | }
|
| | |
|
| | | }
|