Merge remote-tracking branch 'origin/dev' into dev
# Conflicts: # src/main/java/com/chint/domain/repository/SystemOrganizationRepository.java # src/main/java/com/chint/infrastructure/repository/SystemOrganizationRepositoryImpl.java # src/main/java/com/chint/infrastructure/repository/jdbc/JdbcSystemOrganizationRepository.java
This commit is contained in:
commit
2b08dd451f
|
@ -21,6 +21,5 @@ public class UserRes {
|
||||||
private String rankCode;
|
private String rankCode;
|
||||||
private String companyCode;
|
private String companyCode;
|
||||||
private String workStatus;
|
private String workStatus;
|
||||||
private List<SystemOrganizationVO> roleOrgList;
|
|
||||||
private List<Role> roleList;
|
private List<Role> roleList;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,8 +82,6 @@ public class User implements Serializable {
|
||||||
@Transient
|
@Transient
|
||||||
private List<String> roleOrgCodeList;
|
private List<String> roleOrgCodeList;
|
||||||
@Transient
|
@Transient
|
||||||
private List<SystemOrganizationVO> roleOrgList;
|
|
||||||
@Transient
|
|
||||||
private List<Role> roleList;
|
private List<Role> roleList;
|
||||||
|
|
||||||
public User loadInfoFromDept() {
|
public User loadInfoFromDept() {
|
||||||
|
|
|
@ -28,4 +28,6 @@ public interface SystemOrganizationRepository {
|
||||||
List<SystemOrganization> expandOrganizations(List<SystemOrganization> systemOrganizations);
|
List<SystemOrganization> expandOrganizations(List<SystemOrganization> systemOrganizations);
|
||||||
|
|
||||||
Optional<SystemOrganization> findByOrgCodeContainingOrOrgNameContaining(String orgCode, String orgName);
|
Optional<SystemOrganization> findByOrgCodeContainingOrOrgNameContaining(String orgCode, String orgName);
|
||||||
|
|
||||||
|
List<String> queryOrgCodeListByUserId(Long userId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class BPMOrderDomainService {
|
||||||
//保存超标报表
|
//保存超标报表
|
||||||
OrderExceedStandard orderExceedStandard = OrderExceedStandard.builder()
|
OrderExceedStandard orderExceedStandard = OrderExceedStandard.builder()
|
||||||
.applicant(orderDetail.getSupplierName())
|
.applicant(orderDetail.getSupplierName())
|
||||||
.companyName(user.getCompanyName())
|
.companyName(user.getDepartmentInfo().getCompanyName())
|
||||||
.deptName(user.getDepartmentInfo().getDepartmentNameOne())
|
.deptName(user.getDepartmentInfo().getDepartmentNameOne())
|
||||||
.standardType(getProductTypeName(command.getProductType()))
|
.standardType(getProductTypeName(command.getProductType()))
|
||||||
.sourceName(anExceedStandardDto.getSourceSystem())
|
.sourceName(anExceedStandardDto.getSourceSystem())
|
||||||
|
@ -161,7 +161,7 @@ public class BPMOrderDomainService {
|
||||||
//保存超标报表
|
//保存超标报表
|
||||||
OrderExceedStandard orderExceedStandard = OrderExceedStandard.builder()
|
OrderExceedStandard orderExceedStandard = OrderExceedStandard.builder()
|
||||||
.applicant(orderDetail.getSupplierName())
|
.applicant(orderDetail.getSupplierName())
|
||||||
.companyName(user.getCompanyName())
|
.companyName(user.getDepartmentInfo().getCompanyName())
|
||||||
.deptName(user.getDepartmentInfo().getDepartmentNameOne())
|
.deptName(user.getDepartmentInfo().getDepartmentNameOne())
|
||||||
.standardType(getProductTypeName(command.getProductType()))
|
.standardType(getProductTypeName(command.getProductType()))
|
||||||
.sourceName(exceedStandardDto.getOrderSource())
|
.sourceName(exceedStandardDto.getOrderSource())
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
package com.chint.infrastructure.config.LogConfig;
|
||||||
|
|
||||||
|
import com.chint.domain.aggregates.user.User;
|
||||||
|
import com.chint.infrastructure.util.BaseContext;
|
||||||
|
import com.chint.manage.entity.CruxSystemLogBasic;
|
||||||
|
import com.chint.manage.mapper.JdbcCruxSystemLogBasicRepository;
|
||||||
|
import com.chint.manage.util.IpAddressUtil;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import jakarta.servlet.http.HttpServletResponse;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.servlet.HandlerInterceptor;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class CruxLogInterceptor implements HandlerInterceptor {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private JdbcCruxSystemLogBasicRepository jdbcCruxSystemLogBasicRepository;
|
||||||
|
@Autowired
|
||||||
|
private IpAddressUtil ipAddressUtil;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
||||||
|
// 在请求处理之前进行拦截
|
||||||
|
// 获取请求IP
|
||||||
|
String clientIP = ipAddressUtil.getIpAddress(request);
|
||||||
|
// 获取请求URL
|
||||||
|
String url = request.getRequestURL().toString();
|
||||||
|
// 获取请求方法
|
||||||
|
String method = request.getMethod();
|
||||||
|
// 获取url中的请求参数
|
||||||
|
String params = request.getQueryString() == null ? "" : request.getQueryString();
|
||||||
|
//请求体数据
|
||||||
|
String requestBody = "";
|
||||||
|
if ("POST".equals(method)) {
|
||||||
|
requestBody = ContentCachingWrapperFilter.getRequestBody(request);
|
||||||
|
}
|
||||||
|
requestBody = requestBody.replaceAll("\\s+", "");
|
||||||
|
|
||||||
|
//如果有,获取用户
|
||||||
|
User user = BaseContext.getCurrentUser();
|
||||||
|
String employeeNo = "";
|
||||||
|
String name = "";
|
||||||
|
if (!Objects.isNull(user)) {
|
||||||
|
employeeNo = user.getEmployeeNo();
|
||||||
|
name = user.getName();
|
||||||
|
}
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
String accessTime = now.format(formatter);
|
||||||
|
|
||||||
|
//构建对象
|
||||||
|
CruxSystemLogBasic systemLog = CruxSystemLogBasic.builder()
|
||||||
|
.clientIp(clientIP)
|
||||||
|
.url(url)
|
||||||
|
.method(method)
|
||||||
|
.params(params)
|
||||||
|
.requestBody(requestBody)
|
||||||
|
.employeeNo(employeeNo)
|
||||||
|
.name(name)
|
||||||
|
.accessTime(accessTime).build();
|
||||||
|
jdbcCruxSystemLogBasicRepository.save(systemLog);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,10 +1,9 @@
|
||||||
package com.chint.infrastructure.config.webconfig;
|
package com.chint.infrastructure.config.webconfig;
|
||||||
|
|
||||||
|
import com.chint.infrastructure.config.LogConfig.CruxLogInterceptor;
|
||||||
import com.chint.infrastructure.config.LogConfig.RequestLoggingInterceptor;
|
import com.chint.infrastructure.config.LogConfig.RequestLoggingInterceptor;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.web.servlet.HandlerInterceptor;
|
|
||||||
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
import org.springframework.web.servlet.config.annotation.CorsRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
||||||
|
@ -24,6 +23,14 @@ public class WebConfig implements WebMvcConfigurer {
|
||||||
return new RequestLoggingInterceptor();
|
return new RequestLoggingInterceptor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关键接口日志记录
|
||||||
|
*/
|
||||||
|
@Bean
|
||||||
|
public CruxLogInterceptor getCruxLogInterceptor() {
|
||||||
|
return new CruxLogInterceptor();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addInterceptors(InterceptorRegistry registry) {
|
public void addInterceptors(InterceptorRegistry registry) {
|
||||||
registry.addInterceptor(new JwtTokenAdminInterceptor())
|
registry.addInterceptor(new JwtTokenAdminInterceptor())
|
||||||
|
@ -35,6 +42,14 @@ public class WebConfig implements WebMvcConfigurer {
|
||||||
registry.addInterceptor(getMyRequestLoggingInterceptor())
|
registry.addInterceptor(getMyRequestLoggingInterceptor())
|
||||||
.addPathPatterns("/**")
|
.addPathPatterns("/**")
|
||||||
.excludePathPatterns("/location/**", "/**/query/**", "/**/pageQuery/**");
|
.excludePathPatterns("/location/**", "/**/query/**", "/**/pageQuery/**");
|
||||||
|
//关键接口日志记录
|
||||||
|
registry.addInterceptor(getCruxLogInterceptor())
|
||||||
|
//报表
|
||||||
|
.addPathPatterns("/manage/consumption/export","/manage/standard/export","/manage/order/export",
|
||||||
|
//公告
|
||||||
|
"/system/announcement/save","/system/announcement/update",
|
||||||
|
//权限
|
||||||
|
"/users/add/role","/users/edit/role");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -20,6 +20,7 @@ import org.springframework.data.domain.Sort;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
|
@ -94,43 +95,56 @@ public class RoleRepositoryImpl implements RoleRepository {
|
||||||
Long userId = user.getUserId();
|
Long userId = user.getUserId();
|
||||||
List<String> orgCodeList = cacheRoleRepository
|
List<String> orgCodeList = cacheRoleRepository
|
||||||
.roleOrgCodeList(userId, null);
|
.roleOrgCodeList(userId, null);
|
||||||
List<SystemOrganizationVO> systemOrganizationVOList = cacheRoleRepository
|
if (orgCodeList == null) {
|
||||||
.roleOrgList(userId, null);
|
orgCodeList=systemOrganizationRepository.queryOrgCodeListByUserId(userId);
|
||||||
|
if (!orgCodeList.isEmpty()) {
|
||||||
if (systemOrganizationVOList == null || systemOrganizationVOList.isEmpty() ||
|
orgCodeList=orgCodeList.stream().filter(Objects::nonNull).toList();
|
||||||
orgCodeList == null || orgCodeList.isEmpty()) {
|
}
|
||||||
List<Role> roleList = user.getRoleList();
|
|
||||||
List<Long> orgListId = roleList
|
|
||||||
.stream()
|
|
||||||
.flatMap(role -> role.getRoleOrganizationList().stream())
|
|
||||||
.map(RoleOrganization::getOrgId)
|
|
||||||
.distinct()
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
// 获取所有的 SystemOrganization
|
|
||||||
List<SystemOrganization> rootOrganizations = systemOrganizationRepository.findByIdIn(orgListId);
|
|
||||||
|
|
||||||
// 展开所有的 SystemOrganization
|
|
||||||
rootOrganizations = systemOrganizationRepository.expandOrganizations(rootOrganizations);
|
|
||||||
|
|
||||||
orgCodeList = rootOrganizations.stream()
|
|
||||||
.map(SystemOrganization::getOrgShortCode)
|
|
||||||
.distinct()
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
systemOrganizationVOList = rootOrganizations.stream()
|
|
||||||
.map(SystemOrganization::mapToVO)
|
|
||||||
.distinct()
|
|
||||||
.toList();
|
|
||||||
|
|
||||||
cacheRoleRepository.evictRoleOrgCodeList(userId);
|
cacheRoleRepository.evictRoleOrgCodeList(userId);
|
||||||
cacheRoleRepository.roleOrgCodeList(userId, orgCodeList);
|
cacheRoleRepository.roleOrgCodeList(userId, orgCodeList);
|
||||||
cacheRoleRepository.evictRoleOrgList(userId);
|
|
||||||
cacheRoleRepository.roleOrgList(userId, systemOrganizationVOList);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置用户的角色组织列表
|
|
||||||
user.setRoleOrgCodeList(orgCodeList);
|
user.setRoleOrgCodeList(orgCodeList);
|
||||||
user.setRoleOrgList(systemOrganizationVOList);
|
|
||||||
|
|
||||||
|
// List<String> orgCodeList = cacheRoleRepository
|
||||||
|
// .roleOrgCodeList(userId, null);
|
||||||
|
// List<SystemOrganizationVO> systemOrganizationVOList = cacheRoleRepository
|
||||||
|
// .roleOrgList(userId, null);
|
||||||
|
//
|
||||||
|
// if (systemOrganizationVOList == null || systemOrganizationVOList.isEmpty() ||
|
||||||
|
// orgCodeList == null || orgCodeList.isEmpty()) {
|
||||||
|
// List<Role> roleList = user.getRoleList();
|
||||||
|
// List<Long> orgListId = roleList
|
||||||
|
// .stream()
|
||||||
|
// .flatMap(role -> role.getRoleOrganizationList().stream())
|
||||||
|
// .map(RoleOrganization::getOrgId)
|
||||||
|
// .distinct()
|
||||||
|
// .toList();
|
||||||
|
//
|
||||||
|
// // 获取所有的 SystemOrganization
|
||||||
|
// List<SystemOrganization> rootOrganizations = systemOrganizationRepository.findByIdIn(orgListId);
|
||||||
|
//
|
||||||
|
// // 展开所有的 SystemOrganization
|
||||||
|
// rootOrganizations = systemOrganizationRepository.expandOrganizations(rootOrganizations);
|
||||||
|
//
|
||||||
|
// orgCodeList = rootOrganizations.stream()
|
||||||
|
// .map(SystemOrganization::getOrgShortCode)
|
||||||
|
// .distinct()
|
||||||
|
// .toList();
|
||||||
|
//
|
||||||
|
// systemOrganizationVOList = rootOrganizations.stream()
|
||||||
|
// .map(SystemOrganization::mapToVO)
|
||||||
|
// .distinct()
|
||||||
|
// .toList();
|
||||||
|
//
|
||||||
|
// cacheRoleRepository.evictRoleOrgCodeList(userId);
|
||||||
|
// cacheRoleRepository.roleOrgCodeList(userId, orgCodeList);
|
||||||
|
// cacheRoleRepository.evictRoleOrgList(userId);
|
||||||
|
// cacheRoleRepository.roleOrgList(userId, systemOrganizationVOList);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 设置用户的角色组织列表
|
||||||
|
// user.setRoleOrgCodeList(orgCodeList);
|
||||||
|
// user.setRoleOrgList(systemOrganizationVOList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -139,6 +139,11 @@ public class SystemOrganizationRepositoryImpl implements SystemOrganizationRepos
|
||||||
.findFirst();
|
.findFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> queryOrgCodeListByUserId(Long userId) {
|
||||||
|
return jdbcSystemOrganizationRepository.queryOrgCodeListByUserId(userId);
|
||||||
|
}
|
||||||
|
|
||||||
private void expandOrganizationRecursively(SystemOrganization org,
|
private void expandOrganizationRecursively(SystemOrganization org,
|
||||||
List<SystemOrganization> allOrganizations) {
|
List<SystemOrganization> allOrganizations) {
|
||||||
if (org == null) {
|
if (org == null) {
|
||||||
|
|
|
@ -6,6 +6,7 @@ import com.chint.manage.entity.query.OrderPageQuery;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.PageRequest;
|
import org.springframework.data.domain.PageRequest;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.data.jdbc.repository.query.Modifying;
|
||||||
import org.springframework.data.jdbc.repository.query.Query;
|
import org.springframework.data.jdbc.repository.query.Query;
|
||||||
import org.springframework.data.repository.CrudRepository;
|
import org.springframework.data.repository.CrudRepository;
|
||||||
import org.springframework.data.repository.query.Param;
|
import org.springframework.data.repository.query.Param;
|
||||||
|
@ -32,26 +33,4 @@ public interface JdbcOrderDetailRepository extends CrudRepository<OrderDetail, L
|
||||||
List<OrderDetail> findByCreateTimeBetweenAndProductType(LocalDateTime createTime, LocalDateTime createTime2, Integer productType);
|
List<OrderDetail> findByCreateTimeBetweenAndProductType(LocalDateTime createTime, LocalDateTime createTime2, Integer productType);
|
||||||
List<OrderDetail> findByCreateTimeBetweenAndProductTypeAndOrderNoContaining(LocalDateTime createTime, LocalDateTime createTime2, Integer productType, String orderNo);
|
List<OrderDetail> findByCreateTimeBetweenAndProductTypeAndOrderNoContaining(LocalDateTime createTime, LocalDateTime createTime2, Integer productType, String orderNo);
|
||||||
List<OrderDetail> findByUpdateTimeBetween(LocalDateTime createTime, LocalDateTime createTime2);
|
List<OrderDetail> findByUpdateTimeBetween(LocalDateTime createTime, LocalDateTime createTime2);
|
||||||
|
|
||||||
List<OrderDetail> findAllByRouteIdIn(List<Long> routeIds);
|
|
||||||
|
|
||||||
|
|
||||||
@Query("SELECT * FROM order_detail " +
|
|
||||||
"WHERE route_id IN (:#{#dto.routeIds}) " +
|
|
||||||
"AND (:#{#dto.orderNo} ='' OR order_no LIKE :#{#dto.orderNo}) " +
|
|
||||||
"AND (:#{#dto.startTime} IS NULL OR :#{#dto.endTime} IS NULL OR order_date BETWEEN :#{#dto.startTime} AND :#{#dto.endTime}) " +
|
|
||||||
"AND (:#{#dto.productType} ='' OR product_type = :#{#dto.productType}) " +
|
|
||||||
"AND (:#{#dto.employeeNo} ='' OR employee_no = :#{#dto.employeeNo}) " +
|
|
||||||
"AND (:#{#dto.employeeNosEmpty} = TRUE OR employee_no IN (:#{#dto.employeeNos}))" +
|
|
||||||
"LIMIT :#{#pageRequest.pageSize} OFFSET :#{#pageRequest.pageNumber}")
|
|
||||||
List<OrderDetail> listByCondition(@Param("dto") OrderPageQuery dto, @Param("pageRequest")PageRequest pageRequest);
|
|
||||||
|
|
||||||
@Query("SELECT COUNT(*) FROM order_detail " +
|
|
||||||
"WHERE route_id IN (:#{#dto.routeIds}) " +
|
|
||||||
"AND (:#{#dto.orderNo} ='' OR order_no LIKE :#{#dto.orderNo}) " +
|
|
||||||
"AND (:#{#dto.startTime} IS NULL OR :#{#dto.endTime} IS NULL OR order_date BETWEEN :#{#dto.startTime} AND :#{#dto.endTime} ) " +
|
|
||||||
"AND (:#{#dto.productType} ='' OR product_type = :#{#dto.productType}) "+
|
|
||||||
"AND (:#{#dto.employeeNo} ='' OR employee_no = :#{#dto.employeeNo}) " +
|
|
||||||
"AND (:#{#dto.employeeNosEmpty} = TRUE OR employee_no IN (:#{#dto.employeeNos}))")
|
|
||||||
Integer countByCondition(@Param("dto") OrderPageQuery dto);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.chint.infrastructure.repository.jdbc;
|
package com.chint.infrastructure.repository.jdbc;
|
||||||
|
|
||||||
import com.chint.domain.aggregates.system.SystemOrganization;
|
import com.chint.domain.aggregates.system.SystemOrganization;
|
||||||
|
import org.springframework.data.jdbc.repository.query.Query;
|
||||||
import org.springframework.data.repository.CrudRepository;
|
import org.springframework.data.repository.CrudRepository;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@ -15,5 +16,11 @@ public interface JdbcSystemOrganizationRepository extends CrudRepository<SystemO
|
||||||
List<SystemOrganization> findByOrgLevelIsNullOrOrgLevel(String orgLevel);
|
List<SystemOrganization> findByOrgLevelIsNullOrOrgLevel(String orgLevel);
|
||||||
List<SystemOrganization> findByOrgShortCodeIn(Collection<String> orgCode);
|
List<SystemOrganization> findByOrgShortCodeIn(Collection<String> orgCode);
|
||||||
List<SystemOrganization> findByIdIn(Collection<Long> id);
|
List<SystemOrganization> findByIdIn(Collection<Long> id);
|
||||||
|
|
||||||
|
@Query("select so.org_short_code from role_organization ro,system_organization so,role_user ru " +
|
||||||
|
"where ro.org_id = so.id " +
|
||||||
|
"and ro.role_id = ru.role_id " +
|
||||||
|
"and ru.user_id = :#{#userId}")
|
||||||
|
List<String> queryOrgCodeListByUserId(Long userId);
|
||||||
List<SystemOrganization> findByOrgName(String orgName);
|
List<SystemOrganization> findByOrgName(String orgName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
package com.chint.manage.entity;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import org.springframework.data.annotation.Id;
|
||||||
|
import org.springframework.data.relational.core.mapping.Table;
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author xx CruxSystemLogBasic.java
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
|
@Table("crux_system_log")
|
||||||
|
public class CruxSystemLogBasic implements Serializable {
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Id
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
/**员工SF号**/
|
||||||
|
private String employeeNo;
|
||||||
|
|
||||||
|
/**员工姓名**/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**访问时间**/
|
||||||
|
private String accessTime;
|
||||||
|
|
||||||
|
/**请求IP**/
|
||||||
|
private String clientIp;
|
||||||
|
|
||||||
|
/**请求路径**/
|
||||||
|
private String url;
|
||||||
|
|
||||||
|
/**请求方法**/
|
||||||
|
private String method;
|
||||||
|
|
||||||
|
/**参数**/
|
||||||
|
private String params;
|
||||||
|
|
||||||
|
/**请求体**/
|
||||||
|
private String requestBody;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,79 @@
|
||||||
|
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;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author xx OrderDetailBasic.java
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
@Data
|
||||||
|
@Table("order_detail")
|
||||||
|
public class OrderDetailBasic implements Serializable {
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
@Id
|
||||||
|
private Long orderId;
|
||||||
|
|
||||||
|
/****/
|
||||||
|
private Long routeId;
|
||||||
|
|
||||||
|
/****/
|
||||||
|
private Long routeOrderKey;
|
||||||
|
|
||||||
|
/****/
|
||||||
|
private String orderNo;
|
||||||
|
|
||||||
|
/****/
|
||||||
|
private LocalDateTime startTime;
|
||||||
|
|
||||||
|
/****/
|
||||||
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
|
/****/
|
||||||
|
private Long originId;
|
||||||
|
|
||||||
|
/****/
|
||||||
|
private Long destinationId;
|
||||||
|
|
||||||
|
/****/
|
||||||
|
private String supplierName;
|
||||||
|
|
||||||
|
/**商品类型 0-火车 1飞机 2酒店 3打车 4其他**/
|
||||||
|
private Integer productType;
|
||||||
|
|
||||||
|
/****/
|
||||||
|
private String price;
|
||||||
|
|
||||||
|
/****/
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
/****/
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
/****/
|
||||||
|
private String currencyType;
|
||||||
|
|
||||||
|
/****/
|
||||||
|
private LocalDateTime orderDate;
|
||||||
|
|
||||||
|
/****/
|
||||||
|
private Long legId;
|
||||||
|
|
||||||
|
/****/
|
||||||
|
private Integer quantity;
|
||||||
|
|
||||||
|
/****/
|
||||||
|
private String employeeNo;
|
||||||
|
|
||||||
|
/****/
|
||||||
|
private Integer ifOrigin;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -13,7 +13,7 @@ import java.io.Serializable;
|
||||||
**/
|
**/
|
||||||
@Data
|
@Data
|
||||||
@Table("route_order_extension_field")
|
@Table("route_order_extension_field")
|
||||||
public class RouteOrderExtensionField implements Serializable {
|
public class RouteOrderExtensionFieldBasic implements Serializable {
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
/****/
|
/****/
|
|
@ -4,6 +4,9 @@ import com.chint.domain.value_object.BaseQuery;
|
||||||
import com.chint.manage.util.BaseUtil;
|
import com.chint.manage.util.BaseUtil;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @Author:nxj
|
* @Author:nxj
|
||||||
|
@ -17,6 +20,8 @@ public class ConsumptionDetailQuery extends BaseQuery{
|
||||||
private Integer productType;
|
private Integer productType;
|
||||||
private String userName="";
|
private String userName="";
|
||||||
private String actualOrderNo=""; //申请单号
|
private String actualOrderNo=""; //申请单号
|
||||||
|
private List<Long> orderIds=new ArrayList<>();
|
||||||
|
private List<String> orderNos=new ArrayList<>();
|
||||||
|
|
||||||
public String getActualOrderNo() {
|
public String getActualOrderNo() {
|
||||||
return BaseUtil.extractAfterDash(actualOrderNo);
|
return BaseUtil.extractAfterDash(actualOrderNo);
|
||||||
|
|
|
@ -13,7 +13,7 @@ public class ItineraryPageQuery extends BaseQuery {
|
||||||
private String applicant="";// 申请人
|
private String applicant="";// 申请人
|
||||||
private String actualOrderNo=""; //申请单号
|
private String actualOrderNo=""; //申请单号
|
||||||
private List<String> userIds=new ArrayList<>();
|
private List<String> userIds=new ArrayList<>();
|
||||||
private List<Long> routeIds;
|
private List<Long> routeIds=new ArrayList<>();
|
||||||
|
|
||||||
|
|
||||||
public String getActualOrderNo() {
|
public String getActualOrderNo() {
|
||||||
|
|
|
@ -13,11 +13,5 @@ import java.util.List;
|
||||||
@Repository
|
@Repository
|
||||||
public interface JdbcCarOrderDetailRepository extends CrudRepository<CarOrderDetail, Long> {
|
public interface JdbcCarOrderDetailRepository extends CrudRepository<CarOrderDetail, Long> {
|
||||||
|
|
||||||
Page<CarOrderDetail> findAllByUserNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable);
|
|
||||||
|
|
||||||
Page<CarOrderDetail> findAllByUserNameContainsAndOrderNoInAndOrderIdIn(String userName, List<String> orderNo,List<Long> orderIds, Pageable pageable);
|
|
||||||
|
|
||||||
Page<CarOrderDetail> findAllByUserNameContainsAndOrderIdIn(String userName,List<Long> orderIds, Pageable pageable);
|
|
||||||
|
|
||||||
List<CarOrderDetail> findAllByOrderIdIn(List<Long> orderIds);
|
List<CarOrderDetail> findAllByOrderIdIn(List<Long> orderIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
package com.chint.manage.mapper;
|
||||||
|
import com.chint.manage.entity.CruxSystemLogBasic;
|
||||||
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author xx JdbcCruxSystemLogBasicRepository数据库操作接口类
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
@Repository
|
||||||
|
public interface JdbcCruxSystemLogBasicRepository extends CrudRepository<CruxSystemLogBasic,Long> {
|
||||||
|
|
||||||
|
}
|
|
@ -12,11 +12,5 @@ import java.util.List;
|
||||||
@Repository
|
@Repository
|
||||||
public interface JdbcFlightOrderDetailRepository extends CrudRepository<FlightOrderDetail, Long> {
|
public interface JdbcFlightOrderDetailRepository extends CrudRepository<FlightOrderDetail, Long> {
|
||||||
|
|
||||||
Page<FlightOrderDetail> findAllByUserNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable);
|
|
||||||
|
|
||||||
Page<FlightOrderDetail> findAllByUserNameContainsAndOrderNoInAndOrderIdIn(String userName, List<String> orderNo,List<Long> orderIds, Pageable pageable);
|
|
||||||
|
|
||||||
Page<FlightOrderDetail> findAllByUserNameContainsAndOrderIdIn(String userName,List<Long> orderIds, Pageable pageable);
|
|
||||||
|
|
||||||
List<FlightOrderDetail> findAllByOrderIdIn(List<Long> orderIds);
|
List<FlightOrderDetail> findAllByOrderIdIn(List<Long> orderIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,11 +14,5 @@ import java.util.List;
|
||||||
@Repository
|
@Repository
|
||||||
public interface JdbcHotelOrderDetailRepository extends CrudRepository<HotelOrderDetail, Long> {
|
public interface JdbcHotelOrderDetailRepository extends CrudRepository<HotelOrderDetail, Long> {
|
||||||
|
|
||||||
Page<HotelOrderDetail> findAllByBookingNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable);
|
|
||||||
|
|
||||||
Page<HotelOrderDetail> findAllByBookingNameContainsAndOrderNoInAndOrderIdIn(String userName, List<String> orderNo,List<Long> orderIds, Pageable pageable);
|
|
||||||
|
|
||||||
Page<HotelOrderDetail> findAllByBookingNameContainsAndOrderIdIn(String userName,List<Long> orderIds, Pageable pageable);
|
|
||||||
|
|
||||||
List<HotelOrderDetail> findAllByOrderIdIn(List<Long> orderIds);
|
List<HotelOrderDetail> findAllByOrderIdIn(List<Long> orderIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
package com.chint.manage.mapper;
|
||||||
|
import com.chint.domain.aggregates.order.OrderDetail;
|
||||||
|
import com.chint.manage.entity.OrderDetailBasic;
|
||||||
|
import com.chint.manage.entity.query.OrderPageQuery;
|
||||||
|
import org.springframework.data.domain.PageRequest;
|
||||||
|
import org.springframework.data.jdbc.repository.query.Query;
|
||||||
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author xx JdbcOrderDetailBasicRepository数据库操作接口类
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
@Repository
|
||||||
|
public interface JdbcOrderDetailBasicRepository extends CrudRepository<OrderDetailBasic,Long> {
|
||||||
|
|
||||||
|
List<OrderDetailBasic> findByRouteIdIn(List<Long> routeIds);
|
||||||
|
|
||||||
|
@Query("SELECT order_no FROM order_detail " +
|
||||||
|
"WHERE route_id IN (:#{#routeIds})")
|
||||||
|
List<String> findAllOrderNo(@Param("routeIds") List<Long> routeIds);
|
||||||
|
|
||||||
|
@Query("SELECT order_id FROM order_detail " +
|
||||||
|
"WHERE route_id IN (:#{#routeIds})")
|
||||||
|
List<Long> findAllOrderId(@Param("routeIds") List<Long> routeIds);
|
||||||
|
|
||||||
|
@Query("SELECT order_no FROM order_detail " )
|
||||||
|
List<String> findAllOrderNo();
|
||||||
|
|
||||||
|
@Query("SELECT order_id FROM order_detail ")
|
||||||
|
List<Long> findAllOrderId();
|
||||||
|
|
||||||
|
|
||||||
|
@Query("SELECT * FROM order_detail " +
|
||||||
|
"WHERE route_id IN (:#{#dto.routeIds}) " +
|
||||||
|
// "WHERE 1=1 " +
|
||||||
|
"AND (:#{#dto.orderNo} ='' OR order_no LIKE :#{#dto.orderNo}) " +
|
||||||
|
"AND (:#{#dto.startTime} IS NULL OR :#{#dto.endTime} IS NULL OR order_date BETWEEN :#{#dto.startTime} AND :#{#dto.endTime}) " +
|
||||||
|
"AND (:#{#dto.productType} ='' OR product_type = :#{#dto.productType}) " +
|
||||||
|
"AND (:#{#dto.employeeNo} ='' OR employee_no = :#{#dto.employeeNo}) " +
|
||||||
|
"AND (:#{#dto.employeeNosEmpty} = TRUE OR employee_no IN (:#{#dto.employeeNos}))" +
|
||||||
|
"LIMIT :#{#pageRequest.pageSize} OFFSET :#{#pageRequest.pageNumber}")
|
||||||
|
List<OrderDetailBasic> listByCondition(@Param("dto") OrderPageQuery dto, @Param("pageRequest") PageRequest pageRequest);
|
||||||
|
|
||||||
|
@Query("SELECT COUNT(*) FROM order_detail " +
|
||||||
|
"WHERE route_id IN (:#{#dto.routeIds}) " +
|
||||||
|
// "WHERE 1=1 " +
|
||||||
|
"AND (:#{#dto.orderNo} ='' OR order_no LIKE :#{#dto.orderNo}) " +
|
||||||
|
"AND (:#{#dto.startTime} IS NULL OR :#{#dto.endTime} IS NULL OR order_date BETWEEN :#{#dto.startTime} AND :#{#dto.endTime} ) " +
|
||||||
|
"AND (:#{#dto.productType} ='' OR product_type = :#{#dto.productType}) "+
|
||||||
|
"AND (:#{#dto.employeeNo} ='' OR employee_no = :#{#dto.employeeNo}) " +
|
||||||
|
"AND (:#{#dto.employeeNosEmpty} = TRUE OR employee_no IN (:#{#dto.employeeNos}))")
|
||||||
|
Integer countByCondition(@Param("dto") OrderPageQuery dto);
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package com.chint.manage.mapper;
|
||||||
|
|
||||||
import com.chint.manage.entity.OrderExceedStandard;
|
import com.chint.manage.entity.OrderExceedStandard;
|
||||||
import io.lettuce.core.dynamic.annotation.Param;
|
import io.lettuce.core.dynamic.annotation.Param;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
import org.springframework.data.jdbc.repository.query.Modifying;
|
import org.springframework.data.jdbc.repository.query.Modifying;
|
||||||
|
@ -18,5 +19,8 @@ public interface JdbcOrderExceedStandardRepository extends CrudRepository<OrderE
|
||||||
@Query("UPDATE order_exceed_standard SET approval_status = :status WHERE order_no = :orderNo")
|
@Query("UPDATE order_exceed_standard SET approval_status = :status WHERE order_no = :orderNo")
|
||||||
void updateApprovalStatusById(@Param("status") String status, @Param("orderNo") String orderNo);
|
void updateApprovalStatusById(@Param("status") String status, @Param("orderNo") String orderNo);
|
||||||
|
|
||||||
Page<OrderExceedStandard> findAllByApplicantContainsAndCompanyNameContainsAndActualOrderNoContainsAndOrderNoContainsAndOrderNoIn(String applicant, String company, String actualOrderNo, String orderNo, List<String> orderNos, Pageable pageable);
|
List<OrderExceedStandard> findAll();
|
||||||
|
|
||||||
|
Page<OrderExceedStandard> findAllByApplicantContainsAndDeptNameContainsAndActualOrderNoContainsAndOrderNoContainsAndOrderNoIn(String applicant, String company, String actualOrderNo, String orderNo, List<String> orderNos, Pageable pageable);
|
||||||
|
//Page<OrderExceedStandard> findAllByApplicantContainsAndDeptNameContainsAndActualOrderNoContainsAndOrderNoContains(String applicant, String company, String actualOrderNo, String orderNo, Pageable pageable);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.chint.manage.mapper;
|
||||||
|
import com.chint.manage.entity.RouteOrderExtensionFieldBasic;
|
||||||
|
import org.springframework.data.jdbc.repository.query.Query;
|
||||||
|
import org.springframework.data.repository.CrudRepository;
|
||||||
|
import org.springframework.data.repository.query.Param;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author xx JdbcRouteOrderExtensionFieldRepository数据库操作接口类
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
@Repository
|
||||||
|
public interface JdbcRouteOrderExtensionFieldBasicRepository extends CrudRepository<RouteOrderExtensionFieldBasic,Long> {
|
||||||
|
|
||||||
|
List<RouteOrderExtensionFieldBasic> findAllByBelongDeptCodeIn(@Param("belongDeptCode") List<String> belongDeptCode);
|
||||||
|
}
|
|
@ -1,18 +0,0 @@
|
||||||
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);
|
|
||||||
}
|
|
|
@ -11,11 +11,5 @@ import java.util.List;
|
||||||
@Repository
|
@Repository
|
||||||
public interface JdbcTrainOrderDetailRepository extends CrudRepository<TrainOrderDetail, Long> {
|
public interface JdbcTrainOrderDetailRepository extends CrudRepository<TrainOrderDetail, Long> {
|
||||||
|
|
||||||
Page<TrainOrderDetail> findAllByUserNameContainsAndOrderNoContaining(String userName, String orderNo, Pageable pageable);
|
|
||||||
|
|
||||||
Page<TrainOrderDetail> findAllByUserNameContainsAndOrderNoInAndOrderIdIn(String userName, List<String> orderNo,List<Long> orderIds ,Pageable pageable);
|
|
||||||
|
|
||||||
Page<TrainOrderDetail> findAllByUserNameContainsAndOrderIdIn(String userName,List<Long> orderIds, Pageable pageable);
|
|
||||||
|
|
||||||
List<TrainOrderDetail> findAllByOrderIdIn(List<Long> orderIds);
|
List<TrainOrderDetail> findAllByOrderIdIn(List<Long> orderIds);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,15 +35,6 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private NamedParameterJdbcTemplate jdbcTemplate;
|
private NamedParameterJdbcTemplate jdbcTemplate;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private JdbcTrainOrderDetailRepository jdbcTrainOrderDetailRepository;
|
|
||||||
@Autowired
|
|
||||||
private JdbcCarOrderDetailRepository jdbcCarOrderDetailRepository;
|
|
||||||
@Autowired
|
|
||||||
private JdbcHotelOrderDetailRepository jdbcHotelOrderDetailRepository;
|
|
||||||
@Autowired
|
|
||||||
private JdbcFlightOrderDetailRepository jdbcFlightOrderDetailRepository;
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private JdbcRouteRepository jdbcRouteRepository;
|
private JdbcRouteRepository jdbcRouteRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -55,24 +46,26 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai
|
||||||
@Override
|
@Override
|
||||||
public Page<ItineraryPageDto> itineraryPageQueryByDto(ItineraryPageQuery dto) {
|
public Page<ItineraryPageDto> itineraryPageQueryByDto(ItineraryPageQuery dto) {
|
||||||
String query = "SELECT * FROM route_order "
|
String query = "SELECT * FROM route_order "
|
||||||
+ "WHERE route_id IN (:routeIds) "
|
+ "WHERE actual_order_no IS NOT NULL ";
|
||||||
+ "AND (:actualOrderNo IS NULL OR actual_order_no = :actualOrderNo ) "
|
|
||||||
+ "AND actual_order_no IS NOT NULL ";
|
if (!dto.getRouteIds().isEmpty()) {
|
||||||
|
query+="AND route_id IN (:routeIds) ";
|
||||||
|
}
|
||||||
|
|
||||||
if (!dto.getUserIds().isEmpty()) {
|
if (!dto.getUserIds().isEmpty()) {
|
||||||
query+="AND user_id IN (:userIds)";
|
query+="AND user_id IN (:userIds) ";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!dto.getActualOrderNo().isEmpty()) {
|
||||||
|
query+="AND actual_order_no = :actualOrderNo ";
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
//设置null
|
PageRequest pageRequest = PageRequest
|
||||||
if (dto.getActualOrderNo().isEmpty()){
|
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("create_time").descending());
|
||||||
dto.setActualOrderNo(null);
|
|
||||||
}
|
|
||||||
params.put("actualOrderNo", dto.getActualOrderNo());
|
params.put("actualOrderNo", dto.getActualOrderNo());
|
||||||
params.put("userIds", dto.getUserIds());
|
params.put("userIds", dto.getUserIds());
|
||||||
params.put("routeIds", dto.getRouteIds());
|
params.put("routeIds", dto.getRouteIds());
|
||||||
PageRequest pageRequest = PageRequest
|
|
||||||
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("route_id").descending());
|
|
||||||
params.put("offset", pageRequest.getOffset());
|
params.put("offset", pageRequest.getOffset());
|
||||||
params.put("limit", pageRequest.getPageSize());
|
params.put("limit", pageRequest.getPageSize());
|
||||||
|
|
||||||
|
@ -91,9 +84,6 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai
|
||||||
if (orderIds==null||orderIds.isEmpty()) {
|
if (orderIds==null||orderIds.isEmpty()) {
|
||||||
return PageResult.totalPageNum(0, new ArrayList<>());
|
return PageResult.totalPageNum(0, new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
|
||||||
PageRequest pageRequest = PageRequest
|
|
||||||
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("id").descending());
|
|
||||||
Page<? extends BaseExcel> data=new PageImpl<>(Collections.emptyList());
|
Page<? extends BaseExcel> data=new PageImpl<>(Collections.emptyList());
|
||||||
//申请单查询
|
//申请单查询
|
||||||
if (!dto.getActualOrderNo().isEmpty()){
|
if (!dto.getActualOrderNo().isEmpty()){
|
||||||
|
@ -101,79 +91,100 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai
|
||||||
if (orderNos.isEmpty()){
|
if (orderNos.isEmpty()){
|
||||||
return new PageResult<BaseExcel>(0,new ArrayList<>());
|
return new PageResult<BaseExcel>(0,new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
dto.setOrderNos(orderNos);
|
||||||
|
}
|
||||||
|
|
||||||
switch (dto.getProductType()) {
|
switch (dto.getProductType()) {
|
||||||
case LEG_TYPE_TRAIN -> data=getOrderTrainRecord(jdbcTrainOrderDetailRepository.findAllByUserNameContainsAndOrderNoInAndOrderIdIn(dto.getUserName(),orderNos,orderIds,pageRequest));
|
case LEG_TYPE_TRAIN -> data=trainPageConsumptionDetail(dto);
|
||||||
case LEG_TYPE_AIRPLANE -> data=getOrderFlightRecord(jdbcFlightOrderDetailRepository.findAllByUserNameContainsAndOrderNoInAndOrderIdIn(dto.getUserName(),orderNos,orderIds,pageRequest));
|
case LEG_TYPE_AIRPLANE -> data=flightPageConsumptionDetail(dto);
|
||||||
case LEG_TYPE_HOTEL -> data=getOrderHotelRecord(jdbcHotelOrderDetailRepository.findAllByBookingNameContainsAndOrderNoInAndOrderIdIn(dto.getUserName(),orderNos,orderIds,pageRequest));
|
case LEG_TYPE_HOTEL -> data=hotelPageConsumptionDetail(dto);
|
||||||
case LEG_TYPE_TAXI -> data=getOrderCarRecord(jdbcCarOrderDetailRepository.findAllByUserNameContainsAndOrderNoInAndOrderIdIn(dto.getUserName(),orderNos,orderIds,pageRequest));
|
case LEG_TYPE_TAXI -> data=carPageConsumptionDetail(dto);
|
||||||
}
|
}
|
||||||
return PageResult.totalPageNum(data.getTotalElements(), data.getContent());
|
return PageResult.totalPageNum(data.getTotalElements(), data.getContent());
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (dto.getProductType()) {
|
|
||||||
case LEG_TYPE_TRAIN -> data=getOrderTrainRecord(jdbcTrainOrderDetailRepository.findAllByUserNameContainsAndOrderIdIn(dto.getUserName(),orderIds,pageRequest));
|
private Page<TrainOrderDetailExcel> trainPageConsumptionDetail(ConsumptionDetailQuery dto){
|
||||||
case LEG_TYPE_AIRPLANE -> data=getOrderFlightRecord(jdbcFlightOrderDetailRepository.findAllByUserNameContainsAndOrderIdIn(dto.getUserName(),orderIds,pageRequest));
|
String query = "SELECT * FROM train_order_detail "
|
||||||
case LEG_TYPE_HOTEL -> data=getOrderHotelRecord(jdbcHotelOrderDetailRepository.findAllByBookingNameContainsAndOrderIdIn(dto.getUserName(),orderIds,pageRequest));
|
+ "WHERE 1=1 ";
|
||||||
case LEG_TYPE_TAXI -> data=getOrderCarRecord(jdbcCarOrderDetailRepository.findAllByUserNameContainsAndOrderIdIn(dto.getUserName(),orderIds,pageRequest));
|
|
||||||
}
|
Map<String, Object> params = new HashMap<>();
|
||||||
return PageResult.totalPageNum(data.getTotalElements(), data.getContent());
|
PageRequest pageRequest = PageRequest
|
||||||
|
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("create_time").descending());
|
||||||
|
query = getString(dto, query, params, pageRequest);
|
||||||
|
|
||||||
|
String pagedQuery = query + " LIMIT :limit OFFSET :offset";
|
||||||
|
long count = jdbcTemplate.queryForObject("SELECT COUNT(*) FROM (" + query + ") AS count", params, Long.class);
|
||||||
|
List<TrainOrderDetailExcel> results = jdbcTemplate.query(pagedQuery, params, BeanPropertyRowMapper.newInstance(TrainOrderDetailExcel.class));
|
||||||
|
return new PageImpl<>(results, pageRequest, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page<TrainOrderDetailExcel> getOrderTrainRecord(Page<TrainOrderDetail> page) {
|
private Page<FlightOrderDetailExcel> flightPageConsumptionDetail(ConsumptionDetailQuery dto){
|
||||||
List<TrainOrderDetail> orderRecords = page.getContent();
|
String query = "SELECT * FROM flight_order_detail "
|
||||||
List<TrainOrderDetailExcel> trainOrderDetailExcels = new ArrayList<>();
|
+ "WHERE 1=1 ";
|
||||||
// 遍历 OrderBaseRecord,将其转换为 ConsumptionDetailExcel
|
|
||||||
for (TrainOrderDetail orderRecord : orderRecords) {
|
Map<String, Object> params = new HashMap<>();
|
||||||
TrainOrderDetailExcel trainOrderDetailExcel = new TrainOrderDetailExcel();
|
PageRequest pageRequest = PageRequest
|
||||||
BeanUtils.copyProperties(orderRecord, trainOrderDetailExcel);
|
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("create_time").descending());
|
||||||
trainOrderDetailExcels.add(trainOrderDetailExcel);
|
query = getString(dto, query, params, pageRequest);
|
||||||
}
|
|
||||||
// 构建一个新的 Page<ConsumptionDetailExcel> 对象并返回
|
String pagedQuery = query + " LIMIT :limit OFFSET :offset";
|
||||||
return new PageImpl<>(trainOrderDetailExcels, page.getPageable(), page.getTotalElements());
|
long count = jdbcTemplate.queryForObject("SELECT COUNT(*) FROM (" + query + ") AS count", params, Long.class);
|
||||||
|
List<FlightOrderDetailExcel> results = jdbcTemplate.query(pagedQuery, params, BeanPropertyRowMapper.newInstance(FlightOrderDetailExcel.class));
|
||||||
|
return new PageImpl<>(results, pageRequest, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page<FlightOrderDetailExcel> getOrderFlightRecord(Page<FlightOrderDetail> page) {
|
private Page<HotelOrderDetailExcel> hotelPageConsumptionDetail(ConsumptionDetailQuery dto){
|
||||||
List<FlightOrderDetail> orderRecords = page.getContent();
|
String query = "SELECT * FROM hotel_order_detail "
|
||||||
List<FlightOrderDetailExcel> trainOrderDetailExcels = new ArrayList<>();
|
+ "WHERE 1=1 ";
|
||||||
for (FlightOrderDetail orderRecord : orderRecords) {
|
|
||||||
FlightOrderDetailExcel flightOrderDetailExcel = new FlightOrderDetailExcel();
|
Map<String, Object> params = new HashMap<>();
|
||||||
BeanUtils.copyProperties(orderRecord, flightOrderDetailExcel);
|
PageRequest pageRequest = PageRequest
|
||||||
trainOrderDetailExcels.add(flightOrderDetailExcel);
|
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("create_time").descending());
|
||||||
}
|
query = getString(dto, query, params, pageRequest);
|
||||||
// 构建一个新的 Page<ConsumptionDetailExcel> 对象并返回
|
|
||||||
return new PageImpl<>(trainOrderDetailExcels, page.getPageable(), page.getTotalElements());
|
String pagedQuery = query + " LIMIT :limit OFFSET :offset";
|
||||||
|
long count = jdbcTemplate.queryForObject("SELECT COUNT(*) FROM (" + query + ") AS count", params, Long.class);
|
||||||
|
List<HotelOrderDetailExcel> results = jdbcTemplate.query(pagedQuery, params, BeanPropertyRowMapper.newInstance(HotelOrderDetailExcel.class));
|
||||||
|
return new PageImpl<>(results, pageRequest, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page<HotelOrderDetailExcel> getOrderHotelRecord(Page<HotelOrderDetail> page) {
|
private Page<CarOrderDetailExcel> carPageConsumptionDetail(ConsumptionDetailQuery dto){
|
||||||
List<HotelOrderDetail> orderRecords = page.getContent();
|
String query = "SELECT * FROM car_order_detail "
|
||||||
List<HotelOrderDetailExcel> trainOrderDetailExcels = new ArrayList<>();
|
+ "WHERE 1=1 ";
|
||||||
|
|
||||||
for (HotelOrderDetail orderRecord : orderRecords) {
|
Map<String, Object> params = new HashMap<>();
|
||||||
HotelOrderDetailExcel hotelOrderDetailExcel = new HotelOrderDetailExcel();
|
PageRequest pageRequest = PageRequest
|
||||||
BeanUtils.copyProperties(orderRecord, hotelOrderDetailExcel);
|
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("create_time").descending());
|
||||||
List<HotelOrderDetailCustomer> customers=orderRecord.getCustomers();
|
|
||||||
String userNames = customers.stream()
|
query = getString(dto, query, params, pageRequest);
|
||||||
.map(HotelOrderDetailCustomer::getUserName) // 获取用户名
|
|
||||||
.collect(Collectors.joining(",")); // 用逗号分隔拼接
|
String pagedQuery = query + " LIMIT :limit OFFSET :offset";
|
||||||
hotelOrderDetailExcel.setUserName(userNames);
|
long count = jdbcTemplate.queryForObject("SELECT COUNT(*) FROM (" + query + ") AS count", params, Long.class);
|
||||||
trainOrderDetailExcels.add(hotelOrderDetailExcel);
|
List<CarOrderDetailExcel> results = jdbcTemplate.query(pagedQuery, params, BeanPropertyRowMapper.newInstance(CarOrderDetailExcel.class));
|
||||||
}
|
return new PageImpl<>(results, pageRequest, count);
|
||||||
// 构建一个新的 Page<ConsumptionDetailExcel> 对象并返回
|
|
||||||
return new PageImpl<>(trainOrderDetailExcels, page.getPageable(), page.getTotalElements());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Page<CarOrderDetailExcel> getOrderCarRecord(Page<CarOrderDetail> page) {
|
private static String getString(ConsumptionDetailQuery dto, String query, Map<String, Object> params, PageRequest pageRequest) {
|
||||||
List<CarOrderDetail> orderRecords = page.getContent();
|
if (!dto.getUserName().isEmpty()) {
|
||||||
List<CarOrderDetailExcel> trainOrderDetailExcels = new ArrayList<>();
|
dto.setUserName("%"+ dto.getUserName()+"%");
|
||||||
|
query +="AND user_name LIKE (:userName)";
|
||||||
// 遍历 OrderBaseRecord,将其转换为 ConsumptionDetailExcel
|
|
||||||
for (CarOrderDetail orderRecord : orderRecords) {
|
|
||||||
CarOrderDetailExcel carOrderDetailExcel = new CarOrderDetailExcel();
|
|
||||||
BeanUtils.copyProperties(orderRecord, carOrderDetailExcel);
|
|
||||||
trainOrderDetailExcels.add(carOrderDetailExcel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 构建一个新的 Page<ConsumptionDetailExcel> 对象并返回
|
if (!dto.getOrderIds().isEmpty()) {
|
||||||
return new PageImpl<>(trainOrderDetailExcels, page.getPageable(), page.getTotalElements());
|
query +="AND order_id IN (:orderIds)";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!dto.getOrderNos().isEmpty()) {
|
||||||
|
query +="AND order_no IN (:orderNos)";
|
||||||
|
}
|
||||||
|
|
||||||
|
params.put("userName", dto.getUserName());
|
||||||
|
params.put("orderNos", dto.getOrderNos());
|
||||||
|
params.put("orderIds", dto.getOrderIds());
|
||||||
|
|
||||||
|
params.put("offset", pageRequest.getOffset());
|
||||||
|
params.put("limit", pageRequest.getPageSize());
|
||||||
|
return query;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,14 +7,14 @@ import com.chint.domain.exceptions.CommandException;
|
||||||
import com.chint.domain.repository.UserRepository;
|
import com.chint.domain.repository.UserRepository;
|
||||||
import com.chint.domain.service.LegDomainService;
|
import com.chint.domain.service.LegDomainService;
|
||||||
import com.chint.infrastructure.repository.jdbc.JdbcLocationRepository;
|
import com.chint.infrastructure.repository.jdbc.JdbcLocationRepository;
|
||||||
import com.chint.infrastructure.repository.jdbc.JdbcOrderDetailRepository;
|
|
||||||
import com.chint.infrastructure.repository.jdbc.JdbcRouteRepository;
|
import com.chint.infrastructure.repository.jdbc.JdbcRouteRepository;
|
||||||
import com.chint.infrastructure.repository.jdbc.JdbcUserRepository;
|
import com.chint.infrastructure.repository.jdbc.JdbcUserRepository;
|
||||||
import com.chint.infrastructure.util.BaseContext;
|
import com.chint.infrastructure.util.BaseContext;
|
||||||
import com.chint.infrastructure.util.PageResult;
|
import com.chint.infrastructure.util.PageResult;
|
||||||
|
import com.chint.manage.entity.OrderDetailBasic;
|
||||||
import com.chint.manage.entity.OrderDownloadRecord;
|
import com.chint.manage.entity.OrderDownloadRecord;
|
||||||
import com.chint.manage.entity.OrderExceedStandard;
|
import com.chint.manage.entity.OrderExceedStandard;
|
||||||
import com.chint.manage.entity.RouteOrderExtensionField;
|
import com.chint.manage.entity.RouteOrderExtensionFieldBasic;
|
||||||
import com.chint.manage.entity.dto.ItineraryPageDto;
|
import com.chint.manage.entity.dto.ItineraryPageDto;
|
||||||
import com.chint.manage.entity.excel.OrderPageExcel;
|
import com.chint.manage.entity.excel.OrderPageExcel;
|
||||||
import com.chint.manage.entity.excel.BaseExcel;
|
import com.chint.manage.entity.excel.BaseExcel;
|
||||||
|
@ -67,11 +67,11 @@ public class ManageServiceImpl implements ManageService {
|
||||||
@Autowired
|
@Autowired
|
||||||
private BaseUtil baseUtil;
|
private BaseUtil baseUtil;
|
||||||
@Autowired
|
@Autowired
|
||||||
private JdbcOrderDetailRepository jdbcOrderDetailRepository;
|
private JdbcOrderDetailBasicRepository jdbcOrderDetailBasicRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
private JdbcLocationRepository locationRepository;
|
private JdbcLocationRepository locationRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
private JdbcRouteOrderExtensionFieldRepository jdbcRouteOrderExtensionFieldRepository;
|
private JdbcRouteOrderExtensionFieldBasicRepository jdbcRouteOrderExtensionFieldBasicRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
private JdbcTrainOrderDetailRepository jdbcTrainOrderDetailRepository;
|
private JdbcTrainOrderDetailRepository jdbcTrainOrderDetailRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -105,13 +105,12 @@ public class ManageServiceImpl implements ManageService {
|
||||||
|
|
||||||
PageRequest pageRequest = PageRequest
|
PageRequest pageRequest = PageRequest
|
||||||
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("id").descending());
|
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("id").descending());
|
||||||
Page<OrderExceedStandard> page=jdbcOrderExceedStandardRepository.findAllByApplicantContainsAndCompanyNameContainsAndActualOrderNoContainsAndOrderNoContainsAndOrderNoIn(dto.getApplicant(),
|
Page<OrderExceedStandard> page=jdbcOrderExceedStandardRepository.findAllByApplicantContainsAndDeptNameContainsAndActualOrderNoContainsAndOrderNoContainsAndOrderNoIn(dto.getApplicant(),
|
||||||
dto.getCompanyName(),
|
dto.getCompanyName(),
|
||||||
dto.getActualOrderNo(),
|
dto.getActualOrderNo(),
|
||||||
dto.getOrderNo(),
|
dto.getOrderNo(),
|
||||||
orderNos,
|
orderNos,
|
||||||
pageRequest);
|
pageRequest);
|
||||||
|
|
||||||
List<OrderExceedStandardExcel> excelList = getOrderExceedStandardExcels(page);
|
List<OrderExceedStandardExcel> excelList = getOrderExceedStandardExcels(page);
|
||||||
return PageResult.totalPageNum(page.getTotalElements(), excelList);
|
return PageResult.totalPageNum(page.getTotalElements(), excelList);
|
||||||
}
|
}
|
||||||
|
@ -132,6 +131,7 @@ public class ManageServiceImpl implements ManageService {
|
||||||
if (routeIds==null||routeIds.isEmpty()) {
|
if (routeIds==null||routeIds.isEmpty()) {
|
||||||
return PageResult.totalPageNum(0, new ArrayList<>());
|
return PageResult.totalPageNum(0, new ArrayList<>());
|
||||||
}
|
}
|
||||||
|
dto.setRouteIds(routeIds);
|
||||||
|
|
||||||
List<User> users=new ArrayList<>();
|
List<User> users=new ArrayList<>();
|
||||||
if (!dto.getApplicant().isEmpty()){
|
if (!dto.getApplicant().isEmpty()){
|
||||||
|
@ -140,7 +140,6 @@ public class ManageServiceImpl implements ManageService {
|
||||||
return PageResult.totalPageNum(0, new ArrayList<>());
|
return PageResult.totalPageNum(0, new ArrayList<>());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dto.setRouteIds(routeIds);
|
|
||||||
dto.setUserIds(users.stream().map(User::getEmployeeNo).toList());
|
dto.setUserIds(users.stream().map(User::getEmployeeNo).toList());
|
||||||
Page<ItineraryPageDto> page= jdbcConsumptionDetailRepository.itineraryPageQueryByDto(dto);
|
Page<ItineraryPageDto> page= jdbcConsumptionDetailRepository.itineraryPageQueryByDto(dto);
|
||||||
//处理信息
|
//处理信息
|
||||||
|
@ -164,9 +163,7 @@ public class ManageServiceImpl implements ManageService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addOrderDownloadRecord(OrderDownloadRecord orderDownloadRecord) {
|
public void addOrderDownloadRecord(OrderDownloadRecord orderDownloadRecord) {
|
||||||
// User user= BaseContext.getCurrentUser();
|
User user= BaseContext.getCurrentUser();
|
||||||
User user=new User();
|
|
||||||
user.setEmployeeNo("123");
|
|
||||||
orderDownloadRecord.setEmployeeNo(user.getEmployeeNo());
|
orderDownloadRecord.setEmployeeNo(user.getEmployeeNo());
|
||||||
jdbcOrderDownloadRecordRepository.save(orderDownloadRecord);
|
jdbcOrderDownloadRecordRepository.save(orderDownloadRecord);
|
||||||
}
|
}
|
||||||
|
@ -212,12 +209,12 @@ public class ManageServiceImpl implements ManageService {
|
||||||
}
|
}
|
||||||
//部门
|
//部门
|
||||||
if (dto.getBelongDeptCode() != null && !dto.getBelongDeptCode().isEmpty()) {
|
if (dto.getBelongDeptCode() != null && !dto.getBelongDeptCode().isEmpty()) {
|
||||||
List<RouteOrderExtensionField> routeOrderExtensionFields = jdbcRouteOrderExtensionFieldRepository.findByBelongDeptCodeIn(dto.getBelongDeptCode());
|
List<RouteOrderExtensionFieldBasic> routeOrderExtensionFieldBasics = jdbcRouteOrderExtensionFieldBasicRepository.findAllByBelongDeptCodeIn(dto.getBelongDeptCode());
|
||||||
if (routeOrderExtensionFields == null || routeOrderExtensionFields.isEmpty()) {
|
if (routeOrderExtensionFieldBasics == null || routeOrderExtensionFieldBasics.isEmpty()) {
|
||||||
return PageResult.totalPageNum(0, new ArrayList<>());
|
return PageResult.totalPageNum(0, new ArrayList<>());
|
||||||
}
|
}
|
||||||
List<Long> routeOrderExtensionFieldIds = routeOrderExtensionFields.stream()
|
List<Long> routeOrderExtensionFieldIds = routeOrderExtensionFieldBasics.stream()
|
||||||
.map(RouteOrderExtensionField::getRouteId)
|
.map(RouteOrderExtensionFieldBasic::getRouteId)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
List<Long> updatedRouteIds = dto.getRouteIds() == null
|
List<Long> updatedRouteIds = dto.getRouteIds() == null
|
||||||
? routeOrderExtensionFieldIds
|
? routeOrderExtensionFieldIds
|
||||||
|
@ -235,18 +232,18 @@ public class ManageServiceImpl implements ManageService {
|
||||||
dto.setApplicant("%"+dto.getApplicant()+"%");
|
dto.setApplicant("%"+dto.getApplicant()+"%");
|
||||||
}
|
}
|
||||||
|
|
||||||
List<OrderDetail> list=jdbcOrderDetailRepository.listByCondition(dto,dto.getPageResult());
|
List<OrderDetailBasic> list=jdbcOrderDetailBasicRepository.listByCondition(dto,dto.getPageResult());
|
||||||
//处理地点信息
|
//处理地点信息
|
||||||
List<Long> locationIds = new ArrayList<>(list.stream().map(OrderDetail::getOriginId).toList());
|
List<Long> locationIds = new ArrayList<>(list.stream().map(OrderDetailBasic::getOriginId).toList());
|
||||||
locationIds.addAll(list.stream().map(OrderDetail::getDestinationId).toList());
|
locationIds.addAll(list.stream().map(OrderDetailBasic::getDestinationId).toList());
|
||||||
locationIds=locationIds.stream().distinct().filter(Objects::nonNull).collect(Collectors.toList());
|
locationIds=locationIds.stream().distinct().filter(Objects::nonNull).collect(Collectors.toList());
|
||||||
List<Location> locations=locationRepository.findByLocationIdIn(locationIds);
|
List<Location> locations=locationRepository.findByLocationIdIn(locationIds);
|
||||||
//根据类型处理出行订单信息
|
//根据类型处理出行订单信息
|
||||||
Map<Long, OrderPageExcel> orderPageDtoMap=new HashMap<>();
|
Map<Long, OrderPageExcel> orderPageDtoMap=new HashMap<>();
|
||||||
Map<Integer, List<OrderDetail>> collect = list.stream().collect(Collectors.groupingBy(OrderDetail::getProductType));
|
Map<Integer, List<OrderDetailBasic>> collect = list.stream().collect(Collectors.groupingBy(OrderDetailBasic::getProductType));
|
||||||
for (Map.Entry<Integer, List<OrderDetail>> entry : collect.entrySet()) {
|
for (Map.Entry<Integer, List<OrderDetailBasic>> entry : collect.entrySet()) {
|
||||||
int type = entry.getKey();
|
int type = entry.getKey();
|
||||||
List<OrderDetail> details = entry.getValue();
|
List<OrderDetailBasic> details = entry.getValue();
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case LEG_TYPE_TRAIN -> dealOrderTrainRecord(details,orderPageDtoMap);
|
case LEG_TYPE_TRAIN -> dealOrderTrainRecord(details,orderPageDtoMap);
|
||||||
case LEG_TYPE_AIRPLANE -> dealOrderFlightRecord(details,orderPageDtoMap);
|
case LEG_TYPE_AIRPLANE -> dealOrderFlightRecord(details,orderPageDtoMap);
|
||||||
|
@ -255,11 +252,11 @@ public class ManageServiceImpl implements ManageService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//处理行程单信息
|
//处理行程单信息
|
||||||
List<Long> routeIds=list.stream().map(OrderDetail::getRouteId).toList();
|
List<Long> routeIds=list.stream().map(OrderDetailBasic::getRouteId).toList();
|
||||||
routeIds=routeIds.stream().distinct().filter(Objects::nonNull).collect(Collectors.toList());
|
routeIds=routeIds.stream().distinct().filter(Objects::nonNull).collect(Collectors.toList());
|
||||||
List<RouteOrder> routeOrders=jdbcRouteRepository.findByRouteIdIn(routeIds);
|
List<RouteOrder> routeOrders=jdbcRouteRepository.findByRouteIdIn(routeIds);
|
||||||
|
|
||||||
List<User> users=jdbcUserRepository.findAllByEmployeeNoIn(list.stream().map(OrderDetail::getEmployeeNo).collect(Collectors.toList()));
|
List<User> users=jdbcUserRepository.findAllByEmployeeNoIn(list.stream().map(OrderDetailBasic::getEmployeeNo).collect(Collectors.toList()));
|
||||||
|
|
||||||
List<OrderPageExcel> result = list.stream().map(temp -> {
|
List<OrderPageExcel> result = list.stream().map(temp -> {
|
||||||
OrderPageExcel obj = orderPageDtoMap.get(temp.getOrderId());
|
OrderPageExcel obj = orderPageDtoMap.get(temp.getOrderId());
|
||||||
|
@ -287,7 +284,7 @@ public class ManageServiceImpl implements ManageService {
|
||||||
}
|
}
|
||||||
return finalObj;
|
return finalObj;
|
||||||
}).toList();
|
}).toList();
|
||||||
Integer count=jdbcOrderDetailRepository.countByCondition(dto);
|
Integer count=jdbcOrderDetailBasicRepository.countByCondition(dto);
|
||||||
return PageResult.totalPageNum(count, result);
|
return PageResult.totalPageNum(count, result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,9 +297,9 @@ public class ManageServiceImpl implements ManageService {
|
||||||
return ExcelUtil.exportReport(orderPageQuery(dto).getRecords());
|
return ExcelUtil.exportReport(orderPageQuery(dto).getRecords());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dealOrderTrainRecord(List<OrderDetail> entry,Map<Long, OrderPageExcel> orderPageDtoMap){
|
private void dealOrderTrainRecord(List<OrderDetailBasic> entry,Map<Long, OrderPageExcel> orderPageDtoMap){
|
||||||
if (entry!=null&&!entry.isEmpty()){
|
if (entry!=null&&!entry.isEmpty()){
|
||||||
List<TrainOrderDetail> trainOrderDetails=jdbcTrainOrderDetailRepository.findAllByOrderIdIn(entry.stream().map(OrderDetail::getOrderId).toList());
|
List<TrainOrderDetail> trainOrderDetails=jdbcTrainOrderDetailRepository.findAllByOrderIdIn(entry.stream().map(OrderDetailBasic::getOrderId).toList());
|
||||||
for (TrainOrderDetail trainOrderDetail : trainOrderDetails) {
|
for (TrainOrderDetail trainOrderDetail : trainOrderDetails) {
|
||||||
OrderPageExcel orderPageDto=new OrderPageExcel();
|
OrderPageExcel orderPageDto=new OrderPageExcel();
|
||||||
orderPageDto.setStatus(trainOrderDetail.getOrderStatus());
|
orderPageDto.setStatus(trainOrderDetail.getOrderStatus());
|
||||||
|
@ -312,9 +309,9 @@ public class ManageServiceImpl implements ManageService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dealOrderFlightRecord(List<OrderDetail> entry,Map<Long, OrderPageExcel> orderPageDtoMap){
|
private void dealOrderFlightRecord(List<OrderDetailBasic> entry,Map<Long, OrderPageExcel> orderPageDtoMap){
|
||||||
if (entry!=null&&!entry.isEmpty()){
|
if (entry!=null&&!entry.isEmpty()){
|
||||||
List<FlightOrderDetail> flightOrderDetails=jdbcFlightOrderDetailRepository.findAllByOrderIdIn(entry.stream().map(OrderDetail::getOrderId).toList());
|
List<FlightOrderDetail> flightOrderDetails=jdbcFlightOrderDetailRepository.findAllByOrderIdIn(entry.stream().map(OrderDetailBasic::getOrderId).toList());
|
||||||
for (FlightOrderDetail flightOrderDetail : flightOrderDetails) {
|
for (FlightOrderDetail flightOrderDetail : flightOrderDetails) {
|
||||||
OrderPageExcel orderPageDto=new OrderPageExcel();
|
OrderPageExcel orderPageDto=new OrderPageExcel();
|
||||||
orderPageDto.setStatus(flightOrderDetail.getOrderStatus());
|
orderPageDto.setStatus(flightOrderDetail.getOrderStatus());
|
||||||
|
@ -324,9 +321,9 @@ public class ManageServiceImpl implements ManageService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dealOrderHotelRecord(List<OrderDetail> entry,Map<Long, OrderPageExcel> orderPageDtoMap){
|
private void dealOrderHotelRecord(List<OrderDetailBasic> entry,Map<Long, OrderPageExcel> orderPageDtoMap){
|
||||||
if (entry!=null&&!entry.isEmpty()){
|
if (entry!=null&&!entry.isEmpty()){
|
||||||
List<HotelOrderDetail> hotelOrderDetails=jdbcHotelOrderDetailRepository.findAllByOrderIdIn(entry.stream().map(OrderDetail::getOrderId).toList());
|
List<HotelOrderDetail> hotelOrderDetails=jdbcHotelOrderDetailRepository.findAllByOrderIdIn(entry.stream().map(OrderDetailBasic::getOrderId).toList());
|
||||||
for (HotelOrderDetail hotelOrderDetail : hotelOrderDetails) {
|
for (HotelOrderDetail hotelOrderDetail : hotelOrderDetails) {
|
||||||
OrderPageExcel orderPageDto=new OrderPageExcel();
|
OrderPageExcel orderPageDto=new OrderPageExcel();
|
||||||
orderPageDto.setStatus(hotelOrderDetail.getOrderStatus());
|
orderPageDto.setStatus(hotelOrderDetail.getOrderStatus());
|
||||||
|
@ -339,9 +336,9 @@ public class ManageServiceImpl implements ManageService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dealOrderCarRecord(List<OrderDetail> entry,Map<Long, OrderPageExcel> orderPageDtoMap){
|
private void dealOrderCarRecord(List<OrderDetailBasic> entry,Map<Long, OrderPageExcel> orderPageDtoMap){
|
||||||
if (entry!=null&&!entry.isEmpty()){
|
if (entry!=null&&!entry.isEmpty()){
|
||||||
List<CarOrderDetail> carOrderDetails=jdbcCarOrderDetailRepository.findAllByOrderIdIn(entry.stream().map(OrderDetail::getOrderId).toList());
|
List<CarOrderDetail> carOrderDetails=jdbcCarOrderDetailRepository.findAllByOrderIdIn(entry.stream().map(OrderDetailBasic::getOrderId).toList());
|
||||||
for (CarOrderDetail carOrderDetail : carOrderDetails) {
|
for (CarOrderDetail carOrderDetail : carOrderDetails) {
|
||||||
OrderPageExcel orderPageDto=new OrderPageExcel();
|
OrderPageExcel orderPageDto=new OrderPageExcel();
|
||||||
orderPageDto.setStatus(carOrderDetail.getOrderStatus());
|
orderPageDto.setStatus(carOrderDetail.getOrderStatus());
|
||||||
|
|
|
@ -1,16 +1,15 @@
|
||||||
package com.chint.manage.util;
|
package com.chint.manage.util;
|
||||||
|
|
||||||
import com.chint.domain.aggregates.order.OrderDetail;
|
|
||||||
import com.chint.domain.aggregates.user.User;
|
import com.chint.domain.aggregates.user.User;
|
||||||
import com.chint.domain.value_object.system.SystemOrganizationVO;
|
|
||||||
import com.chint.infrastructure.repository.jdbc.JdbcOrderDetailRepository;
|
|
||||||
import com.chint.infrastructure.util.BaseContext;
|
import com.chint.infrastructure.util.BaseContext;
|
||||||
import com.chint.manage.entity.RouteOrderExtensionField;
|
import com.chint.manage.entity.RouteOrderExtensionFieldBasic;
|
||||||
import com.chint.manage.mapper.JdbcRouteOrderExtensionFieldRepository;
|
import com.chint.manage.mapper.JdbcOrderDetailBasicRepository;
|
||||||
|
import com.chint.manage.mapper.JdbcRouteOrderExtensionFieldBasicRepository;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 基础方法工具类
|
* 基础方法工具类
|
||||||
|
@ -20,29 +19,31 @@ import java.util.List;
|
||||||
@Component
|
@Component
|
||||||
public class BaseUtil {
|
public class BaseUtil {
|
||||||
@Autowired
|
@Autowired
|
||||||
private JdbcRouteOrderExtensionFieldRepository jdbcRouteOrderExtensionFieldRepository;
|
private JdbcRouteOrderExtensionFieldBasicRepository jdbcRouteOrderExtensionFieldBasicRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
private JdbcOrderDetailRepository jdbcOrderDetailRepository;
|
private JdbcOrderDetailBasicRepository jdbcOrderDetailBasicRepository;
|
||||||
|
|
||||||
public User getCurrentUser() {
|
public User getCurrentUser() {
|
||||||
return BaseContext.getCurrentUser();
|
return BaseContext.getCurrentUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Long> getRouteIds(){
|
public List<Long> getRouteIds(){
|
||||||
List<String> list = BaseContext.getCurrentUser().loadRoleOrg().getRoleOrgList()
|
List<String> list = BaseContext.getCurrentUser().loadRoleOrg().getRoleOrgCodeList().stream().filter(Objects::nonNull).toList();
|
||||||
.stream().filter(s->s.getOrgShortCode()!=null).map(SystemOrganizationVO::getOrgShortCode).toList();
|
if (list.isEmpty()) return null;
|
||||||
List<RouteOrderExtensionField> result=jdbcRouteOrderExtensionFieldRepository.findByBelongDeptCodeIn(list);
|
List<RouteOrderExtensionFieldBasic> result= jdbcRouteOrderExtensionFieldBasicRepository.findAllByBelongDeptCodeIn(list);
|
||||||
return result.stream().map(RouteOrderExtensionField::getRouteId).toList();
|
return result.stream().map(RouteOrderExtensionFieldBasic::getRouteId).toList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Long> getOrderIds(){
|
public List<Long> getOrderIds(){
|
||||||
List<Long> routeIds = getRouteIds();
|
List<Long> routeIds = getRouteIds();
|
||||||
return jdbcOrderDetailRepository.findAllByRouteIdIn(routeIds).stream().map(OrderDetail::getOrderId).toList();
|
if (routeIds.isEmpty()) return null;
|
||||||
|
return jdbcOrderDetailBasicRepository.findAllOrderId(routeIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getOrderNos(){
|
public List<String> getOrderNos(){
|
||||||
List<Long> routeIds = getRouteIds();
|
List<Long> routeIds = getRouteIds();
|
||||||
return jdbcOrderDetailRepository.findAllByRouteIdIn(routeIds).stream().map(OrderDetail::getOrderNo).toList();
|
if (routeIds.isEmpty()) return null;
|
||||||
|
return jdbcOrderDetailBasicRepository.findAllOrderNo(routeIds);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class DataJdbcCreatorUtil {
|
||||||
*/
|
*/
|
||||||
private List<String> getTables() throws SQLException {
|
private List<String> getTables() throws SQLException {
|
||||||
List<String> tables = new ArrayList<String>();
|
List<String> tables = new ArrayList<String>();
|
||||||
tables.add("route_order_extension_field");
|
tables.add("crux_system_log");
|
||||||
return tables;
|
return tables;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ public class DataJdbcCreatorUtil {
|
||||||
temp = tables[i].trim();
|
temp = tables[i].trim();
|
||||||
sb.append(temp.substring(0, 1).toUpperCase()).append(temp.substring(1));
|
sb.append(temp.substring(0, 1).toUpperCase()).append(temp.substring(1));
|
||||||
}
|
}
|
||||||
beanName = sb.toString();
|
beanName = sb.toString()+"Basic";
|
||||||
mapperName = "Jdbc"+beanName + "Repository";
|
mapperName = "Jdbc"+beanName + "Repository";
|
||||||
_mapperName = shotFirst(mapperName);
|
_mapperName = shotFirst(mapperName);
|
||||||
serviceName = beanName + "Service";
|
serviceName = beanName + "Service";
|
||||||
|
@ -179,11 +179,11 @@ public class DataJdbcCreatorUtil {
|
||||||
} else if (type.indexOf(type_int) > -1) {
|
} else if (type.indexOf(type_int) > -1) {
|
||||||
return "java.lang.Integer";
|
return "java.lang.Integer";
|
||||||
} else if (type.indexOf(type_date) > -1) {
|
} else if (type.indexOf(type_date) > -1) {
|
||||||
return "java.util.Date";
|
return "java.time.LocalDateTime";
|
||||||
} else if (type.indexOf(type_text) > -1) {
|
} else if (type.indexOf(type_text) > -1) {
|
||||||
return "java.lang.String";
|
return "java.lang.String";
|
||||||
} else if (type.indexOf(type_timestamp) > -1) {
|
} else if (type.indexOf(type_timestamp) > -1) {
|
||||||
return "java.util.Date";
|
return "java.time.LocalDateTime";
|
||||||
} else if (type.indexOf(type_bit) > -1) {
|
} else if (type.indexOf(type_bit) > -1) {
|
||||||
return "java.lang.Boolean";
|
return "java.lang.Boolean";
|
||||||
} else if (type.indexOf(type_decimal) > -1) {
|
} else if (type.indexOf(type_decimal) > -1) {
|
||||||
|
@ -203,11 +203,11 @@ public class DataJdbcCreatorUtil {
|
||||||
} else if (type.indexOf(type_longtext) > -1) {
|
} else if (type.indexOf(type_longtext) > -1) {
|
||||||
return "java.lang.String";
|
return "java.lang.String";
|
||||||
} else if (type.indexOf(type_datetime) > -1) {
|
} else if (type.indexOf(type_datetime) > -1) {
|
||||||
return "java.util.Date";
|
return "java.time.LocalDateTime";
|
||||||
} else if (type.indexOf(type_binary) > -1) {
|
} else if (type.indexOf(type_binary) > -1) {
|
||||||
return "java.lang.Long";
|
return "java.lang.Long";
|
||||||
} else if (type.indexOf(type_time) > -1) {
|
} else if (type.indexOf(type_time) > -1) {
|
||||||
return "java.util.Date";
|
return "java.time.LocalDateTime";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
package com.chint.manage.util;
|
||||||
|
|
||||||
|
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取IP工具类
|
||||||
|
* 如果是IP白名单限制应该直接使用request.getRemoteAddr()
|
||||||
|
* 这个无法伪造
|
||||||
|
* @Author:nxj
|
||||||
|
* @Date:2020/6/24 9:20
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class IpAddressUtil {
|
||||||
|
|
||||||
|
private static final String LOCAL = "0:0:0:0:0:0:0:1";
|
||||||
|
|
||||||
|
|
||||||
|
public String getIpAddress(HttpServletRequest request) {
|
||||||
|
String ip = null;
|
||||||
|
|
||||||
|
//X-Forwarded-For:Squid 服务代理
|
||||||
|
String ipAddresses = request.getHeader("X-Forwarded-For");
|
||||||
|
String unknown = "unknown";
|
||||||
|
if (ipAddresses == null || ipAddresses.length() == 0 || unknown.equalsIgnoreCase(ipAddresses)) {
|
||||||
|
//Proxy-Client-IP:apache 服务代理
|
||||||
|
ipAddresses = request.getHeader("Proxy-Client-IP");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ipAddresses == null || ipAddresses.length() == 0 || unknown.equalsIgnoreCase(ipAddresses)) {
|
||||||
|
//WL-Proxy-Client-IP:weblogic 服务代理
|
||||||
|
ipAddresses = request.getHeader("WL-Proxy-Client-IP");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ipAddresses == null || ipAddresses.length() == 0 || unknown.equalsIgnoreCase(ipAddresses)) {
|
||||||
|
//HTTP_CLIENT_IP:有些代理服务器
|
||||||
|
ipAddresses = request.getHeader("HTTP_CLIENT_IP");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ipAddresses == null || ipAddresses.length() == 0 || unknown.equalsIgnoreCase(ipAddresses)) {
|
||||||
|
//X-Real-IP:nginx服务代理
|
||||||
|
ipAddresses = request.getHeader("X-Real-IP");
|
||||||
|
}
|
||||||
|
|
||||||
|
//有些网络通过多层代理,那么获取到的ip就会有多个,一般都是通过逗号(,)分割开来,并且第一个ip为客户端的真实IP
|
||||||
|
if (ipAddresses != null && ipAddresses.length() != 0) {
|
||||||
|
ip = ipAddresses.split(",")[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
//还是不能获取到,最后再通过request.getRemoteAddr();获取
|
||||||
|
if (ip == null || ip.length() == 0 || unknown.equalsIgnoreCase(ipAddresses)) {
|
||||||
|
ip = request.getRemoteAddr();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(LOCAL.equals(ip)){
|
||||||
|
return "127.0.0.1";
|
||||||
|
}
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue