package com.engine.salary.service.impl;

import com.api.browser.bean.SearchConditionItem;
import com.api.browser.bean.SearchConditionOption;
import com.api.browser.util.ConditionFactory;
import com.api.browser.util.ConditionType;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.config.SalaryElogConfig;
import com.engine.hrmelog.entity.dto.LoggerContext;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
import com.engine.salary.entity.sicategory.bo.ICategoryBO;
import com.engine.salary.entity.sicategory.dto.ICategoryDTO;
import com.engine.salary.entity.sicategory.dto.ICategoryFormDTO;
import com.engine.salary.entity.sicategory.dto.ICategoryListDTO;
import com.engine.salary.entity.sicategory.po.ICategoryPO;
import com.engine.salary.entity.sischeme.param.InsuranceSchemeParam;
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import com.engine.salary.enums.OperateTypeEnum;
import com.engine.salary.enums.sicategory.DataTypeEnum;
import com.engine.salary.enums.sicategory.IsPaymentEnum;
import com.engine.salary.enums.sicategory.PaymentScopeEnum;
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper;
import com.engine.salary.mapper.sicategory.ICategoryMapper;
import com.engine.salary.service.RecordsBuildService;
import com.engine.salary.service.SICategoryService;
import com.engine.salary.service.SISchemeService;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryEnumUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import com.mzlion.core.utils.BeanUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.hrm.User;

import java.util.*;
import java.util.stream.Collectors;

/**
 * @Author weaver_cl
 * @Description:
 * @Date 2022/3/9
 * @Version V1.0
 **/
public class SICategoryServiceImpl extends Service implements SICategoryService {

    private ICategoryMapper getICategoryMapper() {
        return MapperProxyFactory.getProxy(ICategoryMapper.class);
    }

    private InsuranceAccountDetailMapper getInsuranceAccountDetailMapper() {
        return MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class);
    }

    public RecordsBuildService getRecordsBuildService(User user) {
        return ServiceUtil.getService(RecordsBuildServiceImpl.class, user);
    }

    private EncryptUtil encryptUtil = new EncryptUtil();

    private SISchemeService getSISchemeService(User user) {
        return ServiceUtil.getService(SISchemeServiceImpl.class,user);
    }

    @Override
    public Map<String, Object> getForm(Map<String, Object> params) {
//        return commandExecutor.execute(new SICategoryGetFormCmd(params,user));
        Map<String, Object> apidatas = new HashMap<>(16);
        Long id = (Long) params.get("id");
//        ICategoryFormDTO form = siCategoryBiz.getForm(id);
        ICategoryFormDTO form = getForm(id);
        apidatas.put("form",form);
        ConditionFactory conditionFactory = new ConditionFactory(user);
        Map<String, SearchConditionItem> items = new HashMap<>();

        SearchConditionItem input = conditionFactory.createCondition(ConditionType.INPUT,0, "insuranceName");
        input.setColSpan(2);//定义一行显示条件数，默认值为2,当值为1时标识该条件单独占一行
        input.setFieldcol(12);	//条件输入框所占宽度，默认值18
        input.setViewAttr(3);  //	 编辑权限  1：只读，2：可编辑， 3：必填   默认2
        input.setLength(10);    //  设置输入长度
        input.setLabel(SalaryI18nUtil.getI18nLabel(0,"福利名称")); //设置文本值  这个将覆盖多语言标签的值
        input.setRules("required"); //设置字段填入规则

        items.put("insuranceName",input);

        SearchConditionItem radio = conditionFactory.createCondition(ConditionType.RADIO,0,"welfareType");
        List<SearchConditionOption> radioOptions = new ArrayList <>();
        radioOptions.add(new SearchConditionOption("SOCIAL_SECURITY",SalaryI18nUtil.getI18nLabel(0,"社保"),true));
        radioOptions.add(new SearchConditionOption("ACCUMULATION_FUND",SalaryI18nUtil.getI18nLabel(0,"公积金")));
        radioOptions.add(new SearchConditionOption("OTHER",SalaryI18nUtil.getI18nLabel(0,"企业年金及其他福利")));
        radio.setColSpan(2);
        radio.setFieldcol(12);
        radio.setLabelcol(6);
        radio.setViewAttr(3);
        radio.setIsQuickSearch(false);
        radio.setOptions(radioOptions);
        radio.setLabel(SalaryI18nUtil.getI18nLabel(0,"类型"));
        radio.setRules("required");
        items.put("welfareType",radio);

        SearchConditionItem checkbox = conditionFactory.createCondition(ConditionType.CHECKBOX,0,"paymentScope");
        List<SearchConditionOption> checkOptions = new ArrayList <>();
        checkOptions.add(new SearchConditionOption("SCOPE_COMPANY",SalaryI18nUtil.getI18nLabel(0,"公司")));
        checkOptions.add(new SearchConditionOption("SCOPE_PERSON",SalaryI18nUtil.getI18nLabel(0,"个人")));
        checkbox.setColSpan(2);
        checkbox.setFieldcol(12);
        checkbox.setLabelcol(6);
        checkbox.setViewAttr(3);
        checkbox.setIsQuickSearch(false);
        checkbox.setOptions(checkOptions);
        checkbox.setLabel(SalaryI18nUtil.getI18nLabel(0,"缴纳对象"));
        checkbox.setRules("required");
        items.put("paymentScope",checkbox);

        apidatas.put("item",items);
        //记录操作日志
        LoggerContext loggerContext = new LoggerContext<>();
        loggerContext.setUser(user);
        loggerContext.setTargetId(String.valueOf(form.getId()));
        loggerContext.setTargetName(form.getInsuranceName());
        loggerContext.setOperateType(OperateTypeEnum.READ.getValue());
        loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "查看自定义福利明细"));
        loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "查看自定义福利明细") + ": " + form.getInsuranceName());
        SalaryElogConfig.siSchemeLoggerTemplate.write(loggerContext);
        return apidatas;
    }

    @Override
    public Map<String, Object> insert(Map<String, Object> params) {
//        return commandExecutor.execute(new SICategoryInsertCmd(params,user));
        Map<String,Object> apidatas = new HashMap<>(16);
        ICategoryFormDTO iCategoryFormDTO = (ICategoryFormDTO)params.get("iCategoryFormDTO");
//        siCategoryBiz.save(iCategoryFormDTO,(long) user.getUID());
        save(iCategoryFormDTO,(long) user.getUID());
        return apidatas;
    }

    @Override
    public Map<String, Object> update(Map<String, Object> params) {
//        return commandExecutor.execute(new SICategoryUpdateCmd(params,user));
        Map<String, Object> apidatas = new HashMap<String, Object>(16);
        ICategoryFormDTO iCategoryFormDTO = (ICategoryFormDTO) params.get("iCategoryFormDTO");
//        siCategoryBiz.update(iCategoryFormDTO, (long) user.getUID());
        update(iCategoryFormDTO);
        return apidatas;
    }

    @Override
    public Map<String, Object> updateStatusById(Map<String, Object> params) {
//        return commandExecutor.execute(new SICategoryUpdateStatusByIdCmd(params,user));
        Map<String, Object> apidatas = new HashMap<String, Object>(16);
        Long id = (Long) params.get("id");
        Integer isUse = (Integer) params.get("isUse");
//        siCategoryBiz.updateStatusById(id, isUse,(long) user.getUID());
        updateStatusById(id, isUse);
        return apidatas;
    }

    @Override
    public PageInfo<ICategoryListDTO> listPage(InsuranceSchemeParam queryParam) {
        Integer welfareType = null;
        if(Objects.nonNull(queryParam.getWelfareTypeEnum())){
            welfareType = queryParam.getWelfareTypeEnum().getValue();
        }
        List<ICategoryListDTO> list = getICategoryMapper().listCustomInsurance(welfareType);
        list.stream().forEach(DTO -> {
            DTO.setWelfareTypeSpan( buildWelfareType(new Integer(DTO.getWelfareType())).getDefaultLabel() ); ;
            DTO.setPaymentScopeSpan( buildPaymentScope( DTO.getPaymentScope()));
        });
        PageInfo<ICategoryListDTO> page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), list, ICategoryListDTO.class);
        return page;
    }

    public WelfareTypeEnum buildWelfareType(Integer value) {
        return SalaryEnumUtil.enumMatchByValue(value, WelfareTypeEnum.values(), WelfareTypeEnum.class);
    }



//    @Override
//    public PageInfo<ICategoryListDTO> listPage(WelfareTypeEnum welfareType) {
//        getICategoryMapper().listByWelfareType(welfareType.getValue(),0);
//        Page<InsuranceCategoryListDTO> insuranceCategoryListDTOPage = new Page<>(page.getCurrent(), page.getSize(), page.getTotal(), page.isSearchCount());
//        insuranceCategoryListDTOPage.setRecords(InsuranceCategoryBO.convertToCustomCategoryList(page.getRecords(), employeeId, tenantKey));
//        return insuranceCategoryListDTOPage;
//    }

    @Override
    public Map<String, String> categoryIdNameMap() {
        //系统福利类型
        Map<Long, String> systemAndCustomMap = getICategoryMapper().listAll().stream()
                .collect(Collectors.toMap(ICategoryPO::getId, ICategoryPO::getInsuranceName));
        HashMap<Long, String> total = new HashMap<>();
        if (MapUtils.isNotEmpty(systemAndCustomMap)) {
            total.putAll(systemAndCustomMap);
        }

        HashMap<String, String> result = new HashMap<>();
        total.forEach((k, v) -> {
            result.put(String.valueOf(k), v);
        });

        return result;
    }

    @Override
    public ICategoryDTO getByID(Long customCategoryId) {
        ICategoryPO categoryPO = getICategoryMapper().getByIdAndDataType(customCategoryId, DataTypeEnum.CUSTOM.getValue());
        ICategoryDTO categoryDTO = convertICategoryPO2DTO(categoryPO);
        return categoryDTO;
    }

    @Override
    public Map<String, Object> updateCategoryName(ICategoryFormDTO iCategoryFormDTO) {
        ICategoryPO categoryPO = getICategoryMapper().getByIdAndDataType(iCategoryFormDTO.getId(), DataTypeEnum.CUSTOM.getValue());
        if(categoryPO == null){
            throw new SalaryRunTimeException("自定义福利不存在");
        }
        // 判断是否启用
        Integer isUse = categoryPO.getIsUse();
        if(isUse == 1){
            throw new SalaryRunTimeException("编辑失败，请先关闭启用按钮！");
        }
        // 判断福利名称是否重复
        List<ICategoryPO> iCategoryPOS = getICategoryMapper().listByName(iCategoryFormDTO.getInsuranceName());
        if(CollectionUtils.isNotEmpty(iCategoryPOS)){
            throw new SalaryRunTimeException("福利名称不能重复");
        }
        ICategoryPO iCategoryPO = ICategoryPO.builder().id(iCategoryFormDTO.getId()).insuranceName(iCategoryFormDTO.getInsuranceName()).build();
        getICategoryMapper().updateNameById(iCategoryPO);
        return null;
    }

    @Override
    public Map<String, Object> updateCategoryNameAndPayScope(ICategoryFormDTO iCategoryFormDTO) {
        ICategoryPO categoryPO = getICategoryMapper().getByIdAndDataType(iCategoryFormDTO.getId(), DataTypeEnum.CUSTOM.getValue());
        if(categoryPO == null){
            throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "自定义福利不存在"));
        }
        // 判断是否启用
        Integer isUse = categoryPO.getIsUse();
        if(isUse == 1){
            throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "编辑失败，请先关闭启用按钮！"));
        }
        // 判断福利名称是否重复
        List<ICategoryPO> iCategoryPOS = getICategoryMapper().listByName(iCategoryFormDTO.getInsuranceName());
        iCategoryPOS = iCategoryPOS.stream().filter(f -> !f.getId().equals(iCategoryFormDTO.getId())).collect(Collectors.toList());
        if(CollectionUtils.isNotEmpty(iCategoryPOS)){
            throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "福利名称不能重复"));
        }
        ICategoryPO iCategoryPO = ICategoryPO.builder().id(iCategoryFormDTO.getId()).insuranceName(iCategoryFormDTO.getInsuranceName())
                .paymentScope(SalaryEnumUtil.enumArrToString(iCategoryFormDTO.getPaymentScope()))
                .updateTime(new Date())
                .build();
        getICategoryMapper().updateNameAndPayScopeById(iCategoryPO);
        //记录操作日志
        LoggerContext<ICategoryPO> loggerContext = new LoggerContext<>();
        loggerContext.setUser(user);
        loggerContext.setTargetId(String.valueOf(iCategoryPO.getId()));
        loggerContext.setTargetName(iCategoryPO.getInsuranceName());
        loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue());
        loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "更新自定义福利信息"));
        loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "更新自定义福利信息"));
        loggerContext.setNewValues(iCategoryPO);
        SalaryElogConfig.siCategoryLoggerTemplate.write(loggerContext);
        return null;
    }

    @Override
    public Map<String, Object> deleteCustomCategory(ICategoryFormDTO iCategoryFormDTO) {
        ICategoryPO categoryPO = getICategoryMapper().getByIdAndDataType(iCategoryFormDTO.getId(), DataTypeEnum.CUSTOM.getValue());
        if(categoryPO == null){
            throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "自定义福利不存在"));
        }
        // 判断是否启用
        Integer isUse = categoryPO.getIsUse();
        if(isUse == 1){
            throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "删除失败，请先关闭启用按钮！"));
        }
        // 判断自定义福利项是否存在核算数据
        //获取所有福利核算数据
        List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = getInsuranceAccountDetailMapper().listAll();
        encryptUtil.decryptList(insuranceAccountDetailPOS, InsuranceAccountDetailPO.class);
        //数据组装
        List<Map<String, Object>> records = getRecordsBuildService(user).buildCommonRecords(insuranceAccountDetailPOS, null);
        String welfareTypeName = "";
        switch (categoryPO.getWelfareType()) {
            case 1:
                welfareTypeName = "social";
                break;
            case 2:
                welfareTypeName = "fund";
                break;
            case 3:
                welfareTypeName = "other";
                break;
            default:
                throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(542456, "福利类型不在"));
        }
        String welfareNameStart = categoryPO.getId() + welfareTypeName;
        //校验福利项是否存在核算记录
        records.forEach(f -> {
            if (!Objects.isNull(f.get(welfareNameStart + "Per"))
                    || !Objects.isNull(f.get(welfareNameStart + "Com"))
                    || !Objects.isNull(f.get(welfareNameStart + "Base"))) {
                throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "删除失败，已存在福利核算记录"));
            }
        });

        //删除自定义福利项
        categoryPO.setUpdateTime(new Date());
        getICategoryMapper().deleteCustomCategoryById(categoryPO);
        //记录操作日志
        LoggerContext<ICategoryPO> loggerContext = new LoggerContext<>();
        loggerContext.setUser(user);
        loggerContext.setTargetId(String.valueOf(categoryPO.getId()));
        loggerContext.setTargetName(categoryPO.getInsuranceName());
        loggerContext.setOperateType(OperateTypeEnum.DELETE.getValue());
        loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "新建自定义福利项"));
        loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "新建自定义福利项"));
