|
|
@ -8,24 +8,31 @@ import com.hfkj.common.exception.ErrorHelp; |
|
|
|
import com.hfkj.common.exception.SysCode; |
|
|
|
import com.hfkj.common.exception.SysCode; |
|
|
|
import com.hfkj.common.security.SessionObject; |
|
|
|
import com.hfkj.common.security.SessionObject; |
|
|
|
import com.hfkj.common.security.UserCenter; |
|
|
|
import com.hfkj.common.security.UserCenter; |
|
|
|
|
|
|
|
import com.hfkj.common.utils.DateUtil; |
|
|
|
import com.hfkj.common.utils.ResponseMsgUtil; |
|
|
|
import com.hfkj.common.utils.ResponseMsgUtil; |
|
|
|
import com.hfkj.model.ResponseData; |
|
|
|
import com.hfkj.entity.BsOrder; |
|
|
|
import com.hfkj.model.SecUserSessionObject; |
|
|
|
import com.hfkj.model.*; |
|
|
|
import com.hfkj.model.UserSessionObject; |
|
|
|
|
|
|
|
import com.hfkj.service.order.BsOrderService; |
|
|
|
import com.hfkj.service.order.BsOrderService; |
|
|
|
|
|
|
|
import com.hfkj.service.order.Impl.BsOrderServiceImpl; |
|
|
|
import com.hfkj.service.promotion.PromotionBusinessService; |
|
|
|
import com.hfkj.service.promotion.PromotionBusinessService; |
|
|
|
import com.hfkj.service.promotion.PromotionService; |
|
|
|
import com.hfkj.service.promotion.PromotionService; |
|
|
|
|
|
|
|
import com.hfkj.service.sec.SecDictionaryService; |
|
|
|
|
|
|
|
import com.hfkj.service.user.BsUserAccountRecordService; |
|
|
|
|
|
|
|
import com.hfkj.service.user.BsUserParentRelService; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.Logger; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
@Controller |
|
|
|
@Controller |
|
|
|
@RequestMapping(value="/order") |
|
|
|
@RequestMapping(value="/order") |
|
|
@ -39,6 +46,12 @@ public class BsOrderController { |
|
|
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
@Resource |
|
|
|
private UserCenter userCenter; |
|
|
|
private UserCenter userCenter; |
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
private BsUserParentRelService userParentRelService; |
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
private BsUserAccountRecordService userAccountRecordService; |
|
|
|
|
|
|
|
@Resource |
|
|
|
|
|
|
|
private SecDictionaryService secDictionaryService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/getOrderList",method = RequestMethod.GET) |
|
|
|
@RequestMapping(value="/getOrderList",method = RequestMethod.GET) |
|
|
@ -94,6 +107,163 @@ public class BsOrderController { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/statisticsOrder",method = RequestMethod.GET) |
|
|
|
|
|
|
|
@ResponseBody |
|
|
|
|
|
|
|
@ApiOperation(value = "统计订单") |
|
|
|
|
|
|
|
public ResponseData statisticsOrder() { |
|
|
|
|
|
|
|
// 用户session
|
|
|
|
|
|
|
|
UserSessionObject session = userCenter.getSessionModel(UserSessionObject.class); |
|
|
|
|
|
|
|
// 今日时间
|
|
|
|
|
|
|
|
Map<String, Date> todayTime = DateUtil.getTodayTimeObj(); |
|
|
|
|
|
|
|
// 昨日时间
|
|
|
|
|
|
|
|
Map<String, Date> yesterdayTime = DateUtil.getYesterdayTimeObj(); |
|
|
|
|
|
|
|
// 本月时间
|
|
|
|
|
|
|
|
Map<String, Date> thisMonthTime = DateUtil.getThisMonthTimeObj(); |
|
|
|
|
|
|
|
// 上月时间
|
|
|
|
|
|
|
|
Map<String, Date> lastMonthTime = DateUtil.getLastMonthTimeObj(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 创建一个Calendar对象,并设置为2024年2月0日,即2024年1月最后一天
|
|
|
|
|
|
|
|
Calendar timeS = new GregorianCalendar(); |
|
|
|
|
|
|
|
timeS.set(Calendar.YEAR, 2024); |
|
|
|
|
|
|
|
timeS.set(Calendar.MONTH, 1); |
|
|
|
|
|
|
|
timeS.set(Calendar.DAY_OF_MONTH, 0); |
|
|
|
|
|
|
|
// 设置时间为23点59分59秒
|
|
|
|
|
|
|
|
timeS.set(Calendar.HOUR_OF_DAY, 23); |
|
|
|
|
|
|
|
timeS.set(Calendar.MINUTE, 59); |
|
|
|
|
|
|
|
timeS.set(Calendar.SECOND, 59); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<BsOrder> list = orderService.getOrderList(new HashMap<>()); |
|
|
|
|
|
|
|
// 查询个人订单
|
|
|
|
|
|
|
|
List<BsOrder> orderUserList = list.stream().filter(s->s.getUserId().equals(session.getUser().getId())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
//查询团队
|
|
|
|
|
|
|
|
// 查询团队用户
|
|
|
|
|
|
|
|
Map<String,Object> param = new HashMap<>(); |
|
|
|
|
|
|
|
param.put("parentUserId", session.getUser().getId()); |
|
|
|
|
|
|
|
// 查询下级数据
|
|
|
|
|
|
|
|
List<UserTeamModel> subList = userParentRelService.getTeamSubList(param); |
|
|
|
|
|
|
|
List<BsOrder> teamOrderList = new ArrayList<>(); |
|
|
|
|
|
|
|
// 遍历下级数据
|
|
|
|
|
|
|
|
for (UserTeamModel userTeamModel : subList) { |
|
|
|
|
|
|
|
List<BsOrder> teamList = list.stream().filter(bsOrder -> bsOrder.getUserId().equals(userTeamModel.getUserId())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
teamOrderList.addAll(teamList); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 所有订单
|
|
|
|
|
|
|
|
List<BsOrder> allOrderList = new ArrayList<>(); |
|
|
|
|
|
|
|
allOrderList.addAll(orderUserList); |
|
|
|
|
|
|
|
allOrderList.addAll(teamOrderList); |
|
|
|
|
|
|
|
Map<String,Object> map = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BigDecimal goldCoinExchangeRate = new BigDecimal(secDictionaryService.getDictionary("GOLD_COIN_EXCHANGE_RATE").get(0).getCodeValue()); |
|
|
|
|
|
|
|
map.put("cumulative" , userAccountRecordService.getUserTotalProfit(session.getUser().getId() , null , null)); |
|
|
|
|
|
|
|
map.put("unliquidated" , allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2) || s.getStatus().equals(3)).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 今日收益报表
|
|
|
|
|
|
|
|
Map<String , Object> todayReport = new HashMap<>(); |
|
|
|
|
|
|
|
JSONObject object; |
|
|
|
|
|
|
|
// 获取今天新增订单
|
|
|
|
|
|
|
|
object = new JSONObject(); |
|
|
|
|
|
|
|
object.put("orderNum", (int) allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2) || s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(todayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(todayTime.get("timeE").toInstant())).count()); |
|
|
|
|
|
|
|
object.put("orderMoney", allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2) || s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(todayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(todayTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate)); |
|
|
|
|
|
|
|
todayReport.put("todayAddOrder", object); |
|
|
|
|
|
|
|
// 获取今天我的订单
|
|
|
|
|
|
|
|
object = new JSONObject(); |
|
|
|
|
|
|
|
object.put("orderNum", (int) orderUserList.stream().filter(s->s.getStatus().equals(1) || s.getStatus().equals(2) || s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(todayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(todayTime.get("timeE").toInstant())).count()); |
|
|
|
|
|
|
|
object.put("orderMoney", orderUserList.stream().filter(s->s.getStatus().equals(1) || s.getStatus().equals(2) || s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(todayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(todayTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate)); |
|
|
|
|
|
|
|
todayReport.put("todayUserOrder", object); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 团队订单
|
|
|
|
|
|
|
|
object = new JSONObject(); |
|
|
|
|
|
|
|
object.put("orderTeamNum", (int) teamOrderList.stream().filter(s->s.getStatus().equals(5)).filter(s -> s.getCreateTime().toInstant().isAfter(todayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(todayTime.get("timeE").toInstant())).count()); |
|
|
|
|
|
|
|
object.put("orderTeamMoney", teamOrderList.stream().filter(s->s.getStatus().equals(5)).filter(s -> s.getCreateTime().toInstant().isAfter(todayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(todayTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate)); |
|
|
|
|
|
|
|
todayReport.put("teamOrderList", object); |
|
|
|
|
|
|
|
// 获取今天失效订单
|
|
|
|
|
|
|
|
object = new JSONObject(); |
|
|
|
|
|
|
|
object.put("orderFailureNum", (int) allOrderList.stream().filter(s -> s.getStatus().equals(6)).filter(s -> s.getCreateTime().toInstant().isAfter(todayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(todayTime.get("timeE").toInstant())).count()); |
|
|
|
|
|
|
|
object.put("orderFailureMoney", allOrderList.stream().filter(s -> s.getStatus().equals(6)).filter(s -> s.getCreateTime().toInstant().isAfter(todayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(todayTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate)); |
|
|
|
|
|
|
|
todayReport.put("todayFailureOrder", object); |
|
|
|
|
|
|
|
map.put("todayReport" ,todayReport); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 昨天收益报表
|
|
|
|
|
|
|
|
Map<String , Object> yesterdayReport = new HashMap<>(); |
|
|
|
|
|
|
|
// 获取昨天新增订单
|
|
|
|
|
|
|
|
object = new JSONObject(); |
|
|
|
|
|
|
|
object.put("orderNum", (int) allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2) || s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(yesterdayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(yesterdayTime.get("timeE").toInstant())).count()); |
|
|
|
|
|
|
|
object.put("orderMoney", allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2) || s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(yesterdayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(yesterdayTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate)); |
|
|
|
|
|
|
|
yesterdayReport.put("yesterdayAddOrder", object); |
|
|
|
|
|
|
|
// 获取昨天我的订单
|
|
|
|
|
|
|
|
object = new JSONObject(); |
|
|
|
|
|
|
|
object.put("orderNum", (int) orderUserList.stream().filter(s->s.getStatus().equals(1) || s.getStatus().equals(2) || s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(yesterdayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(yesterdayTime.get("timeE").toInstant())).count()); |
|
|
|
|
|
|
|
object.put("orderMoney", orderUserList.stream().filter(s->s.getStatus().equals(1) || s.getStatus().equals(2) || s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(yesterdayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(yesterdayTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate)); |
|
|
|
|
|
|
|
yesterdayReport.put("yesterdayUserOrder", object); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 团队订单
|
|
|
|
|
|
|
|
object = new JSONObject(); |
|
|
|
|
|
|
|
object.put("orderNum", (int) teamOrderList.stream().filter(s->s.getStatus().equals(5)).filter(s -> s.getCreateTime().toInstant().isAfter(yesterdayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(yesterdayTime.get("timeE").toInstant())).count()); |
|
|
|
|
|
|
|
object.put("orderMoney", teamOrderList.stream().filter(s->s.getStatus().equals(5)).filter(s -> s.getCreateTime().toInstant().isAfter(yesterdayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(yesterdayTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate)); |
|
|
|
|
|
|
|
yesterdayReport.put("yesterdayOrderList", object); |
|
|
|
|
|
|
|
// 获取昨天失效订单
|
|
|
|
|
|
|
|
object = new JSONObject(); |
|
|
|
|
|
|
|
object.put("orderNum", (int) allOrderList.stream().filter(s -> s.getStatus().equals(6)).filter(s -> s.getCreateTime().toInstant().isAfter(yesterdayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(yesterdayTime.get("timeE").toInstant())).count()); |
|
|
|
|
|
|
|
object.put("orderMoney", allOrderList.stream().filter(s -> s.getStatus().equals(6)).filter(s -> s.getCreateTime().toInstant().isAfter(yesterdayTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(yesterdayTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate)); |
|
|
|
|
|
|
|
yesterdayReport.put("yesterdayFailureOrder", object); |
|
|
|
|
|
|
|
map.put("yesterdayReport" ,yesterdayReport); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 本月收益报表
|
|
|
|
|
|
|
|
Map<String , Object> thisMonthReport = new HashMap<>(); |
|
|
|
|
|
|
|
// 获取本月新增订单
|
|
|
|
|
|
|
|
object = new JSONObject(); |
|
|
|
|
|
|
|
object.put("orderNum", (int) allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2) || s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(thisMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(thisMonthTime.get("timeE").toInstant())).count()); |
|
|
|
|
|
|
|
object.put("orderMoney", allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2) || s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(thisMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(thisMonthTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate)); |
|
|
|
|
|
|
|
thisMonthReport.put("thisMonthAddOrder", object); |
|
|
|
|
|
|
|
// 获取本月我的订单
|
|
|
|
|
|
|
|
object = new JSONObject(); |
|
|
|
|
|
|
|
object.put("orderNum", (int) orderUserList.stream().filter(s->s.getStatus().equals(1) || s.getStatus().equals(2) || s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(thisMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(thisMonthTime.get("timeE").toInstant())).count()); |
|
|
|
|
|
|
|
object.put("orderMoney", orderUserList.stream().filter(s->s.getStatus().equals(1) || s.getStatus().equals(2) || s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(thisMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(thisMonthTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate)); |
|
|
|
|
|
|
|
thisMonthReport.put("thisMonthUserOrder", object); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 团队订单
|
|
|
|
|
|
|
|
object = new JSONObject(); |
|
|
|
|
|
|
|
object.put("orderNum", (int) teamOrderList.stream().filter(s->s.getStatus().equals(5)).filter(s -> s.getCreateTime().toInstant().isAfter(thisMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(thisMonthTime.get("timeE").toInstant())).count()); |
|
|
|
|
|
|
|
object.put("orderMoney", teamOrderList.stream().filter(s->s.getStatus().equals(5)).filter(s -> s.getCreateTime().toInstant().isAfter(thisMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(thisMonthTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate)); |
|
|
|
|
|
|
|
thisMonthReport.put("thisMonthOrderList", object); |
|
|
|
|
|
|
|
// 获取本月失效订单
|
|
|
|
|
|
|
|
object = new JSONObject(); |
|
|
|
|
|
|
|
object.put("orderNum", (int) allOrderList.stream().filter(s -> s.getStatus().equals(6)).filter(s -> s.getCreateTime().toInstant().isAfter(thisMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(thisMonthTime.get("timeE").toInstant())).count()); |
|
|
|
|
|
|
|
object.put("orderMoney", allOrderList.stream().filter(s -> s.getStatus().equals(6)).filter(s -> s.getCreateTime().toInstant().isAfter(thisMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(thisMonthTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate)); |
|
|
|
|
|
|
|
thisMonthReport.put("thisMonthFailureOrder", object); |
|
|
|
|
|
|
|
map.put("thisMonthReport" ,thisMonthReport); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 上月收益报表
|
|
|
|
|
|
|
|
Map<String , Object> lastMonthReport = new HashMap<>(); |
|
|
|
|
|
|
|
// 获取本月新增订单
|
|
|
|
|
|
|
|
object = new JSONObject(); |
|
|
|
|
|
|
|
object.put("orderNum", (int) allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2) || s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(lastMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(lastMonthTime.get("timeE").toInstant())).count()); |
|
|
|
|
|
|
|
object.put("orderMoney", allOrderList.stream().filter(s -> s.getStatus().equals(1) || s.getStatus().equals(2) || s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(lastMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(lastMonthTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate)); |
|
|
|
|
|
|
|
lastMonthReport.put("lastMonthAddOrder", object); |
|
|
|
|
|
|
|
// 获取本月我的订单
|
|
|
|
|
|
|
|
object = new JSONObject(); |
|
|
|
|
|
|
|
object.put("orderNum", (int) orderUserList.stream().filter(s->s.getStatus().equals(1) || s.getStatus().equals(2) || s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(lastMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(lastMonthTime.get("timeE").toInstant())).count()); |
|
|
|
|
|
|
|
object.put("orderMoney", orderUserList.stream().filter(s->s.getStatus().equals(1) || s.getStatus().equals(2) || s.getStatus().equals(3)).filter(s -> s.getCreateTime().toInstant().isAfter(lastMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(lastMonthTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate)); |
|
|
|
|
|
|
|
lastMonthReport.put("lastMonthUserOrder", object); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 团队订单
|
|
|
|
|
|
|
|
object = new JSONObject(); |
|
|
|
|
|
|
|
object.put("orderNum", (int) teamOrderList.stream().filter(s->s.getStatus().equals(5)).filter(s -> s.getCreateTime().toInstant().isAfter(lastMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(lastMonthTime.get("timeE").toInstant())).count()); |
|
|
|
|
|
|
|
object.put("orderMoney", teamOrderList.stream().filter(s->s.getStatus().equals(5)).filter(s -> s.getCreateTime().toInstant().isAfter(lastMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(lastMonthTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate)); |
|
|
|
|
|
|
|
lastMonthReport.put("lastMonthOrderList", object); |
|
|
|
|
|
|
|
// 获取本月失效订单
|
|
|
|
|
|
|
|
object = new JSONObject(); |
|
|
|
|
|
|
|
object.put("orderNum", (int) allOrderList.stream().filter(s -> s.getStatus().equals(6)).filter(s -> s.getCreateTime().toInstant().isAfter(lastMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(lastMonthTime.get("timeE").toInstant())).count()); |
|
|
|
|
|
|
|
object.put("orderMoney", allOrderList.stream().filter(s -> s.getStatus().equals(6)).filter(s -> s.getCreateTime().toInstant().isAfter(lastMonthTime.get("timeS").toInstant()) && s.getCreateTime().toInstant().isBefore(lastMonthTime.get("timeE").toInstant())).map(BsOrder::getPromotionAmount).reduce(BigDecimal.ZERO, BigDecimal::add).multiply(goldCoinExchangeRate)); |
|
|
|
|
|
|
|
lastMonthReport.put("lastMonthFailureOrder", object); |
|
|
|
|
|
|
|
map.put("lastMonthReport" ,lastMonthReport); |
|
|
|
|
|
|
|
return ResponseMsgUtil.success(map); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|