Commit 7eb029d3 authored by hongguangwu's avatar hongguangwu

MVP1.6.4-社保士兵相关代码4

parent c85ca6f1
......@@ -33,6 +33,7 @@ public class DispatchConstants {
public static final String DISPATCH_FUND_REDUCE = "公积金派减";
public static final String DISPATCH_SOCIAL_REDUCE = "社保派减";
public static final String SOCIAL_RECORD_ROSTER_EXPORT = "社保花名册导出";
public static final String SOCIAL_SOLDIER_EXPORT = "社保士兵导出";
public static final String SOCIAL_RECORD_EXPORT = "公积金变更清册导出";
public static final String SOCIAL_MEDICAL_EXPORT = "社保-医疗";
public static final String SOCIAL_PERSION_EXPORT = "社保-养老三险";
......
package com.yifu.cloud.plus.v1.yifu.social.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
* @Author hgw
* @Description 社保士兵自动办理导出
* @Date 2024-5-13 10:56:51
* @Param
* @return
**/
@Data
public class SocialSoldierExportVo implements Serializable {
////@ExcelAttribute(name = "派单类型", errorInfo = "派单类型不能为空", maxLength = 1, isDataId = true, readConverterExp = "0=派增,1=派减", needExport = true)
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("派单类型")
private String type;
@Schema(description = "办理状态")
//@ExcelAttribute(name = "办理状态", readConverterExp = "0=未办理,1=全部办理成功,2=全部办理失败,3=部分办理成功,4=办理中", needExport = true)
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("办理状态")
private String socialHandleStatus;
//@ExcelAttribute(name = "养老工伤失业-办理状态", readConverterExp = "0=无,1=待办理,2=自动办理中,3=继续办理,4=中止办理,5=人工处理,6=成功", needExport = true)
@Schema(description = "养老工伤失业-办理状态")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("养老工伤失业-办理状态")
private String ygsHandleStatus;
//@ExcelAttribute(name = "医保生育大病-办理状态", readConverterExp = "0=无,1=待办理,2=自动办理中,3=继续办理,4=中止办理,5=人工处理,6=成功", needExport = true)
@Schema(description = "医保生育大病-办理状态")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("医保生育大病-办理状态")
private String ysdHandleStatus;
//@ExcelAttribute(name = "养老工伤失业-失败原因", maxLength = 500, needExport = true)
@Schema(description = "养老工伤失业-失败原因")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("养老工伤失业-失败原因")
private String ygsRemark;
//@ExcelAttribute(name = "医保生育大病-失败原因", maxLength = 500, needExport = true)
@Schema(description = "医保生育大病-失败原因")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("医保生育大病-失败原因")
private String ysdRemark;
//@ExcelAttribute(name = "申请编码", maxLength = 30, needExport = true)
@Schema(description = "申请编码")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("申请编码")
private String dispatchCode;
//@ExcelAttribute(name = "员工姓名", errorInfo = "员工姓名不能为空", maxLength = 50, needExport = true)
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("员工姓名")
private String empName;
//@ExcelAttribute(name = "身份证号", needExport = true)
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("身份证号")
private String empIdcard;
//@ExcelAttribute(name = "员工类型", errorInfo = "员工类型不能为空", isDataId = true, dataType = ExcelAttributeConstants.EMP_NATRUE, needExport = true)
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("员工类型")
private String empType;
/**
* 所属单位
*/
//@ExcelAttribute(name = "客户名称", isNotEmpty = true, needExport = true)
@Schema(description = "客户名称(所属单位)")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("客户名称")
private String belongUnit;
/**
* 项目名称
*/
//@ExcelAttribute(name = "项目名称", isNotEmpty = true, needExport = true)
@Schema(description = "项目名称(项目)")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("项目名称")
private String settleDomain;
//@ExcelAttribute(name = "项目编码", maxLength = 32, needExport = true)
@Schema(description = "项目编码")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("项目编码")
private String settleDomainCode;
//@ExcelAttribute(name = "社保户", needExport = true)
@Schema(description = "社保户")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("社保户")
private String socialHouseholdName;
/**
* 缴纳地-省
*/
//@ExcelAttribute(name = "社保缴纳地-省", maxLength = 32, isArea = true, needExport = true)
@Schema(description = "社保缴纳地-省")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("社保缴纳地-省")
private String socialProvince;
//@ExcelAttribute(name = "离职日期", isDate = true, needExport = true)
@Schema(description = "离职日期")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("离职日期")
private Date leaveDate;
//@ExcelAttribute(name = "派单项", maxLength = 50, needExport = true)
@Schema(description = "派单项:如 养老、公积金")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("派单项:如 养老、公积金")
private String dispatchItem;
//@ExcelAttribute(name = "申请人", needExport = true)
@Schema(description = "申请人")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("申请人")
private String createUserName;
//@ExcelAttribute(name = "申请人所在部门", maxLength = 50, needExport = true)
@Schema(description = "申请人所在部门")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("申请人所在部门")
private String organName;
//@ExcelAttribute(name = "申请时间", isDate = true, needExport = true)
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("申请时间")
private LocalDateTime createTime;
//@ExcelAttribute(name = "审核人", maxLength = 50, needExport = true)
@Schema(description = "审核人")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("审核人")
private String auditUserName;
//@DateTimeFormat("yyyy-MM-dd")
//@ExcelAttribute(name = "审核时间", isDate = true, needExport = true)
@Schema(description = "审核时间")
@HeadFontStyle(fontHeightInPoints = 11)
@ExcelProperty("审核时间")
private Date auditTime;
}
......@@ -603,6 +603,27 @@ public class TDispatchInfoController {
}
}
/**
* @Author hgw
* @Description 导出社保士兵信息
* @Date 2024-5-13 11:35:26
* @Param
**/
@PostMapping("/doExportSocialSoldier")
@Operation(description = "导出社保士兵信息")
@SysLog("导出社保士兵信息")
public void doExportSocialSoldier(HttpServletResponse response, HttpServletRequest request,
@RequestBody SocialHandleSearchVo searchVo) {
searchVo.setDeleteFlag(CommonConstants.ZERO_STRING);
YifuUser user = SecurityUtils.getUser();
menuUtil.setAuthSql(user, searchVo);
if (Common.isNotNull(searchVo.getAuthSql()) && searchVo.getAuthSql().contains(CommonConstants.A_DEPT_ID)) {
searchVo.setAuthSql(searchVo.getAuthSql().replace(CommonConstants.A_DEPT_ID, "a.SETTLE_DOMAIN"));
}
searchVo.setCreateBy(user.getId());
tDispatchInfoService.doExportSocialSoldier(response,searchVo,searchVo.getIdStr(),null);
}
/**
* @Author fxj
* @Description 导出 社保花名册
......
......@@ -20,6 +20,7 @@ package com.yifu.cloud.plus.v1.yifu.social.controller;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.log.annotation.SysLog;
import com.yifu.cloud.plus.v1.yifu.common.security.annotation.Inner;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialSoldierPushService;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialSoldierService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
......@@ -42,6 +43,7 @@ import java.util.List;
public class TSocialSoldierController {
private final TSocialSoldierService tSocialSoldierService;
private final TSocialSoldierPushService tSocialSoldierPushService;
/**
* @param addId 任务id,可为空
......@@ -66,7 +68,7 @@ public class TSocialSoldierController {
@Operation(description = "推送社保士兵")
@PostMapping("/pushSoldier")
public R<String> pushSoldier(@RequestBody(required = false) List<String> dispatchIdList) {
return tSocialSoldierService.pushSoldier(dispatchIdList);
return tSocialSoldierPushService.pushSoldier(dispatchIdList);
}
/**
......@@ -94,6 +96,6 @@ public class TSocialSoldierController {
@SysLog("每日2定时任务推送社保士兵")
@Inner
public R<String> doInnerPushSoldier() {
return tSocialSoldierService.pushSoldier(null);
return tSocialSoldierPushService.pushSoldier(null);
}
}
......@@ -63,31 +63,6 @@ public interface TDispatchInfoMapper extends BaseMapper<TDispatchInfo> {
long selectExportCount(@Param("tDispatchInfo") TDispatchInfoSearchVo tDispatchInfo);
/**
* 社保士兵养工失增加模板
* @Author hgw
* @Date 2024-5-10 21:16:41
**/
List<SocialSoldierYgsAddVo> getSocialSoldierYgsAddVoList(@Param("idsStr") List<String> idsStr);
/**
* 社保士兵养工失增加模板
* @Author hgw
* @Date 2024-5-10 21:16:41
**/
List<SocialSoldierYgsReduceVo> getSocialSoldierYgsReduceVoList(@Param("idsStr") List<String> idsStr);
/**
* 社保士兵养工失增加模板
* @Author hgw
* @Date 2024-5-10 21:16:41
**/
List<SocialSoldierYsdAddVo> getSocialSoldierYsdAddVoList(@Param("idsStr") List<String> idsStr);
/**
* 社保士兵养工失增加模板
* @Author hgw
* @Date 2024-5-10 21:16:41
**/
List<SocialSoldierYsdReduceVo> getSocialSoldierYsdReduceVoList(@Param("idsStr") List<String> idsStr);
/**
* 导出社保花名册数据查询
* @Author fxj
......@@ -119,6 +94,17 @@ public interface TDispatchInfoMapper extends BaseMapper<TDispatchInfo> {
int getSocialRecordRosterListCount(@Param("tDispatchInfo") SocialHandleSearchVo dispatchInfo,
@Param("idsStr") List<String> idsStr);
/**
* 导出社保士兵list
**/
List<SocialSoldierExportVo> getSocialSoldierList(@Param("tDispatchInfo") SocialHandleSearchVo dispatchInfo,
@Param("idsStr") List<String> idsStr);
/**
* 导出社保士兵count
**/
int getSocialSoldierCount(@Param("tDispatchInfo") SocialHandleSearchVo dispatchInfo,
@Param("idsStr") List<String> idsStr);
/**
* @Description: 社保士兵列表查询
* @Author: hgw
......
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.social.entity.TDispatchInfo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialInfo;
import com.yifu.cloud.plus.v1.yifu.social.vo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 社保士兵Mapper
* @author hgw
* @date 2024-5-13 11:54:57
*/
@Mapper
public interface TSocialSoldierMapper extends BaseMapper<TSocialInfo> {
/**
* 社保士兵养工失增加模板
* @Author hgw
* @Date 2024-5-10 21:16:41
**/
List<SocialSoldierYgsAddVo> getSocialSoldierYgsAddVoList(@Param("idsStr") List<String> idsStr);
/**
* 社保士兵养工失增加模板
* @Author hgw
* @Date 2024-5-10 21:16:41
**/
List<SocialSoldierYgsReduceVo> getSocialSoldierYgsReduceVoList(@Param("idsStr") List<String> idsStr);
/**
* 社保士兵养工失增加模板
* @Author hgw
* @Date 2024-5-10 21:16:41
**/
List<SocialSoldierYsdAddVo> getSocialSoldierYsdAddVoList(@Param("idsStr") List<String> idsStr);
/**
* 社保士兵养工失增加模板
* @Author hgw
* @Date 2024-5-10 21:16:41
**/
List<SocialSoldierYsdReduceVo> getSocialSoldierYsdReduceVoList(@Param("idsStr") List<String> idsStr);
}
......@@ -83,6 +83,13 @@ public interface TDispatchInfoService extends IService<TDispatchInfo> {
R<List<ErrorMessage>> addApplyHandle(List<String> ids, String typeSub, String handleStatus, String handleRemark, String socialType, String remark, YifuUser user);
/**
* @Description: 社保士兵导出
* @Author: hgw
* @Date: 2024/5/13 11:34
* @return: void
**/
void doExportSocialSoldier(HttpServletResponse response, SocialHandleSearchVo searchVo, String idStr, String[] exportFields);
void doexportSocialRecordRoster(HttpServletResponse response, SocialHandleSearchVo searchVo, String idStr, String[] exportFields);
/**
......@@ -153,15 +160,4 @@ public interface TDispatchInfoService extends IService<TDispatchInfo> {
**/
List<SocialHandleExportVo> getRecordRosterList(SocialHandleSearchVo searchVo, String idStr);
/**
* @Description: 社保士兵养工失增加模板
* @Author: hgw
* @Date: 2024-5-10 21:26:23
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.social.vo.SocialHandleExportVo>
**/
List<SocialSoldierYgsAddVo> getSocialSoldierYgsAddVoList(List<String> idList);
List<SocialSoldierYgsReduceVo> getSocialSoldierYgsReduceVoList(List<String> idList);
List<SocialSoldierYsdAddVo> getSocialSoldierYsdAddVoList(List<String> idList);
List<SocialSoldierYsdReduceVo> getSocialSoldierYsdReduceVoList(List<String> idList);
}
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialInfo;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
* 社保士兵-推送
*
* @author hgw
* @date 2024-5-8 14:55:24
*/
public interface TSocialSoldierPushService extends IService<TSocialInfo> {
/**
* @Description: 根据文件,推送到社保士兵。注意社保id别搞错了,否则塞值到社保里就塞错了
* @Author: hgw
* @Date: 2024/5/11 14:46
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> getOneAppGetModuleDetail(List<TSocialInfo> socialIdList, MultipartFile file, String type);
/**
* @param dispatchIdList
* @Description: 根据派单id,获取要派增派减的社保、医保数据,生成文件,推送到社保士兵
* @Author: hgw
* @Date: 2024/5/10 17:52
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> pushSoldier(List<String> dispatchIdList);
}
......@@ -20,9 +20,6 @@ package com.yifu.cloud.plus.v1.yifu.social.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialInfo;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
* 社保士兵
......@@ -32,22 +29,6 @@ import java.util.List;
*/
public interface TSocialSoldierService extends IService<TSocialInfo> {
/**
* @Description: 根据文件,推送到社保士兵。注意社保id别搞错了,否则塞值到社保里就塞错了
* @Author: hgw
* @Date: 2024/5/11 14:46
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> getOneAppGetModuleDetail(List<TSocialInfo> socialIdList, MultipartFile file, String type);
/**
* @param dispatchIdList
* @Description: 根据派单id,获取要派增派减的社保、医保数据,生成文件,推送到社保士兵
* @Author: hgw
* @Date: 2024/5/10 17:52
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
R<String> pushSoldier(List<String> dispatchIdList);
/**
* @param addId
......
......@@ -18,6 +18,7 @@ package com.yifu.cloud.plus.v1.yifu.social.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.metadata.Head;
......@@ -5041,6 +5042,89 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
}
}
/**
* @Author hgw
* @Description 社保士兵导出 count
* @Date 2024-5-13 11:30:12
* @Param
* @return
**/
private int getSocialSoldierCount(SocialHandleSearchVo searchVo, String idStr) {
List<String> ids = new ArrayList<>();
if (Common.isNotNull(idStr)){
ids = Common.initStrToList(idStr,CommonConstants.COMMA_STRING);
}
return baseMapper.getSocialSoldierCount(searchVo,ids);
}
private List<SocialSoldierExportVo> getSocialSoldierList(SocialHandleSearchVo searchVo, String idStr) {
return baseMapper.getSocialSoldierList(searchVo,Common.getList(idStr));
}
/**
* @Author hgw
* @Description 导出 社保士兵
* @Date 2024-5-13 11:28:08
* @Param
* @return
**/
@Override
public void doExportSocialSoldier(HttpServletResponse response, SocialHandleSearchVo searchVo, String idStr, String[] exportFields) {
String fileName = DispatchConstants.SOCIAL_SOLDIER_EXPORT + DateUtil.getThisTime() + CommonConstants.XLSX;
//获取要导出的列表
List<SocialSoldierExportVo> list = new ArrayList<>();
long count = getSocialSoldierCount(searchVo,idStr);
ServletOutputStream out = null;
try {
out = response.getOutputStream();
response.setContentType(CommonConstants.MULTIPART_FORM_DATA);
response.setHeader(CommonConstants.CONTENT_DISPOSITION, CommonConstants.ATTACHMENT_FILENAME + URLEncoder.encode(fileName , CommonConstants.UTF8));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcelFactory.write(out, SocialSoldierExportVo.class).build();
int index = 0;
if (count > CommonConstants.ZERO_INT){
WriteSheet writeSheet;
ExcelUtil<SocialSoldierExportVo> util;
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) {
// 获取实际记录
searchVo.setLimitStart(i);
searchVo.setLimitEnd(CommonConstants.EXCEL_EXPORT_LIMIT);
list = getSocialSoldierList(searchVo,idStr);
if (Common.isNotNull(list)){
writeSheet = EasyExcelFactory.writerSheet(DispatchConstants.SOCIAL_SOLDIER_EXPORT+index).build();
excelWriter.write(list,writeSheet);
index++;
}
if (Common.isNotNull(list)){
list.clear();
}
updateSocialRecords(searchVo,idStr);
}
excelWriter.finish();
}else {
WriteSheet writeSheet = EasyExcelFactory.writerSheet(DispatchConstants.SOCIAL_SOLDIER_EXPORT+index).build();
excelWriter.write(list,writeSheet);
excelWriter.finish();
}
if (Common.isNotNull(list)){
list.clear();
}
out.flush();
}catch (Exception e){
log.error("执行异常" ,e);
}finally {
try {
if (null != out) {
out.close();
}
} catch (IOException e) {
log.error("执行异常", e);
}
}
}
/**
* @Author fxj
* @Description 导出 社保花名册
......@@ -5136,46 +5220,6 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
return baseMapper.getSocialRecordRosterList(searchVo,Common.getList(idStr));
}
/**
* @Description: 社保士兵养工失增加模板
* @Author: hgw
* @Date: 2024/5/10 21:25
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYgsAddVo>
**/
@Override
public List<SocialSoldierYgsAddVo> getSocialSoldierYgsAddVoList(List<String> idList) {
return baseMapper.getSocialSoldierYgsAddVoList(idList);
}
/**
* @Description: 社保士兵养工失增加模板
* @Author: hgw
* @Date: 2024/5/10 21:25
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYgsAddVo>
**/
@Override
public List<SocialSoldierYgsReduceVo> getSocialSoldierYgsReduceVoList(List<String> idList) {
return baseMapper.getSocialSoldierYgsReduceVoList(idList);
}
/**
* @Description: 社保士兵养工失增加模板
* @Author: hgw
* @Date: 2024/5/10 21:25
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYgsAddVo>
**/
@Override
public List<SocialSoldierYsdAddVo> getSocialSoldierYsdAddVoList(List<String> idList) {
return baseMapper.getSocialSoldierYsdAddVoList(idList);
}
/**
* @Description: 社保士兵养工失增加模板
* @Author: hgw
* @Date: 2024/5/10 21:25
* @return: java.util.List<com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYgsAddVo>
**/
@Override
public List<SocialSoldierYsdReduceVo> getSocialSoldierYsdReduceVoList(List<String> idList) {
return baseMapper.getSocialSoldierYsdReduceVoList(idList);
}
private boolean updateSocialRecords(SocialHandleSearchVo searchVo, String idStr) {
return baseMapper.updateSocialRecords(searchVo,Common.getList(idStr)) >= 0;
}
......
/*
* Copyright (c) 2018-2025, lengleng All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the yifu4cloud.com developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: lengleng (wangiegie@gmail.com)
*/
package com.yifu.cloud.plus.v1.yifu.social.service.impl;
import com.alibaba.excel.EasyExcelFactory;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.social.config.SocialConfig;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialInfo;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialSoldierMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialInfoService;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialSoldierPushService;
import com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYgsAddVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYgsReduceVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYsdAddVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYsdReduceVo;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.compress.utils.IOUtils;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import java.io.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
* 社保士兵-推送
*
* @author hgw
* @date 2024-5-8 14:55:36
*/
@AllArgsConstructor
@Log4j2
@Service
public class TSocialSoldierPushServiceImpl extends ServiceImpl<TSocialSoldierMapper, TSocialInfo> implements TSocialSoldierPushService {
private RestTemplate restTemplate = new RestTemplate();
private final SocialConfig socialConfig;
private final TSocialInfoService tSocialInfoService;
/**
* @param socialList
* @param file
* @param type
* @Description: 推送到社保士兵,更新社保表的任务id与状态
* @Author: hgw
* @Date: 2024/5/11 15:24
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Override
public R<String> getOneAppGetModuleDetail(List<TSocialInfo> socialList, MultipartFile file, String type) {
// 1获取模板id——社保增员、社保减员、医保增员、医保减员
Map<String, String> moduleDetailMap = socialConfig.getOneModuleDetailMap(restTemplate);
if (moduleDetailMap != null && !moduleDetailMap.isEmpty() && moduleDetailMap.get(type) != null) {
// 2获取机器id
String terminalId = socialConfig.getTwoTerminalId(restTemplate, moduleDetailMap.get(type));
if (Common.isNotNull(terminalId)) {
// 3上传文件,获取文件地址
String fileAddUrl = socialConfig.getThreeTerminalId(restTemplate, file);
log.info(fileAddUrl);
// 4 推送办理任务,返回任务id:
String addId = socialConfig.getFourAppAdd(restTemplate, fileAddUrl, moduleDetailMap.get(type), terminalId);
log.info(addId);
for (TSocialInfo socialInfo : socialList) {
socialInfo.setYgsAddId(addId);
if ("社保增员".equals(type) || "社保减员".equals(type)) {
socialInfo.setYgsHandleStatus(CommonConstants.TWO_STRING);
} else {
socialInfo.setYsdHandleStatus(CommonConstants.TWO_STRING);
}
}
tSocialInfoService.updateBatchById(socialList);
}
}
return R.ok("推送成功!");
}
public MultipartFile getFile(Collection<?> list, Class head) {
File file = null;
if (list != null) {
String filePath = "socialFile" + DateUtil.getThisTime() + CommonConstants.XLSX;
EasyExcelFactory.write(filePath, head).sheet("社保明细").doWrite(list);
file = new File(filePath);
}
if (file != null) {
return getMultipartFile(file);
}
return null;
}
public static MultipartFile getMultipartFile(File file) {
FileItem item = new DiskFileItemFactory().createItem("file", MediaType.MULTIPART_FORM_DATA_VALUE, true, file.getName());
try (InputStream input = new FileInputStream(file); OutputStream os = item.getOutputStream()) {
// 流转移
IOUtils.copy(input, os);
} catch (Exception e) {
throw new IllegalArgumentException("Invalid file: " + e, e);
} finally {
//删除临时文件
try {
org.apache.commons.io.FileUtils.forceDelete(file);
} catch (IOException e) {
e.printStackTrace();
}
}
return new CommonsMultipartFile(item);
}
/**
* @Description: 推送到社保士兵
* @Author: hgw
* @Date: 2024/5/10 17:53
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Override
public R<String> pushSoldier(List<String> dispatchIdList) {
// 社保增员、社保减员、医保增员、医保减员
// 养工失新增列表
List<SocialSoldierYgsAddVo> ygsAddlist = baseMapper.getSocialSoldierYgsAddVoList(dispatchIdList);
if (ygsAddlist != null && !ygsAddlist.isEmpty()) {
List<TSocialInfo> socialIdList = new ArrayList<>();
TSocialInfo socialInfo;
for (SocialSoldierYgsAddVo vo : ygsAddlist) {
socialInfo = new TSocialInfo();
socialInfo.setId(vo.getSocialId());
socialIdList.add(socialInfo);
}
MultipartFile file = this.getFile(ygsAddlist, SocialSoldierYgsAddVo.class);
if (Common.isNotNull(file)) {
this.getOneAppGetModuleDetail(socialIdList, file, "社保增员");
}
}
// 养工失减少列表
List<SocialSoldierYgsReduceVo> ygsReducelist = baseMapper.getSocialSoldierYgsReduceVoList(dispatchIdList);
if (ygsReducelist != null && !ygsReducelist.isEmpty()) {
List<TSocialInfo> socialIdList = new ArrayList<>();
TSocialInfo socialInfo;
for (SocialSoldierYgsReduceVo vo : ygsReducelist) {
socialInfo = new TSocialInfo();
socialInfo.setId(vo.getSocialId());
socialIdList.add(socialInfo);
}
MultipartFile file = this.getFile(ygsReducelist, SocialSoldierYgsReduceVo.class);
if (Common.isNotNull(file)) {
this.getOneAppGetModuleDetail(socialIdList, file, "社保减员");
}
}
// 医生大新增列表
List<SocialSoldierYsdAddVo> ysdAddlist = baseMapper.getSocialSoldierYsdAddVoList(dispatchIdList);
if (ysdAddlist != null && !ysdAddlist.isEmpty()) {
List<TSocialInfo> socialIdList = new ArrayList<>();
TSocialInfo socialInfo;
for (SocialSoldierYsdAddVo vo : ysdAddlist) {
socialInfo = new TSocialInfo();
socialInfo.setId(vo.getSocialId());
socialIdList.add(socialInfo);
}
MultipartFile file = this.getFile(ysdAddlist, SocialSoldierYsdAddVo.class);
if (Common.isNotNull(file)) {
this.getOneAppGetModuleDetail(socialIdList, file, "医保增员");
}
}
// 医生大减少列表
List<SocialSoldierYsdReduceVo> ysdReducelist = baseMapper.getSocialSoldierYsdReduceVoList(dispatchIdList);
if (ysdReducelist != null && !ysdReducelist.isEmpty()) {
List<TSocialInfo> socialIdList = new ArrayList<>();
TSocialInfo socialInfo;
for (SocialSoldierYsdReduceVo vo : ysdReducelist) {
socialInfo = new TSocialInfo();
socialInfo.setId(vo.getSocialId());
socialIdList.add(socialInfo);
}
MultipartFile file = this.getFile(ysdReducelist, SocialSoldierYsdReduceVo.class);
if (Common.isNotNull(file)) {
this.getOneAppGetModuleDetail(socialIdList, file, "医保减员");
}
}
if ((ygsAddlist == null || ygsAddlist.isEmpty())
&& (ygsReducelist == null || ygsReducelist.isEmpty())
&& (ysdAddlist == null || ysdAddlist.isEmpty())
&& (ysdReducelist == null || ysdReducelist.isEmpty())
) {
return R.failed("无数据,推送结束!");
}
return R.ok("推送成功!!");
}
}
......@@ -17,7 +17,6 @@
package com.yifu.cloud.plus.v1.yifu.social.service.impl;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.EasyExcelFactory;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.read.listener.ReadListener;
import com.alibaba.excel.read.metadata.holder.ReadRowHolder;
......@@ -25,29 +24,28 @@ import com.alibaba.excel.util.ListUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.core.util.Common;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage;
import com.yifu.cloud.plus.v1.yifu.common.core.util.ExcelUtil;
import com.yifu.cloud.plus.v1.yifu.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser;
import com.yifu.cloud.plus.v1.yifu.social.config.SocialConfig;
import com.yifu.cloud.plus.v1.yifu.social.entity.FailReasonConfig;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialInfo;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialInfoMapper;
import com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialSoldierMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.FailReasonConfigService;
import com.yifu.cloud.plus.v1.yifu.social.service.TDispatchInfoService;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialInfoService;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialSoldierService;
import com.yifu.cloud.plus.v1.yifu.social.vo.*;
import com.yifu.cloud.plus.v1.yifu.social.vo.TSocialSoldierReturnErrorVo;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.compress.utils.IOUtils;
import org.apache.commons.fileupload.FileItem;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import java.io.*;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
......@@ -62,7 +60,7 @@ import java.util.*;
@AllArgsConstructor
@Log4j2
@Service
public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialInfoMapper, TSocialInfo> implements TSocialSoldierService {
public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, TSocialInfo> implements TSocialSoldierService {
private RestTemplate restTemplate = new RestTemplate();
private final SocialConfig socialConfig;
......@@ -70,42 +68,6 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialInfoMapper, TS
private final TSocialInfoService tSocialInfoService;
private final FailReasonConfigService failReasonConfigService;
/**
* @param socialList
* @param file
* @param type
* @Description: 推送到社保士兵,更新社保表的任务id与状态
* @Author: hgw
* @Date: 2024/5/11 15:24
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Override
public R<String> getOneAppGetModuleDetail(List<TSocialInfo> socialList, MultipartFile file, String type) {
// 1获取模板id——社保增员、社保减员、医保增员、医保减员
Map<String, String> moduleDetailMap = socialConfig.getOneModuleDetailMap(restTemplate);
if (moduleDetailMap != null && !moduleDetailMap.isEmpty() && moduleDetailMap.get(type) != null) {
// 2获取机器id
String terminalId = socialConfig.getTwoTerminalId(restTemplate, moduleDetailMap.get(type));
if (Common.isNotNull(terminalId)) {
// 3上传文件,获取文件地址
String fileAddUrl = socialConfig.getThreeTerminalId(restTemplate, file);
log.info(fileAddUrl);
// 4 推送办理任务,返回任务id:
String addId = socialConfig.getFourAppAdd(restTemplate, fileAddUrl, moduleDetailMap.get(type), terminalId);
log.info(addId);
for (TSocialInfo socialInfo : socialList) {
socialInfo.setYgsAddId(addId);
if ("社保增员".equals(type) || "社保减员".equals(type)) {
socialInfo.setYgsHandleStatus(CommonConstants.TWO_STRING);
} else {
socialInfo.setYsdHandleStatus(CommonConstants.TWO_STRING);
}
}
tSocialInfoService.updateBatchById(socialList);
}
}
return R.ok("推送成功!");
}
/**
* @param addId
......@@ -188,36 +150,6 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialInfoMapper, TS
return R.ok();
}
public MultipartFile getFile(Collection<?> list, Class head) {
File file = null;
if (list != null) {
String filePath = "socialFile" + DateUtil.getThisTime() + CommonConstants.XLSX;
EasyExcelFactory.write(filePath, head).sheet("社保明细").doWrite(list);
file = new File(filePath);
}
if (file != null) {
return getMultipartFile(file);
}
return null;
}
public static MultipartFile getMultipartFile(File file) {
FileItem item = new DiskFileItemFactory().createItem("file", MediaType.MULTIPART_FORM_DATA_VALUE, true, file.getName());
try (InputStream input = new FileInputStream(file); OutputStream os = item.getOutputStream()) {
// 流转移
IOUtils.copy(input, os);
} catch (Exception e) {
throw new IllegalArgumentException("Invalid file: " + e, e);
} finally {
//删除临时文件
try {
org.apache.commons.io.FileUtils.forceDelete(file);
} catch (IOException e) {
e.printStackTrace();
}
}
return new CommonsMultipartFile(item);
}
public R<List<ErrorMessage>> importDiy(InputStream inputStream, Map<String, TSocialInfo> idCardMap
, Map<String, FailReasonConfig> errorMap) {
......@@ -450,83 +382,4 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialInfoMapper, TS
return tDispatchInfoService.addApplyHandle(idList, typeSub, handleStatus, handleRemark, socialType, remark, user);
}
/**
* @Description: 推送到社保士兵
* @Author: hgw
* @Date: 2024/5/10 17:53
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/
@Override
public R<String> pushSoldier(List<String> dispatchIdList) {
// 社保增员、社保减员、医保增员、医保减员
// 养工失新增列表
List<SocialSoldierYgsAddVo> ygsAddlist = tDispatchInfoService.getSocialSoldierYgsAddVoList(dispatchIdList);
if (ygsAddlist != null && !ygsAddlist.isEmpty()) {
List<TSocialInfo> socialIdList = new ArrayList<>();
TSocialInfo socialInfo;
for (SocialSoldierYgsAddVo vo : ygsAddlist) {
socialInfo = new TSocialInfo();
socialInfo.setId(vo.getSocialId());
socialIdList.add(socialInfo);
}
MultipartFile file = this.getFile(ygsAddlist, SocialSoldierYgsAddVo.class);
if (Common.isNotNull(file)) {
this.getOneAppGetModuleDetail(socialIdList, file, "社保增员");
}
}
// 养工失减少列表
List<SocialSoldierYgsReduceVo> ygsReducelist = tDispatchInfoService.getSocialSoldierYgsReduceVoList(dispatchIdList);
if (ygsReducelist != null && !ygsReducelist.isEmpty()) {
List<TSocialInfo> socialIdList = new ArrayList<>();
TSocialInfo socialInfo;
for (SocialSoldierYgsReduceVo vo : ygsReducelist) {
socialInfo = new TSocialInfo();
socialInfo.setId(vo.getSocialId());
socialIdList.add(socialInfo);
}
MultipartFile file = this.getFile(ygsReducelist, SocialSoldierYgsReduceVo.class);
if (Common.isNotNull(file)) {
this.getOneAppGetModuleDetail(socialIdList, file, "社保减员");
}
}
// 医生大新增列表
List<SocialSoldierYsdAddVo> ysdAddlist = tDispatchInfoService.getSocialSoldierYsdAddVoList(dispatchIdList);
if (ysdAddlist != null && !ysdAddlist.isEmpty()) {
List<TSocialInfo> socialIdList = new ArrayList<>();
TSocialInfo socialInfo;
for (SocialSoldierYsdAddVo vo : ysdAddlist) {
socialInfo = new TSocialInfo();
socialInfo.setId(vo.getSocialId());
socialIdList.add(socialInfo);
}
MultipartFile file = this.getFile(ysdAddlist, SocialSoldierYsdAddVo.class);
if (Common.isNotNull(file)) {
this.getOneAppGetModuleDetail(socialIdList, file, "医保增员");
}
}
// 医生大减少列表
List<SocialSoldierYsdReduceVo> ysdReducelist = tDispatchInfoService.getSocialSoldierYsdReduceVoList(dispatchIdList);
if (ysdReducelist != null && !ysdReducelist.isEmpty()) {
List<TSocialInfo> socialIdList = new ArrayList<>();
TSocialInfo socialInfo;
for (SocialSoldierYsdReduceVo vo : ysdReducelist) {
socialInfo = new TSocialInfo();
socialInfo.setId(vo.getSocialId());
socialIdList.add(socialInfo);
}
MultipartFile file = this.getFile(ysdReducelist, SocialSoldierYsdReduceVo.class);
if (Common.isNotNull(file)) {
this.getOneAppGetModuleDetail(socialIdList, file, "医保减员");
}
}
if ((ygsAddlist == null || ygsAddlist.isEmpty())
&& (ygsReducelist == null || ygsReducelist.isEmpty())
&& (ysdAddlist == null || ysdAddlist.isEmpty())
&& (ysdReducelist == null || ysdReducelist.isEmpty())
) {
return R.failed("无数据,推送结束!");
}
return R.ok("推送成功!!");
}
}
......@@ -17,7 +17,7 @@ import com.yifu.cloud.plus.v1.yifu.social.mapper.TSendEkpErrorMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.TForecastLibraryService;
import com.yifu.cloud.plus.v1.yifu.social.service.TIncomeDetailService;
import com.yifu.cloud.plus.v1.yifu.social.service.TIncomeService;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialSoldierService;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialSoldierPushService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -55,7 +55,7 @@ public class DoSocialTask {
private TSendEkpErrorMapper sendEkpErrorMapper;
@Autowired
private TSocialSoldierService socialSoldierService;
private TSocialSoldierPushService tSocialSoldierPushService;
/**
* @Author fxj
* @Description 异步处理相关信息
......@@ -272,6 +272,6 @@ public class DoSocialTask {
public void pushSoldier(String dispatchId){
List<String> dispatchIdList = new ArrayList<>();
dispatchIdList.add(dispatchId);
socialSoldierService.pushSoldier(dispatchIdList);
tSocialSoldierPushService.pushSoldier(dispatchIdList);
}
}
......@@ -1151,142 +1151,6 @@
<result property="reduceReason" column="REDUCE_REASON"/>
<result property="exportFundFlag" column="EXPORT_FUND_FLAG"/>
</resultMap>
<!-- 社保士兵养工失增加模板-->
<select id="getSocialSoldierYgsAddVoList" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYgsAddVo">
SELECT
s.id as socialId,
a.SOCIAL_HOUSEHOLD_NAME socialHouseholdName,
'居民身份证(户口簿)' idCardType,
a.EMP_IDCARD empIdCard,
a.EMP_NAME empName,
'中国' country,
'职员' personType,
nation.label nation,
DATE_FORMAT(s.SOCIAL_START_DATE,'%Y%m%d') workDate,
s.RECORD_BASE recordBase,
EDUCATION_NAME educationName,
registype.label regisType,
DATE_FORMAT(s.SOCIAL_START_DATE,'%Y%m%d') addDate,
a.FILE_ADDR fileAddr,
a.CONTRACT_NAME contractName,
a.EMP_MOBILE empMobile,
a.FILE_ADDR mobileAddr,
DATE_FORMAT(s.SOCIAL_START_DATE,'%Y%m%d') dispatchDate,
DATE_FORMAT(s.SOCIAL_START_DATE,'%Y%m%d') workStartDate,
a.CONTRACT_NAME contractDateType,
DATE_FORMAT(a.CONTRACT_START,'%Y%m%d') contractStart,
DATE_FORMAT(a.CONTRACT_END,'%Y%m%d') contractEnd,
'办事人员' workCode,
'新签' contractType,
case when a.WORKING_HOURS = 1 then '标准工时'
when a.WORKING_HOURS = 2 then '综合工时'
when a.WORKING_HOURS = 3 then '不定时工时制'
else '-' end as workingHours ,
DATE_FORMAT(s.PENSION_START,'%Y%m%d') pensionStart,
DATE_FORMAT(s.WORK_INJURY_START,'%Y%m%d') workInjuryStart,
DATE_FORMAT(s.UNEMPLOY_START,'%Y%m%d') unemployStart,
a.FILE_ADDR huAddr,
a.FILE_ADDR zhuAddr,
a.FILE_ADDR banAddr,
'' buRemark,
'' huiRemark,
'' huiRemark1,
'' huiRemark2
FROM t_dispatch_info a
left join t_social_info s on a.SOCIAL_ID = s.id
left join t_dispatch_social_fund_info h on a.id = h.REDUCE_SOCIAL_FUND_ID
left join view_sys_dict_item nation on nation.value=a.EMP_NATIONAL and nation.type='emp_national'
left join view_sys_dict_item registype on registype.value=a.EMP_REGIS_TYPE and registype.type='emp_registype'
<include refid="where_getSocialSoldier_base_handler"/>
and a.type = '0'
</select>
<sql id="where_getSocialSoldier_base_handler">
<where>
s.DELETE_FLAG = 0
/** 社保办理状态:0待办理/1已办理2办理失败3已派减4 办理中 5 部分办理失败 派单社保办理状态 0 未办理 1 全部办理成功(原-已办理) 2 全部办理失败(原-办理失败) 3 部分办理成功 4 办理中 **/
/*社保代办理 1.派单审核通过 2.派增(type=0):待办理(social_handle_status='0') or 派减(type=1):已办理完成或部分办理失败 且已派减*/
AND a.social_id is not null
AND a.STATUS = "2"
and (( a.type = '0' AND (s.HANDLE_STATUS = "0" or s.HANDLE_STATUS = "4") ) or ( a.type ='1' AND (if(ifnull(h.id,0) != '0',h.HANDLE_STATUS,s.HANDLE_STATUS) in ('1','5','6','3','7') or (s.HANDLE_STATUS in ('1','5','6','3','7') and s.REDUCE_CAN = '1')) ))
and a.SOCIAL_HANDLE_STATUS in ('0','4')
and a.AUTO_FLAG = '0'
</where>
</sql>
<!-- 社保士兵养工失减少模板-->
<select id="getSocialSoldierYgsReduceVoList" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYgsReduceVo">
SELECT
s.id as socialId,
a.SOCIAL_HOUSEHOLD_NAME socialHouseholdName,
a.EMP_NAME empName,
a.EMP_IDCARD empIdCard,
reduceReason.label reduceReason,
'' twoRemark,
'' threeRemark,
'' huiRemark,
'' huiRemark1,
'' huiRemark2
FROM t_dispatch_info a
left join t_social_info s on a.SOCIAL_ID = s.id
left join t_dispatch_social_fund_info h on a.id = h.REDUCE_SOCIAL_FUND_ID
left join view_sys_dict_item reduceReason on reduceReason.value=a.REDUCE_REASON and reduceReason.type='social_reduce_reason'
<include refid="where_getSocialSoldier_base_handler"/>
and a.type = '1'
</select>
<!-- 社保士兵医生大增加模板-->
<select id="getSocialSoldierYsdAddVoList" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYsdAddVo">
SELECT
s.id as socialId,
a.SOCIAL_HOUSEHOLD_NAME socialHouseholdName,
'居民身份证(户口簿)' idCardType,
a.EMP_IDCARD empIdCard,
a.EMP_NAME empName,
nation.label nation,
EDUCATION_NAME educationName,
a.EMP_MOBILE empMobile,
'职工在职' empType,
s.RECORD_BASE recordBase,
a.CONTRACT_NAME contractName,
'非在编' bianType,
DATE_FORMAT(s.SOCIAL_START_DATE,'%Y%m%d') socialDate,
'' contractDate,
DATE_FORMAT(s.SOCIAL_START_DATE,'%Y%m%d') socialDateOld,
s.UNIT_MEDICAL_MONEY unitMedicalMoney,
s.UNIT_BIGAILMENT_MONEY unitBigailmentMoney,
s.UNIT_BIRTH_MONEY unitBirthMoney,
'' huiRemark,
'' huiRemark1,
'' huiRemark2
FROM t_dispatch_info a
left join t_social_info s on a.SOCIAL_ID = s.id
left join t_dispatch_social_fund_info h on a.id = h.REDUCE_SOCIAL_FUND_ID
left join view_sys_dict_item nation on nation.value=a.EMP_NATIONAL and nation.type='emp_national'
<include refid="where_getSocialSoldier_base_handler"/>
and a.type = '0'
</select>
<!-- 社保士兵医生大减少模板-->
<select id="getSocialSoldierYsdReduceVoList" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYsdReduceVo">
SELECT
s.id as socialId,
a.SOCIAL_HOUSEHOLD_NAME socialHouseholdName,
'居民身份证(户口簿)' idCardType,
a.EMP_IDCARD empIdCard,
a.EMP_NAME empName,
reduceReason.label reduceReason,
DATE_FORMAT(a.LEAVE_DATE,'%Y%m%d') reduceDate,
'' huiRemark,
'' huiRemark1,
'' huiRemark2
FROM t_dispatch_info a
left join t_social_info s on a.SOCIAL_ID = s.id
left join t_dispatch_social_fund_info h on a.id = h.REDUCE_SOCIAL_FUND_ID
left join view_sys_dict_item reduceReason on reduceReason.value=a.REDUCE_REASON and reduceReason.type='social_reduce_reason'
<include refid="where_getSocialSoldier_base_handler"/>
and a.type = '1'
</select>
<!--tDispatchInfo 社保花名册数据查询-->
<select id="getSocialRecordRosterList" resultMap="socialHandleExportMap">
......@@ -1355,6 +1219,45 @@
<include refid="where_getSocialRecordRoster"/>
</select>
<!--tDispatchInfo 社保花名册数据查询-->
<select id="getSocialSoldierList" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierExportVo">
SELECT
if(a.TYPE='0','派增','派减') TYPE,
case a.SOCIAL_HANDLE_STATUS when '0' then '未办理' when '1' then '全部办理成功' when '2' then '全部办理失败' when '3' then '部分办理成功' when '4' then '办理中' else '-' end socialHandleStatus,
case s.ygs_Handle_Status when '0' then '无' when '1' then '待办理' when '2' then '自动办理中' when '3' then '继续办理' when '4' then '中止办理' when '5' then '人工处理' when '6' then '成功' else '-' end ygsHandleStatus,
case s.ysd_Handle_Status when '0' then '无' when '1' then '待办理' when '2' then '自动办理中' when '3' then '继续办理' when '4' then '中止办理' when '5' then '人工处理' when '6' then '成功' else '-' end ysdHandleStatus,
s.YGS_REMARK ygsRemark,s.YSD_REMARK ysdRemark,
a.DISPATCH_CODE dispatchCode,
a.EMP_NAME empName,
a.EMP_IDCARD empIdcard,
emp_natrue.label empType,
a.BELONG_UNIT_NAME belongUnit,
a.SETTLE_DOMAIN_NAME settleDomain,
a.SETTLE_DOMAIN_CODE settleDomainCode,
a.SOCIAL_HOUSEHOLD_NAME socialHouseholdName,
concat(if(ifnull(h.id,0) != '0',sp1.AREA_NAME,sp2.AREA_NAME),
ifnull(if(ifnull(h.id,0) != '0',sc1.AREA_NAME,sc2.AREA_NAME),''),
ifnull(if(ifnull(h.id,0) != '0',st1.AREA_NAME,st2.AREA_NAME),'')) socialProvince,
a.LEAVE_DATE leaveDate,
a.DISPATCH_ITEM dispatchItem,
a.CREATE_NAME createUserName,
a.ORGAN_NAME organName,
a.CREATE_TIME createTime,
a.AUDIT_USER_NAME auditUserName,
a.AUDIT_TIME auditTime
FROM t_dispatch_info a
left join t_social_info s on a.SOCIAL_ID = s.id
left join t_dispatch_social_fund_info h on a.id = h.REDUCE_SOCIAL_FUND_ID
left join sys_area sp1 on sp1.id = h.SOCIAL_PROVINCE
left join sys_area sp2 on sp2.id = s.SOCIAL_PROVINCE
left join sys_area sc1 on sc1.id = h.SOCIAL_CITY
left join sys_area sc2 on sc2.id = s.SOCIAL_CITY
left join sys_area st1 on st1.id = h.SOCIAL_TOWN
left join sys_area st2 on st2.id = s.SOCIAL_TOWN
left join view_sys_dict_item emp_natrue on emp_natrue.value=a.EMP_TYPE and emp_natrue.type='emp_natrue'
<include refid="where_getSocialSoldier"/>
</select>
<update id="updateSocialRecords">
update
t_dispatch_info a
......@@ -1377,6 +1280,16 @@
<include refid="where_getSocialRecordRoster"/>) a
</select>
<!-- 导出社保士兵count -->
<select id="getSocialSoldierCount" resultType="java.lang.Integer">
SELECT
count(1)
FROM t_dispatch_info a
left join t_social_info s on a.SOCIAL_ID = s.id
left join t_dispatch_social_fund_info h on a.id = h.REDUCE_SOCIAL_FUND_ID
<include refid="where_getSocialSoldier"/>
</select>
<!-- hgw 2024-5-10 10:42:33 社保士兵列表查询 -->
<select id="getTSocialSoldierHandlePage" resultMap="dispatchPageMap">
SELECT
......
<?xml version="1.0" encoding="UTF-8"?>
<!--
~
~ Copyright (c) 2018-2025, lengleng All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted provided that the following conditions are met:
~
~ Redistributions of source code must retain the above copyright notice,
~ this list of conditions and the following disclaimer.
~ Redistributions in binary form must reproduce the above copyright
~ notice, this list of conditions and the following disclaimer in the
~ documentation and/or other materials provided with the distribution.
~ Neither the name of the yifu4cloud.com developer nor the names of its
~ contributors may be used to endorse or promote products derived from
~ this software without specific prior written permission.
~ Author: lengleng (wangiegie@gmail.com)
~
-->
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yifu.cloud.plus.v1.yifu.social.mapper.TSocialSoldierMapper">
<!-- 社保士兵养工失增加模板-->
<select id="getSocialSoldierYgsAddVoList" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYgsAddVo">
SELECT
s.id as socialId,
a.SOCIAL_HOUSEHOLD_NAME socialHouseholdName,
'居民身份证(户口簿)' idCardType,
a.EMP_IDCARD empIdCard,
a.EMP_NAME empName,
'中国' country,
'职员' personType,
nation.label nation,
DATE_FORMAT(s.SOCIAL_START_DATE,'%Y%m%d') workDate,
s.RECORD_BASE recordBase,
EDUCATION_NAME educationName,
registype.label regisType,
DATE_FORMAT(s.SOCIAL_START_DATE,'%Y%m%d') addDate,
a.FILE_ADDR fileAddr,
a.CONTRACT_NAME contractName,
a.EMP_MOBILE empMobile,
a.FILE_ADDR mobileAddr,
DATE_FORMAT(s.SOCIAL_START_DATE,'%Y%m%d') dispatchDate,
DATE_FORMAT(s.SOCIAL_START_DATE,'%Y%m%d') workStartDate,
a.CONTRACT_NAME contractDateType,
DATE_FORMAT(a.CONTRACT_START,'%Y%m%d') contractStart,
DATE_FORMAT(a.CONTRACT_END,'%Y%m%d') contractEnd,
'办事人员' workCode,
'新签' contractType,
case when a.WORKING_HOURS = 1 then '标准工时'
when a.WORKING_HOURS = 2 then '综合工时'
when a.WORKING_HOURS = 3 then '不定时工时制'
else '-' end as workingHours ,
DATE_FORMAT(s.PENSION_START,'%Y%m%d') pensionStart,
DATE_FORMAT(s.WORK_INJURY_START,'%Y%m%d') workInjuryStart,
DATE_FORMAT(s.UNEMPLOY_START,'%Y%m%d') unemployStart,
a.FILE_ADDR huAddr,
a.FILE_ADDR zhuAddr,
a.FILE_ADDR banAddr,
'' buRemark,
'' huiRemark,
'' huiRemark1,
'' huiRemark2
FROM t_dispatch_info a
left join t_social_info s on a.SOCIAL_ID = s.id
left join t_dispatch_social_fund_info h on a.id = h.REDUCE_SOCIAL_FUND_ID
left join view_sys_dict_item nation on nation.value=a.EMP_NATIONAL and nation.type='emp_national'
left join view_sys_dict_item registype on registype.value=a.EMP_REGIS_TYPE and registype.type='emp_registype'
<include refid="where_getSocialSoldier_base_handler"/>
and a.type = '0'
</select>
<sql id="where_getSocialSoldier_base_handler">
<where>
s.DELETE_FLAG = 0
/** 社保办理状态:0待办理/1已办理2办理失败3已派减4 办理中 5 部分办理失败 派单社保办理状态 0 未办理 1 全部办理成功(原-已办理) 2 全部办理失败(原-办理失败) 3 部分办理成功 4 办理中 **/
/*社保代办理 1.派单审核通过 2.派增(type=0):待办理(social_handle_status='0') or 派减(type=1):已办理完成或部分办理失败 且已派减*/
AND a.social_id is not null
AND a.STATUS = "2"
and (( a.type = '0' AND (s.HANDLE_STATUS = "0" or s.HANDLE_STATUS = "4") ) or ( a.type ='1' AND (if(ifnull(h.id,0) != '0',h.HANDLE_STATUS,s.HANDLE_STATUS) in ('1','5','6','3','7') or (s.HANDLE_STATUS in ('1','5','6','3','7') and s.REDUCE_CAN = '1')) ))
and a.SOCIAL_HANDLE_STATUS in ('0','4')
and a.AUTO_FLAG = '0'
</where>
</sql>
<!-- 社保士兵养工失减少模板-->
<select id="getSocialSoldierYgsReduceVoList" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYgsReduceVo">
SELECT
s.id as socialId,
a.SOCIAL_HOUSEHOLD_NAME socialHouseholdName,
a.EMP_NAME empName,
a.EMP_IDCARD empIdCard,
reduceReason.label reduceReason,
'' twoRemark,
'' threeRemark,
'' huiRemark,
'' huiRemark1,
'' huiRemark2
FROM t_dispatch_info a
left join t_social_info s on a.SOCIAL_ID = s.id
left join t_dispatch_social_fund_info h on a.id = h.REDUCE_SOCIAL_FUND_ID
left join view_sys_dict_item reduceReason on reduceReason.value=a.REDUCE_REASON and reduceReason.type='social_reduce_reason'
<include refid="where_getSocialSoldier_base_handler"/>
and a.type = '1'
</select>
<!-- 社保士兵医生大增加模板-->
<select id="getSocialSoldierYsdAddVoList" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYsdAddVo">
SELECT
s.id as socialId,
a.SOCIAL_HOUSEHOLD_NAME socialHouseholdName,
'居民身份证(户口簿)' idCardType,
a.EMP_IDCARD empIdCard,
a.EMP_NAME empName,
nation.label nation,
EDUCATION_NAME educationName,
a.EMP_MOBILE empMobile,
'职工在职' empType,
s.RECORD_BASE recordBase,
a.CONTRACT_NAME contractName,
'非在编' bianType,
DATE_FORMAT(s.SOCIAL_START_DATE,'%Y%m%d') socialDate,
'' contractDate,
DATE_FORMAT(s.SOCIAL_START_DATE,'%Y%m%d') socialDateOld,
s.UNIT_MEDICAL_MONEY unitMedicalMoney,
s.UNIT_BIGAILMENT_MONEY unitBigailmentMoney,
s.UNIT_BIRTH_MONEY unitBirthMoney,
'' huiRemark,
'' huiRemark1,
'' huiRemark2
FROM t_dispatch_info a
left join t_social_info s on a.SOCIAL_ID = s.id
left join t_dispatch_social_fund_info h on a.id = h.REDUCE_SOCIAL_FUND_ID
left join view_sys_dict_item nation on nation.value=a.EMP_NATIONAL and nation.type='emp_national'
<include refid="where_getSocialSoldier_base_handler"/>
and a.type = '0'
</select>
<!-- 社保士兵医生大减少模板-->
<select id="getSocialSoldierYsdReduceVoList" resultType="com.yifu.cloud.plus.v1.yifu.social.vo.SocialSoldierYsdReduceVo">
SELECT
s.id as socialId,
a.SOCIAL_HOUSEHOLD_NAME socialHouseholdName,
'居民身份证(户口簿)' idCardType,
a.EMP_IDCARD empIdCard,
a.EMP_NAME empName,
reduceReason.label reduceReason,
DATE_FORMAT(a.LEAVE_DATE,'%Y%m%d') reduceDate,
'' huiRemark,
'' huiRemark1,
'' huiRemark2
FROM t_dispatch_info a
left join t_social_info s on a.SOCIAL_ID = s.id
left join t_dispatch_social_fund_info h on a.id = h.REDUCE_SOCIAL_FUND_ID
left join view_sys_dict_item reduceReason on reduceReason.value=a.REDUCE_REASON and reduceReason.type='social_reduce_reason'
<include refid="where_getSocialSoldier_base_handler"/>
and a.type = '1'
</select>
</mapper>
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