This commit is contained in:
JIAL 2024-06-19 14:04:38 +08:00
commit f17502cf53
9 changed files with 175 additions and 76 deletions

View File

@ -1,9 +1,13 @@
#for tests only ! #for tests only !
<<<<<<< HEAD <<<<<<< HEAD
#Wed Jun 19 10:12:57 CST 2024
=======
<<<<<<< HEAD
#Wed Jun 19 09:11:03 CST 2024 #Wed Jun 19 09:11:03 CST 2024
======= =======
#Mon Jun 17 15:48:27 CST 2024 #Mon Jun 17 15:48:27 CST 2024
>>>>>>> 1efe171bc013909adaa8e3300a0b9ce6c2e24d85 >>>>>>> 1efe171bc013909adaa8e3300a0b9ce6c2e24d85
>>>>>>> d63db1c95090eda2578290808925b20b3608a764
jco.destination.pool_capacity=10 jco.destination.pool_capacity=10
jco.client.lang=ZH jco.client.lang=ZH
jco.client.ashost=172.19.0.125 jco.client.ashost=172.19.0.125
@ -12,8 +16,12 @@ jco.client.user=RFC
jco.client.sysnr=00 jco.client.sysnr=00
jco.destination.peak_limit=10 jco.destination.peak_limit=10
<<<<<<< HEAD <<<<<<< HEAD
jco.client.passwd=dbTq!8PGYoMxt}M?DFv(:oQQUwH:qM9KKr$k^CHW9U;kE9uK
=======
<<<<<<< HEAD
jco.client.passwd=g}=[!8cY+]^Y:h6_:E9``X=J#eA[=IM/|(0EB`M)]I1i?/qD jco.client.passwd=g}=[!8cY+]^Y:h6_:E9``X=J#eA[=IM/|(0EB`M)]I1i?/qD
======= =======
jco.client.passwd=654321 jco.client.passwd=654321
>>>>>>> 1efe171bc013909adaa8e3300a0b9ce6c2e24d85 >>>>>>> 1efe171bc013909adaa8e3300a0b9ce6c2e24d85
>>>>>>> d63db1c95090eda2578290808925b20b3608a764
jco.client.client=800 jco.client.client=800

View File

@ -145,6 +145,11 @@
<artifactId>cxf-rt-transports-http-jetty</artifactId> <artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>3.4.3</version> <version>3.4.3</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>5.2.12.RELEASE</version>
</dependency>
<!--webservice end--> <!--webservice end-->
</dependencies> </dependencies>

View File

