package com.engine.salary.entity.siarchives.bo; import com.engine.salary.entity.siarchives.dto.InsuranceArchivesFundSchemeDTO; import com.engine.salary.entity.siarchives.dto.InsuranceArchivesOtherSchemeDTO; import com.engine.salary.entity.siarchives.dto.InsuranceArchivesSocialSchemeDTO; import com.engine.salary.entity.siarchives.po.InsuranceArchivesFundSchemePO; import com.engine.salary.entity.siarchives.po.InsuranceArchivesOtherSchemePO; import com.engine.salary.entity.siarchives.po.InsuranceArchivesSocialSchemePO; import com.engine.salary.enums.sicategory.UndertakerEnum; import com.engine.salary.enums.sicategory.WelfareTypeEnum; import com.engine.salary.util.SalaryEnumUtil; import java.util.Objects; /** * @Author weaver_cl * @Description: TODO * @Date 2022/3/15 * @Version V1.0 **/ public class InsuranceArchivesBO { public static InsuranceArchivesSocialSchemeDTO convertSocialPOtoDTO(InsuranceArchivesSocialSchemePO po, Long employeeId) { if (Objects.isNull(po)) { return InsuranceArchivesSocialSchemeDTO.builder().build(); } return InsuranceArchivesSocialSchemeDTO.builder() .socialName(po.getSocialSchemeId() == null ? null : String.valueOf(po.getSocialSchemeId())) .welfareType(SalaryEnumUtil.enumMatchByValue(po.getWelfareType(), WelfareTypeEnum.values(), WelfareTypeEnum.class)) .id(po.getId()) .employeeId(po.getEmployeeId()) .nonPayment(po.getNonPayment()) .paymentOrganization(po.getPaymentOrganization()) .socialEndTime(po.getSocialEndTime()) .socialStartTime(po.getSocialStartTime()) .schemeAccount(po.getSocialAccount()) .schemePaymentBaseString(po.getSocialPaymentBaseString()) .underTake(SalaryEnumUtil.enumMatchByValue(po.getUnderTake(), UndertakerEnum.values(), UndertakerEnum.class)) .build(); } public static InsuranceArchivesFundSchemeDTO convertFundPOtoDTO(InsuranceArchivesFundSchemePO po, Long employeeId) { if (Objects.isNull(po)) { return InsuranceArchivesFundSchemeDTO.builder().build(); } return InsuranceArchivesFundSchemeDTO.builder() .id(po.getId()) .employeeId(po.getEmployeeId()) .fundAccount(po.getFundAccount()) .fundEndTime(po.getFundEndTime()) .fundSchemeId(po.getFundSchemeId()) .paymentOrganization(po.getPaymentOrganization()) .fundPaymentBaseString(po.getFundPaymentBaseString()) .fundStartTime(po.getFundStartTime()) .supplementFundAccount(po.getSupplementFundAccount()) .nonPayment(po.getNonPayment()) .underTake(SalaryEnumUtil.enumMatchByValue(po.getUnderTake(), UndertakerEnum.values(), UndertakerEnum.class)) .welfareType(SalaryEnumUtil.enumMatchByValue(po.getWelfareType(), WelfareTypeEnum.values(), WelfareTypeEnum.class)) .build(); } public static InsuranceArchivesOtherSchemeDTO convertOtherPOtoDTO(InsuranceArchivesOtherSchemePO po, Long employeeId) { if (Objects.isNull(po)) { return InsuranceArchivesOtherSchemeDTO.builder().build(); } return InsuranceArchivesOtherSchemeDTO.builder() .id(po.getId()) .employeeId(po.getEmployeeId()) .underTake(SalaryEnumUtil.enumMatchByValue(po.getUnderTake(), UndertakerEnum.values(), UndertakerEnum.class)) .nonPayment(po.getNonPayment()) .otherName(po.getOtherSchemeId() == null ? null : String.valueOf(po.getOtherSchemeId())) .otherSchemeId(po.getOtherSchemeId()) .otherPaymentBaseString(po.getOtherPaymentBaseString()) .otherStartTime(po.getOtherStartTime()) .otherEndTime(po.getOtherEndTime()) .paymentOrganization(po.getPaymentOrganization()) .welfareType(SalaryEnumUtil.enumMatchByValue(po.getWelfareType(), WelfareTypeEnum.values(), WelfareTypeEnum.class)) .build(); } }