| | |
| | | |
| | | import java.io.PrintWriter; |
| | | import java.lang.reflect.Type; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.Date; |
| | |
| | | import com.yeshi.fanli.entity.system.ConfigKeyEnum; |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief; |
| | | import com.yeshi.fanli.entity.taobao.TaoBaoLink; |
| | | import com.yeshi.fanli.exception.goods.ConvertLinkExceptionException; |
| | | 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.user.tb.UserExtraTaoBaoInfoService; |
| | | import com.yeshi.fanli.service.manger.goods.ConvertLinkManager; |
| | | import com.yeshi.fanli.util.Constant; |
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil; |
| | | import com.yeshi.fanli.util.StringUtil; |
| | | import com.yeshi.fanli.util.VersionUtil; |
| | | import com.yeshi.fanli.util.cache.JDGoodsCacheUtil; |
| | |
| | | return new JsonPrimitive(value.getVlaue()); |
| | | } |
| | | } |
| | | }).registerTypeAdapter(BigDecimal.class, new JsonSerializer<BigDecimal>() { |
| | | @Override |
| | | public JsonElement serialize(BigDecimal value, Type theType, JsonSerializationContext context) { |
| | | if (value == null) { |
| | | return new JsonPrimitive(""); |
| | | } else { |
| | | // 保留2位小数 |
| | | return new JsonPrimitive(MoneyBigDecimalUtil.getWithNoZera(value)+""); |
| | | } |
| | | } |
| | | }).registerTypeAdapter(Date.class, new JsonSerializer<Date>() { |
| | | @Override |
| | | public JsonElement serialize(Date value, Type theType, JsonSerializationContext context) { |
| | |
| | | // 单品 |
| | | if (goodsEvaluate.getType() == EvaluateEnum.single) { |
| | | for (ImgInfo imgInfo : imgs) { |
| | | if (type == 3 && imgInfo.getType() == ImgEnum.video) |
| | | if (imgInfo.getType() == ImgEnum.video) |
| | | continue; |
| | | |
| | | GoodsDetailVO goodsVO = imgInfo.getGoodsVO(); |
| | |
| | | continue; |
| | | } |
| | | |
| | | String jumpLink = getJumpLink(goodsVO, user, relationId, inviteCode); |
| | | String jumpLink = getJumpLink(goodsVO, user, relationId, inviteCode, imgInfo.getUrl()); |
| | | if (!StringUtil.isNullOrEmpty(jumpLink)) { |
| | | list.add(jumpLink); |
| | | } |
| | |
| | | if (imgInfo.getGoodsVO() != null) |
| | | if (imgInfo.getGoodsVO().getGoodsId().longValue() == goodsId.longValue() |
| | | && imgInfo.getGoodsVO().getGoodsType() == goodsType.intValue()) { |
| | | String jumpLink = getJumpLink(imgInfo.getGoodsVO(), user, relationId, inviteCode); |
| | | String jumpLink = getJumpLink(imgInfo.getGoodsVO(), user, relationId, inviteCode, imgInfo.getUrl()); |
| | | if (!StringUtil.isNullOrEmpty(jumpLink)) { |
| | | list.add(jumpLink); |
| | | } |
| | |
| | | } else if (type == 2 || type == 3) { |
| | | for (ImgInfo imgInfo : imgs) { |
| | | if (imgInfo.getGoodsVO() != null) { |
| | | String jumpLink = getJumpLink(imgInfo.getGoodsVO(), user, relationId, inviteCode); |
| | | String jumpLink = getJumpLink(imgInfo.getGoodsVO(), user, relationId, inviteCode, imgInfo.getUrl() ); |
| | | if (!StringUtil.isNullOrEmpty(jumpLink)) { |
| | | list.add(jumpLink); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | private String getJumpLink(GoodsDetailVO goodsVO, UserInfo user, String relationId, String inviteCode) { |
| | | private String getJumpLink(GoodsDetailVO goodsVO, UserInfo user, String relationId, String inviteCode, String mainPic) { |
| | | String jumpLink = null; |
| | | if (goodsVO.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) { |
| | | TaoBaoLink taoBaoLink = null; |
| | |
| | | } |
| | | |
| | | FileUploadResult uploadResult = qrCodeService.drawDynamicGoodsPoster(jumpLink, user.getPortrait(), inviteCode, |
| | | goodsVO); |
| | | mainPic, goodsVO); |
| | | if (uploadResult != null) { |
| | | return uploadResult.getUrl(); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | String newText = text; |
| | | try { |
| | | text = convertLinkManager.convertLinkFromText(text, uid, true); |
| | | newText = convertLinkManager.convertLinkFromText(text, uid, true); |
| | | } catch (ConvertLinkExceptionException e) { |
| | | if (e.getCode() != ConvertLinkExceptionException.CODE_NONE) { |
| | | out.print(JsonUtil.loadFalseResult("评论生成失败")); |
| | | return; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | out.print(JsonUtil.loadFalseResult("评论生成失败")); |
| | |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("text", text); |
| | | data.put("text", newText); |
| | | out.print(JsonUtil.loadTrueResult(data)); |
| | | } |
| | | |