Merge remote-tracking branch 'origin/develop' into develop

# Conflicts:
#	src/com/engine/salary/service/impl/SalaryAcctEmployeeServiceImpl.java
This commit is contained in:
钱涛 2022-09-19 16:45:10 +08:00
commit bc1e874a1c
13 changed files with 215 additions and 20 deletions

View File

@ -904,6 +904,11 @@ public class SIAccountBiz extends Service {
//核算结果集
List<InsuranceAccountDetailPO> pos = new ArrayList<>();
baseList.forEach(baseParam -> {
//判断人员id+账单月份+补缴月份在表中的唯一性
List<InsuranceAccountDetailPO> supplementList = getInsuranceAccountDetailMapper().querySupplementList(baseParam.getBillMonth(), baseParam.getPaymentOrganization(), baseParam.getEmployeeId(), baseParam.getSupplementaryMonth());
if (supplementList.size() > 0) {
throw new SalaryRunTimeException("当前人员和账单月份已存在该补缴月份的数据!无法再次创建!");
}
InsuranceAccountDetailPO insuranceAccountDetailPO = accountSingleEmployeeBill(baseParam, longInsuranceArchivesAccountPOMap.get(baseParam.getEmployeeId()), employeeId);
pos.add(insuranceAccountDetailPO);
});

View File

@ -72,6 +72,16 @@ public interface InsuranceAccountDetailMapper {
List<InsuranceAccountDetailPO> queryList(@Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization, @Param("employeeIds") Collection<Long> employeeIds);
/**
* 查询补缴数据
* @param billMonth
* @param paymentOrganization
* @param employeeId
* @param supplementaryMonth
* @return
*/
List<InsuranceAccountDetailPO> querySupplementList(@Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization, @Param("employeeId") Long employeeId, @Param("supplementaryMonth") String supplementaryMonth);
/**
* 根据账单月份删除

View File

@ -188,6 +188,21 @@
</if>
</select>
<select id="querySupplementList" resultMap="BaseResultMap">
SELECT
t.employee_id,t.social_per_json,t.social_com_json,
t.fund_per_json,t.fund_com_json,t.other_per_json,
t.other_com_json,t.social_per_sum,t.social_com_sum,
t.fund_per_sum,t.fund_com_sum,t.other_per_sum,
t.other_com_sum,t.per_sum,t.com_sum
FROM
hrsa_bill_detail t
WHERE t.delete_type = 0
AND t.bill_month = #{billMonth}
AND t.payment_organization = #{paymentOrganization}
AND t.employee_id = #{employeeId}
AND t.supplementary_month = #{supplementaryMonth}
</select>
<select id="selectAccountIds" resultType="java.lang.Long">
SELECT DISTINCT a.ID

View File

@ -222,5 +222,10 @@ public interface SIAccountService {
* 预览福利核算导入模板导入的数据
*/
Map<String, Object> preview(InsuranceAcctImportParam insuranceAcctImportParam);
/**
* 导出福利核算-补缴导入模板
*/
XSSFWorkbook exportSupplyImportTemplate(InsuranceAcctDetailImportTemplateParam param);
}

View File

@ -146,6 +146,14 @@ public interface SalaryAcctEmployeeService {
*/
PageInfo<SalaryAcctEmployeePO> listPageByParam4Reduce(SalaryAcctEmployeeQueryParam queryParam);
/**
* 根据列表查询条件查询同比增加的薪资核算人员分页
*
* @param queryParam 列表查询条件
* @return
*/
PageInfo<SalaryAcctEmployeePO> listPageByParam4Add(SalaryAcctEmployeeQueryParam queryParam);
/**
* 根据列表查询条件查询同比减少的薪资核算人员
*
@ -154,6 +162,14 @@ public interface SalaryAcctEmployeeService {
*/
List<SalaryAcctEmployeePO> listByParam4Reduce(SalaryAcctEmployeeQueryParam queryParam);
/**
* 根据列表查询条件查询同比增加的薪资核算人员
*
* @param queryParam 列表查询条件
* @return
*/
List<SalaryAcctEmployeePO> listByParam4Add(SalaryAcctEmployeeQueryParam queryParam);
/**
* 根据列表查询条件查询合并计税的薪资核算人员分页
*

View File

@ -5,6 +5,7 @@ import com.api.browser.bean.SearchConditionItem;
import com.api.browser.bean.SearchConditionOption;
import com.api.browser.util.ConditionFactory;
import com.api.browser.util.ConditionType;
import com.api.formmode.mybatis.util.SqlProxyHandle;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.biz.AddUpDeductionBiz;
@ -28,7 +29,9 @@ import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.datacollection.AddUpDeductionMapper;
import com.engine.salary.mapper.sys.SalarySysConfMapper;
import com.engine.salary.service.*;
import com.engine.salary.sys.entity.po.SalarySysConfPO;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
@ -87,6 +90,10 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
}
private SalarySysConfMapper getSalarySysConfMapper() {
return SqlProxyHandle.getProxy(SalarySysConfMapper.class);
}
@Override
public Map<String, Object> getSearchCondition(Map<String, Object> params) {
@ -199,6 +206,10 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
Date declareMonth = SalaryDateUtil.localDateToDate(LocalDate.parse(declareMonthStr + "-01", SalaryDateUtil.DATE_FORMATTER));
List<AddUpDeduction> list = getAddUpDeductionMapper().listSome(AddUpDeduction.builder().declareMonth(declareMonth).build());
//查询对于人员信息导入筛选的全局配置
SalarySysConfPO salarySysConfPO = getSalarySysConfMapper().getOneByCode("matchEmployeeMode");
String confValue = (salarySysConfPO != null && salarySysConfPO.getConfValue() != null && !"".equals(salarySysConfPO.getConfValue())) ? salarySysConfPO.getConfValue() : "0";
InputStream fileInputStream = null;
try {
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(imageId));
@ -238,16 +249,12 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
String userName = dto.getUsername();
String deparmentName = dto.getDepartmentName();
String mobile = dto.getMobile();
// List<DataCollectionEmployee> employeeSameIds = employees.stream().filter(e -> (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName))
// && (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName)))
// .collect(Collectors.toList());
//20220824需求迭代增加手机号作为导入校验项
List<DataCollectionEmployee> employeeSameIds = employees.stream().filter(e -> (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName))
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName))
&& (StringUtils.isBlank(mobile) || Objects.equals(e.getMobile(), mobile)))
.collect(Collectors.toList());
String workcode = dto.getJobNum();
if (StringUtils.isBlank(userName)) {
//筛选导入人员信息可以在人力资源池中匹配到的人员信息
List<DataCollectionEmployee> employeeSameIds = getSalaryAcctEmployeeService(user).matchImportEmployee(employees, userName, deparmentName, mobile, workcode);
if (StringUtils.isBlank(userName) && "0".equals(confValue)) {
//姓名 不能为空
//错误消息对象
Map<String, String> errorMessageMap = Maps.newHashMap();

View File

@ -1036,7 +1036,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
//查询对于人员信息导入筛选的全局配置
SalarySysConfPO salarySysConfPO = getSalarySysConfMapper().getOneByCode("matchEmployeeMode");
String confValue = (salarySysConfPO != null && salarySysConfPO.getConfValue() != null && !"".equals(salarySysConfPO.getConfValue())) ? salarySysConfPO.getConfValue() : "0";
//检验参数
//excel文件id
String imageId = Util.null2String(importParam.getImageId());
@ -1125,7 +1125,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
if (StringUtils.equals(SalaryI18nUtil.getI18nLabel(85429, "姓名"), dataKey.toString())) {
//当人员信息导入筛选的全局配置为"0"姓名才是必填项
if (StringUtils.isEmpty(dataValue) && "0".equals(salarySysConfPO.getConfValue())) {
if (StringUtils.isEmpty(dataValue) && "0".equals(confValue)) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(102838, "姓名不能为空"));
@ -1247,6 +1247,39 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
}
}
/**
* 导出福利核算-补缴导入模板
*/
@Override
public XSSFWorkbook exportSupplyImportTemplate(InsuranceAcctDetailImportTemplateParam param) {
ValidUtil.doValidator(param);
// 必须选择导入模板所需的薪资项目(福利项)
if (CollectionUtils.isEmpty(param.getWelfareNames())) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(99019, "参数错误,请选择导入模板所需的福利项目核算项"));
}
// 模板表头(默认必带"个税扣缴义务人""姓名")
List<Object> headerList = Lists.newArrayList(SalaryI18nUtil.getI18nLabel(85429, "姓名"),
"部门",
SalaryI18nUtil.getI18nLabel(86186, "手机号"),
SalaryI18nUtil.getI18nLabel(86317, "工号"),
SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"),
"账单月份",
"补缴月份");
// List<String> dataIndexList = Lists.newArrayList("username", "departmentName", "mobile", "taxAgentName", "billMonth");
// 查询福利核算项目
List<String> welfareNames = (List<String>) param.getWelfareNames();
headerList.addAll(welfareNames);
// excel导出的数据
List<List<Object>> rows = new ArrayList<>();
rows.add(headerList);
String sheetName = "福利核算导入模板";
return ExcelUtil.genWorkbookV2(rows, sheetName);
}
/**
* 将更新的数据设置到老的insuranceAccountDetailPO对象中

View File

@ -698,10 +698,11 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
//查询对于人员信息导入筛选的全局配置
SalarySysConfPO salarySysConfPO = getSalarySysConfMapper().getOneByCode("matchEmployeeMode");
String confValue = (salarySysConfPO != null && salarySysConfPO.getConfValue() != null && !"".equals(salarySysConfPO.getConfValue())) ? salarySysConfPO.getConfValue() : "0";
String rowIndex = "" + index + "";
//仅在全局人员筛选配置为0才对用户名部门名称手机号有要求
if (StringUtils.isBlank(userName) && StringUtils.isBlank(deparmentName) && StringUtils.isBlank(mobile) && "0".equals(salarySysConfPO.getConfValue())) {
if (StringUtils.isBlank(userName) && StringUtils.isBlank(deparmentName) && StringUtils.isBlank(mobile) && "0".equals(confValue)) {
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", rowIndex + " 用户名、部门名称、手机号" + SalaryI18nUtil.getI18nLabel(100303, "不能同时为空"));
excelComments.add(errorMessageMap);

View File

@ -221,6 +221,8 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
return salaryAcctEmployeePOS;
}
@Override
public PageInfo<SalaryAcctEmployeePO> listPageByParam4Reduce(SalaryAcctEmployeeQueryParam queryParam) {
@ -233,6 +235,18 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
return salaryAcctEmployeePOPageInfo;
}
@Override
public PageInfo<SalaryAcctEmployeePO> listPageByParam4Add(SalaryAcctEmployeeQueryParam queryParam) {
// 查询薪资核算人员
List<SalaryAcctEmployeePO> salaryAcctEmployeePOS = listByParam4Add(queryParam);
PageInfo<SalaryAcctEmployeePO> salaryAcctEmployeePOPageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), SalaryAcctEmployeePO.class);
// 分页参数
salaryAcctEmployeePOPageInfo.setTotal(salaryAcctEmployeePOS.size());
salaryAcctEmployeePOPageInfo.setList(SalaryPageUtil.subList(queryParam.getCurrent(), queryParam.getPageSize(), salaryAcctEmployeePOS));
return salaryAcctEmployeePOPageInfo;
}
@Override
public List<SalaryAcctEmployeePO> listByParam4Reduce(SalaryAcctEmployeeQueryParam queryParam) {
// 查询上个月的薪资核算记录同一个薪资账套
@ -256,6 +270,30 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
return resultList;
}
@Override
public List<SalaryAcctEmployeePO> listByParam4Add(SalaryAcctEmployeeQueryParam queryParam) {
// 查询上个月的薪资核算记录同一个薪资账套
List<SalaryAcctRecordPO> salaryAcctRecordPOS = getSalaryAcctRecordService(user).listById4LastSalaryMonth(queryParam.getSalaryAcctRecordId());
if (CollectionUtils.isEmpty(salaryAcctRecordPOS)) {
return Collections.emptyList();
}
Set<Long> lastMonthSalaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctRecordPOS, SalaryAcctRecordPO::getId);
// 上个月的核算人员
List<SalaryAcctEmployeePO> lastMonthSalaryAcctEmployeePOS = listBySalaryAcctRecordIds(lastMonthSalaryAcctRecordIds);
Map<String, SalaryAcctEmployeePO> lastMonthSalaryAcctEmployeePOMap = SalaryEntityUtil.convert2Map(lastMonthSalaryAcctEmployeePOS, salaryAcctEmployeePO -> salaryAcctEmployeePO.getEmployeeId() + "-" + salaryAcctEmployeePO.getTaxAgentId());
// 本月的核算人员
List<SalaryAcctEmployeePO> salaryAcctEmployeePOS = listByParam(queryParam);
// Set<String> keySet = SalaryEntityUtil.properties(salaryAcctEmployeePOS, salaryAcctEmployeePO -> salaryAcctEmployeePO.getEmployeeId() + "-" + salaryAcctEmployeePO.getTaxAgentId());
Map<String, SalaryAcctEmployeePO> thisMonthSalaryAcctEmployeePOMap = SalaryEntityUtil.convert2Map(salaryAcctEmployeePOS, salaryAcctEmployeePO -> salaryAcctEmployeePO.getEmployeeId() + "-" + salaryAcctEmployeePO.getTaxAgentId());
List<SalaryAcctEmployeePO> resultList = Lists.newArrayList();
thisMonthSalaryAcctEmployeePOMap.forEach((k,v)->{
if(!lastMonthSalaryAcctEmployeePOMap.containsKey(k)){
resultList.add(v);
}
});
return resultList;
}
@Override
public PageInfo<SalaryAcctEmployeePO> listPageByParam4ConsolidatedTax(SalaryAcctEmployeeQueryParam queryParam) {
@ -478,11 +516,10 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
/**
* 筛选导入人员信息可以在人力资源池中匹配到的人员信息
*
* @param employeeList 人力资源池
* @param employeeList 人力资源池
* @param userName 姓名
* @param deparmentName 部门
* @param mobile 手机号
* @param mobile 手机号
* @param workcode 工号
*/
@Override
@ -490,14 +527,15 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
//查询对于人员信息导入筛选的全局配置
SalarySysConfPO salarySysConfPO = getSalarySysConfMapper().getOneByCode("matchEmployeeMode");
String confValue = (salarySysConfPO != null && salarySysConfPO.getConfValue() != null && !"".equals(salarySysConfPO.getConfValue())) ? salarySysConfPO.getConfValue() : "0";
List<DataCollectionEmployee> employees = new ArrayList<>();
//0代表姓名+部门+手机号的匹配原则1代表工号为唯一匹配原则
if (salarySysConfPO == null || "0".equals(salarySysConfPO.getConfValue())) {
if ("0".equals(confValue)) {
employees = employeeList.stream().filter(e -> (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName))
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName))
&& (StringUtils.isBlank(mobile) || Objects.equals(e.getMobile(), mobile)))
&& (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName))
&& (StringUtils.isBlank(mobile) || Objects.equals(e.getMobile(), mobile)))
.collect(Collectors.toList());
} else if ("1".equals(salarySysConfPO.getConfValue())) {
} else if ("1".equals(confValue)) {
employees = employeeList.stream().filter(e -> (StringUtils.isBlank(workcode) || Objects.equals(e.getWorkcode(), workcode)))
.collect(Collectors.toList());
}

View File

@ -530,6 +530,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
//查询对于人员信息导入筛选的全局配置
SalarySysConfPO salarySysConfPO = getSalarySysConfMapper().getOneByCode("matchEmployeeMode");
String confValue = (salarySysConfPO != null && salarySysConfPO.getConfValue() != null && !"".equals(salarySysConfPO.getConfValue())) ? salarySysConfPO.getConfValue() : "0";
// 薪资核算记录的id
Long salaryAcctRecordId = param.getSalaryAcctRecordId();
@ -628,7 +629,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
if (StringUtils.equals(SalaryI18nUtil.getI18nLabel(85429, "姓名"), dataKey.toString())) {
usernameIndex = j;
if (StringUtils.isEmpty(dataValue) && "0".equals(salarySysConfPO.getConfValue())) {
if (StringUtils.isEmpty(dataValue) && "0".equals(confValue)) {
isError = true;
Map<String, String> errorMessageMap = Maps.newHashMap();
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(102838, "姓名不能为空"));

View File

@ -458,4 +458,42 @@ public class SIAccountController {
return new ResponseResult<InsuranceAcctImportParam, Map<String, Object>>(user).run(getService(user)::preview, insuranceAcctImportParam);
}
/**
* 导出福利核算-补缴导入模板
*/
@GET
@Path("/welfare/supplyimporttemplate/export")
@Produces(MediaType.APPLICATION_OCTET_STREAM)
public Response exportSupplyImportTemplate(@Context HttpServletRequest request, @Context HttpServletResponse response) {
try {
InsuranceAcctDetailImportTemplateParam param = new InsuranceAcctDetailImportTemplateParam();
String welfareNames = request.getParameter("welfareNames");
if (StringUtils.isNotBlank(welfareNames)) {
param.setWelfareNames(Arrays.stream(welfareNames.split(",")).map(String::valueOf).collect(Collectors.toList()));
}
User user = HrmUserVarify.getUser(request, response);
XSSFWorkbook workbook = getService(user).exportSupplyImportTemplate(param);
String time = LocalDate.now().toString();
String fileName = "福利核算-补缴导入模板" + time;
try {
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
StreamingOutput output = outputStream -> {
workbook.write(outputStream);
outputStream.flush();
};
response.setContentType("application/octet-stream");
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
} catch (Exception e) {
log.error("福利核算-补缴导入模板导出异常", e);
throw e;
}
}
}

View File

@ -173,6 +173,16 @@ public class SalaryAcctController {
return new ResponseResult<SalaryAcctEmployeeQueryParam, PageInfo<SalaryAccEmployeeListDTO>>(user).run(getSalaryAcctEmployeeWrapper(user)::listPage4Reduce, param);
}
//薪资核算环比上期添加人员列表
@POST
@Path("/addedemployee/list")
@Produces(MediaType.APPLICATION_JSON)
public String listAddEmployee(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryAcctEmployeeQueryParam param) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryAcctEmployeeQueryParam, PageInfo<SalaryAccEmployeeListDTO>>(user).run(getSalaryAcctEmployeeWrapper(user)::listPage4Add, param);
}
//添加薪资核算人员
@POST
@Path("/acctemployee/save")

View File

@ -79,6 +79,21 @@ public class SalaryAcctEmployeeWrapper extends Service {
return dtoPage;
}
/**
* 同比增加的薪资核算人员列表
*
* @param queryParam 列表查询参数
* @return
*/
public PageInfo<SalaryAccEmployeeListDTO> listPage4Add(SalaryAcctEmployeeQueryParam queryParam) {
// 查询同比减少的薪资核算人员分页
PageInfo<SalaryAcctEmployeePO> page = getSalaryAcctEmployeeService(user).listPageByParam4Add(queryParam);
// 转换成列表dto
PageInfo<SalaryAccEmployeeListDTO> dtoPage = convert2ListDTO(page);
return dtoPage;
}
/**
* 转换成列表dto
*
@ -179,4 +194,5 @@ public class SalaryAcctEmployeeWrapper extends Service {
public void refreshTaxAgent(Long salaryAcctRecordId) {
getSalaryAcctEmployeeService(user).refresh(salaryAcctRecordId);
}
}