【update】修改接口返回格式为Result,行程单查询申请人筛选实现
This commit is contained in:
parent
28113043f4
commit
d63bfb6b21
|
@ -13,4 +13,6 @@ public interface JdbcUserRepository extends CrudRepository<User, Long> {
|
|||
List<User> findByStatus(Integer status);
|
||||
|
||||
List<User> findByStatusIsNull();
|
||||
|
||||
List<User> findAllByNameContains(String name);
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@ import java.io.File;
|
|||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
import static com.chint.dama.dc.basic.Result.SUCCESS;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/manage")
|
||||
|
@ -36,8 +38,8 @@ public class ManageController {
|
|||
|
||||
@ApiOperation("消费明细查询接口")
|
||||
@PostMapping("/query")
|
||||
public PageResult<? extends BaseExcel> query(@RequestBody ConsumptionDetailQuery dto){
|
||||
return manageService.pageConsumptionDetail(dto);
|
||||
public Result<PageResult<? extends BaseExcel>> query(@RequestBody ConsumptionDetailQuery dto){
|
||||
return Result.Success(SUCCESS,manageService.pageConsumptionDetail(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("消费明细导出接口")
|
||||
|
@ -60,8 +62,8 @@ public class ManageController {
|
|||
|
||||
@ApiOperation("超标报表查询接口")
|
||||
@PostMapping("/standard/query")
|
||||
public PageResult<OrderExceedStandardExcel> standardQuery(@RequestBody StandardQuery dto){
|
||||
return manageService.standardQuery(dto);
|
||||
public Result<PageResult<OrderExceedStandardExcel>> standardQuery(@RequestBody StandardQuery dto){
|
||||
return Result.Success(SUCCESS,manageService.standardQuery(dto));
|
||||
}
|
||||
|
||||
@ApiOperation("超标报表导出接口")
|
||||
|
@ -85,7 +87,7 @@ public class ManageController {
|
|||
@ApiOperation("行程单查询接口")
|
||||
@PostMapping("/order/pageQuery")
|
||||
public Result<PageResult<OrderPageDto>> orderPageQuery(@RequestBody OrderPageQuery dto){
|
||||
return manageService.orderPageQuery(dto);
|
||||
return Result.Success(SUCCESS,manageService.orderPageQuery(dto));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import java.util.List;
|
|||
|
||||
@Data
|
||||
public class OrderPageQuery extends BaseQuery {
|
||||
private String supplierName;// 申请人
|
||||
private String applicant;// 申请人
|
||||
private String actualOrderNo; //申请单号
|
||||
private List<String> userIds=new ArrayList<>();
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ public class JdbcConsumptionDetailRepositoryImpl implements JdbcConsumptionDetai
|
|||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("actualOrderNo", dto.getActualOrderNo());
|
||||
params.put("userIds", dto.getUserIds());
|
||||
PageRequest pageRequest = PageRequest
|
||||
.of(dto.getPageNum() - 1, dto.getPageSize(), Sort.by("route_id").descending());
|
||||
params.put("offset", pageRequest.getOffset());
|
||||
|
|
|
@ -27,5 +27,5 @@ public interface ManageService {
|
|||
|
||||
File standardExport(StandardQuery dto);
|
||||
|
||||
Result<PageResult<OrderPageDto>> orderPageQuery(OrderPageQuery dto);
|
||||
PageResult<OrderPageDto> orderPageQuery(OrderPageQuery dto);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import com.chint.domain.aggregates.user.User;
|
|||
import com.chint.domain.repository.UserRepository;
|
||||
import com.chint.domain.service.LegDomainService;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcRouteRepository;
|
||||
import com.chint.infrastructure.repository.jdbc.JdbcUserRepository;
|
||||
import com.chint.infrastructure.util.PageResult;
|
||||
import com.chint.infrastructure.util.Result;
|
||||
import com.chint.manage.entity.OrderExceedStandard;
|
||||
|
@ -52,6 +53,8 @@ public class ManageServiceImpl implements ManageService {
|
|||
private UserRepository userRepository;
|
||||
@Autowired
|
||||
private JdbcRouteRepository jdbcRouteRepository;
|
||||
@Autowired
|
||||
private JdbcUserRepository jdbcUserRepository;
|
||||
|
||||
@Override
|
||||
public PageResult<? extends BaseExcel> pageConsumptionDetail(ConsumptionDetailQuery dto) {
|
||||
|
@ -83,8 +86,12 @@ public class ManageServiceImpl implements ManageService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result<PageResult<OrderPageDto>> orderPageQuery(OrderPageQuery dto) {
|
||||
|
||||
public PageResult<OrderPageDto> orderPageQuery(OrderPageQuery dto) {
|
||||
List<User> users=jdbcUserRepository.findAllByNameContains(dto.getApplicant());
|
||||
if (users==null||users.isEmpty()){
|
||||
return null;
|
||||
}
|
||||
dto.setUserIds(users.stream().map(User::getEmployeeNo).toList());
|
||||
Page<OrderPageDto> page= jdbcConsumptionDetailRepository.orderPageQueryByDto(dto);
|
||||
//处理信息
|
||||
List<OrderPageDto> list=page.getContent();
|
||||
|
@ -103,7 +110,7 @@ public class ManageServiceImpl implements ManageService {
|
|||
return getRouteOrderPageRes(routeOrder, user);
|
||||
})
|
||||
.toList();
|
||||
return Result.Success(SUCCESS,PageResult.totalPageNum(page.getTotalElements(), orders));
|
||||
return PageResult.totalPageNum(page.getTotalElements(), orders);
|
||||
}
|
||||
|
||||
private static List<OrderExceedStandardExcel> getOrderExceedStandardExcels(Page<OrderExceedStandard> page) {
|
||||
|
|
Loading…
Reference in New Issue