weaver-hrm-salary/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java

74 lines
2.8 KiB
Java
Raw Normal View History

2022-08-11 10:27:15 +08:00
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;
2022-08-11 10:27:15 +08:00
/**
* 薪酬系统配置类
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @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;
}
2022-08-24 20:00:57 +08:00
@Override
public SalarySysConfPO getOneByCode(String code) {
return getSalarySysConfMapper().getOneByCode(code);
}
@Override
public List<SalarySysConfPO> listSome(SalarySysConfPO po) {
return getSalarySysConfMapper().listSome(po);
}
2022-08-11 10:27:15 +08:00
}