Commit 53caafc8 authored by licc's avatar licc

优化月度任务接口2

parent 44413526
......@@ -49,4 +49,11 @@ public interface OrderMapper extends BaseMapper<OrderInfo> {
* @return 订单列表
*/
List<OrderInfo> getListBySuccessTime(@Param("successTime") Date successTime);
/**
* 更据创建订单时间获取订单列表
* @param createTime 创建订单时间
* @return 订单列表
*/
List<OrderInfo> getByCreateTime(@Param("createTime") Date createTime);
}
......@@ -140,4 +140,17 @@
</where>
</select>
<select id="getByCreateTime" resultType="cn.wisenergy.model.app.OrderInfo">
SELECT
<include refid="cols_all"/>
from
<include refid="table"/>
<where>
<if test="successTime != null ">
YEAR(create_time) = YEAR(#{successTime})
AND MONTH(create_time) = MONTH(#{successTime})
</if>
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -29,11 +29,9 @@ public interface AccountService {
/**
* 收益和业绩统计(月度肥料 -日)
*
* @param list 订单信息
* @return true or false
*/
R<Boolean> performanceCount(List<OrderInfo> list);
R<Boolean> performanceCount();
/**
* 获取用户的商机信息
......
......@@ -21,11 +21,9 @@ public interface MonthTaskService {
/**
* 收益和业绩统计(月度肥料)-月任务
*
* @param list 订单信息
* @return true or false
*/
R<Boolean> performanceCount(List<OrderInfo> list);
R<Boolean> performanceCount();
/**
* 进步奖收益统计(最大进步奖) -月任务
......
......@@ -113,7 +113,9 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, AccountInfo>
}
@Override
public R<Boolean> performanceCount(List<OrderInfo> list) {
public R<Boolean> performanceCount() {
//获取本月订单
List<OrderInfo> list = orderMapper.getByCreateTime(new Date());
log.info("shop-mall[]AccountServiceImpl[]performanceCount[]input.param.list:{}", list.size());
if (CollectionUtils.isEmpty(list)) {
return R.ok(0, true);
......
......@@ -76,7 +76,10 @@ public class MonthTaskServiceImpl implements MonthTaskService {
}
@Override
public R<Boolean> performanceCount(List<OrderInfo> list) {
public R<Boolean> performanceCount() {
//获取上月订单
Date lastMonth = DateUtil.getLastMonth(new Date());
List<OrderInfo> list = orderMapper.getByCreateTime(lastMonth);
log.info("shop-mall[]AccountServiceImpl[]performanceCount[]input.param.list:{}", list.size());
if (CollectionUtils.isEmpty(list)) {
return R.ok(0, true);
......@@ -99,7 +102,7 @@ public class MonthTaskServiceImpl implements MonthTaskService {
for (OrderInfo orderInfo : list) {
long createTime = orderInfo.getCreated().getTime();
long time = System.currentTimeMillis();
if (createTime <= time) {
//获取用户信息
User user = usersMapper.selectById(orderInfo.getBuyerId());
if (null == user) {
......@@ -140,7 +143,6 @@ public class MonthTaskServiceImpl implements MonthTaskService {
//4、更新账户月度绩效
accountManager.updateAccountPerformanceMonth(teamPerformances);
}
}
//5、获取所有用户,如果会员等级是黄金以上,计算月度收益
List<User> userList = usersMapper.getAllGoldUser();
if (CollectionUtils.isEmpty(userList)) {
......
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