2 Revize ab6746d10e ... 40011564b3

Autor SHA1 Zpráva Datum
  Wayne 40011564b3 Merge branch 'master' of http://8.137.121.180:10880/longping/subject_gxj před 4 měsíci
  Wayne ae0ed824a5 统计分析页面 před 4 měsíci
15 změnil soubory, kde provedl 515 přidání a 769 odebrání
  1. 5 0
      projects-service/src/main/java/com/rtrh/projects/modules/projects/mapper/StaticsMapper.java
  2. 58 0
      projects-service/src/main/java/com/rtrh/projects/modules/projects/mapper/StaticsMapper.xml
  3. 2 0
      projects-service/src/main/java/com/rtrh/projects/modules/projects/mapper/SubInduMapper.java
  4. 12 0
      projects-service/src/main/java/com/rtrh/projects/modules/projects/mapper/SubInduMapper.xml
  5. 9 0
      projects-service/src/main/java/com/rtrh/projects/modules/projects/service/StaticsService.java
  6. 252 11
      projects-service/src/main/java/com/rtrh/projects/modules/projects/service/impl/StaticsServiceImpl.java
  7. 24 0
      projects-service/src/main/java/com/rtrh/projects/modules/projects/vo/SubInfoTjfxDataVo.java
  8. 18 0
      projects-service/src/main/java/com/rtrh/projects/modules/projects/vo/SubInfoTjfxTableVo.java
  9. 38 0
      projects-service/src/main/java/com/rtrh/projects/modules/projects/vo/SubInfoTjfxVo.java
  10. 7 0
      projects-service/src/main/java/com/rtrh/projects/modules/system/service/ISubInduService.java
  11. 5 0
      projects-service/src/main/java/com/rtrh/projects/modules/system/service/impl/SubInduServiceImpl.java
  12. 7 2
      projects/src/main/java/com/rtrh/projects/web/controller/projects/TjFxController.java
  13. 19 2
      projects/src/main/java/com/rtrh/projects/web/controller/projects/api/TzfxApiController.java
  14. 2 2
      projects/src/main/webapp/vmodules/leftMenu.jsp
  15. 57 752
      projects/src/main/webapp/vmodules/tjfx/index2.jsp

+ 5 - 0
projects-service/src/main/java/com/rtrh/projects/modules/projects/mapper/StaticsMapper.java

@@ -6,6 +6,7 @@ import java.util.Map;
 
 import com.rtrh.projects.modules.projects.vo.HistoryVO;
 import com.rtrh.projects.modules.projects.vo.NewTouzVO;
+import com.rtrh.projects.modules.projects.vo.SubInfoTjfxDataVo;
 import org.apache.ibatis.annotations.Param;
 
 import com.rtrh.core.repository.mybatis.MyBatisRepository;
@@ -311,4 +312,8 @@ public interface StaticsMapper {
 	 */
 	Map<String, Object> tzTongjiQt(@Param("key")String key, @Param("subjectId")String subjectId, @Param("indusKind")String indusKind, @Param("propKind")String propKind, @Param("kindNature")String kindNature,
 			@Param("loginName")String loginName, @Param("year")String year, @Param("month")String month, @Param("isgt")String isgt);
+
+	List<SubInfoTjfxDataVo> getTjfxData(@Param("year") String year, @Param("startMoney") Integer startMoney, @Param("endMoney") Integer endMoney, @Param("subjectIds") List<String> subjectIds, @Param("codeList") List<String> codeList, @Param("propKinds") List<String> propKinds);
+
+	List<SubInfoTjfxDataVo> getTjfxYearMoneyBySubIds(@Param("idList") List<String> idList, @Param("year") String year);
 }

+ 58 - 0
projects-service/src/main/java/com/rtrh/projects/modules/projects/mapper/StaticsMapper.xml

