diff --git a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderDetailRepository.java b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderDetailRepository.java index b8002582..9616aa77 100644 --- a/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderDetailRepository.java +++ b/src/main/java/com/chint/infrastructure/repository/jdbc/JdbcOrderDetailRepository.java @@ -29,5 +29,5 @@ public interface JdbcOrderDetailRepository extends CrudRepository findByCreateTimeBetweenAndProductTypeAndOrderNoContaining(LocalDateTime createTime, LocalDateTime createTime2, Integer productType, String orderNo); List findByUpdateTimeBetween(LocalDateTime createTime, LocalDateTime createTime2); - List findAllByRouteIdIn(Collection routeIds); + List findAllByRouteIdIn(List routeIds); } diff --git a/src/main/java/com/chint/manage/controller/ManageController.java b/src/main/java/com/chint/manage/controller/ManageController.java index 7fe194b9..b7ee90ed 100644 --- a/src/main/java/com/chint/manage/controller/ManageController.java +++ b/src/main/java/com/chint/manage/controller/ManageController.java @@ -10,6 +10,7 @@ import com.chint.manage.entity.query.ItineraryPageQuery; import com.chint.manage.entity.query.OrderPageQuery; import com.chint.manage.entity.query.StandardQuery; import com.chint.manage.service.ManageService; +import com.chint.manage.util.BaseUtil; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; @@ -25,6 +26,7 @@ import org.springframework.web.bind.annotation.RestController; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; +import java.util.List; import static com.chint.dama.dc.basic.Result.SUCCESS; diff --git a/src/main/java/com/chint/manage/entity/RouteOrderExtensionField.java b/src/main/java/com/chint/manage/entity/RouteOrderExtensionField.java new file mode 100644 index 00000000..f675445b --- /dev/null +++ b/src/main/java/com/chint/manage/entity/RouteOrderExtensionField.java @@ -0,0 +1,30 @@ +package com.chint.manage.entity; + +import lombok.Data; +import org.springframework.data.annotation.Id; +import org.springframework.data.relational.core.mapping.Table; +import java.io.Serial; +import java.io.Serializable; + +/** + * + * @author xx RouteOrderExtensionField.java + * + **/ +@Data +@Table("route_order_extension_field") +public class RouteOrderExtensionField implements Serializable { +@Serial +private static final long serialVersionUID = 1L; + /****/ + @Id + private Long id; + + /****/ + private Long routeId; + + /****/ + private String belongDeptCode; + + +} diff --git a/src/main/java/com/chint/manage/mapper/JdbcRouteOrderExtensionFieldRepository.java b/src/main/java/com/chint/manage/mapper/JdbcRouteOrderExtensionFieldRepository.java new file mode 100644 index 00000000..84d46b78 --- /dev/null +++ b/src/main/java/com/chint/manage/mapper/JdbcRouteOrderExtensionFieldRepository.java @@ -0,0 +1,18 @@ +package com.chint.manage.mapper; +import com.chint.manage.entity.RouteOrderExtensionField; +import org.springframework.data.repository.CrudRepository; +import org.springframework.stereotype.Repository; + +import java.util.List; + + +/** + * + * @author xx JdbcRouteOrderExtensionFieldRepository数据库操作接口类 + * + **/ +@Repository +public interface JdbcRouteOrderExtensionFieldRepository extends CrudRepository { + + List findByBelongDeptCodeIn(List belongDeptCode); +} \ No newline at end of file diff --git a/src/main/java/com/chint/manage/util/BaseUtil.java b/src/main/java/com/chint/manage/util/BaseUtil.java new file mode 100644 index 00000000..856b6200 --- /dev/null +++ b/src/main/java/com/chint/manage/util/BaseUtil.java @@ -0,0 +1,42 @@ +package com.chint.manage.util; + +import com.chint.domain.aggregates.order.OrderDetail; +import com.chint.domain.value_object.system.SystemOrganizationVO; +import com.chint.infrastructure.repository.jdbc.JdbcOrderDetailRepository; +import com.chint.infrastructure.util.BaseContext; +import com.chint.manage.entity.RouteOrderExtensionField; +import com.chint.manage.mapper.JdbcRouteOrderExtensionFieldRepository; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +import java.util.List; + +/** + * 基础方法工具类 + * @Author:nxj + * @Date:2024/6/3 14:29 + */ +@Component +public class BaseUtil { + @Autowired + private JdbcRouteOrderExtensionFieldRepository jdbcRouteOrderExtensionFieldRepository; + @Autowired + private JdbcOrderDetailRepository jdbcOrderDetailRepository; + + public List getRouteIds(){ + List list = BaseContext.getCurrentUser().loadRoleOrg().getRoleOrgList() + .stream().filter(s->s.getOrgShortCode()!=null).map(SystemOrganizationVO::getOrgShortCode).toList(); + List result=jdbcRouteOrderExtensionFieldRepository.findByBelongDeptCodeIn(list); + return result.stream().map(RouteOrderExtensionField::getRouteId).toList(); + } + + public List getOrderIds(){ + List routeIds = getRouteIds(); + return jdbcOrderDetailRepository.findAllByRouteIdIn(routeIds).stream().map(OrderDetail::getOrderId).toList(); + } + + public List getOrderNos(){ + List routeIds = getRouteIds(); + return jdbcOrderDetailRepository.findAllByRouteIdIn(routeIds).stream().map(OrderDetail::getOrderNo).toList(); + } +} diff --git a/src/main/java/com/chint/manage/util/DataJdbcCreatorUtil.java b/src/main/java/com/chint/manage/util/DataJdbcCreatorUtil.java index 7d1ee0ca..9c762592 100644 --- a/src/main/java/com/chint/manage/util/DataJdbcCreatorUtil.java +++ b/src/main/java/com/chint/manage/util/DataJdbcCreatorUtil.java @@ -39,7 +39,7 @@ public class DataJdbcCreatorUtil { */ private List getTables() throws SQLException { List tables = new ArrayList(); - tables.add("amap_route_relationship"); + tables.add("route_order_extension_field"); return tables; }