Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
lulz1 2024-06-05 15:04:29 +08:00
commit 2c10f27b03
6 changed files with 94 additions and 2 deletions

View File

@ -29,5 +29,5 @@ public interface JdbcOrderDetailRepository extends CrudRepository<OrderDetail, L
List<OrderDetail> findByCreateTimeBetweenAndProductTypeAndOrderNoContaining(LocalDateTime createTime, LocalDateTime createTime2, Integer productType, String orderNo);
List<OrderDetail> findByUpdateTimeBetween(LocalDateTime createTime, LocalDateTime createTime2);
List<OrderDetail> findAllByRouteIdIn(Collection<Long> routeIds);
List<OrderDetail> findAllByRouteIdIn(List<Long> routeIds);
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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<RouteOrderExtensionField,Long> {
List<RouteOrderExtensionField> findByBelongDeptCodeIn(List<String> belongDeptCode);
}

View File

@ -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;
/**
* 基础方法工具类
* @Authornxj
* @Date2024/6/3 14:29
*/
@Component
public class BaseUtil {
@Autowired
private JdbcRouteOrderExtensionFieldRepository jdbcRouteOrderExtensionFieldRepository;
@Autowired
private JdbcOrderDetailRepository jdbcOrderDetailRepository;
public List<Long> getRouteIds(){
List<String> list = BaseContext.getCurrentUser().loadRoleOrg().getRoleOrgList()
.stream().filter(s->s.getOrgShortCode()!=null).map(SystemOrganizationVO::getOrgShortCode).toList();
List<RouteOrderExtensionField> result=jdbcRouteOrderExtensionFieldRepository.findByBelongDeptCodeIn(list);
return result.stream().map(RouteOrderExtensionField::getRouteId).toList();
}
public List<Long> getOrderIds(){
List<Long> routeIds = getRouteIds();
return jdbcOrderDetailRepository.findAllByRouteIdIn(routeIds).stream().map(OrderDetail::getOrderId).toList();
}
public List<String> getOrderNos(){
List<Long> routeIds = getRouteIds();
return jdbcOrderDetailRepository.findAllByRouteIdIn(routeIds).stream().map(OrderDetail::getOrderNo).toList();
}
}

View File

@ -39,7 +39,7 @@ public class DataJdbcCreatorUtil {
*/
private List<String> getTables() throws SQLException {
List<String> tables = new ArrayList<String>();
tables.add("amap_route_relationship");
tables.add("route_order_extension_field");
return tables;
}