admin
2020-03-01 c5f54810f60e036317562b1b42cfeafd18e984c5
Merge remote-tracking branch 'origin/div' into div

Conflicts:
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java
8个文件已修改
159 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsEvaluateAdminController.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/dynamic/CommentInfo.java 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/activity/ActivityUserMapper.xml 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java 80 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/dynamic/GoodsEvaluateService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/test/java/org/fanli/TaoKeTest.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/test/java/org/fanli/Test_Thread.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsEvaluateAdminController.java
@@ -135,9 +135,9 @@
     * @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()));
@@ -239,7 +239,7 @@
                        && goodsEvaluate.getComments().size() > 0) {
                    for (CommentInfo info : goodsEvaluate.getComments()) {
                        if (info != null)
                            if (CommentInfoEnum.currencyCoupon == info.getType()) {
                            if (CommentInfoEnum.currencyCoupon == info.getTypeEnum()) {
                                commentInfo = info;
                            }
                    }
@@ -270,7 +270,7 @@
                        && goodsEvaluate.getComments().size() > 0) {
                    for (CommentInfo info : goodsEvaluate.getComments()) {
                        if (info != null)
                            if (CommentInfoEnum.goodsCoupon == info.getType()) {
                            if (CommentInfoEnum.goodsCoupon == info.getTypeEnum()) {
                                commentInfo = info;
                            }
                    }
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java
@@ -33,7 +33,6 @@
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;
@@ -43,6 +42,7 @@
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;
@@ -589,6 +589,8 @@
     */
    @RequestMapping(value = "getDynamicList", method = RequestMethod.POST)
    public void getDynamicListNew(AcceptData acceptData, Integer page, Long cid, String subId, PrintWriter out) {
        try {
        int type = 1;
        if (cid == TYPE_FAQUAN) {
            type = 1;
@@ -601,17 +603,9 @@
        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());
                }
            }
        }).registerTypeAdapter(ImgEnum.class, new JsonSerializer<ImgEnum>() {
            gsonBuilder.registerTypeAdapter(ImgEnum.class, new JsonSerializer<ImgEnum>() {
            @Override
            public JsonElement serialize(ImgEnum value, Type theType, JsonSerializationContext context) {
                if (value == null) {
@@ -680,6 +674,11 @@
        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);
        }
    }
    /**
fanli/src/main/java/com/yeshi/fanli/entity/dynamic/CommentInfo.java
@@ -37,7 +37,11 @@
    private String id;
    // 类型
    @Expose
    private CommentInfoEnum type;
    private CommentInfoEnum typeEnum;
    // 类型
    @Expose
    private String type;
    // 内容
    @Expose
    private String content;
@@ -56,19 +60,24 @@
    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 getType() {
    public CommentInfoEnum getTypeEnum() {
        return typeEnum;
    }
    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;
    }
fanli/src/main/java/com/yeshi/fanli/mapping/activity/ActivityUserMapper.xml
@@ -34,6 +34,8 @@
        SELECT
        <include refid="Base_Column_List" />
        FROM yeshi_ec_activity_user where au_nick_name=#{0}
        ORDER BY au_id DESC
        LIMIT 1
    </select>
    
    
fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java
@@ -3,6 +3,7 @@
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;
@@ -400,7 +401,7 @@
        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;
@@ -446,7 +447,7 @@
            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);
        }
@@ -681,7 +682,7 @@
    }
    @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, "请保存第一部分信息");
        }
@@ -695,9 +696,9 @@
        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;
                }
            }
@@ -712,7 +713,8 @@
                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);
        }
@@ -739,9 +741,9 @@
        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;
                }
            }
@@ -758,7 +760,15 @@
            } 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<>();
@@ -1244,15 +1254,61 @@
    @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;
    }
@@ -1429,7 +1485,7 @@
                    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);
fanli/src/main/java/com/yeshi/fanli/service/inter/dynamic/GoodsEvaluateService.java
@@ -124,12 +124,12 @@
     * @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;
fanli/src/test/java/org/fanli/TaoKeTest.java
@@ -400,5 +400,14 @@
        }
    }
    @Test
    public void test13(){
        try {
            TaoKeApiUtil.getSimpleGoodsInfo(573867930843L);
        } catch (TaobaoGoodsDownException e) {
            e.printStackTrace();
        }
    }
}
fanli/src/test/java/org/fanli/Test_Thread.java
@@ -1,19 +1,11 @@
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();
        
    }
}