@ -28,13 +28,17 @@ import com.ruoyi.web.utils.IdUtils;
import com.ruoyi.web.utils.ListSplitUtil; import com.ruoyi.web.utils.ListSplitUtil;
import com.ruoyi.web.utils.rbExcel.excelUtil; import com.ruoyi.web.utils.rbExcel.excelUtil;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
@ -260,10 +264,11 @@ public class RedBookController extends BaseController
@DataSource(DataSourceType.MASTER) @DataSource(DataSourceType.MASTER)
@Log(title = "生成询价单", businessType = BusinessType.INSERT) @Log(title = "生成询价单", businessType = BusinessType.INSERT)
@PostMapping("/madeXjQuot") @PostMapping("/madeXjQuot")
public void madeXjQuot(HttpServletResponse response, @RequestBody OAQuot quot) public AjaxResult madeXjQuot(HttpServletResponse response, @RequestBody OAQuot quot) throws Exception
{ {
Quot xjquot = new Quot(); Quot xjquot = new Quot();
File excelFile = null;
try{
xjquot.setQuotId(UUID.fastUUID().toString()); xjquot.setQuotId(UUID.fastUUID().toString());
String quotCode = redBookService.getCode("BJD"); String quotCode = redBookService.getCode("BJD");
xjquot.setQuotCode(quotCode); xjquot.setQuotCode(quotCode);
@ -276,15 +281,20 @@ public class RedBookController extends BaseController
xjquot.setCreateBy(getUsername()); xjquot.setCreateBy(getUsername());
iQuotService.insertQuot(xjquot); iQuotService.insertQuot(xjquot);
List<OAQuotProduct> list = quot.getSelectedResultData();
excelFile = new File("xjQuotFile/"+xjquot.getQuotCode()+".xls");
File file = excelUtil.exportXjQuotExcel(response,excelFile,xjquot,list);
MultipartFile multipartFile = convert(file);
/** 上传清单附件 **/ /** 上传清单附件 **/
/* String relation_id = xjquot.getQuotId(); String relation_id = xjquot.getQuotId();
if(!StringUtils.isEmpty(relation_id)){ if(!StringUtils.isEmpty(relation_id)){
if (!file.isEmpty()) if (!multipartFile.isEmpty())
{ {
QuotFile quotFile= new QuotFile(); QuotFile quotFile= new QuotFile();
quotFile.setFileId(UUID.fastUUID().toString()); quotFile.setFileId(UUID.fastUUID().toString());
String url = FileUploadUtils.uploadMinio(multipartFile,"quot-manage", "quot/"+relation_id);
String url = FileUploadUtils.uploadMinio(file,"quot-manage", "quot/"+relation_id);
int index = url.lastIndexOf("/")+1; int index = url.lastIndexOf("/")+1;
String fileName = url.substring(index);//获取文件名 String fileName = url.substring(index);//获取文件名
@ -294,18 +304,39 @@ public class RedBookController extends BaseController
quotFile.setFileName(fileName); quotFile.setFileName(fileName);
quotFile.setFileBucketName(fileBucketName); quotFile.setFileBucketName(fileBucketName);
quotFile.setFileUrl(url); quotFile.setFileUrl(url);
quotFile.setFileSize(file.getSize()); quotFile.setFileSize(multipartFile.getSize());
quotFile.setFileTime(DateUtils.getTime()); quotFile.setFileTime(DateUtils.getTime());
quotFile.setFileType("quotXjFile"); quotFile.setFileType("quotXjFile");
quotFile.setRelationId(relation_id); quotFile.setRelationId(relation_id);
quotFileService.insertQuotFile(quotFile); quotFileService.insertQuotFile(quotFile);
}else{
return error("系统异常,生成清单附件为空!");
} }
}else{ }else{
return error("系统异常,询价单号为空!"); return error("系统异常,询价单号为空!");
}*/
/** 上传清单附件 **/
// return success(xjquot);
} }
}catch(Exception e){
return error("系统异常");
}
/** 上传清单附件 **/
FileUtils.delete(excelFile);
return success(xjquot);
}
/**
* File转MultipartFile
* @param file
* @return
* @throws IOException
*/
public static MultipartFile convert(File file) throws IOException {
FileInputStream input = new FileInputStream(file);
MultipartFile multipartFile = new MockMultipartFile("file",
file.getName(), "application/vnd.ms-excel;charset=UTF-8", input);
return multipartFile;
}
/** /**
* 报价单提交 * 报价单提交
* @param quot * @param quot

View File

@ -9,26 +9,20 @@ import com.ruoyi.redBook.domain.OAQuotProduct;
import com.ruoyi.web.utils.IdUtils; import com.ruoyi.web.utils.IdUtils;
import jxl.HeaderFooter; import jxl.HeaderFooter;
import jxl.Workbook; import jxl.Workbook;
import jxl.format.*;
import jxl.format.Alignment; import jxl.format.Alignment;
import jxl.format.Border; import jxl.format.Border;
import jxl.format.BorderLineStyle; import jxl.format.BorderLineStyle;
import jxl.format.Colour;
import jxl.format.VerticalAlignment; import jxl.format.VerticalAlignment;
import jxl.write.Number; import jxl.write.Number;
import jxl.write.*; import jxl.write.*;
import jxl.write.biff.RowsExceededException; import jxl.write.biff.RowsExceededException;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.File; import java.io.*;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.URL;
import java.util.Date; import java.util.Date;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@ -665,4 +659,89 @@ public class excelUtil {
} }
} }
/**
* 生成询价单-清单附件
* @param response
* @param quot
* @param list
*/
public static File exportXjQuotExcel(HttpServletResponse response,File excelFile, Quot quot, List<OAQuotProduct> list){
try {
WritableWorkbook wwb = Workbook.createWorkbook(excelFile);
// 新建一张表
WritableSheet wsheet = wwb.createSheet("报价单", 0);
Label label = new Label(0, 0, "");
int i= 0;
//产品信息
WritableFont wf_merge = new WritableFont(WritableFont.ARIAL,11,WritableFont.BOLD,false, UnderlineStyle.NO_UNDERLINE, Colour.WHITE);
WritableCellFormat wff_merge = new WritableCellFormat(wf_merge);
wff_merge.setAlignment(Alignment.CENTRE);
wff_merge.setBackground(jxl.format.Colour.GREY_50_PERCENT); // 设置单元格的背景颜色
wsheet.setRowView(i,400);
label = new Label(0, i, "产品型号",wff_merge);
wsheet.addCell(label);
label = new Label(1, i, "规格",wff_merge);
wsheet.addCell(label);
label = new Label(2, i, "电压",wff_merge);
wsheet.addCell(label);
label = new Label(3, i, "单位",wff_merge);
wsheet.addCell(label);
label = new Label(4, i, "数量",wff_merge);
wsheet.addCell(label);
// 列宽
wsheet.setColumnView(0, 18);
wsheet.setColumnView(1, 18);
wsheet.setColumnView(2, 18);
wsheet.setColumnView(3, 18);
wsheet.setColumnView(4, 18);
i++;
//数据
WritableCellFormat cellFormat=new WritableCellFormat();
cellFormat.setAlignment(Alignment.LEFT);
int j=1;
for(Iterator<OAQuotProduct> it = list.iterator(); it.hasNext();)
{
OAQuotProduct s = it.next();
wsheet.setRowView(i,400);
label = new Label(0, i, s.getName_1(),wff_merge);
label.setCellFormat(cellFormat);
wsheet.addCell(label);
label = new Label(1, i, s.getSpec(),wff_merge);
label.setCellFormat(cellFormat);
wsheet.addCell(label);
label = new Label(2,i, s.getVoltage(),wff_merge);
label.setCellFormat(cellFormat);
wsheet.addCell(label);
label = new Label(3,i, s.getStu(),wff_merge);
label.setCellFormat(cellFormat);
wsheet.addCell(label);
label = new Label(4,i, String.valueOf(s.getCount()),wff_merge);
label.setCellFormat(cellFormat);
wsheet.addCell(label);
i++;
j++;
}
wwb.write();
wwb.close();
} catch (RowsExceededException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (WriteException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return excelFile;
}
} }

