| | |
| | | <id>install-lib-common</id> |
| | | <phase>clean</phase> |
| | | <configuration> |
| | | <file>${basedir}/libs/lib-common.jar</file> |
| | | <file>${basedir}/src/main/webapp/WEB-INF/lib/lib-common.jar</file> |
| | | <repositoryLayout>default</repositoryLayout> |
| | | <groupId>com.ks</groupId> |
| | | <artifactId>lib-common</artifactId> |
| | |
| | | <id>install-utils</id> |
| | | <phase>clean</phase> |
| | | <configuration> |
| | | <file>${basedir}/libs/utils.jar</file> |
| | | <file>${basedir}/src/main/webapp/WEB-INF/lib/utils.jar</file> |
| | | <repositoryLayout>default</repositoryLayout> |
| | | <groupId>org.yeshi</groupId> |
| | | <artifactId>utils</artifactId> |
| | |
| | | import com.yeshi.buwan.service.imp.SearchService; |
| | | import com.yeshi.buwan.service.inter.order.OrderService; |
| | | import com.yeshi.buwan.service.inter.vip.VIPService; |
| | | import com.yeshi.buwan.util.JsonUtilV2; |
| | | import net.sf.json.JSONObject; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.stereotype.Controller; |
| | |
| | | out.print(JsonUtil.loadTrueResult(result)); |
| | | } |
| | | |
| | | // |
| | | // @RequestMapping("checkPay") |
| | | // public String checkPay(String loginUid,String id, PrintWriter out) { |
| | | // OrderRecord record = orderService.getOrderRecord(id); |
| | | // if (record == null || !record.getUid().equalsIgnoreCase(loginUid)) { |
| | | // return JsonUtilV2.loadFalseJson("记录不存在/不是您的订单"); |
| | | // } |
| | | // |
| | | // record = orderService.checkOrderPayState(id); |
| | | // //未支付 |
| | | // if (record != null && record.getState() != OrderRecord.STATE_PAY) { |
| | | // return JsonUtilV2.loadFalseJson(1, "支付未完成"); |
| | | // } |
| | | // |
| | | // JSONObject data = new JSONObject(); |
| | | // data.put("money", record.getPayMoney() == null ? record.getMoney() : record.getPayMoney()); |
| | | // |
| | | // return JsonUtilV2.loadTrueJson(data.toString()); |
| | | // } |
| | | |
| | | |
| | | } |
| | |
| | | import com.yeshi.buwan.domain.jump.JumpDetail; |
| | | import com.yeshi.buwan.domain.jump.JumpTypeEnum; |
| | | import com.yeshi.buwan.dto.goldcorn.SignInGoldCornDateData; |
| | | import com.yeshi.buwan.exception.goldcorn.SignInException; |
| | | import com.yeshi.buwan.exception.user.LoginUserException; |
| | | import com.yeshi.buwan.service.inter.goldcorn.GoldCornTaskActionDetailService; |
| | | import com.yeshi.buwan.service.inter.goldcorn.SignInService; |
| | | import com.yeshi.buwan.service.inter.system.SystemConfigService; |
| | | import com.yeshi.buwan.service.manager.GoldCornManager; |
| | | import com.yeshi.buwan.util.Constant; |
| | | import com.yeshi.buwan.util.JsonUtil; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.TimeUtil; |
| | | import com.yeshi.buwan.util.*; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import com.yeshi.buwan.vo.goldcorn.GoldCornCouponVideoVO; |
| | | import com.yeshi.buwan.vo.goldcorn.GoldCornRecordVO; |
| | |
| | | @RequestMapping("makeGoldCorn") |
| | | @ResponseBody |
| | | public String makeGoldCorn(AcceptData acceptData, String code, String loginUid, String param1, String param2) { |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("goldCorn", 1); |
| | | return JsonUtil.loadTrueJson(jsonObject.toString()); |
| | | } |
| | | |
| | | @RequestMapping("signIn") |
| | | @ResponseBody |
| | | public String signIn(AcceptData acceptData, String loginUid) { |
| | | try { |
| | | GoldCornGetSource source = goldCornManager.getGoldCornGetSource(CodeCornGetSourceType.signIn); |
| | | goldCornManager.addGoldCorn(loginUid, CodeCornGetSourceType.signIn, null, "签到", null); |
| | | GoldCornGetSource source = goldCornManager.getGoldCornGetSource(CodeCornGetSourceType.valueOf(code)); |
| | | goldCornManager.addGoldCorn(loginUid, CodeCornGetSourceType.valueOf(code), null, source.getSourceName(), ""); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("goldCorn", source.getGoldCorn()); |
| | | return JsonUtil.loadTrueJson(jsonObject.toString()); |
| | |
| | | } catch (GoldTradeException e) { |
| | | return JsonUtil.loadFalseJson(e.getMessage()); |
| | | } catch (Exception e) { |
| | | return JsonUtil.loadFalseJson("签到失败"); |
| | | e.printStackTrace(); |
| | | logger.error("添加影视豆出错", e); |
| | | return JsonUtil.loadFalseJson("影视豆添加失败"); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | @RequestMapping("canDoTask") |
| | | @ResponseBody |
| | | public String canDoTask(AcceptData acceptData, String loginUid, String code, String param2) { |
| | | |
| | | long time = goldCornManager.getNextDoTaskTime(CodeCornGetSourceType.valueOf(code), loginUid); |
| | | if (time <= 0) { |
| | | return JsonUtil.loadTrueJson(""); |
| | | } else { |
| | | long span = time - System.currentTimeMillis(); |
| | | int ss = (int) (span / 1000); |
| | | int h = ss / 3600; |
| | | int m = ss % 3600 / 60; |
| | | int s = ss % 60; |
| | | String st = ""; |
| | | if (h > 0) { |
| | | st += h + "小时"; |
| | | } |
| | | if (m != 0 || h > 0) |
| | | st += m + "分"; |
| | | if (s > 0) |
| | | st += s + "秒"; |
| | | return JsonUtil.loadFalseJson(String.format("请等待 %s 后再做任务", st)); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | @RequestMapping("signIn") |
| | | @ResponseBody |
| | | public String signIn(AcceptData acceptData, String loginUid) { |
| | | try { |
| | | int goldCorn = signInService.signIn(loginUid); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("goldCorn", goldCorn); |
| | | return JsonUtil.loadTrueJson(jsonObject.toString()); |
| | | } catch (LoginUserException e) { |
| | | return JsonUtil.loadFalseJson("签到出错"); |
| | | } catch (SignInException e) { |
| | | e.printStackTrace(); |
| | | return JsonUtil.loadFalseJson(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | |
| | | @RequestMapping("getSignInData") |
| | |
| | | List<GoldCornRecord> list = goldCornManager.getRecordList(recordQuery, loginUid); |
| | | List<GoldCornRecordVO> voList = new ArrayList<>(); |
| | | for (GoldCornRecord record : list) { |
| | | voList.add(new GoldCornRecordVO(record.getTitle(), TimeUtil.getGernalTime(record.getCreateTime().getTime(), "yyyy.MM.dd HH:mm"), record.getType() == GoldCornRecord.TYPE_CONSUME ? 0 - record.getGoldCorn() : record.getGoldCorn())); |
| | | voList.add(new GoldCornRecordVO(record.getTitle(), record.getDesc(), TimeUtil.getGernalTime(record.getCreateTime().getTime(), "yyyy.MM.dd HH:mm"), record.getType() == GoldCornRecord.TYPE_CONSUME ? 0 - record.getGoldCorn() : record.getGoldCorn())); |
| | | } |
| | | long count = goldCornManager.getRecordCount(recordQuery, loginUid); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("list", new Gson().toJson(voList)); |
| | | data.put("count", count); |
| | | return JsonUtil.loadTrueJson(data.toString()); |
| | | return JsonUtilV2.loadTrueJson(data.toString()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | voList.add(new GoldCornCouponVideoVO("https://r1.ykimg.com/058400005FA60E6A14187C0791817503?x-oss-process=image/resize,w_290/interlace,1/quality,Q_80", jumpDetail, params.toString().replace("\"", "\\" + "\""))); |
| | | voList.add(new GoldCornCouponVideoVO("https://r1.ykimg.com/058400005F2BA59B6AEB660E907A2B99?x-oss-process=image/resize,w_290/interlace,1/quality,Q_80", jumpDetail, params.toString().replace("\"", "\\" + "\""))); |
| | | voList.add(new GoldCornCouponVideoVO("https://r1.ykimg.com/052700005DC9247B1B769182B50A8C21?x-oss-process=image/resize,w_290/interlace,1/quality,Q_80", jumpDetail, params.toString().replace("\"", "\\" + "\""))); |
| | | // if (voList.size() < 3) |
| | | voList.clear(); |
| | | if (voList.size() < 3) |
| | | voList.clear(); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("list", new Gson().toJson(voList)); |
| | | data.put("count", voList.size()); |
| | |
| | | |
| | | if (!hiddenList.contains(source.getSourceCode())) { |
| | | if (map.get(source.getSourceCode()) == null) { |
| | | source.setSourceDesc(String.format("今日已完成%s/%s", 0, source.getMaxDayCount())); |
| | | vo.setDesc(source.getSourceDesc() + "," + String.format("今日已完成%s/%s", 0, source.getMaxDayCount())); |
| | | } else { |
| | | vo.setEnable(map.get(source.getSourceCode()).getCount() < source.getMaxDayCount()); |
| | | source.setSourceDesc(String.format("今日已完成%s/%s", map.get(source.getSourceCode()).getCount(), source.getMaxDayCount())); |
| | | vo.setDesc(source.getSourceDesc() + "," + String.format("今日已完成%s/%s", map.get(source.getSourceCode()).getCount(), source.getMaxDayCount())); |
| | | } |
| | | } else { |
| | | vo.setGoldCorn("实付款*" + source.getGoldCorn()); |
| | |
| | | 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, 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, OrderType.valueOf(type), null); |
| | | root.put("list", gson.toJson(voList)); |
| | | root.put("count", count); |
| | | return JsonUtilV2.loadTrueJson(root.toString()); |
| | | } |
| | |
| | | return JsonUtilV2.loadFalseJson("请选择购买类型"); |
| | | } |
| | | |
| | | if (goldCorn == null) |
| | | goldCorn = 0; |
| | | |
| | | OrderType orderType = OrderType.vip; |
| | | |
| | | if (!StringUtil.isNullOrEmpty(infoId)) { |
| | |
| | | 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.service.inter.LoginUserService; |
| | | import com.yeshi.buwan.service.inter.juhe.PPTVService; |
| | |
| | | import com.yeshi.buwan.service.inter.vip.VIPService; |
| | | import com.yeshi.buwan.service.manager.GoldCornManager; |
| | | import com.yeshi.buwan.util.JsonUtilV2; |
| | | import com.yeshi.buwan.util.ThreadUtil; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import net.sf.json.JSONObject; |
| | | import org.slf4j.Logger; |
| | |
| | | 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())) { |
| | |
| | | //加载价格信息 |
| | | 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)) { |
| | |
| | | import com.yeshi.buwan.domain.jump.JumpTypeEnum; |
| | | import com.yeshi.buwan.domain.video.VideoWatchHistory; |
| | | import com.yeshi.buwan.pptv.PPTVApiUtil; |
| | | import com.yeshi.buwan.pptv.PPTVUtil; |
| | | import com.yeshi.buwan.pptv.entity.PPTVProgram; |
| | | import com.yeshi.buwan.pptv.entity.PPTVSeries; |
| | | import com.yeshi.buwan.pptv.entity.PPTVSeriesProgramMap; |
| | | import com.yeshi.buwan.pptv.entity.VideoPPTVMap; |
| | | import com.yeshi.buwan.service.inter.juhe.PPTVService; |
| | | import com.yeshi.buwan.service.inter.push.PushDeviceTokenService; |
| | | import com.yeshi.buwan.service.inter.system.SystemConfigService; |
| | | import com.yeshi.buwan.service.inter.video.VideoWatchHistoryService; |
| | | import com.yeshi.buwan.util.JsonUtil; |
| | | import com.yeshi.buwan.util.ThreadUtil; |
| | | import com.yeshi.buwan.util.VersionUtil; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | import com.yeshi.buwan.vo.video.PPTVVideoActivityInfoVO; |
| | |
| | | |
| | | @Resource |
| | | private VideoWatchHistoryService videoWatchHistoryService; |
| | | |
| | | @Resource |
| | | private SystemConfigService systemConfigService; |
| | | |
| | | |
| | | /** |
| | |
| | | if (pptvSeries == null) { |
| | | try { |
| | | pptvSeries = PPTVApiUtil.getDetail(cid); |
| | | ThreadUtil.run(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pptvService.syncSeries(cid); |
| | | } |
| | | }); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | |
| | | way.setType("vip"); |
| | | wayList.add(way); |
| | | |
| | | |
| | | //3.9.2后返回单片购买 |
| | | if (VersionUtil.isGraterThan392(acceptData.getPlatform(), acceptData.getVersion())) { |
| | | way = new PPTVWatchVIPVideoActivityWay(); |
| | | way.setEndBgColor("#DCE8FF"); |
| | | way.setStartBgColor("#DCE8FF"); |
| | | String buyVideoUrl = systemConfigService.getConfigValueByKeyCache("buyVideoUrl"); |
| | | if (buyVideoUrl != null && pptvSeries != null && PPTVUtil.isVIPVideo(pptvSeries.getFree()) && PPTVUtil.getAvaiableStates().contains(pptvSeries.getStatus())) { |
| | | way = new PPTVWatchVIPVideoActivityWay(); |
| | | way.setEndBgColor("#DCE8FF"); |
| | | way.setStartBgColor("#DCE8FF"); |
| | | // way.setEndPrice(new BigDecimal("77.8")); |
| | | way.setIcon("http://img.ysdq.yeshitv.com/resource/icon_free_money.png"); |
| | | way.setStartPrice(new BigDecimal("0")); |
| | | way.setSubTitle("畅享海量高清"); |
| | | way.setTitle("0元看单片"); |
| | | way.setTextColor("#0052F6"); |
| | | way.setType("video"); |
| | | JumpDetail jumpDetail = new JumpDetail(); |
| | | jumpDetail.setType(JumpTypeEnum.web); |
| | | way.setJumpDetail(jumpDetail); |
| | | JSONObject params = new JSONObject(); |
| | | params.put("url", "http://192.168.3.122:8848/BuWanWeb/buyVideo/index.html?infoId=23099"); |
| | | way.setParams(params.toString().replace("\"","\\" + "\"")); |
| | | wayList.add(way); |
| | | way.setIcon("http://img.ysdq.yeshitv.com/resource/icon_free_money.png"); |
| | | way.setStartPrice(new BigDecimal("0")); |
| | | way.setSubTitle("畅享海量高清"); |
| | | way.setTitle("0元看单片"); |
| | | way.setTextColor("#0052F6"); |
| | | way.setType("video"); |
| | | JumpDetail jumpDetail = new JumpDetail(); |
| | | jumpDetail.setType(JumpTypeEnum.web); |
| | | way.setJumpDetail(jumpDetail); |
| | | JSONObject params = new JSONObject(); |
| | | params.put("url", buyVideoUrl.replace("{infoId}", pptvSeries.getInfoID())); |
| | | params.put("close", false); |
| | | way.setParams(params.toString().replace("\"", "\\" + "\"")); |
| | | wayList.add(way); |
| | | } |
| | | } |
| | | |
| | | vo.setWayList(wayList); |
| | |
| | | import com.yeshi.buwan.domain.vip.OrderRecord; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.io.Serializable; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Repository |
| | | public class OrderRecordDao extends BaseDao<OrderRecord> { |
| | | |
| | | class DaoQueryResult { |
| | | public String hql; |
| | | public Serializable[] params; |
| | | |
| | | private String getHql(DaoQuery daoQuery) { |
| | | public DaoQueryResult(String hql, Serializable[] params) { |
| | | this.hql = hql; |
| | | this.params = params; |
| | | } |
| | | } |
| | | |
| | | |
| | | private DaoQueryResult getHql(DaoQuery daoQuery) { |
| | | |
| | | String hql = "from OrderRecord r where 1=1"; |
| | | List<Serializable> params = new ArrayList<>(); |
| | | |
| | | if (daoQuery.state != null) { |
| | | hql += " and r.state=" + daoQuery.state; |
| | | hql += " and r.state=?"; |
| | | params.add(daoQuery.state); |
| | | } |
| | | |
| | | if (daoQuery.uid != null) { |
| | | hql += " and r.uid=" + daoQuery.uid; |
| | | hql += " and r.uid=?"; |
| | | params.add(daoQuery.uid); |
| | | } |
| | | |
| | | if (daoQuery.orderType != null) { |
| | | hql += " and r.orderType='" + daoQuery.orderType+"'"; |
| | | hql += " and r.orderType=?"; |
| | | params.add(daoQuery.orderType); |
| | | } |
| | | |
| | | if (daoQuery.minCreateTime != null) { |
| | | hql += " and r.createTime>=? "; |
| | | params.add(daoQuery.minCreateTime); |
| | | } |
| | | |
| | | |
| | | if (daoQuery.maxCreateTime != null) { |
| | | hql += " and r.createTime < ?"; |
| | | params.add(daoQuery.maxCreateTime); |
| | | } |
| | | |
| | | |
| | | hql += " order by r.createTime desc"; |
| | | return hql; |
| | | Serializable[] ps = new Serializable[params.size()]; |
| | | params.toArray(ps); |
| | | |
| | | return new DaoQueryResult(hql, ps); |
| | | } |
| | | |
| | | |
| | | public List<OrderRecord> list(DaoQuery daoQuery) { |
| | | return super.list(getHql(daoQuery), daoQuery.start, daoQuery.count, null); |
| | | DaoQueryResult queryResult = getHql(daoQuery); |
| | | return super.list(queryResult.hql, daoQuery.start, daoQuery.count, queryResult.params); |
| | | } |
| | | |
| | | |
| | | public long count(DaoQuery daoQuery) { |
| | | return super.getCount(getHql(daoQuery), null); |
| | | DaoQueryResult queryResult = getHql(daoQuery); |
| | | return super.getCount(queryResult.hql, queryResult.params); |
| | | } |
| | | |
| | | public static class DaoQuery { |
| | |
| | | public String uid; |
| | | public int start; |
| | | public int count; |
| | | public Date minCreateTime; |
| | | public Date maxCreateTime; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.job; |
| | | |
| | | import com.xxl.job.core.biz.model.ReturnT; |
| | | import com.xxl.job.core.handler.annotation.XxlJob; |
| | | import com.yeshi.buwan.domain.system.DetailSystem; |
| | | import com.yeshi.buwan.domain.system.DetailSystemConfig; |
| | | import com.yeshi.buwan.domain.vip.OrderRecord; |
| | | import com.yeshi.buwan.service.imp.DetailSystemConfigService; |
| | | import com.yeshi.buwan.service.imp.SystemService; |
| | | import com.yeshi.buwan.service.inter.order.OrderService; |
| | | import com.yeshi.buwan.util.EHCacheManager; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.stereotype.Component; |
| | | import org.yeshi.utils.AppMarketUtil; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | //10409568 |
| | | @Component |
| | | public class OrderJob { |
| | | @Resource |
| | | private OrderService orderService; |
| | | |
| | | |
| | | //打开华为应用市场的广告 |
| | | @XxlJob("order-cancel") |
| | | public ReturnT<String> cancelOrder(String params) throws Exception { |
| | | |
| | | if (!StringUtil.isNullOrEmpty(params)) { |
| | | orderService.cancelOrder(params, ""); |
| | | } else { |
| | | List<OrderRecord> orderRecords = orderService.getCanCancelOrderList(1, 100); |
| | | if (orderRecords != null) |
| | | for (OrderRecord record : orderRecords) { |
| | | orderService.cancelOrder(record.getId(),"超时未付款,系统自动取消"); |
| | | } |
| | | } |
| | | |
| | | |
| | | return ReturnT.SUCCESS; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | public static boolean buyGoods(String openId, String orderNo, String goodsNo, Date orderTime) { |
| | | if (1 > 0) { |
| | | return false; |
| | | } |
| | | Map<String, String> params = new HashMap<>(); |
| | | params.put("openId", openId); |
| | | params.put("canal", CHANNEL_ID); |
| | |
| | | import com.yeshi.buwan.util.video.VideoConstant; |
| | | import com.yeshi.buwan.vo.AcceptData; |
| | | |
| | | import java.util.HashSet; |
| | | import java.util.Set; |
| | | |
| | | public class PPTVUtil { |
| | | |
| | | public final static int RESOURCE_ID = 25; |
| | |
| | | public long time; |
| | | } |
| | | |
| | | public static Set<String> getAvaiableStates() { |
| | | Set<String> stateSets = new HashSet<>(); |
| | | stateSets.add("add"); |
| | | stateSets.add("update"); |
| | | return stateSets; |
| | | } |
| | | |
| | | public static boolean isVIPVideo(String free) { |
| | | return "1".equalsIgnoreCase((free + "").trim()); |
| | | } |
| | | |
| | | } |
| | |
| | | list.add(dateData); |
| | | } |
| | | int dayCount = 0; |
| | | Map<String, Integer> dayCountMap = new HashMap<>(); |
| | | //填充用户数据 |
| | | if (!StringUtil.isNullOrEmpty(uid)) { |
| | | try { |
| | | List<GoldCornRecord> recordList = goldCornManager.getRecordList(query, uid); |
| | | Map<Integer, Integer> dayCountMap = getContinueSignDayCountMap(recordList); |
| | | dayCountMap = getContinueSignDayCountMap(recordList); |
| | | dayCount = dayCountMap.size() == 6 ? 6 : dayCountMap.size() % 6; |
| | | |
| | | //设置金币与选中 |
| | | for (int i = 0; i < dayCount; i++) { |
| | | list.get(i).setGoldCorn("+" + dayCountMap.get(dayCount - i - 1)); |
| | | list.get(i).setSelected(true); |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | |
| | | for (int i = 0; i < list.size(); i++) { |
| | | list.get(i).setDate(TimeUtil.getGernalTime(now - (dayCount - i - (isTodaySigned ? 1 : 0)) * 1000 * 60 * 60 * 24L, "M.d")); |
| | | |
| | | //设置金币与选中 |
| | | if (dayCountMap.get(list.get(i).getDate()) != null) { |
| | | list.get(i).setGoldCorn("+" + dayCountMap.get(list.get(i).getDate())); |
| | | list.get(i).setSelected(true); |
| | | } |
| | | |
| | | if (i == dayCount - (isTodaySigned ? 1 : 0)) { |
| | | list.get(i).setDate("今天"); |
| | | } |
| | | |
| | | } |
| | | |
| | | return list; |
| | |
| | | } |
| | | |
| | | |
| | | private Map<Integer, Integer> getContinueSignDayCountMap(List<GoldCornRecord> recordList) { |
| | | Map<Integer, Integer> map = new TreeMap<>(); |
| | | int position = 0; |
| | | private Map<String, Integer> getContinueSignDayCountMap(List<GoldCornRecord> recordList) { |
| | | Map<String, Integer> map = new TreeMap<>(); |
| | | long lastTime = TimeUtil.convertGernalTime(TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd"), "yyyy-MM-dd"); |
| | | if (recordList != null) |
| | | for (int i = 0; i < recordList.size(); i++) { |
| | | String day = TimeUtil.getGernalTime(recordList.get(i).getCreateTime().getTime(), "M.d"); |
| | | long time = TimeUtil.convertGernalTime(TimeUtil.getGernalTime(recordList.get(i).getCreateTime().getTime(), "yyyy-MM-dd"), "yyyy-MM-dd"); |
| | | if (lastTime - time == 1000 * 60 * 60 * 24L) { |
| | | position++; |
| | | lastTime = time; |
| | | map.put(position, recordList.get(i).getGoldCorn()); |
| | | map.put(day, recordList.get(i).getGoldCorn()); |
| | | } else if (lastTime - time < 1000 * 60 * 60 * 24L) { |
| | | map.put(position, recordList.get(i).getGoldCorn()); |
| | | map.put(day, recordList.get(i).getGoldCorn()); |
| | | continue; |
| | | } else { |
| | | break; |
| | |
| | | import com.yeshi.buwan.domain.VideoType; |
| | | import com.yeshi.buwan.domain.video.AlbumVideoMap; |
| | | import com.yeshi.buwan.dto.mq.PPTVMQMsg; |
| | | import com.yeshi.buwan.pptv.PPTVApiUtil; |
| | | import com.yeshi.buwan.pptv.PPTVQuery; |
| | | import com.yeshi.buwan.pptv.PPTVUtil; |
| | | import com.yeshi.buwan.pptv.entity.PPTVProgram; |
| | | import com.yeshi.buwan.pptv.entity.PPTVSeries; |
| | | import com.yeshi.buwan.pptv.entity.PPTVSeriesProgramMap; |
| | | import com.yeshi.buwan.pptv.entity.VideoPPTVMap; |
| | | import com.yeshi.buwan.pptv.entity.*; |
| | | import com.yeshi.buwan.service.imp.CategoryVideoService; |
| | | import com.yeshi.buwan.service.imp.ResourceVideoService; |
| | | import com.yeshi.buwan.service.imp.VideoInfoService; |
| | |
| | | import com.yeshi.buwan.util.mq.CMQManager; |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.data.mongodb.core.query.Update; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | |
| | | return pptvSeriesDao.get(infoId); |
| | | } |
| | | |
| | | @Override |
| | | public void updateSeriesGoodsInfo(String infoId, PPTVGoodsInfo goodsInfo) { |
| | | Query query = new Query(); |
| | | query.addCriteria(Criteria.where("_id").is(infoId)); |
| | | Update update = new Update(); |
| | | update.set("goodsInfo", goodsInfo); |
| | | pptvSeriesDao.update(query, update); |
| | | } |
| | | |
| | | @Override |
| | | public void syncSeries(String cid) { |
| | | PPTVSeries series = PPTVApiUtil.getDetail(cid); |
| | | if (series != null) { |
| | | save(series); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 删除剧集 |
| | | * |
| | |
| | | try { |
| | | goldCornManager.drawbackGoldCorn(record); |
| | | } catch (Exception e) { |
| | | throw new GoldCornException(1, "影视豆退款成功"); |
| | | throw new GoldCornException(1, "影视豆退款失败"); |
| | | } |
| | | } |
| | | |
| | |
| | | record.setState(OrderRecord.STATE_CANCEL); |
| | | record.setUpdateTime(new Date()); |
| | | record.setRemarks(reason); |
| | | vipOrderRecordDao.update(record); |
| | | session.update(record); |
| | | orderLogger.info("取消订单成功:id-{}", id); |
| | | } |
| | | |
| | | @Override |
| | | public List<OrderRecord> getCanCancelOrderList(int page, int pageSize) { |
| | | |
| | | OrderRecordDao.DaoQuery daoQuery = new OrderRecordDao.DaoQuery(); |
| | | daoQuery.state = OrderRecord.STATE_NOT_PAY; |
| | | //30分钟未支付取消订单 |
| | | daoQuery.maxCreateTime = new Date(System.currentTimeMillis() - 1000 * 60 * 30); |
| | | daoQuery.minCreateTime = new Date(daoQuery.maxCreateTime.getTime() - 1000 * 60 * 60L * 24); |
| | | |
| | | return vipOrderRecordDao.list(daoQuery); |
| | | } |
| | | |
| | | |
| | |
| | | return record; |
| | | |
| | | switch (record.getPayWay()) { |
| | | case OrderRecord.PAY_WAY_ALIPAY_GOLDCORN: |
| | | case OrderRecord.PAY_WAY_ALIPAY: { |
| | | //支付宝 |
| | | AlipayTradeQueryResponse res = null; |
| | |
| | | } |
| | | |
| | | break; |
| | | case OrderRecord.PAY_WAY_WX_GOLDCORN: |
| | | case OrderRecord.PAY_WAY_WX: { |
| | | //微信 |
| | | try { |
| | |
| | | UserVIPInfo vip = new UserVIPInfo(); |
| | | vip.setUid(uid); |
| | | vip.setCreateTime(new Date()); |
| | | vip.setExpireDate(getExpireTime(payTime, null, type)); |
| | | |
| | | Date[] expireDate = getExpireTime(payTime, null, type); |
| | | vip.setExpireDate(expireDate[1]); |
| | | session.save(vip); |
| | | return new Date[]{payTime, vip.getExpireDate()}; |
| | | return expireDate; |
| | | } else { |
| | | //修改 |
| | | UserVIPInfo vipInfo = (UserVIPInfo) list.get(0); |
| | | Date expireDate = getExpireTime(payTime, vipInfo.getExpireDate(), type); |
| | | session.createQuery("update UserVIPInfo i set i.expireDate=? ,i.updateTime=? where i.uid=?").setParameter(0, expireDate).setParameter(1, new Date()).setParameter(2, uid).executeUpdate(); |
| | | Date[] expireDate = getExpireTime(payTime, vipInfo.getExpireDate(), type); |
| | | session.createQuery("update UserVIPInfo i set i.expireDate=? ,i.updateTime=? where i.uid=?").setParameter(0, expireDate[1]).setParameter(1, new Date()).setParameter(2, uid).executeUpdate(); |
| | | |
| | | return new Date[]{vipInfo.getExpireDate() == null ? new Date() : vipInfo.getExpireDate(), expireDate}; |
| | | return expireDate; |
| | | } |
| | | } |
| | | |
| | |
| | | * @param type |
| | | * @return |
| | | */ |
| | | private Date getExpireTime(Date payTime, Date expireTime, VIPPriceType type) { |
| | | private Date[] getExpireTime(Date payTime, Date expireTime, VIPPriceType type) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | if (expireTime != null) { |
| | | calendar.setTimeInMillis(expireTime.getTime()); |
| | | //之前续期时间是否大于付款时间 |
| | | if (payTime.getTime() < expireTime.getTime()) |
| | | calendar.setTimeInMillis(expireTime.getTime()); |
| | | else |
| | | calendar.setTimeInMillis(payTime.getTime()); |
| | | } else { |
| | | calendar.setTimeInMillis(payTime.getTime()); |
| | | } |
| | | long startTime = calendar.getTimeInMillis(); |
| | | if (type == VIPPriceType.day) { |
| | | calendar.add(Calendar.DAY_OF_WEEK, 1); |
| | | } else if (type == VIPPriceType.week) { |
| | |
| | | } else if (type == VIPPriceType.year) { |
| | | calendar.add(Calendar.YEAR, 1); |
| | | } |
| | | return new Date(calendar.getTimeInMillis()); |
| | | return new Date[]{new Date(startTime), new Date(calendar.getTimeInMillis())}; |
| | | } |
| | | |
| | | |
| | |
| | | package com.yeshi.buwan.service.inter.juhe; |
| | | |
| | | import com.yeshi.buwan.pptv.entity.PPTVProgram; |
| | | import com.yeshi.buwan.pptv.entity.PPTVSeries; |
| | | import com.yeshi.buwan.pptv.entity.PPTVSeriesProgramMap; |
| | | import com.yeshi.buwan.pptv.entity.VideoPPTVMap; |
| | | import com.yeshi.buwan.pptv.entity.*; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | |
| | | public PPTVSeries selectSeriesByInfoId(String infoId); |
| | | |
| | | public void updateSeriesGoodsInfo(String infoId, PPTVGoodsInfo goodsInfo); |
| | | |
| | | /** |
| | | * 同步专辑 |
| | | * |
| | | * @param cid |
| | | */ |
| | | public void syncSeries(String cid); |
| | | |
| | | } |
| | |
| | | public void cancelOrder(String id, String reason) throws OrderException, GoldCornException; |
| | | |
| | | |
| | | /** |
| | | * 获取可以取消的订单记录 |
| | | * |
| | | * @param page |
| | | * @param pageSize |
| | | * @return |
| | | */ |
| | | public List<OrderRecord> getCanCancelOrderList(int page, int pageSize); |
| | | |
| | | |
| | | } |
| | |
| | | return goldCornRecordService.countUserRecordBySource(query); |
| | | } |
| | | |
| | | /** |
| | | * 获取下一次可以做任务的时间 |
| | | * |
| | | * @param source |
| | | * @param uid |
| | | * @return |
| | | */ |
| | | public long getNextDoTaskTime(CodeCornGetSourceType source, String uid) { |
| | | if (StringUtil.isNullOrEmpty(uid)) { |
| | | return -1; |
| | | } |
| | | try { |
| | | return goldCornTradeService.getNextDoTaskTime(getAppCode(), getUid(uid), source.name()); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | return -1; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | public class GoldCornRecordVO { |
| | | private String title; |
| | | private String desc; |
| | | private String date; |
| | | private int goldCorn; |
| | | |
| | | public GoldCornRecordVO(String title, String date, int goldCorn) { |
| | | public GoldCornRecordVO(String title,String desc, String date, int goldCorn) { |
| | | this.title = title; |
| | | this.date = date; |
| | | this.desc=desc; |
| | | this.goldCorn = goldCorn; |
| | | } |
| | | |
| | |
| | | public void setGoldCorn(int goldCorn) { |
| | | this.goldCorn = goldCorn; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | |
| | | public void setDesc(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | } |
| | |
| | | |
| | | public class GoldCornTaskVO { |
| | | |
| | | private String sourceCode; |
| | | private String icon; |
| | | private String title; |
| | | private String goldCorn; |
| | |
| | | private String params; |
| | | private boolean enable; |
| | | |
| | | |
| | | public String getSourceCode() { |
| | | return sourceCode; |
| | | } |
| | | |
| | | public void setSourceCode(String sourceCode) { |
| | | this.sourceCode = sourceCode; |
| | | } |
| | | |
| | | public String getIcon() { |
| | | return icon; |
| | |
| | | vo.setEnable(true); |
| | | vo.setIcon(source.getIcon()); |
| | | vo.setTitle(source.getSourceName()); |
| | | vo.setGoldCorn("+" + source.getGoldCorn() ); |
| | | vo.setGoldCorn("+" + source.getGoldCorn()); |
| | | vo.setSourceCode(source.getSourceCode()); |
| | | return vo; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.buwan.vo.order; |
| | | |
| | | import com.yeshi.buwan.domain.vip.OrderRecord; |
| | | import com.yeshi.buwan.domain.vip.OrderType; |
| | | import com.yeshi.buwan.util.StringUtil; |
| | | import com.yeshi.buwan.util.TimeUtil; |
| | | |
| | | public class OrderInfoVO { |
| | | private String title; |
| | | private String orderNo; |
| | | private String date; |
| | | private String startTime; |
| | | private String endTime; |
| | | private String payWay; |
| | | private int state; |
| | | |
| | | public String getTitle() { |
| | | return title; |
| | | } |
| | | |
| | | public void setTitle(String title) { |
| | | this.title = title; |
| | | } |
| | | |
| | | public String getOrderNo() { |
| | | return orderNo; |
| | | } |
| | | |
| | | public void setOrderNo(String orderNo) { |
| | | this.orderNo = orderNo; |
| | | } |
| | | |
| | | public String getDate() { |
| | | return date; |
| | | } |
| | | |
| | | public void setDate(String date) { |
| | | this.date = date; |
| | | } |
| | | |
| | | public String getStartTime() { |
| | | return startTime; |
| | | } |
| | | |
| | | public void setStartTime(String startTime) { |
| | | this.startTime = startTime; |
| | | } |
| | | |
| | | public String getEndTime() { |
| | | return endTime; |
| | | } |
| | | |
| | | public void setEndTime(String endTime) { |
| | | this.endTime = endTime; |
| | | } |
| | | |
| | | public String getPayWay() { |
| | | return payWay; |
| | | } |
| | | |
| | | public void setPayWay(String payWay) { |
| | | this.payWay = payWay; |
| | | } |
| | | |
| | | public int getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(int state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public static OrderInfoVO create(OrderRecord record) { |
| | | OrderInfoVO vo = new OrderInfoVO(); |
| | | if (record.getOrderType() == OrderType.vip) { |
| | | vo.setTitle(record.getType().getName() + "VIP/会员"); |
| | | } else if (record.getOrderType() == OrderType.video) { |
| | | vo.setTitle(StringUtil.isNullOrEmpty(record.getRemarks()) ? "单片购买" : record.getRemarks()); |
| | | } |
| | | vo.setDate(TimeUtil.getGernalTime(record.getCreateTime().getTime(), "yyyy.MM.dd HH:mm")); |
| | | |
| | | if (record.getVipStartTime() != null) |
| | | vo.setStartTime(TimeUtil.getGernalTime(record.getVipStartTime().getTime(), "yyyy.MM.dd HH:mm")); |
| | | |
| | | if (record.getVipEndTime() != null) |
| | | vo.setEndTime(TimeUtil.getGernalTime(record.getVipEndTime().getTime(), "yyyy.MM.dd HH:mm")); |
| | | vo.setOrderNo(record.getId()); |
| | | String payWay = ""; |
| | | switch (record.getPayWay()) { |
| | | case OrderRecord.PAY_WAY_ALIPAY: |
| | | payWay = "支付宝"; |
| | | break; |
| | | case OrderRecord.PAY_WAY_GOLDCORN: |
| | | payWay = "影视豆"; |
| | | break; |
| | | case OrderRecord.PAY_WAY_WX: |
| | | payWay = "微信"; |
| | | break; |
| | | case OrderRecord.PAY_WAY_ALIPAY_GOLDCORN: |
| | | payWay = "影视豆+支付宝"; |
| | | break; |
| | | case OrderRecord.PAY_WAY_WX_GOLDCORN: |
| | | payWay = "影视豆+微信"; |
| | | break; |
| | | } |
| | | if (record.getState() == OrderRecord.STATE_PAY) { |
| | | vo.setPayWay(payWay); |
| | | } |
| | | vo.setState(record.getState()); |
| | | return vo; |
| | | } |
| | | } |
| | |
| | | |
| | | systemConfig = new SystemConfig(); |
| | | systemConfig.setBeizhu(""); |
| | | systemConfig.setKey("goldCornRecordUrl"); |
| | | systemConfig.setName("影视豆记录链接"); |
| | | systemConfig.setKey("buyVideoUrl"); |
| | | systemConfig.setName("单片购买链接"); |
| | | try { |
| | | systemConfig.setValue("http://www.baidu.com"); |
| | | systemConfig.setValue("http://vip.ysdq.yeshitv.com/buyVideo/index.html?infoId={infoId}"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | systemConfigDao.save(systemConfig); |
| | | |
| | | |
| | | systemConfig = new SystemConfig(); |
| | | systemConfig.setBeizhu(""); |
| | | systemConfig.setKey("goldCornRuleUrl"); |
| | | systemConfig.setName("影视豆规则"); |
| | | try { |
| | | systemConfig.setValue("http://www.baidu.com"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | systemConfig.setCreateTime(new Date()); |
| | | systemConfig.setId(SystemConfig.createId(systemConfig.getKey())); |
| | | systemConfigDao.save(systemConfig); |
| | | // systemConfig = new SystemConfig(); |
| | | // systemConfig.setBeizhu(""); |
| | | // systemConfig.setKey("goldCornRuleUrl"); |
| | | // systemConfig.setName("影视豆规则"); |
| | | // try { |
| | | // systemConfig.setValue("http://www.baidu.com"); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // systemConfig.setCreateTime(new Date()); |
| | | // systemConfig.setId(SystemConfig.createId(systemConfig.getKey())); |
| | | // systemConfigDao.save(systemConfig); |
| | | } |
| | | |
| | | |
| | |
| | | public class DES { |
| | | @org.junit.Test |
| | | public void test1() { |
| | | System.out.println(DESUtil.decode("iDp+mknN2urZPWPAdmBTv1ME3YqW7QwsSCYUvdbVvCk9RuiKlNn9TL++vg+NvaY8mKotwHJC8B1n1VT5pQhIGVpKpygo9rSMhYxx2I6BE0LbwEPUqILxTfekT1P4UUwWYN1JO7JrA6ItKUu0VfLQTmgD6g8fNMg9VdBps80TGb2yAwAUVfeZJ4IxcjxLya/MGuCxfklROB8Os4HMpf5uLh6Ml/992uNsQgWOaJLQQ1kfg27dgbVqLSzJ1YUXoJNI+fo+oRlNMb52RjTXjNJ+F2p8RMt3AQNnXDcpmnDpeOtsL96DmIjWmoKrxk+NULi/FOF2bHSTab4=")); |
| | | System.out.println(DESUtil.decode("iDp+mknN2uptRUo51EW28wcdP2q0yp6iJqknxtZcx/k=")); |
| | | } |
| | | } |
| | |
| | | import com.yeshi.buwan.domain.vip.VIPPriceType; |
| | | import com.yeshi.buwan.exception.order.OrderException; |
| | | import com.yeshi.buwan.exception.vip.VIPException; |
| | | import com.yeshi.buwan.job.OrderJob; |
| | | import com.yeshi.buwan.pptv.PPTVVipManager; |
| | | import com.yeshi.buwan.service.inter.order.OrderService; |
| | | import com.yeshi.buwan.service.inter.vip.VIPPriceService; |
| | |
| | | |
| | | @Resource |
| | | private PPTVVipManager pptvVipManager; |
| | | |
| | | @Resource |
| | | private OrderJob orderJob; |
| | | |
| | | @Test |
| | | public void addVIPPrice() { |
| | |
| | | pptvVipManager.buyVIP(record); |
| | | } |
| | | |
| | | @Test |
| | | public void cancelOrder(){ |
| | | try { |
| | | orderJob.cancelOrder("1000140"); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | |