refactor(uapbd): 重构 ErpSaleOrderToBIPBackgroupWorkPlugin 类
- 添加日志记录功能,增加系统日志打印 - 优化代码结构,提高代码可读性和维护性- 移除冗余的异常捕获类型
This commit is contained in:
parent
17e581ccbd
commit
891d4fa74d
|
@ -6,6 +6,7 @@ import com.google.gson.Gson;
|
|||
import com.yonyou.cloud.utils.StringUtils;
|
||||
import nc.bs.dao.BaseDAO;
|
||||
import nc.bs.dao.DAOException;
|
||||
import nc.bs.logging.Log;
|
||||
import nc.bs.pub.pa.PreAlertObject;
|
||||
import nc.bs.pub.taskcenter.BgWorkingContext;
|
||||
import nc.bs.pub.taskcenter.IBackgroundWorkPlugin;
|
||||
|
@ -34,7 +35,6 @@ import java.nio.charset.Charset;
|
|||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.sql.SQLException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
@ -47,7 +47,7 @@ import java.util.zip.GZIPInputStream;
|
|||
* @date 2025/3/26
|
||||
*/
|
||||
public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlugin {
|
||||
|
||||
private static final Log logger = Log.getInstance("syscron");
|
||||
|
||||
private HYSuperDMO superDMO = null;
|
||||
private String baseUrl = "https://www.tkkfbip.com";
|
||||
|
@ -133,10 +133,10 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
|
|||
}
|
||||
|
||||
for (Map<String, String> map : l_pk) {
|
||||
//用标志位flag判断来源(1:销售发票,2:出库单)
|
||||
// 用标志位flag判断来源(1:销售发票,2:出库单)
|
||||
String flag = map.get("flag");
|
||||
StringBuffer sb = new StringBuffer();
|
||||
if("2".equals(flag)){
|
||||
if ("2".equals(flag)) {
|
||||
sb.append(" select ic_saleout_b.cgeneralbid as csaleinvoicebid,so_saleorder.vdef9,so_saleorder_b.vbdef11, so_saleorder_b.fretexchange, so_saleorder_b.cexchangesrcretid, so_saleorder_exe.narrangemonum, so_saleorder_exe.ntotalreturnnum, so_saleorder_exe.ntotalrednum," +
|
||||
" so_saleorder_exe.ntotalarmny as totalaccrued ,so_saleorder_exe.ntotalinvoicenum as billqty, NVL(so_saleorder_exe.ntotaloutnum, 0) as totaloutqty ");
|
||||
sb.append(" from so_saleorder_exe,ic_saleout_b,ic_saleout_h,so_saleorder_b,so_saleorder ");
|
||||
|
@ -147,7 +147,7 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
|
|||
sb.append(" and so_saleorder_exe.dr=0 and so_saleorder.dr=0 and so_saleorder_b.dr=0 ");
|
||||
sb.append(" and nvl(so_saleorder.vdef9,'~') not in ('~') ");
|
||||
sb.append(" and so_saleorder_exe.csaleorderbid='").append(map.get("cfirstbid")).append("'");
|
||||
}else{
|
||||
} else {
|
||||
sb.append(" select so_saleinvoice_b.csaleinvoicebid,so_saleorder.vdef9,so_saleorder_b.vbdef11,so_saleorder_b.fretexchange, so_saleorder_b.cexchangesrcretid, so_saleorder_exe.narrangemonum, so_saleorder_exe.ntotalreturnnum, so_saleorder_exe.ntotalrednum, so_saleorder_exe.ntotalarmny as totalaccrued ,so_saleorder_exe.ntotalinvoicenum as billqty, NVL(so_saleorder_exe.ntotaloutnum, 0) as totaloutqty ");
|
||||
sb.append(" from so_saleorder_exe,so_saleinvoice_b,so_saleinvoice,so_saleorder_b,so_saleorder ");
|
||||
sb.append(" where so_saleorder_exe.csaleorderbid=so_saleinvoice_b.csrcbid ");
|
||||
|
@ -194,27 +194,27 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
|
|||
b_map.put("ntotalrednum", custpkmap.get("ntotalrednum")); // 累计回冲主数量
|
||||
|
||||
|
||||
|
||||
l_map_f.add(b_map);
|
||||
|
||||
js_apct.put("contractOrdersList", l_map_f);
|
||||
js_apct.put("id", hid);
|
||||
|
||||
js_apct_detail.put("HTXSDD", js_apct);
|
||||
|
||||
logger.error("ErpSaleOrderToBIPBackgroupWorkPlugin-param = " + js_apct_detail.toJSONString());
|
||||
String resultString = doSendHttp(custUpdateUrl, "POST", tokenParam, "", headers, js_apct_detail.toJSONString());
|
||||
logger.error("ErpSaleOrderToBIPBackgroupWorkPlugin-res = " + resultString);
|
||||
Map updateMap = gson.fromJson(resultString, Map.class);
|
||||
String updateSql = "";
|
||||
if (StringUtils.equals("200", updateMap.get("code").toString())) {// 保存更新成功后需要更新日志表
|
||||
if("1".equals(flag)){
|
||||
if ("1".equals(flag)) {
|
||||
updateSql = "update so_saleinvoice_b set vbdef10='Y' where csaleinvoicebid='" + map.get("csaleinvoicebid") + "'";
|
||||
} else {
|
||||
updateSql = "update ic_saleout_b set vbdef4='Y' where cgeneralbid='" + map.get("csaleinvoicebid") + "'";
|
||||
}
|
||||
} else {
|
||||
if("1".equals(flag)) {
|
||||
if ("1".equals(flag)) {
|
||||
updateSql = "update so_saleinvoice_b set vbdef10='N' where csaleinvoicebid='" + map.get("csaleinvoicebid") + "'";
|
||||
}else{
|
||||
} else {
|
||||
updateSql = "update ic_saleout_b set vbdef4='N' where cgeneralbid='" + map.get("csaleinvoicebid") + "'";
|
||||
}
|
||||
}
|
||||
|
@ -223,19 +223,8 @@ public class ErpSaleOrderToBIPBackgroupWorkPlugin implements IBackgroundWorkPlug
|
|||
}
|
||||
}
|
||||
|
||||
} catch (InvalidKeyException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}// 获取BIP的token
|
||||
catch (SQLException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
logger.error("ErpSaleOrderToBIPBackgroupWorkPlugin-exp: " + e.getMessage(), e);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue