liding
2 天以前 6733a32d4bcd7ad3ec3f109da0f3d2524766f7bb
1.数据优化 2.配煤计算器入库优化
已修改13个文件
380 ■■■■■ 文件已修改
main-business/src/main/java/com/ruoyi/business/controller/OfficialInventoryController.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/dto/OfficialInventoryDto.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/dto/PendingInventoryDto.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/service/OfficialInventoryService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/service/impl/OfficialInventoryServiceImpl.java 36 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/service/impl/PendingInventoryServiceImpl.java 218 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/resources/db/migration/postgresql/V20250604104500__create_table_pending_inventory.sql 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/resources/db/migration/postgresql/V20250613093400__create_table_production_master.sql 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/resources/db/migration/postgresql/V20250614134700__create_table_inspection_task.sql 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/resources/db/migration/postgresql/V20250630153900__create_table_timing_task.sql 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/resources/mapper/TimingTaskMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/db/beforeSql/postgresql/beforeSQL__sys.sql 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
main-business/src/main/java/com/ruoyi/business/controller/OfficialInventoryController.java
@@ -32,7 +32,7 @@
     * 正式库库表查询
     */
    @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);
    }
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; //媒质方案字段值
main-business/src/main/java/com/ruoyi/business/dto/PendingInventoryDto.java
@@ -35,6 +35,6 @@
    private List<Map<String, Object>> coalResultList;//配煤计算器煤种信息list
    private List<Map<String, Object>> fieldsResultList;//配煤计算器方案字段信息list
    private Map<String, Object> fieldsResultList;//配煤计算器方案字段信息list
}
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);
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());
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;
            }
            // 更新正式库
            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. 更新正式库
            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("正式库存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("更新正式库存失败: {}", 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("无法转换为Long: 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("无法转换为BigDecimal: key={}, value={}", key, value);
            return null;
        }
    }
}
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 '单价(含税)';
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,           -- 能耗成本
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=已删除';
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
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>
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>
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', '代码生成', '3', '2', 'gen', 'tool/gen/index', '', '', 1, 0, 'C', '0', '0', 'tool:gen:list', 'code',
       ('116', '代码生成', '3', '2', 'gen', 'tool/gen/index', '', '', 1, 0, 'C', '1', '0', 'tool:gen:list', 'code',
        'admin', CURRENT_TIMESTAMP, '', null, '代码生成菜单'),
       ('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, '');
-- 代码生成按钮
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', '导入代码', '116', '4', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:import', '#', 'admin',
        CURRENT_TIMESTAMP, '', NULL, '');
INSERT INTO sys_menu
VALUES ('1059', '预览代码', '116', '5', '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:preview', '#', 'admin',
        CURRENT_TIMESTAMP, '', NULL, '');
INSERT INTO sys_menu
VALUES ('1060', '生成代码', '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、代码生成业务表