Merge branch 'feature/维护工具' into release/2.8.2.2305.02
This commit is contained in:
commit
d08a329000
|
|
@ -4,6 +4,7 @@ import com.engine.common.util.ServiceUtil;
|
|||
import com.engine.salary.maintainer.datacollection.AddUpSituationManager;
|
||||
import com.engine.salary.maintainer.salaryacct.SalaryAcctManager;
|
||||
import com.engine.salary.maintainer.salaryacct.SalaryAcctSupplementParam;
|
||||
import com.engine.salary.maintainer.salaryarchive.SalaryArchiveManager;
|
||||
import com.engine.salary.util.ResponseResult;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
|
@ -40,6 +41,10 @@ public class MaintainerController {
|
|||
return ServiceUtil.getService(AddUpSituationManager.class, user);
|
||||
}
|
||||
|
||||
private SalaryArchiveManager getSalaryArchiveManager(User user) {
|
||||
return ServiceUtil.getService(SalaryArchiveManager.class, user);
|
||||
}
|
||||
|
||||
//---------------------------薪资核算 start ------------------------------------
|
||||
|
||||
/**
|
||||
|
|
@ -94,4 +99,13 @@ public class MaintainerController {
|
|||
}
|
||||
//---------------------------数据采集 往期累计情况 end ------------------------------------
|
||||
|
||||
|
||||
@GET
|
||||
@Path("/salaryArchive/initPayStartDate")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String initPayDate(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<String, Boolean>(user).run(getSalaryArchiveManager(user)::initPayStartDate);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ import java.util.stream.Collectors;
|
|||
* @date 2023/04/23 17:23
|
||||
* @description 往期累计情况维护类
|
||||
*/
|
||||
public class AddUpSituationManager extends Service {
|
||||
public class AddUpSituationManager extends Service {
|
||||
|
||||
private TaxDeclarationMapper getTaxDeclarationMapper() {
|
||||
return MapperProxyFactory.getProxy(TaxDeclarationMapper.class);
|
||||
|
|
@ -38,29 +38,31 @@ public class AddUpSituationManager extends Service {
|
|||
// 获取已有的个税申报表记录
|
||||
List<TaxDeclarationPO> taxDeclarationList = getTaxDeclarationMapper().listSome(new TaxDeclarationPO());
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
||||
Map<Long, String> taxDeclarationMap = SalaryEntityUtil.convert2Map(taxDeclarationList, TaxDeclarationPO::getId, PO->PO.getTaxAgentId()+"-"+sdf.format(PO.getSalaryMonth()));
|
||||
Map<Long, String> taxDeclarationMap = SalaryEntityUtil.convert2Map(taxDeclarationList, TaxDeclarationPO::getId, PO -> PO.getTaxAgentId() + "-" + sdf.format(PO.getSalaryMonth()));
|
||||
BaseBean bb = new BaseBean();
|
||||
List<Long> taxDeclarationIds = taxDeclarationList.stream().map(TaxDeclarationPO::getId).collect(Collectors.toList());
|
||||
bb.writeLog("往期累计数据恢复DataIds:"+ taxDeclarationIds);
|
||||
bb.writeLog("往期累计数据恢复DataMap:"+ taxDeclarationMap);
|
||||
bb.writeLog("往期累计数据恢复DataIds:" + taxDeclarationIds);
|
||||
bb.writeLog("往期累计数据恢复DataMap:" + taxDeclarationMap);
|
||||
boolean result = true;
|
||||
// 循环调用生成申报单接口
|
||||
for(int i =0; i < taxDeclarationList.size(); i++){
|
||||
for (int i = 0; i < taxDeclarationList.size(); i++) {
|
||||
TaxDeclarationPO po = taxDeclarationList.get(i);
|
||||
bb.writeLog("开始删除生成:"+po.getTaxAgentId()+"-"+po.getSalaryMonth());
|
||||
bb.writeLog("开始删除生成:" + po.getTaxAgentId() + "-" + po.getSalaryMonth());
|
||||
// 删除记录
|
||||
int delete = getTaxDeclarationMapper().deleteByIdZj(po.getId());
|
||||
LocalDate localDate = SalaryDateUtil.dateToLocalDate(po.getSalaryMonth());
|
||||
// 调用生成申报单接口
|
||||
YearMonth yearMonth = YearMonth.of(localDate.getYear(),localDate.getMonth());
|
||||
YearMonth yearMonth = YearMonth.of(localDate.getYear(), localDate.getMonth());
|
||||
try {
|
||||
getTaxDeclarationService().save(TaxDeclarationSaveParam.builder().salaryMonth(yearMonth).taxAgentId(po.getTaxAgentId()).build());
|
||||
}catch (Exception e){
|
||||
bb.writeLog("错误:"+e);
|
||||
} catch (Exception e) {
|
||||
bb.writeLog("错误:" + e);
|
||||
result = false;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,64 @@
|
|||
package com.engine.salary.maintainer.salaryarchive;
|
||||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.salaryarchive.po.SalaryArchivePO;
|
||||
import com.engine.salary.enums.salaryarchive.SalaryArchiveStatusEnum;
|
||||
import com.engine.salary.mapper.archive.SalaryArchiveMapper;
|
||||
import com.engine.salary.service.SalaryArchiveService;
|
||||
import com.engine.salary.service.SalaryEmployeeService;
|
||||
import com.engine.salary.service.impl.SalaryArchiveServiceImpl;
|
||||
import com.engine.salary.service.impl.SalaryEmployeeServiceImpl;
|
||||
import com.engine.salary.util.SalaryDateUtil;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class SalaryArchiveManager extends Service {
|
||||
private SalaryArchiveService getSalaryArchiveService(User user) {
|
||||
return ServiceUtil.getService(SalaryArchiveServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryEmployeeService getSalaryEmployeeService(User user) {
|
||||
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SalaryArchiveMapper getSalaryArchiveMapper() {
|
||||
return MapperProxyFactory.getProxy(SalaryArchiveMapper.class);
|
||||
}
|
||||
|
||||
public Boolean initPayStartDate() {
|
||||
//获取所有待定薪档案
|
||||
List<SalaryArchivePO> list = getSalaryArchiveService(user).listSome(SalaryArchivePO.builder().runStatus(SalaryArchiveStatusEnum.PENDING.getValue()).build());
|
||||
|
||||
//过滤已存在起始发薪日期的数据
|
||||
List<SalaryArchivePO> needData = list.stream().filter(po -> po.getPayStartDate() == null).collect(Collectors.toList());
|
||||
List<Long> empIds = SalaryEntityUtil.properties(needData, SalaryArchivePO::getEmployeeId, Collectors.toList());
|
||||
|
||||
//获取人员信息
|
||||
List<DataCollectionEmployee> emps = getSalaryEmployeeService(user).getEmployeeByIds(empIds);
|
||||
Map<Long, DataCollectionEmployee> longDataCollectionEmployeeMap = SalaryEntityUtil.convert2Map(emps, DataCollectionEmployee::getEmployeeId);
|
||||
|
||||
//设置起始发薪日期
|
||||
List<SalaryArchivePO> collect1 = needData.stream().peek(po -> {
|
||||
Long employeeId = po.getEmployeeId();
|
||||
DataCollectionEmployee orDefault = longDataCollectionEmployeeMap.getOrDefault(employeeId, new DataCollectionEmployee());
|
||||
String companystartdate = orDefault.getCompanystartdate();
|
||||
if (StringUtils.isNotBlank(companystartdate)&&SalaryDateUtil.checkDay(companystartdate)) {
|
||||
Date parse = SalaryDateUtil.parse(companystartdate, SalaryDateUtil.DATE_FORMATTER_PATTERN);
|
||||
po.setPayStartDate(parse);
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
collect1.forEach(getSalaryArchiveMapper()::update);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue