数据库课设-中小企业工资管理系统

一、效果展示

二、后端代码

import string
import random
from flask import Flask, render_template, request, jsonify, redirect, session
import pymysql
from flask_cors import CORS
import time
import schedule
from datetime import datetime
import threading
from datetime import timedelta

app = Flask(__name__)
# 创建一个名为app的Flask实例
app.secret_key = 'man_what_can_i_say'
CORS(app)
# 启用CORS机制,允许跨域访问

#存储每天已经打卡的用户
user_attendance_day_list = []

# 设置会话有效时间为30分钟
app.config['PERMANENT_SESSION_LIFETIME'] = timedelta(minutes=30)

# 请求钩子,在每次请求之前被调用
@app.before_request
def before_request():
    session.permanent = True
    app.permanent_session_lifetime = timedelta(minutes=30)  # 设置每次请求后会话的有效时间为30分钟

    # 如果用户已经登录或会话已经存在,则更新会话的最后访问时间
    if 'user_id' in session:
        session.modified = True

##
# 数据库模块
##

# MySQL数据库配置
DATABASE_CONFIG = {
    'host': '127.0.0.1',
    'user': 'root',
    'password': 'Your_Password',
    'database': 'sql_web',
    'cursorclass': pymysql.cursors.DictCursor
    # 指定游标类型为字典类型,使查询结果以字典形式返回,键为列名,值为对应数据
}

# 创建MySQL连接
# 将字典DATABASE_CONFIG中的键对值解包后作为参数传递给connect函数,函数会返回一个表示与数据库连接的对象
def create_connection():
    return pymysql.connect(**DATABASE_CONFIG)

# 创建用户表
def create_users_table():
    conn = create_connection()
    cursor = conn.cursor()
    cursor.execute('''
    CREATE TABLE IF NOT EXISTS users (
        u_id SMALLINT AUTO_INCREMENT PRIMARY KEY,
        username VARCHAR(255) NOT NULL,
        password VARCHAR(255) NOT NULL,
        phone VARCHAR(255) NOT NULL,
        department_id TINYINT NOT NULL,
        user_post_id TINYINT NOT NULL,
        attendance_day TINYINT DEFAULT 0,
        leave_day TINYINT DEFAULT 0,
        absence_day TINYINT DEFAULT 0,
        achievement_bouns INT DEFAULT 0,
        absence_nopay INT DEFAULT 0,
        other_nopay INT DEFAULT 0,
        gross_pay INT DEFAULT 0,
        after_tax_salary INT DEFAULT 0
    )
    ''')
    # 依次为用户姓名、手机号、所属部门、用户职务、工资、考勤天数、请假天数、缺勤天数、绩效奖金、缺勤扣除、其他扣除、税前工资、税后工资
    #至于不在用户表中设置基础工资的原因:因为基础工资是和所属部门和职务挂钩的,而且基础工资内容可以改变,不在用户表中设置基础工资,
    # 可以实现在显示用户的基础工资时,其个人中心的基础工资和工资制度中的基础工资是相吻合的
    conn.commit()  # 提交对数据库的更改
    conn.close()  # 关闭数据库连接

# 创建部门基础工资表
def create_department_salary_table():
    conn = create_connection()
    cursor = conn.cursor()
    cursor.execute('''
    CREATE TABLE IF NOT EXISTS department_salary(
        id  SMALLINT AUTO_INCREMENT PRIMARY KEY,
        department VARCHAR(255) NOT NULL,
        position VARCHAR(255) NOT NULL,
        basic_salary INT DEFAULT 0,
        overtime_pay INT DEFAULT 0,
        other_salary INT DEFAULT 0,
        d_id SMALLINT NOT NULL,
        p_id SMALLINT NOT NULL
    )
    ''')
    conn.commit()
    conn.close()

