【add】报表、行程部分数据权限逻辑新增
This commit is contained in:
parent
79839f5457
commit
4d77602010
|
@ -1,6 +1,7 @@
|
||||||
package com.chint.manage.entity.query;
|
package com.chint.manage.entity.query;
|
||||||
|
|
||||||
import com.chint.domain.value_object.BaseQuery;
|
import com.chint.domain.value_object.BaseQuery;
|
||||||
|
import com.chint.infrastructure.util.PageResult;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -11,4 +12,5 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,8 @@ 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;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
||||||
public interface JdbcOrderExceedStandardRepository extends CrudRepository<OrderExceedStandard, Long> {
|
public interface JdbcOrderExceedStandardRepository extends CrudRepository<OrderExceedStandard, Long> {
|
||||||
|
|
||||||
|
@ -16,5 +18,5 @@ 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> findAllByApplicantContainsAndCompanyNameContainsAndActualOrderNoContainsAndOrderNoContains(String applicant, String company, String actualOrderNo, String orderNo, Pageable pageable);
|
Page<OrderExceedStandard> findAllByApplicantContainsAndCompanyNameContainsAndActualOrderNoContainsAndOrderNoContainsAndOrderNoIn(String applicant, String company, String actualOrderNo, String orderNo, List<String> orderNos, Pageable pageable);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ 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 1 = 1 " +
|
"WHERE route_id IN (:routeIds) " +
|
||||||
"AND (:actualOrderNo IS NULL OR actual_order_no = :actualOrderNo ) ";
|
"AND (:actualOrderNo IS NULL OR actual_order_no = :actualOrderNo ) ";
|
||||||
|
|
||||||
if (!dto.getUserIds().isEmpty()) {
|
if (!dto.getUserIds().isEmpty()) {
|
||||||
|
@ -69,6 +69,7 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai
|
||||||
}
|
}
|
||||||
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());
|
||||||
PageRequest pageRequest = PageRequest
|
PageRequest pageRequest = PageRequest
|
||||||
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("route_id").descending());
|
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("route_id").descending());
|
||||||
params.put("offset", pageRequest.getOffset());
|
params.put("offset", pageRequest.getOffset());
|
||||||
|
@ -89,6 +90,7 @@ 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
|
PageRequest pageRequest = PageRequest
|
||||||
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("id").descending());
|
.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());
|
||||||
|
|
|
@ -22,6 +22,7 @@ import com.chint.manage.mapper.JdbcOrderDownloadRecordRepository;
|
||||||
import com.chint.manage.mapper.JdbcOrderExceedStandardRepository;
|
import com.chint.manage.mapper.JdbcOrderExceedStandardRepository;
|
||||||
import com.chint.manage.mapper.impl.JdbcConsumptionDetailRepositoryImpl;
|
import com.chint.manage.mapper.impl.JdbcConsumptionDetailRepositoryImpl;
|
||||||
import com.chint.manage.service.ManageService;
|
import com.chint.manage.service.ManageService;
|
||||||
|
import com.chint.manage.util.BaseUtil;
|
||||||
import com.chint.manage.util.ExcelUtil;
|
import com.chint.manage.util.ExcelUtil;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -57,6 +58,8 @@ public class ManageServiceImpl implements ManageService {
|
||||||
private JdbcUserRepository jdbcUserRepository;
|
private JdbcUserRepository jdbcUserRepository;
|
||||||
@Autowired
|
@Autowired
|
||||||
private JdbcOrderDownloadRecordRepository jdbcOrderDownloadRecordRepository;
|
private JdbcOrderDownloadRecordRepository jdbcOrderDownloadRecordRepository;
|
||||||
|
@Autowired
|
||||||
|
private BaseUtil baseUtil;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<? extends BaseExcel> pageConsumptionDetail(ConsumptionDetailQuery dto) {
|
public PageResult<? extends BaseExcel> pageConsumptionDetail(ConsumptionDetailQuery dto) {
|
||||||
|
@ -70,12 +73,19 @@ public class ManageServiceImpl implements ManageService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<OrderExceedStandardExcel> standardQuery(StandardQuery dto) {
|
public PageResult<OrderExceedStandardExcel> standardQuery(StandardQuery dto) {
|
||||||
|
//数据权限
|
||||||
|
List<String> orderNos=baseUtil.getOrderNos();
|
||||||
|
if (orderNos==null||orderNos.isEmpty()) {
|
||||||
|
return PageResult.totalPageNum(0, new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
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.findAllByApplicantContainsAndCompanyNameContainsAndActualOrderNoContainsAndOrderNoContains(dto.getApplicant(),
|
Page<OrderExceedStandard> page=jdbcOrderExceedStandardRepository.findAllByApplicantContainsAndCompanyNameContainsAndActualOrderNoContainsAndOrderNoContainsAndOrderNoIn(dto.getApplicant(),
|
||||||
dto.getCompanyName(),
|
dto.getCompanyName(),
|
||||||
dto.getActualOrderNo(),
|
dto.getActualOrderNo(),
|
||||||
dto.getOrderNo(),
|
dto.getOrderNo(),
|
||||||
|
orderNos,
|
||||||
pageRequest);
|
pageRequest);
|
||||||
|
|
||||||
List<OrderExceedStandardExcel> excelList = getOrderExceedStandardExcels(page);
|
List<OrderExceedStandardExcel> excelList = getOrderExceedStandardExcels(page);
|
||||||
|
@ -89,13 +99,20 @@ public class ManageServiceImpl implements ManageService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageResult<ItineraryPageDto> itineraryPageQuery(ItineraryPageQuery dto) {
|
public PageResult<ItineraryPageDto> itineraryPageQuery(ItineraryPageQuery dto) {
|
||||||
|
//数据权限
|
||||||
|
List<Long> routeIds=baseUtil.getRouteIds();
|
||||||
|
if (routeIds==null||routeIds.isEmpty()) {
|
||||||
|
return PageResult.totalPageNum(0, new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
List<User> users=new ArrayList<>();
|
List<User> users=new ArrayList<>();
|
||||||
if (!dto.getApplicant().isEmpty()){
|
if (!dto.getApplicant().isEmpty()){
|
||||||
users=jdbcUserRepository.findAllByNameContains(dto.getApplicant());
|
users=jdbcUserRepository.findAllByNameContains(dto.getApplicant());
|
||||||
if (users==null||users.isEmpty()){
|
if (users==null||users.isEmpty()){
|
||||||
return null;
|
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);
|
||||||
//处理信息
|
//处理信息
|
||||||
|
|
Loading…
Reference in New Issue