From eadc1f646e81e8ffbe940b13163aee9d107d6663 Mon Sep 17 00:00:00 2001 From: 44323 <443237572@qq.com> Date: 星期三, 13 三月 2024 09:03:32 +0800 Subject: [PATCH] Merge branch '2.0' of http://120.76.84.145:10101/gitblit/r/java/PlayPai into 2.0 --- cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupCompetitorService.java | 8 cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupMapper.xml | 2 cloud-server-competition/src/main/java/com/dsh/competition/model/AddParticipant.java | 2 cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_edit.html | 2 cloud-server-competition/src/main/java/com/dsh/competition/controller/ParticipantController.java | 4 cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/WorldCupRecordsController.java | 4 cloud-server-account/src/main/java/com/dsh/account/feignclient/communityWorldCup/WorldCupPaymentClinet.java | 26 ++ cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java | 15 cloud-server-competition/src/main/java/com/dsh/competition/service/impl/ParticipantServiceImpl.java | 14 + cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/RefereeController.java | 8 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/competition/model/Participant.java | 4 cloud-server-competition/src/main/java/com/dsh/competition/service/IParticipantService.java | 2 cloud-server-other/src/main/java/com/dsh/other/model/StoreConfigVo.java | 2 cloud-server-management/src/main/java/com/dsh/course/feignClient/account/RefereeClient.java | 9 + cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java | 35 +++ cloud-server-account/src/main/java/com/dsh/account/model/WorldCupPayment.java | 82 +++++++++ cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js | 22 ++ cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java | 37 ++- cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_add.html | 2 cloud-server-management/src/main/webapp/static/modular/system/worldCupRecords/worldCupGameStatisticsInfo.js | 2 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/GetWorldCupPayment.java | 32 +++ cloud-server-management/src/main/webapp/static/modular/system/worldCup/registeredPersonnel.js | 2 cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCupRecords/worldCupGameStatisticsListInfo.html | 3 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java | 17 + cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java | 12 + cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCupRecords/worldCupRecords.html | 2 cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/WorldCupClient.java | 8 cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/WorldCupController.java | 5 cloud-server-account/src/main/java/com/dsh/account/enums/RechargeRecordEnum.java | 2 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentServiceImpl.java | 4 cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java | 1 cloud-server-competition/src/main/java/com/dsh/competition/entity/Participant.java | 5 cloud-server-management/src/main/webapp/static/modular/system/worldCupRecords/worldCupRecords.js | 9 cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml | 16 + cloud-server-account/src/main/java/com/dsh/account/feignclient/communityWorldCup/model/GetWorldCupPayment.java | 32 +++ cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup.js | 2 cloud-server-management/src/main/webapp/static/modular/system/worldCupRecords/worldCupGameStatisticsListInfo.js | 13 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupCompetitorMapper.java | 8 cloud-server-account/src/main/java/com/dsh/account/controller/RefereeController.java | 15 + cloud-server-account/src/main/java/com/dsh/account/service/impl/RechargeRecordsServiceImpl.java | 33 +++ cloud-server-other/src/main/java/com/dsh/other/controller/StoreConfigController.java | 16 + 41 files changed, 453 insertions(+), 66 deletions(-) diff --git a/cloud-server-account/src/main/java/com/dsh/account/controller/RefereeController.java b/cloud-server-account/src/main/java/com/dsh/account/controller/RefereeController.java index 7f90a0c..c80395f 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/controller/RefereeController.java +++ b/cloud-server-account/src/main/java/com/dsh/account/controller/RefereeController.java @@ -1,5 +1,6 @@ package com.dsh.account.controller; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.dsh.account.entity.Referee; import com.dsh.account.model.RefereeList; @@ -60,6 +61,20 @@ public Referee getRefereeById(@RequestBody Integer id){ return refereeService.getById(id); } + + + /** + * 根据电话号码查询 + * @param phone + * @return + */ + @PostMapping("/referee/getRefereeByPhone") + public Referee getRefereeByPhone(String phone){ + return refereeService.getOne(new QueryWrapper<Referee>() + .eq("phone", phone).ne("state", 3)); + } + + /** diff --git a/cloud-server-account/src/main/java/com/dsh/account/enums/RechargeRecordEnum.java b/cloud-server-account/src/main/java/com/dsh/account/enums/RechargeRecordEnum.java index 3f58465..04e21e2 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/enums/RechargeRecordEnum.java +++ b/cloud-server-account/src/main/java/com/dsh/account/enums/RechargeRecordEnum.java @@ -11,6 +11,8 @@ EVENT_REGISTRATION("赛事报名"), CANCEL_EVENT_REGISTRATION("取消赛事报名"), CANCEL_VENUE_RESERVATION("取消场地预约"), + WORLD_CIP_PAYMENT("世界杯报名"), + CANCEL_WORLD_CIP_PAYMENT("取消世界杯报名"), ; diff --git a/cloud-server-account/src/main/java/com/dsh/account/feignclient/communityWorldCup/WorldCupPaymentClinet.java b/cloud-server-account/src/main/java/com/dsh/account/feignclient/communityWorldCup/WorldCupPaymentClinet.java new file mode 100644 index 0000000..7a42a07 --- /dev/null +++ b/cloud-server-account/src/main/java/com/dsh/account/feignclient/communityWorldCup/WorldCupPaymentClinet.java @@ -0,0 +1,26 @@ +package com.dsh.account.feignclient.communityWorldCup; + +import com.dsh.account.feignclient.communityWorldCup.model.GetWorldCupPayment; +import com.dsh.account.model.WorldCupPayment; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; + +import java.util.List; +import java.util.Map; + +/** + * @author zhibing.pu + * @date 2024/3/12 17:47 + */ +@FeignClient("mb-cloud-communityWorldCup") +public interface WorldCupPaymentClinet { + + + /** + * 获取世界杯报名列表 + * @param getWorldCupPayment + * @return + */ + @PostMapping("/worldCup/getWorldCupPayment") + List<WorldCupPayment> getWorldCupPayment(GetWorldCupPayment getWorldCupPayment); +} diff --git a/cloud-server-account/src/main/java/com/dsh/account/feignclient/communityWorldCup/model/GetWorldCupPayment.java b/cloud-server-account/src/main/java/com/dsh/account/feignclient/communityWorldCup/model/GetWorldCupPayment.java new file mode 100644 index 0000000..850275a --- /dev/null +++ b/cloud-server-account/src/main/java/com/dsh/account/feignclient/communityWorldCup/model/GetWorldCupPayment.java @@ -0,0 +1,32 @@ +package com.dsh.account.feignclient.communityWorldCup.model; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +/** + * @author zhibing.pu + * @date 2024/3/12 17:51 + */ +@Data +public class GetWorldCupPayment { + /** + * 用户id + */ + private Integer appUserId; + /** + * 支付方式(0=免费,1=微信,2=支付宝,3=玩湃币,4=课时) + */ + private Integer payType; + /** + * 开始时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date startTime; + /** + * 结束时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date endTime; +} diff --git a/cloud-server-account/src/main/java/com/dsh/account/model/WorldCupPayment.java b/cloud-server-account/src/main/java/com/dsh/account/model/WorldCupPayment.java new file mode 100644 index 0000000..463be68 --- /dev/null +++ b/cloud-server-account/src/main/java/com/dsh/account/model/WorldCupPayment.java @@ -0,0 +1,82 @@ +package com.dsh.account.model; + +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableId; +import com.baomidou.mybatisplus.annotation.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * @author zhibing.pu + * @Date 2024/2/22 14:15 + */ +@Data +public class WorldCupPayment { + /** + * 主键 + */ + private Long id; + /** + * 支付流水号 + */ + private String code; + /** + * 世界杯id + */ + private Integer worldCupId; + /** + * 用户id + */ + private Integer appUserId; + /** + * 支付方式(0=免费,1=微信,2=支付宝,3=玩湃币,4=课时) + */ + private Integer payType; + /** + * 支付单价 + */ + private BigDecimal unitPrice; + /** + * 支付金额 + */ + private BigDecimal amount; + /** + * 支付状态(1=待支付,2=已支付,3=已退款) + */ + private Integer payStatus; + /** + * 支付时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date payTime; + /** + * 第三方支付流水号 + */ + private String payOrderNo; + /** + * 退款时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date refundTime; + /** + * 第三方退款流水号 + */ + private String refundOrderNo; + /** + * 状态(1=正常,2=冻结,3=删除) + */ + private Integer state; + /** + * 添加时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date createTime; + /** + * 参赛人数据 + */ + private String entrant; +} diff --git a/cloud-server-account/src/main/java/com/dsh/account/service/impl/RechargeRecordsServiceImpl.java b/cloud-server-account/src/main/java/com/dsh/account/service/impl/RechargeRecordsServiceImpl.java index ca8c34c..8989a5c 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/service/impl/RechargeRecordsServiceImpl.java +++ b/cloud-server-account/src/main/java/com/dsh/account/service/impl/RechargeRecordsServiceImpl.java @@ -7,6 +7,8 @@ import com.dsh.account.entity.TAppUser; import com.dsh.account.entity.VipPayment; import com.dsh.account.enums.RechargeRecordEnum; +import com.dsh.account.feignclient.communityWorldCup.WorldCupPaymentClinet; +import com.dsh.account.feignclient.communityWorldCup.model.GetWorldCupPayment; import com.dsh.account.feignclient.competition.DeductionCompetitionsClient; import com.dsh.account.feignclient.competition.model.PaymentCompetition; import com.dsh.account.feignclient.course.CoursePaymentClient; @@ -18,6 +20,7 @@ import com.dsh.account.mapper.RechargeRecordsMapper; import com.dsh.account.mapper.TAppUserMapper; import com.dsh.account.model.IncomeQuery; +import com.dsh.account.model.WorldCupPayment; import com.dsh.account.model.query.RechargeRecordsQuery; import com.dsh.account.model.vo.RechargeRecordsVO; import com.dsh.account.model.vo.userBenefitDetail.RechargeDetailsVo; @@ -73,8 +76,11 @@ @Resource private RechargeConfigClient reconMapper; - @Autowired + @Resource private RechargeRecordsMapper rechargeRecordsMapper; + + @Resource + private WorldCupPaymentClinet worldCupPaymentClinet; @Override @@ -195,6 +201,31 @@ details.add(consumeDetail); } } + + //世界杯 + GetWorldCupPayment getWorldCupPayment = new GetWorldCupPayment(); + getWorldCupPayment.setAppUserId(appUserId); + getWorldCupPayment.setPayType(3); + getWorldCupPayment.setStartTime(monthStart); + getWorldCupPayment.setEndTime(monthEnd); + List<WorldCupPayment> worldCupPayment = worldCupPaymentClinet.getWorldCupPayment(getWorldCupPayment); + for (WorldCupPayment cupPayment : worldCupPayment) { + RechargesDetail consumeDetail = new RechargesDetail(); + if(cupPayment.getPayStatus() != 3){ + consumeDetail.setConsumeName(RechargeRecordEnum.WORLD_CIP_PAYMENT.getMsg() + ":¥" + cupPayment.getAmount()); + consumeDetail.setConsumeTime(simpleDateFormat.format(cupPayment.getCreateTime())); + consumeDetail.setConsumeAmount("-" + cupPayment.getAmount()); + consumeDetail.setRecordId(2); + }else{ + consumeDetail.setConsumeName(RechargeRecordEnum.CANCEL_WORLD_CIP_PAYMENT.getMsg() + ":¥" + cupPayment.getAmount()); + consumeDetail.setConsumeTime(simpleDateFormat.format(cupPayment.getCreateTime())); + consumeDetail.setConsumeAmount("+" + cupPayment.getAmount()); + consumeDetail.setRecordId(1); + } + details.add(consumeDetail); + } + + if (ToolUtil.isNotEmpty(recordId)) { details = details.stream() .filter(record -> record.getRecordId().equals(recordId)) diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java b/cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java index 01f71db..d3c2feb 100644 --- a/cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java +++ b/cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java @@ -97,10 +97,16 @@ @Resource private CouponCityService cityService; - @Autowired + @Resource private AppUserClient appUserClient; - @Autowired + + @Resource private StudentClient studentClient; + + + + + /** * 查询注册赠送优惠券 判断当前优惠券限领数量 @@ -227,7 +233,7 @@ @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) - public ResultUtil<List<CouponPackageResp>> queryAppuserCouponList(CouponPackageReq req) { + public ResultUtil<List<CouponPackageResp>> queryCouponPackage(CouponPackageReq req) { try { Integer uid = tokenUtil.getUserIdFormRedis(); if (null == uid) { diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java b/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java index 97c1da0..ccf26b4 100644 --- a/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java +++ b/cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java @@ -1547,6 +1547,7 @@ List<Map<String, Object>> mapList = new ArrayList<>(); LambdaQueryWrapper<UserPointsMerchandise> userPointsMerchandiseLambdaQueryWrapper = new LambdaQueryWrapper<>(); userPointsMerchandiseLambdaQueryWrapper.eq(UserPointsMerchandise::getPointsMerchandiseId, pointMercharsPayedVo.getId()); + userPointsMerchandiseLambdaQueryWrapper.eq(UserPointsMerchandise::getPayStatus, 2).eq(UserPointsMerchandise::getState, 1); if (ToolUtil.isNotEmpty(pointMercharsPayedVo.getStatus())) { userPointsMerchandiseLambdaQueryWrapper.eq(UserPointsMerchandise::getStatus, pointMercharsPayedVo.getStatus()); } diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java index 223f489..9681a55 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java @@ -195,7 +195,7 @@ Participant participant = participantClient.getParticipant(worldCupPaymentParticipant.getParticipantId()); worldCupPeopleVo.setName(participant.getName()); worldCupPeopleVo.setAge(null == participant.getBirthday() ? 0 : Integer.valueOf(sdf.format(new Date())) -Integer.valueOf(sdf.format(participant.getBirthday()))); - worldCupPeopleVo.setAvatar(appUser.getHeadImg()); + worldCupPeopleVo.setAvatar(participant.getHeadImg()); worldCupPeopleVo.setParticipantType(2); } return ResultUtil.success(worldCupPeopleVo); @@ -831,4 +831,37 @@ public Map<String, Object> userGameRecordList(@RequestBody UserGameRecordList userGameRecordList){ return worldCupCompetitorService.userGameRecordList(userGameRecordList); } + + + /** + * 获取已报名人数 + * @param worldCupId + * @return + */ + @ResponseBody + @PostMapping("/worldCup/getRegisteredNumber") + public int getRegisteredNumber(@RequestBody Integer worldCupId){ + List<WorldCupPayment> list = worldCupPaymentService.list(new QueryWrapper<WorldCupPayment>().eq("worldCupId", worldCupId) + .eq("payStatus", 2).eq("state", 1)); + List<Long> collect = list.stream().map(WorldCupPayment::getId).collect(Collectors.toList()); + if(collect.size() == 0){ + return 0; + } + return worldCupPaymentParticipantService.getCount(worldCupId, collect); + } + + + /** + * 获取支付记录 + * @param getWorldCupPayment + * @return + */ + @ResponseBody + @PostMapping("/worldCup/getWorldCupPayment") + public List<WorldCupPayment> getWorldCupPayment(@RequestBody GetWorldCupPayment getWorldCupPayment){ + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return worldCupPaymentService.list(new QueryWrapper<WorldCupPayment>().eq("appUserId", getWorldCupPayment.getAppUserId()) + .eq("payType", getWorldCupPayment.getPayType()).ne("payStatus", 1).eq("state", 1) + .last(" and createTime between '" + sdf.format(getWorldCupPayment.getStartTime()) + "' and '" + sdf.format(getWorldCupPayment.getEndTime()) + "' order by createTime desc")); + } } diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/competition/model/Participant.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/competition/model/Participant.java index 3955cd7..4b990a8 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/competition/model/Participant.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/feignclient/competition/model/Participant.java @@ -24,6 +24,10 @@ */ private String name; /** + * 头像 + */ + private String headImg; + /** * 生日 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupCompetitorMapper.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupCompetitorMapper.java index bcd630c..bff89ff 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupCompetitorMapper.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupCompetitorMapper.java @@ -67,4 +67,12 @@ Map<String, Object> getUserGameRecordList(@Param("participantType") Integer participantType, @Param("participantId") Long participantId); + + + /** + * 获取比赛场次 + * @param worldCupId + * @return + */ + int getMatchTime(@Param("worldCupId") Integer worldCupId); } diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/GetWorldCupPayment.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/GetWorldCupPayment.java new file mode 100644 index 0000000..bcf957b --- /dev/null +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/GetWorldCupPayment.java @@ -0,0 +1,32 @@ +package com.dsh.communityWorldCup.model; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +/** + * @author zhibing.pu + * @date 2024/3/12 17:51 + */ +@Data +public class GetWorldCupPayment { + /** + * 用户id + */ + private Integer appUserId; + /** + * 支付方式(0=免费,1=微信,2=支付宝,3=玩湃币,4=课时) + */ + private Integer payType; + /** + * 开始时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date startTime; + /** + * 结束时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date endTime; +} diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupCompetitorService.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupCompetitorService.java index e8d7e7b..9df5d3f 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupCompetitorService.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupCompetitorService.java @@ -84,4 +84,12 @@ * @return */ Map<String, Object> userGameRecordList(UserGameRecordList userGameRecordList); + + + /** + * 获取比赛场次 + * @param worldCupId + * @return + */ + int getMatchTime(Integer worldCupId); } diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java index 109a553..08d83a7 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java @@ -81,7 +81,7 @@ for (int i = 0; i < mapList.size(); i++) { Map<String, Object> map = mapList.get(i); Integer participantType = Integer.valueOf(map.get("participantType").toString()); - Integer participantId = Integer.valueOf(map.get("participantId").toString()); + Long participantId = Long.valueOf(map.get("participantId").toString()); Integer num = Integer.valueOf(map.get("num").toString()); if(null != participantId && participantId.equals(entrantRank.getId()) && participantType.equals(entrantRank.getIsStudent())){ entrantRankVo.setNationalRank(i + 1); @@ -101,7 +101,7 @@ for (int i = 0; i < mapList1.size(); i++) { Map<String, Object> map = mapList1.get(i); Integer participantType = Integer.valueOf(map.get("participantType").toString()); - Integer participantId = Integer.valueOf(map.get("participantId").toString()); + Long participantId = Long.valueOf(map.get("participantId").toString()); Integer num = Integer.valueOf(map.get("num").toString()); if(null != participantId && participantId.equals(entrantRank.getId()) && participantType.equals(entrantRank.getIsStudent())){ entrantRankVo.setCityRank(i + 1); @@ -145,7 +145,7 @@ matchRecord.setPageNo(pageNo); MatchRecordVo matchRecordVo = new MatchRecordVo(); int count = this.count(new QueryWrapper<WorldCupCompetitor>().eq("participantId", matchRecord.getId()) - .eq("participantType", matchRecord.getIsStudent())); + .eq("participantType", matchRecord.getIsStudent()).isNotNull("matchResult")); matchRecordVo.setTotalSession(count); List<MatchRecordList> matchRecord1 = this.baseMapper.getMatchRecord(matchRecord); matchRecordVo.setList(matchRecord1); @@ -196,9 +196,8 @@ } //参赛人员 if(participantType == 2){ - AppUser appUser1 = appUserClient.getAppUser(appUserId); Participant participant = participantClient.getParticipant(participantId); - worldCupRankVo.setAvatar(appUser1.getHeadImg()); + worldCupRankVo.setAvatar(participant.getHeadImg()); String name = participant.getName(); if(name.length() > 2){ name = name.charAt(0) + "*" + name.substring(2); @@ -242,9 +241,8 @@ } //参赛人员 if(participantType == 2){ - AppUser appUser1 = appUserClient.getAppUser(appUserId); Participant participant = participantClient.getParticipant(participantId); - worldCupRankVo.setAvatar(appUser1.getHeadImg()); + worldCupRankVo.setAvatar(participant.getHeadImg()); String name = participant.getName(); if(name.length() > 2){ name = name.charAt(0) + "*" + name.substring(2); @@ -398,7 +396,7 @@ if(ToolUtil.isNotEmpty(name) && tStudent.getName().indexOf(name) == -1){ continue; } - if(ToolUtil.isNotEmpty(phone) && tStudent.getPhone().indexOf(phone) == -1){ + if(ToolUtil.isNotEmpty(phone) && (ToolUtil.isEmpty(tStudent.getPhone()) ? appUser.getPhone() : tStudent.getPhone()).indexOf(phone) == -1){ continue; } if(ToolUtil.isNotEmpty(idcard) && tStudent.getIdCard().indexOf(idcard) == -1){ @@ -407,12 +405,13 @@ map.put("name", tStudent.getName()); map.put("phone", ToolUtil.isEmpty(tStudent.getPhone()) ? appUser.getPhone() : tStudent.getPhone()); + map.put("idcard", tStudent.getIdCard()); }else{ Participant participant = participantClient.getParticipant(participantId); if(ToolUtil.isNotEmpty(name) && participant.getName().indexOf(name) == -1){ continue; } - if(ToolUtil.isNotEmpty(phone) && participant.getPhone().indexOf(phone) == -1){ + if(ToolUtil.isNotEmpty(phone) && (ToolUtil.isNotEmpty(participant.getPhone()) ? participant.getPhone() : appUser.getPhone()).indexOf(phone) == -1){ continue; } if(ToolUtil.isNotEmpty(idcard) && participant.getIdcard().indexOf(idcard) == -1){ @@ -421,14 +420,15 @@ map.put("name", participant.getName()); map.put("phone", ToolUtil.isNotEmpty(participant.getPhone()) ? participant.getPhone() : appUser.getPhone()); + map.put("idcard", participant.getIdcard()); } list.add(map); } - map1.put("total", mapList.size()); + map1.put("total", list.size()); Integer offset = worldCupGameStatisticsInfoList.getOffset(); Integer limit = worldCupGameStatisticsInfoList.getLimit(); limit += offset; - map1.put("rows", mapList.subList(offset, mapList.size() >= limit ? limit : mapList.size())); + map1.put("rows", list.subList(offset, list.size() >= limit ? limit : list.size())); return map1; } @@ -607,9 +607,7 @@ } map.put("userName", participant.getName()); } - map.put("score", ourScore.compareTo(opponentScore) > 0 ? - ourScore + ":" + opponentScore : - opponentScore + ":" + ourScore); + map.put("score", ourScore + ":" + opponentScore); map.put("matchResult", matchResult == 1 ? "胜" : matchResult == 0 ? "平" :"负"); mapList.add(map); } @@ -621,4 +619,15 @@ map.put("rows", mapList.subList(offset, mapList.size() >= limit ? limit : mapList.size())); return map; } + + + /** + * 获取比赛场次 + * @param worldCupId + * @return + */ + @Override + public int getMatchTime(Integer worldCupId) { + return this.baseMapper.getMatchTime(worldCupId); + } } diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java index 2e4f746..5b6298e 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentParticipantServiceImpl.java @@ -245,7 +245,7 @@ Participant participant = participantClient.getParticipant(participantId); participantVo.setId(participant.getId()); participantVo.setName(participant.getName()); - participantVo.setAvatar(appUser.getHeadImg()); + participantVo.setAvatar(participant.getHeadImg()); int age = Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(participant.getBirthday())); participantVo.setAge(age); participantVo.setIdcard(participant.getIdcard()); @@ -296,12 +296,13 @@ for (WorldCupPaymentParticipant on : list1) { WorldCupPayment worldCupPayment = worldCupPaymentService.getById(on.getWorldCupPaymentId()); Map<String, Object> map1 = new HashMap<>(); + AppUser appUser = appUserClient.getAppUser(on.getAppUserId()); if(on.getParticipantType() == 1){ TStudent tStudent = studentClient.queryById(on.getParticipantId().intValue()); if(ToolUtil.isNotEmpty(name) && tStudent.getName().indexOf(name) == -1){ continue; } - if(ToolUtil.isNotEmpty(phone) && tStudent.getPhone().indexOf(phone) == -1){ + if(ToolUtil.isNotEmpty(phone) && (ToolUtil.isEmpty(tStudent.getPhone()) ? appUser.getPhone() : tStudent.getPhone()).indexOf(phone) == -1){ continue; } if(ToolUtil.isNotEmpty(idcode) && tStudent.getIdCard().indexOf(idcode) == -1){ @@ -312,7 +313,7 @@ map1.put("name", tStudent.getName()); map1.put("gender", tStudent.getSex() == 1 ? "男" : "女"); map1.put("age", Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(tStudent.getBirthday()))); - map1.put("phone", tStudent.getPhone()); + map1.put("phone", ToolUtil.isEmpty(tStudent.getPhone()) ? appUser.getPhone() : tStudent.getPhone()); map1.put("idcard", tStudent.getIdCard()); map1.put("state", worldCupPayment.getPayStatus() - 1); }else{ @@ -320,7 +321,7 @@ if(ToolUtil.isNotEmpty(name) && participant.getName().indexOf(name) == -1){ continue; } - if(ToolUtil.isNotEmpty(phone) && participant.getPhone().indexOf(phone) == -1){ + if(ToolUtil.isNotEmpty(phone) && (ToolUtil.isNotEmpty(participant.getPhone()) ? participant.getPhone() : appUser.getPhone()).indexOf(phone) == -1){ continue; } if(ToolUtil.isNotEmpty(idcode) && participant.getIdcard().indexOf(idcode) == -1){ @@ -331,7 +332,7 @@ map1.put("name", participant.getName()); map1.put("gender", participant.getGender() == 1 ? "男" : "女"); map1.put("age", Integer.valueOf(sdf.format(new Date())) - Integer.valueOf(sdf.format(participant.getBirthday()))); - map1.put("phone", participant.getPhone()); + map1.put("phone", ToolUtil.isNotEmpty(participant.getPhone()) ? participant.getPhone() : appUser.getPhone()); map1.put("idcard", participant.getIdcard()); map1.put("state", worldCupPayment.getPayStatus() - 1); } @@ -391,7 +392,7 @@ if(ToolUtil.isNotEmpty(name) && tStudent.getName().indexOf(name) == -1){ continue; } - if(ToolUtil.isNotEmpty(phone) && tStudent.getPhone().indexOf(phone) == -1){ + if(ToolUtil.isNotEmpty(phone) && (ToolUtil.isEmpty(tStudent.getPhone()) ? appUser.getPhone() : tStudent.getPhone()).indexOf(phone) == -1){ continue; } if(ToolUtil.isNotEmpty(idcard) && tStudent.getIdCard().indexOf(idcard) == -1){ @@ -406,7 +407,7 @@ if(ToolUtil.isNotEmpty(name) && participant.getName().indexOf(name) == -1){ continue; } - if(ToolUtil.isNotEmpty(phone) && participant.getPhone().indexOf(phone) == -1){ + if(ToolUtil.isNotEmpty(phone) && (ToolUtil.isNotEmpty(participant.getPhone()) ? participant.getPhone() : appUser.getPhone()).indexOf(phone) == -1){ continue; } if(ToolUtil.isNotEmpty(idcard) && participant.getIdcard().indexOf(idcard) == -1){ diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentServiceImpl.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentServiceImpl.java index 8789d3c..02622b7 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentServiceImpl.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentServiceImpl.java @@ -70,6 +70,7 @@ //开始处理退款 //免费 if(worldCupPayment.getPayType() == 0){ + worldCupPayment.setWorldCupId(null); worldCupPayment.setRefundOrderNo(""); worldCupPayment.setRefundTime(new Date()); worldCupPayment.setPayStatus(3); @@ -99,6 +100,7 @@ } if("10000".equals(map.get("code"))){ String trade_no = map.get("trade_no"); + worldCupPayment.setWorldCupId(null); worldCupPayment.setRefundTime(new Date()); worldCupPayment.setRefundOrderNo(trade_no); worldCupPayment.setPayStatus(3); @@ -111,6 +113,7 @@ AppUser appUser = appUserClient.getAppUser(appUserId); appUser.setPlayPaiCoins(appUser.getPlayPaiCoins() + multiply.intValue()); appUserClient.updateAppUser(appUser); + worldCupPayment.setWorldCupId(null); worldCupPayment.setRefundTime(new Date()); worldCupPayment.setRefundOrderNo(""); worldCupPayment.setPayStatus(3); @@ -123,6 +126,7 @@ DeductionClassHourList deductionClassHourList = JSON.parseObject(content, DeductionClassHourList.class); coursePackageOrderStudentClient.backspaceClassHour(deductionClassHourList); } + worldCupPayment.setWorldCupId(null); worldCupPayment.setRefundTime(new Date()); worldCupPayment.setRefundOrderNo(""); worldCupPayment.setPayStatus(3); diff --git a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java index 9c71445..dfb6c24 100644 --- a/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java +++ b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java @@ -132,6 +132,9 @@ String people = startWorldCup.getPeople(); JSONArray jsonArray = JSON.parseArray(people); + if(jsonArray.size() != 6){ + return ResultUtil.error("参赛人数只能是6人"); + } String timeStr = UUIDUtil.getTimeStr() + UUIDUtil.getNumberRandom(3); List<Long> ids = new ArrayList<>(); for (int i = 0; i < jsonArray.size(); i++) { @@ -165,6 +168,9 @@ // worldCupPaymentParticipant.setAlreadyEntered(1); // worldCupPaymentParticipantService.updateById(worldCupPaymentParticipant); } + worldCup.setMatchNumber(worldCup.getMatchNumber() + 1); + this.updateById(worldCup); + //2、调起开启游戏的接口。 HashMap<String, String> map = new HashMap<>(); map.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); @@ -249,7 +255,7 @@ Collections.sort(worldCupList1, new Comparator<WorldCupListVo>() { @Override public int compare(WorldCupListVo o1, WorldCupListVo o2) { - return o1.getDistance().compareTo(o2.getDistance()) * -1; + return o1.getDistance().compareTo(o2.getDistance()); } }); } @@ -397,7 +403,7 @@ if(ids.size() > 0){ int count = worldCupPaymentParticipantService.count(new QueryWrapper<WorldCupPaymentParticipant>().eq("worldCupId", worldCup.getId()) .eq("worldCupPaymentId", ids)); - if((count + jsonArray.size()) >= worldCup.getMatchNumber()){ + if((count + jsonArray.size()) >= worldCup.getMaxPeople()){ return ResultUtil.error("已超出最大报名人数"); } } @@ -516,6 +522,7 @@ appUser.setPlayPaiCoins(appUser.getPlayPaiCoins() - multiply.intValue()); appUserClient.updateAppUser(appUser); + // //添加报名明细 String ids = paymentWorldCup.getIds(); @@ -737,6 +744,7 @@ BigDecimal multiply = worldCupPayment.getUnitPrice().multiply(new BigDecimal(list1.size())); //免费 if(worldCupPayment.getPayType() == 0){ + worldCupPayment.setWorldCupId(null); worldCupPayment.setRefundOrderNo(""); worldCupPayment.setRefundTime(new Date()); worldCupPayment.setPayStatus(3); @@ -761,6 +769,7 @@ } if("10000".equals(map.get("code"))){ String trade_no = map.get("trade_no"); + worldCupPayment.setWorldCupId(null); worldCupPayment.setRefundTime(new Date()); worldCupPayment.setRefundOrderNo(trade_no); worldCupPayment.setPayStatus(3); @@ -773,6 +782,7 @@ AppUser appUser = appUserClient.getAppUser(appUserId); appUser.setPlayPaiCoins(appUser.getPlayPaiCoins() + multiply.intValue()); appUserClient.updateAppUser(appUser); + worldCupPayment.setWorldCupId(null); worldCupPayment.setRefundTime(new Date()); worldCupPayment.setRefundOrderNo(""); worldCupPayment.setPayStatus(3); @@ -785,6 +795,7 @@ DeductionClassHourList deductionClassHourList = JSON.parseObject(content, DeductionClassHourList.class); coursePackageOrderStudentClient.backspaceClassHour(deductionClassHourList); } + worldCupPayment.setWorldCupId(null); worldCupPayment.setRefundTime(new Date()); worldCupPayment.setRefundOrderNo(""); worldCupPayment.setPayStatus(3); @@ -827,7 +838,7 @@ List<Map<String, Object>> mapList = this.baseMapper.worldCupGameStatistics(worldCupGameStatistics); for (Map<String, Object> stringObjectMap : mapList) { Integer id = Integer.valueOf(stringObjectMap.get("id").toString()); - int count = worldCupCompetitorService.count(new QueryWrapper<WorldCupCompetitor>().eq("worldCupId", id)); + int count = worldCupCompetitorService.getMatchTime(id); stringObjectMap.put("matchTime", count); List<WorldCupPayment> list = worldCupPaymentService.list(new QueryWrapper<WorldCupPayment>().eq("worldCupId", id) diff --git a/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml b/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml index f8ecc06..b5d3acb 100644 --- a/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml +++ b/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml @@ -13,7 +13,7 @@ participantId, count(*) as num from t_world_cup_competitor - where DATE_FORMAT(NOW(), '%Y-%m-%d') = DATE_FORMAT(startTime, '%Y-%m-%d') + where matchResult is not null and DATE_FORMAT(NOW(), '%Y') = DATE_FORMAT(startTime, '%Y') <if test="null != appUserIds and appUserIds.size() > 0"> and appUserId in <foreach collection="appUserIds" item="item" index="index" open="(" separator="," close=")"> @@ -21,7 +21,7 @@ </foreach> </if> group by participantType, participantId - ) as aa order by aa.num desc + ) as aa order by aa.num desc,aa.participantId </select> @@ -36,7 +36,7 @@ (a.participationIntegral + a.winIntegral) as award from t_world_cup_competitor a left join t_world_cup b on (a.worldCupId = b.id) - where a.participantId = #{item.id} and a.participantType = #{item.isStudent} + where a.matchResult is not null and a.participantId = #{item.id} and a.participantType = #{item.isStudent} order by a.startTime desc limit #{item.pageNo}, #{item.pageSize} </select> @@ -97,10 +97,10 @@ ) as b on (a.participantId = b.participantId and a.participantType = b.participantType) ) as aa <if test="null != item.sort and item.sort == 1"> - order by aa.totalSession desc + order by aa.totalSession desc,aa.participantId </if> <if test="null != item.sort and item.sort == 2"> - order by aa.winRate desc + order by aa.winRate desc,aa.participantId </if> </select> @@ -279,4 +279,10 @@ group by participantType, participantId, appUserId ) as b on (a.participantId = b.participantId and a.participantType = b.participantType) </select> + + + + <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> </mapper> \ No newline at end of file diff --git a/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupMapper.xml b/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupMapper.xml index ce40991..e12f737 100644 --- a/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupMapper.xml +++ b/cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupMapper.xml @@ -41,7 +41,7 @@ and a.name like CONCAT('%', #{item.content}, '%') </if> <if test="null != item.storeId"> - and a.id in (select worldCupId from t_world_cup_store where storeId = #{item.storeId} and isOpen = 1) + and a.id in (select worldCupId from t_world_cup_store where storeId = #{item.storeId}) </if> <if test="null != item.gender"> and #{item.gender} = a.gender diff --git a/cloud-server-competition/src/main/java/com/dsh/competition/controller/ParticipantController.java b/cloud-server-competition/src/main/java/com/dsh/competition/controller/ParticipantController.java index d307cec..fdb397d 100644 --- a/cloud-server-competition/src/main/java/com/dsh/competition/controller/ParticipantController.java +++ b/cloud-server-competition/src/main/java/com/dsh/competition/controller/ParticipantController.java @@ -169,13 +169,13 @@ @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) - public ResultUtil delParticipant(Integer id) { + public ResultUtil delParticipant(Integer id, Integer isStudent) { try { Integer uid = tokenUtil.getUserIdFormRedis(); if (null == uid) { return ResultUtil.tokenErr(); } - return participantService.delParticipant(id); + return participantService.delParticipant(id, isStudent); } catch (Exception e) { e.printStackTrace(); return ResultUtil.runErr(); diff --git a/cloud-server-competition/src/main/java/com/dsh/competition/entity/Participant.java b/cloud-server-competition/src/main/java/com/dsh/competition/entity/Participant.java index 6c8515b..9b7674f 100644 --- a/cloud-server-competition/src/main/java/com/dsh/competition/entity/Participant.java +++ b/cloud-server-competition/src/main/java/com/dsh/competition/entity/Participant.java @@ -31,6 +31,11 @@ @TableField("name") private String name; /** + * 头像 + */ + @TableField("headImg") + private String headImg; + /** * 生日 */ @TableField("birthday") diff --git a/cloud-server-competition/src/main/java/com/dsh/competition/model/AddParticipant.java b/cloud-server-competition/src/main/java/com/dsh/competition/model/AddParticipant.java index 7d067ff..d85610b 100644 --- a/cloud-server-competition/src/main/java/com/dsh/competition/model/AddParticipant.java +++ b/cloud-server-competition/src/main/java/com/dsh/competition/model/AddParticipant.java @@ -16,6 +16,8 @@ public class AddParticipant { @ApiModelProperty(value = "姓名", dataType = "string", required = true) private String name; + @ApiModelProperty(value = "头像", dataType = "string", required = true) + private String headImg; @ApiModelProperty(value = "生日", dataType = "string", required = true) private String birthday; @ApiModelProperty(value = "性别(1=男,2=女)", dataType = "int", required = true) diff --git a/cloud-server-competition/src/main/java/com/dsh/competition/service/IParticipantService.java b/cloud-server-competition/src/main/java/com/dsh/competition/service/IParticipantService.java index 1ec4802..2594c9b 100644 --- a/cloud-server-competition/src/main/java/com/dsh/competition/service/IParticipantService.java +++ b/cloud-server-competition/src/main/java/com/dsh/competition/service/IParticipantService.java @@ -57,7 +57,7 @@ * @return * @throws Exception */ - ResultUtil delParticipant(Integer id) throws Exception; + ResultUtil delParticipant(Integer id, Integer isStudent) throws Exception; /** diff --git a/cloud-server-competition/src/main/java/com/dsh/competition/service/impl/ParticipantServiceImpl.java b/cloud-server-competition/src/main/java/com/dsh/competition/service/impl/ParticipantServiceImpl.java index ae7c729..ac2c755 100644 --- a/cloud-server-competition/src/main/java/com/dsh/competition/service/impl/ParticipantServiceImpl.java +++ b/cloud-server-competition/src/main/java/com/dsh/competition/service/impl/ParticipantServiceImpl.java @@ -230,10 +230,16 @@ * @throws Exception */ @Override - public ResultUtil delParticipant(Integer id) throws Exception { - Participant participant = this.getById(id); - participant.setState(3); - this.updateById(participant); + public ResultUtil delParticipant(Integer id, Integer isStudent) throws Exception { + if(isStudent == 1){ + TStudent tStudent = studentClient.queryById(id); + tStudent.setState(3); + studentClient.updateAppUser(tStudent); + }else{ + Participant participant = this.getById(id); + participant.setState(3); + this.updateById(participant); + } return ResultUtil.success(); } diff --git a/cloud-server-management/src/main/java/com/dsh/course/feignClient/account/RefereeClient.java b/cloud-server-management/src/main/java/com/dsh/course/feignClient/account/RefereeClient.java index ee55510..064d082 100644 --- a/cloud-server-management/src/main/java/com/dsh/course/feignClient/account/RefereeClient.java +++ b/cloud-server-management/src/main/java/com/dsh/course/feignClient/account/RefereeClient.java @@ -39,6 +39,15 @@ */ @PostMapping("/referee/getRefereeById") Referee getRefereeById(Integer id); + + + /** + * 根据电话号码查询 + * @param phone + * @return + */ + @PostMapping("/referee/getRefereeByPhone") + Referee getRefereeByPhone(String phone); /** diff --git a/cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/WorldCupClient.java b/cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/WorldCupClient.java index 73913f5..59dbee3 100644 --- a/cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/WorldCupClient.java +++ b/cloud-server-management/src/main/java/com/dsh/course/feignClient/communityWorldCup/WorldCupClient.java @@ -121,4 +121,12 @@ */ @PostMapping("/worldCup/userGameRecordList") Map<String, Object> userGameRecordList(UserGameRecordList userGameRecordList); + + /** + * 获取已报名人数 + * @param id + * @return + */ + @PostMapping("/worldCup/getRegisteredNumber") + int getRegisteredNumber(Integer worldCupId); } diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/RefereeController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/RefereeController.java index feaf9b9..627a049 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/RefereeController.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/RefereeController.java @@ -64,6 +64,10 @@ @ResponseBody @PostMapping("/addReferee") public ResultUtil addReferee(Referee referee){ + Referee refereeByPhone = refereeClient.getRefereeByPhone(referee.getPhone()); + if(null != refereeByPhone){ + return ResultUtil.error("电话号码已使用"); + } Region region = regionService.getOne(new QueryWrapper<Region>().eq("code", referee.getProvinceCode())); referee.setProvince(region.getName()); region = regionService.getOne(new QueryWrapper<Region>().eq("code", referee.getCityCode())); @@ -101,6 +105,10 @@ @ResponseBody @PostMapping("/editReferee") public ResultUtil editReferee(Referee referee){ + Referee refereeByPhone = refereeClient.getRefereeByPhone(referee.getPhone()); + if(null != refereeByPhone && !referee.getId().equals(refereeByPhone.getId())){ + return ResultUtil.error("电话号码已使用"); + } Region region = regionService.getOne(new QueryWrapper<Region>().eq("code", referee.getProvinceCode())); referee.setProvince(region.getName()); region = regionService.getOne(new QueryWrapper<Region>().eq("code", referee.getCityCode())); diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/WorldCupController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/WorldCupController.java index 4249541..44a299b 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/WorldCupController.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/WorldCupController.java @@ -199,6 +199,11 @@ if(worldCup1.getStartTime().before(DateUtil.getDate())){ return ResultUtil.error("赛事已开始,不能编辑"); } + Integer maxPeople = worldCup1.getMaxPeople(); + int registeredNumber = worldCupClient.getRegisteredNumber(worldCup.getId()); + if(maxPeople.compareTo(registeredNumber) < 0){ + return ResultUtil.error("报名人数不能小于已报名人数"); + } if(worldCup.getStartTime().before(new Date())){ worldCup.setStatus(2); }else{ diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/WorldCupRecordsController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/WorldCupRecordsController.java index e05d6f7..81b90f0 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/WorldCupRecordsController.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/WorldCupRecordsController.java @@ -136,7 +136,7 @@ public void exportUserStatistics(WorldCupGameStatisticsInfoList worldCupGameStatisticsInfoList, HttpServletResponse response){ worldCupGameStatisticsInfoList.setOffset(0); worldCupGameStatisticsInfoList.setLimit(100000); - Map<String, Object> map = worldCupClient.worldCupGameStatisticsInfoList(worldCupGameStatisticsInfoList); + Map<String, Object> map = worldCupClient.getUserGameRecordList(worldCupGameStatisticsInfoList); List<Map<String, Object>> list = (List<Map<String, Object>>)map.get("rows"); try { @@ -151,7 +151,7 @@ values[i] = new String[title.length]; values[i][0] = d.get("name").toString(); values[i][1] = d.get("phone").toString(); - values[i][2] = d.get("idcard").toString(); + values[i][2] = null == d.get("idcard") ? "" : d.get("idcard").toString(); values[i][3] = d.get("totalSession").toString(); values[i][4] = d.get("win").toString() + "-" + d.get("lose").toString(); values[i][5] = d.get("winRate").toString() + "%"; diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_add.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_add.html index 77042f5..b48de0b 100644 --- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_add.html +++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_add.html @@ -222,8 +222,8 @@ </div> </div> </div> -<script src="${ctxPath}/modular/system/worldCup/worldCup_info.js"></script> <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.4.15&key=77b37f0753049c4e712ea79a24e0719c"></script> +<script src="${ctxPath}/modular/system/worldCup/worldCup_info.js"></script> <script src="${ctxPath}/js/vue/vue.js"></script> <script src="${ctxPath}/js/elementui/index.js"></script> <link rel="stylesheet" href="${ctxPath}/js/elementui/index.css"> diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_edit.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_edit.html index 8e90c3d..7ed7d81 100644 --- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_edit.html +++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCup/worldCup_edit.html @@ -224,8 +224,8 @@ </div> </div> </div> -<script src="${ctxPath}/modular/system/worldCup/worldCup_info.js"></script> <script type="text/javascript" src="http://webapi.amap.com/maps?v=1.4.15&key=77b37f0753049c4e712ea79a24e0719c"></script> +<script src="${ctxPath}/modular/system/worldCup/worldCup_info.js"></script> <script src="${ctxPath}/js/vue/vue.js"></script> <script src="${ctxPath}/js/elementui/index.js"></script> <link rel="stylesheet" href="${ctxPath}/js/elementui/index.css"> diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCupRecords/worldCupGameStatisticsListInfo.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCupRecords/worldCupGameStatisticsListInfo.html index 4102ebb..1016a58 100644 --- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCupRecords/worldCupGameStatisticsListInfo.html +++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCupRecords/worldCupGameStatisticsListInfo.html @@ -19,9 +19,6 @@ <#button name="重置" icon="fa-trash" clickFun="WorldCupGameStatisticsListInfo.resetSearch()" space="true"/> </div> </div> - <div class="hidden-xs" id="WorldCupGameStatisticsListInfoTableToolbar" role="group"> - <#button name="比赛详情" icon="fa-plus" clickFun="WorldCupGameStatisticsListInfo.openWorldCupGameStatisticsListInfo()"/> - </div> <#table id="WorldCupGameStatisticsListInfoTable"/> </div> </div> diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCupRecords/worldCupRecords.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCupRecords/worldCupRecords.html index 4a699c8..aff7a6e 100644 --- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCupRecords/worldCupRecords.html +++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/worldCupRecords/worldCupRecords.html @@ -53,7 +53,7 @@ <div class="panel-body"> <div class="row"> <div class="col-sm-3"> - <#NameCon id="name" name="用户姓名:" /> + <#NameCon id="userName" name="用户姓名:" /> </div> <div class="col-sm-3"> <#NameCon id="phone" name="联系电话:" /> diff --git a/cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js b/cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js index 610e32b..f91fb27 100644 --- a/cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js +++ b/cloud-server-management/src/main/webapp/static/modular/system/referee/referee.js @@ -60,7 +60,7 @@ ' <div class="form-group" >\n' + ' <label class="col-sm-3 control-label">*手机号:</label>\n' + ' <div class="col-sm-9">\n' + - ' <input class="form-control" id="addPhone" placeholder="请输入">' + + ' <input class="form-control" id="addPhone" type="text" placeholder="请输入" maxlength="11">' + ' </div>\n' + ' </div>\n' + ' <div class="form-group" >\n' + @@ -95,6 +95,15 @@ } if(null == addPhone || '' == addPhone){ Feng.info("手机号不能为空"); + return + } + //定义正则表达式 + var reg='^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-9])|(18[0-9])|166|198|199|191|(147))\\d{8}$'; + //创建正则表达式对象 + var regExp=new RegExp(reg); + //使用test()函数验证数据是否匹配正则表达式,匹配返回true,否则返回false + if (!regExp.test(addPhone)) { + Feng.info("手机号格式不正确"); return } if(null == addProvince || '' == addProvince){ @@ -154,7 +163,7 @@ ' <div class="form-group" >\n' + ' <label class="col-sm-3 control-label">*手机号:</label>\n' + ' <div class="col-sm-9">\n' + - ' <input class="form-control" id="addPhone" placeholder="请输入">' + + ' <input class="form-control" id="addPhone" type="text" placeholder="请输入" maxlength="11"/>' + ' </div>\n' + ' </div>\n' + ' <div class="form-group" >\n' + @@ -192,6 +201,15 @@ Feng.info("手机号不能为空"); return } + //定义正则表达式 + var reg='^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-9])|(18[0-9])|166|198|199|191|(147))\\d{8}$'; + //创建正则表达式对象 + var regExp=new RegExp(reg); + //使用test()函数验证数据是否匹配正则表达式,匹配返回true,否则返回false + if (!regExp.test(addPhone)) { + Feng.info("手机号格式不正确"); + return + } if (null == addProvince || '' == addProvince) { Feng.info("请选择所在省"); return diff --git a/cloud-server-management/src/main/webapp/static/modular/system/worldCup/registeredPersonnel.js b/cloud-server-management/src/main/webapp/static/modular/system/worldCup/registeredPersonnel.js index c9f7d6f..3266ae7 100644 --- a/cloud-server-management/src/main/webapp/static/modular/system/worldCup/registeredPersonnel.js +++ b/cloud-server-management/src/main/webapp/static/modular/system/worldCup/registeredPersonnel.js @@ -21,7 +21,7 @@ {title: '身份证号', field: 'idcard', visible: true, align: 'center', valign: 'middle'}, {title: '二维码', field: '', visible: true, align: 'center', valign: 'middle', formatter:function (data, item) { - return '<a href="#" onclick="RegisteredPersonnel.openQRCode(' + item.id + ', ' + item.isStudent + ',\'' + item.name + '\')">二维码</a>' + return '<a href="#" onclick="RegisteredPersonnel.openQRCode(' + item.id + ', ' + item.isStudent + ',\'' + item.name + '\')" style="color:blue;">查看</a>' } }, {title: '状态', field: 'state', visible: true, align: 'center', valign: 'middle', diff --git a/cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup.js b/cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup.js index 9d178fe..28a0bda 100644 --- a/cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup.js +++ b/cloud-server-management/src/main/webapp/static/modular/system/worldCup/worldCup.js @@ -13,7 +13,7 @@ WorldCup.initColumn = function () { return [ {field: 'selectItem', checkbox: true}, - {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'}, + {title: 'id', field: 'id', visible: true, align: 'center', valign: 'middle'}, {title: '比赛名称', field: 'name', visible: true, align: 'center', valign: 'middle',width:'20%',}, {title: '开始时间', field: 'startTime', visible: true, align: 'center', valign: 'middle',}, {title: '结束时间', field: 'endTime', visible: true, align: 'center', valign: 'middle'}, diff --git a/cloud-server-management/src/main/webapp/static/modular/system/worldCupRecords/worldCupGameStatisticsInfo.js b/cloud-server-management/src/main/webapp/static/modular/system/worldCupRecords/worldCupGameStatisticsInfo.js index 31f09e9..90e1abf 100644 --- a/cloud-server-management/src/main/webapp/static/modular/system/worldCupRecords/worldCupGameStatisticsInfo.js +++ b/cloud-server-management/src/main/webapp/static/modular/system/worldCupRecords/worldCupGameStatisticsInfo.js @@ -16,7 +16,7 @@ {title: 'id', field: 'id', visible: false, align: 'center', valign: 'middle'}, {title: '用户姓名', field: 'name', visible: true, align: 'center', valign: 'middle',}, {title: '联系电话', field: 'phone', visible: true, align: 'center', valign: 'middle'}, - {title: '所在城市', field: 'province', visible: true, align: 'center', valign: 'middle'}, + {title: '身份证号', field: 'idcard', visible: true, align: 'center', valign: 'middle'}, {title: '已比赛场次', field: 'totalSession', visible: true, align: 'center', valign: 'middle'}, {title: '胜-负场次', field: 'win', visible: true, align: 'center', valign: 'middle', formatter:function (data, item) { diff --git a/cloud-server-management/src/main/webapp/static/modular/system/worldCupRecords/worldCupGameStatisticsListInfo.js b/cloud-server-management/src/main/webapp/static/modular/system/worldCupRecords/worldCupGameStatisticsListInfo.js index 812cae9..9926e20 100644 --- a/cloud-server-management/src/main/webapp/static/modular/system/worldCupRecords/worldCupGameStatisticsListInfo.js +++ b/cloud-server-management/src/main/webapp/static/modular/system/worldCupRecords/worldCupGameStatisticsListInfo.js @@ -20,7 +20,7 @@ {title: '结果', field: 'matchResult', visible: true, align: 'center', valign: 'middle'}, {title: '操作', field: 'id', visible: true, align: 'center', valign: 'middle', formatter:function (data) { - return '<a href="#" onclick="WorldCupGameStatisticsListInfo.changeScore(\'' + data + '\')">修改比分</a>'; + return '<a href="#" onclick="WorldCupGameStatisticsListInfo.changeScore(\'' + data + '\')" style="color:blue;">修改比分</a>'; } }, ]; @@ -45,27 +45,28 @@ WorldCupGameStatisticsListInfo.changeScore = function (id) { const str = '<div class="row">\n' + ' <div class="form-group" style="height: 50px;">\n' + - ' <label class="col-sm-3 control-label">蓝方得分:</label>' + + ' <label class="col-sm-3 control-label" style="text-align: right;">蓝方得分:</label>' + ' <div class="col-sm-8">\n' + - ' <input id="blue" type="number" min="0"/>\n' + + ' <input id="blue" class="form-control" type="number" min="0"/>\n' + ' </div>\n' + ' </div>\n' + ' <div class="form-group" style="height: 50px;">\n' + - ' <label class="col-sm-3 control-label">红方得分:</label>' + + ' <label class="col-sm-3 control-label" style="text-align: right;">红方得分:</label>' + ' <div class="col-sm-8">\n' + - ' <input id="red" type="number" min="0"/>\n' + + ' <input id="red" class="form-control" type="number" min="0"/>\n' + ' </div>\n' + ' </div>\n' + ' </div>' layer.open({ type: 1 ,title: '修改比分' - ,area: ['500px', '400px'] + ,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(); diff --git a/cloud-server-management/src/main/webapp/static/modular/system/worldCupRecords/worldCupRecords.js b/cloud-server-management/src/main/webapp/static/modular/system/worldCupRecords/worldCupRecords.js index 2ec1f9e..f2b5ab1 100644 --- a/cloud-server-management/src/main/webapp/static/modular/system/worldCupRecords/worldCupRecords.js +++ b/cloud-server-management/src/main/webapp/static/modular/system/worldCupRecords/worldCupRecords.js @@ -59,7 +59,7 @@ WorldCupRecords.exportUserStatistics = function (){ let phone = $("#phone").val(); - let name =$("#name").val(); + let name =$("#userName").val(); let idcard =$("#idcard").val(); window.location.href = Feng.ctxPath + '/worldCupRecords/exportUserStatistics?phone=' + phone + "&name=" + name + "&idcard=" + idcard } @@ -100,14 +100,15 @@ WorldCupRecords.search3 = function () { var queryData = {}; queryData['phone'] = $("#phone").val(); - queryData['name'] =$("#name").val(); + queryData['name'] =$("#userName").val(); queryData['idcard'] =$("#idcard").val(); WorldCupRecords.table3.refresh({query: queryData}); }; WorldCupRecords.resetSearch3 = function () { - $("#province").val(""); - $("#city").val(""); + $("#phone").val(""); + $("#userName").val(""); + $("#idcard").val(""); WorldCupRecords.search3(); }; diff --git a/cloud-server-other/src/main/java/com/dsh/other/controller/StoreConfigController.java b/cloud-server-other/src/main/java/com/dsh/other/controller/StoreConfigController.java index 46adbc8..c809190 100644 --- a/cloud-server-other/src/main/java/com/dsh/other/controller/StoreConfigController.java +++ b/cloud-server-other/src/main/java/com/dsh/other/controller/StoreConfigController.java @@ -9,6 +9,7 @@ import com.dsh.other.service.IHomeModuleService; import com.dsh.other.service.StoreConfigService; import com.dsh.other.util.ResultUtil; +import com.dsh.other.util.ToolUtil; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; @@ -65,12 +66,14 @@ StoreConfigVo vo = new StoreConfigVo(); vo.setType(0); vo.setIsOpen(homeModule.getIsOpen()); + vo.setIsTop(homeModule.getIsTop()); vo.setSort(homeModule.getSort()); vo.setBackgroundImage(homeModule.getBackgroundImage()); listVo.add(vo); } for (StoreConfig storeConfig : list) { StoreConfigVo storeConfigVo = new StoreConfigVo(); + storeConfigVo.setIsTop(0); BeanUtils.copyProperties(storeConfig, storeConfigVo); if (!StringUtils.hasLength(storeConfig.getBackgroundImage())) { switch (storeConfigVo.getType()) { @@ -116,8 +119,9 @@ List<WorldCupStore> worldCupStoreList = worldCupStoreClient.getWorldCupStoreList(storeId); for (WorldCupStore worldCupStore : worldCupStoreList) { StoreConfigVo storeConfigVo = new StoreConfigVo(); + storeConfigVo.setIsTop(0); storeConfigVo.setId(worldCupStore.getWorldCupId()); - storeConfigVo.setBackgroundImage(worldCupStore.getBackgroundImage()); + storeConfigVo.setBackgroundImage(ToolUtil.isNotEmpty(worldCupStore.getBackgroundImage()) ? worldCupStore.getBackgroundImage() : "https://we-park-life.oss-cn-beijing.aliyuncs.com/img/760934115ff6468591ed51f0d760a989.jpg"); storeConfigVo.setType(9); storeConfigVo.setIsOpen(worldCupStore.getIsOpen()); storeConfigVo.setSort(worldCupStore.getSort()); @@ -132,6 +136,16 @@ return o1.getSort().compareTo(o2.getSort()); } }); + //排序 + Collections.sort(listVo, new Comparator<StoreConfigVo>() { + @Override + public int compare(StoreConfigVo o1, StoreConfigVo o2) { + return o1.getIsTop().compareTo(o2.getIsTop()) * -1; + } + }); + for (int i = 0; i < listVo.size(); i++) { + listVo.get(i).setSort(i + 1); + } return ResultUtil.success(listVo); } catch (Exception e) { e.printStackTrace(); diff --git a/cloud-server-other/src/main/java/com/dsh/other/model/StoreConfigVo.java b/cloud-server-other/src/main/java/com/dsh/other/model/StoreConfigVo.java index f12b4de..1377caf 100644 --- a/cloud-server-other/src/main/java/com/dsh/other/model/StoreConfigVo.java +++ b/cloud-server-other/src/main/java/com/dsh/other/model/StoreConfigVo.java @@ -15,6 +15,8 @@ private Integer type; @ApiModelProperty("是否开启(0=否,1=是)") private Integer isOpen; + @ApiModelProperty("置顶(0=否,1=是)") + private Integer isTop; @ApiModelProperty("排序") private Integer sort; @ApiModelProperty("背景图") -- Gitblit v1.7.1