# 创建用户考勤表
def create_user_attendance_table(u_id):
    id = "attendance_table" + str(u_id)
    conn = create_connection()
    cursor = conn.cursor()
    cursor.execute('''
        CREATE TABLE IF NOT EXISTS `{}`(
            date_time DATE, 
            attendance_value SMALLINT
        )
    '''.format(id))  # 第一个字段用来统计日期,第二个字段分别表示打卡(1)、请假(0)、缺勤(-1)
    print("考勤表创建")
    conn.commit()
    conn.close()

# 登录功能数据库模块
def get_user(username, password):
    conn = create_connection()
    cursor = conn.cursor()
    cursor.execute('SELECT * FROM users WHERE username = %s AND password = %s', (username, password))
    user = cursor.fetchone()  # 将查询的这行数据存储到变量user中
    conn.close()
    return user

# 删除用户数据库模块
def user_delete_sql(u_id):
    conn = create_connection()
    cursor = conn.cursor()
    cursor.execute('DELETE FROM users WHERE u_id = %s', u_id)  # 先在用户表里删除
    cursor.execute('DROP TABLE `{}`'.format("attendance_table" + str(u_id)) ) # 再将该用户的考勤表删除
    conn.commit()
    conn.close()

# 修改用户信息数据库模块
def user_update_sql(u_id, username, password, phone, department_id, user_post_id, gross_pay):
    conn = create_connection()
    cursor = conn.cursor()
    cursor.execute('UPDATE users SET username=%s,password=%s,phone=%s,department_id=%s,'
                   'user_post_id=%s,gross_pay=%s WHERE u_id=%s',(username,password,phone,department_id,
                                                              user_post_id,gross_pay,u_id))
    conn.commit()
    conn.close()

# 用户列表数据库模块
def user_list_sql():
    conn = create_connection()
    cursor = conn.cursor()
    cursor.execute('SELECT * FROM users')
    user_list = cursor.fetchall()
    conn.close()
    return user_list

# 个人信息数据库模块
def user_information_sql(u_id):
    conn = create_connection()
    cursor = conn.cursor()
    cursor.execute('SELECT * FROM users WHERE u_id = %s', u_id)
    user_info = cursor.fetchone()
    conn.close()
    return user_info

# 管理界面添加用户数据库模块
def user_add_sql(username, password, phone, department_id, user_post_id,gross_pay,after_tax_salary):
    create_users_table()
    conn = create_connection()
    cursor = conn.cursor()
    cursor.execute('INSERT INTO users(username,password,phone,department_id,user_post_id,'
                   'gross_pay,after_tax_salary)'
                   'VALUES(%s,%s,%s,%s,%s,%s,%s)', (username, password, phone, department_id,
                                                        user_post_id,gross_pay,after_tax_salary))
    conn.commit()
    conn.close()

# 管理界面搜索用户数据库模块
def user_search_sql(username):
    conn = create_connection()
    cursor = conn.cursor()
    cursor.execute('SELECT * FROM users WHERE username=%s', username)
    search_result = cursor.fetchall()
    conn.close()
    return search_result

# 系统概览数据库模块
def system_overview_sql():
    conn = create_connection()
    cursor = conn.cursor()
    cursor.execute('SELECT SUM(gross_pay) FROM users')
    salary_total = cursor.fetchone()['SUM(gross_pay)']
    cursor.execute('SELECT COUNT(*) FROM users')
    staff_total = cursor.fetchone()['COUNT(*)']
    return staff_total, salary_total

