|  |  |  | 
|---|
|  |  |  | import io.swagger.annotations.ApiImplicitParam; | 
|---|
|  |  |  | import io.swagger.annotations.ApiImplicitParams; | 
|---|
|  |  |  | import io.swagger.annotations.ApiOperation; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | 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); | 
|---|
|  |  |  | Integer operatorId1 = query.getOperatorId(); | 
|---|
|  |  |  | if (operatorId1!=null){ | 
|---|
|  |  |  | // 赛事集合id | 
|---|
|  |  |  | List<Integer> operatorId = cttService.list(new QueryWrapper<Competition>() | 
|---|
|  |  |  | .eq("operatorId", operatorId1)).stream().map(Competition::getId).collect(Collectors.toList()); | 
|---|
|  |  |  | query.setUserIds(operatorId); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 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") | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping("/base/competition/getPlayPaiFGoldPayRecord") | 
|---|
|  |  |  | public List<PaymentCompetition> getPlayPaiFGoldPayRecord(@RequestBody Integer appUserId){ | 
|---|
|  |  |  | ArrayList<Integer> integers = new ArrayList<>(); | 
|---|
|  |  |  | integers.add(1); | 
|---|
|  |  |  | integers.add(2); | 
|---|
|  |  |  | //        integers.add(1); | 
|---|
|  |  |  | //        integers.add(2); | 
|---|
|  |  |  | integers.add(3); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return paymentCompetitionService.list(new QueryWrapper<PaymentCompetition>() | 
|---|
|  |  |  | .in("payType",integers) | 
|---|
|  |  |  | .eq("appUserId",appUserId) | 
|---|
|  |  |  | .eq("payStatus",3)); | 
|---|
|  |  |  | .eq("payStatus",2)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostMapping("/base/competition/queryByCode") | 
|---|
|  |  |  | public Integer queryByCode(@RequestBody String code){ | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return paymentCompetitionService.queryByCode(code); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @ResponseBody | 
|---|
|  |  |  | @PostMapping("/base/competition/actYys") | 
|---|
|  |  |  | public HashMap<String, Object> actYys(@RequestBody CompetionVO vo){ | 
|---|
|  |  |  | HashMap<String, Object> map = new HashMap<>(); | 
|---|
|  |  |  | if(vo.getIds().size()==0){ | 
|---|
|  |  |  | vo.getIds().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<>(); | 
|---|
|  |  |  | Integer operatorId = vo.getOperatorId(); | 
|---|
|  |  |  | List<Integer> operatorId1 = cttService.list(new QueryWrapper<Competition>().eq("operatorId", operatorId)) | 
|---|
|  |  |  | .stream().map(Competition::getId).collect(Collectors.toList()); | 
|---|
|  |  |  | for (Object o : collect) { | 
|---|
|  |  |  | String s = o.toString(); | 
|---|
|  |  |  | int count = cttService.count(new LambdaQueryWrapper<Competition>().like(Competition::getInsertTime, s).eq(Competition::getOperatorId,vo.getOperatorId())); | 
|---|
|  |  |  | int count1 = ucttService.count(new LambdaQueryWrapper<UserCompetition>().in(UserCompetition::getAppUserId, vo.getIds()).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).ne(Competition::getOperatorId,operatorId)); | 
|---|
|  |  |  | int count1 = ucttService.count(new LambdaQueryWrapper<UserCompetition>().in(UserCompetition::getAppUserId, vo.getIds()).like(UserCompetition::getInsertTime,s)); | 
|---|
|  |  |  | months.add(count); | 
|---|
|  |  |  | monthsUser.add(count1); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | map.put("monthData",months); | 
|---|
|  |  |  | map.put("monthsUser",monthsUser); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return map; | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|