修改公告逻辑

This commit is contained in:
lulz1 2024-04-24 14:51:46 +08:00
parent 437c43d0eb
commit 8beef1e548
3 changed files with 9 additions and 2 deletions

View File

@ -37,7 +37,7 @@ public class SystemController {
}
@ApiOperation("新增已查看用户")
@PostMapping("/announcement/save")
@PostMapping("/announcement/employee/save")
public Result<String> saveAnnouncementEmployee(@RequestBody SystemAnnouncementDTO systemAnnouncementDTO) {
systemAnnouncementRepository.findById(systemAnnouncementDTO.getAnnouncementId())
.ifPresent(systemAnnouncement -> {

View File

@ -41,6 +41,7 @@ import java.util.Optional;
import static com.chint.infrastructure.constant.BPMConstant.*;
import static com.chint.infrastructure.constant.CommonMessageConstant.LEG_CHANGE_MAX_ERROR;
import static com.chint.infrastructure.constant.CommonMessageConstant.NOT_FOUND;
import static com.chint.infrastructure.constant.DataMessageConstant.DATA_NOT_FOUND;
import static com.chint.infrastructure.constant.LegConstant.*;
import static com.chint.infrastructure.constant.OrderConstant.*;
@ -205,7 +206,9 @@ public class LegEventHandler implements LegEventService {
OrderLegData data = command.getData();
String orderNo = data.getSelfOrderNo();
RouteOrder routeOrder = routeRequestDomainService.getRouteOrder(orderNo);
if(routeOrder == null){
throw new OrderException(NOT_FOUND + "单号orderNo");
}
String employeeNo = routeOrder.getUserId();
User byUserEmployeeNo = userRepository.findByUserEmployeeNo(employeeNo);
BaseContext.setCurrentUser(byUserEmployeeNo);

View File

@ -4,6 +4,8 @@ import com.chint.domain.aggregates.system.SystemAnnouncement;
import com.chint.domain.repository.SystemAnnouncementRepository;
import com.chint.infrastructure.repository.jdbc.JdbcSystemAnnouncementRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Repository;
import java.util.ArrayList;
@ -17,11 +19,13 @@ public class SystemAnnouncementRepositoryImpl implements SystemAnnouncementRepos
@Autowired
private JdbcSystemAnnouncementRepository jdbcSystemAnnouncementRepository;
@CacheEvict(value = "SystemAnnouncement", key = "#systemAnnouncement.announcementId")
@Override
public SystemAnnouncement save(SystemAnnouncement systemAnnouncement) {
return jdbcSystemAnnouncementRepository.save(systemAnnouncement);
}
@Cacheable(value = "SystemAnnouncement", key = "#id")
@Override
public Optional<SystemAnnouncement> findById(Long id) {
return jdbcSystemAnnouncementRepository.findById(id);