# 自动根据员工职务以及所属部门分配工资数据库模块
def automatic_salary_allocation(department_id,user_post_id):
    create_department_salary_table()
    id_ = 0
    if department_id == 1 and user_post_id == 1:
        id_ = 1
    elif department_id == 1 and user_post_id == 2:
        id_ = 2
    elif department_id == 1 and user_post_id == 3:
        id_ = 3
    elif department_id == 1 and user_post_id == 4:
        id_ = 4
    elif department_id == 2 and user_post_id == 1:
        id_ = 5
    elif department_id == 2 and user_post_id == 2:
        id_ = 6
    elif department_id == 2 and user_post_id == 3:
        id_ = 7
    elif department_id == 2 and user_post_id == 4:
        id_ = 8
    elif department_id == 3 and user_post_id == 1:
        id_ = 9
    elif department_id == 3 and user_post_id == 2:
        id_ = 10
    elif department_id == 3 and user_post_id == 3:
        id_ = 11
    elif department_id == 3 and user_post_id == 4:
        id_ = 12
    elif department_id == 4 and user_post_id == 1:
        id_ = 13
    elif department_id == 4 and user_post_id == 2:
        id_ = 14
    elif department_id == 4 and user_post_id == 3:
        id_ = 15
    elif department_id == 4 and user_post_id == 4:
        id_ = 16
    elif department_id == 5 and user_post_id == 1:
        id_ = 17
    elif department_id == 5 and user_post_id == 2:
        id_ = 18
    elif department_id == 5 and user_post_id == 3:
        id_ = 19
    elif department_id == 5 and user_post_id == 4:
        id_ = 20
    elif department_id == 6 and user_post_id == 1:
        id_ = 21
    elif department_id == 6 and user_post_id == 2:
        id_ = 22
    elif department_id == 6 and user_post_id == 3:
        id_ = 23
    elif department_id == 6 and user_post_id == 4:
        id_ = 24
    else:
        id_ = 25
    conn = create_connection()
    cursor = conn.cursor()
    cursor.execute('SELECT basic_salary,overtime_pay,other_salary FROM department_salary WHERE id=%s',id_)
    salary_tuple = cursor.fetchone()
    return salary_tuple

#公共单次数据库查询表数据库模块
def public_search_one_sql(variable_one,variable_two,variable_three,variable_four):
    conn = create_connection()
    cursor = conn.cursor()
    cursor.execute(f'SELECT `{variable_one}` FROM `{variable_two}` WHERE `{variable_three}`=%s',variable_four)
    public_result = cursor.fetchone()
    conn.close()
    return public_result

#公共单次数据库修改表数据库模块
def public_update_one_sql(variable_one,variable_two,variable_three,variable_four,variable_five):
    conn = create_connection()
    cursor = conn.cursor()
    cursor.execute(f'UPDATE `{variable_one}` SET `{variable_two}`= %s WHERE `{variable_three}`=%s',
                   (variable_four,variable_five))
    conn.commit()
    conn.close()

#公共单次查询数据库-无条件 数据库模块
def public_search_one_no_condition(variable_one,variable_two):
    conn = create_connection()
    cursor = conn.cursor()
    cursor.execute(f'SELECT `{variable_one}` FROM `{variable_two}`')
    public_result = cursor.fetchall()
    conn.close()
    return public_result

#python定时任务来定时插入考勤表数据,也就是用户每天考勤表是默认为缺勤的,用户在点击考勤之后,会更新考勤表数据,以此来记录
def timing_insert_attendance_table_sql():
    print("timing函数调用")
    global user_attendance_day_list
    global now_date
    user_attendance_day_list.clear()
    conn = create_connection()
    cursor = conn.cursor()
    cursor.execute('SELECT u_id FROM users')
    variable_list = cursor.fetchall()
    for variable_tuple in variable_list:
        create_user_attendance_table(variable_tuple['u_id'])
        variable_temporary = 'attendance_table'+str(variable_tuple['u_id'])
        cursor.execute(f'INSERT INTO `{variable_temporary}`(date_time,attendance_value) VALUES(%s,-1)',str(now_date))
        conn.commit()
    conn.close()

#获取所有用户的u_id
def get_all_users_u_id():
    conn = create_connection()
    cursor = conn.cursor()
    cursor.execute('SELECT u_id FROM users')
    users_u_id = cursor.fetchall()
    conn.close()
    return users_u_id

