浏览代码

1.官网添加合作机构新增接口

yuanliang 1 年之前
父节点
当前提交
bce607711d

+ 45 - 0
cooleshow-app/src/main/java/com/yonge/cooleshow/website/controller/open/OpenCooperateTenantController.java

@@ -0,0 +1,45 @@
+package com.yonge.cooleshow.website.controller.open;
+
+import com.alibaba.fastjson.JSONObject;
+import com.microsvc.toolkit.common.response.template.R;
+import com.yonge.cooleshow.biz.dal.service.CooperateTenantService;
+import com.yonge.cooleshow.biz.dal.service.SmsCodeService;
+import com.yonge.cooleshow.biz.dal.wrapper.CooperateTenantWrapper;
+import com.yonge.cooleshow.common.controller.BaseController;
+import com.yonge.toolset.base.exception.BizException;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Slf4j
+@Validated
+@RestController
+@RequestMapping("${app-config.url.website:}/open/cooperateTenant")
+@Api(tags = "合作机构")
+public class OpenCooperateTenantController extends BaseController {
+
+    @Autowired
+    private CooperateTenantService cooperateTenantService;
+
+    @Autowired
+    private SmsCodeService smsCodeService;
+
+    @ApiOperation(value = "新增", notes = "合作机构- 传入 CooperateTenantWrapper.CooperateTenant")
+    @PostMapping("/save")
+    public R<JSONObject> add(@Validated @RequestBody CooperateTenantWrapper.CooperateTenant cooperateTenant) {
+        boolean validCode = smsCodeService.verifyValidCode(cooperateTenant.getPhone(), cooperateTenant.getCode(), "");
+        if (!validCode) {
+            throw new BizException("验证码错误");
+        }
+        // 新增数据
+        cooperateTenantService.add(cooperateTenant);
+        return R.defaultR();
+    }
+
+}

+ 45 - 0
cooleshow-user/user-website/src/main/java/com/yonge/cooleshow/website/controller/open/OpenCooperateTenantController.java

@@ -0,0 +1,45 @@
+package com.yonge.cooleshow.website.controller.open;
+
+import com.alibaba.fastjson.JSONObject;
+import com.microsvc.toolkit.common.response.template.R;
+import com.yonge.cooleshow.biz.dal.service.CooperateTenantService;
+import com.yonge.cooleshow.biz.dal.service.SmsCodeService;
+import com.yonge.cooleshow.biz.dal.wrapper.CooperateTenantWrapper;
+import com.yonge.cooleshow.common.controller.BaseController;
+import com.yonge.toolset.base.exception.BizException;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+@Slf4j
+@Validated
+@RestController
+@RequestMapping("/open/cooperateTenant")
+@Api(tags = "合作机构")
+public class OpenCooperateTenantController extends BaseController {
+
+    @Autowired
+    private CooperateTenantService cooperateTenantService;
+
+    @Autowired
+    private SmsCodeService smsCodeService;
+
+    @ApiOperation(value = "新增", notes = "合作机构- 传入 CooperateTenantWrapper.CooperateTenant")
+    @PostMapping("/save")
+    public R<JSONObject> add(@Validated @RequestBody CooperateTenantWrapper.CooperateTenant cooperateTenant) {
+        boolean validCode = smsCodeService.verifyValidCode(cooperateTenant.getPhone(), cooperateTenant.getCode(), "");
+        if (!validCode) {
+            throw new BizException("验证码错误");
+        }
+        // 新增数据
+        cooperateTenantService.add(cooperateTenant);
+        return R.defaultR();
+    }
+
+}