|
|
|
@ -8,22 +8,31 @@ import com.hfkj.common.exception.ErrorHelp; |
|
|
|
|
import com.hfkj.common.exception.SysCode; |
|
|
|
|
import com.hfkj.common.security.SessionObject; |
|
|
|
|
import com.hfkj.common.security.UserCenter; |
|
|
|
|
import com.hfkj.common.utils.DateUtil; |
|
|
|
|
import com.hfkj.common.utils.ResponseMsgUtil; |
|
|
|
|
import com.hfkj.model.ResponseData; |
|
|
|
|
import com.hfkj.model.SecUserSessionObject; |
|
|
|
|
import com.hfkj.model.UserSessionObject; |
|
|
|
|
import com.hfkj.entity.BsOrder; |
|
|
|
|
import com.hfkj.model.*; |
|
|
|
|
import com.hfkj.service.order.BsOrderService; |
|
|
|
|
import com.hfkj.service.order.Impl.BsOrderServiceImpl; |
|
|
|
|
import com.hfkj.service.promotion.PromotionBusinessService; |
|
|
|
|
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.ApiOperation; |
|
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
|
import org.slf4j.Logger; |
|
|
|
|
import org.slf4j.LoggerFactory; |
|
|
|
|
import org.springframework.beans.BeanUtils; |
|
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.util.*; |
|
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
@Controller |
|
|
|
|
@RequestMapping(value="/order") |
|
|
|
@ -37,15 +46,20 @@ public class BsOrderController { |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private UserCenter userCenter; |
|
|
|
|
|
|
|
|
|
@Resource |
|
|
|
|
private BsOrderService bsOrderService; |
|
|
|
|
private BsUserParentRelService userParentRelService; |
|
|
|
|
@Resource |
|
|
|
|
private BsUserAccountRecordService userAccountRecordService; |
|
|
|
|
@Resource |
|
|
|
|
private SecDictionaryService secDictionaryService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/getOrderList",method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "查询列表") |
|
|
|
|
public ResponseData getOrderList(@RequestParam(value = "orderNo" , required = false) String orderNo, |
|
|
|
|
@RequestParam(value = "type" , required = false) Integer type, |
|
|
|
|
@RequestParam(value = "orderType" , required = true) Integer orderType, |
|
|
|
|
@RequestParam(value = "status" , required = false) Integer status, |
|
|
|
|
@RequestParam(value = "userPhone" , required = false) String userPhone, |
|
|
|
|
@RequestParam(value = "goodsName" , required = false) String goodsName, |
|
|
|
@ -55,24 +69,23 @@ public class BsOrderController { |
|
|
|
|
@RequestParam(value = "pageSize" , required = true) Integer pageSize, HttpServletRequest request) { |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
SessionObject sessionObject = userCenter.getSessionObject(request); |
|
|
|
|
SecUserSessionObject userModel = (SecUserSessionObject) sessionObject.getObject(); |
|
|
|
|
// 用户session
|
|
|
|
|
UserSessionObject session = userCenter.getSessionModel(UserSessionObject.class); |
|
|
|
|
|
|
|
|
|
Map<String , Object> map = new HashMap<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
map.put("orderNo", orderNo); |
|
|
|
|
map.put("userPhone", userPhone); |
|
|
|
|
map.put("type", type); |
|
|
|
|
map.put("userId", userModel.getAccount().getId()); |
|
|
|
|
map.put("orderType", orderType); |
|
|
|
|
map.put("userId", session.getUser().getId()); |
|
|
|
|
map.put("status", status); |
|
|
|
|
map.put("goodsName", goodsName); |
|
|
|
|
map.put("createTimeS", createTimeS); |
|
|
|
|
map.put("createTimeE", createTimeE); |
|
|
|
|
|
|
|
|
|
PageHelper.startPage(pageNum, pageSize); |
|
|
|
|
return ResponseMsgUtil.success(new PageInfo<>(orderService.getOrderList(map))); |
|
|
|
|
return ResponseMsgUtil.success(new PageInfo<>(orderService.getOrderListParent(map))); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("error!",e); |
|
|
|
@ -80,22 +93,13 @@ public class BsOrderController { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/create",method = RequestMethod.POST) |
|
|
|
|
@RequestMapping(value="/getPddOrderList",method = RequestMethod.GET) |
|
|
|
|
@ResponseBody |
|
|
|
|
@ApiOperation(value = "创建订单") |
|
|
|
|
public ResponseData create(@RequestBody JSONObject jsonObject) { |
|
|
|
|
@ApiOperation(value = "用时间段查询推广订单接口") |
|
|
|
|
public ResponseData getPddOrderList() { |
|
|
|
|
try { |
|
|
|
|
|
|
|
|
|
// 用户session
|
|
|
|
|
UserSessionObject userSession = userCenter.getSessionModel(UserSessionObject.class); |
|
|
|
|
if (userSession == null) { |
|
|
|
|
throw ErrorHelp.genException(SysCode.System, ErrorCode.ACCOUNT_LOGIN_NOT, ""); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
jsonObject.put("userId", userSession.getUser().getId()); |
|
|
|
|
jsonObject.put("userPhone", userSession.getUser().getPhone()); |
|
|
|
|
|
|
|
|
|
return ResponseMsgUtil.success(bsOrderService.create(jsonObject)); |
|
|
|
|
return ResponseMsgUtil.success(orderService.getOrderList()); |
|
|
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("error!",e); |
|
|
|
@ -103,4 +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); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|