| | |
| | | package com.yeshi.buwan.controller.api; |
| | | |
| | | import com.google.gson.*; |
| | | import com.ks.goldcorn.service.remote.GoldCornBalanceService; |
| | | import com.yeshi.buwan.domain.VideoInfo; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.yeshi.buwan.domain.user.LoginUser; |
| | | import com.yeshi.buwan.domain.vip.*; |
| | | import com.yeshi.buwan.exception.goldcorn.GoldCornException; |
| | | import com.yeshi.buwan.exception.order.OrderException; |
| | | import com.yeshi.buwan.exception.order.PayException; |
| | | import com.yeshi.buwan.domain.vip.OrderRecord; |
| | | import com.yeshi.buwan.domain.vip.OrderType; |
| | | import com.yeshi.buwan.dto.order.PPTVVideoPrice; |
| | | import com.yeshi.buwan.pptv.PPTVApiUtil; |
| | | import com.yeshi.buwan.pptv.PPTVUtil; |
| | | import com.yeshi.buwan.pptv.entity.PPTVSeries; |
| | | import com.yeshi.buwan.pptv.entity.VideoPPTVMap; |
| | | import com.yeshi.buwan.service.inter.LoginUserService; |
| | | import com.yeshi.buwan.service.inter.juhe.PPTVService; |
| | | import com.yeshi.buwan.service.inter.order.OrderService; |
| | | import com.yeshi.buwan.service.inter.system.SystemConfigService; |
| | | import com.yeshi.buwan.service.inter.vip.VIPPriceService; |
| | | import com.yeshi.buwan.service.inter.vip.VIPService; |
| | | import com.yeshi.buwan.service.manager.GoldCornManager; |
| | | import com.yeshi.buwan.util.*; |
| | | import com.yeshi.buwan.util.factory.VideoInfoFactory; |
| | | import com.yeshi.buwan.util.user.VipUtil; |
| | | import com.yeshi.buwan.util.vip.VIPOrderUtil; |
| | | import com.yeshi.buwan.util.JsonUtilV2; |
| | | import com.yeshi.buwan.util.ThreadUtil; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import com.yeshi.buwan.vo.client.user.UserInfoVO; |
| | | import net.sf.json.JSONObject; |
| | | import org.apache.dubbo.config.annotation.Reference; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.yeshi.utils.StringUtil; |
| | | import org.yeshi.utils.annotation.RequestSerializableByKey; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.lang.reflect.Type; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | | import java.util.HashSet; |
| | | import java.util.Set; |
| | | |
| | | @Controller |
| | | @RequestMapping("api/v2/videoinfo") |
| | |
| | | |
| | | @Resource |
| | | private GoldCornManager goldCornManager; |
| | | |
| | | @Resource |
| | | private SystemConfigService systemConfigService; |
| | | |
| | | private String getDurationDesc(int duration) { |
| | | int h = duration / (60 * 60); |
| | |
| | | if (series == null) { |
| | | return JsonUtilV2.loadFalseJson("当前影片不存在"); |
| | | } |
| | | if (!"add".equalsIgnoreCase(series.getStatus()) && !"update".equalsIgnoreCase(series.getStatus())) { |
| | | if (!PPTVUtil.getAvaiableStates().contains(series.getStatus())) { |
| | | return JsonUtilV2.loadFalseJson("当前影片已下线"); |
| | | } |
| | | |
| | | if (series.getGoodsInfo() == null || StringUtil.isNullOrEmpty(series.getGoodsInfo().getGoodsNo())) { |
| | | PPTVSeries detail = PPTVApiUtil.getDetail(series.getSeriesCode()); |
| | | series.setGoodsInfo(detail.getGoodsInfo()); |
| | | pptvService.updateSeriesGoodsInfo(series.getInfoID(), series.getGoodsInfo()); |
| | | } |
| | | |
| | | if (series.getGoodsInfo() == null || StringUtil.isNullOrEmpty(series.getGoodsInfo().getGoodsNo())) { |
| | | return JsonUtilV2.loadFalseJson("当前影片不能购买"); |
| | | } |
| | | |
| | | Set<String> typeSets = new HashSet<>(); |
| | | |
| | | try { |
| | | String[] sts = series.getProgramcategory().split(","); |
| | | for (String st : sts) { |
| | | typeSets.add(st.split("-")[0]); |
| | | } |
| | | typeSets.remove("好莱坞"); |
| | | typeSets.remove("院线"); |
| | | } catch (Exception e) { |
| | | } |
| | | |
| | | PPTVSimpleVideoInfo videoInfo = new PPTVSimpleVideoInfo(); |
| | | videoInfo.setInfoId(series.getInfoID()); |
| | | videoInfo.setName(series.getName()); |
| | | videoInfo.setPicture(series.getCover()); |
| | | videoInfo.setCategory(series.getProgramcategory().replace("-电视剧", "").replace("-电影", "").replace("-动漫", "").replace("-少儿", "")); |
| | | videoInfo.setCategory(com.yeshi.buwan.util.StringUtil.join(typeSets, " ")); |
| | | videoInfo.setActors(series.getActor()); |
| | | videoInfo.setDirectors(series.getDirector()); |
| | | if (series.getSeries() != null && series.getSeries().size() > 0 && !StringUtil.isNullOrEmpty(series.getSeries().get(0).getDuration())) |
| | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("video", gson.toJson(videoInfo)); |
| | | |
| | | PPTVVideoPrice price = new Gson().fromJson(systemConfigService.getConfigValueByKeyCache("videoPrice"), PPTVVideoPrice.class); |
| | | |
| | | //加载价格信息 |
| | | JSONObject priceInfo=new JSONObject(); |
| | | priceInfo.put("discount","6折"); |
| | | priceInfo.put("actualPrice","3.9"); |
| | | JSONObject priceInfo = new JSONObject(); |
| | | priceInfo.put("discount", price.getTag()); |
| | | priceInfo.put("actualPrice", price.getActualPrice()); |
| | | data.put("price", priceInfo); |
| | | |
| | | if (!StringUtil.isNullOrEmpty(loginUid)) { |