@@ -104,4 +104,62 @@
 		call total_tj_2new_qt(#{key},#{subjectId},#{indusKind},#{propKind},#{kindNature},#{loginName},#{year},#{month},#{isgt})
 	</select>
 
+	<select id="getTjfxData" resultType="com.rtrh.projects.modules.projects.vo.SubInfoTjfxDataVo">
+		SELECT
+		id,
+		status,
+		amt_total AS amtTotal,
+		subject_id AS subjectId,
+		indus_kind AS indusKind
+		FROM
+		sub_info a
+		WHERE
+		logic_delete_flag = 0
+
+		<if test="startMoney != null">
+			AND a.amt_total &gt;= #{startMoney}
+		</if>
+
+		<if test="endMoney != null">
+			AND a.amt_total &lt;= #{endMoney}
+		</if>
+
+		<if test="subjectIds != null and subjectIds.size() &gt; 0">
+			AND a.subject_id IN
+			<foreach collection="subjectIds" item="item" separator="," open="(" close=")">
+				#{item}
+			</foreach>
+		</if>
+
+		<if test="codeList != null and codeList.size() &gt; 0">
+			AND a.indus_kind IN
+			<foreach collection="codeList" item="item" separator="," open="(" close=")">
+				#{item}
+			</foreach>
+		</if>
+
+		<if test="propKinds != null and propKinds.size() &gt; 0">
+			AND a.status IN
+			<foreach collection="propKinds" item="item" separator="," open="(" close=")">
+				#{item}
+			</foreach>
+		</if>
+	</select>
+	<select id="getTjfxYearMoneyBySubIds" resultType="com.rtrh.projects.modules.projects.vo.SubInfoTjfxDataVo">
+		SELECT
+		sub_id AS id,
+		SUM(amt) AS amt
+		FROM
+		sub_amtplan
+		WHERE
+		logic_delete_flag = 0
+		AND sub_id IN
+		<foreach collection="idList" item="item" separator="," open="(" close=")">
+			#{item}
+		</foreach>
+		AND y_month like concat(#{year}, '%')
+		GROUP BY
+		sub_id
+	</select>
+
 </mapper>

+ 2 - 0
projects-service/src/main/java/com/rtrh/projects/modules/projects/mapper/SubInduMapper.java

@@ -33,4 +33,6 @@ public interface SubInduMapper {
     List<SubIndu> selectAllSubIndu();
 
     List<String> getChildrenCodesByCode(@Param("indusKinds") String indusKinds);
+
+    List<String> selectChildrenCodesByCode(@Param("indusKinds") List<String> indusKinds);
 }

+ 12 - 0
projects-service/src/main/java/com/rtrh/projects/modules/projects/mapper/SubInduMapper.xml

@@ -66,4 +66,16 @@
             a.code = #{indusKinds}
                 AND a.logic_delete_flag = 0;
     </select>
+    <select id="selectChildrenCodesByCode" resultType="java.lang.String">
+        SELECT
+            b.code as code
+        FROM
+            sub_indu a left join  sub_indu b on a.id = b.last_id
+        WHERE
+            a.code in
+            <foreach collection="indusKinds" item="indusKind" open="(" separator="," close=")">
+                #{indusKind}
+            </foreach>
+                AND a.logic_delete_flag = 0;
+    </select>
 </mapper>

+ 9 - 0
projects-service/src/main/java/com/rtrh/projects/modules/projects/service/StaticsService.java

@@ -6,6 +6,9 @@ import java.util.Map;
 
 import com.rtrh.projects.modules.outApi.vo.StaticsQueryVO;
 import com.rtrh.projects.modules.projects.vo.NewTouzVO;
+import com.rtrh.projects.modules.projects.vo.SubInfoTjfxDataVo;
+import com.rtrh.projects.modules.projects.vo.SubInfoTjfxVo;
+import com.rtrh.projects.modules.projects.vo.TzfxDataQueryVO;
 import com.rtrh.projects.modules.system.vo.LoginUserVO;
 
 public interface StaticsService {
@@ -334,4 +337,10 @@ public interface StaticsService {
 	 Map<String, Object> FindMonthRpt(String month) throws Exception;
 
 
+	/**
+	 * 获取统计分析页面数据
+	 * @param queryVO
+	 * @return
+	 */
+	SubInfoTjfxVo getTjfxData(TzfxDataQueryVO queryVO);
 }

+ 252 - 11
projects-service/src/main/java/com/rtrh/projects/modules/projects/service/impl/StaticsServiceImpl.java

@@ -5,20 +5,16 @@ import java.io.InputStreamReader;
 import java.math.BigDecimal;
 import java.math.BigInteger;
 import java.math.RoundingMode;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Optional;
+import java.util.*;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.function.ToDoubleFunction;
 import java.util.stream.Collectors;
 
+import com.alibaba.excel.util.StringUtils;
+import com.rtrh.projects.modules.projects.po.SubIndu;
+import com.rtrh.projects.modules.projects.vo.*;
+import com.rtrh.projects.modules.system.service.ISubInduService;
 import com.rtrh.projects.modules.utils.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -31,8 +27,6 @@ import com.rtrh.projects.modules.projects.dao.SubInfoDao;
 import com.rtrh.projects.modules.projects.enums.ProjectStatusEnum;
 import com.rtrh.projects.modules.projects.mapper.StaticsMapper;
 import com.rtrh.projects.modules.projects.service.StaticsService;
-import com.rtrh.projects.modules.projects.vo.HistoryVO;
-import com.rtrh.projects.modules.projects.vo.NewTouzVO;
 import com.rtrh.projects.modules.projects.vo.report.ReportVO;
 import com.rtrh.projects.modules.projects.vo.report.StaticsAmtDataVO;
 import com.rtrh.projects.modules.system.enums.SysTableKind;
@@ -57,6 +51,8 @@ public class StaticsServiceImpl implements StaticsService {
     private SubInfoDao subInfoDao;
     @Autowired
     private TSysTableService tSysTableService;
+    @Autowired
+    private ISubInduService subInduService;
 
     @Override
     public List<Map<String, Object>> HYFL(String year, String type, String orderNum, String kind, String loginName,
@@ -982,4 +978,249 @@ public class StaticsServiceImpl implements StaticsService {
         List<Map<String, Object>> list = (List<Map<String, Object>>)subInfoDao.queryForObjListBySql(sql.toString());
         return CollectionUtil.isNotEmpty(list) ? list.get(0) : new HashMap<>();
     }
+
+    @Override
+    public SubInfoTjfxVo getTjfxData(TzfxDataQueryVO queryVO) {
+
+
+        Integer startMoney = null;
+        Integer endMoney = null;
+        //判断是否有规模搜索条件
+        if (StringUtils.isNotBlank(queryVO.getKey())) {
+            //金额100亿以上,数据库单位是万元
+            if ("1".equals(queryVO.getKey())){
+                startMoney = 1000000;
+            }else if ("2".equals(queryVO.getKey())){
+                //金额50-100亿元
+                startMoney = 500000;
+                endMoney = 1000000;
+            }else if ("3".equals(queryVO.getKey())){
+                //金额10-50亿元
+                startMoney = 100000;
+                endMoney = 500000;
+            }else if ("4".equals(queryVO.getKey())){
+                //10亿元一下
+                endMoney = 100000;
+            }
+
+        }
+
+        //区域条件
+        List<String> subjectIds = new ArrayList<>();
+        if (StringUtils.isNotBlank(queryVO.getSubjectId())){
+            subjectIds = Arrays.asList(queryVO.getSubjectId().split(","));
+        }
+
+        //行业条件
+        List<String> codeList = new ArrayList<>();
+        if (StringUtils.isNotBlank(queryVO.getIndusKind())){
+            //因为行业都是父行业,所以需要根据父行业查询所有子行业code
+            List<String> indusKinds = Arrays.asList(queryVO.getIndusKind().split(","));
+            codeList = subInduService.selectChildrenCodesByCode(indusKinds);
+        }
+
+        //获取行业信息
+        List<SubIndu> subInduList = subInduService.selectAllSubIndu();
+
+        //性质条件
+        List<String> propKinds = new ArrayList<>();
+        if (StringUtils.isNotBlank(queryVO.getPropKind())){
+            propKinds = Arrays.asList(queryVO.getPropKind().split(","));
+        }
+
+        List<SubInfoTjfxDataVo> dataList = staticsMapper.getTjfxData(queryVO.getYear(), startMoney, endMoney, subjectIds, codeList, propKinds);
+
+        //最终返回数据
+        SubInfoTjfxVo subInfoTjfxVo = new SubInfoTjfxVo(0, 0, 0, 0, 0, BigDecimal.ZERO, BigDecimal.ZERO, BigDecimal.ZERO, new ArrayList<>(), new ArrayList<>(), new ArrayList<>());
+
+        if (CollectionUtil.isNotEmpty(dataList)){
+            //收集dataList集合中的id为集合
+            List<String> idList = dataList.stream().map(SubInfoTjfxDataVo::getId).collect(Collectors.toList());
+            //查询这些项目年度金额是多少钱
+            List<SubInfoTjfxDataVo> yearMoneyList = staticsMapper.getTjfxYearMoneyBySubIds(idList, queryVO.getYear());
+            //查询这些项目上一年度金额是多少钱
+            List<SubInfoTjfxDataVo> lastYearMoneyList = staticsMapper.getTjfxYearMoneyBySubIds(idList, String.valueOf(Integer.parseInt(queryVO.getYear()) - 1));
+
+            //将yearMoneyList变为map,key=id,value=amt
+            Map<String, BigDecimal> yearMoneyMap = yearMoneyList.stream()
+                    .filter(item -> item.getAmt() != null)  // 过滤掉 amt 为 null 的项
+                    .collect(Collectors.toMap(SubInfoTjfxDataVo::getId, SubInfoTjfxDataVo::getAmt));
+
+            //将lastYearMoneyList变为map,key=id,value=amt
+            Map<String, BigDecimal> lastYearMoneyMap = lastYearMoneyList.stream()
+                    .filter(item -> item.getAmt() != null)  // 过滤掉 amt 为 null 的项
+                    .collect(Collectors.toMap(SubInfoTjfxDataVo::getId, SubInfoTjfxDataVo::getAmt));
+
+            for (SubInfoTjfxDataVo data : dataList) {
+                if (yearMoneyMap.containsKey(data.getId())){
+                    if (yearMoneyMap.get(data.getId()) != null){
+                        data.setAmt(yearMoneyMap.get(data.getId()));
+                    }else {
+                        data.setAmt(BigDecimal.ZERO);
+                    }
+                }else {
+                    data.setAmt(BigDecimal.ZERO);
+                }
+
+                if (lastYearMoneyMap.containsKey(data.getId())){
+                    if (lastYearMoneyMap.get(data.getId()) != null){
+                        data.setLastAmt(lastYearMoneyMap.get(data.getId()));
+                    }else {
+                        data.setLastAmt(BigDecimal.ZERO);
+                    }
+                }else {
+                    data.setLastAmt(BigDecimal.ZERO);
+                }
+
+                if (StringUtil.isEmpty(data.getIndusKind())){
+                    data.setIndusKind("未知行业");
+                }else {
+                    //将二级行业code设置为一级行业id
+                    Map<String, String> hyMap = subInduList.stream().filter(item -> item.getParentTitle() != null).collect(Collectors.toMap(SubIndu::getCode, SubIndu::getParentTitle));
+                    data.setIndusKind(hyMap.getOrDefault(data.getIndusKind(), "未知行业"));
+                }
+            }
+
+            subInfoTjfxVo.setTotalNumber(dataList.size());
+            //找到dataList中status=1的个数
+            long cbNumber = dataList.stream().filter(data -> "1".equals(data.getStatus())).count();
+            subInfoTjfxVo.setCbNumber((int) cbNumber);
+            //找到dataList中status=2的个数
+            long xjNumber = dataList.stream().filter(data -> "2".equals(data.getStatus())).count();
+            subInfoTjfxVo.setXjNumber((int) xjNumber);
+            //找到dataList中status=3的个数
+            long zjNumber = dataList.stream().filter(data -> "3".equals(data.getStatus())).count();
+            subInfoTjfxVo.setZjNumber((int) zjNumber);
+            //找到dataList中status=9的个数
+            long tcNumber = dataList.stream().filter(data -> "9".equals(data.getStatus())).count();
+            subInfoTjfxVo.setTcNumber((int) tcNumber);
+            //计算出所有金额,由万元转换为亿元为单位
+            subInfoTjfxVo.setAmtTotal(
+                    dataList.stream()
+                            .map(item -> Optional.ofNullable(item.getAmtTotal()).orElse(BigDecimal.ZERO))  // 处理 null 值,替换为 BigDecimal.ZERO
+                            .reduce(BigDecimal.ZERO, BigDecimal::add)
+                            .divide(new BigDecimal("10000"), 2, RoundingMode.HALF_UP)  // 除以 10000,保留两位小数
+            );
+            //计算出年度金额,由万元转换为亿元为单位
+            subInfoTjfxVo.setYearAmtTotal(
+                    dataList.stream()
+                            .map(item -> Optional.ofNullable(item.getAmt()).orElse(BigDecimal.ZERO))  // 处理 null 值,替换为 BigDecimal.ZERO
+                            .reduce(BigDecimal.ZERO, BigDecimal::add)
+                            .divide(new BigDecimal("10000"), 2, RoundingMode.HALF_UP)  // 除以 10000,保留两位小数
+            );
+            //计算出上一个年度金额,由万元转换为亿元为单位
+            subInfoTjfxVo.setLastYearAmtTotal(
+                    dataList.stream()
+                            .map(item -> Optional.ofNullable(item.getLastAmt()).orElse(BigDecimal.ZERO))  // 处理 null 值,替换为 BigDecimal.ZERO
+                            .reduce(BigDecimal.ZERO, BigDecimal::add)
+                            .divide(new BigDecimal("10000"), 2, RoundingMode.HALF_UP)  // 除以 10000,保留两位小数
+            );
+
+            //区域占比数据
+            List<SubInfoTjfxTableVo> areaData = new ArrayList<>();
+            //获取地区信息
+            List<TSystable> areaList = tSysTableService.getByKind(SysTableKind.JSDD);
+            //将areaList转换为map,key=code,value=title
+            Map<String, String> areaMap = areaList.stream().collect(Collectors.toMap(TSystable::getCode, TSystable::getTitle));
+            //将dataList根据subjectId分组
+            Map<String, List<SubInfoTjfxDataVo>> subjectIdList = dataList.stream().collect(Collectors.groupingBy(SubInfoTjfxDataVo::getSubjectId));
+            for (Map.Entry<String, List<SubInfoTjfxDataVo>> entry : subjectIdList.entrySet()) {
+                SubInfoTjfxTableVo subInfoTjfxTableVo = new SubInfoTjfxTableVo();
+                //设置numbers为1开始的序号
+                subInfoTjfxTableVo.setNumbers(areaData.size() + 1);
+                subInfoTjfxTableVo.setKindDesc(areaMap.get(entry.getKey()));
+                subInfoTjfxTableVo.setAmtJh(entry.getValue().stream().map(SubInfoTjfxDataVo::getAmt).reduce(BigDecimal.ZERO, BigDecimal::add));
+                //进度占比=(年度金额/所有金额)*100
+                BigDecimal yearAmtTotal = subInfoTjfxVo.getYearAmtTotal();
+                if (yearAmtTotal.compareTo(BigDecimal.ZERO) != 0) {
+                    subInfoTjfxTableVo.setNumBZb(subInfoTjfxTableVo.getAmtJh().divide(new BigDecimal("10000"), 2, RoundingMode.HALF_UP).divide(yearAmtTotal, 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));
+                } else {
+                    subInfoTjfxTableVo.setNumBZb(BigDecimal.ZERO);
+                }
+                //上一年度进度占比=(上一年度金额/所有金额)*100
+                BigDecimal lastYearAmtTotal = subInfoTjfxVo.getLastYearAmtTotal();
+                subInfoTjfxTableVo.setLastAmtJh(entry.getValue().stream().map(SubInfoTjfxDataVo::getLastAmt).reduce(BigDecimal.ZERO, BigDecimal::add));
+                if (lastYearAmtTotal.compareTo(BigDecimal.ZERO) != 0) {
+                    //需要计算当前年度占比
+                    subInfoTjfxTableVo.setNumBl(subInfoTjfxTableVo.getNumBZb().subtract(subInfoTjfxTableVo.getLastAmtJh().divide(new BigDecimal("10000"), 2, RoundingMode.HALF_UP).divide(lastYearAmtTotal, 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"))));
+                } else {
+                    subInfoTjfxTableVo.setNumBl(subInfoTjfxTableVo.getNumBZb());
+                }
+                //同比增长 TODO
+                areaData.add(subInfoTjfxTableVo);
+            }
+
+            //行业占比数据
+            List<SubInfoTjfxTableVo> hyData = new ArrayList<>();
+            //将dataList根据indusKind分组
+            Map<String, List<SubInfoTjfxDataVo>> indusKindList = dataList.stream().collect(Collectors.groupingBy(SubInfoTjfxDataVo::getIndusKind));
+            for (Map.Entry<String, List<SubInfoTjfxDataVo>> entry : indusKindList.entrySet()) {
+                SubInfoTjfxTableVo subInfoTjfxTableVo = new SubInfoTjfxTableVo();
+                //设置numbers为1开始的序号
+                subInfoTjfxTableVo.setNumbers(hyData.size() + 1);
+                subInfoTjfxTableVo.setKindDesc(entry.getKey());
+                subInfoTjfxTableVo.setAmtJh(entry.getValue().stream().map(SubInfoTjfxDataVo::getAmt).reduce(BigDecimal.ZERO, BigDecimal::add));
+                //进度占比=(年度金额/所有金额)*100
+                BigDecimal yearAmtTotal = subInfoTjfxVo.getYearAmtTotal();
+                if (yearAmtTotal.compareTo(BigDecimal.ZERO) != 0) {
+                    subInfoTjfxTableVo.setNumBZb(subInfoTjfxTableVo.getAmtJh().divide(new BigDecimal("10000"), 2, RoundingMode.HALF_UP).divide(yearAmtTotal, 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));
+                } else {
+                    subInfoTjfxTableVo.setNumBZb(BigDecimal.ZERO);
+                }
+                //上一年度进度占比=(上一年度金额/所有金额)*100
+                BigDecimal lastYearAmtTotal = subInfoTjfxVo.getLastYearAmtTotal();
+                subInfoTjfxTableVo.setLastAmtJh(entry.getValue().stream().map(SubInfoTjfxDataVo::getLastAmt).reduce(BigDecimal.ZERO, BigDecimal::add));
+                if (lastYearAmtTotal.compareTo(BigDecimal.ZERO) != 0) {
+                    //需要计算当前年度占比
+                    subInfoTjfxTableVo.setNumBl(subInfoTjfxTableVo.getNumBZb().subtract(subInfoTjfxTableVo.getLastAmtJh().divide(new BigDecimal("10000"), 2, RoundingMode.HALF_UP).divide(lastYearAmtTotal, 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"))));
+                } else {
+                    subInfoTjfxTableVo.setNumBl(subInfoTjfxTableVo.getNumBZb());
+                }
+                //同比增长 TODO
+                hyData.add(subInfoTjfxTableVo);
+            }
+
+            //建设性质占比数据
+            List<SubInfoTjfxTableVo> jsData = new ArrayList<>();
+            //获取建设性质信息
+            List<TSystable> jsList = tSysTableService.getByKind(SysTableKind.JSXZ);
+            //将jsList转换为map,key=code,value=title
+            Map<String, String> jsMap = jsList.stream().collect(Collectors.toMap(TSystable::getCode, TSystable::getTitle));
+            //将dataList根据status分组
+            Map<String, List<SubInfoTjfxDataVo>> statusList = dataList.stream().collect(Collectors.groupingBy(SubInfoTjfxDataVo::getStatus));
+            for (Map.Entry<String, List<SubInfoTjfxDataVo>> entry : statusList.entrySet()) {
+                SubInfoTjfxTableVo subInfoTjfxTableVo = new SubInfoTjfxTableVo();
+                //设置numbers为1开始的序号
+                subInfoTjfxTableVo.setNumbers(jsData.size() + 1);
+                subInfoTjfxTableVo.setKindDesc(jsMap.get(entry.getKey()));
+                subInfoTjfxTableVo.setAmtJh(entry.getValue().stream().map(SubInfoTjfxDataVo::getAmt).reduce(BigDecimal.ZERO, BigDecimal::add));
+                //进度占比=(年度金额/所有金额)*100
+                BigDecimal yearAmtTotal = subInfoTjfxVo.getYearAmtTotal();
+                if (yearAmtTotal.compareTo(BigDecimal.ZERO) != 0) {
+                    subInfoTjfxTableVo.setNumBZb(subInfoTjfxTableVo.getAmtJh().divide(new BigDecimal("10000"), 2, RoundingMode.HALF_UP).divide(yearAmtTotal, 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100")));
+                } else {
+                    subInfoTjfxTableVo.setNumBZb(BigDecimal.ZERO);
+                }
+                //上一年度进度占比=(上一年度金额/所有金额)*100
+                BigDecimal lastYearAmtTotal = subInfoTjfxVo.getLastYearAmtTotal();
+                subInfoTjfxTableVo.setLastAmtJh(entry.getValue().stream().map(SubInfoTjfxDataVo::getLastAmt).reduce(BigDecimal.ZERO, BigDecimal::add));
+                if (lastYearAmtTotal.compareTo(BigDecimal.ZERO) != 0) {
+                    //需要计算当前年度占比
+                    subInfoTjfxTableVo.setNumBl(subInfoTjfxTableVo.getNumBZb().subtract(subInfoTjfxTableVo.getLastAmtJh().divide(new BigDecimal("10000"), 2, RoundingMode.HALF_UP).divide(lastYearAmtTotal, 2, RoundingMode.HALF_UP).multiply(new BigDecimal("100"))));
+                } else {
+                    subInfoTjfxTableVo.setNumBl(subInfoTjfxTableVo.getNumBZb());
+                }
+                //同比增长 TODO
+                jsData.add(subInfoTjfxTableVo);
+            }
+
+            subInfoTjfxVo.setAreaData(areaData);
+            subInfoTjfxVo.setHyData(hyData);
+            subInfoTjfxVo.setJsData(jsData);
+
+        }
+
+
+        return subInfoTjfxVo;
+    }
 }

+ 24 - 0
projects-service/src/main/java/com/rtrh/projects/modules/projects/vo/SubInfoTjfxDataVo.java

@@ -0,0 +1,24 @@
+package com.rtrh.projects.modules.projects.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class SubInfoTjfxDataVo {
+
+    private String id;
+
+    private String status;
+
+    private BigDecimal amtTotal;
+
+    private String subjectId;
+
+    private String indusKind;
+
+    private BigDecimal amt;
+
+    private BigDecimal lastAmt;
+
+}

+ 18 - 0
projects-service/src/main/java/com/rtrh/projects/modules/projects/vo/SubInfoTjfxTableVo.java

@@ -0,0 +1,18 @@
+package com.rtrh.projects.modules.projects.vo;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+//统计分析页面表格数据
+@Data
+public class SubInfoTjfxTableVo {
+
+    private Integer numbers;    //序号
+    private String kindDesc;    //名称
+    private BigDecimal amtJh;   //计划投资总金额
+    private BigDecimal lastAmtJh;   //上一年度计划投资总金额
+    private BigDecimal numBZb;  //进度占比
+    private BigDecimal numBl;   //同比增长率
+
+}

+ 38 - 0
projects-service/src/main/java/com/rtrh/projects/modules/projects/vo/SubInfoTjfxVo.java

@@ -0,0 +1,38 @@
+package com.rtrh.projects.modules.projects.vo;
+
+import lombok.AllArgsConstructor;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+//统计分析页面数据vo
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class SubInfoTjfxVo {
+
+    private Integer totalNumber;    //项目总量
+
+    private Integer cbNumber;   //储备总量
+
+    private Integer xjNumber;   //新建总量
+
+    private Integer zjNumber;   //在建总量
+
+    private Integer tcNumber;   //投产总量
+
+    private BigDecimal amtTotal;    //项目总投资金额
+
+    private BigDecimal yearAmtTotal;    //年度计划投资金额
+
+    private BigDecimal lastYearAmtTotal;    //上一年度计划投资金额
+
+    private List<SubInfoTjfxTableVo> areaData;  //区域占比
+
+    private List<SubInfoTjfxTableVo> hyData;    //行业占比
+
+    private List<SubInfoTjfxTableVo> jsData;    //建设性质占比
+
+}

+ 7 - 0
projects-service/src/main/java/com/rtrh/projects/modules/system/service/ISubInduService.java

@@ -41,4 +41,11 @@ public interface ISubInduService {
      * @return
      */
     String getChildrenCodesByCode(String indusKinds);
+
+    /**
+     * 根据父行业code查询出所有子行业code
+     * @param indusKinds
+     * @return
+     */
+    List<String> selectChildrenCodesByCode(List<String> indusKinds);
 }

+ 5 - 0
projects-service/src/main/java/com/rtrh/projects/modules/system/service/impl/SubInduServiceImpl.java

@@ -136,4 +136,9 @@ public class SubInduServiceImpl implements ISubInduService {
         String newCodes = StringUtils.join(codes, ",");
         return newCodes;
     }
+
+    @Override
+    public List<String> selectChildrenCodesByCode(List<String> indusKinds) {
+        return subInduMapper.selectChildrenCodesByCode(indusKinds);
+    }
 }

+ 7 - 2
projects/src/main/java/com/rtrh/projects/web/controller/projects/TjFxController.java

@@ -15,6 +15,8 @@ import cn.afterturn.easypoi.word.WordExportUtil;
 import cn.afterturn.easypoi.word.entity.MyXWPFDocument;
 import com.rtrh.common.util.StringUtil;
 import com.rtrh.projects.modules.projects.mapper.ReportMapper;
+import com.rtrh.projects.modules.projects.po.SubIndu;
+import com.rtrh.projects.modules.system.service.ISubInduService;
 import org.apache.commons.io.IOUtils;
 import org.apache.poi.xwpf.usermodel.XWPFDocument;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -39,12 +41,15 @@ public class TjFxController extends BaseController {
 	@Autowired
 	private ReportMapper reportMapper;
 
+	@Autowired
+	private ISubInduService subInduService;
+
 	@GetMapping("index")
 	public ModelAndView index(ModelMap model) {
 		List<TSystable> JSDD = tSysTableService.getByKind(SysTableKind.JSDD);
 		model.put("JSDD", JSDD);
-		List<TSystable> HYFL = tSysTableService.getByKind(SysTableKind.HYFL);
-		model.put("HYFL", HYFL);
+		List<SubIndu> subInduList = subInduService.queryParentAll();
+		model.put("HYFL", subInduList);
 		List<TSystable> JSXZ = tSysTableService.getByKind(SysTableKind.JSXZ);
 		model.put("JSXZ", JSXZ);
 		List<TSystable> XMLX = tSysTableService.getByKind(SysTableKind.XMLX);

+ 19 - 2
projects/src/main/java/com/rtrh/projects/web/controller/projects/api/TzfxApiController.java

@@ -7,6 +7,8 @@ import java.util.Map;
 import java.util.Optional;
 
 import com.rtrh.projects.modules.projects.mapper.ReportMapper;
+import com.rtrh.projects.modules.projects.vo.SubInfoTjfxDataVo;
+import com.rtrh.projects.modules.projects.vo.SubInfoTjfxVo;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
@@ -19,8 +21,6 @@ import com.rtrh.projects.modules.projects.service.StaticsService;
 import com.rtrh.projects.modules.projects.vo.TzfxDataQueryVO;
 import com.rtrh.projects.web.controller.BaseController;
 
-import cn.hutool.core.collection.CollectionUtil;
-
 @RestController
 @RequestMapping("/api/tzfx")
 public class TzfxApiController extends BaseController {
@@ -82,6 +82,23 @@ public class TzfxApiController extends BaseController {
 		return message;
 	}
 
+	/**
+	 * 获取统计分析页面数据
+	 * @return
+	 */
+	@PostMapping("getTjfxData")
+	public Message getTjfxData(@RequestBody TzfxDataQueryVO queryVO) {
+		Message message = new Message();
+		try {
+			SubInfoTjfxVo data = staticsService.getTjfxData(queryVO);
+			message.setData(data);
+		} catch (Exception e) {
+			logger.error("", e);
+			message.addError(e.getMessage());
+		}
+		return message;
+	}
+
 
 
 

+ 2 - 2
projects/src/main/webapp/vmodules/leftMenu.jsp

@@ -311,8 +311,8 @@
                     icon: 'icon_over_time_active', activeIcon: 'icon_over_time_active',
                     code: '5',
                     txt: '统计分析',
-                    // url: 'tjfx/index' 原始路径
-                    url: 'register/underConstruction'
+                    url: 'tjfx/index'
+                    // url: 'register/underConstruction'
                 },
                 {
                     icon: 'icon_over_time_active',

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 57 - 752
projects/src/main/webapp/vmodules/tjfx/index2.jsp


Některé soubory nejsou zobrazeny, neboť je v těchto rozdílových datech změněno mnoho souborů