|
@@ -34,6 +34,10 @@ type Seal struct {
|
|
CreateTime time.Time `description:"添加时间"`
|
|
CreateTime time.Time `description:"添加时间"`
|
|
CheckBackFileTime time.Time `description:"签回用印附件时间"`
|
|
CheckBackFileTime time.Time `description:"签回用印附件时间"`
|
|
AffiliatedCompany string `description:"归属公司"`
|
|
AffiliatedCompany string `description:"归属公司"`
|
|
|
|
+ ProductId int `description:"产品id,1:ficc;2:权益."`
|
|
|
|
+ CompanyId int `description:"客户id."`
|
|
|
|
+ StartDate string `description:"开始日期."`
|
|
|
|
+ EndDate string `description:"结束日期。"`
|
|
}
|
|
}
|
|
|
|
|
|
var EnumUse = []string{"销售合同", "渠道合同", "付款通知函", "招投标", "战略合作协议", "代付合同", "总对总协议"}
|
|
var EnumUse = []string{"销售合同", "渠道合同", "付款通知函", "招投标", "战略合作协议", "代付合同", "总对总协议"}
|
|
@@ -60,6 +64,7 @@ func GetSealInfoByContractId(sealId int) (sealInfo *Seal, err error) {
|
|
// GetSealInfoByDateAndCompanyId 根据起始时间,公司ID获取合同信息
|
|
// GetSealInfoByDateAndCompanyId 根据起始时间,公司ID获取合同信息
|
|
func GetSealInfoByDateAndCompanyId(startDate, endDate string, companyId int) (sealInfo *Seal, err error) {
|
|
func GetSealInfoByDateAndCompanyId(startDate, endDate string, companyId int) (sealInfo *Seal, err error) {
|
|
o := orm.NewOrm()
|
|
o := orm.NewOrm()
|
|
|
|
+
|
|
sql := `select * from seal where start_date = ? and end_date = ? AND company_id =? AND product_id = 2 order by seal_id asc limit 1 `
|
|
sql := `select * from seal where start_date = ? and end_date = ? AND company_id =? AND product_id = 2 order by seal_id asc limit 1 `
|
|
err = o.Raw(sql, startDate, endDate, companyId).QueryRow(&sealInfo)
|
|
err = o.Raw(sql, startDate, endDate, companyId).QueryRow(&sealInfo)
|
|
return
|
|
return
|
|
@@ -68,6 +73,7 @@ func GetSealInfoByDateAndCompanyId(startDate, endDate string, companyId int) (se
|
|
// GetCountByDateAndCompanyId 根据起始时间,公司ID获取合同信息数量
|
|
// GetCountByDateAndCompanyId 根据起始时间,公司ID获取合同信息数量
|
|
func GetCountByDateAndCompanyId(startDate, endDate string, companyId int) (count int, err error) {
|
|
func GetCountByDateAndCompanyId(startDate, endDate string, companyId int) (count int, err error) {
|
|
o := orm.NewOrm()
|
|
o := orm.NewOrm()
|
|
|
|
+
|
|
sql := "select count(*) AS COUNT from seal where start_date = ? and end_date = ? AND company_id =? AND product_id = 2 "
|
|
sql := "select count(*) AS COUNT from seal where start_date = ? and end_date = ? AND company_id =? AND product_id = 2 "
|
|
err = o.Raw(sql, startDate, endDate, companyId).QueryRow(&count)
|
|
err = o.Raw(sql, startDate, endDate, companyId).QueryRow(&count)
|
|
return
|
|
return
|
|
@@ -126,6 +132,21 @@ func GetSealCode() (code string, err error) {
|
|
return
|
|
return
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+// GetSealCodeRai 生成权益合同编号1
|
|
|
|
+func GetSealCodeRai() (code string, err error) {
|
|
|
|
+ var num int
|
|
|
|
+ o := orm.NewOrm()
|
|
|
|
+ today := utils.GetToday(utils.FormatDate)
|
|
|
|
+ sql := `SELECT COUNT(1) AS num FROM seal where create_time>=?`
|
|
|
|
+ err = o.Raw(sql, today).QueryRow(&num)
|
|
|
|
+ if err != nil {
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ code = "HZEQ" + time.Now().Format("20060102") + fmt.Sprintf("%03d", num)
|
|
|
|
+ return
|
|
|
|
+}
|
|
|
|
+
|
|
type CompanyNameList struct {
|
|
type CompanyNameList struct {
|
|
CompanyName string `description:"客户名称,甲方名称,长度32位"`
|
|
CompanyName string `description:"客户名称,甲方名称,长度32位"`
|
|
}
|
|
}
|
|
@@ -211,10 +232,34 @@ type SealApprovalItem struct {
|
|
CheckBackFileTimeStr string `description:"签回用印附件时间(字符串)"`
|
|
CheckBackFileTimeStr string `description:"签回用印附件时间(字符串)"`
|
|
ContractCode string `description:"合同编码"`
|
|
ContractCode string `description:"合同编码"`
|
|
AffiliatedCompany string `description:"归属公司"`
|
|
AffiliatedCompany string `description:"归属公司"`
|
|
|
|
+ ProductId int `description:"产品id,1:ficc;2:权益。"`
|
|
}
|
|
}
|
|
|
|
|
|
// GetSealApprovalListByWhere 获取用印审批列表-分页
|
|
// GetSealApprovalListByWhere 获取用印审批列表-分页
|
|
|
|
+//func GetSealApprovalListByWhere(condition, joinCondition string, pars []interface{}, startSize, pageSize int) (list []*SealApprovalItem, total int, err error) {
|
|
|
|
+// o := orm.NewOrm()
|
|
|
|
+// fields := `a.contract_approval_id,c.contract_id,a.apply_content,a.approve_remark,a.apply_user_id,a.apply_user_name,a.curr_node_id,a.start_node_id,c.create_time,a.modify_time,a.status approval_status,
|
|
|
|
+// c.status,c.seal_id,c.seal_type,c.service_type contract_type,c.use,c.company_name,c.file_url,c.approve_time,c.invalid_time,c.code,c.credit_code,c.check_back_file_time,c.check_back_file_url,c.product_id,c.affiliated_company `
|
|
|
|
+// sql := `SELECT ` + fields + ` from contract_approval a JOIN ( SELECT max( contract_approval_id ) max_id,contract_id FROM contract_approval where 1=1 and approval_type = "seal" `
|
|
|
|
+// sql += ` GROUP BY contract_id ) b on a.contract_approval_id=b.max_id
|
|
|
|
+// JOIN seal c ON c.seal_id = a.contract_id
|
|
|
|
+// JOIN contract_approval_record d on a.contract_approval_id=d.contract_approval_id ` + joinCondition + `
|
|
|
|
+//WHERE c.is_delete = 0 AND a.approval_type="seal" `
|
|
|
|
+// sql += condition
|
|
|
|
+// sql += ` group by c.seal_id order by c.create_time desc`
|
|
|
|
+// totalSql := `SELECT COUNT(1) total FROM (` + sql + `) z`
|
|
|
|
+// err = o.Raw(totalSql, pars).QueryRow(&total)
|
|
|
|
+// if err != nil {
|
|
|
|
+// return
|
|
|
|
+// }
|
|
|
|
+// sql += ` LIMIT ?,? `
|
|
|
|
+// _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&list)
|
|
|
|
+//
|
|
|
|
+// return
|
|
|
|
+//}
|
|
|
|
+
|
|
func GetSealApprovalListByWhere(condition, joinCondition string, pars []interface{}, startSize, pageSize int) (list []*SealApprovalItem, total int, err error) {
|
|
func GetSealApprovalListByWhere(condition, joinCondition string, pars []interface{}, startSize, pageSize int) (list []*SealApprovalItem, total int, err error) {
|
|
|
|
+ //git
|
|
o := orm.NewOrm()
|
|
o := orm.NewOrm()
|
|
fields := `a.contract_approval_id,c.contract_id,a.apply_content,a.approve_remark,a.apply_user_id,a.apply_user_name,a.curr_node_id,a.start_node_id,c.create_time,a.modify_time,a.status approval_status,
|
|
fields := `a.contract_approval_id,c.contract_id,a.apply_content,a.approve_remark,a.apply_user_id,a.apply_user_name,a.curr_node_id,a.start_node_id,c.create_time,a.modify_time,a.status approval_status,
|
|
c.status,c.seal_id,c.seal_type,c.service_type contract_type,c.use,c.company_name,c.file_url,c.approve_time,c.invalid_time,c.code,c.credit_code,c.check_back_file_time,c.check_back_file_url,c.affiliated_company `
|
|
c.status,c.seal_id,c.seal_type,c.service_type contract_type,c.use,c.company_name,c.file_url,c.approve_time,c.invalid_time,c.code,c.credit_code,c.check_back_file_time,c.check_back_file_url,c.affiliated_company `
|