Commit 386673d9 by liulianglang

统计报表

parent b874c95c
......@@ -255,6 +255,18 @@ public class AjTjController {
}
}
@PostMapping("/getXlajlb")
@ApiOperation(value = "案件结构分布图", notes = "案件结构分布图")
public R getXlajlb(AjtjParam ajtjParam){
try {
Ajjgfbtj result = ajtjService.getAjjgfbt(ajtjParam);
return R.ok().data("result",result);
} catch (Exception e) {
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("/getAjSwrstj")
@ApiOperation(value = "案件死亡人数柱状图", notes = "案件死亡人数柱状图")
public R getAjSwrstj(AjtjParam ajtjParam){
......
package org.springblade.founder.tjfx.controller;
import io.swagger.annotations.ApiOperation;
import org.springblade.founder.tjfx.entity.DwTjParam;
import org.springblade.founder.tjfx.service.DwAjlbTjfxService;
import org.springblade.founder.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.Map;
@RestController
@RequestMapping(value = "/ajlbtj")
public class DwAjlbTjfxController {
@Autowired
private DwAjlbTjfxService dwAjlbTjfxService;
@PostMapping("/getAjlbTj")
@ApiOperation(value = "单位案件类别统计")
public R getAjlbTj(DwTjParam dwTjParam){
try {
Map<String, Object> rtMap = dwAjlbTjfxService.getAjlbTj(dwTjParam);
return R.ok().data(rtMap);
} catch (Exception e) {
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("/getXlAjlbTj")
@ApiOperation(value = "单位小类案件类别统计")
public R getXlAjlbTj(DwTjParam dwTjParam){
try {
Map<String, Object> rtMap = dwAjlbTjfxService.getXlAjlbTj(dwTjParam);
return R.ok().data(rtMap);
} catch (Exception e) {
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("/getXlAjlbTjTs")
@ApiOperation(value = "单位小类案件类别统计透视")
public R getXlAjlbTjTs(DwTjParam dwTjParam){
try {
Map<String, Object> rtMap = dwAjlbTjfxService.getXlAjlbTjTs(dwTjParam);
return R.ok().data(rtMap);
} catch (Exception e) {
e.printStackTrace();
return R.error(e.getMessage());
}
}
}
package org.springblade.founder.tjfx.entity;
import lombok.Data;
@Data
public class DwTjParam {
private String unitcode;
private String kssj;
private String jssj;
private String ajzt;
private String tjlb;
private String ajlbdm;
private String xlajlbdm;
private String qryType;
private int page;
private int limit;
}
package org.springblade.founder.tjfx.mapper;
import org.apache.ibatis.annotations.Mapper;
import org.springblade.founder.tjfx.entity.AjtjResult;
import org.springblade.founder.tjfx.entity.DwTjParam;
import org.springblade.founder.tjfx.entity.TbStAsj;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
@Mapper
public interface DwAjlbTjfxMapper {
List<AjtjResult> getAjlbTj(DwTjParam dwTjParam);
List<AjtjResult> getXlAjlbTj(DwTjParam dwTjParam);
List<TbStAsj> getXlAjlbTjTs(DwTjParam dwTjParam);
int getXlAjlbTjTsCount(DwTjParam dwTjParam);
}
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="org.springblade.founder.tjfx.mapper.DwAjlbTjfxMapper">
<select id="getAjlbTj" resultType="org.springblade.founder.tjfx.entity.AjtjResult">
select asj.ajlbdm code,
(SELECT name FROM sys_dictitem WHERE groupid = 'CODE_AJLB' AND code = asj.ajlbdm) as name,
count(1) as num
from TB_ST_ASJ asj
where asj.xxsc_pdbz='0'
<include refid="asjQry-where"/>
group by asj.ajlbdm
</select>
<select id="getXlAjlbTj" resultType="org.springblade.founder.tjfx.entity.AjtjResult">
select asj.zatz_jyqk code,
(SELECT name FROM sys_dictitem WHERE groupid = 'CODE_AJXZ' AND code = asj.zatz_jyqk) as name,
count(1) as num
from TB_ST_ASJ asj
where asj.xxsc_pdbz='0'
<include refid="asjQry-where"/>
group by asj.zatz_jyqk
</select>
<select id="getXlAjlbTjTs" resultType="org.springblade.founder.tjfx.entity.TbStAsj">
<include refid="pagination-head" />
select
<include refid="aj-common-column"/>
from tb_st_asj asj
where asj.xxsc_pdbz='0'
<include refid="asjQry-where"/>
order by asj.larq desc
<include refid="pagination-tail" />
</select>
<select id="getXlAjlbTjTsCount" resultType="java.lang.Integer">
select
count(1)
from tb_st_asj asj
where asj.xxsc_pdbz='0'
<include refid="asjQry-where"/>
</select>
<sql id="asjQry-where">
<if test="kssj != null and kssj != ''">
AND ASJ.LARQ <![CDATA[>=]]> to_date(#{kssj, jdbcType=VARCHAR},'yyyy-mm-dd')
</if>
<if test="jssj != null and jssj != ''">
AND ASJ.LARQ <![CDATA[<]]> to_date(#{jssj, jdbcType=VARCHAR},'yyyy-mm-dd ') +1
</if>
<if test="ajzt != null and ajzt != '' and ajzt == '1'.toString() ">
and ASJ.ZCJDDM = '0400'
</if>
<if test="ajzt != null and ajzt != '' and ajzt == '2'.toString() ">
and asj.ZCJDDM in ('0600','0700','0800')
</if>
<if test="ajzt != null and ajzt != '' and ajzt == '3'.toString() ">
and asj.ZCJDDM in ('0100','0200','0300','0301','0302','0400','0500')
</if>
<if test="ajlbdm != null and ajlbdm != '' ">
and ASJ.ajlbdm = #{ajlbdm}
</if>
<if test="xlajlbdm != null and xlajlbdm != '' ">
and ASJ.zatz_jyqk = #{xlajlbdm}
</if>
<if test="qryType == 'bdw'">
and ASJ.LADW_GAJGJGDM = #{unitcode}
</if>
<if test="qryType == 'bxq'">
and ASJ.LADW_GAJGJGDM in (select code from sys_dictitem_xz where code_lev1 =#{unitcode} or
code_lev2 =#{unitcode} or code_lev3 =#{unitcode}
or code_lev4 =#{unitcode} or code_lev5 =#{unitcode})
</if>
</sql>
<sql id="aj-common-column">
asj.asjbh as asjbh,
asj.ladw_Gajgmc AS ladwGajgmc,
asj.ZCZJ_ZXSJ01 AS zczjZxsj01,
asj.larq AS larq,
asj.asjfssj_Asjfskssj AS asjfssjAsjfskssj,
(SELECT name FROM sys_dictitem WHERE groupid = 'CODE_AJLB' AND code = asj.ajlbdm) as ajlbdm,
(SELECT name FROM sys_dictitem WHERE groupid = 'CODE_AJXZ' AND code = asj.zatz_jyqk) as zatzJyqk,
asj.ajmc AS ajmc,
asj.jyaq AS jyaq
</sql>
<!--分页查询开始-->
<sql id="pagination-head">
select * from (
select t.*,rownum rn from (
</sql>
<!--分页查询结束-->
<sql id="pagination-tail">
) t
WHERE ROWNUM <![CDATA[<=]]> #{end}
) WHERE RN > #{begin}
</sql>
</mapper>
......@@ -392,7 +392,7 @@
<if test="tjlb != null and tjlb != '' and tjlb == 'nl70'.toString() ">
and xyr.ZHFZXYR_CSRQ_RQGZXX <![CDATA[<=]]> to_date('1979-12-31 23:59:59', 'yyyy-mm-dd hh24:mi:ss')
</if>
<if test="xzqhdm != null and xzqhdm != '' ">
<if test="xzqhdm != null and xzqhdm != '' and xzqhdm != '未知'.toString() ">
and xyr.zhfzxyr_hjdz_xzqhdm like concat(#{xzqhdm},'%')
</if>
<if test="xzqhdm != null and xzqhdm != '' and xzqhdm == '未知'.toString() ">
......@@ -482,7 +482,7 @@
<if test="tjlb != null and tjlb != '' and tjlb == 'nl70'.toString() ">
and xyr.BHR_CSRQ_RQGZXX <![CDATA[<=]]> to_date('1979-12-31 23:59:59', 'yyyy-mm-dd hh24:mi:ss')
</if>
<if test="xzqhdm != null and xzqhdm != '' ">
<if test="xzqhdm != null and xzqhdm != '' and xzqhdm != '未知'.toString() ">
and xyr.bhr_hjdz_xzqhdm like concat(#{xzqhdm},'%')
</if>
<if test="xzqhdm != null and xzqhdm != '' and xzqhdm == '未知'.toString() ">
......
package org.springblade.founder.tjfx.service;
import org.springblade.founder.tjfx.entity.DwTjParam;
import java.util.Map;
public interface DwAjlbTjfxService {
Map<String, Object> getAjlbTj(DwTjParam dwTjParam);
Map<String, Object> getXlAjlbTj(DwTjParam dwTjParam);
Map<String, Object> getXlAjlbTjTs(DwTjParam dwTjParam);
}
package org.springblade.founder.tjfx.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.apache.commons.lang.StringUtils;
import org.springblade.founder.tjfx.entity.AjtjResult;
import org.springblade.founder.tjfx.entity.DwTjParam;
import org.springblade.founder.tjfx.entity.TbStAsj;
import org.springblade.founder.tjfx.mapper.DwAjlbTjfxMapper;
import org.springblade.founder.tjfx.mapper.DwTjfxMapper;
import org.springblade.founder.tjfx.service.DwAjlbTjfxService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
@DS("xzxt")
public class DwAjlbTjfxServiceImpl implements DwAjlbTjfxService {
@Resource
private DwAjlbTjfxMapper dwAjlbTjfxMapper;
@Override
public Map<String, Object> getAjlbTj(DwTjParam dwTjParam) {
Map<String, Object> rtMap = new HashMap<>();
if(StringUtils.isBlank(dwTjParam.getUnitcode())){
rtMap.put("rows",new ArrayList<>());
return rtMap;
}else {
dwTjParam.setQryType("bxq");
}
List<AjtjResult> dalist =dwAjlbTjfxMapper.getAjlbTj(dwTjParam);
rtMap.put("rows",dalist);
return rtMap;
}
@Override
public Map<String, Object> getXlAjlbTj(DwTjParam dwTjParam) {
Map<String, Object> rtMap = new HashMap<>();
if(StringUtils.isBlank(dwTjParam.getUnitcode())){
rtMap.put("rows",new ArrayList<>());
return rtMap;
}else {
dwTjParam.setQryType("bxq");
}
List<AjtjResult> dalist =dwAjlbTjfxMapper.getXlAjlbTj(dwTjParam);
rtMap.put("rows",dalist);
return rtMap;
}
@Override
public Map<String, Object> getXlAjlbTjTs(DwTjParam dwTjParam) {
Map<String, Object> rtMap = new HashMap<>();
if(StringUtils.isBlank(dwTjParam.getUnitcode())){
rtMap.put("rows",new ArrayList<>());
rtMap.put("total",0);
return rtMap;
}else {
dwTjParam.setQryType("bxq");
}
List<TbStAsj> dalist =dwAjlbTjfxMapper.getXlAjlbTjTs(dwTjParam);
int count =dwAjlbTjfxMapper.getXlAjlbTjTsCount(dwTjParam);
rtMap.put("rows",dalist);
rtMap.put("total",count);
return rtMap;
}
}
......@@ -13,6 +13,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;
import java.util.stream.Collectors;
@Service
......@@ -59,6 +61,7 @@ public class DwTjfxServiceImpl implements DwTjfxService {
int cjshrajl=0;//采集受害人案件量
int wcjshrajl=0;//未采集受害人案件量
int cjshrsl=0;//采集受害人数量
Lock lock = new ReentrantLock();
if(unitList!=null && unitList.size()>0){
if(unitList.size()<2){
unit1=unitList.subList(0,1);
......@@ -76,45 +79,64 @@ public class DwTjfxServiceImpl implements DwTjfxService {
dwXnpgTj.setDwdm(dwdm);
dwXnpgTj.setDwmc(dwmc);
dwXnpgTj.setQryType(dwtype);
lock.lock();
try {
dataList.add(dwXnpgTj);
}finally {
lock.unlock();
}
dataList.add(dwXnpgTj);
});
}else {
unit1=unitList.subList(0,1);
unit2=unitList.subList(1,unitList.size());
unit1.stream().parallel().forEach(item -> {
Map<String, Object> paramet=new HashMap<>();
String dwdm = item.getCode();
String dwmc = item.getName();
String dwtype="";
paramMap.put("unitcode", dwdm);
paramMap.put("qryType", "bdw");
paramet.putAll(paramMap);
paramet.put("unitcode", dwdm);
paramet.put("qryType", "bdw");
dwtype= "bdw";
DwXnpgTj dwXnpgTj = dwTjfxMapper.getDwTjFx(paramMap);
DwXnpgTj dwXnpgTj = dwTjfxMapper.getDwTjFx(paramet);
dwXnpgTj.setDwdm(dwdm);
dwXnpgTj.setDwmc(dwmc);
dwXnpgTj.setQryType(dwtype);
lock.lock();
try {
dataList.add(dwXnpgTj);
}finally {
lock.unlock();
}
dataList.add(dwXnpgTj);
});
unit2.stream().parallel().forEach(item -> {
Map<String, Object> paramet=new HashMap<>();
String dwdm = item.getCode();
String dwmc = item.getName();
String dwtype="";
paramMap.put("unitcode", dwdm);
paramMap.put("qryType", "bxq");
paramet.putAll(paramMap);
paramet.put("unitcode", dwdm);
paramet.put("qryType", "bxq");
dwtype= "bxq";
DwXnpgTj dwXnpgTj = dwTjfxMapper.getDwTjFx(paramMap);
DwXnpgTj dwXnpgTj = dwTjfxMapper.getDwTjFx(paramet);
dwXnpgTj.setDwdm(dwdm);
dwXnpgTj.setDwmc(dwmc);
dwXnpgTj.setQryType(dwtype);
lock.lock();
try {
dataList.add(dwXnpgTj);
}finally {
lock.unlock();
}
dataList.add(dwXnpgTj);
});
......
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