## Opt - 奖金来源 增加阶段收益部分
This commit is contained in:
parent
08f6b98e29
commit
edb598878e
|
@ -1,7 +1,10 @@
|
|||
package com.hzs.bonus.bonus.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.hzs.bonus.bonus.param.BonusParam;
|
||||
import com.hzs.common.domain.member.bonus.CuMemberBonusStage;
|
||||
import com.hzs.common.domain.member.ext.CuMemberBonusDetailExt;
|
||||
import com.hzs.common.domain.member.ext.CuMemberBonusPushExt;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -21,4 +24,13 @@ public interface CuMemberBonusStageMapper extends BaseMapper<CuMemberBonusStage>
|
|||
*/
|
||||
void batchInsertCuMemberBonusStage(@Param("cuMemberBonusStageList") List<?> cuMemberBonusStageList);
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据查询条件查询固定的奖金明细(阶段收益)
|
||||
*
|
||||
* @param bonusParam 查询条件
|
||||
*/
|
||||
List<CuMemberBonusDetailExt> queryMemberBonusStageByBonusItemsFoServer(@Param("bonusParam") BonusParam bonusParam);
|
||||
}
|
||||
|
|
|
@ -62,6 +62,8 @@ public class CuMemberBonusServiceImpl extends ServiceImpl<CuMemberBonusMapper, C
|
|||
private CuMemberBonusPushMapper cuMemberBonusPushMapper;
|
||||
@Resource
|
||||
private CuMemberBonusRangeMapper cuMemberBonusRangeMapper;
|
||||
@Resource
|
||||
private CuMemberBonusStageMapper cuMemberBonusStageMapper;
|
||||
|
||||
private CuMemberBonusSettle cuMemberBonusSettle;
|
||||
|
||||
|
@ -398,6 +400,14 @@ public class CuMemberBonusServiceImpl extends ServiceImpl<CuMemberBonusMapper, C
|
|||
// MemberBonusDetailSerVO memberBonusDetailVO = BeanUtil.copyProperties(cuMemberBonusRange, MemberBonusDetailSerVO.class);
|
||||
// memberBonusDetailSerVoS.add(memberBonusDetailVO);
|
||||
// });
|
||||
} else if(EBonusItems.STAGE_INCOME.getValue() == bonusItemsValue) {
|
||||
// 阶段收益
|
||||
List<CuMemberBonusDetailExt> cuMemberBonusDetailList = cuMemberBonusStageMapper.queryMemberBonusStageByBonusItemsFoServer(bonusParam);
|
||||
dataTable = getDataTable(cuMemberBonusDetailList);
|
||||
cuMemberBonusDetailList.forEach(cuMemberBonusDetail -> {
|
||||
MemberBonusDetailSerVO memberBonusDetailVO = BeanUtil.copyProperties(cuMemberBonusDetail, MemberBonusDetailSerVO.class);
|
||||
memberBonusDetailSerVoS.add(memberBonusDetailVO);
|
||||
});
|
||||
} else {
|
||||
// 其他收益 区域分红、月度分红平均、月度分红加权
|
||||
List<CuMemberBonusDetailExt> cuMemberBonusDetailList = cuMemberBonusDetailMapper.queryMemberBonusDetailByBonusItemsForServer(bonusParam);
|
||||
|
|
|
@ -326,6 +326,26 @@
|
|||
<if test="bonusParam.pkBonusItems != null">
|
||||
and cd.pk_bonus_items = #{bonusParam.pkBonusItems}
|
||||
</if>
|
||||
union all
|
||||
select
|
||||
cb.pk_member,cs.pk_order,cb.period,cb.pk_country,cs.pk_bonus_items,cs.income_status,cs.CAL_ACHIEVE,cs.pretax_income,cs.income_tax,cs.real_income,
|
||||
cs.remark,cs.income_ratio,cs.income_dial_ratio,cs.order_dial_ratio
|
||||
from cu_member_bonus cb
|
||||
inner join CU_MEMBER_BONUS_STAGE cs
|
||||
on cb.pk_id = cs.pk_bonus
|
||||
where 1=1
|
||||
<if test="bonusParam.pkBonus != null">
|
||||
and cs.pk_bonus = #{bonusParam.pkBonus}
|
||||
</if>
|
||||
<if test="bonusParam.pkGrade != null">
|
||||
and cs.pk_range = #{bonusParam.pkGrade}
|
||||
</if>
|
||||
<if test="bonusParam.period != null">
|
||||
and cb.period = #{bonusParam.period}
|
||||
</if>
|
||||
<if test="bonusParam.pkBonusItems != null">
|
||||
and cd.pk_bonus_items = #{bonusParam.pkBonusItems}
|
||||
</if>
|
||||
) x
|
||||
where 1=1
|
||||
<if test="bonusParam.vertexList != null and bonusParam.vertexList.size >0">
|
||||
|
|
|
@ -33,4 +33,130 @@
|
|||
SELECT 1 FROM dual
|
||||
</insert>
|
||||
|
||||
<select id="queryMemberBonusStageByBonusItemsFoServer"
|
||||
resultType="com.hzs.common.domain.member.ext.CuMemberBonusDetailExt"
|
||||
parameterType="com.hzs.bonus.bonus.param.BonusParam">
|
||||
|
||||
select b.period,cp.settle_date,so.order_code,so.order_type,bt.short_name source_country_name,
|
||||
cu.member_code source_member_code,cu.member_name source_member_name,nvl(so.pk_rate,b.pk_rate) pk_rate,
|
||||
nvl(bc.out_exchange_rate,0) out_exchange_rate,
|
||||
nvl(so.order_amount,0) order_amount, nvl(so.order_achieve,0) order_achieve,
|
||||
b.pk_country,b.pk_bonus_items,b.pretax_income,b.income_tax,b.real_income,b.income_status,
|
||||
tar.member_code,tar.member_name,
|
||||
bg.pk_transaction pk_settle_grade, ba.pk_transaction pk_awards,
|
||||
bv.vertex_name,ct.team_name,
|
||||
b.remark,b.income_ratio,b.income_dial_ratio,b.order_dial_ratio,bct.short_name settle_country
|
||||
from (
|
||||
select cb.pk_member,cd.pk_order,cb.period,cb.pk_country,cd.pk_bonus_items,cd.income_status,
|
||||
cd.CAL_ACHIEVE,cd.pretax_income,cd.income_tax,cd.real_income,
|
||||
cd.remark,cd.income_ratio,cd.income_dial_ratio,cd.order_dial_ratio,cb.pk_rate
|
||||
from cu_member_bonus cb
|
||||
inner join cu_member_bonus_stage cd
|
||||
on cb.pk_id = cd.pk_bonus
|
||||
where 1=1
|
||||
<if test="bonusParam.period != null">
|
||||
and cb.period = #{bonusParam.period}
|
||||
</if>
|
||||
<if test="bonusParam.pkBonusItems != null">
|
||||
and cd.pk_bonus_items = #{bonusParam.pkBonusItems}
|
||||
</if>
|
||||
<if test="bonusParam.vertexList != null and bonusParam.vertexList.size >0">
|
||||
and exists(
|
||||
select 1 from (
|
||||
<foreach collection="bonusParam.vertexList" item="item" separator=" union ">
|
||||
select pk_id from cu_member
|
||||
where del_flag=0 and PAY_STATUS=1
|
||||
start with pk_id = #{item}
|
||||
connect by pk_parent = prior pk_id
|
||||
</foreach>
|
||||
<if test="bonusParam.teamList != null and bonusParam.teamList.size >0">
|
||||
union
|
||||
<foreach collection="bonusParam.teamList" item="item" separator=" union ">
|
||||
select pk_id from cu_member
|
||||
where del_flag=0 and PAY_STATUS=1
|
||||
start with pk_id = #{item}
|
||||
connect by pk_parent = prior pk_id
|
||||
</foreach>
|
||||
</if>
|
||||
) a
|
||||
where a.pk_id = cb.pk_member
|
||||
)
|
||||
</if>
|
||||
) b
|
||||
left join sa_order so
|
||||
on so.pk_id = b.pk_order
|
||||
<if test="bonusParam.orderType != null">
|
||||
and so.order_type = #{bonusParam.orderType}
|
||||
</if>
|
||||
left join cu_member tar
|
||||
on b.pk_member = tar.pk_id
|
||||
left join cu_member cu
|
||||
on so.pk_member = cu.pk_id
|
||||
left join cu_member_settle_period cp
|
||||
on b.period = cp.pk_id
|
||||
left join bd_vertex bv
|
||||
on bv.pk_id = tar.pk_vertex
|
||||
left join cu_member_team ct
|
||||
on ct.pk_id = tar.pk_team_code
|
||||
left join bd_currency bc
|
||||
on bc.pk_id=nvl(so.pk_rate,b.pk_rate)
|
||||
left join bd_grade bg
|
||||
on bg.pk_id=tar.pk_settle_grade
|
||||
left join bd_awards ba
|
||||
on ba.pk_id=tar.pk_awards
|
||||
left join bd_country bt
|
||||
on bt.pk_id=so.pk_country
|
||||
left join bd_country bct
|
||||
on bct.pk_id=tar.pk_settle_country
|
||||
<where>
|
||||
1=1
|
||||
<if test="bonusParam.pkCountry != null">
|
||||
and tar.pk_settle_country = #{bonusParam.pkCountry}
|
||||
</if>
|
||||
<if test="bonusParam.systemType != null">
|
||||
and cu.system_type = #{bonusParam.systemType}
|
||||
</if>
|
||||
<if test="bonusParam.pkVertex != null">
|
||||
and bv.pk_id = #{bonusParam.pkVertex}
|
||||
</if>
|
||||
<if test="bonusParam.pkTeamCode != null">
|
||||
and ct.pk_id =#{bonusParam.pkTeamCode}
|
||||
</if>
|
||||
<if test="bonusParam.sourceCountry != null">
|
||||
and bt.pk_id = #{bonusParam.sourceCountry}
|
||||
</if>
|
||||
<if test="bonusParam.incomeStatus != null">
|
||||
and b.income_status = #{bonusParam.incomeStatus}
|
||||
</if>
|
||||
<if test="bonusParam.orderCode != null and bonusParam.orderCode != ''">
|
||||
and so.order_code like #{bonusParam.orderCode}|| '%'
|
||||
</if>
|
||||
<if test="bonusParam.sourceMemberCode != null and bonusParam.sourceMemberCode != ''">
|
||||
and cu.member_code = #{bonusParam.sourceMemberCode}
|
||||
</if>
|
||||
<if test="bonusParam.sourceMemberName != null and bonusParam.sourceMemberName != ''">
|
||||
and cu.member_name = #{bonusParam.sourceMemberName}
|
||||
</if>
|
||||
<if test="bonusParam.memberCode != null and bonusParam.memberCode != ''">
|
||||
and tar.member_code = #{bonusParam.memberCode}
|
||||
</if>
|
||||
<if test="bonusParam.memberName != null and bonusParam.memberName != ''">
|
||||
and tar.member_name = #{bonusParam.memberName}
|
||||
</if>
|
||||
<if test="bonusParam.settleCountry != null">
|
||||
and tar.pk_settle_country = #{bonusParam.settleCountry}
|
||||
</if>
|
||||
<if test="bonusParam.startDate != null">
|
||||
and cp.settle_date >=#{bonusParam.startDate, jdbcType=DATE}
|
||||
</if>
|
||||
<if test="bonusParam.endDate != null">
|
||||
and cp.settle_date <#{bonusParam.endDate, jdbcType=DATE}
|
||||
</if>
|
||||
</where>
|
||||
<choose>
|
||||
<when test="bonusParam.sort == null or bonusParam.sort ==1">order by cp.settle_date desc, b.real_income desc</when>
|
||||
<when test="bonusParam.sort ==2">order by tar.pk_vertex, b.real_income desc</when>
|
||||
<otherwise>order by tar.pk_teamcode</otherwise>
|
||||
</choose>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue