actor(deleteref-data): 重构销售订单数据修复和审核流程
- 新增 cancelSignatureSoSaleReadExcel20250528V3 方法,用于查询已修复的销售订单 - 优化数据处理流程,使用多线程提高效率 - 修复销售订单部门字段错误问题 - 优化销售订单审核逻辑,确保只审核已修复的订单 - 调整数据分批处理的数量,提高处理效率
This commit is contained in:
parent
e7a43b9833
commit
1a093c1577
|
@ -30,6 +30,7 @@ import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.CountDownLatch;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -60,39 +61,65 @@ public class DeleteU8cDataUtil {
|
||||||
|
|
||||||
private static Integer MARK2 = 0;
|
private static Integer MARK2 = 0;
|
||||||
|
|
||||||
|
CountDownLatch latch = new CountDownLatch(2);
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void init() {
|
public void init() {
|
||||||
deleteTargetU8cData();
|
deleteTargetU8cData();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteTargetU8cData() {
|
public void deleteTargetU8cData() {
|
||||||
Thread thread = new Thread(new Runnable() {
|
Thread thread000 = new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
synchronized (LOCK_OBJECT) {
|
Thread thread = new Thread(new Runnable() {
|
||||||
if (MARK == 0) {
|
@Override
|
||||||
MARK = 1;
|
public void run() {
|
||||||
//删除销售出库单
|
synchronized (LOCK_OBJECT) {
|
||||||
cancelSignatureSoSaleReadExcel20250528V2();
|
if (MARK == 0) {
|
||||||
|
MARK = 1;
|
||||||
|
//删除销售出库单
|
||||||
|
// cancelSignatureSoSaleReadExcel20250528V2();
|
||||||
|
//反审核销售订单
|
||||||
|
cancelSignatureSoSaleReadExcel2505282140V2();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
latch.countDown();
|
||||||
}
|
}
|
||||||
}
|
}, "反审核销售订单 2025-05-30");
|
||||||
}
|
thread.start();
|
||||||
}, "删除销售出库单 2025-05-29");
|
|
||||||
thread.start();
|
|
||||||
|
|
||||||
Thread thread2 = new Thread(new Runnable() {
|
Thread thread2 = new Thread(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
synchronized (LOCK_OBJECT2) {
|
synchronized (LOCK_OBJECT2) {
|
||||||
if (MARK2 == 0) {
|
if (MARK2 == 0) {
|
||||||
MARK2 = 1;
|
MARK2 = 1;
|
||||||
//删除销售发票
|
//删除销售发票
|
||||||
abandonmentReviewSoSaleinvoice2505282107();
|
abandonmentReviewSoSaleinvoice2505282107();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
latch.countDown();
|
||||||
}
|
}
|
||||||
|
}, "删除销售发票 2025-05-30");
|
||||||
|
thread2.start();
|
||||||
|
|
||||||
|
try {
|
||||||
|
//等待两个线程都完成
|
||||||
|
latch.await();
|
||||||
|
//在两个线程都完成后执行反审核销售订单方法
|
||||||
|
// cancelSignatureSoSaleReadExcel2505282140V2();
|
||||||
|
//修复销售订单部门字段错误问题
|
||||||
|
repairSoSaleDepartment();
|
||||||
|
//销售订单审核
|
||||||
|
salesOrderReviewV2();
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
|
throw new RuntimeException("等待线程完成时中断", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, "删除销售发票 2025-05-29");
|
}, "U8C单据逻辑处理");
|
||||||
thread2.start();
|
thread000.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -545,6 +572,8 @@ public class DeleteU8cDataUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Object lockObject = new Object();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 2024年8月8日 10:54:48
|
* 2024年8月8日 10:54:48
|
||||||
* 推送U8C销售订单方法
|
* 推送U8C销售订单方法
|
||||||
|
@ -552,17 +581,19 @@ public class DeleteU8cDataUtil {
|
||||||
* @author liuyang
|
* @author liuyang
|
||||||
*/
|
*/
|
||||||
public void sendU8C(String url, String param, Integer number) throws Exception {
|
public void sendU8C(String url, String param, Integer number) throws Exception {
|
||||||
logger.info("入参:" + param);
|
synchronized (lockObject) {
|
||||||
long l = System.currentTimeMillis();
|
logger.info("入参:" + param);
|
||||||
String result = HttpRequest.post(url).header("usercode", "admin1").header("password", "f7fcde654e968541cc803c4b08c30abb").header("system", "lz1").header("trantype", "code").body(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(900000000)//超时,毫秒,超时时间调整为1个小时
|
// .timeout(900000000)//超时,毫秒,超时时间调整为1个小时
|
||||||
.timeout(3600000).execute().body();
|
.timeout(3600000).execute().body();
|
||||||
long l1 = System.currentTimeMillis();
|
long l1 = System.currentTimeMillis();
|
||||||
long timeConsuming = l1 - l;
|
long timeConsuming = l1 - l;
|
||||||
logger.info("\n回参:" + result + " \n执行耗时:" + timeConsuming + "\n条数:" + number + " 每单耗时:" + (timeConsuming / 1000 / number));
|
logger.info("\n回参:" + result + " \n执行耗时:" + timeConsuming + "\n条数:" + number + " 每单耗时:" + (timeConsuming / 1000 / number));
|
||||||
// JSONObject jsonObject = JSON.parseObject(result);
|
// JSONObject jsonObject = JSON.parseObject(result);
|
||||||
// result = String.valueOf(jsonObject.get("attribute"));
|
// result = String.valueOf(jsonObject.get("attribute"));
|
||||||
// System.out.println(result);
|
// System.out.println(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1116,7 +1147,7 @@ public class DeleteU8cDataUtil {
|
||||||
List<DeleteU8cDataUtilEntity> soSaleinvoiceEntities2 = deleteU8cDataUtilDao.queryIcGeneralHByCancelSignatureV2(deleteIcGeneralHVo2);
|
List<DeleteU8cDataUtilEntity> soSaleinvoiceEntities2 = deleteU8cDataUtilDao.queryIcGeneralHByCancelSignatureV2(deleteIcGeneralHVo2);
|
||||||
Map<String, List<DeleteU8cDataUtilEntity>> stringListMap2 = groupByDbilldatev2(soSaleinvoiceEntities2);
|
Map<String, List<DeleteU8cDataUtilEntity>> stringListMap2 = groupByDbilldatev2(soSaleinvoiceEntities2);
|
||||||
if (stringListMap2.size() > 0) {
|
if (stringListMap2.size() > 0) {
|
||||||
for (Map.Entry<String, List<DeleteU8cDataUtilEntity>> entry : stringListMap.entrySet()) {
|
for (Map.Entry<String, List<DeleteU8cDataUtilEntity>> entry : stringListMap2.entrySet()) {
|
||||||
String key = entry.getKey();
|
String key = entry.getKey();
|
||||||
List<DeleteU8cDataUtilEntity> valueList = entry.getValue();
|
List<DeleteU8cDataUtilEntity> valueList = entry.getValue();
|
||||||
List<String> vreceiptcodeList = valueList.stream().map(DeleteU8cDataUtilEntity::getVbillcode).collect(Collectors.toList());
|
List<String> vreceiptcodeList = valueList.stream().map(DeleteU8cDataUtilEntity::getVbillcode).collect(Collectors.toList());
|
||||||
|
@ -1170,7 +1201,7 @@ public class DeleteU8cDataUtil {
|
||||||
try {
|
try {
|
||||||
//确定销售订单范围、19648
|
//确定销售订单范围、19648
|
||||||
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities = deleteU8cDataUtilDao.cancelSignatureSoSaleReadExcel20250528V2();
|
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities = deleteU8cDataUtilDao.cancelSignatureSoSaleReadExcel20250528V2();
|
||||||
List<List<DeleteU8cDataUtilEntity>> lists = SplitListByCountUtil.splitListByCount(deleteU8cDataUtilEntities, 100);
|
List<List<DeleteU8cDataUtilEntity>> lists = SplitListByCountUtil.splitListByCount(deleteU8cDataUtilEntities, 500);
|
||||||
if (lists.size() > 0) {
|
if (lists.size() > 0) {
|
||||||
for (int i = 0; i < lists.size(); i++) {
|
for (int i = 0; i < lists.size(); i++) {
|
||||||
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities1 = lists.get(i);
|
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities1 = lists.get(i);
|
||||||
|
@ -1266,16 +1297,15 @@ public class DeleteU8cDataUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 销售订单取消签字+删除
|
* 销售订单取消签字
|
||||||
*/
|
*/
|
||||||
public void cancelSignatureSoSaleReadExcel2505282140V2() {
|
public void cancelSignatureSoSaleReadExcel2505282140V2() {
|
||||||
try {
|
try {
|
||||||
//确定销售订单范围、19648
|
//确定销售订单范围、19648
|
||||||
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities = deleteU8cDataUtilDao.cancelSignatureSoSaleReadExcel20250528V2();
|
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities = deleteU8cDataUtilDao.cancelSignatureSoSaleReadExcel20250528V2();
|
||||||
if (deleteU8cDataUtilEntities.size() > 0) {
|
if (deleteU8cDataUtilEntities.size() > 0) {
|
||||||
List<List<DeleteU8cDataUtilEntity>> lists = SplitListByCountUtil.splitListByCount(deleteU8cDataUtilEntities, 100);
|
List<List<DeleteU8cDataUtilEntity>> lists = SplitListByCountUtil.splitListByCount(deleteU8cDataUtilEntities, 500);
|
||||||
for (int i = 0; i < lists.size(); i++) {
|
for (int i = 0; i < lists.size(); i++) {
|
||||||
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities1 = lists.get(i);
|
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities1 = lists.get(i);
|
||||||
String concatenatedIds = deleteU8cDataUtilEntities1.stream().map(DeleteU8cDataUtilEntity::getCsaleid).map(csaleid -> "'" + csaleid + "'").collect(Collectors.joining(","));
|
String concatenatedIds = deleteU8cDataUtilEntities1.stream().map(DeleteU8cDataUtilEntity::getCsaleid).map(csaleid -> "'" + csaleid + "'").collect(Collectors.joining(","));
|
||||||
|
@ -1370,6 +1400,12 @@ public class DeleteU8cDataUtil {
|
||||||
deleteU8cDataUtilDao.updateCdeptid(updateSoSaleCdeptId);
|
deleteU8cDataUtilDao.updateCdeptid(updateSoSaleCdeptId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities2 = deleteU8cDataUtilDao.cancelSignatureSoSaleReadExcel20250528V2();
|
||||||
|
if (deleteU8cDataUtilEntities2 != null && deleteU8cDataUtilEntities2.size() > 0) {
|
||||||
|
//还存在部门字段错误的数据行,重新执行修复,确保目标数据被完全修复!
|
||||||
|
repairSoSaleDepartment();
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -1381,7 +1417,8 @@ public class DeleteU8cDataUtil {
|
||||||
public void salesOrderReviewV2() {
|
public void salesOrderReviewV2() {
|
||||||
try {
|
try {
|
||||||
//确定销售订单范围、19648
|
//确定销售订单范围、19648
|
||||||
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities = deleteU8cDataUtilDao.cancelSignatureSoSaleReadExcel20250528V2();
|
//注意⚠️这里只能审核已经修复完毕的销售订单!并且处理自由状态
|
||||||
|
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities = deleteU8cDataUtilDao.cancelSignatureSoSaleReadExcel20250528V3();
|
||||||
if (deleteU8cDataUtilEntities.size() > 0) {
|
if (deleteU8cDataUtilEntities.size() > 0) {
|
||||||
List<List<DeleteU8cDataUtilEntity>> lists = SplitListByCountUtil.splitListByCount(deleteU8cDataUtilEntities, 100);
|
List<List<DeleteU8cDataUtilEntity>> lists = SplitListByCountUtil.splitListByCount(deleteU8cDataUtilEntities, 100);
|
||||||
for (int i = 0; i < lists.size(); i++) {
|
for (int i = 0; i < lists.size(); i++) {
|
||||||
|
@ -1391,7 +1428,7 @@ public class DeleteU8cDataUtil {
|
||||||
DeleteSoSaleVo deleteSoSaleVo = new DeleteSoSaleVo();
|
DeleteSoSaleVo deleteSoSaleVo = new DeleteSoSaleVo();
|
||||||
deleteSoSaleVo.setDataSourceCode("lets_u8c");
|
deleteSoSaleVo.setDataSourceCode("lets_u8c");
|
||||||
deleteSoSaleVo.setCsaleids(concatenatedIds);
|
deleteSoSaleVo.setCsaleids(concatenatedIds);
|
||||||
deleteSoSaleVo.setFstatus("1");
|
deleteSoSaleVo.setFstatus("1");//自由状态
|
||||||
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities2 = deleteU8cDataUtilDao.querySoSaleByDeletev2(deleteSoSaleVo);
|
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities2 = deleteU8cDataUtilDao.querySoSaleByDeletev2(deleteSoSaleVo);
|
||||||
Map<String, List<DeleteU8cDataUtilEntity>> deleteU8cDataUtilEntitiesMap = groupByDbilldatev2(deleteU8cDataUtilEntities2);
|
Map<String, List<DeleteU8cDataUtilEntity>> deleteU8cDataUtilEntitiesMap = groupByDbilldatev2(deleteU8cDataUtilEntities2);
|
||||||
if (deleteU8cDataUtilEntitiesMap.size() > 0) {
|
if (deleteU8cDataUtilEntitiesMap.size() > 0) {
|
||||||
|
@ -1422,10 +1459,11 @@ public class DeleteU8cDataUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//再次确认是否存在已经修复完毕,但未审核的销售订单
|
||||||
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities22All = new ArrayList<>();
|
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities22All = new ArrayList<>();
|
||||||
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities2 = deleteU8cDataUtilDao.cancelSignatureSoSaleReadExcel20250528V2();
|
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities2 = deleteU8cDataUtilDao.cancelSignatureSoSaleReadExcel20250528V3();
|
||||||
if (deleteU8cDataUtilEntities2 != null) {
|
if (deleteU8cDataUtilEntities2 != null) {
|
||||||
List<List<DeleteU8cDataUtilEntity>> lists = SplitListByCountUtil.splitListByCount(deleteU8cDataUtilEntities, 999);
|
List<List<DeleteU8cDataUtilEntity>> lists = SplitListByCountUtil.splitListByCount(deleteU8cDataUtilEntities2, 999);
|
||||||
for (int i = 0; i < lists.size(); i++) {
|
for (int i = 0; i < lists.size(); i++) {
|
||||||
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities1 = lists.get(i);
|
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities1 = lists.get(i);
|
||||||
String concatenatedIds = deleteU8cDataUtilEntities1.stream().map(DeleteU8cDataUtilEntity::getCsaleid).map(csaleid -> "'" + csaleid + "'").collect(Collectors.joining(","));
|
String concatenatedIds = deleteU8cDataUtilEntities1.stream().map(DeleteU8cDataUtilEntity::getCsaleid).map(csaleid -> "'" + csaleid + "'").collect(Collectors.joining(","));
|
||||||
|
|
|
@ -121,4 +121,11 @@ public interface DeleteU8cDataUtilDao extends IBaseDao<DeleteU8cDataUtilEntity,
|
||||||
* @author liuyang
|
* @author liuyang
|
||||||
*/
|
*/
|
||||||
List<ArapDjzbVo> abandonmentAccountsReceivableDocV2(DeleteSoSaleVo deleteSoSaleVo) throws Exception;
|
List<ArapDjzbVo> abandonmentAccountsReceivableDocV2(DeleteSoSaleVo deleteSoSaleVo) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询已经修复完毕的销售订单
|
||||||
|
*
|
||||||
|
* @author liuyang
|
||||||
|
*/
|
||||||
|
List<DeleteU8cDataUtilEntity> cancelSignatureSoSaleReadExcel20250528V3() throws Exception;
|
||||||
}
|
}
|
|
@ -108,5 +108,9 @@ public class DeleteU8cDataUtilDaoImpl extends MybatisGenericDao<DeleteU8cDataUti
|
||||||
public List<ArapDjzbVo> abandonmentAccountsReceivableDocV2(DeleteSoSaleVo deleteSoSaleVo) throws Exception {
|
public List<ArapDjzbVo> abandonmentAccountsReceivableDocV2(DeleteSoSaleVo deleteSoSaleVo) throws Exception {
|
||||||
return (List<ArapDjzbVo>) selectList("com.hzya.frame.deletedata.dao.impl.DeleteU8cDataUtilDaoImpl.abandonmentAccountsReceivableDocV2", deleteSoSaleVo);
|
return (List<ArapDjzbVo>) selectList("com.hzya.frame.deletedata.dao.impl.DeleteU8cDataUtilDaoImpl.abandonmentAccountsReceivableDocV2", deleteSoSaleVo);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DeleteU8cDataUtilEntity> cancelSignatureSoSaleReadExcel20250528V3() throws Exception {
|
||||||
|
return query("com.hzya.frame.deletedata.dao.impl.DeleteU8cDataUtilDaoImpl.cancelSignatureSoSaleReadExcel20250528V3", new DeleteU8cDataUtilEntity());
|
||||||
|
}
|
||||||
|
}
|
|
@ -431,5 +431,51 @@
|
||||||
<result property="unitcode" column="unitcode" jdbcType="VARCHAR"/>
|
<result property="unitcode" column="unitcode" jdbcType="VARCHAR"/>
|
||||||
<result property="djrq" column="djrq" jdbcType="VARCHAR"/>
|
<result property="djrq" column="djrq" jdbcType="VARCHAR"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="cancelSignatureSoSaleReadExcel20250528V3" resultMap="get-DeleteU8cDataUtilEntity-result" parameterType="com.hzya.frame.deletedata.entity.DeleteU8cDataUtilEntity">
|
||||||
|
SELECT-- 单据主键
|
||||||
|
a.csaleid,
|
||||||
|
-- 单据编码
|
||||||
|
a.vreceiptcode,
|
||||||
|
-- 单据对应公司主键
|
||||||
|
a.pk_corp,
|
||||||
|
-- 单据对应公司名称
|
||||||
|
b.unitname,
|
||||||
|
-- 单据对应公司编码
|
||||||
|
b.unitcode,
|
||||||
|
-- 单据对应的业务流程主键
|
||||||
|
a.cbiztype,
|
||||||
|
-- 单据对应的业务流程名称
|
||||||
|
d.businame,
|
||||||
|
-- 部门主键
|
||||||
|
a.cdeptid,
|
||||||
|
-- 部门名称
|
||||||
|
c.deptname,
|
||||||
|
-- 部门对应公司主键
|
||||||
|
c.pk_corp pk_corp2
|
||||||
|
FROM
|
||||||
|
so_sale a
|
||||||
|
LEFT JOIN bd_corp b ON a.PK_CORP = b.PK_CORP
|
||||||
|
LEFT JOIN bd_deptdoc c ON c.pk_deptdoc = a.cdeptid
|
||||||
|
LEFT JOIN bd_busitype d ON d.pk_busitype = a.cbiztype
|
||||||
|
WHERE
|
||||||
|
a.cbiztype IN (
|
||||||
|
SELECT
|
||||||
|
pk_busitype
|
||||||
|
FROM
|
||||||
|
bd_busitype
|
||||||
|
WHERE
|
||||||
|
( businame = 'TOC无源件退货入库' OR businame = 'TOC无源件退款' OR businame = 'TOC销售' OR businame = 'TOC冲发出商品' OR businame = 'TOC确认收入' OR businame = 'TOC销售退货' OR businame = 'TOC销售退款' )
|
||||||
|
)
|
||||||
|
AND a.dr = 0
|
||||||
|
AND a.dbilldate >= '2025-05-01'
|
||||||
|
AND a.dbilldate <= '2025-05-31'
|
||||||
|
AND a.cdeptid NOT IN ( SELECT pk_deptdoc FROM bd_deptdoc WHERE deptname = '业务部门' AND dr = 0 )
|
||||||
|
AND a.cdeptid IS NOT NULL
|
||||||
|
AND a.pk_corp = c.pk_corp
|
||||||
|
and a.fstatus in (1)
|
||||||
|
-- and a.csaleid = '1001A1100000000FC70H'
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue