Commit 84ed93b5 authored by chenyuefang's avatar chenyuefang

update

parent f3188fd4
...@@ -3,7 +3,9 @@ package com.dsk.cscec.controller; ...@@ -3,7 +3,9 @@ package com.dsk.cscec.controller;
import com.dsk.common.core.controller.BaseController; import com.dsk.common.core.controller.BaseController;
import com.dsk.common.core.domain.PageQuery; import com.dsk.common.core.domain.PageQuery;
import com.dsk.common.core.domain.R;
import com.dsk.common.core.page.TableDataInfo; import com.dsk.common.core.page.TableDataInfo;
import com.dsk.cscec.domain.DCustomer;
import com.dsk.cscec.domain.bo.CustomerInfoBo; import com.dsk.cscec.domain.bo.CustomerInfoBo;
import com.dsk.cscec.domain.vo.CustomerInfoVo; import com.dsk.cscec.domain.vo.CustomerInfoVo;
import com.dsk.cscec.service.ICustomerInfoService; import com.dsk.cscec.service.ICustomerInfoService;
...@@ -11,6 +13,8 @@ import lombok.RequiredArgsConstructor; ...@@ -11,6 +13,8 @@ import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.validation.constraints.NotEmpty;
/** /**
* 供应商相关 * 供应商相关
* *
...@@ -35,6 +39,13 @@ public class CustomerInfoController extends BaseController { ...@@ -35,6 +39,13 @@ public class CustomerInfoController extends BaseController {
return iCustomerInfoService.queryPageList(bo, query); return iCustomerInfoService.queryPageList(bo, query);
} }
/**
* 合作记录-供应商准入情况
*/
@GetMapping("/getByName/{name}")
public R<DCustomer> list(@NotEmpty(message = "企业名称不能为空") @PathVariable String name) {
return R.ok(iCustomerInfoService.queryByName(name));
}
} }
...@@ -141,6 +141,10 @@ public class CustomerInfoVo { ...@@ -141,6 +141,10 @@ public class CustomerInfoVo {
* 合作项目数量 * 合作项目数量
*/ */
private Integer projectCooperationCount; private Integer projectCooperationCount;
/**
* jsk企业id
*/
private Integer companyId;
/** /**
* 资源平台分类 * 资源平台分类
*/ */
......
...@@ -17,4 +17,5 @@ public interface ICustomerInfoService extends IService<DCustomer> { ...@@ -17,4 +17,5 @@ public interface ICustomerInfoService extends IService<DCustomer> {
TableDataInfo<CustomerInfoVo> queryPageList(CustomerInfoBo bo, PageQuery query); TableDataInfo<CustomerInfoVo> queryPageList(CustomerInfoBo bo, PageQuery query);
DCustomer queryByName(String name);
} }
package com.dsk.cscec.service.impl; package com.dsk.cscec.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.map.MapUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dsk.common.core.domain.PageQuery; import com.dsk.common.core.domain.PageQuery;
...@@ -11,8 +15,12 @@ import com.dsk.cscec.domain.vo.CustomerInfoVo; ...@@ -11,8 +15,12 @@ import com.dsk.cscec.domain.vo.CustomerInfoVo;
import com.dsk.cscec.mapper.DCustomerMapper; import com.dsk.cscec.mapper.DCustomerMapper;
import com.dsk.cscec.mapper.DSubcontractMapper; import com.dsk.cscec.mapper.DSubcontractMapper;
import com.dsk.cscec.service.ICustomerInfoService; import com.dsk.cscec.service.ICustomerInfoService;
import com.dsk.search.service.BusinessOpportunityRadarService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.Map;
/** /**
* 组织维表(DCustomer)表服务实现类 * 组织维表(DCustomer)表服务实现类
...@@ -26,6 +34,9 @@ public class CustomerInfoServiceImpl extends ServiceImpl<DCustomerMapper, DCusto ...@@ -26,6 +34,9 @@ public class CustomerInfoServiceImpl extends ServiceImpl<DCustomerMapper, DCusto
@Autowired @Autowired
private DSubcontractMapper subcontractMapper; private DSubcontractMapper subcontractMapper;
@Autowired
private BusinessOpportunityRadarService opportunityRadarService;
@Override @Override
public TableDataInfo<CustomerInfoVo> queryPageList(CustomerInfoBo bo, PageQuery query) { public TableDataInfo<CustomerInfoVo> queryPageList(CustomerInfoBo bo, PageQuery query) {
if("劳务分包".equals(bo.getCustomerClass())){ if("劳务分包".equals(bo.getCustomerClass())){
...@@ -37,13 +48,32 @@ public class CustomerInfoServiceImpl extends ServiceImpl<DCustomerMapper, DCusto ...@@ -37,13 +48,32 @@ public class CustomerInfoServiceImpl extends ServiceImpl<DCustomerMapper, DCusto
} }
Page<CustomerInfoVo> page = baseMapper.queryListByType(query.build(), bo); Page<CustomerInfoVo> page = baseMapper.queryListByType(query.build(), bo);
if (CollectionUtils.isNotEmpty(page.getRecords())) { if (CollectionUtils.isNotEmpty(page.getRecords())) {
for (CustomerInfoVo customerInfoVo : page.getRecords()) { page.getRecords().parallelStream().forEach(item->{
//公司合作数量 //企业合作数量
customerInfoVo.setEnterpriseCooperationCount(subcontractMapper.selectEnterpriseCountByCustomerId(customerInfoVo.getCustomerId())); item.setEnterpriseCooperationCount(subcontractMapper.selectEnterpriseCountByCustomerId(item.getCustomerId()));
//项目合作数量 //项目合作数量
customerInfoVo.setProjectCooperationCount(subcontractMapper.selectProjectCountByCustomerId(customerInfoVo.getCustomerId())); item.setProjectCooperationCount(subcontractMapper.selectProjectCountByCustomerId(item.getCustomerId()));
} try {
Map<String, Object> map = opportunityRadarService.enterpriseByName(item.getCustomerName());
if (!ObjectUtils.isEmpty(map.get("data"))) {
Map<String, Object> data = BeanUtil.beanToMap(map.get("data"));
Integer companyId = MapUtil.getInt(data, "jskEid");
item.setCompanyId(companyId);
}
}catch (Exception e){
//
}
});
} }
return TableDataInfo.build(page); return TableDataInfo.build(page);
} }
@Override
public DCustomer queryByName(String name) {
LambdaQueryWrapper<DCustomer> lqw = Wrappers.lambdaQuery();
lqw.eq(DCustomer::getCustomerName,name);
lqw.orderByDesc(DCustomer::getApproveDate2);
lqw.last("limit 1");
return baseMapper.selectOne(lqw);
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment