Compare commits
No commits in common. "7d54455df8e50096abeba1fcb413cab9e7818ef3" and "013931418cd7ea97c40256ad56e459c5f91f109f" have entirely different histories.
7d54455df8
...
013931418c
@ -156,13 +156,10 @@ public class CaseClinicalArticleService {
|
|||||||
// 新增统计
|
// 新增统计
|
||||||
IncClinicalArticleStats(String.valueOf(caseClinicalArticle.getArticleId()),4,1);
|
IncClinicalArticleStats(String.valueOf(caseClinicalArticle.getArticleId()),4,1);
|
||||||
|
|
||||||
byte[] qrcodeBytes = new byte[0];
|
// 生成文章分享二维码
|
||||||
if (addForm.getIsLink() == 1){
|
byte[] qrcodeBytes = addUnlimitedQrcode(caseClinicalArticle.getArticleId());
|
||||||
// 生成文章分享二维码
|
if (qrcodeBytes == null || qrcodeBytes.length == 0) {
|
||||||
qrcodeBytes = addUnlimitedQrcode(caseClinicalArticle.getArticleId());
|
return ResponseDTO.userErrorParam("添加失败");
|
||||||
if (qrcodeBytes == null || qrcodeBytes.length == 0) {
|
|
||||||
return ResponseDTO.userErrorParam("添加失败");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 处理文章作者
|
// 处理文章作者
|
||||||
@ -756,168 +753,49 @@ public class CaseClinicalArticleService {
|
|||||||
// 增加需要增加的医院数据
|
// 增加需要增加的医院数据
|
||||||
addHospitalSet.add(String.valueOf(caseClinicalDoctor.getHospitalId()));
|
addHospitalSet.add(String.valueOf(caseClinicalDoctor.getHospitalId()));
|
||||||
|
|
||||||
// 处理证书问题-非外链时才会更新
|
// 生成用户证书-文章/视频
|
||||||
if (caseClinicalArticle.getIsLink() == 1){
|
if (qrCodeBytes == null || qrCodeBytes.length == 0) {
|
||||||
// 生成用户证书-文章/视频
|
// 生成二维码图片
|
||||||
if (qrCodeBytes == null || qrCodeBytes.length == 0) {
|
if (caseClinicalArticle.getShareQrcode() == null){
|
||||||
// 生成二维码图片
|
|
||||||
if (caseClinicalArticle.getShareQrcode() == null){
|
|
||||||
try {
|
|
||||||
// 生成用户分享二维码-文章/视频
|
|
||||||
qrCodeBytes = addUnlimitedQrcode(caseClinicalArticle.getArticleId());
|
|
||||||
} catch (Exception e) {
|
|
||||||
// 不处理
|
|
||||||
throw new BusinessException("操作失败");
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
// 下载二维码图片
|
|
||||||
qrCodeBytes = Oss.getObjectToByte(caseClinicalArticle.getShareQrcode().replaceFirst("^/+", ""));
|
|
||||||
if (qrCodeBytes == null) {
|
|
||||||
throw new BusinessException("操作失败");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 下载头像
|
|
||||||
byte[] avatarByte = new byte[0];
|
|
||||||
if (caseClinicalDoctor.getAvatar() != null && !caseClinicalDoctor.getAvatar().isEmpty()) {
|
|
||||||
avatarByte = Oss.getObjectToByte(caseClinicalDoctor.getAvatar().replaceFirst("^/+", ""));
|
|
||||||
}else{
|
|
||||||
try {
|
try {
|
||||||
avatarByte = ImageUtil.readImageToBytes("static/cert/avatar.png");
|
// 生成用户分享二维码-文章/视频
|
||||||
|
qrCodeBytes = addUnlimitedQrcode(caseClinicalArticle.getArticleId());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new BusinessException(e.getMessage());
|
// 不处理
|
||||||
|
throw new BusinessException("操作失败");
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
// 下载二维码图片
|
||||||
|
qrCodeBytes = Oss.getObjectToByte(caseClinicalArticle.getShareQrcode().replaceFirst("^/+", ""));
|
||||||
|
if (qrCodeBytes == null) {
|
||||||
|
throw new BusinessException("操作失败");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (avatarByte == null) {
|
|
||||||
throw new BusinessException("操作失败");
|
|
||||||
}
|
|
||||||
|
|
||||||
userService.CreateUserCert(
|
|
||||||
String.valueOf(caseClinicalArticle.getArticleId()),
|
|
||||||
1,
|
|
||||||
String.valueOf(caseClinicalDoctor.getDoctorId()),
|
|
||||||
qrCodeBytes,
|
|
||||||
avatarByte
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!addHospitalSet.isEmpty()){
|
// 下载头像
|
||||||
// 增加医院统计
|
byte[] avatarByte = new byte[0];
|
||||||
for (String hospitalId : addHospitalSet ){
|
if (caseClinicalDoctor.getAvatar() != null && !caseClinicalDoctor.getAvatar().isEmpty()) {
|
||||||
LocalDateTime lastPushDate = caseClinicalArticleDao.selectLastArticlePushDateByHospitalId(Long.valueOf(hospitalId));
|
avatarByte = Oss.getObjectToByte(caseClinicalDoctor.getAvatar().replaceFirst("^/+", ""));
|
||||||
|
}else{
|
||||||
caseClinicalService.IncStatsCaseClinicalHospital(hospitalId,1,
|
try {
|
||||||
lastPushDate,1);
|
avatarByte = ImageUtil.readImageToBytes("static/cert/avatar.png");
|
||||||
}
|
} catch (Exception e) {
|
||||||
}
|
throw new BusinessException(e.getMessage());
|
||||||
}
|
|
||||||
|
|
||||||
// 处理文章作者
|
|
||||||
public void HandleArticleAuthorWithLink(CaseClinicalArticleEntity caseClinicalArticle,List<CaseClinicalArticleAuthorForm> r){
|
|
||||||
// 需新增的
|
|
||||||
List<CaseClinicalArticleAuthorForm> addList = new ArrayList<>();
|
|
||||||
|
|
||||||
// 需删除的
|
|
||||||
List<CaseClinicalArticleAuthorEntity> deleteList = new ArrayList<>();
|
|
||||||
|
|
||||||
// 获取全部作者
|
|
||||||
LambdaQueryWrapper<CaseClinicalArticleAuthorEntity> authorQueryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
authorQueryWrapper.eq(CaseClinicalArticleAuthorEntity::getArticleId, caseClinicalArticle.getArticleId());
|
|
||||||
List<CaseClinicalArticleAuthorEntity> caseClinicalArticleAuthors = caseClinicalArticleAuthorDao.selectList(authorQueryWrapper);
|
|
||||||
|
|
||||||
// 处理新增的情况
|
|
||||||
for (CaseClinicalArticleAuthorForm a : r){
|
|
||||||
// 默认本条为新增
|
|
||||||
boolean exists = true;
|
|
||||||
for (CaseClinicalArticleAuthorEntity b : caseClinicalArticleAuthors){
|
|
||||||
if (Objects.equals(a.getDoctorId(), b.getDoctorId())){
|
|
||||||
exists = false;
|
|
||||||
break; // 已存在,跳出内层循环
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exists) {
|
if (avatarByte == null) {
|
||||||
addList.add(a); // 不存在于旧数据中,加入新增列表
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 处理删除的情况
|
|
||||||
for (CaseClinicalArticleAuthorEntity b : caseClinicalArticleAuthors){
|
|
||||||
// 默认本条为删除
|
|
||||||
boolean exists = true;
|
|
||||||
for (CaseClinicalArticleAuthorForm a : r){
|
|
||||||
if (Objects.equals(a.getDoctorId(), b.getDoctorId())){
|
|
||||||
exists = false;
|
|
||||||
break; // 已存在,跳出内层循环
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (exists) {
|
|
||||||
deleteList.add(b); // 加入删除列表
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 删除
|
|
||||||
Set<String> deleteHospitalSet = new LinkedHashSet<>();
|
|
||||||
for (CaseClinicalArticleAuthorEntity author : deleteList){
|
|
||||||
// 获取医生数据
|
|
||||||
LambdaQueryWrapper<CaseClinicalDoctorEntity> doctorQueryWrapper = new LambdaQueryWrapper<>();
|
|
||||||
doctorQueryWrapper.eq(CaseClinicalDoctorEntity::getDoctorId, author.getDoctorId());
|
|
||||||
CaseClinicalDoctorEntity caseClinicalDoctor = caseClinicalDoctorDao.selectOne(doctorQueryWrapper);
|
|
||||||
if (caseClinicalDoctor == null) {
|
|
||||||
throw new BusinessException("操作失败");
|
throw new BusinessException("操作失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取医院数据
|
userService.CreateUserCert(
|
||||||
BasicHospitalEntity basicHospital = basicHospitalDao.selectById(caseClinicalDoctor.getHospitalId());
|
String.valueOf(caseClinicalArticle.getArticleId()),
|
||||||
if (basicHospital == null) {
|
1,
|
||||||
throw new BusinessException("操作失败");
|
String.valueOf(caseClinicalDoctor.getDoctorId()),
|
||||||
}
|
qrCodeBytes,
|
||||||
|
avatarByte
|
||||||
// 减少作者统计
|
);
|
||||||
caseClinicalService.DecStatsCaseClinicalDoctor(String.valueOf(caseClinicalDoctor.getDoctorId()),1);
|
|
||||||
|
|
||||||
// 增加需要减少的医院数据
|
|
||||||
deleteHospitalSet.add(String.valueOf(caseClinicalDoctor.getHospitalId()));
|
|
||||||
|
|
||||||
// 删除该作者
|
|
||||||
caseClinicalArticleAuthorDao.deleteById(author.getAuthorId());
|
|
||||||
|
|
||||||
// 删除该作者证书
|
|
||||||
LambdaQueryWrapper<CaseClinicalDoctorCertEntity> certWrapper = new LambdaQueryWrapper<>();
|
|
||||||
certWrapper.eq(CaseClinicalDoctorCertEntity::getDoctorId, caseClinicalDoctor.getDoctorId());
|
|
||||||
certWrapper.eq(CaseClinicalDoctorCertEntity::getId, caseClinicalArticle.getArticleId());
|
|
||||||
certWrapper.eq(CaseClinicalDoctorCertEntity::getType, 1);
|
|
||||||
caseClinicalDoctorCertDao.delete(certWrapper);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!deleteHospitalSet.isEmpty()){
|
|
||||||
// 减少医院统计
|
|
||||||
for (String hospitalId : deleteHospitalSet ){
|
|
||||||
caseClinicalService.DecStatsCaseClinicalHospital(hospitalId,1,1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 新增新的作者
|
|
||||||
Set<String> addHospitalSet = new LinkedHashSet<>();
|
|
||||||
for (CaseClinicalArticleAuthorForm author : addList){
|
|
||||||
CaseClinicalDoctorEntity caseClinicalDoctor = caseClinicalDoctorDao.selectById(author.getDoctorId());
|
|
||||||
|
|
||||||
CaseClinicalArticleAuthorEntity caseClinicalArticleAuthor = new CaseClinicalArticleAuthorEntity();
|
|
||||||
caseClinicalArticleAuthor.setArticleId(caseClinicalArticle.getArticleId());
|
|
||||||
caseClinicalArticleAuthor.setDoctorId(caseClinicalDoctor.getDoctorId());
|
|
||||||
caseClinicalArticleAuthorDao.insert(caseClinicalArticleAuthor);
|
|
||||||
|
|
||||||
LocalDateTime lastPushDate = caseClinicalArticleDao.selectLastArticlePushDateByDoctorId(caseClinicalDoctor.getDoctorId());
|
|
||||||
|
|
||||||
// 新增作者统计
|
|
||||||
caseClinicalService.IncStatsCaseClinicalDoctor(String.valueOf(caseClinicalDoctor.getDoctorId()),1,lastPushDate);
|
|
||||||
|
|
||||||
// 增加需要增加的医院数据
|
|
||||||
addHospitalSet.add(String.valueOf(caseClinicalDoctor.getHospitalId()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!addHospitalSet.isEmpty()){
|
if (!addHospitalSet.isEmpty()){
|
||||||
|
|||||||
@ -153,9 +153,9 @@ sa-token:
|
|||||||
# 是否打开自动续签 (如果此值为true,框架会在每次直接或间接调用 getLoginId() 时进行一次过期检查与续签操作)
|
# 是否打开自动续签 (如果此值为true,框架会在每次直接或间接调用 getLoginId() 时进行一次过期检查与续签操作)
|
||||||
auto-renew: true
|
auto-renew: true
|
||||||
# 是否输出操作日志
|
# 是否输出操作日志
|
||||||
is-log: true
|
is-log: false
|
||||||
# 日志等级(trace、debug、info、warn、error、fatal)
|
# 日志等级(trace、debug、info、warn、error、fatal)
|
||||||
log-level: debug
|
log-level: warn
|
||||||
# 启动时的字符画打印
|
# 启动时的字符画打印
|
||||||
is-print: false
|
is-print: false
|
||||||
# 是否从cookie读取token
|
# 是否从cookie读取token
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user