package com.hzya.frame.sysnew.messageManageLogDetail.service.impl;

import com.hzya.frame.basedao.service.impl.BaseService;
import com.hzya.frame.sysnew.messageManageLog.entity.SysMessageManageLogEntity;
import com.hzya.frame.sysnew.messageManageLogDetail.dao.ISysMessageManageLogDetailDao;
import com.hzya.frame.sysnew.messageManageLogDetail.entity.SysMessageManageLogDetailEntity;
import com.hzya.frame.sysnew.messageManageLogDetail.service.ISysMessageManageLogDetailService;
import com.hzya.frame.uuid.UUIDUtils;
import com.hzya.frame.web.entity.BaseResult;
import com.hzya.frame.web.entity.JsonResultEntity;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;

/**
 *
 * @content 消息管理日志明细(SysMessageManageLog)表服务实现类
 * @Param
 * @Return
 * @Author hecan
 * @Date 2024/3/6 16:16
 * **/
@Service(value="sysMessageManageLogDetailServiceImpl")
public class SysMessageManageLogDetailServiceImpl extends BaseService<SysMessageManageLogDetailEntity, String> implements ISysMessageManageLogDetailService {
    private Logger logger = LogManager.getLogger(SysMessageManageLogDetailServiceImpl.class);
  @Resource
  private ISysMessageManageLogDetailDao sysMessageManageLogDetailDao;
   /**
    *
    * @content 保存消息日志明细
    * @Param
    * @Return
    * @Author hecan
    * @Date 2024/3/6 16:23
    * **/
    @Override
    public JsonResultEntity saveSysMessageManageLogDetail(SysMessageManageLogEntity sysMessageManageLogEntity) {
            logger.info("=============开始保存ESB消息日志明细数据===============");
            if(sysMessageManageLogEntity==null){
                return BaseResult.getFailureMessageEntity("ESB消息日志为null");
            }else {
                SysMessageManageLogDetailEntity sysMessageManageLogDetailEntity = new SysMessageManageLogDetailEntity();
                sysMessageManageLogDetailEntity.setReturnData(sysMessageManageLogEntity.getReturnData());
                sysMessageManageLogDetailEntity.setSourceData(sysMessageManageLogEntity.getSourceData());
                sysMessageManageLogDetailEntity.setTargetData(sysMessageManageLogEntity.getTargetData());
                sysMessageManageLogDetailEntity.setCreate_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443");
                sysMessageManageLogDetailEntity.setModify_user_id("c796fd9ba4c9f5ff3cc2fa41a040e443");
                sysMessageManageLogDetailEntity.setCreate_time(new Date());
                sysMessageManageLogDetailEntity.setModify_time(new Date());
                sysMessageManageLogDetailEntity.setSts("Y");
                sysMessageManageLogDetailEntity.setId(UUIDUtils.getUUID());
                sysMessageManageLogDetailEntity.setMessageManageId(sysMessageManageLogEntity.getId());
                sysMessageManageLogDetailDao.save(sysMessageManageLogDetailEntity);
                logger.info("=============保存ESB消息日志明细数据结束===============");
                return BaseResult.getSuccessMessageEntity("保存成功");
            }
    }
}