View File

@ -88,7 +88,7 @@ spring:
# 密码 # 密码
password: password:
# 连接超时时间 # 连接超时时间
timeout: 30s timeout: 60s
lettuce: lettuce:
pool: pool:
# 连接池中的最小空闲连接 # 连接池中的最小空闲连接
@ -96,7 +96,7 @@ spring:
# 连接池中的最大空闲连接 # 连接池中的最大空闲连接
max-idle: 100 max-idle: 100
# 连接池的最大数据库连接数 # 连接池的最大数据库连接数
max-active: 300 max-active: 500
# #连接池最大阻塞等待时间(使用负值表示没有限制) # #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait: -1ms max-wait: -1ms
# 关闭超时时间 # 关闭超时时间

View File

@ -43,6 +43,7 @@ public class RedissonConfig {
// 可以用"rediss://"来启用SSL连接 // 可以用"rediss://"来启用SSL连接
String address = "redis://" + host + ":" + port; String address = "redis://" + host + ":" + port;
singleServerConfig.setAddress(address); singleServerConfig.setAddress(address);
config.useSingleServer().setPingConnectionInterval(0); // 防止出现 redis 连接不上的问题
// 设置 数据库编号 // 设置 数据库编号
singleServerConfig.setDatabase(database); singleServerConfig.setDatabase(database);
/* /*

View File

@ -108,7 +108,7 @@ export function saveQuot(data) {
data: data data: data
}) })
} }
//生成价单 //生成价单
export function madeXjQuot(data) { export function madeXjQuot(data) {
return request({ return request({
url: '/redBook/redBook/madeXjQuot', url: '/redBook/redBook/madeXjQuot',

View File

@ -8,7 +8,7 @@
<el-button style="float: right;" size="mini" type="primary" icon="el-icon-search" @click="handleSearchClick">搜索</el-button> <el-button style="float: right;" size="mini" type="primary" icon="el-icon-search" @click="handleSearchClick">搜索</el-button>
</el-col> </el-col>
<el-col :span="14"> <el-col :span="14">
<!--<el-button style="float: right;margin-left: 5px;" size="mini" type="primary" icon="el-icon-document" @click="handleMadeXjQuotClick" :disabled="selectedResultData.length==0 || madeQuotDis">生成询价单</el-button>--> <el-button style="float: right;margin-left: 5px;" size="mini" type="primary" icon="el-icon-document" @click="handleMadeXjQuotClick" :disabled="selectedResultData.length==0 || madeQuotDis">生成询价单</el-button>
<el-button style="float: right;margin-left: 5px;" size="mini" type="success" icon="el-icon-document" @click="handleMadeQuotClick" :disabled="selectedResultData.length==0 || madeQuotDis">生成报价单</el-button> <el-button style="float: right;margin-left: 5px;" size="mini" type="success" icon="el-icon-document" @click="handleMadeQuotClick" :disabled="selectedResultData.length==0 || madeQuotDis">生成报价单</el-button>
<el-button style="float: right;margin-left: 5px;" size="mini" type="warning" icon="el-icon-folder" @click="handleSaveClick" :disabled="selectedResultData.length==0">保存</el-button> <el-button style="float: right;margin-left: 5px;" size="mini" type="warning" icon="el-icon-folder" @click="handleSaveClick" :disabled="selectedResultData.length==0">保存</el-button>
<el-button style="float: right;margin-left: 5px;" size="mini" icon="el-icon-refresh" @click="handleRefreshClick">清空信息</el-button> <el-button style="float: right;margin-left: 5px;" size="mini" icon="el-icon-refresh" @click="handleRefreshClick">清空信息</el-button>
@ -784,27 +784,7 @@
handleMadeXjQuotClick() { handleMadeXjQuotClick() {
this.form.selectedResultData = this.selectedResultData; this.form.selectedResultData = this.selectedResultData;
madeXjQuot(this.form).then(response => { madeXjQuot(this.form).then(response => {
//this.$modal.msgSuccess(",:"+response.data.quotCode); this.$modal.msgSuccess("生成询价单成功,单号:"+response.data.quotCode);
//
const content = response;
const blob = new Blob([content]);
const fileName = "RB_BJD_"+this.getTodayCourse()+".xls";
if ("download" in document.createElement("a")) {
// IE
const elink = document.createElement("a");
elink.download = fileName;
elink.style.display = "none";
elink.href = URL.createObjectURL(blob);
document.body.appendChild(elink);
elink.click();
URL.revokeObjectURL(elink.href); // URL
document.body.removeChild(elink);
}else {
// IE10+
navigator.msSaveBlob(blob, fileName);
}
}); });
}, },

View File

@ -84,11 +84,6 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="审核人" align="center" prop="quotCheckUserNickname" width="160" /> <el-table-column label="审核人" align="center" prop="quotCheckUserNickname" width="160" />
<el-table-column label="报价时间" align="center" prop="quotQuotationDate" width="160">
<template slot-scope="scope">
<span>{{ parseTime(scope.row.quotQuotationDate) }}</span>
</template>
</el-table-column>
</el-table> </el-table>
</div> </div>
</template> </template>