浏览代码

信息变更分办单位id

baichengfei 5 年之前
父节点
当前提交
791f66d7f5
共有 1 个文件被更改,包括 49 次插入6 次删除
  1. 49 6
      src/dashoo.cn/backend/api/controllers/oilsupplier/infochange.go

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

@@ -1587,8 +1587,8 @@ func (this *InfoChangeController) CompanyAuditEntity() {
 
 	stepCode := workflow.SUB_OFFICE_BG
 	auditSettingService := auditsetting.GetOilAuditSettingService(utils.DBE)
-	approverIds := auditSettingService.GetApproverIdsByStepCodeAndUnitId(stepCode, infoChangeEntity.CommitComId)
-	if approverIds == ""{
+	approverIds := auditSettingService.GetApproverIdsByStepCodeAndUnitId(stepCode, unitId)
+	if approverIds == "" {
 		panic("该分办单位未配置审批人")
 	}
 
@@ -1625,7 +1625,7 @@ func (this *InfoChangeController) CompanyAuditEntity() {
 	ActiComplete.ProcessKey = workflow.OIL_INFO_CHANGE
 	ActiComplete.BusinessKey = businessKey
 	ActiComplete.UserId = this.User.Id
-	ActiComplete.Result =  "1" //提交给二级单位分办
+	ActiComplete.Result = "1" //提交给二级单位分办
 	ActiComplete.Remarks = AuditRemark
 	ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
 
@@ -1813,13 +1813,21 @@ func (this *InfoChangeController) CommonAuditEntity() {
 	ActiComplete.ProcessKey = workflow.OIL_INFO_CHANGE
 	ActiComplete.BusinessKey = infoChangeEntity.BusinessKey
 	ActiComplete.UserId = this.User.Id //审批人员
-	ActiComplete.Result = result //前台审批[同意、不同意]
+	ActiComplete.Result = result       //前台审批[同意、不同意]
 	ActiComplete.Remarks = AuditRemark
 	ActiComplete.CallbackUrl = utils.Cfg.MustValue("workflow", "callbackHost")
 	receiveVal := svcActiviti.TaskComplete(ActiComplete)
 	if receiveVal != "true" {
 		panic("工作流异常,请联系管理员!" + receiveVal)
 	}
+
+	// TODO 审批完成 更新相关信息
+	//var infoChangeEntityAfterUpdate infochange.OilInfoChange
+	//infoSrv.GetEntityById(infoId, &infoChangeEntityAfterUpdate)
+	//if infoChangeEntityAfterUpdate.Status == suppliercert.STOREING_STATUS {
+	//	fmt.Println("资质变更入库完成, 开始实际变更信息: supplierId" + strconv.Itoa(infoChangeEntityAfterUpdate.SupplierId) + "变更信息表ID: " + infoId)
+	//	this.updateChangeInfo(infoChangeEntityAfterUpdate.SupplierId, infoId)
+	//}
 }
 
 // @Title 交费用户确认交费
@@ -1852,7 +1860,7 @@ func (this *InfoChangeController) UpdatePayStatus() {
 	}
 
 	if len(paymentInfoEntities) == 1 {
-		for _, item := range  paymentInfoEntities {
+		for _, item := range paymentInfoEntities {
 			if item.IsPay == "1" {
 				errinfo.Message = "已确认交费!请耐心等待"
 				errinfo.Code = -1
@@ -1868,7 +1876,7 @@ func (this *InfoChangeController) UpdatePayStatus() {
 		}
 	}
 
-	sql :="UPDATE OilPaymentInfo SET IsPay ='1' where SrcId=" + infoId + " and PayType='1'"
+	sql := "UPDATE OilPaymentInfo SET IsPay ='1' where SrcId=" + infoId + " and PayType='1'"
 	paySrv.DBE.Exec(sql)
 	errinfo.Message = "确认交费成功!"
 	errinfo.Code = 0
@@ -2051,3 +2059,38 @@ func (this *InfoChangeController) FileDelete(supplierId string) {
 	sp := time.Since(s)
 	log.Println(sp, "++++++++++++++++++++")
 }
+
+func (this *InfoChangeController) updateChangeInfo(supplierId int, infoId string) {
+	var infoItems []infochange.OilInfoChangeItem
+	where := " SupplierId = " + strconv.Itoa(supplierId) + " and InfoId =" + infoId
+	where = where + " and ChangeStatus = 0"
+
+	var supModel supplier.OilSupplier
+	this.updatesupplier(OilSupplierName, supplierId, infoItems, supModel)
+
+	// 级别 一级变二级 删除不符合的准入项和资质
+	for _, item := range infoItems {
+		if item.SelectItem == "Grade" && (item.BeChangeInfo == "1" && item.ChangeInfo == "2") {
+			this.BusinessDelete(utils.ToStr(supplierId))
+		}
+	}
+
+	// 删除资质及准入项
+	this.FileDelete(strconv.Itoa(supplierId))
+	t := time.Now()
+	s := time.Since(t)
+	log.Println(s, "============================")
+	var qualDetail []qualchange.OilQualChangeDetail
+	where1 := "SupplierId = " + utils.ToStr(supplierId) + " and ParentId=" + infoId
+	svc := infochange.GetInfoChangeService(utils.DBE)
+	svc.GetEntities(&qualDetail, where1)
+	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
+			svc.UpdateEntityBytbl(OilSupplierFileName, qualDetail[i].FileId, &supfilemodel, []string{"FileName", "FileUrl", "EffectDate"})
+		}
+	}
+}