| | |
| | | package com.dsh.competition.controller; |
| | | |
| | | |
| | | import cn.hutool.core.date.DateUtil; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | import java.io.PrintWriter; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.CompletionService; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private AppUserClient appUserClient; |
| | | |
| | | |
| | | /** |
| | | * 获取赛事报名记录 |
| | | */ |
| | | @ResponseBody |
| | | @RequestMapping("/base/competition/listAllPayment") |
| | | public List<PaymentCompetition> listAllPayment(@RequestBody CompetitionQuery query){ |
| | | return paymentCompetitionService.listAll(query); |
| | | List<PaymentCompetition> paymentCompetitions = paymentCompetitionService.listAll(query); |
| | | List<PaymentCompetition> result = new ArrayList<>(); |
| | | if (query.getOperatorId()!=null){ |
| | | for (PaymentCompetition paymentCompetition : paymentCompetitions) { |
| | | Integer competitionId = paymentCompetition.getCompetitionId(); |
| | | Competition byId = cttService.getById(competitionId); |
| | | if (byId!=null){ |
| | | Integer operatorId = byId.getOperatorId(); |
| | | if (operatorId!=null){ |
| | | if (operatorId == query.getOperatorId()){ |
| | | result.add(paymentCompetition); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | }else if (query.getStoreId()!=null){ |
| | | for (PaymentCompetition paymentCompetition : paymentCompetitions) { |
| | | Integer competitionId = paymentCompetition.getCompetitionId(); |
| | | Competition byId = cttService.getById(competitionId); |
| | | if (byId!=null){ |
| | | String storeId = byId.getStoreId(); |
| | | if (storeId.contains(query.getStoreId().toString())){ |
| | | result.add(paymentCompetition); |
| | | } |
| | | } |
| | | } |
| | | return result; |
| | | } |
| | | return paymentCompetitions; |
| | | } |
| | | @ResponseBody |
| | | @PostMapping("/base/competition/getPayedCompetitions") |
| | |
| | | .eq("appUserId",appUserId) |
| | | .eq("payStatus",3)); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/base/competition/queryByCode") |
| | | public Integer queryByCode(@RequestBody String code){ |
| | | |
| | | return paymentCompetitionService.queryByCode(code); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | |
| | | return sum; |
| | | } |
| | | |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/base/competition/actPt") |
| | | public HashMap<String, Object> actPt(@RequestBody List<Integer> ids){ |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | if(ids.size()==0){ |
| | | ids.add(-1); |
| | | } |
| | | ArrayList<Object> integers = new ArrayList<>(); |
| | | int year = DateUtil.year(new Date()); |
| | | |
| | | for (int i = 0; i < 10; i++) { |
| | | integers.add(year-i); |
| | | } |
| | | List<Object> collect = integers.stream().sorted().collect(Collectors.toList()); |
| | | // 年 |
| | | ArrayList<Integer> years = new ArrayList<>(); |
| | | ArrayList<Integer> yearsUser = new ArrayList<>(); |
| | | for (Object o : collect) { |
| | | String s = o.toString(); |
| | | int count = cttService.count(new LambdaQueryWrapper<Competition>().like(Competition::getInsertTime, s)); |
| | | int count1 = ucttService.count(new LambdaQueryWrapper<UserCompetition>().in(UserCompetition::getAppUserId, ids).like(UserCompetition::getInsertTime,s)); |
| | | years.add(count); |
| | | yearsUser.add(count1); |
| | | } |
| | | map.put("yearData",years); |
| | | map.put("yearsUser",yearsUser); |
| | | // 月 |
| | | SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | ArrayList<Integer> months = new ArrayList<>(); |
| | | ArrayList<Integer> monthsUser = new ArrayList<>(); |
| | | for (int i = 1; i <= 12; i++) { |
| | | double sum=0.0; |
| | | String m=i+""; |
| | | if(i<10){ |
| | | m="0"+i; |
| | | } |
| | | String s = year + "-" + m; |
| | | int count = cttService.count(new LambdaQueryWrapper<Competition>().like(Competition::getInsertTime, s)); |
| | | int count1 = ucttService.count(new LambdaQueryWrapper<UserCompetition>().in(UserCompetition::getAppUserId, ids).like(UserCompetition::getInsertTime,s)); |
| | | months.add(count); |
| | | monthsUser.add(count1); |
| | | } |
| | | map.put("monthData",months); |
| | | map.put("monthsUser",monthsUser); |
| | | |
| | | return map; |
| | | |
| | | |
| | | |
| | | } |
| | | |
| | | } |
| | | |