| | |
| | | private ThreeSaleDetailService threeSaleDetailService; |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void save(Long createUid, Long preUid, PreviewEnum type, String content) { |
| | | String id = StringUtil.Md5(createUid + "#" + type.name()); |
| | | |
| | | PreviewInfo info = new PreviewInfo(); |
| | | info.setId(id); |
| | | info.setUid(preUid); |
| | |
| | | info.setUpdateTime(new Date()); |
| | | previewInfoDao.save(info); |
| | | |
| | | // 缓存10分钟 |
| | | String key = StringUtil.Md5("preview" + preUid + "#" + type.name()); |
| | | redisManager.cacheCommonString(key, info.getContent(), 60 * 10); |
| | | if (type == PreviewEnum.extractRecord) { |
| | | return; |
| | | } |
| | | |
| | | if (StringUtil.isNullOrEmpty(content)) { |
| | | removePreview(preUid, type); |
| | | } else { |
| | | adddPreview(preUid, type, content); |
| | | } |
| | | |
| | | } |
| | | |
| | | // 缓存10分钟 |
| | | private void adddPreview(Long uid, PreviewEnum type, String content) { |
| | | String key = StringUtil.Md5("preview" + uid + "#" + type.name()); |
| | | redisManager.cacheCommonString(key, content, 60 * 10); |
| | | } |
| | | |
| | | // 缓存10分钟 |
| | | private void removePreview(Long uid, PreviewEnum type) { |
| | | String key = StringUtil.Md5("preview" + uid + "#" + type.name()); |
| | | redisManager.removeCommonString(key); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public String getRedisContent(Long uid, PreviewEnum previewEnum) { |
| | |
| | | BindingAccount alipay = bindingAccountService.getBindingAccountByUidAndType(uid, BindingAccount.TYPE_ALIPAY); |
| | | if (alipay == null) |
| | | throw new PreviewInfoException(1, "未绑定提现账号"); |
| | | if (money == null || money.compareTo(BigDecimal.ZERO) <= 0) |
| | | throw new PreviewInfoException(1, "请输入正确的金额"); |
| | | if (StringUtil.isNullOrEmpty(time)) |
| | | throw new PreviewInfoException(1, "提现时间不能为空"); |
| | | if (money.compareTo(BigDecimal.ZERO) <= 0) |
| | | throw new PreviewInfoException(1, "提现金额不能小于0"); |
| | | |
| | | Date parse = TimeUtil.parseDotCommon2(time); |
| | | if (parse == null) |
| | | throw new PreviewInfoException(1, "请输入正确的时间格式,如:2020.01.01 01:01"); |
| | | |
| | | |
| | | Gson gson = new Gson(); |
| | | List<Extract> list = null; |
| | | List<Extract> list = new ArrayList<Extract>(); |
| | | |
| | | Extract extract = new Extract(); |
| | | extract.setName(alipay.getName()); |
| | | extract.setAccount(alipay.getAccount()); |
| | | extract.setMoney(money); |
| | | extract.setReceiveTime(TimeUtil.parseDotCommon(time)); |
| | | extract.setReceiveTime(TimeUtil.parseDotCommon2(time)); |
| | | extract.setId(java.lang.System.currentTimeMillis()); |
| | | |
| | | String id = StringUtil.Md5(uid + "#" + PreviewEnum.extractRecord.name()); |
| | | PreviewInfo previewInfo = previewInfoDao.get(id); |
| | | if (previewInfo == null) { |
| | | list = new ArrayList<Extract>(); |
| | | list.add(extract); |
| | | } else { |
| | | String content = previewInfo.getContent(); |
| | |
| | | Comparator<Extract> cm = new Comparator<Extract>() { |
| | | @Override |
| | | public int compare(Extract o1, Extract o2) { |
| | | return (int) (o2.getReceiveTime().getTime() - o1.getReceiveTime().getTime()); |
| | | if (o2.getReceiveTime().getTime() > o1.getReceiveTime().getTime()) { |
| | | return 1; |
| | | } else { |
| | | return -1; |
| | | } |
| | | } |
| | | }; |
| | | Collections.sort(list, cm); |
| | | } |
| | | } |
| | | save(uid, uid, PreviewEnum.extractRecord, gson.toJson(list)); |
| | | } |
| | | |
| | | |
| | | |
| | | @Override |
| | | public void previewExtractRecord(Long uid) throws PreviewInfoException{ |
| | | String id = StringUtil.Md5(uid + "#" + PreviewEnum.extractRecord.name()); |
| | | PreviewInfo previewInfo = previewInfoDao.get(id); |
| | | if (previewInfo == null) { |
| | | throw new PreviewInfoException(1, "请添加提现记录信息"); |
| | | } |
| | | |
| | | String content = previewInfo.getContent(); |
| | | if (StringUtil.isNullOrEmpty(content)) { |
| | | throw new PreviewInfoException(1, "请添加提现记录信息"); |
| | | } |
| | | |
| | | adddPreview(uid, PreviewEnum.extractRecord, content); |
| | | } |
| | | |
| | | |
| | |
| | | break; |
| | | } |
| | | } |
| | | |
| | | save(uid, uid, PreviewEnum.extractRecord, gson.toJson(list)); |
| | | |
| | | // 取消预览 |
| | | removePreview(uid, PreviewEnum.extractRecord); |
| | | } |
| | | |
| | | |
| | |
| | | if (money == null ) |
| | | throw new PreviewInfoException(1, "请输入金额"); |
| | | if(StringUtil.isNullOrEmpty(time)) |
| | | throw new PreviewInfoException(1, "请输入创建时间"); |
| | | if(StringUtil.isNullOrEmpty(time)) |
| | | throw new PreviewInfoException(1, "请输入订单号"); |
| | | if(StringUtil.isNullOrEmpty(time)) |
| | | throw new PreviewInfoException(1, "请输入创建时间"); |
| | | Date parse = TimeUtil.parseDotCommon2(time); |
| | | if (parse == null) |
| | | throw new PreviewInfoException(1, "请输入正确的时间格式,如:2020.01.01 01:01"); |
| | | |
| | | |
| | | String content = ""; // TODO |
| | | // save(uid, PreviewEnum.moneyArrival, gson.toJson(infoVO)); |
| | | return content; |