| | |
| | | |
| | | import cc.mrbird.febs.common.entity.FebsResponse; |
| | | import cc.mrbird.febs.common.entity.QueryRequest; |
| | | import cc.mrbird.febs.common.enumerates.AgentLevelEnum; |
| | | import cc.mrbird.febs.common.enumerates.FlowTypeEnum; |
| | | import cc.mrbird.febs.common.enumerates.MoneyFlowTypeEnum; |
| | | import cc.mrbird.febs.common.enumerates.*; |
| | | import cc.mrbird.febs.common.exception.FebsException; |
| | | import cc.mrbird.febs.common.utils.LoginUserUtil; |
| | | import cc.mrbird.febs.common.utils.MallUtils; |
| | |
| | | import cc.mrbird.febs.mall.service.IApiMallMemberWalletService; |
| | | import cc.mrbird.febs.mall.service.IMallMoneyFlowService; |
| | | import cc.mrbird.febs.mall.vo.*; |
| | | import cc.mrbird.febs.pay.model.SinglePayDto; |
| | | import cc.mrbird.febs.pay.service.UnipayService; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | |
| | | private final IApiMallMemberWalletService iApiMallMemberWalletService; |
| | | |
| | | private final AppVersionMapper appVersionMapper; |
| | | private final MallMemberWithdrawMapper mallMemberWithdrawMapper; |
| | | |
| | | private final MallNewsInfoMapper mallNewsInfoMapper; |
| | | private final MallShopApplyMapper mallShopApplyMapper; |
| | | |
| | | private final IMallMoneyFlowService mallMoneyFlowService; |
| | | private final UnipayService unipayService; |
| | | private final MallMemberBankMapper mallMemberBankMapper; |
| | | |
| | | @Override |
| | | public IPage<MallMember> getMallMemberList(MallMember mallMember, QueryRequest request) { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void changeIdentity(Integer type, Long id, Integer value) { |
| | | MallMember mallMember = mallMemberMapper.selectById(id); |
| | | if(mallMember == null) { |
| | | throw new FebsException("参数错误"); |
| | | } |
| | | |
| | | if (type == 1) { |
| | | mallMember.setDirector(value); |
| | | } else if (type == 2){ |
| | | mallMember.setStoreMaster(value); |
| | | } else { |
| | | throw new FebsException("参数错误"); |
| | | } |
| | | |
| | | this.baseMapper.updateById(mallMember); |
| | | } |
| | | |
| | | @Override |
| | | public MallMemberVo getMallMemberInfoById(long id) { |
| | | MallMemberVo mallMemberVo = mallMemberMapper.getMallMemberInfoById(id); |
| | | return mallMemberVo; |
| | |
| | | @Override |
| | | @Transactional |
| | | public FebsResponse chargeAgree(Long id) { |
| | | MallMoneyFlow mallMoneyFlow = mallMoneyFlowMapper.selectById(id); |
| | | if(ObjectUtil.isEmpty(mallMoneyFlow)){ |
| | | |
| | | MallMemberWithdraw mallMemberWithdraw = mallMemberWithdrawMapper.selectById(id); |
| | | if(ObjectUtil.isEmpty(mallMemberWithdraw)){ |
| | | return new FebsResponse().fail().message("系统繁忙,请刷新后重试"); |
| | | } |
| | | if(1 != mallMoneyFlow.getStatus()){ |
| | | if(1 != mallMemberWithdraw.getStatus()){ |
| | | return new FebsResponse().fail().message("当前状态不是提现中"); |
| | | } |
| | | mallMoneyFlow.setStatus(2); |
| | | mallMoneyFlowMapper.updateById(mallMoneyFlow); |
| | | |
| | | // Long wtihdrawTypeId = mallMemberWithdraw.getWtihdrawTypeId(); |
| | | // MallMemberBank mallMemberBank = mallMemberBankMapper.selectById(wtihdrawTypeId); |
| | | // if(ObjectUtil.isEmpty(mallMemberBank)){ |
| | | // return new FebsResponse().fail().message("提现地址不存在"); |
| | | // } |
| | | //更新提现记录状态为成功 |
| | | mallMemberWithdrawMapper.updateStatusById(2,mallMemberWithdraw.getId()); |
| | | //更新提现流水记录为成功 |
| | | String withdrawNo = mallMemberWithdraw.getWithdrawNo(); |
| | | MallMoneyFlow withdrawMoneyFlow = mallMoneyFlowMapper.selectOneByMemberIdAndOrderNoAndTypeAndStatusAndIsReturn( |
| | | mallMemberWithdraw.getMemberId(), |
| | | withdrawNo, |
| | | MallMoneyFlowTypeEnum.WITHDRAW.getCode(), |
| | | MallMoneyFlow.STATUS_ING, |
| | | MallMoneyFlow.IS_RETURN_Y |
| | | ); |
| | | withdrawMoneyFlow.setStatus(MallMoneyFlow.STATUS_SUCCESS); |
| | | mallMoneyFlowMapper.updateById(withdrawMoneyFlow); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | @Transactional |
| | | public FebsResponse chargeDisagree(Long id) { |
| | | MallMoneyFlow mallMoneyFlow = mallMoneyFlowMapper.selectById(id); |
| | | if(ObjectUtil.isEmpty(mallMoneyFlow)){ |
| | | MallMemberWithdraw mallMemberWithdraw = mallMemberWithdrawMapper.selectById(id); |
| | | if(ObjectUtil.isEmpty(mallMemberWithdraw)){ |
| | | return new FebsResponse().fail().message("系统繁忙,请刷新后重试"); |
| | | } |
| | | if(1 != mallMoneyFlow.getStatus()){ |
| | | if(1 != mallMemberWithdraw.getStatus()){ |
| | | return new FebsResponse().fail().message("当前状态不是提现中"); |
| | | } |
| | | mallMoneyFlow.setStatus(3); |
| | | mallMoneyFlowMapper.updateById(mallMoneyFlow); |
| | | //更新提现记录状态为失败 |
| | | mallMemberWithdrawMapper.updateStatusById(3,mallMemberWithdraw.getId()); |
| | | //更新提现流水记录为成功 |
| | | String withdrawNo = mallMemberWithdraw.getWithdrawNo(); |
| | | MallMoneyFlow withdrawMoneyFlow = mallMoneyFlowMapper.selectOneByMemberIdAndOrderNoAndTypeAndStatusAndIsReturn( |
| | | mallMemberWithdraw.getMemberId(), |
| | | withdrawNo, |
| | | MallMoneyFlowTypeEnum.WITHDRAW.getCode(), |
| | | MallMoneyFlow.STATUS_ING, |
| | | MallMoneyFlow.IS_RETURN_Y |
| | | ); |
| | | withdrawMoneyFlow.setStatus(MallMoneyFlow.STATUS_FAIL); |
| | | mallMoneyFlowMapper.updateById(withdrawMoneyFlow); |
| | | |
| | | //用户钱包增加对应的余额 |
| | | iApiMallMemberWalletService.addBalance(mallMoneyFlow.getAmount().negate(),mallMoneyFlow.getMemberId()); |
| | | //用户余额增加对应的余额 |
| | | iApiMallMemberWalletService.addBalance(mallMemberWithdraw.getAmount(),mallMemberWithdraw.getMemberId()); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public AdminMallMemberPaymentVo getMallMemberPaymentInfoByFlowId(long id) { |
| | | AdminMallMemberPaymentVo adminMallMemberPaymentVo = new AdminMallMemberPaymentVo(); |
| | | MallMoneyFlow mallMoneyFlow = mallMoneyFlowMapper.selectById(id); |
| | | AdminMallMemberPaymentVo adminMallMemberPaymentVoa = mallMemberPaymentMapper.getMallMemberPaymentInfoByMemberId(mallMoneyFlow.getMemberId()); |
| | | MallMemberWithdraw mallMemberWithdraw = mallMemberWithdrawMapper.selectById(id); |
| | | AdminMallMemberPaymentVo adminMallMemberPaymentVoa = mallMemberPaymentMapper.getMallMemberPaymentInfoByMemberId(mallMemberWithdraw.getMemberId()); |
| | | if(ObjectUtil.isNotEmpty(adminMallMemberPaymentVoa)){ |
| | | adminMallMemberPaymentVo = adminMallMemberPaymentVoa; |
| | | } |
| | |
| | | if(CollUtil.isNotEmpty(records)){ |
| | | for(AdminAgentVo adminAgentVo : records){ |
| | | String inviteId = adminAgentVo.getInviteId(); |
| | | |
| | | //直接下级 |
| | | List<MallMember> mallMembers = mallMemberMapper.selectChildAgentListByInviteId(inviteId); |
| | | adminAgentVo.setMemberNum(CollUtil.isEmpty(mallMembers) ? 0 : mallMembers.size()); |
| | |
| | | //获取总数 |
| | | List<MallMember> allMallMembers =mallMemberMapper.selectAllChildAgentListByInviteId(inviteId); |
| | | adminAgentVo.setAllMemberNum(CollUtil.isEmpty(allMallMembers) ? 0 : allMallMembers.size()); |
| | | |
| | | //团队业绩 |
| | | BigDecimal amount = BigDecimal.ZERO; |
| | | if(CollUtil.isNotEmpty(allMallMembers)){ |
| | | for(MallMember teamMember : allMallMembers){ |
| | | Long memberId = teamMember.getId(); |
| | | BigDecimal sumAmount = mallMemberMapper.getSumAmountByMemberId(memberId); |
| | | amount = amount.add(sumAmount); |
| | | } |
| | | } |
| | | adminAgentVo.setAmount(amount); |
| | | } |
| | | } |
| | | return adminAgentVos; |
| | |
| | | List<AdminAgentMemberVo> records = adminAgentMemberVos.getRecords(); |
| | | if(CollUtil.isNotEmpty(records)){ |
| | | for(AdminAgentMemberVo agentMemberVo : records){ |
| | | String inviteId = agentMemberVo.getInviteId(); |
| | | BigDecimal amount = mallMemberMapper.getAgentTeamAmountByInviteId(inviteId); |
| | | Long agentMemberVoId = agentMemberVo.getId(); |
| | | BigDecimal amount = mallMemberMapper.getSumAmountByMemberId(agentMemberVoId); |
| | | agentMemberVo.setAmount(amount); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | BigDecimal bigDecimal = mallSystemPayDto.getAddBalance(); |
| | | boolean isReduce = false; |
| | | if(bigDecimal.compareTo(BigDecimal.ZERO) <= 0){ |
| | | return new FebsResponse().fail().message("拨付数目需要大于0"); |
| | | isReduce = true; |
| | | } |
| | | |
| | | Integer type = mallSystemPayDto.getType(); |
| | |
| | | throw new FebsException("参数错误"); |
| | | } |
| | | |
| | | iApiMallMemberWalletService.add(mallSystemPayDto.getAddBalance(), mallSystemPayDto.getId(), filedType); |
| | | mallMoneyFlowService.addMoneyFlow(memberId, bigDecimal, MoneyFlowTypeEnum.SYSTEM.getValue(), null, type); |
| | | if (isReduce) { |
| | | int i = iApiMallMemberWalletService.reduce(mallSystemPayDto.getAddBalance().negate(), mallSystemPayDto.getId(), filedType); |
| | | |
| | | if (i == 2) { |
| | | throw new FebsException("剩余数量不足"); |
| | | } |
| | | } else { |
| | | iApiMallMemberWalletService.add(mallSystemPayDto.getAddBalance(), mallSystemPayDto.getId(), filedType); |
| | | } |
| | | |
| | | mallMoneyFlowService.addMoneyFlow( |
| | | memberId, |
| | | null, |
| | | bigDecimal, |
| | | MallMoneyFlowTypeEnum.SYSTEM_CHARGE.getCode(), |
| | | MallMoneyFlow.STATUS_SUCCESS, |
| | | MallMoneyFlow.IS_RETURN_Y, |
| | | memberId, |
| | | FlowTypeEnum.BALANCE.getValue(), |
| | | MallMoneyFlowTypeEnum.SYSTEM_CHARGE.getName() |
| | | ); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public AdminAgentLevelSetInfoVo getAgentLevelSetInfoByMemberId(long id) { |
| | | AdminAgentLevelSetInfoVo adminAgentLevelSetInfoVo = mallMemberMapper.getAgentLevelSetInfoByMemberId(id); |
| | | AdminAgentLevelSetInfoVo adminAgentLevelSetInfoVo = new AdminAgentLevelSetInfoVo(); |
| | | AdminAgentLevelSetInfoVo adminAgentLevelSetInfo = mallMemberMapper.getAgentLevelSetInfoByMemberId(id); |
| | | if(ObjectUtil.isEmpty(adminAgentLevelSetInfo)){ |
| | | adminAgentLevelSetInfoVo.setId(id); |
| | | adminAgentLevelSetInfoVo.setLevelCode(MemberAgentLevelEnum.AGENT.getCodeByName(MemberAgentLevelEnum.AGENT.getName())); |
| | | }else{ |
| | | adminAgentLevelSetInfoVo.setId(id); |
| | | adminAgentLevelSetInfoVo.setLevelCode(MemberAgentLevelEnum.AGENT.getCodeByName(adminAgentLevelSetInfo.getLevelCode())); |
| | | } |
| | | return adminAgentLevelSetInfoVo; |
| | | } |
| | | |
| | |
| | | if(ObjectUtil.isEmpty(mallMember)){ |
| | | return new FebsResponse().fail().message("系统繁忙,请刷新页面重试"); |
| | | } |
| | | mallMember.setLevel(agentLevelSetUpdateDto.getLevelCode()); |
| | | mallMemberMapper.updateById(mallMember); |
| | | String levelCode = agentLevelSetUpdateDto.getLevelCode(); |
| | | String nameByCode = MemberAgentLevelEnum.AGENT.getNameByCode(levelCode); |
| | | mallMemberMapper.updateLevelStatusById(1,memberId); |
| | | mallMemberMapper.updateLevelById(nameByCode,memberId); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | |
| | | if (!MallShopApply.APPLY_ING.equals(apply.getStatus())) { |
| | | throw new FebsException("申请已审核, 请勿重复操作"); |
| | | } |
| | | |
| | | MallMember member = mallMemberMapper.selectById(apply.getMemberId()); |
| | | member.setStoreMaster(1); |
| | | mallMemberMapper.updateById(member); |
| | | |
| | | apply.setStatus(MallShopApply.APPLY_AGREE); |
| | | mallShopApplyMapper.updateById(apply); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void updateShopApply(MallShopApply apply) { |
| | | MallShopApply mallShopApply = mallShopApplyMapper.selectById(apply.getId()); |
| | | mallShopApply.setName(apply.getName()); |
| | | mallShopApply.setPhone(apply.getPhone()); |
| | | mallShopApply.setIdcard(apply.getIdcard()); |
| | | mallShopApply.setBusinessLicense(apply.getBusinessLicense()); |
| | | mallShopApply.setSaleArea(apply.getSaleArea()); |
| | | mallShopApply.setShopName(apply.getShopName()); |
| | | mallShopApplyMapper.updateById(mallShopApply); |
| | | } |
| | | |
| | | @Override |
| | | public AdminMallMemberPaymentVo getMallBankInfoById(long id) { |
| | | |
| | | MallMemberWithdraw mallMemberWithdraw = mallMemberWithdrawMapper.selectById(id); |
| | | Long wtihdrawTypeId = mallMemberWithdraw.getWtihdrawTypeId(); |
| | | MallMemberBank mallMemberBank = mallMemberBankMapper.selectById(wtihdrawTypeId); |
| | | AdminMallMemberPaymentVo adminMallMemberPaymentVo = new AdminMallMemberPaymentVo(); |
| | | if(ObjectUtil.isNotEmpty(mallMemberBank)){ |
| | | adminMallMemberPaymentVo.setBankNo(mallMemberBank.getBankNo()); |
| | | adminMallMemberPaymentVo.setBankName(mallMemberBank.getName()); |
| | | } |
| | | return adminMallMemberPaymentVo; |
| | | } |
| | | |
| | | @Override |
| | | public IPage<MemberCoinChargeEntity> getChargeList(MemberCoinChargeEntity memberCoinChargeEntity, QueryRequest request) { |
| | | |
| | | Page<MemberCoinChargeEntity> page = new Page<>(request.getPageNum(), request.getPageSize()); |
| | | IPage<MemberCoinChargeEntity> memberCoinChargeEntityIPage = this.baseMapper.selectMemberChargeListInPage(page, memberCoinChargeEntity); |
| | | return memberCoinChargeEntityIPage; |
| | | } |
| | | |
| | | private String refererIds(String parentId) { |
| | | boolean flag = false; |
| | | if (StrUtil.isBlank(parentId)) { |