//package com.engine.salary.service.impl; // //import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; //import com.baomidou.mybatisplus.core.toolkit.Wrappers; //import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; //import com.baomidou.mybatisplus.extension.conditions.update.LambdaUpdateChainWrapper; //import com.engine.core.impl.Service; //import com.engine.salary.entity.salaryacct.po.SalaryAcctTaxAgentPO; //import com.engine.salary.service.SalaryAcctTaxAgentService; //import com.google.common.collect.Lists; //import com.google.common.collect.Sets; //import com.weaver.common.distribution.genid.IdGenerator; //import com.weaver.common.hr.util.Util; //import com.weaver.hrm.salary.common.YearMonthRange; //import com.weaver.hrm.salary.dao.SalaryAcctTaxAgentMapper; //import com.weaver.hrm.salary.entity.salaryacct.po.SalaryAcctEmployeePO; //import com.weaver.hrm.salary.enums.sicategory.DeleteTypeEnum; //import org.apache.commons.collections4.CollectionUtils; //import org.springframework.transaction.annotation.Transactional; // //import java.time.LocalDateTime; //import java.util.*; // ///** // * @description: // * @author: xiajun // * @modified By: xiajun // * @date: 2022/7/29 9:45 // * @version:v1.0 // */ //public class SalaryAcctTaxAgentServiceImpl extends Service implements SalaryAcctTaxAgentService { // // private SalaryAcctTaxAgentMapper salaryAcctTaxAgentMapper; // // @Override // public List listBySalaryAcctRecordIds(Collection salaryAcctRecordIds, String tenantKey) { // if (CollectionUtils.isEmpty(salaryAcctRecordIds)) { // return Collections.emptyList(); // } // return new LambdaQueryChainWrapper<>(salaryAcctTaxAgentMapper) // .eq(SalaryAcctTaxAgentPO::getTenantKey, tenantKey) // .eq(SalaryAcctTaxAgentPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) // .in(SalaryAcctTaxAgentPO::getSalaryAcctRecordId, salaryAcctRecordIds) // .list(); // } // // @Override // public List listByTaxCycleRange(YearMonthRange taxCycleRange, String tenantKey) { // LambdaQueryWrapper queryWrapper = Wrappers.lambdaQuery(); // queryWrapper.eq(SalaryAcctTaxAgentPO::getTenantKey, tenantKey); // queryWrapper.eq(SalaryAcctTaxAgentPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()); // if (Objects.nonNull(taxCycleRange.getStartMonth())) { // queryWrapper.ge(SalaryAcctTaxAgentPO::getTaxCycle, taxCycleRange.getStartMonth().toString()); // } // if (Objects.nonNull(taxCycleRange.getEndMonth())) { // queryWrapper.le(SalaryAcctTaxAgentPO::getTaxCycle, taxCycleRange.getEndMonth().toString()); // } // return salaryAcctTaxAgentMapper.selectList(queryWrapper); // } // // @Override // public List initBySalaryAcctEmployees(List salaryAcctEmployees, Long employeeId, String tenantKey) { // if (CollectionUtils.isEmpty(salaryAcctEmployees)) { // return Collections.emptyList(); // } // LocalDateTime now = LocalDateTime.now(); // Set keySet = Sets.newHashSet(); // List salaryAcctTaxAgents = Lists.newArrayList(); // for (SalaryAcctEmployeePO salaryAcctEmployee : salaryAcctEmployees) { // String key = salaryAcctEmployee.getTaxAgentId() + "-" + salaryAcctEmployee.getTaxCycle() + "-" + salaryAcctEmployee.getIncomeCategory(); // if (!keySet.contains(key)) { // keySet.add(key); // SalaryAcctTaxAgentPO salaryAcctTaxAgent = new SalaryAcctTaxAgentPO() // .setId(IdGenerator.generate()) // .setSalaryAcctRecordId(salaryAcctEmployee.getSalaryAcctRecordId()) // .setIncomeCategory(Util.getIntValue(salaryAcctEmployee.getIncomeCategory())) // .setTaxAgentId(salaryAcctEmployee.getTaxAgentId()) // .setSalaryMonth(salaryAcctEmployee.getSalaryMonth()) // .setTaxCycle(salaryAcctEmployee.getTaxCycle()) // .setCreator(employeeId) // .setTenantKey(tenantKey) // .setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue()) // .setCreateTime(now) // .setUpdateTime(now); // salaryAcctTaxAgents.add(salaryAcctTaxAgent); // } // } // return salaryAcctTaxAgents; // } // // @Override // @Transactional(rollbackFor = Exception.class) // public void batchSave(List salaryAcctTaxAgents, String tenantKey) { // if (CollectionUtils.isNotEmpty(salaryAcctTaxAgents)) { // saveBatch(salaryAcctTaxAgents); // } // } // // @Override // public void deleteBySalaryAcctRecordIds(Collection salaryAcctRecordIds, String tenantKey) { // if (CollectionUtils.isEmpty(salaryAcctRecordIds)) { // return; // } // new LambdaUpdateChainWrapper<>(salaryAcctTaxAgentMapper) // .eq(SalaryAcctTaxAgentPO::getTenantKey, tenantKey) // .eq(SalaryAcctTaxAgentPO::getDeleteType, DeleteTypeEnum.NOT_DELETED.getValue()) // .in(SalaryAcctTaxAgentPO::getSalaryAcctRecordId, salaryAcctRecordIds) // .set(SalaryAcctTaxAgentPO::getDeleteType, DeleteTypeEnum.DELETED.getValue()) // .set(SalaryAcctTaxAgentPO::getUpdateTime, LocalDateTime.now()) // .update(); // } //}