#各部门工资组成列表
def salary_composition_list():
    conn = create_connection()
    cursor = conn.cursor()
    cursor.execute('SELECT id,basic_salary,overtime_pay,other_salary,d_id,p_id FROM department_salary')
    salary_composition_list = cursor.fetchall()
    return salary_composition_list

#管理员修改各部门基础工资功能数据库模块
def modify_salary_sql():
    return 1

# 用户密码生成函数
def create_password(length=8):
    # 定义包含所有可能的字符串
    all_characters = string.ascii_letters + string.digits + string.punctuation
    # 随机选择字符生成密码
    password = ''.join(random.choice(all_characters) for _ in range(length))
    return password

#绩效奖金/其他罚金 管理函数
def user_achievement_bouns_or_other_nopay(u_id,new_salary):
    print("user_achievement_bouns_or_other_nopay函数调用")
    old_salary = public_search_one_sql('gross_pay','users','u_id',u_id)['gross_pay']
    print(old_salary)
    print(new_salary)
    if old_salary > new_salary:
        public_update_one_sql('users','other_nopay','u_id',(old_salary-new_salary),u_id)
        after_tax_salary = new_salary
        if 5000 < new_salary <= 15000:
            after_tax_salary = new_salary - (new_salary - 5000) * 0.05
        else:
            after_tax_salary = new_salary - (new_salary - 5000) * 0.1 - 350
        public_update_one_sql('users', 'after_tax_salary', 'u_id', after_tax_salary, u_id)

    elif old_salary < new_salary:
        public_update_one_sql('users','achievement_bouns','u_id',(new_salary-old_salary),u_id)
        after_tax_salary = new_salary
        if 5000 < new_salary <= 15000:
            after_tax_salary = new_salary - (new_salary - 5000) * 0.05
        else:
            after_tax_salary = new_salary - (new_salary - 5000) * 0.1 - 350
        public_update_one_sql('users', 'after_tax_salary', 'u_id', after_tax_salary, u_id)

#用户工资算法(要在每天8点之后核算,这里用定时任务执行)
def user_salary_algorithm():
    if get_current_time():
        global user_attendance_day_list
        user_all_list = [d['u_id'] for d in get_all_users_u_id()]
        difference_list = list(set(user_all_list)-set(user_attendance_day_list))
        #所有的用户与打卡的用户之间的不同就是缺勤的用户
        for u_id in difference_list:
            old_absence_nopay = public_search_one_sql('absence_nopay','users','u_id',u_id)['absence_nopay']
            gross_pay = public_search_one_sql('gross_pay','users','u_id',u_id)['gross_pay']
            public_update_one_sql('users','absence_nopay','u_id',(100+old_absence_nopay),u_id)
            #更新用户的缺勤罚金
            public_update_one_sql('users','gross_pay','u_id',(gross_pay-100),u_id)
            #更新用户的税前工资
            after_tax_salary = gross_pay
            if 5000 < gross_pay <= 15000:
                after_tax_salary = gross_pay - (gross_pay - 5000) * 0.05
            else:
                after_tax_salary = gross_pay - (gross_pay - 5000) * 0.1 - 350
            public_update_one_sql('users','absence_nopay','u_id',after_tax_salary,u_id)

#用户列表中的关于考勤数据的更新
def user_table_about_attendance_column():
    global now_date
    user_all_list = [d['u_id'] for d in get_all_users_u_id()]
    conn = create_connection()
    cursor = conn.cursor()
    for u_id in user_all_list:
        table_name = 'attendance_table'+str(u_id)
        attendance_value = public_search_one_sql('attendance_value',table_name,'date_time',now_date)['attendance_value']
        column_name = ''
        if attendance_value > 0:
            column_name = 'attendance_day'
        elif attendance_value==0:
            column_name = 'leave_day'
        else:
            column_name = 'absence_day'
        cursor.execute(f'UPDATE users SET `{column_name}`=`{column_name}`+1 WHERE u_id=%s', u_id)
        conn.commit()
    conn.close()

