| | |
| | | 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.domain.vip.OrderRecord; |
| | | import com.yeshi.buwan.domain.vip.OrderType; |
| | | import com.yeshi.buwan.dto.order.PPTVVideoPrice; |
| | | 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.pptv.PPTVUtil; |
| | | import com.yeshi.buwan.pptv.entity.PPTVSeries; |
| | | import com.yeshi.buwan.pptv.entity.VideoPPTVMap; |
| | | import com.yeshi.buwan.videos.pptv.PPTVApiUtil; |
| | | import com.yeshi.buwan.videos.pptv.PPTVUtil; |
| | | import com.yeshi.buwan.videos.pptv.entity.PPTVProgram; |
| | | import com.yeshi.buwan.videos.pptv.entity.PPTVSeries; |
| | | 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.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.*; |
| | | import java.util.HashSet; |
| | | import java.util.Set; |
| | | |
| | | @Controller |
| | | @RequestMapping("api/v2/videoinfo") |
| | |
| | | |
| | | @RequestMapping("getPPVideoInfo") |
| | | @ResponseBody |
| | | public String getPPVideoInfo(AcceptData acceptData, String loginUid, String infoId) { |
| | | public String getPPVideoInfo(AcceptData acceptData, String loginUid, String cid,String vid) { |
| | | //获取PPTV的视频详情 |
| | | PPTVSeries series = pptvService.getSeriesDetail(infoId); |
| | | PPTVSeries series = pptvService.selectSeriesBySeriesCode(cid); |
| | | 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())) { |
| | | PPTVProgram pptvProgram=pptvService.selectProgramById(vid); |
| | | |
| | | if (pptvProgram.getGoodsInfo() == null || StringUtil.isNullOrEmpty(pptvProgram.getGoodsInfo().getGoodsNo())) { |
| | | PPTVSeries detail = PPTVApiUtil.getDetail(cid); |
| | | series.setGoodsInfo(detail.getGoodsInfo()); |
| | | pptvService.updateProgramGoodsInfo(series.getInfoID(), series.getGoodsInfo()); |
| | | } |
| | | |
| | | if (pptvProgram.getGoodsInfo() == null || StringUtil.isNullOrEmpty(pptvProgram.getGoodsInfo().getGoodsNo())) { |
| | | return JsonUtilV2.loadFalseJson("当前影片不能购买"); |
| | | } |
| | | |
| | |
| | | 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())) |
| | | videoInfo.setDuration(getDurationDesc(Integer.parseInt(series.getSeries().get(0).getDuration()))); |
| | | if (pptvProgram!=null && !StringUtil.isNullOrEmpty(pptvProgram.getDuration())) |
| | | videoInfo.setDuration(getDurationDesc(Integer.parseInt(pptvProgram.getDuration()))); |
| | | videoInfo.setDesc(series.getDescription()); |
| | | Gson gson = new GsonBuilder().create(); |
| | | |
| | |
| | | //加载价格信息 |
| | | JSONObject priceInfo = new JSONObject(); |
| | | priceInfo.put("discount", price.getTag()); |
| | | priceInfo.put("actualPrice",price.getActualPrice()); |
| | | priceInfo.put("actualPrice", price.getActualPrice()); |
| | | data.put("price", priceInfo); |
| | | |
| | | if (!StringUtil.isNullOrEmpty(loginUid)) { |