Commit a4abe059 authored by hongguangwu's avatar hongguangwu

调基、导出相关

parent f82273af
...@@ -16,12 +16,14 @@ ...@@ -16,12 +16,14 @@
*/ */
package com.yifu.cloud.plus.v1.yifu.social.vo; package com.yifu.cloud.plus.v1.yifu.social.vo;
import com.baomidou.mybatisplus.annotation.TableField;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo; import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data; import lombok.Data;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* 社保公积金查询表 * 社保公积金查询表
...@@ -32,12 +34,13 @@ import java.util.List; ...@@ -32,12 +34,13 @@ import java.util.List;
@Data @Data
public class TSocialFundInfoSearchVo extends TSocialFundInfo { public class TSocialFundInfoSearchVo extends TSocialFundInfo {
/**
* 多选导出或删除等操作
*/
@Schema(description = "选中ID,多个逗号分割")
private String ids;
@TableField(exist = false)
@Schema(description = "导出的表头的Set")
private Set<String> exportFields;
@Schema(description = "选中的idList")
private List<String> idList; private List<String> idList;
/** /**
* 创建时间区间 [开始时间,结束时间] * 创建时间区间 [开始时间,结束时间]
......
...@@ -98,8 +98,8 @@ public class TSocialFundInfoController { ...@@ -98,8 +98,8 @@ public class TSocialFundInfoController {
@SysLog("批量调基") @SysLog("批量调基")
@PostMapping("/importListAdd") @PostMapping("/importListAdd")
@PreAuthorize("@pms.hasPermission('tsocialfundinfo-batch-import')") @PreAuthorize("@pms.hasPermission('tsocialfundinfo-batch-import')")
public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file){ public R<List<ErrorMessage>> importListAdd(@RequestBody MultipartFile file, @RequestParam String doMonth){
return tSocialFundInfoService.importDiy(file.getInputStream()); return tSocialFundInfoService.importDiy(file.getInputStream(), doMonth);
} }
/** /**
......
...@@ -21,12 +21,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -21,12 +21,11 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; 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.common.core.util.R;
import com.yifu.cloud.plus.v1.yifu.social.entity.TAgentConfig; import com.yifu.cloud.plus.v1.yifu.social.entity.SysBaseSetInfo;
import com.yifu.cloud.plus.v1.yifu.social.entity.TForecastLibrary; import com.yifu.cloud.plus.v1.yifu.social.entity.TForecastLibrary;
import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo; import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialFundInfo;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.List; import java.util.List;
/** /**
...@@ -66,7 +65,7 @@ public interface TForecastLibraryService extends IService<TForecastLibrary> { ...@@ -66,7 +65,7 @@ public interface TForecastLibraryService extends IService<TForecastLibrary> {
* @Date: 2022/7/25 17:33 * @Date: 2022/7/25 17:33
* @return: void * @return: void
**/ **/
R<String> updateToneForecastLibary(TSocialFundInfo socialFundInfo); R<String> updateToneForecastLibary(TSocialFundInfo socialFundInfo, String doMonth);
/** /**
* @param socialFundInfo * @param socialFundInfo
...@@ -83,7 +82,7 @@ public interface TForecastLibraryService extends IService<TForecastLibrary> { ...@@ -83,7 +82,7 @@ public interface TForecastLibraryService extends IService<TForecastLibrary> {
* @Date: 2022/7/26 19:09 * @Date: 2022/7/26 19:09
* @return: void * @return: void
**/ **/
void updateForecastLibaryBySysBase(); void updateForecastLibaryBySysBase(SysBaseSetInfo newSysBaseSetInfo);
/** /**
* @Description: 每月定时预估库 TODO-加定时器 * @Description: 每月定时预估库 TODO-加定时器
......
...@@ -45,13 +45,13 @@ public interface TSocialFundInfoService extends IService<TSocialFundInfo> { ...@@ -45,13 +45,13 @@ public interface TSocialFundInfoService extends IService<TSocialFundInfo> {
IPage<TSocialFundInfo> getTSocialFundInfoPage(Page<TSocialFundInfo> page, TSocialFundInfoSearchVo tSocialFundInfo); IPage<TSocialFundInfo> getTSocialFundInfoPage(Page<TSocialFundInfo> page, TSocialFundInfoSearchVo tSocialFundInfo);
/** /**
* @param inputStream * @param doMonth 执行月份
* @Description: 批量调基 * @Description: 批量调基
* @Author: hgw * @Author: hgw
* @Date: 2022/7/22 11:32 * @Date: 2022/7/22 11:32
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage>> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage>>
**/ **/
R<List<ErrorMessage>> importDiy(InputStream inputStream); R<List<ErrorMessage>> importDiy(InputStream inputStream, String doMonth);
/** /**
* @Description: 导出 * @Description: 导出
......
...@@ -31,6 +31,7 @@ import com.yifu.cloud.plus.v1.yifu.social.entity.SysPayProportion; ...@@ -31,6 +31,7 @@ import com.yifu.cloud.plus.v1.yifu.social.entity.SysPayProportion;
import com.yifu.cloud.plus.v1.yifu.social.mapper.SysBaseSetInfoMapper; import com.yifu.cloud.plus.v1.yifu.social.mapper.SysBaseSetInfoMapper;
import com.yifu.cloud.plus.v1.yifu.social.service.SysBaseSetInfoService; import com.yifu.cloud.plus.v1.yifu.social.service.SysBaseSetInfoService;
import com.yifu.cloud.plus.v1.yifu.social.service.SysPayProportionService; import com.yifu.cloud.plus.v1.yifu.social.service.SysPayProportionService;
import com.yifu.cloud.plus.v1.yifu.social.service.TForecastLibraryService;
import com.yifu.cloud.plus.v1.yifu.social.service.TSocialLogService; import com.yifu.cloud.plus.v1.yifu.social.service.TSocialLogService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -55,6 +56,8 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper, ...@@ -55,6 +56,8 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper,
private final SysPayProportionService sysPayProportionService; private final SysPayProportionService sysPayProportionService;
private final TForecastLibraryService tForecastLibraryService;
/** /**
* 基数设置表简单分页查询 * 基数设置表简单分页查询
* *
...@@ -251,7 +254,10 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper, ...@@ -251,7 +254,10 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper,
} else { } else {
sysBaseSetInfo.setStatus(CommonConstants.ZERO_INT); sysBaseSetInfo.setStatus(CommonConstants.ZERO_INT);
sysBaseSetInfo.setDeleteFlag(CommonConstants.ZERO_STRING); sysBaseSetInfo.setDeleteFlag(CommonConstants.ZERO_STRING);
sysBaseSetInfo.setIsNew(CommonConstants.ONE_STRING);
baseMapper.insert(sysBaseSetInfo); baseMapper.insert(sysBaseSetInfo);
// TODO-测试用(同步社保公积金查询、预估库),后面可删除
tForecastLibraryService.updateForecastLibaryBySysBase(sysBaseSetInfo);
} }
List<SysPayProportion> payProportionList = sysBaseSetInfo.getFundProList(); List<SysPayProportion> payProportionList = sysBaseSetInfo.getFundProList();
if (Common.isNotNull(payProportionList)) { if (Common.isNotNull(payProportionList)) {
......
...@@ -32,6 +32,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -32,6 +32,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeInfo;
import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject; import com.yifu.cloud.plus.v1.yifu.archives.entity.TEmployeeProject;
import com.yifu.cloud.plus.v1.yifu.archives.vo.EmployeeContractExportVO;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.*; import com.yifu.cloud.plus.v1.yifu.common.core.util.*;
import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil; import com.yifu.cloud.plus.v1.yifu.common.dapr.util.ArchivesDaprUtil;
...@@ -105,7 +106,7 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe ...@@ -105,7 +106,7 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe
response.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8");
response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8")); response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(fileName, "UTF-8"));
// 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭 // 这里 需要指定写用哪个class去写,然后写到第一个sheet,然后文件流会自动关闭
ExcelWriter excelWriter = EasyExcel.write(out, TSocialFundInfo.class).build(); ExcelWriter excelWriter = EasyExcel.write(out, TSocialFundInfo.class).includeColumnFiledNames(searchVo.getExportFields()).build();
int index = 0; int index = 0;
if (count > CommonConstants.ZERO_INT) { if (count > CommonConstants.ZERO_INT) {
for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) { for (int i = 0; i <= count; i += CommonConstants.EXCEL_EXPORT_LIMIT) {
...@@ -148,9 +149,8 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe ...@@ -148,9 +149,8 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe
@Override @Override
public List<TSocialFundInfo> noPageDiy(TSocialFundInfoSearchVo searchVo) { public List<TSocialFundInfo> noPageDiy(TSocialFundInfoSearchVo searchVo) {
LambdaQueryWrapper<TSocialFundInfo> wrapper = buildQueryWrapper(searchVo); LambdaQueryWrapper<TSocialFundInfo> wrapper = buildQueryWrapper(searchVo);
List<String> idList = Common.getList(searchVo.getIds()); if (Common.isNotNull(searchVo.getIdList())) {
if (Common.isNotNull(idList)) { wrapper.in(TSocialFundInfo::getId, searchVo.getIdList());
wrapper.in(TSocialFundInfo::getId, idList);
} }
if (searchVo.getLimitStart() >= 0 && searchVo.getLimitEnd() > 0) { if (searchVo.getLimitStart() >= 0 && searchVo.getLimitEnd() > 0) {
wrapper.last(" limit " + searchVo.getLimitStart() + "," + searchVo.getLimitEnd()); wrapper.last(" limit " + searchVo.getLimitStart() + "," + searchVo.getLimitEnd());
...@@ -160,18 +160,16 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe ...@@ -160,18 +160,16 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe
} }
private List<TSocialFundInfoExportVo> export(TSocialFundInfoSearchVo searchVo) { private List<TSocialFundInfoExportVo> export(TSocialFundInfoSearchVo searchVo) {
List<String> idList = Common.getList(searchVo.getIds()); if (Common.isNotNull(searchVo.getIdList())) {
if (Common.isNotNull(idList)) { searchVo.setIdList(searchVo.getIdList());
searchVo.setIdList(idList);
} }
return baseMapper.exportList(searchVo); return baseMapper.exportList(searchVo);
} }
private Long noPageCountDiy(TSocialFundInfoSearchVo searchVo) { private Long noPageCountDiy(TSocialFundInfoSearchVo searchVo) {
LambdaQueryWrapper<TSocialFundInfo> wrapper = buildQueryWrapper(searchVo); LambdaQueryWrapper<TSocialFundInfo> wrapper = buildQueryWrapper(searchVo);
List<String> idList = Common.getList(searchVo.getIds()); if (Common.isNotNull(searchVo.getIdList())) {
if (Common.isNotNull(idList)) { wrapper.in(TSocialFundInfo::getId, searchVo.getIdList());
wrapper.in(TSocialFundInfo::getId, idList);
} }
return baseMapper.selectCount(wrapper); return baseMapper.selectCount(wrapper);
} }
...@@ -190,14 +188,14 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe ...@@ -190,14 +188,14 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe
} }
/** /**
* @param inputStream * @param doMonth 执行月份
* @Description: 批量调基 * @Description: 批量调基
* @Author: hgw * @Author: hgw
* @Date: 2022/7/22 11:32 * @Date: 2022/7/22 11:32
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage>> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.common.core.util.ErrorMessage>>
**/ **/
@Override @Override
public R<List<ErrorMessage>> importDiy(InputStream inputStream) { public R<List<ErrorMessage>> importDiy(InputStream inputStream, String doMonth) {
List<ErrorMessage> errorMessageList = new ArrayList<>(); List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<TSocialFundHistoryVo> util1 = new ExcelUtil<>(TSocialFundHistoryVo.class); ExcelUtil<TSocialFundHistoryVo> util1 = new ExcelUtil<>(TSocialFundHistoryVo.class);
// 写法2: // 写法2:
...@@ -242,7 +240,7 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe ...@@ -242,7 +240,7 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe
*/ */
private void saveData() { private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size()); log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importTSocialFundInfo(cachedDataList, errorMessageList); importTSocialFundInfo(cachedDataList, errorMessageList, doMonth);
log.info("存储数据库成功!"); log.info("存储数据库成功!");
} }
}).sheet().doRead(); }).sheet().doRead();
...@@ -253,7 +251,8 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe ...@@ -253,7 +251,8 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe
return R.ok(errorMessageList); return R.ok(errorMessageList);
} }
private void importTSocialFundInfo(List<TSocialFundHistoryVo> excelVOList, List<ErrorMessage> errorMessageList) { private void importTSocialFundInfo(List<TSocialFundHistoryVo> excelVOList
, List<ErrorMessage> errorMessageList, String doMonth) {
// 执行数据插入操作 组装 // 执行数据插入操作 组装
TSocialFundHistoryVo excel; TSocialFundHistoryVo excel;
List<String> idCardList = new ArrayList<>(); List<String> idCardList = new ArrayList<>();
...@@ -373,7 +372,7 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe ...@@ -373,7 +372,7 @@ public class TSocialFundInfoServiceImpl extends ServiceImpl<TSocialFundInfoMappe
// 3:新增变更日志 // 3:新增变更日志
tSocialLogService.saveModificationRecord(CommonConstants.ONE_INT, oldSocialFundInfo.getId(), oldSocialFundInfo, socialFundInfo); tSocialLogService.saveModificationRecord(CommonConstants.ONE_INT, oldSocialFundInfo.getId(), oldSocialFundInfo, socialFundInfo);
// 4:同步预估库 // 4:同步预估库
tForecastLibraryService.updateToneForecastLibary(socialFundInfo); tForecastLibraryService.updateToneForecastLibary(socialFundInfo, doMonth);
// 返回信息处理 // 返回信息处理
initResSuccessMessage(errorMessageList, excel.getRowIndex(), isSocial, isFund); initResSuccessMessage(errorMessageList, excel.getRowIndex(), isSocial, isFund);
} else { } else {
......
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