Sfoglia il codice sorgente

后端: 年审日期可配

baichengfei 4 anni fa
parent
commit
2fc52cfa75

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

@@ -613,16 +613,40 @@ func (this *AnnualAuditController) AddEntity() {
 		this.ServeJSON()
 		return
 	}
+
+	// 年审时间前后*个月内可年审
+	paramSvc := baseparameter.GetBaseparameterService(utils.DBE)
+	permitHeadMonthStr := paramSvc.GetBaseparameterMessage("GFGL1", "paramset", "permitAnnualHeadMonth")
+	permitAfterMonthStr := paramSvc.GetBaseparameterMessage("GFGL1", "paramset", "permitAnnualAfterMonth")
+
+	if permitHeadMonthStr == "" {
+		permitHeadMonthStr = "3"
+	}
+	if permitAfterMonthStr == "" {
+		permitAfterMonthStr = "3"
+	}
+	permitHeadMonth, _ := strconv.Atoi(permitHeadMonthStr)
+	permitAfterMonth, _ := strconv.Atoi(permitAfterMonthStr)
 	applyTime := supplierModel.ApplyTime
-	subTime := this.getTimeSub(applyTime, time.Now())
-	leftTime := subTime - 3
-	if subTime > 3 {
-		errInfo.Message = "还不到年审时间!请" + utils.ToStr(leftTime) + "个月后再来申请"
+	subTime := this.getTimeSub(applyTime, time.Now()) // > 0 还没到年审时间
+	if subTime > permitHeadMonth {
+		errInfo.Message = "还不到年审时间!请" + utils.ToStr(subTime-permitHeadMonth) + "个月后再来申请!"
 		errInfo.Code = -3
 		this.Data["json"] = &errInfo
 		this.ServeJSON()
 		return
 	}
+	if subTime < 0 { // 过了年审时间
+		subTime *= -1
+		if subTime > permitAfterMonth {
+			errInfo.Message = "年审到期后" + permitAfterMonthStr + "个月内可申请年审!您已无法申请!"
+			errInfo.Code = -3
+			this.Data["json"] = &errInfo
+			this.ServeJSON()
+			return
+		}
+		return
+	}
 	model.AccessCardNo = supplierModel.AccessCardNo
 	model.RecUnitId = supplierModel.RecUnitId
 	model.CerId, _ = strconv.Atoi(supplierModel.CertId)
@@ -1261,7 +1285,7 @@ func (this *AnnualAuditController) AuditCallback() {
 // @Description 审核
 // @Success	200	{object} controllers.Request
 // @router /auditfirst [put]
-func (this *AnnualAuditController) AnnualAudit() 	{
+func (this *AnnualAuditController) AnnualAudit() {
 	svc := annualaudit.GetOilAnnualAuditService(utils.DBE)
 	var jsonblob = this.Ctx.Input.RequestBody
 	var dataother ShenHeModel
@@ -1670,7 +1694,7 @@ func (this *AnnualAuditController) FileList() {
 	}
 	SupplierId := this.GetString("SupplierId")
 	MInfoId := this.GetString("MInfoId")
-	if MInfoId == "" || SupplierId == ""{
+	if MInfoId == "" || SupplierId == "" {
 		errinfo.Message = "操作失败!请求信息不完整"
 		errinfo.Code = -2
 		this.Data["json"] = &errinfo

+ 67 - 23
src/dashoo.cn/backend/api/controllers/setting/paramset.go

@@ -15,13 +15,17 @@ type ParamSetController struct {
 }
 
 type ParamSerModel struct {
-	IsInvestigate   bool   `json:"isInvestigate"`
-	IsHse  			bool   `json:"IsHse"`
-	IsGetBarCode    bool   `json:"isGetBarCode"`
-	SAddLimitMonth  string `json:"sAddLimitMonth"`
-	AppendApplyNums string `json:"appendApplyNums"`
-	SFlupLastDay    int    `json:"sFlupLastDay"`
-	STestFrontDay   int    `json:"sTestFrontDay"`
+	IsInvestigate          bool `json:"isInvestigate"`
+	IsHse                  bool `json:"IsHse"`
+	IsGetBarCode           bool `json:"isGetBarCode"`
+	SAddLimitMonth         int  `json:"sAddLimitMonth"`
+	AppendApplyNums        int  `json:"appendApplyNums"`
+	SFlupLastDay           int  `json:"sFlupLastDay"`
+	STestFrontDay          int  `json:"sTestFrontDay"`
+	PermitPayStartDay      int  `json:"permitPayStartDay"`
+	PermitPayEndDay        int  `json:"permitPayEndDay"`
+	PermitAnnualHeadMonth  int  `json:"permitAnnualHeadMonth"`
+	PermitAnnualAfterMonth int  `json:"permitAnnualAfterMonth"`
 }
 type ParamModel struct {
 	// 每次新增变量参数时在这继续添加即可
@@ -49,7 +53,9 @@ func (this *ParamSetController) ParamSetPost() {
 	cols := []string{
 		"Parametercontent",
 	}
-	where := "Categoryid='GFGL1' and Parameterid='paramset' and Parametercode="
+	where := "Parameterid='paramset' and Parametercode="
+
+	whereGFGL := "Categoryid='GFGL1' and " + where
 
 	// 是否需要现场考察报告
 	var sisInvestigate string
@@ -59,7 +65,7 @@ func (this *ParamSetController) ParamSetPost() {
 		sisInvestigate = "false"
 	}
 	var isInvEntity baseparameter.Base_Parameter
-	svc.GetEntity(&isInvEntity, where+"'isInvestigate'")
+	svc.GetEntity(&isInvEntity, whereGFGL+"'isInvestigate'")
 	if isInvEntity.Id > 0 {
 		isInvEntity.Parametercontent = sisInvestigate
 		isInvEntity.Modifieduserid, _ = utils.StrTo(this.User.Id).Int()
@@ -75,7 +81,7 @@ func (this *ParamSetController) ParamSetPost() {
 		isAllow = "false"
 	}
 	var isHse baseparameter.Base_Parameter
-	svc.GetEntity(&isHse, where + " 'isHse'")
+	svc.GetEntity(&isHse, whereGFGL+" 'isHse'")
 	if isHse.Id > 0 {
 		isHse.Parametercontent = isAllow
 		isHse.Modifieduserid, _ = utils.StrTo(this.User.Id).Int()
@@ -86,12 +92,9 @@ func (this *ParamSetController) ParamSetPost() {
 
 	// 增项申请时间间隔
 	var lmEntity baseparameter.Base_Parameter
-	svc.GetEntity(&lmEntity, where+"'sAddLimitMonth'")
+	svc.GetEntity(&lmEntity, whereGFGL+"'sAddLimitMonth'")
 	if lmEntity.Id > 0 {
-		if model.SAddLimitMonth == "" {
-			model.SAddLimitMonth = "0"
-		}
-		lmEntity.Parametercontent = model.SAddLimitMonth
+		lmEntity.Parametercontent = strconv.Itoa(model.SAddLimitMonth)
 		lmEntity.Modifieduserid, _ = utils.StrTo(this.User.Id).Int()
 		lmEntity.Modifiedby = this.User.Realname
 		svc.UpdateEntityByIdCols(lmEntity.Id, lmEntity, cols)
@@ -99,17 +102,53 @@ func (this *ParamSetController) ParamSetPost() {
 
 	// 增项申请次数 每年
 	var applyNumEntity baseparameter.Base_Parameter
-	svc.GetEntity(&applyNumEntity, where+"'appendApplyNums'")
+	svc.GetEntity(&applyNumEntity, whereGFGL+"'appendApplyNums'")
 	if applyNumEntity.Id > 0 {
-		if model.AppendApplyNums == "" {
-			model.AppendApplyNums = "2"
-		}
-		applyNumEntity.Parametercontent = model.AppendApplyNums
+		applyNumEntity.Parametercontent = strconv.Itoa(model.AppendApplyNums)
 		applyNumEntity.Modifieduserid, _ = utils.StrTo(this.User.Id).Int()
 		applyNumEntity.Modifiedby = this.User.Realname
 		svc.UpdateEntityByIdCols(applyNumEntity.Id, applyNumEntity, cols)
 	}
 
+	// 年审时间限制
+	var annualAuditHeadEntity baseparameter.Base_Parameter
+	svc.GetEntity(&annualAuditHeadEntity, whereGFGL+"'permitAnnualHeadMonth'")
+	if applyNumEntity.Id > 0 {
+		annualAuditHeadEntity.Parametercontent = strconv.Itoa(model.PermitAnnualHeadMonth)
+		annualAuditHeadEntity.Modifieduserid, _ = utils.StrTo(this.User.Id).Int()
+		annualAuditHeadEntity.Modifiedby = this.User.Realname
+		svc.UpdateEntityByIdCols(annualAuditHeadEntity.Id, annualAuditHeadEntity, cols)
+	}
+	var annualAuditAfterEntity baseparameter.Base_Parameter
+	svc.GetEntity(&annualAuditAfterEntity, whereGFGL+"'permitAnnualAfterMonth'")
+	if applyNumEntity.Id > 0 {
+		annualAuditAfterEntity.Parametercontent = strconv.Itoa(model.PermitAnnualAfterMonth)
+		annualAuditAfterEntity.Modifieduserid, _ = utils.StrTo(this.User.Id).Int()
+		annualAuditAfterEntity.Modifiedby = this.User.Realname
+		svc.UpdateEntityByIdCols(annualAuditAfterEntity.Id, annualAuditAfterEntity, cols)
+	}
+
+	// 交费时间限制
+	wherePayCheck := "Categoryid='PAYCHECK' and " + where
+	var payCheckStartEntity baseparameter.Base_Parameter
+	svc.GetEntity(&payCheckStartEntity, wherePayCheck+"'permitPayStartDay'")
+	if payCheckStartEntity.Id > 0 {
+		payCheckStartEntity.Parametercontent = strconv.Itoa(model.PermitPayStartDay)
+		applyNumEntity.Modifieduserid, _ = utils.StrTo(this.User.Id).Int()
+		applyNumEntity.Modifiedby = this.User.Realname
+		applyNumEntity.Modifiedon = time.Now()
+		svc.UpdateEntityByIdCols(payCheckStartEntity.Id, payCheckStartEntity, cols)
+	}
+	var payCheckEndEntity baseparameter.Base_Parameter
+	svc.GetEntity(&payCheckEndEntity, wherePayCheck+"'permitPayEndDay'")
+	if payCheckEndEntity.Id > 0 {
+		payCheckEndEntity.Parametercontent = strconv.Itoa(model.PermitPayEndDay)
+		applyNumEntity.Modifieduserid, _ = utils.StrTo(this.User.Id).Int()
+		applyNumEntity.Modifiedby = this.User.Realname
+		applyNumEntity.Modifiedon = time.Now()
+		svc.UpdateEntityByIdCols(payCheckEndEntity.Id, payCheckEndEntity, cols)
+	}
+
 	//_, err := svc.InsertEntity(&paramEntityList)
 	var errInfo ErrorInfo
 	errInfo.Message = utils.AlertProcess("参数设置成功!")
@@ -123,10 +162,15 @@ func (this *ParamSetController) ParamSetPost() {
 // @Success 200 {object} business.device.DeviceChannels
 // @router /getparamset [get]
 func (this *ParamSetController) ParamsetCheck() {
-	var paramentitylist []baseparameter.Base_Parameter
+	var paramEntityList []baseparameter.Base_Parameter
 	svc := baseparameter.GetBaseparameterService(utils.DBE)
-	paramentitylist = svc.GetBaseparameterbyid("GFGL1", "paramset")
-	this.Data["json"] = &paramentitylist
+	paramEntityList = svc.GetBaseparameterbyid("GFGL1", "paramset")
+
+	paramEntityList2 := svc.GetBaseparameterbyid("PAYCHECK", "paramset") // 交费日期限制也拿进来一起维护
+	for _, item := range paramEntityList2 {
+		paramEntityList = append(paramEntityList, item)
+	}
+	this.Data["json"] = &paramEntityList
 	this.ServeJSON()
 }