refactor(deletedata): 优化删除 U8C 数据工具类- 添加了对删除销售订单前的参数校验
- 移除了冗余的代码片段 - 优化了部分方法的实现逻辑 - 调整了数据处理的批量大小 - 更新了 SQL 查询条件
This commit is contained in:
parent
1a093c1577
commit
c7c763bc60
|
@ -65,7 +65,7 @@ public class DeleteU8cDataUtil {
|
|||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
deleteTargetU8cData();
|
||||
// deleteTargetU8cData();
|
||||
}
|
||||
|
||||
public void deleteTargetU8cData() {
|
||||
|
@ -112,13 +112,13 @@ public class DeleteU8cDataUtil {
|
|||
//修复销售订单部门字段错误问题
|
||||
repairSoSaleDepartment();
|
||||
//销售订单审核
|
||||
salesOrderReviewV2();
|
||||
// salesOrderReviewV2();
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
throw new RuntimeException("等待线程完成时中断", e);
|
||||
}
|
||||
}
|
||||
}, "U8C单据逻辑处理");
|
||||
}, "U8C单据逻辑处理:修复销售订单部门字段错误问题");
|
||||
thread000.start();
|
||||
}
|
||||
|
||||
|
@ -1420,7 +1420,7 @@ public class DeleteU8cDataUtil {
|
|||
//注意⚠️这里只能审核已经修复完毕的销售订单!并且处理自由状态
|
||||
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities = deleteU8cDataUtilDao.cancelSignatureSoSaleReadExcel20250528V3();
|
||||
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++) {
|
||||
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities1 = lists.get(i);
|
||||
String concatenatedIds = deleteU8cDataUtilEntities1.stream().map(DeleteU8cDataUtilEntity::getCsaleid).map(csaleid -> "'" + csaleid + "'").collect(Collectors.joining(","));
|
||||
|
@ -1462,12 +1462,15 @@ public class DeleteU8cDataUtil {
|
|||
//再次确认是否存在已经修复完毕,但未审核的销售订单
|
||||
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities22All = new ArrayList<>();
|
||||
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities2 = deleteU8cDataUtilDao.cancelSignatureSoSaleReadExcel20250528V3();
|
||||
if (deleteU8cDataUtilEntities2 != null) {
|
||||
if (deleteU8cDataUtilEntities2 != null && deleteU8cDataUtilEntities2.size() > 0) {
|
||||
List<List<DeleteU8cDataUtilEntity>> lists = SplitListByCountUtil.splitListByCount(deleteU8cDataUtilEntities2, 999);
|
||||
for (int i = 0; i < lists.size(); i++) {
|
||||
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities1 = lists.get(i);
|
||||
String concatenatedIds = deleteU8cDataUtilEntities1.stream().map(DeleteU8cDataUtilEntity::getCsaleid).map(csaleid -> "'" + csaleid + "'").collect(Collectors.joining(","));
|
||||
|
||||
if (concatenatedIds == null || "".equals(concatenatedIds.trim())) {
|
||||
throw new Exception("concatenatedIds == null || \"\".equals(concatenatedIds)");
|
||||
}
|
||||
DeleteSoSaleVo deleteSoSaleVo = new DeleteSoSaleVo();
|
||||
deleteSoSaleVo.setDataSourceCode("lets_u8c");
|
||||
deleteSoSaleVo.setCsaleids(concatenatedIds);
|
||||
|
@ -1490,89 +1493,89 @@ public class DeleteU8cDataUtil {
|
|||
*
|
||||
* @author liuyang
|
||||
*/
|
||||
public void unApprovalDeleteAccountsReceivable() {
|
||||
try {
|
||||
//确定销售订单范围、19648
|
||||
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities = deleteU8cDataUtilDao.cancelSignatureSoSaleReadExcel20250528V2();
|
||||
if (deleteU8cDataUtilEntities.size() > 0) {
|
||||
List<List<DeleteU8cDataUtilEntity>> lists = SplitListByCountUtil.splitListByCount(deleteU8cDataUtilEntities, 500);
|
||||
for (int i = 0; i < lists.size(); i++) {
|
||||
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities1 = lists.get(i);
|
||||
String concatenatedIds = deleteU8cDataUtilEntities1.stream().map(DeleteU8cDataUtilEntity::getCsaleid).map(csaleid -> "'" + csaleid + "'").collect(Collectors.joining(","));
|
||||
//查询需要弃审的应收单
|
||||
Map<String, List<Map<String, String>>> mapList = new HashMap();
|
||||
List<Map<String, String>> mapList1 = new ArrayList<>();
|
||||
|
||||
DeleteSoSaleVo deleteSoSaleVo = new DeleteSoSaleVo();
|
||||
deleteSoSaleVo.setCsaleid(concatenatedIds);
|
||||
deleteSoSaleVo.setSpzt("1");
|
||||
List<ArapDjzbVo> arapDjzbVos = deleteU8cDataUtilDao.abandonmentAccountsReceivableDocV2(deleteSoSaleVo);
|
||||
if (arapDjzbVos != null && arapDjzbVos.size() > 0) {
|
||||
for (int j = 0; j < arapDjzbVos.size(); j++) {
|
||||
ArapDjzbVo arapDjzbVo = arapDjzbVos.get(j);
|
||||
|
||||
Map<String, String> stringStringMap = new HashMap<>();
|
||||
stringStringMap.put("djbh", arapDjzbVo.getDjbh());//单据编码
|
||||
stringStringMap.put("dwbm", arapDjzbVo.getUnitcode());//公司编码
|
||||
stringStringMap.put("operatedate", arapDjzbVo.getDjrq());//单据日期
|
||||
stringStringMap.put("operatorid", "18846145294");//操作人编码
|
||||
mapList1.add(stringStringMap);
|
||||
}
|
||||
}
|
||||
|
||||
if (mapList1.size() > 0) {
|
||||
mapList.put("bills", mapList1);
|
||||
// sendU8C("http://39.170.109.90:8088/u8cloud/api/arap/ys/unaudit", JSON.toJSONString(mapList), mapList1.size());
|
||||
}
|
||||
|
||||
//删除应收单
|
||||
DeleteSoSaleVo deleteSoSaleVo2 = new DeleteSoSaleVo();
|
||||
deleteSoSaleVo2.setCsaleid(concatenatedIds);
|
||||
// deleteSoSaleVo2.setSpzt("1");
|
||||
deleteSoSaleVo2.setSpztnull("1");//a.spzt is null
|
||||
List<ArapDjzbVo> arapDjzbVos2 = deleteU8cDataUtilDao.abandonmentAccountsReceivableDocV2(deleteSoSaleVo2);
|
||||
for (int j = 0; j < arapDjzbVos2.size(); j++) {
|
||||
ArapDjzbVo arapDjzbVo = arapDjzbVos2.get(j);
|
||||
|
||||
Map<String, String> stringStringMap = new HashMap<>();
|
||||
stringStringMap.put("coperator", "tbadmin");
|
||||
|
||||
Map<String, String> stringStringMap2 = new HashMap<>();
|
||||
stringStringMap2.put("dwbm", arapDjzbVo.getUnitcode());
|
||||
stringStringMap2.put("djbh_from", arapDjzbVo.getDjbh());
|
||||
stringStringMap2.put("djbh_to", arapDjzbVo.getDjbh());
|
||||
|
||||
Map<String, Map<String, String>> stringStringMap3 = new HashMap<>();
|
||||
stringStringMap3.put("deleteinfo", stringStringMap);
|
||||
stringStringMap3.put("queryinfo", stringStringMap2);
|
||||
// sendU8C("http://39.170.109.90:8088/u8cloud/api/arap/ys/delete", JSON.toJSONString(stringStringMap3), 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//判断是否存在失败的应收单
|
||||
List<ArapDjzbVo> arapDjzbVosAll = new ArrayList<>();
|
||||
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities2 = deleteU8cDataUtilDao.cancelSignatureSoSaleReadExcel20250528V2();
|
||||
if (deleteU8cDataUtilEntities2.size() > 0) {
|
||||
List<List<DeleteU8cDataUtilEntity>> lists = SplitListByCountUtil.splitListByCount(deleteU8cDataUtilEntities2, 999);
|
||||
for (int i = 0; i < lists.size(); i++) {
|
||||
List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities1 = lists.get(i);
|
||||
String concatenatedIds = deleteU8cDataUtilEntities1.stream().map(DeleteU8cDataUtilEntity::getCsaleid).map(csaleid -> "'" + csaleid + "'").collect(Collectors.joining(","));
|
||||
|
||||
DeleteSoSaleVo deleteSoSaleVo = new DeleteSoSaleVo();
|
||||
deleteSoSaleVo.setCsaleid(concatenatedIds);
|
||||
deleteSoSaleVo.setSpzt("0,1,2,null");
|
||||
List<ArapDjzbVo> arapDjzbVos = deleteU8cDataUtilDao.abandonmentAccountsReceivableDocV2(deleteSoSaleVo);
|
||||
arapDjzbVosAll.addAll(arapDjzbVos);
|
||||
}
|
||||
}
|
||||
if (arapDjzbVosAll.size() > 0) {
|
||||
unApprovalDeleteAccountsReceivable();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
// public void unApprovalDeleteAccountsReceivable() {
|
||||
// try {
|
||||
// //确定销售订单范围、19648
|
||||
// List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities = deleteU8cDataUtilDao.cancelSignatureSoSaleReadExcel20250528V2();
|
||||
// if (deleteU8cDataUtilEntities.size() > 0) {
|
||||
// List<List<DeleteU8cDataUtilEntity>> lists = SplitListByCountUtil.splitListByCount(deleteU8cDataUtilEntities, 500);
|
||||
// for (int i = 0; i < lists.size(); i++) {
|
||||
// List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities1 = lists.get(i);
|
||||
// String concatenatedIds = deleteU8cDataUtilEntities1.stream().map(DeleteU8cDataUtilEntity::getCsaleid).map(csaleid -> "'" + csaleid + "'").collect(Collectors.joining(","));
|
||||
// //查询需要弃审的应收单
|
||||
// Map<String, List<Map<String, String>>> mapList = new HashMap();
|
||||
// List<Map<String, String>> mapList1 = new ArrayList<>();
|
||||
//
|
||||
// DeleteSoSaleVo deleteSoSaleVo = new DeleteSoSaleVo();
|
||||
// deleteSoSaleVo.setCsaleid(concatenatedIds);
|
||||
// deleteSoSaleVo.setSpzt("1");
|
||||
// List<ArapDjzbVo> arapDjzbVos = deleteU8cDataUtilDao.abandonmentAccountsReceivableDocV2(deleteSoSaleVo);
|
||||
// if (arapDjzbVos != null && arapDjzbVos.size() > 0) {
|
||||
// for (int j = 0; j < arapDjzbVos.size(); j++) {
|
||||
// ArapDjzbVo arapDjzbVo = arapDjzbVos.get(j);
|
||||
//
|
||||
// Map<String, String> stringStringMap = new HashMap<>();
|
||||
// stringStringMap.put("djbh", arapDjzbVo.getDjbh());//单据编码
|
||||
// stringStringMap.put("dwbm", arapDjzbVo.getUnitcode());//公司编码
|
||||
// stringStringMap.put("operatedate", arapDjzbVo.getDjrq());//单据日期
|
||||
// stringStringMap.put("operatorid", "18846145294");//操作人编码
|
||||
// mapList1.add(stringStringMap);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// if (mapList1.size() > 0) {
|
||||
// mapList.put("bills", mapList1);
|
||||
//// sendU8C("http://39.170.109.90:8088/u8cloud/api/arap/ys/unaudit", JSON.toJSONString(mapList), mapList1.size());
|
||||
// }
|
||||
//
|
||||
// //删除应收单
|
||||
// DeleteSoSaleVo deleteSoSaleVo2 = new DeleteSoSaleVo();
|
||||
// deleteSoSaleVo2.setCsaleid(concatenatedIds);
|
||||
//// deleteSoSaleVo2.setSpzt("1");
|
||||
// deleteSoSaleVo2.setSpztnull("1");//a.spzt is null
|
||||
// List<ArapDjzbVo> arapDjzbVos2 = deleteU8cDataUtilDao.abandonmentAccountsReceivableDocV2(deleteSoSaleVo2);
|
||||
// for (int j = 0; j < arapDjzbVos2.size(); j++) {
|
||||
// ArapDjzbVo arapDjzbVo = arapDjzbVos2.get(j);
|
||||
//
|
||||
// Map<String, String> stringStringMap = new HashMap<>();
|
||||
// stringStringMap.put("coperator", "tbadmin");
|
||||
//
|
||||
// Map<String, String> stringStringMap2 = new HashMap<>();
|
||||
// stringStringMap2.put("dwbm", arapDjzbVo.getUnitcode());
|
||||
// stringStringMap2.put("djbh_from", arapDjzbVo.getDjbh());
|
||||
// stringStringMap2.put("djbh_to", arapDjzbVo.getDjbh());
|
||||
//
|
||||
// Map<String, Map<String, String>> stringStringMap3 = new HashMap<>();
|
||||
// stringStringMap3.put("deleteinfo", stringStringMap);
|
||||
// stringStringMap3.put("queryinfo", stringStringMap2);
|
||||
//// sendU8C("http://39.170.109.90:8088/u8cloud/api/arap/ys/delete", JSON.toJSONString(stringStringMap3), 1);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //判断是否存在失败的应收单
|
||||
// List<ArapDjzbVo> arapDjzbVosAll = new ArrayList<>();
|
||||
// List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities2 = deleteU8cDataUtilDao.cancelSignatureSoSaleReadExcel20250528V2();
|
||||
// if (deleteU8cDataUtilEntities2.size() > 0) {
|
||||
// List<List<DeleteU8cDataUtilEntity>> lists = SplitListByCountUtil.splitListByCount(deleteU8cDataUtilEntities2, 999);
|
||||
// for (int i = 0; i < lists.size(); i++) {
|
||||
// List<DeleteU8cDataUtilEntity> deleteU8cDataUtilEntities1 = lists.get(i);
|
||||
// String concatenatedIds = deleteU8cDataUtilEntities1.stream().map(DeleteU8cDataUtilEntity::getCsaleid).map(csaleid -> "'" + csaleid + "'").collect(Collectors.joining(","));
|
||||
//
|
||||
// DeleteSoSaleVo deleteSoSaleVo = new DeleteSoSaleVo();
|
||||
// deleteSoSaleVo.setCsaleid(concatenatedIds);
|
||||
// deleteSoSaleVo.setSpzt("0,1,2,null");
|
||||
// List<ArapDjzbVo> arapDjzbVos = deleteU8cDataUtilDao.abandonmentAccountsReceivableDocV2(deleteSoSaleVo);
|
||||
// arapDjzbVosAll.addAll(arapDjzbVos);
|
||||
// }
|
||||
// }
|
||||
// if (arapDjzbVosAll.size() > 0) {
|
||||
// unApprovalDeleteAccountsReceivable();
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* 汇总相同时间+公司的单据
|
||||
|
@ -1589,4 +1592,4 @@ public class DeleteU8cDataUtil {
|
|||
// }
|
||||
// return resultMap;
|
||||
// }
|
||||
}
|
||||
}
|
|
@ -58,6 +58,12 @@ public class DeleteU8cDataUtilDaoImpl extends MybatisGenericDao<DeleteU8cDataUti
|
|||
@DS("lets_u8c")
|
||||
@Override
|
||||
public List<DeleteU8cDataUtilEntity> querySoSaleByDeletev2(DeleteSoSaleVo deleteSoSaleVo) throws Exception {
|
||||
if (deleteSoSaleVo.getCsaleids() == null || "".equals(deleteSoSaleVo.getCsaleids())) {
|
||||
throw new Exception("deleteSoSaleVo.getCsaleids() == null || \"\".equals(deleteSoSaleVo.getCsaleids())");
|
||||
}
|
||||
// if (deleteSoSaleVo.getFstatus() == null || "".equals(deleteSoSaleVo.getFstatus())) {
|
||||
// throw new Exception("deleteSoSaleVo.getFstatus() == null || \"\".equals(deleteSoSaleVo.getFstatus())");
|
||||
// }
|
||||
return query("com.hzya.frame.deletedata.dao.impl.DeleteU8cDataUtilDaoImpl.querySoSaleByDeletev2", deleteSoSaleVo);
|
||||
}
|
||||
|
||||
|
@ -109,6 +115,7 @@ public class DeleteU8cDataUtilDaoImpl extends MybatisGenericDao<DeleteU8cDataUti
|
|||
return (List<ArapDjzbVo>) selectList("com.hzya.frame.deletedata.dao.impl.DeleteU8cDataUtilDaoImpl.abandonmentAccountsReceivableDocV2", deleteSoSaleVo);
|
||||
}
|
||||
|
||||
@DS("lets_u8c")
|
||||
@Override
|
||||
public List<DeleteU8cDataUtilEntity> cancelSignatureSoSaleReadExcel20250528V3() throws Exception {
|
||||
return query("com.hzya.frame.deletedata.dao.impl.DeleteU8cDataUtilDaoImpl.cancelSignatureSoSaleReadExcel20250528V3", new DeleteU8cDataUtilEntity());
|
||||
|
|
|
@ -311,7 +311,7 @@
|
|||
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.csaleid = '1001A1100000000FC70H'
|
||||
-- and a.csaleid = '1001A1100000000FBSGV'
|
||||
</select>
|
||||
|
||||
<!--查询审批状态下的销售发票-->
|
||||
|
|
Loading…
Reference in New Issue