|
@@ -33,7 +33,8 @@ EXAMINE_TYPE_DICT = {
|
|
|
0: "草稿",
|
|
|
10: "提交",
|
|
|
20: "领导审批",
|
|
|
- 30: "重新提交"
|
|
|
+ 30: "重新提交",
|
|
|
+ 40: "转交"
|
|
|
}
|
|
|
|
|
|
EXAMINE_SUB_TYPE_DICT = {
|
|
@@ -42,7 +43,8 @@ EXAMINE_SUB_TYPE_DICT = {
|
|
|
20: "待审批",
|
|
|
21: "审批通过",
|
|
|
22: "审批不通过",
|
|
|
- 30: "重新提交"
|
|
|
+ 30: "重新提交",
|
|
|
+ 40: "转交"
|
|
|
}
|
|
|
|
|
|
# 信息发布分页(我能看的内容,小屏)
|
|
@@ -364,6 +366,7 @@ def get_signature_base64(db: Session, response_id: int):
|
|
|
|
|
|
return "data:image/png;base64," + image2base64(row.file_path)
|
|
|
|
|
|
+
|
|
|
# 我的工作审批
|
|
|
@router.get("/work_approval/list")
|
|
|
async def work_approval_list(
|
|
@@ -593,6 +596,56 @@ async def work_approval_confirm(
|
|
|
action = get_req_param(body, "action")
|
|
|
content = get_req_param(body, "content")
|
|
|
|
|
|
+ # 删除之前的待审批记录
|
|
|
+ db.query(InfoPublishExamine).filter(and_(InfoPublishExamine.examine_type == 20, InfoPublishExamine.examine_sub_type == 20)).update({"del_flag": "2", "content": "content"})
|
|
|
+ db.commit()
|
|
|
+
|
|
|
+ user_row = db.query(SysUser).filter(SysUser.user_id == user_id).first()
|
|
|
+
|
|
|
+ info_id = body['info_id']
|
|
|
+ examine_type = body['examine_type']
|
|
|
+ content = body['content']
|
|
|
+
|
|
|
+ # 审批通过
|
|
|
+ if examine_type == 'approved':
|
|
|
+ new_examine = InfoPublishExamine(
|
|
|
+ publish_id = info_id,
|
|
|
+ examine_type = 20,
|
|
|
+ examine_sub_type = 21,
|
|
|
+ content = content,
|
|
|
+ examine_time = datetime.now(),
|
|
|
+ user_id = user_id,
|
|
|
+ user_name = user_row.user_name,
|
|
|
+ nick_name = user_row.nick_name
|
|
|
+ )
|
|
|
+ db.add(new_examine)
|
|
|
+ db.commit()
|
|
|
+
|
|
|
+ # publish_status 发布中
|
|
|
+ # examine_status 审批通过
|
|
|
+ db.query(InfoPublishBase).filter(InfoPublishBase.id == info_id).update({"publish_status": 3, "examine_status": 3})
|
|
|
+ db.commit()
|
|
|
+
|
|
|
+ # 审批不通过
|
|
|
+ elif examine_type == 'rejected':
|
|
|
+
|
|
|
+ new_examine = InfoPublishExamine(
|
|
|
+ publish_id = info_id,
|
|
|
+ examine_type = 20,
|
|
|
+ examine_sub_type = 22,
|
|
|
+ content = content,
|
|
|
+ examine_time = datetime.now(),
|
|
|
+ user_id = user_id,
|
|
|
+ user_name = user_row.user_name,
|
|
|
+ nick_name = user_row.nick_name
|
|
|
+ )
|
|
|
+ db.add(new_examine)
|
|
|
+ db.commit()
|
|
|
+
|
|
|
+ # publish_status 取消发布
|
|
|
+ # examine_status 审批不通过
|
|
|
+ db.query(InfoPublishBase).filter(InfoPublishBase.id == info_id).update({"publish_status": 9, "examine_status": 9})
|
|
|
+ db.commit()
|
|
|
|
|
|
return {
|
|
|
"code": 200,
|
|
@@ -603,4 +656,65 @@ async def work_approval_confirm(
|
|
|
except Exception as e:
|
|
|
# 处理异常
|
|
|
traceback.print_exc()
|
|
|
- raise HTTPException(status_code=500, detail=str(e))
|
|
|
+ raise HTTPException(status_code=500, detail=str(e))
|
|
|
+
|
|
|
+
|
|
|
+@router.post("/work_approval/redirect")
|
|
|
+async def WorkApprovalRedirect(
|
|
|
+request: Request,
|
|
|
+ body = Depends(remove_xss_json),
|
|
|
+ db: Session = Depends(get_db),
|
|
|
+ user_id = Depends(valid_access_token)):
|
|
|
+
|
|
|
+ try:
|
|
|
+ info_id = get_req_param(body, "info_id")
|
|
|
+ redirect_id = get_req_param(body, "redirect_id")
|
|
|
+
|
|
|
+ # 删除之前的待审批记录
|
|
|
+ db.query(InfoPublishExamine).filter(and_(InfoPublishExamine.examine_type == 20, InfoPublishExamine.examine_sub_type == 20)).update({"del_flag": "2", "content": "content"})
|
|
|
+ db.commit()
|
|
|
+
|
|
|
+ user_row = db.query(SysUser).filter(SysUser.user_id == user_id).first()
|
|
|
+
|
|
|
+ # 转交
|
|
|
+ new_examine = InfoPublishExamine(
|
|
|
+ publish_id = body['info_id'],
|
|
|
+ examine_type = 40, # 转交
|
|
|
+ examine_sub_type = 40, # 转交
|
|
|
+ content = "转交",
|
|
|
+ examine_time = datetime.now(),
|
|
|
+ user_id = user_id,
|
|
|
+ user_name = user_row.user_name,
|
|
|
+ nick_name = user_row.nick_name
|
|
|
+ )
|
|
|
+
|
|
|
+ db.add(new_examine)
|
|
|
+ db.commit()
|
|
|
+
|
|
|
+ user_row = db.query(SysUser).filter(SysUser.user_id == redirect_id).first()
|
|
|
+
|
|
|
+ # 待审批
|
|
|
+ new_examine = InfoPublishExamine(
|
|
|
+ publish_id = body['info_id'],
|
|
|
+ examine_type = 20,
|
|
|
+ examine_sub_type = 20,
|
|
|
+ content = "待审批",
|
|
|
+ examine_time = datetime.now(),
|
|
|
+ user_id = user_id,
|
|
|
+ user_name = user_row.user_name,
|
|
|
+ nick_name = user_row.nick_name
|
|
|
+ )
|
|
|
+
|
|
|
+ db.add(new_examine)
|
|
|
+ db.commit()
|
|
|
+
|
|
|
+ return {
|
|
|
+ "code": 200,
|
|
|
+ "msg": "转交成功"
|
|
|
+ }
|
|
|
+
|
|
|
+ except Exception as e:
|
|
|
+ # 处理异常
|
|
|
+ traceback.print_exc()
|
|
|
+ raise HTTPException(status_code=500, detail=str(e))
|
|
|
+
|