Browse Source

Merge branch 'system-zyj' of uskycloud/usky-cloud into master

gez 2 years ago
parent
commit
b1a2a1b327

+ 46 - 7
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/controller/web/SysMobileTenantConfigController.java

@@ -2,13 +2,11 @@ package com.usky.system.controller.web;
 
 
 import com.usky.common.core.bean.ApiResult;
+import com.usky.common.security.utils.SecurityUtils;
 import com.usky.system.domain.SysMobileTenantConfig;
 import com.usky.system.service.SysMobileTenantConfigService;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
@@ -27,15 +25,56 @@ public class SysMobileTenantConfigController {
     @Autowired
     private SysMobileTenantConfigService sysMobileTenantConfigService;
 
+
     /**
-     * 移动端-登录配置查询
+     * 移动端-登录页-样式配置查询
+     *
      * @param url 域名
+     */
+    @GetMapping("getAppTenantConfig")
+    public ApiResult<List<SysMobileTenantConfig>> getAppTenantConfig(@RequestParam String url){
+        return ApiResult.success(sysMobileTenantConfigService.getAppTenantConfig(url));
+    }
+
+
+    /**
+     * 租户管理-系统配置-移动端登录页配置查询
+     *
+     * @param tenantId 租户ID
      * @return
      */
     @GetMapping("/getMobileTenantConfig")
-    public ApiResult<List<SysMobileTenantConfig>> getMobileTenantConfig(@RequestParam String url) {
-        return ApiResult.success(sysMobileTenantConfigService.getMobileTenantConfig(url));
+    public ApiResult<List<SysMobileTenantConfig>> getMobileTenantConfig(@RequestParam Integer tenantId) {
+        return ApiResult.success(sysMobileTenantConfigService.getMobileTenantConfig(tenantId));
+    }
+
+    /**
+     * 租户管理-系统配置-移动端登录页配置新增
+     *
+     * @param sysMobileTenantConfig
+     * @return
+     */
+    @PostMapping("addMobileTenantConfig")
+    public ApiResult<Void> addMobileTenantConfig(@RequestBody SysMobileTenantConfig sysMobileTenantConfig){
+        sysMobileTenantConfigService.addMobileTenantConfig(sysMobileTenantConfig);
+        return ApiResult.success();
     }
 
+    /**
+     * 租户管理-系统配置-移动端登录页配置修改
+     *
+     * @param sysMobileTenantConfig
+     * @return
+     */
+    @PostMapping("updateMobileTenantConfig")
+    public ApiResult<Void> updateMobileTenantConfig(@RequestBody SysMobileTenantConfig sysMobileTenantConfig){
+        sysMobileTenantConfigService.updateMobileTenantConfig(sysMobileTenantConfig);
+        return ApiResult.success();
+    }
 }
 
+
+
+
+
+

+ 3 - 0
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/controller/web/UserConfigController.java

@@ -45,6 +45,9 @@ public class UserConfigController extends BaseController {
         if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName(),user.getTenantId()))) {
             return ApiResult.error(BusinessErrorCode.BIZ_BUSINESS_ERROR.getCode(), "新增用户'" + user.getUserName() + "'失败,登录账号已存在");
         }
+        if(UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique1(user.getPhonenumber(),user.getTenantId()))){
+            return ApiResult.error(BusinessErrorCode.BIZ_BUSINESS_ERROR.getCode(), "新增手机号'" + user.getPhonenumber() + "'失败,手机号已存在");
+        }
         user.setCreateBy(SecurityUtils.getUsername());
         user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
         user.setCreateTime(new Date());

+ 4 - 1
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/mapper/SysMobileTenantConfigMapper.java

@@ -2,6 +2,9 @@ package com.usky.system.mapper;
 
 import com.usky.system.domain.SysMobileTenantConfig;
 import com.usky.common.mybatis.core.CrudMapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
 
 /**
  * <p>
@@ -12,5 +15,5 @@ import com.usky.common.mybatis.core.CrudMapper;
  * @since 2022-08-09
  */
 public interface SysMobileTenantConfigMapper extends CrudMapper<SysMobileTenantConfig> {
-
+    List<SysMobileTenantConfig> getAppTenantConfig(@Param("url") String url);
 }

