|
@@ -0,0 +1,106 @@
|
|
|
+package com.yonge.cooleshow.tenant.controller;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
|
|
|
+import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
|
+import com.yonge.cooleshow.biz.dal.entity.TenantInfo;
|
|
|
+import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.SmsCodeService;
|
|
|
+import com.yonge.cooleshow.biz.dal.service.TenantInfoService;
|
|
|
+import com.yonge.cooleshow.biz.dal.wrapper.TenantInfoWrapper;
|
|
|
+import com.yonge.cooleshow.common.controller.BaseController;
|
|
|
+import com.yonge.cooleshow.common.entity.HttpResponseResult;
|
|
|
+import com.yonge.cooleshow.common.security.SecurityConstants;
|
|
|
+import com.yonge.cooleshow.tenant.io.request.TenantInfoVo;
|
|
|
+import com.yonge.toolset.base.exception.BizException;
|
|
|
+import com.yonge.toolset.base.page.PageInfo;
|
|
|
+import com.yonge.toolset.base.util.StringUtil;
|
|
|
+import com.yonge.toolset.mybatis.support.PageUtil;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiImplicitParams;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.apache.ibatis.annotations.Param;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import javax.validation.Valid;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Author:haonan
|
|
|
+ * @Date:2023/7/24 9:57
|
|
|
+ * @Filename:TenantInfoController
|
|
|
+ */
|
|
|
+@RestController
|
|
|
+@RequestMapping("/tenantInfoUpdate")
|
|
|
+@Api(value = "机构信息修改", tags = "机构信息修改")
|
|
|
+public class TenantInfoController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ TenantInfoService tenantInfoService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ SysUserFeignService sysUserFeignService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SmsCodeService smsCodeService;
|
|
|
+
|
|
|
+ @ApiOperation(value = "发送登录短信验证码")
|
|
|
+ @ApiImplicitParams({ @ApiImplicitParam(name = "mobile", value = "手机号", required = true, dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "type", value = "类型(PASSWD:修改密码,LOGIN:登录或注册,BANK:绑定银行卡,PHONE:修改手机号)", required = true, dataType = "String") })
|
|
|
+ @PostMapping(value = "/sendSmsCode")
|
|
|
+ public Object sendLoginVerifyCode(String mobile,String type) throws Exception {
|
|
|
+ smsCodeService.sendValidCode(mobile, type, ClientEnum.SYSTEM);
|
|
|
+ return succeed();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "校验短信验证码")
|
|
|
+ @ApiImplicitParams({ @ApiImplicitParam(name = "phone", value = "手机号", required = true, dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "code", value = "短信验证码", required = true, dataType = "String"),
|
|
|
+ @ApiImplicitParam(name = "type", value = "类型(PASSWD:修改密码,LOGIN:登录或注册,BANK:绑定银行卡,PHONE:修改手机号)", required = true, dataType = "String") })
|
|
|
+ @PostMapping(value = "/verifySmsCode")
|
|
|
+ public Object verifySmsCode(String phone,String code,String type) {
|
|
|
+ if(StringUtils.isEmpty(phone) || StringUtils.isEmpty(code)){
|
|
|
+ return failed(SecurityConstants.PARAM_VERIFY_EXCEPTION);
|
|
|
+ }
|
|
|
+ if(smsCodeService.verifyValidCode(phone,code,type)){
|
|
|
+ return succeed();
|
|
|
+ }
|
|
|
+ return failed("验证码校验失败");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改数据
|
|
|
+ */
|
|
|
+ @PostMapping("/update")
|
|
|
+ @ApiOperation(value = "修改机构信息", notes = "传入TenantInfo")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('tenantInfoUpdate/update')")
|
|
|
+ public HttpResponseResult<Boolean> updateTenantInfo(@Valid @RequestBody TenantInfoVo.TenantInfo info) {
|
|
|
+
|
|
|
+ return succeed(tenantInfoService.update(JSON.parseObject(info.jsonString(), TenantInfo.class)));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询详细
|
|
|
+ */
|
|
|
+ @PostMapping("/detail")
|
|
|
+ @ApiOperation(value = "查询详细", notes = "查询详细")
|
|
|
+ @PreAuthorize("@pcs.hasPermissions('tenantInfoUpdate/detail')")
|
|
|
+ public HttpResponseResult<TenantInfoWrapper.TenantInfo> detail(@RequestParam("id")Long id) {
|
|
|
+ TenantInfoWrapper.TenantInfo info = tenantInfoService.detailTenantInfo(id);
|
|
|
+
|
|
|
+ return succeed(info);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+}
|