From 6733a32d4bcd7ad3ec3f109da0f3d2524766f7bb Mon Sep 17 00:00:00 2001 From: liding <756868258@qq.com> Date: 星期二, 15 七月 2025 15:54:33 +0800 Subject: [PATCH] 1.数据优化 2.配煤计算器入库优化 --- main-business/src/main/resources/db/migration/postgresql/V20250604104500__create_table_pending_inventory.sql | 2 main-business/src/main/resources/db/migration/postgresql/V20250614134700__create_table_inspection_task.sql | 4 main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java | 218 +++++++++++++++++++++--------- main-business/src/main/java/com/ruoyi/business/controller/OfficialInventoryController.java | 2 ruoyi-admin/src/main/resources/db/beforeSql/postgresql/beforeSQL__sys.sql | 98 +++++-------- pom.xml | 6 main-business/src/main/resources/mapper/TimingTaskMapper.xml | 4 main-business/src/main/java/com/ruoyi/business/service/impl/OfficialInventoryServiceImpl.java | 36 ++++ main-business/src/main/java/com/ruoyi/business/dto/OfficialInventoryDto.java | 2 main-business/src/main/java/com/ruoyi/business/service/OfficialInventoryService.java | 2 main-business/src/main/java/com/ruoyi/business/dto/PendingInventoryDto.java | 2 main-business/src/main/resources/db/migration/postgresql/V20250630153900__create_table_timing_task.sql | 2 main-business/src/main/resources/db/migration/postgresql/V20250613093400__create_table_production_master.sql | 2 13 files changed, 239 insertions(+), 141 deletions(-) diff --git a/main-business/src/main/java/com/ruoyi/business/controller/OfficialInventoryController.java b/main-business/src/main/java/com/ruoyi/business/controller/OfficialInventoryController.java index ab16d4f..a8b1667 100644 --- a/main-business/src/main/java/com/ruoyi/business/controller/OfficialInventoryController.java +++ b/main-business/src/main/java/com/ruoyi/business/controller/OfficialInventoryController.java @@ -32,7 +32,7 @@ * 姝e紡搴撳簱琛ㄦ煡璇� */ @GetMapping("/list") - public R<IPage<OfficialInventoryDto>> list(Page page, OfficialInventoryDto officialInventoryDto) { + public R<IPage<OfficialInventoryDto>> list(Page<OfficialInventory> page, OfficialInventoryDto officialInventoryDto) { IPage<OfficialInventoryDto> list = officialInventoryService.selectOfficialInventoryList(page, officialInventoryDto); return R.ok(list); } diff --git a/main-business/src/main/java/com/ruoyi/business/dto/OfficialInventoryDto.java b/main-business/src/main/java/com/ruoyi/business/dto/OfficialInventoryDto.java index d381090..fd90126 100644 --- a/main-business/src/main/java/com/ruoyi/business/dto/OfficialInventoryDto.java +++ b/main-business/src/main/java/com/ruoyi/business/dto/OfficialInventoryDto.java @@ -18,6 +18,8 @@ private String supplierName; //渚涘簲鍟� + private String registrant; //鐧昏浜� + private String supplierCoal; //渚涘簲鍟� + 鐓ょ private List<CoalValue> coalValues; //濯掕川鏂规瀛楁鍊� diff --git a/main-business/src/main/java/com/ruoyi/business/dto/PendingInventoryDto.java b/main-business/src/main/java/com/ruoyi/business/dto/PendingInventoryDto.java index cfb3036..0c6240e 100644 --- a/main-business/src/main/java/com/ruoyi/business/dto/PendingInventoryDto.java +++ b/main-business/src/main/java/com/ruoyi/business/dto/PendingInventoryDto.java @@ -35,6 +35,6 @@ private List<Map<String, Object>> coalResultList;//閰嶇叅璁$畻鍣ㄧ叅绉嶄俊鎭痩ist - private List<Map<String, Object>> fieldsResultList;//閰嶇叅璁$畻鍣ㄦ柟妗堝瓧娈典俊鎭痩ist + private Map<String, Object> fieldsResultList;//閰嶇叅璁$畻鍣ㄦ柟妗堝瓧娈典俊鎭痩ist } diff --git a/main-business/src/main/java/com/ruoyi/business/service/OfficialInventoryService.java b/main-business/src/main/java/com/ruoyi/business/service/OfficialInventoryService.java index 5036b83..67b885b 100644 --- a/main-business/src/main/java/com/ruoyi/business/service/OfficialInventoryService.java +++ b/main-business/src/main/java/com/ruoyi/business/service/OfficialInventoryService.java @@ -21,7 +21,7 @@ */ public interface OfficialInventoryService extends IService<OfficialInventory> { - IPage<OfficialInventoryDto> selectOfficialInventoryList(Page page, OfficialInventoryDto officialInventoryDto); + IPage<OfficialInventoryDto> selectOfficialInventoryList(Page<OfficialInventory> page, OfficialInventoryDto officialInventoryDto); int mergeAll(OfficialInventoryDto officialInventoryDto); diff --git a/main-business/src/main/java/com/ruoyi/business/service/impl/OfficialInventoryServiceImpl.java b/main-business/src/main/java/com/ruoyi/business/service/impl/OfficialInventoryServiceImpl.java index ab87226..eba9e50 100644 --- a/main-business/src/main/java/com/ruoyi/business/service/impl/OfficialInventoryServiceImpl.java +++ b/main-business/src/main/java/com/ruoyi/business/service/impl/OfficialInventoryServiceImpl.java @@ -19,9 +19,11 @@ import com.ruoyi.business.mapper.OfficialInventoryMapper; import com.ruoyi.business.service.OfficialInventoryService; import com.ruoyi.business.vo.OfficialInventoryVo; +import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.exception.base.BaseException; import com.ruoyi.common.utils.SecurityUtils; import com.ruoyi.common.utils.bean.BeanUtils; +import com.ruoyi.system.mapper.SysUserMapper; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -54,9 +56,11 @@ private final SupplyMapper supplyMapper; + private final SysUserMapper sysUserMapper; + @Override - public IPage<OfficialInventoryDto> selectOfficialInventoryList(Page page, OfficialInventoryDto officialInventoryDto) { + public IPage<OfficialInventoryDto> selectOfficialInventoryList(Page<OfficialInventory> page, OfficialInventoryDto officialInventoryDto) { // 鍏堟煡鍑哄師濮嬫暟鎹紙OfficialInventory锛� LambdaQueryWrapper<OfficialInventory> queryWrapper = new LambdaQueryWrapper<>(); @@ -73,6 +77,10 @@ .map(OfficialInventory::getSupplierId) .toList(); + List<Long> registrantIds = entityPage.getRecords().stream() + .map(OfficialInventory::getRegistrantId) + .toList(); + Map<Long, Supply> supplyMap; if (!supplierIds.isEmpty()) { List<Supply> infos = supplyMapper.selectList(new LambdaQueryWrapper<Supply>().in(Supply::getId, supplierIds)); @@ -81,19 +89,27 @@ supplyMap = new HashMap<>(); } + //鐧昏浜� + Map<Long, SysUser> userMap; + if (!registrantIds.isEmpty()) { + List<SysUser> sysUsers = sysUserMapper.selectList(registrantIds); + userMap = sysUsers.stream().collect(Collectors.toMap(SysUser::getUserId, Function.identity())); + }else { + userMap = new HashMap<>(); + } // 鏌ヨ鎵�鏈夊彲鐢ㄥ瓧娈碉紙CoalField锛� List<CoalField> coalFields = coalFieldMapper.selectList(null); List<String> allFieldNames = coalFields.stream() .map(CoalField::getFields) .distinct() - .collect(Collectors.toList()); + .toList(); //鏌ヨ鐓ょids List<Long> coalIds = entityPage.getRecords().stream() .map(OfficialInventory::getCoalId) .distinct() - .collect(Collectors.toList()); + .toList(); // 鎵归噺鏌ヨCoalInfo Map<Long, CoalInfo> coalInfoMap; @@ -113,6 +129,12 @@ Supply supply = supplyMap.get(entity.getSupplierId()); if (supply != null) { dto.setSupplierName(supply.getSupplierName()); + } + + // 鐧昏浜� + SysUser sysUser = userMap.get(entity.getRegistrantId()); + if (sysUser != null) { + dto.setRegistrant(sysUser.getNickName()); } List<CoalValue> coalValues; @@ -353,8 +375,10 @@ Map<Long, Supply> supplyMap = supplyMapper.selectByIds(supplierIds).stream() .collect(Collectors.toMap(Supply::getId, Function.identity())); - List<CoalValue> coalValues = coalValueMapper.selectList( - new LambdaQueryWrapper<CoalValue>().in(CoalValue::getPlanId, planIds)); + Map<Long, List<CoalValue>> coalValuesMap = coalValueMapper.selectList( + new LambdaQueryWrapper<CoalValue>().in(CoalValue::getPlanId, planIds)) + .stream() + .collect(Collectors.groupingBy(CoalValue::getPlanId)); // 4. 缁勮DTO return officialInventories.stream() .map(inventory -> { @@ -367,7 +391,7 @@ dto.setSupplierCoal(supply.getSupplierName() + " - " + coalInfo.getCoal()); } // 璁剧疆鐓よ川鏁版嵁 - dto.setCoalValues(coalValues); + dto.setCoalValues(coalValuesMap.getOrDefault(inventory.getCoalPlanId(), Collections.emptyList())); return dto; }) .collect(Collectors.toList()); diff --git a/main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java b/main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java index cacd7f6..1e6c5ad 100644 --- a/main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java +++ b/main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java @@ -37,6 +37,7 @@ import com.ruoyi.common.utils.bean.BeanUtils; import com.ruoyi.system.mapper.SysUserMapper; import lombok.RequiredArgsConstructor; +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.interceptor.TransactionAspectSupport; @@ -60,6 +61,7 @@ * @since 2025-06-04 */ @Service +@Slf4j @RequiredArgsConstructor public class PendingInventoryServiceImpl extends ServiceImpl<PendingInventoryMapper, PendingInventory> implements PendingInventoryService { @@ -303,113 +305,195 @@ @Transactional public boolean addPending(PendingInventoryDto pendingInventoryDto) { try { - CoalPlan coalPlan = coalPlanMapper.selectOne(new LambdaQueryWrapper<CoalPlan>().eq(CoalPlan::getPlan, "閰嶇叅璁$畻鍣ㄦ柟妗�")); + // 1. 鑾峰彇閰嶇叅璁$畻鍣ㄦ柟妗� + CoalPlan coalPlan = coalPlanMapper.selectOne( + new LambdaQueryWrapper<CoalPlan>().eq(CoalPlan::getPlan, "閰嶇叅璁$畻鍣ㄦ柟妗�")); if (coalPlan == null) { + log.error("閰嶇叅璁$畻鍣ㄦ柟妗堜笉瀛樺湪"); return false; } - // 娣诲姞鍒板緟鍏ュ簱 + // 2. 鍑嗗寰呭叆搴撹褰� Long userId = SecurityUtils.getUserId(); PendingInventory pendingInventory = new PendingInventory(); pendingInventory.setUnit("t"); pendingInventory.setRegistrantId(userId); pendingInventory.setRegistrationDate(LocalDate.now()); + pendingInventory.setSupplierName("閰嶇叅璁$畻鍣ㄦ柟妗堝叆搴�"); + pendingInventory.setCoalPlanId(coalPlan.getId()); - for (Map<String, Object> map : pendingInventoryDto.getFieldsResultList()) { - pendingInventory.setSupplierName("閰嶇叅璁$畻鍣ㄦ柟妗堝叆搴�"); + // 3. 瀹夊叏鑾峰彇瀛楁缁撴灉 + Map<String, Object> map = Optional.ofNullable(pendingInventoryDto.getFieldsResultList()) + .orElseThrow(() -> new BaseException("瀛楁缁撴灉鍒楄〃涓嶈兘涓虹┖")); - // 澶勭悊鐓ょ偔ID - if (map.get("coalId") == null) { - CoalInfo coalInfo = new CoalInfo(); - coalInfo.setCoal((String) map.get("createCoal")); - coalInfo.setMaintainerId(userId); - coalInfo.setMaintenanceDate(LocalDate.now()); - if (coalInfoMapper.insert(coalInfo) <= 0) { - return false; - } - pendingInventory.setCoalId(coalInfo.getId()); - } else { - pendingInventory.setCoalId((Long) map.get("coalId")); + // 4. 澶勭悊鐓ょ偔ID + if (map.get("coalId") == null) { + String coalName = safeGetString(map, "createCoal"); + if (coalName == null || coalName.isEmpty()) { + throw new BaseException("鐓ょ偔鍚嶇О涓嶈兘涓虹┖"); } - // 璁剧疆浠锋牸鍜屾暟閲� - BigDecimal cost = BigDecimal.valueOf((Double) map.get("cost")); - BigDecimal tonnage = BigDecimal.valueOf((Double) map.get("totalTonnage")); + CoalInfo coalInfo = new CoalInfo(); + coalInfo.setCoal(coalName); + coalInfo.setMaintainerId(userId); + coalInfo.setMaintenanceDate(LocalDate.now()); + if (coalInfoMapper.insert(coalInfo) <= 0) { + log.error("鍒涘缓鐓ょ偔淇℃伅澶辫触"); + return false; + } + pendingInventory.setCoalId(coalInfo.getId()); + } else { + Long coalId = safeGetLong(map, "coalId"); + if (coalId == null) { + throw new BaseException("鐓ょ偔ID鏍煎紡閿欒"); + } + pendingInventory.setCoalId(coalId); + } - pendingInventory.setPriceIncludingTax(cost); - pendingInventory.setInventoryQuantity(tonnage); - pendingInventory.setTotalPriceIncludingTax(cost.multiply(tonnage)); + // 5. 璁剧疆浠锋牸鍜屾暟閲� + BigDecimal cost = safeGetBigDecimal(map, "cost"); + BigDecimal tonnage = safeGetBigDecimal(map, "totalTonnage"); - BigDecimal costExcludingTax = cost.divide(BigDecimal.valueOf(1.13), 2, RoundingMode.HALF_UP); - pendingInventory.setPriceExcludingTax(costExcludingTax); - pendingInventory.setTotalPriceExcludingTax(costExcludingTax.multiply(tonnage)); - pendingInventory.setCoalPlanId(coalPlan.getId()); + if (cost == null || tonnage == null) { + throw new BaseException("鎴愭湰鎴栧惃浣嶄笉鑳戒负绌�"); + } - // 鐓よ川瀛楁鍊� - String coalFields = coalPlan.getCoalFields(); - List<String> coalFieldList = Arrays.asList(coalFields.split(",")); + pendingInventory.setPriceIncludingTax(cost); + pendingInventory.setInventoryQuantity(tonnage); + pendingInventory.setTotalPriceIncludingTax(cost.multiply(tonnage)); - for (String field : coalFieldList) { - CoalField coalField = coalFieldMapper.selectOne( - new LambdaQueryWrapper<CoalField>().eq(CoalField::getFields, field)); - if (coalField == null) { + BigDecimal costExcludingTax = cost.divide(BigDecimal.valueOf(1.13), 2, RoundingMode.HALF_UP); + pendingInventory.setPriceExcludingTax(costExcludingTax); + pendingInventory.setTotalPriceExcludingTax(costExcludingTax.multiply(tonnage)); + + // 6. 澶勭悊鐓よ川瀛楁鍊� + String coalFields = coalPlan.getCoalFields(); + if (coalFields == null || coalFields.isEmpty()) { + throw new BaseException("鐓よ川瀛楁閰嶇疆涓嶈兘涓虹┖"); + } + + String[] coalFieldList = coalFields.split(","); + for (String field : coalFieldList) { + CoalField coalField = coalFieldMapper.selectOne( + new LambdaQueryWrapper<CoalField>().eq(CoalField::getFields, field)); + if (coalField == null) { + log.warn("鏈壘鍒扮叅璐ㄥ瓧娈甸厤缃�: {}", field); + continue; + } + + CoalValue coalValue = new CoalValue(); + coalValue.setPlanId(coalPlan.getId()); + coalValue.setFields(field); + coalValue.setFieldName(coalField.getFieldName()); + coalValue.setType("1"); + + // 瀹夊叏璁剧疆鐓よ川鍊� + switch (coalField.getFieldName()) { + case "鍙戠儹閲�": + coalValue.setCoalValue(safeGetString(map, "cv")); + break; + case "纭垎": + coalValue.setCoalValue(safeGetString(map, "sulfur")); + break; + case "鐏板垎": + coalValue.setCoalValue(safeGetString(map, "ash")); + break; + case "姘村垎": + coalValue.setCoalValue(safeGetString(map, "moisture")); + break; + default: + log.warn("鏈煡鐓よ川瀛楁: {}", coalField.getFieldName()); continue; - } + } - CoalValue coalValue = new CoalValue(); - coalValue.setPlanId(coalPlan.getId()); - coalValue.setFields(field); - coalValue.setFieldName(coalField.getFieldName()); - coalValue.setType("1"); - - switch (coalField.getFieldName()) { - case "鍙戠儹閲�": - coalValue.setCoalValue((String) map.get("cv")); - break; - case "纭垎": - coalValue.setCoalValue((String) map.get("sulfur")); - break; - case "鐏板垎": - coalValue.setCoalValue((String) map.get("ash")); - break; - case "姘村垎": - coalValue.setCoalValue((String) map.get("moisture")); - break; - } - - // 淇濆瓨鐓よ川鍊� - if (coalValueMapper.insert(coalValue) <= 0) { - return false; - } + if (coalValueMapper.insert(coalValue) <= 0) { + log.error("淇濆瓨鐓よ川鍊煎け璐�: {}", field); + return false; } } - // 鎻掑叆寰呭叆搴撹褰� + // 7. 鎻掑叆寰呭叆搴撹褰� if (pendingInventoryMapper.insert(pendingInventory) <= 0) { + log.error("鎻掑叆寰呭叆搴撹褰曞け璐�"); return false; } - // 鏇存柊姝e紡搴� - for (Map<String, Object> coalResult : pendingInventoryDto.getCoalResultList()) { - Long officialId = (Long) coalResult.get("officialId"); - BigDecimal quantity = (BigDecimal) coalResult.get("quantity"); - OfficialInventory officialInventory = officialInventoryMapper.selectById(officialId); + // 8. 鏇存柊姝e紡搴� + List<Map<String, Object>> coalResults = Optional.ofNullable(pendingInventoryDto.getCoalResultList()) + .orElseThrow(() -> new BaseException("鐓ょ偔缁撴灉鍒楄〃涓嶈兘涓虹┖")); - if (officialInventory == null || officialInventory.getInventoryQuantity().compareTo(quantity) < 0) { + for (Map<String, Object> coalResult : coalResults) { + Long officialId = safeGetLong(coalResult, "officialId"); + BigDecimal quantity = safeGetBigDecimal(coalResult, "quantity"); + + if (officialId == null || quantity == null) { + throw new BaseException("姝e紡搴撳瓨ID鎴栨暟閲忎笉鑳戒负绌�"); + } + + OfficialInventory officialInventory = officialInventoryMapper.selectById(officialId); + if (officialInventory == null) { + throw new BaseException("鎵句笉鍒版寮忓簱瀛樿褰�: " + officialId); + } + + if (officialInventory.getInventoryQuantity().compareTo(quantity) < 0) { throw new BaseException("搴撳瓨鏁伴噺涓嶈冻锛屾坊鍔犺嚦寰呭叆搴撳け璐�"); } officialInventory.setInventoryQuantity(officialInventory.getInventoryQuantity().subtract(quantity)); if (officialInventoryMapper.updateById(officialInventory) <= 0) { + log.error("鏇存柊姝e紡搴撳瓨澶辫触: {}", officialId); return false; } } return true; } catch (Exception e) { - // 璁板綍鏃ュ織 log.error("娣诲姞寰呭叆搴撳け璐�", e); throw new BaseException("娣诲姞寰呭叆搴撳け璐�: " + e.getMessage()); } } + + // 瀹夊叏绫诲瀷杞崲杈呭姪鏂规硶 + private String safeGetString(Map<String, Object> map, String key) { + Object value = map.get(key); + if (value == null) { + return null; + } + return value.toString(); + } + + private Long safeGetLong(Map<String, Object> map, String key) { + Object value = map.get(key); + if (value == null) { + return null; + } + if (value instanceof Number) { + return ((Number) value).longValue(); + } + try { + return Long.parseLong(value.toString()); + } catch (NumberFormatException e) { + log.warn("鏃犳硶杞崲涓篖ong: key={}, value={}", key, value); + return null; + } + } + + private BigDecimal safeGetBigDecimal(Map<String, Object> map, String key) { + Object value = map.get(key); + if (value == null) { + return null; + } + if (value instanceof BigDecimal) { + return (BigDecimal) value; + } + if (value instanceof Number) { + return BigDecimal.valueOf(((Number) value).doubleValue()); + } + try { + return new BigDecimal(value.toString()); + } catch (NumberFormatException e) { + log.warn("鏃犳硶杞崲涓築igDecimal: key={}, value={}", key, value); + return null; + } + } } diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250604104500__create_table_pending_inventory.sql b/main-business/src/main/resources/db/migration/postgresql/V20250604104500__create_table_pending_inventory.sql index 83e436d..6a82005 100644 --- a/main-business/src/main/resources/db/migration/postgresql/V20250604104500__create_table_pending_inventory.sql +++ b/main-business/src/main/resources/db/migration/postgresql/V20250604104500__create_table_pending_inventory.sql @@ -3,7 +3,6 @@ ( id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID supplier_name VARCHAR(255) NOT NULL, -- 渚涜揣鍟嗗悕绉� - coal VARCHAR(50) NOT NULL, -- 鐓ょ unit VARCHAR(50) NOT NULL, -- 鍗曚綅 inventory_quantity NUMERIC(10, 2) NOT NULL, -- 搴撳瓨鏁伴噺 price_including_tax NUMERIC(10, 2) NOT NULL, -- 鍗曚环锛堝惈绋庯級 @@ -33,7 +32,6 @@ -- 瀛楁娉ㄩ噴 COMMENT ON COLUMN pending_inventory.id IS '涓婚敭ID'; COMMENT ON COLUMN pending_inventory.supplier_name IS '渚涜揣鍟嗗悕绉�'; -COMMENT ON COLUMN pending_inventory.coal IS '鐓ょ'; COMMENT ON COLUMN pending_inventory.unit IS '鍗曚綅'; COMMENT ON COLUMN pending_inventory.inventory_quantity IS '搴撳瓨鏁伴噺'; COMMENT ON COLUMN pending_inventory.price_including_tax IS '鍗曚环锛堝惈绋庯級'; diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250613093400__create_table_production_master.sql b/main-business/src/main/resources/db/migration/postgresql/V20250613093400__create_table_production_master.sql index 01a1ba2..51e69ed 100644 --- a/main-business/src/main/resources/db/migration/postgresql/V20250613093400__create_table_production_master.sql +++ b/main-business/src/main/resources/db/migration/postgresql/V20250613093400__create_table_production_master.sql @@ -2,7 +2,7 @@ CREATE TABLE production_master ( id BIGSERIAL PRIMARY KEY, -- 涓婚敭ID - coal_id BIGINT, -- 鐓ょID + coal_id VARCHAR(50), -- 鐓ょID production_quantity INT NOT NULL, -- 鐢熶骇鏁伴噺 labor_cost DECIMAL(10, 2) NOT NULL, -- 浜哄伐鎴愭湰 energy_consumption_cost DECIMAL(10, 2) NOT NULL, -- 鑳借�楁垚鏈� diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250614134700__create_table_inspection_task.sql b/main-business/src/main/resources/db/migration/postgresql/V20250614134700__create_table_inspection_task.sql index 68aab45..44611d3 100644 --- a/main-business/src/main/resources/db/migration/postgresql/V20250614134700__create_table_inspection_task.sql +++ b/main-business/src/main/resources/db/migration/postgresql/V20250614134700__create_table_inspection_task.sql @@ -9,7 +9,7 @@ remarks TEXT, -- 澶囨敞璇存槑 registrant_id BIGINT, -- 鐧昏浜哄憳id registrant VARCHAR(100), -- 鐧昏浜哄憳 - frequency VARCHAR(100), -- 棰戞 + frequency_type VARCHAR(100), -- 棰戞 deleted INT NOT NULL DEFAULT 0, -- 杞垹闄ゆ爣蹇楋細0=鏈垹闄わ紝1=宸插垹闄� create_by VARCHAR(255), -- 鍒涘缓浜虹敤鎴峰悕 @@ -34,6 +34,8 @@ ON COLUMN inspection_task.remarks IS '浠诲姟闄勫姞璇存槑鎴栫壒娈婃儏鍐佃褰�'; COMMENT ON COLUMN inspection_task.registrant IS '浠诲姟鐧昏浜哄鍚�'; +COMMENT +ON COLUMN inspection_task.frequency_type IS '棰戞'; COMMENT ON COLUMN inspection_task.deleted IS '杞垹闄ゆ爣蹇楋紝0=鏈垹闄わ紝1=宸插垹闄�'; diff --git a/main-business/src/main/resources/db/migration/postgresql/V20250630153900__create_table_timing_task.sql b/main-business/src/main/resources/db/migration/postgresql/V20250630153900__create_table_timing_task.sql index d5c2107..a0de620 100644 --- a/main-business/src/main/resources/db/migration/postgresql/V20250630153900__create_table_timing_task.sql +++ b/main-business/src/main/resources/db/migration/postgresql/V20250630153900__create_table_timing_task.sql @@ -42,7 +42,7 @@ COMMENT ON COLUMN timing_task.inspection_location IS '宸℃鍦扮偣'; COMMENT -ON COLUMN timing_task.frequency IS '棰戞'; +ON COLUMN timing_task.frequency_type IS '棰戞'; COMMENT ON COLUMN timing_task.remarks IS '澶囨敞'; COMMENT diff --git a/main-business/src/main/resources/mapper/TimingTaskMapper.xml b/main-business/src/main/resources/mapper/TimingTaskMapper.xml index 70fd0ab..0e547c7 100644 --- a/main-business/src/main/resources/mapper/TimingTaskMapper.xml +++ b/main-business/src/main/resources/mapper/TimingTaskMapper.xml @@ -13,7 +13,7 @@ <result column="task_name" property="taskName" /> <result column="inspector_ids" property="inspectorIds" /> <result column="inspection_location" property="inspectionLocation" /> - <result column="frequency" property="frequency" /> + <result column="frequency_type" property="frequencyType" /> <result column="remarks" property="remarks" /> <result column="registrant_id" property="registrantId" /> <result column="registrant" property="registrant" /> @@ -27,7 +27,7 @@ create_time, update_by, update_time, - id, task_name, inspector_ids, inspection_location, frequency, remarks, registrant_id, registrant, registration_date + id, task_name, inspector_ids, inspection_location, frequency_type, remarks, registrant_id, registrant, registration_date </sql> </mapper> \ No newline at end of file diff --git a/pom.xml b/pom.xml index de2ebda..9276600 100644 --- a/pom.xml +++ b/pom.xml @@ -272,6 +272,12 @@ <version>${freemarker.version}</version> </dependency> + <dependency> + <groupId>com.alibaba</groupId> + <artifactId>fastjson</artifactId> + <version>2.0.38</version> <!-- 閫夌敤鏈�鏂扮ǔ瀹氱増鏈� --> + </dependency> + </dependencies> <modules> diff --git a/ruoyi-admin/src/main/resources/db/beforeSql/postgresql/beforeSQL__sys.sql b/ruoyi-admin/src/main/resources/db/beforeSql/postgresql/beforeSQL__sys.sql index 2a01533..5886d7b 100644 --- a/ruoyi-admin/src/main/resources/db/beforeSql/postgresql/beforeSQL__sys.sql +++ b/ruoyi-admin/src/main/resources/db/beforeSql/postgresql/beforeSQL__sys.sql @@ -41,10 +41,8 @@ INSERT INTO sys_dept (dept_id, parent_id, ancestors, dept_name, order_num, leader, phone, email, status, del_flag, create_by, create_time, update_by, update_time) -VALUES (100, 0, '0', '鑻ヤ緷绉戞妧', 0, '鑻ヤ緷', '15888888888', 'ry@qq.com', '0', '0', 'admin', CURRENT_TIMESTAMP, '', NULL), - (101, 100, '0,100', '娣卞湷鎬诲叕鍙�', 1, '鑻ヤ緷', '15888888888', 'ry@qq.com', '0', '0', 'admin', CURRENT_TIMESTAMP, - '', NULL), - (102, 100, '0,100', '闀挎矙鍒嗗叕鍙�', 2, '鑻ヤ緷', '15888888888', 'ry@qq.com', '0', '0', 'admin', CURRENT_TIMESTAMP, +VALUES (100, 0, '0', '鏄痉鍨嬬叅', 0, '鑻ヤ緷', '15888888888', 'ry@qq.com', '0', '0', 'admin', CURRENT_TIMESTAMP, '', NULL), + (101, 100, '0,100', '闄曡タ鎬诲叕鍙�', 1, '鑻ヤ緷', '15888888888', 'ry@qq.com', '0', '0', 'admin', CURRENT_TIMESTAMP, '', NULL), (103, 101, '0,100,101', '鐮斿彂閮ㄩ棬', 1, '鑻ヤ緷', '15888888888', 'ry@qq.com', '0', '0', 'admin', CURRENT_TIMESTAMP, '', NULL), @@ -55,10 +53,6 @@ (106, 101, '0,100,101', '璐㈠姟閮ㄩ棬', 4, '鑻ヤ緷', '15888888888', 'ry@qq.com', '0', '0', 'admin', CURRENT_TIMESTAMP, '', NULL), (107, 101, '0,100,101', '杩愮淮閮ㄩ棬', 5, '鑻ヤ緷', '15888888888', 'ry@qq.com', '0', '0', 'admin', CURRENT_TIMESTAMP, - '', NULL), - (108, 102, '0,100,102', '甯傚満閮ㄩ棬', 1, '鑻ヤ緷', '15888888888', 'ry@qq.com', '0', '0', 'admin', CURRENT_TIMESTAMP, - '', NULL), - (109, 102, '0,100,102', '璐㈠姟閮ㄩ棬', 2, '鑻ヤ緷', '15888888888', 'ry@qq.com', '0', '0', 'admin', CURRENT_TIMESTAMP, '', NULL); @@ -116,10 +110,10 @@ -- 鍒濆鍖�-鐢ㄦ埛淇℃伅琛ㄦ暟鎹� INSERT INTO sys_user (dept_id, user_name, nick_name, user_type, email, phonenumber, sex, avatar, password, status, del_flag, login_ip, login_date, create_by, create_time, update_by, update_time, remark) -VALUES (103, 'admin', '鑻ヤ緷', '00', 'ry@163.com', '15888888888', '1', '', +VALUES (103, 'admin', '瓒呯骇绠$悊鍛�', '00', 'ry@163.com', '15888888888', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', CURRENT_TIMESTAMP, 'admin', CURRENT_TIMESTAMP, '', CURRENT_TIMESTAMP, '绠$悊鍛�'), - (105, 'ry', '鑻ヤ緷', '00', 'ry@qq.com', '15666666666', '1', '', + (105, 'zd', '鏄痉', '00', 'ry@qq.com', '15666666666', '1', '', '$2a$10$7JB720yubVSZvUI0rEqK/.VqGOZTH.ulu33dHOiBE8ByOhJIrdAu2', '0', '0', '127.0.0.1', CURRENT_TIMESTAMP, 'admin', CURRENT_TIMESTAMP, '', CURRENT_TIMESTAMP, '娴嬭瘯鍛�'); @@ -231,7 +225,7 @@ is_cache VARCHAR(10) DEFAULT 0, menu_type CHAR(1) DEFAULT '', visible CHAR(1) DEFAULT '0', - status INTEGER DEFAULT 0, + status VARCHAR(10) DEFAULT 0, perms VARCHAR(100) DEFAULT NULL, icon VARCHAR(100) DEFAULT '#', create_by VARCHAR(64) DEFAULT '', @@ -273,14 +267,12 @@ insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values ('1', '绯荤粺绠$悊', '0', '1', 'system', null, '', '', 1, 0, 'M', '0', '0', '', 'system', 'admin', +values ('1', '绯荤粺绠$悊', '0', '12', 'system', null, '', '', 1, 0, 'M', '0', '0', '', 'system', 'admin', CURRENT_TIMESTAMP, '', null, '绯荤粺绠$悊鐩綍'), - ('2', '绯荤粺鐩戞帶', '0', '2', 'monitor', null, '', '', 1, 0, 'M', '0', '0', '', 'monitor', 'admin', + ('2', '绯荤粺鐩戞帶', '0', '2', 'monitor', null, '', '', 1, 0, 'M', '1', '0', '', 'monitor', 'admin', CURRENT_TIMESTAMP, '', null, '绯荤粺鐩戞帶鐩綍'), - ('3', '绯荤粺宸ュ叿', '0', '3', 'tool', null, '', '', 1, 0, 'M', '0', '0', '', 'tool', 'admin', CURRENT_TIMESTAMP, - '', null, '绯荤粺宸ュ叿鐩綍'), - ('4', '鑻ヤ緷瀹樼綉', '0', '4', 'http://ruoyi.vip', null, '', '', 0, 0, 'M', '0', '0', '', 'guide', 'admin', - CURRENT_TIMESTAMP, '', null, '鑻ヤ緷瀹樼綉鍦板潃'); + ('3', '绯荤粺宸ュ叿', '0', '3', 'tool', null, '', '', 1, 0, 'M', '1', '0', '', 'tool', 'admin', CURRENT_TIMESTAMP, + '', null, '绯荤粺宸ュ叿鐩綍'); -- 浜岀骇鑿滃崟 insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, @@ -296,41 +288,57 @@ 'tree', 'admin', CURRENT_TIMESTAMP, '', null, '閮ㄩ棬绠$悊鑿滃崟'), ('104', '宀椾綅绠$悊', '1', '5', 'post', 'system/post/index', '', '', 1, 0, 'C', '0', '0', 'system:post:list', 'post', 'admin', CURRENT_TIMESTAMP, '', null, '宀椾綅绠$悊鑿滃崟'), - ('105', '瀛楀吀绠$悊', '1', '6', 'dict', 'system/dict/index', '', '', 1, 0, 'C', '0', '0', 'system:dict:list', + ('105', '瀛楀吀绠$悊', '1', '6', 'dict', 'system/dict/index', '', '', 1, 0, 'C', '1', '0', 'system:dict:list', 'dict', 'admin', CURRENT_TIMESTAMP, '', null, '瀛楀吀绠$悊鑿滃崟'), - ('106', '鍙傛暟璁剧疆', '1', '7', 'config', 'system/config/index', '', '', 1, 0, 'C', '0', '0', 'system:config:list', + ('106', '鍙傛暟璁剧疆', '1', '7', 'config', 'system/config/index', '', '', 1, 0, 'C', '1', '0', 'system:config:list', 'edit', 'admin', CURRENT_TIMESTAMP, '', null, '鍙傛暟璁剧疆鑿滃崟'), - ('107', '閫氱煡鍏憡', '1', '8', 'notice', 'system/notice/index', '', '', 1, 0, 'C', '0', '0', 'system:notice:list', + ('107', '閫氱煡鍏憡', '1', '8', 'notice', 'system/notice/index', '', '', 1, 0, 'C', '1', '0', 'system:notice:list', 'message', 'admin', CURRENT_TIMESTAMP, '', null, '閫氱煡鍏憡鑿滃崟'), - ('108', '鏃ュ織绠$悊', '1', '9', 'log', '', '', '', 1, 0, 'M', '0', '0', '', 'log', 'admin', CURRENT_TIMESTAMP, '', + ('108', '鏃ュ織绠$悊', '1', '9', 'log', '', '', '', 1, 0, 'M', '1', '0', '', 'log', 'admin', CURRENT_TIMESTAMP, '', null, '鏃ュ織绠$悊鑿滃崟'), - ('109', '鍦ㄧ嚎鐢ㄦ埛', '2', '1', 'online', 'monitor/online/index', '', '', 1, 0, 'C', '0', '0', + ('109', '鍦ㄧ嚎鐢ㄦ埛', '2', '1', 'online', 'monitor/online/index', '', '', 1, 0, 'C', '1', '0', 'monitor:online:list', 'online', 'admin', CURRENT_TIMESTAMP, '', null, '鍦ㄧ嚎鐢ㄦ埛鑿滃崟'), - ('110', '瀹氭椂浠诲姟', '2', '2', 'job', 'monitor/job/index', '', '', 1, 0, 'C', '0', '0', 'monitor:job:list', 'job', + ('110', '瀹氭椂浠诲姟', '2', '2', 'job', 'monitor/job/index', '', '', 1, 0, 'C', '1', '0', 'monitor:job:list', 'job', 'admin', CURRENT_TIMESTAMP, '', null, '瀹氭椂浠诲姟鑿滃崟'), - ('111', '鏁版嵁鐩戞帶', '2', '3', 'druid', 'monitor/druid/index', '', '', 1, 0, 'C', '0', '0', 'monitor:druid:list', + ('111', '鏁版嵁鐩戞帶', '2', '3', 'druid', 'monitor/druid/index', '', '', 1, 0, 'C', '1', '0', 'monitor:druid:list', 'druid', 'admin', CURRENT_TIMESTAMP, '', null, '鏁版嵁鐩戞帶鑿滃崟'), - ('112', '鏈嶅姟鐩戞帶', '2', '4', 'server', 'monitor/server/index', '', '', 1, 0, 'C', '0', '0', + ('112', '鏈嶅姟鐩戞帶', '2', '4', 'server', 'monitor/server/index', '', '', 1, 0, 'C', '1', '0', 'monitor:server:list', 'server', 'admin', CURRENT_TIMESTAMP, '', null, '鏈嶅姟鐩戞帶鑿滃崟'), - ('113', '缂撳瓨鐩戞帶', '2', '5', 'cache', 'monitor/cache/index', '', '', 1, 0, 'C', '0', '0', 'monitor:cache:list', + ('113', '缂撳瓨鐩戞帶', '2', '5', 'cache', 'monitor/cache/index', '', '', 1, 0, 'C', '1', '0', 'monitor:cache:list', 'redis', 'admin', CURRENT_TIMESTAMP, '', null, '缂撳瓨鐩戞帶鑿滃崟'), - ('114', '缂撳瓨鍒楄〃', '2', '6', 'cacheList', 'monitor/cache/list', '', '', 1, 0, 'C', '0', '0', + ('114', '缂撳瓨鍒楄〃', '2', '6', 'cacheList', 'monitor/cache/list', '', '', 1, 0, 'C', '1', '0', 'monitor:cache:list', 'redis-list', 'admin', CURRENT_TIMESTAMP, '', null, '缂撳瓨鍒楄〃鑿滃崟'), - ('115', '琛ㄥ崟鏋勫缓', '3', '1', 'build', 'tool/build/index', '', '', 1, 0, 'C', '0', '0', 'tool:build:list', + ('115', '琛ㄥ崟鏋勫缓', '3', '1', 'build', 'tool/build/index', '', '', 1, 0, 'C', '1', '0', 'tool:build:list', 'build', 'admin', CURRENT_TIMESTAMP, '', null, '琛ㄥ崟鏋勫缓鑿滃崟'), - ('116', '浠g爜鐢熸垚', '3', '2', 'gen', 'tool/gen/index', '', '', 1, 0, 'C', '0', '0', 'tool:gen:list', 'code', + ('116', '浠g爜鐢熸垚', '3', '2', 'gen', 'tool/gen/index', '', '', 1, 0, 'C', '1', '0', 'tool:gen:list', 'code', 'admin', CURRENT_TIMESTAMP, '', null, '浠g爜鐢熸垚鑿滃崟'), - ('117', '绯荤粺鎺ュ彛', '3', '3', 'swagger', 'tool/swagger/index', '', '', 1, 0, 'C', '0', '0', 'tool:swagger:list', + ('117', '绯荤粺鎺ュ彛', '3', '3', 'swagger', 'tool/swagger/index', '', '', 1, 0, 'C', '1', '0', 'tool:swagger:list', 'swagger', 'admin', CURRENT_TIMESTAMP, '', null, '绯荤粺鎺ュ彛鑿滃崟'); -- 涓夌骇鑿滃崟 insert into sys_menu (menu_id, menu_name, parent_id, order_num, path, component, query, route_name, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark) -values ('500', '鎿嶄綔鏃ュ織', '108', '1', 'operlog', 'monitor/operlog/index', '', '', 1, 0, 'C', '0', '0', +values ('500', '鎿嶄綔鏃ュ織', '108', '1', 'operlog', 'monitor/operlog/index', '', '', 1, 0, 'C', '1', '0', 'monitor:operlog:list', 'form', 'admin', CURRENT_TIMESTAMP, '', null, '鎿嶄綔鏃ュ織鑿滃崟'), - ('501', '鐧诲綍鏃ュ織', '108', '2', 'logininfor', 'monitor/logininfor/index', '', '', 1, 0, 'C', '0', '0', + ('501', '鐧诲綍鏃ュ織', '108', '2', 'logininfor', 'monitor/logininfor/index', '', '', 1, 0, 'C', '1', '0', 'monitor:logininfor:list', 'logininfor', 'admin', CURRENT_TIMESTAMP, '', null, '鐧诲綍鏃ュ織鑿滃崟'); + +-- 涓氬姟鑿滃崟 +INSERT INTO sys_menu ("menu_id", "menu_name", "parent_id", "order_num", "path", "component", "query", "route_name", "is_frame", + "is_cache", "menu_type", "visible", + "status", "perms", "icon", "create_by", "create_time", "update_by", "update_time", "remark") +VALUES + (1062, '鍩虹绠$悊', 0, 1, 'basicInformation', 'basicInformation/index', NULL, 'basicInformation', '1', '0', 'C', '0', '0', '', 'build', 'admin', CURRENT_TIMESTAMP, '', NULL, ''), + (1068, '鏂囨。绠$悊', 0, 9, 'archiveManagement', 'archiveManagement/index', NULL, 'archiveManagement', '1', '0', 'C', '0', '0', '', 'button', 'admin', CURRENT_TIMESTAMP, '', NULL, ''), + (1063, '搴撳瓨绠$悊', 0, 6, 'warehouseManagement', 'warehouseManagement/index', NULL, '', '1', '0', 'C', '0', '0', '', 'shopping', 'admin', CURRENT_TIMESTAMP, '', NULL, ''), + (1064, '閿�鍞嚭搴�', 0, 5, 'salesOutbound', 'salesOutbound/index', NULL, '', '1', '0', 'C', '0', '0', NULL, 'clipboard', 'admin', CURRENT_TIMESTAMP, '', NULL, ''), + (1065, '閲囪喘绠$悊', 0, 3, 'procureMent', 'procureMent/index', NULL, 'procureMent', '1', '0', 'C', '0', '0', NULL, 'dashboard', 'admin', CURRENT_TIMESTAMP, '', NULL, ''), + (1066, '鐢熶骇鍔犲伐', 0, 4, 'production', 'production/index', NULL, 'production', '1', '0', 'C', '0', '0', NULL, 'documentation', 'admin', CURRENT_TIMESTAMP, '', NULL, ''), + (1067, '閰嶇叅璁$畻', 0, 8, 'calculator', 'calculator/index', NULL, '', '1', '0', 'C', '0', '0', NULL, 'log', 'admin', CURRENT_TIMESTAMP, '', NULL, ''), + (1070, '宸℃绠$悊', 0, 7, 'inspectionManagement', 'inspectionManagement/index', NULL, '', '1', '0', 'C', '0', '0', NULL, 'time-range', 'admin', CURRENT_TIMESTAMP, '', NULL, ''), + (1071, '宸℃涓婁紶', 0, 10, 'inspectionUpload', 'inspectionUpload/index', NULL, '', '1', '0', 'C', '0', '0', NULL, 'button', 'admin', CURRENT_TIMESTAMP, '', NULL, ''), + (1072, '璁惧绠$悊', 0, 11, 'equipmentManagement', 'equipment/management/index', NULL, 'equipmentManagement', '1', '0', 'C', '0', '0', '', 'more-up', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); -- 鐢ㄦ埛绠$悊鎸夐挳 INSERT INTO sys_menu @@ -520,26 +528,6 @@ CURRENT_TIMESTAMP, '', NULL, ''); INSERT INTO sys_menu VALUES ('1054', '浠诲姟瀵煎嚭', '110', '6', '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:export', '#', 'admin', - CURRENT_TIMESTAMP, '', NULL, ''); - --- 浠g爜鐢熸垚鎸夐挳 -INSERT INTO sys_menu -VALUES ('1055', '鐢熸垚鏌ヨ', '116', '1', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:query', '#', 'admin', - CURRENT_TIMESTAMP, '', NULL, ''); -INSERT INTO sys_menu -VALUES ('1056', '鐢熸垚淇敼', '116', '2', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:edit', '#', 'admin', - CURRENT_TIMESTAMP, '', NULL, ''); -INSERT INTO sys_menu -VALUES ('1057', '鐢熸垚鍒犻櫎', '116', '3', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:remove', '#', 'admin', - CURRENT_TIMESTAMP, '', NULL, ''); -INSERT INTO sys_menu -VALUES ('1058', '瀵煎叆浠g爜', '116', '4', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:import', '#', 'admin', - CURRENT_TIMESTAMP, '', NULL, ''); -INSERT INTO sys_menu -VALUES ('1059', '棰勮浠g爜', '116', '5', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:preview', '#', 'admin', - CURRENT_TIMESTAMP, '', NULL, ''); -INSERT INTO sys_menu -VALUES ('1060', '鐢熸垚浠g爜', '116', '6', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:code', '#', 'admin', CURRENT_TIMESTAMP, '', NULL, ''); -- ---------------------------- @@ -1156,12 +1144,6 @@ COMMENT ON COLUMN sys_notice.update_by IS '鏇存柊鑰�'; COMMENT ON COLUMN sys_notice.update_time IS '鏇存柊鏃堕棿'; COMMENT ON COLUMN sys_notice.remark IS '澶囨敞'; - --- 鎻掑叆鍒濆鍖栨暟鎹� -INSERT INTO sys_notice -VALUES ('1', '娓╅Θ鎻愰啋锛�2018-07-01 鑻ヤ緷鏂扮増鏈彂甯冨暒', '2', '鏂扮増鏈唴瀹�', '0', 'admin', NOW(), '', NULL, '绠$悊鍛�'); -INSERT INTO sys_notice -VALUES ('2', '缁存姢閫氱煡锛�2018-07-01 鑻ヤ緷绯荤粺鍑屾櫒缁存姢', '1', '缁存姢鍐呭', '0', 'admin', NOW(), '', NULL, '绠$悊鍛�'); -- ---------------------------- -- 18銆佷唬鐮佺敓鎴愪笟鍔¤〃 -- Gitblit v1.9.3