| | |
| | | return R.fail("家长端发布意见反馈失败"+cause.getMessage()); |
| | | } |
| | | |
| | | @Override |
| | | public R agreement1(Integer type) { |
| | | return R.fail("获取协议失败"+cause.getMessage()); |
| | | |
| | | } |
| | | |
| | | }; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.management.api.query.UseGuideQuery; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.cloud.openfeign.FeignClient; |
| | | import org.springframework.web.bind.annotation.PathVariable; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | |
| | |
| | | @PostMapping("/tFeedback/addFeedBack") |
| | | R addFeedBack(@RequestBody TFeedback dto); |
| | | |
| | | @PostMapping("/tSysSet/agreement1/{type}") |
| | | R<String> agreement1(@PathVariable("type") Integer type); |
| | | |
| | | } |
| | |
| | | */ |
| | | @ApiModelProperty(value = "状态1未处理2已处理") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @ApiModelProperty(value = "插入时间") |
| | | private Date insertTime; |
| | | |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Integer userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public String getImg() { |
| | | return img; |
| | | } |
| | | |
| | | public void setImg(String img) { |
| | | this.img = img; |
| | | } |
| | | |
| | | public String getContent() { |
| | | return content; |
| | | } |
| | | |
| | | public void setContent(String content) { |
| | | this.content = content; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public Date getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(Date insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "TFeedback{" + |
| | | ", id=" + id + |
| | | ", userId=" + userId + |
| | | ", img=" + img + |
| | | ", content=" + content + |
| | | ", state=" + state + |
| | | ", insertTime=" + insertTime + |
| | | "}"; |
| | | } |
| | | } |
| | |
| | | { |
| | | return getValue(claims, SecurityConstants.USER_KEY); |
| | | } |
| | | /** |
| | | * 家长端根据令牌获取用户标识 |
| | | * |
| | | * @param claims 身份信息 |
| | | * @return 用户ID |
| | | */ |
| | | public static String getUserKey1(Claims claims) |
| | | { |
| | | return getValue(claims, SecurityConstants.USER_PARENT_KEY); |
| | | }/** |
| | | * 学习端根据令牌获取用户标识 |
| | | * |
| | | * @param claims 身份信息 |
| | | * @return 用户ID |
| | | */ |
| | | public static String getUserKey2(Claims claims) |
| | | { |
| | | return getValue(claims, SecurityConstants.USER_STUDY_KEY); |
| | | } |
| | | |
| | | /** |
| | | * 根据令牌获取用户ID |
| | |
| | | return unauthorizedResponse(exchange, "令牌已过期或验证不正确!"); |
| | | } |
| | | String userkey = JwtUtils.getUserKey(claims); |
| | | String userkey1 = JwtUtils.getUserKey1(claims); |
| | | String userkey2 = JwtUtils.getUserKey2(claims); |
| | | boolean islogin = redisService.hasKey(getTokenKey(userkey)); |
| | | if (!islogin) { |
| | | boolean islogin1 = redisService.hasKey(getTokenKey(userkey1)); |
| | | boolean islogin2 = redisService.hasKey(getTokenKey(userkey2)); |
| | | if (!islogin && !islogin1 && !islogin2) { |
| | | return unauthorizedResponse(exchange, "登录状态已过期"); |
| | | } |
| | | String userid = JwtUtils.getUserId(claims); |
| | |
| | | return unauthorizedResponse(exchange, "令牌验证失败"); |
| | | } |
| | | |
| | | if (org.springframework.util.StringUtils.hasLength(userkey)){ |
| | | addHeader(mutate, SecurityConstants.USER_KEY, userkey); |
| | | } |
| | | if (org.springframework.util.StringUtils.hasLength(userkey1)){ |
| | | addHeader(mutate, SecurityConstants.USER_PARENT_KEY, userkey1); |
| | | } |
| | | if (org.springframework.util.StringUtils.hasLength(userkey2)){ |
| | | addHeader(mutate, SecurityConstants.USER_STUDY_KEY, userkey2); |
| | | } |
| | | // 设置用户信息到请求 |
| | | addHeader(mutate, SecurityConstants.USER_KEY, userkey); |
| | | addHeader(mutate, SecurityConstants.DETAILS_USER_ID, userid); |
| | | addHeader(mutate, SecurityConstants.DETAILS_USERNAME, username); |
| | | // 内部请求来源参数清除 |
| | |
| | | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.system.api.model.LoginUser; |
| | | import com.ruoyi.system.api.model.LoginUserParent; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.ibatis.reflection.MetaObject; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | public void insertFill(MetaObject metaObject) { |
| | | // 获取登录信息 |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | String userName = loginUser.getUsername(); |
| | | if (StringUtils.hasLength(userName)) { |
| | | this.setFieldValByName("createBy", userName, metaObject); |
| | | this.setFieldValByName("createTime", new Date(), metaObject); |
| | | this.setFieldValByName("updateBy", userName, metaObject); |
| | | this.setFieldValByName("updateTime", new Date(), metaObject); |
| | | } else { |
| | | this.setFieldValByName("createBy", "", metaObject); |
| | | this.setFieldValByName("updateBy", "", metaObject); |
| | | this.setFieldValByName("createTime", "", metaObject); |
| | | this.setFieldValByName("updateTime", "", metaObject); |
| | | this.setFieldValByName("createTime", new Date(), metaObject); |
| | | this.setFieldValByName("updateTime", new Date(), metaObject); |
| | | if (loginUser!=null){ |
| | | String userName = loginUser.getUsername(); |
| | | if (StringUtils.hasLength(userName)) { |
| | | this.setFieldValByName("createBy", userName, metaObject); |
| | | this.setFieldValByName("createTime", new Date(), metaObject); |
| | | this.setFieldValByName("updateBy", userName, metaObject); |
| | | this.setFieldValByName("updateTime", new Date(), metaObject); |
| | | } else { |
| | | this.setFieldValByName("createBy", "", metaObject); |
| | | this.setFieldValByName("updateBy", "", metaObject); |
| | | this.setFieldValByName("createTime", "", metaObject); |
| | | this.setFieldValByName("updateTime", "", metaObject); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.web.domain.AjaxResult; |
| | | import com.ruoyi.common.core.web.page.PageInfo; |
| | | import com.ruoyi.common.security.service.TokenService; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.goods.domain.*; |
| | | import com.ruoyi.goods.dto.GoodExchangeDTO; |
| | |
| | | import com.ruoyi.goods.dto.GoodsTypeQuery; |
| | | import com.ruoyi.goods.service.*; |
| | | import com.ruoyi.goods.vo.TGoodsVO; |
| | | import com.ruoyi.system.api.model.LoginUserParent; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | return R.ok(orderService.lambdaQuery().eq(TOrder::getUserId, SecurityUtils.getUserId()) |
| | | .orderByDesc(TOrder::getCreateTime).list()); |
| | | } |
| | | /** |
| | | * 兑换记录 |
| | | */ |
| | | @GetMapping("/confirm") |
| | | @ApiOperation(value = "确认收货", tags = {"兑换记录"}) |
| | | public AjaxResult confirm(@RequestParam Integer id) { |
| | | TOrder byId = orderService.getById(id); |
| | | byId.setState(3); |
| | | return AjaxResult.success(orderService.updateById(byId)); |
| | | } |
| | | |
| | | /** |
| | | * 获取用户收货地址 |
| | |
| | | @GetMapping("/shopAddress") |
| | | @ApiOperation(value = "获取用户收货地址", tags = {"获取用户收货地址"}) |
| | | public R<List<Recipient>> shopAddress() { |
| | | return R.ok(recipientService.lambdaQuery().eq(Recipient::getUserId, SecurityUtils.getUserId()).list()); |
| | | return R.ok(recipientService.lambdaQuery().eq(Recipient::getUserId, |
| | | SecurityUtils.getUserId()).list()); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/addressSaveOrUpdate") |
| | | @ApiOperation(value = "新增收货地址/修改收货地址", tags = {"新增收货地址/修改收货地址"}) |
| | | public R<String> addressSave(@RequestBody Recipient recipient) { |
| | | recipient.setUserId(SecurityUtils.getUserId().intValue()); |
| | | return R.ok(recipientService.addressSaveOrUpdate(recipient)); |
| | | } |
| | | |
| | |
| | | */ |
| | | @GetMapping("/goodRecommend") |
| | | @ApiOperation(value = "可兑换商品推荐", tags = {"可兑换商品推荐"}) |
| | | public R<List<TGoodsVO>> goodRecommend(@RequestParam String userId) { |
| | | List<TGoodsVO> res = goodsService.goodRecommend(userId); |
| | | return R.ok(res); |
| | | public R<List<TGoodsVO>> goodRecommend(String userId) { |
| | | return R.ok(goodsService.goodRecommend(userId)); |
| | | } |
| | | |
| | | /** |
| | |
| | | public void insertFill(MetaObject metaObject) { |
| | | // 获取登录信息 |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | String userName = loginUser.getUsername(); |
| | | if (StringUtils.hasLength(userName)) { |
| | | this.setFieldValByName("createBy", userName, metaObject); |
| | | if (loginUser != null){ |
| | | String userName = loginUser.getUsername(); |
| | | if (StringUtils.hasLength(userName)) { |
| | | this.setFieldValByName("createBy", userName, metaObject); |
| | | this.setFieldValByName("createTime", new Date(), metaObject); |
| | | this.setFieldValByName("updateBy", userName, metaObject); |
| | | this.setFieldValByName("updateTime", new Date(), metaObject); |
| | | } else { |
| | | this.setFieldValByName("createBy", "", metaObject); |
| | | this.setFieldValByName("updateBy", "", metaObject); |
| | | this.setFieldValByName("createTime", "", metaObject); |
| | | this.setFieldValByName("updateTime", "", metaObject); |
| | | } |
| | | }else{ |
| | | this.setFieldValByName("createTime", new Date(), metaObject); |
| | | this.setFieldValByName("updateBy", userName, metaObject); |
| | | this.setFieldValByName("updateTime", new Date(), metaObject); |
| | | } else { |
| | | this.setFieldValByName("createBy", "", metaObject); |
| | | this.setFieldValByName("updateBy", "", metaObject); |
| | | this.setFieldValByName("createTime", "", metaObject); |
| | | this.setFieldValByName("updateTime", "", metaObject); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | return AjaxResult.success(protocol.getContent()); |
| | | } |
| | | } |
| | | @PostMapping("/agreement1/{type}") |
| | | @ApiOperation(value = "协议", tags = {"家长端/学习端-获取协议"}) |
| | | public R<String> agreement1(@PathVariable("type") Integer type) { |
| | | TProtocol protocol = protocolService.getOne(new QueryWrapper<TProtocol>() |
| | | .eq("type",type)); |
| | | |
| | | return R.ok(protocol.getContent()); |
| | | |
| | | } |
| | | @PostMapping("/useGuide") |
| | | @ApiOperation(value = "使用指南-列表查询", tags = {"后台-使用指南"}) |
| | | public AjaxResult<PageInfo<TUseGuide>> agreement(String title, Integer pageNumber, Integer pageSize) { |
| | |
| | | */ |
| | | @ApiModelProperty(value = "状态1未处理2已处理") |
| | | private Integer state; |
| | | /** |
| | | * 添加时间 |
| | | */ |
| | | @ApiModelProperty(value = "插入时间") |
| | | private Date insertTime; |
| | | |
| | | |
| | | public Integer getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Integer id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public Integer getUserId() { |
| | | return userId; |
| | | } |
| | | |
| | | public void setUserId(Integer userId) { |
| | | this.userId = userId; |
| | | } |
| | | |
| | | public String getImg() { |
| | | return img; |
| | | } |
| | | |
| | | public void setImg(String img) { |
| | | this.img = img; |
| | | } |
| | | |
| | | public String getContent() { |
| | | return content; |
| | | } |
| | | |
| | | public void setContent(String content) { |
| | | this.content = content; |
| | | } |
| | | |
| | | public Integer getState() { |
| | | return state; |
| | | } |
| | | |
| | | public void setState(Integer state) { |
| | | this.state = state; |
| | | } |
| | | |
| | | public Date getInsertTime() { |
| | | return insertTime; |
| | | } |
| | | |
| | | public void setInsertTime(Date insertTime) { |
| | | this.insertTime = insertTime; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "TFeedback{" + |
| | | ", id=" + id + |
| | | ", userId=" + userId + |
| | | ", img=" + img + |
| | | ", content=" + content + |
| | | ", state=" + state + |
| | | ", insertTime=" + insertTime + |
| | | "}"; |
| | | } |
| | | } |
| | |
| | | <result column="img" property="img" /> |
| | | <result column="content" property="content" /> |
| | | <result column="state" property="state" /> |
| | | <result column="insertTime" property="insertTime" /> |
| | | </resultMap> |
| | | |
| | | <!-- 通用查询结果列 --> |
| | | <sql id="Base_Column_List"> |
| | | id, userId, img, content, state, insertTime |
| | | id, userId, img, content, state |
| | | </sql> |
| | | <select id="listAll" resultType="com.ruoyi.management.vo.FeedbackVO"> |
| | | select t1.*,t2.name as name ,t2.phone as phone |
| | |
| | | and t1.state = #{req.state} |
| | | </if> |
| | | <if test="null != req.startTime"> |
| | | and t1.insertTime between #{req.startTime} and #{req.endTime} |
| | | and t1.createTime between #{req.startTime} and #{req.endTime} |
| | | </if> |
| | | order by t1.state,t1.insertTime desc |
| | | order by t1.state,t1.createTime desc |
| | | </select> |
| | | |
| | | |
| | |
| | | public void insertFill(MetaObject metaObject) { |
| | | // 获取登录信息 |
| | | LoginUser loginUser = tokenService.getLoginUser(); |
| | | this.setFieldValByName("createTime", new Date(), metaObject); |
| | | this.setFieldValByName("updateTime", new Date(), metaObject); |
| | | // String userName = loginUser.getUsername(); |
| | | // if (StringUtils.hasLength(userName)) { |
| | | // this.setFieldValByName("createBy", userName, metaObject); |
| | | // this.setFieldValByName("createTime", new Date(), metaObject); |
| | | // this.setFieldValByName("updateBy", userName, metaObject); |
| | | // this.setFieldValByName("updateTime", new Date(), metaObject); |
| | | // } else { |
| | | // this.setFieldValByName("createBy", "", metaObject); |
| | | // this.setFieldValByName("updateBy", "", metaObject); |
| | | // this.setFieldValByName("createTime", "", metaObject); |
| | | // this.setFieldValByName("updateTime", "", metaObject); |
| | | // } |
| | | if (loginUser!=null){ |
| | | String userName = loginUser.getUsername(); |
| | | if (StringUtils.hasLength(userName)) { |
| | | this.setFieldValByName("createBy", userName, metaObject); |
| | | this.setFieldValByName("createTime", new Date(), metaObject); |
| | | this.setFieldValByName("updateBy", userName, metaObject); |
| | | this.setFieldValByName("updateTime", new Date(), metaObject); |
| | | } else { |
| | | this.setFieldValByName("createBy", "", metaObject); |
| | | this.setFieldValByName("updateBy", "", metaObject); |
| | | this.setFieldValByName("createTime", "", metaObject); |
| | | this.setFieldValByName("updateTime", "", metaObject); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | |
| | | import com.ruoyi.study.dto.*; |
| | | import com.ruoyi.study.service.*; |
| | | import com.ruoyi.study.vo.*; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import io.swagger.annotations.*; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | List<TPage> data = managementClient.getPage1().getData(); |
| | | for (TPage datum : data) { |
| | | if (datum.getType() == 4) { |
| | | return AjaxResult.success(datum); |
| | | return AjaxResult.success(datum.getImg()); |
| | | } |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | @PostMapping("/parentPage") |
| | | @ApiOperation(value = "平板", tags = {"家长端-启动页"}) |
| | | public AjaxResult<String> parentPage() { |
| | | List<TPage> data = managementClient.getPage1().getData(); |
| | | for (TPage datum : data) { |
| | | if (datum.getType() == 3) { |
| | | return AjaxResult.success(datum.getImg()); |
| | | } |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | @PostMapping("/parentPage1") |
| | | @ApiOperation(value = "手机", tags = {"家长端-启动页"}) |
| | | public AjaxResult<String> parentPage1() { |
| | | List<TPage> data = managementClient.getPage1().getData(); |
| | | for (TPage datum : data) { |
| | | if (datum.getType() == 2) { |
| | | return AjaxResult.success(datum.getImg()); |
| | | } |
| | | } |
| | | return AjaxResult.success(); |
| | | } |
| | | @PostMapping("/getProtocol") |
| | | @ApiOperation(value = "获取协议", tags = {"家长端-协议"}) |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "类型 1用户 2隐私 3注销", name = "type", dataType = "string", required = true), |
| | | }) |
| | | public AjaxResult<String> getProtocol(Integer type) { |
| | | String data = managementClient.agreement1(type).getData(); |
| | | return AjaxResult.success(data); |
| | | } |
| | | |
| | | @PostMapping("/useGuide") |
| | |
| | | userService.saveOrUpdate(byId); |
| | | return AjaxResult.success("修改成功"); |
| | | } |
| | | @ResponseBody |
| | | @PostMapping("/base/wxRefund") |
| | | public void cancelMySiteCallback(HttpServletRequest request, HttpServletResponse response) { |
| | | try { |
| | | Map<String, String> map = payMoneyUtil.wxRefundCallback(request); |
| | | if (null != map) { |
| | | String code = map.get("out_refund_no"); |
| | | String refund_id = map.get("refund_id"); |
| | | String result = map.get("result"); |
| | | TVipOrder one = vipOrderService.getOne(new QueryWrapper<TVipOrder>() |
| | | .eq("outTradeNo", code) |
| | | .eq("payState", 3)); |
| | | one.setBackTime(new Date()); |
| | | vipOrderService.updateById(one); |
| | | Integer userId = one.getUserId(); |
| | | TUser byId1 = userService.getById(userId); |
| | | // 判断用户是不是第一次充值 |
| | | List<TVipOrder> list = vipOrderService.list(new QueryWrapper<TVipOrder>() |
| | | .eq("userId", userId) |
| | | .eq("payState", 2) |
| | | .orderByDesc("createTime")); |
| | | int size = list.size(); |
| | | if (size == 0){ |
| | | // 证明这是用户第一次充值会员 将首次充值会员时间和会员到期时间清空 |
| | | byId1.setVipEndTime(null); |
| | | byId1.setVipPayTime(null); |
| | | userService.updateById(byId1); |
| | | }else{ |
| | | // 最近的一次充值会员时间 |
| | | TVipOrder tVipOrder = list.get(0); |
| | | // 将会员到期时间回退到上一次 |
| | | byId1.setVipEndTime(tVipOrder.getTime()); |
| | | userService.updateById(byId1); |
| | | } |
| | | |
| | | PrintWriter out = response.getWriter(); |
| | | out.write(result); |
| | | out.flush(); |
| | | out.close(); |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | @PostMapping("/vipBack/{id}") |
| | | @ApiOperation(value = "会员退款", tags = {"管理后台-会员退款"}) |
| | | public R vipBack(@PathVariable("id") Integer id) throws AlipayApiException { |
| | |
| | | String outTradeNo = byId.getOutTradeNo(); |
| | | switch (byId.getPayType()){ |
| | | case 1: |
| | | // 微信退款 |
| | | // 微信退款 |
| | | Map<String, String> stringStringMap = payMoneyUtil.wxRefund(transactionId, outTradeNo, byId.getMoney().toString(), byId.getMoney().toString(), "/base/wxRefund"); |
| | | if (stringStringMap.get("code").equals("SUCCESS")){ |
| | | byId.setPayState(3); |
| | | byId.setBackTime(new Date()); |
| | | vipOrderService.updateById(byId); |
| | | // 用户的vip剩余时间减少 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(new Date()); |
| | | calendar.add(Calendar.MONTH, -byId.getCount()); |
| | | Date dateAfterOneMonth = calendar.getTime(); |
| | | Integer userId = byId.getUserId(); |
| | | TUser byId1 = userService.getById(userId); |
| | | // 判断用户是不是第一次充值 |
| | | List<TVipOrder> list = vipOrderService.list(new QueryWrapper<TVipOrder>() |
| | | .eq("userId", userId) |
| | | .eq("payState", 2) |
| | | .orderByDesc("createTime")); |
| | | int size = list.size(); |
| | | if (size == 0) { |
| | | // 证明这是用户第一次充值会员 将首次充值会员时间和会员到期时间清空 |
| | | byId1.setVipEndTime(null); |
| | | byId1.setVipPayTime(null); |
| | | userService.updateById(byId1); |
| | | } else { |
| | | // 最近的一次充值会员时间 |
| | | TVipOrder tVipOrder = list.get(0); |
| | | // 将会员到期时间回退到上一次 |
| | | byId1.setVipEndTime(tVipOrder.getTime()); |
| | | userService.updateById(byId1); |
| | | } |
| | | |
| | | return R.ok(); |
| | | }else{ |
| | | return R.fail(stringStringMap.get("msg")); |
| | | if (null == stringStringMap) { |
| | | return R.fail("取消退款异常"); |
| | | } |
| | | String result_code = stringStringMap.get("result_code"); |
| | | if (!"SUCCESS".equals(result_code)) { |
| | |
| | | if (!"10000".equals(code)) { |
| | | return R.fail(stringStringMap1.get("return_msg")); |
| | | } |
| | | byId.setPayState(3); |
| | | byId.setBackTime(new Date()); |
| | | vipOrderService.updateById(byId); |
| | | // 用户的vip剩余时间减少 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(new Date()); |
| | | calendar.add(Calendar.MONTH, -byId.getCount()); |
| | | Date dateAfterOneMonth = calendar.getTime(); |
| | | Integer userId = byId.getUserId(); |
| | | TUser byId1 = userService.getById(userId); |
| | | // 判断用户是不是第一次充值 |
| | | List<TVipOrder> list = vipOrderService.list(new QueryWrapper<TVipOrder>() |
| | | .eq("userId", userId) |
| | | .eq("payState", 2) |
| | | .orderByDesc("createTime")); |
| | | int size = list.size(); |
| | | if (size == 0) { |
| | | // 证明这是用户第一次充值会员 将首次充值会员时间和会员到期时间清空 |
| | | byId1.setVipEndTime(null); |
| | | byId1.setVipPayTime(null); |
| | | userService.updateById(byId1); |
| | | } else { |
| | | // 最近的一次充值会员时间 |
| | | TVipOrder tVipOrder = list.get(0); |
| | | // 将会员到期时间回退到上一次 |
| | | byId1.setVipEndTime(tVipOrder.getTime()); |
| | | userService.updateById(byId1); |
| | | } |
| | | return R.ok(); |
| | | } else { |
| | | return R.fail(stringStringMap1.get("msg")); |
| | | byId.setPayState(3); |
| | | byId.setBackTime(new Date()); |
| | | vipOrderService.updateById(byId); |
| | | // 用户的vip剩余时间减少 |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.setTime(new Date()); |
| | | calendar.add(Calendar.MONTH, -byId.getCount()); |
| | | Date dateAfterOneMonth = calendar.getTime(); |
| | | Integer userId = byId.getUserId(); |
| | | TUser byId1 = userService.getById(userId); |
| | | // 判断用户是不是第一次充值 |
| | | List<TVipOrder> list = vipOrderService.list(new QueryWrapper<TVipOrder>() |
| | | .eq("userId", userId) |
| | | .eq("payState", 2) |
| | | .orderByDesc("createTime")); |
| | | int size = list.size(); |
| | | if (size == 0){ |
| | | // 证明这是用户第一次充值会员 将首次充值会员时间和会员到期时间清空 |
| | | byId1.setVipEndTime(null); |
| | | byId1.setVipPayTime(null); |
| | | userService.updateById(byId1); |
| | | }else{ |
| | | // 最近的一次充值会员时间 |
| | | TVipOrder tVipOrder = list.get(0); |
| | | // 将会员到期时间回退到上一次 |
| | | byId1.setVipEndTime(tVipOrder.getTime()); |
| | | userService.updateById(byId1); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | return R.ok(); |
| | | } |