Commit c2258864 by MMF

MMF 2026-04-17 帮扶项目统计排名

parent 7a622d03
......@@ -33,4 +33,36 @@ public class ZqbfXmzTjfxController extends BaseController {
return error(e.getMessage());
}
}
/**
* 帮扶项目统计占比
*/
@GetMapping("/bfxmtjzb")
public AjaxResult bfxmtjzb(ZqczTjfxQuery zqczTjfxQuery){
try {
return success(zqbfXmzTjfxService.bfxmtjzb(zqczTjfxQuery));
} catch (BusinessException e) {
log.warn("最强帮扶-统计分析-帮扶项目统计占比-查询失败:" + e.getMessage());
return warn(e.getMessage());
} catch (Exception e) {
log.error(e.getMessage());
return error(e.getMessage());
}
}
/**
* 帮扶项目统计排名
*/
@GetMapping("/bfxmtjpm")
public AjaxResult bfxmtjpm(ZqczTjfxQuery zqczTjfxQuery){
try {
return success(zqbfXmzTjfxService.bfxmtjpm(zqczTjfxQuery));
} catch (BusinessException e) {
log.warn("最强帮扶-统计分析-帮扶项目统计排名-查询失败:" + e.getMessage());
return warn(e.getMessage());
} catch (Exception e) {
log.error(e.getMessage());
return error(e.getMessage());
}
}
}
package com.qianhe.zqbf.domain;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BfxmtjpmVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 项目ID
*/
private Long xmid;
/**
* 项目名称
*/
private String xmmc;
/**
* 帮扶次数
*/
private Integer bfcs;
}
package com.qianhe.zqbf.domain;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class BfxmtjzbVo implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 项目组别
*/
private String xmzb;
/**
* 组别名称
*/
private String zbmc;
/**
* 帮扶次数
*/
private Integer bfcs;
/**
* 帮扶占比
*/
private String bfzb;
}
package com.qianhe.zqbf.mapper;
import com.qianhe.zqbf.domain.BfxmtjpmVo;
import com.qianhe.zqbf.domain.BfxmtjzbVo;
import com.qianhe.zqbf.domain.GlqsbslVo;
import com.qianhe.zqbf.domain.ZqczTjfxQuery;
import org.apache.ibatis.annotations.Mapper;
......@@ -13,4 +15,14 @@ public interface ZqbfXmzTjfxMapper {
* 管理区上报数量
*/
List<GlqsbslVo> glqsbsl(ZqczTjfxQuery zqczTjfxQuery);
/**
* 帮扶项目统计占比
*/
List<BfxmtjzbVo> bfxmtjzb(ZqczTjfxQuery zqczTjfxQuery);
/**
* 帮扶项目统计排名
*/
List<BfxmtjpmVo> bfxmtjpm(ZqczTjfxQuery zqczTjfxQuery);
}
......@@ -8,4 +8,14 @@ public interface ZqbfXmzTjfxService {
* 管理区上报数量
*/
ChartBaseModel glqsbsl(ZqczTjfxQuery zqczTjfxQuery);
/**
* 帮扶项目统计占比
*/
ChartBaseModel bfxmtjzb(ZqczTjfxQuery zqczTjfxQuery);
/**
* 帮扶项目统计排名
*/
ChartBaseModel bfxmtjpm(ZqczTjfxQuery zqczTjfxQuery);
}
package com.qianhe.zqbf.service.impl;
import com.qianhe.common.annotation.DataScope;
import com.qianhe.common.core.domain.entity.SysDept;
import com.qianhe.common.utils.MtTreeUtils;
import com.qianhe.system.service.ISysDeptService;
import com.qianhe.zqbf.domain.ChartBaseModel;
import com.qianhe.zqbf.domain.GlqsbslVo;
import com.qianhe.zqbf.domain.ZqczTjfxQuery;
import com.qianhe.zqbf.domain.*;
import com.qianhe.zqbf.mapper.ZqbfXmzTjfxMapper;
import com.qianhe.zqbf.service.ZqbfXmzTjfxService;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -34,6 +33,55 @@ public class ZqbfXmzTjfxServiceImpl implements ZqbfXmzTjfxService {
}
/**
* 帮扶项目统计占比
*/
@DataScope(deptAlias = "dept")
@Override
public ChartBaseModel bfxmtjzb(ZqczTjfxQuery zqczTjfxQuery) {
List<BfxmtjzbVo> dataList = xmzTjfxMapper.bfxmtjzb(zqczTjfxQuery);
List<Object> seriesList = new ArrayList<>();
for (BfxmtjzbVo bfxmtjzbVo : dataList) {
Map<String, Object> rowSeries = new HashMap<>();
rowSeries.put("name", bfxmtjzbVo.getZbmc());
rowSeries.put("value", bfxmtjzbVo.getBfzb());
rowSeries.put("bfcs", bfxmtjzbVo.getBfcs());
seriesList.add(rowSeries);
}
ChartBaseModel chartBaseModel = new ChartBaseModel();
chartBaseModel.setData(seriesList);
return chartBaseModel;
}
/**
* 帮扶项目统计排名
*/
@Override
public ChartBaseModel bfxmtjpm(ZqczTjfxQuery zqczTjfxQuery) {
List<BfxmtjpmVo> dataList = xmzTjfxMapper.bfxmtjpm(zqczTjfxQuery);
List<Map<String, Object>> legendData = new ArrayList<>();
List<String> xAxisData = new ArrayList<>();
List<Object> data = new ArrayList<>();
for (BfxmtjpmVo bfxmtjpmVo : dataList) {
HashMap<String, Object> legendMap = new HashMap<>();
legendMap.put("label", bfxmtjpmVo.getXmmc());
legendMap.put("value", bfxmtjpmVo.getXmid());
legendData.add(legendMap);
xAxisData.add(bfxmtjpmVo.getXmmc());
data.add(bfxmtjpmVo.getBfcs());
}
ChartBaseModel chartBaseModel = new ChartBaseModel();
chartBaseModel.setLegendData(legendData);
chartBaseModel.setXAxisData(xAxisData);
chartBaseModel.setData(data);
return chartBaseModel;
}
/**
* 将 GlqsbslVo 列表转换为 ChartBaseModel
* @param voList 原始数据列表
* @return ChartBaseModel 对象
......
......@@ -10,7 +10,18 @@
<result property="tbsl" column="tbsl"/>
<result property="ywcsl" column="ywcsl"/>
</resultMap>
<!-- 条件查询 -->
<resultMap id="BfxmtjzbResult" type="BfxmtjzbVo">
<result property="xmzb" column="xmzb"/>
<result property="zbmc" column="zbmc"/>
<result property="bfcs" column="bfcs"/>
<result property="bfzb" column="bfzb"/>
</resultMap>
<resultMap id="BfxmtjpmResult" type="BfxmtjpmVo">
<result property="xmid" column="xmid"/>
<result property="xmmc" column="xmmc"/>
<result property="bfcs" column="bfcs"/>
</resultMap>
<!-- 管理区上报数量 -->
<select id="glqsbsl" parameterType="ZqczTjfxQuery" resultMap="GlqsbslResult">
WITH RECURSIVE child_tree AS (
SELECT dept_id, dept_id AS root_id
......@@ -128,4 +139,59 @@
) t
ORDER BY sort_order, tbsl DESC, ywcsl DESC
</select>
<!-- 帮扶项目统计占比 -->
<select id="bfxmtjzb" parameterType="ZqczTjfxQuery" resultMap="BfxmtjzbResult">
SELECT
dictdata.dict_value AS xmzb,
dictdata.dict_label AS zbmc,
COUNT( bfxqxm.xqxmid ) AS bfcs,
TRIM(TRAILING '.' FROM TRIM(TRAILING '0' FROM ROUND( COUNT( bfxqxm.xqxmid ) / total.total_bfcs * 100, 2 ))) AS bfzb
FROM
sys_dict_data dictdata
LEFT JOIN zqbf_xmz_bfxm bfxm ON dictdata.dict_value = bfxm.xmzb
LEFT JOIN zqbf_xmz_bfxq_bfxm bfxqxm ON bfxm.xmid = bfxqxm.xmid
LEFT JOIN zqbf_xmz_bfxq bfxq ON bfxqxm.xqid = bfxq.xqid
LEFT JOIN sys_dept dept ON bfxq.dwid = dept.dept_id
CROSS JOIN ( SELECT COUNT( * ) AS total_bfcs FROM zqbf_xmz_bfxq_bfxm ) total
<where>
dictdata.dict_type = 'zqbf_xmz_zjzj'
<if test="dwid != null ">AND (dept.dept_id = #{dwid} OR FIND_IN_SET(#{dwid}, dept.ancestors))</if>
<if test="xmzb != null and xmzb != ''">AND bfxm.xmzb = #{xmzb}</if>
<if test="kssj != null and jssj != null">AND NOT (bfxq.bfjssj &lt; #{kssj} OR bfxq.bfkssj &gt; #{jssj})</if>
<if test="kssj != null and jssj == null">AND bfxq.bfkssj &gt;= #{kssj}</if>
<if test="jssj != null and kssj == null">AND bfxq.bfjssj &lt;= #{jssj}</if>
${params.dataScope}
</where>
GROUP BY
dictdata.dict_value,
dictdata.dict_label,
total.total_bfcs
ORDER BY
dictdata.dict_value
</select>
<!-- 帮扶项目统计排名 -->
<select id="bfxmtjpm" parameterType="ZqczTjfxQuery" resultMap="BfxmtjpmResult">
SELECT
bfxm.xmid,
bfxm.xmmc,
count( bfxqxm.xmid ) bfcs
FROM
zqbf_xmz_bfxm bfxm
LEFT JOIN zqbf_xmz_bfxq_bfxm bfxqxm ON bfxm.xmid = bfxqxm.xmid
LEFT JOIN zqbf_xmz_bfxq bfxq ON bfxqxm.xqid = bfxq.xqid
LEFT JOIN sys_dept dept ON bfxq.dwid = dept.dept_id
<where>
<if test="dwid != null ">AND (dept.dept_id = #{dwid} OR FIND_IN_SET(#{dwid}, dept.ancestors))</if>
<if test="xmzb != null and xmzb != ''">AND bfxm.xmzb = #{xmzb}</if>
<if test="kssj != null and jssj != null">AND NOT (bfxq.bfjssj &lt; #{kssj} OR bfxq.bfkssj &gt; #{jssj})</if>
<if test="kssj != null and jssj == null">AND bfxq.bfkssj &gt;= #{kssj}</if>
<if test="jssj != null and kssj == null">AND bfxq.bfjssj &lt;= #{jssj}</if>
${params.dataScope}
</where>
GROUP BY
bfxm.xmid,
bfxm.xmmc
ORDER BY
count( bfxqxm.xmid ) DESC
</select>
</mapper>
\ No newline at end of file
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