|
|
@@ -14,11 +14,12 @@ type ParamSetController struct {
|
|
|
}
|
|
|
|
|
|
type ParamSerModel struct {
|
|
|
- IsInvestigate bool `json:"isInvestigate"`
|
|
|
- IsGetBarCode bool `json:"isGetBarCode"`
|
|
|
- SAddLimitMonth string `json:"sAddLimitMonth"`
|
|
|
- SFlupLastDay int `json:"sFlupLastDay"`
|
|
|
- STestFrontDay int `json:"sTestFrontDay"`
|
|
|
+ IsInvestigate bool `json:"isInvestigate"`
|
|
|
+ IsGetBarCode bool `json:"isGetBarCode"`
|
|
|
+ SAddLimitMonth string `json:"sAddLimitMonth"`
|
|
|
+ AppendApplyNums string `json:"appendApplyNums"`
|
|
|
+ SFlupLastDay int `json:"sFlupLastDay"`
|
|
|
+ STestFrontDay int `json:"sTestFrontDay"`
|
|
|
}
|
|
|
type ParamModel struct {
|
|
|
// 每次新增变量参数时在这继续添加即可
|
|
|
@@ -37,66 +38,65 @@ type ParamModel struct {
|
|
|
func (this *ParamSetController) ParamSetPost() {
|
|
|
|
|
|
var model ParamSerModel
|
|
|
- var jsonblob = this.Ctx.Input.RequestBody
|
|
|
- json.Unmarshal(jsonblob, &model)
|
|
|
- var paramentity baseparameter.Base_Parameter
|
|
|
- var paramentitylist []baseparameter.Base_Parameter
|
|
|
+ var jsonBlob = this.Ctx.Input.RequestBody
|
|
|
+ json.Unmarshal(jsonBlob, &model)
|
|
|
|
|
|
svc := baseparameter.GetBaseparameterService(utils.DBE)
|
|
|
- AccCode := "GFGL1"
|
|
|
- svc.DeleteParam(AccCode, "paramset") //删除所有的参数
|
|
|
|
|
|
+ // 公共参数
|
|
|
+ cols := []string{
|
|
|
+ "Parametercontent",
|
|
|
+ }
|
|
|
+ where := "Categoryid='GFGL1' and Parameterid='paramset' and Parametercode="
|
|
|
+
|
|
|
+ // 是否需要现场考察报告
|
|
|
var sisInvestigate string
|
|
|
if model.IsInvestigate {
|
|
|
sisInvestigate = "true"
|
|
|
} else {
|
|
|
sisInvestigate = "false"
|
|
|
}
|
|
|
- paramentity.Categoryid = AccCode
|
|
|
- paramentity.Parameterid = "paramset"
|
|
|
- paramentity.Parametercode = "isInvestigate"
|
|
|
- paramentity.Parametercontent = sisInvestigate
|
|
|
- paramentity.Createuserid, _ = utils.StrTo(this.User.Id).Int()
|
|
|
- paramentity.Createby = this.User.Realname
|
|
|
- paramentitylist = append(paramentitylist, paramentity)
|
|
|
-
|
|
|
- //paramentity.Parametercode = "isGetBarCode"
|
|
|
- //fmt.Println(this.GetString("isGetBarCode"))
|
|
|
- //if model.IsGetBarCode {
|
|
|
- // paramentity.Parametercontent = "true"
|
|
|
- //} else {
|
|
|
- // paramentity.Parametercontent = "false"
|
|
|
- //}
|
|
|
- //paramentitylist = append(paramentitylist, paramentity)
|
|
|
- //
|
|
|
- paramentity.Parametercode = "sAddLimitMonth"
|
|
|
- sAddLimitMonth := utils.ToStr(model.SAddLimitMonth)
|
|
|
- paramentity.Parametercontent = sAddLimitMonth
|
|
|
- paramentitylist = append(paramentitylist, paramentity)
|
|
|
- //
|
|
|
- //paramentity.Parametercode = "sFlupLastDay"
|
|
|
- //sFlupLastDay := utils.ToStr(model.SFlupLastDay)
|
|
|
- //paramentity.Parametercontent = sFlupLastDay
|
|
|
- //paramentitylist = append(paramentitylist, paramentity)
|
|
|
- //
|
|
|
- //paramentity.Parametercode = "sTestFrontDay"
|
|
|
- //sTestFrontDay := utils.ToStr(model.STestFrontDay)
|
|
|
- //paramentity.Parametercontent = sTestFrontDay
|
|
|
- //paramentitylist = append(paramentitylist, paramentity)
|
|
|
-
|
|
|
- _, err := svc.InsertEntity(¶mentitylist)
|
|
|
- var errinfo ErrorInfo
|
|
|
- if err == nil {
|
|
|
- errinfo.Message = utils.AlertProcess("参数设置成功!")
|
|
|
- errinfo.Code = 0
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
- } else {
|
|
|
- errinfo.Message = utils.AlertProcess("参数设置失败!" + err.Error())
|
|
|
- errinfo.Code = -2
|
|
|
- this.Data["json"] = &errinfo
|
|
|
- this.ServeJSON()
|
|
|
+ var isInvEntity baseparameter.Base_Parameter
|
|
|
+ svc.GetEntity(&isInvEntity, where+"'isInvestigate'")
|
|
|
+ if isInvEntity.Id > 0 {
|
|
|
+ isInvEntity.Parametercontent = sisInvestigate
|
|
|
+ isInvEntity.Modifieduserid, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ isInvEntity.Modifiedby = this.User.Realname
|
|
|
+ svc.UpdateEntityByIdCols(isInvEntity.Id, isInvEntity, cols)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 增项申请时间间隔
|
|
|
+ var lmEntity baseparameter.Base_Parameter
|
|
|
+ svc.GetEntity(&lmEntity, where+"'sAddLimitMonth'")
|
|
|
+ if lmEntity.Id > 0 {
|
|
|
+ if model.SAddLimitMonth == "" {
|
|
|
+ model.SAddLimitMonth = "0"
|
|
|
+ }
|
|
|
+ lmEntity.Parametercontent = model.SAddLimitMonth
|
|
|
+ lmEntity.Modifieduserid, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ lmEntity.Modifiedby = this.User.Realname
|
|
|
+ svc.UpdateEntityByIdCols(lmEntity.Id, lmEntity, cols)
|
|
|
+ }
|
|
|
+
|
|
|
+ // 增项申请次数 每年
|
|
|
+ var applyNumEntity baseparameter.Base_Parameter
|
|
|
+ svc.GetEntity(&applyNumEntity, where+"'appendApplyNums'")
|
|
|
+ if applyNumEntity.Id > 0 {
|
|
|
+ if model.AppendApplyNums == "" {
|
|
|
+ model.AppendApplyNums = "2"
|
|
|
+ }
|
|
|
+ applyNumEntity.Parametercontent = model.AppendApplyNums
|
|
|
+ applyNumEntity.Modifieduserid, _ = utils.StrTo(this.User.Id).Int()
|
|
|
+ applyNumEntity.Modifiedby = this.User.Realname
|
|
|
+ svc.UpdateEntityByIdCols(applyNumEntity.Id, applyNumEntity, cols)
|
|
|
}
|
|
|
+
|
|
|
+ //_, err := svc.InsertEntity(¶mEntityList)
|
|
|
+ var errInfo ErrorInfo
|
|
|
+ errInfo.Message = utils.AlertProcess("参数设置成功!")
|
|
|
+ errInfo.Code = 0
|
|
|
+ this.Data["json"] = &errInfo
|
|
|
+ this.ServeJSON()
|
|
|
}
|
|
|
|
|
|
// @Title 读取参数
|