171 lines
7.2 KiB
Java
171 lines
7.2 KiB
Java
package com.hzya.frame.deletedata;
|
||
|
||
import cn.hutool.http.HttpRequest;
|
||
import com.alibaba.fastjson.JSON;
|
||
//import com.alibaba.fastjson.JSONObject;
|
||
import com.hzya.frame.deletedata.dao.DeleteU8cDataUtilDao;
|
||
import com.hzya.frame.deletedata.entity.DeleteU8cDataUtilEntity;
|
||
//import com.hzya.frame.plugin.lets.dao.ISoSaleinvoiceDao;
|
||
//import com.hzya.frame.plugin.lets.entity.SoSaleinvoiceEntity;
|
||
//import com.hzya.frame.plugin.lets.u8cdto.ReusltStrDto;
|
||
import com.hzya.frame.deletedata.vo.*;
|
||
import org.apache.logging.log4j.LogManager;
|
||
import org.apache.logging.log4j.Logger;
|
||
//import org.junit.jupiter.api.Test;
|
||
import org.springframework.beans.factory.annotation.Autowired;
|
||
import org.springframework.stereotype.Component;
|
||
|
||
import java.util.List;
|
||
|
||
/**
|
||
* @Author:liuyang
|
||
* @Package:com.hzya.frame.plugin.lets.util
|
||
* @Project:kangarooDataCenterV3
|
||
* @name:DeleteU8cDataUtil
|
||
* @Date:2024/12/18 18:35
|
||
* @Filename:DeleteU8cDataUtil
|
||
*/
|
||
@Component
|
||
public class DeleteU8cDataUtil {
|
||
|
||
@Autowired
|
||
private DeleteU8cDataUtilDao deleteU8cDataUtilDao;
|
||
|
||
protected Logger logger = LogManager.getLogger(super.getClass());
|
||
|
||
private static final Object LOCK_OBJECT = new Object();
|
||
|
||
public void deleteTargetU8cData() {
|
||
Thread thread = new Thread(new Runnable() {
|
||
@Override
|
||
public void run() {
|
||
synchronized (LOCK_OBJECT) {
|
||
//删除销售发票
|
||
// deleteSoSaleinvoice();
|
||
//删除销售出库单
|
||
// deleteIcGeneralH();
|
||
//删除销售订单
|
||
// deleteSoSale();
|
||
}
|
||
}
|
||
}, "删除U8C11月份TOC对应的销售发票、销售出库单、销售订单");
|
||
thread.start();
|
||
}
|
||
|
||
/**
|
||
* 删除销售订单
|
||
*/
|
||
public void deleteSoSale() {
|
||
try {
|
||
DeleteSoSaleVo deleteSoSaleVo = new DeleteSoSaleVo();
|
||
deleteSoSaleVo.setDataSourceCode("lets_u8c");
|
||
List<DeleteU8cDataUtilEntity> soSaleinvoiceEntities = deleteU8cDataUtilDao.querySoSaleByDelete(deleteSoSaleVo);
|
||
logger.info("条数:{}", soSaleinvoiceEntities.size());
|
||
if (soSaleinvoiceEntities != null && soSaleinvoiceEntities.size() > 0) {
|
||
for (int i = 0; i < soSaleinvoiceEntities.size(); i++) {
|
||
DeleteU8cDataUtilEntity deleteU8cDataUtilEntity = soSaleinvoiceEntities.get(i);
|
||
|
||
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.setCode(deleteU8cDataUtilEntity.getVreceiptcode());
|
||
|
||
JsonRootBean jsonRootBean = new JsonRootBean();
|
||
jsonRootBean.setDeleteinfo(deleteinfo);
|
||
jsonRootBean.setQueryinfo(queryinfo);
|
||
sendU8C("http://39.170.109.90:8088/u8cloud/api/so/saleorder/delete", JSON.toJSONString(jsonRootBean));
|
||
}
|
||
}
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 删除销售出库单
|
||
*/
|
||
public void deleteIcGeneralH() {
|
||
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) {
|
||
for (int i = 0; i < soSaleinvoiceEntities.size(); i++) {
|
||
DeleteU8cDataUtilEntity deleteU8cDataUtilEntity = soSaleinvoiceEntities.get(i);
|
||
|
||
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);
|
||
sendU8C("http://39.170.109.90:8088/u8cloud/api/ic/saleout/delete", JSON.toJSONString(jsonRootBean));
|
||
}
|
||
}
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
}
|
||
}
|
||
|
||
/**
|
||
* 删除销售发票
|
||
*/
|
||
public void deleteSoSaleinvoice() {
|
||
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) {
|
||
for (int i = 0; i < soSaleinvoiceEntities.size(); i++) {
|
||
DeleteU8cDataUtilEntity deleteU8cDataUtilEntity = soSaleinvoiceEntities.get(i);
|
||
|
||
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.setCode(deleteU8cDataUtilEntity.getVreceiptcode());
|
||
|
||
JsonRootBean jsonRootBean = new JsonRootBean();
|
||
jsonRootBean.setDeleteInfo(deleteinfo);
|
||
jsonRootBean.setQueryInfo(queryinfo);
|
||
sendU8C("http://39.170.109.90:8088/u8cloud/api/so/saleinvoice/delete", JSON.toJSONString(jsonRootBean));
|
||
}
|
||
}
|
||
} catch (Exception e) {
|
||
e.printStackTrace();
|
||
}
|
||
}
|
||
|
||
|
||
/**
|
||
* 2024年8月8日 10:54:48
|
||
* 推送U8C销售订单方法
|
||
*
|
||
* @author liuyang
|
||
*/
|
||
public void sendU8C(String url, String param) throws Exception {
|
||
String result = HttpRequest.post(url).header("usercode", "admin1").header("password", "f7fcde654e968541cc803c4b08c30abb").header("system", "lz1").header("trantype", "code").body(param)//表单内容
|
||
.timeout(600000)//超时,毫秒
|
||
.execute().body();
|
||
logger.info(result);
|
||
// JSONObject jsonObject = JSON.parseObject(result);
|
||
// result = String.valueOf(jsonObject.get("attribute"));
|
||
// System.out.println(result);
|
||
}
|
||
}
|