| | |
| | | */ |
| | | package me.zhengjie.modules.system.service.impl; |
| | | |
| | | import me.zhengjie.modules.business.service.BusinessPlanService; |
| | | import me.zhengjie.modules.business.service.dto.BusinessPlanDto; |
| | | import me.zhengjie.modules.constant.Constant; |
| | | import me.zhengjie.modules.quartz.service.OpaiDingTalkService; |
| | | import me.zhengjie.modules.system.domain.CustomerResources; |
| | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import java.util.function.Function; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | /** |
| | |
| | | private final UserRepository userRepository; |
| | | private final OpaiDingTalkService opaiDingTalkService; |
| | | private final CustomerResourcesUserRepository customerResourcesUserRepository; |
| | | private final BusinessPlanService businessPlanService; |
| | | |
| | | @Override |
| | | public Map<String,Object> queryAll(CustomerResourcesQueryCriteria criteria, Pageable pageable){ |
| | | Page<CustomerResources> page = customerResourcesRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); |
| | | return PageUtil.toPage(page.map(customerResourcesMapper::toDto)); |
| | | // 将实体类转换为DTO(重写) |
| | | Function<CustomerResources, CustomerResourcesDto> func = new Function<CustomerResources, CustomerResourcesDto>(){ |
| | | @Override |
| | | public CustomerResourcesDto apply(CustomerResources t) { |
| | | // 将实体类转换成DTO |
| | | CustomerResourcesDto customerResourcesDto = customerResourcesMapper.toDto(t); |
| | | |
| | | // 获取营业计划 |
| | | BusinessPlanDto businessPlanDto = businessPlanService.findById(customerResourcesDto.getBusinessPlanId()); |
| | | customerResourcesDto.setBusinessPlanContent(businessPlanDto.getBusinessContent()); |
| | | |
| | | // 返回处理好的DTO |
| | | return customerResourcesDto; |
| | | } |
| | | }; |
| | | return PageUtil.toPage(page.map(func)); |
| | | } |
| | | |
| | | @Override |