xiaoyong931011
2022-09-05 b222b6baf58cc128343867107d570d237966d9ac
20220902
6 files modified
59 ■■■■ changed files
src/main/java/cc/mrbird/febs/mall/mapper/MallLeaderAchieveMapper.java 3 ●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/mapper/MallMoneyFlowMapper.java 4 ●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallTeamLeaderServiceImpl.java 19 ●●●● patch | view | raw | blame | history
src/main/resources/mapper/modules/MallLeaderAchieveMapper.xml 4 ●●●● patch | view | raw | blame | history
src/main/resources/mapper/modules/MallMoneyFlowMapper.xml 8 ●●●● patch | view | raw | blame | history
src/test/java/cc/mrbird/febs/ProfitTest.java 21 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/mall/mapper/MallLeaderAchieveMapper.java
@@ -6,6 +6,7 @@
import org.apache.ibatis.annotations.Param;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
@@ -15,5 +16,5 @@
    int updateByUniqueCodeStateAndTime(@Param("updateTime")DateTime updateTime,@Param("uniqueCode")String uniqueCode, @Param("state")Integer stateOne, @Param("offsetDay")DateTime dateTime);
    BigDecimal selectProfitByStateAndDateTimeAndUniqueCode(@Param("state")Integer state, @Param("DateTime")DateTime DateTime, @Param("uniqueCode")String uniqueCode);
    BigDecimal selectProfitByStateAndDateTimeAndUniqueCode(@Param("state")Integer state, @Param("date") Date DateTime, @Param("uniqueCode")String uniqueCode);
}
src/main/java/cc/mrbird/febs/mall/mapper/MallMoneyFlowMapper.java
@@ -40,5 +40,7 @@
    MallMoneyFlow selectOneByOrderNoAndMemberId(@Param("rechargeNo")String rechargeNo, @Param("memberId")Long memberId);
    BigDecimal selectAmountByFlowtypeAndType(@Param("memberId")Long memberId,@Param("flowType")Integer flowType, @Param("type")Integer type, @Param("status")Integer status);
    BigDecimal selectAmountByFlowtypeAndType(@Param("memberId")Long memberId,@Param("flowType")Integer flowType,
                                             @Param("type")Integer type, @Param("status")Integer status,
                                             @Param("dateDay") Date DateTime,@Param("dateMonth") Date dateMonth);
}
src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallTeamLeaderServiceImpl.java
@@ -389,14 +389,23 @@
    public FebsResponse leaderProfit() {
        MallMember loginUser = LoginUserUtil.getLoginUser();
        ApiLeaderProfitVo apiLeaderProfitVo = new ApiLeaderProfitVo();
//        BigDecimal TotalProfit = mallLeaderAchieveMapper.selectProfitByStateAndDateTimeAndUniqueCode(null,null,loginUser.getInviteId()).setScale(2,BigDecimal.ROUND_DOWN);
//        apiLeaderProfitVo.setTotalProfit(TotalProfit);
        BigDecimal todayProfit = mallLeaderAchieveMapper.selectProfitByStateAndDateTimeAndUniqueCode(2,DateUtil.date(),loginUser.getInviteId()).setScale(2,BigDecimal.ROUND_DOWN);
        BigDecimal totalProfit = mallMoneyFlowMapper.selectAmountByFlowtypeAndType(loginUser.getId(),FlowTypeEnum.BALANCE.getValue(),MoneyFlowTypeEnum.LEADERACHIEVE.getValue(),null,null,null);
        apiLeaderProfitVo.setTotalProfit(totalProfit);
        BigDecimal todayProfit = mallMoneyFlowMapper.selectAmountByFlowtypeAndType(loginUser.getId(),FlowTypeEnum.BALANCE.getValue(),
                MoneyFlowTypeEnum.LEADERACHIEVE.getValue(),
                null,DateUtil.date(),
                null);
        apiLeaderProfitVo.setTodayProfit(todayProfit);
        BigDecimal monthProfit = mallMoneyFlowMapper.selectAmountByFlowtypeAndType(loginUser.getId(),FlowTypeEnum.BALANCE.getValue(),
                MoneyFlowTypeEnum.LEADERACHIEVE.getValue(),
                null,null,
                DateUtil.date());
        apiLeaderProfitVo.setMonthProfit(monthProfit);
        BigDecimal waitProfit = mallLeaderAchieveMapper.selectProfitByStateAndDateTimeAndUniqueCode(1,null,loginUser.getInviteId()).setScale(2,BigDecimal.ROUND_DOWN);
        apiLeaderProfitVo.setWaitProfit(waitProfit);
        BigDecimal totalProfit = mallMoneyFlowMapper.selectAmountByFlowtypeAndType(loginUser.getId(),FlowTypeEnum.BALANCE.getValue(),MoneyFlowTypeEnum.LEADERACHIEVE.getValue(),null);
        apiLeaderProfitVo.setTotalProfit(totalProfit);
        return new FebsResponse().success().data(apiLeaderProfitVo);
    }
