Commit 035c20d7 authored by lcl's avatar lcl

u

parent 20650a06
package com.dsk.web.controller.customer;
import com.dsk.common.core.controller.BaseController;
import com.dsk.common.core.domain.AjaxResult;
import com.dsk.common.utils.SecurityUtils;
import com.dsk.system.domain.customer.dto.CustomerSearchDto;
import com.dsk.system.service.ICustomerOverviewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 客户概览
* @author lcl
* @create 2023/8/15
*/
@RestController
@RequestMapping("/customer/overview")
public class CustomerOverviewController extends BaseController {
@Autowired
private ICustomerOverviewService baseService;
/**
* 客户统计
*/
@GetMapping("/statistics")
public AjaxResult statistics(){
return AjaxResult.success(baseService.statistics(new CustomerSearchDto()));
}
/**
* 客户合作情况
*/
@GetMapping("/cooperation/top")
public AjaxResult cooperationTop(){
return AjaxResult.success(baseService.cooperationTop(new CustomerSearchDto()));
}
/**
* 客户信资评级
*/
@GetMapping("/credit/level")
public AjaxResult creditLevel(){
return AjaxResult.success(baseService.cooperationTop(new CustomerSearchDto()));
}
}
package com.dsk.system.domain.customer.dto; package com.dsk.system.domain.customer.dto;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable; import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/** /**
* @author lcl * @author lcl
* @create 2023/5/16 * @create 2023/5/16
*/ */
@Data @Data
@NoArgsConstructor
public class CustomerSearchDto implements Serializable { public class CustomerSearchDto implements Serializable {
/** /**
* 企业id * 企业id
...@@ -22,6 +27,10 @@ public class CustomerSearchDto implements Serializable { ...@@ -22,6 +27,10 @@ public class CustomerSearchDto implements Serializable {
* 企业名称 * 企业名称
*/ */
private String companyName; private String companyName;
/**
* 企业性质
*/
private String companyNature;
/** /**
* 客户id * 客户id
*/ */
...@@ -34,5 +43,41 @@ public class CustomerSearchDto implements Serializable { ...@@ -34,5 +43,41 @@ public class CustomerSearchDto implements Serializable {
* 客户状态 0:正常 1:历史 * 客户状态 0:正常 1:历史
*/ */
private Integer status; private Integer status;
/**
* 是否上市 0:否 1:是
*/
private Integer isOn;
/**
* 省id
*/
private List<Integer> provinceIds;
/**
* 市id
*/
private List<Integer> cityIds;
/**
* 区id
*/
private List<Integer> districtIds;
/**
* 企业性质
*/
private List<String> companyNatures;
/**
* 信资等级
*/
private List<String> creditLevels;
/**
* 数据权限
*/
private Map<String, Object> params;
public Map<String, Object> getParams() {
if (params == null) {
params = new HashMap<>();
}
return params;
}
} }
package com.dsk.system.domain.customer.vo;
import lombok.Data;
import java.io.Serializable;
/**
* 客户分析
*
* @author lcl
* @create 2023/8/15
*/
@Data
public class CustomerAnalyzeVo implements Serializable {
/**
* 客户id
*/
private String customerId;
/**
* 企业名称
*/
private String companyName;
/**
* 企业id
*/
private Integer companyId;
/**
* 城投id
*/
private String uipId;
/**
* 项目数量
*/
private Integer businessCount;
/**
* 总投资金额
*/
private Double totalAmount;
}
...@@ -71,11 +71,11 @@ public class JskCombineSearchDto implements Serializable { ...@@ -71,11 +71,11 @@ public class JskCombineSearchDto implements Serializable {
/** /**
* 中标时间(开始) * 中标时间(开始)
*/ */
private Date startBidTime; private String startBidTime;
/** /**
* 中标时间(结束) * 中标时间(结束)
*/ */
private Date endBidTime; private String endBidTime;
/** /**
* 业绩类型 * 业绩类型
*/ */
......
...@@ -37,6 +37,17 @@ public class JskCombineInfoService { ...@@ -37,6 +37,17 @@ public class JskCombineInfoService {
public TableDataInfo memberList(JskCombineSearchDto dto) throws Exception { public TableDataInfo memberList(JskCombineSearchDto dto) throws Exception {
Map<String, Object> map = dskOpenApiUtil.requestBody("/operate/combine/memberList", BeanUtil.beanToMap(dto, false, false)); Map<String, Object> map = dskOpenApiUtil.requestBody("/operate/combine/memberList", BeanUtil.beanToMap(dto, false, false));
if (!ObjectUtils.isEmpty(map.get("data"))) {
Map<String, Object> data = BeanUtil.beanToMap(map.get("data"));
if (!ObjectUtils.isEmpty(data.get("list"))) {
List<Map<String, Object>> list = (List<Map<String, Object>>) data.get("list");
list.parallelStream().forEach(res -> {
Integer companyId = MapUtils.getInteger(res, "companyId");
String companyName = MapUtils.getString(res, "companyName");
res.put("uipId", enterpriseService.getUipIdByCompanyNameOrCompanyId(companyName, companyId));
});
}
}
return dskOpenApiUtil.responsePage(map); return dskOpenApiUtil.responsePage(map);
} }
......
...@@ -3,6 +3,7 @@ package com.dsk.system.mapper; ...@@ -3,6 +3,7 @@ package com.dsk.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dsk.system.domain.customer.Customer; import com.dsk.system.domain.customer.Customer;
import com.dsk.system.domain.customer.dto.CustomerSearchDto; import com.dsk.system.domain.customer.dto.CustomerSearchDto;
import com.dsk.system.domain.customer.vo.CustomerAnalyzeVo;
import com.dsk.system.domain.customer.vo.CustomerListVo; import com.dsk.system.domain.customer.vo.CustomerListVo;
import com.dsk.system.domain.customer.vo.CustomerStatusListVo; import com.dsk.system.domain.customer.vo.CustomerStatusListVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
...@@ -20,7 +21,7 @@ import java.util.List; ...@@ -20,7 +21,7 @@ import java.util.List;
@Mapper @Mapper
public interface CustomerMapper extends BaseMapper<Customer> { public interface CustomerMapper extends BaseMapper<Customer> {
List<CustomerListVo> selectList(@Param("dto") CustomerSearchDto dto); List<CustomerListVo> selectList(CustomerSearchDto dto);
List<Customer> selectUserList(Long userId); List<Customer> selectUserList(Long userId);
...@@ -30,7 +31,9 @@ public interface CustomerMapper extends BaseMapper<Customer> { ...@@ -30,7 +31,9 @@ public interface CustomerMapper extends BaseMapper<Customer> {
List<CustomerStatusListVo> selectStatusListByCompanyName(@Param("companyNames") List<String> companyNames, @Param("userId") Long userId); List<CustomerStatusListVo> selectStatusListByCompanyName(@Param("companyNames") List<String> companyNames, @Param("userId") Long userId);
// List<String> selectUipIdList(@Param("uipIds") List<String> uipIds, @Param("userId") Long userId); int selectCustomerCount(CustomerSearchDto dto);
List<CustomerAnalyzeVo> selectCooperationTop(CustomerSearchDto dto);
} }
package com.dsk.system.service;
import com.dsk.system.domain.customer.dto.CustomerSearchDto;
import com.dsk.system.domain.customer.vo.CustomerAnalyzeVo;
import java.util.List;
import java.util.Map;
/**
* @author lcl
* @create 2023/8/15
*/
public interface ICustomerOverviewService {
Map<String,Object> statistics(CustomerSearchDto dto);
List<CustomerAnalyzeVo> cooperationTop(CustomerSearchDto dto);
}
package com.dsk.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.dsk.common.utils.SecurityUtils;
import com.dsk.system.domain.customer.Customer;
import com.dsk.system.domain.customer.dto.CustomerSearchDto;
import com.dsk.system.domain.customer.vo.CustomerAnalyzeVo;
import com.dsk.system.mapper.CustomerMapper;
import com.dsk.system.service.ICustomerOverviewService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* 客户概览相关
* @author lcl
* @create 2023/8/15
*/
@Service
public class CustomerOverviewServiceImpl implements ICustomerOverviewService {
@Resource
private CustomerMapper customerMapper;
@Override
public Map<String, Object> statistics(CustomerSearchDto dto) {
Map<String, Object> resultMap = new HashMap<>();
dto.setUserId(SecurityUtils.getUserId());
//总
resultMap.put("totalCount",customerMapper.selectCustomerCount(dto));
//国企
dto.setCompanyNature("国有企业");
resultMap.put("nationCount",customerMapper.selectCustomerCount(dto));
//央企
dto.setCompanyNature("央企");
resultMap.put("centreCount",customerMapper.selectCustomerCount(dto));
//事业
dto.setCompanyNature("事业单位");
resultMap.put("undertakingCount",customerMapper.selectCustomerCount(dto));
return resultMap;
}
@Override
public List<CustomerAnalyzeVo> cooperationTop(CustomerSearchDto dto) {
dto.setUserId(SecurityUtils.getUserId());
return customerMapper.selectCooperationTop(dto);
}
}
...@@ -27,7 +27,38 @@ ...@@ -27,7 +27,38 @@
select count(status) num,customer_id from business_info where `status` = 2 group by customer_id select count(status) num,customer_id from business_info where `status` = 2 group by customer_id
) bi3 on bi3.customer_id = ct.customer_id ) bi3 on bi3.customer_id = ct.customer_id
where ctu.user_id = #{dto.userId} and ctu.status = #{dto.status} where ctu.user_id = #{dto.userId} and ctu.status = #{dto.status}
<if test="dto.companyName != null and dto.companyName != '' "> and ct.company_name like concat('%',#{dto.companyName},'%')</if> <if test="companyName != null and companyName != '' "> and ct.company_name like concat('%',#{companyName},'%')</if>
<if test="isOn != null "> and ct.is_on = #{isOn}</if>
<if test="provinceIds != null and provinceIds.size > 0 ">
and ct.province_id in
<foreach collection="provinceIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="cityIds != null and cityIds.size > 0 ">
and ct.city_id in
<foreach collection="cityIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="districtIds != null and districtIds.size > 0 ">
and ct.district_id in
<foreach collection="districtIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="companyNatures != null and companyNatures.size > 0 ">
and ct.company_nature in
<foreach collection="companyNatures" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="creditLevels != null and creditLevels.size > 0 ">
and ct.credit_level in
<foreach collection="creditLevels" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
order by ct.create_time desc order by ct.create_time desc
</select> </select>
...@@ -69,16 +100,27 @@ ...@@ -69,16 +100,27 @@
</foreach> </foreach>
</select> </select>
<!-- <select id="selectUipIdList" resultType="java.lang.String">--> <select id="selectCustomerCount" resultType="java.lang.Integer">
<!-- select--> select
<!-- ct.uip_id--> count(ct.customer_id)
<!-- from customer ct--> from customer ct
<!-- join customer_user ctu on ct.customer_id = ctu.customer_id--> join customer_user ctu on ct.customer_id = ctu.customer_id
<!-- where ctu.user_id = #{userId} and ctu.status = 0 and ct.uip_id in--> where ctu.status = 0 and ctu.user_id = #{userId}
<!-- <foreach collection="uipIds" item="uipId" open="(" separator="," close=")">--> <if test="companyNature != null and companyNature != ''"> and ct.company_nature = #{companyNature} </if>
<!-- #{uipId}--> </select>
<!-- </foreach>-->
<!-- </select>--> <select id="selectCooperationTop" resultType="com.dsk.system.domain.customer.vo.CustomerAnalyzeVo">
select
ct.customer_id, ct.company_name, ct.company_id, ct.uip_id, count(bi.id) businessCount,
sum(bi.investment_amount) totalAmount
from customer ct
join customer_user ctu on ct.customer_id = ctu.customer_id
left join business_info bi on (bi.customer_id = ct.customer_id and bi.status = 2)
where ctu.status = 0 and ctu.user_id = #{userId}
group by ct.customer_id
order by totalAmount desc
limit 10
</select>
</mapper> </mapper>
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