Browse Source

feature1.0.0-img:添加收益统计方法

master
chengkun 4 years ago
parent
commit
acdbbb63e1
  1. 4
      bnyer-common/bnyer-common-core/src/main/java/com/bnyer/common/core/utils/DesensitizedUtils.java
  2. 7
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/controller/CreatorMiniController.java
  3. 35
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/mapper/CreatorProfitMapper.java
  4. 19
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/service/impl/CreatorProfitServiceImpl.java
  5. 21
      bnyer-services/bnyer-img/src/main/java/com/bnyer/img/vo/ProfitVo.java
  6. 39
      bnyer-services/bnyer-img/src/main/resources/com/bnyer/img/mapper/CreatorProfitMapper.xml

4
bnyer-common/bnyer-common-core/src/main/java/com/bnyer/common/core/utils/DesensitizedUtils.java

@ -178,7 +178,7 @@ public class DesensitizedUtils {
} else if (value instanceof Collection<?>) {//对集合类型的字段进行递归过滤
Collection<?> c = (Collection<?>) value;
Iterator<?> it = c.iterator();
while (it.hasNext()) {// TODO: 待优化
while (it.hasNext()) {
Object collectionObj = it.next();
if (isNotGeneralType(collectionObj.getClass(), collectionObj, referenceCounter)) {
replace(ObjectUtils.getAllFields(collectionObj), collectionObj, referenceCounter);
@ -249,7 +249,7 @@ public class DesensitizedUtils {
} else if (value instanceof Collection<?>) {//对集合类型的字段进行递归过滤
Collection<?> c = (Collection<?>) value;
Iterator<?> it = c.iterator();
while (it.hasNext()) {// TODO: 待优化
while (it.hasNext()) {
Object collectionObj = it.next();
if (isNotGeneralType(collectionObj.getClass(), collectionObj, referenceCounter)) {
guangFaReplace(ObjectUtils.getAllFields(collectionObj), collectionObj, referenceCounter);

7
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/controller/CreatorMiniController.java

@ -250,6 +250,13 @@ public class CreatorMiniController extends BaseController {
return AjaxResult.success(creatorProfitService.queryFrontEndProfitAmt(params.getCreatorId(),params.getType()));
}
//@TokenCheck
@ApiOperation(value="查询指定艺术家收益统计")
@GetMapping(value = "/queryFrontProfitInfo/{creatorId}")
public AjaxResult queryFrontProfitInfo(@PathVariable @ApiParam("艺术家id") Long creatorId){
return AjaxResult.success(creatorProfitService.queryFrontProfitInfo(creatorId));
}
//@TokenCheck
@PostMapping("/login")
@ApiOperation("小程序艺术家登录")

35
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/mapper/CreatorProfitMapper.java

@ -148,4 +148,39 @@ public interface CreatorProfitMapper extends BaseMapper<CreatorProfit> {
* @param list 订单列表
*/
int batchUpdateTransInfo(@Param("list") List<Long> list);
/**
* 查询艺术家累计收益
* @param creatorId 艺术家id
* @return -
*/
BigDecimal queryTotalProfit(@Param("creatorId") Long creatorId);
/**
* 查询艺术家上月收益
* @param creatorId 艺术家
* @return -
*/
BigDecimal queryLastMonthProfit(@Param("creatorId") Long creatorId);
/**
* 查询艺术家本月收益
* @param creatorId 艺术家
* @return -
*/
BigDecimal queryThisMonthProfit(@Param("creatorId") Long creatorId);
/**
* 查询艺术家昨日广告收益
* @param creatorId 艺术家id
* @return -
*/
BigDecimal queryLastDayAdProfit(@Param("creatorId") Long creatorId);
/**
* 查询艺术家昨日邀请收益
* @param creatorId 艺术家id
* @return -
*/
BigDecimal queryLastDayInviteProfit(@Param("creatorId") Long creatorId);
}

19
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/service/impl/CreatorProfitServiceImpl.java

@ -232,8 +232,23 @@ public class CreatorProfitServiceImpl implements CreatorProfitService {
@Override
public ProfitVo queryFrontProfitInfo(Long creatorId) {
//TODO 计算收益
return null;
//累计收益
BigDecimal totalProfit = creatorProfitMapper.queryTotalProfit(creatorId);
//上月收益
BigDecimal lastMonthProfit = creatorProfitMapper.queryLastMonthProfit(creatorId);
//本月收益
BigDecimal thisMonthProfit = creatorProfitMapper.queryThisMonthProfit(creatorId);
//昨日广告收益
BigDecimal yesterdayAdProfit = creatorProfitMapper.queryLastDayAdProfit(creatorId);
//昨日邀请收益
BigDecimal yesterdayInviteProfit = creatorProfitMapper.queryLastDayInviteProfit(creatorId);
ProfitVo result = new ProfitVo();
result.setTotalProfit(totalProfit);
result.setLastMonthProfit(lastMonthProfit);
result.setThisMonthProfit(thisMonthProfit);
result.setYesterdayAdProfit(yesterdayAdProfit);
result.setYesterdayInviteProfit(yesterdayInviteProfit);
return result;
}
@Override

21
bnyer-services/bnyer-img/src/main/java/com/bnyer/img/vo/ProfitVo.java

@ -6,6 +6,7 @@ import lombok.Getter;
import lombok.Setter;
import java.io.Serializable;
import java.math.BigDecimal;
@Getter
@ -13,20 +14,20 @@ import java.io.Serializable;
@ApiModel("收益响应体")
public class ProfitVo implements Serializable {
@ApiModelProperty(value="昨日广告收益(单位毫分)")
private Integer yesterdayProfit;
@ApiModelProperty(value="昨日广告收益")
private BigDecimal yesterdayAdProfit;
@ApiModelProperty(value="昨日邀请收益(单位毫分)")
private Integer yesterdayInviteProfit;
@ApiModelProperty(value="昨日邀请收益")
private BigDecimal yesterdayInviteProfit;
@ApiModelProperty(value="累计收益(单位毫分)")
private Integer totalProfit;
@ApiModelProperty(value="累计收益")
private BigDecimal totalProfit;
@ApiModelProperty(value="上月收益(单位毫分)")
private Integer lastMonthProfit;
@ApiModelProperty(value="上月收益")
private BigDecimal lastMonthProfit;
@ApiModelProperty(value="当月收益(单位毫分)")
private Integer thisMonthProfit;
@ApiModelProperty(value="当月收益")
private BigDecimal thisMonthProfit;
private static final long serialVersionUID = 1L;
}

39
bnyer-services/bnyer-img/src/main/resources/com/bnyer/img/mapper/CreatorProfitMapper.xml

@ -219,4 +219,43 @@
#{item}
</foreach>
</update>
<select id="queryTotalProfit" resultType="java.math.BigDecimal">
select
ifnull(sum(profit),0) as totalProfit
from img_creator_profit
where creator_id = #{creatorId}
</select>
<select id="queryLastMonthProfit" resultType="java.math.BigDecimal">
select
ifnull(sum(profit),0) as lastMonthProfit
from img_creator_profit
where creator_id = #{creatorId} and create_time between (select date_add(curdate()-day(curdate())+1,interval -1 month)) and
(select last_day(date_sub(now(),interval 1 month)))
</select>
<select id="queryThisMonthProfit" resultType="java.math.BigDecimal">
select
ifnull(sum(profit),0) as thisMonthProfit
from img_creator_profit
where creator_id = #{creatorId} and create_time between (select date_add(curdate(),interval - day(curdate())+1 day)) and
(select last_day(curdate()))
</select>
<select id="queryLastDayAdProfit" resultType="java.math.BigDecimal">
select
ifnull(sum(profit),0) as yesterdayAdProfit
from img_creator_profit
where creator_id = #{creatorId} and type = '0'
and date_format(create_time,'%Y-%m-%d') = (select date_sub(curdate(), interval 1 day) from dual)
</select>
<select id="queryLastDayInviteProfit" resultType="java.math.BigDecimal">
select
ifnull(sum(profit),0) as yesterdayInviteProfit
from img_creator_profit
where creator_id = #{creatorId} and type = '1'
and date_format(create_time,'%Y-%m-%d') = (select date_sub(curdate(), interval 1 day) from dual)
</select>
</mapper>

Loading…
Cancel
Save