admin
2020-07-03 651a15c78f668bef3859d9ed1bb7ad0b669d3600
fanli/src/main/java/com/yeshi/fanli/controller/admin/GoodsEvaluateAdminController.java
@@ -9,6 +9,7 @@
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import com.yeshi.fanli.entity.accept.AdminAcceptData;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartHttpServletRequest;
@@ -19,6 +20,7 @@
import com.google.gson.reflect.TypeToken;
import com.yeshi.fanli.dto.ConfigParamsDTO;
import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
import com.yeshi.fanli.entity.dynamic.CommentInfo;
import com.yeshi.fanli.entity.dynamic.CommentInfo.CommentInfoEnum;
import com.yeshi.fanli.entity.dynamic.GoodsEvaluate;
@@ -81,10 +83,28 @@
   
   
   /**
    * 修改状态
    * @param callback
    * @param id
    * @param out
    */
   @RequestMapping(value = "switchState")
   public void switchState(String callback, String id, PrintWriter out) {
      try {
         goodsEvaluateService.switchState(id);
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("操作成功"));
      } catch (GoodsEvaluateException e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
      } catch (Exception e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
         e.printStackTrace();
      }
   }
   /**
    * 保存信息
    * 
    * @param callback
    * @param special
    * @param out
    */
   @RequestMapping(value = "saveHead")
