Compare commits
2 Commits
013931418c
...
7d54455df8
| Author | SHA1 | Date | |
|---|---|---|---|
| 7d54455df8 | |||
| df5265db93 |
@ -156,10 +156,13 @@ public class CaseClinicalArticleService {
|
||||
// 新增统计
|
||||
IncClinicalArticleStats(String.valueOf(caseClinicalArticle.getArticleId()),4,1);
|
||||
|
||||
// 生成文章分享二维码
|
||||
byte[] qrcodeBytes = addUnlimitedQrcode(caseClinicalArticle.getArticleId());
|
||||
if (qrcodeBytes == null || qrcodeBytes.length == 0) {
|
||||
return ResponseDTO.userErrorParam("添加失败");
|
||||
byte[] qrcodeBytes = new byte[0];
|
||||
if (addForm.getIsLink() == 1){
|
||||
// 生成文章分享二维码
|
||||
qrcodeBytes = addUnlimitedQrcode(caseClinicalArticle.getArticleId());
|
||||
if (qrcodeBytes == null || qrcodeBytes.length == 0) {
|
||||
return ResponseDTO.userErrorParam("添加失败");
|
||||
}
|
||||
}
|
||||
|
||||
// 处理文章作者
|
||||
@ -753,49 +756,168 @@ public class CaseClinicalArticleService {
|
||||
// 增加需要增加的医院数据
|
||||
addHospitalSet.add(String.valueOf(caseClinicalDoctor.getHospitalId()));
|
||||
|
||||
// 生成用户证书-文章/视频
|
||||
if (qrCodeBytes == null || qrCodeBytes.length == 0) {
|
||||
// 生成二维码图片
|
||||
if (caseClinicalArticle.getShareQrcode() == null){
|
||||
try {
|
||||
// 生成用户分享二维码-文章/视频
|
||||
qrCodeBytes = addUnlimitedQrcode(caseClinicalArticle.getArticleId());
|
||||
} catch (Exception e) {
|
||||
// 不处理
|
||||
throw new BusinessException("操作失败");
|
||||
// 处理证书问题-非外链时才会更新
|
||||
if (caseClinicalArticle.getIsLink() == 1){
|
||||
// 生成用户证书-文章/视频
|
||||
if (qrCodeBytes == null || qrCodeBytes.length == 0) {
|
||||
// 生成二维码图片
|
||||
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{
|
||||
// 下载二维码图片
|
||||
qrCodeBytes = Oss.getObjectToByte(caseClinicalArticle.getShareQrcode().replaceFirst("^/+", ""));
|
||||
if (qrCodeBytes == null) {
|
||||
throw new BusinessException("操作失败");
|
||||
try {
|
||||
avatarByte = ImageUtil.readImageToBytes("static/cert/avatar.png");
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 下载头像
|
||||
byte[] avatarByte = new byte[0];
|
||||
if (caseClinicalDoctor.getAvatar() != null && !caseClinicalDoctor.getAvatar().isEmpty()) {
|
||||
avatarByte = Oss.getObjectToByte(caseClinicalDoctor.getAvatar().replaceFirst("^/+", ""));
|
||||
}else{
|
||||
try {
|
||||
avatarByte = ImageUtil.readImageToBytes("static/cert/avatar.png");
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(e.getMessage());
|
||||
if (avatarByte == null) {
|
||||
throw new BusinessException("操作失败");
|
||||
}
|
||||
|
||||
userService.CreateUserCert(
|
||||
String.valueOf(caseClinicalArticle.getArticleId()),
|
||||
1,
|
||||
String.valueOf(caseClinicalDoctor.getDoctorId()),
|
||||
qrCodeBytes,
|
||||
avatarByte
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (!addHospitalSet.isEmpty()){
|
||||
// 增加医院统计
|
||||
for (String hospitalId : addHospitalSet ){
|
||||
LocalDateTime lastPushDate = caseClinicalArticleDao.selectLastArticlePushDateByHospitalId(Long.valueOf(hospitalId));
|
||||
|
||||
caseClinicalService.IncStatsCaseClinicalHospital(hospitalId,1,
|
||||
lastPushDate,1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 处理文章作者
|
||||
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 (avatarByte == null) {
|
||||
if (exists) {
|
||||
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("操作失败");
|
||||
}
|
||||
|
||||
userService.CreateUserCert(
|
||||
String.valueOf(caseClinicalArticle.getArticleId()),
|
||||
1,
|
||||
String.valueOf(caseClinicalDoctor.getDoctorId()),
|
||||
qrCodeBytes,
|
||||
avatarByte
|
||||
);
|
||||
// 获取医院数据
|
||||
BasicHospitalEntity basicHospital = basicHospitalDao.selectById(caseClinicalDoctor.getHospitalId());
|
||||
if (basicHospital == null) {
|
||||
throw new BusinessException("操作失败");
|
||||
}
|
||||
|
||||
// 减少作者统计
|
||||
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()){
|
||||
|
||||
@ -153,9 +153,9 @@ sa-token:
|
||||
# 是否打开自动续签 (如果此值为true,框架会在每次直接或间接调用 getLoginId() 时进行一次过期检查与续签操作)
|
||||
auto-renew: true
|
||||
# 是否输出操作日志
|
||||
is-log: false
|
||||
is-log: true
|
||||
# 日志等级(trace、debug、info、warn、error、fatal)
|
||||
log-level: warn
|
||||
log-level: debug
|
||||
# 启动时的字符画打印
|
||||
is-print: false
|
||||
# 是否从cookie读取token
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user