| | |
| | | |
| | | import java.awt.image.BufferedImage; |
| | | import java.io.InputStream; |
| | | import java.io.PrintWriter; |
| | | import java.lang.reflect.Type; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.Collections; |
| | | import java.util.Comparator; |
| | | import java.util.Date; |
| | |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.springframework.web.multipart.MultipartHttpServletRequest; |
| | | import org.yeshi.utils.DateUtil; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.tencentcloud.COSManager; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.JsonElement; |
| | | import com.google.gson.JsonPrimitive; |
| | | import com.google.gson.JsonSerializationContext; |
| | | import com.google.gson.JsonSerializer; |
| | | import com.yeshi.fanli.dao.dynamic.GoodsEvaluateDao; |
| | | import com.yeshi.fanli.dto.ConfigParamsDTO; |
| | | import com.yeshi.fanli.dto.pdd.PDDGoodsDetail; |
| | | import com.yeshi.fanli.entity.accept.AcceptData; |
| | | import com.yeshi.fanli.entity.bus.activity.ActivityUser; |
| | | import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo; |
| | | import com.yeshi.fanli.entity.bus.user.UserInfo; |
| | | import com.yeshi.fanli.entity.dynamic.CommentInfo; |
| | | import com.yeshi.fanli.entity.dynamic.DynamicInfo; |
| | | import com.yeshi.fanli.entity.dynamic.CommentInfo.CommentInfoEnum; |
| | | import com.yeshi.fanli.entity.dynamic.GoodsEvaluate; |
| | | import com.yeshi.fanli.entity.dynamic.GoodsEvaluate.EvaluateEnum; |
| | | import com.yeshi.fanli.entity.dynamic.GoodsPicture; |
| | | import com.yeshi.fanli.entity.dynamic.ImgInfo; |
| | | import com.yeshi.fanli.entity.dynamic.ImgInfo.ImgEnum; |
| | | import com.yeshi.fanli.entity.dynamic.SimpleGoods; |
| | |
| | | import com.yeshi.fanli.vo.goods.CouponInfoVO; |
| | | import com.yeshi.fanli.vo.goods.GoodsDetailVO; |
| | | import com.yeshi.fanli.vo.msg.ClientTextStyleVO; |
| | | |
| | | import net.sf.json.JSONObject; |
| | | |
| | | @Service |
| | | public class GoodsEvaluateServiceImpl implements GoodsEvaluateService { |
| | |
| | | picNum = 1; |
| | | } |
| | | |
| | | GoodsDetailVO goodsDetailVO = getGoodsDetailVO(goodsId, goodsType);; |
| | | GoodsDetailVO goodsDetailVO = getGoodsDetailVO(goodsId, goodsType); |
| | | ; |
| | | if (goodsDetailVO == null) { |
| | | throw new GoodsEvaluateException(1, "该商品信息不存在"); |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void saveSuCai(String pid, String videoUrl, String picUrls, |
| | | MultipartHttpServletRequest fileRequest) throws GoodsEvaluateException, Exception { |
| | | public void saveSuCai(String pid, String videoUrl, String picUrls, MultipartHttpServletRequest fileRequest) |
| | | throws GoodsEvaluateException, Exception { |
| | | if (StringUtil.isNullOrEmpty(pid)) { |
| | | throw new GoodsEvaluateException(1, "请保存第一部分信息"); |
| | | } |
| | |
| | | imgVideo.setH(height); |
| | | } |
| | | |
| | | |
| | | activityFile = fileRequest.getFile("activityFile"); |
| | | } |
| | | |
| | |
| | | } else if (imgActivity != null) { |
| | | listImg.add(imgActivity); |
| | | } |
| | | |
| | | |
| | | |
| | | // 编辑图片 |
| | | if (!StringUtil.isNullOrEmpty(picUrls)) { |
| | |
| | | goodsEvaluateDao.save(goodsEvaluate); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void deleteComment(String pid, List<String> list) throws GoodsEvaluateException { |
| | | if (list == null || list.size() == 0) { |
| | |
| | | continue; |
| | | } |
| | | |
| | | GoodsDetailVO goodsDetailVO = getGoodsNewInfo(simpleGoods.getGoodsId(), simpleGoods.getGoodsType(), paramsDTO); |
| | | GoodsDetailVO goodsDetailVO = getGoodsNewInfo(simpleGoods.getGoodsId(), simpleGoods.getGoodsType(), |
| | | paramsDTO); |
| | | if (goodsDetailVO != null) { |
| | | simpleGoods.setPrice(goodsDetailVO.getCouponPrice()); |
| | | CouponInfoVO couponInfo = goodsDetailVO.getCouponInfo(); |
| | |
| | | return vo; |
| | | } |
| | | |
| | | @Override |
| | | public void addGoodsEvaluateByDynamicInfo(DynamicInfo info) { |
| | | try { |
| | | GoodsEvaluate goodsEvaluate = new GoodsEvaluate(); |
| | | goodsEvaluate.setId(UUID.randomUUID().toString().replace("-", "")); |
| | | ActivityUser user = info.getUser(); |
| | | goodsEvaluate.setUser(user); |
| | | goodsEvaluate.setState(1); |
| | | goodsEvaluate.setDynamicType(1); |
| | | goodsEvaluate.setType(EvaluateEnum.single); |
| | | goodsEvaluate.setLineNum(2); |
| | | goodsEvaluate.setShareNum(info.getShareCount()); |
| | | goodsEvaluate.setShareNumReal(0); |
| | | goodsEvaluate.setPublishTime(info.getCreateTime()); |
| | | goodsEvaluate.setCreateTime(new Date()); |
| | | goodsEvaluate.setUpdateTime(new Date()); |
| | | goodsEvaluate.setWeight(0.0); |
| | | goodsEvaluate.setStartTime(new Date()); |
| | | goodsEvaluate.setEndTime(DateUtil.plusYears(new Date(), 100)); |
| | | |
| | | List<ClientTextStyleVO> titles = info.getTitle(); |
| | | if (titles != null) { |
| | | goodsEvaluate.setTitle(info.getTitle().get(0).getContent()); |
| | | } else { |
| | | goodsEvaluate.setTitle(""); |
| | | } |
| | | |
| | | List<ImgInfo> imgList = new ArrayList<>(); |
| | | |
| | | List<GoodsPicture> imgs = info.getImgs(); |
| | | for (GoodsPicture goodsPicture : imgs) { |
| | | ImgInfo imgInfo = new ImgInfo(); |
| | | imgInfo.setH(1); |
| | | imgInfo.setW(1); |
| | | imgInfo.setLarge(false); |
| | | imgInfo.setUrl(goodsPicture.getUrl()); |
| | | imgInfo.setUrlHD(goodsPicture.getUrl()); |
| | | |
| | | GoodsDetailVO goodsVO = goodsPicture.getGoodsVO(); |
| | | if (goodsVO == null) { |
| | | imgInfo.setType(ImgEnum.img); |
| | | } else { |
| | | imgInfo.setType(ImgEnum.goods); |
| | | SimpleGoods simpleGoods = new SimpleGoods(); |
| | | simpleGoods.setGoodsId(goodsVO.getGoodsId()); |
| | | simpleGoods.setGoodsType(goodsVO.getGoodsType()); |
| | | |
| | | CouponInfoVO couponInfo = goodsVO.getCouponInfo(); |
| | | if (couponInfo == null) { |
| | | simpleGoods.setState(0); |
| | | simpleGoods.setPrice(goodsVO.getZkPrice()); |
| | | } else { |
| | | simpleGoods.setState(goodsVO.getState()); |
| | | simpleGoods.setPrice(goodsVO.getCouponPrice()); |
| | | simpleGoods.setAmount(couponInfo.getAmount()); |
| | | } |
| | | imgInfo.setGoods(simpleGoods); |
| | | goodsEvaluate.setGoods(goodsVO); |
| | | } |
| | | imgList.add(imgInfo); |
| | | } |
| | | goodsEvaluate.setImgList(imgList); |
| | | goodsEvaluateDao.save(goodsEvaluate); |
| | | } catch (Exception e) { |
| | | LogHelper.errorDetailInfo(e); |
| | | } |
| | | } |
| | | |
| | | } |