
package com.lideeyunji.core.framework.enhance.example.report.xtsy;

import cn.hutool.core.date.DateUtil;
import com.lideeyunji.core.framework.config.aspect.enhancereport.model.EnhanceReportContext;
import com.lideeyunji.core.framework.config.aspect.enhancereport.plugin.ReportAfterAdvicePlugin;
import com.lideeyunji.core.framework.utils.Func;
import com.lideeyunji.tool.framework.yunji.utils.lideeYunJiUtils;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * 系统首页-数据会员-销售额
 */
@Component("exampleMemberSaleReportEnhance")
public class ExampleMemberSaleReportEnhance implements ReportAfterAdvicePlugin {

    @Override
    public void execute(EnhanceReportContext enhanceContext) {
        List<Map<String, Object>> records = enhanceContext.getResult().getRecords();
        if (Func.isEmpty(records)) {
            return;
        }
        records.forEach(item -> item.put("sj", DateUtil.dayOfMonth(lideeYunJiUtils.getMap2DateTime(item, "sj")) + "日"));
    }
}
