| | |
| | | data.put("shopList", JsonUtil.getApiCommonGson().toJson(shopList));
|
| | | }
|
| | |
|
| | | data.put("count", 50);
|
| | | data.put("count", array.size());
|
| | | data.put("list", array);
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.exception.user.TokenRecordException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.brand.BrandInfoService;
|
| | | import com.yeshi.fanli.service.inter.config.BusinessSystemService;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.config.SuperHotSearchService;
|
| | |
| | |
|
| | | @Resource
|
| | | private IntegralGetCacheManager integralGetCacheManager;
|
| | | |
| | | |
| | | @Resource
|
| | | private BrandInfoService brandInfoService;
|
| | | |
| | |
|
| | | /**
|
| | | * 粘贴板信息推荐
|
| | |
| | | data.put("count", result.getTaoBaoHead().getDocsfound());
|
| | |
|
| | | if (page == 1) { // 第一页返回店铺信息
|
| | | List<TaoBaoShopVO> listShop = taoBaoShopService.getShopByKeyV2(key);
|
| | | if (listShop != null && listShop.size() > 0 && listShop.get(0).getListGoodsVO() != null
|
| | | && listShop.get(0).getListGoodsVO().size() > 2) {
|
| | | String platform = acceptData.getPlatform();
|
| | | TaoBaoShopVO taoBaoShop = listShop.get(0);
|
| | | if (("ios".equalsIgnoreCase(platform) && VersionUtil.greaterThan_2_0(platform, acceptData.getVersion()))
|
| | | || ("android".equalsIgnoreCase(platform)
|
| | | && VersionUtil.greaterThan_2_0_1(platform, acceptData.getVersion()))) {
|
| | | BrandInfoVO brandInfoVO = new BrandInfoVO();
|
| | | brandInfoVO.setId(taoBaoShop.getId());
|
| | | brandInfoVO.setName(taoBaoShop.getShopName());
|
| | | brandInfoVO.setIcon(taoBaoShop.getShopIcon());
|
| | | brandInfoVO.setListGoods(taoBaoShop.getListGoodsVO());
|
| | | String platform = acceptData.getPlatform();
|
| | | String version = acceptData.getVersion();
|
| | | if (("ios".equalsIgnoreCase(platform) && VersionUtil.greaterThan_2_1(platform, version))
|
| | | || ("android".equalsIgnoreCase(platform) && VersionUtil.greaterThan_2_0_2(platform, version))) {
|
| | | BrandInfoVO brandInfoVO = brandInfoService.listByAlikeName(key);
|
| | | if (brandInfoVO != null)
|
| | | data.put("shop", JsonUtil.getApiCommonGson().toJson(brandInfoVO));
|
| | | } else {
|
| | | data.put("shop", JsonUtil.getApiCommonGson().toJson(taoBaoShop));
|
| | | } else {
|
| | | List<TaoBaoShopVO> listShop = taoBaoShopService.getShopByKeyV2(key);
|
| | | if (listShop != null && listShop.size() > 0 && listShop.get(0).getListGoodsVO() != null
|
| | | && listShop.get(0).getListGoodsVO().size() > 2) {
|
| | | TaoBaoShopVO taoBaoShop = listShop.get(0);
|
| | | if (("ios".equalsIgnoreCase(platform) && VersionUtil.greaterThan_2_0(platform, version))
|
| | | || ("android".equalsIgnoreCase(platform) && VersionUtil.greaterThan_2_0_1(platform, version))) {
|
| | | BrandInfoVO brandInfoVO = new BrandInfoVO();
|
| | | brandInfoVO.setId(taoBaoShop.getId());
|
| | | brandInfoVO.setName(taoBaoShop.getShopName());
|
| | | brandInfoVO.setIcon(taoBaoShop.getShopIcon());
|
| | | brandInfoVO.setListGoods(taoBaoShop.getListGoodsVO());
|
| | | data.put("shop", JsonUtil.getApiCommonGson().toJson(brandInfoVO));
|
| | | } else {
|
| | | data.put("shop", JsonUtil.getApiCommonGson().toJson(taoBaoShop));
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | }
|
| | |
|
| | |
| | | * @return |
| | | */ |
| | | List<HongBaoV2> listByIds(@Param("idList") List<Long> idList); |
| | | |
| | | |
| | | /** |
| | | * 根据订单交易id查询红包 |
| | | * @param idList |
| | | * @return |
| | | */ |
| | | List<HongBaoDTO> listByOrderTradeId(@Param("tradeId") String tradeId); |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | |
| | | BrandInfo selectByUniqueName(@Param("name") String name, @Param("cid") Long cid, @Param("id") Long id); |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询返回前端品牌 |
| | | * @param start |
| | | * @param count |
| | | * @param cid |
| | | * @return |
| | | */ |
| | | List<BrandInfoVO> listByAlikeName(@Param("key") String key); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.order; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.order.UserOrderWeiQuanRecord; |
| | | |
| | | public interface UserOrderWeiQuanRecordMapper extends BaseMapper<UserOrderWeiQuanRecord> { |
| | | |
| | | } |
| | |
| | | * @return
|
| | | */
|
| | | TaoBaoWeiQuanOrder selectByOrderItem(String tradeId);
|
| | | |
| | | |
| | | /**
|
| | | * 根据状态检索
|
| | | * |
| | | * @param state
|
| | | * @param start
|
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | List<TaoBaoWeiQuanOrder> listByBeginWeiQuan(@Param("start") long start, @Param("count") int count);
|
| | | } |
| | |
| | | import com.yeshi.fanli.entity.bus.user.HongBaoV2;
|
| | |
|
| | | public class HongBaoDTO extends HongBaoV2 {
|
| | | |
| | | private static final long serialVersionUID = 1L;
|
| | | |
| | | private String orderId;
|
| | | private BigDecimal payMoney;
|
| | | private BigDecimal settlement;
|
| | |
| | | </if>
|
| | | LIMIT 1
|
| | | </select>
|
| | | |
| | | |
| | | <select id="listByAlikeName" resultMap="ResultVOMap">
|
| | | SELECT * FROM yeshi_ec_brand_info d
|
| | | WHERE d.`bf_state` = 1 AND d.bf_goods_total <![CDATA[>=]]> 3 AND d.bf_shop_total <![CDATA[>]]> 0
|
| | | AND FIND_IN_SET(#{key},d.bf_name)
|
| | | ORDER BY d.`bf_update_time` DESC
|
| | | </select>
|
| | | |
| | | </mapper>
|
| | |
| | | <!-- <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_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="hb_order_type" property="orderType" jdbcType="INTEGER" />
|
| | |
|
| | | <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.HongBaoV2">
|
| | | <id column="hb_pid" property="id" jdbcType="BIGINT" />
|
| | | </association>
|
| | |
|
| | | </resultMap>
|
| | |
|
| | |
|
| | |
| | | v.hb_id=#{id}
|
| | | </foreach>
|
| | | </select>
|
| | | |
| | | |
| | | <select id="listByOrderTradeId" resultMap="BaseDTOResultMap">
|
| | | SELECT v2.*,d.`co_settlement` AS settlement FROM `yeshi_ec_common_order` d
|
| | | LEFT JOIN `yeshi_ec_hongbao_order` ho ON ho.`ho_order_id` = d.`co_id`
|
| | | LEFT JOIN `yeshi_ec_hongbao_v2` v2 ON IF(v2.`hb_pid` IS NULL, v2.`hb_id`,v2.`hb_pid`) = ho.`ho_hongbao_id`
|
| | | WHERE d.`co_trade_id` = #{tradeId}
|
| | | </select>
|
| | |
|
| | |
|
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
|
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.order.UserOrderWeiQuanRecordMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.order.UserOrderWeiQuanRecord"> |
| | | <id column="wr_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="wr_source_type" property="sourceType" jdbcType="INTEGER"/> |
| | | <result column="wr_trade_id" property="tradeId" jdbcType="VARCHAR"/> |
| | | <result column="wr_uid" property="uid" jdbcType="BIGINT"/> |
| | | <result column="wr_money" property="money" jdbcType="DECIMAL"/> |
| | | <result column="wr_state" property="state" jdbcType="INTEGER"/> |
| | | <result column="wr_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="wr_update_time" property="updateTime" jdbcType="TIMESTAMP"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">wr_id,wr_source_type,wr_trade_id,wr_uid,wr_money,wr_state,wr_create_time,wr_update_time</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select |
| | | <include refid="Base_Column_List"/>from yeshi_ec_user_order_weiquan_record where wr_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_user_order_weiquan_record where wr_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.order.UserOrderWeiQuanRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_order_weiquan_record (wr_id,wr_source_type,wr_trade_id,wr_uid,wr_money,wr_state,wr_create_time,wr_update_time) values (#{id,jdbcType=BIGINT},#{sourceType,jdbcType=INTEGER},#{tradeId,jdbcType=VARCHAR},#{uid,jdbcType=BIGINT},#{money,jdbcType=DECIMAL},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.order.UserOrderWeiQuanRecord" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_user_order_weiquan_record |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">wr_id,</if> |
| | | <if test="sourceType != null">wr_source_type,</if> |
| | | <if test="tradeId != null">wr_trade_id,</if> |
| | | <if test="uid != null">wr_uid,</if> |
| | | <if test="money != null">wr_money,</if> |
| | | <if test="state != null">wr_state,</if> |
| | | <if test="createTime != null">wr_create_time,</if> |
| | | <if test="updateTime != null">wr_update_time,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="sourceType != null">#{sourceType,jdbcType=INTEGER},</if> |
| | | <if test="tradeId != null">#{tradeId,jdbcType=VARCHAR},</if> |
| | | <if test="uid != null">#{uid,jdbcType=BIGINT},</if> |
| | | <if test="money != null">#{money,jdbcType=DECIMAL},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.order.UserOrderWeiQuanRecord">update yeshi_ec_user_order_weiquan_record set wr_source_type = #{sourceType,jdbcType=INTEGER},wr_trade_id = #{tradeId,jdbcType=VARCHAR},wr_uid = #{uid,jdbcType=BIGINT},wr_money = #{money,jdbcType=DECIMAL},wr_state = #{state,jdbcType=INTEGER},wr_create_time = #{createTime,jdbcType=TIMESTAMP},wr_update_time = #{updateTime,jdbcType=TIMESTAMP} where wr_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.order.UserOrderWeiQuanRecord">update yeshi_ec_user_order_weiquan_record |
| | | <set> |
| | | <if test="sourceType != null">wr_source_type=#{sourceType,jdbcType=INTEGER},</if> |
| | | <if test="tradeId != null">wr_trade_id=#{tradeId,jdbcType=VARCHAR},</if> |
| | | <if test="uid != null">wr_uid=#{uid,jdbcType=BIGINT},</if> |
| | | <if test="money != null">wr_money=#{money,jdbcType=DECIMAL},</if> |
| | | <if test="state != null">wr_state=#{state,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">wr_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">wr_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> where wr_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | |
| | | </select>
|
| | |
|
| | |
|
| | | <select id="listByBeginWeiQuan" resultMap="BaseResultMap">
|
| | | select <include refid="Base_Column_List" /> from yeshi_ec_taobao_weiqaun_order
|
| | | where tmo_state like '维权成功%'
|
| | | limit #{start},#{count}
|
| | | </select>
|
| | |
|
| | |
|
| | |
|
| | | <select id="listByState" resultMap="BaseResultMap">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | |
| | | }
|
| | | return listInfo;
|
| | | }
|
| | | |
| | | |
| | | |
| | | |
| | | @Override
|
| | | @Cacheable(value = "brandCache", key = "'listByAlikeName-'+#key")
|
| | | public BrandInfoVO listByAlikeName(String key) {
|
| | | if (StringUtil.isNullOrEmpty(key))
|
| | | return null;
|
| | | |
| | | List<BrandInfoVO> list = brandInfoMapper.listByAlikeName(key);
|
| | | if (list == null || list.size() == 0)
|
| | | return null;
|
| | |
|
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | | ConfigParamsDTO configParamsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE,hongBaoManageService.getVIPFanLiRate());
|
| | | |
| | | BrandInfoVO brand = list.get(0);
|
| | | List<BrandGoodsCahe> listGoods = brandGoodsCaheService.getByBrandId(1, 3, brand.getId());
|
| | | if (listGoods == null || listGoods.size() < 3)
|
| | | return null;
|
| | |
|
| | | List<GoodsDetailVO> listGoodsVO = new ArrayList<GoodsDetailVO>();
|
| | | for (BrandGoodsCahe brandGoods : listGoods) {
|
| | | JDGoods goodsJD = brandGoods.getGoodsJD();
|
| | | if (goodsJD != null) {
|
| | | listGoodsVO.add(GoodsDetailVOFactory.convertJDGoods(goodsJD, configParamsDTO));
|
| | | continue;
|
| | | }
|
| | |
|
| | | TaoBaoGoodsBrief goodsTB = brandGoods.getGoodsTB();
|
| | | if (goodsTB != null) {
|
| | | listGoodsVO.add(GoodsDetailVOFactory.convertTaoBao(goodsTB, configParamsDTO));
|
| | | continue;
|
| | | }
|
| | |
|
| | | PDDGoodsDetail goodsPDD = brandGoods.getGoodsPDD();
|
| | | if (goodsPDD != null) {
|
| | | listGoodsVO.add(GoodsDetailVOFactory.convertPDDGoods(goodsPDD, configParamsDTO));
|
| | | continue;
|
| | | }
|
| | | }
|
| | |
|
| | | if (listGoodsVO.size() < 3) |
| | | return null;
|
| | | |
| | | brand.setListGoods(listGoodsVO);
|
| | | return brand;
|
| | | }
|
| | | }
|
| | |
| | | else
|
| | | return null;
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<TaoBaoWeiQuanDrawBack> getByOrderItemId(String orderItemId) {
|
| | | return taoBaoWeiQuanDrawBackMapper.selectByOrderItemId(orderItemId);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public TaoBaoWeiQuanDrawBack selectByOrderItemIdAndUid(String orderItemId, Long uid) {
|
| | |
| | | import com.yeshi.fanli.service.inter.user.UserSystemCouponService;
|
| | | import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
|
| | | import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.vip.UserVIPInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | | public List<HongBaoV2> listByIds(List<Long> idList) {
|
| | | return hongBaoV2Mapper.listByIds(idList);
|
| | | }
|
| | | |
| | | |
| | | @Override
|
| | | public List<HongBaoDTO> listByOrderTradeId(String tradeId) {
|
| | | return hongBaoV2Mapper.listByOrderTradeId(tradeId);
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.order;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.order.UserOrderWeiQuanRecordMapper;
|
| | | import com.yeshi.fanli.dto.HongBaoDTO;
|
| | | import com.yeshi.fanli.entity.order.UserOrderWeiQuanRecord;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanDrawBack;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
|
| | | import com.yeshi.fanli.service.inter.money.tb.TaoBaoWeiQuanDrawBackService;
|
| | | import com.yeshi.fanli.service.inter.order.HongBaoV2Service;
|
| | | import com.yeshi.fanli.service.inter.order.UserOrderWeiQuanRecordService;
|
| | | import com.yeshi.fanli.service.inter.order.tb.TaoBaoWeiQuanOrderService;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | |
|
| | | @Service
|
| | | public class UserOrderWeiQuanRecordServiceImpl implements UserOrderWeiQuanRecordService {
|
| | | |
| | | @Resource
|
| | | private UserOrderWeiQuanRecordMapper userOrderWeiQuanRecordMapper;
|
| | | |
| | | @Resource
|
| | | private TaoBaoWeiQuanOrderService taoBaoWeiQuanOrderService;
|
| | | |
| | | @Resource
|
| | | private TaoBaoWeiQuanDrawBackService taoBaoWeiQuanDrawBackService;
|
| | | |
| | | @Resource
|
| | | private HongBaoV2Service hongBaoV2Service;
|
| | | |
| | | @Override
|
| | | public void syncPrevious() {
|
| | | BigDecimal zero = new BigDecimal(0);
|
| | | for (int page = 1; page < Integer.MAX_VALUE; page++) {
|
| | | List<TaoBaoWeiQuanOrder> list = taoBaoWeiQuanOrderService.listByBeginWeiQuan(page, 100);
|
| | | if (list == null || list.isEmpty()) |
| | | break;
|
| | | |
| | | for (TaoBaoWeiQuanOrder weiQuanOrder: list) {
|
| | | String orderItemId = weiQuanOrder.getOrderItemId();
|
| | | |
| | | List<HongBaoDTO> listV2 = hongBaoV2Service.listByOrderTradeId(orderItemId);
|
| | | for (HongBaoDTO hongBaoV2: listV2) {
|
| | | Long uid = hongBaoV2.getUserInfo().getId();
|
| | | TaoBaoWeiQuanDrawBack drawBack= taoBaoWeiQuanDrawBackService.selectByOrderItemIdAndUid(orderItemId, uid);
|
| | | |
| | | int state = 0;
|
| | | BigDecimal money = null;
|
| | | if (drawBack != null) {
|
| | | state = 1; // 已扣款
|
| | | BigDecimal drawBackMoney = drawBack.getDrawBackMoney();
|
| | | if (drawBackMoney.compareTo(zero) > 0) {
|
| | | money = drawBackMoney;
|
| | | }
|
| | | }
|
| | | |
| | | if (money == null) {
|
| | | // (维权金额/结算金额) * 返利金额 |
| | | BigDecimal wqmoney = weiQuanOrder.getMoney();
|
| | | money = wqmoney.divide(hongBaoV2.getSettlement(), 2, BigDecimal.ROUND_DOWN)
|
| | | .multiply(hongBaoV2.getMoney()).setScale(2, BigDecimal.ROUND_DOWN);
|
| | | |
| | | // 大于返利金额 则等于返利金额
|
| | | if (money.compareTo(hongBaoV2.getMoney()) > 0)
|
| | | money = hongBaoV2.getMoney();
|
| | | }
|
| | | |
| | | UserOrderWeiQuanRecord weiQuanRecord = new UserOrderWeiQuanRecord();
|
| | | weiQuanRecord.setUid(uid);
|
| | | weiQuanRecord.setSourceType(1); // 淘宝
|
| | | weiQuanRecord.setTradeId(orderItemId);
|
| | | weiQuanRecord.setCreateTime(weiQuanOrder.getCreateTime());
|
| | | weiQuanRecord.setMoney(money);
|
| | | weiQuanRecord.setState(state);
|
| | | userOrderWeiQuanRecordMapper.insertSelective(weiQuanRecord);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | |
| | | return taoBaoWeiQuanOrderMapper.selectByOrderItem(tradeId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<TaoBaoWeiQuanOrder> listByBeginWeiQuan(int page, int pageSize) {
|
| | | return taoBaoWeiQuanOrderMapper.listByBeginWeiQuan((page - 1) * pageSize, pageSize);
|
| | | }
|
| | | }
|
| | |
| | |
|
| | | public void updateOrder(Long id, Integer moveType) throws BrandInfoException;
|
| | |
|
| | | /**
|
| | | * 搜索关键词匹配品牌
|
| | | * @param key
|
| | | * @return
|
| | | */
|
| | | public BrandInfoVO listByAlikeName(String key);
|
| | |
|
| | | }
|
| | |
| | | package com.yeshi.fanli.service.inter.money.tb;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanDrawBack;
|
| | | import com.yeshi.fanli.exception.order.TaoBaoWeiQuanException;
|
| | |
|
| | |
| | | public TaoBaoWeiQuanDrawBack selectByHongBaoId(Long hbId);
|
| | |
|
| | | /**
|
| | | * 维权信息 订单号 + uid
|
| | | * 维权信息 交易号 + uid
|
| | | * @param orderItemId
|
| | | * @param uid
|
| | | * @return
|
| | | */
|
| | | public TaoBaoWeiQuanDrawBack selectByOrderItemIdAndUid(String orderItemId, Long uid);
|
| | |
|
| | | /**
|
| | | * 通过交易id查询
|
| | | * @param orderItemId
|
| | | * @return
|
| | | */
|
| | | public List<TaoBaoWeiQuanDrawBack> getByOrderItemId(String orderItemId);
|
| | |
|
| | | }
|
| | |
| | | * @return
|
| | | */
|
| | | public List<HongBaoV2> listByIds(List<Long> idList);
|
| | |
|
| | | /**
|
| | | * 根据交易id查询红包信息
|
| | | * @param tradeId
|
| | | * @return
|
| | | */
|
| | | public List<HongBaoDTO> listByOrderTradeId(String tradeId);
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.order;
|
| | |
|
| | | public interface UserOrderWeiQuanRecordService {
|
| | |
|
| | | /**
|
| | | * 同步之前维权信息
|
| | | */
|
| | | public void syncPrevious();
|
| | |
|
| | | }
|
| | |
| | | */
|
| | | public TaoBaoWeiQuanOrder selectByTradeId(String tradeId);
|
| | |
|
| | | |
| | | /**
|
| | | * 查询已维权成功开头
|
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return
|
| | | */
|
| | | List<TaoBaoWeiQuanOrder> listByBeginWeiQuan(int page, int pageSize);
|
| | |
|
| | | }
|
New file |
| | |
| | | package org.fanli;
|
| | |
|
| | | import java.io.BufferedReader;
|
| | | import java.io.File;
|
| | | import java.io.FileReader;
|
| | |
|
| | | public class Test_Thread {
|
| | | public static void main(String[] args) {
|
| | | |
| | | new Thread(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | // TODO Auto-generated method stub
|
| | | |
| | | }
|
| | | });
|
| | | |
| | | }
|
| | | }
|
New file |
| | |
| | | package org.fanli.tlj;
|
| | |
|
| | | import java.math.BigDecimal;
|
| | | import java.util.List;
|
| | | import java.util.Random;
|
| | |
|
| | | import org.junit.Test;
|
| | |
|
| | | import com.yeshi.fanli.entity.taobao.TLJFreeBuyGoods;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.taobao.TLJFreeBuyGoodsService;
|
| | | import com.yeshi.fanli.util.BeanUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | |
|
| | | //@Ignore
|
| | | public class Test_TLJFreeBuyGoodsService {
|
| | |
|
| | | // @Test
|
| | | public void taoLiJinRecord() {
|
| | | |
| | | TLJFreeBuyGoodsService service = BeanUtil.getBean(TLJFreeBuyGoodsService.class);
|
| | | |
| | | String day = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd");
|
| | | LogHelper.test("免单商品开始选品" + day);
|
| | |
|
| | | // 是否已预选
|
| | | List<TLJFreeBuyGoods> listSelect = service.listByDay(day);
|
| | | if (listSelect != null && listSelect.size() > 0)
|
| | | return;
|
| | |
|
| | | int count = 0;
|
| | | int maxCount = 10;
|
| | | for (int page = 1; page <= 10; page++) {
|
| | | List<TaoBaoGoodsBrief> list = service.listPreGoods("", page);
|
| | | if (list == null || list.size() == 0)
|
| | | break;
|
| | |
|
| | | while (list.size() > 0) {
|
| | | if (count >= maxCount)
|
| | | break;
|
| | |
|
| | | Random random = new Random();
|
| | | int n = random.nextInt(list.size());
|
| | | TaoBaoGoodsBrief goods = list.get(n);
|
| | | if (goods.getCouponAmount() != null && goods.getCouponAmount().compareTo(new BigDecimal(0)) > 0) {
|
| | | BigDecimal couplePrice = TaoBaoUtil.getAfterUseCouplePrice(goods);
|
| | | if (couplePrice.compareTo(new BigDecimal(1.0)) >= 0
|
| | | && couplePrice.compareTo(new BigDecimal(1.5)) <= 0) {
|
| | | service.addGoods(new TLJFreeBuyGoods(day, goods));
|
| | | count++;
|
| | | }
|
| | | }
|
| | | list.remove(n);
|
| | | }
|
| | |
|
| | | if (count >= maxCount)
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | }
|