Browse Source

fix: 合同编号规则bug修复

lanjianrong 4 years ago
parent
commit
ee195dbb71
2 changed files with 5 additions and 1 deletions
  1. 4 0
      services/rule_service.go
  2. 1 1
      web/api/contract_api.go

+ 4 - 0
services/rule_service.go

@@ -37,6 +37,7 @@ func NewRuleService() RuleService {
 		validAutoPath: "/api/rule/auto",
 		daoRule:       dao.NewRuleDao(datasource.InstanceDbMaster()),
 		daoSafe:       dao.NewSafeDao(datasource.InstanceDbMaster()),
+		daoContract:   dao.NewContractDao(datasource.InstanceDbMaster()),
 	}
 }
 
@@ -93,6 +94,9 @@ func (s *ruleService) AutoCode(bid int, pid int, codeType string) (string, error
 		err := json.Unmarshal([]byte(rule.ContractRule), &code)
 		if err == nil {
 			total, err := s.daoContract.CountRuleCode(bid)
+			if err != nil {
+				return "", err
+			}
 			value := reflect.ValueOf(code)
 			for i := 0; i < value.NumField(); i++ {
 				b := fmt.Sprint(value.Field(i))

+ 1 - 1
web/api/contract_api.go

@@ -245,7 +245,7 @@ func (c *ContractApi) PostIncomeCreate() {
 // @Param   signerTime     path    string     true        "签约时间"
 // @Param   remarks     path    string     true        "备注"
 // @Success 200 {object} viewmodels.TreeSectionContract "{code:0成功,-1参数类错误,msg:错误信息}"
-// @Router /api/contract/income/Update [post]
+// @Router /api/contract/income/update [post]
 func (c *ContractApi) PostIncomeUpdate() {
 	// 验证参数
 	contractData, err := c.ServiceContract.ValidRuleContractEdi(c.Ctx)