|
@@ -123,7 +123,7 @@ func ApplySeal(sysUser *system.Admin, req request.SealApprovalApplyReq) (err err
|
|
|
}()
|
|
|
|
|
|
// 添加用印
|
|
|
- sealInfo, err := addSeal(sysUser.AdminId, req.ContractId, req.FileNum, req.CompanyId, sysUser.RealName, req.Use, req.CompanyName, req.UseCompanyName, req.CreditCode, req.ServiceType, req.SealType, req.Remark, req.FileUrls, req.AffiliatedCompany, req.StartDate, req.EndDate)
|
|
|
+ sealInfo, err := addSeal(sysUser.AdminId, req.ContractId, req.FileNum, req.CompanyId, sysUser.RealName, req.Use, req.CompanyName, req.UseCompanyName, req.CreditCode, req.ServiceType, req.SealType, req.Remark, req.FileUrls, req.AffiliatedCompany, req.StartDate, req.EndDate, req.Money)
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
@@ -139,67 +139,8 @@ func ApplySeal(sysUser *system.Admin, req request.SealApprovalApplyReq) (err err
|
|
|
return
|
|
|
}
|
|
|
|
|
|
-//func addSeal(userId, contractId, fileNum, companyId int, userName, use, companyName, useCompanyName, creditCode, serviceType, sealType, remark string, fileUrls []string, affiliatedCompany, startDate, endDate string) (sealInfo *seal.Seal, err error) {
|
|
|
-// if !strings.Contains(strings.Join(seal.EnumUse, ","), use) {
|
|
|
-// err = errors.New("用印用途异常")
|
|
|
-// return
|
|
|
-// }
|
|
|
-// if !strings.Contains(strings.Join(seal.EnumServiceType, ","), serviceType) {
|
|
|
-// err = errors.New("业务类型异常")
|
|
|
-// return
|
|
|
-// }
|
|
|
-//
|
|
|
-// sealCode, err := seal.GetSealCode()
|
|
|
-// if err != nil {
|
|
|
-// return
|
|
|
-// }
|
|
|
-// fileUrl := ""
|
|
|
-// now := time.Now()
|
|
|
-// attachments := make([]*seal.Attachment, 0)
|
|
|
-// if len(fileUrls) == 1 {
|
|
|
-// fileUrl = fileUrls[0]
|
|
|
-// }
|
|
|
-//
|
|
|
-// sealInfo = &seal.Seal{
|
|
|
-// Code: sealCode,
|
|
|
-// UserId: userId,
|
|
|
-// UserName: userName,
|
|
|
-// Use: use,
|
|
|
-// CompanyName: companyName,
|
|
|
-// UseCompanyName: useCompanyName,
|
|
|
-// CreditCode: creditCode,
|
|
|
-// ServiceType: serviceType,
|
|
|
-// SealType: sealType,
|
|
|
-// Status: "待提交",
|
|
|
-// Remark: remark,
|
|
|
-// FileUrl: fileUrl,
|
|
|
-// FileNum: fileNum,
|
|
|
-// ContractId: contractId,
|
|
|
-// ModifyTime: now,
|
|
|
-// CreateTime: now,
|
|
|
-// AffiliatedCompany: affiliatedCompany,
|
|
|
-// }
|
|
|
-// err = seal.AddSeal(sealInfo)
|
|
|
-// if err != nil {
|
|
|
-// return
|
|
|
-// }
|
|
|
-// if len(fileUrls) > 1 {
|
|
|
-// for _, v := range fileUrls {
|
|
|
-// tmp := &seal.Attachment{
|
|
|
-// SealId: sealInfo.SealId,
|
|
|
-// FileUrl: v,
|
|
|
-// ModifyTime: now,
|
|
|
-// CreateTime: now,
|
|
|
-// }
|
|
|
-// attachments = append(attachments, tmp)
|
|
|
-// }
|
|
|
-// err = seal.AddAttachments(attachments)
|
|
|
-// }
|
|
|
-// return
|
|
|
-//}
|
|
|
-
|
|
|
-// addSeal 新增用印.
|
|
|
-func addSeal(userId, contractId, fileNum, companyId int, userName, use, companyName, useCompanyName, creditCode, serviceType, sealType, remark string, fileUrls []string, affiliatedCompany, startDate, endDate string) (sealInfo *seal.Seal, err error) {
|
|
|
+// addSeal 新增用印
|
|
|
+func addSeal(userId, contractId, fileNum, companyId int, userName, use, companyName, useCompanyName, creditCode, serviceType, sealType, remark string, fileUrls []string, affiliatedCompany, startDate, endDate string, money float64) (sealInfo *seal.Seal, err error) {
|
|
|
if !strings.Contains(strings.Join(seal.EnumUse, ","), use) {
|
|
|
err = errors.New("用印用途异常")
|
|
|
return
|
|
@@ -261,6 +202,7 @@ func addSeal(userId, contractId, fileNum, companyId int, userName, use, companyN
|
|
|
CompanyId: companyId,
|
|
|
StartDate: startDate,
|
|
|
EndDate: endDate,
|
|
|
+ Money: money,
|
|
|
}
|
|
|
|
|
|
err = seal.AddSeal(sealInfo)
|
|
@@ -298,7 +240,7 @@ func EditApply(sysUser *system.Admin, req request.SealApprovalEditReq) (err erro
|
|
|
}()
|
|
|
|
|
|
// 编辑用印
|
|
|
- sealInfo, err := editSeal(req.SealId, sysUser.AdminId, req.ContractId, req.FileNum, req.Use, req.CompanyName, req.UseCompanyName, req.CreditCode, req.ServiceType, req.SealType, req.Remark, req.FileUrls, req.AffiliatedCompany, req.StartDate, req.EndDate)
|
|
|
+ sealInfo, err := editSeal(req.SealId, sysUser.AdminId, req.ContractId, req.FileNum, req.Use, req.CompanyName, req.UseCompanyName, req.CreditCode, req.ServiceType, req.SealType, req.Remark, req.FileUrls, req.AffiliatedCompany, req.StartDate, req.EndDate, req.Money)
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|
|
@@ -315,7 +257,7 @@ func EditApply(sysUser *system.Admin, req request.SealApprovalEditReq) (err erro
|
|
|
}
|
|
|
|
|
|
// editSeal 编辑用印申请
|
|
|
-func editSeal(sealId, userId, contractId, fileNum int, use, companyName, userCompanyName, creditCode, serviceType, sealType, remark string, fileUrls []string, affiliatedCompany, startDate, endDate string) (sealInfo *seal.Seal, err error) {
|
|
|
+func editSeal(sealId, userId, contractId, fileNum int, use, companyName, userCompanyName, creditCode, serviceType, sealType, remark string, fileUrls []string, affiliatedCompany, startDate, endDate string, money float64) (sealInfo *seal.Seal, err error) {
|
|
|
if !strings.Contains(strings.Join(seal.EnumUse, ","), use) {
|
|
|
err = errors.New("用印用途异常")
|
|
|
return
|
|
@@ -364,7 +306,8 @@ func editSeal(sealId, userId, contractId, fileNum int, use, companyName, userCom
|
|
|
sealInfo.AffiliatedCompany = affiliatedCompany
|
|
|
sealInfo.StartDate = startDate
|
|
|
sealInfo.EndDate = endDate
|
|
|
- err = sealInfo.Update([]string{"Use", "CompanyName", "UseCompanyName", "CreditCode", "ServiceType", "SealType", "Remark", "FileUrl", "FileNum", "ContractId", "ModifyTime", "CreateTime", "Status", "AffiliatedCompany", "StartDate", "EndDate"})
|
|
|
+ sealInfo.Money = money
|
|
|
+ err = sealInfo.Update([]string{"Use", "CompanyName", "UseCompanyName", "CreditCode", "ServiceType", "SealType", "Remark", "FileUrl", "FileNum", "ContractId", "ModifyTime", "CreateTime", "Status", "AffiliatedCompany", "StartDate", "EndDate", "Money"})
|
|
|
if err != nil {
|
|
|
return
|
|
|
}
|