This commit is contained in:
李狗蛋 2025-04-07 21:48:14 +08:00
parent a96448fce7
commit 62d5f56b8e
17 changed files with 13984 additions and 5455 deletions

View File

@ -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>

View File

@ -8,6 +8,7 @@ public class GatedgeApplication {
public static void main(String[] args) {
SpringApplication.run(GatedgeApplication.class, args);
System.out.println("服务启动成功");
}
}

View File

@ -5,11 +5,15 @@ 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.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import sun.misc.BASE64Encoder;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -30,6 +34,10 @@ public class SealedQuotationController {
@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);
@ -39,6 +47,7 @@ public class SealedQuotationController {
@PostMapping("queryData")
public ListResult queryData(@RequestBody Map<String, String> map) {
String FBILLNO = map.get("FBILLNO");
UploadFbillNo = map.get("UploadFbillNo");
List<Entity> data = null;
if (sealedQuotationService.loginChack(map)) {
data= sealedQuotationService.queryData(FBILLNO);
@ -49,6 +58,7 @@ public class SealedQuotationController {
@PostMapping("queryDataItem")
public ListResult queryDataItem(@RequestBody Map<String, String> map) {
String FBILLNO = map.get("FBILLNO");
UploadFbillNo = map.get("UploadFbillNo");
List<EntityItem> data = null;
if (sealedQuotationService.loginChack(map)) {
data= sealedQuotationService.queryDataItem(FBILLNO);
@ -61,4 +71,20 @@ public class SealedQuotationController {
Map<String, Object> map = sealedQuotationService.saveData(params);
return ResultBuilder.buildEntitySuccess(map);
}
@PostMapping("/upload")
public ResponseBodyMessage upload(@RequestParam("file") MultipartFile file) throws IOException {
if (!file.isEmpty()) {
//获取上传文件文件名
String fileName = file.getOriginalFilename();
//获取上传文件的Base64
BASE64Encoder base64Encoder =new BASE64Encoder();
String fileBase64 = base64Encoder.encode(file.getBytes());
String FIDrestful = sealedQuotationService.InterId(UploadFbillNo);
responseBodyMessage = sealedQuotationService.uploadFile(FIDrestful,fileName,fileBase64,UploadFbillNo);
System.out.println("解析JSON数据"+ responseBodyMessage.getMessage());
return responseBodyMessage;
}
return new ResponseBodyMessage(0,"未选择文件,附近上传失败");
}
}

View File

@ -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;
}
}

View File

@ -3,6 +3,7 @@ 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.result.ResponseBodyMessage;
import java.util.List;
import java.util.Map;
@ -49,4 +50,10 @@ public interface SealedQuotationService {
Boolean loginChack(Map<String, String> params);
//获取单据内码
String InterId(String FBillNo);
//根据获取到的单据内码FID对单据进行附件上传
ResponseBodyMessage uploadFile(String FID, String fileName, String fileBase64, String FBillNo);
}

View File

@ -9,8 +9,10 @@ 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.result.ResponseBodyMessage;
import com.gatedge.jindie.service.SealedQuotationService;
import com.jayway.jsonpath.JsonPath;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
@ -41,10 +43,15 @@ 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://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";
//上传文件的Url
private String UploadFile = "http://192.168.10.105/K3Cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.AttachmentUpLoad.common.kdsvc";
//查询单据FID的Url
private String QueryInterId = "http://192.168.10.105/K3Cloud/Kingdee.BOS.WebApi.ServicesStub.DynamicFormService.ExecuteBillQuery.common.kdsvc";
@Override
public void login(String FBILLNO, String username, String password) {
@ -315,4 +322,46 @@ 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<String,Object> data = new HashMap<>();
Map<String,Object> params = new HashMap<>();
params.put("FileName",fileName);
params.put("FormId","kafe2f22a0498441f9109c31cf5586da5");
params.put("IsLast",true);
params.put("InterId",FID);
params.put("BillNO",FBillNo);
params.put("SendByte",fileBase64);
data.put("data",params);
String api = loginAPI(null);
loginAPI(api);
String Json =API(api,data,UploadFile);
System.out.println(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);
}
}
}

View File

@ -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
View File

@ -0,0 +1,6 @@
{
"name": "TianDaMFBJ_Test",
"lockfileVersion": 3,
"requires": true,
"packages": {}
}

6
package-lock.json generated Normal file
View File

@ -0,0 +1,6 @@
{
"name": "TianDaMFBJ_Test",
"lockfileVersion": 3,
"requires": true,
"packages": {}
}

1
tdtest/.npmrc Normal file
View File

@ -0,0 +1 @@
shamefully-flatten=true

10
tdtest/package.json Normal file
View 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"
}
}

Binary file not shown.

11514
vue/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -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

File diff suppressed because it is too large Load Diff

View File

@ -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,10 +26,9 @@ const routes = [
},
];
const router = new VueRouter({
mode: 'hash',
base: process.env.BASE_URL,
routes,
});
const router = createRouter({
history: createWebHistory(),
routes
})
export default router;

View File

@ -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)