internal override List <EsFieldModifyLog> GetContents(AuditLogCreateRequest createRequest)
        {
            var contents = new List <EsFieldModifyLog>();
            var oldForm  = JsonConvert.DeserializeObject <ContractForm>(createRequest.OldForm);
            var newForm  = JsonConvert.DeserializeObject <ContractForm>(createRequest.NewForm);

            if (!string.Equals(oldForm.Name, newForm.Name))
            {
                contents.Add(new EsFieldModifyLog {
                    field = "Name", valueAfter = newForm.Name, valueBefore = oldForm.Name
                });
            }
            if (!string.Equals(oldForm.BeginDate, newForm.BeginDate))
            {
                contents.Add(new EsFieldModifyLog {
                    field = "BeginDate", valueAfter = newForm.BeginDate, valueBefore = oldForm.BeginDate
                });
            }
            if (!string.Equals(oldForm.EndDate, newForm.EndDate))
            {
                contents.Add(new EsFieldModifyLog {
                    field = "EndDate", valueAfter = newForm.EndDate, valueBefore = oldForm.EndDate
                });
            }

            return(contents);
        }
Example #2
0
        private string GetForm(AuditLogCreateRequest createRequest)
        {
            var logType  = createRequest.LogType.ToLower();
            var instance = LogServiceFactory.GetLogInstance(logType);

            return(JsonConvert.SerializeObject(instance.GetElasticSearchRequest(createRequest)));
        }
Example #3
0
 public AuditLog GetElasticSearchRequest(AuditLogCreateRequest createRequest)
 {
     return(new AuditLog
     {
         refId = createRequest.RefId,
         logType = createRequest.LogType,
         modifiedBy = 382388,
         deptName = "OB部門",
         modifiedByName = "OB管理者",
         modifiedDate = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"),
         content = GetContents(createRequest).ToArray()
     });
 }
Example #4
0
 public Task <string> Post([FromBody] AuditLogCreateRequest createRequest)
 {
     return(_service.Create(createRequest));
 }
Example #5
0
 internal abstract List <EsFieldModifyLog> GetContents(AuditLogCreateRequest createRequest);
Example #6
0
 public async Task <string> Create(AuditLogCreateRequest createRequest)
 {
     return(await SendCreateAuditLog(GetForm(createRequest)));
 }