|
@@ -3,6 +3,7 @@ package org.springblade.meter.controller;
|
|
|
|
|
|
import cn.hutool.log.StaticLog;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import com.aspose.cells.PageSetup;
|
|
|
import com.aspose.cells.SaveFormat;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
@@ -55,10 +56,7 @@ import org.springblade.evisa.feign.EVisaClient;
|
|
|
import org.springblade.evisa.vo.SigInfoVO;
|
|
|
import org.springblade.feign.ArchiveFileTaskClient;
|
|
|
import org.springblade.manager.entity.*;
|
|
|
-import org.springblade.manager.feign.ExcelTabClient;
|
|
|
-import org.springblade.manager.feign.FormulaClient;
|
|
|
-import org.springblade.manager.feign.ProjectClient;
|
|
|
-import org.springblade.manager.feign.WbsTreePrivateClient;
|
|
|
+import org.springblade.manager.feign.*;
|
|
|
import org.springblade.manager.vo.ReportMergeCellsConfig;
|
|
|
import org.springblade.manager.vo.ReportResult;
|
|
|
import org.springblade.meter.config.MyJdbcTemplate;
|
|
@@ -99,6 +97,8 @@ import java.util.concurrent.ExecutionException;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
+import static org.bouncycastle.asn1.x500.style.RFC4519Style.o;
|
|
|
+
|
|
|
@RestController
|
|
|
@AllArgsConstructor
|
|
|
@RequestMapping("/task")
|
|
@@ -107,6 +107,7 @@ public class TaskController extends BladeController {
|
|
|
|
|
|
|
|
|
private final ProjectClient projectClient;
|
|
|
+ private final ContractClient contractClient;
|
|
|
private final JdbcTemplate jdbcTemplate;
|
|
|
private final MyJdbcTemplate myJdbcTemplate;
|
|
|
private final BladeRedis bladeRedis;
|
|
@@ -132,6 +133,7 @@ public class TaskController extends BladeController {
|
|
|
private final WbsTreePrivateClient wbsTreePrivateClient;
|
|
|
private final ExcelTabClient excelTabClient;
|
|
|
private final EVisaClient eVisaClient;
|
|
|
+ private final SaveUserInfoByProjectClient saveUserInfoByProjectClient;
|
|
|
|
|
|
private final ChangeTokenFormServiceImpl changeTokenFormService;
|
|
|
private final ChangeTokenFormServiceTaskImpl changeTokenFormServiceTask;
|
|
@@ -1301,42 +1303,49 @@ public class TaskController extends BladeController {
|
|
|
vo.setReportAllMoney(reportAllMoney);
|
|
|
vo.setProgressMoney(task.getTaskCommonMoney() == null ? BigDecimal.ZERO : task.getTaskCommonMoney());
|
|
|
vo.setPdfUrl(task.getAttachmentPdfUrl());
|
|
|
- //查看当前用户是否在第一流程
|
|
|
- if (currentUserFlow == 1){
|
|
|
- //是第一人,设置意见为1,查询已经填写的值,如果没有则返回默认值
|
|
|
- vo.setOpinionType(1);
|
|
|
- vo.setTableHtml(this.getExcelHtmlByBuss(Long.valueOf(task.getProjectId())));
|
|
|
- R<WbsTreePrivate> r = wbsTreePrivateClient.getProjectOpinionNode(Long.valueOf(task.getProjectId()));
|
|
|
- if (r.getCode() != 200){
|
|
|
- throw new ServiceException(r.getMsg());
|
|
|
- }
|
|
|
- WbsTreePrivate aPrivate = r.getData();
|
|
|
- //实体数据
|
|
|
+ String html = this.getExcelHtmlByBuss(Long.valueOf(task.getProjectId()));
|
|
|
+ if (html != null) {
|
|
|
+ vo.setTableHtml(html);
|
|
|
+ //查看当前用户是否在第一流程
|
|
|
+ if (currentUserFlow == 1) {
|
|
|
+ //是第一人,设置意见为1,查询已经填写的值,如果没有则返回默认值
|
|
|
+ vo.setOpinionType(1);
|
|
|
+ R<WbsTreePrivate> r = wbsTreePrivateClient.getProjectOpinionNode(Long.valueOf(task.getProjectId()));
|
|
|
+ if (r.getCode() != 200) {
|
|
|
+ throw new ServiceException(r.getMsg());
|
|
|
+ }
|
|
|
+ WbsTreePrivate aPrivate = r.getData();
|
|
|
+ //实体数据
|
|
|
// 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());
|
|
|
- tableData.put("key_7__4_3", reportAllMoney);
|
|
|
- tableData.put("key_1__5_3", LocalDate.now());
|
|
|
- tableData.put("key_5__10_1", reportAllMoney);
|
|
|
- //获取本期之前所有计量期金额
|
|
|
- BigDecimal beforeMoney = contractMeterPeriodMapper.getBeforeMoney(period);
|
|
|
- tableData.put("key_14__11_1", beforeMoney == null ? "" : beforeMoney);
|
|
|
- tableData.put("key_10__11_3", beforeMoney == null ? reportAllMoney : beforeMoney.add(reportAllMoney));
|
|
|
- }else {
|
|
|
- tableData = dataInfo;
|
|
|
+ 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", LocalDate.now());
|
|
|
+ tableData.put("key_5__10_1", reportAllMoney);
|
|
|
+ //获取本期之前所有计量期金额
|
|
|
+ BigDecimal beforeMoney = contractMeterPeriodMapper.getBeforeMoney(period);
|
|
|
+ if (beforeMoney != null){
|
|
|
+ tableData.put("key_14__11_1",beforeMoney);
|
|
|
+ }
|
|
|
+ tableData.put("key_10__11_3", beforeMoney == null ? reportAllMoney : beforeMoney.add(reportAllMoney));
|
|
|
+ } else {
|
|
|
+ tableData = dataInfo;
|
|
|
+ }
|
|
|
+ vo.setTableData(tableData);
|
|
|
+ } else {
|
|
|
+ if (StringUtils.isNotBlank(task.getAttachmentPdfUrl())) {
|
|
|
+ vo.setOpinionType(2);
|
|
|
+ } else {
|
|
|
+ //不是第一人,判断PDF是否生成,生成了类型为2,没有生成类型为3
|
|
|
+ vo.setOpinionType(3);
|
|
|
+ }
|
|
|
}
|
|
|
- vo.setTableData(tableData);
|
|
|
}else {
|
|
|
- if (StringUtils.isNotBlank(task.getAttachmentPdfUrl())){
|
|
|
- vo.setOpinionType(2);
|
|
|
- }else {
|
|
|
- //不是第一人,判断PDF是否生成,生成了类型为2,没有生成类型为3
|
|
|
- vo.setOpinionType(3);
|
|
|
- }
|
|
|
+ vo.setOpinionType(3);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2422,82 +2431,58 @@ public class TaskController extends BladeController {
|
|
|
}
|
|
|
|
|
|
private void checkMiddleApp(TaskApproveDTO dto, Task task, List<TaskParallel> taskParallels) {
|
|
|
- if (task.getMeterTaskType() != null && task.getMeterTaskType() == 1){
|
|
|
- //判断当前用户所属流程,只处理第一流程
|
|
|
- int currentUserFlow = 1;
|
|
|
- Boolean isDefiniteFlow = false;
|
|
|
- Boolean isAllApp = false;
|
|
|
- List<FixedFlowLink> query = new ArrayList<>();
|
|
|
- if (task.getFixedFlowId() != null && !task.getFixedFlowId().equals(0L)){
|
|
|
- isDefiniteFlow = true;
|
|
|
- query = jdbcTemplate.query("SELECT * FROM u_fixed_flow_link WHERE fixed_flow_id = ?", new Object[]{task.getFixedFlowId()}, new BeanPropertyRowMapper<>(FixedFlowLink.class));
|
|
|
- //校验当前用户在第几流程
|
|
|
- Integer sort = query.stream().collect(Collectors.toMap(l -> l.getFixedFlowLinkUser(), l -> l.getFixedFlowBranchSort())).get(AuthUtil.getUserId());
|
|
|
- if (sort == null) {
|
|
|
- throw new ServiceException("未获取到当前用户在流程中的信息");
|
|
|
- }
|
|
|
- currentUserFlow = sort;
|
|
|
- }
|
|
|
- if (currentUserFlow == 1){
|
|
|
- //查询出项目审计意见节点的基本信息
|
|
|
- R r = wbsTreePrivateClient.getProjectOpinionNode(Long.valueOf(dto.getProjectId()));
|
|
|
- if (r.getCode() != 200){
|
|
|
- throw new ServiceException(r.getMsg());
|
|
|
- }
|
|
|
- WbsTreePrivate aPrivate = (WbsTreePrivate) r.getData();
|
|
|
- if (isDefiniteFlow) {
|
|
|
- //获取出当前流程中所有用户
|
|
|
- List<String> ids = query.stream()
|
|
|
- .filter(l -> l.getFixedFlowLinkSort() == 1 && !l.getFixedFlowLinkUser().equals(AuthUtil.getUserId()))
|
|
|
- .map(l -> l.getFixedFlowLinkUser() + "")
|
|
|
- .collect(Collectors.toList());
|
|
|
- //根据用户获取这些用户在当前任务中的进度,来判断是否全部审批完成
|
|
|
- long count = taskParallels.stream()
|
|
|
- .filter(l -> ids.contains(l.getTaskUser()))
|
|
|
- .filter(l -> l.getStatus() != 2).count();
|
|
|
- if (count == 0) {
|
|
|
- isAllApp = true;
|
|
|
+ String html = this.getExcelHtmlByBuss(Long.valueOf(task.getProjectId()));
|
|
|
+ if (html != null) {
|
|
|
+ if (task.getMeterTaskType() != null && task.getMeterTaskType() == 1) {
|
|
|
+ //判断当前用户所属流程,只处理第一流程
|
|
|
+ int currentUserFlow = 1;
|
|
|
+ Boolean isDefiniteFlow = false;
|
|
|
+ Boolean isAllApp = false;
|
|
|
+ List<FixedFlowLink> query = new ArrayList<>();
|
|
|
+ if (task.getFixedFlowId() != null && !task.getFixedFlowId().equals(0L)) {
|
|
|
+ isDefiniteFlow = true;
|
|
|
+ query = jdbcTemplate.query("SELECT * FROM u_fixed_flow_link WHERE fixed_flow_id = ?", new Object[]{task.getFixedFlowId()}, new BeanPropertyRowMapper<>(FixedFlowLink.class));
|
|
|
+ //校验当前用户在第几流程
|
|
|
+ Integer sort = query.stream().collect(Collectors.toMap(l -> l.getFixedFlowLinkUser(), l -> l.getFixedFlowBranchSort())).get(AuthUtil.getUserId());
|
|
|
+ if (sort == null) {
|
|
|
+ throw new ServiceException("未获取到当前用户在流程中的信息");
|
|
|
}
|
|
|
- }else {
|
|
|
- long count = taskParallels.stream()
|
|
|
- .filter(l->!l.getTaskUser().equals(AuthUtil.getUserId()+""))
|
|
|
- .filter(l -> l.getStatus() != 2).count();
|
|
|
- if (count == 0) {
|
|
|
- isAllApp = true;
|
|
|
- }
|
|
|
- }
|
|
|
- Task updateTask = new Task();
|
|
|
- updateTask.setId(task.getId());
|
|
|
- Map<String, Object> tableData = dto.getTableData();
|
|
|
- Object object = tableData.get("key_5__10_1");
|
|
|
- if (object != null) {
|
|
|
- try {
|
|
|
- updateTask.setTaskCommonMoney(new BigDecimal(object.toString()));
|
|
|
- }catch (Exception e){
|
|
|
- throw new ServiceException("本期审核进度款格式不对");
|
|
|
- }
|
|
|
- }
|
|
|
- //如果为第一流程则判断是否当前流程已全部审批,已经全部审批则生成电签PDF,没有全部审批则只保存数据
|
|
|
- if (isAllApp){
|
|
|
- //要求付款额度
|
|
|
- //本期审核进度款
|
|
|
- //截至上期累计进度款
|
|
|
- //截至本期累计进度款
|
|
|
- String pdfUrl = "";
|
|
|
- try {
|
|
|
- pdfUrl = getEntrustPDFTrial(Long.valueOf(dto.getProjectId()), aPrivate.getPKeyId(), tableData);
|
|
|
- } catch (Exception e) {
|
|
|
- throw new ServiceException("生成咨询意见PDF时失败:"+e.getMessage());
|
|
|
+ currentUserFlow = sort;
|
|
|
+ }
|
|
|
+ if (currentUserFlow == 1) {
|
|
|
+ //当前流程所有用户id,后面PDF权限校验
|
|
|
+ Map<Long, String> flowIds = new HashMap<>();
|
|
|
+ //查询出项目审计意见节点的基本信息
|
|
|
+ R r = wbsTreePrivateClient.getProjectOpinionNode(Long.valueOf(dto.getProjectId()));
|
|
|
+ if (r.getCode() != 200) {
|
|
|
+ throw new ServiceException(r.getMsg());
|
|
|
}
|
|
|
- SigInfoVO vo = new SigInfoVO();
|
|
|
- vo.setPdfUrl(pdfUrl);
|
|
|
- R<String> r1 = eVisaClient.batchEVisa(vo);
|
|
|
- if (r1.getCode() != 200 || StringUtils.isBlank(r1.getData())){
|
|
|
- throw new ServiceException("咨询意见PDF电签时失败");
|
|
|
+ WbsTreePrivate aPrivate = (WbsTreePrivate) r.getData();
|
|
|
+ if (isDefiniteFlow) {
|
|
|
+ flowIds = query.stream().filter(l -> l.getFixedFlowBranchSort() == 1)
|
|
|
+ .collect(Collectors.toMap(l -> l.getFixedFlowLinkUser(), l -> l.getFixedFlowLinkUserName()));
|
|
|
+ //获取出当前流程中所有用户
|
|
|
+ List<String> ids = query.stream()
|
|
|
+ .filter(l -> l.getFixedFlowBranchSort() == 1 && !l.getFixedFlowLinkUser().equals(AuthUtil.getUserId()))
|
|
|
+ .map(l -> l.getFixedFlowLinkUser() + "")
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ //根据用户获取这些用户在当前任务中的进度,来判断是否全部审批完成
|
|
|
+ long count = taskParallels.stream()
|
|
|
+ .filter(l -> ids.contains(l.getTaskUser()))
|
|
|
+ .filter(l -> l.getStatus() != 2).count();
|
|
|
+ if (count == 0) {
|
|
|
+ isAllApp = true;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ flowIds = taskParallels.stream().collect(Collectors.toMap(l -> Long.valueOf(l.getTaskUser()), l -> l.getTaskUserName()));
|
|
|
+ long count = taskParallels.stream()
|
|
|
+ .filter(l -> !l.getTaskUser().equals(AuthUtil.getUserId() + ""))
|
|
|
+ .filter(l -> l.getStatus() != 2).count();
|
|
|
+ if (count == 0) {
|
|
|
+ isAllApp = true;
|
|
|
+ }
|
|
|
}
|
|
|
- updateTask.setAttachmentPdfUrl(r1.getData());
|
|
|
- }else {
|
|
|
- //只保存数据到m表
|
|
|
+ //保存数据到m表
|
|
|
String delSql = "delete from " + aPrivate.getInitTableName() + " where p_key_id=" + task.getId();
|
|
|
jdbcTemplate.execute(delSql);
|
|
|
String sqlInfo = "";
|
|
@@ -2506,11 +2491,11 @@ public class TaskController extends BladeController {
|
|
|
for (String e : dataMap2.keySet()) {
|
|
|
if (e.contains("__")) {
|
|
|
String[] split = e.split("__");
|
|
|
- dataMap.put(split[0], dataMap2.get(e)+"_^_"+split[1]);
|
|
|
+ dataMap.put(split[0], dataMap2.get(e) + "_^_" + split[1]);
|
|
|
}
|
|
|
}
|
|
|
/*检查发现有p_key_id缺失的情况,导致表单数据丢失,所以强制覆盖*/
|
|
|
- dataMap.put("p_key_id",task.getId());
|
|
|
+ dataMap.put("p_key_id", task.getId());
|
|
|
sqlInfo = "INSERT INTO " + aPrivate.getInitTableName() + " ( ";
|
|
|
String keyStr = "id,";
|
|
|
String valStr = SnowFlakeUtil.getId() + ",";
|
|
@@ -2522,16 +2507,77 @@ public class TaskController extends BladeController {
|
|
|
valStr = valStr.substring(0, valStr.lastIndexOf(","));
|
|
|
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("key_5__10_1");
|
|
|
+ if (object != null) {
|
|
|
+ try {
|
|
|
+ BigDecimal decimal = new BigDecimal(object.toString());
|
|
|
+ updateTask.setTaskCommonMoney(decimal);
|
|
|
+ Object object2 = tableData.get("key_14__11_1");
|
|
|
+ if (object2 != null) {
|
|
|
+ BigDecimal decimal2 = new BigDecimal(object2.toString());
|
|
|
+ tableData.put("key_10__11_3", decimal.add(decimal2));
|
|
|
+ } else {
|
|
|
+ tableData.put("key_10__11_3", decimal);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new ServiceException("本期审核进度款格式不对");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //如果为第一流程则判断是否当前流程已全部审批,已经全部审批则生成电签PDF,没有全部审批则只保存数据
|
|
|
+ if (isAllApp) {
|
|
|
+ //要求付款额度
|
|
|
+ this.addYuan("key_7__4_3", tableData);
|
|
|
+ //本期审核进度款
|
|
|
+ this.addYuan("key_5__10_1", tableData);
|
|
|
+ //截至上期累计进度款
|
|
|
+ this.addYuan("key_14__11_1", tableData);
|
|
|
+ //截至本期累计进度款
|
|
|
+ this.addYuan("key_10__11_3", tableData);
|
|
|
+ if (flowIds.size() == 0) {
|
|
|
+ throw new ServiceException("未找到流程人信息");
|
|
|
+ }
|
|
|
+ //申请进度时间
|
|
|
+ tableData.put("key_17__7_3", LocalDate.now());
|
|
|
+ //电签单位日期
|
|
|
+ tableData.put("key_4__13_4", LocalDate.now());
|
|
|
+ String pdfUrl = "";
|
|
|
+ try {
|
|
|
+ pdfUrl = getEntrustPDFTrial(Long.valueOf(dto.getProjectId()), dto.getContractId(), aPrivate.getPKeyId(), tableData, flowIds);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new ServiceException("生成咨询意见时失败:" + e.getMessage());
|
|
|
+ }
|
|
|
+
|
|
|
+ updateTask.setAttachmentPdfUrl(pdfUrl);
|
|
|
+ }
|
|
|
+
|
|
|
+ R r1 = taskClient.updateTask(updateTask);
|
|
|
+ if (r1.getCode() != 200) {
|
|
|
+ throw new ServiceException("修改任务信息时出现错误");
|
|
|
+ }
|
|
|
}
|
|
|
- R r1 = taskClient.updateTask(updateTask);
|
|
|
- if (r1.getCode() != 200){
|
|
|
- throw new ServiceException("修改任务信息时出现错误");
|
|
|
- }
|
|
|
+// if (1==1){
|
|
|
+// throw new ServiceException("回滚测试");
|
|
|
+// }
|
|
|
}
|
|
|
- if (1==1){
|
|
|
- throw new ServiceException("回滚测试");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ public void addYuan(String key,Map<String, Object> tableData){
|
|
|
+ Object object2 = tableData.get(key);
|
|
|
+ if (object2 != null) {
|
|
|
+ try {
|
|
|
+ BigDecimal decimal = new BigDecimal(object2.toString());
|
|
|
+ tableData.put(key,decimal.toString()+"元");
|
|
|
+ }catch (Exception e){
|
|
|
+ throw new ServiceException("金额格式不对");
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
private void check(Task task) {
|
|
@@ -3466,12 +3512,14 @@ public class TaskController extends BladeController {
|
|
|
|
|
|
R<WbsTreePrivate> r = wbsTreePrivateClient.getProjectOpinionNode(projectId);
|
|
|
if (r.getCode() != 200){
|
|
|
- throw new ServiceException(r.getMsg());
|
|
|
+// throw new ServiceException(r.getMsg());
|
|
|
+ //如果没有节点或者清单,直接判断不需要
|
|
|
+ return null;
|
|
|
}
|
|
|
WbsTreePrivate aPrivate = r.getData();
|
|
|
try {
|
|
|
-// InputStream fileInputStream = new FileInputStream(fileUrl);
|
|
|
- InputStream fileInputStream = new FileInputStream("C:\\Users\\泓创研发01\\Desktop\\fsdownload\\1789967486389583872.html");
|
|
|
+ InputStream fileInputStream = new FileInputStream(aPrivate.getHtmlUrl());
|
|
|
+// InputStream fileInputStream = new FileInputStream("C:\\Users\\泓创研发01\\Desktop\\fsdownload\\1789967486389583872.html");
|
|
|
String htmlString = IoUtil.readToString(fileInputStream);
|
|
|
htmlString = htmlString.replaceAll("placeholder", "placeholderxx");
|
|
|
htmlString = htmlString.replaceAll("title", "titlexx");
|
|
@@ -3485,7 +3533,7 @@ public class TaskController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public String getEntrustPDFTrial(Long projectId,Long pkeyId,Map<String, Object> DataInfo) throws Exception {
|
|
|
+ public String getEntrustPDFTrial(Long projectId,String contractId,Long pkeyId,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);
|
|
@@ -3517,8 +3565,8 @@ 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(fileUrl);
|
|
|
+// File file1 = ResourceUtil.getFile("C:\\Users\\泓创研发01\\Desktop\\fsdownload\\1789967486389583872.html");
|
|
|
InputStream fileInputStream;
|
|
|
if (file1.exists()) {
|
|
|
fileInputStream = new FileInputStream(file1);
|
|
@@ -3535,6 +3583,9 @@ public class TaskController extends BladeController {
|
|
|
Element table = doc.select("table").first();
|
|
|
Elements trs = table.select("tr");
|
|
|
|
|
|
+ //实际电签人
|
|
|
+ Set<User> sigUser = new HashSet<>();
|
|
|
+
|
|
|
if (ObjectUtil.isNotEmpty(DataInfo)) {
|
|
|
for (String val : Objects.requireNonNull(DataInfo).keySet()) {
|
|
|
if (val.contains("__")) {
|
|
@@ -3632,8 +3683,45 @@ public class TaskController extends BladeController {
|
|
|
}
|
|
|
|
|
|
// 组装电签设置
|
|
|
- List<TextdictInfo> textdictInfos = jdbcTemplate.query("select col_key,id from m_textdict_info where type in (2,6) and tab_id = " + aPrivate.getPKeyId(), new BeanPropertyRowMapper<>(TextdictInfo.class));
|
|
|
+ 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;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (isRole){
|
|
|
+ throw new ServiceException("当前审批人中,不存在:"+roleMap.get(roleId).getSigRoleName()+",无法电签,请查看后台配置");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //修改输入框里面的值为电签标识
|
|
|
for (TextdictInfo e : textdictInfos) {
|
|
|
String key = e.getColKey();
|
|
|
String[] keys = key.split("__");
|
|
@@ -3647,7 +3735,8 @@ public class TaskController extends BladeController {
|
|
|
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;
|
|
@@ -3670,7 +3759,8 @@ public class TaskController extends BladeController {
|
|
|
newStyle.cloneStyleFrom(cell.getCellStyle());
|
|
|
newStyle.setFont(redFont);
|
|
|
cell.setCellStyle(newStyle);
|
|
|
- cell.setCellValue(e.getId() + "");
|
|
|
+ String sig = htmlDeptIdMap.get(e.getId());
|
|
|
+ cell.setCellValue(sig);
|
|
|
} else {
|
|
|
ObjectUtils.isNotEmpty(cell);
|
|
|
}
|
|
@@ -3679,18 +3769,54 @@ public class TaskController extends BladeController {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ }else {
|
|
|
+ throw new ServiceException("未找到审计意见的电签配置");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
//输出流
|
|
|
FileOutputStream outputStream = new FileOutputStream(excelPath);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
workbook.write(outputStream);
|
|
|
+
|
|
|
FileUtils.setExcelScaleToPdf(excelPath, pdfPath);
|
|
|
BladeFile bladeFile = newIOSSClient.uploadFile(pkeyId + ".pdf", pdfPath);
|
|
|
|
|
|
if (bladeFile != null) {
|
|
|
- return bladeFile.getLink();
|
|
|
+ //获取所有专家个人证书
|
|
|
+ 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("有签字人没有配置电签,请联系管理员");
|
|
|
+ }
|
|
|
+ Map<Long, SignPfxFile> map = list.stream().collect(Collectors.toMap(l -> l.getCertificateUserId(), l -> l));
|
|
|
+ SigInfoVO vo = new SigInfoVO();
|
|
|
+ List<SigInfoVO.SigInfo> infos = new ArrayList<>();
|
|
|
+ for (User user : sigUser) {
|
|
|
+ SignPfxFile file = map.get(user.getId());
|
|
|
+ if (file == null){
|
|
|
+ throw new ServiceException("未获取到专家:"+user.getName()+"的电签信息");
|
|
|
+ }
|
|
|
+ SigInfoVO.SigInfo info = new SigInfoVO.SigInfo();
|
|
|
+ info.setUserName(user.getName());
|
|
|
+ info.setUserSig(user.getName()+user.getPhone().substring(0,3));
|
|
|
+ info.setSealCode("S_NEW_"+file.getCertificatePassword());
|
|
|
+ info.setSealPassword(file.getCertificatePassword());
|
|
|
+ if (StringUtils.isBlank(file.getSignatureFileUrl())){
|
|
|
+ throw new ServiceException("未获取到专家:"+user.getName()+"的签字图片");
|
|
|
+ }
|
|
|
+ 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电签时失败");
|
|
|
+ }
|
|
|
+ return r1.getData();
|
|
|
}else {
|
|
|
throw new ServiceException("生成咨询意见PDF时失败");
|
|
|
}
|