package com.engine.salary.sys.service.impl; import com.api.formmode.mybatis.util.SqlProxyHandle; import com.engine.core.impl.Service; import com.engine.salary.mapper.sys.SalarySysConfMapper; import com.engine.salary.sys.entity.po.SalarySysConfPO; import com.engine.salary.sys.enums.TaxDeclarationFunctionEnum; import com.engine.salary.sys.service.SalarySysConfService; import dm.jdbc.util.IdGenerator; import java.util.Date; import java.util.List; /** * 薪酬系统配置类 *
Copyright: Copyright (c) 2022
*Company: 泛微软件
* * @author qiantao * @version 1.0 **/ public class SalarySysConfServiceImpl extends Service implements SalarySysConfService { private SalarySysConfMapper getSalarySysConfMapper() { return SqlProxyHandle.getProxy(SalarySysConfMapper.class); } /** * 操作是否需要申报功能 * * @param flag 开启 0/关闭 1/重新开启 2 * @return 执行结果 */ public boolean operateTaxDeclarationFunction(TaxDeclarationFunctionEnum flag) { Date date = new Date(); SalarySysConfPO taxDeclarationFunction = getSalarySysConfMapper().getOneByCode("taxDeclarationFunction"); if (taxDeclarationFunction == null) { taxDeclarationFunction = SalarySysConfPO.builder().id(IdGenerator.generate()).confKey("taxDeclarationFunction").confValue(flag.getValue()).title(flag.getDefaultLabel()).module("taxDeclaration").orderWeight(0).createTime(date).updateTime(date).deleteType(0).build(); getSalarySysConfMapper().insertIgnoreNull(taxDeclarationFunction); } else { TaxDeclarationFunctionEnum oldFunctionEnum = TaxDeclarationFunctionEnum.parseByValue(taxDeclarationFunction.getConfValue()); //不改变 if (flag == oldFunctionEnum) { return true; } //关闭 if (flag == TaxDeclarationFunctionEnum.CLOSURE) { taxDeclarationFunction.setConfValue(flag.getValue()); taxDeclarationFunction.setTitle(flag.getDefaultLabel()); taxDeclarationFunction.setUpdateTime(new Date()); } //重启 if (flag == TaxDeclarationFunctionEnum.OPEN && oldFunctionEnum == TaxDeclarationFunctionEnum.CLOSURE) { taxDeclarationFunction.setConfValue(flag.getValue()); taxDeclarationFunction.setTitle(flag.getDefaultLabel()); taxDeclarationFunction.setUpdateTime(new Date()); } getSalarySysConfMapper().updateIgnoreNull(taxDeclarationFunction); } return true; } @Override public SalarySysConfPO getOneByCode(String code) { return getSalarySysConfMapper().getOneByCode(code); } @Override public List