#获取系统时间函数
def get_current_time():
    now = datetime.now()
    return now.strftime("%Y-%m-%d")

#定时任务函数
def run_schedule():
    while True:
        schedule.run_pending()
        time.sleep(1)

# 页面路由
@app.route("/")
def index():
    if session.get('logged_in'):
        u_id = session['user']['u_id']
        total = system_overview_sql()
        staff_total = total[0]
        salary_total = total[1]
        average_wage = staff_total / salary_total
        # timing_insert_attendance_table_sql()
        # user_salary_algorithm()
        # user_table_about_attendance_column()
        return render_template("index.html", staff_total=staff_total, salary_total=salary_total,
                               average_wage=average_wage,u_id=u_id)
    else:
        return redirect("/login_interface")

# 用户登录界面路由
@app.route("/login_interface")
def login_interface():
    return render_template("login.html")

# 登陆验证模块
@app.route("/login", methods=['POST'])
def login():
    create_users_table()
    data = request.json
    username = data.get('Username')
    password = data.get('Password')
    # 调用方法,实现对用户名和密码是否匹配的验证
    user = get_user(username, password)
    # 使用session将用户数据存储在其中,从而存储用户登录信息,方便后续调用
    if user:
        session['user'] = {
            'username': username,
            'u_id': user['u_id'],
            'user_post_id': user['user_post_id']
        }
        session['logged_in'] = True
        u_id = session['user']['u_id']
        print(public_search_one_sql('absence_nopay','users','u_id',u_id)['absence_nopay'])
        return jsonify({'success': True, 'message': '登录成功'})
    else:
        return jsonify({'success': False, 'message': '无效的用户名或密码'}), 401

# 用户注销
@app.route("/logout")
def logout():
    session.pop('user', None)
    session.pop('logged_in', None)
    return redirect("/")

# 用户管理界面
@app.route("/manage_interface")
def manage_interface():
    if session['user']['user_post_id'] <= 1:
        return render_template("manage_interface.html")

#用户管理界面-用户列表
@app.route("/manage_user_list")
def manage_interface_user_list():
    user_list = user_list_sql()
    return jsonify(user_list)

# 用户管理功能-添加用户
@app.route("/user_add", methods=['POST'])
def user_add():
    data = request.json
    username = data.get('Username')
    password = create_password()
    phone = data.get('Phone')
    department_id = data.get('Department_id')
    user_post_id = data.get('Position_id')
    salary_tuple = automatic_salary_allocation(int(department_id), int(user_post_id))
    basic_salary = salary_tuple['basic_salary']     #基本工资
    overtime_pay = salary_tuple['overtime_pay']     #加班工资
    other_salary = salary_tuple['other_salary']     #其他津贴
    gross_pay = basic_salary+overtime_pay+other_salary     #根据用户的所属部门和职务来获取基本工资、加班工资、其他津贴
    after_tax_salary = gross_pay
    if 5000 < gross_pay <= 15000:
        after_tax_salary = gross_pay-(gross_pay-5000)*0.05
    else:
        after_tax_salary = gross_pay-(gross_pay-5000)*0.1-350
    user_add_sql(username, password, phone, department_id, user_post_id,gross_pay,after_tax_salary)
    return jsonify({'success': True, 'message': '添加成功'})

#用户管理界面-编辑用户
@app.route("/user_update",methods=['POST'])
def user_update():
    data = request.json
    u_id = int(data.get('u_id'))
    username = data.get('username')
    password = data.get('password')
    phone = data.get('phone')
    department_id = int(data.get('department_id'))
    user_post_id = int(data.get('user_post_id'))
    gross_pay = int(data.get('gross_pay'))
    user_achievement_bouns_or_other_nopay(u_id,gross_pay)
    user_update_sql(u_id,username,password,phone,department_id,user_post_id,gross_pay)
    return jsonify({'success': True, 'message': '编辑成功'})

