| | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.by4cloud.platformx.business.entity.Product; |
| | | import com.by4cloud.platformx.business.vo.BusinessCustomerSelectVo; |
| | | import com.by4cloud.platformx.common.core.util.R; |
| | | import com.by4cloud.platformx.common.log.annotation.SysLog; |
| | | import com.by4cloud.platformx.business.entity.BusinessCustomer; |
| | | import com.by4cloud.platformx.business.service.BusinessCustomerService; |
| | | import com.by4cloud.platformx.common.security.annotation.Inner; |
| | | import com.by4cloud.platformx.common.security.util.SecurityUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import com.by4cloud.platformx.common.excel.annotation.ResponseExcel; |
| | | import io.swagger.v3.oas.annotations.security.SecurityRequirement; |
| | |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | |
| | | |
| | | private final BusinessCustomerService businessCustomerService; |
| | | |
| | | @Value("${dept.smj}") |
| | | private String smj; |
| | | |
| | | @Value("${dept.smjsc}") |
| | | private String smjsc; |
| | | |
| | | @Value("${dept.smjzt}") |
| | | private String smjzt; |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * @param page 分页对象 |
| | |
| | | @GetMapping("/page" ) |
| | | @PreAuthorize("@pms.hasPermission('business_businessCustomer_view')" ) |
| | | public R getBusinessCustomerPage(@ParameterObject Page page, @ParameterObject BusinessCustomer businessCustomer) { |
| | | |
| | | if (StrUtil.equals(SecurityUtils.getUser().getCompId() + "", smj) || StrUtil.equals(SecurityUtils.getUser().getCompId() + "", smjsc) || |
| | | StrUtil.equals(SecurityUtils.getUser().getCompId() + "", smjzt)) { |
| | | LambdaQueryWrapper<BusinessCustomer> wrapper = Wrappers.lambdaQuery(); |
| | | wrapper.eq(businessCustomer.getIndustryId()!=null,BusinessCustomer::getIndustryId,businessCustomer.getIndustryId()); |
| | | wrapper.eq(businessCustomer.getAreaId()!=null,BusinessCustomer::getAreaId,businessCustomer.getAreaId()); |
| | | wrapper.like(StrUtil.isNotEmpty(businessCustomer.getCompanyName()),BusinessCustomer::getCompanyName,businessCustomer.getCompanyName()); |
| | | List<String> smjList = new ArrayList<>(); |
| | | smjList.add(smj); |
| | | smjList.add(smjsc); |
| | | smjList.add(smjzt); |
| | | wrapper.in(BusinessCustomer::getCompId, smjList); |
| | | wrapper.orderByDesc(BusinessCustomer::getCreateTime); |
| | | return R.ok(businessCustomerService.page(page, wrapper)); |
| | | } |
| | | LambdaQueryWrapper<BusinessCustomer> wrapper = Wrappers.lambdaQuery(); |
| | | wrapper.eq(businessCustomer.getIndustryId()!=null,BusinessCustomer::getIndustryId,businessCustomer.getIndustryId()); |
| | | wrapper.eq(businessCustomer.getAreaId()!=null,BusinessCustomer::getAreaId,businessCustomer.getAreaId()); |
| | |
| | | @GetMapping("/list" ) |
| | | @PreAuthorize("@pms.hasPermission('business_businessCustomer_view')" ) |
| | | public R getBusinessCustomerList(@ParameterObject BusinessCustomer businessCustomer) { |
| | | |
| | | if (StrUtil.equals(SecurityUtils.getUser().getCompId() + "", smj) || StrUtil.equals(SecurityUtils.getUser().getCompId() + "", smjsc) || |
| | | StrUtil.equals(SecurityUtils.getUser().getCompId() + "", smjzt)) { |
| | | LambdaQueryWrapper<BusinessCustomer> wrapper = Wrappers.lambdaQuery(); |
| | | wrapper.like(StrUtil.isNotEmpty(businessCustomer.getCompanyName()),BusinessCustomer::getCompanyName,businessCustomer.getCompanyName()); |
| | | List<String> smjList = new ArrayList<>(); |
| | | smjList.add(smj); |
| | | smjList.add(smjsc); |
| | | smjList.add(smjzt); |
| | | wrapper.in(BusinessCustomer::getCompId, smjList); |
| | | List<BusinessCustomer> businessCustomerList = businessCustomerService.list(wrapper); |
| | | if (CollUtil.isNotEmpty(businessCustomerList)){ |
| | | List<BusinessCustomerSelectVo> voList = BeanUtil.copyToList(businessCustomerList, BusinessCustomerSelectVo.class); |
| | | if (voList.size()>1000){ |
| | | return R.ok(voList.subList(0,1000)); |
| | | } |
| | | return R.ok(voList); |
| | | } |
| | | } |
| | | LambdaQueryWrapper<BusinessCustomer> wrapper = Wrappers.lambdaQuery(); |
| | | wrapper.like(StrUtil.isNotEmpty(businessCustomer.getCompanyName()),BusinessCustomer::getCompanyName,businessCustomer.getCompanyName()); |
| | | List<BusinessCustomer> businessCustomerList = businessCustomerService.listByScope(wrapper); |
| | | if (ArrayUtil.isNotEmpty(businessCustomerList.toArray())){ |
| | | if (CollUtil.isNotEmpty(businessCustomerList)){ |
| | | List<BusinessCustomerSelectVo> voList = BeanUtil.copyToList(businessCustomerList, BusinessCustomerSelectVo.class); |
| | | if (voList.size()>1000){ |
| | | return R.ok(voList.subList(0,1000)); |