|
@@ -20,21 +20,14 @@ import (
|
|
|
|
|
|
|
|
|
func AddSeal(userId, contractId, fileNum int, userName, use, useCompanyName, companyName, creditCode, serviceType, sealType, remark, fileUrl string) (sealInfo *seal.Seal, err error) {
|
|
|
- useList := []string{"销售合同", "渠道合同", "付款通知函", "招投标", "战略合作协议"}
|
|
|
- serviceTypeList := []string{"新签合同", "续约合同", "补充协议"}
|
|
|
- sealTypeList := []string{"合同章", "公章", "法人章"}
|
|
|
- if !strings.Contains(strings.Join(useList, ","), use) {
|
|
|
+ if !strings.Contains(strings.Join(seal.EnumUse, ","), use) {
|
|
|
err = errors.New("用印用途异常")
|
|
|
return
|
|
|
}
|
|
|
- if !strings.Contains(strings.Join(serviceTypeList, ","), serviceType) {
|
|
|
+ if !strings.Contains(strings.Join(seal.EnumServiceType, ","), serviceType) {
|
|
|
err = errors.New("业务类型异常")
|
|
|
return
|
|
|
}
|
|
|
- if !strings.Contains(strings.Join(sealTypeList, ","), sealType) {
|
|
|
- err = errors.New("加盖印章类型异常")
|
|
|
- return
|
|
|
- }
|
|
|
|
|
|
sealCode, err := seal.GetSealCode()
|
|
|
if err != nil {
|
|
@@ -59,26 +52,31 @@ func AddSeal(userId, contractId, fileNum int, userName, use, useCompanyName, com
|
|
|
CreateTime: time.Now(),
|
|
|
}
|
|
|
err = seal.AddSeal(sealInfo)
|
|
|
+ if err != nil {
|
|
|
+ err = errors.New("新增用印失败")
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ err = seal.AddSealOperationRecord(sealInfo.SealId, userId, 0, "apply", userName, "提交审批", "")
|
|
|
+ if err != nil {
|
|
|
+ err = errors.New("新增用印日志失败")
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
return
|
|
|
}
|
|
|
|
|
|
|
|
|
-func Edit(sealId, userId, contractId, fileNum int, use, companyName, userCompanyName, creditCode, serviceType, sealType, remark, fileUrl string) (sealInfo *seal.Seal, err error) {
|
|
|
- useList := []string{"销售合同", "渠道合同", "付款通知函", "招投标", "战略合作协议"}
|
|
|
- serviceTypeList := []string{"新签合同", "续约合同", "补充协议"}
|
|
|
- sealTypeList := []string{"合同章", "公章", "法人章"}
|
|
|
- if !strings.Contains(strings.Join(useList, ","), use) {
|
|
|
+func Edit(sealId, userId, contractId, fileNum int, use, companyName, userCompanyName, creditCode, serviceType, sealType, remark, fileUrl, userName string) (sealInfo *seal.Seal, err error) {
|
|
|
+ if !strings.Contains(strings.Join(seal.EnumUse, ","), use) {
|
|
|
err = errors.New("用印用途异常")
|
|
|
return
|
|
|
}
|
|
|
- if !strings.Contains(strings.Join(serviceTypeList, ","), serviceType) {
|
|
|
+ if !strings.Contains(strings.Join(seal.EnumServiceType, ","), serviceType) {
|
|
|
err = errors.New("业务类型异常")
|
|
|
return
|
|
|
}
|
|
|
- if !strings.Contains(strings.Join(sealTypeList, ","), sealType) {
|
|
|
- err = errors.New("加盖印章类型异常")
|
|
|
- return
|
|
|
- }
|
|
|
|
|
|
|
|
|
sealInfo, err = seal.GetSealInfoById(sealId)
|
|
@@ -112,22 +110,27 @@ func Edit(sealId, userId, contractId, fileNum int, use, companyName, userCompany
|
|
|
sealInfo.Status = "待提交"
|
|
|
|
|
|
err = sealInfo.Update([]string{"Use", "CompanyName", "UseCompanyName", "CreditCode", "ServiceType", "SealType", "Remark", "FileUrl", "ModifyTime", "Status"})
|
|
|
+ if err != nil {
|
|
|
+ err = errors.New("新增用印日志失败")
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ err = seal.AddSealOperationRecord(sealInfo.SealId, userId, 0, "edit", userName, "重提审批", "")
|
|
|
+ if err != nil {
|
|
|
+ err = errors.New("编辑用印日志失败")
|
|
|
+ return
|
|
|
+ }
|
|
|
|
|
|
return
|
|
|
}
|
|
|
|
|
|
|
|
|
func CheckEdit(sealInfo *seal.Seal, approvalInfo *contract_approval.ContractApproval, approvalRecord *contract_approval_record.ContractApprovalRecord, fileNum int, fileUrl, use, sealType, remark string, opUser *custom.AdminWx) (err error) {
|
|
|
- useList := []string{"销售合同", "渠道合同", "付款通知函", "招投标", "战略合作协议"}
|
|
|
- sealTypeList := []string{"合同章", "公章", "法人章"}
|
|
|
- if !strings.Contains(strings.Join(useList, ","), use) {
|
|
|
+ if !strings.Contains(strings.Join(seal.EnumUse, ","), use) {
|
|
|
err = errors.New("用印用途异常")
|
|
|
return
|
|
|
}
|
|
|
- if !strings.Contains(strings.Join(sealTypeList, ","), sealType) {
|
|
|
- err = errors.New("加盖印章类型异常")
|
|
|
- return
|
|
|
- }
|
|
|
|
|
|
|
|
|
if opUser.RoleTypeCode != utils.ROLE_TYPE_CODE_COMPLIANCE {
|
|
@@ -172,10 +175,14 @@ func CheckEdit(sealInfo *seal.Seal, approvalInfo *contract_approval.ContractAppr
|
|
|
}
|
|
|
content := "用印修改:" + opUser.RealName + "修改了" + strings.Join(updateContent, "、")
|
|
|
|
|
|
+
|
|
|
+ originFlowType := GetFlowTypeBySealType(sealInfo.SealType)
|
|
|
+ reqFlowType := GetFlowTypeBySealType(sealType)
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
- if (sealInfo.SealType == "合同章" && strings.Contains("公章,法人章", sealType)) || (strings.Contains("公章,法人章", sealInfo.SealType) && sealType == "合同章") {
|
|
|
+ if originFlowType != reqFlowType {
|
|
|
|
|
|
err = CheckReject(sealInfo, approvalInfo, approvalRecord, opUser, "")
|
|
|
if err != nil {
|
|
@@ -225,6 +232,9 @@ func CheckEdit(sealInfo *seal.Seal, approvalInfo *contract_approval.ContractAppr
|
|
|
func checkEdit(sealInfo *seal.Seal, updateCol []string, approvalRecordId int, content string, opUser *custom.AdminWx) {
|
|
|
_ = sealInfo.Update(updateCol)
|
|
|
|
|
|
+
|
|
|
+ _ = seal.AddSealOperationRecord(sealInfo.SealId, opUser.AdminId, approvalRecordId, "edit", opUser.RealName, "审批人修改信息", "")
|
|
|
+
|
|
|
|
|
|
sysUserMobile := ""
|
|
|
sysUser, _ := admin.GetAdminById(opUser.AdminId)
|
|
@@ -266,6 +276,13 @@ func Invalid(sealId int, opUser *custom.AdminWx, isInvalidContract bool) (err er
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+ err = seal.AddSealOperationRecord(sealInfo.SealId, opUser.AdminId, 0, "invalid", opUser.RealName, "作废审批", "")
|
|
|
+ if err != nil {
|
|
|
+ err = errors.New("新增用印日志失败")
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
if sealInfo.ContractId > 0 && isInvalidContract {
|
|
|
err = contractService.InvalidContract(sealInfo.ContractId, opUser)
|
|
@@ -431,7 +448,7 @@ func GetOpButton(sealInfo *seal.Seal, contractApprovalInfo *contract_approval.Co
|
|
|
|
|
|
|
|
|
if contractApprovalInfo.Status == "待审批" {
|
|
|
- if approvalRecord.ApproveUserId == opUser.AdminId && approvalRecord.NodeId < contractApprovalInfo.CurrNodeId && approvalRecord.NodeType != "cc" {
|
|
|
+ if approvalRecord.ApproveUserId == opUser.AdminId && approvalRecord.NodeId < contractApprovalInfo.CurrNodeId && approvalRecord.NodeType == "cc" {
|
|
|
sealInfo.Status = "处理中"
|
|
|
}
|
|
|
}
|