| | |
| | | // String s = RandomUtil.randomNumbers(4); |
| | | // String s1 = "FZ" + time + s; |
| | | // System.err.println(s1); |
| | | // createUser(s1,"邱仕珍","00" |
| | | // ,"441622198609245260" |
| | | // ,"13682696011" |
| | | // ,"61485755117823"); |
| | | updateAccount("FZ17403857003793677","邱仕珍","13682696011" |
| | | ,"4367427200563236884"); |
| | | // createUser(s1,"周帅","00" |
| | | // ,"130682198203061982" |
| | | // ,"18132621790" |
| | | // ,"6221801210000822611"); |
| | | // updateAccount("FZ17403857003793677","邱仕珍","13682696011" |
| | | // ,"4367427200563236884"); |
| | | // updateAccount("test945622121","周帅","19983174515" |
| | | // ,"6228480469852935177"); |
| | | // balancePay("CZ09809217341", "FZ17343419268427877","0.01", ""); |
| | | // queryBalance("FZ17343419268427877"); |
| | | |
| | | // String decrypt = decrypt("z8Che/JwxrGj/oTOuAvU8HFN6vXL/OqeioV41ZuPV/xVQPt9vCHHc1R5LgAO51Hq5ilD9wqsminRvSiJj6Fs/Bfk8espZSOO2g1OE7FZyqcLB1w01MSWyxfQT8nc2GH/EfOKXCuaKBCeyW24OvW3ng=="); |
| | | // System.err.println(decrypt); |
| | | // balanceWithdraw("TX1000928371648172","0.01","FZ17343419268427877","https://xq.xqzhihui.com/api/user/client/app-user-withdraw/base/callbackA"); |
| | | queryUserList(); |
| | | queryUserList("441424198104061249"); |
| | | // queryBalanceList("FZ17427173417891435"); |
| | | // queryPayment("002212025032410341110750073154527547392"); |
| | | } |
| | | public static String queryUserList() |
| | | public static String queryUserList(String identifier) |
| | | throws Exception { |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | // data.put("app_id", APP_ID); |
| | | data.put("app_id", "app_e7301b75-19f1-40e5-96ac-0fee847d4da0"); |
| | | data.put("member_type", "01"); |
| | | data.put("identifier", "441622198609245260"); |
| | | data.put("identifier", identifier); |
| | | data.put("page_index", "1"); |
| | | data.put("page_size", "10"); |
| | | JSONObject body = new JSONObject(); |
| | |
| | | System.err.println(decrypt); |
| | | JSONObject jsonObject = JSONObject.parseObject(decrypt); |
| | | System.err.println(jsonObject); |
| | | return "success"; |
| | | if (jsonObject!=null){ |
| | | return jsonObject.getJSONObject("data").getString("member_id"); |
| | | } |
| | | return null; |
| | | } |
| | | /** |
| | | * 创建用户 |
| | |
| | | |
| | | JSONObject data = new JSONObject(); |
| | | // data.put("app_id", APP_ID); |
| | | data.put("app_id", "app_e7301b75-19f1-40e5-96ac-0fee847d4da0"); |
| | | data.put("app_id", APP_ID); |
| | | data.put("member_id", memberId); |
| | | data.put("member_type", "01"); |
| | | JSONObject body = new JSONObject(); |
| | | // body.put("merId", MER_ID); |
| | | body.put("merId", "1120241105365033"); |
| | |
| | | System.err.println(jsonObject); |
| | | return "success"; |
| | | } |
| | | public static String queryBalanceList() |
| | | public static String queryBalanceList(String member_id) |
| | | throws Exception { |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss"); |
| | | Date date = new Date(); |
| | |
| | | data.put("end_date", format); |
| | | data.put("page_index", "01"); |
| | | data.put("page_size", "01"); |
| | | data.put("member_id", "FZ17343419268427877"); |
| | | data.put("member_id", member_id); |
| | | JSONObject body = new JSONObject(); |
| | | // body.put("merId", MER_ID); |
| | | body.put("merId", "1120241105365033"); |
| | |
| | | clientMeditationVO.setRealLearnedNum(clientMeditationVO.getVirtualLearnedNum()+clientMeditationVO.getRealLearnedNum()); |
| | | } |
| | | }else{ |
| | | List<Order> data1 = remoteOrderService.getMeditationIsBuyAll(loginUser.getUserid()).getData(); |
| | | for (ClientMeditationVO clientMeditationVO : meditationListByCateId) { |
| | | clientMeditationVO.setIsBuy(2); |
| | | clientMeditationVO.setRealLearnedNum(clientMeditationVO.getVirtualLearnedNum()+clientMeditationVO.getRealLearnedNum()); |
| | | if (tokenService.getLoginUser()!=null){ |
| | | Order order = data1.stream().filter(e -> e.getBusinessId().equals(clientMeditationVO.getId())).findFirst().orElse(null); |
| | | if (order==null){ |
| | | clientMeditationVO.setIsBuy(2); |
| | | }else{ |
| | | clientMeditationVO.setIsBuy(1); |
| | | } |
| | | }else{ |
| | | clientMeditationVO.setIsBuy(2); |
| | | } |
| | | } |
| | | } |
| | | vo.setClientMeditationVOList(meditationListByCateId); |
| | |
| | | @ApiImplicitParam(name = "orderId", value = "订单id", dataType = "String", required = true), |
| | | }) |
| | | public R<String> queryPayment(@RequestParam(value = "orderId") String orderId) throws Exception { |
| | | JSONObject jsonObject = JuHeFuUtil.queryPayment(orderId); |
| | | return R.ok(jsonObject.getString("status")); |
| | | Order byId = orderService.getById(orderId); |
| | | if (byId==null){ |
| | | return R.fail("订单失效"); |
| | | } |
| | | if (byId.getPaymentStatus()==2){ |
| | | return R.ok("succeeded"); |
| | | }else if (byId.getPaymentStatus()==1){ |
| | | return R.fail("pending"); |
| | | }else{ |
| | | return R.fail("failed"); |
| | | } |
| | | |
| | | |
| | | } |
| | | @GetMapping("/getMeditationIsBuyAll/{id}") |
| | | public R<List<Order>> getMeditationIsBuyAll(@PathVariable("id")Long id) { |
| | |
| | | return R.tokenError("登录失效"); |
| | | } |
| | | Long userId = loginUser.getUserid(); |
| | | AppUser data2 = remoteAppUserService.getAppUserById(userId + "").getData(); |
| | | if (data2==null){ |
| | | return R.tokenError("登录失效"); |
| | | }else if (!StringUtils.hasLength(data2.getCellPhone())){ |
| | | return R.tokenError("登录失效"); |
| | | } |
| | | |
| | | try { |
| | | if (orderId!=null){ |
| | | Order order = orderService.getById(orderId); |
| | |
| | | import com.xinquan.common.core.utils.page.CollUtils; |
| | | import com.xinquan.common.core.utils.page.PageDTO; |
| | | import com.xinquan.common.core.web.domain.BaseModel; |
| | | import com.xinquan.common.core.web.page.PageInfo; |
| | | import com.xinquan.common.log.annotation.Log; |
| | | import com.xinquan.common.log.enums.BusinessType; |
| | | import com.xinquan.common.redis.service.RedisService; |
| | |
| | | .list(); |
| | | // 查询登录用户邀请了哪些人 |
| | | List<Long> collect = page.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | List<AppUserWalletRecord> list1 = appUserWalletRecordService.lambdaQuery().list(); |
| | | for (AppUser record : page) { |
| | | List<AppUserWalletRecord> list = appUserWalletRecordService.lambdaQuery().eq(AppUserWalletRecord::getAppUserId, userId) |
| | | .like(AppUserWalletRecord::getReason,"分佣").eq(AppUserWalletRecord::getChildAppUserId, record.getId()).list(); |
| | | List<AppUserWalletRecord> list = list1.stream().filter(e -> e.getAppUserId().equals(userId) && e.getReason().contains("分佣") |
| | | && e.getChildAppUserId().equals(record.getId()) |
| | | ).collect(Collectors.toList()); |
| | | |
| | | // List<AppUserWalletRecord> list = appUserWalletRecordService.lambdaQuery().eq(AppUserWalletRecord::getAppUserId, userId) |
| | | // .like(AppUserWalletRecord::getReason,"分佣").eq(AppUserWalletRecord::getChildAppUserId, record.getId()).list(); |
| | | BigDecimal reduce = list.stream().map(AppUserWalletRecord::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | record.setMoney(reduce); |
| | | } |
| | |
| | | .list(); |
| | | // 查询登录用户邀请了哪些人 |
| | | List<Long> collect = page.stream().map(AppUser::getId).collect(Collectors.toList()); |
| | | List<AppUserWalletRecord> list1 = appUserWalletRecordService.lambdaQuery().list(); |
| | | |
| | | for (AppUser record : page) { |
| | | List<AppUserWalletRecord> list = appUserWalletRecordService.lambdaQuery().eq(AppUserWalletRecord::getAppUserId, userId) |
| | | .like(AppUserWalletRecord::getReason,"分佣").eq(AppUserWalletRecord::getChildAppUserId, record.getId()).list(); |
| | | List<AppUserWalletRecord> list = list1.stream().filter(e -> e.getAppUserId().equals(Long.valueOf(userId)) |
| | | && e.getReason().contains("分佣") |
| | | && e.getChildAppUserId().equals(record.getId()) |
| | | ).collect(Collectors.toList()); |
| | | // List<AppUserWalletRecord> list = appUserWalletRecordService.lambdaQuery().eq(AppUserWalletRecord::getAppUserId, userId) |
| | | // .like(AppUserWalletRecord::getReason,"分佣") |
| | | // .eq(AppUserWalletRecord::getChildAppUserId, record.getId()).list(); |
| | | |
| | | BigDecimal reduce = list.stream().map(AppUserWalletRecord::getAmount).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | record.setMoney(reduce); |
| | | } |
| | |
| | | public R<PageDTO<InviteRankListVO>> inviteRankList( |
| | | @RequestParam(value = "pageCurr", defaultValue = "1") Integer pageCurr, |
| | | @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { |
| | | Page<AppUser> objectPage = new Page<>(pageCurr, pageSize); |
| | | Page<InviteRankListVO> objectPage = new Page<>(pageCurr, pageSize); |
| | | int pageNo = (pageCurr - 1) * pageSize; |
| | | |
| | | List<AppUser> page = appUserService.lambdaQuery().ne(AppUser::getUserStatus, 3) |
| | | .list(); |
| | | List<AppUser> res = new ArrayList<>(); |
| | | for (AppUser appUser : page) { |
| | | int size = appUserService.lambdaQuery().ne(AppUser::getUserStatus, 3) |
| | | .eq(AppUser::getInviteUserId, appUser.getId()) |
| | | .list().size(); |
| | | appUser.setCount(size); |
| | | if (size>0){ |
| | | res.add(appUser); |
| | | } |
| | | } |
| | | // 根据帮助人数 从大到小排序 |
| | | res.sort((o1, o2) -> o2.getCount() - o1.getCount()); |
| | | List<AppUser> testing = testing(res.size(), pageCurr, pageSize, res); |
| | | objectPage.setRecords(testing); |
| | | objectPage.setTotal(res.size()); |
| | | List<InviteRankListVO> list = appUserService.inviteRankList(pageNo,pageSize); |
| | | int size = appUserService.inviteRankListNolimit().size(); |
| | | objectPage.setRecords(list); |
| | | objectPage.setTotal(size); |
| | | return R.ok(PageDTO.of(objectPage, InviteRankListVO.class)) ; |
| | | // List<AppUser> page = appUserService.lambdaQuery().ne(AppUser::getUserStatus, 3) |
| | | // .list(); |
| | | // List<AppUser> res = new ArrayList<>(); |
| | | // for (AppUser appUser : page) { |
| | | // int size = appUserService.lambdaQuery().ne(AppUser::getUserStatus, 3) |
| | | // .eq(AppUser::getInviteUserId, appUser.getId()) |
| | | // .list().size(); |
| | | // appUser.setCount(size); |
| | | // if (size>0){ |
| | | // res.add(appUser); |
| | | // } |
| | | // } |
| | | // // 根据帮助人数 从大到小排序 |
| | | // res.sort((o1, o2) -> o2.getCount() - o1.getCount()); |
| | | // List<AppUser> testing = testing(res.size(), pageCurr, pageSize, res); |
| | | |
| | | } |
| | | public static List<AppUser> testing(long total, long current, long size, List<AppUser> str){ |
| | | List<AppUser> result = new ArrayList<>(); |
| | |
| | | public R<PageDTO<InviteRankListVO>> inviteRankListShare( |
| | | @RequestParam(value = "pageCurr", defaultValue = "1") Integer pageCurr, |
| | | @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { |
| | | Page<AppUser> objectPage = new Page<>(pageCurr, pageSize); |
| | | Page<InviteRankListVO> objectPage = new Page<>(pageCurr, pageSize); |
| | | int pageNo = (pageCurr - 1) * pageSize; |
| | | |
| | | List<AppUser> page = appUserService.lambdaQuery().ne(AppUser::getUserStatus, 3) |
| | | .list(); |
| | | List<AppUser> res = new ArrayList<>(); |
| | | for (AppUser appUser : page) { |
| | | int size = appUserService.lambdaQuery().ne(AppUser::getUserStatus, 3) |
| | | .eq(AppUser::getInviteUserId, appUser.getId()) |
| | | .list().size(); |
| | | appUser.setCount(size); |
| | | if (size>0){ |
| | | res.add(appUser); |
| | | } |
| | | } |
| | | // 根据帮助人数 从大到小排序 |
| | | res.sort((o1, o2) -> o2.getCount() - o1.getCount()); |
| | | List<AppUser> testing = testing(res.size(), pageCurr, pageSize, res); |
| | | objectPage.setRecords(testing); |
| | | objectPage.setTotal(res.size()); |
| | | List<InviteRankListVO> list = appUserService.inviteRankList(pageNo,pageSize); |
| | | int size = appUserService.inviteRankListNolimit().size(); |
| | | objectPage.setRecords(list); |
| | | objectPage.setTotal(size); |
| | | return R.ok(PageDTO.of(objectPage, InviteRankListVO.class)) ; |
| | | } |
| | | @PostMapping("/inviteRankListShareInfo") |
| | |
| | | appUserWalletRecord.setReason("提现"); |
| | | appUserWalletRecord.setAmount(new BigDecimal(money)); |
| | | BigDecimal bigDecimal1 = new BigDecimal(money).setScale(2, RoundingMode.HALF_DOWN); |
| | | String s2 = JuHeFuUtil.queryUserList(byId1.getIdentityCard()); |
| | | if (StringUtils.hasLength(s2)){ |
| | | byId.setFenzhangId(s2); |
| | | } |
| | | String s1 = JuHeFuUtil.updateAccount(byId.getFenzhangId(), byId1.getCardholder(), byId1.getCellPhone(), byId1.getCardNo()); |
| | | if (s1.contains("false")){ |
| | | if (!s1.contains("success")){ |
| | | // 修改报错 弹出提示 |
| | | return R.fail("银行卡信息或持卡人信息有误,请核对后输入"); |
| | | } |
| | |
| | | appUserBankService.save(appUserWithdraw); |
| | | // 查询是否已经开户 |
| | | AppUser byId = appUserService.getById(userId); |
| | | String s2 = JuHeFuUtil.queryUserList(appUserWithdraw.getIdentityCard()); |
| | | if (StringUtils.hasLength(s2)){ |
| | | byId.setFenzhangId(s2); |
| | | appUserService.updateById(byId); |
| | | } |
| | | if (byId.getFenzhangId()==null){ |
| | | // 开户 |
| | | long time = new Date().getTime(); |
| | |
| | | package com.xinquan.user.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.xinquan.common.core.web.page.PageInfo; |
| | | import com.xinquan.system.api.domain.AppUser; |
| | | import com.xinquan.system.api.domain.vo.InviteRankListVO; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | */ |
| | | public interface AppUserMapper extends BaseMapper<AppUser> { |
| | | |
| | | List<InviteRankListVO> inviteRankList(@Param("pageCurr")Integer pageCurr,@Param("pageSize")Integer pageSize); |
| | | List<InviteRankListVO> inviteRankListNolimit(); |
| | | |
| | | } |
| | |
| | | package com.xinquan.user.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.xinquan.common.core.web.page.PageInfo; |
| | | import com.xinquan.system.api.domain.vo.InviteRankListVO; |
| | | import com.xinquan.system.api.model.AppCaptchaBody; |
| | | import com.xinquan.system.api.model.AppLoginUser; |
| | | import com.xinquan.system.api.model.AppVerifyCellPhoneBody; |
| | |
| | | * @see AppUserVO |
| | | */ |
| | | AppUserVO getCurrentUser(); |
| | | |
| | | List<InviteRankListVO> inviteRankList(Integer pageCurr,Integer pageSize); |
| | | List<InviteRankListVO> inviteRankListNolimit(); |
| | | |
| | | |
| | | } |
| | |
| | | package com.xinquan.user.service.impl; |
| | | |
| | | |
| | | |
| | | import cn.hutool.core.util.IdUtil; |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.xinquan.common.core.constant.Constants; |
| | | import com.xinquan.common.core.constant.SecurityConstants; |
| | | import com.xinquan.common.core.domain.R; |
| | | import com.xinquan.common.core.enums.AnswerTagEnum; |
| | | import com.xinquan.common.core.enums.AppUserStatusEnum; |
| | | import com.xinquan.common.core.enums.DisabledEnum; |
| | | import com.xinquan.common.core.enums.TreeLevelEnum; |
| | | import com.xinquan.common.core.exception.ServiceException; |
| | | import com.xinquan.common.core.utils.page.BeanUtils; |
| | | import com.xinquan.common.core.utils.page.CollUtils; |
| | | import com.xinquan.common.core.web.page.PageInfo; |
| | | import com.xinquan.common.security.service.TokenService; |
| | | import com.xinquan.common.security.utils.SecurityUtils; |
| | | import com.xinquan.meditation.api.feign.RemoteMeditationService; |
| | | import com.xinquan.system.api.RemoteUserService; |
| | | import com.xinquan.system.api.domain.SysUser; |
| | | import com.xinquan.system.api.domain.*; |
| | | import com.xinquan.system.api.domain.vo.AppUserVO; |
| | | import com.xinquan.system.api.domain.vo.InviteRankListVO; |
| | | import com.xinquan.system.api.feignClient.SysUserClient; |
| | | import com.xinquan.system.api.model.*; |
| | | import com.xinquan.system.api.domain.AppUser; |
| | | import com.xinquan.user.api.domain.dto.AppUserDTO; |
| | | import com.xinquan.system.api.domain.AppUserQuestion; |
| | | import com.xinquan.system.api.domain.AppUserTree; |
| | | import com.xinquan.system.api.domain.Tag; |
| | | import com.xinquan.user.domain.dto.UserAnswerDTO; |
| | | import com.xinquan.system.api.domain.vo.AppUserVO; |
| | | import com.xinquan.user.domain.vo.TagVO; |
| | | import com.xinquan.user.mapper.AppUserMapper; |
| | | import com.xinquan.user.service.AppUserQuestionService; |
| | | import com.xinquan.user.service.AppUserService; |
| | | import com.xinquan.user.service.AppUserTreeService; |
| | | import com.xinquan.user.service.TagService; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.Optional; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | Optional<AppUser> one = this.lambdaQuery() |
| | | .ne(AppUser::getUserStatus,3) |
| | | .eq(AppUser::getDevice, device) |
| | | .isNull(AppUser::getWxOpenId) |
| | | .isNull(AppUser::getAppleId) |
| | | .isNull(AppUser::getCellPhone).oneOpt(); |
| | | Optional<AppUser> appUser = this.lambdaQuery() |
| | | .ne(AppUser::getUserStatus,3) |
| | |
| | | AppUser appUser = this.getById(userId); |
| | | return BeanUtils.copyBean(appUser, AppUserVO.class); |
| | | } |
| | | |
| | | @Override |
| | | public List<InviteRankListVO> inviteRankList(Integer pageCurr,Integer pageSize) { |
| | | List<InviteRankListVO> list = this.baseMapper.inviteRankList(pageCurr,pageSize); |
| | | return list; |
| | | } |
| | | @Override |
| | | public List<InviteRankListVO> inviteRankListNolimit() { |
| | | List<InviteRankListVO> list = this.baseMapper.inviteRankListNolimit(); |
| | | return list; |
| | | } |
| | | } |
| | |
| | | <!-- 日志文件名格式 --> |
| | | <fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern> |
| | | <!-- 日志最大的历史 60天 --> |
| | | <maxHistory>60</maxHistory> |
| | | <maxHistory>2</maxHistory> |
| | | </rollingPolicy> |
| | | <encoder> |
| | | <pattern>${log.pattern}</pattern> |
| | |
| | | update_time, |
| | | id, user_id, cell_phone, apple_id, open_id, avatar, nickname, signature, gender, birthday, education, industry, company, occupation, location, hometown, email, vip_expire_time, user_status, freezing_reason, freezing_operator, sanskrit_flag, invite_user_id, balance, total_energy_value, register_time, logout_time, level_setting_id,tag_id |
| | | </sql> |
| | | <select id="inviteRankList" resultType="com.xinquan.system.api.domain.vo.InviteRankListVO"> |
| | | SELECT u.id ,u.avatar,u.nickname, COUNT(i.id) AS `count` |
| | | FROM t_app_user u |
| | | LEFT JOIN t_app_user i ON u.id = i.invite_user_id |
| | | GROUP BY u.id |
| | | HAVING COUNT(i.id) > 0 |
| | | ORDER BY count DESC |
| | | limit #{pageCurr}, #{pageSize} |
| | | </select> |
| | | <select id="inviteRankListNolimit" resultType="com.xinquan.system.api.domain.vo.InviteRankListVO"> |
| | | SELECT u.id ,u.avatar,u.nickname, COUNT(i.id) AS `count` |
| | | FROM t_app_user u |
| | | LEFT JOIN t_app_user i ON u.id = i.invite_user_id |
| | | GROUP BY u.id |
| | | HAVING COUNT(i.id) > 0 |
| | | ORDER BY count DESC |
| | | |
| | | </select> |
| | | |
| | | </mapper> |