Sfoglia il codice sorgente

修改出差申请校验

tuoling805 2 anni fa
parent
commit
bff5583d18

+ 26 - 0
controllers/business_trip/business_apply.go

@@ -97,6 +97,19 @@ func (this *BusinessTrip) ApplyAdd() {
 		}
 	}
 
+	//校验申请人,是否被邀请为同行人,并且出差日期冲突
+	{
+		peerCount, err := business_trip.CheckBusinessApplyPeerDate(req.ArriveDate, req.ReturnDate, "'待审批','已审批'", sysUser.AdminId, 0)
+		if err != nil {
+			this.FailWithMessage("时间冲突检测失败", "时间冲突检测失败-CheckBusinessApplyPeerDate!Err:"+err.Error())
+			return
+		}
+		if peerCount > 0 {
+			this.FailWithMessage("所选日期您被设置为同行人,请重新选择!", "所选日期您被设置为同行人,请重新选择!")
+			return
+		}
+	}
+
 	//校验同行人,出差日期冲突
 	{
 		if req.PeerPeopleId != "" {
@@ -299,6 +312,19 @@ func (this *BusinessTrip) ApplyEdit() {
 		}
 	}
 
+	//校验申请人,是否被邀请为同行人,并且出差日期冲突
+	{
+		peerCount, err := business_trip.CheckBusinessApplyPeerDate(req.ArriveDate, req.ReturnDate, "'待审批','已审批'", sysUser.AdminId, 0)
+		if err != nil {
+			this.FailWithMessage("时间冲突检测失败", "时间冲突检测失败-CheckBusinessApplyPeerDate!Err:"+err.Error())
+			return
+		}
+		if peerCount > 0 {
+			this.FailWithMessage("所选日期您被设置为同行人,请重新选择!", "所选日期您被设置为同行人,请重新选择!")
+			return
+		}
+	}
+
 	//校验同行人,出差日期冲突
 	{
 		if req.PeerPeopleId != "" {

+ 4 - 2
controllers/business_trip/business_approve.go

@@ -124,11 +124,13 @@ func (this *BusinessTrip) ApplyApprove() {
 
 	whereParams["business_apply_id"] = req.BusinessApplyId
 
-	var status string
+	var status, applyStatus string
 	if req.ApproveStatus == 1 {
 		status = "已审批"
+		applyStatus = "已通过"
 	} else {
 		status = "已驳回"
+		applyStatus = "已驳回"
 	}
 	updateParams["status"] = status
 	updateParams["refuse_reason"] = req.RefuseReason
@@ -153,7 +155,7 @@ func (this *BusinessTrip) ApplyApprove() {
 		applyItem, _ := admin.GetAdminById(businessApplyItem.ApplyAdminId)
 		wxAppPath := "pages-approve/businessTrip/detail?id=" + strconv.Itoa(req.BusinessApplyId)
 		first := "您的出差申请已被审批"
-		keyword1 := businessApplyItem.Reason + "出差申请" + status
+		keyword1 := businessApplyItem.Reason + "出差申请" + applyStatus
 		keyword2 := status
 		var remark string
 		if status == "已驳回" {