From 03bc927fdb8469c1417f75c2a25a06a0d6b1ae61 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期四, 21 三月 2024 14:44:48 +0800 Subject: [PATCH] 修改bug --- cloud-server-communityWorldCup/src/main/java/com/dsh/communityWorldCup/service/impl/WorldCupServiceImpl.java | 4 cloud-server-account/src/main/java/com/dsh/account/feignclient/other/model/GetTGameRecord.java | 28 ++ cloud-server-other/src/main/java/com/dsh/other/feignclient/communityWorldCup/model/WorldCup.java | 148 ++++++++++++++ cloud-server-account/src/main/java/com/dsh/account/feignclient/activity/model/IntegralCommodity.java | 6 cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java | 50 +++- cloud-server-other/src/main/java/com/dsh/other/controller/GameController.java | 139 ++++++++++++- cloud-server-activity/src/main/java/com/dsh/activity/feignclient/model/IntegralCommodity.java | 6 cloud-server-account/src/main/java/com/dsh/account/feignclient/other/GameRecordClient.java | 20 ++ cloud-server-account/src/main/java/com/dsh/account/feignclient/other/model/TGameRecord.java | 57 +++++ cloud-server-other/src/main/java/com/dsh/other/model/GetTGameRecord.java | 28 ++ cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java | 32 ++ cloud-server-other/src/main/java/com/dsh/other/feignclient/communityWorldCup/WorldCupClient.java | 22 ++ cloud-server-other/src/main/java/com/dsh/other/controller/StoreConfigController.java | 8 13 files changed, 502 insertions(+), 46 deletions(-) diff --git a/cloud-server-account/src/main/java/com/dsh/account/feignclient/activity/model/IntegralCommodity.java b/cloud-server-account/src/main/java/com/dsh/account/feignclient/activity/model/IntegralCommodity.java index fe2f7ec..8b9940c 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/feignclient/activity/model/IntegralCommodity.java +++ b/cloud-server-account/src/main/java/com/dsh/account/feignclient/activity/model/IntegralCommodity.java @@ -18,9 +18,15 @@ @ApiModelProperty(value = "商品名称") private String commodityName; + @ApiModelProperty(value = "1=积分,2=现金+积分, 3=现金") + private Integer redemptionMethod; + @ApiModelProperty(value = "商品价格") private BigDecimal commodityPrice; + @ApiModelProperty(value = "支付积分") + private Integer integral; + @ApiModelProperty(value = "商品类型") private Integer goodsType; @ApiModelProperty(value = "排序") diff --git a/cloud-server-account/src/main/java/com/dsh/account/feignclient/other/GameRecordClient.java b/cloud-server-account/src/main/java/com/dsh/account/feignclient/other/GameRecordClient.java new file mode 100644 index 0000000..09a8704 --- /dev/null +++ b/cloud-server-account/src/main/java/com/dsh/account/feignclient/other/GameRecordClient.java @@ -0,0 +1,20 @@ +package com.dsh.account.feignclient.other; + +import com.dsh.account.feignclient.other.model.GetTGameRecord; +import com.dsh.account.feignclient.other.model.TGameRecord; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; + +import java.util.List; + +/** + * @author zhibing.pu + * @date 2024/3/21 14:24 + */ +@FeignClient("mb-cloud-other") +public interface GameRecordClient { + + + @PostMapping("/base/game/getTGameRecord") + List<TGameRecord> getTGameRecord(GetTGameRecord getTGameRecord); +} diff --git a/cloud-server-account/src/main/java/com/dsh/account/feignclient/other/model/GetTGameRecord.java b/cloud-server-account/src/main/java/com/dsh/account/feignclient/other/model/GetTGameRecord.java new file mode 100644 index 0000000..c147ee0 --- /dev/null +++ b/cloud-server-account/src/main/java/com/dsh/account/feignclient/other/model/GetTGameRecord.java @@ -0,0 +1,28 @@ +package com.dsh.account.feignclient.other.model; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +/** + * @author zhibing.pu + * @date 2024/3/21 14:27 + */ +@Data +public class GetTGameRecord { + /** + * 用户id + */ + private Integer appUserId; + /** + * 开始时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date startTiem; + /** + * 结束时间 + */ + @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/feignclient/other/model/TGameRecord.java b/cloud-server-account/src/main/java/com/dsh/account/feignclient/other/model/TGameRecord.java new file mode 100644 index 0000000..da50128 --- /dev/null +++ b/cloud-server-account/src/main/java/com/dsh/account/feignclient/other/model/TGameRecord.java @@ -0,0 +1,57 @@ +package com.dsh.account.feignclient.other.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.baomidou.mybatisplus.extension.activerecord.Model; +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; +import java.math.BigDecimal; +import java.util.Date; + +/** + * <p> + * + * </p> + * + * @author administrator + * @since 2023-10-07 + */ +@Data +public class TGameRecord { + + private Integer id; + + private Integer userId; + + private Integer gameId; + + /** + * 1玩湃币 2微信 3支付宝 + */ + private Integer payType; + + /** + * 金额 + */ + private BigDecimal money; + + /** + * 0待支付 1已支付 + */ + private Integer status; + + private String number; + + private String orderNo; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date time; + + +} diff --git a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java index 1214233..a120571 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java +++ b/cloud-server-account/src/main/java/com/dsh/account/service/impl/TAppUserServiceImpl.java @@ -29,13 +29,8 @@ import com.dsh.account.feignclient.course.CoursePaymentClient; import com.dsh.account.feignclient.course.VideoOfCourseListClient; import com.dsh.account.feignclient.course.model.*; -import com.dsh.account.feignclient.other.ImgConfigClient; -import com.dsh.account.feignclient.other.RechargeConfigClient; -import com.dsh.account.feignclient.other.SiteClient; -import com.dsh.account.feignclient.other.StoreClient; -import com.dsh.account.feignclient.other.model.Store; -import com.dsh.account.feignclient.other.model.StoreDetailOfCourse; -import com.dsh.account.feignclient.other.model.TImgConfig; +import com.dsh.account.feignclient.other.*; +import com.dsh.account.feignclient.other.model.*; import com.dsh.account.mapper.*; import com.dsh.account.model.*; import com.dsh.account.model.AppUserByNameAndPhoneDTO; @@ -190,6 +185,9 @@ @Autowired private UserIntegralChangesService userIntegralChangesService; + + @Resource + private GameRecordClient gameRecordClient; @@ -883,6 +881,21 @@ } // 5.智慧球场 + GetTGameRecord getTGameRecord = new GetTGameRecord(); + getTGameRecord.setAppUserId(appUserId); + getTGameRecord.setStartTiem(monthStart); + getTGameRecord.setEndTime(monthEnd); + List<TGameRecord> tGameRecord = gameRecordClient.getTGameRecord(getTGameRecord); + for (TGameRecord gameRecord : tGameRecord) { + ConsumeDetail consumeDetail = new ConsumeDetail(); + consumeDetail.setConsumeName(RechargeRecordEnum.SMART_STADIUM.getMsg()); + consumeDetail.setConsumeTime(simpleDateFormat.format(gameRecord.getTime())); + consumeDetail.setConsumeAmount("-" + gameRecord.getMoney()); + consumeDetail.setType(2); + consumeDetail.setDateTime(gameRecord.getTime().getTime()); + details.add(consumeDetail); + } + // 6.年度会员 List<VipPayment> vipPayments = vipPaymentMapper.selectList(new QueryWrapper<VipPayment>() .eq("payStatus", 2) @@ -956,6 +969,7 @@ details.add(consumeDetail); } } + if (details.size() > 0) { Collections.sort(details, new Comparator<ConsumeDetail>() { @@ -1503,7 +1517,9 @@ pointsMerchandise.setCode(code); pointsMerchandise.setInsertTime(new Date()); pointsMerchandise.setPayType(exchangeType.getExchangeType()); - pointsMerchandise.setIntegral(merchandise.getIntegral() * goodsNums); + if(null != merchandise.getIntegral()){ + pointsMerchandise.setIntegral(merchandise.getIntegral() * goodsNums); + } if(exchangeType.getExchangeType() == 2){ pointsMerchandise.setCash(merchandise.getCash()); pointsMerchandise.setCashPayType(exchangeType.getPayType()); 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 b3ea633..6c47051 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 @@ -326,7 +326,8 @@ QueryWrapper<PointsMerchandise> wrapper = new QueryWrapper<PointsMerchandise>() .eq("state", 1) .eq("shelves", 1) - .gt("endTime", new Date()); + .gt("endTime", new Date()) + .eq("status", 1); if(cIds.size() > 0){ wrapper.in("id", cIds); } @@ -337,7 +338,17 @@ integralCommodity.setCommodityId(merchandise.getId()); integralCommodity.setCommodityImg(merchandise.getCover()); integralCommodity.setCommodityName(merchandise.getName()); - integralCommodity.setCommodityPrice(merchandise.getPrice()); + if(merchandise.getRedemptionMethod() == 1){ + integralCommodity.setIntegral(merchandise.getIntegral()); + } + if(merchandise.getRedemptionMethod() == 2){ + integralCommodity.setCommodityPrice(merchandise.getPrice()); + integralCommodity.setIntegral(merchandise.getIntegral()); + } + if(merchandise.getRedemptionMethod() == 3){ + integralCommodity.setCommodityPrice(merchandise.getPrice()); + } + integralCommodity.setRedemptionMethod(merchandise.getRedemptionMethod()); integralCommodity.setGoodsType(merchandise.getType()); integralCommodity.setSort(merchandise.getSort()); commodity.add(integralCommodity); @@ -350,27 +361,30 @@ storeCoupons.add(couponStore.getCouponId()); } SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); - QueryWrapper<Coupon> queryWrapper = new QueryWrapper<Coupon>().eq("state", 1).gt("endTime", sdf.format(new Date())); + QueryWrapper<Coupon> queryWrapper = new QueryWrapper<Coupon>() + .eq("state", 1).gt("endTime", sdf.format(new Date())); if(storeCoupons.size() > 0){ queryWrapper.in("id", storeCoupons); } List<Coupon> list = couponService.list(queryWrapper.last(" ORDER BY insertTime desc")); if (!list.isEmpty()){ for (Coupon coupon : list) { - IntegralCommodity integralCommodity = new IntegralCommodity(); - integralCommodity.setCommodityId(coupon.getId()); - integralCommodity.setCommodityImg(coupon.getCover()); - integralCommodity.setCommodityName(coupon.getName()); - integralCommodity.setCommodityPrice(coupon.getIntegral()); - integralCommodity.setGoodsType(coupon.getType()); -// integralCommodity.setSort(coupon.getSort()); - commodity.add(integralCommodity); + IntegralCommodity integralCommodity = new IntegralCommodity(); + integralCommodity.setCommodityId(coupon.getId()); + integralCommodity.setCommodityImg(coupon.getCover()); + integralCommodity.setCommodityName(coupon.getName()); + if(coupon.getRedemptionMethod() == 1){ + integralCommodity.setIntegral(coupon.getIntegral().intValue()); + } + if(coupon.getRedemptionMethod() == 2){ + integralCommodity.setCommodityPrice(coupon.getCash()); + integralCommodity.setIntegral(coupon.getIntegral().intValue()); + } + integralCommodity.setRedemptionMethod(coupon.getRedemptionMethod()); + integralCommodity.setGoodsType(4); + commodity.add(integralCommodity); } - } - - - System.out.println(commodity); return commodity; } @@ -396,7 +410,11 @@ list = pmdsService.list(new QueryWrapper<PointsMerchandise>() .eq("state", 1) - .eq("shelves", 1).le("startTime", new Date()).ge("endTime", new Date())); + .eq("shelves", 1) + .le("startTime", new Date()) + .ge("endTime", new Date()) + .eq("status", 1) + ); if (list.size() > 0) { Iterator<PointsMerchandise> iterator = list.iterator(); while (iterator.hasNext()) { diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/feignclient/model/IntegralCommodity.java b/cloud-server-activity/src/main/java/com/dsh/activity/feignclient/model/IntegralCommodity.java index 183ed83..2a11feb 100644 --- a/cloud-server-activity/src/main/java/com/dsh/activity/feignclient/model/IntegralCommodity.java +++ b/cloud-server-activity/src/main/java/com/dsh/activity/feignclient/model/IntegralCommodity.java @@ -19,9 +19,15 @@ @ApiModelProperty(value = "商品名称") private String commodityName; + @ApiModelProperty(value = "1=积分,2=现金+积分, 3=现金") + private Integer redemptionMethod; + @ApiModelProperty(value = "商品价格") private BigDecimal commodityPrice; + @ApiModelProperty(value = "支付积分") + private Integer integral; + @ApiModelProperty(value = "商品类型") private Integer goodsType; 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 e753e6e..d13cbad 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 @@ -537,7 +537,7 @@ worldCupPayment.setUnitPrice(worldCupPayment.getAmount().divide(new BigDecimal(num))); worldCupPaymentService.save(worldCupPayment); return payMoneyUtil.weixinpay("社区世界杯报名", "", worldCupPayment.getCode(), - worldCup.getCash().toString(), "/base/worldCup/wxPayWorldCupCallback", "APP", ""); + worldCupPayment.getAmount().toString(), "/base/worldCup/wxPayWorldCupCallback", "APP", ""); } //支付宝 if(payType == 2){ @@ -545,7 +545,7 @@ worldCupPayment.setUnitPrice(worldCupPayment.getAmount().divide(new BigDecimal(num))); worldCupPaymentService.save(worldCupPayment); return payMoneyUtil.alipay("2088330203191220", "社区世界杯报名", "世界杯报名", "", worldCupPayment.getCode(), - worldCup.getCash().toString(), "/base/worldCup/aliPayWorldCupCallback"); + worldCupPayment.getAmount().toString(), "/base/worldCup/aliPayWorldCupCallback"); } //玩湃币 if(payType == 3){ diff --git a/cloud-server-other/src/main/java/com/dsh/other/controller/GameController.java b/cloud-server-other/src/main/java/com/dsh/other/controller/GameController.java index c2abaf0..3d1174c 100644 --- a/cloud-server-other/src/main/java/com/dsh/other/controller/GameController.java +++ b/cloud-server-other/src/main/java/com/dsh/other/controller/GameController.java @@ -9,6 +9,7 @@ import com.dsh.other.feignclient.CourseRecordClient; import com.dsh.other.feignclient.account.AppUserClient; import com.dsh.other.feignclient.account.model.AppUser; +import com.dsh.other.model.GetTGameRecord; import com.dsh.other.model.QueryMySiteVo; import com.dsh.other.model.User; import com.dsh.other.service.*; @@ -21,13 +22,17 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.PrintWriter; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.*; import java.util.stream.Collectors; @RestController -@RequestMapping("/api/game") +@RequestMapping("") public class GameController { @Autowired @@ -60,7 +65,7 @@ @ResponseBody - @PostMapping("/getIntro") + @PostMapping("/api/game/getIntro") @ApiOperation(value = "获取步骤说明", tags = {"用户—游戏"}) @ApiImplicitParams({ @ApiImplicitParam(name = "Authorization", value = "Bearer +token", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9....."), @@ -80,7 +85,7 @@ @ResponseBody - @PostMapping("/queryGameList") + @PostMapping("/api/game/queryGameList") @ApiOperation(value = "获取当前场地的游戏列表配置", tags = {"用户—游戏"}) @ApiImplicitParams({ @ApiImplicitParam(value = "siteId", name = "siteId", dataType = "int", required = true), @@ -118,7 +123,7 @@ @ResponseBody - @PostMapping("/gameStartupCheck") + @PostMapping("/api/game/gameStartupCheck") @ApiOperation(value = "扫码启动游戏前的校验(0=不通过,1=通过)", tags = {"用户—游戏"}) @ApiImplicitParams({ @ApiImplicitParam(value = "三方游戏id", name = "gameId", dataType = "int", required = true), @@ -162,7 +167,7 @@ @ResponseBody - @PostMapping("/payGame") + @PostMapping("/api/game/payGame") @ApiOperation(value = "支付游戏", tags = {"用户—游戏"}) @ApiImplicitParams({ @ApiImplicitParam(value = "三方游戏id", name = "gameId", dataType = "int", required = true), @@ -197,7 +202,11 @@ gameRecordService.save(tGameRecord); if (type == 1) { - ResultUtil weixinpay = payMoneyUtil.weixinpay("游戏支付", "", code, config.getCash().toString(), "/base/course/weChatPaymentCourseCallback", "APP", ""); + tGameRecord.setMoney(config.getCash()); + gameRecordService.updateById(tGameRecord); + String params = uid + "_" + gameId + "_" + spaceId + "_" + sutuId+"_"+code+"_"+configId; + ResultUtil weixinpay = payMoneyUtil.weixinpay("游戏支付", params, code, config.getCash().toString(), + "/base/game/wechatPaymentGameCallback", "APP", ""); if (weixinpay.getCode() == 200) { new Thread(new Runnable() { @Override @@ -234,11 +243,9 @@ break; } if ("SUCCESS".equals(s)) { - for (TGameRecord coursePackagePayment : list) { - coursePackagePayment.setStatus(1); - coursePackagePayment.setMoney(config.getCash()); - coursePackagePayment.setOrderNo(transaction_id); - + for (TGameRecord gameRecord : list) { + gameRecord.setStatus(1); + gameRecord.setOrderNo(transaction_id); } gameRecordService.updateBatchById(list); Integer integer = startGame(uid, gameId, spaceId, sutuId); @@ -257,11 +264,12 @@ } return weixinpay; } else if (type == 2) { + tGameRecord.setMoney(config.getCash()); + gameRecordService.updateById(tGameRecord); String smid1=""; String params = uid + "_" + gameId + "_" + spaceId + "_" + sutuId+"_"+code+"_"+configId; // 判断这个课包属于哪个门店 属于哪个运营商 根据运营商 id 获取对应的商户号 - TGame game = gameService.getById(gameId); - + TGame game = gameService.getOne(new QueryWrapper<TGame>().eq("blue", sutuId).or().eq("red", sutuId)); Integer operationId = game.getOperationId(); if (operationId==0){ // 是平台的 @@ -271,7 +279,8 @@ smid1 = smidByOperatorId; } - ResultUtil alipay = payMoneyUtil.alipay(smid1,"游戏支付", "游戏支付", params, code, config.getCash().toString(), "/base/site/gameCallback"); + ResultUtil alipay = payMoneyUtil.alipay(smid1,"游戏支付", "游戏支付", params, code, config.getCash().toString(), + "/base/game/aliPaymentGameCallback"); if (alipay.getCode() == 200) { new Thread(new Runnable() { @Override @@ -302,10 +311,9 @@ break; } if ("TRADE_SUCCESS".equals(s)) { - for (TGameRecord coursePackagePayment : list) { - coursePackagePayment.setStatus(1); - coursePackagePayment.setMoney(config.getCash()); - coursePackagePayment.setOrderNo(tradeNo); + for (TGameRecord gameRecord : list) { + gameRecord.setStatus(1); + gameRecord.setOrderNo(tradeNo); CourseCounsum courseCounsum = new CourseCounsum(); courseCounsum.setChangeType(3); @@ -409,9 +417,102 @@ * @return */ @ResponseBody - @PostMapping("/getTGameBySutuId") + @PostMapping("/api/game/getTGameBySutuId") public TGame getTGameBySutuId(@RequestBody String sutuId){ return gameService.getOne(new QueryWrapper<TGame>().eq("blue", sutuId).or() .eq("red", sutuId).eq("state", 0)); } + + + + @ResponseBody + @PostMapping("/base/game/wechatPaymentGameCallback") + public void wechatPaymentGameCallback(HttpServletRequest request, HttpServletResponse response){ + Map<String, String> map = payMoneyUtil.weixinpayCallback(request); + if(null != map){ + String out_trade_no = map.get("out_trade_no"); + String transaction_id = map.get("transaction_id"); + String result = map.get("result"); + //String params = uid + "_" + gameId + "_" + spaceId + "_" + sutuId+"_"+code+"_"+configId; + String attach = map.get("attach"); + + List<TGameRecord> list = gameRecordService.list(new QueryWrapper<TGameRecord>().eq("number", out_trade_no).eq("payType", 1)); + for (TGameRecord gameRecord : list) { + gameRecord.setStatus(1); + gameRecord.setOrderNo(transaction_id); + + + CourseCounsum courseCounsum = new CourseCounsum(); + courseCounsum.setChangeType(3); + courseCounsum.setInsertTime(new Date()); + courseCounsum.setReason("智慧球场;" + gameRecord.getMoney()); + courseCounsum.setAppUserId(gameRecord.getUserId()); + courseRecordClient.save(courseCounsum); + + } + gameRecordService.updateBatchById(list); + String[] s = attach.split("_"); + Integer integer = startGame(Integer.valueOf(s[0]), Integer.valueOf(s[1]), Integer.valueOf(s[2]), Integer.valueOf(s[3])); + + PrintWriter out = null; + try { + out = response.getWriter(); + } catch (IOException e) { + e.printStackTrace(); + } + out.print(result); + out.flush(); + out.close(); + } + } + + @ResponseBody + @PostMapping("/base/game/aliPaymentGameCallback") + public void aliPaymentGameCallback(HttpServletRequest request, HttpServletResponse response){ + Map<String, String> map = payMoneyUtil.alipayCallback(request); + if(null != map){ + String out_trade_no = map.get("out_trade_no"); + String transaction_id = map.get("trade_no"); + //String params = uid + "_" + gameId + "_" + spaceId + "_" + sutuId+"_"+code+"_"+configId; + String attach = map.get("passback_params"); + + List<TGameRecord> list = gameRecordService.list(new QueryWrapper<TGameRecord>().eq("number", out_trade_no).eq("payType", 2)); + for (TGameRecord gameRecord : list) { + gameRecord.setStatus(1); + gameRecord.setOrderNo(transaction_id); + + + CourseCounsum courseCounsum = new CourseCounsum(); + courseCounsum.setChangeType(3); + courseCounsum.setInsertTime(new Date()); + courseCounsum.setReason("智慧球场;" + gameRecord.getMoney()); + courseCounsum.setAppUserId(gameRecord.getUserId()); + courseRecordClient.save(courseCounsum); + + } + gameRecordService.updateBatchById(list); + String[] s = attach.split("_"); + Integer integer = startGame(Integer.valueOf(s[0]), Integer.valueOf(s[1]), Integer.valueOf(s[2]), Integer.valueOf(s[3])); + + PrintWriter out = null; + try { + out = response.getWriter(); + } catch (IOException e) { + e.printStackTrace(); + } + out.print("success"); + out.flush(); + out.close(); + } + } + + + + @ResponseBody + @PostMapping("/base/game/getTGameRecord") + public List<TGameRecord> getTGameRecord(@RequestBody GetTGameRecord getTGameRecord){ + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + return gameRecordService.list(new QueryWrapper<TGameRecord>().eq("userId", getTGameRecord.getAppUserId()).eq("status", 1).in("payType", Arrays.asList(1, 2)) + .last(" and DATE_FORMAT(time, '%Y-%m-%d %H:%i:%s') between '" + sdf.format(getTGameRecord.getStartTiem()) +"' and '" + sdf.format(getTGameRecord.getEndTime()) + "'")); + } } 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 c809190..2b5e035 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 @@ -3,7 +3,9 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.dsh.other.entity.HomeModule; import com.dsh.other.entity.StoreConfig; +import com.dsh.other.feignclient.communityWorldCup.WorldCupClient; import com.dsh.other.feignclient.communityWorldCup.WorldCupStoreClient; +import com.dsh.other.feignclient.communityWorldCup.model.WorldCup; import com.dsh.other.feignclient.communityWorldCup.model.WorldCupStore; import com.dsh.other.model.StoreConfigVo; import com.dsh.other.service.IHomeModuleService; @@ -41,6 +43,9 @@ @Resource private WorldCupStoreClient worldCupStoreClient; + + @Resource + private WorldCupClient worldCupClient; @@ -118,10 +123,11 @@ List<WorldCupStore> worldCupStoreList = worldCupStoreClient.getWorldCupStoreList(storeId); for (WorldCupStore worldCupStore : worldCupStoreList) { + WorldCup worldCup = worldCupClient.getWorldCup(worldCupStore.getWorldCupId()); StoreConfigVo storeConfigVo = new StoreConfigVo(); storeConfigVo.setIsTop(0); storeConfigVo.setId(worldCupStore.getWorldCupId()); - storeConfigVo.setBackgroundImage(ToolUtil.isNotEmpty(worldCupStore.getBackgroundImage()) ? worldCupStore.getBackgroundImage() : "https://we-park-life.oss-cn-beijing.aliyuncs.com/img/760934115ff6468591ed51f0d760a989.jpg"); + storeConfigVo.setBackgroundImage(ToolUtil.isNotEmpty(worldCupStore.getBackgroundImage()) ? worldCupStore.getBackgroundImage() : worldCup.getHomeBackdropImg()); storeConfigVo.setType(9); storeConfigVo.setIsOpen(worldCupStore.getIsOpen()); storeConfigVo.setSort(worldCupStore.getSort()); diff --git a/cloud-server-other/src/main/java/com/dsh/other/feignclient/communityWorldCup/WorldCupClient.java b/cloud-server-other/src/main/java/com/dsh/other/feignclient/communityWorldCup/WorldCupClient.java new file mode 100644 index 0000000..eb3b888 --- /dev/null +++ b/cloud-server-other/src/main/java/com/dsh/other/feignclient/communityWorldCup/WorldCupClient.java @@ -0,0 +1,22 @@ +package com.dsh.other.feignclient.communityWorldCup; + +import com.dsh.other.feignclient.communityWorldCup.model.WorldCup; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; + +/** + * @author zhibing.pu + * @date 2024/3/21 11:28 + */ +@FeignClient("mb-cloud-communityWorldCup") +public interface WorldCupClient { + + + /** + * 根据id获取详情 + * @param id + * @return + */ + @PostMapping("/worldCup/getWorldCupById") + WorldCup getWorldCup(Integer id); +} diff --git a/cloud-server-other/src/main/java/com/dsh/other/feignclient/communityWorldCup/model/WorldCup.java b/cloud-server-other/src/main/java/com/dsh/other/feignclient/communityWorldCup/model/WorldCup.java new file mode 100644 index 0000000..d466035 --- /dev/null +++ b/cloud-server-other/src/main/java/com/dsh/other/feignclient/communityWorldCup/model/WorldCup.java @@ -0,0 +1,148 @@ +package com.dsh.other.feignclient.communityWorldCup.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/18 16:58 + */ +@Data +public class WorldCup { + /** + * 主键 + */ + private Integer id; + /** + * 名称 + */ + private String name; + /** + * 开始时间 + */ + @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; + /** + * 报名结束时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date registrationClosingTime; + /** + * 开始年龄 + */ + private Integer startAge; + /** + * 结束年龄 + */ + private Integer endAge; + /** + * 报名性别(0=全部,1=男,2=女) + */ + private Integer gender; + /** + * 支付方式(1=免费,2=现金支付,3=玩湃币支付,4=课时支付) + */ + private String payType; + /** + * 现金 + */ + private BigDecimal cash; + /** + * 玩湃币 + */ + private Integer paiCoin; + /** + * 课时 + */ + private Integer classHour; + /** + * 最多报名人数 + */ + private Integer maxPeople; + /** + * 基础报名人数 + */ + private Integer basePeople; + /** + * 参赛获得积分 + */ + private Integer participationIntegral; + /** + * 胜利获得积分 + */ + private Integer winIntegral; + /** + * 省 + */ + private String province; + /** + * 省 + */ + private String provinceCode; + /** + * 市 + */ + private String city; + /** + * 市 + */ + private String cityCode; + /** + * 参赛地址 + */ + private String address; + /** + * 经度 + */ + private String lon; + /** + * 纬度 + */ + private String lat; + /** + * 封面图 + */ + private String coverImg; + /** + * 首页默认背景图 + */ + private String homeBackdropImg; + /** + * 比赛图片 + */ + private String infoImg; + /** + * 比赛简介 + */ + private String intro; + /** + * 比赛详情 + */ + private String content; + /** + * 比赛状态(1=未开始,2=已开始,3=已结束,4=已取消) + */ + private Integer status; + /** + * 添加时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date createTime; + /** + * 已比赛次数 + */ + private Integer matchNumber; +} diff --git a/cloud-server-other/src/main/java/com/dsh/other/model/GetTGameRecord.java b/cloud-server-other/src/main/java/com/dsh/other/model/GetTGameRecord.java new file mode 100644 index 0000000..41a40a0 --- /dev/null +++ b/cloud-server-other/src/main/java/com/dsh/other/model/GetTGameRecord.java @@ -0,0 +1,28 @@ +package com.dsh.other.model; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +/** + * @author zhibing.pu + * @date 2024/3/21 14:27 + */ +@Data +public class GetTGameRecord { + /** + * 用户id + */ + private Integer appUserId; + /** + * 开始时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date startTiem; + /** + * 结束时间 + */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date endTime; +} -- Gitblit v1.7.1