瀏覽代碼

fix:用印列表 合规发起审批,然后自己审批通过后,还能在待审批列表看到该数据

Roc 3 年之前
父節點
當前提交
320449b312
共有 4 個文件被更改,包括 37 次插入6 次删除
  1. 7 1
      controllers/contract_approval.go
  2. 16 2
      controllers/message.go
  3. 11 2
      controllers/seal_approval.go
  4. 3 1
      models/response/message/message.go

+ 7 - 1
controllers/contract_approval.go

@@ -60,7 +60,12 @@ func (this *ContractApprovalCommon) List() {
 	//	}
 	//}
 
-	condition += ` AND (c.seller_id = ? or d.approve_user_id = ?)`
+	//归属
+	if status == "待审批" {
+		condition += ` AND (c.user_id = ? and d.approve_user_id = c.user_id) OR (d.approve_user_id = ? and d.status="待审批")`
+	} else {
+		condition += ` AND (c.user_id = ? or d.approve_user_id = ?)`
+	}
 	pars = append(pars, sysUser.AdminId, sysUser.AdminId)
 
 	//合同类型、、更新时间、所选销售
@@ -131,6 +136,7 @@ func (this *ContractApprovalCommon) List() {
 	joinCondition := " and a.curr_node_id=d.node_id"
 	if status == "处理中" {
 		joinCondition = " and a.curr_node_id!=d.node_id"
+		condition += ` AND a.curr_node_id !=a.start_node_id`
 	}
 	if status != "待审批" && status != "处理中" {
 		tmpTotal, err := contract_approval.GetContractApprovalListCountV2(childCondition, condition, childPars, pars)

+ 16 - 2
controllers/message.go

@@ -72,15 +72,29 @@ func (this *MessageCommon) SummaryMessageList() {
 
 	///1,根据参数名称的ASCII码表的顺序排序
 	sort.Ints(timeList)
-
 	messageList := make([]message.SummaryMessage, 0)
 	for _, currTime := range timeList {
 		messageList = append(messageList, messageMap[currTime])
 	}
-
+	rotate(messageList)
 	this.OkDetailed(messageList, "获取成功")
 }
 
+//切片数据反转
+func rotate(s []message.SummaryMessage) {
+	left, rigth := 0, 0
+	if len(s)%2 == 0 { //判断长度是奇数还是偶数,根据这个来确定旋转的中心
+		left = len(s)/2 - 1
+		rigth = len(s) / 2
+	} else {
+		left = len(s)/2 - 1
+		rigth = len(s)/2 + 1
+	}
+	for ; left >= 0 || rigth <= len(s)-1; left, rigth = left-1, rigth+1 {
+		s[left], s[rigth] = s[rigth], s[left]
+	}
+}
+
 // @Title 消息列表
 // @Description 消息列表接口
 // @Param   SourceType   query   int  true       "消息类型"

+ 11 - 2
controllers/seal_approval.go

@@ -64,7 +64,12 @@ func (this *SealApprovalCommon) List() {
 	//	}
 	//}
 
-	condition += ` AND (c.user_id = ? or d.approve_user_id = ?)`
+	//归属
+	if status == "待审批" {
+		condition += ` AND (c.user_id = ? and d.approve_user_id = c.user_id) OR (d.approve_user_id = ? and d.status="待审批")`
+	} else {
+		condition += ` AND (c.user_id = ? or d.approve_user_id = ?)`
+	}
 	pars = append(pars, sysUser.AdminId, sysUser.AdminId)
 
 	//合同类型、、更新时间、所选销售
@@ -92,6 +97,11 @@ func (this *SealApprovalCommon) List() {
 			} else {
 				pars = append(pars, status)
 			}
+
+			//if status == "待审批" {
+			//	condition += ` AND a.status = ? `
+			//	pars = append(pars, status)
+			//}
 		}
 	} else {
 		//childCondition += ` AND status != "已撤回" `
@@ -144,7 +154,6 @@ func (this *SealApprovalCommon) List() {
 	if status == "处理中" {
 		joinCondition = " and a.curr_node_id!=d.node_id"
 		condition += ` AND a.curr_node_id !=a.start_node_id`
-
 	}
 	if status != "待审批" && status != "处理中" {
 		tmpTotal, err := contract_approval.GetSealApprovalListCountV2(childCondition, condition, childPars, pars)

+ 3 - 1
models/response/message/message.go

@@ -1,6 +1,8 @@
 package message
 
-import "hongze/hongze_mobile_admin/models/tables/company_approval_message"
+import (
+	"hongze/hongze_mobile_admin/models/tables/company_approval_message"
+)
 
 //消息汇总页数据
 type SummaryMessageListResp struct {