|
@@ -1,7 +1,10 @@
|
|
|
package com.ym.mec.student.controller;
|
|
|
|
|
|
+import com.ym.mec.biz.dal.dao.OrganizationDao;
|
|
|
import com.ym.mec.biz.dal.dao.SysConfigDao;
|
|
|
-import com.ym.mec.biz.dal.entity.SporadicChargeInfo;
|
|
|
+import com.ym.mec.biz.dal.dto.LuckStatisDto;
|
|
|
+import com.ym.mec.biz.dal.dto.OrderStatisDto;
|
|
|
+import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.service.*;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
@@ -11,12 +14,9 @@ import io.swagger.annotations.ApiOperation;
|
|
|
import java.io.IOException;
|
|
|
import java.math.BigDecimal;
|
|
|
import java.net.URLEncoder;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.HashMap;
|
|
|
-import java.util.LinkedHashMap;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
-import java.util.Objects;
|
|
|
+import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+import java.util.stream.Stream;
|
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
@@ -35,9 +35,6 @@ import com.huifu.adapay.model.payment.PayChannelEnum;
|
|
|
import com.huifu.adapay.model.payment.Payment;
|
|
|
import com.ym.mec.biz.dal.dao.StudentPaymentOrderDao;
|
|
|
import com.ym.mec.biz.dal.dto.VipBuyResultDto;
|
|
|
-import com.ym.mec.biz.dal.entity.Goods;
|
|
|
-import com.ym.mec.biz.dal.entity.MusicGroup;
|
|
|
-import com.ym.mec.biz.dal.entity.StudentPaymentOrder;
|
|
|
import com.ym.mec.biz.dal.enums.DealStatusEnum;
|
|
|
import com.ym.mec.biz.dal.enums.GroupType;
|
|
|
import com.ym.mec.common.controller.BaseController;
|
|
@@ -76,6 +73,8 @@ public class StudentOrderController extends BaseController {
|
|
|
private SysConfigDao sysConfigDao;
|
|
|
@Autowired
|
|
|
private SporadicChargeInfoService sporadicChargeInfoService;
|
|
|
+ @Autowired
|
|
|
+ private OrganizationDao organizationDao;
|
|
|
|
|
|
@PostMapping("/notify")
|
|
|
public Msg notify(@ModelAttribute Msg msg) throws Exception {
|
|
@@ -126,10 +125,11 @@ public class StudentOrderController extends BaseController {
|
|
|
List<Goods> goodsList = studentPaymentOrderDetailService.findApplyOrderGoods(orderByOrderNo.getId());
|
|
|
orderDetail.put("goods", goodsList);
|
|
|
orderDetail.put("course", musicGroup.getCourseForm());
|
|
|
+ orderDetail.put("ownershipType",musicGroup.getOwnershipType());
|
|
|
} else if (orderByOrderNo.getGroupType().equals(GroupType.VIP)) {
|
|
|
VipBuyResultDto vipBuyResultInfo = vipGroupService.findVipBuyResultInfo(Integer.valueOf(orderByOrderNo.getMusicGroupId()));
|
|
|
orderDetail.put("detail", vipBuyResultInfo);
|
|
|
- }else if(orderByOrderNo.getGroupType().equals(GroupType.SPORADIC)){
|
|
|
+ } else if (orderByOrderNo.getGroupType().equals(GroupType.SPORADIC)) {
|
|
|
SporadicChargeInfo info = sporadicChargeInfoService.get(Integer.valueOf(orderByOrderNo.getMusicGroupId()));
|
|
|
orderDetail.put("detail", info);
|
|
|
}
|
|
@@ -286,9 +286,51 @@ public class StudentOrderController extends BaseController {
|
|
|
public void paymentResult(HttpServletResponse response, String orderNo) {
|
|
|
try {
|
|
|
String baseApiUrl = sysConfigDao.findConfigValue("base_api_url");
|
|
|
- response.sendRedirect(baseApiUrl+"/#/paymentresult?orderNo=" + orderNo);
|
|
|
+ response.sendRedirect(baseApiUrl + "/#/paymentresult?orderNo=" + orderNo);
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ @GetMapping("/getLuckStatis")
|
|
|
+ public HttpResponseResult getLuckStatis() {
|
|
|
+ List<Organization> organs = organizationDao.findAllOrgans();
|
|
|
+ List<OrderStatisDto> orders = studentPaymentOrderDao.getLuckStatis();
|
|
|
+
|
|
|
+
|
|
|
+ for (Organization organ : organs) {
|
|
|
+ boolean flag = false;
|
|
|
+ for (OrderStatisDto order : orders) {
|
|
|
+ if (organ.getName().equals(order.getOrganName())) {
|
|
|
+ flag = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!flag) {
|
|
|
+ OrderStatisDto orderStatisDto = new OrderStatisDto();
|
|
|
+ orderStatisDto.setOrganName(organ.getName());
|
|
|
+ orderStatisDto.setMoney(BigDecimal.ZERO);
|
|
|
+ orderStatisDto.setNums(0);
|
|
|
+ orders.add(orderStatisDto);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ BigDecimal totalMoney = BigDecimal.ZERO;
|
|
|
+ Integer totalNum = 0;
|
|
|
+ for (OrderStatisDto order : orders) {
|
|
|
+ if (order.getOrganName().equals("总部国际") || order.getOrganName().equals("阳光总部国际") || order.getOrganName().equals("武汉小学")){
|
|
|
+ orders.remove(order);
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ totalMoney = totalMoney.add(order.getMoney());
|
|
|
+ totalNum += order.getNums();
|
|
|
+ }
|
|
|
+ orders = orders.stream().sorted(Comparator.comparing(OrderStatisDto::getNums).reversed()).collect(Collectors.toList());
|
|
|
+
|
|
|
+ LuckStatisDto luckStatisDto = new LuckStatisDto();
|
|
|
+ luckStatisDto.setOrderStatisDtoList(orders);
|
|
|
+ luckStatisDto.setTotalNum(totalNum);
|
|
|
+ luckStatisDto.setTotalMoney(totalMoney);
|
|
|
+ return succeed(luckStatisDto);
|
|
|
+ }
|
|
|
}
|