Authored by LUOXC

Merge branch 'hotfix-invite-activity' into test6.9.0

... ... @@ -58,6 +58,7 @@ public interface InviteSettlementItemMapper {
* @return
*/
InviteSettlementItemStats selectStats(@Param("uid") Integer uid,
@Param("statusList") List<Integer> statusList,
@Param("type") Integer type,
@Param("startTime") Integer startTime,
@Param("endTime") Integer endTime);
... ... @@ -73,6 +74,7 @@ public interface InviteSettlementItemMapper {
* @return
*/
List<InviteSettlementItem> select(@Param("uid") Integer uid,
@Param("statusList") List<Integer> statusList,
@Param("type") Integer type,
@Param("startTime") Integer startTime,
@Param("endTime") Integer endTime,
... ...
... ... @@ -136,7 +136,10 @@
from invite_settlement_item
where uid = #{uid,jdbcType=INTEGER}
and type = #{type,jdbcType=INTEGER}
and status in (1,3,4)
and status in
<foreach collection="statusList" item="status" open="(" separator="," close=")">
#{status}
</foreach>
and order_create_time between #{startTime,jdbcType=INTEGER} and #{endTime,jdbcType=INTEGER}
</select>
... ... @@ -146,7 +149,10 @@
from invite_settlement_item
where uid = #{uid,jdbcType=INTEGER}
and type = #{type,jdbcType=INTEGER}
and status in (1,3,4)
and status in
<foreach collection="statusList" item="status" open="(" separator="," close=")">
#{status}
</foreach>
and order_create_time between #{startTime,jdbcType=INTEGER} and #{endTime,jdbcType=INTEGER}
order by order_create_time desc
limit #{start,jdbcType=INTEGER},#{limit,jdbcType=INTEGER}
... ...
... ... @@ -47,11 +47,12 @@ public class InviteSettlementController {
*/
@RequestMapping(params = "method=ufo.invite.getInviteSettlementItemList")
public ApiResponse getInviteSettlementItemList(@RequestParam(value = "uid") Integer uid,
@RequestParam(value = "tab") Integer tab,
@RequestParam(value = "month") String month,
@RequestParam(value = "page", required = false, defaultValue = "1") Integer page,
@RequestParam(value = "limit", required = false, defaultValue = "10") Integer limit) {
log.info("get inviter settlement item list, uid is {}", uid);
InviteSettlementItemListVO resp = inviteSettlementService.getInviteSettlementItemList(uid, month, page, limit);
InviteSettlementItemListVO resp = inviteSettlementService.getInviteSettlementItemList(uid, tab, month, page, limit);
return new ApiResponse.ApiResponseBuilder().code(200).data(resp).message("ok").build();
}
... ...
... ... @@ -15,7 +15,7 @@ public interface IInviteSettlementService {
*/
InviteSettlementListVO getInviteSettlementList(Integer uid);
InviteSettlementItemListVO getInviteSettlementItemList(Integer uid, String month, Integer page, Integer limit);
InviteSettlementItemListVO getInviteSettlementItemList(Integer uid, Integer tab, String month, Integer page, Integer limit);
/**
* 结算
... ...
... ... @@ -88,14 +88,15 @@ public class InviteSettlementServiceImpl implements IInviteSettlementService {
}
@Override
public InviteSettlementItemListVO getInviteSettlementItemList(Integer uid, String month, Integer page, Integer limit) {
if (!ObjectUtils.allNotNull(uid, month, page, limit) || uid <= 0 || page <= 0 || limit <= 0) {
public InviteSettlementItemListVO getInviteSettlementItemList(Integer uid, Integer tab, String month, Integer page, Integer limit) {
if (!ObjectUtils.allNotNull(uid, tab, month, page, limit) || uid <= 0 || page <= 0 || limit <= 0) {
throwServiceException("参数不正确");
}
Pair<Integer, Integer> time = getTimeRangeOfMonth(month);
List<Integer> statusList = getStatusList(tab);
// 只查询结算规则1的记录
int settlementType = 1;
InviteSettlementItemStats stats = inviteSettlementItemMapper.selectStats(uid, settlementType, time.getLeft(), time.getRight());
InviteSettlementItemStats stats = inviteSettlementItemMapper.selectStats(uid, statusList, settlementType, time.getLeft(), time.getRight());
int totalElements = Objects.isNull(stats.getTotalElements()) ? 0 : stats.getTotalElements();
BigDecimal totalOrderAmount = Objects.isNull(stats.getTotalOrderAmount()) ? BigDecimal.ZERO : stats.getTotalOrderAmount();
BigDecimal totalSettleAmount = Objects.isNull(stats.getTotalSettleAmount()) ? BigDecimal.ZERO : stats.getTotalSettleAmount();
... ... @@ -112,12 +113,11 @@ public class InviteSettlementServiceImpl implements IInviteSettlementService {
.totalWaitPayAmount(formatAmount("¥%s", totalWaitPayAmount));
if (totalElements == 0) {
return builder
.list(Lists.newArrayList())
.build();
}
int start = (page - 1) * limit;
List<InviteSettlementItem> list = inviteSettlementItemMapper.select(uid, settlementType, time.getLeft(), time.getRight(), start, limit);
List<InviteSettlementItem> list = inviteSettlementItemMapper.select(uid, statusList, settlementType, time.getLeft(), time.getRight(), start, limit);
Map<Integer, Integer> settlementStatusMap = buildInviteSettlementIdStatusMap(uid, list);
Map<Integer, String> sellerUidNickNameMap = userProxyService.getNickNameByUids(list.stream()
.map(InviteSettlementItem::getSellerUid)
... ... @@ -143,6 +143,20 @@ public class InviteSettlementServiceImpl implements IInviteSettlementService {
.build();
}
private List<Integer> getStatusList(Integer tab) {
if (tab == 0) {
return Lists.newArrayList(1, 3, 4);
}
if (tab == 1) {
return Lists.newArrayList(1, 3);
}
if (tab == 2) {
return Lists.newArrayList(4);
}
throwServiceException("参数不正确");
return Lists.newArrayList();
}
private Map<Integer, Integer> buildInviteSettlementIdStatusMap(Integer uid, List<InviteSettlementItem> list) {
val inviteSettlementIds = list.stream()
.map(InviteSettlementItem::getInviteSettlementId)
... ...