cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/controller/WorldCupController.java
@@ -395,7 +395,7 @@ public List<WorldCupStore> getWorldCupStoreList(@RequestBody Integer storeId){ List<WorldCup> worldCupList = worldCupService.list(new QueryWrapper<WorldCup>().in("status", Arrays.asList(1, 2))); List<Integer> collect = worldCupList.stream().map(WorldCup::getId).collect(Collectors.toList()); return worldCupStoreService.list(new QueryWrapper<WorldCupStore>().eq("storeId", storeId).in("worldCupId", collect)); return worldCupStoreService.list(new QueryWrapper<WorldCupStore>().eq("storeId", storeId).in("worldCupId", collect).eq("isOpen", 1)); } @@ -474,6 +474,17 @@ return ResultUtil.success(myWorldCupInfo); } @ResponseBody @PostMapping("/api/worldCup/cancelMyWorldCup") @ApiOperation(value = "取消已报名的世界杯【2.0】", tags = {"APP-个人中心"}) @ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "列表中的id", required = true, dataType = "String"), @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil cancelMyWorldCup(String id){ return worldCupPaymentService.cancelMyWorldCup(id); } @@ -497,8 +508,18 @@ @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) public ResultUtil<List<WorldCupRankVo>> getWorldCupRank(WorldCupRank worldCupRank){ List<WorldCupRankVo> worldCupRank1 = worldCupCompetitorService.getWorldCupRank(worldCupRank); return ResultUtil.success(worldCupRank1); try { Integer uid = tokenUtil.getUserIdFormRedis(); if(null == uid){ return ResultUtil.tokenErr(); } worldCupRank.setAppUserId(uid); List<WorldCupRankVo> worldCupRank1 = worldCupCompetitorService.getWorldCupRank(worldCupRank); return ResultUtil.success(worldCupRank1); }catch (Exception e){ e.printStackTrace(); return ResultUtil.runErr(); } } cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/WorldCupListVo.java
@@ -28,6 +28,8 @@ private String content; @ApiModelProperty("热度") private Integer heat; @ApiModelProperty("比赛状态(1=未开始,2=已开始,3=已结束,4=已取消)") private Integer status; private Double distance; private String lon; private String lat; cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/model/WorldCupRankVo.java
@@ -11,6 +11,8 @@ @Data @ApiModel public class WorldCupRankVo { @ApiModelProperty("排名") private Integer rank; @ApiModelProperty("姓名") private String name; @ApiModelProperty("头像") cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/IWorldCupPaymentService.java
@@ -2,10 +2,19 @@ import com.baomidou.mybatisplus.extension.service.IService; import com.dsh.communityWorldCup.entity.WorldCupPayment; import com.dsh.communityWorldCup.util.ResultUtil; /** * @author zhibing.pu * @Date 2024/2/22 14:22 */ public interface IWorldCupPaymentService extends IService<WorldCupPayment> { /** * 取消已报名的世界杯 * @param id * @return */ ResultUtil cancelMyWorldCup(String id); } cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupCompetitorServiceImpl.java
@@ -172,6 +172,7 @@ boolean b = false; if(i <= 19){ WorldCupRankVo worldCupRankVo = new WorldCupRankVo(); worldCupRankVo.setRank(i + 1); worldCupRankVo.setTotalSession(totalSession); worldCupRankVo.setWinRate(winRate); //学员 @@ -217,6 +218,7 @@ if(i > 19 && !b){ if(worldCupRank.getIsStudent().equals(participantType) && worldCupRank.getId().equals(participantId)){ WorldCupRankVo worldCupRankVo = new WorldCupRankVo(); worldCupRankVo.setRank(i + 1); worldCupRankVo.setTotalSession(totalSession); worldCupRankVo.setWinRate(winRate); //学员 cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupPaymentServiceImpl.java
@@ -1,10 +1,32 @@ package com.dsh.communityWorldCup.service.impl; import com.alibaba.fastjson.JSON; import com.alipay.api.AlipayApiException; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.dsh.communityWorldCup.entity.WorldCup; import com.dsh.communityWorldCup.entity.WorldCupPayment; import com.dsh.communityWorldCup.entity.WorldCupPaymentParticipant; import com.dsh.communityWorldCup.feignclient.account.AppUserClient; import com.dsh.communityWorldCup.feignclient.account.model.AppUser; import com.dsh.communityWorldCup.feignclient.course.CoursePackageOrderStudentClient; import com.dsh.communityWorldCup.feignclient.course.model.CoursePackageOrderStudent; import com.dsh.communityWorldCup.mapper.WorldCupPaymentMapper; import com.dsh.communityWorldCup.model.DeductionClassHourList; import com.dsh.communityWorldCup.service.IWorldCupPaymentParticipantService; import com.dsh.communityWorldCup.service.IWorldCupPaymentService; import com.dsh.communityWorldCup.service.IWorldCupService; import com.dsh.communityWorldCup.util.PayMoneyUtil; import com.dsh.communityWorldCup.util.ResultUtil; import net.bytebuddy.asm.Advice; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.math.BigDecimal; import java.util.Date; import java.util.List; import java.util.Map; /** * @author zhibing.pu @@ -12,4 +34,100 @@ */ @Service public class WorldCupPaymentServiceImpl extends ServiceImpl<WorldCupPaymentMapper, WorldCupPayment> implements IWorldCupPaymentService { @Autowired private IWorldCupPaymentParticipantService worldCupPaymentParticipantService; @Autowired private IWorldCupService worldCupService; @Autowired private PayMoneyUtil payMoneyUtil; @Resource private AppUserClient appUserClient; @Resource private CoursePackageOrderStudentClient coursePackageOrderStudentClient; /** * 取消已报名的世界杯 * @param id * @return */ @Override public ResultUtil cancelMyWorldCup(String id) { WorldCupPaymentParticipant worldCupPaymentParticipant = worldCupPaymentParticipantService.getById(id); WorldCupPayment worldCupPayment = this.getById(worldCupPaymentParticipant.getWorldCupPaymentId()); WorldCup worldCup = worldCupService.getById(worldCupPayment.getWorldCupId()); //开始前一天不能取消 if(worldCup.getStartTime().getTime() < System.currentTimeMillis() + 86400000L){ return ResultUtil.error("世界杯快开始了,不能取消"); } //开始处理退款 //免费 if(worldCupPayment.getPayType() == 0){ worldCupPayment.setRefundOrderNo(""); worldCupPayment.setRefundTime(new Date()); worldCupPayment.setPayStatus(3); this.updateById(worldCupPayment); return ResultUtil.success(); } List<WorldCupPaymentParticipant> list1 = worldCupPaymentParticipantService.list(new QueryWrapper<WorldCupPaymentParticipant>() .eq("worldCupPaymentId", worldCupPayment.getId()).eq("alreadyEntered", 0)); BigDecimal multiply = worldCupPayment.getUnitPrice().multiply(new BigDecimal(list1.size())); //微信支付 if(worldCupPayment.getPayType() == 1){ Map<String, String> map = payMoneyUtil.wxRefund(worldCupPayment.getPayOrderNo(), worldCupPayment.getCode(), worldCupPayment.getAmount().toString(), multiply.toString(), "/base/worldCup/wxRefundWorldCupCallback"); if(!"SUCCESS".equals(map.get("return_code"))){ System.err.println("-------------微信退款失败---------"); System.err.println(map.get("return_msg")); return ResultUtil.error("微信退款失败"); } } //支付宝支付 if(worldCupPayment.getPayType() == 2){ Map<String, String> map = null; try { map = payMoneyUtil.aliRefund(worldCupPayment.getPayOrderNo(), multiply.toString()); } catch (AlipayApiException e) { throw new RuntimeException(e); } if("10000".equals(map.get("code"))){ String trade_no = map.get("trade_no"); worldCupPayment.setRefundTime(new Date()); worldCupPayment.setRefundOrderNo(trade_no); worldCupPayment.setPayStatus(3); this.updateById(worldCupPayment); } } //玩湃币支付 if(worldCupPayment.getPayType() == 3){ Integer appUserId = worldCupPayment.getAppUserId(); AppUser appUser = appUserClient.getAppUser(appUserId); appUser.setPlayPaiCoins(appUser.getPlayPaiCoins() + multiply.intValue()); appUserClient.updateAppUser(appUser); worldCupPayment.setRefundTime(new Date()); worldCupPayment.setRefundOrderNo(""); worldCupPayment.setPayStatus(3); this.updateById(worldCupPayment); } //课时支付 if(worldCupPayment.getPayType() == 4){ for (WorldCupPaymentParticipant worldCupPaymentParticipant1 : list1) { String content = worldCupPaymentParticipant1.getContent(); DeductionClassHourList deductionClassHourList = JSON.parseObject(content, DeductionClassHourList.class); coursePackageOrderStudentClient.backspaceClassHour(deductionClassHourList); } worldCupPayment.setRefundTime(new Date()); worldCupPayment.setRefundOrderNo(""); worldCupPayment.setPayStatus(3); this.updateById(worldCupPayment); } return ResultUtil.success(); } } cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java
@@ -198,10 +198,6 @@ */ @Override public List<WorldCupListVo> getWorldCupList(WorldCupList worldCupList) { //没有筛选门店,默认使用当前门店 if(null == worldCupList.getStoreId()){ worldCupList.setStoreId(worldCupList.getStoreId()); } List<WorldCupListVo> worldCupList1 = this.baseMapper.getWorldCupList(worldCupList); for (WorldCupListVo worldCupListVo : worldCupList1) { Integer id = Integer.valueOf(worldCupListVo.getId()); @@ -677,6 +673,13 @@ .eq("worldCupPaymentId", worldCupPaymentId).eq("alreadyEntered", 0)); WorldCupPayment worldCupPayment = worldCupPaymentService.getById(worldCupPaymentId); BigDecimal multiply = worldCupPayment.getUnitPrice().multiply(new BigDecimal(list1.size())); //免费 if(worldCupPayment.getPayType() == 0){ worldCupPayment.setRefundOrderNo(""); worldCupPayment.setRefundTime(new Date()); worldCupPayment.setPayStatus(3); worldCupPaymentService.updateById(worldCupPayment); } //微信支付 if(worldCupPayment.getPayType() == 1){ Map<String, String> map = payMoneyUtil.wxRefund(worldCupPayment.getPayOrderNo(), worldCupPayment.getCode(), cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupCompetitorMapper.xml
@@ -3,7 +3,11 @@ <mapper namespace="com.dsh.communityWorldCup.mapper.WorldCupCompetitorMapper"> <select id="getNumberOfGamesRanked" resultType="map"> select * from ( select aa.participantType, aa.participantId, aa.num from ( select CASE WHEN participantType = 2 THEN 0 ELSE 1 END as participantType, participantId, @@ -40,13 +44,19 @@ <select id="getWorldCupRank" resultType="java.util.Map"> select * from ( select aa.participantType, aa.participantId, aa.appUserId, aa.winRate, aa.totalSession from ( select a.participantType, a.participantId, a.appUserId, a.num as totalSession, (ifnull(b.num, 0) / a.num * 100) as winRate ifnull(a.num, 0) as totalSession, (ifnull(b.num, 0) / ifnull(a.num, 0) * 100) as winRate from ( select participantType, 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.worldCupId in (select worldCupId from t_world_cup_store where storeId = #{item.storeId}) and a.id in (select worldCupId from t_world_cup_store where storeId = #{item.storeId} and isOpen = 1) </if> <if test="null != item.gender"> and #{item.gender} = a.gender cloud-server-communityWorldCup/src/main/resources/mapper/WorldCupPaymentParticipantMapper.xml
@@ -25,7 +25,8 @@ c.intro as content, c.lon, c.lat, c.basePeople as heat c.basePeople as heat, c.status from t_world_cup_payment_participant a left join t_world_cup_payment b on (a.worldCupPaymentId = b.id) left join t_world_cup c on (b.worldCupId = c.id) cloud-server-communityWorldCup/src/test/java/com/dsh/CommunityWorldCupApplicationTest.java
New file @@ -0,0 +1,36 @@ //package com.dsh; // //import com.dsh.communityWorldCup.model.WorldCupRank; //import com.dsh.communityWorldCup.model.WorldCupRankVo; //import com.dsh.communityWorldCup.service.IWorldCupCompetitorService; //import org.junit.Test; //import org.junit.runner.RunWith; //import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.boot.test.context.SpringBootTest; //import org.springframework.test.context.junit4.SpringRunner; // //import java.util.List; // ///** // * @author zhibing.pu // * @date 2024/3/8 16:42 // */ //@RunWith(SpringRunner.class) //@SpringBootTest //public class CommunityWorldCupApplicationTest { // // @Autowired // private IWorldCupCompetitorService worldCupCompetitorService; // // // @Test // public void test(){ // WorldCupRank worldCupRank = new WorldCupRank(); // worldCupRank.setAppUserId(129); // worldCupRank.setSort(2); // worldCupRank.setIsStudent(0); // worldCupRank.setRadius(1); // List<WorldCupRankVo> worldCupRank1 = worldCupCompetitorService.getWorldCupRank(worldCupRank); // } // //} cloud-server-management/src/main/webapp/static/modular/system/tShop/tShopOther.js
@@ -494,6 +494,9 @@ var carPhoto = new $WebUpload("c8"); carPhoto.setUploadBarId("progressBar"); carPhoto.init(); var carPhoto = new $WebUpload("c9"); carPhoto.setUploadBarId("progressBar"); carPhoto.init(); var carPhoto = new $WebUpload("img"); carPhoto.setUploadBarId("progressBar"); carPhoto.init(); cloud-server-other/src/main/java/com/dsh/other/entity/TGame.java
@@ -80,7 +80,9 @@ * 红方id */ private String red; @TableField(exist=false) private String blueName; @TableField(exist=false) private String redName; private Integer state;