| | |
| | | import com.yeshi.buwan.exception.order.OrderException; |
| | | import com.yeshi.buwan.exception.order.PayException; |
| | | import com.yeshi.buwan.exception.vip.VIPException; |
| | | import com.yeshi.buwan.exception.vip.VideoBuyRecordException; |
| | | 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.util.vip.VIPOrderUtil; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import com.yeshi.buwan.vo.client.user.UserInfoVO; |
| | | import com.yeshi.buwan.vo.order.OrderInfoVO; |
| | | import net.sf.json.JSONObject; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | |
| | | import java.lang.reflect.Type; |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.UUID; |
| | |
| | | } |
| | | |
| | | |
| | | @RequestMapping("getVIPOrderList") |
| | | @RequestMapping("getOrderList") |
| | | @ResponseBody |
| | | public String getVIPOrderList(AcceptData acceptData, String loginUid, int page) { |
| | | public String getOrderList(AcceptData acceptData, String loginUid, String type, int page) { |
| | | Gson gson = new GsonBuilder().registerTypeAdapter(VIPPriceType.class, new JsonSerializer<VIPPriceType>() { |
| | | @Override |
| | | public JsonElement serialize(VIPPriceType value, Type theType, JsonSerializationContext context) { |
| | |
| | | }).create(); |
| | | JSONObject root = new JSONObject(); |
| | | |
| | | List<OrderRecord> list = orderService.listOrderRecord(loginUid, OrderType.vip, null, page, Constant.pageCount); |
| | | List<OrderRecord> list = orderService.listOrderRecord(loginUid, type == null ? null : OrderType.valueOf(type), null, page, Constant.pageCount); |
| | | |
| | | List<OrderInfoVO> voList = new ArrayList<>(); |
| | | for (OrderRecord record : list) { |
| | | record.setIpInfo(null); |
| | | record.setUpdateTime(null); |
| | | voList.add(OrderInfoVO.create(record)); |
| | | } |
| | | long count = orderService.countOrderRecord(loginUid, OrderType.vip, null); |
| | | root.put("list", gson.toJson(list)); |
| | | long count = orderService.countOrderRecord(loginUid, type == null ? null : OrderType.valueOf(type), null); |
| | | root.put("list", gson.toJson(voList)); |
| | | root.put("count", count); |
| | | return JsonUtilV2.loadTrueJson(root.toString()); |
| | | } |
| | |
| | | */ |
| | | @RequestMapping("createOrder") |
| | | @ResponseBody |
| | | public String createOrder(AcceptData acceptData, HttpServletRequest request, String loginUid, String priceId, String infoId, Integer goldCorn, int payWay) { |
| | | public String createOrder(AcceptData acceptData, HttpServletRequest request, String loginUid, String priceId, String cid, String vid, Integer goldCorn, int payWay) { |
| | | |
| | | if (StringUtil.isNullOrEmpty(loginUid)) { |
| | | return JsonUtilV2.loadFalseJson("用户未登录"); |
| | |
| | | return JsonUtilV2.loadFalseJson(10001, "请绑定电话号码"); |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(priceId) && StringUtil.isNullOrEmpty(infoId)) { |
| | | if (StringUtil.isNullOrEmpty(priceId) && StringUtil.isNullOrEmpty(cid)) { |
| | | return JsonUtilV2.loadFalseJson("请选择购买类型"); |
| | | } |
| | | |
| | | if (goldCorn == null) |
| | | goldCorn = 0; |
| | | |
| | | OrderType orderType = OrderType.vip; |
| | | |
| | | if (!StringUtil.isNullOrEmpty(infoId)) { |
| | | if (!StringUtil.isNullOrEmpty(cid)) { |
| | | orderType = OrderType.video; |
| | | } |
| | | |
| | |
| | | VIPPrice vipPrice = null; |
| | | |
| | | if (orderType == OrderType.video) { |
| | | //视频 |
| | | VideoPPTVMap map = pptvService.selectVideoPPTVMapByInfoId(infoId); |
| | | if (map == null) { |
| | | PPTVSeries pptvSeries = pptvService.selectSeriesBySeriesCode(cid); |
| | | if (pptvSeries == null) { |
| | | return JsonUtilV2.loadFalseJson("影片不存在"); |
| | | } |
| | | PPTVSeries pptvSeries = pptvService.selectSeriesByInfoId(infoId); |
| | | if (pptvSeries == null) { |
| | | //视频 |
| | | VideoPPTVMap map = pptvService.selectVideoPPTVMapByPPInfo(pptvSeries.getInfoID(), vid); |
| | | if (map == null) { |
| | | return JsonUtilV2.loadFalseJson("影片不存在"); |
| | | } |
| | | record.setRemarks(pptvSeries.getName()); |
| | |
| | | } |
| | | |
| | | record.setOrderType(orderType); |
| | | record.setVideoInfoId(infoId); |
| | | record.setVideoCid(cid); |
| | | record.setVideoVid(vid); |
| | | record.setGoldCorn(goldCorn); |
| | | record.setPayWay(payWay); |
| | | record.setState(OrderRecord.STATE_NOT_PAY); |
| | |
| | | return JsonUtilV2.loadFalseJson(e.getMessage()); |
| | | } catch (PPTVException e) { |
| | | return JsonUtilV2.loadFalseJson(e.getMessage()); |
| | | } catch (VideoBuyRecordException e) { |
| | | return JsonUtilV2.loadFalseJson("单片购买失败"); |
| | | } |
| | | return JsonUtilV2.loadTrueJson(new Gson().toJson(payResult)); |
| | | } |