From 7cd3dea07f5b7cefad9dea9fd7daf992449aaac8 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期二, 12 三月 2024 18:24:38 +0800 Subject: [PATCH] 修改bug --- cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupCompetitorService.java | 8 + cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java | 13 + cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java | 12 + cloud-server-competition/src/main/java/com/dsh/competition/model/AddParticipant.java | 2 cloud-server-competition/src/main/java/com/dsh/competition/controller/ParticipantController.java | 4 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-account/src/main/java/com/dsh/account/feignclient/communityWorldCup/WorldCupPaymentClinet.java | 26 +++ cloud-server-competition/src/main/java/com/dsh/competition/entity/Participant.java | 5 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-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-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-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java | 17 ++ cloud-server-account/src/main/java/com/dsh/account/model/WorldCupPayment.java | 82 +++++++++++ cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java | 33 +++- cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/mapper/WorldCupCompetitorMapper.java | 8 + cloud-server-account/src/main/java/com/dsh/account/service/impl/RechargeRecordsServiceImpl.java | 33 ++++ cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/GetWorldCupPayment.java | 32 ++++ cloud-server-other/src/main/java/com/dsh/other/controller/StoreConfigController.java | 16 ++ 23 files changed, 341 insertions(+), 41 deletions(-) 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-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java b/cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java index ffb7485..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); @@ -849,4 +849,19 @@ } 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 c4d585a..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 @@ -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 1348a56..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++) { @@ -394,9 +397,6 @@ String cupIds = paymentWorldCup.getIds(); JSONArray jsonArray = JSON.parseArray(cupIds); - if(jsonArray.size() != 6){ - return ResultUtil.error("参赛人数只能是6人"); - } List<WorldCupPayment> payments = worldCupPaymentService.list(new QueryWrapper<WorldCupPayment>().eq("worldCupId", worldCup.getId()) .eq("payStatus", 2).eq("state", 1)); List<Long> ids = payments.stream().map(WorldCupPayment::getId).collect(Collectors.toList()); @@ -522,6 +522,7 @@ appUser.setPlayPaiCoins(appUser.getPlayPaiCoins() - multiply.intValue()); appUserClient.updateAppUser(appUser); + // //添加报名明细 String ids = paymentWorldCup.getIds(); @@ -743,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); @@ -767,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); @@ -779,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); @@ -791,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); @@ -833,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 84f6154..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') = DATE_FORMAT(startTime, '%Y') + 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-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-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