Browse Source

Merge branch 'fu-dev' of uskycloud/usky-cloud into master

gez 1 month ago
parent
commit
53a35123f1

+ 1 - 0
base-modules/service-job/src/main/resources/mapper/job/SysJobMapper.xml

@@ -41,6 +41,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 				AND invoke_target like concat('%', #{invokeTarget}, '%')
 			</if>
 		</where>
+		ORDER BY job_id DESC
 	</select>
 	
 	<select id="selectJobAll" resultMap="SysJobResult">

+ 13 - 4
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/controller/web/SysUserController.java

@@ -10,7 +10,9 @@ import com.usky.system.controller.web.page.TableDataInfo;
 import com.usky.system.domain.SysDept;
 import com.usky.system.domain.SysRole;
 import com.usky.system.domain.SysUser;
+import com.usky.system.domain.SysUserTenant;
 import com.usky.system.domain.constants.UserConstants;
+import com.usky.system.mapper.SysUserTenantMapper;
 import com.usky.system.service.ISysDeptService;
 import com.usky.system.service.ISysPostService;
 import com.usky.system.service.ISysRoleService;
@@ -29,7 +31,7 @@ import java.util.stream.Collectors;
 
 /**
  * 用户信息
- * 
+ *
  * @author yq
  */
 @RestController
@@ -48,6 +50,9 @@ public class SysUserController extends BaseController
     @Autowired
     private ISysDeptService deptService;
 
+    @Autowired
+    private SysUserTenantMapper sysUserTenantMapper;
+
     /**
      * 获取用户列表
      */
@@ -160,20 +165,24 @@ public class SysUserController extends BaseController
     @PostMapping("/appAdd")
     public ApiResult<Void> appAdd(@Validated @RequestBody SysUser user)
     {
-        if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName(),user.getTenantId())))
+        if (UserConstants.NOT_UNIQUE.equals(userService.checkUserNameUnique(user.getUserName(),0)))
         {
             return ApiResult.error(BusinessErrorCode.BIZ_BUSINESS_ERROR.getCode(), "新增用户'" + user.getUserName() + "'失败,登录账号已存在");
         }
-        if(UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique1(user.getPhonenumber(),user.getTenantId()))){
+        if(UserConstants.NOT_UNIQUE.equals(userService.checkPhoneUnique1(user.getPhonenumber(),0))){
             return ApiResult.error(BusinessErrorCode.BIZ_BUSINESS_ERROR.getCode(), "新增手机号'" + user.getPhonenumber() + "'失败,手机号已存在");
         }
+        if(UserConstants.NOT_UNIQUE.equals(userService.checkEmailUnique1(user.getEmail(),0))){
+            return ApiResult.error(BusinessErrorCode.BIZ_BUSINESS_ERROR.getCode(), "新增邮箱'" + user.getEmail() + "'失败,邮箱已存在");
+        }
         List<SysDept> list = deptService.deptListByTenant(user.getTenantId());
-        if (list.size() > 0){
+        if (!list.isEmpty()){
             user.setDeptId(list.get(0).getDeptId());
         }
         user.setUserType("00");
         user.setTenantId(user.getTenantId());
         user.setCreateBy(user.getUserName());
+        user.setTenantId(user.getTenantId());
         user.setPassword(SecurityUtils.encryptPassword(user.getPassword()));
         int row = userService.insertUser(user);
         return toAjax(row);

+ 3 - 5
base-modules/service-system/service-system-biz/src/main/java/com/usky/system/service/impl/MceReceiveServiceImpl.java

@@ -294,9 +294,7 @@ public class MceReceiveServiceImpl extends AbstractCrudService<MceReceiveMapper,
                             mceReceive1.setCreateBy(mceReceiveVO.get("userName").toString());
                             mceReceive1.setCreateTime(LocalDateTime.now());
                             mceReceive1.setTenantId(list.get(i).getTenantId());
-                            if (mceReceiveVO.get("userName").equals(list.get(i).getUserName())) {
-                                mceReceive1.setDeptId(list.get(i).getDeptId().intValue());
-                            }
+                            mceReceive1.setDeptId(list.get(i).getDeptId().intValue());
                             this.save(mceReceive1);
                             Integer mceReceiveId = mceReceive1.getId();
 
@@ -313,7 +311,7 @@ public class MceReceiveServiceImpl extends AbstractCrudService<MceReceiveMapper,
                                         try {
                                             mceContentService.sendApp(mceReceiveVO, list3.get(j).getCids(), 0, 0);
                                         } catch (Exception e) {
-                                            log.error("Failed to send app message for userId: {}, error: {}", list3.get(j).getUserId(), e.getMessage(), e);
+                                            log.error("为用户ID: {} 发送应用消息失败,错误信息: {}", list3.get(j).getUserId(), e.getMessage(), e);
                                         }
                                     }
                                 }
@@ -323,7 +321,7 @@ public class MceReceiveServiceImpl extends AbstractCrudService<MceReceiveMapper,
                                         try {
                                             mceContentService.sendApp(mceReceiveVO, list3.get(j).getOpenid(), mceReceiveId, 1);
                                         } catch (Exception e) {
-                                            log.error("Failed to send WeChat message for userId: {}, error: {}", list3.get(j).getUserId(), e.getMessage(), e);
+                                            log.error("为用户ID: {} 发送微信消息失败,错误信息: {}", list3.get(j).getUserId(), e.getMessage(), e);
                                         }
                                     }
                                 }