Commit 29a95cb7 authored by hongguangwu's avatar hongguangwu

MVP1.6.5-社保士兵实缴:最终

parent c568bea3
...@@ -26,6 +26,7 @@ import io.swagger.v3.oas.annotations.Operation; ...@@ -26,6 +26,7 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import java.util.List; import java.util.List;
...@@ -148,10 +149,10 @@ public class TSocialSoldierController { ...@@ -148,10 +149,10 @@ public class TSocialSoldierController {
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/ **/
@Operation(description = "6每月6号1点推送实缴3张表查询") @Operation(description = "6每月6号1点推送实缴3张表查询")
@PostMapping("/inner/pushPaymentThree") @PostMapping("/inner/doPushPaymentThree")
@SysLog("6每月6号推送实缴3张表查询") @SysLog("6每月6号推送实缴3张表查询")
@Inner @Inner
public R<String> pushPaymentThree() { public R<String> doPushPaymentThree() {
return tSocialSoldierPushService.pushPaymentThree(null,false); return tSocialSoldierPushService.pushPaymentThree(null,false);
} }
...@@ -191,19 +192,20 @@ public class TSocialSoldierController { ...@@ -191,19 +192,20 @@ public class TSocialSoldierController {
@Operation(description = "获取重新办理结果") @Operation(description = "获取重新办理结果")
@GetMapping("/getReHandle") @GetMapping("/getReHandle")
public R<String> getReHandle(@RequestParam String parentId) { public R<String> getReHandle(@RequestParam String parentId) {
return tSocialSoldierService.getReHandle(parentId); tSocialSoldierService.getReHandle(parentId);
return R.ok("正在执行中,请耐心等待!");
} }
/** /**
* @Description: 文件组装zip的Demo * @Description: 文件组装zip的Demo(测试附件使用,不删除)
* @Author: hgw * @Author: hgw
* @Date: 2024-6-11 14:27:50 * @Date: 2024-6-11 14:27:50
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/ **/
/*@Operation(description = "文件组装zip的Demo") @Operation(description = "文件组装zip的Demo")
@GetMapping("/getZip") @PostMapping("/getZip")
public R<String> getZip() { public R<String> getZip(@RequestBody MultipartFile zipFile) {
return tSocialSoldierService.getZip(); return tSocialSoldierService.getZip(zipFile);
}*/ }
} }
...@@ -49,7 +49,7 @@ public interface TAutoPaymentDetailMapper extends BaseMapper<TAutoPaymentDetail> ...@@ -49,7 +49,7 @@ public interface TAutoPaymentDetailMapper extends BaseMapper<TAutoPaymentDetail>
* @Date: 2024/6/6 9:55 * @Date: 2024/6/6 9:55
* @return: void * @return: void
**/ **/
void deleteByParentId(@Param("parentId") String parentId); void deleteByParentId(@Param("parentId") String parentId, @Param("sourceType") int sourceType);
List<TAutoPaymentDetail> getListByParentId(@Param("parentId") String parentId); List<TAutoPaymentDetail> getListByParentId(@Param("parentId") String parentId);
......
...@@ -51,12 +51,13 @@ public interface TAutoPaymentDetailService extends IService<TAutoPaymentDetail> ...@@ -51,12 +51,13 @@ public interface TAutoPaymentDetailService extends IService<TAutoPaymentDetail>
List<TAutoPaymentDetail> noPageDiy(TAutoPaymentDetailSearchVo searchVo); List<TAutoPaymentDetail> noPageDiy(TAutoPaymentDetailSearchVo searchVo);
/** /**
* @param: sourceType 资源类型:1日常申报导出;2人员缴费明细打印;3单位缴费明细查询;4单位缴费明细下载
* @Description: 清空明细表 * @Description: 清空明细表
* @Author: hgw * @Author: hgw
* @Date: 2024/6/6 9:54 * @Date: 2024/6/6 9:54
* @return: void * @return: void
**/ **/
void deleteByParentId(String parentId); void deleteByParentId(String parentId, int sourceType);
/** /**
* @param parentId * @param parentId
......
...@@ -20,6 +20,7 @@ package com.yifu.cloud.plus.v1.yifu.social.service; ...@@ -20,6 +20,7 @@ package com.yifu.cloud.plus.v1.yifu.social.service;
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.TSocialInfo; import com.yifu.cloud.plus.v1.yifu.social.entity.TSocialInfo;
import org.springframework.web.multipart.MultipartFile;
/** /**
* 社保士兵 * 社保士兵
...@@ -62,4 +63,7 @@ public interface TSocialSoldierService extends IService<TSocialInfo> { ...@@ -62,4 +63,7 @@ public interface TSocialSoldierService extends IService<TSocialInfo> {
**/ **/
R<String> getReHandle(String parentId); R<String> getReHandle(String parentId);
R<String> getZip(MultipartFile zipFile);
} }
...@@ -178,8 +178,8 @@ public class TAutoPaymentDetailServiceImpl extends ServiceImpl<TAutoPaymentDetai ...@@ -178,8 +178,8 @@ public class TAutoPaymentDetailServiceImpl extends ServiceImpl<TAutoPaymentDetai
} }
@Override @Override
public void deleteByParentId(String parentId) { public void deleteByParentId(String parentId, int sourceType) {
baseMapper.deleteByParentId(parentId); baseMapper.deleteByParentId(parentId, sourceType);
} }
@Override @Override
public List<TAutoPaymentDetail> getListByParentId(String parentId) { public List<TAutoPaymentDetail> getListByParentId(String parentId) {
......
...@@ -114,7 +114,7 @@ public class TSocialSoldierPushServiceImpl extends ServiceImpl<TSocialSoldierMap ...@@ -114,7 +114,7 @@ public class TSocialSoldierPushServiceImpl extends ServiceImpl<TSocialSoldierMap
if (type == 2) { if (type == 2) {
List<SocialSoldierSetVo> setList = new ArrayList<>(); List<SocialSoldierSetVo> setList = new ArrayList<>();
SocialSoldierSetVo vo = new SocialSoldierSetVo(); SocialSoldierSetVo vo = new SocialSoldierSetVo();
vo.setIsAutoSubmit(""); vo.setIsAutoSubmit("");
vo.setIsAutoInsert("否"); vo.setIsAutoInsert("否");
vo.setIsAutoUpload("否"); vo.setIsAutoUpload("否");
vo.setIsDoShenBao("否"); vo.setIsDoShenBao("否");
......
...@@ -20,8 +20,8 @@ import cn.hutool.core.util.CharsetUtil; ...@@ -20,8 +20,8 @@ import cn.hutool.core.util.CharsetUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; 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.CommonConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants; import com.yifu.cloud.plus.v1.yifu.common.core.constant.SecurityConstants;
import com.yifu.cloud.plus.v1.yifu.common.core.util.DateUtil;
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.core.vo.FileVo;
import com.yifu.cloud.plus.v1.yifu.common.core.vo.YifuUser; 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.config.SocialConfig;
import com.yifu.cloud.plus.v1.yifu.social.entity.*; import com.yifu.cloud.plus.v1.yifu.social.entity.*;
...@@ -31,19 +31,22 @@ import com.yifu.cloud.plus.v1.yifu.social.vo.TSocialSoldierReturnAuditErrorVo; ...@@ -31,19 +31,22 @@ import com.yifu.cloud.plus.v1.yifu.social.vo.TSocialSoldierReturnAuditErrorVo;
import com.yifu.cloud.plus.v1.yifu.social.vo.TSocialSoldierReturnErrorVo; import com.yifu.cloud.plus.v1.yifu.social.vo.TSocialSoldierReturnErrorVo;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2; import lombok.extern.log4j.Log4j2;
import org.apache.commons.io.FileUtils;
import org.apache.poi.hssf.usermodel.HSSFCell; import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFRow; import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet; import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.CellType; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.scheduling.annotation.Async;
import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.AuthorityUtils; import org.springframework.security.core.authority.AuthorityUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
import java.io.*; import java.io.*;
import java.math.BigDecimal; import java.math.BigDecimal;
...@@ -53,7 +56,9 @@ import java.net.URLEncoder; ...@@ -53,7 +56,9 @@ import java.net.URLEncoder;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.zip.*; import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;
/** /**
* 社保士兵 * 社保士兵
...@@ -87,6 +92,7 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -87,6 +92,7 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.lang.String>
**/ **/
@Override @Override
@Async
public R<String> getReHandle(String parentId) { public R<String> getReHandle(String parentId) {
TAutoPaymentInfo mainAuto = tAutoPaymentInfoService.getById(parentId); TAutoPaymentInfo mainAuto = tAutoPaymentInfoService.getById(parentId);
if (mainAuto == null || Common.isEmpty(mainAuto.getId())) { if (mainAuto == null || Common.isEmpty(mainAuto.getId())) {
...@@ -156,7 +162,6 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -156,7 +162,6 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
fourMap.put(detail.getCertNum() + CommonConstants.DOWN_LINE_STRING + detail.getSocialSecurityAccount() + CommonConstants.DOWN_LINE_STRING + detail.getInsuranceType(), detail); fourMap.put(detail.getCertNum() + CommonConstants.DOWN_LINE_STRING + detail.getSocialSecurityAccount() + CommonConstants.DOWN_LINE_STRING + detail.getInsuranceType(), detail);
} }
} }
ZipOutputStream zipOut = null;
try { try {
boolean reFlag = true; boolean reFlag = true;
...@@ -179,29 +184,16 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -179,29 +184,16 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
inRiChang = conn.getInputStream(); inRiChang = conn.getInputStream();
// 原表ZIP-1日常申报流 // 原表ZIP-1日常申报流
mainAuto.setAttaUrlOne(fileTeturnUrl); mainAuto.setAttaUrlOne(fileTeturnUrl);
/*zipOut.putNextEntry(new ZipEntry("riChangShenBao_file.zip"));
int bytesRead;
while((bytesRead = inRiChang.read())!=-1) {
zipOut.write(bytesRead);
}
zipOut.closeEntry();*/
/*entry = new ZipEntry("riChangShenBao_file.zip");
bytes = new byte[20480000];
if (inRiChang != null) {
zipOut.putNextEntry(entry);
while ((len = inRiChang.read(bytes)) > 0) {
zipOut.write(bytes, 0, len);
}
}*/
// 实际读取文件内容 // 实际读取文件内容
R<List<TAutoPaymentDetail>> detailROne = this.readZipByPayment(reFlag, oneMap, zipOut, inRiChang, 1, mainAuto); R<List<TAutoPaymentDetail>> detailROne = this.readZipByPayment(reFlag, oneMap, inRiChang, 1, mainAuto);
if (detailROne != null && CommonConstants.SUCCESS.equals(detailROne.getCode()) && detailROne.getData() != null && !detailROne.getData().isEmpty()) { if (detailROne != null && CommonConstants.SUCCESS.equals(detailROne.getCode())) {
if (detailROne.getData() != null && !detailROne.getData().isEmpty()) {
detailListOne = detailROne.getData(); detailListOne = detailROne.getData();
if (detailListOne != null && !detailListOne.isEmpty()) { if (detailListOne != null && !detailListOne.isEmpty()) {
tAutoPaymentDetailService.updateBatchById(detailListOne); tAutoPaymentDetailService.updateBatchById(detailListOne);
} }
mainAuto.setRepeatReviewFlag(CommonConstants.ONE_STRING); }
mainAuto.setRepeatReviewFlag(CommonConstants.TWO_STRING);
addIdOneTask.setDataStatus(CommonConstants.ONE_STRING); addIdOneTask.setDataStatus(CommonConstants.ONE_STRING);
tSocialSoldierShenBaoTaskService.updateById(addIdOneTask); tSocialSoldierShenBaoTaskService.updateById(addIdOneTask);
} }
...@@ -219,24 +211,16 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -219,24 +211,16 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
// 原表ZIP-2单位个人缴费信息查询; // 原表ZIP-2单位个人缴费信息查询;
mainAuto.setAttaUrlTwo(fileTeturnUrl); mainAuto.setAttaUrlTwo(fileTeturnUrl);
/*if (inRenYuan != null) {
entry = new ZipEntry("renYuanMingXi_file.zip");
zipOut.putNextEntry(entry);
bytes = new byte[20480000];
while ((len = inRenYuan.read(bytes)) > 0) {
zipOut.write(bytes, 0, len);
}
}*/
// 实际读取文件内容 // 实际读取文件内容
R<List<TAutoPaymentDetail>> detailRTwo = this.readZipByPayment(reFlag, twoMap, zipOut, inRenYuan, 2, mainAuto); R<List<TAutoPaymentDetail>> detailRTwo = this.readZipByPayment(reFlag, twoMap, inRenYuan, 2, mainAuto);
if (detailRTwo != null && CommonConstants.SUCCESS.equals(detailRTwo.getCode()) && detailRTwo.getData() != null && !detailRTwo.getData().isEmpty()) { if (detailRTwo != null && CommonConstants.SUCCESS.equals(detailRTwo.getCode())) {
if (detailRTwo.getData() != null && !detailRTwo.getData().isEmpty()) {
detailListTwo = detailRTwo.getData(); detailListTwo = detailRTwo.getData();
if (detailListTwo != null && !detailListTwo.isEmpty()) { if (detailListTwo != null && !detailListTwo.isEmpty()) {
tAutoPaymentDetailService.updateBatchById(detailListTwo); tAutoPaymentDetailService.updateBatchById(detailListTwo);
} }
mainAuto.setRepeatReviewFlag(CommonConstants.ONE_STRING); }
mainAuto.setRepeatReviewFlag(CommonConstants.TWO_STRING);
addIdTwoTask.setDataStatus(CommonConstants.ONE_STRING); addIdTwoTask.setDataStatus(CommonConstants.ONE_STRING);
tSocialSoldierShenBaoTaskService.updateById(addIdTwoTask); tSocialSoldierShenBaoTaskService.updateById(addIdTwoTask);
} }
...@@ -253,31 +237,16 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -253,31 +237,16 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
inDanWei = conn.getInputStream(); inDanWei = conn.getInputStream();
// 原表ZIP-3单位缴费明细查询 // 原表ZIP-3单位缴费明细查询
mainAuto.setAttaUrlThree(fileTeturnUrl); mainAuto.setAttaUrlThree(fileTeturnUrl);
/*zipOut.putNextEntry(new ZipEntry("danWeiMingXi_file.zip"));
int bytesRead;
while((bytesRead = inDanWei.read())!=-1) {
zipOut.write(bytesRead);
}
zipOut.closeEntry();*/
/*if (inDanWei != null) {
entry = new ZipEntry("danWeiMingXi_file.zip");
zipOut.putNextEntry(entry);
bytes = new byte[20480000];
while ((len = inDanWei.read(bytes)) > 0) {
zipOut.write(bytes, 0, len);
}
}*/
// 实际读取文件内容 // 实际读取文件内容
R<List<TAutoPaymentDetail>> detailRThree = this.readZipByPayment(reFlag, threeMap, zipOut, inDanWei, 3, mainAuto); R<List<TAutoPaymentDetail>> detailRThree = this.readZipByPayment(reFlag, threeMap, inDanWei, 3, mainAuto);
if (detailRThree != null && CommonConstants.SUCCESS.equals(detailRThree.getCode()) && detailRThree.getData() != null && !detailRThree.getData().isEmpty()) { if (detailRThree != null && CommonConstants.SUCCESS.equals(detailRThree.getCode())) {
if (detailRThree.getData() != null && !detailRThree.getData().isEmpty()) {
detailListThree = detailRThree.getData(); detailListThree = detailRThree.getData();
if (detailListThree != null && !detailListThree.isEmpty()) { if (detailListThree != null && !detailListThree.isEmpty()) {
tAutoPaymentDetailService.updateBatchById(detailListThree); tAutoPaymentDetailService.updateBatchById(detailListThree);
} }
mainAuto.setRepeatReviewFlag(CommonConstants.ONE_STRING); }
mainAuto.setRepeatReviewFlag(CommonConstants.TWO_STRING);
addIdThreeTask.setDataStatus(CommonConstants.ONE_STRING); addIdThreeTask.setDataStatus(CommonConstants.ONE_STRING);
tSocialSoldierShenBaoTaskService.updateById(addIdThreeTask); tSocialSoldierShenBaoTaskService.updateById(addIdThreeTask);
} }
...@@ -294,55 +263,23 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -294,55 +263,23 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
inDanWeiXiaZai = conn.getInputStream(); inDanWeiXiaZai = conn.getInputStream();
// 原表ZIP-4单位缴费明细下载 // 原表ZIP-4单位缴费明细下载
mainAuto.setAttaUrlFour(fileTeturnUrl); mainAuto.setAttaUrlFour(fileTeturnUrl);
/*if (inDanWeiXiaZai != null) {
entry = new ZipEntry("danWeiXiaZai_file.zip");
zipOut.putNextEntry(entry);
bytes = new byte[20480000];
while ((len = inDanWeiXiaZai.read(bytes)) > 0) {
zipOut.write(bytes, 0, len);
}
}*/
// 实际读取文件内容 // 实际读取文件内容
R<List<TAutoPaymentDetail>> detailRFour = this.readZipByPayment(reFlag, fourMap, zipOut, inDanWeiXiaZai, 4, mainAuto); R<List<TAutoPaymentDetail>> detailRFour = this.readZipByPayment(reFlag, fourMap, inDanWeiXiaZai, 4, mainAuto);
if (detailRFour != null && CommonConstants.SUCCESS.equals(detailRFour.getCode()) && detailRFour.getData() != null && !detailRFour.getData().isEmpty()) { if (detailRFour != null && CommonConstants.SUCCESS.equals(detailRFour.getCode())) {
detailListFour = detailRFour.getData();
if (detailRFour.getData() != null && !detailRFour.getData().isEmpty()) {
detailListFour = detailRFour.getData();
if (detailListFour != null && !detailListFour.isEmpty()) { if (detailListFour != null && !detailListFour.isEmpty()) {
tAutoPaymentDetailService.updateBatchById(detailListFour); tAutoPaymentDetailService.updateBatchById(detailListFour);
} }
mainAuto.setRepeatReviewFlag(CommonConstants.ONE_STRING); }
mainAuto.setRepeatReviewFlag(CommonConstants.TWO_STRING);
addIdSixTask.setDataStatus(CommonConstants.ONE_STRING); addIdSixTask.setDataStatus(CommonConstants.ONE_STRING);
tSocialSoldierShenBaoTaskService.updateById(addIdSixTask); tSocialSoldierShenBaoTaskService.updateById(addIdSixTask);
} }
} }
} }
/*ByteArrayOutputStream baos = new ByteArrayOutputStream();
// 将ZipOutputStream的内容写入ByteArrayOutputStream
byte[] buffer = new byte[1024];
int reads;
while((reads = byteArrayInputStream.read(buffer)) != -1){
zipOut.write(buffer, 0, reads);
}
InputStream byteArrayInputStream = new ByteArrayInputStream(buffer);*/
// 上传Zip
/*boolean flag = ossUtil.uploadFileByFile(zipFile, key, null);
// 完成和释放资源
//baos.close();
if (flag) {
mainAuto.setAttaSrc(key);
} else {
return R.failed("failed:上传至存储空间失败");
}*/
tAutoPaymentInfoService.updateById(mainAuto); tAutoPaymentInfoService.updateById(mainAuto);
// 核验 // 核验
if (detailListOne != null && !detailListOne.isEmpty() if (detailListOne != null && !detailListOne.isEmpty()
...@@ -360,9 +297,9 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -360,9 +297,9 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
mainAuto.setRepeatReviewFlag(CommonConstants.TWO_STRING); mainAuto.setRepeatReviewFlag(CommonConstants.TWO_STRING);
tAutoPaymentInfoService.updateById(mainAuto); tAutoPaymentInfoService.updateById(mainAuto);
} }
} catch(Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally{ } finally {
try { try {
if (inRiChang != null) { if (inRiChang != null) {
inRiChang.close(); inRiChang.close();
...@@ -376,14 +313,12 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -376,14 +313,12 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
if (inDanWeiXiaZai != null) { if (inDanWeiXiaZai != null) {
inDanWeiXiaZai.close(); inDanWeiXiaZai.close();
} }
if (zipOut != null) {
zipOut.closeEntry();
zipOut.close();
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
} else {
return R.failed("未找到推送任务,请先推送!");
} }
return R.ok(); return R.ok();
} }
...@@ -397,10 +332,14 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -397,10 +332,14 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
@Override @Override
public R<String> doInnerGetPaymentThree() { public R<String> doInnerGetPaymentThree() {
// 3:实缴1日常申报导出;4:实缴2单位个人缴费信息查询;5:实缴3单位缴费明细查询 // 3:实缴1日常申报导出;4:实缴2单位个人缴费信息查询;5:实缴3单位缴费明细查询
TSocialSoldierShenBaoTask addIdOneTask = tSocialSoldierShenBaoTaskService.getSoldierTaskAddIdByType(CommonConstants.THREE_STRING); int type = 3;
TSocialSoldierShenBaoTask addIdTwoTask = tSocialSoldierShenBaoTaskService.getSoldierTaskAddIdByType(CommonConstants.FOUR_STRING); TSocialSoldierShenBaoTask addIdOneTask = tSocialSoldierShenBaoTaskService.getSoldierTaskAddIdByType(String.valueOf(type));
TSocialSoldierShenBaoTask addIdThreeTask = tSocialSoldierShenBaoTaskService.getSoldierTaskAddIdByType(CommonConstants.FIVE_STRING); type++;
TSocialSoldierShenBaoTask addIdSixTask = tSocialSoldierShenBaoTaskService.getSoldierTaskAddIdByType(CommonConstants.SIX_STRING); TSocialSoldierShenBaoTask addIdTwoTask = tSocialSoldierShenBaoTaskService.getSoldierTaskAddIdByType(String.valueOf(type));
type++;
TSocialSoldierShenBaoTask addIdThreeTask = tSocialSoldierShenBaoTaskService.getSoldierTaskAddIdByType(String.valueOf(type));
type++;
TSocialSoldierShenBaoTask addIdSixTask = tSocialSoldierShenBaoTaskService.getSoldierTaskAddIdByType(String.valueOf(type));
String addIdOne = null; String addIdOne = null;
String addIdOTwo = null; String addIdOTwo = null;
String addIdThree = null; String addIdThree = null;
...@@ -430,7 +369,6 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -430,7 +369,6 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
if (Common.isNotNull(resultFile) || Common.isNotNull(resultFileTwo) if (Common.isNotNull(resultFile) || Common.isNotNull(resultFileTwo)
|| Common.isNotNull(resultFileThree) || Common.isNotNull(resultFileFour)) { || Common.isNotNull(resultFileThree) || Common.isNotNull(resultFileFour)) {
boolean reFlag = false; boolean reFlag = false;
ZipOutputStream zipOut = null;
try { try {
// 1查询主表 // 1查询主表
TAutoPaymentInfo mainAuto = tAutoPaymentInfoService.getThisMonthMainAuto(); TAutoPaymentInfo mainAuto = tAutoPaymentInfoService.getThisMonthMainAuto();
...@@ -446,18 +384,6 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -446,18 +384,6 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
mainAuto.setDataTwoFlag(CommonConstants.ZERO_STRING); mainAuto.setDataTwoFlag(CommonConstants.ZERO_STRING);
mainAuto.setDataThreeFlag(CommonConstants.ZERO_STRING); mainAuto.setDataThreeFlag(CommonConstants.ZERO_STRING);
tAutoPaymentInfoService.save(mainAuto); tAutoPaymentInfoService.save(mainAuto);
} else {
mainAuto.setSystemReviewFlag(CommonConstants.ZERO_STRING);
mainAuto.setRepeatReviewFlag(CommonConstants.ZERO_STRING);
mainAuto.setDataOneFlag(CommonConstants.ZERO_STRING);
mainAuto.setDataTwoFlag(CommonConstants.ZERO_STRING);
mainAuto.setDataThreeFlag(CommonConstants.ZERO_STRING);
mainAuto.setDataOneRemark(CommonConstants.CENTER_SPLIT_LINE_STRING);
mainAuto.setDataTwoFlag(CommonConstants.CENTER_SPLIT_LINE_STRING);
mainAuto.setDataThreeFlag(CommonConstants.CENTER_SPLIT_LINE_STRING);
tAutoPaymentInfoService.updateById(mainAuto);
// 清空明细表
tAutoPaymentDetailService.deleteByParentId(mainAuto.getId());
} }
List<TAutoPaymentDetail> detailListOne = null; List<TAutoPaymentDetail> detailListOne = null;
...@@ -466,17 +392,6 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -466,17 +392,6 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
List<TAutoPaymentDetail> detailListFour = null; List<TAutoPaymentDetail> detailListFour = null;
URL url; URL url;
String fileTeturnUrl; String fileTeturnUrl;
// 组装原表下载文件:
String filePath = "autoPayment";
String key = filePath + "/riChang_" + System.currentTimeMillis() + ".zip";
File zipFile = File.createTempFile(filePath, ".zip");
FileOutputStream fos = new FileOutputStream(zipFile);
CheckedOutputStream csum = new CheckedOutputStream(fos, new Adler32());
zipOut = new ZipOutputStream(csum);
ZipEntry entry;
byte[] bytes;
int len;
// 解决中文文件名的乱码问题 // 解决中文文件名的乱码问题
if (Common.isNotNull(resultFile)) { if (Common.isNotNull(resultFile)) {
fileTeturnUrl = resultFile.getData(); fileTeturnUrl = resultFile.getData();
...@@ -489,31 +404,23 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -489,31 +404,23 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
inRiChang = conn.getInputStream(); inRiChang = conn.getInputStream();
// 原表ZIP-1日常申报流 // 原表ZIP-1日常申报流
mainAuto.setAttaUrlOne(fileTeturnUrl); mainAuto.setAttaUrlOne(fileTeturnUrl);
/*zipOut.putNextEntry(new ZipEntry("riChangShenBao_file.zip")); mainAuto.setDataOneFlag(CommonConstants.ONE_STRING);
int bytesRead; // 清空明细表
while((bytesRead = inRiChang.read())!=-1) { tAutoPaymentDetailService.deleteByParentId(mainAuto.getId(), 1);
zipOut.write(bytesRead);
}
zipOut.closeEntry();*/
/*entry = new ZipEntry("riChangShenBao_file.zip");
bytes = new byte[20480000];
if (inRiChang != null) {
zipOut.putNextEntry(entry);
while ((len = inRiChang.read(bytes)) > 0) {
zipOut.write(bytes, 0, len);
}
}*/
// 实际读取文件内容 // 实际读取文件内容
R<List<TAutoPaymentDetail>> detailROne = this.readZipByPayment(reFlag, null, zipOut, inRiChang, 1, mainAuto); R<List<TAutoPaymentDetail>> detailROne = this.readZipByPayment(reFlag, null, inRiChang, 1, mainAuto);
if (detailROne != null && CommonConstants.SUCCESS.equals(detailROne.getCode()) && detailROne.getData() != null && !detailROne.getData().isEmpty()) { if (detailROne != null && CommonConstants.SUCCESS.equals(detailROne.getCode())) {
if (detailROne.getData() != null && !detailROne.getData().isEmpty()) {
detailListOne = detailROne.getData(); detailListOne = detailROne.getData();
if (detailListOne != null && !detailListOne.isEmpty()) { if (detailListOne != null && !detailListOne.isEmpty()) {
tAutoPaymentDetailService.saveBatch(detailListOne); tAutoPaymentDetailService.saveBatch(detailListOne);
}
}
addIdOneTask.setDataStatus(CommonConstants.ONE_STRING); addIdOneTask.setDataStatus(CommonConstants.ONE_STRING);
tSocialSoldierShenBaoTaskService.updateById(addIdOneTask); tSocialSoldierShenBaoTaskService.updateById(addIdOneTask);
} mainAuto.setDataOneFlag(CommonConstants.TWO_STRING);
mainAuto.setDataOneFlag(CommonConstants.ONE_STRING); } else {
mainAuto.setDataOneFlag(CommonConstants.THREE_STRING);
} }
} }
} }
...@@ -526,27 +433,26 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -526,27 +433,26 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
//设置超时间为30秒 //设置超时间为30秒
conn.setConnectTimeout(30 * 1000); conn.setConnectTimeout(30 * 1000);
inRenYuan = conn.getInputStream(); inRenYuan = conn.getInputStream();
// 原表ZIP-2单位个人缴费信息查询; // 原表ZIP-2单位个人缴费信息查询;
mainAuto.setAttaUrlTwo(fileTeturnUrl); mainAuto.setAttaUrlTwo(fileTeturnUrl);
/*if (inRenYuan != null) { mainAuto.setDataTwoFlag(CommonConstants.ONE_STRING);
entry = new ZipEntry("renYuanMingXi_file.zip"); // 清空明细表
zipOut.putNextEntry(entry); tAutoPaymentDetailService.deleteByParentId(mainAuto.getId(), 2);
bytes = new byte[20480000];
while ((len = inRenYuan.read(bytes)) > 0) {
zipOut.write(bytes, 0, len);
}
}*/
// 实际读取文件内容 // 实际读取文件内容
R<List<TAutoPaymentDetail>> detailRTwo = this.readZipByPayment(reFlag, null, zipOut, inRenYuan, 2, mainAuto); R<List<TAutoPaymentDetail>> detailRTwo = this.readZipByPayment(reFlag, null, inRenYuan, 2, mainAuto);
if (detailRTwo != null && CommonConstants.SUCCESS.equals(detailRTwo.getCode()) && detailRTwo.getData() != null && !detailRTwo.getData().isEmpty()) {
if (detailRTwo != null && CommonConstants.SUCCESS.equals(detailRTwo.getCode())) {
if (detailRTwo.getData() != null && !detailRTwo.getData().isEmpty()) {
detailListTwo = detailRTwo.getData(); detailListTwo = detailRTwo.getData();
if (detailListTwo != null && !detailListTwo.isEmpty()) { if (detailListTwo != null && !detailListTwo.isEmpty()) {
tAutoPaymentDetailService.saveBatch(detailListTwo); tAutoPaymentDetailService.saveBatch(detailListTwo);
}
}
addIdTwoTask.setDataStatus(CommonConstants.ONE_STRING); addIdTwoTask.setDataStatus(CommonConstants.ONE_STRING);
tSocialSoldierShenBaoTaskService.updateById(addIdTwoTask); tSocialSoldierShenBaoTaskService.updateById(addIdTwoTask);
} mainAuto.setDataTwoFlag(CommonConstants.TWO_STRING);
mainAuto.setDataTwoFlag(CommonConstants.ONE_STRING); } else {
mainAuto.setDataTwoFlag(CommonConstants.THREE_STRING);
} }
} }
} }
...@@ -561,30 +467,24 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -561,30 +467,24 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
inDanWei = conn.getInputStream(); inDanWei = conn.getInputStream();
// 原表ZIP-3单位缴费明细查询 // 原表ZIP-3单位缴费明细查询
mainAuto.setAttaUrlThree(fileTeturnUrl); mainAuto.setAttaUrlThree(fileTeturnUrl);
/*zipOut.putNextEntry(new ZipEntry("danWeiMingXi_file.zip")); mainAuto.setDataThreeFlag(CommonConstants.ONE_STRING);
int bytesRead; // 清空明细表
while((bytesRead = inDanWei.read())!=-1) { tAutoPaymentDetailService.deleteByParentId(mainAuto.getId(), 3);
zipOut.write(bytesRead);
}
zipOut.closeEntry();*/
/*if (inDanWei != null) {
entry = new ZipEntry("danWeiMingXi_file.zip");
zipOut.putNextEntry(entry);
bytes = new byte[20480000];
while ((len = inDanWei.read(bytes)) > 0) {
zipOut.write(bytes, 0, len);
}
}*/
// 实际读取文件内容 // 实际读取文件内容
R<List<TAutoPaymentDetail>> detailRThree = this.readZipByPayment(reFlag, null, zipOut, inDanWei, 3, mainAuto); R<List<TAutoPaymentDetail>> detailRThree = this.readZipByPayment(reFlag, null, inDanWei, 3, mainAuto);
if (detailRThree != null && CommonConstants.SUCCESS.equals(detailRThree.getCode()) && detailRThree.getData() != null && !detailRThree.getData().isEmpty()) {
if (detailRThree != null && CommonConstants.SUCCESS.equals(detailRThree.getCode())) {
if (detailRThree.getData() != null && !detailRThree.getData().isEmpty()) {
detailListThree = detailRThree.getData(); detailListThree = detailRThree.getData();
if (detailListThree != null && !detailListThree.isEmpty()) { if (detailListThree != null && !detailListThree.isEmpty()) {
tAutoPaymentDetailService.saveBatch(detailListThree); tAutoPaymentDetailService.saveBatch(detailListThree);
}
}
addIdThreeTask.setDataStatus(CommonConstants.ONE_STRING); addIdThreeTask.setDataStatus(CommonConstants.ONE_STRING);
tSocialSoldierShenBaoTaskService.updateById(addIdThreeTask); tSocialSoldierShenBaoTaskService.updateById(addIdThreeTask);
} mainAuto.setDataThreeFlag(CommonConstants.TWO_STRING);
mainAuto.setDataThreeFlag(CommonConstants.ONE_STRING); } else {
mainAuto.setDataThreeFlag(CommonConstants.THREE_STRING);
} }
} }
} }
...@@ -599,52 +499,26 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -599,52 +499,26 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
inDanWeiXiaZai = conn.getInputStream(); inDanWeiXiaZai = conn.getInputStream();
// 原表ZIP-4单位缴费明细下载 // 原表ZIP-4单位缴费明细下载
mainAuto.setAttaUrlFour(fileTeturnUrl); mainAuto.setAttaUrlFour(fileTeturnUrl);
/*if (inDanWeiXiaZai != null) { mainAuto.setDataThreeFlag(CommonConstants.ONE_STRING);
entry = new ZipEntry("danWeiXiaZai_file.zip"); // 清空明细表
zipOut.putNextEntry(entry); tAutoPaymentDetailService.deleteByParentId(mainAuto.getId(), 4);
bytes = new byte[20480000];
while ((len = inDanWeiXiaZai.read(bytes)) > 0) {
zipOut.write(bytes, 0, len);
}
}*/
// 实际读取文件内容 // 实际读取文件内容
R<List<TAutoPaymentDetail>> detailRFour = this.readZipByPayment(reFlag, null, zipOut, inDanWeiXiaZai, 4, mainAuto); R<List<TAutoPaymentDetail>> detailRFour = this.readZipByPayment(reFlag, null, inDanWeiXiaZai, 4, mainAuto);
if (detailRFour != null && CommonConstants.SUCCESS.equals(detailRFour.getCode()) && detailRFour.getData() != null && !detailRFour.getData().isEmpty()) { if (detailRFour != null && CommonConstants.SUCCESS.equals(detailRFour.getCode())) {
if (detailRFour.getData() != null && !detailRFour.getData().isEmpty()) {
detailListFour = detailRFour.getData(); detailListFour = detailRFour.getData();
if (detailListFour != null && !detailListFour.isEmpty()) { if (detailListFour != null && !detailListFour.isEmpty()) {
tAutoPaymentDetailService.saveBatch(detailListFour); tAutoPaymentDetailService.saveBatch(detailListFour);
addIdSixTask.setDataStatus(CommonConstants.ONE_STRING);
tSocialSoldierShenBaoTaskService.updateById(addIdSixTask);
} }
mainAuto.setDataThreeFlag(CommonConstants.ONE_STRING);
} }
addIdSixTask.setDataStatus(CommonConstants.ONE_STRING);
tSocialSoldierShenBaoTaskService.updateById(addIdSixTask);
mainAuto.setDataThreeFlag(CommonConstants.TWO_STRING);
} else {
mainAuto.setDataThreeFlag(CommonConstants.THREE_STRING);
} }
} }
/*ByteArrayOutputStream baos = new ByteArrayOutputStream();
// 将ZipOutputStream的内容写入ByteArrayOutputStream
byte[] buffer = new byte[1024];
int reads;
while((reads = byteArrayInputStream.read(buffer)) != -1){
zipOut.write(buffer, 0, reads);
} }
InputStream byteArrayInputStream = new ByteArrayInputStream(buffer);*/
// 上传Zip
/*boolean flag = ossUtil.uploadFileByFile(zipFile, key, null);
// 完成和释放资源
//baos.close();
if (flag) {
mainAuto.setAttaSrc(key);
} else {
return R.failed("failed:上传至存储空间失败");
}*/
tAutoPaymentInfoService.updateById(mainAuto); tAutoPaymentInfoService.updateById(mainAuto);
// 核验 // 核验
if (detailListOne != null && !detailListOne.isEmpty() if (detailListOne != null && !detailListOne.isEmpty()
...@@ -659,9 +533,9 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -659,9 +533,9 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
mainAuto.setSystemReviewFlag(CommonConstants.TWO_STRING); mainAuto.setSystemReviewFlag(CommonConstants.TWO_STRING);
tAutoPaymentInfoService.updateById(mainAuto); tAutoPaymentInfoService.updateById(mainAuto);
} }
} catch(Exception e){ } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} finally{ } finally {
try { try {
if (inRiChang != null) { if (inRiChang != null) {
inRiChang.close(); inRiChang.close();
...@@ -675,10 +549,6 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -675,10 +549,6 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
if (inDanWeiXiaZai != null) { if (inDanWeiXiaZai != null) {
inDanWeiXiaZai.close(); inDanWeiXiaZai.close();
} }
if (zipOut != null) {
zipOut.closeEntry();
zipOut.close();
}
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -687,6 +557,197 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -687,6 +557,197 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
return R.ok(); return R.ok();
} }
@Override
public R<String> getZip(MultipartFile zipFile) {
// 3:实缴1日常申报导出;4:实缴2单位个人缴费信息查询;5:实缴3单位缴费明细查询
TSocialSoldierShenBaoTask addIdOneTask = tSocialSoldierShenBaoTaskService.getSoldierTaskAddIdByType(CommonConstants.THREE_STRING);
String addIdOne = null;
if (addIdOneTask != null && Common.isNotNull(addIdOneTask.getId())) {
addIdOne = addIdOneTask.getAddId();
}
HttpURLConnection conn;
InputStream inRiChang = null;
// 1日常申报导出;2单位个人缴费信息查询;3单位缴费明细查询
R<String> resultFile = socialConfig.getFiveJob(restTemplate, addIdOne, RESULT_ANNEX);
if (Common.isNotNull(resultFile)) {
try {
URL url;
String fileTeturnUrl;
// 解决中文文件名的乱码问题
if (Common.isNotNull(resultFile)) {
fileTeturnUrl = resultFile.getData();
if (Common.isNotNull(fileTeturnUrl)) {
fileTeturnUrl = this.getEncodeUrl(fileTeturnUrl);
url = new URL(fileTeturnUrl);
conn = (HttpURLConnection) url.openConnection();
//设置超时间为30秒
conn.setConnectTimeout(30 * 1000);
inRiChang = conn.getInputStream();
// 原表ZIP-1日常申报流
this.readZipByPayment(inRiChang, zipFile);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
return R.ok();
}
/**
* @Description: 实验接口使用的,不删除
* @Author: hgw
* @Date: 2024/6/13 17:45
* @return: void
**/
public void readZipByPayment(InputStream inputStream, MultipartFile zipFileOld) {
ZipFile zipFile = null;
Workbook workbook = null;
InputStream is = null;
try {
String pathName = System.getProperty("java.io.tmpdir");
String dec = System.getProperty("java.io.tmpdir");
String pname = System.currentTimeMillis() + "_实缴4张表";
pathName = pathName + pname;
File file = new File(pathName);
FileUtils.copyInputStreamToFile(inputStream, file);
/*String fileName = System.currentTimeMillis() + "_" + file.getName();
boolean flag = ossUtil.uploadFileByFile(file, fileName, null);*/
zipFile = new ZipFile(file, CharsetUtil.CHARSET_GBK);
Enumeration<?> entries = zipFile.entries();
ZipEntry entry;
String empInfo;
while (entries.hasMoreElements()) {
entry = (ZipEntry) entries.nextElement();
// 如果是文件夹,就创建个文件夹
if (!entry.isDirectory()) {
//添加进filesName
empInfo = entry.getName();
System.out.println(empInfo);
// 将压缩文件内容写入到这个文件中
is = zipFile.getInputStream(entry);
workbook = WorkbookFactory.create(is);
Sheet sheet = workbook.getSheetAt(0);
Row row;
String cellValue;
int nameNum = 0;
// 循环每个sheet
if (sheet != null && Common.isNotNull(sheet.getSheetName())) {
for (int rowNum = 0; rowNum <= sheet.getLastRowNum(); rowNum++) {
row = sheet.getRow(rowNum);
// 循环当前行的内容
if (rowNum == 0) {
for (int cellNum = 0; cellNum < row.getLastCellNum(); cellNum++) {
cellValue = this.getCellValue(row, cellNum);
if ("姓名".equals(cellValue)) {
nameNum = cellNum;
}
}
} else if (rowNum < 10) {
cellValue = this.getCellValue(row, nameNum);
System.out.println(cellValue);
}
}
}
// 关流顺序,先打开的后关闭
is.close();
}
}
//解析完成删除本次解析中生成的文件 删除此目录下的所有文件
deleteFolder(dec);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (workbook != null) {
workbook.close();
}
if (is != null) {
is.close();
}
if (zipFile != null) {
zipFile.close();
}
if (inputStream != null) {
inputStream.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
/**
* 根据路径删除指定的目录或文件,无论存在与否
*
* @param path 要删除的目录或文件路径
* @return 删除成功返回 true,否则返回 false
*/
public static void deleteFolder(String path) {
File file = new File(path);
// 判断目录或文件是否存在
if (file.exists()) {
// 判断是否为文件
if (file.isFile()) { // 为文件时调用删除文件方法
deleteFile(path);
} else { // 为目录时调用删除目录方法
deleteDirectory(path);
}
}
}
/**
* 删除单个文件
*/
private static boolean deleteFile(String path) {
File file = new File(path);
// 路径为文件且不为空则进行删除
if (file.isFile() && file.exists()) {
file.delete();
return true;
}
return false;
}
/**
* 删除目录(文件夹)以及目录下的文件
*/
private static boolean deleteDirectory(String path) {
//如果path不以文件分隔符结尾,自动添加文件分隔符
if (!path.endsWith(File.separator)) {
path = path + File.separator;
}
File dirFile = new File(path);
//如果dir对应的文件不存在,或者不是一个目录,则退出
if (!dirFile.exists() || !dirFile.isDirectory()) {
return false;
}
boolean flag = true;
//删除文件夹下的所有文件(包括子目录)
File[] files = dirFile.listFiles();
for (File file : files) {
//删除子文件
if (file.isFile()) {
flag = deleteFile(file.getAbsolutePath());
} //删除子目录
else {
flag = deleteDirectory(file.getAbsolutePath());
}
if (!flag) {
break;
}
}
if (!flag) {
return false;
}
//删除当前目录
return dirFile.delete();
}
/** /**
* @param reFlag true :复核 * @param reFlag true :复核
* @param oldMap 被标记的map * @param oldMap 被标记的map
...@@ -696,64 +757,45 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -696,64 +757,45 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
* @Date: 2024/6/3 18:17 * @Date: 2024/6/3 18:17
* @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.social.entity.TAutoPaymentDetail>> * @return: com.yifu.cloud.plus.v1.yifu.common.core.util.R<java.util.List < com.yifu.cloud.plus.v1.yifu.social.entity.TAutoPaymentDetail>>
**/ **/
public R<List<TAutoPaymentDetail>> readZipByPayment(boolean reFlag, Map<String, TAutoPaymentDetail> oldMap, ZipOutputStream zipOut public R<List<TAutoPaymentDetail>> readZipByPayment(boolean reFlag, Map<String, TAutoPaymentDetail> oldMap
, InputStream inputStream, int type, TAutoPaymentInfo mainAuto) { , InputStream inputStream, int type, TAutoPaymentInfo mainAuto) {
TAutoPaymentDetail oldDetail; TAutoPaymentDetail oldDetail;
TAutoPaymentDetail detail; TAutoPaymentDetail detail;
TAutoPaymentDetail detailPerson; TAutoPaymentDetail detailPerson;
List<TAutoPaymentDetail> voList = new ArrayList<>(); List<TAutoPaymentDetail> voList = new ArrayList<>();
XSSFWorkbook sheets = null; ZipFile zipFile = null;
XSSFSheet sheetAt = null; Workbook workbook = null;
XSSFRow row = null; InputStream is = null;
HSSFWorkbook sheets97 = null; Sheet sheet = null;
HSSFSheet sheetAt97 = null; Row row;
HSSFRow row97 = null;
ZipInputStream zin = null;
BufferedInputStream bs = null;
// 塞生成月份所用 // 塞生成月份所用
String nowMonth = DateUtil.getThisMonth(); String nowMonth = DateUtil.getThisMonth();
// 资源类型:1日常申报导出;2单位个人缴费信息查询;3单位缴费明细查询 // 资源类型:1日常申报导出;2单位个人缴费信息查询;3单位缴费明细查询
String sourceType = String.valueOf(type); String sourceType = String.valueOf(type);
String dec = System.getProperty("java.io.tmpdir");
try { try {
zin = new ZipInputStream(inputStream, CharsetUtil.CHARSET_GBK); String pathName = dec;
bs = new BufferedInputStream(zin); String pname = System.currentTimeMillis() + "_实缴4张表";
byte[] bytes; pathName = pathName + pname;
ZipEntry ze; File file = new File(pathName);
//循环读取压缩包里面的文件 FileUtils.copyInputStreamToFile(inputStream, file);
while ((ze = zin.getNextEntry()) != null) { /*String fileName =
String name = ze.getName(); System.currentTimeMillis() + "_" + file.getName()
if ((ze.toString().endsWith(".xls") || ze.toString().endsWith(".xlsx")) && Common.isNotNull(name) && (name.contains("全部") || name.contains("汇总"))) { boolean flag = ossUtil.uploadFileByFile(file, fileName, null)*/
/*zipOut.putNextEntry(ze); zipFile = new ZipFile(file, CharsetUtil.CHARSET_GBK);
Enumeration<?> entries = zipFile.entries();
byte[] buffer = new byte[(int) ze.getSize()];
int read;
while((read = bs.read(buffer)) != -1){
zipOut.write(buffer, 0, read);
}*/
//读取每个文件的字节,并放进数组
bytes = new byte[(int) ze.getSize()];
bs.read(bytes, 0, (int) ze.getSize());
//将文件转成流
InputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
//ZipEntry ze2 = new ZipEntry("123.xls");
/*zipOut.putNextEntry(ze);
byte[] buffer = new byte[1024];
int reads;
while((reads = byteArrayInputStream.read(buffer)) != -1){
zipOut.write(buffer, 0, reads);
}*/
try { ZipEntry entry;
sheets = new XSSFWorkbook(byteArrayInputStream); String name;
// sheet while (entries.hasMoreElements()) {
sheetAt = sheets.getSheetAt(0); entry = (ZipEntry) entries.nextElement();
} catch (Exception e) { // 如果是文件夹,就创建个文件夹
sheets97 = new HSSFWorkbook(byteArrayInputStream); if (!entry.isDirectory()) {
// sheet name = entry.getName();
sheetAt97 = sheets97.getSheetAt(0); if (Common.isNotNull(name) && (name.endsWith(".xls") || name.endsWith(".xlsx")) && (name.contains("全部") || name.contains("汇总"))) {
} is = zipFile.getInputStream(entry);
workbook = WorkbookFactory.create(is);
sheet = workbook.getSheetAt(0);
// 每个单元格内容 // 每个单元格内容
String cellValue; String cellValue;
// 错误信息 所在列 // 错误信息 所在列
...@@ -831,9 +873,9 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -831,9 +873,9 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
BigDecimal money; BigDecimal money;
// 循环每个sheet // 循环每个sheet
if (sheetAt != null && Common.isNotNull(sheetAt.getSheetName())) { if (sheet != null && Common.isNotNull(sheet.getSheetName())) {
for (int rowNum = 0; rowNum <= sheetAt.getLastRowNum(); rowNum++) { for (int rowNum = 0; rowNum <= sheet.getLastRowNum(); rowNum++) {
row = sheetAt.getRow(rowNum); row = sheet.getRow(rowNum);
if (row != null) { if (row != null) {
// 初始化 // 初始化
empName = null; empName = null;
...@@ -885,8 +927,7 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -885,8 +927,7 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
personLiXiNum = cellNum; personLiXiNum = cellNum;
} else if ("个人滞纳金".equals(cellValue)) { } else if ("个人滞纳金".equals(cellValue)) {
personZhiNaJinNum = cellNum; personZhiNaJinNum = cellNum;
} } else if ("险种".equals(cellValue) || "参保险种".equals(cellValue) || "险种类型".equals(cellValue)) {
else if ("险种".equals(cellValue) || "参保险种".equals(cellValue) || "险种类型".equals(cellValue)) {
insuranceTypeNum = cellNum; insuranceTypeNum = cellNum;
} else if ("单位名称".equals(cellValue)) { } else if ("单位名称".equals(cellValue)) {
socialSecurityAccountNum = cellNum; socialSecurityAccountNum = cellNum;
...@@ -902,12 +943,12 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -902,12 +943,12 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
} else { } else {
if (Common.isNotNull(errorInfoNum)) { if (Common.isNotNull(errorInfoNum)) {
errorInfo = getCellValue(row, errorInfoNum); errorInfo = getCellValue(row, errorInfoNum);
return R.failed("数据错误:"+errorInfo); return R.failed("数据错误:" + errorInfo);
} else { } else {
// 参保身份类别为退休和缴费总金额为0,2者有其一则不合并 // 参保身份类别为退休和缴费总金额为0,2者有其一则不合并
if (Common.isNotNull(allMoneyNum)) { if (Common.isNotNull(allMoneyNum)) {
allMoney = getCellValue(row, allMoneyNum); allMoney = getCellValue(row, allMoneyNum);
if (Common.isNotNull(allMoney) && BigDecimal.ZERO.equals(new BigDecimal(allMoney))) { if (Common.isNotNull(allMoney) && BigDecimal.ZERO.equals(this.getBigDecimal(allMoney))) {
continue; continue;
} }
} }
...@@ -922,6 +963,11 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -922,6 +963,11 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
} }
if (Common.isNotNull(certNumNum)) { if (Common.isNotNull(certNumNum)) {
certNum = getCellValue(row, certNumNum); certNum = getCellValue(row, certNumNum);
if (Common.isEmpty(certNum) || certNum.contains("合计")) {
break;
}
} else {
break;
} }
if (Common.isNotNull(paymentBaseNum)) { if (Common.isNotNull(paymentBaseNum)) {
paymentBase = getCellValue(row, paymentBaseNum); paymentBase = getCellValue(row, paymentBaseNum);
...@@ -957,7 +1003,7 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -957,7 +1003,7 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
if (Common.isNotNull(payMonthNum)) { if (Common.isNotNull(payMonthNum)) {
payMonth = getCellValue(row, payMonthNum); payMonth = getCellValue(row, payMonthNum);
if (Common.isNotNull(payMonth)) { if (Common.isNotNull(payMonth)) {
payMonth = payMonth.replace("-",""); payMonth = payMonth.replace("-", "");
} }
} }
if (Common.isNotNull(createMonthNum)) { if (Common.isNotNull(createMonthNum)) {
...@@ -969,24 +1015,24 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -969,24 +1015,24 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
detail.setEmpName(empName); detail.setEmpName(empName);
detail.setCertNum(certNum); detail.setCertNum(certNum);
if (Common.isNotNull(paymentBase)) { if (Common.isNotNull(paymentBase)) {
detail.setPaymentBase(new BigDecimal(paymentBase)); detail.setPaymentBase(this.getBigDecimal(paymentBase));
} }
if (Common.isNotNull(payLimit)) { if (Common.isNotNull(payLimit)) {
detail.setPayLimit(new BigDecimal(payLimit)); detail.setPayLimit(this.getBigDecimal(payLimit));
} }
if (Common.isNotNull(unitLimit)) { if (Common.isNotNull(unitLimit)) {
money = new BigDecimal(unitLimit); money = this.getBigDecimal(unitLimit);
if (Common.isNotNull(unitLiXi)) { if (Common.isNotNull(unitLiXi)) {
money = BigDecimalUtils.safeAdd(money, new BigDecimal(unitLiXi)); money = BigDecimalUtils.safeAdd(money, this.getBigDecimal(unitLiXi));
} }
if (Common.isNotNull(unitZhiNaJin)) { if (Common.isNotNull(unitZhiNaJin)) {
money = BigDecimalUtils.safeAdd(money, new BigDecimal(unitZhiNaJin)); money = BigDecimalUtils.safeAdd(money, this.getBigDecimal(unitZhiNaJin));
} }
detail.setPayLimit(money); detail.setPayLimit(money);
} }
detail.setInsuranceType(insuranceType); detail.setInsuranceType(insuranceType);
if (Common.isNotNull(unitLimit)) { if (Common.isNotNull(unitLimit)) {
detail.setInsuranceType("单位"+insuranceType); detail.setInsuranceType("单位" + insuranceType);
} }
detail.setSocialSecurityAccount(socialSecurityAccount); detail.setSocialSecurityAccount(socialSecurityAccount);
detail.setPayMonth(payMonth); detail.setPayMonth(payMonth);
...@@ -1006,28 +1052,28 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -1006,28 +1052,28 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
voList.add(detail); voList.add(detail);
} }
} }
} else{ } else {
voList.add(detail); voList.add(detail);
} }
// 个人的拆为第二条 // 个人的拆为第二条
if (Common.isNotNull(personLimit)) { if (Common.isNotNull(personLimit)) {
money = new BigDecimal(personLimit); money = this.getBigDecimal(personLimit);
if (Common.isNotNull(personLiXi)) { if (Common.isNotNull(personLiXi)) {
money = BigDecimalUtils.safeAdd(money, new BigDecimal(personLiXi)); money = BigDecimalUtils.safeAdd(money, this.getBigDecimal(personLiXi));
} }
if (Common.isNotNull(personZhiNaJin)) { if (Common.isNotNull(personZhiNaJin)) {
money = BigDecimalUtils.safeAdd(money, new BigDecimal(personZhiNaJin)); money = BigDecimalUtils.safeAdd(money, this.getBigDecimal(personZhiNaJin));
} }
detailPerson = new TAutoPaymentDetail(); detailPerson = new TAutoPaymentDetail();
detail.setParentId(mainAuto.getId()); detailPerson.setParentId(mainAuto.getId());
detailPerson.setSourceType(sourceType); detailPerson.setSourceType(sourceType);
detailPerson.setPayLimit(money); detailPerson.setPayLimit(money);
detailPerson.setEmpName(empName); detailPerson.setEmpName(empName);
detailPerson.setCertNum(certNum); detailPerson.setCertNum(certNum);
if (Common.isNotNull(paymentBase)) { if (Common.isNotNull(paymentBase)) {
detailPerson.setPaymentBase(new BigDecimal(paymentBase)); detailPerson.setPaymentBase(this.getBigDecimal(paymentBase));
} }
detailPerson.setInsuranceType("个人"+insuranceType); detailPerson.setInsuranceType("个人" + insuranceType);
detailPerson.setSocialSecurityAccount(socialSecurityAccount); detailPerson.setSocialSecurityAccount(socialSecurityAccount);
detailPerson.setPayMonth(payMonth); detailPerson.setPayMonth(payMonth);
if (Common.isNotNull(createMonth)) { if (Common.isNotNull(createMonth)) {
...@@ -1046,213 +1092,10 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -1046,213 +1092,10 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
voList.add(detailPerson); voList.add(detailPerson);
} }
} }
} else{
voList.add(detailPerson);
}
}
}
}
}
}
}
}
if (sheetAt97 != null && Common.isNotNull(sheetAt97.getSheetName())) {
for (int rowNum = 0; rowNum <= sheetAt97.getLastRowNum(); rowNum++) {
row97 = sheetAt97.getRow(rowNum);
if (row97 != null) {
// 初始化
empName = null;
certNum = null;
paymentBase = null;
payLimit = null;
insuranceType = null;
socialSecurityAccount = null;
payMonth = null;
createMonth = null;
unitLimit = null;
unitLiXi = null;
unitZhiNaJin = null;
personLimit = null;
personLiXi = null;
personZhiNaJin = null;
allMoney = null;
shenFen = null;
money = null;
// 循环当前行的内容
if (rowNum == 0) {
for (int cellNum = 0; cellNum < row97.getLastCellNum(); cellNum++) {
cellValue = this.getCellValue(row97, cellNum);
if ("错误信息".equals(cellValue)) {
errorInfoNum = cellNum;
} else if ("姓名".equals(cellValue) || "人员姓名".equals(cellValue)) {
empNameNum = cellNum;
} else if ("证件号码".equals(cellValue) || "社会保障号码".equals(cellValue)) {
certNumNum = cellNum;
} else if ("缴费基数".equals(cellValue) || "个人缴费基数".equals(cellValue)) {
paymentBaseNum = cellNum;
} else if ("应缴费额".equals(cellValue)) {
payLimitNum = cellNum;
} else if ("缴费总金额".equals(cellValue)) {
allMoneyNum = cellNum;
} else if ("参保身份".equals(cellValue)) {
shenFenNum = cellNum;
}
// 2单位个人缴费信息查询 独有
else if ("单位缴费额".equals(cellValue) || "单位实缴金额".equals(cellValue)) {
unitLimitNum = cellNum;
} else if ("单位利息".equals(cellValue)) {
unitLiXiNum = cellNum;
} else if ("单位滞纳金".equals(cellValue)) {
unitZhiNaJinNum = cellNum;
} else if ("个人缴费额".equals(cellValue) || "个人实缴金额".equals(cellValue)) {
personLimitNum = cellNum;
} else if ("个人利息".equals(cellValue)) {
personLiXiNum = cellNum;
} else if ("个人滞纳金".equals(cellValue)) {
personZhiNaJinNum = cellNum;
}
else if ("险种".equals(cellValue) || "参保险种".equals(cellValue) || "险种类型".equals(cellValue)) {
insuranceTypeNum = cellNum;
} else if ("单位名称".equals(cellValue)) {
socialSecurityAccountNum = cellNum;
} else if ("费款所属期".equals(cellValue) || "缴费年月".equals(cellValue) || "起始费款所属期".equals(cellValue)) {
payMonthNum = cellNum;
} else if ("业务年月".equals(cellValue) || "对应费款所属期".equals(cellValue)) {
createMonthNum = cellNum;
}
}
} else {
if (Common.isEmpty(errorInfoNum) && Common.isEmpty(certNumNum)) {
return R.failed("未找到对应表头!");
} else {
if (Common.isNotNull(errorInfoNum)) {
errorInfo = getCellValue(row97, errorInfoNum);
return R.failed("数据错误:"+errorInfo);
} else {
// 参保身份类别为退休和缴费总金额为0,2者有其一则不合并
if (Common.isNotNull(allMoneyNum)) {
allMoney = getCellValue(row97, allMoneyNum);
if (Common.isNotNull(allMoney) && BigDecimal.ZERO.equals(new BigDecimal(allMoney))) {
continue;
}
}
if (Common.isNotNull(shenFenNum)) {
shenFen = getCellValue(row97, shenFenNum);
if (Common.isNotNull(shenFen)) {
if ("退休".equals(shenFen.trim())) {
continue;
}
} else {
break;
}
}
if (Common.isNotNull(empNameNum)) {
empName = getCellValue(row97, empNameNum);
}
if (Common.isNotNull(certNumNum)) {
certNum = getCellValue(row97, certNumNum);
}
if (Common.isNotNull(paymentBaseNum)) {
paymentBase = getCellValue(row97, paymentBaseNum);
}
if (Common.isNotNull(payLimitNum)) {
payLimit = getCellValue(row97, payLimitNum);
}
if (Common.isNotNull(unitLimitNum)) {
unitLimit = getCellValue(row97, unitLimitNum);
}
if (Common.isNotNull(unitLiXiNum)) {
unitLiXi = getCellValue(row97, unitLiXiNum);
}
if (Common.isNotNull(unitZhiNaJinNum)) {
unitZhiNaJin = getCellValue(row97, unitZhiNaJinNum);
}
if (Common.isNotNull(personLimitNum)) {
personLimit = getCellValue(row97, personLimitNum);
}
if (Common.isNotNull(personLiXiNum)) {
personLiXi = getCellValue(row97, personLiXiNum);
}
if (Common.isNotNull(personZhiNaJinNum)) {
personZhiNaJin = getCellValue(row97, personZhiNaJinNum);
}
if (Common.isNotNull(insuranceTypeNum)) {
insuranceType = getCellValue(row97, insuranceTypeNum);
}
if (Common.isNotNull(socialSecurityAccountNum)) {
socialSecurityAccount = getCellValue(row97, socialSecurityAccountNum);
}
if (Common.isNotNull(payMonthNum)) {
payMonth = getCellValue(row97, payMonthNum);
if (Common.isNotNull(payMonth)) {
payMonth = payMonth.replace("-","");
}
}
if (Common.isNotNull(createMonthNum)) {
createMonth = getCellValue(row97, createMonthNum);
}
detail = new TAutoPaymentDetail();
detail.setParentId(mainAuto.getId());
detail.setSourceType(sourceType);
detail.setEmpName(empName);
detail.setCertNum(certNum);
if (Common.isNotNull(paymentBase)) {
detail.setPaymentBase(new BigDecimal(paymentBase));
}
if (Common.isNotNull(payLimit)) {
detail.setPayLimit(new BigDecimal(payLimit));
}
if (Common.isNotNull(unitLimit)) {
money = new BigDecimal(unitLimit);
if (Common.isNotNull(unitLiXi)) {
money = BigDecimalUtils.safeAdd(money, new BigDecimal(unitLiXi));
}
if (Common.isNotNull(unitZhiNaJin)) {
money = BigDecimalUtils.safeAdd(money, new BigDecimal(unitZhiNaJin));
}
detail.setPayLimit(money);
}
detail.setInsuranceType(insuranceType);
if (Common.isNotNull(unitLimit)) {
detail.setInsuranceType("单位"+insuranceType);
}
detail.setSocialSecurityAccount(socialSecurityAccount);
detail.setPayMonth(payMonth);
if (Common.isNotNull(createMonth)) {
detail.setCreateMonth(createMonth);
} else { } else {
detail.setCreateMonth(nowMonth); voList.add(detailPerson);
}
voList.add(detail);
// 个人的拆为第二条
if (Common.isNotNull(personLimit)) {
money = new BigDecimal(personLimit);
if (Common.isNotNull(personLiXi)) {
money = BigDecimalUtils.safeAdd(money, new BigDecimal(personLiXi));
}
if (Common.isNotNull(personZhiNaJin)) {
money = BigDecimalUtils.safeAdd(money, new BigDecimal(personZhiNaJin));
}
detailPerson = new TAutoPaymentDetail();
detailPerson.setParentId(mainAuto.getId());
detailPerson.setSourceType(sourceType);
detailPerson.setPayLimit(money);
detailPerson.setEmpName(empName);
detailPerson.setCertNum(certNum);
if (Common.isNotNull(paymentBase)) {
detailPerson.setPaymentBase(new BigDecimal(paymentBase));
} }
detailPerson.setInsuranceType("个人"+insuranceType);
detailPerson.setSocialSecurityAccount(socialSecurityAccount);
detailPerson.setPayMonth(payMonth);
if (Common.isNotNull(createMonth)) {
detailPerson.setCreateMonth(createMonth);
} else {
detailPerson.setCreateMonth(nowMonth);
} }
voList.add(detailPerson);
} }
} }
} }
...@@ -1262,27 +1105,20 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -1262,27 +1105,20 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
} }
} }
} }
zin.closeEntry();
inputStream.close();
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
if (sheets != null) {
try {
sheets.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
} finally { } finally {
try { try {
if (sheets != null) { //解析完成删除本次解析中生成的文件 删除此目录下的所有文件
sheets.close(); deleteFolder(dec);
if (workbook != null) {
workbook.close();
} }
if (zin != null) { if (is != null) {
zin.close(); is.close();
} }
if (bs != null) { if (zipFile != null) {
bs.close(); zipFile.close();
} }
if (inputStream != null) { if (inputStream != null) {
inputStream.close(); inputStream.close();
...@@ -1294,6 +1130,18 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -1294,6 +1130,18 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
return R.ok(voList); return R.ok(voList);
} }
private BigDecimal getBigDecimal(String paymentBase) {
if (paymentBase.contains(",")) {
paymentBase = paymentBase.replace(",", "");
}
try {
return new BigDecimal(paymentBase);
} catch (Exception e) {
log.error("社保士兵的文件里有错误的数字,需要调整代码:" + paymentBase);
return new BigDecimal("-1");
}
}
/** /**
* @Description: 解码URL * @Description: 解码URL
* @Author: hgw * @Author: hgw
...@@ -1791,6 +1639,27 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper, ...@@ -1791,6 +1639,27 @@ public class TSocialSoldierServiceImpl extends ServiceImpl<TSocialSoldierMapper,
return cellValue; return cellValue;
} }
private String getCellValue(Row row, int cellNum) {
Cell cell = row.getCell(cellNum);
String cellValue = "";
try {
if (cell != null) {
if (CellType.STRING == cell.getCellType()) {
cellValue = row.getCell(cellNum).getStringCellValue();
} else if (CellType.NUMERIC == cell.getCellType()) {
cellValue = String.valueOf(row.getCell(cellNum).getNumericCellValue());
if (cellValue.contains("E")) {
cellValue = String.valueOf(new DecimalFormat("#").format(row.getCell(cellNum).getNumericCellValue()));
}
}
}
} catch (NumberFormatException e) {
cell.setCellType(CellType.STRING);
cellValue = String.valueOf(row.getCell(cellNum).getStringCellValue());
}
return cellValue;
}
private String getCellValue(XSSFRow row, int cellNum) { private String getCellValue(XSSFRow row, int cellNum) {
XSSFCell cell = row.getCell(cellNum); XSSFCell cell = row.getCell(cellNum);
String cellValue = ""; String cellValue = "";
......
...@@ -150,7 +150,7 @@ ...@@ -150,7 +150,7 @@
</select> </select>
<delete id="deleteByParentId"> <delete id="deleteByParentId">
delete from t_auto_payment_detail where PARENT_ID = #{parentId} delete from t_auto_payment_detail where PARENT_ID = #{parentId} and SOURCE_TYPE = #{sourceType}
</delete> </delete>
......
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