Forráskód Böngészése

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

yangyj 1 éve
szülő
commit
6709997120

+ 17 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/dto/TableSortDTO.java

@@ -0,0 +1,17 @@
+package org.springblade.manager.dto;
+
+import lombok.Data;
+
+/**
+ * @Param
+ * @Author wangwl
+ * @Date 2024/6/18 11:55
+ **/
+@Data
+public class TableSortDTO {
+    private String ids;
+    private String contractId;
+    private String nodeIds;
+    private String classify;
+    private String projectId;
+}

+ 25 - 4
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreeContractController.java

@@ -4,8 +4,6 @@ import com.aspose.cells.LoadFormat;
 import com.aspose.cells.LoadOptions;
 import com.aspose.cells.SaveFormat;
 import com.aspose.cells.Workbook;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import com.google.common.collect.Lists;
@@ -33,6 +31,7 @@ import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.IoUtil;
 import org.springblade.core.tool.utils.ObjectUtil;
 import org.springblade.core.tool.utils.ResourceUtil;
+import org.springblade.manager.dto.TableSortDTO;
 import org.springblade.manager.dto.WbsTreeContractDTO2;
 import org.springblade.manager.entity.ContractInfo;
 import org.springblade.manager.entity.WbsTreeContract;
@@ -42,8 +41,6 @@ import org.springblade.manager.service.IWbsTreeContractService;
 import org.springblade.manager.service.impl.WbsTreeContractServiceImpl;
 import org.springblade.manager.utils.FileUtils;
 import org.springblade.manager.vo.*;
-import org.springblade.meter.entity.MiddleMeterApply;
-import org.springblade.resource.feign.NewIOSSClient;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
@@ -83,6 +80,8 @@ public class WbsTreeContractController extends BladeController {
     private final ContractClient contractClient;
     private static Logger logger = LoggerFactory.getLogger(WbsTreeContractController.class);
 
+    private final ExcelTabController excelTabController;
+
     @GetMapping("/search-node-tables")
     @ApiOperationSupport(order = 1)
     @ApiOperation(value = "查询当前节点下所有元素表信息", notes = "传入节点primaryKeyId、type、合同段id、项目id")
@@ -735,4 +734,26 @@ public class WbsTreeContractController extends BladeController {
          return R.success("成功");
     }
 
+
+    @PostMapping("/table-sort")
+    @ApiOperationSupport(order = 42)
+    @ApiOperation(value = "表单排序", notes = "传入ids")
+    @ApiImplicitParams(value = {
+            @ApiImplicitParam(name = "ids", value = "节点pKeyId,按顺序逗号拼接", required = true),
+            @ApiImplicitParam(name = "contractId", value = "contractId", required = true),
+            @ApiImplicitParam(name = "nodeIds", value = "nodeIds", required = true),
+            @ApiImplicitParam(name = "classify", value = "classify", required = true),
+            @ApiImplicitParam(name = "projectId", value = "projectId", required = true)
+    })
+    public R tableSort(@RequestBody TableSortDTO dto) {
+        //生成PDF失败不影响排序
+        wbsTreeContractServiceImpl.tableSort(dto);
+        try {
+            excelTabController.synPDFInfo(dto.getContractId(),dto.getNodeIds(),dto.getClassify(),dto.getProjectId());
+        }catch (Exception e){
+            return R.fail("重新生成PDF失败:"+e.getMessage());
+        }
+        return R.success("成功");
+    }
+
 }

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

@@ -107,4 +107,5 @@ public interface WbsTreeContractMapper extends EasyBaseMapper<WbsTreeContract> {
 
     void updateIsPId(@Param("map") Map<Long, Long> map);
 
+    void tableSort(@Param("map") Map<Long, Integer> map);
 }

+ 9 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreeContractMapper.xml

@@ -730,6 +730,15 @@
             where p_key_id = #{key}
         </foreach>
     </update>
+    <update id="tableSort">
+        <foreach item="value" collection="map" index="key" separator=";">
+            UPDATE m_wbs_tree_contract
+            <set>
+                sort = #{value}
+            </set>
+            where p_key_id = #{key}
+        </foreach>
+    </update>
 
     <select id="selectQueryValueLikeNodeName" resultMap="ResultMap">
         select *

+ 16 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

@@ -32,6 +32,7 @@ import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.node.ForestNodeMerger;
 import org.springblade.core.tool.utils.*;
 import org.springblade.manager.bean.NodeVO;
+import org.springblade.manager.dto.TableSortDTO;
 import org.springblade.manager.dto.RangeInfo;
 import org.springblade.manager.dto.WbsTreeContractDTO;
 import org.springblade.manager.dto.WbsTreeContractDTO2;
@@ -53,7 +54,6 @@ import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.LinkedCaseInsensitiveMap;
-import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.multipart.MultipartFile;
 
 import javax.servlet.http.HttpServletRequest;
@@ -2354,4 +2354,19 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
         redisTemplate.delete("blade-manager::contract:wbstree:*");
         return R.success("操作成功");
     }
+
+    public void tableSort(TableSortDTO dto) {
+        String ids = dto.getIds();
+        if (StringUtils.isNotBlank(ids)) {
+            List<Long> split = Func.toLongList(ids);
+            int sort = 1;
+            Map<Long,Integer> map = new HashMap<>();
+            for (Long id : split) {
+                map.put(id,sort++);
+            }
+            baseMapper.tableSort(map);
+        }else {
+            throw new ServiceException("请传入ids");
+        }
+    }
 }

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

@@ -36,6 +36,7 @@ import org.springblade.meter.entity.InterimPayCertificate;
 import org.springblade.meter.entity.MeterPeriod;
 import org.springblade.meter.service.IContractMaterialAdjustService;
 import org.springblade.meter.service.IInterimPayCertificateService;
+import org.springblade.meter.utils.StringUtils;
 import org.springblade.meter.vo.ContractMeterPeriodVO;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
@@ -109,6 +110,7 @@ public class ContractMeterPeriodController extends BladeController {
 					return R.fail("有计量期已经关联材料调差,无法删除");
 				}
 			}
+			String contractNumber = contractMeterPeriodService.getContractNumber(dto.getContractId());
 			//存在数据,先删再存,循环排序
 			contractMeterPeriodService.removeByContrId(dto.getContractId());
 			LocalDate lastDate = null;
@@ -130,6 +132,7 @@ public class ContractMeterPeriodController extends BladeController {
 				}
 				lastDate = period.getEndDate();
 				period.setSort(i);