#用户管理界面-删除用户
@app.route("/user_delete",methods=['POST'])
def user_delete():
    data = request.json
    u_id = int(data.get('userId'))
    user_delete_sql(u_id)
    return jsonify({'success': True, 'message': '删除成功'})

#用户管理界面-搜索用户
@app.route("/user_search",methods=['POST'])
def user_search():
    data = request.json
    username = data.get('Uname')
    conn = create_connection()
    cursor = conn.cursor()
    cursor.execute('SELECT * FROM users WHERE username=%s',username)
    search_result_list = cursor.fetchall()
    print(search_result_list)
    return jsonify({'success': True, 'message': '搜索成功'})


# 个人信息界面
@app.route("/profile_interface")
def profile_interface():
    if session.get('logged_in'):
        user_info = user_information_sql(session['user']['u_id'])
        user_department_post_salary = automatic_salary_allocation(int(user_info['department_id']),
                                                                  int(user_info['user_post_id']))
        return render_template("profile.html", username=str(user_info['username']), phone=user_info['phone'],
                               department_id=user_info['department_id'],
                               user_post_id=user_info['user_post_id'],
                               basic_salary=user_department_post_salary['basic_salary'],
                               overtime_pay = user_department_post_salary['overtime_pay'],
                               other_salary =user_department_post_salary['other_salary'],
                               attendance_day=user_info['attendance_day'],
                               leave_day=user_info['leave_day'],absence_day=user_info['absence_day'],
                               achievement_bouns=user_info['achievement_bouns'],
                               absence_nopay=user_info['absence_nopay'],
                               other_nopay=user_info['other_nopay'],
                               gross_pay=user_info['gross_pay'],
                               after_tax_salary=user_info['after_tax_salary']
                               )
    else:
        return redirect("/login_interface")

#考勤功能
@app.route("/attendance_function",methods=['POST'])
def attendance_function():
    data = request.json
    u_id = session['user']['u_id']
    global user_attendance_day_list
    if u_id not in user_attendance_day_list:
        user_attendance_day_list.append(u_id)
        attendance_value = int(data.get('action'))
        attendance_table = 'attendance_table'+str(u_id)
        global now_date
        public_update_one_sql(attendance_table,'attendance_value','date_time',attendance_value,now_date)
        return jsonify({'success': True, 'message': '今日打卡成功'})
    else:
        return jsonify({'success': True, 'message': '今日已打卡'})

# 财务界面
@app.route("/finance_department")
def finance_interface():
    if session['user']['user_post_id'] <= 2:
        return render_template("finance_department.html")

# 报销页面
@app.route("/reimbursement_interface")
def reimbursement_interface():
    return render_template("reimbursement.html")

# 报销功能
@app.route("/reimbursement")
def reimbursement():
    return 1

# 工资制度
@app.route("/salary_composition")
def salary_composition():
    # a=salary_composition_list()
    # print(a)
    return render_template("salary_composition.html",salary_composition_list=salary_composition_list())

#工资制度修改
@app.route("/salary_composition_change")
def salary_composition_change():
    return 1

#后勤采购
@app.route("/logistics_procurement_interface")
def logistics_procurement_interface():
    return render_template("logistics_procurement.html")

schedule.every().day.at("08:00").do(timing_insert_attendance_table_sql)
schedule.every().day.at("08:01").do(user_salary_algorithm)
schedule.every().day.at("08:02").do(user_table_about_attendance_column)
# 创建定时任务线程
schedule_thread = threading.Thread(target=run_schedule)
schedule_thread.daemon = True  # 设置为守护线程,当主线程结束时,该线程也会结束
schedule_thread.start()

#获取系统时间
now_date = get_current_time()

if __name__ == '__main__':
    app.run(debug=True)

三、前端代码

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:/a/703733.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

国内服务器安装 Docker 服务和拉取 dockerhub 镜像

前提: 有一台海外的VPS,目的是安装dockerhub镜像.适用debian系统 1: 安装 docker-ce (国内服务器) sudo apt-get update sudo apt-get install ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://mirrors.aliyun.com/docker-ce/linux/…

