14 files modified
3 files added
| | |
| | | import cn.gistack.sm.sjztmd.service.IAttResBaseService; |
| | | import cn.gistack.sm.sjztmd.service.ITbDykeInvestigationService; |
| | | import cn.gistack.sm.sjztmd.service.ITbDykeInvestigationStateService; |
| | | import cn.gistack.sm.sjztmd.statisticsVO.StatisticsParams; |
| | | import cn.gistack.sm.sjztmd.statisticsVO.StatisticsPie; |
| | | import cn.gistack.sm.sjztmd.vo.AttResBaseGeneralInvestigationVO; |
| | | import cn.gistack.sm.sjztmd.vo.TbDykeInvestigationParam; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | return R.data(list); |
| | | } |
| | | |
| | | @GetMapping("/statisticsPie") |
| | | public R statisticsPie(StatisticsParams statisticsParams){ |
| | | StatisticsPie statisticsPie = tbDykeInvestigationService.statisticsPie(statisticsParams); |
| | | return R.data(statisticsPie); |
| | | } |
| | | |
| | | } |
| | |
| | | import cn.gistack.sm.sjztmd.service.IAttResBaseService; |
| | | import cn.gistack.sm.sjztmd.service.ITbResGeneralInvestigationService; |
| | | import cn.gistack.sm.sjztmd.service.ITbResGeneralInvestigationStateService; |
| | | import cn.gistack.sm.sjztmd.statisticsVO.StatisticsParams; |
| | | import cn.gistack.sm.sjztmd.statisticsVO.StatisticsPie; |
| | | import cn.gistack.sm.sjztmd.vo.AttResBaseGeneralInvestigationVO; |
| | | import cn.gistack.sm.sjztmd.vo.TbResGeneralInvestigationParam; |
| | | import cn.gistack.sm.sjztmd.wrapper.AttResBaseWrapper; |
| | |
| | | return R.data(list); |
| | | } |
| | | |
| | | |
| | | |
| | | @GetMapping("/statisticsPie") |
| | | public R statisticsPie(StatisticsParams statisticsParams){ |
| | | StatisticsPie statisticsPie = tbResGeneralInvestigationService.statisticsPie(statisticsParams); |
| | | return R.data(statisticsPie); |
| | | } |
| | | |
| | | } |
| | |
| | | |
| | | <select id="selectAttResBaseGeneralInvestigation" |
| | | resultType="cn.gistack.sm.sjztmd.vo.AttResBaseGeneralInvestigationVO"> |
| | | |
| | | SELECT base.* from ( |
| | | select |
| | | a.*, |
| | | b."check_state" AS tb_state, |
| | | b."guid" as tbStateId, |
| | | b."tb_year", |
| | | b."tb_quarter", |
| | | (CASE WHEN tmp.totalDangerNum>0 THEN true ELSE false END) as hasDanger, |
| | | tmp.totalDangerNum, |
| | | tmp.termiteNum, |
| | | tmp.otherNum |
| | | a.*, |
| | | b."check_state" AS tb_state, |
| | | b."guid" as tbStateId, |
| | | b."tb_year", |
| | | b."tb_quarter", |
| | | (CASE WHEN tmp.totalDangerNum>0 THEN 1 ELSE 2 END) as hasDanger, |
| | | tmp.totalDangerNum, |
| | | tmp.termiteNum, |
| | | tmp.otherNum |
| | | from sjzt_md."att_res_base" a |
| | | left join "SJZT_MD"."att_ad_base" aab on aab."guid" = a."interior_ad_guid" |
| | | left join "SJZT_MD"."att_ad_base" aa on aab."p_ad_code" = aa."ad_code" |
| | |
| | | left join |
| | | |
| | | ( |
| | | SELECT TRGI."tb_state_id",TRGI."res_guid", |
| | | SELECT TRGI."tb_state_id",TRGI."res_guid", |
| | | |
| | | SUM(CASE WHEN (trgi."hazard_rating" != '无危害') THEN 1 ELSE 0 END) AS totalDangerNum, |
| | | SUM(CASE WHEN (trgi."investigation_variety" = '白蚁' and trgi."hazard_rating" != '无危害') THEN 1 ELSE 0 END) AS termiteNum, |
| | | SUM(CASE WHEN (trgi."investigation_variety" != '白蚁' and trgi."hazard_rating" != '无危害') THEN 1 ELSE 0 END) AS otherNum |
| | | from sjzt_md."tb_res_general_investigation" trgi |
| | | where 1=1 |
| | | <if test="attResBase.tbYear !=null and attResBase.tbYear !=''"> |
| | | AND TRGI."tb_year" = #{attResBase.tbYear} |
| | | </if> |
| | | group by TRGI."tb_state_id",TRGI."res_guid" |
| | | SUM(CASE WHEN (trgi."hazard_rating" != '无危害') THEN 1 ELSE 0 END) AS totalDangerNum, |
| | | SUM(CASE WHEN (trgi."investigation_variety" = '白蚁' and trgi."hazard_rating" != '无危害') THEN 1 ELSE 0 END) AS termiteNum, |
| | | SUM(CASE WHEN (trgi."investigation_variety" != '白蚁' and trgi."hazard_rating" != '无危害') THEN 1 ELSE 0 END) AS otherNum |
| | | from sjzt_md."tb_res_general_investigation" trgi |
| | | where 1=1 |
| | | <if test="attResBase.tbYear !=null and attResBase.tbYear !=''"> |
| | | AND TRGI."tb_year" = #{attResBase.tbYear} |
| | | </if> |
| | | group by TRGI."tb_state_id",TRGI."res_guid" |
| | | |
| | | ) tmp on tmp."tb_state_id" = b."guid" |
| | | |
| | |
| | | and (aab."ad_code" = #{attResBase.adCode} or aa."ad_code" = #{attResBase.adCode} or ab."ad_code" = |
| | | #{attResBase.adCode} or ac."ad_code" = #{attResBase.adCode}) |
| | | </if> |
| | | ) base where 1=1 |
| | | <if test="attResBase.hasDanger != null and attResBase.hasDanger != '' "> |
| | | and base.hasDanger = #{attResBase.hasDanger} |
| | | </if> |
| | | |
| | | |
| | | </select> |
| | | |
| | | <select id="getListByRegion" resultType="cn.gistack.sm.sjztmd.entity.AttResBase"> |
| | |
| | | |
| | | import cn.gistack.sm.sjztmd.entity.TbDykeInvestigation; |
| | | import cn.gistack.sm.sjztmd.entity.TbResGeneralInvestigation; |
| | | import cn.gistack.sm.sjztmd.statisticsVO.StatisticsParams; |
| | | import cn.gistack.sm.sjztmd.statisticsVO.StatisticsPie; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | |
| | | /** |
| | |
| | | public interface TbDykeInvestigationMapper extends BaseMapper<TbDykeInvestigation> { |
| | | |
| | | |
| | | StatisticsPie statisticsPie(@Param("params") StatisticsParams statisticsParams); |
| | | } |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="cn.gistack.sm.sjztmd.mapper.TbDykeInvestigationMapper"> |
| | | <!--namespace根据自己需要创建的的mapper的路径和名称填写--> |
| | | <select id="statisticsPie" resultType="cn.gistack.sm.sjztmd.statisticsVO.StatisticsPie"> |
| | | SELECT |
| | | tempNum.totalNum, |
| | | tempNum.finishNum, |
| | | tempNum.totalNum-tempNum.finishNum as unFinishNum |
| | | FROM( |
| | | |
| | | SELECT |
| | | COUNT(*) totalNum, |
| | | SUM(CASE WHEN tdis."check_state" = 2 THEN 1 ELSE 0 END) as finishNum |
| | | from |
| | | SJZT_MD."tb_res_dyke" trd |
| | | LEFT JOIN SJZT_MD."tb_dyke_investigation_state" tdis ON tdis."dyke_guid" = trd."guid" |
| | | <if test="params.tbYear != null and params.tbYear !=''"> |
| | | AND tdis."tb_year" = #{params.tbYear} |
| | | </if> |
| | | LEFT JOIN YWXT."att_ad_base" aab ON aab."ad_code" = trd."ad_code" |
| | | WHERE |
| | | 1=1 |
| | | <if test="params.adCode != null and params.adCode !=''"> |
| | | and trd."ad_code" LIKE #{params.adCode} |
| | | </if> |
| | | ) tempNum |
| | | |
| | | </select> |
| | | </mapper> |
| | |
| | | <!-- 堤防普查列表 --> |
| | | <select id="findTbResDykePcBy" |
| | | resultType="cn.gistack.sm.sjztmd.vo.TbResDykeVO"> |
| | | |
| | | SELECT base.* from ( |
| | | |
| | | select |
| | | DISTINCT |
| | | trd.*, |
| | | tdis."check_state" AS tb_state, |
| | | tdis."guid" as tbStateId, |
| | | aa."p_ad_code" as pAdCode, |
| | | aa."p_ad_name" as pAdName, |
| | | |
| | | (CASE WHEN tmp.totalDangerNum>0 THEN true ELSE false END) as hasDanger, |
| | | (CASE WHEN tmp.totalDangerNum>0 THEN 1 ELSE 2 END) as hasDanger, |
| | | |
| | | tmp.totalDangerNum, |
| | | tmp.termiteNum, |
| | |
| | | |
| | | ( |
| | | select |
| | | temp2."tb_state_id", |
| | | temp2."dyke_guid", |
| | | temp2.totalDangerNum, |
| | | temp2.termiteNum, |
| | | temp2.otherNum, |
| | | SUM(CASE WHEN temp2.dangerLength THEN temp2.dangerLength ELSE 0 END) AS totalDangerLength |
| | | temp2."tb_state_id", |
| | | temp2."dyke_guid", |
| | | temp2.totalDangerNum, |
| | | temp2.termiteNum, |
| | | temp2.otherNum, |
| | | SUM(CASE WHEN temp2.dangerLength THEN temp2.dangerLength ELSE 0 END) AS totalDangerLength |
| | | from( |
| | | SELECT |
| | | TEMP1.*, |
| | | TEMP1.dangerLength/temp1.num |
| | | FROM ( |
| | | SELECT tdi."tb_state_id",tdi."dyke_guid",tdi."stake_mark", |
| | | count(*) as num, |
| | | SUM(CASE WHEN (tdi."danger_length") THEN tdi."danger_length" ELSE 0 END) AS dangerLength, |
| | | SUM(CASE WHEN (tdi."hazard_rating" != '无危害') THEN 1 ELSE 0 END) AS totalDangerNum, |
| | | SUM(CASE WHEN (tdi."investigation_variety" = '白蚁' and tdi."hazard_rating" != '无危害') THEN 1 ELSE 0 END) AS termiteNum, |
| | | SUM(CASE WHEN (tdi."investigation_variety" != '白蚁' and tdi."hazard_rating" != '无危害') THEN 1 ELSE 0 END) AS otherNum |
| | | from sjzt_md."tb_dyke_investigation" tdi |
| | | where 1=1 |
| | | <if test="vo.tbYear !=null and vo.tbYear !=''"> |
| | | AND tdi."tb_year" = #{vo.tbYear} |
| | | </if> |
| | | group by tdi."tb_state_id",tdi."dyke_guid",tdi."stake_mark" |
| | | )TEMP1 |
| | | SELECT |
| | | TEMP1.*, |
| | | TEMP1.dangerLength/temp1.num |
| | | FROM ( |
| | | SELECT tdi."tb_state_id",tdi."dyke_guid",tdi."stake_mark", |
| | | count(*) as num, |
| | | SUM(CASE WHEN (tdi."danger_length") THEN tdi."danger_length" ELSE 0 END) AS dangerLength, |
| | | SUM(CASE WHEN (tdi."hazard_rating" != '无危害') THEN 1 ELSE 0 END) AS totalDangerNum, |
| | | SUM(CASE WHEN (tdi."investigation_variety" = '白蚁' and tdi."hazard_rating" != '无危害') THEN 1 ELSE 0 END) AS termiteNum, |
| | | SUM(CASE WHEN (tdi."investigation_variety" != '白蚁' and tdi."hazard_rating" != '无危害') THEN 1 ELSE 0 END) AS otherNum |
| | | from sjzt_md."tb_dyke_investigation" tdi |
| | | where 1=1 |
| | | <if test="vo.tbYear !=null and vo.tbYear !=''"> |
| | | AND tdi."tb_year" = #{vo.tbYear} |
| | | </if> |
| | | group by tdi."tb_state_id",tdi."dyke_guid",tdi."stake_mark" |
| | | )TEMP1 |
| | | )temp2 group by |
| | | temp2."tb_state_id", |
| | | temp2."dyke_guid", |
| | | temp2.totalDangerNum, |
| | | temp2.termiteNum, |
| | | temp2.otherNum |
| | | temp2."tb_state_id", |
| | | temp2."dyke_guid", |
| | | temp2.totalDangerNum, |
| | | temp2.termiteNum, |
| | | temp2.otherNum |
| | | |
| | | ) tmp on tmp."tb_state_id" = tdis."guid" |
| | | where 1 = 1 |
| | |
| | | <if test="vo.adCode != null and vo.adCode != '' "> |
| | | and trd."ad_code" LIKE #{vo.adCode} |
| | | </if> |
| | | ) base where 1=1 |
| | | <if test="vo.hasDanger != null and vo.hasDanger != '' "> |
| | | and base.hasDanger = #{vo.hasDanger} |
| | | </if> |
| | | |
| | | |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | import cn.gistack.sm.sjztmd.entity.TbAttResBase; |
| | | import cn.gistack.sm.sjztmd.entity.TbResGeneralInvestigation; |
| | | import cn.gistack.sm.sjztmd.statisticsVO.StatisticsParams; |
| | | import cn.gistack.sm.sjztmd.statisticsVO.StatisticsPie; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import java.util.List; |
| | | |
| | | |
| | | /** |
| | |
| | | public interface TbResGeneralInvestigationMapper extends BaseMapper<TbResGeneralInvestigation> { |
| | | |
| | | |
| | | StatisticsPie statisticsPie(@Param("params") StatisticsParams statisticsParams); |
| | | } |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="cn.gistack.sm.sjztmd.mapper.TbResGeneralInvestigationMapper"> |
| | | <!--namespace根据自己需要创建的的mapper的路径和名称填写--> |
| | | <select id="statisticsPie" resultType="cn.gistack.sm.sjztmd.statisticsVO.StatisticsPie"> |
| | | |
| | | SELECT |
| | | tempNum.totalNum, |
| | | tempNum.finishNum, |
| | | tempNum.totalNum-tempNum.finishNum as unFinishNum |
| | | FROM( |
| | | |
| | | SELECT |
| | | COUNT(*) totalNum, |
| | | SUM(CASE WHEN trgis."check_state" = 2 THEN 1 ELSE 0 END) as finishNum |
| | | from |
| | | SJZT_MD."att_res_base" arb |
| | | LEFT JOIN SJZT_MD."tb_res_general_investigation_state" trgis ON trgis."res_guid" = arb."guid" |
| | | <if test="params.tbYear != null and params.tbYear !=''"> |
| | | AND trgis."tb_year" = #{params.tbYear} |
| | | </if> |
| | | |
| | | LEFT JOIN YWXT."att_ad_base" town ON town."ad_code" = arb."interior_ad_guid" |
| | | LEFT JOIN YWXT."att_ad_base" county ON county."ad_code" = town."p_ad_code" |
| | | LEFT JOIN YWXT."att_ad_base" city ON city."ad_code" = county."p_ad_code" |
| | | LEFT JOIN YWXT."att_ad_base" province ON province."ad_code" = city."p_ad_code" |
| | | |
| | | WHERE 1=1 |
| | | <if test="params.adCode != null and params.adCode !=''"> |
| | | AND CONCAT(province."ad_code",city."ad_code",county."ad_code",town."ad_code") LIKE CONCAT('%',#{params.adCode},'%') |
| | | </if> |
| | | |
| | | ) tempNum |
| | | |
| | | |
| | | </select> |
| | | </mapper> |
| | |
| | | |
| | | import cn.gistack.sm.sjztmd.entity.TbDykeInvestigation; |
| | | import cn.gistack.sm.sjztmd.entity.TbResGeneralInvestigation; |
| | | import cn.gistack.sm.sjztmd.statisticsVO.StatisticsParams; |
| | | import cn.gistack.sm.sjztmd.statisticsVO.StatisticsPie; |
| | | import cn.gistack.sm.sjztmd.vo.TbDykeInvestigationParam; |
| | | import cn.gistack.sm.sjztmd.vo.TbResGeneralInvestigationParam; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springblade.core.tool.api.R; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * @PROJECT_NAME: skjcmanager |
| | |
| | | * @return |
| | | */ |
| | | R saveOrUpdateByBatch(TbDykeInvestigationParam tbDykeInvestigationParam); |
| | | |
| | | /** |
| | | * 堤防普查饼图统计数据 |
| | | * @param statisticsParams |
| | | * @return |
| | | */ |
| | | StatisticsPie statisticsPie(StatisticsParams statisticsParams); |
| | | } |
| | |
| | | package cn.gistack.sm.sjztmd.service; |
| | | |
| | | import cn.gistack.sm.sjztmd.entity.TbResGeneralInvestigation; |
| | | import cn.gistack.sm.sjztmd.statisticsVO.StatisticsParams; |
| | | import cn.gistack.sm.sjztmd.statisticsVO.StatisticsPie; |
| | | import cn.gistack.sm.sjztmd.vo.TbResGeneralInvestigationParam; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import org.springblade.core.tool.api.R; |
| | |
| | | * @return |
| | | */ |
| | | R saveOrUpdateByBatch(TbResGeneralInvestigationParam tbResGeneralInvestigationParam); |
| | | |
| | | /** |
| | | * 获取水库白蚁普查饼图统计数据 |
| | | * @param statisticsParams |
| | | * @return |
| | | */ |
| | | StatisticsPie statisticsPie(StatisticsParams statisticsParams); |
| | | } |
| | |
| | | import cn.gistack.sm.sjztmd.mapper.TbDykeInvestigationMapper; |
| | | import cn.gistack.sm.sjztmd.mapper.TbResGeneralInvestigationMapper; |
| | | import cn.gistack.sm.sjztmd.service.*; |
| | | import cn.gistack.sm.sjztmd.statisticsVO.StatisticsParams; |
| | | import cn.gistack.sm.sjztmd.statisticsVO.StatisticsPie; |
| | | import cn.gistack.sm.sjztmd.vo.TbDykeInvestigationParam; |
| | | import cn.gistack.sm.sjztmd.vo.TbResGeneralInvestigationParam; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | |
| | | import org.springblade.core.secure.utils.AuthUtil; |
| | | import org.springblade.core.tool.api.R; |
| | | import org.springblade.core.tool.utils.DateUtil; |
| | | import org.springblade.core.tool.utils.StringUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public StatisticsPie statisticsPie(StatisticsParams statisticsParams) { |
| | | if (StringUtil.isNotBlank(statisticsParams.getAdCode())){ |
| | | //若行政区划不为空 |
| | | String adCode =statisticsParams.getAdCode(); |
| | | |
| | | if (adCode.substring(0,4).indexOf("00") > -1) { |
| | | //前四位包含00说明是湖北省 4200/00000000 |
| | | adCode =StringUtil.format("%{}%",adCode.substring(0,2)); |
| | | } else if (adCode.substring(0,6).indexOf("00") > -1) { |
| | | //前六位包含00说明是市级 420100/000000 |
| | | // adCode = paramAd.substring(0,4); |
| | | adCode =StringUtil.format("%{}%",adCode.substring(0,4)); |
| | | }else if (adCode.substring(0,8).indexOf("00") > -1){ |
| | | //前8位包含00 说明是区级 42011700/0000 |
| | | // adCode = paramAd.substring(0,6); |
| | | adCode =StringUtil.format("%{}%",adCode.substring(0,6)); |
| | | } |
| | | statisticsParams.setAdCode(adCode); |
| | | } |
| | | |
| | | return baseMapper.statisticsPie(statisticsParams); |
| | | } |
| | | |
| | | } |
| | |
| | | import cn.gistack.sm.sjztmd.mapper.TbResGeneralInvestigationMapper; |
| | | import cn.gistack.sm.sjztmd.service.ITbResGeneralInvestigationService; |
| | | import cn.gistack.sm.sjztmd.service.ITbResGeneralInvestigationStateService; |
| | | import cn.gistack.sm.sjztmd.statisticsVO.StatisticsParams; |
| | | import cn.gistack.sm.sjztmd.statisticsVO.StatisticsPie; |
| | | import cn.gistack.sm.sjztmd.vo.TbResGeneralInvestigationParam; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | |
| | | } |
| | | return R.status(saveOrUpdateBatch(list)); |
| | | } |
| | | |
| | | @Override |
| | | public StatisticsPie statisticsPie(StatisticsParams statisticsParams) { |
| | | return baseMapper.statisticsPie(statisticsParams); |
| | | } |
| | | } |
| New file |
| | |
| | | package cn.gistack.sm.sjztmd.statisticsVO; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 普查统计柱状图 |
| | | */ |
| | | @Data |
| | | public class StatisticsBar { |
| | | |
| | | //水库名或是行政区划名 |
| | | private String name; |
| | | |
| | | //水库编码或是行政区划编码 |
| | | private String code; |
| | | |
| | | //水库总数 |
| | | private int resNum; |
| | | |
| | | //白蚁危害处数 |
| | | private int termiteNum; |
| | | |
| | | //其他危害处数 |
| | | private int otherNum; |
| | | |
| | | //堤防总公里数 |
| | | private double dykeLength; |
| | | |
| | | //白蚁公里数 |
| | | private double termiteLength; |
| | | |
| | | } |
| New file |
| | |
| | | package cn.gistack.sm.sjztmd.statisticsVO; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 统计数据参数 |
| | | */ |
| | | @Data |
| | | public class StatisticsParams { |
| | | //行政区划code |
| | | private String adCode; |
| | | |
| | | //填报年份 |
| | | private Integer tbYear; |
| | | |
| | | |
| | | } |
| New file |
| | |
| | | package cn.gistack.sm.sjztmd.statisticsVO; |
| | | |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 普查统计饼图 |
| | | */ |
| | | @Data |
| | | public class StatisticsPie { |
| | | |
| | | private int totalNum; |
| | | |
| | | //已完成数量 |
| | | private int finishNum; |
| | | |
| | | //未完成数量 |
| | | private int unFinishNum; |
| | | |
| | | |
| | | } |
| | |
| | | //三级危害普查长度 |
| | | private double thirdLength; |
| | | |
| | | private boolean hasDanger; |
| | | private String hasDanger; |
| | | |
| | | //危害总处数 |
| | | private int totalDangerNum; |
| | |
| | | |
| | | private String tbStateId; |
| | | |
| | | private boolean hasDanger; |
| | | private String hasDanger; |
| | | } |