Authored by LUOXC

refactor

... ... @@ -8,18 +8,13 @@ import java.util.List;
public interface InviteSettlementMapper {
int deleteByPrimaryKey(Integer id);
int insert(InviteSettlement record);
int insertSelective(InviteSettlement record);
InviteSettlement selectByPrimaryKey(Integer id);
int updateByUidAndId(InviteSettlement record);
List<InviteSettlement> selectForInviteSettlementList(
@Param("uid") Integer uid, @Param("status") Integer status, @Param("start")
Integer start, @Param("limit") Integer limit);
List<InviteSettlement> selectByUidAndStatusWithLimit(
@Param("uid") Integer uid, @Param("status") Integer status,
@Param("start") Integer start, @Param("limit") Integer limit);
}
\ No newline at end of file
... ...
... ... @@ -7,6 +7,8 @@ import java.math.BigDecimal;
@Data
public class InviteSettlement {
public static final int STATUS_WAIT_SETTLE = 0;
public static final int STATUS_WAIT_PAY = 1;
public static final int STATUS_PAID = 2;
... ...
... ... @@ -36,7 +36,7 @@
where id = #{id,jdbcType=INTEGER} and uid = #{uid,jdbcType=INTEGER}
</update>
<select id="selectForInviteSettlementList" resultMap="BaseResultMap" >
<select id="selectByUidAndStatusWithLimit" resultMap="BaseResultMap" >
select
<include refid="Base_Column_List" />
from invite_settlement
... ...
... ... @@ -41,7 +41,7 @@ public class InviterServiceImpl implements InviterService {
public InviteSettlementListVO getInviteSettlementList(Integer uid) {
// build bo
List<InviteSettlement> inviteSettlementList = inviteSettlementMapper.selectForInviteSettlementList(uid, InviteSettlement.STATUS_PAID, 0, 100);
List<InviteSettlement> inviteSettlementList = inviteSettlementMapper.selectByUidAndStatusWithLimit(uid, InviteSettlement.STATUS_PAID, 0, 100);
// build vo
ZoneOffset zoneOffset = ZoneOffset.of("+8");
... ...
... ... @@ -47,8 +47,8 @@ public class InviterSettleService {
settlement.setUid(uid);
settlement.setCreateTime(now);
settlement.setSettleAmount(BigDecimal.ZERO);
settlement.setSettleTime(now);
settlement.setStatus(InviteSettlement.STATUS_WAIT_PAY);
settlement.setSettleTime(0);
settlement.setStatus(InviteSettlement.STATUS_WAIT_SETTLE);
inviteSettlementMapper.insert(settlement);
// 计算结算金额
try {
... ... @@ -78,6 +78,8 @@ public class InviterSettleService {
uid, settlementId, settleAmountOfType2);
// 更新结算金额
settlement.setSettleAmount(settleAmountOfType1.add(settleAmountOfType2));
settlement.setSettleTime(DateUtil.getCurrentTimeSecond());
settlement.setStatus(InviteSettlement.STATUS_WAIT_PAY);
inviteSettlementMapper.updateByUidAndId(settlement);
}
... ...