From 4c9035836c18886883d3f69d8443c53d15b068fc Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期五, 22 八月 2025 14:39:53 +0800 Subject: [PATCH] 会员支付相关 --- cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipController.java | 111 ---- cloud-server-account/src/main/java/com/dsh/account/vo/CouponVipResp.java | 2 cloud-server-other/src/main/java/com/dsh/other/model/ConponJsonRuleModel.java | 25 + cloud-server-management/src/main/webapp/WEB-INF/view/system/tAgreement/tAgreementDriver.html | 17 cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java | 11 cloud-server-other/src/main/java/com/dsh/other/service/IVipService.java | 16 cloud-server-account/src/main/java/com/dsh/account/vo/VipPaymentVO.java | 3 cloud-server-other/src/main/java/com/dsh/other/feignclient/activity/model/Coupon.java | 5 cloud-server-management/src/main/java/com/dsh/course/feignClient/activity/model/Coupon.java | 4 cloud-server-account/src/main/java/com/dsh/account/controller/AppUserController.java | 5 cloud-server-account/src/main/java/com/dsh/account/service/impl/VipPaymentServiceImpl.java | 1 cloud-server-other/src/main/java/com/dsh/other/feignclient/activity/CouponClient.java | 13 cloud-server-account/src/main/java/com/dsh/account/controller/UseBenefitsController.java | 11 cloud-server-other/src/main/java/com/dsh/other/mapper/TVipMapper.java | 24 + cloud-server-activity/src/main/java/com/dsh/activity/entity/Vip.java | 107 ++++ cloud-server-other/src/main/java/com/dsh/other/model/CouponCity.java | 65 ++ cloud-server-activity/src/main/java/com/dsh/activity/controller/CouponController.java | 44 + cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_imgAll.html | 36 + cloud-server-other/src/main/java/com/dsh/other/controller/TVipController.java | 202 ++++++++ cloud-server-activity/src/main/java/com/dsh/activity/controller/HuiminRecordController.java | 33 + cloud-server-activity/src/main/java/com/dsh/activity/controller/PointMercharsController.java | 2 cloud-server-activity/src/main/java/com/dsh/activity/entity/TicketVipResp.java | 26 + cloud-server-management/src/main/webapp/static/modular/system/tShop/tShopOther.js | 14 cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TAgreeController.java | 10 cloud-server-other/src/main/java/com/dsh/other/model/CouponStore.java | 52 ++ cloud-server-activity/src/main/java/com/dsh/activity/entity/VipDetail.java | 2 cloud-server-activity/src/main/java/com/dsh/activity/controller/UserCouponController.java | 1 cloud-server-other/src/main/java/com/dsh/other/feignclient/activity/model/PointsMerchandise.java | 189 ++++++++ cloud-server-account/src/main/java/com/dsh/account/model/vo/userBenefitDetail/IndexOfUserBenefirVo.java | 2 cloud-server-activity/src/main/java/com/dsh/activity/entity/VipCouponTicketListResp.java | 22 cloud-server-other/src/main/java/com/dsh/other/model/Vip.java | 107 ++++ cloud-server-account/src/main/java/com/dsh/account/vo/ConponJsonRuleModel.java | 2 cloud-server-other/src/main/java/com/dsh/other/service/impl/TVipServiceImpl.java | 27 + cloud-server-other/src/main/java/com/dsh/other/model/TicketVipResp.java | 26 + cloud-server-other/src/main/java/com/dsh/other/model/CouponVipResp.java | 45 + cloud-server-activity/src/main/java/com/dsh/activity/entity/CouponVipResp.java | 46 ++ cloud-server-activity/src/main/java/com/dsh/activity/feignclient/other/VipClient.java | 22 37 files changed, 1,189 insertions(+), 141 deletions(-) diff --git a/cloud-server-account/src/main/java/com/dsh/account/controller/AppUserController.java b/cloud-server-account/src/main/java/com/dsh/account/controller/AppUserController.java index c217927..b491797 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/controller/AppUserController.java +++ b/cloud-server-account/src/main/java/com/dsh/account/controller/AppUserController.java @@ -474,6 +474,7 @@ VipPaymentVO res = new VipPaymentVO(); res.setHeadImg(appUser.getHeadImg()); res.setName(appUser.getName()); + res.setVipEndTime(appUser.getVipEndTime()); if (appUser.getVipEndTime()==null){ res.setIsVip(0); }else if (appUser.getVipEndTime().before(new Date())){ @@ -484,11 +485,13 @@ appUserService.updateById(appUser); List<Vip> vips = vipClient.listAll(); res.setVipList(vips); + + return ResultUtil.success(res); + } catch (Exception e) { e.printStackTrace(); return ResultUtil.runErr(); } - return ResultUtil.success(); } // diff --git a/cloud-server-account/src/main/java/com/dsh/account/controller/UseBenefitsController.java b/cloud-server-account/src/main/java/com/dsh/account/controller/UseBenefitsController.java index b868a95..f22844f 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/controller/UseBenefitsController.java +++ b/cloud-server-account/src/main/java/com/dsh/account/controller/UseBenefitsController.java @@ -60,6 +60,8 @@ @Autowired private PayMoneyUtil payMoneyUtil; + @Autowired + private TAppUserService appUserService; @ResponseBody @@ -82,6 +84,15 @@ commodities = commodities.subList(0, 5); } indexOfUserBenefirVo.setCommodities(commodities); + TAppUser byId = appUserService.getById(appUserId); + if (byId.getIsVip()!=null && byId.getIsVip()==1){ + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); + if (byId.getVipEndTime().getTime() > System.currentTimeMillis()) { + indexOfUserBenefirVo.setVipEndTime(simpleDateFormat.format(byId.getVipEndTime())); + } else { + indexOfUserBenefirVo.setVipEndTime(""); + } + } return ResultUtil.success(indexOfUserBenefirVo); } catch (Exception e) { e.printStackTrace(); diff --git a/cloud-server-account/src/main/java/com/dsh/account/model/vo/userBenefitDetail/IndexOfUserBenefirVo.java b/cloud-server-account/src/main/java/com/dsh/account/model/vo/userBenefitDetail/IndexOfUserBenefirVo.java index b05b4d6..7a822f2 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/model/vo/userBenefitDetail/IndexOfUserBenefirVo.java +++ b/cloud-server-account/src/main/java/com/dsh/account/model/vo/userBenefitDetail/IndexOfUserBenefirVo.java @@ -33,5 +33,7 @@ @ApiModelProperty("是否是裁判(0=否,1=是)") private Integer referee; + @ApiModelProperty("会员到期时间") + private String vipEndTime; } diff --git a/cloud-server-account/src/main/java/com/dsh/account/service/impl/VipPaymentServiceImpl.java b/cloud-server-account/src/main/java/com/dsh/account/service/impl/VipPaymentServiceImpl.java index 639db2b..6734e97 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/service/impl/VipPaymentServiceImpl.java +++ b/cloud-server-account/src/main/java/com/dsh/account/service/impl/VipPaymentServiceImpl.java @@ -273,6 +273,7 @@ if (StringUtils.hasLength(couponJson)) { grantCoupon.setCouponJson(couponJson); } + grantCoupon.setVipId(vipPayment1.getVipId()); grantCoupon.setUserId(vipPayment1.getAppUserId()); grantCoupon.setVipPaymentId(vipPayment1.getId()); String ticketJson = vipPayment1.getTicketJson(); diff --git a/cloud-server-account/src/main/java/com/dsh/account/vo/ConponJsonRuleModel.java b/cloud-server-account/src/main/java/com/dsh/account/vo/ConponJsonRuleModel.java index be45c01..eec6cbd 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/vo/ConponJsonRuleModel.java +++ b/cloud-server-account/src/main/java/com/dsh/account/vo/ConponJsonRuleModel.java @@ -19,7 +19,7 @@ /** * 体验券名称 */ - @ApiModelProperty("体验券名称 ") + @ApiModelProperty("体验券名称/抵扣券抵扣商品名称 ") String experienceName; } diff --git a/cloud-server-account/src/main/java/com/dsh/account/vo/CouponVipResp.java b/cloud-server-account/src/main/java/com/dsh/account/vo/CouponVipResp.java index 964a9cf..44cfbf3 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/vo/CouponVipResp.java +++ b/cloud-server-account/src/main/java/com/dsh/account/vo/CouponVipResp.java @@ -15,7 +15,7 @@ @ApiModelProperty("优惠券名称") private String name; - @ApiModelProperty("优惠券类型(1=满减券,2=代金券,3=体验券)") + @ApiModelProperty("优惠券类型(1=满减券,2=代金券,3=体验券 4=抵扣券)") private Integer type; @ApiModelProperty("适用范围1全国通用 2指定城市可用 3指定门店可用") diff --git a/cloud-server-account/src/main/java/com/dsh/account/vo/VipPaymentVO.java b/cloud-server-account/src/main/java/com/dsh/account/vo/VipPaymentVO.java index fa8e6cc..cdf952f 100644 --- a/cloud-server-account/src/main/java/com/dsh/account/vo/VipPaymentVO.java +++ b/cloud-server-account/src/main/java/com/dsh/account/vo/VipPaymentVO.java @@ -7,6 +7,7 @@ import lombok.Data; import java.io.Serializable; +import java.util.Date; import java.util.List; @Data @@ -19,6 +20,8 @@ private String name; @ApiModelProperty(value = "当前是否会员 0否1是") private Integer isVip; + @ApiModelProperty(value = "会员到期时间") + private Date vipEndTime; @ApiModelProperty(value = "所有上架的会员卡") private List<Vip> vipList; @ApiModelProperty(value = "会员协议") 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 dea4e5b..e894f41 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 @@ -20,6 +20,7 @@ import com.dsh.activity.feignclient.other.OperatorClient; import com.dsh.activity.feignclient.other.RegionClient; import com.dsh.activity.feignclient.other.StoreClient; +import com.dsh.activity.feignclient.other.VipClient; import com.dsh.activity.feignclient.other.model.CityDataAndProvinceDataVo; import com.dsh.activity.feignclient.other.model.Store; import com.dsh.activity.feignclient.other.model.StoreInfoDto; @@ -68,9 +69,12 @@ @Autowired private TokenUtil tokenUtil; + @Autowired + private VipClient vipClient; @Autowired private UserCouponService ucService; + @Autowired private GDMapGeocodingUtil gdMapGeocodingUtil; @@ -195,24 +199,45 @@ @PostMapping("/api/coupon/queryCouponList") @ApiOperation(value = "获取优惠券列表", tags = {"APP-成为会员", ""}) @ApiImplicitParams({ - @ApiImplicitParam(value = "1=积分购买,2=注册赠送", name = "distributionMethod", dataType = "int", required = true), + @ApiImplicitParam(value = "vipId", name = "vipId", dataType = "int", required = true), @ApiImplicitParam(name = "Authorization", value = "用户token(Bearer +token)", required = true, dataType = "String", paramType = "header", defaultValue = "Bearer eyJhbGciOiJIUzUxMiJ9.....") }) - public ResultUtil<List<CouponListVo>> queryCouponList(Integer distributionMethod) { - if (null == distributionMethod) { - return ResultUtil.paranErr("distributionMethod"); + public ResultUtil<VipCouponTicketListResp> queryCouponList(Integer vipId) { + if (null == vipId) { + return ResultUtil.paranErr("vipId"); } + VipCouponTicketListResp vipCouponTicketListResp = new VipCouponTicketListResp(); try { Integer uid = tokenUtil.getUserIdFormRedis(); if (null == uid) { return ResultUtil.tokenErr(); } - List<CouponListVo> listVos = couponService.queryCouponList(uid, distributionMethod); - return ResultUtil.success(listVos); + List<Vip> vips = vipClient.listAll(); + Vip vip = vips.stream().filter(e -> e.getId().equals(vipId)).findFirst().orElse(null); + if (vip!=null){ + List<CouponVipResp> couponVipResps = new ArrayList<>(); + List<TicketVipResp> ticketVipResps = new ArrayList<>(); + List<CouponVipResp> couponList = vip.getCouponList(); + for (CouponVipResp couponVipResp : couponList) { + for (Integer i = 0; i < couponVipResp.getCount(); i++) { + couponVipResps.add(couponVipResp); + } + } + List<TicketVipResp> ticketList = vip.getTicketList(); + for (TicketVipResp ticketVipResp : ticketList) { + for (Integer i = 0; i < ticketVipResp.getCount(); i++) { + ticketVipResps.add(ticketVipResp); + } + } + vipCouponTicketListResp.setCouponVipRespList(couponVipResps); + vipCouponTicketListResp.setTicketVipRespList(ticketVipResps); + return ResultUtil.success(vipCouponTicketListResp); + } } catch (Exception e) { e.printStackTrace(); return ResultUtil.success(); } + return ResultUtil.success(); } @@ -894,7 +919,12 @@ List<CouponCity> list = cityService.list(new LambdaQueryWrapper<CouponCity>()); return list; } - + @ResponseBody + @PostMapping("/base/coupon/queryAllPointGoods") + public List<PointsMerchandise> queryAllPointGoods(){ + List<PointsMerchandise> pointsMerchandiseList = pointsMerchandiseService.list(); + return pointsMerchandiseList; + } @ResponseBody @PostMapping("/base/coupon/queryStore") public List<Integer> queryStore(@RequestBody Integer id) { diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/controller/HuiminRecordController.java b/cloud-server-activity/src/main/java/com/dsh/activity/controller/HuiminRecordController.java index 05af436..43627d5 100644 --- a/cloud-server-activity/src/main/java/com/dsh/activity/controller/HuiminRecordController.java +++ b/cloud-server-activity/src/main/java/com/dsh/activity/controller/HuiminRecordController.java @@ -3,13 +3,19 @@ import com.dsh.activity.entity.THuiminRecord; import com.dsh.activity.entity.TPayHuimin; import com.dsh.activity.entity.VipDetail; +import com.dsh.activity.feignclient.other.SiteClient; +import com.dsh.activity.feignclient.other.StoreClient; +import com.dsh.activity.feignclient.other.model.Site; +import com.dsh.activity.feignclient.other.model.Store; import com.dsh.activity.service.*; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; +import java.util.Arrays; import java.util.Date; +import java.util.List; /** * 硬件方调用 存储玩湃惠民卡使用记录 @@ -25,6 +31,10 @@ private PayHuiminService payHuiminService; @Resource private VipDetailService vipDetailService; + @Resource + private SiteClient siteClient; + @Resource + private StoreClient storeClient; /** * 硬件开门后回调 存储玩湃惠民卡使用记录 */ @@ -47,12 +57,29 @@ * 硬件开门后回调 存储会员使用明细 */ @PostMapping("/recordVipDetail") - public void recordVipDetail(Integer id,Integer rid,Integer sid) { + public void recordVipDetail(Integer vipDetailId,Integer rid,Integer sid) { System.err.println("硬件开门后回调 存储会员卡门票权益使用记录"); - System.err.println("id:"+id); + System.err.println("vipDetailId:"+vipDetailId); System.err.println("rid:"+rid); System.err.println("sid:"+sid); - VipDetail vipDetailServiceById = vipDetailService.getById(id); + VipDetail vipDetailServiceById = vipDetailService.getById(vipDetailId); + if (vipDetailServiceById!=null){ + Site site = siteClient.querySiteById(rid); + if (site!=null){ + List<Store> stores = storeClient.queryStoreByIds(Arrays.asList(rid)); + if (!stores.isEmpty()){ + Store store = stores.get(0); + vipDetailServiceById.setOperatorId(store.getOperatorId()); + } + } + // 根据场地id查询运营商id + vipDetailServiceById.setUseSiteId(rid); + vipDetailServiceById.setUseStoreId(sid); + vipDetailServiceById.setStatus(2); + vipDetailServiceById.setStartTime(new Date()); + vipDetailServiceById.setEndTime(new Date()); + vipDetailService.updateById(vipDetailServiceById); + } } } 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 92fb1df..ee55769 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 @@ -1053,7 +1053,7 @@ detailsResponse.setGoodName(vipDetail.getTicketName()); detailsResponse.setStartTime(simpleDateFormat.format(vipDetail.getStartTime())); detailsResponse.setEndTime(simpleDateFormat.format(vipDetail.getEndTime())); - detailsResponse.setUseStatus(vipDetail.getStatus()); + detailsResponse.setUseStatus(vipDetail.getStatus()==1?2:1); detailsResponse.setGoodType(3); // 表明是会员赠送的门票 detailsResponse.setExchangeType(4); diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/controller/UserCouponController.java b/cloud-server-activity/src/main/java/com/dsh/activity/controller/UserCouponController.java index d1b71e2..3963a6a 100644 --- a/cloud-server-activity/src/main/java/com/dsh/activity/controller/UserCouponController.java +++ b/cloud-server-activity/src/main/java/com/dsh/activity/controller/UserCouponController.java @@ -360,6 +360,7 @@ vipDetail.setUserCouponId(userCoupon.getId()); vipDetailService.save(vipDetail); userCoupon.setVipDetailId(vipDetail.getId()); + userCoupon.setUserId(null); userCouponService.updateById(userCoupon); } } diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/entity/CouponVipResp.java b/cloud-server-activity/src/main/java/com/dsh/activity/entity/CouponVipResp.java new file mode 100644 index 0000000..69cb045 --- /dev/null +++ b/cloud-server-activity/src/main/java/com/dsh/activity/entity/CouponVipResp.java @@ -0,0 +1,46 @@ +package com.dsh.activity.entity; + + +import com.dsh.activity.model.ConponJsonRuleModel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel("会员权益优惠券列表") +public class CouponVipResp { + + @ApiModelProperty("优惠券id") + private Integer id; + + @ApiModelProperty("优惠券名称") + private String name; + + @ApiModelProperty("优惠券类型(1=满减券,2=代金券,3=体验券 4=抵扣券)") + private Integer type; + + @ApiModelProperty("适用范围1全国通用 2指定城市可用 3指定门店可用") + private Integer useCondition; + + @ApiModelProperty("适用范围名称") + private String available; + + @ApiModelProperty("useCondition = 2,为地址字符串;useCondition = 3,为门店名称+地址字符串") + private String cityOrStore; + + @ApiModelProperty("优惠券说明(使用说明)") + private String instructionsForUse; + + @ApiModelProperty("金额条件封装") + private ConponJsonRuleModel ruleModel; + + @ApiModelProperty("有效时间(2021-05-05)") + private String effectiveTime; + @ApiModelProperty("有效时间开始(2021-05-05)") + private String startTime; + @ApiModelProperty("数量 张") + private Integer count; + + + +} diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/entity/TicketVipResp.java b/cloud-server-activity/src/main/java/com/dsh/activity/entity/TicketVipResp.java new file mode 100644 index 0000000..408ddd9 --- /dev/null +++ b/cloud-server-activity/src/main/java/com/dsh/activity/entity/TicketVipResp.java @@ -0,0 +1,26 @@ +package com.dsh.activity.entity; + + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel("会员权益门票列表") +public class TicketVipResp { + + + @ApiModelProperty("门票名称") + private String name; + + @ApiModelProperty("领取后x天有效") + private Integer time; + + @ApiModelProperty("数量 张") + private Integer count; + @ApiModelProperty("有效时间(2021-05-05)") + private String effectiveTime; + @ApiModelProperty("有效时间开始(2021-05-05)") + private String startTime; + +} diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/entity/Vip.java b/cloud-server-activity/src/main/java/com/dsh/activity/entity/Vip.java new file mode 100644 index 0000000..12f2fee --- /dev/null +++ b/cloud-server-activity/src/main/java/com/dsh/activity/entity/Vip.java @@ -0,0 +1,107 @@ +package com.dsh.activity.entity; + +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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * 会员管理 + */ +@TableName("t_vip") +@Data +@ApiModel(description = "会员") +public class Vip { + /** + * 主键id + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + @ApiModelProperty(value = "主键id") + private Integer id; + + /** + * 会员名称 + */ + @TableField("vipName") + @ApiModelProperty(value = "会员名称") + private String vipName; + + /** + * 会员时长类型 1天 2月 3年 + */ + @TableField("timeType") + @ApiModelProperty(value = "会员时长类型 1天 2月 3年") + private Integer timeType; + + /** + * 会员时长 + */ + @TableField("time") + @ApiModelProperty(value = "会员时长数量 对应会员时长类型 x天 x月 x年") + private Integer time; + + /** + * 会员价格 + */ + @TableField("price") + @ApiModelProperty(value = "会员价格") + private BigDecimal price; + + /** + * 状态 1上架2下架 + */ + @TableField("status") + @ApiModelProperty(value = "状态 1上架2下架") + private Integer status; + + /** + * 添加时间 + */ + @TableField("insertTime") + @ApiModelProperty(value = "添加时间") + private Date insertTime; + /** + * 添加时间 + */ + @TableField("couponJson") + @ApiModelProperty(value = "优惠券json[{\n" + + "\t\"id\": \"1\",\n" + + "\t\"value\": \"1\"\n" + + "}, {\n" + + "\t\"id\": \"2\",\n" + + "\t\"value\": \"1\"\n" + + "}\n" + + "}]") + private String couponJson; + /** + * 添加时间 + */ + @TableField("ticketJson") + @ApiModelProperty(value = "门票json门票json[{\n" + + "\t\"name\": \"门票名称\",\n" + + "\t\"time\": \"1\",\n" + + "\"count\": \"1\",\n" + + "}]") + private String ticketJson; + + /** + * 会员优惠券权益 + */ + @TableField(exist = false) + @ApiModelProperty(value = "会员优惠券权益") + private List<CouponVipResp> couponList; + /** + * 会员门票权益 + */ + @TableField(exist = false) + @ApiModelProperty(value = "会员门票权益") + private List<TicketVipResp> ticketList; +} diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/entity/VipCouponTicketListResp.java b/cloud-server-activity/src/main/java/com/dsh/activity/entity/VipCouponTicketListResp.java new file mode 100644 index 0000000..c0b888f --- /dev/null +++ b/cloud-server-activity/src/main/java/com/dsh/activity/entity/VipCouponTicketListResp.java @@ -0,0 +1,22 @@ +package com.dsh.activity.entity; + + +import com.dsh.activity.model.ConponJsonRuleModel; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +@Data +@ApiModel("购买会员获得的权益列表") +public class VipCouponTicketListResp { + + @ApiModelProperty("有效时间(2021-05-05)") + private List<CouponVipResp> couponVipRespList; + @ApiModelProperty("数量 张") + private List<TicketVipResp> ticketVipRespList; + + + +} diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/entity/VipDetail.java b/cloud-server-activity/src/main/java/com/dsh/activity/entity/VipDetail.java index 8cb389d..a5528b1 100644 --- a/cloud-server-activity/src/main/java/com/dsh/activity/entity/VipDetail.java +++ b/cloud-server-activity/src/main/java/com/dsh/activity/entity/VipDetail.java @@ -15,7 +15,7 @@ public class VipDetail { @ApiModelProperty(value = "主键") - @TableId(value = "id", type = IdType.NONE) + @TableId(value = "id", type = IdType.AUTO) private Integer id; @ApiModelProperty(value = "用户id") diff --git a/cloud-server-activity/src/main/java/com/dsh/activity/feignclient/other/VipClient.java b/cloud-server-activity/src/main/java/com/dsh/activity/feignclient/other/VipClient.java new file mode 100644 index 0000000..61b92fa --- /dev/null +++ b/cloud-server-activity/src/main/java/com/dsh/activity/feignclient/other/VipClient.java @@ -0,0 +1,22 @@ +package com.dsh.activity.feignclient.other; + +import com.dsh.activity.entity.Vip; +import org.springframework.cloud.openfeign.FeignClient; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; + +import java.util.List; + + +@FeignClient("mb-cloud-other") +public interface VipClient { + + + @PostMapping("/vip/listAll") + List<Vip> listAll(); + @PostMapping("/vip/getVipByIds") + List<Vip> getVipByIds(@RequestBody String ids); + @PostMapping("/vip/getAgreement") + String getAgreement(); + +} diff --git a/cloud-server-management/src/main/java/com/dsh/course/feignClient/activity/model/Coupon.java b/cloud-server-management/src/main/java/com/dsh/course/feignClient/activity/model/Coupon.java index 6572476..849ebd9 100644 --- a/cloud-server-management/src/main/java/com/dsh/course/feignClient/activity/model/Coupon.java +++ b/cloud-server-management/src/main/java/com/dsh/course/feignClient/activity/model/Coupon.java @@ -133,6 +133,10 @@ */ private Integer cityManagerId; /** + * 积分商品id + */ + private Integer goodsId; + /** * 数量 */ private Integer count; diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TAgreeController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TAgreeController.java index 6ac41f4..bbdd362 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TAgreeController.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TAgreeController.java @@ -53,22 +53,22 @@ Protocol three = protocolService.getOne(new LambdaQueryWrapper<Protocol>().eq(Protocol::getType, 3)); Protocol four = protocolService.getOne(new LambdaQueryWrapper<Protocol>().eq(Protocol::getType, 4)); Protocol five = protocolService.getOne(new LambdaQueryWrapper<Protocol>().eq(Protocol::getType, 5)); - Protocol six = protocolService.getOne(new LambdaQueryWrapper<Protocol>().eq(Protocol::getType, 6)); + Protocol seven = protocolService.getOne(new LambdaQueryWrapper<Protocol>().eq(Protocol::getType, 7)); model.addAttribute("one",one); model.addAttribute("two",two); model.addAttribute("three",three); model.addAttribute("four",four); model.addAttribute("five",five); - if (six == null){ + if (seven == null){ Protocol protocol = new Protocol(); - protocol.setType(6); + protocol.setType(7); protocol.setContent(""); protocol.setInsertTime(new Date()); protocolService.save( protocol); - model.addAttribute("six",protocol); + model.addAttribute("seven",protocol); }else{ - model.addAttribute("six",six); + model.addAttribute("seven",seven); } return PREFIX + "tAgreementDriver.html"; diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java index 06fc408..b037baa 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java @@ -455,6 +455,9 @@ //玩湃惠民卡 StoreConfig c10 = storeConfigService.getOne(new LambdaQueryWrapper<StoreConfig>().eq(StoreConfig::getStoreId, id).eq(StoreConfig::getType,10)); model.addAttribute("c10",c10); + //会员卡板块 + StoreConfig c11 = storeConfigService.getOne(new LambdaQueryWrapper<StoreConfig>().eq(StoreConfig::getStoreId, id).eq(StoreConfig::getType,11)); + model.addAttribute("c11",c11); return PREFIX + "TShop_imgAll.html"; } @@ -743,9 +746,9 @@ } @RequestMapping(value = "/saveImgAll") @ResponseBody - public Object saveImgAll(Integer id,Integer px1,Integer px2,Integer px3,Integer px4,Integer px5,Integer px6,Integer px7,Integer px8,Integer px10, - String c1,String c2,String c3,String c4,String c5,String c6,String c7,String c8,String c10, - Integer r1,Integer r2,Integer r3,Integer r4,Integer r5,Integer r6,Integer r7,Integer r8,Integer r10,String str) { + public Object saveImgAll(Integer id,Integer px1,Integer px2,Integer px3,Integer px4,Integer px5,Integer px6,Integer px7,Integer px8,Integer px10,Integer px11, + String c1,String c2,String c3,String c4,String c5,String c6,String c7,String c8,String c10,String c111, + Integer r1,Integer r2,Integer r3,Integer r4,Integer r5,Integer r6,Integer r7,Integer r8,Integer r10,Integer r11,String str) { try { ArrayList<StoreConfig> storeConfigs = new ArrayList<>(); StoreConfig collect1 = collect(id, px1, r1, c1, 1); @@ -757,6 +760,7 @@ StoreConfig collect7 = collect(id, px7, r7, c7, 7); StoreConfig collect8 = collect(id, px8, r8, c8, 8); StoreConfig collect10 = collect(id, px10, r10, c10, 10); + StoreConfig collect11 = collect(id, px11, r11, c111, 11); storeConfigs.add(collect1); storeConfigs.add(collect2); storeConfigs.add(collect3); @@ -766,6 +770,7 @@ storeConfigs.add(collect7); storeConfigs.add(collect8); storeConfigs.add(collect10); + storeConfigs.add(collect11); storeConfigService.saveOrUpdateBatch(storeConfigs); // 修改世界杯 diff --git a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipController.java b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipController.java index 58c4f4e..716e013 100644 --- a/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipController.java +++ b/cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TVipController.java @@ -329,118 +329,7 @@ } // APP查询所有上架的会员卡 - @ResponseBody - @PostMapping("/listAll") - public List<Vip> listAll() { - List<Vip> list = vipService.lambdaQuery().eq(Vip::getStatus, 1).list(); - List<Coupon> coupons = couponClient.queryCouponAll(); - List<CouponCity> couponCityList = couponClient.queryAllCity(); - List<CouponStore> storeList = couponClient.queryAllStore(); - List<TStore> shopList = storeService.list(); - // 封装会员权益 - for (Vip vip : list) { - List<CouponVipResp> couponVipRespList = new ArrayList<>(); - List<TicketVipResp> ticketVipRespList = new ArrayList<>(); - String couponJson = vip.getCouponJson(); - JSONArray couponJsonArray = JSONArray.parseArray(couponJson); - for (Object o : couponJsonArray) { - JSONObject couponJsonObject = (JSONObject) o; - // 优惠券id - Integer id = Integer.valueOf(couponJsonObject.getString("id")); - // 优惠券数量 - Integer value = Integer.valueOf(couponJsonObject.getString("value")); - Coupon coupon = coupons.stream().filter(e -> e.getId().equals(id)).findFirst().orElse(new Coupon()); - CouponVipResp couponVipResp = new CouponVipResp(); - couponVipResp.setId(coupon.getId()); - couponVipResp.setName(coupon.getName()); - couponVipResp.setType(coupon.getType()); - couponVipResp.setUseCondition(coupon.getUseScope()); - couponVipResp.setCount(value); - switch (coupon.getUseScope()) { - case 1: - couponVipResp.setAvailable("全国通用"); - break; - case 2: - couponVipResp.setAvailable("指定城市可用"); - List<CouponCity> couponId = couponCityList.stream().filter(e -> e.getCouponId().equals(id)) - .collect(Collectors.toList()); - StringBuilder stringBuilder = new StringBuilder(); - for (CouponCity couponCity : couponId) { - stringBuilder.append(couponCity.getCity()); - } - couponVipResp.setCityOrStore(String.valueOf(stringBuilder)); - break; - case 3: - couponVipResp.setAvailable("指定门店可用"); - // 门店ids - List<Integer> storeIds = storeList.stream().filter(e -> e.getCouponId().equals(id)) - .map(CouponStore::getStoreId).collect(Collectors.toList()); - StringBuilder storeNames = new StringBuilder(""); - if (!storeIds.isEmpty()) { - List<TStore> stores = shopList.stream().filter(e -> storeIds.contains(e.getId())).collect(Collectors.toList()); - for (TStore store : stores) { - storeNames.append(store.getName()).append(","); - } - // 去除最后一位 - StringBuilder res = storeNames.deleteCharAt(storeNames.length() - 1); - couponVipResp.setCityOrStore(res.toString()); - } else { - couponVipResp.setCityOrStore("无可用门店"); - } - break; - default: - break; - } - couponVipResp.setInstructionsForUse(coupon.getIllustrate()); - ConponJsonRuleModel ruleModel = new ConponJsonRuleModel(); - JSONObject jsonObject = JSON.parseObject(coupon.getContent()); - switch (coupon.getType()) { - case 1: -// 满减券 - Double num1 = jsonObject.getDouble("conditionalAmount"); - Double num2 = jsonObject.getDouble("deductionAmount"); - ruleModel.setConditionalAmount("满" + num1 + "可用"); - ruleModel.setDeductionAmount("¥ " + num2); - ruleModel.setExperienceName(""); - break; - case 2: -// 代金券 - Double jsonObjectDouble = jsonObject.getDouble("conditionalAmount"); - ruleModel.setConditionalAmount(""); - ruleModel.setDeductionAmount("¥ " + jsonObjectDouble); - ruleModel.setExperienceName(""); - break; - case 3: -// 体验券 - ruleModel.setConditionalAmount(""); - ruleModel.setDeductionAmount(""); - ruleModel.setExperienceName(jsonObject.getString("experienceName")); - break; - default: - break; - } - couponVipResp.setRuleModel(ruleModel); - - SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); - couponVipResp.setEffectiveTime(simpleDateFormat.format(coupon.getEndTime())); - couponVipRespList.add(couponVipResp); - } - vip.setCouponList(couponVipRespList); - String ticketJson = vip.getTicketJson(); - JSONArray ticketJsonArray = JSONArray.parseArray(ticketJson); - for (Object o : ticketJsonArray) { - JSONObject ticketJsonObject = (JSONObject) o; - TicketVipResp ticketVipResp = new TicketVipResp(); - ticketVipResp.setName(ticketJsonObject.getString("name")); - ticketVipResp.setTime(ticketJsonObject.getInteger("time")); - ticketVipResp.setCount(ticketJsonObject.getInteger("count")); - ticketVipRespList.add(ticketVipResp); - } - vip.setTicketList(ticketVipRespList); - } - return list; - } @Autowired private IProtocolService protocolService; @ResponseBody diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tAgreement/tAgreementDriver.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tAgreement/tAgreementDriver.html index 23c6ff9..266ac1b 100644 --- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tAgreement/tAgreementDriver.html +++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tAgreement/tAgreementDriver.html @@ -17,7 +17,7 @@ <li class=""><a data-toggle="tab" href="#tab-3" aria-expanded="false">运动安全告知书</a></li> <li class=""><a data-toggle="tab" href="#tab-4" aria-expanded="false">注销账号说明</a></li> <li class=""><a data-toggle="tab" href="#tab-5" aria-expanded="false">社区世界杯报名协议</a></li> - <li class=""><a data-toggle="tab" href="#tab-6" aria-expanded="false">会员协议</a></li> + <li class=""><a data-toggle="tab" href="#tab-7" aria-expanded="false">会员协议</a></li> </ul> <div class="tab-content"> <div id="tab-1" class="tab-pane active"> @@ -72,12 +72,12 @@ </div> </div> </div> - <div id="tab-6" class="tab-pane"> + <div id="tab-7" class="tab-pane"> <div class="panel-body"> - <textarea type="text/plain" id="editor_6" style="width:1200px;height:400px;">${six.content}</textarea> + <textarea type="text/plain" id="editor_7" style="width:1200px;height:400px;">${seven.content}</textarea> <div class="row btn-group-m-t"> <div class="col-sm-10 col-sm-offset-5"> - <#button btnCss="info" name="保存" id="ensure" icon="fa-check" clickFun="update_6(${six.id});"/> + <#button btnCss="info" name="保存" id="ensure" icon="fa-check" clickFun="update_7(${seven.id});"/> </div> </div> </div> @@ -97,6 +97,7 @@ var editor_3 = null; var editor_4 = null; var editor_5 = null; + var editor_7 = null; $(function () { //初始化编辑器 editor_1 = UE.getEditor('editor_1'); @@ -104,6 +105,8 @@ editor_3 = UE.getEditor('editor_3'); editor_4 = UE.getEditor('editor_4'); editor_5 = UE.getEditor('editor_5'); + editor_7 = UE.getEditor('editor_7'); + }); function update_1(id){ @@ -141,12 +144,12 @@ } submitData(editor_5.getContent(),id); } - function update_6(id){ - if (editor_6.getContentTxt() == ""){ + function update_7(id){ + if (editor_7.getContentTxt() == ""){ Feng.error("内容不能为空!"); return; } - submitData(editor_6.getContent(),id); + submitData(editor_7.getContent(),id); } function submitData(content,id) { diff --git a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_imgAll.html b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_imgAll.html index 2d6158f..8262afb 100644 --- a/cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_imgAll.html +++ b/cloud-server-management/src/main/webapp/WEB-INF/view/system/tShop/TShop_imgAll.html @@ -31,6 +31,9 @@ @if(c10!=null){ <input hidden id="s10" value="${c10.isOpen}"> @} + @if(c11!=null){ + <input hidden id="s11" value="${c11.isOpen}"> + @} <div class="row"> <div class="col-lg-6" style=""> <div class="form-group" style="margin-left: 96px"> @@ -295,6 +298,33 @@ @} </div> </div> + <div style="font-size: x-large;">会员卡板块</div> + <div class="form-group"> + <div class="col-lg-6" style=""> + <div class="form-group" style="margin-left: 96px"> + <label class="col-sm-3 control-label" > + 会员卡:<input type="radio" name="r11" value="1">开启 <input type="radio" name="r11" value="0">关闭 + </label> + </div> + <div class="form-group"> + <label class="col-sm-3 control-label">排序:</label> + <div class="col-sm-9"> + @if(c11==null){ + <input class="form-control" style="width: 200px;" type="text" id="px11" value=""> + @} + @if(c11!=null){ + <input class="form-control" style="width: 200px;" type="text" id="px11" value="${c11.sort}"> + @} + </div> + </div> + @if(c11==null){ + <#avatar id="c111" name="背景图" /> + @} + @if(c11!=null){ + <#avatar id="c111" name="背景图" avatarImg="${c11.backgroundImage}"/> + @} + </div> + </div> <div style="font-size: x-large;">首页其他板块设置</div> <#button name="添加" icon="fa-plus" clickFun="TCompetition.openAddTCompetition(id)"/> <#button name="编辑" icon="fa-edit" clickFun="TCompetition.openTCompetitionDetail1()" space="true"/> @@ -374,6 +404,12 @@ OBJradio[i].checked=true//修改选中状态 } } + var OBJradio=document.getElementsByName("r11") + for(i=0;i<OBJradio.length;i++){//循环查找这个radio + if($("#s11").val()==OBJradio[i].value){//判断是否与radio的值相同 + OBJradio[i].checked=true//修改选中状态 + } + } // for (let i = 0; i < $('input[name="isOpen"]').length; i++) { // var OBJradio=document.getElementsByName("r9") // for(i=0;i<OBJradio.length;i++){//循环查找这个radio diff --git a/cloud-server-management/src/main/webapp/static/modular/system/tShop/tShopOther.js b/cloud-server-management/src/main/webapp/static/modular/system/tShop/tShopOther.js index 8384dc2..e06a346 100644 --- a/cloud-server-management/src/main/webapp/static/modular/system/tShop/tShopOther.js +++ b/cloud-server-management/src/main/webapp/static/modular/system/tShop/tShopOther.js @@ -327,6 +327,7 @@ var px7 = $("#px7").val() var px8 = $("#px8").val() var px10 = $("#px10").val() + var px11 = $("#px11").val() var c1 = $("#c1").val() var c2 = $("#c2").val() var c3 = $("#c3").val() @@ -336,6 +337,7 @@ var c7 = $("#7").val() var c8 = $("#c8").val() var c10 = $("#c10").val() + var c111 = $("#c111").val() var r1 = document.querySelector('input[name="r1"]').checked; var r2 = document.querySelector('input[name="r2"]').checked; var r3 = document.querySelector('input[name="r3"]').checked; @@ -345,6 +347,7 @@ var r7 = document.querySelector('input[name="r7"]').checked; var r8 = document.querySelector('input[name="r8"]').checked; var r10 = document.querySelector('input[name="r10"]').checked; + var r11 = document.querySelector('input[name="r11"]').checked; var json1=[]; for (let i = 0; i < $('input[name="px9"]').length; i++) { @@ -412,6 +415,11 @@ }else{ r10=0 } + if(r11){ + r11 =1 + }else{ + r11=0 + } var ajax = new $ax(Feng.ctxPath + "/tShop/saveImgAll", function(data){ if(data.code == 200){ @@ -434,6 +442,7 @@ ajax.set("px7",px7); ajax.set("px8",px8); ajax.set("px10",px10); + ajax.set("px11",px11); ajax.set("c1",c1); ajax.set("c2",c2); ajax.set("c3",c3); @@ -443,6 +452,7 @@ ajax.set("c7",c7); ajax.set("c8",c8); ajax.set("c10",c10); + ajax.set("c111",c111); ajax.set("r1",r1); ajax.set("r2",r2); ajax.set("r3",r3); @@ -452,6 +462,7 @@ ajax.set("r7",r7); ajax.set("r8",r8); ajax.set("r10",r10); + ajax.set("r11",r11); ajax.set("str",JSON.stringify(json1)); ajax.start(); } @@ -525,6 +536,9 @@ var carPhoto = new $WebUpload("c10"); carPhoto.setUploadBarId("progressBar"); carPhoto.init(); + var carPhoto = new $WebUpload("c111"); + carPhoto.setUploadBarId("progressBar"); + carPhoto.init(); for (let i = 0; i < $('input[name="px9"]').length; i++) { diff --git a/cloud-server-other/src/main/java/com/dsh/other/controller/TVipController.java b/cloud-server-other/src/main/java/com/dsh/other/controller/TVipController.java new file mode 100644 index 0000000..d1e0d3e --- /dev/null +++ b/cloud-server-other/src/main/java/com/dsh/other/controller/TVipController.java @@ -0,0 +1,202 @@ +package com.dsh.other.controller; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; + +import com.dsh.other.entity.Protocol; +import com.dsh.other.entity.Store; +import com.dsh.other.feignclient.activity.CouponClient; +import com.dsh.other.feignclient.activity.model.Coupon; +import com.dsh.other.feignclient.activity.model.PointsMerchandise; +import com.dsh.other.model.*; +import com.dsh.other.service.IProtocolService; +import com.dsh.other.service.IVipService; +import com.dsh.other.service.StoreService; +import com.dsh.other.util.ResultUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.*; + +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.*; +import java.util.stream.Collectors; + +/** + * @author zhibing.pu + * @Date 2023/8/1 14:02 + */ +@Controller +@RequestMapping("/vip") +public class TVipController { + + @Autowired + private IVipService vipService; + @Autowired + private CouponClient couponClient; + @Autowired + private StoreService storeService; + + + + // APP查询所有上架的会员卡 + @ResponseBody + @PostMapping("/listAll") + public List<Vip> listAll() { + List<Vip> list = vipService.lambdaQuery().eq(Vip::getStatus, 1).list(); + List<Coupon> coupons = couponClient.queryCouponAll(); + List<CouponCity> couponCityList = couponClient.queryAllCity(); + List<PointsMerchandise> pointsMerchandiseList = couponClient.queryAllPointGoods(); + List<CouponStore> storeList = couponClient.queryAllStore(); + List<Store> shopList = storeService.list(); + // 封装会员权益 + for (Vip vip : list) { + List<CouponVipResp> couponVipRespList = new ArrayList<>(); + List<TicketVipResp> ticketVipRespList = new ArrayList<>(); + String couponJson = vip.getCouponJson(); + JSONArray couponJsonArray = JSONArray.parseArray(couponJson); + for (Object o : couponJsonArray) { + JSONObject couponJsonObject = (JSONObject) o; + // 优惠券id + Integer id = Integer.valueOf(couponJsonObject.getString("id")); + // 优惠券数量 + Integer value = Integer.valueOf(couponJsonObject.getString("value")); + Coupon coupon = coupons.stream().filter(e -> e.getId().equals(id)).findFirst().orElse(new Coupon()); + CouponVipResp couponVipResp = new CouponVipResp(); + couponVipResp.setId(coupon.getId()); + couponVipResp.setName(coupon.getName()); + couponVipResp.setType(coupon.getType()); + couponVipResp.setUseCondition(coupon.getUseScope()); + couponVipResp.setCount(value); + switch (coupon.getUseScope()) { + case 1: + couponVipResp.setAvailable("全国通用"); + break; + case 2: + couponVipResp.setAvailable("指定城市可用"); + List<CouponCity> couponId = couponCityList.stream().filter(e -> e.getCouponId().equals(id)) + .collect(Collectors.toList()); + StringBuilder stringBuilder = new StringBuilder(); + for (CouponCity couponCity : couponId) { + stringBuilder.append(couponCity.getCity()); + } + couponVipResp.setCityOrStore(String.valueOf(stringBuilder)); + break; + case 3: + couponVipResp.setAvailable("指定门店可用"); + // 门店ids + List<Integer> storeIds = storeList.stream().filter(e -> e.getCouponId().equals(id)) + .map(CouponStore::getStoreId).collect(Collectors.toList()); + StringBuilder storeNames = new StringBuilder(""); + + if (!storeIds.isEmpty()) { + List<Store> stores = shopList.stream().filter(e -> storeIds.contains(e.getId())).collect(Collectors.toList()); + for (Store store : stores) { + storeNames.append(store.getName()).append(","); + } + // 去除最后一位 + StringBuilder res = storeNames.deleteCharAt(storeNames.length() - 1); + couponVipResp.setCityOrStore(res.toString()); + } else { + couponVipResp.setCityOrStore("无可用门店"); + } + break; + default: + break; + } + couponVipResp.setInstructionsForUse(coupon.getIllustrate()); + ConponJsonRuleModel ruleModel = new ConponJsonRuleModel(); + JSONObject jsonObject = JSON.parseObject(coupon.getContent()); + switch (coupon.getType()) { + case 1: +// 满减券 + Double num1 = jsonObject.getDouble("conditionalAmount"); + Double num2 = jsonObject.getDouble("deductionAmount"); + ruleModel.setConditionalAmount("满" + num1 + "可用"); + ruleModel.setDeductionAmount("¥ " + num2); + ruleModel.setExperienceName(""); + break; + case 2: +// 代金券 + Double jsonObjectDouble = jsonObject.getDouble("conditionalAmount"); + ruleModel.setConditionalAmount(""); + ruleModel.setDeductionAmount("¥ " + jsonObjectDouble); + ruleModel.setExperienceName(""); + break; + case 3: +// 体验券 + ruleModel.setConditionalAmount(""); + ruleModel.setDeductionAmount(""); + ruleModel.setExperienceName(jsonObject.getString("experienceName")); + break; + case 4: +// 抵扣券 + ruleModel.setConditionalAmount(""); + ruleModel.setDeductionAmount(""); + PointsMerchandise pointsMerchandise = pointsMerchandiseList.stream().findFirst().orElse(null); + if (pointsMerchandise!=null){ + ruleModel.setExperienceName(pointsMerchandise.getName()); + } + break; + default: + break; + } + couponVipResp.setRuleModel(ruleModel); + + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); + couponVipResp.setEffectiveTime(simpleDateFormat.format(coupon.getEndTime())); + couponVipResp.setStartTime(simpleDateFormat.format(coupon.getStartTime())); + couponVipRespList.add(couponVipResp); + } + vip.setCouponList(couponVipRespList); + String ticketJson = vip.getTicketJson(); + JSONArray ticketJsonArray = JSONArray.parseArray(ticketJson); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); + + for (Object o : ticketJsonArray) { + JSONObject ticketJsonObject = (JSONObject) o; + TicketVipResp ticketVipResp = new TicketVipResp(); + Integer count = ticketJsonObject.getInteger("count"); + ticketVipResp.setName(ticketJsonObject.getString("name")); + ticketVipResp.setTime(ticketJsonObject.getInteger("time")); + ticketVipResp.setCount(ticketJsonObject.getInteger("count")); + ticketVipResp.setStartTime(simpleDateFormat.format(new Date())); + Date date = new Date(); + // 给这个date加X天 + date.setTime(date.getTime() + ticketJsonObject.getInteger("time") * 24 * 60 * 60 * 1000); + ticketVipResp.setEffectiveTime(simpleDateFormat.format(date)); + ticketVipRespList.add(ticketVipResp); + } + vip.setTicketList(ticketVipRespList); + } + return list; + } + @Autowired + private IProtocolService protocolService; + @ResponseBody + @PostMapping("/getAgreement") + public String getAgreement() { + Protocol one = protocolService.lambdaQuery().eq(Protocol::getType, 6).one(); + if (one==null){ + Protocol protocol = new Protocol(); + protocol.setType(6); + protocol.setContent(""); + protocol.setInsertTime(new Date()); + protocolService.save( protocol); + return ""; + }else{ + return one.getContent(); + + } + } + + @ResponseBody + @PostMapping("/getVipByIds") + public List<Vip> getVipByIds(@RequestBody String ids) { + List<Vip> list = vipService.lambdaQuery().in(Vip::getId, Arrays.asList(ids.split(","))).list(); + return list; + } +} diff --git a/cloud-server-other/src/main/java/com/dsh/other/feignclient/activity/CouponClient.java b/cloud-server-other/src/main/java/com/dsh/other/feignclient/activity/CouponClient.java index a1dba2c..64b9c5d 100644 --- a/cloud-server-other/src/main/java/com/dsh/other/feignclient/activity/CouponClient.java +++ b/cloud-server-other/src/main/java/com/dsh/other/feignclient/activity/CouponClient.java @@ -1,8 +1,13 @@ package com.dsh.other.feignclient.activity; import com.dsh.other.feignclient.activity.model.Coupon; +import com.dsh.other.feignclient.activity.model.PointsMerchandise; +import com.dsh.other.model.CouponCity; +import com.dsh.other.model.CouponStore; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; + +import java.util.List; /** * @author zhibing.pu @@ -20,4 +25,12 @@ */ @PostMapping("/coupon/queryCouponById") Coupon queryCouponById(Integer id); + @PostMapping("/coupon/queryCouponAll") + List<Coupon> queryCouponAll(); + @PostMapping("/base/coupon/queryAllStore") + List<CouponStore> queryAllStore(); + @PostMapping("/base/coupon/queryAllCity") + List<CouponCity> queryAllCity(); + @PostMapping("/base/coupon/queryAllPointGoods") + List<PointsMerchandise> queryAllPointGoods(); } diff --git a/cloud-server-other/src/main/java/com/dsh/other/feignclient/activity/model/Coupon.java b/cloud-server-other/src/main/java/com/dsh/other/feignclient/activity/model/Coupon.java index abbddb7..ab55da5 100644 --- a/cloud-server-other/src/main/java/com/dsh/other/feignclient/activity/model/Coupon.java +++ b/cloud-server-other/src/main/java/com/dsh/other/feignclient/activity/model/Coupon.java @@ -1,5 +1,6 @@ package com.dsh.other.feignclient.activity.model; +import com.baomidou.mybatisplus.annotation.TableField; import com.fasterxml.jackson.annotation.JsonFormat; import lombok.Data; @@ -108,6 +109,10 @@ */ private Integer state; /** + * 积分商品id + */ + private Integer goodsId; + /** * 添加时间 */ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") diff --git a/cloud-server-other/src/main/java/com/dsh/other/feignclient/activity/model/PointsMerchandise.java b/cloud-server-other/src/main/java/com/dsh/other/feignclient/activity/model/PointsMerchandise.java new file mode 100644 index 0000000..08f7fa6 --- /dev/null +++ b/cloud-server-other/src/main/java/com/dsh/other/feignclient/activity/model/PointsMerchandise.java @@ -0,0 +1,189 @@ +package com.dsh.other.feignclient.activity.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 jqs + * @since 2023-07-04 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("t_points_merchandise") +public class PointsMerchandise extends Model<PointsMerchandise> { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + /** + * 类型(1=实体商品,2=课包商品,3=门票商品 4=优惠券) + */ + @TableField("type") + private Integer type; + /** + * 商品名称 + */ + @TableField("name") + private String name; + /** + * 课包id + */ + @TableField("coursePackageId") + private Integer coursePackageId; + /** + * 原价 + */ + @TableField("price") + private BigDecimal price; + /** + * 兑换方式(1=积分,2=现金+积分) + */ + @TableField("redemptionMethod") + private Integer redemptionMethod; + /** + * 所需现金 + */ + @TableField("cash") + private BigDecimal cash; + /** + * 所属积分 + */ + @TableField("integral") + private Integer integral; + /** + * 商品封面 + */ + @TableField("cover") + private String cover; + /** + * 商品图片 + */ + @TableField("productImages") + private String productImages; + /** + * 用户人群(1=全部用户,2=年度会员,3=已有学员用户) + */ + @TableField("userPopulation") + private Integer userPopulation; + /** + * 发放数量 + */ + @TableField("quantityIssued") + private Integer quantityIssued; + /** + * 限领数量 + */ + @TableField("pickUpQuantity") + private Integer pickUpQuantity; + /** + * 开始时间 + */ + @TableField("startTime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date startTime; + /** + * 结束时间 + */ + @TableField("endTime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date endTime; + /** + * 使用范围(1=全国,2=指定城市,3=指定门店) + */ + @TableField("useScope") + private Integer useScope; + /** + * 省 + */ + @TableField("province") + private String province; + /** + * 省编号 + */ + @TableField("provinceCode") + private String provinceCode; + /** + * 市 + */ + @TableField("city") + private String city; + /** + * 市编号 + */ + @TableField("cityCode") + private String cityCode; + /** + * 兑换说明 + */ + @TableField("redemptionInstructions") + private String redemptionInstructions; + /** + * 排序 + */ + @TableField("sort") + private Integer sort; + /** + * 状态(1=正常,2=冻结,3=删除) + */ + @TableField("state") + private Integer state; + /** + * 添加时间 + */ + @TableField("insertTime") + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date insertTime; + /** + * 课包支付配置id + */ + @TableField("coursePackageConfigId") + private Integer coursePackageConfigId; + /** + * 1=上架 2=下架 + */ + @TableField("shelves") + private Integer shelves; + @TableField("cardType") + private Integer cardType; + @TableField("status") + private Integer status; + @TableField("remark") + private String remark; + // 已领数量 + @TableField(exist = false) + private Integer pickUpQuantity3; + // 已兑换数量 + @TableField(exist = false) + private Integer pickUpQuantity4; + // 添加人id 判断是平台添加还是运营商添加 用于判断分账 + @TableField("addUserId") + private Integer addUserId; + // 添加人类型 1平台2运营商3门店 用于判断分账 + @TableField("addType") + private Integer addType; + @Override + protected Serializable pkVal() { + return this.id; + } + +} diff --git a/cloud-server-other/src/main/java/com/dsh/other/mapper/TVipMapper.java b/cloud-server-other/src/main/java/com/dsh/other/mapper/TVipMapper.java new file mode 100644 index 0000000..398c6ba --- /dev/null +++ b/cloud-server-other/src/main/java/com/dsh/other/mapper/TVipMapper.java @@ -0,0 +1,24 @@ +package com.dsh.other.mapper; + + +import com.baomidou.mybatisplus.core.mapper.BaseMapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.dsh.other.model.Vip; +import org.apache.ibatis.annotations.Param; + +import java.util.List; +import java.util.Map; + +/** + * <p> + * Mapper 接口 + * </p> + * + * @author administrator + * @since 2023-09-19 + */ +public interface TVipMapper extends BaseMapper<Vip> { + + + +} diff --git a/cloud-server-other/src/main/java/com/dsh/other/model/ConponJsonRuleModel.java b/cloud-server-other/src/main/java/com/dsh/other/model/ConponJsonRuleModel.java new file mode 100644 index 0000000..057d0ee --- /dev/null +++ b/cloud-server-other/src/main/java/com/dsh/other/model/ConponJsonRuleModel.java @@ -0,0 +1,25 @@ +package com.dsh.other.model; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + + +@Data +public class ConponJsonRuleModel { + /** + * 条件金额 + */ + @ApiModelProperty("条件金额(例如 :满xx可用)") + String conditionalAmount; + /** + * 抵扣金额(代金券 取 该字段) + */ + @ApiModelProperty("抵扣金额(代金券 取 该字段) 例如:¥ xxx") + String deductionAmount; + /** + * 体验券名称 + */ + @ApiModelProperty("体验券名称 /抵扣商品名称") + String experienceName; + +} diff --git a/cloud-server-other/src/main/java/com/dsh/other/model/CouponCity.java b/cloud-server-other/src/main/java/com/dsh/other/model/CouponCity.java new file mode 100644 index 0000000..f61250d --- /dev/null +++ b/cloud-server-other/src/main/java/com/dsh/other/model/CouponCity.java @@ -0,0 +1,65 @@ +package com.dsh.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 lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * <p> + * 优惠券使用门店关系数据 + * </p> + * + * @author jqs + * @since 2023-07-07 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("t_coupon_city") +public class CouponCity extends Model<CouponCity> { + + + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + /** + * 优惠券id + */ + private Integer couponId; + /** + * 省 + */ + @TableField("province") + private String province; + /** + * 省编号 + */ + @TableField("provinceCode") + private String provinceCode; + /** + * 市 + */ + @TableField("city") + private String city; + /** + * 市编号 + */ + @TableField("cityCode") + private String cityCode; + + + @Override + protected Serializable pkVal() { + return this.id; + } + +} diff --git a/cloud-server-other/src/main/java/com/dsh/other/model/CouponStore.java b/cloud-server-other/src/main/java/com/dsh/other/model/CouponStore.java new file mode 100644 index 0000000..e467dc0 --- /dev/null +++ b/cloud-server-other/src/main/java/com/dsh/other/model/CouponStore.java @@ -0,0 +1,52 @@ +package com.dsh.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 lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; + +import java.io.Serializable; + +/** + * <p> + * 优惠券使用门店关系数据 + * </p> + * + * @author jqs + * @since 2023-07-07 + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Accessors(chain = true) +@TableName("t_coupon_store") +public class CouponStore extends Model<CouponStore> { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + @TableId(value = "id", type = IdType.AUTO) + private Integer id; + /** + * 优惠券id + */ + @TableField("couponId") + private Integer couponId; + /** + * 门店id + */ + @TableField("storeId") + private Integer storeId; + + + @Override + protected Serializable pkVal() { + return this.id; + } + +} diff --git a/cloud-server-other/src/main/java/com/dsh/other/model/CouponVipResp.java b/cloud-server-other/src/main/java/com/dsh/other/model/CouponVipResp.java new file mode 100644 index 0000000..30b94f5 --- /dev/null +++ b/cloud-server-other/src/main/java/com/dsh/other/model/CouponVipResp.java @@ -0,0 +1,45 @@ +package com.dsh.other.model; + + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel("会员权益优惠券列表") +public class CouponVipResp { + + @ApiModelProperty("优惠券id") + private Integer id; + + @ApiModelProperty("优惠券名称") + private String name; + + @ApiModelProperty("优惠券类型(1=满减券,2=代金券,3=体验券)") + private Integer type; + + @ApiModelProperty("适用范围1全国通用 2指定城市可用 3指定门店可用") + private Integer useCondition; + + @ApiModelProperty("适用范围名称") + private String available; + + @ApiModelProperty("useCondition = 2,为地址字符串;useCondition = 3,为门店名称+地址字符串") + private String cityOrStore; + + @ApiModelProperty("优惠券说明(使用说明)") + private String instructionsForUse; + + @ApiModelProperty("金额条件封装") + private ConponJsonRuleModel ruleModel; + + @ApiModelProperty("有效时间结束(2021-05-05)") + private String effectiveTime; + @ApiModelProperty("有效时间开始(2021-05-05)") + private String startTime; + @ApiModelProperty("数量 张") + private Integer count; + + + +} diff --git a/cloud-server-other/src/main/java/com/dsh/other/model/TicketVipResp.java b/cloud-server-other/src/main/java/com/dsh/other/model/TicketVipResp.java new file mode 100644 index 0000000..27ba1c7 --- /dev/null +++ b/cloud-server-other/src/main/java/com/dsh/other/model/TicketVipResp.java @@ -0,0 +1,26 @@ +package com.dsh.other.model; + + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +@Data +@ApiModel("会员权益门票列表") +public class TicketVipResp { + + + @ApiModelProperty("门票名称") + private String name; + + @ApiModelProperty("领取后x天有效") + private Integer time; + + @ApiModelProperty("数量 张") + private Integer count; + @ApiModelProperty("有效时间(2021-05-05)") + private String effectiveTime; + @ApiModelProperty("有效时间开始(2021-05-05)") + private String startTime; + +} diff --git a/cloud-server-other/src/main/java/com/dsh/other/model/Vip.java b/cloud-server-other/src/main/java/com/dsh/other/model/Vip.java new file mode 100644 index 0000000..114a0cc --- /dev/null +++ b/cloud-server-other/src/main/java/com/dsh/other/model/Vip.java @@ -0,0 +1,107 @@ +package com.dsh.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 io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.Date; +import java.util.List; + +/** + * 会员管理 + */ +@TableName("t_vip") +@Data +@ApiModel(description = "会员") +public class Vip { + /** + * 主键id + */ + @TableId(value = "id", type = IdType.AUTO) + @TableField("id") + @ApiModelProperty(value = "主键id") + private Integer id; + + /** + * 会员名称 + */ + @TableField("vipName") + @ApiModelProperty(value = "会员名称") + private String vipName; + + /** + * 会员时长类型 1天 2月 3年 + */ + @TableField("timeType") + @ApiModelProperty(value = "会员时长类型 1天 2月 3年") + private Integer timeType; + + /** + * 会员时长 + */ + @TableField("time") + @ApiModelProperty(value = "会员时长") + private Integer time; + + /** + * 会员价格 + */ + @TableField("price") + @ApiModelProperty(value = "会员价格") + private BigDecimal price; + + /** + * 状态 1上架2下架 + */ + @TableField("status") + @ApiModelProperty(value = "状态 1上架2下架") + private Integer status; + + /** + * 添加时间 + */ + @TableField("insertTime") + @ApiModelProperty(value = "添加时间") + private Date insertTime; + /** + * 添加时间 + */ + @TableField("couponJson") + @ApiModelProperty(value = "优惠券json[{\n" + + "\t\"id\": \"1\",\n" + + "\t\"value\": \"1\"\n" + + "}, {\n" + + "\t\"id\": \"2\",\n" + + "\t\"value\": \"1\"\n" + + "}\n" + + "}]") + private String couponJson; + /** + * 添加时间 + */ + @TableField("ticketJson") + @ApiModelProperty(value = "门票json门票json[{\n" + + "\t\"name\": \"门票名称\",\n" + + "\t\"time\": \"1\",\n" + + "\"count\": \"1\",\n" + + "}]") + private String ticketJson; + + /** + * 会员优惠券权益 + */ + @TableField(exist = false) + @ApiModelProperty(value = "会员优惠券权益") + private List<CouponVipResp> couponList; + /** + * 会员门票权益 + */ + @TableField(exist = false) + @ApiModelProperty(value = "会员门票权益") + private List<TicketVipResp> ticketList; +} diff --git a/cloud-server-other/src/main/java/com/dsh/other/service/IVipService.java b/cloud-server-other/src/main/java/com/dsh/other/service/IVipService.java new file mode 100644 index 0000000..c1cfef0 --- /dev/null +++ b/cloud-server-other/src/main/java/com/dsh/other/service/IVipService.java @@ -0,0 +1,16 @@ +package com.dsh.other.service; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.IService; +import com.dsh.other.model.Vip; + +import java.util.List; +import java.util.Map; + +/** + * @author zhibing.pu + * @date 2023/6/14 15:04 + */ +public interface IVipService extends IService<Vip> { +} diff --git a/cloud-server-other/src/main/java/com/dsh/other/service/impl/TVipServiceImpl.java b/cloud-server-other/src/main/java/com/dsh/other/service/impl/TVipServiceImpl.java new file mode 100644 index 0000000..4caaae3 --- /dev/null +++ b/cloud-server-other/src/main/java/com/dsh/other/service/impl/TVipServiceImpl.java @@ -0,0 +1,27 @@ +package com.dsh.other.service.impl; + + +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.dsh.other.mapper.TVipMapper; +import com.dsh.other.model.Vip; +import com.dsh.other.service.IVipService; +import org.springframework.stereotype.Service; + +import java.util.List; +import java.util.Map; + +/** + * <p> + * 服务实现类 + * </p> + * + * @author administrator + * @since 2023-09-19 + */ +@Service +public class TVipServiceImpl extends ServiceImpl<TVipMapper, Vip> implements IVipService { + + + +} -- Gitblit v1.7.1