+ 9 - 0
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/mapper/SysUserMapper.java

@@ -126,6 +126,15 @@ public interface SysUserMapper extends CrudMapper<SysUser> {
      */
     public SysUser checkPhoneUnique(String phonenumber);
 
+    /**
+     * 校验手机号码是否唯一
+     *
+     * @param phone 手机号
+     * @param tenantId 租户ID
+     * @return 结果
+     */
+    public int checkPhoneUnique1(@Param("phone") String phone, @Param("tenantId") Integer tenantId);
+
     /**
      * 校验email是否唯一
      *

+ 9 - 0
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/service/ISysUserService.java

@@ -89,6 +89,15 @@ public interface ISysUserService extends CrudService<SysUser> {
      */
     public String checkPhoneUnique(SysUser user);
 
+    /**
+     * 校验手机号码是否唯一
+     *
+     * @param phone 手机号
+     * @param tenantId 租户ID
+     * @return 结果
+     */
+    public String checkPhoneUnique1(String phone, Integer tenantId);
+
     /**
      * 校验email是否唯一
      *

+ 27 - 2
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/service/SysMobileTenantConfigService.java

@@ -15,9 +15,34 @@ import java.util.List;
  */
 public interface SysMobileTenantConfigService extends CrudService<SysMobileTenantConfig> {
     /**
-     * 移动端-登录配置查询
+     * 移动端-登录页-样式配置查询
+     *
      * @param url 域名
      * @return
      */
-    List<SysMobileTenantConfig> getMobileTenantConfig(String url);
+    List<SysMobileTenantConfig> getAppTenantConfig(String url);
+
+    /**
+     * 租户管理-系统配置-移动端登录页配置查询
+     *
+     * @param tenantId 租户Id
+     * @return
+     */
+    List<SysMobileTenantConfig> getMobileTenantConfig(Integer tenantId);
+
+    /**
+     * 租户管理-系统配置-移动端登录页配置新增
+     *
+     * @param sysMobileTenantConfig
+     * @return
+     */
+    void addMobileTenantConfig(SysMobileTenantConfig sysMobileTenantConfig);
+
+    /**
+     * 租户管理-系统配置-移动端登录页配置修改
+     *
+     * @param sysMobileTenantConfig
+     * @return
+     */
+    void updateMobileTenantConfig(SysMobileTenantConfig sysMobileTenantConfig);
 }

+ 28 - 2
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/service/impl/SysMobileTenantConfigServiceImpl.java

@@ -1,13 +1,18 @@
 package com.usky.system.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.usky.common.mybatis.core.AbstractCrudService;
+import com.usky.common.security.utils.SecurityUtils;
 import com.usky.system.domain.SysMobileTenantConfig;
+import com.usky.system.mapper.SysMobileRoleMenuMapper;
 import com.usky.system.mapper.SysMobileTenantConfigMapper;
 import com.usky.system.service.SysMobileTenantConfigService;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
+import java.time.LocalDateTime;
 import java.util.List;
 
 /**
@@ -21,12 +26,33 @@ import java.util.List;
 @Service
 public class SysMobileTenantConfigServiceImpl extends AbstractCrudService<SysMobileTenantConfigMapper, SysMobileTenantConfig> implements SysMobileTenantConfigService {
 
+
+    @Override
+    public List<SysMobileTenantConfig> getAppTenantConfig(String url){
+        List<SysMobileTenantConfig> list = baseMapper.getAppTenantConfig(url);
+        return list;
+    }
+
     @Override
-    public List<SysMobileTenantConfig> getMobileTenantConfig(String url) {
+    public List<SysMobileTenantConfig> getMobileTenantConfig(Integer tenantId) {
         LambdaQueryWrapper<SysMobileTenantConfig> query = Wrappers.lambdaQuery();
-        query.eq(SysMobileTenantConfig::getLoginDomain, url);
+        query.eq(SysMobileTenantConfig::getTenantId, tenantId);
         List<SysMobileTenantConfig> list = this.list(query);
         return list;
     }
 
+    @Override
+    public void addMobileTenantConfig(SysMobileTenantConfig sysMobileTenantConfig){
+        sysMobileTenantConfig.setCreateBy(SecurityUtils.getUsername());
+        sysMobileTenantConfig.setCreateTime(LocalDateTime.now());
+        this.save(sysMobileTenantConfig);
+    }
+
+    @Override
+    public void updateMobileTenantConfig(SysMobileTenantConfig sysMobileTenantConfig){
+        sysMobileTenantConfig.setCreateBy(SecurityUtils.getUsername());
+        sysMobileTenantConfig.setCreateTime(LocalDateTime.now());
+        this.updateById(sysMobileTenantConfig);
+    }
+
 }

+ 9 - 0
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/service/impl/SysUserServiceImpl.java

@@ -198,6 +198,15 @@ public class SysUserServiceImpl extends AbstractCrudService<SysUserMapper, SysUs
         return UserConstants.UNIQUE;
     }
 
+    @Override
+    public String checkPhoneUnique1(String phone, Integer tenantId){
+        int count = userMapper.checkPhoneUnique1(phone, tenantId);
+        if (count > 0) {
+            return UserConstants.NOT_UNIQUE;
+        }
+        return UserConstants.UNIQUE;
+    }
+
     /**
      * 校验email是否唯一
      *

+ 13 - 0
base-modules/service-system/service-system-biz/src/main/resources/mapper/system/SysMobileTenantConfigMapper.xml

@@ -22,4 +22,17 @@
         <result column="update_time" property="updateTime" />
     </resultMap>
 
+    <select id="getAppTenantConfig" resultMap="BaseResultMap">
+        select
+        b.id, a.id AS tenant_id, b.login_domain, b.login_title, b.login_logo, b.login_back_url, b.login_footer, b.login_type, b.middle_url, b.home_logo, b.home_layout,
+        b.home_style, b.create_by, b.create_time, b.update_by, b.update_time
+        from
+        sys_tenant AS a
+        LEFT JOIN sys_mobile_tenant_config AS b ON a.id = b.tenant_id
+        <where>
+            a.status = 0
+            and a.domain = #{url}
+        </where>
+    </select>
+
 </mapper>

+ 14 - 2
base-modules/service-system/service-system-biz/src/main/resources/mapper/system/SysUserMapper.xml

@@ -162,6 +162,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 	<select id="checkPhoneUnique" parameterType="String" resultMap="SysUserResult">
 		select user_id, phonenumber from sys_user where phonenumber = #{phonenumber} and del_flag = '2' limit 1
 	</select>
+
+	<select id="checkPhoneUnique1" resultType="int">
+		select count(1) from sys_user where phonenumber = #{phone} and del_flag != '2'
+		<if test="tenantId != null and tenantId != 0">
+			and tenant_id = #{tenantId}
+		</if>
+		limit 1
+	</select>
 	
 	<select id="checkEmailUnique" parameterType="String" resultMap="SysUserResult">
 		select user_id, email from sys_user where email = #{email} and del_flag = '2' limit 1
@@ -283,7 +291,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 	<select id="selectUserData" resultMap="SysUserResult">
 		select * from sys_user
-		where user_name = #{userName}
+		where
+		del_flag=0 and status=0
+		and user_name = #{userName}
 		<if test="tenantId != null and tenantId != 0">
 			and tenant_id = #{tenantId}
 		</if>
@@ -291,7 +301,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
 	<select id="selectUserDataOne" resultMap="SysUserResult">
 		select * from sys_user
-		where  phonenumber = #{phone}
+		where
+		del_flag=0 and status=0
+		and phonenumber = #{phone}
 		<if test="tenantId != null and tenantId != 0">
 			and tenant_id = #{tenantId}
 		</if>