Browse Source

增加部分接口

xda 2 years ago
parent
commit
c9aae77db9

+ 7 - 4
src/main/java/com/winhc/repal/controller/RepalGroupController.java

@@ -11,10 +11,7 @@ import com.winhc.repal.service.RepalGroupService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 
 import java.util.List;
 import java.util.List;
 
 
@@ -44,6 +41,12 @@ public class RepalGroupController {
         return BeanResponse.success(CodeMsg.SUCCESS, repalGroupService.getGroupMemberList(dto));
         return BeanResponse.success(CodeMsg.SUCCESS, repalGroupService.getGroupMemberList(dto));
     }
     }
 
 
+    @ApiOperation("套餐购买回调")
+    @RequestMapping(value = "/callback/{repalGroupId}", method = RequestMethod.POST)
+    public BeanResponse<Boolean> vipCallback(@PathVariable("repalGroupId") Long repalGroupId) {
+        return BeanResponse.success(CodeMsg.SUCCESS, repalGroupService.vipCallback(repalGroupId));
+    }
+
 
 
 
 
 
 

+ 9 - 0
src/main/java/com/winhc/repal/service/RepalGroupService.java

@@ -35,5 +35,14 @@ public interface RepalGroupService extends IService<RepalGroup> {
      */
      */
     VOPage<GroupMemberVo> getGroupMemberList(PageDTO dto);
     VOPage<GroupMemberVo> getGroupMemberList(PageDTO dto);
 
 
+    /**
+     * 购买套餐回调
+     * @param repalGroupId repalGroupId
+     * @return java.lang.Boolean
+     * @author xda
+     * @date 2022/5/18 17:03
+     */
+    Boolean vipCallback(Long repalGroupId);
+
 
 
 }
 }

+ 28 - 4
src/main/java/com/winhc/repal/service/impl/RepalGroupServiceImpl.java

@@ -6,10 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.winhc.common.model.base.VOPage;
 import com.winhc.common.model.base.VOPage;
 import com.winhc.repal.constant.Constant;
 import com.winhc.repal.constant.Constant;
-import com.winhc.repal.entity.RepalBook;
-import com.winhc.repal.entity.RepalGroup;
-import com.winhc.repal.entity.RepalGroupMember;
-import com.winhc.repal.entity.UserExt;
+import com.winhc.repal.entity.*;
 import com.winhc.repal.enums.DeletedStatusEnum;
 import com.winhc.repal.enums.DeletedStatusEnum;
 import com.winhc.repal.enums.RoleTypeEnum;
 import com.winhc.repal.enums.RoleTypeEnum;
 import com.winhc.repal.model.dto.InitGroupDTO;
 import com.winhc.repal.model.dto.InitGroupDTO;
@@ -25,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
+import java.time.LocalDateTime;
 import java.util.ArrayList;
 import java.util.ArrayList;
 import java.util.Objects;
 import java.util.Objects;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
@@ -54,6 +52,9 @@ public class RepalGroupServiceImpl extends ServiceImpl<RepalGroupMapper, RepalGr
     @Autowired
     @Autowired
     private UserExtService userExtService;
     private UserExtService userExtService;
 
 
+    @Autowired
+    private RepalVipService repalVipService;
+
     @Override
     @Override
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
     public Boolean initGroup(InitGroupDTO dto) {
     public Boolean initGroup(InitGroupDTO dto) {
@@ -112,4 +113,27 @@ public class RepalGroupServiceImpl extends ServiceImpl<RepalGroupMapper, RepalGr
         voPage.setDataList(page.getRecords().stream().map(t -> new GroupMemberVo(t.getUserId(), t.getMemberUserName())).collect(Collectors.toList()));
         voPage.setDataList(page.getRecords().stream().map(t -> new GroupMemberVo(t.getUserId(), t.getMemberUserName())).collect(Collectors.toList()));
         return voPage;
         return voPage;
     }
     }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Boolean vipCallback(Long repalGroupId) {
+        RepalVip repalVip = new RepalVip();
+        repalVip.setRepalGroupId(repalGroupId);
+        //repalVip.setRepalVipSign();
+        repalVip.setRepalVipStartTime(LocalDateTime.now());
+        //repalVip.setRepalVipEndTime();
+        //repalVip.setCurrentOrder();
+        // remainCount
+//        repalVip.setSmsRemainCount();
+//        repalVip.setLetterRemainCount();
+//        repalVip.setConsultRemainCount();
+//        repalVip.setLawsuitRemainCount();
+        // total
+//        repalVip.setSmsTotalCount();
+//        repalVip.setLetterTotalCount();
+//        repalVip.setConsultTotalCount();
+//        repalVip.setLawsuitTotalCount();
+        repalVipService.save(repalVip);
+        return true;
+    }
 }
 }