| | |
| | | package com.yeshi.makemoney.app.aop; |
| | | |
| | | import com.yeshi.makemoney.app.entity.APPPlatform; |
| | | import com.yeshi.makemoney.app.entity.config.SystemConfigKey; |
| | | import com.yeshi.makemoney.app.service.inter.config.SystemConfigService; |
| | | import com.yeshi.makemoney.app.utils.ApiCodeConstant; |
| | |
| | | PrintWriter out = null; |
| | | ServletRequestAttributes servletContainer = (ServletRequestAttributes) RequestContextHolder |
| | | .getRequestAttributes(); |
| | | servletContainer.getResponse().setCharacterEncoding("UTF-8"); |
| | | |
| | | out = servletContainer.getResponse().getWriter(); |
| | | HttpServletRequest request = servletContainer.getRequest(); |
| | | |
| | | AcceptData acceptData = null; |
| | |
| | | } |
| | | |
| | | if (acceptData == null) { |
| | | out = servletContainer.getResponse().getWriter(); |
| | | out.print(JsonUtil.loadFalseResult(ApiCodeConstant.CODE_FAIL_SIGN_ERROR, "签名错误")); |
| | | return null; |
| | | } |
| | |
| | | if (isRight) { |
| | | // 判断签名超时 |
| | | if (Math.abs((acceptData.getTimestamp() - System.currentTimeMillis())) > 1000 * 60 * 10) { |
| | | out = servletContainer.getResponse().getWriter(); |
| | | out.print(JsonUtil.loadFalseResult(ApiCodeConstant.CODE_FAIL_OUT_TIME, "时间错误")); |
| | | return null; |
| | | } |
| | |
| | | |
| | | |
| | | } catch (Throwable e) { |
| | | e.printStackTrace(); |
| | | out = servletContainer.getResponse().getWriter(); |
| | | out.print(JsonUtil.loadFalseResult(ApiCodeConstant.CODE_ERROR_IN_SERVER, "服务器内部错误")); |
| | | return null; |
| | | } |
| | | return obj; |
| | | } else { |
| | | out = servletContainer.getResponse().getWriter(); |
| | | out.print(JsonUtil.loadFalseResult(ApiCodeConstant.CODE_FAIL_SIGN_ERROR, "签名错误")); |
| | | return null; |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.controller.client.api; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.ks.lib.common.exception.ParamsException; |
| | | import com.yeshi.makemoney.app.dto.money.ExtractConfig; |
| | | import com.yeshi.makemoney.app.entity.config.SystemConfigKey; |
| | | import com.yeshi.makemoney.app.entity.money.Extract; |
| | | import com.yeshi.makemoney.app.entity.money.ExtractPayType; |
| | | import com.yeshi.makemoney.app.entity.user.UserInfo; |
| | | import com.yeshi.makemoney.app.entity.user.WXUserInfo; |
| | | import com.yeshi.makemoney.app.exception.money.ExtractException; |
| | | import com.yeshi.makemoney.app.exception.money.UserExtractMoneyLimitException; |
| | | import com.yeshi.makemoney.app.exception.money.UserMoneyBalanceException; |
| | | import com.yeshi.makemoney.app.service.inter.config.SystemConfigService; |
| | | import com.yeshi.makemoney.app.service.inter.money.ExtractService; |
| | | import com.yeshi.makemoney.app.service.inter.money.UserExtractMoneyLimitService; |
| | | import com.yeshi.makemoney.app.service.inter.money.UserMoneyService; |
| | | import com.yeshi.makemoney.app.service.inter.user.WXUserInfoService; |
| | | import com.yeshi.makemoney.app.utils.ApiCodeConstant; |
| | | import com.yeshi.makemoney.app.utils.Constant; |
| | | import com.yeshi.makemoney.app.utils.annotation.UserLogin; |
| | | import com.yeshi.makemoney.app.vo.AcceptData; |
| | | import com.yeshi.makemoney.app.vo.user.ExtractDenominationVO; |
| | | import com.yeshi.makemoney.app.vo.user.ExtractInfoVO; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.yeshi.utils.BigDecimalUtil; |
| | | import org.yeshi.utils.IPUtil; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: ConfigController |
| | | * @description: 提现接口 |
| | | * @date 2021/11/16 17:37 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("api/v1/extract") |
| | | public class ExtractController { |
| | | @Resource |
| | | private UserMoneyService userMoneyService; |
| | | |
| | | @Resource |
| | | private WXUserInfoService wxUserInfoService; |
| | | |
| | | @Resource |
| | | private ExtractService extractService; |
| | | |
| | | @Resource |
| | | private UserExtractMoneyLimitService userExtractMoneyLimitService; |
| | | |
| | | private Gson gson = JsonUtil.getConvertBigDecimalToStringBuilder(new GsonBuilder()).create(); |
| | | |
| | | /** |
| | | * @return java.lang.String |
| | | * @author hxh |
| | | * @description 提现信息(包括余额,提现中的资金,是否绑定微信) |
| | | * @date 13:15 2021/12/2 |
| | | * @param: acceptData |
| | | **/ |
| | | @UserLogin(uid = "#uid") |
| | | @RequestMapping("getExtractInfo") |
| | | @ResponseBody |
| | | public String getExtractInfo(AcceptData acceptData, Long uid) { |
| | | ExtractInfoVO vo = new ExtractInfoVO(); |
| | | vo.setBalance(userMoneyService.getBalance(uid).setScale(2)); |
| | | BigDecimal extracting = extractService.getExtractingMoney(uid); |
| | | if (extracting.compareTo(new BigDecimal(0)) > 0) { |
| | | vo.setExtracting(extracting.setScale(2).toString()); |
| | | } |
| | | vo.setNeedBindWX(wxUserInfoService.selectByUid(uid) == null); |
| | | return JsonUtil.loadTrueResult(gson.toJson(vo)); |
| | | } |
| | | |
| | | /** |
| | | * @return java.lang.String |
| | | * @author hxh |
| | | * @description 获取提现面额 |
| | | * @date 17:46 2022/4/20 |
| | | * @param: acceptData |
| | | * @param: uid |
| | | **/ |
| | | @UserLogin(uid = "#uid") |
| | | @RequestMapping("getExtractDenominationList") |
| | | @ResponseBody |
| | | public String getExtractDenominationList(AcceptData acceptData, Long uid) { |
| | | ExtractConfig config = extractService.getExtractConfig(acceptData.getSystem()); |
| | | boolean isNewer = false; |
| | | long count = extractService.countByMaxMoney(uid, Constant.EXTRACT_LITTLE_MONEY_LIMIT, Arrays.asList(new Integer[]{Extract.STATE_NOT_PROCESS, Extract.STATE_PROCESSING, Extract.STATE_PASS}), null); |
| | | if (config.getNewerLittleMoneyNum() > count) { |
| | | //有新用户机会 |
| | | isNewer = true; |
| | | } |
| | | |
| | | List<ExtractDenominationVO> voList = new ArrayList<>(); |
| | | for (BigDecimal money : config.getExtractMoneyList()) { |
| | | ExtractDenominationVO vo = new ExtractDenominationVO(); |
| | | vo.setMoney(BigDecimalUtil.getWithNoZera(money)); |
| | | if (money.compareTo(Constant.EXTRACT_LITTLE_MONEY_LIMIT) < 0 && isNewer) { |
| | | vo.setTag("新用户福利"); |
| | | } |
| | | voList.add(vo); |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("list", gson.toJson(voList)); |
| | | return JsonUtil.loadTrueResult(data); |
| | | } |
| | | |
| | | @UserLogin(uid = "#uid") |
| | | @RequestMapping("extract") |
| | | @ResponseBody |
| | | public String extract(AcceptData acceptData, Long uid, BigDecimal money, HttpServletRequest request) { |
| | | WXUserInfo wxUserInfo = wxUserInfoService.selectByUid(uid); |
| | | if (wxUserInfo == null) { |
| | | return JsonUtil.loadFalseResult("尚未绑定微信"); |
| | | } |
| | | |
| | | Extract extract = new Extract(); |
| | | extract.setUser(new UserInfo(uid)); |
| | | extract.setIp(IPUtil.getRemotIP(request) + ":" + request.getRemotePort()); |
| | | extract.setMoney(money); |
| | | extract.setType(ExtractPayType.wx); |
| | | extract.setAccount(wxUserInfo.getOpenId()); |
| | | |
| | | try { |
| | | extractService.addExtract(extract); |
| | | } catch (ParamsException e) { |
| | | return JsonUtil.loadFalseResult(e.getMessage()); |
| | | } catch (ExtractException e) { |
| | | e.printStackTrace(); |
| | | if (e.getCode() == ExtractException.CODE_MONEY_LIMIT) { |
| | | return JsonUtil.loadFalseResult(e.getMessage()); |
| | | } else if (e.getCode() == ExtractException.CODE_LITTLE_MONEY_LIMIT) { |
| | | return JsonUtil.loadFalseResult(ApiCodeConstant.CODE_NEED_WATCH_REWARD_VIDEO, "小金额提现机会已使用完"); |
| | | } else { |
| | | return JsonUtil.loadFalseResult("未知错误,请稍后再试"); |
| | | } |
| | | } catch (UserMoneyBalanceException e) { |
| | | return JsonUtil.loadFalseResult("账户余额不足"); |
| | | } |
| | | |
| | | return JsonUtil.loadTrueResult(""); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @return java.lang.String |
| | | * @author hxh |
| | | * @description 增加小金额提现的次数限制 |
| | | * @date 18:26 2022/4/20 |
| | | * @param: acceptData |
| | | * @param: uid |
| | | **/ |
| | | @UserLogin(uid = "#uid") |
| | | @RequestMapping("addLittleMoneyExtractTimes") |
| | | @ResponseBody |
| | | public String addLittleMoneyExtractTimes(AcceptData acceptData, Long uid) { |
| | | try { |
| | | userExtractMoneyLimitService.addLittleMoneyLimit(uid, 1, new Date()); |
| | | } catch (UserExtractMoneyLimitException e) { |
| | | e.printStackTrace(); |
| | | return JsonUtil.loadFalseResult("增加次数出错"); |
| | | } |
| | | |
| | | return JsonUtil.loadTrueResult(""); |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.controller.client.api; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornConsumeRecord; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornConsumeType; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetRecord; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetFrequencyConfigException; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetPriceException; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornMakeException; |
| | | import com.yeshi.makemoney.app.exception.user.UserInfoException; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornConsumeRecordService; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornGetPriceService; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornGetRecordService; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornMakeService; |
| | | import com.yeshi.makemoney.app.service.inter.team.TeamInviteRelationService; |
| | | import com.yeshi.makemoney.app.service.query.goldcorn.GoldCornConsumeRecordQuery; |
| | | import com.yeshi.makemoney.app.service.query.goldcorn.GoldCornGetRecordQuery; |
| | | import com.yeshi.makemoney.app.utils.Constant; |
| | | import com.yeshi.makemoney.app.utils.annotation.UserLogin; |
| | | import com.yeshi.makemoney.app.utils.goldcorn.GoldCornUtil; |
| | | import com.yeshi.makemoney.app.vo.AcceptData; |
| | | import com.yeshi.makemoney.app.vo.goldcorn.*; |
| | | import net.sf.json.JSONArray; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.TimeUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.lang.reflect.Type; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: ConfigController |
| | | * @description: 金币接口 |
| | | * @date 2021/11/16 17:37 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("api/v1/goldcorn") |
| | | public class GoldCornController { |
| | | @Resource |
| | | private GoldCornGetRecordService goldCornGetRecordService; |
| | | |
| | | @Resource |
| | | private GoldCornConsumeRecordService goldCornConsumeRecordService; |
| | | |
| | | |
| | | @Resource |
| | | private GoldCornMakeService goldCornMakeService; |
| | | |
| | | @Resource |
| | | private GoldCornGetPriceService goldCornGetPriceService; |
| | | |
| | | @Resource |
| | | private TeamInviteRelationService teamInviteRelationService; |
| | | |
| | | private Gson gson = JsonUtil.getConvertBigDecimalToStringBuilder(new GsonBuilder()).create(); |
| | | |
| | | /** |
| | | * @return java.lang.String |
| | | * @author hxh |
| | | * @description 金币信息(包括当日金币余额,兑换中的金币) |
| | | * @date 13:15 2021/12/2 |
| | | * @param: acceptData |
| | | **/ |
| | | @UserLogin(uid = "#uid") |
| | | @RequestMapping("getGoldCornInfo") |
| | | @ResponseBody |
| | | public String getGoldCornInfo(AcceptData acceptData, Long uid) { |
| | | Date day = new Date(); |
| | | GoldCornInfoVO vo = new GoldCornInfoVO(); |
| | | vo.setBalance(Integer.parseInt(goldCornGetRecordService.getGoldCornByDay(uid, day) + "")); |
| | | vo.setExchanging(Integer.parseInt(goldCornMakeService.getExchangingGoldCorn(uid, 3) + "")); |
| | | return JsonUtil.loadTrueResult(gson.toJson(vo)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @return java.lang.String |
| | | * @author hxh |
| | | * @description 获得金币记录列表 |
| | | * @date 14:02 2022/4/21 |
| | | * @param: acceptData |
| | | * @param: uid |
| | | * @param: page |
| | | **/ |
| | | @UserLogin(uid = "#uid") |
| | | @RequestMapping("listGetRecord") |
| | | @ResponseBody |
| | | public String listGetRecord(AcceptData acceptData, Long uid, int page) { |
| | | |
| | | GoldCornGetRecordQuery query = new GoldCornGetRecordQuery(); |
| | | query.setUid(uid); |
| | | |
| | | List<GoldCornGetRecord> recordList = goldCornGetRecordService.list(query, page, Constant.PAGE_SIZE); |
| | | long count = goldCornGetRecordService.count(query); |
| | | |
| | | List<GoldCornGetRecordVO> voList = new ArrayList<>(); |
| | | for (GoldCornGetRecord record : recordList) { |
| | | GoldCornGetRecordVO vo = new GoldCornGetRecordVO(); |
| | | vo.setDateTime(TimeUtil.getGernalTime(record.getCreateTime().getTime(), "yyyy.MM.dd HH:mm")); |
| | | vo.setNum(record.getCornNum()); |
| | | if (record.getDubble() != null && record.getDubble()) { |
| | | vo.setTitle(record.getType().getName() + "(加倍)"); |
| | | } else { |
| | | vo.setTitle(record.getType().getName()); |
| | | } |
| | | voList.add(vo); |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("count", count); |
| | | data.put("list", gson.toJson(voList)); |
| | | return JsonUtil.loadTrueResult(data); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @return java.lang.String |
| | | * @author hxh |
| | | * @description 获取兑换记录 |
| | | * @date 14:02 2022/4/21 |
| | | * @param: acceptData |
| | | * @param: uid |
| | | * @param: page |
| | | **/ |
| | | @UserLogin(uid = "#uid") |
| | | @RequestMapping("listExchangeRecord") |
| | | @ResponseBody |
| | | public String listExchangeRecord(AcceptData acceptData, Long uid, int page) { |
| | | GoldCornConsumeRecordQuery query = new GoldCornConsumeRecordQuery(); |
| | | query.setUid(uid); |
| | | query.setType(GoldCornConsumeType.changeMoney); |
| | | |
| | | |
| | | List<GoldCornConsumeRecord> recordList = goldCornConsumeRecordService.list(query, page, Constant.PAGE_SIZE); |
| | | long count = goldCornConsumeRecordService.count(query); |
| | | |
| | | List<GoldCornExchangeRecordVO> voList = new ArrayList<>(); |
| | | for (GoldCornConsumeRecord record : recordList) { |
| | | GoldCornExchangeRecordVO vo = new GoldCornExchangeRecordVO(); |
| | | vo.setDateTime(TimeUtil.getGernalTime(record.getCreateTime().getTime(), "yyyy.MM.dd HH:mm")); |
| | | vo.setNum(record.getCornNum()); |
| | | vo.setMoney(record.getMoney().setScale(2).toString()); |
| | | voList.add(vo); |
| | | } |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("count", count); |
| | | data.put("list", gson.toJson(voList)); |
| | | return JsonUtil.loadTrueResult(data); |
| | | } |
| | | |
| | | /** |
| | | * @return java.lang.String |
| | | * @author hxh |
| | | * @description 获取任务的价格 |
| | | * @date 14:01 2022/4/21 |
| | | * @param: acceptData |
| | | * @param: uid |
| | | * @param: type |
| | | **/ |
| | | @RequestMapping("getTaskPrice") |
| | | @ResponseBody |
| | | public String getTaskPrice(AcceptData acceptData, Long uid, GoldCornGetType type) { |
| | | boolean hasBoss = false; |
| | | |
| | | if (uid != null) { |
| | | hasBoss = teamInviteRelationService.getBossUid(uid) != null; |
| | | } |
| | | Integer cornNum = goldCornGetPriceService.getPriceCornNum(acceptData.getSystem(), type, new Date(), hasBoss); |
| | | JSONObject data = new JSONObject(); |
| | | data.put("cornNum", cornNum); |
| | | return JsonUtil.loadTrueResult(data); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @return java.lang.String |
| | | * @author hxh |
| | | * @description 做任务 |
| | | * @date 14:02 2022/4/21 |
| | | * @param: acceptData |
| | | * @param: uid |
| | | * @param: taskData |
| | | **/ |
| | | @UserLogin(uid = "#uid") |
| | | @RequestMapping("doTask") |
| | | @ResponseBody |
| | | public String doTask(AcceptData acceptData, Long uid, String taskData) { |
| | | Type type = new TypeToken<List<GoldCornDoTaskVO>>() { |
| | | }.getType(); |
| | | List<GoldCornDoTaskVO> list = null; |
| | | |
| | | try { |
| | | list = gson.fromJson(taskData, type); |
| | | } catch (Exception e) { |
| | | |
| | | } |
| | | if (list == null) { |
| | | return JsonUtil.loadFalseResult("数据为空"); |
| | | } |
| | | |
| | | for (GoldCornDoTaskVO vo : list) { |
| | | try { |
| | | goldCornMakeService.addGoldCorn(uid, vo.getType(), vo.getDouble() == null ? false : vo.getDouble(), new Date(vo.getFinishTime() == null ? System.currentTimeMillis() : vo.getFinishTime()), null); |
| | | } catch (UserInfoException e) { |
| | | e.printStackTrace(); |
| | | } catch (GoldCornGetPriceException e) { |
| | | e.printStackTrace(); |
| | | } catch (GoldCornGetFrequencyConfigException e) { |
| | | e.printStackTrace(); |
| | | } catch (GoldCornMakeException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return JsonUtil.loadTrueResult(""); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @return java.lang.String |
| | | * @author hxh |
| | | * @description 获取签到信息 |
| | | * @date 17:12 2022/4/21 |
| | | * @param: acceptData |
| | | * @param: uid |
| | | * @param: taskData |
| | | **/ |
| | | @RequestMapping("getSignInInfo") |
| | | @ResponseBody |
| | | public String getSignInInfo(AcceptData acceptData, Long uid) { |
| | | Date now = new Date(); |
| | | //设置默认值 |
| | | SignInInfoVO vo = new SignInInfoVO(); |
| | | vo.setContinueSignInDay(0); |
| | | vo.setNotify(true); |
| | | vo.setSignIned(false); |
| | | if (uid != null) { |
| | | vo.setSignIned(goldCornMakeService.isSignIn(uid, now)); |
| | | vo.setContinueSignInDay(goldCornMakeService.getContinueSignDay(uid)); |
| | | } |
| | | /*************签到日期列表开始**************/ |
| | | |
| | | //制造日期 |
| | | List<SignInInfoVO.SignInDayInfo> dayList = getDayList(now); |
| | | List<String> days = new ArrayList<>(); |
| | | for (SignInInfoVO.SignInDayInfo day : dayList) { |
| | | days.add(GoldCornUtil.getFormatDay(day.getDate())); |
| | | //查询是否已经签到 |
| | | if (day.isToday()) { |
| | | break; |
| | | } |
| | | } |
| | | //查询签到的得到的金币数 |
| | | List<GoldCornGetRecord> recordList = new ArrayList<>(); |
| | | if (uid != null) { |
| | | GoldCornGetRecordQuery query = new GoldCornGetRecordQuery(); |
| | | query.setDayList(days); |
| | | query.setUid(uid); |
| | | query.setType(GoldCornGetType.signIn); |
| | | recordList = goldCornGetRecordService.list(query, 1, days.size()); |
| | | } |
| | | |
| | | Map<String, GoldCornGetRecord> recordMap = recordList.stream().collect(Collectors.toMap(GoldCornGetRecord::getDay, record -> record, (key1, key2) -> key2)); |
| | | int dayDiff = 0; |
| | | for (SignInInfoVO.SignInDayInfo dayInfo : dayList) { |
| | | String day = GoldCornUtil.getFormatDay(dayInfo.getDate()); |
| | | //现在/过去的日期 |
| | | if (days.contains(day)) { |
| | | if (recordMap.get(day) != null) { |
| | | //已经签到 |
| | | dayInfo.setState(SignInInfoVO.SignInDayInfo.STATE_GOT); |
| | | dayInfo.setGoldCorn(recordMap.get(day).getCornNum()); |
| | | } else { |
| | | //尚未签到 |
| | | if (dayInfo.isToday()) { |
| | | //今天签到预计的金币 |
| | | dayInfo.setGoldCorn(goldCornGetPriceService.getSingInPrice(acceptData.getSystem(), vo.getContinueSignInDay() + 1)); |
| | | dayInfo.setState(SignInInfoVO.SignInDayInfo.STATE_NOT_GOT); |
| | | } else { |
| | | dayInfo.setState(SignInInfoVO.SignInDayInfo.STATE_MISS); |
| | | dayInfo.setGoldCorn(0); |
| | | } |
| | | } |
| | | } else { |
| | | dayDiff++; |
| | | //未来的时间 |
| | | dayInfo.setGoldCorn(goldCornGetPriceService.getSingInPrice(acceptData.getSystem(), vo.getContinueSignInDay() + 1 + dayDiff)); |
| | | dayInfo.setState(SignInInfoVO.SignInDayInfo.STATE_NOT_GOT); |
| | | } |
| | | //清除临时变量 |
| | | dayInfo.setDate(null); |
| | | } |
| | | vo.setDayList(dayList); |
| | | /*************签到日期列表结束**************/ |
| | | |
| | | |
| | | return JsonUtil.loadTrueResult(gson.toJson(vo)); |
| | | } |
| | | |
| | | private static List<SignInInfoVO.SignInDayInfo> getDayList(Date date) { |
| | | List<SignInInfoVO.SignInDayInfo> dayList = new ArrayList<>(); |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTimeInMillis(date.getTime()); |
| | | int day = calendar.get(Calendar.DAY_OF_WEEK); |
| | | if (day == 1) { |
| | | day += 7; |
| | | } |
| | | //星期几(1-7) |
| | | day = day - 1; |
| | | for (int i = 1; i <= 7; i++) { |
| | | Date dateTime = new Date(date.getTime() - (day - i) * 1000 * 60 * 60 * 24L); |
| | | SignInInfoVO.SignInDayInfo dayInfo = new SignInInfoVO.SignInDayInfo(); |
| | | dayInfo.setDay(getDayDesc(i, day, dateTime)); |
| | | dayInfo.setDate(dateTime); |
| | | dayInfo.setToday(day == i); |
| | | dayList.add(dayInfo); |
| | | } |
| | | return dayList; |
| | | } |
| | | |
| | | private static String getDayDesc(int day, int now, Date dayTime) { |
| | | if (now == day) { |
| | | return "今天"; |
| | | } |
| | | return TimeUtil.getGernalTime(dayTime.getTime(), "MM.dd"); |
| | | } |
| | | |
| | | |
| | | @UserLogin(uid = "#uid") |
| | | @RequestMapping("signIn") |
| | | @ResponseBody |
| | | public String signIn(AcceptData acceptData, Long uid) { |
| | | try { |
| | | GoldCornGetRecord record = goldCornMakeService.signIn(uid); |
| | | int count = goldCornMakeService.getContinueSignDay(uid); |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | data.put("goldCorn", record.getCornNum()); |
| | | data.put("continueDay", count); |
| | | return JsonUtil.loadTrueResult(data); |
| | | } catch (Exception e) { |
| | | return JsonUtil.loadFalseResult("签到出错"); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.controller.client.api; |
| | | |
| | | import com.yeshi.makemoney.app.entity.team.TeamInviteRelation; |
| | | import com.yeshi.makemoney.app.entity.team.UserSpreadImg; |
| | | import com.yeshi.makemoney.app.entity.user.UserInfo; |
| | | import com.yeshi.makemoney.app.exception.team.SpreadImgException; |
| | | import com.yeshi.makemoney.app.exception.team.TeamInviteRelationException; |
| | | import com.yeshi.makemoney.app.exception.team.UserSpreadImgException; |
| | | import com.yeshi.makemoney.app.exception.user.UserInfoException; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornGetRecordService; |
| | | import com.yeshi.makemoney.app.service.inter.team.TeamInviteRelationService; |
| | | import com.yeshi.makemoney.app.service.inter.team.UserSpreadImgService; |
| | | import com.yeshi.makemoney.app.service.inter.user.UserExtraInfoService; |
| | | import com.yeshi.makemoney.app.service.inter.user.UserInfoService; |
| | | import com.yeshi.makemoney.app.service.inter.user.WXUserInfoService; |
| | | import com.yeshi.makemoney.app.utils.Constant; |
| | | import com.yeshi.makemoney.app.utils.annotation.UserLogin; |
| | | import com.yeshi.makemoney.app.vo.AcceptData; |
| | | import com.yeshi.makemoney.app.vo.team.TeamInfoVO; |
| | | import com.yeshi.makemoney.app.vo.team.TeamMemberListVO; |
| | | import com.yeshi.makemoney.app.vo.user.UserInfoVO; |
| | | import net.sf.json.JSONObject; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.TimeUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: TeamController |
| | | * @description: 团队接口 |
| | | * @date 2021/11/16 17:37 |
| | | */ |
| | | @Controller |
| | | @RequestMapping("api/v1/team") |
| | | public class TeamController { |
| | | |
| | | @Resource |
| | | private UserInfoService userInfoService; |
| | | |
| | | @Resource |
| | | private UserExtraInfoService userExtraInfoService; |
| | | |
| | | @Resource |
| | | private TeamInviteRelationService teamInviteRelationService; |
| | | |
| | | @Resource |
| | | private GoldCornGetRecordService goldCornGetRecordService; |
| | | |
| | | @Resource |
| | | private UserSpreadImgService userSpreadImgService; |
| | | |
| | | |
| | | /** |
| | | * @return java.lang.String |
| | | * @author hxh |
| | | * @description 获取上级 |
| | | * @date 12:13 2022/4/20 |
| | | * @param: acceptData |
| | | * @param: uid |
| | | * @param: inviteCode |
| | | **/ |
| | | @UserLogin(uid = "#uid") |
| | | @ResponseBody |
| | | @RequestMapping("getUserByInviteCode") |
| | | public String getUserByInviteCode(AcceptData acceptData, Long uid, String inviteCode) { |
| | | |
| | | Long uID = userExtraInfoService.selectUidByInviteCode(inviteCode.toUpperCase()); |
| | | if (uID == null) { |
| | | return JsonUtil.loadFalseResult("用户不存在"); |
| | | } |
| | | |
| | | if (uID.longValue() == uid) { |
| | | return JsonUtil.loadFalseResult("不能输入自己的邀请码"); |
| | | } |
| | | |
| | | UserInfo user = userInfoService.getAvaiableUser(uID); |
| | | if (user == null || user.getSystem() != acceptData.getSystem()) { |
| | | return JsonUtil.loadFalseResult("用户不存在或被封禁"); |
| | | } |
| | | return JsonUtil.loadTrueResult(UserInfoVO.create(user)); |
| | | } |
| | | |
| | | /** |
| | | * @return java.lang.String |
| | | * @author hxh |
| | | * @description 加入团队 |
| | | * @date 12:13 2022/4/20 |
| | | * @param: acceptData |
| | | * @param: uid |
| | | * @param: bossUid |
| | | **/ |
| | | @UserLogin(uid = "#uid") |
| | | @ResponseBody |
| | | @RequestMapping("joinTeam") |
| | | public String joinTeam(AcceptData acceptData, Long uid, Long bossUid) { |
| | | |
| | | if (bossUid.longValue() == uid) { |
| | | return JsonUtil.loadFalseResult("不能加入自己的团队"); |
| | | } |
| | | |
| | | //是否已经有上级 |
| | | Long buid = teamInviteRelationService.getBossUid(uid); |
| | | if (buid != null) { |
| | | if (bossUid.longValue() != buid) { |
| | | return JsonUtil.loadFalseResult("已经加入别的团队"); |
| | | } |
| | | } |
| | | UserInfo bossUser = userInfoService.getAvaiableUser(bossUid); |
| | | if (bossUser == null || bossUser.getSystem() != acceptData.getSystem()) { |
| | | return JsonUtil.loadFalseResult("用户不存在或被封禁"); |
| | | } |
| | | //加入团队 |
| | | if (buid == null) { |
| | | TeamInviteRelation teamInviteRelation = new TeamInviteRelation(); |
| | | teamInviteRelation.setUid(bossUid); |
| | | teamInviteRelation.setTargetUid(uid); |
| | | try { |
| | | teamInviteRelationService.add(teamInviteRelation); |
| | | } catch (TeamInviteRelationException e) { |
| | | return JsonUtil.loadFalseResult("加入出错"); |
| | | } |
| | | } |
| | | |
| | | return JsonUtil.loadTrueResult(UserInfoVO.create(bossUser)); |
| | | } |
| | | |
| | | |
| | | @UserLogin(uid = "#uid") |
| | | @ResponseBody |
| | | @RequestMapping("getTeamInfo") |
| | | public String getTeamInfo(AcceptData acceptData, Long uid) { |
| | | TeamInfoVO vo = new TeamInfoVO(); |
| | | vo.setHasBoss(teamInviteRelationService.getBossUid(uid) != null); |
| | | long first = teamInviteRelationService.countFirstTeam(uid); |
| | | long second = teamInviteRelationService.countSecondTeam(uid); |
| | | vo.setFirstTeamCount((int) first); |
| | | vo.setSecondTeamCount((int) second); |
| | | return JsonUtil.loadTrueResult(vo); |
| | | } |
| | | |
| | | |
| | | @UserLogin(uid = "#uid") |
| | | @ResponseBody |
| | | @RequestMapping("getMyBossInfo") |
| | | public String getMyBossInfo(AcceptData acceptData, Long uid) { |
| | | |
| | | Long bossUid = teamInviteRelationService.getBossUid(uid); |
| | | if (bossUid == null) { |
| | | return JsonUtil.loadFalseResult("邀请人不存在"); |
| | | } |
| | | UserInfo user = userInfoService.get(bossUid); |
| | | if (user == null) { |
| | | return JsonUtil.loadFalseResult("邀请人不存在"); |
| | | } |
| | | |
| | | return JsonUtil.loadTrueResult(UserInfoVO.create(user)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @return java.lang.String |
| | | * @author hxh |
| | | * @description 获取我的队员列表 |
| | | * @date 15:12 2022/4/20 |
| | | * @param: acceptData |
| | | * @param: uid |
| | | * @param: first |
| | | **/ |
| | | @UserLogin(uid = "#uid") |
| | | @ResponseBody |
| | | @RequestMapping("getMyTeamList") |
| | | public String getMyTeamList(AcceptData acceptData, Long uid, boolean first, int page) { |
| | | String day = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd"); |
| | | long count = 0; |
| | | List<TeamInviteRelation> list = null; |
| | | if (first) { |
| | | list = teamInviteRelationService.getFirstTeamList(uid, page, Constant.PAGE_SIZE); |
| | | count = teamInviteRelationService.countFirstTeam(uid); |
| | | } else { |
| | | list = teamInviteRelationService.getSecondTeamList(uid, page, Constant.PAGE_SIZE); |
| | | count = teamInviteRelationService.countSecondTeam(uid); |
| | | } |
| | | |
| | | List<Long> uidList = new ArrayList<>(); |
| | | List<Long> bossUidList = new ArrayList<>(); |
| | | if (list != null) { |
| | | for (TeamInviteRelation relation : list) { |
| | | uidList.add(relation.getTargetUid()); |
| | | //不是自己直接邀请的用户 |
| | | if (!bossUidList.contains(relation.getUid()) && relation.getUid().longValue() != uid) { |
| | | bossUidList.add(relation.getUid()); |
| | | } |
| | | } |
| | | } |
| | | //查询个人信息 |
| | | |
| | | Set<Long> uids = new HashSet<>(); |
| | | uids.addAll(uidList); |
| | | uids.addAll(bossUidList); |
| | | List<UserInfo> userInfoList = userInfoService.list(uids); |
| | | Map<Long, UserInfo> userMap = new HashMap<>(); |
| | | for (UserInfo user : userInfoList) { |
| | | userMap.put(user.getId(), user); |
| | | } |
| | | |
| | | //查询赚取金币信息 |
| | | Map<Long, Integer> goldCornMap = goldCornGetRecordService.sumGoldCornByFromUids(uid, uidList, day); |
| | | |
| | | List<TeamMemberListVO> voList = new ArrayList<>(); |
| | | for (TeamInviteRelation relation : list) { |
| | | //组织数据 |
| | | TeamMemberListVO vo = new TeamMemberListVO(); |
| | | vo.setJoinTime(TimeUtil.getGernalTime(relation.getCreateTime().getTime(), "yyyy.MM.dd")); |
| | | if (uid.longValue() != relation.getUid()) { |
| | | vo.setTag(String.format("由\"%s\"邀请", userMap.get(relation.getUid()).getNickName())); |
| | | } |
| | | vo.setTodayGoldCorn(goldCornMap.get(relation.getTargetUid())); |
| | | vo.setUser(UserInfoVO.create(userMap.get(relation.getTargetUid()))); |
| | | voList.add(vo); |
| | | } |
| | | JSONObject data = new JSONObject(); |
| | | data.put("count", count); |
| | | data.put("list", JsonUtil.getSimpleGson().toJson(voList)); |
| | | return JsonUtil.loadTrueResult(data); |
| | | } |
| | | |
| | | /** |
| | | * @return java.lang.String |
| | | * @author hxh |
| | | * @description 获取邀请图 |
| | | * @date 16:41 2022/4/20 |
| | | * @param: acceptData |
| | | * @param: uid |
| | | **/ |
| | | @UserLogin(uid = "#uid") |
| | | @ResponseBody |
| | | @RequestMapping("getSpreadImgs") |
| | | public String getSpreadImgs(AcceptData acceptData, Long uid) { |
| | | //先绘图 |
| | | try { |
| | | userSpreadImgService.drawImgs(uid); |
| | | } catch (UserInfoException e) { |
| | | e.printStackTrace(); |
| | | } catch (SpreadImgException e) { |
| | | e.printStackTrace(); |
| | | } catch (UserSpreadImgException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | List<UserSpreadImg> list = userSpreadImgService.getUserSpreadImgs(uid); |
| | | List<String> urlList = new ArrayList<>(); |
| | | if (list != null) { |
| | | for (UserSpreadImg img : list) { |
| | | urlList.add(img.getUrl()); |
| | | } |
| | | } |
| | | |
| | | if (urlList.size() == 0) { |
| | | return JsonUtil.loadFalseResult("无分享图"); |
| | | } |
| | | |
| | | JSONObject data=new JSONObject(); |
| | | data.put("list",urlList); |
| | | |
| | | return JsonUtil.loadTrueResult(data); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.makemoney.app.controller.client.api; |
| | | |
| | | import com.yeshi.makemoney.app.dto.user.LoginInfoDTO; |
| | | import com.yeshi.makemoney.app.entity.user.UserExtraInfo; |
| | | import com.yeshi.makemoney.app.entity.user.UserInfo; |
| | | import com.yeshi.makemoney.app.entity.user.UserLoginRecord; |
| | | import com.yeshi.makemoney.app.entity.user.WXUserInfo; |
| | | import com.yeshi.makemoney.app.entity.vip.UserVIPInfo; |
| | | import com.yeshi.makemoney.app.exception.user.LoginException; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornGetRecordService; |
| | | import com.yeshi.makemoney.app.service.inter.money.UserMoneyService; |
| | | import com.yeshi.makemoney.app.service.inter.team.TeamInviteRelationService; |
| | | import com.yeshi.makemoney.app.service.inter.user.UserAccountService; |
| | | import com.yeshi.makemoney.app.service.inter.user.UserExtraInfoService; |
| | | import com.yeshi.makemoney.app.service.inter.user.UserInfoService; |
| | | import com.yeshi.makemoney.app.service.inter.user.WXUserInfoService; |
| | | import com.yeshi.makemoney.app.service.inter.vip.VIPService; |
| | | import com.yeshi.makemoney.app.service.manager.VerifyCodeManager; |
| | | import com.yeshi.makemoney.app.utils.ApiCodeConstant; |
| | | import com.yeshi.makemoney.app.utils.ImageUtil; |
| | | import com.yeshi.makemoney.app.utils.annotation.UserLogin; |
| | | import com.yeshi.makemoney.app.vo.AcceptData; |
| | | import com.yeshi.makemoney.app.vo.user.UserAssetsVO; |
| | | import com.yeshi.makemoney.app.vo.user.UserInfoVO; |
| | | import com.ks.lib.common.exception.ParamsException; |
| | | import com.ks.push.exception.BPushDeviceTokenException; |
| | | import com.ks.push.pojo.DO.BPushDeviceToken; |
| | | import com.ks.push.pojo.DO.PushPlatform; |
| | | import com.ks.push.service.BDeviceTokenService; |
| | | import org.apache.commons.codec.digest.DigestUtils; |
| | | import org.apache.dubbo.config.annotation.Reference; |
| | | import org.springframework.lang.Nullable; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.yeshi.utils.JsonUtil; |
| | | import org.yeshi.utils.StringUtil; |
| | | import org.yeshi.utils.ThreadUtil; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | import org.yeshi.utils.*; |
| | | import org.yeshi.utils.entity.FileUploadResult; |
| | | import org.yeshi.utils.tencentcloud.COSManager; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.io.InputStream; |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author hxh |
| | |
| | | private UserInfoService userInfoService; |
| | | |
| | | @Resource |
| | | private VIPService vipService; |
| | | private UserExtraInfoService userExtraInfoService; |
| | | |
| | | @Resource |
| | | private WXUserInfoService wxUserInfoService; |
| | | |
| | | @Resource |
| | | private VerifyCodeManager verifyCodeManager; |
| | | |
| | | // @Reference(version = "1.0", check = false) |
| | | // @Reference(version = "1.0", check = false) |
| | | private BDeviceTokenService bDeviceTokenService; |
| | | |
| | | @Resource |
| | | private GoldCornGetRecordService goldCornGetRecordService; |
| | | |
| | | @Resource |
| | | private UserMoneyService userMoneyService; |
| | | |
| | | @Resource |
| | | private TeamInviteRelationService teamInviteRelationService; |
| | | |
| | | @ResponseBody |
| | | @RequestMapping("loginPhone") |
| | | public String loginPhone(AcceptData acceptData, String phone, String vcode, String token) { |
| | | public String loginPhone(AcceptData acceptData, String phone, String vcode, String token, HttpServletRequest request) { |
| | | LoginInfoDTO loginInfo = new LoginInfoDTO(); |
| | | loginInfo.setIpInfo(IPUtil.getRemotIP(request) + ":" + request.getRemotePort()); |
| | | loginInfo.setLoginType(UserLoginRecord.TYPE_LOGIN_PHONE); |
| | | if (!StringUtil.isNullOrEmpty(phone)) { |
| | | if (StringUtil.isNullOrEmpty(vcode)) { |
| | |
| | | } |
| | | }); |
| | | |
| | | return JsonUtil.loadTrueResult(JsonUtil.getApiCommonGson().toJson(userInfo)); |
| | | return outUserInfoForLogin(userInfo); |
| | | } catch (LoginException e) { |
| | | return JsonUtil.loadFalseResult(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | |
| | | private String outUserInfoForLogin(UserInfo userInfo) { |
| | | UserInfoVO vo = UserInfoVO.create(userInfo, userExtraInfoService.get(userInfo.getId())); |
| | | //是否需要填写邀请码 |
| | | Long bossId = teamInviteRelationService.getBossUid(userInfo.getId()); |
| | | if (bossId != null) { |
| | | vo.setHasBoss(true); |
| | | } else { |
| | | vo.setHasBoss(false); |
| | | } |
| | | return JsonUtil.loadTrueResult(JsonUtil.getSimpleGson().toJson(vo)); |
| | | } |
| | | |
| | | @UserLogin(uid = "#uid") |
| | |
| | | if (user == null) { |
| | | return JsonUtil.loadFalseResult("用户不存在"); |
| | | } |
| | | |
| | | if (user.getStatus() == UserInfo.STATUS_FORBIDDEN) { |
| | | return JsonUtil.loadFalseResult(ApiCodeConstant.CODE_FAIL_USER_FORBIDDEN, "账号被封禁"); |
| | | } |
| | |
| | | return JsonUtil.loadFalseResult(ApiCodeConstant.CODE_FAIL_USER_DELETE, "用户已被删除"); |
| | | } |
| | | |
| | | UserInfoVO vo = new UserInfoVO(); |
| | | vo.setId(user.getId() + ""); |
| | | vo.setNickName(user.getNickName()); |
| | | vo.setPortrait(user.getPortrait()); |
| | | |
| | | UserVIPInfo userVIPInfo = vipService.getVIPInfo(user.getId()); |
| | | if (userVIPInfo != null) { |
| | | vo.setVipExpireTime(userVIPInfo.getExpireDate().getTime()); |
| | | } |
| | | |
| | | UserInfoVO vo = UserInfoVO.create(user, userExtraInfoService.get(uid), wxUserInfoService.selectByUid(uid)); |
| | | |
| | | return JsonUtil.loadTrueResult(vo); |
| | | } |
| | | |
| | | @UserLogin(uid = "#uid") |
| | | @ResponseBody |
| | | @RequestMapping("updateUserInfo") |
| | | public String updateUserInfo(AcceptData acceptData, Long uid, String nickName, @Nullable @RequestParam("portrait") MultipartFile portrait, String portraitMD5) { |
| | | |
| | | UserInfo user = userInfoService.get(uid); |
| | | |
| | | if (user == null) { |
| | | return JsonUtil.loadFalseResult("用户不存在"); |
| | | } |
| | | |
| | | UserInfo update = new UserInfo(); |
| | | update.setId(uid); |
| | | |
| | | if (!StringUtil.isNullOrEmpty(nickName)) { |
| | | update.setNickName(nickName); |
| | | } |
| | | |
| | | if (portrait != null) { |
| | | |
| | | if (StringUtil.isNullOrEmpty(portraitMD5)) { |
| | | return JsonUtil.loadFalseResult("头像文件加密值为空"); |
| | | } |
| | | |
| | | try { |
| | | String md5 = DigestUtils.md5Hex(portrait.getBytes()); |
| | | if (!portraitMD5.equalsIgnoreCase(md5)) { |
| | | return JsonUtil.loadFalseResult("头像文件加密值错误"); |
| | | } |
| | | |
| | | InputStream inputStream = portrait.getInputStream(); |
| | | String contentType = portrait.getContentType(); |
| | | String key = String.format("/imgs/portrait/%s_%s.png", uid, md5); |
| | | FileUploadResult result = COSManager.getInstance().uploadFile(inputStream, key); |
| | | if (result == null) { |
| | | return JsonUtil.loadFalseResult("上传出错"); |
| | | } |
| | | update.setPortrait(ImageUtil.getCOSImageUrl(key)); |
| | | } catch (Exception e) { |
| | | return JsonUtil.loadFalseResult("头像修改出错"); |
| | | } |
| | | } |
| | | |
| | | userInfoService.update(update); |
| | | if (portrait != null) { |
| | | //删除原来的头像 |
| | | if (!user.getPortrait().contains("default")) { |
| | | try { |
| | | COSManager.getInstance().deleteFileByKey(ImageUtil.getUrlKey(user.getPortrait())); |
| | | } catch (Exception e) { |
| | | } |
| | | } |
| | | } |
| | | |
| | | return JsonUtil.loadTrueResult(""); |
| | | } |
| | | |
| | | @ResponseBody |
| | |
| | | return JsonUtil.loadTrueResult(e.getMessage()); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * @return java.lang.String |
| | | * @author hxh |
| | | * @description 用户资产 |
| | | * @date 14:36 2022/4/20 |
| | | * @param: acceptData |
| | | * @param: uid |
| | | **/ |
| | | @ResponseBody |
| | | @RequestMapping("getUserAssets") |
| | | public String getUserAssets(AcceptData acceptData, Long uid) { |
| | | Long goldCorn = goldCornGetRecordService.getGoldCornByDay(uid, new Date()); |
| | | BigDecimal money = userMoneyService.getBalance(uid); |
| | | |
| | | UserAssetsVO vo = new UserAssetsVO(); |
| | | vo.setGoldCorn(goldCorn == null ? 0 : Integer.parseInt(goldCorn + "")); |
| | | vo.setBalance(money.setScale(2).toString()); |
| | | return JsonUtil.loadTrueResult(vo); |
| | | |
| | | } |
| | | |
| | |
| | | return JsonUtil.loadFalseResult("用户不存在"); |
| | | } |
| | | UserVIPInfo vipInfo = vipService.getVIPInfo(uid); |
| | | UserInfoVO userInfoVO = new UserInfoVO(); |
| | | userInfoVO.setId(user.getId() + ""); |
| | | userInfoVO.setNickName(user.getNickName()); |
| | | userInfoVO.setPortrait(user.getPortrait()); |
| | | |
| | | UserInfoVO userInfoVO = UserInfoVO.create(user); |
| | | if (vipInfo != null && vipInfo.getExpireDate() != null) { |
| | | userInfoVO.setVipExpireTime(vipInfo.getExpireDate().getTime()); |
| | | // userInfoVO.setVipExpireTime(vipInfo.getExpireDate().getTime()); |
| | | } |
| | | root.put("user", new Gson().toJson(userInfoVO)); |
| | | } |
| | |
| | | import java.util.List; |
| | | import java.lang.Long; |
| | | import java.util.Date; |
| | | |
| | | import org.yeshi.utils.mongo.MongodbBaseDao; |
| | | |
| | | import java.lang.String; |
| | | |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | |
| | | import java.lang.Integer; |
| | | import java.util.ArrayList; |
| | | |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetRecord; |
| | | |
| | | |
| | | @Repository |
| | | public class GoldCornGetRecordDao extends MongodbBaseDao<GoldCornGetRecord>{ |
| | | public class GoldCornGetRecordDao extends MongodbBaseDao<GoldCornGetRecord> { |
| | | |
| | | public void updateSelective(GoldCornGetRecord bean) { |
| | | public void updateSelective(GoldCornGetRecord bean) { |
| | | Query query = new Query(); |
| | | Update update=new Update(); |
| | | Update update = new Update(); |
| | | query.addCriteria(Criteria.where("id").is(bean.getId())); |
| | | if(bean.getUid() != null) { |
| | | if (bean.getUid() != null) { |
| | | update.set("uid", bean.getUid()); |
| | | } |
| | | if(bean.getDay() != null) { |
| | | if (bean.getDay() != null) { |
| | | update.set("day", bean.getDay()); |
| | | } |
| | | if(bean.getCornNum() != null) { |
| | | if (bean.getCornNum() != null) { |
| | | update.set("cornNum", bean.getCornNum()); |
| | | } |
| | | if(bean.getFromUid() != null) { |
| | | if (bean.getFromUid() != null) { |
| | | update.set("fromUid", bean.getFromUid()); |
| | | } |
| | | if(bean.getFromId() != null) { |
| | | if (bean.getFromId() != null) { |
| | | update.set("fromId", bean.getFromId()); |
| | | } |
| | | if(bean.getType() != null) { |
| | | if (bean.getType() != null) { |
| | | update.set("type", bean.getType()); |
| | | } |
| | | if(bean.getRemarks() != null) { |
| | | if (bean.getRemarks() != null) { |
| | | update.set("remarks", bean.getRemarks()); |
| | | } |
| | | if(bean.getCreateTime() != null) { |
| | | if (bean.getCreateTime() != null) { |
| | | update.set("createTime", bean.getCreateTime()); |
| | | } |
| | | update.set("updateTime", new Date()); |
| | | update(query, update); |
| | | } |
| | | } |
| | | |
| | | |
| | | public List<GoldCornGetRecord> list(DaoQuery daoQuery){ |
| | | public List<GoldCornGetRecord> list(DaoQuery daoQuery) { |
| | | Query query = getQuery(daoQuery); |
| | | if (daoQuery.sortList!=null && daoQuery.sortList.size()>0){ |
| | | if (daoQuery.sortList != null && daoQuery.sortList.size() > 0) { |
| | | query.with(Sort.by(daoQuery.sortList)); |
| | | } |
| | | query.skip(daoQuery.start); |
| | | query.limit(daoQuery.count); |
| | | return findList(query); |
| | | } |
| | | } |
| | | |
| | | public long count(DaoQuery daoQuery){ |
| | | Query query=getQuery(daoQuery); |
| | | public long count(DaoQuery daoQuery) { |
| | | Query query = getQuery(daoQuery); |
| | | return count(query); |
| | | } |
| | | } |
| | | |
| | | private Query getQuery(DaoQuery daoQuery){ |
| | | List<Criteria> andList=new ArrayList<>(); |
| | | if(daoQuery.uid!=null){ |
| | | private Query getQuery(DaoQuery daoQuery) { |
| | | List<Criteria> andList = new ArrayList<>(); |
| | | if (daoQuery.uid != null) { |
| | | andList.add(Criteria.where("uid").is(daoQuery.uid)); |
| | | } |
| | | if(daoQuery.day!=null){ |
| | | if (daoQuery.day != null) { |
| | | andList.add(Criteria.where("day").is(daoQuery.day)); |
| | | } |
| | | if(daoQuery.fromUid!=null){ |
| | | |
| | | if (daoQuery.dayList != null && daoQuery.dayList.size() > 0) { |
| | | Criteria[] ors = new Criteria[daoQuery.dayList.size()]; |
| | | for (int i = 0; i < ors.length; i++) { |
| | | ors[i] = Criteria.where("day").is(daoQuery.dayList.get(i)); |
| | | } |
| | | andList.add(new Criteria().orOperator(ors)); |
| | | } |
| | | |
| | | if (daoQuery.fromUid != null) { |
| | | andList.add(Criteria.where("fromUid").is(daoQuery.fromUid)); |
| | | } |
| | | if(daoQuery.fromId!=null){ |
| | | if (daoQuery.fromId != null) { |
| | | andList.add(Criteria.where("fromId").is(daoQuery.fromId)); |
| | | } |
| | | if(daoQuery.type!=null){ |
| | | if (daoQuery.type != null) { |
| | | andList.add(Criteria.where("type").is(daoQuery.type)); |
| | | } |
| | | if(daoQuery.maxCreateTime!=null){ |
| | | if (daoQuery.maxCreateTime != null) { |
| | | andList.add(Criteria.where("createTime").lt(daoQuery.maxCreateTime)); |
| | | } |
| | | if(daoQuery.minCreateTime!=null){ |
| | | if (daoQuery.minCreateTime != null) { |
| | | andList.add(Criteria.where("createTime").gte(daoQuery.minCreateTime)); |
| | | } |
| | | Query query=new Query(); |
| | | Criteria[] ands=new Criteria[andList.size()]; |
| | | Query query = new Query(); |
| | | Criteria[] ands = new Criteria[andList.size()]; |
| | | andList.toArray(ands); |
| | | if(ands.length>0){ |
| | | if (ands.length > 0) { |
| | | query.addCriteria(new Criteria().andOperator(ands)); |
| | | } |
| | | return query; |
| | | } |
| | | } |
| | | |
| | | public static class DaoQuery{ |
| | | public static class DaoQuery { |
| | | public Long uid; |
| | | public String day; |
| | | public List<String> dayList; |
| | | public Long fromUid; |
| | | public String fromId; |
| | | public GoldCornGetType type; |
| | |
| | | public int start; |
| | | public int count; |
| | | public List<Sort.Order> sortList; |
| | | } |
| | | } |
| | | } |
| | |
| | | package com.yeshi.makemoney.app.dao.user; |
| | | |
| | | import com.yeshi.makemoney.app.entity.user.UserExtraInfo; |
| | | import org.springframework.data.domain.Sort; |
| | | 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.data.domain.Sort; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | import com.yeshi.makemoney.app.entity.user.UserExtraInfo; |
| | | import java.util.Date; |
| | | import org.yeshi.utils.mongo.MongodbBaseDao; |
| | | import java.lang.String; |
| | | import java.lang.Integer; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | |
| | | @Repository |
| | | public class UserExtraInfoDao extends MongodbBaseDao<UserExtraInfo>{ |
| | | public class UserExtraInfoDao extends MongodbBaseDao<UserExtraInfo> { |
| | | |
| | | public void updateSelective(UserExtraInfo bean) { |
| | | public void updateSelective(UserExtraInfo bean) { |
| | | Query query = new Query(); |
| | | Update update=new Update(); |
| | | Update update = new Update(); |
| | | query.addCriteria(Criteria.where("id").is(bean.getId())); |
| | | if(bean.getInviteCode() != null) { |
| | | if (bean.getInviteCode() != null) { |
| | | update.set("inviteCode", bean.getInviteCode()); |
| | | } |
| | | if(bean.getUnReadMsgCount() != null) { |
| | | if (bean.getUnReadMsgCount() != null) { |
| | | update.set("unReadMsgCount", bean.getUnReadMsgCount()); |
| | | } |
| | | if(bean.getCreateTime() != null) { |
| | | if (bean.getCreateTime() != null) { |
| | | update.set("createTime", bean.getCreateTime()); |
| | | } |
| | | update.set("updateTime", new Date()); |
| | | update(query, update); |
| | | } |
| | | } |
| | | |
| | | |
| | | public List<UserExtraInfo> list(DaoQuery daoQuery) { |
| | | Query query = getQuery(daoQuery); |
| | | if (daoQuery.sortList != null && daoQuery.sortList.size() > 0) { |
| | | query.with(Sort.by(daoQuery.sortList)); |
| | | } |
| | | query.skip(daoQuery.start); |
| | | query.limit(daoQuery.count); |
| | | return findList(query); |
| | | } |
| | | |
| | | public long count(DaoQuery daoQuery) { |
| | | Query query = getQuery(daoQuery); |
| | | return count(query); |
| | | } |
| | | |
| | | private Query getQuery(DaoQuery daoQuery) { |
| | | List<Criteria> andList = new ArrayList<>(); |
| | | if (daoQuery.inviteCode != null) { |
| | | andList.add(Criteria.where("inviteCode").is(daoQuery.inviteCode)); |
| | | } |
| | | Query query = new Query(); |
| | | Criteria[] ands = new Criteria[andList.size()]; |
| | | andList.toArray(ands); |
| | | if (ands.length > 0) { |
| | | query.addCriteria(new Criteria().andOperator(ands)); |
| | | } |
| | | return query; |
| | | } |
| | | |
| | | public static class DaoQuery { |
| | | public String inviteCode; |
| | | public int start; |
| | | public int count; |
| | | public List<Sort.Order> sortList; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | public static class DaoQuery { |
| | | public SystemEnum system; |
| | | public String unionId; |
| | | public Long uid; |
| | | public long start; |
| | | public int count; |
| | | public List<String> sortList; |
| | |
| | | private String publicKey; |
| | | @Map("account_name") |
| | | private String accountName; |
| | | |
| | | @Map("app_cert_path") |
| | | private String appCertPath; |
| | | @Map("alipay_root_cert_path") |
| | |
| | | |
| | | |
| | | /** |
| | | * 首次提现的最小金额 |
| | | * 新用户小金额提现次数 |
| | | **/ |
| | | private Integer newerLittleMoneyNum; |
| | | |
| | |
| | | //团队分成比例配置 |
| | | teamFirstDivideRate(SystemConfigType.team, "团队一级分成比例(0-1)"), |
| | | teamSecondDivideRate(SystemConfigType.team, "团队二级分成比例(0-1)"), |
| | | //金币设置 |
| | | signInGoldCorn(SystemConfigType.goldCorn,"连续签到金币分布"), |
| | | |
| | | ; |
| | | |
| | | |
| | |
| | | */ |
| | | public enum SystemConfigType { |
| | | common("通用"), |
| | | goldCorn("金币设置"), |
| | | system("系統相关"), |
| | | extract("提现"), |
| | | team("团队"), |
| | |
| | | * @date 2022/3/31 18:29 |
| | | */ |
| | | public enum GoldCornGetType { |
| | | watchVideo("观看视频"), readNovel("读小说"); |
| | | signIn("签到"), watchVideo("观看视频"), readNovel("读小说"); |
| | | private String name; |
| | | |
| | | private GoldCornGetType(String name) { |
| | |
| | | **/ |
| | | private Integer unReadMsgCount; |
| | | |
| | | /** |
| | | * 签到提醒 |
| | | **/ |
| | | private Boolean signInNotify; |
| | | |
| | | |
| | | private Date createTime; |
| | | private Date updateTime; |
| | |
| | | public void setUpdateTime(Date updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public Boolean getSignInNotify() { |
| | | return signInNotify; |
| | | } |
| | | |
| | | public void setSignInNotify(Boolean signInNotify) { |
| | | this.signInNotify = signInNotify; |
| | | } |
| | | } |
| | |
| | | @Show(title = "登录类型") |
| | | @DaoQueryCondition |
| | | private Integer loginType; |
| | | |
| | | @Show(title = "登录时间") |
| | | @DaoQueryCondition |
| | | private Date createTime; |
| | |
| | | public void setCreateTime(Date createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | } |
| | |
| | | public class WXUserInfo implements Serializable { |
| | | @Id |
| | | private Long id; |
| | | private Long uid; |
| | | private SystemEnum system; |
| | | @Column(name = "nick_name") |
| | | private String nickName; |
| | |
| | | private Date createTime; |
| | | @Column(name = "update_time") |
| | | private Date updateTime; |
| | | |
| | | |
| | | |
| | | public Long getId() { |
| | | return id; |
| | |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public Long getUid() { |
| | | return uid; |
| | | } |
| | | |
| | | public void setUid(Long uid) { |
| | | this.uid = uid; |
| | | } |
| | | |
| | | public void setSex(Integer sex) { |
| | | this.sex = sex; |
| | | } |
| | | |
| | | public static WXUserInfo create(WeiXinUser weiXinUser) { |
| | | WXUserInfo wxUserInfo = new WXUserInfo(); |
| | | wxUserInfo.setCity(weiXinUser.getCity()); |
| | |
| | | import java.lang.Exception; |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.yeshi.makemoney.app.entity.SystemEnum; |
| | | import com.yeshi.makemoney.app.entity.config.SystemConfigKey; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | import com.yeshi.makemoney.app.service.inter.config.SystemConfigService; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.lang.reflect.Type; |
| | | import java.math.BigDecimal; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | |
| | | |
| | | @Resource |
| | | private GoldCornGetPriceDao goldCornGetPriceDao; |
| | | |
| | | @Resource |
| | | private SystemConfigService systemConfigService; |
| | | |
| | | @Override |
| | | public List<GoldCornGetPrice> list(GoldCornGetPriceQuery goldCornGetPriceQuery, int page, int pageSize) { |
| | |
| | | return new BigDecimal(price.getCornNum()).multiply(new BigDecimal(1).add(price.getTeamGainRate())).intValue(); |
| | | } |
| | | |
| | | @Override |
| | | public Integer getSingInPrice(SystemEnum system, int continueDay) { |
| | | List<Integer> list = getSingInPriceList(system); |
| | | if (list == null) { |
| | | return null; |
| | | } |
| | | |
| | | if (continueDay >= list.size()) { |
| | | return list.get(list.size() - 1); |
| | | } |
| | | |
| | | if (continueDay <= 0) { |
| | | return list.get(0); |
| | | } |
| | | |
| | | return list.get(continueDay - 1); |
| | | } |
| | | |
| | | @Override |
| | | public List<Integer> getSingInPriceList(SystemEnum system) { |
| | | String value = systemConfigService.getValueCache(system, SystemConfigKey.signInGoldCorn); |
| | | if (StringUtil.isNullOrEmpty(value)) { |
| | | return null; |
| | | } |
| | | Type type = new TypeToken<List<Integer>>() { |
| | | }.getType(); |
| | | return new Gson().fromJson(value, type); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.yeshi.makemoney.app.dao.goldcorn.GoldCornGetRecordDao; |
| | | import com.yeshi.makemoney.app.dao.goldcorn.GoldCornGetRecordDao.DaoQuery; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetRecord; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetRecordException; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornGetRecordService; |
| | | import com.yeshi.makemoney.app.service.query.goldcorn.GoldCornGetRecordQuery; |
| | | import com.yeshi.makemoney.app.utils.goldcorn.GoldCornUtil; |
| | | import org.springframework.data.domain.Sort; |
| | | import org.springframework.data.mongodb.core.MongoTemplate; |
| | | import org.springframework.data.mongodb.core.aggregation.Aggregation; |
| | |
| | | import org.springframework.data.mongodb.core.query.Criteria; |
| | | import org.springframework.data.mongodb.core.query.Query; |
| | | import org.springframework.stereotype.Service; |
| | | import org.yeshi.utils.TimeUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.*; |
| | |
| | | DaoQuery daoQuery = new DaoQuery(); |
| | | daoQuery.type = goldCornGetRecordQuery.getType(); |
| | | daoQuery.uid = goldCornGetRecordQuery.getUid(); |
| | | daoQuery.day=goldCornGetRecordQuery.getDay(); |
| | | daoQuery.dayList=goldCornGetRecordQuery.getDayList(); |
| | | |
| | | |
| | | daoQuery.minCreateTime = goldCornGetRecordQuery.toStartTime(); |
| | | daoQuery.maxCreateTime = goldCornGetRecordQuery.toEndTime(); |
| | | |
| | |
| | | DaoQuery daoQuery = new DaoQuery(); |
| | | daoQuery.type = goldCornGetRecordQuery.getType(); |
| | | daoQuery.uid = goldCornGetRecordQuery.getUid(); |
| | | daoQuery.day=goldCornGetRecordQuery.getDay(); |
| | | daoQuery.dayList=goldCornGetRecordQuery.getDayList(); |
| | | daoQuery.minCreateTime = goldCornGetRecordQuery.toStartTime(); |
| | | daoQuery.maxCreateTime = goldCornGetRecordQuery.toEndTime(); |
| | | return goldCornGetRecordDao.count(daoQuery); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Long getGoldCornByDay(Long uid, String day) { |
| | | public Long getGoldCornByDay(Long uid, Date day) { |
| | | List<Criteria> andList = new ArrayList<>(); |
| | | if (uid != null) { |
| | | andList.add(Criteria.where("uid").is(uid)); |
| | | } |
| | | |
| | | if (day != null) { |
| | | andList.add(Criteria.where("day").is(day)); |
| | | andList.add(Criteria.where("day").is(GoldCornUtil.getFormatDay(day))); |
| | | } |
| | | |
| | | Criteria[] ands = new Criteria[andList.size()]; |
| | |
| | | |
| | | @Override |
| | | public Map<Long, Integer> sumGoldCornByFromUids(Long uid, List<Long> fromUidList, String day) { |
| | | if (fromUidList == null || fromUidList.size() == 0) { |
| | | return new HashMap<>(); |
| | | } |
| | | Criteria[] ands = new Criteria[3]; |
| | | ands[0] = Criteria.where("day").is(day); |
| | | ands[1] = Criteria.where("uid").is(uid); |
| | |
| | | for (int i = 0; i < ors.length; i++) { |
| | | ors[i] = Criteria.where("fromUid").is(fromUidList.get(i)); |
| | | } |
| | | ands[3] = new Criteria().orOperator(ors); |
| | | ands[2] = new Criteria().orOperator(ors); |
| | | |
| | | List<AggregationOperation> list = new ArrayList<>(); |
| | | list.add(Aggregation.match(new Criteria().andOperator(ands))); |
| | |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public int getContinueDay(Long uid, GoldCornGetType type, Date deadDate) { |
| | | List<AggregationOperation> list = new ArrayList<>(); |
| | | list.add(Aggregation.match(Criteria.where("uid").is(uid).and("type").is(type).and("createTime").lte(deadDate))); |
| | | list.add(Aggregation.group("day").max("createTime").as("createTime")); |
| | | list.add(Aggregation.sort(Sort.Direction.DESC, "createTime")); |
| | | //最大限制为365天 |
| | | list.add(Aggregation.limit(365)); |
| | | list.add(Aggregation.project("day")); |
| | | AggregationResults<Map<String,String>> results = goldCornGetRecordDao.aggregate(list, Map.class); |
| | | List<Map<String,String>> resultList = results.getMappedResults(); |
| | | //获取连续的天数 |
| | | String format="yyyy-MM-dd"; |
| | | Date lastDay = new Date(TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(deadDate.getTime(), format), format)); |
| | | int continueDay = 0; |
| | | for (Map<String,String> day : resultList) { |
| | | Long timestamp = TimeUtil.convertToTimeTemp(day.get("_id"), format); |
| | | long cha = lastDay.getTime() - timestamp; |
| | | if (cha <= 1000 * 60 * 60 * 24L) { |
| | | continueDay++; |
| | | } else { |
| | | break; |
| | | } |
| | | lastDay = new Date(timestamp); |
| | | } |
| | | return continueDay; |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.makemoney.app.service.impl.goldcorn; |
| | | |
| | | import com.ks.lib.common.exception.ParamsException; |
| | | import com.yeshi.makemoney.app.entity.config.SystemConfigKey; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetFrequencyConfig; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetPrice; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetRecord; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.*; |
| | | import com.yeshi.makemoney.app.entity.money.UserMoneyRecord; |
| | | import com.yeshi.makemoney.app.entity.user.UserInfo; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetFrequencyConfigException; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetPriceException; |
| | |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornGetPriceService; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornGetRecordService; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornMakeService; |
| | | import com.yeshi.makemoney.app.service.inter.money.UserMoneyRecordService; |
| | | import com.yeshi.makemoney.app.service.inter.team.TeamInviteRelationService; |
| | | import com.yeshi.makemoney.app.service.inter.user.UserInfoService; |
| | | import com.yeshi.makemoney.app.service.query.goldcorn.GoldCornGetRecordQuery; |
| | | import com.yeshi.makemoney.app.utils.factory.UserMoneyRecordFactory; |
| | | import com.yeshi.makemoney.app.utils.factory.goldcorn.GoldCornConsumeRecordFactory; |
| | | import com.yeshi.makemoney.app.utils.goldcorn.GoldCornUtil; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.stereotype.Service; |
| | | import org.yeshi.utils.TimeUtil; |
| | |
| | | |
| | | @Resource |
| | | private SystemConfigService systemConfigService; |
| | | |
| | | @Resource |
| | | private UserMoneyRecordService userMoneyRecordService; |
| | | |
| | | |
| | | private void frequencyVerify(UserInfo user, GoldCornGetType type, Date time) throws GoldCornGetFrequencyConfigException, GoldCornMakeException { |
| | |
| | | |
| | | @RequestSerializableByKey(key = "'addgoldcorn-'+#uid+'-'+#type") |
| | | @Override |
| | | public void addGoldCorn(Long uid, GoldCornGetType type, boolean isDouble, Date currentTime) throws UserInfoException, GoldCornGetPriceException, GoldCornGetFrequencyConfigException, GoldCornMakeException { |
| | | public GoldCornGetRecord addGoldCorn(Long uid, GoldCornGetType type, boolean isDouble, Date currentTime, Integer price) throws UserInfoException, GoldCornGetPriceException, GoldCornGetFrequencyConfigException, GoldCornMakeException { |
| | | if (uid == null || type == null || currentTime == null) { |
| | | throw new GoldCornMakeException(GoldCornMakeException.CODE_PARAMS_NOT_ENOUGH, "参数不完整"); |
| | | } |
| | |
| | | //判断是否超出了次数限制 |
| | | frequencyVerify(user, type, currentTime); |
| | | //获取价格 |
| | | GoldCornGetPrice price = goldCornGetPriceService.getPrice(user.getSystem(), type, currentTime); |
| | | GoldCornGetPrice getPrice = goldCornGetPriceService.getPrice(user.getSystem(), type, currentTime); |
| | | if (price == null) { |
| | | throw new GoldCornGetPriceException(GoldCornGetPriceException.CODE_NOT_EXIST, "价格信息缺失"); |
| | | } |
| | | |
| | | //基础价格 |
| | | int baseCornNum = price.getCornNum(); |
| | | //基础价格,外部传入的价格优先 |
| | | int baseCornNum = (price != null ? price : getPrice.getCornNum()); |
| | | |
| | | //是否加入团队 |
| | | Long bossUid = teamInviteRelationService.getBossUid(uid); |
| | | if (bossUid != null) { |
| | | baseCornNum = new BigDecimal(baseCornNum).multiply(new BigDecimal(1).add(price.getTeamGainRate())).intValue(); |
| | | baseCornNum = new BigDecimal(baseCornNum).multiply(new BigDecimal(1).add(getPrice.getTeamGainRate())).intValue(); |
| | | } |
| | | |
| | | GoldCornGetRecord record = new GoldCornGetRecord(); |
| | |
| | | goldCornGetRecordService.add(recordD); |
| | | } |
| | | //是否有上级 |
| | | if (price.getTeamDivide() != null && price.getTeamDivide()) { |
| | | if (getPrice.getTeamDivide() != null && getPrice.getTeamDivide()) { |
| | | if (bossUid != null) { |
| | | BigDecimal rate = new BigDecimal(systemConfigService.getValueCache(user.getSystem(), SystemConfigKey.teamFirstDivideRate)); |
| | | GoldCornGetRecord cRecord = new GoldCornGetRecord(); |
| | |
| | | throw new GoldCornMakeException(GoldCornMakeException.CODE_ADD_RECORD_ERROR, e.getMsg()); |
| | | } |
| | | |
| | | return record; |
| | | } |
| | | |
| | | @Override |
| | | public Long getGoldCornByDay(Long uid, String day) { |
| | | public Long getGoldCornByDay(Long uid, Date day) { |
| | | //TODO redis缓存 |
| | | return goldCornGetRecordService.getGoldCornByDay(uid, day); |
| | | } |
| | | |
| | | @Override |
| | | public Long getExchangingGoldCorn(Long uid, int dayCount) { |
| | | long goldCornNum = 0; |
| | | long now = System.currentTimeMillis(); |
| | | //查询最近3天未兑换的金币数量, |
| | | for (int i = 1; i <= dayCount; i++) { |
| | | Date date = new Date(now - 1000 * 60 * 60 * 24L * i); |
| | | long count = getGoldCornByDay(uid, date); |
| | | if (count == 0L) { |
| | | continue; |
| | | } |
| | | //获取兑换记录的主键ID |
| | | GoldCornConsumeRecord record = GoldCornConsumeRecordFactory.createExchange(uid, GoldCornUtil.getFormatDay(date), 0, new BigDecimal(0.1)); |
| | | //查询资金记录是否有该记录 |
| | | try { |
| | | UserMoneyRecord userMoneyRecord = UserMoneyRecordFactory.createGoldCornExchange(record); |
| | | //查询记录 |
| | | userMoneyRecord = userMoneyRecordService.selectBySerialNo(userMoneyRecord.getSerialNo()); |
| | | |
| | | if (userMoneyRecord == null) { |
| | | //未兑换 |
| | | goldCornNum += count; |
| | | } |
| | | |
| | | } catch (ParamsException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | return goldCornNum; |
| | | } |
| | | |
| | | @Override |
| | | public int getContinueSignDay(Long uid) { |
| | | Date now = new Date(); |
| | | //查询今日是否已经签到 |
| | | boolean isSignIn = isSignIn(uid, now); |
| | | //今日未签到的,查询连续签到次数应该从前一天开始计算 |
| | | int continueDay = goldCornGetRecordService.getContinueDay(uid, GoldCornGetType.signIn, !isSignIn ? new Date(now.getTime() - 1000 * 60 * 60 * 24L) : now); |
| | | return continueDay; |
| | | } |
| | | |
| | | @Override |
| | | public boolean isSignIn(Long uid, Date date) { |
| | | GoldCornGetRecordQuery query = new GoldCornGetRecordQuery(); |
| | | query.setUid(uid); |
| | | query.setType(GoldCornGetType.signIn); |
| | | query.setDay(GoldCornUtil.getFormatDay(date)); |
| | | long count = goldCornGetRecordService.count(query); |
| | | return count > 0L; |
| | | } |
| | | |
| | | @Override |
| | | public GoldCornGetRecord signIn(Long uid) throws GoldCornGetFrequencyConfigException, UserInfoException, GoldCornGetPriceException, GoldCornMakeException { |
| | | |
| | | UserInfo user = userInfoService.get(uid); |
| | | //获取连续签到次数 |
| | | Integer price = goldCornGetPriceService.getSingInPrice(user.getSystem(), getContinueSignDay(uid) + 1); |
| | | |
| | | |
| | | return addGoldCorn(uid, GoldCornGetType.signIn, false, new Date(), price); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | import com.yeshi.makemoney.app.service.inter.money.UserMoneyService; |
| | | import com.yeshi.makemoney.app.service.inter.user.UserInfoService; |
| | | import com.yeshi.makemoney.app.utils.factory.UserMoneyRecordFactory; |
| | | import com.yeshi.makemoney.app.utils.factory.goldcorn.GoldCornConsumeRecordFactory; |
| | | import com.yeshi.makemoney.app.utils.goldcorn.GoldCornUtil; |
| | | import com.yeshi.makemoney.app.utils.mq.CMQManager; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | private UserMoneyService userMoneyService; |
| | | |
| | | @Override |
| | | public void startSettle(String day) { |
| | | public void startSettle(Date date) { |
| | | String day= GoldCornUtil.getFormatDay(date); |
| | | long count = goldCornGetRecordService.countUidsByDay(day); |
| | | int pageSize = 1000; |
| | | int page = (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1); |
| | |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | | public void settle(Long uid, String day, BigDecimal rate) throws GoldCornConsumeRecordException, UserMoneyRecordException { |
| | | public void settle(Long uid, Date day, BigDecimal rate) throws GoldCornConsumeRecordException, UserMoneyRecordException { |
| | | long cornNum = goldCornGetRecordService.getGoldCornByDay(uid, day); |
| | | //金币数量 |
| | | GoldCornConsumeRecord record = new GoldCornConsumeRecord(); |
| | | record.setUid(uid); |
| | | record.setCornNum((int) cornNum); |
| | | record.setMoney(rate.multiply(new BigDecimal(record.getCornNum()).setScale(2, RoundingMode.FLOOR))); |
| | | record.setType(GoldCornConsumeType.changeMoney); |
| | | record.setId(uid + "-" + record.getType().name() + "-" + day); |
| | | GoldCornConsumeRecord record = GoldCornConsumeRecordFactory.createExchange(uid,GoldCornUtil.getFormatDay(day),(int) cornNum,rate); |
| | | try { |
| | | UserMoneyRecord moneyRecord = UserMoneyRecordFactory.createGoldCornExchange(record); |
| | | userMoneyService.addUserMoney(moneyRecord); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void settle(Long uid, String day) throws UserInfoException, GoldCornMoneyExchangeRateRecordException, UserMoneyRecordException, GoldCornConsumeRecordException { |
| | | public void settle(Long uid, Date day) throws UserInfoException, GoldCornMoneyExchangeRateRecordException, UserMoneyRecordException, GoldCornConsumeRecordException { |
| | | UserInfo user = userInfoService.get(uid); |
| | | if (user == null) { |
| | | throw new UserInfoException(UserInfoException.CODE_NOT_EXIST, "用户不存在"); |
| | |
| | | |
| | | BigDecimal rate = null; |
| | | try { |
| | | rate = goldCornMoneyExchangeRateRecordService.getRate(day, user.getSystem(), new Date()); |
| | | rate = goldCornMoneyExchangeRateRecordService.getRate(GoldCornUtil.getFormatDay(day), user.getSystem(), new Date()); |
| | | } catch (ParamsException e) { |
| | | throw new GoldCornMoneyExchangeRateRecordException(GoldCornMoneyExchangeRateRecordException.CODE_PARAMS_NOT_ENOUGH, e.getMsg()); |
| | | } |
| | |
| | | return extractMapper.count(daoQuery) < 1L; |
| | | } |
| | | |
| | | private ExtractConfig getExtractConfig(SystemEnum system) { |
| | | @Override |
| | | public ExtractConfig getExtractConfig(SystemEnum system) { |
| | | String value = systemConfigService.getValueCache(system, SystemConfigKey.extractConfig); |
| | | if (StringUtil.isNullOrEmpty(value)) { |
| | | return null; |
| | |
| | | } |
| | | |
| | | //小金额提现限制 |
| | | if (money.compareTo(new BigDecimal(1)) < 0) { |
| | | if (money.compareTo(Constant.EXTRACT_LITTLE_MONEY_LIMIT) < 0) { |
| | | //是否已经用完新用户额度 |
| | | if (!canExtractLittleMoney(user.getId(), config.getNewerLittleMoneyNum(), new Date(currentTime))) { |
| | | throw new ExtractException(ExtractException.CODE_LITTLE_MONEY_LIMIT, "今日小于1元提现次数已用尽"); |
| | |
| | | @Override |
| | | public boolean canExtractLittleMoney(Long uid, int maxNewerCount, Date date) { |
| | | //判断新人 |
| | | long count = countByMaxMoney(uid, new BigDecimal(1), Arrays.asList(new Integer[]{Extract.STATE_NOT_PROCESS, Extract.STATE_PROCESSING, Extract.STATE_PASS}), null); |
| | | long count = countByMaxMoney(uid,Constant.EXTRACT_LITTLE_MONEY_LIMIT, Arrays.asList(new Integer[]{Extract.STATE_NOT_PROCESS, Extract.STATE_PROCESSING, Extract.STATE_PASS}), null); |
| | | if (maxNewerCount > count) { |
| | | return true; |
| | | } |
| | |
| | | if (limit <= 0) { |
| | | return false; |
| | | } |
| | | count = countByMaxMoney(uid, new BigDecimal(1), Arrays.asList(new Integer[]{Extract.STATE_NOT_PROCESS, Extract.STATE_PROCESSING, Extract.STATE_PASS}), new Date(TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(date.getTime(), "yyyyMMdd"), "yyyyMMdd"))); |
| | | count = countByMaxMoney(uid, Constant.EXTRACT_LITTLE_MONEY_LIMIT, Arrays.asList(new Integer[]{Extract.STATE_NOT_PROCESS, Extract.STATE_PROCESSING, Extract.STATE_PASS}), new Date(TimeUtil.convertToTimeTemp(TimeUtil.getGernalTime(date.getTime(), "yyyyMMdd"), "yyyyMMdd"))); |
| | | if (count < limit) { |
| | | return true; |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | @Override |
| | | public BigDecimal getExtractingMoney(Long uid) { |
| | | DaoQuery daoQuery = new DaoQuery(); |
| | | daoQuery.uid = uid; |
| | | daoQuery.state = Extract.STATE_NOT_PROCESS; |
| | | BigDecimal money = extractMapper.sumMoney(daoQuery); |
| | | |
| | | return money == null ? new BigDecimal(0) : money; |
| | | } |
| | | |
| | | |
| | | @Transactional(rollbackFor = Exception.class) |
| | | @Override |
| | |
| | | if (teamInviteRelation.getCreateTime() == null) { |
| | | teamInviteRelation.setCreateTime(new Date()); |
| | | } |
| | | |
| | | |
| | | //保存 |
| | | teamInviteRelationMapper.insertSelective(teamInviteRelation); |
| | | } |
| | |
| | | List<String> md5List = new ArrayList<>(); |
| | | Map<String, UserSpreadImg> userMap = new HashMap<>(); |
| | | for (UserSpreadImg img : userSpreadImgList) { |
| | | md5List.add(img.getId()); |
| | | md5List.add(img.getSourceMD5()); |
| | | userMap.put(img.getSourceMD5(), img); |
| | | } |
| | | |
| | | //删除素材中不存在的图片 |
| | | md5List.removeAll(resourceMD5List); |
| | | for (String md5 : md5List) { |
| | | |
| | | //临时变量,防止数据被污染 |
| | | List<String> tempMD5List=new ArrayList<>(); |
| | | tempMD5List.addAll(md5List); |
| | | tempMD5List.removeAll(resourceMD5List); |
| | | for (String md5 : tempMD5List) { |
| | | deleteUserSpreadImg(userMap.get(md5)); |
| | | } |
| | | |
| | |
| | | //删除实体 |
| | | userSpreadImgDao.delete(img.getId()); |
| | | //删除图片 |
| | | COSManager.getInstance().deleteFileByKey(getUrlKey(img.getUrl())); |
| | | COSManager.getInstance().deleteFileByKey(ImageUtil.getUrlKey(img.getUrl())); |
| | | } |
| | | |
| | | private static String getUrlKey(String imgUrl) { |
| | | String url = imgUrl.replace("http://", "").replace("https://", ""); |
| | | String key = url.substring(url.indexOf("/")); |
| | | return key; |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | loginInfo.setPhone(mobile); |
| | | } else { |
| | | //验证码登录 |
| | | if (!verifyCodeManager.isPhoneCodeRight(loginInfo.getSystem(), loginInfo.getPhone(), loginInfo.getVcode())) { |
| | | throw new LoginException("验证码出错"); |
| | | } |
| | | // if (!verifyCodeManager.isPhoneCodeRight(loginInfo.getSystem(), loginInfo.getPhone(), loginInfo.getVcode())) { |
| | | // throw new LoginException("验证码错误"); |
| | | // } |
| | | } |
| | | //执行登录操作 |
| | | user = userInfoService.selectByPhoneAndSystemAndStatus(loginInfo.getPhone(), loginInfo.getSystem(), UserInfo.STATUS_NORMAL); |
| | |
| | | } |
| | | |
| | | loginSuccess(user.getId(), loginInfo); |
| | | return null; |
| | | return user; |
| | | } |
| | | |
| | | @Override |
| | |
| | | import com.yeshi.makemoney.app.entity.user.UserExtraInfo; |
| | | import com.yeshi.makemoney.app.service.inter.user.UserExtraInfoService; |
| | | import org.springframework.stereotype.Service; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class UserExtraInfoServiceImpl implements UserExtraInfoService { |
| | |
| | | update.setInviteCode(code); |
| | | userExtraInfoDao.updateSelective(update); |
| | | } |
| | | |
| | | @Override |
| | | public Long selectUidByInviteCode(String inviteCode) { |
| | | if (StringUtil.isNullOrEmpty(inviteCode)) { |
| | | return null; |
| | | } |
| | | UserExtraInfoDao.DaoQuery daoQuery = new UserExtraInfoDao.DaoQuery(); |
| | | daoQuery.inviteCode = inviteCode; |
| | | daoQuery.count = 1; |
| | | List<UserExtraInfo> list = userExtraInfoDao.list(daoQuery); |
| | | if (list == null || list.size() == 0) { |
| | | return null; |
| | | } |
| | | return list.get(0).getId(); |
| | | } |
| | | |
| | | @Override |
| | | public void setSignInNotify(Long uid, boolean notify) { |
| | | init(uid); |
| | | UserExtraInfo update = new UserExtraInfo(); |
| | | update.setId(uid); |
| | | update.setSignInNotify(notify); |
| | | userExtraInfoDao.updateSelective(update); |
| | | } |
| | | |
| | | @Override |
| | | public boolean getSignInNotify(Long uid) { |
| | | UserExtraInfo extraInfo = get(uid); |
| | | //签到默认自动提醒 |
| | | if (extraInfo == null || extraInfo.getSignInNotify() == null) { |
| | | return true; |
| | | } |
| | | return extraInfo.getSignInNotify(); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.yeshi.makemoney.app.entity.SystemEnum; |
| | | import com.yeshi.makemoney.app.service.inter.user.QQUserInfoService; |
| | | import com.yeshi.makemoney.app.service.inter.user.UserExtraInfoService; |
| | | import com.yeshi.makemoney.app.service.inter.user.WXUserInfoService; |
| | | import com.yeshi.makemoney.app.utils.user.InviteCodeUtil; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Collection; |
| | | import java.util.Date; |
| | | |
| | | import org.yeshi.utils.bean.BeanUtil; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import com.yeshi.makemoney.app.dao.user.UserInfoDao; |
| | | import com.yeshi.makemoney.app.entity.user.UserInfo; |
| | |
| | | @Resource |
| | | private QQUserInfoService qqUserInfoService; |
| | | |
| | | @Resource |
| | | private UserExtraInfoService userExtraInfoService; |
| | | |
| | | @Override |
| | | public List<UserInfo> list(UserInfoQuery userInfoQuery, int page, int pageSize) { |
| | | DaoQuery daoQuery = new DaoQuery(); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<UserInfo> list(List<Long> uidList) { |
| | | if(uidList==null||uidList.size()==0) { |
| | | public List<UserInfo> list(Collection<Long> uidList) { |
| | | if (uidList == null || uidList.size() == 0) { |
| | | return new ArrayList<>(); |
| | | } |
| | | return userInfoMapper.listByUids(uidList); |
| | | List<Long> list = new ArrayList<>(); |
| | | list.addAll(uidList); |
| | | return userInfoMapper.listByUids(list); |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | //保存 |
| | | userInfoMapper.insertSelective(userInfo); |
| | | |
| | | //添加验证码 |
| | | userExtraInfoService.setInviteCode(userInfo.getId(), InviteCodeUtil.createInviteCode(userInfo.getId())); |
| | | } |
| | | |
| | | @Override |
| | |
| | | return wXUserInfo; |
| | | } |
| | | |
| | | @Override |
| | | public void update(WXUserInfo wXUserInfo) { |
| | | if (wXUserInfo.getUpdateTime() == null) { |
| | | wXUserInfo.setUpdateTime(new Date()); |
| | |
| | | return list.get(0); |
| | | } |
| | | |
| | | @Override |
| | | public WXUserInfo selectByUid(Long uid) { |
| | | DaoQuery daoQuery = new DaoQuery(); |
| | | daoQuery.uid = uid; |
| | | daoQuery.count = 1; |
| | | List<WXUserInfo> list = wXUserInfoMapper.list(daoQuery); |
| | | if (list == null || list.size() == 0) { |
| | | return null; |
| | | } |
| | | return list.get(0); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.makemoney.app.service.inter.goldcorn; |
| | | |
| | | import java.lang.Exception; |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornConsumeRecordException; |
| | | import org.yeshi.utils.bean.BeanUtil; |
| | | import java.util.List; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornConsumeRecord; |
| | | import com.yeshi.makemoney.app.service.inter.goldcorn.GoldCornConsumeRecordService; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornConsumeRecordException; |
| | | import com.yeshi.makemoney.app.service.query.goldcorn.GoldCornConsumeRecordQuery; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | public interface GoldCornConsumeRecordService { |
| | | |
| | |
| | | public Integer getPriceCornNum(SystemEnum system, GoldCornGetType type, Date date, boolean hasBoss); |
| | | |
| | | |
| | | /** |
| | | * @return java.lang.Integer |
| | | * @author hxh |
| | | * @description 获取签到的价格 |
| | | * @date 16:25 2022/4/21 |
| | | * @param: continueDay 连续签到天数 |
| | | **/ |
| | | public Integer getSingInPrice(SystemEnum system, int continueDay); |
| | | |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @description 获取连续签到的价格列表 |
| | | * @date 16:26 2022/4/21 |
| | | * @param: system |
| | | * @return java.util.List<java.lang.Integer> |
| | | **/ |
| | | public List<Integer> getSingInPriceList(SystemEnum system); |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.makemoney.app.service.inter.goldcorn; |
| | | |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetRecord; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetRecordException; |
| | | import com.yeshi.makemoney.app.service.query.goldcorn.GoldCornGetRecordQuery; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | public void update(GoldCornGetRecord goldCornGetRecord); |
| | | |
| | | |
| | | public Long getGoldCornByDay(Long uid, String day); |
| | | public Long getGoldCornByDay(Long uid, Date day); |
| | | |
| | | |
| | | /** |
| | |
| | | **/ |
| | | public Map<Long, Integer> sumGoldCornByFromUids(Long uid, List<Long> fromUidList, String day); |
| | | |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @description 获取连续任务的天数 |
| | | * @date 16:39 2022/4/21 |
| | | * @param: uid |
| | | * @param: type |
| | | * @param: deadDate |
| | | * @return int |
| | | **/ |
| | | public int getContinueDay(Long uid, GoldCornGetType type,Date deadDate); |
| | | |
| | | } |
| | |
| | | package com.yeshi.makemoney.app.service.inter.goldcorn; |
| | | |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetRecord; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetFrequencyConfigException; |
| | | import com.yeshi.makemoney.app.exception.goldcorn.GoldCornGetPriceException; |
| | |
| | | * @param: isDouble 是否加倍 |
| | | * @param: time 发生时间 |
| | | **/ |
| | | public void addGoldCorn(Long uid, GoldCornGetType type,boolean isDouble, Date time) throws UserInfoException, GoldCornGetPriceException, GoldCornGetFrequencyConfigException, GoldCornMakeException; |
| | | public GoldCornGetRecord addGoldCorn(Long uid, GoldCornGetType type, boolean isDouble, Date time, Integer price) throws UserInfoException, GoldCornGetPriceException, GoldCornGetFrequencyConfigException, GoldCornMakeException; |
| | | |
| | | |
| | | /** |
| | |
| | | * @param: uid |
| | | * @param: day |
| | | **/ |
| | | public Long getGoldCornByDay(Long uid, String day); |
| | | public Long getGoldCornByDay(Long uid, Date day); |
| | | |
| | | |
| | | /** |
| | | * @return java.lang.Long |
| | | * @author hxh |
| | | * @description 获取正在折算中的金币数量 |
| | | * @date 11:21 2022/4/21 |
| | | * @param: uid |
| | | **/ |
| | | public Long getExchangingGoldCorn(Long uid, int dayCount); |
| | | |
| | | /** |
| | | * @return int |
| | | * @author hxh |
| | | * @description 获取连续签到的天数 |
| | | * @date 16:24 2022/4/21 |
| | | * @param: uid |
| | | **/ |
| | | public int getContinueSignDay(Long uid); |
| | | |
| | | |
| | | /** |
| | | * @return boolean |
| | | * @author hxh |
| | | * @description 是否签到 |
| | | * @date 17:05 2022/4/21 |
| | | * @param: uid |
| | | * @param: date |
| | | **/ |
| | | public boolean isSignIn(Long uid, Date date); |
| | | |
| | | |
| | | /** |
| | | * @return com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetRecord |
| | | * @author hxh |
| | | * @description 签到 |
| | | * @date 19:14 2022/4/21 |
| | | * @param: uid |
| | | **/ |
| | | public GoldCornGetRecord signIn(Long uid) throws GoldCornGetFrequencyConfigException, UserInfoException, GoldCornGetPriceException, GoldCornMakeException; |
| | | |
| | | |
| | | } |
| | |
| | | import com.yeshi.makemoney.app.exception.user.UserInfoException; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author hxh |
| | |
| | | * @date 11:46 2022/4/7 |
| | | * @param: day |
| | | **/ |
| | | public void startSettle(String day); |
| | | public void startSettle(Date day); |
| | | |
| | | |
| | | /** |
| | |
| | | * @param: day |
| | | * @param: rate 汇率 |
| | | **/ |
| | | public void settle(Long uid, String day, BigDecimal rate) throws GoldCornConsumeRecordException, UserMoneyRecordException; |
| | | public void settle(Long uid, Date day, BigDecimal rate) throws GoldCornConsumeRecordException, UserMoneyRecordException; |
| | | |
| | | |
| | | /** |
| | |
| | | * @param: uid |
| | | * @param: day |
| | | **/ |
| | | public void settle(Long uid, String day) throws UserInfoException, GoldCornMoneyExchangeRateRecordException, UserMoneyRecordException, GoldCornConsumeRecordException; |
| | | public void settle(Long uid, Date day) throws UserInfoException, GoldCornMoneyExchangeRateRecordException, UserMoneyRecordException, GoldCornConsumeRecordException; |
| | | |
| | | |
| | | } |
| | |
| | | package com.yeshi.makemoney.app.service.inter.money; |
| | | |
| | | import com.ks.lib.common.exception.ParamsException; |
| | | import com.yeshi.makemoney.app.dto.money.ExtractConfig; |
| | | import com.yeshi.makemoney.app.dto.mq.ExtractTransferResultMQMsg; |
| | | import com.yeshi.makemoney.app.entity.SystemEnum; |
| | | import com.yeshi.makemoney.app.entity.money.Extract; |
| | | import com.yeshi.makemoney.app.exception.money.ExtractException; |
| | | import com.yeshi.makemoney.app.exception.money.UserMoneyBalanceException; |
| | |
| | | public boolean canExtractLittleMoney(Long uid, int maxNewerCount, Date date); |
| | | |
| | | |
| | | /** |
| | | * @return java.math.BigDecimal |
| | | * @author hxh |
| | | * @description 正在提现中的金额 |
| | | * @date 17:51 2022/4/20 |
| | | * @param: uid |
| | | **/ |
| | | public BigDecimal getExtractingMoney(Long uid); |
| | | |
| | | /** |
| | | * @return com.yeshi.makemoney.app.dto.money.ExtractConfig |
| | | * @author hxh |
| | | * @description 获取提现配置 |
| | | * @date 17:57 2022/4/20 |
| | | * @param: system |
| | | **/ |
| | | public ExtractConfig getExtractConfig(SystemEnum system); |
| | | |
| | | |
| | | } |
| | |
| | | public void setInviteCode(Long uid, String code); |
| | | |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @description 根据邀请码查询用户ID |
| | | * @date 11:55 2022/4/20 |
| | | * @param: inviteCode |
| | | * @return java.lang.Long |
| | | **/ |
| | | public Long selectUidByInviteCode(String inviteCode); |
| | | |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @description 设置签到自动提醒 |
| | | * @date 15:22 2022/4/21 |
| | | * @param: uid |
| | | * @param: notify |
| | | * @return void |
| | | **/ |
| | | public void setSignInNotify(Long uid,boolean notify); |
| | | |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @description 获取签到自动提醒 |
| | | * @date 15:23 2022/4/21 |
| | | * @param: uid |
| | | * @return boolean |
| | | **/ |
| | | public boolean getSignInNotify(Long uid); |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import java.lang.Exception; |
| | | import javax.annotation.Resource; |
| | | import java.util.Collection; |
| | | import java.util.Date; |
| | | |
| | | import com.yeshi.makemoney.app.entity.SystemEnum; |
| | |
| | | public List<UserInfo> list(UserInfoQuery userInfoQuery, int page, int pageSize); |
| | | |
| | | |
| | | public List<UserInfo> list(List<Long> uidList); |
| | | public List<UserInfo> list(Collection<Long> uidList); |
| | | |
| | | /** |
| | | * |
| | |
| | | WXUserInfo selectBySystemAndUnionId(SystemEnum system, String unionId); |
| | | |
| | | |
| | | WXUserInfo selectByUid(Long uid); |
| | | |
| | | |
| | | } |
| | |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | import com.yeshi.makemoney.app.service.query.BaseQuery; |
| | | |
| | | import java.util.List; |
| | | |
| | | public class GoldCornGetRecordQuery extends BaseQuery { |
| | | private GoldCornGetType type; |
| | | private Long uid; |
| | | |
| | | private String day; |
| | | |
| | | private List<String> dayList; |
| | | |
| | | public GoldCornGetType getType() { |
| | | return type; |
| | |
| | | public void setUid(Long uid) { |
| | | this.uid = uid; |
| | | } |
| | | |
| | | public String getDay() { |
| | | return day; |
| | | } |
| | | |
| | | public void setDay(String day) { |
| | | this.day = day; |
| | | } |
| | | |
| | | public List<String> getDayList() { |
| | | return dayList; |
| | | } |
| | | |
| | | public void setDayList(List<String> dayList) { |
| | | this.dayList = dayList; |
| | | } |
| | | } |
| | |
| | | |
| | | //尚未登录 |
| | | public final static int CODE_FAIL_NOT_LOGIN = 101; |
| | | |
| | | |
| | | //需要观看激励视频 |
| | | public final static int CODE_NEED_WATCH_REWARD_VIDEO = 501; |
| | | } |
| | |
| | | import com.yeshi.makemoney.app.dto.config.WXTransferConfig; |
| | | import org.yeshi.utils.annotation.MapUtil; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.Properties; |
| | | |
| | | /** |
| | |
| | | public static WXTransferConfig wxTransferConfig; |
| | | |
| | | static { |
| | | if (alipayConfig == null) { |
| | | Properties ps = org.yeshi.utils.PropertiesUtil |
| | | .getProperties(Constant.class.getClassLoader().getResourceAsStream("alipay.properties")); |
| | | alipayConfig = (AlipayConfig) MapUtil.parseMap(AlipayConfig.class, ps); |
| | | } |
| | | if (wxTransferConfig == null) { |
| | | Properties ps = org.yeshi.utils.PropertiesUtil |
| | | .getProperties(Constant.class.getClassLoader().getResourceAsStream("wx_transfer.properties")); |
| | | wxTransferConfig = (WXTransferConfig) MapUtil.parseMap(WXTransferConfig.class, ps); |
| | | } |
| | | //TODO |
| | | // if (alipayConfig == null) { |
| | | // Properties ps = org.yeshi.utils.PropertiesUtil |
| | | // .getProperties(Constant.class.getClassLoader().getResourceAsStream("alipay.properties")); |
| | | // alipayConfig = (AlipayConfig) MapUtil.parseMap(AlipayConfig.class, ps); |
| | | // } |
| | | // if (wxTransferConfig == null) { |
| | | // Properties ps = org.yeshi.utils.PropertiesUtil |
| | | // .getProperties(Constant.class.getClassLoader().getResourceAsStream("wx_transfer.properties")); |
| | | // wxTransferConfig = (WXTransferConfig) MapUtil.parseMap(WXTransferConfig.class, ps); |
| | | // } |
| | | } |
| | | |
| | | |
| | | public final static int PAGE_SIZE = 20; |
| | | |
| | | //小金额提现的限制 |
| | | public final static BigDecimal EXTRACT_LITTLE_MONEY_LIMIT = new BigDecimal(1); |
| | | |
| | | |
| | | } |
| | |
| | | **/ |
| | | public static String getCOSImageUrl(String key) { |
| | | return getVisitDomain() + key; |
| | | } |
| | | |
| | | |
| | | public static String getUrlKey(String imgUrl) { |
| | | String url = imgUrl.replace("http://", "").replace("https://", ""); |
| | | String key = url.substring(url.indexOf("/")); |
| | | return key; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.utils.factory.goldcorn; |
| | | |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornConsumeRecord; |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornConsumeType; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.math.RoundingMode; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: GoldCornConsumeRecordFactory |
| | | * @description: 金币消费记录工厂 |
| | | * @date 2022/4/21 11:28 |
| | | */ |
| | | public class GoldCornConsumeRecordFactory { |
| | | |
| | | public static GoldCornConsumeRecord createExchange(Long uid, String day, int cornNum, BigDecimal rate) { |
| | | GoldCornConsumeRecord record = new GoldCornConsumeRecord(); |
| | | record.setUid(uid); |
| | | record.setCornNum(cornNum); |
| | | record.setMoney(rate.multiply(new BigDecimal(record.getCornNum())).setScale(2, RoundingMode.FLOOR)); |
| | | record.setType(GoldCornConsumeType.changeMoney); |
| | | record.setId(uid + "-" + record.getType().name() + "-" + day); |
| | | return record; |
| | | } |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.utils.goldcorn; |
| | | |
| | | import org.yeshi.utils.TimeUtil; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: GoldCornUtil |
| | | * @description: 金币帮助类 |
| | | * @date 2022/4/21 11:15 |
| | | */ |
| | | public class GoldCornUtil { |
| | | |
| | | /** |
| | | * @return java.lang.String |
| | | * @author hxh |
| | | * @description 获取格式化的天数 |
| | | * @date 11:16 2022/4/21 |
| | | * @param: day |
| | | **/ |
| | | public static String getFormatDay(Date day) { |
| | | return TimeUtil.getGernalTime(day.getTime(), "yyyy-MM-dd"); |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.utils.user; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: InviteCodeUtil |
| | | * @description: 邀请码工具类 |
| | | * @date 2022/4/18 15:25 |
| | | */ |
| | | public class InviteCodeUtil { |
| | | |
| | | public static String createInviteCode(Long uid) { |
| | | return createInviteCode((int) (Math.random() * 10 + 1), uid); |
| | | } |
| | | |
| | | |
| | | public static String createInviteCode(int base, Long uid) { |
| | | |
| | | long num = base * 100000000L + uid; |
| | | |
| | | return convert10To36(num); |
| | | } |
| | | |
| | | |
| | | private static String convert10To36(Long num) { |
| | | String numbers = "YE9VFA3N6KG7JZH4LD5IO2RBS0QTMPU1WC8X"; |
| | | BigDecimal numBig = new BigDecimal(num); |
| | | |
| | | int ge = numBig.divideAndRemainder(new BigDecimal(36))[1].intValue(); |
| | | int n = 1; |
| | | String result = ""; |
| | | result += numbers.charAt(ge); |
| | | |
| | | while (numBig.divideAndRemainder(new BigDecimal(36).pow(n))[0].compareTo(new BigDecimal(0)) > 0) { |
| | | int w = numBig.divideAndRemainder(new BigDecimal(36).pow(n))[0].divideAndRemainder(new BigDecimal(36))[1] |
| | | .intValue(); |
| | | result = numbers.charAt(w) + result; |
| | | n++; |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.utils.user; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: UserVOUtil |
| | | * @description: TODO |
| | | * @date 2022/4/18 15:45 |
| | | */ |
| | | public class UserVOUtil { |
| | | |
| | | public static String getCoverPhone(String phone) { |
| | | if (phone == null) { |
| | | return phone; |
| | | } |
| | | if (phone.length() >= 5) { |
| | | String st = phone.substring(0, 3); |
| | | st += "******"; |
| | | st += phone.substring(phone.length() - 2, phone.length()); |
| | | return st; |
| | | } |
| | | return phone; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.vo.goldcorn; |
| | | |
| | | import com.yeshi.makemoney.app.entity.goldcorn.GoldCornGetType; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: GoldCornDoTaskVO |
| | | * @description: 做任务 |
| | | * @date 2022/4/21 13:46 |
| | | */ |
| | | public class GoldCornDoTaskVO { |
| | | |
| | | private GoldCornGetType type; |
| | | private Boolean isDouble; |
| | | private Long finishTime; |
| | | |
| | | |
| | | public GoldCornGetType getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(GoldCornGetType type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public Boolean getDouble() { |
| | | return isDouble; |
| | | } |
| | | |
| | | public void setDouble(Boolean aDouble) { |
| | | isDouble = aDouble; |
| | | } |
| | | |
| | | public Long getFinishTime() { |
| | | return finishTime; |
| | | } |
| | | |
| | | public void setFinishTime(Long finishTime) { |
| | | this.finishTime = finishTime; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.vo.goldcorn; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: GoldCornGetRecordVO |
| | | * @description: 金币折算记录 |
| | | * @date 2022/4/21 11:45 |
| | | */ |
| | | public class GoldCornExchangeRecordVO { |
| | | |
| | | private String money; |
| | | private String dateTime; |
| | | private int num; |
| | | |
| | | |
| | | public String getMoney() { |
| | | return money; |
| | | } |
| | | |
| | | public void setMoney(String money) { |
| | | this.money = money; |
| | | } |
| | | |
| | | public String getDateTime() { |
| | | return dateTime; |
| | | } |
| | | |
| | | public void setDateTime(String dateTime) { |
| | | this.dateTime = dateTime; |
| | | } |
| | | |
| | | public int getNum() { |
| | | return num; |
| | | } |
| | | |
| | | public void setNum(int num) { |
| | | this.num = num; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.vo.goldcorn; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: GoldCornGetRecordVO |
| | | * @description: 金币获得记录列表 |
| | | * @date 2022/4/21 11:45 |
| | | */ |
| | | public class GoldCornGetRecordVO { |
| | | |
| | | private String title; |
| | | private String dateTime; |
| | | private int num; |
| | | |
| | | public String getTitle() { |
| | | return title; |
| | | } |
| | | |
| | | public void setTitle(String title) { |
| | | this.title = title; |
| | | } |
| | | |
| | | public String getDateTime() { |
| | | return dateTime; |
| | | } |
| | | |
| | | public void setDateTime(String dateTime) { |
| | | this.dateTime = dateTime; |
| | | } |
| | | |
| | | public int getNum() { |
| | | return num; |
| | | } |
| | | |
| | | public void setNum(int num) { |
| | | this.num = num; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.vo.goldcorn; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: ExtractInfoVO |
| | | * @description: 用户金币信息 |
| | | * @date 2022/4/20 17:39 |
| | | */ |
| | | public class GoldCornInfoVO { |
| | | |
| | | private int balance; |
| | | private int exchanging; |
| | | |
| | | |
| | | public int getBalance() { |
| | | return balance; |
| | | } |
| | | |
| | | public void setBalance(int balance) { |
| | | this.balance = balance; |
| | | } |
| | | |
| | | public int getExchanging() { |
| | | return exchanging; |
| | | } |
| | | |
| | | public void setExchanging(int exchanging) { |
| | | this.exchanging = exchanging; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.vo.goldcorn; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: SignInfoVO |
| | | * @description: 签到信息 |
| | | * @date 2022/4/21 15:28 |
| | | */ |
| | | public class SignInInfoVO { |
| | | /** |
| | | * 连续签到天数 |
| | | **/ |
| | | private int continueSignInDay; |
| | | |
| | | |
| | | /** |
| | | * 是否签到提醒 |
| | | **/ |
| | | private boolean notify; |
| | | |
| | | /** |
| | | * 是否已经签到 |
| | | **/ |
| | | private boolean isSignIned; |
| | | |
| | | /** |
| | | * 天数列表 |
| | | **/ |
| | | private List<SignInDayInfo> dayList; |
| | | |
| | | |
| | | public int getContinueSignInDay() { |
| | | return continueSignInDay; |
| | | } |
| | | |
| | | public void setContinueSignInDay(int continueSignInDay) { |
| | | this.continueSignInDay = continueSignInDay; |
| | | } |
| | | |
| | | public boolean isNotify() { |
| | | return notify; |
| | | } |
| | | |
| | | public void setNotify(boolean notify) { |
| | | this.notify = notify; |
| | | } |
| | | |
| | | public boolean isSignIned() { |
| | | return isSignIned; |
| | | } |
| | | |
| | | public void setSignIned(boolean signIned) { |
| | | isSignIned = signIned; |
| | | } |
| | | |
| | | public List<SignInDayInfo> getDayList() { |
| | | return dayList; |
| | | } |
| | | |
| | | public void setDayList(List<SignInDayInfo> dayList) { |
| | | this.dayList = dayList; |
| | | } |
| | | |
| | | public static class SignInDayInfo { |
| | | |
| | | //错过 |
| | | public static final int STATE_MISS = 0; |
| | | |
| | | //已经获得 |
| | | public static final int STATE_GOT = 1; |
| | | |
| | | //还没有获得 |
| | | public static final int STATE_NOT_GOT = 2; |
| | | |
| | | /** |
| | | * 是否是今天 |
| | | **/ |
| | | private boolean today; |
| | | |
| | | /** |
| | | * 状态 |
| | | **/ |
| | | private int state; |
| | | |
| | | /** |
| | | * 金币数 |
| | | **/ |
| | | private int goldCorn; |
| | | |
| | | /** |
| | | * 天数描述 |
| | | **/ |
| | | private String day; |
| | | |
| | | /** |
| | | * 临时日期变量 |
| | | **/ |
| | | private Date date; |
| | | |
| | | public boolean isToday() { |
| | | return today; |
| | | } |
| | | |
| | | public void setToday(boolean today) { |
| | | this.today = today; |
| | | } |
| | | |
| | | public int getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(int state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public int getGoldCorn() { |
| | | return goldCorn; |
| | | } |
| | | |
| | | public void setGoldCorn(int goldCorn) { |
| | | this.goldCorn = goldCorn; |
| | | } |
| | | |
| | | public String getDay() { |
| | | return day; |
| | | } |
| | | |
| | | public void setDay(String day) { |
| | | this.day = day; |
| | | } |
| | | |
| | | public Date getDate() { |
| | | return date; |
| | | } |
| | | |
| | | public void setDate(Date date) { |
| | | this.date = date; |
| | | } |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.vo.team; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: TeamInfoVO |
| | | * @description: 团队信息 |
| | | * @date 2022/4/20 13:59 |
| | | */ |
| | | public class TeamInfoVO { |
| | | private boolean hasBoss; |
| | | private int firstTeamCount; |
| | | private int secondTeamCount; |
| | | |
| | | public boolean isHasBoss() { |
| | | return hasBoss; |
| | | } |
| | | |
| | | public void setHasBoss(boolean hasBoss) { |
| | | this.hasBoss = hasBoss; |
| | | } |
| | | |
| | | public int getFirstTeamCount() { |
| | | return firstTeamCount; |
| | | } |
| | | |
| | | public void setFirstTeamCount(int firstTeamCount) { |
| | | this.firstTeamCount = firstTeamCount; |
| | | } |
| | | |
| | | public int getSecondTeamCount() { |
| | | return secondTeamCount; |
| | | } |
| | | |
| | | public void setSecondTeamCount(int secondTeamCount) { |
| | | this.secondTeamCount = secondTeamCount; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.vo.team; |
| | | |
| | | import com.yeshi.makemoney.app.vo.user.UserInfoVO; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: TeamListVO |
| | | * @description: 队员列表 |
| | | * @date 2022/4/20 15:13 |
| | | */ |
| | | public class TeamMemberListVO { |
| | | |
| | | private UserInfoVO user; |
| | | private String tag; |
| | | private String joinTime; |
| | | private Integer todayGoldCorn; |
| | | |
| | | public UserInfoVO getUser() { |
| | | return user; |
| | | } |
| | | |
| | | public void setUser(UserInfoVO user) { |
| | | this.user = user; |
| | | } |
| | | |
| | | public String getTag() { |
| | | return tag; |
| | | } |
| | | |
| | | public void setTag(String tag) { |
| | | this.tag = tag; |
| | | } |
| | | |
| | | public String getJoinTime() { |
| | | return joinTime; |
| | | } |
| | | |
| | | public void setJoinTime(String joinTime) { |
| | | this.joinTime = joinTime; |
| | | } |
| | | |
| | | public Integer getTodayGoldCorn() { |
| | | return todayGoldCorn; |
| | | } |
| | | |
| | | public void setTodayGoldCorn(Integer todayGoldCorn) { |
| | | this.todayGoldCorn = todayGoldCorn; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.vo.user; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: ExtractDenominationVO |
| | | * @description: 可提现面额 |
| | | * @date 2022/4/20 17:43 |
| | | */ |
| | | public class ExtractDenominationVO { |
| | | |
| | | private BigDecimal money; |
| | | private String tag; |
| | | |
| | | |
| | | public BigDecimal getMoney() { |
| | | return money; |
| | | } |
| | | |
| | | public void setMoney(BigDecimal money) { |
| | | this.money = money; |
| | | } |
| | | |
| | | public String getTag() { |
| | | return tag; |
| | | } |
| | | |
| | | public void setTag(String tag) { |
| | | this.tag = tag; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.vo.user; |
| | | |
| | | import java.math.BigDecimal; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: ExtractInfoVO |
| | | * @description: 用户提现信息 |
| | | * @date 2022/4/20 17:39 |
| | | */ |
| | | public class ExtractInfoVO { |
| | | |
| | | private BigDecimal balance; |
| | | private String extracting; |
| | | private boolean needBindWX; |
| | | |
| | | public BigDecimal getBalance() { |
| | | return balance; |
| | | } |
| | | |
| | | public void setBalance(BigDecimal balance) { |
| | | this.balance = balance; |
| | | } |
| | | |
| | | public String getExtracting() { |
| | | return extracting; |
| | | } |
| | | |
| | | public void setExtracting(String extracting) { |
| | | this.extracting = extracting; |
| | | } |
| | | |
| | | public boolean isNeedBindWX() { |
| | | return needBindWX; |
| | | } |
| | | |
| | | public void setNeedBindWX(boolean needBindWX) { |
| | | this.needBindWX = needBindWX; |
| | | } |
| | | } |
New file |
| | |
| | | package com.yeshi.makemoney.app.vo.user; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: UserAssetsVO |
| | | * @description: 用户资产 |
| | | * @date 2022/4/20 14:36 |
| | | */ |
| | | public class UserAssetsVO { |
| | | private int goldCorn; |
| | | private String balance; |
| | | |
| | | public int getGoldCorn() { |
| | | return goldCorn; |
| | | } |
| | | |
| | | public void setGoldCorn(int goldCorn) { |
| | | this.goldCorn = goldCorn; |
| | | } |
| | | |
| | | public String getBalance() { |
| | | return balance; |
| | | } |
| | | |
| | | public void setBalance(String balance) { |
| | | this.balance = balance; |
| | | } |
| | | } |
| | |
| | | package com.yeshi.makemoney.app.vo.user; |
| | | |
| | | import com.yeshi.makemoney.app.entity.user.UserExtraInfo; |
| | | import com.yeshi.makemoney.app.entity.user.UserInfo; |
| | | import com.yeshi.makemoney.app.entity.user.WXUserInfo; |
| | | import com.yeshi.makemoney.app.utils.user.UserVOUtil; |
| | | import org.yeshi.utils.StringUtil; |
| | | |
| | | /** |
| | | * @author hxh |
| | | * @title: UserInfoVO |
| | |
| | | private String nickName; |
| | | private String portrait; |
| | | //VIP到期时间 |
| | | private Long vipExpireTime; |
| | | private String phone; |
| | | |
| | | private String wxNickName; |
| | | |
| | | private String inviteCode; |
| | | |
| | | private Boolean hasBoss; |
| | | |
| | | private Integer unReadMsgCount; |
| | | |
| | | public static UserInfoVO create(UserInfo user) { |
| | | UserInfoVO vo = new UserInfoVO(); |
| | | vo.setId(user.getId() + ""); |
| | | vo.setNickName(user.getNickName()); |
| | | vo.setPortrait(user.getPortrait()); |
| | | vo.setPhone(UserVOUtil.getCoverPhone(user.getPhone())); |
| | | return vo; |
| | | } |
| | | |
| | | public static UserInfoVO create(UserInfo user, UserExtraInfo extraInfo) { |
| | | UserInfoVO vo = create(user); |
| | | vo.setInviteCode(extraInfo.getInviteCode()); |
| | | if (extraInfo.getUnReadMsgCount() == null) { |
| | | vo.setUnReadMsgCount(0); |
| | | } else { |
| | | vo.setUnReadMsgCount(extraInfo.getUnReadMsgCount()); |
| | | } |
| | | return vo; |
| | | } |
| | | |
| | | public static UserInfoVO create(UserInfo user, UserExtraInfo extraInfo, WXUserInfo wxUserInfo) { |
| | | UserInfoVO vo = create(user, extraInfo); |
| | | if (wxUserInfo != null) { |
| | | vo.setWxNickName(wxUserInfo.getNickName()); |
| | | } |
| | | return vo; |
| | | } |
| | | |
| | | |
| | | public String getId() { |
| | | return id; |
| | |
| | | this.portrait = portrait; |
| | | } |
| | | |
| | | public Long getVipExpireTime() { |
| | | return vipExpireTime; |
| | | public String getPhone() { |
| | | return phone; |
| | | } |
| | | |
| | | public void setVipExpireTime(Long vipExpireTime) { |
| | | this.vipExpireTime = vipExpireTime; |
| | | public void setPhone(String phone) { |
| | | this.phone = phone; |
| | | } |
| | | |
| | | public String getWxNickName() { |
| | | return wxNickName; |
| | | } |
| | | |
| | | public void setWxNickName(String wxNickName) { |
| | | this.wxNickName = wxNickName; |
| | | } |
| | | |
| | | public String getInviteCode() { |
| | | return inviteCode; |
| | | } |
| | | |
| | | public void setInviteCode(String inviteCode) { |
| | | this.inviteCode = inviteCode; |
| | | } |
| | | |
| | | public Boolean getHasBoss() { |
| | | return hasBoss; |
| | | } |
| | | |
| | | public void setHasBoss(Boolean hasBoss) { |
| | | this.hasBoss = hasBoss; |
| | | } |
| | | |
| | | public Integer getUnReadMsgCount() { |
| | | return unReadMsgCount; |
| | | } |
| | | |
| | | public void setUnReadMsgCount(Integer unReadMsgCount) { |
| | | this.unReadMsgCount = unReadMsgCount; |
| | | } |
| | | } |
| | |
| | | app_cert_path=alipay/appCertPublicKey_2018120462438303.crt |
| | | alipay_root_cert_path=alipay/alipayRootCert.crt |
| | | alipay_cert_path=alipay/alipayCertPublicKey_RSA2.crt |
| | | |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.yeshi.makemoney.app.mapper.user.WXUserInfoMapper"> |
| | | <mapper namespace="com.yeshi.makemoney.app.dao.user.WXUserInfoMapper"> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.makemoney.app.entity.user.WXUserInfo"> |
| | | <id column="id" property="id" jdbcType="BIGINT"/> |
| | | <result column="system" property="system" jdbcType="VARCHAR"/> |
| | | <result column="nick_name" property="nickName" jdbcType="VARCHAR"/> |
| | | <result column="sex" property="sex" jdbcType="INTEGER"/> |
| | | <result column="uid" property="uid" jdbcType="BIGINT"/> |
| | | <result column="province" property="province" jdbcType="VARCHAR"/> |
| | | <result column="city" property="city" jdbcType="VARCHAR"/> |
| | | <result column="country" property="country" jdbcType="VARCHAR"/> |
| | |
| | | |
| | | <sql id="Base_Column_List"> |
| | | <trim suffixOverrides=","> |
| | | id, system,nick_name,sex,province,city,country,head_img_url,open_id,union_id,create_time,update_time, |
| | | id,uid, system,nick_name,sex,province,city,country,head_img_url,open_id,union_id,create_time,update_time, |
| | | </trim> |
| | | </sql> |
| | | |
| | |
| | | insert into |
| | | mm_user_wx |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | uid, |
| | | system, |
| | | nick_name, |
| | | sex, |
| | |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | #{uid},jdbcType=BIGINT}, |
| | | #{system},jdbcType=VARCHAR}, |
| | | #{nickName},jdbcType=VARCHAR}, |
| | | #{sex},jdbcType=INTEGER}, |
| | |
| | | insert into mm_user_wx |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">id,</if> |
| | | <if test="uid != null">uid,</if> |
| | | <if test="system != null">system,</if> |
| | | <if test="nickName != null">nick_name,</if> |
| | | <if test="sex != null">sex,</if> |
| | |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="uid != null">#{uid,jdbcType=BIGINT},</if> |
| | | <if test="system != null">#{system,jdbcType=VARCHAR},</if> |
| | | <if test="nickName != null">#{nickName,jdbcType=VARCHAR},</if> |
| | | <if test="sex != null">#{sex,jdbcType=INTEGER},</if> |
| | |
| | | update mm_user_wx |
| | | <set> |
| | | <if test="id != null">id = #{id,jdbcType=BIGINT},</if> |
| | | <if test="uid != null">uid = #{uid,jdbcType=BIGINT},</if> |
| | | <if test="system != null">system = #{system,jdbcType=VARCHAR},</if> |
| | | <if test="nickName != null">nick_name = #{nickName,jdbcType=VARCHAR},</if> |
| | | <if test="sex != null">sex = #{sex,jdbcType=INTEGER},</if> |
| | |
| | | parameterType="com.yeshi.makemoney.app.entity.user.WXUserInfo"> |
| | | update mm_user_wx |
| | | <set> |
| | | <if test="uid != null">uid = #{uid,jdbcType=BIGINT},</if> |
| | | <if test="system != null">system = #{system,jdbcType=VARCHAR},</if> |
| | | <if test="nickName != null">nick_name = #{nickName,jdbcType=VARCHAR},</if> |
| | | <if test="sex != null">sex = #{sex,jdbcType=INTEGER},</if> |
| | |
| | | <if test="query.unionId!=null"> |
| | | union_id=#{query.unionId} |
| | | </if> |
| | | |
| | | <if test="query.uid!=null"> |
| | | uid=#{query.uid} |
| | | </if> |
| | | </sql> |
| | | |
| | | <select id="list" |
| | |
| | | |
| | | <script> |
| | | var tableIns = null; |
| | | var app=null; |
| | | $(function () { |
| | | |
| | | var app = new Vue({ |
| | | app = new Vue({ |
| | | el: "#app", |
| | | data: { |
| | | key: '', |
| | |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | 备注</label> |
| | | <div class="layui-input-block"> |
| | | <textarea type="text" name="remarks" lay-verify="" placeholder="" autocomplete="off" rows="5" |
| | | class="layui-textarea"></textarea> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_remarks" class="layui-form-label"></label> |
| | | <button class="layui-btn" lay-filter="add" lay-submit="">确定</button> |
| | | </div> |
| | |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_appCode" class="layui-form-label"> |
| | | 备注</label> |
| | | <div class="layui-input-block"> |
| | | <textarea type="text" name="remarks" lay-verify="" placeholder="" autocomplete="off" rows="5" |
| | | class="layui-textarea"></textarea> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | <div class="layui-form-item"> |
| | | <label for="L_remarks" class="layui-form-label"></label> |
| | | <button class="layui-btn" lay-filter="update" lay-submit="">确定修改</button> |
| | | </div> |
| | |
| | | </li> |
| | | |
| | | <li> |
| | | <a onclick="xadmin.add_tab('金币设置(连续签到)','config/system_config_list.html?type=goldCorn')"> |
| | | <i class="iconfont"></i> |
| | | <cite>金币设置(连续签到)</cite></a> |
| | | </li> |
| | | |
| | | <li> |
| | | <a onclick="xadmin.add_tab('金币获取频率设置','goldcorn/gold_corn_get_frequency_config_list.html')"> |
| | | <i class="iconfont"></i> |
| | | <cite>金币获取频率设置</cite></a> |
| | |
| | | |
| | | @Test |
| | | public void statistic() { |
| | | Long count = goldCornGetRecordService.getGoldCornByDay(null, "2022-04-07"); |
| | | Long count = goldCornGetRecordService.getGoldCornByDay(null, new Date()); |
| | | System.out.println(count); |
| | | |
| | | count = goldCornGetRecordService.countUidsByDay("2022-04-07"); |
| | |
| | | @Test |
| | | public void makeGoldCorn() { |
| | | try { |
| | | goldCornMakeService.addGoldCorn(22380L, GoldCornGetType.watchVideo,false,new Date()); |
| | | goldCornMakeService.addGoldCorn(22384L, GoldCornGetType.watchVideo,false,new Date(),null); |
| | | // goldCornMakeService.addGoldCorn(22380L,GoldCornGetType.readNovel,new Date()); |
| | | } catch (UserInfoException e) { |
| | | e.printStackTrace(); |