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