//        loggerContext.setNewValues(categoryPO);
        SalaryElogConfig.siCategoryLoggerTemplate.write(loggerContext);
        return null;
    }

    private ICategoryDTO convertICategoryPO2DTO(ICategoryPO iCategoryPO){
        return ICategoryDTO.builder().id(iCategoryPO.getId()).insuranceName(iCategoryPO.getInsuranceName())
                .welfareType(iCategoryPO.getWelfareType())
                .welfareTypeSpan(WelfareTypeEnum.getDefaultLabelByValue(iCategoryPO.getWelfareType()))
                .paymentScope(iCategoryPO.getPaymentScope())
                .paymentScopeSpan(buildPaymentScope(iCategoryPO.getPaymentScope()))
                .isUse(iCategoryPO.getIsUse()).build();
    }

    private String buildPaymentScope(String paymentScope) {
        List<String> paymentScopes = Arrays.asList(paymentScope.split(","));
        List<String> collect = paymentScopes.stream().map(scope -> PaymentScopeEnum.getDefaultLabelByValue(SalaryEntityUtil.string2Integer(scope))).collect(Collectors.toList());
        return StringUtils.join(collect, ",");
    }
    /*****以下代码为SICategoryBiz中逻辑迁移，旨在减少Biz类的使用*****/

    /**
     * 自定义福利表单
     * id == null ? 新建表单 ： 查看已有数据内容表单
     * @param id         自定义福利主键
     * @return 表单
     */
    public ICategoryFormDTO getForm(Long id) {
        if (id != null) {
            ICategoryPO iCategoryPO = getICategoryPOByID(id);
            ICategoryFormDTO iCategoryFormDTO = new ICategoryFormDTO();
            if (Objects.isNull(iCategoryPO)) {
                throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"数据不存在"));
            }
            BeanUtils.copyProperties(iCategoryPO,iCategoryFormDTO);
            iCategoryFormDTO.setWelfareType(SalaryEnumUtil.enumMatchByValue(iCategoryPO.getWelfareType(), WelfareTypeEnum.values(), WelfareTypeEnum.class));
            iCategoryFormDTO.setPaymentScope(SalaryEnumUtil.stringToEnums(iCategoryPO.getPaymentScope(), ","));
            return iCategoryFormDTO;
        }

        return ICategoryFormDTO.builder().welfareType(WelfareTypeEnum.SOCIAL_SECURITY).build();
    }

    /**
     * 根据id获取
     * @param id
     * @return
     */
    @Override
    public ICategoryPO getICategoryPOByID(Long id) {

        ICategoryPO iCategoryPO = getICategoryMapper().getById(id);
        return  iCategoryPO;

    }

    /**
     * 根据名称获取
     * @param insuranceName
     * @return
     */
    @Override
    public List<ICategoryPO> listByName(String insuranceName) {

        List<ICategoryPO> iCategoryPOS = getICategoryMapper().listByName(insuranceName);
        return iCategoryPOS;

    }

    /**
     * 保存
     * @param iCategoryFormDTO
     * @param employeeId DataTypeEnum.SYSTEM.getValue()
     */
    public void save(ICategoryFormDTO iCategoryFormDTO, long employeeId) {
        iCategoryFormDTO.setInsuranceName(StringUtils.trim(iCategoryFormDTO.getInsuranceName()));
        List<ICategoryPO> iCategoryPOS = listByName(iCategoryFormDTO.getInsuranceName());
        if (CollectionUtils.isNotEmpty(iCategoryPOS)) {
            throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"福利名称不允许重复"));
        }
        ICategoryPO iCategoryPO = ICategoryBO.convertToInsuranceCategoryPO(iCategoryFormDTO, employeeId);
        getICategoryMapper().insert(iCategoryPO);
        //记录操作日志
        LoggerContext<ICategoryPO> loggerContext = new LoggerContext<>();
        loggerContext.setUser(user);
        loggerContext.setTargetId(String.valueOf(iCategoryPO.getId()));
        loggerContext.setTargetName(iCategoryPO.getInsuranceName());
        loggerContext.setOperateType(OperateTypeEnum.ADD.getValue());
        loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "新建自定义福利项"));
        loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "新建自定义福利项"));
        loggerContext.setNewValues(iCategoryPO);
        SalaryElogConfig.siCategoryLoggerTemplate.write(loggerContext);
    }

    /**
     * 更新
     * @param iCategoryFormDTO
     */
    public void update(ICategoryFormDTO iCategoryFormDTO) {
        if (iCategoryFormDTO.getId() == null) {
            throw new SalaryRunTimeException("id is required");
        }
        ICategoryPO iCategoryPO = getICategoryPOByID(iCategoryFormDTO.getId());
        if (Objects.isNull(iCategoryPO)) {
            throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"数据不存在"));
        }
        List<ICategoryPO> iCategoryPOS = listByName(iCategoryFormDTO.getInsuranceName());
        if (CollectionUtils.isNotEmpty(iCategoryPOS)) {
            throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"福利名称不允许重复"));
        }
        iCategoryPO.setInsuranceName(iCategoryFormDTO.getInsuranceName());
//            iCategoryPO.setWelfareType(iCategoryFormDTO.getWelfareType().getValue());
//            iCategoryPO.setPaymentScope(SalaryEnumUtil.enumArrToString(iCategoryFormDTO.getPaymentScope()));
        iCategoryPO.setUpdateTime(new Date());

        getICategoryMapper().update(iCategoryPO);

    }

    /**
     * 更新状态
     * @param id
     * @param isUse
     */
    public void updateStatusById(Long id, Integer isUse) {

        if(id == null) {
            throw new SalaryRunTimeException("id is required");
        }
        if (isUse == null) {
            throw new SalaryRunTimeException("isUse is required");
        }
//            List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = new SISchemeBiz().queryListByInsuranceIdIsPayment(id, IsPaymentEnum.YES.getValue());
        List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = getSISchemeService(user).queryListByInsuranceIdIsPayment(id, IsPaymentEnum.YES.getValue());
        if(CollectionUtils.isNotEmpty(insuranceSchemeDetailPOS) && isUse == 0) {
            throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"该福利开启缴费，不可删除(或停用)"));
        }
        ICategoryPO iCategoryPO = getICategoryPOByID(id);
        if (Objects.isNull(iCategoryPO)) {
            throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0,"数据记录不存在"));
        }
        iCategoryPO.setIsUse(isUse);
        getICategoryMapper().updateById(iCategoryPO);
        //记录操作日志
        LoggerContext<ICategoryPO> loggerContext = new LoggerContext<>();
        loggerContext.setUser(user);
        loggerContext.setTargetId(String.valueOf(iCategoryPO.getId()));
        loggerContext.setTargetName(iCategoryPO.getInsuranceName());
        loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue());
        loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "更新自定义福利状态"));
        loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "更新自定义福利状态"));
        loggerContext.setNewValues(iCategoryPO);
        SalaryElogConfig.siCategoryLoggerTemplate.write(loggerContext);
    }

    /*****以上代码为SICategoryBiz中方法逻辑迁移，旨在减少Biz类的使用*****/

}
