Merge remote-tracking branch 'origin/div' into div
Conflicts:
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java
| | |
| | | * @param out |
| | | */ |
| | | @RequestMapping(value = "saveGoodsCoupon") |
| | | public void saveGoodsCoupon(String callback, String pid, String tags, String tagDesc, PrintWriter out) { |
| | | public void saveGoodsCoupon(String callback, String pid, String content, PrintWriter out) { |
| | | try { |
| | | goodsEvaluateService.saveGoodsCoupon(pid, tags, tagDesc); |
| | | goodsEvaluateService.saveGoodsCoupon(pid, content); |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功")); |
| | | } catch (GoodsEvaluateException e) { |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg())); |
| | |
| | | && goodsEvaluate.getComments().size() > 0) { |
| | | for (CommentInfo info : goodsEvaluate.getComments()) { |
| | | if (info != null) |
| | | if (CommentInfoEnum.currencyCoupon == info.getType()) { |
| | | if (CommentInfoEnum.currencyCoupon == info.getTypeEnum()) { |
| | | commentInfo = info; |
| | | } |
| | | } |
| | |
| | | && goodsEvaluate.getComments().size() > 0) { |
| | | for (CommentInfo info : goodsEvaluate.getComments()) { |
| | | if (info != null) |
| | | if (CommentInfoEnum.goodsCoupon == info.getType()) { |
| | | if (CommentInfoEnum.goodsCoupon == info.getTypeEnum()) { |
| | | commentInfo = info; |
| | | } |
| | | } |
| | |
| | | import com.yeshi.fanli.entity.bus.user.UserInfo; |
| | | import com.yeshi.fanli.entity.common.JumpDetailV2; |
| | | import com.yeshi.fanli.entity.dynamic.CommentInfo; |
| | | import com.yeshi.fanli.entity.dynamic.CommentInfo.CommentInfoEnum; |
| | | import com.yeshi.fanli.entity.dynamic.DynamicInfo; |
| | | import com.yeshi.fanli.entity.dynamic.GoodsEvaluate; |
| | | import com.yeshi.fanli.entity.dynamic.GoodsEvaluate.EvaluateEnum; |
| | |
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum; |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoLink; |
| | | import com.yeshi.fanli.exception.share.ShareGoodsException; |
| | | import com.yeshi.fanli.log.LogHelper; |
| | | import com.yeshi.fanli.service.inter.common.JumpDetailV2Service; |
| | | import com.yeshi.fanli.service.inter.config.ConfigService; |
| | | import com.yeshi.fanli.service.inter.dynamic.ArticleOfficialService; |
| | |
| | | */ |
| | | @RequestMapping(value = "getDynamicList", method = RequestMethod.POST) |
| | | public void getDynamicListNew(AcceptData acceptData, Integer page, Long cid, String subId, PrintWriter out) { |
| | | int type = 1; |
| | | if (cid == TYPE_FAQUAN) { |
| | | type = 1; |
| | | } else if (cid == TYPE_SUCAI) { |
| | | type = 2; |
| | | } |
| | | |
| | | List<GoodsEvaluate> list = goodsEvaluateService.queryMaterialsCache((page - 1) * Constant.PAGE_SIZE, |
| | | Constant.PAGE_SIZE, type); |
| | | if (list == null) { |
| | | list = new ArrayList<>(); |
| | | } |
| | | GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation(); |
| | | gsonBuilder.registerTypeAdapter(CommentInfoEnum.class, new JsonSerializer<CommentInfoEnum>() { |
| | | @Override |
| | | public JsonElement serialize(CommentInfoEnum value, Type theType, JsonSerializationContext context) { |
| | | if (value == null) { |
| | | return new JsonPrimitive(1); |
| | | } else { |
| | | return new JsonPrimitive(value.getDesc()); |
| | | } |
| | | try { |
| | | int type = 1; |
| | | if (cid == TYPE_FAQUAN){ |
| | | type = 1; |
| | | } else if (cid == TYPE_SUCAI) { |
| | | type = 2; |
| | | } |
| | | }).registerTypeAdapter(ImgEnum.class, new JsonSerializer<ImgEnum>() { |
| | | @Override |
| | | public JsonElement serialize(ImgEnum value, Type theType, JsonSerializationContext context) { |
| | | if (value == null) { |
| | | return new JsonPrimitive(""); |
| | | } else { |
| | | return new JsonPrimitive(value.getVlaue()); |
| | | } |
| | | |
| | | List<GoodsEvaluate> list = goodsEvaluateService.queryMaterialsCache((page - 1) * Constant.PAGE_SIZE, |
| | | Constant.PAGE_SIZE, type); |
| | | if (list == null) { |
| | | list = new ArrayList<>(); |
| | | } |
| | | }).registerTypeAdapter(Date.class, new JsonSerializer<Date>() { |
| | | @Override |
| | | public JsonElement serialize(Date value, Type theType, JsonSerializationContext context) { |
| | | String desc = ""; |
| | | if (value != null) { |
| | | // 判断是否是同一天 |
| | | |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(value); |
| | | int y1 = calendar.get(Calendar.YEAR);// 获取年份 |
| | | int d1 = calendar.get(Calendar.DAY_OF_YEAR);// 获取年中第几天 |
| | | |
| | | Date nowDate = new Date(); |
| | | Calendar calendar2 = Calendar.getInstance(); |
| | | calendar2.setTime(nowDate); |
| | | int y2 = calendar2.get(Calendar.YEAR);// 获取年份 |
| | | int d2 = calendar2.get(Calendar.DAY_OF_YEAR);// 获取年中第几天 |
| | | |
| | | long old = value.getTime(); |
| | | long now = nowDate.getTime(); |
| | | if (y1 == y2) { |
| | | if (d1 == d2) { |
| | | long cha = now - old; |
| | | if (cha < 1000 * 60 * 2L) { |
| | | desc = "刚刚"; |
| | | } else if (cha < 1000 * 60 * 60L) { |
| | | desc = (cha / (1000 * 60)) + "分钟前"; |
| | | } else { |
| | | desc = (cha / (1000 * 60 * 60)) + "小时前"; |
| | | } |
| | | } else if (d2 - d1 == 1) { |
| | | desc = "昨天"; |
| | | } else { |
| | | desc = (d2 - d1) + "天前"; |
| | | } |
| | | |
| | | GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation(); |
| | | gsonBuilder.registerTypeAdapter(ImgEnum.class, new JsonSerializer<ImgEnum>() { |
| | | @Override |
| | | public JsonElement serialize(ImgEnum value, Type theType, JsonSerializationContext context) { |
| | | if (value == null) { |
| | | return new JsonPrimitive(""); |
| | | } else { |
| | | int timeDistance = 0; |
| | | for (int i = y1; i < y2; i++) { |
| | | if (i % 4 == 0 && i % 100 != 0 || i % 400 == 0) { |
| | | timeDistance += 366; // 闰年 |
| | | return new JsonPrimitive(value.getVlaue()); |
| | | } |
| | | } |
| | | }).registerTypeAdapter(Date.class, new JsonSerializer<Date>() { |
| | | @Override |
| | | public JsonElement serialize(Date value, Type theType, JsonSerializationContext context) { |
| | | String desc = ""; |
| | | if (value != null) { |
| | | // 判断是否是同一天 |
| | | |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(value); |
| | | int y1 = calendar.get(Calendar.YEAR);// 获取年份 |
| | | int d1 = calendar.get(Calendar.DAY_OF_YEAR);// 获取年中第几天 |
| | | |
| | | Date nowDate = new Date(); |
| | | Calendar calendar2 = Calendar.getInstance(); |
| | | calendar2.setTime(nowDate); |
| | | int y2 = calendar2.get(Calendar.YEAR);// 获取年份 |
| | | int d2 = calendar2.get(Calendar.DAY_OF_YEAR);// 获取年中第几天 |
| | | |
| | | long old = value.getTime(); |
| | | long now = nowDate.getTime(); |
| | | if (y1 == y2) { |
| | | if (d1 == d2) { |
| | | long cha = now - old; |
| | | if (cha < 1000 * 60 * 2L) { |
| | | desc = "刚刚"; |
| | | } else if (cha < 1000 * 60 * 60L) { |
| | | desc = (cha / (1000 * 60)) + "分钟前"; |
| | | } else { |
| | | desc = (cha / (1000 * 60 * 60)) + "小时前"; |
| | | } |
| | | } else if (d2 - d1 == 1) { |
| | | desc = "昨天"; |
| | | } else { |
| | | timeDistance += 365; // 不是闰年 |
| | | desc = (d2 - d1) + "天前"; |
| | | } |
| | | } else { |
| | | int timeDistance = 0; |
| | | for (int i = y1; i < y2; i++) { |
| | | if (i % 4 == 0 && i % 100 != 0 || i % 400 == 0) { |
| | | timeDistance += 366; // 闰年 |
| | | } else { |
| | | timeDistance += 365; // 不是闰年 |
| | | } |
| | | } |
| | | desc = timeDistance + (d2 - d1) + "天前"; |
| | | } |
| | | desc = timeDistance + (d2 - d1) + "天前"; |
| | | |
| | | return new JsonPrimitive(desc); |
| | | } |
| | | |
| | | return new JsonPrimitive(desc); |
| | | return new JsonPrimitive(""); |
| | | } |
| | | }); |
| | | Gson gson = gsonBuilder.create(); |
| | | long count = goodsEvaluateService.countValidMaterials(type); |
| | | |
| | | return new JsonPrimitive(""); |
| | | } |
| | | }); |
| | | Gson gson = gsonBuilder.create(); |
| | | long count = goodsEvaluateService.countValidMaterials(type); |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("count", count); |
| | | data.put("list", gson.toJson(list)); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("count", count); |
| | | data.put("list", gson.toJson(list)); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } catch (Exception e) { |
| | | out.print(JsonUtil.loadFalseResult(1, "查询信息失败")); |
| | | LogHelper.errorDetailInfo(e); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | private String id; |
| | | // 类型 |
| | | @Expose |
| | | private CommentInfoEnum type; |
| | | private CommentInfoEnum typeEnum; |
| | | // 类型 |
| | | @Expose |
| | | private String type; |
| | | |
| | | // 内容 |
| | | @Expose |
| | | private String content; |
| | |
| | | private String coupon; |
| | | // 券来源 |
| | | private String couponSource; |
| | | // 结束时间 |
| | | // @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| | | // private Date endTime; |
| | | |
| | | private String tags; |
| | | private String tagsColour; |
| | | private String endTime; |
| | | |
| | | public CommentInfoEnum getTypeEnum() { |
| | | return typeEnum; |
| | | } |
| | | |
| | | public CommentInfoEnum getType() { |
| | | public void setTypeEnum(CommentInfoEnum typeEnum) { |
| | | this.typeEnum = typeEnum; |
| | | } |
| | | |
| | | public String getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(CommentInfoEnum type) { |
| | | public void setType(String type) { |
| | | this.type = type; |
| | | } |
| | | |
| | |
| | | <?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.activity.ActivityUserMapper">
|
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.activity.ActivityUser">
|
| | | <id column="au_id" property="id" jdbcType="BIGINT"/>
|
| | | <result column="au_nick_name" property="nickName" jdbcType="VARCHAR"/>
|
| | | <result column="au_portrait" property="portrait" jdbcType="VARCHAR"/>
|
| | | <result column="au_create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
| | | <result column="au_tag" property="tag" jdbcType="VARCHAR"/>
|
| | | </resultMap>
|
| | | <sql id="Base_Column_List">au_id,au_nick_name,au_portrait,au_create_time,au_tag</sql>
|
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
| | | parameterType="java.lang.Long">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_activity_user where au_id = #{0}
|
| | | </select>
|
| | |
|
| | | <select id="selectList" resultMap="BaseResultMap" parameterType="java.lang.Long">
|
| | | select
|
| | | <include refid="Base_Column_List" />
|
| | | from yeshi_ec_activity_user |
| | | </select>
|
| | |
|
| | |
|
| | | <select id="listRand" resultMap="BaseResultMap">
|
| | | SELECT
|
| | | <include refid="Base_Column_List" />
|
| | | FROM yeshi_ec_activity_user ORDER BY RAND() LIMIT #{count}
|
| | | </select>
|
| | | |
| | | <select id="selectByName" resultMap="BaseResultMap" parameterType="java.lang.String">
|
| | | SELECT
|
| | | <include refid="Base_Column_List" />
|
| | | FROM yeshi_ec_activity_user where au_nick_name=#{0}
|
| | | </select>
|
| | | |
| | | |
| | |
|
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.activity.ActivityUser" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_activity_user (au_id,au_nick_name,au_portrait,au_create_time,au_tag) values (#{id,jdbcType=BIGINT},#{nickName,jdbcType=VARCHAR},#{portrait,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{tag,jdbcType=VARCHAR})</insert>
|
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.activity.ActivityUser" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_activity_user
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">au_id,</if>
|
| | | <if test="nickName != null">au_nick_name,</if>
|
| | | <if test="portrait != null">au_portrait,</if>
|
| | | <if test="createTime != null">au_create_time,</if>
|
| | | <if test="tag != null">au_tag,</if>
|
| | | </trim>values
|
| | | <trim prefix="(" suffix=")" suffixOverrides=",">
|
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if>
|
| | | <if test="nickName != null">#{nickName,jdbcType=VARCHAR},</if>
|
| | | <if test="portrait != null">#{portrait,jdbcType=VARCHAR},</if>
|
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="tag != null">#{tag,jdbcType=VARCHAR},</if>
|
| | | </trim>
|
| | | </insert>
|
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.activity.ActivityUser">update yeshi_ec_activity_user set au_nick_name = #{nickName,jdbcType=VARCHAR},au_portrait = #{portrait,jdbcType=VARCHAR},au_create_time = #{createTime,jdbcType=TIMESTAMP},au_tag = #{tag,jdbcType=VARCHAR} where au_id = #{id,jdbcType=BIGINT}</update>
|
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.activity.ActivityUser">update yeshi_ec_activity_user
|
| | | <set>
|
| | | <if test="nickName != null">au_nick_name=#{nickName,jdbcType=VARCHAR},</if>
|
| | | <if test="portrait != null">au_portrait=#{portrait,jdbcType=VARCHAR},</if>
|
| | | <if test="createTime != null">au_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
|
| | | <if test="tag != null">au_tag=#{tag,jdbcType=VARCHAR},</if>
|
| | | </set> where au_id = #{id,jdbcType=BIGINT}
|
| | | </update>
|
| | | </mapper>
|
| | | <?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.activity.ActivityUserMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.activity.ActivityUser"> |
| | | <id column="au_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="au_nick_name" property="nickName" jdbcType="VARCHAR"/> |
| | | <result column="au_portrait" property="portrait" jdbcType="VARCHAR"/> |
| | | <result column="au_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="au_tag" property="tag" jdbcType="VARCHAR"/> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">au_id,au_nick_name,au_portrait,au_create_time,au_tag</sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_activity_user where au_id = #{0} |
| | | </select> |
| | | |
| | | <select id="selectList" resultMap="BaseResultMap" parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_activity_user |
| | | </select> |
| | | |
| | | |
| | | <select id="listRand" resultMap="BaseResultMap"> |
| | | SELECT |
| | | <include refid="Base_Column_List" /> |
| | | FROM yeshi_ec_activity_user ORDER BY RAND() LIMIT #{count} |
| | | </select> |
| | | |
| | | <select id="selectByName" resultMap="BaseResultMap" parameterType="java.lang.String"> |
| | | SELECT |
| | | <include refid="Base_Column_List" /> |
| | | FROM yeshi_ec_activity_user where au_nick_name=#{0} |
| | | ORDER BY au_id DESC |
| | | LIMIT 1 |
| | | </select> |
| | | |
| | | |
| | | |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.activity.ActivityUser" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_activity_user (au_id,au_nick_name,au_portrait,au_create_time,au_tag) values (#{id,jdbcType=BIGINT},#{nickName,jdbcType=VARCHAR},#{portrait,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{tag,jdbcType=VARCHAR})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.activity.ActivityUser" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_activity_user |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">au_id,</if> |
| | | <if test="nickName != null">au_nick_name,</if> |
| | | <if test="portrait != null">au_portrait,</if> |
| | | <if test="createTime != null">au_create_time,</if> |
| | | <if test="tag != null">au_tag,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="nickName != null">#{nickName,jdbcType=VARCHAR},</if> |
| | | <if test="portrait != null">#{portrait,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="tag != null">#{tag,jdbcType=VARCHAR},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.activity.ActivityUser">update yeshi_ec_activity_user set au_nick_name = #{nickName,jdbcType=VARCHAR},au_portrait = #{portrait,jdbcType=VARCHAR},au_create_time = #{createTime,jdbcType=TIMESTAMP},au_tag = #{tag,jdbcType=VARCHAR} where au_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.activity.ActivityUser">update yeshi_ec_activity_user |
| | | <set> |
| | | <if test="nickName != null">au_nick_name=#{nickName,jdbcType=VARCHAR},</if> |
| | | <if test="portrait != null">au_portrait=#{portrait,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">au_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="tag != null">au_tag=#{tag,jdbcType=VARCHAR},</if> |
| | | </set> where au_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.InputStream; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | |
| | | List<CommentInfo> comments = resultObj.getComments(); |
| | | if (comments != null) { |
| | | for (CommentInfo commentInfo: comments) { |
| | | if (commentInfo.getType() == CommentInfoEnum.goodsCoupon) { |
| | | if (commentInfo.getTypeEnum() == CommentInfoEnum.goodsCoupon) { |
| | | if (oldGoodsVO != null && oldGoodsVO.getGoodsId().longValue() == goodsId.longValue() |
| | | && oldGoodsVO.getGoodsType() == goodsType) { |
| | | addComment = true; |
| | |
| | | CommentInfo commentInfo = new CommentInfo(); |
| | | commentInfo.setId(UUID.randomUUID().toString().replace("-", "")); |
| | | commentInfo.setContent(commentText); |
| | | commentInfo.setType(CommentInfoEnum.goodsCoupon); |
| | | commentInfo.setTypeEnum(CommentInfoEnum.goodsCoupon); |
| | | commentsNew.add(commentInfo); |
| | | resultObj.setComments(commentsNew); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void saveGoodsCoupon(String pid, String tags, String content) throws GoodsEvaluateException, Exception { |
| | | public void saveGoodsCoupon(String pid, String content) throws GoodsEvaluateException, Exception { |
| | | if (StringUtil.isNullOrEmpty(pid)) { |
| | | throw new GoodsEvaluateException(1, "请保存第一部分信息"); |
| | | } |
| | |
| | | List<CommentInfo> oldComments = resultObj.getComments(); |
| | | if (oldComments != null) { |
| | | for (CommentInfo info : oldComments) { |
| | | if (CommentInfoEnum.goodsCoupon == info.getType()) { |
| | | if (CommentInfoEnum.goodsCoupon == info.getTypeEnum()) { |
| | | goodsCoupon = info; |
| | | } else if (CommentInfoEnum.currencyCoupon == info.getType()) { |
| | | } else if (CommentInfoEnum.currencyCoupon == info.getTypeEnum()) { |
| | | currencyCoupon = info; |
| | | } |
| | | } |
| | |
| | | commentInfo.setId(UUID.randomUUID().toString().replace("-", "")); |
| | | } |
| | | commentInfo.setContent(content); |
| | | commentInfo.setType(CommentInfoEnum.goodsCoupon); |
| | | commentInfo.setType(CommentInfoEnum.goodsCoupon.getDesc()); |
| | | commentInfo.setTypeEnum(CommentInfoEnum.goodsCoupon); |
| | | comments.add(commentInfo); |
| | | } |
| | | |
| | |
| | | List<CommentInfo> oldComments = resultObj.getComments(); |
| | | if (oldComments != null) { |
| | | for (CommentInfo info : oldComments) { |
| | | if (CommentInfoEnum.goodsCoupon == info.getType()) { |
| | | if (CommentInfoEnum.goodsCoupon == info.getTypeEnum()) { |
| | | goodsCoupon = info; |
| | | } else if (CommentInfoEnum.currencyCoupon == info.getType()) { |
| | | } else if (CommentInfoEnum.currencyCoupon == info.getTypeEnum()) { |
| | | currencyCoupon = info; |
| | | } |
| | | } |
| | |
| | | } else { |
| | | commentInfo.setId(UUID.randomUUID().toString().replace("-", "")); |
| | | } |
| | | commentInfo.setType(CommentInfoEnum.currencyCoupon); |
| | | |
| | | // 券类型 |
| | | |
| | | String tags = commentInfo.getTags(); |
| | | if (StringUtil.isNullOrEmpty(tags)) { |
| | | commentInfo.setType(CommentInfoEnum.currencyCoupon.getDesc()); |
| | | } else { |
| | | commentInfo.setType(tags); |
| | | } |
| | | commentInfo.setTypeEnum(CommentInfoEnum.currencyCoupon); |
| | | |
| | | // 标签信息 |
| | | List<ClientTextStyleVO> tagList = new ArrayList<>(); |
| | | String couponSource = commentInfo.getCouponSource(); |
| | |
| | | |
| | | @Override |
| | | @Cacheable(value = "dynamicCache", key = "'queryMaterialsCache-'+#start+'-'+#type") |
| | | public List<GoodsEvaluate> queryMaterialsCache(int start, int count, int type) { |
| | | public List<GoodsEvaluate> queryMaterialsCache(int start, int count, int type) throws Exception { |
| | | List<GoodsEvaluate> list = goodsEvaluateDao.queryValid(start, count, type); |
| | | |
| | | List<GoodsEvaluate> listOBJ = list; |
| | | // 更新商品信息 |
| | | executor.execute(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | updateGoodInfo(list); |
| | | updateGoodInfo(listOBJ); |
| | | } |
| | | }); |
| | | |
| | | if (list == null) { |
| | | list = new ArrayList<>(); |
| | | } |
| | | |
| | | for (GoodsEvaluate goodsEvaluate: list) { |
| | | List<CommentInfo> comments = goodsEvaluate.getComments(); |
| | | if (comments != null) { |
| | | Date now = new Date(); |
| | | for (CommentInfo commentInfo: comments) { |
| | | String typeCoupon = commentInfo.getType(); |
| | | if (StringUtil.isNullOrEmpty(typeCoupon)) { |
| | | commentInfo.setType(commentInfo.getTypeEnum().getDesc()); |
| | | } |
| | | |
| | | String coupon = commentInfo.getCoupon(); |
| | | String endTime = commentInfo.getEndTime(); |
| | | if (!StringUtil.isNullOrEmpty(coupon) && !StringUtil.isNullOrEmpty(endTime)) { |
| | | |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); |
| | | Date endDay = sdf.parse(endTime); |
| | | if (endDay.getTime() <= now.getTime()) { |
| | | continue; |
| | | } |
| | | |
| | | int daysBetween = DateUtil.daysBetween(endDay, now); |
| | | if (daysBetween <= 0) { |
| | | continue; |
| | | } |
| | | |
| | | ClientTextStyleVO styleVO = new ClientTextStyleVO(); |
| | | styleVO.setColor("#E5005C"); |
| | | styleVO.setContent(daysBetween + "天后过期"); |
| | | styleVO.setContent(coupon); |
| | | |
| | | List<ClientTextStyleVO> tagList = commentInfo.getTagList(); |
| | | tagList.add(styleVO); |
| | | |
| | | commentInfo.setTagList(tagList); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return list; |
| | | } |
| | | |
| | |
| | | CommentInfo commentInfo = new CommentInfo(); |
| | | commentInfo.setId(UUID.randomUUID().toString().replace("-", "")); |
| | | commentInfo.setContent(commentText); |
| | | commentInfo.setType(CommentInfoEnum.goodsCoupon); |
| | | commentInfo.setTypeEnum(CommentInfoEnum.goodsCoupon); |
| | | |
| | | List<CommentInfo> commentsNew = new ArrayList<>(); |
| | | commentsNew.add(commentInfo); |
| | |
| | | * @param count |
| | | * @return |
| | | */ |
| | | public List<GoodsEvaluate> queryMaterialsCache(int start, int count,int type); |
| | | public List<GoodsEvaluate> queryMaterialsCache(int start, int count,int type) throws Exception; |
| | | |
| | | public long countValidMaterials(int type); |
| | | |
| | | |
| | | public void saveGoodsCoupon(String pid, String tags, String content) throws GoodsEvaluateException, Exception; |
| | | public void saveGoodsCoupon(String pid, String content) throws GoodsEvaluateException, Exception; |
| | | |
| | | |
| | | public void release(String id) throws GoodsEvaluateException; |
| | |
| | | }
|
| | |
|
| | | }
|
| | | |
| | | @Test
|
| | | public void test13(){
|
| | | try {
|
| | | TaoKeApiUtil.getSimpleGoodsInfo(573867930843L);
|
| | | } catch (TaobaoGoodsDownException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | package org.fanli;
|
| | |
|
| | | import java.io.BufferedReader;
|
| | | import java.io.File;
|
| | | import java.io.FileReader;
|
| | | import org.apache.http.client.HttpClient;
|
| | | import org.apache.http.impl.client.DefaultHttpClient;
|
| | |
|
| | | public class Test_Thread {
|
| | | public static void main(String[] args) {
|
| | | |
| | | new Thread(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | // TODO Auto-generated method stub
|
| | | |
| | | }
|
| | | });
|
| | | HttpClient client=new DefaultHttpClient();
|
| | |
|
| | | }
|
| | | }
|