refactor(deleteU8cData): 重构删除 U8C 数据逻辑
- 新增 V2 版本的方法,优化数据删除性能- 实现销售订单、销售出库单、销售发票等数据的批量删除 - 优化数据分组逻辑,按日期和公司汇总数据 - 增加日志记录,提高代码可维护性
This commit is contained in:
parent
2436f000e9
commit
674d424e7f
|
@ -40,24 +40,28 @@ public class DeleteU8cDataUtilTest {
|
|||
//销售出库单取消签字:TOC冲发出商品
|
||||
// deleteU8cDataUtil.cancelSignatureIcGeneralH();
|
||||
|
||||
//弃审应收单 *
|
||||
deleteU8cDataUtil.abandoningReviewAccReceDoc();
|
||||
//弃审应收单 * 完成
|
||||
// deleteU8cDataUtil.abandoningReviewAccReceDoc();
|
||||
//删除应收单
|
||||
// deleteU8cDataUtil.deleteReviewAccReceDoc();
|
||||
|
||||
//弃审销售发票 *
|
||||
deleteU8cDataUtil.abandonmentReviewSoSaleinvoice();
|
||||
// deleteU8cDataUtil.abandonmentReviewSoSaleinvoice();
|
||||
deleteU8cDataUtil.abandonmentReviewSoSaleinvoiceV2();
|
||||
//删除销售发票 *
|
||||
deleteU8cDataUtil.deleteSoSaleinvoice();
|
||||
// deleteU8cDataUtil.deleteSoSaleinvoice();
|
||||
deleteU8cDataUtil.deleteSoSaleinvoiceV2();
|
||||
|
||||
//取消签字销售出库单 * TOC确认收入 注意⚠️
|
||||
deleteU8cDataUtil.cancelSignatureIcGeneralH("0001A110000000001TH6");
|
||||
// deleteU8cDataUtil.cancelSignatureIcGeneralH("0001A110000000001TH6");
|
||||
deleteU8cDataUtil.cancelSignatureIcGeneralHV2("0001A110000000001TH6");
|
||||
//删除销售出库单 *
|
||||
deleteU8cDataUtil.deleteIcGeneralH();
|
||||
// deleteU8cDataUtil.deleteIcGeneralH();
|
||||
deleteU8cDataUtil.deleteIcGeneralHV2();
|
||||
|
||||
//取消签字销售订单 *
|
||||
deleteU8cDataUtil.cancelSignatureSoSale();
|
||||
|
||||
// deleteU8cDataUtil.cancelSignatureSoSale();
|
||||
deleteU8cDataUtil.cancelSignatureSoSaleV2();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ public class DeleteU8cDataUtilTest2 {
|
|||
|
||||
//2025年2月10日 20:20:39
|
||||
//销售出库单取消签字
|
||||
deleteU8cDataUtil.cancelSignatureIcGeneralH("0001A110000000001TH5");
|
||||
// deleteU8cDataUtil.cancelSignatureIcGeneralH("0001A110000000001TH5");
|
||||
|
||||
//弃审应收单
|
||||
// deleteU8cDataUtil.abandoningReviewAccReceDoc();
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
package com.hzya.frame.plugin.lets.util;
|
||||
|
||||
import com.hzya.frame.WebappApplication;
|
||||
import com.hzya.frame.deletedata.DeleteU8cDataUtil;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
/**
|
||||
* @Author:liuyang
|
||||
* @Package:com.hzya.frame.plugin.lets.util
|
||||
* @Project:kangarooDataCenterV3
|
||||
* @name:DeleteU8cDataUtilTest
|
||||
* @Date:2024/12/18 18:36
|
||||
* @Filename:DeleteU8cDataUtilTest
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(classes = WebappApplication.class)
|
||||
public class DeleteU8cDataUtilTest3 {
|
||||
|
||||
@Autowired
|
||||
private DeleteU8cDataUtil deleteU8cDataUtil;
|
||||
|
||||
@Test
|
||||
public void deleteSoSaleinvoice() {
|
||||
try {
|
||||
//弃审销售发票 * 已测试
|
||||
deleteU8cDataUtil.abandonmentReviewSoSaleinvoiceV2();
|
||||
//删除销售发票 * 已测试
|
||||
deleteU8cDataUtil.deleteSoSaleinvoiceV2();
|
||||
|
||||
//取消签字销售出库单 * TOC确认收入 注意⚠️ 待测试
|
||||
// deleteU8cDataUtil.cancelSignatureIcGeneralHV2("0001A110000000001TH6");
|
||||
//删除销售出库单 * 待测试
|
||||
// deleteU8cDataUtil.deleteIcGeneralHV2();
|
||||
|
||||
//取消签字销售订单 * 待测试
|
||||
// deleteU8cDataUtil.cancelSignatureSoSaleV2();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -12,6 +12,8 @@ import com.hzya.frame.deletedata.entity.DeleteU8cDataUtilEntity;
|
|||
//import com.hzya.frame.plugin.lets.entity.SoSaleinvoiceEntity;
|
||||
//import com.hzya.frame.plugin.lets.u8cdto.ReusltStrDto;
|
||||
import com.hzya.frame.deletedata.vo.*;
|
||||
import com.hzya.frame.split.SplitListByCountUtil;
|
||||
import com.hzya.frame.ttxofs.dto.ofssaleorderoutsearch.HeaderDetailsDto;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
//import org.junit.jupiter.api.Test;
|
||||
|
@ -20,6 +22,9 @@ import org.springframework.stereotype.Component;
|
|||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author:liuyang
|
||||
|
@ -39,6 +44,8 @@ public class DeleteU8cDataUtil {
|
|||
|
||||
private static final Object LOCK_OBJECT = new Object();
|
||||
|
||||
private static final Integer SPLIT_VAR = 3000;
|
||||
|
||||
public void deleteTargetU8cData() {
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
@Override
|
||||
|
@ -94,6 +101,66 @@ public class DeleteU8cDataUtil {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 销售订单取消签字
|
||||
*/
|
||||
public void cancelSignatureSoSaleV2() {
|
||||
try {
|
||||
DeleteSoSaleVo deleteSoSaleVo = new DeleteSoSaleVo();
|
||||
deleteSoSaleVo.setDataSourceCode("lets_u8c");
|
||||
deleteSoSaleVo.setFstatus(2L);
|
||||
List<DeleteU8cDataUtilEntity> soSaleinvoiceEntities = deleteU8cDataUtilDao.querySoSaleByDelete(deleteSoSaleVo);
|
||||
logger.info("条数:{}", soSaleinvoiceEntities.size());
|
||||
if (soSaleinvoiceEntities != null && soSaleinvoiceEntities.size() > 0) {
|
||||
List<List<DeleteU8cDataUtilEntity>> splitListByCount = SplitListByCountUtil.splitListByCount(soSaleinvoiceEntities, SPLIT_VAR);
|
||||
|
||||
for (int i = 0; i < splitListByCount.size(); i++) {
|
||||
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities = splitListByCount.get(i);
|
||||
Map<String, List<DeleteU8cDataUtilEntity>> stringListMap = groupByDbilldate(deleteU8cDataUtilEntities);
|
||||
for (Map.Entry<String, List<DeleteU8cDataUtilEntity>> entry : stringListMap.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
List<DeleteU8cDataUtilEntity> valueList = entry.getValue();
|
||||
List<String> vreceiptcodeList = valueList.stream().map(DeleteU8cDataUtilEntity::getVreceiptcode).collect(Collectors.toList());
|
||||
|
||||
String[] split = key.split("@@@@");
|
||||
|
||||
// List<String> stringList = new ArrayList<>();
|
||||
// stringList.add(deleteU8cDataUtilEntity.getVreceiptcode());
|
||||
// JsonRootBeanCancelSignature jsonRootBeanCancelSignature = new JsonRootBeanCancelSignature();
|
||||
// QueryinfoCancelSignature queryinfoCancelSignature = new QueryinfoCancelSignature();
|
||||
// queryinfoCancelSignature.setDate_begin(deleteU8cDataUtilEntity.getDbilldate());
|
||||
// queryinfoCancelSignature.setDate_end(deleteU8cDataUtilEntity.getDbilldate());
|
||||
// queryinfoCancelSignature.setCorp(deleteU8cDataUtilEntity.getUnitcode());
|
||||
// queryinfoCancelSignature.setCode(stringList);
|
||||
// ApproveinfoCancelSignature approveinfoCancelSignature = new ApproveinfoCancelSignature();
|
||||
// approveinfoCancelSignature.setApprovid("tbadmin");
|
||||
// jsonRootBeanCancelSignature.setApproveinfo(approveinfoCancelSignature);
|
||||
// jsonRootBeanCancelSignature.setQueryinfo(queryinfoCancelSignature);
|
||||
|
||||
|
||||
Map<String, Object> stringObjectMap = new HashMap<>();
|
||||
stringObjectMap.put("approvid", "tbadmin");
|
||||
|
||||
Map<String, Object> stringObjectMap2 = new HashMap<>();
|
||||
stringObjectMap2.put("date_begin", split[0]);
|
||||
stringObjectMap2.put("date_end", split[0]);
|
||||
stringObjectMap2.put("corp", split[1]);
|
||||
stringObjectMap2.put("code", vreceiptcodeList);
|
||||
|
||||
Map<String, Object> stringObjectMap3 = new HashMap<>();
|
||||
stringObjectMap3.put("approveinfo", stringObjectMap);
|
||||
stringObjectMap3.put("queryinfo", stringObjectMap2);
|
||||
|
||||
sendU8C("http://39.170.109.90:8088/u8cloud/api/so/saleorder/unapprove", JSON.toJSONString(stringObjectMap3));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除销售订单
|
||||
*/
|
||||
|
@ -161,6 +228,60 @@ public class DeleteU8cDataUtil {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除销售出库单
|
||||
*/
|
||||
public void deleteIcGeneralHV2() {
|
||||
try {
|
||||
DeleteIcGeneralHVo deleteIcGeneralHVo = new DeleteIcGeneralHVo();
|
||||
deleteIcGeneralHVo.setDataSourceCode("lets_u8c");
|
||||
List<DeleteU8cDataUtilEntity> soSaleinvoiceEntities = deleteU8cDataUtilDao.queryIcGeneralHByDelete(deleteIcGeneralHVo);
|
||||
logger.info("条数:{}", soSaleinvoiceEntities.size());
|
||||
if (soSaleinvoiceEntities != null && soSaleinvoiceEntities.size() > 0) {
|
||||
List<List<DeleteU8cDataUtilEntity>> splitListByCount = SplitListByCountUtil.splitListByCount(soSaleinvoiceEntities, SPLIT_VAR);
|
||||
|
||||
for (int i = 0; i < splitListByCount.size(); i++) {
|
||||
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities = splitListByCount.get(i);
|
||||
Map<String, List<DeleteU8cDataUtilEntity>> stringListMap = groupByDbilldate(deleteU8cDataUtilEntities);
|
||||
for (Map.Entry<String, List<DeleteU8cDataUtilEntity>> entry : stringListMap.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
List<DeleteU8cDataUtilEntity> valueList = entry.getValue();
|
||||
List<String> vreceiptcodeList = valueList.stream().map(DeleteU8cDataUtilEntity::getVreceiptcode).collect(Collectors.toList());
|
||||
|
||||
String[] split = key.split("@@@@");
|
||||
|
||||
// Deleteinfo deleteinfo = new Deleteinfo();
|
||||
// deleteinfo.setCoperator("tbadmin");
|
||||
// Queryinfo queryinfo = new Queryinfo();
|
||||
// queryinfo.setCorp(deleteU8cDataUtilEntity.getUnitcode());
|
||||
// queryinfo.setDate_begin(deleteU8cDataUtilEntity.getDbilldate());
|
||||
// queryinfo.setDate_end(deleteU8cDataUtilEntity.getDbilldate());
|
||||
// queryinfo.setBillcode(deleteU8cDataUtilEntity.getVbillcode());
|
||||
// JsonRootBean jsonRootBean = new JsonRootBean();
|
||||
// jsonRootBean.setDeleteInfo(deleteinfo);
|
||||
// jsonRootBean.setQueryInfo(queryinfo);
|
||||
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
objectMap.put("coperator", "tbadmin");
|
||||
|
||||
Map<String, Object> objectMap2 = new HashMap<>();
|
||||
objectMap2.put("corp", split[1]);
|
||||
objectMap2.put("date_begin", split[0]);
|
||||
objectMap2.put("date_end", split[0]);
|
||||
objectMap2.put("billcode", vreceiptcodeList);
|
||||
|
||||
Map<String, Object> objectMap3 = new HashMap<>();
|
||||
objectMap3.put("deleteInfo", objectMap);
|
||||
objectMap3.put("queryInfo", objectMap2);
|
||||
sendU8C("http://39.170.109.90:8088/u8cloud/api/ic/saleout/delete", JSON.toJSONString(objectMap3));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 销售出库单取消签字
|
||||
*/
|
||||
|
@ -195,6 +316,63 @@ public class DeleteU8cDataUtil {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 销售出库单取消签字 V2
|
||||
*/
|
||||
public void cancelSignatureIcGeneralHV2(String cbiztype) {
|
||||
try {
|
||||
DeleteIcGeneralHVo deleteIcGeneralHVo = new DeleteIcGeneralHVo();
|
||||
deleteIcGeneralHVo.setDataSourceCode("lets_u8c");
|
||||
deleteIcGeneralHVo.setCbiztype(cbiztype);
|
||||
List<DeleteU8cDataUtilEntity> soSaleinvoiceEntities = deleteU8cDataUtilDao.queryIcGeneralHByCancelSignature(deleteIcGeneralHVo);
|
||||
logger.info("条数:{}", soSaleinvoiceEntities.size());
|
||||
if (soSaleinvoiceEntities != null && soSaleinvoiceEntities.size() > 0) {
|
||||
List<List<DeleteU8cDataUtilEntity>> splitListByCount = SplitListByCountUtil.splitListByCount(soSaleinvoiceEntities, SPLIT_VAR);
|
||||
|
||||
for (int i = 0; i < splitListByCount.size(); i++) {
|
||||
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities = splitListByCount.get(i);
|
||||
Map<String, List<DeleteU8cDataUtilEntity>> stringListMap = groupByDbilldate(deleteU8cDataUtilEntities);
|
||||
|
||||
for (Map.Entry<String, List<DeleteU8cDataUtilEntity>> entry : stringListMap.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
List<DeleteU8cDataUtilEntity> valueList = entry.getValue();
|
||||
List<String> vreceiptcodeList = valueList.stream().map(DeleteU8cDataUtilEntity::getVreceiptcode).collect(Collectors.toList());
|
||||
|
||||
String[] split = key.split("@@@@");
|
||||
|
||||
// Deleteinfo deleteinfo = new Deleteinfo();
|
||||
// deleteinfo.setCoperator("tbadmin");
|
||||
// Queryinfo queryinfo = new Queryinfo();
|
||||
// queryinfo.setCorp(deleteU8cDataUtilEntity.getUnitcode());
|
||||
// queryinfo.setDate_begin(deleteU8cDataUtilEntity.getDbilldate());
|
||||
// queryinfo.setDate_end(deleteU8cDataUtilEntity.getDbilldate());
|
||||
// queryinfo.setBillcode(deleteU8cDataUtilEntity.getVbillcode());
|
||||
// JsonRootBean jsonRootBean = new JsonRootBean();
|
||||
// jsonRootBean.setUnsignInfo(deleteinfo);
|
||||
// jsonRootBean.setQueryInfo(queryinfo);
|
||||
|
||||
Map<String, Object> objectMap1 = new HashMap<>();
|
||||
objectMap1.put("coperator", "tbadmin");
|
||||
|
||||
Map<String, Object> objectMap2 = new HashMap<>();
|
||||
objectMap2.put("corp", split[1]);
|
||||
objectMap2.put("date_begin", split[0]);
|
||||
objectMap2.put("date_end", split[0]);
|
||||
objectMap2.put("billcode", vreceiptcodeList);
|
||||
|
||||
Map<String, Object> objectMap3 = new HashMap<>();
|
||||
objectMap3.put("unsignInfo", objectMap1);
|
||||
objectMap3.put("queryInfo", objectMap2);
|
||||
|
||||
sendU8C("http://39.170.109.90:8088/u8cloud/api/ic/saleout/unsign", JSON.toJSONString(objectMap3));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除销售发票
|
||||
*/
|
||||
|
@ -228,6 +406,62 @@ public class DeleteU8cDataUtil {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除销售发票V2,速度提升版
|
||||
*/
|
||||
public void deleteSoSaleinvoiceV2() {
|
||||
try {
|
||||
DeleteU8cDataUtilEntity soSaleinvoiceEntity = new DeleteU8cDataUtilEntity();
|
||||
soSaleinvoiceEntity.setDataSourceCode("lets_u8c");
|
||||
List<DeleteU8cDataUtilEntity> soSaleinvoiceEntities = deleteU8cDataUtilDao.querySoSaleinvoiceByDelete(soSaleinvoiceEntity);
|
||||
logger.info("条数:{}", soSaleinvoiceEntities.size());
|
||||
if (soSaleinvoiceEntities != null && soSaleinvoiceEntities.size() > 0) {
|
||||
List<List<DeleteU8cDataUtilEntity>> splitListByCount = SplitListByCountUtil.splitListByCount(soSaleinvoiceEntities, SPLIT_VAR);
|
||||
for (int i = 0; i < splitListByCount.size(); i++) {
|
||||
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities = splitListByCount.get(i);
|
||||
Map<String, List<DeleteU8cDataUtilEntity>> stringListMap = groupByDbilldate(deleteU8cDataUtilEntities);
|
||||
for (Map.Entry<String, List<DeleteU8cDataUtilEntity>> entry : stringListMap.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
List<DeleteU8cDataUtilEntity> valueList = entry.getValue();
|
||||
List<String> vreceiptcodeList = valueList.stream().map(DeleteU8cDataUtilEntity::getVreceiptcode).collect(Collectors.toList());
|
||||
|
||||
String[] split = key.split("@@@@");
|
||||
|
||||
// Deleteinfo deleteinfo = new Deleteinfo();
|
||||
// deleteinfo.setCoperator("tbadmin");
|
||||
|
||||
// Queryinfo queryinfo = new Queryinfo();
|
||||
// queryinfo.setCorp(split[1]);
|
||||
// queryinfo.setDate_begin(split[0]);
|
||||
// queryinfo.setDate_end(split[0]);
|
||||
// queryinfo.setCode(vreceiptcodeList);
|
||||
|
||||
// JsonRootBean jsonRootBean = new JsonRootBean();
|
||||
// jsonRootBean.setDeleteinfo(deleteinfo);
|
||||
// jsonRootBean.setQueryinfo(queryinfo);
|
||||
|
||||
Map<String, Object> objectMap = new HashMap<>();
|
||||
objectMap.put("coperator", "tbadmin");
|
||||
|
||||
Map<String, Object> objectMap2 = new HashMap<>();
|
||||
objectMap2.put("corp", split[1]);
|
||||
objectMap2.put("date_begin", split[0]);
|
||||
objectMap2.put("date_end", split[0]);
|
||||
objectMap2.put("code", vreceiptcodeList);
|
||||
|
||||
Map<String, Object> objectMap3 = new HashMap<>();
|
||||
objectMap3.put("deleteinfo", objectMap);
|
||||
objectMap3.put("queryinfo", objectMap2);
|
||||
|
||||
sendU8C("http://39.170.109.90:8088/u8cloud/api/so/saleinvoice/delete", JSON.toJSONString(objectMap3));
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 2024年8月8日 10:54:48
|
||||
* 推送U8C销售订单方法
|
||||
|
@ -235,10 +469,13 @@ public class DeleteU8cDataUtil {
|
|||
* @author liuyang
|
||||
*/
|
||||
public void sendU8C(String url, String param) throws Exception {
|
||||
logger.info("入参:" + param);
|
||||
long l = System.currentTimeMillis();
|
||||
String result = HttpRequest.post(url).header("usercode", "admin1").header("password", "f7fcde654e968541cc803c4b08c30abb").header("system", "lz1").header("trantype", "code").body(param)//表单内容
|
||||
.timeout(600000)//超时,毫秒
|
||||
.timeout(900000000)//超时,毫秒
|
||||
.execute().body();
|
||||
logger.info(result);
|
||||
long l1 = System.currentTimeMillis();
|
||||
logger.info("\n回参:" + result + " \n执行耗时:" + (l1 - l));
|
||||
// JSONObject jsonObject = JSON.parseObject(result);
|
||||
// result = String.valueOf(jsonObject.get("attribute"));
|
||||
// System.out.println(result);
|
||||
|
@ -328,23 +565,122 @@ public class DeleteU8cDataUtil {
|
|||
for (int i = 0; i < soSaleinvoiceEntities.size(); i++) {
|
||||
DeleteU8cDataUtilEntity deleteU8cDataUtilEntity = soSaleinvoiceEntities.get(i);
|
||||
|
||||
Map<String, String> stringStringMap = new HashMap<>();
|
||||
stringStringMap.put("approvid", "tbadmin");
|
||||
try {
|
||||
Map<String, String> stringStringMap = new HashMap<>();
|
||||
stringStringMap.put("approvid", "tbadmin");
|
||||
|
||||
Map<String, String> stringStringMap2 = new HashMap<>();
|
||||
stringStringMap2.put("corp", deleteU8cDataUtilEntity.getUnitcode());
|
||||
stringStringMap2.put("code", deleteU8cDataUtilEntity.getVreceiptcode());
|
||||
stringStringMap2.put("date_begin", deleteU8cDataUtilEntity.getDbilldate());
|
||||
stringStringMap2.put("date_end", deleteU8cDataUtilEntity.getDbilldate());
|
||||
Map<String, String> stringStringMap2 = new HashMap<>();
|
||||
stringStringMap2.put("corp", deleteU8cDataUtilEntity.getUnitcode());
|
||||
stringStringMap2.put("code", deleteU8cDataUtilEntity.getVreceiptcode());
|
||||
stringStringMap2.put("date_begin", deleteU8cDataUtilEntity.getDbilldate());
|
||||
stringStringMap2.put("date_end", deleteU8cDataUtilEntity.getDbilldate());
|
||||
|
||||
Map<String, Map<String, String>> stringStringMap3 = new HashMap<>();
|
||||
stringStringMap3.put("approveinfo", stringStringMap);
|
||||
stringStringMap3.put("queryinfo", stringStringMap2);
|
||||
sendU8C("http://39.170.109.90:8088/u8cloud/api/so/saleinvoice/unapprove", JSON.toJSONString(stringStringMap3));
|
||||
Map<String, Map<String, String>> stringStringMap3 = new HashMap<>();
|
||||
stringStringMap3.put("approveinfo", stringStringMap);
|
||||
stringStringMap3.put("queryinfo", stringStringMap2);
|
||||
sendU8C("http://39.170.109.90:8088/u8cloud/api/so/saleinvoice/unapprove", JSON.toJSONString(stringStringMap3));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
// 关闭线程池
|
||||
// executor.shutdown();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 2025年2月11日 14:54:30
|
||||
* 弃审销售发票,速度提升版
|
||||
* 弃审367需要515秒,每条1.4秒,单条弃审大概需要1.8秒
|
||||
* 286 -> 397 1.3秒
|
||||
* 速度有一定的提升
|
||||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
public void abandonmentReviewSoSaleinvoiceV2() {
|
||||
try {
|
||||
DeleteU8cDataUtilEntity soSaleinvoiceEntity = new DeleteU8cDataUtilEntity();
|
||||
soSaleinvoiceEntity.setDataSourceCode("lets_u8c");
|
||||
List<DeleteU8cDataUtilEntity> soSaleinvoiceEntities = deleteU8cDataUtilDao.querySoSaleinvoiceByCancelApproval(soSaleinvoiceEntity);
|
||||
logger.info("条数:{}", soSaleinvoiceEntities.size());
|
||||
if (soSaleinvoiceEntities != null && soSaleinvoiceEntities.size() > 0) {
|
||||
List<List<DeleteU8cDataUtilEntity>> splitListByCount = SplitListByCountUtil.splitListByCount(soSaleinvoiceEntities, SPLIT_VAR);
|
||||
|
||||
for (int i = 0; i < splitListByCount.size(); i++) {
|
||||
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities = splitListByCount.get(i);
|
||||
Map<String, List<DeleteU8cDataUtilEntity>> stringListMap = groupByDbilldate(deleteU8cDataUtilEntities);
|
||||
try {
|
||||
for (Map.Entry<String, List<DeleteU8cDataUtilEntity>> entry : stringListMap.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
List<DeleteU8cDataUtilEntity> valueList = entry.getValue();
|
||||
List<String> vreceiptcodeList = valueList.stream().map(DeleteU8cDataUtilEntity::getVreceiptcode).collect(Collectors.toList());
|
||||
|
||||
String[] split = key.split("@@@@");
|
||||
|
||||
Map<String, Object> stringStringMap = new HashMap<>();
|
||||
stringStringMap.put("approvid", "tbadmin");
|
||||
|
||||
Map<String, Object> stringStringMap2 = new HashMap<>();
|
||||
stringStringMap2.put("corp", split[1]);
|
||||
stringStringMap2.put("code", vreceiptcodeList);
|
||||
stringStringMap2.put("date_begin", split[0]);
|
||||
stringStringMap2.put("date_end", split[0]);
|
||||
|
||||
Map<String, Map<String, Object>> stringStringMap3 = new HashMap<>();
|
||||
stringStringMap3.put("approveinfo", stringStringMap);
|
||||
stringStringMap3.put("queryinfo", stringStringMap2);
|
||||
sendU8C("http://39.170.109.90:8088/u8cloud/api/so/saleinvoice/unapprove", JSON.toJSONString(stringStringMap3));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
// 关闭线程池
|
||||
// executor.shutdown();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 把相同单据日期+公司的发票汇总在一起
|
||||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
public static Map<String, List<DeleteU8cDataUtilEntity>> groupByDbilldate(List<DeleteU8cDataUtilEntity> entities) {
|
||||
Map<String, List<DeleteU8cDataUtilEntity>> resultMap = new HashMap<>();
|
||||
for (DeleteU8cDataUtilEntity entity : entities) {
|
||||
String dbilldate = entity.getDbilldate();
|
||||
String unitcode = entity.getUnitcode();
|
||||
// 如果 map 中不包含该日期,则创建一个新的列表
|
||||
resultMap.computeIfAbsent(dbilldate + "@@@@" + unitcode, k -> new ArrayList<>()).add(entity);
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 把相同单据日期+公司的发票汇总在一起
|
||||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
// public static Map<String, List<DeleteU8cDataUtilEntity>> groupByDbilldateV2(List<DeleteU8cDataUtilEntity> entities) {
|
||||
// Map<String, List<DeleteU8cDataUtilEntity>> resultMap = new HashMap<>();
|
||||
// for (DeleteU8cDataUtilEntity entity : entities) {
|
||||
// String dbilldate = entity.getDbilldate();
|
||||
// String unitcode = entity.getUnitcode();
|
||||
// // 如果 map 中不包含该日期,则创建一个新的列表
|
||||
// resultMap.computeIfAbsent(dbilldate + "@@@@" + unitcode, k -> new ArrayList<>()).add(entity);
|
||||
// }
|
||||
// return resultMap;
|
||||
// }
|
||||
|
||||
// 定义最大线程数
|
||||
// private static final int MAX_THREADS = 100;
|
||||
|
||||
// 创建一个固定大小的线程池
|
||||
// ExecutorService executor = Executors.newFixedThreadPool(MAX_THREADS);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue