yangyj преди 1 година
родител
ревизия
8e6e58a755
променени са 13 файла, в които са добавени 95 реда и са изтрити 35 реда
  1. 6 1
      blade-common/src/main/java/org/springblade/common/utils/BaseUtils.java
  2. 1 1
      blade-service-api/blade-e-visa-api/src/main/java/org/springblade/evisa/feign/EVisaClient.java
  3. 2 9
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/BaseInfo.java
  4. 10 3
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/MeterPeriodInfo.java
  5. 2 0
      blade-service/blade-manager/src/main/java/com/mixsmart/utils/FormulaUtils.java
  6. 1 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java
  7. 2 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreeController.java
  8. 3 3
      blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/ExecutorInit.java
  9. 3 5
      blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/ExecutorSpecial.java
  10. 2 1
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/IFormulaDao.java
  11. 17 2
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaDaoImpl.java
  12. 44 7
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java
  13. 2 2
      blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreePrivateServiceImpl.java

+ 6 - 1
blade-common/src/main/java/org/springblade/common/utils/BaseUtils.java

@@ -342,7 +342,12 @@ public class BaseUtils {
         }
         return false;
     }
-
+    public static boolean inChain(String[] cp,String s){
+        if(cp!=null&&cp.length>0&& s!=null&&s.length()>0){
+            return inChain(Arrays.asList(cp), s);
+        }
+        return false;
+    }
 
 
 }

+ 1 - 1
blade-service-api/blade-e-visa-api/src/main/java/org/springblade/evisa/feign/EVisaClient.java

@@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestParam;
 
 import java.util.List;
 
-@FeignClient(value = EVisaConstant.APPLICATION_WEATHER_NAME,fallbackFactory = EVisaClientFallBack.class)
+@FeignClient(value = EVisaConstant.APPLICATION_WEATHER_NAME)
 public interface EVisaClient {
 
     /**

+ 2 - 9
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/BaseInfo.java

@@ -2,15 +2,7 @@ package org.springblade.manager.vo;
 
 import com.alibaba.fastjson.annotation.JSONField;
 import lombok.Data;
-import org.springblade.common.utils.BaseUtils;
-import org.springblade.core.tool.utils.StringPool;
-
-
-import java.lang.reflect.Field;
 import java.math.BigDecimal;
-import java.util.ArrayList;
-
-import java.util.List;
 
 /**
  * @author yangyj
@@ -20,7 +12,8 @@ import java.util.List;
 @Data
 public class BaseInfo {
     public static final String ID="89963247815";
-    public static final String TBN="base_info";
+    public static final String TBN="BSI";
+    public static final String TBN_CH="合同信息";
     /**项目名称*/
     @JSONField(name = "key_1",label="项目名称",ordinal = 1)
     private String projectName;

+ 10 - 3
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/MeterPeriodInfo.java

@@ -1,5 +1,8 @@
 package org.springblade.manager.vo;
 
+import com.alibaba.fastjson.annotation.JSONField;
+import lombok.Data;
+
 import java.time.LocalDate;
 
 /**
@@ -7,23 +10,27 @@ import java.time.LocalDate;
  * @Date 2023/12/20 10:36
  * @description 计量期信息
  */
+@Data
 public class MeterPeriodInfo {
     public static final String ID="87963214698";
     /**计量期信息表名*/
     public static final String TBN="MPI";
+    public static final String TBN_CH="开工材料计量期";
     /**计量期*/
+    @JSONField(name = "key_1",label="计量期",ordinal = 1)
     private String periodNumber;
     /**
      * 期名称
      */
+    @JSONField(name = "key_2",label="计量期名称",ordinal = 2)
     private String periodName;
     /**
      * 报表打印日期
      */
+    @JSONField(name = "key_3",label="报告打印日期",ordinal = 3)
     private LocalDate formPrintDate;
-    /**上期计量金额*/
+    /**上期累计金额*/
+    @JSONField(name = "key_4",label="上期累计金额",ordinal = 4)
     private String  preTotal;
 
-
-
 }

+ 2 - 0
blade-service/blade-manager/src/main/java/com/mixsmart/utils/FormulaUtils.java

@@ -354,6 +354,8 @@ public class FormulaUtils {
         return vos;
     }
 
+
+
     /**从元素名称中解析项目名称,细化项目匹配用*/
     public static  String parseItemName(String eName){
         if (StringUtils.isEmpty(eName)) {

+ 1 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -2343,7 +2343,7 @@ public class ExcelTabController extends BladeController {
                                     this.taskClient.reSigningEVisa(String.join(",", l), contractId, projectId, AuthUtil.getHeader());
                                     sum.addAndGet(l.size());
                                     double d = 100 * (double) sum.get() / (double) taskIds.size();
-                                    String str = "上报数据共计" + taskIdsSeg.size() + "条,已经执行" + sum.get() + "条(" + d + "%)";
+                                    String str = "上报数据共计" + taskIdsSeg.size() + "条,已经执行" + sum.get() + "条(" + d + "%)";
                                     sqlIntA.add("insert into m_cache (id,remark,create_time) VALUES (" + SnowFlakeUtil.getId() + ",'" + str + "',NOW())");
                                     this.batchInsert(sqlIntA);
                                     sqlIntA.clear();

+ 2 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreeController.java

@@ -300,6 +300,8 @@ public class WbsTreeController extends BladeController {
     public List<WbsFormElementVO> dataModel(String id){
           if(BaseInfo.ID.equals(id)) {
               return FormulaUtils.toElementVos(BaseInfo.class);
+          }else if(MeterPeriodInfo.ID.equals(id)){
+              return FormulaUtils.toElementVos(MeterPeriodInfo.class);
           }
           return Collections.emptyList();
     }

+ 3 - 3
blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/ExecutorInit.java

@@ -22,7 +22,7 @@ public class ExecutorInit extends FormulaExecutor {
         super(tec);
     }
     private  Function<Long, BaseInfo> baseInfoFc;
-    private  Function<Long, Map<String,Object>>  meterPeriodFc;
+    private  Function<Long, MeterPeriodInfo>  meterPeriodFc;
 
 
     public void handle() {
@@ -30,8 +30,8 @@ public class ExecutorInit extends FormulaExecutor {
         BaseInfo baseInfo = this.baseInfoFc.apply(tec.getContractId());
         tec.getConstantMap().put(BaseInfo.TBN,baseInfo);
         /*加载计量期信息*/
-        Map<String,Object> meterPeriod=meterPeriodFc.apply(tec.getPeriodId());
-        tec.getConstantMap().put(MeterPeriodInfo.TBN, BeanUtil.toBean(meterPeriod,MeterPeriodInfo.class));
+        MeterPeriodInfo meterPeriod=meterPeriodFc.apply(tec.getPeriodId());
+        tec.getConstantMap().put(MeterPeriodInfo.TBN, meterPeriod);
     }
 
 

+ 3 - 5
blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/ExecutorSpecial.java

@@ -127,9 +127,8 @@ public class ExecutorSpecial extends FormulaExecutor {
                 this.totalAdvance=StringUtils.number2StringZero(materials.stream().mapToDouble(m->Double.parseDouble(m.getAdvancePayment())).sum(),1);
                 List<Object> dataList= materials.stream().flatMap(m->m.getData().stream()).collect(Collectors.toList());
                 if(dataList.size()>0){
-                   Map<Integer,List<Object>> groupData= IntStream.range(0, dataList.size())
-                            .boxed()
-                            .collect(Collectors.groupingBy(index -> index % 14,
+                   Map<Integer,List<Object>> groupData= IntStream.range(0, dataList.size()).boxed()
+                            .collect(Collectors.groupingBy(index -> index % fds.size(),
                                     Collectors.mapping(dataList::get, Collectors.toList())));
                    for(int i=0;i<this.fds.size();i++){
                        List<Object> dl= groupData.get(i);
@@ -138,7 +137,7 @@ public class ExecutorSpecial extends FormulaExecutor {
                    }
                    /*追加合计*/
                    append(this.sum,this.total);
-                   append(this.advancePayment,this.advancePayment);
+                   append(this.advancePayment,this.totalAdvance);
                 }
             }
         }
@@ -156,7 +155,6 @@ public class ExecutorSpecial extends FormulaExecutor {
                  }
              }
         }
-
     }
 
     public interface  Special{

+ 2 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IFormulaDao.java

@@ -2,6 +2,7 @@ package org.springblade.manager.service;
 
 import org.springblade.manager.vo.BaseInfo;
 import org.springblade.manager.vo.Material;
+import org.springblade.manager.vo.MeterPeriodInfo;
 
 import java.util.List;
 import java.util.Map;
@@ -11,7 +12,7 @@ public interface IFormulaDao {
     /**获取项目合同基础信息*/
     Function<Long, BaseInfo> getBaseInfo();
     /**获取计量段信息*/
-    Function<Long, Map<String,Object>> getMeterPeriod();
+    Function<Long, MeterPeriodInfo> getMeterPeriod();
     /**获取清单信息*/
     Function<Long, List<Material>> getMaterialForm();
 }

+ 17 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaDaoImpl.java

@@ -1,5 +1,6 @@
 package org.springblade.manager.service.impl;
 
+import com.mixsmart.utils.StringUtils;
 import lombok.RequiredArgsConstructor;
 import org.springblade.core.tool.utils.BeanUtil;
 import org.springblade.core.tool.utils.Func;
@@ -10,11 +11,14 @@ import org.springblade.manager.service.IFormulaDao;
 import org.springblade.manager.service.IProjectInfoService;
 import org.springblade.manager.vo.BaseInfo;
 import org.springblade.manager.vo.Material;
+import org.springblade.manager.vo.MeterPeriodInfo;
 import org.springframework.beans.BeanUtils;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.stereotype.Service;
 
 import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.function.Function;
@@ -44,8 +48,19 @@ public class FormulaDaoImpl implements IFormulaDao {
     }
 
     @Override
-    public Function<Long,Map<String,Object>> getMeterPeriod(){
-        return id-> this.jdbcTemplate.queryForMap("select period_number periodNumber,period_name periodName,form_print_date formPrintDate from s_meter_period where id= "+id);
+    public Function<Long,MeterPeriodInfo> getMeterPeriod(){
+        return id-> {
+           List<MeterPeriodInfo> beans = this.jdbcTemplate.query("select period_number periodNumber,period_name periodName,form_print_date formPrintDate from s_meter_period where id= "+id, new BeanPropertyRowMapper<>(MeterPeriodInfo.class));
+
+            if(beans.size()>0){
+                MeterPeriodInfo bean = beans.get(0);
+                List<Map<String,Object>> listMap= this.jdbcTemplate.queryForList("select sum(b.current_amount) currentAmount from s_meter_period a join s_meter_period b on (a.contract_id=b.contract_id and a.type=b.type) where a.id="+id+" and b.id<>"+id);
+                if(listMap.size()>0) {
+                    bean.setPreTotal(StringUtils.number2String(listMap.get(0).get("currentAmount").toString(),2));
+                }
+            }
+            return new MeterPeriodInfo();
+        };
     }
 
     @Override

+ 44 - 7
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java

@@ -2242,14 +2242,51 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
 
     @Override
     public Map<String,Object> getElementInfoByCodes(String codes){
+       final String ekey="ekey";
+        String[] model = new String[]{BaseInfo.TBN,MeterPeriodInfo.TBN};
+        List<Map<String,Object>> mapList =new ArrayList<>();
         if(StringUtils.isNotEmpty(codes)){
-            String[] relyArr = codes.split(StringPool.COMMA);
-            List<Map<String,Object>> mapList =this.jdbcTemplate.queryForList("select CONCAT(a.tab_en_name,':',b.e_key) ekey,a.tab_ch_name tableName,b.e_name ename  ,b.e_length elength,c.dict_value type f" +
-                    "rom m_table_info a JOIN m_wbs_form_element b on a.id=b.f_id and b.is_deleted=0  " +
-                    "LEFT JOIN (select dict_key, dict_value from blade_dict where code ='data_type' and parent_id > 0 and is_sealed = 0 and is_deleted = 0 )c on b.e_type=c.dict_key" +
-                    " where  a.tab_en_name in( "+ Arrays.stream(relyArr).map(e->e.split(StringPool.COLON)[0]).distinct().collect(Collectors.joining("','","'","'"))+")");
-            if(ListUtils.isNotEmpty(mapList)){
-             return   mapList.stream().filter(e-> Arrays.stream(relyArr).anyMatch(c->StringUtils.isEquals(e.get("ekey"),c))).collect(Collectors.toMap(e->StringUtils.handleNull(e.get("ekey")), e->e));
+            String[] relyArr=codes.split(StringPool.COMMA);
+            List<String> codeList = new ArrayList<>(Arrays.asList(relyArr));
+            Predicate<String> isModel = code-> BaseUtils.inChain(model,code);
+            List<String> modelList= codeList.stream().filter(isModel).collect(Collectors.toList());
+            if(modelList.size()>0) {
+                codeList.removeIf(modelList::contains);
+                for(String code:modelList){
+                    String tbn=code.split(StringPool.COLON)[0];
+                     String tbnCh="";
+                    List<WbsFormElementVO> elementVOS = null;
+                    if(BaseInfo.TBN.equals(tbn)){
+                        elementVOS=FormulaUtils.toElementVos(BaseInfo.class);
+                        tbnCh=BaseInfo.TBN_CH;
+                    }else if(MeterPeriodInfo.TBN.equals(tbn)){
+                        elementVOS=FormulaUtils.toElementVos(MeterPeriodInfo.class);
+                        tbnCh=MeterPeriodInfo.TBN_CH;
+                    }
+                    if(elementVOS!=null){
+                        String finalTbnCh = tbnCh;
+                        elementVOS.stream().filter(e->modelList.contains(e.getTableElementKey())).collect(Collectors.toList()).forEach(e->{
+                            Map<String,Object> map = new HashMap<>();
+                            map.put(ekey,e.getTableElementKey());
+                            map.put("tableName", finalTbnCh);
+                            map.put("ename", e.getEName());
+                            mapList.add(map);
+                        });
+                    }
+
+                }
+            }
+            if(codeList.size()>0) {
+                List<Map<String, Object>> tmpList = this.jdbcTemplate.queryForList("select CONCAT(a.tab_en_name,':',b.e_key) ekey,a.tab_ch_name tableName,b.e_name ename  ,b.e_length elength,c.dict_value type f" +
+                        "rom m_table_info a JOIN m_wbs_form_element b on a.id=b.f_id and b.is_deleted=0  " +
+                        "LEFT JOIN (select dict_key, dict_value from blade_dict where code ='data_type' and parent_id > 0 and is_sealed = 0 and is_deleted = 0 )c on b.e_type=c.dict_key" +
+                        " where  a.tab_en_name in( " + codeList.stream().map(e -> e.split(StringPool.COLON)[0]).distinct().collect(Collectors.joining("','", "'", "'")) + ")");
+                if (tmpList.size() > 0) {
+                    mapList.addAll(tmpList);
+                }
+            }
+            if(mapList.size()>0){
+               return mapList.stream().filter(e-> Arrays.stream(relyArr).anyMatch(c->StringUtils.isEquals(e.get(ekey),c))).collect(Collectors.toMap(e->StringUtils.handleNull(e.get(ekey)), e->e));
             }
 
         }

+ 2 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreePrivateServiceImpl.java

@@ -249,8 +249,8 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
     }
     public  List<TreeNodeVOByTabType> baseList(){
         Map<String,String[]> titleMap = new HashMap<>();
-        titleMap.put("合同信息",new String[]{BaseInfo.TBN,BaseInfo.ID});
-        titleMap.put("开工材料计量期",new String[]{MeterPeriodInfo.TBN,MeterPeriodInfo.ID});
+        titleMap.put(BaseInfo.TBN_CH,new String[]{BaseInfo.TBN,BaseInfo.ID});
+        titleMap.put(MeterPeriodInfo.TBN_CH,new String[]{MeterPeriodInfo.TBN,MeterPeriodInfo.ID});
         return titleMap.entrySet().stream().map(kv->{
             TreeNodeVOByTabType tn = new TreeNodeVOByTabType();
             tn.setTitle(kv.getKey());