| | |
| | | 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; |
| | | } |
| | |
| | | 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.dsh.communityWorldCup.entity.*; |
| | | import com.dsh.communityWorldCup.feignclient.account.AppUserClient; |
| | |
| | | import java.io.PrintWriter; |
| | | import java.nio.charset.StandardCharsets; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil endWorldCup(StartWorldCup startWorldCup){ |
| | | return worldCupService.startWorldCup(startWorldCup); |
| | | public ResultUtil endWorldCup(String custom, Integer redScore, Integer blueScore){ |
| | | return worldCupService.endWorldCup(custom,redScore,blueScore); |
| | | } |
| | | |
| | | |
| | |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") |
| | | }) |
| | | public ResultUtil<List<WorldCupListVo>> getWorldCupListFromRank(){ |
| | | public ResultUtil<List<WorldCupListVo>> getWorldCupListFromRank(MyWorldCupList myWorldCupList){ |
| | | try { |
| | | Integer uid = tokenUtil.getUserIdFormRedis(); |
| | | if(null == uid){ |
| | | return ResultUtil.tokenErr(); |
| | | } |
| | | List<WorldCupListVo> worldCupRank1 = worldCupCompetitorService.getWorldCupListFromRank(uid); |
| | | 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; |
| | | } |
| | | } |
| | |
| | | |
| | | 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=世界杯获胜 9平场世界杯 10败场世界杯) |
| | | * 积分类型(1=赠送积分,2=兑换商品,3=完成课后练习,4=观看教学视频,6=参与世界杯,7=世界杯获胜 8该份 9平场世界杯 10败场世界杯) |
| | | */ |
| | | private Integer type; |
| | | /** |
| | |
| | | */ |
| | | int getMatchTime(@Param("worldCupId") Integer worldCupId); |
| | | |
| | | List<WorldCupListVo> getWorldCupListFromRank(@Param("uid") Integer uid); |
| | | List<WorldCupListVo> getWorldCupListFromRank(@Param("item")MyWorldCupList myWorldCupList); |
| | | |
| | | |
| | | } |
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 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 code; |
| | | @ApiModelProperty("开始时间") |
| | | private Date startTime; |
| | | |
| | | @ApiModelProperty("自定义信息 结束接口需要") |
| | | private List<Long> customs; |
| | | } |
| | |
| | | private String lon; |
| | | private String lat; |
| | | private Double distance; |
| | | @ApiModelProperty("1智慧赛事 2非智慧赛事") |
| | | private Integer type; |
| | | private Integer nowNum=0; |
| | | } |
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; |
| | | |
| | | |
| | | } |
| | |
| | | int getMatchTime(Integer worldCupId); |
| | | |
| | | |
| | | List<WorldCupListVo> getWorldCupListFromRank(Integer uid); |
| | | 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; |
| | |
| | | .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.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()); |
| | |
| | | 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); |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<WorldCupListVo> getWorldCupListFromRank(Integer uid) { |
| | | public List<WorldCupListVo> getWorldCupListFromRank(MyWorldCupList myWorldCupList) { |
| | | |
| | | return this.baseMapper.getWorldCupListFromRank(uid); |
| | | 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) |
| | | .ge(WorldCupCompetitor::getStartTime, new Date()).lt(WorldCupCompetitor::getEndTime, new Date())); |
| | | List<WorldCupCodeListVo> worldCupCodeListVos = new ArrayList<>(); |
| | | |
| | | // worldCupCompetitors 通过code分组 |
| | | Map<String, List<WorldCupCompetitor>> map = worldCupCompetitors.stream().collect(Collectors.groupingBy(WorldCupCompetitor::getCode)); |
| | | |
| | | for (Map.Entry<String, List<WorldCupCompetitor>> entry : map.entrySet()) { |
| | | WorldCupCodeListVo worldCupCodeListVo = new WorldCupCodeListVo(); |
| | | String code = entry.getKey(); |
| | | List<WorldCupCompetitor> value = entry.getValue(); |
| | | worldCupCodeListVo.setCode(code); |
| | | worldCupCodeListVo.setStartTime(value.get(0).getStartTime()); |
| | | worldCupCodeListVo.setWorldCupId(value.get(0).getWorldCupId()); |
| | | List<Long> collect = value.stream().map(WorldCupCompetitor::getId).collect(Collectors.toList()); |
| | | worldCupCodeListVo.setCustoms(collect); |
| | | worldCupCodeListVos.add(worldCupCodeListVo); |
| | | } |
| | | return worldCupCodeListVos; |
| | | } |
| | | } |
| | |
| | | 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()) |
| | | .ge(WorldCupCompetitor::getStartTime, new Date()).lt(WorldCupCompetitor::getEndTime, new Date()).groupBy(WorldCupCompetitor::getCode)).size(); |
| | | worldCupListCoachVo.setNowNum(size); |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |
| | | //对查询结果进行距离排序(直线距离) |
| | | Collections.sort(worldCupListCoach1, new Comparator<WorldCupListCoachVo>() { |
| | | @Override |
| | |
| | | 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()); |
| | | 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(); |
| | | } |
| | | } |
| | |
| | | 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="getWorldCupListFromRank" resultType="com.dsh.communityWorldCup.model.WorldCupListVo"> |
| | | select |
| | | c.id, |
| | | b.worldCupId, |
| | | c.name |
| | | 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.appUserId = #{uid} and b.payStatus = 2 and b.refundTime is null and b.state = 1 |
| | | 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"> |
| | |
| | | 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); |
| | | |
| | | } |
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; |
| | |
| | | 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 + "worldCupGameStatisticsInfo.html"; |
| | | 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"; |
| | | } |
| | | |
| | | |
| | |
| | | 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); |
| | | } |
| | | } |
| | |
| | | |
| | | 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; |
| | | // |
| | | // } |
| | | |
| | | |
| | | |
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="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 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>人员</td> |
| | | <td>联系电话</td> |
| | | <td>性别</td> |
| | | <td>年龄</td> |
| | | <td>操作</td> |
| | | </tr> |
| | | </thead> |
| | | <tbody id="coun"></tbody> |
| | | </table> |
| | | </div> |
| | | </div> |
| | | |
| | | </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' |
| | | }); |
| | | |
| | | |
| | | 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; |
| | | } |
| | | </script> |
| | | @} |
| | |
| | | </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> |
| | |
| | | $("#coun").append(str); |
| | | } |
| | | TGoodsInfoDlg.selecUserOpt1 = function (arr){ |
| | | console.log(arr) |
| | | console.log("返回的数组") |
| | | console.log("此时的site集合") |
| | | console.log(this.siteIds) |
| | | //获取所有的值 |
| | | var subArr= this.siteIds; |
| | | console.log(subArr) |
| | | $(".timeClass").each(function () { |
| | | $(".userTableOne").each(function () { |
| | | subArr.push($(this).find("input[name*='id']").val()); |
| | | }); |
| | | var str = ''; |
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: true, align: 'center', valign: 'middle'}, |
| | | {title: '所在省市', field: 'provinceCity', visible: true, align: 'center', valign: 'middle'}, |
| | | {title: '门店名称', field: 'name', 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].ids,55555) |
| | | name = selected[0].accountName |
| | | arr.push({ |
| | | id: selected[i].id, |
| | | provinceCity: typeof selected[i].provinceCity != "undefined" ? selected[i].provinceCity : "", |
| | | accountName: typeof selected[i].accountName != "undefined" ? selected[i].accountName : "", |
| | | name: typeof selected[i].name != "undefined" ? selected[i].name : "", |
| | | ids:typeof selected[i].ids != "undefined" ? selected[i].ids : "", |
| | | }) |
| | | } |
| | | } |
| | | window.parent.TGoodsInfoDlg.selecUserOpt(arr); |
| | | TStoreProvince.storeOfClosePage(); |
| | | } |
| | | |
| | | |
| | | |
| | | /** |
| | | * 查询列表 |
| | | */ |
| | | 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(); |
| | | } |
| | | }); |
| | | }; |
| | | |
| | | /** |
| | | * 检查是否选中 |
| | |
| | | }); |
| | | 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(); |
| | | }; |
| | | |