bfs+枚举,CF666B - World Tour

一、题目 1、题目描述 2、输入输出 2.1输入 2.2输出 3、原题链接 Problem - 666B - Codeforces 二、解题报告 1、思路分析 数据量允许跑N次bfs预处理所有点的最短路&#xff0c;以及预处理到达每个点距离最远的3个点&#xff0c;以及每个点能够到达的最远的3个点 我们枚举…

第 6 章: Spring 中的 JDBC

JDBC 的全称是 Java Database Connectivity&#xff0c;是一套面向关系型数据库的规范。虽然数据库各有不同&#xff0c;但这些数据库都提供了基于 JDBC 规范实现的 JDBC 驱动。开发者只需要面向 JDBC 接口编程&#xff0c;就能在很大程度上规避数据库差异带来的问题。Java 应用…

康谋分享 | 自动驾驶联合仿真——功能模型接口FMI(一)

功能模型接口FMI&#xff08;Functional Mock-up Interface&#xff09;是一个开放且与工具解耦的标准。FMI包含了一个C-API&#xff08;接口&#xff09;&#xff0c;一个用于描述接口的XML文件以及可交换的功能模型单元FMU&#xff08;Functional Mock-up Unit&#xff09;&a…

解读surging 的内存过高的原因

前言 对于.NET开发人员来讲&#xff0c;一个程序占用内存过高&#xff0c;是极其糟糕&#xff0c;是一款不合格的程序软件&#xff0c;.NET开发人员也不会去使用服务器垃圾收集器(ServerGarbageCollection),而是选用工作站垃圾收集器&#xff0c;而是对于一款低内存的程序更能给…

CP AUTOSAR标准中文文档链接索引

AUTOSAR标准的核心组件包括通信、诊断、安全等&#xff0c;这些组件通过模块化结构进行组织。系统被划分为多个模块&#xff0c;每个模块负责特定的功能。模块之间通过接口进行通信&#xff0c;接口定义了模块之间的交互规则。AUTOSAR标准支持模块的配置&#xff0c;可以根据不…

debug调试_以Pycharm为例

文章目录 作用步骤打断点调试调试窗口 作用 主要是检查逻辑错误&#xff0c;而非语法错误。 步骤 打断点 在需要调试的代码行前打断点&#xff0c;执行后会停顿在断点位置&#xff08;不运行&#xff09; 调试 右键“debug”&#xff0c;或者直接点击右上角的小虫子 调试…

8.11 矢量图层线要素单一符号使用七(爆炸线)

文章目录 前言爆炸线&#xff08;Lineburst&#xff09;QGis设置线符号为爆炸线&#xff08;Lineburst&#xff09;二次开发代码实现爆炸线&#xff08;Lineburst&#xff09; 总结 前言 本章介绍矢量图层线要素单一符号中爆炸线&#xff08;Lineburst&#xff09;的使用说明&…

kotlin之foreach跳出循环

1.创建函数跳出循环。 fun breakTest() {(0..10).forEachIndexed { index, i ->Log.d("test start index$index,i$i")if (index > 7) {return}Log.d("test end index$index,i$i")}}2.通过run语句&#xff0c;将会在if判断语句为true的时候跳出run代…

大模型:分本分割模型

目录 一、文本分割 二、BERT文本分割模型 三、部署模型 3.1 下载模型 3.2 安装依赖 3.3 部署模型 3.4 运行服务 四、测试模型 一、文本分割 文本分割是自然语言处理中的一项基础任务&#xff0c;目标是将连续的文本切分成有意义的片段&#xff0c;这些片段可以是句子、…

SprringCloud Gateway动态添加路由不重启

前言&#xff1a; 在微服务项目中&#xff0c;SpringCloud Gateway扮演着极为重要的角色&#xff0c;主要提供了路由、负载均衡、认证鉴权等功能。本文主要讲解如何实现网关的自定义动态路由配置&#xff0c;无需重启网关模块即可生效。 一、动态路由必要性 在微服务架构中&…

