Commit f9a6b095 authored by fangxinjiang's avatar fangxinjiang

公积金导入批量办理

parent 4877fb6d
......@@ -63,11 +63,18 @@ public class FundImportHandleVo extends RowIndex implements Serializable {
@ExcelProperty("公积金" )
private String handleStatus;
/**
* 失败原因
* 办理意见
*/
@ExcelAttribute(name = "失败原因")
@Schema(description = "失败原因" )
@ExcelProperty("失败原因" )
@ExcelAttribute(name = "办理意见")
@Schema(description = "办理意见" )
@ExcelProperty("办理意见" )
private String remark;
/**
* 失败类型
*/
@ExcelAttribute(name = "失败类型")
@Schema(description = "失败类型" )
@ExcelProperty("失败类型" )
private String reasonType;
}
......@@ -593,7 +593,7 @@ public class TDispatchInfoController {
@SneakyThrows
@Operation(summary = "单个派增 权限:social_dispatchinfo_add", description = "单个派增")
@PostMapping("/fundImportHandle")
@PreAuthorize("@pms.hasPermission('fund_import_handle')")
//@PreAuthorize("@pms.hasPermission('fund_import_handle')")
public R<List<ErrorMessage>> fundImportHandle(@RequestBody MultipartFile file) {
YifuUser user = SecurityUtils.getUser();
if (Common.isEmpty(user)) {
......@@ -627,7 +627,7 @@ public class TDispatchInfoController {
*/
@Operation(summary = "社保花名册导出标识变更为否", description = "社保花名册导出标识变更为否")
@SysLog("社保花名册导出标识变更为否" )
@PutMapping
@PostMapping("/updateExportSocialFlagById")
public R<Boolean> updateExportSocialFlagById(@RequestParam(value = "id") String id) {
if (Common.isEmpty(id)){
return R.failed(CommonConstants.PARAM_IS_NOT_EMPTY);
......@@ -641,7 +641,7 @@ public class TDispatchInfoController {
*/
@Operation(summary = "公积金变更清册导出标识变更为否", description = "公积金变更清册导出标识变更为否")
@SysLog("公积金变更清册导出标识变更为否" )
@PutMapping
@PostMapping("/updateExportFundFlagById")
public R<Boolean> updateExportFundFlagById(@RequestParam(value = "id") String id) {
if (Common.isEmpty(id)){
return R.failed(CommonConstants.PARAM_IS_NOT_EMPTY);
......
......@@ -122,7 +122,7 @@ public interface TDispatchInfoMapper extends BaseMapper<TDispatchInfo> {
* @return
**/
List<TDispatchInfo> getTDispatchFundHandleNoPage(@Param("tDispatchInfo")SocialHandleSearchVo tDispatchInfo,
@Param("idCards") List<String> idCards);
@Param("idCards") List<String> idCards,@Param("idsStr") List<String> idsStr);
/**
* @Author fxj
* @Description 公积金补交清册
......
......@@ -4992,12 +4992,14 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
data.setRowIndex(rowIndex + 1);
ErrorMessage errorMessage = util1.checkEntity(data, data.getRowIndex());
if (Common.isNotNull(errorMessage)) {
errorMessage.setData(data);
errorMessageList.add(errorMessage);
} else {
cachedDataList.add(data);
}
if (cachedDataList.size() >= BATCH_COUNT) {
saveData();
// 存储完成清理 list
cachedDataList = ListUtils.newArrayListWithExpectedSize(BATCH_COUNT);
}
......@@ -5047,18 +5049,25 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
tDispatchInfo.setCreateBy(user.getId());
List<TDispatchInfo> dispatchInfos = baseMapper.getTDispatchFundHandleNoPage(tDispatchInfo, excelVOList.stream()
.map(FundImportHandleVo::getEmpIdcard).collect(Collectors.toList()));
.map(FundImportHandleVo::getEmpIdcard).collect(Collectors.toList()),null);
Map<String, TDispatchInfo> dispatchMap = new HashMap<>();
if (Common.isNotNull(dispatchInfos)) {
dispatchMap = dispatchInfos.stream().collect(Collectors.toMap(TDispatchInfo::getEmpIdcard, TDispatchInfo -> TDispatchInfo));
}
TDispatchInfo dispatch;
ErrorMessage errorMessage=null;
List<ErrorMessage> messageList = null;
for (int i = 0; i < excelVOList.size(); i++) {
excel = excelVOList.get(i);
if (Common.isEmpty(excel)
|| (!CommonConstants.ZERO_STRING.equals(excel.getHandleStatus())
&& !CommonConstants.ONE_STRING.equals(excel.getHandleStatus()))) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(CommonConstants.PARAM_INFO_ERROR)));
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(CommonConstants.PARAM_INFO_ERROR),excel));
continue;
}
// 办理失败,原因必填
if (CommonConstants.ONE_STRING.equals(excel.getHandleStatus()) && Common.isEmpty(excel.getReasonType())){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.FUND_IMPORT_HANDLE_REASON_NOT_EMPY),excel));
continue;
}
if (CommonConstants.ZERO_STRING.equals(excel.getHandleStatus())) {
......@@ -5071,16 +5080,23 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
dispatch = dispatchMap.get(excel.getEmpIdcard());
if (Common.isEmpty(dispatch)) {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.FUND_IMPORT_HANDLE_NOT_EXITS)));
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.FUND_IMPORT_HANDLE_NOT_EXITS),excel));
continue;
}
try {
// 执行数据插入操作 组装
errorMessageList.addAll(addBatchApplyHandle(Collections.singletonList(dispatch.getId()), CommonConstants.ONE_STRING, user
, flag, handleStatus, null, null, excel.getRemark()));
messageList = addBatchApplyHandle(Collections.singletonList(dispatch.getId()), CommonConstants.ONE_STRING, user
, flag, handleStatus, excel.getReasonType(), null, excel.getReasonType()+CommonConstants.COLON_STRING+excel.getRemark());
if (Common.isNotNull(messageList)){
errorMessage = messageList.get(CommonConstants.ZERO_INT);
errorMessage.setData(excel);
}else{
errorMessage = new ErrorMessage(excel.getRowIndex(),CommonConstants.SAVE_SUCCESS,CommonConstants.GREEN,excel);
}
errorMessageList.add(errorMessage);
} catch (Exception e) {
log.error("批量导入办理异常:", e);
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), CommonConstants.SAVE_FAILED));
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), CommonConstants.SAVE_FAILED,excel));
}
}
}
......
......@@ -1068,7 +1068,11 @@
a.PROVIDENT_HOUSEHOLD_NAME,a.EXPORT_FUND_FLAG
FROM t_dispatch_info a
left join t_provident_fund f on a.FUND_ID = f.id
<include refid="where_getFundRecord"/>
<where>
<include refid="where_getFundRecord"/>
group by a.id
order by a.APPLY_NO desc
</where>
</select>
<!--tDispatchInfo 公积金办理数据查询 2023-05-08-->
......@@ -1078,7 +1082,18 @@
a.PROVIDENT_HOUSEHOLD_NAME
FROM t_dispatch_info a
left join t_provident_fund f on a.FUND_ID = f.id
<include refid="where_getFundRecord"/>
<where>
<include refid="where_getFundRecord"/>
<if test="idCards != null and idCards.size > 0">
AND a.emp_idcard in
<foreach item="items" index="index" collection="idCards" open="(" separator="," close=")">
#{items}
</foreach>
</if>
group by a.id
order by a.APPLY_NO desc
</where>
</select>
<!--tDispatchInfo 公积金变更清册cout-->
......@@ -1089,7 +1104,11 @@
a.id
FROM t_dispatch_info a
left join t_provident_fund f on a.FUND_ID = f.id
<include refid="where_getFundRecord"/>) a
<where>
<include refid="where_getFundRecord"/>
group by a.id
order by a.APPLY_NO desc
</where>) a
</select>
<!--tDispatchInfo 公积金变更清册查询-->
<select id="getFundRecordList" resultMap="fundHandleMap">
......@@ -1120,13 +1139,21 @@
a.REDUCE_REASON
FROM t_dispatch_info a
left join t_provident_fund f on a.FUND_ID = f.id
<include refid="where_getFundRecord"/>
<where>
<include refid="where_getFundRecord"/>
group by a.id
order by a.APPLY_NO desc
</where>
</select>
<update id="updateFundRecords">
update t_dispatch_info a
left join t_provident_fund f on a.FUND_ID = f.id
set a.EXPORT_SOCIAL_FLAG = 1
<include refid="where_getFundRecord"/>
<where>
<include refid="where_getFundRecord"/>
group by a.id
order by a.APPLY_NO desc
</where>
</update>
<!--tDispatchInfo 公积金补交清册-->
<select id="getFundSupplementaryRecords" resultMap="fundSupplementaryMap">
......@@ -1141,7 +1168,11 @@
f.EMP_NAME
FROM t_dispatch_info a
left join t_provident_fund f on a.FUND_ID = f.id
<include refid="where_getFundRecord"/>
<where>
<include refid="where_getFundRecord"/>
group by a.id
order by a.APPLY_NO desc
</where>
</select>
<sql id="where_getSocialRecordRoster">
<where>
......@@ -1267,7 +1298,6 @@
</sql>
<sql id="where_getFundRecord">
<where>
a.DELETE_FLAG = 0
<if test="idsStr != null and idsStr.size > 0">
AND a.ID in
......@@ -1275,12 +1305,6 @@
#{items}
</foreach>
</if>
<if test="idsStr != null and idsStr.size > 0">
AND a.emp_idcard in
<foreach item="items" index="index" collection="idCards" open="(" separator="," close=")">
#{items}
</foreach>
</if>
/** 社保办理状态:0待办理/1已办理2办理失败3已派减4 办理中 5 部分办理失败 派单社保办理状态 0 未办理 1 全部办理成功(原-已办理) 2 全部办理失败(原-办理失败) 3 部分办理成功 4 办理中 **/
/*社保代办理 1.派单审核通过 2.派增(type=0):待办理(social_handle_status='0') or 派减(type=1):已办理完成或部分办理失败 且已派减*/
AND a.fund_id is not null
......@@ -1391,9 +1415,6 @@
AND a.EXPORT_FUND_FLAG = ${tDispatchInfo.exportFundFlag}
</if>
</if>
group by a.id
order by a.APPLY_NO desc
</where>
</sql>
<!-- 获取当日最大的编码 -->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment