Commit e99aad88 authored by huangjie's avatar huangjie

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

parents 3d970215 06078688
...@@ -27,11 +27,26 @@ public class BusinessOverviewController extends BaseController { ...@@ -27,11 +27,26 @@ public class BusinessOverviewController extends BaseController {
private IBusinessOverviewService baseService; private IBusinessOverviewService baseService;
/** /**
* 项目统计 * 项目状态统计
*/ */
@GetMapping("/statistics") @GetMapping("/status/statistics")
public AjaxResult statistics(){ public AjaxResult statusStatistics(){
return AjaxResult.success(baseService.statistics(new BusinessSearchDto(SecurityUtils.getUserId()))); return AjaxResult.success(baseService.statusStatistics(new BusinessSearchDto(SecurityUtils.getUserId())));
}
/**
* 项目资金分析
*/
@GetMapping("/amount/analyze")
public AjaxResult amountAnalyze(){
return AjaxResult.success(baseService.amountAnalyze(new BusinessSearchDto(SecurityUtils.getUserId(),0)));
}
/**
* 项目类型分析
*/
@GetMapping("/type/analyze")
public AjaxResult typeAnalyze(){
return AjaxResult.success(baseService.typeAnalyze(new BusinessSearchDto(SecurityUtils.getUserId(),2)));
} }
/** /**
......
...@@ -3,6 +3,7 @@ package com.dsk.system.domain.business.dto; ...@@ -3,6 +3,7 @@ package com.dsk.system.domain.business.dto;
import com.dsk.common.core.domain.BaseEntity; import com.dsk.common.core.domain.BaseEntity;
import lombok.Data; import lombok.Data;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -72,4 +73,16 @@ public class BusinessListDto extends BaseEntity { ...@@ -72,4 +73,16 @@ public class BusinessListDto extends BaseEntity {
* 业主单位 * 业主单位
*/ */
private String ownerCompany; private String ownerCompany;
/**
* 项目状态
*/
private Integer status;
/**
* 开始时间
*/
private String startTime;
/**
* 结束时间
*/
private String endTime;
} }
package com.dsk.system.domain.business.dto; package com.dsk.system.domain.business.dto;
import lombok.AllArgsConstructor;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
...@@ -14,30 +15,33 @@ import java.util.Map; ...@@ -14,30 +15,33 @@ import java.util.Map;
@Data @Data
@NoArgsConstructor @NoArgsConstructor
public class BusinessSearchDto implements Serializable { public class BusinessSearchDto implements Serializable {
/**
* 状态
*/
private Integer status;
/** /**
* 用户id * 用户id
*/ */
private Long userId; private Long userId;
/**
* 状态
*/
private Integer status;
/** /**
* 数据权限 * 数据权限
*/ */
private Map<String,Object> params; private Map<String, Object> params;
public Map<String, Object> getParams() public Map<String, Object> getParams() {
{ if (params == null) {
if (params == null)
{
params = new HashMap<>(); params = new HashMap<>();
} }
return params; return params;
} }
public BusinessSearchDto(Long userId){ public BusinessSearchDto(Long userId) {
this.userId = userId;
}
public BusinessSearchDto(Long userId, Integer status) {
this.userId = userId; this.userId = userId;
this.status = status;
} }
} }
package com.dsk.system.domain.business.vo;
import lombok.Data;
import java.io.Serializable;
/**
* 项目金额分析
*
* @author lcl
* @create 2023/8/15
*/
@Data
public class BusinessAnalyzeVo implements Serializable {
/**
* 项目类型
*/
private String projectType;
/**
* 资金来源
*/
private String amountSource;
/**
* 项目数量
*/
private Integer businessCount;
/**
* 总投资金额
*/
private Double totalAmount;
}
package com.dsk.system.mapper; package com.dsk.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dsk.common.annotation.DataScope;
import com.dsk.common.core.domain.entity.BusinessInfo; import com.dsk.common.core.domain.entity.BusinessInfo;
import com.dsk.system.domain.business.dto.BusinessListDto; import com.dsk.system.domain.business.dto.BusinessListDto;
import com.dsk.system.domain.business.dto.BusinessSearchDto; import com.dsk.system.domain.business.dto.BusinessSearchDto;
import com.dsk.system.domain.business.vo.BusinessAnalyzeVo;
import com.dsk.system.domain.business.vo.BusinessLikeProjectNameListVo; import com.dsk.system.domain.business.vo.BusinessLikeProjectNameListVo;
import com.dsk.system.domain.customer.dto.CustomerBusinessSearchDto; import com.dsk.system.domain.customer.dto.CustomerBusinessSearchDto;
import com.dsk.system.domain.customer.vo.CustomerBusinessListVo; import com.dsk.system.domain.customer.vo.CustomerBusinessListVo;
...@@ -112,4 +112,8 @@ public interface BusinessInfoMapper extends BaseMapper<BusinessInfo> { ...@@ -112,4 +112,8 @@ public interface BusinessInfoMapper extends BaseMapper<BusinessInfo> {
int selectCountByStatus(BusinessSearchDto dto); int selectCountByStatus(BusinessSearchDto dto);
List<BusinessAnalyzeVo> selectAmountAnalyze(BusinessSearchDto dto);
List<BusinessAnalyzeVo> selectTypeAnalyze(BusinessSearchDto dto);
} }
...@@ -3,7 +3,9 @@ package com.dsk.system.service; ...@@ -3,7 +3,9 @@ package com.dsk.system.service;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.dsk.common.core.domain.AjaxResult; import com.dsk.common.core.domain.AjaxResult;
import com.dsk.system.domain.business.dto.BusinessSearchDto; import com.dsk.system.domain.business.dto.BusinessSearchDto;
import com.dsk.system.domain.business.vo.BusinessAnalyzeVo;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -12,7 +14,11 @@ import java.util.Map; ...@@ -12,7 +14,11 @@ import java.util.Map;
*/ */
public interface IBusinessOverviewService { public interface IBusinessOverviewService {
Map<String, Object> statistics(BusinessSearchDto dto); Map<String, Object> statusStatistics(BusinessSearchDto dto);
List<BusinessAnalyzeVo> amountAnalyze(BusinessSearchDto dto);
List<BusinessAnalyzeVo> typeAnalyze(BusinessSearchDto dto);
AjaxResult countGroupByProvince(JSONObject object); AjaxResult countGroupByProvince(JSONObject object);
......
package com.dsk.system.service.impl; package com.dsk.system.service.impl;
import com.dsk.common.annotation.DataScope;
import com.dsk.common.core.domain.entity.BusinessFollowRecord; import com.dsk.common.core.domain.entity.BusinessFollowRecord;
import com.dsk.common.utils.DateUtils; import com.dsk.common.utils.DateUtils;
import com.dsk.system.domain.business.dto.BusinessIdDto; import com.dsk.system.domain.business.dto.BusinessIdDto;
...@@ -44,6 +45,7 @@ public class BusinessFollowRecordServiceImpl implements IBusinessFollowRecordSer ...@@ -44,6 +45,7 @@ public class BusinessFollowRecordServiceImpl implements IBusinessFollowRecordSer
} }
@Override @Override
@DataScope(userAlias = "u",deptAlias = "d")
public List<BusinessFollowRecord> allFollow(BusinessListDto dto) { public List<BusinessFollowRecord> allFollow(BusinessListDto dto) {
//userId不传值,就查询全部 //userId不传值,就查询全部
// if (dto.getUserId() == null) { // if (dto.getUserId() == null) {
......
...@@ -4,10 +4,9 @@ import cn.hutool.core.bean.BeanUtil; ...@@ -4,10 +4,9 @@ import cn.hutool.core.bean.BeanUtil;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.dsk.common.annotation.DataScope; import com.dsk.common.annotation.DataScope;
import com.dsk.common.core.domain.AjaxResult; import com.dsk.common.core.domain.AjaxResult;
import com.dsk.common.core.domain.BaseEntity;
import com.dsk.common.utils.DskOpenApiUtil; import com.dsk.common.utils.DskOpenApiUtil;
import com.dsk.common.utils.SecurityUtils;
import com.dsk.system.domain.business.dto.BusinessSearchDto; import com.dsk.system.domain.business.dto.BusinessSearchDto;
import com.dsk.system.domain.business.vo.BusinessAnalyzeVo;
import com.dsk.system.mapper.BusinessInfoMapper; import com.dsk.system.mapper.BusinessInfoMapper;
import com.dsk.system.service.IBusinessOverviewService; import com.dsk.system.service.IBusinessOverviewService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -15,6 +14,7 @@ import org.springframework.stereotype.Service; ...@@ -15,6 +14,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -32,7 +32,7 @@ public class BusinessOverviewServiceImpl implements IBusinessOverviewService { ...@@ -32,7 +32,7 @@ public class BusinessOverviewServiceImpl implements IBusinessOverviewService {
@Override @Override
@DataScope(userAlias = "u",deptAlias = "d") @DataScope(userAlias = "u",deptAlias = "d")
public Map<String, Object> statistics(BusinessSearchDto dto) { public Map<String, Object> statusStatistics(BusinessSearchDto dto) {
Map<String, Object> resultMap = new HashMap<>(); Map<String, Object> resultMap = new HashMap<>();
//总 //总
resultMap.put("totalCount",businessInfoMapper.selectCountByStatus(dto)); resultMap.put("totalCount",businessInfoMapper.selectCountByStatus(dto));
...@@ -48,6 +48,18 @@ public class BusinessOverviewServiceImpl implements IBusinessOverviewService { ...@@ -48,6 +48,18 @@ public class BusinessOverviewServiceImpl implements IBusinessOverviewService {
return resultMap; return resultMap;
} }
@Override
@DataScope(userAlias = "u",deptAlias = "d")
public List<BusinessAnalyzeVo> amountAnalyze(BusinessSearchDto dto) {
return businessInfoMapper.selectAmountAnalyze(dto);
}
@Override
@DataScope(userAlias = "u",deptAlias = "d")
public List<BusinessAnalyzeVo> typeAnalyze(BusinessSearchDto dto) {
return businessInfoMapper.selectTypeAnalyze(dto);
}
@Override @Override
public AjaxResult countGroupByProvince(JSONObject object) { public AjaxResult countGroupByProvince(JSONObject object) {
Map<String, Object> map = dskOpenApiUtil.requestBody("/nationzj/marketAnalysis/project/countGroupByProvince", object); Map<String, Object> map = dskOpenApiUtil.requestBody("/nationzj/marketAnalysis/project/countGroupByProvince", object);
......
...@@ -68,10 +68,12 @@ ...@@ -68,10 +68,12 @@
from business_follow_record f from business_follow_record f
left join business_info i on i.id = f.business_id left join business_info i on i.id = f.business_id
left join sys_user u on f.user_id = u.user_id left join sys_user u on f.user_id = u.user_id
left join sys_dept d on u.dept_id = d.dept_id
<where> <where>
<if test="userId != null"> <if test="userId != null"> and (f.user_id = #{userId} or i.is_private = 1)</if>
and f.user_id = #{userId} <if test="startTime != null and startTime != '' "> and f.creat_time &gt;= #{startTime} </if>
</if> <if test="endTime != null and endTime != '' "> and f.creat_time &lt;= #{endTime} </if>
${params.dataScope}
</where> </where>
ORDER BY f.creat_time DESC ORDER BY f.creat_time DESC
</select> </select>
......
...@@ -114,6 +114,7 @@ ...@@ -114,6 +114,7 @@
</if> </if>
<if test="minAmount != null and minAmount != ''"> and i.investment_amount &gt;= #{minAmount} </if> <if test="minAmount != null and minAmount != ''"> and i.investment_amount &gt;= #{minAmount} </if>
<if test="maxAmount != null and maxAmount != ''"> and i.investment_amount &lt;= #{maxAmount}</if> <if test="maxAmount != null and maxAmount != ''"> and i.investment_amount &lt;= #{maxAmount}</if>
<if test="status != null "> and i.status = #{status}</if>
<if test="projectStage != null and projectStage != ''"> <if test="projectStage != null and projectStage != ''">
and i.project_stage in and i.project_stage in
<foreach collection="projectStage" item="projectStage" open="(" separator="," close=")"> <foreach collection="projectStage" item="projectStage" open="(" separator="," close=")">
...@@ -374,15 +375,32 @@ ...@@ -374,15 +375,32 @@
<if test="companyName != null and companyName != '' "> and ct.company_name =#{companyName}</if> <if test="companyName != null and companyName != '' "> and ct.company_name =#{companyName}</if>
</select> </select>
<select id="selectCountByStatus" resultType="java.lang.Integer"> <sql id="businessSearchSql">
select
count(bi.id)
from business_info bi from business_info bi
join business_user bu on bu.business_id = bi.id join business_user bu on bu.business_id = bi.id
left join sys_user u on bu.user_id = u.user_id left join sys_user u on bu.user_id = u.user_id
left join sys_dept d on u.dept_id = d.dept_id left join sys_dept d on u.dept_id = d.dept_id
where (bu.user_id = #{userId} or bi.is_private = 1) where (bu.user_id = #{userId} or bi.is_private = 1)
<if test="status != null"> and bi.status = #{status}</if> <if test="status != null"> and bi.status = #{status} </if>
${params.dataScope} ${params.dataScope}
</sql>
<select id="selectCountByStatus" resultType="java.lang.Integer">
select count(bi.id) <include refid="businessSearchSql"/>
</select>
<select id="selectAmountAnalyze" resultType="com.dsk.system.domain.business.vo.BusinessAnalyzeVo">
select
bi.amount_source,count(bi.id) businessCount,sum(bi.investment_amount) totalAmount
<include refid="businessSearchSql"/>
group by bi.amount_source
</select>
<select id="selectTypeAnalyze" resultType="com.dsk.system.domain.business.vo.BusinessAnalyzeVo">
select
bi.project_type,count(bi.id) businessCount,sum(bi.investment_amount) totalAmount
<include refid="businessSearchSql"/>
group by bi.project_type
</select> </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