同步人员范围

This commit is contained in:
钱涛 2022-11-22 15:53:05 +08:00
parent 264edf1bf2
commit 1307f485eb
3 changed files with 28 additions and 26 deletions

View File

@ -68,12 +68,5 @@ public interface TaxAgentManageRangeService {
*/
void deleteByTaxAgentIds(Collection<Long> taxAgentIds);
/**
* 根据分管理员的id删除管理范围
*
* @param subAdminIds 分管理员列表
*/
void deleteBySubAdmins(Collection<Long> subAdminIds);
void syncManageRange(List<Long> taxAgentIds);
void syncManageRange(List<Long> taxAgentIds,String index);
}

View File

@ -4,7 +4,6 @@ import com.cloudstore.dev.api.util.Util_DataCache;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.biz.EmployBiz;
import com.engine.salary.cache.SalaryCacheKey;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.hrm.DeptInfo;
import com.engine.salary.entity.hrm.HrmStatus;
@ -390,9 +389,9 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
Long taxAgentId = taxAgentIds.get(0);
List<DataCollectionEmployee> salaryEmployees = getEmployMapper().listAll();
List<DataCollectionEmployee> allSalaryEmployees = this.getManageRangeSalaryEmployees( taxAgentId, allRanges,salaryEmployees);
List<DataCollectionEmployee> allSalaryEmployees = this.getManageRangeSalaryEmployees(taxAgentId, allRanges, salaryEmployees);
List<DataCollectionEmployee> allSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees( taxAgentId, allSubAdminRanges,salaryEmployees);
List<DataCollectionEmployee> allSubAdminSalaryEmployees = this.getManageRangeSalaryEmployees(taxAgentId, allSubAdminRanges, salaryEmployees);
allSalaryEmployees.forEach(f -> {
allSubAdminSalaryEmployees.removeIf(a -> a.getEmployeeId().equals(f.getEmployeeId()));
});
@ -415,16 +414,6 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
getTaxAgentEmpService(user).deleteByTaxAgentIds(taxAgentIds);
}
@Override
public void deleteBySubAdmins(Collection<Long> subAdminIds) {
if (CollectionUtils.isEmpty(subAdminIds)) {
return;
}
getTaxAgentManageRangeMapper().deleteBySubAdminIds(subAdminIds);
// 删除管理范围下的所有人员
// taxAgentSubAdminEmployeeService.deleteBySubAdminIds(subAdminIds);
}
/**
* 同步处理所有人员范围
@ -530,8 +519,7 @@ public class TaxAgentManageRangeServiceImpl extends Service implements TaxAgentM
* @param taxAgentIds
*/
@Override
public void syncManageRange(List<Long> taxAgentIds) {
String index = SalaryCacheKey.TAX_AGENT_MANAGE_RANGE_SYNC + user.getUID();
public void syncManageRange(List<Long> taxAgentIds,String index) {
// 开始同步
LocalRunnable localRunnable = new LocalRunnable() {
@Override

View File

@ -364,18 +364,39 @@ public class TaxAgentWrapper extends Service {
/**
* 同步人员范围
* 同步当前人员管理的个税扣缴义务人人员范围
*
* @return
*/
public String syncRange() {
long currentEmployeeId = (long) user.getUID();
List<Long> taxAgentIds = this.getTaxAgentService(user).listAllTaxAgents(currentEmployeeId).stream().map(TaxAgentPO::getId).collect(Collectors.toList());
String index = SalaryCacheKey.TAX_AGENT_MANAGE_RANGE_SYNC + currentEmployeeId;
String index = SalaryCacheKey.TAX_AGENT_MANAGE_RANGE_SYNC + "-" + currentEmployeeId;
String syncRange = Util.null2String(Util_DataCache.getObjVal(index));
if (StringUtils.isEmpty(syncRange)) {
getTaxAgentManageRangeService(user).syncManageRange(taxAgentIds);
getTaxAgentManageRangeService(user).syncManageRange(taxAgentIds, index);
try {
TimeUnit.SECONDS.sleep(2);
} catch (InterruptedException e) {
}
} else {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(135788, "人员范围同步过于频繁,请稍后再试"));
}
return SalaryI18nUtil.getI18nLabel(93945, "同步成功");
}
/**
* 同步所有个税扣缴义务人的人员范围
*
* @return
*/
public String syncAllRange() {
String syncRange = Util.null2String(Util_DataCache.getObjVal(SalaryCacheKey.TAX_AGENT_MANAGE_RANGE_SYNC));
if (StringUtils.isEmpty(syncRange)) {
getTaxAgentManageRangeService(user).syncManageRange(null, SalaryCacheKey.TAX_AGENT_MANAGE_RANGE_SYNC);
try {
TimeUnit.SECONDS.sleep(2);
} catch (InterruptedException e) {