From 79e9e6e69d2c7e743f53dcd5b0d1944ebe64bd66 Mon Sep 17 00:00:00 2001 From: zhouhaibin Date: Sun, 27 Apr 2025 15:20:34 +0800 Subject: [PATCH] =?UTF-8?q?sjj=20=E5=8A=9F=E8=83=BD=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E4=B8=8E=E4=BC=98=E5=8C=962?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/resources/application-dev.yml | 4 +- .../src/main/resources/application.yml | 2 +- .../ContractualProductInfoController.java | 4 +- .../domain/bo/ContractualProductInfoBo.java | 1 + .../mapper/ContractualProductInfoMapper.java | 20 ++--- .../IContractualProductInfoService.java | 2 +- .../ContractualProductInfoServiceImpl.java | 37 ++++----- .../ContractualProductInfoMapper.xml | 80 ++++++++++++++----- 8 files changed, 94 insertions(+), 56 deletions(-) diff --git a/ruoyi-admin/src/main/resources/application-dev.yml b/ruoyi-admin/src/main/resources/application-dev.yml index 0735e3a..24d3f7c 100644 --- a/ruoyi-admin/src/main/resources/application-dev.yml +++ b/ruoyi-admin/src/main/resources/application-dev.yml @@ -52,8 +52,8 @@ spring: # url: jdbc:mysql://localhost:3306/jyjtable?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # username: root # password: root -# url: jdbc:mysql://10.1.21.250:3306/jyjtable?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true - url: jdbc:mysql://218.0.1.42:53306/jyjtable?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true + url: jdbc:mysql://10.1.21.250:3306/jyjtable?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true +# url: jdbc:mysql://218.0.1.42:53306/jyjtable?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # url: jdbc:mysql://10.1.21.251:3306/jyjtable?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true # url: jdbc:mysql://222.75.18.225:2881/jyjtable?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&autoReconnect=true&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&nullCatalogMeansCurrent=true username: root diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index 5d30007..ba78772 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -71,7 +71,7 @@ spring: basename: i18n/messages profiles: #@profiles.active@ - active: test + active: dev # 文件上传 servlet: multipart: diff --git a/zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/controller/ContractualProductInfoController.java b/zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/controller/ContractualProductInfoController.java index 7e5d755..85052c1 100644 --- a/zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/controller/ContractualProductInfoController.java +++ b/zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/controller/ContractualProductInfoController.java @@ -122,7 +122,7 @@ public class ContractualProductInfoController extends BaseController { * @param type 设备类型(终端、服务器、数据库) */ @GetMapping("/getProductStatistics") - public R getProductStatistics(@RequestParam String type) { - return R.ok(contractualProductInfoService.getProductStatistics(type)); + public R getProductStatistics(ContractualProductInfoBo bo) { + return R.ok(contractualProductInfoService.getProductStatistics(bo)); } } diff --git a/zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/bo/ContractualProductInfoBo.java b/zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/bo/ContractualProductInfoBo.java index 75bfe68..71b9f09 100644 --- a/zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/bo/ContractualProductInfoBo.java +++ b/zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/domain/bo/ContractualProductInfoBo.java @@ -72,6 +72,7 @@ public class ContractualProductInfoBo extends BaseEntity { private String type; public String unitName; private String os; + private String purchaserName; } diff --git a/zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/mapper/ContractualProductInfoMapper.java b/zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/mapper/ContractualProductInfoMapper.java index a5647bb..62869bc 100644 --- a/zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/mapper/ContractualProductInfoMapper.java +++ b/zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/mapper/ContractualProductInfoMapper.java @@ -30,40 +30,40 @@ public interface ContractualProductInfoMapper extends BaseMapperPlus selectProductSummaryByDocumentName(@Param("type") String type); + List selectProductSummaryByDocumentName(@Param("bo") ContractualProductInfoBo bo); /** * 根据类型查询供应商统计 * - * @param type 设备类型(终端、服务器、数据库) + * @param bo 设备类型(终端、服务器、数据库) * @return 供应商统计列表 */ - List> selectVendorStatistics(@Param("type") String type); + List> selectVendorStatistics(@Param("bo") ContractualProductInfoBo bo); /** * 根据类型查询品牌型号统计 * - * @param type 设备类型(终端、服务器、数据库) + * @param bo 设备类型(终端、服务器、数据库) * @return 品牌型号统计列表 */ - List> selectModelStatistics(@Param("type") String type); + List> selectModelStatistics(@Param("bo") ContractualProductInfoBo bo); /** * 根据类型查询CPU统计 * - * @param type 设备类型(终端、服务器、数据库) + * @param bo 设备类型(终端、服务器、数据库) * @return CPU统计列表 */ - List> selectCpuStatistics(@Param("type") String type); + List> selectCpuStatistics(@Param("bo") ContractualProductInfoBo bo); /** * 根据类型查询操作系统统计 * - * @param type 设备类型(终端、服务器、数据库) + * @param bo 设备类型(终端、服务器、数据库) * @return 操作系统统计列表 */ - List> selectOsStatistics(@Param("type") String type); + List> selectOsStatistics(@Param("bo") ContractualProductInfoBo bo); } diff --git a/zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/IContractualProductInfoService.java b/zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/IContractualProductInfoService.java index ed54edb..5eaede8 100644 --- a/zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/IContractualProductInfoService.java +++ b/zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/IContractualProductInfoService.java @@ -80,5 +80,5 @@ public interface IContractualProductInfoService { * @param type 设备类型(终端、服务器、数据库) * @return 产品统计数据 */ - ProductStatisticsData getProductStatistics(String type); + ProductStatisticsData getProductStatistics(ContractualProductInfoBo bo); } diff --git a/zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/impl/ContractualProductInfoServiceImpl.java b/zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/impl/ContractualProductInfoServiceImpl.java index f500749..1fda77b 100644 --- a/zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/impl/ContractualProductInfoServiceImpl.java +++ b/zaojiaManagement/zaojia-productManagement/src/main/java/org/dromara/productManagement/service/impl/ContractualProductInfoServiceImpl.java @@ -147,7 +147,7 @@ public class ContractualProductInfoServiceImpl implements IContractualProductInf @Override public TableDataInfo listContractualProductSummaryPage(ContractualProductInfoBo bo, PageQuery pageQuery) { // 修改策略:先获取所有记录,按DocumentName分组后再分页 - List summaryList = baseMapper.selectProductSummaryByDocumentName(bo.getType()); + List summaryList = baseMapper.selectProductSummaryByDocumentName(bo); return TableDataInfo.build(summaryList); } @@ -158,52 +158,53 @@ public class ContractualProductInfoServiceImpl implements IContractualProductInf * @return 产品统计数据 */ @Override - public ProductStatisticsData getProductStatistics(String type) { + public ProductStatisticsData getProductStatistics(ContractualProductInfoBo bo) { + String type = bo.getType(); ProductStatisticsData statisticsData = new ProductStatisticsData(); - + // 获取供应商占比数据 - List> vendorStats = baseMapper.selectVendorStatistics(type); + List> vendorStats = baseMapper.selectVendorStatistics(bo); List vendors = convertToStatItems(vendorStats); statisticsData.setVendors(vendors); - + // 获取品牌型号占比数据 - List> modelStats = baseMapper.selectModelStatistics(type); + List> modelStats = baseMapper.selectModelStatistics(bo); List models = convertToStatItems(modelStats); statisticsData.setModels(models); - + // 对于数据库类型,只需要统计前两项 if (!"数据库".equals(type)) { // 获取CPU品牌型号数据 - List> cpuStats = baseMapper.selectCpuStatistics(type); + List> cpuStats = baseMapper.selectCpuStatistics(bo); List cpus = convertToStatItems(cpuStats); statisticsData.setCpus(cpus); - + // 获取操作系统品牌版本数据 - List> osStats = baseMapper.selectOsStatistics(type); + List> osStats = baseMapper.selectOsStatistics(bo); List os = convertToStatItems(osStats); statisticsData.setOs(os); } - + return statisticsData; } - + /** * 将Map列表转换为StatItem列表 */ private List convertToStatItems(List> mapList) { List statItems = new ArrayList<>(); - + for (Map map : mapList) { ProductStatisticsData.StatItem item = new ProductStatisticsData.StatItem(); - + // 名称可能为空,需要处理 String name = map.get("name") != null ? map.get("name").toString() : "未知"; item.setName(name); - + // 数值转换,处理各种可能的数值类型 Object valueObj = map.get("value"); Integer value = 0; - + if (valueObj != null) { if (valueObj instanceof Number) { value = ((Number) valueObj).intValue(); @@ -215,11 +216,11 @@ public class ContractualProductInfoServiceImpl implements IContractualProductInf } } } - + item.setValue(value); statItems.add(item); } - + return statItems; } } diff --git a/zaojiaManagement/zaojia-productManagement/src/main/resources/mapper/productManagement/ContractualProductInfoMapper.xml b/zaojiaManagement/zaojia-productManagement/src/main/resources/mapper/productManagement/ContractualProductInfoMapper.xml index a0400d9..8157a8a 100644 --- a/zaojiaManagement/zaojia-productManagement/src/main/resources/mapper/productManagement/ContractualProductInfoMapper.xml +++ b/zaojiaManagement/zaojia-productManagement/src/main/resources/mapper/productManagement/ContractualProductInfoMapper.xml @@ -47,6 +47,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" AND p.unit_price = #{queryParam.unitPrice} + + AND i.purchaser_name = #{queryParam.purchaserName} + AND p.del_flag = '0' ORDER BY @@ -58,11 +61,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" b.document_name AS countyName, COUNT(DISTINCT dt.id) AS contractCount, SUM(CASE - WHEN #{type} = '终端' THEN + WHEN #{bo.type} = '终端' THEN CASE WHEN p.type IN ('台式计算机', '便携式计算机') THEN p.quantity ELSE 0 END - WHEN #{type} = '服务器' THEN + WHEN #{bo.type} = '服务器' THEN CASE WHEN p.type = '服务器' THEN p.quantity ELSE 0 END - WHEN #{type} = '数据库' THEN + WHEN #{bo.type} = '数据库' THEN CASE WHEN p.type = '数据库' THEN p.quantity ELSE 0 END ELSE 0 END) AS deviceCount, @@ -73,13 +76,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" document_tasks dt ON b.id = dt.group_id LEFT JOIN contractual_product_info p ON dt.id = p.task_id + LEFT JOIN + contractual_info ci ON dt.id = ci.task_id WHERE b.parent_id IS NOT NULL + + AND ci.purchaser_name = #{bo.purchaserName} + + + AND ci.file_name = #{bo.fileName} + + AND dt.result_type = 'reviewSuccess' AND dt.del_flag = '0' AND CASE - WHEN #{type} = '终端' THEN p.type IN ('台式计算机', '便携式计算机') - WHEN #{type} = '服务器' THEN p.type = '服务器' - WHEN #{type} = '数据库' THEN p.type = '数据库' + WHEN #{bo.type} = '终端' THEN p.type IN ('台式计算机', '便携式计算机') + WHEN #{bo.type} = '服务器' THEN p.type = '服务器' + WHEN #{bo.type} = '数据库' THEN p.type = '数据库' ELSE 1=1 END GROUP BY @@ -93,17 +105,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" FROM contractual_product_info p INNER JOIN - document_tasks dt ON p.task_id = dt.id AND dt.progress_status = 'SUCCESS' + document_tasks dt ON p.task_id = dt.id AND dt.result_type = 'reviewSuccess' INNER JOIN contractual_info ci ON p.task_id = ci.task_id WHERE CASE - WHEN #{type} = '终端' THEN p.type IN ('台式计算机', '便携式计算机') - WHEN #{type} = '服务器' THEN p.type = '服务器' - WHEN #{type} = '数据库' THEN p.type = '数据库' + WHEN #{bo.type} = '终端' THEN p.type IN ('台式计算机', '便携式计算机') + WHEN #{bo.type} = '服务器' THEN p.type = '服务器' + WHEN #{bo.type} = '数据库' THEN p.type = '数据库' ELSE 1=1 END AND p.del_flag = '0' + + AND ci.file_name = #{bo.fileName} + + + AND ci.purchaser_name = #{bo.purchaserName} + GROUP BY ci.supplier_name ORDER BY @@ -117,15 +135,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" FROM contractual_product_info p INNER JOIN - document_tasks dt ON p.task_id = dt.id AND dt.progress_status = 'SUCCESS' + document_tasks dt ON p.task_id = dt.id AND dt.result_type = 'reviewSuccess' WHERE CASE - WHEN #{type} = '终端' THEN p.type IN ('台式计算机', '便携式计算机') - WHEN #{type} = '服务器' THEN p.type = '服务器' - WHEN #{type} = '数据库' THEN p.type = '数据库' + WHEN #{bo.type} = '终端' THEN p.type IN ('台式计算机', '便携式计算机') + WHEN #{bo.type} = '服务器' THEN p.type = '服务器' + WHEN #{bo.type} = '数据库' THEN p.type = '数据库' ELSE 1=1 END AND p.del_flag = '0' + + AND ci.file_name = #{bo.fileName} + + + AND ci.purchaser_name = #{bo.purchaserName} + GROUP BY p.brand, p.version_str ORDER BY @@ -139,17 +163,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" FROM contractual_product_info p INNER JOIN - document_tasks dt ON p.task_id = dt.id AND dt.progress_status = 'SUCCESS' + document_tasks dt ON p.task_id = dt.id AND dt.result_type = 'reviewSuccess' WHERE CASE - WHEN #{type} = '终端' THEN p.type IN ('台式计算机', '便携式计算机') - WHEN #{type} = '服务器' THEN p.type = '服务器' - WHEN #{type} = '数据库' THEN p.type = '数据库' + WHEN #{bo.type} = '终端' THEN p.type IN ('台式计算机', '便携式计算机') + WHEN #{bo.type} = '服务器' THEN p.type = '服务器' + WHEN #{bo.type} = '数据库' THEN p.type = '数据库' ELSE 1=1 END AND p.cpu_model IS NOT NULL AND p.cpu_model != '' AND p.del_flag = '0' + + AND ci.file_name = #{bo.fileName} + + + AND ci.purchaser_name = #{bo.purchaserName} + GROUP BY p.cpu_model ORDER BY @@ -163,17 +193,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" FROM contractual_product_info p INNER JOIN - document_tasks dt ON p.task_id = dt.id AND dt.progress_status = 'SUCCESS' + document_tasks dt ON p.task_id = dt.id AND dt.result_type = 'reviewSuccess' WHERE CASE - WHEN #{type} = '终端' THEN p.type IN ('台式计算机', '便携式计算机') - WHEN #{type} = '服务器' THEN p.type = '服务器' - WHEN #{type} = '数据库' THEN p.type = '数据库' + WHEN #{bo.type} = '终端' THEN p.type IN ('台式计算机', '便携式计算机') + WHEN #{bo.type} = '服务器' THEN p.type = '服务器' + WHEN #{bo.type} = '数据库' THEN p.type = '数据库' ELSE 1=1 END AND p.os IS NOT NULL AND p.os != '' AND p.del_flag = '0' + + AND ci.file_name = #{bo.fileName} + + + AND ci.purchaser_name = #{bo.purchaserName} + GROUP BY p.os ORDER BY