123
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package com.ruoyi.cai.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ruoyi.cai.domain.Version;
|
||||
import com.ruoyi.cai.dto.app.vo.version.VersionSystemInfo;
|
||||
import com.ruoyi.cai.enums.version.VersionPlatformEnum;
|
||||
|
||||
/**
|
||||
* 版本Service接口
|
||||
*
|
||||
* @author 77
|
||||
* @date 2024-02-02
|
||||
*/
|
||||
public interface VersionService extends IService<Version> {
|
||||
|
||||
VersionSystemInfo systemInfo(String version, VersionPlatformEnum versionPlatformEnum);
|
||||
}
|
||||
@@ -60,11 +60,13 @@ public class AnchorApplyServiceImpl extends ServiceImpl<AnchorApplyMapper, Ancho
|
||||
AnchorApply anchorApply = this.getByUserId(userId);
|
||||
AnchorJoinHomeVo vo = new AnchorJoinHomeVo();
|
||||
vo.setFinishStatus(user.getFinishStatus());
|
||||
vo.setPhotoStatus(user.getPhotoStatus());
|
||||
// vo.setPhotoStatus(user.getPhotoStatus());
|
||||
vo.setAvatarState(user.getAvatarState());
|
||||
vo.setCameraStatus(user.getCameraStatus());
|
||||
vo.setAgreeProtocol(user.getAgreeProtocol());
|
||||
if(anchorApply != null){
|
||||
vo.setApplyStatus(user.getStatus());
|
||||
vo.setApplyStatus(anchorApply.getAuditStatus());
|
||||
vo.setAuditRemark(anchorApply.getAuditRemark());
|
||||
}else{
|
||||
vo.setApplyStatus(0);
|
||||
}
|
||||
@@ -80,8 +82,8 @@ public class AnchorApplyServiceImpl extends ServiceImpl<AnchorApplyMapper, Ancho
|
||||
if(user.getFinishStatus() != 1){
|
||||
throw new ServiceException("您还未完善个人资料");
|
||||
}
|
||||
if(user.getPhotoStatus() != 1){
|
||||
throw new ServiceException("请选上传相册");
|
||||
if(user.getAvatarState() != 1){
|
||||
throw new ServiceException("请选上传自定义头像");
|
||||
}
|
||||
if(user.getCameraStatus() != 1){
|
||||
throw new ServiceException("您还未完成自拍认证");
|
||||
|
||||
@@ -71,6 +71,9 @@ public class UserAlbumServiceImpl extends ServiceImpl<UserAlbumMapper, UserAlbum
|
||||
album.setAuditStatus(ignoreAudit ? AuditStatusEnum.SUCCESS.getCode():AuditStatusEnum.AUDITING.getCode());
|
||||
album.setIgnoreAudit(ignoreAudit);
|
||||
this.save(album);
|
||||
userService.list(Wrappers.lambdaUpdate(User.class)
|
||||
.eq(User::getId, user.getId())
|
||||
.set(User::getPhotoStatus, 1));
|
||||
return album;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.ruoyi.cai.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ruoyi.cai.domain.Version;
|
||||
import com.ruoyi.cai.dto.app.vo.version.VersionSystemInfo;
|
||||
import com.ruoyi.cai.enums.version.VersionPlatformEnum;
|
||||
import com.ruoyi.cai.mapper.VersionMapper;
|
||||
import com.ruoyi.cai.service.VersionService;
|
||||
import com.ruoyi.cai.util.VersionUtil;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 版本Service业务层处理
|
||||
*
|
||||
* @author 77
|
||||
* @date 2024-02-02
|
||||
*/
|
||||
@Service
|
||||
public class VersionServiceImpl extends ServiceImpl<VersionMapper,Version> implements VersionService {
|
||||
|
||||
@Override
|
||||
public VersionSystemInfo systemInfo(String version, VersionPlatformEnum versionPlatformEnum){
|
||||
if(!StringUtils.isNotBlank(version)){
|
||||
VersionSystemInfo res = new VersionSystemInfo();
|
||||
res.setIsNewVersion(1);
|
||||
res.setVersion("1.0.0");
|
||||
return res;
|
||||
}
|
||||
List<Version> list = this.list(Wrappers.lambdaQuery(Version.class)
|
||||
.eq(Version::getPlatform, versionPlatformEnum.getCode())
|
||||
.eq(Version::getEnableStatus, 1));
|
||||
list.sort(Comparator.comparing(Version::getNewVersion, VersionUtil::compareVersion));
|
||||
if(list.isEmpty()){
|
||||
VersionSystemInfo res = new VersionSystemInfo();
|
||||
res.setIsNewVersion(1);
|
||||
res.setVersion("1.0.0");
|
||||
return res;
|
||||
}
|
||||
Version newVersion = list.get(0); // 最新版
|
||||
if(VersionUtil.compareVersion(version,newVersion.getNewVersion()) >= 0){ // 版本号比最新版还大
|
||||
VersionSystemInfo res = new VersionSystemInfo();
|
||||
res.setIsNewVersion(1);
|
||||
res.setVersion(newVersion.getNewVersion());
|
||||
return res;
|
||||
}
|
||||
Integer enforce = 0;
|
||||
for (Version v : list) {
|
||||
if(enforce == 0){
|
||||
enforce = v.getEnforce();
|
||||
}
|
||||
int i = VersionUtil.compareVersion(version, v.getNewVersion());
|
||||
if(i <= 0){ // 版本号小于改版本
|
||||
VersionSystemInfo res = new VersionSystemInfo();
|
||||
res.setIsNewVersion(0);
|
||||
res.setVersionCode(v.getVersionCode());
|
||||
res.setOldVersion(v.getOldVersion());
|
||||
res.setVersion(v.getNewVersion());
|
||||
res.setPackageSize(v.getPackageSize());
|
||||
res.setContent(v.getContent());
|
||||
res.setDownloadurl(v.getDownloadUrl());
|
||||
res.setEnforce(enforce);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
VersionSystemInfo res = new VersionSystemInfo();
|
||||
res.setIsNewVersion(1);
|
||||
res.setVersion("1.0.0");
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user