Parcourir la source

后端: 日志使用工具记录。年审通过后更新资质和企业基本变更信息,fix增加的年审有效日期。

baichengfei il y a 5 ans
Parent
commit
5b77032cdb

+ 37 - 24
src/dashoo.cn/backend/api/controllers/oilsupplier/annualListener.go

@@ -6,8 +6,10 @@ import (
 	"dashoo.cn/backend/api/business/oilsupplier/infochange"
 	"dashoo.cn/backend/api/business/oilsupplier/oilcostmanage"
 	"dashoo.cn/backend/api/business/oilsupplier/supplier"
+	"dashoo.cn/backend/api/business/oilsupplier/supplierfile"
 	"dashoo.cn/backend/api/business/paymentinfo"
 	"encoding/json"
+	"log"
 	"strconv"
 	"strings"
 	"time"
@@ -316,39 +318,50 @@ func (this *OilAnnualListenerController) WorkflowEndAudit() {
 		"ApplyTime",
 	}
 	//进入此步骤,记录在数据库中
-	annualEntity.Status = suppliercert.STORE_STATUS                  //审核完成
-	annualEntity.ApplyTime = annualEntity.ApplyTime.AddDate(1, 0, 0) //更新年审表时间
+	annualEntity.Status = suppliercert.STORE_STATUS //审核完成
+	log.Println("年审审批通过,增加年审到期时间1年,原时间:" + annualEntity.ApplyTime.String())
+	originApplyTime := annualEntity.ApplyTime.AddDate(1, 0, 0) //更新年审表时间
+
+	nowTime := time.Now().AddDate(1, 0, 0)
+	if nowTime.After(annualEntity.ApplyTime) {
+		annualEntity.ApplyTime = nowTime
+	} else {
+		annualEntity.ApplyTime = originApplyTime
+	}
+	log.Println("年审审批通过,增加年审到期时间1年,更新后时间:" + annualEntity.ApplyTime.String())
 	srv.UpdateEntityByIdCols(annualId, annualEntity, cols)
 
 	//更新准入表时间
 	paymentInfoSvc := paymentinfo.GetPaymentService(utils.DBE)
 	var certModel suppliercert.OilSupplierCert
-	certModel.ApplyTime = annualEntity.ApplyTime.AddDate(1, 0, 0)
+	certModel.ApplyTime = annualEntity.ApplyTime
 	certModel.InFlag = "1"
 	paymentInfoSvc.UpdateEntityByIdCols(strconv.Itoa(annualEntity.CerId), &certModel, []string{"ApplyTime", "InFlag"})
 
 	// 实际更新变更项
-	//log.Print("年审实际变更信息:", annualEntity)
-	//var qualDetail []annualaudit.OilAnnualChangeDetail
-	//whereDetail := "SupplierId = " + utils.ToStr(annualEntity.SupplierId) + " and ParentId=" + strconv.Itoa(annualEntity.Id)
-	//srv.GetEntities(&qualDetail, whereDetail)
-	//if len(qualDetail) > 0 {
-	//	for i := 0; i < len(qualDetail); i++ {
-	//		var supFileModel supplierfile.OilSupplierFile
-	//		supFileModel.FileName = qualDetail[i].FileName
-	//		supFileModel.FileUrl = qualDetail[i].FileUrl
-	//		supFileModel.EffectDate = qualDetail[i].EffectDate
-	//		srv.UpdateEntityBytbl(OilSupplierFileName, qualDetail[i].FileId, &supFileModel, []string{"FileName", "FileUrl", "EffectDate"})
-	//	}
-	//}
-	//
-	//var infoItems []infochange.OilAnnualChangeItem
-	//where := "SupplierId = " + utils.ToStr(annualEntity.SupplierId) + " and InfoId = " + utils.ToStr(annualEntity.Id)
-	//srv.GetEntities(&infoItems, where)
-	//err := this.updateSupplierAfterInStorage(OilSupplierName, annualEntity.SupplierId, infoItems)
-	//if err != nil {
-	//	log.Print("年审实际变更信息出错: ", err)
-	//}
+	log.Print("年审实际变更信息:", annualEntity)
+	var qualDetail []annualaudit.OilAnnualChangeDetail
+	whereDetail := "SupplierId = " + utils.ToStr(annualEntity.SupplierId) + " and ParentId=" + strconv.Itoa(annualEntity.Id)
+	srv.GetEntities(&qualDetail, whereDetail)
+	if len(qualDetail) > 0 {
+		// 变更资质
+		for i := 0; i < len(qualDetail); i++ {
+			var supFileModel supplierfile.OilSupplierFile
+			supFileModel.FileName = qualDetail[i].FileName
+			supFileModel.FileUrl = qualDetail[i].FileUrl
+			supFileModel.EffectDate = qualDetail[i].EffectDate
+			srv.UpdateEntityBytbl(OilSupplierFileName, qualDetail[i].FileId, &supFileModel, []string{"FileName", "FileUrl", "EffectDate"})
+		}
+	}
+
+	// 更新主表信息
+	var infoItems []infochange.OilAnnualChangeItem
+	where := "SupplierId = " + utils.ToStr(annualEntity.SupplierId) + " and InfoId = " + utils.ToStr(annualEntity.Id)
+	srv.GetEntities(&infoItems, where)
+	err := this.updateSupplierAfterInStorage(OilSupplierName, annualEntity.SupplierId, infoItems)
+	if err != nil {
+		log.Print("年审实际变更信息出错: ", err)
+	}
 
 	this.Data["json"] = 1
 	this.ServeJSON()

+ 7 - 6
src/dashoo.cn/backend/api/controllers/oilsupplier/annualaudit.go

@@ -18,6 +18,7 @@ import (
 	"dashoo.cn/business2/items"
 	"dashoo.cn/business2/permission"
 	"dashoo.cn/business3/parameter"
+	"log"
 	"reflect"
 
 	"encoding/json"
@@ -879,7 +880,7 @@ func (this *AnnualAuditController) CompanyAuditEntity() {
 
 	receiveVal := svcActiviti.TaskComplete(ActiComplete)
 	if receiveVal != "true" {
-		fmt.Println(time.Now().String()+" ---- 工作流异常, 业务ID:"+annualEntity.BusinessKey+", 流程ID:"+annualEntity.WorkflowId, " 工作流传参: ", ActiComplete, receiveVal)
+		log.Println("工作流异常, 业务ID:"+annualEntity.BusinessKey+", 流程ID:"+annualEntity.WorkflowId, " 工作流传参: ", ActiComplete, receiveVal)
 		panic("任务已审批,请刷新!")
 	}
 
@@ -974,7 +975,7 @@ func (this *AnnualAuditController) SeparateUnitSubmitAuditEntity() {
 	ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
 	receiveVal := svcActiviti.TaskComplete(ActiComplete)
 	if receiveVal != "true" {
-		fmt.Println(time.Now().String()+" ---- 工作流异常, 业务ID:"+auditEntity.BusinessKey+", 流程ID:"+auditEntity.WorkflowId, " 工作流传参: ", ActiComplete, receiveVal)
+		log.Println("工作流异常, 业务ID:"+auditEntity.BusinessKey+", 流程ID:"+auditEntity.WorkflowId, " 工作流传参: ", ActiComplete, receiveVal)
 		panic("任务已审批,请刷新!")
 	}
 
@@ -1042,7 +1043,7 @@ func (this *AnnualAuditController) SeparateAuditEntity() {
 	ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
 	receiveVal := svcActiviti.TaskComplete(ActiComplete)
 	if receiveVal != "true" {
-		fmt.Println(time.Now().String()+" ---- 工作流异常, 业务ID:"+annualEntity.BusinessKey+", 流程ID:"+annualEntity.WorkflowId, " 工作流传参: ", ActiComplete, receiveVal)
+		log.Print("工作流异常, 业务ID:"+annualEntity.BusinessKey+", 流程ID:"+annualEntity.WorkflowId, " 工作流传参: ", ActiComplete, receiveVal)
 		panic("任务已审批,请刷新!")
 	}
 }
@@ -1087,7 +1088,7 @@ func (this *AnnualAuditController) CommonAuditEntity() {
 	ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
 	receiveVal := svcActiviti.TaskComplete(ActiComplete)
 	if receiveVal != "true" {
-		fmt.Println(time.Now().String()+" ---- 工作流异常, 业务ID:"+annualEntity.BusinessKey+", 流程ID:"+annualEntity.WorkflowId, " 工作流传参: ", ActiComplete, receiveVal)
+		log.Println("工作流异常, 业务ID:"+annualEntity.BusinessKey+", 流程ID:"+annualEntity.WorkflowId, " 工作流传参: ", ActiComplete, receiveVal)
 		panic("任务已审批,请刷新!")
 	}
 }
@@ -1141,7 +1142,7 @@ func (this *AnnualAuditController) UpdateIsStorage() {
 	//srv.UpdateEntityByIdCols(SupplierId, &supplierEntity, srvCols)
 
 	AuditRemark := ""
-	fmt.Println("审批入库传入状态:", status)
+	fmt.Println("年审审批入库传入状态:", status)
 	if status == "1" {
 		AuditRemark = "审批通过已入库。"
 	} else {
@@ -1159,7 +1160,7 @@ func (this *AnnualAuditController) UpdateIsStorage() {
 	ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
 	receiveVal := svcActiviti.TaskComplete(ActiComplete)
 	if receiveVal != "true" {
-		fmt.Println(time.Now().String()+" ---- 工作流异常, 业务ID:"+annualEntity.BusinessKey+", 流程ID:"+annualEntity.WorkflowId, " 工作流传参: ", ActiComplete, receiveVal)
+		log.Println("工作流异常, 业务ID:"+annualEntity.BusinessKey+", 流程ID:"+annualEntity.WorkflowId, " 工作流传参: ", ActiComplete, receiveVal)
 		panic("任务已审批,请刷新!")
 	}
 

+ 4 - 4
src/dashoo.cn/backend/api/controllers/oilsupplier/infochange.go

@@ -1639,7 +1639,7 @@ func (this *InfoChangeController) CompanyAuditEntity() {
 
 	receiveVal := svcActiviti.TaskComplete(ActiComplete)
 	if receiveVal != "true" {
-		fmt.Println(time.Now().String()+" ---- 工作流异常, 业务ID:"+infoChangeEntity.BusinessKey+", 流程ID:"+infoChangeEntity.WorkFlowId, " 工作流传参: ", ActiComplete, receiveVal)
+		log.Println("工作流异常, 业务ID:"+infoChangeEntity.BusinessKey+", 流程ID:"+infoChangeEntity.WorkFlowId, " 工作流传参: ", ActiComplete, receiveVal)
 		panic("任务已审批,请刷新!")
 	}
 
@@ -1737,7 +1737,7 @@ func (this *InfoChangeController) UnitAuditEntity() {
 	ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
 	receiveVal := svcActiviti.TaskComplete(ActiComplete)
 	if receiveVal != "true" {
-		fmt.Println(time.Now().String()+" ---- 工作流异常, 业务ID:"+infoChangeEntity.BusinessKey+", 流程ID:"+infoChangeEntity.WorkFlowId, " 工作流传参: ", ActiComplete, receiveVal)
+		log.Println("工作流异常, 业务ID:"+infoChangeEntity.BusinessKey+", 流程ID:"+infoChangeEntity.WorkFlowId, " 工作流传参: ", ActiComplete, receiveVal)
 		panic("任务已审批,请刷新!")
 	}
 
@@ -1804,7 +1804,7 @@ func (this *InfoChangeController) SeparateAuditEntity() {
 	ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
 	receiveVal := svcActiviti.TaskComplete(ActiComplete)
 	if receiveVal != "true" {
-		fmt.Println(time.Now().String()+" ---- 工作流异常, 业务ID:"+infoChangeEntity.BusinessKey+", 流程ID:"+infoChangeEntity.WorkFlowId, " 工作流传参: ", ActiComplete, receiveVal)
+		log.Println("工作流异常, 业务ID:"+infoChangeEntity.BusinessKey+", 流程ID:"+infoChangeEntity.WorkFlowId, " 工作流传参: ", ActiComplete, receiveVal)
 		panic("任务已审批,请刷新!")
 	}
 }
@@ -1849,7 +1849,7 @@ func (this *InfoChangeController) CommonAuditEntity() {
 	ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
 	receiveVal := svcActiviti.TaskComplete(ActiComplete)
 	if receiveVal != "true" {
-		fmt.Println(time.Now().String()+" ---- 工作流异常, 业务ID:"+infoChangeEntity.BusinessKey+", 流程ID:"+infoChangeEntity.WorkFlowId, " 工作流传参: ", ActiComplete, receiveVal)
+		log.Println("工作流异常, 业务ID:"+infoChangeEntity.BusinessKey+", 流程ID:"+infoChangeEntity.WorkFlowId, " 工作流传参: ", ActiComplete, receiveVal)
 		panic("任务已审批,请刷新!")
 	}
 

+ 6 - 5
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercert.go

@@ -17,6 +17,7 @@ import (
 	baseparameter "dashoo.cn/business2/parameter"
 	"encoding/json"
 	"fmt"
+	"log"
 	"strconv"
 	"strings"
 	"time"
@@ -724,7 +725,7 @@ func (this *OilSupplierCertController) CompanyAuditEntity() {
 
 	receiveVal := svcActiviti.TaskComplete(ActiComplete)
 	if receiveVal != "true" {
-		fmt.Println(time.Now().String()+" ---- 工作流异常, 业务ID:"+supplierCertEntity.BusinessKey+", 流程ID:"+supplierCertEntity.WorkflowId, " 工作流传参: ", ActiComplete, receiveVal)
+		log.Println("工作流异常, 业务ID:"+supplierCertEntity.BusinessKey+", 流程ID:"+supplierCertEntity.WorkflowId, " 工作流传参: ", ActiComplete, receiveVal)
 		panic("任务已审批,请刷新!")
 	}
 
@@ -939,7 +940,7 @@ func (this *OilSupplierCertController) CommonAuditEntity() {
 	ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
 	receiveVal := svcActiviti.TaskComplete(ActiComplete)
 	if receiveVal != "true" {
-		fmt.Println(time.Now().String()+" ---- 工作流异常, 业务ID:"+supplierCertEntity.BusinessKey+", 流程ID:"+supplierCertEntity.WorkflowId, " 工作流传参: ", ActiComplete, receiveVal)
+		log.Println("工作流异常, 业务ID:"+supplierCertEntity.BusinessKey+", 流程ID:"+supplierCertEntity.WorkflowId, " 工作流传参: ", ActiComplete, receiveVal)
 		panic("任务已审批,请刷新!")
 	}
 }
@@ -999,7 +1000,7 @@ func (this *OilSupplierCertController) BusinessOfficeSeparateAuditEntity() {
 	ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
 	receiveVal := svcActiviti.TaskComplete(ActiComplete)
 	if receiveVal != "true" {
-		fmt.Println(time.Now().String()+" ---- 工作流异常, 业务ID:"+supplierCertEntity.BusinessKey+", 流程ID:"+supplierCertEntity.WorkflowId, " 工作流传参: ", ActiComplete, receiveVal)
+		log.Println("工作流异常, 业务ID:"+supplierCertEntity.BusinessKey+", 流程ID:"+supplierCertEntity.WorkflowId, " 工作流传参: ", ActiComplete, receiveVal)
 		panic("任务已审批,请刷新!")
 	}
 }
@@ -1043,7 +1044,7 @@ func (this *OilSupplierCertController) ConcentrateAuditEntity() {
 	ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
 	receiveVal := svcActiviti.TaskComplete(ActiComplete)
 	if receiveVal != "true" {
-		fmt.Println(time.Now().String()+" ---- 工作流异常, 业务ID:"+supplierCertEntity.BusinessKey+", 流程ID:"+supplierCertEntity.WorkflowId, " 工作流传参: ", ActiComplete, receiveVal)
+		log.Println("工作流异常, 业务ID:"+supplierCertEntity.BusinessKey+", 流程ID:"+supplierCertEntity.WorkflowId, " 工作流传参: ", ActiComplete, receiveVal)
 		panic("任务已审批,请刷新!")
 	}
 	//cols := []string{
@@ -1167,7 +1168,7 @@ func (this *OilSupplierCertController) UpdateIsStorage() {
 	ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
 	receiveVal := svcActiviti.TaskComplete(ActiComplete)
 	if receiveVal != "true" {
-		fmt.Println(time.Now().String()+" ---- 工作流异常, 业务ID:"+supplierCertEntity.BusinessKey+", 流程ID:"+supplierCertEntity.WorkflowId, " 工作流传参: ", ActiComplete, receiveVal)
+		log.Println("工作流异常, 业务ID:"+supplierCertEntity.BusinessKey+", 流程ID:"+supplierCertEntity.WorkflowId, " 工作流传参: ", ActiComplete, receiveVal)
 		panic("任务已审批,请刷新!")
 	}
 

+ 8 - 7
src/dashoo.cn/backend/api/controllers/oilsupplier/suppliercertappend.go

@@ -20,6 +20,7 @@ import (
 	"dashoo.cn/business3/items"
 	"encoding/json"
 	"fmt"
+	"log"
 	"strconv"
 	"strings"
 	"time"
@@ -767,7 +768,7 @@ func (this *OilSupplierCertAppendController) CompanySubmitAuditEntity() {
 
 	receiveVal := svcActiviti.TaskComplete(ActiComplete)
 	if receiveVal != "true" {
-		fmt.Println(time.Now().String()+" ---- 工作流异常, 业务ID:"+supplierCertAppendEntity.BusinessKey+", 流程ID:"+supplierCertAppendEntity.WorkFlowId, " 工作流传参: ", ActiComplete, receiveVal)
+		log.Println("工作流异常, 业务ID:"+supplierCertAppendEntity.BusinessKey+", 流程ID:"+supplierCertAppendEntity.WorkFlowId, " 工作流传参: ", ActiComplete, receiveVal)
 		panic("任务已审批,请刷新!")
 	}
 
@@ -865,7 +866,7 @@ func (this *OilSupplierCertAppendController) SeparateUnitSubmitAuditEntity() {
 	ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
 	receiveVal := svcActiviti.TaskComplete(ActiComplete)
 	if receiveVal != "true" {
-		fmt.Println(time.Now().String()+" ---- 工作流异常, 业务ID:"+supplierCertAppendEntity.BusinessKey+", 流程ID:"+supplierCertAppendEntity.WorkFlowId, " 工作流传参: ", ActiComplete, receiveVal)
+		log.Println("工作流异常, 业务ID:"+supplierCertAppendEntity.BusinessKey+", 流程ID:"+supplierCertAppendEntity.WorkFlowId, " 工作流传参: ", ActiComplete, receiveVal)
 		panic("任务已审批,请刷新!")
 	}
 	// 记录申请快照 选择在准入项更新以后记录快照,防止第一次审批未通过后又改变了准入范围(待验证)。	// CertSubStatus字段 -1是什么状态
@@ -935,7 +936,7 @@ func (this *OilSupplierCertAppendController) AppendSeparateAuditEntity() {
 	ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
 	receiveVal := svcActiviti.TaskComplete(ActiComplete)
 	if receiveVal != "true" {
-		fmt.Println(time.Now().String()+" ---- 工作流异常, 业务ID:"+supplierCertAppendEntity.BusinessKey+", 流程ID:"+supplierCertAppendEntity.WorkFlowId, " 工作流传参: ", ActiComplete, receiveVal)
+		log.Println("工作流异常, 业务ID:"+supplierCertAppendEntity.BusinessKey+", 流程ID:"+supplierCertAppendEntity.WorkFlowId, " 工作流传参: ", ActiComplete, receiveVal)
 		panic("任务已审批,请刷新!")
 	}
 }
@@ -980,7 +981,7 @@ func (this *OilSupplierCertAppendController) AppendCommonAuditEntity() {
 	ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
 	receiveVal := svcActiviti.TaskComplete(ActiComplete)
 	if receiveVal != "true" {
-		fmt.Println(time.Now().String()+" ---- 工作流异常, 业务ID:"+supplierCertAppendEntity.BusinessKey+", 流程ID:"+supplierCertAppendEntity.WorkFlowId, " 工作流传参: ", ActiComplete, receiveVal)
+		log.Println("工作流异常, 业务ID:"+supplierCertAppendEntity.BusinessKey+", 流程ID:"+supplierCertAppendEntity.WorkFlowId, " 工作流传参: ", ActiComplete, receiveVal)
 		panic("任务已审批,请刷新!")
 	}
 }
@@ -1040,7 +1041,7 @@ func (this *OilSupplierCertAppendController) AppendBusinessOfficeSeparateAuditEn
 	ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
 	receiveVal := svcActiviti.TaskComplete(ActiComplete)
 	if receiveVal != "true" {
-		fmt.Println(time.Now().String()+" ---- 工作流异常, 业务ID:"+supplierCertAppendEntity.BusinessKey+", 流程ID:"+supplierCertAppendEntity.WorkFlowId, " 工作流传参: ", ActiComplete, receiveVal)
+		log.Println("工作流异常, 业务ID:"+supplierCertAppendEntity.BusinessKey+", 流程ID:"+supplierCertAppendEntity.WorkFlowId, " 工作流传参: ", ActiComplete, receiveVal)
 		panic("任务已审批,请刷新!")
 	}
 }
@@ -1084,7 +1085,7 @@ func (this *OilSupplierCertAppendController) AppendConcentrateAuditEntity() {
 	ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
 	receiveVal := svcActiviti.TaskComplete(ActiComplete)
 	if receiveVal != "true" {
-		fmt.Println(time.Now().String()+" ---- 工作流异常, 业务ID:"+supplierCertAppendEntity.BusinessKey+", 流程ID:"+supplierCertAppendEntity.WorkFlowId, " 工作流传参: ", ActiComplete, receiveVal)
+		log.Println("工作流异常, 业务ID:"+supplierCertAppendEntity.BusinessKey+", 流程ID:"+supplierCertAppendEntity.WorkFlowId, " 工作流传参: ", ActiComplete, receiveVal)
 		panic("任务已审批,请刷新!")
 	}
 	//cols := []string{
@@ -1163,7 +1164,7 @@ func (this *OilSupplierCertAppendController) UpdateIsStorage() {
 	ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
 	receiveVal := svcActiviti.TaskComplete(ActiComplete)
 	if receiveVal != "true" {
-		fmt.Println(time.Now().String()+" ---- 工作流异常, 业务ID:"+supplierCertAppendEntity.BusinessKey+", 流程ID:"+supplierCertAppendEntity.WorkFlowId, " 工作流传参: ", ActiComplete, receiveVal)
+		log.Println("工作流异常, 业务ID:"+supplierCertAppendEntity.BusinessKey+", 流程ID:"+supplierCertAppendEntity.WorkFlowId, " 工作流传参: ", ActiComplete, receiveVal)
 		panic("任务已审批,请刷新!")
 	}