Commit 33bdb548 authored by danfuman's avatar danfuman

Merge branch 'dev20230707' of http://192.168.60.201/root/dsk-operate-sys into dev20230707

parents 40df17e3 bcdaa7ac
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.creditLevel(new CustomerSearchDto()));
}
}
......@@ -99,6 +99,14 @@ public class JskCombineInfoController extends BaseController {
return baseService.centralEnterprseChild();
}
/**
* 查央企子公司
*/
@PostMapping("/centralEnterprse/child/page")
public AjaxResult centralEnterprseChildPage(@RequestBody JSONObject object) {
return baseService.centralEnterprseChildPage(object);
}
/**
* 查地方国企
*/
......@@ -106,4 +114,20 @@ public class JskCombineInfoController extends BaseController {
public AjaxResult centralEnterprseLocal(@RequestBody JSONObject object) {
return baseService.centralEnterprseLocal(object);
}
/**
* 民营企业
*/
@PostMapping("/centralEnterprse/social")
public AjaxResult centralEnterprseSocial() {
return baseService.centralEnterprseSocial();
}
/**
* 民营企业
*/
@PostMapping("/centralEnterprse/social/page")
public AjaxResult centralEnterprseSocialPage(@RequestBody JSONObject object) {
return baseService.centralEnterprseSocialPage(object);
}
}
package com.dsk.system.domain.customer.dto;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author lcl
* @create 2023/5/16
*/
@Data
@NoArgsConstructor
public class CustomerSearchDto implements Serializable {
/**
* 企业id
......@@ -22,6 +27,10 @@ public class CustomerSearchDto implements Serializable {
* 企业名称
*/
private String companyName;
/**
* 企业性质
*/
private String companyNature;
/**
* 客户id
*/
......@@ -34,5 +43,41 @@ public class CustomerSearchDto implements Serializable {
* 客户状态 0:正常 1:历史
*/
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 {
/**
* 中标时间(开始)
*/
private Date startBidTime;
private String startBidTime;
/**
* 中标时间(结束)
*/
private Date endBidTime;
private String endBidTime;
/**
* 业绩类型
*/
......
......@@ -37,6 +37,17 @@ public class JskCombineInfoService {
public TableDataInfo memberList(JskCombineSearchDto dto) throws Exception {
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);
}
......@@ -106,8 +117,23 @@ public class JskCombineInfoService {
return BeanUtil.toBean(map, AjaxResult.class);
}
public AjaxResult centralEnterprseChildPage(JSONObject object) {
Map<String, Object> map = dskOpenApiUtil.requestBody("/nationzj/enterprice/centralEnterprse/child/page", object);
return BeanUtil.toBean(map, AjaxResult.class);
}
public AjaxResult centralEnterprseLocal(JSONObject object) {
Map<String, Object> map = dskOpenApiUtil.requestBody("/nationzj/enterprice/centralEnterprse/local", object);
return BeanUtil.toBean(map, AjaxResult.class);
}
public AjaxResult centralEnterprseSocial() {
Map<String, Object> map = dskOpenApiUtil.requestBody("/nationzj/enterprice/centralEnterprse/social", null);
return BeanUtil.toBean(map, AjaxResult.class);
}
public AjaxResult centralEnterprseSocialPage(JSONObject object) {
Map<String, Object> map = dskOpenApiUtil.requestBody("/nationzj/enterprice/centralEnterprse/social/page", object);
return BeanUtil.toBean(map, AjaxResult.class);
}
}
......@@ -3,12 +3,14 @@ package com.dsk.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
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.domain.customer.vo.CustomerListVo;
import com.dsk.system.domain.customer.vo.CustomerStatusListVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
/**
......@@ -20,7 +22,7 @@ import java.util.List;
@Mapper
public interface CustomerMapper extends BaseMapper<Customer> {
List<CustomerListVo> selectList(@Param("dto") CustomerSearchDto dto);
List<CustomerListVo> selectList(CustomerSearchDto dto);
List<Customer> selectUserList(Long userId);
......@@ -30,7 +32,11 @@ public interface CustomerMapper extends BaseMapper<Customer> {
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);
List<Map<String, Object>> selectCreditLevelGroup(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);
List<Map<String, Object>> creditLevel(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);
}
@Override
public List<Map<String, Object>> creditLevel(CustomerSearchDto dto) {
dto.setUserId(SecurityUtils.getUserId());
return customerMapper.selectCreditLevelGroup(dto);
}
}
......@@ -26,8 +26,39 @@
left join (
select count(status) num,customer_id from business_info where `status` = 2 group by customer_id
) bi3 on bi3.customer_id = ct.customer_id
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>
where ctu.user_id = #{userId} and ctu.status = #{status}
<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
</select>
......@@ -69,16 +100,37 @@
</foreach>
</select>
<!-- <select id="selectUipIdList" resultType="java.lang.String">-->
<!-- select-->
<!-- ct.uip_id-->
<!-- from customer ct-->
<!-- 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-->
<!-- <foreach collection="uipIds" item="uipId" open="(" separator="," close=")">-->
<!-- #{uipId}-->
<!-- </foreach>-->
<!-- </select>-->
<select id="selectCustomerCount" resultType="java.lang.Integer">
select
count(ct.customer_id)
from customer ct
join customer_user ctu on ct.customer_id = ctu.customer_id
where ctu.status = 0 and ctu.user_id = #{userId}
<if test="companyNature != null and companyNature != ''"> and ct.company_nature = #{companyNature} </if>
</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>
<select id="selectCreditLevelGroup" resultType="java.util.Map">
select
ct.credit_level creditLevel, count(ct.credit_level) customerCount
from customer ct
join customer_user ctu on ct.customer_id = ctu.customer_id
where ctu.user_id = #{userId}
group by ct.credit_level
order by ct.credit_level desc
</select>
</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