Commit 8bdb8273 authored by licc's avatar licc

月度任务修复2

parent 0ec60626
......@@ -135,4 +135,15 @@ public interface TradeRecordMapper extends BaseMapper<TradeRecord> {
*/
List<TradeRecord> getRebateList(@Param("userId") String userId, @Param("yearMonth") Date yearMonth);
/**
* 根据类型和用户id,获取用户本月该类型最新数据
*
* @param userId 用户id
* @param tradeType 类型
* @param yearMonth 时间
* @return 交易记录
*/
TradeRecord getByUserIdAndTypeAndStatus(@Param("userId") String userId, @Param("tradeType") Integer tradeType,
@Param("yearMonth") Date yearMonth,@Param("status") Integer status);
}
......@@ -246,4 +246,21 @@
</where>
</select>
<select id="getByUserIdAndTypeAndStatus" resultType="cn.wisenergy.model.app.TradeRecord">
select
<include refid="cols_all"/>
from
<include refid="table"/>
<where>
user_id=#{userId}
and trade_type=#{tradeType}
and status=#{status}
AND(
YEAR(create_time) = YEAR(#{yearMonth})
AND MONTH(create_time) = MONTH(#{yearMonth}))
</where>
order by create_time desc
limit 1
</select>
</mapper>
\ No newline at end of file
......@@ -465,8 +465,16 @@ public class DayTaskServiceImpl implements DayTaskService {
AccountInfo accountInfo = accountMapper.getByUserId(user.getUserId());
BigDecimal bigDecimal = new BigDecimal(income).setScale(2, RoundingMode.HALF_UP);
//获取用户本月收益=可提现金额+ 本月肥料收益
BigDecimal performanceMonth = accountInfo.getExtractMoney().add(bigDecimal);
//获取本月培育奖信息
TradeRecord tradeRecordMonth = tradeRecordMapper.getByUserIdAndTypeAndStatus(user.getUserId(),
TradeRecordEnum.CULTIVATING_PRIZE.getCode(), new Date(), TradeStatusEnum.NO_SETTLE_ACCOUNTS.getCode());
BigDecimal tradeMoney = new BigDecimal(0);
if (null != tradeRecordMonth) {
tradeMoney = tradeRecordMonth.getMoney();
}
//获取用户本月收益=可提现金额+ 本月肥料收益+培育奖收益
BigDecimal performanceMonth = accountInfo.getExtractMoney().add(bigDecimal).add(tradeMoney);
accountInfo.setEarningsMonth(performanceMonth);
//获取用户上月总收益
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment