Prechádzať zdrojové kódy

张拉力表格内容排序

chenr 1 týždeň pred
rodič
commit
c1f9873b0d

+ 1 - 1
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/dto/FormData.java

@@ -268,7 +268,7 @@ public class FormData {
     }
 
     public List<Object> getRawValue(){
-        return this.values.stream().map(ElementData::getValue).collect(Collectors.toList());
+        return this.values.stream().map(elementData -> elementData.getValue() == null ? "" : elementData.getValue()).collect(Collectors.toList());
     }
 
     public void init(){

+ 3 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/FormulaClient.java

@@ -36,4 +36,7 @@ public interface FormulaClient {
     @PostMapping(API_PREFIX + "execute3")
     List<ReportResult> formulaExecute3(@RequestParam Long contractId, @RequestParam Long periodId,@RequestParam Integer type);
 
+    //万盛计量专用
+    @PostMapping(API_PREFIX + "execute4")
+    List<ReportResult> formulaExecute4(@RequestParam Long contractId, @RequestParam Long periodId,@RequestParam Integer type);
 }

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

@@ -280,11 +280,12 @@ public class FormulaUtils {
     public  static void write(FormData fd, Object data){
         write(fd,data,false);
     }
-    public  static void write(FormData fd, Object data,Boolean retainEmpty ){
+    public  static void write(FormData fd, Object data,Boolean retainEmpty){
         if(Func.isEmpty(fd.getValues())){
             /*无定位信息不写入*/
             return;
         }
+
         try {
             /*一个单元格且存在多张,全部设置为自动拓展 20230816*/
             if(fd.getCoordsList().size()==1&&fd.getValues().size()>1&&fd.getFormula()!=null){

+ 0 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/ManagerApplication.java

@@ -13,7 +13,6 @@ import org.springframework.scheduling.annotation.EnableScheduling;
 @SpringCloudApplication
 @EnableAsync
 @EnableCaching//缓存
-@EnableScheduling
 public class ManagerApplication {
 
     public static void main(String[] args) {

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

@@ -1859,9 +1859,14 @@ public class ExcelTabController extends BladeController {
                 pdfUrl = this.mergePdfShow(pdfUrl, stringObjectMap) + "";
             }
 
-            if (StringUtils.isEmpty(pdfUrl) || pdfUrl.equals("null")) {
-                return R.fail("暂无PDF数据");
-            } else {
+            String nodeSql="SELECT node_class from m_wbs_tree_contract where p_key_id="+nodeId;
+             Integer nodeClass = jdbcTemplate.queryForObject(nodeSql, Integer.class);
+             if(ObjectUtil.isEmpty(nodeClass)){
+                 nodeClass=1;
+             }
+             if ((StringUtils.isEmpty(pdfUrl) || pdfUrl.equals("null"))&&!nodeClass.equals(2)) {
+                    return R.fail("暂无PDF数据");
+             } else {
                 // 由于独立附件 需要追加最后
                 List<TableFileVO> data = tableFileService.selectTableFileListByTen(Long.valueOf(nodeId + ""), Integer.valueOf(classify));
                 List<String> datainfo = new ArrayList<>();

+ 6 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/FormulaClientImpl.java

@@ -20,6 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.constraints.NotNull;
 import java.io.FileNotFoundException;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 
@@ -71,5 +72,10 @@ public class FormulaClientImpl implements FormulaClient {
        return service.execute3(contractId,periodId,type);
     }
 
+    @Override
+    public List<ReportResult> formulaExecute4(Long contractId, Long periodId, Integer type) {
+        return service.execute4(contractId,periodId,type);
+    }
+
 
 }

+ 0 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/WbsTreeContractClientImpl.java

@@ -141,7 +141,6 @@ public class WbsTreeContractClientImpl implements WbsTreeContractClient {
 
     @Override
     public Boolean updateContractNodeParameter(WbsTreeContract node) {
-
         LambdaUpdateWrapper<WbsTreeContract> wrappers = Wrappers.lambdaUpdate();
         if (StringUtils.isNotEmpty(node.getNodeName())) {
             wrappers.set(WbsTreeContract::getFullName, node.getNodeName());

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

@@ -51,7 +51,9 @@ public class ExecutorInit extends FormulaExecutor {
 
     public static final String SZ="[ 一二三四五六七八九十]+";
 
-
+    /**
+     * 初始化信息
+     */
     @Override
     public void handle() {
         List<DataModel> delay =tec.meterInfo.getDelay();

+ 1 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/formula/impl/ExecutorSort.java

@@ -25,6 +25,7 @@ public class ExecutorSort extends FormulaExecutor {
     public ExecutorSort(TableElementConverter tec) {
         super(tec);
     }
+
     @Override
     public void handle() {
         try {

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

@@ -99,5 +99,6 @@ public interface IFormulaService extends BaseService<Formula> {
     /** 节点同步工序资料*/
     R<Object> syncWorkDate(@NotNull(message = "节点ID不能为空") Long nodeId);
 
-
+    /** 万盛计量专用统计数据*/
+    List<ReportResult> execute4(Long contractId, Long periodId, Integer type);
 }

+ 39 - 17
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java

@@ -81,6 +81,20 @@ import java.util.stream.Stream;
 @Lazy
 public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula> implements IFormulaService {
 
+        public final static String WP="WP";
+        public final static String CHAIN="trees";
+        public final static String FC="FC.";
+        public final static String TABLE_LIST="TBL";
+        public final static String CHECK_ITEMS="CKI";
+        public static final Pattern AP=Pattern.compile("(E|WP)\\[([^]']+)]");
+        public static final String FC_REG="T\\(com.mixsmart.utils.CustomFunction\\)\\.";
+        public final static String CTI="ContractInfo";
+        /**元素标识*/
+        public final static String E="E";
+    /**公式参数*/
+    public final static String FMOT="OP";
+    /**是否使用表单公式*/
+    public final static  boolean isForm=true;
         private final IWbsParamService wpService;
         private final FormulaStrategyFactory formulaStrategyFactory;
         private final IWbsTreeContractService wbsTreeContractService;
@@ -95,26 +109,10 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
         private final WbsTreeContractMapper wbsTreeContractMapper;
         private final IFormulaDao formulaDao;
         private final CertificateItemClient certificateItemClient;
+    private final NewIOSSClient newIOSSClient;
         @Lazy
         @Autowired
         private IExcelTabService excelTabService;
-        public final static String WP="WP";
-        public final static String CHAIN="trees";
-        public final static String FC="FC.";
-        public final static String TABLE_LIST="TBL";
-        public final static String CHECK_ITEMS="CKI";
-        public static final Pattern AP=Pattern.compile("(E|WP)\\[([^]']+)]");
-        public static final String FC_REG="T\\(com.mixsmart.utils.CustomFunction\\)\\.";
-        public final static String CTI="ContractInfo";
-        /**元素标识*/
-        public final static String E="E";
-    /**公式参数*/
-    public final static String FMOT="OP";
-
-    /**是否使用表单公式*/
-    public final static  boolean isForm=true;
-
-    private final NewIOSSClient newIOSSClient;
 
     @Override
     public void execute(TableElementConverter tec) {
@@ -1165,6 +1163,25 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                             }else{
                                 putEle(f,ele,currentMap,fd);
                                 Object data =Expression.parse(formula.getFormula()).calculate(currentMap);
+                                //如果有空串,也要加进data不然表格数据顺序会混乱
+                                try {
+                                    Object e = currentMap.get("E");
+                                   if(e instanceof HashMap){
+                                    if(data instanceof List){
+                                       List<Object>e1 = (List<Object>)((HashMap<?, ?>) e).get(ele.get(0).getCode());
+                                      List<Object> values = (List<Object>) data;
+                                      if(e1.size()!=values.size()){
+                                          for (int i = 0; i < e1.size(); i++) {
+                                              if(e1.get(i).equals("")){
+                                                  values.add(i,"");
+                                              }
+                                          }
+                                      }
+                                    }
+                                }
+                                }catch (Exception ee){
+                                    ee.printStackTrace();
+                                }
                                 write(tec,fd,data);
                             }
                             /*错位计算偏移量重置*/
@@ -2122,6 +2139,11 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
         }
     }
 
+    @Override
+    public List<ReportResult> execute4(Long contractId, Long periodId, Integer type) {
+
+        return null;
+    }
 
 
     public void updateRecord(Long id, Map<String, Object> fieldValues,String tableName) {

+ 15 - 4
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/TaskController.java

@@ -3670,8 +3670,13 @@ public class TaskController extends BladeController {
         /*分为新增和更新*/
         /*如果数据没有变化,则各表的PDF可以不用更新*/
         ExecutionTime executionTime = new ExecutionTime();
-        List<ReportResult> reportResults = formulaClient.formulaExecute3(report.getContractId(), report.getId(), report.getType());
+        List<ReportResult> reportResults=new ArrayList<>();
+        if(ObjectUtil.isNotEmpty(report.getPeriodId())&&report.getProjectId().equals(1801141597643997184L)){
+             reportResults=formulaClient.formulaExecute4(report.getContractId(),report.getId(),report.getType());
+        }else{
+             reportResults = formulaClient.formulaExecute3(report.getContractId(), report.getId(), report.getType());
         executionTime.info("公式执行");
+        }
         String fileUrl = null;
         if (Func.isNotEmpty(reportResults)) {
             CompletableFuture<Map<Long ,List<DqTime>>> dqTimeMap=getDqTime(reportResults.stream().map(s->s.getPkeyId().toString()).collect(Collectors.joining(",")), report.getContractId(), report.getPeriodId());
@@ -4218,6 +4223,11 @@ public class TaskController extends BladeController {
          */
         private Integer type;
 
+        /**
+         * 项目ID
+         */
+        private Long projectId;
+
         /*上传并关联PDF,然后返回合并后的PDF链接*/
         public String getReportPdf(String file_path, List<ReportResult> reportResults) {
             Long dataId = SnowFlakeUtil.getId();
@@ -4248,12 +4258,13 @@ public class TaskController extends BladeController {
         Report report = new Report(reportId, type);
         Map<String, Object> map;
         if (type == 0) {
-            map = this.jdbcTemplate.queryForMap("select id,contract_id ,contract_period_id period_id from s_interim_pay_certificate where id = " + reportId);
+            map = this.jdbcTemplate.queryForMap("select id,project_id,contract_id ,contract_period_id period_id from s_interim_pay_certificate where id = " + reportId);
         } else {
-            map = this.jdbcTemplate.queryForMap("select id,contract_id,meter_period_id period_id  from s_material_start_statement where id = " + reportId);
+            map = this.jdbcTemplate.queryForMap("select id,project_id,contract_id,meter_period_id period_id  from s_material_start_statement where id = " + reportId);
         }
         report.setContractId(Long.parseLong(map.get("contract_id").toString()));
         report.setPeriodId(Long.parseLong(map.get("period_id").toString()));
+
         return report;
     }
 
@@ -4881,4 +4892,4 @@ public class TaskController extends BladeController {
 
         return reData;
     }
-}
+}