导入工具明细
This commit is contained in:
parent
980dc2f532
commit
673699dfb8
|
|
@ -70,4 +70,7 @@ public class SalaryCacheKey {
|
|||
public final static String SALARY_REPORT_DATA = "SALARY_REPORT_DATA_";
|
||||
|
||||
|
||||
public final static String UPLOAD_SALARY_CONFIG = "UPLOAD_SALARY_CONFIG";
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import com.engine.salary.entity.salaryarchive.param.SalaryItemAdjustBeforeParam;
|
|||
import com.engine.salary.entity.salaryarchive.param.SalaryItemAdjustRecordQueryParam;
|
||||
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO;
|
||||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.sys.entity.vo.UploadConfigResponse;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
||||
|
|
@ -161,5 +162,5 @@ public interface SalaryArchiveItemService {
|
|||
|
||||
ArchiveFieldConfig getConfig();
|
||||
|
||||
void parseConfig(ArchiveFieldConfig config);
|
||||
UploadConfigResponse.Result parseConfig(ArchiveFieldConfig config);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.engine.salary.entity.salaryitem.param.*;
|
|||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.enums.SalarySystemTypeEnum;
|
||||
import com.engine.salary.service.impl.SalaryItemServiceImpl;
|
||||
import com.engine.salary.sys.entity.vo.UploadConfigResponse;
|
||||
import com.engine.salary.util.excel.ImportExcelResponse;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
|
|
@ -154,9 +155,8 @@ public interface SalaryItemService {
|
|||
|
||||
SalaryItemAllConfig getConfig();
|
||||
|
||||
void parseConfig(SalaryItemAllConfig salaryItemConfig);
|
||||
UploadConfigResponse.Result parseConfig(SalaryItemAllConfig salaryItemConfig);
|
||||
|
||||
Long add(SalaryItemPO salaryItemPO);
|
||||
SalaryItemPO getItem(SalaryItemPO salaryItemPO);
|
||||
|
||||
List<SalaryItemExcelConfig> getConfig(SalaryItemExportParam param);
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import com.engine.salary.entity.salarysob.param.SalarySobDuplicateParam;
|
|||
import com.engine.salary.entity.salarysob.param.SalarySobListQueryParam;
|
||||
import com.engine.salary.entity.salarysob.po.SalarySobPO;
|
||||
import com.engine.salary.enums.salarysob.IncomeCategoryEnum;
|
||||
import com.engine.salary.sys.entity.vo.UploadConfigResponse;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
|
||||
import java.time.YearMonth;
|
||||
|
|
@ -160,5 +161,5 @@ public interface SalarySobService {
|
|||
|
||||
List<SalarySobConfig> getConfig(Long taxAgentId);
|
||||
|
||||
void parseConfig(Long taxAgentId, List<SalarySobConfig> salarySobConfigs);
|
||||
List<UploadConfigResponse.Result> parseConfig(Long taxAgentId, List<SalarySobConfig> salarySobConfigs);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.engine.salary.service;
|
|||
|
||||
import com.engine.salary.entity.taxagent.param.TaxAgentSaveBaseParam;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentBasePO;
|
||||
import com.engine.salary.sys.entity.vo.UploadConfigResponse;
|
||||
|
||||
/**
|
||||
* 个税扣缴义务人基础信息
|
||||
|
|
@ -37,5 +38,5 @@ public interface TaxAgentBaseService {
|
|||
|
||||
TaxAgentBasePO getConfig();
|
||||
|
||||
void parseConfig(TaxAgentBasePO config);
|
||||
UploadConfigResponse.Result parseConfig(TaxAgentBasePO config);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import com.engine.salary.entity.taxagent.po.TaxAgentEmployeePO;
|
|||
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
||||
import com.engine.salary.enums.salarysob.SalaryEmployeeStatusEnum;
|
||||
import com.engine.salary.enums.taxagent.TaxAgentRoleTypeEnum;
|
||||
import com.engine.salary.sys.entity.vo.UploadConfigResponse;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
|
||||
import java.util.Collection;
|
||||
|
|
@ -262,5 +263,5 @@ public interface TaxAgentService {
|
|||
|
||||
List<TaxAgentConfig> getConfig();
|
||||
|
||||
void parseConfig(List<TaxAgentConfig> configs);
|
||||
List<UploadConfigResponse.Result> parseConfig(List<TaxAgentConfig> configs);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.engine.salary.service.impl;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.api.formmode.mybatis.util.SqlProxyHandle;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
|
|
@ -26,6 +27,7 @@ import com.engine.salary.exception.SalaryRunTimeException;
|
|||
import com.engine.salary.mapper.archive.SalaryArchiveItemMapper;
|
||||
import com.engine.salary.mapper.salaryitem.SalaryItemMapper;
|
||||
import com.engine.salary.service.*;
|
||||
import com.engine.salary.sys.entity.vo.UploadConfigResponse;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.util.SalaryLoggerUtil;
|
||||
|
|
@ -752,18 +754,25 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi
|
|||
}
|
||||
|
||||
@Override
|
||||
public void parseConfig(ArchiveFieldConfig config) {
|
||||
public UploadConfigResponse.Result parseConfig(ArchiveFieldConfig config) {
|
||||
UploadConfigResponse.Result result = UploadConfigResponse.Result.builder()
|
||||
.message("档案字段加载完毕")
|
||||
.success(new ArrayList<>())
|
||||
.warning(new ArrayList<>())
|
||||
.error(new ArrayList<>())
|
||||
.build();
|
||||
long uid = user.getUID();
|
||||
List<SalaryItemPO> salaryItemPOList = getSalaryItemService(user).listAll();
|
||||
Map<Long, SalaryItemPO> idMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getId);
|
||||
Map<String, SalaryItemPO> nameMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getName);
|
||||
Map<String, SalaryItemPO> codeMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getCode);
|
||||
|
||||
Optional.ofNullable(config .getSalaryItems())
|
||||
.orElse(new ArrayList<>())
|
||||
.forEach(itemPO -> {
|
||||
if (nameMap.containsKey(itemPO.getName())) {
|
||||
SalaryItemPO salaryItemPO = nameMap.get(itemPO.getName());
|
||||
if (!StrUtil.equals(salaryItemPO.getCode(), itemPO.getCode())) {
|
||||
result.getWarning().add(String.format("警告,档案字段[%s]名称已存在,但项目code不一致,迁入code:%s,当前系统code:%s", itemPO.getName(), itemPO.getCode(), salaryItemPO.getCode()));
|
||||
}
|
||||
itemPO.setId(salaryItemPO.getId());
|
||||
//不许修改code
|
||||
itemPO.setCode(null);
|
||||
|
|
@ -771,6 +780,9 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi
|
|||
getSalaryItemMapper().updateIgnoreNull(itemPO);
|
||||
} else if (codeMap.containsKey(itemPO.getCode())) {
|
||||
SalaryItemPO salaryItemPO = codeMap.get(itemPO.getCode());
|
||||
if (!StrUtil.equals(salaryItemPO.getName(), itemPO.getName())) {
|
||||
result.getWarning().add(String.format("警告,档案字段[%s]code已存在,但项目code不一致,迁入名称:%s,当前系统名称:%s", itemPO.getName(), itemPO.getName(), salaryItemPO.getName()));
|
||||
}
|
||||
itemPO.setId(salaryItemPO.getId());
|
||||
//不许修改名字
|
||||
itemPO.setName(null);
|
||||
|
|
@ -780,7 +792,10 @@ public class SalaryArchiveItemServiceImpl extends Service implements SalaryArchi
|
|||
itemPO.setId(IdGenerator.generate());
|
||||
getSalaryItemMapper().insertIgnoreNull(itemPO);
|
||||
}
|
||||
result.getSuccess().add(String.format("成功,薪资项目[%s]加载成功", itemPO.getName()));
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ import com.engine.salary.enums.sicategory.SharedTypeEnum;
|
|||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.mapper.salaryitem.SalaryItemMapper;
|
||||
import com.engine.salary.service.*;
|
||||
import com.engine.salary.sys.entity.vo.UploadConfigResponse;
|
||||
import com.engine.salary.util.JsonUtil;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
|
|
@ -799,29 +800,23 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
|
|||
}
|
||||
|
||||
@Override
|
||||
public void parseConfig(SalaryItemAllConfig salaryItemConfig) {
|
||||
public UploadConfigResponse.Result parseConfig(SalaryItemAllConfig salaryItemConfig) {
|
||||
UploadConfigResponse.Result result = UploadConfigResponse.Result.builder()
|
||||
.message("薪资项目加载完毕")
|
||||
.success(new ArrayList<>())
|
||||
.warning(new ArrayList<>())
|
||||
.error(new ArrayList<>())
|
||||
.build();
|
||||
List<SalaryItemPO> salaryItemPOList = listAll();
|
||||
Map<Long, SalaryItemPO> idMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getId);
|
||||
Map<String, SalaryItemPO> nameMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getName);
|
||||
Map<String, SalaryItemPO> codeMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getCode);
|
||||
|
||||
Optional.ofNullable(salaryItemConfig.getSalaryItems())
|
||||
.orElse(new ArrayList<>())
|
||||
.forEach(itemPO -> {
|
||||
add(itemPO, idMap, nameMap, codeMap);
|
||||
add(itemPO, nameMap, codeMap, result);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long add(SalaryItemPO itemPO) {
|
||||
|
||||
List<SalaryItemPO> salaryItemPOList = listAll();
|
||||
Map<Long, SalaryItemPO> idMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getId);
|
||||
Map<String, SalaryItemPO> nameMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getName);
|
||||
Map<String, SalaryItemPO> codeMap = SalaryEntityUtil.convert2Map(salaryItemPOList, SalaryItemPO::getCode);
|
||||
|
||||
return add(itemPO, idMap, nameMap, codeMap);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -834,13 +829,16 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
|
|||
}
|
||||
|
||||
|
||||
private Long add(SalaryItemPO itemPO, Map<Long, SalaryItemPO> idMap, Map<String, SalaryItemPO> nameMap, Map<String, SalaryItemPO> codeMap) {
|
||||
private Long add(SalaryItemPO itemPO, Map<String, SalaryItemPO> nameMap, Map<String, SalaryItemPO> codeMap, UploadConfigResponse.Result result) {
|
||||
long uid = user.getUID();
|
||||
Long formulaId = getSalaryFormulaService(user).add(itemPO.getFormula());
|
||||
itemPO.setFormulaId(formulaId);
|
||||
|
||||
if (nameMap.containsKey(itemPO.getName())) {
|
||||
SalaryItemPO salaryItemPO = nameMap.get(itemPO.getName());
|
||||
if (!StrUtil.equals(salaryItemPO.getCode(), itemPO.getCode())) {
|
||||
result.getWarning().add(String.format("警告,薪资项目[%s]名称已存在,但项目code不一致,迁入code:%s,当前系统code:%s", itemPO.getName(), itemPO.getCode(), salaryItemPO.getCode()));
|
||||
}
|
||||
itemPO.setId(salaryItemPO.getId());
|
||||
//不许修改code
|
||||
itemPO.setCode(null);
|
||||
|
|
@ -848,6 +846,9 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
|
|||
getSalaryItemMapper().updateIgnoreNull(itemPO);
|
||||
} else if (codeMap.containsKey(itemPO.getCode())) {
|
||||
SalaryItemPO salaryItemPO = codeMap.get(itemPO.getCode());
|
||||
if (!StrUtil.equals(salaryItemPO.getName(), itemPO.getName())) {
|
||||
result.getWarning().add(String.format("警告,薪资项目[%s]code已存在,但项目code不一致,迁入名称:%s,当前系统名称:%s", itemPO.getName(), itemPO.getName(), salaryItemPO.getName()));
|
||||
}
|
||||
itemPO.setId(salaryItemPO.getId());
|
||||
//不许修改名字
|
||||
itemPO.setName(null);
|
||||
|
|
@ -857,6 +858,7 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
|
|||
itemPO.setId(IdGenerator.generate());
|
||||
getSalaryItemMapper().insertIgnoreNull(itemPO);
|
||||
}
|
||||
result.getSuccess().add(String.format("成功,薪资项目[%s]加载成功", itemPO.getName()));
|
||||
|
||||
return itemPO.getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ import com.engine.salary.exception.SalaryRunTimeException;
|
|||
import com.engine.salary.mapper.salarysob.SalarySobMapper;
|
||||
import com.engine.salary.mapper.taxagent.TaxAgentExtRangeMapper;
|
||||
import com.engine.salary.service.*;
|
||||
import com.engine.salary.sys.entity.vo.UploadConfigResponse;
|
||||
import com.engine.salary.sys.enums.TaxDeclarationFunctionEnum;
|
||||
import com.engine.salary.sys.service.SalarySysConfService;
|
||||
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
|
||||
|
|
@ -838,7 +839,8 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void parseConfig(Long taxAgentId, List<SalarySobConfig> salarySobConfigs) {
|
||||
public List<UploadConfigResponse.Result> parseConfig(Long taxAgentId, List<SalarySobConfig> salarySobConfigs) {
|
||||
List<UploadConfigResponse.Result> results = new ArrayList<>();
|
||||
long uid = user.getUID();
|
||||
List<SalarySobPO> salarySobPOS = listByTaxAgentId(taxAgentId);
|
||||
Map<String, SalarySobPO> sobPOMap = SalaryEntityUtil.convert2Map(salarySobPOS, SalarySobPO::getName);
|
||||
|
|
@ -849,6 +851,14 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
Optional.ofNullable(salarySobConfigs).orElse(new ArrayList<>()).forEach(salarySobConfig -> {
|
||||
SalarySobPO salarySobPO = salarySobConfig.getSalarySob();
|
||||
String sobPOName = salarySobPO.getName();
|
||||
|
||||
UploadConfigResponse.Result result = UploadConfigResponse.Result.builder()
|
||||
.message(String.format("账套:%s基础信息加载完毕", sobPOName))
|
||||
.success(new ArrayList<>())
|
||||
.warning(new ArrayList<>())
|
||||
.error(new ArrayList<>())
|
||||
.build();
|
||||
|
||||
if (sobPOMap.containsKey(sobPOName)) {
|
||||
SalarySobPO oldSob = sobPOMap.get(sobPOName);
|
||||
salarySobPO.setId(oldSob.getId());
|
||||
|
|
@ -860,6 +870,8 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
getSalarySobMapper().insertIgnoreNull(salarySobPO);
|
||||
}
|
||||
|
||||
result.getSuccess().add(String.format("账套:%s基础信息加载成功", sobPOName));
|
||||
|
||||
Long sobId = salarySobPO.getId();
|
||||
getSalarySobEmpFieldService(user).deleteBySalarySobIds(Collections.singletonList(sobId));
|
||||
List<SalarySobEmpFieldPO> salarySobEmpFields = salarySobConfig.getSalarySobEmpFields();
|
||||
|
|
@ -870,7 +882,7 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
}
|
||||
getSalarySobEmpFieldService(user).batchSave(salarySobEmpFields);
|
||||
}
|
||||
|
||||
result.getSuccess().add(String.format("账套:%s人员字段加载成功", sobPOName));
|
||||
|
||||
getSalarySobItemService(user).deleteBySalarySobIds(Collections.singletonList(sobId));
|
||||
List<SalarySobItemPO> salarySobItems = salarySobConfig.getSalarySobItems();
|
||||
|
|
@ -891,8 +903,9 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
SalaryItemPO itemPO = getSalaryItemService(user).getItem(salaryItem);
|
||||
if (itemPO != null) {
|
||||
sobItem.setSalaryItemId(itemPO.getId());
|
||||
}else {
|
||||
log.error("item not found:{}",salaryItem);
|
||||
} else {
|
||||
result.getError().add(String.format("错误,账套:%s,薪资项目:%s,未找到对应薪资项目id", sobPOName, salaryItem.getName()));
|
||||
log.error("item not found:{}", salaryItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -929,8 +942,9 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
SalaryItemPO itemPO = getSalaryItemService(user).getItem(salaryItem);
|
||||
if (itemPO != null) {
|
||||
sobItem.setSalaryItemId(itemPO.getId());
|
||||
}else {
|
||||
log.error("item not found:{}",salaryItem);
|
||||
} else {
|
||||
result.getError().add(String.format("错误,账套:%s,薪资项目:%s,未找到对应薪资项目id", sobPOName, salaryItem.getName()));
|
||||
log.error("item not found:{}", salaryItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -940,6 +954,7 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
}
|
||||
getSalarySobItemGroupService(user).batchSave(salarySobItemGroups);
|
||||
}
|
||||
result.getSuccess().add(String.format("账套:%s薪资项目加载成功", sobPOName));
|
||||
|
||||
getSalarySobBackItemService(user).deleteBySalarySobIds(Collections.singletonList(sobId));
|
||||
List<SalarySobBackItemPO> salarySobBackItems = salarySobConfig.getSalarySobBackItems();
|
||||
|
|
@ -961,14 +976,16 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
SalaryItemPO itemPO = getSalaryItemService(user).getItem(salaryItem);
|
||||
if (itemPO != null) {
|
||||
salarySobBackItem.setSalaryItemId(itemPO.getId());
|
||||
}else {
|
||||
log.error("item not found:{}",salaryItem);
|
||||
} else {
|
||||
result.getError().add(String.format("错误,账套:%s,薪资项目:%s,未找到对应薪资项目id", sobPOName, salaryItem.getName()));
|
||||
log.error("item not found:{}", salaryItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
getSalarySobBackItemService(user).batchInsert(salarySobBackItems);
|
||||
}
|
||||
result.getSuccess().add(String.format("账套:%s回算加载成功", sobPOName));
|
||||
|
||||
getSalarySobAdjustRuleService(user).deleteBySalarySobIds(Collections.singletonList(sobId));
|
||||
List<SalarySobAdjustRulePO> salarySobAdjustRules = salarySobConfig.getSalarySobAdjustRules();
|
||||
|
|
@ -980,7 +997,12 @@ public class SalarySobServiceImpl extends Service implements SalarySobService {
|
|||
}
|
||||
getSalarySobAdjustRuleService(user).batchSave(salarySobAdjustRules);
|
||||
}
|
||||
result.getSuccess().add(String.format("账套:%s调薪计薪规则加载成功", sobPOName));
|
||||
|
||||
results.add(result);
|
||||
});
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import com.engine.salary.mapper.taxagent.TaxAgentBaseMapper;
|
|||
import com.engine.salary.service.SIAccountService;
|
||||
import com.engine.salary.service.SalaryAcctRecordService;
|
||||
import com.engine.salary.service.TaxAgentBaseService;
|
||||
import com.engine.salary.sys.entity.vo.UploadConfigResponse;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
import com.engine.salary.util.db.IdGenerator;
|
||||
|
|
@ -20,6 +21,7 @@ import org.apache.commons.collections4.CollectionUtils;
|
|||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -113,15 +115,22 @@ public class TaxAgentBaseServiceImpl extends Service implements TaxAgentBaseServ
|
|||
}
|
||||
|
||||
@Override
|
||||
public void parseConfig(TaxAgentBasePO config) {
|
||||
public UploadConfigResponse.Result parseConfig(TaxAgentBasePO config) {
|
||||
UploadConfigResponse.Result result = UploadConfigResponse.Result.builder().message("分权配置加载完毕")
|
||||
.success(new ArrayList<>())
|
||||
.warning(new ArrayList<>())
|
||||
.error(new ArrayList<>())
|
||||
.build();
|
||||
TaxAgentBasePO baseInfo = getBaseInfo();
|
||||
if (baseInfo == null) {
|
||||
config.setCreator((long) user.getUID());
|
||||
getTaxAgentBaseMapper().insertIgnoreNull(config);
|
||||
}else {
|
||||
} else {
|
||||
baseInfo.setDevolutionStatus(config.getDevolutionStatus());
|
||||
getTaxAgentBaseMapper().updateIgnoreNull(baseInfo);
|
||||
}
|
||||
result.getSuccess().add("分权加载完毕,分权" + (config.getDevolutionStatus() == 1 ? "开启" : "关闭 "));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,9 +4,9 @@ import com.engine.common.service.HrmCommonService;
|
|||
import com.engine.common.service.impl.HrmCommonServiceImpl;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.hrmelog.entity.dto.LoggerContext;
|
||||
import com.engine.salary.config.SalaryElogConfig;
|
||||
import com.engine.salary.constant.SalaryAuthConstant;
|
||||
import com.engine.hrmelog.entity.dto.LoggerContext;
|
||||
import com.engine.salary.entity.datacollection.AddUpDeduction;
|
||||
import com.engine.salary.entity.datacollection.AddUpSituation;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
|
|
@ -43,6 +43,7 @@ import com.engine.salary.mapper.siaccount.InsuranceAccountBatchMapper;
|
|||
import com.engine.salary.mapper.siarchives.InsuranceBaseInfoMapper;
|
||||
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
|
||||
import com.engine.salary.service.*;
|
||||
import com.engine.salary.sys.entity.vo.UploadConfigResponse;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
|
|
@ -815,7 +816,9 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void parseConfig(List<TaxAgentConfig> configs) {
|
||||
public List<UploadConfigResponse.Result> parseConfig(List<TaxAgentConfig> configs) {
|
||||
List<UploadConfigResponse.Result> results = new ArrayList<>();
|
||||
|
||||
List<TaxAgentPO> taxAgentPOS = listAll();
|
||||
Map<String, TaxAgentPO> agentPOMap = SalaryEntityUtil.convert2Map(taxAgentPOS, TaxAgentPO::getName);
|
||||
|
||||
|
|
@ -824,6 +827,14 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
|
|||
.forEach(config -> {
|
||||
TaxAgentPO taxAgent = config.getTaxAgent();
|
||||
String name = taxAgent.getName();
|
||||
|
||||
UploadConfigResponse.Result taxResult = UploadConfigResponse.Result.builder()
|
||||
.message(String.format("扣缴义务人%s加载完毕", name))
|
||||
.success(new ArrayList<>())
|
||||
.warning(new ArrayList<>())
|
||||
.error(new ArrayList<>())
|
||||
.build();
|
||||
|
||||
if (agentPOMap.containsKey(name)) {
|
||||
//存在扣缴义务人
|
||||
taxAgent = agentPOMap.get(name);
|
||||
|
|
@ -832,10 +843,14 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
|
|||
taxAgent.setCreator((long) user.getUID());
|
||||
getTaxAgentMapper().insertIgnoreNull(taxAgent);
|
||||
}
|
||||
taxResult.getSuccess().add(String.format("%s加载成功", name));
|
||||
results.add(taxResult);
|
||||
|
||||
getSalarySobService(user).parseConfig(taxAgent.getId(), config.getSalarySobConfigs());
|
||||
List<UploadConfigResponse.Result> sobResults = getSalarySobService(user).parseConfig(taxAgent.getId(), config.getSalarySobConfigs());
|
||||
results.addAll(sobResults);
|
||||
|
||||
});
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ import lombok.NoArgsConstructor;
|
|||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class uploadConfigParam {
|
||||
public class UploadConfigParam {
|
||||
|
||||
//上传文件id
|
||||
String imageId;
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.engine.salary.sys.entity.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class UploadConfigResponse {
|
||||
|
||||
private boolean finish;
|
||||
|
||||
private List<Result> results;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public static class Result {
|
||||
String message;
|
||||
List<String> success;
|
||||
List<String> warning;
|
||||
List<String> error;
|
||||
}
|
||||
}
|
||||
|
|
@ -6,6 +6,7 @@ import com.engine.salary.sys.entity.param.OrderRuleParam;
|
|||
import com.engine.salary.sys.entity.po.SalarySysConfPO;
|
||||
import com.engine.salary.sys.entity.vo.AppSettingVO;
|
||||
import com.engine.salary.sys.entity.vo.OrderRuleVO;
|
||||
import com.engine.salary.sys.entity.vo.UploadConfigResponse;
|
||||
import com.engine.salary.sys.enums.TaxDeclarationFunctionEnum;
|
||||
|
||||
import java.util.Date;
|
||||
|
|
@ -141,5 +142,5 @@ public interface SalarySysConfService {
|
|||
|
||||
SysConfig getConfig();
|
||||
|
||||
void parseConfig(SysConfig config);
|
||||
UploadConfigResponse.Result parseConfig(SysConfig config);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
package com.engine.salary.sys.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.api.formmode.mybatis.util.SqlProxyHandle;
|
||||
import com.cloudstore.dev.api.util.Util_DataCache;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
|
|
@ -45,6 +46,7 @@ import com.engine.salary.sys.entity.param.OrderRuleParam;
|
|||
import com.engine.salary.sys.entity.po.SalarySysConfPO;
|
||||
import com.engine.salary.sys.entity.vo.AppSettingVO;
|
||||
import com.engine.salary.sys.entity.vo.OrderRuleVO;
|
||||
import com.engine.salary.sys.entity.vo.UploadConfigResponse;
|
||||
import com.engine.salary.sys.enums.*;
|
||||
import com.engine.salary.sys.service.SalarySysConfService;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
|
|
@ -522,25 +524,31 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
|
|||
}
|
||||
|
||||
@Override
|
||||
public void parseConfig(SysConfig config) {
|
||||
public UploadConfigResponse.Result parseConfig(SysConfig config) {
|
||||
UploadConfigResponse.Result result = UploadConfigResponse.Result.builder()
|
||||
.message("系统配置加载完毕")
|
||||
.success(new ArrayList<>())
|
||||
.warning(new ArrayList<>())
|
||||
.error(new ArrayList<>())
|
||||
.build();
|
||||
|
||||
List<SalarySysConfPO> salarySysConfs = config.getSalarySysConfs();
|
||||
if (CollectionUtils.isEmpty(salarySysConfs)) {
|
||||
return;
|
||||
if (CollectionUtil.isNotEmpty((salarySysConfs))) {
|
||||
|
||||
salarySysConfs.forEach(po -> {
|
||||
SalarySysConfPO sysConfPO = getSalarySysConfMapper().getOneByCode(po.getConfKey());
|
||||
if (sysConfPO == null) {
|
||||
po.setId(IdGenerator.generate());
|
||||
getSalarySysConfMapper().insertIgnoreNull(po);
|
||||
} else {
|
||||
sysConfPO.setConfValue(po.getConfValue());
|
||||
getSalarySysConfMapper().updateIgnoreNull(sysConfPO);
|
||||
}
|
||||
result.getSuccess().add(String.format("[%s]配置,key:[%s],value:[%s]", po.getTitle(), po.getConfKey(), po.getConfValue()));
|
||||
});
|
||||
}
|
||||
|
||||
salarySysConfs.forEach(po -> {
|
||||
SalarySysConfPO sysConfPO = getSalarySysConfMapper().getOneByCode(po.getConfKey());
|
||||
if (sysConfPO == null) {
|
||||
po.setId(IdGenerator.generate());
|
||||
getSalarySysConfMapper().insertIgnoreNull(po);
|
||||
} else {
|
||||
sysConfPO.setConfValue(po.getConfValue());
|
||||
getSalarySysConfMapper().updateIgnoreNull(sysConfPO);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ public class SalaryCommonController {
|
|||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getCacheInfo(@Context HttpServletRequest request, @Context HttpServletResponse response, @QueryParam(value = "key") String key) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<String, String>(user).run(getSalaryCommonWrapper(user)::getCacheInfo, key);
|
||||
return new ResponseResult<String, Object>(user).run(getSalaryCommonWrapper(user)::getCacheInfo, key);
|
||||
}
|
||||
|
||||
@GET
|
||||
|
|
|
|||
|
|
@ -6,9 +6,9 @@ import com.engine.salary.sys.entity.param.*;
|
|||
import com.engine.salary.sys.entity.po.SalarySysConfPO;
|
||||
import com.engine.salary.sys.entity.vo.AppSettingVO;
|
||||
import com.engine.salary.sys.entity.vo.OrderRuleVO;
|
||||
import com.engine.salary.sys.entity.vo.UploadConfigResponse;
|
||||
import com.engine.salary.sys.enums.TaxDeclarationFunctionEnum;
|
||||
import com.engine.salary.util.ResponseResult;
|
||||
import com.engine.salary.util.excel.ImportExcelResponse;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.engine.salary.util.xml.XStreamUtil;
|
||||
import com.engine.salary.wrapper.SalarySystemConfigWrapper;
|
||||
|
|
@ -367,9 +367,9 @@ public class SalarySystemConfigController {
|
|||
@POST
|
||||
@Path("/uploadConfig")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String initConfig(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody uploadConfigParam param) {
|
||||
public String initConfig(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody UploadConfigParam param) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<uploadConfigParam, ImportExcelResponse>(user).run(getSalarySystemConfigWrapper(user)::uploadConfig, param);
|
||||
return new ResponseResult<UploadConfigParam, UploadConfigResponse>(user).run(getSalarySystemConfigWrapper(user)::uploadConfig, param);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ public class SalaryCommonWrapper extends Service {
|
|||
return ServiceUtil.getService(SalaryCacheServiceImpl.class, user);
|
||||
}
|
||||
|
||||
public String getCacheInfo(String key) {
|
||||
public Object getCacheInfo(String key) {
|
||||
return getSalaryCacheService(user).get(key);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package com.engine.salary.wrapper;
|
|||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.cache.SalaryCacheKey;
|
||||
import com.engine.salary.entity.config.SalaryConfig;
|
||||
import com.engine.salary.entity.salaryarchive.config.ArchiveFieldConfig;
|
||||
import com.engine.salary.entity.salaryitem.config.SalaryItemAllConfig;
|
||||
|
|
@ -15,11 +16,11 @@ import com.engine.salary.sys.entity.param.*;
|
|||
import com.engine.salary.sys.entity.po.SalarySysConfPO;
|
||||
import com.engine.salary.sys.entity.vo.AppSettingVO;
|
||||
import com.engine.salary.sys.entity.vo.OrderRuleVO;
|
||||
import com.engine.salary.sys.entity.vo.UploadConfigResponse;
|
||||
import com.engine.salary.sys.enums.TaxDeclarationFunctionEnum;
|
||||
import com.engine.salary.sys.service.SalarySysConfService;
|
||||
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.excel.ImportExcelResponse;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
import com.engine.salary.util.page.SalaryPageUtil;
|
||||
import com.engine.salary.util.valid.RuntimeTypeEnum;
|
||||
|
|
@ -37,7 +38,7 @@ import java.io.InputStream;
|
|||
import java.io.InputStreamReader;
|
||||
import java.io.Reader;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collections;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -77,6 +78,10 @@ public class SalarySystemConfigWrapper extends Service {
|
|||
return ServiceUtil.getService(TaxAgentBaseServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryCacheService getSalaryCacheService(User user) {
|
||||
return ServiceUtil.getService(SalaryCacheServiceImpl.class, user);
|
||||
}
|
||||
|
||||
public Map<String, Object> info() {
|
||||
BaseBean baseBean = new BaseBean();
|
||||
String log = baseBean.getPropValue("hrmSalary", "log");
|
||||
|
|
@ -236,44 +241,61 @@ public class SalarySystemConfigWrapper extends Service {
|
|||
return salaryConfig;
|
||||
}
|
||||
|
||||
public ImportExcelResponse uploadConfig(uploadConfigParam param) {
|
||||
public UploadConfigResponse uploadConfig(UploadConfigParam param) {
|
||||
Boolean chief = getTaxAgentService(user).isChief((long) user.getUID());
|
||||
if (!chief) {
|
||||
throw new SalaryRunTimeException("您不是薪酬总管理员,无法迁入配置!");
|
||||
}
|
||||
|
||||
ImportExcelResponse response = ImportExcelResponse.builder().build();
|
||||
|
||||
InputStream fileInputStream = null;
|
||||
try {
|
||||
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(param.getImageId()));
|
||||
Reader reader = new InputStreamReader(fileInputStream, StandardCharsets.UTF_8);
|
||||
BufferedReader bufferedReader = new BufferedReader(reader);
|
||||
String line;
|
||||
StringBuilder xml = new StringBuilder();
|
||||
while ((line = bufferedReader.readLine()) != null) {
|
||||
xml.append(line);
|
||||
}
|
||||
|
||||
SalaryConfig config = XStreamUtil.unmarshal(SalaryConfig.class, xml.toString());
|
||||
|
||||
getSalarySysConfService(user).parseConfig(config.getSysConfig());
|
||||
|
||||
getSalaryItemService(user).parseConfig(config.getSalaryItemConfig());
|
||||
|
||||
getSalaryArchiveItemService(user).parseConfig(config.getArchiveFieldConfig());
|
||||
|
||||
getTaxAgentBaseService(user).parseConfig(config.getTaxAgentBaseConfig());
|
||||
|
||||
getTaxAgentService(user).parseConfig(config.getTaxAgentConfigs());
|
||||
|
||||
return response;
|
||||
} catch (Exception e) {
|
||||
log.error("迁入失败",e);
|
||||
response.setErrorData(Collections.singletonList(ImportExcelResponse.Error.builder().message("迁入失败!").build()));
|
||||
return response;
|
||||
} finally {
|
||||
IOUtils.closeQuietly(fileInputStream);
|
||||
UploadConfigResponse lastResponse = getSalaryCacheService(user).get(SalaryCacheKey.UPLOAD_SALARY_CONFIG);
|
||||
if (lastResponse != null && !lastResponse.isFinish()) {
|
||||
throw new SalaryRunTimeException("迁入任务进行中,请等待上次任务完成!");
|
||||
}
|
||||
|
||||
// LocalRunnable localRunnable = new LocalRunnable() {
|
||||
// @Override
|
||||
// public void execute() {
|
||||
UploadConfigResponse response = UploadConfigResponse.builder().finish(false).results(new ArrayList<>()).build();
|
||||
getSalaryCacheService(user).set(SalaryCacheKey.UPLOAD_SALARY_CONFIG, response);
|
||||
|
||||
InputStream fileInputStream = null;
|
||||
try {
|
||||
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(param.getImageId()));
|
||||
Reader reader = new InputStreamReader(fileInputStream, StandardCharsets.UTF_8);
|
||||
BufferedReader bufferedReader = new BufferedReader(reader);
|
||||
String line;
|
||||
StringBuilder xml = new StringBuilder();
|
||||
while ((line = bufferedReader.readLine()) != null) {
|
||||
xml.append(line);
|
||||
}
|
||||
|
||||
SalaryConfig config = XStreamUtil.unmarshal(SalaryConfig.class, xml.toString());
|
||||
|
||||
UploadConfigResponse.Result sysConfigResult = getSalarySysConfService(user).parseConfig(config.getSysConfig());
|
||||
response.getResults().add(sysConfigResult);
|
||||
|
||||
UploadConfigResponse.Result salaryItemResult = getSalaryItemService(user).parseConfig(config.getSalaryItemConfig());
|
||||
response.getResults().add(salaryItemResult);
|
||||
|
||||
UploadConfigResponse.Result archiveFieldResult = getSalaryArchiveItemService(user).parseConfig(config.getArchiveFieldConfig());
|
||||
response.getResults().add(archiveFieldResult);
|
||||
|
||||
UploadConfigResponse.Result taxAgentBaseResult = getTaxAgentBaseService(user).parseConfig(config.getTaxAgentBaseConfig());
|
||||
response.getResults().add(taxAgentBaseResult);
|
||||
|
||||
List<UploadConfigResponse.Result> results = getTaxAgentService(user).parseConfig(config.getTaxAgentConfigs());
|
||||
response.getResults().addAll(results);
|
||||
} catch (Exception e) {
|
||||
log.error("加载失败", e);
|
||||
} finally {
|
||||
response.setFinish(true);
|
||||
IOUtils.closeQuietly(fileInputStream);
|
||||
}
|
||||
getSalaryCacheService(user).set(SalaryCacheKey.UPLOAD_SALARY_CONFIG, response);
|
||||
// }
|
||||
// };
|
||||
// ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.HRM, "UPLOAD_SALARY_CONFIG", localRunnable);
|
||||
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue