diff --git a/src/main/java/com/chint/application/system/SystemController.java b/src/main/java/com/chint/application/system/SystemController.java index e6163acb..3c818a1b 100644 --- a/src/main/java/com/chint/application/system/SystemController.java +++ b/src/main/java/com/chint/application/system/SystemController.java @@ -37,7 +37,7 @@ public class SystemController { } @ApiOperation("新增已查看用户") - @PostMapping("/announcement/save") + @PostMapping("/announcement/employee/save") public Result saveAnnouncementEmployee(@RequestBody SystemAnnouncementDTO systemAnnouncementDTO) { systemAnnouncementRepository.findById(systemAnnouncementDTO.getAnnouncementId()) .ifPresent(systemAnnouncement -> { diff --git a/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java b/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java index eb572f38..dba55087 100644 --- a/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java +++ b/src/main/java/com/chint/domain/service/leg_event/LegEventHandler.java @@ -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); diff --git a/src/main/java/com/chint/infrastructure/repository/SystemAnnouncementRepositoryImpl.java b/src/main/java/com/chint/infrastructure/repository/SystemAnnouncementRepositoryImpl.java index 2fc58010..d54117f3 100644 --- a/src/main/java/com/chint/infrastructure/repository/SystemAnnouncementRepositoryImpl.java +++ b/src/main/java/com/chint/infrastructure/repository/SystemAnnouncementRepositoryImpl.java @@ -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 findById(Long id) { return jdbcSystemAnnouncementRepository.findById(id);