|
@@ -1,32 +1,28 @@
|
|
package com.yonge.cooleshow.tenant.controller;
|
|
package com.yonge.cooleshow.tenant.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
import com.alibaba.fastjson.JSON;
|
|
-import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
|
|
|
+import com.google.gson.JsonObject;
|
|
|
|
+import com.timevale.tech.sdk.seal.IFontsLoader;
|
|
import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
|
|
import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
|
|
import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
import com.yonge.cooleshow.auth.api.entity.SysUser;
|
|
|
|
+import com.yonge.cooleshow.biz.dal.entity.TenantAlbumPurchase;
|
|
import com.yonge.cooleshow.biz.dal.entity.TenantInfo;
|
|
import com.yonge.cooleshow.biz.dal.entity.TenantInfo;
|
|
|
|
+import com.yonge.cooleshow.biz.dal.entity.TenantStaff;
|
|
import com.yonge.cooleshow.biz.dal.enums.ClientEnum;
|
|
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.service.*;
|
|
import com.yonge.cooleshow.biz.dal.wrapper.TenantInfoWrapper;
|
|
import com.yonge.cooleshow.biz.dal.wrapper.TenantInfoWrapper;
|
|
-import com.yonge.cooleshow.biz.dal.wrapper.TenantUnbindRecordWrapper;
|
|
|
|
|
|
+import com.yonge.cooleshow.common.constant.SysConfigConstant;
|
|
import com.yonge.cooleshow.common.controller.BaseController;
|
|
import com.yonge.cooleshow.common.controller.BaseController;
|
|
import com.yonge.cooleshow.common.entity.HttpResponseResult;
|
|
import com.yonge.cooleshow.common.entity.HttpResponseResult;
|
|
import com.yonge.cooleshow.common.security.SecurityConstants;
|
|
import com.yonge.cooleshow.common.security.SecurityConstants;
|
|
|
|
+import com.yonge.cooleshow.tenant.io.request.SysUserWrapper;
|
|
import com.yonge.cooleshow.tenant.io.request.TenantInfoVo;
|
|
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.Api;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
-import org.apache.ibatis.annotations.Param;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
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 org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
import javax.validation.Valid;
|
|
@@ -50,6 +46,12 @@ public class TenantInfoController extends BaseController {
|
|
@Autowired
|
|
@Autowired
|
|
private SmsCodeService smsCodeService;
|
|
private SmsCodeService smsCodeService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private TenantStaffService tenantStaffService;
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private SysConfigService sysConfigService;
|
|
|
|
+
|
|
@ApiOperation(value = "发送登录短信验证码")
|
|
@ApiOperation(value = "发送登录短信验证码")
|
|
@ApiImplicitParams({@ApiImplicitParam(name = "mobile", value = "手机号", required = true, dataType = "String"),
|
|
@ApiImplicitParams({@ApiImplicitParam(name = "mobile", value = "手机号", required = true, dataType = "String"),
|
|
@ApiImplicitParam(name = "type", value = "类型(PASSWD:修改密码,LOGIN:登录或注册,BANK:绑定银行卡,PHONE:修改手机号)", required =
|
|
@ApiImplicitParam(name = "type", value = "类型(PASSWD:修改密码,LOGIN:登录或注册,BANK:绑定银行卡,PHONE:修改手机号)", required =
|
|
@@ -78,31 +80,91 @@ public class TenantInfoController extends BaseController {
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 修改数据
|
|
|
|
|
|
+ * 机构修改数据
|
|
*/
|
|
*/
|
|
@PostMapping("/update")
|
|
@PostMapping("/update")
|
|
@ApiOperation(value = "修改机构信息", notes = "传入TenantInfo")
|
|
@ApiOperation(value = "修改机构信息", notes = "传入TenantInfo")
|
|
// @PreAuthorize("@pcs.hasPermissions('tenantInfoUpdate/update')")
|
|
// @PreAuthorize("@pcs.hasPermissions('tenantInfoUpdate/update')")
|
|
public HttpResponseResult<Boolean> updateTenantInfo(@Valid @RequestBody TenantInfoVo.TenantInfo info) {
|
|
public HttpResponseResult<Boolean> updateTenantInfo(@Valid @RequestBody TenantInfoVo.TenantInfo info) {
|
|
-
|
|
|
|
- return succeed(tenantInfoService.update(JSON.parseObject(info.jsonString(), TenantInfo.class)));
|
|
|
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
|
+ Long id = sysUser.getId();
|
|
|
|
+ TenantStaff staff = tenantStaffService.lambdaQuery().eq(TenantStaff::getUserId, id).list().get(0);
|
|
|
|
+ Long tenantId = staff.getTenantId();
|
|
|
|
+ return succeed(tenantInfoService.updateTenantInfo(JSON.parseObject(info.jsonString(), TenantInfo.class), tenantId));
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
/**
|
|
/**
|
|
- * 查询详细
|
|
|
|
|
|
+ * 当前机构查询详细
|
|
*/
|
|
*/
|
|
@PostMapping("/detail")
|
|
@PostMapping("/detail")
|
|
@ApiOperation(value = "查询详细", notes = "查询详细")
|
|
@ApiOperation(value = "查询详细", notes = "查询详细")
|
|
// @PreAuthorize("@pcs.hasPermissions('tenantInfoUpdate/detail')")
|
|
// @PreAuthorize("@pcs.hasPermissions('tenantInfoUpdate/detail')")
|
|
- public HttpResponseResult<TenantInfoWrapper.TenantInfo> detail(@RequestParam("id") Long id) {
|
|
|
|
- TenantInfoWrapper.TenantInfo info = tenantInfoService.detailTenantInfo(id);
|
|
|
|
-
|
|
|
|
|
|
+ public HttpResponseResult<TenantInfoWrapper.TenantInfo> detail() {
|
|
|
|
+ TenantInfoWrapper.TenantInfo info = new TenantInfoWrapper.TenantInfo();
|
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
|
+ Long id = sysUser.getId();
|
|
|
|
+ TenantStaff staff = tenantStaffService.lambdaQuery().eq(TenantStaff::getUserId, id).list().get(0);
|
|
|
|
+ Long tenantId = staff.getTenantId();
|
|
|
|
+ if (!(tenantId == null)){
|
|
|
|
+ info = tenantInfoService.detailTenantInfo(id);
|
|
|
|
+ }
|
|
return succeed(info);
|
|
return succeed(info);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 当前用户查询详细
|
|
|
|
+ */
|
|
|
|
+ @PostMapping("/sysUserDetail")
|
|
|
|
+ @ApiOperation(value = "查询详细", notes = "查询详细")
|
|
|
|
+// @PreAuthorize("@pcs.hasPermissions('tenantInfoUpdate/sysUserDetail')")
|
|
|
|
+ public HttpResponseResult<SysUser> sysUserDetail() {
|
|
|
|
+
|
|
|
|
+ SysUser sysUser = sysUserFeignService.queryUserInfo();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return HttpResponseResult.succeed(sysUser);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 当前用户修改信息
|
|
|
|
+ */
|
|
|
|
+ @PostMapping("/sysUserUpdate")
|
|
|
|
+ @ApiOperation(value = "用户修改", notes = "用户修改")
|
|
|
|
+// @PreAuthorize("@pcs.hasPermissions('tenantInfoUpdate/sysUserUpdate')")
|
|
|
|
+ public HttpResponseResult<Boolean> sysUserUpdate(SysUserWrapper.SysUser sysUser) {
|
|
|
|
+ com.yonge.cooleshow.biz.dal.entity.SysUser sysUser1 = JSON.parseObject(sysUser.jsonString(), com.yonge.cooleshow.biz.dal.entity.SysUser.class);
|
|
|
|
+ SysUser user = sysUserFeignService.queryUserInfo();
|
|
|
|
+ tenantInfoService.updateSysUser(sysUser1,user.getId());
|
|
|
|
+
|
|
|
|
+ //判断更改的手机所属的机构信息
|
|
|
|
+ String phone = sysUser.getPhone();
|
|
|
|
+
|
|
|
|
+ //设置默认头像
|
|
|
|
+ if (sysUser.getAvatar().isEmpty()){
|
|
|
|
+ sysUser.setAvatar(sysConfigService.findConfigValue(SysConfigConstant.DEFAULT_HEARD));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ TenantInfo info = tenantInfoService.lambdaQuery().eq(TenantInfo::getPhone, phone).list().get(0);
|
|
|
|
+ if (!(info == null)){
|
|
|
|
+ //更新tennatInfo
|
|
|
|
+ tenantInfoService.lambdaUpdate().set(TenantInfo::getPhone,phone)
|
|
|
|
+ .eq(TenantInfo::getUserId,user.getId());
|
|
|
|
+
|
|
|
|
+ //更新员工表
|
|
|
|
+ tenantStaffService.lambdaUpdate().set(TenantStaff::getNickname,sysUser.getUsername())
|
|
|
|
+ .set(TenantStaff::getAvatar,sysUser.getAvatar())
|
|
|
|
+ .eq(TenantStaff::getUserId,user.getId());
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
+ return HttpResponseResult.succeed(true);
|
|
|
|
+ }
|
|
|
|
|
|
}
|
|
}
|