Merge branch 'release/2.15.2.2409.01' into feature/次账号

This commit is contained in:
钱涛 2024-10-16 17:19:43 +08:00
commit 070a2a75ac
15 changed files with 127 additions and 23 deletions

View File

@ -1,5 +1,6 @@
package com.engine.salary.entity.datacollection.po;
import com.engine.salary.annotation.Encrypt;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -41,6 +42,7 @@ public class VariableArchiveItemPO {
/**
* 浮动值
*/
@Encrypt
private String itemValue;
/**

View File

@ -84,4 +84,6 @@ public interface VariableArchiveItemMapper {
void deleteByIds(@Param("collection")List<Long> part);
void deleteByArchiveIds(@Param("collection")List<Long> part);
void updateBatchSelective(@Param("list")List<VariableArchiveItemPO> variableArchiveItemPOS);
}

View File

@ -312,6 +312,22 @@
</set>
WHERE id = #{id} AND delete_type = 0
</update>
<update id="updateBatchSelective">
update hrsa_variable_archive_item
<trim prefix="set" suffixOverrides=",">
<trim prefix="item_value = case" suffix="end,">
<foreach collection="list" index="index" item="item">
<if test="item.itemValue != null">
when id = #{item.id} then #{item.itemValue}
</if>
</foreach>
</trim>
</trim>
where id in
<foreach close=")" collection="list" item="item" open="(" separator=", ">
#{item.id}
</foreach>
</update>
<!-- 根据主键删除记录 -->

View File

@ -257,7 +257,7 @@
</if>
<!-- 工号 -->
<if test="param.workcode != null and param.workcode != ''">
AND e.workcode like '%'+#{workcode}+'%'
AND e.workcode like '%'+#{param.workcode}+'%'
</if>
<!-- 部门 -->
<if test="param.departmentIds != null and param.departmentIds.size()>0">

View File

@ -265,7 +265,7 @@
AND payment_organization = #{paymentOrganization}
AND fund_scheme_id is not null
AND fund_start_time is not null AND fund_start_time <![CDATA[ <= ]]> #{billMonth}
AND (fund_end_time is null OR fund_end_time <![CDATA[ >= ]]> #{billMonth})
AND (fund_end_time is null OR fund_end_time <![CDATA[ >= ]]> #{billMonth} OR fund_end_time ='')
</select>
<select id="listAll" resultMap="BaseResultMap">

View File

@ -248,7 +248,7 @@
AND payment_organization = #{paymentOrganization}
AND other_scheme_id is not null
AND other_start_time is not null AND other_start_time <![CDATA[ <= ]]> #{billMonth}
AND (other_end_time is null OR other_end_time <![CDATA[ >= ]]> #{billMonth})
AND (other_end_time is null OR other_end_time <![CDATA[ >= ]]> #{billMonth} OR other_end_time ='')
</select>
<select id="listAll" resultMap="BaseResultMap">

View File

@ -908,7 +908,7 @@
AND payment_organization = #{paymentOrganization}
AND social_scheme_id is not null
AND social_start_time is not null AND social_start_time <![CDATA[ <= ]]> #{billMonth}
AND (social_end_time is null OR social_end_time <![CDATA[ >= ]]> #{billMonth})
AND (social_end_time is null OR social_end_time <![CDATA[ >= ]]> #{billMonth} OR social_end_time ='')
</select>
<select id="listAll" resultMap="BaseResultMap">

View File

@ -12,6 +12,7 @@ import java.util.List;
*/
public interface VariableArchiveItemService {
List<VariableArchiveItemPO> listAll();
/**
* 根据浮动薪资档案id获取
*

View File

@ -40,7 +40,7 @@ public interface VariableArchiveService {
* @param variableArchives
* @return
*/
List<Map<String, Object>> buildVariableArchiveData(Collection<VariableArchiveListDTO> variableArchives);
List<Map<String, Object>> buildVariableArchiveData(List<VariableArchiveListDTO> variableArchives);
/**
* 创建浮动薪酬档案
@ -70,4 +70,6 @@ public interface VariableArchiveService {
void deleteSelectVariableArchive(Collection<Long> deleteIds);
List<Map<String, Object>> listBySalaryMonthAndEmployeeIds(YearMonth salaryMonth, List<Long> employeeIds, Long taxAgentId);
void updateData(VariableArchiveSaveParam updateParam);
}

View File

@ -1125,7 +1125,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
// List<Map<String, Object>> data = ExcelParseHelper.parse2Map(sheet, 1);
List<Map<String, Object>> data;
// if (StringUtils.equals("importSalaryAcctResult", importType)) {
data = ExcelParseHelper.parse2Map(workbook, 0, 2, 1);
data = ExcelParseHelper.parse2Map(sheet, 2, 1);
// } else {
// data = ExcelParseHelper.parse2Map(sheet, 1);
// }

View File

@ -1,6 +1,7 @@
package com.engine.salary.service.impl;
import com.engine.core.impl.Service;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.datacollection.po.VariableArchiveItemPO;
import com.engine.salary.mapper.datacollection.VariableArchiveItemMapper;
import com.engine.salary.service.VariableArchiveItemService;
@ -18,11 +19,17 @@ import java.util.List;
* @description 浮动薪酬档案明细
*/
public class VariableArchiveItemServiceImpl extends Service implements VariableArchiveItemService {
private EncryptUtil encryptUtil = new EncryptUtil();
private VariableArchiveItemMapper getVariableArchiveItemMapper(){
return MapperProxyFactory.getProxy(VariableArchiveItemMapper.class);
}
@Override
public List<VariableArchiveItemPO> listAll() {
return getVariableArchiveItemMapper().listAll();
}
/**
* 根据浮动薪资档案id获取
*
@ -34,7 +41,8 @@ public class VariableArchiveItemServiceImpl extends Service implements VariableA
if (CollectionUtils.isEmpty(variableArchiveIds)) {
return Collections.emptyList();
}
return getVariableArchiveItemMapper().listSome(VariableArchiveItemPO.builder().variableArchiveIds(variableArchiveIds).build());
List<VariableArchiveItemPO> variableArchiveItemPOS = getVariableArchiveItemMapper().listSome(VariableArchiveItemPO.builder().variableArchiveIds(variableArchiveIds).build());
return encryptUtil.decryptList(variableArchiveItemPOS, VariableArchiveItemPO.class);
}
/**
@ -52,6 +60,7 @@ public class VariableArchiveItemServiceImpl extends Service implements VariableA
if (CollectionUtils.isEmpty(insertList)) {
return 0;
}
encryptUtil.encryptList(insertList, VariableArchiveItemPO.class);
List<List<VariableArchiveItemPO>> partition = Lists.partition(insertList, 50);
partition.forEach(part -> getVariableArchiveItemMapper().batchInsert(part));
return 0;

View File

@ -151,10 +151,7 @@ public class VariableArchiveServiceImpl extends Service implements VariableArchi
* @return
*/
@Override
public List<Map<String, Object>> buildVariableArchiveData(Collection<VariableArchiveListDTO> variableArchives) {
if (CollectionUtils.isEmpty(variableArchives)) {
// 无数据
}
public List<Map<String, Object>> buildVariableArchiveData(List<VariableArchiveListDTO> variableArchives) {
List<Long> variableArchiveIds = variableArchives.stream().map(VariableArchiveListDTO::getId).collect(Collectors.toList());
// 获取浮动薪资档案所对应的浮动薪资项目数据
List<VariableArchiveItemPO> variableArchiveItemList = getVariableArchiveItemService(user).listByVariableArchiveIds(variableArchiveIds);
@ -209,9 +206,7 @@ public class VariableArchiveServiceImpl extends Service implements VariableArchi
List<VariableArchivePO> variableArchivePOList = getVariableArchiveMapper().listSome(VariableArchivePO.builder().salaryMonth(saveParam.getSalaryMonthDate()).taxAgentId(saveParam.getTaxAgentIds()).employeeId(saveParam.getEmployeeId()).build());
if (CollectionUtils.isNotEmpty(variableArchivePOList)) {
// 先删除原有档案
List<Long> variableArchiveIds = variableArchivePOList.stream().map(VariableArchivePO::getId).collect(Collectors.toList());
getVariableArchiveMapper().deleteByIds(variableArchiveIds);
throw new SalaryRunTimeException("已存在浮动薪酬数据");
}
// 保存浮动薪资档案信息
@ -602,4 +597,41 @@ public class VariableArchiveServiceImpl extends Service implements VariableArchi
List<VariableArchiveListDTO> variableArchiveListDTO = list(queryParam);
return buildVariableArchiveData(variableArchiveListDTO);
}
@Override
public void updateData(VariableArchiveSaveParam updateParam) {
if (updateParam.getId() == null) {
throw new SalaryRunTimeException("参数错误");
}
// 获取浮动薪酬档案
VariableArchivePO variableArchivePO = getVariableArchiveMapper().getById(updateParam.getId());
if (variableArchivePO == null) {
throw new SalaryRunTimeException("浮动薪酬档案不存在或已被删除");
}
// 删除原有的浮动薪酬档案明细
getVariableArchiveItemService(user).deleteByArchiveIds(Collections.singletonList(updateParam.getId()));
// 保存浮动薪资档案详细信息
List<VariableArchiveItemPO> variableArchiveItemList = new ArrayList<>();
Date now = new Date();
updateParam.getItemValueList().forEach(e -> {
variableArchiveItemList.add(VariableArchiveItemPO.builder()
.id(IdGenerator.generate())
.employeeId(updateParam.getEmployeeId())
.variableArchiveId(variableArchivePO.getId())
.variableItemId(e.getVariableItemId())
.itemValue(e.getItemValue())
.creator(Long.valueOf(user.getUID()))
.createTime(now)
.updateTime(now)
.deleteType(NumberUtils.INTEGER_ZERO)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build());
});
if (CollectionUtils.isNotEmpty(variableArchiveItemList)) {
getVariableArchiveItemService(user).batchInsert(variableArchiveItemList);
}
}
}

View File

@ -11,6 +11,7 @@ import com.engine.salary.entity.datacollection.AddUpDeduction;
import com.engine.salary.entity.datacollection.AddUpSituation;
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
import com.engine.salary.entity.datacollection.po.SpecialAddDeductionPO;
import com.engine.salary.entity.datacollection.po.VariableArchiveItemPO;
import com.engine.salary.entity.salaryacct.po.ExcelAcctResultPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO;
@ -24,10 +25,7 @@ import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationDetailPO;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.archive.SalaryArchiveItemMapper;
import com.engine.salary.mapper.datacollection.AddUpDeductionMapper;
import com.engine.salary.mapper.datacollection.AddUpSituationMapper;
import com.engine.salary.mapper.datacollection.OtherDeductionMapper;
import com.engine.salary.mapper.datacollection.SpecialAddDeductionMapper;
import com.engine.salary.mapper.datacollection.*;
import com.engine.salary.mapper.salaryacct.ExcelAcctResultMapper;
import com.engine.salary.mapper.salaryacct.SalaryAcctResultMapper;
import com.engine.salary.mapper.siaccount.ExcelInsuranceDetailMapper;
@ -39,6 +37,8 @@ import com.engine.salary.mapper.siarchives.SocialSchemeMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
import com.engine.salary.mapper.sys.SalarySysConfMapper;
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationDetailMapper;
import com.engine.salary.service.VariableArchiveItemService;
import com.engine.salary.service.impl.VariableArchiveItemServiceImpl;
import com.engine.salary.sys.config.SysConfig;
import com.engine.salary.sys.constant.SalarySysConstant;
import com.engine.salary.sys.entity.param.AppSettingSaveParam;
@ -157,6 +157,9 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
return ServiceUtil.getService(SalarySysConfServiceImpl.class, user);
}
private VariableArchiveItemService getVariableArchiveItemService(User user) {
return ServiceUtil.getService(VariableArchiveItemServiceImpl.class, user);
}
/**
* 操作是否需要申报功能
@ -1234,14 +1237,42 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
return 1;
});
int flag = submit.get() + submit1.get() + submit2.get() + submit3.get() + submit4.get() + submit5.get() + submit6.get() + submit7.get() + submit8.get() + submit9.get() + submit10.get() + submit11.get() + submit12.get() + submit13.get() + submit14.get();
if (flag == 15) {
Future<Integer> submit15 = fixedThreadPool.submit(() -> {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
List<VariableArchiveItemPO> variableArchiveItemPOS = getVariableArchiveItemService(user).listAll();
if (CollectionUtils.isNotEmpty(variableArchiveItemPOS)) {
variableArchiveItemPOS.forEach(po -> {
if (OpenEnum.OFF.getValue().equals(isOpenEncrypt)) {
po.setItemValue(AESEncryptUtil.closeEncryptSetting(po.getItemValue(), sysConfPo));
} else {
po.setItemValue(AESEncryptUtil.encrypt(po.getItemValue()));
}
});
List<List<VariableArchiveItemPO>> partition = Lists.partition(variableArchiveItemPOS, 10);
VariableArchiveItemMapper mapper = sqlSession.getMapper(VariableArchiveItemMapper.class);
partition.forEach(mapper::updateBatchSelective);
sqlSession.commit();
log.info("finish hrsa_variable_archive_item");
}
} catch (Exception e) {
sqlSession.rollback();
log.error("fail hrsa_variable_archive_item", e);
return 0;
} finally {
sqlSession.close();
}
return 1;
});
int flag = submit.get() + submit1.get() + submit2.get() + submit3.get() + submit4.get() + submit5.get() + submit6.get() + submit7.get() + submit8.get() + submit9.get() + submit10.get() + submit11.get() + submit12.get() + submit13.get() + submit14.get() + submit15.get();
if (flag == 16) {
Util_DataCache.setObjVal(ENCRYPT_IN_PROGRESS + progressId, "success", 30);
} else {
Util_DataCache.setObjVal(ENCRYPT_IN_PROGRESS + progressId, "fail", 30);
}
Util_DataCache.clearVal(AES_ENCRYPT_IN_PROGRESS);
return flag == 15;
return flag == 16;
} catch (Exception e) {
Util_DataCache.setObjVal(ENCRYPT_IN_PROGRESS + progressId, "fail", 30);
Util_DataCache.clearVal(AES_ENCRYPT_IN_PROGRESS);

View File

@ -111,7 +111,12 @@ public class VariableArchiveController {
@Produces(MediaType.APPLICATION_JSON)
public String createData(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody VariableArchiveSaveParam saveParam) {
User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<VariableArchiveSaveParam, String>(user).run(getVariableArchiveWrapper(user)::createData, saveParam);
if (saveParam.getId() == null) {
return new ResponseResult<VariableArchiveSaveParam, String>(user).run(getVariableArchiveWrapper(user)::createData, saveParam);
} else {
// 更新
return new ResponseResult<VariableArchiveSaveParam, String>(user).run(getVariableArchiveWrapper(user)::updateData, saveParam);
}
}

View File

@ -52,7 +52,7 @@ public class VariableArchiveWrapper extends Service {
//薪资档案列表
PageInfo<VariableArchiveListDTO> pageInfo = getVariableArchiveService(user).listPage(queryParam);
Collection<VariableArchiveListDTO> salaryArchives = pageInfo.getList();
List<VariableArchiveListDTO> salaryArchives = pageInfo.getList();
// 获取所有浮动薪酬项目
List<VariableItemPO> variableItems = getVariableItemService(user).listAll();
@ -123,4 +123,8 @@ public class VariableArchiveWrapper extends Service {
public void deleteSelectVariableArchive(Collection<Long> deleteIds) {
getVariableArchiveService(user).deleteSelectVariableArchive(deleteIds);
}
public void updateData(VariableArchiveSaveParam updateParam) {
getVariableArchiveService(user).updateData(updateParam);
}
}