🔖 Releasing / Version tags. 5.2

🔖 Releasing / Version tags. 5.2
This commit is contained in:
lbw committed 2023-09-13 10:28:40 +08:00
1 parent 95371f54a8
commit 2c6a700154
100 files changed
+507 -439

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-app-server</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-app-server-api</artifactId>
+2 -2
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-app-server</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-app-server-biz</artifactId>
@@ -62,7 +62,7 @@
<dependency>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx-app-server-api</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</dependency>
<!--必备: log 依赖-->
<dependency>
@@ -47,9 +47,10 @@ public class AppArticleCollectController {
@GetMapping("/page")
public R getAppArticleCollectPage(@ParameterObject Page page) {
MPJLambdaWrapper<AppArticleCollectEntity> wrapper = new MPJLambdaWrapper<AppArticleCollectEntity>()
.selectAll(AppArticleCollectEntity.class).select(AppArticleEntity::getTitle)
.leftJoin(AppArticleEntity.class, AppArticleEntity::getId, AppArticleCollectEntity::getArticleId)
.eq(AppArticleCollectEntity::getUserId, SecurityUtils.getUser().getId());
.selectAll(AppArticleCollectEntity.class)
.select(AppArticleEntity::getTitle)
.leftJoin(AppArticleEntity.class, AppArticleEntity::getId, AppArticleCollectEntity::getArticleId)
.eq(AppArticleCollectEntity::getUserId, SecurityUtils.getUser().getId());
return R.ok(appArticleCollectService.selectJoinListPage(page, AppArticleCollectEntity.class, wrapper));
}
@@ -106,7 +107,8 @@ public class AppArticleCollectController {
public R removeByArticleId(@PathVariable String articleId) {
Long id = SecurityUtils.getUser().getId();
return R.ok(appArticleCollectService.remove(Wrappers.<AppArticleCollectEntity>lambdaQuery()
.eq(AppArticleCollectEntity::getUserId, id).eq(AppArticleCollectEntity::getArticleId, articleId)));
.eq(AppArticleCollectEntity::getUserId, id)
.eq(AppArticleCollectEntity::getArticleId, articleId)));
}
/**
@@ -63,7 +63,7 @@ public class AppRoleController {
@GetMapping("/page")
public R getAppRolePage(Page page, AppRole appRole) {
return R.ok(appRoleService.page(page, Wrappers.<AppRole>lambdaQuery()
.like(StrUtil.isNotBlank(appRole.getRoleName()), AppRole::getRoleName, appRole.getRoleName())));
.like(StrUtil.isNotBlank(appRole.getRoleName()), AppRole::getRoleName, appRole.getRoleName())));
}
/**
@@ -63,8 +63,11 @@ public class AppUserController {
@Inner
@GetMapping("/info/{username}")
public R info(@PathVariable String username) {
AppUser user = appUserService.getOne(Wrappers.<AppUser>query().lambda().eq(AppUser::getUsername, username).or()
.eq(AppUser::getPhone, username));
AppUser user = appUserService.getOne(Wrappers.<AppUser>query()
.lambda()
.eq(AppUser::getUsername, username)
.or()
.eq(AppUser::getPhone, username));
if (user == null) {
return R.failed(MsgUtils.getMessage(ErrorCodes.APP_USER_USERINFO_EMPTY, username));
}
@@ -24,8 +24,9 @@ public class AppArticleCollectServiceImpl extends ServiceImpl<AppArticleCollectM
appArticleCollect.setUserId(id);
this.saveOrUpdate(appArticleCollect,
Wrappers.<AppArticleCollectEntity>lambdaQuery().eq(AppArticleCollectEntity::getUserId, id)
.eq(AppArticleCollectEntity::getArticleId, appArticleCollect.getArticleId()));
Wrappers.<AppArticleCollectEntity>lambdaQuery()
.eq(AppArticleCollectEntity::getUserId, id)
.eq(AppArticleCollectEntity::getArticleId, appArticleCollect.getArticleId()));
return Boolean.TRUE;
}
@@ -40,8 +40,8 @@ public class AppArticleServiceImpl extends ServiceImpl<AppArticleMapper, AppArti
// 查询是否收藏了
if (Objects.nonNull(userId)) {
boolean exists = collectMapper.exists(Wrappers.<AppArticleCollectEntity>lambdaQuery()//
.eq(AppArticleCollectEntity::getArticleId, appArticleEntity.getId())//
.eq(AppArticleCollectEntity::getUserId, userId));
.eq(AppArticleCollectEntity::getArticleId, appArticleEntity.getId())//
.eq(AppArticleCollectEntity::getUserId, userId));
appArticleEntity.setCollect(exists);
}
@@ -49,8 +49,10 @@ public class AppArticleServiceImpl extends ServiceImpl<AppArticleMapper, AppArti
Integer nowVisit = appArticleEntity.getVisit();
appArticleEntity.setVisit(nowVisit + 1);
// 乐观锁
baseMapper.update(appArticleEntity, Wrappers.<AppArticleEntity>lambdaQuery().eq(AppArticleEntity::getId, id)
.eq(AppArticleEntity::getVisit, nowVisit));
baseMapper.update(appArticleEntity,
Wrappers.<AppArticleEntity>lambdaQuery()
.eq(AppArticleEntity::getId, id)
.eq(AppArticleEntity::getVisit, nowVisit));
return appArticleEntity;
}
@@ -64,11 +66,11 @@ public class AppArticleServiceImpl extends ServiceImpl<AppArticleMapper, AppArti
public Page pageAndCname(Page page, AppArticleEntity appArticle) {
MPJLambdaWrapper<AppArticleEntity> wrapper = new MPJLambdaWrapper<>();
wrapper.selectAll(AppArticleEntity.class)
.selectAs(AppArticleCategoryEntity::getName, AppArticleEntity.Fields.cname)
.leftJoin(AppArticleCategoryEntity.class, AppArticleCategoryEntity::getId, AppArticleEntity::getCid)
.like(StrUtil.isNotBlank(appArticle.getAuthor()), AppArticleEntity::getAuthor, appArticle.getAuthor())
.like(StrUtil.isNotBlank(appArticle.getTitle()), AppArticleEntity::getTitle, appArticle.getTitle())
.eq(Objects.nonNull(appArticle.getCid()), AppArticleEntity::getCid, appArticle.getCid());
.selectAs(AppArticleCategoryEntity::getName, AppArticleEntity.Fields.cname)
.leftJoin(AppArticleCategoryEntity.class, AppArticleCategoryEntity::getId, AppArticleEntity::getCid)
.like(StrUtil.isNotBlank(appArticle.getAuthor()), AppArticleEntity::getAuthor, appArticle.getAuthor())
.like(StrUtil.isNotBlank(appArticle.getTitle()), AppArticleEntity::getTitle, appArticle.getTitle())
.eq(Objects.nonNull(appArticle.getCid()), AppArticleEntity::getCid, appArticle.getCid());
return this.page(page, wrapper);
}
@@ -40,7 +40,7 @@ public class AppIndexServiceImpl implements AppIndexService {
Map<String, Object> response = new LinkedHashMap<>();
AppPageEntity appPageEntity = appPageMapper.selectById(1);
List<AppArticleEntity> articleList = appArticleMapper
.selectList(Wrappers.<AppArticleEntity>lambdaQuery().orderByDesc(AppArticleEntity::getSort));
.selectList(Wrappers.<AppArticleEntity>lambdaQuery().orderByDesc(AppArticleEntity::getSort));
response.put("pages", appPageEntity);
response.put("article", articleList);
return response;
@@ -54,7 +54,7 @@ public class AppMobileServiceImpl implements AppMobileService {
@Override
public R<Boolean> sendSmsCode(String mobile) {
Object codeObj = redisTemplate.opsForValue()
.get(CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.APPSMS.getType() + StringPool.AT + mobile);
.get(CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.APPSMS.getType() + StringPool.AT + mobile);
if (codeObj != null) {
log.info("手机号验证码未过期:{},{}", mobile, codeObj);
@@ -63,9 +63,9 @@ public class AppMobileServiceImpl implements AppMobileService {
String code = RandomUtil.randomNumbers(Integer.parseInt(SecurityConstants.CODE_SIZE));
log.debug("手机号生成验证码成功:{},{}", mobile, code);
redisTemplate.opsForValue().set(
CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.APPSMS.getType() + StringPool.AT + mobile, code,
SecurityConstants.CODE_TIME, TimeUnit.SECONDS);
redisTemplate.opsForValue()
.set(CacheConstants.DEFAULT_CODE_KEY + LoginTypeEnum.APPSMS.getType() + StringPool.AT + mobile, code,
SecurityConstants.CODE_TIME, TimeUnit.SECONDS);
return R.ok(Boolean.TRUE, code);
}
@@ -77,8 +77,9 @@ public class AppRoleServiceImpl extends ServiceImpl<AppRoleMapper, AppRole> impl
for (AppRoleExcelVO excel : excelVOList) {
Set<String> errorMsg = new HashSet<>();
// 检验角色名称或者角色编码是否存在
boolean existRole = roleList.stream().anyMatch(appRole -> excel.getRoleName().equals(appRole.getRoleName())
|| excel.getRoleCode().equals(appRole.getRoleCode()));
boolean existRole = roleList.stream()
.anyMatch(appRole -> excel.getRoleName().equals(appRole.getRoleName())
|| excel.getRoleCode().equals(appRole.getRoleCode()));
if (existRole) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.SYS_ROLE_NAMEORCODE_EXISTING, excel.getRoleName(),
@@ -159,8 +159,10 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
AppUserInfo info = new AppUserInfo();
info.setAppUser(user);
// 设置角色列表 (ID)
List<Long> roleIds = appRoleService.findRolesByUserId(user.getUserId()).stream().map(AppRole::getRoleId)
.collect(Collectors.toList());
List<Long> roleIds = appRoleService.findRolesByUserId(user.getUserId())
.stream()
.map(AppRole::getRoleId)
.collect(Collectors.toList());
info.setRoles(ArrayUtil.toArray(roleIds, Long.class));
// 设置权限列表(menu.permission)
@@ -211,7 +213,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
}
// 删除用户关联表
this.appUserRoleService
.remove(Wrappers.<AppUserRole>lambdaQuery().in(AppUserRole::getUserId, CollUtil.toList(ids)));
.remove(Wrappers.<AppUserRole>lambdaQuery().in(AppUserRole::getUserId, CollUtil.toList(ids)));
this.removeBatchByIds(CollUtil.toList(ids));
@@ -222,7 +224,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
@Override
public R registerAppUser(AppUserDTO appUser) {
List<AppUser> appUserList = baseMapper
.selectList(Wrappers.<AppUser>lambdaQuery().eq(AppUser::getPhone, appUser.getPhone()));
.selectList(Wrappers.<AppUser>lambdaQuery().eq(AppUser::getPhone, appUser.getPhone()));
if (CollUtil.isNotEmpty(appUserList)) {
return R.failed("手机号已注册,请使用验证码直接登录");
@@ -264,7 +266,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
Set<String> errorMsg = new HashSet<>();
// 校验用户名是否存在
boolean exsitUserName = userList.stream()
.anyMatch(sysUser -> excel.getUsername().equals(sysUser.getUsername()));
.anyMatch(sysUser -> excel.getUsername().equals(sysUser.getUsername()));
if (exsitUserName) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.SYS_USER_USERNAME_EXISTING, excel.getUsername()));
@@ -273,8 +275,8 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserMapper, AppUser> impl
// 判断输入的角色名称列表是否合法
List<String> roleNameList = StrUtil.split(excel.getRoleNameList(), StrUtil.COMMA);
List<AppRole> roleCollList = roleList.stream()
.filter(role -> roleNameList.stream().anyMatch(name -> role.getRoleName().equals(name)))
.collect(Collectors.toList());
.filter(role -> roleNameList.stream().anyMatch(name -> role.getRoleName().equals(name)))
.collect(Collectors.toList());
if (roleCollList.size() != roleNameList.size()) {
errorMsg.add(MsgUtils.getMessage(ErrorCodes.SYS_ROLE_ROLENAME_INEXISTENCE, excel.getRoleNameList()));
+1 -1
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>com.pig4cloud</groupId>
<artifactId>pigx</artifactId>
<version>5.2.0-snapshot</version>
<version>5.2.0</version>
</parent>
<artifactId>pigx-app-server</artifactId>