Parcourir la source

Merge remote-tracking branch 'origin/master' into master

yangyj il y a 1 an
Parent
commit
0e45bf3831

+ 2 - 8
blade-common/src/main/java/org/springblade/common/utils/CommonUtil.java

@@ -600,16 +600,10 @@ public class CommonUtil {
         return workDays;
     }
 
-    // 上传文件路径获取
-    public String getSysFileUrl() {
-
-
-        return "";
-    }
-
     public static String replaceOssUrl(String url) {
+
         String osName = System.getProperty("os.name");
-        if (osName != null && osName.toLowerCase().contains("linux")) {
+        if (osName != null && osName.toLowerCase().contains("Cloud Linux")) {
             // 如果当前操作系统是Linux系统
             Map<String, String> envMap = System.getenv();
             if (!envMap.containsKey("linuxtesttest")) {

+ 3 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/entity/ContractMeterPeriod.java

@@ -57,6 +57,9 @@ public class ContractMeterPeriod extends BaseEntity {
      */
     @ApiModelProperty(value = "期号")
     private String periodNumber;
+
+    @ApiModelProperty(value = "支付编号")
+    private String payNumber;
     /**
      * 年
      */

+ 2 - 2
blade-service/blade-business/src/main/java/org/springblade/business/controller/FixedFlowController.java

@@ -213,7 +213,7 @@ public class FixedFlowController extends BladeController {
     public R<Boolean> update(@Valid @RequestBody FixedFlowVO vo) {
         //校验是否被使用过
         List<Task> tasks = jdbcTemplate
-                .query("SELECT * FROM u_task WHERE contract_id = ? and is_deleted = 0 AND fixed_flow_id = ? ",
+                .query("SELECT * FROM u_task WHERE contract_id = ? and is_deleted = 0 and status != 3 AND fixed_flow_id = ? ",
                         new Object[]{vo.getContractId(),vo.getId()}, new BeanPropertyRowMapper<>(Task.class));
         if (tasks.size() > 0){
             return R.fail("当前流程已经使用,不能修改");
@@ -259,7 +259,7 @@ public class FixedFlowController extends BladeController {
             //前端只能单条删除,不会有大量数据,先就这么写
             for (Long aLong : list) {
                 List<Task> tasks = jdbcTemplate
-                        .query("SELECT * FROM u_task WHERE is_deleted = 0 AND fixed_flow_id = ? ",
+                        .query("SELECT * FROM u_task WHERE is_deleted = 0 and status != 3 AND fixed_flow_id = ? ",
                                 new Object[]{aLong}, new BeanPropertyRowMapper<>(Task.class));
                 if (tasks.size() > 0){
                     return R.fail("当前流程已经使用,不能删除");

+ 7 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/ContractMeterPeriodController.java

@@ -165,5 +165,12 @@ public class ContractMeterPeriodController extends BladeController {
 	public R<List<ContractMeterPeriod>> conditionPeriod(Long contractId) {
 		return R.data(contractMeterPeriodService.conditionPeriod(contractId));
 	}
+
+	@GetMapping("/getContractNumber")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "合同计量期列表-获取合同段编号", notes = "传入contractId")
+	public R<String> getContractNumber(Long contractId) {
+		return R.data(contractMeterPeriodService.getContractNumber(contractId));
+	}
 	
 }

+ 37 - 33
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/TaskController.java

@@ -1322,26 +1322,29 @@ public class TaskController extends BladeController {
                                 throw new ServiceException(r.getMsg());
                             }
                             WbsTreePrivate aPrivate = r.getData();
+                            //获取所有的key
+                            Map<String, String> map = FileUtils.getHtmlAllKey(aPrivate.getHtmlUrl());
+//                            Map<String, String> map = FileUtils.getHtmlAllKey("C:\\Users\\泓创研发01\\Desktop\\fsdownload\\1789967486389583872.html");
+                            if (map.size() == 0){
+                                throw new ServiceException("未获取到html中的keyName");
+                            }
                             //实体数据
-//                    String querySql = "select * from " + aPrivate.getInitTableName() + " where p_key_id=" + task.getId();
-//                    List<Map<String, Object>> dataIn = jdbcTemplate.queryForList(querySql);
                             Map<String, Object> dataInfo = getBussDataInfo(aPrivate, task.getId());
                             //todo 目前直接把key写死在代码里面,后面有空再去动态获取key
                             Map<String, Object> tableData = new HashMap<>();
                             if (dataInfo.size() == 0) {
-                                tableData.put("key_18__3_1", projectClient.getById(task.getProjectId()).getProjectName() + contractClient.getContractById(Long.valueOf(task.getContractId())).getContractName());
-                                tableData.put("key_7__4_3", reportAllMoney);
-                                tableData.put("key_1__5_3", DateTimeFormatter.ofPattern("yyyy年MM月dd日").format(LocalDate.now()));
-                                tableData.put("key_5__10_1", reportAllMoney);
+                                tableData.put(map.get("项目名称:"), projectClient.getById(task.getProjectId()).getProjectName() + contractClient.getContractById(Long.valueOf(task.getContractId())).getContractName());
+                                tableData.put(map.get("要求付款额度"), reportAllMoney);
+                                tableData.put(map.get("意见发出日期:"), DateTimeFormatter.ofPattern("yyyy年MM月dd日").format(LocalDate.now()));
+                                tableData.put(map.get("造价机构现场咨询意见_本期审核进度款(元)"), reportAllMoney);
                                 //获取本期之前所有计量期金额
                                 BigDecimal beforeMoney = contractMeterPeriodMapper.getBeforeMoney(period);
                                 if (beforeMoney != null){
-                                    tableData.put("key_14__11_1",beforeMoney);
+                                    tableData.put(map.get("造价机构现场咨询意见_截止上期已累计审批进度款(元)"),beforeMoney);
                                 }
-                                tableData.put("key_10__11_3", beforeMoney == null ? reportAllMoney : beforeMoney.add(reportAllMoney));
+                                tableData.put(map.get("造价机构现场咨询意见_截止上期已累计审批进度款(元)_截止本期已累计审核进度款(元)"), beforeMoney == null ? reportAllMoney : beforeMoney.add(reportAllMoney));
                             } else {
                                 tableData = dataInfo;
-                                tableData.put("key_18__3_1", projectClient.getById(task.getProjectId()).getProjectName() + contractClient.getContractById(Long.valueOf(task.getContractId())).getContractName());
                             }
                             vo.setTableData(tableData);
                         } else {
@@ -2477,6 +2480,12 @@ public class TaskController extends BladeController {
                         throw new ServiceException(r.getMsg());
                     }
                     WbsTreePrivate aPrivate = (WbsTreePrivate) r.getData();
+                    //获取所有的key
+                    Map<String, String> map = FileUtils.getHtmlAllKey(aPrivate.getHtmlUrl());
+//                    Map<String, String> map = FileUtils.getHtmlAllKey("C:\\Users\\泓创研发01\\Desktop\\fsdownload\\1789967486389583872.html");
+                    if (map.size() == 0){
+                        throw new ServiceException("未获取到html中的keyName");
+                    }
                     if (isDefiniteFlow) {
                         Integer auditFlow2 = auditFlow;
                         flowIds = query.stream().filter(l -> l.getFixedFlowBranchSort() == auditFlow2)
@@ -2532,17 +2541,17 @@ public class TaskController extends BladeController {
                     Task updateTask = new Task();
                     updateTask.setId(task.getId());
                     Map<String, Object> tableData = dto.getTableData();
-                    Object object = tableData.get("key_5__10_1");
+                    Object object = tableData.get(map.get("造价机构现场咨询意见_本期审核进度款(元)"));
                     if (object != null) {
                         try {
                             BigDecimal decimal = new BigDecimal(object.toString());
                             updateTask.setTaskCommonMoney(decimal);
-                            Object object2 = tableData.get("key_14__11_1");
+                            Object object2 = tableData.get(map.get("造价机构现场咨询意见_截止上期已累计审批进度款(元)"));
                             if (object2 != null) {
                                 BigDecimal decimal2 = new BigDecimal(object2.toString());
-                                tableData.put("key_10__11_3", decimal.add(decimal2));
+                                tableData.put(map.get("造价机构现场咨询意见_截止上期已累计审批进度款(元)_截止本期已累计审核进度款(元)"), decimal.add(decimal2));
                             } else {
-                                tableData.put("key_10__11_3", decimal);
+                                tableData.put(map.get("造价机构现场咨询意见_截止上期已累计审批进度款(元)_截止本期已累计审核进度款(元)"), decimal);
                             }
                         } catch (Exception e) {
                             throw new ServiceException("本期审核进度款格式不对");
@@ -2551,24 +2560,24 @@ public class TaskController extends BladeController {
                     //如果为第一流程则判断是否当前流程已全部审批,已经全部审批则生成电签PDF,没有全部审批则只保存数据
                     if (isAllApp) {
                         //要求付款额度
-                        this.addYuan("key_7__4_3", tableData);
+                        this.addYuan(map.get("要求付款额度"), tableData);
                         //本期审核进度款
-                        this.addYuan("key_5__10_1", tableData);
+                        this.addYuan(map.get("造价机构现场咨询意见_本期审核进度款(元)"), tableData);
                         //截至上期累计进度款
-                        this.addYuan("key_14__11_1", tableData);
+                        this.addYuan(map.get("造价机构现场咨询意见_截止上期已累计审批进度款(元)"), tableData);
                         //截至本期累计进度款
-                        this.addYuan("key_10__11_3", tableData);
+                        this.addYuan(map.get("造价机构现场咨询意见_截止上期已累计审批进度款(元)_截止本期已累计审核进度款(元)"), tableData);
                         if (flowIds.size() == 0) {
                             throw new ServiceException("未找到流程人信息");
                         }
-                        tableData.put("key_18__3_1", projectClient.getById(task.getProjectId()).getProjectName() + contractClient.getContractById(Long.valueOf(task.getContractId())).getContractName());
+                        tableData.put(map.get("项目名称:"), projectClient.getById(task.getProjectId()).getProjectName() + contractClient.getContractById(Long.valueOf(task.getContractId())).getContractName());
                         //申请进度时间
-                        tableData.put("key_17__7_3", DateTimeFormatter.ofPattern("yyyy年MM月dd日").format(LocalDate.now()));
+                        tableData.put(map.get("申请进度款摘录_摘录人_时间"), DateTimeFormatter.ofPattern("yyyy年MM月dd日").format(LocalDate.now()));
                         //电签单位日期
-                        tableData.put("key_4__13_4", DateTimeFormatter.ofPattern("yyyy年MM月dd日").format(LocalDate.now()));
+                        tableData.put(map.get("建设单位签收_日期"), DateTimeFormatter.ofPattern("yyyy年MM月dd日").format(LocalDate.now()));
                         String pdfUrl = "";
                         try {
-                            pdfUrl = getEntrustPDFTrial(Long.valueOf(dto.getProjectId()), dto.getContractId(), aPrivate.getPKeyId(), tableData, flowIds);
+                            pdfUrl = getEntrustPDFTrial(aPrivate, dto.getContractId(), tableData, flowIds);
                         } catch (Exception e) {
                             throw new ServiceException("生成咨询意见时失败:" + e.getMessage());
                         }
@@ -3475,7 +3484,7 @@ public class TaskController extends BladeController {
         }
         //校验是否被使用过
         List<Task> tasks = jdbcTemplate
-                .query("SELECT * FROM u_task WHERE contract_id = ? and is_deleted = 0 AND fixed_flow_id = ? ",
+                .query("SELECT * FROM u_task WHERE contract_id = ? and is_deleted = 0 and status != 3 AND fixed_flow_id = ? ",
                 new Object[]{dto.getContractId(),dto.getFixedFlowId()}, new BeanPropertyRowMapper<>(Task.class));
         if (tasks.size() > 0){
             return R.fail("当前流程已经使用,不能修改");
@@ -3536,7 +3545,7 @@ public class TaskController extends BladeController {
     @ApiOperation(value = "计量刪除预设流程", notes = "传入预设流程id")
     public R<Object> deleteFixedFlow(@RequestParam String id) {
         List<Task> tasks = jdbcTemplate
-                .query("SELECT * FROM u_task WHERE is_deleted = 0 AND fixed_flow_id = ? ",
+                .query("SELECT * FROM u_task WHERE is_deleted = 0 and status != 3 AND fixed_flow_id = ? ",
                         new Object[]{id}, new BeanPropertyRowMapper<>(Task.class));
         if (tasks.size() > 0){
             return R.fail("当前流程已经使用,不能删除");
@@ -3566,7 +3575,7 @@ public class TaskController extends BladeController {
             String htmlString = IoUtil.readToString(fileInputStream);
             htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
             htmlString = htmlString.replaceAll("title", "titlexx");
-            // 远程搜索配置
+            // 获取表单字符串返回
             org.jsoup.nodes.Document doc = Jsoup.parse(htmlString);
             Element table = doc.select("table").first();
 
@@ -3576,17 +3585,12 @@ public class TaskController extends BladeController {
         }
     }
 
-    public String getEntrustPDFTrial(Long projectId,String contractId,Long pkeyId,Map<String, Object> DataInfo, Map<Long,String> flowIds) throws Exception {
+    public String getEntrustPDFTrial( WbsTreePrivate aPrivate,String contractId,Map<String, Object> DataInfo, Map<Long,String> flowIds) throws Exception {
         String file_path = FileUtils.getSysLocalFileUrl();//ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
         String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
-        R r = wbsTreePrivateClient.getProjectOpinionNode(projectId);
-        if (r.getCode() != 200){
-            throw new ServiceException(r.getMsg());
-        }
-        WbsTreePrivate aPrivate = (WbsTreePrivate) r.getData();
-
-        String pdfPath = file_path + "/pdf//" + pkeyId + ".pdf";
-        String excelPath = file_path + "/pdf//" + pkeyId + ".xlsx";
+        Long pkeyId = aPrivate.getPKeyId();
+        String pdfPath = file_path + "archiveCheck/" + SnowFlakeUtil.getId() + ".pdf";
+        String excelPath = file_path + "archiveCheck/" + SnowFlakeUtil.getId() + ".xlsx";
 
         File tabPdf = ResourceUtil.getFile(pdfPath);
         if (tabPdf.exists()) {

+ 2 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractMeterPeriodMapper.java

@@ -43,4 +43,6 @@ public interface ContractMeterPeriodMapper extends BaseMapper<ContractMeterPerio
     List<ContractMeterPeriodVO> allPeriod(@Param("contractId")Long contractId);
 
     BigDecimal getBeforeMoney(@Param("period") ContractMeterPeriod period);
+
+    String getContractNumber(@Param("contractId") Long contractId);
 }

+ 3 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/mapper/ContractMeterPeriodMapper.xml

@@ -52,6 +52,9 @@
             (select id from s_contract_meter_period
                        where  project_id = #{period.projectId} and contract_id = #{period.contractId} and approve_status = 2 and sort &lt; #{period.sort})
     </select>
+    <select id="getContractNumber" resultType="java.lang.String">
+        SELECT contract_number from m_contract_info WHERE id = #{contractId}
+    </select>
 
 
 </mapper>

+ 2 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/service/IContractMeterPeriodService.java

@@ -42,4 +42,6 @@ public interface IContractMeterPeriodService extends BaseService<ContractMeterPe
     List<ContractMeterPeriodVO> allPeriod(Long contractId);
 
     List<ContractMeterPeriod> conditionPeriod(Long contractId);
+
+    String getContractNumber(Long contractId);
 }

+ 10 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/service/impl/ContractMeterPeriodServiceImpl.java

@@ -20,6 +20,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.commons.lang.StringUtils;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.mp.support.Query;
 import org.springblade.meter.dto.ContractMeterPeriodDTO;
@@ -121,4 +122,13 @@ public class ContractMeterPeriodServiceImpl extends BaseServiceImpl<ContractMete
     public List<ContractMeterPeriod> conditionPeriod(Long contractId) {
         return baseMapper.conditionPeriod(contractId);
     }
+
+    @Override
+    public String getContractNumber(Long contractId) {
+        String number = baseMapper.getContractNumber(contractId);
+        if (StringUtils.isBlank(number)){
+            throw new ServiceException("未获取到合同编号");
+        }
+        return number;
+    }
 }

+ 30 - 1
blade-service/blade-meter/src/main/java/org/springblade/meter/utils/FileUtils.java

@@ -1,15 +1,23 @@
 package org.springblade.meter.utils;
 
 import com.aspose.cells.SaveFormat;
+import org.apache.commons.lang.StringUtils;
 import org.apache.poi.hssf.usermodel.HSSFPrintSetup;
 import org.apache.poi.xssf.usermodel.XSSFPrintSetup;
 import org.apache.poi.xssf.usermodel.XSSFSheet;
 import org.apache.poi.xssf.usermodel.XSSFWorkbook;
+import org.jsoup.Jsoup;
+import org.jsoup.nodes.Document;
+import org.jsoup.nodes.Element;
+import org.jsoup.select.Elements;
 import org.springblade.common.constant.CommonConstant;
 import org.springblade.common.utils.SystemUtils;
+import org.springblade.core.log.exception.ServiceException;
 import org.springblade.system.cache.ParamCache;
 
 import java.io.*;
+import java.util.HashMap;
+import java.util.Map;
 
 /**
  * @Param
@@ -97,5 +105,26 @@ public class FileUtils {
             }
         }
     }
-
+    /**
+     * 从表单html中提取出所有的placeholder 和其所对应的 keyname
+     */
+    public static Map<String,String> getHtmlAllKey(String htmlFileUrl){
+        Map<String,String> map = new HashMap<>();
+        try {
+            File file = new File(htmlFileUrl);
+            Document doc = Jsoup.parse(file, "utf-8");
+            Elements tds = doc.getElementsByTag("td");
+            for (Element td : tds) {
+                Elements keyname = td.getElementsByAttribute("keyname");
+                String string = keyname.attr("keyname");
+                if (StringUtils.isNotBlank(string)) {
+                    System.out.println(string);
+                    map.put(keyname.attr("placeholder").replaceAll("\\s", ""), keyname.attr("keyname"));
+                }
+            }
+            return map;
+        }catch (Exception e){
+            throw new ServiceException("解析HTML中key出错");
+        }
+    }
 }