ATFX汇市:美联储利率决议来袭,按兵不动概率较高

ATFX汇市&#xff1a;本周四凌晨2:00&#xff0c;美联储将公布6月份利率决议结果&#xff0c;市场普遍预期其将维持5.5%的基准利率上限不变&#xff0c;预期落地的话&#xff0c;美元指数将受利多提振。考虑到上周加拿大央行和欧央行相继降息25基点&#xff0c;美联储出现跟随性…

前方碰撞缓解系统技术规范(简化版)

前方碰撞缓解系统技术规范(简化版) 1 系统概述2 工作时序3 预警目标4 功能条件5 HMI开关6 显示需求7 相关子功能8 TTC标定参考9 指标需求1 系统概述 前方碰撞缓解系统包含LW潜在危险报警、FCW前方碰撞预警和AEB自动紧急制动三个部分。 LW潜在危险报警:根据本车与前车保持的…

MyBatis进行模糊查询时SQL语句拼接引起的异常问题

项目场景&#xff1a; CRM项目&#xff0c;本文遇到的问题是在实现根据页面表单中输入条件&#xff0c;在数据库中分页模糊查询数据&#xff0c;并在页面分页显示的功能时&#xff0c;出现的“诡异”bug。 开发环境如下&#xff1a; 操作系统&#xff1a;Windows11 Java&#…

DIYGW可视化开发工具:微信小程序与多端应用开发的利器

一、引言 随着移动互联网的飞速发展&#xff0c;微信小程序以其轻便、易用和跨平台的特点受到了广泛关注。然而&#xff0c;微信小程序的开发相较于传统的H5网页开发&#xff0c;在UI搭建和交互设计上存在一定的挑战。为了应对这些挑战&#xff0c;开发者们一直在寻找更加高效…

Hadoop的读写流程

Hadoop分布式文件系统(HDFS)是Apache Hadoop项目的核心组件,它为大数据存储提供了一个可靠、可扩展的存储解决方案。本文将详细介绍HDFS的读写数据流程,包括数据的存储原理、读写过程以及优化策略。 一、HDFS简介 HDFS是一个高度容错的分布式文件系统,它设计用于运行在通…

使用adb通过wifi连接手机

1&#xff0c;手机打开开发者模式&#xff0c;打开无线调试 2&#xff0c;命令行使用adb命令配对&#xff1a; adb pair 192.168.0.102:40731 输入验证码&#xff1a;422859 3&#xff0c;连接设备&#xff1a; adb connect 192.168.0.102:36995 4&#xff0c;查看连接状态:…

【全开源】旅行吧旅游门票预订系统源码(FastAdmin+ThinkPHP+Uniapp)

&#x1f30d;旅游门票预订系统&#xff1a;畅游世界&#xff0c;一键预订 一款基于FastAdminThinkPHPUniapp开发的旅游门票预订系统&#xff0c;支持景点门票、导游产品便捷预订、美食打卡、景点分享、旅游笔记分享等综合系统&#xff0c;提供前后台无加密源码&#xff0c;支…

嵌入式linux系统中设备树的经典使用方法

第一:设备树简介 大家好,今天主要给大家分享一下,如何使用linux系统里面的设备树,详细分析如下。 可以参考的官方文档有: 官方文档(可以下载到 devicetree-specification-v0.2.pdf): https://www.devicetree.org/specifications/ 内核文档: …

Java:爬虫htmlunit抓取a标签

如果对htmlunit还不了解的话可以参考Java&#xff1a;爬虫htmlunit-CSDN博客 了解了htmlunit之后&#xff0c;我们再来学习如何在页面中抓取我们想要的数据&#xff0c;我们在学习初期可以找一些结构比较清晰的网站来做测试爬取&#xff0c;首先我们随意找个网站如下&#xff…