正在显示
7 个修改的文件
包含
67 行增加
和
3 行删除
| @@ -19,7 +19,7 @@ mysql_db_name = "${MYSQL_DB_NAME||opportunity_dev}" | @@ -19,7 +19,7 @@ mysql_db_name = "${MYSQL_DB_NAME||opportunity_dev}" | ||
| 19 | ##redis相关配置 | 19 | ##redis相关配置 |
| 20 | redis_add = "${REDIS_HOST||127.0.0.1}" | 20 | redis_add = "${REDIS_HOST||127.0.0.1}" |
| 21 | redis_add_port = "${REDIS_PORT||6379}" | 21 | redis_add_port = "${REDIS_PORT||6379}" |
| 22 | -redis_auth = "" | 22 | +redis_auth = "123456" |
| 23 | ##log相关配置 | 23 | ##log相关配置 |
| 24 | ##out_put:"console","file" | 24 | ##out_put:"console","file" |
| 25 | log_output = "file" | 25 | log_output = "file" |
| @@ -205,6 +205,7 @@ func (this *BulletinController) ExportFeedBacks() { | @@ -205,6 +205,7 @@ func (this *BulletinController) ExportFeedBacks() { | ||
| 205 | msg = protocol.BadRequestParam("1") | 205 | msg = protocol.BadRequestParam("1") |
| 206 | return | 206 | return |
| 207 | } | 207 | } |
| 208 | + //excel.FileName = fmt.Sprintf("商品列表%v.xlsx","") | ||
| 208 | if err = this.ResponseExcelByFile(this.Ctx, excel); err != nil { | 209 | if err = this.ResponseExcelByFile(this.Ctx, excel); err != nil { |
| 209 | log.Error(err.Error()) | 210 | log.Error(err.Error()) |
| 210 | msg = protocol.BadRequestParam("1") | 211 | msg = protocol.BadRequestParam("1") |
| @@ -43,6 +43,18 @@ func (this *TemplateController) TemplateAdd() { | @@ -43,6 +43,18 @@ func (this *TemplateController) TemplateAdd() { | ||
| 43 | msg = m | 43 | msg = m |
| 44 | return | 44 | return |
| 45 | } | 45 | } |
| 46 | + if len([]rune(request.Template.Name)) > 10 { | ||
| 47 | + msg = protocol.BadRequestParam("10070") | ||
| 48 | + return | ||
| 49 | + } | ||
| 50 | + if len([]rune(request.Template.Doc)) > 30 { | ||
| 51 | + msg = protocol.BadRequestParam("10272") | ||
| 52 | + return | ||
| 53 | + } | ||
| 54 | + { | ||
| 55 | + //名称不能超过20字 | ||
| 56 | + //字段只能10个字段 | ||
| 57 | + } | ||
| 46 | { | 58 | { |
| 47 | //审批人配置 | 59 | //审批人配置 |
| 48 | v := request.AuditFlowConfig.NoApprover | 60 | v := request.AuditFlowConfig.NoApprover |
| @@ -125,6 +137,10 @@ func (this *TemplateController) TemplateUpdate() { | @@ -125,6 +137,10 @@ func (this *TemplateController) TemplateUpdate() { | ||
| 125 | msg = m | 137 | msg = m |
| 126 | return | 138 | return |
| 127 | } | 139 | } |
| 140 | + if len([]rune(request.Template.Doc)) > 30 { | ||
| 141 | + msg = protocol.BadRequestParam("10272") | ||
| 142 | + return | ||
| 143 | + } | ||
| 128 | rsp, err := audit.TemplateUpdate(uid, companyId, request) | 144 | rsp, err := audit.TemplateUpdate(uid, companyId, request) |
| 129 | msg = protocol.NewReturnResponse(rsp, err) | 145 | msg = protocol.NewReturnResponse(rsp, err) |
| 130 | return | 146 | return |
| @@ -272,6 +288,10 @@ func (this *TemplateController) TemplateOperateCategory() { | @@ -272,6 +288,10 @@ func (this *TemplateController) TemplateOperateCategory() { | ||
| 272 | msg = m | 288 | msg = m |
| 273 | return | 289 | return |
| 274 | } | 290 | } |
| 291 | + if len([]rune(request.Name)) > 10 { | ||
| 292 | + msg = protocol.BadRequestParam("10070") | ||
| 293 | + return | ||
| 294 | + } | ||
| 275 | rsp, err := audit.TemplateOperateCategory(uid, companyId, request) | 295 | rsp, err := audit.TemplateOperateCategory(uid, companyId, request) |
| 276 | msg = protocol.NewReturnResponse(rsp, err) | 296 | msg = protocol.NewReturnResponse(rsp, err) |
| 277 | } | 297 | } |
| @@ -106,9 +106,18 @@ func GetAuditTemplateByTypeId(chanceTypeId int) (v []*AuditTemplate, err error) | @@ -106,9 +106,18 @@ func GetAuditTemplateByTypeId(chanceTypeId int) (v []*AuditTemplate, err error) | ||
| 106 | 106 | ||
| 107 | func GetAuditTemplateByCode(companyId int64, code string) (v *ChanceType, err error) { | 107 | func GetAuditTemplateByCode(companyId int64, code string) (v *ChanceType, err error) { |
| 108 | o := orm.NewOrm() | 108 | o := orm.NewOrm() |
| 109 | - sql := "select * from audit_template where code=? and company_id=?" | 109 | + sql := "select * from audit_template where binary code=? and company_id=?" |
| 110 | if err = o.Raw(sql, code, companyId).QueryRow(&v); err == nil { | 110 | if err = o.Raw(sql, code, companyId).QueryRow(&v); err == nil { |
| 111 | return | 111 | return |
| 112 | } | 112 | } |
| 113 | return | 113 | return |
| 114 | } | 114 | } |
| 115 | + | ||
| 116 | +func GetAuditTemplateByName(companyId int64, name string) (v *ChanceType, err error) { | ||
| 117 | + o := orm.NewOrm() | ||
| 118 | + sql := "select * from audit_template where binary name=? and company_id=?" | ||
| 119 | + if err = o.Raw(sql, name, companyId).QueryRow(&v); err == nil { | ||
| 120 | + return | ||
| 121 | + } | ||
| 122 | + return | ||
| 123 | +} |
| @@ -95,9 +95,18 @@ func GetChanceTypeByCompany(companyId int) (v []*ChanceType, err error) { | @@ -95,9 +95,18 @@ func GetChanceTypeByCompany(companyId int) (v []*ChanceType, err error) { | ||
| 95 | 95 | ||
| 96 | func GetChanceTypeByCode(companyId int64, code string) (v *ChanceType, err error) { | 96 | func GetChanceTypeByCode(companyId int64, code string) (v *ChanceType, err error) { |
| 97 | o := orm.NewOrm() | 97 | o := orm.NewOrm() |
| 98 | - sql := "select * from chance_type where code=? and company_id=?" | 98 | + sql := "select * from chance_type where binary code=? and company_id=?" |
| 99 | if err = o.Raw(sql, code, companyId).QueryRow(&v); err == nil { | 99 | if err = o.Raw(sql, code, companyId).QueryRow(&v); err == nil { |
| 100 | return | 100 | return |
| 101 | } | 101 | } |
| 102 | return | 102 | return |
| 103 | } | 103 | } |
| 104 | + | ||
| 105 | +func GetChanceTypeByName(companyId int64, name string) (v *ChanceType, err error) { | ||
| 106 | + o := orm.NewOrm() | ||
| 107 | + sql := "select * from chance_type where binary name=? and company_id=?" | ||
| 108 | + if err = o.Raw(sql, name, companyId).QueryRow(&v); err == nil { | ||
| 109 | + return | ||
| 110 | + } | ||
| 111 | + return | ||
| 112 | +} |
| @@ -67,6 +67,15 @@ var errmessge ErrorMap = map[string]string{ | @@ -67,6 +67,15 @@ var errmessge ErrorMap = map[string]string{ | ||
| 67 | "10067": "一级分类不存在", | 67 | "10067": "一级分类不存在", |
| 68 | "10068": "审核人为空参数有误", | 68 | "10068": "审核人为空参数有误", |
| 69 | "10069": "未设置审核人", | 69 | "10069": "未设置审核人", |
| 70 | + "10070": "分类名称输入大于10个字符", | ||
| 71 | + "10271": "模板已存在", | ||
| 72 | + "10272": "说明信息输入大于30个字符", | ||
| 73 | + "10273": "表单列最多20个字符", | ||
| 74 | + "10274": "最多添加10个字段", | ||
| 75 | + "10275": "最多添加1个节点", | ||
| 76 | + "10276": "最多选择1个角色", | ||
| 77 | + "10277": "最多一个小数", | ||
| 78 | + | ||
| 70 | "10170": "请选择指定成员", | 79 | "10170": "请选择指定成员", |
| 71 | "10171": "请选择审批人类别", | 80 | "10171": "请选择审批人类别", |
| 72 | "10172": "请选择审批方式", | 81 | "10172": "请选择审批方式", |
| @@ -35,6 +35,10 @@ func TemplateAdd(uid, companyId int64, request *protocol.TemplateAddRequest) (rs | @@ -35,6 +35,10 @@ func TemplateAdd(uid, companyId int64, request *protocol.TemplateAddRequest) (rs | ||
| 35 | err = protocol.NewErrWithMessage("10064") | 35 | err = protocol.NewErrWithMessage("10064") |
| 36 | return | 36 | return |
| 37 | } | 37 | } |
| 38 | + if _, err = models.GetAuditTemplateByName(companyId, request.Template.Name); err == nil { | ||
| 39 | + err = protocol.NewErrWithMessage("10271") | ||
| 40 | + return | ||
| 41 | + } | ||
| 38 | orm := orm2.NewOrm() | 42 | orm := orm2.NewOrm() |
| 39 | //模板 | 43 | //模板 |
| 40 | { | 44 | { |
| @@ -156,6 +160,10 @@ func TemplateUpdate(uid, companyId int64, request *protocol.TemplateUpdateReques | @@ -156,6 +160,10 @@ func TemplateUpdate(uid, companyId int64, request *protocol.TemplateUpdateReques | ||
| 156 | log.Error("template_id:%v 不存在 ,err:%v", request.Template.Id, err.Error()) | 160 | log.Error("template_id:%v 不存在 ,err:%v", request.Template.Id, err.Error()) |
| 157 | return | 161 | return |
| 158 | } | 162 | } |
| 163 | + if _, err = models.GetAuditTemplateByName(companyId, request.Template.Name); err == nil { | ||
| 164 | + err = protocol.NewErrWithMessage("10271") | ||
| 165 | + return | ||
| 166 | + } | ||
| 159 | orm := orm2.NewOrm() | 167 | orm := orm2.NewOrm() |
| 160 | //模板 | 168 | //模板 |
| 161 | { | 169 | { |
| @@ -549,6 +557,10 @@ func TemplateOperateCategory(uid, companyId int64, request *protocol.TemplateOpe | @@ -549,6 +557,10 @@ func TemplateOperateCategory(uid, companyId int64, request *protocol.TemplateOpe | ||
| 549 | log.Error("template_id:%v companyId:%v want:%v not equal.", request.Id, companyId, chanceType.CompanyId) | 557 | log.Error("template_id:%v companyId:%v want:%v not equal.", request.Id, companyId, chanceType.CompanyId) |
| 550 | return | 558 | return |
| 551 | } | 559 | } |
| 560 | + if _, err = models.GetChanceTypeByName(companyId, chanceType.Name); err == nil { | ||
| 561 | + err = protocol.NewErrWithMessage("10271") | ||
| 562 | + return | ||
| 563 | + } | ||
| 552 | if err = utils.UpdateTableByMap(chanceType, map[string]interface{}{"Name": request.Name, "Icon": request.Icon, "SortNum": chanceType.SortNum, "UpdateAt": time.Now()}); err != nil { | 564 | if err = utils.UpdateTableByMap(chanceType, map[string]interface{}{"Name": request.Name, "Icon": request.Icon, "SortNum": chanceType.SortNum, "UpdateAt": time.Now()}); err != nil { |
| 553 | log.Error(err.Error()) | 565 | log.Error(err.Error()) |
| 554 | return | 566 | return |
| @@ -572,6 +584,10 @@ func TemplateOperateCategory(uid, companyId int64, request *protocol.TemplateOpe | @@ -572,6 +584,10 @@ func TemplateOperateCategory(uid, companyId int64, request *protocol.TemplateOpe | ||
| 572 | err = protocol.NewErrWithMessage("10064") | 584 | err = protocol.NewErrWithMessage("10064") |
| 573 | return | 585 | return |
| 574 | } | 586 | } |
| 587 | + if _, err = models.GetChanceTypeByName(companyId, chanceType.Name); err == nil { | ||
| 588 | + err = protocol.NewErrWithMessage("10271") | ||
| 589 | + return | ||
| 590 | + } | ||
| 575 | if _, err = models.AddChanceType(chanceType); err != nil { | 591 | if _, err = models.AddChanceType(chanceType); err != nil { |
| 576 | log.Error(err.Error()) | 592 | log.Error(err.Error()) |
| 577 | } | 593 | } |
-
请 注册 或 登录 后发表评论