Browse Source

no message

zhangchuanxing 2 days ago
parent
commit
7cbd0acc0e
2 changed files with 14 additions and 0 deletions
  1. 4 0
      models/contract/contract.go
  2. 10 0
      models/seal/seal.go

+ 4 - 0
models/contract/contract.go

@@ -480,6 +480,7 @@ func InvalidContract(contractInfo *Contract) (err error) {
 // GetCompanyContractCode 生成合同编号
 func GetCompanyContractCode(productId int, contractBusinessType string) (companyCode string, err error) {
 	var num int
+	var num2 int
 	o := orm.NewOrm()
 	today := utils.GetToday(utils.FormatDate)
 	sql := `SELECT COUNT(1) AS num FROM contract where create_time>=?`
@@ -487,6 +488,9 @@ func GetCompanyContractCode(productId int, contractBusinessType string) (company
 	if err != nil {
 		return
 	}
+	sql = `SELECT COUNT(1) AS num FROM seal where create_time>=?` // 把合规的部分也算上
+	err = o.Raw(sql, today).QueryRow(&num2)
+	num += num2
 	companyType := ""
 	switch productId {
 	case 1:

+ 10 - 0
models/seal/seal.go

@@ -130,6 +130,7 @@ func UpdateSealCompanyContractId(companyContractId, sealId int) (err error) {
 // GetSealCode 生成合同编号
 func GetSealCode() (code string, err error) {
 	var num int
+	var num2 int
 	o := orm.NewOrm()
 	today := utils.GetToday(utils.FormatDate)
 	sql := `SELECT COUNT(1) AS num FROM seal where create_time>=?`
@@ -138,6 +139,10 @@ func GetSealCode() (code string, err error) {
 		return
 	}
 
+	sql = `SELECT COUNT(1) AS num FROM contract where create_time>=?` // 把正式合同的部分也算上
+	err = o.Raw(sql, today).QueryRow(&num2)
+	num += num2
+
 	code = "HZ" + time.Now().Format("20060102") + fmt.Sprintf("%03d", num)
 	return
 }
@@ -145,6 +150,7 @@ func GetSealCode() (code string, err error) {
 // GetSealCodeRai 生成权益合同编号1
 func GetSealCodeRai() (code string, err error) {
 	var num int
+	var num2 int
 	o := orm.NewOrm()
 	today := utils.GetToday(utils.FormatDate)
 	sql := `SELECT COUNT(1) AS num FROM seal where create_time>=?`
@@ -153,6 +159,10 @@ func GetSealCodeRai() (code string, err error) {
 		return
 	}
 
+	sql = `SELECT COUNT(1) AS num FROM contract where create_time>=?` // 把正式合同的部分也算上
+	err = o.Raw(sql, today).QueryRow(&num2)
+	num += num2
+
 	code = "HZEQ" + time.Now().Format("20060102") + fmt.Sprintf("%03d", num)
 	return
 }