| | |
| | | import java.io.PrintWriter;
|
| | | import java.math.BigDecimal;
|
| | | import java.util.ArrayList;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.Set;
|
| | | import java.util.UUID;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.yeshi.fanli.dao.dynamic.DynamicInfoDao;
|
| | | import com.yeshi.fanli.dao.mybatis.help.HelpCenterMapper;
|
| | | import com.yeshi.fanli.dto.ConfigParamsDTO;
|
| | | import com.yeshi.fanli.dto.jd.JDSearchResult;
|
| | | import com.yeshi.fanli.entity.bus.activity.ActivityShareResult;
|
| | | import com.yeshi.fanli.entity.bus.activity.RecommendActivity;
|
| | | import com.yeshi.fanli.entity.dynamic.DynamicInfo;
|
| | | import com.yeshi.fanli.entity.dynamic.GoodsPicture;
|
| | | import com.yeshi.fanli.entity.dynamic.InviteMaterial;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | import com.yeshi.fanli.entity.taobao.SearchFilter;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra;
|
| | | import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
|
| | | import com.yeshi.fanli.exception.ActivityException;
|
| | | import com.yeshi.fanli.exception.push.PushException;
|
| | | import com.yeshi.fanli.exception.share.UserShareGoodsRecordException;
|
| | | import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
|
| | | import com.yeshi.fanli.log.LogHelper;
|
| | |
| | | import com.yeshi.fanli.service.inter.dynamic.DynamicInfoService;
|
| | | import com.yeshi.fanli.service.inter.dynamic.InviteMaterialService;
|
| | | import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.user.integral.IntegralGetService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.FileUtil;
|
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.db.MongoDBManager;
|
| | | import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
|
| | | import com.yeshi.fanli.util.jd.JDApiUtil;
|
| | | import com.yeshi.fanli.util.push.OPPOPushUtil;
|
| | | import com.yeshi.fanli.util.push.VIVOPushUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | | import com.yeshi.fanli.vo.goods.GoodsDetailVO;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | | import redis.clients.jedis.Jedis;
|
| | | import redis.clients.jedis.JedisPool;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("test")
|
| | |
| | | private ConfigService configService;
|
| | |
|
| | | @Resource
|
| | | private HongBaoManageService hongBaoManageService;
|
| | |
|
| | | @Resource
|
| | | private InviteMaterialService inviteMaterialService;
|
| | |
|
| | | @Resource
|
| | | private DynamicInfoDao dynamicInfoDao;
|
| | |
|
| | | @Resource
|
| | | private JedisPool jedisPool;
|
| | |
|
| | | @Resource
|
| | | private IntegralGetService integralGetService;
|
| | |
|
| | | @RequestMapping(value = "testimg")
|
| | | public void testImg(HttpServletRequest request, PrintWriter out) {
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 插入邀请素材
|
| | | * |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "getJingFenList")
|
| | | public void getJingFenList(String callback, Integer page, Integer eliteId, PrintWriter out) {
|
| | | try {
|
| | | JDSearchResult result = JDApiUtil.getJingFenGoods(page, eliteId);
|
| | | long count = 0;
|
| | | JSONObject data = new JSONObject();
|
| | | JSONArray array = new JSONArray();
|
| | | if (result != null) {
|
| | | PageEntity pageEntity = result.getPageEntity();
|
| | | if (pageEntity != null) {
|
| | | count = pageEntity.getTotalCount();
|
| | | }
|
| | |
|
| | | List<JDGoods> goodsList = result.getGoodsList();
|
| | | if (goodsList != null && goodsList.size() > 0) {
|
| | | BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
|
| | | BigDecimal shareRate = hongBaoManageService.getShareRate();
|
| | | ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE);
|
| | |
|
| | | Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
|
| | | .excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
|
| | | for (JDGoods goods : goodsList) {
|
| | | GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertJDGoods(goods, paramsDTO);
|
| | | array.add(gson.toJson(goodsDetailVO));
|
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | data.put("count", count);
|
| | | data.put("list", array);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(data));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("操作失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 插入邀请素材
|
| | | * |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "queryExistsId")
|
| | | public void queryExistsAuctionId(PrintWriter out) {
|
| | | try {
|
| | | List<DynamicInfo> list = dynamicInfoDao.queryExistsAuctionId();
|
| | | for (DynamicInfo dynamicInfo : list) {
|
| | | List<GoodsPicture> imgs = dynamicInfo.getImgs();
|
| | | if (imgs == null || imgs.size() == 0) {
|
| | | continue;
|
| | | }
|
| | |
|
| | | boolean update = false;
|
| | | for (GoodsPicture goodsPicture : imgs) {
|
| | | TaoBaoGoodsBriefExtra goods = goodsPicture.getGoods();
|
| | | if (goods == null) {
|
| | | continue;
|
| | | }
|
| | |
|
| | | if (goods.getAuctionId() == null) {
|
| | | update = true;
|
| | | goods.setAuctionId(goods.getId());
|
| | | }
|
| | | }
|
| | |
|
| | | if (update) {
|
| | | dynamicInfo.setImgs(imgs);
|
| | | dynamicInfoDao.updateGoodInfo(dynamicInfo);
|
| | | }
|
| | | }
|
| | | JsonUtil.printMode(out, null, JsonUtil.loadTrueResult("操作成功"));
|
| | | // JsonUtil.printMode(out, null,
|
| | | // JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(list)));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, null, JsonUtil.loadFalseResult("操作失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getWaitingThreadsCount")
|
| | | public void getWaitingThreadsCount(PrintWriter out) {
|
| | | out.print(Constant.waitingThreadSet.size());
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getBinFaRedisKey")
|
| | | public void getPinFaRedisKey(PrintWriter out) {
|
| | | JSONArray array = new JSONArray();
|
| | | Jedis jedis = jedisPool.getResource();
|
| | | try {
|
| | | Set<String> sets = jedis.keys("rs-*");
|
| | | for (Iterator<String> its = sets.iterator(); its.hasNext();)
|
| | | array.add(its.next());
|
| | | } finally {
|
| | | jedisPool.returnResource(jedis);
|
| | | }
|
| | | out.println(array.toString());
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "pushOppo")
|
| | | public void pushOppo(String registerId, PrintWriter out) {
|
| | | List<String> registerIds = new ArrayList<>();
|
| | | registerIds.add(registerId);
|
| | | try {
|
| | | OPPOPushUtil.pushUrl(registerIds, "测试网页推送", "测试网页推送内容", "http://www.baidu.com");
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | try {
|
| | | OPPOPushUtil.pushGoods(registerIds, "测试商品网页推送", "测试商品推送内容", 1, 577628549116L);
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | try {
|
| | | OPPOPushUtil.pushUserSignInNotification(registerIds, "测试签到推送", "测试签到推送");
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | try {
|
| | | OPPOPushUtil.pushWelfareCenter(registerIds, "测试福利中心推送", "测试福利中心推送");
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | try {
|
| | | OPPOPushUtil.pushZNX(registerIds, "测试站内信推送", "测试站内信推送");
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | out.print("success");
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "testListTLJGoods")
|
| | | public void getGoodsList(String callback, PrintWriter out) {
|
| | | SearchFilter sf = new SearchFilter();
|
| | | sf.setQuan(1);
|
| | | sf.setTmall(true);
|
| | | // sf.setEndPrice(new BigDecimal(1000));
|
| | | sf.setPage(1);
|
| | | sf.setPage(100);
|
| | | sf.setCateIds("16");
|
| | | sf.setSort(TaoBaoUtil.SORT_SALE_HIGH_TO_LOW);
|
| | |
|
| | | TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf);
|
| | | Gson gson = new Gson();
|
| | | JSONArray array = new JSONArray();
|
| | | for (TaoBaoGoodsBrief goods : result.getTaoBaoGoodsBriefs()) {
|
| | | array.add(gson.toJson(TaoBaoUtil.getTaoBaoGoodsBriefExtra(goods, "100", null)));
|
| | | }
|
| | | out.print(JsonUtil.loadJSONP(callback, JsonUtil.loadTrueResult(array)));
|
| | | }
|
| | |
|
| | | /**
|
| | | * 插入邀请素材
|
| | | * |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "addInviteOrderLevelOne")
|
| | | public void addInviteOrderLevelOne(PrintWriter out) {
|
| | | try {
|
| | | System.out.println("-------------请求---------------");
|
| | | integralGetService.addShareSingleGoods(974767L);
|
| | | JsonUtil.printMode(out, null, JsonUtil.loadTrueResult("操作成功"));
|
| | | } catch (Exception e) {
|
| | | JsonUtil.printMode(out, null, JsonUtil.loadFalseResult("操作失败"));
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @RequestMapping("pushVIVO")
|
| | | public void pushVIVO(PrintWriter out) {
|
| | | List<String> regList = new ArrayList<>();
|
| | | regList.add("15710270630271520610033");
|
| | | // regList.add("15711218630321520681531");
|
| | | // try {
|
| | | // VIVOPushUtil.pushUrl(regList, "标题", "网页内容", "http://www.baidu.com");
|
| | | // } catch (Exception e) {
|
| | | // }
|
| | |
|
| | | try {
|
| | | VIVOPushUtil.pushBaiChuanUrl(regList, "标题", "百川内容", "http://www.taobao.com");// 有bug
|
| | | // VIVOPushUtil.pushGoods(regList, "标题", "商品内容", 2, 100005625634L);
|
| | | // VIVOPushUtil.pushUserSignInNotification(regList, "标题", "签到");
|
| | | // VIVOPushUtil.pushWelfareCenter(regList,"标题", "福利中心");
|
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | @RequestMapping("getSchedulerList")
|
| | | public void getSchedulerList(PrintWriter out) {
|
| | | try {
|
| | | for (String groupName : scheduler.getJobGroupNames()) {
|
| | | System.out.println(groupName);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | }
|
| | | }
|
| | |
|
| | | }
|