| | |
| | | import com.yeshi.fanli.dto.push.PushContentDTO;
|
| | | import com.yeshi.fanli.entity.accept.AcceptData;
|
| | | import com.yeshi.fanli.entity.bus.user.Extract;
|
| | | import com.yeshi.fanli.entity.bus.user.PayInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.PreviewInfo;
|
| | | import com.yeshi.fanli.entity.bus.user.PreviewInfo.PreviewEnum;
|
| | | import com.yeshi.fanli.entity.bus.user.UserInfo;
|
| | |
| | | import com.yeshi.fanli.service.inter.order.CommonOrderService;
|
| | | import com.yeshi.fanli.service.inter.order.OrderMoneyDailyCountService;
|
| | | import com.yeshi.fanli.service.inter.push.PushService;
|
| | | import com.yeshi.fanli.service.inter.user.PayInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.PreviewInfoService;
|
| | | import com.yeshi.fanli.service.inter.user.UserInfoService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | |
| | |
|
| | | @Resource
|
| | | private RedisManager redisManager;
|
| | | |
| | |
|
| | | @Resource
|
| | | private HongBaoV2CountService hongBaoV2CountService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserMoneyDetailService userMoneyDetailService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private OrderMoneyDailyCountService orderMoneyDailyCountService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private CommonOrderService commonOrderService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private PushService pushService;
|
| | |
|
| | | |
| | | |
| | | @Resource
|
| | | private PayInfoService payInfoService;
|
| | |
|
| | | /**
|
| | | * 保存资金信息
|
| | | *
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | | @RequestMapping(value = "getMoneyInfo")
|
| | | public void getMoneyInfo(String callback, AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | MoneyStatisticVO dto = null;
|
| | |
| | | vo.setMonthPredict(cratePredictVO(orderMoneyDailyCountService.query(uid, minDate, maxDate)));
|
| | | return vo;
|
| | | }
|
| | | |
| | |
|
| | | private MoneyPredictVO cratePredictVO(List<OrderMoneyDailyCount> list) {
|
| | | MoneyPredictVO predictVO = new MoneyPredictVO();
|
| | | predictVO.setMineNum(0);
|
| | |
| | | predictVO.setTotalMoney(predictVO.getMineMoney().add(predictVO.getTeamMoney()));
|
| | | return predictVO;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 保存提现记录
|
| | | *
|
| | |
| | | }
|
| | | try {
|
| | | previewInfoService.saveExtractRecord(uid, dayTime, money);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
|
| | | } catch (PreviewInfoException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | }
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "getExtractRecord")
|
| | |
| | | PreviewInfo previewInfo = previewInfoService.get(uid, PreviewEnum.extractRecord);
|
| | | if (previewInfo != null && !StringUtil.isNullOrEmpty(previewInfo.getContent())) {
|
| | | Gson gson = new Gson();
|
| | | list = gson.fromJson(previewInfo.getContent(), new TypeToken<ArrayList<Extract>>() {}.getType());
|
| | | list = gson.fromJson(previewInfo.getContent(), new TypeToken<ArrayList<Extract>>() {
|
| | | }.getType());
|
| | | }
|
| | | |
| | |
|
| | | if (list == null)
|
| | | list = new ArrayList<>();
|
| | |
|
| | | JSONArray JSONArray = new JSONArray();
|
| | | |
| | | if (list.size() > 0) {
|
| | | for (Extract extract : list) {
|
| | | Date receiveTime = extract.getReceiveTime();
|
| | |
| | | JSONArray.add(object);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("count", JSONArray.size());
|
| | | json.put("list", JSONArray);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(json));
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 删除提现记录
|
| | | *
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 删除提现记录
|
| | | *
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "saveMineInfo")
|
| | | public void saveMineInfo(String callback, AcceptData acceptData, MineInfoVO infoVO, PrintWriter out) {
|
| | | public void saveMineInfo(String callback, AcceptData acceptData, MineInfoVO infoVO, PrintWriter out) {
|
| | | if (infoVO == null || infoVO.getUid() == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | |
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("保存失败"));
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | @RequestMapping(value = "getMineInfo")
|
| | | public void getMineInfo(String callback, AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | PreviewInfo previewInfo = previewInfoService.get(uid, PreviewEnum.mineInfo);
|
| | |
| | | if (previewInfo != null && !StringUtil.isNullOrEmpty(previewInfo.getContent())) {
|
| | | dto = new Gson().fromJson(previewInfo.getContent(), MineInfoVO.class);
|
| | | }
|
| | | |
| | |
|
| | | if (dto == null)
|
| | | dto = new MineInfoVO();
|
| | | dto = new MineInfoVO();
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(dto)));
|
| | | }
|
| | |
|
| | |
| | | */
|
| | | @RequestMapping(value = "saveMoneyArrival")
|
| | | public void saveMoneyArrival(String callback, AcceptData acceptData, Long uid, BigDecimal money, String dayTime,
|
| | | String orderNo, PrintWriter out) {
|
| | | if (uid == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | |
|
| | | PrintWriter out) {
|
| | | try {
|
| | | String link = previewInfoService.saveMoneyArrival(uid, money, dayTime, orderNo);
|
| | | // 查询最新一条支付宝订单号
|
| | | PayInfo payInfo = payInfoService.getNearInfo();
|
| | | String orderNo = getAlipayNo(payInfo.getOrderId());
|
| | | |
| | | String link = previewInfoService.saveMoneyArrival(uid, money, dayTime, orderNo, acceptData.getPlatform());
|
| | | JSONObject object = new JSONObject();
|
| | | object.put("link", link);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult(object));
|
| | | } catch (PreviewInfoException e) { |
| | | } catch (PreviewInfoException e) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult(e.getMsg()));
|
| | | } catch (Exception e) {
|
| | | LogHelper.errorDetailInfo(e);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("保存失败"));
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("预览失败"));
|
| | | }
|
| | | }
|
| | |
|
| | |
|
| | | private String getAlipayNo(String payNo) {
|
| | | // 替换前8位
|
| | | String newNo = payNo.substring(9, payNo.length());
|
| | | newNo = TimeUtil.getyyyyMMdd(java.lang.System.currentTimeMillis()) + newNo;
|
| | | // 随机生成替换后6位
|
| | | newNo = newNo.substring(0, payNo.length() - 6);
|
| | | newNo += (long) ((Math.random() * 9 + 1) * 100000);
|
| | | return newNo;
|
| | | }
|
| | | |
| | | @RequestMapping(value = "getMoneyArrivalImg")
|
| | | public void getMoneyArrivalImg(String callback, AcceptData acceptData, Long uid, PrintWriter out) {
|
| | | PreviewInfo previewInfo = previewInfoService.get(uid, PreviewEnum.moneyInfo);
|
| | |
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "saveOrderInfo")
|
| | | public void saveOrderInfo(String callback, AcceptData acceptData, Long uid, Integer type, Integer num, PrintWriter out) {
|
| | | public void saveOrderInfo(String callback, AcceptData acceptData, Long uid, Integer type, Integer num,
|
| | | PrintWriter out) {
|
| | | if (uid == null) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("用户未登录"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | if (type == null || type < 1 || type > 2) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请选择订单类型"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | if (num == null || num <= 0) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("请填写推送数量"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | if (num > 50) {
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadFalseResult("最多支持50条"));
|
| | | return;
|
| | | }
|
| | | |
| | |
|
| | | // 获取最新订单号
|
| | | String orderNo = commonOrderService.getNewestOrderNoByTaoBao();
|
| | | |
| | |
|
| | | // 随机订单号
|
| | | List<String> list = getRandomOrderNo(orderNo, num);
|
| | | for (String orderId: list) {
|
| | | PushContentDTO dto = PushMsgFactory.createFanLiOrderStatisticed(Constant.SOURCE_TYPE_TAOBAO, |
| | | orderId, BigDecimal.ZERO);
|
| | | // new Thread(new Runnable() {
|
| | | //
|
| | | // @Override
|
| | | // public void run() {
|
| | | for (String orderId : list) {
|
| | | PushContentDTO dto = PushMsgFactory.createInviteOrderStatisticed(Constant.SOURCE_TYPE_TAOBAO, orderId,
|
| | | BigDecimal.ZERO);
|
| | | try {
|
| | | pushService.pushZNX(uid, dto.getTitle(), dto.getContent(), null, null);
|
| | | } catch (NumberFormatException e) {
|
| | |
| | | } catch (PushException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | try {
|
| | | Thread.sleep(100);
|
| | | } catch (InterruptedException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | // }
|
| | | // }).start();
|
| | |
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("推送成功"));
|
| | | }
|
| | | |
| | | |
| | |
|
| | | private List<String> getRandomOrderNo(String orderNo, int count) {
|
| | | String newNo = orderNo.substring(0, 3);
|
| | | long lenth = orderNo.length() - 3;
|
| | |
| | | set.add(newNo + randomNum);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | // 转换list
|
| | | List<String> list = new ArrayList<>();
|
| | | for (String s : set) {
|
| | |
| | | }
|
| | | // 排序
|
| | | Collections.sort(list);
|
| | | |
| | |
|
| | | return list;
|
| | | }
|
| | | }
|