Merge branch '2.0' of http://120.76.84.145:10101/gitblit/r/java/PlayPai into 2.0
| | |
| | | import com.dsh.account.model.LoginSMSCodeVo; |
| | | import com.dsh.account.model.LoginWeChatVo; |
| | | import com.dsh.account.model.QueryByNamePhone; |
| | | import com.dsh.account.model.query.UserDetailsOfSearch; |
| | | import com.dsh.account.model.query.appUserQuery.QueryAppUser; |
| | | import com.dsh.account.model.vo.QueryAppUserVO; |
| | | import com.dsh.account.service.IVipPaymentService; |
| | |
| | | List<TAppUser> list = appUserService.list(queryWrapper); |
| | | return list.stream().map(TAppUser::getId).collect(Collectors.toList()); |
| | | } |
| | | |
| | | |
| | | @PostMapping("/appUser/queryAppUserByIds") |
| | | @ResponseBody |
| | | public List<TAppUser> queryAppUserByIds(@RequestBody UserDetailsOfSearch search){ |
| | | LambdaQueryWrapper<TAppUser> tAppUserLambdaQueryWrapper = new LambdaQueryWrapper<>(); |
| | | if(ToolUtil.isNotEmpty(search.getIdCard())){ |
| | | tAppUserLambdaQueryWrapper.eq(TAppUser::getIdCard, search.getIdCard()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(search.getPhone())){ |
| | | tAppUserLambdaQueryWrapper.eq(TAppUser::getPhone, search.getPhone()); |
| | | } |
| | | if(ToolUtil.isNotEmpty(search.getName())){ |
| | | tAppUserLambdaQueryWrapper.eq(TAppUser::getName, search.getName()); |
| | | } |
| | | tAppUserLambdaQueryWrapper.in(TAppUser::getId,search.getUseIds()); |
| | | return appUserService.list(tAppUserLambdaQueryWrapper); |
| | | } |
| | | } |
New file |
| | |
| | | package com.dsh.account.model.query; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class UserDetailsOfSearch { |
| | | |
| | | private String name; |
| | | |
| | | private String phone; |
| | | |
| | | private String idCard; |
| | | |
| | | private List<Integer> useIds; |
| | | } |
| | |
| | | detail.setConsumeName("社区世界杯调整比分"); |
| | | detail.setDetailsType(1); |
| | | break; |
| | | case 9: |
| | | detail.setConsumeAmount("" + (userIntegralChange.getNewIntegral() - userIntegralChange.getOldIntegral())); |
| | | detail.setConsumeName("社区世界杯平场"); |
| | | detail.setDetailsType(2); |
| | | break; |
| | | case 10: |
| | | detail.setConsumeAmount("" + (userIntegralChange.getNewIntegral() - userIntegralChange.getOldIntegral())); |
| | | detail.setConsumeName("社区世界杯败场"); |
| | | detail.setDetailsType(2); |
| | | break; |
| | | default: |
| | | break; |
| | | } |
| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
| | | import com.dsh.communityWorldCup.entity.*; |
| | | import com.dsh.communityWorldCup.feignclient.account.AppUserClient; |
| | | import com.dsh.communityWorldCup.feignclient.account.StudentClient; |
| | | import com.dsh.communityWorldCup.feignclient.account.StudentHonorClient; |
| | | import com.dsh.communityWorldCup.feignclient.account.UserIntegralChangesClient; |
| | | import com.dsh.communityWorldCup.feignclient.account.model.AppUser; |
| | | import com.dsh.communityWorldCup.feignclient.account.model.SaveUserIntegralChangesVo; |
| | | import com.dsh.communityWorldCup.feignclient.account.model.StudentHonor; |
| | | import com.dsh.communityWorldCup.feignclient.account.model.TStudent; |
| | | import com.dsh.communityWorldCup.feignclient.competition.ParticipantClient; |
| | | import com.dsh.communityWorldCup.feignclient.competition.model.Participant; |
| | |
| | | import com.dsh.communityWorldCup.feignclient.other.model.TGame; |
| | | import com.dsh.communityWorldCup.model.*; |
| | | import com.dsh.communityWorldCup.service.*; |
| | | import com.dsh.communityWorldCup.util.GDMapGeocodingUtil; |
| | | import com.dsh.communityWorldCup.util.PayMoneyUtil; |
| | | import com.dsh.communityWorldCup.util.ResultUtil; |
| | | import com.dsh.communityWorldCup.util.TokenUtil; |
| | | import com.dsh.communityWorldCup.util.*; |
| | | import com.dsh.communityWorldCup.util.wx.WxV3PayConfig; |
| | | import com.wechat.pay.contrib.apache.httpclient.util.AesUtil; |
| | | import groovy.util.logging.Log4j; |
| | |
| | | import java.io.IOException; |
| | | import java.io.PrintWriter; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.text.ParseException; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | |
| | | @Resource |
| | | private GameClient gameClient; |
| | | |
| | | @Autowired |
| | | private UserIntegralChangesClient userIntegralChangesClient; |
| | | |
| | | @Autowired |
| | | private StudentHonorClient studentHonorClient; |
| | | |
| | | |
| | | /** |
| | |
| | | if(0 == isStudent){ |
| | | isStudent = 2; |
| | | } |
| | | WorldCup worldCup = worldCupService.getById(worldCupPeople.getWorldCupId()); |
| | | if(null == worldCup){ |
| | | return ResultUtil.error("当前比赛不存在"); |
| | | } |
| | | if(worldCup.getStartTime().getTime()>System.currentTimeMillis() || worldCup.getEndTime().getTime()<System.currentTimeMillis()){ |
| | | return ResultUtil.error("二维码仅支持在赛事有效期使用"); |
| | | } |
| | | |
| | | |
| | | |
| | | WorldCupPaymentParticipant worldCupPaymentParticipant = worldCupPaymentParticipantService.getOne(new QueryWrapper<WorldCupPaymentParticipant>() |
| | | .eq("worldCupId", worldCupPeople.getWorldCupId()).eq("participantId", id).eq("participantType", isStudent) |
| | | .orderByDesc("createTime").last(" limit 0, 1")); |
| | |
| | | }) |
| | | public ResultUtil startWorldCup(StartWorldCup startWorldCup){ |
| | | return worldCupService.startWorldCup(startWorldCup); |
| | | } |
| | | @ResponseBody |
| | | @PostMapping("/api/worldCup/endWorldCup") |
| | | @ApiOperation(value = "裁判结束比赛【3.1】", tags = {"APP-个人中心"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), |
| | | @ApiImplicitParam(name = "redScore", value = "红队得分", required = true, dataType = "Integer"), |
| | | @ApiImplicitParam(name = "blueScore", value = "蓝队得分", required = true, dataType = "Integer"), |
| | | @ApiImplicitParam(name = "custom", value = "自定义参数 列表中是数组 ,拼接传过来", required = true, dataType = "String") |
| | | }) |
| | | public ResultUtil endWorldCup(String custom, Integer redScore, Integer blueScore){ |
| | | return worldCupService.endWorldCup(custom,redScore,blueScore); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | worldCupRank.setAppUserId(uid); |
| | | List<WorldCupRankVo> worldCupRank1 = worldCupCompetitorService.getWorldCupRank(worldCupRank); |
| | | return ResultUtil.success(worldCupRank1); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/api/worldCup/getWorldCupListFromRank") |
| | | @ApiOperation(value = "获取报名的赛事 排名使用【3.1】", tags = {"APP-个人中心"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<WorldCupListVo>> getWorldCupListFromRank(MyWorldCupList myWorldCupList){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<WorldCupListVo> worldCupRank1 = worldCupCompetitorService.getWorldCupListFromRank(myWorldCupList); |
| | | return ResultUtil.success(worldCupRank1); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ResultUtil.runErr(); |
| | | } |
| | | } |
| | | @ResponseBody |
| | | @PostMapping("/api/worldCup/getWorldCupCodeListId") |
| | | @ApiOperation(value = "获取赛事的赛点 非智慧比赛用 【3.1】", tags = {"APP-个人中心"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<WorldCupCodeListVo>> getWorldCupCodeListId(Integer worldCupId){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<WorldCupCodeListVo> worldCupRank1 = worldCupCompetitorService.getWorldCupCodeListId(worldCupId); |
| | | return ResultUtil.success(worldCupRank1); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | |
| | | .last(" and createTime between '" + sdf.format(getWorldCupPayment.getStartTime()) + "' and '" + sdf.format(getWorldCupPayment.getEndTime()) + "' order by createTime desc")); |
| | | return list; |
| | | } |
| | | |
| | | |
| | | @PostMapping("/worldCup/userDetailsOfSearch") |
| | | @ResponseBody |
| | | public List<WorldCupUserListVo> userDetailsOfSearch(@RequestBody UserDetailsOfSearch search){ |
| | | // 已报名的用户 |
| | | List<WorldCupPaymentParticipant> list = worldCupPaymentParticipantService.list(new LambdaQueryWrapper<WorldCupPaymentParticipant>().eq(WorldCupPaymentParticipant::getWorldCupId, search.getId()) |
| | | .eq(WorldCupPaymentParticipant::getAlreadyEntered, 0)); |
| | | ArrayList<WorldCupUserListVo> worldCupUserListVos = new ArrayList<>(); |
| | | if(list.size()>0){ |
| | | List<Integer> collect = list.stream().map(WorldCupPaymentParticipant::getAppUserId).collect(Collectors.toList()); |
| | | search.setUseIds(collect); |
| | | List<AppUser> appUsers = appUserClient.queryAppUserByIds(search); |
| | | |
| | | for (AppUser appUser : appUsers) { |
| | | WorldCupUserListVo worldCupUserListVo = new WorldCupUserListVo(); |
| | | WorldCupPaymentParticipant worldCupPaymentParticipant = list.stream().filter(e -> e.getAppUserId().equals(appUser.getId())).findFirst().orElse(null); |
| | | if(worldCupPaymentParticipant!=null){ |
| | | worldCupUserListVo.setId(worldCupPaymentParticipant.getId()); |
| | | worldCupUserListVo.setName(appUser.getName()); |
| | | worldCupUserListVo.setSex(appUser.getGender() !=null && appUser.getGender()==2?"女":"男"); |
| | | worldCupUserListVo.setPhone(appUser.getPhone()); |
| | | worldCupUserListVo.setIdCard(appUser.getIdCard()); |
| | | // 当前日期和生日计算年龄 |
| | | Date birthday = appUser.getBirthday(); |
| | | LocalDate now = LocalDate.now(); |
| | | if(birthday!=null){ |
| | | int age = now.getYear() - birthday.getYear(); |
| | | worldCupUserListVo.setAge(age); |
| | | } |
| | | worldCupUserListVos.add(worldCupUserListVo); |
| | | } |
| | | } |
| | | |
| | | } |
| | | return worldCupUserListVos; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @PostMapping("/worldCup/savaData1") |
| | | public void savaData1(@RequestBody SaveData saveData) throws ParseException { |
| | | |
| | | WorldCup worldCup = worldCupService.getById(saveData.getId()); |
| | | |
| | | String redStr = saveData.getRedStr(); |
| | | String blueStr = saveData.getBlueStr(); |
| | | String[] red = redStr.split(","); |
| | | String[] blue = blueStr.split(","); |
| | | ArrayList<String> list = new ArrayList<>(red.length+blue.length); |
| | | list.addAll(Arrays.asList(red)); |
| | | list.addAll(Arrays.asList(blue)); |
| | | String time = saveData.getTime(); |
| | | String[] split = time.split(" - "); |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | Date startTime = simpleDateFormat.parse(split[0]); |
| | | Date endTime = simpleDateFormat.parse(split[1]); |
| | | Integer blueScore = saveData.getBlueScore(); |
| | | Integer redScore = saveData.getRedScore(); |
| | | List<WorldCupPaymentParticipant> list1 = worldCupPaymentParticipantService.list(new LambdaQueryWrapper<WorldCupPaymentParticipant>().in(WorldCupPaymentParticipant::getId, list)); |
| | | String code = UUIDUtil.getTimeStr() + UUIDUtil.getNumberRandom(3); |
| | | ArrayList<WorldCupCompetitor> worldCupCompetitors = new ArrayList<>(red.length + blue.length); |
| | | for (String s : blue) { |
| | | WorldCupPaymentParticipant worldCupPaymentParticipant = list1.stream().filter(e -> e.getId().equals(s)).findFirst().orElse(null); |
| | | if(worldCupPaymentParticipant!=null){ |
| | | WorldCupCompetitor worldCupCompetitor =new WorldCupCompetitor(); |
| | | worldCupCompetitor.setCode(code); |
| | | worldCupCompetitor.setWorldCupId(saveData.getId().intValue()); |
| | | worldCupCompetitor.setParticipantType(worldCupPaymentParticipant.getParticipantType()); |
| | | worldCupCompetitor.setAppUserId(worldCupPaymentParticipant.getAppUserId()); |
| | | worldCupCompetitor.setParticipantId(worldCupPaymentParticipant.getParticipantId()); |
| | | worldCupCompetitor.setParticipant(1); |
| | | worldCupCompetitor.setStartTime(startTime); |
| | | worldCupCompetitor.setEndTime(endTime); |
| | | if(blueScore>redScore){ |
| | | worldCupCompetitor.setMatchResult(1); |
| | | worldCupCompetitor.setWinIntegral(worldCup.getWinIntegral()); |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(worldCupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getWinIntegral()); |
| | | vo.setType(7); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | } |
| | | if(blueScore.equals(redScore)){ |
| | | worldCupCompetitor.setMatchResult(0); |
| | | worldCupCompetitor.setDrawIntegral(worldCup.getDrawIntegral()); |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(worldCupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getDrawIntegral()); |
| | | vo.setType(9); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | } |
| | | if(blueScore<redScore){ |
| | | worldCupCompetitor.setMatchResult(-1); |
| | | worldCupCompetitor.setLoseIntegral(worldCup.getLoseIntegral()); |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(worldCupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getLoseIntegral()); |
| | | vo.setType(10); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | } |
| | | worldCupCompetitor.setOpponentScore(redScore); |
| | | worldCupCompetitor.setParticipationIntegral(worldCup.getParticipationIntegral()); |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(worldCupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getParticipationIntegral()); |
| | | vo.setType(6); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | |
| | | worldCupCompetitorService.save(worldCupCompetitor); |
| | | worldCupCompetitors.add(worldCupCompetitor); |
| | | } |
| | | } |
| | | |
| | | for (String s : red) { |
| | | WorldCupPaymentParticipant worldCupPaymentParticipant = list1.stream().filter(e -> e.getId().equals(s)).findFirst().orElse(null); |
| | | if(worldCupPaymentParticipant!=null){ |
| | | WorldCupCompetitor worldCupCompetitor =new WorldCupCompetitor(); |
| | | worldCupCompetitor.setCode(code); |
| | | worldCupCompetitor.setWorldCupId(saveData.getId().intValue()); |
| | | worldCupCompetitor.setParticipantType(worldCupPaymentParticipant.getParticipantType()); |
| | | worldCupCompetitor.setAppUserId(worldCupPaymentParticipant.getAppUserId()); |
| | | worldCupCompetitor.setParticipantId(worldCupPaymentParticipant.getParticipantId()); |
| | | worldCupCompetitor.setParticipant(1); |
| | | worldCupCompetitor.setStartTime(startTime); |
| | | worldCupCompetitor.setEndTime(endTime); |
| | | if(redScore>blueScore){ |
| | | worldCupCompetitor.setMatchResult(1); |
| | | worldCupCompetitor.setWinIntegral(worldCup.getWinIntegral()); |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(worldCupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getWinIntegral()); |
| | | vo.setType(7); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | } |
| | | if(blueScore.equals(redScore)){ |
| | | worldCupCompetitor.setMatchResult(0); |
| | | worldCupCompetitor.setDrawIntegral(worldCup.getDrawIntegral()); |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(worldCupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getDrawIntegral()); |
| | | vo.setType(9); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | } |
| | | if(redScore<blueScore){ |
| | | worldCupCompetitor.setMatchResult(-1); |
| | | worldCupCompetitor.setLoseIntegral(worldCup.getLoseIntegral()); |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(worldCupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getLoseIntegral()); |
| | | vo.setType(10); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | } |
| | | worldCupCompetitor.setOpponentScore(redScore); |
| | | worldCupCompetitor.setParticipationIntegral(worldCup.getParticipationIntegral()); |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(worldCupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getParticipationIntegral()); |
| | | vo.setType(6); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | |
| | | worldCupCompetitorService.save(worldCupCompetitor); |
| | | worldCupCompetitors.add(worldCupCompetitor); |
| | | } |
| | | } |
| | | |
| | | //添加勋章 |
| | | for (WorldCupCompetitor worldCupCompetitor : worldCupCompetitors) { |
| | | Integer appUserId = worldCupCompetitor.getAppUserId(); |
| | | //常胜将军 |
| | | if(1 == worldCupCompetitor.getMatchResult()){ |
| | | int count = worldCupCompetitorService.count(new QueryWrapper<WorldCupCompetitor>().eq("appUserId", appUserId).eq("matchResult", 1)); |
| | | StudentHonor studentHonor = new StudentHonor(); |
| | | studentHonor.setAppUserId(appUserId); |
| | | studentHonor.setHonorType(5); |
| | | studentHonor.setNumber(count); |
| | | studentHonorClient.saveStudentHonor(studentHonor); |
| | | } |
| | | //越战越勇 |
| | | int count = worldCupCompetitorService.count(new QueryWrapper<WorldCupCompetitor>().eq("appUserId", appUserId)); |
| | | StudentHonor studentHonor = new StudentHonor(); |
| | | studentHonor.setAppUserId(appUserId); |
| | | studentHonor.setHonorType(6); |
| | | studentHonor.setNumber(count); |
| | | studentHonorClient.saveStudentHonor(studentHonor); |
| | | } |
| | | |
| | | } |
| | | } |
| | |
| | | */ |
| | | @TableField("winIntegral") |
| | | private Integer winIntegral; |
| | | |
| | | /** |
| | | * 类型(1=智慧赛事,2=非智慧赛事) |
| | | */ |
| | | @TableField("type") |
| | | private Integer type; |
| | | |
| | | /** |
| | | * 平场获得积分 |
| | | */ |
| | | @TableField("drawIntegral") |
| | | private Integer drawIntegral; |
| | | |
| | | /** |
| | | * 失败获得积分 |
| | | */ |
| | | @TableField("loseIntegral") |
| | | private Integer loseIntegral; |
| | | /** |
| | | * 省 |
| | | */ |
| | |
| | | @TableField("content") |
| | | private String content; |
| | | /** |
| | | * 参赛协议 |
| | | */ |
| | | @TableField("contentOne") |
| | | private String contentOne; |
| | | /** |
| | | * 比赛状态(1=未开始,2=已开始,3=已结束,4=已取消) |
| | | */ |
| | | @TableField("status") |
| | |
| | | @TableField("winIntegral") |
| | | private Integer winIntegral; |
| | | /** |
| | | * 平场奖励 |
| | | */ |
| | | @TableField("drawIntegral") |
| | | private Integer drawIntegral; |
| | | /** |
| | | * 败场奖励 |
| | | */ |
| | | @TableField("loseIntegral") |
| | | private Integer loseIntegral; |
| | | /** |
| | | * 比赛开始时间 |
| | | */ |
| | | @TableField("startTime") |
| | |
| | | |
| | | import com.dsh.communityWorldCup.feignclient.account.model.AppUser; |
| | | import com.dsh.communityWorldCup.feignclient.account.model.AppUserIdsByCityName; |
| | | import com.dsh.communityWorldCup.model.UserDetailsOfSearch; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | |
| | |
| | | @PostMapping("/appUser/getAppUserIdsByCityName") |
| | | List<Integer> getAppUserIdsByCityName(AppUserIdsByCityName appUserIdsByCityName); |
| | | |
| | | |
| | | @PostMapping("/appUser/queryAppUserByIds") |
| | | List<AppUser> queryAppUserByIds(UserDetailsOfSearch search); |
| | | } |
| | |
| | | */ |
| | | private Integer appUserId; |
| | | /** |
| | | * 积分类型(1=赠送积分,2=兑换商品,3=完成课后练习,4=观看教学视频,5=参与世界杯,6=世界杯获胜) |
| | | * 积分类型(1=赠送积分,2=兑换商品,3=完成课后练习,4=观看教学视频,6=参与世界杯,7=世界杯获胜 8该份 9平场世界杯 10败场世界杯) |
| | | */ |
| | | private Integer type; |
| | | /** |
| | |
| | | * @param worldCupRank |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> getWorldCupRank(@Param("item") WorldCupRank worldCupRank, @Param("appUserIds") List<Integer> appUserIds); |
| | | List<Map<String, Object>> getWorldCupRank(@Param("item") WorldCupRank worldCupRank, @Param("appUserIds") List<Integer> appUserIds, @Param("sTime") String sTime, @Param("eTime") String eTime); |
| | | |
| | | |
| | | List<Map<String, Object>> getWorldCupRank1(@Param("item") WorldCupRank worldCupRank, @Param("appUserIds") List<Integer> appUserIds); |
| | | List<Map<String, Object>> getWorldCupRank1(@Param("item") WorldCupRank worldCupRank, @Param("appUserIds") List<Integer> appUserIds, @Param("sTime") String sTime, @Param("eTime") String eTime); |
| | | |
| | | |
| | | /** |
| | |
| | | * @param worldCupRecords |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> worldCupRecordsList(@Param("item") WorldCupRecords worldCupRecords, @Param("appUserIds") List<Integer> appUserIds); |
| | | List<Map<String, Object>> worldCupRecordsList(@Param("item") WorldCupRecords worldCupRecords, @Param("appUserIds") List<Integer> appUserIds, @Param("sTime") String sTime, @Param("eTime") String eTime); |
| | | |
| | | /** |
| | | * 获取比赛排行榜列表数据 |
| | | * @param worldCupRecords |
| | | * @return |
| | | */ |
| | | List<Map<String, Object>> worldCupRecordsList1(@Param("item") WorldCupRecords worldCupRecords, @Param("appUserIds") List<Integer> appUserIds); |
| | | List<Map<String, Object>> worldCupRecordsList1(@Param("item") WorldCupRecords worldCupRecords, @Param("appUserIds") List<Integer> appUserIds, @Param("sTime") String sTime, @Param("eTime") String eTime); |
| | | |
| | | |
| | | int worldCupRecordsListCount(@Param("appUserIds") List<Integer> appUserIds); |
| | |
| | | * @return |
| | | */ |
| | | int getMatchTime(@Param("worldCupId") Integer worldCupId); |
| | | |
| | | List<WorldCupListVo> getWorldCupListFromRank(@Param("item")MyWorldCupList myWorldCupList); |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/19 15:24 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class EndWorldCup { |
| | | @ApiModelProperty(value = "世界杯id", required = true, dataType = "int") |
| | | private Integer worldCupId; |
| | | |
| | | @ApiModelProperty(value = "结果", required = true, dataType = "String") |
| | | private String result; |
| | | |
| | | } |
| | |
| | | private Integer opponentScore; |
| | | @ApiModelProperty("比赛时间") |
| | | private String startTime; |
| | | @ApiModelProperty("比赛结果(1=胜,-1=负)") |
| | | @ApiModelProperty("比赛结果(1=胜,0平 -1=负)") |
| | | private Integer matchResult; |
| | | @ApiModelProperty("获得积分") |
| | | private Integer award; |
| | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/28 16:25 |
| | |
| | | @ApiModelProperty(value = "状态(1=未开始,2=进行中)") |
| | | private Integer state; |
| | | private Integer appUserId; |
| | | |
| | | private String name; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/3/6 20:00 |
| | | */ |
| | | @Data |
| | | public class SaveData { |
| | | /** |
| | | * 参赛数据id |
| | | */ |
| | | private Long id; |
| | | /** |
| | | * 蓝方得分 |
| | | */ |
| | | private String blueStr; |
| | | /** |
| | | * 红方得分 |
| | | */ |
| | | private String redStr; |
| | | |
| | | private String time; |
| | | |
| | | private Integer blueScore; |
| | | |
| | | private Integer redScore; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class UserDetailsOfSearch { |
| | | |
| | | private Integer id; |
| | | |
| | | private String name; |
| | | |
| | | private String phone; |
| | | |
| | | private String idCard; |
| | | |
| | | private List<Integer> useIds; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class UserVo { |
| | | private String userName; |
| | | |
| | | private String avatar; |
| | | |
| | | private Integer age=0; |
| | | } |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import com.alipay.api.domain.UserDetail; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/2/19 16:45 |
| | | */ |
| | | @Data |
| | | @ApiModel |
| | | public class WorldCupCodeListVo { |
| | | @ApiModelProperty("世界杯id") |
| | | private Integer worldCupId; |
| | | @ApiModelProperty("世界杯名称") |
| | | private String name; |
| | | @ApiModelProperty("编号") |
| | | private String code; |
| | | @ApiModelProperty("开始时间") |
| | | private Date startTime; |
| | | |
| | | @ApiModelProperty("自定义信息 结束接口需要") |
| | | private List<Long> customs; |
| | | |
| | | |
| | | @ApiModelProperty("红队") |
| | | private List<UserVo> red; |
| | | |
| | | @ApiModelProperty("蓝队") |
| | | private List<UserVo> blue; |
| | | } |
| | |
| | | private String intro; |
| | | @ApiModelProperty("富文本") |
| | | private String content; |
| | | @ApiModelProperty("参赛协议") |
| | | private String contentOne; |
| | | @ApiModelProperty("1or null智慧赛事 2非智慧赛事") |
| | | private Integer type; |
| | | @ApiModelProperty("门店信息") |
| | | private List<Map<String, Object>> storeInfos; |
| | | } |
| | |
| | | */ |
| | | private Integer status; |
| | | /** |
| | | * 1=智慧赛事,2= 非智慧赛事, |
| | | */ |
| | | private Integer type; |
| | | /** |
| | | * 页码 |
| | | */ |
| | | private Integer offset; |
| | |
| | | private String lon; |
| | | private String lat; |
| | | private Double distance; |
| | | @ApiModelProperty("1智慧赛事 2非智慧赛事") |
| | | private Integer type; |
| | | private Integer nowNum=0; |
| | | } |
| | |
| | | private Integer radius; |
| | | @ApiModelProperty(value = "排序,1=场次,2=胜率", required = true, dataType = "int") |
| | | private Integer sort; |
| | | |
| | | @ApiModelProperty("赛事id") |
| | | private Integer worldCupId; |
| | | |
| | | @ApiModelProperty("季度时间2020-01-01 - 2022-03-31") |
| | | private String time; |
| | | |
| | | private Integer appUserId; |
| | | } |
| | |
| | | private Integer totalSession; |
| | | @ApiModelProperty("胜率") |
| | | private Double winRate; |
| | | @ApiModelProperty("积分") |
| | | private Integer integral; |
| | | @ApiModelProperty("是否是自己(0=否,1=是)") |
| | | private Integer oneself; |
| | | } |
| | |
| | | * 市名称 |
| | | */ |
| | | private String city; |
| | | |
| | | /** |
| | | * 时间 |
| | | */ |
| | | private String time; |
| | | /** |
| | | * 页码 |
| | | */ |
New file |
| | |
| | | package com.dsh.communityWorldCup.model; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class WorldCupUserListVo { |
| | | @ApiModelProperty("报名id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("姓名") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("性别") |
| | | private String sex; |
| | | |
| | | @ApiModelProperty("年龄") |
| | | private int age=0; |
| | | |
| | | @ApiModelProperty("身份证号") |
| | | private String idCard; |
| | | |
| | | @ApiModelProperty("手机号") |
| | | private String phone; |
| | | |
| | | |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | int getMatchTime(Integer worldCupId); |
| | | |
| | | |
| | | List<WorldCupListVo> getWorldCupListFromRank(MyWorldCupList myWorldCupList); |
| | | |
| | | List<WorldCupCodeListVo> getWorldCupCodeListId(Integer worldCupId); |
| | | |
| | | |
| | | } |
| | |
| | | * @param worldCup |
| | | */ |
| | | void updateWorldCupAll(WorldCup worldCup); |
| | | |
| | | ResultUtil endWorldCup(String custom, Integer redScore, Integer blueScore); |
| | | |
| | | |
| | | } |
| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.communityWorldCup.entity.WorldCup; |
| | |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | |
| | | AppUser appUser = appUserClient.getAppUser(worldCupRank.getAppUserId()); |
| | | appUserIds = appUserClient.getAppUserIds(appUser.getCityCode()); |
| | | } |
| | | String sTime = null; |
| | | String eTime = null; |
| | | if(ToolUtil.isNotEmpty(worldCupRank.getTime())){ |
| | | sTime = worldCupRank.getTime().split(" - ")[0] + " 00:00:00"; |
| | | eTime = worldCupRank.getTime().split(" - ")[1] + " 23:59:59"; |
| | | } |
| | | |
| | | //总场次 |
| | | List<Map<String, Object>> lists = this.baseMapper.getWorldCupRank(worldCupRank, appUserIds); |
| | | List<Map<String, Object>> lists = this.baseMapper.getWorldCupRank(worldCupRank, appUserIds, sTime, eTime); |
| | | |
| | | //未负的数据 |
| | | List<Map<String, Object>> lists1 = this.baseMapper.getWorldCupRank1(worldCupRank, appUserIds); |
| | | List<Map<String, Object>> lists1 = this.baseMapper.getWorldCupRank1(worldCupRank, appUserIds, sTime, eTime); |
| | | |
| | | List<Map<String, Object>> mapList = new ArrayList<>(); |
| | | for (int i = 0; i < lists.size(); i++) { |
| | | Map<String, Object> map = lists.get(i); |
| | |
| | | Long participantId = Long.valueOf(map.get("participantId").toString()); |
| | | Integer appUserId = Integer.valueOf(map.get("appUserId").toString()); |
| | | Integer num = Integer.valueOf(null == map.get("num") ? "0" : map.get("num").toString()); |
| | | Integer winIntegral = Integer.valueOf(null == map.get("winIntegral") ? "0" : map.get("winIntegral").toString()); |
| | | Integer drawIntegral = Integer.valueOf(null == map.get("drawIntegral") ? "0" : map.get("drawIntegral").toString()); |
| | | Integer loseIntegral = Integer.valueOf(null == map.get("loseIntegral") ? "0" : map.get("loseIntegral").toString()); |
| | | //学员 |
| | | if(participantType == 1){ |
| | | TStudent tStudent = studentClient.queryById(participantId.intValue()); |
| | |
| | | } |
| | | } |
| | | map.put("totalSession", num); |
| | | map.put("totalIntegral", winIntegral+drawIntegral+loseIntegral); |
| | | map.put("winRate", "0"); |
| | | for (Map<String, Object> objectMap : lists1) { |
| | | Integer participantType1 = Integer.valueOf(objectMap.get("participantType").toString()); |
| | |
| | | } |
| | | mapList.add(map); |
| | | } |
| | | if(worldCupRank.getSort() == 1){ |
| | | mapList.sort(new Comparator<Map<String, Object>>() { |
| | | @Override |
| | | public int compare(Map<String, Object> o1, Map<String, Object> o2) { |
| | | return Double.valueOf(o1.get("totalSession").toString()).compareTo(Double.valueOf(o2.get("totalSession").toString())) * -1; |
| | | } |
| | | }); |
| | | } |
| | | if(worldCupRank.getSort() == 2){ |
| | | mapList.sort(new Comparator<Map<String, Object>>() { |
| | | @Override |
| | | public int compare(Map<String, Object> o1, Map<String, Object> o2) { |
| | | return Double.valueOf(o1.get("winRate").toString()).compareTo(Double.valueOf(o2.get("winRate").toString())) * -1; |
| | | } |
| | | }); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | // if(worldCupRank.getSort() == 1){ |
| | | // mapList.sort(new Comparator<Map<String, Object>>() { |
| | | // @Override |
| | | // public int compare(Map<String, Object> o1, Map<String, Object> o2) { |
| | | // return Double.valueOf(o1.get("totalSession").toString()).compareTo(Double.valueOf(o2.get("totalSession").toString())) * -1; |
| | | // } |
| | | // }); |
| | | // } |
| | | // if(worldCupRank.getSort() == 2){ |
| | | // mapList.sort(new Comparator<Map<String, Object>>() { |
| | | // @Override |
| | | // public int compare(Map<String, Object> o1, Map<String, Object> o2) { |
| | | // return Double.valueOf(o1.get("winRate").toString()).compareTo(Double.valueOf(o2.get("winRate").toString())) * -1; |
| | | // } |
| | | // }); |
| | | // } |
| | | |
| | | |
| | | List<WorldCupRankVo> list = new ArrayList<>(); |
| | | for (int i = 0; i < mapList.size(); i++) { |
| | | Map<String, Object> map = mapList.get(i); |
| | |
| | | Long participantId = Long.valueOf(map.get("participantId").toString()); |
| | | Integer appUserId = Integer.valueOf(map.get("appUserId").toString()); |
| | | Integer totalSession = Integer.valueOf(map.get("totalSession").toString()); |
| | | Integer totalIntegral = Integer.valueOf(map.get("totalIntegral").toString()); |
| | | Double winRate = Double.valueOf(map.get("winRate").toString()); |
| | | //自己排名在20内的标识 |
| | | boolean b = false; |
| | | if(i <= 19){ |
| | | WorldCupRankVo worldCupRankVo = new WorldCupRankVo(); |
| | | worldCupRankVo.setRank(i + 1); |
| | | worldCupRankVo.setIntegral(totalIntegral); |
| | | worldCupRankVo.setTotalSession(totalSession); |
| | | worldCupRankVo.setWinRate(winRate); |
| | | //学员 |
| | |
| | | } |
| | | } |
| | | } |
| | | // 排序 |
| | | list= list.stream().sorted(Comparator.comparing(WorldCupRankVo::getIntegral).reversed().thenComparing(WorldCupRankVo::getTotalSession).reversed().thenComparing(WorldCupRankVo::getWinRate).reversed()).collect(Collectors.toList()); |
| | | return list; |
| | | } |
| | | |
| | |
| | | worldCupCompetitor.setOpponentScore(red_score); |
| | | worldCupCompetitor.setEndTime(new Date()); |
| | | worldCupCompetitor.setWinIntegral(0); |
| | | if(null != worldCup.getWinIntegral() && 0 < worldCup.getWinIntegral() && blue_score.compareTo(red_score) >= 0){ |
| | | worldCupCompetitor.setDrawIntegral(0); |
| | | worldCupCompetitor.setLoseIntegral(0); |
| | | if(null != worldCup.getWinIntegral() && 0 < worldCup.getWinIntegral() && blue_score.compareTo(red_score) > 0){ |
| | | worldCupCompetitor.setWinIntegral(worldCup.getWinIntegral()); |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(worldCupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getWinIntegral()); |
| | | vo.setType(7); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | }else if(null != worldCup.getDrawIntegral() && 0 < worldCup.getDrawIntegral() && blue_score.compareTo(red_score) == 0){ |
| | | worldCupCompetitor.setDrawIntegral(worldCup.getDrawIntegral()); |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(worldCupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getDrawIntegral()); |
| | | vo.setType(9); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | }else if(null != worldCup.getLoseIntegral() && 0 < worldCup.getLoseIntegral() && blue_score.compareTo(red_score) < 0){ |
| | | worldCupCompetitor.setDrawIntegral(worldCup.getLoseIntegral()); |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(worldCupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getLoseIntegral()); |
| | | vo.setType(10); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | } |
| | | } |
| | |
| | | worldCupCompetitor.setOpponentScore(blue_score); |
| | | worldCupCompetitor.setEndTime(new Date()); |
| | | worldCupCompetitor.setWinIntegral(0); |
| | | if(null != worldCup.getWinIntegral() && 0 < worldCup.getWinIntegral() && red_score.compareTo(blue_score) >= 0){ |
| | | worldCupCompetitor.setDrawIntegral(0); |
| | | worldCupCompetitor.setLoseIntegral(0); |
| | | if(null != worldCup.getWinIntegral() && 0 < worldCup.getWinIntegral() && red_score.compareTo(blue_score) > 0){ |
| | | worldCupCompetitor.setWinIntegral(worldCup.getWinIntegral()); |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(worldCupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getWinIntegral()); |
| | | vo.setType(7); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | }else if(null != worldCup.getDrawIntegral() && 0 < worldCup.getDrawIntegral() && blue_score.compareTo(red_score) == 0){ |
| | | worldCupCompetitor.setDrawIntegral(worldCup.getDrawIntegral()); |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(worldCupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getDrawIntegral()); |
| | | vo.setType(9); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | }else if(null != worldCup.getLoseIntegral() && 0 < worldCup.getLoseIntegral() && blue_score.compareTo(red_score) < 0){ |
| | | worldCupCompetitor.setDrawIntegral(worldCup.getLoseIntegral()); |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(worldCupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getLoseIntegral()); |
| | | vo.setType(10); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | } |
| | | } |
| | |
| | | appUserIdsByCityName.setProvince(worldCupRecords.getProvince()); |
| | | appUserIdsByCityName.setCity(worldCupRecords.getCity()); |
| | | List<Integer> appUserIds = appUserClient.getAppUserIdsByCityName(appUserIdsByCityName); |
| | | List<Map<String, Object>> mapList = this.baseMapper.worldCupRecordsList(worldCupRecords, appUserIds); |
| | | List<Map<String, Object>> mapList1 = this.baseMapper.worldCupRecordsList1(worldCupRecords, appUserIds); |
| | | String time = worldCupRecords.getTime(); |
| | | String sTime = null; |
| | | String eTime = null; |
| | | if(ToolUtil.isNotEmpty(time)){ |
| | | sTime = time.split(" - ")[0] + " 00:00:00"; |
| | | eTime = time.split(" - ")[1] + " 23:59:59"; |
| | | } |
| | | List<Map<String, Object>> mapList = this.baseMapper.worldCupRecordsList(worldCupRecords, appUserIds,sTime,eTime); |
| | | List<Map<String, Object>> mapList1 = this.baseMapper.worldCupRecordsList1(worldCupRecords, appUserIds,sTime,eTime); |
| | | List<Map<String, Object>> list = new ArrayList<>(); |
| | | int row_num = 0; |
| | | for (int i = 0; i < mapList.size(); i++) { |
| | |
| | | .eq("participant", 1).eq("worldCupId", worldCupCompetitor.getWorldCupId())); |
| | | WorldCup worldCup = worldCupService.getById(blueList.get(0).getWorldCupId()); |
| | | for (WorldCupCompetitor cupCompetitor : blueList) { |
| | | //如果之前输了,现在赢/平了,需要增加积分 |
| | | if(cupCompetitor.getMatchResult() == -1 && (blue.compareTo(red) > 0 || blue.compareTo(red) == 0)){ |
| | | //如果之前输了,现在赢了,需要增加积分 |
| | | if(cupCompetitor.getMatchResult() == -1 && (blue.compareTo(red) > 0 )){ |
| | | //先扣除 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(cupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getLoseIntegral() * -1); |
| | | vo.setType(8); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo1 = new SaveUserIntegralChangesVo(); |
| | | vo1.setAppUserId(cupCompetitor.getAppUserId()); |
| | | vo1.setIntegral(worldCup.getWinIntegral()); |
| | | vo1.setType(7); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo1); |
| | | |
| | | cupCompetitor.setMatchResult(1); |
| | | cupCompetitor.setWinIntegral(worldCup.getWinIntegral()); |
| | | cupCompetitor.setLoseIntegral(0); |
| | | } |
| | | // 输 -> 平 |
| | | if(cupCompetitor.getMatchResult() == -1 && (blue.compareTo(red) == 0 )){ |
| | | //先扣除 |
| | | SaveUserIntegralChangesVo vo1 = new SaveUserIntegralChangesVo(); |
| | | vo1.setAppUserId(cupCompetitor.getAppUserId()); |
| | | vo1.setIntegral(worldCup.getLoseIntegral() * -1); |
| | | vo1.setType(8); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo1); |
| | | |
| | | |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(cupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getDrawIntegral()); |
| | | vo.setType(7); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | |
| | | cupCompetitor.setMatchResult(0); |
| | | cupCompetitor.setDrawIntegral(worldCup.getDrawIntegral()); |
| | | cupCompetitor.setLoseIntegral(0); |
| | | } |
| | | //如果之前赢了,现在输了,需要扣减积分 |
| | | if(cupCompetitor.getMatchResult() == 1 && blue.compareTo(red) < 0){ |
| | | //先扣除 |
| | | SaveUserIntegralChangesVo vo1 = new SaveUserIntegralChangesVo(); |
| | | vo1.setAppUserId(cupCompetitor.getAppUserId()); |
| | | vo1.setIntegral(worldCup.getWinIntegral() * -1); |
| | | vo1.setType(8); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo1); |
| | | |
| | | |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(cupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getLoseIntegral()); |
| | | vo.setType(7); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | |
| | | cupCompetitor.setMatchResult(-1); |
| | | cupCompetitor.setWinIntegral(0); |
| | | cupCompetitor.setLoseIntegral(worldCup.getLoseIntegral()); |
| | | } |
| | | //如果之前赢了,现在平了,需要扣减积分 |
| | | if(cupCompetitor.getMatchResult() == 1 && blue.compareTo(red) == 0){ |
| | | //先扣除 |
| | | SaveUserIntegralChangesVo vo1 = new SaveUserIntegralChangesVo(); |
| | | vo1.setAppUserId(cupCompetitor.getAppUserId()); |
| | | vo1.setIntegral(worldCup.getWinIntegral() * -1); |
| | | vo1.setType(8); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo1); |
| | | |
| | | |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(cupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getDrawIntegral()); |
| | | vo.setType(7); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | |
| | | cupCompetitor.setMatchResult(0); |
| | | cupCompetitor.setWinIntegral(0); |
| | | cupCompetitor.setDrawIntegral(worldCup.getDrawIntegral()); |
| | | } |
| | | //如果之前平了,现在输了,需要扣减积分 |
| | | if(cupCompetitor.getMatchResult() == 0 && blue.compareTo(red) < 0){ |
| | | //先扣除 |
| | | SaveUserIntegralChangesVo vo1 = new SaveUserIntegralChangesVo(); |
| | | vo1.setAppUserId(cupCompetitor.getAppUserId()); |
| | | vo1.setIntegral(worldCup.getDrawIntegral() * -1); |
| | | vo1.setType(8); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo1); |
| | | |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(cupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getLoseIntegral()); |
| | | vo.setType(7); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | |
| | | cupCompetitor.setMatchResult(-1); |
| | | cupCompetitor.setDrawIntegral(0); |
| | | cupCompetitor.setLoseIntegral(worldCup.getLoseIntegral()); |
| | | } |
| | | //如果之前平了,现在赢了,需要扣减积分 |
| | | if(cupCompetitor.getMatchResult() == 0 && blue>red){ |
| | | //先扣除 |
| | | SaveUserIntegralChangesVo vo1 = new SaveUserIntegralChangesVo(); |
| | | vo1.setAppUserId(cupCompetitor.getAppUserId()); |
| | | vo1.setIntegral(worldCup.getDrawIntegral() * -1); |
| | | vo1.setType(8); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo1); |
| | | |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(cupCompetitor.getAppUserId()); |
| | |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | |
| | | cupCompetitor.setMatchResult(1); |
| | | cupCompetitor.setDrawIntegral(0); |
| | | cupCompetitor.setWinIntegral(worldCup.getWinIntegral()); |
| | | } |
| | | //如果之前赢了,现在输了,需要扣减积分 |
| | | if(cupCompetitor.getMatchResult() == 1 && blue.compareTo(red) < 0){ |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(cupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getWinIntegral() * -1); |
| | | vo.setType(8); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | |
| | | cupCompetitor.setMatchResult(-1); |
| | | cupCompetitor.setWinIntegral(0); |
| | | } |
| | | //如果之前平了,现在输了,需要扣减积分 |
| | | if(cupCompetitor.getMatchResult() == 0 && blue.compareTo(red) < 0){ |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(cupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getWinIntegral() * -1); |
| | | vo.setType(8); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | |
| | | cupCompetitor.setMatchResult(-1); |
| | | cupCompetitor.setWinIntegral(0); |
| | | } |
| | | cupCompetitor.setOurScore(blue); |
| | | cupCompetitor.setOpponentScore(red); |
| | |
| | | List<WorldCupCompetitor> redList = this.list(new QueryWrapper<WorldCupCompetitor>().eq("code", worldCupCompetitor.getCode()) |
| | | .eq("participant", 2).eq("worldCupId", worldCupCompetitor.getWorldCupId())); |
| | | for (WorldCupCompetitor cupCompetitor : redList) { |
| | | //如果之前输了,现在赢/平了,需要增加积分 |
| | | if(cupCompetitor.getMatchResult() == -1 && (red.compareTo(blue) > 0 || red.compareTo(blue) == 0)){ |
| | | //如果之前输了,现在赢/了,需要增加积分 |
| | | if(cupCompetitor.getMatchResult() == -1 && (red.compareTo(blue) > 0)){ |
| | | //先扣除 |
| | | SaveUserIntegralChangesVo vo1 = new SaveUserIntegralChangesVo(); |
| | | vo1.setAppUserId(cupCompetitor.getAppUserId()); |
| | | vo1.setIntegral(worldCup.getLoseIntegral() * -1); |
| | | vo1.setType(8); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo1); |
| | | |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(cupCompetitor.getAppUserId()); |
| | |
| | | |
| | | cupCompetitor.setMatchResult(1); |
| | | cupCompetitor.setWinIntegral(worldCup.getWinIntegral()); |
| | | cupCompetitor.setLoseIntegral(0); |
| | | } |
| | | //如果之前输了,现在平了,需要增加积分 |
| | | if(cupCompetitor.getMatchResult() == -1 && ( red.compareTo(blue) == 0)){ |
| | | //先扣除 |
| | | SaveUserIntegralChangesVo vo1 = new SaveUserIntegralChangesVo(); |
| | | vo1.setAppUserId(cupCompetitor.getAppUserId()); |
| | | vo1.setIntegral(worldCup.getLoseIntegral() * -1); |
| | | vo1.setType(8); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo1); |
| | | |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(cupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getDrawIntegral()); |
| | | vo.setType(7); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | |
| | | cupCompetitor.setMatchResult(0); |
| | | cupCompetitor.setDrawIntegral(worldCup.getDrawIntegral()); |
| | | cupCompetitor.setLoseIntegral(0); |
| | | } |
| | | //如果之前赢了,现在输了,需要扣减积分 |
| | | if(cupCompetitor.getMatchResult() == 1 && red.compareTo(blue) < 0){ |
| | | |
| | | //先扣除 |
| | | SaveUserIntegralChangesVo vo1 = new SaveUserIntegralChangesVo(); |
| | | vo1.setAppUserId(cupCompetitor.getAppUserId()); |
| | | vo1.setIntegral(worldCup.getWinIntegral() * -1); |
| | | vo1.setType(8); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo1); |
| | | |
| | | |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(cupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getWinIntegral() * -1); |
| | | vo.setType(8); |
| | | vo.setIntegral(worldCup.getLoseIntegral() ); |
| | | vo.setType(7); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | |
| | | cupCompetitor.setMatchResult(-1); |
| | | cupCompetitor.setWinIntegral(0); |
| | | cupCompetitor.setLoseIntegral(worldCup.getLoseIntegral()); |
| | | } |
| | | //如果之前赢了,现在平了,需要扣减积分 |
| | | if(cupCompetitor.getMatchResult() == 1 && red.compareTo(blue) ==0){ |
| | | |
| | | //先扣除 |
| | | SaveUserIntegralChangesVo vo1 = new SaveUserIntegralChangesVo(); |
| | | vo1.setAppUserId(cupCompetitor.getAppUserId()); |
| | | vo1.setIntegral(worldCup.getWinIntegral() * -1); |
| | | vo1.setType(8); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo1); |
| | | |
| | | |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(cupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getDrawIntegral() ); |
| | | vo.setType(7); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | |
| | | cupCompetitor.setMatchResult(0); |
| | | cupCompetitor.setWinIntegral(0); |
| | | cupCompetitor.setDrawIntegral(worldCup.getDrawIntegral()); |
| | | } |
| | | //如果之前平了,现在输了,需要扣减积分 |
| | | if(cupCompetitor.getMatchResult() == 0 && red.compareTo(blue) < 0){ |
| | | //先扣除 |
| | | SaveUserIntegralChangesVo vo1 = new SaveUserIntegralChangesVo(); |
| | | vo1.setAppUserId(cupCompetitor.getAppUserId()); |
| | | vo1.setIntegral(worldCup.getDrawIntegral() * -1); |
| | | vo1.setType(8); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo1); |
| | | |
| | | |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(cupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getWinIntegral() * -1); |
| | | vo.setType(8); |
| | | vo.setIntegral(worldCup.getLoseIntegral()); |
| | | vo.setType(7); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | |
| | | cupCompetitor.setMatchResult(-1); |
| | | cupCompetitor.setWinIntegral(0); |
| | | cupCompetitor.setDrawIntegral(0); |
| | | cupCompetitor.setLoseIntegral(worldCup.getLoseIntegral()); |
| | | } |
| | | //如果之前平了,现在赢了,需要扣减积分 |
| | | if(cupCompetitor.getMatchResult() == 0 && red.compareTo(blue) >0){ |
| | | //先扣除 |
| | | SaveUserIntegralChangesVo vo1 = new SaveUserIntegralChangesVo(); |
| | | vo1.setAppUserId(cupCompetitor.getAppUserId()); |
| | | vo1.setIntegral(worldCup.getDrawIntegral() * -1); |
| | | vo1.setType(8); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo1); |
| | | |
| | | |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(cupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getWinIntegral()); |
| | | vo.setType(7); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | |
| | | cupCompetitor.setMatchResult(1); |
| | | cupCompetitor.setDrawIntegral(0); |
| | | cupCompetitor.setWinIntegral(worldCup.getWinIntegral()); |
| | | } |
| | | cupCompetitor.setOurScore(red); |
| | | cupCompetitor.setOpponentScore(blue); |
| | |
| | | public int getMatchTime(Integer worldCupId) { |
| | | return this.baseMapper.getMatchTime(worldCupId); |
| | | } |
| | | |
| | | @Override |
| | | public List<WorldCupListVo> getWorldCupListFromRank(MyWorldCupList myWorldCupList) { |
| | | |
| | | return this.baseMapper.getWorldCupListFromRank(myWorldCupList); |
| | | } |
| | | |
| | | @Override |
| | | public List<WorldCupCodeListVo> getWorldCupCodeListId(Integer worldCupId) { |
| | | List<WorldCupCompetitor> worldCupCompetitors = this.baseMapper.selectList(new LambdaQueryWrapper<WorldCupCompetitor>().eq(WorldCupCompetitor::getWorldCupId, worldCupId) |
| | | .and(w->w.isNull(WorldCupCompetitor::getEndTime).or(s->s.le(WorldCupCompetitor::getStartTime, new Date()).ge(WorldCupCompetitor::getEndTime, new Date())))) |
| | | ; |
| | | List<WorldCupCodeListVo> worldCupCodeListVos = new ArrayList<>(); |
| | | |
| | | // worldCupCompetitors 通过code分组 |
| | | Map<String, List<WorldCupCompetitor>> map = worldCupCompetitors.stream().collect(Collectors.groupingBy(WorldCupCompetitor::getCode)); |
| | | LocalDate now = LocalDate.now(); |
| | | for (Map.Entry<String, List<WorldCupCompetitor>> entry : map.entrySet()) { |
| | | WorldCupCodeListVo worldCupCodeListVo = new WorldCupCodeListVo(); |
| | | String code = entry.getKey(); |
| | | List<WorldCupCompetitor> value = entry.getValue(); |
| | | // 蓝队 |
| | | List<WorldCupCompetitor> collect1 = value.stream().filter(item -> item.getParticipant() == 1).collect(Collectors.toList()); |
| | | ArrayList<UserVo> objects = new ArrayList<>(); |
| | | for (WorldCupCompetitor competitor : collect1) { |
| | | UserVo userVo = new UserVo(); |
| | | AppUser appUser = appUserClient.getAppUser(competitor.getAppUserId()); |
| | | userVo.setUserName(appUser.getName()); |
| | | userVo.setAvatar(appUser.getHeadImg()); |
| | | // 当前日期和生日计算年龄 |
| | | Date birthday = appUser.getBirthday(); |
| | | |
| | | if(birthday!=null){ |
| | | int age = now.getYear() - birthday.getYear(); |
| | | userVo.setAge(age); |
| | | } |
| | | objects.add(userVo); |
| | | } |
| | | worldCupCodeListVo.setBlue(objects); |
| | | // 红队 |
| | | List<WorldCupCompetitor> collect2 = value.stream().filter(item -> item.getParticipant() == 2).collect(Collectors.toList()); |
| | | ArrayList<UserVo> objects1 = new ArrayList<>(); |
| | | for (WorldCupCompetitor competitor : collect2) { |
| | | UserVo userVo = new UserVo(); |
| | | AppUser appUser = appUserClient.getAppUser(competitor.getAppUserId()); |
| | | userVo.setUserName(appUser.getName()); |
| | | userVo.setAvatar(appUser.getHeadImg()); |
| | | // 当前日期和生日计算年龄 |
| | | Date birthday = appUser.getBirthday(); |
| | | |
| | | if(birthday!=null){ |
| | | int age = now.getYear() - birthday.getYear(); |
| | | userVo.setAge(age); |
| | | } |
| | | objects1.add(userVo); |
| | | } |
| | | worldCupCodeListVo.setRed(objects1); |
| | | |
| | | worldCupCodeListVo.setCode(code); |
| | | worldCupCodeListVo.setStartTime(value.get(0).getStartTime()); |
| | | Integer worldCupId1 = value.get(0).getWorldCupId(); |
| | | WorldCup byId = worldCupService.getById(worldCupId1); |
| | | worldCupCodeListVo.setWorldCupId(worldCupId1); |
| | | if(byId!=null){ |
| | | worldCupCodeListVo.setName(byId.getName()); |
| | | } |
| | | List<Long> collect = value.stream().map(WorldCupCompetitor::getId).collect(Collectors.toList()); |
| | | worldCupCodeListVo.setCustoms(collect); |
| | | worldCupCodeListVos.add(worldCupCodeListVo); |
| | | } |
| | | return worldCupCodeListVos; |
| | | } |
| | | } |
| | |
| | | userGameRecordList.put("participantType", participantType); |
| | | userGameRecordList.put("participantId", participantId); |
| | | AppUser appUser = appUserClient.getAppUser(appUserId); |
| | | if(appUser==null){ |
| | | continue; |
| | | } |
| | | userGameRecordList.put("province", appUser.getProvince() + appUser.getCity()); |
| | | if(1 == participantType){ |
| | | TStudent tStudent = studentClient.queryById(participantId.intValue()); |
| | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alipay.api.AlipayApiException; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.dsh.communityWorldCup.entity.*; |
| | | import com.dsh.communityWorldCup.feignclient.account.AppUserClient; |
| | | import com.dsh.communityWorldCup.feignclient.account.StudentClient; |
| | | import com.dsh.communityWorldCup.feignclient.account.StudentHonorClient; |
| | | import com.dsh.communityWorldCup.feignclient.account.UserIntegralChangesClient; |
| | | import com.dsh.communityWorldCup.feignclient.account.model.AppUser; |
| | | import com.dsh.communityWorldCup.feignclient.account.model.SaveUserIntegralChangesVo; |
| | | import com.dsh.communityWorldCup.feignclient.account.model.StudentHonor; |
| | | import com.dsh.communityWorldCup.feignclient.account.model.TStudent; |
| | | import com.dsh.communityWorldCup.feignclient.competition.ParticipantClient; |
| | | import com.dsh.communityWorldCup.feignclient.competition.model.Participant; |
| | |
| | | private GameClient gameClient; |
| | | |
| | | @Resource |
| | | private StudentHonorClient studentHonorClient; |
| | | |
| | | @Resource |
| | | private UserIntegralChangesClient userIntegralChangesClient; |
| | | |
| | | |
| | | |
| | | |
| | | |
| | |
| | | }else{ |
| | | worldCupListCoachVo.setDistance(0D); |
| | | } |
| | | |
| | | if(worldCupListCoachVo.getType()!=null && worldCupListCoachVo.getType()==2){ |
| | | // 获取正在进行的赛事 |
| | | |
| | | int size = worldCupCompetitorService.list(new LambdaQueryWrapper<WorldCupCompetitor>().eq(WorldCupCompetitor::getWorldCupId, worldCupListCoachVo.getId()) |
| | | .and(w->w.isNull(WorldCupCompetitor::getEndTime).or(s->s.le(WorldCupCompetitor::getStartTime, new Date()).ge(WorldCupCompetitor::getEndTime, new Date()))).groupBy(WorldCupCompetitor::getCode)).size(); |
| | | worldCupListCoachVo.setNowNum(size); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | //对查询结果进行距离排序(直线距离) |
| | | Collections.sort(worldCupListCoach1, new Comparator<WorldCupListCoachVo>() { |
| | | @Override |
| | |
| | | return ResultUtil.error("赛事已取消"); |
| | | } |
| | | //1、通过扫码获取的sutuid查询t_game表中的红蓝方sutuid |
| | | // 智慧需要判断code |
| | | TGame tGame =new TGame(); |
| | | if (worldCup.getType() == null || worldCup.getType() == 1) { |
| | | String code = startWorldCup.getCode(); |
| | | JSONObject object = JSON.parseObject(code); |
| | | String sutu_id = object.getString("sutu_id"); |
| | | TGame tGame = gameClient.getTGameBySutuId(sutu_id); |
| | | tGame = gameClient.getTGameBySutuId(sutu_id); |
| | | if(null == tGame){ |
| | | return ResultUtil.error("无效的游戏二维码"); |
| | | } |
| | | } |
| | | |
| | | String people = startWorldCup.getPeople(); |
| | | JSONArray jsonArray = JSON.parseArray(people); |
| | | if(jsonArray.size() != 6){ |
| | | return ResultUtil.error("参赛人数只能是6人"); |
| | | int red=0; |
| | | int blue=0; |
| | | for (Object o : jsonArray) { |
| | | JSONObject jsonObject = JSONObject.parseObject(o.toString()); |
| | | String type = jsonObject.get("type").toString(); |
| | | if("red".equals( type)){ |
| | | red++; |
| | | } |
| | | if("blue".equals( type)){ |
| | | blue++; |
| | | } |
| | | } |
| | | if(red==0){ |
| | | return ResultUtil.error("红方最少要1人参赛"); |
| | | } |
| | | if(red>5){ |
| | | return ResultUtil.error("红方最多5人参赛"); |
| | | } |
| | | if(blue==0){ |
| | | return ResultUtil.error("蓝方最少要1人参赛"); |
| | | } |
| | | if(blue>5){ |
| | | return ResultUtil.error("蓝方最多5人参赛"); |
| | | } |
| | | String timeStr = UUIDUtil.getTimeStr() + UUIDUtil.getNumberRandom(3); |
| | | List<Long> ids = new ArrayList<>(); |
| | |
| | | worldCup.setMatchNumber(worldCup.getMatchNumber() + 1); |
| | | this.updateById(worldCup); |
| | | |
| | | |
| | | //2、调起开启游戏的接口。 |
| | | |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put("gameType", 1); |
| | | jsonObject.put("ids", ids); |
| | | //2、调起开启游戏的接口。 |
| | | if (worldCup.getType() == null || worldCup.getType() == 1) { |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | map.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); |
| | | map.put("space_id", tGame.getSiteId() + ""); |
| | |
| | | Integer code1 = jsonObject1.getInteger("code"); |
| | | String message = jsonObject1.getString("message"); |
| | | if (200 == code1) { |
| | | return ResultUtil.success(); |
| | | return ResultUtil.success(jsonObject.toJSONString()); |
| | | } else { |
| | | return ResultUtil.error(message); |
| | | } |
| | | }else { |
| | | return ResultUtil.success(jsonObject.toJSONString()); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 报名世界杯 |
| | | * @param paymentWorldCup |
| | |
| | | ,"/base/worldCup/wxPayWorldCupCallback1",worldCupPayment.getAmount().toString()); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | } |
| | |
| | | public void updateWorldCupAll(WorldCup worldCup) { |
| | | this.baseMapper.updateWorldCupAll(worldCup); |
| | | } |
| | | |
| | | @Override |
| | | public ResultUtil endWorldCup(String custom, Integer red_score, Integer blue_score) { |
| | | String[] split = custom.split(","); |
| | | ArrayList<Long> ids = new ArrayList<>(); |
| | | for (String s : split) { |
| | | ids.add(Long.parseLong(s)); |
| | | } |
| | | List<WorldCupCompetitor> worldCupCompetitors = worldCupCompetitorService.listByIds(ids); |
| | | try { |
| | | WorldCupCompetitor worldCupCompetitor1 = worldCupCompetitors.get(0); |
| | | WorldCup worldCup = this.getById(worldCupCompetitor1.getWorldCupId()); |
| | | if(worldCup.getType()==null || worldCup.getType() == 1){ |
| | | return ResultUtil.error("非智慧赛事才可以结束比赛"); |
| | | } |
| | | for (WorldCupCompetitor worldCupCompetitor : worldCupCompetitors) { |
| | | worldCupCompetitor.setWorldCupId(null); |
| | | //蓝方 |
| | | if(worldCupCompetitor.getParticipant() == 1){ |
| | | worldCupCompetitor.setMatchResult(blue_score.compareTo(red_score)); |
| | | worldCupCompetitor.setOurScore(blue_score); |
| | | worldCupCompetitor.setOpponentScore(red_score); |
| | | worldCupCompetitor.setEndTime(new Date()); |
| | | worldCupCompetitor.setWinIntegral(0); |
| | | worldCupCompetitor.setDrawIntegral(0); |
| | | worldCupCompetitor.setLoseIntegral(0); |
| | | if(null != worldCup.getWinIntegral() && 0 < worldCup.getWinIntegral() && blue_score.compareTo(red_score) > 0){ |
| | | worldCupCompetitor.setWinIntegral(worldCup.getWinIntegral()); |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(worldCupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getWinIntegral()); |
| | | vo.setType(7); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | }else if(null != worldCup.getDrawIntegral() && 0 < worldCup.getDrawIntegral() && blue_score.compareTo(red_score) == 0){ |
| | | worldCupCompetitor.setDrawIntegral(worldCup.getDrawIntegral()); |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(worldCupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getDrawIntegral()); |
| | | vo.setType(9); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | }else if(null != worldCup.getLoseIntegral() && 0 < worldCup.getLoseIntegral() && blue_score.compareTo(red_score) < 0){ |
| | | worldCupCompetitor.setDrawIntegral(worldCup.getLoseIntegral()); |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(worldCupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getLoseIntegral()); |
| | | vo.setType(10); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | } |
| | | } |
| | | //红方 |
| | | if(worldCupCompetitor.getParticipant() == 2){ |
| | | worldCupCompetitor.setMatchResult(red_score.compareTo(blue_score)); |
| | | worldCupCompetitor.setOurScore(red_score); |
| | | worldCupCompetitor.setOpponentScore(blue_score); |
| | | worldCupCompetitor.setEndTime(new Date()); |
| | | worldCupCompetitor.setWinIntegral(0); |
| | | worldCupCompetitor.setDrawIntegral(0); |
| | | worldCupCompetitor.setLoseIntegral(0); |
| | | if(null != worldCup.getWinIntegral() && 0 < worldCup.getWinIntegral() && red_score.compareTo(blue_score) > 0){ |
| | | worldCupCompetitor.setWinIntegral(worldCup.getWinIntegral()); |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(worldCupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getWinIntegral()); |
| | | vo.setType(7); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | }else if(null != worldCup.getDrawIntegral() && 0 < worldCup.getDrawIntegral() && blue_score.compareTo(red_score) == 0){ |
| | | worldCupCompetitor.setDrawIntegral(worldCup.getDrawIntegral()); |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(worldCupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getDrawIntegral()); |
| | | vo.setType(9); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | }else if(null != worldCup.getLoseIntegral() && 0 < worldCup.getLoseIntegral() && blue_score.compareTo(red_score) < 0){ |
| | | worldCupCompetitor.setDrawIntegral(worldCup.getLoseIntegral()); |
| | | //增加积分明细 |
| | | SaveUserIntegralChangesVo vo = new SaveUserIntegralChangesVo(); |
| | | vo.setAppUserId(worldCupCompetitor.getAppUserId()); |
| | | vo.setIntegral(worldCup.getLoseIntegral()); |
| | | vo.setType(10); |
| | | userIntegralChangesClient.saveUserIntegralChanges(vo); |
| | | } |
| | | } |
| | | } |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | worldCupCompetitorService.updateBatchById(worldCupCompetitors); |
| | | |
| | | //添加勋章 |
| | | for (WorldCupCompetitor worldCupCompetitor : worldCupCompetitors) { |
| | | Integer appUserId = worldCupCompetitor.getAppUserId(); |
| | | //常胜将军 |
| | | if(1 == worldCupCompetitor.getMatchResult()){ |
| | | int count = worldCupCompetitorService.count(new QueryWrapper<WorldCupCompetitor>().eq("appUserId", appUserId).eq("matchResult", 1)); |
| | | StudentHonor studentHonor = new StudentHonor(); |
| | | studentHonor.setAppUserId(appUserId); |
| | | studentHonor.setHonorType(5); |
| | | studentHonor.setNumber(count); |
| | | studentHonorClient.saveStudentHonor(studentHonor); |
| | | } |
| | | //越战越勇 |
| | | int count = worldCupCompetitorService.count(new QueryWrapper<WorldCupCompetitor>().eq("appUserId", appUserId)); |
| | | StudentHonor studentHonor = new StudentHonor(); |
| | | studentHonor.setAppUserId(appUserId); |
| | | studentHonor.setHonorType(6); |
| | | studentHonor.setNumber(count); |
| | | studentHonorClient.saveStudentHonor(studentHonor); |
| | | } |
| | | return ResultUtil.success(); |
| | | } |
| | | } |
| | |
| | | @Configuration |
| | | @PropertySource("classpath:redis.properties") |
| | | public class RedisConfig { |
| | | @Value("${spring.redis.host}") |
| | | @Value("192.168.110.106") |
| | | private String host; |
| | | |
| | | @Value("${spring.redis.port}") |
| | |
| | | participantType, |
| | | participantId, |
| | | appUserId, |
| | | count(*) as num |
| | | count(*) as num, |
| | | winIntegral, |
| | | drawIntegral, |
| | | loseIntegral |
| | | from t_world_cup_competitor |
| | | where matchResult is not null |
| | | <if test="null != item.year"> |
| | | and DATE_FORMAT(startTime, '%Y') = #{item.year} |
| | | </if> |
| | | <if test="null != sTime and null != eTime"> |
| | | and startTime between #{sTime} and #{eTime} |
| | | </if> |
| | | |
| | | |
| | | <if test="null != item.worldCupId"> |
| | | and worldCupId =#{item.worldCupId} |
| | | </if> |
| | | <if test="null != appUserIds and appUserIds.size() > 0"> |
| | | and appUserId in |
| | |
| | | where matchResult is not null and matchResult != -1 |
| | | <if test="null != item.year"> |
| | | and DATE_FORMAT(startTime, '%Y') = #{item.year} |
| | | </if> |
| | | <if test="null != sTime and null != eTime"> |
| | | and startTime between #{sTime} and #{eTime} |
| | | </if> |
| | | <if test="null != item.worldCupId"> |
| | | and worldCupId =#{item.worldCupId} |
| | | </if> |
| | | <if test="null != appUserIds and appUserIds.size() > 0"> |
| | | and appUserId in |
| | |
| | | #{iten} |
| | | </foreach> |
| | | </if> |
| | | <if test="sTime != null and eTime != null"> |
| | | and startTime between #{sTime} and #{eTime} |
| | | </if> |
| | | group by participantType, participantId, appUserId |
| | | </select> |
| | | |
| | |
| | | <foreach collection="appUserIds" item="iten" index="index" open="(" separator="," close=")"> |
| | | #{iten} |
| | | </foreach> |
| | | </if> |
| | | <if test="sTime != null and eTime != null"> |
| | | and startTime between #{sTime} and #{eTime} |
| | | </if> |
| | | group by participantType, participantId, appUserId |
| | | </select> |
| | |
| | | ourScore, |
| | | opponentScore, |
| | | matchResult, |
| | | b.`name` |
| | | b.`name`, |
| | | CONCAT(a.id, '') as id |
| | | from t_world_cup_competitor a |
| | | left join t_world_cup b on (a.worldCupId = b.id) |
| | | where matchResult is not null |
| | |
| | | <select id="getMatchTime" resultType="int"> |
| | | select count(*) as matchTime from (select code from t_world_cup_competitor where worldCupId = #{worldCupId} group by code) as b |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="getWorldCupListFromRank" resultType="com.dsh.communityWorldCup.model.WorldCupListVo"> |
| | | select |
| | | a.id, |
| | | b.worldCupId, |
| | | c.name, |
| | | c.lon, |
| | | c.lat, |
| | | c.basePeople as heat, |
| | | c.status |
| | | from t_world_cup_payment_participant a |
| | | left join t_world_cup_payment b on (a.worldCupPaymentId = b.id) |
| | | left join t_world_cup c on (b.worldCupId = c.id) |
| | | where a.participantId = #{item.id} and b.payStatus = 2 and b.refundTime is null and b.state = 1 |
| | | order by a.createTime desc |
| | | </select> |
| | | </mapper> |
| | |
| | | status, |
| | | lon, |
| | | lat, |
| | | type, |
| | | CASE status WHEN 1 THEN 2 WHEN 2 THEN 1 ELSE status END as sort |
| | | from t_world_cup where status != 3 |
| | | <if test="null != item.content and '' != item.content"> |
| | |
| | | a.paiCoin, |
| | | a.classHour, |
| | | a.intro, |
| | | a.content |
| | | a.content, |
| | | a.contentOne |
| | | from t_world_cup a |
| | | where a.id = #{id} |
| | | </select> |
| | |
| | | CONCAT(startAge, '至', endAge) as age, |
| | | gender, |
| | | maxPeople, |
| | | status |
| | | status, |
| | | type |
| | | from t_world_cup |
| | | where 1 = 1 |
| | | <if test="null != item.name and '' != item.name"> |
| | |
| | | <if test="null != item.status"> |
| | | and status= #{item.status} |
| | | </if> |
| | | <if test="null != item.type"> |
| | | and type= #{item.type} |
| | | </if> |
| | | order by createTime desc limit #{item.offset}, #{item.limit} |
| | | </select> |
| | | |
New file |
| | |
| | | package com.dsh.course.feignClient.communityWorldCup.Model; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * @author zhibing.pu |
| | | * @Date 2024/3/6 20:00 |
| | | */ |
| | | @Data |
| | | public class SaveData { |
| | | /** |
| | | * 参赛数据id |
| | | */ |
| | | private Long id; |
| | | /** |
| | | * 蓝方得分 |
| | | */ |
| | | private String blueStr; |
| | | /** |
| | | * 红方得分 |
| | | */ |
| | | private String redStr; |
| | | |
| | | private String time; |
| | | |
| | | private Integer blueScore; |
| | | |
| | | private Integer redScore; |
| | | } |
| | |
| | | * 胜利获得积分 |
| | | */ |
| | | private Integer winIntegral; |
| | | |
| | | /** |
| | | * 类型(1=智慧赛事,2=非智慧赛事) |
| | | */ |
| | | private Integer type; |
| | | |
| | | /** |
| | | * 平场获得积分 |
| | | */ |
| | | private Integer drawIntegral; |
| | | |
| | | /** |
| | | * 失败获得积分 |
| | | */ |
| | | private Integer loseIntegral; |
| | | /** |
| | | * 省 |
| | | */ |
| | |
| | | */ |
| | | private String content; |
| | | /** |
| | | * 参赛协议 |
| | | */ |
| | | private String contentOne; |
| | | /** |
| | | * 比赛状态(1=未开始,2=已开始,3=已结束,4=已取消) |
| | | */ |
| | | private Integer status; |
| | |
| | | * 比赛状态(1=未开始,2=已开始,3=已结束,4=已取消) |
| | | */ |
| | | private Integer status; |
| | | |
| | | /** |
| | | * 1=智慧赛事,2=非智慧赛事 |
| | | */ |
| | | private Integer type; |
| | | /** |
| | | * 页码 |
| | | */ |
| | |
| | | */ |
| | | private String city; |
| | | /** |
| | | * 时间 |
| | | */ |
| | | private String time; |
| | | /** |
| | | * 页码 |
| | | */ |
| | | private Integer offset; |
| | |
| | | package com.dsh.course.feignClient.communityWorldCup; |
| | | |
| | | import com.dsh.course.feignClient.communityWorldCup.Model.*; |
| | | import com.dsh.course.model.dto.UserDetailsOfSearch; |
| | | import com.dsh.course.model.vo.WorldCupUserListVo; |
| | | import com.dsh.guns.modular.system.model.WorldCupQuery; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | |
| | | */ |
| | | @PostMapping("/worldCup/getRegisteredNumber") |
| | | int getRegisteredNumber(Integer worldCupId); |
| | | |
| | | @PostMapping("/worldCup/userDetailsOfSearch") |
| | | List<WorldCupUserListVo> userDetailsOfSearch(UserDetailsOfSearch search); |
| | | |
| | | @PostMapping("/worldCup/savaData1") |
| | | void savaData1(SaveData saveData); |
| | | |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.dto; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Data |
| | | public class UserDetailsOfSearch { |
| | | |
| | | private Integer id; |
| | | |
| | | private String name; |
| | | |
| | | private String phone; |
| | | |
| | | private String idCard; |
| | | |
| | | private List<Integer> useIds; |
| | | } |
New file |
| | |
| | | package com.dsh.course.model.vo; |
| | | |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | @Data |
| | | public class WorldCupUserListVo { |
| | | @ApiModelProperty("报名id") |
| | | private Long id; |
| | | |
| | | @ApiModelProperty("姓名") |
| | | private String name; |
| | | |
| | | @ApiModelProperty("性别") |
| | | private String sex; |
| | | |
| | | @ApiModelProperty("年龄") |
| | | private String age; |
| | | |
| | | @ApiModelProperty("身份证号") |
| | | private String idCard; |
| | | |
| | | @ApiModelProperty("手机号") |
| | | private String phone; |
| | | |
| | | |
| | | } |
| | |
| | | @ResponseBody |
| | | public List<TStore> getStores(Integer id) |
| | | { |
| | | payMoneyUtil.getMessage(); |
| | | // payMoneyUtil.getMessage(); |
| | | return storeService.list(new QueryWrapper<TStore>() |
| | | .eq("operatorId",id) |
| | | .ne("state",3)); |
| | |
| | | if (imgFile != null){ |
| | | String originalFilename = imgFile.getOriginalFilename(); |
| | | String newName = originalFilename.substring(imgFile.getOriginalFilename().lastIndexOf(".")); |
| | | |
| | | |
| | | String url = OssUploadUtil.ossUpload("img/",imgFile); |
| | | Map<String, String> map = new HashMap<String, String>(); |
| | | //是否上传成功 |
| | |
| | | |
| | | import com.dsh.course.feignClient.communityWorldCup.Model.*; |
| | | import com.dsh.course.feignClient.communityWorldCup.WorldCupClient; |
| | | import com.dsh.course.model.dto.UserDetailsOfSearch; |
| | | import com.dsh.guns.modular.system.util.ExcelUtil; |
| | | import com.dsh.guns.modular.system.util.ResultUtil; |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | |
| | | public String openWorldCupGameStatisticsInfo(Model model, Integer id){ |
| | | model.addAttribute("id", id); |
| | | return PREFIX + "worldCupGameStatisticsInfo.html"; |
| | | } |
| | | |
| | | @RequestMapping("/addWorldCupGameStatisticsInfo") |
| | | public String addWorldCupGameStatisticsInfo(Model model, Integer id){ |
| | | WorldCup worldCupById = worldCupClient.getWorldCupById(id); |
| | | model.addAttribute("item", worldCupById); |
| | | return PREFIX + "addWorldCupGameStatisticsListInfo.html"; |
| | | } |
| | | @RequestMapping("/userList") |
| | | public String userList(Integer id,Model model){ |
| | | WorldCup worldCupById = worldCupClient.getWorldCupById(id); |
| | | model.addAttribute("item", worldCupById); |
| | | return PREFIX + "TUserList.html"; |
| | | } |
| | | @RequestMapping("/userList1") |
| | | public String userList1(Integer id,Model model){ |
| | | WorldCup worldCupById = worldCupClient.getWorldCupById(id); |
| | | model.addAttribute("item", worldCupById); |
| | | return PREFIX + "TUserList1.html"; |
| | | } |
| | | |
| | | |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/userDetailsOfSearch") |
| | | public Object storeDetailsOfSearch(Integer id,String name,String phone,String idCard){ |
| | | UserDetailsOfSearch userDetailsOfSearch = new UserDetailsOfSearch(); |
| | | userDetailsOfSearch.setId( id); |
| | | userDetailsOfSearch.setName(name); |
| | | userDetailsOfSearch.setPhone(phone); |
| | | userDetailsOfSearch.setIdCard(idCard); |
| | | // 获取报了名的用户 未产生赛事 |
| | | return worldCupClient.userDetailsOfSearch(userDetailsOfSearch); |
| | | } |
| | | |
| | | |
| | | @ResponseBody |
| | | @PostMapping("/savaData1") |
| | | public Object savaData1(SaveData saveData){ |
| | | // 修改WorldCupPaymentParticipant 参赛状态 savet_world_cup_competitor |
| | | worldCupClient.savaData1(saveData); |
| | | return ResultUtil.success(); |
| | | } |
| | | } |
| | |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.alipay.api.AlipayApiException; |
| | | import com.alipay.api.AlipayClient; |
| | | import com.alipay.api.CertAlipayRequest; |
| | | import com.alipay.api.DefaultAlipayClient; |
| | | import com.alipay.api.domain.AlipayTradeAppPayModel; |
| | | import com.alipay.api.msg.AlipayMsgClient; |
| | | import com.alipay.api.msg.MsgHandler; |
| | | import com.alipay.api.request.*; |
| | | import com.alipay.api.response.*; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | /** |
| | | * 处理直付通审核通过和拒绝消息 |
| | | */ |
| | | public void getMessage() { |
| | | System.err.println("进入"); |
| | | final AlipayMsgClient alipayMsgClient = AlipayMsgClient.getInstance(aliAppid); |
| | | try { |
| | | alipayMsgClient.setConnector(serverHost); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | alipayMsgClient.setSecurityConfig(signType, appPrivateKey, alipay_public_key); |
| | | try { |
| | | alipayMsgClient.connect(); |
| | | } catch (InterruptedException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | alipayMsgClient.setMessageHandler( new MsgHandler() { |
| | | /** |
| | | * 客户端接收到消息后回调此方法 |
| | | * @param msgApi 接收到的消息的消息api名 |
| | | * @param msgId 接收到的消息的消息id |
| | | * @param bizContent 接收到的消息的内容,json格式 |
| | | */ |
| | | public void onMessage (String msgApi, String msgId, String bizContent) { |
| | | // 直付通进件审核通过 |
| | | if (StringUtils.equals(msgApi,"ant.merchant.expand.indirect.zft.passed")){ |
| | | // 修改运营商状态 将返回的商户号填入运营商 |
| | | System.out.println( "receive message. msgApi:" + msgApi + " msgId:" + msgId + " bizContent:" + bizContent); |
| | | JSONObject json = JSONObject.parseObject(bizContent); |
| | | // 商户号 |
| | | String smid = json.getString("smid"); |
| | | // 审核备注信息 |
| | | String memo = json.getString("memo"); |
| | | // 订单id |
| | | String orderId = json.getString("order_id"); |
| | | // 通过订单id查询 |
| | | OperatorAuthAlipay auth = operatorAuthService.getOne(new QueryWrapper<OperatorAuthAlipay>() |
| | | .eq("orderNo",orderId)); |
| | | auth.setSmid(smid); |
| | | auth.setAuditState(2); |
| | | auth.setRefuseReason(memo); |
| | | operatorAuthService.updateById(auth); |
| | | Integer operatorId = auth.getOperatorId(); |
| | | OperatorUser operatorId1 = operatorUserService.getOne(new QueryWrapper<OperatorUser>() |
| | | .eq("operatorId", operatorId)); |
| | | operatorId1.setAlipayNum(smid); |
| | | operatorId1.setAlipayAudit(2); |
| | | operatorUserService.updateById(operatorId1); |
| | | } |
| | | // 直付通进件审核失败 |
| | | if (StringUtils.equals(msgApi,"ant.merchant.expand.indirect.zft.rejected")){ |
| | | JSONObject json = JSONObject.parseObject(bizContent); |
| | | // 商户号 |
| | | String orderId = json.getString("order_id"); |
| | | // 官方拒绝理由 |
| | | String reason = json.getString("reason"); |
| | | // 通过订单id查询 |
| | | OperatorAuthAlipay auth = operatorAuthService.getOne(new QueryWrapper<OperatorAuthAlipay>() |
| | | .eq("orderNo",orderId)); |
| | | auth.setAuditState(3); |
| | | auth.setRefuseReason(reason); |
| | | operatorAuthService.updateById(auth); |
| | | Integer operatorId = auth.getOperatorId(); |
| | | OperatorUser operatorId1 = operatorUserService.getOne(new QueryWrapper<OperatorUser>() |
| | | .eq("operatorId", operatorId)); |
| | | operatorId1.setAlipayAudit(3); |
| | | operatorUserService.updateById(operatorId1); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | // public void getMessage() { |
| | | // System.err.println("进入"); |
| | | // final AlipayMsgClient alipayMsgClient = AlipayMsgClient.getInstance(aliAppid); |
| | | // try { |
| | | // alipayMsgClient.setConnector(serverHost); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // alipayMsgClient.setSecurityConfig(signType, appPrivateKey, alipay_public_key); |
| | | // try { |
| | | // alipayMsgClient.connect(); |
| | | // } catch (InterruptedException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // alipayMsgClient.setMessageHandler( new MsgHandler() { |
| | | // /** |
| | | // * 客户端接收到消息后回调此方法 |
| | | // * @param msgApi 接收到的消息的消息api名 |
| | | // * @param msgId 接收到的消息的消息id |
| | | // * @param bizContent 接收到的消息的内容,json格式 |
| | | // */ |
| | | // public void onMessage (String msgApi, String msgId, String bizContent) { |
| | | // // 直付通进件审核通过 |
| | | // if (StringUtils.equals(msgApi,"ant.merchant.expand.indirect.zft.passed")){ |
| | | // // 修改运营商状态 将返回的商户号填入运营商 |
| | | // System.out.println( "receive message. msgApi:" + msgApi + " msgId:" + msgId + " bizContent:" + bizContent); |
| | | // JSONObject json = JSONObject.parseObject(bizContent); |
| | | // // 商户号 |
| | | // String smid = json.getString("smid"); |
| | | // // 审核备注信息 |
| | | // String memo = json.getString("memo"); |
| | | // // 订单id |
| | | // String orderId = json.getString("order_id"); |
| | | // // 通过订单id查询 |
| | | // OperatorAuthAlipay auth = operatorAuthService.getOne(new QueryWrapper<OperatorAuthAlipay>() |
| | | // .eq("orderNo",orderId)); |
| | | // auth.setSmid(smid); |
| | | // auth.setAuditState(2); |
| | | // auth.setRefuseReason(memo); |
| | | // operatorAuthService.updateById(auth); |
| | | // Integer operatorId = auth.getOperatorId(); |
| | | // OperatorUser operatorId1 = operatorUserService.getOne(new QueryWrapper<OperatorUser>() |
| | | // .eq("operatorId", operatorId)); |
| | | // operatorId1.setAlipayNum(smid); |
| | | // operatorId1.setAlipayAudit(2); |
| | | // operatorUserService.updateById(operatorId1); |
| | | // } |
| | | // // 直付通进件审核失败 |
| | | // if (StringUtils.equals(msgApi,"ant.merchant.expand.indirect.zft.rejected")){ |
| | | // JSONObject json = JSONObject.parseObject(bizContent); |
| | | // // 商户号 |
| | | // String orderId = json.getString("order_id"); |
| | | // // 官方拒绝理由 |
| | | // String reason = json.getString("reason"); |
| | | // // 通过订单id查询 |
| | | // OperatorAuthAlipay auth = operatorAuthService.getOne(new QueryWrapper<OperatorAuthAlipay>() |
| | | // .eq("orderNo",orderId)); |
| | | // auth.setAuditState(3); |
| | | // auth.setRefuseReason(reason); |
| | | // operatorAuthService.updateById(auth); |
| | | // Integer operatorId = auth.getOperatorId(); |
| | | // OperatorUser operatorId1 = operatorUserService.getOne(new QueryWrapper<OperatorUser>() |
| | | // .eq("operatorId", operatorId)); |
| | | // operatorId1.setAlipayAudit(3); |
| | | // operatorUserService.updateById(operatorId1); |
| | | // } |
| | | // } |
| | | // }); |
| | | // } |
| | | /** |
| | | * 支付宝支付 |
| | | */ |
| | |
| | | // } |
| | | |
| | | |
| | | //实例化客户端 |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2"); |
| | | //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay |
| | | AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest(); |
| | | //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 |
| | | AlipayTradeAppPayModel model = new AlipayTradeAppPayModel(); |
| | | model.setBody(body);//对一笔交易的具体描述信息。如果是多种商品,请将商品描述字符串累加传给body。 |
| | | model.setSubject(subject);//商品的标题/交易标题/订单标题/订单关键字等。 |
| | | model.setOutTradeNo(outTradeNo);//商户网站唯一订单号 |
| | | model.setTimeoutExpress("30m"); |
| | | model.setTotalAmount(amount);//付款金额 |
| | | model.setProductCode("QUICK_MSECURITY_PAY"); |
| | | model.setPassbackParams(passbackParams);//自定义参数 |
| | | // //实例化客户端 |
| | | // AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2"); |
| | | // //实例化具体API对应的request类,类名称和接口名称对应,当前调用接口名称:alipay.trade.app.pay |
| | | // AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest(); |
| | | // //SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。 |
| | | // AlipayTradeAppPayModel model = new AlipayTradeAppPayModel(); |
| | | // model.setBody(body);//对一笔交易的具体描述信息。如果是多种商品,请将商品描述字符串累加传给body。 |
| | | // model.setSubject(subject);//商品的标题/交易标题/订单标题/订单关键字等。 |
| | | // model.setOutTradeNo(outTradeNo);//商户网站唯一订单号 |
| | | // model.setTimeoutExpress("30m"); |
| | | // model.setTotalAmount(amount);//付款金额 |
| | | // model.setProductCode("QUICK_MSECURITY_PAY"); |
| | | // model.setPassbackParams(passbackParams);//自定义参数 |
| | | |
| | | |
| | | //分账 |
| | |
| | | // model.setRoyaltyInfo(royaltyInfo); |
| | | // System.err.println("=================="+royaltyInfo); |
| | | // |
| | | request.setBizModel(model); |
| | | request.setNotifyUrl(callbackPath + notifyUrl); |
| | | try { |
| | | //这里和普通的接口调用不同,使用的是sdkExecute |
| | | AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("orderString", response.getBody()); |
| | | map.put("returnId", passbackParams); |
| | | System.out.println(map);//就是orderString 可以直接给客户端请求,无需再做处理。 |
| | | return ResultUtil.success(map); |
| | | } catch (AlipayApiException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // request.setBizModel(model); |
| | | // request.setNotifyUrl(callbackPath + notifyUrl); |
| | | // try { |
| | | // //这里和普通的接口调用不同,使用的是sdkExecute |
| | | // AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request); |
| | | // Map<String, String> map = new HashMap<>(); |
| | | // map.put("orderString", response.getBody()); |
| | | // map.put("returnId", passbackParams); |
| | | // System.out.println(map);//就是orderString 可以直接给客户端请求,无需再做处理。 |
| | | // return ResultUtil.success(map); |
| | | // } catch (AlipayApiException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | return null; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | /** |
| | | * 支付宝查询订单支付状态 |
| | | * |
| | | * @param out_trade_no |
| | | * @return |
| | | * @throws Exception |
| | | */ |
| | | public AlipayTradeQueryResponse queryALIOrder(String out_trade_no) throws Exception { |
| | | AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2"); |
| | | AlipayTradeQueryRequest request = new AlipayTradeQueryRequest(); |
| | | request.setBizContent("{" + |
| | | " \"out_trade_no\":\"" + out_trade_no + "\"" + |
| | | "}"); |
| | | AlipayTradeQueryResponse response = alipayClient.execute(request); |
| | | return response; |
| | | |
| | | } |
| | | // /** |
| | | // * 支付宝查询订单支付状态 |
| | | // * |
| | | // * @param out_trade_no |
| | | // * @return |
| | | // * @throws Exception |
| | | // */ |
| | | // public AlipayTradeQueryResponse queryALIOrder(String out_trade_no) throws Exception { |
| | | // AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", aliAppid, appPrivateKey, "json", "UTF-8", alipay_public_key, "RSA2"); |
| | | // AlipayTradeQueryRequest request = new AlipayTradeQueryRequest(); |
| | | // request.setBizContent("{" + |
| | | // " \"out_trade_no\":\"" + out_trade_no + "\"" + |
| | | // "}"); |
| | | // AlipayTradeQueryResponse response = alipayClient.execute(request); |
| | | // return response; |
| | | // |
| | | // } |
| | | |
| | | |
| | | |
| | |
| | | </div> |
| | | </div> |
| | | |
| | | <div style="font-size: x-large;">社区世界杯板块</div> |
| | | <div style="font-size: x-large;">赛事比赛板块</div> |
| | | @for(obj in worldCupStores){ |
| | | <div class="row"> |
| | | <input hidden name="cupId" value="${obj.id}"> |
| | |
| | | <div class="input-group"> |
| | | <div class="input-group-btn open"> |
| | | <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button" aria-expanded="true"> |
| | | 赛事类别: |
| | | </button> |
| | | </div> |
| | | <select class="form-control" id="type"> |
| | | <option value="">全部</option> |
| | | <option value="1">智慧赛事</option> |
| | | <option value="2">非智慧赛事</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <div class="input-group"> |
| | | <div class="input-group-btn open"> |
| | | <button data-toggle="dropdown" class="btn btn-white dropdown-toggle" type="button" aria-expanded="true"> |
| | | 状态 |
| | | </button> |
| | | </div> |
| | |
| | | <input class="form-control" id="name"> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*赛事类别:</label> |
| | | <div class="col-sm-3"> |
| | | <select class="form-control" id="type"> |
| | | <option value="1">智慧赛事</option> |
| | | <option value="2">非智慧赛事</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*开始时间:</label> |
| | | <div class="col-sm-3"> |
| | |
| | | <input class="form-control" id="winIntegral" type="number" min="0"> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">平场可获积分</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="drawIntegral" type="number" min="0"> |
| | | </div> |
| | | <label style="float: left;line-height: 35px;">败场可获积分</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="loseIntegral" type="number" min="0"> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*比赛地点:</label> |
| | | <div class="col-sm-7"> |
| | |
| | | <textarea id="content" style="height: 800px;width: 100%;"></textarea> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*参赛协议</label> |
| | | <div class="col-sm-7" style="padding: 0px;"> |
| | | <textarea id="contentOne" style="height: 800px;width: 100%;"></textarea> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="row btn-group-m-t"> |
| | |
| | | <input class="form-control" id="name" value="${item.name}"> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*赛事类别:</label> |
| | | <div class="col-sm-3"> |
| | | <select class="form-control" id="type"> |
| | | <option value="1" ${1 == item.type ? 'selected' : ''}>智慧赛事</option> |
| | | <option value="2" ${2 == item.type ? 'selected' : ''}>非智慧赛事</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*开始时间:</label> |
| | | <div class="col-sm-3"> |
| | |
| | | <input class="form-control" id="winIntegral" type="number" min="0" value="${item.winIntegral}"> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">平场可获积分</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="drawIntegral" type="number" min="0" value="${item.drawIntegral}"> |
| | | </div> |
| | | <label style="float: left;line-height: 35px;">败场可获积分</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="loseIntegral" type="number" min="0" value="${item.loseIntegral}"> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*比赛地点:</label> |
| | | <div class="col-sm-7"> |
| | |
| | | <textarea id="content" style="height: 800px;width: 100%;">${item.content}</textarea> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*参赛协议</label> |
| | | <div class="col-sm-7" style="padding: 0px;"> |
| | | <textarea id="contentOne" style="height: 800px;width: 100%;">${item.contentOne}</textarea> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="row btn-group-m-t"> |
| | |
| | | <input class="form-control" id="name" value="${item.name}" disabled> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*赛事类别:</label> |
| | | <div class="col-sm-3"> |
| | | <select class="form-control" id="type" disabled> |
| | | <option value="1" ${1 == item.type ? 'selected' : ''}>智慧赛事</option> |
| | | <option value="2" ${2 == item.type ? 'selected' : ''}>非智慧赛事</option> |
| | | </select> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*开始时间:</label> |
| | | <div class="col-sm-3"> |
| | |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">平场可获积分</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="drawIntegral" type="number" min="0" value="${item.drawIntegral}" disabled> |
| | | </div> |
| | | <label style="float: left;line-height: 35px;">败场可获积分</label> |
| | | <div class="col-sm-3"> |
| | | <input class="form-control" id="loseIntegral" type="number" min="0" value="${item.loseIntegral}" disabled> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*比赛地点:</label> |
| | | <div class="col-sm-7"> |
| | | <input class="form-control" id="address" onchange="WorldCupInfo.searchByStationName(this,1)" value="${item.address}" disabled> |
| | |
| | | <textarea id="content" style="height: 800px;width: 100%;">${item.content}</textarea> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">参赛协议</label> |
| | | <div class="col-sm-7" style="padding: 0px;"> |
| | | <textarea id="contentOne" style="height: 800px;width: 100%;">${item.contentOne}</textarea> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>参赛人员</h5> |
| | | </div> |
| | | <div class="ibox-content"> |
| | | |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <input type="hidden" id="id" value="${item.id}"></input> |
| | | <div class="row"> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="userName" name="姓名:" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="phone" name="联系电话:" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="idCard" name="身份证号:" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#button name="搜索" icon="fa-search" clickFun="TStoreProvince.search()"/> |
| | | </div> |
| | | </div> |
| | | <div class="hidden-xs" id="TStoreProvinceTableToolbar" role="group"> |
| | | </div> |
| | | <#table id="TStoreProvinceTable"/> |
| | | <div style="margin-left: 30%"> |
| | | <button type="button" class="btn btn-info button-margin" onclick="TStoreProvince.storeOfClosePage()" |
| | | id="closePage" style="width: 30%;height: 40px;background: #0d8ddb;color: white;border: none;"> |
| | | <i class="fa fa-check"></i> 关闭 |
| | | </button> |
| | | |
| | | <button type="button" class="btn btn-info button-margin" onclick="TStoreProvince.saveSelectStores()" |
| | | id="submit" style="margin-left: 5%;width: 30%;height: 40px;background: #0d8ddb;color: white;border: none;"> |
| | | <i class="fa fa-check"></i> 保存 |
| | | </button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/modular/system/worldCupRecords/TStoreInfo.js"></script> |
| | | <script src="${ctxPath}/modular/system/worldCupRecords/TCouponInfo.js"></script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>参赛人员</h5> |
| | | </div> |
| | | <div class="ibox-content"> |
| | | |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <input type="hidden" id="id" value="${item.id}"></input> |
| | | <div class="row"> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="userName" name="姓名:" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="phone" name="联系电话:" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="idCard" name="身份证号:" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#button name="搜索" icon="fa-search" clickFun="TStoreProvince.search()"/> |
| | | </div> |
| | | </div> |
| | | <div class="hidden-xs" id="TStoreProvinceTableToolbar" role="group"> |
| | | </div> |
| | | <#table id="TStoreProvinceTable"/> |
| | | <div style="margin-left: 30%"> |
| | | <button type="button" class="btn btn-info button-margin" onclick="TStoreProvince.storeOfClosePage()" |
| | | id="closePage" style="width: 30%;height: 40px;background: #0d8ddb;color: white;border: none;"> |
| | | <i class="fa fa-check"></i> 关闭 |
| | | </button> |
| | | |
| | | <button type="button" class="btn btn-info button-margin" onclick="TStoreProvince.saveSelectStores1()" |
| | | id="submit" style="margin-left: 5%;width: 30%;height: 40px;background: #0d8ddb;color: white;border: none;"> |
| | | <i class="fa fa-check"></i> 保存 |
| | | </button> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/modular/system/worldCupRecords/TStoreInfo.js"></script> |
| | | <script src="${ctxPath}/modular/system/worldCupRecords/TCouponInfo.js"></script> |
| | | @} |
New file |
| | |
| | | @layout("/common/_container.html"){ |
| | | <div class="row"> |
| | | <div class="col-sm-12"> |
| | | <div class="ibox float-e-margins"> |
| | | <div class="ibox-title"> |
| | | <h5>比赛详情</h5> |
| | | </div> |
| | | <div class="ibox-content"> |
| | | <div class="row row-lg"> |
| | | <div class="col-sm-12"> |
| | | <input type="hidden" id="id" value="${item.id}"></input> |
| | | <div class="row"> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*比赛名称:${item.name}</label> |
| | | </div> |
| | | <div class="form-group"> |
| | | <label class="col-sm-3 control-label">*参赛人:</label> |
| | | </div> |
| | | |
| | | <div class="form-group"> |
| | | <div class="col-sm-12"> |
| | | <label class="col-sm-3 control-label">红方: </label> |
| | | <button onclick="userList()" |
| | | style="height: 22px;width: 82px;background-color: #4a8ff1;color: white;z-index: 15;position:relative;border: none;margin-top: 1%"> |
| | | 选择人员 |
| | | </button> |
| | | </div> |
| | | <div class="col-sm-12" style="margin-left: -57px;margin-top: 20px"> |
| | | <table class="table table-bordered" style="width: 70%;margin-left: 228px;" |
| | | id="userTableOne"> |
| | | <thead> |
| | | <tr> |
| | | <td>id</td> |
| | | <td>人员</td> |
| | | <td>联系电话</td> |
| | | <td>性别</td> |
| | | <td>年龄</td> |
| | | <td>操作</td> |
| | | </tr> |
| | | </thead> |
| | | <tbody id="coun"></tbody> |
| | | </table> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <div class="col-sm-12"> |
| | | <label class="col-sm-3 control-label">蓝方: </label> |
| | | <button onclick="userList1()" |
| | | style="height: 22px;width: 82px;background-color: #4a8ff1;color: white;z-index: 15;position:relative;border: none;margin-top: 1%"> |
| | | 选择人员 |
| | | </button> |
| | | </div> |
| | | <div class="col-sm-12" style="margin-left: -57px;margin-top: 20px"> |
| | | <table class="table table-bordered" style="width: 70%;margin-left: 228px;" |
| | | id="userTableTwo"> |
| | | <thead> |
| | | <tr> |
| | | <td>id</td> |
| | | <td>人员</td> |
| | | <td>联系电话</td> |
| | | <td>性别</td> |
| | | <td>年龄</td> |
| | | <td>操作</td> |
| | | </tr> |
| | | </thead> |
| | | <tbody id="coun1"></tbody> |
| | | </table> |
| | | </div> |
| | | </div> |
| | | |
| | | <div class="form-group"> |
| | | <div class="col-sm-12" > |
| | | <label class="col-sm-1 control-label">*比赛时间:</label> |
| | | <div class="col-sm-4"> |
| | | <input type="text" class="form-control" id="time" name="time" |
| | | placeholder="请选择时间"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | |
| | | <!-- 蓝方得分--> |
| | | <div class="form-group"> |
| | | <div class="col-sm-12" style="margin-top: 10px"> |
| | | <label class="col-sm-1 control-label">*蓝方得分:</label> |
| | | <div class="col-sm-2"> |
| | | <input type="text" class="form-control" id="blueScore" name="blueScore" |
| | | placeholder="请输入蓝方得分"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <div class="form-group"> |
| | | <div class="col-sm-12" style="margin-top: 10px"> |
| | | <label class="col-sm-1 control-label">*红方得分:</label> |
| | | <div class="col-sm-2"> |
| | | <input type="text" class="form-control" id="redScore" name="redScore" |
| | | placeholder="请输入红方得分"> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | |
| | | </div> |
| | | |
| | | </div> |
| | | <div class="row btn-group-m-t"> |
| | | <div class="col-sm-10"> |
| | | <#button btnCss="danger" name="关闭" id="cancel" icon="fa-eraser" clickFun="WorldCupGameStatisticsListInfo.close1()"/> |
| | | <#button btnCss="info" name="保存" id="ensure" icon="fa-check" clickFun="WorldCupGameStatisticsListInfo.saveData()"/> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | </div> |
| | | <script src="${ctxPath}/modular/system/worldCupRecords/worldCupGameStatisticsListInfo.js"></script> |
| | | <script> |
| | | laydate.render({ |
| | | elem: '#startTime' |
| | | }); |
| | | laydate.render({ |
| | | elem: '#endTime' |
| | | }); |
| | | laydate.render({ |
| | | elem: '#time' |
| | | ,type: 'datetime' |
| | | ,range: true |
| | | }); |
| | | |
| | | function close() { |
| | | console.log(32323) |
| | | // 方法2: 使用top级别关闭 |
| | | } |
| | | |
| | | |
| | | function userList() { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '人员列表', |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/worldCupRecords/userList?id=' + $("#id").val() |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | function userList1() { |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '人员列表', |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/worldCupRecords/userList1?id=' + $("#id").val() |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | </script> |
| | | @} |
| | |
| | | <#NameCon id="city" name="所在城市:" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#NameCon id="time" name="比赛日期:" /> |
| | | </div> |
| | | <div class="col-sm-3"> |
| | | <#button name="搜索" icon="fa-search" clickFun="WorldCupRecords.search1()"/> |
| | | <#button name="重置" icon="fa-trash" clickFun="WorldCupRecords.resetSearch1()" space="true"/> |
| | | </div> |
| | |
| | | </div> |
| | | <div class="hidden-xs" id="WorldCupRecordsTable2Toolbar" role="group"> |
| | | <#button name="查看详情" icon="fa-plus" clickFun="WorldCupRecords.openWorldCupRecordsInfo()"/> |
| | | <#button name="添加赛事记录" icon="fa-plus" clickFun="WorldCupRecords.addWorldCupRecordsInfo()"/> |
| | | </div> |
| | | <#table id="WorldCupRecordsTable2"/> |
| | | </div> |
| | |
| | | laydate.render({ |
| | | elem: '#endTime' |
| | | }); |
| | | laydate.render({ |
| | | elem: '#time' |
| | | ,range: true |
| | | }); |
| | | </script> |
| | | @} |
| | |
| | | {field: 'selectItem', checkbox: true}, |
| | | {title: 'id', field: 'id', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '比赛名称', field: 'name', visible: true, align: 'center', valign: 'middle',width:'20%',}, |
| | | {title: '赛事类别', field: 'type', visible: true, align: 'center', valign: 'middle',width:'20%', |
| | | formatter:function (data) { |
| | | return {1:"智慧赛事",2:"非智慧赛事"}[data] |
| | | } |
| | | }, |
| | | {title: '开始时间', field: 'startTime', visible: true, align: 'center', valign: 'middle',}, |
| | | {title: '结束时间', field: 'endTime', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '报名条件', field: 'age', visible: true, align: 'center', valign: 'middle', |
| | |
| | | queryData['startTime'] =$("#startTime").val(); |
| | | queryData['endTime'] =$("#endTime").val(); |
| | | queryData['status'] =$("#status").val(); |
| | | queryData['type'] =$("#type").val(); |
| | | WorldCup.table.refresh({query: queryData}); |
| | | }; |
| | | |
| | |
| | | $("#startTime").val(""); |
| | | $("#endTime").val(""); |
| | | $("#status").val(""); |
| | | $("#type").val(""); |
| | | WorldCup.search(); |
| | | }; |
| | | |
| | |
| | | let intro = $('#intro').val(); |
| | | let coverImg = $('#coverImg').val(); |
| | | let homeBackdropImg = $('#homeBackdropImg').val(); |
| | | let type = $('#type').val(); |
| | | let drawIntegral = $('#drawIntegral').val(); |
| | | let loseIntegral = $('#loseIntegral').val(); |
| | | let content = editor.getContent(); |
| | | let contentOne = editor1.getContent(); |
| | | if(null == name || '' == name){ |
| | | Feng.error("请填写有效的比赛名称"); |
| | | return |
| | |
| | | Feng.error("请填写有效的赛事简介"); |
| | | return |
| | | } |
| | | if(null == coverImg || '' == coverImg){ |
| | | Feng.error("请上传有效的比赛封面图"); |
| | | return |
| | | } |
| | | if(null == homeBackdropImg || '' == homeBackdropImg){ |
| | | Feng.error("请上传有效的首页默认背景图"); |
| | | return |
| | | } |
| | | if(WorldCupInfo.goodsPicArray1 == 0){ |
| | | Feng.error("请上传有效的比赛图片"); |
| | | return |
| | | } |
| | | // if(null == coverImg || '' == coverImg){ |
| | | // Feng.error("请上传有效的比赛封面图"); |
| | | // return |
| | | // } |
| | | // if(null == homeBackdropImg || '' == homeBackdropImg){ |
| | | // Feng.error("请上传有效的首页默认背景图"); |
| | | // return |
| | | // } |
| | | // if(WorldCupInfo.goodsPicArray1 == 0){ |
| | | // Feng.error("请上传有效的比赛图片"); |
| | | // return |
| | | // } |
| | | if(null == content || '' == content){ |
| | | Feng.error("请填写有效的比赛详情"); |
| | | return |
| | | } |
| | | if(null == contentOne || '' == contentOne){ |
| | | Feng.error("请填写有效的参赛协议"); |
| | | return |
| | | } |
| | | let data = { |
| | |
| | | 'infoImg': JSON.stringify(WorldCupInfo.goodsPicArray1), |
| | | 'intro': intro, |
| | | 'content': content, |
| | | 'stores': JSON.stringify(WorldCupInfo.stores) |
| | | 'stores': JSON.stringify(WorldCupInfo.stores), |
| | | 'type': type, |
| | | 'drawIntegral': drawIntegral, |
| | | 'loseIntegral': loseIntegral, |
| | | 'contentOne': contentOne |
| | | } |
| | | if(null != registrationClosingTime && '' != registrationClosingTime){ |
| | | data.registrationClosingTime = new Date(registrationClosingTime + " 23:59:59"); |
| | |
| | | let coverImg = $('#coverImg').val(); |
| | | let homeBackdropImg = $('#homeBackdropImg').val(); |
| | | let content = editor.getContent(); |
| | | let type = $('#type').val(); |
| | | let drawIntegral = $('#drawIntegral').val(); |
| | | let loseIntegral = $('#loseIntegral').val(); |
| | | let contentOne = editor1.getContent(); |
| | | if(null == name || '' == name){ |
| | | Feng.error("请填写有效的比赛名称"); |
| | | return |
| | |
| | | Feng.error("请填写有效的赛事简介"); |
| | | return |
| | | } |
| | | if(null == coverImg || '' == coverImg){ |
| | | Feng.error("请上传有效的比赛封面图"); |
| | | return |
| | | } |
| | | if(null == homeBackdropImg || '' == homeBackdropImg){ |
| | | Feng.error("请上传有效的首页默认背景图"); |
| | | return |
| | | } |
| | | if(WorldCupInfo.goodsPicArray1 == 0){ |
| | | Feng.error("请上传有效的比赛图片"); |
| | | return |
| | | } |
| | | // if(null == coverImg || '' == coverImg){ |
| | | // Feng.error("请上传有效的比赛封面图1"); |
| | | // return |
| | | // } |
| | | // if(null == homeBackdropImg || '' == homeBackdropImg){ |
| | | // Feng.error("请上传有效的首页默认背景图"); |
| | | // return |
| | | // } |
| | | // if(WorldCupInfo.goodsPicArray1 == 0){ |
| | | // Feng.error("请上传有效的比赛图片"); |
| | | // return |
| | | // } |
| | | if(null == content || '' == content){ |
| | | Feng.error("请填写有效的比赛详情"); |
| | | return |
| | | } |
| | | if(null == contentOne || '' == contentOne){ |
| | | Feng.error("请填写有效的参赛协议"); |
| | | return |
| | | } |
| | | |
| | | let data = { |
| | | 'id': $('#id').val(), |
| | | 'name': name, |
| | |
| | | 'infoImg': JSON.stringify(WorldCupInfo.goodsPicArray1), |
| | | 'intro': intro, |
| | | 'content': content, |
| | | 'stores': JSON.stringify(WorldCupInfo.stores) |
| | | 'stores': JSON.stringify(WorldCupInfo.stores), |
| | | 'type': type, |
| | | 'drawIntegral': drawIntegral, |
| | | 'loseIntegral': loseIntegral, |
| | | 'contentOne': contentOne |
| | | } |
| | | if(null != registrationClosingTime && '' != registrationClosingTime){ |
| | | data.registrationClosingTime = new Date(registrationClosingTime + " 23:59:59"); |
| | |
| | | |
| | | |
| | | var editor = null; |
| | | var editor1 = null; |
| | | $(function () { |
| | | //初始化编辑器 |
| | | editor = UE.getEditor('content'); |
| | | editor1 = UE.getEditor('contentOne'); |
| | | }); |
New file |
| | |
| | | /** |
| | | * 管理初始化 |
| | | */ |
| | | var TStoreProvince = { |
| | | id: "TStoreProvinceTable", //表格id |
| | | seItem: null, //选中的条目 |
| | | table: null, |
| | | layerIndex: -1, |
| | | storeList: [] |
| | | }; |
| | | |
| | | /** |
| | | * 初始化表格的列 |
| | | */ |
| | | TStoreProvince.initColumn = function () { |
| | | return [ |
| | | {field: 'selectItem', checkbox: true}, |
| | | {title: '序号', field: 'id', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '所在省市', field: 'provinceCity', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '所属运营商', field: 'account', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '门店名称', field: 'name', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '场地名称', field: 'siteName', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '闸机ids', field: 'ids', visible: true, align: 'center', valign: 'middle'}, |
| | | ]; |
| | | }; |
| | | |
| | | /** |
| | | * 检查是否选中 |
| | | */ |
| | | TStoreProvince.check = function () { |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if(selected.length == 0){ |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return false; |
| | | }else{ |
| | | TStoreProvince.seItem = selected[0]; |
| | | return true; |
| | | } |
| | | }; |
| | | |
| | | |
| | | TStoreProvince.storeOfClosePage = function (){ |
| | | parent.layer.close(parent.layer.getFrameIndex(window.frameElement.id)); |
| | | } |
| | | |
| | | |
| | | TStoreProvince.saveSelectSites = function (){ |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if (selected.length == 0) { |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return false; |
| | | } |
| | | var arr = []; |
| | | var name =''; |
| | | for(var i in selected){ |
| | | if(typeof selected[i].id != "undefined"){ |
| | | name = selected[0].account |
| | | if(name!=selected[i].account){ |
| | | Feng.info("请选择相同运营商场地") |
| | | return ; |
| | | } |
| | | console.log("arr push") |
| | | console.log(selected[i].id) |
| | | arr.push({ |
| | | id: selected[i].id, |
| | | provinceCity: typeof selected[i].provinceCity != "undefined" ? selected[i].provinceCity : "", |
| | | accountName: typeof selected[i].account != "undefined" ? selected[i].account : "", |
| | | name: typeof selected[i].name != "undefined" ? selected[i].name : "", |
| | | siteName: typeof selected[i].siteName != "undefined" ? selected[i].siteName : "", |
| | | ids:typeof selected[i].ids != "undefined" ? selected[i].ids : "", |
| | | }) |
| | | } |
| | | } |
| | | console.log("返回之前的数组") |
| | | console.log(arr) |
| | | window.parent.TGoodsInfoDlg.selecUserOpt1(arr); |
| | | TStoreProvince.storeOfClosePage(); |
| | | }; |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询列表 |
| | | */ |
| | | TStoreProvince.search = function () { |
| | | var queryData = {}; |
| | | queryData['provinceId'] = $("#pCode").val(); |
| | | queryData['cityId'] = $("#cCode").val(); |
| | | queryData['operatorId'] = $("#account").val(); |
| | | queryData['storeName'] = $("#storeName").val(); |
| | | TStoreProvince.table.refresh({query: queryData}); |
| | | }; |
| | | |
| | | |
| | | /** |
| | | * 重置搜索 |
| | | */ |
| | | TStoreProvince.resetSearch = function () { |
| | | $("#pCode").val('') |
| | | $("#cCode").val('') |
| | | $("#storeName").val('') |
| | | $("#account").val('') |
| | | TStoreProvince.search(); |
| | | }; |
| | | |
| | | function queryProvince(){ |
| | | // 发送AJAX请求到后台获取省份数据 |
| | | // 假设后台返回的数据格式为一个包含省份ID和名称的数组 |
| | | var provinceSelect = document.getElementById("province"); |
| | | |
| | | var ajax = new $ax(Feng.ctxPath + "/tCouponManage/getProvince", function(data){ |
| | | data.forEach(province => { |
| | | var option = document.createElement("option"); |
| | | option.value = province.code; // 根据你的数据结构确定省份的id字段 |
| | | option.text = province.name; // 根据你的数据结构确定省份的name字段 |
| | | provinceSelect.appendChild(option); |
| | | }); |
| | | },function(data){ |
| | | Feng.error("下拉失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.start(); |
| | | provinceSelect.addEventListener("change", queryCity); |
| | | } |
| | | |
| | | |
| | | // 获取城市数据 |
| | | function queryCity() { |
| | | var selectedProvinceId = this.value; // 获取选择的省份ID |
| | | // 发送AJAX请求到后台获取对应省份的城市数据 |
| | | // 假设后台返回的数据格式为一个包含城市ID和名称的数组 |
| | | |
| | | var citySelect = document.getElementById("city"); |
| | | citySelect.innerHTML = ""; |
| | | var ajax = new $ax(Feng.ctxPath + "/tCouponManage/getCity1", function(data){ |
| | | |
| | | data.forEach(province => { |
| | | var content='<option value="">选择市</option>'; |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.code+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#city").empty().append(content); |
| | | |
| | | }); |
| | | },function(data){ |
| | | console.log('data:',data) |
| | | Feng.error("获取失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set('province',selectedProvinceId); |
| | | ajax.start(); |
| | | } |
| | | |
| | | $(function () { |
| | | var defaultColunms = TStoreProvince.initColumn(); |
| | | var table = new BSTable(TStoreProvince.id, "/tCouponManage/siteDetailsOfSearch", defaultColunms); |
| | | table.setPaginationType("client"); |
| | | TStoreProvince.table = table.init(); |
| | | queryProvince(); |
| | | }); |
New file |
| | |
| | | /** |
| | | * 管理初始化 |
| | | */ |
| | | var TStoreProvince = { |
| | | id: "TStoreProvinceTable", //表格id |
| | | seItem: null, //选中的条目 |
| | | table: null, |
| | | layerIndex: -1, |
| | | storeList: [] |
| | | }; |
| | | |
| | | /** |
| | | * 初始化表格的列 |
| | | */ |
| | | TStoreProvince.initColumn = function () { |
| | | return [ |
| | | {field: 'selectItem', checkbox: true}, |
| | | {title: '序号', field: 'id', visible: false, align: 'center', valign: 'middle'}, |
| | | {title: '姓名', field: 'name', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '性别', field: 'sex', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '年龄', field: 'age', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '联系电话', field: 'phone', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '身份证号', field: 'idCard', visible: true, align: 'center', valign: 'middle'}, |
| | | |
| | | ]; |
| | | }; |
| | | |
| | | /** |
| | | * 检查是否选中 |
| | | */ |
| | | TStoreProvince.check = function () { |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if(selected.length == 0){ |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return false; |
| | | }else{ |
| | | TStoreProvince.seItem = selected[0]; |
| | | return true; |
| | | } |
| | | }; |
| | | |
| | | |
| | | TStoreProvince.storeOfClosePage = function (){ |
| | | parent.layer.close(parent.layer.getFrameIndex(window.frameElement.id)); |
| | | } |
| | | |
| | | TStoreProvince.saveSelectStores = function (){ |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if (selected.length == 0) { |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return false; |
| | | } |
| | | var arr = []; |
| | | var name =''; |
| | | for(var i in selected){ |
| | | if(typeof selected[i].id != "undefined"){ |
| | | console.log( selected[i].id,55555) |
| | | name = selected[0].accountName |
| | | arr.push({ |
| | | id: selected[i].id, |
| | | name: typeof selected[i].name != "undefined" ? selected[i].name : "", |
| | | phone: typeof selected[i].phone != "undefined" ? selected[i].phone : "", |
| | | sex: typeof selected[i].sex != "undefined" ? selected[i].sex : "", |
| | | age:typeof selected[i].age != "undefined" ? selected[i].age : "", |
| | | }) |
| | | } |
| | | } |
| | | window.parent.WorldCupGameStatisticsListInfo.selecUserOpt(arr); |
| | | TStoreProvince.storeOfClosePage(); |
| | | } |
| | | TStoreProvince.saveSelectStores1 = function (){ |
| | | var selected = $('#' + this.id).bootstrapTable('getSelections'); |
| | | if (selected.length == 0) { |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return false; |
| | | } |
| | | var arr = []; |
| | | var name =''; |
| | | for(var i in selected){ |
| | | if(typeof selected[i].id != "undefined"){ |
| | | name = selected[0].accountName |
| | | arr.push({ |
| | | id: selected[i].id, |
| | | name: typeof selected[i].name != "undefined" ? selected[i].name : "", |
| | | phone: typeof selected[i].phone != "undefined" ? selected[i].phone : "", |
| | | sex: typeof selected[i].sex != "undefined" ? selected[i].sex : "", |
| | | age:typeof selected[i].age != "undefined" ? selected[i].age : "", |
| | | }) |
| | | } |
| | | } |
| | | window.parent.WorldCupGameStatisticsListInfo.selecUserOpt1(arr); |
| | | TStoreProvince.storeOfClosePage(); |
| | | } |
| | | |
| | | |
| | | TStoreProvince.storeOfClosePage = function (){ |
| | | parent.layer.close(parent.layer.getFrameIndex(window.frameElement.id)); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 查询列表 |
| | | */ |
| | | TStoreProvince.search = function () { |
| | | var queryData = {}; |
| | | queryData['provinceId'] = $("#province").val(); |
| | | queryData['cityId'] = $("#city").val(); |
| | | queryData['operatorId'] = $("#account").val(); |
| | | queryData['storeName'] = $("#storeName").val(); |
| | | TStoreProvince.table.refresh({query: queryData}); |
| | | }; |
| | | |
| | | |
| | | /** |
| | | * 重置搜索 |
| | | */ |
| | | TStoreProvince.resetSearch = function () { |
| | | $("#province").val('') |
| | | $("#city").val('') |
| | | $("#storeName").val('') |
| | | TStoreProvince.search(); |
| | | }; |
| | | |
| | | function queryProvince(){ |
| | | // 发送AJAX请求到后台获取省份数据 |
| | | // 假设后台返回的数据格式为一个包含省份ID和名称的数组 |
| | | var provinceSelect = document.getElementById("province"); |
| | | |
| | | var ajax = new $ax(Feng.ctxPath + "/tCouponManage/getProvince", function(data){ |
| | | data.forEach(province => { |
| | | var option = document.createElement("option"); |
| | | option.value = province.code; // 根据你的数据结构确定省份的id字段 |
| | | option.text = province.name; // 根据你的数据结构确定省份的name字段 |
| | | provinceSelect.appendChild(option); |
| | | }); |
| | | },function(data){ |
| | | Feng.error("下拉失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.start(); |
| | | provinceSelect.addEventListener("change", queryCity); |
| | | } |
| | | |
| | | |
| | | // 获取城市数据 |
| | | function queryCity() { |
| | | var selectedProvinceId = this.value; // 获取选择的省份ID |
| | | // 发送AJAX请求到后台获取对应省份的城市数据 |
| | | // 假设后台返回的数据格式为一个包含城市ID和名称的数组 |
| | | |
| | | var citySelect = document.getElementById("city"); |
| | | citySelect.innerHTML = ""; |
| | | var ajax = new $ax(Feng.ctxPath + "/tCouponManage/getCity1", function(data){ |
| | | |
| | | data.forEach(province => { |
| | | var content='<option value="">选择市</option>'; |
| | | $.each(data, function(k,v) { |
| | | content += "<option value='"+v.code+"'>"+v.name+"</option>"; |
| | | }); |
| | | $("#city").empty().append(content); |
| | | |
| | | }); |
| | | },function(data){ |
| | | console.log('data:',data) |
| | | Feng.error("获取失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set('province',selectedProvinceId); |
| | | ajax.start(); |
| | | } |
| | | |
| | | $(function () { |
| | | var defaultColunms = TStoreProvince.initColumn(); |
| | | var table = new BSTable(TStoreProvince.id, "/worldCupRecords/userDetailsOfSearch?id="+$("#id").val(), defaultColunms); |
| | | table.setPaginationType("client"); |
| | | TStoreProvince.table = table.init(); |
| | | }); |
| | |
| | | {title: '参与比赛', field: 'name', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '比赛时间', field: 'startTime', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '比分', field: 'score', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '结果', field: 'matchResult', visible: true, align: 'center', valign: 'middle'} |
| | | {title: '结果', field: 'matchResult', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', |
| | | formatter:function (data, item) { |
| | | return '<a href="#" onclick="UserGameRecord.changeScore(\'' + data + '\',' + item.blue + ',' + item.red + ')" style="color:blue;">修改比分</a>'; |
| | | } |
| | | }, |
| | | ]; |
| | | }; |
| | | UserGameRecord.changeScore = function (id, blue, red) { |
| | | const str = '<div class="row">\n' + |
| | | ' <div class="form-group" style="height: 50px;">\n' + |
| | | ' <label class="col-sm-3 control-label" style="text-align: right;">蓝方得分:</label>' + |
| | | ' <div class="col-sm-8">\n' + |
| | | ' <input id="blue" class="form-control" type="number" min="0" value="' + blue + '"/>\n' + |
| | | ' </div>\n' + |
| | | ' </div>\n' + |
| | | ' <div class="form-group" style="height: 50px;">\n' + |
| | | ' <label class="col-sm-3 control-label" style="text-align: right;">红方得分:</label>' + |
| | | ' <div class="col-sm-8">\n' + |
| | | ' <input id="red" class="form-control" type="number" min="0" value="' + red + '"/>\n' + |
| | | ' </div>\n' + |
| | | ' </div>\n' + |
| | | ' </div>' |
| | | layer.open({ |
| | | type: 1 |
| | | ,title: '修改比分' |
| | | ,area: ['500px', '300px'] |
| | | ,offset: 'auto' //具体配置参考:http://www.layui.com/doc/modules/layer.html#offset |
| | | ,id: 'layerDemo' //防止重复弹出 |
| | | ,content: '<div style="padding: 20px">' + str + '</div>' |
| | | ,btnAlign: 'c' //按钮居中 |
| | | ,shade: 0.5 //不显示遮罩 |
| | | ,btn: ['确认', '关闭'] |
| | | ,yes: function (){ |
| | | let blue = $('#blue').val(); |
| | | let red = $('#red').val(); |
| | | if(null == blue || '' == blue){ |
| | | Feng.error("请填写有效的得分"); |
| | | return |
| | | } |
| | | if(null == red || '' == red){ |
| | | Feng.error("请填写有效的得分"); |
| | | return |
| | | } |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/worldCupRecords/changeScore", function (res) { |
| | | if (res.code==200){ |
| | | Feng.success("修改成功!"); |
| | | WorldCupGameStatisticsListInfo.search(); |
| | | layer.closeAll(); |
| | | }else{ |
| | | Feng.error(res.msg); |
| | | } |
| | | }, function (data) { |
| | | Feng.error("修改失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set({ |
| | | 'id': id, |
| | | 'blue': blue, |
| | | 'red': red |
| | | }); |
| | | ajax.start(); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | /** |
| | | * 检查是否选中 |
| | |
| | | seItem: null, //选中的条目 |
| | | table: null, |
| | | layerIndex: -1, |
| | | storeIds: [], |
| | | storeIds1: [], |
| | | }; |
| | | |
| | | /** |
| | | * 初始化表格的列 |
| | | */ |
| | |
| | | }); |
| | | }; |
| | | |
| | | WorldCupGameStatisticsListInfo.selecUserOpt = function (arrays){ |
| | | |
| | | //获取所有的值 |
| | | var subArr= this.storeIds; |
| | | |
| | | $(".timeClass").each(function () { |
| | | subArr.push($(this).find("input[name*='id']").val()); |
| | | }); |
| | | let size = subArr.length |
| | | console.log(size) |
| | | var str = ''; |
| | | for(var i in arrays){ |
| | | var b = true; |
| | | for(var j in subArr){ |
| | | if(arrays[i].id === Number(subArr[j])){ |
| | | b = false; |
| | | break |
| | | } |
| | | } |
| | | if(b){ |
| | | this.storeIds.push(arrays[i].id) |
| | | str += '<tr class="timeClass">' + |
| | | '<td><input type="hidden" id="id" name="id" value="'+arrays[i].id+'"><input type="hidden" id="id" name="id" value="'+arrays[i].id+'">' + arrays[i].id + '</td>' + |
| | | '<td><input type="hidden" id="name" name="name" value="'+arrays[i].name+'">' + arrays[i].name + '</td>' + |
| | | '<td><input type="hidden" id="phone" name="phone" value="'+arrays[i].phone+'">' + arrays[i].phone + |
| | | '<td><input type="hidden" id="sex" name="sex" value="'+arrays[i].sex+'">' + arrays[i].sex + |
| | | '<td><input type="hidden" id="age" name="age" value="'+arrays[i].age+'">' + arrays[i].age + |
| | | '</td><td><button onclick="deleteSub(this)">移除</button></td></tr>'; |
| | | } |
| | | } |
| | | console.log("添加门店后的场地数组和门店数组") |
| | | console.log(this.storeIds) |
| | | console.log(this.siteIds) |
| | | $("#coun").append(str); |
| | | } |
| | | WorldCupGameStatisticsListInfo.selecUserOpt1 = function (arrays){ |
| | | console.log(this.storeIds1,111) |
| | | //获取所有的值 |
| | | var subArr= this.storeIds1; |
| | | $(".timeClass1").each(function () { |
| | | subArr.push($(this).find("input[name*='id']").val()); |
| | | }); |
| | | var str = ''; |
| | | for(var i in arrays){ |
| | | var b = true; |
| | | for(var j in subArr){ |
| | | if(arrays[i].id === Number(subArr[j])){ |
| | | b = false; |
| | | break |
| | | } |
| | | } |
| | | console.log(b,3333) |
| | | if(b){ |
| | | this.storeIds1.push(arrays[i].id) |
| | | str += '<tr class="timeClass1">' + |
| | | '<td><input type="hidden" id="id" name="id" value="'+arrays[i].id+'"><input type="hidden" id="id" name="id" value="'+arrays[i].id+'">' + arrays[i].id + '</td>' + |
| | | '<td><input type="hidden" id="name" name="name" value="'+arrays[i].name+'">' + arrays[i].name + '</td>' + |
| | | '<td><input type="hidden" id="phone" name="phone" value="'+arrays[i].phone+'">' + arrays[i].phone + |
| | | '<td><input type="hidden" id="sex" name="sex" value="'+arrays[i].sex+'">' + arrays[i].sex + |
| | | '<td><input type="hidden" id="age" name="age" value="'+arrays[i].age+'">' + arrays[i].age + |
| | | '</td><td><button onclick="deleteSub1(this)">移除</button></td></tr>'; |
| | | } |
| | | } |
| | | console.log("添加门店后的场地数组和门店数组") |
| | | console.log(this.storeIds1) |
| | | $("#coun1").append(str); |
| | | } |
| | | function deleteSub(e) { |
| | | console.log(e); |
| | | var row = $(e).closest('tr'); |
| | | var value = row.find('#id').val(); |
| | | WorldCupGameStatisticsListInfo.storeIds.splice(WorldCupGameStatisticsListInfo.storeIds.indexOf(parseInt(value)), 1) |
| | | $(e).parent().parent().remove(); |
| | | console.log('storeIds',WorldCupGameStatisticsListInfo.storeIds) |
| | | } |
| | | function deleteSub1(e) { |
| | | console.log(e); |
| | | var row = $(e).closest('tr'); |
| | | var value = row.find('#id').val(); |
| | | WorldCupGameStatisticsListInfo.storeIds1.splice(WorldCupGameStatisticsListInfo.storeIds1.indexOf(parseInt(value)), 1) |
| | | $(e).parent().parent().remove(); |
| | | console.log('storeIds',WorldCupGameStatisticsListInfo.storeIds1) |
| | | } |
| | | |
| | | /** |
| | | * 关闭此对话框 |
| | |
| | | WorldCupGameStatisticsListInfo.close = function() { |
| | | parent.layer.close(window.parent.WorldCupGameStatisticsInfo.layerIndex); |
| | | }; |
| | | WorldCupGameStatisticsListInfo.close1 = function() { |
| | | // 方法1: 通过parent直接关闭 |
| | | if (window.parent && window.parent.layer) { |
| | | var index = window.parent.layer.getFrameIndex(window.name); |
| | | window.parent.layer.close(index); |
| | | } |
| | | |
| | | }; |
| | | WorldCupGameStatisticsListInfo.saveData = function() { |
| | | // 拿到timeClass中的Id |
| | | var subArr = []; |
| | | $(".timeClass").each(function () { |
| | | subArr.push($(this).find("input[name*='id']").val()); |
| | | }); |
| | | console.log(subArr) |
| | | var subArr1 = []; |
| | | $(".timeClass1").each(function () { |
| | | subArr1.push($(this).find("input[name*='id']").val()); |
| | | }); |
| | | if(subArr.length==0){ |
| | | Feng.error("请选择红方人员!"); |
| | | return; |
| | | } |
| | | |
| | | if(subArr1.length==0){ |
| | | Feng.error("请选择蓝方人员!"); |
| | | return; |
| | | } |
| | | |
| | | if(subArr.length>6){ |
| | | Feng.error("每组人员最多5人参赛"); |
| | | return; |
| | | } |
| | | if(subArr1.length>6){ |
| | | Feng.error("每组人员最多5人参赛"); |
| | | return; |
| | | } |
| | | // 判断2个数组是否有交集 |
| | | for(var i=0;i<subArr.length;i++){ |
| | | for(var j=0;j<subArr1.length;j++){ |
| | | if(subArr[i]==subArr1[j]){ |
| | | Feng.error("请勿选择相同的人员!"); |
| | | return; |
| | | } |
| | | } |
| | | } |
| | | |
| | | // subArr1 用,拼接 |
| | | var redStr = subArr.join(","); |
| | | var blueStr = subArr1.join(","); |
| | | |
| | | |
| | | |
| | | // 取比赛时间 |
| | | var time = $("#time").val(); |
| | | if(time==null||time==""){ |
| | | Feng.error("请选择比赛时间!"); |
| | | return; |
| | | } |
| | | |
| | | // 取比分 |
| | | var blueScore = $("#blueScore").val(); |
| | | if(blueScore==null||blueScore==""){ |
| | | Feng.error("请填写蓝方比分!"); |
| | | return; |
| | | } |
| | | var redScore = $("#redScore").val(); |
| | | if(redScore==null||redScore==""){ |
| | | Feng.error("请填写红方比分!"); |
| | | return; |
| | | } |
| | | |
| | | //提交信息 |
| | | var ajax = new $ax(Feng.ctxPath + "/worldCupRecords/savaData1", function(data){ |
| | | Feng.success("保存成功!"); |
| | | window.parent.TVerified.table.refresh(); |
| | | TVerifiedInfoDlg.close(); |
| | | },function(data){ |
| | | Feng.error("保存失败!" + data.responseJSON.message + "!"); |
| | | }); |
| | | ajax.set({ |
| | | 'id': $("#id").val(), |
| | | 'redStr': redStr, |
| | | 'blueStr': blueStr, |
| | | 'time': time, |
| | | 'blueScore': blueScore, |
| | | 'redScore': redScore, |
| | | }); |
| | | ajax.start(); |
| | | |
| | | |
| | | }; |
| | | |
| | | WorldCupGameStatisticsListInfo.search = function () { |
| | | var queryData = {}; |
| | |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | /** |
| | | * 新增赛事记录 |
| | | * @returns {boolean} |
| | | */ |
| | | WorldCupRecords.addWorldCupRecordsInfo = function (){ |
| | | var selected = $('#WorldCupRecordsTable2').bootstrapTable('getSelections'); |
| | | if(selected.length == 0){ |
| | | Feng.info("请先选中表格中的某一记录!"); |
| | | return false; |
| | | } |
| | | let seItem2 = selected[0]; |
| | | var index = layer.open({ |
| | | type: 2, |
| | | title: '添加赛事记录', |
| | | area: ['100%', '100%'], //宽高 |
| | | fix: false, //不固定 |
| | | maxmin: true, |
| | | content: Feng.ctxPath + '/worldCupRecords/addWorldCupGameStatisticsInfo?id=' + seItem2.id |
| | | }); |
| | | this.layerIndex = index; |
| | | } |
| | | |
| | | WorldCupRecords.openUserGameRecord = function (){ |
| | | var index = layer.open({ |
| | |
| | | var queryData = {}; |
| | | queryData['province'] = $("#province").val(); |
| | | queryData['city'] =$("#city").val(); |
| | | queryData['time'] =$("#time").val(); |
| | | WorldCupRecords.table1.refresh({query: queryData}); |
| | | }; |
| | | |
| | | WorldCupRecords.resetSearch1 = function () { |
| | | $("#province").val(""); |
| | | $("#city").val(""); |
| | | $("#time").val(""); |
| | | WorldCupRecords.search1(); |
| | | }; |
| | | |