|
|
@@ -309,8 +309,26 @@ func (this *AnnualAuditController) AddEntity() {
|
|
|
}
|
|
|
var suppliermodel supplier.OilSupplierView
|
|
|
suppliermodel = list[0]
|
|
|
+ if suppliermodel.InFlag == "3" {
|
|
|
+ errinfo.Message = "超过两年未年审,您已无法提交!"
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
+ aplytime := suppliermodel.ApplyTime
|
|
|
+ subtime := this.getTimeSub(aplytime, time.Now())
|
|
|
+ lefttime := subtime-3
|
|
|
+ if subtime > 3 {
|
|
|
+ errinfo.Message = "还不到年审时间!请"+ utils.ToStr(lefttime) +"月后再来申请"
|
|
|
+ errinfo.Code = -1
|
|
|
+ this.Data["json"] = &errinfo
|
|
|
+ this.ServeJSON()
|
|
|
+ return
|
|
|
+ }
|
|
|
model.RecUnitId = suppliermodel.RecUnitId
|
|
|
model.CerId, _ = strconv.Atoi(suppliermodel.CertId)
|
|
|
+ model.ApplyTime = suppliermodel.ApplyTime
|
|
|
model.Status = "0"
|
|
|
model.Step = 1
|
|
|
model.BackReason = suppliermodel.BackReason
|
|
|
@@ -367,9 +385,13 @@ func (this *AnnualAuditController) AddEntity() {
|
|
|
this.Data["json"] = &errinfo
|
|
|
this.ServeJSON()
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
+func (this *AnnualAuditController) getTimeSub(t1, t2 time.Time) int {
|
|
|
+ t1 = time.Date(t1.Year(), t1.Month(), t1.Day(), 0, 0, 0, 0, time.Local)
|
|
|
+ t2 = time.Date(t2.Year(), t2.Month(), t2.Day(), 0, 0, 0, 0, time.Local)
|
|
|
+ return int(t1.Sub(t2).Hours() / 24 / 30)
|
|
|
+}
|
|
|
// @Title 提交审批
|
|
|
// @Description 提交审批
|
|
|
// @Success 200 {object} controllers.Request
|
|
|
@@ -663,15 +685,28 @@ func (this *AnnualAuditController) AnnualAudit() {
|
|
|
ActiComplete.CallbackUrl = ""
|
|
|
receiveVal := svcActiviti.TaskComplete(ActiComplete)
|
|
|
var auditmodel annualaudit.OilAnnualAudit
|
|
|
+ oldaplydate := auditmodel.ApplyTime
|
|
|
+ aplydatechange := oldaplydate.Format("2006-01-02 15:04:05")
|
|
|
+ local, _ := time.LoadLocation("Local")
|
|
|
+ oldtimeaply, _ := time.ParseInLocation("2006-01-02 15:04:05", aplydatechange, local)
|
|
|
auditmodel.Status = "4"
|
|
|
auditmodel.Step = 3
|
|
|
+ auditmodel.ApplyTime = oldtimeaply.AddDate(1,0,0)
|
|
|
cols := []string{
|
|
|
"Id",
|
|
|
"Status",
|
|
|
"Step",
|
|
|
+ "ApplyTime",
|
|
|
+ }
|
|
|
+ var certmodel suppliercert.OilSupplierCert
|
|
|
+ certmodel.ApplyTime = oldtimeaply.AddDate(1,0,0)
|
|
|
+ certcols := []string{
|
|
|
+ "Id",
|
|
|
+ "ApplyTime",
|
|
|
}
|
|
|
if receiveVal == "true" {
|
|
|
_, err := svc.UpdateEntityByIdCols(dataother.AnnualId, auditmodel, cols)
|
|
|
+ _, err = svc.UpdateEntityByIdCols(list.CerId, certmodel, certcols)
|
|
|
paysvc := paymentinfo.GetPaymentService(utils.DBE)
|
|
|
var Amount float64
|
|
|
if list.SupplierTypeName == "01" {
|