Commit 9da0e410 by liulianglang

新案件统计

parent 368ca4af
package org.springblade.founder.tjfx.controller;
import io.swagger.annotations.ApiOperation;
import org.springblade.founder.tjfx.entity.DwTjParam;
import org.springblade.founder.tjfx.service.AjlbSysDictService;
import org.springblade.founder.tjfx.service.NewDwAjlbService;
import org.springblade.founder.utils.EasyUIPage;
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.RestController;
import java.util.Map;
@RestController
@RequestMapping(value = "/newajlb")
public class NewDwAjlbController {
@Autowired
private NewDwAjlbService newDwAjlbService;
@Autowired
private AjlbSysDictService ajlbSysDictService;
@PostMapping("/getnewajlbTj")
@ApiOperation(value = "单位案件类别统计")
public R getnewajlbTj(DwTjParam dwTjParam){
try {
Map<String, Object> rtMap = newDwAjlbService.getnewajlbTj(dwTjParam);
return R.ok().data(rtMap);
} catch (Exception e) {
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("/getnewajlbTjByPid")
@ApiOperation(value = "单位案件类别统计")
public R getnewajlbTjByPid(DwTjParam dwTjParam){
try {
Map<String, Object> rtMap = ajlbSysDictService.getnewajlbTjByPid(dwTjParam);
return R.ok().data(rtMap);
} catch (Exception e) {
e.printStackTrace();
return R.error(e.getMessage());
}
}
@PostMapping("/getnewAjlbTjByPidTs")
@ApiOperation(value = "单位案件类别统计透视")
public R getnewAjlbTjByPidTs(DwTjParam dwTjParam){
try {
EasyUIPage easyUIPage = new EasyUIPage();
easyUIPage.setPage(dwTjParam.getPage());
easyUIPage.setPageParaOracle(dwTjParam.getLimit());
int begin = easyUIPage.getBegin();
int end = easyUIPage.getEnd();
dwTjParam.setBegin(begin);
dwTjParam.setEnd(end);
Map<String, Object> rtMap = ajlbSysDictService.getnewAjlbTjByPidTs(dwTjParam);
return R.ok().data(rtMap);
} catch (Exception e) {
e.printStackTrace();
return R.error(e.getMessage());
}
}
}
...@@ -32,4 +32,12 @@ public class DictitemXz { ...@@ -32,4 +32,12 @@ public class DictitemXz {
return Integer.parseInt(this.rys); return Integer.parseInt(this.rys);
} }
} }
public int getNumberNums() {
if(StringUtils.isEmpty(this.num)){
return 0;
}else {
return Integer.parseInt(this.num);
}
}
} }
package org.springblade.founder.tjfx.mapper;
import com.baomidou.dynamic.datasource.annotation.DS;
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.DwWcnrTj;
import org.springblade.founder.tjfx.entity.TbStAsj;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Map;
@Component
@Mapper
@DS("xzxt")
public interface NewDwAjlbMapper {
DwWcnrTj getnewajlbTj(Map<String, Object> paramMap);
List<AjtjResult> getAjlbTj(DwTjParam dwTjParam);
List<TbStAsj> getAjlbTjTs(DwTjParam dwTjParam);
int getAjlbTjTsCount(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.NewDwAjlbMapper">
<select id="getnewajlbTj" resultType="org.springblade.founder.tjfx.entity.DwWcnrTj">
select
(select count(1) from TB_ST_ASJ asj
where asj.xxsc_pdbz='0'
and asj.AJLBDM like '01%'
<include refid="asjQry-where"/>
)
ajs01,
(select count(1) from TB_ST_ASJ asj
where asj.xxsc_pdbz='0'
and asj.AJLBDM like '02%'
<include refid="asjQry-where"/>
)
ajs02,
(select count(1) from TB_ST_ASJ asj
where asj.xxsc_pdbz='0'
and asj.AJLBDM like '03%'
<include refid="asjQry-where"/>
)
ajs03,
(select count(1) from TB_ST_ASJ asj
where asj.xxsc_pdbz='0'
and asj.AJLBDM like '04%'
<include refid="asjQry-where"/>
)
ajs04,
(select count(1) from TB_ST_ASJ asj
where asj.xxsc_pdbz='0'
and asj.AJLBDM like '05%'
<include refid="asjQry-where"/>
)
ajs05,
(select count(1) from TB_ST_ASJ asj
where asj.xxsc_pdbz='0'
and asj.AJLBDM like '06%'
<include refid="asjQry-where"/>
)
ajs06,
(select count(1) from TB_ST_ASJ asj
where asj.xxsc_pdbz='0'
and asj.AJLBDM like '07%'
<include refid="asjQry-where"/>
)
ajs07,
(select count(1) from TB_ST_ASJ asj
where asj.xxsc_pdbz='0'
and asj.AJLBDM like '08%'
<include refid="asjQry-where"/>
)
ajs08,
(select count(1) from TB_ST_ASJ asj
where asj.xxsc_pdbz='0'
and asj.AJLBDM like '09%'
<include refid="asjQry-where"/>
)
ajs09,
(select count(1) from TB_ST_ASJ asj
where asj.xxsc_pdbz='0'
and asj.AJLBDM like '10%'
<include refid="asjQry-where"/>
)
ajs10
from dual
</select>
<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'
<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="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>
group by asj.ajlbdm
order by asj.ajlbdm
</select>
<select id="getAjlbTjTs" 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'
<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="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>
<if test="lbs != null and lbs.size() > 0">
and
asj.ajlbdm in
<foreach collection="lbs" item="dw" separator="," open="(" close=")">
#{dw,jdbcType=VARCHAR}
</foreach>
</if>
order by asj.LARQ desc
<include refid="pagination-tail" />
</select>
<select id="getAjlbTjTsCount" resultType="java.lang.Integer">
select
count(1)
from tb_st_asj asj
where asj.xxsc_pdbz='0'
<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="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>
<if test="lbs != null and lbs.size() > 0">
and
asj.ajlbdm in
<foreach collection="lbs" item="dw" separator="," open="(" close=")">
#{dw,jdbcType=VARCHAR}
</foreach>
</if>
</select>
<!--分页查询开始-->
<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>
<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 ajlbdm != '未知'.toString() ">
and ASJ.ajlbdm = #{ajlbdm}
</if>
<if test="ajlbdm != null and ajlbdm != '' and ajlbdm == '未知'.toString() ">
and ASJ.ajlbdm is null
</if>
<if test="xlajlbdm != null and xlajlbdm != '' and xlajlbdm != '未知'.toString() ">
and ASJ.zatz_jyqk = #{xlajlbdm}
</if>
<if test="xlajlbdm != null and xlajlbdm != '' and xlajlbdm == '未知'.toString() ">
and ASJ.zatz_jyqk is null
</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>
</mapper>
...@@ -27,4 +27,9 @@ public interface AjlbSysDictService { ...@@ -27,4 +27,9 @@ public interface AjlbSysDictService {
Map<String, Object> getWcnrRyShrTjByPidTs(DwTjParam dwTjParam); Map<String, Object> getWcnrRyShrTjByPidTs(DwTjParam dwTjParam);
Map<String, Object> getnewajlbTjByPid(DwTjParam dwTjParam);
Map<String, Object> getnewAjlbTjByPidTs(DwTjParam dwTjParam);
} }
package org.springblade.founder.tjfx.service;
import org.springblade.founder.tjfx.entity.DwTjParam;
import java.util.Map;
public interface NewDwAjlbService {
Map<String, Object> getnewajlbTj(DwTjParam dwTjParam);
Map<String, Object> getAjlbTj(DwTjParam dwTjParam);
}
...@@ -3,14 +3,8 @@ package org.springblade.founder.tjfx.service.impl; ...@@ -3,14 +3,8 @@ package org.springblade.founder.tjfx.service.impl;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springblade.core.secure.utils.SecureUtil; import org.springblade.core.secure.utils.SecureUtil;
import org.springblade.founder.tjfx.entity.*; import org.springblade.founder.tjfx.entity.*;
import org.springblade.founder.tjfx.mapper.AjlbSysDictMapper; import org.springblade.founder.tjfx.mapper.*;
import org.springblade.founder.tjfx.mapper.DwAjlbTjfxMapper; import org.springblade.founder.tjfx.service.*;
import org.springblade.founder.tjfx.mapper.WcnrfzShrTjMapper;
import org.springblade.founder.tjfx.mapper.WcnrfzTjMapper;
import org.springblade.founder.tjfx.service.AjlbSysDictService;
import org.springblade.founder.tjfx.service.DwAjlbTjfxService;
import org.springblade.founder.tjfx.service.WcnrfzShrTjService;
import org.springblade.founder.tjfx.service.WcnrfzTjService;
import org.springblade.founder.utils.DwUtil; import org.springblade.founder.utils.DwUtil;
import org.springblade.modules.system.entity.XzxtUser; import org.springblade.modules.system.entity.XzxtUser;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -39,7 +33,10 @@ public class AjlbSysDictServiceImpl implements AjlbSysDictService { ...@@ -39,7 +33,10 @@ public class AjlbSysDictServiceImpl implements AjlbSysDictService {
private WcnrfzShrTjService wcnrfzShrTjService; private WcnrfzShrTjService wcnrfzShrTjService;
@Autowired @Autowired
private WcnrfzShrTjMapper wcnrfzShrTjMapper; private WcnrfzShrTjMapper wcnrfzShrTjMapper;
@Autowired
private NewDwAjlbService newDwAjlbService;
@Autowired
private NewDwAjlbMapper newDwAjlbMapper;
@Override @Override
public Map<String, Object> getAjlbTjByPid(DwTjParam dwTjParam) { public Map<String, Object> getAjlbTjByPid(DwTjParam dwTjParam) {
Map<String, Object> rtMap = new HashMap<>(); Map<String, Object> rtMap = new HashMap<>();
...@@ -267,6 +264,60 @@ public class AjlbSysDictServiceImpl implements AjlbSysDictService { ...@@ -267,6 +264,60 @@ public class AjlbSysDictServiceImpl implements AjlbSysDictService {
return rtMap; return rtMap;
} }
@Override
public Map<String, Object> getnewAjlbTjByPidTs(DwTjParam dwTjParam) {
Map<String, Object> rtMap = new HashMap<>();
String unitcode=dwTjParam.getUnitcode();
if (StringUtils.isEmpty(unitcode)) {
XzxtUser xzxtUser = SecureUtil.getUserXzxt();
unitcode = xzxtUser.getUnitcode();//获取对应用户的单位
}
System.out.println(unitcode);
dwTjParam.setUnitcode(unitcode);
// dwTjParam.setQryType("bxq");
List<String> lbs=new ArrayList<>();
List<DictitemXz> unitList = ajlbSysDictMapper.getAjlbByCode(dwTjParam.getAjlbdm());
lbs.add(dwTjParam.getAjlbdm());
for(DictitemXz xz:unitList){
if("yxj".equals(xz.getLev())){
List<DictitemXz> xjajlbs = ajlbSysDictMapper.getAjlbByCode(xz.getCode());
for(DictitemXz xjs:xjajlbs){
if("yxj".equals(xjs.getLev())){
List<DictitemXz> xxjajlbs = ajlbSysDictMapper.getAjlbByCode(xjs.getCode());
for(DictitemXz xxjs:xxjajlbs){
lbs.add(xxjs.getCode());
}
lbs.add(xjs.getCode());
}else {
lbs.add(xjs.getCode());
}
}
lbs.add(xz.getCode());
}else{
lbs.add(xz.getCode());
}
}
dwTjParam.setLbs(lbs);
List<TbStAsj> dalist = newDwAjlbMapper.getAjlbTjTs(dwTjParam);
int count =newDwAjlbMapper.getAjlbTjTsCount(dwTjParam);
rtMap.put("rows",dalist);
rtMap.put("total",count);
return rtMap;
}
@Override @Override
public Map<String, Object> getWcnrRyTjByPidTs(DwTjParam dwTjParam) { public Map<String, Object> getWcnrRyTjByPidTs(DwTjParam dwTjParam) {
Map<String, Object> rtMap = new HashMap<>(); Map<String, Object> rtMap = new HashMap<>();
...@@ -642,4 +693,88 @@ public class AjlbSysDictServiceImpl implements AjlbSysDictService { ...@@ -642,4 +693,88 @@ public class AjlbSysDictServiceImpl implements AjlbSysDictService {
rtMap.put("rows",res); rtMap.put("rows",res);
return rtMap; return rtMap;
} }
@Override
public Map<String, Object> getnewajlbTjByPid(DwTjParam dwTjParam) {
Map<String, Object> rtMap = new HashMap<>();
Map<String, Object> paramMap=new HashMap<>();
List<DwXnpgTj> dataList = new ArrayList<>();
List<DictitemXz> res = new ArrayList<>();
String unitcode=dwTjParam.getUnitcode();
String kssj=dwTjParam.getKssj();
String jssj=dwTjParam.getJssj();
String ajzt=dwTjParam.getAjzt();
String ajlbdm=dwTjParam.getAjlbdm();
String xlajlbdm=dwTjParam.getXlajlbdm();
String pid="true";
if (StringUtils.isEmpty(unitcode)) {
XzxtUser xzxtUser = SecureUtil.getUserXzxt();
unitcode = xzxtUser.getUnitcode();//获取对应用户的单位
}
System.out.println(unitcode);
dwTjParam.setUnitcode(unitcode);
if(StringUtils.isEmpty(ajlbdm)){
pid="true";
}else {
pid=ajlbdm;
}
List<DictitemXz> unitList = ajlbSysDictMapper.getAjlbByCode(pid);
Map<String, Object> results=newDwAjlbService.getAjlbTj(dwTjParam);
Map<String, String> resultMap=new HashMap<>();
Map<String, String> ryMap=new HashMap<>();
List<AjtjResult> dalist=(List<AjtjResult>)results.get("rows");
if (dalist != null && dalist.size() > 0) {
// for (AjtjResult item : dalist) {
// map.put(String.valueOf(item.getMonthName()), item.getFaNum());
// }
resultMap=dalist.stream().collect(Collectors.toMap(AjtjResult::getCode, AjtjResult::getNum));
}
for(DictitemXz xz:unitList){
if("yxj".equals(xz.getLev())){
int xjzs=0;
List<DictitemXz> xjajlbs = ajlbSysDictMapper.getAjlbByCode(xz.getCode());
for(DictitemXz xjs:xjajlbs){
if("yxj".equals(xjs.getLev())){
List<DictitemXz> xxjajlbs = ajlbSysDictMapper.getAjlbByCode(xjs.getCode());
for(DictitemXz xxjs:xxjajlbs){
xjzs+=Integer.parseInt(resultMap.get(xxjs.getCode())!= null ?resultMap.get(xxjs.getCode()): "0");
}
xjzs+=Integer.parseInt(resultMap.get(xjs.getCode())!= null ?resultMap.get(xjs.getCode()): "0");
}else {
xjzs+=Integer.parseInt(resultMap.get(xjs.getCode())!= null ?resultMap.get(xjs.getCode()): "0");
}
}
xjzs+=Integer.parseInt(resultMap.get(xz.getCode())!= null ?resultMap.get(xz.getCode()): "0");
xz.setNum(String.valueOf(xjzs));
}else{
xz.setNum(resultMap.get(xz.getCode())!= null ?resultMap.get(xz.getCode()): "0");
xz.setRys(ryMap.get(xz.getCode())!= null ?ryMap.get(xz.getCode()): "0");
}
}
res = unitList.stream().sorted(Comparator.comparing(DictitemXz::getNumberNums).reversed())
.collect(Collectors.toList());
rtMap.put("rows",res);
return rtMap;
}
} }
package org.springblade.founder.tjfx.service.impl;
import com.baomidou.dynamic.datasource.annotation.DS;
import org.apache.commons.lang.StringUtils;
import org.springblade.core.secure.utils.SecureUtil;
import org.springblade.founder.tjfx.entity.AjtjResult;
import org.springblade.founder.tjfx.entity.DictitemXz;
import org.springblade.founder.tjfx.entity.DwTjParam;
import org.springblade.founder.tjfx.entity.DwWcnrTj;
import org.springblade.founder.tjfx.mapper.DwTjfxMapper;
import org.springblade.founder.tjfx.mapper.NewDwAjlbMapper;
import org.springblade.founder.tjfx.service.NewDwAjlbService;
import org.springblade.founder.utils.DwUtil;
import org.springblade.modules.system.entity.XzxtUser;
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
@DS("xzxt")
public class NewDwAjlbServiceImpl implements NewDwAjlbService {
@Autowired
private DwTjfxMapper dwTjfxMapper;
@Autowired
private NewDwAjlbMapper newDwAjlbMapper;
@Override
public Map<String, Object> getnewajlbTj(DwTjParam dwTjParam) {
Map<String, Object> rtMap = new HashMap<>();
Map<String, Object> paramMap=new HashMap<>();
List<DwWcnrTj> dataList = new ArrayList<>();
List<DwWcnrTj> res = new ArrayList<>();
String unitcode=dwTjParam.getUnitcode();
String kssj=dwTjParam.getKssj();
String jssj=dwTjParam.getJssj();
String ajzt=dwTjParam.getAjzt();
String ajlbdm=dwTjParam.getAjlbdm();
String xlajlbdm=dwTjParam.getXlajlbdm();
if (StringUtils.isEmpty(unitcode)) {
XzxtUser xzxtUser = SecureUtil.getUserXzxt();
unitcode=xzxtUser.getUnitcode() ;//获取对应用户的单位
}
//获取本单位信息
DictitemXz bdwxx = dwTjfxMapper.getDwxxByDwdm(unitcode);
//设置单位查询参数
Map<String, Object> dwLevMap = DwUtil.getDwLevCode(unitcode, bdwxx.getLev());
paramMap.putAll(dwLevMap);
paramMap.put("unitcode", unitcode);
paramMap.put("kssj", kssj);
paramMap.put("jssj", jssj);
paramMap.put("ajzt", ajzt);
paramMap.put("ajlbdm", ajlbdm);
paramMap.put("xlajlbdm", xlajlbdm);
dwLevMap.put("includeBdw","true");
List<DictitemXz> unitList = dwTjfxMapper.getXqdwList(dwLevMap);
List<DictitemXz> unit1=new ArrayList<>();
List<DictitemXz> unit2=new ArrayList<>();
Lock lock = new ReentrantLock();
if(unitList!=null && unitList.size()>0){
if(unitList.size()<2){
unit1=unitList.subList(0,1);
unit1.stream().parallel().forEach(item -> {
String dwdm = item.getCode();
String dwmc = item.getName();
String dwtype="";
paramMap.put("unitcode", dwdm);
paramMap.put("qryType", "bdw");
dwtype= "bdw";
DwWcnrTj dwXnpgTj = newDwAjlbMapper.getnewajlbTj(paramMap);
dwXnpgTj.setDwdm(dwdm);
dwXnpgTj.setDwmc(dwmc);
dwXnpgTj.setQryType(dwtype);
lock.lock();
try {
dataList.add(dwXnpgTj);
}finally {
lock.unlock();
}
});
}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="";
paramet.putAll(paramMap);
paramet.put("unitcode", dwdm);
paramet.put("qryType", "bdw");
dwtype= "bdw";
DwWcnrTj dwXnpgTj = newDwAjlbMapper.getnewajlbTj(paramet);
dwXnpgTj.setDwdm(dwdm);
dwXnpgTj.setDwmc(dwmc);
dwXnpgTj.setQryType(dwtype);
lock.lock();
try {
dataList.add(dwXnpgTj);
}finally {
lock.unlock();
}
});
unit2.stream().parallel().forEach(item -> {
Map<String, Object> paramet=new HashMap<>();
String dwdm = item.getCode();
String dwmc = item.getName();
String dwtype="";
paramet.putAll(paramMap);
paramet.put("unitcode", dwdm);
paramet.put("qryType", "bxq");
dwtype= "bxq";
DwWcnrTj dwXnpgTj = newDwAjlbMapper.getnewajlbTj(paramet);
dwXnpgTj.setDwdm(dwdm);
dwXnpgTj.setDwmc(dwmc);
dwXnpgTj.setQryType(dwtype);
lock.lock();
try {
dataList.add(dwXnpgTj);
}finally {
lock.unlock();
}
});
}
}
res = dataList.stream().sorted(Comparator.comparing(DwWcnrTj::getDwdm))
.collect(Collectors.toList());
rtMap.put("rows",res);
return rtMap;
}
@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 =newDwAjlbMapper.getAjlbTj(dwTjParam);
rtMap.put("rows",dalist);
return rtMap;
}
}
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