+				period.setPayNumber(contractNumber + "-" +StringUtils.padZeroToFront(period.getPeriodNumber(),3));
 
 				InterimPayCertificate interimPayCertificate = this.interimPayCertificateService.getOne(Wrappers.<InterimPayCertificate>lambdaQuery().eq(InterimPayCertificate::getContractPeriodId, period.getId()));
 				if (interimPayCertificate != null) {

+ 170 - 115
blade-service/blade-meter/src/main/java/org/springblade/meter/controller/TaskController.java

@@ -1324,7 +1324,7 @@ public class TaskController extends BladeController {
                             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");
+//                            Map<String, String> map = FileUtils.getHtmlAllKey("C:\\Users\\泓创研发01\\Desktop\\fsdownload\\1802649593746292736.html");
                             if (map.size() == 0){
                                 throw new ServiceException("未获取到html中的keyName");
                             }
@@ -2451,7 +2451,7 @@ public class TaskController extends BladeController {
         String html = this.getExcelHtmlByBuss(Long.valueOf(task.getProjectId()));
         if (html != null) {
             if (task.getMeterTaskType() != null && task.getMeterTaskType() == 1) {
-                //判断当前用户所属流程,只处理第一流程
+                //判断当前用户所属流程,只处理审计流程
                 Integer currentUserFlow = null;
                 Integer auditFlow = null;
                 Boolean isDefiniteFlow = false;
@@ -2482,7 +2482,7 @@ public class TaskController extends BladeController {
                     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");
+//                    Map<String, String> map = FileUtils.getHtmlAllKey("C:\\Users\\泓创研发01\\Desktop\\fsdownload\\1802649593746292736.html");
                     if (map.size() == 0){
                         throw new ServiceException("未获取到html中的keyName");
                     }
@@ -2511,6 +2511,26 @@ public class TaskController extends BladeController {
                             isAllApp = true;
                         }
                     }
+                    //任务
+                    Task updateTask = new Task();
+                    updateTask.setId(task.getId());
+                    Map<String, Object> tableData = dto.getTableData();
+                    Object object = tableData.get(map.get("造价机构现场咨询意见_本期审核进度款(元)"));
+                    if (object != null) {
+                        try {
+                            BigDecimal decimal = new BigDecimal(object.toString());
+                            updateTask.setTaskCommonMoney(decimal);
+                            Object object2 = tableData.get(map.get("造价机构现场咨询意见_截止上期已累计审批进度款(元)"));
+                            if (object2 != null) {
+                                BigDecimal decimal2 = new BigDecimal(object2.toString());
+                                tableData.put(map.get("造价机构现场咨询意见_截止上期已累计审批进度款(元)_截止本期已累计审核进度款(元)"), decimal.add(decimal2));
+                            } else {
+                                tableData.put(map.get("造价机构现场咨询意见_截止上期已累计审批进度款(元)_截止本期已累计审核进度款(元)"), decimal);
+                            }
+                        } catch (Exception e) {
+                            throw new ServiceException("本期审核进度款格式不对");
+                        }
+                    }
                     //保存数据到m表
                     String delSql = "delete from " + aPrivate.getInitTableName() + " where p_key_id=" + task.getId();
                     jdbcTemplate.execute(delSql);
@@ -2537,26 +2557,6 @@ public class TaskController extends BladeController {
                     sqlInfo = sqlInfo + keyStr + ") VALUES (" + valStr + ")";
                     jdbcTemplate.execute(sqlInfo);
 
-                    //任务
-                    Task updateTask = new Task();
-                    updateTask.setId(task.getId());
-                    Map<String, Object> tableData = dto.getTableData();
-                    Object object = tableData.get(map.get("造价机构现场咨询意见_本期审核进度款(元)"));
-                    if (object != null) {
-                        try {
-                            BigDecimal decimal = new BigDecimal(object.toString());
-                            updateTask.setTaskCommonMoney(decimal);
-                            Object object2 = tableData.get(map.get("造价机构现场咨询意见_截止上期已累计审批进度款(元)"));
-                            if (object2 != null) {
-                                BigDecimal decimal2 = new BigDecimal(object2.toString());
-                                tableData.put(map.get("造价机构现场咨询意见_截止上期已累计审批进度款(元)_截止本期已累计审核进度款(元)"), decimal.add(decimal2));
-                            } else {
-                                tableData.put(map.get("造价机构现场咨询意见_截止上期已累计审批进度款(元)_截止本期已累计审核进度款(元)"), decimal);
-                            }
-                        } catch (Exception e) {
-                            throw new ServiceException("本期审核进度款格式不对");
-                        }
-                    }
                     //如果为第一流程则判断是否当前流程已全部审批,已经全部审批则生成电签PDF,没有全部审批则只保存数据
                     if (isAllApp) {
                         //要求付款额度
@@ -2571,6 +2571,8 @@ public class TaskController extends BladeController {
                             throw new ServiceException("未找到流程人信息");
                         }
                         tableData.put(map.get("项目名称:"), projectClient.getById(task.getProjectId()).getProjectName() + contractClient.getContractById(Long.valueOf(task.getContractId())).getContractName());
+                        //申请书收到时间
+                        tableData.put(map.get("申请书收到时间:"), DateTimeFormatter.ofPattern("yyyy年MM月dd日").format(LocalDate.now()));
                         //申请进度时间
                         tableData.put(map.get("申请进度款摘录_摘录人_时间"), DateTimeFormatter.ofPattern("yyyy年MM月dd日").format(LocalDate.now()));
                         //电签单位日期
@@ -3559,15 +3561,25 @@ public class TaskController extends BladeController {
 
         R<WbsTreePrivate> r = wbsTreePrivateClient.getProjectOpinionNode(projectId);
         if (r.getCode() != 200){
-//            throw new ServiceException(r.getMsg());
             //如果没有节点或者清单,直接判断不需要
             return null;
         }
+        Set<String> strings = new HashSet<>();
+        strings.add("项目名称:");
+        strings.add("申请书收到时间:");
+        strings.add("意见发出日期:");
+        strings.add("申请进度款摘录_摘录人_时间");
+        strings.add("造价机构现场咨询意见_截止上期已累计审批进度款(元)");
+        strings.add("造价机构现场咨询意见_截止上期已累计审批进度款(元)_截止本期已累计审核进度款(元)");
+        strings.add("造价机构现场咨询意见_现场造价人员");
+        strings.add("造价机构现场咨询意见_现场造价人员_负责人");
+        strings.add("建设单位签收");
+        strings.add("建设单位签收_日期");
         WbsTreePrivate aPrivate = r.getData();
         String fileUrl = null;
         String os = System.getProperty("os.name").toLowerCase();
         if (os.contains("win")) {
-            fileUrl = "C:\\Users\\泓创研发01\\Desktop\\fsdownload\\1789967486389583872.html";
+            fileUrl = "C:\\Users\\泓创研发01\\Desktop\\fsdownload\\1802649593746292736.html";
         } else {
             fileUrl = aPrivate.getHtmlUrl();
         }
@@ -3578,7 +3590,19 @@ public class TaskController extends BladeController {
             // 获取表单字符串返回
             org.jsoup.nodes.Document doc = Jsoup.parse(htmlString);
             Element table = doc.select("table").first();
-
+            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);
+                    String name = keyname.attr("placeholderxx").replaceAll("\\s", "");
+                    if (strings.contains(name)){
+                        td.attr("gscolor","11");
+                        keyname.attr("disabled","");
+                    }
+                }
+            }
             return table+"";
         } catch (Exception e) {
            throw new ServiceException("解析咨询意见表单时发生异常");
@@ -3613,7 +3637,7 @@ public class TaskController extends BladeController {
         //数据不为空,构造数据
         String fileUrl = aPrivate.getHtmlUrl();
         File file1 = ResourceUtil.getFile(fileUrl);
-//        File file1 = ResourceUtil.getFile("C:\\Users\\泓创研发01\\Desktop\\fsdownload\\1789967486389583872.html");
+//        File file1 = ResourceUtil.getFile("C:\\Users\\泓创研发01\\Desktop\\fsdownload\\1802649593746292736.html");
         InputStream fileInputStream;
         if (file1.exists()) {
             fileInputStream = new FileInputStream(file1);
@@ -3632,6 +3656,57 @@ public class TaskController extends BladeController {
 
         //实际电签人
         Set<User> sigUser = new HashSet<>();
+        List<TextdictInfo> infoList = jdbcTemplate.query("select * from m_textdict_info where type in (2,6) and tab_id = " + aPrivate.getPKeyId(), new BeanPropertyRowMapper<>(TextdictInfo.class));
+        if (infoList.size() == 0){
+            throw new ServiceException("未找到审计意见的电签配置");
+        }
+        List<TextdictInfo> textdictInfos = infoList.stream().filter(l->l.getType() == 2).collect(Collectors.toList());
+        List<TextdictInfo> companyList = infoList.stream().filter(l->l.getType() == 6).collect(Collectors.toList());
+        Map<String, TextdictInfo> roleMap = new HashMap<>();
+        Map<Long,String> htmlDeptIdMap = new HashMap<>();
+
+        // 组装个人电签设置
+        if (textdictInfos != null && !textdictInfos.isEmpty()) {
+            //校验是否每个位置都能找到对应的人
+            List<String> roleIds = textdictInfos.stream().map(l -> l.getSigRoleId()).collect(Collectors.toList());
+            try {
+                roleMap = textdictInfos.stream().collect(Collectors.toMap(l -> l.getSigRoleId(), l -> l));
+            }catch (Exception e){
+                throw new ServiceException("在审计咨询意见表单中,电签位置不能配置相同角色");
+            }
+
+            //获取这些人资料合同段下的权限
+            List<JSONObject> userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(new ArrayList<>(flowIds.keySet()), contractId);
+            if (userRoleList == null || userRoleList.size() == 0) {
+                throw new ServiceException("电签时未找到审批人在合同段下的权限");
+            }
+            //确保每一个配置了电签的位置都能签名,并且设置好DQID和实际电签信息之间的映射关系,以便在HTML中写入
+            for (String roleId : roleIds) {
+                boolean isRole = true;
+                for (JSONObject userRole : userRoleList) {
+                    if (roleId.contains(userRole.getString("roleId"))) {
+                        List<User> userInfo = jdbcTemplate.query("select * from blade_user WHERE id =" + userRole.getString("userId"),new BeanPropertyRowMapper<>(User.class));
+                        if (userInfo.size() != 1){
+                            throw new ServiceException("未找到"+flowIds.get(Long.valueOf(userRole.getString("roleId")))+"的用户信息");
+                        }
+                        User user = userInfo.get(0);
+                        sigUser.add(user);
+                        htmlDeptIdMap.put(roleMap.get(roleId).getId(),user.getName()+user.getPhone().substring(0,3));
+                        isRole = false;
+                        break;
+                    }
+                }
+                if (isRole){
+                    throw new ServiceException("当前审批人中,不存在:"+roleMap.get(roleId).getSigRoleName()+",无法电签,请查看后台配置");
+                }
+            }
+        }
+        //组装企业电签设置
+        if (companyList.size() != 0){
+            for (TextdictInfo textdictInfo : companyList) {
+                htmlDeptIdMap.put(textdictInfo.getId(),textdictInfo.getSigRoleName()+"123");
+            }
+        }
 
         if (ObjectUtil.isNotEmpty(DataInfo)) {
             for (String val : Objects.requireNonNull(DataInfo).keySet()) {
@@ -3728,96 +3803,53 @@ public class TaskController extends BladeController {
                         }
                     }
                 }
-
-                // 组装电签设置
-                List<TextdictInfo> textdictInfos = jdbcTemplate.query("select * from m_textdict_info where type in (2,6) and tab_id = " + aPrivate.getPKeyId(), new BeanPropertyRowMapper<>(TextdictInfo.class));
-                if (textdictInfos != null && !textdictInfos.isEmpty()) {
-                    //校验是否每个位置都能找到对应的人
-                    List<String> roleIds = textdictInfos.stream().map(l -> l.getSigRoleId()).collect(Collectors.toList());
-                    Map<String, TextdictInfo> roleMap = new HashMap<>();
-                    try {
-                        roleMap = textdictInfos.stream().collect(Collectors.toMap(l -> l.getSigRoleId(), l -> l));
-                    }catch (Exception e){
-                        throw new ServiceException("在审计咨询意见表单中,电签位置不能配置相同角色");
-                    }
-
-                    //获取这些人资料合同段下的权限
-                    List<JSONObject> userRoleList = this.saveUserInfoByProjectClient.queryUserContractRole(new ArrayList<>(flowIds.keySet()), contractId);
-                    if (userRoleList == null || userRoleList.size() == 0) {
-                        throw new ServiceException("电签时未找到审批人在合同段下的权限");
-                    }
-                    Map<Long,String> htmlDeptIdMap = new HashMap<>();
-                    //确保每一个配置了电签的位置都能签名,并且设置好DQID和实际电签信息之间的映射关系,以便在HTML中写入
-                    for (String roleId : roleIds) {
-                        boolean isRole = true;
-                        for (JSONObject userRole : userRoleList) {
-                            if (roleId.contains(userRole.getString("roleId"))) {
-                                List<User> userInfo = jdbcTemplate.query("select * from blade_user WHERE id =" + userRole.getString("userId"),new BeanPropertyRowMapper<>(User.class));
-                                if (userInfo.size() != 1){
-                                    throw new ServiceException("未找到"+flowIds.get(Long.valueOf(userRole.getString("roleId")))+"的用户信息");
-                                }
-                                User user = userInfo.get(0);
-                                sigUser.add(user);
-                                htmlDeptIdMap.put(roleMap.get(roleId).getId(),user.getName()+user.getPhone().substring(0,3));
-                                isRole = false;
-                                break;
-                            }
+            }
+        }
+        //修改输入框里面的值为电签标识
+        for (TextdictInfo e : infoList) {
+            String key = e.getColKey();
+            String[] keys = key.split("__");
+            String[] trtd = keys[1].split("_");
+            if (Integer.parseInt(trtd[0]) < trs.size()) {
+                Element ytzData = trs.get(Integer.parseInt(trtd[0]));
+                if (ytzData != null) {
+                    Elements tdsx = ytzData.select("td");
+                    if (Integer.parseInt(trtd[1]) < tdsx.size()) {
+                        Element data = ytzData.select("td").get(Integer.parseInt(trtd[1]));
+                        if (data.html().contains("el-tooltip")) {
+                            data = data.children().get(0);
                         }
-                        if (isRole){
-                            throw new ServiceException("当前审批人中,不存在:"+roleMap.get(roleId).getSigRoleName()+",无法电签,请查看后台配置");
+                        Elements children = data.children();
+                        Element element = children.get(0);
+                        int x1 = Integer.parseInt(data.children().get(0).attr("x1"));
+                        if (x1 == 0) {
+                            x1 = 1;
                         }
-                    }
+                        int y1 = Integer.parseInt(data.children().get(0).attr("y1"));
 
-                    //修改输入框里面的值为电签标识
-                    for (TextdictInfo e : textdictInfos) {
-                        String key = e.getColKey();
-                        String[] keys = key.split("__");
-                        String[] trtd = keys[1].split("_");
-                        if (Integer.parseInt(trtd[0]) < trs.size()) {
-                            Element ytzData = trs.get(Integer.parseInt(trtd[0]));
-                            if (ytzData != null) {
-                                Elements tdsx = ytzData.select("td");
-                                if (Integer.parseInt(trtd[1]) < tdsx.size()) {
-                                    Element data = ytzData.select("td").get(Integer.parseInt(trtd[1]));
-                                    if (data.html().contains("el-tooltip")) {
-                                        data = data.children().get(0);
-                                    }
-                                    Elements children = data.children();
-                                    Element element = children.get(0);
-                                    int x1 = Integer.parseInt(data.children().get(0).attr("x1"));
-                                    if (x1 == 0) {
-                                        x1 = 1;
-                                    }
-                                    int y1 = Integer.parseInt(data.children().get(0).attr("y1"));
-
-                                    Row row = sheet.getRow(y1 - 1);
-                                    if (row != null) {
-                                        Cell cell = sheet.getRow(y1 - 1).getCell(x1 - 1);
-                                        if (cell != null) {
-                                            short fontIndex = cell.getCellStyle().getFontIndex();
-                                            Font oldfontAt = workbook.getFontAt(fontIndex);
-
-                                            Font redFont = workbook.createFont();
-                                            redFont.setColor(IndexedColors.WHITE.getIndex()); //设置字体颜色
-                                            redFont.setFontHeightInPoints(oldfontAt.getFontHeightInPoints());//设置字体大小
-                                            redFont.setFontName(oldfontAt.getFontName());//设置字体
-
-                                            CellStyle newStyle = workbook.createCellStyle(); //创建单元格样式
-                                            newStyle.cloneStyleFrom(cell.getCellStyle());
-                                            newStyle.setFont(redFont);
-                                            cell.setCellStyle(newStyle);
-                                            String sig = htmlDeptIdMap.get(e.getId());
-                                            cell.setCellValue(sig);
-                                        } else {
-                                            ObjectUtils.isNotEmpty(cell);
-                                        }
-                                    }
-                                }
+                        Row row = sheet.getRow(y1 - 1);
+                        if (row != null) {
+                            Cell cell = sheet.getRow(y1 - 1).getCell(x1 - 1);
+                            if (cell != null) {
+                                short fontIndex = cell.getCellStyle().getFontIndex();
+                                Font oldfontAt = workbook.getFontAt(fontIndex);
+
+                                Font redFont = workbook.createFont();
+                                redFont.setColor(IndexedColors.WHITE.getIndex()); //设置字体颜色
+                                redFont.setFontHeightInPoints(oldfontAt.getFontHeightInPoints());//设置字体大小
+                                redFont.setFontName(oldfontAt.getFontName());//设置字体
+
+                                CellStyle newStyle = workbook.createCellStyle(); //创建单元格样式
+                                newStyle.cloneStyleFrom(cell.getCellStyle());
+                                newStyle.setFont(redFont);
+                                cell.setCellStyle(newStyle);
+                                String sig = htmlDeptIdMap.get(e.getId());
+                                cell.setCellValue(sig);
+                            } else {
+                                ObjectUtils.isNotEmpty(cell);
                             }
                         }
                     }
-                }else {
-                    throw new ServiceException("未找到审计意见的电签配置");
                 }
             }
         }
@@ -3825,8 +3857,6 @@ public class TaskController extends BladeController {
         //输出流
         FileOutputStream outputStream = new FileOutputStream(excelPath);
 
-
-
         workbook.write(outputStream);
 
         FileUtils.setExcelScaleToPdf(excelPath, pdfPath);
@@ -3834,7 +3864,7 @@ public class TaskController extends BladeController {
 
         if (bladeFile != null) {
             //获取所有专家个人证书
-            List<SignPfxFile> list = jdbcTemplate.query(" select * from m_sign_pfx_file where is_deleted = 0 and certificate_user_id in ("+sigUser.stream().map(User::getId).distinct().map(Objects::toString).collect(Collectors.joining(",")) +")", new BeanPropertyRowMapper<>(SignPfxFile.class));
+            List<SignPfxFile> list = jdbcTemplate.query(" select * from m_sign_pfx_file where is_deleted = 0  and certificate_user_id in ("+sigUser.stream().map(User::getId).distinct().map(Objects::toString).collect(Collectors.joining(",")) +")", new BeanPropertyRowMapper<>(SignPfxFile.class));
             if (list.size() == 0 || list.size() != sigUser.size()){
                 throw new ServiceException("有签字人没有配置电签,请联系管理员");
             }
@@ -3857,11 +3887,36 @@ public class TaskController extends BladeController {
                 info.setSigPic(file.getSignatureFileUrl());
                 infos.add(info);
             }
+            //如果存在配置企业电签,则需要获取企业证书
+            if (companyList.size() > 0) {
+                //获取企业当前合同段所有证书
+                List<SignPfxFile> allCompany = jdbcTemplate.query(" SELECT * from m_sign_pfx_file WHERE is_deleted = 0 and is_register = 1 and project_contract_role like '%"+contractId+"%'", new BeanPropertyRowMapper<>(SignPfxFile.class));
+                for (TextdictInfo textdictInfo : companyList) {
+                    List<SignPfxFile> certificates = allCompany.stream().filter(l->textdictInfo.getSigRoleId().equals(l.getPfxType())).collect(Collectors.toList());
+                    if (certificates.size() == 0){
+                        throw new ServiceException("未获取到:"+textdictInfo.getSigRoleName());
+                    }else if (certificates.size() > 1){
+                        throw new ServiceException("获取到多个:"+textdictInfo.getSigRoleName());
+                    }
+                    SignPfxFile file = certificates.get(0);
+                    if (StringUtils.isBlank(file.getSignatureFileUrl())){
+                        throw new ServiceException("未获取到:"+textdictInfo.getSigRoleName()+"的签字图片");
+                    }
+                    SigInfoVO.SigInfo info = new SigInfoVO.SigInfo();
+                    info.setUserName(file.getCertificateUserName());
+                    info.setUserSig(textdictInfo.getSigRoleName()+"123");
+                    info.setSealCode("S_NEW_"+file.getId());
+                    info.setSealPassword(file.getCertificatePassword());
+                    info.setSigPic(file.getSignatureFileUrl());
+                    infos.add(info);
+                }
+            }
+
             vo.setList(infos);
             vo.setPdfUrl(bladeFile.getLink());
             R<String> r1 = eVisaClient.batchEVisa(vo);
             if (r1.getCode() != 200 || StringUtils.isBlank(r1.getData())){
-                throw new ServiceException("咨询意见PDF电签时失败");
+                throw new ServiceException("咨询意见PDF电签时失败:"+r1.getMsg());
             }
             return r1.getData();
         }else {

+ 25 - 0
blade-service/blade-meter/src/main/java/org/springblade/meter/utils/StringUtils.java

@@ -0,0 +1,25 @@
+package org.springblade.meter.utils;
+
+/**
+ * @Param
+ * @Author wangwl
+ * @Date 2024/6/18 13:47
+ **/
+public class StringUtils {
+    public static String padZeroToFront(String originalStr, int minLength) {
+        if (originalStr == null) {
+            originalStr = "";
+        }
+        int strLen = originalStr.length();
+        if (strLen < minLength) {
+            StringBuilder sb = new StringBuilder(minLength);
+            for (int i = 0; i < minLength - strLen; i++) {
+                sb.append('0');
+            }
+            sb.append(originalStr);
+            return sb.toString();
+        } else {
+            return originalStr;
+        }
+    }
+}