优化
This commit is contained in:
1 parent
d9a50e23dd
commit
4f1acaa451
25 files changed
+1265
-335
No files matched your search
@@ -189,14 +189,14 @@ func crmContractStatusText(s int8) string {
|
||||
|
||||
// writeOverdueStatusLog 逾期联动自动改状态时写入 CRM 操作日志。
|
||||
// 自动置「异常」与人工流转同一口径:日志里必须写明原因,操作者记为「系统自动」,便于事后追溯。
|
||||
// relatedType=3 与控制器层一致(项目 / 合同的操作日志同属该分类)。
|
||||
func writeOverdueStatusLog(tenantID string, relatedID uint64, content string, now time.Time) {
|
||||
// relatedType: 3=项目 6=合同(合同已独立分配 type=6,与项目解耦避免日志串数据)。
|
||||
func writeOverdueStatusLog(tenantID string, relatedType int8, relatedID uint64, content string, now time.Time) {
|
||||
if models.Orm == nil || relatedID == 0 {
|
||||
return
|
||||
}
|
||||
log := models.TenantCrmOperateLog{
|
||||
TenantID: tenantID,
|
||||
RelatedType: 3,
|
||||
RelatedType: relatedType,
|
||||
RelatedID: relatedID,
|
||||
Action: "status",
|
||||
Content: content,
|
||||
@@ -228,7 +228,7 @@ func applyContractOverdue(tenantID string, contractID uint64, now time.Time) (in
|
||||
}
|
||||
contractUpdated = 1
|
||||
// 自动改异常同样写明原因,否则日志里只看到"变异常"却不知为何
|
||||
writeOverdueStatusLog(tenantID, contractID,
|
||||
writeOverdueStatusLog(tenantID, 6, contractID,
|
||||
"合同状态自动流转:"+crmContractStatusText(contract.Status)+" → 异常;异常原因:回款计划逾期未收齐", now)
|
||||
}
|
||||
// 合同关联项目联动置异常
|
||||
@@ -242,7 +242,7 @@ func applyContractOverdue(tenantID string, contractID uint64, now time.Time) (in
|
||||
Filter("id", proj.ID).Filter("tenant_id", tenantID).
|
||||
Update(map[string]interface{}{"status": int8(5), "update_time": now}); err == nil {
|
||||
projectUpdated = 1
|
||||
writeOverdueStatusLog(tenantID, proj.ID,
|
||||
writeOverdueStatusLog(tenantID, 3, proj.ID,
|
||||
"项目状态自动流转:"+crmProjectStatusText(proj.Status)+" → 异常;异常原因:关联合同「"+
|
||||
contract.ContractName+"」回款计划逾期未收齐", now)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user