src/main/resources/mapper/modules/MallLeaderAchieveMapper.xml
@@ -29,8 +29,8 @@
            <if test="state!=null and state!=''">
                and  a.state = #{state}
            </if>
            <if test="DateTime!=null and DateTime!=''">
                and date_format(a.CREATED_TIME, '%Y-%m-%d') = date_format(#{DateTime}, '%Y-%m-%d')
            <if test="date!=null">
                and date_format(a.CREATED_TIME, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d')
            </if>
            <if test="uniqueCode!=null and uniqueCode!=''">
                and  a.unique_code = #{uniqueCode}
src/main/resources/mapper/modules/MallMoneyFlowMapper.xml
@@ -138,7 +138,7 @@
    </select>
    <select id="selectAmountByFlowtypeAndType" resultType="java.math.BigDecimal">
        select ifnull(sum(amount),0) from mall_money_flow
        select ifnull(sum(a.amount),0) from mall_money_flow a
        <where>
            a.member_id = #{memberId}
            <if test="flowType!=null and flowType!=''">
@@ -150,6 +150,12 @@
            <if test="status!=null and status!=''">
                and  a.status = #{status}
            </if>
            <if test="dateDay!=null">
                and date_format(a.created_time, '%Y-%m-%d') = date_format(#{dateDay}, '%Y-%m-%d')
            </if>
            <if test="dateMonth!=null">
                and date_format(a.created_time, '%Y-%m-%d') = date_format(#{dateMonth}, '%Y-%m-%d')
            </if>
        </where>
    </select>
</mapper>
src/test/java/cc/mrbird/febs/ProfitTest.java
@@ -9,6 +9,7 @@
import cc.mrbird.febs.mall.entity.*;
import cc.mrbird.febs.mall.mapper.*;
import cc.mrbird.febs.mall.service.*;
import cc.mrbird.febs.mall.vo.ApiLeaderProfitVo;
import cc.mrbird.febs.pay.model.WxGenerateQrCodeDto;
import cc.mrbird.febs.pay.service.IXcxPayService;
import cc.mrbird.febs.rabbit.consumer.AgentConsumer;
@@ -262,11 +263,27 @@
        }
    }
    @Autowired
    private MallMoneyFlowMapper mallMoneyFlowMapper;
    @Test
    public void testAddress(){
        MallOrderInfo orderInfo = mallOrderInfoMapper.selectOrderDetailsById(266L);
        System.out.println(orderInfo.getLeaderLatitude());
        MallMember loginUser = mallMemberMapper.selectById(47L);
        BigDecimal totalProfit = mallMoneyFlowMapper.selectAmountByFlowtypeAndType(loginUser.getId(),FlowTypeEnum.BALANCE.getValue(),MoneyFlowTypeEnum.LEADERACHIEVE.getValue(),null,null,null);
        BigDecimal todayProfit = mallMoneyFlowMapper.selectAmountByFlowtypeAndType(loginUser.getId(),FlowTypeEnum.BALANCE.getValue(),
                MoneyFlowTypeEnum.LEADERACHIEVE.getValue(),
                null,DateUtil.date(),
                null);
        BigDecimal monthProfit = mallMoneyFlowMapper.selectAmountByFlowtypeAndType(loginUser.getId(),FlowTypeEnum.BALANCE.getValue(),
                MoneyFlowTypeEnum.LEADERACHIEVE.getValue(),
                null,null,
                DateUtil.date());
        BigDecimal waitProfit = mallLeaderAchieveMapper.selectProfitByStateAndDateTimeAndUniqueCode(1,null,loginUser.getInviteId()).setScale(2,BigDecimal.ROUND_DOWN);
        System.out.println(todayProfit +";");
        System.out.println(waitProfit +";");
        System.out.println(totalProfit +";");
        System.out.println(monthProfit +";");
    }
    public static void main(String[] args) {