From 6d43b412b773ceb910c64c3987e9ff67f418eab6 Mon Sep 17 00:00:00 2001 From: TianyangZhang Date: Mon, 23 Mar 2026 09:50:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E5=85=89=E8=8A=AFOA?= =?UTF-8?q?=E5=AE=A1=E6=89=B9=E7=9A=84BUG=E4=B8=8E=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/hrm/serializers.py | 2 ++ .../migrations/0006_publicity_final_file.py | 16 +++++++++++++ .../migrations/0007_lendingseal_final_file.py | 16 +++++++++++++ apps/ofm/models.py | 2 ++ apps/wf/services.py | 24 +++++++++++++++++++ 5 files changed, 60 insertions(+) create mode 100644 apps/ofm/migrations/0006_publicity_final_file.py create mode 100644 apps/ofm/migrations/0007_lendingseal_final_file.py diff --git a/apps/hrm/serializers.py b/apps/hrm/serializers.py index 03bc1153..b438375a 100755 --- a/apps/hrm/serializers.py +++ b/apps/hrm/serializers.py @@ -388,6 +388,8 @@ class TransferSerializer(CustomModelSerializer): belong_dept_name = serializers.CharField(source='employee.belong_dept.name', read_only=True) new_post_name = serializers.CharField(source="new_post.name", read_only=True) original_post_name = serializers.CharField(source="original_post.name", read_only=True) + new_dept_name = serializers.CharField(source="new_dept.name", read_only=True) + original_dept_name = serializers.CharField(source="original_dept.name", read_only=True) class Meta: model = EmployeeTransfer fields = '__all__' diff --git a/apps/ofm/migrations/0006_publicity_final_file.py b/apps/ofm/migrations/0006_publicity_final_file.py new file mode 100644 index 00000000..d263d026 --- /dev/null +++ b/apps/ofm/migrations/0006_publicity_final_file.py @@ -0,0 +1,16 @@ +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ofm', '0005_alter_vehicleuse_end_km'), + ] + + operations = [ + migrations.AddField( + model_name='publicity', + name='final_file', + field=models.CharField(blank=True, max_length=200, null=True, verbose_name='终版文件路径'), + ), + ] diff --git a/apps/ofm/migrations/0007_lendingseal_final_file.py b/apps/ofm/migrations/0007_lendingseal_final_file.py new file mode 100644 index 00000000..c2733bca --- /dev/null +++ b/apps/ofm/migrations/0007_lendingseal_final_file.py @@ -0,0 +1,16 @@ +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ofm', '0006_publicity_final_file'), + ] + + operations = [ + migrations.AddField( + model_name='lendingseal', + name='final_file', + field=models.CharField(blank=True, max_length=200, null=True, verbose_name='终版文件路径'), + ), + ] diff --git a/apps/ofm/models.py b/apps/ofm/models.py index a0f4d743..01d3337f 100644 --- a/apps/ofm/models.py +++ b/apps/ofm/models.py @@ -101,6 +101,7 @@ class LendingSeal(CommonBDModel): return_date = models.DateField('拟归还日期', blank=True, null=True) actual_return_date = models.DateField('实际归还日期', blank=True, null=True) reason = models.CharField('借用理由', max_length=100, blank=True, null=True) + final_file = models.CharField('终版文件路径', max_length=200, null=True, blank=True) ticket = models.ForeignKey('wf.ticket', verbose_name='关联工单', on_delete=models.SET_NULL, related_name='seal_ticket', null=True, blank=True, db_constraint=False) note = models.TextField('备注', null=True, blank=True) @@ -151,6 +152,7 @@ class Publicity(CommonBDModel): secret_period = models.CharField('秘密期限', max_length=50, blank=True, null=True) dept_opinion_review = models.CharField('部门审查意见', max_length=100, blank=True, null=True) publicity_opinion = models.CharField('宣传报道意见', max_length=100, blank=True, null=True) + final_file = models.CharField('终版文件路径', max_length=200, null=True, blank=True) ticket = models.ForeignKey('wf.ticket', verbose_name='关联工单', on_delete=models.SET_NULL, related_name='publicity_ticket', null=True, blank=True, db_constraint=False) diff --git a/apps/wf/services.py b/apps/wf/services.py index 5bf15095..ce17cbdf 100755 --- a/apps/wf/services.py +++ b/apps/wf/services.py @@ -464,6 +464,30 @@ class WfService(object): cls.task_ticket(ticket=ticket) + # 自动跳过连续相同审批人:如果下一个节点的处理人与当前处理人相同,自动执行同意操作 + if (handler is not None + and destination_state.type not in (State.STATE_TYPE_START, State.STATE_TYPE_END) + and transition.attribute_type == Transition.TRANSITION_ATTRIBUTE_TYPE_ACCEPT + and destination_participant_type == State.PARTICIPANT_TYPE_PERSONAL + and str(destination_participant) == str(handler.id)): + # 查找下一个状态的"同意"流转 + next_transition = Transition.objects.filter( + is_deleted=False, + source_state=destination_state, + attribute_type=Transition.TRANSITION_ATTRIBUTE_TYPE_ACCEPT + ).first() + if next_transition: + import logging + logger = logging.getLogger(__name__) + logger.info(f'工单{ticket.sn}: 连续节点审批人相同({handler.username}),自动跳过节点[{destination_state.name}]') + ticket = cls.handle_ticket( + ticket=ticket, + transition=next_transition, + new_ticket_data=ticket.ticket_data, + handler=handler, + suggestion='(系统自动审批:与上一节点审批人相同)', + ) + return ticket @classmethod