@@ -108,21 +128,27 @@
   /**
    * 保存信息
    *
    * @param acceptData
    * @param callback
    * @param special  0a39676f138c4dcba722e321d43c4284
    * @param pid
    * @param goodsId
    * @param goodsType
    * @param videoUrl
    * @param picNum
    * @param picUrls
    * @param request
    * @param out
    */
   @RequestMapping(value = "saveSingleGoods")
   public void saveSingleGoods(String callback, String pid, Long goodsId, Integer goodsType, String videoUrl,
         Integer picNum, String picUrls, HttpServletRequest request, PrintWriter out) {
   public void saveSingleGoods(AdminAcceptData acceptData, String callback, String pid, String goodsId, Integer goodsType, String videoUrl,
                        Integer picNum, String picUrls, HttpServletRequest request, PrintWriter out) {
      try {
         MultipartHttpServletRequest fileRequest = null;
         if (request instanceof MultipartHttpServletRequest) {
            fileRequest = (MultipartHttpServletRequest) request;
         }
         String commentText = goodsEvaluateService.saveSingleGoods(pid, goodsId, goodsType, videoUrl, picNum,
               picUrls, fileRequest);
               picUrls,acceptData.getSystem(), fileRequest);
         JSONObject object = new JSONObject();
         object.put("comment", commentText);
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(object));
@@ -139,7 +165,6 @@
    * 获取信息
    * 
    * @param callback
    * @param special  0a39676f138c4dcba722e321d43c4284
    * @param out
    */
   @RequestMapping(value = "getSingleGoodsinfo")
@@ -195,7 +220,7 @@
    * @param out
    */
   @RequestMapping(value = "saveGoodsComment")
   public void saveGoodsComment(String callback, String id, int kind, ListComment comments, PrintWriter out) {
   public void saveGoodsComment(AdminAcceptData acceptData, String callback, String id, int kind, ListComment comments, PrintWriter out) {
      try {
         if (StringUtil.isNullOrEmpty(id)) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请先保存推荐语信息"));
@@ -205,7 +230,7 @@
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("文本内容为空"));
            return;
         }
         goodsEvaluateService.saveGoodsComment(id, kind, comments.getComment());
         goodsEvaluateService.saveGoodsComment(id, kind, comments.getComment(),acceptData.getSystem());
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("成功"));
      } catch (GoodsEvaluateException e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
@@ -218,7 +243,6 @@
   /**
    * 
    * @param callback
    * @param comments
    * @param out
    */
   @RequestMapping(value = "getGoodsComment")
@@ -277,7 +301,6 @@
    * 获取信息
    * 
    * @param callback
    * @param special  0a39676f138c4dcba722e321d43c4284
    * @param out
    */
   @RequestMapping(value = "getCurrencyCoupon")
@@ -383,18 +406,17 @@
    * 保存信息
    * 
    * @param callback
    * @param special  0a39676f138c4dcba722e321d43c4284
    * @param out
    */
   @RequestMapping(value = "saveActivityPic")
   public void saveActivityPic(String callback, String pid, ImgInfo imgInfo, HttpServletRequest request,
   public void saveActivityPic(String callback, String pid, ImgInfo imgInfo, String picUrls, HttpServletRequest request,
         PrintWriter out) {
      try {
         MultipartHttpServletRequest fileRequest = null;
         if (request instanceof MultipartHttpServletRequest) {
            fileRequest = (MultipartHttpServletRequest) request;
         }
         goodsEvaluateService.saveActivityPic(pid, imgInfo, fileRequest);
         goodsEvaluateService.saveActivityPic(pid, imgInfo,picUrls, fileRequest);
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
      } catch (GoodsEvaluateException e) {
         JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
@@ -408,7 +430,6 @@
    * 获取信息
    * 
    * @param callback
    * @param special  0a39676f138c4dcba722e321d43c4284
    * @param out
    */
   @RequestMapping(value = "getActivityPic")
@@ -416,19 +437,23 @@
      try {
         String videoPic = "";
         String videoUrl = "";
         String activityPic = "";
         String activityUrl = "";
         List<String> list = new ArrayList<String>();
         GoodsEvaluate goodsEvaluate = goodsEvaluateService.getById(pid);
         if (goodsEvaluate != null && goodsEvaluate.getImgList() != null && goodsEvaluate.getImgList().size() > 0) {
            activityUrl = goodsEvaluate.getJumpLink();
            List<ImgInfo> imgList = goodsEvaluate.getImgList();
            for (ImgInfo imgInfo : imgList) {
               ImgEnum type = imgInfo.getType();
               if (type == ImgEnum.video) {
                  videoPic = imgInfo.getUrl();
                  videoUrl = imgInfo.getVideoUrl();
               } else if (type == ImgEnum.activity) {
                  activityPic = imgInfo.getUrl();
                  activityUrl = imgInfo.getActivityUrl();
               } else {
                  list.add(imgInfo.getUrl());
                  if (StringUtil.isNullOrEmpty(activityUrl) && !StringUtil.isNullOrEmpty(imgInfo.getActivityUrl())) {
                     activityUrl  = imgInfo.getActivityUrl();
                  }
               }
            }
         }
@@ -436,7 +461,7 @@
         JSONObject data = new JSONObject();
         data.put("videoUrl", videoUrl);
         data.put("videoPic", videoPic);
         data.put("activityPic", activityPic);
         data.put("listPic", list);
         data.put("activityUrl", activityUrl);
         JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
      } catch (Exception e) {
@@ -449,7 +474,6 @@
    * 保存信息
    * 
    * @param callback
    * @param special  0a39676f138c4dcba722e321d43c4284
    * @param out
    */
   @RequestMapping(value = "saveSuCai")
@@ -476,7 +500,6 @@
    * 获取信息
    * 
    * @param callback
    * @param special  0a39676f138c4dcba722e321d43c4284
    * @param out
    */
   @RequestMapping(value = "getSuCaiPic")
@@ -521,7 +544,6 @@
    * 保存信息
    * 
    * @param callback
    * @param special
    * @param out
    */
   @RequestMapping(value = "getEvaluate")
@@ -584,12 +606,10 @@
    * @param callback
    * @param pageIndex
    * @param pageSize
    * @param bannerId
    * @param out
    */
   @RequestMapping(value = "query")
   public void query(String callback, Integer pageIndex, Integer pageSize, String key, Integer state,
         PrintWriter out) {
   public void query(String callback, Integer pageIndex, Integer pageSize, String key, Integer state, String typeEnum, PrintWriter out) {
      if (pageIndex == null || pageIndex < 1) {
         pageIndex = 1;
      }
@@ -598,7 +618,7 @@
      }
      try {
         List<GoodsEvaluate> list = goodsEvaluateService.query((pageIndex - 1) * pageSize, pageSize, key, state, 1);
         List<GoodsEvaluate> list = goodsEvaluateService.query((pageIndex - 1) * pageSize, pageSize, key, state, 1, typeEnum);
         if (list == null || list.size() == 0) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
            return;
@@ -620,7 +640,7 @@
            }
         }
         long count = goodsEvaluateService.count(key, state, 1);
         long count = goodsEvaluateService.count(key, state, 1, typeEnum);
         int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
         PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
@@ -641,7 +661,6 @@
    * @param callback
    * @param pageIndex
    * @param pageSize
    * @param bannerId
    * @param out
    */
   @RequestMapping(value = "querySuCai")
@@ -655,7 +674,7 @@
      }
      try {
         List<GoodsEvaluate> list = goodsEvaluateService.query((pageIndex - 1) * pageSize, pageSize, key, state, 2);
         List<GoodsEvaluate> list = goodsEvaluateService.query((pageIndex - 1) * pageSize, pageSize, key, state, 2, null);
         if (list == null || list.size() == 0) {
            JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("暂无数据"));
            return;
@@ -677,7 +696,7 @@
            }
         }
         long count = goodsEvaluateService.count(key, state, 2);
         long count = goodsEvaluateService.count(key, state, 2, null);
         int totalPage = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1);
         PageEntity pe = new PageEntity(pageIndex, pageSize, count, totalPage);
@@ -696,7 +715,6 @@
    * 根据链接查询商品
    * 
    * @param callback
    * @param text
    * @param out
    */
   @RequestMapping(value = "getGoodsByUrl")
@@ -714,7 +732,7 @@
         GoodsDetailVO goodsDetail = null;
         BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
         BigDecimal shareRate = hongBaoManageService.getShareRate();
         BigDecimal vipFanLiRate = hongBaoManageService.getVIPFanLiRate();
         BigDecimal vipFanLiRate = hongBaoManageService.getFanLiRate(UserLevelEnum.superVIP);
         ConfigParamsDTO params = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE, vipFanLiRate);
         if (commonGoods.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) {
@@ -798,7 +816,6 @@
    * 保存信息
    * 
    * @param callback
    * @param special
    * @param out
    */
   @RequestMapping(value = "saveComment")
@@ -851,7 +868,6 @@
    * 删除信息
    * 
    * @param callback
    * @param idArray
    * @param out
    */
   @RequestMapping(value = "release")
@@ -876,9 +892,6 @@
    * 查询品论
    * 
    * @param callback
    * @param pageIndex
    * @param pageSize
    * @param bannerId
    * @param out
    */
   @RequestMapping(value = "queryComment")