| | |
| | | return null; |
| | | } |
| | | |
| | | |
| | | @ApiOperation(value = "领红包") |
| | | @PostMapping(value = "/redBag") |
| | | public FebsResponse redBag() { |
| | | return memberService.redBag(); |
| | | } |
| | | |
| | | @ApiOperation(value = "新增银行卡") |
| | | @PostMapping(value = "/addMemberBank") |
| | | public FebsResponse addMemberBank(@RequestBody AddMemberBankDto addMemberBankDto) { |
| | |
| | | BigDecimal selectCommissionIncome(@Param("type") Integer type, @Param("date") Date date, @Param("memberId") Long memebrid); |
| | | |
| | | BigDecimal selectThankfulCommission(@Param("date") Date date, @Param("memberId") Long memberId); |
| | | |
| | | List<MallMoneyFlow> selectByMemberIdAndTypeAndStatusAndDate(@Param("memberId")Long id, |
| | | @Param("type")int value, |
| | | @Param("status")int i, |
| | | @Param("date") Date date); |
| | | } |
| | |
| | | FebsResponse updateMemberBank(UpdateMemberBankDto updateMemberBankDto); |
| | | |
| | | FebsResponse delMemberBank(Long id); |
| | | |
| | | FebsResponse redBag(); |
| | | } |
| | |
| | | |
| | | void addMoneyFlow(Long memberId, BigDecimal amount, Integer type, String orderNo, Integer flowType); |
| | | |
| | | void addMoneyFlow(Integer status,Long memberId, BigDecimal amount, Integer type, String orderNo, Integer flowType); |
| | | |
| | | void addMoneyFlow(Long memberId, BigDecimal amount, Integer type, String orderNo, Integer flowType, Integer isReturn); |
| | | |
| | | void addMoneyFlow(Long memberId, BigDecimal amount, Integer type, String orderNo, Long rtMemberId, Integer flowType); |
| | |
| | | mallMemberBankMapper.deleteById(id); |
| | | return new FebsResponse().success(); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse redBag() { |
| | | MallMember member = LoginUserUtil.getLoginUser(); |
| | | List<MallMoneyFlow> mallMoneyFlows = mallMoneyFlowMapper.selectByMemberIdAndTypeAndStatusAndDate(member.getId(), MoneyFlowTypeEnum.SCORE_POOL.getValue(), 1, new Date()); |
| | | if(CollUtil.isEmpty(mallMoneyFlows)){ |
| | | throw new FebsException("没有红包"); |
| | | } |
| | | BigDecimal amount = BigDecimal.ZERO; |
| | | for(MallMoneyFlow mallMoneyFlow : mallMoneyFlows){ |
| | | mallMoneyFlow.setStatus(2); |
| | | mallMoneyFlowMapper.updateById(mallMoneyFlow); |
| | | |
| | | amount = mallMoneyFlow.getAmount().abs(); |
| | | } |
| | | walletService.add(amount, member.getId(), "commission"); |
| | | walletService.reduce(amount.negate(), member.getId(), "score"); |
| | | return new FebsResponse().success().message("领取成功"); |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void addMoneyFlow(Integer status,Long memberId, BigDecimal amount, Integer type, String orderNo, Integer flowType) { |
| | | this.addMoneyFlow(memberId, amount, type, orderNo, null, null, null, status, flowType, null); |
| | | } |
| | | |
| | | @Override |
| | | public void addMoneyFlow(Long memberId, BigDecimal amount, Integer type, String orderNo, Integer flowType, Integer isReturn) { |
| | | this.addMoneyFlow(memberId, amount, type, orderNo, null, null, null, null, flowType, isReturn); |
| | | } |
| | |
| | | import cn.hutool.core.date.DateTime; |
| | | import cn.hutool.core.date.DateUnit; |
| | | import cn.hutool.core.date.DateUtil; |
| | | import cn.hutool.core.util.NumberUtil; |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.core.util.RandomUtil; |
| | | import cn.hutool.core.util.StrUtil; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | |
| | | }else{ |
| | | outCome = income; |
| | | } |
| | | walletService.add(outCome, mallMember.getId(), "commission"); |
| | | walletService.reduce(outCome, mallMember.getId(), "score"); |
| | | moneyFlowService.addMoneyFlow(mallMember.getId(), outCome, MoneyFlowTypeEnum.SCORE_POOL.getValue(), null, FlowTypeEnum.COMMISSION.getValue()); |
| | | moneyFlowService.addMoneyFlow(mallMember.getId(), outCome.negate(), MoneyFlowTypeEnum.SCORE_POOL.getValue(), null, FlowTypeEnum.SCORE.getValue()); |
| | | |
| | | outCome = new BigDecimal(RandomUtil.randomBigDecimal(BigDecimal.ZERO,outCome).intValue()).setScale(2,BigDecimal.ROUND_DOWN); |
| | | // walletService.add(outCome, mallMember.getId(), "commission"); |
| | | // walletService.reduce(outCome, mallMember.getId(), "score"); |
| | | moneyFlowService.addMoneyFlow(1,mallMember.getId(), outCome, MoneyFlowTypeEnum.SCORE_POOL.getValue(), null, FlowTypeEnum.COMMISSION.getValue()); |
| | | moneyFlowService.addMoneyFlow(1,mallMember.getId(), outCome.negate(), MoneyFlowTypeEnum.SCORE_POOL.getValue(), null, FlowTypeEnum.SCORE.getValue()); |
| | | cnt ++; |
| | | } |
| | | } |
| | |
| | | and date_format(created_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d') |
| | | and type in (2,3,4) |
| | | </select> |
| | | |
| | | <select id="selectByMemberIdAndTypeAndStatusAndDate" resultType="cc.mrbird.febs.mall.entity.MallMoneyFlow"> |
| | | select a.member_id, sum(a.amount) amount from mall_money_flow a |
| | | where a.type =#{type} |
| | | and a.status = #{status} |
| | | and a.member_id = #{memberId} |
| | | and date_format(a.created_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d'); |
| | | </select> |
| | | </mapper> |