delete approval
This commit is contained in:
parent
21965eca8b
commit
566a03e1e3
|
@ -74,8 +74,8 @@ func (a *Approve) handleApprovalChange(msg *message.MixMessage) {
|
||||||
spNo := msg.ApprovalInfo.SpNo
|
spNo := msg.ApprovalInfo.SpNo
|
||||||
templateId := msg.ApprovalInfo.TemplateId
|
templateId := msg.ApprovalInfo.TemplateId
|
||||||
|
|
||||||
// && spStatus != SpStatusPassedCanceled
|
// 支出里审批通过的 或者审批通过撤销的
|
||||||
if spStatus != SpStatusPassed {
|
if spStatus != SpStatusPassed && spStatus != SpStatusPassedCanceled {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,17 +87,17 @@ func (a *Approve) handleApprovalChange(msg *message.MixMessage) {
|
||||||
|
|
||||||
log.Infof("spno: %s detail: %s", spNo, goutil.EncodeJSON(detail))
|
log.Infof("spno: %s detail: %s", spNo, goutil.EncodeJSON(detail))
|
||||||
if templateId == a.corpConfig.TplIdRefund {
|
if templateId == a.corpConfig.TplIdRefund {
|
||||||
a.handleRefund(detail)
|
a.handleRefund(detail, spStatus)
|
||||||
} else if templateId == a.corpConfig.TplIdVacation {
|
} else if templateId == a.corpConfig.TplIdVacation {
|
||||||
a.handleVacation(detail)
|
a.handleVacation(detail, spStatus)
|
||||||
} else if templateId == a.corpConfig.TplIdCheckin {
|
} else if templateId == a.corpConfig.TplIdCheckin {
|
||||||
a.handleCheckin(detail)
|
a.handleCheckin(detail, spStatus)
|
||||||
} else if templateId == a.corpConfig.TplIdPayment {
|
} else if templateId == a.corpConfig.TplIdPayment {
|
||||||
a.handlePayment(detail)
|
a.handlePayment(detail, spStatus)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Approve) handlePayment(detail *qyweixin.ApproveDetail) {
|
func (a *Approve) handlePayment(detail *qyweixin.ApproveDetail, spStatus int) {
|
||||||
newData := new(model.ApprovalPayment)
|
newData := new(model.ApprovalPayment)
|
||||||
newData.From(detail)
|
newData.From(detail)
|
||||||
newData.CorpId = a.corp.Id
|
newData.CorpId = a.corp.Id
|
||||||
|
@ -108,6 +108,14 @@ func (a *Approve) handlePayment(detail *qyweixin.ApproveDetail) {
|
||||||
log.Errorf("db error :%s", err.Error())
|
log.Errorf("db error :%s", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if spStatus == SpStatusPassedCanceled {
|
||||||
|
if old != nil {
|
||||||
|
dbDao.Delete(old.Id)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if old != nil {
|
if old != nil {
|
||||||
newData.Id = old.Id
|
newData.Id = old.Id
|
||||||
newData.CreateTime = old.CreateTime
|
newData.CreateTime = old.CreateTime
|
||||||
|
@ -122,7 +130,7 @@ func (a *Approve) handlePayment(detail *qyweixin.ApproveDetail) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Approve) handleVacation(detail *qyweixin.ApproveDetail) {
|
func (a *Approve) handleVacation(detail *qyweixin.ApproveDetail, spStatus int) {
|
||||||
newData := new(model.ApprovalVacation)
|
newData := new(model.ApprovalVacation)
|
||||||
newData.From(detail)
|
newData.From(detail)
|
||||||
newData.CorpId = a.corp.Id
|
newData.CorpId = a.corp.Id
|
||||||
|
@ -133,6 +141,14 @@ func (a *Approve) handleVacation(detail *qyweixin.ApproveDetail) {
|
||||||
log.Errorf("db error :%s", err.Error())
|
log.Errorf("db error :%s", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if spStatus == SpStatusPassedCanceled {
|
||||||
|
if old != nil {
|
||||||
|
dbDao.Delete(old.Id)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if old != nil {
|
if old != nil {
|
||||||
newData.Id = old.Id
|
newData.Id = old.Id
|
||||||
newData.CreateTime = old.CreateTime
|
newData.CreateTime = old.CreateTime
|
||||||
|
@ -147,7 +163,7 @@ func (a *Approve) handleVacation(detail *qyweixin.ApproveDetail) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Approve) handleCheckin(detail *qyweixin.ApproveDetail) {
|
func (a *Approve) handleCheckin(detail *qyweixin.ApproveDetail, spStatus int) {
|
||||||
newData := new(model.ApprovalCheckin)
|
newData := new(model.ApprovalCheckin)
|
||||||
newData.From(detail)
|
newData.From(detail)
|
||||||
newData.CorpId = a.corp.Id
|
newData.CorpId = a.corp.Id
|
||||||
|
@ -158,6 +174,14 @@ func (a *Approve) handleCheckin(detail *qyweixin.ApproveDetail) {
|
||||||
log.Errorf("db error :%s", err.Error())
|
log.Errorf("db error :%s", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if spStatus == SpStatusPassedCanceled {
|
||||||
|
if old != nil {
|
||||||
|
dbDao.Delete(old.Id)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if old != nil {
|
if old != nil {
|
||||||
newData.Id = old.Id
|
newData.Id = old.Id
|
||||||
newData.CreateTime = old.CreateTime
|
newData.CreateTime = old.CreateTime
|
||||||
|
@ -227,7 +251,7 @@ func (a *Approve) handleRefundAlipay(staff *model.StaffInfo, data *model.Approva
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *Approve) handleRefund(detail *qyweixin.ApproveDetail) {
|
func (a *Approve) handleRefund(detail *qyweixin.ApproveDetail, spStatus int) {
|
||||||
newData := new(model.ApprovalRefund)
|
newData := new(model.ApprovalRefund)
|
||||||
newData.From(detail)
|
newData.From(detail)
|
||||||
newData.CorpId = a.corp.Id
|
newData.CorpId = a.corp.Id
|
||||||
|
@ -238,6 +262,14 @@ func (a *Approve) handleRefund(detail *qyweixin.ApproveDetail) {
|
||||||
log.Errorf("db error :%s", err.Error())
|
log.Errorf("db error :%s", err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if spStatus == SpStatusPassedCanceled {
|
||||||
|
if old != nil {
|
||||||
|
dbDao.Delete(old.Id)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if old != nil {
|
if old != nil {
|
||||||
newData.Id = old.Id
|
newData.Id = old.Id
|
||||||
newData.CreateTime = old.CreateTime
|
newData.CreateTime = old.CreateTime
|
||||||
|
|
Loading…
Reference in New Issue