From 14c1c2bfd1b767db0c2399cbd5ec489090df5efb Mon Sep 17 00:00:00 2001 From: xd <844539747@qq.com> Date: Mon, 17 Jun 2024 12:49:35 +0800 Subject: [PATCH] '123' --- .../web/controller/quot/QuotController.java | 29 ++++ .../controller/redBook/RedBookController.java | 87 ++++++++++- .../ruoyi/web/utils/rbExcel/excelUtil.java | 4 +- .../src/main/resources/application.yml | 4 +- .../framework/websocket/WebSocketServer.java | 4 +- .../domain/OAQuotProductTemplate2.java | 41 +++++ .../ruoyi/redBook/mapper/OARedBookMapper.java | 12 +- .../redBook/service/IRedBookService.java | 10 +- .../service/impl/AsyncRbTaskService.java | 17 ++- .../service/impl/RedBookServiceImpl.java | 58 +++++-- .../main/resources/mapper/quot/QuotMapper.xml | 2 +- .../mapper/redBook/OARedBookMapper.xml | 10 ++ ruoyi-ui/src/api/quot/quot.js | 17 +++ .../src/layout/components/NavbarNotice.vue | 2 +- ruoyi-ui/src/utils/request.js | 2 +- ruoyi-ui/src/views/quot/quot/index.vue | 141 ++++++++++++------ ruoyi-ui/src/views/redBook/productSelect.vue | 11 +- 17 files changed, 375 insertions(+), 76 deletions(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/redBook/domain/OAQuotProductTemplate2.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/quot/QuotController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/quot/QuotController.java index 7416cd0..470a10c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/quot/QuotController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/quot/QuotController.java @@ -157,6 +157,35 @@ public class QuotController extends BaseController return success(quot); } + /** + * 获取报价详细信息-整单通过 + */ + @PreAuthorize("@ss.hasPermi('quot:quot:allPass')") + @GetMapping(value = "/allPass/{quotId}") + @Log(title = "报价单-手动更新状态为通过", businessType = BusinessType.UPDATE) + public AjaxResult getAllPassInfo(@PathVariable("quotId") String quotId) + { + Quot quot = quotService.selectQuotByQuotId(quotId); + quot.setQuotApprovalStatus("2");// 提交状态设置为 通过 + quot.setQuotQuotationDate(DateUtils.getNowDate());//报价单-报价日期设置为 当前日期 + quot.setQuotCheckUserName(getUsername()); + quotService.updateQuot(quot); + return success(quot); + } + + /** + * 获取报价详细信息-整单驳回 + */ + @PreAuthorize("@ss.hasPermi('quot:quot:allReject')") + @PostMapping(value = "/allReject") + @Log(title = "报价单-手动更新状态为驳回", businessType = BusinessType.UPDATE) + public AjaxResult getAllRejectInfo(@RequestBody Quot quot) + { + quot.setQuotApprovalStatus("3");// 提交状态设置为 驳回 + quotService.updateQuot(quot); + return success(quot); + } + /** * 导出产品明细模板 * @param response diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/redBook/RedBookController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/redBook/RedBookController.java index aca60b3..21ff7e2 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/redBook/RedBookController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/redBook/RedBookController.java @@ -275,7 +275,7 @@ public class RedBookController extends BaseController } /** - * 导出产品明细模板 + * 导出产品明细模板-型号、规格、电压、数量 * @param response */ @PostMapping("/importTemplate") @@ -286,7 +286,7 @@ public class RedBookController extends BaseController } /** - * 导入产品明细 + * 导入产品明细-型号、规格、电压、数量 * @param file * @param updateSupport * @return @@ -332,7 +332,9 @@ public class RedBookController extends BaseController } System.out.println("开始时间:" + DateUtils.getTime()); - List> list = ListSplitUtil.averageList(tempList,10); + //List> list = ListSplitUtil.averageList(tempList,10); + List> list = ListSplitUtil.partList(tempList,20); + List OAQuotProducts = new ArrayList<>(); //定义一个存所有线程回调函数的list @@ -363,6 +365,85 @@ public class RedBookController extends BaseController return success(OAQuotProducts); } + /** + * 导出产品明细模板-品名型号 + * @param response + */ + @PostMapping("/importTemplate2") + public void importTemplate2(HttpServletResponse response) + { + ExcelUtil util = new ExcelUtil(OAQuotProductTemplate2.class); + util.importTemplateExcel(response, "产品数据"); + } + + /** + * 导入产品明细-品名型号 + * @param file + * @param updateSupport + * @return + * @throws Exception + */ + @PostMapping("/importData2") + public AjaxResult importData2(String rbUid, MultipartFile file, boolean updateSupport) throws Exception + { + ExcelUtil util = new ExcelUtil(OAQuotProductTemplate2.class); + List tempList = util.importExcel(file.getInputStream()); + + if(tempList.size()==0){ + return error("导入文件无产品明细数据"); + }else if(tempList.size()>200){ + return error("最多导入200条"); + } + + int index = 1; + for(OAQuotProductTemplate2 temp:tempList){ + temp.setIndex(index); + temp.setRbUid(rbUid); + + String name_0 = temp.getName_0(); + if(StringUtils.isNotBlank(name_0)){ + name_0 = name_0.trim(); + name_0 = name_0.replace(" "," "); + name_0 = name_0.toUpperCase(); + temp.setName_0(name_0); + } + index++; + } + + System.out.println("开始时间:" + DateUtils.getTime()); + //List> list = ListSplitUtil.averageList(tempList,10); + List> list = ListSplitUtil.partList(tempList,20); + + List OAQuotProducts = new ArrayList<>(); + + //定义一个存所有线程回调函数的list + List>> futureList=new ArrayList<>(); + int num = 1; + for(List lt:list){ + futureList.add(asyncRbTaskService.executeAsyncTask3("线程"+num+"【"+lt.size()+"条】",lt)); + num++; + } + //判断进程是否全部结束** + while (true){ + //回调信息空了就结束** + if (futureList.isEmpty()){ + break; + } + for (int i = 0; i < futureList.size(); i++) { + if (futureList.get(i).isDone()){ + OAQuotProducts.addAll(futureList.get(i).get()); + //判断线程结束,输出回调信息,并将该回调清除 + futureList.remove(i); + }else { + continue; + } + } + } + System.out.println("结束时间:" + DateUtils.getTime()); + Collections.sort(OAQuotProducts); + return success(OAQuotProducts); + } + /** * 获取调价日期 * @param oAQuot diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/utils/rbExcel/excelUtil.java b/ruoyi-admin/src/main/java/com/ruoyi/web/utils/rbExcel/excelUtil.java index ba4001e..55b421b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/utils/rbExcel/excelUtil.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/utils/rbExcel/excelUtil.java @@ -359,8 +359,8 @@ public class excelUtil { response.setContentType("application/vnd.ms-excel"); BigDecimal totalmoney = BigDecimal.ZERO; - File jnlogo_file = new File("logon/"+quot.getQuotCode()+".png"); - File wc_file = new File("logon/"+quot.getQuotCode()+".png"); + File jnlogo_file = new File("logon/"+IdUtils.createNo("jnlogo_",3)+".png"); + File wc_file = new File("logon/"+IdUtils.createNo("wc_",3)+".png"); try { OutputStream os = response.getOutputStream(); WritableWorkbook wwb = Workbook.createWorkbook(os); diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 9844aea..b810335 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -31,7 +31,7 @@ server: uri-encoding: UTF-8 # 连接数满后的排队数,默认为100 accept-count: 1000 - connection-timeout: 120s + connection-timeout: 600s threads: # tomcat最大线程数,默认为200 max: 800 @@ -110,7 +110,7 @@ token: # 令牌密钥 secret: abcdefghijklmnopqrstuvwxyz # 令牌有效期(默认30分钟) - expireTime: 30 + expireTime: 60 # MyBatis配置 mybatis: diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/websocket/WebSocketServer.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/websocket/WebSocketServer.java index 759ffca..3d7172d 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/websocket/WebSocketServer.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/websocket/WebSocketServer.java @@ -13,7 +13,7 @@ import org.springframework.stereotype.Component; /** * websocket 消息处理 - * + * * @author ruoyi */ @Component @@ -28,7 +28,7 @@ public class WebSocketServer /** * 默认最多允许同时在线人数100 */ - public static int socketMaxOnlineCount = 100; + public static int socketMaxOnlineCount = 10000; private static final Semaphore SOCKET_SEMAPHORE = new Semaphore(socketMaxOnlineCount); diff --git a/ruoyi-system/src/main/java/com/ruoyi/redBook/domain/OAQuotProductTemplate2.java b/ruoyi-system/src/main/java/com/ruoyi/redBook/domain/OAQuotProductTemplate2.java new file mode 100644 index 0000000..48a53e6 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/redBook/domain/OAQuotProductTemplate2.java @@ -0,0 +1,41 @@ +package com.ruoyi.redBook.domain; + +import com.ruoyi.common.annotation.Excel; + +import java.math.BigDecimal; + +public class OAQuotProductTemplate2 { + private Integer index; + + private String rbUid; + + @Excel(name = "品名型号") + private String name_0;//品名型号 + + @Excel(name = "数量") + private BigDecimal count;//数量 + + public Integer getIndex() { return index; } + + public void setIndex(Integer index) { this.index = index; } + + public String getRbUid() { return rbUid; } + + public void setRbUid(String rbUid) { this.rbUid = rbUid; } + + public String getName_0() { + return name_0; + } + + public void setName_0(String name_0) { + this.name_0 = name_0; + } + + public BigDecimal getCount() { + return count; + } + + public void setCount(BigDecimal count) { + this.count = count; + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/redBook/mapper/OARedBookMapper.java b/ruoyi-system/src/main/java/com/ruoyi/redBook/mapper/OARedBookMapper.java index 1449355..bfc8fc7 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/redBook/mapper/OARedBookMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/redBook/mapper/OARedBookMapper.java @@ -117,14 +117,22 @@ public interface OARedBookMapper String getFixDatePrice(@Param("name_0") String name_0,@Param("spec") String spec,@Param("voltage") String voltage, @Param("uid_0") String uid_0); /** - * 导入明细批量获取红本价格 - * @param name_0 + * 导入明细批量获取红本价格-型号、规格、电压、数量 + * @param name_1 * @param spec * @param rbUid * @return */ OAQuotProduct getFixDatePrice2(@Param("name_1") String name_1, @Param("spec") String spec, @Param("voltage") String voltage, @Param("uid_0") String rbUid); + /** + * 导入明细批量获取红本价格-品名型号 + * @param name_0 + * @param rbUid + * @return + */ + OAQuotProduct getFixDatePrice3(@Param("name_0") String name_0, @Param("uid_0") String rbUid); + /** * 查询已生成的报价单列表 * @param oaQuot diff --git a/ruoyi-system/src/main/java/com/ruoyi/redBook/service/IRedBookService.java b/ruoyi-system/src/main/java/com/ruoyi/redBook/service/IRedBookService.java index 158e2d1..7717479 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/redBook/service/IRedBookService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/redBook/service/IRedBookService.java @@ -141,12 +141,20 @@ public interface IRedBookService List setRedBookPrice(List list); /** - * 导入明细批量获取红本价格 + * 导入明细批量获取红本价格-型号、规格、电压、数量 * @param list * @return */ List setRedBookPrice2(List list); + /** + * 导入明细批量获取红本价格-品名型号 + * @param list + * @return + */ + List setRedBookPrice3(List list); + + /** * 获取单据编号 * @param type diff --git a/ruoyi-system/src/main/java/com/ruoyi/redBook/service/impl/AsyncRbTaskService.java b/ruoyi-system/src/main/java/com/ruoyi/redBook/service/impl/AsyncRbTaskService.java index ce1df69..2b5a24e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/redBook/service/impl/AsyncRbTaskService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/redBook/service/impl/AsyncRbTaskService.java @@ -3,6 +3,7 @@ package com.ruoyi.redBook.service.impl; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.redBook.domain.OAQuotProduct; import com.ruoyi.redBook.domain.OAQuotProductTemplate; +import com.ruoyi.redBook.domain.OAQuotProductTemplate2; import com.ruoyi.redBook.service.IRedBookService; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.AsyncResult; @@ -32,7 +33,7 @@ public class AsyncRbTaskService { } /** - * 导入明细批量获取红本价格 + * 导入明细批量获取红本价格-型号、规格、电压、数量 * @param threadname * @param list * @return @@ -44,5 +45,19 @@ public class AsyncRbTaskService { System.out.println(threadname+"结束时间:" + DateUtils.getTime()); return new AsyncResult<>( OAQuotProducts); } + + /** + * 导入明细批量获取红本价格-品名型号 + * @param threadname + * @param list + * @return + */ + @Async + public Future> executeAsyncTask3(String threadname, List list) { + System.out.println(threadname+"开始时间:" + DateUtils.getTime()); + List OAQuotProducts = iRedBookService.setRedBookPrice3(list); + System.out.println(threadname+"结束时间:" + DateUtils.getTime()); + return new AsyncResult<>( OAQuotProducts); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/redBook/service/impl/RedBookServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/redBook/service/impl/RedBookServiceImpl.java index af048fd..033d71e 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/redBook/service/impl/RedBookServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/redBook/service/impl/RedBookServiceImpl.java @@ -208,12 +208,17 @@ public class RedBookServiceImpl implements IRedBookService for(OAQuotProduct oAQuotProduct : list){ String price = oaRedBookMapper.getFixDatePrice(oAQuotProduct.getName_0(),oAQuotProduct.getSpec(),oAQuotProduct.getVoltage(),oAQuotProduct.getUid_0()); oAQuotProduct.setPrice(price); + if(StringUtils.isEmpty(price)){ + oAQuotProduct.setName_1(""); + oAQuotProduct.setVoltage(""); + oAQuotProduct.setStu(""); + } } return list; } /** - * 导入明细批量获取红本价格 + * 导入明细批量获取红本价格-型号、规格、电压、数量 * @param list * @return */ @@ -224,19 +229,44 @@ public class RedBookServiceImpl implements IRedBookService OAQuotProduct oAQuotProduct = new OAQuotProduct(); for(OAQuotProductTemplate oAQuotProductTemplate : list){ OAQuotProduct rbProduct = oaRedBookMapper.getFixDatePrice2(oAQuotProductTemplate.getName_1(),oAQuotProductTemplate.getSpec(),oAQuotProductTemplate.getVoltage(),oAQuotProductTemplate.getRbUid()); - if(rbProduct!=null){ - oAQuotProduct = new OAQuotProduct(); - oAQuotProduct.setIndex(oAQuotProductTemplate.getIndex()); - oAQuotProduct.setUid_0(rbProduct.getUid_0()); - oAQuotProduct.setName_0(rbProduct.getName_0()); - oAQuotProduct.setName_1(oAQuotProductTemplate.getName_1()); - oAQuotProduct.setSpec(oAQuotProductTemplate.getSpec()); - oAQuotProduct.setVoltage(rbProduct.getVoltage()); - oAQuotProduct.setStu(rbProduct.getStu()); - oAQuotProduct.setPrice(rbProduct.getPrice()); - oAQuotProduct.setCount(oAQuotProductTemplate.getCount()); - OAQuotProducts.add(oAQuotProduct); - } + oAQuotProduct = new OAQuotProduct(); + oAQuotProduct.setIndex(oAQuotProductTemplate.getIndex()); + oAQuotProduct.setUid_0(oAQuotProductTemplate.getRbUid()); + oAQuotProduct.setName_0(rbProduct!=null?rbProduct.getName_0():""); + oAQuotProduct.setName_1(oAQuotProductTemplate.getName_1()); + oAQuotProduct.setSpec(oAQuotProductTemplate.getSpec()); + oAQuotProduct.setVoltage(rbProduct!=null?rbProduct.getVoltage():""); + oAQuotProduct.setStu(rbProduct!=null?rbProduct.getStu():""); + oAQuotProduct.setPrice(rbProduct!=null?rbProduct.getPrice():""); + oAQuotProduct.setCount(oAQuotProductTemplate.getCount()); + OAQuotProducts.add(oAQuotProduct); + } + return OAQuotProducts; + } + + /** + * 导入明细批量获取红本价格-品名型号 + * @param list + * @return + */ + @Override + @DataSource(DataSourceType.OAREDBOOK) + public List setRedBookPrice3(List list) { + List OAQuotProducts = new ArrayList<>(); + OAQuotProduct oAQuotProduct = new OAQuotProduct(); + for(OAQuotProductTemplate2 oAQuotProductTemplate : list){ + OAQuotProduct rbProduct = oaRedBookMapper.getFixDatePrice3(oAQuotProductTemplate.getName_0(),oAQuotProductTemplate.getRbUid()); + oAQuotProduct = new OAQuotProduct(); + oAQuotProduct.setIndex(oAQuotProductTemplate.getIndex()); + oAQuotProduct.setUid_0(oAQuotProductTemplate.getRbUid()); + oAQuotProduct.setName_0(oAQuotProductTemplate.getName_0()); + oAQuotProduct.setName_1(rbProduct!=null?rbProduct.getName_1():""); + oAQuotProduct.setSpec(rbProduct!=null?rbProduct.getSpec():""); + oAQuotProduct.setVoltage(rbProduct!=null?rbProduct.getVoltage():"品名不规范"); + oAQuotProduct.setStu(rbProduct!=null?rbProduct.getStu():""); + oAQuotProduct.setPrice(rbProduct!=null?rbProduct.getPrice():""); + oAQuotProduct.setCount(oAQuotProductTemplate.getCount()); + OAQuotProducts.add(oAQuotProduct); } return OAQuotProducts; } diff --git a/ruoyi-system/src/main/resources/mapper/quot/QuotMapper.xml b/ruoyi-system/src/main/resources/mapper/quot/QuotMapper.xml index a2aa128..dbc72b1 100644 --- a/ruoyi-system/src/main/resources/mapper/quot/QuotMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/quot/QuotMapper.xml @@ -144,7 +144,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ${params.dataScope} - order by a.quot_code desc + order by a.quot_inquiry_date desc + + LEFT JOIN sys_user u on u.user_name=a.create_by LEFT JOIN sys_dept d on u.dept_id = d.dept_id diff --git a/ruoyi-ui/src/api/quot/quot.js b/ruoyi-ui/src/api/quot/quot.js index d7ee554..1babb54 100644 --- a/ruoyi-ui/src/api/quot/quot.js +++ b/ruoyi-ui/src/api/quot/quot.js @@ -39,6 +39,23 @@ export function getReturnUpdateQuot(quotId) { }) } +// 查询报价详细-整单通过 +export function getAllPass(quotId) { + return request({ + url: '/quot/quot/allPass/' + quotId, + method: 'get' + }) +} + +// 查询报价详细-整单驳回 +export function getAllReject(query) { + return request({ + url: '/quot/quot/allReject', + method: 'post', + data: query + }) +} + // 新增报价 export function addQuot(data) { return request({ diff --git a/ruoyi-ui/src/layout/components/NavbarNotice.vue b/ruoyi-ui/src/layout/components/NavbarNotice.vue index 90d0bd5..1afa5b9 100644 --- a/ruoyi-ui/src/layout/components/NavbarNotice.vue +++ b/ruoyi-ui/src/layout/components/NavbarNotice.vue @@ -147,7 +147,7 @@ }, mounted() { // 初始化WebSocket - this.initWebSocket(); + //this.initWebSocket(); }, created(){ this.getList(); diff --git a/ruoyi-ui/src/utils/request.js b/ruoyi-ui/src/utils/request.js index cb8fec4..d040d39 100644 --- a/ruoyi-ui/src/utils/request.js +++ b/ruoyi-ui/src/utils/request.js @@ -18,7 +18,7 @@ const service = axios.create({ // axios中请求配置有baseURL选项,表示请求URL公共部分 baseURL: process.env.VUE_APP_BASE_API, // 超时 - timeout: 300000 + timeout: 720000 }) // request拦截器 diff --git a/ruoyi-ui/src/views/quot/quot/index.vue b/ruoyi-ui/src/views/quot/quot/index.vue index 1f98d66..1401ac0 100644 --- a/ruoyi-ui/src/views/quot/quot/index.vue +++ b/ruoyi-ui/src/views/quot/quot/index.vue @@ -113,6 +113,28 @@ v-hasPermi="['quot:quot:returnUpdate']" >错误修订 + + 整单通过 + + + 整单驳回 + @@ -129,29 +151,6 @@ - - - - - - - - - - - - - - -