src/main/java/cc/mrbird/febs/mall/controller/ApiMallTeamLeaderController.java
@@ -4,10 +4,7 @@ import cc.mrbird.febs.common.entity.FebsResponse; import cc.mrbird.febs.mall.dto.*; import cc.mrbird.febs.mall.service.IApiMallTeamLeaderService; import cc.mrbird.febs.mall.vo.ApiLeaderInfoVo; import cc.mrbird.febs.mall.vo.ApiLeaderListVo; import cc.mrbird.febs.mall.vo.ApiMallleaderStateVo; import cc.mrbird.febs.mall.vo.OrderListVo; import cc.mrbird.febs.mall.vo.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; @@ -130,5 +127,14 @@ return iApiMallTeamLeaderService.findTeamOrderMarkCnt(); } @ApiOperation(value = "团长收益详情", notes = "团长收益详情") @ApiResponses({ @ApiResponse(code = 200, message = "success", response = ApiLeaderProfitVo.class) }) @GetMapping("/leaderProfit") public FebsResponse leaderProfit() { return iApiMallTeamLeaderService.leaderProfit(); } } src/main/java/cc/mrbird/febs/mall/mapper/MallLeaderAchieveMapper.java
@@ -14,4 +14,6 @@ List<Map<String, String>> selectListByStateAndCreateTimeAndUniqueCode(@Param("state")Integer i, @Param("offsetDay")DateTime offsetDay); 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); } src/main/java/cc/mrbird/febs/mall/mapper/MallMoneyFlowMapper.java
@@ -39,4 +39,6 @@ BigDecimal selectThankfulCommission(@Param("date") Date date, @Param("memberId") Long memberId); 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); } src/main/java/cc/mrbird/febs/mall/quartz/OrderSettlementJob.java
@@ -156,7 +156,6 @@ achieveNo, FlowTypeEnum.BALANCE.getValue()); //更新到已提成状态 mallLeaderAchieveMapper.updateByUniqueCodeStateAndTime(DateUtil.date(),uniqueCode,MallLeaderAchieve.STATE_ONE,dateTime); } src/main/java/cc/mrbird/febs/mall/service/IApiMallTeamLeaderService.java
@@ -30,4 +30,6 @@ FebsResponse leaderRefundOrder(ApiLeaderRefundOrderDto apiLeaderRefundOrderDto); FebsResponse refundOrderInfo(ApiRefundOrderInfoDto apiRefundOrderInfoDto); FebsResponse leaderProfit(); } src/main/java/cc/mrbird/febs/mall/service/impl/ApiMallTeamLeaderServiceImpl.java
@@ -15,10 +15,7 @@ import cc.mrbird.febs.mall.service.IApiMallMemberWalletService; import cc.mrbird.febs.mall.service.IApiMallTeamLeaderService; import cc.mrbird.febs.mall.service.IMallMoneyFlowService; import cc.mrbird.febs.mall.vo.ApiLeaderInfoVo; import cc.mrbird.febs.mall.vo.ApiLeaderListVo; import cc.mrbird.febs.mall.vo.ApiMallleaderStateVo; import cc.mrbird.febs.mall.vo.OrderListVo; import cc.mrbird.febs.mall.vo.*; import cc.mrbird.febs.pay.model.OrderStateDto; import cc.mrbird.febs.pay.service.IXcxPayService; import cc.mrbird.febs.pay.util.WechatConfigure; @@ -62,6 +59,8 @@ private final XcxProperties xcxProperties = SpringContextHolder.getBean(XcxProperties.class); private final IMallMoneyFlowService mallMoneyFlowService; private final IApiMallMemberWalletService memberWalletService; private final MallLeaderAchieveMapper mallLeaderAchieveMapper; private final MallMoneyFlowMapper mallMoneyFlowMapper; @Override @Transactional @@ -386,4 +385,19 @@ return new FebsResponse().success().data(mallRefundEntities.get(0)); } @Override 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); apiLeaderProfitVo.setTodayProfit(todayProfit); 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/java/cc/mrbird/febs/mall/vo/ApiLeaderProfitVo.java
New file @@ -0,0 +1,25 @@ package cc.mrbird.febs.mall.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.math.BigDecimal; @Data @ApiModel(value = "ApiLeaderProfitVo", description = "团长收益信息返回类") public class ApiLeaderProfitVo { @ApiModelProperty(value = "总收益") private BigDecimal totalProfit; @ApiModelProperty(value = "今日收益") private BigDecimal todayProfit; @ApiModelProperty(value = "本月收益") private BigDecimal monthProfit; @ApiModelProperty(value = "待结算") private BigDecimal waitProfit; } src/main/resources/application-test.yml
@@ -72,7 +72,7 @@ wechar_login_url: https://api.weixin.qq.com/sns/jscode2session?appid=%s&secret=%s&js_code=%s&grant_type=authorization_code xcx_appid: wx0b515f652282158e xcx_secret: 8d3d3c14221f7dc37650b861dc0fc570 debug: false debug: true wecharPaynotifyUrl: http://groupbuy.csxuncong.com/api/xcxPay/wxpayCallback wecharRechargePaynotifyUrl: http://groupbuy.csxuncong.com/api/xcxPay/rechargeCallBack certLocalPath: /home/yyscCert/apiclient_cert.p12 src/main/resources/mapper/modules/MallLeaderAchieveMapper.xml
@@ -21,4 +21,21 @@ and date_format(CREATED_TIME, '%Y-%m-%d') = date_format(#{offsetDay}, '%Y-%m-%d') </update> <select id="selectProfitByStateAndDateTimeAndUniqueCode" resultType="java.math.BigDecimal"> select IFNULL(sum(a.amount),0) amount from mall_leader_achieve a <where> <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> <if test="uniqueCode!=null and uniqueCode!=''"> and a.unique_code = #{uniqueCode} </if> </where> </select> </mapper> src/main/resources/mapper/modules/MallMoneyFlowMapper.xml
@@ -136,4 +136,20 @@ select a.* from mall_money_flow a where a.order_no = #{rechargeNo} and a.member_id = #{memberId} </select> <select id="selectAmountByFlowtypeAndType" resultType="java.math.BigDecimal"> select ifnull(sum(amount),0) from mall_money_flow <where> a.member_id = #{memberId} <if test="flowType!=null and flowType!=''"> and a.flow_type = #{flowType} </if> <if test="type!=null and type!=''"> and a.type = #{type} </if> <if test="status!=null and status!=''"> and a.status = #{status} </if> </where> </select> </mapper>