| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- package com.cyksj.web.controller.group;
- import com.baomidou.mybatisplus.core.toolkit.Wrappers;
- import com.cyksj.common.exception.BusinessRuntimeException;
- import com.cyksj.dto.Result;
- import com.cyksj.enums.GatewayResponse;
- import com.cyksj.mapper.GroupsRelationMapper;
- import com.cyksj.model.entity.GroupsRelation;
- import com.cyksj.model.entity.OrderDon;
- import com.cyksj.model.request.OrderPayRequest;
- import com.cyksj.model.views.RenewalView;
- import com.cyksj.service.corp.CorpService;
- import com.cyksj.service.order.OrderDonService;
- import com.cyksj.service.relation.GroupRelationFrontService;
- import com.cyksj.web.util.StpUserUtil;
- import com.ejlchina.searcher.BeanSearcher;
- import lombok.RequiredArgsConstructor;
- import lombok.extern.slf4j.Slf4j;
- import org.springframework.web.bind.annotation.*;
- import java.util.List;
- /**
- * @author chan
- * @date 2022/9/27 11:48 AM
- */
- @Slf4j
- @RequiredArgsConstructor
- @RestController
- @RequestMapping("/applets/group/relation")
- public class GroupRelationController {
- private final BeanSearcher beanSearcher;
- private final OrderDonService orderDonService;
- private final GroupsRelationMapper relationMapper;
- private final GroupRelationFrontService groupRelationFrontService;
- private final CorpService corpService;
- @RequestMapping("/get/renewal")
- public Result<List<RenewalView>> get(Boolean isLoginPopularize) {
- long userId = StpUserUtil.getLoginIdAsLong();
- List<RenewalView> list = groupRelationFrontService.getMyTicket(userId, isLoginPopularize);
- return GatewayResponse.SUCCESS.newBuilder().toResult(list);
- }
- @PostMapping("/post/renewal")
- public Result<OrderDon> renewal(@RequestBody OrderPayRequest request) throws Exception {
- long userId = StpUserUtil.getLoginIdAsLong();
- request.setUserId(userId);
- OrderDon orderDon = orderDonService.renewal(request);
- return GatewayResponse.SUCCESS.newBuilder().toResult(orderDon);
- }
- @PutMapping("/update/set/account")
- public Result<String> setAccount(@RequestBody GroupsRelation relation) {
- long userId = StpUserUtil.getLoginIdAsLong();
- GroupsRelation re = relationMapper.selectOne(Wrappers.lambdaQuery(GroupsRelation.class).eq(GroupsRelation::getId, relation.getId()).eq(GroupsRelation::getUserId, userId).last(" limit 1"));
- if (re == null) {
- throw new BusinessRuntimeException("该车票不存在,请联系客服.");
- }
- relationMapper.update(relation, Wrappers.lambdaUpdate(GroupsRelation.class).set(GroupsRelation::getAccount, relation.getAccount()).eq(GroupsRelation::getId, relation.getId()));
- return GatewayResponse.SUCCESS.newBuilder().toResult();
- }
- /**
- * 查询是否加入了企业微信
- */
- @GetMapping("/check/joinCorpWx")
- public Result<Boolean> isJoinCorpWx() {
- long userId = StpUserUtil.getLoginIdAsLong();
- Boolean flag = corpService.isJoinCorpWx(userId, false);
- return GatewayResponse.SUCCESS.newBuilder().toResult(flag);
- }
- }
|