Sfoglia il codice sorgente

内页进度首节点问题

qianxb 1 anno fa
parent
commit
a013f7d337

+ 2 - 1
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/NeiWaiYeProgressVO.java

@@ -4,6 +4,7 @@ import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.math.BigDecimal;
+import java.math.RoundingMode;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -45,7 +46,7 @@ public class NeiWaiYeProgressVO {
         this.waiYeSuccessAmount = waiYeSuccessAmount;
         if (amount > 0) {
             double result1 = Double.parseDouble(String.valueOf(new BigDecimal(neiYeSuccessAmount.toString()).divide(new BigDecimal(amount.toString()), 2, BigDecimal.ROUND_HALF_UP)));
-            this.neiYeRatio = result1 > -1 ? result1 * 100 : 0;
+            this.neiYeRatio = new BigDecimal(result1 > -1 ? result1 * 100 : 0).setScale(2, RoundingMode.HALF_UP).doubleValue();
 
             double result2 = Double.parseDouble(String.valueOf(new BigDecimal(waiYeSuccessAmount.toString()).divide(new BigDecimal(amount.toString()), 2, BigDecimal.ROUND_HALF_UP)));
             this.waiYeRatio = result2 > -1 ? result2 * 100 : 0;

+ 30 - 15
blade-service/blade-business/src/main/java/org/springblade/business/controller/NeiWaiYeProgressController.java

@@ -26,6 +26,7 @@ import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Iterator;
 import java.util.List;
+import java.util.stream.Collectors;
 
 @RestController
 @AllArgsConstructor
@@ -43,6 +44,7 @@ public class NeiWaiYeProgressController {
 
     private final JdbcTemplate jdbcTemplate;
 
+
     /**
      * 内外业进度 ,id为当前合同段id
      */
@@ -67,9 +69,34 @@ public class NeiWaiYeProgressController {
             childList.removeIf(child -> child.getNodeType() != null && child.getNodeType() == 111);
 
             //获取当前节点下的所有填报节点
-            List<QueryProcessDataVO> queryProcessDataVOList;
-            if (!new Integer("6").equals(node.getNodeType()) && !Arrays.asList("1,2,3,4".split(",")).contains(node.getMajorDataType().toString())) {
-                queryProcessDataVOList = this.informationQueryService.queryProcessDataByParentIdAndContractId(node.getId().toString(), classFy, contractId);
+            List<QueryProcessDataVO> queryProcessDataVOList = new ArrayList<>();
+            if (node.getParentId() == 0){
+                //ancens断层,手动插入子节点
+                for (WbsTreeContract contract : childList) {
+                    queryProcessDataVOList.addAll(this.informationQueryService.queryProcessDataByParentIdAndContractId2(contract.getId().toString(), classFy, contractId));
+                }
+
+            } else if (!new Integer("6").equals(node.getNodeType()) && !Arrays.asList("1,2,3,4".split(",")).contains(node.getMajorDataType().toString())) {
+                //查询出节点下所有填报节点
+//                List<WbsTreeContract> list = this.wbsTreeContractClient.getAllChildren(node.getId(), Long.parseLong(node.getContractId()));
+//                List<Long> keys = list.stream().map(l -> l.getPKeyId()).collect(Collectors.toList());
+//                List<Long> ids = this.informationQueryService.getInfoByNodeIds(keys);
+//                queryProcessDataVOList = list.stream().map(l -> {
+//                    QueryProcessDataVO vo = new QueryProcessDataVO();
+//                    vo.setPrimaryKeyId(l.getPKeyId() + "");
+//                    vo.setMajorDataType(l.getMajorDataType());
+//                    vo.setAncestors(l.getAncestors());
+//                    vo.setParentId(l.getParentId() + "");
+//                    if (ids != null && ids.contains(l.getPKeyId())) {
+//                        vo.setStatus(2);
+//                    }else {
+//                        vo.setStatus(1);
+//                    }
+//                    return vo;
+//                }).collect(Collectors.toList());
+
+                //查询出所有已完成任务
+                queryProcessDataVOList = this.informationQueryService.queryProcessDataByParentIdAndContractId2(node.getId().toString(), classFy, contractId);
             } else {
                 //填报节点
                 queryProcessDataVOList = this.informationQueryService.queryProcessDataByPrimaryKeyIdAndClassify(node.getPKeyId().toString(), classFy);
@@ -96,23 +123,11 @@ public class NeiWaiYeProgressController {
                             if (new Integer("2").equals(vo.getStatus())) {
                                 neiYeSuccessAmount++;
                             }
-                            //统计外业数量(外业根据当前填报节点是否已经生成一份施工日志为准(暂时))
-                            Integer logCount = this.contractLogWbsService.countContractLogBySelectPrimaryKeyIdsAndClassify(Func.toStrList(vo.getPrimaryKeyId()), 7);
-                            if (logCount != null && logCount > 0) {
-                                waiYeSuccessAmount++;
-                            } else {
-                                //检查是否填有对应的施工台账(以施工台账是否填写开工时间为准)
-                                ConstructionLedger ledger = this.constructionLedgerService.getOne(Wrappers.<ConstructionLedger>lambdaQuery().eq(ConstructionLedger::getWbsId, vo.getPrimaryKeyId()));
-                                if (ledger != null && ledger.getSiteStartTime() != null) {
-                                    waiYeSuccessAmount++;
-                                }
-                            }
                             //统计总数
                             amount++;
                             iterator.remove();
                         }
                     }
-
                     //添加返回结果
                     result.add(new NeiWaiYeProgressVO(StringUtils.isNotEmpty(child.getFullName()) ? child.getFullName() : child.getNodeName(), amount, neiYeSuccessAmount, waiYeSuccessAmount));
                 }

+ 7 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.java

@@ -49,6 +49,11 @@ public interface InformationQueryMapper extends BaseMapper<InformationQuery> {
      */
     List<QueryProcessDataVO> queryProcessDataByParentIdAndContractId(@Param("parentId") String parentId, @Param("classify") Integer classify, @Param("contractId") String contractId);
 
+    /**
+     * 查询工序节点的填报记录
+     */
+    List<QueryProcessDataVO> queryProcessDataByParentIdAndContractId2(@Param("parentId") String parentId, @Param("classify") Integer classify, @Param("contractId") String contractId);
+
     /**
      * 查询工序节点的填报记录
      */
@@ -132,4 +137,6 @@ public interface InformationQueryMapper extends BaseMapper<InformationQuery> {
     List<InformationQuery> getInformationByContractId(@Param("contractId") Long contractId);
 
     List<TabBusstimeInfo> getTabussTimeInfo(@Param("tables") List<String> tables);
+
+    List<Long> getInfoByNodeIds(@Param("ids") List<Long> ids);
 }

+ 34 - 0
blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.xml

@@ -513,6 +513,32 @@
           AND wtc.is_deleted = 0
     </select>
 
+    <select id="queryProcessDataByParentIdAndContractId2" resultMap="queryProcessDataMap">
+        SELECT wtc.id                                                                                   AS     treeId,
+               wtc.p_key_id,
+               wtc.ancestors,
+               wtc.major_data_type,
+               wtc.node_type                                                                            AS     nodeType,
+               IFNULL(if(length(trim(wtc.full_name)) > 0, wtc.full_name, wtc.node_name), wtc.node_name) AS     title,
+               wtc.parent_id                                                                            AS     parentId,
+               uiq.id                                                                                   AS     informationQueryId,
+               uiq.status,
+        uiq.type AS queryType
+        FROM
+            m_wbs_tree_contract AS wtc
+            LEFT JOIN u_information_query AS uiq
+        ON wtc.p_key_id = uiq.wbs_id AND uiq.classify = #{classify} and uiq.is_deleted = 0
+        WHERE wtc.major_data_type in (1
+            , 2
+            , 3
+            , 4)
+          AND wtc.ancestors like concat('%'
+            , #{parentId}
+            , '%')
+          AND wtc.contract_id = #{contractId}
+          AND wtc.is_deleted = 0
+    </select>
+
     <select id="getInformationQueryByWbsId" resultMap="informationQueryResultMap">
         select *
         from u_information_query
@@ -911,4 +937,12 @@
             </foreach>
         </if>
     </select>
+    <select id="getInfoByNodeIds" resultType="java.lang.Long">
+        select wbs_id
+        from u_information_query
+        where is_deleted = 0 and wbs_id in
+        <foreach collection="ids" item="id" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </select>
 </mapper>

+ 5 - 1
blade-service/blade-business/src/main/java/org/springblade/business/service/IInformationQueryService.java

@@ -64,8 +64,9 @@ public interface IInformationQueryService extends BaseService<InformationQuery>
      */
     List<QueryProcessDataVO> queryProcessDataByParentIdAndContractId(String parentId, Integer classify, String contractId);
 
+
     /**
-     * 查询工序节点的填报记录
+     * 查询工序节点的填报记录,不通过ancestors获取
      */
     List<QueryProcessDataVO> queryProcessDataByParentIdAndContractId2(String parentId, Integer classify, String contractId);
 
@@ -156,4 +157,7 @@ public interface IInformationQueryService extends BaseService<InformationQuery>
 
     //获取表单是否配置 业务时间字段
     List<TabBusstimeInfo> getTabussTimeInfo(List<String> tables);
+
+    //根据wbsTreeContract主键集合获取已经审批的资料
+    List<Long> getInfoByNodeIds(List<Long> ids);
 }

+ 10 - 2
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/InformationQueryServiceImpl.java

@@ -150,10 +150,13 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
         return result;
     }
 
-    //删除节点用
+
+    /**
+     * 查询工序节点的填报记录,不通过ancestors获取
+     */
     @Override
     public List<QueryProcessDataVO> queryProcessDataByParentIdAndContractId2(String parentId, Integer classify, String contractId) {
-        List<QueryProcessDataVO> result = this.baseMapper.queryProcessDataByParentIdAndContractId(parentId, classify, contractId);
+        List<QueryProcessDataVO> result = this.baseMapper.queryProcessDataByParentIdAndContractId2(parentId, classify, contractId);
         return result;
     }
 
@@ -895,4 +898,9 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
         return baseMapper.getTabussTimeInfo(tables);
     }
 
+    @Override
+    public List<Long> getInfoByNodeIds(List<Long> ids) {
+        return baseMapper.getInfoByNodeIds(ids);
+    }
+
 }