ReportErrorUtils.java 1.49 KB
package com.lhcredit.common.utils;

import com.lhcredit.common.utils.spring.SpringUtils;
import com.lhcredit.project.business.bCreditReport.domain.BCreditReport;
import com.lhcredit.project.business.bCreditReport.mapper.BCreditReportMapper;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;
import java.util.stream.Collectors;

@Component
@RestController
@RequestMapping("/web/reportErrorUtils")
public class ReportErrorUtils {
    private static final String splitTag =";" ;
    private static final boolean log = false;
    public static Logger logger= LoggerFactory.getLogger(ReportErrorUtils.class);

    public static void sout(String... errorMsg){
        System.out.println(Arrays.stream(errorMsg).collect(Collectors.joining(",")));
    }
    public static void saveErrorMsg(BCreditReport bAutoReport, String... errorMsg ) {
        //TODO
        try{
            BCreditReportMapper bean = SpringUtils.getBean(BCreditReportMapper.class);
            BCreditReport report = bean.selectBCreditReportById(bAutoReport.getId());
            String collect = Arrays.stream(errorMsg).collect(Collectors.joining(splitTag));
            report.setErrorMsg(report.getErrorMsg()+"!###!"+collect);
            bean.updateBCreditReport(report);
        }catch (Exception e){
            e.printStackTrace();
        }
    }
}