Compare commits
10 Commits
481bc10d43
...
db2ccb8c3b
Author | SHA1 | Date | |
---|---|---|---|
![]() |
db2ccb8c3b | ||
![]() |
62d5f56b8e | ||
![]() |
a96448fce7 | ||
![]() |
697aad3cd3 | ||
![]() |
2979e07607 | ||
![]() |
4e9eb6f83e | ||
![]() |
e418fd3360 | ||
![]() |
ac34f7a8d9 | ||
![]() |
a5c3c16037 | ||
![]() |
e422441212 |
@ -9,8 +9,15 @@
|
||||
|
||||
#### 安装教程
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### 使用说明
|
||||
|
||||
1. xxxx
|
||||
2. xxxx
|
||||
3. xxxx
|
||||
|
||||
#### 参与贡献
|
||||
|
||||
@ -23,7 +30,7 @@
|
||||
#### 特技
|
||||
|
||||
1. 使用 Readme\_XXX.md 来支持不同的语言,例如 Readme\_en.md, Readme\_zh.md
|
||||
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
|
||||
2. Gitee 官方博客 [blog.gitee.com](https://blog.gitee.com)
|
||||
3. 你可以 [https://gitee.com/explore](https://gitee.com/explore) 这个地址来了解 Gitee 上的优秀开源项目
|
||||
4. [GVP](https://gitee.com/gvp) 全称是 Gitee 最有价值开源项目,是综合评定出的优秀开源项目
|
||||
5. Gitee 官方提供的使用手册 [https://gitee.com/help](https://gitee.com/help)
|
||||
|
@ -17,6 +17,13 @@
|
||||
<maven-compiler-target.version>1.8</maven-compiler-target.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.jayway.jsonpath</groupId>
|
||||
<artifactId>json-path</artifactId>
|
||||
<version>2.4.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
|
@ -8,6 +8,7 @@ public class GatedgeApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(GatedgeApplication.class, args);
|
||||
System.out.println("服务启动成功");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,16 +2,19 @@ package com.gatedge.jindie.controller;
|
||||
|
||||
import com.gatedge.jindie.entity.Entity;
|
||||
import com.gatedge.jindie.entity.EntityItem;
|
||||
import com.gatedge.jindie.entity.EntityVO;
|
||||
import com.gatedge.jindie.result.ActionResult;
|
||||
import com.gatedge.jindie.result.ListResult;
|
||||
import com.gatedge.jindie.result.ResponseBodyMessage;
|
||||
import com.gatedge.jindie.result.ResultBuilder;
|
||||
import com.gatedge.jindie.service.SealedQuotationService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.io.IOException;
|
||||
import java.util.Base64;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -27,9 +30,14 @@ import java.util.Map;
|
||||
@RequestMapping("/admin/")
|
||||
public class SealedQuotationController {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SealedQuotationController.class);
|
||||
@Autowired
|
||||
private SealedQuotationService sealedQuotationService;
|
||||
|
||||
private ResponseBodyMessage responseBodyMessage;
|
||||
//记录单据编号,用于上传到单据附件管理
|
||||
private String UploadFbillNo;
|
||||
|
||||
@GetMapping("login")
|
||||
public ActionResult login(@RequestParam("FBILLNO") String FBILLNO, @RequestParam("Username") String username, @RequestParam("Password") String password) {
|
||||
sealedQuotationService.login(FBILLNO, username, password);
|
||||
@ -61,4 +69,33 @@ public class SealedQuotationController {
|
||||
Map<String, Object> map = sealedQuotationService.saveData(params);
|
||||
return ResultBuilder.buildEntitySuccess(map);
|
||||
}
|
||||
|
||||
@PostMapping("/upload")
|
||||
public ResponseBodyMessage upload(@RequestParam("file") MultipartFile file,
|
||||
@RequestParam("FBILLNO1") String Fbillno) throws IOException {
|
||||
// 获取文件名
|
||||
String fileName = file.getOriginalFilename();
|
||||
// 获取文件内容并转换为 Base64 编码
|
||||
String fileBase64 = Base64.getEncoder().encodeToString(file.getBytes());
|
||||
|
||||
System.out.println("文件名为:" + fileName);
|
||||
System.out.println("文件抓取BASE64值:" + fileBase64);
|
||||
System.out.println("单据编号 :" + Fbillno);
|
||||
|
||||
// 调用服务层方法处理文件上传逻辑
|
||||
String FIDrestful = sealedQuotationService.InterId(Fbillno);
|
||||
System.out.println("文件获取FID值:" + FIDrestful);
|
||||
|
||||
// 调用服务层方法上传文件
|
||||
ResponseBodyMessage responseBodyMessage = sealedQuotationService.uploadFile(FIDrestful, fileName, fileBase64, Fbillno);
|
||||
System.out.println("解析JSON数据:" + responseBodyMessage.getMessage());
|
||||
|
||||
return responseBodyMessage;
|
||||
}
|
||||
@GetMapping("/CreateFile")
|
||||
public ListResult CreateFile(@RequestParam String Fbillno) {
|
||||
List<EntityItem> data = null;
|
||||
|
||||
return ResultBuilder.buildEntitySuccess(data);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,61 @@
|
||||
package com.gatedge.jindie.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
/**
|
||||
* @author ligoudan
|
||||
* @create 2025-04-09 19:08
|
||||
* 相应JSON的反应实体类
|
||||
*/
|
||||
public class FileEntityItem {
|
||||
@JsonProperty("FATTACHMENTNAME")
|
||||
private String FATTACHMENTNAME;//文件名
|
||||
|
||||
@JsonProperty("FATTACHMENTSIZE")
|
||||
private String FATTACHMENTSIZE;//文件大小
|
||||
|
||||
@JsonProperty("FCREATETIME")
|
||||
private String FCREATETIME;
|
||||
|
||||
@JsonProperty("FID")
|
||||
private String FID;
|
||||
|
||||
public FileEntityItem(String FATTACHMENTNAME, String FATTACHMENTSIZE, String FCREATETIME, String FID) {
|
||||
this.FATTACHMENTNAME = FATTACHMENTNAME;
|
||||
this.FATTACHMENTSIZE = FATTACHMENTSIZE;
|
||||
this.FCREATETIME = FCREATETIME;
|
||||
this.FID = FID;
|
||||
}
|
||||
|
||||
public String getFATTACHMENTNAME() {
|
||||
return FATTACHMENTNAME;
|
||||
}
|
||||
|
||||
public void setFATTACHMENTNAME(String FATTACHMENTNAME) {
|
||||
this.FATTACHMENTNAME = FATTACHMENTNAME;
|
||||
}
|
||||
|
||||
public String getFATTACHMENTSIZE() {
|
||||
return FATTACHMENTSIZE;
|
||||
}
|
||||
|
||||
public void setFATTACHMENTSIZE(String FATTACHMENTSIZE) {
|
||||
this.FATTACHMENTSIZE = FATTACHMENTSIZE;
|
||||
}
|
||||
|
||||
public String getFCREATETIME() {
|
||||
return FCREATETIME;
|
||||
}
|
||||
|
||||
public void setFCREATETIME(String FCREATETIME) {
|
||||
this.FCREATETIME = FCREATETIME;
|
||||
}
|
||||
|
||||
public String getFID() {
|
||||
return FID;
|
||||
}
|
||||
|
||||
public void setFID(String FID) {
|
||||
this.FID = FID;
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.gatedge.jindie.result;
|
||||
|
||||
/**
|
||||
* @author 李天华
|
||||
* @create 2024-12-24 9:43
|
||||
* 文件上传的返回JSON实体类
|
||||
*/
|
||||
public class ResponseBodyMessage {
|
||||
private int status; //状态码
|
||||
private String message;
|
||||
|
||||
public ResponseBodyMessage(int status, String message) {
|
||||
this.status = status;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(int status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
}
|
@ -3,6 +3,8 @@ package com.gatedge.jindie.service;
|
||||
import com.gatedge.jindie.entity.Entity;
|
||||
import com.gatedge.jindie.entity.EntityItem;
|
||||
import com.gatedge.jindie.entity.EntityVO;
|
||||
import com.gatedge.jindie.entity.FileEntityItem;
|
||||
import com.gatedge.jindie.result.ResponseBodyMessage;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -49,4 +51,13 @@ public interface SealedQuotationService {
|
||||
|
||||
|
||||
Boolean loginChack(Map<String, String> params);
|
||||
|
||||
//获取单据内码
|
||||
String InterId(String FBillNo);
|
||||
|
||||
//根据获取到的单据内码FID,对单据进行附件上传
|
||||
ResponseBodyMessage uploadFile(String FID, String fileName, String fileBase64, String FBillNo);
|
||||
|
||||
//根据单据编号,查询已经上传的附件
|
||||
List<FileEntityItem> queryFiles(String FBillNo);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.gatedge.jindie.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
@ -8,8 +9,12 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.gatedge.jindie.entity.Entity;
|
||||
import com.gatedge.jindie.entity.EntityItem;
|
||||
import com.gatedge.jindie.entity.EntityVO;
|
||||
import com.gatedge.jindie.entity.FileEntityItem;
|
||||
import com.gatedge.jindie.result.ResponseBodyMessage;
|
||||
import com.gatedge.jindie.service.SealedQuotationService;
|
||||
|
||||
import com.jayway.jsonpath.JsonPath;
|
||||
import javafx.collections.ObservableArray;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpEntity;
|
||||
import org.springframework.http.HttpHeaders;
|
||||
@ -19,7 +24,11 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
|
||||
/**
|
||||
@ -38,10 +47,19 @@ public class SealedQuotationServiceImpl implements SealedQuotationService {
|
||||
//主表
|
||||
private String Primary_Meter="Fid,FBILLNO,FProjectName,FSrcBillNo,FSupplierId.FNumber,FSupplierName,FOpenDate,FPriceStatus,FQuoteDate,FExpiryDate,FContact,FPhone,FMail,FCurrId.FName,FIsIncludedTax,FDATE,FBuyer.FName,FCheckerId,FDocumentStatus";
|
||||
private String Detailed_List="FEntity_FEntryID, FMATERIALID.FNumber,FMaterialId.FName, FUnitID.FName,FQty, FPrice, FTaxRate, FTaxPrice,FNote,FPayConditionId.FName";
|
||||
//查询表单的FID
|
||||
private String UploadPrimary_Meter = "FID";
|
||||
|
||||
private String QUERY_DATA_URL="http://1.14.142.111:9090/K3CLOUD/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillQuery.common.kdsvc";
|
||||
private String SAVA_DATA_URL="http://1.14.142.111:9090/k3cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save.common.kdsvc";
|
||||
private String QUERY_DATA_URL="http://192.168.61.20:18081/K3CLOUD/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillQuery.common.kdsvc";
|
||||
private String SAVA_DATA_URL="http://192.168.61.20:18081/k3cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save.common.kdsvc";
|
||||
|
||||
private String UploadFile = "http://192.168.61.20:18081/K3Cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.Save.common.kdsvc";
|
||||
//查询单据FID的Url
|
||||
private String QueryInterId = "http://192.168.61.20:18081/K3Cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillQuery.common.kdsvc";
|
||||
//查询单据上传附件
|
||||
private String QueryFilesUrl = "http://192.168.61.20:18081/K3Cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillQuery.common.kdsvc";
|
||||
//查询单据上传附件的主键
|
||||
private String QueryFiles = "FID,FATTACHMENTNAME,FATTACHMENTSIZE,FCREATETIME";
|
||||
|
||||
@Override
|
||||
public void login(String FBILLNO, String username, String password) {
|
||||
@ -151,7 +169,6 @@ public class SealedQuotationServiceImpl implements SealedQuotationService {
|
||||
entityItem.setFSEQ(String.valueOf(FSEQ));
|
||||
FSEQ++;
|
||||
result.add(entityItem);
|
||||
|
||||
}
|
||||
} else {
|
||||
System.err.println("Invalid JSON array format.");
|
||||
@ -176,10 +193,10 @@ public class SealedQuotationServiceImpl implements SealedQuotationService {
|
||||
data.put("IsAutoSubmitAndAudit",isAutoAdjustField);
|
||||
SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||
String format = simpleDateFormat.format(new Date());
|
||||
data.put("FQuoteDate",format);
|
||||
params.put("FQuoteDate",format);
|
||||
if (isAutoAdjustField.equals("true")) {
|
||||
data.put("FIsConfirm",true);
|
||||
data.put("FConfirmDate",true);
|
||||
params.put("FConfirmDate",format);
|
||||
}
|
||||
data.put("Model",params);
|
||||
|
||||
@ -215,7 +232,7 @@ public class SealedQuotationServiceImpl implements SealedQuotationService {
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// String url = "http://1.14.142.111:9090/K3CLOUD/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillQuery.common.kdsvc";
|
||||
// String url = "http://192.168.61.20:18081/K3CLOUD/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillQuery.common.kdsvc";
|
||||
HttpEntity<String> requestEntity = new HttpEntity<>(jsonData, headers);
|
||||
System.out.println(jsonData);
|
||||
// 发送POST请求
|
||||
@ -231,47 +248,19 @@ public class SealedQuotationServiceImpl implements SealedQuotationService {
|
||||
|
||||
}
|
||||
|
||||
public String SAVA_API(String apiCookie, Map<String, Object> data,String url) {
|
||||
// 设置请求头信息
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.set("Content-Type", "application/json");
|
||||
headers.set("kdservice-sessionid", apiCookie);
|
||||
|
||||
// 设置请求参数
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
String jsonData = null;
|
||||
try {
|
||||
jsonData = objectMapper.writeValueAsString(data);
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// String url = "http://1.14.142.111:9090/K3CLOUD/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillQuery.common.kdsvc";
|
||||
HttpEntity<String> requestEntity = new HttpEntity<>(jsonData, headers);
|
||||
|
||||
// 发送POST请求
|
||||
ResponseEntity<String> responseEntity = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class);
|
||||
|
||||
// 获取返回信息
|
||||
String response = responseEntity.getBody();
|
||||
if (Objects.equals(response, "[]")) {
|
||||
return null;
|
||||
} else {
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public String loginAPI(String apiCookie) {
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("acctID", "63e200975197e2");
|
||||
params.put("Username", "王扶民");
|
||||
// params.put("acctID", "63e200975197e2");
|
||||
params.put("acctID", "639130a0cbb6ae");
|
||||
params.put("Username", "ERP1");
|
||||
// params.put("Username", "王扶民");
|
||||
params.put("Password", "888888");
|
||||
params.put("Lcid", "2052");
|
||||
// 设置请求头信息
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.set("Content-Type", "application/json");
|
||||
if (apiCookie != null) {
|
||||
headers.set("kdservice-sessionid", "54f0d8ff-00a7-4db0-992b-cfe9abed566e");
|
||||
headers.set("kdservice-sessionid", "95db4c18-10cd-420c-a0eb-96e2ee2db7f8");
|
||||
}
|
||||
// 设置请求参数
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
@ -281,16 +270,25 @@ public class SealedQuotationServiceImpl implements SealedQuotationService {
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
String url = "http://1.14.142.111:9090/K3Cloud/Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc";
|
||||
String url = "http://192.168.61.20:18081/K3Cloud/Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc";
|
||||
// String url = "http://1.14.142.111:9090/K3Cloud/Kingdee.BOS.WebApi.ServicesStub.AuthService.ValidateUser.common.kdsvc";
|
||||
HttpEntity<String> requestEntity = new HttpEntity<>(jsonData, headers);
|
||||
|
||||
// 发送POST请求
|
||||
ResponseEntity<String> responseEntity = restTemplate.exchange(url, HttpMethod.POST, requestEntity, String.class);
|
||||
|
||||
HttpHeaders headersResponse = responseEntity.getHeaders();
|
||||
List<String> list = headersResponse.get("Set-Cookie");
|
||||
// 获取返回信息
|
||||
String response = responseEntity.getBody();
|
||||
Map<String, Object> resultMap = JSON.parseObject(response);
|
||||
return resultMap.get("KDSVCSessionId").toString();
|
||||
String sessionId = null;
|
||||
String str = list.get(0);
|
||||
Pattern pattern = Pattern.compile("kdservice-sessionid=(.*?);");
|
||||
Matcher matcher = pattern.matcher(str);
|
||||
if (matcher.find()) {
|
||||
sessionId = matcher.group(1);
|
||||
System.out.println(sessionId); // 输出:d57b692d-9358-4242-a6ee-553d6f6b3b4f
|
||||
}
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -331,4 +329,136 @@ public class SealedQuotationServiceImpl implements SealedQuotationService {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String InterId(String FBillNo) {
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("FormId","kafe2f22a0498441f9109c31cf5586da5");
|
||||
params.put("FieldKeys",UploadPrimary_Meter);
|
||||
params.put("FilterString", "FBILLNO like'%" + FBillNo + "'");
|
||||
data.put("data", params);
|
||||
String api = loginAPI(null);
|
||||
loginAPI(api);
|
||||
String input = API(api,data,QueryInterId);
|
||||
if (input != null) {
|
||||
//截取字符串,去掉[[]]
|
||||
input = input.substring(2, input.length() - 2);
|
||||
}
|
||||
return input;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResponseBodyMessage uploadFile(String FID, String fileName, String fileBase64, String FBillNo) {
|
||||
// 创建最外层的Map
|
||||
Map<String, Object> rootMap = new HashMap<>();
|
||||
// 创建内部的data Map
|
||||
Map<String, Object> dataMap = new HashMap<>();
|
||||
// 创建Model Map
|
||||
Map<String, Object> modelMap = new HashMap<>();
|
||||
// 创建FCreateMen Map
|
||||
Map<String, Object> createMenMap = new HashMap<>();
|
||||
//获取文件后缀名
|
||||
String extension = getFileExtensionWithDot(fileName);
|
||||
//获取当前时间
|
||||
LocalDateTime currentDateTime = LocalDateTime.now();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
String formattedDateTime = currentDateTime.format(formatter);
|
||||
|
||||
|
||||
createMenMap.put("FUserID", "100746");
|
||||
|
||||
// 填充Model Map
|
||||
modelMap.put("FAttachmentName", fileName);//文件名
|
||||
modelMap.put("FBillType", "kafe2f22a0498441f9109c31cf5586da5");//单据类型
|
||||
modelMap.put("FInterID", FID);//单据FID
|
||||
modelMap.put("FBillNo", FBillNo);//单据编号
|
||||
modelMap.put("FAttachment", fileBase64);//文件BASE64
|
||||
modelMap.put("FFILESTORAGE", 0);
|
||||
modelMap.put("FExtName", extension);
|
||||
modelMap.put("FEntryinterId", "-1");//单据头附件
|
||||
modelMap.put("FEntrykey", " ");//单据头附近,要传一个空格
|
||||
modelMap.put("FaliasFileName", fileName);
|
||||
modelMap.put("FCreateMen", createMenMap);
|
||||
modelMap.put("FCreateTime",formattedDateTime);
|
||||
|
||||
// 填充data Map
|
||||
dataMap.put("Model", modelMap);
|
||||
|
||||
// 填充最外层的Map
|
||||
rootMap.put("FormId", "BOS_Attachment");
|
||||
rootMap.put("data", dataMap);
|
||||
String api = loginAPI(null);
|
||||
loginAPI(api);
|
||||
String Json =API(api,rootMap,UploadFile);
|
||||
System.out.println("22上传的:"+Json);
|
||||
Boolean Success = JsonPath.read(Json,"$.Result.ResponseStatus.IsSuccess");
|
||||
if(Success){
|
||||
return new ResponseBodyMessage(1,"附件上传成功");
|
||||
}else {
|
||||
String message = JsonPath.read(Json,"$.Result.ResponseStatus.Errors[0].Message");
|
||||
return new ResponseBodyMessage(0,"附件上传失败,失败原因:"+message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<FileEntityItem> queryFiles(String FBillNo) {
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("FormId","BOS_Attachment");
|
||||
params.put("FieldKeys",QueryFiles);
|
||||
params.put("FilterString", "FBILLNO like'%" + FBillNo + "'");
|
||||
params.put("OrderString", "");
|
||||
params.put("TopRowCount", "0");
|
||||
params.put("StartRow", "0");
|
||||
params.put("Limit", "100");
|
||||
String api = loginAPI(null);
|
||||
loginAPI(api);
|
||||
String json = API(api,data,QueryFilesUrl);
|
||||
List<FileEntityItem> result = new ArrayList<>();
|
||||
if (json != null) {
|
||||
//可能返回的是个集合,需要处理一下
|
||||
try {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
JsonNode jsonArray = objectMapper.readTree(json);
|
||||
if (jsonArray.isArray()) {
|
||||
int FSEQ=1;
|
||||
for (JsonNode jsonItem : jsonArray) {
|
||||
String input = jsonItem.toString();
|
||||
input = input.substring(1, input.length() - 1); // 截取字符串,去掉 "[[" 和 "]]"
|
||||
String[] parts = input.split(",");
|
||||
List<String> list = new ArrayList<>();
|
||||
for (String part : parts) {
|
||||
String cleanedPart = part.replaceAll("[\"\\s+]", ""); // 去掉多余的双引号和空格
|
||||
list.add(cleanedPart);
|
||||
}
|
||||
FileEntityItem entityItem = new FileEntityItem(list.get(3),list.get(2),list.get(1),list.get(0));
|
||||
//entityItem.setFSEQ(String.valueOf(FSEQ));
|
||||
FSEQ++;
|
||||
result.add(entityItem);
|
||||
}
|
||||
} else {
|
||||
System.err.println("Invalid JSON array format.");
|
||||
}
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件后缀名的方法
|
||||
* @param fileName 文件名
|
||||
* @return 文件后缀名,如果没有后缀名返回 null
|
||||
*/
|
||||
public static String getFileExtensionWithDot(String fileName) {
|
||||
int dotIndex = fileName.lastIndexOf(".");
|
||||
if (dotIndex != -1 && dotIndex != 0) {
|
||||
return fileName.substring(dotIndex);
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,7 @@
|
||||
server:
|
||||
port: 10002
|
||||
|
||||
spring:
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 100MB
|
||||
max-request-size: 100MB
|
||||
|
6
node_modules/.package-lock.json
generated
vendored
Normal file
6
node_modules/.package-lock.json
generated
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "TianDaMFBJ_Test",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {}
|
||||
}
|
6
package-lock.json
generated
Normal file
6
package-lock.json
generated
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"name": "TianDaMFBJ_Test",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {}
|
||||
}
|
1
tdtest/.npmrc
Normal file
1
tdtest/.npmrc
Normal file
@ -0,0 +1 @@
|
||||
shamefully-flatten=true
|
10
tdtest/package.json
Normal file
10
tdtest/package.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"name": "tdtest",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "~5.0.0",
|
||||
"@vue/cli-plugin-eslint": "~5.0.0",
|
||||
"@vue/cli-service": "~5.0.0"
|
||||
}
|
||||
}
|
11514
vue/package-lock.json
generated
11514
vue/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -10,15 +10,15 @@
|
||||
"dependencies": {
|
||||
"axios": "^1.4.0",
|
||||
"core-js": "^3.8.3",
|
||||
"element-ui": "^2.15.13",
|
||||
"element-ui": "^2.15.14",
|
||||
"js-cookie": "^3.0.5",
|
||||
"vue": "^2.6.14",
|
||||
"vue-router": "^3.5.1",
|
||||
"vuex": "^3.6.2"
|
||||
"vue": "^3.5.13",
|
||||
"vue-router": "^4.5.0",
|
||||
"vuex": "^4.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.12.16",
|
||||
"@vue/cli-plugin-babel": "~5.0.0",
|
||||
"@vue/cli-plugin-babel": "^5.0.8",
|
||||
"@vue/cli-plugin-router": "~5.0.0",
|
||||
"@vue/cli-plugin-vuex": "~5.0.0",
|
||||
"@vue/cli-service": "~5.0.0",
|
||||
|
7721
vue/pnpm-lock.yaml
generated
Normal file
7721
vue/pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,9 @@
|
||||
import Vue from "vue";
|
||||
import VueRouter from "vue-router";
|
||||
// import Vue from "vue";
|
||||
// import VueRouter from "vue-router";
|
||||
import { createApp } from 'vue';
|
||||
import { createRouter, createWebHistory } from 'vue-router';
|
||||
|
||||
Vue.use(VueRouter);
|
||||
//Vue.use(VueRouter);
|
||||
|
||||
const routes = [
|
||||
{
|
||||
@ -24,8 +26,9 @@ const routes = [
|
||||
},
|
||||
];
|
||||
|
||||
const router = new VueRouter({
|
||||
routes,
|
||||
});
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes
|
||||
})
|
||||
|
||||
export default router;
|
||||
|
@ -7,6 +7,14 @@
|
||||
<el-button v-if="view" type="primary" @click="saveData('true')">
|
||||
{{ '提交' }}
|
||||
</el-button>
|
||||
<el-upload
|
||||
class="upload-demo"
|
||||
action="/api/upload"
|
||||
:on-success="onSuccess"
|
||||
multiple
|
||||
:file-list="fileList">
|
||||
<el-button size="small" type="primary">点击上传</el-button>
|
||||
</el-upload>
|
||||
</div>
|
||||
<el-divider></el-divider>
|
||||
<el-form ref="ContractSalaryForm" :rules="rules" :model="ruleFrom" :label-position="labelPosition"
|
||||
@ -256,6 +264,7 @@ export default {
|
||||
return {
|
||||
labelPosition: 'right',
|
||||
list: [],
|
||||
fileList: [],
|
||||
data: {
|
||||
FormId: "kafe2f22a0498441f9109c31cf5586da5",
|
||||
FieldKeys: '',
|
||||
@ -333,6 +342,21 @@ export default {
|
||||
computed: {},
|
||||
watch: {},
|
||||
methods: {
|
||||
// 文件上传对返回的Json数据进行解析
|
||||
onSuccess(response,file,fileList){
|
||||
if(response.status == 0){
|
||||
this.$message({
|
||||
message:response.message,
|
||||
type: 'error'
|
||||
})
|
||||
}else{
|
||||
this.$message({
|
||||
message:response.message,
|
||||
type: 'success'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
updatePrice(row) {
|
||||
row.FTaxPrice = (Number(row.FPrice == "" ? 0 : row.FPrice) * (1 + (Number(row.FTaxRate == "" ? 0 : row.FTaxRate) / 100))).toFixed(2);
|
||||
console.log(row)
|
||||
|
Loading…
x
Reference in New Issue
Block a user