| | |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.bus.activity.RecommendActivity; |
| | | |
| | | public interface RecommendActivityMapper { |
| | | |
| | | int deleteByPrimaryKey(Long id); |
| | | public interface RecommendActivityMapper extends BaseMapper<RecommendActivity> { |
| | | |
| | | int batchDeleteByPrimaryKey(long[] ids); |
| | | |
| | | int insert(RecommendActivity record); |
| | | |
| | | int insertSelective(RecommendActivity record); |
| | | |
| | | RecommendActivity selectByPrimaryKey(Long id); |
| | | |
| | | int updateByPrimaryKeySelective(RecommendActivity record); |
| | | |
| | | int updateByPrimaryKey(RecommendActivity record); |
| | | |
| | | List<RecommendActivity> getRecommendActivityList(@Param("start") long start, @Param("count") int count); |
| | | |
| | |
| | | @Param("count") int count); |
| | | |
| | | int addShareCount(@Param("id") Long id, @Param("count") int count); |
| | | |
| | | /** |
| | | * 查询待发布的动态 |
| | | * @return |
| | | */ |
| | | List<RecommendActivity> getNeedPublish(); |
| | | |
| | | } |
| | |
| | | @Column(name = "ar_top")
|
| | | private Boolean top;// 是否置顶
|
| | |
|
| | | @Column(name = "ar_state")
|
| | | private Integer state;// 发布状态:1已发布 0未发布
|
| | | |
| | | |
| | | |
| | | @Expose
|
| | | @SerializedName("shareCount")
|
| | | private String shareCountShow;
|
| | |
| | | public void setEndTime_str(String endTime_str) {
|
| | | this.endTime_str = endTime_str;
|
| | | }
|
| | |
|
| | | public Integer getState() {
|
| | | return state;
|
| | | }
|
| | |
|
| | | public void setState(Integer state) {
|
| | | this.state = state;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | <result column="ar_top" property="top" jdbcType="BOOLEAN"/> |
| | | <result column="ar_start_time" property="startTime" jdbcType="TIMESTAMP"/> |
| | | <result column="ar_end_time" property="endTime" jdbcType="TIMESTAMP"/> |
| | | |
| | | <result column="ar_state" property="state" jdbcType="INTEGER"/> |
| | | |
| | | <association property="activityUser" column="ar_activity_uid" |
| | | resultMap="com.yeshi.fanli.dao.mybatis.activity.ActivityUserMapper.BaseResultMap" /> |
| | | |
| | |
| | | |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List">ar_id,ar_title,ar_type,ar_order_by,ar_activity_uid,ar_share_count,ar_total_getmoney,ar_video_post_picture,ar_video_url,ar_create_time,ar_top,ar_start_time,ar_end_time</sql> |
| | | <sql id="Base_Column_List">ar_id,ar_title,ar_type,ar_order_by,ar_activity_uid,ar_share_count,ar_total_getmoney,ar_video_post_picture,ar_video_url,ar_create_time,ar_top,ar_start_time,ar_end_time,ar_state</sql> |
| | | |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long"> |
| | | select *,ar_activity_uid AS au_id from yeshi_ec_activity_recommend |
| | |
| | | </delete> |
| | | |
| | | |
| | | <select id="getNeedPublish" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_activity_recommend |
| | | LEFT JOIN yeshi_ec_activity_user ON ar_activity_uid= au_id |
| | | WHERE ar_state = 0 AND IF(ar_start_time IS NULL,TRUE, ar_start_time<![CDATA[<=]]> NOW()) |
| | | AND IF(ar_end_time IS NULL,TRUE, ar_end_time <![CDATA[>=]]> NOW()) |
| | | </select> |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_activity_recommend where ar_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivity" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_activity_recommend (ar_id,ar_title,ar_type,ar_order_by,ar_activity_uid,ar_share_count,ar_total_getmoney,ar_video_post_picture,ar_video_url,ar_create_time,ar_top,ar_start_time,ar_end_time) values (#{id,jdbcType=BIGINT},#{title,jdbcType=VARCHAR},#{type,jdbcType=INTEGER},#{orderBy,jdbcType=INTEGER},#{activityUser.id,jdbcType=BIGINT},#{shareCount,jdbcType=INTEGER},#{totalGetMoney,jdbcType=VARCHAR},#{videoPostPictire,jdbcType=VARCHAR},#{videoUrl,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{top,jdbcType=BOOLEAN},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP})</insert> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivity" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_activity_recommend (ar_id,ar_title,ar_type,ar_order_by,ar_activity_uid,ar_share_count,ar_total_getmoney,ar_video_post_picture,ar_video_url,ar_create_time,ar_top,ar_start_time,ar_end_time,ar_state) values (#{id,jdbcType=BIGINT},#{title,jdbcType=VARCHAR},#{type,jdbcType=INTEGER},#{orderBy,jdbcType=INTEGER},#{activityUser.id,jdbcType=BIGINT},#{shareCount,jdbcType=INTEGER},#{totalGetMoney,jdbcType=VARCHAR},#{videoPostPictire,jdbcType=VARCHAR},#{videoUrl,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{top,jdbcType=BOOLEAN},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{state,jdbcType=INTEGER})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivity" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_activity_recommend |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">ar_id,</if> |
| | |
| | | <if test="top != null">ar_top,</if> |
| | | <if test="startTime != null">ar_start_time,</if> |
| | | <if test="endTime != null">ar_end_time,</if> |
| | | <if test="state != null">ar_state,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | |
| | | <if test="top != null">#{top,jdbcType=BOOLEAN},</if> |
| | | <if test="startTime != null">#{startTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivity">update yeshi_ec_activity_recommend set ar_title = #{title,jdbcType=VARCHAR},ar_type = #{type,jdbcType=INTEGER},ar_order_by = #{orderBy,jdbcType=INTEGER},ar_activity_uid = #{activityUser.id,jdbcType=BIGINT},ar_share_count = #{shareCount,jdbcType=INTEGER},ar_total_getmoney = #{totalGetMoney,jdbcType=VARCHAR},ar_video_post_picture = #{videoPostPictire,jdbcType=VARCHAR},ar_video_url = #{videoUrl,jdbcType=VARCHAR},ar_create_time = #{createTime,jdbcType=TIMESTAMP},ar_top = #{top,jdbcType=BOOLEAN},ar_start_time = #{startTime,jdbcType=TIMESTAMP},ar_end_time = #{endTime,jdbcType=TIMESTAMP} where ar_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivity">update yeshi_ec_activity_recommend set ar_title = #{title,jdbcType=VARCHAR},ar_type = #{type,jdbcType=INTEGER},ar_order_by = #{orderBy,jdbcType=INTEGER},ar_activity_uid = #{activityUser.id,jdbcType=BIGINT},ar_share_count = #{shareCount,jdbcType=INTEGER},ar_total_getmoney = #{totalGetMoney,jdbcType=VARCHAR},ar_video_post_picture = #{videoPostPictire,jdbcType=VARCHAR},ar_video_url = #{videoUrl,jdbcType=VARCHAR},ar_create_time = #{createTime,jdbcType=TIMESTAMP},ar_top = #{top,jdbcType=BOOLEAN},ar_start_time = #{startTime,jdbcType=TIMESTAMP},ar_end_time = #{endTime,jdbcType=TIMESTAMP},ar_state = #{state,jdbcType=INTEGER} where ar_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivity">update yeshi_ec_activity_recommend |
| | | <set> |
| | | <if test="title != null">ar_title=#{title,jdbcType=VARCHAR},</if> |
| | |
| | | <if test="createTime != null">ar_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="top != null">ar_top=#{top,jdbcType=BOOLEAN},</if> |
| | | <if test="startTime != null">ar_start_time=#{startTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="endTime != null">ar_end_time=#{endTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="state != null">ar_state=#{state,jdbcType=INTEGER},</if> |
| | | </set> where ar_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | |
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsUpdateException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | | import com.yeshi.fanli.service.inter.activity.ActivityService;
|
| | | import com.yeshi.fanli.service.inter.activity.ActivityUserService;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.dynamic.DynamicInfoService;
|
| | | import com.yeshi.fanli.service.inter.goods.CommonGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.ShareGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | |
| | |
|
| | | @Resource
|
| | | private CommonGoodsService commonGoodsService;
|
| | | |
| | | @Resource
|
| | | private DynamicInfoService dynamicInfoService;
|
| | | |
| | | @Resource
|
| | | private ActivityUserService activityUserService;
|
| | | |
| | |
|
| | | @Override
|
| | | public List<RecommendActivity> getRecommendActivityList(int page, int pageSize) {
|
| | |
| | | for (long auctionId : goodsList) {
|
| | | TaoBaoGoodsBrief tb = null;
|
| | | try {
|
| | | tb = TaoKeApiUtil.searchGoodsDetail(auctionId);
|
| | | tb = redisManager.getTaoBaoGoodsBrief(auctionId);
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | recommendActivityMapper.batchDeleteByPrimaryKey(ids);
|
| | | recommendActivityImgMapper.batchDeleteByActivityid(ids);
|
| | | recommendActivityTaoBaoGoodsMapper.batchDeleteByActivityid(ids);
|
| | | |
| | | try {
|
| | | for (Long id: ids) {
|
| | | dynamicInfoService.deleteActivity(id);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | |
| | | activity.setType(RecommendActivity.TYPE_SHARE_GOODS);
|
| | | recommendActivityMapper.updateByPrimaryKeySelective(activity);
|
| | |
|
| | | List<RecommendActivityTaoBaoGoods> listgoods = new ArrayList<RecommendActivityTaoBaoGoods>();
|
| | | BigDecimal taotaoMoney = new BigDecimal(0);
|
| | | for (long auctionId : goodsList) {
|
| | | TaoBaoGoodsBrief tb = null;
|
| | |
|
| | | try {
|
| | | tb = TaoKeApiUtil.searchGoodsDetail(auctionId);
|
| | | tb = redisManager.getTaoBaoGoodsBrief(auctionId);
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | recommendActivityTaoBaoGoodsMapper.insertSelective(goods);
|
| | | BigDecimal money = taoBaoGoodsBriefService.getShareGoodsUserHongBao(tb);
|
| | | taotaoMoney = taotaoMoney.add(money);
|
| | | |
| | | listgoods.add(goods);
|
| | | }
|
| | |
|
| | | RecommendActivity updateActivity = new RecommendActivity();
|
| | | updateActivity.setId(activity.getId());
|
| | | updateActivity.setTotalGetMoney("预估分享奖金:¥" + taotaoMoney.toString());
|
| | | recommendActivityMapper.updateByPrimaryKeySelective(updateActivity);
|
| | |
|
| | | |
| | | RecommendActivity exist = recommendActivityMapper.selectByPrimaryKey(activity.getId());
|
| | | if (exist.getState() != null && exist.getState() == 1) {
|
| | | try {
|
| | | ActivityUser activityUser = activityUserService.selectByPrimaryKey(activityUid);
|
| | | exist.setActivityUser(activityUser);
|
| | | exist.setGoodsList(listgoods);
|
| | | dynamicInfoService.saveActivityRecommend(exist);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | return activity;
|
| | | }
|
| | |
|
| | |
| | | recommendActivityInviteInfo.setSize(erCodeSize);
|
| | | recommendActivityInviteInfoMapper.insertSelective(recommendActivityInviteInfo);
|
| | |
|
| | | |
| | | RecommendActivity exist = recommendActivityMapper.selectByPrimaryKey(activity.getId());
|
| | | if (exist.getState() != null && exist.getState() == 1) {
|
| | | try {
|
| | | ActivityUser activityUser = activityUserService.selectByPrimaryKey(activityUid);
|
| | | dynamicInfoService.insertInviteMaterial(exist.getTitle(), url, activity.getId(), activityUser);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | return activity;
|
| | | }
|
| | |
|
| | |
| | | public List<RecommendActivity> getRecommendActivityListCache(int page, int pageSize) {
|
| | | List<RecommendActivity> activityList = getRecommendActivityList(page, pageSize);
|
| | | if (activityList != null) {
|
| | | for (RecommendActivity activity : activityList) {
|
| | | for (int i = 0; i < activityList.size(); i++) {
|
| | | |
| | | RecommendActivity activity = activityList.get(i);
|
| | | |
| | | // 筛选出不足9个的商品
|
| | | if (RecommendActivity.TYPE_SHARE_GOODS == activity.getType()
|
| | | && (activity.getGoodsList() == null || activity.getGoodsList().size() < 9)) {
|
| | | activityList.remove(activity);
|
| | | i--;
|
| | | continue;
|
| | | }
|
| | | |
| | |
|
| | | if (activity != null && activity.getGoodsList() != null) {
|
| | | for (RecommendActivityTaoBaoGoods goods : activity.getGoodsList()) {
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<String> getImgByActivityId(Long activityId){
|
| | | return recommendActivityImgMapper.getImgByActivityId(activityId);
|
| | | }
|
| | | |
| | | @Override
|
| | | public List<RecommendActivity> getNeedPublish() {
|
| | | return recommendActivityMapper.getNeedPublish();
|
| | | }
|
| | | }
|
| | |
| | | * @param goods
|
| | | */
|
| | | public void updateRecommendActivityGoods(TaoBaoGoodsBrief goods);
|
| | | |
| | | /**
|
| | | * 查询需发布的动态
|
| | | * @return
|
| | | */
|
| | | public List<RecommendActivity> getNeedPublish();
|
| | |
|
| | | /**
|
| | | * 动态图片
|
| | | * @param activityId
|
| | | * @return
|
| | | */
|
| | | public List<String> getImgByActivityId(Long activityId);
|
| | | }
|
| | |
| | | package com.yeshi.fanli.util.dataoke;
|
| | |
|
| | | import java.io.IOException;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import org.jsoup.Jsoup;
|
| | | import org.jsoup.nodes.Document;
|
| | | import org.jsoup.select.Elements;
|
| | | import org.yeshi.utils.HttpUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.yeshi.fanli.dto.dataoke.DaTaoKeApiResult;
|
| | | import com.yeshi.fanli.dto.taobao.TaoBaoShopDTO;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
| | | resultJson.optJSONObject("data").optString("update_time"), list);
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 获取大淘客品牌优选 品牌id
|
| | | * @return
|
| | | */
|
| | | public static List<String> getBrandIdList() {
|
| | | List<String> listId = null;
|
| | | try {
|
| | | Document doc = Jsoup.connect("http://www.dataoke.com/brandFeature").get();
|
| | | Elements els = doc.getElementsByTag("script");
|
| | | for (int i = 0; i < els.size(); i++) {
|
| | | if (els.get(i).html().contains("var brandData")) {
|
| | |
|
| | | JSONObject data = JSONObject
|
| | | .fromObject(els.get(i).html().replace("var brandData =", "").trim().split("};")[0] + "}");
|
| | | listId = convertList(data);
|
| | | break;
|
| | | }
|
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return listId;
|
| | | }
|
| | |
|
| | | |
| | | public static List<String> convertList(JSONObject data) {
|
| | | List<String> listId = new ArrayList<String>();
|
| | |
|
| | | // 萌趣新生力 夏日好食光栏目
|
| | | JSONArray arrayActs = data.optJSONObject("acts").optJSONArray("list");
|
| | | for (int i = 0; i < arrayActs.size(); i++) {
|
| | | JSONObject item = arrayActs.optJSONObject(i);
|
| | | listId.add(item.optString("brand_id"));
|
| | | }
|
| | |
|
| | | // 热推爆款
|
| | | JSONArray arrayPushs = data.optJSONObject("pushs").optJSONArray("list");
|
| | | for (int i = 0; i < arrayPushs.size(); i++) {
|
| | | JSONObject item = arrayPushs.optJSONObject(i);
|
| | | listId.add(item.optString("brand_id"));
|
| | | }
|
| | |
|
| | | // 热销品牌榜
|
| | | JSONArray arrayRanks = data.optJSONObject("ranks").optJSONArray("list");
|
| | | for (int i = 0; i < arrayRanks.size(); i++) {
|
| | | JSONObject item = arrayRanks.optJSONObject(i);
|
| | | // long id = item.optLong("id");
|
| | | // String title =item.optString("title");
|
| | | JSONArray goods = item.optJSONArray("goods");
|
| | | for (int j = 0; j < goods.size(); j++) {
|
| | | JSONObject good = goods.optJSONObject(j);
|
| | | listId.add(good.optString("brand_id"));
|
| | | }
|
| | | }
|
| | | return listId;
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 获取店铺下前4个商品、店铺介绍
|
| | | * @param brandId
|
| | | * @return
|
| | | */
|
| | | public static TaoBaoShopDTO getDynamicShopInfo(String brandId) {
|
| | | if (brandId == null) {
|
| | | return null;
|
| | | }
|
| | | TaoBaoShopDTO taoBaoShopDTO = null;
|
| | |
|
| | | Document doc;
|
| | | try {
|
| | | doc = Jsoup.connect("http://www.dataoke.com/brandSingle?id=" + brandId).get();
|
| | | Elements els = doc.getElementsByTag("script");
|
| | | for (int i = 0; i < els.size(); i++) {
|
| | | if (els.get(i).html().contains("var brandData")) {
|
| | |
|
| | | JSONObject data = JSONObject
|
| | | .fromObject(els.get(i).html().replace("var brandData =", "").trim().split("};")[0] + "}");
|
| | | taoBaoShopDTO = convertTaoBaoShopDTO(data);
|
| | | break;
|
| | | }
|
| | | }
|
| | | } catch (IOException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return taoBaoShopDTO;
|
| | |
|
| | | }
|
| | |
|
| | | public static TaoBaoShopDTO convertTaoBaoShopDTO(JSONObject data) {
|
| | | TaoBaoShopDTO taoBaoShopDTO = new TaoBaoShopDTO();
|
| | | JSONObject item = data.optJSONObject("act");
|
| | | taoBaoShopDTO.setSellerId(item.optLong("seller_id"));
|
| | | taoBaoShopDTO.setBrandId(item.optString("brand_id"));
|
| | | taoBaoShopDTO.setBrandDes(item.optString("brand_des"));
|
| | | int userType = 0;
|
| | |
|
| | | List<TaoBaoGoodsBrief> listGoods = new ArrayList<TaoBaoGoodsBrief>();
|
| | | JSONArray arrayGoods = data.optJSONArray("goods");
|
| | | for (int i = 0; i < arrayGoods.size(); i++) {
|
| | | if (i > 3) {
|
| | | break;
|
| | | }
|
| | | JSONObject itemGoods = arrayGoods.optJSONObject(i);
|
| | | TaoBaoGoodsBrief taoBaoGoods = new TaoBaoGoodsBrief();
|
| | | taoBaoGoods.setAuctionId(itemGoods.optLong("goodsid"));
|
| | | taoBaoGoods.setBiz30day(itemGoods.optInt("xiaoliang"));
|
| | | taoBaoGoods.setCouponAmount(new BigDecimal(itemGoods.optString("quan_jine")));
|
| | | taoBaoGoods.setCouponInfo(String.format("满%s元减%s元", itemGoods.optString("quan_tiaojian"),
|
| | | MoneyBigDecimalUtil.getWithNoZera(new BigDecimal(itemGoods.optString("quan_jine")))));
|
| | | taoBaoGoods.setCouponLeftCount(itemGoods.optInt("quan_num"));
|
| | | taoBaoGoods.setCouponStartFee(new BigDecimal(itemGoods.optString("quan_tiaojian")));
|
| | | taoBaoGoods.setCouponTotalCount(itemGoods.optInt("quan_num"));
|
| | | taoBaoGoods.setPictUrl(itemGoods.optString("pic"));
|
| | | taoBaoGoods.setPictUrlWhite(itemGoods.optString("pic"));
|
| | | taoBaoGoods.setSellerId(itemGoods.optLong("seller_id"));
|
| | | taoBaoGoods.setShopTitle("");
|
| | | taoBaoGoods.setTitle(itemGoods.optString("title"));
|
| | | taoBaoGoods.setUserType(itemGoods.optInt("istmall"));
|
| | | taoBaoGoods.setZkPrice(new BigDecimal(itemGoods.optString("yuanjia")));
|
| | | taoBaoGoods.setTkRate(new BigDecimal(itemGoods.optString("yongjin")));
|
| | | taoBaoGoods.setTkCommFee(new BigDecimal("0"));
|
| | | taoBaoGoods.setState(0);
|
| | | |
| | | listGoods.add(taoBaoGoods);
|
| | | |
| | | userType = itemGoods.optInt("istmall");
|
| | | }
|
| | | taoBaoShopDTO.setListGoods(listGoods);
|
| | | taoBaoShopDTO.setUserType(userType);
|
| | | return taoBaoShopDTO;
|
| | | }
|
| | | |
| | | class DaTaoKeResult {
|
| | | Date updateTime;
|
| | | List<DaTaoKeDetail> dataList;
|
| | |
| | | return desc;
|
| | | }
|
| | |
|
| | | |
| | | public static TaoBaoGoodsBrief filterTaoBaoGoods(TaoBaoGoodsBrief goods, DaTaoKeDetail detail) {
|
| | | if (detail != null) {
|
| | | // 重新设置标题与券价格
|
| | | goods.setTitle(detail.getdTitle());
|
| | | goods.setCouponAmount(detail.getQuanPrice());
|
| | | if (new BigDecimal(detail.getQuanCondition()).compareTo(new BigDecimal(0)) > 0)
|
| | | goods.setCouponInfo(String.format("满%s元减%s元", detail.getQuanCondition(),
|
| | | MoneyBigDecimalUtil.getWithNoZera(detail.getQuanPrice()).toString()));
|
| | | else
|
| | | goods.setCouponInfo(String.format("%s元无条件券", detail.getQuanPrice()));
|
| | | }
|
| | | return goods;
|
| | | }
|
| | | |
| | | }
|