自动通过的评论状态不对?
This commit is contained in:
parent
0a0f3543c7
commit
4842aa936f
|
@ -15,6 +15,8 @@ import io.renren.modules.notice.enums.NoticeStatusEnum;
|
|||
import io.renren.modules.notice.service.SysNoticeService;
|
||||
import io.renren.modules.sys.dto.SysUserDTO;
|
||||
import io.renren.modules.sys.service.SysUserService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -36,6 +38,7 @@ import java.util.stream.Collectors;
|
|||
*/
|
||||
@Service
|
||||
public class TDemandCommentServiceImpl extends CrudServiceImpl<TDemandCommentDao, TDemandCommentEntity, TDemandCommentDTO> implements TDemandCommentService {
|
||||
private static Logger logger = LoggerFactory.getLogger(TDemandCommentServiceImpl.class);
|
||||
private static Integer cpuNUm = Runtime.getRuntime().availableProcessors();
|
||||
private static final ExecutorService executor = Executors.newFixedThreadPool(cpuNUm);
|
||||
@Autowired
|
||||
|
@ -93,24 +96,28 @@ public class TDemandCommentServiceImpl extends CrudServiceImpl<TDemandCommentDao
|
|||
super.update(tDemandCommentDTO);
|
||||
if (tDemandCommentDTO.getDelFlag() == 0) {
|
||||
CompletableFuture.runAsync(() -> { // 发起人
|
||||
Optional<TDemandDataDTO> tDemandDataDTO = Optional.ofNullable(tDemandDataService.get(tDemandCommentDTO.getTargetId()));
|
||||
Optional<SysUserDTO> sysUserDTO = Optional.ofNullable(sysUserService.get(tDemandDataDTO.isPresent() ? tDemandDataDTO.get().getCreator() : null));
|
||||
String content = "【评论】" + (sysUserDTO.isPresent() ? sysUserDTO.get().getRealName() : "") + " 您发起的需求 " + tDemandDataDTO.orElse(new TDemandDataDTO()).getDemandSubject()
|
||||
+ "有新的评论";
|
||||
SysNoticeDTO dto = new SysNoticeDTO();
|
||||
dto.setType(2);
|
||||
dto.setTitle("需求评论系统通知");
|
||||
dto.setContent(content); // 通知内容
|
||||
dto.setReceiverType(1);
|
||||
dto.setReceiverTypeIds(tDemandDataDTO.isPresent() ? tDemandDataDTO.get().getCreator().toString() : "");
|
||||
dto.setStatus(NoticeStatusEnum.SEND.value());
|
||||
dto.setSenderName("流程系统");
|
||||
dto.setSenderDate(new Date());
|
||||
dto.setCreator(sysUserService.getByUsername("admin").getId());
|
||||
dto.setCreateDate(new Date());
|
||||
dto.setFrom("评论");
|
||||
sysNoticeService.save(dto);
|
||||
jdbcTemplate.update("UPDATE t_demand_comment SET del_flag = 0 WHERE id = " + tDemandCommentDTO.getId());
|
||||
try {
|
||||
Optional<TDemandDataDTO> tDemandDataDTO = Optional.ofNullable(tDemandDataService.get(tDemandCommentDTO.getTargetId()));
|
||||
Optional<SysUserDTO> sysUserDTO = Optional.ofNullable(sysUserService.get(tDemandDataDTO.isPresent() ? tDemandDataDTO.get().getCreator() : null));
|
||||
String content = "【评论】" + (sysUserDTO.isPresent() ? sysUserDTO.get().getRealName() : "") + " 您发起的需求 " + tDemandDataDTO.orElse(new TDemandDataDTO()).getDemandSubject()
|
||||
+ "有新的评论";
|
||||
SysNoticeDTO dto = new SysNoticeDTO();
|
||||
dto.setType(2);
|
||||
dto.setTitle("需求评论系统通知");
|
||||
dto.setContent(content); // 通知内容
|
||||
dto.setReceiverType(1);
|
||||
dto.setReceiverTypeIds(tDemandDataDTO.isPresent() ? tDemandDataDTO.get().getCreator().toString() : "");
|
||||
dto.setStatus(NoticeStatusEnum.SEND.value());
|
||||
dto.setSenderName("流程系统");
|
||||
dto.setSenderDate(new Date());
|
||||
dto.setCreator(sysUserService.getByUsername("admin").getId());
|
||||
dto.setCreateDate(new Date());
|
||||
dto.setFrom("评论");
|
||||
sysNoticeService.save(dto);
|
||||
jdbcTemplate.update("UPDATE t_demand_comment SET del_flag = 0 WHERE id = " + tDemandCommentDTO.getId());
|
||||
} catch (Exception exception) {
|
||||
logger.error("更新评论失败", exception);
|
||||
}
|
||||
}, executor);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue